commit
stringlengths
40
40
old_file
stringlengths
4
237
new_file
stringlengths
4
237
old_contents
stringlengths
1
4.24k
new_contents
stringlengths
1
4.87k
subject
stringlengths
15
778
message
stringlengths
15
8.75k
lang
stringclasses
266 values
license
stringclasses
13 values
repos
stringlengths
5
127k
02a7ada6f13de462989a252a098e2143fb7fbb9d
AudioWorks/src/AudioWorks.Common/ConfigurationManager.cs
AudioWorks/src/AudioWorks.Common/ConfigurationManager.cs
using System; using System.IO; using System.Reflection; using JetBrains.Annotations; using Microsoft.Extensions.Configuration; namespace AudioWorks.Common { /// <summary> /// Manages the retrieval of configuration settings from disk. /// </summary> public static class ConfigurationManager { /// <summary> /// Gets the configuration. /// </summary> /// <value>The configuration.</value> [NotNull] [CLSCompliant(false)] public static IConfigurationRoot Configuration { get; } static ConfigurationManager() { var settingsPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "AudioWorks"); const string settingsFileName = "settings.json"; // Copy the settings template if the file doesn't already exist var settingsFile = Path.Combine(settingsPath, settingsFileName); if (!File.Exists(settingsFile)) { Directory.CreateDirectory(settingsPath); File.Copy( // ReSharper disable once AssignNullToNotNullAttribute Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), settingsFileName), settingsFile); } Configuration = new ConfigurationBuilder() .SetBasePath(settingsPath) .AddJsonFile(settingsFileName, true) .Build(); } } }
using System; using System.IO; using System.Reflection; using JetBrains.Annotations; using Microsoft.Extensions.Configuration; namespace AudioWorks.Common { /// <summary> /// Manages the retrieval of configuration settings from disk. /// </summary> public static class ConfigurationManager { /// <summary> /// Gets the configuration. /// </summary> /// <value>The configuration.</value> [NotNull] [CLSCompliant(false)] public static IConfigurationRoot Configuration { get; } static ConfigurationManager() { var settingsPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "AudioWorks"); const string settingsFileName = "settings.json"; // Copy the settings template if the file doesn't already exist var settingsFile = Path.Combine(settingsPath, settingsFileName); if (!File.Exists(settingsFile)) { Directory.CreateDirectory(settingsPath); File.Copy( Path.Combine( // ReSharper disable once AssignNullToNotNullAttribute Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), settingsFileName), settingsFile); } Configuration = new ConfigurationBuilder() .SetBasePath(settingsPath) .AddJsonFile(settingsFileName, true) .Build(); } } }
Correct issue where settings.json cannot be found when using a shadow copied DLL.
Correct issue where settings.json cannot be found when using a shadow copied DLL.
C#
agpl-3.0
jherby2k/AudioWorks
7b88cd194a07fc40642642ceca621ac8e8fbc18c
RohlikAPITests/RohlikovacTests.cs
RohlikAPITests/RohlikovacTests.cs
using System.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; using RohlikAPI; namespace RohlikAPITests { [TestClass] public class RohlikovacTests { private string[] GetCredentials() { string filePath = @"..\..\..\loginPassword.txt"; if (!File.Exists(filePath)) { throw new FileNotFoundException("Test needs credentials. Create 'loginPassword.txt' in solution root directory. Enter username@email.com:yourPassword on first line."); } var passwordString = File.ReadAllText(filePath); return passwordString.Split(':'); } [TestMethod] public void RunTest() { var login = GetCredentials(); var rohlikApi = new AuthenticatedRohlikApi(login[0], login[1]); var result = rohlikApi.RunRohlikovac(); if (result.Contains("error")) { Assert.Fail($"Failed to login to rohlik. Login used: {login[0]}"); } } } }
using System.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; using RohlikAPI; namespace RohlikAPITests { [TestClass] public class RohlikovacTests { private string[] GetCredentials() { string filePath = @"..\..\..\loginPassword.txt"; if (!File.Exists(filePath)) { throw new FileNotFoundException("Test needs credentials. Create 'loginPassword.txt' in solution root directory. Enter username@email.com:yourPassword on first line."); } var passwordString = File.ReadAllText(filePath); return passwordString.Split(':'); } [TestMethod, TestCategory("Authenticated")] public void RunTest() { var login = GetCredentials(); var rohlikApi = new AuthenticatedRohlikApi(login[0], login[1]); var result = rohlikApi.RunRohlikovac(); if (result.Contains("error")) { Assert.Fail($"Failed to login to rohlik. Login used: {login[0]}"); } } } }
Add test category to authenticated test
Add test category to authenticated test
C#
mit
xobed/RohlikAPI,xobed/RohlikAPI,xobed/RohlikAPI,notdev/RohlikAPI,xobed/RohlikAPI
92a6e6c6bc2a6e978c98efca92dc98b5a457ad8b
dotnet/samples/dotnet_send.cs
dotnet/samples/dotnet_send.cs
using System; using Reachmail.Easysmtp.Post.Request; public void Main() { var reachmail = Reachmail.Api.Create("<API Token>"); var request = new DeliveryRequest { FromAddress = "from@from.com", Recipients = new Recipients { new Recipient { Address = "to@to.com" } }, Subject = "Subject", BodyText = "Text", BodyHtml = "<p>html</p>", Headers = new Headers { { "name", "value" } }, Attachments = new Attachments { new EmailAttachment { Filename = "text.txt", Data = "b2ggaGFp", // Base64 encoded ContentType = "text/plain", ContentDisposition = "attachment", Cid = "<text.txt>" } }, Tracking = true, FooterAddress = "footer@footer.com", SignatureDomain = "signature.net" }; var result = reachmail.Easysmtp.Post(request); }
using System; using Reachmail.Easysmtp.Post.Request; public void Main() { var reachmail = Reachmail.Api.Create("<API Token>"); var request = new DeliveryRequest { FromAddress = "from@from.com", Recipients = new Recipients { new Recipient { Address = "to@to.com" } }, Subject = "Subject", BodyText = "Text", BodyHtml = "html", Headers = new Headers { { "name", "value" } }, Attachments = new Attachments { new EmailAttachment { Filename = "text.txt", Data = "b2ggaGFp", // Base64 encoded ContentType = "text/plain", ContentDisposition = "attachment", Cid = "<text.txt>" } }, Tracking = true, FooterAddress = "footer@footer.com", SignatureDomain = "signature.net" }; var result = reachmail.Easysmtp.Post(request); }
Tweak to content for display on ES marketing site
Tweak to content for display on ES marketing site Removed P tags from the HTML content node.
C#
mit
ReachmailInc/WebAPISamples,ReachmailInc/WebAPISamples,ReachmailInc/WebAPISamples,ReachmailInc/WebAPISamples,ReachmailInc/WebAPISamples,ReachmailInc/WebAPISamples,ReachmailInc/WebAPISamples
aa0ab9952519bc69715d7fb056f4305655a156a3
ContactsBot/Modules/UserMotd.cs
ContactsBot/Modules/UserMotd.cs
using System; using System.Collections.Generic; using System.Text; using System.Linq; using Discord; using Discord.WebSocket; using Discord.Commands; using System.Threading.Tasks; namespace ContactsBot.Modules { class UserMotd : IMessageAction { private DiscordSocketClient _client; private BotConfiguration _config; public bool IsEnabled { get; private set; } public void Install(IDependencyMap map) { _client = map.Get<DiscordSocketClient>(); _config = map.Get<BotConfiguration>(); } public void Enable() { _client.UserJoined += ShowMotd; IsEnabled = true; } public void Disable() { _client.UserJoined -= ShowMotd; IsEnabled = false; } public async Task ShowMotd(SocketGuildUser user) { var channel = await user.Guild.GetDefaultChannelAsync(); try { await channel.SendMessageAsync(String.Format(_config.MessageOfTheDay, user.Mention)); } catch (FormatException) { await channel.SendMessageAsync("Tell the admin to fix the MOTD formatting!"); } } } }
using System; using System.Collections.Generic; using System.Text; using System.Linq; using Discord; using Discord.WebSocket; using Discord.Commands; using System.Threading.Tasks; namespace ContactsBot.Modules { class UserMotd : IMessageAction { private DiscordSocketClient _client; private BotConfiguration _config; public bool IsEnabled { get; private set; } public void Install(IDependencyMap map) { _client = map.Get<DiscordSocketClient>(); _config = map.Get<BotConfiguration>(); } public void Enable() { _client.UserJoined += ShowMotd; IsEnabled = true; } public void Disable() { _client.UserJoined -= ShowMotd; IsEnabled = false; } public async Task ShowMotd(SocketGuildUser user) { var channel = await user.Guild.GetDefaultChannelAsync(); try { await (await user.CreateDMChannelAsync()).SendMessageAsync(String.Format(_config.MessageOfTheDay, user.Mention)); } catch (FormatException) { await channel.SendMessageAsync("Tell the admin to fix the MOTD formatting!"); } } } }
Send message as DM, not default channel
Send message as DM, not default channel
C#
mit
discord-csharp/Contacts,MarkusGordathian/Contacts
4151504ed8c6f20e964a862d8ccd9e1f89dad19b
Build/Program.cs
Build/Program.cs
using System; using Cake.Frosting; public class Program { public static int Main(string[] args) { return new CakeHost() .UseContext<Context>() .UseLifetime<Lifetime>() .UseWorkingDirectory("..") .InstallTool(new Uri("nuget:?package=GitVersion.CommandLine&version=5.0.1")) .InstallTool(new Uri("nuget:?package=Microsoft.TestPlatform&version=16.8.0")) .InstallTool(new Uri("nuget:?package=NUnitTestAdapter&version=2.3.0")) .InstallTool(new Uri("nuget:?package=NuGet.CommandLine&version=5.8.0")) .Run(args); } }
using System; using Cake.Frosting; public class Program { public static int Main(string[] args) { return new CakeHost() .UseContext<Context>() .UseLifetime<Lifetime>() .UseWorkingDirectory("..") .SetToolPath("../tools") .InstallTool(new Uri("nuget:?package=GitVersion.CommandLine&version=5.0.1")) .InstallTool(new Uri("nuget:?package=Microsoft.TestPlatform&version=16.8.0")) .InstallTool(new Uri("nuget:?package=NUnitTestAdapter&version=2.3.0")) .InstallTool(new Uri("nuget:?package=NuGet.CommandLine&version=5.8.0")) .Run(args); } }
Fix tools being installed to wrong path
Fix tools being installed to wrong path
C#
mit
nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,dnnsoftware/Dnn.Platform,bdukes/Dnn.Platform,mitchelsellers/Dnn.Platform,bdukes/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.Platform,valadas/Dnn.Platform,valadas/Dnn.Platform,nvisionative/Dnn.Platform,valadas/Dnn.Platform,nvisionative/Dnn.Platform,valadas/Dnn.Platform,bdukes/Dnn.Platform,mitchelsellers/Dnn.Platform,bdukes/Dnn.Platform,dnnsoftware/Dnn.Platform
8eec4001efcb93098ef2fa657a3e174925f2f218
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
using System.Reactive.Linq; using ReactiveUI; using System; namespace WalletWasabi.Fluent.ViewModels { public class AddWalletPageViewModel : NavBarItemViewModel { private string _walletName = ""; private bool _optionsEnabled; public AddWalletPageViewModel(NavigationStateViewModel navigationState) : base(navigationState, NavigationTarget.Dialog) { Title = "Add Wallet"; this.WhenAnyValue(x => x.WalletName) .Select(x => !string.IsNullOrWhiteSpace(x)) .Subscribe(x => OptionsEnabled = x); } public override string IconName => "add_circle_regular"; public string WalletName { get => _walletName; set => this.RaiseAndSetIfChanged(ref _walletName, value); } public bool OptionsEnabled { get => _optionsEnabled; set => this.RaiseAndSetIfChanged(ref _optionsEnabled, value); } } }
using System.Reactive.Linq; using ReactiveUI; using System; using System.Windows.Input; namespace WalletWasabi.Fluent.ViewModels { public class AddWalletPageViewModel : NavBarItemViewModel { private string _walletName = ""; private bool _optionsEnabled; public AddWalletPageViewModel(NavigationStateViewModel navigationState) : base(navigationState, NavigationTarget.Dialog) { Title = "Add Wallet"; BackCommand = ReactiveCommand.Create(() => navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear()); CancelCommand = ReactiveCommand.Create(() => navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear()); this.WhenAnyValue(x => x.WalletName) .Select(x => !string.IsNullOrWhiteSpace(x)) .Subscribe(x => OptionsEnabled = x); } public override string IconName => "add_circle_regular"; public ICommand BackCommand { get; } public ICommand CancelCommand { get; } public string WalletName { get => _walletName; set => this.RaiseAndSetIfChanged(ref _walletName, value); } public bool OptionsEnabled { get => _optionsEnabled; set => this.RaiseAndSetIfChanged(ref _optionsEnabled, value); } } }
Add back and cancel button commands
Add back and cancel button commands
C#
mit
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
f05ce1b951319683455bfc3d31a94668393c396b
Project/Util/SharedStructures.cs
Project/Util/SharedStructures.cs
using System.Collections.Generic; namespace Kazyx.RemoteApi { /// <summary> /// Response of getMethodTypes API. /// </summary> public class MethodType { /// <summary> /// Name of API /// </summary> public string Name { set; get; } /// <summary> /// Request parameter types. /// </summary> public List<string> ReqTypes { set; get; } /// <summary> /// Response parameter types. /// </summary> public List<string> ResTypes { set; get; } /// <summary> /// Version of API /// </summary> public string Version { set; get; } } /// <summary> /// Set of current value and its candidates. /// </summary> /// <typeparam name="T"></typeparam> public class Capability<T> { /// <summary> /// Current value of the specified parameter. /// </summary> public virtual T Current { set; get; } /// <summary> /// Candidate values of the specified parameter. /// </summary> public virtual List<T> Candidates { set; get; } public override bool Equals(object o) { var other = o as Capability<T>; if (!Current.Equals(other.Current)) { return false; } if (Candidates?.Count != other.Candidates?.Count) { return false; } for (int i = 0; i < Candidates.Count; i++) { if (!Candidates[i].Equals(other.Candidates[i])) { return false; } } return true; } } }
using System.Collections.Generic; using System.Linq; namespace Kazyx.RemoteApi { /// <summary> /// Response of getMethodTypes API. /// </summary> public class MethodType { /// <summary> /// Name of API /// </summary> public string Name { set; get; } /// <summary> /// Request parameter types. /// </summary> public List<string> ReqTypes { set; get; } /// <summary> /// Response parameter types. /// </summary> public List<string> ResTypes { set; get; } /// <summary> /// Version of API /// </summary> public string Version { set; get; } } /// <summary> /// Set of current value and its candidates. /// </summary> /// <typeparam name="T"></typeparam> public class Capability<T> { /// <summary> /// Current value of the specified parameter. /// </summary> public virtual T Current { set; get; } /// <summary> /// Candidate values of the specified parameter. /// </summary> public virtual List<T> Candidates { set; get; } public override bool Equals(object o) { var other = o as Capability<T>; if (other == null) { return false; } if (!Current.Equals(other.Current)) { return false; } if (Candidates?.Count != other.Candidates?.Count) { return false; } return Candidates.SequenceEqual(other.Candidates); } } }
Use SequenceEqual and check null
Use SequenceEqual and check null
C#
mit
kazyx/kz-remote-api
4a9bc29971ff72ac9f7eef8f6aaca7ba47f2e849
CefSharp.Wpf.Example/Handlers/GeolocationHandler.cs
CefSharp.Wpf.Example/Handlers/GeolocationHandler.cs
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; using System.Windows; namespace CefSharp.Wpf.Example.Handlers { internal class GeolocationHandler : IGeolocationHandler { bool IGeolocationHandler.OnRequestGeolocationPermission(IWebBrowser browserControl, IBrowser browser, string requestingUrl, int requestId, IGeolocationCallback callback) { using (callback) { var result = MessageBox.Show(String.Format("{0} wants to use your computer's location. Allow? ** You must set your Google API key in CefExample.Init() for this to work. **", requestingUrl), "Geolocation", MessageBoxButton.YesNo); callback.Continue(result == MessageBoxResult.Yes); return result == MessageBoxResult.Yes; } } void IGeolocationHandler.OnCancelGeolocationPermission(IWebBrowser browserControl, IBrowser browser, int requestId) { } } }
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; using System.Windows; namespace CefSharp.Wpf.Example.Handlers { internal class GeolocationHandler : IGeolocationHandler { bool IGeolocationHandler.OnRequestGeolocationPermission(IWebBrowser browserControl, IBrowser browser, string requestingUrl, int requestId, IGeolocationCallback callback) { //You can execute the callback inline //callback.Continue(true); //return true; //You can execute the callback in an `async` fashion //Open a message box on the `UI` thread and ask for user input. //You can open a form, or do whatever you like, just make sure you either //execute the callback or call `Dispose` as it's an `unmanaged` wrapper. var chromiumWebBrowser = (ChromiumWebBrowser)browserControl; chromiumWebBrowser.Dispatcher.BeginInvoke((Action)(() => { //Callback wraps an unmanaged resource, so we'll make sure it's Disposed (calling Continue will also Dipose of the callback, it's safe to dispose multiple times). using (callback) { var result = MessageBox.Show(String.Format("{0} wants to use your computer's location. Allow? ** You must set your Google API key in CefExample.Init() for this to work. **", requestingUrl), "Geolocation", MessageBoxButton.YesNo); //Execute the callback, to allow/deny the request. callback.Continue(result == MessageBoxResult.Yes); } })); //Yes we'd like to hadle this request ourselves. return true; } void IGeolocationHandler.OnCancelGeolocationPermission(IWebBrowser browserControl, IBrowser browser, int requestId) { } } }
Update the GelocationHandler example - seems people are still struggling with the callback concept.
Update the GelocationHandler example - seems people are still struggling with the callback concept.
C#
bsd-3-clause
jamespearce2006/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp,Livit/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp
56a68b664a39d62c910502f5beaf5e9dda66e8ed
MonoHaven.Client/UI/Remote/ServerInventoryWidget.cs
MonoHaven.Client/UI/Remote/ServerInventoryWidget.cs
using System.Drawing; using MonoHaven.UI.Widgets; namespace MonoHaven.UI.Remote { public class ServerInventoryWidget : ServerWidget { public static ServerWidget Create(ushort id, ServerWidget parent, object[] args) { var size = (Point)args[0]; var widget = new InventoryWidget(parent.Widget); widget.SetInventorySize(size); return new ServerInventoryWidget(id, parent, widget); } public ServerInventoryWidget(ushort id, ServerWidget parent, InventoryWidget widget) : base(id, parent, widget) { widget.Drop += (p) => SendMessage("drop", p); widget.Transfer += OnTransfer; } private void OnTransfer(TransferEventArgs e) { var mods = ServerInput.ToServerModifiers(e.Modifiers); SendMessage("xfer", e.Delta, mods); } } }
using System.Drawing; using MonoHaven.UI.Widgets; namespace MonoHaven.UI.Remote { public class ServerInventoryWidget : ServerWidget { public static ServerWidget Create(ushort id, ServerWidget parent, object[] args) { var size = (Point)args[0]; var widget = new InventoryWidget(parent.Widget); widget.SetInventorySize(size); return new ServerInventoryWidget(id, parent, widget); } private readonly InventoryWidget widget; public ServerInventoryWidget(ushort id, ServerWidget parent, InventoryWidget widget) : base(id, parent, widget) { this.widget = widget; this.widget.Drop += (p) => SendMessage("drop", p); this.widget.Transfer += OnTransfer; } public override void ReceiveMessage(string message, object[] args) { if (message == "sz") widget.SetInventorySize((Point)args[0]); else base.ReceiveMessage(message, args); } private void OnTransfer(TransferEventArgs e) { var mods = ServerInput.ToServerModifiers(e.Modifiers); SendMessage("xfer", e.Delta, mods); } } }
Handle message changing inventory size
Handle message changing inventory size
C#
mit
k-t/SharpHaven
e2a9f256b8eba0030eccc05463019aeb81e50dc1
WebScriptHook.Service/Program.cs
WebScriptHook.Service/Program.cs
using CommandLine; using System; using System.IO; using System.Threading; using WebScriptHook.Framework; using WebScriptHook.Framework.BuiltinPlugins; using WebScriptHook.Framework.Plugins; using WebScriptHook.Service.Plugins; namespace WebScriptHook.Service { class Program { static WebScriptHookComponent wshComponent; static void Main(string[] args) { string componentName = Guid.NewGuid().ToString(); Uri remoteUri; var options = new CommandLineOptions(); if (Parser.Default.ParseArguments(args, options)) { if (!string.IsNullOrWhiteSpace(options.Name)) componentName = options.Name; remoteUri = new Uri(options.ServerUriString); } else { return; } wshComponent = new WebScriptHookComponent(componentName, remoteUri, Console.Out, LogType.All); // Register custom plugins wshComponent.PluginManager.RegisterPlugin(new Echo()); wshComponent.PluginManager.RegisterPlugin(new PluginList()); wshComponent.PluginManager.RegisterPlugin(new PrintToScreen()); // Load plugins in plugins directory if dir exists if (Directory.Exists("plugins")) { var plugins = PluginLoader.LoadAllPluginsFromDir("plugins", "*.dll"); foreach (var plug in plugins) { wshComponent.PluginManager.RegisterPlugin(plug); } } // Start WSH component wshComponent.Start(); // TODO: Use a timer instead of Sleep while (true) { wshComponent.Update(); Thread.Sleep(100); } } } }
using CommandLine; using System; using System.IO; using System.Threading; using WebScriptHook.Framework; using WebScriptHook.Framework.BuiltinPlugins; using WebScriptHook.Framework.Plugins; using WebScriptHook.Service.Plugins; namespace WebScriptHook.Service { class Program { static WebScriptHookComponent wshComponent; static void Main(string[] args) { string componentName = Guid.NewGuid().ToString(); Uri remoteUri; var options = new CommandLineOptions(); if (Parser.Default.ParseArguments(args, options)) { if (!string.IsNullOrWhiteSpace(options.Name)) componentName = options.Name; remoteUri = new Uri(options.ServerUriString); } else { return; } wshComponent = new WebScriptHookComponent(componentName, remoteUri, TimeSpan.FromMilliseconds(30), Console.Out, LogType.All); // Register custom plugins wshComponent.PluginManager.RegisterPlugin(new Echo()); wshComponent.PluginManager.RegisterPlugin(new PluginList()); wshComponent.PluginManager.RegisterPlugin(new PrintToScreen()); // Load plugins in plugins directory if dir exists if (Directory.Exists("plugins")) { var plugins = PluginLoader.LoadAllPluginsFromDir("plugins", "*.dll"); foreach (var plug in plugins) { wshComponent.PluginManager.RegisterPlugin(plug); } } // Start WSH component wshComponent.Start(); // TODO: Use a timer instead of Sleep while (true) { wshComponent.Update(); Thread.Sleep(100); } } } }
Use polling rate of 30
Use polling rate of 30
C#
mit
LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC
7fd0175d643ad48af596013ce2350d13bef7cce3
WootzJs.Injection/Context.cs
WootzJs.Injection/Context.cs
using System; using System.Collections.Generic; namespace WootzJs.Injection { public class Context { private ICache cache; private IDictionary<Type, IBinding> transientBindings; public Context(Context context = null, ICache cache = null, IDictionary<Type, IBinding> transientBindings = null) { cache = cache ?? new Cache(); this.cache = context != null ? new HybridCache(cache, context.Cache) : cache; this.transientBindings = transientBindings; } public ICache Cache { get { return cache; } } public IBinding GetCustomBinding(Type type) { if (transientBindings == null) return null; IBinding result; transientBindings.TryGetValue(type, out result); return result; } } }
using System; using System.Collections.Generic; namespace WootzJs.Injection { public class Context { private ICache cache; private IDictionary<Type, IBinding> transientBindings; public Context(Context context = null, ICache cache = null, IDictionary<Type, IBinding> transientBindings = null) { cache = cache ?? new Cache(); this.cache = context != null ? new HybridCache(cache, context.Cache) : cache; this.transientBindings = transientBindings; } public ICache Cache { get { return cache; } } public IBinding GetCustomBinding(Type type) { if (transientBindings == null) return null; while (type != null) { IBinding result; if (transientBindings.TryGetValue(type, out result)) return result; type = type.BaseType; } return null; } } }
Fix handling of transient bindings to accomodate bindings that have been specified for an ancestral type
Fix handling of transient bindings to accomodate bindings that have been specified for an ancestral type
C#
mit
x335/WootzJs,kswoll/WootzJs,x335/WootzJs,kswoll/WootzJs,x335/WootzJs,kswoll/WootzJs
2cfd69eebb0e231fbf3c9024354ac0e37ea0c4f9
assets/CommonAssemblyInfo.cs
assets/CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyVersion("1.4.0.0")] [assembly: AssemblyFileVersion("1.4.0.0")] [assembly: AssemblyInformationalVersion("1.4.15")]
using System.Reflection; [assembly: AssemblyVersion("1.4.0.0")] [assembly: AssemblyFileVersion("1.4.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")]
Use 1.0.0 as the default informational version so it's easy to spot when it might have been un-patched during a build
Use 1.0.0 as the default informational version so it's easy to spot when it might have been un-patched during a build
C#
apache-2.0
merbla/serilog,vossad01/serilog,serilog/serilog,ajayanandgit/serilog,serilog/serilog,skomis-mm/serilog,CaioProiete/serilog,SaltyDH/serilog,richardlawley/serilog,Applicita/serilog,colin-young/serilog,adamchester/serilog,adamchester/serilog,colin-young/serilog,nblumhardt/serilog,zmaruo/serilog,joelweiss/serilog,Jaben/serilog,vorou/serilog,DavidSSL/serilog,JuanjoFuchs/serilog,khellang/serilog,clarkis117/serilog,harishjan/serilog,nblumhardt/serilog,harishjan/serilog,ravensorb/serilog,skomis-mm/serilog,ravensorb/serilog,jotautomation/serilog,joelweiss/serilog,merbla/serilog,clarkis117/serilog,redwards510/serilog
5a1f3c9364000fdf905bdd2b773d567367859e12
Source/Csla.test/Silverlight/Rollback/RollbackTests.cs
Source/Csla.test/Silverlight/Rollback/RollbackTests.cs
#if NUNIT using NUnit.Framework; using TestClass = NUnit.Framework.TestFixtureAttribute; using TestInitialize = NUnit.Framework.SetUpAttribute; using TestCleanup = NUnit.Framework.TearDownAttribute; using TestMethod = NUnit.Framework.TestAttribute; using TestSetup = NUnit.Framework.SetUpAttribute; #elif MSTEST using Microsoft.VisualStudio.TestTools.UnitTesting; #endif using UnitDriven; namespace Csla.Test.Silverlight.Rollback { #if SILVERLIGHT [TestClass] #endif public class RollbackTests : TestBase { #if SILVERLIGHT [TestMethod] public void UnintializedProperty_RollsBack_AfterCancelEdit() { var context = GetContext(); RollbackRoot.BeginCreateLocal((o, e) => { var item = e.Object; var initialValue = 0;// item.UnInitedP; item.BeginEdit(); item.UnInitedP = 1000; item.Another = "test"; item.CancelEdit(); context.Assert.AreEqual(initialValue, item.UnInitedP); context.Assert.Success(); }); context.Complete(); } #endif } }
#if NUNIT using NUnit.Framework; using TestClass = NUnit.Framework.TestFixtureAttribute; using TestInitialize = NUnit.Framework.SetUpAttribute; using TestCleanup = NUnit.Framework.TearDownAttribute; using TestMethod = NUnit.Framework.TestAttribute; using TestSetup = NUnit.Framework.SetUpAttribute; #elif MSTEST using Microsoft.VisualStudio.TestTools.UnitTesting; #endif using UnitDriven; namespace Csla.Test.Silverlight.Rollback { #if SILVERLIGHT [TestClass] #endif public class RollbackTests : TestBase { #if SILVERLIGHT [TestMethod] public void UnintializedProperty_RollsBack_AfterCancelEdit() { var context = GetContext(); RollbackRoot.BeginCreateLocal((o, e) => { context.Assert.Try(() => { var item = e.Object; var initialValue = 0;// item.UnInitedP; item.BeginEdit(); item.UnInitedP = 1000; item.Another = "test"; item.CancelEdit(); context.Assert.AreEqual(initialValue, item.UnInitedP); context.Assert.Success(); }); }); context.Complete(); } #endif } }
Add Try block. bugid: 623
Add Try block. bugid: 623
C#
mit
MarimerLLC/csla,JasonBock/csla,BrettJaner/csla,ronnymgm/csla-light,rockfordlhotka/csla,jonnybee/csla,ronnymgm/csla-light,BrettJaner/csla,ronnymgm/csla-light,MarimerLLC/csla,rockfordlhotka/csla,MarimerLLC/csla,jonnybee/csla,jonnybee/csla,JasonBock/csla,rockfordlhotka/csla,BrettJaner/csla,JasonBock/csla
95ef73bc40b66e5ed00af86f7b67d87271b84793
bindings/csharp/Context.cs
bindings/csharp/Context.cs
using System; using System.Runtime.InteropServices; namespace LibGPhoto2 { public class Context : Object { [DllImport ("libgphoto2.so")] internal static extern IntPtr gp_context_new (); public Context () { this.handle = new HandleRef (this, gp_context_new ()); } [DllImport ("libgphoto2.so")] internal static extern void gp_context_unref (HandleRef context); protected override void Cleanup () { System.Console.WriteLine ("cleanup context"); gp_context_unref(handle); } } }
using System; using System.Runtime.InteropServices; namespace LibGPhoto2 { public class Context : Object { [DllImport ("libgphoto2.so")] internal static extern IntPtr gp_context_new (); public Context () { this.handle = new HandleRef (this, gp_context_new ()); } [DllImport ("libgphoto2.so")] internal static extern void gp_context_unref (HandleRef context); protected override void Cleanup () { gp_context_unref(handle); } } }
Remove random context cleanup console output
Remove random context cleanup console output git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@8996 67ed7778-7388-44ab-90cf-0a291f65f57c
C#
lgpl-2.1
gphoto/libgphoto2,gphoto/libgphoto2,msmeissn/libgphoto2,gphoto/libgphoto2,msmeissn/libgphoto2,jbreeden/libgphoto2,thusoy/libgphoto2,jbreeden/libgphoto2,gphoto/libgphoto2,thusoy/libgphoto2,jbreeden/libgphoto2,thusoy/libgphoto2,msmeissn/libgphoto2,thusoy/libgphoto2,jbreeden/libgphoto2,msmeissn/libgphoto2,jbreeden/libgphoto2,msmeissn/libgphoto2,gphoto/libgphoto2,thusoy/libgphoto2,gphoto/libgphoto2
2176c0a2bfd28f3daf78be8b04537a86d09de2b6
Drums/VDrumExplorer.Data/Fields/IField.cs
Drums/VDrumExplorer.Data/Fields/IField.cs
// Copyright 2019 Jon Skeet. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. namespace VDrumExplorer.Data.Fields { public interface IField { string Description { get; } FieldPath Path { get; } ModuleAddress Address { get; } int Size { get; } public FieldCondition? Condition { get; } } }
// Copyright 2019 Jon Skeet. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. namespace VDrumExplorer.Data.Fields { public interface IField { string Description { get; } FieldPath Path { get; } ModuleAddress Address { get; } int Size { get; } FieldCondition? Condition { get; } } }
Remove redundant specification of public in interface
Remove redundant specification of public in interface
C#
apache-2.0
jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode
70f03052fb4accd42cf8edc3b943b46a044016be
UnityProject/Assets/Scripts/Objects/MessageOnInteract.cs
UnityProject/Assets/Scripts/Objects/MessageOnInteract.cs
using JetBrains.Annotations; using PlayGroups.Input; using UI; using UnityEngine; public class MessageOnInteract : InputTrigger { public string Message; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public override void Interact(GameObject originator, Vector3 position, string hand) { UIManager.Chat.AddChatEvent(new ChatEvent(Message, ChatChannel.Examine)); } }
using JetBrains.Annotations; using PlayGroups.Input; using UI; using UnityEngine; public class MessageOnInteract : InputTrigger { public string Message; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public override void Interact(GameObject originator, Vector3 position, string hand) { ChatRelay.Instance.AddToChatLogClient(Message, ChatChannel.Examine); } }
Use ChatRelay instead of UIManager when examining objects
Use ChatRelay instead of UIManager when examining objects
C#
agpl-3.0
krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation,Necromunger/unitystation,krille90/unitystation,Necromunger/unitystation,krille90/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation
454eec2acfaf731a28d30f2c5d7278486402f54c
src/StackExchange.Exceptional.Shared/Internal/Statics.cs
src/StackExchange.Exceptional.Shared/Internal/Statics.cs
namespace StackExchange.Exceptional.Internal { /// <summary> /// Internal Exceptional static controls, not meant for consumption. /// This can and probably will break without warning. Don't use the .Internal namespace directly. /// </summary> public static class Statics { /// <summary> /// Settings for context-less logging. /// </summary> /// <remarks> /// In ASP.NET (non-Core) this is populated by the ConfigSettings load. /// In ASP.NET Core this is populated by .Configure() in the DI pipeline. /// </remarks> public static ExceptionalSettingsBase Settings { get; set; } /// <summary> /// Returns whether an error passed in right now would be logged. /// </summary> public static bool IsLoggingEnabled { get; set; } = true; } }
namespace StackExchange.Exceptional.Internal { /// <summary> /// Internal Exceptional static controls, not meant for consumption. /// This can and probably will break without warning. Don't use the .Internal namespace directly. /// </summary> public static class Statics { /// <summary> /// Settings for context-less logging. /// </summary> /// <remarks> /// In ASP.NET (non-Core) this is populated by the ConfigSettings load. /// In ASP.NET Core this is populated by .Configure() in the DI pipeline. /// </remarks> public static ExceptionalSettingsBase Settings { get; set; } = new ExceptionalSettingsDefault(); /// <summary> /// Returns whether an error passed in right now would be logged. /// </summary> public static bool IsLoggingEnabled { get; set; } = true; } }
Make sure Settings is never null
Make sure Settings is never null
C#
apache-2.0
NickCraver/StackExchange.Exceptional,NickCraver/StackExchange.Exceptional
01eeda768f72f44f675295a425700bbf5971098e
Mappy/ExtensionMethods.cs
Mappy/ExtensionMethods.cs
namespace Mappy { using System; using System.ComponentModel; using System.Reactive.Linq; using System.Reactive.Subjects; public static class ExtensionMethods { public static IObservable<TField> PropertyAsObservable<TSource, TField>(this TSource source, Func<TSource, TField> accessor, string name) where TSource : INotifyPropertyChanged { var subject = new BehaviorSubject<TField>(accessor(source)); // FIXME: This is leaky. // We create a subscription to connect this to the subject // but we don't hold onto this subscription. // The subject we return can never be garbage collected // because the subscription cannot be freed. Observable.FromEventPattern<PropertyChangedEventHandler, PropertyChangedEventArgs>( x => source.PropertyChanged += x, x => source.PropertyChanged -= x) .Where(x => x.EventArgs.PropertyName == name) .Select(_ => accessor(source)) .Subscribe(subject); return subject; } } }
namespace Mappy { using System; using System.ComponentModel; using System.Reactive.Linq; using System.Reactive.Subjects; public static class ExtensionMethods { public static IObservable<TField> PropertyAsObservable<TSource, TField>(this TSource source, Func<TSource, TField> accessor, string name) where TSource : INotifyPropertyChanged { var obs = Observable.FromEventPattern<PropertyChangedEventHandler, PropertyChangedEventArgs>( x => source.PropertyChanged += x, x => source.PropertyChanged -= x) .Where(x => x.EventArgs.PropertyName == name) .Select(_ => accessor(source)) .Multicast(new BehaviorSubject<TField>(accessor(source))); // FIXME: This is leaky. // We create a connection here but don't hold on to the reference. // We can never unregister our event handler without this. obs.Connect(); return obs; } } }
Use multicast instead of explicit BehaviourSubject setup
Use multicast instead of explicit BehaviourSubject setup
C#
mit
MHeasell/Mappy,MHeasell/Mappy
83297ffc0ed1eaee60cf2e6b8cd8bb6e70b05d70
Framework/Interface/IMessageRecieverT.cs
Framework/Interface/IMessageRecieverT.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TirkxDownloader.Framework.Interface { /// <summary> /// This interface should be implemented for recieve JSON then parse it and return to caller /// </summary> /// <typeparam name="T">Type of message, must be JSON compatibility</typeparam> interface IMessageReciever<T> { ICollection<string> Prefixes { get; } bool IsRecieving { get; } Task<T> GetMessageAsync(); /// <summary> /// Call this method when terminate application /// </summary> void Close(); /// <summary> /// Call this method when you want to stop reciever /// </summary> void StopReciever(); } }
using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace TirkxDownloader.Framework.Interface { /// <summary> /// This interface should be implemented for recieve JSON then parse it and return to caller /// </summary> /// <typeparam name="T">Type of message, must be JSON compatibility</typeparam> public interface IMessageReciever<T> { ICollection<string> Prefixes { get; } bool IsRecieving { get; } Task<T> GetMessageAsync(); Task<T> GetMessageAsync(CancellationToken ct); /// <summary> /// Call this method when terminate application /// </summary> void Close(); } }
Delete stop reciever, to stop receiver use CancellationToken
Delete stop reciever, to stop receiver use CancellationToken
C#
mit
witoong623/TirkxDownloader,witoong623/TirkxDownloader
ef2ef28f3fdbb1156f496c8f7bb9c3601a84c534
NBitcoin/NullableShims.cs
NBitcoin/NullableShims.cs
#if NULLABLE_SHIMS using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] public sealed class MaybeNullWhenAttribute : Attribute { public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } public bool ReturnValue { get; } } } #endif
#if NULLABLE_SHIMS using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] internal sealed class MaybeNullWhenAttribute : Attribute { public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } public bool ReturnValue { get; } } } #endif
Change MaybeNullWhenAttribute to internal to remove collision with diagnostics ns
Change MaybeNullWhenAttribute to internal to remove collision with diagnostics ns
C#
mit
NicolasDorier/NBitcoin,MetacoSA/NBitcoin,MetacoSA/NBitcoin
43ebf710ab0ea438e37c12dee8676b33217a4ef0
src/Microsoft.AspNet.Server.Kestrel/ServerInformation.cs
src/Microsoft.AspNet.Server.Kestrel/ServerInformation.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNet.Hosting.Server; using Microsoft.Framework.Configuration; namespace Microsoft.AspNet.Server.Kestrel { public class ServerInformation : IServerInformation, IKestrelServerInformation { public ServerInformation() { Addresses = new List<ServerAddress>(); } public void Initialize(IConfiguration configuration) { var urls = configuration["server.urls"]; if (!string.IsNullOrEmpty(urls)) { urls = "http://+:5000/"; } foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { var address = ServerAddress.FromUrl(url); if (address != null) { Addresses.Add(address); } } } public string Name { get { return "Kestrel"; } } public IList<ServerAddress> Addresses { get; private set; } public int ThreadCount { get; set; } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNet.Hosting.Server; using Microsoft.Framework.Configuration; namespace Microsoft.AspNet.Server.Kestrel { public class ServerInformation : IServerInformation, IKestrelServerInformation { public ServerInformation() { Addresses = new List<ServerAddress>(); } public void Initialize(IConfiguration configuration) { var urls = configuration["server.urls"]; if (string.IsNullOrEmpty(urls)) { urls = "http://+:5000/"; } foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { var address = ServerAddress.FromUrl(url); if (address != null) { Addresses.Add(address); } } } public string Name { get { return "Kestrel"; } } public IList<ServerAddress> Addresses { get; private set; } public int ThreadCount { get; set; } } }
Fix regression in reading config
Fix regression in reading config
C#
apache-2.0
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
d79236736579088d02f7c767dbeeab07a2a5b3e4
Pdelvo.Minecraft.Protocol/Packets/DisplayScoreboard.cs
Pdelvo.Minecraft.Protocol/Packets/DisplayScoreboard.cs
using System; using Pdelvo.Minecraft.Network; namespace Pdelvo.Minecraft.Protocol.Packets { [PacketUsage(PacketUsage.ServerToClient)] public class DisplayScoreboard : Packet { public byte Position { get; set; } public string ScoreName { get; set; } /// <summary> /// Initializes a new instance of the <see cref="DisplayScoreboard" /> class. /// </summary> /// <remarks> /// </remarks> public DisplayScoreboard() { Code = 0xCF; } /// <summary> /// Receives the specified reader. /// </summary> /// <param name="reader"> The reader. </param> /// <param name="version"> The version. </param> /// <remarks> /// </remarks> protected override void OnReceive(BigEndianStream reader, int version) { if (reader == null) throw new ArgumentNullException("reader"); Position = reader.ReadByte(); ScoreName = reader.ReadString16(); } /// <summary> /// Sends the specified writer. /// </summary> /// <param name="writer"> The writer. </param> /// <param name="version"> The version. </param> /// <remarks> /// </remarks> protected override void OnSend(BigEndianStream writer, int version) { if (writer == null) throw new ArgumentNullException("writer"); writer.Write(Code); writer.Write(Position); writer.Write(ScoreName); } } }
using System; using Pdelvo.Minecraft.Network; namespace Pdelvo.Minecraft.Protocol.Packets { [PacketUsage(PacketUsage.ServerToClient)] public class DisplayScoreboard : Packet { public byte Position { get; set; } public string ScoreName { get; set; } /// <summary> /// Initializes a new instance of the <see cref="DisplayScoreboard" /> class. /// </summary> /// <remarks> /// </remarks> public DisplayScoreboard() { Code = 0xD0; } /// <summary> /// Receives the specified reader. /// </summary> /// <param name="reader"> The reader. </param> /// <param name="version"> The version. </param> /// <remarks> /// </remarks> protected override void OnReceive(BigEndianStream reader, int version) { if (reader == null) throw new ArgumentNullException("reader"); Position = reader.ReadByte(); ScoreName = reader.ReadString16(); } /// <summary> /// Sends the specified writer. /// </summary> /// <param name="writer"> The writer. </param> /// <param name="version"> The version. </param> /// <remarks> /// </remarks> protected override void OnSend(BigEndianStream writer, int version) { if (writer == null) throw new ArgumentNullException("writer"); writer.Write(Code); writer.Write(Position); writer.Write(ScoreName); } } }
Fix display scoreboard packet id
Fix display scoreboard packet id
C#
mit
pdelvo/Pdelvo.Minecraft
12dce77d512ec4231ddf5d20a78a9372da500380
ForecastPCL/Properties/AssemblyInfo.cs
ForecastPCL/Properties/AssemblyInfo.cs
using System.Resources; 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("ForecastPCL")] [assembly: AssemblyDescription("An unofficial PCL for the forecast.io weather API.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Jerome Cheng")] [assembly: AssemblyProduct("ForecastPCL")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // 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.4.0.0")] [assembly: AssemblyFileVersion("2.4.0.0")]
using System.Resources; 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("ForecastPCL")] [assembly: AssemblyDescription("An unofficial PCL for the forecast.io weather API.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Jerome Cheng")] [assembly: AssemblyProduct("ForecastPCL")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // 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.5.0.0")] [assembly: AssemblyFileVersion("2.5.0.0")]
Bump assembly version to 2.5.0.
Bump assembly version to 2.5.0.
C#
mit
jcheng31/DarkSkyApi,jcheng31/ForecastPCL
b50d3a21f84ef9351bfc2e79b59c81b1dc70ffc2
binding/TestFairy.iOS/StructsAndEnums.cs
binding/TestFairy.iOS/StructsAndEnums.cs
using System; using System.Runtime.InteropServices; using Foundation; // Generated by Objective Sharpie (https://download.xamarin.com/objective-sharpie/ObjectiveSharpie.pkg) // > sharpie bind -output TestFairy -namespace TestFairyLib -sdk iphoneos10.1 TestFairy.h namespace TestFairyLib { public static class CFunctions { // extern void TFLog (NSString *format, ...) __attribute__((format(NSString, 1, 2))); [DllImport ("__Internal")] public static extern void TFLog (NSString format, IntPtr varArgs); // extern void TFLogv (NSString *format, va_list arg_list); [DllImport ("__Internal")] public static extern unsafe void TFLogv (NSString format, sbyte* arg_list); } }
using System; using System.Runtime.InteropServices; using Foundation; // Generated by Objective Sharpie (https://download.xamarin.com/objective-sharpie/ObjectiveSharpie.pkg) // > sharpie bind -output TestFairy -namespace TestFairyLib -sdk iphoneos10.1 TestFairy.h namespace TestFairyLib { public static class CFunctions { // extern void TFLog (NSString *format, ...) __attribute__((format(NSString, 1, 2))); [DllImport ("__Internal")] public static extern void TFLog (IntPtr format, string arg0); // extern void TFLogv (NSString *format, va_list arg_list); [DllImport ("__Internal")] public static extern unsafe void TFLogv (IntPtr format, sbyte* arg_list); } }
Use native pointer for format string
Use native pointer for format string
C#
apache-2.0
testfairy/testfairy-xamarin
ab56bce5b15f69667988455feaf760c4eaadc9a6
osu.Framework/Graphics/UserInterface/DirectorySelectorDirectory.cs
osu.Framework/Graphics/UserInterface/DirectorySelectorDirectory.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using System; using System.IO; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Framework.Extensions.EnumExtensions; namespace osu.Framework.Graphics.UserInterface { public abstract class DirectorySelectorDirectory : DirectorySelectorItem { protected readonly DirectoryInfo Directory; protected override string FallbackName => Directory.Name; [Resolved] private Bindable<DirectoryInfo> currentDirectory { get; set; } protected DirectorySelectorDirectory(DirectoryInfo directory, string displayName = null) : base(displayName) { Directory = directory; try { bool isHidden = directory?.Attributes.HasFlagFast(FileAttributes.Hidden) == true; // On Windows, system drives are returned with `System | Hidden | Directory` file attributes, // but the expectation is that they shouldn't be shown in a hidden state. bool isSystemDrive = directory?.Parent == null; if (isHidden && !isSystemDrive) ApplyHiddenState(); } catch (UnauthorizedAccessException) { // checking attributes on access-controlled directories will throw an error so we handle it here to prevent a crash } } protected override bool OnClick(ClickEvent e) { currentDirectory.Value = Directory; return 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. #nullable disable using System; using System.IO; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Framework.Extensions.EnumExtensions; namespace osu.Framework.Graphics.UserInterface { public abstract class DirectorySelectorDirectory : DirectorySelectorItem { protected readonly DirectoryInfo Directory; protected override string FallbackName => Directory.Name; [Resolved] private Bindable<DirectoryInfo> currentDirectory { get; set; } protected DirectorySelectorDirectory(DirectoryInfo directory, string displayName = null) : base(displayName) { Directory = directory; try { bool isHidden = directory?.Attributes.HasFlagFast(FileAttributes.Hidden) == true; // On Windows, system drives are returned with `System | Hidden | Directory` file attributes, // but the expectation is that they shouldn't be shown in a hidden state. bool isSystemDrive = directory?.Parent == null; if (isHidden && !isSystemDrive) ApplyHiddenState(); } catch (IOException) { // various IO exceptions could occur when attempting to read attributes. // one example is when a target directory is a drive which is locked by BitLocker: // // "Unhandled exception. System.IO.IOException: This drive is locked by BitLocker Drive Encryption. You must unlock this drive from Control Panel. : 'D:\'" } catch (UnauthorizedAccessException) { // checking attributes on access-controlled directories will throw an error so we handle it here to prevent a crash } } protected override bool OnClick(ClickEvent e) { currentDirectory.Value = Directory; return true; } } }
Fix directory selector crashing when attempting to display a bitlocker locked drive
Fix directory selector crashing when attempting to display a bitlocker locked drive Closes #5477. Untested.
C#
mit
peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework
875bb611c10aad8ef315212f0e21c8c7ae304546
PinSharp/Http/FormUrlEncodedContent.cs
PinSharp/Http/FormUrlEncodedContent.cs
using System; using System.Collections.Generic; using System.Net.Http; using System.Net.Http.Headers; using System.Text; namespace PinSharp.Http { internal class FormUrlEncodedContent : ByteArrayContent { private static readonly Encoding DefaultHttpEncoding = Encoding.GetEncoding("ISO-8859-1"); public FormUrlEncodedContent(IEnumerable<KeyValuePair<string, string>> nameValueCollection) : base(GetContentByteArray(nameValueCollection)) { Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); } private static byte[] GetContentByteArray(IEnumerable<KeyValuePair<string, string>> nameValueCollection) { if (nameValueCollection == null) throw new ArgumentNullException(nameof(nameValueCollection)); var stringBuilder = new StringBuilder(); foreach (var keyValuePair in nameValueCollection) { if (stringBuilder.Length > 0) stringBuilder.Append('&'); stringBuilder.Append(Encode(keyValuePair.Key)); stringBuilder.Append('='); stringBuilder.Append(Encode(keyValuePair.Value)); } return DefaultHttpEncoding.GetBytes(stringBuilder.ToString()); } private static string Encode(string data) { return string.IsNullOrEmpty(data) ? "" : Uri.EscapeDataString(data).Replace("%20", "+"); } } }
using System; using System.Collections.Generic; using System.Net.Http; using System.Net.Http.Headers; using System.Text; namespace PinSharp.Http { internal class FormUrlEncodedContent : ByteArrayContent { private static readonly Encoding DefaultHttpEncoding = Encoding.GetEncoding("ISO-8859-1"); public FormUrlEncodedContent(IEnumerable<KeyValuePair<string, string>> nameValueCollection) : base(GetContentByteArray(nameValueCollection)) { Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); } private static byte[] GetContentByteArray(IEnumerable<KeyValuePair<string, string>> nameValueCollection) { if (nameValueCollection == null) throw new ArgumentNullException(nameof(nameValueCollection)); var stringBuilder = new StringBuilder(); foreach (var keyValuePair in nameValueCollection) { if (stringBuilder.Length > 0) stringBuilder.Append('&'); stringBuilder.Append(Encode(keyValuePair.Key)); stringBuilder.Append('='); stringBuilder.Append(Encode(keyValuePair.Value)); } return DefaultHttpEncoding.GetBytes(stringBuilder.ToString()); } private static string Encode(string data) { if (string.IsNullOrEmpty(data)) return ""; return EscapeLongDataString(data); } private static string EscapeLongDataString(string data) { // Uri.EscapeDataString() does not support strings longer than this const int maxLength = 65519; var sb = new StringBuilder(); var iterationsNeeded = data.Length / maxLength; for (var i = 0; i <= iterationsNeeded; i++) { sb.Append(i < iterationsNeeded ? Uri.EscapeDataString(data.Substring(maxLength * i, maxLength)) : Uri.EscapeDataString(data.Substring(maxLength * i))); } return sb.ToString().Replace("%20", "+"); } } }
Fix issue with long data string (e.g. base64)
Fix issue with long data string (e.g. base64) #13
C#
unlicense
Krusen/PinSharp
aa6538fba89c63a93eb4edd026fe366ceb0401df
source/XeroApi/Properties/AssemblyInfo.cs
source/XeroApi/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
using System.Reflection; using System.Runtime.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("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // 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.1")] [assembly: AssemblyFileVersion("1.1.0.1")]
Increment build number to match NuGet
Increment build number to match NuGet
C#
mit
jcvandan/XeroAPI.Net,TDaphneB/XeroAPI.Net,MatthewSteeples/XeroAPI.Net,XeroAPI/XeroAPI.Net
1c2d0ca33fe2b1dcf7f1580a89380774ae25ab16
src/DocumentDbTests/Bugs/Bug_2211_select_transform_inner_object.cs
src/DocumentDbTests/Bugs/Bug_2211_select_transform_inner_object.cs
using System; using System.Linq; using System.Threading.Tasks; using Bug2211; using Marten; using Marten.Testing.Harness; using Shouldly; using Weasel.Core; using Xunit; namespace DocumentDbTests.Bugs { public class Bug_2211_select_transform_inner_object: BugIntegrationContext { [Fact] public async Task should_be_able_to_select_nested_objects() { using var documentStore = SeparateStore(x => { x.AutoCreateSchemaObjects = AutoCreate.All; x.Schema.For<TestEntity>(); }); await documentStore.Advanced.Clean.DeleteAllDocumentsAsync(); await using var session = documentStore.OpenSession(); session.Store(new TestEntity { Name = "Test", Inner = new TestDto { Name = "TestDto" } }); await session.SaveChangesAsync(); await using var querySession = documentStore.QuerySession(); var results = await querySession.Query<TestEntity>() .Select(x => new { Inner = x.Inner }) .ToListAsync(); results.Count.ShouldBe(1); results[0].Inner.Name.ShouldBe("Test Dto"); } } } namespace Bug2211 { public class TestEntity { public Guid Id { get; set; } public string Name { get; set; } public TestDto Inner { get; set; } } public class TestDto { public string Name { get; set; } } }
using System; using System.Linq; using System.Threading.Tasks; using Bug2211; using Marten; using Marten.Testing.Harness; using Shouldly; using Weasel.Core; using Xunit; namespace DocumentDbTests.Bugs { public class Bug_2211_select_transform_inner_object: BugIntegrationContext { [Fact] public async Task should_be_able_to_select_nested_objects() { using var documentStore = SeparateStore(x => { x.AutoCreateSchemaObjects = AutoCreate.All; x.Schema.For<TestEntity>(); }); await documentStore.Advanced.Clean.DeleteAllDocumentsAsync(); await using var session = documentStore.OpenSession(); var testEntity = new TestEntity { Name = "Test", Inner = new TestDto { Name = "TestDto" } }; session.Store(testEntity); await session.SaveChangesAsync(); await using var querySession = documentStore.QuerySession(); var results = await querySession.Query<TestEntity>() .Select(x => new { Inner = x.Inner }) .ToListAsync(); results.Count.ShouldBe(1); results[0].Inner.Name.ShouldBe(testEntity.Inner.Name); } } } namespace Bug2211 { public class TestEntity { public Guid Id { get; set; } public string Name { get; set; } public TestDto Inner { get; set; } } public class TestDto { public string Name { get; set; } } }
Fix test referring to wrong value
Fix test referring to wrong value
C#
mit
ericgreenmix/marten,ericgreenmix/marten,ericgreenmix/marten,ericgreenmix/marten
767a40e9c1c07fbeac819b34b0fa9716ee9c74d2
Scripts/GameApi/Messages/ServerSpawnSceneObjectMessage.cs
Scripts/GameApi/Messages/ServerSpawnSceneObjectMessage.cs
using System.Collections; using System.Collections.Generic; using LiteNetLib.Utils; using UnityEngine; namespace LiteNetLibHighLevel { public class ServerSpawnSceneObjectMessage : LiteNetLibMessageBase { public uint objectId; public Vector3 position; public override void Deserialize(NetDataReader reader) { objectId = reader.GetUInt(); position = new Vector3(reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); } public override void Serialize(NetDataWriter writer) { writer.Put(objectId); writer.Put(position.x); writer.Put(position.y); writer.Put(position.z); } } }
using System.Collections; using System.Collections.Generic; using LiteNetLib.Utils; using UnityEngine; namespace LiteNetLibHighLevel { public class ServerSpawnSceneObjectMessage : ILiteNetLibMessage { public uint objectId; public Vector3 position; public void Deserialize(NetDataReader reader) { objectId = reader.GetUInt(); position = new Vector3(reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); } public void Serialize(NetDataWriter writer) { writer.Put(objectId); writer.Put(position.x); writer.Put(position.y); writer.Put(position.z); } } }
Change serialize/deserialze abstract class to interface
Change serialize/deserialze abstract class to interface
C#
mit
insthync/LiteNetLibManager,insthync/LiteNetLibManager
fd9b9b43878728173a297d615a59e8b35db917f3
src/FalconSharp/Properties/VersionInfo.cs
src/FalconSharp/Properties/VersionInfo.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18449 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ [assembly: System.Reflection.AssemblyVersion("1.0.*")] [assembly: System.Reflection.AssemblyInformationalVersion("0.1.2")]
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18449 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ [assembly: System.Reflection.AssemblyVersion("1.0.*")] [assembly: System.Reflection.AssemblyInformationalVersion("0.1.1")]
Set correct version number, v0.1.1
Set correct version number, v0.1.1
C#
mit
UmbrellaInc/FalconSharp,UmbrellaInc/FalconSharp
ab510cea704fa4a210e73f90cad77d8325492f80
Scripts/Converters/Vector2ToVector3.cs
Scripts/Converters/Vector2ToVector3.cs
using UnityEngine; namespace Pear.InteractionEngine.Converters { /// <summary> /// Converts a Vector2 to Vector3 /// </summary> public class Vector2ToVector3 : MonoBehaviour, IPropertyConverter<Vector2, Vector3> { public Vector3 Convert(Vector2 convertFrom) { return convertFrom; } } }
using System; using System.Collections.Generic; using UnityEngine; namespace Pear.InteractionEngine.Converters { /// <summary> /// Converts a Vector2 to Vector3 /// </summary> public class Vector2ToVector3 : MonoBehaviour, IPropertyConverter<Vector2, Vector3> { [Tooltip("Where should the X value be set")] public VectorFields SetXOn = VectorFields.X; [Tooltip("Multiplied on the X value when it's set")] public float XMultiplier = 1; [Tooltip("Where should the Y value be set")] public VectorFields SetYOn = VectorFields.X; [Tooltip("Multiplied on the Y value when it's set")] public float YMultiplier = 1; public Vector3 Convert(Vector2 convertFrom) { float x = 0; float y = 0; float z = 0; Dictionary<VectorFields, Action<float>> setActions = new Dictionary<VectorFields, Action<float>>() { { VectorFields.X, val => x = val }, { VectorFields.Y, val => y = val }, { VectorFields.Z, val => z = val }, }; setActions[SetXOn](convertFrom.x * XMultiplier); setActions[SetYOn](convertFrom.y * YMultiplier); return new Vector3(x, y, z); } } public enum VectorFields { X, Y, Z, } }
Add more features to vector 2 -> vector 3 conversion
Add more features to vector 2 -> vector 3 conversion
C#
mit
PearMed/Pear-Interaction-Engine
e7ff96c5bc327a0fc69941dc9715ea47bf2191db
src/keypay-dotnet/Properties/AssemblyInfo.cs
src/keypay-dotnet/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("KeyPay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("KeyPay")] [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("93365e33-3b92-4ea6-ab42-ffecbc504138")] // 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: AssemblyInformationalVersion("1.1.0.13-rc1")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("KeyPay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("KeyPay")] [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("93365e33-3b92-4ea6-ab42-ffecbc504138")] // 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: AssemblyInformationalVersion("1.1.0.13")] [assembly: AssemblyFileVersion("1.0.0.0")]
Add Employee Standard Hours endpoints
Add Employee Standard Hours endpoints
C#
mit
KeyPay/keypay-dotnet,KeyPay/keypay-dotnet,KeyPay/keypay-dotnet,KeyPay/keypay-dotnet
00d95ecfa1dc65b879b8d21c6b548d2d1e723e6c
Views/Home/Index.cshtml
Views/Home/Index.cshtml
@{ ViewBag.Title = "Home Page"; } <div class="col-md-5"> <h1> Vendo 5.0 </h1> <p class="lead">The Future of Vending Machines</p> <p class="text-justify"> Vendo 5.0 is among the first digitally integrated vending machines of the 21st century. It's so great, that we skipped the first four versions and went straight to 5. With Vendo 5.0, you have the ability to access our machines through your smartphone or P.C. Create an account with us and explore the Vendo lifestyle. You'll have access to each the machines in your area and the ability to control what the machine grabs for you. Whether it's candy, chips or soda, Vendo 5.0 can satisfy your nourishment. So, sign up today and live life the Vendo way! </p> </div> <img src="~/img/Vendo.png" class="center-block" /> <div class="row"> <div class="col-md-10 col-md-offset-1"> </div> </div> </div>
@{ ViewBag.Title = "Home Page"; } <div class="col-md-5"> <h1> Vendo 5.0 </h1> <p class="lead">The Future of Vending Machines</p> <p class="text-justify"> Vendo 5.0 is among the first digitally integrated vending machines of the 21st century. It's so great, that we skipped the first four versions and went straight to 5. With Vendo 5.0, you have the ability to access our machines through your smartphone or P.C. Create an account with us and explore the Vendo lifestyle. You'll have access to each the machines in your area and the ability to control what the machine grabs for you. Whether it's candy, chips or soda, Vendo 5.0 can satisfy your nourishment. So, sign up today and live life the Vendo way! </p> </div> <img src="~/img/Vendo.png" class="center-block" /> <img id="vendo" src='<%=ResolveUrl("~/img/Vendo.png") %>' /> <div class="row"> <div class="col-md-10 col-md-offset-1"> </div> </div>
Add code to allow vendo img to show on Azure
Add code to allow vendo img to show on Azure
C#
mit
jnnfrlocke/VendingMachineNew,jnnfrlocke/VendingMachineNew,jnnfrlocke/VendingMachineNew
68ba4388587ac8ca4644ece84f4ab140bd3d6be2
src/CommonAssemblyInfo.cs
src/CommonAssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Yevgeniy Shunevych")] [assembly: AssemblyProduct("Atata")] [assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2016")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("0.6.0.0")] [assembly: AssemblyFileVersion("0.6.0.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Yevgeniy Shunevych")] [assembly: AssemblyProduct("Atata")] [assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2016")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("0.7.0.0")] [assembly: AssemblyFileVersion("0.7.0.0")]
Increase project version number to 0.7.0
Increase project version number to 0.7.0
C#
apache-2.0
atata-framework/atata,YevgeniyShunevych/Atata,atata-framework/atata,YevgeniyShunevych/Atata
fd1936626783f64d45d3142f77115ed5e85266b3
LINQToTTree/LINQToTTreeLib/Variables/VarSimple.cs
LINQToTTree/LINQToTTreeLib/Variables/VarSimple.cs
using System; using LinqToTTreeInterfacesLib; namespace LINQToTTreeLib.Variables { /// <summary> /// A simple variable (like int, etc.). /// </summary> public class VarSimple : IVariable { public string VariableName { get; private set; } public string RawValue { get; private set; } public Type Type { get; private set; } public VarSimple(System.Type type) { if (type == null) throw new ArgumentNullException("Must have a good type!"); Type = type; VariableName = type.CreateUniqueVariableName(); RawValue = VariableName; } public IValue InitialValue { get; set; } public bool Declare { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } } }
using System; using LinqToTTreeInterfacesLib; namespace LINQToTTreeLib.Variables { /// <summary> /// A simple variable (like int, etc.). /// </summary> public class VarSimple : IVariable { public string VariableName { get; private set; } public string RawValue { get; private set; } public Type Type { get; private set; } public VarSimple(System.Type type) { if (type == null) throw new ArgumentNullException("Must have a good type!"); Type = type; VariableName = type.CreateUniqueVariableName(); RawValue = VariableName; } public IValue InitialValue { get; set; } /// <summary> /// Get/Set if this variable needs to be declared. /// </summary> public bool Declare { get; set; } } }
Add the ability to have a simple variable declared inline.
Add the ability to have a simple variable declared inline.
C#
lgpl-2.1
gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT
96f29c5696946c6f1365ea8f9e8d2318776f7915
samples/MvcSandbox/Startup.cs
samples/MvcSandbox/Startup.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace MvcSandbox { public class Startup { // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app) { app.UseDeveloperExceptionPage(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } public static void Main(string[] args) { var host = CreateWebHostBuilder(args) .Build(); host.Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => new WebHostBuilder() .UseContentRoot(Directory.GetCurrentDirectory()) .ConfigureLogging(factory => { factory .AddConsole() .AddDebug(); }) .UseIISIntegration() .UseKestrel() .UseStartup<Startup>(); } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace MvcSandbox { public class Startup { // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_2_1); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app) { app.UseDeveloperExceptionPage(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } public static void Main(string[] args) { var host = CreateWebHostBuilder(args) .Build(); host.Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => new WebHostBuilder() .UseContentRoot(Directory.GetCurrentDirectory()) .ConfigureLogging(factory => { factory .AddConsole() .AddDebug(); }) .UseIISIntegration() .UseKestrel() .UseStartup<Startup>(); } }
Use latest compat version in MvcSandbox
Use latest compat version in MvcSandbox
C#
apache-2.0
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
aa0639ac54889fd46ba4374951544198ac49a749
src/Squidex.Domain.Apps.Entities/Contents/ScheduleJob.cs
src/Squidex.Domain.Apps.Entities/Contents/ScheduleJob.cs
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System; using NodaTime; using Squidex.Domain.Apps.Core.Contents; using Squidex.Infrastructure; namespace Squidex.Domain.Apps.Entities.Contents { public sealed class ScheduleJob { public Guid Id { get; } public Status Status { get; } public RefToken ScheduledBy { get; } public Instant DueTime { get; } public ScheduleJob(Guid id, Status status, RefToken by, Instant due) { Id = id; ScheduledBy = by; Status = status; DueTime = due; } public static ScheduleJob Build(Status status, RefToken by, Instant due) { return new ScheduleJob(Guid.NewGuid(), status, by, due); } } }
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System; using NodaTime; using Squidex.Domain.Apps.Core.Contents; using Squidex.Infrastructure; namespace Squidex.Domain.Apps.Entities.Contents { public sealed class ScheduleJob { public Guid Id { get; } public Status Status { get; } public RefToken ScheduledBy { get; } public Instant DueTime { get; } public ScheduleJob(Guid id, Status status, RefToken scheduledBy, Instant due) { Id = id; ScheduledBy = scheduledBy; Status = status; DueTime = due; } public static ScheduleJob Build(Status status, RefToken by, Instant due) { return new ScheduleJob(Guid.NewGuid(), status, by, due); } } }
Fix deserialization of scheduled job.
Fix deserialization of scheduled job.
C#
mit
Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex
981dba4dde7fb08f48cd10b0926c0c04e1bb1e3c
src/Diploms.WebUI/Configuration/ControllerExtensions.cs
src/Diploms.WebUI/Configuration/ControllerExtensions.cs
using System.Linq; using Diploms.Dto; using Microsoft.AspNetCore.Mvc; namespace Diploms.WebUI { public static class ControllerExtensions { public static OperationResult GetErrors(this Controller controller, object model) { var result = new OperationResult(); if (model == null) { result.Errors.Add("Ошибка ввода данных"); } result.Errors.AddRange(controller.ModelState.Values.SelectMany(v => v.Errors .Where(b => !string.IsNullOrEmpty(b.ErrorMessage)) .Select(b => b.ErrorMessage))); return result; } } }
using System.Linq; using Diploms.Dto; using Microsoft.AspNetCore.Mvc; namespace Diploms.WebUI { public static class ControllerExtensions { public static OperationResult GetErrors(this Controller controller, object model) { var result = new OperationResult(); if (model == null) { result.Errors.Add("Ошибка ввода данных"); } result.Errors.AddRange(controller.ModelState.Values.SelectMany(v => v.Errors .Where(b => !string.IsNullOrEmpty(b.ErrorMessage)) .Select(b => b.ErrorMessage))); return result; } public static IActionResult Unprocessable(this Controller controller, object value) { return controller.StatusCode(422, value); } } }
Add special http method to return unprocessable entities
Add special http method to return unprocessable entities
C#
mit
denismaster/dcs,denismaster/dcs,denismaster/dcs,denismaster/dcs
29091f3fe2c7febbccf2d01b98ce798d95670547
src/HipChatConnect/Controllers/Listeners/Github/GithubAggregator.cs
src/HipChatConnect/Controllers/Listeners/Github/GithubAggregator.cs
using System.Linq; using System.Text; using System.Threading.Tasks; using HipChatConnect.Controllers.Listeners.Github.Models; using HipChatConnect.Controllers.Listeners.TeamCity; namespace HipChatConnect.Controllers.Listeners.Github { public class GithubAggregator { private IHipChatRoom Room { get; } public GithubAggregator(IHipChatRoom room) { Room = room; } public async Task Handle(GithubPushNotification notification) { await SendTeamsInformationAsync(notification); } private async Task SendTeamsInformationAsync(GithubPushNotification notification) { var githubModel = notification.GithubModel; (var title, var text) = BuildMessage(githubModel); var cardData = new SuccessfulTeamsActivityCardData { Title = title, Text = text }; await Room.SendTeamsActivityCardAsync(cardData); } private static (string Title, string Text) BuildMessage(GithubModel model) { var branch = model.Ref.Replace("refs/heads/", ""); var authorNames = model.Commits.Select(c => c.Author.Name).Distinct(); var title = $"**{string.Join(", ", authorNames)}** committed on [{branch}]({model.Repository.HtmlUrl + "/tree/" + branch})"; var stringBuilder = new StringBuilder(); foreach (var commit in model.Commits) { stringBuilder.Append($@"* {commit.Message} [{commit.Id.Substring(0, 11)}]({commit.Url})"); } return (title, stringBuilder.ToString()); } } }
using System.Linq; using System.Text; using System.Threading.Tasks; using HipChatConnect.Controllers.Listeners.Github.Models; using HipChatConnect.Controllers.Listeners.TeamCity; namespace HipChatConnect.Controllers.Listeners.Github { public class GithubAggregator { private IHipChatRoom Room { get; } public GithubAggregator(IHipChatRoom room) { Room = room; } public async Task Handle(GithubPushNotification notification) { await SendTeamsInformationAsync(notification); } private async Task SendTeamsInformationAsync(GithubPushNotification notification) { var githubModel = notification.GithubModel; (var title, var text) = BuildMessage(githubModel); var cardData = new SuccessfulTeamsActivityCardData { Title = title, Text = text }; await Room.SendTeamsActivityCardAsync(cardData); } private static (string Title, string Text) BuildMessage(GithubModel model) { var branch = model.Ref.Replace("refs/heads/", ""); var authorNames = model.Commits.Select(c => c.Author.Name).Distinct().ToList(); var title = $"{string.Join(", ", authorNames)} committed on {branch}"; var stringBuilder = new StringBuilder(); stringBuilder.AppendLine( $"**{string.Join(", ", authorNames)}** committed on [{branch}]({model.Repository.HtmlUrl + "/tree/" + branch})"); foreach (var commit in model.Commits) { stringBuilder.AppendLine($@"* {commit.Message} [{commit.Id.Substring(0, 11)}]({commit.Url})"); stringBuilder.AppendLine(); } return (title, stringBuilder.ToString()); } } }
Fix some formatting for Teams
Fix some formatting for Teams
C#
mit
laurentkempe/HipChatConnect,laurentkempe/HipChatConnect
bf1a7dfb850c7ea143372ea48e628edeb1cbd981
src/Chess-Demo/AppDelegate.cs
src/Chess-Demo/AppDelegate.cs
using System.Reflection; using Microsoft.Xna.Framework; using CocosDenshion; using CocosSharp; namespace Chess_Demo { class AppDelegate : CCApplicationDelegate { static CCWindow sharedWindow; public static CCWindow SharedWindow { get { return sharedWindow; } } public static CCSize DefaultResolution; public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "assets"; sharedWindow = mainWindow; DefaultResolution = new CCSize( application.MainWindow.WindowSizeInPixels.Width, application.MainWindow.WindowSizeInPixels.Height); CCScene scene = new CCScene(sharedWindow); sharedWindow.RunWithScene(scene); } public override void ApplicationDidEnterBackground(CCApplication application) { application.Paused = true; } public override void ApplicationWillEnterForeground(CCApplication application) { application.Paused = false; } } }
using System.Reflection; using Microsoft.Xna.Framework; using CocosDenshion; using CocosSharp; namespace Chess_Demo { class AppDelegate : CCApplicationDelegate { static CCWindow sharedWindow; public static CCWindow SharedWindow { get { return sharedWindow; } } public static CCSize DefaultResolution; public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "assets"; sharedWindow = mainWindow; DefaultResolution = new CCSize( application.MainWindow.WindowSizeInPixels.Width, application.MainWindow.WindowSizeInPixels.Height); CCScene scene = new CCScene(sharedWindow); scene.AddChild(new ChessLayer()); sharedWindow.RunWithScene(scene); } public override void ApplicationDidEnterBackground(CCApplication application) { application.Paused = true; } public override void ApplicationWillEnterForeground(CCApplication application) { application.Paused = false; } } }
Add Layer to scene. Currently breaking on asset load
Add Layer to scene. Currently breaking on asset load
C#
mit
HotPrawns/Jiemyu_Unity,HotPrawns/Jiemyu
672604ffe649779254dda0aa7967396f7d5d464b
MedallionOData.Samples.Web/Models/Provider.cs
MedallionOData.Samples.Web/Models/Provider.cs
using Medallion.OData.Sql; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Medallion.OData.Samples.Web.Models { public class Provider : DatabaseProvider { protected override string GetSqlTypeName(Trees.ODataExpressionType oDataType) { throw new NotImplementedException(); } protected override System.Collections.IEnumerable Execute(string sql, IReadOnlyList<Parameter> parameters, Type resultType) { throw new NotImplementedException(); } protected override int ExecuteCount(string sql, IReadOnlyList<Parameter> parameters) { throw new NotImplementedException(); } } }
using Medallion.OData.Service.Sql; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Medallion.OData.Samples.Web.Models { public class Provider : DatabaseProvider { protected override string GetSqlTypeName(Trees.ODataExpressionType oDataType) { throw new NotImplementedException(); } protected override System.Collections.IEnumerable Execute(string sql, IReadOnlyList<Parameter> parameters, Type resultType) { throw new NotImplementedException(); } protected override int ExecuteCount(string sql, IReadOnlyList<Parameter> parameters) { throw new NotImplementedException(); } } }
Build fix after namespace adjustment
Build fix after namespace adjustment
C#
mit
madelson/MedallionOData,madelson/MedallionOData,madelson/MedallionOData
604172bca0555166a6e99d96aa370e33f3872cc7
MemoryGames/MemoryGames/CardRandomPosition.cs
MemoryGames/MemoryGames/CardRandomPosition.cs
using System; using System.Collections.Generic; using System.Linq; namespace MemoryGames { public class CardRandomPosition { private List<CardFace> gameCard = new List<CardFace>(); private string[] cardName = new string[8];//here will be the name of the card private Random randomGenerator = new Random(); public static void FillMatrix() { } internal static CardFace[,] GetRandomCardFace() { throw new NotImplementedException(); } } }
using System; using System.Collections.Generic; using System.Linq; namespace MemoryGames { public class CardRandomPosition { public static CardFace[,] GetRandomCardFace(int dimentionZero, int dimentionOne) { const int pair = 2; const int pairCount = 9; CardFace[,] cardFace = new CardFace[dimentionZero, dimentionOne]; Random randomGenerator = new Random(); List<CardFace> gameCard = new List<CardFace>(); int allCard = dimentionZero * dimentionOne; int currentGameCardPair = allCard / pair; string[] cardName = new string[pairCount] { "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" }; for (int element = 0, j = 0; element < allCard; element++, j++) { if (j == currentGameCardPair) { j = 0; } gameCard.Add(new CardFace(cardName[j])); } for (int row = 0; row < dimentionZero; row++) { for (int col = 0; col < dimentionOne; col++) { int randomElement = randomGenerator.Next(0, gameCard.Count); cardFace[row, col] = gameCard[randomElement]; gameCard.RemoveAt(randomElement); } } return cardFace; } } }
Add random position of card
Add random position of card
C#
mit
TomaNikolov/MemoryGame
64f20d5b47ecfd62269764a8c360be60d3910614
Nodejs/Tests/AnalysisTests/SerializedAnalysisTests.cs
Nodejs/Tests/AnalysisTests/SerializedAnalysisTests.cs
/* **************************************************************************** * * Copyright (c) Microsoft Corporation. * * This source code is subject to terms and conditions of the Apache License, Version 2.0. A * copy of the license can be found in the License.html file at the root of this distribution. If * you cannot locate the Apache License, Version 2.0, please send an email to * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound * by the terms of the Apache License, Version 2.0. * * You must not remove this notice, or any other, from this software. * * ***************************************************************************/ using Microsoft.NodejsTools.Analysis; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace AnalysisTests { [TestClass] internal class SerializedAnalysisTests : AnalysisTests { internal override ModuleAnalysis ProcessText(string text) { return SerializationTests.RoundTrip(ProcessOneText(text)); } } }
/* **************************************************************************** * * Copyright (c) Microsoft Corporation. * * This source code is subject to terms and conditions of the Apache License, Version 2.0. A * copy of the license can be found in the License.html file at the root of this distribution. If * you cannot locate the Apache License, Version 2.0, please send an email to * vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound * by the terms of the Apache License, Version 2.0. * * You must not remove this notice, or any other, from this software. * * ***************************************************************************/ using Microsoft.NodejsTools.Analysis; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace AnalysisTests { [TestClass] public class SerializedAnalysisTests : AnalysisTests { internal override ModuleAnalysis ProcessText(string text) { return SerializationTests.RoundTrip(ProcessOneText(text)); } } }
Test needs to be public
Test needs to be public
C#
apache-2.0
zhoffice/nodejstools,hagb4rd/nodejstools,hoanhtien/nodejstools,necroscope/nodejstools,bowdenk7/nodejstools,mjbvz/nodejstools,paladique/nodejstools,Microsoft/nodejstools,redabakr/nodejstools,paladique/nodejstools,paladique/nodejstools,lukedgr/nodejstools,bowdenk7/nodejstools,paulvanbrenk/nodejstools,np83/nodejstools,avitalb/nodejstools,AustinHull/nodejstools,np83/nodejstools,kant2002/nodejstools,np83/nodejstools,redabakr/nodejstools,lukedgr/nodejstools,nareshjo/nodejstools,hoanhtien/nodejstools,AustinHull/nodejstools,paulvanbrenk/nodejstools,paladique/nodejstools,ahmad-farid/nodejstools,munyirik/nodejstools,np83/nodejstools,nareshjo/nodejstools,hoanhtien/nodejstools,chanchaldabriya/nodejstools,hagb4rd/nodejstools,mjbvz/nodejstools,munyirik/nodejstools,ahmad-farid/nodejstools,paulvanbrenk/nodejstools,mauricionr/nodejstools,Microsoft/nodejstools,Microsoft/nodejstools,zhoffice/nodejstools,mauricionr/nodejstools,bowdenk7/nodejstools,necroscope/nodejstools,munyirik/nodejstools,bossvn/nodejstools,bowdenk7/nodejstools,kant2002/nodejstools,np83/nodejstools,zhoffice/nodejstools,redabakr/nodejstools,hoanhtien/nodejstools,nareshjo/nodejstools,lukedgr/nodejstools,ahmad-farid/nodejstools,hoanhtien/nodejstools,mjbvz/nodejstools,munyirik/nodejstools,mousetraps/nodejstools,munyirik/nodejstools,chanchaldabriya/nodejstools,hagb4rd/nodejstools,hagb4rd/nodejstools,lukedgr/nodejstools,necroscope/nodejstools,zhoffice/nodejstools,necroscope/nodejstools,mousetraps/nodejstools,chanchaldabriya/nodejstools,mjbvz/nodejstools,AustinHull/nodejstools,redabakr/nodejstools,paulvanbrenk/nodejstools,zhoffice/nodejstools,redabakr/nodejstools,ahmad-farid/nodejstools,paladique/nodejstools,bossvn/nodejstools,mjbvz/nodejstools,mauricionr/nodejstools,kant2002/nodejstools,mauricionr/nodejstools,lukedgr/nodejstools,nareshjo/nodejstools,kant2002/nodejstools,bowdenk7/nodejstools,bossvn/nodejstools,mauricionr/nodejstools,Microsoft/nodejstools,paulvanbrenk/nodejstools,nareshjo/nodejstools,ahmad-farid/nodejstools,avitalb/nodejstools,hagb4rd/nodejstools,bossvn/nodejstools,AustinHull/nodejstools,mousetraps/nodejstools,AustinHull/nodejstools,bossvn/nodejstools,mousetraps/nodejstools,kant2002/nodejstools,chanchaldabriya/nodejstools,Microsoft/nodejstools,avitalb/nodejstools,necroscope/nodejstools,chanchaldabriya/nodejstools,avitalb/nodejstools,avitalb/nodejstools,mousetraps/nodejstools
e2e6b8e4cb174d46d50812887e13d8c8e1657654
Battery-Commander.Web/Controllers/API/WeaponsController.cs
Battery-Commander.Web/Controllers/API/WeaponsController.cs
using BatteryCommander.Web.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace BatteryCommander.Web.Controllers.API { public class WeaponsController : ApiController { public WeaponsController(Database db) : base(db) { // Nothing to do here } [HttpGet] public async Task<IEnumerable<dynamic>> Get() { // GET: api/weapons return await db .Weapons .Select(_ => new { _.Id, _.OpticSerial, _.OpticType, _.Serial, _.StockNumber, _.Type, _.UnitId }) .ToListAsync(); } [HttpPost] public async Task<IActionResult> Post([FromBody]Weapon weapon) { await db.Weapons.AddAsync(weapon); await db.SaveChangesAsync(); return Ok(); } [HttpDelete] public async Task<IActionResult> Delete(int id) { var weapon = await db.Weapons.FindAsync(id); db.Weapons.Remove(weapon); await db.SaveChangesAsync(); return Ok(); } } }
using BatteryCommander.Web.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using System.Linq; using System.Threading.Tasks; namespace BatteryCommander.Web.Controllers.API { public class WeaponsController : ApiController { public WeaponsController(Database db) : base(db) { // Nothing to do here } [HttpGet] public async Task<IActionResult> Get(int? unit) { // GET: api/weapons return Ok( await db .Weapons .Where(weapon => !unit.HasValue || weapon.UnitId == unit) .Select(_ => new { _.Id, _.OpticSerial, _.OpticType, _.Serial, _.StockNumber, _.Type, _.UnitId }) .ToListAsync()); } [HttpPost] public async Task<IActionResult> Post([FromBody]Weapon weapon) { await db.Weapons.AddAsync(weapon); await db.SaveChangesAsync(); return Ok(); } [HttpDelete] public async Task<IActionResult> Delete(int id) { var weapon = await db.Weapons.FindAsync(id); db.Weapons.Remove(weapon); await db.SaveChangesAsync(); return Ok(); } } }
Allow filtering weapons by unit
Allow filtering weapons by unit
C#
mit
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
f002dae2e57c0f2ac33b430f7117a08b12879ddd
tests/Auth0.ManagementApi.IntegrationTests/TestBase.cs
tests/Auth0.ManagementApi.IntegrationTests/TestBase.cs
using System.Threading.Tasks; using Auth0.AuthenticationApi; using Auth0.AuthenticationApi.Models; using Microsoft.Extensions.Configuration; namespace Auth0.Tests.Shared { public class TestBase { private readonly IConfigurationRoot _config; public TestBase() { _config = new ConfigurationBuilder() .AddJsonFile("client-secrets.json", true) .AddEnvironmentVariables() .Build(); } protected async Task<string> GenerateManagementApiToken() { var authenticationApiClient = new AuthenticationApiClient(GetVariable("AUTH0_AUTHENTICATION_API_URL")); // Get the access token var token = await authenticationApiClient.GetTokenAsync(new ClientCredentialsTokenRequest { ClientId = GetVariable("AUTH0_MANAGEMENT_API_CLIENT_ID"), ClientSecret = GetVariable("AUTH0_MANAGEMENT_API_CLIENT_SECRET"), Audience = GetVariable("AUTH0_MANAGEMENT_API_AUDIENCE") }); return token.AccessToken; } protected string GetVariable(string variableName) { return _config[variableName]; } } }
using System; using System.Threading.Tasks; using Auth0.AuthenticationApi; using Auth0.AuthenticationApi.Models; using Microsoft.Extensions.Configuration; namespace Auth0.Tests.Shared { public class TestBase { private readonly IConfigurationRoot _config; public TestBase() { _config = new ConfigurationBuilder() .AddJsonFile("client-secrets.json", true) .AddEnvironmentVariables() .Build(); } protected async Task<string> GenerateManagementApiToken() { var authenticationApiClient = new AuthenticationApiClient(GetVariable("AUTH0_AUTHENTICATION_API_URL")); // Get the access token var token = await authenticationApiClient.GetTokenAsync(new ClientCredentialsTokenRequest { ClientId = GetVariable("AUTH0_MANAGEMENT_API_CLIENT_ID"), ClientSecret = GetVariable("AUTH0_MANAGEMENT_API_CLIENT_SECRET"), Audience = GetVariable("AUTH0_MANAGEMENT_API_AUDIENCE") }); return token.AccessToken; } protected string GetVariable(string variableName) { var value = _config[variableName]; if (String.IsNullOrEmpty(value)) throw new ArgumentOutOfRangeException($"Configuration value '{variableName}' has not been set."); return value; } } }
Check configuration values are set in tests
Check configuration values are set in tests
C#
mit
auth0/auth0.net,auth0/auth0.net
892f0729e7262dc48eb6a0a985f4a9fb7470f75a
Samples/Configuration/ConfigurationConsole/Program.cs
Samples/Configuration/ConfigurationConsole/Program.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="Program.cs" company="Quartz Software SRL"> // Copyright (c) Quartz Software SRL. All rights reserved. // </copyright> // <summary> // Implements the program class. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace ConfigurationConsole { using System.Runtime.Loader; using System.Threading.Tasks; using StartupConsole.Application; class Program { public static async Task Main(string[] args) { AssemblyLoadContext.Default.Resolving += (context, name) => { if (name.Name.EndsWith(".resources")) { return null; } return null; }; await new ConsoleShell().BootstrapAsync(args); } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="Program.cs" company="Quartz Software SRL"> // Copyright (c) Quartz Software SRL. All rights reserved. // </copyright> // <summary> // Implements the program class. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace ConfigurationConsole { using System.Runtime.Loader; using System.Threading.Tasks; using StartupConsole.Application; class Program { public static async Task Main(string[] args) { //AssemblyLoadContext.Default.Resolving += (context, name) => // { // if (name.Name.EndsWith(".resources")) // { // return null; // } // return null; // }; await new ConsoleShell().BootstrapAsync(args); } } }
Comment out the resource not found fix for .NET Core
Comment out the resource not found fix for .NET Core
C#
mit
quartz-software/kephas,quartz-software/kephas
2e2e229d2f2d62e09afbe9099ac8f97d59c710f7
Components/TemplateHelpers/Images/Ratio.cs
Components/TemplateHelpers/Images/Ratio.cs
using System; namespace Satrabel.OpenContent.Components.TemplateHelpers { public class Ratio { private readonly float _ratio; public int Width { get; private set; } public int Height { get; private set; } public float AsFloat { get { return (float)Width / (float)Height); } } public Ratio(string ratioString) { Width = 1; Height = 1; var elements = ratioString.ToLowerInvariant().Split('x'); if (elements.Length == 2) { int leftPart; int rightPart; if (int.TryParse(elements[0], out leftPart) && int.TryParse(elements[1], out rightPart)) { Width = leftPart; Height = rightPart; } } _ratio = AsFloat; } public Ratio(int width, int height) { if (width < 1) throw new ArgumentOutOfRangeException("width", width, "should be 1 or larger"); if (height < 1) throw new ArgumentOutOfRangeException("height", height, "should be 1 or larger"); Width = width; Height = height; _ratio = AsFloat; } public void SetWidth(int newWidth) { Width = newWidth; Height = Convert.ToInt32(newWidth / _ratio); } public void SetHeight(int newHeight) { Width = Convert.ToInt32(newHeight * _ratio); Height = newHeight; } } }
using System; namespace Satrabel.OpenContent.Components.TemplateHelpers { public class Ratio { private readonly float _ratio; public int Width { get; private set; } public int Height { get; private set; } public float AsFloat { get { return (float)Width / (float)Height; } } public Ratio(string ratioString) { Width = 1; Height = 1; var elements = ratioString.ToLowerInvariant().Split('x'); if (elements.Length == 2) { int leftPart; int rightPart; if (int.TryParse(elements[0], out leftPart) && int.TryParse(elements[1], out rightPart)) { Width = leftPart; Height = rightPart; } } _ratio = AsFloat; } public Ratio(int width, int height) { if (width < 1) throw new ArgumentOutOfRangeException("width", width, "should be 1 or larger"); if (height < 1) throw new ArgumentOutOfRangeException("height", height, "should be 1 or larger"); Width = width; Height = height; _ratio = AsFloat; } public void SetWidth(int newWidth) { Width = newWidth; Height = Convert.ToInt32(newWidth / _ratio); } public void SetHeight(int newHeight) { Width = Convert.ToInt32(newHeight * _ratio); Height = newHeight; } } }
Fix issue where ratio was always returning "1"
Fix issue where ratio was always returning "1"
C#
mit
janjonas/OpenContent,janjonas/OpenContent,janjonas/OpenContent,janjonas/OpenContent,janjonas/OpenContent
abf4cadab49e7baac51700029f29181550924e8c
Source/TeaCommerce.Umbraco.Application/Caching/UmbracoRuntimeCacheService.cs
Source/TeaCommerce.Umbraco.Application/Caching/UmbracoRuntimeCacheService.cs
using System; using TeaCommerce.Api.Dependency; using TeaCommerce.Api.Infrastructure.Caching; using Umbraco.Core; using Umbraco.Core.Cache; namespace TeaCommerce.Umbraco.Application.Caching { [SuppressDependency("TeaCommerce.Api.Infrastructure.Caching.ICacheService", "TeaCommerce.Api")] public class UmbracoRuntimeCacheService : ICacheService { private IRuntimeCacheProvider _runtimeCache; public UmbracoRuntimeCacheService() : this(ApplicationContext.Current.ApplicationCache.RuntimeCache) { } public UmbracoRuntimeCacheService(IRuntimeCacheProvider runtimeCache) { _runtimeCache = runtimeCache; } public T GetCacheValue<T>(string cacheKey) where T : class { return (T)_runtimeCache.GetCacheItem($"TeaCommerce_{cacheKey}"); } public void Invalidate(string cacheKey) { _runtimeCache.ClearCacheItem($"TeaCommerce_{cacheKey}"); } public void SetCacheValue(string cacheKey, object cacheValue) { _runtimeCache.InsertCacheItem($"TeaCommerce_{cacheKey}", () => cacheValue); } public void SetCacheValue(string cacheKey, object cacheValue, TimeSpan cacheDuration) { _runtimeCache.InsertCacheItem($"TeaCommerce_{cacheKey}", () => cacheValue, cacheDuration); } } }
using System; using TeaCommerce.Api.Dependency; using TeaCommerce.Api.Infrastructure.Caching; using Umbraco.Core; using Umbraco.Core.Cache; namespace TeaCommerce.Umbraco.Application.Caching { [SuppressDependency("TeaCommerce.Api.Infrastructure.Caching.ICacheService", "TeaCommerce.Api")] public class UmbracoRuntimeCacheService : ICacheService { private IRuntimeCacheProvider _runtimeCache; public UmbracoRuntimeCacheService() : this(ApplicationContext.Current.ApplicationCache.RuntimeCache) { } public UmbracoRuntimeCacheService(IRuntimeCacheProvider runtimeCache) { _runtimeCache = runtimeCache; } public T GetCacheValue<T>(string cacheKey) where T : class { return (T)_runtimeCache.GetCacheItem($"TeaCommerce_{cacheKey}"); } public void Invalidate(string cacheKey) { _runtimeCache.ClearCacheItem($"TeaCommerce_{cacheKey}"); } public void SetCacheValue(string cacheKey, object cacheValue) { _runtimeCache.InsertCacheItem($"TeaCommerce_{cacheKey}", () => cacheValue); } public void SetCacheValue(string cacheKey, object cacheValue, TimeSpan cacheDuration) { _runtimeCache.InsertCacheItem($"TeaCommerce_{cacheKey}", () => cacheValue, cacheDuration, true); } } }
Enable sliding expiration by default as that is what the Tea Commerce cache does
Enable sliding expiration by default as that is what the Tea Commerce cache does
C#
mit
TeaCommerce/Tea-Commerce-for-Umbraco,TeaCommerce/Tea-Commerce-for-Umbraco,TeaCommerce/Tea-Commerce-for-Umbraco
82ec97343a604e166d3667cfaca758027d8a344d
code_examples/01-SubcutaneousTestsVsImplementationTests/subcutaneous-test.cs
code_examples/01-SubcutaneousTestsVsImplementationTests/subcutaneous-test.cs
public class StudentControllerTests { [SetUp] public void Setup() { _fixture = new DatabaseFixture(); _controller = new StudentController(new StudentRepository(_fixture.Context)); } [Test] public void IndexAction_ShowsAllStudentsOrderedByName() { var expectedStudents = new List<Student> { new Student("Joe", "Bloggs"), new Student("Jane", "Smith") }; expectedStudents.ForEach(_fixture.SeedContext.Students.Add) _fixture.SeedContext.SaveChanges(); List<StudentViewModel> viewModel; _controller.Index() .ShouldRenderDefaultView() .WithModel<List<StudentViewModel>>(vm => viewModel = vm); viewModel.Select(s => s.Name).ShouldBe( _existingStudents.OrderBy(s => s.FullName).Select(s => s.FullName)) } private StudentController _controller; private DatabaseFixture _fixture; }
public class StudentControllerTests { [SetUp] public void Setup() { _fixture = new DatabaseFixture(); _controller = new StudentController(new StudentRepository(_fixture.Context)); } [Test] public void IndexAction_ShowsAllStudentsOrderedByName() { var expectedStudents = new List<Student> { new Student("Joe", "Bloggs"), new Student("Jane", "Smith") }; expectedStudents.ForEach(_fixture.SeedContext.Students.Add) _fixture.SeedContext.SaveChanges(); List<StudentViewModel> viewModel; _controller.Index() .ShouldRenderDefaultView() .WithModel<List<StudentViewModel>>(vm => viewModel = vm); viewModel.Select(s => s.Name).ShouldBe( _existingStudents.OrderBy(s => s.FullName).Select(s => s.FullName)); } private StudentController _controller; private DatabaseFixture _fixture; }
Fix a missing semicolon in an example
Fix a missing semicolon in an example
C#
mit
MRCollective/MicrotestingPresentation
6b8e4b5111f6d73c9563800bc1cb0a4462b1d088
source/plugin/Assets/GoogleMobileAds/Editor/GoogleMobileAdsSettingsEditor.cs
source/plugin/Assets/GoogleMobileAds/Editor/GoogleMobileAdsSettingsEditor.cs
using UnityEditor; using UnityEngine; namespace GoogleMobileAds.Editor { [InitializeOnLoad] [CustomEditor(typeof(GoogleMobileAdsSettings))] public class GoogleMobileAdsSettingsEditor : UnityEditor.Editor { [MenuItem("Assets/Google Mobile Ads/Settings...")] public static void OpenInspector() { Selection.activeObject = GoogleMobileAdsSettings.Instance; if (GoogleMobileAdsSettings.Instance.DelayAppMeasurementInit) { EditorGUILayout.HelpBox( "Delays app measurement until you explicitly initialize the Mobile Ads SDK or load an ad.", MessageType.Info); } EditorGUI.indentLevel--; EditorGUILayout.Separator(); if (GUI.changed) { OnSettingsChanged(); } } private void OnSettingsChanged() { EditorUtility.SetDirty((GoogleMobileAdsSettings) target); GoogleMobileAdsSettings.Instance.WriteSettingsToFile(); } } }
using UnityEditor; using UnityEngine; namespace GoogleMobileAds.Editor { [InitializeOnLoad] [CustomEditor(typeof(GoogleMobileAdsSettings))] public class GoogleMobileAdsSettingsEditor : UnityEditor.Editor { [MenuItem("Assets/Google Mobile Ads/Settings...")] public static void OpenInspector() { Selection.activeObject = GoogleMobileAdsSettings.Instance; } public override void OnInspectorGUI() { EditorGUILayout.LabelField("Google Mobile Ads App ID", EditorStyles.boldLabel); EditorGUI.indentLevel++; GoogleMobileAdsSettings.Instance.GoogleMobileAdsAndroidAppId = EditorGUILayout.TextField("Android", GoogleMobileAdsSettings.Instance.GoogleMobileAdsAndroidAppId); GoogleMobileAdsSettings.Instance.GoogleMobileAdsIOSAppId = EditorGUILayout.TextField("iOS", GoogleMobileAdsSettings.Instance.GoogleMobileAdsIOSAppId); EditorGUILayout.HelpBox( "Google Mobile Ads App ID will look similar to this sample ID: ca-app-pub-3940256099942544~3347511713", MessageType.Info); EditorGUI.indentLevel--; EditorGUILayout.Separator(); EditorGUILayout.LabelField("AdMob-specific settings", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); GoogleMobileAdsSettings.Instance.DelayAppMeasurementInit = EditorGUILayout.Toggle(new GUIContent("Delay app measurement"), GoogleMobileAdsSettings.Instance.DelayAppMeasurementInit); if (GoogleMobileAdsSettings.Instance.DelayAppMeasurementInit) { EditorGUILayout.HelpBox( "Delays app measurement until you explicitly initialize the Mobile Ads SDK or load an ad.", MessageType.Info); } EditorGUI.indentLevel--; EditorGUILayout.Separator(); if (GUI.changed) { OnSettingsChanged(); } } private void OnSettingsChanged() { EditorUtility.SetDirty((GoogleMobileAdsSettings) target); GoogleMobileAdsSettings.Instance.WriteSettingsToFile(); } } }
Fix erroneous removal of code
Fix erroneous removal of code PiperOrigin-RevId: 350625811
C#
apache-2.0
googleads/googleads-mobile-unity,googleads/googleads-mobile-unity
945ef339760bee342bdde0f0db156430a28b9966
src/Novell.Directory.Ldap.NETStandard/ExtensionMethods.cs
src/Novell.Directory.Ldap.NETStandard/ExtensionMethods.cs
using System.Collections.Generic; using System.Text; namespace Novell.Directory.Ldap { internal static partial class ExtensionMethods { /// <summary> /// Is the given collection null, or Empty (0 elements)? /// </summary> internal static bool IsEmpty<T>(this IReadOnlyCollection<T> coll) => coll == null || coll.Count == 0; /// <summary> /// Is the given collection not null, and has at least 1 element? /// </summary> /// <typeparam name="T"></typeparam> /// <param name="coll"></param> /// <returns></returns> internal static bool IsNotEmpty<T>(this IReadOnlyCollection<T> coll) => !IsEmpty(coll); /// <summary> /// Shortcut for Encoding.UTF8.GetBytes /// </summary> internal static byte[] ToUtf8Bytes(this string input) => Encoding.UTF8.GetBytes(input); } }
using System; using System.Collections.Generic; using System.Text; namespace Novell.Directory.Ldap { internal static partial class ExtensionMethods { /// <summary> /// Shortcut for <see cref="string.IsNullOrEmpty"/> /// </summary> internal static bool IsEmpty(this string input) => string.IsNullOrEmpty(input); /// <summary> /// Shortcut for negative <see cref="string.IsNullOrEmpty"/> /// </summary> internal static bool IsNotEmpty(this string input) => !IsEmpty(input); /// <summary> /// Is the given collection null, or Empty (0 elements)? /// </summary> internal static bool IsEmpty<T>(this IReadOnlyCollection<T> coll) => coll == null || coll.Count == 0; /// <summary> /// Is the given collection not null, and has at least 1 element? /// </summary> /// <typeparam name="T"></typeparam> /// <param name="coll"></param> /// <returns></returns> internal static bool IsNotEmpty<T>(this IReadOnlyCollection<T> coll) => !IsEmpty(coll); /// <summary> /// Shortcut for <see cref="UTF8Encoding.GetBytes"/> /// </summary> internal static byte[] ToUtf8Bytes(this string input) => Encoding.UTF8.GetBytes(input); /// <summary> /// Shortcut for <see cref="UTF8Encoding.GetString"/> /// Will return an empty string if <paramref name="input"/> is null or empty. /// </summary> internal static string FromUtf8Bytes(this byte[] input) => input.IsNotEmpty() ? Encoding.UTF8.GetString(input) : string.Empty; /// <summary> /// Compare two strings using <see cref="StringComparison.Ordinal"/> /// </summary> internal static bool EqualsOrdinal(this string input, string other) => string.Equals(input, other, StringComparison.Ordinal); /// <summary> /// Compare two strings using <see cref="StringComparison.OrdinalIgnoreCase"/> /// </summary> internal static bool EqualsOrdinalCI(this string input, string other) => string.Equals(input, other, StringComparison.OrdinalIgnoreCase); } }
Add more string extension methods for common operations
Add more string extension methods for common operations
C#
mit
dsbenghe/Novell.Directory.Ldap.NETStandard,dsbenghe/Novell.Directory.Ldap.NETStandard
8c0ec1a3e0c7915306dcb47925168b017a035668
samples/Todo/Todo/TodoItem.cs
samples/Todo/Todo/TodoItem.cs
// TodoItem.cs // using System; using System.Runtime.CompilerServices; namespace Todo { [Imported] [IgnoreNamespace] [ScriptName("Object")] internal sealed class TodoItem { public bool Completed; [ScriptName("id")] public string ID; public string Title; } }
// TodoItem.cs // using System; using System.Runtime.CompilerServices; namespace Todo { [ScriptImport] [ScriptIgnoreNamespace] [ScriptName("Object")] internal sealed class TodoItem { public bool Completed; [ScriptName("id")] public string ID; public string Title; } }
Update todo sample for latest metadata changes
Update todo sample for latest metadata changes
C#
apache-2.0
x335/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,nikhilk/scriptsharp
e93c13496f5e920569404ede102f4608d3cf6db5
src/BugsnagUnity/DictionaryExtensions.cs
src/BugsnagUnity/DictionaryExtensions.cs
using System.Collections.Generic; using BugsnagUnity.Payload; using UnityEngine; namespace BugsnagUnity { static class DictionaryExtensions { internal static void PopulateDictionaryFromAndroidData(this IDictionary<string, object> dictionary, AndroidJavaObject source) { using (var set = source.Call<AndroidJavaObject>("entrySet")) using (var iterator = set.Call<AndroidJavaObject>("iterator")) { while (iterator.Call<bool>("hasNext")) { using (var mapEntry = iterator.Call<AndroidJavaObject>("next")) { var key = mapEntry.Call<string>("getKey"); using (var value = mapEntry.Call<AndroidJavaObject>("getValue")) { if (value != null) { using (var @class = value.Call<AndroidJavaObject>("getClass")) { if (@class.Call<bool>("isArray")) { using (var arrays = new AndroidJavaClass("java.util.Arrays")) { dictionary.AddToPayload(key, arrays.CallStatic<string>("toString", value)); } } else { dictionary.AddToPayload(key, value.Call<string>("toString")); } } } } } } } } } }
using System; using System.Collections.Generic; using BugsnagUnity.Payload; using UnityEngine; namespace BugsnagUnity { static class DictionaryExtensions { private static IntPtr Arrays { get; } = AndroidJNI.FindClass("java/util/Arrays"); private static IntPtr ToStringMethod { get; } = AndroidJNIHelper.GetMethodID(Arrays, "toString", "([Ljava/lang/Object;)Ljava/lang/String;", true); internal static void PopulateDictionaryFromAndroidData(this IDictionary<string, object> dictionary, AndroidJavaObject source) { using (var set = source.Call<AndroidJavaObject>("entrySet")) using (var iterator = set.Call<AndroidJavaObject>("iterator")) { while (iterator.Call<bool>("hasNext")) { using (var mapEntry = iterator.Call<AndroidJavaObject>("next")) { var key = mapEntry.Call<string>("getKey"); using (var value = mapEntry.Call<AndroidJavaObject>("getValue")) { if (value != null) { using (var @class = value.Call<AndroidJavaObject>("getClass")) { if (@class.Call<bool>("isArray")) { var args = AndroidJNIHelper.CreateJNIArgArray(new[] {value}); var formattedValue = AndroidJNI.CallStaticStringMethod(Arrays, ToStringMethod, args); dictionary.AddToPayload(key, formattedValue); } else { dictionary.AddToPayload(key, value.Call<string>("toString")); } } } } } } } } } }
Use a more compatible method call
Use a more compatible method call For some reason the way we are calling this method does not work on at least android v6. I have tested this on android 4, 5 and 6
C#
mit
bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity
bbf260bcfcb183f96c126478b0fb4655b0468808
src/SIM.Tool.Windows/MainWindowComponents/CreateSupportPatchButton.cs
src/SIM.Tool.Windows/MainWindowComponents/CreateSupportPatchButton.cs
namespace SIM.Tool.Windows.MainWindowComponents { using System; using System.IO; using System.Windows; using Sitecore.Diagnostics.Base; using JetBrains.Annotations; using SIM.Core; using SIM.Instances; using SIM.Tool.Base; using SIM.Tool.Base.Plugins; [UsedImplicitly] public class CreateSupportPatchButton : IMainWindowButton { #region Public methods public bool IsEnabled(Window mainWindow, Instance instance) { return true; } public void OnClick(Window mainWindow, Instance instance) { if (instance == null) { WindowHelper.ShowMessage("Choose an instance first"); return; } var product = instance.Product; Assert.IsNotNull(product, $"The {instance.ProductFullName} distributive is not available in local repository. You need to get it first."); var version = product.Version + "." + product.Update; var args = new[] { version, instance.Name, instance.WebRootPath }; var dir = Environment.ExpandEnvironmentVariables("%APPDATA%\\Sitecore\\PatchCreator"); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } File.WriteAllLines(Path.Combine(dir, "args.txt"), args); CoreApp.RunApp("iexplore", $"http://dl.sitecore.net/updater/pc/PatchCreator.application"); } #endregion } }
namespace SIM.Tool.Windows.MainWindowComponents { using System; using System.IO; using System.Windows; using Sitecore.Diagnostics.Base; using JetBrains.Annotations; using SIM.Core; using SIM.Instances; using SIM.Tool.Base; using SIM.Tool.Base.Plugins; [UsedImplicitly] public class CreateSupportPatchButton : IMainWindowButton { #region Public methods private string AppArgsFilePath { get; } private string AppUrl { get; } public CreateSupportPatchButton(string appArgsFilePath, string appUrl) { AppArgsFilePath = appArgsFilePath; AppUrl = appUrl; } public bool IsEnabled(Window mainWindow, Instance instance) { return true; } public void OnClick(Window mainWindow, Instance instance) { if (instance == null) { WindowHelper.ShowMessage("Choose an instance first"); return; } var product = instance.Product; Assert.IsNotNull(product, $"The {instance.ProductFullName} distributive is not available in local repository. You need to get it first."); var version = product.Version + "." + product.Update; var args = new[] { version, instance.Name, instance.WebRootPath }; var dir = Environment.ExpandEnvironmentVariables(AppArgsFilePath); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } File.WriteAllLines(Path.Combine(dir, "args.txt"), args); CoreApp.RunApp("iexplore", AppUrl); } #endregion } }
Add properties to patch creator button
Add properties to patch creator button
C#
mit
Sitecore/Sitecore-Instance-Manager,Brad-Christie/Sitecore-Instance-Manager
ba255b7056b4f4d76ec7d32a3375bb44ea700ff9
tools/Build/Build.cs
tools/Build/Build.cs
using System; using Faithlife.Build; internal static class Build { public static int Main(string[] args) => BuildRunner.Execute(args, build => { build.AddDotNetTargets( new DotNetBuildSettings { DocsSettings = new DotNetDocsSettings { GitLogin = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""), GitAuthor = new GitAuthorInfo("Faithlife Build Bot", "faithlifebuildbot@users.noreply.github.com"), SourceCodeUrl = "https://github.com/Faithlife/RepoName/tree/master/src", }, }); }); }
using System; using Faithlife.Build; internal static class Build { public static int Main(string[] args) => BuildRunner.Execute(args, build => { build.AddDotNetTargets( new DotNetBuildSettings { DocsSettings = new DotNetDocsSettings { GitLogin = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""), GitAuthor = new GitAuthorInfo("Faithlife Build Bot", "faithlifebuildbot@users.noreply.github.com"), SourceCodeUrl = "https://github.com/Faithlife/RepoName/tree/master/src", }, }); build.Target("default") .DependsOn("build"); }); }
Set default build target to build.
Set default build target to build.
C#
mit
Faithlife/System.Data.SQLite,Faithlife/Parsing,ejball/ArgsReading,Faithlife/FaithlifeUtility,ejball/XmlDocMarkdown,Faithlife/System.Data.SQLite
e56abef5c40695162e410da0ab24d6e39d6fb9c8
ExactTarget.TriggeredEmail/Core/ExactTargetResultChecker.cs
ExactTarget.TriggeredEmail/Core/ExactTargetResultChecker.cs
using System; using System.Linq; using ExactTarget.TriggeredEmail.ExactTargetApi; namespace ExactTarget.TriggeredEmail.Core { public class ExactTargetResultChecker { public static void CheckResult(Result result) { if (result == null) { throw new Exception("Received an unexpected null result from ExactTarget"); } if (result.StatusCode.Equals("OK", StringComparison.InvariantCultureIgnoreCase)) { return; } var triggeredResult = result as TriggeredSendCreateResult; var subscriberFailures = triggeredResult == null ? Enumerable.Empty<string>() : triggeredResult.SubscriberFailures.Select(f => " ErrorCode:" + f.ErrorCode + " ErrorDescription:" + f.ErrorDescription); throw new Exception(string.Format("ExactTarget response indicates failure. StatusCode:{0} StatusMessage:{1} SubscriberFailures:{2}", result.StatusCode, result.StatusMessage, string.Join("|", subscriberFailures))); } } }
using System; using System.Linq; using ExactTarget.TriggeredEmail.ExactTargetApi; namespace ExactTarget.TriggeredEmail.Core { public class ExactTargetResultChecker { public static void CheckResult(Result result) { if (result == null) { throw new Exception("Received an unexpected null result from ExactTarget"); } if (result.StatusCode.Equals("OK", StringComparison.InvariantCultureIgnoreCase)) { return; } var triggeredResult = result as TriggeredSendCreateResult; var subscriberFailures = triggeredResult == null || triggeredResult.SubscriberFailures == null ? Enumerable.Empty<string>() : triggeredResult.SubscriberFailures.Select(f => " ErrorCode:" + f.ErrorCode + " ErrorDescription:" + f.ErrorDescription); throw new Exception(string.Format("ExactTarget response indicates failure. StatusCode:{0} StatusMessage:{1} SubscriberFailures:{2}", result.StatusCode, result.StatusMessage, string.Join("|", subscriberFailures))); } } }
Fix result checker if no subscriber errors in response
Fix result checker if no subscriber errors in response
C#
mit
alwynlombaard/ExactTarget-triggered-email-sender
0dfa9a0efb8cbffe4a914ea7d8a9effe854c81f0
EfMigrationsBug/Migrations/201410021402204_ChangePkType.cs
EfMigrationsBug/Migrations/201410021402204_ChangePkType.cs
namespace EfMigrationsBug.Migrations { using System; using System.Data.Entity.Migrations; public partial class ChangePkType : DbMigration { public override void Up() { DropPrimaryKey("dbo.Foos"); AlterColumn("dbo.Foos", "ID", c => c.Int(nullable: false, identity: true)); AddPrimaryKey("dbo.Foos", "ID"); } public override void Down() { DropPrimaryKey("dbo.Foos"); AlterColumn("dbo.Foos", "ID", c => c.String(nullable: false, maxLength: 5)); AddPrimaryKey("dbo.Foos", "ID"); } } }
namespace EfMigrationsBug.Migrations { using System; using System.Data.Entity.Migrations; public partial class ChangePkType : DbMigration { public override void Up() { DropTable("dbo.Foos"); CreateTable( "dbo.Foos", c => new { ID = c.Int(nullable: false, identity: true), }) .PrimaryKey(t => t.ID); } public override void Down() { DropTable("dbo.Foos"); CreateTable( "dbo.Foos", c => new { ID = c.String(nullable: false, maxLength: 5), }) .PrimaryKey(t => t.ID); } } }
Modify the migration so it rebuilds the table.
Modify the migration so it rebuilds the table.
C#
mit
mareksuscak/ef-migrations-bug
1bf53f46f27c84eeb8225458a9215304a570bada
Aurio/Aurio/Streams/MemoryWriterStream.cs
Aurio/Aurio/Streams/MemoryWriterStream.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace Aurio.Streams { public class MemoryWriterStream : MemorySourceStream, IAudioWriterStream { public MemoryWriterStream(MemoryStream target, AudioProperties properties) : base(target, properties) { } public void Write(byte[] buffer, int offset, int count) { // Default stream checks according to MSDN if(buffer == null) { throw new ArgumentNullException("buffer must not be null"); } if(!source.CanWrite) { throw new NotSupportedException("target stream is not writable"); } if(buffer.Length - offset < count) { throw new ArgumentException("not enough remaining bytes or count too large"); } if(offset < 0 || count < 0) { throw new ArgumentOutOfRangeException("offset and count must not be negative"); } // Check block alignment if(count % SampleBlockSize != 0) { throw new ArgumentException("count must be a multiple of the sample block size"); } source.Write(buffer, offset, count); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace Aurio.Streams { public class MemoryWriterStream : MemorySourceStream, IAudioWriterStream { public MemoryWriterStream(MemoryStream target, AudioProperties properties) : base(target, properties) { } public MemoryWriterStream(AudioProperties properties) : base(new MemoryStream(), properties) { } public void Write(byte[] buffer, int offset, int count) { // Default stream checks according to MSDN if(buffer == null) { throw new ArgumentNullException("buffer must not be null"); } if(!source.CanWrite) { throw new NotSupportedException("target stream is not writable"); } if(buffer.Length - offset < count) { throw new ArgumentException("not enough remaining bytes or count too large"); } if(offset < 0 || count < 0) { throw new ArgumentOutOfRangeException("offset and count must not be negative"); } // Check block alignment if(count % SampleBlockSize != 0) { throw new ArgumentException("count must be a multiple of the sample block size"); } source.Write(buffer, offset, count); } } }
Add constructor that creates memory stream internally
Add constructor that creates memory stream internally
C#
agpl-3.0
protyposis/Aurio,protyposis/Aurio
a9e4976b7aa9026b04d63c3346cfc83a6bf204e9
Source/OxyPlot/Utilities/TypeExtensions.cs
Source/OxyPlot/Utilities/TypeExtensions.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="TypeExtensions.cs" company="OxyPlot"> // Copyright (c) 2014 OxyPlot contributors // </copyright> // <summary> // Provides extension methods for types. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace OxyPlot { using System; using System.Linq; using System.Reflection; /// <summary> /// Provides extension methods for types. /// </summary> public static class TypeExtensions { /// <summary> /// Retrieves an object that represents a specified property. /// </summary> /// <param name="type">The type that contains the property.</param> /// <param name="name">The name of the property.</param> /// <returns>An object that represents the specified property, or null if the property is not found.</returns> public static PropertyInfo GetRuntimeProperty(this Type type, string name) { #if NET40 var source = type.GetProperties(); #else var typeInfo = type.GetTypeInfo(); var source = typeInfo.AsType().GetRuntimeProperties(); #endif foreach (var x in source) { if (x.Name == name) return x; } return null; } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="TypeExtensions.cs" company="OxyPlot"> // Copyright (c) 2014 OxyPlot contributors // </copyright> // <summary> // Provides extension methods for types. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace OxyPlot { using System; using System.Linq; using System.Reflection; /// <summary> /// Provides extension methods for types. /// </summary> public static class TypeExtensions { /// <summary> /// Retrieves an object that represents a specified property. /// </summary> /// <param name="type">The type that contains the property.</param> /// <param name="name">The name of the property.</param> /// <returns>An object that represents the specified property, or null if the property is not found.</returns> public static PropertyInfo GetRuntimeProperty(this Type type, string name) { #if NET40 var source = type.GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); #else var typeInfo = type.GetTypeInfo(); var source = typeInfo.AsType().GetRuntimeProperties(); #endif foreach (var x in source) { if (x.Name == name) return x; } return null; } } }
Update type extension for net40
Update type extension for net40
C#
mit
oxyplot/oxyplot,ze-pequeno/oxyplot
2905292d20308fd492135d8d7f2b1d2f883fc250
osu.Framework/Platform/Linux/LinuxGameHost.cs
osu.Framework/Platform/Linux/LinuxGameHost.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.Platform.Linux.Native; using osu.Framework.Platform.Linux.Sdl; using osuTK; namespace osu.Framework.Platform.Linux { public class LinuxGameHost : DesktopGameHost { internal LinuxGameHost(string gameName, bool bindIPC = false, ToolkitOptions toolkitOptions = default, bool portableInstallation = false, bool useSdl = false) : base(gameName, bindIPC, toolkitOptions, portableInstallation, useSdl) { } protected override void SetupForRun() { base.SetupForRun(); // required for the time being to address libbass_fx.so load failures (see https://github.com/ppy/osu/issues/2852) Library.Load("libbass.so", Library.LoadFlags.RTLD_LAZY | Library.LoadFlags.RTLD_GLOBAL); } protected override IWindow CreateWindow() => !UseSdl ? (IWindow)new LinuxGameWindow() : new Window(); protected override Storage GetStorage(string baseName) => new LinuxStorage(baseName, this); public override Clipboard GetClipboard() { if (((LinuxGameWindow)Window).IsSdl) { return new SdlClipboard(); } else { return new LinuxClipboard(); } } } }
// 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.Platform.Linux.Native; using osu.Framework.Platform.Linux.Sdl; using osuTK; namespace osu.Framework.Platform.Linux { public class LinuxGameHost : DesktopGameHost { internal LinuxGameHost(string gameName, bool bindIPC = false, ToolkitOptions toolkitOptions = default, bool portableInstallation = false, bool useSdl = false) : base(gameName, bindIPC, toolkitOptions, portableInstallation, useSdl) { } protected override void SetupForRun() { base.SetupForRun(); // required for the time being to address libbass_fx.so load failures (see https://github.com/ppy/osu/issues/2852) Library.Load("libbass.so", Library.LoadFlags.RTLD_LAZY | Library.LoadFlags.RTLD_GLOBAL); } protected override IWindow CreateWindow() => !UseSdl ? (IWindow)new LinuxGameWindow() : new Window(); protected override Storage GetStorage(string baseName) => new LinuxStorage(baseName, this); public override Clipboard GetClipboard() => Window is Window || (Window as LinuxGameWindow)?.IsSdl == true ? (Clipboard)new SdlClipboard() : new LinuxClipboard(); } }
Use SdlClipboard on Linux when using new SDL2 backend
Use SdlClipboard on Linux when using new SDL2 backend
C#
mit
EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework
963c84d8e7250200152382ed48d02851a1cfe083
src/Models/Games/LineScore.cs
src/Models/Games/LineScore.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace mdryden.cflapi.v1.Models.Games { public class LineScore { [JsonProperty(PropertyName = "quarter")] public int Quarter { get; set; } [JsonProperty(PropertyName = "score")] public int Score { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace mdryden.cflapi.v1.Models.Games { public class LineScore { [JsonProperty(PropertyName = "quarter")] public Quarters Quarter { get; set; } [JsonProperty(PropertyName = "score")] public int Score { get; set; } } }
Change quarter type to enum to allow for "ot" as value.
Change quarter type to enum to allow for "ot" as value.
C#
mit
pudds/cfl-api.net,pudds/cfl-api.net
d97cdedfadbb77157cfce80812c4bfbe123f5841
Meridium.EPiServer.Migration/Support/SourcePage.cs
Meridium.EPiServer.Migration/Support/SourcePage.cs
using System.Linq; using EPiServer.Core; namespace Meridium.EPiServer.Migration.Support { public class SourcePage { public string TypeName { get; set; } public PropertyDataCollection Properties { get; set; } public TValue GetValue<TValue>(string propertyName, TValue @default = default(TValue)) where TValue : class { var data = Properties != null ? Properties.Get(propertyName) : null; return (data != null) ? (data.Value as TValue) : @default; } public TValue GetValueWithFallback<TValue>(params string[] properties) where TValue : class { var property = properties.SkipWhile(p => !Properties.HasValue(p)).FirstOrDefault(); return (property != null) ? GetValue<TValue>(property) : null; } } internal static class PropertyDataExtensions { public static bool HasValue(this PropertyDataCollection self, string key) { var property = self.Get(key); if (property == null) return false; return !(property.IsNull || string.IsNullOrWhiteSpace(property.ToString())); } } }
using System.Linq; using EPiServer.Core; namespace Meridium.EPiServer.Migration.Support { public class SourcePage { public string TypeName { get; set; } public PropertyDataCollection Properties { get; set; } public TValue GetValue<TValue>(string propertyName, TValue @default = default(TValue)) { var data = Properties != null ? Properties.Get(propertyName) : null; if (data != null && data.Value is TValue) return (TValue) data.Value; return @default; } public TValue GetValueWithFallback<TValue>(params string[] properties) { var property = properties.SkipWhile(p => !Properties.HasValue(p)).FirstOrDefault(); return (property != null) ? GetValue<TValue>(property) : default(TValue); } } internal static class PropertyDataExtensions { public static bool HasValue(this PropertyDataCollection self, string key) { var property = self.Get(key); if (property == null) return false; return !(property.IsNull || string.IsNullOrWhiteSpace(property.ToString())); } } }
Make GetValue method handle value types
Make GetValue method handle value types Removing the `class` type restriction on the `SourcePage.GetValue` and `SourcePage.GetValueWithFallback` methods. Instead of `null` `default(TValue)` is returned when a value can not be extracted.
C#
mit
meridiumlabs/episerver.migration
9af0f42dafba5b473f28c31814d79661a54146b2
src/Templar/TemplateSource.cs
src/Templar/TemplateSource.cs
using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; namespace Templar { public class TemplateSource : IContentSource { private readonly string global; private readonly Compiler compiler; private readonly TemplateFinder finder; public TemplateSource(string global, Compiler compiler, TemplateFinder finder) { this.global = global; this.compiler = compiler; this.finder = finder; } public string GetContent(HttpContextBase httpContext) { var templates = finder.Find(httpContext); using (var writer = new StringWriter()) { writer.WriteLine("!function() {"); writer.WriteLine(" var templates = {0}.templates = {{}};", global); var results = Compile(templates); foreach (var result in results) { writer.WriteLine(result); } writer.WriteLine("}();"); return writer.ToString(); } } private IEnumerable<string> Compile(IEnumerable<Template> templates) { return templates.AsParallel().Select(template => { string name = template.GetName(); string content = compiler.Compile(template.GetContent()); return string.Format(" templates['{0}'] = {1};", name, content); }); } } }
using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; namespace Templar { public class TemplateSource : IContentSource { private readonly string global; private readonly Compiler compiler; private readonly TemplateFinder finder; public TemplateSource(string global, Compiler compiler, TemplateFinder finder) { this.global = global; this.compiler = compiler; this.finder = finder; } public string GetContent(HttpContextBase httpContext) { var templates = finder.Find(httpContext); using (var writer = new StringWriter()) { writer.WriteLine("!function() {"); writer.WriteLine(" var templates = {0}.templates = {{}};", global); var results = Compile(templates); foreach (var result in results) { writer.WriteLine(result); } writer.WriteLine("}();"); return writer.ToString(); } } private IEnumerable<string> Compile(IEnumerable<Template> templates) { return templates.Select(template => { string name = template.GetName(); string content = compiler.Compile(template.GetContent()); return string.Format(" templates['{0}'] = {1};", name, content); }); } } }
Remove usage of parallelism when compiling templates (causing crash in Jurassic?).
Remove usage of parallelism when compiling templates (causing crash in Jurassic?).
C#
mit
mrydengren/templar,mrydengren/templar
510ffce1877f2cb7c7e1900764970a5838e7ff46
Moya.Runner.Console/OptionArgumentPair.cs
Moya.Runner.Console/OptionArgumentPair.cs
namespace Moya.Runner.Console { public struct OptionArgumentPair { public string Option { get; set; } public string Argument { get; set; } public static OptionArgumentPair Create(string stringFromCommandLine) { string[] optionAndArgument = stringFromCommandLine.Split('='); return new OptionArgumentPair { Option = optionAndArgument[0], Argument = optionAndArgument[1] }; } } }
namespace Moya.Runner.Console { using System.Linq; public struct OptionArgumentPair { public string Option { get; set; } public string Argument { get; set; } public static OptionArgumentPair Create(string stringFromCommandLine) { string[] optionAndArgument = stringFromCommandLine.Split('='); return new OptionArgumentPair { Option = optionAndArgument.Any() ? optionAndArgument[0] : string.Empty, Argument = optionAndArgument.Count() > 1 ? optionAndArgument[1] : string.Empty }; } } }
Handle optionargumentpairs with only option
Handle optionargumentpairs with only option
C#
mit
Hammerstad/Moya
60550b73f77d0ec625c070fcd6eee395e8397149
osu.Game/Online/RealtimeMultiplayer/MultiplayerUserState.cs
osu.Game/Online/RealtimeMultiplayer/MultiplayerUserState.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. namespace osu.Game.Online.RealtimeMultiplayer { public enum MultiplayerUserState { Idle, Ready, WaitingForLoad, Loaded, Playing, Results, } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. namespace osu.Game.Online.RealtimeMultiplayer { public enum MultiplayerUserState { /// <summary> /// The user is idle and waiting for something to happen (or watching the match but not participating). /// </summary> Idle, /// <summary> /// The user has marked themselves as ready to participate and should be considered for the next game start. /// </summary> Ready, /// <summary> /// The server is waiting for this user to finish loading. This is a reserved state, and is set by the server. /// </summary> /// <remarks> /// All users in <see cref="Ready"/> state when the game start will be transitioned to this state. /// All users in this state need to transition to <see cref="Loaded"/> before the game can start. /// </remarks> WaitingForLoad, /// <summary> /// The user's client has marked itself as loaded and ready to begin gameplay. /// </summary> Loaded, /// <summary> /// The user is currently playing in a game. This is a reserved state, and is set by the server. /// </summary> /// <remarks> /// Once there are no remaining <see cref="WaitingForLoad"/> users, all users in <see cref="Loaded"/> state will be transitioned to this state. /// At this point the game will start for all users. /// </remarks> Playing, /// <summary> /// The user has finished playing and is ready to view results. /// </summary> /// <remarks> /// Once all users transition from <see cref="Playing"/> to this state, the game will end and results will be distributed. /// All users will be transitioned to the <see cref="Results"/> state. /// </remarks> FinishedPlay, /// <summary> /// The user is currently viewing results. This is a reserved state, and is set by the server. /// </summary> Results, } }
Add missing states and xmldoc for all states' purposes
Add missing states and xmldoc for all states' purposes
C#
mit
peppy/osu-new,smoogipoo/osu,smoogipooo/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu
3176f7f85d458fd6dc11324250a7d850d3b30a20
CollAction/ValidationAttributes/RichTextRequiredAttribute.cs
CollAction/ValidationAttributes/RichTextRequiredAttribute.cs
using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; namespace CollAction.ValidationAttributes { public class RichTextRequiredAttribute : ValidationAttribute, IClientModelValidator { public void AddValidation(ClientModelValidationContext context) { context.Attributes["data-val"] = "true"; context.Attributes["data-val-richtextrequired"] = ErrorMessage ?? $"{context.ModelMetadata.DisplayName} is required"; } } }
using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; namespace CollAction.ValidationAttributes { public class RichTextRequiredAttribute : RequiredAttribute, IClientModelValidator { public void AddValidation(ClientModelValidationContext context) { var requiredMessage = ErrorMessage ?? $"{context.ModelMetadata.DisplayName} is required"; context.Attributes["data-val"] = "true"; context.Attributes["data-val-required"] = requiredMessage; context.Attributes["data-val-richtextrequired"] = requiredMessage; } } }
Add required validation for rich text components on server side
Add required validation for rich text components on server side
C#
agpl-3.0
CollActionteam/CollAction,CollActionteam/CollAction,CollActionteam/CollAction,CollActionteam/CollAction,CollActionteam/CollAction
00940d3297bd526cde61887cc49bf13ef8d360cf
QuizFactory/QuizFactory.Data/Migrations/Configuration.cs
QuizFactory/QuizFactory.Data/Migrations/Configuration.cs
namespace QuizFactory.Data.Migrations { using System; using System.Data.Entity.Migrations; using System.Linq; using QuizFactory.Data; internal sealed class Configuration : DbMigrationsConfiguration<QuizFactoryDbContext> { public Configuration() { this.AutomaticMigrationsEnabled = true; this.AutomaticMigrationDataLossAllowed = false; } protected override void Seed(QuizFactoryDbContext context) { if (!context.Roles.Any()) { var seedUsers = new SeedUsers(); seedUsers.Generate(context); } var seedData = new SeedData(context); if (!context.QuizDefinitions.Any()) { foreach (var item in seedData.Quizzes) { context.QuizDefinitions.Add(item); } } if (!context.Categories.Any()) { foreach (var item in seedData.Categories) { context.Categories.Add(item); } } context.SaveChanges(); } } }
namespace QuizFactory.Data.Migrations { using System; using System.Data.Entity.Migrations; using System.Linq; using QuizFactory.Data; internal sealed class Configuration : DbMigrationsConfiguration<QuizFactoryDbContext> { public Configuration() { this.AutomaticMigrationsEnabled = true; this.AutomaticMigrationDataLossAllowed = true; } protected override void Seed(QuizFactoryDbContext context) { if (!context.Roles.Any()) { var seedUsers = new SeedUsers(); seedUsers.Generate(context); } var seedData = new SeedData(context); if (!context.QuizDefinitions.Any()) { foreach (var item in seedData.Quizzes) { context.QuizDefinitions.Add(item); } } if (!context.Categories.Any()) { foreach (var item in seedData.Categories) { context.Categories.Add(item); } } context.SaveChanges(); } } }
Revert "disable automatic migration data loss"
Revert "disable automatic migration data loss" This reverts commit f6024ca8c0657cab4eeda90ef9225f66654fd6be.
C#
mit
dpesheva/QuizFactory,dpesheva/QuizFactory
83d83a132aba8bdae6f1c71b9ea8999eb86ebf3c
SupportManager.Web/Features/User/CreateCommandHandler.cs
SupportManager.Web/Features/User/CreateCommandHandler.cs
using AutoMapper; using MediatR; using SupportManager.DAL; using SupportManager.Web.Infrastructure.CommandProcessing; namespace SupportManager.Web.Features.User { public class CreateCommandHandler : RequestHandler<CreateCommand> { private readonly SupportManagerContext db; public CreateCommandHandler(SupportManagerContext db) { this.db = db; } protected override void HandleCore(CreateCommand message) { var user = Mapper.Map<DAL.User>(message); db.Users.Add(user); } } }
using SupportManager.DAL; using SupportManager.Web.Infrastructure.CommandProcessing; namespace SupportManager.Web.Features.User { public class CreateCommandHandler : RequestHandler<CreateCommand> { private readonly SupportManagerContext db; public CreateCommandHandler(SupportManagerContext db) { this.db = db; } protected override void HandleCore(CreateCommand message) { var user = new DAL.User {DisplayName = message.Name, Login = message.Name}; db.Users.Add(user); } } }
Replace map with manual initialization
Replace map with manual initialization
C#
mit
mycroes/SupportManager,mycroes/SupportManager,mycroes/SupportManager
f21358e85b50b6ba642c7354e35af923c7c6d811
src/Firehose.Web/Authors/NicholasMGetchell.cs
src/Firehose.Web/Authors/NicholasMGetchell.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class NicholasMGetchell : IAmACommunityMember { public string FirstName => "Nicholas"; public string LastName => "Getchell"; public string ShortBioOrTagLine => "Analyst"; public string StateOrRegion => "Boston, MA"; public string EmailAddress => "nicholas@getchell.org"; public string TwitterHandle => "getch3028"; public string GravatarHash => "1ebff516aa68c1b3bc786bd291b8fca1"; public string GitHubHandle => "ngetchell"; public GeoPosition Position => new GeoPosition(53.073635, 8.806422); public Uri WebSite => new Uri("https://powershell.getchell.org"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://powershell.getchell.org/feed/"); } } public string FeedLanguageCode => "en"; } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class NicholasMGetchell : IAmACommunityMember { public string FirstName => "Nicholas"; public string LastName => "Getchell"; public string ShortBioOrTagLine => "Systems Administrator"; public string StateOrRegion => "Boston, MA"; public string EmailAddress => "nicholas@getchell.org"; public string TwitterHandle => "getch3028"; public string GravatarHash => "1ebff516aa68c1b3bc786bd291b8fca1"; public string GitHubHandle => "ngetchell"; public GeoPosition Position => new GeoPosition(53.073635, 8.806422); public Uri WebSite => new Uri("https://ngetchell.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://ngetchell.com/tag/powershell/rss/"); } } public string FeedLanguageCode => "en"; } }
Move from powershell.getchell.org to ngetchell.com
Move from powershell.getchell.org to ngetchell.com Also adds an updated Bio to reflect my current work.
C#
mit
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
ff1735522174e0bf8e007cf692f0078eec7776e8
src/Azure/Storage.Net.Microsoft.Azure.DataLake.Store/Gen2/Models/DirectoryItem.cs
src/Azure/Storage.Net.Microsoft.Azure.DataLake.Store/Gen2/Models/DirectoryItem.cs
using System; using Newtonsoft.Json; namespace Storage.Net.Microsoft.Azure.DataLake.Store.Gen2.Models { public class DirectoryItem { [JsonProperty("contentLength")] public int? ContentLength { get; set; } [JsonProperty("etag")] public DateTime Etag { get; set; } [JsonProperty("group")] public string Group { get; set; } [JsonProperty("isDirectory")] public bool IsDirectory { get; set; } [JsonProperty("lastModified")] public DateTime LastModified { get; set; } [JsonProperty("name")] public string Name { get; set; } [JsonProperty("owner")] public string Owner { get; set; } [JsonProperty("permissions")] public string Permissions { get; set; } } }
using System; using Newtonsoft.Json; namespace Storage.Net.Microsoft.Azure.DataLake.Store.Gen2.Models { public class DirectoryItem { [JsonProperty("contentLength")] public int? ContentLength { get; set; } [JsonProperty("etag")] public string Etag { get; set; } [JsonProperty("group")] public string Group { get; set; } [JsonProperty("isDirectory")] public bool IsDirectory { get; set; } [JsonProperty("lastModified")] public DateTime LastModified { get; set; } [JsonProperty("name")] public string Name { get; set; } [JsonProperty("owner")] public string Owner { get; set; } [JsonProperty("permissions")] public string Permissions { get; set; } } }
Change etag from DateTime to string, to reflect updated api.
Change etag from DateTime to string, to reflect updated api.
C#
mit
aloneguid/storage
7045eb196ca51bded0bd2ebef995714901f0e578
src/Umbraco.Web/WebApi/Filters/HttpQueryStringModelBinder.cs
src/Umbraco.Web/WebApi/Filters/HttpQueryStringModelBinder.cs
using System.Collections.Generic; using System.Linq; using System.Net.Http.Formatting; using System.Web.Http.Controllers; using System.Web.Http.ModelBinding; namespace Umbraco.Web.WebApi.Filters { /// <summary> /// Allows an Action to execute with an arbitrary number of QueryStrings /// </summary> /// <remarks> /// Just like you can POST an arbitrary number of parameters to an Action, you can't GET an arbitrary number /// but this will allow you to do it /// </remarks> public sealed class HttpQueryStringModelBinder : IModelBinder { public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) { //get the query strings from the request properties if (actionContext.Request.Properties.ContainsKey("MS_QueryNameValuePairs")) { if (actionContext.Request.Properties["MS_QueryNameValuePairs"] is IEnumerable<KeyValuePair<string, string>> queryStrings) { var queryStringKeys = queryStrings.Select(kvp => kvp.Key).ToArray(); var additionalParameters = new Dictionary<string, string>(); if(queryStringKeys.Contains("culture") == false) { additionalParameters["culture"] = actionContext.Request.ClientCulture(); } var formData = new FormDataCollection(queryStrings.Union(additionalParameters)); bindingContext.Model = formData; return true; } } return false; } } }
using System.Collections.Generic; using System.Linq; using System.Net.Http.Formatting; using System.Web.Http.Controllers; using System.Web.Http.ModelBinding; using Umbraco.Core; namespace Umbraco.Web.WebApi.Filters { /// <summary> /// Allows an Action to execute with an arbitrary number of QueryStrings /// </summary> /// <remarks> /// Just like you can POST an arbitrary number of parameters to an Action, you can't GET an arbitrary number /// but this will allow you to do it /// </remarks> public sealed class HttpQueryStringModelBinder : IModelBinder { public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) { //get the query strings from the request properties if (actionContext.Request.Properties.ContainsKey("MS_QueryNameValuePairs")) { if (actionContext.Request.Properties["MS_QueryNameValuePairs"] is IEnumerable<KeyValuePair<string, string>> queryStrings) { var queryStringKeys = queryStrings.Select(kvp => kvp.Key).ToArray(); var additionalParameters = new Dictionary<string, string>(); if(queryStringKeys.InvariantContains("culture") == false) { additionalParameters["culture"] = actionContext.Request.ClientCulture(); } var formData = new FormDataCollection(queryStrings.Union(additionalParameters)); bindingContext.Model = formData; return true; } } return false; } } }
Use InvariantContains instead of Contains when looking for culture in the querystring
Use InvariantContains instead of Contains when looking for culture in the querystring
C#
mit
tcmorris/Umbraco-CMS,madsoulswe/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,abryukhov/Umbraco-CMS,abryukhov/Umbraco-CMS,rasmuseeg/Umbraco-CMS,abjerner/Umbraco-CMS,NikRimington/Umbraco-CMS,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,umbraco/Umbraco-CMS,umbraco/Umbraco-CMS,NikRimington/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,NikRimington/Umbraco-CMS,marcemarc/Umbraco-CMS,bjarnef/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,leekelleher/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,madsoulswe/Umbraco-CMS,leekelleher/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,rasmuseeg/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,madsoulswe/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,bjarnef/Umbraco-CMS,hfloyd/Umbraco-CMS,abjerner/Umbraco-CMS,rasmuseeg/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,mattbrailsford/Umbraco-CMS,hfloyd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,mattbrailsford/Umbraco-CMS
cc73813109652efbef46b2c19f576b106a72ac09
Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs
Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs
using System.Collections.Generic; using Promact.Trappist.DomainModel.Models.Question; using System.Linq; using Promact.Trappist.DomainModel.DbContext; namespace Promact.Trappist.Repository.Questions { public class QuestionRepository : IQuestionRespository { private readonly TrappistDbContext _dbContext; public QuestionRepository(TrappistDbContext dbContext) { _dbContext = dbContext; } /// <summary> /// Get all questions /// </summary> /// <returns>Question list</returns> public List<SingleMultipleAnswerQuestion> GetAllQuestions() { var question = _dbContext.SingleMultipleAnswerQuestion.ToList(); return question; } /// <summary> /// Add single multiple answer question into model /// </summary> /// <param name="singleMultipleAnswerQuestion"></param> /// <param name="singleMultipleAnswerQuestionOption"></param> public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption) { _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion); foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption) { singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id; _dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement); } _dbContext.SaveChanges(); } } }
using System.Collections.Generic; using Promact.Trappist.DomainModel.Models.Question; using System.Linq; using Promact.Trappist.DomainModel.DbContext; namespace Promact.Trappist.Repository.Questions { public class QuestionRepository : IQuestionRespository { private readonly TrappistDbContext _dbContext; public QuestionRepository(TrappistDbContext dbContext) { _dbContext = dbContext; } /// <summary> /// Get all questions /// </summary> /// <returns>Question list</returns> public List<SingleMultipleAnswerQuestion> GetAllQuestions() { var question = _dbContext.SingleMultipleAnswerQuestion.ToList(); return question; } /// <summary> /// Add single multiple answer question into model /// </summary> /// <param name="singleMultipleAnswerQuestion"></param> /// <param name="singleMultipleAnswerQuestionOption"></param> public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption) { _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion); foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption) { singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id; _dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement); } _dbContext.SaveChanges(); } } }
Update server side API for single multiple answer question
Update server side API for single multiple answer question
C#
mit
Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist
3bb209ef9fef3607481679f32406fb4f8468fc1f
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("TsAnalyser")] [assembly: AssemblyDescription("RTP and TS Analyser")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Cinegy GmbH")] [assembly: AssemblyProduct("TsAnalyser")] [assembly: AssemblyCopyright("Copyright © Cinegy GmbH 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("4583a25c-d61a-44a3-b839-a55b091f6187")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.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("TsAnalyser")] [assembly: AssemblyDescription("RTP and TS Analyser")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Cinegy GmbH")] [assembly: AssemblyProduct("TsAnalyser")] [assembly: AssemblyCopyright("Copyright © Cinegy GmbH 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("4583a25c-d61a-44a3-b839-a55b091f6187")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
Update assembly version number to v1.1
Update assembly version number to v1.1
C#
apache-2.0
Cinegy/TsAnalyser
07aa2918a3446a3bdabbb40b07e2663528d5afd8
src/Solomobro.Instagram.Tests/WebApi/AuthSettingsTests.cs
src/Solomobro.Instagram.Tests/WebApi/AuthSettingsTests.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NUnit.Framework; namespace Solomobro.Instagram.Tests.WebApi { [TestFixture] public class AuthSettingsTests { //WebApiDemo.Settings.EnvironmentManager. } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using NUnit.Framework; using Solomobro.Instagram.WebApiDemo.Settings; namespace Solomobro.Instagram.Tests.WebApi { [TestFixture] public class AuthSettingsTests { const string Settings = @"#Instagram Settings InstaWebsiteUrl=https://github.com/solomobro/Instagram InstaClientId=<CLIENT-ID> InstaClientSecret=<CLIENT-SECRET> InstaRedirectUrl=http://localhost:56841/api/authorize"; [Test] public void AllAuthSettingsPropertiesAreSet() { Assert.That(AuthSettings.InstaClientId, Is.Null); Assert.That(AuthSettings.InstaClientSecret, Is.Null); Assert.That(AuthSettings.InstaRedirectUrl, Is.Null); Assert.That(AuthSettings.InstaWebsiteUrl, Is.Null); using (var memStream = new MemoryStream(Encoding.ASCII.GetBytes(Settings))) { AuthSettings.LoadSettings(memStream); } Assert.That(AuthSettings.InstaClientId, Is.Not.Null); Assert.That(AuthSettings.InstaClientSecret, Is.Not.Null); Assert.That(AuthSettings.InstaRedirectUrl, Is.Not.Null); Assert.That(AuthSettings.InstaWebsiteUrl, Is.Not.Null); } } }
Add unit test for AuthSettings class
Add unit test for AuthSettings class
C#
apache-2.0
solomobro/Instagram,solomobro/Instagram,solomobro/Instagram
273ed5678f8cb6583e67e17a050532a33454d19f
MultiMiner.Xgminer/MiningPool.cs
MultiMiner.Xgminer/MiningPool.cs
using System; namespace MultiMiner.Xgminer { //marked Serializable to allow deep cloning of CoinConfiguration [Serializable] public class MiningPool { public string Host { get; set; } public int Port { get; set; } public string Username { get; set; } public string Password { get; set; } public int Quota { get; set; } //see bfgminer README about quotas } }
using System; namespace MultiMiner.Xgminer { //marked Serializable to allow deep cloning of CoinConfiguration [Serializable] public class MiningPool { public MiningPool() { //set defaults Host = String.Empty; Username = String.Empty; Password = String.Empty; } public string Host { get; set; } public int Port { get; set; } public string Username { get; set; } public string Password { get; set; } public int Quota { get; set; } //see bfgminer README about quotas } }
Set default values (to avoid null references for invalid user data)
Set default values (to avoid null references for invalid user data)
C#
mit
nwoolls/MultiMiner,IWBWbiz/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner
162e50b1128f8b3f9ab936035ce7a89ab91fabc1
src/Microsoft.DotNet.Tools.Pack/NuGet/PackageIdValidator.cs
src/Microsoft.DotNet.Tools.Pack/NuGet/PackageIdValidator.cs
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Globalization; namespace NuGet { public static class PackageIdValidator { internal const int MaxPackageIdLength = 100; public static bool IsValidPackageId(string packageId) { if (string.IsNullOrWhiteSpace(packageId)) { throw new ArgumentException(nameof(packageId)); } // Rules: // Should start with a character // Can be followed by '.' or '-'. Cannot have 2 of these special characters consecutively. // Cannot end with '-' or '.' var firstChar = packageId[0]; if (!char.IsLetterOrDigit(firstChar) && firstChar != '_') { // Should start with a char/digit/_. return false; } var lastChar = packageId[packageId.Length - 1]; if (lastChar == '-' || lastChar == '.') { // Should not end with a '-' or '.'. return false; } for (int index = 1; index < packageId.Length - 1; index++) { var ch = packageId[index]; if (!char.IsLetterOrDigit(ch) && ch != '-' && ch != '.') { return false; } if ((ch == '-' || ch == '.') && ch == packageId[index - 1]) { // Cannot have two successive '-' or '.' in the name. return false; } } return true; } public static void ValidatePackageId(string packageId) { if (packageId.Length > MaxPackageIdLength) { // TODO: Resources throw new ArgumentException("NuGetResources.Manifest_IdMaxLengthExceeded"); } if (!IsValidPackageId(packageId)) { // TODO: Resources throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "NuGetResources.InvalidPackageId", packageId)); } } } }
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Globalization; using System.Text.RegularExpressions; namespace NuGet { public static class PackageIdValidator { private static readonly Regex _idRegex = new Regex(@"^\w+([_.-]\w+)*$", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture); internal const int MaxPackageIdLength = 100; public static bool IsValidPackageId(string packageId) { if (packageId == null) { throw new ArgumentNullException("packageId"); } return _idRegex.IsMatch(packageId); } public static void ValidatePackageId(string packageId) { if (packageId.Length > MaxPackageIdLength) { // TODO: Resources throw new ArgumentException("NuGetResources.Manifest_IdMaxLengthExceeded"); } if (!IsValidPackageId(packageId)) { // TODO: Resources throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "NuGetResources.InvalidPackageId", packageId)); } } } }
Fix package id version checking during pack - The logic wasn't in sync with nuget.exe
Fix package id version checking during pack - The logic wasn't in sync with nuget.exe
C#
mit
jaredpar/cli,jonsequitur/cli,mlorbetske/cli,naamunds/cli,ravimeda/cli,gkhanna79/cli,AbhitejJohn/cli,harshjain2/cli,EdwardBlair/cli,FubarDevelopment/cli,jonsequitur/cli,blackdwarf/cli,AbhitejJohn/cli,mylibero/cli,krwq/cli,marono/cli,ravimeda/cli,FubarDevelopment/cli,mylibero/cli,mylibero/cli,livarcocc/cli-1,mlorbetske/cli,krwq/cli,JohnChen0/cli,naamunds/cli,danquirk/cli,gkhanna79/cli,krwq/cli,MichaelSimons/cli,MichaelSimons/cli,EdwardBlair/cli,livarcocc/cli-1,blackdwarf/cli,JohnChen0/cli,gkhanna79/cli,weshaggard/cli,schellap/cli,marono/cli,nguerrera/cli,svick/cli,weshaggard/cli,naamunds/cli,weshaggard/cli,mlorbetske/cli,MichaelSimons/cli,jaredpar/cli,jkotas/cli,gkhanna79/cli,dasMulli/cli,mylibero/cli,borgdylan/dotnet-cli,svick/cli,schellap/cli,jaredpar/cli,jkotas/cli,stuartleeks/dotnet-cli,anurse/Cli,borgdylan/dotnet-cli,JohnChen0/cli,blackdwarf/cli,jaredpar/cli,FubarDevelopment/cli,johnbeisner/cli,Faizan2304/cli,jonsequitur/cli,jaredpar/cli,harshjain2/cli,marono/cli,gkhanna79/cli,schellap/cli,dasMulli/cli,naamunds/cli,blackdwarf/cli,JohnChen0/cli,AbhitejJohn/cli,danquirk/cli,borgdylan/dotnet-cli,danquirk/cli,jaredpar/cli,dasMulli/cli,borgdylan/dotnet-cli,svick/cli,Faizan2304/cli,mlorbetske/cli,nguerrera/cli,stuartleeks/dotnet-cli,MichaelSimons/cli,nguerrera/cli,jonsequitur/cli,weshaggard/cli,harshjain2/cli,krwq/cli,schellap/cli,stuartleeks/dotnet-cli,schellap/cli,marono/cli,jkotas/cli,stuartleeks/dotnet-cli,MichaelSimons/cli,borgdylan/dotnet-cli,mylibero/cli,jkotas/cli,krwq/cli,livarcocc/cli-1,ravimeda/cli,danquirk/cli,johnbeisner/cli,stuartleeks/dotnet-cli,naamunds/cli,schellap/cli,nguerrera/cli,AbhitejJohn/cli,Faizan2304/cli,danquirk/cli,FubarDevelopment/cli,johnbeisner/cli,weshaggard/cli,jkotas/cli,EdwardBlair/cli,marono/cli
a0c1da647ed06478559cca86f783262b12510f52
Properties/VersionAssemblyInfo.cs
Properties/VersionAssemblyInfo.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.34003 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.1.0")] [assembly: AssemblyConfiguration("Release built on 2013-10-23 22:48")] [assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")] [assembly: AssemblyDescription("Autofac.Extras.CommonServiceLocator 3.0.1")]
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18051 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.1.0")] [assembly: AssemblyConfiguration("Release built on 2013-12-03 10:23")] [assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")] [assembly: AssemblyDescription("Autofac.Extras.CommonServiceLocator 3.0.1")]
Split WCF functionality out of Autofac.Extras.Multitenant into a separate assembly/package, Autofac.Extras.Multitenant.Wcf. Both packages are versioned 3.1.0.
Split WCF functionality out of Autofac.Extras.Multitenant into a separate assembly/package, Autofac.Extras.Multitenant.Wcf. Both packages are versioned 3.1.0.
C#
mit
autofac/Autofac.Extras.CommonServiceLocator
28652caeb6156522b2ee211868d5e1e966edc306
Properties/VersionAssemblyInfo.cs
Properties/VersionAssemblyInfo.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.34003 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.2.0")] [assembly: AssemblyConfiguration("Release built on 2013-10-23 22:48")] [assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")] [assembly: AssemblyDescription("Autofac.Extras.AggregateService 3.0.2")]
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18051 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.2.0")] [assembly: AssemblyConfiguration("Release built on 2013-12-03 10:23")] [assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")] [assembly: AssemblyDescription("Autofac.Extras.AggregateService 3.0.2")]
Split WCF functionality out of Autofac.Extras.Multitenant into a separate assembly/package, Autofac.Extras.Multitenant.Wcf. Both packages are versioned 3.1.0.
Split WCF functionality out of Autofac.Extras.Multitenant into a separate assembly/package, Autofac.Extras.Multitenant.Wcf. Both packages are versioned 3.1.0.
C#
mit
autofac/Autofac.Extras.AggregateService
468e2a8fa6bbc93a912e0a5049077ee36bca7ebf
Opus.Core/PackageBuildList.cs
Opus.Core/PackageBuildList.cs
// <copyright file="PackageBuildList.cs" company="Mark Final"> // Opus // </copyright> // <summary>Opus Core</summary> // <author>Mark Final</author> namespace Opus.Core { public class PackageBuild { public PackageBuild(PackageIdentifier id) { this.Name = id.Name; this.Versions = new UniqueList<PackageIdentifier>(); this.Versions.Add(id); this.SelectedVersion = id; } public string Name { get; private set; } public UniqueList<PackageIdentifier> Versions { get; private set; } public PackageIdentifier SelectedVersion { get; set; } } public class PackageBuildList : UniqueList<PackageBuild> { public PackageBuild GetPackage(string name) { foreach (PackageBuild i in this) { if (i.Name == name) { return i; } } return null; } } }
// <copyright file="PackageBuildList.cs" company="Mark Final"> // Opus // </copyright> // <summary>Opus Core</summary> // <author>Mark Final</author> namespace Opus.Core { public class PackageBuild { public PackageBuild(PackageIdentifier id) { this.Name = id.Name; this.Versions = new UniqueList<PackageIdentifier>(); this.Versions.Add(id); this.SelectedVersion = id; } public string Name { get; private set; } public UniqueList<PackageIdentifier> Versions { get; private set; } public PackageIdentifier SelectedVersion { get; set; } public override string ToString() { System.Text.StringBuilder builder = new System.Text.StringBuilder(); builder.AppendFormat("{0}: Package '{1}' with {2} versions", base.ToString(), this.Name, this.Versions.Count); return builder.ToString(); } } public class PackageBuildList : UniqueList<PackageBuild> { public PackageBuild GetPackage(string name) { foreach (PackageBuild i in this) { if (i.Name == name) { return i; } } return null; } } }
Add an improved string representation of PackageBuild instances
[trunk] Add an improved string representation of PackageBuild instances
C#
bsd-3-clause
markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation
52ededb390ff36f873c85e869b4007af235ad59e
Drums/VDrumExplorer.Model/Schema/Json/HexInt32Converter.cs
Drums/VDrumExplorer.Model/Schema/Json/HexInt32Converter.cs
// Copyright 2020 Jon Skeet. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using Newtonsoft.Json; using System; using VDrumExplorer.Utility; namespace VDrumExplorer.Model.Schema.Json { internal class HexInt32Converter : JsonConverter<HexInt32> { public override void WriteJson(JsonWriter writer, HexInt32 value, JsonSerializer serializer) => writer.WriteValue(value.ToString()); public override HexInt32 ReadJson(JsonReader reader, Type objectType, HexInt32 existingValue, bool hasExistingValue, JsonSerializer serializer) => HexInt32.Parse(Preconditions.AssertNotNull((string?) reader.Value)); } }
// Copyright 2020 Jon Skeet. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using Newtonsoft.Json; using System; using VDrumExplorer.Utility; namespace VDrumExplorer.Model.Schema.Json { internal class HexInt32Converter : JsonConverter<HexInt32> { public override void WriteJson(JsonWriter writer, HexInt32? value, JsonSerializer serializer) => writer.WriteValue(value?.ToString()); public override HexInt32 ReadJson(JsonReader reader, Type objectType, HexInt32? existingValue, bool hasExistingValue, JsonSerializer serializer) => HexInt32.Parse(Preconditions.AssertNotNull((string?) reader.Value)); } }
Fix new warning around nullability
Fix new warning around nullability
C#
apache-2.0
jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode
431b5517d15cb177050b99d4dd1a456110e4526a
Assets/Scripts/HarryPotterUnity/Cards/PlayRequirements/InputRequirement.cs
Assets/Scripts/HarryPotterUnity/Cards/PlayRequirements/InputRequirement.cs
using HarryPotterUnity.Game; using JetBrains.Annotations; using UnityEngine; namespace HarryPotterUnity.Cards.PlayRequirements { public class InputRequirement : MonoBehaviour, ICardPlayRequirement { private BaseCard _cardInfo; [SerializeField, UsedImplicitly] private int _fromHandActionInputRequired; [SerializeField, UsedImplicitly] private int _inPlayActionInputRequired; public int FromHandActionInputRequired { get { return _fromHandActionInputRequired; } } public int InPlayActionInputRequired { get { return _inPlayActionInputRequired; } } private void Awake() { _cardInfo = GetComponent<BaseCard>(); if (GetComponent<InputGatherer>() == null) { gameObject.AddComponent<InputGatherer>(); } } public bool MeetsRequirement() { return _cardInfo.GetFromHandActionTargets().Count >= _fromHandActionInputRequired; } public void OnRequirementMet() { } } }
using HarryPotterUnity.Game; using JetBrains.Annotations; using UnityEngine; namespace HarryPotterUnity.Cards.PlayRequirements { public class InputRequirement : MonoBehaviour, ICardPlayRequirement { private BaseCard _cardInfo; [SerializeField, UsedImplicitly] private int _fromHandActionInputRequired; [SerializeField, UsedImplicitly] private int _inPlayActionInputRequired; public int FromHandActionInputRequired { get { return _fromHandActionInputRequired; } } public int InPlayActionInputRequired { get { return _inPlayActionInputRequired; } } private void Awake() { _cardInfo = GetComponent<BaseCard>(); if (GetComponent<InputGatherer>() == null) { gameObject.AddComponent<InputGatherer>(); } } public bool MeetsRequirement() { //TODO: Need to check whether this needs to check the FromHandActionTargets or the InPlayActionTargets! return _cardInfo.GetFromHandActionTargets().Count >= _fromHandActionInputRequired; } public void OnRequirementMet() { } } }
Add TODO for Input Requirement
Add TODO for Input Requirement
C#
mit
StefanoFiumara/Harry-Potter-Unity
62ff03224be369f835d5f99392bde48db5eec204
standard-library/Int32.cs
standard-library/Int32.cs
namespace System { /// <summary> /// Represents a 32-bit integer. /// </summary> public struct Int32 { // Note: integers are equivalent to instances of this data structure because // flame-llvm the contents of single-field structs as a value of their single // field, rather than as a LLVM struct. So a 32-bit integer becomes an i32 and // so does a `System.Int32`. So don't add, remove, or edit the fields in this // struct. private int value; /// <summary> /// Converts this integer to a string representation. /// </summary> /// <returns>The string representation for the integer.</returns> public string ToString() { return Convert.ToString(value); } } }
namespace System { /// <summary> /// Represents a 32-bit integer. /// </summary> public struct Int32 { // Note: integers are equivalent to instances of this data structure because // flame-llvm stores the contents of single-field structs as a value of their // field, rather than as a LLVM struct. So a 32-bit integer becomes an i32 and // so does a `System.Int32`. So don't add, remove, or edit the fields in this // struct. private int value; /// <summary> /// Converts this integer to a string representation. /// </summary> /// <returns>The string representation for the integer.</returns> public string ToString() { return Convert.ToString(value); } } }
Fix a typo in a comment
Fix a typo in a comment
C#
mit
jonathanvdc/flame-llvm,jonathanvdc/flame-llvm,jonathanvdc/flame-llvm
8801dfa8fb3b93d38072be9cef1fa642afadc73b
ExpandableList/ExpandableList.Android/Views/DetailsView.cs
ExpandableList/ExpandableList.Android/Views/DetailsView.cs
using Android.App; using Android.OS; using MvvmCross.Droid.Support.V7.AppCompat; using System; namespace ExpandableList.Droid.Views { [Activity(Label = "DetailsView")] public class DetailsView : MvxAppCompatActivity { protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); } catch (Exception ex) { } } } }
using Android.App; using Android.OS; using MvvmCross.Droid.Support.V7.AppCompat; using System; namespace ExpandableList.Droid.Views { [Activity(Label = "DetailsView")] public class DetailsView : MvxAppCompatActivity { protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); } } }
Fix build error with unused variable
Fix build error with unused variable
C#
mit
AlexStefan/template-app
118f233b57e040bc290bcf612b55400acef1561b
osu.Framework.Tests/Audio/AudioComponentTest.cs
osu.Framework.Tests/Audio/AudioComponentTest.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 NUnit.Framework; using osu.Framework.Audio; using osu.Framework.IO.Stores; using osu.Framework.Threading; namespace osu.Framework.Tests.Audio { [TestFixture] public class AudioComponentTest { [Test] public void TestVirtualTrack() { var thread = new AudioThread(); var store = new NamespacedResourceStore<byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources"); var manager = new AudioManager(thread, store, store); thread.Start(); var track = manager.Tracks.GetVirtual(); Assert.IsFalse(track.IsRunning); Assert.AreEqual(0, track.CurrentTime); track.Start(); Task.Delay(50); Assert.Greater(track.CurrentTime, 0); track.Stop(); Assert.IsFalse(track.IsRunning); thread.Exit(); Task.Delay(500); Assert.IsFalse(thread.Exited); } } }
// 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 NUnit.Framework; using osu.Framework.Audio; using osu.Framework.IO.Stores; using osu.Framework.Platform; using osu.Framework.Threading; namespace osu.Framework.Tests.Audio { [TestFixture] public class AudioComponentTest { [Test] public void TestVirtualTrack() { Architecture.SetIncludePath(); var thread = new AudioThread(); var store = new NamespacedResourceStore<byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources"); var manager = new AudioManager(thread, store, store); thread.Start(); var track = manager.Tracks.GetVirtual(); Assert.IsFalse(track.IsRunning); Assert.AreEqual(0, track.CurrentTime); track.Start(); Task.Delay(50); Assert.Greater(track.CurrentTime, 0); track.Stop(); Assert.IsFalse(track.IsRunning); thread.Exit(); Task.Delay(500); Assert.IsFalse(thread.Exited); } } }
Fix new test on CI host
Fix new test on CI host
C#
mit
peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework
742b9d9f4469a7aa97be61fa74534459be2c8e19
src/Arkivverket.Arkade.UI/Bootstrapper.cs
src/Arkivverket.Arkade.UI/Bootstrapper.cs
using System.Windows; using Arkivverket.Arkade.UI.Views; using Arkivverket.Arkade.Util; using Autofac; using Prism.Autofac; using Prism.Modularity; namespace Arkivverket.Arkade.UI { public class Bootstrapper : AutofacBootstrapper { protected override DependencyObject CreateShell() { return Container.Resolve<MainWindow>(); } protected override void InitializeShell() { Application.Current.MainWindow.Show(); } protected override void ConfigureModuleCatalog() { var catalog = (ModuleCatalog) ModuleCatalog; catalog.AddModule(typeof(ModuleAModule)); } protected override void ConfigureContainerBuilder(ContainerBuilder builder) { base.ConfigureContainerBuilder(builder); builder.RegisterModule(new ArkadeAutofacModule()); } } /* public class Bootstrapper : UnityBootstrapper { protected override DependencyObject CreateShell() { return Container.Resolve<MainWindow>(); } protected override void InitializeShell() { Application.Current.MainWindow.Show(); } protected override void ConfigureContainer() { base.ConfigureContainer(); Container.RegisterTypeForNavigation<View000Debug>("View000Debug"); Container.RegisterTypeForNavigation<View100Status>("View100Status"); ILogService logService = new RandomLogService(); Container.RegisterInstance(logService); } protected override void ConfigureModuleCatalog() { ModuleCatalog catalog = (ModuleCatalog)ModuleCatalog; catalog.AddModule(typeof(ModuleAModule)); } } public static class UnityExtensons { public static void RegisterTypeForNavigation<T>(this IUnityContainer container, string name) { container.RegisterType(typeof(object), typeof(T), name); } } */ }
using System.Windows; using Arkivverket.Arkade.UI.Views; using Arkivverket.Arkade.Util; using Autofac; using Prism.Autofac; using Prism.Modularity; namespace Arkivverket.Arkade.UI { public class Bootstrapper : AutofacBootstrapper { protected override DependencyObject CreateShell() { return Container.Resolve<MainWindow>(); } protected override void InitializeShell() { Application.Current.MainWindow.Show(); } protected override void ConfigureModuleCatalog() { var catalog = (ModuleCatalog) ModuleCatalog; catalog.AddModule(typeof(ModuleAModule)); } protected override void ConfigureContainerBuilder(ContainerBuilder builder) { base.ConfigureContainerBuilder(builder); builder.RegisterModule(new ArkadeAutofacModule()); } } }
Remove old bootstrapper stuff from UI-project.
Remove old bootstrapper stuff from UI-project.
C#
agpl-3.0
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
71da075e02a3a86123241f5508bff439fdc76335
src/Totem.Runtime/Timeline/ITimelineDb.cs
src/Totem.Runtime/Timeline/ITimelineDb.cs
using System; using System.Collections.Generic; using System.Linq; namespace Totem.Runtime.Timeline { /// <summary> /// Describes the database persisting the timeline /// </summary> public interface ITimelineDb { Many<TimelinePoint> Append(TimelinePosition cause, Many<Event> events); TimelinePoint AppendOccurred(TimelinePoint scheduledPoint); void RemoveFromSchedule(TimelinePosition position); TimelineResumeInfo ReadResumeInfo(); } }
using System; using System.Collections.Generic; using System.Linq; namespace Totem.Runtime.Timeline { /// <summary> /// Describes the database persisting the timeline /// </summary> public interface ITimelineDb { Many<TimelinePoint> Append(TimelinePosition cause, Many<Event> events); TimelinePoint AppendOccurred(TimelinePoint scheduledPoint); TimelineResumeInfo ReadResumeInfo(); } }
Remove unused method on timeline db
Remove unused method on timeline db
C#
mit
bwatts/Totem,bwatts/Totem
8fea3dacee5ce9d3cb46789a8a672668cc9deed0
src/Nancy/Session/Session.cs
src/Nancy/Session/Session.cs
namespace Nancy.Session { using System.Collections; using System.Collections.Generic; public class Session : ISession { private readonly IDictionary<string, object> dictionary; private bool hasChanged; public Session() : this(new Dictionary<string, object>(0)){} public Session(IDictionary<string, object> dictionary) { this.dictionary = dictionary; } public int Count { get { return dictionary.Count; } } public void DeleteAll() { if (Count > 0) { MarkAsChanged(); } dictionary.Clear(); } public void Delete(string key) { if (dictionary.Remove(key)) { MarkAsChanged(); } } public object this[string key] { get { return dictionary.ContainsKey(key) ? dictionary[key] : null; } set { dictionary[key] = value; MarkAsChanged(); } } public bool HasChanged { get { return this.hasChanged; } } IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } public IEnumerator<KeyValuePair<string, object>> GetEnumerator() { return dictionary.GetEnumerator(); } private void MarkAsChanged() { hasChanged = true; } } }
namespace Nancy.Session { using System.Collections; using System.Collections.Generic; public class Session : ISession { private readonly IDictionary<string, object> dictionary; private bool hasChanged; public Session() : this(new Dictionary<string, object>(0)){} public Session(IDictionary<string, object> dictionary) { this.dictionary = dictionary; } public int Count { get { return dictionary.Count; } } public void DeleteAll() { if (Count > 0) { MarkAsChanged(); } dictionary.Clear(); } public void Delete(string key) { if (dictionary.Remove(key)) { MarkAsChanged(); } } public object this[string key] { get { return dictionary.ContainsKey(key) ? dictionary[key] : null; } set { if (this[key] == value) return; dictionary[key] = value; MarkAsChanged(); } } public bool HasChanged { get { return this.hasChanged; } } IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } public IEnumerator<KeyValuePair<string, object>> GetEnumerator() { return dictionary.GetEnumerator(); } private void MarkAsChanged() { hasChanged = true; } } }
Update session only is value is changed
Update session only is value is changed
C#
mit
AlexPuiu/Nancy,tareq-s/Nancy,horsdal/Nancy,jonathanfoster/Nancy,rudygt/Nancy,sloncho/Nancy,AlexPuiu/Nancy,rudygt/Nancy,NancyFx/Nancy,tsdl2013/Nancy,xt0rted/Nancy,joebuschmann/Nancy,horsdal/Nancy,phillip-haydon/Nancy,fly19890211/Nancy,sadiqhirani/Nancy,albertjan/Nancy,sroylance/Nancy,MetSystem/Nancy,cgourlay/Nancy,blairconrad/Nancy,hitesh97/Nancy,malikdiarra/Nancy,dbabox/Nancy,ayoung/Nancy,guodf/Nancy,VQComms/Nancy,EIrwin/Nancy,AIexandr/Nancy,sloncho/Nancy,kekekeks/Nancy,jeff-pang/Nancy,charleypeng/Nancy,anton-gogolev/Nancy,dbolkensteyn/Nancy,blairconrad/Nancy,nicklv/Nancy,Worthaboutapig/Nancy,AIexandr/Nancy,jmptrader/Nancy,duszekmestre/Nancy,jmptrader/Nancy,AlexPuiu/Nancy,wtilton/Nancy,wtilton/Nancy,danbarua/Nancy,xt0rted/Nancy,khellang/Nancy,cgourlay/Nancy,fly19890211/Nancy,VQComms/Nancy,kekekeks/Nancy,asbjornu/Nancy,tparnell8/Nancy,vladlopes/Nancy,SaveTrees/Nancy,davidallyoung/Nancy,VQComms/Nancy,horsdal/Nancy,guodf/Nancy,VQComms/Nancy,tsdl2013/Nancy,AIexandr/Nancy,SaveTrees/Nancy,davidallyoung/Nancy,felipeleusin/Nancy,AcklenAvenue/Nancy,guodf/Nancy,tparnell8/Nancy,SaveTrees/Nancy,kekekeks/Nancy,damianh/Nancy,MetSystem/Nancy,MetSystem/Nancy,khellang/Nancy,davidallyoung/Nancy,ayoung/Nancy,joebuschmann/Nancy,NancyFx/Nancy,grumpydev/Nancy,NancyFx/Nancy,murador/Nancy,SaveTrees/Nancy,jongleur1983/Nancy,sloncho/Nancy,Novakov/Nancy,tparnell8/Nancy,phillip-haydon/Nancy,charleypeng/Nancy,ayoung/Nancy,ccellar/Nancy,sadiqhirani/Nancy,AcklenAvenue/Nancy,murador/Nancy,jeff-pang/Nancy,jongleur1983/Nancy,jonathanfoster/Nancy,thecodejunkie/Nancy,jmptrader/Nancy,malikdiarra/Nancy,duszekmestre/Nancy,felipeleusin/Nancy,hitesh97/Nancy,danbarua/Nancy,VQComms/Nancy,joebuschmann/Nancy,jchannon/Nancy,grumpydev/Nancy,wtilton/Nancy,EIrwin/Nancy,AlexPuiu/Nancy,asbjornu/Nancy,daniellor/Nancy,nicklv/Nancy,tsdl2013/Nancy,AIexandr/Nancy,ccellar/Nancy,NancyFx/Nancy,jongleur1983/Nancy,adamhathcock/Nancy,felipeleusin/Nancy,murador/Nancy,JoeStead/Nancy,charleypeng/Nancy,davidallyoung/Nancy,tparnell8/Nancy,guodf/Nancy,jchannon/Nancy,vladlopes/Nancy,grumpydev/Nancy,danbarua/Nancy,charleypeng/Nancy,AcklenAvenue/Nancy,damianh/Nancy,sloncho/Nancy,anton-gogolev/Nancy,EIrwin/Nancy,felipeleusin/Nancy,dbolkensteyn/Nancy,davidallyoung/Nancy,nicklv/Nancy,danbarua/Nancy,jeff-pang/Nancy,tareq-s/Nancy,fly19890211/Nancy,phillip-haydon/Nancy,cgourlay/Nancy,wtilton/Nancy,hitesh97/Nancy,jchannon/Nancy,xt0rted/Nancy,grumpydev/Nancy,JoeStead/Nancy,Crisfole/Nancy,albertjan/Nancy,Novakov/Nancy,murador/Nancy,tareq-s/Nancy,duszekmestre/Nancy,sroylance/Nancy,blairconrad/Nancy,ccellar/Nancy,ccellar/Nancy,dbolkensteyn/Nancy,tareq-s/Nancy,jongleur1983/Nancy,rudygt/Nancy,thecodejunkie/Nancy,MetSystem/Nancy,cgourlay/Nancy,Worthaboutapig/Nancy,jchannon/Nancy,dbabox/Nancy,sroylance/Nancy,JoeStead/Nancy,Crisfole/Nancy,sadiqhirani/Nancy,malikdiarra/Nancy,lijunle/Nancy,vladlopes/Nancy,joebuschmann/Nancy,EliotJones/NancyTest,Novakov/Nancy,anton-gogolev/Nancy,thecodejunkie/Nancy,dbolkensteyn/Nancy,Worthaboutapig/Nancy,EliotJones/NancyTest,dbabox/Nancy,adamhathcock/Nancy,Worthaboutapig/Nancy,daniellor/Nancy,jonathanfoster/Nancy,AIexandr/Nancy,malikdiarra/Nancy,jonathanfoster/Nancy,jmptrader/Nancy,daniellor/Nancy,albertjan/Nancy,AcklenAvenue/Nancy,albertjan/Nancy,jeff-pang/Nancy,xt0rted/Nancy,asbjornu/Nancy,khellang/Nancy,hitesh97/Nancy,lijunle/Nancy,khellang/Nancy,horsdal/Nancy,charleypeng/Nancy,duszekmestre/Nancy,sadiqhirani/Nancy,JoeStead/Nancy,rudygt/Nancy,asbjornu/Nancy,vladlopes/Nancy,ayoung/Nancy,lijunle/Nancy,phillip-haydon/Nancy,asbjornu/Nancy,lijunle/Nancy,daniellor/Nancy,tsdl2013/Nancy,EliotJones/NancyTest,dbabox/Nancy,jchannon/Nancy,damianh/Nancy,EIrwin/Nancy,sroylance/Nancy,fly19890211/Nancy,anton-gogolev/Nancy,blairconrad/Nancy,Crisfole/Nancy,thecodejunkie/Nancy,Novakov/Nancy,adamhathcock/Nancy,nicklv/Nancy,adamhathcock/Nancy,EliotJones/NancyTest
5fe764b2db98b30113fdc9f2fc7690df8db97ed8
osu.Game.Tournament/Components/TourneyVideo.cs
osu.Game.Tournament/Components/TourneyVideo.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Video; using osu.Game.Graphics; namespace osu.Game.Tournament.Components { public class TourneyVideo : CompositeDrawable { private readonly VideoSprite video; public TourneyVideo(Stream stream) { if (stream == null) { InternalChild = new Box { Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)), RelativeSizeAxes = Axes.Both, }; } else InternalChild = video = new VideoSprite(stream) { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, }; } public bool Loop { set { if (video != null) video.Loop = value; } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Video; using osu.Framework.Timing; using osu.Game.Graphics; namespace osu.Game.Tournament.Components { public class TourneyVideo : CompositeDrawable { private readonly VideoSprite video; private ManualClock manualClock; private IFrameBasedClock sourceClock; public TourneyVideo(Stream stream) { if (stream == null) { InternalChild = new Box { Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)), RelativeSizeAxes = Axes.Both, }; } else InternalChild = video = new VideoSprite(stream) { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, }; } public bool Loop { set { if (video != null) video.Loop = value; } } protected override void LoadComplete() { base.LoadComplete(); sourceClock = Clock; Clock = new FramedClock(manualClock = new ManualClock()); } protected override void Update() { base.Update(); // we want to avoid seeking as much as possible, because we care about performance, not sync. // to avoid seeking completely, we only increment out local clock when in an updating state. manualClock.CurrentTime += sourceClock.ElapsedFrameTime; } } }
Fix tournament videos stuttering when changing scenes
Fix tournament videos stuttering when changing scenes
C#
mit
EVAST9919/osu,peppy/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,2yangk23/osu,peppy/osu-new,johnneijzen/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,johnneijzen/osu,smoogipoo/osu,EVAST9919/osu,ppy/osu
4cc1771b574980b77b29d7f0a263488131f284c7
Assets/SourceCode/RoomGenerator.cs
Assets/SourceCode/RoomGenerator.cs
using UnityEngine; public class RoomGenerator : MonoBehaviour { public GameObject roomPrefab; public int roomCount = 100; public int spaceWidth = 500; public int spaceLength = 500; public int minRoomWidth = 5; public int maxRoomWidth = 20; public int minRoomLength = 5; public int maxRoomLength = 20; public Room[] generatedrRooms; public void Run() { for (int i = 0; i < this.transform.childCount; i++) { DestroyImmediate(this.transform.GetChild(i).gameObject); } generatedrRooms = new Room[roomCount]; for (int i = 0; i < roomCount; i++) { var posX = Random.Range (0, spaceWidth); var posZ = Random.Range (0, spaceLength); var sizeX = Random.Range (minRoomWidth, maxRoomWidth); var sizeZ = Random.Range (minRoomLength, maxRoomLength); var instance = Instantiate (roomPrefab); instance.transform.SetParent (this.transform); instance.transform.localPosition = new Vector3 (posX, 0f, posZ); instance.transform.localScale = Vector3.one; var room = instance.GetComponent<Room> (); room.Init (sizeX, sizeZ); generatedrRooms [i] = room; } } }
using UnityEngine; public class RoomGenerator : MonoBehaviour { public GameObject roomPrefab; public int roomCount = 100; public int spaceWidth = 500; public int spaceLength = 500; public int minRoomWidth = 5; public int maxRoomWidth = 20; public int minRoomLength = 5; public int maxRoomLength = 20; public Room[] generatedRooms; public void Run() { for (int i = 0; i < generatedRooms.Length; i++) { DestroyImmediate(generatedRooms[i].gameObject); } generatedRooms = new Room[roomCount]; for (int i = 0; i < roomCount; i++) { var posX = Random.Range (0, spaceWidth); var posZ = Random.Range (0, spaceLength); var sizeX = Random.Range (minRoomWidth, maxRoomWidth); var sizeZ = Random.Range (minRoomLength, maxRoomLength); var instance = Instantiate (roomPrefab); instance.transform.SetParent (this.transform); instance.transform.localPosition = new Vector3 (posX, 0f, posZ); instance.transform.localScale = Vector3.one; var room = instance.GetComponent<Room> (); room.Init (sizeX, sizeZ); generatedRooms [i] = room; } } }
Fix typo in public variable
Fix typo in public variable
C#
mit
Saduras/DungeonGenerator
247ff6c10cc5fbd24007107543ee21af233e4cf7
src/DeployStatus/Service/DeployStatusService.cs
src/DeployStatus/Service/DeployStatusService.cs
using System; using DeployStatus.Configuration; using DeployStatus.SignalR; using log4net; using Microsoft.Owin.Hosting; namespace DeployStatus.Service { public class DeployStatusService : IService { private IDisposable webApp; private readonly ILog log; private readonly DeployStatusConfiguration deployConfiguration; public DeployStatusService() { log = LogManager.GetLogger(typeof (DeployStatusService)); deployConfiguration = DeployStatusSettingsSection.Settings.AsDeployConfiguration(); } public void Start() { log.Info("Starting api polling service..."); DeployStatusState.Instance.Value.Start(deployConfiguration); var webAppUrl = deployConfiguration.WebAppUrl; log.Info($"Starting web app service on {webAppUrl}..."); webApp = WebApp.Start<Startup>(webAppUrl); log.Info("Started."); } public void Stop() { webApp.Dispose(); DeployStatusState.Instance.Value.Stop(); } } }
using System; using System.Linq; using DeployStatus.Configuration; using DeployStatus.SignalR; using log4net; using Microsoft.Owin.Hosting; namespace DeployStatus.Service { public class DeployStatusService : IService { private IDisposable webApp; private readonly ILog log; private readonly DeployStatusConfiguration deployConfiguration; public DeployStatusService() { log = LogManager.GetLogger(typeof (DeployStatusService)); deployConfiguration = DeployStatusSettingsSection.Settings.AsDeployConfiguration(); } public void Start() { log.Info("Starting api polling service..."); DeployStatusState.Instance.Value.Start(deployConfiguration); var webAppUrl = deployConfiguration.WebAppUrl; log.Info($"Starting web app service on {webAppUrl}..."); var startOptions = new StartOptions(); foreach (var url in webAppUrl.Split(',')) { startOptions.Urls.Add(url); } webApp = WebApp.Start<Startup>(startOptions); log.Info("Started."); } public void Stop() { webApp.Dispose(); DeployStatusState.Instance.Value.Stop(); } } }
Add support for listening on multiple urls.
Add support for listening on multiple urls.
C#
mit
Jark/DeployStatus,Jark/DeployStatus,Jark/DeployStatus
b11156b2cc1e19e419b3174558c1ac0200ee11bf
src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml.cs
src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml.cs
using System; using System.Windows.Controls; using GitHub.InlineReviews.Views; using GitHub.InlineReviews.ViewModels; namespace GitHub.InlineReviews.Tags { public partial class ShowInlineCommentGlyph : UserControl { readonly CommentTooltipView commentTooltipView; public ShowInlineCommentGlyph() { InitializeComponent(); commentTooltipView = new CommentTooltipView(); ToolTip = commentTooltipView; ToolTipOpening += ShowInlineCommentGlyph_ToolTipOpening; } private void ShowInlineCommentGlyph_ToolTipOpening(object sender, ToolTipEventArgs e) { var tag = Tag as ShowInlineCommentTag; var viewModel = new CommentTooltipViewModel(); foreach (var comment in tag.Thread.Comments) { var commentViewModel = new TooltipCommentViewModel(comment.User, comment.Body, comment.CreatedAt); viewModel.Comments.Add(commentViewModel); } commentTooltipView.DataContext = viewModel; } } }
using System; using System.Windows.Controls; using GitHub.InlineReviews.Views; using GitHub.InlineReviews.ViewModels; namespace GitHub.InlineReviews.Tags { public partial class ShowInlineCommentGlyph : UserControl { readonly ToolTip toolTip; public ShowInlineCommentGlyph() { InitializeComponent(); toolTip = new ToolTip(); ToolTip = toolTip; } protected override void OnToolTipOpening(ToolTipEventArgs e) { var tag = Tag as ShowInlineCommentTag; var viewModel = new CommentTooltipViewModel(); foreach (var comment in tag.Thread.Comments) { var commentViewModel = new TooltipCommentViewModel(comment.User, comment.Body, comment.CreatedAt); viewModel.Comments.Add(commentViewModel); } var view = new CommentTooltipView(); view.DataContext = viewModel; toolTip.Content = view; } protected override void OnToolTipClosing(ToolTipEventArgs e) { toolTip.Content = null; } } }
Create and release tooltip content on demand
Create and release tooltip content on demand Save memory by not holding on to contents of tooltip (comment thread).
C#
mit
github/VisualStudio,github/VisualStudio,github/VisualStudio
8d55340325b457427661d0ae31d8b0a5e66b255a
src/Umbraco.Web/Media/EmbedProviders/Youtube.cs
src/Umbraco.Web/Media/EmbedProviders/Youtube.cs
using System.Collections.Generic; namespace Umbraco.Web.Media.EmbedProviders { public class YouTube : EmbedProviderBase { public override string ApiEndpoint => "https://www.youtube.com/oembed"; public override string[] UrlSchemeRegex => new string[] { @"youtu.be/.*", @"youtu.be/.*" }; public override Dictionary<string, string> RequestParams => new Dictionary<string, string>() { //ApiUrl/?format=json {"format", "json"} }; public override string GetMarkup(string url, int maxWidth = 0, int maxHeight = 0) { var requestUrl = base.GetEmbedProviderUrl(url, maxWidth, maxHeight); var oembed = base.GetJsonResponse<OEmbedResponse>(requestUrl); return oembed.GetHtml(); } } }
using System.Collections.Generic; namespace Umbraco.Web.Media.EmbedProviders { public class YouTube : EmbedProviderBase { public override string ApiEndpoint => "https://www.youtube.com/oembed"; public override string[] UrlSchemeRegex => new string[] { @"youtu.be/.*", @"youtube.com/watch.*" }; public override Dictionary<string, string> RequestParams => new Dictionary<string, string>() { //ApiUrl/?format=json {"format", "json"} }; public override string GetMarkup(string url, int maxWidth = 0, int maxHeight = 0) { var requestUrl = base.GetEmbedProviderUrl(url, maxWidth, maxHeight); var oembed = base.GetJsonResponse<OEmbedResponse>(requestUrl); return oembed.GetHtml(); } } }
Fix up youtube URL regex matching
Fix up youtube URL regex matching
C#
mit
JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,leekelleher/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,bjarnef/Umbraco-CMS,NikRimington/Umbraco-CMS,KevinJump/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,hfloyd/Umbraco-CMS,umbraco/Umbraco-CMS,leekelleher/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,dawoe/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,arknu/Umbraco-CMS,mattbrailsford/Umbraco-CMS,bjarnef/Umbraco-CMS,NikRimington/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,rasmuseeg/Umbraco-CMS,robertjf/Umbraco-CMS,rasmuseeg/Umbraco-CMS,hfloyd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,bjarnef/Umbraco-CMS,abryukhov/Umbraco-CMS,leekelleher/Umbraco-CMS,leekelleher/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,mattbrailsford/Umbraco-CMS,NikRimington/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,madsoulswe/Umbraco-CMS,bjarnef/Umbraco-CMS,rasmuseeg/Umbraco-CMS,tcmorris/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,abjerner/Umbraco-CMS,madsoulswe/Umbraco-CMS
4b370ec763b69d06569933d71677a6d4727da66a
src/ErgastApi/Responses/ErgastResponse.cs
src/ErgastApi/Responses/ErgastResponse.cs
using System; using Newtonsoft.Json; namespace ErgastApi.Responses { // TODO: Use internal/private constructors for all response types? public abstract class ErgastResponse { [JsonProperty("url")] public virtual string RequestUrl { get; private set; } [JsonProperty("limit")] public virtual int Limit { get; private set; } [JsonProperty("offset")] public virtual int Offset { get; private set; } [JsonProperty("total")] public virtual int TotalResults { get; private set; } // TODO: Note that it can be inaccurate if limit/offset do not correlate // TODO: Test with 0 values public virtual int Page => Offset / Limit + 1; // TODO: Test with 0 values public virtual int TotalPages => (int) Math.Ceiling(TotalResults / (double)Limit); // TODO: Test public virtual bool HasMorePages => TotalResults > Limit + Offset; } }
using System; using Newtonsoft.Json; namespace ErgastApi.Responses { // TODO: Use internal/private constructors for all response types? public abstract class ErgastResponse { [JsonProperty("url")] public string RequestUrl { get; protected set; } [JsonProperty("limit")] public int Limit { get; protected set; } [JsonProperty("offset")] public int Offset { get; protected set; } [JsonProperty("total")] public int TotalResults { get; protected set; } // TODO: Note that it can be inaccurate if limit/offset do not divide evenly public int Page { get { if (Limit <= 0) return 1; return (int) Math.Ceiling((double) Offset / Limit) + 1; } } // TODO: Test with 0 values public int TotalPages => (int) Math.Ceiling(TotalResults / (double) Limit); // TODO: Test public bool HasMorePages => TotalResults > Limit + Offset; } }
Fix issue with Page calculation
Fix issue with Page calculation
C#
unlicense
Krusen/ErgastApi.Net
251cbc8f829a7b5a8687857e03aa9d5c4675b111
Modbus/IO/StreamResourceUtility.cs
Modbus/IO/StreamResourceUtility.cs
using System.Linq; using System.Text; namespace Modbus.IO { internal static class StreamResourceUtility { internal static string ReadLine(IStreamResource stream) { var result = new StringBuilder(); var singleByteBuffer = new byte[1]; do { stream.Read(singleByteBuffer, 0, 1); result.Append(Encoding.ASCII.GetChars(singleByteBuffer).First()); } while (!result.ToString().EndsWith(Modbus.NewLine)); return result.ToString().Substring(0, result.Length - Modbus.NewLine.Length); } } }
using System.Linq; using System.Text; namespace Modbus.IO { internal static class StreamResourceUtility { internal static string ReadLine(IStreamResource stream) { var result = new StringBuilder(); var singleByteBuffer = new byte[1]; do { if (0 == stream.Read(singleByteBuffer, 0, 1)) continue; result.Append(Encoding.ASCII.GetChars(singleByteBuffer).First()); } while (!result.ToString().EndsWith(Modbus.NewLine)); return result.ToString().Substring(0, result.Length - Modbus.NewLine.Length); } } }
Add checking of Read() return value.
Add checking of Read() return value. Without this using of non-initialized (0) value or value from the previous step of loop.
C#
mit
yvschmid/NModbus4,richardlawley/NModbus4,NModbus4/NModbus4,Maxwe11/NModbus4,NModbus/NModbus,xlgwr/NModbus4
320476f8da56704035b9da6f558960638ab4d1ef
src/GitHub.VisualStudio/Services/SharedResources.cs
src/GitHub.VisualStudio/Services/SharedResources.cs
using GitHub.UI; using GitHub.VisualStudio.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; namespace GitHub.VisualStudio { public static class SharedResources { static readonly Dictionary<string, DrawingBrush> drawingBrushes = new Dictionary<string, DrawingBrush>(); public static DrawingBrush GetDrawingForIcon(Octicon icon, Brush color) { string name = icon.ToString(); if (drawingBrushes.ContainsKey(name)) return drawingBrushes[name]; var brush = new DrawingBrush() { Drawing = new GeometryDrawing() { Brush = color, Pen = new Pen(color, 1.0).FreezeThis(), Geometry = OcticonPath.GetGeometryForIcon(icon).FreezeThis() } .FreezeThis(), Stretch = Stretch.Uniform } .FreezeThis(); drawingBrushes.Add(name, brush); return brush; } } }
using System.Collections.Generic; using System.Windows.Media; using GitHub.UI; using GitHub.VisualStudio.UI; namespace GitHub.VisualStudio { public static class SharedResources { static readonly Dictionary<string, DrawingBrush> drawingBrushes = new Dictionary<string, DrawingBrush>(); public static DrawingBrush GetDrawingForIcon(Octicon icon, Brush color) { string name = icon.ToString(); if (drawingBrushes.ContainsKey(name)) return drawingBrushes[name]; var brush = new DrawingBrush() { Drawing = new GeometryDrawing() { Brush = color, Pen = new Pen(color, 1.0).FreezeThis(), Geometry = OcticonPath.GetGeometryForIcon(icon).FreezeThis() } .FreezeThis(), Stretch = Stretch.Uniform } .FreezeThis(); drawingBrushes.Add(name, brush); return brush; } } }
Sort and remove unused usings
Sort and remove unused usings
C#
mit
SaarCohen/VisualStudio,YOTOV-LIMITED/VisualStudio,Dr0idKing/VisualStudio,luizbon/VisualStudio,shaunstanislaus/VisualStudio,yovannyr/VisualStudio,bbqchickenrobot/VisualStudio,github/VisualStudio,modulexcite/VisualStudio,github/VisualStudio,HeadhunterXamd/VisualStudio,radnor/VisualStudio,mariotristan/VisualStudio,GuilhermeSa/VisualStudio,8v060htwyc/VisualStudio,bradthurber/VisualStudio,GProulx/VisualStudio,ChristopherHackett/VisualStudio,AmadeusW/VisualStudio,nulltoken/VisualStudio,naveensrinivasan/VisualStudio,amytruong/VisualStudio,github/VisualStudio,pwz3n0/VisualStudio
998237b83d5d753a066e5910563cae3209481517
Samples/Stylet.Samples.RedditBrowser/Pages/TaskbarViewModel.cs
Samples/Stylet.Samples.RedditBrowser/Pages/TaskbarViewModel.cs
using Stylet.Samples.RedditBrowser.Events; using Stylet.Samples.RedditBrowser.RedditApi; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Stylet.Samples.RedditBrowser.Pages { public class TaskbarViewModel : Screen { private IEventAggregator events; public string Subreddit { get; set; } public IEnumerable<SortMode> SortModes { get; private set; } public SortMode SelectedSortMode { get; set; } public TaskbarViewModel(IEventAggregator events) { this.events = events; this.SortModes = SortMode.AllModes; this.SelectedSortMode = SortMode.Hot; } public void Open() { this.events.Publish(new OpenSubredditEvent() { Subreddit = this.Subreddit, SortMode = this.SelectedSortMode }); } } }
using Stylet.Samples.RedditBrowser.Events; using Stylet.Samples.RedditBrowser.RedditApi; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Stylet.Samples.RedditBrowser.Pages { public class TaskbarViewModel : Screen { private IEventAggregator events; public string Subreddit { get; set; } public IEnumerable<SortMode> SortModes { get; private set; } public SortMode SelectedSortMode { get; set; } public TaskbarViewModel(IEventAggregator events) { this.events = events; this.SortModes = SortMode.AllModes; this.SelectedSortMode = SortMode.Hot; } public bool CanOpen { get { return !String.IsNullOrWhiteSpace(this.Subreddit); } } public void Open() { this.events.Publish(new OpenSubredditEvent() { Subreddit = this.Subreddit, SortMode = this.SelectedSortMode }); } } }
Add extra work to RedditBrowser sample
Add extra work to RedditBrowser sample
C#
mit
canton7/Stylet,canton7/Stylet,cH40z-Lord/Stylet,cH40z-Lord/Stylet
2c9df53c35f0c6cf53acf44b6c56e3ff400ab2e3
PadReaderTest/Program.cs
PadReaderTest/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using XboxOnePadReader; namespace PadReaderTest { class Program { static void Main(string[] args) { ControllerReader myController = ControllerReader.Instance; int x = 0; while (x < 5) { Thread.Sleep(1); ++x; } myController.CloseController(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using XboxOnePadReader; namespace PadReaderTest { class Program { static void Main(string[] args) { ControllerReader myController = ControllerReader.Instance; int x = 0; while (x < 5) { Thread.Sleep(1000); ++x; } myController.CloseController(); } } }
Fix Sleep of the test program
Fix Sleep of the test program
C#
apache-2.0
badgio/XboxOneController,badgio/XboxOneController,badgio/XboxOneController
52ed00c76cc1c586fc2fd37d90ae5644d2d9afe6
Project1/Assets/Test1.cs
Project1/Assets/Test1.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Test1 : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Test1 : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { Condole.Log("This log is added by Suzuki"); } }
Write Log message for test
Write Log message for test
C#
mit
rexph/UnityPractice
32fe1f196e9bc955194c176ed49f74909a081ed0
OpenKh.Game/Global.cs
OpenKh.Game/Global.cs
namespace OpenKh.Game { public class Global { public const int ResolutionWidth = 512; public const int ResolutionHeight = 416; public const int ResolutionRemixWidth = 684; public const float ResolutionReMixRatio = 0.925f; public const float ResolutionBoostRatio = 2; } }
namespace OpenKh.Game { public class Global { public const int ResolutionWidth = 512; public const int ResolutionHeight = 416; public const int ResolutionRemixWidth = 684; public const float ResolutionReMixRatio = 0.925f; } }
Remove unused line of code
Remove unused line of code
C#
mit
Xeeynamo/KingdomHearts
c1a4f2e6afd823b9e36c73f76f16ea4445da0a88
osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs
osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Taiko.Difficulty; using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Taiko.Tests { public class TaikoDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko"; [TestCase(2.9811338051242915d, "diffcalc-test")] [TestCase(2.9811338051242915d, "diffcalc-test-strong")] public void Test(double expected, string name) => base.Test(expected, name); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(new TaikoRuleset(), beatmap); protected override Ruleset CreateRuleset() => new TaikoRuleset(); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Taiko.Difficulty; using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Taiko.Tests { public class TaikoDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko"; [TestCase(2.2905937546434592d, "diffcalc-test")] [TestCase(2.2905937546434592d, "diffcalc-test-strong")] public void Test(double expected, string name) => base.Test(expected, name); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(new TaikoRuleset(), beatmap); protected override Ruleset CreateRuleset() => new TaikoRuleset(); } }
Update expected SR in test
Update expected SR in test
C#
mit
NeoAdonis/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,peppy/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,ppy/osu,smoogipoo/osu