commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
f3f32c4c7f477c1c4cdd208e5bf530f196f8ec72
fix unpublic, add test case for CardRecordID
NCTUGDC/HearthStone
HearthStone/HearthStone.Library.Test/CardRecordUnitTest.cs
HearthStone/HearthStone.Library.Test/CardRecordUnitTest.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HearthStone.Library.Test { [TestClass] public class CardRecordUnitTest { class TestCardRecord : CardRecord { public TestCardRecord() : base() { } public TestCardRecord(int cardRecordID, int cardID) : base(cardRecordID, cardID) { } public void SetCardRecordID(int ID) { CardRecordID = ID; } } [TestMethod] public void CardRecordIDTestMethod1() { TestCardRecord test1 = new TestCardRecord(); foreach (int id in new int[] { 0, 1, 2, 3, 4 }){ test1.SetCardRecordID(id); Assert.IsTrue(test1.CardRecordID == id, "Invalid Setter for CardRecordID: to set " + id); } } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HearthStone.Library.Test { [TestClass] public class CardRecordUnitTest { class TestCardRecord : CardRecord { TestCardRecord(int cardRecordID, int cardID) : base(cardRecordID, cardID) { } void setCardRecordID(int ID) { CardRecordID = ID; } } } }
apache-2.0
C#
7835076aec203474c110d5ba4427a476a1801004
Add support for MSDIA140 to DIA-based CoreRT/.NETNative StackTraceGenerator on Windows
botaberg/corert,shrah/corert,tijoytom/corert,botaberg/corert,tijoytom/corert,krytarowski/corert,shrah/corert,gregkalapos/corert,shrah/corert,botaberg/corert,gregkalapos/corert,yizhang82/corert,gregkalapos/corert,botaberg/corert,gregkalapos/corert,yizhang82/corert,krytarowski/corert,krytarowski/corert,yizhang82/corert,krytarowski/corert,yizhang82/corert,tijoytom/corert,shrah/corert,tijoytom/corert
src/System.Private.StackTraceGenerator/src/Internal/Dia/Guids.cs
src/System.Private.StackTraceGenerator/src/Internal/Dia/Guids.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.Diagnostics; using System.Collections.Generic; namespace Internal.StackGenerator.Dia { internal static class Guids { public static readonly IEnumerable<Guid> DiaSource_CLSIDs = new Guid[] { new Guid("E6756135-1E65-4D17-8576-610761398C3C"), // msdia140.dll new Guid("3BFCEA48-620F-4B6B-81F7-B9AF75454C7D"), // msdia120.dll }; public static readonly Guid IID_IDiaDataSource = new Guid("79F1BB5F-B66E-48E5-B6A9-1545C323CA3D"); } }
// 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.Diagnostics; using System.Collections.Generic; namespace Internal.StackGenerator.Dia { internal static class Guids { public static readonly IEnumerable<Guid> DiaSource_CLSIDs = new Guid[] { new Guid("3BFCEA48-620F-4B6B-81F7-B9AF75454C7D"), // msdia120.dll new Guid("761D3BCD-1304-41D5-94E8-EAC54E4AC172"), // msdia110.dll }; public static readonly Guid IID_IDiaDataSource = new Guid("79F1BB5F-B66E-48E5-B6A9-1545C323CA3D"); } }
mit
C#
724e70a658a12220d6cddc7324a5ff1b604a8986
Add UIComponent_ComponentLocation test
atata-framework/atata,YevgeniyShunevych/Atata,atata-framework/atata,YevgeniyShunevych/Atata
src/Atata.Tests/UIComponentTest.cs
src/Atata.Tests/UIComponentTest.cs
using NUnit.Framework; namespace Atata.Tests { public class UIComponentTest : AutoTest { [Test] public void UIComponent_ComponentLocation() { int y; Go.To<InputPage>(). TextInput.ComponentLocation.X.Should.BeGreater(10). TextInput.ComponentLocation.Y.Should.BeInRange(10, 1000). TextInput.ComponentLocation.Y.Get(out y). TextInput.ComponentLocation.Y.Should.Equal(y); } [Test] public void UIComponent_ComponentSize() { int height; Go.To<InputPage>(). TextInput.ComponentSize.Width.Should.BeGreater(20). TextInput.ComponentSize.Height.Should.BeInRange(10, 100). TextInput.ComponentSize.Height.Get(out height). TextInput.ComponentSize.Height.Should.Equal(height); } } }
using NUnit.Framework; namespace Atata.Tests { public class UIComponentTest : AutoTest { [Test] public void UIComponent_ComponentSize() { int height; Go.To<InputPage>(). TextInput.ComponentSize.Width.Should.BeGreater(20). TextInput.ComponentSize.Height.Should.BeInRange(10, 100). TextInput.ComponentSize.Height.Get(out height). TextInput.ComponentSize.Height.Should.Equal(height); } } }
apache-2.0
C#
fc8ab0b762c27fb91718b447511097478c435b1e
fix issue wrong type check while loading saved settings
kubdotnet/LedControllerEngine
LedControllerEngine/Assets/Effects/SplitSides/SplitSides.cs
LedControllerEngine/Assets/Effects/SplitSides/SplitSides.cs
using System; using System.Collections.Generic; namespace LedControllerEngine.Assets.Effects { public class SplitSides : IEffect { public string Name { get => "Split Sides"; } public int ModeNumber { get => 7; } public Guid Id { get => new Guid("8FAB810D-A27C-401F-8D01-26A88EAA6612"); } public Type SettingsControl { get => typeof(SplitSidesSettings); } private SplitSidesSettingsModel _settingsModel = new SplitSidesSettingsModel(); public object SettingsModel { get { return _settingsModel; } set { if (!(value is SplitSidesSettingsModel)) { throw new ArgumentException("Wrong type, SplitSidesSettingsModel expected"); } _settingsModel = (SplitSidesSettingsModel)value; } } public Type EffectType => typeof(SplitSides); /// <summary> /// Gets the settings values. /// </summary> /// <returns> /// List of EffectSetting /// </returns> public List<EffectSetting> GetSettingsValues() { var settings = new List<EffectSetting>(); settings.Add(new EffectSetting() { Code = 0, Value = ModeNumber }); // effect mode number settings.Add(new EffectSetting() { Code = 1, Value = _settingsModel.WestHue.GetValueOrDefault() }); settings.Add(new EffectSetting() { Code = 2, Value = _settingsModel.EastHue.GetValueOrDefault() }); settings.Add(new EffectSetting() { Code = 4, Value = _settingsModel.FanPhaseOffset.GetValueOrDefault() }); settings.Add(new EffectSetting() { Code = 5, Value = _settingsModel.SidePhaseOffset.GetValueOrDefault() }); settings.Add(new EffectSetting() { Code = 6, Value = (int)_settingsModel.Pulse.Key }); settings.Add(new EffectSetting() { Code = 7, Value = _settingsModel.PulseSpeed.GetValueOrDefault() }); return settings; } } }
using System; using System.Collections.Generic; namespace LedControllerEngine.Assets.Effects { public class SplitSides : IEffect { public string Name { get => "Split Sides"; } public int ModeNumber { get => 7; } public Guid Id { get => new Guid("8FAB810D-A27C-401F-8D01-26A88EAA6612"); } public Type SettingsControl { get => typeof(SplitSidesSettings); } private SplitSidesSettingsModel _settingsModel = new SplitSidesSettingsModel(); public object SettingsModel { get { return _settingsModel; } set { if (!(value is SingleSpinnerSettingsModel)) { throw new ArgumentException("Wrong type, SplitSidesSettingsModel expected"); } _settingsModel = (SplitSidesSettingsModel)value; } } public Type EffectType => typeof(SplitSides); /// <summary> /// Gets the settings values. /// </summary> /// <returns> /// List of EffectSetting /// </returns> public List<EffectSetting> GetSettingsValues() { var settings = new List<EffectSetting>(); settings.Add(new EffectSetting() { Code = 0, Value = ModeNumber }); // effect mode number settings.Add(new EffectSetting() { Code = 1, Value = _settingsModel.WestHue.GetValueOrDefault() }); settings.Add(new EffectSetting() { Code = 2, Value = _settingsModel.EastHue.GetValueOrDefault() }); settings.Add(new EffectSetting() { Code = 4, Value = _settingsModel.FanPhaseOffset.GetValueOrDefault() }); settings.Add(new EffectSetting() { Code = 5, Value = _settingsModel.SidePhaseOffset.GetValueOrDefault() }); settings.Add(new EffectSetting() { Code = 6, Value = (int)_settingsModel.Pulse.Key }); settings.Add(new EffectSetting() { Code = 7, Value = _settingsModel.PulseSpeed.GetValueOrDefault() }); return settings; } } }
mit
C#
22648d3f437934156b59113d5576d79c79e72b0a
Use SingleOrDefault as we may not know all WhatMine.com algorithms
nwoolls/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner,IWBWbiz/MultiMiner
MultiMiner.WhatMine/Extensions/CoinInformationExtensions.cs
MultiMiner.WhatMine/Extensions/CoinInformationExtensions.cs
using MultiMiner.CoinApi.Data; using MultiMiner.Xgminer.Data; using Newtonsoft.Json.Linq; using System; using System.Linq; namespace MultiMiner.WhatMine.Extensions { public static class CoinInformationExtensions { public static void PopulateFromJson(this CoinInformation coinInformation, JToken jToken) { coinInformation.Symbol = jToken.Value<string>("market_code"); coinInformation.Name = jToken.Value<string>("name"); string algorithm = jToken.Value<string>("algorithm"); coinInformation.Algorithm = FixAlgorithmName(algorithm); coinInformation.CurrentBlocks = jToken.Value<int>("height"); coinInformation.Difficulty = jToken.Value<double>("difficulty"); coinInformation.Reward = jToken.Value<double>("reward"); coinInformation.Exchange = jToken.Value<string>("exchange_name"); coinInformation.Income = jToken.Value<double>("btc_per_day"); if (coinInformation.Symbol.Equals("BTC", System.StringComparison.OrdinalIgnoreCase)) coinInformation.Price = 1; else coinInformation.Price = jToken.Value<double>("exchange_rate"); } private static string FixAlgorithmName(string algorithm) { string result = algorithm; if (algorithm.Equals(ApiContext.ScryptNFactor, StringComparison.OrdinalIgnoreCase)) result = AlgorithmFullNames.ScryptN; else { KnownAlgorithm knownAlgorithm = KnownAlgorithms.Algorithms.SingleOrDefault(a => a.Name.Equals(algorithm, StringComparison.OrdinalIgnoreCase)); if (knownAlgorithm != null) result = knownAlgorithm.FullName; } return result; } } }
using MultiMiner.CoinApi.Data; using MultiMiner.Xgminer.Data; using Newtonsoft.Json.Linq; using System.Linq; namespace MultiMiner.WhatMine.Extensions { public static class CoinInformationExtensions { public static void PopulateFromJson(this CoinInformation coinInformation, JToken jToken) { coinInformation.Symbol = jToken.Value<string>("market_code"); coinInformation.Name = jToken.Value<string>("name"); string algorithm = jToken.Value<string>("algorithm"); coinInformation.Algorithm = FixAlgorithmName(algorithm); coinInformation.CurrentBlocks = jToken.Value<int>("height"); coinInformation.Difficulty = jToken.Value<double>("difficulty"); coinInformation.Reward = jToken.Value<double>("reward"); coinInformation.Exchange = jToken.Value<string>("exchange_name"); coinInformation.Income = jToken.Value<double>("btc_per_day"); if (coinInformation.Symbol.Equals("BTC", System.StringComparison.OrdinalIgnoreCase)) coinInformation.Price = 1; else coinInformation.Price = jToken.Value<double>("exchange_rate"); } private static string FixAlgorithmName(string algorithm) { string result = algorithm; if (algorithm.Equals(ApiContext.ScryptNFactor, System.StringComparison.OrdinalIgnoreCase)) result = AlgorithmFullNames.ScryptN; else { var knownAlgorithm = KnownAlgorithms.Algorithms.Single(a => a.Name.Equals(algorithm, System.StringComparison.OrdinalIgnoreCase)); result = knownAlgorithm.FullName; } return result; } } }
mit
C#
b3d1e1bfac791496690261dddba6f8ea2dd61ebd
Fix example notification timer breaking on skip (forward mouse button or Enter)
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
Core/Notification/Example/FormNotificationExample.cs
Core/Notification/Example/FormNotificationExample.cs
using System.Windows.Forms; using TweetDuck.Core.Controls; using TweetDuck.Plugins; using TweetDuck.Resources; namespace TweetDuck.Core.Notification.Example{ sealed class FormNotificationExample : FormNotificationMain{ public override bool RequiresResize => true; protected override bool CanDragWindow => Program.UserConfig.NotificationPosition == TweetNotification.Position.Custom; protected override FormBorderStyle NotificationBorderStyle{ get{ if (Program.UserConfig.NotificationSize == TweetNotification.Size.Custom){ switch(base.NotificationBorderStyle){ case FormBorderStyle.FixedSingle: return FormBorderStyle.Sizable; case FormBorderStyle.FixedToolWindow: return FormBorderStyle.SizableToolWindow; } } return base.NotificationBorderStyle; } } private readonly TweetNotification exampleNotification; public FormNotificationExample(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, false){ string exampleTweetHTML = ScriptLoader.LoadResource("pages/example.html", true).Replace("{avatar}", TweetNotification.AppLogoLink); #if DEBUG exampleTweetHTML = exampleTweetHTML.Replace("</p>", @"</p><div style='margin-top:256px'>Scrollbar test padding...</div>"); #endif exampleNotification = TweetNotification.Example(exampleTweetHTML, 176); } public override void HideNotification(){ Location = ControlExtensions.InvisibleLocation; } public override void FinishCurrentNotification(){} public void ShowExampleNotification(bool reset){ if (reset){ LoadTweet(exampleNotification); } else{ PrepareAndDisplayWindow(); } UpdateTitle(); } } }
using System.Windows.Forms; using TweetDuck.Core.Controls; using TweetDuck.Plugins; using TweetDuck.Resources; namespace TweetDuck.Core.Notification.Example{ sealed class FormNotificationExample : FormNotificationMain{ public override bool RequiresResize => true; protected override bool CanDragWindow => Program.UserConfig.NotificationPosition == TweetNotification.Position.Custom; protected override FormBorderStyle NotificationBorderStyle{ get{ if (Program.UserConfig.NotificationSize == TweetNotification.Size.Custom){ switch(base.NotificationBorderStyle){ case FormBorderStyle.FixedSingle: return FormBorderStyle.Sizable; case FormBorderStyle.FixedToolWindow: return FormBorderStyle.SizableToolWindow; } } return base.NotificationBorderStyle; } } private readonly TweetNotification exampleNotification; public FormNotificationExample(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, false){ string exampleTweetHTML = ScriptLoader.LoadResource("pages/example.html", true).Replace("{avatar}", TweetNotification.AppLogoLink); #if DEBUG exampleTweetHTML = exampleTweetHTML.Replace("</p>", @"</p><div style='margin-top:256px'>Scrollbar test padding...</div>"); #endif exampleNotification = TweetNotification.Example(exampleTweetHTML, 176); } public override void HideNotification(){ Location = ControlExtensions.InvisibleLocation; } public void ShowExampleNotification(bool reset){ if (reset){ LoadTweet(exampleNotification); } else{ PrepareAndDisplayWindow(); } UpdateTitle(); } } }
mit
C#
5aced720db0681e7dbe5610fc0135f9f365d8799
Switch to JSON.NET serialiser.
modulexcite/DartVS,DartVS/DartVS,DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS
DanTup.DartAnalysis/Infrastructure/JsonSerialiser.cs
DanTup.DartAnalysis/Infrastructure/JsonSerialiser.cs
using System; using System.Web.Script.Serialization; using Newtonsoft.Json; namespace DanTup.DartAnalysis { /// <summary> /// Serialises and deserialises objects to/from JSON. /// </summary> class JsonSerialiser { /// <summary> /// Serialises the provided object into JSON. /// </summary> /// <param name="obj">The object to serialise.</param> /// <returns>String of JSON representing the provided object.</returns> public string Serialise(object obj) { return JsonConvert.SerializeObject(obj); } /// <summary> /// Deserialises the provided JSON into an object of type <typeparamref name="T"/>. /// </summary> /// <typeparam name="T">The type to deserialise into.</typeparam> /// <param name="json">The string of JSON to deserialise.</param> /// <returns>A concrete object built from the provided JSON.</returns> public T Deserialise<T>(string json) { return (T)Deserialise(json, typeof(T)); } /// <summary> /// Deserialises the provided JSON into an object of the provided type. /// </summary> /// <param name="json">The string of JSON to deserialise.</param> /// <param name="t">The Type to be deserialised into.</param> /// <returns>A concrete object built from the provided JSON.</returns> public object Deserialise(string json, Type t) { return JsonConvert.DeserializeObject(json, t); } } }
using System; using System.Web.Script.Serialization; namespace DanTup.DartAnalysis { /// <summary> /// Serialises and deserialises objects to/from JSON. /// </summary> class JsonSerialiser { readonly JavaScriptSerializer serialiser = new JavaScriptSerializer(); /// <summary> /// Serialises the provided object into JSON. /// </summary> /// <param name="obj">The object to serialise.</param> /// <returns>String of JSON representing the provided object.</returns> public string Serialise(object obj) { return serialiser.Serialize(obj); } /// <summary> /// Deserialises the provided JSON into an object of type <typeparamref name="T"/>. /// </summary> /// <typeparam name="T">The type to deserialise into.</typeparam> /// <param name="json">The string of JSON to deserialise.</param> /// <returns>A concrete object built from the provided JSON.</returns> public T Deserialise<T>(string json) { return (T)Deserialise(json, typeof(T)); } /// <summary> /// Deserialises the provided JSON into an object of the provided type. /// </summary> /// <param name="json">The string of JSON to deserialise.</param> /// <param name="t">The Type to be deserialised into.</param> /// <returns>A concrete object built from the provided JSON.</returns> public object Deserialise(string json, Type t) { return serialiser.Deserialize(json, t); } } }
mit
C#
a7519637f961d11dc38c313f4b622819805f0b19
Test condition on related not included values
Vavro/Tests,Vavro/Tests,Vavro/Tests,Vavro/Tests
EntityFrameworkTests/EntityFrameworkTests/Program.cs
EntityFrameworkTests/EntityFrameworkTests/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using EntityFramework.Northwind.Entities; namespace EntityFrameworkTests { class Program { static void Main(string[] args) { //TestNotIncludedQuery(); using (var context = new NORTHWNDEntities()) { context.Configuration.LazyLoadingEnabled = false; context.Configuration.ProxyCreationEnabled = false; context.Configuration.AutoDetectChangesEnabled = false; context.Configuration.ValidateOnSaveEnabled = false; var ordersQuery = context.Orders.Where(o => o.Customers.Region != o.Employees.Region); var orders = ordersQuery.ToList(); foreach (var order in orders) { PrintOrder(order); } } Console.WriteLine("Press ENTER to exit"); Console.ReadLine(); } private static void TestNotIncludedQuery() { using (var context = new NORTHWNDEntities()) { context.Configuration.LazyLoadingEnabled = false; context.Configuration.ProxyCreationEnabled = false; context.Configuration.AutoDetectChangesEnabled = false; context.Configuration.ValidateOnSaveEnabled = false; //var customer = context.Customers.FirstOrDefault(); var currentCustomer = context.Customers.Attach(new Customers() {CustomerID = "ALFKI"}); var currentCustomerOrdersQuery = context.Orders.Where(o => o.Customers.CustomerID == currentCustomer.CustomerID); var currentCustomerOrders = currentCustomerOrdersQuery.ToList(); foreach (var currentCustomerOrder in currentCustomerOrders) { PrintOrder(currentCustomerOrder); } } } private static void PrintOrder(Orders currentCustomerOrder) { Console.WriteLine("Order Id {0}, shipped to: {4} {1} {2} {3}, on date {5}", currentCustomerOrder.OrderID, currentCustomerOrder.ShipAddress, currentCustomerOrder.ShipCity, currentCustomerOrder.ShipCountry, currentCustomerOrder.ShipName, currentCustomerOrder.ShippedDate); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using EntityFramework.Northwind.Entities; namespace EntityFrameworkTests { class Program { static void Main(string[] args) { using (var context = new NORTHWNDEntities()) { context.Configuration.LazyLoadingEnabled = false; context.Configuration.ProxyCreationEnabled = false; context.Configuration.AutoDetectChangesEnabled = false; context.Configuration.ValidateOnSaveEnabled = false; //var customer = context.Customers.FirstOrDefault(); var currentCustomer = context.Customers.Attach(new Customers() {CustomerID = "ALFKI"}); var currentCustomerOrdersQuery = context.Orders.Where(o => o.Customers.CustomerID == currentCustomer.CustomerID); var currentCustomerOrders = currentCustomerOrdersQuery.ToList(); foreach (var currentCustomerOrder in currentCustomerOrders) { Console.WriteLine("Order Id {0}, shipped to: {4} {1} {2} {3}, on date {5}", currentCustomerOrder.OrderID, currentCustomerOrder.ShipAddress, currentCustomerOrder.ShipCity, currentCustomerOrder.ShipCountry, currentCustomerOrder.ShipName, currentCustomerOrder.ShippedDate); } } Console.WriteLine("Press ENTER to exit"); Console.ReadLine(); } } }
mit
C#
ec91388110d96472ce1b416ff2f59e27134f8e95
Update FormItemModel.cs
bluemner/FormsGenerator,bluemner/FormsGenerator,bluemner/FormsGenerator
FormsGeneratorWebApplication/Models/FormItemModel.cs
FormsGeneratorWebApplication/Models/FormItemModel.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.Entity; using System.ComponentModel.DataAnnotations; namespace FormsGeneratorWebApplication.Models { public class FormItemModel { public int postion { get; set; } public string question { get; set; } public int type { get; set; } } //What is the point of this? this is parent class explain public class Question { public int ID { get; set; } public string QuestionText { get; set; } public string[] Options { get; set; } } public class QuestionDBContext : DbContext { public DbSet<Question> Questions { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.Entity; using System.ComponentModel.DataAnnotations; namespace FormsGeneratorWebApplication.Models { public class FormItemModel { public int postion { get; set; } public string question { get; set; } public int type { get; set; } } public class Question { public int ID { get; set; } public string QuestionText { get; set; } public string[] Options { get; set; } } public class QuestionDBContext : DbContext { public DbSet<Question> Questions { get; set; } } }
mit
C#
928063cf81f2ab1044c2a86696075edd293ef20b
Refactor / break out 'five_mixed_tsets' construction for impending re-use testing issue #1.
clicketyclack/TileExchange
TileExchange/UnitTests/TileSets/DiscoverLoadTests.cs
TileExchange/UnitTests/TileSets/DiscoverLoadTests.cs
/* * Copyright (C) 2018 Erik Mossberg * * This file is part of TileExchanger. * * TileExchanger is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * TileExchanger is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ using System; using NUnit.Framework; using TileExchange.TileSetTypes; using TileExchange.TileSetRepo; using TileExchange.ExchangeEngine; namespace TileExchange { public class DiscoverLoadTests { private TileSetRepo.TileSetRepo five_mixed_tsets { get; set; } [OneTimeSetUp] public void OneTime() { var tileset_path = UserSettings.GetDefaultPath("tileset_path"); tileset_path = System.IO.Path.Combine(tileset_path, "test"); tileset_path = System.IO.Path.Combine(tileset_path, "5_mixed_tsets"); five_mixed_tsets = new TileSetRepo.TileSetRepo(); five_mixed_tsets.Discover(tileset_path, false); } /// <summary> /// Check number of tilesets in a directory. /// </summary> [Test] public void DiscoverTileSets() { var tileset_path = UserSettings.GetDefaultPath("tileset_path"); tileset_path = System.IO.Path.Combine(tileset_path, "test"); var tsr_root = new TileSetRepo.TileSetRepo(); tsr_root.Discover(tileset_path, false); Assert.AreEqual(2, tsr_root.NumberOfTilesets()); var tsr_root_recur = new TileSetRepo.TileSetRepo(); tsr_root_recur.Discover(tileset_path, true); Assert.AreEqual(10, tsr_root_recur.NumberOfTilesets()); } /// <summary> /// Verify that tileset discovery correctly identifies tileset types. /// </summary> [Test] public void DiscoverTileSetsHandleType() { var found = five_mixed_tsets.ByName("Stars (8x16)"); Assert.AreEqual("ChoppedBitmapTileSet", found[0].TileSetType); found = five_mixed_tsets.ByName("16 pastels (32x32)"); Assert.AreEqual("ProceduralHSVTileSet", found[0].TileSetType); } } }
/* * Copyright (C) 2018 Erik Mossberg * * This file is part of TileExchanger. * * TileExchanger is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * TileExchanger is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ using System; using NUnit.Framework; using TileExchange.TileSetTypes; using TileExchange.TileSetRepo; using TileExchange.ExchangeEngine; namespace TileExchange { [TestFixture] public class DiscoverLoadTests { /// <summary> /// Check number of tilesets in a directory. /// </summary> [Test] public void DiscoverTileSets() { var tileset_path = UserSettings.GetDefaultPath("tileset_path"); tileset_path = System.IO.Path.Combine(tileset_path, "test"); var tsr_root = new TileSetRepo.TileSetRepo(); tsr_root.Discover(tileset_path, false); Assert.AreEqual(2, tsr_root.NumberOfTilesets()); var tsr_root_recur = new TileSetRepo.TileSetRepo(); tsr_root_recur.Discover(tileset_path, true); Assert.AreEqual(10, tsr_root_recur.NumberOfTilesets()); } /// <summary> /// Verify that tileset discovery correctly identifies tileset types. /// </summary> [Test] public void DiscoverTileSetsHandleType() { var tileset_path = UserSettings.GetDefaultPath("tileset_path"); tileset_path = System.IO.Path.Combine(tileset_path, "test"); tileset_path = System.IO.Path.Combine(tileset_path, "5_mixed_tsets"); var tsr_root = new TileSetRepo.TileSetRepo(); tsr_root.Discover(tileset_path, false); var found = tsr_root.ByName("Stars (8x16)"); Assert.AreEqual("ChoppedBitmapTileSet", found[0].TileSetType); found = tsr_root.ByName("16 pastels (32x32)"); Assert.AreEqual("ProceduralHSVTileSet", found[0].TileSetType); } } }
agpl-3.0
C#
9b24d8c3a0d6cab627c8b5fb997f89044d6178ad
Update Feature1.cs
iamnotageek/GitTest1
ConsoleApp1/ConsoleApp1/Feature1.cs
ConsoleApp1/ConsoleApp1/Feature1.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Feature1 { public int Add() { var x1 = 1; var x2 = 2; var sum = x1 + x2; return sum; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Feature1 { public int Add() { int x1 = 1; int x2 = 2; int sum = x1 + x2; return sum; } } }
mit
C#
1255ac03ac799e6be91af0103c627d7eb0b53d10
Revert "Fix threading issue on initialisation"
episerver/AlloyDemoKit,episerver/AlloyDemoKit,episerver/AlloyDemoKit
src/AlloyDemoKit/Business/Channels/DisplayResolutionBase.cs
src/AlloyDemoKit/Business/Channels/DisplayResolutionBase.cs
using EPiServer.Framework.Localization; using EPiServer.ServiceLocation; using EPiServer.Web; namespace AlloyDemoKit.Business.Channels { /// <summary> /// Base class for all resolution definitions /// </summary> public abstract class DisplayResolutionBase : IDisplayResolution { private Injected<LocalizationService> LocalizationService { get; set; } protected DisplayResolutionBase(string name, int width, int height) { Id = GetType().FullName; Name = Translate(name); Width = width; Height = height; } /// <summary> /// Gets the unique ID for this resolution /// </summary> public string Id { get; protected set; } /// <summary> /// Gets the name of resolution /// </summary> public string Name { get; protected set; } /// <summary> /// Gets the resolution width in pixels /// </summary> public int Width { get; protected set; } /// <summary> /// Gets the resolution height in pixels /// </summary> public int Height { get; protected set; } private string Translate(string resurceKey) { string value; if(!LocalizationService.Service.TryGetString(resurceKey, out value)) { value = resurceKey; } return value; } } }
using System; using EPiServer.Framework.Localization; using EPiServer.ServiceLocation; using EPiServer.Web; namespace AlloyDemoKit.Business.Channels { /// <summary> /// Base class for all resolution definitions /// </summary> public abstract class DisplayResolutionBase : IDisplayResolution { private Injected<LocalizationService> LocalizationService { get; set; } private static object syncLock = new Object(); protected DisplayResolutionBase(string name, int width, int height) { Id = GetType().FullName; Name = Translate(name); Width = width; Height = height; } /// <summary> /// Gets the unique ID for this resolution /// </summary> public string Id { get; protected set; } /// <summary> /// Gets the name of resolution /// </summary> public string Name { get; protected set; } /// <summary> /// Gets the resolution width in pixels /// </summary> public int Width { get; protected set; } /// <summary> /// Gets the resolution height in pixels /// </summary> public int Height { get; protected set; } private string Translate(string resurceKey) { string value; lock (syncLock) { if (!LocalizationService.Service.TryGetString(resurceKey, out value)) { value = resurceKey; } } return value; } } }
apache-2.0
C#
09ff0c5809be9025ca102b65640f25e68dda2338
Index aangepast
TeamXArtesis/ScrumProject,TeamXArtesis/ScrumProject
TeamX/TeamX/Views/Home/Index.cshtml
TeamX/TeamX/Views/Home/Index.cshtml
@{ ViewBag.Title = "Home Page"; ViewBag.Format = String.Format("{0:dddd}", @ViewBag.Datum); } <form action="~/Home/ResultPage" name="docentform"> <h1 class"indexTitle">@ViewBag.Format</h1> <h3>Klas</h3> <div class="ui-widget"> <label>Selecteer een klas: &nbsp;&nbsp;</label> <select id="combobox"> <option value="">Select one.."></option> <script src="~/Scripts/fillComboBox.js"></script> </select> </div> <h3>Lokaal</h3> <div class="ui-widget"> <label>Selecteer een lokaal: &nbsp;&nbsp;</label> <select id="combobox1"> <option value="">Select one.."></option> </select> </div> <h3>OLOD</h3> <div class="ui-widget"> <label>Selecteer een OLOD:&nbsp;</label> <select id="combobox2"> <option value="">Select one.."></option> </select> </div> <h3>Docent</h3> <div class="ui-widget"> <label>Selecteer een docent: </label> <select id="combobox3"> <option value="">Select one...</option> </select> </div> <input type="submit" value="OK" class="button"> </form>
@{ ViewBag.Title = "Home Page"; int id = ViewBag.Id; string day = ""; switch (id) { case 1: day = "Monday"; break; case 2: day = "Tuesday"; break; case 3: day = "Wednesday"; break; case 4: day = "Thursday"; break; case 5: day = "Friday"; break; default: day = "WTF"; break; } ViewBag.Day = day; } <form action="~/Home/ResultPage" name="docentform"> <h3>Klas</h3> <div class="ui-widget"> <label>Selecteer een klas: &nbsp;&nbsp;</label> <select id="combobox"> <option value="">Select one.."></option> <script src="~/Scripts/fillComboBox.js"></script> </select> </div> <h3>Lokaal</h3> <div class="ui-widget"> <label>Selecteer een lokaal: &nbsp;&nbsp;</label> <select id="combobox1"> <option value="">Select one.."></option> </select> </div> <h3>OLOD</h3> <div class="ui-widget"> <label>Selecteer een OLOD:&nbsp;</label> <select id="combobox2"> <option value="">Select one.."></option> </select> </div> <h3>Docent</h3> <div class="ui-widget"> <label>Selecteer een docent: </label> <select id="combobox3"> <option value="">Select one...</option> </select> </div> <input type="submit" value="OK" class="button"> </form>
mit
C#
90106ca437e1021e6d8538140e632798d272e6b9
Bump v1.0.15
karronoli/tiny-sato
TinySato/Properties/AssemblyInfo.cs
TinySato/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("TinySato")] [assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TinySato")] [assembly: AssemblyCopyright("Copyright 2016 karronoli")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: [assembly: AssemblyVersion("1.0.15")] [assembly: AssemblyFileVersion("1.0.15")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("TinySato")] [assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TinySato")] [assembly: AssemblyCopyright("Copyright 2016 karronoli")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: [assembly: AssemblyVersion("1.0.14")] [assembly: AssemblyFileVersion("1.0.14")]
apache-2.0
C#
407575c830a7583a7f938ccc91823f515059a821
Correct spelling of Bugs Bunny (#5)
wealth-farm/SparkPost.Net
src/WealthFarm.SparkPost.Tests/Integegration/TransmissionTests.cs
src/WealthFarm.SparkPost.Tests/Integegration/TransmissionTests.cs
using System.Collections.Generic; using System.Threading.Tasks; using FluentAssertions; using Xunit; namespace WealthFarm.SparkPost.Tests.Integegration { public class TransmissionTests : BaseTest { [Fact] public async Task CreateTransmission() { var transmission = new Transmission { Description = "A test transmission", Content = new TemplateContent { TemplateId = "test-email" } }; var recipients = new List<Recipient> { new Recipient { Address = new Address { Name = "Bugs Bunny", Email = Email } } }; transmission.WithRecipients(recipients); var result = await Client.CreateTransmission(transmission); result.Id.Should().NotBeNullOrEmpty(); result.TotalAcceptedRecipients.Should().Be(1); result.TotalRejectedRecipients.Should().Be(0); } } }
using System.Collections.Generic; using System.Threading.Tasks; using FluentAssertions; using Xunit; namespace WealthFarm.SparkPost.Tests.Integegration { public class TransmissionTests : BaseTest { [Fact] public async Task CreateTransmission() { var transmission = new Transmission { Description = "A test transmission", Content = new TemplateContent { TemplateId = "test-email" } }; var recipients = new List<Recipient> { new Recipient { Address = new Address { Name = "Buggs Bunny", Email = Email } } }; transmission.WithRecipients(recipients); var result = await Client.CreateTransmission(transmission); result.Id.Should().NotBeNullOrEmpty(); result.TotalAcceptedRecipients.Should().Be(1); result.TotalRejectedRecipients.Should().Be(0); } } }
mit
C#
d66fb307dc0f8b0fa0cb2f546dfb96663a320174
Fix wrong licence header
ZLima12/osu,ppy/osu,peppy/osu,2yangk23/osu,johnneijzen/osu,smoogipoo/osu,UselessToucan/osu,ZLima12/osu,naoey/osu,naoey/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,DrabWeb/osu,EVAST9919/osu,peppy/osu-new,Drezi126/osu,Nabile-Rahmani/osu,NeoAdonis/osu,smoogipooo/osu,2yangk23/osu,peppy/osu,ppy/osu,DrabWeb/osu,DrabWeb/osu,EVAST9919/osu,johnneijzen/osu,naoey/osu,Frontear/osuKyzer,NeoAdonis/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu
osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs
osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.UI { internal class DrawableManiaJudgement : DrawableJudgement<ManiaJudgement> { public DrawableManiaJudgement(ManiaJudgement judgement) : base(judgement) { JudgementText.TextSize = 25; } protected override void LoadComplete() { base.LoadComplete(); this.FadeInFromZero(50, Easing.OutQuint); switch (Judgement.Result) { case HitResult.Hit: this.ScaleTo(0.8f); this.ScaleTo(1, 250, Easing.OutElastic); this.Delay(50).FadeOut(200).ScaleTo(0.75f, 250); break; } Expire(); } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using osu.Framework.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.UI { internal class DrawableManiaJudgement : DrawableJudgement<ManiaJudgement> { public DrawableManiaJudgement(ManiaJudgement judgement) : base(judgement) { JudgementText.TextSize = 25; } protected override void LoadComplete() { base.LoadComplete(); this.FadeInFromZero(50, Easing.OutQuint); switch (Judgement.Result) { case HitResult.Hit: this.ScaleTo(0.8f); this.ScaleTo(1, 250, Easing.OutElastic); this.Delay(50).FadeOut(200).ScaleTo(0.75f, 250); break; } Expire(); } } }
mit
C#
6ee9a4b7697b74f953e20b7313c0e16a527ece90
Fix ClonesToRepositoryPathAsync test
github/VisualStudio,github/VisualStudio,github/VisualStudio
test/GitHub.App.UnitTests/Services/RepositoryCloneServiceTests.cs
test/GitHub.App.UnitTests/Services/RepositoryCloneServiceTests.cs
using System.Reactive.Linq; using System.Threading.Tasks; using NSubstitute; using NUnit.Framework; using UnitTests; using GitHub.Services; using System.Linq.Expressions; using System; using GitHub.Models; using GitHub.Api; public class RepositoryCloneServiceTests { public class TheCloneRepositoryMethod : TestBaseClass { [Test] public async Task ClonesToRepositoryPathAsync() { var serviceProvider = Substitutes.ServiceProvider; var operatingSystem = serviceProvider.GetOperatingSystem(); var vsGitServices = serviceProvider.GetVSGitServices(); var cloneService = serviceProvider.GetRepositoryCloneService(); await cloneService.CloneRepository("https://github.com/foo/bar", @"c:\dev\bar"); operatingSystem.Directory.Received().CreateDirectory(@"c:\dev\bar"); await vsGitServices.Received().Clone("https://github.com/foo/bar", @"c:\dev\bar", true); } [Test] public async Task UpdatesMetricsWhenRepositoryClonedAsync() { var serviceProvider = Substitutes.ServiceProvider; var operatingSystem = serviceProvider.GetOperatingSystem(); var vsGitServices = serviceProvider.GetVSGitServices(); var graphqlFactory = Substitute.For<IGraphQLClientFactory>(); var usageTracker = Substitute.For<IUsageTracker>(); var cloneService = new RepositoryCloneService(operatingSystem, vsGitServices, graphqlFactory, usageTracker); await cloneService.CloneRepository("https://github.com/foo/bar", "bar", @"c:\dev"); var model = UsageModel.Create(Guid.NewGuid()); await usageTracker.Received().IncrementCounter( Arg.Is<Expression<Func<UsageModel.MeasuresModel, int>>>(x => ((MemberExpression)x.Body).Member.Name == nameof(model.Measures.NumberOfClones))); } } }
using System.Reactive.Linq; using System.Threading.Tasks; using NSubstitute; using NUnit.Framework; using UnitTests; using GitHub.Services; using System.Linq.Expressions; using System; using GitHub.Models; using GitHub.Api; public class RepositoryCloneServiceTests { public class TheCloneRepositoryMethod : TestBaseClass { [Test] public async Task ClonesToRepositoryPathAsync() { var serviceProvider = Substitutes.ServiceProvider; var operatingSystem = serviceProvider.GetOperatingSystem(); var vsGitServices = serviceProvider.GetVSGitServices(); var cloneService = serviceProvider.GetRepositoryCloneService(); await cloneService.CloneRepository("https://github.com/foo/bar", "bar", @"c:\dev"); operatingSystem.Directory.Received().CreateDirectory(@"c:\dev\bar"); await vsGitServices.Received().Clone("https://github.com/foo/bar", @"c:\dev\bar", true); } [Test] public async Task UpdatesMetricsWhenRepositoryClonedAsync() { var serviceProvider = Substitutes.ServiceProvider; var operatingSystem = serviceProvider.GetOperatingSystem(); var vsGitServices = serviceProvider.GetVSGitServices(); var graphqlFactory = Substitute.For<IGraphQLClientFactory>(); var usageTracker = Substitute.For<IUsageTracker>(); var cloneService = new RepositoryCloneService(operatingSystem, vsGitServices, graphqlFactory, usageTracker); await cloneService.CloneRepository("https://github.com/foo/bar", "bar", @"c:\dev"); var model = UsageModel.Create(Guid.NewGuid()); await usageTracker.Received().IncrementCounter( Arg.Is<Expression<Func<UsageModel.MeasuresModel, int>>>(x => ((MemberExpression)x.Body).Member.Name == nameof(model.Measures.NumberOfClones))); } } }
mit
C#
2daa1dd99102fb9a102caf1f54640b57e4ed2c6c
add null check for user in delete method in service
olebg/car-mods-heaven,olebg/car-mods-heaven
CarModsHeaven/CarModsHeaven/CarModsHeaven.Services/UsersService.cs
CarModsHeaven/CarModsHeaven/CarModsHeaven.Services/UsersService.cs
using System.Linq; using Bytes2you.Validation; using CarModsHeaven.Data.Contracts; using CarModsHeaven.Data.Models; using CarModsHeaven.Data.Repositories.Contracts; using CarModsHeaven.Services.Contracts; namespace CarModsHeaven.Services { public class UsersService : IUsersService { private readonly IEfRepository<User> usersRepo; private readonly IUnitOfWork context; private readonly string usersRepoCheck = "Users Repository is null"; private readonly string contextCheck = "DbContext is null"; private readonly string userCheck = "Project is null"; public UsersService(IEfRepository<User> usersRepo, IUnitOfWork context) { Guard.WhenArgument(usersRepo, this.usersRepoCheck).IsNull().Throw(); Guard.WhenArgument(context, this.contextCheck).IsNull().Throw(); this.usersRepo = usersRepo; this.context = context; } public IQueryable<User> GetAll() { return this.usersRepo.AllVisible; } public IQueryable<User> GetUserById(string id) { return this.usersRepo.AllVisible .Where(x => x.Id == id); } public void Delete(User user) { Guard.WhenArgument(user, this.userCheck).IsNull().Throw(); this.usersRepo.Delete(user); this.context.SaveChanges(); } } }
using System.Linq; using Bytes2you.Validation; using CarModsHeaven.Data.Contracts; using CarModsHeaven.Data.Models; using CarModsHeaven.Data.Repositories.Contracts; using CarModsHeaven.Services.Contracts; namespace CarModsHeaven.Services { public class UsersService : IUsersService { private readonly IEfRepository<User> usersRepo; private readonly IUnitOfWork context; private readonly string usersRepoCheck = "Users Repository is null"; private readonly string contextCheck = "DbContext is null"; public UsersService(IEfRepository<User> usersRepo, IUnitOfWork context) { Guard.WhenArgument(usersRepo, this.usersRepoCheck).IsNull().Throw(); Guard.WhenArgument(context, this.contextCheck).IsNull().Throw(); this.usersRepo = usersRepo; this.context = context; } public IQueryable<User> GetAll() { return this.usersRepo.AllVisible; } public IQueryable<User> GetUserById(string id) { return this.usersRepo.AllVisible .Where(x => x.Id == id); } public void Delete(User user) { this.usersRepo.Delete(user); this.context.SaveChanges(); } } }
mit
C#
7af60d550f39e9b6070b93bce14af9457455b136
Fix not allowing to compile project with no implementation of IDotvvmServiceConfigurator
riganti/dotvvm,riganti/dotvvm,riganti/dotvvm,riganti/dotvvm
src/DotVVM.Compiler/Resolving/DotvvmServiceConfiguratorResolver.cs
src/DotVVM.Compiler/Resolving/DotvvmServiceConfiguratorResolver.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using DotVVM.Compiler.Exceptions; using DotVVM.Framework.Configuration; using DotVVM.Framework.Utils; using Microsoft.Extensions.DependencyInjection; namespace DotVVM.Compiler.Resolving { public class DotvvmServiceConfiguratorResolver : IDotvvmServiceConfiguratorResolver { private Type ResolveIDotvvmServiceConfiguratorClassType(Assembly assembly) { var interfaceType = typeof(IDotvvmServiceConfigurator); var resultTypes = assembly.GetLoadableTypes().Where(s => s.GetTypeInfo().ImplementedInterfaces.Any(i => i.Name == interfaceType.Name)).Where(s => s != null).ToList(); if (resultTypes.Count > 1) { throw new ConfigurationInitializationException( $"Assembly '{assembly.FullName}' contains more the one implementaion of IDotvvmServiceConfigurator."); } return resultTypes.SingleOrDefault(); } private MethodInfo ResolveConfigureServicesMethods(Type startupType) { var method = startupType.GetMethod("ConfigureServices", new[] {typeof(IDotvvmServiceCollection)}); if (method == null) { throw new ConfigurationInitializationException("Missing method 'void ConfigureServices(IDotvvmServiceCollection services)'."); } return method; } public IServiceConfiguratorExecutor GetServiceConfiguratorExecutor(Assembly assembly) { var startupType = ResolveIDotvvmServiceConfiguratorClassType(assembly); if (startupType == null) { return new NoServiceConfiguratorExecutor(); } var resolvedMethod = ResolveConfigureServicesMethods(startupType); return new ServiceConfiguratorExecutor(resolvedMethod, startupType); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using DotVVM.Compiler.Exceptions; using DotVVM.Framework.Configuration; using DotVVM.Framework.Utils; using Microsoft.Extensions.DependencyInjection; namespace DotVVM.Compiler.Resolving { public class DotvvmServiceConfiguratorResolver : IDotvvmServiceConfiguratorResolver { private Type ResolveIDotvvmServiceConfiguratorClassType(Assembly assembly) { var interfaceType = typeof(IDotvvmServiceConfigurator); var resultTypes = assembly.GetLoadableTypes().Where(s => s.GetTypeInfo().ImplementedInterfaces.Any(i => i.Name == interfaceType.Name)).Where(s => s != null).ToList(); if (resultTypes.Count > 1) { throw new ConfigurationInitializationException( $"Assembly '{assembly.FullName}' contains more the one implementaion of IDotvvmServiceConfigurator."); } return resultTypes.Single(); } private MethodInfo ResolveConfigureServicesMethods(Type startupType) { var method = startupType.GetMethod("ConfigureServices", new[] {typeof(IDotvvmServiceCollection)}); if (method == null) { throw new ConfigurationInitializationException("Missing method 'void ConfigureServices(IDotvvmServiceCollection services)'."); } return method; } public IServiceConfiguratorExecutor GetServiceConfiguratorExecutor(Assembly assembly) { var startupType = ResolveIDotvvmServiceConfiguratorClassType(assembly); if (startupType == null) { return new NoServiceConfiguratorExecutor(); } var resolvedMethod = ResolveConfigureServicesMethods(startupType); return new ServiceConfiguratorExecutor(resolvedMethod, startupType); } } }
apache-2.0
C#
e571ad510d1be8b813dc070f07f26d99950e303e
Change UpdateManager to use events.
Necromunger/unitystation,krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,Necromunger/unitystation,krille90/unitystation,fomalsd/unitystation,Necromunger/unitystation,Necromunger/unitystation,Necromunger/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation
UnityProject/Assets/Scripts/Managers/UpdateManager/UpdateManager.cs
UnityProject/Assets/Scripts/Managers/UpdateManager/UpdateManager.cs
using UnityEngine; using UnityEngine.SceneManagement; using System; /// <summary> /// Handles the update methods for in game objects /// Handling the updates from a single point decreases cpu time /// and increases performance /// </summary> public class UpdateManager : MonoBehaviour { private static UpdateManager updateManager; private event Action UpdateMe; private event Action FixedUpdateMe; private event Action LateUpdateMe; private event Action UpdateAction; public static UpdateManager Instance { get { if (updateManager == null) { updateManager = FindObjectOfType<UpdateManager>(); } return updateManager; } } public void Add(ManagedNetworkBehaviour updatable) { UpdateMe += updatable.UpdateMe; FixedUpdateMe += updatable.FixedUpdateMe; LateUpdateMe += updatable.LateUpdateMe; } public void Add(Action updatable) { UpdateAction += updatable; } public void Remove(ManagedNetworkBehaviour updatable) { UpdateMe -= updatable.UpdateMe; FixedUpdateMe -= updatable.FixedUpdateMe; LateUpdateMe -= updatable.LateUpdateMe; } public void Remove(Action updatable) { UpdateAction -= updatable; } private void OnEnable() { SceneManager.activeSceneChanged += SceneChanged; } private void OnDisable() { SceneManager.activeSceneChanged -= SceneChanged; } private void SceneChanged(Scene prevScene, Scene newScene) { Reset(); } private void Reset() { UpdateMe = null; FixedUpdateMe = null; LateUpdateMe = null; } private void Update() { UpdateMe?.Invoke(); FixedUpdateMe?.Invoke(); LateUpdateMe?.Invoke(); UpdateAction?.Invoke(); } }
using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using System; /// <summary> /// Handles the update methods for in game objects /// Handling the updates from a single point decreases cpu time /// and increases performance /// </summary> public class UpdateManager : MonoBehaviour { private static UpdateManager updateManager; //List of all the objects to override UpdateMe method in Update private readonly List<ManagedNetworkBehaviour> regularUpdate = new List<ManagedNetworkBehaviour>(); private readonly List<Action> regularUpdateAction = new List<Action>(); public static UpdateManager Instance { get { if (updateManager == null) { updateManager = FindObjectOfType<UpdateManager>(); } return updateManager; } } public void Add(ManagedNetworkBehaviour updatable) { if (!regularUpdate.Contains(updatable)) { regularUpdate.Add(updatable); } } public void Add(Action updatable) { if (!regularUpdateAction.Contains(updatable)) { regularUpdateAction.Add(updatable); } } public void Remove(ManagedNetworkBehaviour updatable) { if (regularUpdate.Contains(updatable)) { regularUpdate.Remove(updatable); } } public void Remove(Action updatable) { if (regularUpdateAction.Contains(updatable)) { regularUpdateAction.Remove(updatable); } } private void OnEnable() { SceneManager.activeSceneChanged += SceneChanged; } private void OnDisable() { SceneManager.activeSceneChanged -= SceneChanged; } private void SceneChanged(Scene prevScene, Scene newScene) { Reset(); } // Reset the references when the scene is changed private void Reset() { regularUpdate.Clear(); } private void Update() { for (int i = 0; i < regularUpdate.Count; i++) { regularUpdate[i].UpdateMe(); regularUpdate[i].FixedUpdateMe(); regularUpdate[i].LateUpdateMe(); } for(int i = 0; i < regularUpdateAction.Count; i++) { regularUpdateAction[i].Invoke(); } } }
agpl-3.0
C#
beab534a4524b439eb62b9418b16bed6cea00c35
Mark System.Collections HashCollisionScenario test as OuterLoop
yizhang82/corefx,Jiayili1/corefx,tijoytom/corefx,krytarowski/corefx,tijoytom/corefx,ravimeda/corefx,Ermiar/corefx,seanshpark/corefx,seanshpark/corefx,nbarbettini/corefx,weltkante/corefx,ptoonen/corefx,gkhanna79/corefx,dotnet-bot/corefx,stone-li/corefx,mazong1123/corefx,wtgodbe/corefx,tijoytom/corefx,Jiayili1/corefx,nchikanov/corefx,cydhaselton/corefx,marksmeltzer/corefx,ViktorHofer/corefx,alexperovich/corefx,shimingsg/corefx,stone-li/corefx,ptoonen/corefx,cydhaselton/corefx,shmao/corefx,stephenmichaelf/corefx,YoupHulsebos/corefx,marksmeltzer/corefx,stephenmichaelf/corefx,Jiayili1/corefx,ravimeda/corefx,tijoytom/corefx,shimingsg/corefx,krk/corefx,lggomez/corefx,ViktorHofer/corefx,the-dwyer/corefx,stone-li/corefx,parjong/corefx,dhoehna/corefx,rjxby/corefx,rjxby/corefx,ptoonen/corefx,weltkante/corefx,fgreinacher/corefx,lggomez/corefx,dhoehna/corefx,the-dwyer/corefx,YoupHulsebos/corefx,yizhang82/corefx,fgreinacher/corefx,ericstj/corefx,weltkante/corefx,rahku/corefx,billwert/corefx,Ermiar/corefx,jlin177/corefx,dotnet-bot/corefx,wtgodbe/corefx,ravimeda/corefx,ravimeda/corefx,ptoonen/corefx,nchikanov/corefx,rahku/corefx,krytarowski/corefx,stephenmichaelf/corefx,axelheer/corefx,the-dwyer/corefx,krk/corefx,YoupHulsebos/corefx,Ermiar/corefx,mazong1123/corefx,YoupHulsebos/corefx,alexperovich/corefx,BrennanConroy/corefx,jlin177/corefx,tijoytom/corefx,billwert/corefx,dotnet-bot/corefx,ptoonen/corefx,krytarowski/corefx,DnlHarvey/corefx,shimingsg/corefx,lggomez/corefx,stone-li/corefx,JosephTremoulet/corefx,ViktorHofer/corefx,shimingsg/corefx,YoupHulsebos/corefx,tijoytom/corefx,jlin177/corefx,gkhanna79/corefx,gkhanna79/corefx,Petermarcu/corefx,stephenmichaelf/corefx,MaggieTsang/corefx,MaggieTsang/corefx,dotnet-bot/corefx,alexperovich/corefx,yizhang82/corefx,MaggieTsang/corefx,rahku/corefx,seanshpark/corefx,shmao/corefx,weltkante/corefx,nchikanov/corefx,jlin177/corefx,seanshpark/corefx,DnlHarvey/corefx,rubo/corefx,mmitche/corefx,dhoehna/corefx,krk/corefx,ravimeda/corefx,shmao/corefx,twsouthwick/corefx,marksmeltzer/corefx,shimingsg/corefx,axelheer/corefx,the-dwyer/corefx,twsouthwick/corefx,ericstj/corefx,marksmeltzer/corefx,cydhaselton/corefx,Petermarcu/corefx,elijah6/corefx,nbarbettini/corefx,lggomez/corefx,Jiayili1/corefx,elijah6/corefx,parjong/corefx,dotnet-bot/corefx,ericstj/corefx,JosephTremoulet/corefx,rjxby/corefx,ViktorHofer/corefx,billwert/corefx,cydhaselton/corefx,nbarbettini/corefx,krytarowski/corefx,mmitche/corefx,zhenlan/corefx,jlin177/corefx,Ermiar/corefx,gkhanna79/corefx,alexperovich/corefx,MaggieTsang/corefx,elijah6/corefx,wtgodbe/corefx,zhenlan/corefx,dhoehna/corefx,elijah6/corefx,billwert/corefx,nchikanov/corefx,mmitche/corefx,DnlHarvey/corefx,mazong1123/corefx,stone-li/corefx,dhoehna/corefx,zhenlan/corefx,MaggieTsang/corefx,Jiayili1/corefx,the-dwyer/corefx,nchikanov/corefx,fgreinacher/corefx,rjxby/corefx,zhenlan/corefx,wtgodbe/corefx,rahku/corefx,krk/corefx,weltkante/corefx,yizhang82/corefx,alexperovich/corefx,Petermarcu/corefx,mmitche/corefx,lggomez/corefx,fgreinacher/corefx,MaggieTsang/corefx,DnlHarvey/corefx,MaggieTsang/corefx,stone-li/corefx,richlander/corefx,shimingsg/corefx,rubo/corefx,nbarbettini/corefx,weltkante/corefx,krytarowski/corefx,seanshpark/corefx,stephenmichaelf/corefx,alexperovich/corefx,mazong1123/corefx,dotnet-bot/corefx,richlander/corefx,twsouthwick/corefx,richlander/corefx,lggomez/corefx,krk/corefx,JosephTremoulet/corefx,ptoonen/corefx,rahku/corefx,BrennanConroy/corefx,Ermiar/corefx,ViktorHofer/corefx,shimingsg/corefx,rubo/corefx,parjong/corefx,DnlHarvey/corefx,Petermarcu/corefx,JosephTremoulet/corefx,twsouthwick/corefx,parjong/corefx,seanshpark/corefx,billwert/corefx,cydhaselton/corefx,twsouthwick/corefx,mmitche/corefx,gkhanna79/corefx,rahku/corefx,jlin177/corefx,wtgodbe/corefx,Ermiar/corefx,shmao/corefx,axelheer/corefx,marksmeltzer/corefx,Jiayili1/corefx,nbarbettini/corefx,elijah6/corefx,seanshpark/corefx,Petermarcu/corefx,krytarowski/corefx,dhoehna/corefx,DnlHarvey/corefx,yizhang82/corefx,rubo/corefx,zhenlan/corefx,nbarbettini/corefx,mmitche/corefx,mazong1123/corefx,BrennanConroy/corefx,DnlHarvey/corefx,zhenlan/corefx,nchikanov/corefx,nchikanov/corefx,krk/corefx,shmao/corefx,YoupHulsebos/corefx,krk/corefx,ericstj/corefx,axelheer/corefx,axelheer/corefx,yizhang82/corefx,mazong1123/corefx,yizhang82/corefx,ViktorHofer/corefx,Petermarcu/corefx,shmao/corefx,twsouthwick/corefx,ericstj/corefx,nbarbettini/corefx,richlander/corefx,JosephTremoulet/corefx,richlander/corefx,Ermiar/corefx,JosephTremoulet/corefx,elijah6/corefx,Petermarcu/corefx,ravimeda/corefx,parjong/corefx,zhenlan/corefx,mazong1123/corefx,jlin177/corefx,billwert/corefx,parjong/corefx,ViktorHofer/corefx,parjong/corefx,twsouthwick/corefx,ericstj/corefx,shmao/corefx,stephenmichaelf/corefx,ptoonen/corefx,marksmeltzer/corefx,gkhanna79/corefx,rahku/corefx,the-dwyer/corefx,rjxby/corefx,gkhanna79/corefx,krytarowski/corefx,rubo/corefx,stone-li/corefx,stephenmichaelf/corefx,dhoehna/corefx,mmitche/corefx,Jiayili1/corefx,YoupHulsebos/corefx,rjxby/corefx,alexperovich/corefx,richlander/corefx,JosephTremoulet/corefx,wtgodbe/corefx,axelheer/corefx,dotnet-bot/corefx,the-dwyer/corefx,billwert/corefx,wtgodbe/corefx,rjxby/corefx,lggomez/corefx,cydhaselton/corefx,elijah6/corefx,weltkante/corefx,marksmeltzer/corefx,richlander/corefx,cydhaselton/corefx,tijoytom/corefx,ravimeda/corefx,ericstj/corefx
src/System.Collections/tests/Generic/Dictionary/HashCollisionScenarios/OutOfBoundsRegression.cs
src/System.Collections/tests/Generic/Dictionary/HashCollisionScenarios/OutOfBoundsRegression.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.Collections.Generic; using Xunit; namespace System.Collections.Tests { public class InternalHashCodeTests { /// <summary> /// Given a byte array, copies it to the string, without messing with any encoding. This issue was hit on a x64 machine /// </summary> private static string GetString(byte[] bytes) { var chars = new char[bytes.Length / sizeof(char)]; Buffer.BlockCopy(bytes, 0, chars, 0, bytes.Length); return new string(chars); } [Fact] [OuterLoop("Takes over 55% of System.Collections.Tests testing time")] public static void OutOfBoundsRegression() { var dictionary = new Dictionary<string, string>(); foreach (var item in TestData.GetData()) { var operation = item.Item1; var keyBase64 = item.Item2; var key = keyBase64.Length > 0 ? GetString(Convert.FromBase64String(keyBase64)) : string.Empty; if (operation == InputAction.Add) dictionary[key] = key; else if (operation == InputAction.Delete) dictionary.Remove(key); } } } }
// 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.Collections.Generic; using Xunit; namespace System.Collections.Tests { public class InternalHashCodeTests { /// <summary> /// Given a byte array, copies it to the string, without messing with any encoding. This issue was hit on a x64 machine /// </summary> private static string GetString(byte[] bytes) { var chars = new char[bytes.Length / sizeof(char)]; Buffer.BlockCopy(bytes, 0, chars, 0, bytes.Length); return new string(chars); } [Fact] public static void OutOfBoundsRegression() { var dictionary = new Dictionary<string, string>(); foreach (var item in TestData.GetData()) { var operation = item.Item1; var keyBase64 = item.Item2; var key = keyBase64.Length > 0 ? GetString(Convert.FromBase64String(keyBase64)) : string.Empty; if (operation == InputAction.Add) dictionary[key] = key; else if (operation == InputAction.Delete) dictionary.Remove(key); } } } }
mit
C#
35d1122d035ddb93f91c404d2cc0907a4ba48964
Add validation implementation in search module.
henrikfroehling/TraktApiSharp
Source/Lib/TraktApiSharp/Modules/TraktSearchModule.cs
Source/Lib/TraktApiSharp/Modules/TraktSearchModule.cs
namespace TraktApiSharp.Modules { using Enums; using Objects.Basic; using Requests; using Requests.WithoutOAuth.Search; using System; using System.Threading.Tasks; public class TraktSearchModule : TraktBaseModule { public TraktSearchModule(TraktClient client) : base(client) { } public async Task<TraktPaginationListResult<TraktSearchResult>> SearchTextQueryAsync(string query, TraktSearchResultType? type = null, int? year = null, int? page = null, int? limit = null) { ValidateQuery(query); return await QueryAsync(new TraktSearchTextQueryRequest(Client) { Query = query, Type = type, Year = year, PaginationOptions = new TraktPaginationOptions(page, limit) }); } public async Task<TraktPaginationListResult<TraktSearchIdLookupResult>> SearchIdLookupAsync(TraktSearchLookupIdType type, string lookupId, int? page = null, int? limit = null) { ValidateIdLookup(lookupId); return await QueryAsync(new TraktSearchIdLookupRequest(Client) { Type = type, LookupId = lookupId, PaginationOptions = new TraktPaginationOptions(page, limit) }); } private void ValidateQuery(string query) { if (string.IsNullOrEmpty(query)) throw new ArgumentException("search query not valid", "query"); } private void ValidateIdLookup(string lookupId) { if (string.IsNullOrEmpty(lookupId)) throw new ArgumentException("search lookup id not valid", "lookupId"); } } }
namespace TraktApiSharp.Modules { using Enums; using Objects.Basic; using Requests; using Requests.WithoutOAuth.Search; using System.Threading.Tasks; public class TraktSearchModule : TraktBaseModule { public TraktSearchModule(TraktClient client) : base(client) { } public async Task<TraktPaginationListResult<TraktSearchResult>> SearchTextQueryAsync(string query, TraktSearchResultType? type = null, int? year = null, int? page = null, int? limit = null) { return await QueryAsync(new TraktSearchTextQueryRequest(Client) { Query = query, Type = type, Year = year, PaginationOptions = new TraktPaginationOptions(page, limit) }); } public async Task<TraktPaginationListResult<TraktSearchIdLookupResult>> SearchIdLookupAsync(TraktSearchLookupIdType type, string lookupId, int? page = null, int? limit = null) { return await QueryAsync(new TraktSearchIdLookupRequest(Client) { Type = type, LookupId = lookupId, PaginationOptions = new TraktPaginationOptions(page, limit) }); } } }
mit
C#
8396386945071e5d0ea203aeccfaf24b5cd70d54
Fix syntax error (C# 6.0 feature) from previous commit
davetransom/Swashbuckle,domaindrivendev/Swashbuckle,lostllama/Swashbuckle,Atomosk/Swashbuckle,davetransom/Swashbuckle,domaindrivendev/Swashbuckle,davetransom/Swashbuckle,domaindrivendev/Swashbuckle,lostllama/Swashbuckle,lostllama/Swashbuckle,Atomosk/Swashbuckle,lostllama/Swashbuckle,davetransom/Swashbuckle,Atomosk/Swashbuckle,Atomosk/Swashbuckle
Swashbuckle.Tests/Owin/BaseInMemoryOwinSwaggerTest.cs
Swashbuckle.Tests/Owin/BaseInMemoryOwinSwaggerTest.cs
using System; using System.Net.Http; using System.Threading.Tasks; using Microsoft.Owin.Testing; using Newtonsoft.Json.Linq; using NUnit.Framework; using Owin; namespace Swashbuckle.Tests.Owin { [TestFixture] public abstract class BaseInMemoryOwinSwaggerTest { protected HttpClient _client; private IDisposable _server; /// <summary> /// Generates swagger documentation only for specific controllers. /// </summary> /// <param name="controllerType"></param> protected void UseInMemoryOwinServer(params Type[] controllerType) { ConfigureInMemoryOwinServer(appBuilder => ConfigureOwinStartup(controllerType, appBuilder)); } protected void UseInMemoryOwinServer(Action<IAppBuilder> owinStartupBuilder) { ConfigureInMemoryOwinServer(appBuilder => owinStartupBuilder(appBuilder)); } private void ConfigureOwinStartup(Type[] controller, IAppBuilder appBuilder) { new OwinStartup(controller).Configuration(appBuilder); } private void ConfigureInMemoryOwinServer(Action<IAppBuilder> appBuilder) { var testServer = TestServer.Create(appBuilder); _client = testServer.HttpClient; _server = testServer; } [TestFixtureTearDown] public void TeardownFixture() { if (_server != null) _server.Dispose(); _server = null; } [TearDown] public void Teardown() { if (_server != null) _server.Dispose(); _server = null; } protected async Task<JObject> GetSwaggerDocs() { return await GetContent("swagger/docs/v1"); } protected async Task<JObject> GetContent(string uri) { var response = await _client.GetAsync(uri); if (response.IsSuccessStatusCode == false) Assert.Fail("Failed request to {0}: Status code: {1} {2}", uri, response.StatusCode.ToString(), response.ReasonPhrase); var content = await response.Content.ReadAsAsync<JObject>(); return content; } } }
using System; using System.Net.Http; using System.Threading.Tasks; using Microsoft.Owin.Testing; using Newtonsoft.Json.Linq; using NUnit.Framework; using Owin; namespace Swashbuckle.Tests.Owin { [TestFixture] public abstract class BaseInMemoryOwinSwaggerTest { protected HttpClient _client; private IDisposable _server; /// <summary> /// Generates swagger documentation only for specific controllers. /// </summary> /// <param name="controllerType"></param> protected void UseInMemoryOwinServer(params Type[] controllerType) { ConfigureInMemoryOwinServer(appBuilder => ConfigureOwinStartup(controllerType, appBuilder)); } protected void UseInMemoryOwinServer(Action<IAppBuilder> owinStartupBuilder) { ConfigureInMemoryOwinServer(appBuilder => owinStartupBuilder(appBuilder)); } private void ConfigureOwinStartup(Type[] controller, IAppBuilder appBuilder) { new OwinStartup(controller).Configuration(appBuilder); } private void ConfigureInMemoryOwinServer(Action<IAppBuilder> appBuilder) { var testServer = TestServer.Create(appBuilder); _client = testServer.HttpClient; _server = testServer; } [TestFixtureTearDown] public void TeardownFixture() { _server?.Dispose(); _server = null; } [TearDown] public void Teardown() { _server?.Dispose(); _server = null; } protected async Task<JObject> GetSwaggerDocs() { return await GetContent("swagger/docs/v1"); } protected async Task<JObject> GetContent(string uri) { var response = await _client.GetAsync(uri); if (response.IsSuccessStatusCode == false) Assert.Fail("Failed request to {0}: Status code: {1} {2}", uri, response.StatusCode.ToString(), response.ReasonPhrase); var content = await response.Content.ReadAsAsync<JObject>(); return content; } } }
bsd-3-clause
C#
2201fc745e4514cc9eff3104aa8f8e16e0585e86
Fix storyboard loops start time when none of their commands start at 0.
UselessToucan/osu,johnneijzen/osu,ppy/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,Nabile-Rahmani/osu,peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,ZLima12/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,johnneijzen/osu,DrabWeb/osu,ZLima12/osu,peppy/osu-new,UselessToucan/osu,EVAST9919/osu,Drezi126/osu,naoey/osu,DrabWeb/osu,naoey/osu,smoogipoo/osu,naoey/osu,Frontear/osuKyzer,NeoAdonis/osu,2yangk23/osu,DrabWeb/osu
osu.Game/Storyboards/CommandLoop.cs
osu.Game/Storyboards/CommandLoop.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; namespace osu.Game.Storyboards { public class CommandLoop : CommandTimelineGroup { public double LoopStartTime; public int LoopCount; public override double StartTime => LoopStartTime + CommandsStartTime; public override double EndTime => StartTime + CommandsDuration * LoopCount; public CommandLoop(double startTime, int loopCount) { LoopStartTime = startTime; LoopCount = loopCount; } public override IEnumerable<CommandTimeline<T>.TypedCommand> GetCommands<T>(CommandTimelineSelector<T> timelineSelector, double offset = 0) { for (var loop = 0; loop < LoopCount; loop++) { var loopOffset = LoopStartTime + loop * CommandsDuration; foreach (var command in base.GetCommands(timelineSelector, offset + loopOffset)) yield return command; } } public override string ToString() => $"{LoopStartTime} x{LoopCount}"; } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; namespace osu.Game.Storyboards { public class CommandLoop : CommandTimelineGroup { public double LoopStartTime; public int LoopCount; public override double StartTime => LoopStartTime; public override double EndTime => LoopStartTime + CommandsDuration * LoopCount; public CommandLoop(double startTime, int loopCount) { LoopStartTime = startTime; LoopCount = loopCount; } public override IEnumerable<CommandTimeline<T>.TypedCommand> GetCommands<T>(CommandTimelineSelector<T> timelineSelector, double offset = 0) { for (var loop = 0; loop < LoopCount; loop++) { var loopOffset = LoopStartTime + loop * CommandsDuration; foreach (var command in base.GetCommands(timelineSelector, offset + loopOffset)) yield return command; } } public override string ToString() => $"{LoopStartTime} x{LoopCount}"; } }
mit
C#
67b62133044be192515c1412681a7f579a00c478
Update ViewModelRepository
geeklearningio/Testavior
src/GeekLearning.Test.Integration/Mvc/ViewModelRepository.cs
src/GeekLearning.Test.Integration/Mvc/ViewModelRepository.cs
namespace GeekLearning.Test.Integration.Mvc { using System; using System.Collections.Concurrent; public class ViewModelRepository { private readonly ConcurrentDictionary<Type, object> repository = new ConcurrentDictionary<Type, object>(); public void Add<TModel>(TModel model) where TModel : class { if (!this.repository.TryAdd(model.GetType(), model)) { throw new ArgumentException($"The model {model.GetType().Name} is already registered"); } } public TModel Get<TModel>() where TModel : class { object value; this.repository.TryGetValue(typeof(TModel), out value); return value as TModel; } } }
namespace GeekLearning.Test.Integration.Mvc { using System; using System.Collections.Concurrent; public class ViewModelRepository { private readonly ConcurrentDictionary<Type, object> repository = new ConcurrentDictionary<Type, object>(); public void Add<TModel>(TModel model) where TModel : class { if (!this.repository.TryAdd(model.GetType(), model)) { throw new ArgumentException($"The model {model.GetType().Name} is already registered"); } } public TModel Get<TModel>() where TModel : class { object value; this.repository.TryGetValue(typeof(TModel), out value); return value as TModel; } } }
mit
C#
f9d8b09d1a707dce90caf04167148106691c6f8b
Use wslPath from settings with the PathConverter methods.
archpoint/gitwrap
GitWrap/PathConverter.cs
GitWrap/PathConverter.cs
using System; using System.Text.RegularExpressions; namespace GitWrap { public class PathConverter { public static string convertPathFromWindowsToLinux(String path) { // Translate directory structure. // Use regex to translate drive letters. string pattern = @"(\D):\\"; string argstr = path; foreach (Match match in Regex.Matches(path, pattern, RegexOptions.IgnoreCase)) { string driveLetter = match.Groups[1].ToString(); argstr = Regex.Replace(path, pattern, Properties.Settings.Default.wslpath + driveLetter.ToLower() + "/"); } // Convert Windows path to Linux style paths argstr = argstr.Replace("\\", "/"); // Escape any whitespaces argstr = argstr.Replace(" ", "\\ "); // Escape parenthesis argstr = argstr.Replace("(", "\\("); argstr = argstr.Replace(")", "\\)"); return argstr; } public static string convertPathFromLinuxToWindows(String path) { string drivePathPattern = String.Format(@"{0}(\D)/", Properties.Settings.Default.wslpath); string argstr = path; foreach (Match match in Regex.Matches(path, drivePathPattern, RegexOptions.None)) { string driveLetter = match.Groups[1].ToString(); argstr = Regex.Replace(path, drivePathPattern, driveLetter.ToUpper() + ":\\"); // Convert Linux style path separators to Windows style equivalent argstr = argstr.Replace("/", "\\"); } argstr = argstr.Replace("/", "\\"); return argstr; } } }
using System; using System.Text.RegularExpressions; namespace GitWrap { public class PathConverter { public static string convertPathFromWindowsToLinux(String path) { // Translate directory structure. // Use regex to translate drive letters. string pattern = @"(\D):\\"; string argstr = path; foreach (Match match in Regex.Matches(path, pattern, RegexOptions.IgnoreCase)) { string driveLetter = match.Groups[1].ToString(); argstr = Regex.Replace(path, pattern, "/mnt/" + driveLetter.ToLower() + "/"); } // Convert Windows path to Linux style paths argstr = argstr.Replace("\\", "/"); // Escape any whitespaces argstr = argstr.Replace(" ", "\\ "); // Escape parenthesis argstr = argstr.Replace("(", "\\("); argstr = argstr.Replace(")", "\\)"); return argstr; } public static string convertPathFromLinuxToWindows(String path) { string drivePathPattern = @"/mnt/(\D)/"; string argstr = path; foreach (Match match in Regex.Matches(path, drivePathPattern, RegexOptions.None)) { string driveLetter = match.Groups[1].ToString(); argstr = Regex.Replace(path, drivePathPattern, driveLetter.ToUpper() + ":\\"); // Convert Linux style path separators to Windows style equivalent argstr = argstr.Replace("/", "\\"); } argstr = argstr.Replace("/", "\\"); return argstr; } } }
mit
C#
6170415c275de5c1a8cd53005479f7144d81867b
Update comment.
AmadeusW/roslyn,weltkante/roslyn,tmat/roslyn,wvdd007/roslyn,KirillOsenkov/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn,reaction1989/roslyn,sharwell/roslyn,heejaechang/roslyn,diryboy/roslyn,ErikSchierboom/roslyn,genlu/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,mgoertz-msft/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,panopticoncentral/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,brettfo/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,dotnet/roslyn,genlu/roslyn,eriawan/roslyn,tmat/roslyn,mavasani/roslyn,gafter/roslyn,stephentoub/roslyn,ErikSchierboom/roslyn,jmarolf/roslyn,tannergooding/roslyn,reaction1989/roslyn,AmadeusW/roslyn,bartdesmet/roslyn,tannergooding/roslyn,weltkante/roslyn,wvdd007/roslyn,brettfo/roslyn,mgoertz-msft/roslyn,physhi/roslyn,gafter/roslyn,tmat/roslyn,davkean/roslyn,reaction1989/roslyn,AmadeusW/roslyn,davkean/roslyn,shyamnamboodiripad/roslyn,tannergooding/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,heejaechang/roslyn,brettfo/roslyn,eriawan/roslyn,panopticoncentral/roslyn,davkean/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,mavasani/roslyn,stephentoub/roslyn,KirillOsenkov/roslyn,physhi/roslyn,sharwell/roslyn,weltkante/roslyn,jmarolf/roslyn,dotnet/roslyn,diryboy/roslyn,heejaechang/roslyn,genlu/roslyn,aelij/roslyn,jmarolf/roslyn,eriawan/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,jasonmalinowski/roslyn,aelij/roslyn,wvdd007/roslyn,gafter/roslyn,diryboy/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,physhi/roslyn
src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Controller_InvokeSignatureHelp.cs
src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Controller_InvokeSignatureHelp.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.CodeAnalysis.SignatureHelp; using Microsoft.VisualStudio.Commanding; using Microsoft.VisualStudio.Text.Editor.Commanding.Commands; using VSCommanding = Microsoft.VisualStudio.Commanding; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp { internal partial class Controller { VSCommanding.CommandState IChainedCommandHandler<InvokeSignatureHelpCommandArgs>.GetCommandState(InvokeSignatureHelpCommandArgs args, Func<VSCommanding.CommandState> nextHandler) { AssertIsForeground(); return nextHandler(); } void IChainedCommandHandler<InvokeSignatureHelpCommandArgs>.ExecuteCommand(InvokeSignatureHelpCommandArgs args, Action nextHandler, CommandExecutionContext context) { AssertIsForeground(); DismissSessionIfActive(); var providers = GetProviders(); if (providers == null) { return; } // Dismiss any Completion sessions when Signature Help is explicitly invoked. // There are cases when both show up implicitly, for example in argument lists // when the user types the `(`. If both are showing and the user explicitly // invokes Signature Help, they are requesting that the Signature Help control // be the focused one. Closing an existing Completion session accomplishes this. _completionBroker.GetSession(args.TextView)?.Dismiss(); this.StartSession(providers, new SignatureHelpTriggerInfo(SignatureHelpTriggerReason.InvokeSignatureHelpCommand)); } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.CodeAnalysis.SignatureHelp; using Microsoft.VisualStudio.Commanding; using Microsoft.VisualStudio.Text.Editor.Commanding.Commands; using VSCommanding = Microsoft.VisualStudio.Commanding; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp { internal partial class Controller { VSCommanding.CommandState IChainedCommandHandler<InvokeSignatureHelpCommandArgs>.GetCommandState(InvokeSignatureHelpCommandArgs args, Func<VSCommanding.CommandState> nextHandler) { AssertIsForeground(); return nextHandler(); } void IChainedCommandHandler<InvokeSignatureHelpCommandArgs>.ExecuteCommand(InvokeSignatureHelpCommandArgs args, Action nextHandler, CommandExecutionContext context) { AssertIsForeground(); DismissSessionIfActive(); var providers = GetProviders(); if (providers == null) { return; } // Dismiss any completion sessions when Signature Help is explicitly invoked. The // primary motivation for this behavior is when both Signature Help and Completion // are activated at the same time, for example in argument lists. _completionBroker.GetSession(args.TextView)?.Dismiss(); this.StartSession(providers, new SignatureHelpTriggerInfo(SignatureHelpTriggerReason.InvokeSignatureHelpCommand)); } } }
mit
C#
c5a2dedc442fd522877efe9b447db4326624fddf
Allow capital A/An too.
EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an
WikipediaAvsAnTrieExtractor/RegexTextUtils.ExtractWordsAfterAOrAn.cs
WikipediaAvsAnTrieExtractor/RegexTextUtils.ExtractWordsAfterAOrAn.cs
using System.Text.RegularExpressions; using System.Linq; using System; using System.Collections.Generic; namespace WikipediaAvsAnTrieExtractor { public partial class RegexTextUtils { //Note: regexes are NOT static and shared because of... http://stackoverflow.com/questions/7585087/multithreaded-use-of-regex //This code is bottlenecked by regexes, so this really matters, here. readonly Regex followingAn = new Regex(@"\b(?<article>[Aa]n?) [\(""'“‘-]*(?<word>\S+)", RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant); public IEnumerable<AvsAnSighting> ExtractWordsPrecededByAOrAn(string text) { return from Match m in followingAn.Matches(text) select new AvsAnSighting { Word = m.Groups["word"].Value + " ", PrecededByAn = m.Groups["article"].Value.Length == 2 }; } } }
using System.Text.RegularExpressions; using System.Linq; using System; using System.Collections.Generic; namespace WikipediaAvsAnTrieExtractor { public partial class RegexTextUtils { //Note: regexes are NOT static and shared because of... http://stackoverflow.com/questions/7585087/multithreaded-use-of-regex //This code is bottlenecked by regexes, so this really matters, here. readonly Regex followingAn = new Regex(@"\b(?<article>a|an) [\(""'“‘-]?(?<word>\S+)", RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant); public IEnumerable<AvsAnSighting> ExtractWordsPrecededByAOrAn(string text) { return from Match m in followingAn.Matches(text) select new AvsAnSighting { Word = m.Groups["word"].Value + " ", PrecededByAn = m.Groups["article"].Value.Length == 2 }; } } }
apache-2.0
C#
f92fb1598463cf52a5b91e67044a9cc7630ba92b
Make operation cancelable
AmadeusW/roslyn,bartdesmet/roslyn,eriawan/roslyn,diryboy/roslyn,bartdesmet/roslyn,physhi/roslyn,AmadeusW/roslyn,wvdd007/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,wvdd007/roslyn,weltkante/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,AmadeusW/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,sharwell/roslyn,KevinRansom/roslyn,dotnet/roslyn,physhi/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,diryboy/roslyn,mavasani/roslyn,KevinRansom/roslyn,sharwell/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,mavasani/roslyn,eriawan/roslyn,KevinRansom/roslyn
src/VisualStudio/Core/Def/ExternalAccess/ProjectSystem/Api/IProjectSystemUpdateReferenceOperation.cs
src/VisualStudio/Core/Def/ExternalAccess/ProjectSystem/Api/IProjectSystemUpdateReferenceOperation.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.Threading; using System.Threading.Tasks; namespace Microsoft.VisualStudio.LanguageServices.ExternalAccess.ProjectSystem.Api { internal interface IProjectSystemUpdateReferenceOperation { /// <summary> /// Applies a reference update operation to the project file. /// </summary> /// <returns>A boolean indicating success.</returns> /// <remarks>Throws <see cref="InvalidOperationException"/> if operation has already been applied.</remarks> Task<bool> ApplyAsync(CancellationToken cancellationToken); /// <summary> /// Reverts a reference update operation to the project file. /// </summary> /// <returns>A boolean indicating success.</returns> /// <remarks>Throws <see cref="InvalidOperationException"/> if operation has not been applied.</remarks> Task<bool> RevertAsync(CancellationToken cancellationToken); } }
// 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.Threading.Tasks; namespace Microsoft.VisualStudio.LanguageServices.ExternalAccess.ProjectSystem.Api { internal interface IProjectSystemUpdateReferenceOperation { /// <summary> /// Applies a reference update operation to the project file. /// </summary> /// <returns>A boolean indicating success.</returns> /// <remarks>Throws <see cref="InvalidOperationException"/> if operation has already been applied.</remarks> Task<bool> ApplyAsync(); /// <summary> /// Reverts a reference update operation to the project file. /// </summary> /// <returns>A boolean indicating success.</returns> /// <remarks>Throws <see cref="InvalidOperationException"/> if operation has not been applied.</remarks> Task<bool> RevertAsync(); } }
mit
C#
08362b29a6410162aafc657dfa62f14e0017de8a
fix codefactor
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Controls/WalletExplorer/AddressMoneyTuple.cs
WalletWasabi.Gui/Controls/WalletExplorer/AddressMoneyTuple.cs
using NBitcoin; using System; namespace WalletWasabi.Gui.Controls.WalletExplorer { public struct AddressMoneyTuple : IEquatable<AddressMoneyTuple> { public AddressMoneyTuple(string address = null, Money amount = null, bool isEmpty = true) { Address = address; Amount = amount; IsEmpty = isEmpty; } public static AddressMoneyTuple Empty { get; } = new AddressMoneyTuple(); public string Address { get; } public Money Amount { get; } private bool IsEmpty { get; } public static bool operator ==(AddressMoneyTuple x, AddressMoneyTuple y) => x.Equals(y); public static bool operator !=(AddressMoneyTuple x, AddressMoneyTuple y) => !(x == y); public bool Equals(AddressMoneyTuple other) { return this.IsEmpty == other.IsEmpty && this.Amount == other.Amount && this.Address == other.Address; } public override bool Equals(object obj) { return base.Equals(obj); } } }
using NBitcoin; using System; namespace WalletWasabi.Gui.Controls.WalletExplorer { public struct AddressMoneyTuple : IEquatable<AddressMoneyTuple> { public AddressMoneyTuple(string address = null, Money amount = null, bool isEmpty = true) { Address = address; Amount = amount; IsEmpty = isEmpty; } public string Address { get; } public Money Amount { get; } private bool IsEmpty { get; } public static AddressMoneyTuple Empty { get; } = new AddressMoneyTuple(); public static bool operator ==(AddressMoneyTuple x, AddressMoneyTuple y) => x.Equals(y); public static bool operator !=(AddressMoneyTuple x, AddressMoneyTuple y) => !(x == y); public bool Equals(AddressMoneyTuple other) { return this.IsEmpty == other.IsEmpty && this.Amount == other.Amount && this.Address == other.Address; } } }
mit
C#
977afee0f07b9008a91252311dea937cbb67130e
Improve Adding comments
KristianMariyanov/LaptopListingSystem,KristianMariyanov/LaptopListingSystem,KristianMariyanov/LaptopListingSystem,KristianMariyanov/LaptopListingSystem
Web/LaptopListingSystem.Web/Controllers/CommentsController.cs
Web/LaptopListingSystem.Web/Controllers/CommentsController.cs
namespace LaptopListingSystem.Web.Controllers { using System.Linq; using System.Security.Claims; using LaptopListingSystem.Data.Models; using LaptopListingSystem.Data.Repositories.Contracts; using LaptopListingSystem.Web.InputModels.Comments; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; [Authorize] [Route("api/[controller]")] public class CommentsController : Controller { private readonly IDeletableEntityRepository<Comment> comments; private readonly IDeletableEntityRepository<User> users; public CommentsController( IDeletableEntityRepository<Comment> comments, IDeletableEntityRepository<User> users) { this.comments = comments; this.users = users; } [HttpPost] public IActionResult Post(CommentInputModel inputModel) { if (inputModel != null && this.ModelState.IsValid) { var userName = this.User.FindFirstValue(ClaimTypes.NameIdentifier); var userId = this.users.All().Where(u => u.UserName == userName).Select(u => u.Id).FirstOrDefault(); var comment = new Comment { Content = inputModel.Content, LaptopId = inputModel.LaptopId, UserId = userId }; this.comments.Add(comment); this.comments.SaveChanges(); // We don't have view of single comments return this.Created(string.Empty, comment); } return this.BadRequest("Invalid input"); } } }
namespace LaptopListingSystem.Web.Controllers { using LaptopListingSystem.Data.Models; using LaptopListingSystem.Data.Repositories.Contracts; using LaptopListingSystem.Web.InputModels.Comments; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; [Authorize] [Route("api/[controller]")] public class CommentsController : Controller { private readonly IDeletableEntityRepository<Comment> comments; public CommentsController(IDeletableEntityRepository<Comment> comments) { this.comments = comments; } [HttpPost] public IActionResult Post(CommentInputModel inputModel) { if (inputModel != null && this.ModelState.IsValid) { // TODO: get user var comment = new Comment { Content = inputModel.Content, LaptopId = inputModel.LaptopId }; this.comments.Add(comment); // We don't have view of single comments return this.Created(string.Empty, comment); } return this.BadRequest("Invalid input"); } } }
mit
C#
a3b803fe93cd5feca298f63ba5b17f3f3d906e31
Fix compile error in WPF .NET Core sample
Deadpikle/NetSparkle,Deadpikle/NetSparkle
src/NetSparkle.Samples.NetCore.WPF/MainWindow.xaml.cs
src/NetSparkle.Samples.NetCore.WPF/MainWindow.xaml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace NetSparkle.Samples.NetCore.WPF { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private Sparkle _sparkle; public MainWindow() { InitializeComponent(); // remove the netsparkle key from registry try { Microsoft.Win32.Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\NetSparkle.TestAppNetCoreWPF"); } catch { } // set icon in project properties! string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName; var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName); _sparkle = new Sparkle("https://deadpikle.github.io/NetSparkle/files/sample-app/appcast.xml") { UIFactory = new NetSparkle.UI.WPF.UIFactory(NetSparkle.UI.WPF.IconUtilities.ToImageSource(icon)), ShowsUIOnMainThread = false //UseNotificationToast = true }; // TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/) _sparkle.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12; _sparkle.StartLoop(true, true); } private void ManualUpdateCheck_Click(object sender, RoutedEventArgs e) { _sparkle.CheckForUpdatesAtUserRequest(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace NetSparkle.Samples.NetCore.WPF { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private Sparkle _sparkle; public MainWindow() { InitializeComponent(); // remove the netsparkle key from registry try { Microsoft.Win32.Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\NetSparkle.TestAppNetCoreWPF"); } catch { } // set icon in project properties! string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName; var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName); _sparkle = new Sparkle("https://deadpikle.github.io/NetSparkle/files/sample-app/appcast.xml") { UIFactory = new NetSparkle.UI.WPF.UIFactory(NetSparkle.UI.WPF.IconUtilities.ToImageSource(icon)), ShowsUIOnMainThread = false //UseNotificationToast = true }; // TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/) _sparkle.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12; _sparkle.StartLoop(true, true); } /// <summary> /// Convert System.Drawing.Icon to System.Windows.Media.ImageSource. /// From: https://stackoverflow.com/a/6580799/3938401 /// </summary> /// <param name="icon"></param> /// <returns></returns> public static ImageSource ToImageSource(System.Drawing.Icon icon) { if (icon == null) { return null; } return imageSource; } private void ManualUpdateCheck_Click(object sender, RoutedEventArgs e) { _sparkle.CheckForUpdatesAtUserRequest(); } } }
mit
C#
f959ca05031ee6a502e1d57168da28ab79739bc1
Rebuild deds for reference data collections
SkillsFundingAgency/das-paymentsacceptancetesting
src/SFA.DAS.Payments.AcceptanceTests/SpecFlowHooks.cs
src/SFA.DAS.Payments.AcceptanceTests/SpecFlowHooks.cs
using System; using ProviderPayments.TestStack.Core; using SFA.DAS.Payments.AcceptanceTests.DataHelpers; using SFA.DAS.Payments.AcceptanceTests.ExecutionEnvironment; using TechTalk.SpecFlow; namespace SFA.DAS.Payments.AcceptanceTests { [Binding] public static class SpecFlowHooks { internal static string RunId { get; private set; } [BeforeTestRun] public static void PrepareTestRun() { RunId = IdentifierGenerator.GenerateIdentifier(12); AcceptanceTestDataHelper.CreateTestRun(RunId, DateTime.Now, Environment.MachineName, EnvironmentVariablesFactory.GetEnvironmentVariables()); } [BeforeTestRun] public static void PrepateDeds() { var processService = new ProcessService(new TestLogger()); var environmentVariables = EnvironmentVariablesFactory.GetEnvironmentVariables(); processService.RebuildDedsDatabase(ComponentType.DataLockSubmission, environmentVariables); processService.RebuildDedsDatabase(ComponentType.DataLockPeriodEnd, environmentVariables); processService.RebuildDedsDatabase(ComponentType.EarningsCalculator, environmentVariables); processService.RebuildDedsDatabase(ComponentType.PaymentsDue, environmentVariables); processService.RebuildDedsDatabase(ComponentType.LevyCalculator, environmentVariables); processService.RebuildDedsDatabase(ComponentType.CoInvestedPayments, environmentVariables); processService.RebuildDedsDatabase(ComponentType.ReferenceCommitments, environmentVariables); processService.RebuildDedsDatabase(ComponentType.ReferenceAccounts, environmentVariables); } [BeforeScenario] public static void ClearCollectionPeriodMapping() { var environmentVariables = EnvironmentVariablesFactory.GetEnvironmentVariables(); AcceptanceTestDataHelper.ClearCollectionPeriodMapping(environmentVariables); } [BeforeScenario] public static void ClearOldStuff() { var environmentVariables = EnvironmentVariablesFactory.GetEnvironmentVariables(); AcceptanceTestDataHelper.ClearOldDedsIlrSubmissions(environmentVariables); } [BeforeScenario] public static void Start() { Console.WriteLine("Start: " + DateTime.Now.ToString()); } [AfterScenario] public static void Finish() { Console.WriteLine("Finish: " + DateTime.Now.ToString()); } } }
using System; using ProviderPayments.TestStack.Core; using SFA.DAS.Payments.AcceptanceTests.DataHelpers; using SFA.DAS.Payments.AcceptanceTests.ExecutionEnvironment; using TechTalk.SpecFlow; namespace SFA.DAS.Payments.AcceptanceTests { [Binding] public static class SpecFlowHooks { internal static string RunId { get; private set; } [BeforeTestRun] public static void PrepareTestRun() { RunId = IdentifierGenerator.GenerateIdentifier(12); AcceptanceTestDataHelper.CreateTestRun(RunId, DateTime.Now, Environment.MachineName, EnvironmentVariablesFactory.GetEnvironmentVariables()); } [BeforeTestRun] public static void PrepateDeds() { var processService = new ProcessService(new TestLogger()); var environmentVariables = EnvironmentVariablesFactory.GetEnvironmentVariables(); processService.RebuildDedsDatabase(ComponentType.DataLockSubmission, environmentVariables); processService.RebuildDedsDatabase(ComponentType.DataLockPeriodEnd, environmentVariables); processService.RebuildDedsDatabase(ComponentType.EarningsCalculator, environmentVariables); processService.RebuildDedsDatabase(ComponentType.PaymentsDue, environmentVariables); processService.RebuildDedsDatabase(ComponentType.LevyCalculator, environmentVariables); processService.RebuildDedsDatabase(ComponentType.CoInvestedPayments, environmentVariables); } [BeforeScenario] public static void ClearCollectionPeriodMapping() { var environmentVariables = EnvironmentVariablesFactory.GetEnvironmentVariables(); AcceptanceTestDataHelper.ClearCollectionPeriodMapping(environmentVariables); } [BeforeScenario] public static void ClearOldStuff() { var environmentVariables = EnvironmentVariablesFactory.GetEnvironmentVariables(); AcceptanceTestDataHelper.ClearOldDedsIlrSubmissions(environmentVariables); } [BeforeScenario] public static void Start() { Console.WriteLine("Start: " + DateTime.Now.ToString()); } [AfterScenario] public static void Finish() { Console.WriteLine("Finish: " + DateTime.Now.ToString()); } } }
mit
C#
46e6333a6a3d81fa300f9824da39180cab3d4c2c
Add SQLiteDatabase unit tests
lecaillon/Evolve
test/Evolve.Test/Dialect/SQLite/SQLiteDatabaseTest.cs
test/Evolve.Test/Dialect/SQLite/SQLiteDatabaseTest.cs
using Evolve.Dialect.SQLite; using Xunit; namespace Evolve.Test.Dialect.SQLite { public class SQLiteDatabaseTest { [Fact(DisplayName = "SQLiteDatabase_name_is_sqlite")] public void SQLiteDatabase_name_is_sqlite() { using (var connection = TestUtil.GetInMemorySQLiteWrappedConnection()) { var db = new SQLiteDatabase(connection); Assert.Equal("sqlite", db.DatabaseName); } } [Fact(DisplayName = "GetCurrentSchemaName_is_always_main")] public void GetCurrentSchemaName_is_always_main() { using (var connection = TestUtil.GetInMemorySQLiteWrappedConnection()) { var db = new SQLiteDatabase(connection); Assert.Equal("main", db.GetCurrentSchemaName()); } } [Fact(DisplayName = "ChangeSchema_always_returns_main")] public void ChangeSchema_always_returns_main() { using (var connection = TestUtil.GetInMemorySQLiteWrappedConnection()) { var db = new SQLiteDatabase(connection); var schema = db.ChangeSchema("another_shema"); Assert.NotNull(schema); Assert.Equal("main", schema.Name); } } [Fact(DisplayName = "GetMetadataTable_works")] public void GetMetadataTable_works() { using (var connection = TestUtil.GetInMemorySQLiteWrappedConnection()) { var db = new SQLiteDatabase(connection); var metadataTable = db.GetMetadataTable("main", TestContext.DefaultMetadataTableName); Assert.NotNull(metadataTable); Assert.True(metadataTable.CreateIfNotExists()); } } } }
using Evolve.Dialect.SQLite; using Xunit; namespace Evolve.Test.Dialect.SQLite { public class SQLiteDatabaseTest { [Fact(DisplayName = "SQLiteDatabase_name_is_sqlite")] public void SQLiteDatabase_name_is_sqlite() { using (var connection = TestUtil.GetInMemorySQLiteWrappedConnection()) { var db = new SQLiteDatabase(connection); Assert.Equal("sqlite", db.DatabaseName); } } } }
mit
C#
6b0ade427a8d2e13178bceaf8484b9dff3055407
bump version to 2.0.1
Sevitec/oneoffixx-connectclient
Windows/src/OneOffixx.ConnectClient.WinApp/Properties/AssemblyInfo.cs
Windows/src/OneOffixx.ConnectClient.WinApp/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OneOffixx Connect Client")] [assembly: AssemblyDescription("Test Client for OneOffixx Connect")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Sevitec Informatik AG")] [assembly: AssemblyProduct("OneOffixx.ConnectClient.WinApp")] [assembly: AssemblyCopyright("Copyright © Sevitec Informatik AG 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.1.0")] [assembly: AssemblyFileVersion("2.0.1.0")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OneOffixx Connect Client")] [assembly: AssemblyDescription("Test Client for OneOffixx Connect")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Sevitec Informatik AG")] [assembly: AssemblyProduct("OneOffixx.ConnectClient.WinApp")] [assembly: AssemblyCopyright("Copyright © Sevitec Informatik AG 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")]
mit
C#
250feae9325849809ce41c373ff88e29f175bb7f
clone the request's headers
clement911/ShopifySharp,nozzlegear/ShopifySharp,addsb/ShopifySharp
ShopifySharp/Infrastructure/CloneableRequestMessage.cs
ShopifySharp/Infrastructure/CloneableRequestMessage.cs
using System; using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Threading.Tasks; namespace ShopifySharp.Infrastructure { public class CloneableRequestMessage : HttpRequestMessage { public CloneableRequestMessage(Uri url, HttpMethod method, HttpContent content = null) : base(method, url) { if (content != null) { this.Content = content; } } public CloneableRequestMessage Clone() { HttpContent newContent = Content; if (newContent != null && newContent is JsonContent c) { newContent = c.Clone(); } var cloned = new CloneableRequestMessage(RequestUri, Method, newContent); // Copy over the request's headers which includes the access token if set foreach (var header in Headers) { cloned.Headers.Add(header.Key, header.Value); } return cloned; } } }
using System; using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Threading.Tasks; namespace ShopifySharp.Infrastructure { public class CloneableRequestMessage : HttpRequestMessage { public CloneableRequestMessage(Uri url, HttpMethod method, HttpContent content = null) : base(method, url) { if (content != null) { this.Content = content; } } public CloneableRequestMessage Clone() { HttpContent newContent = Content; if (newContent != null && newContent is JsonContent c) { newContent = c.Clone(); } return new CloneableRequestMessage(RequestUri, Method, newContent); } } }
mit
C#
adcb2d43034d7ccc0553c5270fda02681d1c759d
Bump dev version to 0.10
fadookie/monodevelop-justenoughvi,hifi/monodevelop-justenoughvi
JustEnoughVi/Properties/AddinInfo.cs
JustEnoughVi/Properties/AddinInfo.cs
using Mono.Addins; using Mono.Addins.Description; [assembly: Addin( "JustEnoughVi", Namespace = "JustEnoughVi", Version = "0.10" )] [assembly: AddinName("Just Enough Vi")] [assembly: AddinCategory("IDE extensions")] [assembly: AddinDescription("Simplified Vi/Vim mode for MonoDevelop/Xamarin Studio.")] [assembly: AddinAuthor("Toni Spets")]
using Mono.Addins; using Mono.Addins.Description; [assembly: Addin( "JustEnoughVi", Namespace = "JustEnoughVi", Version = "0.9" )] [assembly: AddinName("Just Enough Vi")] [assembly: AddinCategory("IDE extensions")] [assembly: AddinDescription("Simplified Vi/Vim mode for MonoDevelop/Xamarin Studio.")] [assembly: AddinAuthor("Toni Spets")]
mit
C#
e1bb6df606d5144b812eb5f403e4964348b9b99c
Increment assembly version number.
feliperomero3/MVVMSandbox
MicroMvvm/Properties/AssemblyInfo.cs
MicroMvvm/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("MicroMvvm")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MicroMvvm")] [assembly: AssemblyCopyright("Copyright © 2011")] [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("67a8f9a0-e0d6-434f-89d9-6404883a9732")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")]
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("MicroMvvm")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MicroMvvm")] [assembly: AssemblyCopyright("Copyright © 2011")] [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("67a8f9a0-e0d6-434f-89d9-6404883a9732")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
f4ab62daff728c0b2f96beecdb4160d0a2d47cc0
Fix normal InvalidOp exceptions (not model exceptions) being swallowed
kamsar/Synthesis,roberthardy/Synthesis
Source/Synthesis.Mvc/Pipelines/GetRenderer/ResilientGetViewRenderer.cs
Source/Synthesis.Mvc/Pipelines/GetRenderer/ResilientGetViewRenderer.cs
using System; using System.IO; using System.Web.UI; using Sitecore; using Sitecore.Mvc.Pipelines.Response.GetRenderer; using Sitecore.Mvc.Presentation; namespace Synthesis.Mvc.Pipelines.GetRenderer { /// <summary> /// Errors in model type no longer explode the whole page, instead showing a warning to preview/editors /// /// This prevents view renderings with invalid or lacking data sources from causing major problems. /// </summary> public class ResilientGetViewRenderer : GetViewRenderer { protected override Renderer GetRenderer(Rendering rendering, GetRendererArgs args) { var baseResult = (ViewRenderer)base.GetRenderer(rendering, args); return new ResilientViewRenderer { ViewPath = baseResult.ViewPath, Rendering = baseResult.Rendering }; } protected class ResilientViewRenderer : ViewRenderer { // prevent exceptions in rendering caused by invalid model types from exploding the whole page public override void Render(TextWriter writer) { try { base.Render(writer); } catch (InvalidOperationException ioe) { if (ioe.InnerException != null && ioe.InnerException.Message.StartsWith("The model item passed into the dictionary is of type")) { if (Context.PageMode.IsPreview || Context.PageMode.IsPageEditor) { NullModelHelper.RenderNullModelMessage(new HtmlTextWriter(writer), ViewPath, Rendering.DataSource, new ViewModelTypeResolver().GetViewModelType(ViewPath), Rendering.Model); } return; } throw; } } } } }
using System; using System.IO; using System.Web.UI; using Sitecore; using Sitecore.Mvc.Pipelines.Response.GetRenderer; using Sitecore.Mvc.Presentation; namespace Synthesis.Mvc.Pipelines.GetRenderer { /// <summary> /// Errors in model type no longer explode the whole page, instead showing a warning to preview/editors /// /// This prevents view renderings with invalid or lacking data sources from causing major problems. /// </summary> public class ResilientGetViewRenderer : GetViewRenderer { protected override Renderer GetRenderer(Rendering rendering, GetRendererArgs args) { var baseResult = (ViewRenderer)base.GetRenderer(rendering, args); return new ResilientViewRenderer { ViewPath = baseResult.ViewPath, Rendering = baseResult.Rendering }; } protected class ResilientViewRenderer : ViewRenderer { // prevent exceptions in rendering caused by invalid model types from exploding the whole page public override void Render(TextWriter writer) { try { base.Render(writer); } catch (InvalidOperationException ioe) { if (ioe.InnerException != null && ioe.InnerException.Message.StartsWith("The model item passed into the dictionary is of type")) { if (Context.PageMode.IsPreview || Context.PageMode.IsPageEditor) { NullModelHelper.RenderNullModelMessage(new HtmlTextWriter(writer), ViewPath, Rendering.DataSource, new ViewModelTypeResolver().GetViewModelType(ViewPath), Rendering.Model); } } } } } } }
mit
C#
3cfb2f779df1a56df99883e2bbd5d66a56c32562
Add some empty code to InterControlAnimation
DanieleScipioni/TestApp
TestAppUWP/Samples/InterControlAnimation/InterControlAnimation.xaml.cs
TestAppUWP/Samples/InterControlAnimation/InterControlAnimation.xaml.cs
using Windows.UI.Xaml; namespace TestAppUWP.Samples.InterControlAnimation { public sealed partial class InterControlAnimation { private static Control2 _control2; private static Control1 _control1; public InterControlAnimation() { InitializeComponent(); ContentPresenter.Content = new Control1(); } private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { var changeControlAnimation = new ChangeControlAnimation(); ContentPresenter.Content = ContentPresenter.Content is Control1 ? (object) GetControl2() : GetControl1(); } private static Control1 GetControl1() { return _control1 ?? (_control1 = new Control1()); } private static Control2 GetControl2() { return _control2 ?? (_control2 = new Control2()); } } public class ChangeControlAnimation { } }
using Windows.UI.Xaml; namespace TestAppUWP.Samples.InterControlAnimation { public sealed partial class InterControlAnimation { private static Control2 _control2; private static Control1 _control1; public InterControlAnimation() { InitializeComponent(); ContentPresenter.Content = new Control1(); } private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { ContentPresenter.Content = ContentPresenter.Content is Control1 ? (object) GetControl2() : GetControl1(); } private static Control1 GetControl1() { return _control1 ?? (_control1 = new Control1()); } private static Control2 GetControl2() { return _control2 ?? (_control2 = new Control2()); } } }
mit
C#
c6c7d3781d71fb52ad81fee49b5b3ec04b22589d
Fix broken build
cdmdotnet/CQRS,Chinchilla-Software-Com/CQRS
Framework/Ninject/Azure/Cqrs.Ninject.Azure.ServiceBus.CommandBus/Configuration/AzureQueuedCommandBusReceiverModule.cs
Framework/Ninject/Azure/Cqrs.Ninject.Azure.ServiceBus.CommandBus/Configuration/AzureQueuedCommandBusReceiverModule.cs
using System.Linq; using Cqrs.Azure.ServiceBus; namespace Cqrs.Ninject.Azure.ServiceBus.CommandBus.Configuration { public class AzureQueuedCommandBusReceiverModule<TAuthenticationToken> : AzureCommandBusReceiverModule<TAuthenticationToken> { /// <summary> /// Loads the module into the kernel. /// </summary> public override void Load() { bool isMessageSerialiserBound = Kernel.GetBindings(typeof(IAzureBusHelper<TAuthenticationToken>)).Any(); if (!isMessageSerialiserBound) { Bind<IAzureBusHelper<TAuthenticationToken>>() .To<AzureBusHelper<TAuthenticationToken>>() .InSingletonScope(); } var bus = GetOrCreateBus<AzureQueuedCommandBusReceiver<TAuthenticationToken>>(); RegisterCommandReceiver(bus); RegisterCommandHandlerRegistrar(bus); RegisterCommandMessageSerialiser(); } } }
using Cqrs.Azure.ServiceBus; using Cqrs.Bus; namespace Cqrs.Ninject.Azure.ServiceBus.CommandBus.Configuration { public class AzureQueuedCommandBusReceiverModule<TAuthenticationToken> : AzureCommandBusReceiverModule<TAuthenticationToken> { public override void RegisterCommandHandlerRegistrar() { Bind<ICommandHandlerRegistrar>() .To<AzureQueuedCommandBusReceiver<TAuthenticationToken>>() .InSingletonScope(); } } }
lgpl-2.1
C#
560bad9a1eb72e332dce4b9d93786d0e8cb09b4c
Remove unnecessary setters.
OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn
src/OmniSharp.Abstractions/Models/v2/CodeActions/ICodeActionRequest.cs
src/OmniSharp.Abstractions/Models/v2/CodeActions/ICodeActionRequest.cs
using Newtonsoft.Json; namespace OmniSharp.Models.V2.CodeActions { public interface ICodeActionRequest { [JsonConverter(typeof(ZeroBasedIndexConverter))] int Line { get; } [JsonConverter(typeof(ZeroBasedIndexConverter))] int Column { get; } string Buffer { get; } string FileName { get; } Range Selection { get; } ICodeActionRequest WithSelection(Range newSelection); } }
using Newtonsoft.Json; namespace OmniSharp.Models.V2.CodeActions { public interface ICodeActionRequest { [JsonConverter(typeof(ZeroBasedIndexConverter))] int Line { get; set; } [JsonConverter(typeof(ZeroBasedIndexConverter))] int Column { get; set; } string Buffer { get; set; } string FileName { get; set; } Range Selection { get; set; } ICodeActionRequest WithSelection(Range newSelection); } }
mit
C#
f6d1f997f29d46a2959b7ef93d51d2cd2dbcbc6b
Remove double semicolon (#800)
fluentassertions/fluentassertions,dennisdoomen/fluentassertions,fluentassertions/fluentassertions,dennisdoomen/fluentassertions,jnyrup/fluentassertions,jnyrup/fluentassertions
Src/FluentAssertions/Equivalency/EquivalencyAssertionOptionsExtentions.cs
Src/FluentAssertions/Equivalency/EquivalencyAssertionOptionsExtentions.cs
using System; using System.Linq; using System.Reflection; namespace FluentAssertions.Equivalency { public static class EquivalencyAssertionOptionsExtentions { /// <summary> /// Returns either the run-time or compile-time type of the subject based on the options provided by the caller. /// </summary> /// <remarks> /// If the expectation is a nullable type, it should return the type of the wrapped object. /// </remarks> public static Type GetExpectationType(this IEquivalencyAssertionOptions config, IMemberInfo context) { Type type = config.UseRuntimeTyping ? context.RuntimeType : context.CompileTimeType; return NullableOrActualType(type); } private static Type NullableOrActualType(Type type) { if (type.IsConstructedGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) { type = type.GetGenericArguments().First(); } return type; } } }
using System; using System.Linq; using System.Reflection; namespace FluentAssertions.Equivalency { public static class EquivalencyAssertionOptionsExtentions { /// <summary> /// Returns either the run-time or compile-time type of the subject based on the options provided by the caller. /// </summary> /// <remarks> /// If the expectation is a nullable type, it should return the type of the wrapped object. /// </remarks> public static Type GetExpectationType(this IEquivalencyAssertionOptions config, IMemberInfo context) { Type type = config.UseRuntimeTyping ? context.RuntimeType : context.CompileTimeType; return NullableOrActualType(type);; } private static Type NullableOrActualType(Type type) { if (type.IsConstructedGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) { type = type.GetGenericArguments().First(); } return type; } } }
apache-2.0
C#
40a22788afa4155feff19b2f6dda2c4cd2925dc7
Fix collection rank.
ikeough/IFC-gen,ikeough/IFC-gen,ikeough/IFC-gen
src/IFC-gen/csharp/CollectionInfo.cs
src/IFC-gen/csharp/CollectionInfo.cs
using System; using System.Collections.Generic; using System.Linq; namespace Express { public enum CollectionType { Array,List,Set } public class CollectionInfo : TypeInfo { public int Rank{get;set;} public int Size{get;set;} public CollectionType CollectionType {get;set;} public CollectionInfo(string name) : base(name) { Rank = 0; } public override string ToString() { switch(CollectionType) { case CollectionType.Array: return $"{ValueType}" + string.Join("",Enumerable.Repeat($"[{Size}]",Rank)); case CollectionType.List: return $"{string.Join("",Enumerable.Repeat("List<",Rank))}{ValueType}{string.Join("",Enumerable.Repeat(">",Rank))}"; case CollectionType.Set: return $"{string.Join("",Enumerable.Repeat("List<",Rank))}{ValueType}{string.Join("",Enumerable.Repeat(">",Rank))}"; default: return "*** ERROR ***"; } } } }
using System; using System.Collections.Generic; using System.Linq; namespace Express { public enum CollectionType { Array,List,Set } public class CollectionInfo : TypeInfo { public int Rank{get;set;} public int Size{get;set;} public CollectionType CollectionType {get;set;} public CollectionInfo(string name) : base(name) { Rank = 1; } public override string ToString() { switch(CollectionType) { case CollectionType.Array: return $"{ValueType}" + string.Join("",Enumerable.Repeat("[]",Rank)); case CollectionType.List: return $"{string.Join("",Enumerable.Repeat("List<",Rank))}{ValueType}{string.Join("",Enumerable.Repeat(">",Rank))}"; case CollectionType.Set: return $"{string.Join("",Enumerable.Repeat("List<",Rank))}{ValueType}{string.Join("",Enumerable.Repeat(">",Rank))}"; default: return "*** ERROR ***"; } } } }
mit
C#
f6ada59c036735fe4cd869ffa4599f5e78b902dd
update to 1.4.4.0
Ulterius/server
RemoteTaskServer/Properties/AssemblyInfo.cs
RemoteTaskServer/Properties/AssemblyInfo.cs
#region using System.Reflection; using System.Runtime.InteropServices; #endregion // 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("Ulterius™ Server")] [assembly: AssemblyDescription("Ulterius is currently in beta, follow updates at blog.ulterius.io")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ulterius")] [assembly: AssemblyProduct("Ulterius Server")] [assembly: AssemblyCopyright("Copyright © Octopodal Solutions 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8faa6465-7d15-4c77-9b5f-d9495293a794")] // 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.4.4.0")] [assembly: AssemblyFileVersion("1.4.4.0")]
#region using System.Reflection; using System.Runtime.InteropServices; #endregion // 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("Ulterius™ Server")] [assembly: AssemblyDescription("Ulterius is currently in beta, follow updates at blog.ulterius.io")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ulterius")] [assembly: AssemblyProduct("Ulterius Server")] [assembly: AssemblyCopyright("Copyright © Octopodal Solutions 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8faa6465-7d15-4c77-9b5f-d9495293a794")] // 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.4.3.0")] [assembly: AssemblyFileVersion("1.4.3.0")]
mpl-2.0
C#
0fbddd4e1c11c38d308f436631006960bca08976
Change case for capability with js code.
beta-tank/TicTacToe,beta-tank/TicTacToe,beta-tank/TicTacToe
TicTacToe/ViewModels/TurnResultViewModel.cs
TicTacToe/ViewModels/TurnResultViewModel.cs
using TicTacToe.Core.Enums; namespace TicTacToe.Web.ViewModels { public class TurnResultViewModel { public string status { get; set; } public string errorText { get; set; } public bool isGameDone { get; set; } public PlayerCode winner { get; set; } public int opponentMove { get; set; } public TurnResultViewModel() { opponentMove = -1; } } public static class RusultStatus { public static string Error = "error"; public static string Success = "success"; } }
using TicTacToe.Core.Enums; namespace TicTacToe.Web.ViewModels { public class TurnResultViewModel { public string Status { get; set; } public string ErrorText { get; set; } public bool IsGameDone { get; set; } public PlayerCode Winner { get; set; } public byte OpponentMove { get; set; } } public static class RusultStatus { public static string Error = "error"; public static string Success = "success"; } }
mit
C#
afe80d40a6bed769baabfcfaee027b4028041893
Fix AudioPlayerTests on Linux
tombogle/libpalaso,ermshiperete/libpalaso,andrew-polk/libpalaso,gtryus/libpalaso,andrew-polk/libpalaso,gtryus/libpalaso,gmartin7/libpalaso,mccarthyrb/libpalaso,mccarthyrb/libpalaso,gtryus/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,gmartin7/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,ddaspit/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso,ddaspit/libpalaso,mccarthyrb/libpalaso,sillsdev/libpalaso,sillsdev/libpalaso,andrew-polk/libpalaso,gmartin7/libpalaso,ddaspit/libpalaso,gtryus/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso,tombogle/libpalaso,gmartin7/libpalaso,ddaspit/libpalaso,ermshiperete/libpalaso,ermshiperete/libpalaso,ermshiperete/libpalaso,andrew-polk/libpalaso
SIL.Media.Tests/AudioPlayerTests.cs
SIL.Media.Tests/AudioPlayerTests.cs
using System; using System.IO; using System.Threading; using NUnit.Framework; using SIL.IO; using SIL.Media.Tests.Properties; #if !MONO using SIL.Media.Naudio; using NAudio.Wave; #endif namespace SIL.Media.Tests { [TestFixture] public class AudioPlayerTests { [Test] public void LoadFile_ThenDispose_FileCanBeDeleted() { #if !MONO var file = TempFile.FromResource(Resources._2Channel, ".wav"); using (var player = new AudioPlayer()) { player.LoadFile(file.Path); } Assert.DoesNotThrow(() => File.Delete(file.Path)); #endif } /// <summary> /// This test shows what caused hearthis to abandon the naudio; previous to a change to this class in 2/2012, it is believed that all was ok. /// </summary> [Test, Ignore("Known to Fail (hangs forever")] public void PlayFile_ThenDispose_FileCanBeDeleted() { #if !MONO var file = TempFile.FromResource(Resources._2Channel, ".wav"); using (var player = new AudioPlayer()) { player.LoadFile(file.Path); //player.Stopped += (s, e) => { Assert.DoesNotThrow(() => File.Delete(file.Path)); }; player.StartPlaying(); var giveUpTime = DateTime.Now.AddSeconds(3); while (player.PlaybackState != PlaybackState.Stopped && DateTime.Now < giveUpTime) Thread.Sleep(100); } Assert.DoesNotThrow(() => File.Delete(file.Path)); Assert.False(File.Exists(file.Path)); #endif } } }
#if !MONO using SIL.Media.Tests.Properties; #endif using System; using System.IO; using System.Threading; using NAudio.Wave; using NUnit.Framework; using SIL.IO; using SIL.Media.Naudio; namespace SIL.Media.Tests { [TestFixture] public class AudioPlayerTests { [Test] public void LoadFile_ThenDispose_FileCanBeDeleted() { #if !MONO var file = TempFile.FromResource(Resources._2Channel, ".wav"); using (var player = new AudioPlayer()) { player.LoadFile(file.Path); } Assert.DoesNotThrow(() => File.Delete(file.Path)); #endif } /// <summary> /// This test shows what caused hearthis to abandon the naudio; previous to a change to this class in 2/2012, it is believed that all was ok. /// </summary> [Test, Ignore("Known to Fail (hangs forever")] public void PlayFile_ThenDispose_FileCanBeDeleted() { #if !MONO var file = TempFile.FromResource(Resources._2Channel, ".wav"); using (var player = new AudioPlayer()) { player.LoadFile(file.Path); //player.Stopped += (s, e) => { Assert.DoesNotThrow(() => File.Delete(file.Path)); }; player.StartPlaying(); var giveUpTime = DateTime.Now.AddSeconds(3); while (player.PlaybackState != PlaybackState.Stopped && DateTime.Now < giveUpTime) Thread.Sleep(100); } Assert.DoesNotThrow(() => File.Delete(file.Path)); Assert.False(File.Exists(file.Path)); #endif } } }
mit
C#
796b8936431efeb90e6392a69257bf6d0c9d784b
Update Index.cshtml
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Mvc/Views/Home/Index.cshtml
Anlab.Mvc/Views/Home/Index.cshtml
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: Update posted: June 10, 2020<br /><br /> We are open and receiving samples as usual.<br /><br /> Thank you for your patience over the last several months. </div> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses. </p> <p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the operation of a number of analytical methods and instruments.</p> <p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory. We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/> Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> </address> </div>
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: May 21, 2020<br /><br /> We are close to full operational status at the lab now and receiving hours will return to normal (daily 8am to 5pm) on May 26th. If you are dropping off samples at receiving and would prefer to stay outside, you can knock on the door or give Gary a call at 530-752-0266 and he will push a cart outside the door to take your samples and paperwork. We do have hand sanitizer available in the receiving area. <br /><br /> <br /><br /> Thank you for your patience during this time of changing circumstances. </div> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses. </p> <p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the operation of a number of analytical methods and instruments.</p> <p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory. We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/> Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> </address> </div>
mit
C#
f1b8686b12eac72d8cc660a6b57e0be0869183f7
Add STATUS_OPERATION_DEFERRED to JavaConsts
Ghenghis/play-games-plugin-for-unity,claywilkinson/play-games-plugin-for-unity,jkasten2/play-games-plugin-for-unity,Bvnkame/play-games-plugin-for-unity,jennifer42104/play-games-plugin-for-unity,slaosk/play-games-plugin-for-unity,UlrichAbiguime/play-games-plugin-for-unity,natsumesou/play-games-plugin-for-unity,Ghenghis/play-games-plugin-for-unity,UlrichAbiguime/play-games-plugin-for-unity,n054/play-games-plugin-for-unity,sbchuruku/play-games-plugin-for-unity,jennifer421/play-games-plugin-for-unity,MrLolicon/play-games-plugin-for-unity,MrLolicon/play-games-plugin-for-unity,Ghenghis/play-games-plugin-for-unity,SixMinute/play-games-plugin-for-unity,claywilkinson/play-games-plugin-for-unity,slaosk/play-games-plugin-for-unity,n054/play-games-plugin-for-unity,natsumesou/play-games-plugin-for-unity,jennifer42104/play-games-plugin-for-unity,jennifer42104/play-games-plugin-for-unity,sbchuruku/play-games-plugin-for-unity,UlrichAbiguime/play-games-plugin-for-unity,claywilkinson/play-games-plugin-for-unity,natsumesou/play-games-plugin-for-unity,jkasten2/play-games-plugin-for-unity,n054/play-games-plugin-for-unity,jkasten2/play-games-plugin-for-unity,jkasten2/play-games-plugin-for-unity,Bvnkame/play-games-plugin-for-unity,natsumesou/play-games-plugin-for-unity,slaosk/play-games-plugin-for-unity,SixMinute/play-games-plugin-for-unity,UlrichAbiguime/play-games-plugin-for-unity,n054/play-games-plugin-for-unity,Bvnkame/play-games-plugin-for-unity,SixMinute/play-games-plugin-for-unity,MrLolicon/play-games-plugin-for-unity,jennifer421/play-games-plugin-for-unity,jennifer421/play-games-plugin-for-unity,jennifer421/play-games-plugin-for-unity,slaosk/play-games-plugin-for-unity,Bvnkame/play-games-plugin-for-unity,SixMinute/play-games-plugin-for-unity,jennifer42104/play-games-plugin-for-unity,sbchuruku/play-games-plugin-for-unity,MrLolicon/play-games-plugin-for-unity,Ghenghis/play-games-plugin-for-unity,claywilkinson/play-games-plugin-for-unity,sbchuruku/play-games-plugin-for-unity
source/PluginDev/Assets/GooglePlayGames/Platforms/Android/JavaConsts.cs
source/PluginDev/Assets/GooglePlayGames/Platforms/Android/JavaConsts.cs
/* * Copyright (C) 2013 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #if UNITY_ANDROID using System; namespace GooglePlayGames.Android { internal class JavaConsts { // achievement states public const int STATE_HIDDEN = 2; public const int STATE_REVEALED = 1; public const int STATE_UNLOCKED = 0; // achievement types public const int TYPE_INCREMENTAL = 1; public const int TYPE_STANDARD = 0; // status codes public const int STATUS_OK = 0; public const int STATUS_STALE_DATA = 3; public const int STATUS_NO_DATA = 4; public const int STATUS_OPERATION_DEFERRED = 5; public const int STATUS_KEY_NOT_FOUND = 2002; } } #endif
/* * Copyright (C) 2013 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #if UNITY_ANDROID using System; namespace GooglePlayGames.Android { internal class JavaConsts { // achievement states public const int STATE_HIDDEN = 2; public const int STATE_REVEALED = 1; public const int STATE_UNLOCKED = 0; // achievement types public const int TYPE_INCREMENTAL = 1; public const int TYPE_STANDARD = 0; // status codes public const int STATUS_OK = 0; public const int STATUS_STALE_DATA = 3; public const int STATUS_NO_DATA = 4; public const int STATUS_KEY_NOT_FOUND = 2002; } } #endif
apache-2.0
C#
7b7651f5940f0dfd382b4ebfe43ecd6fce98227b
Set a user agent for shoutcast streams that isn't blacklisted.
Amrykid/Neptunium
src/Neptunium/Core/Media/ShoutcastStationMediaStreamer.cs
src/Neptunium/Core/Media/ShoutcastStationMediaStreamer.cs
using System; using System.Threading.Tasks; using Neptunium.Core.Stations; using Windows.Media.Playback; using Windows.Media.Core; using UWPShoutcastMSS.Streaming; namespace Neptunium.Media { internal class ShoutcastStationMediaStreamer : BasicNepAppMediaStreamer { private ShoutcastStream streamSource = null; public override void InitializePlayback(MediaPlayer player) { Player = player; Player.Source = StreamMediaSource; this.IsPlaying = true; } public override async Task TryConnectAsync(StationStream stream) { try { streamSource = await ShoutcastStreamFactory.ConnectAsync(stream.StreamUrl, new ShoutcastStreamFactoryConnectionSettings() { UserAgent = "Neptunium (http://github.com/Amrykid/Neptunium)" }); streamSource.MetadataChanged += ShoutcastStream_MetadataChanged; StreamMediaSource = MediaSource.CreateFromMediaStreamSource(streamSource.MediaStreamSource); this.StationPlaying = stream.ParentStation; } catch(Exception ex) { throw new Neptunium.Core.NeptuniumStreamConnectionFailedException(stream); } } private void ShoutcastStream_MetadataChanged(object sender, ShoutcastMediaSourceStreamMetadataChangedEventArgs e) { RaiseMetadataChanged(new Core.Media.Metadata.SongMetadata() { Artist = e.Artist, Track = e.Title, StationPlayedOn = this.StationPlaying }); } public override void Dispose() { if (streamSource != null) { streamSource.Disconnect(); streamSource.MetadataChanged -= ShoutcastStream_MetadataChanged; } base.Dispose(); } } }
using System; using System.Threading.Tasks; using Neptunium.Core.Stations; using Windows.Media.Playback; using Windows.Media.Core; using UWPShoutcastMSS.Streaming; namespace Neptunium.Media { internal class ShoutcastStationMediaStreamer : BasicNepAppMediaStreamer { private ShoutcastStream streamSource = null; public override void InitializePlayback(MediaPlayer player) { Player = player; Player.Source = StreamMediaSource; this.IsPlaying = true; } public override async Task TryConnectAsync(StationStream stream) { try { streamSource = await ShoutcastStreamFactory.ConnectAsync(stream.StreamUrl); streamSource.MetadataChanged += ShoutcastStream_MetadataChanged; StreamMediaSource = MediaSource.CreateFromMediaStreamSource(streamSource.MediaStreamSource); this.StationPlaying = stream.ParentStation; } catch(Exception ex) { throw new Neptunium.Core.NeptuniumStreamConnectionFailedException(stream); } } private void ShoutcastStream_MetadataChanged(object sender, ShoutcastMediaSourceStreamMetadataChangedEventArgs e) { RaiseMetadataChanged(new Core.Media.Metadata.SongMetadata() { Artist = e.Artist, Track = e.Title, StationPlayedOn = this.StationPlaying }); } public override void Dispose() { if (streamSource != null) { streamSource.Disconnect(); streamSource.MetadataChanged -= ShoutcastStream_MetadataChanged; } base.Dispose(); } } }
mit
C#
57c28c9f4179569a64b48d141027f8c01dfe7abd
Change access level to internal
2Toad/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp,2Toad/websocket-sharp,2Toad/websocket-sharp,2Toad/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp
websocket-sharp/Opcode.cs
websocket-sharp/Opcode.cs
#region License /* * Opcode.cs * * The MIT License * * Copyright (c) 2012-2015 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion using System; namespace WebSocketSharp { /// <summary> /// Indicates the WebSocket frame type. /// </summary> /// <remarks> /// The values of this enumeration are defined in /// <see href="http://tools.ietf.org/html/rfc6455#section-5.2">Section 5.2</see> of RFC 6455. /// </remarks> internal enum Opcode : byte { /// <summary> /// Equivalent to numeric value 0. Indicates continuation frame. /// </summary> Cont = 0x0, /// <summary> /// Equivalent to numeric value 1. Indicates text frame. /// </summary> Text = 0x1, /// <summary> /// Equivalent to numeric value 2. Indicates binary frame. /// </summary> Binary = 0x2, /// <summary> /// Equivalent to numeric value 8. Indicates connection close frame. /// </summary> Close = 0x8, /// <summary> /// Equivalent to numeric value 9. Indicates ping frame. /// </summary> Ping = 0x9, /// <summary> /// Equivalent to numeric value 10. Indicates pong frame. /// </summary> Pong = 0xa } }
#region License /* * Opcode.cs * * The MIT License * * Copyright (c) 2012-2015 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion using System; namespace WebSocketSharp { /// <summary> /// Indicates the WebSocket frame type. /// </summary> /// <remarks> /// The values of this enumeration are defined in /// <see href="http://tools.ietf.org/html/rfc6455#section-5.2">Section 5.2</see> of RFC 6455. /// </remarks> public enum Opcode : byte { /// <summary> /// Equivalent to numeric value 0. Indicates continuation frame. /// </summary> Cont = 0x0, /// <summary> /// Equivalent to numeric value 1. Indicates text frame. /// </summary> Text = 0x1, /// <summary> /// Equivalent to numeric value 2. Indicates binary frame. /// </summary> Binary = 0x2, /// <summary> /// Equivalent to numeric value 8. Indicates connection close frame. /// </summary> Close = 0x8, /// <summary> /// Equivalent to numeric value 9. Indicates ping frame. /// </summary> Ping = 0x9, /// <summary> /// Equivalent to numeric value 10. Indicates pong frame. /// </summary> Pong = 0xa } }
mit
C#
761b87ae26ed17084239c4a2bf3982cf7352a4b9
change encoding to UTF-8,
jwChung/Experimentalism,jwChung/Experimentalism
src/Experiment/GlobalSuppressions.cs
src/Experiment/GlobalSuppressions.cs
// This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. // // To add a suppression to this file, right-click the message in the // Code Analysis results, point to "Suppress Message", and click // "In Suppression File". // You do not need to add suppressions to this file manually. [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification="CI빌드에서 강력한 이름으로 assembly를 서명하기 때문에 이 경고를 무시.")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly", Justification="SemanticVersioning의 명명법을 따르기 위하여 이 경고를 무시.")]
// This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. // // To add a suppression to this file, right-click the message in the // Code Analysis results, point to "Suppress Message", and click // "In Suppression File". // You do not need to add suppressions to this file manually. [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification="CILܴ %\ tDŽ<\ assembly| X0 L8 t | 4.")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly", Justification="SemanticVersioningX D 0t0 X t | 4.")]
mit
C#
a55c6aa9c72ac8d181a267a9105e76f57fda7294
Improve ReversePath
MatterHackers/agg-sharp,larsbrubaker/agg-sharp,jlewin/agg-sharp
agg/VertexSource/ReversePath.cs
agg/VertexSource/ReversePath.cs
using MatterHackers.VectorMath; using System; //---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // C# port by: Lars Brubaker // larsbrubaker@gmail.com // Copyright (C) 2007 // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Rounded rectangle vertex generator // //---------------------------------------------------------------------------- using System.Collections.Generic; using System.Linq; namespace MatterHackers.Agg.VertexSource { public class ReversePath : VertexSourceLegacySupport { private bool convertNextToMove; public ReversePath(IVertexSource sourcePath) { SourcePath = sourcePath; } public IVertexSource SourcePath { get; } public override IEnumerable<VertexData> Vertices() { IVertexSource sourcePath = SourcePath; foreach (VertexData vertexData in sourcePath.Vertices().Reverse()) { // when we hit the initial stop. Skip it if (vertexData.IsClose || vertexData.IsStop) { if (vertexData.IsClose) { convertNextToMove = true; } continue; } if (convertNextToMove) { convertNextToMove = false; yield return new VertexData() { position = vertexData.position, command = ShapePath.FlagsAndCommand.MoveTo }; continue; } yield return vertexData; } // and send the actual stop yield return new VertexData(ShapePath.FlagsAndCommand.EndPoly | ShapePath.FlagsAndCommand.FlagClose | ShapePath.FlagsAndCommand.FlagCCW, new Vector2()); yield return new VertexData(ShapePath.FlagsAndCommand.Stop, new Vector2()); } } }
using MatterHackers.VectorMath; //---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // C# port by: Lars Brubaker // larsbrubaker@gmail.com // Copyright (C) 2007 // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Rounded rectangle vertex generator // //---------------------------------------------------------------------------- using System.Collections.Generic; namespace MatterHackers.Agg.VertexSource { public class ReversePath : VertexSourceLegacySupport { public ReversePath(IVertexSource sourcePath) { SourcPath = sourcePath; } public IVertexSource SourcPath { get; } public override IEnumerable<VertexData> Vertices() { IVertexSource sourcePath = SourcPath; foreach (VertexData vertexData in sourcePath.Vertices()) { // when we hit the initial stop. Skip it if (ShapePath.is_stop(vertexData.command)) { break; } yield return vertexData; } // and send the actual stop yield return new VertexData(ShapePath.FlagsAndCommand.EndPoly | ShapePath.FlagsAndCommand.FlagClose | ShapePath.FlagsAndCommand.FlagCCW, new Vector2()); yield return new VertexData(ShapePath.FlagsAndCommand.Stop, new Vector2()); } } }
bsd-2-clause
C#
9f1d1f02c59638eac262c1a52e5c032f9d152c76
test description
thanhpd/LibraryClient
LibraryDesktop/Models/BookModel.cs
LibraryDesktop/Models/BookModel.cs
using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using LibraryData.Models; using LibraryData.Services; using LibraryDesktop.Utils; using System.ComponentModel.DataAnno namespace LibraryDesktop.Models { public class BookModel { [DisplayName("ID")] [Description("The identify number of the book")] public string id { get; set; } public string book_image { get; set; } public string book_name { get; set; } public string book_author { get; set; } public string book_publisher { get; set; } public DateTime created_at { get; set; } public DateTime updated_at { get; set; } public string book_year { get; set; } public string status { get; set; } public string book_description { get; set; } public Image BookImage { get; set; } public BookModel(Book book) { id = book.id; book_image = book.book_image; book_name = book.book_name; book_author = book.book_author; book_publisher = book.book_publisher; book_year = book.book_year; book_description = book.book_description; created_at = book.created_at; updated_at = book.updated_at; status = book.status; if (!String.IsNullOrWhiteSpace(book_image)) { BookImage = FormHelper.FetchImage(DataProvider.GetImage(book_image)); } } } }
using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using LibraryData.Models; using LibraryData.Services; using LibraryDesktop.Utils; namespace LibraryDesktop.Models { public class BookModel { public string id { get; set; } public string book_image { get; set; } public string book_name { get; set; } public string book_author { get; set; } public string book_publisher { get; set; } public DateTime created_at { get; set; } public DateTime updated_at { get; set; } public string book_year { get; set; } public string status { get; set; } public string book_description { get; set; } public Image BookImage { get; set; } public BookModel(Book book) { id = book.id; book_image = book.book_image; book_name = book.book_name; book_author = book.book_author; book_publisher = book.book_publisher; book_year = book.book_year; book_description = book.book_description; created_at = book.created_at; updated_at = book.updated_at; status = book.status; if (!String.IsNullOrWhiteSpace(book_image)) { BookImage = FormHelper.FetchImage(DataProvider.GetImage(book_image)); } } } }
mit
C#
318cb0f6c5fabec364dcc9af9ce6add17ebb9cb6
Add Length property
EasyPeasyLemonSqueezy/MadCat
MadCat/NutPackerLib/SpriteSheet.cs
MadCat/NutPackerLib/SpriteSheet.cs
namespace NutPacker { using Microsoft.Xna.Framework; /// <summary> /// Contains array of <see cref="Rectangle"/>, /// Length property, and indexed property getter for it. /// </summary> public abstract class SpriteSheet { protected Rectangle[] Frames; public int Length { get { return Frames.Length; } } public Rectangle this[int index] { get { return Frames[index]; } } } }
namespace NutPacker { using Microsoft.Xna.Framework; /// <summary> /// Contains array of <see cref="Rectangle"/> and indexed property getter for it. /// </summary> public abstract class SpriteSheet { protected Rectangle[] Frames; public Rectangle this[int index] { get { return Frames[index]; } } } }
mit
C#
e25e62d04ad1670e4efc32ecc3e0a53a285830db
Add xmlenumattribute to values
Ackara/Daterpillar
src/Daterpillar.Core/ForeignKeyRule.cs
src/Daterpillar.Core/ForeignKeyRule.cs
using System.Xml.Serialization; namespace Gigobyte.Daterpillar { /// <summary> /// Foreign key collision rule. /// </summary> public enum ForeignKeyRule { [XmlEnum] NONE, [XmlEnum] CASCADE, [XmlEnum] SET_NULL, [XmlEnum] SET_DEFAULT, [XmlEnum] RESTRICT } }
namespace Gigobyte.Daterpillar { /// <summary> /// Foreign key collision rule. /// </summary> public enum ForeignKeyRule { NONE, CASCADE, SET_NULL, SET_DEFAULT, RESTRICT } }
mit
C#
9400bdbd8dad6225926d8f963231225206124b1d
fix MotionController change logic
eSlider/colorbob
Assets/MotionController.cs
Assets/MotionController.cs
using UnityEngine; using System.Collections; public class MotionController : MonoBehaviour { public float speed = 3; private Rigidbody rb; void Start () { rb = GetComponent<Rigidbody> (); } void Update () { float moveHorizontal = Input.GetAxis ("Horizontal"); float moveVertical = Input.GetAxis ("Vertical"); Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical); rb.AddForce (movement * speed); } }
using UnityEngine; using System.Collections; // This is MotionController public class MotionController : MonoBehaviour { public float speedFactor = 0.1f; void Update () { if(Input.GetKey(KeyCode.UpArrow)){ transform.Translate(Vector3.forward * speedFactor); } if(Input.GetKey(KeyCode.DownArrow)){ transform.Translate(Vector3.back * speedFactor); } if(Input.GetKey(KeyCode.RightArrow)){ transform.Translate(Vector3.right * speedFactor); } if(Input.GetKey(KeyCode.LeftArrow)){ transform.Translate(Vector3.left * speedFactor); } } }
mit
C#
d5f1d94b517703f202bfcf6dfe695eb46ee02f33
Allow specifying two sprites for legacy hit explosions
smoogipooo/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,peppy/osu
osu.Game.Rulesets.Taiko/Skinning/LegacyHitExplosion.cs
osu.Game.Rulesets.Taiko/Skinning/LegacyHitExplosion.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; namespace osu.Game.Rulesets.Taiko.Skinning { public class LegacyHitExplosion : CompositeDrawable { private readonly Drawable sprite; private readonly Drawable strongSprite; /// <summary> /// Creates a new legacy hit explosion. /// </summary> /// <remarks> /// Contrary to stable's, this implementation doesn't require a frame-perfect hit /// for the strong sprite to be displayed. /// </remarks> /// <param name="sprite">The normal legacy explosion sprite.</param> /// <param name="strongSprite">The strong legacy explosion sprite.</param> public LegacyHitExplosion(Drawable sprite, Drawable strongSprite = null) { this.sprite = sprite; this.strongSprite = strongSprite; } [BackgroundDependencyLoader] private void load() { Anchor = Anchor.Centre; Origin = Anchor.Centre; AutoSizeAxes = Axes.Both; AddInternal(sprite); if (strongSprite != null) AddInternal(strongSprite.With(s => s.Alpha = 0)); } protected override void LoadComplete() { base.LoadComplete(); const double animation_time = 120; this.FadeInFromZero(animation_time).Then().FadeOut(animation_time * 1.5); this.ScaleTo(0.6f) .Then().ScaleTo(1.1f, animation_time * 0.8) .Then().ScaleTo(0.9f, animation_time * 0.4) .Then().ScaleTo(1f, animation_time * 0.2); Expire(true); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; namespace osu.Game.Rulesets.Taiko.Skinning { public class LegacyHitExplosion : CompositeDrawable { public LegacyHitExplosion(Drawable sprite) { InternalChild = sprite; Anchor = Anchor.Centre; Origin = Anchor.Centre; AutoSizeAxes = Axes.Both; } protected override void LoadComplete() { base.LoadComplete(); const double animation_time = 120; this.FadeInFromZero(animation_time).Then().FadeOut(animation_time * 1.5); this.ScaleTo(0.6f) .Then().ScaleTo(1.1f, animation_time * 0.8) .Then().ScaleTo(0.9f, animation_time * 0.4) .Then().ScaleTo(1f, animation_time * 0.2); Expire(true); } } }
mit
C#
9835098476bfd503eb5af79c06df016088c59369
Update version.
maraf/Money,maraf/Money,maraf/Money
src/Money.UI.Blazor/Pages/About.cshtml
src/Money.UI.Blazor/Pages/About.cshtml
@page "/about" <h1>Money</h1> <h4>Neptuo</h4> <p class="gray"> v1.5.0 </p> <p> <a target="_blank" href="http://github.com/maraf/Money">Documentation</a> </p> <p> <a target="_blank" href="https://github.com/maraf/Money/issues/new">Report an issue</a> </p>
@page "/about" <h1>Money</h1> <h4>Neptuo</h4> <p class="gray"> v1.4.0 </p> <p> <a target="_blank" href="http://github.com/maraf/Money">Documentation</a> </p> <p> <a target="_blank" href="https://github.com/maraf/Money/issues/new">Report an issue</a> </p>
apache-2.0
C#
3fa4f19ac0a9005013e7f483b7c399cae92b421a
save flag when check changed
CORDEA/ConviviumCalculator,CORDEA/ConviviumCalculator,CORDEA/ConviviumCalculator,CORDEA/ConviviumCalculator,CORDEA/ConviviumCalculator,CORDEA/ConviviumCalculator
windows/ConviviumCalculator/MainPage.xaml.cs
windows/ConviviumCalculator/MainPage.xaml.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 namespace ConviviumCalculator { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); ViewModel = new MainViewModel(); } public MainViewModel ViewModel { get; set; } private void CheckBox_CheckedChanged(object sender, RoutedEventArgs e) { var checkBox = (CheckBox)sender; var context = checkBox.DataContext; if (context is ListItem) { var item = context as ListItem; ViewModel.SaveFlag(item.Name, checkBox.IsChecked ?? false); } } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 namespace ConviviumCalculator { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); ViewModel = new MainViewModel(); } public MainViewModel ViewModel { get; set; } private void CheckBox_CheckedChanged(object sender, RoutedEventArgs e) { var checkBox = (CheckBox)sender; var context = checkBox.DataContext; if (context is ListItem) { // save } } } }
apache-2.0
C#
48b8d31667d14d0fd22904cdfb162d817a7978d6
make class public
IUMDPI/IUMediaHelperApps
Packager/Exceptions/NormalizeOriginalException.cs
Packager/Exceptions/NormalizeOriginalException.cs
using System; namespace Packager.Exceptions { public class NormalizeOriginalException : AbstractEngineException { public NormalizeOriginalException(string baseMessage, params object[] parameters) : base(baseMessage, parameters) { } public NormalizeOriginalException(Exception innerException, string baseMessage, params object[] parameters) : base(innerException, baseMessage, parameters) { } } }
using System; namespace Packager.Exceptions { internal class NormalizeOriginalException : AbstractEngineException { public NormalizeOriginalException(string baseMessage, params object[] parameters) : base(baseMessage, parameters) { } public NormalizeOriginalException(Exception innerException, string baseMessage, params object[] parameters) : base(innerException, baseMessage, parameters) { } } }
apache-2.0
C#
64ecf0b7a21bc6faa70974faaa7a18a8da090ddb
Improve mutex information message
nicolabricot/MoodPicker-Windows
MoodPicker/Program.cs
MoodPicker/Program.cs
using System; using System.Threading; using System.Windows.Forms; namespace MoodPicker { static class Program { static Mutex mutex = new Mutex(true, "info.devenet.windows.moodpicker"); public const string ARGS_INTRAY = "/intray"; public const string MOODPICKER_WEBSITE = "http://windows.devenet.info/moodpicker"; public const string MOODPICKER_GITHUB = "https://github.com/nicolabricot/MoodPicker"; /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { if (mutex.WaitOne(TimeSpan.Zero, true)) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MoodPicker moodpicker = new MoodPicker(args); if (! (args.Length > 0 && args[0] == ARGS_INTRAY)) moodpicker.Show(); Application.Run(); mutex.ReleaseMutex(); } else { MessageBox.Show( "Holy crap, the application is already running." + Environment.NewLine + "Did you check in the notification tray?", "Mood Picker", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } } } }
using System; using System.Threading; using System.Windows.Forms; namespace MoodPicker { static class Program { static Mutex mutex = new Mutex(true, "info.devenet.windows.moodpicker"); public const string ARGS_INTRAY = "/intray"; public const string MOODPICKER_WEBSITE = "http://windows.devenet.info/moodpicker"; public const string MOODPICKER_GITHUB = "https://github.com/nicolabricot/MoodPicker"; /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { if (mutex.WaitOne(TimeSpan.Zero, true)) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MoodPicker moodpicker = new MoodPicker(args); if (! (args.Length > 0 && args[0] == ARGS_INTRAY)) moodpicker.Show(); Application.Run(); mutex.ReleaseMutex(); } else { MessageBox.Show( "Holy crap, the application is already running.", "Mood Picker", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } } } }
apache-2.0
C#
10d0ac6b8fd73b6bffc026de9ca28e72e065ae9a
Fix recursion in durable types
bwatts/Totem,bwatts/Totem
Source/Totem.Runtime/Timeline/ViewDbOperations.cs
Source/Totem.Runtime/Timeline/ViewDbOperations.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Totem.Runtime.Map.Timeline; namespace Totem.Runtime.Timeline { /// <summary> /// Extends <see cref="IViewDb"/> with core operations /// </summary> [EditorBrowsable(EditorBrowsableState.Never)] public static class ViewDbOperations { public static View Read(this IViewDb viewDb, Type viewType, Id id, bool strict = true) { return viewDb.Read(viewType, id, strict); } public static TView Read<TView>(this IViewDb viewDb, Id id, bool strict = true) where TView : View { return (TView) viewDb.Read(typeof(TView), id, strict); } public static View Read(this IViewDb viewDb, ViewType viewType, Id id, bool strict = true) { return viewDb.Read(viewType.DeclaredType, id, strict); } public static View Read(this IViewDb viewDb, Type viewType, bool strict = true) { return viewDb.Read(viewType, Id.Unassigned, strict); } public static TView Read<TView>(this IViewDb viewDb, bool strict = true) where TView : View { return viewDb.Read<TView>(Id.Unassigned, strict); } public static View Read(this IViewDb viewDb, ViewType viewType, bool strict = true) { return viewDb.Read(viewType, Id.Unassigned, strict); } // // JSON // public static string ReadJson(this IViewDb viewDb, Type viewType, Id id, bool strict = true) { return viewDb.ReadJson(viewType, id, strict); } public static string ReadJson<TView>(this IViewDb viewDb, Id id, bool strict = true) where TView : View { return viewDb.ReadJson(typeof(TView), id, strict); } public static string ReadJson(this IViewDb viewDb, ViewType viewType, Id id, bool strict = true) { return viewDb.ReadJson(viewType, id, strict); } public static string ReadJson(this IViewDb viewDb, Type viewType, bool strict = true) { return viewDb.ReadJson(viewType, Id.Unassigned, strict); } public static string ReadJson<TView>(this IViewDb viewDb, bool strict = true) where TView : View { return viewDb.ReadJson<TView>(Id.Unassigned, strict); } public static string ReadJson(this IViewDb viewDb, ViewType viewType, bool strict = true) { return viewDb.ReadJson(viewType, Id.Unassigned, strict); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Totem.Runtime.Map.Timeline; namespace Totem.Runtime.Timeline { /// <summary> /// Extends <see cref="IViewDb"/> with core operations /// </summary> [EditorBrowsable(EditorBrowsableState.Never)] public static class ViewDbOperations { public static View Read(this IViewDb viewDb, Type viewType, Id id, bool strict = true) { return viewDb.Read(viewType, id, strict); } public static TView Read<TView>(this IViewDb viewDb, Id id, bool strict = true) where TView : View { return (TView) viewDb.Read(typeof(TView), id, strict); } public static View Read(this IViewDb viewDb, ViewType viewType, Id id, bool strict = true) { return viewDb.Read(viewType, id, strict); } public static View Read(this IViewDb viewDb, Type viewType, bool strict = true) { return viewDb.Read(viewType, Id.Unassigned, strict); } public static TView Read<TView>(this IViewDb viewDb, bool strict = true) where TView : View { return viewDb.Read<TView>(Id.Unassigned, strict); } public static View Read(this IViewDb viewDb, ViewType viewType, bool strict = true) { return viewDb.Read(viewType, Id.Unassigned, strict); } // // JSON // public static string ReadJson(this IViewDb viewDb, Type viewType, Id id, bool strict = true) { return viewDb.ReadJson(viewType, id, strict); } public static string ReadJson<TView>(this IViewDb viewDb, Id id, bool strict = true) where TView : View { return viewDb.ReadJson(typeof(TView), id, strict); } public static string ReadJson(this IViewDb viewDb, ViewType viewType, Id id, bool strict = true) { return viewDb.ReadJson(viewType, id, strict); } public static string ReadJson(this IViewDb viewDb, Type viewType, bool strict = true) { return viewDb.ReadJson(viewType, Id.Unassigned, strict); } public static string ReadJson<TView>(this IViewDb viewDb, bool strict = true) where TView : View { return viewDb.ReadJson<TView>(Id.Unassigned, strict); } public static string ReadJson(this IViewDb viewDb, ViewType viewType, bool strict = true) { return viewDb.ReadJson(viewType, Id.Unassigned, strict); } } }
mit
C#
9f370206f20e69477723b168bddbe15fd5ce6b4f
Update Mobile.cs
jkanchelov/Telerik-OOP-Team-StarFruit
TeamworkStarFruit/CatalogueLib/Products/Mobile.cs
TeamworkStarFruit/CatalogueLib/Products/Mobile.cs
namespace CatalogueLib { using CatalogueLib.Products.Enumerations; using CatalogueLib.Products.Struct; using System.Text; public abstract class Mobile : Product { public Mobile() { } public Mobile(int ID, decimal price, bool isAvailable, Brand brand, int Memory, string CPU, int RAM, string Model, string battery, string connectivity, bool ExpandableMemory, double ScreenSize) : base(ID, price, isAvailable, brand) { this.Memory = Memory; this.CPU = CPU; this.RAM = RAM; this.Model = Model; this.battery = battery; this.Connectivity = Connectivity; this.ExpandableMemory = ExpandableMemory; this.ScreenSize = ScreenSize; } public int Memory { get; private set; } public string CPU { get; private set; } public int RAM { get; private set; } public string Model { get; private set; } public string battery { get; private set; } public string Connectivity { get; private set; } public bool ExpandableMemory { get; private set; } public double ScreenSize { get; private set; } public override string ToString() { StringBuilder stroitel = new StringBuilder(); stroitel = stroitel.Append(string.Format("{0}", base.ToString())); stroitel = stroitel.Append(string.Format(" Model: {0}\n Screen size: {1}\n Memory: {2}\n CPU: {3}\n RAM: {4}\n Expandable memory: {5}\n Battery: {6}",this.Model,this.ScreenSize,this.Memory,this.CPU,this.RAM, this.ExpandableMemory,this.battery)); return stroitel.AppendLine().ToString(); } } }
namespace CatalogueLib { using CatalogueLib.Products.Enumerations; using CatalogueLib.Products.Struct; public abstract class Mobile : Product { public Mobile() { } public Mobile(int ID, decimal price, bool isAvailable, Brand brand, int Memory, string CPU, int RAM, string Model, string battery, string connectivity, bool ExpandableMemory, double ScreenSize) : base(ID, price, isAvailable, brand) { this.Memory = Memory; this.CPU = CPU; this.RAM = RAM; this.Model = Model; this.battery = battery; this.Connectivity = Connectivity; this.ExpandableMemory = ExpandableMemory; this.ScreenSize = ScreenSize; } public int Memory { get; private set; } public string CPU { get; private set; } public int RAM { get; private set; } public string Model { get; private set; } public string battery { get; private set; } public string Connectivity { get; private set; } public bool ExpandableMemory { get; private set; } public double ScreenSize { get; private set; } public override string ToString() { return base.ToString() + $"\nModel:{this.Model}\nScreen size:{this.ScreenSize}\nMemory: {this.Memory}\nCPU: {this.CPU}\nRAM: {this.RAM} Expandable memory: {this.ExpandableMemory}\nBattery: {this.battery}"; } } }
mit
C#
8083c9c083933fa4ea7ffda95714480c69e37245
Use ImmutableArray for IList interface
wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D
TestEDITOR/Serializers/ProjectContractResolver.cs
TestEDITOR/Serializers/ProjectContractResolver.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Newtonsoft.Json.Serialization; using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TestEDITOR { /// <summary> /// /// </summary> internal class ProjectContractResolver : DefaultContractResolver { /// <summary> /// Use ImmutableArray for IList contract. /// </summary> /// <param name="type"></param> /// <returns></returns> public override JsonContract ResolveContract(Type type) { if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IList<>)) { return base .ResolveContract(typeof(ImmutableArray<>) .MakeGenericType(type.GenericTypeArguments[0])); } else { return base.ResolveContract(type); } } /// <summary> /// Serialize only writable properties. /// </summary> /// <param name="type"></param> /// <param name="memberSerialization"></param> /// <returns></returns> protected override IList<JsonProperty> CreateProperties(Type type, Newtonsoft.Json.MemberSerialization memberSerialization) { IList<JsonProperty> props = base.CreateProperties(type, memberSerialization); return props.Where(p => p.Writable).ToList(); } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Newtonsoft.Json.Serialization; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TestEDITOR { /// <summary> /// /// </summary> internal class ProjectContractResolver : DefaultContractResolver { /// <summary> /// Use ObservableCollection for IList contract. /// </summary> /// <param name="type"></param> /// <returns></returns> public override JsonContract ResolveContract(Type type) { if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IList<>)) { return base .ResolveContract(typeof(ObservableCollection<>) .MakeGenericType(type.GenericTypeArguments[0])); } else { return base.ResolveContract(type); } } /// <summary> /// Serialize only writable properties. /// </summary> /// <param name="type"></param> /// <param name="memberSerialization"></param> /// <returns></returns> protected override IList<JsonProperty> CreateProperties(Type type, Newtonsoft.Json.MemberSerialization memberSerialization) { IList<JsonProperty> props = base.CreateProperties(type, memberSerialization); return props.Where(p => p.Writable).ToList(); } } }
mit
C#
caa9e8a014ac25c7a58854d3b2e35eeb573eb714
Improve LateBindingCall error handling
Baggykiin/Netstack
Netstack/Language/Literals/LateBindingCall.cs
Netstack/Language/Literals/LateBindingCall.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.CSharp.RuntimeBinder; namespace Netstack.Language.Literals { class LateBindingCall : Literal { private readonly string label; public LateBindingCall(string label) { this.label = label; } public override void Execute(NetStack stack) { Statement functionBody; try { functionBody = stack.GetFunction(label); } catch (KeyNotFoundException) { throw new RuntimeBinderException(string.Format("Failed to call function (no binding for \"{0}\" exists).", label)); } functionBody.Evaluate(stack); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Netstack.Language.Literals { class LateBindingCall :Literal { private string label; public LateBindingCall(string label) { this.label = label; } public override void Execute(NetStack stack) { stack.GetFunction(label).Evaluate(stack); } } }
mit
C#
de85d2a5ec80e9ca46837291b245979f7b92dda0
Update MongoUtil.
tlaothong/dailysoccer,tlaothong/dailysoccer,tlaothong/dailysoccer,tlaothong/dailysoccer
DailySoccer2015/ApiApp/MongoAccess/MongoUtil.cs
DailySoccer2015/ApiApp/MongoAccess/MongoUtil.cs
using ApiApp.Models; using MongoDB.Driver; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.Configuration; namespace ApiApp.MongoAccess { static class MongoUtil { private static IMongoClient _client; private static IMongoDatabase _database; private static MongoDbHelper<Team> _team = new MongoDbHelper<Team>(_database, "dailysoccer.Teams"); private static MongoDbHelper<Match> _match = new MongoDbHelper<Match>(_database, "dailysoccer.Matches"); private static MongoDbHelper<League> _league = new MongoDbHelper<League>(_database, "dailysoccer.Leagues"); private static MongoDbHelper<Reward> _reward = new MongoDbHelper<Reward>(_database, "dailysoccer.Rewards"); private static MongoDbHelper<Winner> _winner = new MongoDbHelper<Winner>(_database, "dailysoccer.Winners"); private static MongoDbHelper<Prediction> _prediction = new MongoDbHelper<Prediction>(_database, "dailysoccer.Predictions"); private static MongoDbHelper<UserProfile> _userProfile = new MongoDbHelper<UserProfile>(_database, "dailysoccer.UserProfiles"); private static MongoDbHelper<RewardGroup> _rewardGroup = new MongoDbHelper<RewardGroup>(_database, "dailysoccer.RewardGroups"); private static MongoDbHelper<PendingWinner> _pendingWinner = new MongoDbHelper<PendingWinner>(_database, "dailysoccer.PendingWinners"); private static MongoDbHelper<FacebookAccount> _facebookAccount = new MongoDbHelper<FacebookAccount>(_database, "dailysoccer.FacebookAccounts"); static MongoUtil() { var connectionString = WebConfigurationManager.AppSettings["primaryConnectionString"]; _client = new MongoClient(connectionString); var dbName = WebConfigurationManager.AppSettings["databaseName"]; _database = _client.GetDatabase(dbName); } public static string /*MongoCollection*/ GetCollection(string collectionName) { //var connectionString = WebConfigurationManager.ConnectionStrings["primaryConnectionString"].ConnectionString; var dbName = WebConfigurationManager.AppSettings["databaseName"]; return null; } } }
using MongoDB.Driver; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.Configuration; namespace ApiApp.MongoAccess { static class MongoUtil { private static IMongoClient _client; private static IMongoDatabase _database; static MongoUtil() { var connectionString = WebConfigurationManager.AppSettings["primaryConnectionString"]; _client = new MongoClient(connectionString); var dbName = WebConfigurationManager.AppSettings["databaseName"]; _database = _client.GetDatabase(dbName); } public static string /*MongoCollection*/ GetCollection(string collectionName) { //var connectionString = WebConfigurationManager.ConnectionStrings["primaryConnectionString"].ConnectionString; var dbName = WebConfigurationManager.AppSettings["databaseName"]; return null; } } }
mit
C#
1509ad3ba5d65197bf5ad09a37490f1ea8aacd7a
Add default values for lyric and pitch
reznet/MusicXml.Net,vdaron/MusicXml.Net,gerryaobrien/MusicXml.Net
MusicXml/Domain/Note.cs
MusicXml/Domain/Note.cs
namespace MusicXml.Domain { public class Note { internal Note() { Type = string.Empty; Duration = -1; Voice = -1; Staff = -1; IsChordTone = false; Lyric = new Lyric(); Pitch = new Pitch(); } public string Type { get; internal set; } public int Voice { get; internal set; } public int Duration { get; internal set; } public Lyric Lyric { get; internal set; } public Pitch Pitch { get; internal set; } public int Staff { get; internal set; } public bool IsChordTone { get; internal set; } } }
namespace MusicXml.Domain { public class Note { internal Note() { Type = string.Empty; Duration = -1; Voice = -1; Staff = -1; IsChordTone = false; } public string Type { get; internal set; } public int Voice { get; internal set; } public int Duration { get; internal set; } public Lyric Lyric { get; internal set; } public Pitch Pitch { get; internal set; } public int Staff { get; internal set; } public bool IsChordTone { get; internal set; } } }
bsd-3-clause
C#
f3472fa363a7bfba85c89de6b62407b6c10bbfcd
Fix rust.BroadcastChat using wrong Broadcast method
Visagalis/Oxide,Visagalis/Oxide,LaserHydra/Oxide,LaserHydra/Oxide
Games/Unity/Oxide.Game.Rust/Libraries/Server.cs
Games/Unity/Oxide.Game.Rust/Libraries/Server.cs
using Oxide.Core.Libraries; namespace Oxide.Game.Rust.Libraries { public class Server : Library { #region Chat and Commands /// <summary> /// Broadcasts a chat message to all players /// </summary> /// <param name="message"></param> /// <param name="userId"></param> /// <param name="prefix"></param> public void Broadcast(string message, string prefix = null, ulong userId = 0) { ConsoleNetwork.BroadcastToAllClients("chat.add", userId, prefix != null ? $"{prefix} {message}" : message, 1.0); } /// <summary> /// Broadcasts a chat message to all players /// </summary> /// <param name="message"></param> /// <param name="userId"></param> /// <param name="prefix"></param> /// <param name="args"></param> public void Broadcast(string message, string prefix = null, ulong userId = 0, params object[] args) => Broadcast(string.Format(message, args), prefix, userId); /// <summary> /// Runs the specified server command /// </summary> /// <param name="command"></param> /// <param name="args"></param> public void Command(string command, params object[] args) => ConsoleSystem.Run(ConsoleSystem.Option.Server, command, args); #endregion } }
using Oxide.Core.Libraries; namespace Oxide.Game.Rust.Libraries { public class Server : Library { #region Chat and Commands /// <summary> /// Broadcasts a chat message to all players /// </summary> /// <param name="message"></param> /// <param name="userId"></param> /// <param name="prefix"></param> public void Broadcast(string message, string prefix = null, ulong userId = 0) { ConsoleNetwork.BroadcastToAllClients("chat.add", userId, prefix != null ? $"{prefix} {message}" : message, 1.0); } /// <summary> /// Broadcasts a chat message to all players /// </summary> /// <param name="message"></param> /// <param name="userId"></param> /// <param name="prefix"></param> /// <param name="args"></param> public void Broadcast(string message, string prefix = null, ulong userId = 0, params object[] args) => Broadcast(string.Format(message, args), prefix, userId); /// <summary> /// Broadcasts a chat message to all players /// </summary> /// <param name="message"></param> /// <param name="prefix"></param> /// <param name="args"></param> public void Broadcast(string message, string prefix = null, params object[] args) => Broadcast(string.Format(message, args), prefix); /// <summary> /// Runs the specified server command /// </summary> /// <param name="command"></param> /// <param name="args"></param> public void Command(string command, params object[] args) => ConsoleSystem.Run(ConsoleSystem.Option.Server, command, args); #endregion } }
mit
C#
d520aebdc6b22431515aead28b2a01c3b5ade7a5
Change version to 2.0.0
Coding-Enthusiast/Watch-Only-Bitcoin-Wallet
WatchOnlyBitcoinWallet/Properties/AssemblyInfo.cs
WatchOnlyBitcoinWallet/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("WatchOnlyBitcoinWallet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Coding Enthusiast Coders")] [assembly: AssemblyProduct("WatchOnlyBitcoinWallet")] [assembly: AssemblyCopyright("Copyright © C.E. 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.*")] [assembly: AssemblyFileVersion("2.0.0.0")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("WatchOnlyBitcoinWallet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Coding Enthusiast Coders")] [assembly: AssemblyProduct("WatchOnlyBitcoinWallet")] [assembly: AssemblyCopyright("Copyright © C.E. 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
20cb5daeb16119346bd52aab4892a134ed750fe7
Add testcase for implicit set.
github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql
csharp/ql/test/utils/model-generator/typebasedflow/TypeBasedSummaries.cs
csharp/ql/test/utils/model-generator/typebasedflow/TypeBasedSummaries.cs
using System; using System.Linq; using System.Collections; using System.Collections.Generic; namespace Summaries; public class TypeBasedSimple<T> { public T Prop { get { throw null; } set { throw null; } } public TypeBasedSimple(T t) { throw null; } public T Get() { throw null; } public T Get(object x) { throw null; } public T Id(T x) { throw null; } public S Id<S>(S x) { throw null; } public void Set(T x) { throw null; } public void Set(int x, T y) { throw null; } public void Set<S>(S x) { throw null; } // No summary as S is unrelated to T } public class TypeBasedComplex<T> { public void AddMany(IEnumerable<T> xs) { throw null; } public int Apply(Func<T, int> f) { throw null; } public S Apply<S>(Func<T, S> f) { throw null; } public T2 Apply<T1,T2>(T1 x, Func<T1, T2> f) { throw null; } public TypeBasedComplex<T> FlatMap(Func<T, IEnumerable<T>> f) { throw null; } public TypeBasedComplex<S> FlatMap<S>(Func<T, IEnumerable<S>> f) { throw null; } public IList<T> GetMany() { throw null; } public S Map<S>(Func<T, S> f) { throw null; } public TypeBasedComplex<S> MapComplex<S>(Func<T, S> f) { throw null; } public TypeBasedComplex<T> Return(Func<T, TypeBasedComplex<T>> f) { throw null; } public void Set(int x, Func<int, T> f) { throw null;} } // It is assumed that this is a collection with elements of type T. public class TypeBasedCollection<T> : IEnumerable<T> { IEnumerator<T> IEnumerable<T>.GetEnumerator() { throw null; } IEnumerator IEnumerable.GetEnumerator() { throw null; } public void Add(T x) { throw null; } public void AddMany(IEnumerable<T> x) { throw null; } public T First() { throw null; } public ICollection<T> GetMany() { throw null; } } // It is assumed that this is NOT a collection with elements of type T. public class TypeBasedNoCollection<T> : IEnumerable { IEnumerator IEnumerable.GetEnumerator() { throw null; } public T Get() { throw null; } public void Set(T x) { throw null; } }
using System; using System.Linq; using System.Collections; using System.Collections.Generic; namespace Summaries; public class TypeBasedSimple<T> { public T Prop { get { throw null; } set { throw null; } } public TypeBasedSimple(T t) { throw null; } public T Get() { throw null; } public T Get(object x) { throw null; } public T Id(T x) { throw null; } public S Id<S>(S x) { throw null; } public void Set(T x) { throw null; } public void Set(int x, T y) { throw null; } public void Set<S>(S x) { throw null; } // No summary as S is unrelated to T } public class TypeBasedComplex<T> { public void AddMany(IEnumerable<T> xs) { throw null; } public int Apply(Func<T, int> f) { throw null; } public S Apply<S>(Func<T, S> f) { throw null; } public T2 Apply<T1,T2>(T1 x, Func<T1, T2> f) { throw null; } public TypeBasedComplex<T> FlatMap(Func<T, IEnumerable<T>> f) { throw null; } public TypeBasedComplex<S> FlatMap<S>(Func<T, IEnumerable<S>> f) { throw null; } public IList<T> GetMany() { throw null; } public S Map<S>(Func<T, S> f) { throw null; } public TypeBasedComplex<S> MapComplex<S>(Func<T, S> f) { throw null; } public TypeBasedComplex<T> Return(Func<T, TypeBasedComplex<T>> f) { throw null; } // Examples still not working: // public void Set(int x, Func<int, T> f) { throw null;} } // It is assumed that this is a collection with elements of type T. public class TypeBasedCollection<T> : IEnumerable<T> { IEnumerator<T> IEnumerable<T>.GetEnumerator() { throw null; } IEnumerator IEnumerable.GetEnumerator() { throw null; } public void Add(T x) { throw null; } public void AddMany(IEnumerable<T> x) { throw null; } public T First() { throw null; } public ICollection<T> GetMany() { throw null; } } // It is assumed that this is NOT a collection with elements of type T. public class TypeBasedNoCollection<T> : IEnumerable { IEnumerator IEnumerable.GetEnumerator() { throw null; } public T Get() { throw null; } public void Set(T x) { throw null; } }
mit
C#
a46acca618b525d9f8708f81e2e84b99a3df35e3
Fix Parser tests
Baggykiin/pass-winmenu
pass-winmenu-tests/Parsing/ParserTests.cs
pass-winmenu-tests/Parsing/ParserTests.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace PassWinmenu.Tests { [TestClass] public class ParserTests { private const string Category = "Core: Password File Parsing"; [TestMethod, TestCategory(Category)] public void Test_EmptyFile() { var text = ""; var p = new PasswordFileParser(); var parsed = p.Parse(new PasswordFile(""), text, false); Assert.AreEqual(parsed.Password, string.Empty); Assert.AreEqual(parsed.Metadata, string.Empty); } [TestMethod, TestCategory(Category)] public void Test_LineEndings_Metadata() { var crlf = "password\r\nmeta-data"; var cr= "password\rmeta-data"; var lf = "password\nmeta-data"; var p = new PasswordFileParser(); var parsedCrlf = p.Parse(new PasswordFile(""), crlf, false); Assert.AreEqual(parsedCrlf.Password, "password"); Assert.AreEqual(parsedCrlf.Metadata, "meta-data"); var parsedCr = p.Parse(new PasswordFile(""), cr, false); Assert.AreEqual(parsedCr.Password, "password"); Assert.AreEqual(parsedCr.Metadata, "meta-data"); var parsedLf = p.Parse(new PasswordFile(""), lf, false); Assert.AreEqual(parsedLf.Password, "password"); Assert.AreEqual(parsedLf.Metadata, "meta-data"); } [TestMethod, TestCategory(Category)] public void Test_LineEndings_PasswordOnly() { var crlf = "password\r\n"; var cr = "password\r"; var lf = "password\n"; var none = "password"; var p = new PasswordFileParser(); var parsedCrlf = p.Parse(new PasswordFile(""), crlf, false); Assert.AreEqual(parsedCrlf.Password, "password"); Assert.AreEqual(parsedCrlf.Metadata, string.Empty); var parsedCr = p.Parse(new PasswordFile(""), cr, false); Assert.AreEqual(parsedCr.Password, "password"); Assert.AreEqual(parsedCr.Metadata, string.Empty); var parsedLf = p.Parse(new PasswordFile(""), lf, false); Assert.AreEqual(parsedLf.Password, "password"); Assert.AreEqual(parsedLf.Metadata, string.Empty); var parsedNone = p.Parse(new PasswordFile(""), none, false); Assert.AreEqual(parsedNone.Password, "password"); Assert.AreEqual(parsedNone.Metadata, string.Empty); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace PassWinmenu.Tests { [TestClass] public class ParserTests { private const string Category = "Core: Password File Parsing"; [TestMethod, TestCategory(Category)] public void Test_EmptyFile() { var text = ""; var p = new PasswordFileParser(); var parsed = p.Parse(null, text, false); Assert.AreEqual(parsed.Password, string.Empty); Assert.AreEqual(parsed.Metadata, string.Empty); } [TestMethod, TestCategory(Category)] public void Test_LineEndings_Metadata() { var crlf = "password\r\nmeta-data"; var cr= "password\rmeta-data"; var lf = "password\nmeta-data"; var p = new PasswordFileParser(); var parsedCrlf = p.Parse(null, crlf, false); Assert.AreEqual(parsedCrlf.Password, "password"); Assert.AreEqual(parsedCrlf.Metadata, "meta-data"); var parsedCr = p.Parse(null, cr, false); Assert.AreEqual(parsedCr.Password, "password"); Assert.AreEqual(parsedCr.Metadata, "meta-data"); var parsedLf = p.Parse(null, lf, false); Assert.AreEqual(parsedLf.Password, "password"); Assert.AreEqual(parsedLf.Metadata, "meta-data"); } [TestMethod, TestCategory(Category)] public void Test_LineEndings_PasswordOnly() { var crlf = "password\r\n"; var cr = "password\r"; var lf = "password\n"; var none = "password"; var p = new PasswordFileParser(); var parsedCrlf = p.Parse(null, crlf, false); Assert.AreEqual(parsedCrlf.Password, "password"); Assert.AreEqual(parsedCrlf.Metadata, string.Empty); var parsedCr = p.Parse(null, cr, false); Assert.AreEqual(parsedCr.Password, "password"); Assert.AreEqual(parsedCr.Metadata, string.Empty); var parsedLf = p.Parse(null, lf, false); Assert.AreEqual(parsedLf.Password, "password"); Assert.AreEqual(parsedLf.Metadata, string.Empty); var parsedNone = p.Parse(null, none, false); Assert.AreEqual(parsedNone.Password, "password"); Assert.AreEqual(parsedNone.Metadata, string.Empty); } } }
mit
C#
ebfe51106970ba2368b353115b2999c4c00f43b1
Increment minor -> 0.8.0
awseward/Bugsnag.NET,awseward/Bugsnag.NET
SharedAssemblyInfo.cs
SharedAssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyVersion("0.8.0.0")] [assembly: AssemblyFileVersion("0.8.0.0")] [assembly: AssemblyInformationalVersion("0.8.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyVersion("0.7.0.0")] [assembly: AssemblyFileVersion("0.7.0.0")] [assembly: AssemblyInformationalVersion("0.7.0")]
mit
C#
7871d4f386d474530f49b07a7052bff331b0fa26
Update CustomerDocumentEnum
petber/Visma.Net,ON-IT/Visma.Net,petber/Visma.Net
ONIT.VismaNet/Models/Enums/CustomerDocumentType.cs
ONIT.VismaNet/Models/Enums/CustomerDocumentType.cs
namespace ONIT.VismaNetApi.Models.Enums { public enum CustomerDocumentType { Invoice = 1, DebitMemo, CreditNote, Payment, VoidPayment, Prepayment, Refund, FinCharge, SmallBalanceWo, SmallCreditWo, CashSale, CashReturn, Undefined, NoUpdate } }
namespace ONIT.VismaNetApi.Models.Enums { public enum CustomerDocumentType { Invoice = 1, DebitMemo, CreditMemo, Payment, VoidPayment, Prepayment, Refund, FinCharge, SmallBalanceWo, SmallCreditWo, CashSale, CashReturn, Undefined, NoUpdate } }
mit
C#
da659339dd7beaa6d4edbb2b9d4ed89c92763ec9
Change namespace of EnyimMemcachedServiceCollectionExtensions
cnblogs/EnyimMemcachedCore,cnblogs/EnyimMemcachedCore,DukeCheng/EnyimMemcachedCore,DukeCheng/EnyimMemcachedCore
Enyim.Caching/EnyimMemcachedServiceCollectionExtensions.cs
Enyim.Caching/EnyimMemcachedServiceCollectionExtensions.cs
using Enyim.Caching; using Enyim.Caching.Configuration; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Microsoft.Extensions.DependencyInjection { public static class EnyimMemcachedServiceCollectionExtensions { public static IServiceCollection AddEnyimMemcached(this IServiceCollection services, Action<MemcachedClientOptions> setupAction) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (setupAction == null) { throw new ArgumentNullException(nameof(setupAction)); } services.AddOptions(); services.Configure(setupAction); services.Add(ServiceDescriptor.Transient<IMemcachedClientConfiguration, MemcachedClientConfiguration>()); services.Add(ServiceDescriptor.Singleton<IMemcachedClient, MemcachedClient>()); services.Add(ServiceDescriptor.Singleton<IDistributedCache, MemcachedClient>()); return services; } } }
using Enyim.Caching.Configuration; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Enyim.Caching { public static class EnyimMemcachedServiceCollectionExtensions { public static IServiceCollection AddEnyimMemcached(this IServiceCollection services, Action<MemcachedClientOptions> setupAction) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (setupAction == null) { throw new ArgumentNullException(nameof(setupAction)); } services.AddOptions(); services.Configure(setupAction); services.Add(ServiceDescriptor.Transient<IMemcachedClientConfiguration, MemcachedClientConfiguration>()); services.Add(ServiceDescriptor.Singleton<IMemcachedClient, MemcachedClient>()); services.Add(ServiceDescriptor.Singleton<IDistributedCache, MemcachedClient>()); return services; } } }
apache-2.0
C#
6526bc30778a3588eb2b6046e432fa959b6a0557
Make quizzer result properties read-only
brwml/MatchMakerTool
Reporting/Models/QuizzerResult.cs
Reporting/Models/QuizzerResult.cs
namespace MatchMaker.Reporting.Models; using System.Diagnostics; using System.Runtime.Serialization; using System.Xml.Linq; using Ardalis.GuardClauses; /// <summary> /// Defines the <see cref="QuizzerResult" /> /// </summary> [DataContract] [DebuggerDisplay("Quizzer Result (Quizzer {QuizzerId}, Score {Score}, Errors {Errors})")] public class QuizzerResult { /// <summary> /// Initializes a new instance of the <see cref="QuizzerResult"/> class. /// </summary> /// <param name="id">The quizzer identifier</param> /// <param name="score">The quizzer score</param> /// <param name="errors">The quizzer errors</param> private QuizzerResult(int id, int score, int errors) { this.QuizzerId = id; this.Score = score; this.Errors = errors; } /// <summary> /// Gets or sets the Errors /// </summary> [DataMember] public int Errors { get; } /// <summary> /// Gets or sets the quizzer identifier /// </summary> [DataMember] public int QuizzerId { get; } /// <summary> /// Gets or sets the Score /// </summary> [DataMember] public int Score { get; } /// <summary> /// Creates a <see cref="QuizzerResult"/> instance from an XML element. /// </summary> /// <param name="xml">The xml<see cref="XElement"/> instance</param> /// <returns>The <see cref="QuizzerResult"/> instance</returns> public static QuizzerResult FromXml(XElement xml) { Guard.Against.Null(xml, nameof(xml)); return new QuizzerResult( xml.GetAttribute<int>("id"), xml.GetAttribute<int>("score"), xml.GetAttribute<int>("errors")); } /// <summary> /// Converts the <see cref="QuizzerResult"/> instance to XML. /// </summary> /// <returns>The <see cref="XElement"/> instance</returns> public XElement ToXml() { return new XElement( "quizzer", new XAttribute("id", this.QuizzerId), new XAttribute("score", this.Score), new XAttribute("errors", this.Errors)); } }
namespace MatchMaker.Reporting.Models; using System.Diagnostics; using System.Runtime.Serialization; using System.Xml.Linq; using Ardalis.GuardClauses; /// <summary> /// Defines the <see cref="QuizzerResult" /> /// </summary> [DataContract] [DebuggerDisplay("Quizzer Result (Quizzer {QuizzerId}, Score {Score}, Errors {Errors})")] public class QuizzerResult { /// <summary> /// Gets or sets the Errors /// </summary> [DataMember] public int Errors { get; set; } /// <summary> /// Gets or sets the quizzer identifier /// </summary> [DataMember] public int QuizzerId { get; set; } /// <summary> /// Gets or sets the Score /// </summary> [DataMember] public int Score { get; set; } /// <summary> /// Creates a <see cref="QuizzerResult"/> instance from an XML element. /// </summary> /// <param name="xml">The xml<see cref="XElement"/> instance</param> /// <returns>The <see cref="QuizzerResult"/> instance</returns> public static QuizzerResult FromXml(XElement xml) { Guard.Against.Null(xml, nameof(xml)); return new QuizzerResult { QuizzerId = xml.GetAttribute<int>("id"), Score = xml.GetAttribute<int>("score"), Errors = xml.GetAttribute<int>("errors") }; } /// <summary> /// Converts the <see cref="QuizzerResult"/> instance to XML. /// </summary> /// <returns>The <see cref="XElement"/> instance</returns> public XElement ToXml() { return new XElement( "quizzer", new XAttribute("id", this.QuizzerId), new XAttribute("score", this.Score), new XAttribute("errors", this.Errors)); } }
mit
C#
17fa4f3f961ae1007b5324092ee07220e6335c26
Fix PlatformInfo parsing by manually traversing the PlatformInfo json and performing casts
SnowflakePowered/snowflake,faint32/snowflake-1,SnowflakePowered/snowflake,SnowflakePowered/snowflake,faint32/snowflake-1,RonnChyran/snowflake,RonnChyran/snowflake,faint32/snowflake-1,RonnChyran/snowflake
Snowflake/Platform/PlatformInfo.cs
Snowflake/Platform/PlatformInfo.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Snowflake.Information.MediaStore; using Snowflake.Information; using Snowflake.Controller; using System.Collections.ObjectModel; using Snowflake.Extensions; using Newtonsoft.Json.Linq; namespace Snowflake.Platform { public class PlatformInfo : Info, IPlatformInfo { public PlatformInfo(string platformId, string name, IMediaStore mediastore, IDictionary<string, string> metadata, IList<string> fileExtensions, IPlatformDefaults platformDefaults, IDictionary<string, IControllerDefinition> controllers, int maximumInputs): base(platformId, name, mediastore, metadata) { this.FileExtensions = fileExtensions; this.Defaults = platformDefaults; this.controllers = controllers; } public IList<string> FileExtensions { get; private set; } public IPlatformDefaults Defaults { get; set; } public IReadOnlyDictionary<string, IControllerDefinition> Controllers { get { return this.controllers.AsReadOnly(); } } private IDictionary<string, IControllerDefinition> controllers; public int MaximumInputs { get; private set; } public static IPlatformInfo FromDictionary(IDictionary<string, dynamic> jsonDictionary) { IPlatformDefaults platformDefaults = jsonDictionary["Defaults"].ToObject<PlatformDefaults>(); var controllers = new Dictionary<string, IControllerDefinition>(); foreach (var value in jsonDictionary["Controllers"]) { var inputs = ((JObject)value.Value.ControllerInputs).ToObject<IDictionary<object, JObject>>().ToDictionary(x => (string)x.Key, x => (IControllerInput)x.Value.ToObject<ControllerInput>()); controllers.Add(value.Name, new ControllerDefinition(inputs, value.Name)); } // string controllerId = return new PlatformInfo( jsonDictionary["PlatformId"], jsonDictionary["Name"], new FileMediaStore(jsonDictionary["MediaStoreKey"]), jsonDictionary["Metadata"].ToObject<Dictionary<string, string>>(), jsonDictionary["FileExtensions"].ToObject<List<string>>(), platformDefaults, controllers, (int)jsonDictionary["MaximumInputs"] ); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Snowflake.Information.MediaStore; using Snowflake.Information; using Snowflake.Controller; using System.Collections.ObjectModel; using Snowflake.Extensions; namespace Snowflake.Platform { public class PlatformInfo : Info, IPlatformInfo { public PlatformInfo(string platformId, string name, IMediaStore mediastore, IDictionary<string, string> metadata, IList<string> fileExtensions, IPlatformDefaults platformDefaults, IDictionary<string, IControllerDefinition> controllers, int maximumInputs): base(platformId, name, mediastore, metadata) { this.FileExtensions = fileExtensions; this.Defaults = platformDefaults; this.controllers = controllers; } public IList<string> FileExtensions { get; private set; } public IPlatformDefaults Defaults { get; set; } public IReadOnlyDictionary<string, IControllerDefinition> Controllers { get { return this.controllers.AsReadOnly(); } } private IDictionary<string, IControllerDefinition> controllers; public int MaximumInputs { get; private set; } public static IPlatformInfo FromDictionary(IDictionary<string, dynamic> jsonDictionary) { IPlatformDefaults platformDefaults = jsonDictionary["Defaults"].ToObject<PlatformDefaults>(); // string controllerId = return new PlatformInfo( jsonDictionary["PlatformId"], jsonDictionary["Name"], new FileMediaStore(jsonDictionary["MediaStoreKey"]), jsonDictionary["Metadata"].ToObject<Dictionary<string, string>>(), jsonDictionary["FileExtensions"].ToObject<List<string>>(), platformDefaults, jsonDictionary["Controllers"].ToObject<Dictionary<string, IControllerDefinition>>(), (int)jsonDictionary["MaximumInputs"] ); } } }
mpl-2.0
C#
74ceb4f1cf2f6ff86300bd89578abb119cbe00b0
Fix add result form styles. Remove Comments.
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
src/CompetitionPlatform/Views/Project/AddResult.cshtml
src/CompetitionPlatform/Views/Project/AddResult.cshtml
@model CompetitionPlatform.Models.ProjectViewModels.AddResultViewModel <br /> <br /> <br /> <section class="section section--competition_edit"> <div class="container"> <div class="content__left"> <form asp-controller="ProjectDetails" asp-action="SaveResult" enctype="multipart/form-data" class="form form--share_result"> <input asp-for="@Model.ProjectId" type="hidden" /> <input asp-for="@Model.ParticipantId" type="hidden" /> <div class="row"> <div class="col-md-9"> <input asp-for="@Model.Link" class="form-control" type="text" placeholder="Insert link for the shared file(Dropbox, googleDrive, GitHub)" /> </div> <div class="col-md-3"> <button type="submit" class="btn btn-md"><i class="icon icon--share_result"></i> Send Result</button> </div> <div class="col-md-9"> <br /> <span asp-validation-for="@Model.Link" class="text-danger" /> </div> </div> </form> </div> </div> </section> @section Scripts { @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} }
@model CompetitionPlatform.Models.ProjectViewModels.AddResultViewModel @*<form asp-controller="ProjectDetails" asp-action="SaveResult" enctype="multipart/form-data"> <div class="form-group col-md-10"> <input asp-for="@Model.ProjectId" type="hidden"/> <input asp-for="@Model.ParticipantId" type="hidden"/> <input asp-for="@Model.Link" class="form-control inline" placeholder="Insert link for the shared file(Dropbox, googleDrive, GitHub)"/> <span asp-validation-for="@Model.Link" class="text-danger" /> </div> <div class="form-group"> <input type="submit" value="Send Result" class="btn btn-primary col-md-2 inline" /> </div> </form>*@ <br/> <br/> <br/> <form asp-controller="ProjectDetails" asp-action="SaveResult" enctype="multipart/form-data" class="form form--share_result"> <input asp-for="@Model.ProjectId" type="hidden" /> <input asp-for="@Model.ParticipantId" type="hidden" /> <div class="col-sm-9"> <input asp-for="@Model.Link" class="form-control" type="text" placeholder="Insert link for the shared file(Dropbox, googleDrive, GitHub)" /> </div> <div class="col-sm-3"> <button type="submit" class="btn btn-md"><i class="icon icon--share_result"></i> Send Result</button> </div> <span asp-validation-for="@Model.Link" class="text-danger" /> </form> @section Scripts { @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} }
mit
C#
cad3e57bfd2a7b97bf25b58d9b537e55e07b1c24
Set JsonSchemaTypeAttribute allow multiple to false, closes https://github.com/RicoSuter/NSwag/issues/2097
NJsonSchema/NJsonSchema,RSuter/NJsonSchema
src/NJsonSchema/Annotations/JsonSchemaTypeAttribute.cs
src/NJsonSchema/Annotations/JsonSchemaTypeAttribute.cs
//----------------------------------------------------------------------- // <copyright file="JsonSchemaTypeAttribute.cs" company="NSwag"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/NSwag/NSwag/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System; namespace NJsonSchema.Annotations { /// <summary>Specifies the type to use for JSON Schema generation.</summary> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Class, AllowMultiple = false)] public class JsonSchemaTypeAttribute : Attribute { /// <summary>Initializes a new instance of the <see cref="JsonSchemaTypeAttribute"/> class.</summary> /// <param name="type">The type of the schema.</param> public JsonSchemaTypeAttribute(Type type) { Type = type; } /// <summary>Gets or sets the response type.</summary> public Type Type { get; } /// <summary>Gets or sets a value indicating whether the schema can be null (default: null = unchanged).</summary> public bool IsNullable { get => IsNullableRaw ?? false; set => IsNullableRaw = value; } internal bool? IsNullableRaw { get; set; } // required because attribute properties cannot be bool? } }
//----------------------------------------------------------------------- // <copyright file="JsonSchemaTypeAttribute.cs" company="NSwag"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/NSwag/NSwag/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System; namespace NJsonSchema.Annotations { /// <summary>Specifies the type to use for JSON Schema generation.</summary> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Class, AllowMultiple = true)] public class JsonSchemaTypeAttribute : Attribute { /// <summary>Initializes a new instance of the <see cref="JsonSchemaTypeAttribute"/> class.</summary> /// <param name="type">The type of the schema.</param> public JsonSchemaTypeAttribute(Type type) { Type = type; } /// <summary>Gets or sets the response type.</summary> public Type Type { get; } /// <summary>Gets or sets a value indicating whether the schema can be null (default: null = unchanged).</summary> public bool IsNullable { get => IsNullableRaw ?? false; set => IsNullableRaw = value; } internal bool? IsNullableRaw { get; set; } // required because attribute properties cannot be bool? } }
mit
C#
5d8a46071b2e60c4c04767e17084d7d06370c3f4
Fix Mac build.
PowerOfCode/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,PowerOfCode/Eto,l8s/Eto,bbqchickenrobot/Eto-1,l8s/Eto,l8s/Eto
Source/Eto.Platform.Mac/Forms/Controls/SearchBoxHandler.cs
Source/Eto.Platform.Mac/Forms/Controls/SearchBoxHandler.cs
using System; using Eto.Drawing; using Eto.Forms; using MonoMac.AppKit; namespace Eto.Platform.Mac.Forms.Controls { /// <summary> /// TODO: Try to eliminate code duplication between this class /// and TextBoxHandler. /// </summary> public class SearchBoxHandler : MacText<NSSearchField, SearchBox>, ISearchBox, ITextBoxWithMaxLength { class EtoTextField : NSSearchField, IMacControl { object IMacControl.Handler { get { return Handler; } } public SearchBoxHandler Handler { get; set; } } public override bool HasFocus { get { if (Widget.ParentWindow == null) return false; return ((IMacWindow)Widget.ParentWindow.Handler).FieldEditorObject == Control; } } public override NSSearchField CreateControl() { return new EtoTextField { Handler = this, Bezeled = true, Editable = true, Selectable = true, Formatter = new MyFormatter{ Handler = this } }; } protected override void Initialize() { base.Initialize(); Control.Cell.Scrollable = true; Control.Cell.Wraps = false; Control.Cell.UsesSingleLineMode = true; MaxLength = -1; } protected override Size GetNaturalSize(Size availableSize) { var size = base.GetNaturalSize (availableSize); size.Width = Math.Max (100, size.Height); return size; } public override void AttachEvent (string handler) { switch (handler) { case TextArea.TextChangedEvent: Control.Changed += delegate { Widget.OnTextChanged (EventArgs.Empty); }; break; default: base.AttachEvent (handler); break; } } public bool ReadOnly { get { return !Control.Editable; } set { Control.Editable = !value; } } public int MaxLength { get; set; } public string PlaceholderText { get { return ((NSTextFieldCell)Control.Cell).PlaceholderString; } set { ((NSTextFieldCell)Control.Cell).PlaceholderString = value ?? string.Empty; } } public void SelectAll() { Control.SelectText (Control); } } }
using System; using Eto.Forms; using MonoMac.AppKit; using MonoMac.Foundation; using Eto.Platform.Mac.Forms.Controls; using MonoMac.ObjCRuntime; namespace Eto.Platform.Mac.Forms.Controls { /// <summary> /// TODO: Try to eliminate code duplication between this class /// and TextBoxHandler. /// </summary> public class SearchBoxHandler : MacText<NSSearchField, SearchBox>, ISearchBox, ITextBoxWithMaxLength { class EtoTextField : NSSearchField, IMacControl { object IMacControl.Handler { get { return Handler; } } public SearchBoxHandler Handler { get; set; } } public override bool HasFocus { get { if (Widget.ParentWindow == null) return false; return ((IMacWindow)Widget.ParentWindow.Handler).FieldEditorObject == Control; } } public override NSSearchField CreateControl() { return new EtoTextField { Handler = this, Bezeled = true, Editable = true, Selectable = true, Formatter = new MyFormatter{ Handler = this } }; } protected override void Initialize() { base.Initialize(); Control.Cell.Scrollable = true; Control.Cell.Wraps = false; Control.Cell.UsesSingleLineMode = true; MaxLength = -1; } protected override Eto.Drawing.Size GetNaturalSize () { var size = base.GetNaturalSize (); size.Width = Math.Max (100, size.Height); return size; } public override void AttachEvent (string handler) { switch (handler) { case TextArea.TextChangedEvent: Control.Changed += delegate { Widget.OnTextChanged (EventArgs.Empty); }; break; default: base.AttachEvent (handler); break; } } public bool ReadOnly { get { return !Control.Editable; } set { Control.Editable = !value; } } public int MaxLength { get; set; } public string PlaceholderText { get { return ((NSTextFieldCell)Control.Cell).PlaceholderString; } set { ((NSTextFieldCell)Control.Cell).PlaceholderString = value ?? string.Empty; } } public void SelectAll() { Control.SelectText (Control); } } }
bsd-3-clause
C#
da3f802a8a9021b77ce3bcd2c155b6058d1f80b3
Fix comparison
canton7/RestEase
src/RestEase/Implementation/SerializationMethods.cs
src/RestEase/Implementation/SerializationMethods.cs
namespace RestEase.Implementation { internal class ResolvedSerializationMethods { public const BodySerializationMethod DefaultBodySerializationMethod = BodySerializationMethod.Serialized; public QuerySerializationMethod DefaultQuerySerializationMethod = QuerySerializationMethod.ToString; public PathSerializationMethod DefaultPathSerializationMethod = PathSerializationMethod.ToString; public SerializationMethodsAttribute ClassAttribute { get; private set; } public SerializationMethodsAttribute MethodAttribute { get; private set; } public ResolvedSerializationMethods(SerializationMethodsAttribute classAttribute, SerializationMethodsAttribute methodAttribute) { this.ClassAttribute = classAttribute; this.MethodAttribute = methodAttribute; } public BodySerializationMethod ResolveBody(BodySerializationMethod parameterMethod) { if (parameterMethod != BodySerializationMethod.Default) return parameterMethod; if (this.MethodAttribute != null && this.MethodAttribute.Body != BodySerializationMethod.Default) return this.MethodAttribute.Body; if (this.ClassAttribute != null && this.ClassAttribute.Body != BodySerializationMethod.Default) return this.ClassAttribute.Body; return DefaultBodySerializationMethod; } public QuerySerializationMethod ResolveQuery(QuerySerializationMethod parameterMethod) { if (parameterMethod != QuerySerializationMethod.Default) return parameterMethod; if (this.MethodAttribute != null && this.MethodAttribute.Query != QuerySerializationMethod.Default) return this.MethodAttribute.Query; if (this.ClassAttribute != null && this.ClassAttribute.Query != QuerySerializationMethod.Default) return this.ClassAttribute.Query; return DefaultQuerySerializationMethod; } public PathSerializationMethod ResolvePath(PathSerializationMethod parameterMethod) { if (parameterMethod != PathSerializationMethod.Default) return parameterMethod; if (this.MethodAttribute != null && this.MethodAttribute.Path != PathSerializationMethod.Default) return this.MethodAttribute.Path; if (this.ClassAttribute != null && this.ClassAttribute.Path != PathSerializationMethod.Default) return this.ClassAttribute.Path; return DefaultPathSerializationMethod; } } }
namespace RestEase.Implementation { internal class ResolvedSerializationMethods { public const BodySerializationMethod DefaultBodySerializationMethod = BodySerializationMethod.Serialized; public QuerySerializationMethod DefaultQuerySerializationMethod = QuerySerializationMethod.ToString; public PathSerializationMethod DefaultPathSerializationMethod = PathSerializationMethod.ToString; public SerializationMethodsAttribute ClassAttribute { get; private set; } public SerializationMethodsAttribute MethodAttribute { get; private set; } public ResolvedSerializationMethods(SerializationMethodsAttribute classAttribute, SerializationMethodsAttribute methodAttribute) { this.ClassAttribute = classAttribute; this.MethodAttribute = methodAttribute; } public BodySerializationMethod ResolveBody(BodySerializationMethod parameterMethod) { if (parameterMethod != BodySerializationMethod.Default) return parameterMethod; if (this.MethodAttribute != null && this.MethodAttribute.Body != BodySerializationMethod.Default) return this.MethodAttribute.Body; if (this.ClassAttribute != null && this.ClassAttribute.Body != BodySerializationMethod.Default) return this.ClassAttribute.Body; return DefaultBodySerializationMethod; } public QuerySerializationMethod ResolveQuery(QuerySerializationMethod parameterMethod) { if (parameterMethod != QuerySerializationMethod.Default) return parameterMethod; if (this.MethodAttribute != null && this.MethodAttribute.Query != QuerySerializationMethod.Default) return this.MethodAttribute.Query; if (this.ClassAttribute != null && this.ClassAttribute.Query != QuerySerializationMethod.Default) return this.ClassAttribute.Query; return DefaultQuerySerializationMethod; } public PathSerializationMethod ResolvePath(PathSerializationMethod parameterMethod) { if (parameterMethod == PathSerializationMethod.Default) return parameterMethod; if (this.MethodAttribute != null && this.MethodAttribute.Path != PathSerializationMethod.Default) return this.MethodAttribute.Path; if (this.ClassAttribute != null && this.ClassAttribute.Path != PathSerializationMethod.Default) return this.ClassAttribute.Path; return DefaultPathSerializationMethod; } } }
mit
C#
b69aa4aefb91c2d7e1fdcfc3bdd6cb48a5cabe57
Update WordCreator.cs
vanjikumaran/VizhiMozhi
SrilankanTamilFingerSpelling/SrilankanTamilFingerSpelling/Utilities/WordCreator.cs
SrilankanTamilFingerSpelling/SrilankanTamilFingerSpelling/Utilities/WordCreator.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SrilankanTamilFingerSpelling.Utilities { class WordCreator { private String letterBase; private String letterNew; public string processLetters(String letter) { if (letterBase == null) { // create initial Base Letter this.letterBase = letter; return 0; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SrilankanTamilFingerSpelling.Utilities { class WordCreator { private String letterBase; private String letterNew; public string processLetters(String letter) { if (letterBase == null) { // create initial Base Letter this.letterBase = letter; return 0; } else { if (true) { } } } } }
apache-2.0
C#
841f9c81e42744fbbb11b564905ab32029ae597b
Remove another pattern match.
syeerzy/visualfsharp,dsyme/FSharp.Compiler.Service,dsyme/FSharp.Compiler.Service,syeerzy/visualfsharp,brettfo/visualfsharp,ncave/FSharp.Compiler.Service,syeerzy/visualfsharp,dsyme/fsharp,ncave/FSharp.Compiler.Service,dsyme/FSharp.Compiler.Service,cloudRoutine/FSharp.Compiler.Service,dsyme/fsharp,brettfo/visualfsharp,fsharp/fsharp,syeerzy/visualfsharp,brettfo/visualfsharp,fsharp/fsharp,brettfo/visualfsharp,ncave/FSharp.Compiler.Service,cloudRoutine/FSharp.Compiler.Service,dsyme/fsharp,brettfo/visualfsharp,cloudRoutine/FSharp.Compiler.Service,Jand42/FSharp.Compiler.Service,dsyme/fsharp,Jand42/FSharp.Compiler.Service,syeerzy/visualfsharp,brettfo/visualfsharp,dsyme/fsharp,dsyme/fsharp,fsharp/fsharp,dsyme/fsharp,Jand42/FSharp.Compiler.Service,syeerzy/visualfsharp
vsintegration/src/FSharp.UIResources/IntegerRangeValidationRule.cs
vsintegration/src/FSharp.UIResources/IntegerRangeValidationRule.cs
using System.Globalization; using System.Windows.Controls; namespace Microsoft.VisualStudio.FSharp.UIResources { public class IntegerRangeValidationRule : ValidationRule { public IntegerRangeValidationRule() : base(ValidationStep.RawProposedValue, true) { } public int Min { get; set; } public int Max { get; set; } public override ValidationResult Validate(object value, CultureInfo cultureInfo) { if (value is string) { var text = (string)value; int i = 0; if (int.TryParse(text, out i) && i >= Min && i <= Max) { return ValidationResult.ValidResult; } } return new ValidationResult(false, $"Expected a number between {Min} and {Max}"); } } }
using System.Globalization; using System.Windows.Controls; namespace Microsoft.VisualStudio.FSharp.UIResources { public class IntegerRangeValidationRule : ValidationRule { public IntegerRangeValidationRule() : base(ValidationStep.RawProposedValue, true) { } public int Min { get; set; } public int Max { get; set; } public override ValidationResult Validate(object value, CultureInfo cultureInfo) { if (value is string) { var text = (string)value; if (int.TryParse(text, out int i) && i >= Min && i <= Max) { return ValidationResult.ValidResult; } } return new ValidationResult(false, $"Expected a number between {Min} and {Max}"); } } }
mit
C#
53a30b9673a5166ebc0b2225dd45f1172337888f
Fix warning
RehanSaeed/Schema.NET
Tests/Schema.NET.Test/ThingTest.cs
Tests/Schema.NET.Test/ThingTest.cs
namespace Schema.NET.Test { using System; using Newtonsoft.Json; using Xunit; public class ThingTest { private readonly Thing thing = new Thing() { Name = "New Object", Description = "This is the description of a new object we can't deserialize", Image = new Uri("https://example.com/image.jpg") }; private readonly string json = "{" + "\"@context\":\"http://schema.org\"," + "\"@type\":\"NewObject\"," + "\"name\":\"New Object\"," + "\"description\":\"This is the description of a new object we can't deserialize\"," + "\"image\":\"https://example.com/image.jpg\"," + "\"someProperty\":\"not supported\"" + "}"; [Fact] public void Deserializing_NewObjectJsonLd_ReturnsThing() => Assert.Equal( this.thing.ToString(), JsonConvert.DeserializeObject<Thing>(this.json, TestDefaults.DefaultJsonSerializerSettings).ToString()); } }
namespace Schema.NET.Test { using System; using Newtonsoft.Json; using Xunit; public class ThingTest { private readonly Thing thing = new Thing() { Name = "New Object", Description = "This is the description of a new object we can't deserialize", Image = new Uri("https://example.com/image.jpg") }; private readonly string json = "{" + "\"@context\":\"http://schema.org\"," + "\"@type\":\"NewObject\"," + "\"name\":\"New Object\"," + "\"description\":\"This is the description of a new object we can't deserialize\"," + "\"image\":\"https://example.com/image.jpg\"," + "\"someProperty\":\"not supported\"" + "}"; [Fact] public void Deserializing_NewObjectJsonLd_ReturnsThing() { Assert.Equal(this.thing.ToString(), JsonConvert.DeserializeObject<Thing>(this.json, TestDefaults.DefaultJsonSerializerSettings).ToString()); } } }
mit
C#
7b19e97493781877de192167f6cb88e0efec219a
コメント修正。
t-miyake/OutlookOkan
SetupCustomAction/CustomAction.cs
SetupCustomAction/CustomAction.cs
using System; using System.Collections; using System.Configuration.Install; using System.Diagnostics; using System.IO; using System.Windows; namespace SetupCustomAction { [System.ComponentModel.RunInstaller(true)] public sealed class CustomAction : Installer { public override void Install(IDictionary savedState) { base.Install(savedState); var outlookProcess = Process.GetProcessesByName("OUTLOOK"); if (outlookProcess.Length > 0) { throw new InstallException(); } } public override void Uninstall(IDictionary savedState) { base.Uninstall(savedState); var result = MessageBox.Show("設定を削除しますか?", "設定削除の確認", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes, MessageBoxOptions.ServiceNotification); if (result == MessageBoxResult.Yes) { try { var directoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Noraneko\\OutlookOkan\\"); Directory.Delete(directoryPath, true); } catch (Exception) { //Do Nothing. } } } public override void Commit(IDictionary savedState) { } public override void Rollback(IDictionary savedState) { } } }
using System; using System.Collections; using System.Configuration.Install; using System.Diagnostics; using System.IO; using System.Windows; namespace SetupCustomAction { [System.ComponentModel.RunInstaller(true)] public sealed class CustomAction : Installer { public override void Install(IDictionary savedState) { base.Install(savedState); var outlookProcess = Process.GetProcessesByName("OUTLOOK"); if (outlookProcess.Length > 0) { throw new InstallException(); } } public override void Uninstall(IDictionary savedState) { base.Uninstall(savedState); var result = MessageBox.Show("設定を削除しますか?", "設定削除の確認", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes, MessageBoxOptions.ServiceNotification); if (result == MessageBoxResult.Yes) { try { var directoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Noraneko\\OutlookOkan\\"); Directory.Delete(directoryPath, true); } catch (Exception) { //throw new InstallException(); } } } public override void Commit(IDictionary savedState) { } public override void Rollback(IDictionary savedState) { } } }
apache-2.0
C#
ff963f8c98fc4cda688b1a58486c446d89adeadf
Remove class constraint on AsNonNull()
peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework
osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.cs
osu.Framework/Extensions/ObjectExtensions/ObjectExtensions.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.Diagnostics.CodeAnalysis; namespace osu.Framework.Extensions.ObjectExtensions { /// <summary> /// Extensions that apply to all objects. /// </summary> public static class ObjectExtensions { /// <summary> /// Coerces a nullable object as non-nullable. This is an alternative to the C# 8 null-forgiving operator "<c>!</c>". /// </summary> /// <remarks> /// This should only be used when an assertion or other handling is not a reasonable alternative. /// </remarks> /// <param name="obj">The nullable object.</param> /// <typeparam name="T">The type of the object.</typeparam> /// <returns>The non-nullable object corresponding to <paramref name="obj"/>.</returns> [return: NotNullIfNotNull("obj")] public static T AsNonNull<T>(this T? obj) => obj!; /// <summary> /// If the given object is null. /// </summary> public static bool IsNull<T>([NotNullWhen(false)] this T obj) => ReferenceEquals(obj, null); /// <summary> /// <c>true</c> if the given object is not null, <c>false</c> otherwise. /// </summary> public static bool IsNotNull<T>([NotNullWhen(true)] this T obj) => !ReferenceEquals(obj, null); } }
// 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.Diagnostics.CodeAnalysis; namespace osu.Framework.Extensions.ObjectExtensions { /// <summary> /// Extensions that apply to all objects. /// </summary> public static class ObjectExtensions { /// <summary> /// Coerces a nullable object as non-nullable. This is an alternative to the C# 8 null-forgiving operator "<c>!</c>". /// </summary> /// <remarks> /// This should only be used when an assertion or other handling is not a reasonable alternative. /// </remarks> /// <param name="obj">The nullable object.</param> /// <typeparam name="T">The type of the object.</typeparam> /// <returns>The non-nullable object corresponding to <paramref name="obj"/>.</returns> public static T AsNonNull<T>(this T? obj) where T : class { return obj!; } /// <summary> /// If the given object is null. /// </summary> public static bool IsNull<T>([NotNullWhen(false)] this T obj) => ReferenceEquals(obj, null); /// <summary> /// <c>true</c> if the given object is not null, <c>false</c> otherwise. /// </summary> public static bool IsNotNull<T>([NotNullWhen(true)] this T obj) => !ReferenceEquals(obj, null); } }
mit
C#
97067976f75a416dd8adc290aed8841ab51740ad
Add null check
NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,ppy/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,peppy/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu
osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs
osu.Game/Overlays/Settings/Sections/General/UpdateSettings.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.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Configuration; using osu.Game.Overlays.Settings.Sections.Maintenance; using osu.Game.Updater; namespace osu.Game.Overlays.Settings.Sections.General { public class UpdateSettings : SettingsSubsection { [Resolved(CanBeNull = true)] private UpdateManager updateManager { get; set; } protected override string Header => "Updates"; private SettingsButton checkForUpdatesButton; [BackgroundDependencyLoader(true)] private void load(Storage storage, OsuConfigManager config, OsuGame game) { Add(new SettingsEnumDropdown<ReleaseStream> { LabelText = "Release stream", Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream), }); if (updateManager?.CanCheckForUpdate == true) { Add(checkForUpdatesButton = new SettingsButton { Text = "Check for updates", Action = () => { checkForUpdatesButton.Enabled.Value = false; Task.Run(updateManager.CheckForUpdateAsync).ContinueWith(t => Schedule(() => checkForUpdatesButton.Enabled.Value = true)); } }); } if (RuntimeInfo.IsDesktop) { Add(new SettingsButton { Text = "Open osu! folder", Action = storage.OpenInNativeExplorer, }); Add(new SettingsButton { Text = "Change folder location...", Action = () => game?.PerformFromScreen(menu => menu.Push(new MigrationSelectScreen())) }); } } } }
// 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.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Configuration; using osu.Game.Overlays.Settings.Sections.Maintenance; using osu.Game.Updater; namespace osu.Game.Overlays.Settings.Sections.General { public class UpdateSettings : SettingsSubsection { [Resolved(CanBeNull = true)] private UpdateManager updateManager { get; set; } protected override string Header => "Updates"; private SettingsButton checkForUpdatesButton; [BackgroundDependencyLoader(true)] private void load(Storage storage, OsuConfigManager config, OsuGame game) { Add(new SettingsEnumDropdown<ReleaseStream> { LabelText = "Release stream", Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream), }); if (updateManager.CanCheckForUpdate) { Add(checkForUpdatesButton = new SettingsButton { Text = "Check for updates", Action = () => { checkForUpdatesButton.Enabled.Value = false; Task.Run(updateManager.CheckForUpdateAsync).ContinueWith(t => Schedule(() => checkForUpdatesButton.Enabled.Value = true)); } }); } if (RuntimeInfo.IsDesktop) { Add(new SettingsButton { Text = "Open osu! folder", Action = storage.OpenInNativeExplorer, }); Add(new SettingsButton { Text = "Change folder location...", Action = () => game?.PerformFromScreen(menu => menu.Push(new MigrationSelectScreen())) }); } } } }
mit
C#
027d8c44bf111bcb8bc919722cc8340df0fd14ac
Reformat code
thomasgalliker/ValueConverters.NET
ValueConverters.Shared/EnumToObjectConverter.cs
ValueConverters.Shared/EnumToObjectConverter.cs
using System; using System.Globalization; using System.Reflection; #if (NETFX || WINDOWS_PHONE) using System.Windows; using System.Windows.Markup; #elif (NETFX_CORE) using Windows.UI.Xaml; using Windows.UI.Xaml.Markup; #elif (XAMARIN) using Xamarin.Forms; #endif namespace ValueConverters { /// <summary> /// EnumToObjectConverter can be used to select different resources based on given enum name. /// This can be particularly useful if an enum needs to represent an image on the user interface. /// /// Use the Items property to create a ResourceDictionary which contains object-to-enum-name mappings. /// Each defined object must have an x:Key which maps to the particular enum name. /// /// Check out following example: /// <example> /// <ResourceDictionary> /// <BitmapImage x:Key="Off" UriSource="/Resources/Images/stop.png" /> /// <BitmapImage x:Key="On" UriSource="/Resources/Images/play.png" /> /// <BitmapImage x:Key="Maybe" UriSource="/Resources/Images/pause.png" /> /// </ResourceDictionary> /// </example> /// Source: http://stackoverflow.com/questions/2787725/how-to-display-different-enum-icons-using-xaml-only /// </summary> public class EnumToObjectConverter : StringToObjectConverter { protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return UnsetValue; } var type = value.GetType(); var key = Enum.GetName(type, value); return base.Convert(key, targetType, parameter, culture); } } }
using System; using System.Globalization; #if (NETFX || WINDOWS_PHONE) using System.Windows; using System.Windows.Markup; #elif (NETFX_CORE) using Windows.UI.Xaml; using Windows.UI.Xaml.Markup; #elif (XAMARIN) using Xamarin.Forms; #endif namespace ValueConverters { /// <summary> /// EnumToObjectConverter can be used to select different resources based on given enum name. /// This can be particularly useful if an enum needs to represent an image on the user interface. /// /// Use the Items property to create a ResourceDictionary which contains object-to-enum-name mappings. /// Each defined object must have an x:Key which maps to the particular enum name. /// /// Check out following example: /// <example> /// <ResourceDictionary> /// <BitmapImage x:Key="Off" UriSource="/Resources/Images/stop.png" /> /// <BitmapImage x:Key="On" UriSource="/Resources/Images/play.png" /> /// <BitmapImage x:Key="Maybe" UriSource="/Resources/Images/pause.png" /> /// </ResourceDictionary> /// </example> /// Source: http://stackoverflow.com/questions/2787725/how-to-display-different-enum-icons-using-xaml-only /// </summary> public class EnumToObjectConverter : StringToObjectConverter { protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return UnsetValue; } var key = Enum.GetName(value.GetType(), value); return base.Convert(key, targetType, parameter, culture); } } }
mit
C#
daa0dd305f0e2572fd5042571fde5b21b91d0e3b
Update HomeController.cs
ojraqueno/webapiimageupload,ojraqueno/webapiimageupload,ojraqueno/webapiimageupload
WebAPIImageUpload/Controllers/HomeController.cs
WebAPIImageUpload/Controllers/HomeController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; namespace WebAPIImageUpload.Controllers { public class HomeController : Controller { public ActionResult Index() { return View(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; namespace WebAPIImageUpload.Controllers { [Authorize] public class HomeController : Controller { public ActionResult Index() { return View(); } } }
mit
C#
9bfd567c05d2cd56118913850e344bcb398ca957
introduce error
samarkoirala/MyTestBlog,samarkoirala/MyTestBlog,samarkoirala/MyTestBlog,samarkoirala/MyTestBlog
Startup.cs
Startup.cs
using Microsoft.Owin; using Owin; [assembly: OwinStartupAttribute(typeof(MyBlog.Startup))] namespace MyBlog { public partial class Startup { public void Configuration(IAppBuilder app) { ConfigureAuth(app); }asdfasdf } }
using Microsoft.Owin; using Owin; [assembly: OwinStartupAttribute(typeof(MyBlog.Startup))] namespace MyBlog { public partial class Startup { public void Configuration(IAppBuilder app) { ConfigureAuth(app); } } }
mit
C#
b1d1ba77c264c57576ccc55cc3baebdea403596b
remove unused test
larsbrubaker/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl
Tests/MatterControl.Tests/MatterControl/Slicing/SliceLayersTests.cs
Tests/MatterControl.Tests/MatterControl/Slicing/SliceLayersTests.cs
/* Copyright (c) 2014, Lars Brubaker All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using System.Threading; using MatterHackers.Agg.Platform; using MatterHackers.MatterControl.Tests.Automation; using MatterHackers.PolygonMesh; using MatterHackers.PolygonMesh.Csg; using MatterHackers.PolygonMesh.Processors; using MatterHackers.VectorMath; using NUnit.Framework; namespace MatterHackers.MatterControl.Slicing.Tests { [TestFixture, Category("MatterControl.Slicing")] public class SliceLayersTests { //[Test] public void SliceLayersGeneratingCorrectSegments() { // TODO: Make tests work on Mac as well as Windows if (AggContext.OperatingSystem == OSType.Mac) { return; } string meshFileName = TestContext.CurrentContext.ResolveProjectPath(4, "Tests", "TestData", "TestMeshes", "SliceLayers", "Box20x20x10.stl"); Mesh cubeMesh = StlProcessing.Load(meshFileName, CancellationToken.None); AxisAlignedBoundingBox bounds = cubeMesh.GetAxisAlignedBoundingBox(); Assert.IsTrue(bounds.ZSize == 10); //var alllayers = slicelayers.getperimetersforalllayers(cubemesh, .2, .2); //assert.istrue(alllayers.count == 50); //foreach (slicelayer layer in alllayers) //{ // assert.istrue(layer.unorderedsegments.count == 8); // // work in progress // //assert.istrue(layer.perimeters.count == 1); // //assert.istrue(layer.perimeters[0].count == 8); //} //alllayers = slicelayers.getperimetersforalllayers(cubemesh, .2, .1); //Assert.IsTrue(allLayers.Count == 99); } } }
/* Copyright (c) 2014, Lars Brubaker All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using System.Threading; using MatterHackers.Agg.Platform; using MatterHackers.MatterControl.Tests.Automation; using MatterHackers.PolygonMesh; using MatterHackers.PolygonMesh.Csg; using MatterHackers.PolygonMesh.Processors; using MatterHackers.VectorMath; using NUnit.Framework; namespace MatterHackers.MatterControl.Slicing.Tests { [TestFixture, Category("MatterControl.Slicing")] public class SliceLayersTests { //[Test] public void SliceLayersGeneratingCorrectSegments() { // TODO: Make tests work on Mac as well as Windows if (AggContext.OperatingSystem == OSType.Mac) { return; } string meshFileName = TestContext.CurrentContext.ResolveProjectPath(4, "Tests", "TestData", "TestMeshes", "SliceLayers", "Box20x20x10.stl"); Mesh cubeMesh = StlProcessing.Load(meshFileName, CancellationToken.None); AxisAlignedBoundingBox bounds = cubeMesh.GetAxisAlignedBoundingBox(); Assert.IsTrue(bounds.ZSize == 10); var allLayers = SliceLayers.GetPerimetersForAllLayers(cubeMesh, .2, .2); Assert.IsTrue(allLayers.Count == 50); foreach (SliceLayer layer in allLayers) { Assert.IsTrue(layer.UnorderedSegments.Count == 8); // work in progress //Assert.IsTrue(layer.Perimeters.Count == 1); //Assert.IsTrue(layer.Perimeters[0].Count == 8); } allLayers = SliceLayers.GetPerimetersForAllLayers(cubeMesh, .2, .1); Assert.IsTrue(allLayers.Count == 99); } } }
bsd-2-clause
C#
36141f2578bb8c7d58b2064b6e47435f0505d369
refactor to use modelInfoRepository
Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen
Dashen/View.cs
Dashen/View.cs
using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using Dashen.Assets; using Dashen.Infrastructure; namespace Dashen { public class View { private readonly ModelInfoRepository _modelInfo; private readonly List<AssetInfo> _assets; public View(ModelInfoRepository modelInfo) { _modelInfo = modelInfo; _assets = new List<AssetInfo>(); _assets.Add(new JavaScriptAssetInfo("static/js/react.min.js")); _assets.Add(new JavaScriptAssetInfo("static/js/JSXTransformer.js")); _assets.Add(new JavaScriptAssetInfo("static/js/jquery-1.10.0.min.js")); _assets.Add(new JavaScriptAssetInfo("static/js/wrapper.jsx").AddAttribute("type", "text/jsx")); } private string GetTemplate() { using (var stream = GetType().Assembly.GetManifestResourceStream("Dashen.Static.views.Index.htm")) using (var reader = new StreamReader(stream)) { return reader.ReadToEnd(); } } private string GetScripts() { var sb = new StringBuilder(); _assets .Where(asset => asset.Location == AssetLocations.PreHead || asset.Location == AssetLocations.PostHead) .ForEach(asset => sb.AppendLine(asset.ToString())); return sb.ToString(); } private string GetComponents() { var sb = new StringBuilder(); _modelInfo.All().ForEach(info => { sb.AppendFormat("<script type='text/jsx' src='components/{0}'></script>", info.Component.Name); sb.AppendLine(); }); return sb.ToString(); } private string BuildReactUI() { var dashboardJsx = @" var Dashboard = React.createClass({ render: function() { return ( <div className='row fullwidth'> {components} </div> ); } }); React.renderComponent( <Dashboard />, document.getElementById('content') );"; var componentFormat = " <Wrapper component={{{0}}} url='models/{1}' interval={{{2}}} />"; var sb = new StringBuilder(); _modelInfo.All().ForEach(info => { sb.AppendFormat(componentFormat, info.Component.Name, info.ModelID, 5000); sb.AppendLine(); }); return dashboardJsx.Replace("{components}", sb.ToString()); } public string Render() { var template = GetTemplate(); template = template.Replace("{scripts}", GetScripts()); template = template.Replace("{components}", GetComponents()); template = template.Replace("{generated}", BuildReactUI()); return template; } } }
using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using Dashen.Assets; using Dashen.Infrastructure; namespace Dashen { public class View { private readonly List<AssetInfo> _assets; public View() { _assets = new List<AssetInfo>(); _assets.Add(new JavaScriptAssetInfo("static/js/react.min.js")); _assets.Add(new JavaScriptAssetInfo("static/js/JSXTransformer.js")); _assets.Add(new JavaScriptAssetInfo("static/js/jquery-1.10.0.min.js")); _assets.Add(new JavaScriptAssetInfo("static/js/wrapper.jsx").AddAttribute("type", "text/jsx")); } public void AddAsset(AssetInfo asset) { _assets.Add(asset); } private string GetTemplate() { using (var stream = GetType().Assembly.GetManifestResourceStream("Dashen.Static.views.Index.htm")) using (var reader = new StreamReader(stream)) { return reader.ReadToEnd(); } } private string GetScripts() { var sb = new StringBuilder(); _assets .Where(asset => asset.Location == AssetLocations.PreHead || asset.Location == AssetLocations.PostHead) .ForEach(asset => sb.AppendLine(asset.ToString())); return sb.ToString(); } private string GetComponents() { var sb = new StringBuilder(); _assets .Where(asset => asset.Location == AssetLocations.PreBody || asset.Location == AssetLocations.PostBody) .ForEach(asset => sb.AppendLine(asset.ToString())); return sb.ToString(); } private string BuildReactUI() { var dashboardJsx = @" var Dashboard = React.createClass({ render: function() { return ( <div className='row fullwidth'> {components} </div> ); } }); React.renderComponent( <Dashboard />, document.getElementById('content') );"; var componentFormat = " <Wrapper component={{{0}}} url='{1}' interval={{{2}}} />"; var sb = new StringBuilder(); _assets .OfType<ComponentAssetInfo>() .ForEach(component => sb.AppendFormat(componentFormat, component.Name, component.ModelPath, 5000 ).AppendLine()); return dashboardJsx.Replace("{components}", sb.ToString()); } public string Render() { var template = GetTemplate(); template = template.Replace("{scripts}", GetScripts()); template = template.Replace("{components}", GetComponents()); template = template.Replace("{generated}", BuildReactUI()); return template; } } }
lgpl-2.1
C#
46865075e7bd9203020be76bc8cfba1a4774ba1b
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
autofac/Autofac.Extras.CommonServiceLocator
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("Autofac.Extras.CommonServiceLocator")]
using System; using System.Reflection; [assembly: AssemblyTitle("Autofac.Extras.CommonServiceLocator")] [assembly: AssemblyDescription("Autofac Adapter for the Microsoft CommonServiceLocator")]
mit
C#
82c69043c2b4f47c9d5f9ce0ef06983b9e7e18a7
clean up initialization, use CopyOptions.
nathansamson/F-Spot-Album-Exporter,nathansamson/F-Spot-Album-Exporter,nathansamson/F-Spot-Album-Exporter,Sanva/f-spot,mono/f-spot,GNOME/f-spot,mans0954/f-spot,nathansamson/F-Spot-Album-Exporter,NguyenMatthieu/f-spot,Sanva/f-spot,Sanva/f-spot,mans0954/f-spot,mono/f-spot,Yetangitu/f-spot,mans0954/f-spot,dkoeb/f-spot,NguyenMatthieu/f-spot,mans0954/f-spot,Sanva/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,Yetangitu/f-spot,GNOME/f-spot,mans0954/f-spot,dkoeb/f-spot,mono/f-spot,dkoeb/f-spot,mans0954/f-spot,NguyenMatthieu/f-spot,Yetangitu/f-spot,GNOME/f-spot,dkoeb/f-spot,mono/f-spot,Sanva/f-spot,GNOME/f-spot,Yetangitu/f-spot,Yetangitu/f-spot,GNOME/f-spot,dkoeb/f-spot,dkoeb/f-spot,mono/f-spot,mono/f-spot
src/ThumbnailCache.cs
src/ThumbnailCache.cs
using System; using System.Collections; using Gdk; public class ThumbnailCache : IDisposable { // Types. private class Thumbnail { // Path of the image on the disk. public string path; // The uncompressed thumbnail. public Pixbuf pixbuf; } // Private members and constants private const int DEFAULT_CACHE_SIZE = 200; private int max_count; private ArrayList pixbuf_mru; private Hashtable pixbuf_hash = new Hashtable (); static private ThumbnailCache defaultcache = new ThumbnailCache (DEFAULT_CACHE_SIZE); // Public API public ThumbnailCache (int max_count) { this.max_count = max_count; pixbuf_mru = new ArrayList (max_count); } static public ThumbnailCache Default { get { return defaultcache; } } public void AddThumbnail (string path, Pixbuf pixbuf) { Thumbnail thumbnail = new Thumbnail (); thumbnail.path = path; thumbnail.pixbuf = pixbuf; RemoveThumbnailForPath (path); pixbuf_mru.Insert (0, thumbnail); pixbuf_hash.Add (path, thumbnail); MaybeExpunge (); } public Pixbuf GetThumbnailForPath (string path) { if (! pixbuf_hash.ContainsKey (path)) return null; Thumbnail item = pixbuf_hash [path] as Thumbnail; pixbuf_mru.Remove (item); pixbuf_mru.Insert (0, item); // Shallow Copy Pixbuf copy = new Pixbuf (item.pixbuf, 0, 0, item.pixbuf.Width, item.pixbuf.Height); PixbufUtils.CopyThumbnailOptions (item.pixbuf, copy); return copy; } public void RemoveThumbnailForPath (string path) { if (! pixbuf_hash.ContainsKey (path)) return; Thumbnail item = pixbuf_hash [path] as Thumbnail; pixbuf_hash.Remove (path); pixbuf_mru.Remove (item); item.pixbuf.Dispose (); } public void Dispose () { foreach (object item in pixbuf_mru) { Thumbnail thumb = item as Thumbnail; pixbuf_hash.Remove (thumb.path); thumb.pixbuf.Dispose (); } pixbuf_mru.Clear (); } // Private utility methods. private void MaybeExpunge () { while (pixbuf_mru.Count > max_count) { Thumbnail thumbnail = pixbuf_mru [pixbuf_mru.Count - 1] as Thumbnail; pixbuf_hash.Remove (thumbnail.path); pixbuf_mru.RemoveAt (pixbuf_mru.Count - 1); thumbnail.pixbuf.Dispose (); } } }
using System; using System.Collections; using Gdk; public class ThumbnailCache : IDisposable { // Types. private class Thumbnail { // Path of the image on the disk. public string path; // The uncompressed thumbnail. public Pixbuf pixbuf; } // Private members and constants private const int DEFAULT_CACHE_SIZE = 200; private int max_count; private ArrayList pixbuf_mru; private Hashtable pixbuf_hash = new Hashtable (); static private ThumbnailCache default_thumbnail_cache = null; // Public API public ThumbnailCache (int max_count) { this.max_count = max_count; pixbuf_mru = new ArrayList (max_count); } static public ThumbnailCache Default { get { if (default_thumbnail_cache == null) default_thumbnail_cache = new ThumbnailCache (DEFAULT_CACHE_SIZE); return default_thumbnail_cache; } } public void AddThumbnail (string path, Pixbuf pixbuf) { Thumbnail thumbnail = new Thumbnail (); thumbnail.path = path; thumbnail.pixbuf = pixbuf; RemoveThumbnailForPath (path); pixbuf_mru.Insert (0, thumbnail); pixbuf_hash.Add (path, thumbnail); MaybeExpunge (); } public Pixbuf GetThumbnailForPath (string path) { if (! pixbuf_hash.ContainsKey (path)) return null; Thumbnail item = pixbuf_hash [path] as Thumbnail; pixbuf_mru.Remove (item); pixbuf_mru.Insert (0, item); Pixbuf copy = new Pixbuf (item.pixbuf, 0, 0, item.pixbuf.Width, item.pixbuf.Height); PixbufUtils.SetOption (copy, "tEXt::Thumb::URI", item.pixbuf.GetOption ("tEXt::Thumb::URI")); PixbufUtils.SetOption (copy, "tEXt::Thumb::MTime", item.pixbuf.GetOption ("tEXt::Thumb::MTime")); return copy; } public void RemoveThumbnailForPath (string path) { if (! pixbuf_hash.ContainsKey (path)) return; Thumbnail item = pixbuf_hash [path] as Thumbnail; pixbuf_hash.Remove (path); pixbuf_mru.Remove (item); item.pixbuf.Dispose (); } public void Dispose () { foreach (object item in pixbuf_mru) { Thumbnail thumb = item as Thumbnail; pixbuf_hash.Remove (thumb.path); thumb.pixbuf.Dispose (); } pixbuf_mru.Clear (); } // Private utility methods. private void MaybeExpunge () { while (pixbuf_mru.Count > max_count) { Thumbnail thumbnail = pixbuf_mru [pixbuf_mru.Count - 1] as Thumbnail; pixbuf_hash.Remove (thumbnail.path); pixbuf_mru.RemoveAt (pixbuf_mru.Count - 1); thumbnail.pixbuf.Dispose (); } } }
mit
C#
cadeaff015b1094dc4a0f4faa9a35cc7d89f2751
fix a small bug in CheckBoxItem
qusma/qdms,underwater/qdms,qusma/qdms,underwater/qdms
QDMSServer/CheckBoxItem.cs
QDMSServer/CheckBoxItem.cs
// ----------------------------------------------------------------------- // <copyright file="CheckBoxItem.cs" company=""> // Copyright 2013 Alexander Soffronow Pagonidis // </copyright> // ----------------------------------------------------------------------- using System.ComponentModel; namespace QDMSServer { public class CheckBoxItem<T> : INotifyPropertyChanged { private bool _isChecked; private T _item; public CheckBoxItem(T item, bool isChecked = false) { _item = item; _isChecked = isChecked; } public bool IsChecked { get { return _isChecked; } set { _isChecked = value; NotifyPropertyChanged("IsChecked"); } } public T Item { get { return _item; } set { _item = value; NotifyPropertyChanged("Item"); } } public event PropertyChangedEventHandler PropertyChanged; protected void NotifyPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } }
// ----------------------------------------------------------------------- // <copyright file="CheckBoxItem.cs" company=""> // Copyright 2013 Alexander Soffronow Pagonidis // </copyright> // ----------------------------------------------------------------------- using System.ComponentModel; namespace QDMSServer { public class CheckBoxItem<T> { private bool _isChecked; private T _item; public CheckBoxItem(T item, bool isChecked = false) { _item = item; _isChecked = isChecked; } public bool IsChecked { get { return _isChecked; } set { _isChecked = value; NotifyPropertyChanged("IsChecked"); } } public T Item { get { return _item; } set { _item = value; NotifyPropertyChanged("Item"); } } public event PropertyChangedEventHandler PropertyChanged; protected void NotifyPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } }
bsd-3-clause
C#
83becc06c6393afdb974375e30542211f01f9d5f
Write to log when retrying
DanielRose/GitVersion,dpurge/GitVersion,ermshiperete/GitVersion,GitTools/GitVersion,dazinator/GitVersion,asbjornu/GitVersion,ermshiperete/GitVersion,gep13/GitVersion,ermshiperete/GitVersion,onovotny/GitVersion,pascalberger/GitVersion,onovotny/GitVersion,onovotny/GitVersion,pascalberger/GitVersion,DanielRose/GitVersion,GitTools/GitVersion,DanielRose/GitVersion,JakeGinnivan/GitVersion,pascalberger/GitVersion,asbjornu/GitVersion,JakeGinnivan/GitVersion,dpurge/GitVersion,dpurge/GitVersion,ParticularLabs/GitVersion,ermshiperete/GitVersion,JakeGinnivan/GitVersion,dazinator/GitVersion,JakeGinnivan/GitVersion,gep13/GitVersion,dpurge/GitVersion,ParticularLabs/GitVersion
src/GitVersionCore/Helpers/OperationWithExponentialBackoff.cs
src/GitVersionCore/Helpers/OperationWithExponentialBackoff.cs
using System; using System.Collections.Generic; namespace GitVersion.Helpers { internal class OperationWithExponentialBackoff<T> where T : Exception { private IThreadSleep ThreadSleep; private Action Operation; private int MaxRetries; public OperationWithExponentialBackoff(IThreadSleep threadSleep, Action operation, int maxRetries = 5) { if (threadSleep == null) throw new ArgumentNullException("threadSleep"); if (maxRetries < 0) throw new ArgumentOutOfRangeException("maxRetries"); this.ThreadSleep = threadSleep; this.Operation = operation; this.MaxRetries = maxRetries; } public void Execute() { var exceptions = new List<Exception>(); int tries = 0; int sleepMSec = 500; while (tries <= MaxRetries) { tries++; try { Operation(); break; } catch (T e) { exceptions.Add(e); if (tries > MaxRetries) { throw new AggregateException("Operation failed after maximum number of retries were exceeded.", exceptions); } } Logger.WriteInfo(string.Format("Operation failed, retrying in {0} milliseconds.", sleepMSec)); ThreadSleep.Sleep(sleepMSec); sleepMSec *= 2; } } } }
using System; using System.Collections.Generic; namespace GitVersion.Helpers { internal class OperationWithExponentialBackoff<T> where T : Exception { private IThreadSleep ThreadSleep; private Action Operation; private int MaxRetries; public OperationWithExponentialBackoff(IThreadSleep threadSleep, Action operation, int maxRetries = 5) { if (threadSleep == null) throw new ArgumentNullException("threadSleep"); if (maxRetries < 0) throw new ArgumentOutOfRangeException("maxRetries"); this.ThreadSleep = threadSleep; this.Operation = operation; this.MaxRetries = maxRetries; } public void Execute() { var exceptions = new List<Exception>(); int tries = 0; int sleepMSec = 500; while (tries <= MaxRetries) { tries++; try { Operation(); break; } catch (T e) { exceptions.Add(e); if (tries > MaxRetries) { throw new AggregateException("Operation failed after maximum number of retries were exceeded.", exceptions); } } ThreadSleep.Sleep(sleepMSec); sleepMSec *= 2; } } } }
mit
C#
2436619d36f7d19b49924fec2e597774cad7f9ef
Remove redundant #ToString.
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
src/MitternachtBot/Modules/Gambling/WheelOfFortuneCommands.cs
src/MitternachtBot/Modules/Gambling/WheelOfFortuneCommands.cs
using System.Threading.Tasks; using Discord; using Discord.Commands; using Mitternacht.Common.Attributes; using Mitternacht.Extensions; using Mitternacht.Services; using Wof = Mitternacht.Modules.Gambling.Common.WheelOfFortune.WheelOfFortune; namespace Mitternacht.Modules.Gambling { public partial class Gambling { public class WheelOfFortuneCommands : MitternachtSubmodule { private readonly CurrencyService _cs; private readonly IBotConfigProvider _bc; public WheelOfFortuneCommands(CurrencyService cs, IBotConfigProvider bc) { _cs = cs; _bc = bc; } [MitternachtCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task WheelOfFortune(int bet) { const int minBet = 10; if(bet < minBet) { await ReplyErrorLocalized("min_bet_limit", minBet + _bc.BotConfig.CurrencySign).ConfigureAwait(false); return; } if(!await _cs.RemoveAsync(Context.User.Id, "Wheel Of Fortune - bet", bet).ConfigureAwait(false)) { await ReplyErrorLocalized("not_enough", _bc.BotConfig.CurrencySign).ConfigureAwait(false); return; } var wof = new Wof(); var amount = (int)(bet * wof.Multiplier); if(amount > 0) await _cs.AddAsync(Context.User.Id, "Wheel Of Fortune - won", amount).ConfigureAwait(false); await Context.Channel.SendConfirmAsync( Format.Bold($@"{Context.User} won: {amount + _bc.BotConfig.CurrencySign} 『{Wof.Multipliers[1]}』 『{Wof.Multipliers[0]}』 『{Wof.Multipliers[7]}』 『{Wof.Multipliers[2]}』 {wof.Emoji} 『{Wof.Multipliers[6]}』 『{Wof.Multipliers[3]}』 『{Wof.Multipliers[4]}』 『{Wof.Multipliers[5]}』")).ConfigureAwait(false); } } } }
using System.Threading.Tasks; using Discord; using Discord.Commands; using Mitternacht.Common.Attributes; using Mitternacht.Extensions; using Mitternacht.Services; using Wof = Mitternacht.Modules.Gambling.Common.WheelOfFortune.WheelOfFortune; namespace Mitternacht.Modules.Gambling { public partial class Gambling { public class WheelOfFortuneCommands : MitternachtSubmodule { private readonly CurrencyService _cs; private readonly IBotConfigProvider _bc; public WheelOfFortuneCommands(CurrencyService cs, IBotConfigProvider bc) { _cs = cs; _bc = bc; } [MitternachtCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task WheelOfFortune(int bet) { const int minBet = 10; if(bet < minBet) { await ReplyErrorLocalized("min_bet_limit", minBet + _bc.BotConfig.CurrencySign).ConfigureAwait(false); return; } if(!await _cs.RemoveAsync(Context.User.Id, "Wheel Of Fortune - bet", bet).ConfigureAwait(false)) { await ReplyErrorLocalized("not_enough", _bc.BotConfig.CurrencySign).ConfigureAwait(false); return; } var wof = new Wof(); var amount = (int)(bet * wof.Multiplier); if(amount > 0) await _cs.AddAsync(Context.User.Id, "Wheel Of Fortune - won", amount).ConfigureAwait(false); await Context.Channel.SendConfirmAsync( Format.Bold($@"{Context.User.ToString()} won: {amount + _bc.BotConfig.CurrencySign} 『{Wof.Multipliers[1]}』 『{Wof.Multipliers[0]}』 『{Wof.Multipliers[7]}』 『{Wof.Multipliers[2]}』 {wof.Emoji} 『{Wof.Multipliers[6]}』 『{Wof.Multipliers[3]}』 『{Wof.Multipliers[4]}』 『{Wof.Multipliers[5]}』")).ConfigureAwait(false); } } } }
mit
C#
865b8017b684a5c2efeee696581bf0acd0452b74
Decrease turn count for difficulty's sake
makerslocal/LudumDare38
bees-in-the-trap/Assets/Scripts/GameController.cs
bees-in-the-trap/Assets/Scripts/GameController.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GameController : MonoBehaviour { public static int STARTING_BEES = 3; public static int STARTING_POLLEN = 10; public static int TURN_COUNT = 10; private int turn = 1; private int bees; private int usableBees; private int pollen; private float bPressTimeStamp; public GameObject cursorObject; private Cursor cursor; private BoardGeneration b; public Text turnText; public Text beeText; public Text pollenText; // Use this for initialization void Start () { b = GameObject.FindGameObjectWithTag ("GameController").GetComponent<BoardGeneration> (); cursor = cursorObject.GetComponent<Cursor> (); bees = usableBees = STARTING_BEES; pollen = STARTING_POLLEN; beeText.text = usableBees + " / " + bees; pollenText.text = "" + pollen; turnText.text = "Turn " + turn + " / " + TURN_COUNT; bPressTimeStamp = 0f; } // Update is called once per frame void Update () { if (Input.GetKeyUp ("b")) { if (Time.time - bPressTimeStamp > 0.5f) { EndTurn (); bPressTimeStamp = 0f; } else { Buy (); bPressTimeStamp = 0f; } } if (Input.GetKeyDown ("b")) { bPressTimeStamp = Time.time; } } void Buy () { Hex h = cursor.GetSelectedHex (); if (usableBees >= h.beeCost && pollen >= h.pollenCost && !h.isActive && b.isHexPurchasable(h)) { h.ActivateHex (); b.AddPurchasableHexesAdjacentTo (b.GetIndexOfHex(h)); GameObject bee = h.transform.GetChild (0).gameObject; bee.GetComponent<Animator> ().SetBool ("IsPurchased", true); bee.GetComponent<SpriteRenderer> ().color = h.GetComponent<SpriteRenderer> ().color; bees += h.beeReward; usableBees -= h.beeCost; pollen -= h.pollenCost; beeText.text = usableBees + " / " + bees; pollenText.text = "" + pollen; } } void EndTurn () { while (usableBees-- > 0) { int r = Random.Range (0, 4); pollen += r; } usableBees = bees; beeText.text = usableBees + " / " + bees; pollenText.text = "" + pollen; if (++turn > TURN_COUNT) { Application.LoadLevel (0); // end the game } turnText.text = "Turn " + turn + " / " + TURN_COUNT; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GameController : MonoBehaviour { public static int STARTING_BEES = 3; public static int STARTING_POLLEN = 10; public static int TURN_COUNT = 20; private int turn = 1; private int bees; private int usableBees; private int pollen; private float bPressTimeStamp; public GameObject cursorObject; private Cursor cursor; private BoardGeneration b; public Text turnText; public Text beeText; public Text pollenText; // Use this for initialization void Start () { b = GameObject.FindGameObjectWithTag ("GameController").GetComponent<BoardGeneration> (); cursor = cursorObject.GetComponent<Cursor> (); bees = usableBees = STARTING_BEES; pollen = STARTING_POLLEN; beeText.text = usableBees + " / " + bees; pollenText.text = "" + pollen; turnText.text = "Turn " + turn + " / " + TURN_COUNT; bPressTimeStamp = 0f; } // Update is called once per frame void Update () { if (Input.GetKeyUp ("b")) { if (Time.time - bPressTimeStamp > 0.5f) { EndTurn (); bPressTimeStamp = 0f; } else { Buy (); bPressTimeStamp = 0f; } } if (Input.GetKeyDown ("b")) { bPressTimeStamp = Time.time; } } void Buy () { Hex h = cursor.GetSelectedHex (); if (usableBees >= h.beeCost && pollen >= h.pollenCost && !h.isActive && b.isHexPurchasable(h)) { h.ActivateHex (); b.AddPurchasableHexesAdjacentTo (b.GetIndexOfHex(h)); GameObject bee = h.transform.GetChild (0).gameObject; bee.GetComponent<Animator> ().SetBool ("IsPurchased", true); bee.GetComponent<SpriteRenderer> ().color = h.GetComponent<SpriteRenderer> ().color; bees += h.beeReward; usableBees -= h.beeCost; pollen -= h.pollenCost; beeText.text = usableBees + " / " + bees; pollenText.text = "" + pollen; } } void EndTurn () { while (usableBees-- > 0) { int r = Random.Range (0, 4); pollen += r; } usableBees = bees; beeText.text = usableBees + " / " + bees; pollenText.text = "" + pollen; if (++turn > TURN_COUNT) { Application.LoadLevel (0); // end the game } turnText.text = "Turn " + turn + " / " + TURN_COUNT; } }
mit
C#
9c3124346635161c806528002499c155a19b86be
Fix for the volunteer results page. Not finished.
andrewhart098/crisischeckin,jsucupira/crisischeckin,RyanBetker/crisischeckin,pottereric/crisischeckin,HTBox/crisischeckin,RyanBetker/crisischeckin,lloydfaulkner/crisischeckin,mjmilan/crisischeckin,djjlewis/crisischeckin,HTBox/crisischeckin,brunck/crisischeckin,mjmilan/crisischeckin,jsucupira/crisischeckin,lloydfaulkner/crisischeckin,RyanBetker/crisischeckinUpdates,RyanBetker/crisischeckinUpdates,andrewhart098/crisischeckin,andrewhart098/crisischeckin,HTBox/crisischeckin,brunck/crisischeckin,mjmilan/crisischeckin,brunck/crisischeckin,pottereric/crisischeckin,djjlewis/crisischeckin
crisischeckin/crisicheckinweb/Views/Volunteer/_FilterResults.cshtml
crisischeckin/crisicheckinweb/Views/Volunteer/_FilterResults.cshtml
@model IEnumerable<Models.Person> @{ ViewBag.Title = "_FilterResults"; } <style> table, tr, th, td { padding: 7px; border: 1px solid grey; } </style> <table> <tr> <th>Volunteer Name</th> <th>Email</th> <th>Phone</th> <th>Cluster</th> </tr> @if (Model != null) { foreach (var person in Model) { <tr> <td>@(person.LastName + ", " + person.FirstName)</td> <td>@person.Email</td> <td>@person.PhoneNumber</td> <td> @foreach (var commitment in person.Commitments) { @(Html.Encode(commitment.Cluster != null ? commitment.Cluster.Name : "")) } </td> </tr> } } </table>
@model IEnumerable<Models.Person> @{ ViewBag.Title = "_FilterResults"; } <style> table, tr, th, td { padding: 7px; border: 1px solid grey; } </style> <table> <tr> <th>Volunteer Name</th> <th>Email</th> <th>Phone</th> <th>Cluster</th> </tr> @if (Model != null) { foreach (var person in Model) { <tr> <td>@(person.LastName + ", " + person.FirstName)</td> <td>@person.Email</td> <td>@person.PhoneNumber</td> <td>@(Html.Encode(person.Cluster != null ? person.Cluster.Name : ""))</td> </tr> } } </table>
apache-2.0
C#
e5fa91e5fb95ce14aff5dab1e96adaf071438121
Make InMemoryFileSystem implement IFileSystem
appharbor/appharbor-cli
src/AppHarbor.Tests/InMemoryFileSystem.cs
src/AppHarbor.Tests/InMemoryFileSystem.cs
using System; using System.IO; namespace AppHarbor.Tests { public class InMemoryFileSystem : IFileSystem { public void Delete(string path) { throw new NotImplementedException(); } public Stream OpenRead(string path) { throw new NotImplementedException(); } public Stream OpenWrite(string path) { throw new NotImplementedException(); } } }
namespace AppHarbor.Tests { public class InMemoryFileSystem { } }
mit
C#