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
84a6516a0e72ae5c4fc650c778d5907f0d73dfb1
UnicornPacker/UnicornPacker/Models/OrdersContext.cs
UnicornPacker/UnicornPacker/Models/OrdersContext.cs
using Microsoft.Data.Entity; using System; using System.IO; using Windows.Storage; namespace UnicornPacker.Models { public class OrdersContext : DbContext { public DbSet<Order> Orders { get; set; } public DbSet<OrderLine> OrderLines { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { string localDirectory = string.Empty; try { localDirectory = ApplicationData.Current.LocalFolder.Path; } catch (InvalidOperationException) { } optionsBuilder.UseSqlite($"Data source={Path.Combine(localDirectory, "Orders001.db")}"); } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<Order>() .Property(o => o.OrderId) .ValueGeneratedNever(); modelBuilder.Entity<OrderLine>() .Key(l => new { l.OrderId, l.ProductId }); } } }
using Microsoft.Data.Entity; using System; using System.IO; using Windows.Storage; namespace UnicornPacker.Models { public class OrdersContext : DbContext { public DbSet<Order> Orders { get; set; } public DbSet<OrderLine> OrderLines { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlite($"Data source={GetLocalDatabaseFile()}"); } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<Order>() .Property(o => o.OrderId) .ValueGeneratedNever(); modelBuilder.Entity<OrderLine>() .Key(l => new { l.OrderId, l.ProductId }); } private static string GetLocalDatabaseFile() { string localDirectory = string.Empty; try { localDirectory = ApplicationData.Current.LocalFolder.Path; } catch (InvalidOperationException) { } return Path.Combine(localDirectory, "Orders.db"); } } }
Clean up code for SQLite connection
:art: Clean up code for SQLite connection
C#
apache-2.0
rowanmiller/UnicornStore,rowanmiller/UnicornStore,rowanmiller/UnicornStore
71d00720b168ebbd5f1769b43511f79ae66c400b
ValveResourceFormat/Resource/ResourceTypes/Sound.cs
ValveResourceFormat/Resource/ResourceTypes/Sound.cs
using System; using System.IO; using System.Text; namespace ValveResourceFormat.ResourceTypes { public class Sound : Blocks.ResourceData { private BinaryReader Reader; private long DataOffset; private NTRO NTROBlock; public override void Read(BinaryReader reader, Resource resource) { Reader = reader; reader.BaseStream.Position = Offset; if (resource.Blocks.ContainsKey(BlockType.NTRO)) { NTROBlock = new NTRO(); NTROBlock.Offset = Offset; NTROBlock.Size = Size; NTROBlock.Read(reader, resource); } DataOffset = Offset + Size; } public byte[] GetSound() { Reader.BaseStream.Position = DataOffset; return Reader.ReadBytes((int)Reader.BaseStream.Length); } public override string ToString() { if (NTROBlock != null) { return NTROBlock.ToString(); } return "This is a sound."; } } }
using System; using System.IO; using System.Text; namespace ValveResourceFormat.ResourceTypes { public class Sound : Blocks.ResourceData { private BinaryReader Reader; private NTRO NTROBlock; public override void Read(BinaryReader reader, Resource resource) { Reader = reader; reader.BaseStream.Position = Offset; if (resource.Blocks.ContainsKey(BlockType.NTRO)) { NTROBlock = new NTRO(); NTROBlock.Offset = Offset; NTROBlock.Size = Size; NTROBlock.Read(reader, resource); } } public byte[] GetSound() { Reader.BaseStream.Position = Offset + Size; return Reader.ReadBytes((int)(Reader.BaseStream.Length - Reader.BaseStream.Position)); } public override string ToString() { if (NTROBlock != null) { return NTROBlock.ToString(); } return "This is a sound."; } } }
Read sound until the end of file correctly
Read sound until the end of file correctly
C#
mit
SteamDatabase/ValveResourceFormat
44f0a1a89d891f8cc674520e7ad3ff2a88b4febe
IronFoundry.Container/ContainerHostDependencyHelper.cs
IronFoundry.Container/ContainerHostDependencyHelper.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; namespace IronFoundry.Container { public class ContainerHostDependencyHelper { const string ContainerHostAssemblyName = "IronFoundry.Container.Host"; readonly Assembly containerHostAssembly; public ContainerHostDependencyHelper() { this.containerHostAssembly = GetContainerHostAssembly(); } public virtual string ContainerHostExe { get { return ContainerHostAssemblyName + ".exe"; } } public virtual string ContainerHostExePath { get { return containerHostAssembly.Location; } } public string ContainerHostExeConfig { get { return ContainerHostExe + ".config"; } } public string ContainerHostExeConfigPath { get { return ContainerHostExePath + ".config"; } } static Assembly GetContainerHostAssembly() { return Assembly.ReflectionOnlyLoad(ContainerHostAssemblyName); } public virtual IReadOnlyList<string> GetContainerHostDependencies() { return EnumerateLocalReferences(containerHostAssembly).ToList(); } IEnumerable<string> EnumerateLocalReferences(Assembly assembly) { foreach (var referencedAssemblyName in assembly.GetReferencedAssemblies()) { var referencedAssembly = Assembly.ReflectionOnlyLoad(referencedAssemblyName.FullName); if (!referencedAssembly.GlobalAssemblyCache) { yield return referencedAssembly.Location; if (!referencedAssembly.Location.Contains("ICSharpCode.SharpZipLib.dll")) foreach (var nestedReferenceFilePath in EnumerateLocalReferences(referencedAssembly)) yield return nestedReferenceFilePath; } } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; namespace IronFoundry.Container { public class ContainerHostDependencyHelper { const string ContainerHostAssemblyName = "IronFoundry.Container.Host"; readonly Assembly containerHostAssembly; public ContainerHostDependencyHelper() { this.containerHostAssembly = GetContainerHostAssembly(); } public virtual string ContainerHostExe { get { return ContainerHostAssemblyName + ".exe"; } } public virtual string ContainerHostExePath { get { return containerHostAssembly.Location; } } public string ContainerHostExeConfig { get { return ContainerHostExe + ".config"; } } public string ContainerHostExeConfigPath { get { return ContainerHostExePath + ".config"; } } static Assembly GetContainerHostAssembly() { return Assembly.ReflectionOnlyLoad(ContainerHostAssemblyName); } public virtual IReadOnlyList<string> GetContainerHostDependencies() { return EnumerateLocalReferences(containerHostAssembly).ToList(); } IEnumerable<string> EnumerateLocalReferences(Assembly assembly) { foreach (var referencedAssemblyName in assembly.GetReferencedAssemblies()) { var referencedAssembly = Assembly.ReflectionOnlyLoad(referencedAssemblyName.FullName); if (!referencedAssembly.GlobalAssemblyCache) { yield return referencedAssembly.Location; foreach (var nestedReferenceFilePath in EnumerateLocalReferences(referencedAssembly)) yield return nestedReferenceFilePath; } } } } }
Remove unnecessary check for SharpZipLib dll.
Remove unnecessary check for SharpZipLib dll.
C#
apache-2.0
cloudfoundry-incubator/IronFrame,cloudfoundry/IronFrame,cloudfoundry/IronFrame,cloudfoundry-incubator/if_warden,cloudfoundry-incubator/if_warden,stefanschneider/IronFrame,cloudfoundry-incubator/IronFrame,stefanschneider/IronFrame
ae0e7e64e854d62e2099599e86a8962d0a41c342
DesktopWidgets/Helpers/ProcessHelper.cs
DesktopWidgets/Helpers/ProcessHelper.cs
#region using System.Diagnostics; using System.IO; using DesktopWidgets.Classes; #endregion namespace DesktopWidgets.Helpers { internal static class ProcessHelper { public static void Launch(string path, string args = "", string startIn = "", ProcessWindowStyle style = ProcessWindowStyle.Normal) { Launch(new ProcessFile {Path = path, Arguments = args, StartInFolder = startIn, WindowStyle = style}); } public static void Launch(ProcessFile file) { if (string.IsNullOrWhiteSpace(file.Path) || !File.Exists(file.Path)) return; Process.Start(new ProcessStartInfo { FileName = file.Path, Arguments = file.Arguments, WorkingDirectory = file.StartInFolder, WindowStyle = file.WindowStyle }); } public static void OpenFolder(string path) { if (File.Exists(path) || Directory.Exists(path)) Launch("explorer.exe", "/select," + path); } } }
#region using System.Diagnostics; using System.IO; using DesktopWidgets.Classes; #endregion namespace DesktopWidgets.Helpers { internal static class ProcessHelper { public static void Launch(string path, string args = "", string startIn = "", ProcessWindowStyle style = ProcessWindowStyle.Normal) { Launch(new ProcessFile {Path = path, Arguments = args, StartInFolder = startIn, WindowStyle = style}); } public static void Launch(ProcessFile file) { Process.Start(new ProcessStartInfo { FileName = file.Path, Arguments = file.Arguments, WorkingDirectory = file.StartInFolder, WindowStyle = file.WindowStyle }); } public static void OpenFolder(string path) { if (File.Exists(path) || Directory.Exists(path)) Launch("explorer.exe", "/select," + path); } } }
Revert "Fix error when launching missing files"
Revert "Fix error when launching missing files" This reverts commit df9c57117a6b2de5ec1dee7926f929bc4d24693f.
C#
apache-2.0
danielchalmers/DesktopWidgets
cd4bb3cf02101d013c05c4e0c24dd43c2eb3be4c
src/Dbus/Connection.Authentication.cs
src/Dbus/Connection.Authentication.cs
using System; using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace Dbus { public partial class Connection { private static async Task authenticate(Stream stream) { using (var writer = new StreamWriter(stream, Encoding.ASCII, 32, true)) using (var reader = new StreamReader(stream, Encoding.ASCII, false, 32, true)) { writer.NewLine = "\r\n"; await writer.WriteAsync("\0AUTH EXTERNAL ").ConfigureAwait(false); var uid = getuid(); var stringUid = $"{uid}"; var uidBytes = Encoding.ASCII.GetBytes(stringUid); foreach (var b in uidBytes) await writer.WriteAsync($"{b:X}").ConfigureAwait(false); await writer.WriteLineAsync().ConfigureAwait(false); await writer.FlushAsync().ConfigureAwait(false); var response = await reader.ReadLineAsync().ConfigureAwait(false); if (!response.StartsWith("OK ")) throw new InvalidOperationException("Authentication failed: " + response); await writer.WriteLineAsync("BEGIN").ConfigureAwait(false); await writer.FlushAsync().ConfigureAwait(false); } } [DllImport("c")] private static extern int getuid(); } }
using System; using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace Dbus { public partial class Connection { private static async Task authenticate(Stream stream) { using (var writer = new StreamWriter(stream, Encoding.ASCII, 32, true)) using (var reader = new StreamReader(stream, Encoding.ASCII, false, 32, true)) { writer.NewLine = "\r\n"; await writer.WriteAsync("\0AUTH EXTERNAL ").ConfigureAwait(false); var uid = getuid(); var stringUid = $"{uid}"; var uidBytes = Encoding.ASCII.GetBytes(stringUid); foreach (var b in uidBytes) await writer.WriteAsync($"{b:X}").ConfigureAwait(false); await writer.WriteLineAsync().ConfigureAwait(false); await writer.FlushAsync().ConfigureAwait(false); var response = await reader.ReadLineAsync().ConfigureAwait(false); if (!response.StartsWith("OK ")) throw new InvalidOperationException("Authentication failed: " + response); await writer.WriteLineAsync("BEGIN").ConfigureAwait(false); await writer.FlushAsync().ConfigureAwait(false); } } [DllImport("libc")] private static extern int getuid(); } }
Add a `lib` prefix to the DllImport so it works with mono
Add a `lib` prefix to the DllImport so it works with mono
C#
mit
Tragetaschen/DbusCore
a9452e7eb3b7af3c3a63c6f2c431be392b52fdbf
examples/TestObjects.cs
examples/TestObjects.cs
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Collections.Generic; using NDesk.DBus; using org.freedesktop.DBus; public class ManagedDBusTestObjects { public static void Main () { Bus bus = Bus.Session; ObjectPath myPath = new ObjectPath ("/org/ndesk/test"); string myName = "org.ndesk.test"; //TODO: write the rest of this demo and implement } } public class Device : IDevice { public string GetName () { return "Some device"; } } public class DeviceManager : IDeviceManager { public IDevice GetCurrentDevice () { return new Device (); } } public interface IDevice { string GetName (); } public interface IDeviceManager { IDevice GetCurrentDevice (); } public interface IUglyDeviceManager { ObjectPath GetCurrentDevice (); }
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Collections.Generic; using NDesk.DBus; using org.freedesktop.DBus; public class ManagedDBusTestObjects { public static void Main () { Bus bus = Bus.Session; ObjectPath myPath = new ObjectPath ("/org/ndesk/test"); string myName = "org.ndesk.test"; //TODO: write the rest of this demo and implement } } public class Device : IDevice { public string Name { get { return "Some device"; } } } public class DeviceManager : IDeviceManager { public IDevice CurrentDevice { get { return new Device (); } } } public interface IDevice { string Name { get; } } public interface IDeviceManager { IDevice CurrentDevice { get; } } public interface IUglyDeviceManager { ObjectPath CurrentDevice { get; } }
Use properties in example code
Use properties in example code
C#
mit
openmedicus/dbus-sharp,Tragetaschen/dbus-sharp,arfbtwn/dbus-sharp,Tragetaschen/dbus-sharp,mono/dbus-sharp,arfbtwn/dbus-sharp,mono/dbus-sharp,openmedicus/dbus-sharp
ffb196dbdb212d87132cc86ed79c4b8cfce94d23
Sandra.UI.WF/Properties/AssemblyInfo.cs
Sandra.UI.WF/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Sandra")] [assembly: AssemblyDescription("Hosted on https://github.com/PenguinF/sandra-three")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Sandra")] [assembly: AssemblyCopyright("Copyright © 2002-2016 - Henk Nicolai")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Sandra")] [assembly: AssemblyDescription("Hosted on https://github.com/PenguinF/sandra-three")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Sandra")] [assembly: AssemblyCopyright("Copyright © 2004-2016 - Henk Nicolai")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
Correct year when development started.
Correct year when development started.
C#
apache-2.0
PenguinF/sandra-three
6651acbbf84791ea73a200497689d2a9c9daaad4
CustomLinearScalers/Gaussian.cs
CustomLinearScalers/Gaussian.cs
using System; namespace Mpdn.CustomLinearScaler { namespace Example { public class Gaussian : ICustomLinearScaler { public Guid Guid { get { return new Guid("647351FF-7FEC-4EAB-86C7-CE1BEF43EFD4"); } } public string Name { get { return "Gaussian"; } } public bool AllowDeRing { get { return false; } } public ScalerTaps MaxTapCount { get { return ScalerTaps.Eight; } } public float GetWeight(float n, int width) { return (float) GaussianKernel(n, width); } private static double GaussianKernel(double x, double radius) { var sigma = radius/6; return Math.Exp(-(x*x/(2*sigma*sigma))); } } } }
using System; namespace Mpdn.CustomLinearScaler { namespace Example { public class Gaussian : ICustomLinearScaler { public Guid Guid { get { return new Guid("647351FF-7FEC-4EAB-86C7-CE1BEF43EFD4"); } } public string Name { get { return "Gaussian"; } } public bool AllowDeRing { get { return false; } } public ScalerTaps MaxTapCount { get { return ScalerTaps.Eight; } } public float GetWeight(float n, int width) { return (float) GaussianKernel(n, width / 2); } private static double GaussianKernel(double x, double radius) { var sigma = radius / 4; return Math.Exp(-(x*x/(2*sigma*sigma))); } } } }
Fix radius calculation and lower sigma.
Fix radius calculation and lower sigma.
C#
mit
zachsaw/RenderScripts
9751010f08a222b06498b9a88a6cc4493d340a45
Components/Log/Log_Visual_Behaviour.cs
Components/Log/Log_Visual_Behaviour.cs
using UnityEngine; using UnityEngine.UI; using System.Collections; namespace UDBase.Components.Log { public class Log_Visual_Behaviour : MonoBehaviour { public Text Text; public void Init() { Text.text = ""; } public void AddMessage(string msg) { Text.text += msg + "\n"; } } }
using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; namespace UDBase.Components.Log { public class Log_Visual_Behaviour : MonoBehaviour { public Text Text; List<string> _messages = new List<string>(); public void Init() { Clear(); } public void Clear() { Text.text = ""; } public void AddMessage(string msg) { _messages.Add(msg); ApplyMessage(msg); } void ApplyMessage(string msg) { Text.text += msg + "\n"; } } }
Store messages in list to future filter; Clear method;
Store messages in list to future filter; Clear method;
C#
mit
KonH/UDBase
a111afadfda3aa6f29e456fa6eaa081330c277d0
test/Helpers/SplatModeDetectorSetUp.cs
test/Helpers/SplatModeDetectorSetUp.cs
using System; using System.Linq; using System.Reflection; using NUnit.Framework; [SetUpFixture] public class SplatModeDetectorSetUp { static SplatModeDetectorSetUp() { // HACK: Force .NET 4.5 version of Splat to load when executing inside NCrunch var ncrunchAsms = Environment.GetEnvironmentVariable("NCrunch.AllAssemblyLocations")?.Split(';'); if (ncrunchAsms != null) { ncrunchAsms.Where(x => x.EndsWith(@"\Net45\Splat.dll")).Select(Assembly.LoadFrom).FirstOrDefault(); } } [OneTimeSetUp] public void RunBeforeAnyTests() { Splat.ModeDetector.Current.SetInUnitTestRunner(true); } }
using System; using System.Linq; using System.Reflection; using NUnit.Framework; [SetUpFixture] public class SplatModeDetectorSetUp { [OneTimeSetUp] public void RunBeforeAnyTests() { Splat.ModeDetector.Current.SetInUnitTestRunner(true); } }
Remove hack to load correct version of Splat.
Remove hack to load correct version of Splat.
C#
mit
github/VisualStudio,github/VisualStudio,github/VisualStudio
e583a17ef8381a15ae9f59635dae7e0cfbdd2aac
src/Microsoft.AspNetCore.SpaServices/Prerendering/PrerenderingServiceCollectionExtensions.cs
src/Microsoft.AspNetCore.SpaServices/Prerendering/PrerenderingServiceCollectionExtensions.cs
using System; using System.Collections.Generic; using System.Text; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.NodeServices; using Microsoft.AspNetCore.SpaServices.Prerendering; using Microsoft.Extensions.DependencyInjection.Extensions; namespace Microsoft.Extensions.DependencyInjection { /// <summary> /// Extension methods for setting up prerendering features in an <see cref="IServiceCollection" />. /// </summary> public static class PrerenderingServiceCollectionExtensions { /// <summary> /// Configures the dependency injection system to supply an implementation /// of <see cref="ISpaPrerenderer"/>. /// </summary> /// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param> public static void AddSpaPrerenderer(this IServiceCollection serviceCollection) { serviceCollection.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>(); serviceCollection.AddSingleton<ISpaPrerenderer, DefaultSpaPrerenderer>(); } } }
using Microsoft.AspNetCore.SpaServices.Prerendering; namespace Microsoft.Extensions.DependencyInjection { /// <summary> /// Extension methods for setting up prerendering features in an <see cref="IServiceCollection" />. /// </summary> public static class PrerenderingServiceCollectionExtensions { /// <summary> /// Configures the dependency injection system to supply an implementation /// of <see cref="ISpaPrerenderer"/>. /// </summary> /// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param> public static void AddSpaPrerenderer(this IServiceCollection serviceCollection) { serviceCollection.AddHttpContextAccessor(); serviceCollection.AddSingleton<ISpaPrerenderer, DefaultSpaPrerenderer>(); } } }
Clean up how IHttpContextAccessor is added
Clean up how IHttpContextAccessor is added
C#
apache-2.0
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
cd2285b8ddc0b5de1100ebbe9d2a65d8b9aead19
WpfAboutView/Properties/AssemblyInfo.cs
WpfAboutView/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("WpfAboutView")] [assembly: AssemblyDescription("Simple About control with app name, icon, version, and credits")] [assembly: AssemblyCompany("Daniel Chalmers")] [assembly: AssemblyProduct("WpfAboutView")] [assembly: AssemblyCopyright("© Daniel Chalmers 2017")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.1.0.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("WpfAboutView")] [assembly: AssemblyDescription("Simple About control with app name, icon, version, and credits")] [assembly: AssemblyCompany("Daniel Chalmers")] [assembly: AssemblyProduct("WpfAboutView")] [assembly: AssemblyCopyright("© Daniel Chalmers 2018")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.1.0.0")]
Update copyright year to 2018
Update copyright year to 2018
C#
mit
danielchalmers/WpfAboutView
02f94dcc24f9d3a4f569a9124704d780fdcc2722
osu.Framework.Benchmarks/BenchmarkManySpinningBoxes.cs
osu.Framework.Benchmarks/BenchmarkManySpinningBoxes.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 BenchmarkDotNet.Attributes; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osuTK.Graphics; namespace osu.Framework.Benchmarks { public class BenchmarkManySpinningBoxes : GameBenchmark { [Test] [Benchmark] public void RunFrame() => RunSingleFrame(); protected override Game CreateGame() => new TestGame(); private class TestGame : Game { protected override void LoadComplete() { base.LoadComplete(); for (int i = 0; i < 1000; i++) { var box = new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black }; Add(box); box.Spin(200, RotationDirection.Clockwise); } } } } }
// 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 BenchmarkDotNet.Attributes; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osuTK; using osuTK.Graphics; namespace osu.Framework.Benchmarks { public class BenchmarkManySpinningBoxes : GameBenchmark { private TestGame game; [Test] [Benchmark] public void RunFrame() { game.MainContent.AutoSizeAxes = Axes.None; game.MainContent.RelativeSizeAxes = Axes.Both; RunSingleFrame(); } [Test] [Benchmark] public void RunFrameWithAutoSize() { game.MainContent.RelativeSizeAxes = Axes.None; game.MainContent.AutoSizeAxes = Axes.Both; RunSingleFrame(); } [Test] [Benchmark] public void RunFrameWithAutoSizeDuration() { game.MainContent.RelativeSizeAxes = Axes.None; game.MainContent.AutoSizeAxes = Axes.Both; game.MainContent.AutoSizeDuration = 100; RunSingleFrame(); } protected override Game CreateGame() => game = new TestGame(); private class TestGame : Game { public Container MainContent; protected override void LoadComplete() { base.LoadComplete(); Add(MainContent = new Container()); for (int i = 0; i < 1000; i++) { var box = new Box { Size = new Vector2(100), Colour = Color4.Black }; MainContent.Add(box); box.Spin(200, RotationDirection.Clockwise); } } } } }
Add autosize coverage to spinning boxes benchmark
Add autosize coverage to spinning boxes benchmark
C#
mit
peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework
24fe7538fd0e7eb7d9592760978e716636751069
osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs
osu.Game.Tournament/Screens/Showcase/TournamentLogo.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; namespace osu.Game.Tournament.Screens.Showcase { public class TournamentLogo : CompositeDrawable { public TournamentLogo() { RelativeSizeAxes = Axes.X; Margin = new MarginPadding { Vertical = 5 }; Height = 100; } [BackgroundDependencyLoader] private void load(TextureStore textures) { InternalChild = new Sprite { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, FillMode = FillMode.Fit, RelativeSizeAxes = Axes.Both, Texture = textures.Get("game-screen-logo"), }; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; namespace osu.Game.Tournament.Screens.Showcase { public class TournamentLogo : CompositeDrawable { public TournamentLogo() { RelativeSizeAxes = Axes.X; Margin = new MarginPadding { Vertical = 5 }; Height = 100; } [BackgroundDependencyLoader] private void load(TextureStore textures) { InternalChild = new Sprite { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, FillMode = FillMode.Fit, RelativeSizeAxes = Axes.Both, Texture = textures.Get("header-logo"), }; } } }
Use new logo name for showcase screen
Use new logo name for showcase screen
C#
mit
ppy/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,EVAST9919/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu-new,NeoAdonis/osu,EVAST9919/osu,peppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu
4e479a917768be7e105fbf98a02ae30a12216757
Core/EntityCore/Context.cs
Core/EntityCore/Context.cs
using EntityCore.DynamicEntity; using EntityCore.Utils; using System.Configuration; using System.Data.Common; using System.Data.Entity; using System.Data.Entity.Infrastructure; namespace EntityCore { public static class Context { public static DynamicEntityContext New(string nameOrConnectionString) { Check.NotEmpty(nameOrConnectionString, "nameOrConnectionString"); var connnection = DbHelpers.GetDbConnection(nameOrConnectionString); DbCompiledModel model = GetCompiledModel(connnection); return new DynamicEntityContext(nameOrConnectionString, model); } public static DynamicEntityContext New(DbConnection existingConnection) { Check.NotNull(existingConnection, "existingConnection"); DbCompiledModel model = GetCompiledModel(existingConnection); return new DynamicEntityContext(existingConnection, model, false); } private static DbCompiledModel GetCompiledModel(DbConnection connection) { var builder = new DbModelBuilder(DbModelBuilderVersion.Latest); foreach (var entity in EntityTypeCache.GetEntitiesTypes(connection)) builder.RegisterEntityType(entity); var model = builder.Build(connection); return model.Compile(); } } }
using EntityCore.DynamicEntity; using EntityCore.Utils; using System.Data.Common; using System.Data.Entity; using System.Data.Entity.Infrastructure; using System.Data.Entity.ModelConfiguration.Conventions; using System.Data.SqlClient; using System.Linq; namespace EntityCore { public static class Context { public static DynamicEntityContext New(string nameOrConnectionString) { Check.NotEmpty(nameOrConnectionString, "nameOrConnectionString"); var connection = DbHelpers.GetDbConnection(nameOrConnectionString); DbCompiledModel model = GetCompiledModel(connection); return new DynamicEntityContext(nameOrConnectionString, model); } public static DynamicEntityContext New(DbConnection existingConnection) { Check.NotNull(existingConnection, "existingConnection"); DbCompiledModel model = GetCompiledModel(existingConnection); return new DynamicEntityContext(existingConnection, model, false); } private static DbCompiledModel GetCompiledModel(DbConnection connection) { var builder = new DbModelBuilder(DbModelBuilderVersion.Latest); foreach (var entity in EntityTypeCache.GetEntitiesTypes(connection)) builder.RegisterEntityType(entity); if (!(connection is SqlConnection)) // Compatible Effort. See https://effort.codeplex.com/workitem/678 builder.Conventions.Remove<ColumnAttributeConvention>(); var model = builder.Build(connection); return model.Compile(); } } }
Remove unsupported column attribute convention with no sql connection.
Remove unsupported column attribute convention with no sql connection.
C#
mit
xaviermonin/EntityCore
81768a1239041df745955ee24632359be2abef10
src/OpenZH.Data/Map/PolygonTrigger.cs
src/OpenZH.Data/Map/PolygonTrigger.cs
using System.IO; using OpenZH.Data.Utilities.Extensions; namespace OpenZH.Data.Map { public sealed class PolygonTrigger { public string Name { get; private set; } public string LayerName { get; private set; } public uint UniqueId { get; private set; } public PolygonTriggerType TriggerType { get; private set; } public MapVector3i[] Points { get; private set; } public static PolygonTrigger Parse(BinaryReader reader) { var name = reader.ReadUInt16PrefixedAsciiString(); var layerName = reader.ReadUInt16PrefixedAsciiString(); var uniqueId = reader.ReadUInt32(); var triggerType = reader.ReadUInt32AsEnum<PolygonTriggerType>(); var unknown = reader.ReadUInt16(); if (unknown != 0) { throw new InvalidDataException(); } var numPoints = reader.ReadUInt32(); var points = new MapVector3i[numPoints]; for (var i = 0; i < numPoints; i++) { points[i] = MapVector3i.Parse(reader); } return new PolygonTrigger { Name = name, LayerName = layerName, UniqueId = uniqueId, TriggerType = triggerType, Points = points }; } } public enum PolygonTriggerType : uint { Area = 0, Water = 1 } }
using System; using System.IO; using OpenZH.Data.Utilities.Extensions; namespace OpenZH.Data.Map { public sealed class PolygonTrigger { public string Name { get; private set; } public string LayerName { get; private set; } public uint UniqueId { get; private set; } public PolygonTriggerType TriggerType { get; private set; } public MapVector3i[] Points { get; private set; } public static PolygonTrigger Parse(BinaryReader reader) { var name = reader.ReadUInt16PrefixedAsciiString(); var layerName = reader.ReadUInt16PrefixedAsciiString(); var uniqueId = reader.ReadUInt32(); var triggerType = reader.ReadUInt32AsEnum<PolygonTriggerType>(); var unknown = reader.ReadUInt16(); if (unknown != 0) { throw new InvalidDataException(); } var numPoints = reader.ReadUInt32(); var points = new MapVector3i[numPoints]; for (var i = 0; i < numPoints; i++) { points[i] = MapVector3i.Parse(reader); } return new PolygonTrigger { Name = name, LayerName = layerName, UniqueId = uniqueId, TriggerType = triggerType, Points = points }; } } [Flags] public enum PolygonTriggerType : uint { Area = 0, Water = 1, River = 256, Unknown = 65536, WaterAndRiver = Water | River, WaterAndUnknown = Water | Unknown, } }
Support more polygon trigger types
Support more polygon trigger types
C#
mit
feliwir/openSage,feliwir/openSage
b71cea2722ae1f080f9ef72228cc48482a70c2f7
Mos6510.Tests/Instructions/InyTests.cs
Mos6510.Tests/Instructions/InyTests.cs
using NUnit.Framework; using Mos6510.Instructions; namespace Mos6510.Tests.Instructions { [TestFixture] public class InyTests { [Test] public void IncrementsTheValueInRegisterY() { const int initialValue = 42; var model = new ProgrammingModel(); model.GetRegister(RegisterName.Y).SetValue(initialValue); var instruction = new Iny(); instruction.Execute(model); Assert.That(model.GetRegister(RegisterName.Y).GetValue(), Is.EqualTo(initialValue + 1)); } } }
using NUnit.Framework; using Mos6510.Instructions; namespace Mos6510.Tests.Instructions { [TestFixture] public class InyTests { [Test] public void IncrementsTheValueInRegisterY() { const int initialValue = 42; var model = new ProgrammingModel(); model.GetRegister(RegisterName.Y).SetValue(initialValue); var instruction = new Iny(); instruction.Execute(model); Assert.That(model.GetRegister(RegisterName.Y).GetValue(), Is.EqualTo(initialValue + 1)); } [TestCase(0x7F, true)] [TestCase(0x7E, false)] public void VerifyValuesOfNegativeFlag(int initialValue, bool expectedResult) { var model = new ProgrammingModel(); model.GetRegister(RegisterName.Y).SetValue(initialValue); model.NegativeFlag = !expectedResult; var instruction = new Iny(); instruction.Execute(model); Assert.That(model.NegativeFlag, Is.EqualTo(expectedResult)); } [TestCase(0xFF, true)] [TestCase(0x00, false)] public void VerifyValuesOfZeroFlag(int initialValue, bool expectedResult) { var model = new ProgrammingModel(); model.GetRegister(RegisterName.Y).SetValue(initialValue); model.ZeroFlag = !expectedResult; var instruction = new Iny(); instruction.Execute(model); Assert.That(model.ZeroFlag, Is.EqualTo(expectedResult)); } } }
Add tests for the status flags set by iny.
Add tests for the status flags set by iny. There is no need for production code changes, as the status flag logic is already present in the RegisterUtils class.
C#
mit
joshpeterson/mos,joshpeterson/mos,joshpeterson/mos
6e603871528b5c74ae09647befcc03b70643f1b0
MongoDBDriver/AssemblyInfo.cs
MongoDBDriver/AssemblyInfo.cs
using System; using System.Reflection; using System.Security.Permissions; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("MongoDBDriver")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.0.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: System.Runtime.InteropServices.ComVisible(false)] [assembly: CLSCompliantAttribute(true)] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Bson")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Bson")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)]
using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Permissions; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("MongoDBDriver")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.0.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: System.Runtime.InteropServices.ComVisible(false)] [assembly: CLSCompliantAttribute(true)] [assembly: InternalsVisibleTo("MongoDB.Driver.Tests")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Bson")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Bson")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)]
Allow MongoDB.Driver.Tests to see internals of MongoDB.Driver.
Allow MongoDB.Driver.Tests to see internals of MongoDB.Driver.
C#
apache-2.0
samus/mongodb-csharp,mongodb-csharp/mongodb-csharp,zh-huan/mongodb
599f3e00407f6bf84b5be82a1c6d3c30f75be6f9
src/Features/Lsif/Generator/Graph/Item.cs
src/Features/Lsif/Generator/Graph/Item.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph { /// <summary> /// Represents a single item that points to a range from a result. See https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#request-textdocumentreferences /// for an example of item edges. /// </summary> internal sealed class Item : Edge { public Id<LsifDocument> Document { get; } public string? Property { get; } public Item(Id<Vertex> outVertex, Id<Range> range, Id<LsifDocument> document, IdFactory idFactory, string? property = null) : base(label: "item", outVertex, new[] { range.As<Range, Vertex>() }, idFactory) { Document = document; Property = property; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph { /// <summary> /// Represents a single item that points to a range from a result. See https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#request-textdocumentreferences /// for an example of item edges. /// </summary> internal sealed class Item : Edge { public Id<LsifDocument> Shard { get; } public string? Property { get; } public Item(Id<Vertex> outVertex, Id<Range> range, Id<LsifDocument> document, IdFactory idFactory, string? property = null) : base(label: "item", outVertex, new[] { range.As<Range, Vertex>() }, idFactory) { Shard = document; Property = property; } } }
Rename document to shard in item edges
Rename document to shard in item edges
C#
mit
jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,mavasani/roslyn,mavasani/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn
84a5d3dc94e8969da6cec20a4c1bed03b83c6805
Gu.Wpf.UiAutomation/WindowsAPI/POINT.cs
Gu.Wpf.UiAutomation/WindowsAPI/POINT.cs
// ReSharper disable InconsistentNaming #pragma warning disable namespace Gu.Wpf.UiAutomation.WindowsAPI { using System; using System.Diagnostics; using System.Runtime.InteropServices; using System.Windows; [DebuggerDisplay("({X}, {Y})")] [StructLayout(LayoutKind.Sequential)] public struct POINT : IEquatable<POINT> { public int X; public int Y; public POINT(int x, int y) { this.X = x; this.Y = y; } public static bool operator ==(POINT left, POINT right) { return left.Equals(right); } public static bool operator !=(POINT left, POINT right) { return !left.Equals(right); } public static POINT Create(Point p) { return new POINT { X = (int)p.X, Y = (int)p.Y, }; } /// <inheritdoc /> public bool Equals(POINT other) { return this.X == other.X && this.Y == other.Y; } /// <inheritdoc /> public override bool Equals(object obj) => obj is POINT other && this.Equals(other); /// <inheritdoc /> public override int GetHashCode() { unchecked { return (this.X * 397) ^ this.Y; } } } }
// ReSharper disable InconsistentNaming #pragma warning disable namespace Gu.Wpf.UiAutomation.WindowsAPI { using System; using System.Diagnostics; using System.Runtime.InteropServices; using System.Windows; [DebuggerDisplay("({X}, {Y})")] [StructLayout(LayoutKind.Sequential)] public struct POINT : IEquatable<POINT> { public int X; public int Y; public POINT(int x, int y) { this.X = x; this.Y = y; } public static bool operator ==(POINT left, POINT right) { return left.Equals(right); } public static bool operator !=(POINT left, POINT right) { return !left.Equals(right); } /// <inheritdoc /> public bool Equals(POINT other) { return this.X == other.X && this.Y == other.Y; } /// <inheritdoc /> public override bool Equals(object obj) => obj is POINT other && this.Equals(other); /// <inheritdoc /> public override int GetHashCode() { unchecked { return (this.X * 397) ^ this.Y; } } internal static POINT Create(Point p) { return new POINT { X = (int)p.X, Y = (int)p.Y, }; } } }
Make point factory method internal.
Make point factory method internal.
C#
mit
JohanLarsson/Gu.Wpf.UiAutomation
f7138326a23533f72e1de787f97c95a48281458b
IPTables.Net/Iptables/IPTablesTables.cs
IPTables.Net/Iptables/IPTablesTables.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using IPTables.Net.Exceptions; namespace IPTables.Net.Iptables { /// <summary> /// Data to define the default IPTables tables and chains /// </summary> internal class IPTablesTables { static internal Dictionary<String, List<String>> Tables = new Dictionary<string, List<string>> { { "filter", new List<string>{"INPUT", "FORWARD", "OUTPUT"} }, { "nat", new List<string>{"PREROUTING", "POSTROUTING", "OUTPUT"} }, { "raw", new List<string>{"PREROUTING", "POSTROUTING"} }, { "mangle", new List<string>{"INPUT", "FORWARD", "OUTPUT", "PREROUTING", "POSTROUTING"} }, }; internal static List<String> GetInternalChains(String table) { if (!Tables.ContainsKey(table)) { throw new IpTablesNetException(String.Format("Unknown Table: {0}", table)); } return Tables[table]; } internal static bool IsInternalChain(String table, String chain) { return GetInternalChains(table).Contains(chain); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using IPTables.Net.Exceptions; namespace IPTables.Net.Iptables { /// <summary> /// Data to define the default IPTables tables and chains /// </summary> internal class IPTablesTables { static internal Dictionary<String, List<String>> Tables = new Dictionary<string, List<string>> { { "filter", new List<string>{"INPUT", "FORWARD", "OUTPUT"} }, { "nat", new List<string>{"PREROUTING", "POSTROUTING", "OUTPUT"} }, { "raw", new List<string>{"PREROUTING", "POSTROUTING", "OUTPUT"} }, { "mangle", new List<string>{"INPUT", "FORWARD", "OUTPUT", "PREROUTING", "POSTROUTING"} }, }; internal static List<String> GetInternalChains(String table) { if (!Tables.ContainsKey(table)) { throw new IpTablesNetException(String.Format("Unknown Table: {0}", table)); } return Tables[table]; } internal static bool IsInternalChain(String table, String chain) { return GetInternalChains(table).Contains(chain); } } }
Add OUTPUT chain to raw, remove POSTROUTING
Add OUTPUT chain to raw, remove POSTROUTING
C#
apache-2.0
splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net
b218046fa28ef9ebb257663adf5388d9174345ee
osu.Game/Rulesets/Mods/ModUsage.cs
osu.Game/Rulesets/Mods/ModUsage.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.Rulesets.Mods { /// <summary> /// The usage of this mod to determine whether it's playable in such context. /// </summary> public enum ModUsage { /// <summary> /// Used for a per-user gameplay session. /// Determines whether the mod is playable by an end user. /// </summary> User, /// <summary> /// Used in multiplayer but must be applied to all users. /// This is generally the case for mods which affect the length of gameplay. /// </summary> MultiplayerRoomWide, /// <summary> /// Used in multiplayer either at a room or per-player level (i.e. "free mod"). /// </summary> MultiplayerPerPlayer, } }
// 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.Rulesets.Mods { /// <summary> /// The usage of this mod to determine whether it's playable in such context. /// </summary> public enum ModUsage { /// <summary> /// Used for a per-user gameplay session. /// </summary> User, /// <summary> /// Used in multiplayer but must be applied to all users. /// This is generally the case for mods which affect the length of gameplay. /// </summary> MultiplayerRoomWide, /// <summary> /// Used in multiplayer either at a room or per-player level (i.e. "free mod"). /// </summary> MultiplayerPerPlayer, } }
Remove redundant line from mod usage
Remove redundant line from mod usage
C#
mit
ppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu,ppy/osu,peppy/osu
d461f3553c9c7fabc6be465d26318730208f1b8a
Testing/TestingDispatch.cs
Testing/TestingDispatch.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Diagnostics; namespace MatterHackers.MatterControl.Testing { public class TestingDispatch { string errorLogFileName = null; public TestingDispatch() { errorLogFileName = string.Format("ErrorLog - {0:yyyy-MM-dd hh-mmtt}.txt", DateTime.Now); string firstLine = string.Format("MatterControl Errors: {0:yyyy-MM-dd hh:mm:ss tt}", DateTime.Now); using (StreamWriter file = new StreamWriter(errorLogFileName)) { file.WriteLine(errorLogFileName, firstLine); } } public void RunTests(string[] testCommands) { try { ReleaseTests.AssertDebugNotDefined(); } catch (Exception e) { DumpException(e); } try { MatterHackers.GCodeVisualizer.GCodeFile.AssertDebugNotDefined(); } catch (Exception e) { DumpException(e); } } void DumpException(Exception e) { using (StreamWriter w = File.AppendText(errorLogFileName)) { w.WriteLine(e.Message); w.Write(e.StackTrace); w.WriteLine(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Diagnostics; namespace MatterHackers.MatterControl.Testing { public class TestingDispatch { string errorLogFileName = null; public TestingDispatch() { errorLogFileName = "ErrorLog.txt"; string firstLine = string.Format("MatterControl Errors: {0:yyyy-MM-dd hh:mm:ss tt}", DateTime.Now); using (StreamWriter file = new StreamWriter(errorLogFileName)) { file.WriteLine(errorLogFileName, firstLine); } } public void RunTests(string[] testCommands) { try { ReleaseTests.AssertDebugNotDefined(); } catch (Exception e) { DumpException(e); } try { MatterHackers.GCodeVisualizer.GCodeFile.AssertDebugNotDefined(); } catch (Exception e) { DumpException(e); } } void DumpException(Exception e) { using (StreamWriter w = File.AppendText(errorLogFileName)) { w.WriteLine(e.Message); w.Write(e.StackTrace); w.WriteLine(); } } } }
Save as consistent filename to make other scripting easier.
Save as consistent filename to make other scripting easier.
C#
bsd-2-clause
ddpruitt/MatterControl,rytz/MatterControl,unlimitedbacon/MatterControl,MatterHackers/MatterControl,mmoening/MatterControl,gregory-diaz/MatterControl,tellingmachine/MatterControl,mmoening/MatterControl,CodeMangler/MatterControl,MatterHackers/MatterControl,mmoening/MatterControl,rytz/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,CodeMangler/MatterControl,gregory-diaz/MatterControl,jlewin/MatterControl,MatterHackers/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,rytz/MatterControl,jlewin/MatterControl,ddpruitt/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,CodeMangler/MatterControl,tellingmachine/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,ddpruitt/MatterControl
997e831065fad27a72009bd13ba4d9708ed54d17
Diagnostics/UnhelpfulDebugger/Program.cs
Diagnostics/UnhelpfulDebugger/Program.cs
using System; namespace UnhelpfulDebugger { class Program { static void Main() { string awkward1 = "Foo\\Bar"; string awkward2 = "FindEle‌​ment"; float awkward3 = 4.9999995f; Console.WriteLine(awkward1); PrintString(awkward1); Console.WriteLine(awkward2); PrintString(awkward2); Console.WriteLine(awkward3); PrintDouble(awkward3); } static void PrintString(string text) { Console.WriteLine($"Text: '{text}'"); Console.WriteLine($"Length: {text.Length}"); for (int i = 0; i < text.Length; i++) { Console.WriteLine($"{i,2} U+{((int)text[i]):0000} '{text[i]}'"); } } static void PrintDouble(double value) => Console.WriteLine(DoubleConverter.ToExactString(value)); } }
using System; namespace UnhelpfulDebugger { class Program { static void Main() { string awkward1 = "Foo\\Bar"; string awkward2 = "FindEle‌​ment"; double awkward3 = 4.9999999999999995d; Console.WriteLine(awkward1); PrintString(awkward1); Console.WriteLine(awkward2); PrintString(awkward2); Console.WriteLine(awkward3); PrintDouble(awkward3); } static void PrintString(string text) { Console.WriteLine($"Text: '{text}'"); Console.WriteLine($"Length: {text.Length}"); for (int i = 0; i < text.Length; i++) { Console.WriteLine($"{i,2} U+{((int)text[i]):0000} '{text[i]}'"); } } static void PrintDouble(double value) => Console.WriteLine(DoubleConverter.ToExactString(value)); } }
Use double instead of float
Use double instead of float
C#
apache-2.0
jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode
b73a2fd54780aea619977dd7a3928cf9e639e9ee
osu.Framework.iOS/Input/IOSTextInput.cs
osu.Framework.iOS/Input/IOSTextInput.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using Foundation; using osu.Framework.Input; namespace osu.Framework.iOS.Input { public class IOSTextInput : ITextInputSource { private readonly IOSGameView view; private string pending = string.Empty; public IOSTextInput(IOSGameView view) { this.view = view; } public bool ImeActive => false; public string GetPendingText() { try { return pending; } finally { pending = string.Empty; } } private void handleShouldChangeCharacters(NSRange range, string text) { if (text == " " || text.Trim().Length > 0) pending += text; } public void Deactivate(object sender) { view.KeyboardTextField.HandleShouldChangeCharacters -= handleShouldChangeCharacters; view.KeyboardTextField.UpdateFirstResponder(false); } public void Activate(object sender) { view.KeyboardTextField.HandleShouldChangeCharacters += handleShouldChangeCharacters; view.KeyboardTextField.UpdateFirstResponder(true); } public event Action<string> OnNewImeComposition; public event Action<string> OnNewImeResult; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using Foundation; using osu.Framework.Input; namespace osu.Framework.iOS.Input { public class IOSTextInput : ITextInputSource { private readonly IOSGameView view; private string pending = string.Empty; public IOSTextInput(IOSGameView view) { this.view = view; } public bool ImeActive => false; public string GetPendingText() { try { return pending; } finally { pending = string.Empty; } } private void handleShouldChangeCharacters(NSRange range, string text) { if (text == " " || text.Trim().Length > 0) pending += text; } public void Deactivate(object sender) { view.KeyboardTextField.HandleShouldChangeCharacters -= handleShouldChangeCharacters; view.KeyboardTextField.UpdateFirstResponder(false); } public void Activate(object sender) { view.KeyboardTextField.HandleShouldChangeCharacters += handleShouldChangeCharacters; view.KeyboardTextField.UpdateFirstResponder(true); } public event Action<string> OnNewImeComposition { add { } remove { } } public event Action<string> OnNewImeResult { add { } remove { } } } }
Use empty accessor for unimplemented events.
Use empty accessor for unimplemented events.
C#
mit
smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework
e1b0f2ee75abed1a74326bfe69429ee86190ad0c
osu.Framework/Input/StateChanges/MouseScrollRelativeInput.cs
osu.Framework/Input/StateChanges/MouseScrollRelativeInput.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.Input.StateChanges.Events; using osu.Framework.Input.States; using osuTK; namespace osu.Framework.Input.StateChanges { /// <summary> /// Denotes a relative change of mouse scroll. /// Pointing devices such as mice provide relative scroll input. /// </summary> public class MouseScrollRelativeInput : IInput { /// <summary> /// The change in scroll. This is added to the current scroll. /// </summary> public Vector2 Delta; /// <summary> /// Whether the change came from a device supporting precision scrolling. /// </summary> /// <remarks> /// In cases this is true, scroll events will generally map 1:1 to user's input, rather than incrementing in large "notches" (as expected of traditional scroll wheels). /// </remarks> public bool IsPrecise; public void Apply(InputState state, IInputStateChangeHandler handler) { var mouse = state.Mouse; if (Delta != Vector2.Zero) { var lastScroll = mouse.Scroll; mouse.Scroll += Delta; mouse.LastSource = this; handler.HandleInputStateChange(new MouseScrollChangeEvent(state, this, lastScroll, IsPrecise)); } } } }
// 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.Input.StateChanges.Events; using osu.Framework.Input.States; using osuTK; namespace osu.Framework.Input.StateChanges { /// <summary> /// Denotes a relative change of mouse scroll. /// Pointing devices such as mice provide relative scroll input. /// </summary> public class MouseScrollRelativeInput : IInput { /// <summary> /// The change in scroll. This is added to the current scroll. /// </summary> public Vector2 Delta; /// <summary> /// Whether the change came from a device supporting precision scrolling. /// </summary> /// <remarks> /// In cases this is true, scroll events will generally map 1:1 to user's input, rather than incrementing in large "notches" (as expected of traditional scroll wheels). /// </remarks> public bool IsPrecise; public void Apply(InputState state, IInputStateChangeHandler handler) { var mouse = state.Mouse; if (Delta != Vector2.Zero) { if (!IsPrecise && Delta.X == 0 && state.Keyboard.ShiftPressed) Delta = new Vector2(Delta.Y, 0); var lastScroll = mouse.Scroll; mouse.Scroll += Delta; mouse.LastSource = this; handler.HandleInputStateChange(new MouseScrollChangeEvent(state, this, lastScroll, IsPrecise)); } } } }
Convert vertical scroll to horizontal when shift is held
Convert vertical scroll to horizontal when shift is held
C#
mit
smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework
ca12f0367c2cfaae7da6051d76e35343b079806d
examples/asp.net-mvc/HR.Web/Views/Employee/Index.cshtml
examples/asp.net-mvc/HR.Web/Views/Employee/Index.cshtml
 @{ ViewBag.Title = "Employees Overview"; } <h2>Employees Overview</h2> You can only see this page if you have the <strong>employee_read</strong> permissions.
@using System.Security.Claims @{ ViewBag.Title = "Employees Overview"; } <h2>Employees Overview</h2> You can only see this page if you have the <strong>employee_read</strong> permissions. <br/> <br/> @if (ClaimsPrincipal.Current.HasClaim(ClaimTypes.Role, "employee_create")) { <a href="@Url.Action("Create", "Employee")" class="btn btn-info btn-lg">Create a new employee</a> }
Hide or show button in sample application
Hide or show button in sample application
C#
mit
darbio/auth0-roles-permissions-dashboard-sample,darbio/auth0-roles-permissions-dashboard-sample,auth0/auth0-roles-permissions-dashboard-sample,darbio/auth0-roles-permissions-dashboard-sample,auth0/auth0-roles-permissions-dashboard-sample,auth0/auth0-roles-permissions-dashboard-sample
57d233683ea5401f44259458e11533bd468f32d8
GUI/Utils/Settings.cs
GUI/Utils/Settings.cs
using System.Collections.Generic; using System.Drawing; using System.IO; using ValveKeyValue; namespace GUI.Utils { internal static class Settings { public class AppConfig { public List<string> GameSearchPaths { get; set; } = new List<string>(); public string BackgroundColor { get; set; } = string.Empty; public string OpenDirectory { get; set; } = string.Empty; public string SaveDirectory { get; set; } = string.Empty; } private const string SettingsFilePath = "settings.txt"; public static AppConfig Config { get; set; } = new AppConfig(); public static Color BackgroundColor { get; set; } = Color.FromArgb(60, 60, 60); public static void Load() { if (!File.Exists(SettingsFilePath)) { Save(); return; } using (var stream = new FileStream(SettingsFilePath, FileMode.Open, FileAccess.Read)) { Config = KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Deserialize<AppConfig>(stream, KVSerializerOptions.DefaultOptions); } BackgroundColor = ColorTranslator.FromHtml(Config.BackgroundColor); } public static void Save() { Config.BackgroundColor = ColorTranslator.ToHtml(BackgroundColor); using (var stream = new FileStream(SettingsFilePath, FileMode.Create, FileAccess.Write, FileShare.None)) { KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Serialize(stream, Config, nameof(ValveResourceFormat)); } } } }
using System.Collections.Generic; using System.Drawing; using System.IO; using ValveKeyValue; namespace GUI.Utils { internal static class Settings { public class AppConfig { public List<string> GameSearchPaths { get; set; } = new List<string>(); public string BackgroundColor { get; set; } = string.Empty; public string OpenDirectory { get; set; } = string.Empty; public string SaveDirectory { get; set; } = string.Empty; } private static string SettingsFilePath; public static AppConfig Config { get; set; } = new AppConfig(); public static Color BackgroundColor { get; set; } = Color.FromArgb(60, 60, 60); public static void Load() { SettingsFilePath = Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), "settings.txt"); if (!File.Exists(SettingsFilePath)) { Save(); return; } using (var stream = new FileStream(SettingsFilePath, FileMode.Open, FileAccess.Read)) { Config = KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Deserialize<AppConfig>(stream, KVSerializerOptions.DefaultOptions); } BackgroundColor = ColorTranslator.FromHtml(Config.BackgroundColor); } public static void Save() { Config.BackgroundColor = ColorTranslator.ToHtml(BackgroundColor); using (var stream = new FileStream(SettingsFilePath, FileMode.Create, FileAccess.Write, FileShare.None)) { KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Serialize(stream, Config, nameof(ValveResourceFormat)); } } } }
Save settings.txt to same folder as the assembly
Save settings.txt to same folder as the assembly Fixes #109
C#
mit
SteamDatabase/ValveResourceFormat
bf75fadfac64455ef25130458c1abef681d64d4b
src/Controllers/Home.cs
src/Controllers/Home.cs
using System; using System.Linq; using downr.Services; using Microsoft.AspNetCore.Mvc; namespace downr.Controllers { public class HomeController : Controller { IYamlIndexer _indexer; public HomeController(IYamlIndexer indexer) { _indexer = indexer; } [Route("{id?}")] public IActionResult Index(string id) { // if no slug was provided show the last one if (string.IsNullOrEmpty(id)) return RedirectToAction("Index", "Posts", new { slug = _indexer.Metadata.ElementAt(0).Slug }); // if the slug was provided AND found, redirect to it if (_indexer.Metadata.Any(x => x.Slug == id)) return RedirectToAction("Index", "Posts", new { slug = _indexer.Metadata.ElementAt(0).Slug }); else // no match was found, show the last one return RedirectToAction("Index", "Posts", new { slug = _indexer.Metadata.ElementAt(0).Slug }); } } }
using System; using System.Linq; using downr.Services; using Microsoft.AspNetCore.Mvc; namespace downr.Controllers { public class HomeController : Controller { IYamlIndexer _indexer; public HomeController(IYamlIndexer indexer) { _indexer = indexer; } [Route("{id?}")] public IActionResult Index(string id) { //Go to a slug if provided otherwise go to latest. var slug = _indexer.Metadata.FirstOrDefault(x => x.Slug == id)?.Slug; return RedirectToAction("Index", "Posts", new { slug = slug ?? _indexer.Metadata.ElementAt(0).Slug }); } } }
Fix logic in home index to go to a slug if provided
Fix logic in home index to go to a slug if provided
C#
apache-2.0
bradygaster/downr,bradygaster/downr,spboyer/downr,spboyer/downr,bradygaster/downr
c73c6ed6b42bbf0b110d7c6174ce5cb8cb1aeb1f
source/CroquetAustralia.Website/Layouts/Shared/Sidebar.cshtml
source/CroquetAustralia.Website/Layouts/Shared/Sidebar.cshtml
<div class="sticky-notes"> <div class="sticky-note"> <i class="pin"></i> <div class="content green"> <h1> GC Handicapping System </h1> <p> New <a href="/disciplines/golf-croquet/resources">GC Handicapping System</a> comes into effect 3 April, 2017 </p> </div> </div> </div>
<div class="sticky-notes"> <div class="sticky-note"> <i class="pin"></i> <div class="content green"> <h1> GC Handicapping System </h1> <p> New <a href="/disciplines/golf-croquet/resources">GC Handicapping System</a> came into effect 3 April, 2017 </p> </div> </div> </div>
Change GC Handicapping sticky note
Change GC Handicapping sticky note
C#
mit
croquet-australia/croquet-australia-website,croquet-australia/website-application,croquet-australia/croquet-australia.com.au,croquet-australia/croquet-australia.com.au,croquet-australia/croquet-australia.com.au,croquet-australia/website-application,croquet-australia/croquet-australia-website,croquet-australia/croquet-australia-website,croquet-australia/website-application,croquet-australia/croquet-australia-website,croquet-australia/croquet-australia.com.au,croquet-australia/website-application
159e6888803818767878e625b6507311694f7850
src/VisualStudio/LiveShare/Test/RunCodeActionsHandlerTests.cs
src/VisualStudio/LiveShare/Test/RunCodeActionsHandlerTests.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageServer.CustomProtocol; using Newtonsoft.Json.Linq; using Roslyn.Test.Utilities; using Xunit; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests { public class RunCodeActionsHandlerTests : AbstractLiveShareRequestHandlerTests { [WpfFact] public async Task TestRunCodeActionsAsync() { var markup = @"class A { void M() { {|caret:|}int i = 1; } }"; var (solution, ranges) = CreateTestSolution(markup); var codeActionLocation = ranges["caret"].First(); var results = await TestHandleAsync<LSP.ExecuteCommandParams, object>(solution, CreateExecuteCommandParams(codeActionLocation)); Assert.True((bool)results); } private static LSP.ExecuteCommandParams CreateExecuteCommandParams(LSP.Location location) => new LSP.ExecuteCommandParams() { Command = "_liveshare.remotecommand.Roslyn", Arguments = new object[] { JObject.FromObject(new LSP.Command() { CommandIdentifier = "Roslyn.RunCodeAction", Arguments = new RunCodeActionParams[] { CreateRunCodeActionParams("Use implicit type", location) } }) } }; } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageServer.CustomProtocol; using Newtonsoft.Json.Linq; using Roslyn.Test.Utilities; using Xunit; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests { public class RunCodeActionsHandlerTests : AbstractLiveShareRequestHandlerTests { [WpfFact] public async Task TestRunCodeActionsAsync() { var markup = @"class A { void M() { {|caret:|}int i = 1; } }"; var (solution, ranges) = CreateTestSolution(markup); var codeActionLocation = ranges["caret"].First(); var results = await TestHandleAsync<LSP.ExecuteCommandParams, object>(solution, CreateExecuteCommandParams(codeActionLocation, "Use implicit type")); Assert.True((bool)results); } private static LSP.ExecuteCommandParams CreateExecuteCommandParams(LSP.Location location, string title) => new LSP.ExecuteCommandParams() { Command = "_liveshare.remotecommand.Roslyn", Arguments = new object[] { JObject.FromObject(new LSP.Command() { CommandIdentifier = "Roslyn.RunCodeAction", Arguments = new RunCodeActionParams[] { CreateRunCodeActionParams(title, location) }, Title = title }) } }; } }
Update tests to pass new required title parameter.
Update tests to pass new required title parameter.
C#
mit
AlekseyTs/roslyn,gafter/roslyn,physhi/roslyn,nguerrera/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,abock/roslyn,tmat/roslyn,genlu/roslyn,mavasani/roslyn,reaction1989/roslyn,wvdd007/roslyn,physhi/roslyn,jmarolf/roslyn,tannergooding/roslyn,diryboy/roslyn,ErikSchierboom/roslyn,nguerrera/roslyn,davkean/roslyn,KevinRansom/roslyn,brettfo/roslyn,AmadeusW/roslyn,mavasani/roslyn,diryboy/roslyn,gafter/roslyn,gafter/roslyn,mavasani/roslyn,reaction1989/roslyn,aelij/roslyn,nguerrera/roslyn,weltkante/roslyn,abock/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,brettfo/roslyn,KirillOsenkov/roslyn,weltkante/roslyn,davkean/roslyn,sharwell/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,mgoertz-msft/roslyn,dotnet/roslyn,tmat/roslyn,brettfo/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,panopticoncentral/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,heejaechang/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,stephentoub/roslyn,agocke/roslyn,AlekseyTs/roslyn,KevinRansom/roslyn,reaction1989/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,jmarolf/roslyn,panopticoncentral/roslyn,physhi/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,tmat/roslyn,agocke/roslyn,tannergooding/roslyn,genlu/roslyn,genlu/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,jasonmalinowski/roslyn,jmarolf/roslyn,mgoertz-msft/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,heejaechang/roslyn,stephentoub/roslyn,aelij/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,AmadeusW/roslyn,stephentoub/roslyn,wvdd007/roslyn,eriawan/roslyn,agocke/roslyn,weltkante/roslyn,davkean/roslyn,abock/roslyn,KirillOsenkov/roslyn,dotnet/roslyn,aelij/roslyn,KirillOsenkov/roslyn
daac8b8dfeb2ae90305558ac0959fd1d32363cd3
src/AddIn.Export/ExtentionDefinition.cs
src/AddIn.Export/ExtentionDefinition.cs
using Loupe.Extensibility; using Loupe.Extensibility.Client; namespace Loupe.Extension.Export { /// <summary> /// Top-level class for integrating with the Loupe framework /// </summary> [LoupeExtension(ConfigurationEditor = typeof(ExportConfigurationDialog), MachineConfiguration = typeof(ExportAddInConfiguration))] public class ExtentionDefinition : IExtensionDefinition { /// <summary> /// Called to register the extension. /// </summary> /// <param name="context">A standard interface to the hosting environment for the Extension, provided to all the different extensions that get loaded.</param><param name="definitionContext">Used to register the various types used by the extension.</param> /// <remarks> /// <para> /// If any exception is thrown during this call this Extension will not be loaded. /// </para> /// <para> /// Register each of the other extension types that should be available to end users through appropriate calls to /// the definitionContext. These objects will be created and initialized as required and provided the same IExtensionContext object instance provided to this /// method to enable coordination between all of the components. /// </para> /// <para> /// After registration the extension definition object is unloaded and disposed. /// </para> /// </remarks> public void Register(IGlobalContext context, IExtensionDefinitionContext definitionContext) { //we have to register all of our types during this call or they won't be used at all. definitionContext.RegisterSessionAnalyzer(typeof(SessionExporter)); definitionContext.RegisterSessionCommand(typeof(SessionExporter)); } } }
using Loupe.Extensibility; using Loupe.Extensibility.Client; namespace Loupe.Extension.Export { /// <summary> /// Top-level class for integrating with the Loupe framework /// </summary> [LoupeExtension(ConfigurationEditor = typeof(ExportConfigurationDialog), CommonConfiguration = typeof(ExportAddInConfiguration))] public class ExtentionDefinition : IExtensionDefinition { /// <summary> /// Called to register the extension. /// </summary> /// <param name="context">A standard interface to the hosting environment for the Extension, provided to all the different extensions that get loaded.</param><param name="definitionContext">Used to register the various types used by the extension.</param> /// <remarks> /// <para> /// If any exception is thrown during this call this Extension will not be loaded. /// </para> /// <para> /// Register each of the other extension types that should be available to end users through appropriate calls to /// the definitionContext. These objects will be created and initialized as required and provided the same IExtensionContext object instance provided to this /// method to enable coordination between all of the components. /// </para> /// <para> /// After registration the extension definition object is unloaded and disposed. /// </para> /// </remarks> public void Register(IGlobalContext context, IExtensionDefinitionContext definitionContext) { //we have to register all of our types during this call or they won't be used at all. definitionContext.RegisterSessionAnalyzer(typeof(SessionExporter)); definitionContext.RegisterSessionCommand(typeof(SessionExporter)); } } }
Correct extension definition configuration value
Correct extension definition configuration value
C#
apache-2.0
GibraltarSoftware/Loupe.Samples,GibraltarSoftware/Loupe.Samples,GibraltarSoftware/Loupe.Samples
9785999d4c6520dbe443e115f50d1301f107cd7e
src/PowerShellEditorServices.Transport.Stdio/Request/InitializeRequest.cs
src/PowerShellEditorServices.Transport.Stdio/Request/InitializeRequest.cs
using Microsoft.PowerShell.EditorServices.Session; using Microsoft.PowerShell.EditorServices.Transport.Stdio.Event; using Microsoft.PowerShell.EditorServices.Transport.Stdio.Message; using Microsoft.PowerShell.EditorServices.Transport.Stdio.Response; using Nito.AsyncEx; using System.Threading.Tasks; namespace Microsoft.PowerShell.EditorServices.Transport.Stdio.Request { [MessageTypeName("initialize")] public class InitializeRequest : RequestBase<InitializeRequestArguments> { public override async Task ProcessMessage( EditorSession editorSession, MessageWriter messageWriter) { // Send the Initialized event first so that we get breakpoints await messageWriter.WriteMessage( new InitializedEvent()); // Now send the Initialize response to continue setup await messageWriter.WriteMessage( this.PrepareResponse( new InitializeResponse())); } } public class InitializeRequestArguments { public string AdapterId { get; set; } public bool LinesStartAt1 { get; set; } public string PathFormat { get; set; } public bool SourceMaps { get; set; } public string GeneratedCodeDirectory { get; set; } } }
using Microsoft.PowerShell.EditorServices.Session; using Microsoft.PowerShell.EditorServices.Transport.Stdio.Event; using Microsoft.PowerShell.EditorServices.Transport.Stdio.Message; using Microsoft.PowerShell.EditorServices.Transport.Stdio.Response; using Microsoft.PowerShell.EditorServices.Utility; using Nito.AsyncEx; using System.Threading.Tasks; namespace Microsoft.PowerShell.EditorServices.Transport.Stdio.Request { [MessageTypeName("initialize")] public class InitializeRequest : RequestBase<InitializeRequestArguments> { public override async Task ProcessMessage( EditorSession editorSession, MessageWriter messageWriter) { // TODO: Remove this behavior in the near future -- // Create the debug service log in a separate file // so that there isn't a conflict with the default // log file. Logger.Initialize("DebugService.log", LogLevel.Verbose); // Send the Initialized event first so that we get breakpoints await messageWriter.WriteMessage( new InitializedEvent()); // Now send the Initialize response to continue setup await messageWriter.WriteMessage( this.PrepareResponse( new InitializeResponse())); } } public class InitializeRequestArguments { public string AdapterId { get; set; } public bool LinesStartAt1 { get; set; } public string PathFormat { get; set; } public bool SourceMaps { get; set; } public string GeneratedCodeDirectory { get; set; } } }
Add separate log file for debugging service
Add separate log file for debugging service This change adds a new log file for the debugging service called "DebugService.log". This log file will be taken back out once we have the debugging service running in the same process as the language service.
C#
mit
PowerShell/PowerShellEditorServices
2dffe9ca54fb6cfa5c507bf051f2b6897836c80c
CORS/Controllers/ValuesController.cs
CORS/Controllers/ValuesController.cs
using System.Collections.Generic; using System.Web.Http; using System.Web.Http.Cors; namespace CORS.Controllers { public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() { return new string[] { "This is a CORS request.", "That works from any origin." }; } // GET api/values/another [HttpGet] [EnableCors(origins:"http://www.bigfont.ca", headers:"*", methods: "*")] public IEnumerable<string> Another() { return new string[] { "This is a CORS request.", "It works only from www.bigfont.ca." }; } public class EstimateQuery { public string username { get; set; } } public IHttpActionResult GetTitleEstimate([FromUri] EstimateQuery query) { // All the values in "query" are null or zero // Do some stuff with query if there were anything to do if(query != null) { return Ok(query.username); } else { return Ok("Add a username!"); } } } }
using System.Collections.Generic; using System.Web.Http; using System.Web.Http.Cors; namespace CORS.Controllers { public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() { return new string[] { "This is a CORS request.", "That works from any origin." }; } // GET api/values/another [HttpGet] [EnableCors(origins:"http://www.bigfont.ca", headers:"*", methods: "*")] public IEnumerable<string> Another() { return new string[] { "This is a CORS request.", "It works only from www.bigfont.ca." }; } public class EstimateQuery { public string username { get; set; } } public IHttpActionResult GetTitleEstimate([FromUri] EstimateQuery query) { // All the values in "query" are null or zero // Do some stuff with query if there were anything to do if(query != null && query.username != null) { return Ok(query.username); } else { return Ok("Add a username!"); } } } }
Check username for null too.
Check username for null too.
C#
mit
bigfont/webapi-cors
1fabeae8d2643464dbd31a3406d26893ddfa1ef6
src/Manos/Manos.Server/IHttpResponse.cs
src/Manos/Manos.Server/IHttpResponse.cs
using System; using System.Text; namespace Manos.Server { public interface IHttpResponse { IHttpTransaction Transaction { get; } HttpHeaders Headers { get; } HttpResponseStream Stream { get; } Encoding Encoding { get; } int StatusCode { get; set; } bool WriteStatusLine { get; set; } bool WriteHeaders { get; set; } void Write (string str); void Write (string str, params object [] prms); void WriteLine (string str); void WriteLine (string str, params object [] prms); void Write (byte [] data); void SendFile (string file); void Finish (); void SetHeader (string name, string value); void SetCookie (string name, HttpCookie cookie); HttpCookie SetCookie (string name, string value); HttpCookie SetCookie (string name, string value, string domain); HttpCookie SetCookie (string name, string value, DateTime expires); HttpCookie SetCookie (string name, string value, string domain, DateTime expires); HttpCookie SetCookie (string name, string value, TimeSpan max_age); HttpCookie SetCookie (string name, string value, string domain, TimeSpan max_age); void Redirect (string url); } }
using System; using System.IO; using System.Text; namespace Manos.Server { public interface IHttpResponse { IHttpTransaction Transaction { get; } HttpHeaders Headers { get; } HttpResponseStream Stream { get; } StreamWriter Writer { get; } Encoding Encoding { get; } int StatusCode { get; set; } bool WriteStatusLine { get; set; } bool WriteHeaders { get; set; } void Write (string str); void Write (string str, params object [] prms); void WriteLine (string str); void WriteLine (string str, params object [] prms); void Write (byte [] data); void SendFile (string file); void Finish (); void SetHeader (string name, string value); void SetCookie (string name, HttpCookie cookie); HttpCookie SetCookie (string name, string value); HttpCookie SetCookie (string name, string value, string domain); HttpCookie SetCookie (string name, string value, DateTime expires); HttpCookie SetCookie (string name, string value, string domain, DateTime expires); HttpCookie SetCookie (string name, string value, TimeSpan max_age); HttpCookie SetCookie (string name, string value, string domain, TimeSpan max_age); void Redirect (string url); } }
Add the writer to the interface.
Add the writer to the interface.
C#
mit
jmptrader/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,jmptrader/manos,jmptrader/manos,jmptrader/manos,mdavid/manos-spdy
60324bb1571a6230ba4f3a49575a9962cadb527b
src/Giles.Core/Configuration/Filter.cs
src/Giles.Core/Configuration/Filter.cs
using System; using System.Collections.Generic; using System.Linq; namespace Giles.Core.Configuration { [Serializable] public class Filter { public Filter() { } public Filter(string convertToFilter) { foreach (var entry in FilterLookUp.Where(entry => convertToFilter.Contains(entry.Key))) { Type = entry.Value; Name = convertToFilter.Replace(entry.Key, string.Empty).Trim(); break; } if (!string.IsNullOrWhiteSpace(Name)) return; Name = convertToFilter.Trim(); Type = FilterType.Inclusive; } public string Name { get; set; } public FilterType Type { get; set; } public string NameDll { get { return Name.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) ? Name : String.Format("{0}.dll", Name); } } public static readonly IDictionary<string, FilterType> FilterLookUp = new Dictionary<string, FilterType> { {"-i", FilterType.Inclusive}, {"-e", FilterType.Exclusive} }; } public enum FilterType { Inclusive, Exclusive } }
using System; using System.Collections.Generic; using System.Linq; namespace Giles.Core.Configuration { [Serializable] public class Filter { public Filter() { } public Filter(string convertToFilter) { foreach (var entry in FilterLookUp.Where(entry => convertToFilter.Contains(string.Format(" {0}" ,entry.Key)))) { Type = entry.Value; Name = convertToFilter.Replace(string.Format(" {0}", entry.Key), string.Empty).Trim(); break; } if (!string.IsNullOrWhiteSpace(Name)) return; Name = convertToFilter.Trim(); Type = FilterType.Inclusive; } public string Name { get; set; } public FilterType Type { get; set; } public string NameDll { get { return Name.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) ? Name : String.Format("{0}.dll", Name); } } public static readonly IDictionary<string, FilterType> FilterLookUp = new Dictionary<string, FilterType> { {"-i", FilterType.Inclusive}, {"-e", FilterType.Exclusive} }; } public enum FilterType { Inclusive, Exclusive } }
Make sure there is a space between the -* and the filtered namespace to prevent any accidental replacements
Make sure there is a space between the -* and the filtered namespace to prevent any accidental replacements
C#
mit
michaelsync/Giles,codereflection/Giles,michaelsync/Giles,michaelsync/Giles,codereflection/Giles,codereflection/Giles,michaelsync/Giles
4fc8e9cebef3b42a4256cbc314db2e21f200e2c2
MVCLibraryManagementSystem/Controllers/HomeController.cs
MVCLibraryManagementSystem/Controllers/HomeController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MVCLibraryManagementSystem.Controllers { public class HomeController : Controller { // GET: Home public ActionResult Index() { return View(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MVCLibraryManagementSystem.Controllers { public class HomeController : Controller { // GET: Home public ActionResult Index() { return View(); } } }
Fix merge conflict with maitisoumyajit
Fix merge conflict with maitisoumyajit
C#
mit
ibsarbca/MVCLibraryManagementSystem
c1957dbdb9f15b9273aa9cf31ca6aa88d8eecc5b
vmPing/Views/IsolatedPingWindow.xaml.cs
vmPing/Views/IsolatedPingWindow.xaml.cs
using System; using System.Windows; using System.Windows.Controls; using vmPing.Classes; namespace vmPing.Views { /// <summary> /// Interaction logic for IsolatedPingWindow.xaml /// </summary> public partial class IsolatedPingWindow : Window { private int SelStart = 0; private int SelLength = 0; public IsolatedPingWindow(Probe pingItem) { InitializeComponent(); pingItem.IsolatedWindow = this; DataContext = pingItem; } private void History_TextChanged(object sender, TextChangedEventArgs e) { History.SelectionStart = SelStart; History.SelectionLength = SelLength; History.ScrollToEnd(); } private void History_SelectionChanged(object sender, RoutedEventArgs e) { SelStart = History.SelectionStart; SelLength = History.SelectionLength; } private void Window_Closed(object sender, EventArgs e) { (DataContext as Probe).IsolatedWindow = null; DataContext = null; } } }
using System; using System.Windows; using System.Windows.Controls; using vmPing.Classes; namespace vmPing.Views { /// <summary> /// Interaction logic for IsolatedPingWindow.xaml /// </summary> public partial class IsolatedPingWindow : Window { private int SelStart = 0; private int SelLength = 0; public IsolatedPingWindow(Probe pingItem) { InitializeComponent(); pingItem.IsolatedWindow = this; DataContext = pingItem; } private void History_TextChanged(object sender, TextChangedEventArgs e) { History.SelectionStart = SelStart; History.SelectionLength = SelLength; Application.Current.Dispatcher.BeginInvoke( new Action(() => History.ScrollToEnd())); } private void History_SelectionChanged(object sender, RoutedEventArgs e) { SelStart = History.SelectionStart; SelLength = History.SelectionLength; } private void Window_Closed(object sender, EventArgs e) { (DataContext as Probe).IsolatedWindow = null; DataContext = null; } } }
Use dispatcher begininvoke for textbox scroll
Use dispatcher begininvoke for textbox scroll
C#
mit
R-Smith/vmPing
5546770b9d0793f66a6ab41773f07194a3c6e135
Common/NuGetConstants.cs
Common/NuGetConstants.cs
using System; namespace NuGet { public static class NuGetConstants { public static readonly string DefaultFeedUrl = "https://go.microsoft.com/fwlink/?LinkID=230477"; public static readonly string V1FeedUrl = "https://go.microsoft.com/fwlink/?LinkID=206669"; public static readonly string DefaultGalleryServerUrl = "http://go.microsoft.com/fwlink/?LinkID=207106"; public static readonly string DefaultSymbolServerUrl = "http://nuget.gw.symbolsource.org/Public/NuGet"; } }
using System; namespace NuGet { public static class NuGetConstants { public static readonly string DefaultFeedUrl = "https://go.microsoft.com/fwlink/?LinkID=230477"; public static readonly string V1FeedUrl = "https://go.microsoft.com/fwlink/?LinkID=206669"; public static readonly string DefaultGalleryServerUrl = "https://www.nuget.org"; public static readonly string DefaultSymbolServerUrl = "http://nuget.gw.symbolsource.org/Public/NuGet"; } }
Update default publishing url to point to v2 feed.
Update default publishing url to point to v2 feed. --HG-- branch : 1.6
C#
apache-2.0
mdavid/nuget,mdavid/nuget
8324fda25184eb1e9113ee95adf74c9fbdb4562c
src/AppHarbor/Program.cs
src/AppHarbor/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AppHarbor { class Program { static void Main(string[] args) { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Castle.Windsor; namespace AppHarbor { class Program { static void Main(string[] args) { var container = new WindsorContainer(); } } }
Initialize a WindowsContainer when program starts
Initialize a WindowsContainer when program starts
C#
mit
appharbor/appharbor-cli
4838f122f5a995c99e58c9d23f6f3e5b9e4f21f9
PSO2Launcher/App.xaml.cs
PSO2Launcher/App.xaml.cs
using System.Windows; using Dogstar.Properties; namespace Dogstar { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App { void Application_Startup(object sender, StartupEventArgs e) { if (Settings.Default.UpgradeCheck) { Settings.Default.Upgrade(); Settings.Default.UpgradeCheck = false; Settings.Default.Save(); } foreach (var arg in e.Args) { switch (arg) { case "-pso2": Helper.LaunchGame(); Shutdown(); break; } } } private void Application_Exit(object sender, ExitEventArgs e) { if (e.ApplicationExitCode == 0) { Settings.Default.Save(); } } } }
using System.Windows; using Dogstar.Properties; namespace Dogstar { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App { void Application_Startup(object sender, StartupEventArgs e) { if (Settings.Default.UpgradeCheck) { Settings.Default.Upgrade(); Settings.Default.UpgradeCheck = false; Settings.Default.Save(); } foreach (var arg in e.Args) { switch (arg) { case "-pso2": Helper.LaunchGame(); Shutdown(); break; } } } private void Application_Exit(object sender, ExitEventArgs e) { if (e.ApplicationExitCode == 0) { Settings.Default.Save(); if (Settings.Default.IsGameInstalled) { PsoSettings.Save(); } } } } }
Save game settings on close.
Save game settings on close.
C#
mit
LightningDragon/Dogstar
35ad409da6fd60f48f66b58003058ac9d2c5b360
osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.cs
osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinnerTick.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.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinnerTick : DrawableOsuHitObject { private bool hasBonusPoints; /// <summary> /// Whether this judgement has a bonus of 1,000 points additional to the numeric result. /// Set when a spin occured after the spinner has completed. /// </summary> public bool HasBonusPoints { get => hasBonusPoints; internal set { hasBonusPoints = value; Samples.Volume.Value = ((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints ? 1 : 0; } } public override bool DisplayResult => false; public DrawableSpinnerTick(SpinnerTick spinnerTick) : base(spinnerTick) { } /// <summary> /// Apply a judgement result. /// </summary> /// <param name="hit">Whether to apply a <see cref="HitResult.Great"/> result, <see cref="HitResult.Miss"/> otherwise.</param> internal void TriggerResult(bool hit) { HitObject.StartTime = Time.Current; ApplyResult(r => r.Type = hit ? HitResult.Great : HitResult.Miss); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinnerTick : DrawableOsuHitObject { private bool hasBonusPoints; /// <summary> /// Whether this judgement has a bonus of 1,000 points additional to the numeric result. /// Set when a spin occured after the spinner has completed. /// </summary> public bool HasBonusPoints { get => hasBonusPoints; internal set { hasBonusPoints = value; ((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints = value; Samples.Volume.Value = value ? 1 : 0; } } public override bool DisplayResult => false; public DrawableSpinnerTick(SpinnerTick spinnerTick) : base(spinnerTick) { } /// <summary> /// Apply a judgement result. /// </summary> /// <param name="hit">Whether to apply a <see cref="HitResult.Great"/> result, <see cref="HitResult.Miss"/> otherwise.</param> internal void TriggerResult(bool hit) { HitObject.StartTime = Time.Current; ApplyResult(r => r.Type = hit ? HitResult.Great : HitResult.Miss); } } }
Fix spinner bonus ticks samples not actually playing
Fix spinner bonus ticks samples not actually playing
C#
mit
smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu
826a8552e598dc55cc59d11982fdcda470011f70
osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs
osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; namespace osu.Game.Overlays.Settings.Sections.Graphics { public class DetailSettings : SettingsSubsection { protected override string Header => "Detail Settings"; [BackgroundDependencyLoader] private void load(OsuConfigManager config) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "Storyboards", Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard) }, new SettingsCheckbox { LabelText = "Rotate cursor when dragging", Bindable = config.GetBindable<bool>(OsuSetting.CursorRotation) }, new SettingsEnumDropdown<ScreenshotFormat> { LabelText = "Screenshot format", Bindable = config.GetBindable<ScreenshotFormat>(OsuSetting.ScreenshotFormat) }, new SettingsCheckbox { LabelText = "Capture menu cursor", Bindable = config.GetBindable<bool>(OsuSetting.ScreenshotCaptureMenuCursor) } }; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; namespace osu.Game.Overlays.Settings.Sections.Graphics { public class DetailSettings : SettingsSubsection { protected override string Header => "Detail Settings"; [BackgroundDependencyLoader] private void load(OsuConfigManager config) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "Storyboards", Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard) }, new SettingsCheckbox { LabelText = "Rotate cursor when dragging", Bindable = config.GetBindable<bool>(OsuSetting.CursorRotation) }, new SettingsEnumDropdown<ScreenshotFormat> { LabelText = "Screenshot format", Bindable = config.GetBindable<ScreenshotFormat>(OsuSetting.ScreenshotFormat) }, new SettingsCheckbox { LabelText = "Show menu cursor in screenshots", Bindable = config.GetBindable<bool>(OsuSetting.ScreenshotCaptureMenuCursor) } }; } } }
Reword options item to include "screenshot"
Reword options item to include "screenshot"
C#
mit
smoogipoo/osu,ZLima12/osu,2yangk23/osu,UselessToucan/osu,smoogipoo/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu,2yangk23/osu,ppy/osu,UselessToucan/osu,Nabile-Rahmani/osu,johnneijzen/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,naoey/osu,naoey/osu,UselessToucan/osu,NeoAdonis/osu,johnneijzen/osu,ppy/osu,naoey/osu,DrabWeb/osu,DrabWeb/osu,peppy/osu-new,ZLima12/osu,peppy/osu,ppy/osu,EVAST9919/osu,EVAST9919/osu,DrabWeb/osu
81d04b5eae2d14faf7f80b6f8892883e655442d2
Src/Hosts/Rik.CodeCamp.Host/CodeCampControl.cs
Src/Hosts/Rik.CodeCamp.Host/CodeCampControl.cs
using System; using GAIT.Utilities.Logging; using NLog; using Topshelf; using static GAIT.Utilities.GeneralBootstrapper; namespace Rik.CodeCamp.Host { internal class CodeCampControl : ServiceControl { private Bootstrapper _bootstrapper; private readonly ILogger _logger; public CodeCampControl() { _logger = LoggingFactory.Create(GetType()); } public bool Start(HostControl hostControl) { try { _bootstrapper = new Bootstrapper(); //var worker = _bootstrapper.Resolve<IWorker>(); //return worker.Start(); } catch (Exception exception) { _logger.Fatal(exception, "Start failed!!! "); } return false; } public bool Stop(HostControl hostControl) { try { _bootstrapper?.Dispose(); CancelAll.Cancel(); } catch (Exception exception) { _logger.Fatal(exception, "Stop failed!!! "); } return false; } } }
using System; using GAIT.Utilities.Logging; using NLog; using Rik.CodeCamp.Core; using Topshelf; using static GAIT.Utilities.GeneralBootstrapper; namespace Rik.CodeCamp.Host { internal class CodeCampControl : ServiceControl { private Bootstrapper _bootstrapper; private readonly ILogger _logger; public CodeCampControl() { _logger = LoggingFactory.Create(GetType()); } public bool Start(HostControl hostControl) { try { _bootstrapper = new Bootstrapper(); var worker = _bootstrapper.Resolve<IWorker>(); return worker.Start(); } catch (Exception exception) { _logger.Fatal(exception, "Start failed!!! "); } return false; } public bool Stop(HostControl hostControl) { try { _bootstrapper?.Dispose(); CancelAll.Cancel(); } catch (Exception exception) { _logger.Fatal(exception, "Stop failed!!! "); } return false; } } }
Add worker resolve and start Start
Add worker resolve and start Start
C#
mit
generik0/Rik.CodeCamp
e4e30eee782a1135b978c0728b1f4d2ac9d75deb
SteamAccountSwitcher/Options.xaml.cs
SteamAccountSwitcher/Options.xaml.cs
using System; using System.Windows; using SteamAccountSwitcher.Properties; namespace SteamAccountSwitcher { /// <summary> /// Interaction logic for Options.xaml /// </summary> public partial class Options : Window { public Options() { InitializeComponent(); Settings.Default.Save(); } private void menuItemImport_OnClick(object sender, EventArgs e) { AccountDataHelper.ImportAccounts(); } private void menuItemExport_OnClick(object sender, EventArgs e) { AccountDataHelper.ExportAccounts(); } private void btnOK_Click(object sender, RoutedEventArgs e) { SettingsHelper.SaveSettings(); DialogResult = true; } private void btnCancel_Click(object sender, RoutedEventArgs e) { Settings.Default.Reload(); DialogResult = true; } } }
using System; using System.Windows; using SteamAccountSwitcher.Properties; namespace SteamAccountSwitcher { /// <summary> /// Interaction logic for Options.xaml /// </summary> public partial class Options : Window { public Options() { InitializeComponent(); Settings.Default.Save(); } private void menuItemImport_OnClick(object sender, EventArgs e) { AccountDataHelper.ImportAccounts(); } private void menuItemExport_OnClick(object sender, EventArgs e) { AccountDataHelper.ExportAccounts(); } private void btnOK_Click(object sender, RoutedEventArgs e) { SettingsHelper.SaveSettings(); DialogResult = true; } private void btnCancel_Click(object sender, RoutedEventArgs e) { Settings.Default.Reload(); DialogResult = false; } } }
Set DialogResult to false on Options cancel
Set DialogResult to false on Options cancel
C#
mit
danielchalmers/SteamAccountSwitcher
d51ff9ef3bfabda6eebfcd5445ef3e102f38b886
06.OthreTypes/06.OtherTypes.Homework/OtherTypes/FractionCalculator/TestProgram.cs
06.OthreTypes/06.OtherTypes.Homework/OtherTypes/FractionCalculator/TestProgram.cs
using System; namespace FractionCalculator { using Class; public class TestProgram { public static void Main() { try { Fraction fraction1 = new Fraction(22, 7); Fraction fraction2 = new Fraction(40, 4); Fraction result = fraction1 + fraction2; Console.WriteLine(result.Numerator); Console.WriteLine(result.Denominator); Console.WriteLine(result); } catch (DivideByZeroException ex) { Console.WriteLine(ex.Message); } } } }
using System; namespace FractionCalculator { using Class; public class TestProgram { public static void Main() { try { Fraction fraction1 = new Fraction(22, 7); Fraction fraction2 = new Fraction(40, 4); Fraction result = fraction1 + fraction2; Console.WriteLine(result.Numerator); Console.WriteLine(result.Denominator); Console.WriteLine(result); } catch (DivideByZeroException ex) { Console.WriteLine(ex.Message); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } } } }
Add more one catch block for ArgumentException
Add more one catch block for ArgumentException
C#
cc0-1.0
ivayloivanof/OOP.CSharp,ivayloivanof/OOP.CSharp
da164e434ee9166ea37722d8abb1097b77b0fdc4
projects/AsyncEnum35Sample/test/AsyncEnum35Sample.Test.Unit/AsyncOperationTest.cs
projects/AsyncEnum35Sample/test/AsyncEnum35Sample.Test.Unit/AsyncOperationTest.cs
//----------------------------------------------------------------------- // <copyright file="AsyncOperationTest.cs" company="Brian Rogers"> // Copyright (c) Brian Rogers. All rights reserved. // </copyright> //----------------------------------------------------------------------- namespace AsyncEnum35Sample.Test.Unit { using System; using System.Collections.Generic; using Xunit; public class AsyncOperationTest { public AsyncOperationTest() { } [Fact] public void Set_result_in_ctor_and_break_completes_sync() { SetResultInCtorOperation op = new SetResultInCtorOperation(1234); IAsyncResult result = op.Start(null, null); Assert.True(result.IsCompleted); Assert.True(result.CompletedSynchronously); Assert.Equal(1234, SetResultInCtorOperation.End(result)); } private abstract class TestAsyncOperation : AsyncOperation<int> { protected TestAsyncOperation() { } } private sealed class SetResultInCtorOperation : TestAsyncOperation { public SetResultInCtorOperation(int result) { this.Result = result; } protected override IEnumerator<Step> Steps() { yield break; } } } }
//----------------------------------------------------------------------- // <copyright file="AsyncOperationTest.cs" company="Brian Rogers"> // Copyright (c) Brian Rogers. All rights reserved. // </copyright> //----------------------------------------------------------------------- namespace AsyncEnum35Sample.Test.Unit { using System; using System.Collections.Generic; using Xunit; public class AsyncOperationTest { public AsyncOperationTest() { } [Fact] public void Set_result_in_ctor_and_break_completes_sync() { SetResultInCtorOperation op = new SetResultInCtorOperation(1234); IAsyncResult result = op.Start(null, null); Assert.True(result.IsCompleted); Assert.True(result.CompletedSynchronously); Assert.Equal(1234, SetResultInCtorOperation.End(result)); } [Fact] public void Set_result_in_enumerator_and_break_completes_sync() { SetResultInEnumeratorOperation op = new SetResultInEnumeratorOperation(1234); IAsyncResult result = op.Start(null, null); Assert.True(result.IsCompleted); Assert.True(result.CompletedSynchronously); Assert.Equal(1234, SetResultInEnumeratorOperation.End(result)); } private abstract class TestAsyncOperation : AsyncOperation<int> { protected TestAsyncOperation() { } } private sealed class SetResultInCtorOperation : TestAsyncOperation { public SetResultInCtorOperation(int result) { this.Result = result; } protected override IEnumerator<Step> Steps() { yield break; } } private sealed class SetResultInEnumeratorOperation : TestAsyncOperation { private readonly int result; public SetResultInEnumeratorOperation(int result) { this.result = result; } protected override IEnumerator<Step> Steps() { this.Result = this.result; yield break; } } } }
Set result in enumerator and break completes sync
Set result in enumerator and break completes sync
C#
unlicense
brian-dot-net/writeasync,brian-dot-net/writeasync,brian-dot-net/writeasync
88ae2ecf1939d2f2026ab988081063d95f555c96
src/EditorFeatures/Core/Implementation/KeywordHighlighting/HighlightingService.cs
src/EditorFeatures/Core/Implementation/KeywordHighlighting/HighlightingService.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Composition; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Editor.Implementation.Highlighting { [Export(typeof(IHighlightingService))] [Shared] internal class HighlightingService : IHighlightingService { private readonly List<Lazy<IHighlighter, LanguageMetadata>> _highlighters; [ImportingConstructor] public HighlightingService( [ImportMany] IEnumerable<Lazy<IHighlighter, LanguageMetadata>> highlighters) { _highlighters = highlighters.ToList(); } public IEnumerable<TextSpan> GetHighlights( SyntaxNode root, int position, CancellationToken cancellationToken) { return _highlighters.Where(h => h.Metadata.Language == root.Language) .Select(h => h.Value.GetHighlights(root, position, cancellationToken)) .WhereNotNull() .Flatten() .Distinct(); } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Composition; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Editor.Implementation.Highlighting { [Export(typeof(IHighlightingService))] [Shared] internal class HighlightingService : IHighlightingService { private readonly List<Lazy<IHighlighter, LanguageMetadata>> _highlighters; [ImportingConstructor] public HighlightingService( [ImportMany] IEnumerable<Lazy<IHighlighter, LanguageMetadata>> highlighters) { _highlighters = highlighters.ToList(); } public IEnumerable<TextSpan> GetHighlights( SyntaxNode root, int position, CancellationToken cancellationToken) { try { return _highlighters.Where(h => h.Metadata.Language == root.Language) .Select(h => h.Value.GetHighlights(root, position, cancellationToken)) .WhereNotNull() .Flatten() .Distinct(); } catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e)) { // https://devdiv.visualstudio.com/DevDiv/_workitems/edit/763988 // We still couldn't identify the root cause for the linked bug above. // Since high lighting failure is not important enough to crash VS, change crash to NFW. return SpecializedCollections.EmptyEnumerable<TextSpan>(); } } } }
Change high lighting crash to NFW
Change high lighting crash to NFW
C#
mit
aelij/roslyn,brettfo/roslyn,diryboy/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,tannergooding/roslyn,MichalStrehovsky/roslyn,brettfo/roslyn,reaction1989/roslyn,panopticoncentral/roslyn,AlekseyTs/roslyn,reaction1989/roslyn,stephentoub/roslyn,jmarolf/roslyn,KevinRansom/roslyn,heejaechang/roslyn,heejaechang/roslyn,swaroop-sridhar/roslyn,mavasani/roslyn,tannergooding/roslyn,eriawan/roslyn,dotnet/roslyn,KevinRansom/roslyn,swaroop-sridhar/roslyn,jasonmalinowski/roslyn,tannergooding/roslyn,abock/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,davkean/roslyn,mgoertz-msft/roslyn,AmadeusW/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,stephentoub/roslyn,davkean/roslyn,diryboy/roslyn,agocke/roslyn,nguerrera/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,genlu/roslyn,reaction1989/roslyn,panopticoncentral/roslyn,KirillOsenkov/roslyn,VSadov/roslyn,eriawan/roslyn,heejaechang/roslyn,VSadov/roslyn,agocke/roslyn,dotnet/roslyn,tmat/roslyn,bartdesmet/roslyn,aelij/roslyn,genlu/roslyn,MichalStrehovsky/roslyn,eriawan/roslyn,agocke/roslyn,abock/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,mgoertz-msft/roslyn,wvdd007/roslyn,physhi/roslyn,sharwell/roslyn,mgoertz-msft/roslyn,abock/roslyn,sharwell/roslyn,weltkante/roslyn,tmat/roslyn,nguerrera/roslyn,wvdd007/roslyn,bartdesmet/roslyn,diryboy/roslyn,brettfo/roslyn,tmat/roslyn,stephentoub/roslyn,gafter/roslyn,genlu/roslyn,gafter/roslyn,swaroop-sridhar/roslyn,AlekseyTs/roslyn,sharwell/roslyn,KirillOsenkov/roslyn,aelij/roslyn,KirillOsenkov/roslyn,wvdd007/roslyn,MichalStrehovsky/roslyn,gafter/roslyn,jmarolf/roslyn,mavasani/roslyn,ErikSchierboom/roslyn,VSadov/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,dotnet/roslyn,nguerrera/roslyn,AlekseyTs/roslyn,physhi/roslyn,davkean/roslyn,physhi/roslyn,bartdesmet/roslyn,ErikSchierboom/roslyn,mavasani/roslyn
54c9a049b509889d193eed145f100a04da6c0e94
SendEmails/SendEmailWithLogo/Program.cs
SendEmails/SendEmailWithLogo/Program.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Mail; using System.Net.Mime; using System.Text; using System.Threading.Tasks; namespace SendEmailWithLogo { class Program { static void Main(string[] args) { var toAddress = "somewhere@mailinator.com"; var fromAddress = "you@host.com"; var message = "your message goes here"; // create the email var mailMessage = new MailMessage(); mailMessage.To.Add(toAddress); mailMessage.Subject = "Sending emails is easy"; mailMessage.From = new MailAddress(fromAddress); mailMessage.Body = message; // send it (settings in web.config / app.config) var smtp = new SmtpClient(); smtp.Send(mailMessage); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Mail; using System.Net.Mime; using System.Text; using System.Threading.Tasks; namespace SendEmailWithLogo { class Program { static void Main(string[] args) { var toAddress = "somewhere@mailinator.com"; var fromAddress = "you@host.com"; var pathToLogo = @"Content\logo.png"; var pathToTemplate = @"Content\Template.html"; var messageText = File.ReadAllText(pathToTemplate); // replace placeholder messageText = ReplacePlaceholdersWithValues(messageText); // create the email var mailMessage = new MailMessage(); mailMessage.To.Add(toAddress); mailMessage.Subject = "Sending emails is easy"; mailMessage.From = new MailAddress(fromAddress); mailMessage.IsBodyHtml = true; mailMessage.AlternateViews.Add(CreateHtmlMessage(messageText, pathToLogo)); // send it (settings in web.config / app.config) var smtp = new SmtpClient(); smtp.Send(mailMessage); } private static AlternateView CreateHtmlMessage(string messageText, string pathToLogo) { LinkedResource inline = new LinkedResource(pathToLogo); inline.ContentId = "companyLogo"; AlternateView alternateView = AlternateView.CreateAlternateViewFromString(messageText, null, MediaTypeNames.Text.Html); alternateView.LinkedResources.Add(inline); return alternateView; } private static string ReplacePlaceholdersWithValues(string messageText) { // use the dynamic values instead of the hardcoded ones in this example messageText = messageText.Replace("$AMOUNT$", "$12.50"); messageText = messageText.Replace("$DATE$", DateTime.Now.ToShortDateString()); messageText = messageText.Replace("$INVOICE$", "25639"); messageText = messageText.Replace("$TRANSACTION$", "TRX2017-WEB-01"); return messageText; } } }
Include company logo in email
Include company logo in email
C#
apache-2.0
jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets
c5519c3078c7d37bdbd5e354b1ef671bf12ca35e
src/PolymeliaDeployController/Program.cs
src/PolymeliaDeployController/Program.cs
using System; using System.Linq; using System.ServiceProcess; namespace PolymeliaDeployController { using System.Configuration; using System.Data.Entity; using Microsoft.Owin.Hosting; using PolymeliaDeploy; using PolymeliaDeploy.Controller; using PolymeliaDeploy.Data; using PolymeliaDeploy.Network; static class Program { static void Main(string[] args) { Database.SetInitializer<PolymeliaDeployDbContext>(null); DeployServices.ReportClient = new ReportLocalClient(); var service = new Service(); if (args.Any(arg => arg == "/c")) { using (CreateServiceHost()) { Console.WriteLine("Started"); Console.ReadKey(); Console.WriteLine("Stopping"); return; } } ServiceBase.Run(service); } internal static IDisposable CreateServiceHost() { var localIpAddress = IPAddressRetriever.LocalIPAddress(); var portNumber = ConfigurationManager.AppSettings["ControllerPort"]; var controllUri = string.Format("http://{0}:{1}", localIpAddress, portNumber); return WebApplication.Start<Startup>(controllUri); } } }
using System; using System.Linq; using System.ServiceProcess; namespace PolymeliaDeployController { using System.Configuration; using System.Data.Entity; using Microsoft.Owin.Hosting; using PolymeliaDeploy; using PolymeliaDeploy.Controller; using PolymeliaDeploy.Data; using PolymeliaDeploy.Network; static class Program { static void Main(string[] args) { Database.SetInitializer<PolymeliaDeployDbContext>(null); DeployServices.ReportClient = new ReportLocalClient(); var service = new Service(); if (Environment.UserInteractive) { using (CreateServiceHost()) { Console.WriteLine("Started"); Console.ReadKey(); Console.WriteLine("Stopping"); return; } } ServiceBase.Run(service); } internal static IDisposable CreateServiceHost() { var localIpAddress = IPAddressRetriever.LocalIPAddress(); var portNumber = ConfigurationManager.AppSettings["ControllerPort"]; var controllUri = string.Format("http://{0}:{1}", localIpAddress, portNumber); return WebApplication.Start<Startup>(controllUri); } } }
Check Environment.UserInteractive instead of /c argument.
Check Environment.UserInteractive instead of /c argument.
C#
mit
fredrikn/PolymeliaDeploy,fredrikn/PolymeliaDeploy
0a5cb4faca18f1af0c23ee3757d9721ab5c09089
src/Rainbow/Diff/Fields/XmlComparison.cs
src/Rainbow/Diff/Fields/XmlComparison.cs
using System; using System.Xml; using System.Xml.Linq; using Rainbow.Model; namespace Rainbow.Diff.Fields { public class XmlComparison : FieldTypeBasedComparison { public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (string.IsNullOrWhiteSpace(field1.Value) && string.IsNullOrWhiteSpace(field2.Value)) return true; if (string.IsNullOrWhiteSpace(field1.Value) || string.IsNullOrWhiteSpace(field2.Value)) return false; try { var x1 = XElement.Parse(field1.Value); var x2 = XElement.Parse(field2.Value); return XNode.DeepEquals(x1, x2); } catch (XmlException xe) { throw new InvalidOperationException($"Unable to compare {field1.NameHint ?? field2.NameHint} field due to invalid XML value.", xe); } } public override string[] SupportedFieldTypes => new[] { "Layout", "Tracking", "Rules" }; } }
using System.Xml; using System.Xml.Linq; using Rainbow.Model; using Sitecore.Diagnostics; namespace Rainbow.Diff.Fields { public class XmlComparison : FieldTypeBasedComparison { public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (string.IsNullOrWhiteSpace(field1.Value) && string.IsNullOrWhiteSpace(field2.Value)) return true; if (string.IsNullOrWhiteSpace(field1.Value) || string.IsNullOrWhiteSpace(field2.Value)) return false; try { var x1 = XElement.Parse(field1.Value); var x2 = XElement.Parse(field2.Value); return XNode.DeepEquals(x1, x2); } catch (XmlException xe) { Log.Error($"Field {field1.NameHint ?? field2.NameHint} contained an invalid XML value. Falling back to string comparison.", xe, this); return new DefaultComparison().AreEqual(field1, field2); } } public override string[] SupportedFieldTypes => new[] { "Layout", "Tracking", "Rules" }; } }
Fix error that aborted sync when invalid XML was present in an XML formatted field (e.g. a malformed rules field in the stock master db)
Fix error that aborted sync when invalid XML was present in an XML formatted field (e.g. a malformed rules field in the stock master db)
C#
mit
kamsar/Rainbow
fdb82cf7d3511d4d82fabd041b95b7b74c888d4e
src/Serilog.Sinks.Graylog/GraylogSink.cs
src/Serilog.Sinks.Graylog/GraylogSink.cs
using System; using System.Threading.Tasks; using Newtonsoft.Json.Linq; using Serilog.Core; using Serilog.Debugging; using Serilog.Events; using Serilog.Sinks.Graylog.Core; using Serilog.Sinks.Graylog.Core.Transport; namespace Serilog.Sinks.Graylog { public class GraylogSink : ILogEventSink { private readonly Lazy<IGelfConverter> _converter; private readonly Lazy<ITransport> _transport; public GraylogSink(GraylogSinkOptions options) { ISinkComponentsBuilder sinkComponentsBuilder = new SinkComponentsBuilder(options); _transport = new Lazy<ITransport>(() => sinkComponentsBuilder.MakeTransport()); _converter = new Lazy<IGelfConverter>(() => sinkComponentsBuilder.MakeGelfConverter()); } public void Emit(LogEvent logEvent) { try { Task.Run(() => EmitAsync(logEvent)).GetAwaiter().GetResult(); } catch (Exception exc) { SelfLog.WriteLine("Oops something going wrong {0}", exc); } } private Task EmitAsync(LogEvent logEvent) { JObject json = _converter.Value.GetGelfJson(logEvent); string payload = json.ToString(Newtonsoft.Json.Formatting.None); return _transport.Value.Send(payload); } } }
using System; using System.Threading.Tasks; using Newtonsoft.Json.Linq; using Serilog.Core; using Serilog.Debugging; using Serilog.Events; using Serilog.Sinks.Graylog.Core; using Serilog.Sinks.Graylog.Core.Transport; namespace Serilog.Sinks.Graylog { public class GraylogSink : ILogEventSink, IDisposable { private readonly Lazy<IGelfConverter> _converter; private readonly Lazy<ITransport> _transport; public GraylogSink(GraylogSinkOptions options) { ISinkComponentsBuilder sinkComponentsBuilder = new SinkComponentsBuilder(options); _transport = new Lazy<ITransport>(() => sinkComponentsBuilder.MakeTransport()); _converter = new Lazy<IGelfConverter>(() => sinkComponentsBuilder.MakeGelfConverter()); } public void Dispose() { _transport.Value.Dispose(); } public void Emit(LogEvent logEvent) { try { Task.Run(() => EmitAsync(logEvent)).GetAwaiter().GetResult(); } catch (Exception exc) { SelfLog.WriteLine("Oops something going wrong {0}", exc); } } private Task EmitAsync(LogEvent logEvent) { JObject json = _converter.Value.GetGelfJson(logEvent); string payload = json.ToString(Newtonsoft.Json.Formatting.None); return _transport.Value.Send(payload); } } }
Fix increase connections to transport
Fix increase connections to transport
C#
mit
whir1/serilog-sinks-graylog
1e1b480a071f0348b608e0851546803157929e41
src/Tests/ConfigBuilder.cs
src/Tests/ConfigBuilder.cs
using NServiceBus; public static class ConfigBuilder { public static EndpointConfiguration BuildDefaultConfig(string endpointName) { var configuration = new EndpointConfiguration(endpointName); configuration.SendFailedMessagesTo("error"); configuration.UsePersistence<InMemoryPersistence>(); configuration.UseTransport<LearningTransport>(); configuration.PurgeOnStartup(true); var recoverability = configuration.Recoverability(); recoverability.Delayed( customizations: settings => { settings.NumberOfRetries(0); }); recoverability.Immediate( customizations: settings => { settings.NumberOfRetries(0); }); return configuration; } }
using NServiceBus; public static class ConfigBuilder { public static EndpointConfiguration BuildDefaultConfig(string endpointName) { var configuration = new EndpointConfiguration(endpointName); configuration.SendFailedMessagesTo("error"); configuration.UsePersistence<InMemoryPersistence>(); configuration.UseTransport<LearningTransport>(); configuration.PurgeOnStartup(true); return configuration; } }
Revert "disable retries in tests"
Revert "disable retries in tests" This reverts commit 4875687e65609b0c13edf8d236a7e88d351d39ca.
C#
mit
SimonCropp/NServiceBus.Serilog
21b25dd361788c3c35141c096cbb8355dc71ec33
src/Certify.UI/Controls/ManagedCertificate/TestProgress.xaml.cs
src/Certify.UI/Controls/ManagedCertificate/TestProgress.xaml.cs
using System.Windows; using System.Windows.Controls; namespace Certify.UI.Controls.ManagedCertificate { public partial class TestProgress : UserControl { protected Certify.UI.ViewModel.ManagedCertificateViewModel ItemViewModel => UI.ViewModel.ManagedCertificateViewModel.Current; protected Certify.UI.ViewModel.AppViewModel AppViewModel => UI.ViewModel.AppViewModel.Current; public TestProgress() { InitializeComponent(); DataContext = ItemViewModel; } private void TextBlock_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { // copy text to clipboard if (sender != null) { var text = (sender as TextBlock).Text; Clipboard.SetText(text); MessageBox.Show("Copied to clipboard"); } } } }
using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; namespace Certify.UI.Controls.ManagedCertificate { public partial class TestProgress : UserControl { protected Certify.UI.ViewModel.ManagedCertificateViewModel ItemViewModel => UI.ViewModel.ManagedCertificateViewModel.Current; protected Certify.UI.ViewModel.AppViewModel AppViewModel => UI.ViewModel.AppViewModel.Current; public TestProgress() { InitializeComponent(); DataContext = ItemViewModel; } private async Task<bool> WaitForClipboard(string text) { // if running under terminal services etc the clipboard can take multiple attempts to set // https://stackoverflow.com/questions/68666/clipbrd-e-cant-open-error-when-setting-the-clipboard-from-net for (var i = 0; i < 10; i++) { try { Clipboard.SetText(text); return true; } catch { } await Task.Delay(50); } return false; } private async void TextBlock_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { // copy text to clipboard if (sender != null) { var text = (sender as TextBlock).Text; var copiedOK = await WaitForClipboard(text); if (copiedOK) { MessageBox.Show("Copied to clipboard"); } else { MessageBox.Show("Another process is preventing access to the clipboard. Please try again."); } } } } }
Fix exception on clipboard access contention
Fix exception on clipboard access contention
C#
mit
ndouthit/Certify,webprofusion/Certify
fe650e0c638d5d66ae998b914dd8222148afd857
src/Pickles/Pickles/LanguageServices.cs
src/Pickles/Pickles/LanguageServices.cs
#region License /* Copyright [2011] [Jeffrey Cameron] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #endregion using System; using System.Globalization; using gherkin; namespace PicklesDoc.Pickles { public class LanguageServices { private readonly CultureInfo currentCulture; public LanguageServices(Configuration configuration) { if (!string.IsNullOrEmpty(configuration.Language)) this.currentCulture = CultureInfo.GetCultureInfo(configuration.Language); } private java.util.List GetKeywords(string key) { return this.GetLanguage().keywords(key); } public string GetKeyword(string key) { var keywords = this.GetKeywords("background"); if (keywords != null && !keywords.isEmpty()) { return keywords.get(0).ToString(); } return null; } private I18n GetLanguage() { if (this.currentCulture == null) return new I18n("en"); return new I18n(this.currentCulture.TwoLetterISOLanguageName); } } }
#region License /* Copyright [2011] [Jeffrey Cameron] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #endregion using System; using System.Globalization; using System.Linq; using Gherkin3; namespace PicklesDoc.Pickles { public class LanguageServices { private readonly CultureInfo currentCulture; private readonly GherkinDialectProvider dialectProvider; public LanguageServices(Configuration configuration) { if (!string.IsNullOrEmpty(configuration.Language)) this.currentCulture = CultureInfo.GetCultureInfo(configuration.Language); this.dialectProvider = new GherkinDialectProvider(); } private string[] GetBackgroundKeywords() { return this.GetLanguage().BackgroundKeywords; } public string GetKeyword(string key) { var keywords = this.GetBackgroundKeywords(); return keywords.FirstOrDefault(); } private GherkinDialect GetLanguage() { if (this.currentCulture == null) return this.dialectProvider.GetDialect("en", null); return this.dialectProvider.GetDialect(this.currentCulture.TwoLetterISOLanguageName, null); } } }
Use GherkinDialectProvider instead of I18n
Use GherkinDialectProvider instead of I18n
C#
apache-2.0
picklesdoc/pickles,ludwigjossieaux/pickles,ludwigjossieaux/pickles,blorgbeard/pickles,dirkrombauts/pickles,magicmonty/pickles,picklesdoc/pickles,dirkrombauts/pickles,blorgbeard/pickles,dirkrombauts/pickles,magicmonty/pickles,ludwigjossieaux/pickles,magicmonty/pickles,dirkrombauts/pickles,blorgbeard/pickles,picklesdoc/pickles,magicmonty/pickles,picklesdoc/pickles,blorgbeard/pickles
6432c9da98cd1908033db7fb56209df5ed58e705
Src/BScript/Expressions/NewExpression.cs
Src/BScript/Expressions/NewExpression.cs
namespace BScript.Expressions { using System; using System.Collections.Generic; using System.Linq; using System.Text; using BScript.Language; public class NewExpression : IExpression { private IExpression expression; private IList<IExpression> argexprs; public NewExpression(IExpression expression, IList<IExpression> argexprs) { this.expression = expression; this.argexprs = argexprs; } public IExpression Expression { get { return this.expression; } } public IList<IExpression> ArgumentExpressions { get { return this.argexprs; } } public object Evaluate(Context context) { var type = (Type)this.expression.Evaluate(context); IList<object> args = new List<object>(); foreach (var argexpr in this.argexprs) args.Add(argexpr.Evaluate(context)); return Activator.CreateInstance(type, args.ToArray()); } } }
namespace BScript.Expressions { using System; using System.Collections.Generic; using System.Linq; using System.Text; using BScript.Language; using BScript.Utilities; public class NewExpression : IExpression { private IExpression expression; private IList<IExpression> argexprs; public NewExpression(IExpression expression, IList<IExpression> argexprs) { this.expression = expression; this.argexprs = argexprs; } public IExpression Expression { get { return this.expression; } } public IList<IExpression> ArgumentExpressions { get { return this.argexprs; } } public object Evaluate(Context context) { Type type; if (this.expression is DotExpression) type = TypeUtilities.GetType(((DotExpression)this.expression).FullName); else type = (Type)this.expression.Evaluate(context); IList<object> args = new List<object>(); foreach (var argexpr in this.argexprs) args.Add(argexpr.Evaluate(context)); return Activator.CreateInstance(type, args.ToArray()); } } }
Fix new expression with dot name
Fix new expression with dot name
C#
mit
ajlopez/BScript
b2db5c7b1ff529df5357016eda28698de752dc14
NBi.Xml/Decoration/Command/SqlRunXml.cs
NBi.Xml/Decoration/Command/SqlRunXml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Xml.Serialization; using NBi.Core.Etl; using NBi.Xml.Items; using System.IO; using NBi.Core.Batch; using NBi.Xml.Settings; namespace NBi.Xml.Decoration.Command { public class SqlRunXml : DecorationCommandXml, IBatchRunCommand { [XmlAttribute("name")] public string Name { get; set; } [XmlAttribute("path")] public string InternalPath { get; set; } [XmlIgnore] public string FullPath { get { var fullPath = string.Empty; if (!Path.IsPathRooted(InternalPath) || string.IsNullOrEmpty(Settings.BasePath)) fullPath = InternalPath + Name; else fullPath = Settings.BasePath + InternalPath + Name; return fullPath; } } [XmlAttribute("connectionString")] public string SpecificConnectionString { get; set; } [XmlIgnore] public string ConnectionString { get { if (!String.IsNullOrWhiteSpace(SpecificConnectionString)) return SpecificConnectionString; if (Settings != null && Settings.GetDefault(SettingsXml.DefaultScope.Decoration) != null) return Settings.GetDefault(SettingsXml.DefaultScope.Decoration).ConnectionString; return string.Empty; } } public SqlRunXml() { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Xml.Serialization; using NBi.Core.Etl; using NBi.Xml.Items; using System.IO; using NBi.Core.Batch; using NBi.Xml.Settings; namespace NBi.Xml.Decoration.Command { public class SqlRunXml : DecorationCommandXml, IBatchRunCommand { [XmlAttribute("name")] public string Name { get; set; } [XmlAttribute("path")] public string InternalPath { get; set; } [XmlIgnore] public string FullPath { get { var fullPath = string.Empty; if (!Path.IsPathRooted(InternalPath) || string.IsNullOrEmpty(Settings.BasePath)) fullPath = InternalPath + Name; else fullPath = Settings.BasePath + InternalPath + Name; return fullPath; } } [XmlAttribute("connectionString")] public string SpecificConnectionString { get; set; } [XmlIgnore] public string ConnectionString { get { if (!string.IsNullOrEmpty(SpecificConnectionString) && SpecificConnectionString.StartsWith("@")) return Settings.GetReference(SpecificConnectionString.Remove(0, 1)).ConnectionString; if (!String.IsNullOrWhiteSpace(SpecificConnectionString)) return SpecificConnectionString; if (Settings != null && Settings.GetDefault(SettingsXml.DefaultScope.Decoration) != null) return Settings.GetDefault(SettingsXml.DefaultScope.Decoration).ConnectionString; return string.Empty; } } public SqlRunXml() { } } }
Fix it also for sql-run
Fix it also for sql-run
C#
apache-2.0
Seddryck/NBi,Seddryck/NBi
8ce7a76484799af5d659efe19ac7556fbe249002
Source/Web/ForumSystem.Web/Views/Answer/ViewAll.cshtml
Source/Web/ForumSystem.Web/Views/Answer/ViewAll.cshtml
@model System.Linq.IQueryable<ForumSystem.Web.ViewModels.Answers.AnswerViewModel> @using ForumSystem.Web.ViewModels.Answers; @foreach (var answer in Model) { <div class="panel panel-success"> <div class="panel-heading"> <h3> @answer.Post.Title </h3> </div> <div class="panel-body"> <div class="panel-body"> <p>@Html.Raw(answer.Content)</p> @if (@answer.Author != null) { <p>@answer.Author.Email</p> } else { @Html.Display("Anonymous") } </div> <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="bottom" title="Tooltip on left"> @Html.ActionLink("Delete", "Delete", "Answer", new { id = answer.Id }, null) </button> </div> </div> }
@model System.Linq.IQueryable<ForumSystem.Web.ViewModels.Answers.AnswerViewModel> @using ForumSystem.Web.ViewModels.Answers; <div class="panel panel-success"> <div class="panel-heading"> <h3> @Html.ActionLink(Model.FirstOrDefault().Post.Title, "Display", "Questions", new { id = Model.FirstOrDefault().PostId, url = "new" }, null) </h3> </div> <div class="panel-body"> @foreach (var answer in Model) { <div class="panel-body"> <span class="glyphicon glyphicon-user" aria-hidden="true"></span> <p>@Html.Raw(answer.Content)</p> @if (@answer.Author != null) { <p>@answer.Author.Email</p> } else { @Html.Display("Anonymous") } </div> <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="bottom" title="Tooltip on left"> @Html.ActionLink("Delete", "Delete", "Answer", new { id = answer.Id }, null) </button> } </div> </div>
Update view of all answers
Update view of all answers
C#
mit
IskraNikolova/ForumSystem,IskraNikolova/ForumSystem,IskraNikolova/ForumSystem
502dcc566978b9bc2420d102e76ecbf51260b875
osu.Game/Skinning/LegacySkinDecoder.cs
osu.Game/Skinning/LegacySkinDecoder.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.Game.Beatmaps.Formats; namespace osu.Game.Skinning { public class LegacySkinDecoder : LegacyDecoder<LegacySkinConfiguration> { public LegacySkinDecoder() : base(1) { } protected override void ParseLine(LegacySkinConfiguration skin, Section section, string line) { if (section != Section.Colours) { line = StripComments(line); var pair = SplitKeyVal(line); switch (section) { case Section.General: switch (pair.Key) { case @"Name": skin.SkinInfo.Name = pair.Value; return; case @"Author": skin.SkinInfo.Creator = pair.Value; return; case @"Version": if (pair.Value == "latest" || pair.Value == "User") skin.LegacyVersion = LegacySkinConfiguration.LATEST_VERSION; else if (decimal.TryParse(pair.Value, out var version)) skin.LegacyVersion = version; return; } break; } if (!string.IsNullOrEmpty(pair.Key)) skin.ConfigDictionary[pair.Key] = pair.Value; } base.ParseLine(skin, section, line); } } }
// 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.Game.Beatmaps.Formats; namespace osu.Game.Skinning { public class LegacySkinDecoder : LegacyDecoder<LegacySkinConfiguration> { public LegacySkinDecoder() : base(1) { } protected override void ParseLine(LegacySkinConfiguration skin, Section section, string line) { if (section != Section.Colours) { line = StripComments(line); var pair = SplitKeyVal(line); switch (section) { case Section.General: switch (pair.Key) { case @"Name": skin.SkinInfo.Name = pair.Value; return; case @"Author": skin.SkinInfo.Creator = pair.Value; return; case @"Version": if (pair.Value == "latest") skin.LegacyVersion = LegacySkinConfiguration.LATEST_VERSION; else if (decimal.TryParse(pair.Value, out var version)) skin.LegacyVersion = version; return; } break; } if (!string.IsNullOrEmpty(pair.Key)) skin.ConfigDictionary[pair.Key] = pair.Value; } base.ParseLine(skin, section, line); } } }
Fix incorrect skin version case
Fix incorrect skin version case
C#
mit
johnneijzen/osu,smoogipoo/osu,ppy/osu,ppy/osu,EVAST9919/osu,UselessToucan/osu,2yangk23/osu,smoogipooo/osu,peppy/osu,2yangk23/osu,UselessToucan/osu,peppy/osu-new,johnneijzen/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,smoogipoo/osu
a86d4072b80353e8eab64e0756e344819907edbd
kafka-tests/Fakes/FakeKafkaConnection.cs
kafka-tests/Fakes/FakeKafkaConnection.cs
using KafkaNet; using KafkaNet.Protocol; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace kafka_tests.Fakes { public class FakeKafkaConnection : IKafkaConnection { private Uri _address; public Func<ProduceResponse> ProduceResponseFunction; public Func<MetadataResponse> MetadataResponseFunction; public FakeKafkaConnection(Uri address) { _address = address; } public int MetadataRequestCallCount { get; set; } public int ProduceRequestCallCount { get; set; } public Uri KafkaUri { get { return _address; } } public bool ReadPolling { get { return true; } } public Task SendAsync(byte[] payload) { throw new NotImplementedException(); } public Task<List<T>> SendAsync<T>(IKafkaRequest<T> request) { var tcs = new TaskCompletionSource<List<T>>(); if (typeof(T) == typeof(ProduceResponse)) { ProduceRequestCallCount++; tcs.SetResult(new List<T> { (T)(object)ProduceResponseFunction() }); } else if (typeof(T) == typeof(MetadataResponse)) { MetadataRequestCallCount++; tcs.SetResult(new List<T> { (T)(object)MetadataResponseFunction() }); } return tcs.Task; } public void Dispose() { } } }
using KafkaNet; using KafkaNet.Protocol; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace kafka_tests.Fakes { public class FakeKafkaConnection : IKafkaConnection { private Uri _address; public Func<ProduceResponse> ProduceResponseFunction; public Func<MetadataResponse> MetadataResponseFunction; public FakeKafkaConnection(Uri address) { _address = address; } public int MetadataRequestCallCount { get; set; } public int ProduceRequestCallCount { get; set; } public Uri KafkaUri { get { return _address; } } public bool ReadPolling { get { return true; } } public Task SendAsync(byte[] payload) { throw new NotImplementedException(); } public Task<List<T>> SendAsync<T>(IKafkaRequest<T> request) { var task = new Task<List<T>>(() => { if (typeof(T) == typeof(ProduceResponse)) { ProduceRequestCallCount++; return new List<T> { (T)(object)ProduceResponseFunction() }; } else if (typeof(T) == typeof(MetadataResponse)) { MetadataRequestCallCount++; return new List<T> { (T)(object)MetadataResponseFunction() }; } return null; }); task.Start(); return task; } public void Dispose() { } } }
Fix fake not replicating actual behaviour
Fix fake not replicating actual behaviour
C#
apache-2.0
aNutForAJarOfTuna/kafka-net,CenturyLinkCloud/kafka-net,gigya/KafkaNetClient,nightkid1027/kafka-net,Jroland/kafka-net,EranOfer/KafkaNetClient,PKRoma/kafka-net,bridgewell/kafka-net,martijnhoekstra/kafka-net,geffzhang/kafka-net,BDeus/KafkaNetClient
26e171802b2c442ba5d222be87768204f8307699
DataTool/JSON/JSONTool.cs
DataTool/JSON/JSONTool.cs
using System; using System.IO; using DataTool.ToolLogic.List; using Utf8Json; using Utf8Json.Resolvers; using static DataTool.Helper.IO; using static DataTool.Helper.Logger; namespace DataTool.JSON { public class JSONTool { internal void OutputJSON(object jObj, ListFlags toolFlags) { CompositeResolver.RegisterAndSetAsDefault(new IJsonFormatter[] { new ResourceGUIDFormatter() }, new[] { StandardResolver.Default }); byte[] json = JsonSerializer.NonGeneric.Serialize(jObj.GetType(), jObj); if (!string.IsNullOrWhiteSpace(toolFlags.Output)) { byte[] pretty = JsonSerializer.PrettyPrintByteArray(json); Log("Writing to {0}", toolFlags.Output); CreateDirectoryFromFile(toolFlags.Output); using (Stream file = File.OpenWrite(toolFlags.Output)) { file.SetLength(0); file.Write(pretty, 0, pretty.Length); } } else { Console.Error.WriteLine(JsonSerializer.PrettyPrint(json)); } } } }
using System; using System.IO; using DataTool.ToolLogic.List; using Utf8Json; using Utf8Json.Resolvers; using static DataTool.Helper.IO; using static DataTool.Helper.Logger; namespace DataTool.JSON { public class JSONTool { internal void OutputJSON(object jObj, ListFlags toolFlags) { CompositeResolver.RegisterAndSetAsDefault(new IJsonFormatter[] { new ResourceGUIDFormatter() }, new[] { StandardResolver.Default }); byte[] json = JsonSerializer.NonGeneric.Serialize(jObj.GetType(), jObj); if (!string.IsNullOrWhiteSpace(toolFlags.Output)) { byte[] pretty = JsonSerializer.PrettyPrintByteArray(json); Log("Writing to {0}", toolFlags.Output); CreateDirectoryFromFile(toolFlags.Output); var fileName = !toolFlags.Output.EndsWith(".json") ? $"{toolFlags.Output}.json" : toolFlags.Output; using (Stream file = File.OpenWrite(fileName)) { file.SetLength(0); file.Write(pretty, 0, pretty.Length); } } else { Console.Error.WriteLine(JsonSerializer.PrettyPrint(json)); } } } }
Append .json to end of filename when outputting JSON
Append .json to end of filename when outputting JSON
C#
mit
overtools/OWLib
29d6f59471e02e6c6f2f75edc6b07dbc11e263e7
src/NodaTime.Test/DateTimeZoneProvidersTest.cs
src/NodaTime.Test/DateTimeZoneProvidersTest.cs
// Copyright 2013 The Noda Time Authors. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using System.Linq; using NUnit.Framework; namespace NodaTime.Test { /// <summary> /// Tests for DateTimeZoneProviders. /// </summary> public class DateTimeZoneProvidersTest { [Test] public void TzdbProviderUsesTzdbSource() { Assert.IsTrue(DateTimeZoneProviders.Tzdb.VersionId.StartsWith("TZDB: ")); } [Test] public void AllTzdbTimeZonesLoad() { var allZones = DateTimeZoneProviders.Tzdb.Ids.Select(id => DateTimeZoneProviders.Tzdb[id]).ToList(); // Just to stop the variable from being lonely. In reality, it's likely there'll be a breakpoint here to inspect a particular zone... Assert.IsTrue(allZones.Count > 50); } [Test] public void BclProviderUsesTimeZoneInfoSource() { Assert.IsTrue(DateTimeZoneProviders.Bcl.VersionId.StartsWith("TimeZoneInfo: ")); } } }
// Copyright 2013 The Noda Time Authors. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using System.Linq; using NodaTime.Testing.TimeZones; using NodaTime.Xml; using NUnit.Framework; namespace NodaTime.Test { /// <summary> /// Tests for DateTimeZoneProviders. /// </summary> public class DateTimeZoneProvidersTest { [Test] public void TzdbProviderUsesTzdbSource() { Assert.IsTrue(DateTimeZoneProviders.Tzdb.VersionId.StartsWith("TZDB: ")); } [Test] public void AllTzdbTimeZonesLoad() { var allZones = DateTimeZoneProviders.Tzdb.Ids.Select(id => DateTimeZoneProviders.Tzdb[id]).ToList(); // Just to stop the variable from being lonely. In reality, it's likely there'll be a breakpoint here to inspect a particular zone... Assert.IsTrue(allZones.Count > 50); } [Test] public void BclProviderUsesTimeZoneInfoSource() { Assert.IsTrue(DateTimeZoneProviders.Bcl.VersionId.StartsWith("TimeZoneInfo: ")); } [Test] public void SerializationDelegatesToXmlSerializerSettings() { var original = XmlSerializationSettings.DateTimeZoneProvider; try { #pragma warning disable CS0618 // Type or member is obsolete var provider1 = new FakeDateTimeZoneSource.Builder().Build().ToProvider(); DateTimeZoneProviders.Serialization = provider1; Assert.AreSame(provider1, XmlSerializationSettings.DateTimeZoneProvider); var provider2 = new FakeDateTimeZoneSource.Builder().Build().ToProvider(); XmlSerializationSettings.DateTimeZoneProvider = provider2; Assert.AreSame(provider2, DateTimeZoneProviders.Serialization); #pragma warning restore CS0618 // Type or member is obsolete } finally { XmlSerializationSettings.DateTimeZoneProvider = original; } } } }
Add test for delegation in obsolete property
Add test for delegation in obsolete property (This keeps the coverage of DateTimeZoneProviders at 100% :)
C#
apache-2.0
malcolmr/nodatime,nodatime/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,nodatime/nodatime,malcolmr/nodatime,malcolmr/nodatime,BenJenkinson/nodatime
0c07787f8452548458a989664b4ba9ba45d03575
src/ErgastApi/Responses/Models/Driver.cs
src/ErgastApi/Responses/Models/Driver.cs
using System; using Newtonsoft.Json; namespace ErgastApi.Responses.Models { public class Driver { [JsonProperty("driverId")] public string DriverId { get; private set; } /// <summary> /// Drivers who participated in the 2014 season onwards have a permanent driver number. /// However, this may differ from the value of the number attribute of the Result element in earlier seasons /// or where the reigning champion has chosen to use "1" rather than his permanent driver number. /// </summary> [JsonProperty("permanentNumber")] public int? PermanentNumber { get; private set; } [JsonProperty("code")] public string Code { get; private set; } [JsonProperty("url")] public string WikiUrl { get; private set; } public string FullName => $"{FirstName} {LastName}"; [JsonProperty("givenName")] public string FirstName { get; private set; } [JsonProperty("familyName")] public string LastName { get; private set; } [JsonProperty("dateOfBirth")] public DateTime DateOfBirth { get; private set; } [JsonProperty("nationality")] public string Nationality { get; private set; } } }
using System; using Newtonsoft.Json; namespace ErgastApi.Responses.Models { public class Driver { [JsonProperty("driverId")] public string DriverId { get; private set; } /// <summary> /// Drivers who participated in the 2014 season onwards have a permanent driver number. /// However, this may differ from the value of the number attribute of the Result element in earlier seasons /// or where the reigning champion has chosen to use "1" rather than his permanent driver number. /// </summary> [JsonProperty("permanentNumber")] public int? PermanentNumber { get; private set; } [JsonProperty("code")] public string Code { get; private set; } [JsonProperty("url")] public string WikiUrl { get; private set; } public string FullName => $"{FirstName} {LastName}"; [JsonProperty("givenName")] public string FirstName { get; private set; } [JsonProperty("familyName")] public string LastName { get; private set; } [JsonProperty("dateOfBirth")] public DateTime? DateOfBirth { get; private set; } [JsonProperty("nationality")] public string Nationality { get; private set; } } }
Support drivers without a date of birth
Support drivers without a date of birth
C#
unlicense
Krusen/ErgastApi.Net
00a5902fbf49c37d81d470fc437432bca403611c
src/NHibernate/Linq/ExpressionTransformers/RemoveRedundantCast.cs
src/NHibernate/Linq/ExpressionTransformers/RemoveRedundantCast.cs
using System.Linq.Expressions; using Remotion.Linq.Parsing.ExpressionTreeVisitors.Transformation; namespace NHibernate.Linq.ExpressionTransformers { /// <summary> /// Remove redundant casts to the same type or to superclass (upcast) in <see cref="ExpressionType.Convert"/>, <see cref=" ExpressionType.ConvertChecked"/> /// and <see cref="ExpressionType.TypeAs"/> <see cref="UnaryExpression"/>s /// </summary> public class RemoveRedundantCast : IExpressionTransformer<UnaryExpression> { private static readonly ExpressionType[] _supportedExpressionTypes = new[] { ExpressionType.TypeAs, ExpressionType.Convert, ExpressionType.ConvertChecked, }; public Expression Transform(UnaryExpression expression) { if (expression.Type != typeof(object) && expression.Type.IsAssignableFrom(expression.Operand.Type) && expression.Method != null && !expression.IsLiftedToNull) { return expression.Operand; } return expression; } public ExpressionType[] SupportedExpressionTypes { get { return _supportedExpressionTypes; } } } }
using System.Linq.Expressions; using Remotion.Linq.Parsing.ExpressionTreeVisitors.Transformation; namespace NHibernate.Linq.ExpressionTransformers { /// <summary> /// Remove redundant casts to the same type or to superclass (upcast) in <see cref="ExpressionType.Convert"/>, <see cref=" ExpressionType.ConvertChecked"/> /// and <see cref="ExpressionType.TypeAs"/> <see cref="UnaryExpression"/>s /// </summary> public class RemoveRedundantCast : IExpressionTransformer<UnaryExpression> { private static readonly ExpressionType[] _supportedExpressionTypes = new[] { ExpressionType.TypeAs, ExpressionType.Convert, ExpressionType.ConvertChecked, }; public Expression Transform(UnaryExpression expression) { if (expression.Type != typeof(object) && expression.Type.IsAssignableFrom(expression.Operand.Type) && expression.Method == null && !expression.IsLiftedToNull) { return expression.Operand; } return expression; } public ExpressionType[] SupportedExpressionTypes { get { return _supportedExpressionTypes; } } } }
Fix typo in last commit
Fix typo in last commit
C#
lgpl-2.1
fredericDelaporte/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,alobakov/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,ManufacturingIntelligence/nhibernate-core,lnu/nhibernate-core,nkreipke/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,ngbrown/nhibernate-core,alobakov/nhibernate-core,fredericDelaporte/nhibernate-core,nkreipke/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,gliljas/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,livioc/nhibernate-core,lnu/nhibernate-core,nhibernate/nhibernate-core,livioc/nhibernate-core,hazzik/nhibernate-core,livioc/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,alobakov/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core
f5ef4bb3e5546dc0abd09d89188cc91dd2e8ed6e
src/WebJobs.Script/Description/Binding/EventHubBindingMetadata.cs
src/WebJobs.Script/Description/Binding/EventHubBindingMetadata.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; using Microsoft.Azure.WebJobs.ServiceBus; namespace Microsoft.Azure.WebJobs.Script.Description { public class EventHubBindingMetadata : BindingMetadata { [AllowNameResolution] public string Path { get; set; } public override void ApplyToConfig(JobHostConfigurationBuilder configBuilder) { if (configBuilder == null) { throw new ArgumentNullException("configBuilder"); } EventHubConfiguration eventHubConfig = configBuilder.EventHubConfiguration; string connectionString = null; if (!string.IsNullOrEmpty(Connection)) { connectionString = Utility.GetAppSettingOrEnvironmentValue(Connection); } if (this.IsTrigger) { string eventProcessorHostName = Guid.NewGuid().ToString(); string storageConnectionString = configBuilder.Config.StorageConnectionString; var eventProcessorHost = new Microsoft.ServiceBus.Messaging.EventProcessorHost( eventProcessorHostName, this.Path, Microsoft.ServiceBus.Messaging.EventHubConsumerGroup.DefaultGroupName, connectionString, storageConnectionString); eventHubConfig.AddEventProcessorHost(this.Path, eventProcessorHost); } else { var client = Microsoft.ServiceBus.Messaging.EventHubClient.CreateFromConnectionString( connectionString, this.Path); eventHubConfig.AddEventHubClient(this.Path, client); } } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; using Microsoft.Azure.WebJobs.ServiceBus; namespace Microsoft.Azure.WebJobs.Script.Description { public class EventHubBindingMetadata : BindingMetadata { [AllowNameResolution] public string Path { get; set; } // Optional Consumer group public string ConsumerGroup { get; set; } public override void ApplyToConfig(JobHostConfigurationBuilder configBuilder) { if (configBuilder == null) { throw new ArgumentNullException("configBuilder"); } EventHubConfiguration eventHubConfig = configBuilder.EventHubConfiguration; string connectionString = null; if (!string.IsNullOrEmpty(Connection)) { connectionString = Utility.GetAppSettingOrEnvironmentValue(Connection); } if (this.IsTrigger) { string eventProcessorHostName = Guid.NewGuid().ToString(); string storageConnectionString = configBuilder.Config.StorageConnectionString; string consumerGroup = this.ConsumerGroup; if (consumerGroup == null) { consumerGroup = Microsoft.ServiceBus.Messaging.EventHubConsumerGroup.DefaultGroupName; } var eventProcessorHost = new Microsoft.ServiceBus.Messaging.EventProcessorHost( eventProcessorHostName, this.Path, consumerGroup, connectionString, storageConnectionString); eventHubConfig.AddEventProcessorHost(this.Path, eventProcessorHost); } else { var client = Microsoft.ServiceBus.Messaging.EventHubClient.CreateFromConnectionString( connectionString, this.Path); eventHubConfig.AddEventHubClient(this.Path, client); } } } }
Support EventHub Consumer Groups in Script
Support EventHub Consumer Groups in Script
C#
mit
fabiocav/azure-webjobs-sdk-script,Azure/azure-webjobs-sdk-script,fabiocav/azure-webjobs-sdk-script,Azure/azure-webjobs-sdk-script,Azure/azure-webjobs-sdk-script,fabiocav/azure-webjobs-sdk-script,fabiocav/azure-webjobs-sdk-script,Azure/azure-webjobs-sdk-script
a72a9274e88f10d32480f7bb5a71a15f66b784c9
src/MiNET/MiNET.Service/MiNetService.cs
src/MiNET/MiNET.Service/MiNetService.cs
using Topshelf; namespace MiNET.Service { public class MiNetService { private MiNetServer _server; private void Start() { _server = new MiNetServer(); _server.StartServer(); } private void Stop() { _server.StopServer(); } private static void Main(string[] args) { HostFactory.Run(host => { host.Service<MiNetService>(s => { s.ConstructUsing(construct => new MiNetService()); s.WhenStarted(service => service.Start()); s.WhenStopped(service => service.Stop()); }); host.RunAsLocalService(); host.SetDisplayName("MiNET Service"); host.SetDescription("MiNET MineCraft Pocket Edition server."); host.SetServiceName("MiNET"); }); } } }
using System; using Topshelf; namespace MiNET.Service { public class MiNetService { private MiNetServer _server; private void Start() { _server = new MiNetServer(); _server.StartServer(); } private void Stop() { _server.StopServer(); } private static void Main(string[] args) { if (IsRunningOnMono()) { var service = new MiNetService(); service.Start(); Console.WriteLine("MiNET runing. Press <enter> to stop service.."); Console.ReadLine(); service.Stop(); } HostFactory.Run(host => { host.Service<MiNetService>(s => { s.ConstructUsing(construct => new MiNetService()); s.WhenStarted(service => service.Start()); s.WhenStopped(service => service.Stop()); }); host.RunAsLocalService(); host.SetDisplayName("MiNET Service"); host.SetDescription("MiNET MineCraft Pocket Edition server."); host.SetServiceName("MiNET"); }); } public static bool IsRunningOnMono() { return Type.GetType("Mono.Runtime") != null; } } }
Fix mono support on startup. Bypass TopShelf service framework.
Fix mono support on startup. Bypass TopShelf service framework.
C#
mpl-2.0
yungtechboy1/MiNET,uniaspiex/MiNET,InPvP/MiNET,MiPE-JP/RaNET,erichexter/MiNET,Vladik46/MiNET,Creeperface01/MiNET
2ce9bb27a1608cbadd23098de99c007e7d7d8f9f
src/StructuredLogger/Serialization/StringWriter.cs
src/StructuredLogger/Serialization/StringWriter.cs
using System.Text; namespace Microsoft.Build.Logging.StructuredLogger { public class StringWriter { public static string GetString(object rootNode) { var sb = new StringBuilder(); WriteNode(rootNode, sb, 0); return sb.ToString(); } private static void WriteNode(object rootNode, StringBuilder sb, int indent = 0) { Indent(sb, indent); var text = rootNode.ToString(); // when we injest strings we normalize on \n to save space. // when the strings leave our app via clipboard, bring \r\n back so that notepad works text = text.Replace("\n", "\r\n"); sb.AppendLine(text); var treeNode = rootNode as TreeNode; if (treeNode != null && treeNode.HasChildren) { if (treeNode.HasChildren) { foreach (var child in treeNode.Children) { WriteNode(child, sb, indent + 1); } } } } private static void Indent(StringBuilder sb, int indent) { for (int i = 0; i < indent * 4; i++) { sb.Append(' '); } } } }
using System.Text; namespace Microsoft.Build.Logging.StructuredLogger { public class StringWriter { public static string GetString(object rootNode) { var sb = new StringBuilder(); WriteNode(rootNode, sb, 0); return sb.ToString(); } private static void WriteNode(object rootNode, StringBuilder sb, int indent = 0) { Indent(sb, indent); var text = rootNode.ToString() ?? ""; // when we injest strings we normalize on \n to save space. // when the strings leave our app via clipboard, bring \r\n back so that notepad works text = text.Replace("\n", "\r\n"); sb.AppendLine(text); var treeNode = rootNode as TreeNode; if (treeNode != null && treeNode.HasChildren) { if (treeNode.HasChildren) { foreach (var child in treeNode.Children) { WriteNode(child, sb, indent + 1); } } } } private static void Indent(StringBuilder sb, int indent) { for (int i = 0; i < indent * 4; i++) { sb.Append(' '); } } } }
Fix NRE when copying nodes when the ToString() is null
Fix NRE when copying nodes when the ToString() is null This happens more or less randomly with the following exception: System.NullReferenceException was unhandled HResult=-2147467261 Message=Object reference not set to an instance of an object. Source=StructuredLogger StackTrace: at Microsoft.Build.Logging.StructuredLogger.StringWriter.WriteNode(Object rootNode, StringBuilder sb, Int32 indent) in C:\MSBuildStructuredLog\src\StructuredLogger\Serialization\StringWriter.cs:line 23 at Microsoft.Build.Logging.StructuredLogger.StringWriter.WriteNode(Object rootNode, StringBuilder sb, Int32 indent) in C:\MSBuildStructuredLog\src\StructuredLogger\Serialization\StringWriter.cs:line 32 at Microsoft.Build.Logging.StructuredLogger.StringWriter.WriteNode(Object rootNode, StringBuilder sb, Int32 indent) in C:\MSBuildStructuredLog\src\StructuredLogger\Serialization\StringWriter.cs:line 32 at Microsoft.Build.Logging.StructuredLogger.StringWriter.WriteNode(Object rootNode, StringBuilder sb, Int32 indent) in C:\MSBuildStructuredLog\src\StructuredLogger\Serialization\StringWriter.cs:line 32 at Microsoft.Build.Logging.StructuredLogger.StringWriter.WriteNode(Object rootNode, StringBuilder sb, Int32 indent) in C:\MSBuildStructuredLog\src\StructuredLogger\Serialization\StringWriter.cs:line 32 at Microsoft.Build.Logging.StructuredLogger.StringWriter.WriteNode(Object rootNode, StringBuilder sb, Int32 indent) in C:\MSBuildStructuredLog\src\StructuredLogger\Serialization\StringWriter.cs:line 32 at Microsoft.Build.Logging.StructuredLogger.StringWriter.WriteNode(Object rootNode, StringBuilder sb, Int32 indent) in C:\MSBuildStructuredLog\src\StructuredLogger\Serialization\StringWriter.cs:line 32 at Microsoft.Build.Logging.StructuredLogger.StringWriter.GetString(Object rootNode) in C:\MSBuildStructuredLog\src\StructuredLogger\Serialization\StringWriter.cs:line 11 at StructuredLogViewer.Controls.BuildControl.Copy() at StructuredLogViewer.Controls.BuildControl.TreeView_KeyDown(Object sender, KeyEventArgs args) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey) at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled) at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers) at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled) at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at StructuredLogViewer.Entrypoint.Main(String[] args) InnerException:
C#
mit
KirillOsenkov/MSBuildStructuredLog,KirillOsenkov/MSBuildStructuredLog
66b8a8ad2eadf04b6dcd88b9ba9740044f4cf92e
osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs
osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.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 osuTK; using osuTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { /// <summary> /// A single follow point positioned between two adjacent <see cref="DrawableOsuHitObject"/>s. /// </summary> public class FollowPoint : Container, IAnimationTimeReference { private const float width = 8; public override bool RemoveWhenNotAlive => false; public FollowPoint() { Origin = Anchor.Centre; Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.FollowPoint), _ => new CircularContainer { Masking = true, AutoSizeAxes = Axes.Both, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, Colour = Color4.White.Opacity(0.2f), Radius = 4, }, Child = new Box { Size = new Vector2(width), Blending = BlendingParameters.Additive, Origin = Anchor.Centre, Anchor = Anchor.Centre, Alpha = 0.5f, } }, confineMode: ConfineMode.NoScaling); } public double AnimationStartTime { get; set; } } }
// 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 osuTK; using osuTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { /// <summary> /// A single follow point positioned between two adjacent <see cref="DrawableOsuHitObject"/>s. /// </summary> public class FollowPoint : Container, IAnimationTimeReference { private const float width = 8; public override bool RemoveWhenNotAlive => false; public FollowPoint() { Origin = Anchor.Centre; Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.FollowPoint), _ => new CircularContainer { Masking = true, AutoSizeAxes = Axes.Both, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, Colour = Color4.White.Opacity(0.2f), Radius = 4, }, Child = new Box { Size = new Vector2(width), Blending = BlendingParameters.Additive, Origin = Anchor.Centre, Anchor = Anchor.Centre, Alpha = 0.5f, } }); } public double AnimationStartTime { get; set; } } }
Remove stray default value specification
Remove stray default value specification
C#
mit
NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,EVAST9919/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,smoogipooo/osu,ppy/osu,UselessToucan/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,peppy/osu
15e27b7ea8d1cbe42f7e0550a567725a6856111b
otr-project/Views/UserMailer/Welcome.cshtml
otr-project/Views/UserMailer/Welcome.cshtml
Hello @ViewData.Model.FirstName,<br /><br /> Thank you for signing up for Rambla! You have taken the first step towards expanding your rentability.<br /><br /> @{ string URL = Url.Action("activateaccount", "Account", new RouteValueDictionary(new { id = ViewData.Model.ActivationId }), Request.Url.Scheme.ToString(), Request.Url.Host); } Please click <a href="@URL">here</a> to activate your account.<br /><br /> Regards,<br /> Rambla Team
@{ string URL = Url.Action("activateaccount", "Account", new RouteValueDictionary(new { id = ViewData.Model.ActivationId }), Request.Url.Scheme.ToString(), Request.Url.Host); } <p>Hi @ViewData.Model.FirstName,</p> <p>Welcome to <strong>Rambla</strong>, a marketplace that facilitates sharing of items between you and your community members. We're excited to have you as a member and can't wait to see what you have to share.</p> <p>As a new member, here are a few suggestions to get you started with Rambla:</p> <ul> <li> Dig out that hammer drill that you do not need right now or that snowboard that you do not use too often and post it on <strong>Rambla</strong>. In fact, any unused item in your house can be of use to someone belonging to your community. </li> <li> Need a sleeping bag for your annual camping trip or an outdoor patio heater for your Christmas party? Search for it on <strong>Rambla</strong> There is always someone who has an item you are looking for and is willing to share it with you. </li> <li> Help your fellow community members find your stuff by using big images, writing thoughtful descriptions and addressing their queries promptly. You might just get rewarded for your exceptional conduct with a small gift from us. :-) </li> </ul> <p>To get started with your <strong>Rambla</strong> experience, please click <a href="@URL">here</a> to activate your account.</p> <p>Thanks for joining and happy sharing!</p> <p>- The Rambla Team</p>
Update verbiage on user registration email
Update verbiage on user registration email
C#
mit
ratneshchandna/rambla,ratneshchandna/rambla,ratneshchandna/rambla
b06595645e85da0d1baac45fa0b7b8a95943a94f
DanTup.DartVS.Vsix/Providers/BraceCompletionProvider.cs
DanTup.DartVS.Vsix/Providers/BraceCompletionProvider.cs
using System.ComponentModel.Composition; using Microsoft.VisualStudio.Text.BraceCompletion; using Microsoft.VisualStudio.Utilities; namespace DanTup.DartVS { [Export(typeof(IBraceCompletionDefaultProvider))] [ContentType(DartContentTypeDefinition.DartContentType)] [BracePair('{', '}')] class BraceCompletionProvider : IBraceCompletionDefaultProvider { } }
using System.ComponentModel.Composition; using Microsoft.VisualStudio.Text.BraceCompletion; using Microsoft.VisualStudio.Utilities; namespace DanTup.DartVS { [Export(typeof(IBraceCompletionDefaultProvider))] [ContentType(DartContentTypeDefinition.DartContentType)] [BracePair('{', '}')] [BracePair('(', ')')] [BracePair('[', ']')] class BraceCompletionProvider : IBraceCompletionDefaultProvider { } }
Support completion of parens and indexes too.
Support completion of parens and indexes too.
C#
mit
modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS
fea56322f0aadcdb1b48a82f4836a47d268cd213
osu.Game/Rulesets/Mods/ModSuddenDeath.cs
osu.Game/Rulesets/Mods/ModSuddenDeath.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using osu.Game.Graphics; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mods { public abstract class ModSuddenDeath : Mod, IApplicableToScoreProcessor { public override string Name => "Sudden Death"; public override string ShortenedName => "SD"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath; public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Miss a note and fail."; public override double ScoreMultiplier => 1; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) }; public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { scoreProcessor.FailConditions += FailCondition; } protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value != scoreProcessor.HighestCombo.Value; } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using osu.Game.Graphics; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mods { public abstract class ModSuddenDeath : Mod, IApplicableToScoreProcessor { public override string Name => "Sudden Death"; public override string ShortenedName => "SD"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath; public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Miss a note and fail."; public override double ScoreMultiplier => 1; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) }; public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { scoreProcessor.FailConditions += FailCondition; } protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value == 0; } }
Fix SD not failing for the first note
Fix SD not failing for the first note
C#
mit
naoey/osu,UselessToucan/osu,smoogipoo/osu,ZLima12/osu,2yangk23/osu,ppy/osu,ZLima12/osu,Drezi126/osu,peppy/osu,Nabile-Rahmani/osu,johnneijzen/osu,2yangk23/osu,DrabWeb/osu,smoogipoo/osu,johnneijzen/osu,EVAST9919/osu,smoogipoo/osu,NeoAdonis/osu,naoey/osu,peppy/osu,EVAST9919/osu,peppy/osu-new,NeoAdonis/osu,Frontear/osuKyzer,ppy/osu,DrabWeb/osu,peppy/osu,UselessToucan/osu,DrabWeb/osu,naoey/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,NeoAdonis/osu
3eca8bfd62c029e96062a41c101fc5b72b7b8db1
src/LessMsi.Cli/ShowHelpCommand.cs
src/LessMsi.Cli/ShowHelpCommand.cs
using System; using System.Collections.Generic; namespace LessMsi.Cli { internal class ShowHelpCommand : LessMsiCommand { public override void Run(List<string> args) { ShowHelp(""); } public static void ShowHelp(string errorMessage) { string helpString = @"Usage: lessmsi <command> [options] <msi_name> [<path_to_extract\>] [file_names] Commands: x Extracts all or specified files from the specified msi_name. l Lists the contents of the specified msi table as CSV to stdout. v Lists the value of the ProductVersion Property in the msi (typically this is the version of the MSI). o Opens the specified msi_name in the GUI. h Shows this help page. For more information see http://lessmsi.activescott.com "; if (!string.IsNullOrEmpty(errorMessage)) { helpString = "\r\nError: " + errorMessage + "\r\n\r\n" + helpString; } Console.WriteLine(helpString); } } }
using System; using System.Collections.Generic; namespace LessMsi.Cli { internal class ShowHelpCommand : LessMsiCommand { public override void Run(List<string> args) { ShowHelp(""); } public static void ShowHelp(string errorMessage) { string helpString = @"Usage: lessmsi <command> [options] <msi_name> [<path_to_extract\>] [file_names] Commands: x Extracts all or specified files from the specified msi_name. l Lists the contents of the specified msi table as CSV to stdout. Table is specified with -t switch. Example: lessmsi l -t Component c:\foo.msi v Lists the value of the ProductVersion Property in the msi (typically this is the version of the MSI). o Opens the specified msi_name in the GUI. h Shows this help page. For more information see http://lessmsi.activescott.com "; if (!string.IsNullOrEmpty(errorMessage)) { helpString = "\r\nError: " + errorMessage + "\r\n\r\n" + helpString; } Console.WriteLine(helpString); } } }
Add help for -t switch
Add help for -t switch
C#
mit
activescott/lessmsi,activescott/lessmsi,pombredanne/lessmsi,activescott/lessmsi,pombredanne/lessmsi
c5b3bc1a0bb46f888292a130147e72bc7fac837b
Core/Handling/ContextMenuNotification.cs
Core/Handling/ContextMenuNotification.cs
using CefSharp; namespace TweetDck.Core.Handling{ class ContextMenuNotification : ContextMenuBase{ public override void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){ model.Clear(); base.OnBeforeContextMenu(browserControl,browser,frame,parameters,model); RemoveSeparatorIfLast(model); } public override bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags){ return false; } } }
using CefSharp; namespace TweetDck.Core.Handling{ class ContextMenuNotification : ContextMenuBase{ public override void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){ model.Clear(); base.OnBeforeContextMenu(browserControl,browser,frame,parameters,model); RemoveSeparatorIfLast(model); } } }
Fix context menu not running any actions in notification Form
Fix context menu not running any actions in notification Form
C#
mit
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
3552f4d6d19249804935b8a08a94bfc9d64fd8cb
MonoGameUtils/Properties/AssemblyInfo.cs
MonoGameUtils/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("MonoGameUtils")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MonoGameUtils")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4ecedc75-1f2d-4915-9efe-368a5d104e41")] // 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.4.0")] [assembly: AssemblyFileVersion("1.0.4.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("MonoGameUtils")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MonoGameUtils")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4ecedc75-1f2d-4915-9efe-368a5d104e41")] // 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.5.0")] [assembly: AssemblyFileVersion("1.0.5.0")]
Increment version number for new build.
Increment version number for new build.
C#
mit
dneelyep/MonoGameUtils
9de034a8eb0b5680e65dbac0df7270f98ebae3ea
Scripts/Interactions/CopyInteractions.cs
Scripts/Interactions/CopyInteractions.cs
using UnityEngine; namespace Pear.InteractionEngine.Interactions { /// <summary> /// Copies interactions from the current object to the supplied objects /// </summary> public class CopyInteractions: MonoBehaviour { [Tooltip("Objects that interactions will be copied to")] public GameObject[] CopyTo; private void Awake() { if (CopyTo != null) { //Copy alkl interactions from the current object to the specified object foreach (GameObject copyTo in CopyTo) Interaction.CopyAll(gameObject, copyTo); } } } }
using UnityEngine; namespace Pear.InteractionEngine.Interactions { /// <summary> /// Copies interactions from the current object to the supplied objects /// </summary> public class CopyInteractions: MonoBehaviour { [Tooltip("Objects that interactions will be copied to")] public GameObject[] CopyTo; [Tooltip("Objects that the interactions will be copied from")] public GameObject[] CopyFrom; private void Awake() { if (CopyTo != null) { // Copy all interactions from the current object to the specified object foreach (GameObject copyTo in CopyTo) Interaction.CopyAll(gameObject, copyTo); } if(CopyFrom != null) { // Copy all interactions from the specified objects to this game object foreach (GameObject copyFrom in CopyFrom) Interaction.CopyAll(copyFrom, gameObject); } } } }
Copy interactions from the given object
Copy interactions from the given object
C#
mit
PearMed/Pear-Interaction-Engine
9a81c1505872ea75094aba6135dc149b757721a4
WebEditor/WebEditor/Views/Create/New.cshtml
WebEditor/WebEditor/Views/Create/New.cshtml
@model WebEditor.Models.Create @{ ViewBag.Title = "New Game"; } @section scripts { <script src="@Url.Content("~/Scripts/GameNew.js")" type="text/javascript"></script> } @using (Html.BeginForm()) { @Html.ValidationSummary(true, "Unable to create game. Please correct the errors below.") <div> <div class="editor-label"> @Html.LabelFor(m => m.GameName) </div> <div class="editor-field"> @Html.TextBoxFor(m => m.GameName, new { style = "width: 300px" }) @Html.ValidationMessageFor(m => m.GameName) </div> <div class="editor-label"> @Html.LabelFor(m => m.SelectedType) </div> <div class="editor-field"> @Html.DropDownListFor(m => m.SelectedType, new SelectList(Model.AllTypes, Model.SelectedType)) @Html.ValidationMessageFor(m => m.SelectedType) </div> <div class="editor-label"> @Html.LabelFor(m => m.SelectedTemplate) </div> <div class="editor-field"> @Html.DropDownListFor(m => m.SelectedTemplate, new SelectList(Model.AllTemplates, Model.SelectedTemplate)) @Html.ValidationMessageFor(m => m.SelectedTemplate) </div> <p> <button id="submit-button" type="submit">Create</button> </p> </div> }
@model WebEditor.Models.Create @{ ViewBag.Title = "New Game"; } @section scripts { <script src="@Url.Content("~/Scripts/GameNew.js")" type="text/javascript"></script> } @using (Html.BeginForm()) { @Html.ValidationSummary(true, "Unable to create game. Please correct the errors below.") <div> <div class="editor-label"> @Html.LabelFor(m => m.GameName): </div> <div class="editor-field"> @Html.TextBoxFor(m => m.GameName, new { style = "width: 300px" }) @Html.ValidationMessageFor(m => m.GameName) </div> <div style="display: none"> <div class="editor-label"> @Html.LabelFor(m => m.SelectedType): </div> <div class="editor-field"> @Html.DropDownListFor(m => m.SelectedType, new SelectList(Model.AllTypes, Model.SelectedType)) @Html.ValidationMessageFor(m => m.SelectedType) </div> </div> <div class="editor-label"> @Html.LabelFor(m => m.SelectedTemplate): </div> <div class="editor-field"> @Html.DropDownListFor(m => m.SelectedTemplate, new SelectList(Model.AllTemplates, Model.SelectedTemplate)) @Html.ValidationMessageFor(m => m.SelectedTemplate) </div> <p> <button id="submit-button" type="submit">Create</button> </p> </div> }
Hide game type for now
Hide game type for now
C#
mit
textadventures/quest,siege918/quest,textadventures/quest,textadventures/quest,F2Andy/quest,F2Andy/quest,textadventures/quest,siege918/quest,F2Andy/quest,siege918/quest,siege918/quest
d9c7d7bcabd767844c67d08ff1488ad8927e88e1
StressMeasurementSystem/Models/Patient.cs
StressMeasurementSystem/Models/Patient.cs
using System.Net.Mail; namespace StressMeasurementSystem.Models { public class Patient { #region Structs public struct Name { public string Prefix { get; set; } public string First { get; set; } public string Middle { get; set; } public string Last { get; set; } public string Suffix { get; set; } } public struct Organization { public string Company { get; set; } public string JobTitle { get; set; } } public struct PhoneNumber { public enum Type {Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other} public string Number { get; set; } public Type T { get; set; } } public struct Email { public enum Type {Home, Work, Other} public MailAddress Address { get; set; } public Type T { get; set; } } #endregion #region Fields private Name _name; private uint _age; private Organization _organization; private PhoneNumber _phoneNumber; private Email _email; #endregion #region Constructors public Patient(Name name, uint age, Organization organization, PhoneNumber phoneNumber, Email email) { _name = name; _age = age; _organization = organization; _phoneNumber = phoneNumber; _email = email; } #endregion } }
using System.Collections.Generic; using System.Net.Mail; namespace StressMeasurementSystem.Models { public class Patient { #region Structs public struct Name { public string Prefix { get; set; } public string First { get; set; } public string Middle { get; set; } public string Last { get; set; } public string Suffix { get; set; } } public struct Organization { public string Company { get; set; } public string JobTitle { get; set; } } public struct PhoneNumber { public enum Type {Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other} public string Number { get; set; } public Type T { get; set; } } public struct Email { public enum Type {Home, Work, Other} public MailAddress Address { get; set; } public Type T { get; set; } } #endregion #region Fields private Name _name; private uint _age; private Organization _organization; private List<PhoneNumber> _phoneNumbers; private List<Email> _emails; #endregion #region Constructors public Patient(Name name, uint age, Organization organization, List<PhoneNumber> phoneNumbers, List<Email> emails) { _name = name; _age = age; _organization = organization; _phoneNumbers = phoneNumbers; _emails = emails; } #endregion } }
Allow for multiple phone numbers and email addresses
Allow for multiple phone numbers and email addresses
C#
apache-2.0
SICU-Stress-Measurement-System/frontend-cs
fc80404d84bb91797958bee6e66bb16c0856ffd7
src/Leeroy/Program.cs
src/Leeroy/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceProcess; using System.Text; namespace Leeroy { static class Program { /// <summary> /// The main entry point for the application. /// </summary> static void Main() { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service() }; ServiceBase.Run(ServicesToRun); } } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceProcess; using System.Text; using System.Threading; namespace Leeroy { static class Program { /// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { if (args.FirstOrDefault() == "/test") { Overseer overseer = new Overseer(new CancellationTokenSource().Token, "BradleyGrainger", "Configuration", "master"); overseer.Run(null); } else { ServiceBase.Run(new ServiceBase[] { new Service() }); } } } }
Allow debugging without running as a service.
Allow debugging without running as a service. Pass the "/test" command-line argument to run the program as a simple console app.
C#
mit
LogosBible/Leeroy
a0942260a92e8e39756007aa261bc34fc6d1e414
input/docs/getting-started/index.cshtml
input/docs/getting-started/index.cshtml
Order: 10 Description: Tutorials to get you up and running quickly RedirectFrom: - docs/overview - docs/overview/features --- @Html.Partial("_ChildPages")
Order: 10 Description: Tutorials to get you up and running quickly RedirectFrom: - docs/overview - docs/overview/features --- <div class="alert alert-info"> <p> See also <a href="/community/resources/">Community Resources</a> for a lot of helpful courses, videos, presentations and blog posts which can help you get started with Cake. </p> </div> @Html.Partial("_ChildPages")
Add link to resources to Getting Started guide
Add link to resources to Getting Started guide
C#
mit
cake-build/website,cake-build/website,cake-build/website
494feb1f4b9dc0e4d4bc09c77ac5223561e7a5a8
TextMatch/Properties/AssemblyInfo.cs
TextMatch/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("TextMatch")] [assembly: AssemblyDescription("A library for matching texts with Lucene query expressions")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TextMatch")] [assembly: AssemblyCopyright("Copyright © 2015 Cris Almodovar")] [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("2fe43f0a-b8c0-4de3-b2d5-6fc207385f7c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.7.0.0")] [assembly: AssemblyFileVersion("0.7.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("TextMatch")] [assembly: AssemblyDescription("A library for matching texts with Lucene query expressions")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TextMatch")] [assembly: AssemblyCopyright("Copyright © 2015 Cris Almodovar")] [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("2fe43f0a-b8c0-4de3-b2d5-6fc207385f7c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.6.5.0")] [assembly: AssemblyFileVersion("0.6.5.0")]
Change version number to 0.6.5
Change version number to 0.6.5
C#
apache-2.0
cris-almodovar/text-match
00e98b323415649b1d3cbadaf4a29e4e815a9beb
AudioWorks/tests/AudioWorks.Commands.Tests/ModuleFixture.cs
AudioWorks/tests/AudioWorks.Commands.Tests/ModuleFixture.cs
/* Copyright 2018 Jeremy Herbison This file is part of AudioWorks. AudioWorks is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. AudioWorks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with AudioWorks. If not, see <https://www.gnu.org/licenses/>. */ using System; using System.IO; using System.Management.Automation; using System.Management.Automation.Runspaces; using JetBrains.Annotations; namespace AudioWorks.Commands.Tests { [UsedImplicitly] public sealed class ModuleFixture : IDisposable { const string _moduleProject = "AudioWorks.Commands"; [NotNull] internal Runspace Runspace { get; } public ModuleFixture() { var state = InitialSessionState.CreateDefault(); // This bypasses the execution policy (InitialSessionState.ExecutionPolicy isn't available with PowerShell 5) state.AuthorizationManager = new AuthorizationManager("Microsoft.PowerShell"); state.ImportPSModule( Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).FullName, _moduleProject)); Runspace = RunspaceFactory.CreateRunspace(state); Runspace.Open(); } public void Dispose() { Runspace.Close(); } } }
/* Copyright 2018 Jeremy Herbison This file is part of AudioWorks. AudioWorks is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. AudioWorks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with AudioWorks. If not, see <https://www.gnu.org/licenses/>. */ using System; using System.IO; using System.Management.Automation; using System.Management.Automation.Runspaces; using JetBrains.Annotations; namespace AudioWorks.Commands.Tests { [UsedImplicitly] public sealed class ModuleFixture : IDisposable { const string _moduleProject = "AudioWorks.Commands"; [NotNull] internal Runspace Runspace { get; } public ModuleFixture() { var state = InitialSessionState.CreateDefault(); // This bypasses the execution policy (InitialSessionState.ExecutionPolicy isn't available with PowerShell 5) state.AuthorizationManager = new AuthorizationManager("Microsoft.PowerShell"); state.ImportPSModule(new[] { Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).FullName, _moduleProject) }); Runspace = RunspaceFactory.CreateRunspace(state); Runspace.Open(); } public void Dispose() { Runspace.Close(); } } }
Revert change that broke tests on Windows PowerShell.
Revert change that broke tests on Windows PowerShell.
C#
agpl-3.0
jherby2k/AudioWorks
423a759188c27b0857d03b9eb2e10f969d7d10b3
Cascara.Tests/Src/CascaraTestFramework.cs
Cascara.Tests/Src/CascaraTestFramework.cs
using Xunit.Abstractions; namespace Cascara.Tests { public abstract class CascaraTestFramework { public CascaraTestFramework(ITestOutputHelper output) { Output = output; } protected ITestOutputHelper Output { get; } } }
using System; using System.Xml.Linq; using Xunit.Abstractions; namespace Cascara.Tests { public abstract class CascaraTestFramework { protected static string BuildXmlElement(string name, params Tuple<string, string>[] attrs) { return BuildXmlElement(name, "", attrs); } protected static string BuildXmlElement(string name, string innerData, params Tuple<string, string>[] attrs) { string attrString = ""; foreach (Tuple<string, string> t in attrs) { attrString += string.Format(" {0}='{1}'", t.Item1, t.Item2); } return string.Format("<{0}{1}>{2}</{0}>", name, attrString, innerData); } protected static XElement ParseXmlElement(string data) { XDocument doc = XDocument.Parse(data, LoadOptions.SetLineInfo); return doc.Root; } public CascaraTestFramework(ITestOutputHelper output) { Output = output; } protected ITestOutputHelper Output { get; } } }
Add static methods for building XML data strings
Add static methods for building XML data strings
C#
mit
whampson/bft-spec,whampson/cascara
17a04f8ffe4f4e5918c2c590275a4c4734a16dc6
DesktopWidgets/Classes/IntroData.cs
DesktopWidgets/Classes/IntroData.cs
using System.ComponentModel; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; namespace DesktopWidgets.Classes { [ExpandableObject] [DisplayName("Intro Settings")] public class IntroData { [DisplayName("Duration")] public int Duration { get; set; } = -1; [DisplayName("Reversable")] public bool Reversable { get; set; } = false; [DisplayName("Activate")] public bool Activate { get; set; } = false; [DisplayName("Stay Open")] public bool HideOnFinish { get; set; } = true; [DisplayName("Execute Finish Action")] public bool ExecuteFinishAction { get; set; } = true; } }
using System.ComponentModel; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; namespace DesktopWidgets.Classes { [ExpandableObject] [DisplayName("Intro Settings")] public class IntroData { [DisplayName("Duration")] public int Duration { get; set; } = -1; [DisplayName("Reversable")] public bool Reversable { get; set; } = false; [DisplayName("Activate")] public bool Activate { get; set; } = false; [DisplayName("Hide On Finish")] public bool HideOnFinish { get; set; } = true; [DisplayName("Execute Finish Action")] public bool ExecuteFinishAction { get; set; } = true; } }
Fix intro settings "Hide On Finish" option name
Fix intro settings "Hide On Finish" option name
C#
apache-2.0
danielchalmers/DesktopWidgets
f9461f10a707a256cad729fbff6705df071ad01a
EncodingConverter/Logic/FileData.cs
EncodingConverter/Logic/FileData.cs
using IO = System.IO; namespace dokas.EncodingConverter.Logic { internal sealed class FileData { public string Path { get; private set; } public string Name { get; private set; } public string Extension { get; private set; } public FileData(string path) { Path = path; Name = IO.Path.GetFileName(path); Extension = IO.Path.GetExtension(path); } } }
using System; using IO = System.IO; namespace dokas.EncodingConverter.Logic { internal sealed class FileData { public string Path { get; private set; } public string Name { get; private set; } public string Extension { get; private set; } public FileData(string path) { if (path == null) { throw new ArgumentNullException("path"); } Path = path; Name = IO.Path.GetFileName(path); Extension = IO.Path.GetExtension(path); } public override bool Equals(object obj) { var otherFileData = obj as FileData; return otherFileData != null && Path.Equals(otherFileData.Path); } public override int GetHashCode() { return Path.GetHashCode(); } } }
Implement Equals/GetHashCode to comply with Distinct
Implement Equals/GetHashCode to comply with Distinct
C#
mit
MSayfullin/EncodingConverter
486b2c130e0a3398a2a6a810c561d5e4aa950a55
Kooboo.CMS/Kooboo.CMS.Web/Areas/Sites/Views/ABPageSetting/Edit.cshtml
Kooboo.CMS/Kooboo.CMS.Web/Areas/Sites/Views/ABPageSetting/Edit.cshtml
@model Kooboo.CMS.Sites.ABTest.ABPageSetting @using Kooboo.CMS.Sites.ABTest; @{ ViewBag.Title = "Edit A/B page setting"; Layout = "~/Views/Shared/Blank.cshtml"; } @section Panel{ <ul class="panel"> <li> <a data-ajaxform=""> @Html.IconImage("save") @("Save".Localize())</a> </li> <li> <a href="@ViewContext.RequestContext.GetRequestValue("return")"> @Html.IconImage("cancel") @("Back".Localize())</a> </li> </ul> } <div class="block common-form"> <h1 class="title">@ViewBag.Title</h1> @using (Html.BeginForm()) { @Html.ValidationSummary(true) <table> <tbody> @Html.DisplayFor(o => o.RuleName) @Html.HiddenFor(o => o.RuleName) @Html.DisplayFor(o => o.MainPage) @Html.EditorFor(o => o.Items) @Html.EditorFor(o => o.ABTestGoalPage, new { HtmlAttributes = new { @class = "medium" } }) </tbody> </table> } </div>
@model Kooboo.CMS.Sites.ABTest.ABPageSetting @using Kooboo.CMS.Sites.ABTest; @{ ViewBag.Title = "Edit A/B page setting"; Layout = "~/Views/Shared/Blank.cshtml"; } @section Panel{ <ul class="panel"> <li> <a data-ajaxform=""> @Html.IconImage("save") @("Save".Localize())</a> </li> <li> <a href="@ViewContext.RequestContext.GetRequestValue("return")"> @Html.IconImage("cancel") @("Back".Localize())</a> </li> </ul> } <div class="block common-form"> <h1 class="title">@ViewBag.Title</h1> @using (Html.BeginForm()) { @Html.ValidationSummary(true) <table> <tbody> @Html.EditorFor(o => o.RuleName) @Html.DisplayFor(o => o.MainPage) @Html.EditorFor(o => o.Items) @Html.EditorFor(o => o.ABTestGoalPage, new { HtmlAttributes = new { @class = "medium" } }) </tbody> </table> } </div>
Make available to change the rule when editing A/B page setting.
Make available to change the rule when editing A/B page setting.
C#
bsd-3-clause
andyshao/CMS,jtm789/CMS,techwareone/Kooboo-CMS,andyshao/CMS,lingxyd/CMS,Kooboo/CMS,jtm789/CMS,techwareone/Kooboo-CMS,andyshao/CMS,lingxyd/CMS,Kooboo/CMS,Kooboo/CMS,jtm789/CMS,techwareone/Kooboo-CMS,lingxyd/CMS
091b6c5993398cb836eee76389badd4697556544
src/MsgPack.Rpc/Rpc/ExceptionModifiers.cs
src/MsgPack.Rpc/Rpc/ExceptionModifiers.cs
#region -- License Terms -- // // MessagePack for CLI // // Copyright (C) 2010 FUJIWARA, Yusuke // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion -- License Terms -- using System; namespace MsgPack.Rpc { internal sealed class ExceptionModifiers { public static readonly ExceptionModifiers IsMatrioshkaInner = new ExceptionModifiers(); private ExceptionModifiers() { } } }
#region -- License Terms -- // // MessagePack for CLI // // Copyright (C) 2010 FUJIWARA, Yusuke // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion -- License Terms -- using System; namespace MsgPack.Rpc { internal static class ExceptionModifiers { public static readonly object IsMatrioshkaInner = String.Intern( typeof( ExceptionModifiers ).FullName + ".IsMatrioshkaInner" ); } }
Fix that the flag prevents serialization.
Fix that the flag prevents serialization.
C#
apache-2.0
yonglehou/msgpack-rpc-cli,yfakariya/msgpack-rpc-cli
739f80d2569ecc0ca213858af78b68590e79de7a
SlackUI/Handlers/BrowserRequestHandler.cs
SlackUI/Handlers/BrowserRequestHandler.cs
#region Copyright © 2014 Ricardo Amaral /* * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file. */ #endregion using CefSharp; namespace SlackUI { internal class BrowserRequestHandler : IRequestHandler { #region Public Methods public bool GetAuthCredentials(IWebBrowser browser, bool isProxy, string host, int port, string realm, string scheme, ref string username, ref string password) { // Let the Chromium web browser handle the event return false; } public ResourceHandler GetResourceHandler(IWebBrowser browser, IRequest request) { // Let the Chromium web browser handle the event return null; } public bool OnBeforeBrowse(IWebBrowser browser, IRequest request, bool isRedirect) { // Disable browser forward/back navigation with keyboard keys if(request.TransitionType == (TransitionType.Explicit | TransitionType.ForwardBack)) { return true; } // Let the Chromium web browser handle the event return false; } public bool OnBeforePluginLoad(IWebBrowser browser, string url, string policyUrl, IWebPluginInfo info) { // Let the Chromium web browser handle the event return false; } public bool OnBeforeResourceLoad(IWebBrowser browser, IRequest request, IResponse response) { // Let the Chromium web browser handle the event return false; } public void OnPluginCrashed(IWebBrowser browser, string pluginPath) { // No implementation required } public void OnRenderProcessTerminated(IWebBrowser browser, CefTerminationStatus status) { // No implementation required } #endregion } }
#region Copyright © 2014 Ricardo Amaral /* * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file. */ #endregion using CefSharp; namespace SlackUI { internal class BrowserRequestHandler : IRequestHandler { #region Public Methods public bool GetAuthCredentials(IWebBrowser browser, bool isProxy, string host, int port, string realm, string scheme, ref string username, ref string password) { // Let the Chromium web browser handle the event return false; } public ResourceHandler GetResourceHandler(IWebBrowser browser, IRequest request) { // Let the Chromium web browser handle the event return null; } public bool OnBeforeBrowse(IWebBrowser browser, IRequest request, bool isRedirect) { // Disable browser forward/back navigation with keyboard keys if((request.TransitionType & TransitionType.ForwardBack) != 0) { return true; } // Let the Chromium web browser handle the event return false; } public bool OnBeforePluginLoad(IWebBrowser browser, string url, string policyUrl, IWebPluginInfo info) { // Let the Chromium web browser handle the event return false; } public bool OnBeforeResourceLoad(IWebBrowser browser, IRequest request, IResponse response) { // Let the Chromium web browser handle the event return false; } public void OnPluginCrashed(IWebBrowser browser, string pluginPath) { // No implementation required } public void OnRenderProcessTerminated(IWebBrowser browser, CefTerminationStatus status) { // No implementation required } #endregion } }
Cover ALL forward/back navigation cases
Cover ALL forward/back navigation cases
C#
mit
rfgamaral/SlackUI
1b1021ed216e70dceaeada9c0721780189ca9a34
StressMeasurementSystem/Models/Patient.cs
StressMeasurementSystem/Models/Patient.cs
using System; using System.Collections.Generic; using System.Net.Mail; namespace StressMeasurementSystem.Models { public class Patient { #region Structs public struct Name { public string Prefix { get; set; } public string First { get; set; } public string Middle { get; set; } public string Last { get; set; } public string Suffix { get; set; } } public struct Organization { public string Company { get; set; } public string JobTitle { get; set; } } public struct PhoneNumber { public enum Type { Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other } public string Number { get; set; } public Type T { get; set; } } public struct Email { public enum Type { Home, Work, Other } public MailAddress Address { get; set; } public Type T { get; set; } } #endregion #region Fields private Name? _name; private DateTime _dateOfBirth; private Organization? _organization; private List<PhoneNumber> _phoneNumbers; private List<Email> _emails; #endregion #region Constructors public Patient(Name? name, DateTime dateOfBirth, Organization? organization, List<PhoneNumber> phoneNumbers, List<Email> emails) { _name = name; _dateOfBirth = dateOfBirth; _organization = organization; _phoneNumbers = phoneNumbers; _emails = emails; } #endregion } }
using System; using System.Collections.Generic; using System.Net.Mail; namespace StressMeasurementSystem.Models { public class Patient { #region Structs public struct Name { public string Prefix { get; set; } public string First { get; set; } public string Middle { get; set; } public string Last { get; set; } public string Suffix { get; set; } } public struct Organization { public string Company { get; set; } public string JobTitle { get; set; } } public struct PhoneNumber { public enum Type { Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other } public string Number { get; set; } public Type T { get; set; } } public struct EmailAddress { public enum Type { Home, Work, Other } public MailAddress Address { get; set; } public Type T { get; set; } } #endregion #region Fields private Name? _name; private DateTime _dateOfBirth; private Organization? _organization; private List<PhoneNumber> _phoneNumbers; private List<EmailAddress> _emailAddresses; #endregion #region Constructors public Patient(Name? name, DateTime dateOfBirth, Organization? organization, List<PhoneNumber> phoneNumbers, List<EmailAddress> emailAddresses) { _name = name; _dateOfBirth = dateOfBirth; _organization = organization; _phoneNumbers = phoneNumbers; _emailAddresses = emailAddresses; } #endregion } }
Rename Email struct as EmailAddress; refactor as appropriate
Rename Email struct as EmailAddress; refactor as appropriate
C#
apache-2.0
SICU-Stress-Measurement-System/frontend-cs
e2ffaa2f82fca9b15e7426e28df61c61423e27b4
src/Stripe.net/Properties/InternalsVisibleTo.cs
src/Stripe.net/Properties/InternalsVisibleTo.cs
using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("StripeTests")]
using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Newtonsoft.Json")] [assembly: InternalsVisibleTo("StripeTests")]
Make internals visible to Newtonsoft.Json
Make internals visible to Newtonsoft.Json
C#
apache-2.0
richardlawley/stripe.net,stripe/stripe-dotnet
a59b892eba0cd9083f9ea461b0a2fc6924c8f4ee
src/WebApp/HomeModule.cs
src/WebApp/HomeModule.cs
using Dolstagis.Web; using Dolstagis.Web.Sessions; namespace WebApp { public class HomeModule : Module { public HomeModule() { Services.For<ISessionStore>().Singleton().Use<InMemorySessionStore>(); AddStaticFiles("~/content"); AddViews("~/views"); AddViews("~/errors"); AddHandler<Index>(); } } }
using Dolstagis.Web; using Dolstagis.Web.Sessions; namespace WebApp { public class HomeModule : Module { public HomeModule() { Services.For<ISessionStore>().Singleton().Use<InMemorySessionStore>(); AddStaticFiles("~/content"); AddViews("~/views"); // Uncomment the following line to use custom error messages. // AddViews("~/errors"); AddHandler<Index>(); } } }
Use default error messages in demo app.
Use default error messages in demo app.
C#
mit
jammycakes/dolstagis.web,jammycakes/dolstagis.web,jammycakes/dolstagis.web
a082b6468b05e8abfffc25951dca128e46353d9d
src/DelegateDecompiler.Tests/EnumTests.cs
src/DelegateDecompiler.Tests/EnumTests.cs
using System; using System.Linq.Expressions; using Xunit; namespace DelegateDecompiler.Tests { public class EnumTests : DecompilerTestsBase { public enum TestEnum { Foo, Bar } [Fact] public void TestEnumParameterEqualsEnumConstant() { Expression<Func<TestEnum, bool>> expected = x => x == TestEnum.Bar; Func<TestEnum, bool> compiled = x => x == TestEnum.Bar; Test(expected, compiled); } [Fact] public void TestEnumConstantEqualsEnumParameter() { Expression<Func<TestEnum, bool>> expected = x => TestEnum.Bar == x; Func<TestEnum, bool> compiled = x => TestEnum.Bar == x; Test(expected, compiled); } } }
using System; using System.Linq.Expressions; using Xunit; namespace DelegateDecompiler.Tests { public class EnumTests : DecompilerTestsBase { public enum TestEnum { Foo, Bar } [Fact] public void TestEnumParameterEqualsEnumConstant() { Expression<Func<TestEnum, bool>> expected = x => x == TestEnum.Bar; Func<TestEnum, bool> compiled = x => x == TestEnum.Bar; Test(expected, compiled); } [Fact] public void TestEnumConstantEqualsEnumParameter() { Expression<Func<TestEnum, bool>> expected = x => TestEnum.Bar == x; Func<TestEnum, bool> compiled = x => TestEnum.Bar == x; Test(expected, compiled); } [Fact] public void TestEnumParametersEqual() { Expression<Func<TestEnum, TestEnum, bool>> expected = (x, y) => x == y; Func<TestEnum, TestEnum, bool> compiled = (x, y) => x == y; Test(expected, compiled); } [Fact(Skip = "Needs optimization")] public void TestEnumParameterNotEqualsEnumConstant() { Expression<Func<TestEnum, bool>> expected = x => x != TestEnum.Bar; Func<TestEnum, bool> compiled = x => x != TestEnum.Bar; Test(expected, compiled); } [Fact(Skip = "Needs optimization")] public void TestEnumConstantNotEqualsEnumParameter() { Expression<Func<TestEnum, bool>> expected = x => TestEnum.Bar != x; Func<TestEnum, bool> compiled = x => TestEnum.Bar != x; Test(expected, compiled); } [Fact(Skip = "Needs optimization")] public void TestEnumParametersNotEqual() { Expression<Func<TestEnum, TestEnum, bool>> expected = (x, y) => x != y; Func<TestEnum, TestEnum, bool> compiled = (x, y) => x != y; Test(expected, compiled); } } }
Add more tests for enums
Add more tests for enums
C#
mit
jaenyph/DelegateDecompiler,morgen2009/DelegateDecompiler,hazzik/DelegateDecompiler
72aa394aaf543fc42cb68bf35eb2554d0593b5cd
src/GuardClauses.UnitTests/GuardAgainsOutOfRange.cs
src/GuardClauses.UnitTests/GuardAgainsOutOfRange.cs
using Ardalis.GuardClauses; using System; using Xunit; namespace GuardClauses.UnitTests { public class GuardAgainsOutOfRange { [Fact] public void DoesNothingGivenInRangeValueUsingShortcutMethod() { Guard.AgainsOutOfRange(2, "index", 1, 5); } [Fact] public void DoesNothingGivenInRangeValueUsingExtensionMethod() { Guard.Against.OutOfRange(2, "index", 1, 5); } [Fact] public void ThrowsGivenOutOfRangeValueUsingShortcutMethod() { Assert.Throws<ArgumentOutOfRangeException>(() => Guard.AgainsOutOfRange(5, "index", 1, 4)); } [Fact] public void ThrowsGivenOutOfRangeValueUsingExtensionMethod() { Assert.Throws<ArgumentOutOfRangeException>(() => Guard.Against.OutOfRange(5, "index", 1, 4)); } } }
using Ardalis.GuardClauses; using System; using Xunit; namespace GuardClauses.UnitTests { public class GuardAgainsOutOfRange { [Theory] [InlineData(1, 1, 5)] [InlineData(2, 1, 5)] [InlineData(3, 1, 5)] public void DoesNothingGivenInRangeValueUsingShortcutMethod(int input, int rangeFrom, int rangeTo) { Guard.AgainsOutOfRange(input, "index", rangeFrom, rangeTo); } [Theory] [InlineData(1, 1, 5)] [InlineData(2, 1, 5)] [InlineData(3, 1, 5)] public void DoesNothingGivenInRangeValueUsingExtensionMethod(int input, int rangeFrom, int rangeTo) { Guard.Against.OutOfRange(input, "index", rangeFrom, rangeTo); } [Theory] [InlineData(-1, 1, 5)] [InlineData(0, 1, 5)] [InlineData(6, 1, 5)] public void ThrowsGivenOutOfRangeValueUsingShortcutMethod(int input, int rangeFrom, int rangeTo) { Assert.Throws<ArgumentOutOfRangeException>(() => Guard.AgainsOutOfRange(input, "index", rangeFrom, rangeTo)); } [Theory] [InlineData(-1, 1, 5)] [InlineData(0, 1, 5)] [InlineData(6, 1, 5)] public void ThrowsGivenOutOfRangeValueUsingExtensionMethod(int input, int rangeFrom, int rangeTo) { Assert.Throws<ArgumentOutOfRangeException>(() => Guard.Against.OutOfRange(input, "index", rangeFrom, rangeTo)); } } }
Improve tests with theory test cases
Improve tests with theory test cases
C#
mit
ardalis/GuardClauses
d462cfc4601c77460a7cc02dbcb50ccb2f3cc3ed
src/Nancy.Owin.Tests/AppBuilderExtensionsFixture.cs
src/Nancy.Owin.Tests/AppBuilderExtensionsFixture.cs
namespace Nancy.Owin.Tests { using System; using global::Owin; using Microsoft.Owin.Testing; using Nancy.Testing; using Xunit; public class AppBuilderExtensionsFixture { /*[Fact] public void When_host_Nancy_via_IAppBuilder_then_should_handle_requests() { // Given var bootstrapper = new ConfigurableBootstrapper(config => config.Module<TestModule>()); using(var server = TestServer.Create(app => app.UseNancy(opts => opts.Bootstrapper = bootstrapper))) { // When var response = server.HttpClient.GetAsync(new Uri("http://localhost/")).Result; // Then Assert.Equal(response.StatusCode, System.Net.HttpStatusCode.OK); } }*/ public class TestModule : NancyModule { public TestModule() { Get["/"] = _ => HttpStatusCode.OK; } } } }
namespace Nancy.Owin.Tests { using System; using global::Owin; using Microsoft.Owin.Testing; using Nancy.Testing; using Xunit; public class AppBuilderExtensionsFixture { #if !__MonoCS__ [Fact] public void When_host_Nancy_via_IAppBuilder_then_should_handle_requests() { // Given var bootstrapper = new ConfigurableBootstrapper(config => config.Module<TestModule>()); using(var server = TestServer.Create(app => app.UseNancy(opts => opts.Bootstrapper = bootstrapper))) { // When var response = server.HttpClient.GetAsync(new Uri("http://localhost/")).Result; // Then Assert.Equal(response.StatusCode, System.Net.HttpStatusCode.OK); } } #endif public class TestModule : NancyModule { public TestModule() { Get["/"] = _ => HttpStatusCode.OK; } } } }
Exclude AppBuilder test from running on Mono.
Exclude AppBuilder test from running on Mono.
C#
mit
damianh/Nancy,tparnell8/Nancy,SaveTrees/Nancy,wtilton/Nancy,AlexPuiu/Nancy,guodf/Nancy,albertjan/Nancy,nicklv/Nancy,horsdal/Nancy,VQComms/Nancy,SaveTrees/Nancy,grumpydev/Nancy,EliotJones/NancyTest,hitesh97/Nancy,tsdl2013/Nancy,joebuschmann/Nancy,thecodejunkie/Nancy,danbarua/Nancy,blairconrad/Nancy,daniellor/Nancy,tsdl2013/Nancy,asbjornu/Nancy,jeff-pang/Nancy,jmptrader/Nancy,MetSystem/Nancy,jongleur1983/Nancy,felipeleusin/Nancy,jonathanfoster/Nancy,AIexandr/Nancy,tsdl2013/Nancy,davidallyoung/Nancy,AlexPuiu/Nancy,cgourlay/Nancy,EliotJones/NancyTest,khellang/Nancy,jeff-pang/Nancy,dbabox/Nancy,adamhathcock/Nancy,sroylance/Nancy,charleypeng/Nancy,sloncho/Nancy,JoeStead/Nancy,malikdiarra/Nancy,NancyFx/Nancy,murador/Nancy,guodf/Nancy,Novakov/Nancy,danbarua/Nancy,jongleur1983/Nancy,guodf/Nancy,joebuschmann/Nancy,jchannon/Nancy,JoeStead/Nancy,Worthaboutapig/Nancy,AIexandr/Nancy,lijunle/Nancy,VQComms/Nancy,cgourlay/Nancy,albertjan/Nancy,wtilton/Nancy,EIrwin/Nancy,tparnell8/Nancy,jmptrader/Nancy,jmptrader/Nancy,damianh/Nancy,EliotJones/NancyTest,adamhathcock/Nancy,asbjornu/Nancy,blairconrad/Nancy,joebuschmann/Nancy,murador/Nancy,adamhathcock/Nancy,AcklenAvenue/Nancy,sroylance/Nancy,wtilton/Nancy,dbolkensteyn/Nancy,VQComms/Nancy,sroylance/Nancy,nicklv/Nancy,phillip-haydon/Nancy,felipeleusin/Nancy,felipeleusin/Nancy,ayoung/Nancy,asbjornu/Nancy,sroylance/Nancy,duszekmestre/Nancy,guodf/Nancy,malikdiarra/Nancy,MetSystem/Nancy,thecodejunkie/Nancy,SaveTrees/Nancy,grumpydev/Nancy,EIrwin/Nancy,vladlopes/Nancy,jongleur1983/Nancy,NancyFx/Nancy,rudygt/Nancy,daniellor/Nancy,SaveTrees/Nancy,EIrwin/Nancy,malikdiarra/Nancy,AIexandr/Nancy,anton-gogolev/Nancy,joebuschmann/Nancy,jchannon/Nancy,charleypeng/Nancy,JoeStead/Nancy,lijunle/Nancy,jchannon/Nancy,blairconrad/Nancy,Worthaboutapig/Nancy,rudygt/Nancy,tareq-s/Nancy,xt0rted/Nancy,grumpydev/Nancy,Worthaboutapig/Nancy,khellang/Nancy,daniellor/Nancy,davidallyoung/Nancy,khellang/Nancy,NancyFx/Nancy,fly19890211/Nancy,xt0rted/Nancy,rudygt/Nancy,sloncho/Nancy,ccellar/Nancy,davidallyoung/Nancy,vladlopes/Nancy,NancyFx/Nancy,ccellar/Nancy,duszekmestre/Nancy,sadiqhirani/Nancy,dbabox/Nancy,danbarua/Nancy,AcklenAvenue/Nancy,blairconrad/Nancy,AIexandr/Nancy,danbarua/Nancy,jonathanfoster/Nancy,phillip-haydon/Nancy,jeff-pang/Nancy,sadiqhirani/Nancy,tparnell8/Nancy,thecodejunkie/Nancy,Novakov/Nancy,cgourlay/Nancy,AlexPuiu/Nancy,duszekmestre/Nancy,tareq-s/Nancy,jeff-pang/Nancy,lijunle/Nancy,hitesh97/Nancy,dbabox/Nancy,ccellar/Nancy,khellang/Nancy,xt0rted/Nancy,jchannon/Nancy,phillip-haydon/Nancy,charleypeng/Nancy,davidallyoung/Nancy,MetSystem/Nancy,tparnell8/Nancy,sloncho/Nancy,EliotJones/NancyTest,horsdal/Nancy,horsdal/Nancy,dbolkensteyn/Nancy,ayoung/Nancy,xt0rted/Nancy,duszekmestre/Nancy,ayoung/Nancy,murador/Nancy,ayoung/Nancy,charleypeng/Nancy,phillip-haydon/Nancy,Novakov/Nancy,Worthaboutapig/Nancy,fly19890211/Nancy,dbolkensteyn/Nancy,dbabox/Nancy,murador/Nancy,VQComms/Nancy,MetSystem/Nancy,wtilton/Nancy,anton-gogolev/Nancy,nicklv/Nancy,AIexandr/Nancy,rudygt/Nancy,sadiqhirani/Nancy,Crisfole/Nancy,davidallyoung/Nancy,daniellor/Nancy,asbjornu/Nancy,tareq-s/Nancy,vladlopes/Nancy,JoeStead/Nancy,AlexPuiu/Nancy,jonathanfoster/Nancy,AcklenAvenue/Nancy,EIrwin/Nancy,thecodejunkie/Nancy,fly19890211/Nancy,sadiqhirani/Nancy,adamhathcock/Nancy,albertjan/Nancy,albertjan/Nancy,malikdiarra/Nancy,tareq-s/Nancy,asbjornu/Nancy,jmptrader/Nancy,jonathanfoster/Nancy,lijunle/Nancy,anton-gogolev/Nancy,VQComms/Nancy,AcklenAvenue/Nancy,Novakov/Nancy,sloncho/Nancy,nicklv/Nancy,Crisfole/Nancy,jchannon/Nancy,Crisfole/Nancy,damianh/Nancy,hitesh97/Nancy,ccellar/Nancy,vladlopes/Nancy,cgourlay/Nancy,fly19890211/Nancy,dbolkensteyn/Nancy,charleypeng/Nancy,horsdal/Nancy,grumpydev/Nancy,felipeleusin/Nancy,tsdl2013/Nancy,jongleur1983/Nancy,hitesh97/Nancy,anton-gogolev/Nancy
c499bba4064673d3f0170475cb6450a8dba51eeb
librato4net/AppSettingsLibratoSettings.cs
librato4net/AppSettingsLibratoSettings.cs
using System; using System.Configuration; namespace librato4net { public class AppSettingsLibratoSettings : ILibratoSettings { // ReSharper disable once InconsistentNaming private static readonly AppSettingsLibratoSettings settings = new AppSettingsLibratoSettings(); private const string DefaultApiEndPoint = "https://metrics-api.librato.com/v1/"; public static AppSettingsLibratoSettings Settings { get { return settings; } } public string Username { get { return ConfigurationManager.AppSettings["Librato.Username"]; } } public string ApiKey { get { return ConfigurationManager.AppSettings["Librato.ApiKey"]; } } public Uri ApiEndpoint { get { return new Uri(ConfigurationManager.AppSettings["Librato.ApiEndpoint"] ?? DefaultApiEndPoint); } } public TimeSpan SendInterval { get { return TimeSpan.Parse(ConfigurationManager.AppSettings["Librato.SendInterval"] ?? "00:00:05"); } } } }
using System; using System.Configuration; namespace librato4net { public class AppSettingsLibratoSettings : ILibratoSettings { // ReSharper disable once InconsistentNaming private static readonly AppSettingsLibratoSettings settings = new AppSettingsLibratoSettings(); private const string DefaultApiEndPoint = "https://metrics-api.librato.com/v1/"; public static AppSettingsLibratoSettings Settings { get { return settings; } } public string Username { get { var username = ConfigurationManager.AppSettings["Librato.Username"]; if (string.IsNullOrEmpty(username)) { throw new ConfigurationErrorsException("Librato.Username is required and cannot be empty"); } return username; } } public string ApiKey { get { var apiKey = ConfigurationManager.AppSettings["Librato.ApiKey"]; if (string.IsNullOrEmpty(apiKey)) { throw new ConfigurationErrorsException("Librato.ApiKey is required and cannot be empty"); } return apiKey; } } public Uri ApiEndpoint { get { return new Uri(ConfigurationManager.AppSettings["Librato.ApiEndpoint"] ?? DefaultApiEndPoint); } } public TimeSpan SendInterval { get { return TimeSpan.Parse(ConfigurationManager.AppSettings["Librato.SendInterval"] ?? "00:00:05"); } } } }
Validate Username and ApiKey from appSettings.
Validate Username and ApiKey from appSettings.
C#
mit
plmwong/librato4net
0d7aa868bb99a09c325b41e2e96f6a131b91d694
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 Width / 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
e57555304c025dc2a4653c45adc79fb109063447
src/Common/src/System/Diagnostics/ExceptionExtensions.cs
src/Common/src/System/Diagnostics/ExceptionExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace System.Diagnostics { /// <summary>Provides a set of static methods for working with Exceptions.</summary> internal static class ExceptionHelpers { public static TException InitializeStackTrace<TException>(this TException e) where TException : Exception { Debug.Assert(e != null); Debug.Assert(e.StackTrace == null); try { throw e; } catch { return e; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace System.Diagnostics { /// <summary>Provides a set of static methods for working with Exceptions.</summary> internal static class ExceptionHelpers { public static TException InitializeStackTrace<TException>(this TException e) where TException : Exception { Debug.Assert(e != null); // Ideally we'd be able to populate e.StackTrace with the current stack trace. // We could throw the exception and catch it, but the populated StackTrace would // not extend beyond this frame. Instead, we grab a stack trace and store it into // the exception's data dictionary, at least making the info available for debugging, // albeit not part of the string returned by e.ToString() or e.StackTrace. e.Data["StackTrace"] = Environment.StackTrace; return e; } } }
Change InitializeStackTrace helper to store trace in Data
Change InitializeStackTrace helper to store trace in Data My previous attempt to get a better stack trace in exceptions was insufficient. I was throwing/catching the exception to initialize the StackTrace, but I neglected the fact that the stack trace is filled in as the exception propagates, and so throwing/catching in the same frame means that the stack trace just stores that one frame, which isn't helpful. Instead, this changes the helper to store the stack trace obtained via Environment.StackTrace into the Exception's Data dictionary. This means the exception doesn't show up in a e.ToString() or e.StackTrace rendering, but it's at least stored for debugging purposes.
C#
mit
mmitche/corefx,seanshpark/corefx,twsouthwick/corefx,mmitche/corefx,stone-li/corefx,khdang/corefx,jlin177/corefx,tijoytom/corefx,Priya91/corefx-1,JosephTremoulet/corefx,zhenlan/corefx,jlin177/corefx,alphonsekurian/corefx,nbarbettini/corefx,ellismg/corefx,ViktorHofer/corefx,richlander/corefx,manu-silicon/corefx,MaggieTsang/corefx,richlander/corefx,MaggieTsang/corefx,elijah6/corefx,iamjasonp/corefx,ravimeda/corefx,tstringer/corefx,MaggieTsang/corefx,ravimeda/corefx,jlin177/corefx,Ermiar/corefx,stone-li/corefx,MaggieTsang/corefx,alphonsekurian/corefx,stephenmichaelf/corefx,lggomez/corefx,nchikanov/corefx,dsplaisted/corefx,shmao/corefx,rjxby/corefx,tstringer/corefx,Jiayili1/corefx,iamjasonp/corefx,ptoonen/corefx,gkhanna79/corefx,parjong/corefx,jlin177/corefx,YoupHulsebos/corefx,weltkante/corefx,weltkante/corefx,parjong/corefx,mmitche/corefx,iamjasonp/corefx,yizhang82/corefx,shmao/corefx,cartermp/corefx,wtgodbe/corefx,the-dwyer/corefx,ericstj/corefx,manu-silicon/corefx,marksmeltzer/corefx,ptoonen/corefx,alexperovich/corefx,nchikanov/corefx,MaggieTsang/corefx,richlander/corefx,jhendrixMSFT/corefx,khdang/corefx,manu-silicon/corefx,cartermp/corefx,mazong1123/corefx,jlin177/corefx,Chrisboh/corefx,nbarbettini/corefx,BrennanConroy/corefx,zhenlan/corefx,DnlHarvey/corefx,shimingsg/corefx,axelheer/corefx,axelheer/corefx,billwert/corefx,mmitche/corefx,ellismg/corefx,krk/corefx,rubo/corefx,parjong/corefx,dhoehna/corefx,nbarbettini/corefx,fgreinacher/corefx,rjxby/corefx,nchikanov/corefx,tijoytom/corefx,rjxby/corefx,seanshpark/corefx,zhenlan/corefx,tijoytom/corefx,jhendrixMSFT/corefx,marksmeltzer/corefx,twsouthwick/corefx,rjxby/corefx,ViktorHofer/corefx,ravimeda/corefx,wtgodbe/corefx,rahku/corefx,zhenlan/corefx,rahku/corefx,nchikanov/corefx,dotnet-bot/corefx,yizhang82/corefx,jhendrixMSFT/corefx,mazong1123/corefx,nchikanov/corefx,parjong/corefx,jlin177/corefx,gkhanna79/corefx,ellismg/corefx,alphonsekurian/corefx,adamralph/corefx,yizhang82/corefx,tstringer/corefx,ptoonen/corefx,gkhanna79/corefx,JosephTremoulet/corefx,Ermiar/corefx,manu-silicon/corefx,lggomez/corefx,billwert/corefx,stone-li/corefx,ericstj/corefx,dhoehna/corefx,weltkante/corefx,dhoehna/corefx,dotnet-bot/corefx,axelheer/corefx,billwert/corefx,ViktorHofer/corefx,krytarowski/corefx,shmao/corefx,tijoytom/corefx,wtgodbe/corefx,SGuyGe/corefx,ptoonen/corefx,dhoehna/corefx,ViktorHofer/corefx,Priya91/corefx-1,fgreinacher/corefx,Ermiar/corefx,fgreinacher/corefx,ptoonen/corefx,lggomez/corefx,JosephTremoulet/corefx,axelheer/corefx,twsouthwick/corefx,ericstj/corefx,wtgodbe/corefx,the-dwyer/corefx,marksmeltzer/corefx,khdang/corefx,rjxby/corefx,richlander/corefx,richlander/corefx,rubo/corefx,ravimeda/corefx,krk/corefx,richlander/corefx,weltkante/corefx,stephenmichaelf/corefx,rubo/corefx,lggomez/corefx,stone-li/corefx,SGuyGe/corefx,zhenlan/corefx,ericstj/corefx,billwert/corefx,alexperovich/corefx,dhoehna/corefx,weltkante/corefx,jhendrixMSFT/corefx,seanshpark/corefx,the-dwyer/corefx,krytarowski/corefx,krk/corefx,Jiayili1/corefx,shmao/corefx,rjxby/corefx,dhoehna/corefx,seanshpark/corefx,shimingsg/corefx,tstringer/corefx,lggomez/corefx,shimingsg/corefx,wtgodbe/corefx,cartermp/corefx,nbarbettini/corefx,YoupHulsebos/corefx,alexperovich/corefx,rahku/corefx,twsouthwick/corefx,jhendrixMSFT/corefx,elijah6/corefx,alexperovich/corefx,cartermp/corefx,Ermiar/corefx,Ermiar/corefx,khdang/corefx,wtgodbe/corefx,ptoonen/corefx,Priya91/corefx-1,manu-silicon/corefx,krytarowski/corefx,alexperovich/corefx,alphonsekurian/corefx,wtgodbe/corefx,weltkante/corefx,ellismg/corefx,billwert/corefx,lggomez/corefx,Jiayili1/corefx,parjong/corefx,mazong1123/corefx,rahku/corefx,khdang/corefx,fgreinacher/corefx,rahku/corefx,shmao/corefx,Ermiar/corefx,Chrisboh/corefx,manu-silicon/corefx,mmitche/corefx,lggomez/corefx,ViktorHofer/corefx,jhendrixMSFT/corefx,alexperovich/corefx,krk/corefx,yizhang82/corefx,rjxby/corefx,Petermarcu/corefx,iamjasonp/corefx,stephenmichaelf/corefx,JosephTremoulet/corefx,rubo/corefx,alexperovich/corefx,cydhaselton/corefx,marksmeltzer/corefx,krk/corefx,krk/corefx,krytarowski/corefx,billwert/corefx,marksmeltzer/corefx,krytarowski/corefx,YoupHulsebos/corefx,Jiayili1/corefx,iamjasonp/corefx,jlin177/corefx,Jiayili1/corefx,stone-li/corefx,iamjasonp/corefx,ptoonen/corefx,BrennanConroy/corefx,khdang/corefx,krk/corefx,ViktorHofer/corefx,axelheer/corefx,mmitche/corefx,ravimeda/corefx,cydhaselton/corefx,dsplaisted/corefx,cydhaselton/corefx,nchikanov/corefx,billwert/corefx,cydhaselton/corefx,DnlHarvey/corefx,the-dwyer/corefx,richlander/corefx,YoupHulsebos/corefx,rahku/corefx,twsouthwick/corefx,mazong1123/corefx,elijah6/corefx,stephenmichaelf/corefx,the-dwyer/corefx,mazong1123/corefx,Petermarcu/corefx,tijoytom/corefx,shimingsg/corefx,ravimeda/corefx,marksmeltzer/corefx,Petermarcu/corefx,DnlHarvey/corefx,MaggieTsang/corefx,Ermiar/corefx,tstringer/corefx,nchikanov/corefx,YoupHulsebos/corefx,ericstj/corefx,seanshpark/corefx,SGuyGe/corefx,Chrisboh/corefx,the-dwyer/corefx,tstringer/corefx,shimingsg/corefx,mazong1123/corefx,krytarowski/corefx,nbarbettini/corefx,gkhanna79/corefx,tijoytom/corefx,cydhaselton/corefx,marksmeltzer/corefx,ericstj/corefx,Petermarcu/corefx,cartermp/corefx,dotnet-bot/corefx,Petermarcu/corefx,shmao/corefx,twsouthwick/corefx,DnlHarvey/corefx,DnlHarvey/corefx,ravimeda/corefx,rubo/corefx,YoupHulsebos/corefx,nbarbettini/corefx,elijah6/corefx,parjong/corefx,twsouthwick/corefx,Jiayili1/corefx,YoupHulsebos/corefx,seanshpark/corefx,Petermarcu/corefx,Petermarcu/corefx,SGuyGe/corefx,gkhanna79/corefx,gkhanna79/corefx,dotnet-bot/corefx,yizhang82/corefx,MaggieTsang/corefx,adamralph/corefx,JosephTremoulet/corefx,stone-li/corefx,dotnet-bot/corefx,dotnet-bot/corefx,zhenlan/corefx,alphonsekurian/corefx,Jiayili1/corefx,stephenmichaelf/corefx,ViktorHofer/corefx,shimingsg/corefx,Priya91/corefx-1,ellismg/corefx,stephenmichaelf/corefx,mmitche/corefx,adamralph/corefx,yizhang82/corefx,DnlHarvey/corefx,weltkante/corefx,Priya91/corefx-1,ericstj/corefx,jhendrixMSFT/corefx,shimingsg/corefx,gkhanna79/corefx,rahku/corefx,shmao/corefx,krytarowski/corefx,BrennanConroy/corefx,ellismg/corefx,stone-li/corefx,dotnet-bot/corefx,Chrisboh/corefx,seanshpark/corefx,SGuyGe/corefx,cydhaselton/corefx,zhenlan/corefx,manu-silicon/corefx,elijah6/corefx,dsplaisted/corefx,cartermp/corefx,parjong/corefx,JosephTremoulet/corefx,elijah6/corefx,axelheer/corefx,Priya91/corefx-1,Chrisboh/corefx,yizhang82/corefx,the-dwyer/corefx,mazong1123/corefx,JosephTremoulet/corefx,iamjasonp/corefx,DnlHarvey/corefx,alphonsekurian/corefx,Chrisboh/corefx,SGuyGe/corefx,tijoytom/corefx,cydhaselton/corefx,dhoehna/corefx,alphonsekurian/corefx,nbarbettini/corefx,elijah6/corefx,stephenmichaelf/corefx
c379e93614d5e429565d780be876873d90116e41
Battery-Commander.Web/Controllers/AdminController.cs
Battery-Commander.Web/Controllers/AdminController.cs
using BatteryCommander.Web.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System; namespace BatteryCommander.Web.Controllers { [Authorize, ApiExplorerSettings(IgnoreApi = true)] public class AdminController : Controller { // Admin Tasks: // Add/Remove Users // Backup SQLite Db // Scrub Soldier Data private readonly Database db; public AdminController(Database db) { this.db = db; } public IActionResult Index() { return View(); } public IActionResult Backup() { var data = System.IO.File.ReadAllBytes("Data.db"); var mimeType = "application/octet-stream"; return File(data, mimeType); } public IActionResult Logs() { byte[] data; using (var stream = new FileStream($@"logs\{DateTime.Today:yyyyMMdd}.log"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var reader = new StreamReader(stream)) { data = System.Text.Encoding.Default.GetBytes(reader.ReadToEnd()); } return File(data, "text/plain"); } } }
using BatteryCommander.Web.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System; using System.IO; namespace BatteryCommander.Web.Controllers { [Authorize, ApiExplorerSettings(IgnoreApi = true)] public class AdminController : Controller { // Admin Tasks: // Add/Remove Users // Backup SQLite Db // Scrub Soldier Data private readonly Database db; public AdminController(Database db) { this.db = db; } public IActionResult Index() { return View(); } public IActionResult Backup() { var data = System.IO.File.ReadAllBytes("Data.db"); var mimeType = "application/octet-stream"; return File(data, mimeType); } public IActionResult Logs() { byte[] data; using (var stream = new FileStream($@"logs\{DateTime.Today:yyyyMMdd}.log", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var reader = new StreamReader(stream)) { data = System.Text.Encoding.Default.GetBytes(reader.ReadToEnd()); } return File(data, "text/plain"); } } }
Fix imports on admin logs
Fix imports on admin logs
C#
mit
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
4c2985b6d129c74dcdb4b19f17dad449ddf09c9f
osu.Game/Audio/SampleInfoList.cs
osu.Game/Audio/SampleInfoList.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; namespace osu.Game.Audio { public class SampleInfoList : List<SampleInfo> { public SampleInfoList() { } public SampleInfoList(IEnumerable<SampleInfo> elements) { AddRange(elements); } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; namespace osu.Game.Audio { public class SampleInfoList : List<SampleInfo> { public SampleInfoList() { } public SampleInfoList(IEnumerable<SampleInfo> elements) { AddRange(elements); } } }
Use CRLF instead of LF.
Use CRLF instead of LF.
C#
mit
smoogipooo/osu,osu-RP/osu-RP,smoogipoo/osu,NeoAdonis/osu,EVAST9919/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,ppy/osu,johnneijzen/osu,ZLima12/osu,peppy/osu,DrabWeb/osu,ppy/osu,naoey/osu,nyaamara/osu,peppy/osu-new,RedNesto/osu,ZLima12/osu,peppy/osu,UselessToucan/osu,peppy/osu,EVAST9919/osu,Frontear/osuKyzer,NeoAdonis/osu,DrabWeb/osu,naoey/osu,Drezi126/osu,ppy/osu,naoey/osu,2yangk23/osu,johnneijzen/osu,DrabWeb/osu,2yangk23/osu,tacchinotacchi/osu,smoogipoo/osu,Nabile-Rahmani/osu,Damnae/osu
f4d8c3f5f950dd60aa41d33d77e9e9f00975b6d5
Portal.CMS.Web/Views/Error/_Layout.cshtml
Portal.CMS.Web/Views/Error/_Layout.cshtml
@model Portal.CMS.Web.Areas.Builder.ViewModels.Build.CustomViewModel @{ ViewBag.Title = "Error"; Layout = ""; } <!DOCTYPE html> <html lang="en-gb"> <head> <title>Portal CMS: @ViewBag.Title</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" /> @RenderSection("Styles", false) @Styles.Render("~/Resources/CSS/Bootstrap") @Styles.Render("~/Resources/CSS/FontAwesome") @Styles.Render("~/Resources/CSS/Framework") <script src="https://code.jquery.com/jquery-2.2.1.min.js"></script> <script src="https://code.jquery.com/ui/1.12.0-beta.1/jquery-ui.min.js"></script> @RenderSection("HEADScripts", false) </head> <body> <nav class="navbar navbar-inverse"><div class="container-fluid"><div class="navbar-header"><a class="navbar-brand" href="@Url.Action("Index", "Home", new { area = "" })">Portal CMS</a></div></div></nav> @RenderBody() @RenderSection("DOMScripts", false) @Scripts.Render("~/Resources/JavaScript/Bootstrap") @Scripts.Render("~/Resources/JavaScript/Bootstrap/Confirmation") @Scripts.Render("~/Resources/JavaScript/Bootstrap/Modal") @Scripts.Render("~/Resources/JavaScript/Framework/Global") </body> </html>
@model Portal.CMS.Web.Areas.Builder.ViewModels.Build.CustomViewModel @{ ViewBag.Title = "Error"; Layout = ""; } <!DOCTYPE html> <html lang="en-gb"> <head> <title>Portal CMS: @ViewBag.Title</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" /> @RenderSection("Styles", false) @Styles.Render("~/Resources/CSS/Bootstrap") @Styles.Render("~/Resources/CSS/FontAwesome") @Styles.Render("~/Resources/CSS/Framework") @Scripts.Render("~/Resources/JavaScript/JQuery") @Scripts.Render("~/Resources/JavaScript/JQueryUI") @RenderSection("HEADScripts", false) @Html.Partial("_Analytics") </head> <body class="page-builder"> <nav class="navbar navbar-inverse"><div class="container-fluid"><div class="navbar-header"><a class="navbar-brand" href="@Url.Action("Index", "Home", new { area = "" })">Portal CMS</a></div></div></nav> @Html.Partial("_NavBar") @RenderBody() @Html.Partial("_DOMScripts") @RenderSection("DOMScripts", false) </body> </html>
Update Error Layout to Standardise Against Standard Layout
Update Error Layout to Standardise Against Standard Layout
C#
mit
tommcclean/PortalCMS,tommcclean/PortalCMS,tommcclean/PortalCMS
0842157ae6b7fbb9a35fef7e521fdbd3e577dbd2
Z3D_Kees_01/Assets/_Scripts/BackToMenu.cs
Z3D_Kees_01/Assets/_Scripts/BackToMenu.cs
using UnityEngine; using System.Collections; public class BackToMenu : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.Escape)){ Application.LoadLevel(0); GameObject GUI; GUI = GameObject.Find("GUISYSTEM"); Destroy(GUI); } } }
using UnityEngine; using System.Collections; public class BackToMenu : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.Escape)){ Application.LoadLevel(0); GameObject guiSys; guiSys = GameObject.Find("GUISYSTEM"); Destroy(guiSys); GameObject networkC; networkC = GameObject.Find("NetworkController"); Destroy(networkC); } } }
Destroy NetworkController when going back to menu
Destroy NetworkController when going back to menu
C#
mit
jmc-figueira/Z3D,jmc-figueira/Z3D,jmc-figueira/Z3D