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
50f9d731c96ec389e2955eb6b104a7a6999ef0d9
remove tab
pocketberserker/free-monad-csharp
CSharp.Monad.Free/F0.cs
CSharp.Monad.Free/F0.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CSharp.Monad { class F0FunctorImpl : Functor<F0> { internal F0FunctorImpl() { } public _1<F0, B> Map<A, B>(Func<A, B> f, _1<F0, A> fa) { return F0.Wrap(() => f((fa as F0<A>).Apply())); } } internal class F0Impl<A> : F0<A> { private readonly Func<A> f; public F0Impl(Func<A> f) { this.f = f; } public A Apply() { return f(); } } public sealed class F0 { public static readonly Functor<F0> Functor = new F0FunctorImpl(); public static F0<A> Wrap<A>(Func<A> f) { return new F0Impl<A>(f); } private F0() {} } public interface F0<A> : _1<F0, A> { A Apply(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CSharp.Monad { class F0FunctorImpl : Functor<F0> { internal F0FunctorImpl() { } public _1<F0, B> Map<A, B>(Func<A, B> f, _1<F0, A> fa) { return F0.Wrap(() => f((fa as F0<A>).Apply())); } } internal class F0Impl<A> : F0<A> { private readonly Func<A> f; public F0Impl(Func<A> f) { this.f = f; } public A Apply() { return f(); } } public sealed class F0 { public static readonly Functor<F0> Functor = new F0FunctorImpl(); public static F0<A> Wrap<A>(Func<A> f) { return new F0Impl<A>(f); } private F0() {} } public interface F0<A> : _1<F0, A> { A Apply(); } }
mit
C#
4aab312652139417b06c0cfc8f54278c503b2260
Add create suta button
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Views/SUTA/List.cshtml
Battery-Commander.Web/Views/SUTA/List.cshtml
@model IEnumerable<SUTA> @{ ViewBag.Title = "SUTA Tracker"; } <div class="btn-group"> @Html.ActionLink("Add New", "New", "SUTA", null, new { @class = "btn btn-default" }) </div> <div id="suta-list"> <div class="page-header"> <h1>@ViewBag.Title</h1> <table class="table table-striped display nowrap" id="dt" width="100%"> <thead> <tr> <th>Details</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Status)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().StartDate)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Soldier.Rank)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Soldier.LastName)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Soldier.FirstName)</th> </tr> </thead> <tbody> @foreach (var request in Model) { <tr> <td></td> <td>@Html.DisplayFor(_ => request.Status)</td> <td>@Html.DisplayFor(_ => request.StartDate)</td> <td>@Html.DisplayFor(_ => request.Soldier.RankHumanized)</td> <td>@Html.DisplayFor(_ => request.Soldier.LastName)</td> <td>@Html.DisplayFor(_ => request.Soldier.FirstName)</td> </tr> } </tbody> </table> </div> </div>
@model IEnumerable<SUTA> @{ ViewBag.Title = "SUTA Tracker"; } <div id="suta-list"> <div class="page-header"> <h1>@ViewBag.Title</h1> <table class="table table-striped display nowrap" id="dt" width="100%"> <thead> <tr> <th>Details</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Status)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().StartDate)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Soldier.Rank)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Soldier.LastName)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Soldier.FirstName)</th> </tr> </thead> <tbody> @foreach (var request in Model) { <tr> <td></td> <td>@Html.DisplayFor(_ => request.Status)</td> <td>@Html.DisplayFor(_ => request.StartDate)</td> <td>@Html.DisplayFor(_ => request.Soldier.RankHumanized)</td> <td>@Html.DisplayFor(_ => request.Soldier.LastName)</td> <td>@Html.DisplayFor(_ => request.Soldier.FirstName)</td> </tr> } </tbody> </table> </div> </div>
mit
C#
8b24b861a3cbdf9e2411716e391e60965072ca0d
Make X509 work with ManagedHandler
jterry75/Docker.DotNet,jterry75/Docker.DotNet,ahmetalpbalkan/Docker.DotNet
Docker.DotNet.X509/CertificateCredentials.cs
Docker.DotNet.X509/CertificateCredentials.cs
using System.Net; using System.Net.Http; using System.Security.Cryptography.X509Certificates; using Microsoft.Net.Http.Client; namespace Docker.DotNet.X509 { public class CertificateCredentials : Credentials { private X509Certificate2 _certificate; public CertificateCredentials(X509Certificate2 clientCertificate) { _certificate = clientCertificate; } public override HttpMessageHandler GetHandler(HttpMessageHandler innerHandler) { var handler = (ManagedHandler)innerHandler; handler.ClientCertificates = new X509CertificateCollection { _certificate }; handler.ServerCertificateValidationCallback = ServicePointManager.ServerCertificateValidationCallback; return handler; } public override bool IsTlsCredentials() { return true; } public override void Dispose() { } } }
using System.Net.Http; using System.Security.Cryptography.X509Certificates; namespace Docker.DotNet.X509 { public class CertificateCredentials : Credentials { private readonly WebRequestHandler _handler; public CertificateCredentials(X509Certificate2 clientCertificate) { _handler = new WebRequestHandler() { ClientCertificateOptions = ClientCertificateOption.Manual, UseDefaultCredentials = false }; _handler.ClientCertificates.Add(clientCertificate); } public override HttpMessageHandler Handler { get { return _handler; } } public override bool IsTlsCredentials() { return true; } public override void Dispose() { _handler.Dispose(); } } }
apache-2.0
C#
80d14aec6ce2f05c4004f4597513fb0a5d5cd6dd
Update build.cake
jamesmontemagno/Xamarin.Plugins,predictive-technology-laboratory/Xamarin.Plugins
Connectivity/build.cake
Connectivity/build.cake
#addin "Cake.FileHelpers" var TARGET = Argument ("target", Argument ("t", "NuGetPack")); var version = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999"); Task ("Build").Does (() => { const string sln = "./Connectivity.sln"; const string cfg = "Release"; NuGetRestore (sln); if (!IsRunningOnWindows ()) DotNetBuild (sln, c => c.Configuration = cfg); else MSBuild (sln, c => { c.Configuration = cfg; c.MSBuildPlatform = MSBuildPlatform.x86; }); }); Task ("NuGetPack") .IsDependentOn ("Build") .Does (() => { NuGetPack ("./Connectivity.Plugin.nuspec", new NuGetPackSettings { Version = version, Verbosity = NuGetVerbosity.Detailed, OutputDirectory = "./", BasePath = "./", }); }); RunTarget (TARGET);
#addin "Cake.FileHelpers" var TARGET = Argument ("target", Argument ("t", "Build")); var version = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999"); Task ("Build").Does (() => { const string sln = "./Connectivity.sln"; const string cfg = "Release"; NuGetRestore (sln); if (!IsRunningOnWindows ()) DotNetBuild (sln, c => c.Configuration = cfg); else MSBuild (sln, c => { c.Configuration = cfg; c.MSBuildPlatform = MSBuildPlatform.x86; }); }); Task ("NuGetPack") .IsDependentOn ("Build") .Does (() => { NuGetPack ("./Connectivity.Plugin.nuspec", new NuGetPackSettings { Version = version, Verbosity = NuGetVerbosity.Detailed, OutputDirectory = "./", BasePath = "./", }); }); RunTarget (TARGET);
mit
C#
4aee03370e4226572070d3e7b609aea175f395d8
修正 JIT 问题
GameFramework/GameFramework,EllanJiang/GameFramework
GameFramework/Base/GameFrameworkException.cs
GameFramework/Base/GameFrameworkException.cs
//------------------------------------------------------------ // Game Framework v3.x // Copyright © 2013-2017 Jiang Yin. All rights reserved. // Homepage: http://gameframework.cn/ // Feedback: mailto:jiangyin@gameframework.cn //------------------------------------------------------------ using System; using System.Runtime.Serialization; namespace GameFramework { /// <summary> /// 游戏框架异常类。 /// </summary> [Serializable] public class GameFrameworkException : Exception { /// <summary> /// 初始化游戏框架异常类的新实例。 /// </summary> public GameFrameworkException() : base() { } /// <summary> /// 使用指定错误消息初始化游戏框架异常类的新实例。 /// </summary> /// <param name="message">描述错误的消息。</param> public GameFrameworkException(string message) : base(message) { } /// <summary> /// 使用指定错误消息和对作为此异常原因的内部异常的引用来初始化游戏框架异常类的新实例。 /// </summary> /// <param name="message">解释异常原因的错误消息。</param> /// <param name="innerException">导致当前异常的异常。如果 innerException 参数不为空引用,则在处理内部异常的 catch 块中引发当前异常。</param> public GameFrameworkException(string message, Exception innerException) : base(message, innerException) { } /// <summary> /// 用序列化数据初始化游戏框架异常类的新实例。 /// </summary> /// <param name="info">存有有关所引发异常的序列化的对象数据。</param> /// <param name="context">包含有关源或目标的上下文信息。</param> protected GameFrameworkException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
//------------------------------------------------------------ // Game Framework v3.x // Copyright © 2013-2017 Jiang Yin. All rights reserved. // Homepage: http://gameframework.cn/ // Feedback: mailto:jiangyin@gameframework.cn //------------------------------------------------------------ using System; using System.Runtime.Serialization; namespace GameFramework { /// <summary> /// 游戏框架异常类。 /// </summary> [Serializable] public sealed class GameFrameworkException : Exception { /// <summary> /// 初始化游戏框架异常类的新实例。 /// </summary> public GameFrameworkException() : base() { } /// <summary> /// 使用指定错误消息初始化游戏框架异常类的新实例。 /// </summary> /// <param name="message">描述错误的消息。</param> public GameFrameworkException(string message) : base(message) { } /// <summary> /// 使用指定错误消息和对作为此异常原因的内部异常的引用来初始化游戏框架异常类的新实例。 /// </summary> /// <param name="message">解释异常原因的错误消息。</param> /// <param name="innerException">导致当前异常的异常。如果 innerException 参数不为空引用,则在处理内部异常的 catch 块中引发当前异常。</param> public GameFrameworkException(string message, Exception innerException) : base(message, innerException) { } /// <summary> /// 用序列化数据初始化游戏框架异常类的新实例。 /// </summary> /// <param name="info">存有有关所引发异常的序列化的对象数据。</param> /// <param name="context">包含有关源或目标的上下文信息。</param> protected GameFrameworkException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
mit
C#
f6b2d0453936964a3aec6914b32cb81047217d9f
fix output
Epxoxy/LiveRoku
LiveRoku/helpers/debugex/LogTraceListener.cs
LiveRoku/helpers/debugex/LogTraceListener.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LiveRoku { internal class LogTraceListener : System.Diagnostics.TraceListener { private StringBuilder debugMsgBuilder = new StringBuilder (); private string path; private int maxSize; public LogTraceListener (string path, int maxSize) { this.path = path; this.maxSize = maxSize; } public override void Write (string message) { debugMsgBuilder.Append (message); if (debugMsgBuilder.Length > maxSize) { WriteToFileAndClear (); } } public void WriteToFileAndClear () { if (debugMsgBuilder.Length <= 0) return; try { Storage.FileHelper.writeTxt (debugMsgBuilder.ToString (), path, true); } catch (Exception) { throw; } debugMsgBuilder.Clear (); } public override void WriteLine (string message) { if (!string.IsNullOrEmpty(message)) { message = message.Replace("\n", $"{Environment.NewLine}----------------"); } Write ("[" + DateTime.Now.ToString ("yyyy-MM-dd HH:mm:ss.fff") + "] " + message + Environment.NewLine); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LiveRoku { internal class LogTraceListener : System.Diagnostics.TraceListener { private StringBuilder debugMsgBuilder = new StringBuilder (); private string path; private int maxSize; public LogTraceListener (string path, int maxSize) { this.path = path; this.maxSize = maxSize; } public override void Write (string message) { debugMsgBuilder.Append (message); if (debugMsgBuilder.Length > maxSize) { WriteToFileAndClear (); } } public void WriteToFileAndClear () { if (debugMsgBuilder.Length <= 0) return; try { Storage.FileHelper.writeTxt (debugMsgBuilder.ToString (), path, true); } catch (Exception) { throw; } debugMsgBuilder.Clear (); } public override void WriteLine (string message) { if (!string.IsNullOrEmpty(message)) { message = message.Replace(Environment.NewLine, $"{Environment.NewLine}----------------"); } Write ("[" + DateTime.Now.ToString ("yyyy-MM-dd HH:mm:ss.fff") + "] " + message + Environment.NewLine); } } }
mit
C#
a6664dbf8c3823887c24ea2eebbc47c2b9c1a131
Rename missed variable
EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,EVAST9919/osu-framework
osu.Framework.Tests/Audio/SampleChannelVirtualTest.cs
osu.Framework.Tests/Audio/SampleChannelVirtualTest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Threading; using NUnit.Framework; using osu.Framework.Audio.Sample; using osu.Framework.Development; using osu.Framework.Threading; namespace osu.Framework.Tests.Audio { [TestFixture] public class SampleChannelVirtualTest { private SampleChannelVirtual channel; [SetUp] public void Setup() { channel = new SampleChannelVirtual(); updateChannel(); } [Test] public void TestStart() { Assert.IsFalse(channel.Played); Assert.IsFalse(channel.HasCompleted); channel.Play(); updateChannel(); Thread.Sleep(50); Assert.IsTrue(channel.Played); Assert.IsTrue(channel.HasCompleted); } private void updateChannel() => RunOnAudioThread(() => channel.Update()); /// <summary> /// Certain actions are invoked on the audio thread. /// Here we simulate this process on a correctly named thread to avoid endless blocking. /// </summary> /// <param name="action">The action to perform.</param> public static void RunOnAudioThread(Action action) { var resetEvent = new ManualResetEvent(false); new Thread(() => { ThreadSafety.IsAudioThread = true; action(); resetEvent.Set(); }) { Name = GameThread.PrefixedThreadNameFor("Audio") }.Start(); if (!resetEvent.WaitOne(TimeSpan.FromSeconds(10))) throw new TimeoutException(); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Threading; using NUnit.Framework; using osu.Framework.Audio.Sample; using osu.Framework.Development; using osu.Framework.Threading; namespace osu.Framework.Tests.Audio { [TestFixture] public class SampleChannelVirtualTest { private SampleChannelVirtual channel; [SetUp] public void Setup() { channel = new SampleChannelVirtual(); updateTrack(); } [Test] public void TestStart() { Assert.IsFalse(channel.Played); Assert.IsFalse(channel.HasCompleted); channel.Play(); updateTrack(); Thread.Sleep(50); Assert.IsTrue(channel.Played); Assert.IsTrue(channel.HasCompleted); } private void updateTrack() => RunOnAudioThread(() => channel.Update()); /// <summary> /// Certain actions are invoked on the audio thread. /// Here we simulate this process on a correctly named thread to avoid endless blocking. /// </summary> /// <param name="action">The action to perform.</param> public static void RunOnAudioThread(Action action) { var resetEvent = new ManualResetEvent(false); new Thread(() => { ThreadSafety.IsAudioThread = true; action(); resetEvent.Set(); }) { Name = GameThread.PrefixedThreadNameFor("Audio") }.Start(); if (!resetEvent.WaitOne(TimeSpan.FromSeconds(10))) throw new TimeoutException(); } } }
mit
C#
2307889bf81762d647718a17d0d4e326782dd4b5
Fix incorrect cast
peppy/osu-new,ppy/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,peppy/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu
osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs
osu.Game.Rulesets.Mania/Edit/ManiaSelectionHandler.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Linq; using osu.Framework.Allocation; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Screens.Edit.Compose.Components; namespace osu.Game.Rulesets.Mania.Edit { public class ManiaSelectionHandler : EditorSelectionHandler { [Resolved] private IScrollingInfo scrollingInfo { get; set; } [Resolved] private HitObjectComposer composer { get; set; } public override bool HandleMovement(MoveSelectionEvent<HitObject> moveEvent) { var hitObjectBlueprint = (HitObjectSelectionBlueprint)moveEvent.Blueprint; int lastColumn = ((ManiaHitObject)hitObjectBlueprint.Item).Column; performColumnMovement(lastColumn, moveEvent); return true; } private void performColumnMovement(int lastColumn, MoveSelectionEvent<HitObject> moveEvent) { var maniaPlayfield = ((ManiaHitObjectComposer)composer).Playfield; var currentColumn = maniaPlayfield.GetColumnByPosition(moveEvent.Blueprint.ScreenSpaceSelectionPoint + moveEvent.ScreenSpaceDelta); if (currentColumn == null) return; int columnDelta = currentColumn.Index - lastColumn; if (columnDelta == 0) return; int minColumn = int.MaxValue; int maxColumn = int.MinValue; // find min/max in an initial pass before actually performing the movement. foreach (var obj in EditorBeatmap.SelectedHitObjects.OfType<ManiaHitObject>()) { if (obj.Column < minColumn) minColumn = obj.Column; if (obj.Column > maxColumn) maxColumn = obj.Column; } columnDelta = Math.Clamp(columnDelta, -minColumn, maniaPlayfield.TotalColumns - 1 - maxColumn); EditorBeatmap.PerformOnSelection(h => { if (h is ManiaHitObject maniaObj) maniaObj.Column += columnDelta; }); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Linq; using osu.Framework.Allocation; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Screens.Edit.Compose.Components; namespace osu.Game.Rulesets.Mania.Edit { public class ManiaSelectionHandler : EditorSelectionHandler { [Resolved] private IScrollingInfo scrollingInfo { get; set; } [Resolved] private HitObjectComposer composer { get; set; } public override bool HandleMovement(MoveSelectionEvent<HitObject> moveEvent) { var maniaBlueprint = (HitObjectSelectionBlueprint<ManiaHitObject>)moveEvent.Blueprint; int lastColumn = maniaBlueprint.HitObject.Column; performColumnMovement(lastColumn, moveEvent); return true; } private void performColumnMovement(int lastColumn, MoveSelectionEvent<HitObject> moveEvent) { var maniaPlayfield = ((ManiaHitObjectComposer)composer).Playfield; var currentColumn = maniaPlayfield.GetColumnByPosition(moveEvent.Blueprint.ScreenSpaceSelectionPoint + moveEvent.ScreenSpaceDelta); if (currentColumn == null) return; int columnDelta = currentColumn.Index - lastColumn; if (columnDelta == 0) return; int minColumn = int.MaxValue; int maxColumn = int.MinValue; // find min/max in an initial pass before actually performing the movement. foreach (var obj in EditorBeatmap.SelectedHitObjects.OfType<ManiaHitObject>()) { if (obj.Column < minColumn) minColumn = obj.Column; if (obj.Column > maxColumn) maxColumn = obj.Column; } columnDelta = Math.Clamp(columnDelta, -minColumn, maniaPlayfield.TotalColumns - 1 - maxColumn); EditorBeatmap.PerformOnSelection(h => { if (h is ManiaHitObject maniaObj) maniaObj.Column += columnDelta; }); } } }
mit
C#
3b55eeb416c01f1f2ba5d2fa0a8ce0d7a25d6bd7
Fix test failure by setting beatmap
NeoAdonis/osu,ppy/osu,peppy/osu,smoogipooo/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,UselessToucan/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu
osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs
osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Edit.Components; using osuTK; namespace osu.Game.Tests.Visual.Editing { [TestFixture] public class TestSceneEditorClock : EditorClockTestScene { public TestSceneEditorClock() { Add(new FillFlowContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new TimeInfoContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(200, 100) }, new PlaybackControl { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(200, 100) } } }); } [BackgroundDependencyLoader] private void load() { Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo); } [Test] public void TestStopAtTrackEnd() { AddStep("Reset clock", () => Clock.Seek(0)); AddStep("Start clock", Clock.Start); AddAssert("Clock running", () => Clock.IsRunning); AddStep("Seek near end", () => Clock.Seek(Clock.TrackLength - 250)); AddUntilStep("Clock stops", () => !Clock.IsRunning); AddAssert("Clock stopped at end", () => Clock.CurrentTime == Clock.TrackLength); AddStep("Start clock again", Clock.Start); AddAssert("Clock looped to start", () => Clock.IsRunning && Clock.CurrentTime < 500); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Screens.Edit.Components; using osuTK; namespace osu.Game.Tests.Visual.Editing { [TestFixture] public class TestSceneEditorClock : EditorClockTestScene { public TestSceneEditorClock() { Add(new FillFlowContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new TimeInfoContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(200, 100) }, new PlaybackControl { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(200, 100) } } }); } [Test] public void TestStopAtTrackEnd() { AddStep("Reset clock", () => Clock.Seek(0)); AddStep("Start clock", Clock.Start); AddAssert("Clock running", () => Clock.IsRunning); AddStep("Seek near end", () => Clock.Seek(Clock.TrackLength - 250)); AddUntilStep("Clock stops", () => !Clock.IsRunning); AddAssert("Clock stopped at end", () => Clock.CurrentTime == Clock.TrackLength); AddStep("Start clock again", Clock.Start); AddAssert("Clock looped to start", () => Clock.IsRunning && Clock.CurrentTime < 500); } } }
mit
C#
974c6fb36c9efc81cdecd8e1cf6f9d9798ca7fd7
Add clientside code to test channel registration on server
GeorgeHahn/SOVND
SOVND.Client/App.xaml.cs
SOVND.Client/App.xaml.cs
using Charlotte; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; using libspotifydotnet; namespace SOVND.Client { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application { public SovndClient client = new SovndClient("127.0.0.1", 1883, "", ""); } public class SovndClient : MqttModule { private Action<string> Log = _ => Console.WriteLine(_); public SovndClient(string brokerHostName, int brokerPort, string username, string password) : base(brokerHostName, brokerPort, username, password) { On["/{channel}/playlist/{songid}"] = _ => { Log("Votes for :\{_.songid} set to :\{_.Message}"); }; On["/{channel}/playlist/{songid}/voters"] = _ => { Log("Voters for :\{_.songid}: :\{_.Message}"); }; On["/{channel}/playlist/{songid}/removed"] = _ => { Log("Song removed from playlist: :\{_.songid}"); }; On["/user/{username}/{channel}/chat"] = _ => { Log(":\{_.username}: :\{_.Message}"); }; On["/{channel}/stats/users"] = _ => { Log(":\{_.Message} active users"); }; On["/{channel}/nowplaying"] = _ => { Log("Playing: :\{_.Message}"); }; } public new void Run() { Connect(); RegisterChannel("Ambient", "Ambient music", ""); Publish("/user/georgehahn/ambient/songs/spotify:track:4OeTOlMKA693c7YOh5z9x1", "vote"); } public bool RegisterChannel(string name, string description, string image) { Publish("/user/georgehahn/registerchannel/name", name); Publish("/user/georgehahn/registerchannel/description", description); Publish("/user/georgehahn/registerchannel/image", image); return true; } } }
using Charlotte; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; namespace SOVND.Client { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application { public SovndClient client = new SovndClient("127.0.0.1", 1883, "", ""); } public class SovndClient : MqttModule { private Action<string> Log = _ => Console.WriteLine(_); public SovndClient(string brokerHostName, int brokerPort, string username, string password) : base(brokerHostName, brokerPort, username, password) { On["/{channel}/playlist/{songid}"] = _ => { Log("Votes for :\{_.songid} set to :\{_.Message}"); }; On["/{channel}/playlist/{songid}/voters"] = _ => { Log("Voters for :\{_.songid}: :\{_.Message}"); }; On["/{channel}/playlist/{songid}/removed"] = _ => { Log("Song removed from playlist: :\{_.songid}"); }; On["/user/{username}/{channel}/chat"] = _ => { Log(":\{_.username}: :\{_.Message}"); }; On["/{channel}/stats/users"] = _ => { Log(":\{_.Message} active users"); }; On["/{channel}/nowplaying"] = _ => { Log("Playing: :\{_.Message}"); }; Connect(); Publish("/user/georgehahn/ambient/songs/spotify:track:4OeTOlMKA693c7YOh5z9x1", "vote"); } } }
epl-1.0
C#
43d2bcdc2155f74f0881c8bbdc6a79b2155f406f
Remove Close() call in using statement
appharbor/AppHarbor.Web.Security
AppHarbor.Web.Security/SymmetricEncryption.cs
AppHarbor.Web.Security/SymmetricEncryption.cs
using System.IO; using System.Security.Cryptography; namespace AppHarbor.Web.Security { public class SymmetricEncryption : Encryption { private readonly SymmetricAlgorithm _algorithm; private readonly byte[] _secretKey; private readonly byte[] _initializationVector; public SymmetricEncryption(SymmetricAlgorithm algorithm, byte[] secretKey, byte[] initializationVector) { _algorithm = algorithm; _secretKey = secretKey; _initializationVector = initializationVector; } public override void Dispose() { _algorithm.Dispose(); } public override byte[] Encrypt(byte[] valueBytes) { using (var output = new MemoryStream()) { using (var cryptoOutput = new CryptoStream(output, _algorithm.CreateEncryptor(_secretKey, _initializationVector), CryptoStreamMode.Write)) { cryptoOutput.Write(valueBytes, 0, valueBytes.Length); } return output.ToArray(); } } public override byte[] Decrypt(byte[] encryptedValue) { using (var output = new MemoryStream()) { using (var cryptoOutput = new CryptoStream(output, _algorithm.CreateDecryptor(_secretKey, _initializationVector), CryptoStreamMode.Write)) { cryptoOutput.Write(encryptedValue, 0, encryptedValue.Length); } return output.ToArray(); } } } public sealed class SymmetricEncryption<T> : SymmetricEncryption where T : SymmetricAlgorithm, new() { public SymmetricEncryption(byte[] secretKey, byte[] initializationVector) : base(new T(), secretKey, initializationVector) { } } }
using System.IO; using System.Security.Cryptography; namespace AppHarbor.Web.Security { public class SymmetricEncryption : Encryption { private readonly SymmetricAlgorithm _algorithm; private readonly byte[] _secretKey; private readonly byte[] _initializationVector; public SymmetricEncryption(SymmetricAlgorithm algorithm, byte[] secretKey, byte[] initializationVector) { _algorithm = algorithm; _secretKey = secretKey; _initializationVector = initializationVector; } public override void Dispose() { _algorithm.Dispose(); } public override byte[] Encrypt(byte[] valueBytes) { using (var output = new MemoryStream()) { using (var cryptoOutput = new CryptoStream(output, _algorithm.CreateEncryptor(_secretKey, _initializationVector), CryptoStreamMode.Write)) { cryptoOutput.Write(valueBytes, 0, valueBytes.Length); cryptoOutput.Close(); } return output.ToArray(); } } public override byte[] Decrypt(byte[] encryptedValue) { using (var output = new MemoryStream()) { using (var cryptoOutput = new CryptoStream(output, _algorithm.CreateDecryptor(_secretKey, _initializationVector), CryptoStreamMode.Write)) { cryptoOutput.Write(encryptedValue, 0, encryptedValue.Length); cryptoOutput.Close(); } return output.ToArray(); } } } public sealed class SymmetricEncryption<T> : SymmetricEncryption where T : SymmetricAlgorithm, new() { public SymmetricEncryption(byte[] secretKey, byte[] initializationVector) : base(new T(), secretKey, initializationVector) { } } }
mit
C#
c6db15922f2de9534e2bdcd60a793eaf863ad6a0
Update ICorrelationService.cs
tiksn/TIKSN-Framework
TIKSN.Core/Integration/Correlation/ICorrelationService.cs
TIKSN.Core/Integration/Correlation/ICorrelationService.cs
namespace TIKSN.Integration.Correlation { /// <summary> /// Service for generating and parsing <see cref="CorrelationID"/>. /// </summary> public interface ICorrelationService { /// <summary> /// Creates <see cref="CorrelationID"/> from string representation. /// </summary> /// <param name="stringRepresentation"></param> /// <returns></returns> CorrelationID Create(string stringRepresentation); /// <summary> /// Creates <see cref="CorrelationID"/> from binary representation. /// </summary> /// <param name="byteArrayRepresentation"></param> /// <returns></returns> CorrelationID Create(byte[] byteArrayRepresentation); /// <summary> /// Generates new <see cref="CorrelationID"/> /// </summary> /// <returns></returns> CorrelationID Generate(); } }
namespace TIKSN.Integration.Correlation { /// <summary> /// Service for generating and parsing <see cref="Correlation"/>. /// </summary> public interface ICorrelationService { /// <summary> /// Creates <see cref="CorrelationID"/> from string representation. /// </summary> /// <param name="stringRepresentation"></param> /// <returns></returns> CorrelationID Create(string stringRepresentation); /// <summary> /// Creates <see cref="CorrelationID"/> from binary representation. /// </summary> /// <param name="byteArrayRepresentation"></param> /// <returns></returns> CorrelationID Create(byte[] byteArrayRepresentation); /// <summary> /// Generates new <see cref="CorrelationID"/> /// </summary> /// <returns></returns> CorrelationID Generate(); } }
mit
C#
1961ce832aa0a0b6ea7a7f7c9a8bab4abb3b2257
Update FastBinaryBondSerializer.cs
tiksn/TIKSN-Framework
TIKSN.Core/Serialization/Bond/FastBinaryBondSerializer.cs
TIKSN.Core/Serialization/Bond/FastBinaryBondSerializer.cs
using Bond.IO.Safe; using Bond.Protocols; namespace TIKSN.Serialization.Bond { public class FastBinaryBondSerializer : SerializerBase<byte[]> { protected override byte[] SerializeInternal<T>(T obj) { var output = new OutputBuffer(); var writer = new FastBinaryWriter<OutputBuffer>(output); global::Bond.Serialize.To(writer, obj); return output.Data.Array; } } }
using Bond.IO.Safe; using Bond.Protocols; namespace TIKSN.Serialization.Bond { public class FastBinaryBondSerializer : SerializerBase<byte[]> { protected override byte[] SerializeInternal<T>(T obj) { var output = new OutputBuffer(); var writer = new FastBinaryWriter<OutputBuffer>(output); global::Bond.Serialize.To(writer, obj); return output.Data.Array; } } }
mit
C#
ca65c6bd8f0f99b98ad5fee089cb509e60d9a7ac
fix #171
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
BTCPayServer/Views/Account/ConfirmEmail.cshtml
BTCPayServer/Views/Account/ConfirmEmail.cshtml
@{ ViewData["Title"] = "Confirm email"; } <section> <div class="container"> <div class="row"> <div class="col-lg-12 text-center"> <partial name="_StatusMessage" model="@("Thank you for confirming your email.")" /> </div> </div> </div> </section>
@{ ViewData["Title"] = "Confirm email"; } <section> <div class="container"> <div class="row"> <div class="col-lg-12 text-center"> <partial name="_StatusMessage" for="@("Thank you for confirming your email.")" /> </div> </div> </div> </section>
mit
C#
49a878dc20ce004169333f86021e02f528a6cf9b
Fix comma separator support not actually working
peppy/osu,smoogipooo/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,ppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu
osu.Game/Graphics/UserInterface/ScoreCounter.cs
osu.Game/Graphics/UserInterface/ScoreCounter.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface { public abstract class ScoreCounter : RollingCounter<double> { protected override double RollingDuration => 1000; protected override Easing RollingEasing => Easing.Out; /// <summary> /// Whether comma separators should be displayed. /// </summary> public bool UseCommaSeparator { get; } public Bindable<int> RequiredDisplayDigits { get; } = new Bindable<int>(); /// <summary> /// Displays score. /// </summary> /// <param name="leading">How many leading zeroes the counter will have.</param> /// <param name="useCommaSeparator">Whether comma separators should be displayed.</param> protected ScoreCounter(int leading = 0, bool useCommaSeparator = false) { UseCommaSeparator = useCommaSeparator; if (useCommaSeparator && leading > 0) throw new ArgumentException("Should not mix leading zeroes and comma separators as it doesn't make sense"); RequiredDisplayDigits.Value = leading; RequiredDisplayDigits.BindValueChanged(_ => UpdateDisplay()); } protected override double GetProportionalDuration(double currentValue, double newValue) { return currentValue > newValue ? currentValue - newValue : newValue - currentValue; } protected override LocalisableString FormatCount(double count) { string format = new string('0', RequiredDisplayDigits.Value); var output = ((long)count).ToString(format); if (UseCommaSeparator) { for (int i = output.Length - 3; i > 0; i -= 3) output = output.Insert(i, @","); } return output; } protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s => s.Font = s.Font.With(fixedWidth: true)); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface { public abstract class ScoreCounter : RollingCounter<double> { protected override double RollingDuration => 1000; protected override Easing RollingEasing => Easing.Out; /// <summary> /// Whether comma separators should be displayed. /// </summary> public bool UseCommaSeparator { get; } public Bindable<int> RequiredDisplayDigits { get; } = new Bindable<int>(); /// <summary> /// Displays score. /// </summary> /// <param name="leading">How many leading zeroes the counter will have.</param> /// <param name="useCommaSeparator">Whether comma separators should be displayed.</param> protected ScoreCounter(int leading = 0, bool useCommaSeparator = false) { UseCommaSeparator = useCommaSeparator; RequiredDisplayDigits.Value = leading; RequiredDisplayDigits.BindValueChanged(_ => UpdateDisplay()); } protected override double GetProportionalDuration(double currentValue, double newValue) { return currentValue > newValue ? currentValue - newValue : newValue - currentValue; } protected override LocalisableString FormatCount(double count) { string format = new string('0', RequiredDisplayDigits.Value); if (UseCommaSeparator) { for (int i = format.Length - 3; i > 0; i -= 3) format = format.Insert(i, @","); } return ((long)count).ToString(format); } protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s => s.Font = s.Font.With(fixedWidth: true)); } }
mit
C#
6f22dfbcc1a41a100767a0d5a22797063ff2c0bc
Fix WatchListTests
ermau/Tempest.Social
Desktop/Tempest.Social.Tests/WatchListTests.cs
Desktop/Tempest.Social.Tests/WatchListTests.cs
// // WatchListTests.cs // // Author: // Eric Maupin <me@ermau.com> // // Copyright (c) 2013 Eric Maupin // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Collections.Specialized; using System.Linq; using System.Threading.Tasks; using NUnit.Framework; using Tempest.Tests; namespace Tempest.Social.Tests { [TestFixture] public class WatchListTests { [Test] public void CtorInvalid() { Assert.Throws<ArgumentNullException> (() => new WatchList (null)); } private WatchList list; private MockClientConnection clientConn; private MockServerConnection serverConn; [SetUp] public void Setup() { var provider = new MockConnectionProvider (SocialProtocol.Instance); provider.Start (MessageTypes.Reliable); var cs = provider.GetConnections (SocialProtocol.Instance); clientConn = cs.Item1; serverConn = cs.Item2; var context = new TempestClient (clientConn, MessageTypes.Reliable); context.ConnectAsync (new Target (Target.LoopbackIP, 1)).Wait(); list = new WatchList (context); } [Test] public void Ctor() { Assert.AreEqual (0, list.Count); CollectionAssert.IsEmpty (list); } [Test] public void ReceiveAdd() { var test = new AsyncTest(); var p = new Person ("id"); list.CollectionChanged += (sender, args) => { Assert.AreEqual (NotifyCollectionChangedAction.Add, args.Action); Assert.IsNotNull (args.NewItems); Assert.AreEqual (p, args.NewItems[0]); test.PassHandler (null, EventArgs.Empty); }; serverConn.SendAsync (new PersonMessage (p)); test.Assert (10000); Assert.AreEqual (p, list.FirstOrDefault()); } } }
// // WatchListTests.cs // // Author: // Eric Maupin <me@ermau.com> // // Copyright (c) 2013 Eric Maupin // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Collections.Specialized; using System.Linq; using System.Threading.Tasks; using NUnit.Framework; using Tempest.Tests; namespace Tempest.Social.Tests { [TestFixture] public class WatchListTests { [Test] public void CtorInvalid() { Assert.Throws<ArgumentNullException> (() => new WatchList (null)); } private WatchList list; private MockClientConnection clientConn; private MockServerConnection serverConn; [SetUp] public async Task Setup() { var provider = new MockConnectionProvider (SocialProtocol.Instance); provider.Start (MessageTypes.Reliable); var cs = provider.GetConnections (SocialProtocol.Instance); clientConn = cs.Item1; serverConn = cs.Item2; var context = new TempestClient (clientConn, MessageTypes.Reliable); await context.ConnectAsync (new Target (Target.LoopbackIP, 1)); list = new WatchList (context); } [Test] public void Ctor() { Assert.AreEqual (0, list.Count); CollectionAssert.IsEmpty (list); } [Test] public void ReceiveAdd() { var test = new AsyncTest(); var p = new Person ("id"); list.CollectionChanged += (sender, args) => { Assert.AreEqual (NotifyCollectionChangedAction.Add, args.Action); Assert.IsNotNull (args.NewItems); Assert.AreEqual (p, args.NewItems[0]); test.PassHandler (null, EventArgs.Empty); }; serverConn.SendAsync (new PersonMessage (p)); test.Assert (10000); Assert.AreEqual (p, list.FirstOrDefault()); } } }
mit
C#
a60919d3bbbf96f65c17921ba8cb1d4c7012e05e
Add new ListActivatableNames() to org.freedesktop.DBus
arfbtwn/dbus-sharp,arfbtwn/dbus-sharp,mono/dbus-sharp,Tragetaschen/dbus-sharp,mono/dbus-sharp,openmedicus/dbus-sharp,Tragetaschen/dbus-sharp,openmedicus/dbus-sharp
src/DBus.cs
src/DBus.cs
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using NDesk.DBus; //namespace org.freedesktop.DBus namespace org.freedesktop.DBus { /* //what's this for? public class DBusException : ApplicationException { } */ #if UNDOCUMENTED_IN_SPEC //TODO: maybe this should be mapped to its CLR counterpart directly? //not yet used [Interface ("org.freedesktop.DBus.Error.InvalidArgs")] public class InvalidArgsException : ApplicationException { } #endif [Flags] public enum NameFlag : uint { None = 0, AllowReplacement = 0x1, ReplaceExisting = 0x2, DoNotQueue = 0x4, } public enum NameReply : uint { PrimaryOwner = 1, InQueue, Exists, AlreadyOwner, } public enum ReleaseNameReply : uint { Released = 1, NonExistent, NotOwner, } public enum StartReply : uint { //The service was successfully started. Success = 1, //A connection already owns the given name. AlreadyRunning, } public delegate void NameOwnerChangedHandler (string name, string old_owner, string new_owner); public delegate void NameAcquiredHandler (string name); public delegate void NameLostHandler (string name); [Interface ("org.freedesktop.DBus.Peer")] public interface Peer { void Ping (); [return: Argument ("machine_uuid")] string GetMachineId (); } [Interface ("org.freedesktop.DBus.Introspectable")] public interface Introspectable { [return: Argument ("data")] string Introspect (); } [Interface ("org.freedesktop.DBus.Properties")] public interface Properties { //TODO: some kind of indexer mapping? //object this [string propname] {get; set;} [return: Argument ("value")] object Get (string @interface, string propname); //void Get (string @interface, string propname, out object value); void Set (string @interface, string propname, object value); } [Interface ("org.freedesktop.DBus")] public interface IBus : Introspectable { NameReply RequestName (string name, NameFlag flags); ReleaseNameReply ReleaseName (string name); string Hello (); string[] ListNames (); string[] ListActivatableNames (); bool NameHasOwner (string name); event NameOwnerChangedHandler NameOwnerChanged; event NameLostHandler NameLost; event NameAcquiredHandler NameAcquired; StartReply StartServiceByName (string name, uint flags); string GetNameOwner (string name); uint GetConnectionUnixUser (string connection_name); void AddMatch (string rule); void RemoveMatch (string rule); #if UNDOCUMENTED_IN_SPEC //undocumented in spec //there are more of these void ReloadConfig (); #endif } }
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using NDesk.DBus; //namespace org.freedesktop.DBus namespace org.freedesktop.DBus { /* //what's this for? public class DBusException : ApplicationException { } */ #if UNDOCUMENTED_IN_SPEC //TODO: maybe this should be mapped to its CLR counterpart directly? //not yet used [Interface ("org.freedesktop.DBus.Error.InvalidArgs")] public class InvalidArgsException : ApplicationException { } #endif [Flags] public enum NameFlag : uint { None = 0, AllowReplacement = 0x1, ReplaceExisting = 0x2, DoNotQueue = 0x4, } public enum NameReply : uint { PrimaryOwner = 1, InQueue, Exists, AlreadyOwner, } public enum ReleaseNameReply : uint { Released = 1, NonExistent, NotOwner, } public enum StartReply : uint { //The service was successfully started. Success = 1, //A connection already owns the given name. AlreadyRunning, } public delegate void NameOwnerChangedHandler (string name, string old_owner, string new_owner); public delegate void NameAcquiredHandler (string name); public delegate void NameLostHandler (string name); [Interface ("org.freedesktop.DBus.Peer")] public interface Peer { void Ping (); [return: Argument ("machine_uuid")] string GetMachineId (); } [Interface ("org.freedesktop.DBus.Introspectable")] public interface Introspectable { [return: Argument ("data")] string Introspect (); } [Interface ("org.freedesktop.DBus.Properties")] public interface Properties { //TODO: some kind of indexer mapping? //object this [string propname] {get; set;} [return: Argument ("value")] object Get (string @interface, string propname); //void Get (string @interface, string propname, out object value); void Set (string @interface, string propname, object value); } [Interface ("org.freedesktop.DBus")] public interface IBus : Introspectable { NameReply RequestName (string name, NameFlag flags); ReleaseNameReply ReleaseName (string name); string Hello (); string[] ListNames (); bool NameHasOwner (string name); event NameOwnerChangedHandler NameOwnerChanged; event NameLostHandler NameLost; event NameAcquiredHandler NameAcquired; StartReply StartServiceByName (string name, uint flags); string GetNameOwner (string name); uint GetConnectionUnixUser (string connection_name); void AddMatch (string rule); void RemoveMatch (string rule); #if UNDOCUMENTED_IN_SPEC //undocumented in spec //there are more of these void ReloadConfig (); #endif } }
mit
C#
b115e346624f6fec9e845cb9d33adc9cc6e26a34
Set version 0.1.1
morgen2009/DelegateDecompiler,hazzik/DelegateDecompiler,jaenyph/DelegateDecompiler
src/DelegateDecompiler/Properties/AssemblyInfo.cs
src/DelegateDecompiler/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("DelegateDecompiller")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DelegateDecompiller")] [assembly: AssemblyCopyright("Copyright © hazzik 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cec0a257-502b-4718-91c3-9e67555c5e1b")] // 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.1.1.0")] [assembly: AssemblyFileVersion("0.1.1.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("DelegateDecompiller")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DelegateDecompiller")] [assembly: AssemblyCopyright("Copyright © hazzik 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cec0a257-502b-4718-91c3-9e67555c5e1b")] // 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.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")]
mit
C#
fa8fc19e9d680e92c0ac777819509f86e9547623
make serializeUtil visible to Tests
digipost/digipost-api-client-dotnet
Digipost.Api.Client/Properties/AssemblyInfo.cs
Digipost.Api.Client/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("Digipost.Api.Client")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Digipost.Api.Client")] [assembly: AssemblyCopyright("Copyright Digipost © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: InternalsVisibleTo("Digipost.Api.Client.Tests")] // 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("47a06c01-ce61-4f3e-aee9-29d933be78e6")] // 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.*")]
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("Digipost.Api.Client")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Digipost.Api.Client")] [assembly: AssemblyCopyright("Copyright Digipost © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("47a06c01-ce61-4f3e-aee9-29d933be78e6")] // 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.*")]
apache-2.0
C#
6c7f0e4b23bfa8b2ebc2387b087186b58600200b
Fix GenerateSlug
fujiy/FujiyBlog,fujiy/FujiyBlog,fujiy/FujiyBlog
src/FujiyBlog.Core/Extensions/StringExtensions.cs
src/FujiyBlog.Core/Extensions/StringExtensions.cs
using System.Text; using System.Text.RegularExpressions; namespace FujiyBlog.Core.Extensions { public static class StringExtensions { public static string GenerateSlug(this string text) { if (string.IsNullOrWhiteSpace(text)) { return string.Empty; } text = RemoveAccent(text).ToLower(); text = Regex.Replace(text, @"[^a-z0-9\s-]", ""); // invalid chars text = Regex.Replace(text, @"[\s-]+", "-").Trim(); // convert multiple spaces or hyphens into one hyphen //text = Regex.Replace(text, @"\s", "-"); // hyphens text = text.Substring(0, text.Length <= 200 ? text.Length : 200).Trim(); // cut and trim it return text; } private static string RemoveAccent(string txt) { byte[] bytes = Encoding.GetEncoding("Cyrillic").GetBytes(txt); return Encoding.ASCII.GetString(bytes); } private static readonly Regex RegexStripHtml = new Regex("<[^>]*>", RegexOptions.Compiled); public static string StripHtml(this string html) { return string.IsNullOrWhiteSpace(html) ? string.Empty : RegexStripHtml.Replace(html, string.Empty).Trim(); } } }
using System.Text; using System.Text.RegularExpressions; namespace FujiyBlog.Core.Extensions { public static class StringExtensions { public static string GenerateSlug(this string text) { text = RemoveAccent(text).ToLower(); text = Regex.Replace(text, @"[^a-z0-9\s-]", ""); // invalid chars text = Regex.Replace(text, @"\s+", " ").Trim(); // convert multiple spaces into one space text = text.Substring(0, text.Length <= 200 ? text.Length : 200).Trim(); // cut and trim it text = Regex.Replace(text, @"\s", "-"); // hyphens return text; } private static string RemoveAccent(string txt) { byte[] bytes = Encoding.GetEncoding("Cyrillic").GetBytes(txt); return Encoding.ASCII.GetString(bytes); } private static readonly Regex RegexStripHtml = new Regex("<[^>]*>", RegexOptions.Compiled); public static string StripHtml(this string html) { return string.IsNullOrWhiteSpace(html) ? string.Empty : RegexStripHtml.Replace(html, string.Empty).Trim(); } } }
mit
C#
51f69f171192e0534e3221be9f2b41023fac8cf5
Rename listened table in migration
B1naryStudio/Azimuth,B1naryStudio/Azimuth
Azimuth.Migrations/Migrations/Migration_201409101200_RemoveListenedTableAndAddCounterToPlaylistTable.cs
Azimuth.Migrations/Migrations/Migration_201409101200_RemoveListenedTableAndAddCounterToPlaylistTable.cs
 using FluentMigrator; namespace Azimuth.Migrations { [Migration(201409101200)] public class Migration_201409101200_RemoveListenedTableAndAddCounterToPlaylistTable: Migration { public override void Up() { Delete.Table("Listened"); Alter.Table("Playlists").AddColumn("Listened").AsInt64().WithDefaultValue(0); } public override void Down() { Create.Table("Listened") .WithColumn("Id").AsInt64().NotNullable().Identity().PrimaryKey() .WithColumn("PlaylistId").AsInt64().NotNullable().ForeignKey("Playlists", "PlaylistsId") .WithColumn("Amount").AsInt64().NotNullable(); Delete.Column("Listened").FromTable("Playlists"); } } }
 using FluentMigrator; namespace Azimuth.Migrations { [Migration(201409101200)] public class Migration_201409101200_RemoveListenedTableAndAddCounterToPlaylistTable: Migration { public override void Up() { Delete.Table("Listened"); Alter.Table("Playlists").AddColumn("Listened").AsInt64().WithDefaultValue(0); } public override void Down() { Create.Table("UnauthorizedListeners") .WithColumn("Id").AsInt64().NotNullable().Identity().PrimaryKey() .WithColumn("PlaylistId").AsInt64().NotNullable().ForeignKey("Playlists", "PlaylistsId") .WithColumn("Amount").AsInt64().NotNullable(); Delete.Column("Listened").FromTable("Playlists"); } } }
mit
C#
5d6f72a9730a078616b51d0f91b181875b1b78d8
fix build
WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common
src/WeihanLi.Common/Helpers/DelegateTextWriter.cs
src/WeihanLi.Common/Helpers/DelegateTextWriter.cs
using System; using System.IO; using System.Text; using System.Threading.Tasks; namespace WeihanLi.Common.Helpers { public class DelegateTextWriter : TextWriter { public override Encoding Encoding => Encoding.UTF8; private readonly Action<string> _onLineWritten; private readonly StringBuilder _builder; public DelegateTextWriter(Action<string> onLineWritten) { _onLineWritten = onLineWritten ?? throw new ArgumentNullException(nameof(onLineWritten)); _builder = new StringBuilder(); } public override void Flush() { if (_builder.Length > 0) { FlushInternal(); } } public override Task FlushAsync() { if (_builder.Length > 0) { FlushInternal(); } return TaskHelper.CompletedTask; } public override void Write(char value) { if (value == '\n') { FlushInternal(); } else { _builder.Append(value); } } public override Task WriteAsync(char value) { if (value == '\n') { FlushInternal(); } else { _builder.Append(value); } return TaskHelper.CompletedTask; } private void FlushInternal() { _onLineWritten(_builder.ToString()); _builder.Clear(); } } }
using System; using System.IO; using System.Text; using System.Threading.Tasks; namespace WeihanLi.Common.Helpers { public class DelegateTextWriter : TextWriter { public override Encoding Encoding => Encoding.UTF8; private readonly Action<string> _onLineWritten; private readonly StringBuilder _builder; public DelegateTextWriter(Action<string> onLineWritten) { _onLineWritten = onLineWritten ?? throw new ArgumentNullException(nameof(onLineWritten)); _builder = new StringBuilder(); } public override void Flush() { if (_builder.Length > 0) { FlushInternal(); } } public override Task FlushAsync() { if (_builder.Length > 0) { FlushInternal(); } return TaskHelper.CompletedTask; } public override void Write(char value) { if (value == '\n') { FlushInternal(); } else { _builder.Append(value); } } public override Task WriteAsync(char value) { if (value == '\n') { FlushInternal(); } else { _builder.Append(value); } return Task.CompletedTask; } private void FlushInternal() { _onLineWritten(_builder.ToString()); _builder.Clear(); } } }
mit
C#
cc2584876f5ce2c2e47fb6ba5319c58792642547
Revert "defined scene parameters"
tt-acm/Spectacles.GrasshopperExporter
GHva3c/GHva3c/va3c_Scene.cs
GHva3c/GHva3c/va3c_Scene.cs
using System; using System.Collections.Generic; using Grasshopper.Kernel; using Rhino.Geometry; namespace GHva3c { public class va3c_Scene : GH_Component { /// <summary> /// Initializes a new instance of the va3c_Scene class. /// </summary> public va3c_Scene() : base("va3c_Scene", "Nickname", "Description", "Category", "Subcategory") { } /// <summary> /// Registers all the input parameters for this component. /// </summary> protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { } /// <summary> /// Registers all the output parameters for this component. /// </summary> protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { } /// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { } /// <summary> /// Provides an Icon for the component. /// </summary> protected override System.Drawing.Bitmap Icon { get { //You can add image files to your project resources and access them like this: // return Resources.IconForThisComponent; return null; } } /// <summary> /// Gets the unique ID for this component. Do not change this ID after release. /// </summary> public override Guid ComponentGuid { get { return new Guid("{392e8cc6-8e8d-41e6-96ce-cc39f1a5f31c}"); } } } }
using System; using System.Collections.Generic; using Grasshopper.Kernel; using Rhino.Geometry; namespace GHva3c { public class va3c_Scene : GH_Component { /// <summary> /// Initializes a new instance of the va3c_Scene class. /// </summary> public va3c_Scene() : base("va3c_Scene", "va3c_Scene", "va3c_Scene", "Category", "Subcategory") { } /// <summary> /// Registers all the input parameters for this component. /// </summary> protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddTextParameter("Geometry", "G", "va3c geometry", GH_ParamAccess.item); pManager.AddTextParameter("[Lights]", "[L]", "va3c light sources", GH_ParamAccess.item); pManager.AddTextParameter("[Cameras]", "[C]", "va3c cameras", GH_ParamAccess.item); } /// <summary> /// Registers all the output parameters for this component. /// </summary> protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { } /// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { } /// <summary> /// Provides an Icon for the component. /// </summary> protected override System.Drawing.Bitmap Icon { get { //You can add image files to your project resources and access them like this: // return Resources.IconForThisComponent; return null; } } /// <summary> /// Gets the unique ID for this component. Do not change this ID after release. /// </summary> public override Guid ComponentGuid { get { return new Guid("{392e8cc6-8e8d-41e6-96ce-cc39f1a5f31c}"); } } } }
mit
C#
9ba8441a3bebe5133c5f5639cb2d6178dc4a7083
Include Fact attribute on test method
henriqueprj/infixtopostfix
test/MathParser.Tests/InfixLexicalAnalyzerTest.cs
test/MathParser.Tests/InfixLexicalAnalyzerTest.cs
using Xunit; namespace MathParser.Tests { public class InfixLexicalAnalyzerTest { [Fact] public void Expressao_binaria_simples_com_espacos() { //var analyzer = new InfixLexicalAnalyzer(); //analyzer.Analyze("2 + 2"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MathParser.Tests { public class InfixLexicalAnalyzerTest { public void Expressao_binaria_simples_com_espacos() { //var analyzer = new InfixLexicalAnalyzer(); //analyzer.Analyze("2 + 2"); } } }
mit
C#
a5e642016966fb44270c21143ca6e7b31b7838ec
Update servicepointmanager to use newer TLS
neuralaxis/synapsecsharpclient
Synapse.RestClient/SynapseRestClientFactory.cs
Synapse.RestClient/SynapseRestClientFactory.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Synapse.RestClient.Transaction; namespace Synapse.RestClient { using User; using Node; using System.Net; public class SynapseRestClientFactory { private SynapseApiCredentials _creds; private string _baseUrl; public SynapseRestClientFactory(SynapseApiCredentials credentials, string baseUrl) { this._creds = credentials; this._baseUrl = baseUrl; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; } public ISynapseUserApiClient CreateUserClient() { return new SynapseUserApiClient(this._creds, this._baseUrl); } public ISynapseNodeApiClient CreateNodeClient() { return new SynapseNodeApiClient(this._creds, this._baseUrl); } public ISynapseTransactionApiClient CreateTransactionClient() { return new SynapseTransactionApiClient(this._creds, this._baseUrl); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Synapse.RestClient.Transaction; namespace Synapse.RestClient { using User; using Node; public class SynapseRestClientFactory { private SynapseApiCredentials _creds; private string _baseUrl; public SynapseRestClientFactory(SynapseApiCredentials credentials, string baseUrl) { this._creds = credentials; this._baseUrl = baseUrl; } public ISynapseUserApiClient CreateUserClient() { return new SynapseUserApiClient(this._creds, this._baseUrl); } public ISynapseNodeApiClient CreateNodeClient() { return new SynapseNodeApiClient(this._creds, this._baseUrl); } public ISynapseTransactionApiClient CreateTransactionClient() { return new SynapseTransactionApiClient(this._creds, this._baseUrl); } } }
mit
C#
d6aeb8e17a33bd4486bb6cc7288d21f510a86ba9
adjust error message format
acple/ParsecSharp
ParsecSharp/Parser/Parser.Monad.Extensions.cs
ParsecSharp/Parser/Parser.Monad.Extensions.cs
using System; using System.Runtime.CompilerServices; using ParsecSharp.Internal; namespace ParsecSharp { public static partial class Parser { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, TResult> Bind<TToken, T, TResult>(this Parser<TToken, T> parser, Func<T, Parser<TToken, TResult>> next) => new Bind<TToken, T, TResult>(parser, next); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, TResult> Bind<TToken, T, TResult>(this Parser<TToken, T> parser, Func<T, Parser<TToken, TResult>> next, Func<Fail<TToken, T>, Parser<TToken, TResult>> resume) => new Next<TToken, T, TResult>(parser, next, resume); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, T> Alternative<TToken, T>(this Parser<TToken, T> first, Parser<TToken, T> second) => new Alternative<TToken, T>(first, second); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, T> Alternative<TToken, T>(this Parser<TToken, T> parser, Func<Fail<TToken, T>, Parser<TToken, T>> resume) => new Resume<TToken, T>(parser, resume); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, TResult> Map<TToken, T, TResult>(this Parser<TToken, T> parser, Func<T, TResult> function) => parser.Bind(x => Pure<TToken, TResult>(function(x))); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, T> Guard<TToken, T>(this Parser<TToken, T> parser, Func<T, bool> predicate) => parser.Guard(predicate, x => $"A value '{x?.ToString() ?? "<null>"}' does not satisfy condition"); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, T> Guard<TToken, T>(this Parser<TToken, T> parser, Func<T, bool> predicate, Func<T, string> message) => parser.Bind(x => (predicate(x)) ? Pure<TToken, T>(x) : Fail<TToken, T>($"At {nameof(Guard)}, {message(x)}")); } }
using System; using System.Runtime.CompilerServices; using ParsecSharp.Internal; namespace ParsecSharp { public static partial class Parser { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, TResult> Bind<TToken, T, TResult>(this Parser<TToken, T> parser, Func<T, Parser<TToken, TResult>> next) => new Bind<TToken, T, TResult>(parser, next); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, TResult> Bind<TToken, T, TResult>(this Parser<TToken, T> parser, Func<T, Parser<TToken, TResult>> next, Func<Fail<TToken, T>, Parser<TToken, TResult>> resume) => new Next<TToken, T, TResult>(parser, next, resume); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, T> Alternative<TToken, T>(this Parser<TToken, T> first, Parser<TToken, T> second) => new Alternative<TToken, T>(first, second); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, T> Alternative<TToken, T>(this Parser<TToken, T> parser, Func<Fail<TToken, T>, Parser<TToken, T>> resume) => new Resume<TToken, T>(parser, resume); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, TResult> Map<TToken, T, TResult>(this Parser<TToken, T> parser, Func<T, TResult> function) => parser.Bind(x => Pure<TToken, TResult>(function(x))); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, T> Guard<TToken, T>(this Parser<TToken, T> parser, Func<T, bool> predicate) => parser.Guard(predicate, x => $"A value '{x?.ToString() ?? "<null>"}' doesn't satisfy condition"); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Parser<TToken, T> Guard<TToken, T>(this Parser<TToken, T> parser, Func<T, bool> predicate, Func<T, string> message) => parser.Bind(x => (predicate(x)) ? Pure<TToken, T>(x) : Fail<TToken, T>($"At {nameof(Guard)}, {message(x)}")); } }
mit
C#
24aa71913800ebd121cbb9fcf2a7cf79d47744dd
Hide mouse cursor.
PlanetLotus/FPS-Sandbox,PlanetLotus/FPS-Sandbox
Assets/NetworkManager.cs
Assets/NetworkManager.cs
using UnityEngine; using UnityEngine.UI; using System.Collections.Generic; public class NetworkManager : MonoBehaviour { public List<string> ChatMessages; public bool IsOfflineMode; public GameObject playerControllerPrefab; public void AddChatMessage(string message) { PhotonView.Get(this).RPC("AddChatMessageRPC", PhotonTargets.All, message); } [RPC] private void AddChatMessageRPC(string message) { // TODO: If message is longer than x characters, split it into multiple messages so that it fits inside the textbox while (ChatMessages.Count >= maxChatMessages) { ChatMessages.RemoveAt(0); } ChatMessages.Add(message); } void Start() { PhotonNetwork.player.name = PlayerPrefs.GetString("Username", "Matt"); ChatMessages = new List<string>(); if (IsOfflineMode) { PhotonNetwork.offlineMode = true; OnJoinedLobby(); } else { Connect(); } } void Update() { } void Connect() { PhotonNetwork.ConnectUsingSettings("FPS Test v001"); } void OnGUI() { } void OnJoinedLobby() { Debug.Log("OnJoinedLobby"); PhotonNetwork.JoinRandomRoom(); } void OnPhotonRandomJoinFailed() { Debug.Log("OnPhotonRandomJoinFailed"); PhotonNetwork.CreateRoom(null); } void OnJoinedRoom() { Debug.Log("OnJoinedRoom"); AddChatMessage("[SYSTEM] OnJoinedRoom!"); SpawnPlayer(); } void SpawnPlayer() { AddChatMessage("[SYSTEM] Spawning Player: " + PhotonNetwork.player.ID); GameObject player = PhotonNetwork.Instantiate(playerControllerPrefab.name, Vector3.zero, Quaternion.identity, 0); ((MonoBehaviour)player.GetComponent("MouseLook")).enabled = true; ((MonoBehaviour)player.GetComponent("PlayerController")).enabled = true; player.transform.FindChild("Main Camera").gameObject.SetActive(true); Cursor.visible = false; } const int maxChatMessages = 7; }
using UnityEngine; using UnityEngine.UI; using System.Collections.Generic; public class NetworkManager : MonoBehaviour { public List<string> ChatMessages; public bool IsOfflineMode; public GameObject playerControllerPrefab; public void AddChatMessage(string message) { PhotonView.Get(this).RPC("AddChatMessageRPC", PhotonTargets.All, message); } [RPC] private void AddChatMessageRPC(string message) { // TODO: If message is longer than x characters, split it into multiple messages so that it fits inside the textbox while (ChatMessages.Count >= maxChatMessages) { ChatMessages.RemoveAt(0); } ChatMessages.Add(message); } void Start() { PhotonNetwork.player.name = PlayerPrefs.GetString("Username", "Matt"); ChatMessages = new List<string>(); if (IsOfflineMode) { PhotonNetwork.offlineMode = true; OnJoinedLobby(); } else { Connect(); } } void Update() { } void Connect() { PhotonNetwork.ConnectUsingSettings("FPS Test v001"); } void OnGUI() { } void OnJoinedLobby() { Debug.Log("OnJoinedLobby"); PhotonNetwork.JoinRandomRoom(); } void OnPhotonRandomJoinFailed() { Debug.Log("OnPhotonRandomJoinFailed"); PhotonNetwork.CreateRoom(null); } void OnJoinedRoom() { Debug.Log("OnJoinedRoom"); AddChatMessage("[SYSTEM] OnJoinedRoom!"); SpawnPlayer(); } void SpawnPlayer() { AddChatMessage("[SYSTEM] Spawning Player: " + PhotonNetwork.player.ID); GameObject player = PhotonNetwork.Instantiate(playerControllerPrefab.name, Vector3.zero, Quaternion.identity, 0); ((MonoBehaviour)player.GetComponent("MouseLook")).enabled = true; ((MonoBehaviour)player.GetComponent("PlayerController")).enabled = true; player.transform.FindChild("Main Camera").gameObject.SetActive(true); } const int maxChatMessages = 7; }
mit
C#
84ab87c2b97358904ef3abab2595c03c56c28ef5
Update UserSessionScopeStorage.cs
tiksn/TIKSN-Framework
TIKSN.Core/Session/UserSessionScopeStorage.cs
TIKSN.Core/Session/UserSessionScopeStorage.cs
using System; using System.Collections.Concurrent; using Microsoft.Extensions.DependencyInjection; namespace TIKSN.Session { public class UserSessionScopeStorage<TIdentity> : IUserSessionScopeStorage<TIdentity> where TIdentity : IEquatable<TIdentity> { private readonly ConcurrentDictionary<TIdentity, IServiceScope> _scopes; private readonly IServiceProvider _serviceProvider; public UserSessionScopeStorage(IServiceProvider serviceProvider) { this._scopes = new ConcurrentDictionary<TIdentity, IServiceScope>(); this._serviceProvider = serviceProvider; } public IServiceProvider GetOrAddServiceProvider(TIdentity id) => this._scopes.GetOrAdd(id, key => this._serviceProvider.CreateScope()).ServiceProvider; public bool TryRemoveServiceProvider(TIdentity id) { var removed = this._scopes.TryRemove(id, out var removedScope); if (removed) { removedScope.Dispose(); } return removed; } } }
using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Concurrent; namespace TIKSN.Session { public class UserSessionScopeStorage<TIdentity> : IUserSessionScopeStorage<TIdentity> where TIdentity : IEquatable<TIdentity> { private readonly ConcurrentDictionary<TIdentity, IServiceScope> _scopes; private readonly IServiceProvider _serviceProvider; public UserSessionScopeStorage(IServiceProvider serviceProvider) { _scopes = new ConcurrentDictionary<TIdentity, IServiceScope>(); _serviceProvider = serviceProvider; } public IServiceProvider GetOrAddServiceProvider(TIdentity id) { return _scopes.GetOrAdd(id, key => _serviceProvider.CreateScope()).ServiceProvider; } public bool TryRemoveServiceProvider(TIdentity id) { var removed = _scopes.TryRemove(id, out IServiceScope removedScope); if (removed) removedScope.Dispose(); return removed; } } }
mit
C#
c77a00d000001f574d5349b3e167017972f3d570
Update maze-runner test
bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity
features/fixtures/Main.cs
features/fixtures/Main.cs
using UnityEngine; using System.Collections; using System.Collections.Generic; #if UNITY_EDITOR using UnityEditor; #endif public class Main : MonoBehaviour { #if UNITY_EDITOR public static void CreateScene() { var scene = UnityEditor.SceneManagement.EditorSceneManager.NewScene(UnityEditor.SceneManagement.NewSceneSetup.DefaultGameObjects, UnityEditor.SceneManagement.NewSceneMode.Single); UnityEngine.SceneManagement.SceneManager.SetActiveScene(scene); var obj = new GameObject("Bugsnag"); var bugsnag = obj.AddComponent<BugsnagUnity.BugsnagBehaviour>(); bugsnag.BugsnagApiKey = System.Environment.GetEnvironmentVariable("BUGSNAG_APIKEY"); obj.AddComponent<Main>(); UnityEditor.SceneManagement.EditorSceneManager.SaveScene(scene, "Assets/MainScene.unity"); var scenes = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes); scenes.Add(new EditorBuildSettingsScene("Assets/MainScene.unity", true)); EditorBuildSettings.scenes = scenes.ToArray(); } #endif bool sent = false; void Update() { // only send one crash if (!sent) { sent = true; BugsnagUnity.Bugsnag.Client.Configuration.Endpoint = new System.Uri(System.Environment.GetEnvironmentVariable("MAZE_ENDPOINT")); BugsnagUnity.Bugsnag.Client.Breadcrumbs.Leave("bleeb"); BugsnagUnity.Bugsnag.Client.Notify(new System.Exception("blorb"), report => { report.User.Name = "blarb"; }); // wait for 5 seconds before exiting the application StartCoroutine(WaitForBugsnag()); } } IEnumerator WaitForBugsnag() { yield return new WaitForSeconds(5); Application.Quit(); } }
using UnityEngine; using System.Collections; using System.Collections.Generic; #if UNITY_EDITOR using UnityEditor; #endif public class Main : MonoBehaviour { #if UNITY_EDITOR public static void CreateScene() { var scene = UnityEditor.SceneManagement.EditorSceneManager.NewScene(UnityEditor.SceneManagement.NewSceneSetup.DefaultGameObjects, UnityEditor.SceneManagement.NewSceneMode.Single); UnityEngine.SceneManagement.SceneManager.SetActiveScene(scene); var obj = new GameObject("Bugsnag"); var bugsnag = obj.AddComponent<BugsnagUnity.BugsnagBehaviour>(); bugsnag.BugsnagApiKey = System.Environment.GetEnvironmentVariable("BUGSNAG_APIKEY"); obj.AddComponent<Main>(); UnityEditor.SceneManagement.EditorSceneManager.SaveScene(scene, "Assets/MainScene.unity"); var scenes = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes); scenes.Add(new EditorBuildSettingsScene("Assets/MainScene.unity", true)); EditorBuildSettings.scenes = scenes.ToArray(); } #endif bool sent = false; void Update() { // only send one crash if (!sent) { sent = true; BugsnagUnity.Bugsnag.Client.Configuration.Endpoint = new System.Uri(System.Environment.GetEnvironmentVariable("MAZE_ENDPOINT")); BugsnagUnity.Bugsnag.Client.Breadcrumbs.Leave("bleeb"); BugsnagUnity.Bugsnag.Client.Notify(new System.Exception("blorb"), report => { report.Event.User.Name = "blarb"; }); // wait for 5 seconds before exiting the application StartCoroutine(WaitForBugsnag()); } } IEnumerator WaitForBugsnag() { yield return new WaitForSeconds(5); Application.Quit(); } }
mit
C#
1cf43ac2155991869a19ddc8931348d92c52c22b
Update run.cs
ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls
stubs/cSharp-Net/run.cs
stubs/cSharp-Net/run.cs
using System; using System.Net; //tested with Mono and Visual Studio: //* Mono: can't recommend using, test if you do not believe //* Visual Studio (all Ok). Same for F# and Visual Basic Stubs public class Run { static public void Main (String []args) { if (args.Length != 2){ Console.WriteLine("UNSUPPORTED"); Environment.Exit(0); } String host, port; host = args[0]; port = args[1]; try { string url = "https://" + host + ":" + port; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Console.WriteLine ("VERIFY SUCCESS"); } catch (System.Net.WebException e) { if (! e.ToString().Contains("NameResolutionFailure")){ Console.WriteLine("VERIFY FAILURE"); } else { Console.WriteLine (e); Environment.Exit(1); } } catch (System.Exception e) { Console.WriteLine (e); Environment.Exit(1); } Environment.Exit(0); } }
using System; using System.Net; //tested with Mono and cannot recommend using public class Run { static public void Main (String []args) { if (args.Length != 2){ Console.WriteLine("UNSUPPORTED"); Environment.Exit(0); } String host, port; host = args[0]; port = args[1]; try { string url = "https://" + host + ":" + port; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Console.WriteLine ("VERIFY SUCCESS"); } catch (System.Net.WebException e) { if (! e.ToString().Contains("NameResolutionFailure")){ Console.WriteLine("VERIFY FAILURE"); } else { Console.WriteLine (e); Environment.Exit(1); } } catch (System.Exception e) { Console.WriteLine (e); Environment.Exit(1); } Environment.Exit(0); } }
mit
C#
20ff63a7db147b054995bf67e0a68a5fb600a01f
Simplify IsParameterSet method
jbe2277/musicmanager
src/MusicManager/MusicManager.Presentation/Converters/ConverterHelper.cs
src/MusicManager/MusicManager.Presentation/Converters/ConverterHelper.cs
using System; namespace Waf.MusicManager.Presentation.Converters { internal static class ConverterHelper { public static bool IsParameterSet(string expectedParameter, object actualParameter) { return string.Equals(actualParameter as string, expectedParameter, StringComparison.OrdinalIgnoreCase); } } }
using System; namespace Waf.MusicManager.Presentation.Converters { internal static class ConverterHelper { public static bool IsParameterSet(string expectedParameter, object actualParameter) { string parameter = actualParameter as string; return !string.IsNullOrEmpty(parameter) && string.Equals(parameter, expectedParameter, StringComparison.OrdinalIgnoreCase); } } }
mit
C#
4560266c5b5326b1f6709d816eae2fafaf1df911
Rename field.
fffej/BobTheBuilder,alastairs/BobTheBuilder
BobTheBuilder/Builder.cs
BobTheBuilder/Builder.cs
using System; using System.Dynamic; namespace BobTheBuilder { public class DynamicBuilder : DynamicObject { private readonly Type _destinationType; private object _property; internal DynamicBuilder(Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } _destinationType = destinationType; } public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { _property = args[0]; result = this; return true; } public object Build() { object instance = Activator.CreateInstance(_destinationType); instance.GetType().GetProperty("StringProperty").SetValue(instance, _property); return instance; } } public class A { public static dynamic BuilderFor<T>() where T: class { return new DynamicBuilder(typeof(T)); } } }
using System; using System.Dynamic; namespace BobTheBuilder { public class DynamicBuilder : DynamicObject { private readonly Type _destinationType; private object property; internal DynamicBuilder(Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } _destinationType = destinationType; } public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { property = args[0]; result = this; return true; } public object Build() { object instance = Activator.CreateInstance(_destinationType); instance.GetType().GetProperty("StringProperty").SetValue(instance, property); return instance; } } public class A { public static dynamic BuilderFor<T>() where T: class { return new DynamicBuilder(typeof(T)); } } }
apache-2.0
C#
c1c4e3e562189e9238f2d9f63e1373d69b01ae1e
Update IValidatableModel.cs
Windows-XAML/Template10.Validation
Library/Interfaces.Validation/IValidatableModel.cs
Library/Interfaces.Validation/IValidatableModel.cs
using System; using System.Collections.ObjectModel; using Template10.Controls.Validation; using Template10.Mvvm.Validation; namespace Template10.Interfaces.Validation { public interface IValidatableModel : IBindable { bool Validate(bool validateAfter); void Revert(); void MarkAsClean(); ObservableDictionary<string, IProperty> Properties { get; } ObservableCollection<string> Errors { get; } Action<IValidatableModel> Validator { set; get; } bool IsValid { get; } bool IsDirty { get; } } }
using System; using System.Collections.ObjectModel; using Template10.Controls.Validation; using Template10.Mvvm.Validation; namespace Template10.Interfaces.Validation { public interface IValidatableModel : IBindable { bool Validate(); void Revert(); void MarkAsClean(); ObservableDictionary<string, IProperty> Properties { get; } ObservableCollection<string> Errors { get; } Action<IValidatableModel> Validator { set; get; } bool IsValid { get; } bool IsDirty { get; } } }
mit
C#
c89ec0dda19893397055f75ebf1ff01d859c3dfd
Add missing "using geckofx" for mono build
StephenMcConnel/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,StephenMcConnel/BloomDesktop,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,andrew-polk/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,JohnThomson/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,andrew-polk/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop
src/BloomTests/ProblemReporterDialogTests.cs
src/BloomTests/ProblemReporterDialogTests.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using Bloom; using Bloom.MiscUI; using NUnit.Framework; #if __MonoCS__ using Gecko; #endif namespace BloomTests { [TestFixture] #if __MonoCS__ [RequiresSTA] #endif public class ProblemReporterDialogTests { [TestFixtureSetUp] public void FixtureSetup() { Browser.SetUpXulRunner(); } [TestFixtureTearDown] public void FixtureTearDown() { #if __MonoCS__ // Doing this in Windows works on dev machines but somehow freezes the TC test runner Xpcom.Shutdown(); #endif } /// <summary> /// This is just a smoke-test that will notify us if the SIL JIRA stops working with the API we're relying on. /// It sends reports to https://jira.sil.org/browse/AUT /// </summary> [Test] public void CanSubmitToSILJiraAutomatedTestProject() { using (var dlg = new ProblemReporterDialog(null, null)) { dlg.SetupForUnitTest("AUT"); dlg.ShowDialog(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using Bloom; using Bloom.MiscUI; using NUnit.Framework; namespace BloomTests { [TestFixture] #if __MonoCS__ [RequiresSTA] #endif public class ProblemReporterDialogTests { [TestFixtureSetUp] public void FixtureSetup() { Browser.SetUpXulRunner(); } [TestFixtureTearDown] public void FixtureTearDown() { #if __MonoCS__ // Doing this in Windows works on dev machines but somehow freezes the TC test runner Xpcom.Shutdown(); #endif } /// <summary> /// This is just a smoke-test that will notify us if the SIL JIRA stops working with the API we're relying on. /// It sends reports to https://jira.sil.org/browse/AUT /// </summary> [Test] public void CanSubmitToSILJiraAutomatedTestProject() { using (var dlg = new ProblemReporterDialog(null, null)) { dlg.SetupForUnitTest("AUT"); dlg.ShowDialog(); } } } }
mit
C#
ea55f8db711a621e5f0710f650bc45fbeb4b8b49
Update OidcConfigurationController.cs
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/OidcConfigurationController.cs
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/OidcConfigurationController.cs
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.Mvc; namespace Company.WebApplication1.Controllers { public class OidcConfigurationController : Controller { private readonly ILogger<OidcConfigurationController> logger; public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> _logger) { ClientRequestParametersProvider = clientRequestParametersProvider; logger = _logger; } public IClientRequestParametersProvider ClientRequestParametersProvider { get; } [HttpGet("_configuration/{clientId}")] public IActionResult GetClientRequestParameters([FromRoute]string clientId) { var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId); return Ok(parameters); } } }
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.Mvc; namespace Company.WebApplication1.Controllers { public class OidcConfigurationController : Controller { private readonly ILogger<SampleDataController> logger; public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<SampleDataController> _logger) { ClientRequestParametersProvider = clientRequestParametersProvider; logger = _logger; } public IClientRequestParametersProvider ClientRequestParametersProvider { get; } [HttpGet("_configuration/{clientId}")] public IActionResult GetClientRequestParameters([FromRoute]string clientId) { var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId); return Ok(parameters); } } }
apache-2.0
C#
76aff950eb99b176309c1e86a4b44c9beb09fee0
Add retry parameter to RetryAfterDelay
step-up-labs/firebase-database-dotnet
src/Firebase/Extensions/ObservableExtensions.cs
src/Firebase/Extensions/ObservableExtensions.cs
namespace Firebase.Database.Extensions { using System; using System.Reactive.Linq; public static class ObservableExtensions { /// <summary> /// Returns a cold observable which retries (re-subscribes to) the source observable on error until it successfully terminates. /// </summary> /// <param name="source">The source observable.</param> /// <param name="dueTime">How long to wait between attempts.</param> /// <param name="retryOnError">A predicate determining for which exceptions to retry. Defaults to all</param> /// <param name="retryCount">The number of attempts of running the source observable before failing.</param> /// <returns> /// A cold observable which retries (re-subscribes to) the source observable on error up to the /// specified number of times or until it successfully terminates. /// </returns> public static IObservable<T> RetryAfterDelay<T, TException>( this IObservable<T> source, TimeSpan dueTime, Func<TException, bool> retryOnError, int? retryCount = null) where TException: Exception { int attempt = 0; var pipeline = Observable.Defer(() => { return ((++attempt == 1) ? source : source.DelaySubscription(dueTime)) .Select(item => new Tuple<bool, T, Exception>(true, item, null)) .Catch<Tuple<bool, T, Exception>, TException>(e => retryOnError(e) ? Observable.Throw<Tuple<bool, T, Exception>>(e) : Observable.Return(new Tuple<bool, T, Exception>(false, default(T), e))); }); if (retryCount.HasValue) { pipeline = pipeline.Retry(retryCount.Value); } else { pipeline = pipeline.Retry(); } return pipeline.SelectMany(t => t.Item1 ? Observable.Return(t.Item2) : Observable.Throw<T>(t.Item3)); } } }
namespace Firebase.Database.Extensions { using System; using System.Reactive.Linq; public static class ObservableExtensions { /// <summary> /// Returns a cold observable which retries (re-subscribes to) the source observable on error until it successfully terminates. /// </summary> /// <param name="source">The source observable.</param> /// <param name="dueTime">How long to wait between attempts.</param> /// <param name="retryOnError">A predicate determining for which exceptions to retry. Defaults to all</param> /// <returns> /// A cold observable which retries (re-subscribes to) the source observable on error up to the /// specified number of times or until it successfully terminates. /// </returns> public static IObservable<T> RetryAfterDelay<T, TException>( this IObservable<T> source, TimeSpan dueTime, Func<TException, bool> retryOnError) where TException: Exception { int attempt = 0; return Observable.Defer(() => { return ((++attempt == 1) ? source : source.DelaySubscription(dueTime)) .Select(item => new Tuple<bool, T, Exception>(true, item, null)) .Catch<Tuple<bool, T, Exception>, TException>(e => retryOnError(e) ? Observable.Throw<Tuple<bool, T, Exception>>(e) : Observable.Return(new Tuple<bool, T, Exception>(false, default(T), e))); }) .Retry() .SelectMany(t => t.Item1 ? Observable.Return(t.Item2) : Observable.Throw<T>(t.Item3)); } } }
mit
C#
f27e286643afcb79046d1627817cf3ce0653c2cc
Update IsGroupConverter.cs
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
src/Core2D/UI/Avalonia/Converters/IsGroupConverter.cs
src/Core2D/UI/Avalonia/Converters/IsGroupConverter.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Globalization; using Avalonia.Data.Converters; using Core2D.Shapes; namespace Core2D.UI.Avalonia.Converters { /// <summary> /// Converts a binding value object from <see cref="object"/> to <see cref="bool"/> True if value is not equal to null and is of type <see cref="GroupShape"/> otherwise return False. /// </summary> public class IsGroupConverter : IValueConverter { /// <summary> /// Converts a value. /// </summary> /// <param name="value">The value to convert.</param> /// <param name="targetType">The type of the target.</param> /// <param name="parameter">A user-defined parameter.</param> /// <param name="culture">The culture to use.</param> /// <returns>The converted value.</returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return value != null && value.GetType() == typeof(GroupShape); } /// <summary> /// Converts a value. /// </summary> /// <param name="value">The value to convert.</param> /// <param name="targetType">The type of the target.</param> /// <param name="parameter">A user-defined parameter.</param> /// <param name="culture">The culture to use.</param> /// <returns>The converted value.</returns> public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Avalonia.Data.Converters; using Core2D.Shapes; using System; using System.Globalization; namespace Core2D.UI.Avalonia.Converters { /// <summary> /// Converts a binding value object from <see cref="object"/> to <see cref="bool"/> True if value is not equal to null and is of type <see cref="GroupShape"/> otherwise return False. /// </summary> public class IsGroupConverter : IValueConverter { /// <summary> /// Converts a value. /// </summary> /// <param name="value">The value to convert.</param> /// <param name="targetType">The type of the target.</param> /// <param name="parameter">A user-defined parameter.</param> /// <param name="culture">The culture to use.</param> /// <returns>The converted value.</returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return value != null && value.GetType() == typeof(GroupShape); } /// <summary> /// Converts a value. /// </summary> /// <param name="value">The value to convert.</param> /// <param name="targetType">The type of the target.</param> /// <param name="parameter">A user-defined parameter.</param> /// <param name="culture">The culture to use.</param> /// <returns>The converted value.</returns> public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
mit
C#
cce9486464dee71ce0b6ea4500ddeb61606f3711
Fix edit-manifest cmdlet
Ackara/Buildbox
src/Ncrement.Powershell/Cmdlets/EditManifestCmdlet.cs
src/Ncrement.Powershell/Cmdlets/EditManifestCmdlet.cs
using Acklann.Ncrement.Extensions; using System.IO; using System.Management.Automation; using System.Text; namespace Acklann.Ncrement.Cmdlets { /// <summary> /// <para type="synopsis">Edit a manifest file.</para> /// </summary> /// <seealso cref="Acklann.Ncrement.Cmdlets.ManifestCmdletBase" /> [Cmdlet(VerbsData.Edit, (nameof(Ncrement) + nameof(Manifest)), ConfirmImpact = ConfirmImpact.Medium)] public class EditManifestCmdlet : ManifestCmdletBase { /// <summary> /// <para type="description">The absolute path of the manifest file.</para> /// </summary> [ValidateNotNullOrEmpty] [Parameter(Position = 1)] public string ManifestPath { get; set; } /// <summary> /// <para type="description">The [Manifest] to be used to overwritting the file.</para> /// </summary> [Alias(nameof(PathInfo.Path), nameof(FileInfo.FullName))] [Parameter(ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] public PSObject InputObject { get; set; } /// <summary> /// <para type="description">Determine whether the modified file should be staged in source control.</para> /// </summary> [Parameter] public SwitchParameter Stage { get; set; } /// <summary> /// Processes the record. /// </summary> protected override void ProcessRecord() { Manifest manifest = null; string manifestPath = null; InputObject?.GetManifestInfo(out manifest, out manifestPath); manifest = Overwrite(manifest ?? Manifest.LoadFrom(ManifestPath = ManifestPath ?? manifestPath)); string json = Editor.UpdateManifestFile(ManifestPath, manifest); using (var file = new FileStream(ManifestPath, FileMode.Create, FileAccess.Write, FileShare.Read)) using (var writer = new StreamWriter(file, Encoding.UTF8)) { writer.Write(json); writer.Flush(); } if (Stage) Git.Stage(ManifestPath); WriteObject(manifest.ToPSObject()); } } }
using Acklann.Ncrement.Extensions; using System.IO; using System.Management.Automation; using System.Text; namespace Acklann.Ncrement.Cmdlets { /// <summary> /// <para type="synopsis">Edit a manifest file.</para> /// </summary> /// <seealso cref="Acklann.Ncrement.Cmdlets.ManifestCmdletBase" /> [Cmdlet(VerbsData.Edit, (nameof(Ncrement) + nameof(Manifest)), ConfirmImpact = ConfirmImpact.Medium)] public class EditManifestCmdlet : ManifestCmdletBase { /// <summary> /// <para type="description">The absolute path of the manifest file.</para> /// </summary> [ValidateNotNullOrEmpty] [Parameter(Position = 1)] public string ManifestPath { get; set; } /// <summary> /// <para type="description">The [Manifest] to be used to overwritting the file.</para> /// </summary> [Alias(nameof(PathInfo.Path), nameof(FileInfo.FullName))] [Parameter(ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] public PSObject InputObject { get; set; } /// <summary> /// <para type="description">Determine whether the modified file should be staged in source control.</para> /// </summary> [Parameter] public SwitchParameter Stage { get; set; } /// <summary> /// Processes the record. /// </summary> protected override void ProcessRecord() { Manifest manifest = null; string manifestPath = null; InputObject?.GetManifestInfo(out manifest, out manifestPath); manifest = Overwrite(manifest ?? Manifest.LoadFrom(ManifestPath = ManifestPath ?? manifestPath)); string json = Editor.UpdateManifestFile(ManifestPath, manifest); using (var file = new FileStream(ManifestPath, FileMode.Open, FileAccess.Write, FileShare.Read)) using (var writer = new StreamWriter(file, Encoding.UTF8)) { writer.Write(json); writer.Flush(); } if (Stage) Git.Stage(ManifestPath); WriteObject(manifest.ToPSObject()); } } }
mit
C#
f35ad5928313fc22d8b1d16f9d2cd81629890fc7
clean up code
asibahi/RoomArrangement
RoomArrangement/Room.cs
RoomArrangement/Room.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RoomArrangement { class Room { // Meta properties private readonly int id; public int ID => id; private readonly string name; public string Name => string.Format( string.IsNullOrEmpty(name) ? "Room {1}" : "Room {1} : {0}", name, ID); private static int Population { get; set; } // Geometric properties // Note the Anchor here is supposed to be the SW Corner. public Rectangle Space { get; set; } public Point Anchor { get; set; } public char Orientation { get { if (Space.XDimension > Space.YDimension) return 'X'; else if (Space.XDimension < Space.YDimension) return 'Y'; else return 'O'; } } public Point Center { get { var pt = new Point(Anchor); pt.X += Space.XDimension / 2; pt.Y += Space.YDimension / 2; return pt; } } // Empty Constructor public Room() : this(null, new Point(), new Rectangle(3, 4)) { } // Constuctor public Room(string n, Point pt, Rectangle rec) { id = ++Population; name = n; Space = rec; Anchor = pt; Database.Add(this); } // Methods and stuff public void Rotate() { Space = new Rectangle(Space.YDimension, Space.XDimension); } public void Adjust(int x, int y, bool YOrientation) { // Setting the new Anchor Anchor = new Point(x, y); // Setting the new Orientation // 0 is X, 1 is Y. Feels better this way, but doesn't really matter. char tempChar = YOrientation ? 'Y' : 'X'; if (Orientation != 'O' && tempChar != Orientation) Rotate(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RoomArrangement { class Room { // Meta properties public int ID { get; private set; } private string name; public string Name { get { return string.Format( string.IsNullOrEmpty(name) ? "Room {1}" : "Room {1} : {0}", name, ID); } private set { name = value; } } private static int Population { get; set; } // Geometric properties // Note the Anchor here is supposed to be the SW Corner. public Rectangle Space { get; set; } public Point Anchor { get; set; } public char Orientation { get { if (Space.XDimension > Space.YDimension) return 'X'; else if (Space.XDimension < Space.YDimension) return 'Y'; else return 'O'; } } public Point Center { get { var pt = new Point(Anchor); pt.X += Space.XDimension / 2; pt.Y += Space.YDimension / 2; return pt; } } // Empty Constructor public Room() :this(null,new Point(), new Rectangle(3,4)) { } // Constuctor public Room(string n, Point pt, Rectangle rec) { ID = ++Population; Name = n; Space = rec; Anchor = pt; Database.Add(this); } // Methods and stuff public void Rotate() { Space = new Rectangle(Space.YDimension, Space.XDimension); } public void Adjust(int x, int y, bool YOrientation) { // Setting the new Anchor Anchor = new Point(x, y); // Setting the new Orientation // 0 is X, 1 is Y. Feels better this way, but doesn't really matter. char tempChar = YOrientation ? 'Y' : 'X'; if (Orientation != 'O' && tempChar != Orientation) Rotate(); } } }
mit
C#
71c6f3adf83c5a9c11c1aa832893ea21131e0da1
check IsHidden on PropertyVm creation
mcintyre321/Noodles,mcintyre321/Noodles
Noodles.Web/Helpers/FormFactoryHelperExtensions.cs
Noodles.Web/Helpers/FormFactoryHelperExtensions.cs
using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web.Mvc; using System.Web.Mvc; using FormFactory; namespace Noodles.Helpers { public static class FormFactoryHelperExtensions { public static PropertyVm ToPropertyVm(this NodeMethodParameter parameter, HtmlHelper Html) { var vm = new PropertyVm(Html, parameter.ParameterType, parameter.Name) { GetId = () => parameter.Id(), DisplayName = parameter.DisplayName, GetCustomAttributes = () => parameter.CustomAttributes, Readonly = false, IsHidden = parameter.CustomAttributes.OfType<DataTypeAttribute>().Any(x => x.CustomDataType == "Hidden"), Value = parameter.Value, Choices = parameter.Choices, Suggestions = parameter.Suggestions, Source = parameter, }; vm.IsHidden |= parameter.Locked; return vm; } } }
using System.Web.Mvc; using System.Web.Mvc; using FormFactory; namespace Noodles.Helpers { public static class FormFactoryHelperExtensions { public static PropertyVm ToPropertyVm(this NodeMethodParameter parameter, HtmlHelper Html) { var vm = new PropertyVm(Html, parameter.ParameterType, parameter.Name) { GetId = () => parameter.Id(), DisplayName = parameter.DisplayName, GetCustomAttributes = () => parameter.CustomAttributes, Readonly = false, Value = parameter.Value, Choices = parameter.Choices, Suggestions = parameter.Suggestions, Source = parameter, }; vm.IsHidden |= parameter.Locked; return vm; } } }
mit
C#
5f9d2ebf02326f505a2a3c4c476659aed225c172
Add client for simple call
avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors
csharp/Hello/HelloClient/Program.cs
csharp/Hello/HelloClient/Program.cs
using System; using Grpc.Core; using Hello; namespace HelloClient { class Program { public static void Main(string[] args) { Channel channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure); var client = new HelloService.HelloServiceClient(channel); String user = "Euler"; var reply = client.SayHello(new HelloReq { Name = user }); Console.WriteLine(reply.Result); channel.ShutdownAsync().Wait(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } }
using System; namespace HelloClient { class MainClass { public static void Main(string[] args) { Console.WriteLine("Hello World!"); } } }
mit
C#
76a2aa46baf34ae8edc3b7a0a884e5b2112107f6
allow asp.net core retry after initialization failed
zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,303248153/ZKWeb,zkweb-framework/ZKWeb
ZKWeb/ZKWeb.Hosting.AspNetCore/StartupBase.cs
ZKWeb/ZKWeb.Hosting.AspNetCore/StartupBase.cs
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.PlatformAbstractions; using System; using System.IO; using System.Threading; using System.Threading.Tasks; using ZKWebStandard.Ioc; namespace ZKWeb.Hosting.AspNetCore { /// <summary> /// Base startup class for Asp.Net Core /// </summary> public abstract class StartupBase { /// <summary> /// Get website root directory /// </summary> /// <returns></returns> public virtual string GetWebsiteRootDirectory() { var path = PlatformServices.Default.Application.ApplicationBasePath; while (!File.Exists(Path.Combine(path, "Web.config"))) { path = Path.GetDirectoryName(path); if (string.IsNullOrEmpty(path)) { throw new DirectoryNotFoundException("Website root directory not found"); } } return path; } /// <summary> /// Allow child class to configure middlewares /// </summary> protected virtual void ConfigureMiddlewares(IApplicationBuilder app) { } /// <summary> /// Configure application /// </summary> public virtual void Configure(IApplicationBuilder app, IApplicationLifetime lifetime) { try { // Initialize application Application.Ioc.RegisterMany<CoreWebsiteStopper>(ReuseType.Singleton); Application.Initialize(GetWebsiteRootDirectory()); Application.Ioc.RegisterInstance(lifetime); // Configure middlewares ConfigureMiddlewares(app); } catch { // Stop application after error reported var thread = new Thread(() => { Thread.Sleep(3000); lifetime.StopApplication(); }); thread.IsBackground = true; thread.Start(); throw; } // Set request handler, it will running in thread pool // It can't throw any exception otherwise application will get killed app.Run(coreContext => Task.Run(() => { var context = new CoreHttpContextWrapper(coreContext); try { // Handle request Application.OnRequest(context); } catch (CoreHttpResponseEndException) { // Success } catch (Exception ex) { // Error try { Application.OnError(context, ex); } catch (CoreHttpResponseEndException) { // Handle error success } catch (Exception) { // Handle error failed } } })); } } }
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.PlatformAbstractions; using System; using System.IO; using System.Threading.Tasks; using ZKWebStandard.Ioc; namespace ZKWeb.Hosting.AspNetCore { /// <summary> /// Base startup class for Asp.Net Core /// </summary> public abstract class StartupBase { /// <summary> /// Get website root directory /// </summary> /// <returns></returns> public virtual string GetWebsiteRootDirectory() { var path = PlatformServices.Default.Application.ApplicationBasePath; while (!File.Exists(Path.Combine(path, "Web.config"))) { path = Path.GetDirectoryName(path); if (string.IsNullOrEmpty(path)) { throw new DirectoryNotFoundException("Website root directory not found"); } } return path; } /// <summary> /// Allow child class to configure middlewares /// </summary> protected virtual void ConfigureMiddlewares(IApplicationBuilder app) { } /// <summary> /// Configure application /// </summary> public virtual void Configure(IApplicationBuilder app, IApplicationLifetime lifetime) { // Initialize application Application.Ioc.RegisterMany<CoreWebsiteStopper>(ReuseType.Singleton); Application.Initialize(GetWebsiteRootDirectory()); Application.Ioc.RegisterInstance(lifetime); // Configure middlewares ConfigureMiddlewares(app); // Set request handler, it will running in thread pool // It can't throw any exception otherwise application will get killed app.Run(coreContext => Task.Run(() => { var context = new CoreHttpContextWrapper(coreContext); try { // Handle request Application.OnRequest(context); } catch (CoreHttpResponseEndException) { // Success } catch (Exception ex) { // Error try { Application.OnError(context, ex); } catch (CoreHttpResponseEndException) { // Handle error success } catch (Exception) { // Handle error failed } } })); } } }
mit
C#
0bbbc134859428865d94b81f01572b32c2fce433
Add code to write split quotes
fredatgithub/MyFavoriteQuotes
SplitXmlFile/Program.cs
SplitXmlFile/Program.cs
using System; using System.IO; using System.Linq; using System.Text; using System.Xml.Linq; using System.Xml.Serialization; using MyFavoriteQuotes.Properties; using Tools; namespace SplitXmlFile { internal static class Program { private static void Main() { Action<string> display = Console.WriteLine; display("séparation d'un gros fichier xml en plusieurs petits"); //string fileName = "Quote_files\\quote1.xml"; string fileName = "quote1.xml"; int startNumber = 3; int numberOfQuotePerFile = 250; StringBuilder xmlFileHeader = new StringBuilder(); xmlFileHeader.Append(@"<?xml version=""1.0"" encoding=""utf-8"" ?>"); xmlFileHeader.Append("<Quotes>"); //xmlFileHeader.Append("<Quote>"); XDocument xmlDoc; try { xmlDoc = XDocument.Load(fileName); } catch (Exception exception) { Console.WriteLine(exception.Message); throw ; } var result = from node in xmlDoc.Descendants("Quote") where node.HasElements let xElementAuthor = node.Element("Author") where xElementAuthor != null let xElementLanguage = node.Element("Language") where xElementLanguage != null let xElementQuote = node.Element("QuoteValue") where xElementQuote != null select new { authorValue = xElementAuthor.Value, languageValue = xElementLanguage.Value, sentenceValue = xElementQuote.Value }; Quotes _allQuotes = new Quotes(); foreach (var q in result) { if (!_allQuotes.ListOfQuotes.Contains(new Quote(q.authorValue, q.languageValue, q.sentenceValue)) && q.authorValue != string.Empty && q.languageValue != string.Empty && q.sentenceValue != string.Empty) { _allQuotes.Add(new Quote(q.authorValue, q.languageValue, q.sentenceValue)); } } int counter = 0; for (int i = 0; i < _allQuotes.ListOfQuotes.Count; i++) { } display("Press any key to exit:"); Console.ReadKey(); } } }
using System; using System.IO; using System.Linq; using System.Text; using System.Xml.Linq; using System.Xml.Serialization; using MyFavoriteQuotes.Properties; using Tools; namespace SplitXmlFile { internal static class Program { private static void Main() { Action<string> display = Console.WriteLine; display("séparation d'un gros fichier xml en plusieurs petits"); //string fileName = "Quote_files\\quote1.xml"; string fileName = "quote1.xml"; int startNumber = 3; int numberOfQuotePerFile = 250; StringBuilder xmlFile = new StringBuilder(); xmlFile.Append(@"<?xml version=""1.0"" encoding=""utf-8"" ?>"); xmlFile.Append("<Quotes>"); xmlFile.Append("<Quote>"); //try //{ // using (TextReader reader = new StreamReader(fileName)) // { // XmlSerializer serializer = new XmlSerializer(typeof(Quotes)); // var list = (Quotes)serializer.Deserialize(reader); // } //} //catch (Exception exception) //{ // Console.WriteLine(exception); //} XDocument xmlDoc; try { xmlDoc = XDocument.Load(fileName); } catch (Exception exception) { Console.WriteLine(exception.Message); throw ; } var result = from node in xmlDoc.Descendants("Quote") where node.HasElements let xElementAuthor = node.Element("Author") where xElementAuthor != null let xElementLanguage = node.Element("Language") where xElementLanguage != null let xElementQuote = node.Element("QuoteValue") where xElementQuote != null select new { authorValue = xElementAuthor.Value, languageValue = xElementLanguage.Value, sentenceValue = xElementQuote.Value }; Quotes _allQuotes = new Quotes(); foreach (var q in result) { if (!_allQuotes.ListOfQuotes.Contains(new Quote(q.authorValue, q.languageValue, q.sentenceValue)) && q.authorValue != string.Empty && q.languageValue != string.Empty && q.sentenceValue != string.Empty) { _allQuotes.Add(new Quote(q.authorValue, q.languageValue, q.sentenceValue)); } } display("Press any key to exit:"); Console.ReadKey(); } } }
mit
C#
37f71675670a73a026eced843d6c57e90556aeae
Test promoting model to shared state.
ZhangLeiCharles/mobile,eatskolnikov/mobile,masterrr/mobile,peeedge/mobile,eatskolnikov/mobile,eatskolnikov/mobile,ZhangLeiCharles/mobile,masterrr/mobile,peeedge/mobile
Tests/Data/ModelTest.cs
Tests/Data/ModelTest.cs
using System; using System.Linq; using NUnit.Framework; using Toggl.Phoebe.Data; using XPlatUtils; namespace Toggl.Phoebe.Tests.Data { [TestFixture] public class ModelTest { private class PlainModel : Model { } [TestFixtureSetUp] public void Init () { ServiceContainer.Register<MessageBus> (); } [TestFixtureTearDown] public void Cleanup () { ServiceContainer.Clear (); } [SetUp] public void SetUp () { ServiceContainer.AddScope (); } [TearDown] public void TearDown () { ServiceContainer.RemoveScope (); } [Test] public void TestDefaults () { var model = new PlainModel (); Assert.IsNull (model.Id, "Id must be null"); Assert.IsNull (model.RemoteId, "RemoteId must be null"); Assert.IsFalse (model.IsShared, "IsShared must be false"); Assert.IsFalse (model.IsPersisted, "IsPersisted must be false"); Assert.That (model.ModifiedAt, Is.EqualTo (DateTime.UtcNow).Within (1).Seconds, "ModifiedAt must be the time of model creation"); Assert.IsFalse (model.IsDirty, "IsDirty must be false"); Assert.IsFalse (model.IsMerging, "IsMerging must be false"); Assert.IsNull (model.DeletedAt, "DeletedAt must be null"); Assert.IsNull (model.RemoteDeletedAt, "RemoteDeletedAt must be null"); Assert.IsEmpty (model.Errors, "Errors must be empty"); Assert.IsTrue (model.IsValid, "IsValid must be true"); } private MessageBus MessageBus { get { return ServiceContainer.Resolve<MessageBus> (); } } [Test] public void TestMakeShared () { // Verify the ModelChangedMessage send count var messageCount = 0; MessageBus.Subscribe<ModelChangedMessage> ((msg) => { messageCount++; }); var model = new PlainModel (); model.PropertyChanged += (sender, e) => { if (e.PropertyName == PlainModel.PropertyIsShared) { // Check that model is present in cache Assert.That (Model.GetCached<PlainModel> (), Has.Exactly (1).SameAs (model), "The newly shared object should be present in cache already."); } else if (e.PropertyName == PlainModel.PropertyId) { // Expect ID assignment } else { Assert.Fail (String.Format ("Property '{0}' changed unexpectedly.", e.PropertyName)); } }; var shared = Model.Update (model); Assert.AreSame (model, shared, "Promoting to shared should return the initial model."); Assert.NotNull (model.Id, "Should have received a new unique Id."); Assert.AreEqual (messageCount, 1, "Received invalid number of OnModelChanged messages"); } } }
using System; using NUnit.Framework; using Toggl.Phoebe.Data; namespace Toggl.Phoebe.Tests.Data { [TestFixture] public class ModelTest { private class PlainModel : Model { } [Test] public void TestDefaults () { var model = new PlainModel (); Assert.IsNull (model.Id, "Id must be null"); Assert.IsNull (model.RemoteId, "RemoteId must be null"); Assert.IsFalse (model.IsShared, "IsShared must be false"); Assert.IsFalse (model.IsPersisted, "IsPersisted must be false"); Assert.That (model.ModifiedAt, Is.EqualTo (DateTime.UtcNow).Within (1).Seconds, "ModifiedAt must be the time of model creation"); Assert.IsFalse (model.IsDirty, "IsDirty must be false"); Assert.IsFalse (model.IsMerging, "IsMerging must be false"); Assert.IsNull (model.DeletedAt, "DeletedAt must be null"); Assert.IsNull (model.RemoteDeletedAt, "RemoteDeletedAt must be null"); Assert.IsEmpty (model.Errors, "Errors must be empty"); Assert.IsTrue (model.IsValid, "IsValid must be true"); } } }
bsd-3-clause
C#
bd2bca6875eb8928c97fb4f8246913ad1b94b40e
Enable NRT
mavasani/roslyn,sharwell/roslyn,diryboy/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,weltkante/roslyn,dotnet/roslyn,mavasani/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,bartdesmet/roslyn,dotnet/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,weltkante/roslyn
src/Analyzers/CSharp/Analyzers/UseConditionalExpression/CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer.cs
src/Analyzers/CSharp/Analyzers/UseConditionalExpression/CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer.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.LanguageServices; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.UseConditionalExpression; namespace Microsoft.CodeAnalysis.CSharp.UseConditionalExpression { [DiagnosticAnalyzer(LanguageNames.CSharp)] internal class CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer : AbstractUseConditionalExpressionForReturnDiagnosticAnalyzer<IfStatementSyntax> { public CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer() : base(new LocalizableResourceString(nameof(CSharpAnalyzersResources.if_statement_can_be_simplified), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources))) { } protected override ISyntaxFacts GetSyntaxFacts() => CSharpSyntaxFacts.Instance; } }
// 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.LanguageServices; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.UseConditionalExpression; namespace Microsoft.CodeAnalysis.CSharp.UseConditionalExpression { [DiagnosticAnalyzer(LanguageNames.CSharp)] internal class CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer : AbstractUseConditionalExpressionForReturnDiagnosticAnalyzer<IfStatementSyntax> { public CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer() : base(new LocalizableResourceString(nameof(CSharpAnalyzersResources.if_statement_can_be_simplified), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources))) { } protected override ISyntaxFacts GetSyntaxFacts() => CSharpSyntaxFacts.Instance; } }
mit
C#
0d07488fc00252eff26123af1b7bd11dfb822a0d
Use ITablatureWebpageImporter for GetTablatureDocumentMethodString().
GetTabster/Tabster
Tabster/Utilities/Common.cs
Tabster/Utilities/Common.cs
#region using System.Reflection; using System.Windows.Forms; using Tabster.Core.Data.Processing; #endregion namespace Tabster.Utilities { internal static class Common { private static string _copyrightString; public static string GetTablatureDocumentMethodString(ITablatureWebpageImporter importer = null) { var str = string.Format("{0} v{1}", Application.ProductName, Application.ProductVersion); if (importer != null && !string.IsNullOrEmpty(importer.SiteName)) { str += string.Format(" / {0}", importer.SiteName); } return str; } public static string GetCopyrightString(string prefix = "Copyright", bool appendCompanyName = true) { if (_copyrightString != null) return _copyrightString; var str = ""; var assembly = Assembly.GetExecutingAssembly(); var copyrightAttributes = assembly.GetCustomAttributes(typeof (AssemblyCopyrightAttribute), true); if (copyrightAttributes.Length > 0) { var copyrightString = ((AssemblyCopyrightAttribute) copyrightAttributes[0]).Copyright; if (!string.IsNullOrEmpty(copyrightString)) str = copyrightString; } if (appendCompanyName) { string companyString = null; var companyAttributes = assembly.GetCustomAttributes(typeof (AssemblyCompanyAttribute), true); if (companyAttributes.Length > 0) companyString = ((AssemblyCompanyAttribute) companyAttributes[0]).Company; if (!string.IsNullOrEmpty(companyString) && !str.EndsWith(companyString)) { str += string.Format(" {0}", companyString); } } if (!str.StartsWith(prefix)) str = str.Insert(0, string.Format("{0} ", prefix)); _copyrightString = str; return str; } } }
#region using System.Reflection; using System.Windows.Forms; using Tabster.Core.Parsing; #endregion namespace Tabster.Utilities { internal static class Common { private static string _copyrightString; public static string GetTablatureDocumentMethodString(ITabParser parser = null) { var str = string.Format("{0} v{1}", Application.ProductName, Application.ProductVersion); if (parser != null && !string.IsNullOrEmpty(parser.Name)) { str += string.Format(" / {0} v{1}", parser.Name, parser.Version); } return str; } public static string GetCopyrightString(string prefix = "Copyright", bool appendCompanyName = true) { if (_copyrightString != null) return _copyrightString; var str = ""; var assembly = Assembly.GetExecutingAssembly(); var copyrightAttributes = assembly.GetCustomAttributes(typeof (AssemblyCopyrightAttribute), true); if (copyrightAttributes.Length > 0) { var copyrightString = ((AssemblyCopyrightAttribute) copyrightAttributes[0]).Copyright; if (!string.IsNullOrEmpty(copyrightString)) str = copyrightString; } if (appendCompanyName) { string companyString = null; var companyAttributes = assembly.GetCustomAttributes(typeof (AssemblyCompanyAttribute), true); if (companyAttributes.Length > 0) companyString = ((AssemblyCompanyAttribute) companyAttributes[0]).Company; if (!string.IsNullOrEmpty(companyString) && !str.EndsWith(companyString)) { str += string.Format(" {0}", companyString); } } if (!str.StartsWith(prefix)) str = str.Insert(0, string.Format("{0} ", prefix)); _copyrightString = str; return str; } } }
apache-2.0
C#
e6bb4e3b5a8cfe27985a4a7f5346959d8076754e
Fix issue #586
dazerdude/SharpDX,fmarrabal/SharpDX,manu-silicon/SharpDX,fmarrabal/SharpDX,sharpdx/SharpDX,weltkante/SharpDX,mrvux/SharpDX,fmarrabal/SharpDX,mrvux/SharpDX,PavelBrokhman/SharpDX,jwollen/SharpDX,dazerdude/SharpDX,PavelBrokhman/SharpDX,dazerdude/SharpDX,weltkante/SharpDX,jwollen/SharpDX,RobyDX/SharpDX,waltdestler/SharpDX,weltkante/SharpDX,manu-silicon/SharpDX,dazerdude/SharpDX,davidlee80/SharpDX-1,manu-silicon/SharpDX,andrewst/SharpDX,TechPriest/SharpDX,mrvux/SharpDX,weltkante/SharpDX,Ixonos-USA/SharpDX,Ixonos-USA/SharpDX,andrewst/SharpDX,davidlee80/SharpDX-1,davidlee80/SharpDX-1,manu-silicon/SharpDX,jwollen/SharpDX,PavelBrokhman/SharpDX,sharpdx/SharpDX,PavelBrokhman/SharpDX,TechPriest/SharpDX,TechPriest/SharpDX,fmarrabal/SharpDX,sharpdx/SharpDX,davidlee80/SharpDX-1,RobyDX/SharpDX,waltdestler/SharpDX,Ixonos-USA/SharpDX,RobyDX/SharpDX,Ixonos-USA/SharpDX,TechPriest/SharpDX,waltdestler/SharpDX,waltdestler/SharpDX,RobyDX/SharpDX,jwollen/SharpDX,andrewst/SharpDX
Source/SharpDX.Direct2D1/BorderTransform.cs
Source/SharpDX.Direct2D1/BorderTransform.cs
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel // // 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; namespace SharpDX.Direct2D1 { public partial class BorderTransform { /// <summary> /// Initializes a new instance of <see cref="BorderTransform"/> class /// </summary> /// <param name="context">The effect context</param> /// <param name="extendModeX">The extend mode for X coordinates</param> /// <param name="extendModeY">The extend mode for Y coordinates</param> /// <unmanaged>HRESULT ID2D1EffectContext::CreateBorderTransform([In] D2D1_EXTEND_MODE extendModeX,[In] D2D1_EXTEND_MODE extendModeY,[Out, Fast] ID2D1BorderTransform** transform)</unmanaged> public BorderTransform(EffectContext context, SharpDX.Direct2D1.ExtendMode extendModeX, SharpDX.Direct2D1.ExtendMode extendModeY) : base(IntPtr.Zero) { context.CreateBorderTransform(extendModeX, extendModeY, this); } } }
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Collections.Generic; using System.Text; namespace SharpDX.Direct2D1 { public partial class BorderTransform { /// <summary> /// Initializes a new instance of <see cref="BorderTransform"/> class /// </summary> /// <param name="context">The effect context</param> /// <param name="extendModeX">The extend mode for X coordinates</param> /// <param name="extendModeY">The extend mode for Y coordinates</param> /// <unmanaged>HRESULT ID2D1EffectContext::CreateBorderTransform([In] D2D1_EXTEND_MODE extendModeX,[In] D2D1_EXTEND_MODE extendModeY,[Out, Fast] ID2D1BorderTransform** transform)</unmanaged> public BorderTransform(EffectContext context, SharpDX.Direct2D1.ExtendMode extendModeX, SharpDX.Direct2D1.ExtendMode extendModeY) : base(IntPtr.Zero) { context.CreateBorderTransform(extendModeX, ExtendModeX, this); } } }
mit
C#
c4121655e93e4d442e507a34bb3b74b96a9f45af
add backup channel link
codingteam/codingteam.org.ru,codingteam/codingteam.org.ru
Views/Home/Resources.cshtml
Views/Home/Resources.cshtml
<h1>Resources</h1> <p>Here is a list of codingteam affiliated online resources:</p> <ul class="fa-ul"> <li> <a href="https://github.com/codingteam/"> <i class="fa-li fa fa-github"></i> GitHub organization </a> </li> <li> <a href="xmpp:codingteam@conference.jabber.ru?join"> <i class="fa-li fa fa-lightbulb-o"></i> XMPP conference </a> </li> <li> <a href="xmpp:codingteam@conference.codingteam.org.ru?join"> <i class="fa-li fa fa-lightbulb-o"></i> XMPP conference (backup channel) </a> </li> <li> <a href="https://gitter.im/codingteam"> <i class="fa-li fa fa-users"></i> Gitter room </a> </li> <li> <a href="https://bitbucket.org/codingteam"> <i class="fa-li fa fa-bitbucket"></i> Bitbucket team </a> </li> <li> <a href="https://gitlab.com/groups/codingteam"> <i class="fa-li fa fa-code-fork"></i> GitLab team </a> </li> <li> <a href="https://www.loglist.net/"> <i class="fa-li fa fa-ambulance"></i> LogList </a> </li> <li> <a href="https://telegram.me/joinchat/BE1AdEAiwR85TsuRlhU_bA"> <i class="fa-li fa fa-envelope-o"></i> Telegram group </a> </li> </ul>
<h1>Resources</h1> <p>Here is a list of codingteam affiliated online resources:</p> <ul class="fa-ul"> <li> <a href="https://github.com/codingteam/"> <i class="fa-li fa fa-github"></i> GitHub organization </a> </li> <li> <a href="xmpp:codingteam@conference.jabber.ru?join"> <i class="fa-li fa fa-lightbulb-o"></i> XMPP conference </a> </li> <li> <a href="https://gitter.im/codingteam"> <i class="fa-li fa fa-users"></i> Gitter room </a> </li> <li> <a href="https://bitbucket.org/codingteam"> <i class="fa-li fa fa-bitbucket"></i> Bitbucket team </a> </li> <li> <a href="https://gitlab.com/groups/codingteam"> <i class="fa-li fa fa-code-fork"></i> GitLab team </a> </li> <li> <a href="https://www.loglist.net/"> <i class="fa-li fa fa-ambulance"></i> LogList </a> </li> <li> <a href="https://telegram.me/joinchat/BE1AdEAiwR85TsuRlhU_bA"> <i class="fa-li fa fa-envelope-o"></i> Telegram group </a> </li> </ul>
mit
C#
d0e062f0069bb6e1647a8136dad7892f9059fa63
fix build
PombeirP/T4Factories
T4Factories.Testbed/Models/CsvFileParser.cs
T4Factories.Testbed/Models/CsvFileParser.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="CsvFileParser.cs" company="Developer In The Flow"> // © 2012-2013 Pedro Pombeiro // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace T4Factories.Testbed.Models { using System.IO; using T4Factories.Testbed.Contracts; [GenerateT4Factory(typeof(IFileParser))] public class CsvFileParser : IFileParser { #region Fields private readonly IFileSystem fileSystem; private readonly string delimiter; #endregion #region Constructors and Destructors public CsvFileParser(IFileSystem fileSystem, string delimiter) { this.fileSystem = fileSystem; this.delimiter = delimiter; } #endregion public string[] Parse(string filePath) { object file = this.fileSystem.GetFile(filePath); return new string[0]; } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="CsvFileParser.cs" company="Developer In The Flow"> // © 2012-2013 Pedro Pombeiro // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace T4Factories.Testbed.Models { using System.IO; using T4Factories.Testbed.Contracts; [GenerateT4Factory(typeof(IFileParser))] public class CsvFileParser : IFileParser { #region Fields private readonly IFileSystem fileSystem; private readonly string delimiter; #endregion #region Constructors and Destructors public CsvFileParser(IFileSystem fileSystem, string delimiter) { this.fileSystem = fileSystem; this.delimiter = delimiter; } #endregion public string[] Parse(string filePath) { File file = this.fileSystem.GetFile(filePath); } } }
mit
C#
80054a4687663f8a62f1f53854138ac8fd9e2474
Fix memory leak caused by undisposed memorystream.
TheBrainTech/xwt,antmicro/xwt,directhex/xwt,sevoku/xwt,mono/xwt,mminns/xwt,residuum/xwt,cra0zy/xwt,iainx/xwt,hwthomas/xwt,steffenWi/xwt,lytico/xwt,hamekoz/xwt,akrisiun/xwt,mminns/xwt
Xwt.Gtk.Windows/GtkWindowsDesktopBackend.cs
Xwt.Gtk.Windows/GtkWindowsDesktopBackend.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Xwt.GtkBackend; using System.Runtime.InteropServices; using System.Drawing; using System.IO; using System.Drawing.Imaging; namespace Xwt.Gtk.Windows { class GtkWindowsDesktopBackend: GtkDesktopBackend { Dictionary<string, Gdk.Pixbuf> icons = new Dictionary<string, Gdk.Pixbuf> (); public override object GetFileIcon (string filename) { var normal = GetIcon (filename, 0); if (normal == null) return null; var frames = new List<Gdk.Pixbuf> (); frames.Add (normal); var small = GetIcon (filename, Win32.SHGFI_SMALLICON); if (small != null && !frames.Contains (small)) frames.Add (small); var shell = GetIcon (filename, Win32.SHGFI_SHELLICONSIZE); if (shell != null && !frames.Contains (shell)) frames.Add (shell); var large = GetIcon (filename, Win32.SHGFI_LARGEICON); if (large != null && !frames.Contains (large)) frames.Add (large); return new GtkImage (frames); } Gdk.Pixbuf GetIcon (string filename, uint size) { SHFILEINFO shinfo = new SHFILEINFO (); Win32.SHGetFileInfoW (filename, Win32.FILE_ATTRIBUTES_NORMAL, ref shinfo, (uint)Marshal.SizeOf (shinfo), Win32.SHGFI_USEFILEATTRIBUTES | Win32.SHGFI_ICON | Win32.SHGFI_ICONLOCATION | Win32.SHGFI_TYPENAME | size); if (shinfo.iIcon == 0) { Win32.DestroyIcon (shinfo.hIcon); return null; } var icon = Icon.FromHandle (shinfo.hIcon); string key = shinfo.iIcon + " - " + shinfo.szDisplayName + " - " + icon.Width; Gdk.Pixbuf pix; if (!icons.TryGetValue (key, out pix)) { pix = CreateFromResource (icon.ToBitmap ()); icons[key] = pix; } Win32.DestroyIcon (shinfo.hIcon); return pix; } public Gdk.Pixbuf CreateFromResource (Bitmap bitmap) { using (var ms = new MemoryStream ()) { bitmap.Save (ms, ImageFormat.Png); ms.Position = 0; return new Gdk.Pixbuf (ms); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Xwt.GtkBackend; using System.Runtime.InteropServices; using System.Drawing; using System.IO; using System.Drawing.Imaging; namespace Xwt.Gtk.Windows { class GtkWindowsDesktopBackend: GtkDesktopBackend { Dictionary<string, Gdk.Pixbuf> icons = new Dictionary<string, Gdk.Pixbuf> (); public override object GetFileIcon (string filename) { var normal = GetIcon (filename, 0); if (normal == null) return null; var frames = new List<Gdk.Pixbuf> (); frames.Add (normal); var small = GetIcon (filename, Win32.SHGFI_SMALLICON); if (small != null && !frames.Contains (small)) frames.Add (small); var shell = GetIcon (filename, Win32.SHGFI_SHELLICONSIZE); if (shell != null && !frames.Contains (shell)) frames.Add (shell); var large = GetIcon (filename, Win32.SHGFI_LARGEICON); if (large != null && !frames.Contains (large)) frames.Add (large); return new GtkImage (frames); } Gdk.Pixbuf GetIcon (string filename, uint size) { SHFILEINFO shinfo = new SHFILEINFO (); Win32.SHGetFileInfoW (filename, Win32.FILE_ATTRIBUTES_NORMAL, ref shinfo, (uint)Marshal.SizeOf (shinfo), Win32.SHGFI_USEFILEATTRIBUTES | Win32.SHGFI_ICON | Win32.SHGFI_ICONLOCATION | Win32.SHGFI_TYPENAME | size); if (shinfo.iIcon == 0) { Win32.DestroyIcon (shinfo.hIcon); return null; } var icon = Icon.FromHandle (shinfo.hIcon); string key = shinfo.iIcon + " - " + shinfo.szDisplayName + " - " + icon.Width; Gdk.Pixbuf pix; if (!icons.TryGetValue (key, out pix)) { pix = CreateFromResource (icon.ToBitmap ()); icons[key] = pix; } Win32.DestroyIcon (shinfo.hIcon); return pix; } public Gdk.Pixbuf CreateFromResource (Bitmap bitmap) { MemoryStream ms = new MemoryStream (); bitmap.Save (ms, ImageFormat.Png); ms.Position = 0; return new Gdk.Pixbuf (ms); } } }
mit
C#
5aac6dd314fad2c821543e29fcd4c6b391c661b1
Throw 404 when you can't find the node
mcintyre321/Noodles,mcintyre321/Noodles
WebNoodle/NodeHelper.cs
WebNoodle/NodeHelper.cs
using System; using System.Collections.Generic; using System.Web; namespace WebNoodle { public static class NodeHelper { public static IEnumerable<object> YieldChildren(this object node, string path, bool breakOnNull = false) { path = string.IsNullOrWhiteSpace(path) ? "/" : path; yield return node; var parts = (path).Split("/".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (var part in parts) { node = node.GetChild(part); if (node == null) { if (breakOnNull) yield break; throw new HttpException(404, "Node '" + part + "' not found in path '" + path + "'"); } yield return node; } } } }
using System; using System.Collections.Generic; namespace WebNoodle { public static class NodeHelper { public static IEnumerable<object> YieldChildren(this object node, string path, bool breakOnNull = false) { path = string.IsNullOrWhiteSpace(path) ? "/" : path; yield return node; var parts = (path).Split("/".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (var part in parts) { node = node.GetChild(part); if (node == null) { if (breakOnNull) yield break; throw new Exception("Node '" + part + "' not found in path '" + path + "'"); } yield return node; } } } }
mit
C#
a170cf16ad14cc207946d98f1e2c51c2b45d3b95
Update Sentry DSN
Mpstark/articulate
Articulate/Constants.cs
Articulate/Constants.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Articulate { static class Constants { /// <summary> /// The DSN used by Raven to report exceptions to a Sentry instance for tracking /// </summary> public const string SentryDSN = "https://dea77c17b8c143b2bea1506ac8e68ef0:e655b40c10e64c3bb8799af142b8c13a@sentry.sierrasoftworks.com/19"; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Articulate { static class Constants { /// <summary> /// The DSN used by Raven to report exceptions to a Sentry instance for tracking /// </summary> public const string SentryDSN = "http://eb3dd1c4c34c4699a63aa7f94a6ffed1:71a20430f5ba41c0b90d1ed21a019178@sentry.sierrasoftworks.com/4"; } }
mit
C#
035b66da8646140633340eee2cbe36d443c68c1a
drop description now indicates that it's money brokensword health penalty increased
lizard-entertainment/runityscape,Cinnamon18/runityscape
Assets/Scripts/Game/Defined/Serialized/ItemList.cs
Assets/Scripts/Game/Defined/Serialized/ItemList.cs
using System.Collections.Generic; using Scripts.Model.Spells; using Scripts.Model.Items; using Scripts.Model.Stats; using Scripts.Game.Defined.Spells; using Scripts.Model.Buffs; using Scripts.Game.Defined.Serialized.Spells; namespace Scripts.Game.Defined.Serialized.Items.Consumables { public class Apple : ConsumableItem { private const int HEALING_AMOUNT = 10; public Apple() : base(1, TargetType.SINGLE_ALLY, "Apple", string.Format("A juicy apple. Restores {0} {1}.", HEALING_AMOUNT, StatType.HEALTH.ColoredName)) { } public override IList<SpellEffect> GetEffects(SpellParams caster, SpellParams target) { return new SpellEffect[] { new AddToModStat(target.Stats, StatType.HEALTH, HEALING_AMOUNT) }; } } } namespace Scripts.Game.Defined.Serialized.Items.Equipment { public class PoisonArmor : EquippableItem { public PoisonArmor() : base(EquipType.ARMOR, 10, "Poisoned Armor", "This doesn't look safe.") { Stats.Add(StatType.VITALITY, 3); Stats.Add(StatType.AGILITY, -1); } public override Buff CreateBuff() { return new Poison(); } } public class BrokenSword : EquippableItem { public BrokenSword() : base(EquipType.WEAPON, 5, "Broken Sword", "A broken sword dropped by a spirit.") { Stats.Add(StatType.STRENGTH, 1); Stats.Add(StatType.VITALITY, -4); } } public class GhostArmor : EquippableItem { public GhostArmor() : base(EquipType.ARMOR, 10, "Cursed Mail", "A cursed chainmail dropped by a spirit.") { Stats.Add(StatType.STRENGTH, -10); Stats.Add(StatType.AGILITY, -10); } } } namespace Scripts.Game.Defined.Serialized.Items.Misc { public class Money : BasicItem { public Money() : base( Util.GetSprite("water-drop"), 0, "Drop", "A drop of pure water. Typically used as currency." ) { } } }
using System.Collections.Generic; using Scripts.Model.Spells; using Scripts.Model.Items; using Scripts.Model.Stats; using Scripts.Game.Defined.Spells; using Scripts.Model.Buffs; using Scripts.Game.Defined.Serialized.Spells; namespace Scripts.Game.Defined.Serialized.Items.Consumables { public class Apple : ConsumableItem { private const int HEALING_AMOUNT = 10; public Apple() : base(1, TargetType.SINGLE_ALLY, "Apple", string.Format("A juicy apple. Restores {0} {1}.", HEALING_AMOUNT, StatType.HEALTH.ColoredName)) { } public override IList<SpellEffect> GetEffects(SpellParams caster, SpellParams target) { return new SpellEffect[] { new AddToModStat(target.Stats, StatType.HEALTH, HEALING_AMOUNT) }; } } } namespace Scripts.Game.Defined.Serialized.Items.Equipment { public class PoisonArmor : EquippableItem { public PoisonArmor() : base(EquipType.ARMOR, 10, "Poisoned Armor", "This doesn't look safe.") { Stats.Add(StatType.VITALITY, 3); Stats.Add(StatType.AGILITY, -1); } public override Buff CreateBuff() { return new Poison(); } } public class BrokenSword : EquippableItem { public BrokenSword() : base(EquipType.WEAPON, 5, "Broken Sword", "A broken sword dropped by a spirit.") { Stats.Add(StatType.STRENGTH, 1); Stats.Add(StatType.VITALITY, -1); } } public class GhostArmor : EquippableItem { public GhostArmor() : base(EquipType.ARMOR, 10, "Cursed Mail", "A cursed chainmail dropped by a spirit.") { Stats.Add(StatType.STRENGTH, -10); Stats.Add(StatType.AGILITY, -10); } } } namespace Scripts.Game.Defined.Serialized.Items.Misc { public class Money : BasicItem { public Money() : base( Util.GetSprite("water-drop"), 0, "Drop", "A drop of pure water." ) { } } }
mit
C#
b62b3a1d2d64aa9194cf6a42e556b6f421e0e1fd
Make FPS counter to a GameComponent
rafaelalmeidatk/MonoGame.Extended,Aurioch/MonoGame.Extended,HyperionMT/MonoGame.Extended,LithiumToast/MonoGame.Extended,cra0zy/MonoGame.Extended,rafaelalmeidatk/MonoGame.Extended
Source/MonoGame.Extended/FramesPerSecondCounter.cs
Source/MonoGame.Extended/FramesPerSecondCounter.cs
using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; namespace MonoGame.Extended { public class FramesPerSecondCounter : DrawableGameComponent { public FramesPerSecondCounter(Game game, int maximumSamples = 100) :base(game) { MaximumSamples = maximumSamples; } private readonly Queue<float> _sampleBuffer = new Queue<float>(); public long TotalFrames { get; private set; } public float AverageFramesPerSecond { get; private set; } public float CurrentFramesPerSecond { get; private set; } public int MaximumSamples { get; } public void Reset() { TotalFrames = 0; _sampleBuffer.Clear(); } public void UpdateFPS(float deltaTime) { CurrentFramesPerSecond = 1.0f / deltaTime; _sampleBuffer.Enqueue(CurrentFramesPerSecond); if (_sampleBuffer.Count > MaximumSamples) { _sampleBuffer.Dequeue(); AverageFramesPerSecond = _sampleBuffer.Average(i => i); } else { AverageFramesPerSecond = CurrentFramesPerSecond; } TotalFrames++; } public override void Update(GameTime gameTime) { base.Update(gameTime); } public override void Draw(GameTime gameTime) { UpdateFPS((float)gameTime.ElapsedGameTime.TotalSeconds); base.Draw(gameTime); } } }
using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; namespace MonoGame.Extended { public class FramesPerSecondCounter : IUpdate { public FramesPerSecondCounter(int maximumSamples = 100) { MaximumSamples = maximumSamples; } private readonly Queue<float> _sampleBuffer = new Queue<float>(); public long TotalFrames { get; private set; } public float AverageFramesPerSecond { get; private set; } public float CurrentFramesPerSecond { get; private set; } public int MaximumSamples { get; } public void Reset() { TotalFrames = 0; _sampleBuffer.Clear(); } public void Update(float deltaTime) { CurrentFramesPerSecond = 1.0f / deltaTime; _sampleBuffer.Enqueue(CurrentFramesPerSecond); if (_sampleBuffer.Count > MaximumSamples) { _sampleBuffer.Dequeue(); AverageFramesPerSecond = _sampleBuffer.Average(i => i); } else { AverageFramesPerSecond = CurrentFramesPerSecond; } TotalFrames++; } public void Update(GameTime gameTime) { Update((float)gameTime.ElapsedGameTime.TotalSeconds); } } }
mit
C#
02766064079a43c83d180578e214f437bbbd4f9f
Fix merge issue
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EAS.Web/Views/EmployerCommitments/SubmitCommitmentEntry.cshtml
src/SFA.DAS.EAS.Web/Views/EmployerCommitments/SubmitCommitmentEntry.cshtml
@using SFA.DAS.EAS.Web.Models @model SubmitCommitmentViewModel @{ var targetName = string.IsNullOrWhiteSpace(Model.HashedCommitmentId) ? "SubmitNewCommitmentEntry" : "SubmitExistingCommitmentEntry"; } <div class="grid-row"> <div class="column-two-thirds"> <h1 class="heading-xlarge">Instructions for your training provider</h1> <p>Let <span class="heading-medium">@Model.ProviderName</span> know which apprentices you'd like them to add. </p> <form method="POST" action="@Url.Action(targetName)"> @Html.AntiForgeryToken() <div class="form-group"> <label class="form-label" for="Message">Instructions</label> <p class="form-hint">For example, please add the 12 admin level 2 apprentices and 13 engineering level 3 apprentices.</p> <textarea class="form-control form-control-3-4" id="Message" name="Message" cols="40" rows="10" aria-required="true"></textarea> </div> @Html.HiddenFor(x => x.HashedCommitmentId) @Html.HiddenFor(x => x.LegalEntityCode) @Html.HiddenFor(x => x.LegalEntityName) @Html.HiddenFor(x => x.ProviderId) @Html.HiddenFor(x => x.ProviderName) @Html.HiddenFor(x => x.CohortRef) @Html.HiddenFor(x => x.SaveOrSend) <button type="submit" class="button">Send request to provider</button> </form> </div> </div>
@using SFA.DAS.EAS.Web.Models @model SubmitCommitmentViewModel @{ var targetName = string.IsNullOrWhiteSpace(Model.HashedCommitmentId) ? "SubmitNewCommitmentEntry" : "SubmitExistingCommitmentEntry"; } <div class="grid-row"> <div class="column-two-thirds"> <h1 class="heading-xlarge">Instructions for your training provider</h1> <p>Let <span class="heading-medium">@Model.Commitment.ProviderName</span> know which apprentices you'd like them to add. </p> <form method="POST" action="@Url.Action(targetName)"> @Html.AntiForgeryToken() <div class="form-group"> <label class="form-label" for="Message">Instructions</label> <p class="form-hint">For example, please add the 12 admin level 2 apprentices and 13 engineering level 3 apprentices.</p> <textarea class="form-control form-control-3-4" id="Message" name="Message" cols="40" rows="10" aria-required="true"></textarea> </div> @Html.HiddenFor(x => x.HashedCommitmentId) @Html.HiddenFor(x => x.LegalEntityCode) @Html.HiddenFor(x => x.LegalEntityName) @Html.HiddenFor(x => x.ProviderId) @Html.HiddenFor(x => x.ProviderName) @Html.HiddenFor(x => x.CohortRef) @Html.HiddenFor(x => x.SaveOrSend) <button type="submit" class="button">Send request to provider</button> </form> </div> </div>
mit
C#
cc74269fd45041f30583fd275564787daa4081d0
Update AssemblyInfo.cs
Sitefinity/Less
Telerik.Sitefinity.Less/Properties/AssemblyInfo.cs
Telerik.Sitefinity.Less/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using System.Web; using System.Web.UI; using Telerik.Sitefinity.Less; // 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("Telerik.Sitefinity.Less")] [assembly: AssemblyDescription("The solution contains projects for compilation of LESS syntax to CSS styles.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Telerik")] [assembly: AssemblyProduct("Telerik.Sitefinity.Less")] [assembly: AssemblyCopyright("Copyright © 2005-2019 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Registers ModuleInstaller.PreApplicationStart() to be executed prior to the application start [assembly: PreApplicationStartMethod(typeof(LessModuleInstaller), "PreApplicationStart")] // 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("5692e865-28fc-4804-9c50-746524d80896")] // 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")] [assembly: WebResource("Telerik.Sitefinity.Less.Module.Web.Resources.CustomStylesKendoUIView.css", "text/css", PerformSubstitution = true)] [assembly: WebResource("Telerik.Sitefinity.Less.Module.Web.Resources.paging.png", "image/gif")]
using System.Reflection; using System.Runtime.InteropServices; using System.Web; using System.Web.UI; using Telerik.Sitefinity.Less; // 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("Telerik.Sitefinity.Less")] [assembly: AssemblyDescription("The solution contains projects for compilation of LESS syntax to CSS styles.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Telerik")] [assembly: AssemblyProduct("Telerik.Sitefinity.Less")] [assembly: AssemblyCopyright("Copyright © 2016 Telerik")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Registers ModuleInstaller.PreApplicationStart() to be executed prior to the application start [assembly: PreApplicationStartMethod(typeof(LessModuleInstaller), "PreApplicationStart")] // 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("5692e865-28fc-4804-9c50-746524d80896")] // 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")] [assembly: WebResource("Telerik.Sitefinity.Less.Module.Web.Resources.CustomStylesKendoUIView.css", "text/css", PerformSubstitution = true)] [assembly: WebResource("Telerik.Sitefinity.Less.Module.Web.Resources.paging.png", "image/gif")]
mit
C#
0521c5f58871ffa3f00ecf2ced4582737d88a2c3
Use pattern matching
thomasgalliker/ValueConverters.NET
ValueConverters.Shared/BoolToValueConverterBase.cs
ValueConverters.Shared/BoolToValueConverterBase.cs
using System.Globalization; using System; #if NETFX || WINDOWS_PHONE using System.Windows; using System.Windows.Data; #elif (NETFX_CORE) using Windows.UI.Xaml; using Windows.UI.Xaml.Data; #endif namespace ValueConverters { /// <summary> /// Source: /// http://geekswithblogs.net/codingbloke/archive/2010/05/28/a-generic-boolean-value-converter.aspx /// </summary> /// <typeparam name="T">Generic type T which is used as TrueValue or FalseValue.</typeparam> /// <typeparam name="TConverter">Converter type</typeparam> public abstract class BoolToValueConverterBase<T, TConverter> : SingletonConverterBase<TConverter> where TConverter : new() { public abstract T TrueValue { get; set; } public abstract T FalseValue { get; set; } public abstract bool IsInverted { get; set; } protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var returnValue = this.FalseValue; if (value is bool boolValue) { if (this.IsInverted) { returnValue = boolValue ? this.FalseValue : this.TrueValue; } else { returnValue = boolValue ? this.TrueValue : this.FalseValue; } } return returnValue; } protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { bool returnValue = false; if (value != null) { if (this.IsInverted) { returnValue = value.Equals(this.FalseValue); } else { returnValue = value.Equals(this.TrueValue); } } return returnValue; } } }
using System.Globalization; using System; #if NETFX || WINDOWS_PHONE using System.Windows; using System.Windows.Data; #elif (NETFX_CORE) using Windows.UI.Xaml; using Windows.UI.Xaml.Data; #endif namespace ValueConverters { /// <summary> /// Source: /// http://geekswithblogs.net/codingbloke/archive/2010/05/28/a-generic-boolean-value-converter.aspx /// </summary> /// <typeparam name="T">Generic type T which is used as TrueValue or FalseValue.</typeparam> /// <typeparam name="TConverter">Converter type</typeparam> public abstract class BoolToValueConverterBase<T, TConverter> : SingletonConverterBase<TConverter> where TConverter : new() { public abstract T TrueValue { get; set; } public abstract T FalseValue { get; set; } public abstract bool IsInverted { get; set; } protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var returnValue = this.FalseValue; if (value is bool) { if (this.IsInverted) { returnValue = (bool)value ? this.FalseValue : this.TrueValue; } else { returnValue = (bool)value ? this.TrueValue : this.FalseValue; } } return returnValue; } protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { bool returnValue = false; if (value != null) { if (this.IsInverted) { returnValue = value.Equals(this.FalseValue); } else { returnValue = value.Equals(this.TrueValue); } } return returnValue; } } }
mit
C#
aad3111d03eca22bb366daa3cfdbf283e341c463
Fix tests failing due to not being updated with new behaviour
ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework
osu.Framework.Tests/Localisation/CultureInfoHelperTest.cs
osu.Framework.Tests/Localisation/CultureInfoHelperTest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Globalization; using NUnit.Framework; using osu.Framework.Localisation; namespace osu.Framework.Tests.Localisation { [TestFixture] public class CultureInfoHelperTest { private const string system_culture = ""; [TestCase("en-US", true, "en-US")] [TestCase("invalid name", false, system_culture)] [TestCase(system_culture, true, system_culture)] [TestCase("ko_KR", false, system_culture)] public void TestTryGetCultureInfo(string name, bool expectedReturnValue, string expectedCultureName) { CultureInfo expectedCulture; switch (expectedCultureName) { case system_culture: expectedCulture = CultureInfo.CurrentCulture; break; default: expectedCulture = CultureInfo.GetCultureInfo(expectedCultureName); break; } bool retVal = CultureInfoHelper.TryGetCultureInfo(name, out var culture); Assert.That(retVal, Is.EqualTo(expectedReturnValue)); Assert.That(culture, Is.EqualTo(expectedCulture)); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Globalization; using NUnit.Framework; using osu.Framework.Localisation; namespace osu.Framework.Tests.Localisation { [TestFixture] public class CultureInfoHelperTest { private const string invariant_culture = ""; [TestCase("en-US", true, "en-US")] [TestCase("invalid name", false, invariant_culture)] [TestCase(invariant_culture, true, invariant_culture)] [TestCase("ko_KR", false, invariant_culture)] public void TestTryGetCultureInfo(string name, bool expectedReturnValue, string expectedCultureName) { CultureInfo expectedCulture; switch (expectedCultureName) { case invariant_culture: expectedCulture = CultureInfo.InvariantCulture; break; default: expectedCulture = CultureInfo.GetCultureInfo(expectedCultureName); break; } bool retVal = CultureInfoHelper.TryGetCultureInfo(name, out var culture); Assert.That(retVal, Is.EqualTo(expectedReturnValue)); Assert.That(culture, Is.EqualTo(expectedCulture)); } } }
mit
C#
f680aca3b5bea622baed1beed198b2468c051b1f
Add comment
60071jimmy/UartOscilloscope,60071jimmy/UartOscilloscope
QueueDataGraphic/QueueDataGraphic/CSharpFiles/Debug.cs
QueueDataGraphic/QueueDataGraphic/CSharpFiles/Debug.cs
/******************************************************************** * Develop by Jimmy Hu * * This program is licensed under the Apache License 2.0. * * Debug.cs * * 本檔案用於宣告偵錯相關工具物件 * ******************************************************************** */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace QueueDataGraphic.CSharpFiles { // namespace start, 進入命名空間 class Debug // Debug class, Debug類別 { // Debug class start, 進入Debug類別 /// <summary> /// DebugMode would be setted "true" during debugging. /// 在偵錯模式中將DebugMode設為true /// </summary> public readonly static bool DebugMode = true; } // Debug class eud, 結束Debug類別 } // namespace end, 結束命名空間
/******************************************************************** * Develop by Jimmy Hu * * This program is licensed under the Apache License 2.0. * * Debug.cs * * 本檔案用於宣告偵錯相關工具物件 * ******************************************************************** */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace QueueDataGraphic.CSharpFiles { class Debug // Debug class, Debug類別 { // Debug class start, 進入Debug類別 /// <summary> /// DebugMode would be setted "true" during debugging. /// 在偵錯模式中將DebugMode設為true /// </summary> public readonly static bool DebugMode = true; } // Debug class eud, 結束Debug類別 }
apache-2.0
C#
509ed1718d371da35b68627710973b345d60aab2
Update ZoomHelper.cs
wieslawsoltes/PanAndZoom,PanAndZoom/PanAndZoom,wieslawsoltes/MatrixPanAndZoomDemo,PanAndZoom/PanAndZoom,wieslawsoltes/PanAndZoom
src/Avalonia.Controls.PanAndZoom/ZoomHelper.cs
src/Avalonia.Controls.PanAndZoom/ZoomHelper.cs
using System; namespace Avalonia.Controls.PanAndZoom { /// <summary> /// Zoom helper methods. /// </summary> public static class ZoomHelper { /// <summary> /// Calculate scrollable properties. /// </summary> /// <param name="bounds">The view bounds.</param> /// <param name="matrix">The transform matrix.</param> /// <param name="extent">The extent of the scrollable content.</param> /// <param name="viewport">The size of the viewport.</param> /// <param name="offset">The current scroll offset.</param> public static void CalculateScrollable(Rect bounds, Matrix matrix, out Size extent, out Size viewport, out Vector offset) { var transformed = bounds.TransformToAABB(matrix); var width = transformed.Size.Width; var height = transformed.Size.Height; var x = transformed.Position.X; var y = transformed.Position.Y; extent = new Size(width + Math.Abs(x), height + Math.Abs(y)); var offsetX = x < 0 ? extent.Width + x : 0; var offsetY = y < 0 ? extent.Height + y : 0; offset = new Vector(offsetX, offsetY); viewport = bounds.Size; } } }
using System; namespace Avalonia.Controls.PanAndZoom { /// <summary> /// Zoom helper methods. /// </summary> public static class ZoomHelper { /// <summary> /// Calculate scrollable properties. /// </summary> /// <param name="bounds">The view bounds.</param> /// <param name="matrix">The transform matrix.</param> /// <param name="extent">The extent of the scrollable content.</param> /// <param name="viewport">The size of the viewport.</param> /// <param name="offset">The current scroll offset.</param> public static void CalculateScrollable(Rect bounds, Matrix matrix, out Size extent, out Size viewport, out Vector offset) { var transformed = bounds.TransformToAABB(matrix); var width = transformed.Size.Width; var height = transformed.Size.Height; var x = transformed.Position.X; var y = transformed.Position.Y; extent = new Size(width + Math.Abs(x), height + Math.Abs(y)); var offsetX = x < 0 ? extent.Width - x : 0; var offsetY = y < 0 ? extent.Height - y : 0; offsetX -= width - bounds.Width; offsetY -= height - bounds.Height; offset = new Vector(offsetX, offsetY); viewport = bounds.Size; } } }
mit
C#
1ce92e0330ea1abc9d2860e127490eaf9f10e664
Handle Mongo ObjectId references better
ermshiperete/LfMerge,ermshiperete/LfMerge,ermshiperete/LfMerge,sillsdev/LfMerge,sillsdev/LfMerge,sillsdev/LfMerge
src/LfMerge/LanguageForge/Model/LfAuthorInfo.cs
src/LfMerge/LanguageForge/Model/LfAuthorInfo.cs
// Copyright (c) 2015 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using MongoDB.Bson; namespace LfMerge.LanguageForge.Model { public class LfAuthorInfo : LfFieldBase { public ObjectId? CreatedByUserRef { get; set; } public DateTime CreatedDate { get; set; } public ObjectId? ModifiedByUserRef { get; set; } public DateTime ModifiedDate { get; set; } } }
// Copyright (c) 2015 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; namespace LfMerge.LanguageForge.Model { public class LfAuthorInfo : LfFieldBase { public string CreatedByUserRef { get; set; } public DateTime CreatedDate { get; set; } public string ModifiedByUserRef { get; set; } public DateTime ModifiedDate { get; set; } } }
mit
C#
2093baa2d382c244bf3d3c70016a7fb9976560e2
add GetUserId with default value
WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common
src/WeihanLi.Common/Services/IUserIdProvider.cs
src/WeihanLi.Common/Services/IUserIdProvider.cs
using WeihanLi.Extensions; namespace WeihanLi.Common.Services { public interface IUserIdProvider { string GetUserId(); } public static class UserIdProviderExtensions { public static T GetUserId<T>(this IUserIdProvider userIdProvider) { return userIdProvider.GetUserId().To<T>(); } public static T GetUserId<T>(this IUserIdProvider userIdProvider, T defaultValue) { return userIdProvider.GetUserId().ToOrDefault(defaultValue); } } }
using WeihanLi.Extensions; namespace WeihanLi.Common.Services { public interface IUserIdProvider { string GetUserId(); } public static class UserIdProviderExtensions { public static T GetUserId<T>(this IUserIdProvider userIdProvider) { return userIdProvider.GetUserId().To<T>(); } } }
mit
C#
9180ab4442a25925192da08a7ea5d42ebe7e7af7
Reset commit to not break backwards compatibility mode
aaronpowell/Umbraco-CMS,abryukhov/Umbraco-CMS,WebCentrum/Umbraco-CMS,NikRimington/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,tompipe/Umbraco-CMS,dawoe/Umbraco-CMS,aaronpowell/Umbraco-CMS,rasmuseeg/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,lars-erik/Umbraco-CMS,leekelleher/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,leekelleher/Umbraco-CMS,abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,rasmuseeg/Umbraco-CMS,abjerner/Umbraco-CMS,tompipe/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,NikRimington/Umbraco-CMS,aaronpowell/Umbraco-CMS,lars-erik/Umbraco-CMS,robertjf/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,bjarnef/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,madsoulswe/Umbraco-CMS,umbraco/Umbraco-CMS,tompipe/Umbraco-CMS,bjarnef/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,rasmuseeg/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,leekelleher/Umbraco-CMS,WebCentrum/Umbraco-CMS,NikRimington/Umbraco-CMS,madsoulswe/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,lars-erik/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,tcmorris/Umbraco-CMS,lars-erik/Umbraco-CMS,lars-erik/Umbraco-CMS,marcemarc/Umbraco-CMS,madsoulswe/Umbraco-CMS,WebCentrum/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,arknu/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS
src/Umbraco.Core/Models/TagCacheStorageType.cs
src/Umbraco.Core/Models/TagCacheStorageType.cs
namespace Umbraco.Core.Models { public enum TagCacheStorageType { Csv, Json } }
namespace Umbraco.Core.Models { public enum TagCacheStorageType { Json, Csv } }
mit
C#
d1fc6e405c3ce91a05ba0276646fd63748ce02f8
fix test url
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
Spa/NakedObjects.Spa.Selenium.Test/tests/TestConfig.cs
Spa/NakedObjects.Spa.Selenium.Test/tests/TestConfig.cs
 namespace NakedObjects.Selenium { public static class TestConfig { //public const string BaseUrl = "http://localhost:49998/"; public const string BaseUrl = "http://nakedobjectstest.azurewebsites.net/"; } }
 namespace NakedObjects.Selenium { public static class TestConfig { public const string BaseUrl = "http://localhost:49998/"; //public const string BaseUrl = "http://nakedobjectstest.azurewebsites.net/"; } }
apache-2.0
C#
ee0f3c5090f9b520f8601cea1133a9731b16905c
increment minor version,
jwChung/Experimentalism,jwChung/Experimentalism
build/CommonAssemblyInfo.cs
build/CommonAssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Jin-Wook Chung")] [assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyProduct("")] [assembly: AssemblyVersion("0.9.0")] [assembly: AssemblyInformationalVersion("0.9.0")] /* * Version 0.9.0 * * Implemented FirstClassTheoremAttribute which supports providing auto data * using the AutoFixture library. * * Addressed unhandled exception thrown when creating TestCommand instances * in BaseTheoremAttribute.EnumerateTestCommands(IMethodInfo). * * Issue: https://github.com/jwChung/Experimentalism/issues/23 * * Pull request: https://github.com/jwChung/Experimentalism/pull/32 */
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Jin-Wook Chung")] [assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyProduct("")] [assembly: AssemblyVersion("0.8.21")] [assembly: AssemblyInformationalVersion("0.8.21")] /* * Version 0.8.21 * * Refactor to simplify * - Makes BaseTheoremAttribute and BaseFirstClassTheoremAttribute * abstract class. * - Removes all the parameterized constructors of BaseTheoremAttribute * and BaseFirstClassTheoremAttribute, but instead, introduces * the abstract method 'CreateTestFixture(MethodInfo)'. * * BREAKING CHANGE * - Delete: ITestFixtureFactory * - Delete: TypeFixtureFactory * - Delete: NotSupportedFixture * - Delete: AutoFixtureFactory * - Rename: DefaultTheoremAttribute -> BaseTheoremAttribute * - Rename: DefaultFirstClassTheoremAttribute -> * BaseFirstClassTheoremAttribute * - Delete: All the constructors of BaseTheoremAttribute * and BaseFirstClassTheoremAttribute * - Delete: FixtureFactory and FixtureType properties of * BaseTheoremAttribute and BaseFirstClassTheoremAttribute * - Change: ConvertToTestCommand(IMethodInfo, ITestFixtureFactory) -> * ConvertToTestCommand(IMethodInfo, Func<MethodInfo, ITestFixture>) */
mit
C#
0e7a1c8eec0bc0bb8d61fb247456754326e21051
Remove unused using.
weltkante/roslyn,dotnet/roslyn,jamesqo/roslyn,kelltrick/roslyn,heejaechang/roslyn,MichalStrehovsky/roslyn,MichalStrehovsky/roslyn,mavasani/roslyn,diryboy/roslyn,jkotas/roslyn,sharwell/roslyn,AlekseyTs/roslyn,gafter/roslyn,tannergooding/roslyn,MattWindsor91/roslyn,bkoelman/roslyn,CaptainHayashi/roslyn,tmat/roslyn,mavasani/roslyn,abock/roslyn,jamesqo/roslyn,mattscheffer/roslyn,reaction1989/roslyn,ErikSchierboom/roslyn,mattscheffer/roslyn,wvdd007/roslyn,Giftednewt/roslyn,lorcanmooney/roslyn,AmadeusW/roslyn,davkean/roslyn,lorcanmooney/roslyn,genlu/roslyn,bartdesmet/roslyn,agocke/roslyn,genlu/roslyn,CyrusNajmabadi/roslyn,tmat/roslyn,AnthonyDGreen/roslyn,jamesqo/roslyn,AlekseyTs/roslyn,weltkante/roslyn,tmeschter/roslyn,swaroop-sridhar/roslyn,srivatsn/roslyn,srivatsn/roslyn,wvdd007/roslyn,AmadeusW/roslyn,mmitche/roslyn,xasx/roslyn,AnthonyDGreen/roslyn,VSadov/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,davkean/roslyn,CaptainHayashi/roslyn,VSadov/roslyn,AlekseyTs/roslyn,paulvanbrenk/roslyn,wvdd007/roslyn,KevinRansom/roslyn,DustinCampbell/roslyn,robinsedlaczek/roslyn,sharwell/roslyn,jcouv/roslyn,Hosch250/roslyn,shyamnamboodiripad/roslyn,tannergooding/roslyn,stephentoub/roslyn,physhi/roslyn,KirillOsenkov/roslyn,ErikSchierboom/roslyn,stephentoub/roslyn,tvand7093/roslyn,srivatsn/roslyn,weltkante/roslyn,VSadov/roslyn,dpoeschl/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,gafter/roslyn,Hosch250/roslyn,physhi/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,pdelvo/roslyn,KevinRansom/roslyn,jkotas/roslyn,agocke/roslyn,MichalStrehovsky/roslyn,MattWindsor91/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,cston/roslyn,mattscheffer/roslyn,gafter/roslyn,davkean/roslyn,Giftednewt/roslyn,bkoelman/roslyn,CyrusNajmabadi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,jmarolf/roslyn,eriawan/roslyn,swaroop-sridhar/roslyn,aelij/roslyn,sharwell/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,Hosch250/roslyn,bkoelman/roslyn,dpoeschl/roslyn,mgoertz-msft/roslyn,tmeschter/roslyn,jkotas/roslyn,orthoxerox/roslyn,reaction1989/roslyn,tvand7093/roslyn,khyperia/roslyn,eriawan/roslyn,TyOverby/roslyn,kelltrick/roslyn,orthoxerox/roslyn,brettfo/roslyn,CaptainHayashi/roslyn,paulvanbrenk/roslyn,TyOverby/roslyn,tmat/roslyn,kelltrick/roslyn,Giftednewt/roslyn,OmarTawfik/roslyn,brettfo/roslyn,mgoertz-msft/roslyn,diryboy/roslyn,heejaechang/roslyn,jcouv/roslyn,abock/roslyn,aelij/roslyn,nguerrera/roslyn,bartdesmet/roslyn,jmarolf/roslyn,reaction1989/roslyn,DustinCampbell/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,panopticoncentral/roslyn,xasx/roslyn,KirillOsenkov/roslyn,jasonmalinowski/roslyn,AmadeusW/roslyn,khyperia/roslyn,physhi/roslyn,swaroop-sridhar/roslyn,stephentoub/roslyn,mmitche/roslyn,paulvanbrenk/roslyn,aelij/roslyn,tvand7093/roslyn,nguerrera/roslyn,abock/roslyn,pdelvo/roslyn,tannergooding/roslyn,cston/roslyn,ErikSchierboom/roslyn,genlu/roslyn,jmarolf/roslyn,diryboy/roslyn,AnthonyDGreen/roslyn,mmitche/roslyn,xasx/roslyn,lorcanmooney/roslyn,jcouv/roslyn,panopticoncentral/roslyn,heejaechang/roslyn,MattWindsor91/roslyn,OmarTawfik/roslyn,MattWindsor91/roslyn,OmarTawfik/roslyn,pdelvo/roslyn,tmeschter/roslyn,dotnet/roslyn,robinsedlaczek/roslyn,brettfo/roslyn,orthoxerox/roslyn,KirillOsenkov/roslyn,nguerrera/roslyn,TyOverby/roslyn,agocke/roslyn,eriawan/roslyn,DustinCampbell/roslyn,robinsedlaczek/roslyn,panopticoncentral/roslyn,cston/roslyn,bartdesmet/roslyn,khyperia/roslyn,dpoeschl/roslyn
src/Compilers/Core/Portable/AdditionalTextFile.cs
src/Compilers/Core/Portable/AdditionalTextFile.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Threading; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis { /// <summary> /// Represents a non source code file. /// </summary> internal sealed class AdditionalTextFile : AdditionalText { private readonly CommandLineSourceFile _sourceFile; private readonly CommonCompiler _compiler; private SourceText _text; private IList<DiagnosticInfo> _diagnostics; private readonly object _lockObject = new object(); public AdditionalTextFile(CommandLineSourceFile sourceFile, CommonCompiler compiler) { if (compiler == null) { throw new ArgumentNullException(nameof(compiler)); } _sourceFile = sourceFile; _compiler = compiler; _diagnostics = SpecializedCollections.EmptyList<DiagnosticInfo>(); } /// <summary> /// Path to the file. /// </summary> public override string Path => _sourceFile.Path; /// <summary> /// Returns a <see cref="SourceText"/> with the contents of this file, or <c>null</c> if /// there were errors reading the file. /// </summary> public override SourceText GetText(CancellationToken cancellationToken = default) { lock (_lockObject) { if (_text == null) { var diagnostics = new List<DiagnosticInfo>(); _text = _compiler.TryReadFileContent(_sourceFile, diagnostics); _diagnostics = diagnostics; } } return _text; } /// <summary> /// Errors encountered when trying to read the additional file. Always empty if /// <see cref="GetText(CancellationToken)"/> has not been called. /// </summary> internal IList<DiagnosticInfo> Diagnostics => _diagnostics; } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.IO; using System.Threading; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis { /// <summary> /// Represents a non source code file. /// </summary> internal sealed class AdditionalTextFile : AdditionalText { private readonly CommandLineSourceFile _sourceFile; private readonly CommonCompiler _compiler; private SourceText _text; private IList<DiagnosticInfo> _diagnostics; private readonly object _lockObject = new object(); public AdditionalTextFile(CommandLineSourceFile sourceFile, CommonCompiler compiler) { if (compiler == null) { throw new ArgumentNullException(nameof(compiler)); } _sourceFile = sourceFile; _compiler = compiler; _diagnostics = SpecializedCollections.EmptyList<DiagnosticInfo>(); } /// <summary> /// Path to the file. /// </summary> public override string Path => _sourceFile.Path; /// <summary> /// Returns a <see cref="SourceText"/> with the contents of this file, or <c>null</c> if /// there were errors reading the file. /// </summary> public override SourceText GetText(CancellationToken cancellationToken = default) { lock (_lockObject) { if (_text == null) { var diagnostics = new List<DiagnosticInfo>(); _text = _compiler.TryReadFileContent(_sourceFile, diagnostics); _diagnostics = diagnostics; } } return _text; } /// <summary> /// Errors encountered when trying to read the additional file. Always empty if /// <see cref="GetText(CancellationToken)"/> has not been called. /// </summary> internal IList<DiagnosticInfo> Diagnostics => _diagnostics; } }
mit
C#
1ed06e4bb391b4c8d73cd15cc9af74c629e37bd5
Add implementation details to MySQLSchemaAggregator
Ackara/Daterpillar
src/Daterpillar.NET/Data/MySQLSchemaAggregator.cs
src/Daterpillar.NET/Data/MySQLSchemaAggregator.cs
using System.Data; namespace Gigobyte.Daterpillar.Data { public class MySQLSchemaAggregator : SchemaAggregatorBase { public MySQLSchemaAggregator(IDbConnection connection) : base(connection) { } protected override string GetColumnInfoQuery(string tableName) { return $"SELECT c.`COLUMN_NAME` AS `Name`, c.DATA_TYPE AS `Type`, if(c.CHARACTER_MAXIMUM_LENGTH IS NULL, if(c.NUMERIC_PRECISION IS NULL, 0, c.NUMERIC_PRECISION), c.CHARACTER_MAXIMUM_LENGTH) AS `Scale`, if(c.NUMERIC_SCALE IS NULL, 0, c.NUMERIC_SCALE) AS `Precision`, c.IS_NULLABLE AS `Nullable`, c.COLUMN_DEFAULT AS `Default`, if(c.EXTRA = 'auto_increment', 1, 0) AS `Auto`, c.COLUMN_COMMENT AS `Comment` FROM information_schema.`COLUMNS` c WHERE c.TABLE_SCHEMA = '{Schema.Name}' AND c.`TABLE_NAME` = '{tableName}';"; } protected override string GetForeignKeyInfoQuery(string tableName) { return $"SELECT rc.`CONSTRAINT_NAME` AS `Name`, fc.FOR_COL_NAME AS `Column`, rc.REFERENCED_TABLE_NAME AS `Referecne_Table`, fc.REF_COL_NAME AS `Reference_Column`, rc.UPDATE_RULE AS `On_Update`, rc.DELETE_RULE AS `On_Delete`, rc.MATCH_OPTION AS `On_Match` FROM information_schema.REFERENTIAL_CONSTRAINTS rc JOIN information_schema.INNODB_SYS_FOREIGN_COLS fc ON fc.ID = concat(rc.`CONSTRAINT_SCHEMA`, '/', rc.`CONSTRAINT_NAME`) WHERE rc.`CONSTRAINT_SCHEMA` = '{Schema.Name}' AND rc.`TABLE_NAME` = '{tableName}';"; } protected override string GetIndexColumnsQuery(string indexIdentifier) { string[] values = indexIdentifier.Split(':'); return $"SELECT s.COLUMN_NAME AS `Name`, 'ASC' AS `Order` FROM information_schema.STATISTICS s WHERE s.TABLE_SCHEMA = '{Schema.Name}' AND s.TABLE_NAME = '{values[0]}' AND s.INDEX_NAME = '{values[1]}';"; } protected override string GetIndexInfoQuery(string tableName) { return $"SELECT s.INDEX_NAME AS `Name`, if(tc.CONSTRAINT_TYPE <> 'PRIMARY KEY' OR tc.CONSTRAINT_TYPE IS NULL, 'index', 'primaryKey') AS `Type`, if(tc.CONSTRAINT_TYPE = 'UNIQUE', 1, 0) AS `Unique`, concat(s.`TABLE_NAME`, ':', s.INDEX_NAME) AS `Id` FROM information_schema.STATISTICS s LEFT JOIN information_schema.TABLE_CONSTRAINTS tc ON tc.`CONSTRAINT_NAME` = s.INDEX_NAME AND tc.TABLE_SCHEMA = s.INDEX_SCHEMA AND tc.`TABLE_NAME` = s.`TABLE_NAME` AND tc.CONSTRAINT_TYPE <> 'FOREIGN KEY' WHERE s.INDEX_SCHEMA = '{Schema.Name}' AND s.`TABLE_NAME` = '{tableName}';"; } protected override string GetTableInfoQuery() { return $"SELECT t.TABLE_NAME AS `Name`, t.TABLE_COMMENT AS `Comment` FROM information_schema.TABLES t WHERE t.TABLE_SCHEMA = '{Schema.Name}';"; } } }
using System; using System.Data; namespace Gigobyte.Daterpillar.Data { public class MySQLSchemaAggregator : SchemaAggregatorBase { public MySQLSchemaAggregator(IDbConnection connection) : base(connection) { } protected override string GetColumnInfoQuery(string tableName) { return $"SELECT c.`COLUMN_NAME` AS `Name`, c.DATA_TYPE AS `Type`, if(c.CHARACTER_MAXIMUM_LENGTH IS NULL, if(c.NUMERIC_PRECISION IS NULL, 0, c.NUMERIC_PRECISION), c.CHARACTER_MAXIMUM_LENGTH) AS `Scale`, if(c.NUMERIC_SCALE IS NULL, 0, c.NUMERIC_SCALE) AS `Precision`, c.IS_NULLABLE AS `Nullable`, c.COLUMN_DEFAULT AS `Default`, if(c.EXTRA = 'auto_increment', 1, 0) AS `Auto`, c.COLUMN_COMMENT AS `Comment` FROM information_schema.`COLUMNS` c WHERE c.TABLE_SCHEMA = '{Schema.Name}' AND c.`TABLE_NAME` = '{tableName}';"; } protected override string GetForeignKeyInfoQuery(string tableName) { return $"SELECT rc.`CONSTRAINT_NAME` AS `Name`, fc.FOR_COL_NAME AS `Column`, rc.REFERENCED_TABLE_NAME AS `Referecne_Table`, fc.REF_COL_NAME AS `Reference_Column`, rc.UPDATE_RULE AS `On_Update`, rc.DELETE_RULE AS `On_Delete`, rc.MATCH_OPTION AS `On_Match` FROM information_schema.REFERENTIAL_CONSTRAINTS rc JOIN information_schema.INNODB_SYS_FOREIGN_COLS fc ON fc.ID = concat(rc.`CONSTRAINT_SCHEMA`, '/', rc.`CONSTRAINT_NAME`) WHERE rc.`CONSTRAINT_SCHEMA` = '{Schema.Name}' AND rc.`TABLE_NAME` = '{tableName}';"; } protected override string GetIndexColumnsQuery(string indexIdentifier) { throw new NotImplementedException(); } protected override string GetIndexInfoQuery(string tableName) { throw new NotImplementedException(); } protected override string GetTableInfoQuery() { return $"SELECT t.TABLE_NAME AS `Name`, t.TABLE_COMMENT AS `Comment` FROM information_schema.TABLES t WHERE t.TABLE_SCHEMA = '{Schema.Name}';"; } } }
mit
C#
60e69f5b8dccb55eb1e34a778a99a042f0165c18
Fix bug where quest NPC dialog caused a crash because the requested NPC was never set
ethanmoffat/EndlessClient
EOLib/Domain/Interact/MapNPCActions.cs
EOLib/Domain/Interact/MapNPCActions.cs
using AutomaticTypeMapper; using EOLib.Domain.Interact.Quest; using EOLib.Domain.NPC; using EOLib.IO.Repositories; using EOLib.Net; using EOLib.Net.Communication; namespace EOLib.Domain.Interact { [AutoMappedType] public class MapNPCActions : IMapNPCActions { private readonly IPacketSendService _packetSendService; private readonly IENFFileProvider _enfFileProvider; private readonly IQuestDataRepository _questDataRepository; public MapNPCActions(IPacketSendService packetSendService, IENFFileProvider enfFileProvider, IQuestDataRepository questDataRepository) { _packetSendService = packetSendService; _enfFileProvider = enfFileProvider; _questDataRepository = questDataRepository; } public void RequestShop(INPC npc) { var packet = new PacketBuilder(PacketFamily.Shop, PacketAction.Open) .AddShort(npc.Index) .Build(); _packetSendService.SendPacket(packet); } public void RequestQuest(INPC npc) { _questDataRepository.RequestedNPC = npc; var data = _enfFileProvider.ENFFile[npc.ID]; var packet = new PacketBuilder(PacketFamily.Quest, PacketAction.Use) .AddShort(npc.Index) .AddShort(data.VendorID) .Build(); _packetSendService.SendPacket(packet); } } public interface IMapNPCActions { void RequestShop(INPC npc); void RequestQuest(INPC npc); } }
using AutomaticTypeMapper; using EOLib.Domain.NPC; using EOLib.IO.Repositories; using EOLib.Net; using EOLib.Net.Communication; namespace EOLib.Domain.Interact { [AutoMappedType] public class MapNPCActions : IMapNPCActions { private readonly IPacketSendService _packetSendService; private readonly IENFFileProvider _enfFileProvider; public MapNPCActions(IPacketSendService packetSendService, IENFFileProvider enfFileProvider) { _packetSendService = packetSendService; _enfFileProvider = enfFileProvider; } public void RequestShop(INPC npc) { var packet = new PacketBuilder(PacketFamily.Shop, PacketAction.Open) .AddShort(npc.Index) .Build(); _packetSendService.SendPacket(packet); } public void RequestQuest(INPC npc) { var data = _enfFileProvider.ENFFile[npc.ID]; var packet = new PacketBuilder(PacketFamily.Quest, PacketAction.Use) .AddShort(npc.Index) .AddShort(data.VendorID) .Build(); _packetSendService.SendPacket(packet); } } public interface IMapNPCActions { void RequestShop(INPC npc); void RequestQuest(INPC npc); } }
mit
C#
f9ca48054b89faa433f0577820964be2b45d4242
Switch the load order so that metadata comes first in the dom
paynecrl97/Glimpse,sorenhl/Glimpse,dudzon/Glimpse,sorenhl/Glimpse,SusanaL/Glimpse,flcdrg/Glimpse,codevlabs/Glimpse,codevlabs/Glimpse,rho24/Glimpse,rho24/Glimpse,paynecrl97/Glimpse,elkingtonmcb/Glimpse,codevlabs/Glimpse,SusanaL/Glimpse,Glimpse/Glimpse,Glimpse/Glimpse,paynecrl97/Glimpse,SusanaL/Glimpse,flcdrg/Glimpse,paynecrl97/Glimpse,flcdrg/Glimpse,gabrielweyer/Glimpse,gabrielweyer/Glimpse,elkingtonmcb/Glimpse,rho24/Glimpse,dudzon/Glimpse,elkingtonmcb/Glimpse,sorenhl/Glimpse,Glimpse/Glimpse,rho24/Glimpse,gabrielweyer/Glimpse,dudzon/Glimpse
source/Glimpse.Core2/Extensibility/ScriptOrder.cs
source/Glimpse.Core2/Extensibility/ScriptOrder.cs
namespace Glimpse.Core2.Extensibility { public enum ScriptOrder { IncludeBeforeClientInterfaceScript, ClientInterfaceScript, IncludeAfterClientInterfaceScript, IncludeBeforeRequestDataScript, RequestMetadataScript, RequestDataScript, IncludeAfterRequestDataScript, } }
namespace Glimpse.Core2.Extensibility { public enum ScriptOrder { IncludeBeforeClientInterfaceScript, ClientInterfaceScript, IncludeAfterClientInterfaceScript, IncludeBeforeRequestDataScript, RequestDataScript, RequestMetadataScript, IncludeAfterRequestDataScript, } }
apache-2.0
C#
20c83223770615646981a3049c91c8dab69e2e99
Clean file
appharbor/ConsolR,appharbor/ConsolR
Hosting/BootStrapper.cs
Hosting/BootStrapper.cs
using System.Web.Routing; using SignalR; [assembly: WebActivator.PostApplicationStartMethod(typeof(ConsolR.Hosting.Bootstrapper), "PreApplicationStart")] namespace ConsolR.Hosting { public static class Bootstrapper { public static void PreApplicationStart() { var routes = RouteTable.Routes; routes.MapHttpHandler<Handler>("consolr"); routes.MapHttpHandler<Handler>("consolr/validate"); routes.MapConnection<ExecuteEndPoint>("consolr-execute", "consolr/execute/{*operation}"); } } }
using System.Web.Routing; using ConsolR.Hosting; using SignalR; [assembly: WebActivator.PostApplicationStartMethod(typeof(ConsolR.Hosting.Bootstrapper), "PreApplicationStart")] namespace ConsolR.Hosting { public static class Bootstrapper { public static void PreApplicationStart() { var routes = RouteTable.Routes; routes.MapHttpHandler<Handler>("consolr/validate"); routes.MapHttpHandler<Handler>("consolr"); routes.MapConnection<ExecuteEndPoint>("consolr-execute", "consolr/execute/{*operation}"); } } }
mit
C#
afa11beacb0c2d74067295003d42a2cba0492f1a
work on vessel warp
KerbaeAdAstra/KerbalFuture
KerbalFuture/SpaceFolderFlightDrive.cs
KerbalFuture/SpaceFolderFlightDrive.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using KSP; using KerbalFuture; namespace KerbalFuture { class FlightDrive : VesselModule { private static Vector3d vesPos; private static double vesHeight; private static CelestialBody vesBody; private static CelestialBody warpBody; public void WarpVessel() { if(WarpIsGo()) { vesPos = this.Vessel.GetWorldPosition3D(); vesBody = this.Vessel.mainBody; vesHeight = (this.Vessel.alitiude + vesBody.Radius); warpBody = GUIChosenBody(); } } private double GetVesselLongPos(Vector3d pos) { return this.Vessel.GetLongitude(pos, false); } private double GetVesselLatPos(Vector3d pos) { return this.Vessel.GetLatitude(pos, false); } private void CalculateGravPot(CelestialBody cb) { cb. } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using KSP; using KerbalFuture; namespace KerbalFuture { class FlightDrive : VesselModule { private static Vector3d vesPos; private static double vesHeight; private static CelestialBody vesBody; public void WarpVessel() { if(WarpIsGo()) { vesPos = this.Vessel.GetWorldPosition3D(); vesBody = this.Vessel.mainBody; vesHeight = this.Vessel.alitiude + vesBody.Radius; } } } }
mit
C#
1cd10fc1fd3108930c58afa9fbd3b770a5d1103a
Remove unused field.
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
src/MitternachtBot/Modules/Games/Services/GamesService.cs
src/MitternachtBot/Modules/Games/Services/GamesService.cs
using System; using System.Collections.Concurrent; using System.Linq; using System.Threading; using Mitternacht.Modules.Games.Common; using Mitternacht.Services; namespace Mitternacht.Modules.Games.Services { public class GamesService : IMService { private readonly IBotConfigProvider _bcp; public readonly ConcurrentDictionary<ulong, GirlRating> GirlRatings = new ConcurrentDictionary<ulong, GirlRating>(); public string[] EightBallResponses => _bcp.BotConfig.EightBallResponses.Select(ebr => ebr.Text).ToArray(); public GamesService(IBotConfigProvider bcp) { _bcp = bcp; var timer = new Timer(_ => { GirlRatings.Clear(); }, null, TimeSpan.FromDays(1), TimeSpan.FromDays(1)); } } }
using System; using System.Collections.Concurrent; using System.Linq; using System.Threading; using Mitternacht.Modules.Games.Common; using Mitternacht.Services; namespace Mitternacht.Modules.Games.Services { public class GamesService : IMService { private readonly IBotConfigProvider _bcp; public readonly ConcurrentDictionary<ulong, GirlRating> GirlRatings = new ConcurrentDictionary<ulong, GirlRating>(); public string[] EightBallResponses => _bcp.BotConfig.EightBallResponses.Select(ebr => ebr.Text).ToArray(); public readonly string TypingArticlesPath = "data/typing_articles2.json"; public GamesService(IBotConfigProvider bcp) { _bcp = bcp; var timer = new Timer(_ => { GirlRatings.Clear(); }, null, TimeSpan.FromDays(1), TimeSpan.FromDays(1)); } } }
mit
C#
a6ccbc7d7ecc865c84d5386aeb3ff84ec1ff6d83
Update PraramterHelper.cs
isdaniel/ElectronicInvoice_TW
src/ElectronicInvoice.Produce/Helper/PraramterHelper.cs
src/ElectronicInvoice.Produce/Helper/PraramterHelper.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; namespace ElectronicInvoice.Produce.Infrastructure.Helper { public class PraramterHelper { /// <summary> /// 將字典轉成相對應參數字串 /// </summary> /// <param name="dirc"></param> /// <returns></returns> public static string DictionaryToParamter(IDictionary<string,string> dirc) { return string.Join("&", dirc.Select(x => $"{x.Key}={x.Value}")); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; namespace ElectronicInvoice.Produce.Infrastructure.Helper { public class PraramterHelper { /// <summary> /// 將字典轉成相對應參數字串 /// </summary> /// <param name="dirc"></param> /// <returns></returns> public static string DictionaryToParamter(IDictionary<string,string> dirc) { string value = string.Empty; List<string> paraList = new List<string>(); foreach (var item in dirc) { value = item.Value ?? ""; paraList.Add(SpellParamter(item.Key, value)); } return string.Join("&", paraList); } private static string SpellParamter(string key,string value) { return $"{key}={value}"; } } }
apache-2.0
C#
838cd975c6c31c55e303594139e32454eba6996d
Make the FNF exception light up more robust
AlekseyTs/roslyn,davkean/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,swaroop-sridhar/roslyn,dotnet/roslyn,panopticoncentral/roslyn,VSadov/roslyn,mavasani/roslyn,diryboy/roslyn,dotnet/roslyn,VSadov/roslyn,bartdesmet/roslyn,aelij/roslyn,DustinCampbell/roslyn,agocke/roslyn,mgoertz-msft/roslyn,DustinCampbell/roslyn,nguerrera/roslyn,nguerrera/roslyn,physhi/roslyn,abock/roslyn,jasonmalinowski/roslyn,stephentoub/roslyn,tannergooding/roslyn,gafter/roslyn,sharwell/roslyn,gafter/roslyn,reaction1989/roslyn,mgoertz-msft/roslyn,eriawan/roslyn,abock/roslyn,agocke/roslyn,jcouv/roslyn,diryboy/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,tmat/roslyn,jcouv/roslyn,mavasani/roslyn,DustinCampbell/roslyn,KirillOsenkov/roslyn,swaroop-sridhar/roslyn,diryboy/roslyn,MichalStrehovsky/roslyn,brettfo/roslyn,AlekseyTs/roslyn,heejaechang/roslyn,eriawan/roslyn,brettfo/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,heejaechang/roslyn,weltkante/roslyn,mgoertz-msft/roslyn,CyrusNajmabadi/roslyn,physhi/roslyn,abock/roslyn,MichalStrehovsky/roslyn,sharwell/roslyn,tmat/roslyn,jmarolf/roslyn,CyrusNajmabadi/roslyn,AlekseyTs/roslyn,gafter/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,weltkante/roslyn,stephentoub/roslyn,aelij/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,jcouv/roslyn,jmarolf/roslyn,agocke/roslyn,dotnet/roslyn,wvdd007/roslyn,jmarolf/roslyn,tannergooding/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,KirillOsenkov/roslyn,aelij/roslyn,VSadov/roslyn,ErikSchierboom/roslyn,KevinRansom/roslyn,tmat/roslyn,sharwell/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,ErikSchierboom/roslyn,nguerrera/roslyn,genlu/roslyn,weltkante/roslyn,davkean/roslyn,shyamnamboodiripad/roslyn,ErikSchierboom/roslyn,AmadeusW/roslyn,reaction1989/roslyn,reaction1989/roslyn,physhi/roslyn,tannergooding/roslyn,mavasani/roslyn,MichalStrehovsky/roslyn,swaroop-sridhar/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,brettfo/roslyn,genlu/roslyn,AmadeusW/roslyn,davkean/roslyn,bartdesmet/roslyn,eriawan/roslyn
src/Compilers/Shared/DesktopShim.cs
src/Compilers/Shared/DesktopShim.cs
// Copyright (c) Microsoft. 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; namespace Roslyn.Utilities { /// <summary> /// This is a bridge for APIs that are only available on Desktop /// and NOT on CoreCLR. The compiler currently targets .NET 4.5 and CoreCLR /// so this shim is necessary for switching on the dependent behavior. /// </summary> internal static class DesktopShim { internal static class FileNotFoundException { internal static readonly Type Type = typeof(FileNotFoundException); private static PropertyInfo s_fusionLog = Type?.GetTypeInfo().GetDeclaredProperty("FusionLog"); internal static string TryGetFusionLog(object obj) => s_fusionLog?.GetValue(obj) as string; } } }
// Copyright (c) Microsoft. 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; namespace Roslyn.Utilities { /// <summary> /// This is a bridge for APIs that are only available on Desktop /// and NOT on CoreCLR. The compiler currently targets .NET 4.5 and CoreCLR /// so this shim is necessary for switching on the dependent behavior. /// </summary> internal static class DesktopShim { internal static class FileNotFoundException { internal static readonly Type Type = ReflectionUtilities.TryGetType( "System.IO.FileNotFoundException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); private static PropertyInfo s_fusionLog = Type?.GetTypeInfo().GetDeclaredProperty("FusionLog"); internal static string TryGetFusionLog(object obj) => s_fusionLog.GetValue(obj) as string; } } }
mit
C#
c0bf26b2a1a889de988c1c1e375ac2947fdd4615
Add new formats to ResponseFormat.cs
Ackara/Mockaroo.NET
src/Mockaroo.Core/ResponseFormat.cs
src/Mockaroo.Core/ResponseFormat.cs
namespace Gigobyte.Mockaroo { /// <summary> /// The Mockaroo server HTTP response format. /// </summary> public enum ResponseFormat { /// <summary> /// Comma separated values. The first row will contain the field names. Subsequent rows will /// contain the generated data values. /// </summary> CSV, /// <summary> /// Results are returned as a json object. Results will be returned as an array if the "size" /// query string parameter is greater than 1. /// </summary> JSON, /// <summary> /// Tab-separated values. The first row will contain the field names. Subsequent rows will /// contain the generated data values. /// </summary> TXT, /// <summary> /// Results are returned as SQL insert statements. /// </summary> SQL, /// <summary> /// Results are returned as an xml document. /// </summary> XML } }
namespace Gigobyte.Mockaroo { /// <summary> /// The Mockaroo server HTTP response format. /// </summary> public enum ResponseFormat { /// <summary> /// Comma separated values. The first row will contain the field names. Subsequent rows will /// contain the generated data values. /// </summary> CSV, /// <summary> /// Results are returned as a json object. Results will be returned as an array if the /// "size" query string parameter is greater than 1. /// </summary> JSON } }
mit
C#
4ea7cefa59f423395bb74b58316e6fb00aa4a94d
increase version
MPZMail/MpzMail.Api,MahmutOhneC/MpzMail.Api
MpzMail.Api/Properties/AssemblyInfo.cs
MpzMail.Api/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("MpzMail.Api")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MpzMail.Api")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9b063e07-8d3b-4faa-bb34-90c70e5f7460")] // 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")]
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("MpzMail.Api")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MpzMail.Api")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9b063e07-8d3b-4faa-bb34-90c70e5f7460")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
8f4213994da35a84551f4aa546ed99cd63518ed0
Fix bug: Clearing the cache says "All items have been cleared from the recent packages list." Work items: 986
xoofx/NuGet,indsoft/NuGet2,dolkensp/node.net,mono/nuget,xero-github/Nuget,anurse/NuGet,antiufo/NuGet2,indsoft/NuGet2,themotleyfool/NuGet,jholovacs/NuGet,themotleyfool/NuGet,alluran/node.net,RichiCoder1/nuget-chocolatey,kumavis/NuGet,zskullz/nuget,mrward/nuget,jholovacs/NuGet,jmezach/NuGet2,GearedToWar/NuGet2,ctaggart/nuget,mono/nuget,ctaggart/nuget,xoofx/NuGet,GearedToWar/NuGet2,pratikkagda/nuget,jmezach/NuGet2,antiufo/NuGet2,dolkensp/node.net,zskullz/nuget,chocolatey/nuget-chocolatey,RichiCoder1/nuget-chocolatey,antiufo/NuGet2,oliver-feng/nuget,ctaggart/nuget,akrisiun/NuGet,alluran/node.net,oliver-feng/nuget,xoofx/NuGet,atheken/nuget,mono/nuget,antiufo/NuGet2,jmezach/NuGet2,pratikkagda/nuget,oliver-feng/nuget,indsoft/NuGet2,RichiCoder1/nuget-chocolatey,oliver-feng/nuget,chocolatey/nuget-chocolatey,indsoft/NuGet2,chester89/nugetApi,OneGet/nuget,jmezach/NuGet2,jholovacs/NuGet,jholovacs/NuGet,pratikkagda/nuget,mrward/nuget,atheken/nuget,RichiCoder1/nuget-chocolatey,rikoe/nuget,jmezach/NuGet2,RichiCoder1/nuget-chocolatey,mrward/nuget,mono/nuget,oliver-feng/nuget,mrward/NuGet.V2,chocolatey/nuget-chocolatey,xoofx/NuGet,pratikkagda/nuget,xoofx/NuGet,mrward/nuget,kumavis/NuGet,xoofx/NuGet,dolkensp/node.net,OneGet/nuget,mrward/NuGet.V2,dolkensp/node.net,ctaggart/nuget,jholovacs/NuGet,jmezach/NuGet2,zskullz/nuget,RichiCoder1/nuget-chocolatey,zskullz/nuget,chester89/nugetApi,mrward/nuget,rikoe/nuget,GearedToWar/NuGet2,chocolatey/nuget-chocolatey,OneGet/nuget,antiufo/NuGet2,themotleyfool/NuGet,chocolatey/nuget-chocolatey,mrward/nuget,mrward/NuGet.V2,alluran/node.net,akrisiun/NuGet,indsoft/NuGet2,GearedToWar/NuGet2,mrward/NuGet.V2,OneGet/nuget,GearedToWar/NuGet2,oliver-feng/nuget,mrward/NuGet.V2,rikoe/nuget,mrward/NuGet.V2,anurse/NuGet,alluran/node.net,pratikkagda/nuget,indsoft/NuGet2,chocolatey/nuget-chocolatey,rikoe/nuget,pratikkagda/nuget,antiufo/NuGet2,jholovacs/NuGet,GearedToWar/NuGet2
src/Options/GeneralOptionControl.cs
src/Options/GeneralOptionControl.cs
using System; using System.Diagnostics; using System.IO; using System.Windows.Forms; using NuGet.VisualStudio; namespace NuGet.Options { public partial class GeneralOptionControl : UserControl { private IRecentPackageRepository _recentPackageRepository; private IProductUpdateSettings _productUpdateSettings; public GeneralOptionControl() { InitializeComponent(); _productUpdateSettings = ServiceLocator.GetInstance<IProductUpdateSettings>(); Debug.Assert(_productUpdateSettings != null); _recentPackageRepository = ServiceLocator.GetInstance<IRecentPackageRepository>(); Debug.Assert(_recentPackageRepository != null); } private void OnClearRecentPackagesClick(object sender, EventArgs e) { _recentPackageRepository.Clear(); MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearRecentPackages, Resources.ShowWarning_Title); } internal void OnActivated() { checkForUpdate.Checked = _productUpdateSettings.ShouldCheckForUpdate; browsePackageCacheButton.Enabled = clearPackageCacheButton.Enabled = Directory.Exists(MachineCache.Default.Source); } internal void OnApply() { _productUpdateSettings.ShouldCheckForUpdate = checkForUpdate.Checked; } private void OnClearPackageCacheClick(object sender, EventArgs e) { MachineCache.Default.Clear(); MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearPackageCache, Resources.ShowWarning_Title); } private void OnBrowsePackageCacheClick(object sender, EventArgs e) { if (Directory.Exists(MachineCache.Default.Source)) { Process.Start(MachineCache.Default.Source); } } } }
using System; using System.Diagnostics; using System.IO; using System.Windows.Forms; using NuGet.VisualStudio; namespace NuGet.Options { public partial class GeneralOptionControl : UserControl { private IRecentPackageRepository _recentPackageRepository; private IProductUpdateSettings _productUpdateSettings; public GeneralOptionControl() { InitializeComponent(); _productUpdateSettings = ServiceLocator.GetInstance<IProductUpdateSettings>(); Debug.Assert(_productUpdateSettings != null); _recentPackageRepository = ServiceLocator.GetInstance<IRecentPackageRepository>(); Debug.Assert(_recentPackageRepository != null); } private void OnClearRecentPackagesClick(object sender, EventArgs e) { _recentPackageRepository.Clear(); MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearRecentPackages, Resources.ShowWarning_Title); } internal void OnActivated() { checkForUpdate.Checked = _productUpdateSettings.ShouldCheckForUpdate; browsePackageCacheButton.Enabled = clearPackageCacheButton.Enabled = Directory.Exists(MachineCache.Default.Source); } internal void OnApply() { _productUpdateSettings.ShouldCheckForUpdate = checkForUpdate.Checked; } private void OnClearPackageCacheClick(object sender, EventArgs e) { MachineCache.Default.Clear(); MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearRecentPackages, Resources.ShowWarning_Title); } private void OnBrowsePackageCacheClick(object sender, EventArgs e) { if (Directory.Exists(MachineCache.Default.Source)) { Process.Start(MachineCache.Default.Source); } } } }
apache-2.0
C#
f0e56a1455be4ede45bc9a4683227f6b84cf0fa0
Change a-Z to a-zA-Z as reccomended
r2i-sitecore/dotless,rytmis/dotless,dotless/dotless,dotless/dotless,modulexcite/dotless,rytmis/dotless,modulexcite/dotless,rytmis/dotless,modulexcite/dotless,r2i-sitecore/dotless,rytmis/dotless,rytmis/dotless,r2i-sitecore/dotless,modulexcite/dotless,rytmis/dotless,r2i-sitecore/dotless,modulexcite/dotless,r2i-sitecore/dotless,modulexcite/dotless,r2i-sitecore/dotless,rytmis/dotless,r2i-sitecore/dotless,modulexcite/dotless
src/dotless.Core/Parser/Tree/Url.cs
src/dotless.Core/Parser/Tree/Url.cs
namespace dotless.Core.Parser.Tree { using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using Infrastructure; using Infrastructure.Nodes; using Utils; using Exceptions; public class Url : Node { public Node Value { get; set; } public Url(Node value, IEnumerable<string> paths) { if (value is TextNode) { var textValue = value as TextNode; if (!Regex.IsMatch(textValue.Value, @"^(([a-zA-Z]+:)|(\/))") && paths.Any()) { textValue.Value = paths.Concat(new[] { textValue.Value }).AggregatePaths(); } } Value = value; } public Url(Node value) { Value = value; } public string GetUrl() { if (Value is TextNode) return (Value as TextNode).Value; throw new ParserException("Imports do not allow expressions"); } public override Node Evaluate(Env env) { return new Url(Value.Evaluate(env)); } public override void AppendCSS(Env env) { env.Output .Append("url(") .Append(Value) .Append(")"); } } }
namespace dotless.Core.Parser.Tree { using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using Infrastructure; using Infrastructure.Nodes; using Utils; using Exceptions; public class Url : Node { public Node Value { get; set; } public Url(Node value, IEnumerable<string> paths) { if (value is TextNode) { var textValue = value as TextNode; if (!Regex.IsMatch(textValue.Value, @"^(([A-z]+:)|(\/))") && paths.Any()) { textValue.Value = paths.Concat(new[] { textValue.Value }).AggregatePaths(); } } Value = value; } public Url(Node value) { Value = value; } public string GetUrl() { if (Value is TextNode) return (Value as TextNode).Value; throw new ParserException("Imports do not allow expressions"); } public override Node Evaluate(Env env) { return new Url(Value.Evaluate(env)); } public override void AppendCSS(Env env) { env.Output .Append("url(") .Append(Value) .Append(")"); } } }
apache-2.0
C#
c5471cc62ebe67750c990c40fbe9bf0e40537259
Comment out the environment message for the time being
Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype
src/Glimpse.Agent.AspNet/Internal/Inspectors/AspNet/EnvironmentInspector.cs
src/Glimpse.Agent.AspNet/Internal/Inspectors/AspNet/EnvironmentInspector.cs
using System; using Glimpse.Agent.AspNet.Messages; using Glimpse.Agent.Inspectors; using Microsoft.AspNet.Http; namespace Glimpse.Agent.AspNet.Internal.Inspectors.AspNet { public class EnvironmentInspector : Inspector { private readonly IAgentBroker _broker; private EnvironmentMessage _message; public EnvironmentInspector(IAgentBroker broker) { _broker = broker; } public override void Before(HttpContext context) { //if (_message == null) //{ // _message = new EnvironmentMessage // { // Server = Environment.MachineName, // OperatingSystem = Environment.OSVersion.VersionString, // ProcessorCount = Environment.ProcessorCount, // Is64Bit = Environment.Is64BitOperatingSystem, // CommandLineArgs = Environment.GetCommandLineArgs(), // EnvironmentVariables = Environment.GetEnvironmentVariables() // }; //} //_broker.SendMessage(_message); } } }
using System; using Glimpse.Agent.AspNet.Messages; using Glimpse.Agent.Inspectors; using Microsoft.AspNet.Http; namespace Glimpse.Agent.AspNet.Internal.Inspectors.AspNet { public class EnvironmentInspector : Inspector { private readonly IAgentBroker _broker; private EnvironmentMessage _message; public EnvironmentInspector(IAgentBroker broker) { _broker = broker; } public override void Before(HttpContext context) { if (_message == null) { _message = new EnvironmentMessage { Server = Environment.MachineName, OperatingSystem = Environment.OSVersion.VersionString, ProcessorCount = Environment.ProcessorCount, Is64Bit = Environment.Is64BitOperatingSystem, CommandLineArgs = Environment.GetCommandLineArgs(), EnvironmentVariables = Environment.GetEnvironmentVariables() }; } _broker.SendMessage(_message); } } }
mit
C#
945b4161685d5c5ddfd4e9cad0aff77106a6fdd7
Fix - Settaggio dello stato di "In Sede" quando prenoto un mezzo
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
src/backend/SO115App.Persistence.MongoDB/GestioneMezzi/SetMezzoPrenotato.cs
src/backend/SO115App.Persistence.MongoDB/GestioneMezzi/SetMezzoPrenotato.cs
using MongoDB.Driver; using Persistence.MongoDB; using SO115App.Models.Classi.Condivise; using SO115App.Models.Servizi.CQRS.Commands.GestioneSoccorso.GestionePartenza.SetMezzoPrenotato; using SO115App.Models.Servizi.Infrastruttura.Composizione; using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Gac; using System; using System.Collections.Generic; namespace SO115App.Persistence.MongoDB.GestioneMezzi { public class SetMezzoPrenotato : ISetMezzoPrenotato { private readonly IGetStatoMezzi _getStatoMezzi; private readonly DbContext _dbContext; private readonly IGetMezziByCodiceMezzo _getMezziByCodice; public SetMezzoPrenotato(IGetStatoMezzi getStatoMezzi, DbContext dbContext, IGetMezziByCodiceMezzo getMezziByCodice) { _getStatoMezzi = getStatoMezzi; _dbContext = dbContext; _getMezziByCodice = getMezziByCodice; } public void Set(SetMezzoPrenotatoCommand command) { var mezzi = _getStatoMezzi.Get(command.MezzoPrenotato.CodiceSede, command.MezzoPrenotato.CodiceMezzo); //var mezzoFromOra = _getMezziByCodice.Get(new List<string> { command.MezzoPrenotato.CodiceMezzo }, command.MezzoPrenotato.CodiceSede).Result.Find(x => x.Codice.Equals(command.MezzoPrenotato.CodiceMezzo)); //command.MezzoPrenotato.CodiceSede = mezzoFromOra.Distaccamento.Codice; if (mezzi != null && command.MezzoPrenotato.SbloccaMezzo) { _dbContext.StatoMezzoCollection.FindOneAndDelete(Builders<StatoOperativoMezzo>.Filter.Eq(s => s.CodiceMezzo, command.MezzoPrenotato.CodiceMezzo)); } else if (!command.MezzoPrenotato.SbloccaMezzo) { command.MezzoPrenotato.StatoOperativo = "In Sede"; _dbContext.StatoMezzoCollection.InsertOne(command.MezzoPrenotato); } } } }
using MongoDB.Driver; using Persistence.MongoDB; using SO115App.Models.Classi.Condivise; using SO115App.Models.Servizi.CQRS.Commands.GestioneSoccorso.GestionePartenza.SetMezzoPrenotato; using SO115App.Models.Servizi.Infrastruttura.Composizione; using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Gac; using System; using System.Collections.Generic; namespace SO115App.Persistence.MongoDB.GestioneMezzi { public class SetMezzoPrenotato : ISetMezzoPrenotato { private readonly IGetStatoMezzi _getStatoMezzi; private readonly DbContext _dbContext; private readonly IGetMezziByCodiceMezzo _getMezziByCodice; public SetMezzoPrenotato(IGetStatoMezzi getStatoMezzi, DbContext dbContext, IGetMezziByCodiceMezzo getMezziByCodice) { _getStatoMezzi = getStatoMezzi; _dbContext = dbContext; _getMezziByCodice = getMezziByCodice; } public void Set(SetMezzoPrenotatoCommand command) { var mezzi = _getStatoMezzi.Get(command.MezzoPrenotato.CodiceSede, command.MezzoPrenotato.CodiceMezzo); //var mezzoFromOra = _getMezziByCodice.Get(new List<string> { command.MezzoPrenotato.CodiceMezzo }, command.MezzoPrenotato.CodiceSede).Result.Find(x => x.Codice.Equals(command.MezzoPrenotato.CodiceMezzo)); //command.MezzoPrenotato.CodiceSede = mezzoFromOra.Distaccamento.Codice; if (mezzi != null && command.MezzoPrenotato.SbloccaMezzo) { _dbContext.StatoMezzoCollection.FindOneAndDelete(Builders<StatoOperativoMezzo>.Filter.Eq(s => s.CodiceMezzo, command.MezzoPrenotato.CodiceMezzo)); } else if (!command.MezzoPrenotato.SbloccaMezzo) { _dbContext.StatoMezzoCollection.InsertOne(command.MezzoPrenotato); } } } }
agpl-3.0
C#
1a69a43b3546ec07fbae1fa05aabe282e759da7d
adjust polar polygons to use the polar vector class change type of polar vector values to double
opcon/Substructio,opcon/Substructio
Core/Math/PolarVector.cs
Core/Math/PolarVector.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using OpenTK; namespace Substructio.Core.Math { public class PolarVector { public double Radius { get; set; } public double Azimuth { get; set; } public PolarVector(double azimuth, double radius) { Azimuth = azimuth; Radius = radius; } public PolarVector() { Azimuth = 0; Radius = 0; } public Vector2 ToCartesianCoordinates() { return new Vector2((float)(Radius * System.Math.Cos(Azimuth)), (float)(Radius * System.Math.Sin(Azimuth))); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using OpenTK; namespace Substructio.Core.Math { class PolarVector { public float Radius { get; set; } public float Azimuth { get; set; } public PolarVector(float azimuth, float radius) { Azimuth = azimuth; Radius = radius; } public PolarVector() { Azimuth = 0; Radius = 0; } public Vector2 ToCartesianCoordinates() { return new Vector2((float)(Radius * System.Math.Cos(Azimuth)), (float)(Radius * System.Math.Sin(Azimuth))); } } }
mit
C#
2e4ddad18dc9797e3c79625396948de7778fcfd0
Add setter
bartlomiejwolk/AnimationPathAnimator
PathEvents/NodeEvent.cs
PathEvents/NodeEvent.cs
using UnityEngine; namespace ATP.SimplePathAnimator.Events { [System.Serializable] public class NodeEvent { [SerializeField] private string methodName; [SerializeField] private string methodArg; public string MethodName { get { return methodName; } set { methodName = value; } } public string MethodArg { get { return methodArg; } set { methodArg = value; } } } }
using UnityEngine; namespace ATP.SimplePathAnimator.Events { [System.Serializable] public class NodeEvent { [SerializeField] private string methodName; [SerializeField] private string methodArg; public string MethodName { get { return methodName; } } public string MethodArg { get { return methodArg; } } } }
mit
C#
45da0497c54668b5c57f77e6a9ad2c830cc68ff5
Make Platform.Linux.Native.dlopen() private.
ZLima12/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,peppy/osu-framework,Tom94/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework
osu.Framework/Platform/Linux/Native/Library.cs
osu.Framework/Platform/Linux/Native/Library.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.Runtime.InteropServices; namespace osu.Framework.Platform.Linux.Native { public static class Library { [DllImport("libdl.so", EntryPoint = "dlopen")] private static extern IntPtr dlopen(string filename, int flags); public static void LoadLazyLocal(string filename) { dlopen(filename, 0x001); // RTLD_LOCAL + RTLD_NOW } public static void LoadNowLocal(string filename) { dlopen(filename, 0x002); // RTLD_LOCAL + RTLD_NOW } public static void LoadLazyGlobal(string filename) { dlopen(filename, 0x101); // RTLD_GLOBAL + RTLD_LAZY } public static void LoadNowGlobal(string filename) { dlopen(filename, 0x102); // RTLD_GLOBAL + RTLD_NOW } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.Runtime.InteropServices; namespace osu.Framework.Platform.Linux.Native { public static class Library { [DllImport("libdl.so", EntryPoint = "dlopen")] static extern IntPtr dlopen(string filename, int flags); public static void LoadLazyLocal(string filename) { dlopen(filename, 0x001); // RTLD_LOCAL + RTLD_NOW } public static void LoadNowLocal(string filename) { dlopen(filename, 0x002); // RTLD_LOCAL + RTLD_NOW } public static void LoadLazyGlobal(string filename) { dlopen(filename, 0x101); } public static void LoadNowGlobal(string filename) { dlopen(filename, 0x102); } } }
mit
C#
b4f8aba0fbc410b9251c6c67a9402c28f43924f1
Fix comments
DaveSenn/Extend
.Src/Extend/System.Type/Type.IsMicrosoftType.cs
.Src/Extend/System.Type/Type.IsMicrosoftType.cs
#region Usings using System; using System.Linq; using System.Reflection; #endregion namespace Extend { /// <summary> /// Class containing some extension methods for <see cref="Type" />. /// </summary> public static partial class TypeEx { /// <summary> /// Checks if th given type is a Microsoft type, based on the company attribute of it's declaring assembly. /// </summary> /// <param name="type">The type to check.</param> /// <returns>Returns a value of true if the given type is a Microsoft type; otherwise, false.</returns> public static Boolean IsMicrosoftType( this Type type ) { #if PORTABLE45 var attributes = type.GetTypeInfo() .Assembly.GetCustomAttributes<AssemblyCompanyAttribute>(); #elif NET40 var attributes = type.Assembly.GetCustomAttributes( typeof (AssemblyCompanyAttribute), false ) .OfType<AssemblyCompanyAttribute>(); #endif return attributes.Any( x => x.Company == "Microsoft Corporation" ); } } }
#region Usings using System; using System.Linq; using System.Reflection; #endregion namespace Extend { /// <summary> /// Class containing some extension methods for <see cref="Type" />. /// </summary> public static partial class TypeEx { /// <summary> /// Checks if th egiven type is a microsoft type, based on the company attribut eof it's declaring assembly. /// </summary> /// <param name="type">The type to check.</param> /// <returns>Returns a value of true if the given type is a microsft type; otherweise, false.</returns> public static Boolean IsMicrosoftType( this Type type ) { #if PORTABLE45 var attributes = type.GetTypeInfo() .Assembly.GetCustomAttributes<AssemblyCompanyAttribute>(); #elif NET40 var attributes = type.Assembly.GetCustomAttributes( typeof (AssemblyCompanyAttribute), false ) .OfType<AssemblyCompanyAttribute>(); #endif return attributes.Any( x => x.Company == "Microsoft Corporation" ); } } }
mit
C#
08ad6c9280beca5df1c562cedb4111457946c2ec
Change greetings
mormond/WhoWasIn,mormond/WhoWasIn
Dialogs/RootDialog.cs
Dialogs/RootDialog.cs
namespace whoWasIn.Dialogs { using Microsoft.Bot.Builder.Dialogs; using Microsoft.Bot.Connector; using System; using System.Net.Http; using System.Threading.Tasks; using whoWasIn.Services.LUISService; [Serializable] public class RootDialog : IDialog<object> { public async Task StartAsync(IDialogContext ctx) { await ctx.PostAsync("Greetings..."); ctx.Wait(MessageReceivedAsync); } public async Task MessageReceivedAsync(IDialogContext ctx, IAwaitable<IMessageActivity> argument) { var message = await argument; await ctx.PostAsync("You said " + message.Text); LUISResponse response = await LUISService.askLUIS(message.Text); switch (response.topScoringIntent.intent) { case "Who worked on": ctx.Call<object>(new WhoWorkedOnDialog(response), null); break; case "GetYear": ctx.Call<object>(new WhatYearDialog(response), null); break; case "Tell me about": ctx.Call<object>(new TellMeAboutDialog(response), null); break; default: ctx.Wait(MessageReceivedAsync); break; } } private async Task ResumeAfterWhoWorkedOnDialog(IDialogContext context, IAwaitable<int> result) { } private async Task ResumeAfterWhatYearDialog(IDialogContext context, IAwaitable<int> result) { } private async Task ResumeAfterTellMeAbout(IDialogContext context, IAwaitable<int> result) { } } }
namespace whoWasIn.Dialogs { using Microsoft.Bot.Builder.Dialogs; using Microsoft.Bot.Connector; using System; using System.Net.Http; using System.Threading.Tasks; using whoWasIn.Services.LUISService; [Serializable] public class RootDialog : IDialog<object> { public async Task StartAsync(IDialogContext ctx) { await ctx.PostAsync("You wanted to know about Bob and Al, right?"); ctx.Wait(MessageReceivedAsync); } public async Task MessageReceivedAsync(IDialogContext ctx, IAwaitable<IMessageActivity> argument) { var message = await argument; await ctx.PostAsync("You said " + message.Text + " but you meant to ask something else"); LUISResponse response = await LUISService.askLUIS(message.Text); switch (response.topScoringIntent.intent) { case "Who worked on": ctx.Call<object>(new WhoWorkedOnDialog(response), null); break; case "GetYear": ctx.Call<object>(new WhatYearDialog(response), null); break; case "Tell me about": ctx.Call<object>(new TellMeAboutDialog(response), null); break; default: ctx.Wait(MessageReceivedAsync); break; } } private async Task ResumeAfterWhoWorkedOnDialog(IDialogContext context, IAwaitable<int> result) { } private async Task ResumeAfterWhatYearDialog(IDialogContext context, IAwaitable<int> result) { } private async Task ResumeAfterTellMeAbout(IDialogContext context, IAwaitable<int> result) { } } }
mit
C#
fd6ff72ca9a3b2011d5c1fceb9ffa9f8e2324196
Add xaml attributes
l8s/Eto,l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,l8s/Eto,PowerOfCode/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1
Source/Eto.Serialization.Xaml/Properties/AssemblyInfo.cs
Source/Eto.Serialization.Xaml/Properties/AssemblyInfo.cs
using System.Reflection; using System.Windows.Markup; [assembly: AssemblyTitle("Eto.Forms Xaml serializer")] [assembly: AssemblyDescription("Eto.Forms Xaml serializer")] [assembly: XmlnsDefinition(Eto.Serialization.Xaml.EtoXamlSchemaContext.EtoFormsNamespace, "Eto.Forms", AssemblyName="Eto")] [assembly: XmlnsDefinition(Eto.Serialization.Xaml.EtoXamlSchemaContext.EtoFormsNamespace, "Eto.Xaml.Extensions")] [assembly: XmlnsPrefix(Eto.Serialization.Xaml.EtoXamlSchemaContext.EtoFormsNamespace, "eto")]
using System.Reflection; [assembly: AssemblyTitle("Eto.Forms Xaml serializer")] [assembly: AssemblyDescription("Eto.Forms Xaml serializer")]
bsd-3-clause
C#
33af9b5ef6a556349cbee000d1898351445460c6
Fix TeamCity integration build
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
resharper/resharper-unity/test/src/Cg/ProjectModel/CgProjectFileTypeTests.cs
resharper/resharper-unity/test/src/Cg/ProjectModel/CgProjectFileTypeTests.cs
using JetBrains.ProjectModel; using JetBrains.ReSharper.Plugins.Unity.Cg.ProjectModel; using JetBrains.ReSharper.Plugins.Unity.ProjectModel; using JetBrains.ReSharper.Resources.Shell; using NUnit.Framework; namespace JetBrains.ReSharper.Plugins.Unity.Tests.Cg.ProjectModel { [TestFixture] public class CgProjectFileTypeTests { [Test] public void ProjectFileTypeIsRegistered() { Assert.NotNull(CgProjectFileType.Instance); var projectFileTypes = Shell.Instance.GetComponent<IProjectFileTypes>(); Assert.NotNull(projectFileTypes.GetFileType(CgProjectFileType.Name)); } [TestCase(CgProjectFileType.CG_EXTENSION)] [TestCase(CgProjectFileType.COMPUTE_EXTENSION)] [TestCase(CgProjectFileType.HLSL_EXTENSION)] [TestCase(CgProjectFileType.GLSL_EXTENSION)] // [TestCase(CgProjectFileType.HLSLINC_EXTENSION)] // Clashes with C++ plugin when run in TeamCity [TestCase(CgProjectFileType.GLSLINC_EXTENSION)] public void ProjectFileTypeFromExtensionCginc(string extension) { var projectFileExtensions = Shell.Instance.GetComponent<IProjectFileExtensions>(); Assert.AreSame(CgProjectFileType.Instance, projectFileExtensions.GetFileType(extension)); } } }
using JetBrains.ProjectModel; using JetBrains.ReSharper.Plugins.Unity.Cg.ProjectModel; using JetBrains.ReSharper.Plugins.Unity.ProjectModel; using JetBrains.ReSharper.Resources.Shell; using NUnit.Framework; namespace JetBrains.ReSharper.Plugins.Unity.Tests.Cg.ProjectModel { [TestFixture] public class CgProjectFileTypeTests { [Test] public void ProjectFileTypeIsRegistered() { Assert.NotNull(CgProjectFileType.Instance); var projectFileTypes = Shell.Instance.GetComponent<IProjectFileTypes>(); Assert.NotNull(projectFileTypes.GetFileType(CgProjectFileType.Name)); } [TestCase(CgProjectFileType.CG_EXTENSION)] [TestCase(CgProjectFileType.COMPUTE_EXTENSION)] [TestCase(CgProjectFileType.HLSL_EXTENSION)] [TestCase(CgProjectFileType.GLSL_EXTENSION)] [TestCase(CgProjectFileType.HLSLINC_EXTENSION)] [TestCase(CgProjectFileType.GLSLINC_EXTENSION)] public void ProjectFileTypeFromExtensionCginc(string extension) { var projectFileExtensions = Shell.Instance.GetComponent<IProjectFileExtensions>(); Assert.AreSame(CgProjectFileType.Instance, projectFileExtensions.GetFileType(extension)); } } }
apache-2.0
C#
09bd0b8ede3891bd75bf44d918b2d4aeb8014974
Make amplitude processor public again
ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework
osu.Framework/Audio/BassAmplitudeProcessor.cs
osu.Framework/Audio/BassAmplitudeProcessor.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using ManagedBass; using osu.Framework.Audio.Mixing.Bass; using osu.Framework.Audio.Track; namespace osu.Framework.Audio { /// <summary> /// Computes and caches amplitudes for a bass channel. /// </summary> public class BassAmplitudeProcessor { /// <summary> /// The most recent amplitude data. Note that this is updated on an ongoing basis and there is no guarantee it is in a consistent (single sample) state. /// If you need consistent data, make a copy of FrequencyAmplitudes while on the audio thread. /// </summary> public ChannelAmplitudes CurrentAmplitudes { get; private set; } = ChannelAmplitudes.Empty; private readonly IBassAudioChannel channel; public BassAmplitudeProcessor(IBassAudioChannel channel) { this.channel = channel; } private float[]? frequencyData; public void Update() { if (channel.Handle == 0) return; bool active = channel.Interface.ChannelIsActive(channel) == PlaybackState.Playing; float[] channelLevels = new float[2]; channel.Interface.ChannelGetLevel(channel, channelLevels, 1 / 60f, LevelRetrievalFlags.Stereo); var leftChannel = active ? channelLevels[0] : -1; var rightChannel = active ? channelLevels[1] : -1; if (leftChannel >= 0 && rightChannel >= 0) { frequencyData ??= new float[ChannelAmplitudes.AMPLITUDES_SIZE]; channel.Interface.ChannelGetData(channel, frequencyData, (int)DataFlags.FFT512); CurrentAmplitudes = new ChannelAmplitudes(leftChannel, rightChannel, frequencyData); } else CurrentAmplitudes = ChannelAmplitudes.Empty; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using ManagedBass; using osu.Framework.Audio.Mixing.Bass; using osu.Framework.Audio.Track; namespace osu.Framework.Audio { /// <summary> /// Computes and caches amplitudes for a bass channel. /// </summary> internal class BassAmplitudeProcessor { /// <summary> /// The most recent amplitude data. Note that this is updated on an ongoing basis and there is no guarantee it is in a consistent (single sample) state. /// If you need consistent data, make a copy of FrequencyAmplitudes while on the audio thread. /// </summary> public ChannelAmplitudes CurrentAmplitudes { get; private set; } = ChannelAmplitudes.Empty; private readonly IBassAudioChannel channel; public BassAmplitudeProcessor(IBassAudioChannel channel) { this.channel = channel; } private float[]? frequencyData; public void Update() { if (channel.Handle == 0) return; bool active = channel.Interface.ChannelIsActive(channel) == PlaybackState.Playing; float[] channelLevels = new float[2]; channel.Interface.ChannelGetLevel(channel, channelLevels, 1 / 60f, LevelRetrievalFlags.Stereo); var leftChannel = active ? channelLevels[0] : -1; var rightChannel = active ? channelLevels[1] : -1; if (leftChannel >= 0 && rightChannel >= 0) { frequencyData ??= new float[ChannelAmplitudes.AMPLITUDES_SIZE]; channel.Interface.ChannelGetData(channel, frequencyData, (int)DataFlags.FFT512); CurrentAmplitudes = new ChannelAmplitudes(leftChannel, rightChannel, frequencyData); } else CurrentAmplitudes = ChannelAmplitudes.Empty; } } }
mit
C#
ba4a8474b75a0cf155bf695ad10c4e3e235d57c3
Remove excess licence header
smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework
osu.Framework/Graphics/UserInterface/Caret.cs
osu.Framework/Graphics/UserInterface/Caret.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.Containers; using osuTK; namespace osu.Framework.Graphics.UserInterface { /// <summary> /// A UI component generally used to show the current cursor location in a text edit field. /// </summary> public abstract class Caret : CompositeDrawable { /// <summary> /// Request the caret be displayed at a particular location, with an optional selection length. /// </summary> /// <param name="position">The position (in parent space) where the caret should be displayed.</param> /// <param name="selectionWidth">If a selection is active, the length (in parent space) of the selection. The caret should extend to display this selection to the user.</param> public abstract void DisplayAt(Vector2 position, float? selectionWidth); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.Containers; using osuTK; namespace osu.Framework.Graphics.UserInterface { /// <summary> /// A UI component generally used to show the current cursor location in a text edit field. /// </summary> public abstract class Caret : CompositeDrawable { /// <summary> /// Request the caret be displayed at a particular location, with an optional selection length. /// </summary> /// <param name="position">The position (in parent space) where the caret should be displayed.</param> /// <param name="selectionWidth">If a selection is active, the length (in parent space) of the selection. The caret should extend to display this selection to the user.</param> public abstract void DisplayAt(Vector2 position, float? selectionWidth); } }
mit
C#
cf192c84a8d528f23c949aa70210e1c300fa53e2
make catcher field readonly
smoogipooo/osu,NeoAdonis/osu,johnneijzen/osu,peppy/osu-new,EVAST9919/osu,smoogipoo/osu,ppy/osu,2yangk23/osu,NeoAdonis/osu,johnneijzen/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,2yangk23/osu,EVAST9919/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu
osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs
osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using osuTK; using System; namespace osu.Game.Rulesets.Catch.Mods { public class CatchModRelax : ModRelax, IApplicableToDrawableRuleset<CatchHitObject> { public override string Description => @"Use the mouse to control the catcher."; public void ApplyToDrawableRuleset(DrawableRuleset<CatchHitObject> drawableRuleset) => (drawableRuleset.Playfield.Parent as Container).Add(new CatchModRelaxHelper(drawableRuleset.Playfield as CatchPlayfield)); private class CatchModRelaxHelper : Drawable, IKeyBindingHandler<CatchAction>, IRequireHighFrequencyMousePosition { private readonly CatcherArea.Catcher catcher; public CatchModRelaxHelper(CatchPlayfield catchPlayfield) { catcher = catchPlayfield.CatcherArea.MovableCatcher; RelativeSizeAxes = Axes.Both; } //disable keyboard controls public bool OnPressed(CatchAction action) => true; public bool OnReleased(CatchAction action) => true; protected override bool OnMouseMove(MouseMoveEvent e) { //lock catcher to mouse position horizontally catcher.X = e.MousePosition.X / DrawSize.X; //make Yuzu face the direction he's moving var direction = Math.Sign(e.Delta.X); if (direction != 0) catcher.Scale = new Vector2(Math.Abs(catcher.Scale.X) * direction, catcher.Scale.Y); return base.OnMouseMove(e); } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using osuTK; using System; namespace osu.Game.Rulesets.Catch.Mods { public class CatchModRelax : ModRelax, IApplicableToDrawableRuleset<CatchHitObject> { public override string Description => @"Use the mouse to control the catcher."; public void ApplyToDrawableRuleset(DrawableRuleset<CatchHitObject> drawableRuleset) => (drawableRuleset.Playfield.Parent as Container).Add(new CatchModRelaxHelper(drawableRuleset.Playfield as CatchPlayfield)); private class CatchModRelaxHelper : Drawable, IKeyBindingHandler<CatchAction>, IRequireHighFrequencyMousePosition { private CatcherArea.Catcher catcher; public CatchModRelaxHelper(CatchPlayfield catchPlayfield) { catcher = catchPlayfield.CatcherArea.MovableCatcher; RelativeSizeAxes = Axes.Both; } //disable keyboard controls public bool OnPressed(CatchAction action) => true; public bool OnReleased(CatchAction action) => true; protected override bool OnMouseMove(MouseMoveEvent e) { //lock catcher to mouse position horizontally catcher.X = e.MousePosition.X / DrawSize.X; //make Yuzu face the direction he's moving var direction = Math.Sign(e.Delta.X); if (direction != 0) catcher.Scale = new Vector2(Math.Abs(catcher.Scale.X) * direction, catcher.Scale.Y); return base.OnMouseMove(e); } } } }
mit
C#
a1798fd38d29e8cc25a0919025b78bd4e1f24e39
Fix bad ctor implementation
ppy/osu,NeoAdonis/osu,johnneijzen/osu,2yangk23/osu,peppy/osu,ppy/osu,peppy/osu,smoogipooo/osu,2yangk23/osu,EVAST9919/osu,ppy/osu,UselessToucan/osu,peppy/osu-new,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,johnneijzen/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,EVAST9919/osu,UselessToucan/osu
osu.Game/Rulesets/Objects/PathControlPoint.cs
osu.Game/Rulesets/Objects/PathControlPoint.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Types; using osuTK; namespace osu.Game.Rulesets.Objects { public class PathControlPoint : IEquatable<PathControlPoint> { /// <summary> /// The position of this <see cref="PathControlPoint"/>. /// </summary> public readonly Bindable<Vector2> Position = new Bindable<Vector2>(); /// <summary> /// The type of path segment starting at this <see cref="PathControlPoint"/>. /// If null, this <see cref="PathControlPoint"/> will be a part of the previous path segment. /// </summary> public readonly Bindable<PathType?> Type = new Bindable<PathType?>(); /// <summary> /// Invoked when any property of this <see cref="PathControlPoint"/> is changed. /// </summary> internal event Action Changed; /// <summary> /// Creates a new <see cref="PathControlPoint"/>. /// </summary> public PathControlPoint() : this(Vector2.Zero, null) { } /// <summary> /// Creates a new <see cref="PathControlPoint"/> with a provided position and type. /// </summary> /// <param name="position">The initial position.</param> /// <param name="type">The initial type.</param> public PathControlPoint(Vector2 position, PathType? type = null) { Position.Value = position; Type.Value = type; Position.ValueChanged += _ => Changed?.Invoke(); Type.ValueChanged += _ => Changed?.Invoke(); } public bool Equals(PathControlPoint other) => Position.Value == other?.Position.Value && Type.Value == other.Type.Value; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Types; using osuTK; namespace osu.Game.Rulesets.Objects { public class PathControlPoint : IEquatable<PathControlPoint> { /// <summary> /// The position of this <see cref="PathControlPoint"/>. /// </summary> public readonly Bindable<Vector2> Position = new Bindable<Vector2>(); /// <summary> /// The type of path segment starting at this <see cref="PathControlPoint"/>. /// If null, this <see cref="PathControlPoint"/> will be a part of the previous path segment. /// </summary> public readonly Bindable<PathType?> Type = new Bindable<PathType?>(); /// <summary> /// Invoked when any property of this <see cref="PathControlPoint"/> is changed. /// </summary> internal event Action Changed; /// <summary> /// Creates a new <see cref="PathControlPoint"/>. /// </summary> public PathControlPoint() : this(Vector2.Zero, null) { } /// <summary> /// Creates a new <see cref="PathControlPoint"/> with a provided position and type. /// </summary> /// <param name="position">The initial position.</param> /// <param name="type">The initial type.</param> public PathControlPoint(Vector2 position, PathType? type = null) { Position.ValueChanged += _ => Changed?.Invoke(); Type.ValueChanged += _ => Changed?.Invoke(); } public bool Equals(PathControlPoint other) => Position.Value == other?.Position.Value && Type.Value == other.Type.Value; } }
mit
C#
482f04940c1325bb9bb6815c3433be6e0ed25f70
optimize HasComponent function
pokettomonstaa/NewBark,pokettomonstaa/NewBark
Assets/Scripts/Extensions/GameObjectExtension.cs
Assets/Scripts/Extensions/GameObjectExtension.cs
using UnityEngine; public static class GameObjectExtension { public static bool HasComponent<T>(this GameObject obj) where T : Component { return obj.TryGetComponent(typeof(T), out _); } }
using UnityEngine; public static class GameObjectExtension { public static bool HasComponent<T>(this GameObject obj) where T : Component { return obj.GetComponent<T>() != null; } }
mit
C#
146ea97487f1cb0b81f7cad65fe9c9caffcfc716
fix input text sort
n0nick/pewpew
PewPew/Game/Target.cs
PewPew/Game/Target.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PewPew.Game { public class TargetType { public string inputText; public System.Windows.Media.SolidColorBrush color; public string fileName; } class Target { public enum TargetName { Action1, Action2, Action3, Action4 }; public static Dictionary<TargetName, TargetType> EnemyTypes = new Dictionary<TargetName, TargetType>() { { TargetName.Action1, new TargetType { inputText = "ice,water,wind", color = System.Windows.Media.Brushes.ForestGreen, fileName = "comb1.png" } }, { TargetName.Action2, new TargetType { inputText = "fire,magic,stone", color = System.Windows.Media.Brushes.Yellow, fileName = "comb2.png" } }, { TargetName.Action3, new TargetType { inputText = "ice,magic,wind", color = System.Windows.Media.Brushes.Purple, fileName = "comb3.png" } }, { TargetName.Action4, new TargetType { inputText = "fire,ice,wind", color = System.Windows.Media.Brushes.Teal, fileName = "comb4.png" } } }; public static TargetType EnemyTypeByInputText(String inputText) { return EnemyTypes.FirstOrDefault(type => type.Value.inputText == inputText).Value; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PewPew.Game { public class TargetType { public string inputText; public System.Windows.Media.SolidColorBrush color; public string fileName; } class Target { public enum TargetName { Action1, Action2, Action3, Action4 }; public static Dictionary<TargetName, TargetType> EnemyTypes = new Dictionary<TargetName, TargetType>() { { TargetName.Action1, new TargetType { inputText = "ice,water,wind", color = System.Windows.Media.Brushes.ForestGreen, fileName = "comb1.png" } }, { TargetName.Action2, new TargetType { inputText = "fire,magic,stone", color = System.Windows.Media.Brushes.Yellow, fileName = "comb2.png" } }, { TargetName.Action3, new TargetType { inputText = "ice,magic,wind", color = System.Windows.Media.Brushes.Purple, fileName = "comb3.png" } }, { TargetName.Action4, new TargetType { inputText = "ice,fire,wind", color = System.Windows.Media.Brushes.Teal, fileName = "comb4.png" } } }; public static TargetType EnemyTypeByInputText(String inputText) { return EnemyTypes.FirstOrDefault(type => type.Value.inputText == inputText).Value; } } }
mit
C#
c19035fccc746e50cbcfc36fbb7d88ed799a9975
Use TimeSpan instead of an int for the countdown time
space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14
Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs
Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs
using System; using System.Threading; using Content.Server.Interfaces.GameTicking; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; using Timer = Robust.Shared.Timers.Timer; namespace Content.Server.GameObjects.EntitySystems { public class RoundEndSystem : EntitySystem { #pragma warning disable 649 [Dependency] private IGameTicker _gameTicker; [Dependency] private IGameTiming _gameTiming; #pragma warning restore 649 private CancellationTokenSource _roundEndCancellationTokenSource = new CancellationTokenSource(); public bool IsRoundEndCountdownStarted { get; private set; } public TimeSpan RoundEndCountdownTime { get; set; } = TimeSpan.FromMinutes(4); public TimeSpan? ExpectedCountdownEnd = null; public delegate void RoundEndCountdownStarted(); public event RoundEndCountdownStarted OnRoundEndCountdownStarted; public delegate void RoundEndCountdownCancelled(); public event RoundEndCountdownCancelled OnRoundEndCountdownCancelled; public delegate void RoundEndCountdownFinished(); public event RoundEndCountdownFinished OnRoundEndCountdownFinished; public void RequestRoundEnd() { if (IsRoundEndCountdownStarted) return; IsRoundEndCountdownStarted = true; ExpectedCountdownEnd = _gameTiming.CurTime + RoundEndCountdownTime; Timer.Spawn(RoundEndCountdownTime, EndRound, _roundEndCancellationTokenSource.Token); OnRoundEndCountdownStarted?.Invoke(); } public void CancelRoundEndCountdown() { if (!IsRoundEndCountdownStarted) return; IsRoundEndCountdownStarted = false; _roundEndCancellationTokenSource.Cancel(); _roundEndCancellationTokenSource = new CancellationTokenSource(); ExpectedCountdownEnd = null; OnRoundEndCountdownCancelled?.Invoke(); } private void EndRound() { OnRoundEndCountdownFinished?.Invoke(); _gameTicker.EndRound(); } } }
using System; using System.Threading; using Content.Server.Interfaces.GameTicking; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; using Timer = Robust.Shared.Timers.Timer; namespace Content.Server.GameObjects.EntitySystems { public class RoundEndSystem : EntitySystem { #pragma warning disable 649 [Dependency] private IGameTicker _gameTicker; [Dependency] private IGameTiming _gameTiming; #pragma warning restore 649 private CancellationTokenSource _roundEndCancellationTokenSource = new CancellationTokenSource(); public bool IsRoundEndCountdownStarted { get; private set; } public int RoundEndCountdownTime { get; set; } = 240000; public TimeSpan? ExpectedCountdownEnd = null; public delegate void RoundEndCountdownStarted(); public event RoundEndCountdownStarted OnRoundEndCountdownStarted; public delegate void RoundEndCountdownCancelled(); public event RoundEndCountdownCancelled OnRoundEndCountdownCancelled; public delegate void RoundEndCountdownFinished(); public event RoundEndCountdownFinished OnRoundEndCountdownFinished; public void RequestRoundEnd() { if (IsRoundEndCountdownStarted) return; IsRoundEndCountdownStarted = true; ExpectedCountdownEnd = _gameTiming.CurTime + TimeSpan.FromMilliseconds(RoundEndCountdownTime); Timer.Spawn(RoundEndCountdownTime, EndRound, _roundEndCancellationTokenSource.Token); OnRoundEndCountdownStarted?.Invoke(); } public void CancelRoundEndCountdown() { if (!IsRoundEndCountdownStarted) return; IsRoundEndCountdownStarted = false; _roundEndCancellationTokenSource.Cancel(); _roundEndCancellationTokenSource = new CancellationTokenSource(); ExpectedCountdownEnd = null; OnRoundEndCountdownCancelled?.Invoke(); } private void EndRound() { OnRoundEndCountdownFinished?.Invoke(); _gameTicker.EndRound(); } } }
mit
C#
23730ebaa1c43fa8fa0cfbbffaf28da24c809e57
Revert scratch
cyotek/Cyotek.Windows.Forms.ColorPicker
Cyotek.Windows.Forms.ColorPicker.Demo/Program.cs
Cyotek.Windows.Forms.ColorPicker.Demo/Program.cs
using System; using System.Windows.Forms; namespace Cyotek.Windows.Forms.ColorPicker.Demo { // Cyotek Color Picker controls library // Copyright © 2013-2015 Cyotek Ltd. // http://cyotek.com/blog/tag/colorpicker // Licensed under the MIT License. See license.txt for the full text. // If you use this code in your applications, donations or attribution are welcome internal static class Program { #region Static Methods /// <summary> /// The main entry point for the application. /// </summary> [STAThread] private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } #endregion } }
using System; using System.Windows.Forms; namespace Cyotek.Windows.Forms.ColorPicker.Demo { // Cyotek Color Picker controls library // Copyright © 2013-2015 Cyotek Ltd. // http://cyotek.com/blog/tag/colorpicker // Licensed under the MIT License. See license.txt for the full text. // If you use this code in your applications, donations or attribution are welcome internal static class Program { #region Static Methods /// <summary> /// The main entry point for the application. /// </summary> [STAThread] private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new ScratchForm()); } #endregion } }
mit
C#
d82cd631010a97dd32628f4093154f3ed62110c4
remove dead code
woopsa-protocol/Woopsa,woopsa-protocol/Woopsa,woopsa-protocol/Woopsa,fabien-chevalley/Woopsa,fabien-chevalley/Woopsa,fabien-chevalley/Woopsa,woopsa-protocol/Woopsa,woopsa-protocol/Woopsa,fabien-chevalley/Woopsa,woopsa-protocol/Woopsa,fabien-chevalley/Woopsa,fabien-chevalley/Woopsa
Sources/DotNet/Woopsa/Utils/JsonSerializer.cs
Sources/DotNet/Woopsa/Utils/JsonSerializer.cs
using System; using System.Collections.Generic; using System.Text; using System.IO; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Runtime.Serialization.Json; namespace Woopsa { public static class JsonSerializer { public static string Serialize(object obj) { return JsonConvert.SerializeObject(obj); } public static Dictionary<string, object> ToDictionnary(object obj) { var jobect = obj as JObject; if (jobect != null) return jobect.ToObject<Dictionary<string, object>>(); return null; } public static object[] ToArray(object obj) { var jarray = obj as JArray; if (jarray != null) return jarray.ToObject<object[]>(); return null; } public static T Deserialize<T>(string json) { return JsonConvert.DeserializeObject<T>(json); } } }
using System; using System.Collections.Generic; using System.Text; using System.IO; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Runtime.Serialization.Json; namespace Woopsa { public static class JsonSerializer { public static string Serialize(object obj) { return JsonConvert.SerializeObject(obj); } public static Dictionary<string, object> ToDictionnary(object obj) { var jobect = obj as JObject; if (jobect != null) return jobect.ToObject<Dictionary<string, object>>(); return null; } public static object[] ToArray(object obj) { var jarray = obj as JArray; if (jarray != null) return jarray.ToObject<object[]>(); return null; } //public object Deserialize(string json) //{ // var dictionnary = JsonConvert.DeserializeObject<Dictionary<string, object>>(json); // if (dictionnary != null) // return dictionnary; // var array = JsonConvert.DeserializeObject<object[]>(json); // if (array != null) // return array; // return JsonConvert.DeserializeObject(json); //} public static T Deserialize<T>(string json) { return JsonConvert.DeserializeObject<T>(json); } //public string Serialize(object obj) //{ // var serializer = new DataContractJsonSerializer(obj.GetType()); // string json; // using (var stream = new MemoryStream()) // { // serializer.WriteObject(stream, obj); // json = Encoding.UTF8.GetString(stream.ToArray()); // } // return json; //} //public T Deserialize<T>(string json) //{ // object obj; // using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(json))) // { // DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(T)); // obj = serializer.ReadObject(stream); // } // return (T)obj; //} //public object Deserialize(string json) //{ // object obj; // using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(json))) // { // DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Dictionary<string, object>)); // obj = serializer.ReadObject(stream); // } // return obj; //} } }
mit
C#
1ff4fbed696075435582a51264762dfe1466a944
Update Demo
sunkaixuan/SqlSugar
Src/Asp.Net/SqlServerTest/Demo/Demo6_Queue.cs
Src/Asp.Net/SqlServerTest/Demo/Demo6_Queue.cs
using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OrmTest { public class Demo6_Queue { public static void Init() { Console.WriteLine(""); Console.WriteLine("#### Queue Start ####"); SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { DbType = DbType.SqlServer, ConnectionString = Config.ConnectionString, InitKeyType = InitKeyType.Attribute, IsAutoCloseConnection = true, AopEvents = new AopEvents { OnLogExecuting = (sql, p) => { Console.WriteLine(sql); Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value))); } } }); db.Insertable<Order>(new Order() { Name = "a" }).AddQueue(); db.Insertable<Order>(new Order() { Name = "b" }).AddQueue(); db.SaveQueues(); db.Insertable<Order>(new Order() { Name = "a" }).AddQueue(); db.Insertable<Order>(new Order() { Name = "b" }).AddQueue(); db.Insertable<Order>(new Order() { Name = "c" }).AddQueue(); db.Insertable<Order>(new Order() { Name = "d" }).AddQueue(); var ar = db.SaveQueuesAsync(); ar.Wait(); db.Queryable<Order>().AddQueue(); db.Queryable<Order>().AddQueue(); db.AddQueue("select * from [Order] where id=@id", new { id = 10000 }); var result2 = db.SaveQueues<Order, Order, Order>(); Console.WriteLine("#### Queue End ####"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OrmTest { public class Demo6_Queue { public static void Init() { } } }
apache-2.0
C#
37044fa8f62d80c60c586ac568acc455929f492c
Update SiteVar.cs
LANDIS-II-Foundation/Landis-Spatial-Modeling-Library
src/Landscapes/SiteVar.cs
src/Landscapes/SiteVar.cs
// Copyright 2004-2006 University of Wisconsin // All rights reserved. // // Contributors: // James Domingo, UW-Madison, Forest Landscape Ecology Lab using Landis.SpatialModeling; using System.Diagnostics; namespace Landis.Landscapes { public abstract class SiteVar<T> { private ILandscape landscape; //--------------------------------------------------------------------- public System.Type DataType { get { return typeof(T); } } //--------------------------------------------------------------------- public ILandscape Landscape { get { return landscape; } } //--------------------------------------------------------------------- protected SiteVar(ILandscape landscape) { this.landscape = landscape; } //--------------------------------------------------------------------- /// <summary> /// Validates that a site refers to the same landscape as the site /// variable was created for. /// </summary> protected void Validate(Site site) { Trace.Assert(site.Landscape == landscape); } } }
// Copyright 2004-2006 University of Wisconsin // All rights reserved. // // The copyright holders license this file under the New (3-clause) BSD // License (the "License"). You may not use this file except in // compliance with the License. A copy of the License is available at // // http://www.opensource.org/licenses/BSD-3-Clause // // and is included in the NOTICE.txt file distributed with this work. // // Contributors: // James Domingo, UW-Madison, Forest Landscape Ecology Lab using Landis.SpatialModeling; using System.Diagnostics; namespace Landis.Landscapes { public abstract class SiteVar<T> { private ILandscape landscape; //--------------------------------------------------------------------- public System.Type DataType { get { return typeof(T); } } //--------------------------------------------------------------------- public ILandscape Landscape { get { return landscape; } } //--------------------------------------------------------------------- protected SiteVar(ILandscape landscape) { this.landscape = landscape; } //--------------------------------------------------------------------- /// <summary> /// Validates that a site refers to the same landscape as the site /// variable was created for. /// </summary> protected void Validate(Site site) { Trace.Assert(site.Landscape == landscape); } } }
apache-2.0
C#
63e00b40f27e044126eb5acc53e887b25dd633d8
Make LogEventFormatter public
vostok/core
Vostok.Core/Logging/Logs/LogEventFormatter.cs
Vostok.Core/Logging/Logs/LogEventFormatter.cs
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text.RegularExpressions; namespace Vostok.Logging.Logs { public static class LogEventFormatter { private static readonly Regex Pattern = new Regex(@"(?<!{){@?(?<arg>[^ :{}]+)(?<format>:[^}]+)?}", RegexOptions.Compiled); public static string Format(LogEvent logEvent) { var message = FormatMessage(logEvent.MessageTemplate, logEvent.MessageParameters); var parameters = FormatProperties(logEvent.Properties); return $"{DateTime.Now:HH:mm:ss.fff} {logEvent.Level} {message} {logEvent.Exception}{Environment.NewLine}{parameters}{Environment.NewLine}"; } public static string FormatMessage(string template, object[] parameters) { if (parameters.Length == 0) return template; var processedArguments = new List<string>(); foreach (Match match in Pattern.Matches(template)) { var arg = match.Groups["arg"].Value; if (!int.TryParse(arg, out _)) { var argumentIndex = processedArguments.IndexOf(arg); if (argumentIndex == -1) { argumentIndex = processedArguments.Count; processedArguments.Add(arg); } template = ReplaceFirst(template, match.Value, "{" + argumentIndex + match.Groups["format"].Value + "}"); } } return string.Format(CultureInfo.InvariantCulture, template, parameters); } public static string FormatProperties(IReadOnlyDictionary<string, object> properties) { return "{" + string.Join(", ", properties.Select(x => $"{x.Key}: {x.Value}")) + "}"; } private static string ReplaceFirst(string text, string search, string replace) { var position = text.IndexOf(search, StringComparison.Ordinal); if (position < 0) return text; return text.Substring(0, position) + replace + text.Substring(position + search.Length); } } }
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text.RegularExpressions; namespace Vostok.Logging.Logs { internal static class LogEventFormatter { private static readonly Regex Pattern = new Regex(@"(?<!{){@?(?<arg>[^ :{}]+)(?<format>:[^}]+)?}", RegexOptions.Compiled); public static string Format(LogEvent logEvent) { var message = FormatMessage(logEvent.MessageTemplate, logEvent.MessageParameters); var parameters = FormatProperties(logEvent.Properties); return $"{DateTime.Now:HH:mm:ss.fff} {logEvent.Level} {message} {logEvent.Exception}{Environment.NewLine}{parameters}{Environment.NewLine}"; } internal static string FormatMessage(string template, object[] parameters) { if (parameters.Length == 0) return template; var processedArguments = new List<string>(); foreach (Match match in Pattern.Matches(template)) { var arg = match.Groups["arg"].Value; if (!int.TryParse(arg, out _)) { var argumentIndex = processedArguments.IndexOf(arg); if (argumentIndex == -1) { argumentIndex = processedArguments.Count; processedArguments.Add(arg); } template = ReplaceFirst(template, match.Value, "{" + argumentIndex + match.Groups["format"].Value + "}"); } } return string.Format(CultureInfo.InvariantCulture, template, parameters); } internal static string FormatProperties(IReadOnlyDictionary<string, object> properties) { return "{" + string.Join(", ", properties.Select(x => $"{x.Key}: {x.Value}")) + "}"; } private static string ReplaceFirst(string text, string search, string replace) { var position = text.IndexOf(search, StringComparison.Ordinal); if (position < 0) return text; return text.Substring(0, position) + replace + text.Substring(position + search.Length); } } }
mit
C#
8794c473a6527f0eafa789a6c922c5325f02b2fc
Update InventoryComponent.cs
williambl/Haunt
Haunt/Assets/Scripts/Items/InventoryComponent.cs
Haunt/Assets/Scripts/Items/InventoryComponent.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class InventoryComponent : MonoBehaviour { [Header("Properties"] public Item holdingitem; }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class InventoryComponent : MonoBehaviour { [Header("Properties:"] public Item holdingitem; }
mit
C#