commit
stringlengths
40
40
old_file
stringlengths
4
237
new_file
stringlengths
4
237
old_contents
stringlengths
1
4.24k
new_contents
stringlengths
1
4.87k
subject
stringlengths
15
778
message
stringlengths
15
8.75k
lang
stringclasses
266 values
license
stringclasses
13 values
repos
stringlengths
5
127k
e70c3be7b963085d661ae4d4dd0a0bbf4f19f355
Assets/Resources/Scripts/game/view/StatusText.cs
Assets/Resources/Scripts/game/view/StatusText.cs
using UnityEngine; using UnityEngine.UI; /// <summary> /// Attach this to the status text game object /// </summary> public class StatusText : MonoBehaviour { Text text; GlobalGame game; public GlobalGame Game { get { return game; } set { if (game != null) { game.WinnerChanged -= HandleGameStateChanged; game.TurnChanged -= HandleGameStateChanged; } game = value; game.WinnerChanged += HandleGameStateChanged; game.TurnChanged += HandleGameStateChanged; } } private void Start() { text = GetComponent<Text>(); if (game != null) { HandleGameStateChanged(null, null); } } public void HandleGameStateChanged(object o, GameEventArgs e) { if (game.GameOver()) { if (game.Winner != null) { text.text = game.Winner.Name + " wins!"; return; } text.text = "Tie game"; return; } text.text = game.ActivePlayer().Name + "'s turn"; } }
using UnityEngine; using UnityEngine.UI; /// <summary> /// Attach this to the status text game object /// </summary> public class StatusText : MonoBehaviour { Text text; GlobalGame game; public GlobalGame Game { get { return game; } set { if (game != null) { game.WinnerChanged -= HandleGameStateChanged; game.TurnChanged -= HandleGameStateChanged; } game = value; if (game != null) { game.WinnerChanged += HandleGameStateChanged; game.TurnChanged += HandleGameStateChanged; } UpdateState(); } } void UpdateState() { HandleGameStateChanged(game, null); } private void Start() { text = GetComponent<Text>(); UpdateState(); } public void HandleGameStateChanged(object o, GameEventArgs e) { if (game == null) { text.text = ""; return; } if (game.GameOver()) { if (game.Winner != null) { text.text = game.Winner.Name + " wins!"; return; } text.text = "Tie game"; return; } text.text = game.ActivePlayer().Name + "'s turn"; } }
Fix status text not updating upon reset
Fix status text not updating upon reset
C#
mit
Curdflappers/UltimateTicTacToe
7157f43938b6787ae9d63bf79f904d8e36da7b9c
Assets/Resources/Scripts/game/view/StatusText.cs
Assets/Resources/Scripts/game/view/StatusText.cs
using UnityEngine; using UnityEngine.UI; /// <summary> /// Attach this to the status text game object /// </summary> public class StatusText : MonoBehaviour { Text text; GlobalGame game; public GlobalGame Game { get { return game; } set { if (game != null) { game.WinnerChanged -= HandleGameStateChanged; game.TurnChanged -= HandleGameStateChanged; } game = value; if (game != null) { game.WinnerChanged += HandleGameStateChanged; game.TurnChanged += HandleGameStateChanged; } UpdateState(); } } void UpdateState() { HandleGameStateChanged(game, null); } private void Start() { text = GetComponent<Text>(); UpdateState(); } public void HandleGameStateChanged(object o, GameEventArgs e) { if (game == null) { text.text = ""; return; } if (game.GameOver()) { if (game.Winner != null) { text.text = game.Winner.Name + " wins!"; return; } text.text = "Tie game"; return; } text.text = game.ActivePlayer().Name + "'s turn"; } }
using UnityEngine; using UnityEngine.UI; /// <summary> /// Attach this to the status text game object /// </summary> public class StatusText : MonoBehaviour { GlobalGame game; public GlobalGame Game { get { return game; } set { if (game != null) { game.WinnerChanged -= HandleGameStateChanged; game.TurnChanged -= HandleGameStateChanged; } game = value; if (game != null) { game.WinnerChanged += HandleGameStateChanged; game.TurnChanged += HandleGameStateChanged; } UpdateState(); } } void UpdateState() { HandleGameStateChanged(game, null); } private void Awake() { UpdateState(); } public void HandleGameStateChanged(object o, GameEventArgs e) { Text text = GetComponent<Text>(); if (game == null) { text.text = ""; return; } if (game.GameOver()) { if (game.Winner != null) { text.text = game.Winner.Name + " wins!"; return; } text.text = "Tie game"; return; } text.text = game.ActivePlayer().Name + "'s turn"; } }
Fix null error on status text initialization
Fix null error on status text initialization
C#
mit
Curdflappers/UltimateTicTacToe
7528b4e178e7028fdd8b301d3a4cb0f2df27fbe8
CorvallisBus.Core/WebClients/ServiceAlertsClient.cs
CorvallisBus.Core/WebClients/ServiceAlertsClient.cs
using System; using System.Linq; using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using CorvallisBus.Core.Models; using HtmlAgilityPack; namespace CorvallisBus.Core.WebClients { public static class ServiceAlertsClient { static readonly Uri FEED_URL = new Uri("https://www.corvallisoregon.gov/news?field_microsite_tid=581"); static readonly HttpClient httpClient = new HttpClient(); public static async Task<List<ServiceAlert>> GetServiceAlerts() { var responseStream = await httpClient.GetStreamAsync(FEED_URL); var htmlDocument = new HtmlDocument(); htmlDocument.Load(responseStream); var alerts = htmlDocument.DocumentNode.SelectNodes("//tbody/tr") .Select(row => ParseRow(row)) .ToList(); return alerts; } private static ServiceAlert ParseRow(HtmlNode row) { var anchor = row.Descendants("a").First(); var relativeLink = anchor.Attributes["href"].Value; var link = new Uri(FEED_URL, relativeLink).ToString(); var title = anchor.InnerText; var publishDate = row.Descendants("span") .First(node => node.HasClass("date-display-single")) .Attributes["content"] .Value; return new ServiceAlert(title, publishDate, link); } } }
using System; using System.Linq; using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using CorvallisBus.Core.Models; using HtmlAgilityPack; namespace CorvallisBus.Core.WebClients { public static class ServiceAlertsClient { static readonly Uri FEED_URL = new Uri("https://www.corvallisoregon.gov/news?field_microsite_tid=581"); static readonly HttpClient httpClient = new HttpClient(); public static async Task<List<ServiceAlert>> GetServiceAlerts() { var responseStream = await httpClient.GetStreamAsync(FEED_URL); var htmlDocument = new HtmlDocument(); htmlDocument.Load(responseStream); var alerts = htmlDocument.DocumentNode.SelectNodes("//tbody/tr") .Select(row => ParseRow(row)) .ToList(); alerts.Insert(0, new ServiceAlert( title: "App Update for Upcoming CTS Schedule", publishDate: "2019-09-09T00:00:00-07:00", link: "https://rikkigibson.github.io/corvallisbus")); return alerts; } private static ServiceAlert ParseRow(HtmlNode row) { var anchor = row.Descendants("a").First(); var relativeLink = anchor.Attributes["href"].Value; var link = new Uri(FEED_URL, relativeLink).ToString(); var title = anchor.InnerText; var publishDate = row.Descendants("span") .First(node => node.HasClass("date-display-single")) .Attributes["content"] .Value; return new ServiceAlert(title, publishDate, link); } } }
Add service alert for app update notice
Add service alert for app update notice
C#
mit
RikkiGibson/Corvallis-Bus-Server,RikkiGibson/Corvallis-Bus-Server
d577e7d388d8dd40ffd63b701654eef54089d04a
DesktopWidgets/Helpers/DoubleHelper.cs
DesktopWidgets/Helpers/DoubleHelper.cs
using System; using DesktopWidgets.Properties; namespace DesktopWidgets.Helpers { public static class DoubleHelper { public static bool IsEqual(this double val1, double val2) => double.IsNaN(val1) || double.IsNaN(val1) || (Math.Abs(val1 - val2) > Settings.Default.DoubleComparisonTolerance); } }
using System; using DesktopWidgets.Properties; namespace DesktopWidgets.Helpers { public static class DoubleHelper { public static bool IsEqual(this double val1, double val2) => double.IsNaN(val1) || double.IsNaN(val2) || (Math.Abs(val1 - val2) > Settings.Default.DoubleComparisonTolerance); } }
Fix NaN floating point comparison
Fix NaN floating point comparison
C#
apache-2.0
danielchalmers/DesktopWidgets
18f8d5b2690186c73caace681b32011917a75f5b
Core/Other/Analytics/AnalyticsReport.cs
Core/Other/Analytics/AnalyticsReport.cs
using System.Collections; using System.Collections.Specialized; using System.Text; namespace TweetDuck.Core.Other.Analytics{ sealed class AnalyticsReport : IEnumerable{ private OrderedDictionary data = new OrderedDictionary(32); private int separators; public void Add(int ignored){ // adding separators to pretty print data.Add((++separators).ToString(), null); } public void Add(string key, string value){ data.Add(key, value); } public AnalyticsReport FinalizeReport(){ if (!data.IsReadOnly){ data = data.AsReadOnly(); } return this; } public IEnumerator GetEnumerator(){ return data.GetEnumerator(); } public NameValueCollection ToNameValueCollection(){ NameValueCollection collection = new NameValueCollection(); foreach(DictionaryEntry entry in data){ if (entry.Value != null){ collection.Add((string)entry.Key, (string)entry.Value); } } return collection; } public override string ToString(){ StringBuilder build = new StringBuilder(); foreach(DictionaryEntry entry in data){ if (entry.Value == null){ build.AppendLine(); } else{ build.AppendLine(entry.Key+": "+entry.Value); } } return build.ToString(); } } }
using System.Collections; using System.Collections.Specialized; using System.Text; namespace TweetDuck.Core.Other.Analytics{ sealed class AnalyticsReport : IEnumerable{ private OrderedDictionary data = new OrderedDictionary(32); private int separators; public void Add(int ignored){ // adding separators to pretty print data.Add((++separators).ToString(), null); } public void Add(string key, string value){ data.Add(key, value); } public AnalyticsReport FinalizeReport(){ if (!data.IsReadOnly){ data = data.AsReadOnly(); } return this; } public IEnumerator GetEnumerator(){ return data.GetEnumerator(); } public NameValueCollection ToNameValueCollection(){ NameValueCollection collection = new NameValueCollection(); foreach(DictionaryEntry entry in data){ if (entry.Value != null){ collection.Add(((string)entry.Key).ToLower().Replace(' ', '_'), (string)entry.Value); } } return collection; } public override string ToString(){ StringBuilder build = new StringBuilder(); foreach(DictionaryEntry entry in data){ if (entry.Value == null){ build.AppendLine(); } else{ build.AppendLine(entry.Key+": "+entry.Value); } } return build.ToString(); } } }
Tweak key format in analytics request
Tweak key format in analytics request
C#
mit
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
52c8cea27dc8e0400fd125b80e262378b8a79153
osu.Game/Online/ProductionEndpointConfiguration.cs
osu.Game/Online/ProductionEndpointConfiguration.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. namespace osu.Game.Online { public class ProductionEndpointConfiguration : EndpointConfiguration { public ProductionEndpointConfiguration() { WebsiteRootUrl = APIEndpointUrl = @"https://osu.ppy.sh"; APIClientSecret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk"; APIClientID = "5"; SpectatorEndpointUrl = "https://spectator2.ppy.sh/spectator"; MultiplayerEndpointUrl = "https://spectator2.ppy.sh/multiplayer"; } } }
// 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. namespace osu.Game.Online { public class ProductionEndpointConfiguration : EndpointConfiguration { public ProductionEndpointConfiguration() { WebsiteRootUrl = APIEndpointUrl = @"https://osu.ppy.sh"; APIClientSecret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk"; APIClientID = "5"; SpectatorEndpointUrl = "https://spectator.ppy.sh/spectator"; MultiplayerEndpointUrl = "https://spectator.ppy.sh/multiplayer"; } } }
Update spectator/multiplayer endpoint in line with new deployment
Update spectator/multiplayer endpoint in line with new deployment
C#
mit
peppy/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu
09fc566e9536b98ee259f46a3af5ad0372f8777e
Joinrpg/Views/Character/Details.cshtml
Joinrpg/Views/Character/Details.cshtml
@using JoinRpg.Web.Models @model CharacterDetailsViewModel <div> @Html.Partial("CharacterNavigation", Model.Navigation) @* TODO: Жесточайше причесать эту страницу*@ <dl class="dl-horizontal"> <dt>Игрок</dt> <dd>@Html.DisplayFor(model => model, "IPlayerCharacter")</dd> <dt>@Html.DisplayNameFor(model => model.Description)</dt> <dd>@Html.DisplayFor(model => model.Description)</dd> <dt>@Html.DisplayNameFor(model => model.ParentGroups)</dt> <dd>@Html.DisplayFor(model => model.ParentGroups)</dd> </dl> <h4>Поля персонажа</h4> <div class="form-horizontal"> @Html.Partial("_EditFieldsPartial", Model.Fields) </div> @Html.Partial("_PlotForCharacterPartial", Model.Plot) </div>
@using JoinRpg.Web.Models @model CharacterDetailsViewModel <div> @Html.Partial("CharacterNavigation", Model.Navigation) @* TODO: Жесточайше причесать эту страницу*@ <dl class="dl-horizontal"> <dt>Игрок</dt> <dd>@Html.DisplayFor(model => model, "IPlayerCharacter")</dd> <dt>@Html.DisplayNameFor(model => model.Description)</dt> <dd>@Html.DisplayFor(model => model.Description)</dd> <dt>@Html.DisplayNameFor(model => model.ParentGroups)</dt> <dd>@Html.DisplayFor(model => model.ParentGroups)</dd> </dl> @if (Model.Fields.CharacterFields.Any()) { <h4>Поля персонажа</h4> <div class="form-horizontal"> @Html.Partial("_EditFieldsPartial", Model.Fields) </div> } @Html.Partial("_PlotForCharacterPartial", Model.Plot) </div>
Hide character fields header if no fields
Hide character fields header if no fields
C#
mit
leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net
b44d326439509174dcba3f0bf46376821aa0d46d
CIV/Program.cs
CIV/Program.cs
using static System.Console; using CIV.Ccs; namespace CIV { class Program { static void Main(string[] args) { var text = System.IO.File.ReadAllText(args[0]); var processes = CcsFacade.ParseAll(text); var trace = CcsFacade.RandomTrace(processes["Prison"], 450); foreach (var action in trace) { WriteLine(action); } } } }
using static System.Console; using CIV.Ccs; using CIV.Interfaces; namespace CIV { class Program { static void Main(string[] args) { var text = System.IO.File.ReadAllText(args[0]); var processes = CcsFacade.ParseAll(text); var trace = CcsFacade.RandomTrace(processes["Prison"], 450); foreach (var action in trace) { WriteLine(action); } } } }
Add CIV.Interfaces reference in Main
Add CIV.Interfaces reference in Main
C#
mit
lou1306/CIV,lou1306/CIV
8f34c75a8742a1754246f2d3383b2fcab48dddcf
ReSharperTnT/Bootstrapper.cs
ReSharperTnT/Bootstrapper.cs
using System.Web.Http; using Autofac; using Autofac.Integration.WebApi; namespace ReSharperTnT { public class Bootstrapper { static Bootstrapper() { Init(); } public static void Init() { var bootstrapper = new Bootstrapper(); var container = bootstrapper.CreateContainer(); var autofacWebApiDependencyResolver = new AutofacWebApiDependencyResolver(container); GlobalConfiguration.Configuration.DependencyResolver = autofacWebApiDependencyResolver; } private readonly IContainer _container; public Bootstrapper() { var builder = new ContainerBuilder(); builder.RegisterAssemblyTypes(typeof (Bootstrapper).Assembly) .AsImplementedInterfaces(); builder.RegisterAssemblyTypes(typeof (Bootstrapper).Assembly) .Where(c=>c.Name.EndsWith("Controller")) .AsSelf(); _container = builder.Build(); } public IContainer CreateContainer() { return _container; } public T Get<T>() { return _container.Resolve<T>(); } } }
using System.Reflection; using System.Web.Http; using Autofac; using Autofac.Integration.WebApi; namespace ReSharperTnT { public class Bootstrapper { public static void Init() { var bootstrapper = new Bootstrapper(); var container = bootstrapper.CreateContainer(); var autofacWebApiDependencyResolver = new AutofacWebApiDependencyResolver(container); GlobalConfiguration.Configuration.DependencyResolver = autofacWebApiDependencyResolver; } private readonly IContainer _container; public Bootstrapper() { var builder = new ContainerBuilder(); builder.RegisterApiControllers(Assembly.GetExecutingAssembly()); builder.RegisterAssemblyTypes(typeof (Bootstrapper).Assembly) .AsImplementedInterfaces(); _container = builder.Build(); } public IContainer CreateContainer() { return _container; } public T Get<T>() { return _container.Resolve<T>(); } } }
Revert "Revert "registration of api controllers fixed""
Revert "Revert "registration of api controllers fixed"" This reverts commit 5d659b38601b2620054b286c941a5d53f1da20ae.
C#
apache-2.0
borismod/ReSharperTnT,borismod/ReSharperTnT
056f8d0c23426f0822bc02690cbb9d5ee46dfb4b
RecurringDates/Extensions.cs
RecurringDates/Extensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RecurringDates { public static class Extensions { public static SetUnionRule Or(this IRule first, params IRule[] otherRules) { return new SetUnionRule {Rules = new[] {first}.Concat(otherRules)}; } public static SetIntersectionRule And(this IRule first, params IRule[] otherRules) { return new SetIntersectionRule { Rules = new[] { first }.Concat(otherRules) }; } public static SetDifferenceRule Except(this IRule includeRule, IRule excludeRule) { return new SetDifferenceRule { IncludeRule = includeRule , ExcludeRule = excludeRule }; } public static NotRule Not(this IRule rule) { return new NotRule { ReferencedRule = rule }; } public static NthInMonthRule NthInMonth(this IRule rule, int nthOccurrence) { return new NthInMonthRule {Nth = nthOccurrence, ReferencedRule = rule}; } public static MonthsFilterRule InMonths(this IRule rule, params Month[] months) { return new MonthsFilterRule { Months = months, ReferencedRule = rule }; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RecurringDates { public static class Extensions { public static SetUnionRule Or(this IRule first, params IRule[] otherRules) { return new SetUnionRule {Rules = new[] {first}.Concat(otherRules)}; } public static SetIntersectionRule And(this IRule first, params IRule[] otherRules) { return new SetIntersectionRule { Rules = new[] { first }.Concat(otherRules) }; } public static SetDifferenceRule Except(this IRule includeRule, IRule excludeRule) { return new SetDifferenceRule { IncludeRule = includeRule , ExcludeRule = excludeRule }; } public static NotRule Not(this IRule rule) { return new NotRule { ReferencedRule = rule }; } public static NthInMonthRule NthInMonth(this IRule rule, int nthOccurrence) { return new NthInMonthRule {Nth = nthOccurrence, ReferencedRule = rule}; } public static MonthsFilterRule InMonths(this IRule rule, params Month[] months) { return new MonthsFilterRule { Months = months, ReferencedRule = rule }; } public static DayOfWeekRule EveryWeek(this DayOfWeek dow) { return new DayOfWeekRule(dow); } } }
Add new fluent syntax: DayOfWeek.Monday.EveryWeek()
Add new fluent syntax: DayOfWeek.Monday.EveryWeek()
C#
bsd-2-clause
diaconesq/RecurringDates
0cf7eca272c079b90d15e8ab335725be898dd1be
src/Arkivverket.Arkade/Util/ArkadeAutofacModule.cs
src/Arkivverket.Arkade/Util/ArkadeAutofacModule.cs
using Arkivverket.Arkade.Core; using Arkivverket.Arkade.Core.Noark5; using Arkivverket.Arkade.Identify; using Arkivverket.Arkade.Logging; using Arkivverket.Arkade.Tests; using Arkivverket.Arkade.Tests.Noark5; using Autofac; namespace Arkivverket.Arkade.Util { public class ArkadeAutofacModule : Module { protected override void Load(ContainerBuilder builder) { builder.RegisterType<TarCompressionUtility>().As<ICompressionUtility>(); builder.RegisterType<TestSessionFactory>().AsSelf(); builder.RegisterType<ArchiveIdentifier>().As<IArchiveIdentifier>(); builder.RegisterType<Noark5TestEngine>().AsSelf().SingleInstance(); builder.RegisterType<ArchiveContentReader>().As<IArchiveContentReader>(); builder.RegisterType<TestProvider>().As<ITestProvider>(); builder.RegisterType<StatusEventHandler>().As<IStatusEventHandler>().SingleInstance(); builder.RegisterType<Noark5TestProvider>().AsSelf(); } } }
using Arkivverket.Arkade.Core; using Arkivverket.Arkade.Core.Addml; using Arkivverket.Arkade.Core.Noark5; using Arkivverket.Arkade.Identify; using Arkivverket.Arkade.Logging; using Arkivverket.Arkade.Tests; using Arkivverket.Arkade.Tests.Noark5; using Autofac; namespace Arkivverket.Arkade.Util { public class ArkadeAutofacModule : Module { protected override void Load(ContainerBuilder builder) { builder.RegisterType<AddmlDatasetTestEngine>().AsSelf(); builder.RegisterType<AddmlProcessRunner>().AsSelf(); builder.RegisterType<ArchiveContentReader>().As<IArchiveContentReader>(); builder.RegisterType<ArchiveIdentifier>().As<IArchiveIdentifier>(); builder.RegisterType<FlatFileReaderFactory>().AsSelf(); builder.RegisterType<Noark5TestEngine>().AsSelf().SingleInstance(); builder.RegisterType<Noark5TestProvider>().AsSelf(); builder.RegisterType<StatusEventHandler>().As<IStatusEventHandler>().SingleInstance(); builder.RegisterType<TarCompressionUtility>().As<ICompressionUtility>(); builder.RegisterType<TestEngineFactory>().AsSelf(); builder.RegisterType<TestProvider>().As<ITestProvider>(); builder.RegisterType<TestSessionFactory>().AsSelf(); } } }
Add missing dependencies to autofac module
Add missing dependencies to autofac module
C#
agpl-3.0
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
ce413bba03ffca04c458096306579ff6e4dc0318
Google.Solutions.IapDesktop.Application.Test/FixtureBase.cs
Google.Solutions.IapDesktop.Application.Test/FixtureBase.cs
// // Copyright 2019 Google LLC // // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // using NUnit.Framework; using System.Diagnostics; namespace Google.Solutions.IapDesktop.Application.Test { public abstract class FixtureBase { [SetUp] public void SetUpTracing() { TraceSources.IapDesktop.Listeners.Add(new ConsoleTraceListener()); TraceSources.IapDesktop.Switch.Level = SourceLevels.Verbose; } } }
// // Copyright 2019 Google LLC // // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // using NUnit.Framework; using System.Diagnostics; namespace Google.Solutions.IapDesktop.Application.Test { public abstract class FixtureBase { private static TraceSource[] Traces = new[] { Google.Solutions.Compute.TraceSources.Compute, Google.Solutions.IapDesktop.Application.TraceSources.IapDesktop }; [SetUp] public void SetUpTracing() { var listener = new ConsoleTraceListener(); foreach (var trace in Traces) { trace.Listeners.Add(listener); trace.Switch.Level = System.Diagnostics.SourceLevels.Verbose; } } } }
Enable tracing for IAP code
Enable tracing for IAP code Change-Id: I34c2c3c3c5110b9b894a59a81910f02667aefe52
C#
apache-2.0
GoogleCloudPlatform/iap-desktop,GoogleCloudPlatform/iap-desktop
9d31efd24cfd819abaafa057e17d501f89a168f5
src/Blogifier.Core/Services/Social/SocialService.cs
src/Blogifier.Core/Services/Social/SocialService.cs
using Blogifier.Core.Common; using Blogifier.Core.Data.Domain; using Blogifier.Core.Data.Interfaces; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Blogifier.Core.Services.Social { public class SocialService : ISocialService { IUnitOfWork _db; public SocialService(IUnitOfWork db) { _db = db; } public Task<Dictionary<string, string>> GetSocialButtons(Profile profile) { var buttons = ApplicationSettings.SocialButtons; if(profile != null) { // override with profile customizations var dbFields = _db.CustomFields.Find(f => f.CustomType == CustomType.Profile && f.ParentId == profile.Id); if (dbFields != null && dbFields.Count() > 0) { foreach (var field in dbFields) { if (buttons.ContainsKey(field.CustomKey)) { buttons[field.CustomKey] = field.CustomValue; } } } } return Task.Run(()=> buttons); } } }
using Blogifier.Core.Common; using Blogifier.Core.Data.Domain; using Blogifier.Core.Data.Interfaces; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Blogifier.Core.Services.Social { public class SocialService : ISocialService { IUnitOfWork _db; public SocialService(IUnitOfWork db) { _db = db; } public Task<Dictionary<string, string>> GetSocialButtons(Profile profile) { var buttons = new Dictionary<string, string>(); foreach (var item in ApplicationSettings.SocialButtons) { buttons.Add(item.Key, item.Value); } if(profile != null) { // override with profile customizations var dbFields = _db.CustomFields.Find(f => f.CustomType == CustomType.Profile && f.ParentId == profile.Id); if (dbFields != null && dbFields.Count() > 0) { foreach (var field in dbFields) { if (buttons.ContainsKey(field.CustomKey)) { buttons[field.CustomKey] = field.CustomValue; } } } } return Task.Run(()=> buttons); } } }
Fix social buttons not copying setting valus
Fix social buttons not copying setting valus
C#
mit
murst/Blogifier.Core,blogifierdotnet/Blogifier.Core,murst/Blogifier.Core,murst/Blogifier.Core,blogifierdotnet/Blogifier.Core
19cd07a473e5d39e069bd2376cfaf37fce8f0ee6
src/SampSharp.Entities/SAMP/Dialogs/DialogSystem.cs
src/SampSharp.Entities/SAMP/Dialogs/DialogSystem.cs
// SampSharp // Copyright 2022 Tim Potze // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace SampSharp.Entities.SAMP; /// <summary>Represents a system for handling dialog functionality</summary> public class DialogSystem : ISystem { [Event] // ReSharper disable once UnusedMember.Local private void OnPlayerDisconnect(VisibleDialog player, DisconnectReason _) { player.Handler(new DialogResult(DialogResponse.Disconnected, 0, null)); } [Event] // ReSharper disable once UnusedMember.Local private void OnDialogResponse(VisibleDialog player, int dialogId, int response, int listItem, string inputText) { if (dialogId != DialogService.DialogId) return; // Prevent dialog hacks player.ResponseReceived = true; player.Handler(new DialogResult(response == 1 ? DialogResponse.LeftButton : DialogResponse.RightButtonOrCancel, listItem, inputText)); } }
// SampSharp // Copyright 2022 Tim Potze // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace SampSharp.Entities.SAMP; /// <summary>Represents a system for handling dialog functionality</summary> public class DialogSystem : ISystem { [Event] // ReSharper disable once UnusedMember.Local private void OnPlayerDisconnect(VisibleDialog player, DisconnectReason _) { player.ResponseReceived = true; player.Handler(new DialogResult(DialogResponse.Disconnected, 0, null)); } [Event] // ReSharper disable once UnusedMember.Local private void OnDialogResponse(VisibleDialog player, int dialogId, int response, int listItem, string inputText) { if (dialogId != DialogService.DialogId) return; // Prevent dialog hacks player.ResponseReceived = true; player.Handler(new DialogResult(response == 1 ? DialogResponse.LeftButton : DialogResponse.RightButtonOrCancel, listItem, inputText)); player.Destroy(); } }
Fix issues related to open dialogs when a player disconnects
[ecs] Fix issues related to open dialogs when a player disconnects
C#
apache-2.0
ikkentim/SampSharp,ikkentim/SampSharp,ikkentim/SampSharp
a10c0a835dcd53ac1a510c927624c887f03f75c0
AlexTouch.PSPDFKit/PSPDFKit.linkwith.cs
AlexTouch.PSPDFKit/PSPDFKit.linkwith.cs
using System; using MonoTouch.ObjCRuntime; [assembly: LinkWith ("PSPDFKit.a", LinkTarget.ArmV7s | LinkTarget.ArmV7 | LinkTarget.Simulator, ForceLoad = true, IsCxx = true, Frameworks = "MediaPlayer CoreText QuartzCore MessageUI ImageIO CoreMedia CoreGraphics AVFoundation", LinkerFlags = "-lz -ObjC")]
using System; using MonoTouch.ObjCRuntime; [assembly: LinkWith ("PSPDFKit.a", LinkTarget.ArmV7s | LinkTarget.ArmV7 | LinkTarget.Simulator, ForceLoad = true, IsCxx = true, Frameworks = "MediaPlayer CoreText QuartzCore MessageUI ImageIO CoreMedia CoreGraphics AVFoundation", LinkerFlags = "-lz -ObjC -fobjc-arc")]
Add missing ARC runtime linker flag
Add missing ARC runtime linker flag
C#
mit
gururajios/XamarinBindings,gururajios/XamarinBindings,hanoibanhcuon/XamarinBindings,hanoibanhcuon/XamarinBindings,kushal2905/XamarinBindings-1,andnsx/XamarinBindings,theonlylawislove/XamarinBindings,andnsx/XamarinBindings,kushal2905/XamarinBindings-1
d64c15bea4cb31f903663660dcfd15059e11c81b
SimpleEventMonitor.Web/AppHostSimpleEventMonitor.cs
SimpleEventMonitor.Web/AppHostSimpleEventMonitor.cs
using System.Reflection; using Funq; using ServiceStack.Common.Web; using ServiceStack.ServiceHost; using ServiceStack.Text; using ServiceStack.WebHost.Endpoints; using SimpleEventMonitor.Core; namespace SimpleEventMonitor.Web { public class AppHostSimpleEventMonitor : AppHostBase { public AppHostSimpleEventMonitor(IEventDataStore dataStore) : base("SimpleEventMonitorServices", Assembly.GetExecutingAssembly()) { Container.Register(dataStore); } public override void Configure(Container container) { JsConfig.IncludeNullValues = true; SetConfig( new EndpointHostConfig { DebugMode = true, DefaultContentType = ContentType.Json, EnableFeatures = Feature.All }); } } }
using System.Reflection; using Funq; using ServiceStack.Common.Web; using ServiceStack.ServiceHost; using ServiceStack.Text; using ServiceStack.WebHost.Endpoints; using SimpleEventMonitor.Core; namespace SimpleEventMonitor.Web { public class AppHostSimpleEventMonitor : AppHostBase { public AppHostSimpleEventMonitor(IEventDataStore dataStore) : base("SimpleEventMonitorServices", Assembly.GetExecutingAssembly()) { Container.Register(dataStore); } public override void Configure(Container container) { #if DEBUG bool debug = true; var enableFeatures = Feature.All; #else bool debug = false; var enableFeatures = Feature.All.Remove(Feature.Metadata); #endif JsConfig.IncludeNullValues = true; SetConfig( new EndpointHostConfig { DebugMode = debug, DefaultContentType = ContentType.Json, EnableFeatures = enableFeatures }); } } }
Debug mode only enabled for Debug Build configuration
Debug mode only enabled for Debug Build configuration
C#
mit
Jeern/SimpleEventMonitor,Jeern/SimpleEventMonitor,Jeern/SimpleEventMonitor
c063f5fd28d31c5c791ded98eb73c3b4a9f67feb
Selenium.WebDriver.Equip/TestCapture.cs
Selenium.WebDriver.Equip/TestCapture.cs
using System; using System.Drawing.Imaging; using System.IO; using OpenQA.Selenium; namespace Selenium.WebDriver.Equip { public class TestCapture { private IWebDriver _browser = null; private string fileName; public TestCapture(IWebDriver iWebDriver, string type = "Failed") { fileName = string.Format(@"{0}\{1}.{2}", Directory.GetCurrentDirectory(), DateTime.Now.Ticks, type); _browser = iWebDriver; } public void CaptureWebPage() { WebDriverLogsLogs(); PageSource(); ScreenShot(); } public void PageSource() { string htmlFile = string.Format(@"{0}.html", fileName); using (var sw = new StreamWriter(htmlFile, false)) sw.Write(_browser.PageSource); } public void ScreenShot() { _browser.TakeScreenShot(fileName + ".jpeg", ScreenshotImageFormat.Jpeg); } public void WebDriverLogsLogs() { foreach (var log in _browser.Manage().Logs.AvailableLogTypes) using (var sw = new StreamWriter(string.Format(@"{0}.{1}.log", fileName, log), false)) foreach (var logentry in _browser.Manage().Logs.GetLog(log)) sw.WriteLine(logentry); } } }
using OpenQA.Selenium; using System; using System.IO; using System.Reflection; namespace Selenium.WebDriver.Equip { public class TestCapture { private IWebDriver _browser = null; private string fileName; public TestCapture(IWebDriver iWebDriver, string type = "Failed") { fileName = $@"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\{DateTime.Now.Ticks}.{type}"; _browser = iWebDriver; } public void CaptureWebPage() { WebDriverLogsLogs(); PageSource(); ScreenShot(); } public void PageSource() { string htmlFile = $"{fileName}.html"; using (var sw = new StreamWriter(htmlFile, false)) sw.Write(_browser.PageSource); } public void ScreenShot() { _browser.TakeScreenShot(fileName + ".jpeg", ScreenshotImageFormat.Jpeg); } public void WebDriverLogsLogs() { foreach (var log in _browser.Manage().Logs.AvailableLogTypes) using (var sw = new StreamWriter($"{fileName}.{log}.log", false)) foreach (var logentry in _browser.Manage().Logs.GetLog(log)) sw.WriteLine(logentry); } } }
Fix screen capture durring test failure
Fix screen capture durring test failure
C#
mit
rcasady616/Selenium.WeDriver.Equip,rcasady616/Selenium.WeDriver.Equip
b5ac5c46ec4e330cac2e8c9dbbc8594ed0571dd3
Src/Options.cs
Src/Options.cs
namespace JsonDiffPatchDotNet { public sealed class Options { public Options() { ArrayDiff = ArrayDiffMode.Efficient; TextDiff = TextDiffMode.Efficient; MinEfficientTextDiffLength = 50; } public ArrayDiffMode ArrayDiff { get; set; } public TextDiffMode TextDiff { get; set; } public long MinEfficientTextDiffLength { get; set; } } }
namespace JsonDiffPatchDotNet { public sealed class Options { public Options() { ArrayDiff = ArrayDiffMode.Simple; TextDiff = TextDiffMode.Efficient; MinEfficientTextDiffLength = 50; } public ArrayDiffMode ArrayDiff { get; set; } public TextDiffMode TextDiff { get; set; } public long MinEfficientTextDiffLength { get; set; } } }
Switch simple array diff to default until Efficient array diffing is implemented
Switch simple array diff to default until Efficient array diffing is implemented
C#
mit
wbish/jsondiffpatch.net,arbitertl/jsondiffpatch.net
9074cdf3401b3fb891d09b2079ab07976e84435e
video/TweetDuck.Video/Controls/SeekBar.cs
video/TweetDuck.Video/Controls/SeekBar.cs
using System.Drawing; using System.Windows.Forms; namespace TweetDuck.Video.Controls{ sealed class SeekBar : ProgressBar{ private readonly SolidBrush brush; public SeekBar(){ brush = new SolidBrush(Color.White); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); } protected override void OnPaint(PaintEventArgs e){ if (brush.Color != ForeColor){ brush.Color = ForeColor; } Rectangle rect = e.ClipRectangle; rect.Width = (int)(rect.Width*((double)Value/Maximum)); e.Graphics.FillRectangle(brush, rect); } protected override void Dispose(bool disposing){ base.Dispose(disposing); if (disposing){ brush.Dispose(); } } } }
using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; namespace TweetDuck.Video.Controls{ sealed class SeekBar : ProgressBar{ private readonly SolidBrush brushFore; private readonly SolidBrush brushHover; private readonly SolidBrush brushOverlap; public SeekBar(){ brushFore = new SolidBrush(Color.White); brushHover = new SolidBrush(Color.White); brushOverlap = new SolidBrush(Color.White); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); } protected override void OnPaint(PaintEventArgs e){ if (brushFore.Color != ForeColor){ brushFore.Color = ForeColor; brushHover.Color = Color.FromArgb(128, ForeColor); brushOverlap.Color = Color.FromArgb(80+ForeColor.R*11/16, 80+ForeColor.G*11/16, 80+ForeColor.B*11/16); } Rectangle rect = e.ClipRectangle; Point cursor = PointToClient(Cursor.Position); int width = rect.Width; int progress = (int)(width*((double)Value/Maximum)); rect.Width = progress; e.Graphics.FillRectangle(brushFore, rect); if (cursor.X >= 0 && cursor.Y >= 0 && cursor.X <= width && cursor.Y <= rect.Height){ if (progress >= cursor.X){ rect.Width = cursor.X; e.Graphics.FillRectangle(brushOverlap, rect); } else{ rect.X = progress; rect.Width = cursor.X-rect.X; e.Graphics.FillRectangle(brushHover, rect); } } } protected override void Dispose(bool disposing){ base.Dispose(disposing); if (disposing){ brushFore.Dispose(); brushHover.Dispose(); brushOverlap.Dispose(); } } } }
Add a hover effect to video player seek bar
Add a hover effect to video player seek bar
C#
mit
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
76a4cee31a651f0a4be824b9db3102efa2e6707f
tests/NServiceKit.Logging.Tests/Support/TestBase.cs
tests/NServiceKit.Logging.Tests/Support/TestBase.cs
using System; using System.Diagnostics; using NUnit.Framework; using Rhino.Mocks; namespace NServiceKit.Logging.Tests.Support { public class TestBase { private MockRepository mocks; protected virtual MockRepository Mocks { get { return mocks; } } [SetUp] protected virtual void SetUp() { mocks = new MockRepository(); } [TearDown] protected virtual void TearDown() { mocks = null; } protected virtual void ReplayAll() { Mocks.ReplayAll(); } protected virtual void VerifyAll() { try { Mocks.VerifyAll(); } catch (InvalidOperationException ex) { Debug.Print("InvalidOperationException thrown: {0}", ex.Message); } } } }
using System; using System.Diagnostics; using NUnit.Framework; using Rhino.Mocks; namespace NServiceKit.Logging.Tests.Support { public class TestBase { private MockRepository mocks; protected virtual MockRepository Mocks { get { return mocks; } } [SetUp] protected virtual void SetUp() { mocks = new MockRepository(); } [TearDown] protected virtual void TearDown() { mocks.BackToRecordAll(); mocks = null; } protected virtual void ReplayAll() { Mocks.ReplayAll(); } protected virtual void VerifyAll() { try { Mocks.VerifyAll(); } catch (InvalidOperationException ex) { Debug.Print("InvalidOperationException thrown: {0}", ex.Message); } } } }
Reset the mocks before disposing
Reset the mocks before disposing
C#
bsd-3-clause
NServiceKit/NServiceKit.Logging,NServiceKit/NServiceKit.Logging
cca58f3ec06b40bb8273ab3f7c84768850d2e10d
Samples/Mapsui.Samples.Common/Maps/MbTilesSample.cs
Samples/Mapsui.Samples.Common/Maps/MbTilesSample.cs
using System.IO; using BruTile.MbTiles; using Mapsui.Layers; using Mapsui.UI; using SQLite; namespace Mapsui.Samples.Common.Maps { public class MbTilesSample : ISample { // This is a hack used for iOS/Android deployment public static string MbTilesLocation { get; set; } = @"." + Path.DirectorySeparatorChar + "MbTiles"; public string Name => "1 MbTiles"; public string Category => "Data"; public void Setup(IMapControl mapControl) { mapControl.Map = CreateMap(); } public static Map CreateMap() { var map = new Map(); map.Layers.Add(CreateMbTilesLayer(Path.Combine(MbTilesLocation, "world.mbtiles"), "regular")); return map; } public static TileLayer CreateMbTilesLayer(string path, string name) { var mbTilesTileSource = new MbTilesTileSource(new SQLiteConnectionString(path, true)); var mbTilesLayer = new TileLayer(mbTilesTileSource) { Name = name}; return mbTilesLayer; } } }
using System.IO; using BruTile.MbTiles; using Mapsui.Layers; using Mapsui.UI; using SQLite; namespace Mapsui.Samples.Common.Maps { public class MbTilesSample : ISample { // This is a hack used for iOS/Android deployment public static string MbTilesLocation { get; set; } = @"." + Path.DirectorySeparatorChar + "MbTiles"; public string Name => "1 MbTiles"; public string Category => "Data"; public void Setup(IMapControl mapControl) { mapControl.Map = CreateMap(); } public static Map CreateMap() { var map = new Map(); map.Layers.Add(CreateMbTilesLayer(Path.GetFullPath(Path.Combine(MbTilesLocation, "world.mbtiles")), "regular")); return map; } public static TileLayer CreateMbTilesLayer(string path, string name) { var mbTilesTileSource = new MbTilesTileSource(new SQLiteConnectionString(path, true)); var mbTilesLayer = new TileLayer(mbTilesTileSource) { Name = name}; return mbTilesLayer; } } }
Replace SQLite path for MBTiles files with full path, so that doesn't throw an exception on UWP
Replace SQLite path for MBTiles files with full path, so that doesn't throw an exception on UWP
C#
mit
charlenni/Mapsui,charlenni/Mapsui,pauldendulk/Mapsui
d98640a0249aab8edbbe8cfec49594a6358d9da5
apis/Google.Cloud.Redis.V1Beta1/Google.Cloud.Redis.V1Beta1.SmokeTests/CloudRedisClientSmokeTest.cs
apis/Google.Cloud.Redis.V1Beta1/Google.Cloud.Redis.V1Beta1.SmokeTests/CloudRedisClientSmokeTest.cs
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; namespace Google.Cloud.Redis.V1Beta1.SmokeTests { public class CloudRedisClientSmokeTest { public static int Main(string[] args) { var client = CloudRedisClient.Create(); var locationName = new LocationName(args[0], "-"); var instances = client.ListInstances(locationName); foreach (var instance in instances) { Console.WriteLine(instance.Name); } // Success Console.WriteLine("Smoke test passed OK"); return 0; } } }
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using Google.Api.Gax.ResourceNames; namespace Google.Cloud.Redis.V1Beta1.SmokeTests { public class CloudRedisClientSmokeTest { public static int Main(string[] args) { var client = CloudRedisClient.Create(); var locationName = new LocationName(args[0], "-"); var instances = client.ListInstances(locationName); foreach (var instance in instances) { Console.WriteLine(instance.Name); } // Success Console.WriteLine("Smoke test passed OK"); return 0; } } }
Fix smoke test to use common LocationName
Fix smoke test to use common LocationName
C#
apache-2.0
googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/gcloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet
1dd0b71505938752b2e2ba01574e6dbb4870bf7c
src/Booma.Proxy.Client.Unity.Common/Engine/Initializables/NetworkClientConnectionOnInitInitializable.cs
src/Booma.Proxy.Client.Unity.Common/Engine/Initializables/NetworkClientConnectionOnInitInitializable.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Common.Logging; using GladNet; namespace Booma.Proxy { [SceneTypeCreate(GameSceneType.ServerSelectionScreen)] [SceneTypeCreate(GameSceneType.PreShipSelectionScene)] [SceneTypeCreate(GameSceneType.CharacterSelectionScreen)] //probably more than just the character screen. public sealed class NetworkClientConnectionOnInitInitializable : IGameInitializable { private IConnectionService ConnectionService { get; } private IGameConnectionEndpointDetails ConnectionDetails { get; } private ILog Logger { get; } /// <inheritdoc /> public NetworkClientConnectionOnInitInitializable([NotNull] IConnectionService connectionService, [NotNull] IGameConnectionEndpointDetails connectionDetails, [NotNull] ILog logger) { ConnectionService = connectionService ?? throw new ArgumentNullException(nameof(connectionService)); ConnectionDetails = connectionDetails ?? throw new ArgumentNullException(nameof(connectionDetails)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); } /// <inheritdoc /> public Task OnGameInitialized() { if(Logger.IsInfoEnabled) Logger.Info($"Connectiong to: {ConnectionDetails.IpAddress}:{ConnectionDetails.Port}"); //This initializable actually just //connects a IConnectionService with the provided game details. return ConnectionService.ConnectAsync(ConnectionDetails.IpAddress, ConnectionDetails.Port); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Common.Logging; using GladNet; namespace Booma.Proxy { [SceneTypeCreate(GameSceneType.PreBlockBurstingScene)] [SceneTypeCreate(GameSceneType.ServerSelectionScreen)] [SceneTypeCreate(GameSceneType.PreShipSelectionScene)] [SceneTypeCreate(GameSceneType.CharacterSelectionScreen)] //probably more than just the character screen. public sealed class NetworkClientConnectionOnInitInitializable : IGameInitializable { private IConnectionService ConnectionService { get; } private IGameConnectionEndpointDetails ConnectionDetails { get; } private ILog Logger { get; } /// <inheritdoc /> public NetworkClientConnectionOnInitInitializable([NotNull] IConnectionService connectionService, [NotNull] IGameConnectionEndpointDetails connectionDetails, [NotNull] ILog logger) { ConnectionService = connectionService ?? throw new ArgumentNullException(nameof(connectionService)); ConnectionDetails = connectionDetails ?? throw new ArgumentNullException(nameof(connectionDetails)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); } /// <inheritdoc /> public Task OnGameInitialized() { if(Logger.IsInfoEnabled) Logger.Info($"Connectiong to: {ConnectionDetails.IpAddress}:{ConnectionDetails.Port}"); //This initializable actually just //connects a IConnectionService with the provided game details. return ConnectionService.ConnectAsync(ConnectionDetails.IpAddress, ConnectionDetails.Port); } } }
Enable auto-connection on pre-block bursting screen
Enable auto-connection on pre-block bursting screen
C#
agpl-3.0
HelloKitty/Booma.Proxy
cf29a0502bcf95210319e5fea86d03fb97a6d04f
Assets/Editor/MicrogameCollectionEditor.cs
Assets/Editor/MicrogameCollectionEditor.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; [CustomEditor(typeof(MicrogameCollection))] public class MicrogameCollectionEditor : Editor { public override void OnInspectorGUI() { MicrogameCollection collection = (MicrogameCollection)target; if (GUILayout.Button("Update Microgames")) { collection.updateMicrogames(); } DrawDefaultInspector(); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; [CustomEditor(typeof(MicrogameCollection))] public class MicrogameCollectionEditor : Editor { public override void OnInspectorGUI() { MicrogameCollection collection = (MicrogameCollection)target; if (GUILayout.Button("Update Microgames")) { collection.updateMicrogames(); EditorUtility.SetDirty(collection); } DrawDefaultInspector(); } }
Set MicrogameCollection dirty in editor update
Set MicrogameCollection dirty in editor update
C#
mit
NitorInc/NitoriWare,Barleytree/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare
0f9c1a4686d5b1101cb44effdd3ef636e49f47ca
CRP.Mvc/Views/Payments/Confirmation.cshtml
CRP.Mvc/Views/Payments/Confirmation.cshtml
@using Microsoft.Web.Mvc @model CRP.Controllers.ViewModels.PaymentConfirmationViewModel @{ ViewBag.Title = "Confirmation"; } <div class="boundary"> <h2>Registration Confirmation</h2> <p>You have successfully registered for the following event:</p> <div> <label>Item: </label> @Model.Transaction.Item.Name </div> <div> <label>Amount: </label> @($"{Model.Transaction.Total:C}") </div> @if (Model.Transaction.Credit) { <div> <p>Payment is still due:</p> <form action="@Model.PostUrl" method="post" autocomplete="off" style="margin-right: 3px"> @foreach (var pair in Model.PaymentDictionary) { <input type="hidden" name="@pair.Key" value="@pair.Value"/> } <input type="hidden" name="signature" value="@Model.Signature"/> @Html.SubmitButton("Submit", "Click here to be taken to our payment site") </form> </div> } else if (Model.Transaction.Total > 0) { <div> @Html.Raw(Model.Transaction.Item.CheckPaymentInstructions) </div> } </div>
@using Microsoft.Web.Mvc @model CRP.Controllers.ViewModels.PaymentConfirmationViewModel @{ ViewBag.Title = "Confirmation"; } <div class="boundary"> <h2>Registration Confirmation</h2> <p>You have successfully registered for the following event:</p> <div> <label>Item: </label> @Model.Transaction.Item.Name </div> <div> <label>Amount: </label> @($"{Model.Transaction.Total:C}") </div> @if (Model.Transaction.Credit) { <div> <p>Payment is still due:</p> <form action="@Model.PostUrl" method="post" autocomplete="off" style="margin-right: 3px"> @foreach (var pair in Model.PaymentDictionary) { <input type="hidden" name="@pair.Key" value="@pair.Value"/> } <input type="hidden" name="signature" value="@Model.Signature"/> <input type="submit" class="btn btn-primary" value="Click here to be taken to our payment site"/> </form> </div> } else if (Model.Transaction.Total > 0) { <div> @Html.Raw(Model.Transaction.Item.CheckPaymentInstructions) </div> } </div>
Add a link on Credit card registrations that have not paid
Add a link on Credit card registrations that have not paid
C#
mit
ucdavis/CRP,ucdavis/CRP,ucdavis/CRP
76325ff54e72b5ff28595f5d4d836e24ca8b7f2d
Source/Reaper.SharpBattleNet.Framework.DiabloIIRealmServer/Details/DiabloIIRealmServer.cs
Source/Reaper.SharpBattleNet.Framework.DiabloIIRealmServer/Details/DiabloIIRealmServer.cs
namespace Reaper.SharpBattleNet.Framework.DiabloIIRealmServer.Details { using System; using System.Linq; using System.Text; using System.Collections; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Nini; using Nini.Config; using Nini.Ini; using Nini.Util; using NLog; using Reaper; using Reaper.SharpBattleNet; using Reaper.SharpBattleNet.Framework; using Reaper.SharpBattleNet.Framework.DiabloIIRealmServer; internal sealed class DiabloIIRealmServer : IDiabloIIRealmServer { private readonly IConfigSource _configuration = null; private readonly Logger _logger = LogManager.GetCurrentClassLogger(); public DiabloIIRealmServer(IConfigSource configuration) { _configuration = configuration; return; } public async Task Start(string[] commandArguments) { return; } public async Task Stop() { return; } } }
namespace Reaper.SharpBattleNet.Framework.DiabloIIRealmServer.Details { using System; using System.Linq; using System.Text; using System.Collections; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Nini; using Nini.Config; using Nini.Ini; using Nini.Util; using NLog; using Reaper; using Reaper.SharpBattleNet; using Reaper.SharpBattleNet.Framework; using Reaper.SharpBattleNet.Framework.Networking; using Reaper.SharpBattleNet.Framework.DiabloIIRealmServer; internal sealed class DiabloIIRealmServer : IDiabloIIRealmServer { private readonly IConfigSource _configuration = null; private readonly INetworkManager _networkManager = null; private readonly Logger _logger = LogManager.GetCurrentClassLogger(); public DiabloIIRealmServer(IConfigSource configuration, INetworkManager networkManager) { _configuration = configuration; _networkManager = networkManager; return; } public async Task Start(string[] commandArguments) { await _networkManager.StartNetworking(); return; } public async Task Stop() { await _networkManager.StopNetworking(); return; } } }
Update D2RS to handle new networking infrastructure.
Update D2RS to handle new networking infrastructure.
C#
mit
wynandpieterse/SharpBattleNet
7adbd75d41de363b9be151d573fff4f78c4e6b0e
src/Orchard.Web/Modules/LETS/Views/NoticesAdmin/List.cshtml
src/Orchard.Web/Modules/LETS/Views/NoticesAdmin/List.cshtml
@model LETS.ViewModels.MemberNoticesViewModel <h1>@string.Format("{0}'s {1}", @Model.Member.FirstLastName, T("notices"))</h1> @if (Model.Notices.Count().Equals(0)) { <p>@T("This member doesn't have any active notices")</p> } @foreach (var notice in Model.Notices) { @Display(notice) } @{ <div id="archivedNotices"> <h2>@T("Archived notices")</h2> <p><strong>@T("Expired notices will show up here until they are deleted or re-activated by publishing them.")</strong></p> <p>@T("Notices can also be archived if you don't want to delete them yet")</p> @if (Model.ArchivedNotices.Any()) { foreach (var archivedNotice in Model.ArchivedNotices) { @Display(archivedNotice) } } </div> }
@using LETS.Helpers; @model LETS.ViewModels.MemberNoticesViewModel <h1>@string.Format("{0}'s {1}", @Model.Member.FirstLastName, T("notices"))</h1> @if (Model.Notices.Count().Equals(0)) { <p>@T("This member doesn't have any active notices")</p> } @foreach (var notice in Model.Notices) { var id = notice.ContentItem.Id; @Display(notice) @Html.ActionLink(T("Edit").ToString(), "Edit", "Notice", new { area = "LETS", id = id }, new { @class = "edit" }) @:| @Html.ActionLink(T("Delete").ToString(), "Delete", "Notice", new { area = "LETS", id = id }, new { @class = "edit", itemprop = "UnsafeUrl RemoveUrl" }) @:| @*var published = Helpers.IsPublished(notice.ContentPart.Id); if (published) { @Html.Link(T("Archive").Text, Url.Action("Unpublish", "Notice", new { area = "LETS", id = notice.Id }), new { @class = "edit", itemprop = "UnsafeUrl ArchiveUrl" }) } else { @Html.ActionLink(T("Publish").ToString(), "Publish", "Notice", new { area = "LETS", id = notice.Id }, new { @class = "edit", itemprop = "UnsafeUrl" }) }*@ } @{ <div id="archivedNotices"> <h2>@T("Archived notices")</h2> <p><strong>@T("Expired notices will show up here until they are deleted or re-activated by publishing them.")</strong></p> <p>@T("Notices can also be archived if you don't want to delete them yet")</p> @if (Model.ArchivedNotices.Any()) { foreach (var archivedNotice in Model.ArchivedNotices) { @Display(archivedNotice) } } </div> } @Html.AntiForgeryTokenOrchard()
Add edit links to noitces admin
Add edit links to noitces admin
C#
bsd-3-clause
planetClaire/Orchard-LETS,planetClaire/Orchard-LETS,planetClaire/Orchard-LETS,planetClaire/Orchard-LETS,planetClaire/Orchard-LETS
1ad6ffe90003a7af33cc92c4d695f34ac5b84593
SmartCam/Controllers/SmartCamController.cs
SmartCam/Controllers/SmartCamController.cs
using System.IO; using System.Web; using System.Web.Mvc; using System.Net.Mail; namespace SmartCam.Controllers { public class SmartCamController : Controller { private static byte[] currentImage = new byte[0]; [HttpPost] public string PostImage(HttpPostedFileBase file) { Stream fileStream = file.InputStream; using (MemoryStream ms = new MemoryStream()) { fileStream.CopyTo(ms); currentImage = ms.GetBuffer(); } return "Success"; } [HttpGet] public FileResult GetPicture() { return new FileStreamResult(new MemoryStream(currentImage), "image/jpeg"); } [HttpGet] public string SendNotification() { var fromAddress = new MailAddress(from, "From Name"); var toAddress = new MailAddress(to, "To Name"); const string fromPassword = ; const string subject = "SmartCam"; const string body = "Motion Detected!"; using (SmtpClient smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new System.Net.NetworkCredential(fromAddress.Address, fromPassword) }) { using (var message = new MailMessage(fromAddress, toAddress) { Subject = subject, Body = body }) { smtp.Send(message); } } return "Success"; } } }
using System.IO; using System.Web; using System.Web.Mvc; using System.Net.Mail; namespace SmartCam.Controllers { public class SmartCamController : Controller { private static byte[] currentImage = new byte[0]; [HttpPost] public string PostImage(HttpPostedFileBase file) { Stream fileStream = file.InputStream; using (MemoryStream ms = new MemoryStream()) { fileStream.CopyTo(ms); currentImage = ms.GetBuffer(); } return "Success"; } [HttpGet] public FileResult GetPicture() { return new FileStreamResult(new MemoryStream(currentImage), "image/jpeg"); } [HttpGet] public ActionResult ShowFeed() { return View(); } [HttpGet] public string SendNotification() { var fromAddress = new MailAddress(from, "From Name"); var toAddress = new MailAddress(to, "To Name"); const string fromPassword = ; const string subject = "SmartCam"; const string body = "Motion Detected!"; using (SmtpClient smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new System.Net.NetworkCredential(fromAddress.Address, fromPassword) }) { using (var message = new MailMessage(fromAddress, toAddress) { Subject = subject, Body = body }) { smtp.Send(message); } } return "Success"; } } }
Add an endpoint for the view page
Add an endpoint for the view page
C#
mit
Ranger1230/IoTClass-SmartCam,Ranger1230/IoTClass-SmartCam
eba099fc81f41b2e670a800ad2d009047fbac7e2
XmlParserWpf/XmlParserWpf/FilesViewModel.cs
XmlParserWpf/XmlParserWpf/FilesViewModel.cs
using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; namespace XmlParserWpf { public class FilesViewModel: ObservableCollection<FilesListItem> { public const int NoneSelection = -1; private int _selectedIndex = NoneSelection; public int SelectedIndex { get { return _selectedIndex; } set { if (_selectedIndex != value) { _selectedIndex = value; OnPropertyChanged(new PropertyChangedEventArgs("SelectedIndex")); OnPropertyChanged(new PropertyChangedEventArgs("SelectedFile")); } } } public FilesListItem SelectedFile => (SelectedIndex != NoneSelection ? this[SelectedIndex] : null); public void AddAndSelect(FilesListItem item) { Add(item); SelectedIndex = IndexOf(item); } public bool HasFile(string path) { return this.Any(x => x.Path.Equals(path)); } public void SelectIfExists(string path) { if (HasFile(path)) SelectedIndex = IndexOf(this.First(x => x.Path.Equals(path))); } public void RemoveSelected() { if (SelectedIndex < 0) return; RemoveAt(SelectedIndex); if (Count == 0) SelectedIndex = NoneSelection; } } }
using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; namespace XmlParserWpf { public class FilesViewModel: ObservableCollection<FilesListItem> { public const int NoneSelection = -1; private int _selectedIndex = NoneSelection; public int SelectedIndex { get { return _selectedIndex; } set { if (_selectedIndex != value) { _selectedIndex = value; OnPropertyChanged(new PropertyChangedEventArgs("SelectedIndex")); OnPropertyChanged(new PropertyChangedEventArgs("SelectedFile")); } } } public FilesListItem SelectedFile => ((Count > 0) && (SelectedIndex != NoneSelection)) ? this[SelectedIndex] : null; public void AddAndSelect(FilesListItem item) { Add(item); SelectedIndex = IndexOf(item); } public bool HasFile(string path) { return this.Any(x => x.Path.Equals(path)); } public void SelectIfExists(string path) { if (HasFile(path)) SelectedIndex = IndexOf(this.First(x => x.Path.Equals(path))); } public void RemoveSelected() { if (SelectedIndex < 0) return; RemoveAt(SelectedIndex); if (Count == 0) SelectedIndex = NoneSelection; } } }
Fix IndexOutOfBounds exception on application closing
Fix IndexOutOfBounds exception on application closing * with empty files list when SelectedIndex = 0 SelectedFile = ? * now SelectedFile = null
C#
mit
SVss/SPP_3
7c7d536ea45d6175e9993545ef3176cbd7f4413a
src/backend/SO115App.Persistence.MongoDB/GestioneTrasferimentiChiamate/CodiciChiamate/GetCodiciChiamate.cs
src/backend/SO115App.Persistence.MongoDB/GestioneTrasferimentiChiamate/CodiciChiamate/GetCodiciChiamate.cs
using MongoDB.Driver; using MongoDB.Driver.Linq; using Persistence.MongoDB; using SO115App.Models.Servizi.Infrastruttura.GestioneTrasferimentiChiamate.CodiciChiamate; using System.Collections.Generic; namespace SO115App.Persistence.MongoDB.GestioneTrasferimentiChiamate.CodiciChiamate { public class GetCodiciChiamate : IGetCodiciChiamate { private readonly DbContext _dbContext; public GetCodiciChiamate(DbContext dbContext) => _dbContext = dbContext; public List<string> Get(string CodSede) { return _dbContext.RichiestaAssistenzaCollection.AsQueryable() .Where(c => c.TestoStatoRichiesta == "C" && c.CodSOCompetente == CodSede) .Select(c => c.Codice) .ToList(); } } }
using MongoDB.Driver; using MongoDB.Driver.Linq; using Persistence.MongoDB; using SO115App.API.Models.Classi.Organigramma; using SO115App.API.Models.Classi.Soccorso; using SO115App.Models.Servizi.Infrastruttura.GestioneTrasferimentiChiamate.CodiciChiamate; using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.ServizioSede; using System.Collections.Generic; using System.Linq; namespace SO115App.Persistence.MongoDB.GestioneTrasferimentiChiamate.CodiciChiamate { public class GetCodiciChiamate : IGetCodiciChiamate { private readonly DbContext _dbContext; private readonly IGetAlberaturaUnitaOperative _getAlberaturaUnitaOperative; public GetCodiciChiamate(DbContext dbContext, IGetAlberaturaUnitaOperative getAlberaturaUnitaOperative) { _dbContext = dbContext; _getAlberaturaUnitaOperative = getAlberaturaUnitaOperative; } public List<string> Get(string CodSede) { var listaSediAlberate = _getAlberaturaUnitaOperative.ListaSediAlberata(); var pinNodi = new List<PinNodo>(); pinNodi.Add(new PinNodo(CodSede, true)); foreach (var figlio in listaSediAlberate.GetSottoAlbero(pinNodi)) { pinNodi.Add(new PinNodo(figlio.Codice, true)); } var filtroSediCompetenti = Builders<RichiestaAssistenza>.Filter .In(richiesta => richiesta.CodSOCompetente, pinNodi.Select(uo => uo.Codice)); var lista = _dbContext.RichiestaAssistenzaCollection.Find(filtroSediCompetenti).ToList(); return lista.Where(c => c.TestoStatoRichiesta == "C") .Select(c => c.Codice).ToList(); } } }
Fix gestione codici chiamata in Trasferimento Chiamata
Fix gestione codici chiamata in Trasferimento Chiamata
C#
agpl-3.0
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
ffde389641a15f0b0faceb8e1e900fa186509bda
osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs
osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Beatmaps.Formats { /// <summary> /// A <see cref="LegacyBeatmapDecoder"/> built for difficulty calculation of legacy <see cref="Beatmap"/>s /// <remarks> /// To use this, the decoder must be registered by the application through <see cref="LegacyDifficultyCalculatorBeatmapDecoder.Register"/>. /// Doing so will override any existing <see cref="Beatmap"/> decoders. /// </remarks> /// </summary> public class LegacyDifficultyCalculatorBeatmapDecoder : LegacyBeatmapDecoder { public LegacyDifficultyCalculatorBeatmapDecoder(int version = LATEST_VERSION) : base(version) { ApplyOffsets = false; } public new static void Register() { AddDecoder<Beatmap>(@"osu file format v", m => new LegacyDifficultyCalculatorBeatmapDecoder(int.Parse(m.Split('v').Last()))); } protected override TimingControlPoint CreateTimingControlPoint() => new LegacyDifficultyCalculatorControlPoint(); private class LegacyDifficultyCalculatorControlPoint : TimingControlPoint { public override double BeatLength { get; set; } = DEFAULT_BEAT_LENGTH; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Beatmaps.Formats { /// <summary> /// A <see cref="LegacyBeatmapDecoder"/> built for difficulty calculation of legacy <see cref="Beatmap"/>s /// <remarks> /// To use this, the decoder must be registered by the application through <see cref="LegacyDifficultyCalculatorBeatmapDecoder.Register"/>. /// Doing so will override any existing <see cref="Beatmap"/> decoders. /// </remarks> /// </summary> public class LegacyDifficultyCalculatorBeatmapDecoder : LegacyBeatmapDecoder { public LegacyDifficultyCalculatorBeatmapDecoder(int version = LATEST_VERSION) : base(version) { ApplyOffsets = false; } public new static void Register() { AddDecoder<Beatmap>(@"osu file format v", m => new LegacyDifficultyCalculatorBeatmapDecoder(int.Parse(m.Split('v').Last()))); SetFallbackDecoder<Beatmap>(() => new LegacyDifficultyCalculatorBeatmapDecoder()); } protected override TimingControlPoint CreateTimingControlPoint() => new LegacyDifficultyCalculatorControlPoint(); private class LegacyDifficultyCalculatorControlPoint : TimingControlPoint { public override double BeatLength { get; set; } = DEFAULT_BEAT_LENGTH; } } }
Add difficulty calculator beatmap decoder fallback
Add difficulty calculator beatmap decoder fallback
C#
mit
NeoAdonis/osu,johnneijzen/osu,NeoAdonis/osu,peppy/osu-new,2yangk23/osu,ppy/osu,UselessToucan/osu,peppy/osu,ppy/osu,UselessToucan/osu,peppy/osu,peppy/osu,2yangk23/osu,ppy/osu,EVAST9919/osu,EVAST9919/osu,ZLima12/osu,ZLima12/osu,smoogipoo/osu,smoogipooo/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,johnneijzen/osu
b250ea3aada297a1c2ee8f8a3c00ccaaee36e500
Tile.cs
Tile.cs
using System; using HexWorld.Enums; namespace HexWorld { public class Tile { public TileTypes Type { get; set; } public bool IsWater { get; set; } public string Printable { get; set; } public Tile(TileTypes type) { ChangeTile(type); } public void ChangeTile(TileTypes type) { Type = type; switch (Type) { case TileTypes.Ocean: IsWater = true; // Printable = "▓▓▓"; Printable = " "; break; case TileTypes.Desert: IsWater = false; Printable = "░░░"; break; case TileTypes.Mountain: IsWater = false; Printable = "╔╬╗"; break; case TileTypes.Hill: IsWater = false; Printable = "▅▂▅"; break; case TileTypes.Grassland: IsWater = false; Printable = "▒▒▒"; break; case TileTypes.Steppe: IsWater = false; Printable = "░▒░"; break; case TileTypes.Tundra: IsWater = false; Printable = "***"; break; default: throw new ArgumentException("Unknown Tile Type"); } } public override string ToString() { return Printable; } } }
using System; using HexWorld.Enums; namespace HexWorld { public class Tile { public TileTypes Type { get; set; } public bool IsWater { get; set; } public string Printable { get; set; } public Tile(TileTypes type) { ChangeTile(type); } public void ChangeTile(TileTypes type) { Type = type; switch (Type) { case TileTypes.Ocean: IsWater = true; // Printable = "▓▓▓"; Printable = " "; break; case TileTypes.Desert: IsWater = false; Printable = "░░░"; break; case TileTypes.Mountain: IsWater = false; Printable = "╔╬╗"; break; case TileTypes.Hill: IsWater = false; Printable = "▅▂▅"; break; case TileTypes.Grassland: IsWater = false; Printable = "▒▒▒"; break; case TileTypes.Steppe: IsWater = false; Printable = "░▒░"; break; case TileTypes.Tundra: IsWater = false; Printable = "***"; break; case TileTypes.Jungle: IsWater = false; Printable = "╫╫╫"; break; case TileTypes.Forest: IsWater = false; Printable = "┼┼┼"; break; case TileTypes.Swamp: IsWater = false; Printable = "▚▞▜"; break; default: throw new ArgumentException("Unknown Tile Type"); } } public override string ToString() { return Printable; } } }
Test data for last 3 tile types.
Test data for last 3 tile types.
C#
mit
DmitriiP/HexWorld
87e88f9fffca78c8a99410dc85174ba5c1c1b49f
testproj/UnitTest1.cs
testproj/UnitTest1.cs
namespace testproj { using System; using JetBrains.dotMemoryUnit; using NUnit.Framework; [TestFixture] public class UnitTest1 { [Test] public void TestMethod1() { dotMemory.Check( memory => { var str1 = "1"; var str2 = "2"; var str3 = "3"; Assert.LessOrEqual(2, memory.ObjectsCount); Console.WriteLine(str1 + str2 + str3); }); } } }
namespace testproj { using System; using System.Collections.Generic; using JetBrains.dotMemoryUnit; using NUnit.Framework; [TestFixture] public class UnitTest1 { [Test] public void TestMethod1() { var strs = new List<string>(); var memoryCheckPoint = dotMemory.Check(); strs.Add(GenStr()); strs.Add(GenStr()); strs.Add(GenStr()); dotMemory.Check( memory => { var strCount = memory .GetDifference(memoryCheckPoint) .GetNewObjects() .GetObjects(i => i.Type == typeof(string)) .ObjectsCount; Assert.LessOrEqual(strCount, 2); }); strs.Clear(); } [Test] public void TestMethod2() { var strs = new List<string>(); var memoryCheckPoint = dotMemory.Check(); strs.Add(GenStr()); strs.Add(GenStr()); dotMemory.Check( memory => { var strCount = memory .GetDifference(memoryCheckPoint) .GetNewObjects() .GetObjects(i => i.Type == typeof(string)) .ObjectsCount; Assert.LessOrEqual(strCount, 2); }); strs.Clear(); } private static string GenStr() { return Guid.NewGuid().ToString(); } } }
Add broken test to testproj
Add broken test to testproj
C#
apache-2.0
JetBrains/teamcity-dotmemory,JetBrains/teamcity-dotmemory
358b8cc2ddcb8829b61ff8b0c7c5419d7178b7b9
Assets/Scripts/Player/PlayerState.cs
Assets/Scripts/Player/PlayerState.cs
using UnityEngine; using UnityEngine.Networking; public class PlayerState : NetworkBehaviour { [SyncVar] string fakingTheory; [SyncVar] int score; void Start() { fakingTheory = null; score = 0; } [Command] public void CmdSetFakingState(string newFakingTheory) { fakingTheory = newFakingTheory; } [Command] public void CmdAddScore(int value) { score += value; } public bool IsFaking() { return (fakingTheory != null); } void OnGUI() { if (!isLocalPlayer) { return; } GUI.BeginGroup(new Rect(Screen.width / 2 - 100, Screen.height - 100, 200, 200)); GUILayout.Label("Score: " + score); if (IsFaking()) { GUILayout.Label("Faking using " + fakingTheory); } GUI.EndGroup(); } }
using System; using UnityEngine; using UnityEngine.Networking; public class PlayerState : NetworkBehaviour { [SyncVar] string fakingTheory; [SyncVar] int score; void Start() { fakingTheory = null; score = 0; } [Command] public void CmdSetFakingState(string newFakingTheory) { fakingTheory = newFakingTheory; } [Command] public void CmdAddScore(int value) { score += value; } public bool IsFaking() { return !String.IsNullOrEmpty(fakingTheory); } void OnGUI() { if (!isLocalPlayer) { return; } GUI.BeginGroup(new Rect(Screen.width / 2 - 100, Screen.height - 100, 200, 200)); GUILayout.Label("Score: " + score); if (IsFaking()) { GUILayout.Label("Faking using " + fakingTheory); } GUI.EndGroup(); } }
Fix the player score counter (IsFaking always returned true)
Fix the player score counter (IsFaking always returned true)
C#
mit
Nagasaki45/UnsocialVR,Nagasaki45/UnsocialVR
f5e918707e4b12ac6ca1838d0d8e6e60801abc42
Gitter/Gitter/Gitter.Shared/Services/Concrete/BackgroundTaskService.cs
Gitter/Gitter/Gitter.Shared/Services/Concrete/BackgroundTaskService.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Windows.ApplicationModel.Background; using Gitter.Services.Abstract; namespace Gitter.Services.Concrete { public class BackgroundTaskService : IBackgroundTaskService { public Dictionary<string, string> Tasks { get { return new Dictionary<string, string> { {"NotificationsBackgroundTask", "Gitter.Tasks"} }; } } public async Task RegisterTasksAsync() { foreach (var kvTask in Tasks) { if (BackgroundTaskRegistration.AllTasks.Any(task => task.Value.Name == kvTask.Key)) break; await RegisterTaskAsync(kvTask.Key, kvTask.Value); } } private async Task RegisterTaskAsync(string taskName, string taskNamespace) { var requestAccess = await BackgroundExecutionManager.RequestAccessAsync(); if (requestAccess == BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity || requestAccess == BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity) { var taskBuilder = new BackgroundTaskBuilder { Name = taskName, TaskEntryPoint = string.Format("{0}.{1}", taskNamespace, taskName) }; // Set the condition trigger that feels right for you taskBuilder.SetTrigger(new TimeTrigger(15, false)); taskBuilder.Register(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Windows.ApplicationModel.Background; using Gitter.Services.Abstract; namespace Gitter.Services.Concrete { public class BackgroundTaskService : IBackgroundTaskService { public Dictionary<string, string> Tasks { get { return new Dictionary<string, string> { {"NotificationsBackgroundTask", "Gitter.Tasks"} }; } } public async Task RegisterTasksAsync() { foreach (var kvTask in Tasks) { if (BackgroundTaskRegistration.AllTasks.Any(task => task.Value.Name == kvTask.Key)) break; await RegisterTaskAsync(kvTask.Key, kvTask.Value); } } private async Task RegisterTaskAsync(string taskName, string taskNamespace) { var requestAccess = await BackgroundExecutionManager.RequestAccessAsync(); if (requestAccess == BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity || requestAccess == BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity) { var taskBuilder = new BackgroundTaskBuilder { Name = taskName, TaskEntryPoint = string.Format("{0}.{1}", taskNamespace, taskName) }; // Set the condition trigger that feels right for you taskBuilder.SetTrigger(new TimeTrigger(15, false)); taskBuilder.AddCondition(new SystemCondition(SystemConditionType.InternetAvailable)); taskBuilder.AddCondition(new SystemCondition(SystemConditionType.UserNotPresent)); taskBuilder.Register(); } } } }
Add conditions to background tasks
Add conditions to background tasks
C#
apache-2.0
Odonno/Modern-Gitter
1063474b0e5f6f00a217aa3b26c3536589c49c47
Mindscape.Raygun4Net.Xamarin.iOS/RaygunSettings.cs
Mindscape.Raygun4Net.Xamarin.iOS/RaygunSettings.cs
using System; namespace Mindscape.Raygun4Net { public class RaygunSettings { private static RaygunSettings settings; private const string DefaultApiEndPoint = "https://api.raygun.io/entries"; private const string DefaultPulseEndPoint = "https://api.raygun.io/events"; public static RaygunSettings Settings { get { return settings ?? (settings = new RaygunSettings { ApiEndpoint = new Uri(DefaultApiEndPoint), PulseEndpoint = new Uri(DefaultPulseEndPoint) }); } } public Uri ApiEndpoint { get; set; } public Uri PulseEndpoint{ get; set; } } }
using System; namespace Mindscape.Raygun4Net { public class RaygunSettings { private static RaygunSettings settings; private const string DefaultApiEndPoint = "https://api.raygun.io/entries"; private const string DefaultPulseEndPoint = "https://api.raygun.io/events"; public static RaygunSettings Settings { get { return settings ?? (settings = new RaygunSettings { ApiEndpoint = new Uri(DefaultApiEndPoint), PulseEndpoint = new Uri(DefaultPulseEndPoint) }); } } public Uri ApiEndpoint { get; set; } public Uri PulseEndpoint{ get; set; } public bool SetUnobservedTaskExceptionsAsObserved { get; set; } } }
Add option to mark exceptions as observed
Add option to mark exceptions as observed
C#
mit
MindscapeHQ/raygun4net,MindscapeHQ/raygun4net,MindscapeHQ/raygun4net
2e96740ac27e3e36155920eb4c0bb3aa15e46d21
Gui/RootedObjectEventHandler.cs
Gui/RootedObjectEventHandler.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MatterHackers.Agg.UI { public class RootedObjectEventHandler { EventHandler InternalEvent; public void RegisterEvent(EventHandler functionToCallOnEvent, ref EventHandler functionThatWillBeCalledToUnregisterEvent) { InternalEvent += functionToCallOnEvent; functionThatWillBeCalledToUnregisterEvent += (sender, e) => { InternalEvent -= functionToCallOnEvent; }; } public void UnregisterEvent(EventHandler functionToCallOnEvent, ref EventHandler functionThatWillBeCalledToUnregisterEvent) { InternalEvent -= functionToCallOnEvent; // After we remove it it will still be removed again in the functionThatWillBeCalledToUnregisterEvent // But it is valid to attempt remove more than once. } public void CallEvents(Object sender, EventArgs e) { if (InternalEvent != null) { InternalEvent(this, e); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MatterHackers.Agg.UI { public class RootedObjectEventHandler { #if DEBUG private event EventHandler InternalEventForDebug; private List<EventHandler> DebugEventDelegates = new List<EventHandler>(); private event EventHandler InternalEvent { //Wraps the PrivateClick event delegate so that we can track which events have been added and clear them if necessary add { InternalEventForDebug += value; DebugEventDelegates.Add(value); } remove { InternalEventForDebug -= value; DebugEventDelegates.Remove(value); } } #else EventHandler InternalEvent; #endif public void RegisterEvent(EventHandler functionToCallOnEvent, ref EventHandler functionThatWillBeCalledToUnregisterEvent) { InternalEvent += functionToCallOnEvent; functionThatWillBeCalledToUnregisterEvent += (sender, e) => { InternalEvent -= functionToCallOnEvent; }; } public void UnregisterEvent(EventHandler functionToCallOnEvent, ref EventHandler functionThatWillBeCalledToUnregisterEvent) { InternalEvent -= functionToCallOnEvent; // After we remove it it will still be removed again in the functionThatWillBeCalledToUnregisterEvent // But it is valid to attempt remove more than once. } public void CallEvents(Object sender, EventArgs e) { #if DEBUG if (InternalEventForDebug != null) { InternalEventForDebug(this, e); } #else if (InternalEvent != null) { InternalEvent(this, e); } #endif } } }
Put in some debugging code for looking at what functions have been added to the rooted event handler.
Put in some debugging code for looking at what functions have been added to the rooted event handler.
C#
bsd-2-clause
MatterHackers/agg-sharp,LayoutFarm/PixelFarm,mmoening/agg-sharp,mmoening/agg-sharp,jlewin/agg-sharp,mmoening/agg-sharp,larsbrubaker/agg-sharp
11bd8791bf8e60b2c8a2b942eb2b31972828643b
GrinerTest/PolygonClip/insert.cs
GrinerTest/PolygonClip/insert.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GrienerTest { public partial class PolygonClip { #if false void insert(node *ins, node *first, node *last) { node *aux=first; while(aux != last && aux->alpha < ins->alpha) aux = aux->next; ins->next = aux; ins->prev = aux->prev; ins->prev->next = ins; ins->next->prev = ins; } #endif void insert(Node ins,Node first,Node last) { Node aux = first; while (aux != last && aux.alpha < ins.alpha) aux = aux.next; ins.next = aux; ins.prev = aux.prev; ins.prev.next = ins; ins.next.prev = ins; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GrienerTest { public partial class PolygonClip { #if false void insert(node *ins, node *first, node *last) { node *aux=first; while(aux != last && aux->alpha < ins->alpha) aux = aux->next; ins->next = aux; ins->prev = aux->prev; ins->prev->next = ins; ins->next->prev = ins; } #endif void insert(Node ins,Node first,Node last) { Node aux = first; while (aux != last && aux.alpha < ins.alpha) aux = aux.next; ins.next = aux; ins.prev = aux.prev; /* * Feb 2017. Check against null pointer */ if (ins.prev != null) { ins.prev.next = ins; } if (ins.next != null) { ins.next.prev = ins; } } } }
Add in check for null pointers.
Add in check for null pointers.
C#
unlicense
johnmott59/PolygonClippingInCSharp
163a9d74f7f75a330335b06e0b5f0246a02877a5
ZirMed.TrainingSandbox/Views/Home/Contact.cshtml
ZirMed.TrainingSandbox/Views/Home/Contact.cshtml
@{ ViewBag.Title = "Contact"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <address> One Microsoft Way<br /> Redmond, WA 98052-6399<br /> <abbr title="Phone">P:</abbr> 425.555.0100 </address> <address> <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br /> <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a> <strong>Pat:</strong> <a href="mailto:patrick.fulton@zirmed.com">patrick.fulton@zirmed.com</a> <strong>Dustin:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> </address>
@{ ViewBag.Title = "Contact"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <address> One Microsoft Way<br /> Redmond, WA 98052-6399<br /> <abbr title="Phone">P:</abbr> 425.555.0100 </address> <address> <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br /> <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a> <strong>Pat:</strong> <a href="mailto:patrick.fulton@zirmed.com">patrick.fulton@zirmed.com</a> <strong>Dustin:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> <strong>Nicolas:</strong> <a href="mailto:nick.wolf@zirmed.com">nick.wolf@zirmed.com</a> </address>
Add nick wolf contact info.
Add nick wolf contact info.
C#
mit
jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox
db75332cde309ad10a40aa1136db0b7120e2b6de
JustEnoughVi/ChangeInnerBlock.cs
JustEnoughVi/ChangeInnerBlock.cs
using System; using Mono.TextEditor; using ICSharpCode.NRefactory; namespace JustEnoughVi { public class ChangeInnerBlock : ChangeCommand { public ChangeInnerBlock(TextEditorData editor, char openingChar, char closingChar) : base(editor, TextObject.InnerBlock, openingChar, closingChar) { } protected override void Run() { CommandRange range = _selector(); ChangeRange(range); if (range != CommandRange.Empty) { // Move caret inside if it is on on opening character and block is empty if (range.Length == 0 && Editor.Caret.Offset < range.Start) Editor.Caret.Offset++; else { // if block still has two newlines inside, then drop inside block and indent int del1 = NewLine.GetDelimiterLength(Editor.Text[range.Start - 1], Editor.Text[range.Start]); if (del1 > 0) { int del2Start = range.Start - 1 + del1; int del2 = NewLine.GetDelimiterLength(Editor.Text[del2Start], Editor.Text[del2Start + 1]); if (del2 > 0) IndentInsideBlock(range.Start); } } } } private void IndentInsideBlock(int blockStart) { int end = blockStart; while (Char.IsWhiteSpace(Editor.Text[end])) end++; Editor.SetSelection(blockStart, end); Editor.DeleteSelectedText(); MiscActions.InsertNewLine(Editor); } } }
using System; using Mono.TextEditor; using ICSharpCode.NRefactory.Utils; using ICSharpCode.NRefactory; namespace JustEnoughVi { public class ChangeInnerBlock : ChangeCommand { public ChangeInnerBlock(TextEditorData editor, char openingChar, char closingChar) : base(editor, TextObject.InnerBlock, openingChar, closingChar) { } protected override void Run() { CommandRange range = _selector(); ChangeRange(range); if (range != CommandRange.Empty) { // Move caret inside if it is on on opening character and block is empty if (range.Length == 0 && Editor.Caret.Offset < range.Start) Editor.Caret.Offset++; else { // if block still has two newlines inside, then drop inside block and indent int del1 = NewLine.GetDelimiterLength(Editor.Text[range.Start - 1], Editor.Text[range.Start]); if (del1 > 0) { int del2Start = range.Start - 1 + del1; int del2 = NewLine.GetDelimiterLength(Editor.Text[del2Start], Editor.Text[del2Start + 1]); if (del2 > 0) IndentInsideBlock(range.Start - 2); } } } } private void IndentInsideBlock(int openingChar) { string indentation = Editor.GetLineIndent(Editor.OffsetToLineNumber(openingChar)); if (indentation != null && indentation.Length > 0) Editor.Insert(Editor.Caret.Offset, indentation); MiscActions.InsertTab(Editor); } } }
Fix indentation when changing inside multiline block
Fix indentation when changing inside multiline block
C#
mit
hifi/monodevelop-justenoughvi
dd033df831319768a5cc6993f7e0ad1886f7de18
DynaShape/Properties/AssemblyInfo.cs
DynaShape/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("DynaShape")] [assembly: AssemblyDescription("Open-source Dynamo plugin for constraint-based form finding, optimization and physics simulation")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DynaShape")] [assembly: AssemblyCopyright("MIT License © 2017 Long Nguyen")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("157ad178-ee17-46e9-b6dc-c50eb9dcca60")] [assembly: AssemblyVersion("0.3.1.2")] [assembly: AssemblyFileVersion("0.3.1.2")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("DynaShape")] [assembly: AssemblyDescription("Open-source Dynamo plugin for constraint-based form finding, optimization and physics simulation")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DynaShape")] [assembly: AssemblyCopyright("MIT License © 2017 Long Nguyen")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("157ad178-ee17-46e9-b6dc-c50eb9dcca60")] [assembly: AssemblyVersion("0.3.2.0")] [assembly: AssemblyFileVersion("0.3.2.0")]
Set AssemblyVersion number correctly to 0.3.2
Set AssemblyVersion number correctly to 0.3.2
C#
mit
LongNguyenP/DynaShape
90fb3e781983ae8d0caa14dc21bb0fb32df5755b
EvilDICOM.Core/EvilDICOM.Core/IO/Writing/DICOMBinaryWriter.cs
EvilDICOM.Core/EvilDICOM.Core/IO/Writing/DICOMBinaryWriter.cs
using System; using System.IO; using System.Text; namespace EvilDICOM.Core.IO.Writing { public class DICOMBinaryWriter : IDisposable { private readonly BinaryWriter _writer; /// <summary> /// Constructs a new writer from a file path. /// </summary> /// <param name="filePath">path to the file to be written</param> public DICOMBinaryWriter(string filePath) { _writer = new BinaryWriter( File.Open(filePath, FileMode.Create), Encoding.UTF8); } public DICOMBinaryWriter(Stream stream) { _writer = new BinaryWriter(stream, Encoding.UTF8); } public void Dispose() { _writer.Dispose(); } public void Write(byte b) { _writer.Write(b); } public void Write(byte[] bytes) { _writer.Write(bytes); } public void Write(char[] chars) { _writer.Write(chars); } public void Write(string chars) { char[] asCharArray = chars.ToCharArray(0, chars.Length); Write(asCharArray); } public void WriteNullBytes(int numberToWrite) { for (int i = 0; i < numberToWrite; i++) { Write(0x00); } } } }
using System; using System.IO; using System.Text; namespace EvilDICOM.Core.IO.Writing { public class DICOMBinaryWriter : IDisposable { private readonly BinaryWriter _writer; /// <summary> /// Constructs a new writer from a file path. /// </summary> /// <param name="filePath">path to the file to be written</param> public DICOMBinaryWriter(string filePath) { _writer = new BinaryWriter( File.Open(filePath, FileMode.Create), Encoding.UTF8); } public DICOMBinaryWriter(Stream stream) { _writer = new BinaryWriter(stream, Encoding.UTF8); } public void Dispose() { _writer.Dispose(); } public void Write(byte b) { _writer.Write(b); } public void Write(byte[] bytes) { _writer.Write(bytes); } public void Write(char[] chars) { _writer.Write(chars); } public void Write(string chars) { char[] asCharArray = chars.ToCharArray(); Write(asCharArray); } public void WriteNullBytes(int numberToWrite) { for (int i = 0; i < numberToWrite; i++) { Write(0x00); } } } }
Use portable ToCharArray overload yielding equivalent result
Use portable ToCharArray overload yielding equivalent result
C#
mit
cureos/Evil-DICOM,SuneBuur/Evil-DICOM
f225445b69b515d0da07cd15dd313406f3d02990
build/scripts/utilities.cake
build/scripts/utilities.cake
#tool "nuget:?package=GitVersion.CommandLine" #addin "Cake.Yaml" public class ContextInfo { public string NugetVersion { get; set; } public string AssemblyVersion { get; set; } public GitVersion Git { get; set; } public string BuildVersion { get { return NugetVersion + "-" + Git.Sha; } } } ContextInfo _versionContext = null; public ContextInfo VersionContext { get { if(_versionContext == null) throw new Exception("The current context has not been read yet. Call ReadContext(FilePath) before accessing the property."); return _versionContext; } } public ContextInfo ReadContext(FilePath filepath) { _versionContext = DeserializeYamlFromFile<ContextInfo>(filepath); _versionContext.Git = GitVersion(); return _versionContext; } public void UpdateAppVeyorBuildVersionNumber() { var increment = 0; while(increment < 10) { try { var version = VersionContext.BuildVersion; if(increment > 0) version += "-" + increment; AppVeyor.UpdateBuildVersion(version); break; } catch { increment++; } } }
#tool "nuget:?package=GitVersion.CommandLine" #addin "Cake.Yaml" public class ContextInfo { public string NugetVersion { get; set; } public string AssemblyVersion { get; set; } public GitVersion Git { get; set; } public string BuildVersion { get { return NugetVersion + "-" + Git.Sha; } } } ContextInfo _versionContext = null; public ContextInfo VersionContext { get { if(_versionContext == null) throw new Exception("The current context has not been read yet. Call ReadContext(FilePath) before accessing the property."); return _versionContext; } } public ContextInfo ReadContext(FilePath filepath) { _versionContext = DeserializeYamlFromFile<ContextInfo>(filepath); try { _versionContext.Git = GitVersion(); } catch { _versionContext.Git = new Cake.Common.Tools.GitVersion.GitVersion(); } return _versionContext; } public void UpdateAppVeyorBuildVersionNumber() { var increment = 0; while(increment < 10) { try { var version = VersionContext.BuildVersion; if(increment > 0) version += "-" + increment; AppVeyor.UpdateBuildVersion(version); break; } catch { increment++; } } }
Allow to run build even if git repo informations are not available
Allow to run build even if git repo informations are not available
C#
mit
Abc-Arbitrage/Zebus,biarne-a/Zebus
217c5774a1c148c66489346fdda63de87665a7ce
src/ColorTools/Program.cs
src/ColorTools/Program.cs
using System; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Shapes; class Program { [STAThread] static void Main(string[] args) { var app = new Application(); var window = new Window(); window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.WindowState = WindowState.Maximized; window.Title = "SystemColors"; var content = new ListBox(); foreach (var prop in typeof(SystemColors).GetProperties().Where(p => p.PropertyType == typeof(SolidColorBrush))) { var brush = prop.GetValue(null) as SolidColorBrush; var rect = new Rectangle() { Width = 100, Height = 20, Fill = brush }; var panel = new StackPanel() { Orientation = Orientation.Horizontal }; panel.Children.Add(new TextBlock() { Text = prop.Name, Width = 200 }); panel.Children.Add(rect); panel.Children.Add(new TextBlock() { Text = brush.Color.ToString(), Margin = new Thickness(8, 0, 8, 0) }); content.Items.Add(panel); } window.Content = content; app.Run(window); } }
using System; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Shapes; class Program { [STAThread] static void Main(string[] args) { var app = new Application(); var window = new Window(); window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.WindowState = WindowState.Maximized; window.Title = "SystemColors"; var content = new ListBox(); var sb = new StringBuilder(); foreach (var prop in typeof(SystemColors).GetProperties().Where(p => p.PropertyType == typeof(SolidColorBrush))) { var brush = prop.GetValue(null) as SolidColorBrush; var rect = new Rectangle() { Width = 100, Height = 20, Fill = brush }; var panel = new StackPanel() { Orientation = Orientation.Horizontal }; panel.Children.Add(new TextBlock() { Text = prop.Name, Width = 200 }); panel.Children.Add(rect); panel.Children.Add(new TextBlock() { Text = brush.Color.ToString(), Margin = new Thickness(8, 0, 8, 0) }); content.Items.Add(panel); } foreach (var prop in typeof(Colors).GetProperties().Where(p => p.PropertyType == typeof(Color))) { var color = (Color)prop.GetValue(null); sb.AppendLine($"{color.R / 255.0}, {color.G / 255.0}, {color.B / 255.0},"); //sb.AppendLine($"{color.ScR}, {color.ScG}, {color.ScB},"); } // Clipboard.SetText(sb.ToString()); window.Content = content; app.Run(window); } }
Add some code to dump known colors
Add some code to dump known colors
C#
mit
KirillOsenkov/ColorTools,KirillOsenkov/ColorTools,KirillOsenkov/ColorTools
80c03aa7ffc6cfddaef97543c01fdfec8bd7d4de
Twee2Z/Analyzer/TweeAnalyzer.cs
Twee2Z/Analyzer/TweeAnalyzer.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using Antlr4.Runtime; using Antlr4.Runtime.Misc; using Antlr4.Runtime.Tree; namespace Twee2Z.Analyzer { public static class TweeAnalyzer { public static ObjectTree.Tree Parse(StreamReader input) { return Parse2(Lex(input)); } public static ObjectTree.Tree Parse2(CommonTokenStream input) { System.Console.WriteLine("Parse twee file ..."); Twee.StartContext startContext = new Twee(input).start(); TweeVisitor visit = new TweeVisitor(); visit.Visit(startContext); System.Console.WriteLine("Convert parse tree into object tree ..."); return visit.Tree; } public static CommonTokenStream Lex(StreamReader input) { System.Console.WriteLine("Lex twee file ..."); AntlrInputStream antlrStream = new AntlrInputStream(input.ReadToEnd()); return new CommonTokenStream(new LEX(antlrStream)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using Antlr4.Runtime; using Antlr4.Runtime.Misc; using Antlr4.Runtime.Tree; namespace Twee2Z.Analyzer { public static class TweeAnalyzer { public static ObjectTree.Tree Parse(StreamReader input) { return Parse2(Lex(input)); } public static ObjectTree.Tree Parse2(CommonTokenStream input) { System.Console.WriteLine("Parse twee file ..."); Twee.StartContext startContext = new Twee(input).start(); TweeVisitor visit = new TweeVisitor(); visit.Visit(startContext); System.Console.WriteLine("Convert parse tree into object tree ..."); return visit.Tree; } public static CommonTokenStream Lex(StreamReader input) { System.Console.WriteLine("Lex twee file ..."); AntlrInputStream antlrStream = new AntlrInputStream(input.ReadToEnd()); return new CommonTokenStream(new LEX(antlrStream)); } } }
Revert "Revert "auswertung von tags gebessert""
Revert "Revert "auswertung von tags gebessert"" This reverts commit 59db5d111a7f8c11a188c031bc82bbfc114b70ce.
C#
mit
humsp/uebersetzerbauSWP
e089806577e0afc70eb2f234eee4ea264d44c04e
src/Eurofurence.App.Server.Services/Storage/StorageService.cs
src/Eurofurence.App.Server.Services/Storage/StorageService.cs
using System; using System.Threading.Tasks; using Eurofurence.App.Domain.Model.Abstractions; using Eurofurence.App.Domain.Model.Sync; using Eurofurence.App.Server.Services.Abstractions; namespace Eurofurence.App.Server.Services.Storage { public class StorageService<T> : IStorageService { private readonly IEntityStorageInfoRepository _entityStorageInfoRepository; private readonly string _entityType; public StorageService(IEntityStorageInfoRepository entityStorageInfoRepository, string entityType) { _entityStorageInfoRepository = entityStorageInfoRepository; _entityType = entityType; } public async Task TouchAsync() { var record = await GetEntityStorageRecordAsync(); record.LastChangeDateTimeUtc = DateTime.UtcNow; await _entityStorageInfoRepository.ReplaceOneAsync(record); } public async Task ResetDeltaStartAsync() { var record = await GetEntityStorageRecordAsync(); record.DeltaStartDateTimeUtc = DateTime.UtcNow; await _entityStorageInfoRepository.ReplaceOneAsync(record); } public Task<EntityStorageInfoRecord> GetStorageInfoAsync() { return GetEntityStorageRecordAsync(); } private async Task<EntityStorageInfoRecord> GetEntityStorageRecordAsync() { var record = await _entityStorageInfoRepository.FindOneAsync(_entityType); if (record == null) { record = new EntityStorageInfoRecord {EntityType = _entityType}; record.NewId(); record.Touch(); await _entityStorageInfoRepository.InsertOneAsync(record); } return record; } } }
using System; using System.Threading.Tasks; using Eurofurence.App.Domain.Model.Abstractions; using Eurofurence.App.Domain.Model.Sync; using Eurofurence.App.Server.Services.Abstractions; namespace Eurofurence.App.Server.Services.Storage { public class StorageService<T> : IStorageService { private readonly IEntityStorageInfoRepository _entityStorageInfoRepository; private readonly string _entityType; public StorageService(IEntityStorageInfoRepository entityStorageInfoRepository, string entityType) { _entityStorageInfoRepository = entityStorageInfoRepository; _entityType = entityType; } public async Task TouchAsync() { var record = await GetEntityStorageRecordAsync(); record.LastChangeDateTimeUtc = DateTime.UtcNow; await _entityStorageInfoRepository.ReplaceOneAsync(record); } public async Task ResetDeltaStartAsync() { var record = await GetEntityStorageRecordAsync(); record.DeltaStartDateTimeUtc = DateTime.UtcNow; await _entityStorageInfoRepository.ReplaceOneAsync(record); } public Task<EntityStorageInfoRecord> GetStorageInfoAsync() { return GetEntityStorageRecordAsync(); } private async Task<EntityStorageInfoRecord> GetEntityStorageRecordAsync() { var record = await _entityStorageInfoRepository.FindOneAsync(_entityType); if (record == null) { record = new EntityStorageInfoRecord { EntityType = _entityType, DeltaStartDateTimeUtc = DateTime.UtcNow }; record.NewId(); record.Touch(); await _entityStorageInfoRepository.InsertOneAsync(record); } return record; } } }
Fix to ensure Delta start time is reset when storage is re-created
Fix to ensure Delta start time is reset when storage is re-created
C#
mit
Pinselohrkater/ef_app-backend-dotnet_core,Pinselohrkater/ef_app-backend-dotnet_core,eurofurence/ef-app_backend-dotnet-core,eurofurence/ef-app_backend-dotnet-core
953f7a999556611fa20fb2f57c3552271f4becd6
VendingMachine/VendingMachine.Core/VendingMachine.cs
VendingMachine/VendingMachine.Core/VendingMachine.cs
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Vending.Core { public class VendingMachine { private readonly List<Coin> _coins = new List<Coin>(); private readonly List<Coin> _returnTray = new List<Coin>(); private readonly List<string> _output = new List<string>(); public IEnumerable<Coin> ReturnTray => _returnTray; public IEnumerable<string> Output => _output; public void Dispense(string sku) { _output.Add(sku); } public void Accept(Coin coin) { if (coin.Value() == 0) { _returnTray.Add(coin); return; } _coins.Add(coin); } public string GetDisplayText() { if (!_coins.Any()) { return "INSERT COIN"; } return $"{CurrentTotal():C}"; } private decimal CurrentTotal() { var counts = new Dictionary<Coin, int>() { {Coin.Nickel, 0}, {Coin.Dime, 0}, {Coin.Quarter, 0} }; foreach (var coin in _coins) { counts[coin]++; } decimal total = 0; foreach (var coinCount in counts) { total += (coinCount.Value * coinCount.Key.Value()); } return ConvertCentsToDollars(total); } private static decimal ConvertCentsToDollars(decimal total) { return total / 100; } } }
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Vending.Core { public class VendingMachine { private readonly List<Coin> _coins = new List<Coin>(); private readonly List<Coin> _returnTray = new List<Coin>(); public IEnumerable<Coin> ReturnTray => _returnTray; public void Dispense(string soda) { } public void Accept(Coin coin) { if (coin.Value() == 0) { _returnTray.Add(coin); return; } _coins.Add(coin); } public string GetDisplayText() { if (!_coins.Any()) { return "INSERT COIN"; } return $"{CurrentTotal():C}"; } private decimal CurrentTotal() { var counts = new Dictionary<Coin, int>() { {Coin.Nickel, 0}, {Coin.Dime, 0}, {Coin.Quarter, 0} }; foreach (var coin in _coins) { counts[coin]++; } decimal total = 0; foreach (var coinCount in counts) { total += (coinCount.Value * coinCount.Key.Value()); } return ConvertCentsToDollars(total); } private static decimal ConvertCentsToDollars(decimal total) { return total / 100; } } }
Revert "Added place to output products"
Revert "Added place to output products" This reverts commit a4d3db1b46a642857651273f1d717b12d91f182b.
C#
mit
ckuhn203/VendingMachineKata
6110f556302d7cded305e238db57cedaea99bf0d
MainDemo.Wpf/Converters/BrushToHexConverter.cs
MainDemo.Wpf/Converters/BrushToHexConverter.cs
using System; using System.Globalization; using System.Windows.Data; using System.Windows.Media; namespace MaterialDesignDemo.Converters { public class BrushToHexConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) return null; string lowerHexString(int i) => i.ToString("X").ToLower(); var brush = (SolidColorBrush)value; var hex = lowerHexString(brush.Color.R) + lowerHexString(brush.Color.G) + lowerHexString(brush.Color.B); return "#" + hex; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
using System; using System.Globalization; using System.Windows.Data; using System.Windows.Media; namespace MaterialDesignDemo.Converters { public class BrushToHexConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) return null; string lowerHexString(int i) => i.ToString("X2").ToLower(); var brush = (SolidColorBrush)value; var hex = lowerHexString(brush.Color.R) + lowerHexString(brush.Color.G) + lowerHexString(brush.Color.B); return "#" + hex; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
Fix display of color code
Fix display of color code Fixes #1546
C#
mit
ButchersBoy/MaterialDesignInXamlToolkit,ButchersBoy/MaterialDesignInXamlToolkit,ButchersBoy/MaterialDesignInXamlToolkit
c880a577e9a0205685095efdc028c51da1a7f55a
RockLib.Messaging/IReceiver.cs
RockLib.Messaging/IReceiver.cs
using System; namespace RockLib.Messaging { /// <summary> /// Defines an interface for receiving messages. To start receiving messages, /// set the value of the <see cref="MessageHandler"/> property. /// </summary> public interface IReceiver : IDisposable { /// <summary> /// Gets the name of this instance of <see cref="IReceiver"/>. /// </summary> string Name { get; } /// <summary> /// Gets or sets the message handler for this receiver. When set, the receiver is started /// and will invoke the value's <see cref="IMessageHandler.OnMessageReceived"/> method /// when messages are received. /// </summary> IMessageHandler MessageHandler { get; set; } /// <summary> /// Occurs when a connection is established. /// </summary> event EventHandler Connected; /// <summary> /// Occurs when a connection is lost. /// </summary> event EventHandler<DisconnectedEventArgs> Disconnected; } }
using System; namespace RockLib.Messaging { /// <summary> /// Defines an interface for receiving messages. To start receiving messages, /// set the value of the <see cref="MessageHandler"/> property. /// </summary> public interface IReceiver : IDisposable { /// <summary> /// Gets the name of this instance of <see cref="IReceiver"/>. /// </summary> string Name { get; } /// <summary> /// Gets or sets the message handler for this receiver. When set, the receiver is started /// and will invoke the value's <see cref="IMessageHandler.OnMessageReceived"/> method /// when messages are received. /// </summary> /// <remarks> /// Implementions of this interface should not allow this property to be set to null or /// to be set more than once. /// </remarks> IMessageHandler MessageHandler { get; set; } /// <summary> /// Occurs when a connection is established. /// </summary> event EventHandler Connected; /// <summary> /// Occurs when a connection is lost. /// </summary> event EventHandler<DisconnectedEventArgs> Disconnected; } }
Add remark to doc comment
Add remark to doc comment
C#
mit
RockFramework/Rock.Messaging
285442c15f4767cca472d465c96949dd436eff4b
Citysim/City.cs
Citysim/City.cs
using Citysim.Map; namespace Citysim { public class City { /// <summary> /// Amount of cash available. /// </summary> public int cash = 10000; // $10,000 starting cash /// <summary> /// The world. Needs generation. /// </summary> public World world = new World(); } }
using Citysim.Map; namespace Citysim { public class City { /// <summary> /// Amount of cash available. /// </summary> public int cash = 10000; // $10,000 starting cash /// <summary> /// MW (mega watts) of electricity available to the city. /// </summary> public int power = 0; /// <summary> /// ML (mega litres) of water available to the city. /// </summary> public int water = 0; /// <summary> /// The world. Needs generation. /// </summary> public World world = new World(); } }
Add city power and water variables.
Add city power and water variables.
C#
mit
mitchfizz05/Citysim,pigant/Citysim
cfef767cc81b58278386affe8e500987c2f4a776
source/Nuke.Common/Utilities/AssemblyExtensions.cs
source/Nuke.Common/Utilities/AssemblyExtensions.cs
// Copyright 2018 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; using System.Reflection; namespace Nuke.Common.Utilities { public static class AssemblyExtensions { public static string GetInformationalText(this Assembly assembly) { return $"version {assembly.GetVersionText()} ({EnvironmentInfo.Platform}, {EnvironmentInfo.Framework})"; } public static string GetVersionText(this Assembly assembly) { var informationalVersion = assembly.GetAssemblyInformationalVersion(); var plusIndex = informationalVersion.IndexOf(value: '+'); return plusIndex == -1 ? "LOCAL" : informationalVersion.Substring(startIndex: 0, length: plusIndex); } private static string GetAssemblyInformationalVersion(this Assembly assembly) { return assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion; } } }
// Copyright 2018 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; using System.Reflection; namespace Nuke.Common.Utilities { public static class AssemblyExtensions { public static string GetInformationalText(this Assembly assembly) { return $"version {assembly.GetVersionText()} ({EnvironmentInfo.Platform},{EnvironmentInfo.Framework})"; } public static string GetVersionText(this Assembly assembly) { var informationalVersion = assembly.GetAssemblyInformationalVersion(); var plusIndex = informationalVersion.IndexOf(value: '+'); return plusIndex == -1 ? "LOCAL" : informationalVersion.Substring(startIndex: 0, length: plusIndex); } private static string GetAssemblyInformationalVersion(this Assembly assembly) { return assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion; } } }
Remove whitespace in informational text
Remove whitespace in informational text
C#
mit
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
ee0401405180eeecd129f5c9b3246f431df05850
template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/WebApi-CSharp/AzureAdB2COptions.cs
template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/WebApi-CSharp/AzureAdB2COptions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Company.WebApplication1 { public class AzureAdB2COptions { public string ClientId { get; set; } public string AzureAdB2CInstance { get; set; } public string Tenant { get; set; } public string SignUpSignInPolicyId { get; set; } public string DefaultPolicy => SignUpSignInPolicyId; public string Authority => $"{AzureAdB2CInstance}/{Tenant}/{DefaultPolicy}/v2.0"; public string Audience => ClientId; } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Company.WebApplication1 { public class AzureAdB2COptions { public string ClientId { get; set; } public string AzureAdB2CInstance { get; set; } public string Domain { get; set; } public string SignUpSignInPolicyId { get; set; } public string DefaultPolicy => SignUpSignInPolicyId; public string Authority => $"{AzureAdB2CInstance}/{Domain}/{DefaultPolicy}/v2.0"; public string Audience => ClientId; } }
Rename Tenant to Domain in the web api template
Rename Tenant to Domain in the web api template
C#
mit
seancpeters/templating,rschiefer/templating,danroth27/templating,rschiefer/templating,seancpeters/templating,lambdakris/templating,danroth27/templating,mlorbetske/templating,rschiefer/templating,lambdakris/templating,mlorbetske/templating,seancpeters/templating,seancpeters/templating,danroth27/templating,lambdakris/templating
25a0562a17f85f5bbb7944514d2013bb5a2b0410
src/VisualStudio/LiveShare/Test/ClassificationsHandlerTests.cs
src/VisualStudio/LiveShare/Test/ClassificationsHandlerTests.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.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol; using Xunit; namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests { public class ClassificationsHandlerTests : AbstractLiveShareRequestHandlerTests { [Fact] public async Task TestClassificationsAsync() { var markup = @"class A { void M() { {|classify:var|} i = 1; } }"; var (solution, ranges) = CreateTestSolution(markup); var classifyLocation = ranges["classify"].First(); var results = await TestHandleAsync<ClassificationParams, ClassificationSpan[]>(solution, CreateClassificationParams(classifyLocation)); AssertCollectionsEqual(new ClassificationSpan[] { CreateClassificationSpan("keyword", classifyLocation.Range) }, results, AssertClassificationsEqual); } private static void AssertClassificationsEqual(ClassificationSpan expected, ClassificationSpan actual) { Assert.Equal(expected.Classification, actual.Classification); Assert.Equal(expected.Range, actual.Range); } private static ClassificationSpan CreateClassificationSpan(string classification, Range range) => new ClassificationSpan() { Classification = classification, Range = range }; private static ClassificationParams CreateClassificationParams(Location location) => new ClassificationParams() { Range = location.Range, TextDocument = CreateTextDocumentIdentifier(location.Uri) }; } }
// 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.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol; using Xunit; namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests { public class ClassificationsHandlerTests : AbstractLiveShareRequestHandlerTests { [Fact] public async Task TestClassificationsAsync() { var markup = @"class A { void M() { {|classify:var|} i = 1; } }"; var (solution, ranges) = CreateTestSolution(markup); var classifyLocation = ranges["classify"].First(); var results = await TestHandleAsync<ClassificationParams, object[]>(solution, CreateClassificationParams(classifyLocation)); AssertCollectionsEqual(new ClassificationSpan[] { CreateClassificationSpan("keyword", classifyLocation.Range) }, results, AssertClassificationsEqual); } private static void AssertClassificationsEqual(ClassificationSpan expected, ClassificationSpan actual) { Assert.Equal(expected.Classification, actual.Classification); Assert.Equal(expected.Range, actual.Range); } private static ClassificationSpan CreateClassificationSpan(string classification, Range range) => new ClassificationSpan() { Classification = classification, Range = range }; private static ClassificationParams CreateClassificationParams(Location location) => new ClassificationParams() { Range = location.Range, TextDocument = CreateTextDocumentIdentifier(location.Uri) }; } }
Fix classification test to use object type.
Fix classification test to use object type.
C#
mit
dotnet/roslyn,sharwell/roslyn,jmarolf/roslyn,ErikSchierboom/roslyn,sharwell/roslyn,AlekseyTs/roslyn,genlu/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,ErikSchierboom/roslyn,gafter/roslyn,eriawan/roslyn,heejaechang/roslyn,aelij/roslyn,AmadeusW/roslyn,genlu/roslyn,agocke/roslyn,panopticoncentral/roslyn,diryboy/roslyn,stephentoub/roslyn,brettfo/roslyn,abock/roslyn,KirillOsenkov/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,physhi/roslyn,AlekseyTs/roslyn,bartdesmet/roslyn,agocke/roslyn,wvdd007/roslyn,AmadeusW/roslyn,davkean/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,panopticoncentral/roslyn,nguerrera/roslyn,dotnet/roslyn,davkean/roslyn,mgoertz-msft/roslyn,mavasani/roslyn,jmarolf/roslyn,weltkante/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,physhi/roslyn,tmat/roslyn,abock/roslyn,wvdd007/roslyn,sharwell/roslyn,tmat/roslyn,tmat/roslyn,heejaechang/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,genlu/roslyn,mavasani/roslyn,weltkante/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,physhi/roslyn,stephentoub/roslyn,davkean/roslyn,brettfo/roslyn,bartdesmet/roslyn,agocke/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,reaction1989/roslyn,mavasani/roslyn,panopticoncentral/roslyn,abock/roslyn,brettfo/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,tannergooding/roslyn,gafter/roslyn,aelij/roslyn,aelij/roslyn,weltkante/roslyn,diryboy/roslyn,reaction1989/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,wvdd007/roslyn,nguerrera/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,eriawan/roslyn,gafter/roslyn,jasonmalinowski/roslyn,stephentoub/roslyn,KevinRansom/roslyn,nguerrera/roslyn
84ec3d8465c78fe7916a8905cedbb83e1c85f168
Mappy/Program.cs
Mappy/Program.cs
namespace Mappy { using System; using System.Windows.Forms; using UI.Forms; public static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] public static void Main() { Application.ThreadException += Program.OnGuiUnhandedException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } private static void HandleUnhandledException(object o) { Exception e = o as Exception; if (e != null) { throw e; } } private static void OnGuiUnhandedException(object sender, System.Threading.ThreadExceptionEventArgs e) { HandleUnhandledException(e.Exception); } } }
namespace Mappy { using System; using System.IO; using System.Windows.Forms; using UI.Forms; public static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] public static void Main() { RemoveOldVersionSettings(); Application.ThreadException += Program.OnGuiUnhandedException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } private static void HandleUnhandledException(object o) { Exception e = o as Exception; if (e != null) { throw e; } } private static void OnGuiUnhandedException(object sender, System.Threading.ThreadExceptionEventArgs e) { HandleUnhandledException(e.Exception); } private static void RemoveOldVersionSettings() { string appDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); string oldDir = Path.Combine(appDir, @"Armoured_Fish"); try { if (Directory.Exists(oldDir)) { Directory.Delete(oldDir, true); } } catch (IOException) { // we don't care if this fails } } } }
Add code to remove all old settings
Add code to remove all old settings
C#
mit
MHeasell/Mappy,MHeasell/Mappy
e993f4be927a993c3d1abd21d58085625e953355
src/DotNetCore.CAP/ICapTransaction.Base.cs
src/DotNetCore.CAP/ICapTransaction.Base.cs
using System.Collections.Generic; using DotNetCore.CAP.Models; namespace DotNetCore.CAP { public abstract class CapTransactionBase : ICapTransaction { private readonly IDispatcher _dispatcher; private readonly IList<CapPublishedMessage> _bufferList; protected CapTransactionBase(IDispatcher dispatcher) { _dispatcher = dispatcher; _bufferList = new List<CapPublishedMessage>(1); } public bool AutoCommit { get; set; } public object DbTransaction { get; set; } protected internal virtual void AddToSent(CapPublishedMessage msg) { _bufferList.Add(msg); } protected void Flush() { foreach (var message in _bufferList) { _dispatcher.EnqueueToPublish(message); } } public abstract void Commit(); public abstract void Rollback(); public abstract void Dispose(); } }
using System.Collections.Generic; using DotNetCore.CAP.Models; namespace DotNetCore.CAP { public abstract class CapTransactionBase : ICapTransaction { private readonly IDispatcher _dispatcher; private readonly IList<CapPublishedMessage> _bufferList; protected CapTransactionBase(IDispatcher dispatcher) { _dispatcher = dispatcher; _bufferList = new List<CapPublishedMessage>(1); } public bool AutoCommit { get; set; } public object DbTransaction { get; set; } protected internal virtual void AddToSent(CapPublishedMessage msg) { _bufferList.Add(msg); } protected virtual void Flush() { foreach (var message in _bufferList) { _dispatcher.EnqueueToPublish(message); } _bufferList.Clear(); } public abstract void Commit(); public abstract void Rollback(); public abstract void Dispose(); } }
Fix flush unclaer data bugs.
Fix flush unclaer data bugs.
C#
mit
ouraspnet/cap,dotnetcore/CAP,dotnetcore/CAP,dotnetcore/CAP
0697c78826e7fd14d001dbd9de2a6073635bb77b
osu.Framework.Tests/Audio/DevicelessAudioTest.cs
osu.Framework.Tests/Audio/DevicelessAudioTest.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; namespace osu.Framework.Tests.Audio { [TestFixture] public class DevicelessAudioTest : AudioThreadTest { public override void SetUp() { base.SetUp(); // lose all devices Manager.SimulateDeviceLoss(); } [Test] public void TestPlayTrackWithoutDevices() { var track = Manager.Tracks.Get("Tracks.sample-track.mp3"); // start track track.Restart(); Assert.IsTrue(track.IsRunning); CheckTrackIsProgressing(track); // stop track track.Stop(); WaitForOrAssert(() => !track.IsRunning, "Track did not stop", 1000); Assert.IsFalse(track.IsRunning); // seek track track.Seek(0); Assert.IsFalse(track.IsRunning); Assert.AreEqual(track.CurrentTime, 0); } } }
// 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; namespace osu.Framework.Tests.Audio { [TestFixture] public class DevicelessAudioTest : AudioThreadTest { public override void SetUp() { base.SetUp(); // lose all devices Manager.SimulateDeviceLoss(); } [Test] public void TestPlayTrackWithoutDevices() { var track = Manager.Tracks.Get("Tracks.sample-track.mp3"); // start track track.Restart(); Assert.IsTrue(track.IsRunning); CheckTrackIsProgressing(track); // stop track track.Stop(); WaitForOrAssert(() => !track.IsRunning, "Track did not stop", 1000); Assert.IsFalse(track.IsRunning); // seek track track.Seek(0); Assert.IsFalse(track.IsRunning); WaitForOrAssert(() => track.CurrentTime == 0, "Track did not seek correctly", 1000); } } }
Fix one remaining case of incorrect audio testing
Fix one remaining case of incorrect audio testing
C#
mit
ZLima12/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework
b43fdb50d28840a7f8ae168011a8b4dc59b5e488
mvcWebApp/Views/Home/_Jumbotron.cshtml
mvcWebApp/Views/Home/_Jumbotron.cshtml
 <div id="my-jumbotron" class="jumbotron"> <div class="container"> <h1>Welcome!</h1> <p>We are Sweet Water Revolver. This is our website. Please look around and check out our...</p> <p><a class="btn btn-primary btn-lg" role="button">... showtimes.</a></p> </div> </div>
<div class="container"> <div id="my-jumbotron" class="jumbotron"> <h1>Welcome!</h1> <p>We are Sweet Water Revolver. This is our website. Please look around and check out our...</p> <p><a class="btn btn-primary btn-lg" role="button">... showtimes.</a></p> </div> </div>
Make the jumbotron inside a container.
Make the jumbotron inside a container.
C#
mit
bigfont/sweet-water-revolver
a57910ac24de00a21ce8bced19cae8ad09bb7990
Assets/skilltesting.cs
Assets/skilltesting.cs
using UnityEngine; using System.Collections; public class test : Skill { private float duration = 10f; private float expiration; bool active; Player player; private int bonusStrength; protected override void Start() { base.Start(); base.SetBaseValues(15, 16000, 150, "Ignite", SkillLevel.Level1); player = GetComponent<Player>(); } protected override void Update() { base.Update(); if(active && Time.time >= expiration) { active = false; player.transform.GetChild(0).GetComponent<DealDamage>().isMagic = false; player.SetStrength(player.GetStrength() - bonusStrength); } } public override void UseSkill(GameObject caller, GameObject target = null, object optionalParameters = null) { base.UseSkill(gameObject); expiration = Time.time + duration; active = true; player.transform.GetChild(0).GetComponent<DealDamage>().isMagic = true; bonusStrength = player.GetIntelligence() / 2; player.SetStrength(player.GetStrength() + bonusStrength); } } public class skilltesting : MonoBehaviour { float castInterval; private Skill testSkill; // Use this for initialization void Start () { gameObject.AddComponent<Fireball>(); testSkill = GetComponent<Skill>(); } // Update is called once per frame void Update () { if(testSkill.GetCoolDownTimer() <= 0) { testSkill.UseSkill(gameObject); } } }
using UnityEngine; using System.Collections; public class test : Skill { private float duration = 10f; private float expiration; bool active; Player player; private int bonusStrength; protected override void Start() { base.Start(); base.SetBaseValues(15, 16000, 150, "Ignite", SkillLevel.Level1); player = GetComponent<Player>(); } protected override void Update() { base.Update(); if(active && Time.time >= expiration) { active = false; player.transform.GetChild(0).GetComponent<DealDamage>().isMagic = false; player.SetStrength(player.GetStrength() - bonusStrength); } } public override void UseSkill(GameObject caller, GameObject target = null, object optionalParameters = null) { base.UseSkill(gameObject); expiration = Time.time + duration; active = true; player.transform.GetChild(0).GetComponent<DealDamage>().isMagic = true; bonusStrength = player.GetIntelligence() / 2; player.SetStrength(player.GetStrength() + bonusStrength); } } public class skilltesting : MonoBehaviour { float castInterval; private Skill testSkill; // Use this for initialization void Start () { gameObject.AddComponent<FireballSkill>(); testSkill = GetComponent<Skill>(); } // Update is called once per frame void Update () { if(testSkill.GetCoolDownTimer() <= 0) { testSkill.UseSkill(gameObject); } } }
Fix Error With Skill Test
Fix Error With Skill Test
C#
mit
DevelopersGuild/Castle-Bashers
6c7be5c8205bff134017be8223c86de681e2ecfe
test/Pioneer.Pagination.Tests/ClampTests.cs
test/Pioneer.Pagination.Tests/ClampTests.cs
using Xunit; namespace Pioneer.Pagination.Tests { /// <summary> /// Clamp Tests /// </summary> public class ClampTests { private readonly PaginatedMetaService _sut = new PaginatedMetaService(); [Fact] public void LastPageDisplayed() { var result = _sut.GetMetaData(10, 11, 1); Assert.True(result.NextPage.PageNumber == 10, "Expected: Last Page "); } [Fact] public void FirstPageDisplayed() { var result = _sut.GetMetaData(10, 0, 1); Assert.True(result.NextPage.PageNumber == 1, "Expected: First Page "); } } }
using Xunit; namespace Pioneer.Pagination.Tests { /// <summary> /// Clamp Tests /// </summary> public class ClampTests { private readonly PaginatedMetaService _sut = new PaginatedMetaService(); [Fact] public void NextPageIsLastPageInCollectionWhenRequestedPageIsGreatedThenCollection() { var result = _sut.GetMetaData(10, 11, 1); Assert.True(result.NextPage.PageNumber == 10, "Expected: Last Page "); } [Fact] public void PreviousPageIsLastPageMinusOneInCollectionWhenRequestedPageIsGreatedThenCollection() { var result = _sut.GetMetaData(10, 11, 1); Assert.True(result.PreviousPage.PageNumber == 9, "Expected: Last Page "); } [Fact] public void PreviousPageIsFirstPageInCollectionWhenRequestedPageIsZero() { var result = _sut.GetMetaData(10, 0, 1); Assert.True(result.PreviousPage.PageNumber == 1, "Expected: First Page "); } [Fact] public void NextPageIsSecondPageInCollectionWhenRequestedPageIsZero() { var result = _sut.GetMetaData(10, 0, 1); Assert.True(result.NextPage.PageNumber == 2, "Expected: First Page "); } [Fact] public void PreviousPageIsFirstPageInCollectionWhenRequestedPageIsNegative() { var result = _sut.GetMetaData(10, -1, 1); Assert.True(result.PreviousPage.PageNumber == 1, "Expected: First Page "); } [Fact] public void NextPageIsSecondPageInCollectionWhenRequestedPageIsNegative() { var result = _sut.GetMetaData(10, -1, 1); Assert.True(result.NextPage.PageNumber == 2, "Expected: First Page "); } } }
Add edge case unit tests
Add edge case unit tests
C#
mit
PioneerCode/pioneer-pagination,PioneerCode/pioneer-pagination,PioneerCode/pioneer-pagination
630b90cf27ac2ac1badf8d808b848df3bd73186e
TruckRouter/Program.cs
TruckRouter/Program.cs
using TruckRouter.Models; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.AddTransient<IMazeSolver, MazeSolverBFS>(); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseAuthorization(); app.MapControllers(); app.Run();
using TruckRouter.Models; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.AddTransient<IMazeSolver, MazeSolverBFS>(); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); app.UseDeveloperExceptionPage(); } else { app.UseHttpsRedirection(); app.UseAuthorization(); } app.UseHttpsRedirection(); app.UseAuthorization(); app.MapControllers(); app.Run();
Enable https redirection and authorization for non-dev envs only
Enable https redirection and authorization for non-dev envs only
C#
mit
surlycoder/truck-router
b1c34777aaf2c0937fc6b6e650528851b879e21b
Source/Tests/TraktApiSharp.Tests/Experimental/Requests/Users/OAuth/TraktUserCustomListUpdateRequestTests.cs
Source/Tests/TraktApiSharp.Tests/Experimental/Requests/Users/OAuth/TraktUserCustomListUpdateRequestTests.cs
namespace TraktApiSharp.Tests.Experimental.Requests.Users.OAuth { using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using TraktApiSharp.Experimental.Requests.Base.Put; using TraktApiSharp.Experimental.Requests.Users.OAuth; using TraktApiSharp.Objects.Get.Users.Lists; using TraktApiSharp.Objects.Post.Users; [TestClass] public class TraktUserCustomListUpdateRequestTests { [TestMethod, TestCategory("Requests"), TestCategory("Users")] public void TestTraktUserCustomListUpdateRequestIsNotAbstract() { typeof(TraktUserCustomListUpdateRequest).IsAbstract.Should().BeFalse(); } [TestMethod, TestCategory("Requests"), TestCategory("Users")] public void TestTraktUserCustomListUpdateRequestIsSealed() { typeof(TraktUserCustomListUpdateRequest).IsSealed.Should().BeTrue(); } [TestMethod, TestCategory("Requests"), TestCategory("Users")] public void TestTraktUserCustomListUpdateRequestIsSubclassOfATraktSingleItemPutByIdRequest() { typeof(TraktUserCustomListUpdateRequest).IsSubclassOf(typeof(ATraktSingleItemPutByIdRequest<TraktList, TraktUserCustomListPost>)).Should().BeTrue(); } } }
namespace TraktApiSharp.Tests.Experimental.Requests.Users.OAuth { using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using TraktApiSharp.Experimental.Requests.Base.Put; using TraktApiSharp.Experimental.Requests.Users.OAuth; using TraktApiSharp.Objects.Get.Users.Lists; using TraktApiSharp.Objects.Post.Users; using TraktApiSharp.Requests; [TestClass] public class TraktUserCustomListUpdateRequestTests { [TestMethod, TestCategory("Requests"), TestCategory("Users")] public void TestTraktUserCustomListUpdateRequestIsNotAbstract() { typeof(TraktUserCustomListUpdateRequest).IsAbstract.Should().BeFalse(); } [TestMethod, TestCategory("Requests"), TestCategory("Users")] public void TestTraktUserCustomListUpdateRequestIsSealed() { typeof(TraktUserCustomListUpdateRequest).IsSealed.Should().BeTrue(); } [TestMethod, TestCategory("Requests"), TestCategory("Users")] public void TestTraktUserCustomListUpdateRequestIsSubclassOfATraktSingleItemPutByIdRequest() { typeof(TraktUserCustomListUpdateRequest).IsSubclassOf(typeof(ATraktSingleItemPutByIdRequest<TraktList, TraktUserCustomListPost>)).Should().BeTrue(); } [TestMethod, TestCategory("Requests"), TestCategory("Users")] public void TestTraktUserCustomListUpdateRequestHasAuthorizationRequired() { var request = new TraktUserCustomListUpdateRequest(null); request.AuthorizationRequirement.Should().Be(TraktAuthorizationRequirement.Required); } } }
Add test for authorization requirement in TraktUserCustomListUpdateRequest
Add test for authorization requirement in TraktUserCustomListUpdateRequest
C#
mit
henrikfroehling/TraktApiSharp
75687902e82e56c9029a3a208f22995cbe58c5de
Umbraco.Inception/Attributes/UmbracoTabAttribute.cs
Umbraco.Inception/Attributes/UmbracoTabAttribute.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Umbraco.Inception.Attributes { [AttributeUsage(AttributeTargets.Property)] public class UmbracoTabAttribute : Attribute { public string Name { get; set; } public int SortOrder { get; set; } public UmbracoTabAttribute(string name, int sortOrder = 0) { Name = name; SortOrder = sortOrder; } } }
using System; namespace Umbraco.Inception.Attributes { [AttributeUsage(AttributeTargets.Property)] public class UmbracoTabAttribute : Attribute { public string Name { get; set; } public int SortOrder { get; set; } public UmbracoTabAttribute(string name) { Name = name; SortOrder = 0; } public UmbracoTabAttribute(string name, int sortOrder = 0) { Name = name; SortOrder = sortOrder; } } }
Add original constructor signature as there is Inception code which looks for it
Add original constructor signature as there is Inception code which looks for it
C#
mit
east-sussex-county-council/Escc.Umbraco.Inception
dc31524912c1162612ae6fcb9325bd98368ec0c2
100_Doors_Problem/C#/Davipb/HundredDoors.cs
100_Doors_Problem/C#/Davipb/HundredDoors.cs
using System.Linq; namespace HundredDoors { public static class HundredDoors { /// <summary> /// Solves the 100 Doors problem /// </summary> /// <returns>An array with 101 values, each representing a door (except 0). True = open</returns> public static bool[] Solve() { // Create our array with 101 values, all of them false. We'll only use 1~100 to simplify it bool[] doors = Enumerable.Repeat(false, 101).ToArray(); // We'll pass 100 times, each pass we'll start at door #pass and increment by pass, toggling the current door for (int pass = 1; pass <= 100; pass++) for (int i = pass; i < doors.Length; i += pass) doors[i] = !doors[i]; return doors; } } }
using System.Linq; namespace HundredDoors { public static class HundredDoors { /// <summary> /// Solves the 100 Doors problem /// </summary> /// <returns>An array with 101 values, each representing a door (except 0). True = open</returns> public static bool[] Solve() { // Create our array with 101 values, all of them false. We'll only use 1~100 to simplify it bool[] doors = Enumerable.Repeat(false, 101).ToArray(); // We'll pass 100 times, each pass we'll start at door #pass and increment by pass, toggling the current door for (int pass = 1; pass <= 100; pass++) for (int i = pass; i < doors.Length; i += pass) doors[i] = !doors[i]; return doors; //final door count } } }
Revert "Revert "Added "final door count" comment at return value.""
Revert "Revert "Added "final door count" comment at return value."" This reverts commit 4ed080e822168a87a0140fb8f0f28132bc0b6d96.
C#
mit
n1ghtmare/Algorithm-Implementations,pravsingh/Algorithm-Implementations,pravsingh/Algorithm-Implementations,kennyledet/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,kennyledet/Algorithm-Implementations,pravsingh/Algorithm-Implementations,pravsingh/Algorithm-Implementations,pravsingh/Algorithm-Implementations,kennyledet/Algorithm-Implementations,kennyledet/Algorithm-Implementations,kennyledet/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,kennyledet/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,kennyledet/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,pravsingh/Algorithm-Implementations,pravsingh/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,pravsingh/Algorithm-Implementations,pravsingh/Algorithm-Implementations,kennyledet/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,kennyledet/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,pravsingh/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,kennyledet/Algorithm-Implementations,n1ghtmare/Algorithm-Implementations,pravsingh/Algorithm-Implementations,pravsingh/Algorithm-Implementations,kennyledet/Algorithm-Implementations,kennyledet/Algorithm-Implementations,pravsingh/Algorithm-Implementations,kennyledet/Algorithm-Implementations,pravsingh/Algorithm-Implementations,kennyledet/Algorithm-Implementations,kennyledet/Algorithm-Implementations,pravsingh/Algorithm-Implementations
df9e0dbd1339636969bc572a8aeb6880bddf164e
src/Cake.Docker/Container/Logs/Docker.Aliases.Logs.cs
src/Cake.Docker/Container/Logs/Docker.Aliases.Logs.cs
using Cake.Core; using Cake.Core.Annotations; using System; namespace Cake.Docker { partial class DockerAliases { /// <summary> /// Logs <paramref name="container"/> using default settings. /// </summary> /// <param name="context">The context.</param> /// <param name="container">The list of containers.</param> [CakeMethodAlias] public static void DockerLogs(this ICakeContext context, string container) { DockerLogs(context, new DockerContainerLogsSettings(), container); } /// <summary> /// Logs <paramref name="container"/> using the given <paramref name="settings"/>. /// </summary> /// <param name="context">The context.</param> /// <param name="container">The list of containers.</param> /// <param name="settings">The settings.</param> [CakeMethodAlias] public static void DockerLogs(this ICakeContext context, DockerContainerLogsSettings settings, string container) { if (context == null) { throw new ArgumentNullException("context"); } if (container == null) { throw new ArgumentNullException("container"); } var runner = new GenericDockerRunner<DockerContainerLogsSettings>(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); runner.Run("start", settings ?? new DockerContainerLogsSettings(), new string[] { container }); } } }
using Cake.Core; using Cake.Core.Annotations; using System; using System.Linq; using System.Collections.Generic; namespace Cake.Docker { partial class DockerAliases { /// <summary> /// Logs <paramref name="container"/> using default settings. /// </summary> /// <param name="context">The context.</param> /// <param name="container">The list of containers.</param> [CakeMethodAlias] public static IEnumerable<string> DockerLogs(this ICakeContext context, string container) { return DockerLogs(context, new DockerContainerLogsSettings(), container); } /// <summary> /// Logs <paramref name="container"/> using the given <paramref name="settings"/>. /// </summary> /// <param name="context">The context.</param> /// <param name="container">The list of containers.</param> /// <param name="settings">The settings.</param> [CakeMethodAlias] public static IEnumerable<string> DockerLogs(this ICakeContext context, DockerContainerLogsSettings settings, string container) { if (context == null) { throw new ArgumentNullException("context"); } if (container == null) { throw new ArgumentNullException("container"); } var runner = new GenericDockerRunner<DockerContainerLogsSettings>(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); return runner.RunWithResult("logs", settings ?? new DockerContainerLogsSettings(), r => r.ToArray(), new string[] { container }); } } }
Fix log command and return log lines
Fix log command and return log lines
C#
mit
MihaMarkic/Cake.Docker
34f59cde9b07e142596eb255173260a243694e44
Bonobo.Git.Server.Test/IntegrationTests/SharedLayoutTests.cs
Bonobo.Git.Server.Test/IntegrationTests/SharedLayoutTests.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Bonobo.Git.Server.Controllers; using Bonobo.Git.Server.Test.Integration.Web; using Bonobo.Git.Server.Test.IntegrationTests.Helpers; using SpecsFor.Mvc; namespace Bonobo.Git.Server.Test.IntegrationTests { using OpenQA.Selenium.Support.UI; using OpenQA.Selenium; [TestClass] public class SharedLayoutTests : IntegrationTestBase { [TestMethod, TestCategory(TestCategories.WebIntegrationTest)] public void DropdownNavigationWorks() { var reponame = "A_Nice_Repo"; var id1 = ITH.CreateRepositoryOnWebInterface(reponame); var id2 = ITH.CreateRepositoryOnWebInterface("other_name"); app.NavigateTo<RepositoryController>(c => c.Detail(id2)); var element = app.Browser.FindElementByCssSelector("select#Repositories"); var dropdown = new SelectElement(element); dropdown.SelectByText(reponame); app.UrlMapsTo<RepositoryController>(c => c.Detail(id1)); app.WaitForElementToBeVisible(By.CssSelector("select#Repositories"), TimeSpan.FromSeconds(10)); dropdown = new SelectElement(app.Browser.FindElementByCssSelector("select#Repositories")); dropdown.SelectByText("other_name"); app.UrlMapsTo<RepositoryController>(c => c.Detail(id2)); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Bonobo.Git.Server.Controllers; using Bonobo.Git.Server.Test.Integration.Web; using Bonobo.Git.Server.Test.IntegrationTests.Helpers; using SpecsFor.Mvc; namespace Bonobo.Git.Server.Test.IntegrationTests { using OpenQA.Selenium.Support.UI; using OpenQA.Selenium; using System.Threading; [TestClass] public class SharedLayoutTests : IntegrationTestBase { [TestMethod, TestCategory(TestCategories.WebIntegrationTest)] public void DropdownNavigationWorks() { var reponame = ITH.MakeName(); var otherreponame = ITH.MakeName(reponame + "_other"); var repoId = ITH.CreateRepositoryOnWebInterface(reponame); var otherrepoId = ITH.CreateRepositoryOnWebInterface(otherreponame); app.NavigateTo<RepositoryController>(c => c.Detail(otherrepoId)); var element = app.Browser.FindElementByCssSelector("select#Repositories"); var dropdown = new SelectElement(element); dropdown.SelectByText(reponame); Thread.Sleep(2000); app.UrlMapsTo<RepositoryController>(c => c.Detail(repoId)); app.WaitForElementToBeVisible(By.CssSelector("select#Repositories"), TimeSpan.FromSeconds(10)); dropdown = new SelectElement(app.Browser.FindElementByCssSelector("select#Repositories")); dropdown.SelectByText(otherreponame); Thread.Sleep(2000); app.UrlMapsTo<RepositoryController>(c => c.Detail(otherrepoId)); } } }
Make DropdDownNavigationWorks more reliable and use new test methods.
Make DropdDownNavigationWorks more reliable and use new test methods.
C#
mit
larshg/Bonobo-Git-Server,crowar/Bonobo-Git-Server,gencer/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,willdean/Bonobo-Git-Server,gencer/Bonobo-Git-Server,crowar/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,larshg/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,larshg/Bonobo-Git-Server,gencer/Bonobo-Git-Server,willdean/Bonobo-Git-Server,crowar/Bonobo-Git-Server,gencer/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,lkho/Bonobo-Git-Server,crowar/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,willdean/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,lkho/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,willdean/Bonobo-Git-Server,lkho/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,crowar/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,lkho/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,willdean/Bonobo-Git-Server,larshg/Bonobo-Git-Server,crowar/Bonobo-Git-Server,forgetz/Bonobo-Git-Server
220f890eed25833c695059f9dc96a814ac9e09f5
PSql.Tests/Tests.Support/StringExtensions.cs
PSql.Tests/Tests.Support/StringExtensions.cs
using System; using System.Linq; using System.Linq.Expressions; using FluentAssertions; namespace PSql.Tests { using static ScriptExecutor; internal static class StringExtensions { internal static void ShouldOutput( this string script, params object[] expected ) { if (script is null) throw new ArgumentNullException(nameof(script)); if (expected is null) throw new ArgumentNullException(nameof(expected)); var (objects, exception) = Execute(script); exception.Should().BeNull(); objects.Should().HaveCount(expected.Length); objects .Select(o => o?.BaseObject) .Should().BeEquivalentTo(expected, x => x.IgnoringCyclicReferences()); } internal static void ShouldThrow<T>( this string script, string messagePart ) where T : Exception { script.ShouldThrow<T>( e => e.Message.Contains(messagePart, StringComparison.OrdinalIgnoreCase) ); } internal static void ShouldThrow<T>( this string script, Expression<Func<T, bool>>? predicate = null ) where T : Exception { if (script is null) throw new ArgumentNullException(nameof(script)); var (_, exception) = Execute(script); exception.Should().NotBeNull().And.BeAssignableTo<T>(); if (predicate is not null) exception.Should().Match<T>(predicate); } } }
using System; using System.Linq; using System.Linq.Expressions; using FluentAssertions; namespace PSql.Tests { using static ScriptExecutor; internal static class StringExtensions { internal static void ShouldOutput( this string script, params object[] expected ) { if (script is null) throw new ArgumentNullException(nameof(script)); if (expected is null) throw new ArgumentNullException(nameof(expected)); var (objects, exception) = Execute(script); exception.Should().BeNull(); objects.Should().HaveCount(expected.Length); objects .Select(o => o?.BaseObject) .Should().BeEquivalentTo(expected, x => x.IgnoringCyclicReferences()); } internal static void ShouldThrow<T>(this string script, string messagePart) where T : Exception { var exception = script.ShouldThrow<T>(); exception.Message.Should().Contain(messagePart); } internal static T ShouldThrow<T>(this string script) where T : Exception { if (script is null) throw new ArgumentNullException(nameof(script)); var (_, exception) = Execute(script); return exception .Should().NotBeNull() .And .BeAssignableTo<T>() .Subject; } } }
Rework exception asserts to improve failure messages.
Rework exception asserts to improve failure messages.
C#
isc
sharpjs/PSql,sharpjs/PSql
117e0790111c0b250c46cba360270a45552cf80f
Renci.SshClient/Renci.SshNet.Tests/Classes/CipherInfoTest.cs
Renci.SshClient/Renci.SshNet.Tests/Classes/CipherInfoTest.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using Renci.SshNet.Security.Cryptography; using Renci.SshNet.Tests.Common; using System; namespace Renci.SshNet.Tests.Classes { /// <summary> /// Holds information about key size and cipher to use /// </summary> [TestClass] public class CipherInfoTest : TestBase { /// <summary> ///A test for CipherInfo Constructor ///</summary> [TestMethod()] public void CipherInfoConstructorTest() { int keySize = 0; // TODO: Initialize to an appropriate value Func<byte[], byte[], BlockCipher> cipher = null; // TODO: Initialize to an appropriate value CipherInfo target = new CipherInfo(keySize, cipher); Assert.Inconclusive("TODO: Implement code to verify target"); } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using Renci.SshNet.Security.Cryptography; using Renci.SshNet.Tests.Common; using System; namespace Renci.SshNet.Tests.Classes { /// <summary> /// Holds information about key size and cipher to use /// </summary> [TestClass] public class CipherInfoTest : TestBase { /// <summary> ///A test for CipherInfo Constructor ///</summary> [TestMethod()] public void CipherInfoConstructorTest() { int keySize = 0; // TODO: Initialize to an appropriate value Func<byte[], byte[], Cipher> cipher = null; // TODO: Initialize to an appropriate value CipherInfo target = new CipherInfo(keySize, cipher); Assert.Inconclusive("TODO: Implement code to verify target"); } } }
Fix build when targeting .NET Framework 3.5 as Func only supports covariance on .NET Framework 4.0 and higher.
Fix build when targeting .NET Framework 3.5 as Func only supports covariance on .NET Framework 4.0 and higher.
C#
mit
GenericHero/SSH.NET,sshnet/SSH.NET,miniter/SSH.NET,Bloomcredit/SSH.NET
901c93ef0c226baba6a7438d05519532b15424ea
Src/Compilers/Core/Source/Diagnostic/IMessageSerializable.cs
Src/Compilers/Core/Source/Diagnostic/IMessageSerializable.cs
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.CodeAnalysis { /// <summary> /// Indicates that the implementing type can be serialized via <see cref="ToString"/> /// for diagnostic message purposes. /// </summary> /// <remarks> /// Not appropriate on types that require localization, since localization should /// happen after serialization. /// </remarks> internal interface IMessageSerializable { } }
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.CodeAnalysis { /// <summary> /// Indicates that the implementing type can be serialized via <see cref="object.ToString"/> /// for diagnostic message purposes. /// </summary> /// <remarks> /// Not appropriate on types that require localization, since localization should /// happen after serialization. /// </remarks> internal interface IMessageSerializable { } }
Fix a warning about a cref in an XML doc comment.
Fix a warning about a cref in an XML doc comment. "ToString" by itself cannot be resolved to a symbol. We really meant "object.ToString". (changeset 1255357)
C#
mit
KamalRathnayake/roslyn,dotnet/roslyn,aelij/roslyn,nguerrera/roslyn,russpowers/roslyn,danielcweber/roslyn,paladique/roslyn,panopticoncentral/roslyn,marksantos/roslyn,AmadeusW/roslyn,khellang/roslyn,ahmedshuhel/roslyn,weltkante/roslyn,AlekseyTs/roslyn,BugraC/roslyn,AlexisArce/roslyn,mavasani/roslyn,stebet/roslyn,akrisiun/roslyn,thomaslevesque/roslyn,tsdl2013/roslyn,CyrusNajmabadi/roslyn,amcasey/roslyn,ManishJayaswal/roslyn,dotnet/roslyn,dpoeschl/roslyn,ilyes14/roslyn,DustinCampbell/roslyn,khyperia/roslyn,dsplaisted/roslyn,CaptainHayashi/roslyn,supriyantomaftuh/roslyn,paladique/roslyn,panopticoncentral/roslyn,akoeplinger/roslyn,dsplaisted/roslyn,antonssonj/roslyn,Inverness/roslyn,mattscheffer/roslyn,ErikSchierboom/roslyn,bbarry/roslyn,TyOverby/roslyn,KevinH-MS/roslyn,AnthonyDGreen/roslyn,stjeong/roslyn,srivatsn/roslyn,stebet/roslyn,jonatassaraiva/roslyn,ErikSchierboom/roslyn,bkoelman/roslyn,Maxwe11/roslyn,dpen2000/roslyn,JohnHamby/roslyn,paulvanbrenk/roslyn,sharwell/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,nagyistoce/roslyn,mattscheffer/roslyn,3F/roslyn,AmadeusW/roslyn,jroggeman/roslyn,YOTOV-LIMITED/roslyn,FICTURE7/roslyn,sharwell/roslyn,davkean/roslyn,AlexisArce/roslyn,evilc0des/roslyn,MattWindsor91/roslyn,MichalStrehovsky/roslyn,tang7526/roslyn,vcsjones/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,srivatsn/roslyn,sharadagrawal/Roslyn,doconnell565/roslyn,gafter/roslyn,reaction1989/roslyn,bkoelman/roslyn,TyOverby/roslyn,devharis/roslyn,VPashkov/roslyn,3F/roslyn,TyOverby/roslyn,MichalStrehovsky/roslyn,ManishJayaswal/roslyn,v-codeel/roslyn,JohnHamby/roslyn,drognanar/roslyn,nagyistoce/roslyn,tmat/roslyn,chenxizhang/roslyn,taylorjonl/roslyn,eriawan/roslyn,bartdesmet/roslyn,MatthieuMEZIL/roslyn,robinsedlaczek/roslyn,mgoertz-msft/roslyn,akoeplinger/roslyn,jkotas/roslyn,ericfe-ms/roslyn,jeffanders/roslyn,vslsnap/roslyn,zmaruo/roslyn,mirhagk/roslyn,heejaechang/roslyn,jroggeman/roslyn,tmat/roslyn,JakeGinnivan/roslyn,khyperia/roslyn,mirhagk/roslyn,Giftednewt/roslyn,davkean/roslyn,michalhosala/roslyn,OmniSharp/roslyn,bbarry/roslyn,leppie/roslyn,ericfe-ms/roslyn,mavasani/roslyn,jkotas/roslyn,tsdl2013/roslyn,abock/roslyn,DavidKarlas/roslyn,Maxwe11/roslyn,ManishJayaswal/roslyn,GuilhermeSa/roslyn,aelij/roslyn,Giftednewt/roslyn,kienct89/roslyn,ilyes14/roslyn,akoeplinger/roslyn,cybernet14/roslyn,Felorati/roslyn,jramsay/roslyn,natgla/roslyn,swaroop-sridhar/roslyn,paladique/roslyn,physhi/roslyn,akrisiun/roslyn,sharwell/roslyn,VShangxiao/roslyn,rgani/roslyn,sharadagrawal/Roslyn,kuhlenh/roslyn,dovzhikova/roslyn,FICTURE7/roslyn,MattWindsor91/roslyn,CaptainHayashi/roslyn,Shiney/roslyn,DustinCampbell/roslyn,ahmedshuhel/roslyn,russpowers/roslyn,zmaruo/roslyn,brettfo/roslyn,CyrusNajmabadi/roslyn,yeaicc/roslyn,dovzhikova/roslyn,vslsnap/roslyn,pjmagee/roslyn,garryforreg/roslyn,nemec/roslyn,huoxudong125/roslyn,rgani/roslyn,budcribar/roslyn,pjmagee/roslyn,a-ctor/roslyn,rgani/roslyn,jramsay/roslyn,xoofx/roslyn,AnthonyDGreen/roslyn,rchande/roslyn,KevinH-MS/roslyn,jrharmon/roslyn,antonssonj/roslyn,kelltrick/roslyn,KevinRansom/roslyn,physhi/roslyn,Pvlerick/roslyn,antonssonj/roslyn,DanielRosenwasser/roslyn,agocke/roslyn,xoofx/roslyn,EricArndt/roslyn,orthoxerox/roslyn,jbhensley/roslyn,mirhagk/roslyn,jbhensley/roslyn,stephentoub/roslyn,VShangxiao/roslyn,mseamari/Stuff,AmadeusW/roslyn,Hosch250/roslyn,lisong521/roslyn,stjeong/roslyn,genlu/roslyn,khyperia/roslyn,michalhosala/roslyn,EricArndt/roslyn,balajikris/roslyn,enginekit/roslyn,poizan42/roslyn,ValentinRueda/roslyn,a-ctor/roslyn,VSadov/roslyn,oberxon/roslyn,mmitche/roslyn,bbarry/roslyn,drognanar/roslyn,natgla/roslyn,1234-/roslyn,kienct89/roslyn,DanielRosenwasser/roslyn,Giten2004/roslyn,AnthonyDGreen/roslyn,xoofx/roslyn,swaroop-sridhar/roslyn,jeremymeng/roslyn,thomaslevesque/roslyn,JakeGinnivan/roslyn,dpoeschl/roslyn,furesoft/roslyn,vcsjones/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,jeffanders/roslyn,mmitche/roslyn,danielcweber/roslyn,KirillOsenkov/roslyn,jmarolf/roslyn,aelij/roslyn,devharis/roslyn,shyamnamboodiripad/roslyn,genlu/roslyn,DustinCampbell/roslyn,Shiney/roslyn,mgoertz-msft/roslyn,VShangxiao/roslyn,VitalyTVA/roslyn,jramsay/roslyn,gafter/roslyn,lisong521/roslyn,mseamari/Stuff,basoundr/roslyn,cston/roslyn,KashishArora/Roslyn,hanu412/roslyn,Giten2004/roslyn,yjfxfjch/roslyn,GuilhermeSa/roslyn,OmarTawfik/roslyn,danielcweber/roslyn,ahmedshuhel/roslyn,YOTOV-LIMITED/roslyn,DinoV/roslyn,MavenRain/roslyn,stebet/roslyn,jrharmon/roslyn,vcsjones/roslyn,wvdd007/roslyn,hanu412/roslyn,natidea/roslyn,Felorati/roslyn,jgglg/roslyn,jbhensley/roslyn,jasonmalinowski/roslyn,KiloBravoLima/roslyn,sharadagrawal/TestProject2,tmeschter/roslyn,marksantos/roslyn,jeffanders/roslyn,jaredpar/roslyn,srivatsn/roslyn,jhendrixMSFT/roslyn,wschae/roslyn,agocke/roslyn,1234-/roslyn,paulvanbrenk/roslyn,BugraC/roslyn,leppie/roslyn,ManishJayaswal/roslyn,OmniSharp/roslyn,managed-commons/roslyn,hanu412/roslyn,garryforreg/roslyn,yetangye/roslyn,HellBrick/roslyn,ljw1004/roslyn,michalhosala/roslyn,balajikris/roslyn,chenxizhang/roslyn,EricArndt/roslyn,swaroop-sridhar/roslyn,jgglg/roslyn,JohnHamby/roslyn,zmaruo/roslyn,zooba/roslyn,VSadov/roslyn,KirillOsenkov/roslyn,diryboy/roslyn,Pvlerick/roslyn,yetangye/roslyn,jkotas/roslyn,jrharmon/roslyn,jgglg/roslyn,lorcanmooney/roslyn,moozzyk/roslyn,tvand7093/roslyn,stephentoub/roslyn,khellang/roslyn,cston/roslyn,dovzhikova/roslyn,droyad/roslyn,SeriaWei/roslyn,SeriaWei/roslyn,taylorjonl/roslyn,jasonmalinowski/roslyn,VPashkov/roslyn,AArnott/roslyn,mattwar/roslyn,REALTOBIZ/roslyn,budcribar/roslyn,RipCurrent/roslyn,KashishArora/Roslyn,mono/roslyn,jmarolf/roslyn,xasx/roslyn,poizan42/roslyn,CaptainHayashi/roslyn,wvdd007/roslyn,OmniSharp/roslyn,heejaechang/roslyn,huoxudong125/roslyn,weltkante/roslyn,marksantos/roslyn,eriawan/roslyn,budcribar/roslyn,sharadagrawal/TestProject2,Felorati/roslyn,Maxwe11/roslyn,jamesqo/roslyn,kelltrick/roslyn,v-codeel/roslyn,nemec/roslyn,DavidKarlas/roslyn,tang7526/roslyn,managed-commons/roslyn,kuhlenh/roslyn,genlu/roslyn,oocx/roslyn,kelltrick/roslyn,natidea/roslyn,AArnott/roslyn,droyad/roslyn,mono/roslyn,moozzyk/roslyn,Inverness/roslyn,huoxudong125/roslyn,oberxon/roslyn,tannergooding/roslyn,evilc0des/roslyn,OmarTawfik/roslyn,antiufo/roslyn,poizan42/roslyn,agocke/roslyn,aanshibudhiraja/Roslyn,shyamnamboodiripad/roslyn,antiufo/roslyn,ValentinRueda/roslyn,khellang/roslyn,jaredpar/roslyn,mattwar/roslyn,MatthieuMEZIL/roslyn,weltkante/roslyn,yjfxfjch/roslyn,tannergooding/roslyn,jeremymeng/roslyn,pdelvo/roslyn,v-codeel/roslyn,magicbing/roslyn,Pvlerick/roslyn,heejaechang/roslyn,ValentinRueda/roslyn,zooba/roslyn,magicbing/roslyn,1234-/roslyn,diryboy/roslyn,tang7526/roslyn,lorcanmooney/roslyn,xasx/roslyn,jcouv/roslyn,paulvanbrenk/roslyn,oocx/roslyn,dotnet/roslyn,rchande/roslyn,dpoeschl/roslyn,dpen2000/roslyn,sharadagrawal/Roslyn,lisong521/roslyn,robinsedlaczek/roslyn,managed-commons/roslyn,jonatassaraiva/roslyn,abock/roslyn,oocx/roslyn,devharis/roslyn,MattWindsor91/roslyn,sharadagrawal/TestProject2,grianggrai/roslyn,DavidKarlas/roslyn,mattscheffer/roslyn,kienct89/roslyn,AlekseyTs/roslyn,REALTOBIZ/roslyn,tvand7093/roslyn,Giten2004/roslyn,DinoV/roslyn,KirillOsenkov/roslyn,evilc0des/roslyn,ericfe-ms/roslyn,DinoV/roslyn,mavasani/roslyn,vslsnap/roslyn,jcouv/roslyn,mmitche/roslyn,ljw1004/roslyn,amcasey/roslyn,grianggrai/roslyn,supriyantomaftuh/roslyn,aanshibudhiraja/Roslyn,krishnarajbb/roslyn,ilyes14/roslyn,enginekit/roslyn,rchande/roslyn,oberxon/roslyn,KamalRathnayake/roslyn,jhendrixMSFT/roslyn,VitalyTVA/roslyn,nemec/roslyn,VitalyTVA/roslyn,MichalStrehovsky/roslyn,AArnott/roslyn,garryforreg/roslyn,jamesqo/roslyn,doconnell565/roslyn,tmeschter/roslyn,VSadov/roslyn,furesoft/roslyn,diryboy/roslyn,KashishArora/Roslyn,MavenRain/roslyn,yeaicc/roslyn,stjeong/roslyn,tannergooding/roslyn,gafter/roslyn,taylorjonl/roslyn,jmarolf/roslyn,AlexisArce/roslyn,jcouv/roslyn,Hosch250/roslyn,furesoft/roslyn,natgla/roslyn,CyrusNajmabadi/roslyn,dsplaisted/roslyn,doconnell565/roslyn,REALTOBIZ/roslyn,yjfxfjch/roslyn,brettfo/roslyn,balajikris/roslyn,VPashkov/roslyn,KevinH-MS/roslyn,BugraC/roslyn,OmarTawfik/roslyn,Giftednewt/roslyn,RipCurrent/roslyn,cybernet14/roslyn,orthoxerox/roslyn,reaction1989/roslyn,jasonmalinowski/roslyn,a-ctor/roslyn,physhi/roslyn,tmeschter/roslyn,ErikSchierboom/roslyn,brettfo/roslyn,wschae/roslyn,KiloBravoLima/roslyn,enginekit/roslyn,Inverness/roslyn,eriawan/roslyn,yetangye/roslyn,mgoertz-msft/roslyn,magicbing/roslyn,SeriaWei/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,nguerrera/roslyn,Hosch250/roslyn,KamalRathnayake/roslyn,russpowers/roslyn,AlekseyTs/roslyn,pjmagee/roslyn,wvdd007/roslyn,MihaMarkic/roslyn-prank,panopticoncentral/roslyn,nagyistoce/roslyn,KevinRansom/roslyn,aanshibudhiraja/Roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,zooba/roslyn,basoundr/roslyn,JakeGinnivan/roslyn,wschae/roslyn,jeremymeng/roslyn,HellBrick/roslyn,cybernet14/roslyn,lorcanmooney/roslyn,jonatassaraiva/roslyn,jhendrixMSFT/roslyn,pdelvo/roslyn,stephentoub/roslyn,mono/roslyn,amcasey/roslyn,krishnarajbb/roslyn,abock/roslyn,davkean/roslyn,robinsedlaczek/roslyn,MihaMarkic/roslyn-prank,cston/roslyn,drognanar/roslyn,bkoelman/roslyn,jaredpar/roslyn,jamesqo/roslyn,tmat/roslyn,HellBrick/roslyn,supriyantomaftuh/roslyn,KiloBravoLima/roslyn,RipCurrent/roslyn,GuilhermeSa/roslyn,mseamari/Stuff,leppie/roslyn,basoundr/roslyn,thomaslevesque/roslyn,antiufo/roslyn,tvand7093/roslyn,xasx/roslyn,DavidKarlas/roslyn,3F/roslyn,kuhlenh/roslyn,MihaMarkic/roslyn-prank,MattWindsor91/roslyn,droyad/roslyn,FICTURE7/roslyn,natidea/roslyn,krishnarajbb/roslyn,chenxizhang/roslyn,reaction1989/roslyn,pdelvo/roslyn,yetangye/roslyn,JohnHamby/roslyn,jroggeman/roslyn,mattwar/roslyn,tsdl2013/roslyn,moozzyk/roslyn,grianggrai/roslyn,MatthieuMEZIL/roslyn,YOTOV-LIMITED/roslyn,dpen2000/roslyn,orthoxerox/roslyn,MavenRain/roslyn,nguerrera/roslyn,akrisiun/roslyn,ljw1004/roslyn,yeaicc/roslyn,DanielRosenwasser/roslyn,Shiney/roslyn
91ff5bb1376ee112513b63bb6a374b992cc088f1
src/Smooth.IoC.Dapper.Repository.UnitOfWork/Repo/IRepository.cs
src/Smooth.IoC.Dapper.Repository.UnitOfWork/Repo/IRepository.cs
using System.Collections.Generic; using System.Threading.Tasks; using Smooth.IoC.Dapper.Repository.UnitOfWork.Data; namespace Smooth.IoC.Dapper.Repository.UnitOfWork.Repo { public interface IRepository<TEntity, TPk> where TEntity : class, IEntity<TPk> { TEntity Get(TPk key, ISession session = null); Task<TEntity> GetAsync(TPk key, ISession session = null); IEnumerable<TEntity> GetAll(ISession session = null); Task<IEnumerable<TEntity>> GetAllAsync(ISession session = null); TPk SaveOrUpdate(TEntity entity, IUnitOfWork transaction); Task<TPk> SaveOrUpdateAsync(TEntity entity, IUnitOfWork transaction); } }
using System.Collections.Generic; using System.Threading.Tasks; using Smooth.IoC.Dapper.Repository.UnitOfWork.Data; namespace Smooth.IoC.Dapper.Repository.UnitOfWork.Repo { public interface IRepository<TEntity, TPk> where TEntity : class, IEntity<TPk> { TEntity GetKey(TPk key, ISession session = null); Task<TEntity> GetKeyAsync(TPk key, ISession session = null); TEntity Get(TEntity entity, ISession session = null); Task<TEntity> GetAsync(TEntity entity, ISession session = null) IEnumerable<TEntity> GetAll(ISession session = null); Task<IEnumerable<TEntity>> GetAllAsync(ISession session = null); TPk SaveOrUpdate(TEntity entity, IUnitOfWork transaction); Task<TPk> SaveOrUpdateAsync(TEntity entity, IUnitOfWork transaction); } }
Change get method and add the new getter
Change get method and add the new getter
C#
mit
generik0/Smooth.IoC.Dapper.Repository.UnitOfWork,generik0/Smooth.IoC.Dapper.Repository.UnitOfWork
e3012b7c2941d6f28ac096e4011c78d0d9f89c5f
mountain-thoughts/Program.cs
mountain-thoughts/Program.cs
using System; using System.Diagnostics; using System.Linq; namespace mountain_thoughts { public class Program { public static void Main(string[] args) { Process mountainProcess = NativeMethods.GetMountainProcess(); if (mountainProcess == null) { Console.WriteLine("Could not get process. Is Mountain running?"); Console.ReadLine(); Environment.Exit(1); } IntPtr handle = mountainProcess.Handle; IntPtr address = NativeMethods.GetStringAddress(mountainProcess); Twitter.Authenticate(); NativeMethods.StartReadingString(handle, address, Callback); Console.ReadLine(); NativeMethods.StopReadingString(); } private static void Callback(string thought) { string properThought = string.Empty; foreach (string word in thought.Split(' ').Skip(1)) { string lowerWord = word; if (word != "I") lowerWord = word.ToLowerInvariant(); properThought += lowerWord + " "; } properThought = properThought.Trim(); Console.WriteLine(properThought); Twitter.Tweet(string.Format("\"{0}\"", properThought)); } } }
using System; using System.Diagnostics; namespace mountain_thoughts { public class Program { public static void Main(string[] args) { Process mountainProcess = NativeMethods.GetMountainProcess(); if (mountainProcess == null) { Console.WriteLine("Could not get process. Is Mountain running?"); Console.ReadLine(); Environment.Exit(1); } IntPtr handle = mountainProcess.Handle; IntPtr address = NativeMethods.GetStringAddress(mountainProcess); Twitter.Authenticate(); NativeMethods.StartReadingString(handle, address, Callback); Console.ReadLine(); NativeMethods.StopReadingString(); } private static void Callback(string thought) { string properThought = string.Empty; foreach (string word in thought.Split(' ')) { string lowerWord = word; if (word != "I") lowerWord = word.ToLowerInvariant(); properThought += lowerWord + " "; } properThought = properThought.Trim(); Console.WriteLine(properThought); Twitter.Tweet(string.Format("\"{0}\"", properThought)); } } }
Revert "Exclude the first word"
Revert "Exclude the first word" This reverts commit c5f9cf87bd3a18e4acf130a001f84b249598acc4.
C#
mit
BinaryTENSHi/mountain-thoughts
f5f16e979dee08ab805d7a7daee0c820a6d3d15a
ThScoreFileConverter/Models/Th165/AllScoreData.cs
ThScoreFileConverter/Models/Th165/AllScoreData.cs
//----------------------------------------------------------------------- // <copyright file="AllScoreData.cs" company="None"> // Copyright (c) IIHOSHI Yoshinori. // Licensed under the BSD-2-Clause license. See LICENSE.txt file in the project root for full license information. // </copyright> //----------------------------------------------------------------------- #pragma warning disable SA1600 // Elements should be documented using System.Collections.Generic; namespace ThScoreFileConverter.Models.Th165 { internal class AllScoreData { private readonly List<IScore> scores; public AllScoreData() => this.scores = new List<IScore>(Definitions.SpellCards.Count); public Th095.HeaderBase Header { get; private set; } public IReadOnlyList<IScore> Scores => this.scores; public IStatus Status { get; private set; } public void Set(Th095.HeaderBase header) => this.Header = header; public void Set(IScore score) => this.scores.Add(score); public void Set(IStatus status) => this.Status = status; } }
//----------------------------------------------------------------------- // <copyright file="AllScoreData.cs" company="None"> // Copyright (c) IIHOSHI Yoshinori. // Licensed under the BSD-2-Clause license. See LICENSE.txt file in the project root for full license information. // </copyright> //----------------------------------------------------------------------- #pragma warning disable SA1600 // Elements should be documented using System.Collections.Generic; namespace ThScoreFileConverter.Models.Th165 { internal class AllScoreData { private readonly List<IScore> scores; public AllScoreData() { this.scores = new List<IScore>(Definitions.SpellCards.Count); } public Th095.HeaderBase Header { get; private set; } public IReadOnlyList<IScore> Scores => this.scores; public IStatus Status { get; private set; } public void Set(Th095.HeaderBase header) => this.Header = header; public void Set(IScore score) => this.scores.Add(score); public void Set(IStatus status) => this.Status = status; } }
Fix not to use expression-bodied constructors (cont.)
Fix not to use expression-bodied constructors (cont.)
C#
bsd-2-clause
y-iihoshi/ThScoreFileConverter,y-iihoshi/ThScoreFileConverter
fdee45a5d4396adbd9fb96fa2e488fbc39657924
MultiMiner.Win/Extensions/TimeIntervalExtensions.cs
MultiMiner.Win/Extensions/TimeIntervalExtensions.cs
namespace MultiMiner.Win.Extensions { static class TimeIntervalExtensions { public static int ToMinutes(this MultiMiner.Win.ApplicationConfiguration.TimerInterval timerInterval) { int coinStatsMinutes; switch (timerInterval) { case ApplicationConfiguration.TimerInterval.FiveMinutes: coinStatsMinutes = 5; break; case ApplicationConfiguration.TimerInterval.ThirtyMinutes: coinStatsMinutes = 30; break; case ApplicationConfiguration.TimerInterval.OneHour: coinStatsMinutes = 1 * 60; break; case ApplicationConfiguration.TimerInterval.ThreeHours: coinStatsMinutes = 3 * 60; break; case ApplicationConfiguration.TimerInterval.SixHours: coinStatsMinutes = 6 * 60; break; case ApplicationConfiguration.TimerInterval.TwelveHours: coinStatsMinutes = 12 * 60; break; default: coinStatsMinutes = 15; break; } return coinStatsMinutes; } } }
namespace MultiMiner.Win.Extensions { static class TimeIntervalExtensions { public static int ToMinutes(this MultiMiner.Win.ApplicationConfiguration.TimerInterval timerInterval) { int coinStatsMinutes; switch (timerInterval) { case ApplicationConfiguration.TimerInterval.FiveMinutes: coinStatsMinutes = 5; break; case ApplicationConfiguration.TimerInterval.ThirtyMinutes: coinStatsMinutes = 30; break; case ApplicationConfiguration.TimerInterval.OneHour: coinStatsMinutes = 1 * 60; break; case ApplicationConfiguration.TimerInterval.TwoHours: coinStatsMinutes = 2 * 60; break; case ApplicationConfiguration.TimerInterval.ThreeHours: coinStatsMinutes = 3 * 60; break; case ApplicationConfiguration.TimerInterval.SixHours: coinStatsMinutes = 6 * 60; break; case ApplicationConfiguration.TimerInterval.TwelveHours: coinStatsMinutes = 12 * 60; break; default: coinStatsMinutes = 15; break; } return coinStatsMinutes; } } }
Handle the TwoHour time interval for strategies - was defaulting to 15
Handle the TwoHour time interval for strategies - was defaulting to 15
C#
mit
nwoolls/MultiMiner,IWBWbiz/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner
594011aab84e206901361ea3106f4da1d26aa86f
cslacs/Csla/Serialization/Mobile/NullPlaceholder.cs
cslacs/Csla/Serialization/Mobile/NullPlaceholder.cs
using System; namespace Csla.Serialization.Mobile { /// <summary> /// Placeholder for null child objects. /// </summary> [Serializable()] public sealed class NullPlaceholder : IMobileObject { #region Constructors public NullPlaceholder() { // Nothing } #endregion #region IMobileObject Members public void GetState(SerializationInfo info) { // Nothing } public void GetChildren(SerializationInfo info, MobileFormatter formatter) { // Nothing } public void SetState(SerializationInfo info) { // Nothing } public void SetChildren(SerializationInfo info, MobileFormatter formatter) { // Nothing } #endregion } }
using System; namespace Csla.Serialization.Mobile { /// <summary> /// Placeholder for null child objects. /// </summary> [Serializable()] public sealed class NullPlaceholder : IMobileObject { #region Constructors /// <summary> /// Creates an instance of the type. /// </summary> public NullPlaceholder() { // Nothing } #endregion #region IMobileObject Members /// <summary> /// Method called by MobileFormatter when an object /// should serialize its data. The data should be /// serialized into the SerializationInfo parameter. /// </summary> /// <param name="info"> /// Object to contain the serialized data. /// </param> public void GetState(SerializationInfo info) { // Nothing } /// <summary> /// Method called by MobileFormatter when an object /// should serialize its child references. The data should be /// serialized into the SerializationInfo parameter. /// </summary> /// <param name="info"> /// Object to contain the serialized data. /// </param> /// <param name="formatter"> /// Reference to the formatter performing the serialization. /// </param> public void GetChildren(SerializationInfo info, MobileFormatter formatter) { // Nothing } /// <summary> /// Method called by MobileFormatter when an object /// should be deserialized. The data should be /// deserialized from the SerializationInfo parameter. /// </summary> /// <param name="info"> /// Object containing the serialized data. /// </param> public void SetState(SerializationInfo info) { // Nothing } /// <summary> /// Method called by MobileFormatter when an object /// should deserialize its child references. The data should be /// deserialized from the SerializationInfo parameter. /// </summary> /// <param name="info"> /// Object containing the serialized data. /// </param> /// <param name="formatter"> /// Reference to the formatter performing the deserialization. /// </param> public void SetChildren(SerializationInfo info, MobileFormatter formatter) { // Nothing } #endregion } }
Add missing XML docs to code. bugid: 272
Add missing XML docs to code. bugid: 272
C#
mit
MarimerLLC/csla,BrettJaner/csla,rockfordlhotka/csla,BrettJaner/csla,JasonBock/csla,MarimerLLC/csla,jonnybee/csla,BrettJaner/csla,rockfordlhotka/csla,JasonBock/csla,ronnymgm/csla-light,MarimerLLC/csla,ronnymgm/csla-light,jonnybee/csla,jonnybee/csla,rockfordlhotka/csla,JasonBock/csla,ronnymgm/csla-light
bf3936140f0cccdfcf5de58d06e850760055920f
crm/CEP/UserProfile.cs
crm/CEP/UserProfile.cs
// Copyright (c) ComUnity 2015 // Hans Malherbe <hansm@comunity.co.za> using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Web; namespace CEP { public class UserProfile { [Key, Required, StringLength(10, MinimumLength = 10, ErrorMessage = "Mobile number must be exactly 10 digits")] public string Cell { get; set; } [StringLength(50)] public string Name { get; set; } [StringLength(50)] public string Surname { get; set; } [StringLength(100)] public string HouseNumberAndStreetName { get; set; } [StringLength(10)] public string PostalCode { get; set; } [StringLength(50)] public string Province { get; set; } [StringLength(100)] public string Picture { get; set; } [StringLength(10)] public string HomePhone { get; set; } [StringLength(10)] public string WorkPhone { get; set; } [StringLength(350)] public string Email { get; set; } [StringLength(13)] public string IdNumber { get; set; } [StringLength(100)] public string CrmContactId { get; set; } public virtual ICollection<Feedback> Feedbacks { get; set; } public virtual ICollection<FaultLog> Faults { get; set; } } }
// Copyright (c) ComUnity 2015 // Hans Malherbe <hansm@comunity.co.za> using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Web; namespace CEP { public class UserProfile { [Key, Required, StringLength(10, MinimumLength = 10, ErrorMessage = "Mobile number must be exactly 10 digits")] public string Cell { get; set; } [StringLength(50)] public string Name { get; set; } [StringLength(50)] public string Surname { get; set; } [StringLength(100)] public string HouseNumberAndStreetName { get; set; } [StringLength(10)] public string PostalCode { get; set; } [StringLength(50)] public string Province { get; set; } [StringLength(2000)] public string PictureUrl { get; set; } [StringLength(10)] public string HomePhone { get; set; } [StringLength(10)] public string WorkPhone { get; set; } [StringLength(350)] public string Email { get; set; } [StringLength(13)] public string IdNumber { get; set; } [StringLength(100)] public string CrmContactId { get; set; } public virtual ICollection<Feedback> Feedbacks { get; set; } public virtual ICollection<FaultLog> Faults { get; set; } } }
Change user picture field to PictureUrl
Change user picture field to PictureUrl
C#
mit
comunity/crm
fc2277bc580e53214c497210790067b3aa3137c9
AhoCorasick/Extensions.cs
AhoCorasick/Extensions.cs
using System.Collections.Generic; namespace Ganss.Text { /// <summary> /// Provides extension methods. /// </summary> public static class Extensions { /// <summary> /// Determines whether this instance contains the specified words. /// </summary> /// <param name="text">The text.</param> /// <param name="words">The words.</param> /// <returns>The matched words.</returns> public static IEnumerable<WordMatch> Contains(this string text, IEnumerable<string> words) { return new AhoCorasick(words).Search(text); } /// <summary> /// Determines whether this instance contains the specified words. /// </summary> /// <param name="text">The text.</param> /// <param name="words">The words.</param> /// <returns>The matched words.</returns> public static IEnumerable<WordMatch> Contains(this string text, params string[] words) { return new AhoCorasick(words).Search(text); } } }
using System.Collections.Generic; namespace Ganss.Text { /// <summary> /// Provides extension methods. /// </summary> public static class Extensions { /// <summary> /// Determines whether this instance contains the specified words. /// </summary> /// <param name="text">The text.</param> /// <param name="words">The words.</param> /// <returns>The matched words.</returns> public static IEnumerable<WordMatch> Contains(this string text, IEnumerable<string> words) { return new AhoCorasick(words).Search(text); } /// <summary> /// Determines whether this instance contains the specified words. /// </summary> /// <param name="text">The text.</param> /// <param name="words">The words.</param> /// <returns>The matched words.</returns> public static IEnumerable<WordMatch> Contains(this string text, params string[] words) { return new AhoCorasick(words).Search(text); } /// <summary> /// Determines whether this instance contains the specified words. /// </summary> /// <param name="text">The text.</param> /// <param name="comparer">The comparer used to compare individual characters.</param> /// <param name="words">The words.</param> /// <returns>The matched words.</returns> public static IEnumerable<WordMatch> Contains(this string text, IEqualityComparer<char> comparer, IEnumerable<string> words) { return new AhoCorasick(comparer, words).Search(text); } /// <summary> /// Determines whether this instance contains the specified words. /// </summary> /// <param name="text">The text.</param> /// <param name="comparer">The comparer used to compare individual characters.</param> /// <param name="words">The words.</param> /// <returns>The matched words.</returns> public static IEnumerable<WordMatch> Contains(this string text, IEqualityComparer<char> comparer, params string[] words) { return new AhoCorasick(comparer, words).Search(text); } } }
Add custom char comparison to extension methods
Add custom char comparison to extension methods
C#
mit
mganss/AhoCorasick
26932d153cf2924314191056c1dff422e2a53a7a
src/contrib/loggers/Akka.Serilog/Event/Serilog/SerilogLogMessageFormatter.cs
src/contrib/loggers/Akka.Serilog/Event/Serilog/SerilogLogMessageFormatter.cs
using System; using System.Collections.Generic; using System.Linq; using Akka.Event; using Serilog.Events; using Serilog.Parsing; namespace Akka.Serilog.Event.Serilog { public class SerilogLogMessageFormatter : ILogMessageFormatter { private readonly MessageTemplateCache _templateCache; public SerilogLogMessageFormatter() { _templateCache = new MessageTemplateCache(new MessageTemplateParser()); } public string Format(string format, params object[] args) { var template = _templateCache.Parse(format); var propertyTokens = template.Tokens.OfType<PropertyToken>().ToArray(); var properties = new Dictionary<string, LogEventPropertyValue>(); if (propertyTokens.Length != args.Length) throw new FormatException("Invalid number or arguments provided."); for (var i = 0; i < propertyTokens.Length; i++) { var arg = args[i]; properties.Add(propertyTokens[i].PropertyName, new ScalarValue(arg)); } return template.Render(properties); } } }
using System; using System.Collections.Generic; using System.Linq; using Akka.Event; using Serilog.Events; using Serilog.Parsing; namespace Akka.Serilog.Event.Serilog { public class SerilogLogMessageFormatter : ILogMessageFormatter { private readonly MessageTemplateCache _templateCache; public SerilogLogMessageFormatter() { _templateCache = new MessageTemplateCache(new MessageTemplateParser()); } public string Format(string format, params object[] args) { var template = _templateCache.Parse(format); var propertyTokens = template.Tokens.OfType<PropertyToken>().ToArray(); var properties = new Dictionary<string, LogEventPropertyValue>(); for (var i = 0; i < args.Length; i++) { var propertyToken = propertyTokens.ElementAtOrDefault(i); if (propertyToken == null) break; properties.Add(propertyToken.PropertyName, new ScalarValue(args[i])); } return template.Render(properties); } } }
Change the way we match args to property tokens to more closely match Serilog when you pass in too few or too many arguments
Change the way we match args to property tokens to more closely match Serilog when you pass in too few or too many arguments
C#
apache-2.0
kekekeks/akka.net,jordansjones/akka.net,jordansjones/akka.net,dyanarose/akka.net,willieferguson/akka.net,vchekan/akka.net,Micha-kun/akka.net,nvivo/akka.net,d--g/akka.net,forki/akka.net,dbolkensteyn/akka.net,willieferguson/akka.net,neekgreen/akka.net,thelegendofando/akka.net,rogeralsing/akka.net,cpx/akka.net,JeffCyr/akka.net,silentnull/akka.net,d--g/akka.net,alexpantyukhin/akka.net,trbngr/akka.net,eloraiby/akka.net,thelegendofando/akka.net,ali-ince/akka.net,zbrad/akka.net,forki/akka.net,stefansedich/akka.net,GeorgeFocas/akka.net,numo16/akka.net,ashic/akka.net,Silv3rcircl3/akka.net,forki/akka.net,matiii/akka.net,neekgreen/akka.net,naveensrinivasan/akka.net,adamhathcock/akka.net,AntoineGa/akka.net,kstaruch/akka.net,billyxing/akka.net,kstaruch/akka.net,stefansedich/akka.net,alex-kondrashov/akka.net,KadekM/akka.net,heynickc/akka.net,eisendle/akka.net,simonlaroche/akka.net,silentnull/akka.net,chris-ray/akka.net,Silv3rcircl3/akka.net,nanderto/akka.net,skotzko/akka.net,Chinchilla-Software-Com/akka.net,kerryjiang/akka.net,dyanarose/akka.net,adamhathcock/akka.net,gwokudasam/akka.net,KadekM/akka.net,kerryjiang/akka.net,amichel/akka.net,cpx/akka.net,derwasp/akka.net,linearregression/akka.net,matiii/akka.net,JeffCyr/akka.net,akoshelev/akka.net,MAOliver/akka.net,tillr/akka.net,forki/akka.net,nvivo/akka.net,dbolkensteyn/akka.net,naveensrinivasan/akka.net,michal-franc/akka.net,kekekeks/akka.net,alexvaluyskiy/akka.net,rogeralsing/akka.net,heynickc/akka.net,ali-ince/akka.net,derwasp/akka.net,chris-ray/akka.net,zbrad/akka.net,akoshelev/akka.net,bruinbrown/akka.net,billyxing/akka.net,eloraiby/akka.net,amichel/akka.net,simonlaroche/akka.net,gwokudasam/akka.net,eisendle/akka.net,rodrigovidal/akka.net,alexpantyukhin/akka.net,numo16/akka.net,rodrigovidal/akka.net,michal-franc/akka.net,ashic/akka.net,AntoineGa/akka.net,skotzko/akka.net,alex-kondrashov/akka.net,cdmdotnet/akka.net,MAOliver/akka.net,tillr/akka.net,GeorgeFocas/akka.net,nanderto/akka.net,linearregression/akka.net,bruinbrown/akka.net,vchekan/akka.net,cdmdotnet/akka.net,trbngr/akka.net,alexvaluyskiy/akka.net,Chinchilla-Software-Com/akka.net,Micha-kun/akka.net
e2f002e871b7c5d1989a4f5e16dc706a9a8f1a4a
CorePlugin/ScriptExecutor.cs
CorePlugin/ScriptExecutor.cs
using System; using System.Collections.Generic; using System.Linq; using Duality; using RockyTV.Duality.Plugins.IronPython.Resources; using IronPython.Hosting; using IronPython.Runtime; using IronPython.Compiler; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; namespace RockyTV.Duality.Plugins.IronPython { public class ScriptExecutor : Component, ICmpInitializable, ICmpUpdatable { public ContentRef<PythonScript> Script { get; set; } [DontSerialize] private PythonExecutionEngine _engine; protected PythonExecutionEngine Engine { get { return _engine; } } public void OnInit(InitContext context) { if (!Script.IsAvailable) return; _engine = new PythonExecutionEngine(Script.Res.Content); _engine.SetVariable("gameObject", GameObj); if (_engine.HasMethod("start")) _engine.CallMethod("start"); } public void OnUpdate() { if (_engine.HasMethod("update")) _engine.CallMethod("update"); } public void OnShutdown(ShutdownContext context) { if (context == ShutdownContext.Deactivate) { GameObj.DisposeLater(); } } } }
using System; using System.Collections.Generic; using System.Linq; using Duality; using RockyTV.Duality.Plugins.IronPython.Resources; using IronPython.Hosting; using IronPython.Runtime; using IronPython.Compiler; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; namespace RockyTV.Duality.Plugins.IronPython { public class ScriptExecutor : Component, ICmpInitializable, ICmpUpdatable { public ContentRef<PythonScript> Script { get; set; } [DontSerialize] private PythonExecutionEngine _engine; protected PythonExecutionEngine Engine { get { return _engine; } } protected virtual float Delta { get { return Time.MsPFMult * Time.TimeMult; } } public void OnInit(InitContext context) { if (!Script.IsAvailable) return; _engine = new PythonExecutionEngine(Script.Res.Content); _engine.SetVariable("gameObject", GameObj); if (_engine.HasMethod("start")) _engine.CallMethod("start"); } public void OnUpdate() { if (_engine.HasMethod("update")) _engine.CallMethod("update", Delta); } public void OnShutdown(ShutdownContext context) { if (context == ShutdownContext.Deactivate) { GameObj.DisposeLater(); } } } }
Call 'update' with Delta time
Call 'update' with Delta time
C#
mit
RockyTV/Duality.IronPython
c9123df98c2772c98a37161b51e796ceb5e8bc94
source/Assets/Scripts/Loader.cs
source/Assets/Scripts/Loader.cs
using UnityEngine; using System.Reflection; [assembly: AssemblyVersion("1.0.0.*")] public class Loader : MonoBehaviour { /// <summary> /// DebugUI prefab to instantiate. /// </summary> [SerializeField] private GameObject _debugUI; /// <summary> /// ModalDialog prefab to instantiate. /// </summary> [SerializeField] private GameObject _modalDialog; /// <summary> /// MainMenu prefab to instantiate. /// </summary> [SerializeField] private GameObject _mainMenu; /// <summary> /// InGameUI prefab to instantiate. /// </summary> [SerializeField] private GameObject _inGameUI; /// <summary> /// SoundManager prefab to instantiate. /// </summary> [SerializeField] private GameObject _soundManager; /// <summary> /// GameManager prefab to instantiate. /// </summary> [SerializeField] private GameObject _gameManager; protected void Awake() { // Check if the instances have already been assigned to static variables or they are still null. if (DebugUI.Instance == null) { Instantiate(_debugUI); } if (ModalDialog.Instance == null) { Instantiate(_modalDialog); } if (MainMenu.Instance == null) { Instantiate(_mainMenu); } if (InGameUI.Instance == null) { Instantiate(_inGameUI); } if (SoundManager.Instance == null) { Instantiate(_soundManager); } if (GameManager.Instance == null) { Instantiate(_gameManager); } } }
using UnityEngine; using System.Reflection; [assembly: AssemblyVersion("1.1.0.*")] public class Loader : MonoBehaviour { /// <summary> /// DebugUI prefab to instantiate. /// </summary> [SerializeField] private GameObject _debugUI; /// <summary> /// ModalDialog prefab to instantiate. /// </summary> [SerializeField] private GameObject _modalDialog; /// <summary> /// MainMenu prefab to instantiate. /// </summary> [SerializeField] private GameObject _mainMenu; /// <summary> /// InGameUI prefab to instantiate. /// </summary> [SerializeField] private GameObject _inGameUI; /// <summary> /// SoundManager prefab to instantiate. /// </summary> [SerializeField] private GameObject _soundManager; /// <summary> /// GameManager prefab to instantiate. /// </summary> [SerializeField] private GameObject _gameManager; protected void Awake() { // Check if the instances have already been assigned to static variables or they are still null. if (DebugUI.Instance == null) { Instantiate(_debugUI); } if (ModalDialog.Instance == null) { Instantiate(_modalDialog); } if (MainMenu.Instance == null) { Instantiate(_mainMenu); } if (InGameUI.Instance == null) { Instantiate(_inGameUI); } if (SoundManager.Instance == null) { Instantiate(_soundManager); } if (GameManager.Instance == null) { Instantiate(_gameManager); } } }
Change version up to 1.1.0
Change version up to 1.1.0
C#
unknown
matiasbeckerle/breakout,matiasbeckerle/perspektiva,matiasbeckerle/arkanoid
00103e2f65005dfb62c9f08f42495f9fa86fddeb
src/ConsoleApp/Program.cs
src/ConsoleApp/Program.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using static System.Console; namespace ConsoleApp { public class Table { private readonly string tableName; private readonly IEnumerable<Column> columns; public Table(string tableName, IEnumerable<Column> columns) { this.tableName = tableName; this.columns = columns; } public void OutputMigrationCode(TextWriter writer) { writer.Write(@"namespace Cucu { [Migration("); writer.Write(DateTime.Now.ToString("yyyyMMddHHmmss")); writer.Write(@")] public class Vaca : Migration { public override void Up() { Create.Table("""); writer.Write(tableName); writer.Write(@""")"); columns.ToList().ForEach(c => { writer.WriteLine(); writer.Write(c.FluentMigratorCode()); }); writer.WriteLine(@"; } public override void Down() { // nothing here yet } } }"); } } class Program { private static void Main() { var columnsProvider = new ColumnsProvider(@"Server=.\SQLEXPRESS;Database=LearnORM;Trusted_Connection=True;"); var tableName = "Book"; var columns = columnsProvider.GetColumnsAsync("dbo", tableName).GetAwaiter().GetResult(); new Table(tableName, columns).OutputMigrationCode(Out); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using static System.Console; namespace ConsoleApp { public class Table { private readonly string tableName; private readonly IEnumerable<Column> columns; public Table(string tableName, IEnumerable<Column> columns) { this.tableName = tableName; this.columns = columns; } public void OutputMigrationCode(TextWriter writer) { writer.Write(@"namespace Cucu { [Migration("); writer.Write(DateTime.Now.ToString("yyyyMMddHHmmss")); writer.Write(@")] public class Vaca : Migration { public override void Up() { Create.Table("""); writer.Write(tableName); writer.Write(@""")"); columns.ToList().ForEach(c => { writer.WriteLine(); writer.Write(c.FluentMigratorCode()); }); writer.WriteLine(@"; } public override void Down() { // nothing here yet } } }"); } } class Program { private static void Main() { var connectionString = @"Server=.\SQLEXPRESS;Database=LearnORM;Trusted_Connection=True;"; var schemaName = "dbo"; var tableName = "Book"; var columnsProvider = new ColumnsProvider(connectionString); var columns = columnsProvider.GetColumnsAsync(schemaName, tableName).GetAwaiter().GetResult(); new Table(tableName, columns).OutputMigrationCode(Out); } } }
Put variables in Main first
Put variables in Main first
C#
mit
TeamnetGroup/schema2fm
b79cb544944fa2c9fe0bdf22e1dcab3494d8cd62
Assets/MRTK/Examples/Demos/HandTracking/Scripts/LeapMotionOrientationDisplay.cs
Assets/MRTK/Examples/Demos/HandTracking/Scripts/LeapMotionOrientationDisplay.cs
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using UnityEngine; using Microsoft.MixedReality.Toolkit.Input; using TMPro; #if LEAPMOTIONCORE_PRESENT using Microsoft.MixedReality.Toolkit.LeapMotion.Input; #endif namespace Microsoft.MixedReality.Toolkit.Examples { /// <summary> /// Returns the orientation of Leap Motion Controller /// </summary> public class LeapMotionOrientationDisplay : MonoBehaviour { #if LEAPMOTIONCORE_PRESENT [SerializeField] private TextMeshProUGUI orientationText; private LeapMotionDeviceManagerProfile managerProfile; private void Start() { if (GetLeapManager()) { orientationText.text = "Orientation: " + GetLeapManager().LeapControllerOrientation.ToString(); } else { orientationText.text = "Orientation: Unavailable"; } } private LeapMotionDeviceManagerProfile GetLeapManager() { if (!MixedRealityToolkit.Instance.ActiveProfile) { return null; } foreach (MixedRealityInputDataProviderConfiguration config in MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.DataProviderConfigurations) { if (config.ComponentType == typeof(LeapMotionDeviceManager)) { managerProfile = (LeapMotionDeviceManagerProfile)config.Profile; return managerProfile; } } return null; } #endif } }
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using UnityEngine; using Microsoft.MixedReality.Toolkit.Input; using TMPro; #if LEAPMOTIONCORE_PRESENT && UNITY_STANDALONE using Microsoft.MixedReality.Toolkit.LeapMotion.Input; #endif namespace Microsoft.MixedReality.Toolkit.Examples { /// <summary> /// Returns the orientation of Leap Motion Controller /// </summary> public class LeapMotionOrientationDisplay : MonoBehaviour { #if LEAPMOTIONCORE_PRESENT && UNITY_STANDALONE [SerializeField] private TextMeshProUGUI orientationText; private LeapMotionDeviceManagerProfile managerProfile; private void Start() { if (GetLeapManager()) { orientationText.text = "Orientation: " + GetLeapManager().LeapControllerOrientation.ToString(); } else { orientationText.text = "Orientation: Unavailable"; } } private LeapMotionDeviceManagerProfile GetLeapManager() { if (!MixedRealityToolkit.Instance.ActiveProfile) { return null; } foreach (MixedRealityInputDataProviderConfiguration config in MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.DataProviderConfigurations) { if (config.ComponentType == typeof(LeapMotionDeviceManager)) { managerProfile = (LeapMotionDeviceManagerProfile)config.Profile; return managerProfile; } } return null; } #endif } }
Add standalone ifdef to leap example scene script
Add standalone ifdef to leap example scene script
C#
mit
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
79af64b94c137e394d16483d3aa7cc0d50eebaad
src/SmugMugCodeGen/Constants.cs
src/SmugMugCodeGen/Constants.cs
// Copyright (c) Alex Ghiondea. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace SmugMugCodeGen { public static class Constants { public const string PropertyDefinition = @"public {0} {1} {{get; set;}}"; public const string EnumDefinition = @"// Copyright (c) Alex Ghiondea. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace SmugMug.v2.Types {{ public enum {0} {{ {1} }} }} "; public const string ClassDefinition = @"// Copyright (c) Alex Ghiondea. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; namespace SmugMug.v2.Types {{ public partial class {0}Entity {{ {1} }} }} "; } }
// Copyright (c) Alex Ghiondea. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace SmugMugCodeGen { public static class Constants { public const string PropertyDefinition = @"public {0} {1} {{get; set;}}"; public const string EnumDefinition = @"// Copyright (c) Alex Ghiondea. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace SmugMug.v2.Types {{ public enum {0} {{ {1} }} }} "; public const string ClassDefinition = @"// Copyright (c) Alex Ghiondea. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; namespace SmugMug.v2.Types {{ public partial class {0}Entity : SmugMugEntity {{ {1} }} }} "; } }
Make sure that classes generated derive from a common type to allow code sharing
Make sure that classes generated derive from a common type to allow code sharing
C#
mit
AlexGhiondea/SmugMug.NET
0a2a9c21a8d37276d682a1af62614fc44e53b7e5
Assets/Gameflow/Levels.cs
Assets/Gameflow/Levels.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Levels : MonoBehaviour { /* Cette classe a pour destin d'être sur un prefab. * Ce prefab agira comme une config manuelle de niveaux pour faciliter le level design. * On pourra faire différentes configs si on veut (mettons une par difficulté) et ultimement glisser cette config dans le gamecontroller * pour qu'il s'en serve. * */ [SerializeField] WorkDay[] days; int currentLevel = 0; public void StartNext() { //starts next level } public void EndCurrent() { //ends current level currentLevel++; if (days[currentLevel].AddsJob) { // add a job to pool } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Levels : MonoBehaviour { /* Cette classe a pour destin d'être sur un prefab. * Ce prefab agira comme une config manuelle de niveaux pour faciliter le level design. * On pourra faire différentes configs si on veut (mettons une par difficulté) et ultimement glisser cette config dans le gamecontroller * pour qu'il s'en serve. * */ [SerializeField] WorkDay[] days; [SerializeField] int maxJobCount; int currentLevel = 0; public void StartNext() { //starts next level } public void EndCurrent() { //ends current level currentLevel++; if (days[currentLevel].AddsJob) { // add a job to pool // if this brings us over maximum, change a job instead } } }
Add max job count to levels
Add max job count to levels
C#
mit
LeBodro/super-salaryman-2044
2ffc72b75ffc89de892d92e0e028ccd7e22e866f
src/Cassette.UnitTests/PlaceholderTracker.cs
src/Cassette.UnitTests/PlaceholderTracker.cs
using System; using System.Text.RegularExpressions; using Should; using Xunit; namespace Cassette.UI { public class PlaceholderTracker_Tests { [Fact] public void WhenInsertPlaceholder_ThenPlaceholderIdHtmlReturned() { var tracker = new PlaceholderTracker(); var result = tracker.InsertPlaceholder(() => ("")); var guidRegex = new Regex(@"[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}"); var output = result; guidRegex.IsMatch(output).ShouldBeTrue(); } [Fact] public void GivenInsertPlaceholder_WhenReplacePlaceholders_ThenHtmlInserted() { var tracker = new PlaceholderTracker(); var html = tracker.InsertPlaceholder(() => ("<p>test</p>")); tracker.ReplacePlaceholders(html).ShouldEqual( Environment.NewLine + "<p>test</p>" + Environment.NewLine ); } } }
using System; using System.Text.RegularExpressions; using Should; using Xunit; namespace Cassette { public class PlaceholderTracker_Tests { [Fact] public void WhenInsertPlaceholder_ThenPlaceholderIdHtmlReturned() { var tracker = new PlaceholderTracker(); var result = tracker.InsertPlaceholder(() => ("")); var guidRegex = new Regex(@"[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}"); var output = result; guidRegex.IsMatch(output).ShouldBeTrue(); } [Fact] public void GivenInsertPlaceholder_WhenReplacePlaceholders_ThenHtmlInserted() { var tracker = new PlaceholderTracker(); var html = tracker.InsertPlaceholder(() => ("<p>test</p>")); tracker.ReplacePlaceholders(html).ShouldEqual( Environment.NewLine + "<p>test</p>" + Environment.NewLine ); } } }
Move test into correct namespace.
Move test into correct namespace.
C#
mit
BluewireTechnologies/cassette,damiensawyer/cassette,damiensawyer/cassette,andrewdavey/cassette,honestegg/cassette,andrewdavey/cassette,damiensawyer/cassette,andrewdavey/cassette,honestegg/cassette,honestegg/cassette,BluewireTechnologies/cassette
86cc010df40d362917c46c3f5551192a06d0041a
Modix.Services/StackExchange/StackExchangeService.cs
Modix.Services/StackExchange/StackExchangeService.cs
using Newtonsoft.Json; using System; using System.Net; using System.Net.Http; using System.Threading.Tasks; namespace Modix.Services.StackExchange { public class StackExchangeService { private string _ApiReferenceUrl = $"http://api.stackexchange.com/2.2/search/advanced" + "?key={0}" + $"&order=desc" + $"&sort=votes" + $"&filter=default"; public async Task<StackExchangeResponse> GetStackExchangeResultsAsync(string token, string phrase, string site, string tags) { _ApiReferenceUrl = string.Format(_ApiReferenceUrl, token); phrase = Uri.EscapeDataString(phrase); site = Uri.EscapeDataString(site); tags = Uri.EscapeDataString(tags); var query = _ApiReferenceUrl += $"&site={site}&tags={tags}&q={phrase}"; var client = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip }); var response = await client.GetAsync(query); if (!response.IsSuccessStatusCode) { throw new WebException("Something failed while querying the Stack Exchange API."); } var json = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject<StackExchangeResponse>(json); } } }
using Newtonsoft.Json; using System; using System.Net; using System.Net.Http; using System.Threading.Tasks; namespace Modix.Services.StackExchange { public class StackExchangeService { private static HttpClient HttpClient => new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip }); private string _ApiReferenceUrl = $"http://api.stackexchange.com/2.2/search/advanced" + "?key={0}" + $"&order=desc" + $"&sort=votes" + $"&filter=default"; public async Task<StackExchangeResponse> GetStackExchangeResultsAsync(string token, string phrase, string site, string tags) { _ApiReferenceUrl = string.Format(_ApiReferenceUrl, token); phrase = Uri.EscapeDataString(phrase); site = Uri.EscapeDataString(site); tags = Uri.EscapeDataString(tags); var query = _ApiReferenceUrl += $"&site={site}&tags={tags}&q={phrase}"; var response = await HttpClient.GetAsync(query); if (!response.IsSuccessStatusCode) { throw new WebException("Something failed while querying the Stack Exchange API."); } var jsonResponse = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject<StackExchangeResponse>(jsonResponse); } } }
Use static HttpClient in SO module
Use static HttpClient in SO module
C#
mit
mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX
093c8de0139e6e834f6eb2ee29bf0d7ead9801ac
GanttChart/Properties/AssemblyInfo.cs
GanttChart/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(".NET Winforms Gantt Chart Control")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Braincase Solutions")] [assembly: AssemblyProduct("GanttChartControl")] [assembly: AssemblyCopyright("Copyright © 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("e316b126-c783-4060-95b9-aa8ee2e676d7")] // 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.3")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle(".NET Winforms Gantt Chart Control")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Braincase Solutions")] [assembly: AssemblyProduct("GanttChartControl")] [assembly: AssemblyCopyright("Copyright © 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("e316b126-c783-4060-95b9-aa8ee2e676d7")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.1")] [assembly: AssemblyFileVersion("1.0.0.4")]
Fix assembly and file versions
Fix assembly and file versions
C#
mit
jakesee/ganttchart
442b3f0cea7fc5f38ffd58bd9aae71893b95b0ac
Consul.Test/CoordinateTest.cs
Consul.Test/CoordinateTest.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Consul.Test { [TestClass] public class CoordinateTest { [TestMethod] public void TestCoordinate_Datacenters() { var client = new Client(); var info = client.Agent.Self(); if (!info.Response.ContainsKey("Coord")) { Assert.Inconclusive("This version of Consul does not support the coordinate API"); } var datacenters = client.Coordinate.Datacenters(); Assert.IsNotNull(datacenters.Response); Assert.IsTrue(datacenters.Response.Length > 0); } [TestMethod] public void TestCoordinate_Nodes() { var client = new Client(); var info = client.Agent.Self(); if (!info.Response.ContainsKey("Coord")) { Assert.Inconclusive("This version of Consul does not support the coordinate API"); } var nodes = client.Coordinate.Nodes(); Assert.IsNotNull(nodes.Response); Assert.IsTrue(nodes.Response.Length > 0); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Consul.Test { [TestClass] public class CoordinateTest { [TestMethod] public void Coordinate_Datacenters() { var client = new Client(); var info = client.Agent.Self(); if (!info.Response.ContainsKey("Coord")) { Assert.Inconclusive("This version of Consul does not support the coordinate API"); } var datacenters = client.Coordinate.Datacenters(); Assert.IsNotNull(datacenters.Response); Assert.IsTrue(datacenters.Response.Length > 0); } [TestMethod] public void Coordinate_Nodes() { var client = new Client(); var info = client.Agent.Self(); if (!info.Response.ContainsKey("Coord")) { Assert.Inconclusive("This version of Consul does not support the coordinate API"); } var nodes = client.Coordinate.Nodes(); // There's not a good way to populate coordinates without // waiting for them to calculate and update, so the best // we can do is call the endpoint and make sure we don't // get an error. - from offical API. Assert.IsNotNull(nodes); } } }
Reduce testing of coordinate nodes call
Reduce testing of coordinate nodes call
C#
apache-2.0
PlayFab/consuldotnet
1cb2c95b281e9d071ff27184d9735b15c3a7ee4c
PackageExplorer/Converters/PackageIconConverter.cs
PackageExplorer/Converters/PackageIconConverter.cs
using System; using System.Globalization; using System.Windows.Data; using System.Windows.Media.Imaging; using PackageExplorerViewModel; namespace PackageExplorer { public class PackageIconConverter : IMultiValueConverter { #region IMultiValueConverter Members public object? Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values?.Length > 1 && values[0] is PackageViewModel package && values[1] is string str && !string.IsNullOrEmpty(str)) { var metadata = package.PackageMetadata; if (!string.IsNullOrEmpty(metadata.Icon)) { foreach (var file in package.RootFolder.GetFiles()) { if (string.Equals(file.Path, metadata.Icon, StringComparison.OrdinalIgnoreCase)) { var image = new BitmapImage(); image.BeginInit(); image.CacheOption = BitmapCacheOption.OnLoad; image.StreamSource = file.GetStream(); image.EndInit(); return image; } } } if (metadata.IconUrl != null) { var image = new BitmapImage(); image.BeginInit(); image.UriSource = metadata.IconUrl; image.EndInit(); return image; } } return null; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } #endregion } }
using System; using System.Globalization; using System.Windows.Data; using System.Windows.Media.Imaging; using PackageExplorerViewModel; namespace PackageExplorer { public class PackageIconConverter : IMultiValueConverter { #region IMultiValueConverter Members public object? Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values?.Length > 1 && values[0] is PackageViewModel package && values[1] is string str && !string.IsNullOrEmpty(str)) { var metadata = package.PackageMetadata; if (!string.IsNullOrEmpty(metadata.Icon)) { // Normalize any directories to match what's the package // We do this here instead of the metadata so that we round-trip // whatever the user originally had when in edit view var iconPath = metadata.Icon.Replace('/', '\\'); foreach (var file in package.RootFolder.GetFiles()) { if (string.Equals(file.Path, iconPath, StringComparison.OrdinalIgnoreCase)) { var image = new BitmapImage(); image.BeginInit(); image.CacheOption = BitmapCacheOption.OnLoad; image.StreamSource = file.GetStream(); image.EndInit(); return image; } } } if (metadata.IconUrl != null) { var image = new BitmapImage(); image.BeginInit(); image.UriSource = metadata.IconUrl; image.EndInit(); return image; } } return null; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } #endregion } }
Normalize directory separator char for finding the embedded icon
Normalize directory separator char for finding the embedded icon
C#
mit
campersau/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer
8031e4874db385b2122f699930027637dd84f118
Octokit/Models/Response/GitHubCommit.cs
Octokit/Models/Response/GitHubCommit.cs
using System.Collections.Generic; using System.Diagnostics; namespace Octokit { /// <summary> /// An enhanced git commit containing links to additional resources /// </summary> [DebuggerDisplay("{DebuggerDisplay,nq}")] public class GitHubCommit : GitReference { public GitHubCommit() { } public GitHubCommit(string url, string label, string @ref, string sha, User user, Repository repository, Author author, string commentsUrl, Commit commit, Author committer, string htmlUrl, GitHubCommitStats stats, IReadOnlyList<GitReference> parents, IReadOnlyList<GitHubCommitFile> files) : base(url, label, @ref, sha, user, repository) { Author = author; CommentsUrl = commentsUrl; Commit = commit; Committer = committer; HtmlUrl = htmlUrl; Stats = stats; Parents = parents; Files = files; } public Author Author { get; protected set; } public string CommentsUrl { get; protected set; } public Commit Commit { get; protected set; } public Author Committer { get; protected set; } public string HtmlUrl { get; protected set; } public GitHubCommitStats Stats { get; protected set; } public IReadOnlyList<GitReference> Parents { get; protected set; } public IReadOnlyList<GitHubCommitFile> Files { get; protected set; } } }
using System.Collections.Generic; using System.Diagnostics; namespace Octokit { /// <summary> /// An enhanced git commit containing links to additional resources /// </summary> [DebuggerDisplay("{DebuggerDisplay,nq}")] public class GitHubCommit : GitReference { public GitHubCommit() { } public GitHubCommit(string url, string label, string @ref, string sha, User user, Repository repository, Author author, string commentsUrl, Commit commit, Author committer, string htmlUrl, GitHubCommitStats stats, IReadOnlyList<GitReference> parents, IReadOnlyList<GitHubCommitFile> files) : base(url, label, @ref, sha, user, repository) { Author = author; CommentsUrl = commentsUrl; Commit = commit; Committer = committer; HtmlUrl = htmlUrl; Stats = stats; Parents = parents; Files = files; } /// <summary> /// Gets the GitHub account information for the commit author. It attempts to match the email /// address used in the commit with the email addresses registered with the GitHub account. /// If no account corresponds to the commit email, then this property is null. /// </summary> public Author Author { get; protected set; } public string CommentsUrl { get; protected set; } public Commit Commit { get; protected set; } /// <summary> /// Gets the GitHub account information for the commit committer. It attempts to match the email /// address used in the commit with the email addresses registered with the GitHub account. /// If no account corresponds to the commit email, then this property is null. /// </summary> public Author Committer { get; protected set; } public string HtmlUrl { get; protected set; } public GitHubCommitStats Stats { get; protected set; } public IReadOnlyList<GitReference> Parents { get; protected set; } public IReadOnlyList<GitHubCommitFile> Files { get; protected set; } } }
Add doc comments for Author and Committer
Add doc comments for Author and Committer
C#
mit
shiftkey/octokit.net,shana/octokit.net,alfhenrik/octokit.net,ivandrofly/octokit.net,eriawan/octokit.net,octokit/octokit.net,hahmed/octokit.net,alfhenrik/octokit.net,thedillonb/octokit.net,M-Zuber/octokit.net,mminns/octokit.net,editor-tools/octokit.net,Sarmad93/octokit.net,rlugojr/octokit.net,octokit-net-test-org/octokit.net,octokit/octokit.net,dampir/octokit.net,SmithAndr/octokit.net,gdziadkiewicz/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,hahmed/octokit.net,SamTheDev/octokit.net,editor-tools/octokit.net,octokit-net-test-org/octokit.net,khellang/octokit.net,chunkychode/octokit.net,gdziadkiewicz/octokit.net,shiftkey-tester/octokit.net,eriawan/octokit.net,devkhan/octokit.net,fake-organization/octokit.net,devkhan/octokit.net,bslliw/octokit.net,dampir/octokit.net,gabrielweyer/octokit.net,thedillonb/octokit.net,chunkychode/octokit.net,SmithAndr/octokit.net,shiftkey-tester/octokit.net,ivandrofly/octokit.net,shiftkey/octokit.net,SamTheDev/octokit.net,gabrielweyer/octokit.net,M-Zuber/octokit.net,khellang/octokit.net,TattsGroup/octokit.net,shana/octokit.net,Sarmad93/octokit.net,TattsGroup/octokit.net,adamralph/octokit.net,rlugojr/octokit.net,mminns/octokit.net,shiftkey-tester-org-blah-blah/octokit.net
9f4fa7b2f98e8833fb244088c19af810ad3debfc
src/Compilers/Server/VBCSCompilerTests/Extensions.cs
src/Compilers/Server/VBCSCompilerTests/Extensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests { internal static class Extensions { public static Task<bool> ToTask(this WaitHandle handle, int? timeoutMilliseconds) { RegisteredWaitHandle registeredHandle = null; var tcs = new TaskCompletionSource<bool>(); registeredHandle = ThreadPool.RegisterWaitForSingleObject( handle, (_, timedOut) => { tcs.TrySetResult(!timedOut); if (!timedOut) { registeredHandle.Unregister(waitObject: null); } }, null, timeoutMilliseconds ?? -1, executeOnlyOnce: true); return tcs.Task; } public static async Task<bool> WaitOneAsync(this WaitHandle handle, int? timeoutMilliseconds = null) => await handle.ToTask(timeoutMilliseconds); public static async ValueTask<T> TakeAsync<T>(this BlockingCollection<T> collection, TimeSpan? pollTimeSpan = null, CancellationToken cancellationToken = default) { var delay = pollTimeSpan ?? TimeSpan.FromSeconds(.25); do { if (collection.TryTake(out T value)) { return value; } await Task.Delay(delay, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); } while (true); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests { internal static class Extensions { public static Task ToTask(this WaitHandle handle, int? timeoutMilliseconds) { RegisteredWaitHandle registeredHandle = null; var tcs = new TaskCompletionSource<object>(); registeredHandle = ThreadPool.RegisterWaitForSingleObject( handle, (_, timeout) => { tcs.TrySetResult(null); if (registeredHandle is object) { registeredHandle.Unregister(waitObject: null); } }, null, timeoutMilliseconds ?? -1, executeOnlyOnce: true); return tcs.Task; } public static async Task WaitOneAsync(this WaitHandle handle, int? timeoutMilliseconds = null) => await handle.ToTask(timeoutMilliseconds); public static async ValueTask<T> TakeAsync<T>(this BlockingCollection<T> collection, TimeSpan? pollTimeSpan = null, CancellationToken cancellationToken = default) { var delay = pollTimeSpan ?? TimeSpan.FromSeconds(.25); do { if (collection.TryTake(out T value)) { return value; } await Task.Delay(delay, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); } while (true); } } }
Fix race in VBCSCompiler test
Fix race in VBCSCompiler test Need to account for the case that the callback executes before the handle is assigned. Or that the handle is visible in the call back. closes #41788
C#
mit
wvdd007/roslyn,KirillOsenkov/roslyn,CyrusNajmabadi/roslyn,reaction1989/roslyn,eriawan/roslyn,AlekseyTs/roslyn,reaction1989/roslyn,eriawan/roslyn,tannergooding/roslyn,heejaechang/roslyn,tannergooding/roslyn,bartdesmet/roslyn,aelij/roslyn,AmadeusW/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,brettfo/roslyn,panopticoncentral/roslyn,gafter/roslyn,eriawan/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,tannergooding/roslyn,bartdesmet/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,jmarolf/roslyn,aelij/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,KevinRansom/roslyn,mgoertz-msft/roslyn,panopticoncentral/roslyn,diryboy/roslyn,physhi/roslyn,jmarolf/roslyn,reaction1989/roslyn,wvdd007/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,stephentoub/roslyn,KevinRansom/roslyn,physhi/roslyn,davkean/roslyn,genlu/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,gafter/roslyn,mavasani/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,bartdesmet/roslyn,mavasani/roslyn,KevinRansom/roslyn,tmat/roslyn,CyrusNajmabadi/roslyn,AmadeusW/roslyn,dotnet/roslyn,tmat/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,gafter/roslyn,tmat/roslyn,weltkante/roslyn,physhi/roslyn,genlu/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,heejaechang/roslyn,diryboy/roslyn,davkean/roslyn,dotnet/roslyn,sharwell/roslyn,aelij/roslyn,stephentoub/roslyn,brettfo/roslyn,sharwell/roslyn,davkean/roslyn,brettfo/roslyn,genlu/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn
255fc29f75e8dfc63f7bf51808b7fff92fbb84ec
PalasoUIWindowsForms.Tests/FontTests/FontHelperTests.cs
PalasoUIWindowsForms.Tests/FontTests/FontHelperTests.cs
using System; using System.Drawing; using NUnit.Framework; using Palaso.UI.WindowsForms; namespace PalasoUIWindowsForms.Tests.FontTests { [TestFixture] public class FontHelperTests { [SetUp] public void SetUp() { // setup code goes here } [TearDown] public void TearDown() { // tear down code goes here } [Test] public void MakeFont_FontAndStyle_ValidFont() { Font sourceFont = SystemFonts.DefaultFont; Font returnFont = FontHelper.MakeFont(sourceFont, FontStyle.Bold); Assert.AreEqual(sourceFont.FontFamily.Name, returnFont.FontFamily.Name); Assert.AreEqual(FontStyle.Bold, returnFont.Style & FontStyle.Bold); } } }
using System; using System.Drawing; using System.Linq; using NUnit.Framework; using Palaso.UI.WindowsForms; namespace PalasoUIWindowsForms.Tests.FontTests { [TestFixture] public class FontHelperTests { [SetUp] public void SetUp() { // setup code goes here } [TearDown] public void TearDown() { // tear down code goes here } [Test] public void MakeFont_FontName_ValidFont() { Font sourceFont = SystemFonts.DefaultFont; Font returnFont = FontHelper.MakeFont(sourceFont.FontFamily.Name); Assert.AreEqual(sourceFont.FontFamily.Name, returnFont.FontFamily.Name); } [Test] public void MakeFont_FontNameAndStyle_ValidFont() { // use Times New Roman foreach (var family in FontFamily.Families.Where(family => family.Name == "Times New Roman")) { Font sourceFont = new Font(family, 10f, FontStyle.Regular); Font returnFont = FontHelper.MakeFont(sourceFont, FontStyle.Bold); Assert.AreEqual(sourceFont.FontFamily.Name, returnFont.FontFamily.Name); Assert.AreEqual(FontStyle.Bold, returnFont.Style & FontStyle.Bold); break; } } } }
Fix mono bug in the FontHelper class
Fix mono bug in the FontHelper class
C#
mit
ermshiperete/libpalaso,sillsdev/libpalaso,darcywong00/libpalaso,andrew-polk/libpalaso,gmartin7/libpalaso,mccarthyrb/libpalaso,andrew-polk/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,hatton/libpalaso,gmartin7/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,mccarthyrb/libpalaso,mccarthyrb/libpalaso,sillsdev/libpalaso,hatton/libpalaso,mccarthyrb/libpalaso,andrew-polk/libpalaso,marksvc/libpalaso,ddaspit/libpalaso,gmartin7/libpalaso,gtryus/libpalaso,JohnThomson/libpalaso,chrisvire/libpalaso,andrew-polk/libpalaso,chrisvire/libpalaso,gmartin7/libpalaso,JohnThomson/libpalaso,darcywong00/libpalaso,marksvc/libpalaso,chrisvire/libpalaso,ddaspit/libpalaso,ddaspit/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,chrisvire/libpalaso,marksvc/libpalaso,sillsdev/libpalaso,hatton/libpalaso,tombogle/libpalaso,gtryus/libpalaso,ddaspit/libpalaso,ermshiperete/libpalaso,JohnThomson/libpalaso,darcywong00/libpalaso,ermshiperete/libpalaso,hatton/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,gtryus/libpalaso,sillsdev/libpalaso,JohnThomson/libpalaso
19a186ae96f220e7cc7ceccbc62618ff91f37bfe
Solution/Chiro.Gap.Api/MappingHelper.cs
Solution/Chiro.Gap.Api/MappingHelper.cs
/* * Copyright 2017 Chirojeugd-Vlaanderen vzw. See the NOTICE file at the * top-level directory of this distribution, and at * https://gapwiki.chiro.be/copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Linq; using System.Web; using AutoMapper; using Chiro.Gap.Api.Models; using Chiro.Gap.ServiceContracts.DataContracts; namespace Chiro.Gap.Api { public static class MappingHelper { public static void CreateMappings() { // TODO: Damn, nog steeds automapper 3. (zie #5401). Mapper.CreateMap<GroepInfo, GroepModel>(); } } }
/* * Copyright 2017 Chirojeugd-Vlaanderen vzw. See the NOTICE file at the * top-level directory of this distribution, and at * https://gapwiki.chiro.be/copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using AutoMapper; using Chiro.Gap.Api.Models; using Chiro.Gap.ServiceContracts.DataContracts; namespace Chiro.Gap.Api { public static class MappingHelper { public static void CreateMappings() { // TODO: Damn, nog steeds automapper 3. (zie #5401). Mapper.CreateMap<GroepInfo, GroepModel>() .ForMember(dst => dst.StamNummer, opt => opt.MapFrom(src => src.StamNummer.Trim())); } } }
Remove trailing spaces from stamnummer.
Remove trailing spaces from stamnummer.
C#
apache-2.0
Chirojeugd-Vlaanderen/gap,Chirojeugd-Vlaanderen/gap,Chirojeugd-Vlaanderen/gap
fdd06c58b1d1305e575699a8e3371d070904944f
WebApi/Controllers/LoggingController.cs
WebApi/Controllers/LoggingController.cs
/* Empiria Extensions Framework ****************************************************************************** * * * Solution : Empiria Extensions Framework System : Empiria Microservices * * Namespace : Empiria.Microservices Assembly : Empiria.Microservices.dll * * Type : LoggingController Pattern : Web API Controller * * Version : 1.0 License : Please read license.txt file * * * * Summary : Contains web api methods for application log services. * * * ********************************** Copyright(c) 2016-2017. La Vía Óntica SC, Ontica LLC and contributors. **/ using System; using System.Web.Http; using Empiria.Logging; using Empiria.Security; using Empiria.WebApi; namespace Empiria.Microservices { /// <summary>Contains web api methods for application log services.</summary> public class LoggingController : WebApiController { #region Public APIs /// <summary>Stores an array of log entries.</summary> /// <param name="logEntries">The non-empty array of LogEntryModel instances.</param> [HttpPost, AllowAnonymous] [Route("v1/logging")] public void PostLogEntryArray(string apiKey, [FromBody] LogEntryModel[] logEntries) { try { ClientApplication clientApplication = base.GetClientApplication(); var logTrail = new LogTrail(clientApplication); logTrail.Write(logEntries); } catch (Exception e) { throw base.CreateHttpException(e); } } #endregion Public APIs } // class LoggingController } // namespace Empiria.Microservices
/* Empiria Extensions Framework ****************************************************************************** * * * Module : Empiria Web Api Component : Base controllers * * Assembly : Empiria.WebApi.dll Pattern : Web Api Controller * * Type : LoggingController License : Please read LICENSE.txt file * * * * Summary : Contains web api methods for application log services. * * * ************************* Copyright(c) La Vía Óntica SC, Ontica LLC and contributors. All rights reserved. **/ using System; using System.Web.Http; using Empiria.Logging; using Empiria.Security; namespace Empiria.WebApi.Controllers { /// <summary>Contains web api methods for application log services.</summary> public class LoggingController : WebApiController { #region Public APIs /// <summary>Stores an array of log entries.</summary> /// <param name="logEntries">The non-empty array of LogEntryModel instances.</param> [HttpPost, AllowAnonymous] [Route("v1/logging")] public void PostLogEntryArray([FromBody] LogEntryModel[] logEntries) { try { ClientApplication clientApplication = base.GetClientApplication(); var logTrail = new LogTrail(clientApplication); logTrail.Write(logEntries); } catch (Exception e) { throw base.CreateHttpException(e); } } #endregion Public APIs } // class LoggingController } // namespace Empiria.WebApi.Controllers
Fix remove logging controller apiKey parameter
Fix remove logging controller apiKey parameter
C#
agpl-3.0
Ontica/Empiria.Extended
2274bf1f10b70248ab249ffd92209a69a4952961
Papyrus/Papyrus/Extensions/EbookExtensions.cs
Papyrus/Papyrus/Extensions/EbookExtensions.cs
using System; using System.Threading.Tasks; using Windows.Storage; namespace Papyrus { public static class EBookExtensions { public static async Task<bool> VerifyMimetypeAsync(this EBook ebook) { var mimetypeFile = await ebook._rootFolder.GetItemAsync("mimetype"); if (mimetypeFile == null) // Make sure file exists. return false; var fileContents = await FileIO.ReadTextAsync(mimetypeFile as StorageFile); if (fileContents != "application/epub+zip") // Make sure file contents are correct. return false; return true; } } }
using System; using System.Threading.Tasks; using Windows.Storage; namespace Papyrus { public static class EBookExtensions { public static async Task<bool> VerifyMimetypeAsync(this EBook ebook) { bool VerifyMimetypeString(string value) => value == "application/epub+zip"; if (ebook._rootFolder == null) // Make sure a root folder was specified. return false; var mimetypeFile = await ebook._rootFolder.GetItemAsync("mimetype"); if (mimetypeFile == null) // Make sure file exists. return false; var fileContents = await FileIO.ReadTextAsync(mimetypeFile as StorageFile); if (!VerifyMimetypeString(fileContents)) // Make sure file contents are correct. return false; return true; } } }
Use local function to verify mimetype string.
Use local function to verify mimetype string.
C#
mit
TastesLikeTurkey/Papyrus
97581d8b6c400ec32d84305a776a4dcba51cc34a
WalletWasabi.Gui/Shell/MainMenu/ToolsMainMenuItems.cs
WalletWasabi.Gui/Shell/MainMenu/ToolsMainMenuItems.cs
using AvalonStudio.MainMenu; using AvalonStudio.Menus; using System; using System.Collections.Generic; using System.Composition; using System.Text; namespace WalletWasabi.Gui.Shell.MainMenu { internal class ToolsMainMenuItems { private IMenuItemFactory _menuItemFactory; [ImportingConstructor] public ToolsMainMenuItems(IMenuItemFactory menuItemFactory) { _menuItemFactory = menuItemFactory; } #region MainMenu [ExportMainMenuItem("Tools")] [DefaultOrder(1)] public IMenuItem Tools => _menuItemFactory.CreateHeaderMenuItem("Tools", null); #endregion MainMenu #region Group [ExportMainMenuDefaultGroup("Tools", "Managers")] [DefaultOrder(0)] public object ManagersGroup => null; [ExportMainMenuDefaultGroup("Tools", "Settings")] [DefaultOrder(1)] public object SettingsGroup => null; #endregion Group #region MenuItem [ExportMainMenuItem("Tools", "Wallet Manager")] [DefaultOrder(0)] [DefaultGroup("Managers")] public IMenuItem GenerateWallet => _menuItemFactory.CreateCommandMenuItem("Tools.WalletManager"); [ExportMainMenuItem("Tools", "Settings")] [DefaultOrder(1)] [DefaultGroup("Settings")] public IMenuItem Settings => _menuItemFactory.CreateCommandMenuItem("Tools.Settings"); #endregion MenuItem } }
using AvalonStudio.MainMenu; using AvalonStudio.Menus; using System; using System.Collections.Generic; using System.Composition; using System.Text; namespace WalletWasabi.Gui.Shell.MainMenu { internal class ToolsMainMenuItems { private IMenuItemFactory _menuItemFactory; [ImportingConstructor] public ToolsMainMenuItems(IMenuItemFactory menuItemFactory) { _menuItemFactory = menuItemFactory; } #region MainMenu [ExportMainMenuItem("Tools")] [DefaultOrder(1)] public IMenuItem Tools => _menuItemFactory.CreateHeaderMenuItem("Tools", null); #endregion MainMenu #region Group [ExportMainMenuDefaultGroup("Tools", "Managers")] [DefaultOrder(0)] public object ManagersGroup => null; [ExportMainMenuDefaultGroup("Tools", "Settings")] [DefaultOrder(1)] public object SettingsGroup => null; #endregion Group #region MenuItem [ExportMainMenuItem("Tools", "Wallet Manager")] [DefaultOrder(0)] [DefaultGroup("Managers")] public IMenuItem WalletManager => _menuItemFactory.CreateCommandMenuItem("Tools.WalletManager"); [ExportMainMenuItem("Tools", "Settings")] [DefaultOrder(1)] [DefaultGroup("Settings")] public IMenuItem Settings => _menuItemFactory.CreateCommandMenuItem("Tools.Settings"); #endregion MenuItem } }
Rename GenerateWallet menuitem to WalletManager
Rename GenerateWallet menuitem to WalletManager
C#
mit
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
9445ca7de83913d883383fe7a291ebddace23285
WalletWasabi/JsonConverters/ExtPubKeyJsonConverter.cs
WalletWasabi/JsonConverters/ExtPubKeyJsonConverter.cs
using NBitcoin; using Newtonsoft.Json; using System; namespace WalletWasabi.JsonConverters { public class ExtPubKeyJsonConverter : JsonConverter { /// <inheritdoc /> public override bool CanConvert(Type objectType) { return objectType == typeof(ExtPubKey); } /// <inheritdoc /> public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var hex = (string)reader.Value; return new ExtPubKey(ByteHelpers.FromHex(hex)); } /// <inheritdoc /> public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { var epk = (ExtPubKey)value; var hex = ByteHelpers.ToHex(epk.ToBytes()); writer.WriteValue(hex); } } }
using NBitcoin; using Newtonsoft.Json; using System; namespace WalletWasabi.JsonConverters { public class ExtPubKeyJsonConverter : JsonConverter { /// <inheritdoc /> public override bool CanConvert(Type objectType) { return objectType == typeof(ExtPubKey); } /// <inheritdoc /> public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var s = (string)reader.Value; ExtPubKey epk; try { epk = ExtPubKey.Parse(s); } catch { // Try hex, Old wallet format was like this. epk = new ExtPubKey(ByteHelpers.FromHex(s)); } return epk; } /// <inheritdoc /> public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { var epk = (ExtPubKey)value; var xpub = epk.GetWif(Network.Main).ToWif(); writer.WriteValue(xpub); } } }
Save xpub instead of hex (wallet compatibility)
Save xpub instead of hex (wallet compatibility)
C#
mit
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
23d1663efb133f10d52980b0ae7cec2a908512cf
drivers/AgateWinForms/FormsInterop.cs
drivers/AgateWinForms/FormsInterop.cs
using System; using System.Collections.Generic; using System.Text; using Draw = System.Drawing; using Geo = ERY.AgateLib.Geometry; namespace ERY.AgateLib.WinForms { public static class FormsInterop { public static Draw.Rectangle ToRectangle(Geo.Rectangle rect) { return new System.Drawing.Rectangle(rect.X, rect.Y, rect.Width, rect.Height); } } }
using System; using System.Collections.Generic; using System.Text; using Draw = System.Drawing; using ERY.AgateLib.Geometry; namespace ERY.AgateLib.WinForms { public static class FormsInterop { public static Draw.Color ConvertColor(Color clr) { return Draw.Color.FromArgb(clr.ToArgb()); } public static Color ConvertColor(Draw.Color clr) { return Color.FromArgb(clr.ToArgb()); } public static Draw.Rectangle ConvertRectangle(Rectangle rect) { return new Draw.Rectangle(rect.X, rect.Y, rect.Width, rect.Height); } public static Rectangle ConvertRectangle(Draw.Rectangle rect) { return new Rectangle(rect.X, rect.Y, rect.Width, rect.Height); } public static Draw.RectangleF ConvertRectangleF(RectangleF rect) { return new Draw.RectangleF(rect.X, rect.Y, rect.Width, rect.Height); } public static RectangleF ConvertRectangleF(Draw.RectangleF rect) { return new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); } public static Point ConvertPoint(Draw.Point pt) { return new Point(pt.X, pt.Y); } public static Draw.Point ConvertPoint(Point pt) { return new Draw.Point(pt.X, pt.Y); } public static PointF ConvertPointF(Draw.PointF pt) { return new PointF(pt.X, pt.Y); } public static Draw.PointF ConvertPointF(PointF pt) { return new Draw.PointF(pt.X, pt.Y); } public static Size ConvertSize(Draw.Size pt) { return new Size(pt.Width, pt.Height); } public static Draw.Size ConvertSize(Size pt) { return new Draw.Size(pt.Width, pt.Height); } public static SizeF ConvertSizeF(Draw.SizeF pt) { return new SizeF(pt.Width, pt.Height); } public static Draw.SizeF ConvertSizeF(SizeF pt) { return new Draw.SizeF(pt.Width, pt.Height); } } }
Add converters for System.Drawing structures.
Add converters for System.Drawing structures.
C#
mit
eylvisaker/AgateLib
8639ada4cd6e600d3508e93c4b40657ae3c23de2
Homunculus/MarekMotykaBot/ExtensionsMethods/StringExtensions.cs
Homunculus/MarekMotykaBot/ExtensionsMethods/StringExtensions.cs
using System.Text.RegularExpressions; namespace MarekMotykaBot.ExtensionsMethods { public static class StringExtensions { public static string RemoveRepeatingChars(this string inputString) { string newString = string.Empty; char[] charArray = inputString.ToCharArray(); for (int i = 0; i < charArray.Length; i++) { if (string.IsNullOrEmpty(newString)) newString += charArray[i].ToString(); else if (newString[newString.Length - 1] != charArray[i]) newString += charArray[i].ToString(); } return newString; } public static string RemoveEmojis(this string inputString) { return Regex.Replace(inputString, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled); } public static string RemoveEmotes(this string inputString) { return Regex.Replace(inputString, "(<:.+>)+", "", RegexOptions.Compiled); } public static string RemoveEmojisAndEmotes(this string inputString) { return inputString.RemoveEmotes().RemoveEmojis(); } } }
using System.Text.RegularExpressions; namespace MarekMotykaBot.ExtensionsMethods { public static class StringExtensions { public static string RemoveRepeatingChars(this string inputString) { string newString = string.Empty; char[] charArray = inputString.ToCharArray(); for (int i = 0; i < charArray.Length; i++) { if (string.IsNullOrEmpty(newString)) newString += charArray[i].ToString(); else if (newString[newString.Length - 1] != charArray[i]) newString += charArray[i].ToString(); } return newString; } public static string RemoveEmojis(this string inputString) { return Regex.Replace(inputString, @"[^a-zA-Z0-9\s]+", "", RegexOptions.Compiled); } public static string RemoveEmotes(this string inputString) { return Regex.Replace(inputString, "(<:.+>)+", "", RegexOptions.Compiled); } public static string RemoveEmojisAndEmotes(this string inputString) { return inputString.RemoveEmotes().RemoveEmojis(); } } }
Allow spaces in !meme command.
Allow spaces in !meme command.
C#
mit
Ervie/Homunculus
78da8870a296a1be854933df6ae6806f5670fd90
libcmdline/Properties/AssemblyInfo.cs
libcmdline/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("libcmdline")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("libcmdline")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("853c7fe9-e12b-484c-93de-3f3de6907860")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("libcmdline")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("libcmdline")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("853c7fe9-e12b-484c-93de-3f3de6907860")] // 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")]
Change version to a reasonable value
Change version to a reasonable value Let's face it. This library is at v0.1.
C#
isc
sbennett1990/libcmdline
7507314e0dd5f122a49a3dca3adcaf0bdfa9ffae
VirusTotal.NET/DateTimeParsers/YearMonthDayConverter.cs
VirusTotal.NET/DateTimeParsers/YearMonthDayConverter.cs
using System; using System.Globalization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using VirusTotalNET.Exceptions; namespace VirusTotalNET.DateTimeParsers { public class YearMonthDayConverter : DateTimeConverterBase { private readonly CultureInfo _culture = new CultureInfo("en-us"); private const string _dateFormatString = "yyyyMMdd"; public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { writer.DateFormatString = _dateFormatString; writer.WriteValue(value); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.Value == null) return DateTime.MinValue; if (!(reader.Value is string)) throw new InvalidDateTimeException("Invalid date/time from VirusTotal. Tried to parse: " + reader.Value); string value = (string)reader.Value; if (DateTime.TryParseExact(value, _dateFormatString, _culture, DateTimeStyles.AllowWhiteSpaces, out DateTime result)) return result; throw new InvalidDateTimeException("Invalid date/time from VirusTotal. Tried to parse: " + value); } } }
using System; using System.Globalization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using VirusTotalNET.Exceptions; namespace VirusTotalNET.DateTimeParsers { public class YearMonthDayConverter : DateTimeConverterBase { private readonly CultureInfo _culture = new CultureInfo("en-us"); private const string _dateFormatString = "yyyyMMdd"; public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { writer.DateFormatString = _dateFormatString; writer.WriteValue(value); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.Value == null) return DateTime.MinValue; if (!(reader.Value is string)) throw new InvalidDateTimeException("Invalid date/time from VirusTotal. Tried to parse: " + reader.Value); string value = (string)reader.Value; //VT sometimes have really old data that return '-' in timestamps if (value.Equals("-", StringComparison.OrdinalIgnoreCase)) return DateTime.MinValue; if (DateTime.TryParseExact(value, _dateFormatString, _culture, DateTimeStyles.AllowWhiteSpaces, out DateTime result)) return result; throw new InvalidDateTimeException("Invalid date/time from VirusTotal. Tried to parse: " + value); } } }
Fix a bug where dates are sometimes '-'
Fix a bug where dates are sometimes '-'
C#
apache-2.0
Genbox/VirusTotal.NET
c69e88eb97b90c73b3e2dcd2bebe18c8aa4b8540
osu.Game/Configuration/ScoreMeterType.cs
osu.Game/Configuration/ScoreMeterType.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.ComponentModel; namespace osu.Game.Configuration { public enum ScoreMeterType { [Description("None")] None, [Description("Hit Error (left)")] HitErrorLeft, [Description("Hit Error (right)")] HitErrorRight, [Description("Hit Error (both)")] HitErrorBoth, } }
// 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.ComponentModel; namespace osu.Game.Configuration { public enum ScoreMeterType { [Description("None")] None, [Description("Hit Error (left)")] HitErrorLeft, [Description("Hit Error (right)")] HitErrorRight, [Description("Hit Error (both)")] HitErrorBoth, [Description("Colour (left)")] ColourLeft, [Description("Colour (right)")] ColourRight, [Description("Colour (both)")] ColourBoth, } }
Add more types to dropdown
Add more types to dropdown
C#
mit
johnneijzen/osu,smoogipooo/osu,NeoAdonis/osu,NeoAdonis/osu,EVAST9919/osu,2yangk23/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,ppy/osu,ppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,EVAST9919/osu,2yangk23/osu,johnneijzen/osu,peppy/osu