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
65ec85b3a5c75af0181ebe328fae58e016f1feb2
Remove escape handling logic from FocusedOverlayContainer
ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ZLima12/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework
osu.Framework/Graphics/Containers/FocusedOverlayContainer.cs
osu.Framework/Graphics/Containers/FocusedOverlayContainer.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE namespace osu.Framework.Graphics.Containers { /// <summary> /// An overlay container that eagerly holds keyboard focus. /// </summary> public abstract class FocusedOverlayContainer : OverlayContainer { public override bool RequestsFocus => State == Visibility.Visible; public override bool AcceptsFocus => true; protected override void PopIn() { Schedule(() => GetContainingInputManager().TriggerFocusContention(this)); } protected override void PopOut() { if (HasFocus) GetContainingInputManager().ChangeFocus(null); } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using osu.Framework.Input; using OpenTK.Input; namespace osu.Framework.Graphics.Containers { /// <summary> /// An overlay container that eagerly holds keyboard focus. /// </summary> public abstract class FocusedOverlayContainer : OverlayContainer { public override bool RequestsFocus => State == Visibility.Visible; public override bool AcceptsFocus => true; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { if (HasFocus && State == Visibility.Visible && !args.Repeat) { switch (args.Key) { case Key.Escape: Hide(); return true; } } return base.OnKeyDown(state, args); } protected override void PopIn() { Schedule(() => GetContainingInputManager().TriggerFocusContention(this)); } protected override void PopOut() { if (HasFocus) GetContainingInputManager().ChangeFocus(null); } } }
mit
C#
fff1cb0b355e9b8984dbc950dd8d2d4412e01a94
Fix allowed mods not being copied when populating playlist items
peppy/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu
osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs
osu.Game/Screens/OnlinePlay/Playlists/PlaylistsSongSelect.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Components; using osu.Game.Screens.Select; namespace osu.Game.Screens.OnlinePlay.Playlists { public class PlaylistsSongSelect : OnlinePlaySongSelect { [Resolved] private BeatmapManager beatmaps { get; set; } protected override BeatmapDetailArea CreateBeatmapDetailArea() => new MatchBeatmapDetailArea { CreateNewItem = createNewItem }; protected override void SelectItem(PlaylistItem item) { switch (Playlist.Count) { case 0: createNewItem(); break; case 1: populateItemFromCurrent(Playlist.Single()); break; } this.Exit(); } private void createNewItem() { PlaylistItem item = new PlaylistItem { ID = Playlist.Count == 0 ? 0 : Playlist.Max(p => p.ID) + 1 }; populateItemFromCurrent(item); Playlist.Add(item); } private void populateItemFromCurrent(PlaylistItem item) { item.Beatmap.Value = Beatmap.Value.BeatmapInfo; item.Ruleset.Value = Ruleset.Value; item.RequiredMods.Clear(); item.RequiredMods.AddRange(Mods.Value.Select(m => m.CreateCopy())); item.AllowedMods.Clear(); item.AllowedMods.AddRange(FreeMods.Value.Select(m => m.CreateCopy())); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Components; using osu.Game.Screens.Select; namespace osu.Game.Screens.OnlinePlay.Playlists { public class PlaylistsSongSelect : OnlinePlaySongSelect { [Resolved] private BeatmapManager beatmaps { get; set; } protected override BeatmapDetailArea CreateBeatmapDetailArea() => new MatchBeatmapDetailArea { CreateNewItem = createNewItem }; protected override void SelectItem(PlaylistItem item) { switch (Playlist.Count) { case 0: createNewItem(); break; case 1: populateItemFromCurrent(Playlist.Single()); break; } this.Exit(); } private void createNewItem() { PlaylistItem item = new PlaylistItem { ID = Playlist.Count == 0 ? 0 : Playlist.Max(p => p.ID) + 1 }; populateItemFromCurrent(item); Playlist.Add(item); } private void populateItemFromCurrent(PlaylistItem item) { item.Beatmap.Value = Beatmap.Value.BeatmapInfo; item.Ruleset.Value = Ruleset.Value; item.RequiredMods.Clear(); item.RequiredMods.AddRange(Mods.Value.Select(m => m.CreateCopy())); } } }
mit
C#
2b8c4423d732a9d6e856f0e7736a5a6dce1b7e78
Add more supported image extensions to the image viewer plugin.
campersau/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer,dsplaisted/NuGetPackageExplorer,BreeeZe/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer
PackageExplorer/MefServices/ImageFileViewer.cs
PackageExplorer/MefServices/ImageFileViewer.cs
using System.IO; using System.Windows.Controls; using System.Windows.Media.Imaging; using NuGetPackageExplorer.Types; namespace PackageExplorer { [PackageContentViewerMetadata(99, ".jpg", ".gif", ".png", ".tif", ".bmp", ".ico")] internal class ImageFileViewer : IPackageContentViewer { public object GetView(string extension, Stream stream) { var source = new BitmapImage(); source.BeginInit(); source.CacheOption = BitmapCacheOption.OnLoad; source.StreamSource = stream; source.EndInit(); return new Image { Source = source, Width = source.Width, Height = source.Height }; } } }
using System.IO; using System.Windows.Controls; using System.Windows.Media.Imaging; using NuGetPackageExplorer.Types; namespace PackageExplorer { [PackageContentViewerMetadata(99, ".jpg", ".gif", ".png", ".tif")] internal class ImageFileViewer : IPackageContentViewer { public object GetView(string extension, Stream stream) { var source = new BitmapImage(); source.BeginInit(); source.CacheOption = BitmapCacheOption.OnLoad; source.StreamSource = stream; source.EndInit(); return new Image { Source = source, Width = source.Width, Height = source.Height }; } } }
mit
C#
782912e959a895644df3a9e710186962db286fd9
Revert "Closes #99: Fixed VS2008 support."
codemerlin/git-tfs,TheoAndersen/git-tfs,allansson/git-tfs,WolfVR/git-tfs,bleissem/git-tfs,adbre/git-tfs,kgybels/git-tfs,steveandpeggyb/Public,guyboltonking/git-tfs,steveandpeggyb/Public,irontoby/git-tfs,spraints/git-tfs,kgybels/git-tfs,allansson/git-tfs,steveandpeggyb/Public,kgybels/git-tfs,hazzik/git-tfs,vzabavnov/git-tfs,codemerlin/git-tfs,modulexcite/git-tfs,jeremy-sylvis-tmg/git-tfs,WolfVR/git-tfs,irontoby/git-tfs,timotei/git-tfs,modulexcite/git-tfs,NathanLBCooper/git-tfs,PKRoma/git-tfs,codemerlin/git-tfs,TheoAndersen/git-tfs,WolfVR/git-tfs,guyboltonking/git-tfs,jeremy-sylvis-tmg/git-tfs,pmiossec/git-tfs,hazzik/git-tfs,allansson/git-tfs,NathanLBCooper/git-tfs,timotei/git-tfs,spraints/git-tfs,timotei/git-tfs,hazzik/git-tfs,irontoby/git-tfs,modulexcite/git-tfs,spraints/git-tfs,NathanLBCooper/git-tfs,TheoAndersen/git-tfs,git-tfs/git-tfs,TheoAndersen/git-tfs,allansson/git-tfs,jeremy-sylvis-tmg/git-tfs,adbre/git-tfs,andyrooger/git-tfs,bleissem/git-tfs,hazzik/git-tfs,bleissem/git-tfs,adbre/git-tfs,guyboltonking/git-tfs
GitTfs.Vs2008/TfsHelper.Vs2008.cs
GitTfs.Vs2008/TfsHelper.Vs2008.cs
using System; using System.Collections.Generic; using System.IO; using System.Net; using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.VersionControl.Client; using Sep.Git.Tfs.Core.TfsInterop; using Sep.Git.Tfs.Util; using Sep.Git.Tfs.VsCommon; using StructureMap; namespace Sep.Git.Tfs.Vs2008 { public class TfsHelper : TfsHelperBase { private TeamFoundationServer _server; public TfsHelper(TextWriter stdout, TfsApiBridge bridge, IContainer container) : base(stdout, bridge, container) { } public override string TfsClientLibraryVersion { get { return "" + typeof (TeamFoundationServer).Assembly.GetName().Version + " (MS)"; } } public override void EnsureAuthenticated() { if (string.IsNullOrEmpty(Url)) { _server = null; } else { _server = HasCredentials ? new TeamFoundationServer(Url, GetCredential(), new UICredentialsProvider()) : new TeamFoundationServer(Url, new UICredentialsProvider()); _server.EnsureAuthenticated(); } } protected override T GetService<T>() { return (T) _server.GetService(typeof (T)); } protected override string GetAuthenticatedUser() { return VersionControl.AuthenticatedUser; } public override bool CanShowCheckinDialog { get { return false; } } public override long ShowCheckinDialog(IWorkspace workspace, IPendingChange[] pendingChanges, IEnumerable<IWorkItemCheckedInfo> checkedInfos, string checkinComment) { throw new NotImplementedException(); } } public class ItemDownloadStrategy : IItemDownloadStrategy { private readonly TfsApiBridge _bridge; public ItemDownloadStrategy(TfsApiBridge bridge) { _bridge = bridge; } public Stream DownloadFile(IItem item) { var tempfile = TemporaryFileStream.Acquire(); _bridge.Unwrap<Item>(item).DownloadFile(tempfile.Filename); return tempfile; } } }
using System; using System.Collections.Generic; using System.IO; using System.Net; using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.VersionControl.Client; using Sep.Git.Tfs.Core.TfsInterop; using Sep.Git.Tfs.Util; using Sep.Git.Tfs.VsCommon; using StructureMap; namespace Sep.Git.Tfs.Vs2008 { public class TfsHelper : TfsHelperBase { private TeamFoundationServer _server; public TfsHelper(TextWriter stdout, TfsApiBridge bridge, IContainer container) : base(stdout, bridge, container) { } public override string TfsClientLibraryVersion { get { return "" + typeof (TeamFoundationServer).Assembly.GetName().Version + " (MS)"; } } public override void EnsureAuthenticated() { if (string.IsNullOrEmpty(Url)) { _server = null; } else { _server = HasCredentials ? new TeamFoundationServer(Url, GetCredential(), new UICredentialsProvider()) : new TeamFoundationServer(Url, new UICredentialsProvider()); _server.EnsureAuthenticated(); } } protected override T GetService<T>() { return (T) _server.GetService(typeof (T)); } protected override string GetAuthenticatedUser() { return VersionControl.AuthenticatedUser; } public override bool CanShowCheckinDialog { get { return false; } } public override long ShowCheckinDialog(IWorkspace workspace, IPendingChange[] pendingChanges, IEnumerable<IWorkItemCheckedInfo> checkedInfos, string checkinComment) { throw new NotImplementedException(); } } public class ItemDownloadStrategy : IItemDownloadStrategy { private readonly TfsApiBridge _bridge; public ItemDownloadStrategy(TfsApiBridge bridge) { _bridge = bridge; } public Stream DownloadFile(IItem item) { return _bridge.Unwrap<Item>(item).DownloadFile(); } } }
apache-2.0
C#
f48984920d5b489adba4afd4a8c3c9fedaceebe1
Change bonus volume logic to work
smoogipooo/osu,peppy/osu,UselessToucan/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,peppy/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu
osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs
osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinnerTick : DrawableOsuHitObject { private bool hasBonusPoints; /// <summary> /// Whether this judgement has a bonus of 1,000 points additional to the numeric result. /// Set when a spin occured after the spinner has completed. /// </summary> public bool HasBonusPoints { get => hasBonusPoints; internal set { hasBonusPoints = value; Samples.Volume.Value = ((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints ? 1 : 0; } } public override bool DisplayResult => false; public DrawableSpinnerTick(SpinnerTick spinnerTick) : base(spinnerTick) { } /// <summary> /// Apply a judgement result. /// </summary> /// <param name="hit">Whether to apply a <see cref="HitResult.Great"/> result, <see cref="HitResult.Miss"/> otherwise.</param> internal void TriggerResult(bool hit) { HitObject.StartTime = Time.Current; ApplyResult(r => r.Type = hit ? HitResult.Great : HitResult.Miss); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinnerTick : DrawableOsuHitObject { private readonly BindableDouble bonusSampleVolume = new BindableDouble(); private bool hasBonusPoints; /// <summary> /// Whether this judgement has a bonus of 1,000 points additional to the numeric result. /// Set when a spin occured after the spinner has completed. /// </summary> public bool HasBonusPoints { get => hasBonusPoints; internal set { hasBonusPoints = value; bonusSampleVolume.Value = value ? 1 : 0; ((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints = value; } } public override bool DisplayResult => false; public DrawableSpinnerTick(SpinnerTick spinnerTick) : base(spinnerTick) { } protected override void LoadComplete() { base.LoadComplete(); Samples.AddAdjustment(AdjustableProperty.Volume, bonusSampleVolume); } /// <summary> /// Apply a judgement result. /// </summary> /// <param name="hit">Whether to apply a <see cref="HitResult.Great"/> result, <see cref="HitResult.Miss"/> otherwise.</param> internal void TriggerResult(bool hit) { HitObject.StartTime = Time.Current; ApplyResult(r => r.Type = hit ? HitResult.Great : HitResult.Miss); } } }
mit
C#
9363e2d59e0cd3f3978fae267e465b299d61720d
Fix getting current screen for windows (use actual width/height)
l8s/Eto,PowerOfCode/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,l8s/Eto,l8s/Eto
Source/Eto.Platform.Wpf/Forms/ScreenHandler.cs
Source/Eto.Platform.Wpf/Forms/ScreenHandler.cs
using System; using Eto.Forms; using sw = System.Windows; using sd = System.Drawing; using swm = System.Windows.Media; using swf = System.Windows.Forms; using Eto.Drawing; namespace Eto.Platform.Wpf.Forms { public class ScreenHandler : WidgetHandler<swf.Screen, Screen>, IScreen { float scale; public ScreenHandler (sw.Window window) { var source = sw.PresentationSource.FromVisual (window); Control = GetCurrentScreen (window); scale = (float)(source.CompositionTarget.TransformToDevice.M22 * 92.0 / 72.0); } public ScreenHandler (swf.Screen screen) { Control = screen; var form = new swf.Form (); var graphics = form.CreateGraphics (); scale = graphics.DpiY / 72f; } static swf.Screen GetCurrentScreen (sw.Window window) { var centerPoint = new sd.Point ((int)(window.Left + window.ActualWidth / 2), (int)(window.Top + window.ActualHeight / 2)); foreach (var s in swf.Screen.AllScreens) { if (s.Bounds.Contains (centerPoint)) return s; } return swf.Screen.PrimaryScreen; } public float RealScale { get { return scale; } } public float Scale { get { return scale; } } public RectangleF Bounds { get { return Control.Bounds.ToEto (); } } public RectangleF WorkingArea { get { return Control.WorkingArea.ToEto (); } } public int BitsPerPixel { get { return Control.BitsPerPixel; } } public bool IsPrimary { get { return Control.Primary; } } } }
using System; using Eto.Forms; using sw = System.Windows; using sd = System.Drawing; using swm = System.Windows.Media; using swf = System.Windows.Forms; using Eto.Drawing; namespace Eto.Platform.Wpf.Forms { public class ScreenHandler : WidgetHandler<swf.Screen, Screen>, IScreen { float scale; public ScreenHandler (sw.Window window) { var source = sw.PresentationSource.FromVisual (window); Control = GetCurrentScreen (window); scale = (float)(source.CompositionTarget.TransformToDevice.M22 * 92.0 / 72.0); } public ScreenHandler (swf.Screen screen) { Control = screen; var form = new swf.Form (); var graphics = form.CreateGraphics (); scale = graphics.DpiY / 72f; } static swf.Screen GetCurrentScreen (sw.Window window) { var centerPoint = new sd.Point ((int)(window.Left + window.Width / 2), (int)(window.Top + window.Height / 2)); foreach (var s in swf.Screen.AllScreens) { if (s.Bounds.Contains (centerPoint)) return s; } return null; } public float RealScale { get { return scale; } } public float Scale { get { return scale; } } public RectangleF Bounds { get { return Control.Bounds.ToEto (); } } public RectangleF WorkingArea { get { return Control.WorkingArea.ToEto (); } } public int BitsPerPixel { get { return Control.BitsPerPixel; } } public bool IsPrimary { get { return Control.Primary; } } } }
bsd-3-clause
C#
9a38e62f4a05b43d36060938506ae3b02c6d11a0
Update version number to reflect changes
mrkno/TitleCleaner
TitleCleanerConsole/Properties/AssemblyInfo.cs
TitleCleanerConsole/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // 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("Title Cleaner")] [assembly: AssemblyDescription("Clean media file names.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Knox Enterprises")] [assembly: AssemblyProduct("Title Cleaner")] [assembly: AssemblyCopyright("Copyright © Matthew Knox 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("3a7e8105-833d-48d0-b504-e37d8eafc521")] // 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("2.0.0.1")] [assembly: AssemblyFileVersion("2.0.0.1")] [assembly: NeutralResourcesLanguageAttribute("en-NZ")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // 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("Title Cleaner")] [assembly: AssemblyDescription("Clean media file names.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Knox Enterprises")] [assembly: AssemblyProduct("Title Cleaner")] [assembly: AssemblyCopyright("Copyright © Matthew Knox 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("3a7e8105-833d-48d0-b504-e37d8eafc521")] // 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("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-NZ")]
mit
C#
178aedcac6811f57722b42af434de431aa66f1b7
Fix for 'Prelude.delay throws exception' https://github.com/louthy/language-ext/issues/79 Thanks @OlduwanSteve
StanJav/language-ext,StefanBertels/language-ext,louthy/language-ext
LanguageExt.Core/Prelude_Timer.cs
LanguageExt.Core/Prelude_Timer.cs
using System; using System.Linq; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Threading.Tasks; namespace LanguageExt { public static partial class Prelude { /// <summary> /// Execute a function after a specified delay /// </summary> /// <param name="f">Function to execute</param> /// <param name="delayFor">Time span to delay for</param> /// <returns>IObservable T with the result</returns> public static IObservable<T> delay<T>(Func<T> f, TimeSpan delayFor) => delayFor.TotalMilliseconds < 1 ? Observable.Return(f()).Take(1) : Task.Delay(delayFor).ContinueWith(_ => f()).ToObservable().Take(1); /// <summary> /// Execute a function at a specific time /// </summary> /// <remarks> /// This will fail to be accurate across a Daylight Saving Time boundary /// </remarks> /// <param name="f">Function to execute</param> /// <param name="delayUntil">DateTime to wake up at.</param> /// <returns>IObservable T with the result</returns> public static IObservable<T> delay<T>(Func<T> f, DateTime delayUntil) => delay(f, delayUntil.ToUniversalTime() - DateTime.UtcNow); /// <summary> /// Execute an action after a specified delay /// </summary> /// <param name="f">Action to execute</param> /// <param name="delayFor">Time span to delay for</param> public static Unit delay(Action f, TimeSpan delayFor) { if (delayFor.TotalMilliseconds < 1) { f(); } else { Task.Delay(delayFor).ContinueWith(_ => f()); } return unit; } /// <summary> /// Execute a function at a specific time /// </summary> /// <remarks> /// This will fail to be accurate across a Daylight Saving Time boundary /// </remarks> /// <param name="f">Action to execute</param> /// <param name="delayUntil">DateTime to wake up at.</param> public static Unit delay(Action f, DateTime delayUntil) => delay(f, delayUntil.ToUniversalTime() - DateTime.UtcNow); } }
using System; using System.Linq; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Threading.Tasks; namespace LanguageExt { public static partial class Prelude { /// <summary> /// Execute a function after a specified delay /// </summary> /// <param name="f">Function to execute</param> /// <param name="delayFor">Time span to delay for</param> /// <returns>IObservable T with the result</returns> public static IObservable<T> delay<T>(Func<T> f, TimeSpan delayFor) => delayFor.TotalMilliseconds < 1 ? Observable.Return(f()).Take(1) : Task.Delay(delayFor).ContinueWith(_ => f()).ToObservable().Take(1); /// <summary> /// Execute a function at a specific time /// </summary> /// <remarks> /// This will fail to be accurate across a Daylight Saving Time boundary /// </remarks> /// <param name="f">Function to execute</param> /// <param name="delayUntil">DateTime to wake up at.</param> /// <returns>IObservable T with the result</returns> public static IObservable<T> delay<T>(Func<T> f, DateTime delayUntil) => delay(f, delayUntil.ToUniversalTime() - DateTime.UtcNow); /// <summary> /// Execute an action after a specified delay /// </summary> /// <param name="f">Action to execute</param> /// <param name="delayFor">Time span to delay for</param> public static Unit delay(Action f, TimeSpan delayFor) { if (delayFor.TotalMilliseconds < 1) { f(); } else { Task.Delay(delayFor).ContinueWith(_ => f()).Start(); } return unit; } /// <summary> /// Execute a function at a specific time /// </summary> /// <remarks> /// This will fail to be accurate across a Daylight Saving Time boundary /// </remarks> /// <param name="f">Action to execute</param> /// <param name="delayUntil">DateTime to wake up at.</param> public static Unit delay(Action f, DateTime delayUntil) => delay(f, delayUntil.ToUniversalTime() - DateTime.UtcNow); } }
mit
C#
8726b2e2a1fe436530829f0fd8a7f768dbdb585e
Update version.
VictorZakharov/pinwin
PinWin/Properties/AssemblyInfo.cs
PinWin/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("PinWin")] [assembly: AssemblyDescription("Allows user to make desktop windows top most")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PinWin")] [assembly: AssemblyCopyright("Copyright © Victor Zakharov 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7ae6966c-0686-4ac4-afbb-9ffd7bf7b81c")] // 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("0.2.3")] [assembly: AssemblyFileVersion("0.2.3")]
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("PinWin")] [assembly: AssemblyDescription("Allows user to make desktop windows top most")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PinWin")] [assembly: AssemblyCopyright("Copyright © Victor Zakharov 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7ae6966c-0686-4ac4-afbb-9ffd7bf7b81c")] // 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("0.2.2")] [assembly: AssemblyFileVersion("0.2.2")]
mit
C#
7e27ad8941e84e95266a624fbc1efae2adb4d9eb
fix Warning level
signumsoftware/framework,signumsoftware/framework
Signum.Upgrade/Upgrades/Upgrade_20210210_UpgradeNugets.cs
Signum.Upgrade/Upgrades/Upgrade_20210210_UpgradeNugets.cs
using Signum.Utilities; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace Signum.Upgrade.Upgrades { class Upgrade_20210210_UpgradeNugets : CodeUpgradeBase { public override string Description => "Upgrade a few nugets"; public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile(@"Southwind.React\Southwind.React.csproj", file => { file.UpdateNugetReference("Microsoft.TypeScript.MSBuild", "4.1.4"); file.WarningLevel = WarningLevel.Warning; file.UpdateNugetReference("Swashbuckle.AspNetCore", "6.0.3"); }); } } }
using Signum.Utilities; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace Signum.Upgrade.Upgrades { class Upgrade_20210210_UpgradeNugets : CodeUpgradeBase { public override string Description => "Upgrade a few nugets"; public override void Execute(UpgradeContext uctx) { uctx.ChangeCodeFile(@"Southwind.React\Southwind.React.csproj", file => { file.UpdateNugetReference("Microsoft.TypeScript.MSBuild", "4.1.4"); file.UpdateNugetReference("Swashbuckle.AspNetCore", "6.0.3"); }); } } }
mit
C#
58033134ca5bfb1c2cd606513f02b854ba7529c9
replace uploading qr code with shortening nfshost link
HouseBreaker/Shameless
Shameless/QRGeneration/QRUtils.cs
Shameless/QRGeneration/QRUtils.cs
namespace Shameless.QRGeneration { using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Net; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using ZXing; using ZXing.Common; public static class QrUtils { public static QrResult MakeUrlIntoQrCode(string url) { var writer = new BarcodeWriter { Format = BarcodeFormat.QR_CODE, Options = new EncodingOptions { Height = 325, Width = 325 } }; var result = writer.Write(url); var qrResult = new QrResult(url, new Bitmap(result)); return qrResult; } public static string Shorten(string url) { string shortUrl; using (var client = new WebClient()) { var response = client.DownloadString($"https://hec.su/api?url={url}"); var json = (JObject)JsonConvert.DeserializeObject(response); shortUrl = json["short"].Value<string>(); } return shortUrl; } } }
namespace Shameless.QRGeneration { using System.Drawing; using System.Net; using ZXing; using ZXing.Common; public static class QrUtils { public static QrResult MakeTicketIntoQrCode(string path) { var resultUrl = UploadToTempHost(path); var writer = new BarcodeWriter { Format = BarcodeFormat.QR_CODE, Options = new EncodingOptions { Height = 275, Width = 275 } }; var result = writer.Write(resultUrl); var qrResult = new QrResult(resultUrl, new Bitmap(result)); return qrResult; } private static string UploadToTempHost(string path) { string response; using (var client = new WebClient()) { var responseBytes = client.UploadFile("https://uguu.se/api.php?d=upload-tool", path); response = client.Encoding.GetString(responseBytes); } return response; } } }
mit
C#
2fd70bc78a7bfc8c13e1d9b6ef94a354a9932a3a
Add auto unload model
tobyclh/UnityCNTK,tobyclh/UnityCNTK
Assets/UnityCNTK/Models/Model.cs
Assets/UnityCNTK/Models/Model.cs
using System.Collections; using System.Collections.Generic; using UnityEngine.Assertions; using System.Linq; using UnityEngine; using UnityEditor; using CNTK; using System.Timers; using System.Threading; using CNTK; namespace UnityCNTK { // Unifying class that combine the use of both EvalDLL and CNTKLibrary // The reason we have not dropped support for EvalDLL is that it expose more native function of the full API, // which are very useful in general. public abstract class Model : ScriptableObject { public Function function; public IConvertible input; public IConvertible output; public Thread thread; public bool KeepModelLoaded = false; public abstract void LoadModel(); public abstract void Evaluate(DeviceDescriptor device); public abstract void OnEvaluated(); } }
using System.Collections; using System.Collections.Generic; using UnityEngine.Assertions; using System.Linq; using UnityEngine; using UnityEditor; using CNTK; using System.Timers; using System.Threading; using CNTK; namespace UnityCNTK { // Unifying class that combine the use of both EvalDLL and CNTKLibrary // The reason we have not dropped support for EvalDLL is that it expose more native function of the full API, // which are very useful in general. public abstract class Model : ScriptableObject { public Function function; public IConvertible input; public IConvertible output; public Thread thread; public abstract void LoadModel(); public abstract void Evaluate(DeviceDescriptor device); public abstract void OnEvaluated(); } }
mit
C#
2fd3e222399af19f2b14c6e5e75c2710d9bae6a8
Use ToUpperInvariant instead of culture version
mono/maccore
src/Foundation/ExportAttribute.cs
src/Foundation/ExportAttribute.cs
// // ExportAttribute.cs: The Export attribute // // Authors: // Geoff Norton // // Copyright 2009, Novell, Inc. // Copyright 2010, Novell, Inc. // Copyright 2011, 2012 Xamarin 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.Globalization; using System.Reflection; using MonoMac.ObjCRuntime; namespace MonoMac.Foundation { [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)] public class ExportAttribute : Attribute { string selector; ArgumentSemantic semantic; public ExportAttribute() {} public ExportAttribute(string selector) { this.selector = selector; this.semantic = ArgumentSemantic.None; } public ExportAttribute(string selector, ArgumentSemantic semantic) { this.selector = selector; this.semantic = semantic; } public string Selector { get { return this.selector; } set { this.selector = value; } } public ArgumentSemantic ArgumentSemantic { get { return this.semantic; } set { this.semantic = value; } } //#if MONOMAC public ExportAttribute ToGetter (PropertyInfo prop) { if (string.IsNullOrEmpty (Selector)) Selector = prop.Name; return new ExportAttribute (selector, semantic); } public ExportAttribute ToSetter (PropertyInfo prop) { if (string.IsNullOrEmpty (Selector)) Selector = prop.Name; return new ExportAttribute (string.Format ("set{0}{1}:", char.ToUpperInvariant (selector [0]), selector.Substring (1)), semantic); } //#endif } [AttributeUsage (AttributeTargets.Property)] public sealed class OutletAttribute : ExportAttribute { public OutletAttribute () {} public OutletAttribute (string name) : base (name) {} } [AttributeUsage (AttributeTargets.Method)] public sealed class ActionAttribute : ExportAttribute { public ActionAttribute () {} public ActionAttribute (string selector) : base (selector) {} } }
// // ExportAttribute.cs: The Export attribute // // Authors: // Geoff Norton // // Copyright 2009, Novell, Inc. // Copyright 2010, Novell, Inc. // Copyright 2011, 2012 Xamarin 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.Globalization; using System.Reflection; using MonoMac.ObjCRuntime; namespace MonoMac.Foundation { [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)] public class ExportAttribute : Attribute { string selector; ArgumentSemantic semantic; public ExportAttribute() {} public ExportAttribute(string selector) { this.selector = selector; this.semantic = ArgumentSemantic.None; } public ExportAttribute(string selector, ArgumentSemantic semantic) { this.selector = selector; this.semantic = semantic; } public string Selector { get { return this.selector; } set { this.selector = value; } } public ArgumentSemantic ArgumentSemantic { get { return this.semantic; } set { this.semantic = value; } } //#if MONOMAC public ExportAttribute ToGetter (PropertyInfo prop) { if (string.IsNullOrEmpty (Selector)) Selector = prop.Name; return new ExportAttribute (selector, semantic); } public ExportAttribute ToSetter (PropertyInfo prop) { if (string.IsNullOrEmpty (Selector)) Selector = prop.Name; return new ExportAttribute (string.Format ("set{0}{1}:", char.ToUpper (selector [0], CultureInfo.InvariantCulture), selector.Substring (1)), semantic); } //#endif } [AttributeUsage (AttributeTargets.Property)] public sealed class OutletAttribute : ExportAttribute { public OutletAttribute () {} public OutletAttribute (string name) : base (name) {} } [AttributeUsage (AttributeTargets.Method)] public sealed class ActionAttribute : ExportAttribute { public ActionAttribute () {} public ActionAttribute (string selector) : base (selector) {} } }
apache-2.0
C#
ea1a210a3bd4e7ea24fa5610fcead0007762934c
Clear all view engines and add only Razor view engine (performance)
juliameleshko/AnimalHope,juliameleshko/AnimalHope
AnimalHope/AnimalHope.Web/Global.asax.cs
AnimalHope/AnimalHope.Web/Global.asax.cs
using AnimalHope.Web.Infrastructure.Mapping; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; namespace AnimalHope.Web { public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorViewEngine()); AutoMapperConfig.Execute(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); } } }
using AnimalHope.Web.Infrastructure.Mapping; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; namespace AnimalHope.Web { public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { AutoMapperConfig.Execute(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); } } }
mit
C#
00febf3a56b6b912da578d8ce78b7de0fa82fd55
Load environment variables from different targets to support ASP.Net applications.
CH3CHO/Archaius.Net
Archaius.Net/EnvironmentConfiguration.cs
Archaius.Net/EnvironmentConfiguration.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace Archaius { public class EnvironmentConfiguration : DictionaryConfiguration { public EnvironmentConfiguration() : base(GetEnvironmentVariables()) { } public override void AddProperty(string key, object value) { throw new NotSupportedException("EnvironmentConfiguration is readonly."); } public override void SetProperty(string key, object value) { throw new NotSupportedException("EnvironmentConfiguration is readonly."); } public override void ClearProperty(string key) { throw new NotSupportedException("EnvironmentConfiguration is readonly."); } public override void Clear() { throw new NotSupportedException("EnvironmentConfiguration is readonly."); } private static IDictionary<string, object> GetEnvironmentVariables() { var variables = Environment.GetEnvironmentVariables(EnvironmentVariableTarget.Process) .Cast<DictionaryEntry>() .ToDictionary(variable => (string)variable.Key, variable => variable.Value); foreach (DictionaryEntry userVariable in Environment.GetEnvironmentVariables(EnvironmentVariableTarget.User)) { if (!variables.ContainsKey((string)userVariable.Key)) { variables.Add((string)userVariable.Key, userVariable.Value); } } foreach (DictionaryEntry machineVariable in Environment.GetEnvironmentVariables(EnvironmentVariableTarget.Machine)) { if (!variables.ContainsKey((string)machineVariable.Key)) { variables.Add((string)machineVariable.Key, machineVariable.Value); } } return variables; } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace Archaius { public class EnvironmentConfiguration : DictionaryConfiguration { public EnvironmentConfiguration() : base(GetEnvironmentVariables()) { } public override void AddProperty(string key, object value) { throw new NotSupportedException("EnvironmentConfiguration is readonly."); } public override void SetProperty(string key, object value) { throw new NotSupportedException("EnvironmentConfiguration is readonly."); } public override void ClearProperty(string key) { throw new NotSupportedException("EnvironmentConfiguration is readonly."); } public override void Clear() { throw new NotSupportedException("EnvironmentConfiguration is readonly."); } private static IDictionary<string, object> GetEnvironmentVariables() { return Environment.GetEnvironmentVariables() .Cast<DictionaryEntry>() .ToDictionary(variable => (string)variable.Key, variable => variable.Value); } } }
mit
C#
c8681e724e77b01d4d468652c95f4752bd208e58
fix bug: star didn't destroy
39M/LMix
Assets/Scenes/InGame/Scripts/StarMove.cs
Assets/Scenes/InGame/Scripts/StarMove.cs
using UnityEngine; using System.Collections; public class StarMove : MonoBehaviour { GamePlayer status; void Start () { status = GameObject.Find ("GamePlayer").GetComponent ("GamePlayer") as GamePlayer; } void Update () { if (status.pause) return; transform.Translate (Vector3.back * Random.Range (5f, 20) * Time.deltaTime, Space.World); transform.Rotate (new Vector3 (15, 30, 45) * Time.deltaTime); if (transform.position.z < -10) Destroy (gameObject); } }
using UnityEngine; using System.Collections; public class StarMove : MonoBehaviour { GamePlayer status; void Start () { status = GameObject.Find ("GamePlayer").GetComponent ("GamePlayer") as GamePlayer; } void Update () { if (status.pause) return; transform.Translate (Vector3.back * Random.Range (5f, 20) * Time.deltaTime, Space.World); transform.Rotate (new Vector3 (15, 30, 45) * Time.deltaTime); if (transform.position.y < -10) Destroy (gameObject); } }
mit
C#
5f4d7437bcdafc03434d62446683b5d1692940ae
Fix the issue
smoogipooo/osu,NeoAdonis/osu,ppy/osu,johnneijzen/osu,peppy/osu,ppy/osu,EVAST9919/osu,UselessToucan/osu,UselessToucan/osu,ZLima12/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,ZLima12/osu,peppy/osu-new,2yangk23/osu,NeoAdonis/osu,johnneijzen/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,peppy/osu,EVAST9919/osu,2yangk23/osu
osu.Game/Graphics/Containers/OsuHoverContainer.cs
osu.Game/Graphics/Containers/OsuHoverContainer.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osuTK.Graphics; using System.Collections.Generic; namespace osu.Game.Graphics.Containers { public class OsuHoverContainer : OsuClickableContainer { protected const float FADE_DURATION = 500; protected Color4 HoverColour; protected Color4 IdleColour = Color4.White; protected virtual IEnumerable<Drawable> EffectTargets => new[] { Content }; public OsuHoverContainer() { Enabled.ValueChanged += e => { if (e.NewValue && isHovered) fadeIn(); if (!e.NewValue) unhover(); }; } private bool isHovered; protected override bool OnHover(HoverEvent e) { isHovered = true; if (!Enabled.Value) return false; fadeIn(); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { unhover(); base.OnHoverLost(e); } private void unhover() { if (!isHovered) return; isHovered = false; EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint)); } [BackgroundDependencyLoader] private void load(OsuColour colours) { if (HoverColour == default) HoverColour = colours.Yellow; } protected override void LoadComplete() { base.LoadComplete(); EffectTargets.ForEach(d => d.FadeColour(IdleColour)); } private void fadeIn() { EffectTargets.ForEach(d => d.FadeColour(Color4.Black, FADE_DURATION * 10, Easing.OutQuint)); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osuTK.Graphics; using System.Collections.Generic; namespace osu.Game.Graphics.Containers { public class OsuHoverContainer : OsuClickableContainer { protected const float FADE_DURATION = 500; protected Color4 HoverColour; protected Color4 IdleColour = Color4.White; protected virtual IEnumerable<Drawable> EffectTargets => new[] { Content }; public OsuHoverContainer() { Enabled.ValueChanged += e => { if (!e.NewValue) unhover(); }; } private bool isHovered; protected override bool OnHover(HoverEvent e) { if (!Enabled.Value) return false; EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint)); isHovered = true; return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { unhover(); base.OnHoverLost(e); } private void unhover() { if (!isHovered) return; isHovered = false; EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint)); } [BackgroundDependencyLoader] private void load(OsuColour colours) { if (HoverColour == default) HoverColour = colours.Yellow; } protected override void LoadComplete() { base.LoadComplete(); EffectTargets.ForEach(d => d.FadeColour(IdleColour)); } } }
mit
C#
f85e1e1829b0adc27259e00af5ed0097266ab7d1
implement Comment property for JpegComment
punker76/taglib-sharp,hwahrmann/taglib-sharp,CamargoR/taglib-sharp,archrival/taglib-sharp,archrival/taglib-sharp,Clancey/taglib-sharp,CamargoR/taglib-sharp,Clancey/taglib-sharp,punker76/taglib-sharp,Clancey/taglib-sharp,mono/taglib-sharp,hwahrmann/taglib-sharp
src/TagLib/Jpeg/JpegCommentTag.cs
src/TagLib/Jpeg/JpegCommentTag.cs
// // JpegCommentTag.cs: // // Author: // Ruben Vermeersch ([email protected]) // // Copyright (C) 2009 Ruben Vermeersch // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License version // 2.1 as published by the Free Software Foundation. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA // using System; using TagLib.Image; namespace TagLib.Jpeg { /// <summary> /// Contains the JPEG comment. /// </summary> public class JpegCommentTag : ImageTag { #region Constructors /// <summary> /// Constructs a new <see cref="JpegComment" />. /// </summary> /// <param name="value"> /// The value of the comment. /// </param> public JpegCommentTag (string value) { Value = value; } /// <summary> /// Constructs a new <see cref="JpegComment" />. /// </summary> public JpegCommentTag () { Value = null; } #endregion #region Public Properties /// <summary> /// The value of this <see cref="JpegComment" />. /// </summary> public string Value { get; set; } /// <summary> /// Gets or sets the comment for the image described /// by the current instance. /// </summary> /// <value> /// A <see cref="string" /> containing the comment of the /// current instace. /// </value> public override string Comment { get { return Value; } set { Value = value; } } #endregion #region Public Methods /// <summary> /// Gets the tag types contained in the current instance. /// </summary> /// <value> /// Always <see cref="TagTypes.JpegComment" />. /// </value> public override TagTypes TagTypes { get {return TagTypes.JpegComment;} } /// <summary> /// Clears the values stored in the current instance. /// </summary> public override void Clear () { throw new NotImplementedException (); } #endregion } }
// // JpegCommentTag.cs: // // Author: // Ruben Vermeersch ([email protected]) // // Copyright (C) 2009 Ruben Vermeersch // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License version // 2.1 as published by the Free Software Foundation. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA // using System; using TagLib.Image; namespace TagLib.Jpeg { /// <summary> /// Contains the JPEG comment. /// </summary> public class JpegCommentTag : ImageTag { #region Constructors /// <summary> /// Constructs a new <see cref="JpegComment" />. /// </summary> /// <param name="value"> /// The value of the comment. /// </param> public JpegCommentTag (string value) { Value = value; } /// <summary> /// Constructs a new <see cref="JpegComment" />. /// </summary> public JpegCommentTag () { Value = null; } #endregion #region Public Properties /// <summary> /// The value of this <see cref="JpegComment" />. /// </summary> public string Value { get; set; } #endregion #region Public Methods /// <summary> /// Gets the tag types contained in the current instance. /// </summary> /// <value> /// Always <see cref="TagTypes.JpegComment" />. /// </value> public override TagTypes TagTypes { get {return TagTypes.JpegComment;} } /// <summary> /// Clears the values stored in the current instance. /// </summary> public override void Clear () { throw new NotImplementedException (); } #endregion } }
lgpl-2.1
C#
c24408c16bede3e1beb28b5012c025ae4ac976fd
Change version number.
ollyau/FSWebMap
WebMap/Properties/AssemblyInfo.cs
WebMap/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 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("WebMap")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WebMap")] [assembly: AssemblyCopyright("Copyright © Orion Lyau 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)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // 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("0.2.0.0")] [assembly: AssemblyFileVersion("0.2.0.0")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 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("WebMap")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WebMap")] [assembly: AssemblyCopyright("Copyright © Orion Lyau 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)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // 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.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
mit
C#
07a0905fa20e87f313c65b91e588bff120e641db
Add TODO to LinkType
leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net
src/JoinRpg.DataModel/Links.cs
src/JoinRpg.DataModel/Links.cs
using JetBrains.Annotations; namespace JoinRpg.DataModel { // TODO add unit test to ensure that everything covered public enum LinkType { ResultUser, ResultCharacterGroup, ResultCharacter, Claim, Plot, Comment, Project, CommentDiscussion, PaymentSuccess, PaymentFail, } public interface ILinkable { LinkType LinkType { get; } [NotNull] string Identification { get; } int? ProjectId { get; } } }
using JetBrains.Annotations; namespace JoinRpg.DataModel { public enum LinkType { ResultUser, ResultCharacterGroup, ResultCharacter, Claim, Plot, Comment, Project, CommentDiscussion, PaymentSuccess, PaymentFail, } public interface ILinkable { LinkType LinkType { get; } [NotNull] string Identification { get; } int? ProjectId { get; } } }
mit
C#
e6a7a8d8f14e6348772a0037362703ecac1b7b88
Make the facades a no-op on Windows platforms, so they don't troll PCL authors
xamarin/ModernHttpClient,scoodah/ModernHttpClient,kensykora/ModernHttpClient,nachocove/ModernHttpClient-demo,mattleibow/ModernHttpClient,djlewisxactware/ModernHttpClient,koltsov-ps/ModernHttpClient,tpurtell/ModernHttpClient,tomgilder/OkHttpClient,pacificIT/ModernHttpClient,paulcbetts/ModernHttpClient,leonardors/ModernHttpClient,nachocove/ModernHttpClient,tomgilder/OkHttpClient
src/ModernHttpClient/Facades.cs
src/ModernHttpClient/Facades.cs
using System; using System.Net.Http; using System.Threading.Tasks; using System.Threading; using System.IO; namespace ModernHttpClient.Portable { public class NativeMessageHandler : HttpClientHandler { /// <summary> /// Initializes a new instance of the <see /// cref="ModernHttpClient.Portable.NativeMessageHandler"/> class. /// </summary> public NativeMessageHandler(): base() { } /// <summary> /// Initializes a new instance of the <see /// cref="ModernHttpClient.Portable.NativeMessageHandler"/> class. /// </summary> /// <param name="throwOnCaptiveNetwork">If set to <c>true</c> throw on /// captive network (ie: a captive network is usually a wifi network /// where an authentication html form is shown instead of the real /// content).</param> public NativeMessageHandler(bool throwOnCaptiveNetwork) : base() { } [Obsolete("You're using NativeMessageHandler on an unsupported platform or are ref'ing the wrong DLL. This method will do nothing!")] public void RegisterForProgress(HttpRequestMessage request, ProgressDelegate callback) { } } public class ProgressStreamContent : StreamContent { const string wrongVersion = "You're referencing the Portable version in your App - you need to reference the platform (iOS/Android) version"; ProgressStreamContent(Stream stream) : base(stream) { throw new Exception(wrongVersion); } ProgressStreamContent(Stream stream, int bufferSize) : base(stream, bufferSize) { throw new Exception(wrongVersion); } public ProgressDelegate Progress { get { throw new Exception(wrongVersion); } set { throw new Exception(wrongVersion); } } } public delegate void ProgressDelegate(long bytes, long totalBytes, long totalBytesExpected); }
using System; using System.Net.Http; using System.Threading.Tasks; using System.Threading; using System.IO; namespace ModernHttpClient.Portable { public class NativeMessageHandler : HttpMessageHandler { const string wrongVersion = "You're referencing the Portable version in your App - you need to reference the platform (iOS/Android) version"; /// <summary> /// Initializes a new instance of the <see /// cref="ModernHttpClient.Portable.NativeMessageHandler"/> class. /// </summary> public NativeMessageHandler(): base() { throw new Exception(wrongVersion); } /// <summary> /// Initializes a new instance of the <see /// cref="ModernHttpClient.Portable.NativeMessageHandler"/> class. /// </summary> /// <param name="throwOnCaptiveNetwork">If set to <c>true</c> throw on /// captive network (ie: a captive network is usually a wifi network /// where an authentication html form is shown instead of the real /// content).</param> public NativeMessageHandler(bool throwOnCaptiveNetwork) : base() { throw new Exception(wrongVersion); } public void RegisterForProgress(HttpRequestMessage request, ProgressDelegate callback) { throw new Exception(wrongVersion); } protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { throw new Exception(wrongVersion); } } public class ProgressStreamContent : StreamContent { const string wrongVersion = "You're referencing the Portable version in your App - you need to reference the platform (iOS/Android) version"; ProgressStreamContent(Stream stream) : base(stream) { throw new Exception(wrongVersion); } ProgressStreamContent(Stream stream, int bufferSize) : base(stream, bufferSize) { throw new Exception(wrongVersion); } public ProgressDelegate Progress { get { throw new Exception(wrongVersion); } set { throw new Exception(wrongVersion); } } } public delegate void ProgressDelegate(long bytes, long totalBytes, long totalBytesExpected); }
mit
C#
e3b8e93d27847dd6c718185e42ebeb99839864eb
Remove cost att
heynickc/dto_assembly,heynickc/dto_assembly,heynickc/dto_assembly
DtoDeepDive.Data/DTO/LaborSequenceDTO.cs
DtoDeepDive.Data/DTO/LaborSequenceDTO.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DtoDeepDive.Data.DTO { public class LaborSequenceDTO { public string SequenceNumber { get; set; } public string SequenceDescription { get; set; } public double RunTime { get; set; } public decimal LaborRate { get; set; } public decimal Burden { get; set; } public decimal GetLaborCost(double quantity) { return ((decimal)RunTime * LaborRate) * Burden; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DtoDeepDive.Data.DTO { public class LaborSequenceDTO { public string SequenceNumber { get; set; } public string SequenceDescription { get; set; } public double RunTime { get; set; } public decimal LaborRate { get; set; } public decimal Burden { get; set; } public decimal LaborCost { get; set; } public decimal GetLaborCost(double quantity) { return ((decimal)RunTime * LaborRate) * Burden; } } }
mit
C#
7765eba9e261e0bbdd014b6d6faa4dc92efffa19
Add Error property
Archie-Yang/PcscDotNet
src/PcscDotNet/PcscException.cs
src/PcscDotNet/PcscException.cs
using System; using System.ComponentModel; namespace PcscDotNet { public class PcscException : Win32Exception { public SCardError Error => (SCardError)NativeErrorCode; public PcscException() { } public PcscException(int error) : base(error) { } public PcscException(SCardError error) : base((int)error) { } public PcscException(string message) : base(message) { } public PcscException(int error, string message) : base(error, message) { } public PcscException(string message, Exception innerException) : base(message, innerException) { } } }
using System; using System.ComponentModel; namespace PcscDotNet { public class PcscException : Win32Exception { public PcscException() { } public PcscException(int error) : base(error) { } public PcscException(SCardError error) : base((int)error) { } public PcscException(string message) : base(message) { } public PcscException(int error, string message) : base(error, message) { } public PcscException(string message, Exception innerException) : base(message, innerException) { } } }
mit
C#
1c609f81014aaf90fa62fd1badca013b73affa38
Fix FindByChildContentStrategy
YevgeniyShunevych/Atata,atata-framework/atata,YevgeniyShunevych/Atata,atata-framework/atata
src/Atata/ScopeSearch/Strategies/FindByChildContentStrategy.cs
src/Atata/ScopeSearch/Strategies/FindByChildContentStrategy.cs
using System.Text; namespace Atata { public class FindByChildContentStrategy : XPathComponentScopeLocateStrategy { private readonly int childIndex; public FindByChildContentStrategy(int childIndex) { this.childIndex = childIndex; } protected override void BuildXPath(StringBuilder builder, ComponentScopeLocateOptions options) { builder.AppendFormat( "[*[{0}][{1}]]", childIndex + 1, options.GetTermsXPathCondition()); } } }
using System.Text; namespace Atata { public class FindByChildContentStrategy : XPathComponentScopeLocateStrategy { private readonly int childIndex; public FindByChildContentStrategy(int childIndex) { this.childIndex = childIndex; } protected override void BuildXPath(StringBuilder builder, ComponentScopeLocateOptions options) { builder.AppendFormat( "/*[{0}][{1}]", childIndex, options.GetTermsXPathCondition()); } } }
apache-2.0
C#
f28c2d2fd049757eae2d353f1f14b474c7c34e86
Fix documentation typo.
brendankowitz/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,Azure/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,Azure/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk
src/Microsoft.WindowsAzure.Jobs/NoAutomaticTriggerAttribute.cs
src/Microsoft.WindowsAzure.Jobs/NoAutomaticTriggerAttribute.cs
using System; namespace Microsoft.WindowsAzure.Jobs { /// <summary> /// Represents an attribute that is used to indicate that the JobHost should not listen to /// this method. This can be useful to avoid the performance impact of listening on a large container /// or to avoid inadvertent triggering of the function. /// The method can be invoked explicitly using the Call method on the JobHost. /// </summary> [AttributeUsage(AttributeTargets.Method)] public class NoAutomaticTriggerAttribute : Attribute { /// <summary> /// Initializes a new instance of the NoAutomaticTriggerAttribute class. /// </summary> public NoAutomaticTriggerAttribute() { } } }
using System; namespace Microsoft.WindowsAzure.Jobs { /// <summary> /// Represents an attribute that is used to indicate that the JobHost should not listen to /// this method. This can be useful to avoid the performance impact of listening on a large container /// or to avoid inadvertant triggering of the function. /// The method can be invoked explicitly using the Call method on the JobHost. /// </summary> [AttributeUsage(AttributeTargets.Method)] public class NoAutomaticTriggerAttribute : Attribute { /// <summary> /// Initializes a new instance of the NoAutomaticTriggerAttribute class. /// </summary> public NoAutomaticTriggerAttribute() { } } }
mit
C#
132ccee3988a296ffdba3406d8c05343f5f36f35
Revert "reImplemetn getToken request to use JSON"
dfensgmbh/biz.dfch.CS.CoffeeTracker
src/biz.dfch.CS.CoffeeTracker.Client/AuthenticationHelper.cs
src/biz.dfch.CS.CoffeeTracker.Client/AuthenticationHelper.cs
/** * Copyright 2017 d-fens GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; using System.Net; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace biz.dfch.CS.CoffeeTracker.Client.Tests { public class AuthenticationHelper { public string bearerToken = ""; public Uri tokenUri; private static readonly HttpClient client = new HttpClient(); public AuthenticationHelper(Uri hostUri, string username, string password) { Contract.Requires(null != hostUri); var tokenUriStr = string.Format("{0}{1}", hostUri.AbsoluteUri, "token"); this.tokenUri = new Uri(tokenUriStr); } public async Task ReceiveAndSetToken(string userName, string password) { var bodyValuesDictionary = new Dictionary<string, string> { { "Name", userName}, { "Password", password}, { "grant_type", "password"} }; var body = new FormUrlEncodedContent(bodyValuesDictionary); var response = await client.PostAsync(tokenUri, body); Contract.Assert(HttpStatusCode.BadGateway != response.StatusCode); Contract.Assert(HttpStatusCode.BadRequest != response.StatusCode); var responseString = await response.Content.ReadAsStringAsync(); int i = 0; } } }
/** * Copyright 2017 d-fens GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Runtime.Serialization.Json; using System.Text; using System.Threading.Tasks; namespace biz.dfch.CS.CoffeeTracker.Client.Tests { public class AuthenticationHelper { public string bearerToken = ""; public Uri tokenUri; private static readonly HttpClient client = new HttpClient(); public AuthenticationHelper(Uri hostUri, string username, string password) { Contract.Requires(null != hostUri); var tokenUriStr = string.Format("{0}{1}", hostUri.AbsoluteUri, "token"); this.tokenUri = new Uri(tokenUriStr); } public async Task ReceiveAndSetToken(string userName, string password) { // Arrange client for token request client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json"); var bodyValuesDictionary = new Dictionary<string, string> { { "Name", userName}, { "Password", password}, { "grant_type", "password"} }; var body = new FormUrlEncodedContent(bodyValuesDictionary); var response = await client.PostAsync(tokenUri, body); Contract.Assert(HttpStatusCode.BadGateway != response.StatusCode); Contract.Assert(HttpStatusCode.BadRequest != response.StatusCode); var responseString = await response.Content.ReadAsStringAsync(); int i = 0; } } }
apache-2.0
C#
69afefa78848bc9258662646cd5433cf52a505a1
Change Version string from 0.5.11 to 0.6.0 for release.
ft-/opensim-optimizations-wip,ft-/arribasim-dev-tests,M-O-S-E-S/opensim,AlphaStaxLLC/taiga,bravelittlescientist/opensim-performance,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,Michelle-Argus/ArribasimExtract,bravelittlescientist/opensim-performance,justinccdev/opensim,OpenSimian/opensimulator,ft-/opensim-optimizations-wip-tests,justinccdev/opensim,zekizeki/agentservice,ft-/opensim-optimizations-wip-tests,allquixotic/opensim-autobackup,Michelle-Argus/ArribasimExtract,QuillLittlefeather/opensim-1,AlphaStaxLLC/taiga,bravelittlescientist/opensim-performance,M-O-S-E-S/opensim,QuillLittlefeather/opensim-1,ft-/arribasim-dev-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,OpenSimian/opensimulator,QuillLittlefeather/opensim-1,M-O-S-E-S/opensim,allquixotic/opensim-autobackup,cdbean/CySim,justinccdev/opensim,rryk/omp-server,rryk/omp-server,cdbean/CySim,justinccdev/opensim,rryk/omp-server,ft-/arribasim-dev-extras,zekizeki/agentservice,OpenSimian/opensimulator,ft-/arribasim-dev-tests,justinccdev/opensim,TomDataworks/opensim,intari/OpenSimMirror,M-O-S-E-S/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,zekizeki/agentservice,BogusCurry/arribasim-dev,rryk/omp-server,justinccdev/opensim,AlexRa/opensim-mods-Alex,RavenB/opensim,AlphaStaxLLC/taiga,TomDataworks/opensim,Michelle-Argus/ArribasimExtract,RavenB/opensim,AlexRa/opensim-mods-Alex,ft-/arribasim-dev-extras,AlphaStaxLLC/taiga,allquixotic/opensim-autobackup,bravelittlescientist/opensim-performance,TomDataworks/opensim,allquixotic/opensim-autobackup,TomDataworks/opensim,intari/OpenSimMirror,ft-/arribasim-dev-extras,allquixotic/opensim-autobackup,AlphaStaxLLC/taiga,N3X15/VoxelSim,QuillLittlefeather/opensim-1,Michelle-Argus/ArribasimExtract,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip-extras,OpenSimian/opensimulator,N3X15/VoxelSim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,AlphaStaxLLC/taiga,RavenB/opensim,N3X15/VoxelSim,N3X15/VoxelSim,ft-/arribasim-dev-tests,zekizeki/agentservice,ft-/opensim-optimizations-wip,ft-/opensim-optimizations-wip-tests,BogusCurry/arribasim-dev,BogusCurry/arribasim-dev,ft-/opensim-optimizations-wip,AlphaStaxLLC/taiga,ft-/arribasim-dev-tests,M-O-S-E-S/opensim,OpenSimian/opensimulator,N3X15/VoxelSim,ft-/opensim-optimizations-wip-tests,TomDataworks/opensim,TechplexEngineer/Aurora-Sim,BogusCurry/arribasim-dev,M-O-S-E-S/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,bravelittlescientist/opensim-performance,AlphaStaxLLC/taiga,OpenSimian/opensimulator,AlexRa/opensim-mods-Alex,RavenB/opensim,intari/OpenSimMirror,TechplexEngineer/Aurora-Sim,OpenSimian/opensimulator,intari/OpenSimMirror,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-tests,AlexRa/opensim-mods-Alex,M-O-S-E-S/opensim,allquixotic/opensim-autobackup,ft-/opensim-optimizations-wip-extras,Michelle-Argus/ArribasimExtract,rryk/omp-server,cdbean/CySim,BogusCurry/arribasim-dev,ft-/opensim-optimizations-wip-extras,AlexRa/opensim-mods-Alex,bravelittlescientist/opensim-performance,cdbean/CySim,intari/OpenSimMirror,ft-/opensim-optimizations-wip,N3X15/VoxelSim,zekizeki/agentservice,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip-extras,N3X15/VoxelSim,TomDataworks/opensim,rryk/omp-server,ft-/opensim-optimizations-wip-tests,intari/OpenSimMirror,RavenB/opensim,zekizeki/agentservice,RavenB/opensim,QuillLittlefeather/opensim-1,cdbean/CySim,ft-/arribasim-dev-tests,QuillLittlefeather/opensim-1,cdbean/CySim,AlexRa/opensim-mods-Alex,N3X15/VoxelSim,QuillLittlefeather/opensim-1,BogusCurry/arribasim-dev,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TechplexEngineer/Aurora-Sim,Michelle-Argus/ArribasimExtract,TechplexEngineer/Aurora-Sim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TomDataworks/opensim
OpenSim/Framework/Servers/VersionInfo.cs
OpenSim/Framework/Servers/VersionInfo.cs
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSim Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace OpenSim { /// <summary> /// This is the OpenSim version string. Change this if you are releasing a new OpenSim version. /// </summary> public class VersionInfo { public readonly static string Version = "OpenSimulator Server 0.6.0"; // stay with 27 chars (used in regioninfo) } }
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSim Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace OpenSim { /// <summary> /// This is the OpenSim version string. Change this if you are releasing a new OpenSim version. /// </summary> public class VersionInfo { public readonly static string Version = "OpenSimulator Server 0.5.11"; // stay with 27 chars (used in regioninfo) } }
bsd-3-clause
C#
cf5378d1c11f3bf0d053eb46ebf02035a8c24aeb
Add SourceRange::Position():SourceRange method
jcracknell/emd,jcracknell/emd
cs/src/pegleg.cs/Parsing/SourceRange.cs
cs/src/pegleg.cs/Parsing/SourceRange.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace pegleg.cs.Parsing { public class SourceRange { public readonly int Index; public readonly int Line; public readonly int LineIndex; public readonly int Length; public SourceRange(int index, int length, int line, int lineIndex) { if(!(index >= 0)) throw ExceptionBecause.Argument(() => index, "must be a non-negative integer"); if(!(length >= 0)) throw ExceptionBecause.Argument(() => length, "must be non-negative integer"); if(!(line >= 1)) throw ExceptionBecause.Argument(() => line, "must be a positive integer"); if(!(lineIndex >= 0)) throw ExceptionBecause.Argument(() => lineIndex, "must be a non-negative integer"); if(!(lineIndex <= index)) throw ExceptionBecause.Argument(() => lineIndex, "must be less than index"); Index = index; Line = line; LineIndex = lineIndex; Length = length; } /// <summary> /// Calculate a new <see cref="SourceRange"/> starting at this value and extending through the provided <see cref="end"/> range. /// </summary> /// <param name="end">The ending <see cref="SourceRange"/> used to calculate the extent of the resulting <see cref="SourceRange"/>.</param> /// <returns>A new <see cref="SourceRange"/> at the current value's position extending throught the provided <paramref name="end"/>.</returns> public SourceRange Through(SourceRange end) { return new SourceRange(Index, end.Index - Index + end.Length, Line, LineIndex); } /// <summary> /// Create a new <see cref="SourceRange"/> at the position of the current value with length 0. /// </summary> /// <returns>A new <see cref="SourceRange"/> at the position of the current value with length 0.</returns> public SourceRange Position() { return new SourceRange(Index, 0, Line, LineIndex); } public override int GetHashCode() { return ((Index << 16) | (Index >> 16)) ^ Length ^ (Line << 16) ^ (LineIndex << 8); } public override bool Equals(object obj) { var other = obj as SourceRange; return null != other && this.Index == other.Index && this.Length == other.Length && this.Line == other.Line && this.LineIndex == other.LineIndex; } public override string ToString() { return string.Concat("{ Index: ", Index, ", Length: ", Length, ", Line: ", Line, ", LineIndex: ", LineIndex, " }"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace pegleg.cs.Parsing { public class SourceRange { public readonly int Index; public readonly int Line; public readonly int LineIndex; public readonly int Length; public SourceRange(int index, int length, int line, int lineIndex) { if(!(index >= 0)) throw ExceptionBecause.Argument(() => index, "must be a non-negative integer"); if(!(length >= 0)) throw ExceptionBecause.Argument(() => length, "must be non-negative integer"); if(!(line >= 1)) throw ExceptionBecause.Argument(() => line, "must be a positive integer"); if(!(lineIndex >= 0)) throw ExceptionBecause.Argument(() => lineIndex, "must be a non-negative integer"); if(!(lineIndex <= index)) throw ExceptionBecause.Argument(() => lineIndex, "must be less than index"); Index = index; Line = line; LineIndex = lineIndex; Length = length; } /// <summary> /// Calculate a new <see cref="SourceRange"/> starting at this value and extending through the provided <see cref="end"/> range. /// </summary> /// <param name="end">The ending <see cref="SourceRange"/> used to calculate the extent of the resulting <see cref="SourceRange"/>.</param> /// <returns>A new <see cref="SourceRange"/> at the current value's position extending throught the provided <paramref name="end"/>.</returns> public SourceRange Through(SourceRange end) { return new SourceRange(Index, end.Index - Index + end.Length, Line, LineIndex); } public override int GetHashCode() { return ((Index << 16) | (Index >> 16)) ^ Length ^ (Line << 16) ^ (LineIndex << 8); } public override bool Equals(object obj) { var other = obj as SourceRange; return null != other && this.Index == other.Index && this.Length == other.Length && this.Line == other.Line && this.LineIndex == other.LineIndex; } public override string ToString() { return string.Concat("{ Index: ", Index, ", Length: ", Length, ", Line: ", Line, ", LineIndex: ", LineIndex, " }"); } } }
mit
C#
1a1c15f3d63a8ed57ae147806d40ea268d9ac2f4
Raise version number.
City-of-Helsinki/organisaatiorekisteri,City-of-Helsinki/organisaatiorekisteri,City-of-Helsinki/palvelutietovaranto,City-of-Helsinki/palvelutietovaranto,City-of-Helsinki/palvelutietovaranto,City-of-Helsinki/palvelutietovaranto,City-of-Helsinki/organisaatiorekisteri,City-of-Helsinki/organisaatiorekisteri
Source/SharedFiles/SharedAssemblyInfo.cs
Source/SharedFiles/SharedAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyProduct("Palvelutietovaranto")] [assembly: AssemblyVersion("0.14.0.0")] [assembly: AssemblyFileVersion("0.14.0.0")] [assembly: AssemblyInformationalVersion("0.14.0")]
using System.Reflection; [assembly: AssemblyProduct("Palvelutietovaranto")] [assembly: AssemblyVersion("0.13.0.0")] [assembly: AssemblyFileVersion("0.13.0.0")] [assembly: AssemblyInformationalVersion("0.13.0")]
mit
C#
0c5714fe1efd54fdcf36ec4152b881c0b6e8ec12
Refactor JsonSection
atata-framework/atata-configuration-json
src/Atata.Configuration.Json/JsonSection.cs
src/Atata.Configuration.Json/JsonSection.cs
using System; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Atata { public class JsonSection { [JsonExtensionData] public Dictionary<string, JToken> AdditionalProperties { get; } = new Dictionary<string, JToken>(); public Dictionary<string, object> ExtraPropertiesMap => AdditionalProperties?.ToDictionary(x => x.Key, x => ConvertJToken(x.Value)); private static object ConvertJToken(JToken token) { switch (token.Type) { case JTokenType.None: case JTokenType.Null: case JTokenType.Undefined: return null; case JTokenType.Integer: return (int)token; case JTokenType.Float: return (double)token; case JTokenType.Boolean: return (bool)token; case JTokenType.TimeSpan: return (TimeSpan)token; default: return (string)token; } } } }
using System; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Atata { public class JsonSection { [JsonExtensionData] public Dictionary<string, JToken> AdditionalProperties { get; } = new Dictionary<string, JToken>(); public Dictionary<string, object> ExtraPropertiesMap => AdditionalProperties?.ToDictionary(x => x.Key, x => ConvertJToken(x.Value)); private static object ConvertJToken(JToken token) { switch (token.Type) { case JTokenType.None: case JTokenType.Null: case JTokenType.Undefined: return null; case JTokenType.Integer: return (int)token; case JTokenType.Float: return (double)token; case JTokenType.Boolean: return (bool)token; case JTokenType.TimeSpan: return (TimeSpan)token; default: return (string)token; } } public T Get<T>(string propertyName) { string normalizedPropertyName = propertyName.ToString(TermCase.Camel); JToken token; return AdditionalProperties.TryGetValue(normalizedPropertyName, out token) || AdditionalProperties.TryGetValue(propertyName, out token) ? token.ToObject<T>() : default(T); } } }
apache-2.0
C#
3eec35188f2bb6b4409c57de1daa14734edfa779
Fix compiler error
dermeister0/InheritdocTest
src/InheritdocTest/AnotherNumberProvider.cs
src/InheritdocTest/AnotherNumberProvider.cs
using Domain; using System.Collections.Generic; namespace InheritdocTest { /// <summary> /// Number provider. /// </summary> public class AnotherNumberProvider : IAnotherValueProvider { /// <inheritdoc /> public int GetValue() { return 42; } /// <inheritdoc /> public IEnumerable<int> GetValues() { yield return 1; yield return 2; yield return 3; } } }
using System.Collections.Generic; namespace InheritdocTest { /// <summary> /// Number provider. /// </summary> public class AnotherNumberProvider : IAnotherValueProvider { /// <inheritdoc /> public int GetValue() { return 42; } /// <inheritdoc /> public IEnumerable<int> GetValues() { yield return 1; yield return 2; yield return 3; } } }
mit
C#
1915fac43e3018874b114d97855576f341e2c319
delete dettaglio tipologia
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
src/backend/SO115App.Persistence.MongoDB/GestioneDettaglioTipologia/DeleteDettaglioTipologia.cs
src/backend/SO115App.Persistence.MongoDB/GestioneDettaglioTipologia/DeleteDettaglioTipologia.cs
using MongoDB.Driver; using Persistence.MongoDB; using SO115App.Models.Classi.Condivise; using SO115App.Models.Classi.Pos; using SO115App.Models.Classi.Triage; using SO115App.Models.Servizi.Infrastruttura.GestioneDettaglioTipologie; using System.Collections.Generic; using System.Linq; namespace SO115App.Persistence.MongoDB.GestioneDettaglioTipologia { public class DeleteDettaglioTipologia : IDeleteDettaglioTipologia { private readonly DbContext _dbContext; public DeleteDettaglioTipologia(DbContext dbContext) { _dbContext = dbContext; } public void Delete(int CodDettaglioTipologia) { _dbContext.TipologiaDettaglioCollection.DeleteOne(Builders<TipologiaDettaglio>.Filter.Eq(x => x.CodiceDettaglioTipologia, CodDettaglioTipologia)); var values = new List<int>() { CodDettaglioTipologia }; var listaPos = _dbContext.DtoPosCollection.Find(p => p.ListaTipologie.Any(t => t.CodTipologiaDettaglio.Any(td => td.Equals(CodDettaglioTipologia)))).ToList(); var listaIdPos = listaPos.Select(s => s.Id); foreach (var pos in listaPos) { var nuovaAssociazione = pos.ListaTipologie.Where(t => !t.CodTipologiaDettaglio.Contains(CodDettaglioTipologia)).ToList(); if(nuovaAssociazione.Count == 0) { _dbContext.DtoPosCollection.DeleteOne(p => p.Id.Equals(pos.Id)); } else { pos.ListaTipologie = nuovaAssociazione; //UPDATE POS _dbContext.DtoPosCollection.DeleteOne(p => p.Id.Equals(pos.Id)); _dbContext.DtoPosCollection.InsertOne(pos); } } //ELIMINO TRIAGE _dbContext.TriageCollection.DeleteOne(Builders<Triage>.Filter.Eq(x => x.CodDettaglioTipologia, CodDettaglioTipologia)); _dbContext.TriageDataCollection.DeleteOne(Builders<TriageData>.Filter.Eq(x => x.CodDettaglioTipologia, CodDettaglioTipologia)); } } }
using MongoDB.Driver; using Persistence.MongoDB; using SO115App.Models.Classi.Condivise; using SO115App.Models.Classi.Triage; using SO115App.Models.Servizi.Infrastruttura.GestioneDettaglioTipologie; using System.Collections.Generic; using System.Linq; namespace SO115App.Persistence.MongoDB.GestioneDettaglioTipologia { public class DeleteDettaglioTipologia : IDeleteDettaglioTipologia { private readonly DbContext _dbContext; public DeleteDettaglioTipologia(DbContext dbContext) { _dbContext = dbContext; } public void Delete(int CodDettaglioTipologia) { _dbContext.TipologiaDettaglioCollection.DeleteOne(Builders<TipologiaDettaglio>.Filter.Eq(x => x.CodiceDettaglioTipologia, CodDettaglioTipologia)); var values = new List<int>() { CodDettaglioTipologia }; var listaPos = _dbContext.DtoPosCollection.Find(p => p.ListaTipologie.Any(t => t.CodTipologiaDettaglio.Any(td => td.Equals(CodDettaglioTipologia)))).ToList(); var filtro = listaPos.Select(s => s.Id).ToList(); foreach (var pos in listaPos) { pos.ListaTipologie = pos.ListaTipologie.Where(t => !t.CodTipologiaDettaglio.Contains(CodDettaglioTipologia)).ToList(); } _dbContext.DtoPosCollection.DeleteMany(p => filtro.Contains(p.Id)); _dbContext.DtoPosCollection.InsertMany(listaPos.AsEnumerable()); //ELIMINO TRIAGE _dbContext.TriageCollection.DeleteOne(Builders<Triage>.Filter.Eq(x => x.CodDettaglioTipologia, CodDettaglioTipologia)); _dbContext.TriageDataCollection.DeleteOne(Builders<TriageData>.Filter.Eq(x => x.CodDettaglioTipologia, CodDettaglioTipologia)); } } }
agpl-3.0
C#
feec1626d6ac99287e3313e1673015cb74cd2fd3
Update description in AssemblyInfo.cs
MarcelMalik/Fluent-Xamarin-Forms
src/FluentXamarinForms/Properties/AssemblyInfo.cs
src/FluentXamarinForms/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle ("FluentXamarinForms")] [assembly: AssemblyDescription ("Fluent API for Xamarin.Forms")] [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("Marcel E. Malik")] [assembly: AssemblyProduct ("FluentXamarinForms")] [assembly: AssemblyCopyright ("Marcel E. Malik")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion ("1.0.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle ("FluentXamarinForms")] [assembly: AssemblyDescription ("")] [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("einmalik")] [assembly: AssemblyProduct ("")] [assembly: AssemblyCopyright ("Marcel Malik")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion ("1.0.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
mit
C#
279ee6b8b43f7936ee157840fe26a8af07ecbb5a
Remove TralusModule from Requierd Module Types in TralusWinModule
mehrandvd/Tralus,mehrandvd/Tralus
Framework/Source/Tralus.Framework.Module.Win/TralusWinModule.cs
Framework/Source/Tralus.Framework.Module.Win/TralusWinModule.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DevExpress.ExpressApp; using DevExpress.ExpressApp.DC; using DevExpress.ExpressApp.Model; using DevExpress.ExpressApp.Model.Core; using Tralus.Framework.BusinessModel.Utility; namespace Tralus.Framework.Module.Win { public class TralusWinModule : TralusModule { protected TralusWinModule() { if (!(this is FrameworkWindowsFormsModule)) { this.RequiredModuleTypes.Add(typeof(FrameworkWindowsFormsModule)); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DevExpress.ExpressApp; using DevExpress.ExpressApp.DC; using DevExpress.ExpressApp.Model; using DevExpress.ExpressApp.Model.Core; using Tralus.Framework.BusinessModel.Utility; namespace Tralus.Framework.Module.Win { public class TralusWinModule : TralusModule { protected TralusWinModule() { if (!(this is FrameworkWindowsFormsModule)) { this.RequiredModuleTypes.Add(typeof(TralusModule)); this.RequiredModuleTypes.Add(typeof(FrameworkWindowsFormsModule)); } } } }
apache-2.0
C#
ac9825d2bf70ae7a9ab1acd2abde34463a32acba
Fix line endings
nunit/nunit-vs-adapter,nunit/nunit3-vs-adapter
src/NUnitTestAdapterTests/Fakes/FakeRunContext.cs
src/NUnitTestAdapterTests/Fakes/FakeRunContext.cs
// **************************************************************** // Copyright (c) 2012 NUnit Software. All rights reserved. // **************************************************************** using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; namespace NUnit.VisualStudio.TestAdapter.Tests.Fakes { class FakeRunContext : IRunContext { #region IRunContext Members bool IRunContext.InIsolation { get { throw new NotImplementedException(); } } bool IRunContext.IsBeingDebugged { get { throw new NotImplementedException(); } } bool IRunContext.IsDataCollectionEnabled { get { throw new NotImplementedException(); } } bool IRunContext.KeepAlive { get { return true; } } string IRunContext.TestRunDirectory { get { throw new NotImplementedException(); } } ITestCaseFilterExpression IRunContext.GetTestCaseFilter(IEnumerable<string> supportedProperties, Func<string, TestProperty> propertyProvider) { return null; // as if we don't have a TFS Build, equal to testing from VS } #endregion #region IDiscoveryContextMembers IRunSettings IDiscoveryContext.RunSettings { get { throw new NotImplementedException(); } } #endregion public string SolutionDirectory { get { throw new NotImplementedException(); } } } }
// **************************************************************** // Copyright (c) 2012 NUnit Software. All rights reserved. // **************************************************************** using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; namespace NUnit.VisualStudio.TestAdapter.Tests.Fakes { class FakeRunContext : IRunContext { #region IRunContext Members bool IRunContext.InIsolation { get { throw new NotImplementedException(); } } bool IRunContext.IsBeingDebugged { get { throw new NotImplementedException(); } } bool IRunContext.IsDataCollectionEnabled { get { throw new NotImplementedException(); } } bool IRunContext.KeepAlive { get { return true; } } string IRunContext.TestRunDirectory { get { throw new NotImplementedException(); } } ITestCaseFilterExpression IRunContext.GetTestCaseFilter(IEnumerable<string> supportedProperties, Func<string, TestProperty> propertyProvider) { return null; // as if we don't have a TFS Build, equal to testing from VS } #endregion #region IDiscoveryContextMembers IRunSettings IDiscoveryContext.RunSettings { get { throw new NotImplementedException(); } } #endregion public string SolutionDirectory { get { throw new NotImplementedException(); } } } }
mit
C#
e5f499675470b69307e2e89a74bcd0db15c192bc
Add RoviService to CommsTransports enumeration
MiXTelematics/MiX.Integrate.Api.Client
MiX.Integrate.Shared/Entities/Communications/CommsTransports.cs
MiX.Integrate.Shared/Entities/Communications/CommsTransports.cs
namespace MiX.Integrate.Shared.Entities.Communications { public enum CommsTransports { Default = -1, None = 0, GSMDataCall = 1, GSMSMS = 2, GPRS = 3, DataTrak = 4, Config = 5, DECT = 6, LBS = 7, Datcom = 8, WLAN = 9, SatComms = 10, RoviService = 11 } }
namespace MiX.Integrate.Shared.Entities.Communications { public enum CommsTransports { Default = -1, None = 0, GSMDataCall = 1, GSMSMS = 2, GPRS = 3, DataTrak = 4, Config = 5, DECT = 6, LBS = 7, Datcom = 8, WLAN = 9, SatComms = 10 } }
mit
C#
eab8e1237aedc5c094dfed3e5ada44f3f5d86f84
Improve comment on Src/GoogleApis.Auth.Mvc4/OAuth2/Mvc/Filters/AuthActionFilter.cs
milkmeat/google-api-dotnet-client,LPAMNijoel/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,jtattermusch/google-api-dotnet-client,cdanielm58/google-api-dotnet-client,jtattermusch/google-api-dotnet-client,peleyal/google-api-dotnet-client,chenneo/google-api-dotnet-client,maha-khedr/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,jskeet/google-api-dotnet-client,hurcane/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,PiRSquared17/google-api-dotnet-client,googleapis/google-api-dotnet-client,ephraimncory/google-api-dotnet-client,jskeet/google-api-dotnet-client,line21c/google-api-dotnet-client,arjunRanosys/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,sawanmishra/google-api-dotnet-client,jesusog/google-api-dotnet-client,neil-119/google-api-dotnet-client,ErAmySharma/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,googleapis/google-api-dotnet-client,peleyal/google-api-dotnet-client,initaldk/google-api-dotnet-client,hoangduit/google-api-dotnet-client,sqt-android/google-api-dotnet-client,duongnhyt/google-api-dotnet-client,eshangin/google-api-dotnet-client,ajmal744/google-api-dotnet-client,mylemans/google-api-dotnet-client,jskeet/google-api-dotnet-client,smarly-net/google-api-dotnet-client,inetdream/google-api-dotnet-client,lli-klick/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,duongnhyt/google-api-dotnet-client,nicolasdavel/google-api-dotnet-client,googleapis/google-api-dotnet-client,peleyal/google-api-dotnet-client,initaldk/google-api-dotnet-client,initaldk/google-api-dotnet-client,shumaojie/google-api-dotnet-client,karishmal/google-api-dotnet-client,MyOwnClone/google-api-dotnet-client,amitla/google-api-dotnet-client,shumaojie/google-api-dotnet-client,kapil-chauhan-ngi/google-api-dotnet-client,kelvinRosa/google-api-dotnet-client,DJJam/google-api-dotnet-client,ajaypradeep/google-api-dotnet-client,hurcane/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,amnsinghl/google-api-dotnet-client,aoisensi/google-api-dotnet-client,Senthilvera/google-api-dotnet-client,mjacobsen4DFM/google-api-dotnet-client,hurcane/google-api-dotnet-client,LPAMNijoel/google-api-dotnet-client,bacm/google-api-dotnet-client,neil-119/google-api-dotnet-client,rburgstaler/google-api-dotnet-client,SimonAntony/google-api-dotnet-client,ssett/google-api-dotnet-client,eshivakant/google-api-dotnet-client,asifshaon/google-api-dotnet-client,duckhamqng/google-api-dotnet-client,amit-learning/google-api-dotnet-client,olofd/google-api-dotnet-client,liuqiaosz/google-api-dotnet-client,aoisensi/google-api-dotnet-client,pgallastegui/google-api-dotnet-client,RavindraPatidar/google-api-dotnet-client,abujehad139/google-api-dotnet-client,amitla/google-api-dotnet-client,joesoc/google-api-dotnet-client,eydjey/google-api-dotnet-client,hivie7510/google-api-dotnet-client,hurcane/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,MesutGULECYUZ/google-api-dotnet-client,kekewong/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,luantn2/google-api-dotnet-client
Src/GoogleApis.Auth.Mvc4/OAuth2/Mvc/Filters/AuthActionFilter.cs
Src/GoogleApis.Auth.Mvc4/OAuth2/Mvc/Filters/AuthActionFilter.cs
/* Copyright 2013 Google Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System.Web; using System.Web.Mvc; using Google.Apis.Auth.OAuth2.Responses; namespace Google.Apis.Auth.OAuth2.Mvc.Filters { /// <summary> /// An action filter which parses the query parameters into <seealso cref="AuthorizationCodeResponseUrl"/>. /// </summary> public class AuthorizationCodeActionFilter : ActionFilterAttribute, IActionFilter { /// <summary> /// Parses the request into <seealso cref="AuthorizationCodeResponseUrl"/>. /// </summary> public override void OnActionExecuting(ActionExecutingContext actionContext) { (actionContext.ActionParameters["authorizationCode"] as AuthorizationCodeResponseUrl) .ParseRequest(actionContext.RequestContext.HttpContext.Request); base.OnActionExecuting(actionContext); } } /// <summary>Auth extensions methods.</summary> public static class AuthExtensions { /// <summary>Parses the HTTP request query parameters into the Authorization code response.</summary> internal static void ParseRequest(this AuthorizationCodeResponseUrl authorizationCode, HttpRequestBase request) { var queryDic = HttpUtility.ParseQueryString(request.Url.Query); authorizationCode.Code = queryDic["code"]; authorizationCode.Error = queryDic["error"]; authorizationCode.ErrorDescription = queryDic["error_description"]; authorizationCode.ErrorUri = queryDic["error_uri"]; authorizationCode.State = queryDic["state"]; } } }
/* Copyright 2013 Google Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System.Web; using System.Web.Mvc; using Google.Apis.Auth.OAuth2.Responses; namespace Google.Apis.Auth.OAuth2.Mvc.Filters { /// <summary> /// An action filter which parses the query parameters into <seealso cref="AuthorizationCodeResponseUrl"/>. /// </summary> public class AuthorizationCodeActionFilter : ActionFilterAttribute, IActionFilter { /// <summary> /// Parses the request into <seealso cref="Google.Apis.Auth.OAuth2.Responses.AuthorizationCodeResponseUrl"/> /// </summary> public override void OnActionExecuting(ActionExecutingContext actionContext) { (actionContext.ActionParameters["authorizationCode"] as AuthorizationCodeResponseUrl) .ParseRequest(actionContext.RequestContext.HttpContext.Request); base.OnActionExecuting(actionContext); } } /// <summary>Auth extensions methods.</summary> public static class AuthExtensions { /// <summary>Parses the HTTP request query parameters into the Authorization code response.</summary> internal static void ParseRequest(this AuthorizationCodeResponseUrl authorizationCode, HttpRequestBase request) { var queryDic = HttpUtility.ParseQueryString(request.Url.Query); authorizationCode.Code = queryDic["code"]; authorizationCode.Error = queryDic["error"]; authorizationCode.ErrorDescription = queryDic["error_description"]; authorizationCode.ErrorUri = queryDic["error_uri"]; authorizationCode.State = queryDic["state"]; } } }
apache-2.0
C#
e536f1ad6d3bd1d00968eeddba4997ebda85218c
Add simple locking of resourceManagers dictionary for thread safety
UselessToucan/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,peppy/osu,smoogipoo/osu,ppy/osu
osu.Game/Localisation/ResourceManagerLocalisationStore.cs
osu.Game/Localisation/ResourceManagerLocalisationStore.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Resources; using System.Threading.Tasks; using osu.Framework.Localisation; namespace osu.Game.Localisation { public class ResourceManagerLocalisationStore : ILocalisationStore { private readonly Dictionary<string, ResourceManager> resourceManagers = new Dictionary<string, ResourceManager>(); public ResourceManagerLocalisationStore(string cultureCode) { EffectiveCulture = new CultureInfo(cultureCode); } public void Dispose() { } public string Get(string lookup) { var split = lookup.Split(':'); string ns = split[0]; string key = split[1]; lock (resourceManagers) { if (!resourceManagers.TryGetValue(ns, out var manager)) resourceManagers[ns] = manager = new ResourceManager(ns, GetType().Assembly); try { return manager.GetString(key, EffectiveCulture); } catch (MissingManifestResourceException) { // in the case the manifest is missing, it is likely that the user is adding code-first implementations of new localisation namespaces. // it's fine to ignore this as localisation will fallback to default values. return null; } } } public Task<string> GetAsync(string lookup) { return Task.FromResult(Get(lookup)); } public Stream GetStream(string name) { throw new NotImplementedException(); } public IEnumerable<string> GetAvailableResources() { throw new NotImplementedException(); } public CultureInfo EffectiveCulture { get; } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Resources; using System.Threading.Tasks; using osu.Framework.Localisation; namespace osu.Game.Localisation { public class ResourceManagerLocalisationStore : ILocalisationStore { private readonly Dictionary<string, ResourceManager> resourceManagers = new Dictionary<string, ResourceManager>(); public ResourceManagerLocalisationStore(string cultureCode) { EffectiveCulture = new CultureInfo(cultureCode); } public void Dispose() { } public string Get(string lookup) { var split = lookup.Split(':'); string ns = split[0]; string key = split[1]; if (!resourceManagers.TryGetValue(ns, out var manager)) resourceManagers[ns] = manager = new ResourceManager(ns, GetType().Assembly); try { return manager.GetString(key, EffectiveCulture); } catch (MissingManifestResourceException) { // in the case the manifest is missing, it is likely that the user is adding code-first implementations of new localisation namespaces. // it's fine to ignore this as localisation will fallback to default values. return null; } } public Task<string> GetAsync(string lookup) { return Task.FromResult(Get(lookup)); } public Stream GetStream(string name) { throw new NotImplementedException(); } public IEnumerable<string> GetAvailableResources() { throw new NotImplementedException(); } public CultureInfo EffectiveCulture { get; } } }
mit
C#
78c82b740bb646ab0c794b62c710ae741bc032bd
Update Program.cs
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Program.cs
Battery-Commander.Web/Program.cs
using Microsoft.AspNetCore.Hosting; using Sentry; using Serilog; using System.IO; namespace BatteryCommander.Web { public class Program { public static void Main(string[] args) { using (SentrySdk.Init("https://[email protected]/1447369")) { var host = new WebHostBuilder() .UseApplicationInsights() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .UseSerilog((h, context) => { context .Enrich.FromLogContext() .WriteTo.Sentry(); }) .Build(); host.Run(); } } } }
using Microsoft.AspNetCore.Hosting; using Sentry; using Serilog; using System.IO; namespace BatteryCommander.Web { public class Program { public static void Main(string[] args) { using (SentrySdk.Init("https://[email protected]/1447369")) { var host = new WebHostBuilder() .UseApplicationInsights() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .UseSentry() .UseSerilog((h, context) => { context .Enrich.FromLogContext() .WriteTo.Sentry(); }) .Build(); host.Run(); } } } }
mit
C#
031f7d225be7d6690243aa005d7ddfe09394ca2c
Fix build failure under mono
klightspeed/EDDiscovery,andreaspada/EDDiscovery,klightspeed/EDDiscovery,andreaspada/EDDiscovery,klightspeed/EDDiscovery,EDDiscovery/EDDiscovery,EDDiscovery/EDDiscovery,EDDiscovery/EDDiscovery
EDDiscovery/Export/ExportBase.cs
EDDiscovery/Export/ExportBase.cs
using EDDiscovery.EliteDangerous; using System; using System.Collections.Generic; using System.Data.SqlTypes; using System.Globalization; using System.Linq; using System.Text; namespace EDDiscovery.Export { public enum CSVFormat { USA_UK = 0, EU = 1, } public abstract class ExportBase { protected string delimiter = ","; protected CultureInfo formatculture; private CSVFormat csvformat; public CSVFormat Csvformat { get { return csvformat; } set { csvformat = value; if (csvformat == CSVFormat.EU) { delimiter = ";"; formatculture = new System.Globalization.CultureInfo("sv"); } else { delimiter = ","; formatculture = new System.Globalization.CultureInfo("en-US"); } } } abstract public bool ToCSV(string filename); abstract public bool GetData(EDDiscoveryForm _discoveryForm); protected string MakeValueCsvFriendly(object value) { if (value == null) return delimiter; if (value is INullable && ((INullable)value).IsNull) return delimiter; if (value is DateTime) { if (((DateTime)value).TimeOfDay.TotalSeconds == 0) return ((DateTime)value).ToString("yyyy-MM-dd") + delimiter; ; return ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss") + delimiter; ; } string output = value.ToString(); if (output.Contains(",") || output.Contains("\"")) output = '"' + output.Replace("\"", "\"\"") + '"'; return output + delimiter; } } }
using EDDiscovery.EliteDangerous; using System; using System.Collections.Generic; using System.Data.SqlTypes; using System.Globalization; using System.Linq; using System.Text; namespace EDDiscovery.Export { public enum CSVFormat { USA_UK = 0, EU = 1, } public abstract class ExportBase { protected string delimiter = ","; protected CultureInfo formatculture; private CSVFormat csvformat; public CSVFormat Csvformat { get { return csvformat; } set { csvformat = value; if (csvformat == CSVFormat.EU) { delimiter = ";"; formatculture = new System.Globalization.CultureInfo("sv"); } else { delimiter = ","; formatculture = new System.Globalization.CultureInfo("en-US"); } } } abstract public bool ToCSV(string filename); abstract public bool GetData(EDDiscoveryForm _discoveryForm); protected string MakeValueCsvFriendly(object value) { if (value == null) return delimiter; if (value is Nullable && ((INullable)value).IsNull) return delimiter; if (value is DateTime) { if (((DateTime)value).TimeOfDay.TotalSeconds == 0) return ((DateTime)value).ToString("yyyy-MM-dd") + delimiter; ; return ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss") + delimiter; ; } string output = value.ToString(); if (output.Contains(",") || output.Contains("\"")) output = '"' + output.Replace("\"", "\"\"") + '"'; return output + delimiter; } } }
apache-2.0
C#
869f1f61da286c96f69190219a66f347f113adb3
Fix map format expression serializer throws ArgumentNullException when there are missing members.
undeadlabs/msgpack-cli,scopely/msgpack-cli,modulexcite/msgpack-cli,msgpack/msgpack-cli,msgpack/msgpack-cli,modulexcite/msgpack-cli,undeadlabs/msgpack-cli,scopely/msgpack-cli
src/MsgPack/Serialization/ExpressionSerializers/MapFormatObjectExpressionMessagePackSerializer.cs
src/MsgPack/Serialization/ExpressionSerializers/MapFormatObjectExpressionMessagePackSerializer.cs
#region -- License Terms -- // // MessagePack for CLI // // Copyright (C) 2010-2012 FUJIWARA, Yusuke // // 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 -- License Terms -- using System.Collections.Generic; using System.Linq; using System.Reflection; namespace MsgPack.Serialization.ExpressionSerializers { /// <summary> /// <see cref="ObjectExpressionMessagePackSerializer{T}"/> for map format stream. /// </summary> /// <typeparam name="T">The type of target type.</typeparam> internal class MapFormatObjectExpressionMessagePackSerializer<T> : ObjectExpressionMessagePackSerializer<T> { public MapFormatObjectExpressionMessagePackSerializer( SerializationContext context, SerializingMember[] members ) : base( context, members ) { } protected internal override void PackToCore( Packer packer, T objectTree ) { packer.PackMapHeader( this.MemberSerializers.Length ); for ( int i = 0; i < this.MemberSerializers.Length; i++ ) { if( this.MemberNames[i]==null ) { // Skip missing member. continue; } packer.PackString( this.MemberNames[ i ] ); this.MemberSerializers[ i ].PackTo( packer, this.MemberGetters[ i ]( objectTree ) ); } } } }
#region -- License Terms -- // // MessagePack for CLI // // Copyright (C) 2010-2012 FUJIWARA, Yusuke // // 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 -- License Terms -- using System.Collections.Generic; using System.Linq; using System.Reflection; namespace MsgPack.Serialization.ExpressionSerializers { /// <summary> /// <see cref="ObjectExpressionMessagePackSerializer{T}"/> for map format stream. /// </summary> /// <typeparam name="T">The type of target type.</typeparam> internal class MapFormatObjectExpressionMessagePackSerializer<T> : ObjectExpressionMessagePackSerializer<T> { public MapFormatObjectExpressionMessagePackSerializer( SerializationContext context, SerializingMember[] members ) : base( context, members ) { } protected internal override void PackToCore( Packer packer, T objectTree ) { packer.PackMapHeader( this.MemberSerializers.Length ); for ( int i = 0; i < this.MemberSerializers.Length; i++ ) { packer.PackString( this.MemberNames[ i ] ); this.MemberSerializers[ i ].PackTo( packer, this.MemberGetters[ i ]( objectTree ) ); } } } }
apache-2.0
C#
670fff43cd307ee6976630ee2daabe33d031e217
Fix toggle colleciton inspector
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity
Assets/MixedRealityToolkit.SDK/Inspectors/UX/Interactable/InteractableToggleCollectionInspector.cs
Assets/MixedRealityToolkit.SDK/Inspectors/UX/Interactable/InteractableToggleCollectionInspector.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEditor; using UnityEngine; namespace Microsoft.MixedReality.Toolkit.UI.Editor { [CustomEditor(typeof(InteractableToggleCollection))] /// <summary> /// Custom inspector for InteractableToggleCollection /// </summary> internal class InteractableToggleCollectionInspector : UnityEditor.Editor { protected InteractableToggleCollection instance; protected SerializedProperty toggleListProperty; protected SerializedProperty currentIndexProperty; protected SerializedProperty onSelectionEventsProperty; protected virtual void OnEnable() { instance = (InteractableToggleCollection)target; toggleListProperty = serializedObject.FindProperty("toggleList"); currentIndexProperty = serializedObject.FindProperty("currentIndex"); onSelectionEventsProperty = serializedObject.FindProperty("OnSelectionEvents"); } public override void OnInspectorGUI() { RenderCustomInspector(); if (Application.isPlaying && instance != null && GUI.changed) { int currentIndex = instance.CurrentIndex; currentIndex = Mathf.Clamp(currentIndex, 0, instance.ToggleList.Length - 1); if (currentIndex >= instance.ToggleList.Length || currentIndex < 0) { Debug.Log("Index out of range: " + currentIndex); } else { instance.SetSelection(currentIndex, true, true); } } } public virtual void RenderCustomInspector() { serializedObject.Update(); // Disable ability to edit ToggleList through the inspector if in play mode bool isPlayMode = EditorApplication.isPlaying || EditorApplication.isPaused; using (new EditorGUI.DisabledScope(isPlayMode)) { EditorGUILayout.PropertyField(toggleListProperty, true); } EditorGUILayout.PropertyField(currentIndexProperty); EditorGUILayout.PropertyField(onSelectionEventsProperty); serializedObject.ApplyModifiedProperties(); } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using Microsoft.MixedReality.Toolkit.Input; using Microsoft.MixedReality.Toolkit.Utilities.Editor; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using UnityEditor; using UnityEngine; namespace Microsoft.MixedReality.Toolkit.UI.Editor { [CustomEditor(typeof(InteractableToggleCollection))] /// <summary> /// Custom inspector for InteractableToggleCollection /// </summary> internal class InteractableToggleCollectionInspector : UnityEditor.Editor { protected InteractableToggleCollection instance; protected SerializedProperty toggleListProperty; protected SerializedProperty currentIndexProperty; protected virtual void OnEnable() { instance = (InteractableToggleCollection)target; toggleListProperty = serializedObject.FindProperty("toggleList"); currentIndexProperty = serializedObject.FindProperty("currentIndex"); } public override void OnInspectorGUI() { RenderCustomInspector(); if (Application.isPlaying && instance != null && GUI.changed) { int currentIndex = instance.CurrentIndex; currentIndex = Mathf.Clamp(currentIndex, 0, instance.ToggleList.Length - 1); if (currentIndex >= instance.ToggleList.Length || currentIndex < 0) { Debug.Log("Index out of range: " + currentIndex); } else { instance.SetSelection(currentIndex, true, true); } } } public virtual void RenderCustomInspector() { serializedObject.Update(); // Disable ability to edit ToggleList through the inspector if in play mode bool isPlayMode = EditorApplication.isPlaying || EditorApplication.isPaused; using (new EditorGUI.DisabledScope(isPlayMode)) { EditorGUILayout.PropertyField(toggleListProperty, true); } EditorGUILayout.PropertyField(currentIndexProperty); serializedObject.ApplyModifiedProperties(); } } }
mit
C#
4ec1fcdddbde2a7e08ac6619b33c7a6321886c16
Enable NRT
dotnet/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,diryboy/roslyn,mavasani/roslyn,weltkante/roslyn,mavasani/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,sharwell/roslyn,diryboy/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,dotnet/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,weltkante/roslyn
src/Analyzers/CSharp/Analyzers/UseImplicitOrExplicitType/CSharpUseImplicitTypeDiagnosticAnalyzer.cs
src/Analyzers/CSharp/Analyzers/UseImplicitOrExplicitType/CSharpUseImplicitTypeDiagnosticAnalyzer.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 Microsoft.CodeAnalysis.CSharp.Utilities; using Microsoft.CodeAnalysis.Diagnostics; namespace Microsoft.CodeAnalysis.CSharp.Diagnostics.TypeStyle { [DiagnosticAnalyzer(LanguageNames.CSharp)] internal sealed class CSharpUseImplicitTypeDiagnosticAnalyzer : CSharpTypeStyleDiagnosticAnalyzerBase { private static readonly LocalizableString s_Title = new LocalizableResourceString(nameof(CSharpAnalyzersResources.Use_implicit_type), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)); private static readonly LocalizableString s_Message = new LocalizableResourceString(nameof(CSharpAnalyzersResources.use_var_instead_of_explicit_type), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)); protected override CSharpTypeStyleHelper Helper => CSharpUseImplicitTypeHelper.Instance; public CSharpUseImplicitTypeDiagnosticAnalyzer() : base(diagnosticId: IDEDiagnosticIds.UseImplicitTypeDiagnosticId, enforceOnBuild: EnforceOnBuildValues.UseImplicitType, title: s_Title, message: s_Message) { } } }
// 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 Microsoft.CodeAnalysis.CSharp.Utilities; using Microsoft.CodeAnalysis.Diagnostics; namespace Microsoft.CodeAnalysis.CSharp.Diagnostics.TypeStyle { [DiagnosticAnalyzer(LanguageNames.CSharp)] internal sealed class CSharpUseImplicitTypeDiagnosticAnalyzer : CSharpTypeStyleDiagnosticAnalyzerBase { private static readonly LocalizableString s_Title = new LocalizableResourceString(nameof(CSharpAnalyzersResources.Use_implicit_type), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)); private static readonly LocalizableString s_Message = new LocalizableResourceString(nameof(CSharpAnalyzersResources.use_var_instead_of_explicit_type), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)); protected override CSharpTypeStyleHelper Helper => CSharpUseImplicitTypeHelper.Instance; public CSharpUseImplicitTypeDiagnosticAnalyzer() : base(diagnosticId: IDEDiagnosticIds.UseImplicitTypeDiagnosticId, enforceOnBuild: EnforceOnBuildValues.UseImplicitType, title: s_Title, message: s_Message) { } } }
mit
C#
a74fbde9c5b757711a4c02d1c6338f4199df6f29
测试多租户OAuth #1550
jiehanlin/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,mc7246/WeiXinMPSDK,mc7246/WeiXinMPSDK,lishewen/WeiXinMPSDK,mc7246/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,lishewen/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,lishewen/WeiXinMPSDK
Samples/Senparc.Weixin.MP.Sample.vs2017/Senparc.Weixin.MP.CoreSample/Filters/CustomOAuthAttribute.cs
Samples/Senparc.Weixin.MP.Sample.vs2017/Senparc.Weixin.MP.CoreSample/Filters/CustomOAuthAttribute.cs
using System.Web; using Microsoft.AspNetCore.Http; using Senparc.CO2NET; using Senparc.CO2NET.Trace; using Senparc.Weixin.MP.MvcExtension; namespace Senparc.Weixin.MP.CoreSample.Filters { /// <summary> /// OAuth自动验证,可以加在Action或整个Controller上 /// </summary> public class CustomOAuthAttribute : SenparcOAuthAttribute { public CustomOAuthAttribute(string appId, string oauthCallbackUrl) : base(appId, oauthCallbackUrl) { base._appId = base._appId ?? Config.SenparcWeixinSetting.TenPayV3_AppId; //如果是多租户,也可以这样写: #if NETCOREAPP2_2 var httpContextAccessor = SenparcDI.GetService<IHttpContextAccessor>(); base._appId = httpContextAccessor.HttpContext.Request.Query["appId"]; SenparcTrace.SendCustomLog("SenparcOAuthAttribute 测试", httpContextAccessor.HttpContext.Request.Query["appId"]); #else base._appId = HttpContext.Current.Request.QueryString["appId"]; #endif } public override bool IsLogined(HttpContext httpContext) { return httpContext != null && httpContext.Session.GetString("OpenId") != null; //也可以使用其他方法如Session验证用户登录 //return httpContext != null && httpContext.User.Identity.IsAuthenticated; } } }
using System.Web; using Microsoft.AspNetCore.Http; using Senparc.Weixin.MP.MvcExtension; namespace Senparc.Weixin.MP.CoreSample.Filters { /// <summary> /// OAuth自动验证,可以加在Action或整个Controller上 /// </summary> public class CustomOAuthAttribute : SenparcOAuthAttribute { public CustomOAuthAttribute(string appId, string oauthCallbackUrl) : base(appId, oauthCallbackUrl) { base._appId = base._appId ?? Config.SenparcWeixinSetting.TenPayV3_AppId; } public override bool IsLogined(HttpContext httpContext) { return httpContext != null && httpContext.Session.GetString("OpenId") != null; //也可以使用其他方法如Session验证用户登录 //return httpContext != null && httpContext.User.Identity.IsAuthenticated; } } }
apache-2.0
C#
434377aa52300a5af7698733722f462196434840
Revert "Add failing test case"
ppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,NeoAdonis/osu,ppy/osu
osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs
osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] public class TestSceneCatchPlayerLegacySkin : LegacySkinPlayerTestScene { protected override Ruleset CreatePlayerRuleset() => new CatchRuleset(); } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Skinning.Legacy; using osu.Game.Skinning; using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] public class TestSceneCatchPlayerLegacySkin : LegacySkinPlayerTestScene { [Test] public void TestUsingLegacySkin() { // check for the existence of a random legacy component to ensure using legacy skin. // this should exist in LegacySkinPlayerTestScene but the weird transformer logic below needs to be "fixed" or otherwise first. AddAssert("using legacy skin", () => this.ChildrenOfType<LegacyScoreCounter>().Any()); } protected override Ruleset CreatePlayerRuleset() => new TestCatchRuleset(); private class TestCatchRuleset : CatchRuleset { public override ISkin CreateLegacySkinProvider(ISkinSource source, IBeatmap beatmap) => new TestCatchLegacySkinTransformer(source); } private class TestCatchLegacySkinTransformer : CatchLegacySkinTransformer { public TestCatchLegacySkinTransformer(ISkinSource source) : base(source) { } public override Drawable GetDrawableComponent(ISkinComponent component) { var drawable = base.GetDrawableComponent(component); if (drawable != null) return drawable; // it shouldn't really matter whether to return null or return this, // but returning null skips over the beatmap skin, so this needs to exist to test things properly. return Source.GetDrawableComponent(component); } } } }
mit
C#
1f14d9b690d39122cd89ef799429c12c7511e34e
Use correct width adjust for osu!catch playfield
peppy/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu-new,ppy/osu,ppy/osu
osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs
osu.Game.Rulesets.Catch/UI/CatchPlayfieldAdjustmentContainer.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Catch.UI { public class CatchPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer { private const float playfield_size_adjust = 0.8f; protected override Container<Drawable> Content => content; private readonly Container content; public CatchPlayfieldAdjustmentContainer() { Anchor = Anchor.TopCentre; Origin = Anchor.TopCentre; Size = new Vector2(playfield_size_adjust); InternalChild = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, FillAspectRatio = 4f / 3, Child = content = new ScalingContainer { RelativeSizeAxes = Axes.Both } }; } /// <summary> /// A <see cref="Container"/> which scales its content relative to a target width. /// </summary> private class ScalingContainer : Container { protected override void Update() { base.Update(); Scale = new Vector2(Parent.ChildSize.X / CatchPlayfield.WIDTH); Size = Vector2.Divide(Vector2.One, Scale); } } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.UI; using osuTK; namespace osu.Game.Rulesets.Catch.UI { public class CatchPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer { protected override Container<Drawable> Content => content; private readonly Container content; public CatchPlayfieldAdjustmentContainer() { Anchor = Anchor.TopCentre; Origin = Anchor.TopCentre; Size = new Vector2(0.86f); // matches stable's vertical offset for catcher plate InternalChild = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, FillAspectRatio = 4f / 3, Child = content = new ScalingContainer { RelativeSizeAxes = Axes.Both } }; } /// <summary> /// A <see cref="Container"/> which scales its content relative to a target width. /// </summary> private class ScalingContainer : Container { protected override void Update() { base.Update(); Scale = new Vector2(Parent.ChildSize.X / CatchPlayfield.WIDTH); Size = Vector2.Divide(Vector2.One, Scale); } } } }
mit
C#
bcc13991c5a140113f60fe90853c3d4c246bff0d
Make `InvocationShape`'s `arguments` parameter optional
Moq/moq4,ocoanet/moq4
src/Moq/InvocationShape.cs
src/Moq/InvocationShape.cs
// Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD. // All rights reserved. Licensed under the BSD 3-Clause License; see License.txt. using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; namespace Moq { /// <summary> /// Describes the "shape" of an invocation against which concrete <see cref="Invocation"/>s can be matched. /// </summary> internal readonly struct InvocationShape { private static readonly IReadOnlyList<Expression> noArguments = new Expression[0]; private static readonly IMatcher[] noArgumentMatchers = new IMatcher[0]; public readonly LambdaExpression Expression; public readonly MethodInfo Method; public readonly IReadOnlyList<Expression> Arguments; private readonly IMatcher[] argumentMatchers; public InvocationShape(LambdaExpression expression, MethodInfo method, IReadOnlyList<Expression> arguments = null) { this.Expression = expression; this.Method = method; this.Arguments = arguments ?? noArguments; this.argumentMatchers = arguments != null ? MatcherFactory.CreateMatchers(arguments, method.GetParameters()) : noArgumentMatchers; } public void Deconstruct(out LambdaExpression expression, out MethodInfo method, out IReadOnlyList<Expression> arguments) { expression = this.Expression; method = this.Method; arguments = this.Arguments; } public bool IsMatch(Invocation invocation) { var arguments = invocation.Arguments; if (this.argumentMatchers.Length != arguments.Length) { return false; } if (invocation.Method != this.Method && !this.IsOverride(invocation.Method)) { return false; } for (int i = 0, n = this.argumentMatchers.Length; i < n; ++i) { if (this.argumentMatchers[i].Matches(arguments[i]) == false) { return false; } } return true; } private bool IsOverride(MethodInfo invocationMethod) { var method = this.Method; if (!method.DeclaringType.IsAssignableFrom(invocationMethod.DeclaringType)) { return false; } if (!method.Name.Equals(invocationMethod.Name, StringComparison.Ordinal)) { return false; } if (method.ReturnType != invocationMethod.ReturnType) { return false; } if (method.IsGenericMethod || invocationMethod.IsGenericMethod) { if (!method.GetGenericArguments().CompareTo(invocationMethod.GetGenericArguments(), exact: false)) { return false; } } else { if (!invocationMethod.GetParameterTypes().CompareTo(method.GetParameterTypes(), exact: true)) { return false; } } return true; } } }
// Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD. // All rights reserved. Licensed under the BSD 3-Clause License; see License.txt. using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; namespace Moq { /// <summary> /// Describes the "shape" of an invocation against which concrete <see cref="Invocation"/>s can be matched. /// </summary> internal readonly struct InvocationShape { public readonly LambdaExpression Expression; public readonly MethodInfo Method; public readonly IReadOnlyList<Expression> Arguments; private readonly IMatcher[] argumentMatchers; public InvocationShape(LambdaExpression expression, MethodInfo method, IReadOnlyList<Expression> arguments) { this.Expression = expression; this.Method = method; this.Arguments = arguments; this.argumentMatchers = MatcherFactory.CreateMatchers(arguments, method.GetParameters()); } public void Deconstruct(out LambdaExpression expression, out MethodInfo method, out IReadOnlyList<Expression> arguments) { expression = this.Expression; method = this.Method; arguments = this.Arguments; } public bool IsMatch(Invocation invocation) { var arguments = invocation.Arguments; if (this.argumentMatchers.Length != arguments.Length) { return false; } if (invocation.Method != this.Method && !this.IsOverride(invocation.Method)) { return false; } for (int i = 0, n = this.argumentMatchers.Length; i < n; ++i) { if (this.argumentMatchers[i].Matches(arguments[i]) == false) { return false; } } return true; } private bool IsOverride(MethodInfo invocationMethod) { var method = this.Method; if (!method.DeclaringType.IsAssignableFrom(invocationMethod.DeclaringType)) { return false; } if (!method.Name.Equals(invocationMethod.Name, StringComparison.Ordinal)) { return false; } if (method.ReturnType != invocationMethod.ReturnType) { return false; } if (method.IsGenericMethod || invocationMethod.IsGenericMethod) { if (!method.GetGenericArguments().CompareTo(invocationMethod.GetGenericArguments(), exact: false)) { return false; } } else { if (!invocationMethod.GetParameterTypes().CompareTo(method.GetParameterTypes(), exact: true)) { return false; } } return true; } } }
bsd-3-clause
C#
1b69ab9ce669ed1196ea4c53434e02b8a02de0fb
Add basic log processing
theAprel/OptionsDisplay
OptionsDisplay/OptionsDisplay.cs
OptionsDisplay/OptionsDisplay.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OptionsDisplay { public class TagPrinter { private static LogWindow window; public static void Load() { window = new LogWindow(); window.Show(); Hearthstone_Deck_Tracker.API.LogEvents.OnPowerLogLine.Add(processPowerLogLine); } public static void processPowerLogLine(String line) { if(line.Contains("tag=NUM_OPTIONS ")) { String entity = line.Split("Entity=".ToCharArray())[1].Split(" ".ToCharArray())[0]; String value = line.Split("Value=".ToCharArray())[1]; window.SetWindowText(entity + " has " + value + " options."); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OptionsDisplay { public class TagPrinter { public static void Load() { LogWindow window = new LogWindow(); window.Show(); Hearthstone_Deck_Tracker.API.LogEvents.OnPowerLogLine.Add(window.SetWindowText); } } }
agpl-3.0
C#
68167f74d3c39f5c4b0b43a524c3c4e7cf6fe1ff
Improve examples program
Stratajet/UnitConversion
UnitConversionExample/Program.cs
UnitConversionExample/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using UnitConversion; namespace UnitConversionExample { public class Program { public static void Main(string[] args) { // Simple programmatic approach to conversion between units var converter = new MassConverter("kg", "lbs"); double kg = 452; double lbs = converter.LeftToRight(kg); Console.WriteLine("Weight in pounds is " + lbs); // Converting both ways is easy double originalKgs = converter.RightToLeft(lbs); Console.WriteLine("Converted back: " + originalKgs); // You may also want a simpler level of precision lbs = converter.LeftToRight(kg, 2); Console.WriteLine("Weight in pounds is " + lbs); // You can easily customise converters to support synonyms used in business logic double mtowKG = 3000; converter.AddSynonym("kg", "MTOW (KG)"); converter.UnitLeft = "MTOW (KG)"; lbs = converter.LeftToRight(mtowKG); Console.WriteLine("MTOW (KG) in lbs is " + lbs); // Add a new unit with a custom conversion factor converter.AddUnit("Chuck Norris", 9001); converter.UnitRight = "Chuck Norris"; kg = 7; var chucks = converter.LeftToRight(kg); Console.WriteLine("7 Kg is equal to " + lbs + " chucks"); Console.Read(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using UnitConversion; namespace UnitConversionExample { public class Program { public static void Main(string[] args) { // Simple programmatic approach to conversion between units var converter = new MassConverter("kg", "lbs"); double kg = 452; double lbs = converter.LeftToRight(kg); Console.WriteLine("Weight in pounds is " + lbs); // Converting both ways is easy double originalKgs = converter.RightToLeft(lbs); Console.WriteLine("Converted back: " + originalKgs); // You may also want a simpler level of precision lbs = converter.LeftToRight(kg, 2); Console.WriteLine("Weight in pounds is " + lbs); // You can easily customise converters to support synonyms used in business logic string unitFromDatabase = "MTOW (KG)"; double mtowKG = 3000; converter.AddSynonym("kg", "MTOW (KG)"); converter.UnitLeft = unitFromDatabase; double mtowLBs = converter.LeftToRight(mtowKG); Console.WriteLine("MTOW (KG) in lbs is " + mtowLBs); // Add a new unit with a custom conversion factor converter.AddUnit("Chuck Norris", 9001); converter.UnitRight = "Chuck Norris"; kg = 7; var chucks = converter.LeftToRight(kg); Console.WriteLine("7 Kg is equal to " + lbs + " chucks"); Console.Read(); } } }
mit
C#
2650398b9ae3c5434cf14df0f2d3589ae6763cfb
fix json deserialization of empty height and width in mediadetails sizes
wp-net/WordPressPCL,cobalto/WordPressPCL,wp-net/WordPressPCL,cobalto/WordPressPCL
WordPressPCL/Models/MediaSize.cs
WordPressPCL/Models/MediaSize.cs
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Text; namespace WordPressPCL.Models { /// <summary> /// Info about Media Size /// <see cref="MediaDetails.Sizes"/> /// </summary> public class MediaSize { /// <summary> /// File /// </summary> [JsonProperty("file")] public string File { get; set; } /// <summary> /// Media Width /// </summary> [JsonProperty("width")] public int? Width { get; set; } /// <summary> /// Media Height /// </summary> [JsonProperty("height")] public int? Height { get; set; } /// <summary> /// Mime Type /// </summary> [JsonProperty("mime_type")] public string MimeType { get; set; } /// <summary> /// Url of source media /// </summary> [JsonProperty("source_url")] public string SourceUrl { get; set; } } }
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Text; namespace WordPressPCL.Models { /// <summary> /// Info about Media Size /// <see cref="MediaDetails.Sizes"/> /// </summary> public class MediaSize { /// <summary> /// File /// </summary> [JsonProperty("file")] public string File { get; set; } /// <summary> /// Media Width /// </summary> [JsonProperty("width")] public int Width { get; set; } /// <summary> /// Media Height /// </summary> [JsonProperty("height")] public int Height { get; set; } /// <summary> /// Mime Type /// </summary> [JsonProperty("mime_type")] public string MimeType { get; set; } /// <summary> /// Url of source media /// </summary> [JsonProperty("source_url")] public string SourceUrl { get; set; } } }
mit
C#
87f6502508a290481995d01916b73c6f209eea16
Update GlobalMouseListener.cs
gmamaladze/globalmousekeyhook
MouseKeyHook/Implementation/GlobalMouseListener.cs
MouseKeyHook/Implementation/GlobalMouseListener.cs
// This code is distributed under MIT license. // Copyright (c) 2015 George Mamaladze // See license.txt or https://mit-license.org/ using System.Windows.Forms; using Gma.System.MouseKeyHook.WinApi; namespace Gma.System.MouseKeyHook.Implementation { internal class GlobalMouseListener : MouseListener { private readonly int m_SystemDoubleClickTime; private MouseButtons m_PreviousClicked; private Point m_PreviousClickedPosition; private int m_PreviousClickedTime; public GlobalMouseListener() : base(HookHelper.HookGlobalMouse) { m_SystemDoubleClickTime = MouseNativeMethods.GetDoubleClickTime(); } protected override void ProcessDown(ref MouseEventExtArgs e) { if (IsDoubleClick(e)) e = e.ToDoubleClickEventArgs(); base.ProcessDown(ref e); } protected override void ProcessUp(ref MouseEventExtArgs e) { base.ProcessUp(ref e); if (e.Clicks == 2) StopDoubleClickWaiting(); if (e.Clicks == 1) StartDoubleClickWaiting(e); } private void StartDoubleClickWaiting(MouseEventExtArgs e) { m_PreviousClicked = e.Button; m_PreviousClickedTime = e.Timestamp; m_PreviousClickedPosition = e.Point; } private void StopDoubleClickWaiting() { m_PreviousClicked = MouseButtons.None; m_PreviousClickedTime = 0; m_PreviousClickedPosition = m_UninitialisedPoint; } private bool IsDoubleClick(MouseEventExtArgs e) { return e.Button == m_PreviousClicked && e.Point == m_PreviousClickedPosition && // Click-move-click exception, see Patch 11222 e.Timestamp - m_PreviousClickedTime <= m_SystemDoubleClickTime; } protected override MouseEventExtArgs GetEventArgs(CallbackData data) { return MouseEventExtArgs.FromRawDataGlobal(data); } } }
// This code is distributed under MIT license. // Copyright (c) 2015 George Mamaladze // See license.txt or https://mit-license.org/ using System.Windows.Forms; using Gma.System.MouseKeyHook.WinApi; namespace Gma.System.MouseKeyHook.Implementation { internal class GlobalMouseListener : MouseListener { private readonly int m_SystemDoubleClickTime; private MouseButtons m_PreviousClicked; private Point m_PreviousClickedPosition; private int m_PreviousClickedTime; public GlobalMouseListener() : base(HookHelper.HookGlobalMouse) { m_SystemDoubleClickTime = MouseNativeMethods.GetDoubleClickTime(); } protected override void ProcessDown(ref MouseEventExtArgs e) { if (IsDoubleClick(e)) e = e.ToDoubleClickEventArgs(); base.ProcessDown(ref e); } protected override void ProcessUp(ref MouseEventExtArgs e) { base.ProcessUp(ref e); if (e.Clicks == 2) StopDoubleClickWaiting(); if (e.Clicks == 1) StartDoubleClickWaiting(e); } private void StartDoubleClickWaiting(MouseEventExtArgs e) { m_PreviousClicked = e.Button; m_PreviousClickedTime = e.Timestamp; m_PreviousClickedPosition = e.Point; } private void StopDoubleClickWaiting() { m_PreviousClicked = MouseButtons.None; m_PreviousClickedTime = 0; m_PreviousClickedPosition = new Point(0, 0); } private bool IsDoubleClick(MouseEventExtArgs e) { return e.Button == m_PreviousClicked && e.Point == m_PreviousClickedPosition && // Click-move-click exception, see Patch 11222 e.Timestamp - m_PreviousClickedTime <= m_SystemDoubleClickTime; } protected override MouseEventExtArgs GetEventArgs(CallbackData data) { return MouseEventExtArgs.FromRawDataGlobal(data); } } }
mit
C#
6e12a7ebb071ac41de76917c5746a2813feeac64
Fix up line endings
jagrem/slang,jagrem/slang,jagrem/slang
slang/Lexing/Trees/Transformers/ConstantRuleExtensions.cs
slang/Lexing/Trees/Transformers/ConstantRuleExtensions.cs
using System.Collections.Generic; using slang.Lexing.Rules.Core; using slang.Lexing.Trees.Nodes; using System.Linq; namespace slang.Lexing.Trees.Transformers { public static class ConstantRuleExtensions { public static Node Transform (this Constant rule, IEnumerable<Node> parents) { var node = new Node (); var value = rule.Value; parents .Where (parent => !parent.Transitions.ContainsKey (value)) .ToList ().ForEach (parent => parent.Transitions.Add (rule.Value, node)); return node; } } }
using System.Collections.Generic; using slang.Lexing.Rules.Core; using slang.Lexing.Trees.Nodes; using System.Linq; namespace slang.Lexing.Trees.Transformers { public static class ConstantRuleExtensions { public static Node Transform (this Constant rule, IEnumerable<Node> parents) { var node = new Node (); var value = rule.Value; parents .Where (parent => !parent.Transitions.ContainsKey (value)) .ToList ().ForEach (parent => parent.Transitions.Add (rule.Value, node)); return node; } } }
mit
C#
d9cac0232449da9d913bfb3ec8236f47d6a15f81
Fix `HelperToReturnHelperAdapter`
rexm/Handlebars.Net,rexm/Handlebars.Net
source/Handlebars/Adapters/HelperToReturnHelperAdapter.cs
source/Handlebars/Adapters/HelperToReturnHelperAdapter.cs
namespace HandlebarsDotNet.Adapters { internal class HelperToReturnHelperAdapter { private readonly HandlebarsHelper _helper; private readonly HandlebarsReturnHelper _delegate; public HelperToReturnHelperAdapter(HandlebarsHelper helper) { _helper = helper; _delegate = (context, arguments) => { using (var writer = new PolledStringWriter()) { _helper(writer, context, arguments); return writer.ToString(); } }; } public static implicit operator HandlebarsReturnHelper(HelperToReturnHelperAdapter adapter) { return adapter._delegate; } } }
namespace HandlebarsDotNet.Adapters { internal class HelperToReturnHelperAdapter { private readonly HandlebarsHelper _helper; private readonly HandlebarsReturnHelper _delegate; public HelperToReturnHelperAdapter(HandlebarsHelper helper) { _helper = helper; _delegate = (context, arguments) => { using (var writer = new PolledStringWriter()) { _helper(writer, context, arguments); return writer; } }; } public static implicit operator HandlebarsReturnHelper(HelperToReturnHelperAdapter adapter) { return adapter._delegate; } } }
mit
C#
b609fd1c5f6e90a68a6ac329d8557a8d8c739bf6
Improve EffectPipelineState performance
feliwir/openSage,feliwir/openSage
src/OpenSage.Game/Graphics/Effects/EffectPipelineState.cs
src/OpenSage.Game/Graphics/Effects/EffectPipelineState.cs
using System; using Veldrid; namespace OpenSage.Graphics.Effects { public readonly struct EffectPipelineState : IEquatable<EffectPipelineState> { public readonly RasterizerStateDescription RasterizerState; public readonly DepthStencilStateDescription DepthStencilState; public readonly BlendStateDescription BlendState; public readonly OutputDescription OutputDescription; public readonly EffectPipelineStateHandle Handle; public EffectPipelineState( in RasterizerStateDescription rasterizerState, in DepthStencilStateDescription depthStencilState, in BlendStateDescription blendState, in OutputDescription outputDescription) { RasterizerState = rasterizerState; DepthStencilState = depthStencilState; BlendState = blendState; OutputDescription = outputDescription; Handle = null; Handle = EffectPipelineStateFactory.GetHandle(this); } public override bool Equals(object obj) { return obj is EffectPipelineState && Equals((EffectPipelineState) obj); } public bool Equals(EffectPipelineState other) { return RasterizerState.Equals(other.RasterizerState) && DepthStencilState.Equals(other.DepthStencilState) && BlendState.Equals(other.BlendState) && OutputDescription.Equals(other.OutputDescription); } public override int GetHashCode() { var hashCode = 414621651; hashCode = hashCode * -1521134295 + RasterizerState.GetHashCode(); hashCode = hashCode * -1521134295 + DepthStencilState.GetHashCode(); hashCode = hashCode * -1521134295 + BlendState.GetHashCode(); hashCode = hashCode * -1521134295 + OutputDescription.GetHashCode(); return hashCode; } public static bool operator ==(in EffectPipelineState state1, in EffectPipelineState state2) { return state1.Equals(state2); } public static bool operator !=(in EffectPipelineState state1, in EffectPipelineState state2) { return !(state1 == state2); } } }
using Veldrid; namespace OpenSage.Graphics.Effects { public readonly struct EffectPipelineState { public readonly RasterizerStateDescription RasterizerState; public readonly DepthStencilStateDescription DepthStencilState; public readonly BlendStateDescription BlendState; public readonly OutputDescription OutputDescription; public readonly EffectPipelineStateHandle Handle; public EffectPipelineState( RasterizerStateDescription rasterizerState, DepthStencilStateDescription depthStencilState, BlendStateDescription blendState, OutputDescription outputDescription) { RasterizerState = rasterizerState; DepthStencilState = depthStencilState; BlendState = blendState; OutputDescription = outputDescription; Handle = null; Handle = EffectPipelineStateFactory.GetHandle(this); } } }
mit
C#
3d3fe9f776e5de790918abb8829686ef99965b30
Update TextToSpeechOptions.cs
tiksn/TIKSN-Framework
TIKSN.Core/Speech/TextToSpeechOptions.cs
TIKSN.Core/Speech/TextToSpeechOptions.cs
namespace TIKSN.Speech { public class TextToSpeechOptions { public string VoiceId { get; set; } } }
namespace TIKSN.Speech { public class TextToSpeechOptions { public string VoiceId { get; set; } } }
mit
C#
a17330804e6a22e44869b799ca17e3687ee0a3a5
Update test case
BERef/BibTeXLibrary
UnitTest/UnexpectedTokenExceptionTest.cs
UnitTest/UnexpectedTokenExceptionTest.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using BibTeXLibrary; namespace UnitTest { [TestClass] public class UnexpectedTokenExceptionTest { [TestMethod] public void TestConstructor() { var e = new UnexpectedTokenException(1, 10, TokenType.EOF, TokenType.Comma, TokenType.RightBrace); Assert.AreEqual(1, e.LineNo); Assert.AreEqual(10, e.ColNo); Assert.AreEqual("Line 1, Col 10. Unexpected token: EOF. Expected: Comma, RightBrace", e.Message); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using BibTeXLibrary; namespace UnitTest { [TestClass] public class UnexpectedTokenExceptionTest { [TestMethod] public void TestConstructor() { var e = new UnexpectedTokenException(1, 10, TokenType.EOF, TokenType.Comma, TokenType.RightBrace); Assert.AreEqual(1, e.LineNo); Assert.AreEqual(10, e.ColNo); Assert.AreEqual("Unexpected token: EOF. Expected: Comma, RightBrace", e.Message); } } }
mit
C#
38d6d93f65d5f3abff9ef01ab600f8a39d2a577b
Fix recently introduced crash when opening dev tools in notification window
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
Core/Handling/ResourceHandlerNotification.cs
Core/Handling/ResourceHandlerNotification.cs
using CefSharp; using System.Collections.Specialized; using System.IO; using System.Text; namespace TweetDck.Core.Handling{ class ResourceHandlerNotification : IResourceHandler{ private readonly NameValueCollection headers = new NameValueCollection(0); private MemoryStream dataIn; public void SetHTML(string html){ if (dataIn != null){ dataIn.Dispose(); } dataIn = ResourceHandler.GetMemoryStream(html, Encoding.UTF8); } public void Dispose(){ if (dataIn != null){ dataIn.Dispose(); dataIn = null; } } bool IResourceHandler.ProcessRequest(IRequest request, ICallback callback){ callback.Continue(); return true; } void IResourceHandler.GetResponseHeaders(IResponse response, out long responseLength, out string redirectUrl){ redirectUrl = null; response.MimeType = "text/html"; response.StatusCode = 200; response.StatusText = "OK"; response.ResponseHeaders = headers; responseLength = dataIn != null ? dataIn.Length : -1; } bool IResourceHandler.ReadResponse(Stream dataOut, out int bytesRead, ICallback callback){ callback.Dispose(); try{ int length = (int)dataIn.Length; dataIn.CopyTo(dataOut, length); bytesRead = length; return true; }catch{ // catch IOException, possibly NullReferenceException if dataIn is null bytesRead = 0; return false; } } bool IResourceHandler.CanGetCookie(Cookie cookie){ return true; } bool IResourceHandler.CanSetCookie(Cookie cookie){ return true; } void IResourceHandler.Cancel(){} } }
using CefSharp; using System.Collections.Specialized; using System.IO; using System.Text; namespace TweetDck.Core.Handling{ class ResourceHandlerNotification : IResourceHandler{ private readonly NameValueCollection headers = new NameValueCollection(0); private MemoryStream dataIn; public void SetHTML(string html){ if (dataIn != null){ dataIn.Dispose(); } dataIn = ResourceHandler.GetMemoryStream(html, Encoding.UTF8); } public void Dispose(){ if (dataIn != null){ dataIn.Dispose(); dataIn = null; } } bool IResourceHandler.ProcessRequest(IRequest request, ICallback callback){ callback.Continue(); return true; } void IResourceHandler.GetResponseHeaders(IResponse response, out long responseLength, out string redirectUrl){ redirectUrl = null; response.MimeType = "text/html"; response.StatusCode = 200; response.StatusText = "OK"; response.ResponseHeaders = headers; responseLength = dataIn.Length; } bool IResourceHandler.ReadResponse(Stream dataOut, out int bytesRead, ICallback callback){ callback.Dispose(); try{ int length = (int)dataIn.Length; dataIn.CopyTo(dataOut, length); bytesRead = length; return true; }catch{ // catch IOException, possibly NullReferenceException if dataIn is null bytesRead = 0; return false; } } bool IResourceHandler.CanGetCookie(Cookie cookie){ return true; } bool IResourceHandler.CanSetCookie(Cookie cookie){ return true; } void IResourceHandler.Cancel(){} } }
mit
C#
7603f462e4e8df432eff7c191227ded67cd6523d
Update assembly version
napalm684/Owin.LocaleLoader
Owin.LocaleLoader/Properties/AssemblyInfo.cs
Owin.LocaleLoader/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("Owin.LocaleLoader")] [assembly: AssemblyDescription("Used to intercept placeholder requests and replace them with locale specific requests")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Owin.LocaleLoader")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9c0a6508-1336-4510-b32a-00a5dafec01d")] // 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.1")] [assembly: AssemblyFileVersion("1.0.0.1")]
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("Owin.LocaleLoader")] [assembly: AssemblyDescription("Used to intercept placeholder requests and replace them with locale specific requests")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Owin.LocaleLoader")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9c0a6508-1336-4510-b32a-00a5dafec01d")] // 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#
8ac9a579525b827b3edd0ca14f0668e78f441c6e
Update Rand.cs
dimmpixeye/Unity3dTools
Runtime/Helpers/Rand.cs
Runtime/Helpers/Rand.cs
// Project : ecs // Contacts : Pix - [email protected] using System; namespace Pixeye.Actors { public static class Rand { public static Random Source = new Random(DateTime.Today.Second); public static float Get(float minimum, float maximum) { return (float) (Source.NextDouble() * (maximum - minimum) + minimum); } public static int Get(int minimum, int maximum) { return (int) (Source.NextDouble() * (maximum - minimum) + minimum); } public static bool NextBool(int truePercentage = 50) { return Source.NextDouble() < truePercentage / 100.0; } } }
// Project : ecs // Contacts : Pix - [email protected] using System; namespace Pixeye.Actors { public static class Rand { public static Random Source = new Random(DateTime.Today.Second); public static float Get(float minimum, float maximum) { return (float) Source.NextDouble() * (maximum - minimum) + minimum; } public static int Get(int minimum, int maximum) { return (int) Source.NextDouble() * (maximum - minimum) + minimum; } public static bool NextBool(int truePercentage = 50) { return Source.NextDouble() < truePercentage / 100.0; } } }
mit
C#
6391d21af1b5c671fc99d6cfc9d483971840b6f6
Remove test used for visualization
johnneijzen/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,EVAST9919/osu,ppy/osu,ZLima12/osu,EVAST9919/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ZLima12/osu,johnneijzen/osu,2yangk23/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,peppy/osu-new,smoogipoo/osu,2yangk23/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu
osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs
osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Shapes; using osu.Game.Screens.Menu; using osuTK.Graphics; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestSceneButtonSystem : OsuTestScene { public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ButtonSystem), typeof(ButtonArea), typeof(Button) }; public TestSceneButtonSystem() { OsuLogo logo; ButtonSystem buttons; Children = new Drawable[] { new Box { Colour = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke), RelativeSizeAxes = Axes.Both, }, buttons = new ButtonSystem(), logo = new OsuLogo { RelativePositionAxes = Axes.Both } }; buttons.SetOsuLogo(logo); foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType<ButtonSystemState>().Skip(1)) AddStep($"State to {s}", () => buttons.State = s); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Shapes; using osu.Game.Screens.Menu; using osuTK; using osuTK.Graphics; namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestSceneButtonSystem : OsuTestScene { public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ButtonSystem), typeof(ButtonArea), typeof(Button) }; public TestSceneButtonSystem() { OsuLogo logo; ButtonSystem buttons; Children = new Drawable[] { new Box { Colour = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke), RelativeSizeAxes = Axes.Both, }, buttons = new ButtonSystem(), logo = new OsuLogo { RelativePositionAxes = Axes.Both } }; buttons.SetOsuLogo(logo); foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType<ButtonSystemState>().Skip(1)) AddStep($"State to {s}", () => { buttons.State = s; if (buttons.State == ButtonSystemState.EnteringMode) { buttons.FadeOut(400, Easing.InSine); buttons.MoveTo(new Vector2(-800, 0), 400, Easing.InSine); logo.FadeOut(300, Easing.InSine) .ScaleTo(0.2f, 300, Easing.InSine); } else { buttons.FadeIn(400, Easing.OutQuint); buttons.MoveTo(new Vector2(0), 400, Easing.OutQuint); logo.FadeColour(Color4.White, 100, Easing.OutQuint); logo.FadeIn(100, Easing.OutQuint); } }); } } }
mit
C#
dfb890c0bc4f25a65365a890b50ab1f7f13bbb4b
Update TransformPlus.cs
xxmon/unity
Editor/TransformPlus.cs
Editor/TransformPlus.cs
using UnityEngine; using System.Collections; using UnityEditor; [CustomEditor (typeof(Transform))] public class TransformPlus : Editor { Transform myTarget; float inch = 2.54f; float foot = 30.48f; public override void OnInspectorGUI () { myTarget = (Transform)target; myTarget.localPosition = EditorGUILayout.Vector3Field ("Position", myTarget.localPosition); EditorGUILayout.Vector3Field ("Position (inch)", myTarget.localPosition / inch); EditorGUILayout.Vector3Field ("Position (foot)", myTarget.localPosition / foot); myTarget.localEulerAngles = EditorGUILayout.Vector3Field ("Rotation", myTarget.localEulerAngles); myTarget.localScale = EditorGUILayout.Vector3Field ("Scale", myTarget.localScale); EditorGUILayout.Vector3Field ("Scale (inch)", myTarget.localScale / inch); EditorGUILayout.Vector3Field ("Scale (foot)", myTarget.localScale / foot); } }
using UnityEngine; using System.Collections; using UnityEditor; [CustomEditor (typeof(Transform))] public class TransformPlus : Editor { Transform myTarget; float inch = 2.54f; float foot = 30.48f; public override void OnInspectorGUI () { myTarget = (Transform)target; myTarget.localPosition = EditorGUILayout.Vector3Field ("Position", myTarget.localPosition); EditorGUILayout.Vector3Field ("Position (inch)", myTarget.localPosition / inch); EditorGUILayout.Vector3Field ("Position (foot)", myTarget.localPosition / foot); myTarget.localEulerAngles = EditorGUILayout.Vector3Field ("Rotation", myTarget.localEulerAngles); myTarget.localScale = EditorGUILayout.Vector3Field ("Scale", myTarget.localScale); EditorGUILayout.Vector3Field ("Scale (inch)", myTarget.localScale / inch); EditorGUILayout.Vector3Field ("Scale (foot)", myTarget.localScale / foot); } }
mit
C#
f479720d5a9eb7759e235cf94134dcdb93e87784
Remove our custom bootstrapper and use the BenchmarkSwitcher (#1480)
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
test/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs
test/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.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 System; using System.Reflection; using BenchmarkDotNet.Running; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { public class Program { public static void Main(string[] args) { BenchmarkSwitcher.FromAssembly(typeof(Program).GetTypeInfo().Assembly).Run(args); } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using BenchmarkDotNet.Running; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { public class Program { public static void Main(string[] args) { var options = (uint[])Enum.GetValues(typeof(BenchmarkType)); BenchmarkType type; if (args.Length != 1 || !Enum.TryParse(args[0], out type)) { Console.WriteLine($"Please add benchmark to run as parameter:"); for (var i = 0; i < options.Length; i++) { Console.WriteLine($" {((BenchmarkType)options[i]).ToString()}"); } return; } RunSelectedBenchmarks(type); } private static void RunSelectedBenchmarks(BenchmarkType type) { if (type.HasFlag(BenchmarkType.RequestParsing)) { BenchmarkRunner.Run<RequestParsing>(); } if (type.HasFlag(BenchmarkType.Writing)) { BenchmarkRunner.Run<Writing>(); } if (type.HasFlag(BenchmarkType.Throughput)) { BenchmarkRunner.Run<PipeThroughput>(); } if (type.HasFlag(BenchmarkType.KnownStrings)) { BenchmarkRunner.Run<KnownStrings>(); } if (type.HasFlag(BenchmarkType.KestrelHttpParser)) { BenchmarkRunner.Run<KestrelHttpParser>(); } if (type.HasFlag(BenchmarkType.FrameParsingOverhead)) { BenchmarkRunner.Run<FrameParsingOverhead>(); } } } [Flags] public enum BenchmarkType : uint { RequestParsing = 1, Writing = 2, Throughput = 4, KnownStrings = 8, KestrelHttpParser = 16, FrameParsingOverhead = 32, // add new ones in powers of two - e.g. 2,4,8,16... All = uint.MaxValue } }
apache-2.0
C#
2791f45b3adbeeffc90f010a265944158a685f06
Fix use of Navigation as first docked child of UIWindow
bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,l8s/Eto,PowerOfCode/Eto,PowerOfCode/Eto,l8s/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,l8s/Eto
Source/Eto.Platform.iOS/Forms/iosViewExtensions.cs
Source/Eto.Platform.iOS/Forms/iosViewExtensions.cs
using System; using MonoTouch.UIKit; using Eto.Forms; using Eto.Drawing; namespace Eto.Platform.iOS.Forms { public static class MacViewExtensions { public static UIView GetContainerView (this Control control) { if (control == null) return null; var viewHandler = control.Handler as IiosView; if (viewHandler != null) return viewHandler.ContainerControl; return control.ControlObject as UIView; } public static UIView GetContentView (this Control control) { if (control == null) return null; var containerHandler = control.Handler as IiosContainer; if (containerHandler != null) return containerHandler.ContentControl; return control.ControlObject as UIView; } public static void AddSubview (this Control control, Control subView, bool useRoot = false) { var parentController = control.GetViewController (false); if (parentController != null) { parentController.AddChildViewController (subView.GetViewController ()); return; } if (useRoot) { var window = control.GetContainerView () as UIWindow; if (window != null) { window.RootViewController = subView.GetViewController (); return; } } var parentView = control.GetContentView (); if (parentView != null) { parentView.AddSubview (subView.GetContainerView ()); return; } throw new EtoException("Coult not add subview to parent"); } public static Size GetPreferredSize(this Control control) { if (control == null) return Size.Empty; var mh = control.Handler as IiosView; if (mh != null) { return mh.GetPreferredSize (); } var c = control.ControlObject as UIView; if (c != null) { return c.SizeThatFits(UIView.UILayoutFittingCompressedSize).ToEtoSize (); } return Size.Empty; } public static UIViewController GetViewController (this Control control, bool force = true) { if (control == null) return null; var controller = control.Handler as IiosViewController; if (controller != null) { return controller.Controller; } if (force) { var view = control.GetContainerView (); if (view != null) { var viewcontroller = new RotatableViewController { Control = control, View = view }; return viewcontroller; } } return null; } } }
using System; using MonoTouch.UIKit; using Eto.Forms; using Eto.Drawing; namespace Eto.Platform.iOS.Forms { public static class MacViewExtensions { public static UIView GetContainerView (this Control control) { if (control == null) return null; var viewHandler = control.Handler as IiosView; if (viewHandler != null) return viewHandler.ContainerControl; return control.ControlObject as UIView; } public static UIView GetContentView (this Control control) { if (control == null) return null; var containerHandler = control.Handler as IiosContainer; if (containerHandler != null) return containerHandler.ContentControl; return control.ControlObject as UIView; } public static void AddSubview(this Control control, Control subView, bool useRoot = false) { var parentController = control.GetViewController (false); if (parentController != null) { parentController.AddChildViewController(subView.GetViewController()); return; } var parentView = control.GetContentView (); parentView.AddSubview (subView.GetContainerView ()); } public static Size GetPreferredSize(this Control control) { if (control == null) return Size.Empty; var mh = control.Handler as IiosView; if (mh != null) { return mh.GetPreferredSize (); } var c = control.ControlObject as UIView; if (c != null) { return c.SizeThatFits(UIView.UILayoutFittingCompressedSize).ToEtoSize (); } return Size.Empty; } public static UIViewController GetViewController (this Control control, bool force = true) { if (control == null) return null; var controller = control.Handler as IiosViewController; if (controller != null) { return controller.Controller; } if (force) { var view = control.GetContainerView (); if (view != null) { var viewcontroller = new RotatableViewController { Control = control, View = view }; return viewcontroller; } } return null; } } }
bsd-3-clause
C#
15fa75fe1d5e77b6e143a3309a719c29f0c530b6
Add another testing method to SubBoundObject
haozhouxu/CefSharp,wangzheng888520/CefSharp,jamespearce2006/CefSharp,illfang/CefSharp,rover886/CefSharp,ITGlobal/CefSharp,rover886/CefSharp,illfang/CefSharp,NumbersInternational/CefSharp,zhangjingpu/CefSharp,NumbersInternational/CefSharp,NumbersInternational/CefSharp,AJDev77/CefSharp,ruisebastiao/CefSharp,battewr/CefSharp,Livit/CefSharp,illfang/CefSharp,VioletLife/CefSharp,dga711/CefSharp,rover886/CefSharp,Haraguroicha/CefSharp,wangzheng888520/CefSharp,Octopus-ITSM/CefSharp,Octopus-ITSM/CefSharp,battewr/CefSharp,windygu/CefSharp,twxstar/CefSharp,Octopus-ITSM/CefSharp,joshvera/CefSharp,battewr/CefSharp,yoder/CefSharp,twxstar/CefSharp,battewr/CefSharp,yoder/CefSharp,yoder/CefSharp,jamespearce2006/CefSharp,ITGlobal/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,windygu/CefSharp,rlmcneary2/CefSharp,jamespearce2006/CefSharp,AJDev77/CefSharp,Haraguroicha/CefSharp,VioletLife/CefSharp,dga711/CefSharp,windygu/CefSharp,dga711/CefSharp,rover886/CefSharp,joshvera/CefSharp,ruisebastiao/CefSharp,joshvera/CefSharp,NumbersInternational/CefSharp,twxstar/CefSharp,Octopus-ITSM/CefSharp,haozhouxu/CefSharp,ITGlobal/CefSharp,Livit/CefSharp,yoder/CefSharp,zhangjingpu/CefSharp,rlmcneary2/CefSharp,zhangjingpu/CefSharp,Haraguroicha/CefSharp,AJDev77/CefSharp,ruisebastiao/CefSharp,zhangjingpu/CefSharp,gregmartinhtc/CefSharp,windygu/CefSharp,haozhouxu/CefSharp,rover886/CefSharp,AJDev77/CefSharp,ruisebastiao/CefSharp,twxstar/CefSharp,wangzheng888520/CefSharp,Haraguroicha/CefSharp,Livit/CefSharp,dga711/CefSharp,ITGlobal/CefSharp,VioletLife/CefSharp,gregmartinhtc/CefSharp,joshvera/CefSharp,VioletLife/CefSharp,illfang/CefSharp,wangzheng888520/CefSharp,rlmcneary2/CefSharp,gregmartinhtc/CefSharp,gregmartinhtc/CefSharp,Livit/CefSharp,rlmcneary2/CefSharp,haozhouxu/CefSharp,Haraguroicha/CefSharp
CefSharp.Example/SubBoundObject.cs
CefSharp.Example/SubBoundObject.cs
namespace CefSharp.Example { public class SubBoundObject { public string SimpleProperty { get; set; } public SubBoundObject() { SimpleProperty = "This is a very simple property."; } public string GetMyType() { return "My Type is " + GetType(); } public string EchoSimpleProperty() { return SimpleProperty; } } }
namespace CefSharp.Example { public class SubBoundObject { public string SimpleProperty { get; set; } public SubBoundObject() { SimpleProperty = "This is a very simple property."; } public string GetMyType() { return "My Type is " + GetType(); } } }
bsd-3-clause
C#
f3bccf729328629707af02897ad81a4613cd73da
Update RequestExamineMessage.cs
fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation
UnityProject/Assets/Scripts/Messages/Client/Interaction/RequestExamineMessage.cs
UnityProject/Assets/Scripts/Messages/Client/Interaction/RequestExamineMessage.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using Mirror; using UnityEngine; /// <summary> /// Requests for the server to perform examine interaction /// </summary> public class RequestExamineMessage : ClientMessage { //TODO: Is this constant needed anymore public static short MessageType = (short) MessageTypes.RequestExamine; //members // netid of target public uint examineTarget; static RequestExamineMessage() { //constructor } public override IEnumerator Process() { //TODO: check break conditions if (SentByPlayer == null || SentByPlayer.Script == null) { yield break; } // Sort of translates one or more netId to gameobjects contained in NetworkObjects[] // it's confusing AF to me atm. yield return WaitFor(examineTarget); // Here we build the message to send, by looking at the target's components. // anyone extending IExaminable gets a say in it. // Look for examinables. var examinables = NetworkObject.GetComponents<IExaminable>(); string msg = ""; IExaminable examinable; for (int i = 0; i < examinables.Count(); i++) { examinable = examinables[i]; msg += $"{examinable.Examine()}"; if (i != examinables.Count() - 1) { msg += "\n"; } } // Send the message. Chat.AddExamineMsgFromServer(SentByPlayer.GameObject, msg); } public static void Send(uint targetNetId) { // TODO: Log something? var msg = new RequestExamineMessage() { examineTarget = targetNetId }; msg.Send(); } // //TODO: Figure out serial/deserialization? // public override void Deserialize(NetworkReader reader) // { // } // public override void Serialize(NetworkWriter writer) // { // } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using Mirror; using UnityEngine; /// <summary> /// Requests for the server to perform examine interaction /// </summary> public class RequestExamineMessage : ClientMessage { //TODO: Is this constant needed anymore public static short MessageType = (short) MessageTypes.RequestExamine; //members // netid of target public uint examineTarget; static RequestExamineMessage() { //constructor } public override IEnumerator Process() { //TODO: check break conditions if (SentByPlayer == null || SentByPlayer.Script == null) { yield break; } // Sort of translates one or more netId to gameobjects contained in NetworkObjects[] // it's confusing AF to me atm. yield return WaitFor(examineTarget); // Here we build the message to send, by looking at the target's components. // anyone extending IExaminable gets a say in it. // Look for examinables. var examinables = NetworkObject.GetComponents<IExaminable>(); string msg = ""; foreach (var examinable in examinables) { msg += $"{examinable.Examine()}\n"; } if (msg.Length > 0) { msg = msg.Substring(0, msg.Length-2); } // Send the message. Chat.AddExamineMsgFromServer(SentByPlayer.GameObject, msg); } public static void Send(uint targetNetId) { // TODO: Log something? var msg = new RequestExamineMessage() { examineTarget = targetNetId }; msg.Send(); } // //TODO: Figure out serial/deserialization? // public override void Deserialize(NetworkReader reader) // { // } // public override void Serialize(NetworkWriter writer) // { // } }
agpl-3.0
C#
69e82133da9d9220e81c0b0c17842ccbd5fb25d9
Fix Alt; Add alt addition
bunashibu/kikan
Assets/Scripts/Skill/All/Alt.cs
Assets/Scripts/Skill/All/Alt.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Bunashibu.Kikan { public class Alt : Skill { void Start() { if (!photonView.isMine) return; var skillUser = _skillUserObj.GetComponent<BattlePlayer>(); int addition = skillUser.Level.Lv * 50 + (int)(Random.value * 100); skillUser.Hp.Add(2000 + addition); skillUser.Hp.UpdateView(); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Bunashibu.Kikan { public class Alt : Skill { void Start() { var skillUser = _skillUserObj.GetComponent<BattlePlayer>(); skillUser.Hp.Add(2000); skillUser.Hp.UpdateView(); } } }
mit
C#
7d2836efa4d4b3ea684b7781028d9a8aaf545068
Remove useless debug log
solfen/Rogue_Cadet
Assets/Scripts/UI/InputMapUI.cs
Assets/Scripts/UI/InputMapUI.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class InputMapUI : MonoBehaviour { public static InputMapUI instance; public Sprite gamepadSprite; public Sprite keyboardSprite; public Image inputImage; public Text text; public bool isGamepad; private Animator anim; private bool isLoaded = false; void Awake () { isGamepad = Input.GetJoystickNames().Length > 0 && Input.GetJoystickNames()[0] != ""; inputImage.sprite = isGamepad ? gamepadSprite : keyboardSprite; anim = GetComponent<Animator>(); instance = this; EventDispatcher.AddEventListener(Events.GAME_LOADED, OnLoaded); } void OnDestroy() { EventDispatcher.RemoveEventListener(Events.GAME_LOADED, OnLoaded); } // Update is called once per frame void Update () { if(Input.GetButtonDown("Start") && isLoaded) { anim.SetTrigger("Close"); isLoaded = false; Time.timeScale = 1; } } public void Open() { anim.SetTrigger("Open"); Time.timeScale = 0; } public void OnLoaded(object useless) { text.text = "Press start or space"; isLoaded = true; } public void OnOpen() { Application.LoadLevel(0); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class InputMapUI : MonoBehaviour { public static InputMapUI instance; public Sprite gamepadSprite; public Sprite keyboardSprite; public Image inputImage; public Text text; public bool isGamepad; private Animator anim; private bool isLoaded = false; void Awake () { isGamepad = Input.GetJoystickNames().Length > 0 && Input.GetJoystickNames()[0] != ""; inputImage.sprite = isGamepad ? gamepadSprite : keyboardSprite; anim = GetComponent<Animator>(); instance = this; EventDispatcher.AddEventListener(Events.GAME_LOADED, OnLoaded); } void OnDestroy() { EventDispatcher.RemoveEventListener(Events.GAME_LOADED, OnLoaded); } // Update is called once per frame void Update () { if(Input.GetButtonDown("Start") && isLoaded) { anim.SetTrigger("Close"); isLoaded = false; Time.timeScale = 1; Debug.Log("coucouc"); } } public void Open() { anim.SetTrigger("Open"); Time.timeScale = 0; } public void OnLoaded(object useless) { text.text = "Press start or space"; isLoaded = true; } public void OnOpen() { Application.LoadLevel(0); } }
mit
C#
7be3bbbfd743e24177e3063bb6247154ffc88cc6
Fix release transaction number
ON-IT/Visma.Net
Visma.net/lib/DAta/JournalTransactionData.cs
Visma.net/lib/DAta/JournalTransactionData.cs
using ONIT.VismaNetApi.Models; using System.Threading.Tasks; namespace ONIT.VismaNetApi.Lib.Data { public class JournalTransactionData : BaseCrudDataClass<JournalTransaction> { public JournalTransactionData(VismaNetAuthorization auth) : base(auth) { ApiControllerUri = VismaNetControllers.JournalTransaction; } public async Task AddAttachment(JournalTransaction journalTransaction, byte[] data, string filename) { await VismaNetApiHelper.AddAttachment(Authorization, ApiControllerUri, journalTransaction.GetIdentificator(), data, filename); } public async Task AddAttachment(JournalTransaction journalTransaction, int lineNumber, byte[] data, string filename) { await VismaNetApiHelper.AddAttachment(Authorization, ApiControllerUri, $"{journalTransaction.GetIdentificator()}/{lineNumber}", data, filename); } public async Task<VismaActionResult> Release(JournalTransaction transaction) { return await VismaNetApiHelper.Action(Authorization, ApiControllerUri, transaction.GetIdentificator(), "release"); } public async Task<VismaActionResult> Release(string transactionNumber) { return await VismaNetApiHelper.Action(Authorization, ApiControllerUri, transactionNumber, "release"); } } }
using ONIT.VismaNetApi.Models; using System.Threading.Tasks; namespace ONIT.VismaNetApi.Lib.Data { public class JournalTransactionData : BaseCrudDataClass<JournalTransaction> { public JournalTransactionData(VismaNetAuthorization auth) : base(auth) { ApiControllerUri = VismaNetControllers.JournalTransaction; } public async Task AddAttachment(JournalTransaction journalTransaction, byte[] data, string filename) { await VismaNetApiHelper.AddAttachment(Authorization, ApiControllerUri, journalTransaction.GetIdentificator(), data, filename); } public async Task AddAttachment(JournalTransaction journalTransaction, int lineNumber, byte[] data, string filename) { await VismaNetApiHelper.AddAttachment(Authorization, ApiControllerUri, $"{journalTransaction.GetIdentificator()}/{lineNumber}", data, filename); } public async Task<VismaActionResult> Release(JournalTransaction transaction) { return await VismaNetApiHelper.Action(Authorization, ApiControllerUri, transaction.GetIdentificator(), "release"); } } }
mit
C#
8fc73467c5f3e82c483f69033d8c493339e66a4d
make SpanAirlockSerializer public
vostok/core
Vostok.Core/Tracing/SpanAirlockSerializer.cs
Vostok.Core/Tracing/SpanAirlockSerializer.cs
using System; using System.IO; using Vostok.Airlock; using Vostok.Commons.Binary; namespace Vostok.Tracing { public class SpanAirlockSerializer : IAirlockSerializer<Span>, IAirlockDeserializer<Span> { private const byte FormatVersion = 1; public void Serialize(Span span, IAirlockSink sink) { var writer = sink.Writer; writer.Write(FormatVersion); writer.Write(span.TraceId); writer.Write(span.SpanId); writer.WriteNullable(span.ParentSpanId, (w, id) => w.Write(id)); writer.Write(span.BeginTimestamp.UtcTicks); writer.WriteNullable(span.EndTimestamp, (w, t) => w.Write(t.UtcTicks)); writer.WriteDictionary(span.Annotations, (w, key) => w.Write(key), (w, value) => w.Write(value)); } public Span Deserialize(IAirlockSource source) { var reader = source.Reader; var version = reader.ReadByte(); if (version != FormatVersion) throw new InvalidDataException("invalid format version: " + version); return new Span { TraceId = reader.ReadGuid(), SpanId = reader.ReadGuid(), ParentSpanId = reader.ReadNullableStruct(x => x.ReadGuid()), BeginTimestamp = new DateTimeOffset(reader.ReadInt64(), TimeSpan.Zero), EndTimestamp = reader.ReadNullableStruct(x => new DateTimeOffset(x.ReadInt64(), TimeSpan.Zero)), Annotations = reader.ReadDictionary(r => r.ReadString(), r => r.ReadString()) }; } } }
using System; using System.IO; using Vostok.Airlock; using Vostok.Commons.Binary; namespace Vostok.Tracing { internal class SpanAirlockSerializer : IAirlockSerializer<Span>, IAirlockDeserializer<Span> { private const byte FormatVersion = 1; public void Serialize(Span span, IAirlockSink sink) { var writer = sink.Writer; writer.Write(FormatVersion); writer.Write(span.TraceId); writer.Write(span.SpanId); writer.WriteNullable(span.ParentSpanId, (w, id) => w.Write(id)); writer.Write(span.BeginTimestamp.UtcTicks); writer.WriteNullable(span.EndTimestamp, (w, t) => w.Write(t.UtcTicks)); writer.WriteDictionary(span.Annotations, (w, key) => w.Write(key), (w, value) => w.Write(value)); } public Span Deserialize(IAirlockSource source) { var reader = source.Reader; var version = reader.ReadByte(); if (version != FormatVersion) throw new InvalidDataException("invalid format version: " + version); return new Span { TraceId = reader.ReadGuid(), SpanId = reader.ReadGuid(), ParentSpanId = reader.ReadNullableStruct(x => x.ReadGuid()), BeginTimestamp = new DateTimeOffset(reader.ReadInt64(), TimeSpan.Zero), EndTimestamp = reader.ReadNullableStruct(x => new DateTimeOffset(x.ReadInt64(), TimeSpan.Zero)), Annotations = reader.ReadDictionary(r => r.ReadString(), r => r.ReadString()) }; } } }
mit
C#
5d25d25cbcc366c2ca04ee7aff14ee8fbdfa0346
fix status code 200
elyen3824/myfinanalysis-data
data-provider/run.csx
data-provider/run.csx
using System.Net; public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) { log.Info("C# HTTP trigger function processed a request."); // parse query parameter string name = req.GetQueryNameValuePairs() .FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0) .Value; string symbol = GetValueFromQuery(req, "symbol"); string start = GetValueFromQuery(req, "start"); string end = GetValueFromQuery(req, "end"); // Get request body dynamic data = await req.Content.ReadAsAsync<object>(); // Set name to query string or body data string[] symbols = data?.symbols; HttpResponseMessage result = GetResponse(req, symbol, symbols, start, end); return result; } private static string GetValueFromQuery(HttpRequestMessage req, string key) { return req.GetQueryNameValuePairs() .FirstOrDefault(q => string.Compare(q.Key, key, true) == 0) .Value; } private static HttpResponseMessage GetResponse(HttpRequestMessage req, string symbol, string[] symbols, string start, string end) { if(symbol == null && symbols == null) return req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body") dynamic urls = GetUrls(symbol, symbols, start, end); return req.CreateResponse(HttpStatusCode.OK, urls); } private static dynamic GetUrls(string symbol, string[] symbols, string start, string end) { if(symbol !=null) return $"https://www.quandl.com/api/v3/datasets/WIKI/{symbol}/data.json?start_date={start}&end_date={end}&collapse=daily&transform=cumul"; return string.Empty; }
using System.Net; public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) { log.Info("C# HTTP trigger function processed a request."); // parse query parameter string name = req.GetQueryNameValuePairs() .FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0) .Value; string symbol = GetValueFromQuery(req, "symbol"); string start = GetValueFromQuery(req, "start"); string end = GetValueFromQuery(req, "end"); // Get request body dynamic data = await req.Content.ReadAsAsync<object>(); // Set name to query string or body data string[] symbols = data?.symbols; HttpResponseMessage result = GetResponse(req, symbol, symbols, start, end); return result; } private static string GetValueFromQuery(HttpRequestMessage req, string key) { return req.GetQueryNameValuePairs() .FirstOrDefault(q => string.Compare(q.Key, key, true) == 0) .Value; } private static HttpResponseMessage GetResponse(HttpRequestMessage req, string symbol, string[] symbols, string start, string end) { if(symbol == null && symbols == null) return req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body") dynamic urls = GetUrls(symbol, symbols, start, end); return req.CreateResponse(HttpStatusCode.Ok, urls); } private static dynamic GetUrls(string symbol, string[] symbols, string start, string end) { if(symbol !=null) return $"https://www.quandl.com/api/v3/datasets/WIKI/{symbol}/data.json?start_date={start}&end_date={end}&collapse=daily&transform=cumul"; return string.Empty; }
mit
C#
58f664c0f33b8d9fae5700582c49cd405b3487fa
remove output
davidbetz/nalarium
Nalarium.Test/Base64.cs
Nalarium.Test/Base64.cs
using NUnit.Framework; using System; namespace Nalarium.Test { [TestFixture] public class Base64 { [Test] public void To() { var input = "hello"; var base64 = Nalarium.Base64.To(input); var plain = Nalarium.Base64.From(base64); Assert.AreEqual(input, plain); } [Test] public void Bad() { var bad = Nalarium.Base64.From("base64"); Assert.AreEqual(bad, string.Empty); } [Test] public void Merge() { var merged = Nalarium.Base64.Merge("hello", "there"); var mergedPlain = Nalarium.Base64.From(merged); Assert.AreEqual("hellothere", mergedPlain); } [Test] public void MergedWithSeparator() { var mergedWithSeparator = Nalarium.Base64.Merge(':', "hello", "there"); var mergedWithSeparatorPlain = Nalarium.Base64.From(mergedWithSeparator); Assert.AreEqual("hello:there", mergedWithSeparatorPlain); } } }
using NUnit.Framework; using System; namespace Nalarium.Test { [TestFixture] public class Base64 { [Test] public void To() { var input = "hello"; var base64 = Nalarium.Base64.To(input); Console.WriteLine(base64); var plain = Nalarium.Base64.From(base64); Assert.AreEqual(input, plain); } [Test] public void Bad() { var bad = Nalarium.Base64.From("base64"); Assert.AreEqual(bad, string.Empty); } [Test] public void Merge() { var merged = Nalarium.Base64.Merge("hello", "there"); Console.WriteLine(merged); var mergedPlain = Nalarium.Base64.From(merged); Assert.AreEqual("hellothere", mergedPlain); } [Test] public void MergedWithSeparator() { var mergedWithSeparator = Nalarium.Base64.Merge(':', "hello", "there"); Console.WriteLine(mergedWithSeparator); var mergedWithSeparatorPlain = Nalarium.Base64.From(mergedWithSeparator); Assert.AreEqual("hello:there", mergedWithSeparatorPlain); } } }
bsd-3-clause
C#
8770984f65ad431fcc8fb26f7dde7260f68117c3
Update Extensions - Remove unused extensions and clean up Truncate
mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX
Modix.Data/Utilities/Extensions.cs
Modix.Data/Utilities/Extensions.cs
using System; using System.Linq; namespace Modix.Data.Utilities { public static class Extensions { public static string Truncate(this string value, int maxLength, int maxLines, string suffix = "…") { if (string.IsNullOrEmpty(value)) return value; if (value.Length <= maxLength) { return value; } var lines = value.Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return lines.Length > maxLines ? string.Join("\n", lines.Take(maxLines)) : $"{value.Substring(0, maxLength).Trim()}{suffix}"; } public static bool OrdinalContains(this string value, string search) { return value.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0; } } }
using System; using System.Linq; namespace Modix.Data.Utilities { public static class Extensions { public static long ToLong(this ulong number) { if (!long.TryParse((number.ToString()), out var convertedNumber)) throw new AggregateException("Could not convert ulong to long"); return convertedNumber; } public static ulong ToUlong(this long number) { if (!ulong.TryParse((number.ToString()), out var convertedNumber)) throw new AggregateException("Could not convert long to ulong"); return convertedNumber; } public static string Truncate(this string value, int maxLength, int maxLines, string suffix = "…") { if (string.IsNullOrEmpty(value)) return value; if (value.Length <= maxLength) { return value; } else { var lines = value.Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (lines.Length > maxLines) { //merge everything back with newlines return String.Join("\n", lines.Take(maxLines)); } return $"{value.Substring(0, maxLength).Trim()}{suffix}"; } } public static bool OrdinalContains(this string value, string search) { return value.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0; } } }
mit
C#
be4ab386ff70d997b6b419fba0e719d43d94b2ba
Add contracts to verifty the DrawModel() method doesn't receive null data.
dneelyep/MonoGameUtils
MonoGameUtils/Drawing/Utilities.cs
MonoGameUtils/Drawing/Utilities.cs
using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace MonoGameUtils.Drawing { /// <summary> /// Various useful utility methods that don't obviously go elsewhere. /// </summary> public static class Utilities { /// <summary> /// Draw the provided model in the world, given the provided matrices. /// </summary> /// <param name="model">The model to draw.</param> /// <param name="world">The world matrix that the model should be drawn in.</param> /// <param name="view">The view matrix that the model should be drawn in.</param> /// <param name="projection">The projection matrix that the model should be drawn in.</param> public static void DrawModel(Model model, Matrix world, Matrix view, Matrix projection) { Contract.Requires(model != null); Contract.Requires(world != null); Contract.Requires(view != null); Contract.Requires(projection != null); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = world; effect.View = view; effect.Projection = projection; } mesh.Draw(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace MonoGameUtils.Drawing { /// <summary> /// Various useful utility methods that don't obviously go elsewhere. /// </summary> public static class Utilities { /// <summary> /// Draw the provided model in the world, given the provided matrices. /// </summary> /// <param name="model">The model to draw.</param> /// <param name="world">The world matrix that the model should be drawn in.</param> /// <param name="view">The view matrix that the model should be drawn in.</param> /// <param name="projection">The projection matrix that the model should be drawn in.</param> public static void DrawModel(Model model, Matrix world, Matrix view, Matrix projection) { foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = world; effect.View = view; effect.Projection = projection; } mesh.Draw(); } } } }
mit
C#
d23dcca633011da837bafe5eea2ef2cb8b3fc248
Update version number.
Damnae/storybrew
editor/Properties/AssemblyInfo.cs
editor/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("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // 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.12.*")]
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("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // 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.11.*")]
mit
C#
1f227cf9bd7d889df87eec56595b31752548c8af
add #if UNITY_EDITOR
zhaoqingqing/UGUIDemo
Assets/Function/ChangeSprite/Scripts/UGUICreateSpriteAsset.cs
Assets/Function/ChangeSprite/Scripts/UGUICreateSpriteAsset.cs
using UnityEngine; using System.Collections; using System.IO; using System.Collections.Generic; #if UNITY_EDITOR using UnityEditor; public static class UGUICreateSpriteAsset { [MenuItem("Assets/Create/UGUI Sprite Asset", false, 10)] static void main() { Object target = Selection.activeObject; if (target == null || target.GetType() != typeof(Texture2D)) return; Texture2D sourceTex = target as Texture2D;         //整体路径         string filePathWithName = AssetDatabase.GetAssetPath(sourceTex);         //带后缀的文件名         string fileNameWithExtension = Path.GetFileName(filePathWithName);         //不带后缀的文件名         string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePathWithName);         //不带文件名的路径         string filePath = filePathWithName.Replace(fileNameWithExtension, ""); UGUISpriteAsset spriteAsset = AssetDatabase.LoadAssetAtPath(filePath + fileNameWithoutExtension + ".asset", typeof(UGUISpriteAsset)) as UGUISpriteAsset; bool isNewAsset = spriteAsset == null ? true : false; if (isNewAsset) { spriteAsset = ScriptableObject.CreateInstance<UGUISpriteAsset>(); spriteAsset.texSource = sourceTex; spriteAsset.listSpriteAssetInfor = GetSpritesInfor(sourceTex); AssetDatabase.CreateAsset(spriteAsset, filePath + fileNameWithoutExtension + ".asset"); } } public static List<SpriteAssetInfor> GetSpritesInfor(Texture2D tex) { List<SpriteAssetInfor> m_sprites = new List<SpriteAssetInfor>(); string filePath = UnityEditor.AssetDatabase.GetAssetPath(tex); Object[] objects = UnityEditor.AssetDatabase.LoadAllAssetsAtPath(filePath); for (int i = 0; i < objects.Length; i++) { if (objects[i].GetType() == typeof(Sprite)) { SpriteAssetInfor temp = new SpriteAssetInfor(); Sprite sprite = objects[i] as Sprite; temp.ID = i; temp.name = sprite.name; temp.pivot = sprite.pivot; temp.rect = sprite.rect; temp.sprite = sprite; m_sprites.Add(temp); } } return m_sprites; } } #endif
using UnityEngine; using UnityEditor; using System.Collections; using System.IO; using System.Collections.Generic; public static class UGUICreateSpriteAsset { [MenuItem("Assets/Create/UGUI Sprite Asset", false, 10)] static void main() { Object target = Selection.activeObject; if (target == null || target.GetType() != typeof(Texture2D)) return; Texture2D sourceTex = target as Texture2D;         //整体路径         string filePathWithName = AssetDatabase.GetAssetPath(sourceTex);         //带后缀的文件名         string fileNameWithExtension = Path.GetFileName(filePathWithName);         //不带后缀的文件名         string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePathWithName);         //不带文件名的路径         string filePath = filePathWithName.Replace(fileNameWithExtension, ""); UGUISpriteAsset spriteAsset = AssetDatabase.LoadAssetAtPath(filePath + fileNameWithoutExtension + ".asset", typeof(UGUISpriteAsset)) as UGUISpriteAsset; bool isNewAsset = spriteAsset == null ? true : false; if (isNewAsset) { spriteAsset = ScriptableObject.CreateInstance<UGUISpriteAsset>(); spriteAsset.texSource = sourceTex; spriteAsset.listSpriteAssetInfor = GetSpritesInfor(sourceTex); AssetDatabase.CreateAsset(spriteAsset, filePath + fileNameWithoutExtension + ".asset"); } } public static List<SpriteAssetInfor> GetSpritesInfor(Texture2D tex) { List<SpriteAssetInfor> m_sprites = new List<SpriteAssetInfor>(); string filePath = UnityEditor.AssetDatabase.GetAssetPath(tex); Object[] objects = UnityEditor.AssetDatabase.LoadAllAssetsAtPath(filePath); for (int i = 0; i < objects.Length; i++) { if (objects[i].GetType() == typeof(Sprite)) { SpriteAssetInfor temp = new SpriteAssetInfor(); Sprite sprite = objects[i] as Sprite; temp.ID = i; temp.name = sprite.name; temp.pivot = sprite.pivot; temp.rect = sprite.rect; temp.sprite = sprite; m_sprites.Add(temp); } } return m_sprites; } }
apache-2.0
C#
d829665fed544d113f72a85b63b41cab9a39712b
Update UtilizeThemeColors.cs
maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.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,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET
Examples/CSharp/Formatting/Excel2007Themes/UtilizeThemeColors.cs
Examples/CSharp/Formatting/Excel2007Themes/UtilizeThemeColors.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Formatting.Excel2007Themes { public class UtilizeThemeColors { public static void Main(string[] args) { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create directory if it is not already present. bool IsExists = System.IO.Directory.Exists(dataDir); if (!IsExists) System.IO.Directory.CreateDirectory(dataDir); //Instantiate a Workbook. Workbook workbook = new Workbook(); //Get cells collection in the first (default) worksheet. Cells cells = workbook.Worksheets[0].Cells; //Get the D3 cell. Aspose.Cells.Cell c = cells["D3"]; //Get the style of the cell. Style s = c.GetStyle(); //Set foreground color for the cell from the default theme Accent2 color. s.ForegroundThemeColor = new ThemeColor(ThemeColorType.Accent2, 0.5); //Set the pattern type. s.Pattern = BackgroundType.Solid; //Get the font for the style. Aspose.Cells.Font f = s.Font; //Set the theme color. f.ThemeColor = new ThemeColor(ThemeColorType.Accent4, 0.1); //Apply style. c.SetStyle(s); //Put a value. c.PutValue("Testing1"); //Save the excel file. workbook.Save(dataDir + "output.out.xlsx"); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Formatting.Excel2007Themes { public class UtilizeThemeColors { public static void Main(string[] args) { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create directory if it is not already present. bool IsExists = System.IO.Directory.Exists(dataDir); if (!IsExists) System.IO.Directory.CreateDirectory(dataDir); //Instantiate a Workbook. Workbook workbook = new Workbook(); //Get cells collection in the first (default) worksheet. Cells cells = workbook.Worksheets[0].Cells; //Get the D3 cell. Aspose.Cells.Cell c = cells["D3"]; //Get the style of the cell. Style s = c.GetStyle(); //Set foreground color for the cell from the default theme Accent2 color. s.ForegroundThemeColor = new ThemeColor(ThemeColorType.Accent2, 0.5); //Set the pattern type. s.Pattern = BackgroundType.Solid; //Get the font for the style. Aspose.Cells.Font f = s.Font; //Set the theme color. f.ThemeColor = new ThemeColor(ThemeColorType.Accent4, 0.1); //Apply style. c.SetStyle(s); //Put a value. c.PutValue("Testing1"); //Save the excel file. workbook.Save(dataDir + "output.out.xlsx"); } } }
mit
C#
c595e969c62a16e028a1c7ac8ace1bb8bcf1cc48
Clean up and add comments
gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT
LINQToTTree/LINQToTTreeLib/Statements/StatementRecordIndicies.cs
LINQToTTree/LINQToTTreeLib/Statements/StatementRecordIndicies.cs
 using System.Collections.Generic; using LinqToTTreeInterfacesLib; using LINQToTTreeLib.Variables; namespace LINQToTTreeLib.Statements { /// <summary> /// Sits inside a loop and records the integer that it is given on each call by pushing it onto a vector. It *does not* /// check for uniqueness of that integer that is pushed on - this is pretty simple. The vector it is pushing onto should /// be declared at an outter level to be of any use. :-) /// </summary> class StatementRecordIndicies : IStatement { /// <summary> /// The integer to record /// </summary> private IValue _intToRecord; /// <summary> /// The array to be storing things in /// </summary> private Variables.VarArray _storageArray; /// <summary> /// Create a statement that will record this index into this array each time through. /// </summary> /// <param name="intToRecord">Integer that should be cached on each time through</param> /// <param name="storageArray">The array where the indicies should be written</param> public StatementRecordIndicies(IValue intToRecord, VarArray storageArray) { _intToRecord = intToRecord; _storageArray = storageArray; } /// <summary> /// Returns a IValue that represents /// </summary> public IValue HolderArray { get; private set; } /// <summary> /// Return the code for this statement. /// </summary> /// <returns></returns> public IEnumerable<string> CodeItUp() { yield return string.Format("{0}.push_back({1});", _storageArray.RawValue, _intToRecord.RawValue); } } }
 using System.Collections.Generic; using LinqToTTreeInterfacesLib; namespace LINQToTTreeLib.Statements { /// <summary> /// Sits inside a loop and records the integer that it is given on each call by pushing it onto a vector. It *does not* /// check for uniqueness. /// </summary> class StatementRecordIndicies : IStatement { private LinqToTTreeInterfacesLib.IValue iValue; private Variables.VarArray arrayRecord; /// <summary> /// Create a statement that will record this index into this array each time through. /// </summary> /// <param name="iValue"></param> /// <param name="arrayRecord"></param> public StatementRecordIndicies(IValue iValue, Variables.VarArray arrayRecord) { // TODO: Complete member initialization this.iValue = iValue; this.arrayRecord = arrayRecord; } /// <summary> /// Returns a IValue that represents /// </summary> public IValue HolderArray { get; private set; } /// <summary> /// Return the code for this statement. /// </summary> /// <returns></returns> public IEnumerable<string> CodeItUp() { yield return string.Format("{0}.push_back({1});", arrayRecord.RawValue, iValue.RawValue); } } }
lgpl-2.1
C#
8a8185327901006ad0bf959c1aed103a2b6b804e
Fix ruby test.
exKAZUu/Code2Xml,exKAZUu/Code2Xml,exKAZUu/Code2Xml,exKAZUu/Code2Xml
Code2Xml.Languages.Ruby18.Tests/Ruby18CodeToXmlTest.cs
Code2Xml.Languages.Ruby18.Tests/Ruby18CodeToXmlTest.cs
#region License // Copyright (C) 2011-2012 Kazunori Sakamoto // // 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.IO; using Code2Xml.Core.Tests; using Code2Xml.Languages.Ruby18.CodeToXmls; using IronRuby; using NUnit.Framework; namespace Code2Xml.Languages.Ruby18.Tests { [TestFixture] public class Ruby18CodeToXmlTest { [Test] public void コードを解析できる() { Ruby18CodeToXml.Instance.Generate("p 1"); //var path = Fixture.GetInputPath( // "Ruby18", "block.rb"); //Ruby18CodeToXml.Instance.GenerateFromFile(path, true); } [Test] public void InvokeRubyScript() { var DirectoryPath = Path.Combine( "ParserScripts", "IronRubyParser"); var engine = Ruby.CreateEngine(); // ir.exe.config を参照のこと engine.SetSearchPaths( new[] { DirectoryPath, }); var scope = engine.CreateScope(); var source = engine.CreateScriptSourceFromFile(Path.Combine(DirectoryPath, "parser.rb")); source.Execute(scope); } } }
#region License // Copyright (C) 2011-2012 Kazunori Sakamoto // // 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.IO; using Code2Xml.Core.Tests; using Code2Xml.Languages.Ruby18.CodeToXmls; using IronRuby; using NUnit.Framework; namespace Code2Xml.Languages.Ruby18.Tests { [TestFixture] public class Ruby18CodeToXmlTest { [Test] public void コードを解析できる() { Ruby18CodeToXml.Instance.Generate("a = 1"); //var path = Fixture.GetInputPath( // "Ruby18", "block.rb"); //Ruby18CodeToXml.Instance.GenerateFromFile(path, true); } [Test] public void InvokeRubyScript() { var DirectoryPath = Path.Combine( "ParserScripts", "IronRubyParser"); var engine = Ruby.CreateEngine(); // ir.exe.config を参照のこと engine.SetSearchPaths( new[] { DirectoryPath, }); var scope = engine.CreateScope(); var source = engine.CreateScriptSourceFromFile(Path.Combine(DirectoryPath, "parser.rb")); source.Execute(scope); } } }
apache-2.0
C#
f600066dbcd4f95efb6d6c621b45c576edbbf4da
Remove unused code bits
mzxgiant/CryptInject
CryptInject.BasicExample/DataObjectInstanceContract.cs
CryptInject.BasicExample/DataObjectInstanceContract.cs
using System.Runtime.Serialization; namespace CryptInject.BasicExample { [DataContract] [SerializerRedirect(typeof(DataContractAttribute))] public class DataObjectInstanceContract { [SerializerRedirect(typeof(DataMemberAttribute))] [Encryptable("Sensitive Information")] public virtual int Integer { get; set; } [SerializerRedirect(typeof(DataMemberAttribute))] [Encryptable("Non-Sensitive Information")] public virtual string String { get; set; } [OnDeserializing] void OnDeserializing(StreamingContext c) { this.Relink(); } } }
using System.Runtime.Serialization; namespace CryptInject.BasicExample { [DataContract] //[KnownType(typeof(InnerObjectContract))] [SerializerRedirect(typeof(DataContractAttribute))] public class DataObjectInstanceContract { //[DataMember] //public InnerObjectContract Member { get; set; } [SerializerRedirect(typeof(DataMemberAttribute))] [Encryptable("Sensitive Information")] public virtual int Integer { get; set; } [SerializerRedirect(typeof(DataMemberAttribute))] [Encryptable("Non-Sensitive Information")] public virtual string String { get; set; } [OnDeserializing] void OnDeserializing(StreamingContext c) { this.Relink(); } } //[DataContract] //[SerializerRedirect(typeof(DataContractAttribute))] //public class InnerObjectContract //{ // [SerializerRedirect(typeof(DataMemberAttribute))] // [Encryptable("Semi-Sensitive Information")] // public virtual string HelloStr { get; set; } //} }
mit
C#
0ccc84ae524948c135e00b60f224ce3f754dad91
modify Editor
degarashi0913/FAManagementStudio
FAManagementStudio.Controls/Controls/BindableEditor.cs
FAManagementStudio.Controls/Controls/BindableEditor.cs
using ICSharpCode.AvalonEdit; using ICSharpCode.AvalonEdit.Highlighting; using ICSharpCode.AvalonEdit.Highlighting.Xshd; using System; using System.Windows; using System.Xml; namespace FAManagementStudio.Controls { public class BindableEditor : TextEditor { public BindableEditor() { Uri fileUri = new Uri("pack://application:,,,/FAManagementStudio.Controls;component/files/sql.xshd", UriKind.Absolute); try { using (var reader = new XmlTextReader(Application.GetResourceStream(fileUri).Stream)) { this.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance); } } catch //放置 { } } public new string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } } internal string baseText { get { return base.Text; } set { base.Text = value; } } public static DependencyProperty TextProperty = DependencyProperty.Register(nameof(Text), typeof(string), typeof(BindableEditor), new PropertyMetadata(string.Empty, (obj, args) => { var target = (BindableEditor)obj; if (target.baseText != (string)args.NewValue) target.baseText = (string)args.NewValue; }) ); protected override void OnTextChanged(EventArgs e) { if (Text != baseText) { SetValue(TextProperty, baseText); } base.OnTextChanged(e); } } }
using ICSharpCode.AvalonEdit; using ICSharpCode.AvalonEdit.Highlighting; using ICSharpCode.AvalonEdit.Highlighting.Xshd; using System; using System.Windows; using System.Xml; namespace FAManagementStudio.Controls { public class BindableEditor : TextEditor { public BindableEditor() { Uri fileUri = new Uri("pack://application:,,,/FAManagementStudio.Controls;component/files/sql.xshd", UriKind.Absolute); try { using (var reader = new XmlTextReader(Application.GetResourceStream(fileUri).Stream)) { this.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance); } } catch //放置 { } } public new string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } } internal string baseText { get { return base.Text; } set { base.Text = value; } } public static DependencyProperty TextProperty = DependencyProperty.Register(nameof(Text), typeof(string), typeof(BindableEditor), new PropertyMetadata((obj, args) => { var target = (BindableEditor)obj; if (target.baseText != (string)args.NewValue) target.baseText = (string)args.NewValue; }) ); protected override void OnTextChanged(EventArgs e) { if (Text != null && Text != baseText) { SetValue(TextProperty, baseText); } base.OnTextChanged(e); } } }
mit
C#
5800a2306678cdf3cda71dd1351b5fe4b7423538
Check validity if the ImageView before trying to access its Drawable
luberda-molinet/FFImageLoading,daniel-luberda/FFImageLoading,petlack/FFImageLoading,kalarepa/FFImageLoading,AndreiMisiukevich/FFImageLoading,molinch/FFImageLoading
FFImageLoading.Droid/Extensions/ImageViewExtensions.cs
FFImageLoading.Droid/Extensions/ImageViewExtensions.cs
using Android.Widget; using FFImageLoading.Work; using System; namespace FFImageLoading.Extensions { public static class ImageViewExtensions { /// <summary> /// Retrieve the currently active work task (if any) associated with this imageView. /// </summary> /// <param name="imageView"></param> /// <returns></returns> public static ImageLoaderTask GetImageLoaderTask(this ImageView imageView) { if (imageView == null || imageView.Handle == IntPtr.Zero) return null; var drawable = imageView.Drawable; var asyncDrawable = drawable as AsyncDrawable; if (asyncDrawable != null) { return asyncDrawable.GetImageLoaderTask(); } return null; } } }
using Android.Widget; using FFImageLoading.Work; namespace FFImageLoading.Extensions { public static class ImageViewExtensions { /// <summary> /// Retrieve the currently active work task (if any) associated with this imageView. /// </summary> /// <param name="imageView"></param> /// <returns></returns> public static ImageLoaderTask GetImageLoaderTask(this ImageView imageView) { if (imageView == null) return null; var drawable = imageView.Drawable; var asyncDrawable = drawable as AsyncDrawable; if (asyncDrawable != null) { return asyncDrawable.GetImageLoaderTask(); } return null; } } }
mit
C#
90bc34ef2d4db69429ab5b70063f76b3f800b5f0
Add Move(string, string, Players) constructor
ProgramFOX/Chess.NET
ChessDotNet/Move.cs
ChessDotNet/Move.cs
namespace ChessDotNet { public class Move { public Position OriginalPosition { get; private set; } public Position NewPosition { get; private set; } public Players Player { get; private set; } public Move(Position originalPos, Position newPos, Players player) { OriginalPosition = originalPos; NewPosition = newPos; Player = player; } public Move(string originalPos, string newPos, Players player) { OriginalPosition = new Position(originalPos); NewPosition = new Position(newPos); Player = player; } public override bool Equals(object obj) { Move m1 = this; Move m2 = (Move)obj; return m1.OriginalPosition.Equals(m2.OriginalPosition) && m1.NewPosition.Equals(m2.NewPosition) && m1.Player == m2.Player; } public override int GetHashCode() { return new { OriginalPosition, NewPosition, Player }.GetHashCode(); } public static bool operator ==(Move m1, Move m2) { return m1.Equals(m2); } public static bool operator !=(Move m1, Move m2) { return !m1.Equals(m2); } } }
namespace ChessDotNet { public class Move { public Position OriginalPosition { get; } public Position NewPosition { get; } public Players Player { get; } public Move(Position originalPos, Position newPos, Players player) { OriginalPosition = originalPos; NewPosition = newPos; Player = player; } public override bool Equals(object obj) { Move m1 = this; Move m2 = (Move)obj; return m1.OriginalPosition.Equals(m2.OriginalPosition) && m1.NewPosition.Equals(m2.NewPosition) && m1.Player == m2.Player; } public override int GetHashCode() { return new { OriginalPosition, NewPosition, Player }.GetHashCode(); } public static bool operator ==(Move m1, Move m2) { return m1.Equals(m2); } public static bool operator !=(Move m1, Move m2) { return !m1.Equals(m2); } } }
mit
C#
1336749aaa903361c01b51590f3e1e965a1aeb28
Revert reversion
feliwir/openSage,feliwir/openSage
src/OpenSage.Game/Gui/Wnd/Images/Image.cs
src/OpenSage.Game/Gui/Wnd/Images/Image.cs
using System; using OpenSage.Mathematics; using Veldrid; using Rectangle = OpenSage.Mathematics.Rectangle; namespace OpenSage.Gui.Wnd.Images { public sealed class Image { private readonly ImageSource _source; private readonly bool _grayscale; private Texture _texture; private Size _size; public string Name { get; } public Size NaturalSize => _source.NaturalSize; internal Image(string name, ImageSource source, bool grayscale = false) { Name = name; _source = source; _grayscale = grayscale; } internal void SetSize(in Size size) { var actualSize = _source.NaturalSize.Width > size.Width ? _source.NaturalSize : size; if (_size == actualSize) { return; } _texture = _source.GetTexture(actualSize); if(size.Width == 0 || size.Height == 0) { return; } if (_texture == null) { throw new InvalidOperationException(); } _size = actualSize; } public Image WithGrayscale(bool grayscale) { return new Image(Name, _source, grayscale); } internal void Draw(DrawingContext2D drawingContext, in Rectangle destinationRect) { if (_texture == null) { throw new InvalidOperationException(); } drawingContext.DrawImage(_texture, null, destinationRect, grayscale: _grayscale); } } }
using System; using OpenSage.Mathematics; using Veldrid; using Rectangle = OpenSage.Mathematics.Rectangle; namespace OpenSage.Gui.Wnd.Images { public sealed class Image { private readonly ImageSource _source; private readonly bool _grayscale; private Texture _texture; private Size _size; public string Name { get; } public Size NaturalSize => _source.NaturalSize; internal Image(string name, ImageSource source, bool grayscale = false) { Name = name; _source = source; _grayscale = grayscale; } internal void SetSize(in Size size) { var actualSize = _source.NaturalSize.Width > size.Width ? _source.NaturalSize : size; if (_size == actualSize) { return; } _texture = _source.GetTexture(size); if(size.Width == 0 || size.Height == 0) { return; } if (_texture == null) { throw new InvalidOperationException(); } _size = actualSize; } public Image WithGrayscale(bool grayscale) { return new Image(Name, _source, grayscale); } internal void Draw(DrawingContext2D drawingContext, in Rectangle destinationRect) { if (_texture == null) { throw new InvalidOperationException(); } drawingContext.DrawImage(_texture, null, destinationRect, grayscale: _grayscale); } } }
mit
C#
348f8c5d9b3c7ed599fcfe0f17a9d67d291aaa5b
Allow specifying a custom MemoryAllocator in ArrayPoolTextureUploads
smoogipooo/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework
osu.Framework/Graphics/Textures/ArrayPoolTextureUpload.cs
osu.Framework/Graphics/Textures/ArrayPoolTextureUpload.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Buffers; using osu.Framework.Graphics.Primitives; using osuTK.Graphics.ES30; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; namespace osu.Framework.Graphics.Textures { public class ArrayPoolTextureUpload : ITextureUpload { public Span<Rgba32> RawData => memoryOwner.Memory.Span; public ReadOnlySpan<Rgba32> Data => RawData; private readonly IMemoryOwner<Rgba32> memoryOwner; /// <summary> /// The target mipmap level to upload into. /// </summary> public int Level { get; set; } /// <summary> /// The texture format for this upload. /// </summary> public virtual PixelFormat Format => PixelFormat.Rgba; /// <summary> /// The target bounds for this upload. If not specified, will assume to be (0, 0, width, height). /// </summary> public RectangleI Bounds { get; set; } /// <summary> /// Create an empty raw texture with an efficient shared memory backing. /// </summary> /// <param name="width">The width of the texture.</param> /// <param name="height">The height of the texture.</param> /// <param name="memoryAllocator">The source to retrieve memory from. Shared default is used if null.</param> public ArrayPoolTextureUpload(int width, int height, MemoryAllocator memoryAllocator = null) { memoryOwner = (memoryAllocator ?? SixLabors.ImageSharp.Configuration.Default.MemoryAllocator).Allocate<Rgba32>(width * height); } // ReSharper disable once ConvertToAutoPropertyWithPrivateSetter public bool HasBeenUploaded => disposed; #region IDisposable Support #pragma warning disable IDE0032 // Use auto property private bool disposed; #pragma warning restore IDE0032 // Use auto property protected virtual void Dispose(bool disposing) { if (!disposed) { disposed = true; memoryOwner.Dispose(); } } ~ArrayPoolTextureUpload() { Dispose(false); } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Buffers; using osu.Framework.Graphics.Primitives; using osuTK.Graphics.ES30; using SixLabors.ImageSharp.PixelFormats; namespace osu.Framework.Graphics.Textures { public class ArrayPoolTextureUpload : ITextureUpload { public Span<Rgba32> RawData => memoryOwner.Memory.Span; public ReadOnlySpan<Rgba32> Data => RawData; private readonly IMemoryOwner<Rgba32> memoryOwner; /// <summary> /// The target mipmap level to upload into. /// </summary> public int Level { get; set; } /// <summary> /// The texture format for this upload. /// </summary> public virtual PixelFormat Format => PixelFormat.Rgba; /// <summary> /// The target bounds for this upload. If not specified, will assume to be (0, 0, width, height). /// </summary> public RectangleI Bounds { get; set; } /// <summary> /// Create an empty raw texture with an efficient shared memory backing. /// </summary> /// <param name="width">The width of the texture.</param> /// <param name="height">The height of the texture.</param> public ArrayPoolTextureUpload(int width, int height) { memoryOwner = SixLabors.ImageSharp.Configuration.Default.MemoryAllocator.Allocate<Rgba32>(width * height); } // ReSharper disable once ConvertToAutoPropertyWithPrivateSetter public bool HasBeenUploaded => disposed; #region IDisposable Support #pragma warning disable IDE0032 // Use auto property private bool disposed; #pragma warning restore IDE0032 // Use auto property protected virtual void Dispose(bool disposing) { if (!disposed) { disposed = true; memoryOwner.Dispose(); } } ~ArrayPoolTextureUpload() { Dispose(false); } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion } }
mit
C#
5444ab76fa1cebbd3b6ecfe595741bdce68a2ba6
fix '
ChizhovYuI/tasks
Eval/EvalProgram.cs
Eval/EvalProgram.cs
using System; using System.Linq; namespace EvalTask { class EvalProgram { static void Main(string[] args) { string input = Console.In.ReadToEnd(); var lines = input.Split(new[] {'\r', '\n'}, StringSplitOptions.RemoveEmptyEntries); var expr = lines[0].Replace(",", ".").Replace("'",""); var json = string.Join("", lines.Skip(1)); try { string output = new ExpressionEvaluator().Evaluate(expr, json); Console.WriteLine(output); } catch (Exception) { Console.WriteLine("error"); } } } }
using System; using System.Linq; namespace EvalTask { class EvalProgram { static void Main(string[] args) { string input = Console.In.ReadToEnd(); var lines = input.Split(new[] {'\r', '\n'}, StringSplitOptions.RemoveEmptyEntries); var expr = lines[0].Replace(",", "."); var json = string.Join("", lines.Skip(1)); try { string output = new ExpressionEvaluator().Evaluate(expr, json); Console.WriteLine(output); } catch (Exception) { Console.WriteLine("error"); } } } }
mit
C#
defaba820615bfe17e567087087703af3862e20c
Convert relative path into full path
AArnott/Nerdbank.GitVersioning,AArnott/Nerdbank.GitVersioning,AArnott/Nerdbank.GitVersioning
src/Cake.GitVersioning/GitVersioningAliases.cs
src/Cake.GitVersioning/GitVersioningAliases.cs
using System.IO; using System.Reflection; using Cake.Core; using Cake.Core.Annotations; using Nerdbank.GitVersioning; namespace Cake.GitVersioning { /// <summary> /// Contains functionality for using Nerdbank.GitVersioning. /// </summary> [CakeAliasCategory("Git Versioning")] public static class GitVersioningAliases { /// <summary> /// Gets the Git Versioning version from the current repo. /// </summary> /// <example> /// Task("GetVersion") /// .Does(() => /// { /// Information(GetVersioningGetVersion().SemVer2) /// }); /// </example> /// <param name="context">The context.</param> /// <param name="projectDirectory">Directory to start the search for version.json.</param> /// <returns>The version information from Git Versioning.</returns> [CakeMethodAlias] public static VersionOracle GitVersioningGetVersion(this ICakeContext context, string projectDirectory = ".") { var fullProjectDirectory = (new DirectoryInfo(projectDirectory)).FullName; GitExtensions.HelpFindLibGit2NativeBinaries(Path.GetDirectoryName(Assembly.GetAssembly(typeof(GitVersioningAliases)).Location)); return VersionOracle.Create(fullProjectDirectory, null, CloudBuild.Active); } } }
using System.IO; using System.Reflection; using Cake.Core; using Cake.Core.Annotations; using Nerdbank.GitVersioning; namespace Cake.GitVersioning { /// <summary> /// Contains functionality for using Nerdbank.GitVersioning. /// </summary> [CakeAliasCategory("Git Versioning")] public static class GitVersioningAliases { /// <summary> /// Gets the Git Versioning version from the current repo. /// </summary> /// <example> /// Task("GetVersion") /// .Does(() => /// { /// Information(GetVersioningGetVersion().SemVer2) /// }); /// </example> /// <param name="context">The context.</param> /// <param name="projectDirectory">Directory to start the search for version.json.</param> /// <returns>The version information from Git Versioning.</returns> [CakeMethodAlias] public static VersionOracle GitVersioningGetVersion(this ICakeContext context, string projectDirectory = ".") { GitExtensions.HelpFindLibGit2NativeBinaries(Path.GetDirectoryName(Assembly.GetAssembly(typeof(GitVersioningAliases)).Location)); return VersionOracle.Create(projectDirectory, null, CloudBuild.Active); } } }
mit
C#
f8b84625e83c475d56ed27fb1a9ca8d987e48e93
Fix #459 - Removed call to HttpContext.Request in favor of HttpRuntime.AppDomainAppVirtualPath
SusanaL/Glimpse,Glimpse/Glimpse,paynecrl97/Glimpse,flcdrg/Glimpse,dudzon/Glimpse,sorenhl/Glimpse,flcdrg/Glimpse,codevlabs/Glimpse,elkingtonmcb/Glimpse,codevlabs/Glimpse,SusanaL/Glimpse,paynecrl97/Glimpse,rho24/Glimpse,gabrielweyer/Glimpse,rho24/Glimpse,Glimpse/Glimpse,rho24/Glimpse,sorenhl/Glimpse,elkingtonmcb/Glimpse,rho24/Glimpse,paynecrl97/Glimpse,gabrielweyer/Glimpse,codevlabs/Glimpse,elkingtonmcb/Glimpse,SusanaL/Glimpse,dudzon/Glimpse,sorenhl/Glimpse,Glimpse/Glimpse,paynecrl97/Glimpse,flcdrg/Glimpse,dudzon/Glimpse,gabrielweyer/Glimpse
source/Glimpse.AspNet/HttpHandlerEndpointConfiguration.cs
source/Glimpse.AspNet/HttpHandlerEndpointConfiguration.cs
using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using Glimpse.Core.Extensibility; using Glimpse.Core.Framework; namespace Glimpse.AspNet { public class HttpHandlerEndpointConfiguration : ResourceEndpointConfiguration { private string applicationPath; public string ApplicationPath { get { return applicationPath ?? HttpRuntime.AppDomainAppVirtualPath; } // HttpRuntime call based on http://mvolo.com/iis7-integrated-mode-request-is-not-available-in-this-context-exception-in-applicationstart/ set { applicationPath = value; } } protected override string GenerateUriTemplate(string resourceName, string baseUri, IEnumerable<ResourceParameterMetadata> parameters, ILogger logger) { var root = VirtualPathUtility.ToAbsolute(baseUri, ApplicationPath); var stringBuilder = new StringBuilder(string.Format(@"{0}?n={1}", root, resourceName)); var requiredParams = parameters.Where(p => p.IsRequired); foreach (var parameter in requiredParams) { stringBuilder.Append(string.Format("&{0}={{{1}}}", parameter.Name, parameter.Name)); } var optionalParams = parameters.Except(requiredParams).Select(p => p.Name).ToArray(); // Format based on Form-style query continuation from RFC6570: http://tools.ietf.org/html/rfc6570#section-3.2.9 if (optionalParams.Any()) { stringBuilder.Append(string.Format("{{&{0}}}", string.Join(",", optionalParams))); } return stringBuilder.ToString(); } } }
using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using Glimpse.Core.Extensibility; using Glimpse.Core.Framework; namespace Glimpse.AspNet { public class HttpHandlerEndpointConfiguration : ResourceEndpointConfiguration { private string applicationPath; public string ApplicationPath { get { return applicationPath ?? HttpContext.Current.Request.ApplicationPath; } set { applicationPath = value; } } protected override string GenerateUriTemplate(string resourceName, string baseUri, IEnumerable<ResourceParameterMetadata> parameters, ILogger logger) { var root = VirtualPathUtility.ToAbsolute(baseUri, ApplicationPath); var stringBuilder = new StringBuilder(string.Format(@"{0}?n={1}", root, resourceName)); var requiredParams = parameters.Where(p => p.IsRequired); foreach (var parameter in requiredParams) { stringBuilder.Append(string.Format("&{0}={{{1}}}", parameter.Name, parameter.Name)); } var optionalParams = parameters.Except(requiredParams).Select(p => p.Name).ToArray(); // Format based on Form-style query continuation from RFC6570: http://tools.ietf.org/html/rfc6570#section-3.2.9 if (optionalParams.Any()) { stringBuilder.Append(string.Format("{{&{0}}}", string.Join(",", optionalParams))); } return stringBuilder.ToString(); } } }
apache-2.0
C#
64f93f3917947e710a9102d26922884ce22d2e64
Add task hooks for integration tests
vCipher/Cake.Hg
setup.cake
setup.cake
#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease Environment.SetVariableNames(); BuildParameters.SetParameters(context: Context, buildSystem: BuildSystem, sourceDirectoryPath: "./src", title: "Cake.Hg", repositoryOwner: "cake-contrib", repositoryName: "Cake.Hg", appVeyorAccountName: "cakecontrib", solutionFilePath: "./src/Cake.Hg.sln", shouldRunCodecov: false, shouldRunDotNetCorePack: true, shouldRunIntegrationTests: true, wyamSourceFiles: "../../src/**/{!bin,!obj,!packages,!*Tests,}/**/*.cs"); BuildParameters.PrintParameters(Context); ToolSettings.SetToolSettings(context: Context); Task("Unzip-Addin") .IsDependentOn("Package") .Does(() => { var addin = BuildParameters.Title; var semVersion = BuildParameters.Version.SemVersion; var nugetRoot = BuildParameters.Paths.Directories.NuGetPackages; var package = $"{nugetRoot}/{addin}.{semVersion}.nupkg"; var addinDir = MakeAbsolute(Directory($"./tools/Addins/{addin}/{addin}")); if (DirectoryExists(addinDir)) { DeleteDirectory(addinDir, new DeleteDirectorySettings { Recursive = true, Force = true }); } Unzip(package, addinDir); }); BuildParameters.Tasks.IntegrationTestTask.IsDependentOn("Unzip-Addin"); BuildParameters.Tasks.PublishMyGetPackagesTask.IsDependentOn("Run-Integration-Tests"); BuildParameters.Tasks.PublishNuGetPackagesTask.IsDependentOn("Run-Integration-Tests"); Build.RunDotNetCore();
#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease Environment.SetVariableNames(); BuildParameters.SetParameters(context: Context, buildSystem: BuildSystem, sourceDirectoryPath: "./src", title: "Cake.Hg", repositoryOwner: "cake-contrib", repositoryName: "Cake.Hg", appVeyorAccountName: "cakecontrib", solutionFilePath: "./src/Cake.Hg.sln", shouldRunCodecov: false, shouldRunDotNetCorePack: true, shouldRunIntegrationTests: true, wyamSourceFiles: "../../src/**/{!bin,!obj,!packages,!*Tests,}/**/*.cs"); BuildParameters.PrintParameters(Context); ToolSettings.SetToolSettings(context: Context); Task("Unzip-Addin") .IsDependentOn("Package") .Does(() => { var addin = BuildParameters.Title; var semVersion = BuildParameters.Version.SemVersion; var nugetRoot = BuildParameters.Paths.Directories.NuGetPackages; var package = $"{nugetRoot}/{addin}.{semVersion}.nupkg"; var addinDir = MakeAbsolute(Directory($"./tools/Addins/{addin}/{addin}")); if (DirectoryExists(addinDir)) { DeleteDirectory(addinDir, new DeleteDirectorySettings { Recursive = true, Force = true }); } Unzip(package, addinDir); }); BuildParameters.Tasks.IntegrationTestTask .IsDependentOn("Unzip-Addin"); Build.RunDotNetCore();
mit
C#
d55f6c10fee7ecb8ef50e7a64e7ca8bc8d8e370c
Add missing ToString implementation
xfleckx/BeMoBI,xfleckx/BeMoBI
Assets/Scripts/DataExtensions.cs
Assets/Scripts/DataExtensions.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace Assets.BeMoBI.Scripts { public static class DataExtensions { public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> collection) { return collection.OrderBy((i) => Guid.NewGuid()); } public static IntVector2 AsIntVector(this Vector2 vector) { return new IntVector2((int)vector.x, (int)vector.y); } public static IntVector3 AsIntVector(this Vector3 vector) { return new IntVector3((int)vector.x, (int)vector.y, (int) vector.z); } } public struct IntVector2 { int x; int y; public IntVector2(int x, int y) { this.x = x; this.y = y; } public override string ToString() { return string.Format("({0} {1})", x, y); } } public struct IntVector3 { int x; int y; int z; public IntVector3(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } public override string ToString() { return string.Format("({0} {1} {2})", x, y, z); } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace Assets.BeMoBI.Scripts { public static class DataExtensions { public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> collection) { return collection.OrderBy((i) => Guid.NewGuid()); } public static IntVector2 AsIntVector(this Vector2 vector) { return new IntVector2((int)vector.x, (int)vector.y); } public static IntVector3 AsIntVector(this Vector3 vector) { return new IntVector3((int)vector.x, (int)vector.y, (int) vector.z); } } public struct IntVector2 { int x; int y; public IntVector2(int x, int y) { this.x = x; this.y = y; } } public struct IntVector3 { int x; int y; int z; public IntVector3(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } } }
mit
C#
5bd9c46558499f3b88bdfb7ad60c8c9da3b7c6b7
Remove unused extensions
SamTheDev/octokit.net,dampir/octokit.net,michaKFromParis/octokit.net,alfhenrik/octokit.net,editor-tools/octokit.net,kdolan/octokit.net,ivandrofly/octokit.net,hahmed/octokit.net,editor-tools/octokit.net,TattsGroup/octokit.net,khellang/octokit.net,rlugojr/octokit.net,Sarmad93/octokit.net,ChrisMissal/octokit.net,nsnnnnrn/octokit.net,gdziadkiewicz/octokit.net,khellang/octokit.net,naveensrinivasan/octokit.net,SmithAndr/octokit.net,thedillonb/octokit.net,bslliw/octokit.net,hahmed/octokit.net,adamralph/octokit.net,octokit-net-test/octokit.net,SamTheDev/octokit.net,brramos/octokit.net,cH40z-Lord/octokit.net,shiftkey/octokit.net,octokit/octokit.net,chunkychode/octokit.net,rlugojr/octokit.net,octokit-net-test-org/octokit.net,kolbasov/octokit.net,Red-Folder/octokit.net,fffej/octokit.net,mminns/octokit.net,takumikub/octokit.net,ivandrofly/octokit.net,shiftkey-tester/octokit.net,darrelmiller/octokit.net,shana/octokit.net,gabrielweyer/octokit.net,nsrnnnnn/octokit.net,alfhenrik/octokit.net,TattsGroup/octokit.net,eriawan/octokit.net,devkhan/octokit.net,shana/octokit.net,yonglehou/octokit.net,M-Zuber/octokit.net,hitesh97/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,fake-organization/octokit.net,yonglehou/octokit.net,dampir/octokit.net,M-Zuber/octokit.net,magoswiat/octokit.net,thedillonb/octokit.net,shiftkey-tester/octokit.net,Sarmad93/octokit.net,SmithAndr/octokit.net,mminns/octokit.net,octokit/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,shiftkey/octokit.net,dlsteuer/octokit.net,geek0r/octokit.net,gabrielweyer/octokit.net,daukantas/octokit.net,gdziadkiewicz/octokit.net,forki/octokit.net,SLdragon1989/octokit.net,devkhan/octokit.net,octokit-net-test-org/octokit.net,chunkychode/octokit.net,eriawan/octokit.net
Burr/Helpers/StringExtensions.cs
Burr/Helpers/StringExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Burr.Helpers { public static class StringExtensions { public static bool IsBlank(this string s) { return string.IsNullOrWhiteSpace(s); } public static bool IsNotBlank(this string s) { return !string.IsNullOrWhiteSpace(s); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Burr.Helpers { public static class StringExtensions { public static bool IsBlank(this string s) { return string.IsNullOrWhiteSpace(s); } public static bool IsNotBlank(this string s) { return !string.IsNullOrWhiteSpace(s); } public static string UrlEncode(this string s) { return Uri.EscapeDataString(s); } } }
mit
C#
b2a9e2a9c29474ebce5513bb2adc329a50152f7d
Clean up the view.
bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes
Orchard.Source.1.8.1/src/Orchard.Web/Modules/LccNetwork/Views/EditorTemplates/Parts/HighlightableItemPart.cshtml
Orchard.Source.1.8.1/src/Orchard.Web/Modules/LccNetwork/Views/EditorTemplates/Parts/HighlightableItemPart.cshtml
@model LccNetwork.Models.HighlightableItemPart @{ var containingType = Model.ContentItem.ContentType; var friendlyContainingType = Model.ContentItem.TypeDefinition.DisplayName; var highlightOptions = new List<SelectListItem>(); highlightOptions.Add(new SelectListItem() { Value = "All", Text = "All" }); highlightOptions.Add(new SelectListItem() { Value = containingType, Text = friendlyContainingType }); } @if (!Model.IsHighlighted) { <fieldset> <span class="checkbox-and-label"> @Html.EditorFor(m => m.IsHighlighted) <label for="@Html.FieldIdFor(m => m.IsHighlighted)" class="forcheckbox">@T("Set as the highlighted item for: ")</label> @Html.DropDownListFor(m => m.HighlightGroup, highlightOptions) content items. </span> <span class="hint">@T("Check to promote this content as a highlighted item.")</span> </fieldset> } else { <span>@T("This is the featured item for {0} content.", Model.HighlightGroup)</span> }
@model LccNetwork.Models.HighlightableItemPart @{ var containingType = Model.ContentItem.ContentType; var friendlyContainingType = Model.ContentItem.TypeDefinition.DisplayName; var highlightOptions = new List<SelectListItem>(); highlightOptions.Add(new SelectListItem() { Value = "All", Text = "All" }); highlightOptions.Add(new SelectListItem() { Value = containingType, Text = friendlyContainingType }); } @if (!Model.IsHighlighted) { <fieldset> <span class="checkbox-and-label"> @Html.EditorFor(m => m.IsHighlighted) <label for="@Html.FieldIdFor(m => m.IsHighlighted)" class="forcheckbox">@T("Set as the highlighted item for: ")</label> </span> @Html.DropDownListFor(m => m.HighlightGroup, highlightOptions) <span class="hint">@T("Check to promote this content as a highlighted item.")</span> </fieldset> } else { <span>@T("This is the featured item for {0} content.", Model.HighlightGroup)</span> }
bsd-3-clause
C#
02aa5b53435563e9270c5894f0c4c25c18fb2f1c
configure jsonSerializer properly
Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate
Magistrate/MagistrateRegistry.cs
Magistrate/MagistrateRegistry.cs
using Ledger; using Magistrate.Infrastructure; using Magistrate.ReadModels; using MediatR; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using StructureMap; using StructureMap.Graph; namespace Magistrate { public class MagistrateRegistry : Registry { public MagistrateRegistry(IEventStore store) { Scan(a => { a.TheCallingAssembly(); a.WithDefaultConventions(); a.AddAllTypesOf(typeof(IRequestHandler<,>)); a.AddAllTypesOf(typeof(INotificationHandler<>)); }); For<SingleInstanceFactory>().Use<SingleInstanceFactory>(ctx => t => ctx.GetInstance(t)); For<MultiInstanceFactory>().Use<MultiInstanceFactory>(ctx => t => ctx.GetAllInstances(t)); For<IMediator>().Use<Mediator>(); Policies.Add<ServicePolicy>(); For<AllCollections>().Singleton(); For<Projectionist>().Singleton(); For<IEventStore>() .Use(context => new ProjectionStore(store, context.GetInstance<Projectionist>().Apply)); For<JsonSerializerSettings>().Use(new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); } } }
using Ledger; using Magistrate.Infrastructure; using Magistrate.ReadModels; using MediatR; using StructureMap; using StructureMap.Graph; namespace Magistrate { public class MagistrateRegistry : Registry { public MagistrateRegistry(IEventStore store) { Scan(a => { a.TheCallingAssembly(); a.WithDefaultConventions(); a.AddAllTypesOf(typeof(IRequestHandler<,>)); a.AddAllTypesOf(typeof(INotificationHandler<>)); }); For<SingleInstanceFactory>().Use<SingleInstanceFactory>(ctx => t => ctx.GetInstance(t)); For<MultiInstanceFactory>().Use<MultiInstanceFactory>(ctx => t => ctx.GetAllInstances(t)); For<IMediator>().Use<Mediator>(); Policies.Add<ServicePolicy>(); For<AllCollections>().Singleton(); For<Projectionist>().Singleton(); For<IEventStore>() .Use(context => new ProjectionStore(store, context.GetInstance<Projectionist>().Apply)); } } }
lgpl-2.1
C#
30f67c086f10814bf533f6970b081f523e9bacf2
Fix for https://github.com/ppittle/pMixins/issues/23 (MaskShouldFilterInterfacesAppliedToTarget)
ppittle/pMixins,ppittle/pMixins,ppittle/pMixins
pMixins.CodeGenerator/Pipelines/GenerateCode/Steps/TargetPartialClassGenerator/AddMixinInterfacesToInterfaceList.cs
pMixins.CodeGenerator/Pipelines/GenerateCode/Steps/TargetPartialClassGenerator/AddMixinInterfacesToInterfaceList.cs
//----------------------------------------------------------------------- // <copyright file="AddMixinInterfacesToInterfaceList.cs" company="Copacetic Software"> // Copyright (c) Copacetic Software. // <author>Philip Pittle</author> // <date>Friday, February 7, 2014 5:32:09 PM</date> // Licensed under the Apache License, Version 2.0, // you may not use this file except in compliance with this 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. // </copyright> //----------------------------------------------------------------------- using System.Linq; using CopaceticSoftware.CodeGenerator.StarterKit.Extensions; using CopaceticSoftware.Common.Patterns; using CopaceticSoftware.pMixins.Attributes; using ICSharpCode.NRefactory.TypeSystem; namespace CopaceticSoftware.pMixins.CodeGenerator.Pipelines.GenerateCode.Steps.TargetPartialClassGenerator { public class AddMixinInterfacesToInterfaceList : IPipelineStep<pMixinGeneratorPipelineState> { public bool PerformTask(pMixinGeneratorPipelineState manager) { var doNotMixinType = typeof (DoNotMixinAttribute) .ToIType(manager.BaseState.Context.TypeResolver.Compilation); var currentMixin = manager.CurrentpMixinAttribute.Mixin; var candidateTypes = //If Masks are defined, only use the masks manager.CurrentpMixinAttribute.Masks.Any() ? manager.CurrentpMixinAttribute.Masks .Union(manager.CurrentpMixinAttribute.Masks.SelectMany(x => x.GetAllBaseTypes())) //otherwise use all base types from mixin : currentMixin .GetDefinition().GetAllBaseTypes(); manager.GeneratedClassInterfaceList.AddRange( candidateTypes .Where(x => x.Kind == TypeKind.Interface && !x.IsDecoratedWithAttribute(doNotMixinType, includeBaseTypes: false)) .Select(x => x.GetOriginalFullNameWithGlobal(currentMixin))); return true; } } }
//----------------------------------------------------------------------- // <copyright file="AddMixinInterfacesToInterfaceList.cs" company="Copacetic Software"> // Copyright (c) Copacetic Software. // <author>Philip Pittle</author> // <date>Friday, February 7, 2014 5:32:09 PM</date> // Licensed under the Apache License, Version 2.0, // you may not use this file except in compliance with this 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. // </copyright> //----------------------------------------------------------------------- using System.Linq; using CopaceticSoftware.CodeGenerator.StarterKit.Extensions; using CopaceticSoftware.Common.Patterns; using CopaceticSoftware.pMixins.Attributes; using ICSharpCode.NRefactory.TypeSystem; namespace CopaceticSoftware.pMixins.CodeGenerator.Pipelines.GenerateCode.Steps.TargetPartialClassGenerator { public class AddMixinInterfacesToInterfaceList : IPipelineStep<pMixinGeneratorPipelineState> { public bool PerformTask(pMixinGeneratorPipelineState manager) { var doNotMixinType = typeof (DoNotMixinAttribute) .ToIType(manager.BaseState.Context.TypeResolver.Compilation); var currentMixin = manager.CurrentpMixinAttribute.Mixin; manager.GeneratedClassInterfaceList.AddRange( currentMixin .GetDefinition().GetAllBaseTypes() .Where(x => x.Kind == TypeKind.Interface && !x.IsDecoratedWithAttribute(doNotMixinType, includeBaseTypes: false)) .Select(x => x.GetOriginalFullNameWithGlobal(currentMixin))); return true; } } }
apache-2.0
C#
2b5ac39d8bf1d1d4cc39dbf664978781372e4f66
Fix UtcDateTimeNowProviderTests
riganti/infrastructure
src/Infrastructure/Tests/Riganti.Utils.Infrastructure.Core.Tests/DateTimeNowProvider/UtcDateTimeNowProviderTests.cs
src/Infrastructure/Tests/Riganti.Utils.Infrastructure.Core.Tests/DateTimeNowProvider/UtcDateTimeNowProviderTests.cs
using System; using Xunit; namespace Riganti.Utils.Infrastructure.Core.Tests.DateTimeNowProvider { public class UtcDateTimeNowProviderTests { readonly UtcDateTimeProvider utcDateTimeProviderSUT = new UtcDateTimeProvider(); [Fact] public void ProvidesUtcTime_Test() { var utcDateTimeNowProviderValue = utcDateTimeProviderSUT.Now; var diff = DateTime.UtcNow - utcDateTimeNowProviderValue; Assert.True(diff < TimeSpan.FromSeconds(1)); } } }
using System; using Xunit; namespace Riganti.Utils.Infrastructure.Core.Tests.DateTimeNowProvider { public class UtcDateTimeNowProviderTests { readonly UtcDateTimeProvider utcDateTimeProviderSUT = new UtcDateTimeProvider(); [Fact] public void ProvidesUtcTime_Test() { var utcDateTimeNowProviderValue = utcDateTimeProviderSUT.Now; Assert.True(DateTime.Compare(utcDateTimeNowProviderValue, DateTime.UtcNow) == 0); } } }
apache-2.0
C#
d8aed10820d45a61c2de7bcfeabe7bff3c58a886
Document credentials fields
Nexmo/csharp-client,Nexmo/nexmo-dotnet,Nexmo/csharp-client
Nexmo.Api/Request/Credentials.cs
Nexmo.Api/Request/Credentials.cs
namespace Nexmo.Api.Request { public class Credentials { /// <summary> /// Nexmo API Key (from your account dashboard) /// </summary> public string ApiKey { get; set; } /// <summary> /// Nexmo API Secret (from your account dashboard) /// </summary> public string ApiSecret { get; set; } /// <summary> /// Signature Secret (from API settings section of your account settings) /// </summary> public string SecuritySecret { get; set; } /// <summary> /// Application ID (GUID) /// </summary> public string ApplicationId { get; set; } /// <summary> /// Application private key contents /// This is the actual key file contents and NOT a path to the key file! /// </summary> public string ApplicationKey { get; set; } /// <summary> /// (Optional) App useragent value to pass with every request /// </summary> public string AppUserAgent { get; set; } } }
namespace Nexmo.Api.Request { public class Credentials { public string ApiKey { get; set; } public string ApiSecret { get; set; } public string SecuritySecret { get; set; } public string ApplicationId { get; set; } public string ApplicationKey { get; set; } // Optional app useragent value to pass with every request public string AppUserAgent { get; set; } } }
mit
C#
114f028295e78e263be48494d6ae15f9fd68db81
Update kod.cs
Juchnowski/testrep
kod.cs
kod.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RozliczeniePracownikow { public class Rozliczenia { public virtual double kosztPrzejazduSamochod(int kilometry, float spalanie, float cenaLitr, float dodatkowe) { return Math.Round((kilometry / 100) * spalanie * cenaLitr + dodatkowe,2); } public decimal chorobowe(int liczbaDni, float wynagrodzenie, float stawkaChorobowa = 0.8f) { return Math.Round((decimal)( (wynagrodzenie*12/360)*liczbaDni*stawkaChorobowa ),1); Console.WriteLine("BLABLABLA"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RozliczeniePracownikow { public class Rozliczenia { public virtual double kosztPrzejazduSamochod(int kilometry, float spalanie, float cenaLitr, float dodatkowe) { return Math.Round((kilometry / 100) * spalanie * cenaLitr + dodatkowe,2); } public decimal chorobowe(int liczbaDni, float wynagrodzenie, float stawkaChorobowa = 0.8f) { return Math.Round((decimal)( (wynagrodzenie*12/360)*liczbaDni*stawkaChorobowa ),1); } } }
mit
C#
5ddcfb93838b5f5673a32e9f7a01e53f52cdf48e
Add prompt
KLab/websocket-unitymobile,KLab/websocket-unitymobile,takuya-andou/websocket-unitymobile,takuya-andou/websocket-unitymobile
EchoClient/Program.cs
EchoClient/Program.cs
using System; using WebSocketSharp; namespace EchoClient { class MainClass { public static void Main (string[] args) { if (args.Length != 1) { Console.WriteLine ("Usage: EchoClient.exe ws://echo.websocket.org"); return; } WebSocket ws = new WebSocket(args[0], null); ws.OnOpen = (Object sender, EventArgs e) => { Console.WriteLine ("Connected"); Console.Write("-> "); }; ws.OnMessage = (Object sender, MessageEventArgs e) => { Console.WriteLine ("<- " + e.Data); Console.Write("-> "); }; ws.OnError = (Object sender, ErrorEventArgs e) => { Console.WriteLine ("ERROR: " + e.Message); Console.Write("-> "); }; ws.OnClose = (Object sender, CloseEventArgs e) => { Console.WriteLine ("Closed " + e.Code + e.Reason + e.WasClean); }; ws.Connect (); while (true) { string line = Console.ReadLine (); ws.Send (line.TrimEnd(new char[] {'\r', '\n'})); } } } }
using System; using WebSocketSharp; namespace EchoClient { class MainClass { public static void Main (string[] args) { if (args.Length != 1) { Console.WriteLine ("Usage: EchoClient.exe ws://echo.websocket.org"); return; } WebSocket ws = new WebSocket(args[0], null); ws.OnOpen = (Object sender, EventArgs e) => { Console.WriteLine ("Connected"); }; ws.OnMessage = (Object sender, MessageEventArgs e) => { Console.WriteLine (e.Data); }; ws.OnError = (Object sender, ErrorEventArgs e) => { Console.WriteLine ("ERROR: " + e.Message); }; ws.OnClose = (Object sender, CloseEventArgs e) => { Console.WriteLine ("Closed " + e.Code + e.Reason + e.WasClean); }; ws.Connect (); while (true) { string line = Console.ReadLine (); ws.Send (line.TrimEnd(new char[] {'\r', '\n'})); } } } }
mit
C#
b5570a0642461723aacb2c6cf9386e8467c958d5
Remove Academic Year Left Of Line Unit Test
SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments
src/SFA.DAS.Commitments.Application.UnitTests/Commands/SharedValidation/Apprenticeships/ValidatingTrainingDates.cs
src/SFA.DAS.Commitments.Application.UnitTests/Commands/SharedValidation/Apprenticeships/ValidatingTrainingDates.cs
using System; using FluentAssertions; using NUnit.Framework; using SFA.DAS.Commitments.Domain.Entities.AcademicYear; using Moq; namespace SFA.DAS.Commitments.Application.UnitTests.Commands.SharedValidation.Apprenticeships { [TestFixture] public sealed class ValidatingTrainingDates : ApprenticeshipValidationTestBase { [Test] public void ShouldBeInvalidIfStartDateBeforeMay2017() { ExampleValidApprenticeship.StartDate = new DateTime(2017, 4, 22); var result = Validator.Validate(ExampleValidApprenticeship); result.IsValid.Should().BeFalse(); } [Test] public void ShouldBeInvalidIfEndDateBeforeStartDate() { ExampleValidApprenticeship.StartDate = new DateTime(2017, 7, 22); ExampleValidApprenticeship.EndDate = new DateTime(2017, 6, 28); var result = Validator.Validate(ExampleValidApprenticeship); result.IsValid.Should().BeFalse(); } [Test] public void ShouldBeInvalidIfEndDateIsTheSameAsStartDate() { ExampleValidApprenticeship.StartDate = new DateTime(2017, 7, 22); ExampleValidApprenticeship.EndDate = new DateTime(2017, 7, 22); var result = Validator.Validate(ExampleValidApprenticeship); result.IsValid.Should().BeFalse(); } [Test] public void ShouldBeInvalidIfEndDateIsInThePast() { ExampleValidApprenticeship.StartDate = new DateTime(2017, 5, 10); ExampleValidApprenticeship.EndDate = new DateTime(2017, 5, 22); var result = Validator.Validate(ExampleValidApprenticeship); result.IsValid.Should().BeFalse(); } } }
using System; using FluentAssertions; using NUnit.Framework; using SFA.DAS.Commitments.Domain.Entities.AcademicYear; using Moq; namespace SFA.DAS.Commitments.Application.UnitTests.Commands.SharedValidation.Apprenticeships { [TestFixture] public sealed class ValidatingTrainingDates : ApprenticeshipValidationTestBase { [Test] public void ShouldBeInvalidIfStartDateBeforeMay2017() { ExampleValidApprenticeship.StartDate = new DateTime(2017, 4, 22); var result = Validator.Validate(ExampleValidApprenticeship); result.IsValid.Should().BeFalse(); } [Test] public void ShouldBeInvalidIfEndDateBeforeStartDate() { ExampleValidApprenticeship.StartDate = new DateTime(2017, 7, 22); ExampleValidApprenticeship.EndDate = new DateTime(2017, 6, 28); var result = Validator.Validate(ExampleValidApprenticeship); result.IsValid.Should().BeFalse(); } [Test] public void ShouldBeInvalidIfEndDateIsTheSameAsStartDate() { ExampleValidApprenticeship.StartDate = new DateTime(2017, 7, 22); ExampleValidApprenticeship.EndDate = new DateTime(2017, 7, 22); var result = Validator.Validate(ExampleValidApprenticeship); result.IsValid.Should().BeFalse(); } [Test] public void ShouldBeInvalidIfEndDateIsInThePast() { ExampleValidApprenticeship.StartDate = new DateTime(2017, 5, 10); ExampleValidApprenticeship.EndDate = new DateTime(2017, 5, 22); var result = Validator.Validate(ExampleValidApprenticeship); result.IsValid.Should().BeFalse(); } [Test] public void ShouldBeInvalidIfAcademicYearValidatorIsNotSucessful() { ExampleValidApprenticeship.StartDate = new DateTime(2017, 7, 22); MockAcademicYearValidator .Setup(x => x.Validate(ExampleValidApprenticeship.StartDate.Value)) .Returns(AcademicYearValidationResult.NotWithinFundingPeriod); var result = Validator.Validate(ExampleValidApprenticeship); MockAcademicYearValidator.Verify(x => x.Validate(ExampleValidApprenticeship.StartDate.Value), Times.AtLeastOnce); result.IsValid.Should().BeFalse(); } } }
mit
C#
2e2f8723a0b704632ab23c04545611ab548e9d5c
Set collections on property groups
gkonings/Umbraco-CMS,rasmuseeg/Umbraco-CMS,KevinJump/Umbraco-CMS,leekelleher/Umbraco-CMS,gavinfaux/Umbraco-CMS,mittonp/Umbraco-CMS,kasperhhk/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,hfloyd/Umbraco-CMS,mittonp/Umbraco-CMS,romanlytvyn/Umbraco-CMS,rustyswayne/Umbraco-CMS,mittonp/Umbraco-CMS,TimoPerplex/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,lars-erik/Umbraco-CMS,Phosworks/Umbraco-CMS,rustyswayne/Umbraco-CMS,marcemarc/Umbraco-CMS,sargin48/Umbraco-CMS,tcmorris/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,rasmusfjord/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,bjarnef/Umbraco-CMS,rasmusfjord/Umbraco-CMS,neilgaietto/Umbraco-CMS,NikRimington/Umbraco-CMS,sargin48/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,lars-erik/Umbraco-CMS,abjerner/Umbraco-CMS,rustyswayne/Umbraco-CMS,umbraco/Umbraco-CMS,arknu/Umbraco-CMS,WebCentrum/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,aadfPT/Umbraco-CMS,WebCentrum/Umbraco-CMS,base33/Umbraco-CMS,aadfPT/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,neilgaietto/Umbraco-CMS,KevinJump/Umbraco-CMS,gavinfaux/Umbraco-CMS,TimoPerplex/Umbraco-CMS,leekelleher/Umbraco-CMS,robertjf/Umbraco-CMS,gkonings/Umbraco-CMS,gavinfaux/Umbraco-CMS,lars-erik/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,jchurchley/Umbraco-CMS,madsoulswe/Umbraco-CMS,rasmusfjord/Umbraco-CMS,TimoPerplex/Umbraco-CMS,mattbrailsford/Umbraco-CMS,madsoulswe/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS,robertjf/Umbraco-CMS,tompipe/Umbraco-CMS,gavinfaux/Umbraco-CMS,kasperhhk/Umbraco-CMS,jchurchley/Umbraco-CMS,dawoe/Umbraco-CMS,lars-erik/Umbraco-CMS,neilgaietto/Umbraco-CMS,umbraco/Umbraco-CMS,aadfPT/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,sargin48/Umbraco-CMS,tompipe/Umbraco-CMS,rasmuseeg/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,tcmorris/Umbraco-CMS,aaronpowell/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,kasperhhk/Umbraco-CMS,tcmorris/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,gkonings/Umbraco-CMS,gkonings/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,rasmuseeg/Umbraco-CMS,neilgaietto/Umbraco-CMS,TimoPerplex/Umbraco-CMS,dawoe/Umbraco-CMS,WebCentrum/Umbraco-CMS,arknu/Umbraco-CMS,lars-erik/Umbraco-CMS,gavinfaux/Umbraco-CMS,bjarnef/Umbraco-CMS,romanlytvyn/Umbraco-CMS,leekelleher/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,romanlytvyn/Umbraco-CMS,abryukhov/Umbraco-CMS,gkonings/Umbraco-CMS,kasperhhk/Umbraco-CMS,madsoulswe/Umbraco-CMS,sargin48/Umbraco-CMS,Phosworks/Umbraco-CMS,leekelleher/Umbraco-CMS,Phosworks/Umbraco-CMS,hfloyd/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,Phosworks/Umbraco-CMS,kgiszewski/Umbraco-CMS,base33/Umbraco-CMS,KevinJump/Umbraco-CMS,rustyswayne/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,aaronpowell/Umbraco-CMS,TimoPerplex/Umbraco-CMS,umbraco/Umbraco-CMS,tompipe/Umbraco-CMS,jchurchley/Umbraco-CMS,Phosworks/Umbraco-CMS,mittonp/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,robertjf/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,tcmorris/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,mittonp/Umbraco-CMS,robertjf/Umbraco-CMS,bjarnef/Umbraco-CMS,NikRimington/Umbraco-CMS,marcemarc/Umbraco-CMS,romanlytvyn/Umbraco-CMS,kasperhhk/Umbraco-CMS,dawoe/Umbraco-CMS,rasmusfjord/Umbraco-CMS,NikRimington/Umbraco-CMS,romanlytvyn/Umbraco-CMS,hfloyd/Umbraco-CMS,aaronpowell/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,kgiszewski/Umbraco-CMS,neilgaietto/Umbraco-CMS,kgiszewski/Umbraco-CMS,base33/Umbraco-CMS,rasmusfjord/Umbraco-CMS,rustyswayne/Umbraco-CMS,sargin48/Umbraco-CMS
src/Umbraco.Web/Models/ContentEditing/PropertyGroupDisplay.cs
src/Umbraco.Web/Models/ContentEditing/PropertyGroupDisplay.cs
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace Umbraco.Web.Models.ContentEditing { [DataContract(Name = "propertyGroup", Namespace = "")] public class PropertyGroupDisplay { public PropertyGroupDisplay() { Properties = new List<PropertyTypeDisplay>(); ParentTabContentTypeNames = new List<string>(); ParentTabContentTypes = new List<int>(); } [DataMember(Name = "id")] public int Id { get; set; } [DataMember(Name = "parentGroupId")] public int ParentGroupId { get; set; } [DataMember(Name = "sortOrder")] public int SortOrder { get; set; } [DataMember(Name = "name")] public string Name { get; set; } [DataMember(Name = "properties")] public IEnumerable<PropertyTypeDisplay> Properties { get; set; } //Indicate if this tab was inherited [DataMember(Name = "inherited")] public bool Inherited { get; set; } [DataMember(Name = "contentTypeId")] public int ContentTypeId { get; set; } [DataMember(Name = "parentTabContentTypes")] public IEnumerable<int> ParentTabContentTypes { get; set; } [DataMember(Name = "parentTabContentTypeNames")] public IEnumerable<string> ParentTabContentTypeNames { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace Umbraco.Web.Models.ContentEditing { [DataContract(Name = "propertyGroup", Namespace = "")] public class PropertyGroupDisplay { public PropertyGroupDisplay() { Properties = new List<PropertyTypeDisplay>(); } [DataMember(Name = "id")] public int Id { get; set; } [DataMember(Name = "parentGroupId")] public int ParentGroupId { get; set; } [DataMember(Name = "sortOrder")] public int SortOrder { get; set; } [DataMember(Name = "name")] public string Name { get; set; } [DataMember(Name = "properties")] public IEnumerable<PropertyTypeDisplay> Properties { get; set; } //Indicate if this tab was inherited [DataMember(Name = "inherited")] public bool Inherited { get; set; } [DataMember(Name = "contentTypeId")] public int ContentTypeId { get; set; } [DataMember(Name = "parentTabContentTypes")] public IEnumerable<int> ParentTabContentTypes { get; set; } [DataMember(Name = "parentTabContentTypeNames")] public IEnumerable<string> ParentTabContentTypeNames { get; set; } } }
mit
C#
9eccfcc80a4f75b08967e78820ba22668628fab2
Fix to avoid CA1812
y-iihoshi/ThScoreFileConverter,y-iihoshi/ThScoreFileConverter
ThScoreFileConverter/ExceptionOccurredEventArgs.cs
ThScoreFileConverter/ExceptionOccurredEventArgs.cs
//----------------------------------------------------------------------- // <copyright file="ExceptionOccurredEventArgs.cs" company="None"> // (c) 2014 IIHOSHI Yoshinori // </copyright> //----------------------------------------------------------------------- namespace ThScoreFileConverter { using System; using System.Diagnostics.CodeAnalysis; /// <summary> /// Represents the event data that indicates occurring of an exception. /// </summary> #if DEBUG [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Reviewed.")] #endif internal class ExceptionOccurredEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="ExceptionOccurredEventArgs"/> class. /// </summary> /// <param name="ex">The exception data.</param> public ExceptionOccurredEventArgs(Exception ex) { this.Exception = ex; } /// <summary> /// Gets the exception data. /// </summary> public Exception Exception { get; private set; } } }
//----------------------------------------------------------------------- // <copyright file="ExceptionOccurredEventArgs.cs" company="None"> // (c) 2014 IIHOSHI Yoshinori // </copyright> //----------------------------------------------------------------------- namespace ThScoreFileConverter { using System; /// <summary> /// Represents the event data that indicates occurring of an exception. /// </summary> internal class ExceptionOccurredEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="ExceptionOccurredEventArgs"/> class. /// </summary> /// <param name="ex">The exception data.</param> public ExceptionOccurredEventArgs(Exception ex) { this.Exception = ex; } /// <summary> /// Gets the exception data. /// </summary> public Exception Exception { get; private set; } } }
bsd-2-clause
C#