commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
5b33405a6ac04324ac2fc7b82849a7370e996e85
Change Subsystem Init to Start() instead of StartOnServer(), otherwise Cross-matrices might not work correctly due to somethings not being initialized yet.
krille90/unitystation,fomalsd/unitystation,krille90/unitystation,Necromunger/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,Necromunger/unitystation,krille90/unitystation,Necromunger/unitystation
UnityProject/Assets/Scripts/Tilemaps/Behaviours/Meta/SubsystemManager.cs
UnityProject/Assets/Scripts/Tilemaps/Behaviours/Meta/SubsystemManager.cs
using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.Networking; public class SubsystemManager : NetworkBehaviour { private List<SubsystemBehaviour> systems = new List<SubsystemBehaviour>(); private bool initialized; private void Start() { if (isServer) { systems = systems.OrderByDescending(s => s.Priority).ToList(); Initialize(); } } private void Initialize() { for (int i = 0; i < systems.Count; i++) { systems[i].Initialize(); } initialized = true; } public void Register(SubsystemBehaviour system) { systems.Add(system); } public void UpdateAt(Vector3Int position) { if (!initialized) { return; } for (int i = 0; i < systems.Count; i++) { systems[i].UpdateAt(position); } } }
using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.Networking; public class SubsystemManager : NetworkBehaviour { private List<SubsystemBehaviour> systems = new List<SubsystemBehaviour>(); private bool initialized; public override void OnStartServer() { systems = systems.OrderByDescending(s => s.Priority).ToList(); Initialize(); } private void Initialize() { for (int i = 0; i < systems.Count; i++) { systems[i].Initialize(); } initialized = true; } public void Register(SubsystemBehaviour system) { systems.Add(system); } public void UpdateAt(Vector3Int position) { if (!initialized) { return; } for (int i = 0; i < systems.Count; i++) { systems[i].UpdateAt(position); } } }
agpl-3.0
C#
30325c04d38fbaedc97cca56caa7d749864f8399
Add extra virtual channel looping test
peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework
osu.Framework.Tests/Audio/SampleChannelVirtualTest.cs
osu.Framework.Tests/Audio/SampleChannelVirtualTest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Threading; using NUnit.Framework; using osu.Framework.Audio.Sample; using osu.Framework.Development; using osu.Framework.Threading; namespace osu.Framework.Tests.Audio { [TestFixture] public class SampleChannelVirtualTest { private Sample sample; [SetUp] public void Setup() { sample = new SampleVirtual(); updateSample(); } [Test] public void TestStart() { var channel = sample.Play(); Assert.IsTrue(channel.Playing); Assert.IsFalse(channel.HasCompleted); updateSample(); Assert.IsFalse(channel.Playing); Assert.IsTrue(channel.HasCompleted); } [Test] public void TestLooping() { var channel = sample.Play(); channel.Looping = true; Assert.IsTrue(channel.Playing); Assert.IsFalse(channel.HasCompleted); updateSample(); Assert.IsTrue(channel.Playing); Assert.False(channel.HasCompleted); channel.Stop(); Assert.False(channel.Playing); Assert.IsTrue(channel.HasCompleted); } private void updateSample() => RunOnAudioThread(() => sample.Update()); /// <summary> /// Certain actions are invoked on the audio thread. /// Here we simulate this process on a correctly named thread to avoid endless blocking. /// </summary> /// <param name="action">The action to perform.</param> public static void RunOnAudioThread(Action action) { var resetEvent = new ManualResetEvent(false); new Thread(() => { ThreadSafety.IsAudioThread = true; action(); resetEvent.Set(); }) { Name = GameThread.PrefixedThreadNameFor("Audio") }.Start(); if (!resetEvent.WaitOne(TimeSpan.FromSeconds(10))) throw new TimeoutException(); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Threading; using NUnit.Framework; using osu.Framework.Audio.Sample; using osu.Framework.Development; using osu.Framework.Threading; namespace osu.Framework.Tests.Audio { [TestFixture] public class SampleChannelVirtualTest { private Sample sample; [SetUp] public void Setup() { sample = new SampleVirtual(); updateSample(); } [Test] public void TestStart() { var channel = sample.Play(); Assert.IsTrue(channel.Playing); Assert.IsFalse(channel.HasCompleted); updateSample(); Assert.IsFalse(channel.Playing); Assert.IsTrue(channel.HasCompleted); } private void updateSample() => RunOnAudioThread(() => sample.Update()); /// <summary> /// Certain actions are invoked on the audio thread. /// Here we simulate this process on a correctly named thread to avoid endless blocking. /// </summary> /// <param name="action">The action to perform.</param> public static void RunOnAudioThread(Action action) { var resetEvent = new ManualResetEvent(false); new Thread(() => { ThreadSafety.IsAudioThread = true; action(); resetEvent.Set(); }) { Name = GameThread.PrefixedThreadNameFor("Audio") }.Start(); if (!resetEvent.WaitOne(TimeSpan.FromSeconds(10))) throw new TimeoutException(); } } }
mit
C#
18e75b8522ea54f819e728efdf00e577852682b3
Add a test for SKSwizzle
mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp
tests/Tests/SKPixmapTest.cs
tests/Tests/SKPixmapTest.cs
using System; using System.Runtime.InteropServices; using Xunit; namespace SkiaSharp.Tests { public class SKPixmapTest : SKTest { [SkippableFact] public void ReadPixelSucceeds() { var info = new SKImageInfo(10, 10); var ptr1 = Marshal.AllocCoTaskMem(info.BytesSize); var pix1 = new SKPixmap(info, ptr1); var ptr2 = Marshal.AllocCoTaskMem(info.BytesSize); var result = pix1.ReadPixels(info, ptr2, info.RowBytes); Assert.True(result); } [SkippableFact] public void WithMethodsDoNotModifySource() { var info = new SKImageInfo(100, 30, SKColorType.Rgb565, SKAlphaType.Unpremul); var pixmap = new SKPixmap(info, (IntPtr)123); Assert.Equal(SKColorType.Rgb565, pixmap.ColorType); Assert.Equal((IntPtr)123, pixmap.GetPixels()); var copy = pixmap.WithColorType(SKColorType.Index8); Assert.Equal(SKColorType.Rgb565, pixmap.ColorType); Assert.Equal((IntPtr)123, pixmap.GetPixels()); Assert.Equal(SKColorType.Index8, copy.ColorType); Assert.Equal((IntPtr)123, copy.GetPixels()); } [SkippableFact] public void ReadPixelCopiesData() { var info = new SKImageInfo(10, 10); using (var bmp1 = new SKBitmap(info)) using (var pix1 = bmp1.PeekPixels()) using (var bmp2 = new SKBitmap(info)) using (var pix2 = bmp2.PeekPixels()) { bmp1.Erase(SKColors.Blue); bmp1.Erase(SKColors.Green); Assert.NotEqual(Marshal.ReadInt64(pix1.GetPixels()), Marshal.ReadInt64(pix2.GetPixels())); var result = pix1.ReadPixels(pix2); Assert.True(result); Assert.Equal(Marshal.ReadInt64(pix1.GetPixels()), Marshal.ReadInt64(pix2.GetPixels())); } } [SkippableFact] public void SwizzleSwapsRedAndBlue() { var info = new SKImageInfo(10, 10); using (var bmp = new SKBitmap(info)) { bmp.Erase(SKColors.Red); Assert.Equal(SKColors.Red, bmp.Pixels[0]); SKSwizzle.SwapRedBlue(bmp.GetPixels(out var length), info.Width * info.Height); Assert.Equal(SKColors.Blue, bmp.Pixels[0]); } } } }
using System; using System.Runtime.InteropServices; using Xunit; namespace SkiaSharp.Tests { public class SKPixmapTest : SKTest { [SkippableFact] public void ReadPixelSucceeds() { var info = new SKImageInfo(10, 10); var ptr1 = Marshal.AllocCoTaskMem(info.BytesSize); var pix1 = new SKPixmap(info, ptr1); var ptr2 = Marshal.AllocCoTaskMem(info.BytesSize); var result = pix1.ReadPixels(info, ptr2, info.RowBytes); Assert.True(result); } [SkippableFact] public void WithMethodsDoNotModifySource() { var info = new SKImageInfo(100, 30, SKColorType.Rgb565, SKAlphaType.Unpremul); var pixmap = new SKPixmap(info, (IntPtr)123); Assert.Equal(SKColorType.Rgb565, pixmap.ColorType); Assert.Equal((IntPtr)123, pixmap.GetPixels()); var copy = pixmap.WithColorType(SKColorType.Index8); Assert.Equal(SKColorType.Rgb565, pixmap.ColorType); Assert.Equal((IntPtr)123, pixmap.GetPixels()); Assert.Equal(SKColorType.Index8, copy.ColorType); Assert.Equal((IntPtr)123, copy.GetPixels()); } [SkippableFact] public void ReadPixelCopiesData() { var info = new SKImageInfo(10, 10); using (var bmp1 = new SKBitmap(info)) using (var pix1 = bmp1.PeekPixels()) using (var bmp2 = new SKBitmap(info)) using (var pix2 = bmp2.PeekPixels()) { bmp1.Erase(SKColors.Blue); bmp1.Erase(SKColors.Green); Assert.NotEqual(Marshal.ReadInt64(pix1.GetPixels()), Marshal.ReadInt64(pix2.GetPixels())); var result = pix1.ReadPixels(pix2); Assert.True(result); Assert.Equal(Marshal.ReadInt64(pix1.GetPixels()), Marshal.ReadInt64(pix2.GetPixels())); } } } }
mit
C#
5aa855ed9efa4c45be6b29b9d3f309a5cdf71e68
Fix method name in OnDisconnectAsync
albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,skynode/eShopOnContainers,albertodall/eShopOnContainers,skynode/eShopOnContainers,skynode/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,skynode/eShopOnContainers,dotnet-architecture/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,skynode/eShopOnContainers
src/Services/Ordering/Ordering.SignalrHub/NotificationHub.cs
src/Services/Ordering/Ordering.SignalrHub/NotificationHub.cs
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.SignalR; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Ordering.SignalrHub { [Authorize] public class NotificationsHub : Hub { public override async Task OnConnectedAsync() { await Groups.AddToGroupAsync(Context.ConnectionId, Context.User.Identity.Name); await base.OnConnectedAsync(); } public override async Task OnDisconnectedAsync(Exception ex) { await Groups.RemoveFromGroupAsync(Context.ConnectionId, Context.User.Identity.Name); await base.OnDisconnectedAsync(ex); } } }
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.SignalR; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Ordering.SignalrHub { [Authorize] public class NotificationsHub : Hub { public override async Task OnConnectedAsync() { await Groups.AddToGroupAsync(Context.ConnectionId, Context.User.Identity.Name); await base.OnConnectedAsync(); } public override async Task OnDisconnectedAsync(Exception ex) { await Groups.AddToGroupAsync(Context.ConnectionId, Context.User.Identity.Name); await base.OnDisconnectedAsync(ex); } } }
mit
C#
6686b095492abdd1eb0909eea6b57a6c33513b93
Hide F rank from beatmap overlay
ppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu
osu.Game/Overlays/BeatmapListing/BeatmapSearchScoreFilterRow.cs
osu.Game/Overlays/BeatmapListing/BeatmapSearchScoreFilterRow.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using System.Collections.Generic; using System.Linq; using osu.Framework.Extensions; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; using osu.Game.Scoring; namespace osu.Game.Overlays.BeatmapListing { public class BeatmapSearchScoreFilterRow : BeatmapSearchMultipleSelectionFilterRow<ScoreRank> { public BeatmapSearchScoreFilterRow() : base(BeatmapsStrings.ListingSearchFiltersRank) { } protected override MultipleSelectionFilter CreateMultipleSelectionFilter() => new RankFilter(); private class RankFilter : MultipleSelectionFilter { protected override MultipleSelectionFilterTabItem CreateTabItem(ScoreRank value) => new RankItem(value); protected override IEnumerable<ScoreRank> GetValues() => base.GetValues().Where(r => r > ScoreRank.F).Reverse(); } private class RankItem : MultipleSelectionFilterTabItem { public RankItem(ScoreRank value) : base(value) { } protected override LocalisableString LabelFor(ScoreRank value) => value.GetLocalisableDescription(); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using System.Collections.Generic; using System.Linq; using osu.Framework.Extensions; using osu.Framework.Localisation; using osu.Game.Resources.Localisation.Web; using osu.Game.Scoring; namespace osu.Game.Overlays.BeatmapListing { public class BeatmapSearchScoreFilterRow : BeatmapSearchMultipleSelectionFilterRow<ScoreRank> { public BeatmapSearchScoreFilterRow() : base(BeatmapsStrings.ListingSearchFiltersRank) { } protected override MultipleSelectionFilter CreateMultipleSelectionFilter() => new RankFilter(); private class RankFilter : MultipleSelectionFilter { protected override MultipleSelectionFilterTabItem CreateTabItem(ScoreRank value) => new RankItem(value); protected override IEnumerable<ScoreRank> GetValues() => base.GetValues().Reverse(); } private class RankItem : MultipleSelectionFilterTabItem { public RankItem(ScoreRank value) : base(value) { } protected override LocalisableString LabelFor(ScoreRank value) => value.GetLocalisableDescription(); } } }
mit
C#
aa3b667040f2b3b7724771c60f02275e7afde1ad
remove using of DebuggerNonUserCode
stsrki/fluentmigrator,amroel/fluentmigrator,modulexcite/fluentmigrator,IRlyDontKnow/fluentmigrator,barser/fluentmigrator,drmohundro/fluentmigrator,mstancombe/fluentmigrator,barser/fluentmigrator,spaccabit/fluentmigrator,jogibear9988/fluentmigrator,KaraokeStu/fluentmigrator,itn3000/fluentmigrator,alphamc/fluentmigrator,vgrigoriu/fluentmigrator,wolfascu/fluentmigrator,amroel/fluentmigrator,dealproc/fluentmigrator,drmohundro/fluentmigrator,lcharlebois/fluentmigrator,fluentmigrator/fluentmigrator,FabioNascimento/fluentmigrator,igitur/fluentmigrator,schambers/fluentmigrator,IRlyDontKnow/fluentmigrator,FabioNascimento/fluentmigrator,akema-fr/fluentmigrator,dealproc/fluentmigrator,itn3000/fluentmigrator,vgrigoriu/fluentmigrator,lcharlebois/fluentmigrator,MetSystem/fluentmigrator,bluefalcon/fluentmigrator,MetSystem/fluentmigrator,modulexcite/fluentmigrator,wolfascu/fluentmigrator,bluefalcon/fluentmigrator,tommarien/fluentmigrator,KaraokeStu/fluentmigrator,spaccabit/fluentmigrator,schambers/fluentmigrator,stsrki/fluentmigrator,jogibear9988/fluentmigrator,fluentmigrator/fluentmigrator,tommarien/fluentmigrator,igitur/fluentmigrator,alphamc/fluentmigrator,eloekset/fluentmigrator,akema-fr/fluentmigrator,eloekset/fluentmigrator,mstancombe/fluentmigrator
src/FluentMigrator/Expressions/MigrationExpressionBase.cs
src/FluentMigrator/Expressions/MigrationExpressionBase.cs
#region License // // Copyright (c) 2007-2009, Sean Chambers <schambers80@gmail.com> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.Collections.Generic; namespace FluentMigrator.Expressions { public abstract class MigrationExpressionBase : IMigrationExpression { public abstract void ExecuteWith(IMigrationProcessor processor); public abstract void CollectValidationErrors(ICollection<string> errors); public virtual IMigrationExpression Reverse() { throw new NotSupportedException(String.Format("The {0} cannot be automatically reversed", GetType().Name)); } public virtual void ApplyConventions(IMigrationConventions conventions) { // By default do nothing, if an expression convention supports this, they should override } public override string ToString() { return GetType().Name.Replace("Expression", "") + " "; } } }
#region License // // Copyright (c) 2007-2009, Sean Chambers <schambers80@gmail.com> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.Collections.Generic; using System.Diagnostics; namespace FluentMigrator.Expressions { public abstract class MigrationExpressionBase : IMigrationExpression { public abstract void ExecuteWith(IMigrationProcessor processor); public abstract void CollectValidationErrors(ICollection<string> errors); [DebuggerNonUserCode] //to ignore thrown exception on debug public virtual IMigrationExpression Reverse() { throw new NotSupportedException(String.Format("The {0} cannot be automatically reversed", GetType().Name)); } public virtual void ApplyConventions(IMigrationConventions conventions) { // By default do nothing, if an expression convention supports this, they should override } public override string ToString() { return GetType().Name.Replace("Expression", "") + " "; } } }
apache-2.0
C#
f116edb57243c1db8096de7d877fd9330291c072
Correct description for modulo
devatwork/Premotion-Mansion,devatwork/Premotion-Mansion,devatwork/Premotion-Mansion,Erikvl87/Premotion-Mansion,Erikvl87/Premotion-Mansion,Erikvl87/Premotion-Mansion,Erikvl87/Premotion-Mansion,devatwork/Premotion-Mansion
src/Premotion.Mansion.Core/ScriptFunctions/Math/Modulo.cs
src/Premotion.Mansion.Core/ScriptFunctions/Math/Modulo.cs
using Premotion.Mansion.Core.Scripting.ExpressionScript; namespace Premotion.Mansion.Core.ScriptFunctions.Math { /// <summary> /// Computes the remainder of division of the first- by the second number. /// </summary> [ScriptFunction("Modulo")] public class Modulo : FunctionExpression { /// <summary> /// </summary> /// <param name="context"></param> /// <param name="first"></param> /// <param name="second"></param> /// <returns></returns> public double Evaluate(IMansionContext context, double first, double second) { return first % second; } } }
using Premotion.Mansion.Core.Scripting.ExpressionScript; namespace Premotion.Mansion.Core.ScriptFunctions.Math { /// <summary> /// Modulo computes a remainder. Multiplies the first value with the second value. /// </summary> [ScriptFunction("Modulo")] public class Modulo : FunctionExpression { /// <summary> /// </summary> /// <param name="context"></param> /// <param name="first"></param> /// <param name="second"></param> /// <returns></returns> public double Evaluate(IMansionContext context, double first, double second) { return first % second; } } }
mit
C#
e6ba129c382d12c87483876b37f11f892a3bd580
Use predefined default size for embedded windows
wieslawsoltes/Perspex,jkoritzinsky/Avalonia,OronDF343/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,MrDaedra/Avalonia,danwalmsley/Perspex,punker76/Perspex,AvaloniaUI/Avalonia,susloparovdenis/Avalonia,kekekeks/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,jkoritzinsky/Perspex,susloparovdenis/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,MrDaedra/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,DavidKarlas/Perspex,susloparovdenis/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,OronDF343/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jazzay/Perspex,bbqchickenrobot/Perspex,tshcherban/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,kekekeks/Perspex,jkoritzinsky/Avalonia,akrisiun/Perspex,susloparovdenis/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex
src/Windows/Perspex.Win32/Embedding/EmbeddedWindowImpl.cs
src/Windows/Perspex.Win32/Embedding/EmbeddedWindowImpl.cs
// Copyright (c) The Perspex Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using Perspex.Win32.Interop; namespace Perspex.Win32 { public class EmbeddedWindowImpl : WindowImpl { private static readonly System.Windows.Forms.UserControl WinFormsControl = new System.Windows.Forms.UserControl(); public IntPtr Handle { get; private set; } protected override IntPtr CreateWindowOverride(ushort atom) { var hWnd = UnmanagedMethods.CreateWindowEx( 0, atom, null, (int)UnmanagedMethods.WindowStyles.WS_CHILD, 0, 0, 640, 480, WinFormsControl.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); Handle = hWnd; return hWnd; } } }
// Copyright (c) The Perspex Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using Perspex.Win32.Interop; namespace Perspex.Win32 { public class EmbeddedWindowImpl : WindowImpl { private static readonly System.Windows.Forms.UserControl WinFormsControl = new System.Windows.Forms.UserControl(); public IntPtr Handle { get; private set; } protected override IntPtr CreateWindowOverride(ushort atom) { var hWnd = UnmanagedMethods.CreateWindowEx( 0, atom, null, (int)UnmanagedMethods.WindowStyles.WS_CHILD, UnmanagedMethods.CW_USEDEFAULT, UnmanagedMethods.CW_USEDEFAULT, UnmanagedMethods.CW_USEDEFAULT, UnmanagedMethods.CW_USEDEFAULT, WinFormsControl.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); Handle = hWnd; return hWnd; } } }
mit
C#
109251a7ce43a383c4d687e4960c6bbea3b37531
Update AutoMapperConfiguration.cs - add StatInfoEntity, StatInfo map
NinjaVault/NinjaHive,NinjaVault/NinjaHive
NinjaHive.BusinessLayer/AutoMapperConfiguration.cs
NinjaHive.BusinessLayer/AutoMapperConfiguration.cs
using AutoMapper; using NinjaHive.Contract.DTOs; using NinjaHive.Domain; namespace NinjaHive.BusinessLayer { public class AutoMapperConfiguration { public static void Configure() { Mapper.CreateMap<EquipmentItemEntity, EquipmentItem>() .ForMember(destination => destination.UpgradeElement, options => options.MapFrom(source => source.IsUpgrader)) .ForMember(destination => destination.CraftingElement, options => options.MapFrom(source => source.IsCrafter)) .ForMember(destination => destination.QuestItem, options => options.MapFrom(source => source.IsQuestItem)); Mapper.CreateMap<SkillEntity, Skill>() .ForMember(destination => destination.TargetCount, options => options.MapFrom(source => source.Targets)); Mapper.CreateMap<StatInfoEntity, StatInfo>(); } }; }
using AutoMapper; using NinjaHive.Contract.DTOs; using NinjaHive.Domain; namespace NinjaHive.BusinessLayer { public class AutoMapperConfiguration { public static void Configure() { Mapper.CreateMap<EquipmentItemEntity, EquipmentItem>() .ForMember(destination => destination.UpgradeElement, options => options.MapFrom(source => source.IsUpgrader)) .ForMember(destination => destination.CraftingElement, options => options.MapFrom(source => source.IsCrafter)) .ForMember(destination => destination.QuestItem, options => options.MapFrom(source => source.IsQuestItem)); Mapper.CreateMap<SkillEntity, Skill>() .ForMember(destination => destination.TargetCount, options => options.MapFrom(source => source.Targets)); } }; }
apache-2.0
C#
da7941061c5ea75a0fc459cdf5eff2133ca0cf91
Add the return date, and change the long time string to short date string.
SoftwareDesign/Library,SoftwareDesign/Library,SoftwareDesign/Library
MMLibrarySystem/MMLibrarySystem/Views/Admin/Index.cshtml
MMLibrarySystem/MMLibrarySystem/Views/Admin/Index.cshtml
@model IEnumerable<MMLibrarySystem.Models.BorrowRecord> @{ ViewBag.Title = "Borrowed Books"; } <table id="bookList"> <tr> <td> Book Number </td> <td> Title </td> <td> Borrowed By </td> <td> Borrowed Start From </td> <td> Return Data </td> <td> State </td> <td> Operation </td> </tr> @{ foreach (var item in Model) { <tr> <td>@item.Book.BookNumber </td> <td>@item.Book.BookType.Title </td> <td>@item.User.DisplayName </td> <td>@item.BorrowedDate.ToShortDateString() </td> <td>@item.BorrowedDate.AddDays(31).ToShortDateString() </td> <td>@(item.IsCheckedOut ? "Checked Out" : "Borrow Accepted") </td> <td> @{ if (item.IsCheckedOut) { @Html.ActionLink("Return", "Return", "Admin", new { borrowId = @item.BorrowRecordId }, new { onclick = "return confirm('Are you sure to return this book?')" }) } else { @Html.ActionLink("Check Out", "CheckOut", "Admin", new { borrowId = @item.BorrowRecordId }, null) } } </td> </tr> } } </table>
@model IEnumerable<MMLibrarySystem.Models.BorrowRecord> @{ ViewBag.Title = "Borrowed Books"; } <table id="bookList"> <tr> <td> Book Number </td> <td> Title </td> <td> Borrowed By </td> <td> Borrowed Start From </td> <td> State </td> <td> Operation </td> </tr> @{ foreach (var item in Model) { <tr> <td>@item.Book.BookNumber </td> <td>@item.Book.BookType.Title </td> <td>@item.User.DisplayName </td> <td>@item.BorrowedDate </td> <td>@(item.IsCheckedOut ? "Checked Out" : "Borrow Accepted") </td> <td> @{ if (item.IsCheckedOut) { @Html.ActionLink("Return", "Return", "Admin", new { borrowId = @item.BorrowRecordId }, new { onclick = "return confirm('Are you sure to return this book?')" }) } else { @Html.ActionLink("Check Out", "CheckOut", "Admin", new { borrowId = @item.BorrowRecordId }, null) } } </td> </tr> } } </table>
apache-2.0
C#
e44f62a72a3c35d79ec942c8d4d10e0ef096ec2f
Fix controller organizationcontext misusage
os2kitos/kitos,os2kitos/kitos,os2kitos/kitos,os2kitos/kitos
Presentation.Web/Controllers/OData/ItSystemsController.cs
Presentation.Web/Controllers/OData/ItSystemsController.cs
using System.Linq; using System.Web.Http; using System.Web.OData; using System.Web.OData.Routing; using Core.DomainModel; using Core.DomainModel.ItSystem; using Core.DomainServices; using System.Net; using Core.ApplicationServices; using Presentation.Web.Access; namespace Presentation.Web.Controllers.OData { public partial class ItSystemsController : BaseEntityController<ItSystem> { private readonly IAuthenticationService _authService; private readonly IOrganizationContextFactory _contextFactory; public ItSystemsController(IGenericRepository<ItSystem> repository, IAuthenticationService authService, IOrganizationContextFactory contextFactory) : base(repository, authService) { _authService = authService; _contextFactory = contextFactory; } // GET /Organizations(1)/ItSystems [EnableQuery] [ODataRoute("Organizations({orgKey})/ItSystems")] public IHttpActionResult GetItSystems(int orgKey) { var organizationContext = _contextFactory.CreateOrganizationContext(orgKey); if (!organizationContext.AllowReads(UserId)) { return Forbidden(); } var result = Repository.AsQueryable().Where(m => m.OrganizationId == orgKey || m.AccessModifier == AccessModifier.Public); return Ok(result); } // GET /Organizations(1)/ItSystems(1) [EnableQuery] [ODataRoute("Organizations({orgKey})/ItSystems({sysKey})")] public IHttpActionResult GetItSystems(int orgKey, int sysKey) { var system = Repository.AsQueryable().SingleOrDefault(m => m.Id == sysKey); if (system == null) { return NotFound(); } var organizationContext = _contextFactory.CreateOrganizationContext(orgKey); if (!organizationContext.AllowReads(UserId, system)) { return StatusCode(HttpStatusCode.Forbidden); } return Ok(system); } [ODataRoute("ItSystems")] public override IHttpActionResult Get() { return base.Get(); } } }
using System.Linq; using System.Web.Http; using System.Web.OData; using System.Web.OData.Routing; using Core.DomainModel; using Core.DomainModel.ItSystem; using Core.DomainServices; using System.Net; using Core.ApplicationServices; using Presentation.Web.Access; namespace Presentation.Web.Controllers.OData { public partial class ItSystemsController : BaseEntityController<ItSystem> { private readonly IAuthenticationService _authService; private readonly IOrganizationContextFactory _contextFactory; public ItSystemsController(IGenericRepository<ItSystem> repository, IAuthenticationService authService, IOrganizationContextFactory contextFactory) : base(repository, authService) { _authService = authService; _contextFactory = contextFactory; } // GET /Organizations(1)/ItSystems [EnableQuery] [ODataRoute("Organizations({key})/ItSystems")] public IHttpActionResult GetItSystems(int key) { var loggedIntoOrgId = _authService.GetCurrentOrganizationId(UserId); var organizationContext = _contextFactory.CreateOrganizationContext(loggedIntoOrgId); if (!organizationContext.AllowReads(UserId)) { return Forbidden(); } var result = Repository.AsQueryable().Where(m => m.OrganizationId == key || m.AccessModifier == AccessModifier.Public); return Ok(result); } // GET /Organizations(1)/ItSystems(1) [EnableQuery] [ODataRoute("Organizations({orgKey})/ItSystems({sysKey})")] public IHttpActionResult GetItSystems(int orgKey, int sysKey) { var system = Repository.AsQueryable().SingleOrDefault(m => m.Id == sysKey); if (system == null) { return NotFound(); } var organizationContext = _contextFactory.CreateOrganizationContext(orgKey); if (!organizationContext.AllowReads(UserId, system)) { return StatusCode(HttpStatusCode.Forbidden); } return Ok(system); } [ODataRoute("ItSystems")] public override IHttpActionResult Get() { return base.Get(); } } }
mpl-2.0
C#
b1816e15bd272453fa3ea489c06c69c396ab9f5d
Print the texts of each row
12joan/hangman
table.cs
table.cs
using System; using System.Collections.Generic; using System.Text; namespace Hangman { public class Table { public int Width; public int Spacing; public Row[] Rows; public Table(int width, int spacing, Row[] rows) { Width = width; Spacing = spacing; Rows = rows; } public string Draw() { List<string> rowTexts = new List<string>(); foreach (var row in Rows) { rowTexts.Add(row.Text); } return String.Join("\n", rowTexts); } } }
using System; namespace Hangman { public class Table { public int Width; public int Spacing; public Row[] Rows; public Table(int width, int spacing, Row[] rows) { Width = width; Spacing = spacing; Rows = rows; } public string Draw() { return "Hello World"; } } }
unlicense
C#
c669d088a8e533afab534f9a50911da7e3ed5764
Add opening with Paint.NET
AVPolyakov/SharpLayout
SharpLayout.Tests/Program.cs
SharpLayout.Tests/Program.cs
using System; using System.Diagnostics; namespace SharpLayout.Tests { static class Program { static void Main() { var document = new Document { //CellsAreHighlighted = true, R1C1AreVisible = true, //ParagraphsAreHighlighted = true, //CellLineNumbersAreVisible = true }; PaymentOrder.AddSection(document); document.SavePng(0, "Temp.png", 120).StartLiveViewer(false); //Process.Start(document.SavePng(0, "Temp.png")); //open with Paint.NET //Process.Start(document.SavePdf($"Temp_{Guid.NewGuid():N}.pdf")); } private static void StartLiveViewer(this string fileName, bool alwaysShowWindow) { if (alwaysShowWindow || Process.GetProcessesByName("LiveViewer").Length <= 0) Process.Start("LiveViewer", fileName); } } }
using System; using System.Diagnostics; namespace SharpLayout.Tests { static class Program { static void Main() { var document = new Document { //CellsAreHighlighted = true, R1C1AreVisible = true, //ParagraphsAreHighlighted = true, //CellLineNumbersAreVisible = true }; PaymentOrder.AddSection(document); document.SavePng(0, "Temp.png", 120).StartLiveViewer(false); //Process.Start(document.SavePdf($"Temp_{Guid.NewGuid():N}.pdf")); } private static void StartLiveViewer(this string fileName, bool alwaysShowWindow) { if (alwaysShowWindow || Process.GetProcessesByName("LiveViewer").Length <= 0) Process.Start("LiveViewer", fileName); } } }
mit
C#
7089bef86949873467c577cd398813bac73b7fcf
Fix for #17184 - The name "View" does not exist. Modified the two references to View.ContentItems to ViewData.
tobydodds/folklife,angelapper/Orchard,dozoft/Orchard,mvarblow/Orchard,NIKASoftwareDevs/Orchard,Inner89/Orchard,RoyalVeterinaryCollege/Orchard,SouleDesigns/SouleDesigns.Orchard,brownjordaninternational/OrchardCMS,geertdoornbos/Orchard,sfmskywalker/Orchard,dburriss/Orchard,jersiovic/Orchard,MpDzik/Orchard,yersans/Orchard,johnnyqian/Orchard,dozoft/Orchard,cryogen/orchard,MetSystem/Orchard,Sylapse/Orchard.HttpAuthSample,Codinlab/Orchard,Serlead/Orchard,andyshao/Orchard,armanforghani/Orchard,stormleoxia/Orchard,OrchardCMS/Orchard-Harvest-Website,stormleoxia/Orchard,omidnasri/Orchard,MetSystem/Orchard,li0803/Orchard,AndreVolksdorf/Orchard,marcoaoteixeira/Orchard,dcinzona/Orchard-Harvest-Website,Cphusion/Orchard,alejandroaldana/Orchard,jaraco/orchard,ehe888/Orchard,fassetar/Orchard,bigfont/orchard-cms-modules-and-themes,jtkech/Orchard,TaiAivaras/Orchard,kouweizhong/Orchard,planetClaire/Orchard-LETS,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,oxwanawxo/Orchard,vairam-svs/Orchard,kgacova/Orchard,Sylapse/Orchard.HttpAuthSample,RoyalVeterinaryCollege/Orchard,sfmskywalker/Orchard,gcsuk/Orchard,xiaobudian/Orchard,escofieldnaxos/Orchard,KeithRaven/Orchard,gcsuk/Orchard,openbizgit/Orchard,bedegaming-aleksej/Orchard,brownjordaninternational/OrchardCMS,qt1/orchard4ibn,hannan-azam/Orchard,kouweizhong/Orchard,Praggie/Orchard,Lombiq/Orchard,salarvand/orchard,Lombiq/Orchard,Ermesx/Orchard,aaronamm/Orchard,huoxudong125/Orchard,stormleoxia/Orchard,mvarblow/Orchard,marcoaoteixeira/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,vard0/orchard.tan,escofieldnaxos/Orchard,salarvand/Portal,caoxk/orchard,neTp9c/Orchard,li0803/Orchard,hannan-azam/Orchard,infofromca/Orchard,Dolphinsimon/Orchard,MetSystem/Orchard,enspiral-dev-academy/Orchard,infofromca/Orchard,cryogen/orchard,omidnasri/Orchard,yonglehou/Orchard,LaserSrl/Orchard,mgrowan/Orchard,bigfont/orchard-continuous-integration-demo,escofieldnaxos/Orchard,asabbott/chicagodevnet-website,hhland/Orchard,Serlead/Orchard,tobydodds/folklife,xiaobudian/Orchard,ericschultz/outercurve-orchard,marcoaoteixeira/Orchard,hhland/Orchard,arminkarimi/Orchard,fassetar/Orchard,bigfont/orchard-continuous-integration-demo,neTp9c/Orchard,phillipsj/Orchard,caoxk/orchard,Serlead/Orchard,dburriss/Orchard,arminkarimi/Orchard,jagraz/Orchard,jagraz/Orchard,dburriss/Orchard,fassetar/Orchard,planetClaire/Orchard-LETS,grapto/Orchard.CloudBust,ehe888/Orchard,aaronamm/Orchard,kgacova/Orchard,neTp9c/Orchard,LaserSrl/Orchard,stormleoxia/Orchard,SzymonSel/Orchard,bigfont/orchard-cms-modules-and-themes,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,huoxudong125/Orchard,armanforghani/Orchard,arminkarimi/Orchard,yersans/Orchard,qt1/orchard4ibn,AndreVolksdorf/Orchard,dcinzona/Orchard-Harvest-Website,mgrowan/Orchard,spraiin/Orchard,MpDzik/Orchard,vard0/orchard.tan,vairam-svs/Orchard,Lombiq/Orchard,bedegaming-aleksej/Orchard,hbulzy/Orchard,yonglehou/Orchard,AEdmunds/beautiful-springtime,kouweizhong/Orchard,jtkech/Orchard,openbizgit/Orchard,kouweizhong/Orchard,Cphusion/Orchard,yersans/Orchard,omidnasri/Orchard,planetClaire/Orchard-LETS,aaronamm/Orchard,ehe888/Orchard,OrchardCMS/Orchard,planetClaire/Orchard-LETS,rtpHarry/Orchard,salarvand/orchard,openbizgit/Orchard,Lombiq/Orchard,Morgma/valleyviewknolls,alejandroaldana/Orchard,alejandroaldana/Orchard,LaserSrl/Orchard,oxwanawxo/Orchard,cooclsee/Orchard,TaiAivaras/Orchard,jimasp/Orchard,yonglehou/Orchard,johnnyqian/Orchard,yonglehou/Orchard,rtpHarry/Orchard,dburriss/Orchard,ericschultz/outercurve-orchard,spraiin/Orchard,arminkarimi/Orchard,OrchardCMS/Orchard-Harvest-Website,abhishekluv/Orchard,brownjordaninternational/OrchardCMS,asabbott/chicagodevnet-website,cooclsee/Orchard,hhland/Orchard,TalaveraTechnologySolutions/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,abhishekluv/Orchard,Anton-Am/Orchard,asabbott/chicagodevnet-website,Morgma/valleyviewknolls,tobydodds/folklife,grapto/Orchard.CloudBust,salarvand/Portal,armanforghani/Orchard,IDeliverable/Orchard,OrchardCMS/Orchard,hannan-azam/Orchard,DonnotRain/Orchard,Morgma/valleyviewknolls,SeyDutch/Airbrush,phillipsj/Orchard,LaserSrl/Orchard,cryogen/orchard,emretiryaki/Orchard,AEdmunds/beautiful-springtime,luchaoshuai/Orchard,vard0/orchard.tan,mvarblow/Orchard,enspiral-dev-academy/Orchard,Praggie/Orchard,Fogolan/OrchardForWork,SouleDesigns/SouleDesigns.Orchard,Ermesx/Orchard,omidnasri/Orchard,johnnyqian/Orchard,vairam-svs/Orchard,qt1/orchard4ibn,armanforghani/Orchard,IDeliverable/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,DonnotRain/Orchard,dcinzona/Orchard-Harvest-Website,armanforghani/Orchard,smartnet-developers/Orchard,qt1/Orchard,Fogolan/OrchardForWork,patricmutwiri/Orchard,li0803/Orchard,hbulzy/Orchard,AdvantageCS/Orchard,JRKelso/Orchard,Sylapse/Orchard.HttpAuthSample,SzymonSel/Orchard,bigfont/orchard-cms-modules-and-themes,MpDzik/Orchard,gcsuk/Orchard,fortunearterial/Orchard,Dolphinsimon/Orchard,fortunearterial/Orchard,Praggie/Orchard,smartnet-developers/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,xkproject/Orchard,jimasp/Orchard,qt1/Orchard,jimasp/Orchard,Lombiq/Orchard,enspiral-dev-academy/Orchard,brownjordaninternational/OrchardCMS,fassetar/Orchard,TalaveraTechnologySolutions/Orchard,dcinzona/Orchard,AndreVolksdorf/Orchard,SeyDutch/Airbrush,xiaobudian/Orchard,angelapper/Orchard,SzymonSel/Orchard,TaiAivaras/Orchard,OrchardCMS/Orchard-Harvest-Website,omidnasri/Orchard,jimasp/Orchard,sfmskywalker/Orchard,luchaoshuai/Orchard,Codinlab/Orchard,AEdmunds/beautiful-springtime,MpDzik/Orchard,abhishekluv/Orchard,openbizgit/Orchard,MetSystem/Orchard,SzymonSel/Orchard,hbulzy/Orchard,cooclsee/Orchard,qt1/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,stormleoxia/Orchard,harmony7/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard,andyshao/Orchard,jaraco/orchard,luchaoshuai/Orchard,tobydodds/folklife,KeithRaven/Orchard,luchaoshuai/Orchard,Codinlab/Orchard,AndreVolksdorf/Orchard,fortunearterial/Orchard,planetClaire/Orchard-LETS,kgacova/Orchard,Fogolan/OrchardForWork,Sylapse/Orchard.HttpAuthSample,johnnyqian/Orchard,escofieldnaxos/Orchard,andyshao/Orchard,li0803/Orchard,phillipsj/Orchard,smartnet-developers/Orchard,SeyDutch/Airbrush,geertdoornbos/Orchard,neTp9c/Orchard,grapto/Orchard.CloudBust,oxwanawxo/Orchard,alejandroaldana/Orchard,omidnasri/Orchard,Serlead/Orchard,jchenga/Orchard,geertdoornbos/Orchard,SeyDutch/Airbrush,TalaveraTechnologySolutions/Orchard,spraiin/Orchard,salarvand/Portal,m2cms/Orchard,bigfont/orchard-continuous-integration-demo,NIKASoftwareDevs/Orchard,RoyalVeterinaryCollege/Orchard,sebastienros/msc,NIKASoftwareDevs/Orchard,TalaveraTechnologySolutions/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,OrchardCMS/Orchard-Harvest-Website,harmony7/Orchard,Inner89/Orchard,dozoft/Orchard,dcinzona/Orchard-Harvest-Website,austinsc/Orchard,mgrowan/Orchard,jtkech/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,AdvantageCS/Orchard,angelapper/Orchard,Ermesx/Orchard,tobydodds/folklife,TalaveraTechnologySolutions/Orchard,qt1/orchard4ibn,oxwanawxo/Orchard,jtkech/Orchard,hannan-azam/Orchard,jchenga/Orchard,aaronamm/Orchard,omidnasri/Orchard,caoxk/orchard,sebastienros/msc,salarvand/Portal,SeyDutch/Airbrush,OrchardCMS/Orchard,Cphusion/Orchard,LaserSrl/Orchard,qt1/Orchard,dcinzona/Orchard-Harvest-Website,johnnyqian/Orchard,huoxudong125/Orchard,Dolphinsimon/Orchard,Fogolan/OrchardForWork,geertdoornbos/Orchard,xkproject/Orchard,austinsc/Orchard,hbulzy/Orchard,MpDzik/Orchard,omidnasri/Orchard,grapto/Orchard.CloudBust,jersiovic/Orchard,smartnet-developers/Orchard,abhishekluv/Orchard,TalaveraTechnologySolutions/Orchard,austinsc/Orchard,SouleDesigns/SouleDesigns.Orchard,jersiovic/Orchard,bigfont/orchard-cms-modules-and-themes,jerryshi2007/Orchard,phillipsj/Orchard,enspiral-dev-academy/Orchard,gcsuk/Orchard,cooclsee/Orchard,smartnet-developers/Orchard,KeithRaven/Orchard,tobydodds/folklife,mvarblow/Orchard,Inner89/Orchard,MpDzik/Orchard,AdvantageCS/Orchard,arminkarimi/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,sfmskywalker/Orchard,OrchardCMS/Orchard-Harvest-Website,angelapper/Orchard,KeithRaven/Orchard,alejandroaldana/Orchard,oxwanawxo/Orchard,Praggie/Orchard,caoxk/orchard,aaronamm/Orchard,RoyalVeterinaryCollege/Orchard,IDeliverable/Orchard,jtkech/Orchard,dcinzona/Orchard,IDeliverable/Orchard,salarvand/orchard,m2cms/Orchard,jerryshi2007/Orchard,OrchardCMS/Orchard-Harvest-Website,OrchardCMS/Orchard,infofromca/Orchard,spraiin/Orchard,infofromca/Orchard,dozoft/Orchard,bigfont/orchard-cms-modules-and-themes,asabbott/chicagodevnet-website,vairam-svs/Orchard,austinsc/Orchard,Morgma/valleyviewknolls,abhishekluv/Orchard,hhland/Orchard,mgrowan/Orchard,abhishekluv/Orchard,austinsc/Orchard,qt1/orchard4ibn,Dolphinsimon/Orchard,openbizgit/Orchard,emretiryaki/Orchard,Fogolan/OrchardForWork,emretiryaki/Orchard,jersiovic/Orchard,salarvand/orchard,dburriss/Orchard,jersiovic/Orchard,andyshao/Orchard,AdvantageCS/Orchard,JRKelso/Orchard,yersans/Orchard,JRKelso/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,hannan-azam/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,Ermesx/Orchard,sfmskywalker/Orchard,gcsuk/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,patricmutwiri/Orchard,SouleDesigns/SouleDesigns.Orchard,bedegaming-aleksej/Orchard,mgrowan/Orchard,jaraco/orchard,jerryshi2007/Orchard,dcinzona/Orchard,ericschultz/outercurve-orchard,omidnasri/Orchard,xkproject/Orchard,jagraz/Orchard,m2cms/Orchard,salarvand/orchard,luchaoshuai/Orchard,bigfont/orchard-continuous-integration-demo,fassetar/Orchard,m2cms/Orchard,emretiryaki/Orchard,bedegaming-aleksej/Orchard,KeithRaven/Orchard,kgacova/Orchard,sebastienros/msc,huoxudong125/Orchard,brownjordaninternational/OrchardCMS,jchenga/Orchard,mvarblow/Orchard,ericschultz/outercurve-orchard,angelapper/Orchard,grapto/Orchard.CloudBust,TalaveraTechnologySolutions/Orchard,patricmutwiri/Orchard,TalaveraTechnologySolutions/Orchard,hhland/Orchard,Dolphinsimon/Orchard,dcinzona/Orchard,infofromca/Orchard,RoyalVeterinaryCollege/Orchard,rtpHarry/Orchard,Anton-Am/Orchard,Anton-Am/Orchard,AdvantageCS/Orchard,ehe888/Orchard,IDeliverable/Orchard,yersans/Orchard,dcinzona/Orchard-Harvest-Website,vard0/orchard.tan,m2cms/Orchard,qt1/Orchard,spraiin/Orchard,DonnotRain/Orchard,salarvand/Portal,jchenga/Orchard,Inner89/Orchard,jerryshi2007/Orchard,NIKASoftwareDevs/Orchard,harmony7/Orchard,vard0/orchard.tan,sfmskywalker/Orchard,SzymonSel/Orchard,cryogen/orchard,emretiryaki/Orchard,Cphusion/Orchard,sebastienros/msc,jaraco/orchard,harmony7/Orchard,xiaobudian/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Serlead/Orchard,fortunearterial/Orchard,jchenga/Orchard,DonnotRain/Orchard,Anton-Am/Orchard,OrchardCMS/Orchard,qt1/orchard4ibn,phillipsj/Orchard,Inner89/Orchard,vard0/orchard.tan,Sylapse/Orchard.HttpAuthSample,DonnotRain/Orchard,xiaobudian/Orchard,rtpHarry/Orchard,MetSystem/Orchard,Praggie/Orchard,jagraz/Orchard,JRKelso/Orchard,harmony7/Orchard,jerryshi2007/Orchard,Codinlab/Orchard,fortunearterial/Orchard,grapto/Orchard.CloudBust,xkproject/Orchard,kgacova/Orchard,hbulzy/Orchard,TaiAivaras/Orchard,TaiAivaras/Orchard,jagraz/Orchard,bedegaming-aleksej/Orchard,patricmutwiri/Orchard,Codinlab/Orchard,Morgma/valleyviewknolls,kouweizhong/Orchard,andyshao/Orchard,AEdmunds/beautiful-springtime,geertdoornbos/Orchard,sebastienros/msc,rtpHarry/Orchard,dcinzona/Orchard,JRKelso/Orchard,yonglehou/Orchard,Ermesx/Orchard,marcoaoteixeira/Orchard,huoxudong125/Orchard,patricmutwiri/Orchard,sfmskywalker/Orchard,Cphusion/Orchard,enspiral-dev-academy/Orchard,escofieldnaxos/Orchard,NIKASoftwareDevs/Orchard,dozoft/Orchard,marcoaoteixeira/Orchard,AndreVolksdorf/Orchard,neTp9c/Orchard,vairam-svs/Orchard,li0803/Orchard,Anton-Am/Orchard,xkproject/Orchard,ehe888/Orchard,cooclsee/Orchard,jimasp/Orchard
src/Orchard.Web/Modules/Orchard.Tags/Views/Admin/Edit.cshtml
src/Orchard.Web/Modules/Orchard.Tags/Views/Admin/Edit.cshtml
@model Orchard.Tags.ViewModels.TagsAdminEditViewModel @using Orchard.ContentManagement; @using Orchard.Utility.Extensions; <h1>@Html.TitleForPage(T("Manage tag: {0}", Model.TagName).ToString()) </h1> @using (Html.BeginFormAntiForgeryPost()) { @Html.ValidationSummary() <fieldset> @Html.HiddenFor(m=>m.Id) @Html.LabelFor(m => m.TagName, T("Tag Name")) @Html.TextBoxFor(m=>m.TagName, new { @class = "text" }) </fieldset> <fieldset> <button class="primaryAction" type="submit">@T("Save")</button> </fieldset> } <h2>@T("Content items tagged with {0}", Model.TagName)</h2> @if (ViewData["ContentItems"] == null) { <p>@T("There is nothing tagged with {0}", Model.TagName)</p> } else { <table class="items"> <colgroup> <col id="Col1" /> <col id="Col2" /> </colgroup> <thead> <tr> <th scope="col">@T("Content Type")</th> <th scope="co2">@T("Name")</th> </tr> </thead> @foreach (IContent content in (IEnumerable<IContent>)ViewData["ContentItems"]) { <tr> <td>@content.ContentItem.ContentType.CamelFriendly()</td> <td>@Html.ItemEditLink(content.ContentItem)</td> </tr> } </table> }
@model Orchard.Tags.ViewModels.TagsAdminEditViewModel @using Orchard.ContentManagement; @using Orchard.Utility.Extensions; <h1>@Html.TitleForPage(T("Manage tag: {0}", Model.TagName).ToString()) </h1> @using (Html.BeginFormAntiForgeryPost()) { @Html.ValidationSummary() <fieldset> @Html.HiddenFor(m=>m.Id) @Html.LabelFor(m => m.TagName, T("Tag Name")) @Html.TextBoxFor(m=>m.TagName, new { @class = "text" }) </fieldset> <fieldset> <button class="primaryAction" type="submit">@T("Save")</button> </fieldset> } <h2>@T("Content items tagged with {0}", Model.TagName)</h2> @if (View.ContentItems == null) { <p>@T("There is nothing tagged with {0}", Model.TagName)</p> } else { <table class="items"> <colgroup> <col id="Col1" /> <col id="Col2" /> </colgroup> <thead> <tr> <th scope="col">@T("Content Type")</th> <th scope="co2">@T("Name")</th> </tr> </thead> @foreach (IContent content in View.ContentItems) { <tr> <td>@content.ContentItem.ContentType.CamelFriendly()</td> <td>@Html.ItemEditLink(content.ContentItem)</td> </tr> } </table> }
bsd-3-clause
C#
56f689c5cc1366924ede360c6619208b0ba656da
change VaultLoader's class access level
kingsamchen/EasyKeeper
VaultLoader.cs
VaultLoader.cs
/* @ Kingsley Chen */ namespace EasyKeeper { public static class VaultLoader { public static PasswordVault LoadFromProvided(string path, string password) { return null; } public static PasswordVault LoadFromNew(string path, string password) { var vault = new PasswordVault(path, password); vault.StoreAsync(); return vault; } } }
/* @ Kingsley Chen */ namespace EasyKeeper { internal static class VaultLoader { public static PasswordVault LoadFromProvided(string path, string password) { return null; } public static PasswordVault LoadFromNew(string path, string password) { var vault = new PasswordVault(path, password); vault.StoreAsync(); return vault; } } }
mit
C#
1f505932354e5df31d3bd071ec4f584abe2af5bb
Change clock widgets "Font Size" default value
danielchalmers/DesktopWidgets
DesktopWidgets/WidgetBase/Settings/WidgetClockSettingsBase.cs
DesktopWidgets/WidgetBase/Settings/WidgetClockSettingsBase.cs
using System; using System.Collections.Generic; using System.ComponentModel; namespace DesktopWidgets.WidgetBase.Settings { public class WidgetClockSettingsBase : WidgetSettingsBase { [Category("General")] [DisplayName("Refresh Interval")] public int UpdateInterval { get; set; } [Category("Style")] [DisplayName("Time Format")] public List<string> DateTimeFormat { get; set; } [Category("General")] [DisplayName("Time Offset")] public TimeSpan TimeOffset { get; set; } public override void SetDefaults() { base.SetDefaults(); UpdateInterval = -1; DateTimeFormat = new List<string> {"{hh}:{mm} {tt}"}; TimeOffset = TimeSpan.FromHours(0); FontSize = 24; } } }
using System; using System.Collections.Generic; using System.ComponentModel; namespace DesktopWidgets.WidgetBase.Settings { public class WidgetClockSettingsBase : WidgetSettingsBase { [Category("General")] [DisplayName("Refresh Interval")] public int UpdateInterval { get; set; } [Category("Style")] [DisplayName("Time Format")] public List<string> DateTimeFormat { get; set; } [Category("General")] [DisplayName("Time Offset")] public TimeSpan TimeOffset { get; set; } public override void SetDefaults() { base.SetDefaults(); UpdateInterval = -1; DateTimeFormat = new List<string> {"{hh}:{mm} {tt}"}; TimeOffset = TimeSpan.FromHours(0); } } }
apache-2.0
C#
5293bf8785cec9239d656e31c7e889e0d7a07b68
add source to get effective route
AzureAutomationTeam/azure-powershell,krkhan/azure-powershell,seanbamsft/azure-powershell,devigned/azure-powershell,pankajsn/azure-powershell,AzureAutomationTeam/azure-powershell,alfantp/azure-powershell,alfantp/azure-powershell,yoavrubin/azure-powershell,hungmai-msft/azure-powershell,devigned/azure-powershell,zhencui/azure-powershell,naveedaz/azure-powershell,atpham256/azure-powershell,AzureRT/azure-powershell,yoavrubin/azure-powershell,pankajsn/azure-powershell,rohmano/azure-powershell,atpham256/azure-powershell,naveedaz/azure-powershell,AzureAutomationTeam/azure-powershell,AzureRT/azure-powershell,ClogenyTechnologies/azure-powershell,AzureRT/azure-powershell,AzureRT/azure-powershell,yantang-msft/azure-powershell,alfantp/azure-powershell,krkhan/azure-powershell,alfantp/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,jtlibing/azure-powershell,naveedaz/azure-powershell,rohmano/azure-powershell,atpham256/azure-powershell,seanbamsft/azure-powershell,rohmano/azure-powershell,jtlibing/azure-powershell,AzureRT/azure-powershell,pankajsn/azure-powershell,krkhan/azure-powershell,yantang-msft/azure-powershell,yoavrubin/azure-powershell,ClogenyTechnologies/azure-powershell,pankajsn/azure-powershell,atpham256/azure-powershell,devigned/azure-powershell,ClogenyTechnologies/azure-powershell,yoavrubin/azure-powershell,jtlibing/azure-powershell,yantang-msft/azure-powershell,zhencui/azure-powershell,krkhan/azure-powershell,pankajsn/azure-powershell,yantang-msft/azure-powershell,zhencui/azure-powershell,hungmai-msft/azure-powershell,jtlibing/azure-powershell,yantang-msft/azure-powershell,seanbamsft/azure-powershell,AzureRT/azure-powershell,zhencui/azure-powershell,ClogenyTechnologies/azure-powershell,yoavrubin/azure-powershell,yantang-msft/azure-powershell,naveedaz/azure-powershell,krkhan/azure-powershell,rohmano/azure-powershell,devigned/azure-powershell,seanbamsft/azure-powershell,devigned/azure-powershell,atpham256/azure-powershell,naveedaz/azure-powershell,alfantp/azure-powershell,jtlibing/azure-powershell,krkhan/azure-powershell,zhencui/azure-powershell,seanbamsft/azure-powershell,naveedaz/azure-powershell,rohmano/azure-powershell,hungmai-msft/azure-powershell,hungmai-msft/azure-powershell,hungmai-msft/azure-powershell,zhencui/azure-powershell,atpham256/azure-powershell,seanbamsft/azure-powershell,pankajsn/azure-powershell,hungmai-msft/azure-powershell,AzureAutomationTeam/azure-powershell,devigned/azure-powershell,AzureAutomationTeam/azure-powershell,rohmano/azure-powershell
src/ResourceManager/Network/Commands.Network/Models/PSEffectiveRoute.cs
src/ResourceManager/Network/Commands.Network/Models/PSEffectiveRoute.cs
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // namespace Microsoft.Azure.Commands.Network.Models { using Newtonsoft.Json; using System.Collections.Generic; public class PSEffectiveRoute { [JsonProperty(Order = 1)] public string Name { get; set; } [JsonProperty(Order = 1)] public string State { get; set; } [JsonProperty(Order = 1)] public string Source { get; set; } [JsonProperty(Order = 1)] public List<string> AddressPrefix { get; set; } [JsonProperty(Order = 1)] public string NextHopType { get; set; } [JsonProperty(Order = 1)] public List<string> NextHopIpAddress { get; set; } } }
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // namespace Microsoft.Azure.Commands.Network.Models { using Newtonsoft.Json; using System.Collections.Generic; public class PSEffectiveRoute { [JsonProperty(Order = 1)] public string Name { get; set; } [JsonProperty(Order = 1)] public string State { get; set; } [JsonProperty(Order = 1)] public List<string> AddressPrefix { get; set; } [JsonProperty(Order = 1)] public string NextHopType { get; set; } [JsonProperty(Order = 1)] public List<string> NextHopIpAddress { get; set; } } }
apache-2.0
C#
ed14e014015042a2527210fab3af73c060677f88
Add missing full stop
smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,smoogipooo/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,peppy/osu
osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs
osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModMirror : Mod, IApplicableToBeatmap { public override string Name => "Mirror"; public override string Acronym => "MR"; public override ModType Type => ModType.Conversion; public override string Description => "Notes are flipped horizontally."; public override double ScoreMultiplier => 1; public override bool Ranked => true; public void ApplyToBeatmap(IBeatmap beatmap) { var availableColumns = ((ManiaBeatmap)beatmap).TotalColumns; beatmap.HitObjects.OfType<ManiaHitObject>().ForEach(h => h.Column = availableColumns - 1 - h.Column); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModMirror : Mod, IApplicableToBeatmap { public override string Name => "Mirror"; public override string Acronym => "MR"; public override ModType Type => ModType.Conversion; public override string Description => "Notes are flipped horizontally"; public override double ScoreMultiplier => 1; public override bool Ranked => true; public void ApplyToBeatmap(IBeatmap beatmap) { var availableColumns = ((ManiaBeatmap)beatmap).TotalColumns; beatmap.HitObjects.OfType<ManiaHitObject>().ForEach(h => h.Column = availableColumns - 1 - h.Column); } } }
mit
C#
d5a1e00feb34dbfe3ec6a67ba5a64d51df47c905
Improve "barrel roll" mod settings description
NeoAdonis/osu,peppy/osu,smoogipooo/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu
osu.Game.Rulesets.Osu/Mods/OsuModBarrelRoll.cs
osu.Game.Rulesets.Osu/Mods/OsuModBarrelRoll.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Osu.Mods { public class OsuModBarrelRoll : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject> { [SettingSource("Roll speed", "Rotations per minute")] public BindableNumber<double> SpinSpeed { get; } = new BindableDouble(0.5) { MinValue = 0.02, MaxValue = 4, Precision = 0.01, }; [SettingSource("Direction", "The direction of rotation")] public Bindable<RotationDirection> Direction { get; } = new Bindable<RotationDirection>(RotationDirection.Clockwise); public override string Name => "Barrel Roll"; public override string Acronym => "BR"; public override string Description => "The whole playfield is on a wheel!"; public override double ScoreMultiplier => 1; public override string SettingDescription => $"{SpinSpeed.Value}rpm, {Direction.Value.GetDescription().ToLowerInvariant()}"; public void Update(Playfield playfield) { playfield.Rotation = (Direction.Value == RotationDirection.CounterClockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value); } public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset) { // scale the playfield to allow all hitobjects to stay within the visible region. drawableRuleset.Playfield.Scale = new Vector2(OsuPlayfield.BASE_SIZE.Y / OsuPlayfield.BASE_SIZE.X); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Osu.Mods { public class OsuModBarrelRoll : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject> { [SettingSource("Roll speed", "Rotations per minute")] public BindableNumber<double> SpinSpeed { get; } = new BindableDouble(0.5) { MinValue = 0.02, MaxValue = 4, Precision = 0.01, }; [SettingSource("Direction", "The direction of rotation")] public Bindable<RotationDirection> Direction { get; } = new Bindable<RotationDirection>(RotationDirection.Clockwise); public override string Name => "Barrel Roll"; public override string Acronym => "BR"; public override string Description => "The whole playfield is on a wheel!"; public override double ScoreMultiplier => 1; public void Update(Playfield playfield) { playfield.Rotation = (Direction.Value == RotationDirection.CounterClockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value); } public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset) { // scale the playfield to allow all hitobjects to stay within the visible region. drawableRuleset.Playfield.Scale = new Vector2(OsuPlayfield.BASE_SIZE.Y / OsuPlayfield.BASE_SIZE.X); } } }
mit
C#
0aa12925060a671326ef42fa26ae1f14f78c7ad4
Remove DisableTestParallelization on CI due to the same reason.
CXuesong/WikiClientLibrary
UnitTestProject1/Assembly.cs
UnitTestProject1/Assembly.cs
using Xunit; // This is a work-around for #11. // https://github.com/CXuesong/WikiClientLibrary/issues/11 // We are using Bot Password on CI, which may naturally evade the issue. #if ENV_CI_BUILD [assembly:CollectionBehavior(DisableTestParallelization = true)] #endif
using Xunit; // This is a work-around for #11. // https://github.com/CXuesong/WikiClientLibrary/issues/11 [assembly:CollectionBehavior(DisableTestParallelization = true)]
apache-2.0
C#
547d3228ea248a253d0e50e2a3d891980990fe7a
Undo perf regression.
SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Perspex,grokys/Perspex,grokys/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,akrisiun/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex
samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs
samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs
using System; using System.Collections.ObjectModel; using System.Linq; using Avalonia.Media; using ReactiveUI; namespace ControlCatalog.ViewModels { public class ItemsRepeaterPageViewModel : ReactiveObject { private int _newItemIndex = 1; private int _newGenerationIndex = 0; private ObservableCollection<Item> _items; public ItemsRepeaterPageViewModel() { Items = CreateItems(); } public ObservableCollection<Item> Items { get => _items; set => this.RaiseAndSetIfChanged(ref _items, value); } public Item SelectedItem { get; set; } public void AddItem() { var index = SelectedItem != null ? Items.IndexOf(SelectedItem) : -1; Items.Insert(index + 1, new Item(index + 1) { Text = $"New Item {_newItemIndex++}" }); } public void RandomizeHeights() { var random = new Random(); foreach (var i in Items) { i.Height = random.Next(240) + 10; } } public void ResetItems() { Items = CreateItems(); } private ObservableCollection<Item> CreateItems() { var suffix = _newGenerationIndex == 0 ? string.Empty : $"[{_newGenerationIndex.ToString()}]"; _newGenerationIndex++; return new ObservableCollection<Item>( Enumerable.Range(1, 100000).Select(i => new Item(i) { Text = $"Item {i.ToString()} {suffix}" })); } public class Item : ReactiveObject { private double _height = double.NaN; public Item(int index) => Index = index; public int Index { get; } public string Text { get; set; } public double Height { get => _height; set => this.RaiseAndSetIfChanged(ref _height, value); } } } }
using System; using System.Collections.ObjectModel; using System.Linq; using Avalonia.Media; using ReactiveUI; namespace ControlCatalog.ViewModels { public class ItemsRepeaterPageViewModel : ReactiveObject { private int _newItemIndex = 1; private int _newGenerationIndex = 0; private ObservableCollection<Item> _items; public ItemsRepeaterPageViewModel() { Items = CreateItems(); } public ObservableCollection<Item> Items { get => _items; set => this.RaiseAndSetIfChanged(ref _items, value); } public Item SelectedItem { get; set; } public void AddItem() { var index = SelectedItem != null ? Items.IndexOf(SelectedItem) : -1; Items.Insert(index + 1, new Item(index + 1) { Text = $"New Item {_newItemIndex++}" }); } public void RandomizeHeights() { var random = new Random(); foreach (var i in Items) { i.Height = random.Next(240) + 10; } } public void ResetItems() { Items = CreateItems(); } private ObservableCollection<Item> CreateItems() { var suffix = _newGenerationIndex == 0 ? string.Empty : $"[{_newGenerationIndex.ToString()}]"; _newGenerationIndex++; return new ObservableCollection<Item>( Enumerable.Range(1, 100000).Select(i => new Item(i) { Text = $"Item {i} {suffix}" })); } public class Item : ReactiveObject { private double _height = double.NaN; public Item(int index) => Index = index; public int Index { get; } public string Text { get; set; } public double Height { get => _height; set => this.RaiseAndSetIfChanged(ref _height, value); } } } }
mit
C#
500f7ea923cec3ec267abfa1704122ec3fb19c49
Update copyright notice.
mthamil/EFDocumentationGenerator
EFDocumentationGenerator/ConnectionStrings/InnerConnectionStringParser.cs
EFDocumentationGenerator/ConnectionStrings/InnerConnectionStringParser.cs
// Entity Designer Documentation Generator // Copyright 2017 Matthew Hamilton - matthamilton@live.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; namespace DocumentationGenerator.ConnectionStrings { /// <summary> /// Responsible for parsing out a database connection string from an Entity Framework connection string. /// </summary> public class InnerConnectionStringParser { /// <summary> /// Parses an inner database connection string from an Entity Framework connection string. /// </summary> /// <param name="entityConnectionString">The connection string to parse</param> /// <returns>An inner database connection string</returns> public string Parse(string entityConnectionString) { var innerConnStringStart = entityConnectionString.IndexOf("data source=", StringComparison.OrdinalIgnoreCase); var innerConnStringEnd = entityConnectionString.LastIndexOf("\"", StringComparison.OrdinalIgnoreCase); var connectionString = entityConnectionString.Substring (innerConnStringStart, (entityConnectionString.Length - innerConnStringStart) - (entityConnectionString.Length - innerConnStringEnd)).Trim(); return connectionString; } } }
// Entity Designer Documentation Generator // Copyright 2013 Matthew Hamilton - matthamilton@live.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; namespace DocumentationGenerator.ConnectionStrings { /// <summary> /// Responsible for parsing out a database connection string from an Entity Framework connection string. /// </summary> public class InnerConnectionStringParser { /// <summary> /// Parses an inner database connection string from an Entity Framework connection string. /// </summary> /// <param name="entityConnectionString">The connection string to parse</param> /// <returns>An inner database connection string</returns> public string Parse(string entityConnectionString) { var innerConnStringStart = entityConnectionString.IndexOf("data source=", StringComparison.OrdinalIgnoreCase); var innerConnStringEnd = entityConnectionString.LastIndexOf("\"", StringComparison.OrdinalIgnoreCase); var connectionString = entityConnectionString.Substring (innerConnStringStart, (entityConnectionString.Length - innerConnStringStart) - (entityConnectionString.Length - innerConnStringEnd)).Trim(); return connectionString; } } }
apache-2.0
C#
2f78a81c8d8f94577a30885955939023bed8ff6b
fix failing test: GC before testing
fluffynuts/PeanutButter,fluffynuts/PeanutButter,fluffynuts/PeanutButter
source/Utils/PeanutButter.Utils.Tests/TestMetadataExtensions.cs
source/Utils/PeanutButter.Utils.Tests/TestMetadataExtensions.cs
using System; using NExpect.Implementations; using NUnit.Framework; using NExpect; using static NExpect.Expectations; using static PeanutButter.RandomGenerators.RandomValueGen; // ReSharper disable PossibleNullReferenceException // ReSharper disable TryCastAlwaysSucceeds namespace PeanutButter.Utils.Tests { [TestFixture] public class TestMetadataExtensions { [Test] public void ShouldBeAbleToSetAndRetrieveAValue() { // Arrange var target = new { }; var key = GetRandomString(2); var value = GetRandomInt(); // Pre-Assert // Act target.SetMetadata(key, value); var result = target.GetMetadata<int>(key); // Assert Expect(result).To.Equal(value); } [Test] public void ShouldBeAbleToInformIfThereIsMetadata() { // Arrange var target = new { }; var key = GetRandomString(2); var value = GetRandomString(4); target.SetMetadata(key, value); // Pre-Assert // Act var result = target.HasMetadata<string>(key); // Assert Expect(result).To.Be.True(); } [Test] public void ShouldGcMetaData() { // Arrange GC.Collect(); var target = new { }; var key = GetRandomString(2); var value = GetRandomBoolean(); target.SetMetadata(key, value); // Pre-Assert Expect(target.HasMetadata<bool>(key)).To.Be.True(); Expect(MetadataExtensions.TrackedObjectCount()).To.Equal(1); // Act target = null; GC.Collect(); // Assert Expect(() => { target.HasMetadata<bool>(key); }).To.Throw(); Expect(MetadataExtensions.TrackedObjectCount()).To.Equal(0); } } }
using System; using NExpect.Implementations; using NUnit.Framework; using NExpect; using static NExpect.Expectations; using static PeanutButter.RandomGenerators.RandomValueGen; // ReSharper disable PossibleNullReferenceException // ReSharper disable TryCastAlwaysSucceeds namespace PeanutButter.Utils.Tests { [TestFixture] public class TestMetadataExtensions { [Test] public void ShouldBeAbleToSetAndRetrieveAValue() { // Arrange var target = new { }; var key = GetRandomString(2); var value = GetRandomInt(); // Pre-Assert // Act target.SetMetadata(key, value); var result = target.GetMetadata<int>(key); // Assert Expect(result).To.Equal(value); } [Test] public void ShouldBeAbleToInformIfThereIsMetadata() { // Arrange var target = new { }; var key = GetRandomString(2); var value = GetRandomString(4); target.SetMetadata(key, value); // Pre-Assert // Act var result = target.HasMetadata<string>(key); // Assert Expect(result).To.Be.True(); } [Test] public void ShouldGcMetaData() { // Arrange var target = new { }; var key = GetRandomString(2); var value = GetRandomBoolean(); target.SetMetadata(key, value); // Pre-Assert Expect(target.HasMetadata<bool>(key)).To.Be.True(); Expect(MetadataExtensions.TrackedObjectCount()).To.Equal(1); // Act target = null; GC.Collect(); // Assert Expect(() => { target.HasMetadata<bool>(key); }).To.Throw(); Expect(MetadataExtensions.TrackedObjectCount()).To.Equal(0); } } }
bsd-3-clause
C#
b65f2067b9cf066248be5f053af56df9de3d9cc0
Add using
karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS
src/Package/Impl/ProjectSystem/ProjectTreePropertiesProvider.cs
src/Package/Impl/ProjectSystem/ProjectTreePropertiesProvider.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. #if VS15 using System.ComponentModel.Composition; using System.IO; using Microsoft.Common.Core; using Microsoft.VisualStudio.Imaging; using Microsoft.VisualStudio.ProjectSystem; using Microsoft.VisualStudio.R.Package.Sql; namespace Microsoft.VisualStudio.R.Package.ProjectSystem { [Export(typeof(IProjectTreePropertiesProvider))] [AppliesTo(ProjectConstants.RtvsProjectCapability)] internal sealed class ProjectTreePropertiesProvider : IProjectTreePropertiesProvider { public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues) { if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot)) { propertyValues.Icon = ProjectIconProvider.ProjectNodeImage.ToProjectSystemType(); } else if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.FileOnDisk)) { string ext = Path.GetExtension(propertyContext.ItemName).ToLowerInvariant(); if (ext == ".r") { propertyValues.Icon = ProjectIconProvider.RFileNodeImage.ToProjectSystemType(); } else if (ext == ".rdata" || ext == ".rhistory") { propertyValues.Icon = ProjectIconProvider.RDataFileNodeImage.ToProjectSystemType(); } else if (ext == ".md" || ext == ".rmd") { propertyValues.Icon = KnownMonikers.MarkdownFile.ToProjectSystemType(); } else if (propertyContext.ItemName.EndsWithIgnoreCase(SProcFileExtensions.QueryFileExtension)) { propertyValues.Icon = KnownMonikers.DatabaseColumn.ToProjectSystemType(); } else if (propertyContext.ItemName.EndsWithIgnoreCase(SProcFileExtensions.SProcFileExtension)) { propertyValues.Icon = KnownMonikers.DatabaseStoredProcedures.ToProjectSystemType(); } } } } } #endif
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. #if VS15 using System.ComponentModel.Composition; using System.IO; using Microsoft.VisualStudio.Imaging; using Microsoft.VisualStudio.ProjectSystem; using Microsoft.VisualStudio.R.Package.Sql; namespace Microsoft.VisualStudio.R.Package.ProjectSystem { [Export(typeof(IProjectTreePropertiesProvider))] [AppliesTo(ProjectConstants.RtvsProjectCapability)] internal sealed class ProjectTreePropertiesProvider : IProjectTreePropertiesProvider { public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues) { if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.ProjectRoot)) { propertyValues.Icon = ProjectIconProvider.ProjectNodeImage.ToProjectSystemType(); } else if (propertyValues.Flags.Contains(ProjectTreeFlags.Common.FileOnDisk)) { string ext = Path.GetExtension(propertyContext.ItemName).ToLowerInvariant(); if (ext == ".r") { propertyValues.Icon = ProjectIconProvider.RFileNodeImage.ToProjectSystemType(); } else if (ext == ".rdata" || ext == ".rhistory") { propertyValues.Icon = ProjectIconProvider.RDataFileNodeImage.ToProjectSystemType(); } else if (ext == ".md" || ext == ".rmd") { propertyValues.Icon = KnownMonikers.MarkdownFile.ToProjectSystemType(); } else if (propertyContext.ItemName.EndsWithIgnoreCase(SProcFileExtensions.QueryFileExtension)) { propertyValues.Icon = KnownMonikers.DatabaseColumn.ToProjectSystemType(); } else if (propertyContext.ItemName.EndsWithIgnoreCase(SProcFileExtensions.SProcFileExtension)) { propertyValues.Icon = KnownMonikers.DatabaseStoredProcedures.ToProjectSystemType(); } } } } } #endif
mit
C#
304fb449ab3ada611797883fe50b4e8fdb9d5842
Revert "cleanup"
iolevel/peachpie-concept,iolevel/peachpie-concept,iolevel/peachpie-concept,peachpiecompiler/peachpie,peachpiecompiler/peachpie,peachpiecompiler/peachpie
src/Peachpie.CodeAnalysis/FlowAnalysis/Graph/BoundExpression.cs
src/Peachpie.CodeAnalysis/FlowAnalysis/Graph/BoundExpression.cs
using Pchp.CodeAnalysis.FlowAnalysis; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Pchp.CodeAnalysis.Semantics { partial class BoundLiteral { /// <summary> /// Gets type mask of the literal within given type context. /// </summary> internal TypeRefMask ResolveTypeMask(TypeRefContext typeCtx) { Debug.Assert(this.ConstantValue.HasValue); var value = this.ConstantValue.Value; if (value == null) { return typeCtx.GetNullTypeMask(); } else { if (value is long || value is int) { return typeCtx.GetLongTypeMask(); } else if (value is string) { return typeCtx.GetStringTypeMask(); } else if (value is bool) { return typeCtx.GetBooleanTypeMask(); } else if (value is double) { return typeCtx.GetDoubleTypeMask(); } else { throw new NotImplementedException(); } } } } }
using Pchp.CodeAnalysis.FlowAnalysis; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Pchp.CodeAnalysis.Semantics { partial class BoundLiteral { /// <summary> /// Gets type mask of the literal within given type context. /// </summary> internal TypeRefMask ResolveTypeMask(TypeRefContext typeCtx) { Debug.Assert(this.ConstantValue.HasValue); return this.ConstantValue.Value switch { null => typeCtx.GetNullTypeMask(), int => typeCtx.GetLongTypeMask(), long => typeCtx.GetLongTypeMask(), string => typeCtx.GetStringTypeMask(), bool => typeCtx.GetBooleanTypeMask(), double => typeCtx.GetDoubleTypeMask(), byte[] => typeCtx.GetWritableStringTypeMask(), _ => throw new NotImplementedException(), }; } } }
apache-2.0
C#
2503cb6fd6d9c16f727c7812d412483d931609a6
Modify DepartmentService to use new CrudService
denismaster/dcs,denismaster/dcs,denismaster/dcs,denismaster/dcs
src/Diploms.Services/Departments/DepartmentsService.cs
src/Diploms.Services/Departments/DepartmentsService.cs
using System; using System.Threading.Tasks; using AutoMapper; using Diploms.Core; using Diploms.Dto; using Diploms.Dto.Departments; namespace Diploms.Services.Departments { public class DepartmentsService : CrudService<Department, DepartmentEditDto, DepartmentEditDto, DepartmentEditDto> { public DepartmentsService(IRepository<Department> repository, IMapper mapper) : base(repository, mapper) { } } }
using System; using System.Threading.Tasks; using AutoMapper; using Diploms.Core; using Diploms.Dto; using Diploms.Dto.Departments; namespace Diploms.Services.Departments { public class DepartmentsService { private readonly IRepository<Department> _repository; private readonly IMapper _mapper; public DepartmentsService(IRepository<Department> repository, IMapper mapper) { _repository = repository ?? throw new System.ArgumentNullException(nameof(repository)); _mapper = mapper ?? throw new System.ArgumentNullException(nameof(mapper)); } public async Task<OperationResult> Add(DepartmentEditDto model) { var result = new OperationResult(); try { var department = _mapper.Map<Department>(model); department.CreateDate = DateTime.UtcNow; _repository.Add(department); await _repository.SaveChanges(); } catch(Exception e) { result.Errors.Add(e.Message); } return result; } public async Task<OperationResult> Edit(DepartmentEditDto model) { var result = new OperationResult(); try { var department = _mapper.Map<Department>(model); department.ChangeDate = DateTime.UtcNow; _repository.Update(department); await _repository.SaveChanges(); } catch(Exception e) { result.Errors.Add(e.Message); } return result; } } }
mit
C#
57b9764ea168816e5b38eacfbeabdd835c837db8
make director creation aligned with service concept
rustamserg/mogate
mogate.Shared/GameMogate.cs
mogate.Shared/GameMogate.cs
#region Using Statements using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Storage; using Microsoft.Xna.Framework.Input; #endregion namespace mogate { public class GameMogate : Game { GraphicsDeviceManager m_graphics; public GameMogate () { m_graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; m_graphics.PreferredBackBufferHeight = Globals.VIEWPORT_HEIGHT; m_graphics.PreferredBackBufferWidth = Globals.VIEWPORT_WIDTH; m_graphics.IsFullScreen = false; IsMouseVisible = true; } protected override void Initialize () { var gameState = new GameState (this); var sprites = new SpriteSheets (this); var director = new Director (this); Services.AddService (typeof(IWorld), new World()); Services.AddService (typeof(IGameState), gameState); Services.AddService (typeof(ISpriteSheets), sprites); Services.AddService (typeof(IStatistics), new Statistics ()); Services.AddService (typeof(IDirector), director); Components.Add (sprites); Components.Add (gameState); Components.Add (director); director.RegisterScene (new GameScene (this, "game")); director.RegisterScene (new MainScene (this, "main")); director.RegisterScene (new InterScene (this, "inter")); director.RegisterScene (new PlayerSelectScene (this, "player_select")); base.Initialize (); } protected override void LoadContent () { var director = (IDirector)Services.GetService (typeof(IDirector)); director.ActivateScene ("main"); } } }
#region Using Statements using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Storage; using Microsoft.Xna.Framework.Input; #endregion namespace mogate { public class GameMogate : Game { GraphicsDeviceManager m_graphics; Director m_director; public GameMogate () { m_graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; m_graphics.PreferredBackBufferHeight = Globals.VIEWPORT_HEIGHT; m_graphics.PreferredBackBufferWidth = Globals.VIEWPORT_WIDTH; m_graphics.IsFullScreen = false; IsMouseVisible = true; } protected override void Initialize () { var gameState = new GameState (this); var sprites = new SpriteSheets (this); Services.AddService (typeof(IWorld), new World()); Services.AddService (typeof(IGameState), gameState); Services.AddService (typeof(ISpriteSheets), sprites); Services.AddService (typeof(IStatistics), new Statistics ()); Components.Add (sprites); Components.Add (gameState); // new flow, there is only director game component is added m_director = new Director (this); Services.AddService (typeof(IDirector), m_director); m_director.RegisterScene (new GameScene (this, "game")); m_director.RegisterScene (new MainScene (this, "main")); m_director.RegisterScene (new InterScene (this, "inter")); m_director.RegisterScene (new PlayerSelectScene (this, "player_select")); base.Initialize (); } protected override void LoadContent () { m_director.ActivateScene ("main"); } } }
mit
C#
11c2b3c17a964de5246188ca83e8b83341e9913c
update startMenuController
oussamabonnor1/Catcheep
Documents/Unity3D/Catcheep/Assets/Scripts/startMenuManager.cs
Documents/Unity3D/Catcheep/Assets/Scripts/startMenuManager.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class startMenuManager : MonoBehaviour { public GameObject ScrollBarGameObject; private Scrollbar ScrollBar; private Vector2 edgeOfScreen; public int menuCount; // Use this for initialization void Start() { if (ScrollBarGameObject == null) ScrollBarGameObject = GameObject.Find("Scrollbar"); ScrollBar = ScrollBarGameObject.GetComponent<Scrollbar>(); edgeOfScreen = new Vector2(Screen.width, Screen.height); } // Update is called once per frame void Update() { //if (Input.touchCount == 0) //TODO fix it if(Input.GetMouseButtonDown(0)){ float portion = (float) 1 / menuCount; for (int i = 1; i <= menuCount; i++) { if (ScrollBar.value < ((i * portion) - portion / 2) && ScrollBar.value > ((i - 1) * portion)) { ScrollBar.value = Mathf.Lerp(ScrollBar.value, (i - 1) * portion, 0.05f); } if (ScrollBar.value > ((i * portion) - portion / 2) && ScrollBar.value < (i * portion)) { ScrollBar.value = Mathf.Lerp(ScrollBar.value, (i) * portion, 0.05f); } } } if (Input.touchCount == 1) { } } public void farm() { SceneManager.LoadScene("Farm"); } public void snow() { SceneManager.LoadScene("snow"); } public void quit() { Application.Quit(); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class startMenuManager : MonoBehaviour { public GameObject ScrollBarGameObject; private Scrollbar ScrollBar; private Vector2 edgeOfScreen; public int menuCount; // Use this for initialization void Start() { if (ScrollBarGameObject == null) ScrollBarGameObject = GameObject.Find("Scrollbar"); ScrollBar = ScrollBarGameObject.GetComponent<Scrollbar>(); edgeOfScreen = new Vector2(Screen.width, Screen.height); } // Update is called once per frame void Update() { //if (Input.touchCount == 0) if(Input.GetMouseButtonDown(0)){ float portion = (float) 1 / menuCount; for (int i = 1; i <= menuCount; i++) { if (ScrollBar.value < ((i * portion) - portion / 2) && ScrollBar.value > ((i - 1) * portion)) { ScrollBar.value = Mathf.Lerp(ScrollBar.value, (i - 1) * portion, 0.05f); } if (ScrollBar.value > ((i * portion) - portion / 2) && ScrollBar.value < (i * portion)) { ScrollBar.value = Mathf.Lerp(ScrollBar.value, (i) * portion, 0.05f); } } } if (Input.touchCount == 1) { } } public void farm() { SceneManager.LoadScene("Farm"); } public void snow() { SceneManager.LoadScene("snow"); } public void quit() { Application.Quit(); } }
mit
C#
40c04e7776a1248e8e5bea663abcd1ad2f52f8f3
exclude IfElapsed wrapper from debugger stepthrough
ArsenShnurkov/BitSharp
BitSharp.Common/Throttler.cs
BitSharp.Common/Throttler.cs
using System; using System.Collections.Concurrent; using System.Diagnostics; using System.Runtime.CompilerServices; namespace BitSharp.Common { public static class Throttler { private static readonly ConcurrentDictionary<Tuple<string, string, int>, DateTime> lastTimes = new ConcurrentDictionary<Tuple<string, string, int>, DateTime>(); [DebuggerStepThrough] public static bool IfElapsed(TimeSpan interval, Action action, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) { var key = Tuple.Create(memberName, filePath, lineNumber); DateTime lastTime; if (!lastTimes.TryGetValue(key, out lastTime)) lastTime = DateTime.MinValue; var now = DateTime.Now; if (now - lastTime >= interval) { lastTimes[key] = now; action(); return true; } else return false; } } }
using System; using System.Collections.Concurrent; using System.Runtime.CompilerServices; namespace BitSharp.Common { public static class Throttler { private static readonly ConcurrentDictionary<Tuple<string, string, int>, DateTime> lastTimes = new ConcurrentDictionary<Tuple<string, string, int>, DateTime>(); public static bool IfElapsed(TimeSpan interval, Action action, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) { var key = Tuple.Create(memberName, filePath, lineNumber); DateTime lastTime; if (!lastTimes.TryGetValue(key, out lastTime)) lastTime = DateTime.MinValue; var now = DateTime.Now; if (now - lastTime >= interval) { lastTimes[key] = now; action(); return true; } else return false; } } }
unlicense
C#
f0019dbb12619be7f392cfff9e58d8950932ea7c
Add BeneficiaryDetailsList missing properties
CurrencyCloud/currencycloud-net
Source/CurrencyCloud/Entity/List/BeneficiaryDetailsList.cs
Source/CurrencyCloud/Entity/List/BeneficiaryDetailsList.cs
using System.Collections.Generic; using Newtonsoft.Json; namespace CurrencyCloud.Entity.List { public class BeneficiaryDetailsList { internal BeneficiaryDetailsList() { } public struct Detail { public string PaymentType { get; set; } public string AcctNumber { get; set; } public string BicSwift { get; set; } public string BeneficiaryEntityType { get; set; } public string BeneficiaryStateOrProvince { get; set; } public string BeneficiaryPostcode { get; set; } public string BeneficiaryAddress { get; set; } public string BeneficiaryCity { get; set; } public string BeneficiaryCountry { get; set; } public string BeneficiaryFirstName { get; set; } public string BeneficiaryLastName { get; set; } public string BeneficiaryCompanyName { get; set; } public string Aba { get; set; } public string SortCode { get; set; } public string Iban { get; set; } public string BsbCode { get; set; } public string InstitutionNo { get; set; } public string BankCode { get; set; } public string BranchCode { get; set; } public string Clabe { get; set; } public string Cnaps { get; set; } public string Ifsc { get; set; } } public List<Detail> Details { get; set; } public string ToJSON() { var obj = new[] { new { Details } }; return JsonConvert.SerializeObject(obj); } } }
using System.Collections.Generic; using Newtonsoft.Json; namespace CurrencyCloud.Entity.List { public class BeneficiaryDetailsList { internal BeneficiaryDetailsList() { } public struct Detail { public string PaymentType { get; set; } public string AcctNumber { get; set; } public string BicSwift { get; set; } public string BeneficiaryEntityType { get; set; } } public List<Detail> Details { get; set; } public string ToJSON() { var obj = new[] { new { Details } }; return JsonConvert.SerializeObject(obj); } } }
mit
C#
7f875becbde3219ce52783304d7129a6c1bb8c04
Fix docs for jquery-tmpl
andrewdavey/cassette,damiensawyer/cassette,honestegg/cassette,honestegg/cassette,damiensawyer/cassette,honestegg/cassette,andrewdavey/cassette,damiensawyer/cassette,andrewdavey/cassette
src/Website/Views/Documentation/v2/HtmlTemplates/JQueryTmpl.cshtml
src/Website/Views/Documentation/v2/HtmlTemplates/JQueryTmpl.cshtml
@{ ViewBag.Title = "Cassette | jQuery-tmpl Template Compilation"; } <h1>jQuery-tmpl Template Compilation</h1> <p>jQuery-tmpl templates are usually embedded into a page using non-executing script blocks. The browser then compiles these into JavaScript functions at runtime. This may be fast in modern browsers, but given a lot of templates and a slower mobile browser, you may notice the slow down.</p> <p>Cassette enables you to pre-compile jQuery-tmpl templates into JavaScript on the server-side. The compiled templates are cached and served to the browser as a regular script. This also provides all the benefits of Cassette's bundle versioning and caching. </p> <p>The compiled template functions are loaded directly into jQuery-tmpl, with no runtime overhead.</p> <h2>Install Cassette.JQueryTmpl</h2> <p>Install the package from nuget:</p> <pre><code>Install-Package Cassette.JQueryTmpl</code></pre> <h2>Bundle configuration</h2> <p> No additional bundle configuration is required. The plug-in replaces the default HTML template pipeline. </p> <p>So your configuration will still look similar to this:</p> <pre><code>bundles.Add&lt;<span class="code-type">HtmlTemplate</span>&gt;(<span class="string">"HtmlTemplates"</span>);</code></pre> <h2>Using in pages</h2> <p>In a view page, reference your templates just like any other bundle:</p> <pre><code><span class="code-tag">@@{</span> <span class="code-type">Bundles</span>.Reference(<span class="string">"HtmlTemplates"</span>); }</code></pre> <p>Also, tell Cassette where to render the HTML required to include the templates:</p> <pre><code><span class="code-tag">@@</span><span class="razor-expression"><span class="code-type">Bundles</span>.RenderHtmlTemplates()</span></code></pre> <p>Now when the page runs, instead of embedding the template sources into the page, a single script include is generated:</p> <pre><code><span class="open-tag">&lt;</span><span class="tag">script</span> <span class="attribute">src</span><span class="attribute-value">="/cassette.axd/htmltemplate/HtmlTemplates_7d879cec"</span> <span class="attribute">type</span><span class="attribute-value">="text/javascript"</span><span class="close-tag">&gt;</span><span class="open-tag">&lt;/</span><span class="tag">script</span><span class="close-tag">&gt;</span></code></pre> <p>This script contains the templates compiled into JavaScript. Like all Cassette bundles, it is versioned and cached aggresively. So a browser only needs to download it once.</p>
@{ ViewBag.Title = "Cassette | jQuery-tmpl Template Compilation"; } <h1>jQuery-tmpl Template Compilation</h1> <p>jQuery-tmpl templates are usually embedded into a page using non-executing script blocks. The browser then compiles these into JavaScript functions at runtime. This may be fast in modern browsers, but given a lot of templates and a slower mobile browser, you may notice the slow down.</p> <p>Cassette enables you to pre-compile jQuery-tmpl templates into JavaScript on the server-side. The compiled templates are cached and served to the browser as a regular script. This also provides all the benefits of Cassette's bundle versioning and caching. </p> <p>The compiled template functions are loaded directly into jQuery-tmpl, with no runtime overhead.</p> <h2>Bundle configuration</h2> <p>To enable this feature, use the following bundle configuration:</p> <pre><code>bundles.Add&lt;<span class="code-type">HtmlTemplate</span>&gt;( <span class="string">"HtmlTemplates"</span> <span class="comment">// Assign the jQuery-tmpl processor to the HTML template bundles</span> bundle => bundle.Pipeline = <span class="keyword">new</span> <span class="code-type">JQueryTmplPipeline</span>() );</code></pre> <h2>Using in pages</h2> <p>In a view page, reference your templates just like any other bundle:</p> <pre><code><span class="code-tag">@@{</span> <span class="code-type">Bundles</span>.Reference(<span class="string">"HtmlTemplates"</span>); }</code></pre> <p>Also, tell Cassette where to render the HTML required to include the templates:</p> <pre><code><span class="code-tag">@@</span><span class="razor-expression"><span class="code-type">Bundles</span>.RenderHtmlTemplates()</span></code></pre> <p>Now when the page runs, instead of embedding the template sources into the page, a single script include is generated:</p> <pre><code><span class="open-tag">&lt;</span><span class="tag">script</span> <span class="attribute">src</span><span class="attribute-value">="/cassette.axd/htmltemplate/HtmlTemplates_7d879cec"</span> <span class="attribute">type</span><span class="attribute-value">="text/javascript"</span><span class="close-tag">&gt;</span><span class="open-tag">&lt;/</span><span class="tag">script</span><span class="close-tag">&gt;</span></code></pre> <p>This script will return the templates compiled into JavaScript. Like all Cassette bundles, it is versioned and cached aggresively. So a browser only needs to download it once.</p>
mit
C#
3b102ffe37627a3884e89e76a08422ee9c51b786
implement all the other methods
octokit/octokit.net,alfhenrik/octokit.net,michaKFromParis/octokit.net,dampir/octokit.net,shana/octokit.net,Red-Folder/octokit.net,Sarmad93/octokit.net,shiftkey-tester/octokit.net,ivandrofly/octokit.net,ChrisMissal/octokit.net,M-Zuber/octokit.net,SmithAndr/octokit.net,gabrielweyer/octokit.net,bslliw/octokit.net,thedillonb/octokit.net,kolbasov/octokit.net,SamTheDev/octokit.net,hahmed/octokit.net,editor-tools/octokit.net,Sarmad93/octokit.net,octokit-net-test-org/octokit.net,brramos/octokit.net,chunkychode/octokit.net,ivandrofly/octokit.net,devkhan/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,TattsGroup/octokit.net,octokit-net-test/octokit.net,alfhenrik/octokit.net,dlsteuer/octokit.net,M-Zuber/octokit.net,shana/octokit.net,fake-organization/octokit.net,khellang/octokit.net,rlugojr/octokit.net,magoswiat/octokit.net,gdziadkiewicz/octokit.net,SLdragon1989/octokit.net,chunkychode/octokit.net,khellang/octokit.net,naveensrinivasan/octokit.net,thedillonb/octokit.net,daukantas/octokit.net,octokit-net-test-org/octokit.net,kdolan/octokit.net,hitesh97/octokit.net,gdziadkiewicz/octokit.net,shiftkey-tester/octokit.net,shiftkey/octokit.net,shiftkey/octokit.net,devkhan/octokit.net,cH40z-Lord/octokit.net,nsnnnnrn/octokit.net,fffej/octokit.net,mminns/octokit.net,TattsGroup/octokit.net,editor-tools/octokit.net,dampir/octokit.net,SamTheDev/octokit.net,octokit/octokit.net,takumikub/octokit.net,geek0r/octokit.net,rlugojr/octokit.net,nsrnnnnn/octokit.net,mminns/octokit.net,darrelmiller/octokit.net,adamralph/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,gabrielweyer/octokit.net,SmithAndr/octokit.net,forki/octokit.net,eriawan/octokit.net,eriawan/octokit.net,hahmed/octokit.net
Octokit.Reactive/Clients/ObservableOrganizationTeamsClient.cs
Octokit.Reactive/Clients/ObservableOrganizationTeamsClient.cs
using System; using System.Reactive; using System.Reactive.Threading.Tasks; using Octokit.Reactive.Internal; namespace Octokit.Reactive { public class ObservableOrganizationTeamsClient : IObservableOrganizationTeamsClient { readonly IConnection _connection; readonly ITeamsClient _client; /// <summary> /// Initializes a new Organization Teams API client. /// </summary> /// <param name="client">An <see cref="IGitHubClient" /> used to make the requests</param> public ObservableOrganizationTeamsClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _connection = client.Connection; _client = client.Organization.Team; } public IObservable<TeamItem> GetAllTeams(string org) { Ensure.ArgumentNotNullOrEmptyString(org, "org"); return _connection.GetAndFlattenAllPages<TeamItem>(ApiUrls.OrganizationTeams(org)); } public IObservable<Team> CreateTeam(string org, NewTeam team) { return _client.CreateTeam(org, team).ToObservable(); } public IObservable<Team> UpdateTeam(int id, UpdateTeam team) { return _client.UpdateTeam(id, team).ToObservable(); } public IObservable<Unit> DeleteTeam(int id) { return _client.DeleteTeam(id).ToObservable(); } } }
using System; using System.Reactive; using System.Reactive.Threading.Tasks; using Octokit.Reactive.Internal; namespace Octokit.Reactive { public class ObservableOrganizationTeamsClient : IObservableOrganizationTeamsClient { readonly IConnection _connection; /// <summary> /// Initializes a new Organization Teams API client. /// </summary> /// <param name="client">An <see cref="IGitHubClient" /> used to make the requests</param> public ObservableOrganizationTeamsClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _connection = client.Connection; } public IObservable<TeamItem> GetAllTeams(string org) { Ensure.ArgumentNotNullOrEmptyString(org, "org"); return _connection.GetAndFlattenAllPages<TeamItem>(ApiUrls.OrganizationTeams(org)); } public IObservable<Team> CreateTeam(string org, NewTeam team) { throw new NotImplementedException(); } public IObservable<Team> UpdateTeam(int id, UpdateTeam team) { throw new NotImplementedException(); } public IObservable<Unit> DeleteTeam(int id) { throw new NotImplementedException(); } } }
mit
C#
1583b396930d548e4e7cd30f7067844ca3601c61
Call Open action for grid activation
directhex/banshee-hacks,dufoli/banshee,stsundermann/banshee,allquixotic/banshee-gst-sharp-work,allquixotic/banshee-gst-sharp-work,mono-soc-2011/banshee,allquixotic/banshee-gst-sharp-work,GNOME/banshee,babycaseny/banshee,GNOME/banshee,babycaseny/banshee,stsundermann/banshee,directhex/banshee-hacks,lamalex/Banshee,lamalex/Banshee,ixfalia/banshee,Dynalon/banshee-osx,Dynalon/banshee-osx,lamalex/Banshee,ixfalia/banshee,babycaseny/banshee,Carbenium/banshee,Carbenium/banshee,mono-soc-2011/banshee,babycaseny/banshee,dufoli/banshee,mono-soc-2011/banshee,Dynalon/banshee-osx,petejohanson/banshee,lamalex/Banshee,GNOME/banshee,GNOME/banshee,ixfalia/banshee,Dynalon/banshee-osx,mono-soc-2011/banshee,babycaseny/banshee,GNOME/banshee,ixfalia/banshee,directhex/banshee-hacks,stsundermann/banshee,stsundermann/banshee,Dynalon/banshee-osx,GNOME/banshee,mono-soc-2011/banshee,GNOME/banshee,Carbenium/banshee,arfbtwn/banshee,dufoli/banshee,Carbenium/banshee,arfbtwn/banshee,arfbtwn/banshee,babycaseny/banshee,Dynalon/banshee-osx,directhex/banshee-hacks,Dynalon/banshee-osx,ixfalia/banshee,ixfalia/banshee,directhex/banshee-hacks,stsundermann/banshee,petejohanson/banshee,dufoli/banshee,allquixotic/banshee-gst-sharp-work,GNOME/banshee,Dynalon/banshee-osx,petejohanson/banshee,stsundermann/banshee,petejohanson/banshee,mono-soc-2011/banshee,babycaseny/banshee,arfbtwn/banshee,stsundermann/banshee,babycaseny/banshee,lamalex/Banshee,arfbtwn/banshee,mono-soc-2011/banshee,dufoli/banshee,dufoli/banshee,lamalex/Banshee,Carbenium/banshee,dufoli/banshee,Carbenium/banshee,ixfalia/banshee,directhex/banshee-hacks,arfbtwn/banshee,petejohanson/banshee,arfbtwn/banshee,arfbtwn/banshee,dufoli/banshee,petejohanson/banshee,stsundermann/banshee,allquixotic/banshee-gst-sharp-work,allquixotic/banshee-gst-sharp-work,ixfalia/banshee
src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookGrid.cs
src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookGrid.cs
// // AudiobookGrid.cs // // Author: // Gabriel Burt <gburt@novell.com> // // Copyright (C) 2009 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using Mono.Unix; using Gtk; using Hyena; using Hyena.Data; using Hyena.Data.Gui; using Banshee.Widgets; using Banshee.Sources; using Banshee.ServiceStack; using Banshee.Collection; using Banshee.Collection.Database; using Banshee.Collection.Gui; using Banshee.Gui; using Banshee.Gui.Widgets; using Banshee.Sources.Gui; using Banshee.Web; namespace Banshee.Audiobook { public class AudiobookGrid : SearchableListView<AlbumInfo> { private AudiobookLibrarySource library; public AudiobookGrid () { var layout = new DataViewLayoutGrid () { ChildAllocator = () => new DataViewChildAlbum () { ImageSize = 180 }, View = this }; ViewLayout = layout; RowActivated += (o, a) => library.Actions["AudiobookOpen"].Activate (); } public void SetLibrary (AudiobookLibrarySource library) { SetModel (library.BooksModel); this.library = library; } public override bool SelectOnRowFound { get { return true; } } protected override Gdk.Size OnMeasureChild () { return base.OnMeasureChild (); } protected override bool OnPopupMenu () { library.Actions["AudiobookBookPopup"].Activate (); return true; } } }
// // AudiobookGrid.cs // // Author: // Gabriel Burt <gburt@novell.com> // // Copyright (C) 2009 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using Mono.Unix; using Gtk; using Hyena; using Hyena.Data; using Hyena.Data.Gui; using Banshee.Widgets; using Banshee.Sources; using Banshee.ServiceStack; using Banshee.Collection; using Banshee.Collection.Database; using Banshee.Collection.Gui; using Banshee.Gui; using Banshee.Gui.Widgets; using Banshee.Sources.Gui; using Banshee.Web; namespace Banshee.Audiobook { public class AudiobookGrid : SearchableListView<AlbumInfo> { private AudiobookLibrarySource library; public AudiobookGrid () { var layout = new DataViewLayoutGrid () { ChildAllocator = () => new DataViewChildAlbum () { ImageSize = 180 }, View = this }; ViewLayout = layout; } public void SetLibrary (AudiobookLibrarySource library) { SetModel (library.BooksModel); this.library = library; } public override bool SelectOnRowFound { get { return true; } } protected override Gdk.Size OnMeasureChild () { return base.OnMeasureChild (); } protected override bool OnPopupMenu () { library.Actions["AudiobookBookPopup"].Activate (); return true; } } }
mit
C#
73bc86a042aa903edc9beb883082477296838aae
Fix bad conflict resolution which caused mulitple entries
dotnet/roslyn,diryboy/roslyn,bartdesmet/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,weltkante/roslyn,mavasani/roslyn,diryboy/roslyn,sharwell/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,diryboy/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn
src/Workspaces/Core/Portable/Experiments/IExperimentationService.cs
src/Workspaces/Core/Portable/Experiments/IExperimentationService.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Composition; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; namespace Microsoft.CodeAnalysis.Experiments { internal interface IExperimentationService : IWorkspaceService { bool IsExperimentEnabled(string experimentName); void EnableExperiment(string experimentName, bool value); } [ExportWorkspaceService(typeof(IExperimentationService)), Shared] internal class DefaultExperimentationService : IExperimentationService { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public DefaultExperimentationService() { } public bool IsExperimentEnabled(string experimentName) => false; public void EnableExperiment(string experimentName, bool value) { } } internal static class WellKnownExperimentNames { public const string PartialLoadMode = "Roslyn.PartialLoadMode"; public const string TypeImportCompletion = "Roslyn.TypeImportCompletion"; public const string InsertFullMethodCall = "Roslyn.InsertFullMethodCall"; public const string TargetTypedCompletionFilter = "Roslyn.TargetTypedCompletionFilter"; public const string OOPServerGC = "Roslyn.OOPServerGC"; public const string ImportsOnPasteDefaultEnabled = "Roslyn.ImportsOnPasteDefaultEnabled"; public const string LspTextSyncEnabled = "Roslyn.LspTextSyncEnabled"; public const string SourceGeneratorsEnableOpeningInWorkspace = "Roslyn.SourceGeneratorsEnableOpeningInWorkspace"; public const string RemoveUnusedReferences = "Roslyn.RemoveUnusedReferences"; public const string LSPCompletion = "Roslyn.LSP.Completion"; public const string CloudCache = "Roslyn.CloudCache"; public const string UnnamedSymbolCompletionDisabled = "Roslyn.UnnamedSymbolCompletionDisabled"; public const string InheritanceMargin = "Roslyn.InheritanceMargin"; public const string RazorLspEditorFeatureFlag = "Razor.LSP.Editor"; public const string LspPullDiagnosticsFeatureFlag = "Lsp.PullDiagnostics"; public const string OOPCoreClr = "Roslyn.OOPCoreClr"; public const string ProgressionForceLegacySearch = "Roslyn.ProgressionForceLegacySearch"; public const string AsynchronousQuickActions = "Roslyn.AsynchronousQuickActions"; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Composition; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; namespace Microsoft.CodeAnalysis.Experiments { internal interface IExperimentationService : IWorkspaceService { bool IsExperimentEnabled(string experimentName); void EnableExperiment(string experimentName, bool value); } [ExportWorkspaceService(typeof(IExperimentationService)), Shared] internal class DefaultExperimentationService : IExperimentationService { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public DefaultExperimentationService() { } public bool IsExperimentEnabled(string experimentName) => false; public void EnableExperiment(string experimentName, bool value) { } } internal static class WellKnownExperimentNames { public const string PartialLoadMode = "Roslyn.PartialLoadMode"; public const string TypeImportCompletion = "Roslyn.TypeImportCompletion"; public const string InsertFullMethodCall = "Roslyn.InsertFullMethodCall"; public const string TargetTypedCompletionFilter = "Roslyn.TargetTypedCompletionFilter"; public const string OOPServerGC = "Roslyn.OOPServerGC"; public const string LspTextSyncEnabled = "Roslyn.LspTextSyncEnabled"; public const string ImportsOnPasteDefaultEnabled = "Roslyn.ImportsOnPasteDefaultEnabled"; public const string LspTextSyncEnabled = "Roslyn.LspTextSyncEnabled"; public const string SourceGeneratorsEnableOpeningInWorkspace = "Roslyn.SourceGeneratorsEnableOpeningInWorkspace"; public const string RemoveUnusedReferences = "Roslyn.RemoveUnusedReferences"; public const string LSPCompletion = "Roslyn.LSP.Completion"; public const string CloudCache = "Roslyn.CloudCache"; public const string UnnamedSymbolCompletionDisabled = "Roslyn.UnnamedSymbolCompletionDisabled"; public const string InheritanceMargin = "Roslyn.InheritanceMargin"; public const string RazorLspEditorFeatureFlag = "Razor.LSP.Editor"; public const string LspPullDiagnosticsFeatureFlag = "Lsp.PullDiagnostics"; public const string OOPCoreClr = "Roslyn.OOPCoreClr"; public const string ProgressionForceLegacySearch = "Roslyn.ProgressionForceLegacySearch"; public const string AsynchronousQuickActions = "Roslyn.AsynchronousQuickActions"; } }
mit
C#
579c99c403abfbe9aab3900758c8fad50b7cbaee
Add docs
mavasani/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn
src/Workspaces/Core/Portable/Workspace/Host/HostSolutionServices.cs
src/Workspaces/Core/Portable/Workspace/Host/HostSolutionServices.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Host.Mef; namespace Microsoft.CodeAnalysis.Host { /// <summary> /// Per solution services provided by the host environment. /// </summary> internal sealed class HostSolutionServices { /// <remarks> /// Note: do not expose publicly. <see cref="HostWorkspaceServices"/> exposes a <see /// cref="HostWorkspaceServices.Workspace"/> which we want to avoid doing from our immutable snapshots. /// </remarks> private readonly HostWorkspaceServices _services; // This ensures a single instance of this type associated with each HostWorkspaceServices. [Obsolete("Do not call directly. Use HostWorkspaceServices.SolutionServices to acquire an instance")] internal HostSolutionServices(HostWorkspaceServices services) { _services = services; } internal IMefHostExportProvider ExportProvider => (IMefHostExportProvider)_services.HostServices; /// <inheritdoc cref="HostWorkspaceServices.GetService"/> public TWorkspaceService? GetService<TWorkspaceService>() where TWorkspaceService : IWorkspaceService => _services.GetService<TWorkspaceService>(); /// <inheritdoc cref="HostWorkspaceServices.GetRequiredService"/> public TWorkspaceService GetRequiredService<TWorkspaceService>() where TWorkspaceService : IWorkspaceService => _services.GetRequiredService<TWorkspaceService>(); /// <inheritdoc cref="HostWorkspaceServices.SupportedLanguages"/> public IEnumerable<string> SupportedLanguages => _services.SupportedLanguages; /// <inheritdoc cref="HostWorkspaceServices.IsSupported"/> public bool IsSupported(string languageName) => _services.IsSupported(languageName); /// <summary> /// Gets the <see cref="HostProjectServices"/> for the language name. /// </summary> /// <exception cref="NotSupportedException">Thrown if the language isn't supported.</exception> public HostProjectServices GetProjectServices(string languageName) => _services.GetLanguageServices(languageName).ProjectServices; } internal static class HostSolutionServicesExtensions { public static TLanguageService GetRequiredLanguageService<TLanguageService>(this HostSolutionServices services, string language) where TLanguageService : ILanguageService => services.GetProjectServices(language).GetRequiredService<TLanguageService>(); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Host.Mef; namespace Microsoft.CodeAnalysis.Host { // TODO(cyrusn): Make public. Tracked through https://github.com/dotnet/roslyn/issues/62914 internal sealed class HostSolutionServices { /// <remarks> /// Note: do not expose publicly. <see cref="HostWorkspaceServices"/> exposes a <see /// cref="HostWorkspaceServices.Workspace"/> which we want to avoid doing from our immutable snapshots. /// </remarks> private readonly HostWorkspaceServices _services; // This ensures a single instance of this type associated with each HostWorkspaceServices. [Obsolete("Do not call directly. Use HostWorkspaceServices.SolutionServices to acquire an instance")] internal HostSolutionServices(HostWorkspaceServices services) { _services = services; } internal IMefHostExportProvider ExportProvider => (IMefHostExportProvider)_services.HostServices; /// <inheritdoc cref="HostWorkspaceServices.GetService"/> public TWorkspaceService? GetService<TWorkspaceService>() where TWorkspaceService : IWorkspaceService => _services.GetService<TWorkspaceService>(); /// <inheritdoc cref="HostWorkspaceServices.GetRequiredService"/> public TWorkspaceService GetRequiredService<TWorkspaceService>() where TWorkspaceService : IWorkspaceService => _services.GetRequiredService<TWorkspaceService>(); /// <inheritdoc cref="HostWorkspaceServices.SupportedLanguages"/> public IEnumerable<string> SupportedLanguages => _services.SupportedLanguages; /// <inheritdoc cref="HostWorkspaceServices.IsSupported"/> public bool IsSupported(string languageName) => _services.IsSupported(languageName); /// <summary> /// Gets the <see cref="HostProjectServices"/> for the language name. /// </summary> /// <exception cref="NotSupportedException">Thrown if the language isn't supported.</exception> public HostProjectServices GetProjectServices(string languageName) => _services.GetLanguageServices(languageName).ProjectServices; } internal static class HostSolutionServicesExtensions { public static TLanguageService GetRequiredLanguageService<TLanguageService>(this HostSolutionServices services, string language) where TLanguageService : ILanguageService => services.GetProjectServices(language).GetRequiredService<TLanguageService>(); } }
mit
C#
a44b30f698dd64de944a4b73f3ac2a66c0cff634
Update FluentCell
MarcelMalik/Fluent-Xamarin-Forms
src/FluentXamarinForms/FluentBase/FluentCellBase.cs
src/FluentXamarinForms/FluentBase/FluentCellBase.cs
using System; using Xamarin.Forms; using System.Linq.Expressions; namespace FluentXamarinForms.FluentBase { public abstract class FluentCellBase<TFluent, T> : FluentElementBase<TFluent, T> where TFluent: FluentBase<T> where T : Cell, new() { public FluentCellBase () : base () { } public FluentCellBase (T instance) : base (instance) { } public TFluent AddContextAction (MenuItem item) { this.BuilderActions.Add (cell => { cell.ContextActions.Add (item); }); return this as TFluent; } public TFluent AddContextAction<TFluent2, T2> (FluentMenuItemBase<TFluent2, T2> fluentMenuItem) where TFluent2: FluentBase<T2> where T2: MenuItem, new() { this.BuilderActions.Add (cell => { cell.ContextActions.Add (fluentMenuItem.Build ()); }); return this as TFluent; } public TFluent RemoveContextAction (MenuItem item) { this.BuilderActions.Add (cell => { cell.ContextActions.Remove (item); }); return this as TFluent; } public TFluent Height (double value) { this.BuilderActions.Add (cell => { cell.Height = value; }); return this as TFluent; } public TFluent IsEnabled (bool enabled) { this.BuilderActions.Add (cell => { cell.IsEnabled = enabled; }); return this as TFluent; } public TFluent BindIsEnabled (string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null, string stringFormat = null) { this.BuilderActions.Add (cell => { cell.SetBinding (Cell.IsEnabledProperty, path, mode, converter, stringFormat); }); return this as TFluent; } public TFluent BindIsEnabled<TSource> (Expression<Func<TSource, object>> sourceProperty, BindingMode mode = BindingMode.Default, IValueConverter converter = null, string stringFormat = null) { this.BuilderActions.Add (cell => { cell.SetBinding<TSource> (Cell.IsEnabledProperty, sourceProperty, mode, converter, stringFormat); }); return this as TFluent; } } }
using System; using Xamarin.Forms; namespace FluentXamarinForms.FluentBase { public abstract class FluentCellBase<TFluent, T> : FluentElementBase<TFluent, T> where TFluent: FluentBase<T> where T : Cell, new() { public FluentCellBase () : base () { } public FluentCellBase (T instance) : base (instance) { } public TFluent AddContextAction (MenuItem item) { this.BuilderActions.Add (cell => { cell.ContextActions.Add (item); }); return this as TFluent; } public TFluent RemoveContextAction (MenuItem item) { this.BuilderActions.Add (cell => { cell.ContextActions.Remove (item); }); return this as TFluent; } public TFluent Height (double value) { this.BuilderActions.Add (cell => { cell.Height = value; }); return this as TFluent; } public TFluent IsEnabled (bool enabled) { this.BuilderActions.Add (cell => { cell.IsEnabled = enabled; }); return this as TFluent; } } }
mit
C#
08ecb685dab475865abfbd7ad886a858f01d6031
add missing routes
dnauck/License.Manager,dnauck/License.Manager
src/License.Manager.Core/ServiceModel/GetLicense.cs
src/License.Manager.Core/ServiceModel/GetLicense.cs
using System; using ServiceStack.ServiceHost; namespace License.Manager.Core.ServiceModel { [Route("/licenses/{Id}", "GET, OPTIONS")] [Route("/licenses/{LicenseId}", "GET, OPTIONS")] [Route("/products/{ProductId}/licenses/{Id}", "GET, OPTIONS")] [Route("/products/{ProductId}/licenses/{LicenseId}", "GET, OPTIONS")] [Route("/customers/{CustomerId}/licenses/{Id}", "GET, OPTIONS")] [Route("/customers/{CustomerId}/licenses/{LicenseId}", "GET, OPTIONS")] public class GetLicense : IReturn<Model.License> { public int Id { get; set; } public Guid LicenseId { get; set; } public int CustomerId { get; set; } public int ProductId { get; set; } } }
using System; using ServiceStack.ServiceHost; namespace License.Manager.Core.ServiceModel { [Route("/products/{ProductId}/licenses/{Id}", "GET, OPTIONS")] [Route("/products/{ProductId}/licenses/{LicenseId}", "GET, OPTIONS")] [Route("/customers/{CustomerId}/licenses/{Id}", "GET, OPTIONS")] [Route("/customers/{CustomerId}/licenses/{LicenseId}", "GET, OPTIONS")] public class GetLicense : IReturn<Model.License> { public int Id { get; set; } public Guid LicenseId { get; set; } public int CustomerId { get; set; } public int ProductId { get; set; } } }
mit
C#
4a44b845c12bd01ffb4d60deefb63171dc789d0d
Allow redirect to returnUrl from login part
SntsDev/n2cms,nimore/n2cms,bussemac/n2cms,VoidPointerAB/n2cms,nicklv/n2cms,VoidPointerAB/n2cms,EzyWebwerkstaden/n2cms,nimore/n2cms,n2cms/n2cms,EzyWebwerkstaden/n2cms,bussemac/n2cms,nicklv/n2cms,SntsDev/n2cms,nicklv/n2cms,EzyWebwerkstaden/n2cms,VoidPointerAB/n2cms,VoidPointerAB/n2cms,bussemac/n2cms,n2cms/n2cms,nimore/n2cms,DejanMilicic/n2cms,bussemac/n2cms,nimore/n2cms,DejanMilicic/n2cms,SntsDev/n2cms,EzyWebwerkstaden/n2cms,nicklv/n2cms,DejanMilicic/n2cms,SntsDev/n2cms,bussemac/n2cms,DejanMilicic/n2cms,n2cms/n2cms,nicklv/n2cms,n2cms/n2cms,EzyWebwerkstaden/n2cms
src/Mvc/MvcTemplates/Controllers/LoginController.cs
src/Mvc/MvcTemplates/Controllers/LoginController.cs
using System.Web.Mvc; using System.Web.Security; using N2.Templates.Mvc.Models.Parts; using N2.Templates.Mvc.Models; using N2.Web; namespace N2.Templates.Mvc.Controllers { [Controls(typeof(LoginItem))] public class LoginController : TemplatesControllerBase<LoginItem> { public override ActionResult Index() { var model = new LoginModel(CurrentItem) { LoggedIn = User.Identity.IsAuthenticated }; return View(model); } public ActionResult Login(string userName, string password, bool? remember) { if(Membership.ValidateUser(userName, password) || FormsAuthentication.Authenticate(userName, password)) { FormsAuthentication.SetAuthCookie(userName, remember ?? false); if (string.IsNullOrEmpty(Request["returnUrl"])) return RedirectToParentPage(); else return Redirect(Request["returnUrl"]); } else { ModelState.AddModelError("Login.Failed", CurrentItem.FailureText); } return ViewParentPage(); } public ActionResult Logout() { FormsAuthentication.SignOut(); return RedirectToParentPage(); } } }
using System.Web.Mvc; using System.Web.Security; using N2.Templates.Mvc.Models.Parts; using N2.Templates.Mvc.Models; using N2.Web; namespace N2.Templates.Mvc.Controllers { [Controls(typeof(LoginItem))] public class LoginController : TemplatesControllerBase<LoginItem> { public override ActionResult Index() { var model = new LoginModel(CurrentItem) { LoggedIn = User.Identity.IsAuthenticated }; return View(model); } public ActionResult Login(string userName, string password, bool? remember) { if(Membership.ValidateUser(userName, password) || FormsAuthentication.Authenticate(userName, password)) { FormsAuthentication.SetAuthCookie(userName, remember ?? false); return RedirectToParentPage(); } else { ModelState.AddModelError("Login.Failed", CurrentItem.FailureText); } return ViewParentPage(); } public ActionResult Logout() { FormsAuthentication.SignOut(); return RedirectToParentPage(); } } }
lgpl-2.1
C#
c0320e2d1665b0fcdb637c6dea5198180480f554
Kill projectiles after 2 seconds
DonRobo/satanic-buddies
Assets/Scripts/Projectile.cs
Assets/Scripts/Projectile.cs
using UnityEngine; using System.Collections; public class Projectile : MonoBehaviour { public float lifetime = 2; private float age = 0; public float damage = 10; public float speed = 30; public Vector3 direction; // Use this for initialization void Start() { direction = direction.normalized * speed; } // Update is called once per frame void Update() { age += Time.deltaTime; if (age > lifetime) { Destroy(this.gameObject); } transform.Translate(direction.normalized * speed * Time.deltaTime); } void OnTriggerEnter(Collider other) { if (other.GetComponent<Enemy>() != null && other.GetComponent<Rigidbody>() != null) { other.GetComponent<Enemy>().Damage(damage); other.GetComponent<Rigidbody>().AddForce(direction.normalized * 200); } if (other.GetComponent<PlayerController>() == null) { GameObject.Destroy(this.gameObject); } } }
using UnityEngine; using System.Collections; public class Projectile : MonoBehaviour { public float damage = 10; public float speed = 30; public Vector3 direction; // Use this for initialization void Start() { direction = direction.normalized * speed; } // Update is called once per frame void Update() { transform.Translate(direction.normalized * speed * Time.deltaTime); } void OnTriggerEnter(Collider other) { if (other.GetComponent<Enemy>() != null && other.GetComponent<Rigidbody>() != null) { other.GetComponent<Enemy>().Damage(damage); other.GetComponent<Rigidbody>().AddForce(direction.normalized * 200); } if (other.GetComponent<PlayerController>() == null) { GameObject.Destroy(this.gameObject); } } }
cc0-1.0
C#
a78aac33429ebf257dbf7179f15abe156ea6ac11
Fix #400 : Title Summary
petedavis/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,xkproject/Orchard2,petedavis/Orchard2,xkproject/Orchard2,petedavis/Orchard2,lukaskabrt/Orchard2,jtkech/Orchard2,jtkech/Orchard2,lukaskabrt/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,jtkech/Orchard2,jtkech/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,lukaskabrt/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,yiji/Orchard2,xkproject/Orchard2,yiji/Orchard2,lukaskabrt/Orchard2,yiji/Orchard2
src/Orchard.Cms.Web/Modules/Orchard.Title/Views/TitlePart.Summary.cshtml
src/Orchard.Cms.Web/Modules/Orchard.Title/Views/TitlePart.Summary.cshtml
@model dynamic <h2><a display-for="@Model.ContentItem">@Model.Title</a></h2>
@model dynamic <h1><a display-for="@Model.ContentItem" >@Model.Title</a></h1>
bsd-3-clause
C#
8169442ed1479122c029b63a8c178dd4d99aeeb6
Update StringExtensions.cs
BenjaminAbt/snippets
CSharp/StringExtensions.cs
CSharp/StringExtensions.cs
using System; namespace SchwabenCode.Basics { public static class StringExtensions { /// <summary> /// Cuts a string with the given max length /// </summary> public static string WithMaxLength(this string value, int maxLength) { return value?.Substring(0, Math.Min(value.Length, maxLength)); } } }
using System; namespace SchwabenCode.Core { public static class StringExtensions { /// <summary> /// Cuts a string with the given max length /// </summary> public static string WithMaxLength(this string value, int maxLength) { return value?.Substring(0, Math.Min(value.Length, maxLength)); } } }
mit
C#
6a4878de71de9aec0c1e79fbe715b548f7e5d5ed
support limitting details request by fields
ericnewton76/gmaps-api-net
src/Google.Maps/Places/Details/PlaceDetailsRequest.cs
src/Google.Maps/Places/Details/PlaceDetailsRequest.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Google.Maps.Places.Details { public class PlaceDetailsRequest : BaseRequest { /// <summary> /// Undocumented address component filters. /// Only geocoding results matching the component filters will be returned. /// </summary> /// <remarks>IE: country:uk|locality:stathern</remarks> public string PlaceID { get; set; } /// <summary> /// The bounding box of the viewport within which to bias geocode /// results more prominently. /// </summary> /// <remarks> /// Optional. This parameter will only influence, not fully restrict, results /// from the geocoder. /// </remarks> /// <see href="http://code.google.com/apis/maps/documentation/geocoding/#Viewports"/> [System.Obsolete("Use PlaceID")] public string Reference { get; set; } /// <summary> /// The region code, specified as a ccTLD ("top-level domain") /// two-character value. /// </summary> /// <remarks> /// Optional. This parameter will only influence, not fully restrict, results /// from the geocoder. /// </remarks> /// <see href="http://code.google.com/apis/maps/documentation/geocoding/#RegionCodes"/> public string Extensions { get; set; } /// <summary> /// Use the fields parameter to specify a comma-separated list of place data types to return /// </summary> /// <remarks> /// Optional. /// </remarks> /// <see href="https://developers.google.com/places/web-service/details#fields" /> public string[] Fields { get; set; } /// <summary> /// The language in which to return results. If language is not /// supplied, the geocoder will attempt to use the native language of /// the domain from which the request is sent wherever possible. /// </summary> /// <remarks>Optional.</remarks> /// <see href="http://code.google.com/apis/maps/faq.html#languagesupport"/> public string Language { get; set; } public override Uri ToUri() { var qsb = new Internal.QueryStringBuilder(); if(!String.IsNullOrEmpty(PlaceID)) { qsb.Append("placeid", PlaceID); } #pragma warning disable CS0618 // Type or member is obsolete else if(!String.IsNullOrEmpty(Reference)) { qsb.Append("reference", Reference); } #pragma warning restore CS0618 // Type or member is obsolete else { throw new InvalidOperationException("Either PlaceID or Reference fields must be set."); } if(!String.IsNullOrEmpty(Extensions)) qsb.Append("extensions", Extensions); if ((Fields != null && Fields.Any())) { qsb.Append("fields", string.Join("|", Fields)); } if(!String.IsNullOrEmpty(Language)) qsb.Append("language", Language); var url = "json?" + qsb.ToString(); return new Uri(url, UriKind.Relative); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Google.Maps.Places.Details { public class PlaceDetailsRequest : BaseRequest { /// <summary> /// Undocumented address component filters. /// Only geocoding results matching the component filters will be returned. /// </summary> /// <remarks>IE: country:uk|locality:stathern</remarks> public string PlaceID { get; set; } /// <summary> /// The bounding box of the viewport within which to bias geocode /// results more prominently. /// </summary> /// <remarks> /// Optional. This parameter will only influence, not fully restrict, results /// from the geocoder. /// </remarks> /// <see href="http://code.google.com/apis/maps/documentation/geocoding/#Viewports"/> [System.Obsolete("Use PlaceID")] public string Reference { get; set; } /// <summary> /// The region code, specified as a ccTLD ("top-level domain") /// two-character value. /// </summary> /// <remarks> /// Optional. This parameter will only influence, not fully restrict, results /// from the geocoder. /// </remarks> /// <see href="http://code.google.com/apis/maps/documentation/geocoding/#RegionCodes"/> public string Extensions { get; set; } /// <summary> /// The language in which to return results. If language is not /// supplied, the geocoder will attempt to use the native language of /// the domain from which the request is sent wherever possible. /// </summary> /// <remarks>Optional.</remarks> /// <see href="http://code.google.com/apis/maps/faq.html#languagesupport"/> public string Language { get; set; } public override Uri ToUri() { var qsb = new Internal.QueryStringBuilder(); if(!String.IsNullOrEmpty(PlaceID)) { qsb.Append("placeid", PlaceID); } #pragma warning disable CS0618 // Type or member is obsolete else if(!String.IsNullOrEmpty(Reference)) { qsb.Append("reference", Reference); } #pragma warning restore CS0618 // Type or member is obsolete else { throw new InvalidOperationException("Either PlaceID or Reference fields must be set."); } if(!String.IsNullOrEmpty(Extensions)) qsb.Append("extensions", Extensions); if(!String.IsNullOrEmpty(Language)) qsb.Append("language", Language); var url = "json?" + qsb.ToString(); return new Uri(url, UriKind.Relative); } } }
apache-2.0
C#
88a23a8e019f74af92306065fd360b76650f2f10
add null instance for testing
oldrev/maltreport
src/Sandwych.Reporting.Tests/Common/TestingDataSet.cs
src/Sandwych.Reporting.Tests/Common/TestingDataSet.cs
using System; using System.Collections.Generic; using System.Text; namespace Sandwych.Reporting.Tests.Common { public class TestingDataSet { public SimpleObject SimpleObject { get; private set; } = new SimpleObject(); public SimpleObject NullSimpleObject { get; private set; } = null; public Table Table1 { get; private set; } = new Table(); } }
using System; using System.Collections.Generic; using System.Text; namespace Sandwych.Reporting.Tests.Common { public class TestingDataSet { public SimpleObject SimpleObject { get; private set; } = new SimpleObject(); public Table Table1 { get; private set; } = new Table(); } }
mit
C#
54632c9feaa8590427cf6d3bd8c3b0b2e00d9fe5
Support watching of arbitrary connections
mono/dbus-sharp-glib,mono/dbus-sharp-glib
glib/GLib.cs
glib/GLib.cs
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; //using GLib; //using Gtk; using NDesk.DBus; using NDesk.GLib; using org.freedesktop.DBus; namespace NDesk.DBus { //FIXME: this API needs review and de-unixification. It is horrid, but gets the job done. public static class BusG { static bool initialized = false; public static void Init () { if (initialized) return; Init (Bus.System); Init (Bus.Session); //TODO: consider starter bus? initialized = true; } public static void Init (Connection conn) { IOFunc dispatchHandler = delegate (IOChannel source, IOCondition condition, IntPtr data) { conn.Iterate (); return true; }; Init (conn, dispatchHandler); } public static void Init (Connection conn, IOFunc dispatchHandler) { IOChannel channel = new IOChannel ((int)conn.Transport.SocketHandle); IO.AddWatch (channel, IOCondition.In, dispatchHandler); } } }
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; //using GLib; //using Gtk; using NDesk.DBus; using NDesk.GLib; using org.freedesktop.DBus; namespace NDesk.DBus { //FIXME: this API needs review and de-unixification. It is horrid, but gets the job done. public static class BusG { static bool SystemDispatch (IOChannel source, IOCondition condition, IntPtr data) { Bus.System.Iterate (); return true; } static bool SessionDispatch (IOChannel source, IOCondition condition, IntPtr data) { Bus.Session.Iterate (); return true; } static bool initialized = false; public static void Init () { if (initialized) return; Init (Bus.System, SystemDispatch); Init (Bus.Session, SessionDispatch); initialized = true; } public static void Init (Connection conn, IOFunc dispatchHandler) { IOChannel channel = new IOChannel ((int)conn.Transport.SocketHandle); IO.AddWatch (channel, IOCondition.In, dispatchHandler); } //TODO: add public API to watch an arbitrary connection } }
mit
C#
1a2a6328c4bc59864030c7f8e64e73a52f6162d0
Remove redundant code
mstrother/BmpListener
BmpListener/Bmp/BmpHeader.cs
BmpListener/Bmp/BmpHeader.cs
using System; using System.Linq; using BmpListener; namespace BmpListener.Bmp { public class BmpHeader { public BmpHeader(byte[] data) { Version = data.First(); //if (Version != 3) //{ // throw new Exception("invalid BMP version"); //} Length = data.ToUInt32(1); Type = (MessageType)data.ElementAt(5); } public byte Version { get; } public uint Length { get; } public MessageType Type { get; } } }
using System; using Newtonsoft.Json; using System.Linq; using BmpListener; namespace BmpListener.Bmp { public class BmpHeader { public BmpHeader(byte[] data) { Version = data.First(); //if (Version != 3) //{ // throw new Exception("invalid BMP version"); //} Length = data.ToUInt32(1); Type = (MessageType)data.ElementAt(5); } public byte Version { get; private set; } [JsonIgnore] public uint Length { get; private set; } public MessageType Type { get; private set; } } }
mit
C#
cd78d82927a6deb6a3ae9a89741f4d91c2abd0de
Bump version
managed-commons/SvgNet
SvgNet/AssemblyInfo.cs
SvgNet/AssemblyInfo.cs
/* Copyright © 2003 RiskCare Ltd. All rights reserved. Copyright © 2010 SvgNet & SvgGdi Bridge Project. All rights reserved. Copyright © 2015, 2017 Rafael Teixeira, Mojmír Němeček, Benjamin Peterson and Other Contributors Original source code licensed with BSD-2-Clause spirit, treat it thus, see accompanied LICENSE for more */ using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("SvgNet")] [assembly: AssemblyDescription("C# framework for creating SVG images")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("RiskCare Ltd, SvgNet and SvgGdi Bridge Project, Rafael Teixeira, Mojmír Němeček, Benjamin Peterson")] [assembly: AssemblyProduct("SvgNet")] [assembly: AssemblyCopyright("Copyright 2003, 2010, 2015, 2017 RiskCare Ltd, SvgNet and SvgGdi Bridge Project, Rafael Teixeira, Mojmír Němeček, Benjamin Peterson")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyFileVersion("1.0.7")] [assembly: AssemblyInformationalVersion("1.0.7")] [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")]
/* Copyright © 2003 RiskCare Ltd. All rights reserved. Copyright © 2010 SvgNet & SvgGdi Bridge Project. All rights reserved. Copyright © 2015, 2017 Rafael Teixeira, Mojmír Němeček, Benjamin Peterson and Other Contributors Original source code licensed with BSD-2-Clause spirit, treat it thus, see accompanied LICENSE for more */ using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("SvgNet")] [assembly: AssemblyDescription("C# framework for creating SVG images")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("RiskCare Ltd, SvgNet and SvgGdi Bridge Project, Rafael Teixeira, Mojmír Němeček, Benjamin Peterson")] [assembly: AssemblyProduct("SvgNet")] [assembly: AssemblyCopyright("Copyright 2003, 2010, 2015, 2017 RiskCare Ltd, SvgNet and SvgGdi Bridge Project, Rafael Teixeira, Mojmír Němeček, Benjamin Peterson")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyFileVersion("1.0.6")] [assembly: AssemblyInformationalVersion("1.0.6")] [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")]
bsd-3-clause
C#
85485c5ebfd80de8f1e4d17068d2a88b0478fbda
remove unuse code
yb199478/catlib,CatLib/Framework
CatLib.VS/CatLib/Core/App.cs
CatLib.VS/CatLib/Core/App.cs
/* * This file is part of the CatLib package. * * (c) Yu Bin <support@catlib.io> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * Document: http://catlib.io/ */ using System; using CatLib.API; namespace CatLib { /// <summary> /// CatLib实例 /// </summary> public sealed class App { /// <summary> /// CatLib实例 /// </summary> private static IApplication instance; /// <summary> /// CatLib实例 /// </summary> public static IApplication Instance { get { if (instance != null) { return instance; } throw new NullReferenceException("Application is not instance."); } internal set { instance = value; } } } }
/* * This file is part of the CatLib package. * * (c) Yu Bin <support@catlib.io> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * Document: http://catlib.io/ */ using System; using System.Reflection; using CatLib.API; namespace CatLib { /// <summary> /// CatLib实例 /// </summary> public sealed class App { /// <summary> /// CatLib实例 /// </summary> private static IApplication instance; /// <summary> /// CatLib实例 /// </summary> public static IApplication Instance { get { if (instance != null) { return instance; } throw new NullReferenceException("Application is not instance."); } internal set { instance = value; } } } }
unknown
C#
37547667de34ab6d5afc01bb1bcb994afe994ce2
Paste in some more CEF docs.
ITGlobal/CefSharp,twxstar/CefSharp,dga711/CefSharp,gregmartinhtc/CefSharp,AJDev77/CefSharp,illfang/CefSharp,haozhouxu/CefSharp,NumbersInternational/CefSharp,jamespearce2006/CefSharp,haozhouxu/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,rlmcneary2/CefSharp,dga711/CefSharp,zhangjingpu/CefSharp,wangzheng888520/CefSharp,joshvera/CefSharp,windygu/CefSharp,Livit/CefSharp,gregmartinhtc/CefSharp,AJDev77/CefSharp,VioletLife/CefSharp,joshvera/CefSharp,ruisebastiao/CefSharp,Livit/CefSharp,illfang/CefSharp,AJDev77/CefSharp,joshvera/CefSharp,jamespearce2006/CefSharp,Haraguroicha/CefSharp,yoder/CefSharp,twxstar/CefSharp,NumbersInternational/CefSharp,yoder/CefSharp,rlmcneary2/CefSharp,illfang/CefSharp,VioletLife/CefSharp,yoder/CefSharp,ITGlobal/CefSharp,battewr/CefSharp,VioletLife/CefSharp,dga711/CefSharp,Haraguroicha/CefSharp,ruisebastiao/CefSharp,Haraguroicha/CefSharp,ruisebastiao/CefSharp,wangzheng888520/CefSharp,battewr/CefSharp,zhangjingpu/CefSharp,wangzheng888520/CefSharp,AJDev77/CefSharp,haozhouxu/CefSharp,zhangjingpu/CefSharp,gregmartinhtc/CefSharp,joshvera/CefSharp,jamespearce2006/CefSharp,NumbersInternational/CefSharp,windygu/CefSharp,wangzheng888520/CefSharp,Livit/CefSharp,Livit/CefSharp,haozhouxu/CefSharp,battewr/CefSharp,ruisebastiao/CefSharp,rlmcneary2/CefSharp,yoder/CefSharp,battewr/CefSharp,Haraguroicha/CefSharp,windygu/CefSharp,gregmartinhtc/CefSharp,dga711/CefSharp,rlmcneary2/CefSharp,ITGlobal/CefSharp,twxstar/CefSharp,Haraguroicha/CefSharp,VioletLife/CefSharp,zhangjingpu/CefSharp,windygu/CefSharp,twxstar/CefSharp,ITGlobal/CefSharp,illfang/CefSharp,NumbersInternational/CefSharp
CefSharp/ILifeSpanHandler.cs
CefSharp/ILifeSpanHandler.cs
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. namespace CefSharp { public interface ILifeSpanHandler { /// <summary> /// Called before a popup window is created. /// </summary> /// <param name="browser">The IWebBrowser control this request is for.</param> /// <param name="sourceUrl">The URL of the HTML frame that launched this popup.</param> /// <param name="targetUrl">The URL of the popup content. (This may be empty/null)</param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="width"></param> /// <param name="height"></param> /// <returns></returns> /// <remarks> /// CEF documentation: /// /// Called on the IO thread before a new popup window is created. The |browser| /// and |frame| parameters represent the source of the popup request. The /// |target_url| and |target_frame_name| values may be empty if none were /// specified with the request. The |popupFeatures| structure contains /// information about the requested popup window. To allow creation of the /// popup window optionally modify |windowInfo|, |client|, |settings| and /// |no_javascript_access| and return false. To cancel creation of the popup /// window return true. The |client| and |settings| values will default to the /// source browser's values. The |no_javascript_access| value indicates whether /// the new browser window should be scriptable and in the same process as the /// source browser. /// </remarks> bool OnBeforePopup(IWebBrowser browser, string sourceUrl, string targetUrl, ref int x, ref int y, ref int width, ref int height); /// <summary> /// Called before a CefBrowser window (either the main browser for IWebBrowser, /// or one of its children) /// </summary> /// <param name="browser"></param> void OnBeforeClose(IWebBrowser browser); } }
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. namespace CefSharp { public interface ILifeSpanHandler { bool OnBeforePopup(IWebBrowser browser, string sourceUrl, string targetUrl, ref int x, ref int y, ref int width, ref int height); void OnBeforeClose(IWebBrowser browser); } }
bsd-3-clause
C#
2b498f45cba3554d33d3d29e7c010ee8b893e9af
Revert PortUtil.cs changes (#147)
StefH/WireMock.Net,StefH/WireMock.Net,WireMock-Net/WireMock.Net
src/WireMock.Net/Http/PortUtil.cs
src/WireMock.Net/Http/PortUtil.cs
using System.Net; using System.Net.Sockets; using System.Text.RegularExpressions; namespace WireMock.Http { /// <summary> /// Port Utility class /// </summary> public static class PortUtil { private static readonly Regex UrlDetailsRegex = new Regex(@"^(?<proto>\w+)://[^/]+?(?<port>\d+)?/", RegexOptions.Compiled); /// <summary> /// Finds a free TCP port. /// </summary> /// <remarks>see http://stackoverflow.com/questions/138043/find-the-next-tcp-port-in-net.</remarks> public static int FindFreeTcpPort() { TcpListener tcpListener = null; try { tcpListener = new TcpListener(IPAddress.Loopback, 0); tcpListener.Start(); return ((IPEndPoint)tcpListener.LocalEndpoint).Port; } finally { tcpListener?.Stop(); } } /// <summary> /// Extract a proto and port from a URL. /// </summary> public static bool TryExtractProtocolAndPort(string url, out string proto, out int port) { proto = null; port = 0; Match m = UrlDetailsRegex.Match(url); if (m.Success) { proto = m.Groups["proto"].Value; return int.TryParse(m.Groups["port"].Value, out port); } return false; } } }
using System.Net; using System.Net.Sockets; using System.Text.RegularExpressions; namespace WireMock.Http { /// <summary> /// Port Utility class /// </summary> public static class PortUtil { private static readonly IPEndPoint DefaultLoopbackEndpoint = new IPEndPoint(IPAddress.Loopback, port: 0); private static readonly Regex UrlDetailsRegex = new Regex(@"^(?<proto>\w+)://[^/]+?(?<port>\d+)?/", RegexOptions.Compiled); /// <summary> /// Finds a free TCP port. /// </summary> /// <remarks>see http://stackoverflow.com/questions/138043/find-the-next-tcp-port-in-net.</remarks> public static int FindFreeTcpPort() { using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { socket.Bind(DefaultLoopbackEndpoint); return ((IPEndPoint)socket.LocalEndPoint).Port; } } /// <summary> /// Extract a proto and port from a URL. /// </summary> public static bool TryExtractProtocolAndPort(string url, out string proto, out int port) { proto = null; port = 0; Match m = UrlDetailsRegex.Match(url); if (m.Success) { proto = m.Groups["proto"].Value; return int.TryParse(m.Groups["port"].Value, out port); } return false; } } }
apache-2.0
C#
7321d5047974be13ac2d1a4df4bdc023d6f4f2b8
Create a new copy of the MapContext every time a new MapContextScope is created
eswann/Mapster
src/Mapster.Core/MapContext/MapContextScope.cs
src/Mapster.Core/MapContext/MapContextScope.cs
using System; using Mapster.Utils; namespace Mapster { public class MapContextScope : IDisposable { public MapContext Context { get; } private readonly MapContext? _oldContext; public MapContextScope() { _oldContext = MapContext.Current; this.Context = new MapContext(); if (_oldContext != null) { foreach (var parameter in _oldContext.Parameters) { this.Context.Parameters[parameter.Key] = parameter.Value; } foreach (var reference in _oldContext.References) { this.Context.References[reference.Key] = reference.Value; } } MapContext.Current = this.Context; } public void Dispose() { MapContext.Current = _oldContext; } public static TResult GetOrAddMapReference<TResult>(ReferenceTuple key, Func<ReferenceTuple, TResult> mapFn) where TResult : notnull { using var context = new MapContextScope(); var dict = context.Context.References; if (!dict.TryGetValue(key, out var reference)) dict[key] = reference = mapFn(key); return (TResult)reference; } } }
using System; using Mapster.Utils; namespace Mapster { public class MapContextScope : IDisposable { public MapContext Context { get; } private readonly bool _isRootScope; public MapContextScope() { var context = MapContext.Current; if (context == null) { _isRootScope = true; MapContext.Current = context = new MapContext(); } this.Context = context; } public void Dispose() { if (_isRootScope && ReferenceEquals(MapContext.Current, this.Context)) MapContext.Current = null; } public static TResult GetOrAddMapReference<TResult>(ReferenceTuple key, Func<ReferenceTuple, TResult> mapFn) where TResult : notnull { using var context = new MapContextScope(); var dict = context.Context.References; if (!dict.TryGetValue(key, out var reference)) dict[key] = reference = mapFn(key); return (TResult)reference; } } }
mit
C#
e1a703822ecfa68a89a4d62893a5359d184ddb2e
Break out listing variable in LoanTest
jzebedee/lcapi
LCAPI/LcapiTests/LoanTest.cs
LCAPI/LcapiTests/LoanTest.cs
using System.Collections.Generic; using System.IO; using System.Linq; using LendingClub; using Xunit; namespace LcapiTests { public class LoanTest { private KeyValuePair<string, string> GetTestCredentials() { var lines = File.ReadLines(@"C:\Dropbox\Data\LocalRepos\lcapi\LCAPI\testCredentials.txt").ToList(); return new KeyValuePair<string, string>(lines.First(), lines.Last()); } private Loan CreateApiObject() { var cred = GetTestCredentials(); var apiKey = cred.Value; return new Loan(apiKey); } [Fact] public void ListingTest() { var api = CreateApiObject(); var task = api.GetListingAsync(); var listing = task.Result; Assert.NotNull(listing); } } }
using System.Collections.Generic; using System.IO; using System.Linq; using LendingClub; using Xunit; namespace LcapiTests { public class LoanTest { private KeyValuePair<string, string> GetTestCredentials() { var lines = File.ReadLines(@"C:\Dropbox\Data\LocalRepos\lcapi\LCAPI\testCredentials.txt").ToList(); return new KeyValuePair<string, string>(lines.First(), lines.Last()); } private Loan CreateApiObject() { var cred = GetTestCredentials(); var apiKey = cred.Value; return new Loan(apiKey); } [Fact] public void ListingTest() { var api = CreateApiObject(); var listing = api.GetListingAsync().Result; Assert.NotNull(listing); } } }
agpl-3.0
C#
70c84811ed00a37b438cea3941000bba12ed418d
Revert incorrect change
peppy/osu-new,peppy/osu,UselessToucan/osu,peppy/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,ppy/osu
osu.Game.Tests/Resources/TestResources.cs
osu.Game.Tests/Resources/TestResources.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using NUnit.Framework; using osu.Framework.IO.Stores; namespace osu.Game.Tests.Resources { public static class TestResources { public static DllResourceStore GetStore() => new DllResourceStore(typeof(TestResources).Assembly); public static Stream OpenResource(string name) => GetStore().GetStream($"Resources/{name}"); public static Stream GetTestBeatmapStream(bool virtualTrack = false) => OpenResource($"Archives/241526 Soleily - Renatus{(virtualTrack ? "_virtual" : "")}.osz"); public static string GetTestBeatmapForImport(bool virtualTrack = false) { var tempPath = Path.GetTempFileName() + ".osz"; using (var stream = GetTestBeatmapStream(virtualTrack)) using (var newFile = File.Create(tempPath)) stream.CopyTo(newFile); Assert.IsTrue(File.Exists(tempPath)); return tempPath; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using NUnit.Framework; using osu.Framework; using osu.Framework.IO.Stores; namespace osu.Game.Tests.Resources { public static class TestResources { public static DllResourceStore GetStore() => new DllResourceStore(typeof(TestResources).Assembly); public static Stream OpenResource(string name) => GetStore().GetStream($"Resources/{name}"); public static Stream GetTestBeatmapStream(bool virtualTrack = false) => OpenResource($"Archives/241526 Soleily - Renatus{(virtualTrack ? "_virtual" : "")}.osz"); public static string GetTestBeatmapForImport(bool virtualTrack = false) { var tempPath = Path.Combine(RuntimeInfo.StartupDirectory, Path.GetTempFileName() + ".osz"); using (var stream = GetTestBeatmapStream(virtualTrack)) using (var newFile = File.Create(tempPath)) stream.CopyTo(newFile); Assert.IsTrue(File.Exists(tempPath)); return tempPath; } } }
mit
C#
f99435ff6a8b80cfac0a89d4a3210338026ff5f8
Add a null check to FlatProgressBar.brush
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
Core/Controls/FlatProgressBar.Designer.cs
Core/Controls/FlatProgressBar.Designer.cs
namespace TweetDick.Core.Controls { partial class FlatProgressBar { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (brush != null)brush.Dispose(); if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { components = new System.ComponentModel.Container(); } #endregion } }
namespace TweetDick.Core.Controls { partial class FlatProgressBar { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { brush.Dispose(); if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { components = new System.ComponentModel.Container(); } #endregion } }
mit
C#
665c61f832d384cebb63e38f2b501055b1561a8b
Make surveillance camera static shorter (#11757)
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
Content.Client/SurveillanceCamera/ActiveSurveillanceCameraMonitor.cs
Content.Client/SurveillanceCamera/ActiveSurveillanceCameraMonitor.cs
namespace Content.Client.SurveillanceCamera; [RegisterComponent] public sealed class ActiveSurveillanceCameraMonitorVisualsComponent : Component { public float TimeLeft = 10f; public Action? OnFinish; }
namespace Content.Client.SurveillanceCamera; [RegisterComponent] public sealed class ActiveSurveillanceCameraMonitorVisualsComponent : Component { public float TimeLeft = 30f; public Action? OnFinish; }
mit
C#
ed450ad5a2411693a87336061d3ca9b0632e0fd7
Update SnapshotSpanExtensionMethods.cs
Zebrina/PapyrusScriptEditorVSIX,Zebrina/PapyrusScriptEditorVSIX
PapyrusScriptEditorVSIX/Common/Extensions/SnapshotSpanExtensionMethods.cs
PapyrusScriptEditorVSIX/Common/Extensions/SnapshotSpanExtensionMethods.cs
using Microsoft.VisualStudio.Text; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Papyrus.Common.Extensions { internal static class TextSnapshotExtensionMethods { #region ITextSnapshot public static SnapshotSpan Ignore(this ITextSnapshotLine, int offset, Predicate<char> pred) { } public static SnapshotSpan Ignore(this ITextSnapshotLine, int offset) { } #endregion #region SnapshotSpan public static SnapshotSpan Subspan(this SnapshotSpan value, int offset, int length) { return new SnapshotSpan(value.Snapshot, new Span(value.Start.Position + offset, length)); } public static SnapshotSpan Subspan(this SnapshotSpan value, int offset) { return value.Subspan(offset, value.Length - offset); } public static SnapshotSpan Trim(this SnapshotSpan value) { string text = value.GetText(); int offset; for (offset = 0; offset < text.Length; ++offset) { if (!Char.IsWhiteSpace(text[offset])) { break; } } int length = text.Length - offset; for (; length >= 0; --length) { if (!Char.IsWhiteSpace(text[offset + (length - 1)])) { break; } } return new SnapshotSpan(value.Start + offset, length); } #endregion } }
using Microsoft.VisualStudio.Text; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Papyrus.Common.Extensions { internal static class SnapshotSpanExtended { public static SnapshotSpan Subspan(this SnapshotSpan value, int offset, int length) { return new SnapshotSpan(value.Snapshot, new Span(value.Start.Position + offset, length)); } public static SnapshotSpan Subspan(this SnapshotSpan value, int offset) { return value.Subspan(offset, value.Length - offset); } public static SnapshotSpan Trim(this SnapshotSpan value) { string text = value.GetText(); int offset; for (offset = 0; offset < text.Length; ++offset) { if (!Char.IsWhiteSpace(text[offset])) { break; } } int length = text.Length - offset; for (; length >= 0; --length) { if (!Char.IsWhiteSpace(text[offset + (length - 1)])) { break; } } return new SnapshotSpan(value.Start + offset, length); } } }
mit
C#
2f97dc7874801258e9046562934a1ea88b6e2df6
Add LauncherId to CompanyFile (used to Launch a CF from ARL via Link in Partner Dashboard)
tungripe/AccountRight_Live_API_.Net_SDK,sawilde/AccountRight_Live_API_.Net_SDK,MYOB-Technology/AccountRight_Live_API_.Net_SDK
MYOB.API.SDK/SDK/Contracts/CompanyFile.cs
MYOB.API.SDK/SDK/Contracts/CompanyFile.cs
using System; using System.Runtime.Serialization; namespace MYOB.AccountRight.SDK.Contracts { /// <summary> /// CompanyFile /// </summary> public class CompanyFile { /// <summary> /// The CompanyFile Identifier /// </summary> public Guid Id { get; set; } /// <summary> /// CompanyFile Name /// </summary> public string Name { get; set; } /// <summary> /// CompanyFile Library full path (including file name). /// </summary> public string LibraryPath { get; set; } /// <summary> /// Account Right Live product version compatible with this CompanyFile /// </summary> public string ProductVersion { get; set; } /// <summary> /// Account Right Live product level of the CompanyFile /// </summary> public ProductLevel ProductLevel { get; set; } /// <summary> /// Uri of the resource /// </summary> public Uri Uri { get; set; } /// <summary> /// Launcher Id can be used to open Online Company files from command line /// </summary> public Guid? LauncherId { get; set; } } }
using System; using System.Runtime.Serialization; namespace MYOB.AccountRight.SDK.Contracts { /// <summary> /// CompanyFile /// </summary> public class CompanyFile { /// <summary> /// The CompanyFile Identifier /// </summary> public Guid Id { get; set; } /// <summary> /// CompanyFile Name /// </summary> public string Name { get; set; } /// <summary> /// CompanyFile Library full path (including file name). /// </summary> public string LibraryPath { get; set; } /// <summary> /// Account Right Live product version compatible with this CompanyFile /// </summary> public string ProductVersion { get; set; } /// <summary> /// Account Right Live product level of the CompanyFile /// </summary> public ProductLevel ProductLevel { get; set; } /// <summary> /// Uri of the resource /// </summary> public Uri Uri { get; set; } } }
mit
C#
202174fccb5f681fc8d4d8328347a77d0dab3287
Fix an error communicating with some Network Devices (KeyNotFoundException)
IWBWbiz/MultiMiner,nwoolls/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner
MultiMiner.Xgminer.Api/Parsers/MinerStatisticsParser.cs
MultiMiner.Xgminer.Api/Parsers/MinerStatisticsParser.cs
using MultiMiner.Xgminer.Api.Data; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MultiMiner.Xgminer.Api.Parsers { class MinerStatisticsParser : ResponseTextParser { public static void ParseTextForMinerStatistics(string text, List<MinerStatistics> minerStatistics) { List<string> responseParts = ParseResponseText(text); if (responseParts.Count == 0) return; foreach (string responsePart in responseParts) { Dictionary<string, string> keyValuePairs = ParseResponsePart(responsePart); //check for key-value pairs, seen Count == 0 with user API logs if (keyValuePairs.Count > 0) { string id = String.Empty; //user bug reports indicate this key may not exist if (keyValuePairs.ContainsKey("ID")) id = keyValuePairs["ID"]; if (id.StartsWith("pool", StringComparison.OrdinalIgnoreCase)) //not concerned with pool information (for now) continue; MinerStatistics newStatistics = new MinerStatistics(); newStatistics.ID = id; string key = String.Empty; const int MaxChainCount = 16; for (int i = 1; i < MaxChainCount; i++) { key = "chain_acs" + i; if (keyValuePairs.ContainsKey(key)) newStatistics.ChainStatus[i - 1] = keyValuePairs[key]; } key = "frequency"; if (keyValuePairs.ContainsKey(key)) newStatistics.Frequency = TryToParseDouble(keyValuePairs, key, 0.0); minerStatistics.Add(newStatistics); } } } } }
using MultiMiner.Xgminer.Api.Data; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MultiMiner.Xgminer.Api.Parsers { class MinerStatisticsParser : ResponseTextParser { public static void ParseTextForMinerStatistics(string text, List<MinerStatistics> minerStatistics) { List<string> responseParts = ParseResponseText(text); if (responseParts.Count == 0) return; foreach (string responsePart in responseParts) { Dictionary<string, string> keyValuePairs = ParseResponsePart(responsePart); //check for key-value pairs, seen Count == 0 with user API logs if (keyValuePairs.Count > 0) { string id = keyValuePairs["ID"]; if (id.StartsWith("pool", StringComparison.OrdinalIgnoreCase)) //not concerned with pool information (for now) continue; MinerStatistics newStatistics = new MinerStatistics(); newStatistics.ID = id; string key = String.Empty; const int MaxChainCount = 16; for (int i = 1; i < MaxChainCount; i++) { key = "chain_acs" + i; if (keyValuePairs.ContainsKey(key)) newStatistics.ChainStatus[i - 1] = keyValuePairs[key]; } key = "frequency"; if (keyValuePairs.ContainsKey(key)) newStatistics.Frequency = TryToParseDouble(keyValuePairs, key, 0.0); minerStatistics.Add(newStatistics); } } } } }
mit
C#
2906c712ea322709fe6451c17f4254cdc70535ab
enable mixing CallOriginal with DoInstead
telerik/JustMockLite
Telerik.JustMock/Core/Behaviors/CallOriginalBehavior.cs
Telerik.JustMock/Core/Behaviors/CallOriginalBehavior.cs
/* JustMock Lite Copyright © 2010-2014 Telerik AD 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 Telerik.JustMock.Core.Behaviors { internal class CallOriginalBehavior : IBehavior { public void Process(Invocation invocation) { if (ShouldCallOriginal(invocation)) { invocation.UserProvidedImplementation = true; invocation.CallOriginal = true; } } public static bool ShouldCallOriginal(Invocation invocation) { return !invocation.Recording || invocation.RetainBehaviorDuringRecording; } } }
/* JustMock Lite Copyright © 2010-2014 Telerik AD 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 Telerik.JustMock.Core.Behaviors { internal class CallOriginalBehavior : IBehavior { public void Process(Invocation invocation) { if (ShouldCallOriginal(invocation) && !invocation.UserProvidedImplementation) { invocation.UserProvidedImplementation = true; invocation.CallOriginal = true; } } public static bool ShouldCallOriginal(Invocation invocation) { return !invocation.Recording || invocation.RetainBehaviorDuringRecording; } } }
apache-2.0
C#
bad0d3070d765bbe4550fb6b3153d8cfe2f3a71a
Add link to Question Index.
dsteinweg/TeacherPouch,dsteinweg/TeacherPouch,dsteinweg/TeacherPouch,dsteinweg/TeacherPouch
TeacherPouch.Web/Views/Admin/Index.cshtml
TeacherPouch.Web/Views/Admin/Index.cshtml
@model AdminViewModel @{ ViewBag.Title = "Admin"; } <div id="admin"> <h2>Admin Home</h2> <h4>Welcome, @Model.UserName!</h4> <fieldset> <legend>Your Account</legend> <p>Assigned Roles: @Model.Roles</p> </fieldset> <fieldset> <legend>Photos</legend> @if (SecurityHelper.UserIsAdmin(base.User)) { <a href="@Url.PhotoCreate()">Create New Photo</a> <br> } <a href="@Url.PhotoIndex()">View All Photos</a> </fieldset> <fieldset> <legend>Tags</legend> @if (SecurityHelper.UserIsAdmin(base.User)) { <a href="@Url.TagCreate()">Create New Tag</a> <br> } <a href="@Url.TagIndex()">View All Tags</a> </fieldset> <fieldset> <legend>Questions</legend> @Html.ActionLink("View All Questions", MVC.Questions.QuestionIndex()) </fieldset> <p> <a href="@Url.AdminLogout()">Log out</a> </p> </div>
@model AdminViewModel @{ ViewBag.Title = "Admin"; } <div id="admin"> <h2>Admin Home</h2> <h4>Welcome, @Model.UserName!</h4> <fieldset> <legend>Your Account</legend> <p>Assigned Roles: @Model.Roles</p> </fieldset> <fieldset> <legend>Photos</legend> @if (SecurityHelper.UserIsAdmin(base.User)) { <a href="@Url.PhotoCreate()">Create New Photo</a> <br> } <a href="@Url.PhotoIndex()">View All Photos</a> </fieldset> <fieldset> <legend>Tags</legend> @if (SecurityHelper.UserIsAdmin(base.User)) { <a href="@Url.TagCreate()">Create New Tag</a> <br> } <a href="@Url.TagIndex()">View All Tags</a> </fieldset> <p> <a href="@Url.AdminLogout()">Log out</a> </p> </div>
mit
C#
967c67f19f445df498af5d718907fbcb358fab53
Fix compilation.
CosmosOS/Cosmos,MyvarHD/Cosmos,jp2masa/Cosmos,trivalik/Cosmos,MyvarHD/Cosmos,Cyber4/Cosmos,zhangwenquan/Cosmos,tgiphil/Cosmos,kant2002/Cosmos-1,sgetaz/Cosmos,CosmosOS/Cosmos,sgetaz/Cosmos,kant2002/Cosmos-1,fanoI/Cosmos,fanoI/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,tgiphil/Cosmos,zhangwenquan/Cosmos,MetSystem/Cosmos,zhangwenquan/Cosmos,sgetaz/Cosmos,jp2masa/Cosmos,zarlo/Cosmos,MetSystem/Cosmos,MyvarHD/Cosmos,Cyber4/Cosmos,zdimension/Cosmos,zarlo/Cosmos,MetSystem/Cosmos,tgiphil/Cosmos,zdimension/Cosmos,fanoI/Cosmos,zdimension/Cosmos,MetSystem/Cosmos,CosmosOS/Cosmos,trivalik/Cosmos,Cyber4/Cosmos,MyvarHD/Cosmos,zhangwenquan/Cosmos,MetSystem/Cosmos,jp2masa/Cosmos,zarlo/Cosmos,sgetaz/Cosmos,MyvarHD/Cosmos,Cyber4/Cosmos,Cyber4/Cosmos,sgetaz/Cosmos,kant2002/Cosmos-1,zdimension/Cosmos,zhangwenquan/Cosmos,kant2002/Cosmos-1,zdimension/Cosmos,trivalik/Cosmos
Users/Matthijs/PlaygroundHAL/HALGlobal.cs
Users/Matthijs/PlaygroundHAL/HALGlobal.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Cosmos.Core; namespace PlaygroundHAL { public static class HALGlobal { public static void Test() { //Heap.SendStatsToDebugger(); //Heap.SendStatsToDebugger(); new object(); new object(); new object(); new object(); new object(); //Heap.SendStatsToDebugger(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Cosmos.Core; namespace PlaygroundHAL { public static class HALGlobal { public static void Test() { Heap.SendStatsToDebugger(); Heap.SendStatsToDebugger(); new object(); new object(); new object(); new object(); new object(); Heap.SendStatsToDebugger(); } } }
bsd-3-clause
C#
b4e7b030e6d8b3677929212c9db370ab2b12ecab
Update library version to 1.3.6
ion-sapoval/google-measurement-protocol-dotnet
src/GoogleMeasurementProtocol/Properties/AssemblyInfo.cs
src/GoogleMeasurementProtocol/Properties/AssemblyInfo.cs
using System.Reflection; 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("GoogleMeasurementProtocol")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("GoogleMeasurementProtocol")] [assembly: AssemblyCopyright("Copyright © 2014")] [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("64a833e9-803e-4d51-8820-ac631ff2c9a5")] // 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.3.6.0")] [assembly: AssemblyFileVersion("1.3.6.0")]
using System.Reflection; 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("GoogleMeasurementProtocol")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("GoogleMeasurementProtocol")] [assembly: AssemblyCopyright("Copyright © 2014")] [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("64a833e9-803e-4d51-8820-ac631ff2c9a5")] // 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.3.5.0")] [assembly: AssemblyFileVersion("1.3.5.0")]
mit
C#
845050294d640bb8734a5ab5e7c59195e9875c62
Create multiple events, serialize and re-load.
mdavid/DDay-iCal-svn
Example2/Program.cs
Example2/Program.cs
using System; using System.Collections.Generic; using System.Text; using DDay.iCal; using DDay.iCal.Components; using DDay.iCal.DataTypes; using DDay.iCal.Serialization; namespace Example2 { public class Program { /// <summary> /// Creates a string representation of an event. /// </summary> /// <param name="evt">The event to display</param> /// <returns>A string representation of the event.</returns> static string GetDescription(Event evt) { string summary = evt.Summary + ": " + evt.Start.Local.ToShortDateString(); if (evt.IsAllDay) { return summary + " (all day)"; } else { summary += ", " + evt.Start.Local.ToShortTimeString(); return summary + " (" + Math.Round((double)(evt.End - evt.Start).TotalHours) + " hours)"; } } /// <summary> /// The main program execution. /// </summary> static void Main(string[] args) { // Create a new iCalendar iCalendar iCal = new iCalendar(); // Create the event, and add it to the iCalendar Event evt = Event.Create(iCal); // Set information about the event evt.Start = DateTime.Today; evt.Start = evt.Start.AddHours(8); evt.End = evt.Start.AddHours(18); // This also sets the duration evt.DTStamp = DateTime.Now; evt.Description = "The event description"; evt.Location = "Event location"; evt.Summary = "18 hour event summary"; // Set information about the second event evt = Event.Create(iCal); evt.Start = DateTime.Today.AddDays(5); evt.End = evt.Start.AddDays(1); evt.IsAllDay = true; evt.DTStamp = DateTime.Now; evt.Summary = "All-day event"; // Display each event foreach(Event e in iCal.Events) Console.WriteLine("Event created: " + GetDescription(e)); // Serialize (save) the iCalendar iCalendarSerializer serializer = new iCalendarSerializer(iCal); serializer.Serialize(@"iCalendar.ics"); Console.WriteLine("iCalendar file saved." + Environment.NewLine); iCal = iCalendar.LoadFromFile(@"iCalendar.ics"); Console.WriteLine("iCalendar file loaded."); foreach (Event e in iCal.Events) Console.WriteLine("Event loaded: " + GetDescription(e)); } } }
using System; using System.Collections.Generic; using System.Text; using DDay.iCal; using DDay.iCal.Components; using DDay.iCal.Serialization; namespace Example2 { public class Program { static void Main(string[] args) { // Create a new iCalendar iCalendar iCal = new iCalendar(); // Create the event, and add it to the iCalendar Event evt = Event.Create(iCal); // Set information about the event evt.Start = DateTime.Today; evt.End = DateTime.Today.AddDays(1); // This also sets the duration evt.DTStamp = DateTime.Now; evt.Description = "The event description"; evt.Location = "Event location"; evt.Summary = "The summary of the event"; // Serialize (save) the iCalendar iCalendarSerializer serializer = new iCalendarSerializer(iCal); serializer.Serialize(@"iCalendar.ics"); } } }
bsd-3-clause
C#
cf6831d8f9e4b14d63a5ccaef41d9afafcb09544
fix detyper registration
volak/Aggregates.NET,volak/Aggregates.NET
src/Aggregates.NET.NServiceBus/Internal/MessageDetyper.cs
src/Aggregates.NET.NServiceBus/Internal/MessageDetyper.cs
using Aggregates.Extensions; using Aggregates.Logging; using NServiceBus.Pipeline; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; using System.Threading.Tasks; namespace Aggregates.Internal { public class MessageDetyper : Behavior<IOutgoingPhysicalMessageContext> { private static readonly ILog Logger = LogProvider.GetLogger("MessageDetyper"); private Contracts.IVersionRegistrar _registrar; public MessageDetyper(Contracts.IVersionRegistrar registrar) { _registrar = registrar; } public override Task Invoke(IOutgoingPhysicalMessageContext context, Func<Task> next) { var messageTypeKey = "NServiceBus.EnclosedMessageTypes"; //var headers = context.Headers; if (!context.Headers.TryGetValue(messageTypeKey, out var messageType)) return next(); if(messageType.IndexOf(';') != -1) messageType = messageType.Substring(0, messageType.IndexOf(';')); // Don't use context.Message.Instance because it will be IEvent_impl var type = Type.GetType(messageType, false); if(type == null) { Logger.WarnEvent("UnknownType", "{MessageType} sent - but could not load type?", messageType); return next(); } var definition = _registrar.GetVersionedName(type); if (definition == null) { Logger.WarnEvent("UnknownMessage", "{MessageType} has no known definition", type.FullName); return next(); } context.Headers[messageTypeKey] = definition; return next(); } } [ExcludeFromCodeCoverage] internal class MessageDetyperRegistration : RegisterStep { public MessageDetyperRegistration() : base( stepId: "MessageDetyper", behavior: typeof(MessageDetyper), description: "detypes outgoing messages to Versioned commands/events", factoryMethod: (b) => new MessageDetyper(b.Build<Contracts.IVersionRegistrar>())) { } } }
using Aggregates.Extensions; using Aggregates.Logging; using NServiceBus.Pipeline; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; using System.Threading.Tasks; namespace Aggregates.Internal { public class MessageDetyper : Behavior<IOutgoingPhysicalMessageContext> { private static readonly ILog Logger = LogProvider.GetLogger("MessageDetyper"); private Contracts.IVersionRegistrar _registrar; public MessageDetyper(Contracts.IVersionRegistrar registrar) { _registrar = registrar; } public override Task Invoke(IOutgoingPhysicalMessageContext context, Func<Task> next) { var messageTypeKey = "NServiceBus.EnclosedMessageTypes"; //var headers = context.Headers; if (!context.Headers.TryGetValue(messageTypeKey, out var messageType)) return next(); if(messageType.IndexOf(';') != -1) messageType = messageType.Substring(0, messageType.IndexOf(';')); // Don't use context.Message.Instance because it will be IEvent_impl var type = Type.GetType(messageType, false); if(type == null) { Logger.WarnEvent("UnknownType", "{MessageType} sent - but could not load type?", messageType); return next(); } var definition = _registrar.GetVersionedName(type); if (definition == null) { Logger.WarnEvent("UnknownMessage", "{MessageType} has no known definition", type.FullName); return next(); } context.Headers[messageTypeKey] = definition; return next(); } } [ExcludeFromCodeCoverage] internal class MessageDetyperRegistration : RegisterStep { public MessageDetyperRegistration() : base( stepId: "MessageDetyper", behavior: typeof(MessageDetyperRegistration), description: "detypes outgoing messages to Versioned commands/events", factoryMethod: (b) => new MessageDetyper(b.Build<Contracts.IVersionRegistrar>())) { } } }
mit
C#
e8cc8ec17feafed2ffecb2bf9321ea7b5ccae3f7
fix datagrid xmlns attribute.
SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,Perspex/Perspex,grokys/Perspex,wieslawsoltes/Perspex,grokys/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,akrisiun/Perspex,SuperJMN/Avalonia
src/Avalonia.Controls.DataGrid/Properties/AssemblyInfo.cs
src/Avalonia.Controls.DataGrid/Properties/AssemblyInfo.cs
// Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; using System.Runtime.CompilerServices; using Avalonia.Metadata; [assembly: InternalsVisibleTo("Avalonia.Controls.UnitTests")] [assembly: InternalsVisibleTo("Avalonia.DesignerSupport")] [assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Controls")]
// Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; using System.Runtime.CompilerServices; using Avalonia.Metadata; [assembly: InternalsVisibleTo("Avalonia.Controls.UnitTests")] [assembly: InternalsVisibleTo("Avalonia.DesignerSupport")] [assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia")] [assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Controls")] [assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Controls.Primitives")] [assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Controls.Collections")]
mit
C#
85ec125219cd9f6d3ad47da7fbd2e0ec3fe501df
Update ACommand_ResLenFlex class. -Modify CheckLen() method. -Add comment to constructor.
CountrySideEngineer/Ev3Controller
dev/src/Ev3Controller/Ev3Command/ACommand_ResLenFlex.cs
dev/src/Ev3Controller/Ev3Command/ACommand_ResLenFlex.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ev3Controller.Ev3Command { public abstract class ACommand_ResLenFlex : ACommand { #region Constructors and the Finalizer /// <summary> /// Constructor /// </summary> /// <param name="CommandParam"></param> public ACommand_ResLenFlex(ICommandParam CommandParam = null) : base(CommandParam) { } #endregion #region Other methods and private properties in calling order /// <summary> /// Check whether size of response data buffer and length set in reponse data, /// calcurated data lenght from the number of device in the data, matche. /// (To be more precise, the size should equals the result of formula below.) /// FORMULA : Device num x OneDataLen property. /// If they are not match, CommandLenException will be thrown. /// </summary> /// <param name="OptDataIndex">Index of option data.</param> /// <returns>Length written in response data.</returns> protected override int CheckLen(int OptDataIndex) { Debug.Assert(this.ResData != null); int ResLen = base.CheckLen(); int DataIndex = (int)RESPONSE_BUFF_INDEX.RESPONSE_BUFF_INDEX_RES_DATA_TOP; int DevNum = this.ResData[DataIndex]; if (ResLen != (DevNum * this.OneDataLen) + 1) { throw new CommandLenException( "Command or response data Len error", this.Cmd, this.SubCmd, this.Name); } return ResLen; } #endregion #region Public Properties /// <summary> /// Size of "ONE DATA". /// </summary> public byte OneDataLen { get; protected set; } #endregion } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ev3Controller.Ev3Command { public abstract class ACommand_ResLenFlex : ACommand { #region Constructors and the Finalizer public ACommand_ResLenFlex(ICommandParam CommandParam) : base(CommandParam) { } #endregion #region Other methods and private properties in calling order /// <summary> /// Check whether size of response data buffer and length set in reponse data, /// calcurated data lenght from the number of device in the data, matche. /// (To be more precise, the size should equals the result of formula below.) /// FORMULA : Device num x OneDataLen property. /// If they are not match, CommandLenException will be thrown. /// </summary> /// <param name="OptDataIndex">Index of option data.</param> /// <returns>Length written in response data.</returns> protected override int CheckLen(int OptDataIndex) { Debug.Assert(this.ResData != null); int DataIndex = (int)RESPONSE_BUFF_INDEX.RESPONSE_BUFF_INDEX_RES_DATA_TOP; int DevNum = this.ResData[DataIndex]; if (ResLen != (DevNum * this.OneDataLen) + 1) { throw new CommandLenException( "Command or response data Len error", this.Cmd, this.SubCmd, this.Name); } return ResLen; } #endregion #region Public Properties /// <summary> /// Size of "ONE DATA". /// </summary> public byte OneDataLen { get; protected set; } #endregion } }
mit
C#
366583c8e24bc3b7f2e533e8ea4623641507c5bd
Update tests
smoogipooo/osu,NeoAdonis/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,smoogipoo/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Osu.Difficulty; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; [TestCase(6.6975550434910005d, "diffcalc-test")] [TestCase(1.4673500058356748d, "zero-length-sliders")] public void Test(double expected, string name) => base.Test(expected, name); [TestCase(8.938989502378238d, "diffcalc-test")] [TestCase(1.779323508403831d, "zero-length-sliders")] public void TestClockRateAdjusted(double expected, string name) => Test(expected, name, new OsuModDoubleTime()); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Osu.Difficulty; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; [TestCase(6.531832890435525d, "diffcalc-test")] [TestCase(1.4644923495008817d, "zero-length-sliders")] public void Test(double expected, string name) => base.Test(expected, name); [TestCase(8.8067616302940852d, "diffcalc-test")] [TestCase(1.7763214959309293d, "zero-length-sliders")] public void TestClockRateAdjusted(double expected, string name) => Test(expected, name, new OsuModDoubleTime()); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } }
mit
C#
adc2dfa6c6ffecf27ae299d0cecd1e2844d380f3
Fix HitCircleLongCombo test stacking off-screen
peppy/osu,EVAST9919/osu,ZLima12/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,EVAST9919/osu,UselessToucan/osu,ppy/osu,2yangk23/osu,peppy/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,johnneijzen/osu,johnneijzen/osu,smoogipoo/osu,ZLima12/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu
osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs
osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLongCombo.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Tests.Visual; using osuTK; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class TestSceneHitCircleLongCombo : PlayerTestScene { public TestSceneHitCircleLongCombo() : base(new OsuRuleset()) { } protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = new BeatmapInfo { BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 }, Ruleset = ruleset } }; for (int i = 0; i < 512; i++) if (i % 32 < 20) beatmap.HitObjects.Add(new HitCircle { Position = new Vector2(256, 192), StartTime = i * 100 }); return beatmap; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Tests.Visual; using osuTK; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class TestSceneHitCircleLongCombo : PlayerTestScene { public TestSceneHitCircleLongCombo() : base(new OsuRuleset()) { } protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = new BeatmapInfo { BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 }, Ruleset = ruleset } }; for (int i = 0; i < 512; i++) beatmap.HitObjects.Add(new HitCircle { Position = new Vector2(256, 192), StartTime = i * 100 }); return beatmap; } } }
mit
C#
07efca6a8e865d94bd1b5efb47922445c1098fa5
Fix being unable to remove project reference from Dependencies folder.
mrward/monodevelop-dnx-addin
src/MonoDevelop.Dnx/MonoDevelop.Dnx.NodeBuilders/DependencyNodeBuilder.cs
src/MonoDevelop.Dnx/MonoDevelop.Dnx.NodeBuilders/DependencyNodeBuilder.cs
// // DependencyNodeBuilder.cs // // Author: // Matt Ward <ward.matt@gmail.com> // // Copyright (c) 2015 Matthew Ward // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // using System; using MonoDevelop.Dnx.Commands; using MonoDevelop.Ide.Gui.Components; namespace MonoDevelop.Dnx.NodeBuilders { public class DependencyNodeBuilder : TypeNodeBuilder { public override string ContextMenuAddinPath { get { return "/MonoDevelop/Dnx/ContextMenu/ProjectPad/DependencyNode"; } } public override Type NodeDataType { get { return typeof(DependencyNode); } } public override Type CommandHandlerType { get { return typeof(DependencyNodeCommandHandler); } } public override string GetNodeName (ITreeNavigator thisNode, object dataObject) { var node = (DependencyNode)dataObject; return node.Name; } public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo) { var node = (DependencyNode)dataObject; nodeInfo.Label = node.GetLabel (); nodeInfo.Icon = Context.GetIcon (node.GetIconId ()); nodeInfo.StatusSeverity = node.GetStatusSeverity (); nodeInfo.StatusMessage = node.GetStatusMessage (); nodeInfo.DisabledStyle = node.IsDisabled (); } public override bool HasChildNodes (ITreeBuilder builder, object dataObject) { var node = (DependencyNode)dataObject; return node.HasDependencies (); } public override void BuildChildNodes (ITreeBuilder treeBuilder, object dataObject) { var node = (DependencyNode)dataObject; foreach (DependencyNode childNode in node.GetDependencies ()) { treeBuilder.AddChild (childNode); } } } }
// // DependencyNodeBuilder.cs // // Author: // Matt Ward <ward.matt@gmail.com> // // Copyright (c) 2015 Matthew Ward // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // using System; using MonoDevelop.Ide.Gui.Components; namespace MonoDevelop.Dnx.NodeBuilders { public class DependencyNodeBuilder : TypeNodeBuilder { public override string ContextMenuAddinPath { get { return "/MonoDevelop/Dnx/ContextMenu/ProjectPad/DependencyNode"; } } public override Type NodeDataType { get { return typeof(DependencyNode); } } public override string GetNodeName (ITreeNavigator thisNode, object dataObject) { var node = (DependencyNode)dataObject; return node.Name; } public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo) { var node = (DependencyNode)dataObject; nodeInfo.Label = node.GetLabel (); nodeInfo.Icon = Context.GetIcon (node.GetIconId ()); nodeInfo.StatusSeverity = node.GetStatusSeverity (); nodeInfo.StatusMessage = node.GetStatusMessage (); nodeInfo.DisabledStyle = node.IsDisabled (); } public override bool HasChildNodes (ITreeBuilder builder, object dataObject) { var node = (DependencyNode)dataObject; return node.HasDependencies (); } public override void BuildChildNodes (ITreeBuilder treeBuilder, object dataObject) { var node = (DependencyNode)dataObject; foreach (DependencyNode childNode in node.GetDependencies ()) { treeBuilder.AddChild (childNode); } } } }
mit
C#
5265bd95160fc94920a3bf723e839cd00fda5ca1
Add retry to SetCloudBuildVariable method in VisualStudioTeamServices.
AArnott/Nerdbank.GitVersioning,AArnott/Nerdbank.GitVersioning,AArnott/Nerdbank.GitVersioning
src/NerdBank.GitVersioning/CloudBuildServices/VisualStudioTeamServices.cs
src/NerdBank.GitVersioning/CloudBuildServices/VisualStudioTeamServices.cs
namespace Nerdbank.GitVersioning.CloudBuildServices { using System; using System.Collections.Generic; using System.IO; /// <summary> /// /// </summary> /// <remarks> /// The VSTS-specific properties referenced here are documented here: /// https://msdn.microsoft.com/en-us/Library/vs/alm/Build/scripts/variables /// </remarks> internal class VisualStudioTeamServices : ICloudBuild { public bool IsPullRequest => BuildingRef?.StartsWith("refs/pull/") ?? false; public string BuildingTag => CloudBuild.IfStartsWith(BuildingRef, "refs/tags/"); public string BuildingBranch => CloudBuild.IfStartsWith(BuildingRef, "refs/heads/"); public string GitCommitId => null; public bool IsApplicable => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SYSTEM_TEAMPROJECTID")); private static string BuildingRef => Environment.GetEnvironmentVariable("BUILD_SOURCEBRANCH"); public IReadOnlyDictionary<string, string> SetCloudBuildNumber(string buildNumber, TextWriter stdout, TextWriter stderr) { (stdout ?? Console.Out).WriteLine($"##vso[build.updatebuildnumber]{buildNumber}"); return GetDictionaryFor("Build.BuildNumber", buildNumber); } public IReadOnlyDictionary<string, string> SetCloudBuildVariable(string name, string value, TextWriter stdout, TextWriter stderr) { Utilities.FileOperationWithRetry(() => (stdout ?? Console.Out).WriteLine($"##vso[task.setvariable variable={name};]{value}")); return GetDictionaryFor(name, value); } private static IReadOnlyDictionary<string, string> GetDictionaryFor(string variableName, string value) { return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { GetEnvironmentVariableNameForVariable(variableName), value }, }; } private static string GetEnvironmentVariableNameForVariable(string name) => name.ToUpperInvariant().Replace('.', '_'); } }
namespace Nerdbank.GitVersioning.CloudBuildServices { using System; using System.Collections.Generic; using System.IO; /// <summary> /// /// </summary> /// <remarks> /// The VSTS-specific properties referenced here are documented here: /// https://msdn.microsoft.com/en-us/Library/vs/alm/Build/scripts/variables /// </remarks> internal class VisualStudioTeamServices : ICloudBuild { public bool IsPullRequest => BuildingRef?.StartsWith("refs/pull/") ?? false; public string BuildingTag => CloudBuild.IfStartsWith(BuildingRef, "refs/tags/"); public string BuildingBranch => CloudBuild.IfStartsWith(BuildingRef, "refs/heads/"); public string GitCommitId => null; public bool IsApplicable => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SYSTEM_TEAMPROJECTID")); private static string BuildingRef => Environment.GetEnvironmentVariable("BUILD_SOURCEBRANCH"); public IReadOnlyDictionary<string, string> SetCloudBuildNumber(string buildNumber, TextWriter stdout, TextWriter stderr) { (stdout ?? Console.Out).WriteLine($"##vso[build.updatebuildnumber]{buildNumber}"); return GetDictionaryFor("Build.BuildNumber", buildNumber); } public IReadOnlyDictionary<string, string> SetCloudBuildVariable(string name, string value, TextWriter stdout, TextWriter stderr) { (stdout ?? Console.Out).WriteLine($"##vso[task.setvariable variable={name};]{value}"); return GetDictionaryFor(name, value); } private static IReadOnlyDictionary<string, string> GetDictionaryFor(string variableName, string value) { return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { GetEnvironmentVariableNameForVariable(variableName), value }, }; } private static string GetEnvironmentVariableNameForVariable(string name) => name.ToUpperInvariant().Replace('.', '_'); } }
mit
C#
67462477cd89bd9ac030961bcce8abfb82ed4b2d
Update Pregunta1.cs
Baltasarq/ExamenDIA
Codigo/Pregunta1/Pregunta1.cs
Codigo/Pregunta1/Pregunta1.cs
namespace Codigo.Pregunta1 { public static class Pregunta1 { public const string Explicacion = @" Esta es la plantilla para cualquier examen de DIA. Debe funcionar tanto en MonoDevelop/XamarinStudio, como Visual Studio. Si tienes que compartir fuentes entre preguntas (p.ej., porque se pide ampliar una clase ya creada), recuerda copiar la clase de la pregunta anterior en la nueva. Tienes creado aparte un proyecto para tests. Recuerda: - Añadir: tus datos en Codigo.Info - Eliminar: 'Pregunta1.Ppal.Prueba();' en Codigo.Ppal.Main(). Buena suerte, -- Baltasar García, jbgarcia@uvigo.es "; } }
namespace Codigo.Pregunta1 { public static class Pregunta1 { public const string Explicacion = @" Esta es la plantilla para cualquier examen de DIA. Debe funcionar tanto en MonoDevelop/XamarinStudio, como Visual Studio. Si tienes que compartir fuentes entre preguntas (p.ej., porque se pide ampliar una clase ya creada), recuerda copiar la clase de la pregunta anterior en la nueva. Tienes creado aparte un proyecto para tests. Recuerda eliminar: 'Pregunta1.Ppal.Prueba();' en Codigo.Ppal.Main(). Haz modificaciones globales (tracers, etc.) en Codigo.Ppal. Buena suerte, -- Baltasar García, jbgarcia@uvigo.es "; } }
mit
C#
c76782201709c7b4e9a4bbb74abe79fbd1e17e2c
Comment Fail classes #7 - added comment to DesignByContractViolationException
synergy-software/synergy.contracts,synergy-software/synergy.contracts
Synergy.Contracts/Failures/DesignByContractViolationException.cs
Synergy.Contracts/Failures/DesignByContractViolationException.cs
using System; using System.Runtime.Serialization; using JetBrains.Annotations; namespace Synergy.Contracts { /// <summary> /// The exception thrown when some contract check failed. /// When you see it it means that someone does not meet the contract. /// </summary> [Serializable] public class DesignByContractViolationException : Exception { /// <summary> /// Constructs the exception with no message. /// </summary> public DesignByContractViolationException() { } /// <summary> /// Constructs the exception with a message. /// </summary> /// <param name="message"></param> public DesignByContractViolationException([NotNull] string message) : base(message) { } /// <summary> /// Serialization required constructor. /// </summary> protected DesignByContractViolationException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
using System; using System.Runtime.Serialization; using JetBrains.Annotations; namespace Synergy.Contracts { /// <summary> /// Wyjtek rzucany gwnie przez klas <see cref="Fail"/>. Mwi on o tym, e wiat zewntrzny /// dla naszej logiki nie speni kontraktu jaki nasz kod zakada - np. przyszed null do metody /// a my nie zakadalimy, e moe przyj. Nasz kod zakada, e jest uruchomiony na serwerze a /// okazao si inaczej, itd. <br/> /// /// Ten exception nigdy nie powinien by rzucany. Jeli go widzisz /// oznacza to, e jest co nie tak ze wiatem zewntrznym, ktry nie spenia kontraktu danej metody. /// </summary> [Serializable] public class DesignByContractViolationException : Exception { /// <summary> /// Wyjtek rzucany gwnie przez klas <see cref="Fail"/>. Mwi on o tym, e wiat zewntrzny /// dla naszej logiki nie speni kontraktu jaki nasz kod zakada - np. przyszed null do metody /// a my nie zakadalimy, e moe przyj. Nasz kod zakada, e jest uruchomiony na serwerze a /// okazao si inaczej, itd. <br/> /// /// Ten exception nigdy nie powinien by rzucany. Jeli go widzisz /// oznacza to, e jest co nie tak ze wiatem zewntrznym, ktry nie spenia kontraktu danej metody. /// </summary> public DesignByContractViolationException() { } /// <summary> /// Wyjtek rzucany gwnie przez klas <see cref="Fail"/>. Mwi on o tym, e wiat zewntrzny /// dla naszej logiki nie speni kontraktu jaki nasz kod zakada - np. przyszed null do metody /// a my nie zakadalimy, e moe przyj. Nasz kod zakada, e jest uruchomiony na serwerze a /// okazao si inaczej, itd. <br/> /// /// Ten exception nigdy nie powinien by rzucany. Jeli go widzisz /// oznacza to, e jest co nie tak ze wiatem zewntrznym, ktry nie spenia kontraktu danej metody. /// </summary> public DesignByContractViolationException([NotNull] string message) : base(message) { } /// <summary> /// Konstruktor sucy do deserializacji. Bez niego ten wyjtek nie jest w stanie sie zdeserializowa. /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected DesignByContractViolationException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
mit
C#
82d76d9b4c64032520a02d9eec1d99467a8ffc7a
Use the Builder factory where possible in tests
alastairs/BobTheBuilder
BobTheBuilder.Tests/MethodSyntaxFacts.cs
BobTheBuilder.Tests/MethodSyntaxFacts.cs
using System; using BobTheBuilder.ArgumentStore; using BobTheBuilder.Syntax; using Microsoft.CSharp.RuntimeBinder; using NSubstitute; using Ploeh.AutoFixture.Xunit; using Xunit; using Xunit.Extensions; namespace BobTheBuilder.Tests { public class MethodSyntaxFacts { [Theory, AutoData] public void SetStringStateByName(string expected) { var sut = A.BuilderFor<SampleType>(); sut.WithStringProperty(expected); SampleType result = sut.Build(); Assert.Equal(expected, result.StringProperty); } [Theory, AutoData] public void SetIntStateByName(int expected) { var sut = A.BuilderFor<SampleType>(); sut.WithIntProperty(expected); SampleType result = sut.Build(); Assert.Equal(expected, result.IntProperty); } [Theory, AutoData] public void SetComplexStateByName(Exception expected) { var sut = A.BuilderFor<SampleType>(); sut.WithComplexProperty(expected); SampleType result = sut.Build(); Assert.Equal(expected, result.ComplexProperty); } [Theory, AutoData] public void MissingTheMemberNameFromTheMethodResultsInARuntimeBinderException(string anonymous) { var argumentStore = Substitute.For<IArgumentStore>(); dynamic sut = new DynamicBuilder<SampleType>(new MethodSyntaxParser(argumentStore), argumentStore); var exception = Assert.Throws<RuntimeBinderException>(() => sut.With(anonymous)); Assert.True(exception.Message.EndsWith("does not contain a definition for 'With'")); } [Theory, AutoData] public void CallingAMethodThatDoesNotBeginWithTheWordWithResultsInARuntimeBinderException(string anonymous) { var argumentStore = Substitute.For<IArgumentStore>(); dynamic sut = A.BuilderFor<SampleType>(); var exception = Assert.Throws<RuntimeBinderException>(() => sut.And(anonymous)); Assert.True(exception.Message.EndsWith("does not contain a definition for 'And'")); } } }
using System; using BobTheBuilder.ArgumentStore; using BobTheBuilder.Syntax; using Microsoft.CSharp.RuntimeBinder; using NSubstitute; using Ploeh.AutoFixture.Xunit; using Xunit; using Xunit.Extensions; namespace BobTheBuilder.Tests { public class MethodSyntaxFacts { [Theory, AutoData] public void SetStringStateByName(string expected) { var sut = A.BuilderFor<SampleType>(); sut.WithStringProperty(expected); SampleType result = sut.Build(); Assert.Equal(expected, result.StringProperty); } [Theory, AutoData] public void SetIntStateByName(int expected) { var sut = A.BuilderFor<SampleType>(); sut.WithIntProperty(expected); SampleType result = sut.Build(); Assert.Equal(expected, result.IntProperty); } [Theory, AutoData] public void SetComplexStateByName(Exception expected) { var sut = A.BuilderFor<SampleType>(); sut.WithComplexProperty(expected); SampleType result = sut.Build(); Assert.Equal(expected, result.ComplexProperty); } [Theory, AutoData] public void MissingTheMemberNameFromTheMethodResultsInARuntimeBinderException(string anonymous) { var argumentStore = Substitute.For<IArgumentStore>(); dynamic sut = new DynamicBuilder<SampleType>(new MethodSyntaxParser(argumentStore), argumentStore); var exception = Assert.Throws<RuntimeBinderException>(() => sut.With(anonymous)); Assert.True(exception.Message.EndsWith("does not contain a definition for 'With'")); } [Theory, AutoData] public void CallingAMethodThatDoesNotBeginWithTheWordWithResultsInARuntimeBinderException(string anonymous) { var argumentStore = Substitute.For<IArgumentStore>(); dynamic sut = new DynamicBuilder<SampleType>(new MethodSyntaxParser(argumentStore), argumentStore); var exception = Assert.Throws<RuntimeBinderException>(() => sut.And(anonymous)); Assert.True(exception.Message.EndsWith("does not contain a definition for 'And'")); } } }
apache-2.0
C#
a75380c5fb0313bc5795b62aa7ad92f1ad98568c
Update Util.cs
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
Util/Xamarin.AndroidBinderator/Xamarin.AndroidBinderator/Util.cs
Util/Xamarin.AndroidBinderator/Xamarin.AndroidBinderator/Util.cs
using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; using System.Security.Cryptography; namespace AndroidBinderator { internal static class Util { internal static string HashMd5(Stream value) { using (var md5 = MD5.Create()) return BitConverter.ToString(md5.ComputeHash(value)).Replace("-", "").ToLowerInvariant(); } internal static string HashSha256(string value) { return HashSha256(Encoding.UTF8.GetBytes(value)); } internal static string HashSha256(byte[] value) { using (var sha256 = new SHA256Managed()) { var hash = new StringBuilder(); var hashData = sha256.ComputeHash(value); foreach (var b in hashData) hash.Append(b.ToString("x2")); return hash.ToString(); } } internal static string HashSha256(Stream value) { using (var sha256 = new SHA256Managed()) { var hash = new StringBuilder(); var hashData = sha256.ComputeHash(value); foreach (var b in hashData) hash.Append(b.ToString("x2")); return hash.ToString(); } } } }
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Threading.Tasks; using System.Security.Cryptography; namespace AndroidBinderator { internal static class Util { internal static string HashMd5(Stream value) { using (var md5 = MD5.Create()) return BitConverter.ToString(md5.ComputeHash(value)).Replace("-", "").ToLowerInvariant(); } internal static string HashSha256(string value) { return HashSha256(Encoding.UTF8.GetBytes(value)); } internal static string HashSha256(byte[] value) { using (var sha256 = new SHA256Managed()) { var hash = new StringBuilder(); var hashData = sha256.ComputeHash(value); foreach (var b in hashData) hash.Append(b.ToString("x2")); return hash.ToString(); } } internal static string HashSha256(Stream value) { using (var sha256 = new SHA256Managed()) { var hash = new StringBuilder(); var hashData = sha256.ComputeHash(value); foreach (var b in hashData) hash.Append(b.ToString("x2")); return hash.ToString(); } } } }
mit
C#
47f04231af4519dc8a4302263f460b6194dc2bc5
Add support for command line arguments to configuration
LukeTillman/killrvideo-csharp,LukeTillman/killrvideo-csharp,LukeTillman/killrvideo-csharp
src/KillrVideo.Host/Config/EnvironmentConfigurationSource.cs
src/KillrVideo.Host/Config/EnvironmentConfigurationSource.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace KillrVideo.Host.Config { /// <summary> /// Gets configuration values from command line args and environment variables. /// </summary> public class EnvironmentConfigurationSource : IHostConfigurationSource { private static readonly Regex MatchCaps = new Regex("[ABCDEFGHIJKLMNOPQRSTUVWXYZ]", RegexOptions.Singleline | RegexOptions.Compiled); private readonly Lazy<IDictionary<string, string>> _commandLineArgs; public EnvironmentConfigurationSource() { _commandLineArgs = new Lazy<IDictionary<string,string>>(ParseCommandLineArgs); } public string GetConfigurationValue(string key) { // See if command line had it string val; if (_commandLineArgs.Value.TryGetValue(key, out val)) return val; // See if environment variables have it key = ConfigKeyToEnvironmentVariableName(key); return Environment.GetEnvironmentVariable(key); } private static IDictionary<string, string> ParseCommandLineArgs() { var results = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); // Get command line args but skip the first one which will be the process/executable name string[] args = Environment.GetCommandLineArgs().Skip(1).ToArray(); string argName = null; foreach (string arg in args) { // Do we have an argument? if (arg.StartsWith("-")) { // If we currently have an argName, assume it was a switch and just add TrueString as the value if (argName != null) results.Add(argName, bool.TrueString); argName = arg.TrimStart('-'); continue; } // Do we have an argument that doesn't have a previous arg name? if (argName == null) throw new InvalidOperationException($"Unknown command line argument {arg}"); // Add argument value under previously parsed arg name results.Add(argName, arg); argName = null; } return results; } /// <summary> /// Utility method to convert a config key to an approriate environment variable name. /// </summary> private static string ConfigKeyToEnvironmentVariableName(string key) { key = MatchCaps.Replace(key, match => match.Index == 0 ? match.Value : $"_{match.Value}"); return $"KILLRVIDEO_{key.ToUpperInvariant()}"; } } }
using System; using System.Text.RegularExpressions; namespace KillrVideo.Host.Config { /// <summary> /// Gets configuration values from environment variables. /// </summary> public class EnvironmentConfigurationSource : IHostConfigurationSource { private static readonly Regex MatchCaps = new Regex("[ABCDEFGHIJKLMNOPQRSTUVWXYZ]", RegexOptions.Singleline | RegexOptions.Compiled); public string GetConfigurationValue(string key) { key = ConfigKeyToEnvironmentVariableName(key); return Environment.GetEnvironmentVariable(key); } /// <summary> /// Utility method to convert a config key to an approriate environment variable name. /// </summary> private static string ConfigKeyToEnvironmentVariableName(string key) { key = MatchCaps.Replace(key, match => match.Index == 0 ? match.Value : $"_{match.Value}"); return $"KILLRVIDEO_{key.ToUpperInvariant()}"; } } }
apache-2.0
C#
25826958a3a1563d4ff1b842a00459f88394cf71
Fix 4 for #187
imulus/Archetype,kipusoep/Archetype,kjac/Archetype,Nicholas-Westby/Archetype,Nicholas-Westby/Archetype,kgiszewski/Archetype,kjac/Archetype,kipusoep/Archetype,kgiszewski/Archetype,kgiszewski/Archetype,kjac/Archetype,tomfulton/Archetype,imulus/Archetype,imulus/Archetype,Nicholas-Westby/Archetype,kipusoep/Archetype,tomfulton/Archetype,tomfulton/Archetype
app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs
app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs
using System.Collections.Generic; using System; using System.Linq; using System.Net; using System.Web.Http; using AutoMapper; using Umbraco.Core.Models; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; using Umbraco.Web.Editors; namespace Archetype.Api { [PluginController("ArchetypeApi")] public class ArchetypeDataTypeController : UmbracoAuthorizedJsonController { public IEnumerable<object> GetAllPropertyEditors() { return global::Umbraco.Core.PropertyEditors.PropertyEditorResolver.Current.PropertyEditors .Select(x => new {defaultPreValues = x.DefaultPreValues, alias = x.Alias, view = x.ValueEditor.View}); } public object GetAll() { var dataTypes = Services.DataTypeService.GetAllDataTypeDefinitions(); return dataTypes.Select(t => new { guid = t.Key, name = t.Name }); } public object GetByGuid(Guid guid, string contentTypeAlias, string propertyTypeAlias, string archetypeAlias) { var dataType = Services.DataTypeService.GetDataTypeDefinitionById(guid); if (dataType == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } var dataTypeDisplay = Mapper.Map<IDataTypeDefinition, DataTypeDisplay>(dataType); return new { selectedEditor = dataTypeDisplay.SelectedEditor, preValues = dataTypeDisplay.PreValues, contentTypeAlias = contentTypeAlias, propertyTypeAlias = propertyTypeAlias, archetypeAlias = archetypeAlias }; } } }
using System.Collections.Generic; using System; using System.Linq; using System.Net; using System.Web.Http; using AutoMapper; using Umbraco.Core.Models; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; using Umbraco.Web.Editors; namespace Archetype.Api { [PluginController("ArchetypeApi")] public class ArchetypeDataTypeController : UmbracoAuthorizedJsonController { public IEnumerable<object> GetAllPropertyEditors() { return global::Umbraco.Core.PropertyEditors.PropertyEditorResolver.Current.PropertyEditors .Select(x => new {defaultPreValues = x.DefaultPreValues, alias = x.Alias, view = x.ValueEditor.View}); } public object GetAll() { var dataTypes = Services.DataTypeService.GetAllDataTypeDefinitions(); return dataTypes.Select(t => new { guid = t.Key, name = t.Name }); } public object GetByGuid(Guid guid) { var dataType = Services.DataTypeService.GetDataTypeDefinitionById(guid); if (dataType == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } var dataTypeDisplay = Mapper.Map<IDataTypeDefinition, DataTypeDisplay>(dataType); return new { selectedEditor = dataTypeDisplay.SelectedEditor, preValues = dataTypeDisplay.PreValues }; } } }
mit
C#
45f993bbfdc5497fc74a4c4e0ceb4951f987e1fa
Update master
Sohra/mvc.jquery.datatables,offspringer/mvc.jquery.datatables,offspringer/mvc.jquery.datatables,seguemark/mvc.jquery.datatables,seguemark/mvc.jquery.datatables,mcintyre321/mvc.jquery.datatables,mcintyre321/mvc.jquery.datatables,mcintyre321/mvc.jquery.datatables,Sohra/mvc.jquery.datatables
Mvc.JQuery.Datatables.Templates/Properties/AssemblyInfo.cs
Mvc.JQuery.Datatables.Templates/Properties/AssemblyInfo.cs
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("Mvc.JQuery.Datatables.Templates")] [assembly: AssemblyDescription("Install this project to customise the cshtml templates, or if you don't want to use the EmbeddedResourceVirtualPathProvider ")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Mvc.JQuery.Datatables.Templates")] [assembly: AssemblyCopyright("Copyright © Microsoft 2012")] [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("3a1615c1-4f8f-4cea-8bc5-844b23ef7073")] // 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")]
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("Mvc.JQuery.Datatables.Templates")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Mvc.JQuery.Datatables.Templates")] [assembly: AssemblyCopyright("Copyright © Microsoft 2012")] [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("3a1615c1-4f8f-4cea-8bc5-844b23ef7073")] // 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")]
mit
C#
030fa0ef52e80b0da417ad03c7953498b41d7346
Update RunPoolingSystem.cs
cdrandin/Simple-Object-Pooling
PoolingSystem_Demo/Assets/Demo/Scripts/RunPoolingSystem.cs
PoolingSystem_Demo/Assets/Demo/Scripts/RunPoolingSystem.cs
using UnityEngine; using System.Collections; using System.Collections.Generic; public class RunPoolingSystem : MonoBehaviour { public bool test; public List<GameObject> objects_to_pool; public List<GameObject> objects_in_the_pool; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.Space)) { GameObject obj = null; obj = PoolingSystem.instance.PS_Instantiate(objects_to_pool[Random.Range(0, objects_to_pool.Count)], new Vector3(Random.Range(-5.0f, 5.0f), 3.0f, Random.Range(-5.0f, 5.0f)), Quaternion.identity); if(obj == null) return; objects_in_the_pool.Add(obj); } else if(Input.GetKeyDown(KeyCode.Backspace)) { if(objects_in_the_pool.Count > 0) { int i = Random.Range(0, objects_in_the_pool.Count); if(!test) { PoolingSystem.instance.PS_Destroy(objects_in_the_pool[i]); } else { PoolingSystem.instance.PS_Destroy(objects_in_the_pool[i]); } objects_in_the_pool.RemoveAt(i); } } } }
using UnityEngine; using System.Collections; using System.Collections.Generic; public class RunPoolingSystem : MonoBehaviour { public List<GameObject> objects_to_pool; public List<GameObject> objects_in_the_pool; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.Space)) { GameObject obj = PoolingSystem.instance.PS_Instantiate(objects_to_pool[Random.Range(0, objects_to_pool.Count)], new Vector3(Random.Range(-5.0f, 5.0f), 3.0f, Random.Range(-5.0f, 5.0f)), Quaternion.identity); if(obj == null) return; objects_in_the_pool.Add(obj); } else if(Input.GetKeyDown(KeyCode.Backspace)) { if(objects_in_the_pool.Count > 0) { int i = Random.Range(0, objects_in_the_pool.Count); PoolingSystem.instance.PS_Destroy(objects_in_the_pool[i]); objects_in_the_pool.RemoveAt(i); } } } }
mit
C#
75e39b795d1179a72382a5d383e81507ef66b2d6
Change 1.
robpearson/SimpleWebApp,robpearson/SimpleWebApp,robpearson/SimpleWebApp
RobPearson.SimpleWebApp/Views/Home/Index.cshtml
RobPearson.SimpleWebApp/Views/Home/Index.cshtml
@{ ViewBag.Title = "Home Page"; } <p>Change 1.</p>
@{ ViewBag.Title = "Home Page"; } <div class="jumbotron"> <h1>Index</h1> <p class="lead">Index something something something.</p> </div> <div class="row"> <div class="col-md-4"> <h2>Getting started</h2> <p> ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and gives you full control over markup for enjoyable, agile development. </p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Get more libraries</h2> <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Web Hosting</h2> <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p> </div> </div>
mit
C#
e6dbf65c7938fcbf572a54ad482fc197a7cdd075
call base.Init in vectormotortemplate
badgeir/ule,badgeir/ule
unityproj/Assets/ULE/Scripts/Motor/Templates/VectorMotorTemplate.cs
unityproj/Assets/ULE/Scripts/Motor/Templates/VectorMotorTemplate.cs
using UnityEngine; using System.Collections; using ULE; public class VectorMotorTemplate : VectorMotor { void Start () { mName = "Name"; mLength = 3; mMinVal = -1; mMaxVal = 1; base.Init(); } // Called when a new action is received protected override void Act(float[] action) { Debug.Log(action[0]); Debug.Log(action[1]); Debug.Log(action[2]); } }
using UnityEngine; using System.Collections; using ULE; public class VectorMotorTemplate : VectorMotor { void Start () { mName = "Name"; mLength = 3; mMinVal = -1; mMaxVal = 1; } // Called when a new action is received protected override void Act(float[] action) { Debug.Log(action[0]); Debug.Log(action[1]); Debug.Log(action[2]); } }
mit
C#
a24a27940408a6c6ddf082f9073b5b9db79c0eef
use OsuMarkdownListItem for ListItemBlock
NeoAdonis/osu,ppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,ppy/osu
osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs
osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using Markdig; using Markdig.Extensions.AutoIdentifiers; using Markdig.Extensions.Tables; using Markdig.Extensions.Yaml; using Markdig.Syntax; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers.Markdown; namespace osu.Game.Graphics.Containers.Markdown { public class OsuMarkdownContainer : MarkdownContainer { protected override void AddMarkdownComponent(IMarkdownObject markdownObject, FillFlowContainer container, int level) { switch (markdownObject) { case YamlFrontMatterBlock _: // Don't parse YAML Frontmatter break; case ListItemBlock listItemBlock: var childContainer = CreateListItem(listItemBlock); container.Add(childContainer); foreach (var single in listItemBlock) base.AddMarkdownComponent(single, childContainer, level); break; default: base.AddMarkdownComponent(markdownObject, container, level); break; } } public override MarkdownTextFlowContainer CreateTextFlow() => new OsuMarkdownTextFlowContainer(); protected override MarkdownFencedCodeBlock CreateFencedCodeBlock(FencedCodeBlock fencedCodeBlock) => new OsuMarkdownFencedCodeBlock(fencedCodeBlock); protected override MarkdownSeparator CreateSeparator(ThematicBreakBlock thematicBlock) => new OsuMarkdownSeparator(); protected override MarkdownQuoteBlock CreateQuoteBlock(QuoteBlock quoteBlock) => new OsuMarkdownQuoteBlock(quoteBlock); protected override MarkdownTable CreateTable(Table table) => new OsuMarkdownTable(table); protected virtual OsuMarkdownListItem CreateListItem(ListItemBlock listItemBlock) => new OsuMarkdownListItem(); protected override MarkdownPipeline CreateBuilder() => new MarkdownPipelineBuilder().UseAutoIdentifiers(AutoIdentifierOptions.GitHub) .UseEmojiAndSmiley() .UseYamlFrontMatter() .UseAdvancedExtensions().Build(); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using Markdig; using Markdig.Extensions.AutoIdentifiers; using Markdig.Extensions.Tables; using Markdig.Extensions.Yaml; using Markdig.Syntax; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers.Markdown; namespace osu.Game.Graphics.Containers.Markdown { public class OsuMarkdownContainer : MarkdownContainer { protected override void AddMarkdownComponent(IMarkdownObject markdownObject, FillFlowContainer container, int level) { switch (markdownObject) { case YamlFrontMatterBlock _: // Don't parse YAML Frontmatter break; default: base.AddMarkdownComponent(markdownObject, container, level); break; } } public override MarkdownTextFlowContainer CreateTextFlow() => new OsuMarkdownTextFlowContainer(); protected override MarkdownFencedCodeBlock CreateFencedCodeBlock(FencedCodeBlock fencedCodeBlock) => new OsuMarkdownFencedCodeBlock(fencedCodeBlock); protected override MarkdownSeparator CreateSeparator(ThematicBreakBlock thematicBlock) => new OsuMarkdownSeparator(); protected override MarkdownQuoteBlock CreateQuoteBlock(QuoteBlock quoteBlock) => new OsuMarkdownQuoteBlock(quoteBlock); protected override MarkdownTable CreateTable(Table table) => new OsuMarkdownTable(table); protected override MarkdownPipeline CreateBuilder() => new MarkdownPipelineBuilder().UseAutoIdentifiers(AutoIdentifierOptions.GitHub) .UseEmojiAndSmiley() .UseYamlFrontMatter() .UseAdvancedExtensions().Build(); } }
mit
C#
6d7ba328ce7a2698a8dbabd32944b19500b11e23
Remove unnecessary point type check
layeredio/Harlow,johnvcoleman/Harlow
Harlow/Harlow/VectorPoint.cs
Harlow/Harlow/VectorPoint.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Harlow { public class VectorPoint : VectorFeature { public VectorPoint(int numOfPoints, ShapeType shapeType) : base (numOfPoints, shapeType) { this.Coordinates = new double[numOfPoints]; this.Properties = new Dictionary<string, string>(); } /// <summary> /// All of the points that make up the vector feature. /// Points don't have segments /// </summary> new public double[] Coordinates { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Harlow { public class VectorPoint : VectorFeature { public VectorPoint(int numOfPoints, ShapeType shapeType) : base (numOfPoints, shapeType) { if (shapeType != ShapeType.Point) { Bbox = new double[4]; } this.Coordinates = new double[numOfPoints]; this.Properties = new Dictionary<string, string>(); } /// <summary> /// All of the points that make up the vector feature. /// Points don't have segments /// </summary> new public double[] Coordinates { get; set; } } }
mit
C#
0d569da92c6a3b6e8b92a95f686c55c706d53ba7
Remove unused field
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNetCore.Razor.Evolution/Legacy/ParserBase.cs
src/Microsoft.AspNetCore.Razor.Evolution/Legacy/ParserBase.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.AspNetCore.Razor.Evolution.Legacy { internal abstract class ParserBase { public ParserBase(ParserContext context) { Context = context; } public ParserContext Context { get; } public abstract void BuildSpan(SpanBuilder span, SourceLocation start, string content); public abstract void ParseBlock(); } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.AspNetCore.Razor.Evolution.Legacy { internal abstract class ParserBase { private ParserContext _context; public ParserBase(ParserContext context) { Context = context; } public ParserContext Context { get; } public abstract void BuildSpan(SpanBuilder span, SourceLocation start, string content); public abstract void ParseBlock(); } }
apache-2.0
C#
3f171549f0c858dbf1d77aca0da26f9b973f2c1c
remove unnecessary method
roflkins/IdentityServer3,wondertrap/IdentityServer3,18098924759/IdentityServer3,delloncba/IdentityServer3,tonyeung/IdentityServer3,iamkoch/IdentityServer3,18098924759/IdentityServer3,codeice/IdentityServer3,yanjustino/IdentityServer3,SonOfSam/IdentityServer3,tbitowner/IdentityServer3,tonyeung/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,uoko-J-Go/IdentityServer,kouweizhong/IdentityServer3,jonathankarsh/IdentityServer3,chicoribas/IdentityServer3,delRyan/IdentityServer3,remunda/IdentityServer3,openbizgit/IdentityServer3,bestwpw/IdentityServer3,mvalipour/IdentityServer3,jackswei/IdentityServer3,IdentityServer/IdentityServer3,mvalipour/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,huoxudong125/Thinktecture.IdentityServer.v3,paulofoliveira/IdentityServer3,Agrando/IdentityServer3,roflkins/IdentityServer3,tbitowner/IdentityServer3,buddhike/IdentityServer3,angelapper/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,huoxudong125/Thinktecture.IdentityServer.v3,18098924759/IdentityServer3,iamkoch/IdentityServer3,openbizgit/IdentityServer3,uoko-J-Go/IdentityServer,yanjustino/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,buddhike/IdentityServer3,jackswei/IdentityServer3,jonathankarsh/IdentityServer3,roflkins/IdentityServer3,tuyndv/IdentityServer3,IdentityServer/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,bodell/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,wondertrap/IdentityServer3,charoco/IdentityServer3,ryanvgates/IdentityServer3,Agrando/IdentityServer3,angelapper/IdentityServer3,delloncba/IdentityServer3,delRyan/IdentityServer3,bodell/IdentityServer3,bestwpw/IdentityServer3,codeice/IdentityServer3,EternalXw/IdentityServer3,ryanvgates/IdentityServer3,IdentityServer/IdentityServer3,chicoribas/IdentityServer3,charoco/IdentityServer3,iamkoch/IdentityServer3,paulofoliveira/IdentityServer3,paulofoliveira/IdentityServer3,tuyndv/IdentityServer3,mvalipour/IdentityServer3,faithword/IdentityServer3,olohmann/IdentityServer3,faithword/IdentityServer3,remunda/IdentityServer3,openbizgit/IdentityServer3,yanjustino/IdentityServer3,kouweizhong/IdentityServer3,ryanvgates/IdentityServer3,charoco/IdentityServer3,tuyndv/IdentityServer3,chicoribas/IdentityServer3,tonyeung/IdentityServer3,kouweizhong/IdentityServer3,codeice/IdentityServer3,Agrando/IdentityServer3,jackswei/IdentityServer3,jonathankarsh/IdentityServer3,bodell/IdentityServer3,tbitowner/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,bestwpw/IdentityServer3,delRyan/IdentityServer3,EternalXw/IdentityServer3,SonOfSam/IdentityServer3,buddhike/IdentityServer3,olohmann/IdentityServer3,angelapper/IdentityServer3,uoko-J-Go/IdentityServer,EternalXw/IdentityServer3,wondertrap/IdentityServer3,faithword/IdentityServer3,remunda/IdentityServer3,delloncba/IdentityServer3,olohmann/IdentityServer3,SonOfSam/IdentityServer3
source/Core/Configuration/Registration.cs
source/Core/Configuration/Registration.cs
/* * Copyright 2014 Dominick Baier, Brock Allen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace Thinktecture.IdentityServer.Core.Configuration { public abstract class Registration { public static Registration<T> RegisterType<T>(Type type) where T: class { if (type == null) throw new ArgumentNullException("type"); return new Registration<T> { Type = type }; } public static Registration<T> RegisterFactory<T>(Func<T> typeFunc) where T : class { if (typeFunc == null) throw new ArgumentNullException("typeFunc"); return new Registration<T> { TypeFactory = typeFunc }; } public static Registration<T> RegisterSingleton<T>(T instance) where T : class { if (instance == null) throw new ArgumentNullException("instance"); return RegisterFactory<T>(() => instance); } public abstract Type InterfaceType { get; } public abstract Type ImplementationType { get; } public abstract Func<object> ImplementationFactory { get; } } public class Registration<T> : Registration where T : class { public Type Type { get; set; } public Func<T> TypeFactory { get; set; } public override Type InterfaceType { get { return typeof(T); } } public override Type ImplementationType { get { return Type; } } public override Func<object> ImplementationFactory { get { return TypeFactory; } } } }
/* * Copyright 2014 Dominick Baier, Brock Allen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace Thinktecture.IdentityServer.Core.Configuration { public abstract class Registration { public static Registration<T> RegisterType<T>(Type type) where T: class { if (type == null) throw new ArgumentNullException("type"); return new Registration<T> { Type = type }; } public static Registration<T> RegisterFactory<T>(Func<T> typeFunc) where T : class { if (typeFunc == null) throw new ArgumentNullException("typeFunc"); return new Registration<T> { TypeFactory = typeFunc }; } public static Registration<T> RegisterSingleton<T>(T instance) where T : class { if (instance == null) throw new ArgumentNullException("instance"); return RegisterFactory<T>(() => instance); } public abstract Type InterfaceType { get; } public abstract Type ImplementationType { get; } public abstract Func<object> ImplementationFactory { get; } internal static Registration<Services.IExternalClaimsFilter> RegisterFactory<T1>(Func<Services.IExternalClaimsFilter> func) { throw new NotImplementedException(); } } public class Registration<T> : Registration where T : class { public Type Type { get; set; } public Func<T> TypeFactory { get; set; } public override Type InterfaceType { get { return typeof(T); } } public override Type ImplementationType { get { return Type; } } public override Func<object> ImplementationFactory { get { return TypeFactory; } } } }
apache-2.0
C#
a83e80f88da8edd55bb177fab9df1f1499dfb546
Comment extends IdentifiableDeletableEntity<int> now.
vladislav-karamfilov/Bloggable,vladislav-karamfilov/Bloggable
src/Data/Bloggable.Data.Models/Comment.cs
src/Data/Bloggable.Data.Models/Comment.cs
namespace Bloggable.Data.Models { using System.ComponentModel.DataAnnotations; using Bloggable.Data.Contracts; public class Comment : IdentifiableDeletableEntity<int> { [Required] //// TODO: Add validation for length public string Content { get; set; } public int PostId { get; set; } public virtual Post Post { get; set; } [Required] public string AuthorId { get; set; } public virtual User Author { get; set; } } }
namespace Bloggable.Data.Models { using System.ComponentModel.DataAnnotations; public class Comment { [Key] public int Id { get; set; } [Required] //// TODO: Add validation for length public string Content { get; set; } public int PostId { get; set; } public virtual Post Post { get; set; } [Required] public string AuthorId { get; set; } public virtual User Author { get; set; } } }
mit
C#
5eab62b84110c716bc10603746a7a76fed09612d
Update WeeklyXamarin.cs
stvansolano/planetxamarin,planetxamarin/planetxamarin,beraybentesen/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,MabroukENG/planetxamarin,stvansolano/planetxamarin,stvansolano/planetxamarin
src/Firehose.Web/Authors/WeeklyXamarin.cs
src/Firehose.Web/Authors/WeeklyXamarin.cs
using System; using System.Collections.Generic; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class WeeklyXamarin : IAmACommunityMember { public string FirstName => "Weekly"; public string LastName => "Xamarin"; public string StateOrRegion => "Internet"; public string EmailAddress => "inbox@weeklyxamarin.com"; public string ShortBioOrTagLine => "is a weekly newsletter that contains a hand-picked round-up of the best mobile development links and resources. Curated by Geoffrey Huntley. Free." ; public Uri WebSite => new Uri("https://www.weeklyxamarin.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://weeklyxamarin.com/issues.rss"); } } public string TwitterHandle => "weeklyxamarin"; public string GitHubHandle => string.Empty; public string GravatarHash => ""; public GeoPosition Position => new GeoPosition(-22.9791499, 133.0190863); } }
using System; using System.Collections.Generic; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class WeeklyXamarin : IAmACommunityMember { public string FirstName => "Weekly"; public string LastName => "Xamarin"; public string StateOrRegion => "Internet"; public string EmailAddress => "inbox@weeklyxamarin.com"; public string ShortBioOrTagLine => "weekly newsletter that contains a hand-picked round-up of the best mobile development links and resources. Curated by Geoffrey Huntley. Free." ; public Uri WebSite => new Uri("https://www.weeklyxamarin.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://weeklyxamarin.com/issues.rss"); } } public string TwitterHandle => "weeklyxamarin"; public string GitHubHandle => string.Empty; public string GravatarHash => ""; public GeoPosition Position => new GeoPosition(-22.9791499, 133.0190863); } }
mit
C#
02beb04c4bc09bffd5c607523b1058b675a6ba35
Update HtmlSanitizerOptions.cs
mganss/HtmlSanitizer
src/HtmlSanitizer/HtmlSanitizerOptions.cs
src/HtmlSanitizer/HtmlSanitizerOptions.cs
using AngleSharp.Css.Dom; using System; using System.Collections.Generic; namespace Ganss.XSS { /// <summary> /// Provides options to be used with <see cref="HtmlSanitizer"/>. /// </summary> public class HtmlSanitizerOptions { /// <summary> /// Gets or sets the allowed tag names such as "a" and "div". /// </summary> public ISet<string> AllowedTags { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase); /// <summary> /// Gets or sets the allowed HTML attributes such as "href" and "alt". /// </summary> public ISet<string> AllowedAttributes { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase); /// <summary> /// Gets or sets the allowed CSS classes. /// </summary> public ISet<string> AllowedCssClasses { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed CSS properties such as "font" and "margin". /// </summary> public ISet<string> AllowedCssProperties { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase); /// <summary> /// Gets or sets the allowed CSS at-rules such as "@media" and "@font-face". /// </summary> public ISet<CssRuleType> AllowedAtRules { get; set; } = new HashSet<CssRuleType>(StringComparer.OrdinalIgnoreCase); /// <summary> /// Gets or sets the allowed URI schemes such as "http" and "https". /// </summary> public ISet<string> AllowedSchemes { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase); /// <summary> /// Gets or sets the HTML attributes that can contain a URI such as "href". /// </summary> public ISet<string> UriAttributes { get; set; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase); } }
using AngleSharp.Css.Dom; using System; using System.Collections.Generic; namespace Ganss.XSS { /// <summary> /// Provides options to be used with <see cref="HtmlSanitizer"/>. /// </summary> public class HtmlSanitizerOptions { /// <summary> /// Gets or sets the allowed tag names such as "a" and "div". /// </summary> public ISet<string> AllowedTags { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed HTML attributes such as "href" and "alt". /// </summary> public ISet<string> AllowedAttributes { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed CSS classes. /// </summary> public ISet<string> AllowedCssClasses { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed CSS properties such as "font" and "margin". /// </summary> public ISet<string> AllowedCssProperties { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the allowed CSS at-rules such as "@media" and "@font-face". /// </summary> public ISet<CssRuleType> AllowedAtRules { get; set; } = new HashSet<CssRuleType>(); /// <summary> /// Gets or sets the allowed URI schemes such as "http" and "https". /// </summary> public ISet<string> AllowedSchemes { get; set; } = new HashSet<string>(); /// <summary> /// Gets or sets the HTML attributes that can contain a URI such as "href". /// </summary> public ISet<string> UriAttributes { get; set; } = new HashSet<string>(); } }
mit
C#
ed1019fa48645ad6688eaa267810fcc66f8a8d5c
Increment assembly version for new Nuget build.
dneelyep/MonoGameUtils
MonoGameUtils/Properties/AssemblyInfo.cs
MonoGameUtils/Properties/AssemblyInfo.cs
using System.Reflection; 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("MonoGameUtils")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MonoGameUtils")] [assembly: AssemblyCopyright("")] [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("4ecedc75-1f2d-4915-9efe-368a5d104e41")] // 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.6.0")] [assembly: AssemblyFileVersion("1.0.6.0")]
using System.Reflection; 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("MonoGameUtils")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MonoGameUtils")] [assembly: AssemblyCopyright("")] [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("4ecedc75-1f2d-4915-9efe-368a5d104e41")] // 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.5.0")] [assembly: AssemblyFileVersion("1.0.5.0")]
mit
C#
abf718242b11519825228a2f6098dff745231608
Make explicit marker font semi-bold
peppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu-new,ppy/osu,ppy/osu,smoogipoo/osu,ppy/osu,smoogipooo/osu,peppy/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu
osu.Game/Overlays/BeatmapSet/ExplicitBeatmapPill.cs
osu.Game/Overlays/BeatmapSet/ExplicitBeatmapPill.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.BeatmapSet { public class ExplicitBeatmapPill : CompositeDrawable { public ExplicitBeatmapPill() { AutoSizeAxes = Axes.Both; } [BackgroundDependencyLoader(true)] private void load(OsuColour colours, OverlayColourProvider colourProvider) { InternalChild = new CircularContainer { Masking = true, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = colourProvider?.Background5 ?? colours.Gray2, }, new OsuSpriteText { Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f }, Text = "EXPLICIT", Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold), Colour = OverlayColourProvider.Orange.Colour2, } } }; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.BeatmapSet { public class ExplicitBeatmapPill : CompositeDrawable { public ExplicitBeatmapPill() { AutoSizeAxes = Axes.Both; } [BackgroundDependencyLoader(true)] private void load(OsuColour colours, OverlayColourProvider colourProvider) { InternalChild = new CircularContainer { Masking = true, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = colourProvider?.Background5 ?? colours.Gray2, }, new OsuSpriteText { Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f }, Text = "EXPLICIT", Font = OsuFont.GetFont(size: 10, weight: FontWeight.Bold), Colour = OverlayColourProvider.Orange.Colour2, } } }; } } }
mit
C#
7a55931bbe6661ac640ad339d829d6a063168b3a
Update IWebElementExtensions.ToDetailedString method
atata-framework/atata,atata-framework/atata,YevgeniyShunevych/Atata,YevgeniyShunevych/Atata
src/Atata.WebDriverExtras/Extensions/IWebElementExtensions.cs
src/Atata.WebDriverExtras/Extensions/IWebElementExtensions.cs
using System; using System.Linq; using OpenQA.Selenium; namespace Atata { // TODO: Review IWebElementExtensions class. Remove unused methods. public static class IWebElementExtensions { public static WebElementExtendedSearchContext Try(this IWebElement element) { return new WebElementExtendedSearchContext(element); } public static WebElementExtendedSearchContext Try(this IWebElement element, TimeSpan timeout) { return new WebElementExtendedSearchContext(element, timeout); } public static WebElementExtendedSearchContext Try(this IWebElement element, TimeSpan timeout, TimeSpan retryInterval) { return new WebElementExtendedSearchContext(element, timeout, retryInterval); } public static bool HasClass(this IWebElement element, string className) { return element.GetAttribute("class").Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Contains(className); } public static string GetValue(this IWebElement element) { return element.GetAttribute("value"); } public static IWebElement FillInWith(this IWebElement element, string text) { element.Clear(); if (!string.IsNullOrEmpty(text)) element.SendKeys(text); return element; } public static string ToDetailedString(this IWebElement element) { element.CheckNotNull(nameof(element)); try { return $@"Tag: {element.TagName} Location: {element.Location} Size: {element.Size} Text: {element.Text.Trim()}"; } catch { return null; } } } }
using System; using System.Linq; using OpenQA.Selenium; namespace Atata { // TODO: Review IWebElementExtensions class. Remove unused methods. public static class IWebElementExtensions { public static WebElementExtendedSearchContext Try(this IWebElement element) { return new WebElementExtendedSearchContext(element); } public static WebElementExtendedSearchContext Try(this IWebElement element, TimeSpan timeout) { return new WebElementExtendedSearchContext(element, timeout); } public static WebElementExtendedSearchContext Try(this IWebElement element, TimeSpan timeout, TimeSpan retryInterval) { return new WebElementExtendedSearchContext(element, timeout, retryInterval); } public static bool HasClass(this IWebElement element, string className) { return element.GetAttribute("class").Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Contains(className); } public static string GetValue(this IWebElement element) { return element.GetAttribute("value"); } public static IWebElement FillInWith(this IWebElement element, string text) { element.Clear(); if (!string.IsNullOrEmpty(text)) element.SendKeys(text); return element; } public static string ToDetailedString(this IWebElement element) { element.CheckNotNull(nameof(element)); try { return $@"Tag: {element.TagName} Location: {element.Location} Size: {element.Size} Text: {element.Text}"; } catch { return null; } } } }
apache-2.0
C#
3d48344a8f1978b99e83e51e8234682f246eba3c
update yaml option
sergey-vershinin/docfx,928PJY/docfx,pascalberger/docfx,superyyrrzz/docfx,hellosnow/docfx,DuncanmaMSFT/docfx,superyyrrzz/docfx,sergey-vershinin/docfx,sergey-vershinin/docfx,hellosnow/docfx,LordZoltan/docfx,LordZoltan/docfx,superyyrrzz/docfx,hellosnow/docfx,pascalberger/docfx,DuncanmaMSFT/docfx,dotnet/docfx,928PJY/docfx,928PJY/docfx,LordZoltan/docfx,dotnet/docfx,LordZoltan/docfx,pascalberger/docfx,dotnet/docfx
src/Microsoft.DocAsCode.EntityModel/YamlUtility.cs
src/Microsoft.DocAsCode.EntityModel/YamlUtility.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.EntityModel { using System.IO; using System.Threading; using YamlDotNet.Serialization; using Microsoft.DocAsCode.YamlSerialization; public static class YamlUtility { private static readonly ThreadLocal<YamlSerializer> serializer = new ThreadLocal<YamlSerializer>(() => new YamlSerializer(SerializationOptions.DisableAliases)); private static readonly ThreadLocal<YamlDeserializer> deserializer = new ThreadLocal<YamlDeserializer>(() => new YamlDeserializer(ignoreUnmatched: true)); public static void Serialize(TextWriter writer, object graph) { serializer.Value.Serialize(writer, graph); } public static void Serialize(string path, object graph) { var directory = Path.GetDirectoryName(path); if (!string.IsNullOrEmpty(directory)) { Directory.CreateDirectory(directory); } using (StreamWriter writer = new StreamWriter(path)) { Serialize(writer, graph); } } public static T Deserialize<T>(TextReader reader) { return deserializer.Value.Deserialize<T>(reader); } public static T Deserialize<T>(string path) { using (StreamReader reader = new StreamReader(path)) return Deserialize<T>(reader); } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.EntityModel { using System.IO; using System.Threading; using Microsoft.DocAsCode.YamlSerialization; public static class YamlUtility { private static readonly ThreadLocal<YamlSerializer> serializer = new ThreadLocal<YamlSerializer>(() => new YamlSerializer()); private static readonly ThreadLocal<YamlDeserializer> deserializer = new ThreadLocal<YamlDeserializer>(() => new YamlDeserializer(ignoreUnmatched: true)); public static void Serialize(TextWriter writer, object graph) { serializer.Value.Serialize(writer, graph); } public static void Serialize(string path, object graph) { var directory = Path.GetDirectoryName(path); if (!string.IsNullOrEmpty(directory)) { Directory.CreateDirectory(directory); } using (StreamWriter writer = new StreamWriter(path)) { Serialize(writer, graph); } } public static T Deserialize<T>(TextReader reader) { return deserializer.Value.Deserialize<T>(reader); } public static T Deserialize<T>(string path) { using (StreamReader reader = new StreamReader(path)) return Deserialize<T>(reader); } } }
mit
C#
68c55a795ecdd17c2c7e03d56c302709624728d3
Fix a typo: make a hyperlink actually a link.
zaccharles/nodatime,malcolmr/nodatime,zaccharles/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,zaccharles/nodatime,nodatime/nodatime,zaccharles/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,malcolmr/nodatime,zaccharles/nodatime,jskeet/nodatime,zaccharles/nodatime,jskeet/nodatime,nodatime/nodatime
src/NodaTime.Serialization.JsonNet/NamespaceDoc.cs
src/NodaTime.Serialization.JsonNet/NamespaceDoc.cs
#region Copyright and license information // Copyright 2001-2009 Stephen Colebourne // Copyright 2009-2011 Jon Skeet // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using System.Runtime.CompilerServices; namespace NodaTime.Serialization.JsonNet { /// <summary> /// <para> /// The NodaTime.Serialization.JsonNet namespace contains support code to enable /// JSON serialization for Noda Time types using <see href="http://json.net">Json.NET</see>. /// </para> /// <para>Code in this namespace is not currently included in Noda Time NuGet packages; /// it is still deemed "experimental". To use these serializers, please download and build the Noda Time /// source code from the <see href="http://noda-time.googlecode.com">project home page</see>.</para> /// </summary> [CompilerGenerated] internal class NamespaceDoc { // No actual code here - it's just for the sake of documenting the namespace. } }
#region Copyright and license information // Copyright 2001-2009 Stephen Colebourne // Copyright 2009-2011 Jon Skeet // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using System.Runtime.CompilerServices; namespace NodaTime.Serialization.JsonNet { /// <summary> /// <para> /// The NodaTime.Serialization.JsonNet namespace contains support code to enable /// JSON serialization for Noda Time types using <see href="http://json.net">Json.NET</see>. /// </para> /// <para>Code in this namespace is not currently included in Noda Time NuGet packages; /// it is still deemed "experimental". To use these serializers, please download and build the Noda Time /// source code from the <see cref="http://noda-time.googlecode.com">project home page</see>.</para> /// </summary> [CompilerGenerated] internal class NamespaceDoc { // No actual code here - it's just for the sake of documenting the namespace. } }
apache-2.0
C#
d5a3eac107cae781d58d14b7060448bee676d591
Update StructuredLoggerCheckerUtil.cs
CyrusNajmabadi/roslyn,mavasani/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,dotnet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,dotnet/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn
src/Tools/BuildBoss/StructuredLoggerCheckerUtil.cs
src/Tools/BuildBoss/StructuredLoggerCheckerUtil.cs
// 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.Linq; using Microsoft.Build.Logging.StructuredLogger; namespace BuildBoss { /// <summary> /// This type invokes the analyzer here: /// /// https://github.com/KirillOsenkov/MSBuildStructuredLog/blob/master/src/StructuredLogger/Analyzers/DoubleWritesAnalyzer.cs /// /// </summary> internal sealed class StructuredLoggerCheckerUtil : ICheckerUtil { private readonly string _logFilePath; internal StructuredLoggerCheckerUtil(string logFilePath) { _logFilePath = logFilePath; } public bool Check(TextWriter textWriter) { try { var build = Serialization.Read(_logFilePath); var doubleWrites = DoubleWritesAnalyzer.GetDoubleWrites(build).ToArray(); // Issue https://github.com/dotnet/roslyn/issues/62372 if (doubleWrites.Any(doubleWrite => Path.GetFileName(doubleWrite.Key) != "Microsoft.VisualStudio.Text.Internal.dll")) { foreach (var doubleWrite in doubleWrites) { textWriter.WriteLine($"Multiple writes to {doubleWrite.Key}"); foreach (var source in doubleWrite.Value) { textWriter.WriteLine($"\t{source}"); } textWriter.WriteLine(); } return false; } return true; } catch (Exception ex) { textWriter.WriteLine($"Error processing binary log file: {ex.Message}"); return false; } } } }
// 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.Linq; using Microsoft.Build.Logging.StructuredLogger; namespace BuildBoss { /// <summary> /// This type invokes the analyzer here: /// /// https://github.com/KirillOsenkov/MSBuildStructuredLog/blob/master/src/StructuredLogger/Analyzers/DoubleWritesAnalyzer.cs /// /// </summary> internal sealed class StructuredLoggerCheckerUtil : ICheckerUtil { private readonly string _logFilePath; internal StructuredLoggerCheckerUtil(string logFilePath) { _logFilePath = logFilePath; } public bool Check(TextWriter textWriter) { try { var build = Serialization.Read(_logFilePath); var doubleWrites = DoubleWritesAnalyzer.GetDoubleWrites(build).ToArray(); if (doubleWrites.Any()) { foreach (var doubleWrite in doubleWrites) { // Issue https://github.com/dotnet/roslyn/issues/62372 if (Path.GetFileName(doubleWrite.Key) == "Microsoft.VisualStudio.Text.Internal.dll") { continue; } textWriter.WriteLine($"Multiple writes to {doubleWrite.Key}"); foreach (var source in doubleWrite.Value) { textWriter.WriteLine($"\t{source}"); } textWriter.WriteLine(); } return false; } return true; } catch (Exception ex) { textWriter.WriteLine($"Error processing binary log file: {ex.Message}"); return false; } } } }
mit
C#
5017017a26ab4ae2b8e8164fd5a0206b0303db43
Update CopyControls.cs
asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET
Examples/CSharp/Articles/CopyShapesBetweenWorksheets/CopyControls.cs
Examples/CSharp/Articles/CopyShapesBetweenWorksheets/CopyControls.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Articles.CopyShapesBetweenWorksheets { public class CopyControls { public static void Main() { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Create a workbook object //Open the template file Workbook workbook = new Workbook(dataDir+ "aspose-sample.xlsx"); //Get the Shapes from the "Control" worksheet. Aspose.Cells.Drawing.ShapeCollection shape = workbook.Worksheets["Sheet3"].Shapes; //Copy the Textbox to the Result Worksheet workbook.Worksheets["Sheet1"].Shapes.AddCopy(shape[0], 5, 0, 2, 0); //Copy the Oval Shape to the Result Worksheet workbook.Worksheets["Sheet1"].Shapes.AddCopy(shape[1], 10, 0, 2, 0); //Save the Worksheet workbook.Save(dataDir+ "Controls.out.xlsx"); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Articles.CopyShapesBetweenWorksheets { public class CopyControls { public static void Main() { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Create a workbook object //Open the template file Workbook workbook = new Workbook(dataDir+ "aspose-sample.xlsx"); //Get the Shapes from the "Control" worksheet. Aspose.Cells.Drawing.ShapeCollection shape = workbook.Worksheets["Sheet3"].Shapes; //Copy the Textbox to the Result Worksheet workbook.Worksheets["Sheet1"].Shapes.AddCopy(shape[0], 5, 0, 2, 0); //Copy the Oval Shape to the Result Worksheet workbook.Worksheets["Sheet1"].Shapes.AddCopy(shape[1], 10, 0, 2, 0); //Save the Worksheet workbook.Save(dataDir+ "Controls.out.xlsx"); } } }
mit
C#
039c3ad1b9bb884620edc6edaef1312ed15866ea
Use new array indexing syntax
jasonracey/PlaylistGrabber
PlaylistGrabber/Downloader.cs
PlaylistGrabber/Downloader.cs
using System; using System.Collections.Generic; using System.IO; using System.Net; namespace PlaylistGrabber { public class Downloader { public string State { get; private set; } public int DownloadedFiles { get; private set; } public int TotalFiles { get; private set; } public void DownloadFiles(List<Uri> uris) { TotalFiles = uris.Count; foreach (var uri in uris) { DownloadFile(uri); DownloadedFiles++; } } private void DownloadFile(Uri uri) { State = $"Downloading {uri} ..."; var webClient = new WebClient(); var destinationPath = GetDestinationPath(uri); webClient.DownloadFile(uri, destinationPath); } private static string GetDestinationPath(Uri uri) { var parts = uri.ToString().Split('/'); var directoryName = parts[^2]; var fileName = parts[^1]; string destinationDirectory = $@"Z:\Downloads\{directoryName}"; // only creates dir if it doesn't already exist Directory.CreateDirectory(destinationDirectory); string destinationPath = $@"{destinationDirectory}\{fileName}"; if (File.Exists(destinationPath)) { File.Delete(destinationPath); } return destinationPath; } } }
using System; using System.Collections.Generic; using System.IO; using System.Net; namespace PlaylistGrabber { public class Downloader { public string State { get; private set; } public int DownloadedFiles { get; private set; } public int TotalFiles { get; private set; } public void DownloadFiles(List<Uri> uris) { TotalFiles = uris.Count; foreach (var uri in uris) { DownloadFile(uri); DownloadedFiles++; } } private void DownloadFile(Uri uri) { State = $"Downloading {uri} ..."; var webClient = new WebClient(); var destinationPath = GetDestinationPath(uri); webClient.DownloadFile(uri, destinationPath); } private static string GetDestinationPath(Uri uri) { var parts = uri.ToString().Split('/'); var directoryName = parts[parts.Length - 2]; var fileName = parts[parts.Length - 1]; string destinationDirectory = $@"Z:\Downloads\{directoryName}"; // only creates dir if it doesn't already exist Directory.CreateDirectory(destinationDirectory); string destinationPath = $@"{destinationDirectory}\{fileName}"; if (File.Exists(destinationPath)) { File.Delete(destinationPath); } return destinationPath; } } }
mit
C#
f71a064357b02d7c5aa76000e47d3899ab55d626
Update AssemblyInfo.cs
aaronhance/SharpTUI
STUI/Properties/AssemblyInfo.cs
STUI/Properties/AssemblyInfo.cs
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("SharpTUI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SharpTUI")] [assembly: AssemblyCopyright("Copyright © Aaron Hance 2015")] [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("69a8968f-9e05-4d18-a56d-9b2d03700c59")] // 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")]
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("SharpTUI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("SharpTUI")] [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] [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("69a8968f-9e05-4d18-a56d-9b2d03700c59")] // 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")]
apache-2.0
C#
510109e57e25eb1fbf44a56ab38132994723c46d
Remove the AheadBy/BehindBy workaround on MacOSX Can be handled with the new RepositoryView view model
awaescher/RepoZ,awaescher/RepoZ
RepoZ.Api.Mac/Git/MacRepositoryReader.cs
RepoZ.Api.Mac/Git/MacRepositoryReader.cs
using System.Linq; using LibGit2Sharp; using RepoZ.Api.Git; namespace RepoZ.Api.Mac.Git { public class MacRepositoryReader : IRepositoryReader { public Api.Git.Repository ReadRepository(string path) { if (string.IsNullOrEmpty(path)) return Api.Git.Repository.Empty; string repoPath = LibGit2Sharp.Repository.Discover(path); if (string.IsNullOrEmpty(repoPath)) return Api.Git.Repository.Empty; return ReadRepositoryWithRetries(repoPath, 3); } private Api.Git.Repository ReadRepositoryWithRetries(string repoPath, int maxRetries) { Api.Git.Repository repository = null; int currentTry = 1; while (repository == null && currentTry <= maxRetries) { try { repository = ReadRepositoryInternal(repoPath); } catch (LockedFileException) { if (currentTry >= maxRetries) throw; else System.Threading.Thread.Sleep(500); } currentTry++; } return repository; } private Api.Git.Repository ReadRepositoryInternal(string repoPath) { using (var repo = new LibGit2Sharp.Repository(repoPath)) { return new Api.Git.Repository() { Name = new System.IO.DirectoryInfo(repo.Info.WorkingDirectory).Name, Path = repo.Info.WorkingDirectory, Branches = repo.Branches.Select(b => b.FriendlyName).ToArray(), CurrentBranch = repo.Head.FriendlyName, AheadBy = repo.Head.TrackingDetails?.AheadBy, BehindBy = repo.Head.TrackingDetails?.BehindBy }; } } } }
using System.Linq; using LibGit2Sharp; using RepoZ.Api.Git; namespace RepoZ.Api.Mac.Git { public class MacRepositoryReader : IRepositoryReader { public Api.Git.Repository ReadRepository(string path) { if (string.IsNullOrEmpty(path)) return Api.Git.Repository.Empty; string repoPath = LibGit2Sharp.Repository.Discover(path); if (string.IsNullOrEmpty(repoPath)) return Api.Git.Repository.Empty; return ReadRepositoryWithRetries(repoPath, 3); } private Api.Git.Repository ReadRepositoryWithRetries(string repoPath, int maxRetries) { Api.Git.Repository repository = null; int currentTry = 1; while (repository == null && currentTry <= maxRetries) { try { repository = ReadRepositoryInternal(repoPath); } catch (LockedFileException) { if (currentTry >= maxRetries) throw; else System.Threading.Thread.Sleep(500); } currentTry++; } return repository; } private Api.Git.Repository ReadRepositoryInternal(string repoPath) { using (var repo = new LibGit2Sharp.Repository(repoPath)) { return new Api.Git.Repository() { Name = new System.IO.DirectoryInfo(repo.Info.WorkingDirectory).Name, Path = repo.Info.WorkingDirectory, Branches = repo.Branches.Select(b => b.FriendlyName).ToArray(), CurrentBranch = repo.Head.FriendlyName, AheadBy = repo.Head.TrackingDetails?.AheadBy ?? -1, BehindBy = repo.Head.TrackingDetails?.BehindBy ?? -1 }; } } } }
mit
C#
61a28d9a7c542d1797ba57a0815edbefdb41c74f
Add docstring for ValidationDiagnostic
riganti/dotvvm-samples-academy,riganti/dotvvm-samples-academy,riganti/dotvvm-samples-academy
DotvvmAcademy/DotvvmAcademy.Validation/ValidationDiagnostic.cs
DotvvmAcademy/DotvvmAcademy.Validation/ValidationDiagnostic.cs
namespace DotvvmAcademy.Validation { /// <summary> /// Represents an issue found by an <see cref="IValidationService{TRequest, TResponse}"/>. /// </summary> public class ValidationDiagnostic { /// <summary> /// Creates a new <see cref="ValidationDiagnostic"/>. /// </summary> /// <param name="id"></param> /// <param name="message"></param> /// <param name="location"></param> public ValidationDiagnostic(string id, string message, ValidationDiagnosticLocation location) { Id = id; Message = message; Location = location; } /// <summary> /// The unique identification code of the found issue. /// </summary> public string Id { get; set; } /// <summary> /// The specific location in a file of the found issue. /// </summary> public ValidationDiagnosticLocation Location { get; set; } /// <summary> /// The message describing the found issue to the user. /// </summary> public string Message { get; set; } } }
namespace DotvvmAcademy.Validation { public class ValidationDiagnostic { public ValidationDiagnostic(string id, string message, ValidationDiagnosticLocation location) { Id = id; Message = message; Location = location; } public string Id { get; set; } public ValidationDiagnosticLocation Location { get; set; } public string Message { get; set; } } }
apache-2.0
C#
49586cbf48b5782cb637352112c1bf4b845b5b9d
Fix pre-5.0.2 Plane Annotation Drawing
stevefsp/Lizitt-Unity3D-Utilities
Source/Lizitt/Utils/Core/Editor/SimplePlaneAnnotationEditor.cs
Source/Lizitt/Utils/Core/Editor/SimplePlaneAnnotationEditor.cs
/* * Copyright (c) 2015 Stephen A. Pratt * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ using UnityEditor; using UnityEngine; namespace com.lizitt.u3d.editor { public static class SimplePlaneAnnotationEditor { private static readonly Vector3 MarkerSize = new Vector3(1, 0.01f, 1); #if UNITY_5_0_0 || UNITY_5_0_1 [DrawGizmo(GizmoType.NotSelected | GizmoType.SelectedOrChild)] #else [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy)] #endif static void DrawGizmo(SimplePlaneAnnotation item, GizmoType type) { #if UNITY_5_0_0 || UNITY_5_0_1 if (!(AnnotationUtil.drawAlways || (type & GizmoType.SelectedOrChild) != 0)) #else if (!(AnnotationUtil.drawAlways || (type & GizmoType.InSelectionHierarchy) != 0)) #endif return; Gizmos.color = item.Color; Gizmos.matrix = item.transform.localToWorldMatrix; Gizmos.DrawCube(item.PositionOffset, MarkerSize); } } }
/* * Copyright (c) 2015 Stephen A. Pratt * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ using UnityEditor; using UnityEngine; namespace com.lizitt.u3d.editor { public static class SimplePlaneAnnotationEditor { private static readonly Vector3 MarkerSize = new Vector3(1, 0.01f, 1); #if UNITY_5_0_0 || UNITY_5_0_1 [DrawGizmo(GizmoType.NotSelected | GizmoType.SelectedOrChild)] #else [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy)] #endif static void DrawGizmo(SimplePlaneAnnotation item, GizmoType type) { #if UNITY_5_0_0 || UNITY_5_0_1 if (AnnotationUtil.drawAlways || (type & GizmoType.SelectedOrChild) != 0) #else if (!(AnnotationUtil.drawAlways || (type & GizmoType.InSelectionHierarchy) != 0)) #endif return; Gizmos.color = item.Color; Gizmos.matrix = item.transform.localToWorldMatrix; Gizmos.DrawCube(item.PositionOffset, MarkerSize); } } }
mit
C#
260cbb7e1ef088012a4a932c1f15e4f8e2364173
Add [Serializable] attribute
dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute
Source/NSubstitute/Exceptions/ArgumentSetWithIncompatibleValueException.cs
Source/NSubstitute/Exceptions/ArgumentSetWithIncompatibleValueException.cs
using System; using System.Runtime.Serialization; namespace NSubstitute.Exceptions { [Serializable] public class ArgumentSetWithIncompatibleValueException : SubstituteException { const string WhatProbablyWentWrong = "Could not set value of type {2} to argument {0} ({1}) because the types are incompatible."; public ArgumentSetWithIncompatibleValueException(int argumentIndex, Type argumentType, Type typeOfValueWeTriedToAssign) : base(string.Format(WhatProbablyWentWrong, argumentIndex, argumentType.Name, typeOfValueWeTriedToAssign.Name)) { } protected ArgumentSetWithIncompatibleValueException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
using System; using System.Runtime.Serialization; namespace NSubstitute.Exceptions { public class ArgumentSetWithIncompatibleValueException : SubstituteException { const string WhatProbablyWentWrong = "Could not set value of type {2} to argument {0} ({1}) because the types are incompatible."; public ArgumentSetWithIncompatibleValueException(int argumentIndex, Type argumentType, Type typeOfValueWeTriedToAssign) : base(string.Format(WhatProbablyWentWrong, argumentIndex, argumentType.Name, typeOfValueWeTriedToAssign.Name)) { } protected ArgumentSetWithIncompatibleValueException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
bsd-3-clause
C#
e7f3941b1b81bfe5940ab0da6297023aa3d762c0
Revert "Quarantine all ProjectTemplate tests until dotnet new lock issue is resolved."
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/ProjectTemplates/test/AssemblyInfo.AssemblyFixtures.cs
src/ProjectTemplates/test/AssemblyInfo.AssemblyFixtures.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.E2ETesting; using Microsoft.AspNetCore.Testing; using Templates.Test.Helpers; using Xunit; [assembly: TestFramework("Microsoft.AspNetCore.E2ETesting.XunitTestFrameworkWithAssemblyFixture", "ProjectTemplates.Tests")] [assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(ProjectFactoryFixture))] [assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(SeleniumStandaloneServer))]
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNetCore.E2ETesting; using Microsoft.AspNetCore.Testing; using Templates.Test.Helpers; using Xunit; [assembly: TestFramework("Microsoft.AspNetCore.E2ETesting.XunitTestFrameworkWithAssemblyFixture", "ProjectTemplates.Tests")] [assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(ProjectFactoryFixture))] [assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(SeleniumStandaloneServer))] [assembly: QuarantinedTest("Investigation pending in https://github.com/dotnet/aspnetcore/issues/21748")]
apache-2.0
C#