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
|
|---|---|---|---|---|---|---|---|---|---|
000f95b0acbd44bcc14ded41875e1c10443a767a
|
TfsHipChat.Tests/TfsIdentityTests.cs
|
TfsHipChat.Tests/TfsIdentityTests.cs
|
using System.IO;
using Xunit;
namespace TfsHipChat.Tests
{
public class TfsIdentityTests
{
[Fact]
public void Url_ShouldReturnTheServerUrl_WhenDeserializedByValidXml()
{
const string serverUrl = "http://some-tfs-server.com";
const string tfsIdentityXml = "<TeamFoundationServer url=\"" + serverUrl + "\" />";
var serializer = new System.Xml.Serialization.XmlSerializer(typeof (TfsIdentity));
string url = null;
using (var reader = new StringReader(tfsIdentityXml))
{
var tfsIdentity = serializer.Deserialize(reader) as TfsIdentity;
if (tfsIdentity != null) url = tfsIdentity.Url;
}
Assert.Equal(url, serverUrl);
}
}
}
|
using System.IO;
using Xunit;
namespace TfsHipChat.Tests
{
public class TfsIdentityTests
{
[Fact]
public void Url_ShouldReturnTheServerUrl_WhenDeserializedUsingValidXml()
{
const string serverUrl = "http://some-tfs-server.com";
const string tfsIdentityXml = "<TeamFoundationServer url=\"" + serverUrl + "\" />";
var serializer = new System.Xml.Serialization.XmlSerializer(typeof (TfsIdentity));
string url = null;
using (var reader = new StringReader(tfsIdentityXml))
{
var tfsIdentity = serializer.Deserialize(reader) as TfsIdentity;
if (tfsIdentity != null) url = tfsIdentity.Url;
}
Assert.Equal(url, serverUrl);
}
}
}
|
Fix grammar in test name
|
Fix grammar in test name
|
C#
|
mit
|
timclipsham/tfs-hipchat
|
debeb3f75d076df5e9a035311650ad0b5e489a8b
|
src/LoadTests/ReadAll.cs
|
src/LoadTests/ReadAll.cs
|
namespace LoadTests
{
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using EasyConsole;
using SqlStreamStore.Streams;
public class ReadAll : LoadTest
{
protected override async Task RunAsync(CancellationToken ct)
{
Output.WriteLine("");
Output.WriteLine(ConsoleColor.Green, "Appends events to streams and reads them all back in a single task.");
Output.WriteLine("");
var streamStore = GetStore();
await new AppendExpectedVersionAnyParallel()
.Append(streamStore, ct);
int readPageSize = Input.ReadInt("Read page size: ", 1, 10000);
var stopwatch = Stopwatch.StartNew();
int count = 0;
var position = Position.Start;
ReadAllPage page;
do
{
page = await streamStore.ReadAllForwards(position, readPageSize, cancellationToken: ct);
count += page.Messages.Length;
Console.Write($"\r> Read {count}");
position = page.NextPosition;
} while (!page.IsEnd);
stopwatch.Stop();
var rate = Math.Round((decimal)count / stopwatch.ElapsedMilliseconds * 1000, 0);
Output.WriteLine("");
Output.WriteLine($"> {count} messages read in {stopwatch.Elapsed} ({rate} m/s)");
}
}
}
|
namespace LoadTests
{
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using EasyConsole;
using SqlStreamStore.Streams;
public class ReadAll : LoadTest
{
protected override async Task RunAsync(CancellationToken ct)
{
Output.WriteLine("");
Output.WriteLine(ConsoleColor.Green, "Appends events to streams and reads them all back in a single task.");
Output.WriteLine("");
var streamStore = GetStore();
await new AppendExpectedVersionAnyParallel()
.Append(streamStore, ct);
int readPageSize = Input.ReadInt("Read page size: ", 1, 10000);
var prefectch = Input.ReadEnum<YesNo>("Prefetch: ");
var stopwatch = Stopwatch.StartNew();
int count = 0;
var position = Position.Start;
ReadAllPage page;
do
{
page = await streamStore.ReadAllForwards(position, readPageSize, prefetchJsonData: prefectch == YesNo.Yes, cancellationToken: ct);
count += page.Messages.Length;
Console.Write($"\r> Read {count}");
position = page.NextPosition;
} while (!page.IsEnd);
stopwatch.Stop();
var rate = Math.Round((decimal)count / stopwatch.ElapsedMilliseconds * 1000, 0);
Output.WriteLine("");
Output.WriteLine($"> {count} messages read in {stopwatch.Elapsed} ({rate} m/s)");
}
private enum YesNo
{
Yes,
No
}
}
}
|
Add option to enable prefetch or not.
|
Add option to enable prefetch or not.
|
C#
|
mit
|
SQLStreamStore/SQLStreamStore,damianh/Cedar.EventStore,SQLStreamStore/SQLStreamStore
|
d0eb2c906f0944bdb830b0fa3899a4d5ba45b952
|
AsynchronousAndMultithreading/2.AsyncLambda/Program.cs
|
AsynchronousAndMultithreading/2.AsyncLambda/Program.cs
|
using System;
using System.Threading.Tasks;
using static System.Console;
namespace AsyncLambda
{
class Program
{
static async Task Main()
{
WriteLine("Started");
try
{
Process(async () =>
{
await Task.Delay(500);
throw new Exception();
});
}
catch (Exception)
{
WriteLine("Catch");
}
await Task.Delay(2000);
WriteLine("Finished");
}
private static void Process(Action action)
{
action();
}
private static void Process(Func<Task> action)
{
action();
}
}
}
|
using System;
using System.Threading.Tasks;
using static System.Console;
namespace AsyncLambda
{
class Program
{
static async Task Main()
{
WriteLine("Started");
try
{
Process(async () =>
{
await Task.Delay(500);
throw new Exception();
});
}
catch (Exception)
{
WriteLine("Catch");
}
await Task.Delay(2000);
WriteLine("Finished");
}
private static void Process(Action action)
{
action();
}
// private static void Process(Func<Task> action)
// {
// action();
// }
}
}
|
Comment code according to presentation's flow
|
Comment code according to presentation's flow
|
C#
|
mit
|
Ky7m/DemoCode,Ky7m/DemoCode,Ky7m/DemoCode,Ky7m/DemoCode
|
7e59520aaff11a8ab24817d446f65fc23a94f2c4
|
src/Avalonia.Visuals/Media/RenderOptions.cs
|
src/Avalonia.Visuals/Media/RenderOptions.cs
|
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using Avalonia.Visuals.Media.Imaging;
namespace Avalonia.Media
{
public class RenderOptions
{
/// <summary>
/// Defines the <see cref="BitmapInterpolationMode"/> property.
/// </summary>
public static readonly StyledProperty<BitmapInterpolationMode> BitmapInterpolationModeProperty =
AvaloniaProperty.RegisterAttached<RenderOptions, AvaloniaObject, BitmapInterpolationMode>(
"BitmapInterpolationMode",
BitmapInterpolationMode.HighQuality,
inherits: true);
/// <summary>
/// Gets the value of the BitmapInterpolationMode attached property for a control.
/// </summary>
/// <param name="element">The control.</param>
/// <returns>The control's left coordinate.</returns>
public static BitmapInterpolationMode GetBitmapInterpolationMode(AvaloniaObject element)
{
return element.GetValue(BitmapInterpolationModeProperty);
}
/// <summary>
/// Sets the value of the BitmapInterpolationMode attached property for a control.
/// </summary>
/// <param name="element">The control.</param>
/// <param name="value">The left value.</param>
public static void SetBitmapInterpolationMode(AvaloniaObject element, BitmapInterpolationMode value)
{
element.SetValue(BitmapInterpolationModeProperty, value);
}
}
}
|
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using Avalonia.Visuals.Media.Imaging;
namespace Avalonia.Media
{
public class RenderOptions
{
/// <summary>
/// Defines the <see cref="BitmapInterpolationMode"/> property.
/// </summary>
public static readonly StyledProperty<BitmapInterpolationMode> BitmapInterpolationModeProperty =
AvaloniaProperty.RegisterAttached<RenderOptions, AvaloniaObject, BitmapInterpolationMode>(
"BitmapInterpolationMode",
BitmapInterpolationMode.MediumQuality,
inherits: true);
/// <summary>
/// Gets the value of the BitmapInterpolationMode attached property for a control.
/// </summary>
/// <param name="element">The control.</param>
/// <returns>The control's left coordinate.</returns>
public static BitmapInterpolationMode GetBitmapInterpolationMode(AvaloniaObject element)
{
return element.GetValue(BitmapInterpolationModeProperty);
}
/// <summary>
/// Sets the value of the BitmapInterpolationMode attached property for a control.
/// </summary>
/// <param name="element">The control.</param>
/// <param name="value">The left value.</param>
public static void SetBitmapInterpolationMode(AvaloniaObject element, BitmapInterpolationMode value)
{
element.SetValue(BitmapInterpolationModeProperty, value);
}
}
}
|
Set default render quality to medium
|
Set default render quality to medium
|
C#
|
mit
|
AvaloniaUI/Avalonia,wieslawsoltes/Perspex,akrisiun/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Perspex,grokys/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia
|
7ac9583bc22efd02f36618cb3dcb19648b819a29
|
NetSparkleTestAppWPF/MainWindow.xaml.cs
|
NetSparkleTestAppWPF/MainWindow.xaml.cs
|
using System.Drawing;
using System.Windows;
namespace NetSparkle.TestAppWPF
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private Sparkle _sparkle;
public MainWindow()
{
InitializeComponent();
// remove the netsparkle key from registry
try
{
Microsoft.Win32.Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\NetSparkle.TestAppWPF");
}
catch { }
_sparkle = new Sparkle("https://deadpikle.github.io/NetSparkle/files/sample-app/appcast.xml", SystemIcons.Application); //, "NetSparkleTestApp.exe");
_sparkle.RunningFromWPF = true;
_sparkle.CloseWPFWindow += _sparkle_CloseWPFWindow;
_sparkle.StartLoop(true, true);
}
private void _sparkle_CloseWPFWindow()
{
Dispatcher.Invoke(() => {
Application.Current.Shutdown();
});
}
private void button1_Click(object sender, RoutedEventArgs e)
{
_sparkle.CheckForUpdatesAtUserRequest();
// _sparkle.StopLoop();
// Close();
}
}
}
|
using System.Drawing;
using System.Windows;
namespace NetSparkle.TestAppWPF
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private Sparkle _sparkle;
public MainWindow()
{
InitializeComponent();
// remove the netsparkle key from registry
try
{
Microsoft.Win32.Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\NetSparkle.TestAppWPF");
}
catch { }
_sparkle = new Sparkle("https://deadpikle.github.io/NetSparkle/files/sample-app/appcast.xml", SystemIcons.Application); //, "NetSparkleTestApp.exe");
_sparkle.RunningFromWPF = true;
_sparkle.StartLoop(true, true);
}
private void button1_Click(object sender, RoutedEventArgs e)
{
_sparkle.CheckForUpdatesAtUserRequest();
// _sparkle.StopLoop();
// Close();
}
}
}
|
Remove unnecessary event callback in WPF demo
|
Remove unnecessary event callback in WPF demo
|
C#
|
mit
|
Deadpikle/NetSparkle,Deadpikle/NetSparkle
|
a291311c10c666452b1de71e4a8fdb8fa765d472
|
src/AutoQueryable/Models/Enums/ClauseType.cs
|
src/AutoQueryable/Models/Enums/ClauseType.cs
|
using System;
namespace AutoQueryable.Models.Enums
{
[Flags]
public enum ClauseType : short
{
Select = 1 << 1,
Top = 1 << 2,
Take = 1 << 3,
Skip = 1 << 4,
OrderBy = 1 << 5,
OrderByDesc = 1 << 6,
Include = 1 << 7,
GroupBy = 1 << 8,
First = 1 << 9,
Last = 1 << 10,
WrapWith = 1 << 11
}
}
|
using System;
namespace AutoQueryable.Models.Enums
{
[Flags]
public enum ClauseType : short
{
Select = 1 << 1,
Top = 1 << 2,
Take = 1 << 3,
Skip = 1 << 4,
OrderBy = 1 << 5,
OrderByDesc = 1 << 6,
GroupBy = 1 << 8,
First = 1 << 9,
Last = 1 << 10,
WrapWith = 1 << 11
}
}
|
Remove Include from clause types.
|
Remove Include from clause types.
|
C#
|
mit
|
trenoncourt/AutoQueryable
|
4e67097dc3f61442592b1594c28710fbf00e72e0
|
DesktopWidgets/Events/WidgetMouseDownEvent.cs
|
DesktopWidgets/Events/WidgetMouseDownEvent.cs
|
using System.Windows.Input;
namespace DesktopWidgets.Events
{
internal class WidgetMouseDownEvent : WidgetEventBase
{
public MouseButton MouseButton { get; set; }
}
}
|
using System.ComponentModel;
using System.Windows.Input;
namespace DesktopWidgets.Events
{
internal class WidgetMouseDownEvent : WidgetEventBase
{
[DisplayName("Mouse Button")]
public MouseButton MouseButton { get; set; }
}
}
|
Fix "Widget Mouse Down" event property friendly names
|
Fix "Widget Mouse Down" event property friendly names
|
C#
|
apache-2.0
|
danielchalmers/DesktopWidgets
|
d2b4b6e5e2c7a1f693b40ffc8c5c07701275c77a
|
src/Xamarin.Social/AssemblyInfo.cs
|
src/Xamarin.Social/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Xamarin.Social")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Xamarin, Inc.")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("2012 Xamarin, Inc.")]
[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("")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Xamarin.Social")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Xamarin Inc.")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("2012-2013 Xamarin Inc.")]
[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.2.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("")]
|
Fix version and update copyright
|
Fix version and update copyright
|
C#
|
apache-2.0
|
aphex3k/Xamarin.Social,pacificIT/Xamarin.Social,xamarin/Xamarin.Social,moljac/Xamarin.Social,pacificIT/Xamarin.Social,aphex3k/Xamarin.Social,junian/Xamarin.Social,xamarin/Xamarin.Social,moljac/Xamarin.Social,junian/Xamarin.Social
|
b05ab7fe62156711cb8e39defe56ca7104d0f9ae
|
Drawing/AppDelegate.cs
|
Drawing/AppDelegate.cs
|
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace Example_Drawing
{
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
#region -= declarations and properties =-
protected UIWindow window;
protected UINavigationController mainNavController;
protected Example_Drawing.Screens.iPad.Home.HomeScreen iPadHome;
#endregion
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create our window
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.MakeKeyAndVisible ();
// instantiate our main navigatin controller and add it's view to the window
mainNavController = new UINavigationController ();
iPadHome = new Example_Drawing.Screens.iPad.Home.HomeScreen ();
mainNavController.PushViewController (iPadHome, false);
window.RootViewController = mainNavController;
//
return true;
}
}
}
|
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace Example_Drawing
{
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
#region -= declarations and properties =-
protected UIWindow window;
protected UINavigationController mainNavController;
protected Example_Drawing.Screens.iPad.Home.HomeScreen iPadHome;
#endregion
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create our window
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.MakeKeyAndVisible ();
// instantiate our main navigatin controller and add it's view to the window
mainNavController = new UINavigationController ();
mainNavController.NavigationBar.Translucent = false;
iPadHome = new Example_Drawing.Screens.iPad.Home.HomeScreen ();
mainNavController.PushViewController (iPadHome, false);
window.RootViewController = mainNavController;
//
return true;
}
}
}
|
Set navigation bar translucent to false to fix views overlapping. Fix bug
|
[Drawing] Set navigation bar translucent to false to fix views overlapping. Fix bug [14631]
|
C#
|
mit
|
a9upam/monotouch-samples,YOTOV-LIMITED/monotouch-samples,YOTOV-LIMITED/monotouch-samples,sakthivelnagarajan/monotouch-samples,albertoms/monotouch-samples,xamarin/monotouch-samples,davidrynn/monotouch-samples,sakthivelnagarajan/monotouch-samples,labdogg1003/monotouch-samples,kingyond/monotouch-samples,andypaul/monotouch-samples,peteryule/monotouch-samples,markradacz/monotouch-samples,haithemaraissia/monotouch-samples,sakthivelnagarajan/monotouch-samples,robinlaide/monotouch-samples,davidrynn/monotouch-samples,hongnguyenpro/monotouch-samples,labdogg1003/monotouch-samples,hongnguyenpro/monotouch-samples,nelzomal/monotouch-samples,kingyond/monotouch-samples,nervevau2/monotouch-samples,robinlaide/monotouch-samples,iFreedive/monotouch-samples,sakthivelnagarajan/monotouch-samples,kingyond/monotouch-samples,albertoms/monotouch-samples,nervevau2/monotouch-samples,davidrynn/monotouch-samples,albertoms/monotouch-samples,markradacz/monotouch-samples,iFreedive/monotouch-samples,andypaul/monotouch-samples,nervevau2/monotouch-samples,labdogg1003/monotouch-samples,markradacz/monotouch-samples,haithemaraissia/monotouch-samples,W3SS/monotouch-samples,peteryule/monotouch-samples,haithemaraissia/monotouch-samples,a9upam/monotouch-samples,labdogg1003/monotouch-samples,xamarin/monotouch-samples,hongnguyenpro/monotouch-samples,a9upam/monotouch-samples,xamarin/monotouch-samples,hongnguyenpro/monotouch-samples,haithemaraissia/monotouch-samples,nelzomal/monotouch-samples,robinlaide/monotouch-samples,davidrynn/monotouch-samples,YOTOV-LIMITED/monotouch-samples,andypaul/monotouch-samples,nervevau2/monotouch-samples,nelzomal/monotouch-samples,YOTOV-LIMITED/monotouch-samples,peteryule/monotouch-samples,nelzomal/monotouch-samples,andypaul/monotouch-samples,W3SS/monotouch-samples,a9upam/monotouch-samples,W3SS/monotouch-samples,robinlaide/monotouch-samples,peteryule/monotouch-samples,iFreedive/monotouch-samples
|
100b17dad96430d7a128e2affed53febf36e1c0a
|
SGEnviroTest/ApiTest.cs
|
SGEnviroTest/ApiTest.cs
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SGEnviro;
namespace SGEnviroTest
{
[TestClass]
public class ApiTest
{
private string apiKey;
[TestInitialize]
public void TestInitialize()
{
apiKey = ConfigurationManager.AppSettings["ApiKey"];
}
[TestMethod]
public void TestApiCanRetrieve()
{
var api = new SGEnviroApi(apiKey);
var result = api.GetPsiUpdateAsync().Result;
Assert.IsNotNull(result);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SGEnviro;
namespace SGEnviroTest
{
[TestClass]
public class ApiTest
{
private string apiKey;
[TestInitialize]
public void TestInitialize()
{
apiKey = ConfigurationManager.AppSettings["ApiKey"];
}
[TestMethod]
public async Task TestApiCanRetrieve()
{
var api = new SGEnviroApi(apiKey);
var result = await api.GetPsiUpdateAsync();
Assert.IsNotNull(result);
}
}
}
|
Fix incorrectly implemented async test.
|
Fix incorrectly implemented async test.
|
C#
|
mit
|
jcheng31/SGEnviro
|
10234388e2379ab5c383381fe142f5365f4d2ed6
|
src/RestKit/Properties/AssemblyInfo.cs
|
src/RestKit/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("RestKit")]
[assembly: AssemblyDescription("SIMPLE http client wrapper that eliminates the boilerplate code you don't want to write.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RestKit")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("de3a6223-af0a-4583-bdfb-63957829e7ba")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]
[assembly: CLSCompliant(true)]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("RestKit")]
[assembly: AssemblyDescription("SIMPLE http client wrapper that eliminates the boilerplate code you don't want to write.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RestKit")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("de3a6223-af0a-4583-bdfb-63957829e7ba")]
[assembly: AssemblyVersion("1.1.0.1")]
[assembly: AssemblyFileVersion("1.1.0.1")]
[assembly: CLSCompliant(true)]
|
Increment minor version - breaking changes.
|
Increment minor version - breaking changes.
|
C#
|
mit
|
bkjuice/RestKit
|
fe2b84735bfd9ba728f807adfc18897db77cf5bb
|
ProcessGremlinApp/ArgumentParser.cs
|
ProcessGremlinApp/ArgumentParser.cs
|
using CommandLine;
namespace ProcessGremlinApp
{
public class ArgumentParser
{
public bool TryParse(string[] args, out Arguments arguments)
{
string invokedVerb = null;
object invokedVerbInstance = null;
var options = new Options();
if (Parser.Default.ParseArguments(
args,
options,
(verb, subOptions) =>
{
invokedVerb = verb;
invokedVerbInstance = subOptions;
}) && invokedVerbInstance is CommonOptions)
{
arguments = new Arguments(invokedVerb, invokedVerbInstance);
return true;
}
arguments = null;
return false;
}
}
}
|
using CommandLine;
namespace ProcessGremlinApp
{
public class ArgumentParser
{
public bool TryParse(string[] args, out Arguments arguments)
{
if (args != null && args.Length != 0)
{
string invokedVerb = null;
object invokedVerbInstance = null;
var options = new Options();
if (Parser.Default.ParseArguments(
args,
options,
(verb, subOptions) =>
{
invokedVerb = verb;
invokedVerbInstance = subOptions;
}) && invokedVerbInstance is CommonOptions)
{
arguments = new Arguments(invokedVerb, invokedVerbInstance);
return true;
}
}
arguments = null;
return false;
}
}
}
|
Fix crashing in the case of empty args
|
Fix crashing in the case of empty args
|
C#
|
bsd-3-clause
|
NathanLBCooper/ProcessGremlin
|
05bd8ea89c350a78c7cbf3d1cbf64276cbcf2886
|
src/AppHarbor/Program.cs
|
src/AppHarbor/Program.cs
|
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()
.Install(new AppHarborInstaller());
var commandDispatcher = container.Resolve<CommandDispatcher>();
if (args.Any())
{
commandDispatcher.Dispatch(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()
.Install(new AppHarborInstaller());
var commandDispatcher = container.Resolve<CommandDispatcher>();
if (args.Any())
{
commandDispatcher.Dispatch(args);
}
Console.WriteLine("Usage: appharbor COMMAND [command-options]");
Console.WriteLine("");
}
}
}
|
Write usage information if no parameters are specified
|
Write usage information if no parameters are specified
|
C#
|
mit
|
appharbor/appharbor-cli
|
4089eee761f09a19a07baab3dfd4f4b5d8808d2f
|
Properties/AssemblyInfo.cs
|
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("Lurking Window Detector")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lurking Window Detector")]
[assembly: AssemblyCopyright("Copyright (c) 2016 KAMADA Ken'ichi")]
[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("700adee8-5d49-40f3-a3ae-05dc23501663")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Lurking Window Detector")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lurking Window Detector")]
[assembly: AssemblyCopyright("Copyright (c) 2016 KAMADA Ken'ichi")]
[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("700adee8-5d49-40f3-a3ae-05dc23501663")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
|
Increment the version to 1.1.
|
Increment the version to 1.1.
|
C#
|
bsd-2-clause
|
kamadak/lurkingwind
|
e026e57ee8268ba866e0008037bd8c20e96f8e78
|
src/Parsley/Grammar.Keyword.cs
|
src/Parsley/Grammar.Keyword.cs
|
namespace Parsley;
partial class Grammar
{
public static Parser<string> Keyword(string word)
{
if (word.Any(ch => !char.IsLetter(ch)))
throw new ArgumentException("Keywords may only contain letters.", nameof(word));
return input =>
{
var peek = input.Peek(word.Length + 1);
if (peek.StartsWith(word, StringComparison.Ordinal))
{
if (peek.Length == word.Length || !char.IsLetter(peek[^1]))
{
input.Advance(word.Length);
return new Parsed<string>(word, input.Position);
}
}
return new Error<string>(input.Position, ErrorMessage.Expected(word));
};
}
}
|
namespace Parsley;
partial class Grammar
{
public static Parser<string> Keyword(string word)
{
if (word.Any(ch => !char.IsLetter(ch)))
throw new ArgumentException("Keywords may only contain letters.", nameof(word));
return input =>
{
var peek = input.Peek(word.Length + 1);
if (peek.StartsWith(word))
{
if (peek.Length == word.Length || !char.IsLetter(peek[^1]))
{
input.Advance(word.Length);
return new Parsed<string>(word, input.Position);
}
}
return new Error<string>(input.Position, ErrorMessage.Expected(word));
};
}
}
|
Remove superfluous StringComparison.Ordinal argument from ReadOnlySpan<char>.StarstWith(...) call, since the overload without a StringComparison in fact performs ordinal comparison semantics and the original call ultimately calls into the overload with no StringComparison argument anyway. In other words, you only have to specify StringComparison for span StartsWith calls when you are NOT using ordinal comparisons.
|
Remove superfluous StringComparison.Ordinal argument from ReadOnlySpan<char>.StarstWith(...) call, since the overload without a StringComparison in fact performs ordinal comparison semantics and the original call ultimately calls into the overload with no StringComparison argument anyway. In other words, you only have to specify StringComparison for span StartsWith calls when you are NOT using ordinal comparisons.
|
C#
|
mit
|
plioi/parsley
|
f227ab5010f438e692e49d813ac2fcab2fff426a
|
EarTrumpet/Extensions/AppExtensions.cs
|
EarTrumpet/Extensions/AppExtensions.cs
|
using System;
using System.Diagnostics;
using System.IO;
using System.Windows;
using Windows.ApplicationModel;
namespace EarTrumpet.Extensions
{
public static class AppExtensions
{
public static Version GetVersion(this Application app)
{
if (HasIdentity(app))
{
var packageVer = Package.Current.Id.Version;
return new Version(packageVer.Major, packageVer.Minor, packageVer.Build, packageVer.Revision);
}
else
{
#if DEBUG
var versionStr = new StreamReader(Application.GetResourceStream(new Uri("pack://application:,,,/EarTrumpet;component/Assets/DevVersion.txt")).Stream).ReadToEnd();
return Version.Parse(versionStr);
#else
return new Version(0, 0, 0, 0);
#endif
}
}
static bool? _hasIdentity = null;
public static bool HasIdentity(this Application app)
{
#if VSDEBUG
if (Debugger.IsAttached)
{
return false;
}
#endif
if (_hasIdentity == null)
{
try
{
_hasIdentity = (Package.Current.Id != null);
}
catch (InvalidOperationException ex)
{
#if !DEBUG
// We do not expect this to occur in production when the app is packaged.
AppTrace.LogWarning(ex);
#else
Trace.WriteLine($"AppExtensions HasIdentity: False {ex.Message}");
#endif
_hasIdentity = false;
}
}
return (bool)_hasIdentity;
}
}
}
|
using System;
using System.Diagnostics;
using System.IO;
using System.Windows;
using Windows.ApplicationModel;
using EarTrumpet.Diagnosis;
namespace EarTrumpet.Extensions
{
public static class AppExtensions
{
public static Version GetVersion(this Application app)
{
if (HasIdentity(app))
{
var packageVer = Package.Current.Id.Version;
return new Version(packageVer.Major, packageVer.Minor, packageVer.Build, packageVer.Revision);
}
else
{
#if DEBUG
var versionStr = new StreamReader(Application.GetResourceStream(new Uri("pack://application:,,,/EarTrumpet;component/Assets/DevVersion.txt")).Stream).ReadToEnd();
return Version.Parse(versionStr);
#else
return new Version(0, 0, 0, 0);
#endif
}
}
static bool? _hasIdentity = null;
public static bool HasIdentity(this Application app)
{
#if VSDEBUG
if (Debugger.IsAttached)
{
return false;
}
#endif
if (_hasIdentity == null)
{
try
{
_hasIdentity = (Package.Current.Id != null);
}
catch (InvalidOperationException ex)
{
#if !DEBUG
// We do not expect this to occur in production when the app is packaged.
ErrorReporter.LogWarning(ex);
#else
Trace.WriteLine($"AppExtensions HasIdentity: False {ex.Message}");
#endif
_hasIdentity = false;
}
}
return (bool)_hasIdentity;
}
}
}
|
Clean up lingering AppTrace reference
|
Clean up lingering AppTrace reference
|
C#
|
mit
|
File-New-Project/EarTrumpet
|
c9accfd67018e19f1b502f1ab98923e16e1f1dfb
|
Assets/Editor/Alensia/Core/UI/ComponentFactory.cs
|
Assets/Editor/Alensia/Core/UI/ComponentFactory.cs
|
using System;
using UnityEditor;
using UnityEngine;
namespace Alensia.Core.UI
{
public static class ComponentFactory
{
[MenuItem("GameObject/UI/Alensia/Button", false, 10)]
public static Button CreateButton(MenuCommand command) => CreateComponent(command, Button.CreateInstance);
[MenuItem("GameObject/UI/Alensia/Dropdown", false, 10)]
public static Dropdown CreateDropdown(MenuCommand command) => CreateComponent(command, Dropdown.CreateInstance);
[MenuItem("GameObject/UI/Alensia/Label", false, 10)]
public static Label CreateLabel(MenuCommand command) => CreateComponent(command, Label.CreateInstance);
[MenuItem("GameObject/UI/Alensia/Panel", false, 10)]
public static Panel CreatePanel(MenuCommand command) => CreateComponent(command, Panel.CreateInstance);
[MenuItem("GameObject/UI/Alensia/Slider", false, 10)]
public static Slider CreateSlider(MenuCommand command) => CreateComponent(command, Slider.CreateInstance);
[MenuItem("GameObject/UI/Alensia/Scroll Panel", false, 10)]
public static ScrollPanel CreateScrollPanel(MenuCommand command) => CreateComponent(command, ScrollPanel.CreateInstance);
private static T CreateComponent<T>(
MenuCommand command, Func<T> factory) where T : UIComponent
{
var component = factory.Invoke();
GameObjectUtility.SetParentAndAlign(
component.gameObject, command.context as GameObject);
Undo.RegisterCreatedObjectUndo(component, "Create " + component.name);
Selection.activeObject = component;
return component;
}
}
}
|
using System;
using UnityEditor;
using UnityEngine;
namespace Alensia.Core.UI
{
public static class ComponentFactory
{
[MenuItem("GameObject/UI/Alensia/Label", false, 10)]
public static Label CreateLabel(MenuCommand command) => CreateComponent(command, Label.CreateInstance);
[MenuItem("GameObject/UI/Alensia/Button", false, 10)]
public static Button CreateButton(MenuCommand command) => CreateComponent(command, Button.CreateInstance);
[MenuItem("GameObject/UI/Alensia/Dropdown", false, 10)]
public static Dropdown CreateDropdown(MenuCommand command) => CreateComponent(command, Dropdown.CreateInstance);
[MenuItem("GameObject/UI/Alensia/Slider", false, 10)]
public static Slider CreateSlider(MenuCommand command) => CreateComponent(command, Slider.CreateInstance);
[MenuItem("GameObject/UI/Alensia/Panel", false, 10)]
public static Panel CreatePanel(MenuCommand command) => CreateComponent(command, Panel.CreateInstance);
[MenuItem("GameObject/UI/Alensia/Scroll Panel", false, 10)]
public static ScrollPanel CreateScrollPanel(MenuCommand command) => CreateComponent(command, ScrollPanel.CreateInstance);
private static T CreateComponent<T>(
MenuCommand command, Func<T> factory) where T : UIComponent
{
var component = factory.Invoke();
GameObjectUtility.SetParentAndAlign(
component.gameObject, command.context as GameObject);
Undo.RegisterCreatedObjectUndo(component, "Create " + component.name);
Selection.activeObject = component;
return component;
}
}
}
|
Rearrange UI menu according to component types
|
Rearrange UI menu according to component types
|
C#
|
apache-2.0
|
mysticfall/Alensia
|
dcd6c2c62131af0774c4f870bd5ace8366bb86fc
|
Eco/Variables/PublicIpVariable.cs
|
Eco/Variables/PublicIpVariable.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace Eco.Variables
{
public class PublicIpVariable : IVariableProvider
{
public Dictionary<string, Func<string>> GetVariables()
{
return new Dictionary<string, Func<string>>()
{
{ "publicIp", () => new WebClient().DownloadString("http://icanhazip.com").Trim() }
};
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace Eco.Variables
{
public class PublicIpVariable : IVariableProvider
{
string _lastIp;
DateTime _lastUpdate;
public Dictionary<string, Func<string>> GetVariables()
{
var now = DateTime.Now;
if (now - _lastUpdate > TimeSpan.FromMinutes(1))
{
_lastIp = new WebClient().DownloadString("http://icanhazip.com").Trim();
_lastUpdate = now;
}
return new Dictionary<string, Func<string>>()
{
{ "publicIp", () => _lastIp }
};
}
}
}
|
Refresh IP address not often than 1 time per minute.
|
Refresh IP address not often than 1 time per minute.
|
C#
|
apache-2.0
|
lukyad/Eco
|
5d35cb9e8ec79d97123476c0eae4f09387720016
|
Entities/Components/Behaviours/Controller.cs
|
Entities/Components/Behaviours/Controller.cs
|
using Andromeda2D.Entities;
using Andromeda2D.Entities.Components;
using Andromeda2D.Entities.Components.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Andromeda.Entities.Components
{
/// <summary>
/// A controller for a model
/// </summary>
/// <typeparam name="TModel">The model type</typeparam>
public abstract class Controller<TModel> : Component
where TModel : IModel
{
Entity _entity;
/// <summary>
/// Sets the model of the controller
/// </summary>
/// <param name="model">The model to set to this controller</param>
protected void SetControllerModel(TModel model)
{
this._model = model;
}
private TModel _model;
/// <summary>
/// The model of this controller
/// </summary>
public TModel Model
{
get => _model;
}
public abstract void InitModel();
public override void OnComponentInit(Entity entity)
{
InitModel();
}
}
}
|
using Andromeda2D.Entities;
using Andromeda2D.Entities.Components;
using Andromeda2D.Entities.Components.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Andromeda.Entities.Components
{
/// <summary>
/// A controller for a model
/// </summary>
/// <typeparam name="TModel">The model type</typeparam>
public abstract class Controller<TModel> : Component
where TModel : IModel
{
Entity _entity;
/// <summary>
/// Sets the model of the controller
/// </summary>
/// <param name="model">The model to set to this controller</param>
protected void SetControllerModel(TModel model)
{
this._model = model;
}
private TModel _model;
/// <summary>
/// The model of this controller
/// </summary>
public TModel Model
{
get => _model;
}
protected abstract void InitModel();
public override void OnComponentInit(Entity entity)
{
InitModel();
}
}
}
|
Change InitModel from public to protected
|
Change InitModel from public to protected
No reason for it to be public.
|
C#
|
mit
|
Vorlias/Andromeda
|
5c7b0314069bf363dc810fb5864d39cec442e78e
|
MultiMiner.Remoting.Server/RemotingServer.cs
|
MultiMiner.Remoting.Server/RemotingServer.cs
|
using System;
using System.ServiceModel;
namespace MultiMiner.Remoting.Server
{
public class RemotingServer
{
private bool serviceStarted = false;
private ServiceHost myServiceHost = null;
public void Startup()
{
Uri baseAddress = new Uri("net.tcp://localhost:" + Config.RemotingPort + "/RemotingService");
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
myServiceHost = new ServiceHost(typeof(RemotingService), baseAddress);
myServiceHost.AddServiceEndpoint(typeof(IRemotingService), binding, baseAddress);
myServiceHost.Open();
serviceStarted = true;
}
public void Shutdown()
{
myServiceHost.Close();
myServiceHost = null;
serviceStarted = false;
}
}
}
|
using System;
using System.ServiceModel;
namespace MultiMiner.Remoting.Server
{
public class RemotingServer
{
private bool serviceStarted = false;
private ServiceHost myServiceHost = null;
public void Startup()
{
Uri baseAddress = new Uri("net.tcp://localhost:" + Config.RemotingPort + "/RemotingService");
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
myServiceHost = new ServiceHost(typeof(RemotingService), baseAddress);
myServiceHost.AddServiceEndpoint(typeof(IRemotingService), binding, baseAddress);
myServiceHost.Open();
serviceStarted = true;
}
public void Shutdown()
{
if (!serviceStarted)
return;
myServiceHost.Close();
myServiceHost = null;
serviceStarted = false;
}
}
}
|
Fix a null ref error
|
Fix a null ref error
|
C#
|
mit
|
nwoolls/MultiMiner,IWBWbiz/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner
|
5aecc31f2cd8ddadb82615dd36483fafb875c6a7
|
VideoAggregator/Program.cs
|
VideoAggregator/Program.cs
|
using System;
using Gtk;
namespace VideoAggregator
{
class MainClass
{
public static void Main (string[] args)
{
Application.Init ();
MainWindow win = new MainWindow ();
win.Show ();
Application.Run ();
}
}
}
|
using System;
using Gtk;
namespace VideoAggregator
{
class MainClass
{
public static void Main (string[] args)
{
Application.Init ();
MainWindow win = new MainWindow ();
win.Maximize ();
win.Show ();
Application.Run ();
}
}
}
|
Make program maximized on start
|
Make program maximized on start
|
C#
|
mit
|
Lakon/VideoAggregator
|
c123eb4ae03fffa5c20f1f5a6bd12c5454172122
|
CuberLib/ImageTile.cs
|
CuberLib/ImageTile.cs
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CuberLib
{
public class ImageTile
{
private Image image;
private Size size;
public ImageTile(string inputFile, int xSize, int ySize)
{
if (!File.Exists(inputFile)) throw new FileNotFoundException();
image = Image.FromFile(inputFile);
size = new Size(xSize, ySize);
}
public void GenerateTiles(string outputPath)
{
int xMax = image.Width;
int yMax = image.Height;
int tileWidth = xMax / size.Width;
int tileHeight = yMax / size.Height;
for (int x = 0; x < size.Width; x++)
{
for (int y = 0; y < size.Height; y++)
{
string outputFileName = Path.Combine(outputPath, string.Format("{0}_{1}.jpg", x, y));
Rectangle tileBounds = new Rectangle(x * tileWidth, y * tileHeight, tileWidth, tileHeight);
Bitmap target = new Bitmap(tileWidth, tileHeight);
using (Graphics graphics = Graphics.FromImage(target))
{
graphics.DrawImage(
image,
new Rectangle(0, 0, tileWidth, tileHeight),
tileBounds,
GraphicsUnit.Pixel);
}
target.Save(outputFileName, ImageFormat.Jpeg);
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CuberLib
{
public class ImageTile
{
private Image image;
private Size size;
public ImageTile(string inputFile, int xSize, int ySize)
{
if (!File.Exists(inputFile)) throw new FileNotFoundException();
image = Image.FromFile(inputFile);
size = new Size(xSize, ySize);
}
public void GenerateTiles(string outputPath)
{
int xMax = image.Width;
int yMax = image.Height;
int tileWidth = xMax / size.Width;
int tileHeight = yMax / size.Height;
if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); }
for (int x = 0; x < size.Width; x++)
{
for (int y = 0; y < size.Height; y++)
{
string outputFileName = Path.Combine(outputPath, string.Format("{0}_{1}.jpg", x, y));
Rectangle tileBounds = new Rectangle(x * tileWidth, y * tileHeight, tileWidth, tileHeight);
Bitmap target = new Bitmap(tileWidth, tileHeight);
using (Graphics graphics = Graphics.FromImage(target))
{
graphics.DrawImage(
image,
new Rectangle(0, 0, tileWidth, tileHeight),
tileBounds,
GraphicsUnit.Pixel);
}
target.Save(outputFileName, ImageFormat.Jpeg);
}
}
}
}
}
|
Create output directory if needed for jpg slicing.
|
Create output directory if needed for jpg slicing.
|
C#
|
mit
|
PyriteServer/PyriteCli,PyriteServer/PyriteCli,PyriteServer/PyriteCli
|
3c912162801af8345ec6fe029c61b0d6e3c9287b
|
Battery-Commander.Web/Models/Vehicle.cs
|
Battery-Commander.Web/Models/Vehicle.cs
|
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BatteryCommander.Web.Models
{
public class Vehicle
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public int UnitId { get; set; }
public virtual Unit Unit { get; set; }
// Notes, What's broken about it?
[Required]
public VehicleStatus Status { get; set; } = VehicleStatus.FMC;
[Required, StringLength(10)]
public String Bumper { get; set; }
[Required]
public VehicleType Type { get; set; } = VehicleType.HMMWV;
// public String Registration { get; set; }
// public String Serial { get; set; }
[Required]
public int Seats { get; set; } = 2;
// TroopCapacity?
// Chalk Order?
// LIN?
// Fuel Card? Towbar? Water Buffalo?
// Fuel Level?
// Driver, A-Driver, Passengers, Assigned Section?
public enum VehicleType : byte
{
HMMWV = 0,
MTV = 1
}
public enum VehicleStatus : byte
{
Unknown = 0,
FMC = 1,
NMC = byte.MaxValue
}
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BatteryCommander.Web.Models
{
public class Vehicle
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public int UnitId { get; set; }
public virtual Unit Unit { get; set; }
// Notes, What's broken about it?
[Required]
public VehicleStatus Status { get; set; } = VehicleStatus.FMC;
[Required, StringLength(10)]
public String Bumper { get; set; }
[Required]
public VehicleType Type { get; set; } = VehicleType.HMMWV;
// public String Registration { get; set; }
// public String Serial { get; set; }
[Required]
public int Seats { get; set; } = 2;
// TroopCapacity?
// Chalk Order?
// LIN?
// Fuel Card? Towbar? Water Buffalo?
// Fuel Level?
// Driver, A-Driver, Passengers, Assigned Section?
// Has JBC-P?
public enum VehicleType : byte
{
HMMWV = 0,
MTV = 1
}
public enum VehicleStatus : byte
{
Unknown = 0,
FMC = 1,
NMC = byte.MaxValue
}
}
}
|
Add note about things to add for vehicles
|
Add note about things to add for vehicles
|
C#
|
mit
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
56308d1b0b58227b37fdae46f4cb0ea75136171c
|
SocialToolBox.Sample.Web/InitialData.cs
|
SocialToolBox.Sample.Web/InitialData.cs
|
using System;
using SocialToolBox.Core.Database;
using SocialToolBox.Core.Database.Serialization;
using SocialToolBox.Crm.Contact.Event;
namespace SocialToolBox.Sample.Web
{
/// <summary>
/// Data initially available in the system.
/// </summary>
public static class InitialData
{
public static readonly Id UserVictorNicollet = Id.Parse("aaaaaaaaaaa");
public static readonly Id ContactBenjaminFranklin = Id.Parse("aaaaaaaaaab");
/// <summary>
/// Generates sample data.
/// </summary>
public static void AddTo(SocialModules modules)
{
var t = modules.Database.OpenReadWriteCursor();
AddContactsTo(modules, t);
}
/// <summary>
/// Generates sample contacts.
/// </summary>
private static void AddContactsTo(SocialModules modules, ICursor t)
{
foreach (var ev in new IContactEvent[]
{
new ContactCreated(ContactBenjaminFranklin, DateTime.Parse("2013/09/26"),UserVictorNicollet),
new ContactNameUpdated(ContactBenjaminFranklin, DateTime.Parse("2013/09/26"),UserVictorNicollet,"Benjamin","Franklin"),
}) modules.Contacts.Stream.AddEvent(ev, t);
}
}
}
|
using System;
using SocialToolBox.Core.Database;
using SocialToolBox.Crm.Contact.Event;
namespace SocialToolBox.Sample.Web
{
/// <summary>
/// Data initially available in the system.
/// </summary>
public static class InitialData
{
public static readonly Id UserVictorNicollet = Id.Parse("aaaaaaaaaaa");
public static readonly Id ContactBenjaminFranklin = Id.Parse("aaaaaaaaaab");
public static readonly Id ContactJuliusCaesar = Id.Parse("aaaaaaaaaac");
/// <summary>
/// Generates sample data.
/// </summary>
public static void AddTo(SocialModules modules)
{
var t = modules.Database.OpenReadWriteCursor();
AddContactsTo(modules, t);
}
/// <summary>
/// Generates sample contacts.
/// </summary>
private static void AddContactsTo(SocialModules modules, ICursor t)
{
foreach (var ev in new IContactEvent[]
{
new ContactCreated(ContactBenjaminFranklin, DateTime.Parse("2013/09/26"),UserVictorNicollet),
new ContactNameUpdated(ContactBenjaminFranklin, DateTime.Parse("2013/09/26"),UserVictorNicollet,"Benjamin","Franklin"),
new ContactCreated(ContactJuliusCaesar, DateTime.Parse("2013/09/27"),UserVictorNicollet),
new ContactNameUpdated(ContactJuliusCaesar, DateTime.Parse("2013/09/27"),UserVictorNicollet,"Julius","Caesar")
}) modules.Contacts.Stream.AddEvent(ev, t);
}
}
}
|
Add a second contact to initial sample data
|
Add a second contact to initial sample data
|
C#
|
mit
|
VictorNicollet/SocialToolBox
|
68337df64377032faa9b86538164dacb30551fcf
|
osu.Game/Tests/Gameplay/TestGameplayState.cs
|
osu.Game/Tests/Gameplay/TestGameplayState.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using System.Collections.Generic;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.Gameplay
{
/// <summary>
/// Static class providing a <see cref="Create"/> convenience method to retrieve a correctly-initialised <see cref="GameplayState"/> instance in testing scenarios.
/// </summary>
public static class TestGameplayState
{
/// <summary>
/// Creates a correctly-initialised <see cref="GameplayState"/> instance for use in testing.
/// </summary>
public static GameplayState Create(Ruleset ruleset, IReadOnlyList<Mod>? mods = null, Score? score = null)
{
var beatmap = new TestBeatmap(ruleset.RulesetInfo);
var workingBeatmap = new TestWorkingBeatmap(beatmap);
var playableBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);
return new GameplayState(playableBeatmap, ruleset, mods, score);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using System.Collections.Generic;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.Gameplay
{
/// <summary>
/// Static class providing a <see cref="Create"/> convenience method to retrieve a correctly-initialised <see cref="GameplayState"/> instance in testing scenarios.
/// </summary>
public static class TestGameplayState
{
/// <summary>
/// Creates a correctly-initialised <see cref="GameplayState"/> instance for use in testing.
/// </summary>
public static GameplayState Create(Ruleset ruleset, IReadOnlyList<Mod>? mods = null, Score? score = null)
{
var beatmap = new TestBeatmap(ruleset.RulesetInfo);
var workingBeatmap = new TestWorkingBeatmap(beatmap);
var playableBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);
var scoreProcessor = ruleset.CreateScoreProcessor();
scoreProcessor.ApplyBeatmap(playableBeatmap);
return new GameplayState(playableBeatmap, ruleset, mods, score, scoreProcessor);
}
}
}
|
Fix tests by creating a score processor
|
Fix tests by creating a score processor
|
C#
|
mit
|
ppy/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu,peppy/osu
|
0fc76080896695e1f0569b3188f2489532a886a2
|
src/CodeBreaker.WebApp/Storage/ScoreStore.cs
|
src/CodeBreaker.WebApp/Storage/ScoreStore.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CodeBreaker.Core;
using CodeBreaker.Core.Storage;
using Microsoft.EntityFrameworkCore;
namespace CodeBreaker.WebApp.Storage
{
public class ScoreStore : IScoreStore
{
private readonly CodeBreakerDbContext _dbContext;
public ScoreStore(CodeBreakerDbContext dbContext)
{
_dbContext = dbContext;
}
public async Task<Score[]> GetScores(int page, int size)
{
return (await _dbContext.Scores.ToListAsync())
.OrderBy(s => s.Attempts)
.ThenBy(s => s.Duration)
.Skip(page * size).Take(size)
.ToArray();
}
public async Task SaveScore(Score score)
{
await _dbContext.Scores.AddAsync(score);
await _dbContext.SaveChangesAsync();
}
public Task<bool> ScoreExists(Guid gameId)
{
return _dbContext.Scores.AnyAsync(s => s.GameId == gameId);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CodeBreaker.Core;
using CodeBreaker.Core.Storage;
using Microsoft.EntityFrameworkCore;
namespace CodeBreaker.WebApp.Storage
{
public class ScoreStore : IScoreStore
{
private readonly CodeBreakerDbContext _dbContext;
public ScoreStore(CodeBreakerDbContext dbContext)
{
_dbContext = dbContext;
}
public Task<Score[]> GetScores(int page, int size)
{
return _dbContext.Scores
.OrderBy(s => s.Attempts)
.ThenBy(s => s.Duration)
.Skip(page * size).Take(size)
.ToArrayAsync();
}
public async Task SaveScore(Score score)
{
await _dbContext.Scores.AddAsync(score);
await _dbContext.SaveChangesAsync();
}
public Task<bool> ScoreExists(Guid gameId)
{
return _dbContext.Scores.AnyAsync(s => s.GameId == gameId);
}
}
}
|
Fix for slow high score loading
|
Fix for slow high score loading
|
C#
|
mit
|
vlesierse/codebreaker,vlesierse/codebreaker,vlesierse/codebreaker
|
e6d3bda079b5d9fe28c4c53500a782f07270fd74
|
src/Glimpse.Web.Common/GlimpseWebServices.cs
|
src/Glimpse.Web.Common/GlimpseWebServices.cs
|
using System;
using System.Collections.Generic;
using Glimpse.Web;
using Microsoft.Framework.DependencyInjection;
namespace Glimpse
{
public class GlimpseWebServices
{
public static IServiceCollection GetDefaultServices()
{
var services = new ServiceCollection();
services.AddTransient<IRequestAuthorizerProvider, DefaultRequestAuthorizerProvider>();
services.AddTransient<IRequestHandlerProvider, DefaultRequestHandlerProvider>();
return services;
}
}
}
|
using System;
using System.Collections.Generic;
using Glimpse.Web;
using Microsoft.Framework.DependencyInjection;
namespace Glimpse
{
public class GlimpseWebServices
{
public static IServiceCollection GetDefaultServices()
{
var services = new ServiceCollection();
services.AddTransient<IRequestAuthorizerProvider, DefaultRequestAuthorizerProvider>();
services.AddTransient<IRequestHandlerProvider, DefaultRequestHandlerProvider>();
services.AddTransient<IRequestRuntimeProvider, DefaultRequestRuntimeProvider>();
return services;
}
}
}
|
Add default RequestRuntime to service registration
|
Add default RequestRuntime to service registration
|
C#
|
mit
|
pranavkm/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype
|
e8b3e776b7fb1ce39add2ae6e93821fcfd79bf32
|
src/SIM.Telemetry/Properties/AssemblyInfo.cs
|
src/SIM.Telemetry/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("SIM.Telemetry")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SIM.Telemetry")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("b91b2024-3f75-4df7-8dcc-111fb5ccaf5d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SIM.Telemetry")]
[assembly: AssemblyDescription("'SIM.Telemetry' is used to track Sitecore Instance Manager utilisation statistics")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SIM.Telemetry")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("b91b2024-3f75-4df7-8dcc-111fb5ccaf5d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Add AssemblyDescription to SIM.Telemetry project
|
Add AssemblyDescription to SIM.Telemetry project
|
C#
|
mit
|
Sitecore/Sitecore-Instance-Manager
|
726cc21e006428e9ff7dd66b27c9be61056f30b8
|
src/Tests/Nest.Tests.Unit/Extensions.cs
|
src/Tests/Nest.Tests.Unit/Extensions.cs
|
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Nest.Tests.Unit
{
public static class JsonExtensions
{
internal static bool JsonEquals(this string json, string otherjson)
{
var nJson = JObject.Parse(json).ToString();
var nOtherJson = JObject.Parse(otherjson).ToString();
//Assert.AreEqual(nOtherJson, nJson);
return nJson == nOtherJson;
}
}
}
|
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Nest.Tests.Unit
{
public static class JsonExtensions
{
internal static bool JsonEquals(this string json, string otherjson)
{
var nJson = JObject.Parse(json);
var nOtherJson = JObject.Parse(otherjson);
return JToken.DeepEquals(nJson, nOtherJson);
}
}
}
|
Use deep equality rather than string comparison.
|
Use deep equality rather than string comparison.
This makes the tests a lot less brittle, since they don't
depend on the vagueries of json ordering
|
C#
|
apache-2.0
|
CSGOpenSource/elasticsearch-net,geofeedia/elasticsearch-net,UdiBen/elasticsearch-net,LeoYao/elasticsearch-net,robertlyson/elasticsearch-net,abibell/elasticsearch-net,cstlaurent/elasticsearch-net,adam-mccoy/elasticsearch-net,junlapong/elasticsearch-net,robrich/elasticsearch-net,UdiBen/elasticsearch-net,adam-mccoy/elasticsearch-net,amyzheng424/elasticsearch-net,LeoYao/elasticsearch-net,abibell/elasticsearch-net,ststeiger/elasticsearch-net,TheFireCookie/elasticsearch-net,azubanov/elasticsearch-net,geofeedia/elasticsearch-net,azubanov/elasticsearch-net,wawrzyn/elasticsearch-net,faisal00813/elasticsearch-net,cstlaurent/elasticsearch-net,starckgates/elasticsearch-net,junlapong/elasticsearch-net,CSGOpenSource/elasticsearch-net,gayancc/elasticsearch-net,gayancc/elasticsearch-net,mac2000/elasticsearch-net,wawrzyn/elasticsearch-net,elastic/elasticsearch-net,tkirill/elasticsearch-net,joehmchan/elasticsearch-net,mac2000/elasticsearch-net,jonyadamit/elasticsearch-net,gayancc/elasticsearch-net,DavidSSL/elasticsearch-net,robrich/elasticsearch-net,CSGOpenSource/elasticsearch-net,starckgates/elasticsearch-net,faisal00813/elasticsearch-net,amyzheng424/elasticsearch-net,ststeiger/elasticsearch-net,amyzheng424/elasticsearch-net,jonyadamit/elasticsearch-net,joehmchan/elasticsearch-net,wawrzyn/elasticsearch-net,geofeedia/elasticsearch-net,faisal00813/elasticsearch-net,mac2000/elasticsearch-net,KodrAus/elasticsearch-net,abibell/elasticsearch-net,LeoYao/elasticsearch-net,TheFireCookie/elasticsearch-net,SeanKilleen/elasticsearch-net,junlapong/elasticsearch-net,joehmchan/elasticsearch-net,RossLieberman/NEST,tkirill/elasticsearch-net,elastic/elasticsearch-net,tkirill/elasticsearch-net,KodrAus/elasticsearch-net,SeanKilleen/elasticsearch-net,DavidSSL/elasticsearch-net,jonyadamit/elasticsearch-net,ststeiger/elasticsearch-net,azubanov/elasticsearch-net,UdiBen/elasticsearch-net,robertlyson/elasticsearch-net,TheFireCookie/elasticsearch-net,KodrAus/elasticsearch-net,robertlyson/elasticsearch-net,RossLieberman/NEST,starckgates/elasticsearch-net,SeanKilleen/elasticsearch-net,RossLieberman/NEST,adam-mccoy/elasticsearch-net,cstlaurent/elasticsearch-net,robrich/elasticsearch-net,DavidSSL/elasticsearch-net
|
54c4b8833369efce0e06228c365b115b07dece7c
|
MessageBird/Objects/Error.cs
|
MessageBird/Objects/Error.cs
|
using Newtonsoft.Json;
namespace MessageBird.Objects
{
public class Error
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("parameter")]
public string Parameter { get; set; }
}
}
|
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace MessageBird.Objects
{
public enum ErrorCode
{
RequestNotAllowed = 2,
MissingParameters = 9,
InvalidParameters = 10,
NotFound = 20,
NotEnoughBalance = 25,
ApiNotFound = 98,
InternalError = 99
}
public class Error
{
[JsonProperty("code")]
public ErrorCode Code { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("parameter")]
public string Parameter { get; set; }
}
}
|
Replace integer error code with enum
|
Replace integer error code with enum
|
C#
|
isc
|
messagebird/csharp-rest-api
|
c72017a7db4ad00ba2b63d976fca20c5ea9ac583
|
osu.Game/Configuration/HUDVisibilityMode.cs
|
osu.Game/Configuration/HUDVisibilityMode.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.ComponentModel;
namespace osu.Game.Configuration
{
public enum HUDVisibilityMode
{
Never,
[Description("Hide during gameplay")]
HideDuringGameplay,
[Description("Hide during breaks")]
HideDuringBreaks,
Always
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.ComponentModel;
namespace osu.Game.Configuration
{
public enum HUDVisibilityMode
{
Never,
[Description("Hide during gameplay")]
HideDuringGameplay,
Always
}
}
|
Remove "hide during breaks" option
|
Remove "hide during breaks" option
Probably wouldn't be used anyway.
|
C#
|
mit
|
UselessToucan/osu,ppy/osu,ppy/osu,peppy/osu-new,peppy/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu
|
958e804f4e6f5fb88f7818916a1a56f9c0c82aa8
|
Fitbit.Portable/JsonDotNetSerializerExtensions.cs
|
Fitbit.Portable/JsonDotNetSerializerExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Fitbit.Models;
using Newtonsoft.Json.Linq;
namespace Fitbit.Api.Portable
{
internal static class JsonDotNetSerializerExtensions
{
/// <summary>
/// GetFriends has to do some custom manipulation with the returned representation
/// </summary>
/// <param name="serializer"></param>
/// <param name="friendsJson"></param>
/// <returns></returns>
internal static List<UserProfile> GetFriends(this JsonDotNetSerializer serializer, string friendsJson)
{
if (string.IsNullOrWhiteSpace(friendsJson))
{
throw new ArgumentNullException("friendsJson", "friendsJson can not be empty, null or whitespace.");
}
// todo: additional error checking of json string required
serializer.RootProperty = "user";
var users = JToken.Parse(friendsJson)["friends"];
return users.Children().Select(serializer.Deserialize<UserProfile>).ToList();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Fitbit.Models;
using Newtonsoft.Json.Linq;
namespace Fitbit.Api.Portable
{
internal static class JsonDotNetSerializerExtensions
{
/// <summary>
/// GetFriends has to do some custom manipulation with the returned representation
/// </summary>
/// <param name="serializer"></param>
/// <param name="friendsJson"></param>
/// <returns></returns>
internal static List<UserProfile> GetFriends(this JsonDotNetSerializer serializer, string friendsJson)
{
if (string.IsNullOrWhiteSpace(friendsJson))
{
throw new ArgumentNullException("friendsJson", "friendsJson can not be empty, null or whitespace.");
}
// todo: additional error checking of json string required
serializer.RootProperty = "user";
var friends = JToken.Parse(friendsJson)["friends"];
return friends.Children().Select(serializer.Deserialize<UserProfile>).ToList();
}
}
}
|
Rename variable to make it read better
|
Rename variable to make it read better
|
C#
|
mit
|
amammay/Fitbit.NET,WestDiscGolf/Fitbit.NET,aarondcoleman/Fitbit.NET,AlexGhiondea/Fitbit.NET,amammay/Fitbit.NET,aarondcoleman/Fitbit.NET,AlexGhiondea/Fitbit.NET,WestDiscGolf/Fitbit.NET,amammay/Fitbit.NET,AlexGhiondea/Fitbit.NET,WestDiscGolf/Fitbit.NET,aarondcoleman/Fitbit.NET
|
80a63762076446e39aaef1146ef322301bc8ae26
|
AmazingCloudSearch/Properties/AssemblyInfo.cs
|
AmazingCloudSearch/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("CloudSearch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CloudSearch")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8ace1017-c436-4f00-b040-84f7619af92f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.2")]
[assembly: AssemblyFileVersion("1.0.0.2")]
|
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("CloudSearch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CloudSearch")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8ace1017-c436-4f00-b040-84f7619af92f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]
|
Undo version number bump from personal build
|
Undo version number bump from personal build
|
C#
|
mit
|
baylesj/OkayCloudSearch,baylesj/OkayCloudSearch
|
9288a468d586e88533ebd380ba0eabe71e90a254
|
examples/SetPictures.cs
|
examples/SetPictures.cs
|
using System;
using TagLib;
public class SetPictures
{
public static void Main(string [] args)
{
if(args.Length < 2) {
Console.Error.WriteLine("USAGE: mono SetPictures.exe AUDIO_PATH IMAGE_PATH_1[...IMAGE_PATH_N]");
return;
}
TagLib.File file = TagLib.File.Create(args[0]);
Console.WriteLine("Current picture count: " + file.Tag.Pictures.Length);
Picture [] pictures = new Picture[args.Length - 1];
for(int i = 1; i < args.Length; i++) {
Picture picture = Picture.CreateFromPath(args[i]);
pictures[i - 1] = picture;
}
file.Tag.Pictures = pictures;
file.Save();
Console.WriteLine("New picture count: " + file.Tag.Pictures.Length);
}
}
|
using System;
using TagLib;
public class SetPictures
{
public static void Main(string [] args)
{
if(args.Length < 2) {
Console.Error.WriteLine("USAGE: mono SetPictures.exe AUDIO_PATH IMAGE_PATH_1[...IMAGE_PATH_N]");
return;
}
TagLib.File file = TagLib.File.Create(args[0]);
Console.WriteLine("Current picture count: " + file.Tag.Pictures.Length);
Picture [] pictures = new Picture[args.Length - 1];
for(int i = 1; i < args.Length; i++) {
Picture picture = new Picture(args[i]);
pictures[i - 1] = picture;
}
file.Tag.Pictures = pictures;
file.Save();
Console.WriteLine("New picture count: " + file.Tag.Pictures.Length);
}
}
|
Fix use of obsolete API
|
Fix use of obsolete API
svn path=/trunk/taglib-sharp/; revision=123925
|
C#
|
lgpl-2.1
|
archrival/taglib-sharp,hwahrmann/taglib-sharp,archrival/taglib-sharp,punker76/taglib-sharp,mono/taglib-sharp,CamargoR/taglib-sharp,Clancey/taglib-sharp,punker76/taglib-sharp,Clancey/taglib-sharp,hwahrmann/taglib-sharp,Clancey/taglib-sharp,CamargoR/taglib-sharp
|
2eda5bfe536b94162e201d494e8b206038cb7de7
|
AxosoftAPI.NET/Interfaces/IWorklogs.cs
|
AxosoftAPI.NET/Interfaces/IWorklogs.cs
|
using AxosoftAPI.NET.Core.Interfaces;
using AxosoftAPI.NET.Models;
namespace AxosoftAPI.NET.Interfaces
{
public interface IWorkLogs : IGetAllResource<WorkLog>, ICreateResource<WorkLog>, IDeleteResource<WorkLog>
{
}
}
|
using AxosoftAPI.NET.Core.Interfaces;
using AxosoftAPI.NET.Models;
namespace AxosoftAPI.NET.Interfaces
{
public interface IWorkLogs : IResource<WorkLog>
{
}
}
|
Support full API available for worklogs
|
Support full API available for worklogs
Adds ability to update a worklog and retrieve a single worklog as provided for in API: http://developer.axosoft.com/api#!/work_logs
|
C#
|
mit
|
Axosoft/AxosoftAPI.NET
|
f1e6a83fdd73c5589772ab9d3fef316853a5cd19
|
Source/ue4czmq/ue4czmq.Build.cs
|
Source/ue4czmq/ue4czmq.Build.cs
|
// Copyright 2015 Palm Stone Games, Inc. All Rights Reserved.
using System.IO;
namespace UnrealBuildTool.Rules
{
public class ue4czmq : ModuleRules
{
public ue4czmq(TargetInfo Target)
{
// Include paths
//PublicIncludePaths.AddRange(new string[] {});
//PrivateIncludePaths.AddRange(new string[] {});
// Dependencies
PublicDependencyModuleNames.AddRange(new string[] { "Core", "Engine", });
//PrivateDependencyModuleNames.AddRange(new string[] {});
// Dynamically loaded modules
//DynamicallyLoadedModuleNames.AddRange(new string[] {});
// Definitions
Definitions.Add("WITH_UE4CZMQ=1");
LoadLib(Target);
}
public void LoadLib(TargetInfo Target)
{
string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
// CZMQ
string czmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "czmq"));
PublicAdditionalLibraries.Add(Path.Combine(czmqPath, "Libraries", "czmq.lib"));
PrivateIncludePaths.Add(Path.Combine(czmqPath, "Includes"));
// LIBZMQ
string libzmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "libzmq"));
PrivateIncludePaths.Add(Path.Combine(libzmqPath, "Includes"));
}
}
}
|
// Copyright 2015 Palm Stone Games, Inc. All Rights Reserved.
using System.IO;
namespace UnrealBuildTool.Rules
{
public class ue4czmq : ModuleRules
{
public ue4czmq(TargetInfo Target)
{
// Include paths
//PublicIncludePaths.AddRange(new string[] {});
//PrivateIncludePaths.AddRange(new string[] {});
// Dependencies
PublicDependencyModuleNames.AddRange(new string[] { "Core", "Engine", });
//PrivateDependencyModuleNames.AddRange(new string[] {});
// Dynamically loaded modules
//DynamicallyLoadedModuleNames.AddRange(new string[] {});
// Definitions
Definitions.Add("WITH_UE4CZMQ=1");
LoadLib(Target);
}
public void LoadLib(TargetInfo Target)
{
string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
// CZMQ
string czmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "czmq"));
PrivateAdditionalLibraries.Add(Path.Combine(czmqPath, "Libraries", "czmq.lib"));
PrivateIncludePaths.Add(Path.Combine(czmqPath, "Includes"));
// LIBZMQ
string libzmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "libzmq"));
PrivateIncludePaths.Add(Path.Combine(libzmqPath, "Includes"));
}
}
}
|
Use a PrivateAdditionalLibrary for czmq.lib instead of a public one
|
Use a PrivateAdditionalLibrary for czmq.lib instead of a public one
|
C#
|
apache-2.0
|
DeltaMMO/ue4czmq,DeltaMMO/ue4czmq
|
31c27d73907cae7cd36a4dae0fa919231009dc16
|
NBi.Testing/Unit/Xml/XmlManagerTest.cs
|
NBi.Testing/Unit/Xml/XmlManagerTest.cs
|
using System;
using NBi.Xml;
using NUnit.Framework;
namespace NBi.Testing.Unit.Xml
{
[TestFixture]
public class XmlManagerTest
{
[Test]
public void Load_ValidFile_Success()
{
var filename = DiskOnFile.CreatePhysicalFile("TestSuite.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteSample.xml");
var manager = new XmlManager();
manager.Load(filename);
Assert.That(manager.TestSuite, Is.Not.Null);
}
[Test]
public void Load_ValidFile_TestContentIsCorrect()
{
var filename = DiskOnFile.CreatePhysicalFile("TestSuite.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteSample.xml");
var manager = new XmlManager();
manager.Load(filename);
Assert.That(manager.TestSuite.Tests[0].Content, Is.Not.Null);
}
[Test]
public void Load_InvalidFile_Successfully()
{
var filename = DiskOnFile.CreatePhysicalFile("TestSuiteInvalidSyntax.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteInvalidSyntax.xml");
var manager = new XmlManager();
Assert.Throws<ArgumentException>(delegate { manager.Load(filename); });
}
}
}
|
using System;
using NBi.Xml;
using NUnit.Framework;
namespace NBi.Testing.Unit.Xml
{
[TestFixture]
public class XmlManagerTest
{
[Test]
public void Load_ValidFile_Success()
{
var filename = DiskOnFile.CreatePhysicalFile("TestSuite.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteSample.xml");
var manager = new XmlManager();
manager.Load(filename);
Assert.That(manager.TestSuite, Is.Not.Null);
}
[Test]
public void Load_ValidFile_TestContentIsCorrect()
{
var filename = DiskOnFile.CreatePhysicalFile("TestContentIsCorrect.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteSample.xml");
var manager = new XmlManager();
manager.Load(filename);
Assert.That(manager.TestSuite.Tests[0].Content, Is.Not.Null);
}
[Test]
public void Load_InvalidFile_Successfully()
{
var filename = DiskOnFile.CreatePhysicalFile("TestSuiteInvalidSyntax.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteInvalidSyntax.xml");
var manager = new XmlManager();
Assert.Throws<ArgumentException>(delegate { manager.Load(filename); });
}
}
}
|
Fix failing test for TestContent in test redaction
|
Fix failing test for TestContent in test redaction
|
C#
|
apache-2.0
|
Seddryck/NBi,Seddryck/NBi
|
422df765046af985f4bc27119b234be623a14263
|
src/Binding/Properties/AssemblyInfo.cs
|
src/Binding/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;
// 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("Binding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Binding")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using Android;
[assembly: AssemblyTitle("Binding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Binding")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: LinkerSafe]
|
Add link safe attribute support
|
Add link safe attribute support
|
C#
|
apache-2.0
|
Plac3hold3r/PH.Wdullaer.Materialdatetimepicker,Plac3hold3r/PH.Wdullaer.Materialdatetimepicker,Plac3hold3r/PH.Wdullaer.Materialdatetimepicker
|
519f31ce81bbf886b3d048f42d6b32cdd5a5f739
|
poshsecframework/PShell/psfilenameeditor.cs
|
poshsecframework/PShell/psfilenameeditor.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace poshsecframework.PShell
{
class psfilenameeditor : System.Drawing.Design.UITypeEditor
{
public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return System.Drawing.Design.UITypeEditorEditStyle.Modal;
}
[RefreshProperties(System.ComponentModel.RefreshProperties.All)]
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context == null || context.Instance == null)
{
return base.EditValue(context, provider, value);
}
else
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Select " + context.PropertyDescriptor.DisplayName;
dlg.FileName = (string)value;
dlg.Filter = "All Files (*.*)|*.*";
if (dlg.ShowDialog() == DialogResult.OK)
{
value = dlg.FileName;
}
dlg.Dispose();
dlg = null;
return value;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace poshsecframework.PShell
{
class psfilenameeditor : System.Drawing.Design.UITypeEditor
{
public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return System.Drawing.Design.UITypeEditorEditStyle.Modal;
}
[RefreshProperties(System.ComponentModel.RefreshProperties.All)]
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context == null || context.Instance == null)
{
return base.EditValue(context, provider, value);
}
else
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Select " + context.PropertyDescriptor.DisplayName;
dlg.FileName = (string)value;
dlg.Filter = "All Files (*.*)|*.*";
dlg.CheckFileExists = false;
if (dlg.ShowDialog() == DialogResult.OK)
{
value = dlg.FileName;
}
dlg.Dispose();
dlg = null;
return value;
}
}
}
}
|
Allow File to not Exist in FileBrowse
|
Allow File to not Exist in FileBrowse
|
C#
|
bsd-3-clause
|
PoshSec/PoshSecFramework
|
4bc489bbdd95fb49f095bff9c6566708ad85e7f1
|
RuneScapeCacheToolsTests/RuneTek5CacheTests.cs
|
RuneScapeCacheToolsTests/RuneTek5CacheTests.cs
|
using System;
using Villermen.RuneScapeCacheTools.Cache;
using Villermen.RuneScapeCacheTools.Cache.RuneTek5;
using Xunit;
using Xunit.Abstractions;
namespace RuneScapeCacheToolsTests
{
public class RuneTek5CacheTests : IDisposable
{
private ITestOutputHelper _output;
private RuneTek5Cache _cache;
public RuneTek5CacheTests(ITestOutputHelper output)
{
_output = output;
_cache = new RuneTek5Cache("TestData");
}
/// <summary>
/// Test for a file that exists, an archive file that exists and a file that doesn't exist.
/// </summary>
[Fact]
public void TestGetFile()
{
var file = _cache.GetFile(12, 3);
var fileData = file.Data;
Assert.True(fileData.Length > 0, "File's data is empty.");
var archiveFile = _cache.GetFile(17, 5);
var archiveEntry = archiveFile.Entries[255];
Assert.True(archiveEntry.Length > 0, "Archive entry's data is empty.");
try
{
_cache.GetFile(40, 30);
Assert.True(false, "Cache returned a file that shouldn't exist.");
}
catch (CacheException exception)
{
Assert.True(exception.Message.Contains("incomplete"), "Non-existent file cache exception had the wrong message.");
}
}
public void Dispose()
{
_cache?.Dispose();
}
}
}
|
using System;
using Villermen.RuneScapeCacheTools.Cache;
using Villermen.RuneScapeCacheTools.Cache.RuneTek5;
using Xunit;
using Xunit.Abstractions;
namespace RuneScapeCacheToolsTests
{
public class RuneTek5CacheTests : IDisposable
{
private readonly ITestOutputHelper _output;
private readonly RuneTek5Cache _cache;
public RuneTek5CacheTests(ITestOutputHelper output)
{
_output = output;
_cache = new RuneTek5Cache("TestData");
}
/// <summary>
/// Test for a file that exists, an archive file that exists and a file that doesn't exist.
/// </summary>
[Fact]
public void TestGetFile()
{
var file = _cache.GetFile(12, 3);
var fileData = file.Data;
Assert.True(fileData.Length > 0, "File's data is empty.");
var archiveFile = _cache.GetFile(17, 5);
var archiveEntry = archiveFile.Entries[255];
Assert.True(archiveEntry.Length > 0, "Archive entry's data is empty.");
try
{
_cache.GetFile(40, 30);
Assert.True(false, "Cache returned a file that shouldn't exist.");
}
catch (CacheException exception)
{
Assert.True(exception.Message.Contains("incomplete"), "Non-existent file cache exception had the wrong message.");
}
}
public void Dispose()
{
_cache?.Dispose();
}
}
}
|
Add some readonly 's to tests
|
Add some readonly
's to tests
|
C#
|
mit
|
villermen/runescape-cache-tools,villermen/runescape-cache-tools
|
dbeb3f07053c759a2fc17a34a40f86dd93a9f7c1
|
src/WtsApi32.Tests/WtsApi32Facts.cs
|
src/WtsApi32.Tests/WtsApi32Facts.cs
|
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
using System;
using System.Linq;
using PInvoke;
using Xunit;
using Xunit.Abstractions;
using static PInvoke.WtsApi32;
public class WtsApi32Facts
{
private readonly ITestOutputHelper output;
public WtsApi32Facts(ITestOutputHelper output)
{
this.output = output;
}
[Fact]
public void CheckWorkingOfWtsSafeMemoryGuard()
{
System.Diagnostics.Debugger.Break();
WtsSafeSessionInfoGuard wtsSafeMemoryGuard = new WtsSafeSessionInfoGuard();
int sessionCount = 0;
Assert.True(WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, ref wtsSafeMemoryGuard, ref sessionCount));
Assert.NotEqual(0, sessionCount);
var list = wtsSafeMemoryGuard.Take(sessionCount).ToList();
foreach (var ses in list)
{
this.output.WriteLine($"{ses.pWinStationName}, {ses.SessionID}, {ses.State}");
}
}
}
|
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
using System;
using System.Linq;
using PInvoke;
using Xunit;
using Xunit.Abstractions;
using static PInvoke.WtsApi32;
public class WtsApi32Facts
{
private readonly ITestOutputHelper output;
public WtsApi32Facts(ITestOutputHelper output)
{
this.output = output;
}
[Fact]
public void CheckWorkingOfWtsSafeMemoryGuard()
{
WtsSafeSessionInfoGuard wtsSafeMemoryGuard = new WtsSafeSessionInfoGuard();
int sessionCount = 0;
Assert.True(WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, ref wtsSafeMemoryGuard, ref sessionCount));
Assert.NotEqual(0, sessionCount);
var list = wtsSafeMemoryGuard.Take(sessionCount).ToList();
foreach (var ses in list)
{
this.output.WriteLine($"{ses.pWinStationName}, {ses.SessionID}, {ses.State}");
}
}
}
|
Delete break from the test
|
Delete break from the test
|
C#
|
mit
|
vbfox/pinvoke,jmelosegui/pinvoke,AArnott/pinvoke
|
023dbd2c17c1b6de00a8a0a0e7b2479a5cbc75d9
|
IntervalTimer.cs
|
IntervalTimer.cs
|
using System;
using Microsoft.SPOT;
namespace IntervalTimer
{
public delegate void IntervalEventHandler(object sender, EventArgs e);
public class IntervalTimer
{
public TimeSpan ShortDuration { get; set; }
public TimeSpan LongDuration { get; set; }
public IntervalTimer(TimeSpan shortDuration, TimeSpan longDuration)
{
ShortDuration = shortDuration;
LongDuration = longDuration;
}
public IntervalTimer(int shortSeconds, int longSeconds)
{
ShortDuration = new TimeSpan(0, 0, shortSeconds);
LongDuration = new TimeSpan(0, 0, longSeconds);
}
}
}
|
using System;
using Microsoft.SPOT;
namespace IntervalTimer
{
public delegate void IntervalEventHandler(object sender, IntervalReachedEventArgs e);
public class IntervalTimer
{
public TimeSpan ShortDuration { get; set; }
public TimeSpan LongDuration { get; set; }
public IntervalTimer(TimeSpan shortDuration, TimeSpan longDuration)
{
ShortDuration = shortDuration;
LongDuration = longDuration;
}
public IntervalTimer(int shortSeconds, int longSeconds)
{
ShortDuration = new TimeSpan(0, 0, shortSeconds);
LongDuration = new TimeSpan(0, 0, longSeconds);
}
}
}
|
Use IntervalReachedEventArgs instead of EventArgs.
|
Use IntervalReachedEventArgs instead of EventArgs.
|
C#
|
mit
|
jcheng31/IntervalTimer
|
9796c345b01bbf6b7224720fce030ad748f16e62
|
src/platform/toolkit/restql/aspnet/Global.asax.cs
|
src/platform/toolkit/restql/aspnet/Global.asax.cs
|
using System;
using System.Web;
using System.Web.Configuration;
using ZMQ;
namespace Nohros.Toolkit.RestQL
{
public class Global : HttpApplication
{
static readonly Context zmq_context_;
#region .ctor
static Global() {
zmq_context_ = new Context(ZMQ.Context.DefaultIOThreads);
}
#endregion
protected void Application_Start(object sender, EventArgs e) {
string config_file_name =
WebConfigurationManager.AppSettings[Strings.kConfigFileNameKey];
string config_file_path = Server.MapPath(config_file_name);
Settings settings = new Settings.Loader()
.Load(config_file_path, Strings.kConfigRootNodeName);
var factory = new HttpQueryApplicationFactory(settings);
Application[Strings.kApplicationKey] = factory.CreateQueryApplication();
}
protected void Session_Start(object sender, EventArgs e) {
}
protected void Application_BeginRequest(object sender, EventArgs e) {
}
protected void Application_AuthenticateRequest(object sender, EventArgs e) {
}
protected void Application_Error(object sender, EventArgs e) {
}
protected void Session_End(object sender, EventArgs e) {
}
protected void Application_End(object sender, EventArgs e) {
var app = Application[Strings.kApplicationKey] as HttpQueryApplication;
if (app != null) {
app.Stop();
app.Dispose();
}
zmq_context_.Dispose();
}
}
}
|
using System;
using System.Web;
using System.Web.Configuration;
using ZMQ;
namespace Nohros.Toolkit.RestQL
{
public class Global : HttpApplication
{
static readonly Context zmq_context_;
#region .ctor
static Global() {
zmq_context_ = new Context(ZMQ.Context.DefaultIOThreads);
}
#endregion
protected void Application_Start(object sender, EventArgs e) {
string config_file_name =
WebConfigurationManager.AppSettings[Strings.kConfigFileNameKey];
string config_file_path = Server.MapPath(config_file_name);
Settings settings = new Settings.Loader()
.Load(config_file_path, Strings.kConfigRootNodeName);
var factory = new HttpQueryApplicationFactory(settings);
HttpQueryApplication app = factory.CreateQueryApplication();
Application[Strings.kApplicationKey] = app;
app.Start();
}
protected void Session_Start(object sender, EventArgs e) {
}
protected void Application_BeginRequest(object sender, EventArgs e) {
}
protected void Application_AuthenticateRequest(object sender, EventArgs e) {
}
protected void Application_Error(object sender, EventArgs e) {
}
protected void Session_End(object sender, EventArgs e) {
}
protected void Application_End(object sender, EventArgs e) {
var app = Application[Strings.kApplicationKey] as HttpQueryApplication;
if (app != null) {
app.Stop();
app.Dispose();
}
zmq_context_.Dispose();
}
}
}
|
Fix a bug that causes the application to not start. This happen because the Start method was not begin called.
|
Fix a bug that causes the application to not start. This happen because the Start method was not begin called.
|
C#
|
mit
|
nohros/must,nohros/must,nohros/must
|
aec4cb0ef5058b6f6e321693a23f5c9860a2f983
|
Assets/Resources/Scripts/game/model/Settings.cs
|
Assets/Resources/Scripts/game/model/Settings.cs
|
using UnityEngine;
public class Settings {
public static Player
p1 = new RandomAI(null, 1, Color.red, Resources.Load<Sprite>("Sprites/x"), "X"),
p2 = new RandomAI(null, 2, Color.blue, Resources.Load<Sprite>("Sprites/o"), "O");
}
|
using UnityEngine;
public class Settings {
public static Player p1 = RandomAI(true), p2 = RandomAI(false);
public static RandomAI RandomAI(bool firstPlayer)
{
int turn = firstPlayer ? 1 : 2;
Color color = firstPlayer ? Color.red : Color.blue;
Sprite sprite =
Resources.Load<Sprite>("Sprites/" + (firstPlayer ? "x" : "o"));
string name = firstPlayer ? "X" : "O";
return new RandomAI(null, turn, color, sprite, name);
}
}
|
Add RandomAI() method for fast generation of simple random players
|
Add RandomAI() method for fast generation of simple random players
|
C#
|
mit
|
Curdflappers/UltimateTicTacToe
|
458f9631df0aece3b1122c288bd10ba65baa6614
|
A-vs-An/AvsAn-Test/StandardCasesWork.cs
|
A-vs-An/AvsAn-Test/StandardCasesWork.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AvsAnLib;
using ExpressionToCodeLib;
using NUnit.Framework;
namespace AvsAn_Test {
public class StandardCasesWork {
[TestCase("an", "unanticipated result")]
[TestCase("a", "unanimous vote")]
[TestCase("an", "honest decision")]
[TestCase("a", "honeysuckle shrub")]
[TestCase("an", "0800 number")]
[TestCase("an", "∞ of oregano")]
[TestCase("a", "NASA scientist")]
[TestCase("an", "NSA analyst")]
[TestCase("a", "FIAT car")]
[TestCase("an", "FAA policy")]
[TestCase("an", "A")]
public void DoTest(string article, string word) {
PAssert.That(() => AvsAn.Query(word).Article == article);
}
[TestCase("a", "", "")]
[TestCase("a", "'", "'")]
[TestCase("an", "N", "N ")]
[TestCase("a", "NASA", "NAS")]
public void CheckOddPrefixes(string article, string word, string prefix) {
PAssert.That(() => AvsAn.Query(word).Article == article && AvsAn.Query(word).Prefix == prefix);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AvsAnLib;
using ExpressionToCodeLib;
using NUnit.Framework;
namespace AvsAn_Test {
public class StandardCasesWork {
[TestCase("an", "unanticipated result")]
[TestCase("a", "unanimous vote")]
[TestCase("an", "honest decision")]
[TestCase("a", "honeysuckle shrub")]
[TestCase("an", "0800 number")]
[TestCase("an", "∞ of oregano")]
[TestCase("a", "NASA scientist")]
[TestCase("an", "NSA analyst")]
[TestCase("a", "FIAT car")]
[TestCase("an", "FAA policy")]
[TestCase("an", "A")]
[TestCase("a", "uniformed agent")]
[TestCase("an", "unissued permit")]
[TestCase("an", "unilluminating argument")]
public void DoTest(string article, string word) {
PAssert.That(() => AvsAn.Query(word).Article == article);
}
[TestCase("a", "", "")]
[TestCase("a", "'", "'")]
[TestCase("an", "N", "N ")]
[TestCase("a", "NASA", "NAS")]
public void CheckOddPrefixes(string article, string word, string prefix) {
PAssert.That(() => AvsAn.Query(word).Article == article && AvsAn.Query(word).Prefix == prefix);
}
}
}
|
Add two (currently failing) tests. Hopefully the new wikiextractor will deal with these corner cases (unissued, unilluminating).
|
Add two (currently failing) tests.
Hopefully the new wikiextractor will deal with these corner cases (unissued, unilluminating).
|
C#
|
apache-2.0
|
EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an
|
d5bacbbc7bd3e989430cfe01534dd3c531e37ef4
|
src/NHasher/HashExtensions.cs
|
src/NHasher/HashExtensions.cs
|
namespace NHasher
{
internal static class HashExtensions
{
public static ulong RotateLeft(this ulong original, int bits)
{
return (original << bits) | (original >> (64 - bits));
}
public static uint RotateLeft(this uint original, int bits)
{
return (original << bits) | (original >> (32 - bits));
}
internal static unsafe ulong GetUInt64(this byte[] data, int position)
{
// we only read aligned longs, so a simple casting is enough
fixed (byte* pbyte = &data[position])
{
return *((ulong*)pbyte);
}
}
internal static unsafe uint GetUInt32(this byte[] data, int position)
{
// we only read aligned longs, so a simple casting is enough
fixed (byte* pbyte = &data[position])
{
return *((uint*)pbyte);
}
}
}
}
|
using System.Runtime.CompilerServices;
namespace NHasher
{
internal static class HashExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ulong RotateLeft(this ulong original, int bits)
{
return (original << bits) | (original >> (64 - bits));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint RotateLeft(this uint original, int bits)
{
return (original << bits) | (original >> (32 - bits));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe ulong GetUInt64(this byte[] data, int position)
{
// we only read aligned longs, so a simple casting is enough
fixed (byte* pbyte = &data[position])
{
return *((ulong*)pbyte);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe uint GetUInt32(this byte[] data, int position)
{
// we only read aligned longs, so a simple casting is enough
fixed (byte* pbyte = &data[position])
{
return *((uint*)pbyte);
}
}
}
}
|
Add AggressiveInlining for Rotate and Get functions
|
Add AggressiveInlining for Rotate and Get functions
|
C#
|
mit
|
CDuke/NHasher
|
b0a45d73220214e51eea883a1fa1b4dd5b86c0dd
|
MonkeyTests/MonkeyHelper/Code/Constants.tstest.cs
|
MonkeyTests/MonkeyHelper/Code/Constants.tstest.cs
|
using Telerik.TestingFramework.Controls.KendoUI;
using Telerik.WebAii.Controls.Html;
using Telerik.WebAii.Controls.Xaml;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using ArtOfTest.Common.UnitTesting;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using ArtOfTest.WebAii.Design;
using ArtOfTest.WebAii.Design.Execution;
using ArtOfTest.WebAii.ObjectModel;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.Silverlight.UI;
namespace MonkeyTests
{
public static class Constans
{
public static string BrowserWaitUntilReady = @"MonkeyHelper\Steps\BrowserWaitUntilReady.tstest";
public static string NavigationToBaseUrl = @"MonkeyHelper\Steps\NavigationToBaseUrl.tstest";
public static string ClickOnElement = @"MonkeyHelper\Steps\ClickOnElement.tstest";
}
}
|
using Telerik.TestingFramework.Controls.KendoUI;
using Telerik.WebAii.Controls.Html;
using Telerik.WebAii.Controls.Xaml;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using ArtOfTest.Common.UnitTesting;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using ArtOfTest.WebAii.Design;
using ArtOfTest.WebAii.Design.Execution;
using ArtOfTest.WebAii.ObjectModel;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.Silverlight.UI;
namespace MonkeyTests
{
public static class Constans
{
public static string BrowserWaitUntilReady = @"MonkeyTests\MonkeyHelper\Steps\MonkeyHelper_BrowserWaitUntilReady.tstest";
public static string NavigationToBaseUrl = @"MonkeyTests\MonkeyHelper\Steps\MonkeyHelper_NavigationToBaseUrl.tstest";
public static string ClickOnElement = @"MonkeyTests\MonkeyHelper\Steps\MonkeyHelper_ClickOnElement.tstest";
}
}
|
Change constants file. Fixed path to MonkeyHelper.
|
Change constants file. Fixed path to MonkeyHelper.
|
C#
|
mit
|
VitalyaKvas/MonkeyHelper
|
1f226cbeae1919dcc10e8ee522e03ebb9f116fa3
|
Bialjam/Assets/Gra/LightManager.cs
|
Bialjam/Assets/Gra/LightManager.cs
|
using UnityEngine;
using System.Collections;
public class LightManager {
Material LightOnMaterial;
Material LightOffMaterial;
public bool IsOn = true;
// Use this for initialization
public void UpdateLights() {
GameObject[] allLights = GameObject.FindGameObjectsWithTag ("Light");
foreach (GameObject i in allLights) {
i.SetActive (IsOn);
}
SpriteRenderer[] bitmaps = GameObject.FindObjectsOfType<SpriteRenderer>();
if (IsOn) {
foreach (SpriteRenderer i in bitmaps) {
i.material = LightOnMaterial;
}
} else {
foreach (SpriteRenderer i in bitmaps) {
i.material = LightOffMaterial;
}
}
}
public void SetLights(bool enabled) {
IsOn = enabled;
UpdateLights ();
}
private static LightManager instance;
public static LightManager Instance
{
get
{
if(instance==null)
{
instance = new LightManager();
instance.LightOnMaterial = Resources.Load("Materials/LightOnMaterial", typeof(Material)) as Material;
instance.LightOffMaterial = Resources.Load("Materials/LightOffMaterial", typeof(Material)) as Material;
}
return instance;
}
}
}
|
using UnityEngine;
using System.Collections;
public class LightManager {
Material LightOnMaterial;
Material LightOffMaterial;
public bool IsOn = true;
// Use this for initialization
public void UpdateLights() {
bool lightOn = IsOn;
if (!Application.loadedLevelName.StartsWith ("Level"))
lightOn = false;
GameObject[] allLights = GameObject.FindGameObjectsWithTag ("Light");
foreach (GameObject i in allLights) {
i.SetActive (lightOn);
}
SpriteRenderer[] bitmaps = GameObject.FindObjectsOfType<SpriteRenderer>();
if (lightOn) {
foreach (SpriteRenderer i in bitmaps) {
i.material = LightOnMaterial;
}
} else {
foreach (SpriteRenderer i in bitmaps) {
i.material = LightOffMaterial;
}
}
}
public void SetLights(bool enabled) {
IsOn = enabled;
UpdateLights ();
}
private static LightManager instance;
public static LightManager Instance
{
get
{
if(instance==null)
{
instance = new LightManager();
instance.LightOnMaterial = Resources.Load("Materials/LightOnMaterial", typeof(Material)) as Material;
instance.LightOffMaterial = Resources.Load("Materials/LightOffMaterial", typeof(Material)) as Material;
}
return instance;
}
}
}
|
Make lights not appear in menu
|
Make lights not appear in menu
|
C#
|
cc0-1.0
|
BialJam/NieWiemAndrzejuNaprawdeNieWiem
|
90f34a4bc06ba02bd2a13e035b540656cc8e2e00
|
WalletWasabi.Gui/Behaviors/CommandOnDoubleClickBehavior.cs
|
WalletWasabi.Gui/Behaviors/CommandOnDoubleClickBehavior.cs
|
using Avalonia.Controls;
using System.Reactive.Disposables;
namespace WalletWasabi.Gui.Behaviors
{
public class CommandOnDoubleClickBehavior : CommandBasedBehavior<Control>
{
private CompositeDisposable _disposables;
protected override void OnAttached()
{
_disposables = new CompositeDisposable();
base.OnAttached();
_disposables.Add(AssociatedObject.AddHandler(Control.PointerPressedEvent, (sender, e) =>
{
if(e.ClickCount == 2)
{
e.Handled = ExecuteCommand();
}
}));
}
protected override void OnDetaching()
{
base.OnDetaching();
_disposables.Dispose();
}
}
}
|
using Avalonia.Controls;
using System.Reactive.Disposables;
namespace WalletWasabi.Gui.Behaviors
{
public class CommandOnDoubleClickBehavior : CommandBasedBehavior<Control>
{
private CompositeDisposable Disposables { get; set; }
protected override void OnAttached()
{
Disposables = new CompositeDisposable();
base.OnAttached();
Disposables.Add(AssociatedObject.AddHandler(Control.PointerPressedEvent, (sender, e) =>
{
if (e.ClickCount == 2)
{
e.Handled = ExecuteCommand();
}
}));
}
protected override void OnDetaching()
{
base.OnDetaching();
Disposables?.Dispose();
}
}
}
|
Use property instead of field for CompositeDisposable
|
Use property instead of field for CompositeDisposable
|
C#
|
mit
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
cd51733ae03a3453b2cb8c5af6fce20f776cbc50
|
Mond/Libraries/Console/ConsoleOutput.cs
|
Mond/Libraries/Console/ConsoleOutput.cs
|
using Mond.Binding;
namespace Mond.Libraries.Console
{
[MondClass("")]
internal class ConsoleOutputClass
{
private ConsoleOutputLibrary _consoleOutput;
public static MondValue Create(ConsoleOutputLibrary consoleOutput)
{
MondValue prototype;
MondClassBinder.Bind<ConsoleOutputClass>(out prototype);
var instance = new ConsoleOutputClass();
instance._consoleOutput = consoleOutput;
var obj = new MondValue(MondValueType.Object);
obj.UserData = instance;
obj.Prototype = prototype;
obj.Lock();
return obj;
}
[MondFunction("print")]
public void Print(params MondValue[] arguments)
{
foreach (var v in arguments)
{
_consoleOutput.Out.Write((string)v);
}
}
[MondFunction("printLn")]
public void PrintLn(params MondValue[] arguments)
{
if (arguments.Length == 0)
_consoleOutput.Out.WriteLine();
foreach (var v in arguments)
{
_consoleOutput.Out.Write((string)v);
_consoleOutput.Out.WriteLine();
}
}
}
}
|
using Mond.Binding;
namespace Mond.Libraries.Console
{
[MondClass("")]
internal class ConsoleOutputClass
{
private ConsoleOutputLibrary _consoleOutput;
public static MondValue Create(ConsoleOutputLibrary consoleOutput)
{
MondValue prototype;
MondClassBinder.Bind<ConsoleOutputClass>(out prototype);
var instance = new ConsoleOutputClass();
instance._consoleOutput = consoleOutput;
var obj = new MondValue(MondValueType.Object);
obj.UserData = instance;
obj.Prototype = prototype;
obj.Lock();
return obj;
}
[MondFunction("print")]
public void Print(params MondValue[] arguments)
{
foreach (var v in arguments)
{
_consoleOutput.Out.Write((string)v);
}
}
[MondFunction("printLn")]
public void PrintLn(params MondValue[] arguments)
{
foreach (var v in arguments)
{
_consoleOutput.Out.Write((string)v);
}
_consoleOutput.Out.WriteLine();
}
}
}
|
Change printLn to print all values followed by a newline
|
Change printLn to print all values followed by a newline
|
C#
|
mit
|
Rohansi/Mond,Rohansi/Mond,SirTony/Mond,Rohansi/Mond,SirTony/Mond,SirTony/Mond
|
34dc452221cc5d8fd42d0c6d1a84c0bcf0a0b7f8
|
HALClient/Properties/AssemblyInfo.cs
|
HALClient/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("HALClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HALClient")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("HALClient.Tests")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HALClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HALClient")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("HALClient.Tests")]
// 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.5.0")]
[assembly: AssemblyFileVersion("0.5.0")]
|
Set the version to a trepidatious 0.5
|
Set the version to a trepidatious 0.5
|
C#
|
apache-2.0
|
Xerosigma/halclient
|
9ae7005681cd81308397716507cb594f66ff6484
|
Android/Layout/TabFragment.cs
|
Android/Layout/TabFragment.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Database;
using Android.Graphics;
using Android.OS;
using Android.Runtime;
using Android.Support.Design.Widget;
using Android.Support.V4.Widget;
using Android.Support.V4.View;
using Android.Support.V7.App;
using Android.Support.V7.Widget;
using Android.Utilities;
using Android.Views;
using Android.Widget;
using Java.Lang;
using Fragment = Android.Support.V4.App.Fragment;
using Toolbar = Android.Support.V7.Widget.Toolbar;
using SearchView = Android.Support.V7.Widget.SearchView;
namespace Android.Utilities
{
public abstract class TabFragment : Fragment
{
public abstract string Title { get; }
protected virtual void OnGotFocus() { }
protected virtual void OnLostFocus() { }
public virtual void Refresh() { }
public override void SetMenuVisibility(bool visible)
{
base.SetMenuVisibility(visible);
if (visible)
OnGotFocus();
else
OnLostFocus();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Database;
using Android.Graphics;
using Android.OS;
using Android.Runtime;
using Android.Support.Design.Widget;
using Android.Support.V4.Widget;
using Android.Support.V4.View;
using Android.Support.V7.App;
using Android.Support.V7.Widget;
using Android.Utilities;
using Android.Views;
using Android.Widget;
using Java.Lang;
using Fragment = Android.Support.V4.App.Fragment;
using Toolbar = Android.Support.V7.Widget.Toolbar;
using SearchView = Android.Support.V7.Widget.SearchView;
namespace Android.Utilities
{
public abstract class TabFragment : Fragment
{
public abstract string Title { get; }
protected virtual void OnGotFocus() { }
protected virtual void OnLostFocus() { }
public virtual void Refresh() { }
public override void SetMenuVisibility(bool visible)
{
base.SetMenuVisibility(visible);
/*if (visible)
OnGotFocus();
else
OnLostFocus();*/
}
public override bool UserVisibleHint
{
get
{
return base.UserVisibleHint;
}
set
{
base.UserVisibleHint = value;
if (value)
OnGotFocus();
else
OnLostFocus();
}
}
}
}
|
Use UserVisibilityHint to detect ViewPager change instead of MenuVisibility, this fixes an Exception.
|
Use UserVisibilityHint to detect ViewPager change instead of MenuVisibility, this fixes an Exception.
|
C#
|
mit
|
jbatonnet/shared
|
7ba0f1c56ae7799036a56c11ef62dc410f993e8b
|
SimpSim.NET/Registers.cs
|
SimpSim.NET/Registers.cs
|
namespace SimpSim.NET
{
public class Registers
{
public delegate void ValueWrittenToOutputRegisterHandler(char output);
public event ValueWrittenToOutputRegisterHandler ValueWrittenToOutputRegister;
private readonly byte[] _array;
public Registers()
{
_array = new byte[16];
}
public byte this[byte register]
{
get
{
return _array[register];
}
set
{
_array[register] = value;
if (register == 0x0f && ValueWrittenToOutputRegister != null)
ValueWrittenToOutputRegister((char)value);
}
}
}
}
|
namespace SimpSim.NET
{
public class Registers
{
public delegate void ValueWrittenToOutputRegisterHandler(char output);
public event ValueWrittenToOutputRegisterHandler ValueWrittenToOutputRegister;
private readonly byte[] _array;
public Registers()
{
_array = new byte[16];
}
public byte this[byte register]
{
get
{
return _array[register];
}
set
{
_array[register] = value;
if (register == 0x0f)
ValueWrittenToOutputRegister?.Invoke((char)value);
}
}
}
}
|
Use null propagation when invoking ValueWrittenToOutputRegister to prevent possible race condition.
|
Use null propagation when invoking ValueWrittenToOutputRegister to prevent possible race condition.
|
C#
|
mit
|
ryanjfitz/SimpSim.NET
|
3f4ae0b822dbfcd4d86689dbdf0d5e63b5fe30b0
|
Utils/Helpers/Strings.cs
|
Utils/Helpers/Strings.cs
|
using System;
namespace Utils
{
public static class Strings
{
public static Tuple<string, string> SplitString(this string str, char separator)
{
var index = str.IndexOf(separator);
var str2 = str.Length > index?str.Substring(index + 1):string.Empty;
var str1 = str.Substring(0, index);
return new Tuple<string, string>(str1, str2);
}
}
}
|
using System;
namespace Utils
{
public static class Strings
{
public static Tuple<string, string> SplitString(this string str, char separator)
{
var index = str.IndexOf(separator);
var str2 = str.Length > index?str.Substring(index + 1):string.Empty;
var str1 = str.Substring(0, index);
return new Tuple<string, string>(str1, str2);
}
public static void Trim<T>(this T obj, Expression<Func<T, string>> action) where T : class
{
var expression = (MemberExpression)action.Body;
var member = expression.Member;
Action<string> setProperty;
Func<string> getPropertyValue;
switch (member.MemberType)
{
case MemberTypes.Field:
setProperty = val => ((FieldInfo)member).SetValue(obj,val);
getPropertyValue = () => ((FieldInfo)member).GetValue(obj)?.ToString();
break;
case MemberTypes.Property:
setProperty = val => ((PropertyInfo)member).SetValue(obj, val);
getPropertyValue = () => ((PropertyInfo) member).GetValue(obj)?.ToString();
break;
default:
throw new ArgumentOutOfRangeException();
}
var trimmedString = getPropertyValue().Trim();
setProperty(trimmedString);
}
}
}
|
Add Trim string property extension
|
Add Trim string property extension
to use obj.Trim(x => x.Prop1);
|
C#
|
bsd-3-clause
|
stadub/Net.Utils
|
6efc5cc5e25f97095cd11e9524a93a96711b8f87
|
ZimmerBot.Core.Tests/BotTests/ContinueTests.cs
|
ZimmerBot.Core.Tests/BotTests/ContinueTests.cs
|
using NUnit.Framework;
namespace ZimmerBot.Core.Tests.BotTests
{
[TestFixture]
public class ContinueTests : TestHelper
{
[Test]
public void CanContinueWithEmptyTarget()
{
BuildBot(@"
> Hello
: Hi
! continue
> *
! weight 0.5
: What can I help you with?
");
AssertDialog("Hello", "Hi\nWhat can I help you with?");
}
[Test]
public void CanContinueWithLabel()
{
BuildBot(@"
> Yo
: Yaj!
! continue at HowIsItGoing
<HowIsItGoing>
: How is it going?
>
: What can I help you with?
");
AssertDialog("Yo!", "Yaj!\nHow is it going?");
}
[Test]
public void CanContinueWithNewInput()
{
BuildBot(@"
> Yo
: Yaj!
! continue with Having Fun
> Having Fun
: is it fun
>
: What can I help you with?
");
AssertDialog("Yo!", "Yaj!\nis it fun");
}
}
}
|
using NUnit.Framework;
namespace ZimmerBot.Core.Tests.BotTests
{
[TestFixture]
public class ContinueTests : TestHelper
{
[Test]
public void CanContinueWithEmptyTarget()
{
BuildBot(@"
> Hello
: Hi
! continue
> *
! weight 0.5
: What can I help you with?
");
AssertDialog("Hello", "Hi\nWhat can I help you with?");
}
[Test]
public void CanContinueWithLabel()
{
BuildBot(@"
> Yo
: Yaj!
! continue at HowIsItGoing
<HowIsItGoing>
: How is it going?
>
: What can I help you with?
");
AssertDialog("Yo!", "Yaj!\nHow is it going?");
}
[Test]
public void CanContinueWithNewInput()
{
BuildBot(@"
> Yo
: Yaj!
! continue with Having Fun
> Having Fun
: is it fun
>
: What can I help you with?
");
AssertDialog("Yo!", "Yaj!\nis it fun");
}
[Test]
public void CanContinueWithParameters()
{
BuildBot(@"
> Yo +
: Yaj!
! continue with Some <1>
> Some +
: Love '<1>'
");
AssertDialog("Yo Mouse", "Yaj!\nLove 'Mouse'");
}
}
}
|
Add test showing problem with "continue with".
|
Add test showing problem with "continue with".
|
C#
|
mit
|
JornWildt/ZimmerBot
|
b58afa3eb693c29d74d5aac93f7160f5f35dc639
|
osu.Game/Skinning/LegacySkinConfiguration.cs
|
osu.Game/Skinning/LegacySkinConfiguration.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.Skinning
{
public class LegacySkinConfiguration : DefaultSkinConfiguration
{
public const decimal LATEST_VERSION = 2.7m;
/// <summary>
/// Legacy version of this skin. Null if no version was set to allow fallback to a parent skin version.
/// </summary>
public decimal? LegacyVersion { get; internal set; }
public enum LegacySetting
{
Version,
}
}
}
|
// 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.Skinning
{
public class LegacySkinConfiguration : DefaultSkinConfiguration
{
public const decimal LATEST_VERSION = 2.7m;
/// <summary>
/// Legacy version of this skin.
/// </summary>
public decimal? LegacyVersion { get; internal set; }
public enum LegacySetting
{
Version,
}
}
}
|
Remove unnecessary mentioning in xmldoc
|
Remove unnecessary mentioning in xmldoc
|
C#
|
mit
|
ppy/osu,ppy/osu,2yangk23/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,johnneijzen/osu,2yangk23/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipooo/osu,johnneijzen/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,EVAST9919/osu,EVAST9919/osu,smoogipoo/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu
|
3b672b16c5c6a0b7253a4b5ed72f79fcd8cac683
|
LaunchNumbering/LNSettings.cs
|
LaunchNumbering/LNSettings.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LaunchNumbering
{
public class LNSettings : GameParameters.CustomParameterNode
{
public override GameParameters.GameMode GameMode => GameParameters.GameMode.ANY;
public override bool HasPresets => false;
public override string Section => "Launch Numbering";
public override int SectionOrder => 1;
public override string Title => "Vessel Defaults";
[GameParameters.CustomParameterUI("Numbering Scheme")]
public NumberScheme Scheme { get; set; }
[GameParameters.CustomParameterUI("Show Bloc numbers")]
public bool ShowBloc { get; set; }
[GameParameters.CustomParameterUI("Bloc Numbering Scheme")]
public NumberScheme BlocScheme { get; set; }
public enum NumberScheme
{
Arabic,
Roman
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LaunchNumbering
{
public class LNSettings : GameParameters.CustomParameterNode
{
public override GameParameters.GameMode GameMode => GameParameters.GameMode.ANY;
public override bool HasPresets => false;
public override string Section => "Launch Numbering";
public override int SectionOrder => 1;
public override string Title => "Vessel Defaults";
[GameParameters.CustomParameterUI("Numbering Scheme")]
public NumberScheme Scheme { get; set; }
[GameParameters.CustomParameterUI("Show Bloc numbers")]
public bool ShowBloc { get; set; } = true;
[GameParameters.CustomParameterUI("Bloc Numbering Scheme")]
public NumberScheme BlocScheme { get; set; } = NumberScheme.Roman;
public enum NumberScheme
{
Arabic,
Roman
}
}
}
|
Set suitable default settings, in accordance with the prophecy
|
Set suitable default settings, in accordance with the prophecy
|
C#
|
mit
|
Damien-The-Unbeliever/KSPLaunchNumbering
|
a06135a365155cfb3206d7977a041777ef36dc15
|
Assignment2Application/UnitTestProject1/UnitTest1.cs
|
Assignment2Application/UnitTestProject1/UnitTest1.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Assignment2Application;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
FibonacciGenerator _gen = new FibonacciGenerator();
[TestMethod]
public void FibonacciGeneratorBasic()
{
Assert.Equals(_gen.Get(0), 0);
Assert.Equals(_gen.Get(1), 1);
Assert.Equals(_gen.Get(2), 1);
Assert.Equals(_gen.Get(3), 2);
Assert.Equals(_gen.Get(4), 3);
Assert.Equals(_gen.Get(5), 5);
}
[TestMethod]
public void FibonacciGenerator9()
{
Assert.Equals(_gen.Get(9), 34);
}
[TestMethod]
public void FibonacciGeneratorBig()
{
Assert.AreNotSame(_gen.Get(12345678), 0);
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Assignment2Application;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
FibonacciGenerator _gen = new FibonacciGenerator();
[TestMethod]
public void FibonacciGeneratorBasic()
{
Assert.AreEqual(_gen.Get(0), 0);
Assert.AreEqual(_gen.Get(1), 1);
Assert.AreEqual(_gen.Get(2), 1);
Assert.AreEqual(_gen.Get(3), 2);
Assert.AreEqual(_gen.Get(4), 3);
Assert.AreEqual(_gen.Get(5), 5);
}
[TestMethod]
public void FibonacciGenerator9()
{
Assert.AreEqual(_gen.Get(9), 34);
}
[TestMethod]
public void FibonacciGeneratorBig()
{
Assert.AreNotSame(_gen.Get(12345678), 0);
}
}
}
|
Replace deprecated Equals API by AreEqual
|
Replace deprecated Equals API by AreEqual
|
C#
|
mit
|
prifio/Assignment2,vors/Assignment2
|
0b3a8e049280b9d916e641202f2a3d0f63f23009
|
Confuser.Core/Project/Patterns/NamespaceFunction.cs
|
Confuser.Core/Project/Patterns/NamespaceFunction.cs
|
using System;
using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
/// <summary>
/// A function that compare the namespace of definition.
/// </summary>
public class NamespaceFunction : PatternFunction {
internal const string FnName = "namespace";
/// <inheritdoc />
public override string Name {
get { return FnName; }
}
/// <inheritdoc />
public override int ArgumentCount {
get { return 1; }
}
/// <inheritdoc />
public override object Evaluate(IDnlibDef definition) {
if (!(definition is TypeDef) && !(definition is IMemberDef))
return false;
object ns = Arguments[0].Evaluate(definition);
var type = definition as TypeDef;
if (type == null)
type = ((IMemberDef)definition).DeclaringType;
while (type.IsNested)
type = type.DeclaringType;
return type != null && type.Namespace == ns.ToString();
}
}
}
|
using System;
using System.Text.RegularExpressions;
using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
/// <summary>
/// A function that compare the namespace of definition.
/// </summary>
public class NamespaceFunction : PatternFunction {
internal const string FnName = "namespace";
/// <inheritdoc />
public override string Name {
get { return FnName; }
}
/// <inheritdoc />
public override int ArgumentCount {
get { return 1; }
}
/// <inheritdoc />
public override object Evaluate(IDnlibDef definition) {
if (!(definition is TypeDef) && !(definition is IMemberDef))
return false;
var ns = Arguments[0].Evaluate(definition).ToString();
var type = definition as TypeDef;
if (type == null)
type = ((IMemberDef)definition).DeclaringType;
while (type.IsNested)
type = type.DeclaringType;
return type != null && Regex.IsMatch(type.Namespace, ns);
}
}
}
|
Use Regex in namespace pattern
|
Use Regex in namespace pattern
|
C#
|
mit
|
engdata/ConfuserEx,Desolath/ConfuserEx3,Desolath/Confuserex,yeaicc/ConfuserEx
|
8d08686469e98c88d2d4594c32a91dfd5c0f3892
|
Tests/Linq/UserTests/Issue1556Tests.cs
|
Tests/Linq/UserTests/Issue1556Tests.cs
|
using System;
using System.Linq;
using LinqToDB;
using NUnit.Framework;
namespace Tests.UserTests
{
[TestFixture]
public class Issue1556Tests : TestBase
{
[Test]
public void Issue1556Test([DataSources(ProviderName.Sybase, ProviderName.OracleNative)] string context)
{
using (var db = GetDataContext(context))
{
AreEqual(
from p in db.Parent
from c in db.Child
where p.ParentID == c.ParentID || c.GrandChildren.Any(y => y.ParentID == p.ParentID)
select new { p, c }
,
db.Parent
.InnerJoin(db.Child,
(p,c) => p.ParentID == c.ParentID || c.GrandChildren.Any(y => y.ParentID == p.ParentID),
(p,c) => new { p, c }));
}
}
}
}
|
using System;
using System.Linq;
using LinqToDB;
using NUnit.Framework;
namespace Tests.UserTests
{
[TestFixture]
public class Issue1556Tests : TestBase
{
[Test]
public void Issue1556Test(
[DataSources(ProviderName.Sybase, ProviderName.OracleNative, ProviderName.Access)] string context)
{
using (var db = GetDataContext(context))
{
AreEqual(
from p in db.Parent
from c in db.Child
where p.ParentID == c.ParentID || c.GrandChildren.Any(y => y.ParentID == p.ParentID)
select new { p, c }
,
db.Parent
.InnerJoin(db.Child,
(p,c) => p.ParentID == c.ParentID || c.GrandChildren.Any(y => y.ParentID == p.ParentID),
(p,c) => new { p, c }));
}
}
}
}
|
Access dos not support such join syntax.
|
Access dos not support such join syntax.
|
C#
|
mit
|
ronnyek/linq2db,LinqToDB4iSeries/linq2db,MaceWindu/linq2db,linq2db/linq2db,LinqToDB4iSeries/linq2db,MaceWindu/linq2db,linq2db/linq2db
|
74695653ca025d96fdffa6a781866f7a845dc0ba
|
InfinniPlatform.SystemConfig/Metadata/MetadataUniqueName.cs
|
InfinniPlatform.SystemConfig/Metadata/MetadataUniqueName.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace InfinniPlatform.Core.Metadata
{
public class MetadataUniqueName : IEquatable<MetadataUniqueName>
{
private const char NamespaceSeparator = '.';
public MetadataUniqueName(string ns, string name)
{
Namespace = ns;
Name = name;
}
public MetadataUniqueName(string fullQuelifiedName)
{
Namespace = fullQuelifiedName.Remove(fullQuelifiedName.LastIndexOf(NamespaceSeparator));
Name = fullQuelifiedName.Split(NamespaceSeparator).Last();
}
public string Namespace { get; }
public string Name { get; }
public bool Equals(MetadataUniqueName other)
{
return Namespace.Equals(other.Namespace) && Name.Equals(other.Name);
}
public override string ToString()
{
return $"{Namespace}.{Name}";
}
public override int GetHashCode()
{
return Namespace.GetHashCode() ^ Name.GetHashCode();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace InfinniPlatform.Core.Metadata
{
public class MetadataUniqueName : IEquatable<MetadataUniqueName>
{
private const char NamespaceSeparator = '.';
public MetadataUniqueName(string ns, string name)
{
Namespace = ns;
Name = name;
}
public MetadataUniqueName(string fullQuelifiedName)
{
Namespace = fullQuelifiedName.Remove(fullQuelifiedName.LastIndexOf(NamespaceSeparator));
Name = fullQuelifiedName.Split(NamespaceSeparator).Last();
}
public string Namespace { get; }
public string Name { get; }
public bool Equals(MetadataUniqueName other)
{
return Namespace.Equals(other.Namespace, StringComparison.OrdinalIgnoreCase) && Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase);
}
public override string ToString()
{
return $"{Namespace}.{Name}";
}
public override int GetHashCode()
{
return Namespace.ToLower().GetHashCode() ^ Name.ToLower().GetHashCode();
}
}
}
|
Fix metadata cache case dependency
|
Fix metadata cache case dependency
|
C#
|
agpl-3.0
|
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
|
15f8146d861d72527b310ebe78141f659569cba9
|
src/GraphQL/Execution/AntlrDocumentBuilder.cs
|
src/GraphQL/Execution/AntlrDocumentBuilder.cs
|
using System.IO;
using System.Text;
using Antlr4.Runtime;
using GraphQL.Language;
using GraphQL.Parsing;
namespace GraphQL.Execution
{
public class AntlrDocumentBuilder : IDocumentBuilder
{
public Document Build(string data)
{
var stream = new MemoryStream(Encoding.UTF8.GetBytes(data));
var reader = new StreamReader(stream);
var input = new AntlrInputStream(reader);
var lexer = new GraphQLLexer(input);
var tokens = new CommonTokenStream(lexer);
var parser = new GraphQLParser(tokens);
var documentTree = parser.document();
var vistor = new GraphQLVisitor();
return vistor.Visit(documentTree) as Document;
}
}
}
|
using System.IO;
using System.Text;
using Antlr4.Runtime;
using GraphQL.Language;
using GraphQL.Parsing;
namespace GraphQL.Execution
{
public class AntlrDocumentBuilder : IDocumentBuilder
{
public Document Build(string data)
{
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(data)))
using (var reader = new StreamReader(stream))
{
var input = new AntlrInputStream(reader);
var lexer = new GraphQLLexer(input);
var tokens = new CommonTokenStream(lexer);
var parser = new GraphQLParser(tokens);
var documentTree = parser.document();
var vistor = new GraphQLVisitor();
return vistor.Visit(documentTree) as Document;
}
}
}
}
|
Clean up stream after use.
|
Clean up stream after use.
|
C#
|
mit
|
teamsmileyface/graphql-dotnet,joemcbride/graphql-dotnet,alexmcmillan/graphql-dotnet,plecong/graphql-dotnet,scmccart/graphql-dotnet,dNetGuru/graphql-dotnet,graphql-dotnet/graphql-dotnet,teamsmileyface/graphql-dotnet,kthompson/graphql-dotnet,plecong/graphql-dotnet,kthompson/graphql-dotnet,joemcbride/graphql-dotnet,alexmcmillan/graphql-dotnet,dNetGuru/graphql-dotnet,kthompson/graphql-dotnet,graphql-dotnet/graphql-dotnet,scmccart/graphql-dotnet,graphql-dotnet/graphql-dotnet
|
160b8050084d36f1af021d0fb43763a5274f30b8
|
MonitoringDemoHost/ChaosHandler.cs
|
MonitoringDemoHost/ChaosHandler.cs
|
using System;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Logging;
class ChaosHandler : IHandleMessages<object>
{
readonly ILog Log = LogManager.GetLogger<ChaosHandler>();
readonly double Thresshold = ThreadLocalRandom.NextDouble() * 0.50;
public Task Handle(object message, IMessageHandlerContext context)
{
var result = ThreadLocalRandom.NextDouble();
if (result < Thresshold) throw new Exception($"Random chaos ({Thresshold * 100:N}% failure)");
return Task.FromResult(0);
}
}
|
using System;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Logging;
class ChaosHandler : IHandleMessages<object>
{
readonly ILog Log = LogManager.GetLogger<ChaosHandler>();
readonly double Thresshold = ThreadLocalRandom.NextDouble() * 0.05;
public Task Handle(object message, IMessageHandlerContext context)
{
var result = ThreadLocalRandom.NextDouble();
if (result < Thresshold) throw new Exception($"Random chaos ({Thresshold * 100:N}% failure)");
return Task.FromResult(0);
}
}
|
Set failure rate to max 5%
|
Set failure rate to max 5%
|
C#
|
mit
|
ramonsmits/NServiceBus.MonitoringDemoHost
|
a9c645bdd53c90f61b6f86855dd7e1bbb004b87b
|
PhotoLife/PhotoLife.Services/CategoryService.cs
|
PhotoLife/PhotoLife.Services/CategoryService.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
using PhotoLife.Models.Enums;
using PhotoLife.Services.Contracts;
namespace PhotoLife.Services
{
public class CategoryService : ICategoryService
{
private readonly IRepository<Category> categoryRepository;
private readonly IUnitOfWork unitOfWork;
public CategoryService(IRepository<Category> categoryRepository, IUnitOfWork unitOfWork)
{
if (categoryRepository == null)
{
throw new ArgumentNullException(nameof(categoryRepository));
}
if (unitOfWork == null)
{
throw new ArgumentNullException(nameof(unitOfWork));
}
this.categoryRepository = categoryRepository;
this.unitOfWork = unitOfWork;
}
public Category GetCategoryByName(CategoryEnum categoryEnum)
{
return this.categoryRepository.GetAll.FirstOrDefault(c => c.Name.Equals(categoryEnum));
}
public IEnumerable<Category> GetAll()
{
return this.categoryRepository.GetAll.ToList();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
using PhotoLife.Models.Enums;
using PhotoLife.Services.Contracts;
namespace PhotoLife.Services
{
public class CategoryService : ICategoryService
{
private readonly IRepository<Category> categoryRepository;
private readonly IUnitOfWork unitOfWork;
public CategoryService(IRepository<Category> categoryRepository, IUnitOfWork unitOfWork)
{
if (categoryRepository == null)
{
throw new ArgumentNullException("categoryRepository");
}
if (unitOfWork == null)
{
throw new ArgumentNullException("unitOfWork");
}
this.categoryRepository = categoryRepository;
this.unitOfWork = unitOfWork;
}
public Category GetCategoryByName(CategoryEnum categoryEnum)
{
return this.categoryRepository.GetAll.FirstOrDefault(c => c.Name.Equals(categoryEnum));
}
public IEnumerable<Category> GetAll()
{
return this.categoryRepository.GetAll.ToList();
}
}
}
|
Change throw exception due to appharbor build
|
Change throw exception due to appharbor build
|
C#
|
mit
|
Branimir123/PhotoLife,Branimir123/PhotoLife,Branimir123/PhotoLife
|
92ec14bbb15ddc7e3d7b85a3e151fdcf6914d5ce
|
src/SyncTrayzor/SyncThing/ApiClient/GenericEvent.cs
|
src/SyncTrayzor/SyncThing/ApiClient/GenericEvent.cs
|
namespace SyncTrayzor.SyncThing.ApiClient
{
public class GenericEvent : Event
{
public override void Visit(IEventVisitor visitor)
{
visitor.Accept(this);
}
public override string ToString()
{
return $"<GenericEvent ID={this.Id} Type={this.Type} Time={this.Time}>";
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace SyncTrayzor.SyncThing.ApiClient
{
public class GenericEvent : Event
{
public override void Visit(IEventVisitor visitor)
{
visitor.Accept(this);
}
[JsonProperty("data")]
public JToken Data { get; set; }
public override string ToString()
{
return $"<GenericEvent ID={this.Id} Type={this.Type} Time={this.Time} Data={this.Data.ToString(Formatting.None)}>";
}
}
}
|
Print 'data' fields for generic events
|
Print 'data' fields for generic events
|
C#
|
mit
|
canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor
|
82947e5ba57be81bdb43bce864fa1222567f88af
|
tests/LineBot.Tests/TestHelpers/TestConfiguration.cs
|
tests/LineBot.Tests/TestHelpers/TestConfiguration.cs
|
// Copyright 2017-2018 Dirk Lemstra (https://github.com/dlemstra/line-bot-sdk-dotnet)
//
// Dirk Lemstra licenses this file to you under the Apache License,
// version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at:
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
namespace Line.Tests
{
[ExcludeFromCodeCoverage]
public sealed class TestConfiguration : ILineConfiguration
{
private TestConfiguration()
{
}
public string ChannelAccessToken => "ChannelAccessToken";
public string ChannelSecret => "ChannelSecret";
public static ILineConfiguration Create()
{
return new TestConfiguration();
}
public static ILineBot CreateBot()
{
return new LineBot(new TestConfiguration(), TestHttpClient.Create(), null);
}
public static ILineBot CreateBot(TestHttpClient httpClient)
{
return new LineBot(new TestConfiguration(), httpClient, null);
}
public static ILineBot CreateBot(ILineBotLogger logger)
{
return new LineBot(new TestConfiguration(), TestHttpClient.Create(), logger);
}
}
}
|
// Copyright 2017-2018 Dirk Lemstra (https://github.com/dlemstra/line-bot-sdk-dotnet)
//
// Dirk Lemstra licenses this file to you under the Apache License,
// version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at:
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
namespace Line.Tests
{
[ExcludeFromCodeCoverage]
public sealed class TestConfiguration : ILineConfiguration
{
private TestConfiguration()
{
}
public string ChannelAccessToken => "ChannelAccessToken";
public string ChannelSecret => "ChannelSecret";
public static ILineConfiguration Create()
{
return new TestConfiguration();
}
public static ILineBot CreateBot()
{
return new LineBot(new TestConfiguration(), TestHttpClient.Create(), new EmptyLineBotLogger());
}
public static ILineBot CreateBot(TestHttpClient httpClient)
{
return new LineBot(new TestConfiguration(), httpClient, new EmptyLineBotLogger());
}
public static ILineBot CreateBot(ILineBotLogger logger)
{
return new LineBot(new TestConfiguration(), TestHttpClient.Create(), logger);
}
}
}
|
Use EmptyLineBotLogger in unit tests.
|
Use EmptyLineBotLogger in unit tests.
|
C#
|
apache-2.0
|
dlemstra/line-bot-sdk-dotnet,dlemstra/line-bot-sdk-dotnet
|
63c4f231e4512f2861f6fd9c2fc84656f5007833
|
src/NRules/NRules.RuleModel/ExpressionMap.cs
|
src/NRules/NRules.RuleModel/ExpressionMap.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace NRules.RuleModel
{
/// <summary>
/// Sorted readonly map of named expressions.
/// </summary>
public class ExpressionMap : IEnumerable<NamedExpressionElement>
{
private readonly SortedDictionary<string, NamedExpressionElement> _expressions;
public ExpressionMap(IEnumerable<NamedExpressionElement> expressions)
{
_expressions = new SortedDictionary<string, NamedExpressionElement>(expressions.ToDictionary(x => x.Name));
}
/// <summary>
/// Number of expressions in the map.
/// </summary>
public int Count => _expressions.Count;
/// <summary>
/// Retrieves expression by name.
/// </summary>
/// <param name="name">Expression name.</param>
/// <returns>Matching expression.</returns>
public NamedExpressionElement this[string name]
{
get
{
var found = _expressions.TryGetValue(name, out var result);
if (!found)
{
throw new ArgumentException(
$"Expression with the given name not found. Name={name}", nameof(name));
}
return result;
}
}
public IEnumerator<NamedExpressionElement> GetEnumerator()
{
return _expressions.Values.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace NRules.RuleModel
{
/// <summary>
/// Sorted readonly map of named expressions.
/// </summary>
public class ExpressionMap : IEnumerable<NamedExpressionElement>
{
private readonly SortedDictionary<string, NamedExpressionElement> _expressions;
public ExpressionMap(IEnumerable<NamedExpressionElement> expressions)
{
_expressions = new SortedDictionary<string, NamedExpressionElement>(expressions.ToDictionary(x => x.Name));
}
/// <summary>
/// Number of expressions in the map.
/// </summary>
public int Count => _expressions.Count;
/// <summary>
/// Retrieves expression by name.
/// </summary>
/// <param name="name">Expression name.</param>
/// <returns>Matching expression.</returns>
public NamedExpressionElement this[string name]
{
get
{
var found = _expressions.TryGetValue(name, out var result);
if (!found)
{
throw new ArgumentException(
$"Expression with the given name not found. Name={name}", nameof(name));
}
return result;
}
}
/// <summary>
/// Retrieves expression by name.
/// </summary>
/// <param name="name">Expression name.</param>
/// <returns>Matching expression or <c>null</c>.</returns>
public NamedExpressionElement Find(string name)
{
_expressions.TryGetValue(name, out var result);
return result;
}
public IEnumerator<NamedExpressionElement> GetEnumerator()
{
return _expressions.Values.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
|
Add Find method to expression map
|
Add Find method to expression map
|
C#
|
mit
|
NRules/NRules
|
45db485f5535dac46196accb0200d0c3d66f4057
|
AspectInjector.Task/AspectInjectorBuildTask.cs
|
AspectInjector.Task/AspectInjectorBuildTask.cs
|
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.Cecil;
using System;
using System.IO;
namespace AspectInjector.BuildTask
{
public class AspectInjectorBuildTask : Task
{
[Required]
public string Assembly { get; set; }
[Required]
public string OutputPath { get; set; }
public override bool Execute()
{
try
{
Console.WriteLine("Aspect Injector has started for {0}", Assembly);
var assemblyResolver = new DefaultAssemblyResolver();
assemblyResolver.AddSearchDirectory(OutputPath);
string assemblyFile = Path.Combine(OutputPath, Assembly + ".exe");
var assembly = AssemblyDefinition.ReadAssembly(assemblyFile,
new ReaderParameters
{
ReadingMode = Mono.Cecil.ReadingMode.Deferred,
AssemblyResolver = assemblyResolver
});
Console.WriteLine("Assembly has been loaded");
var injector = new AspectInjector();
injector.Process(assembly);
Console.WriteLine("Assembly has been patched");
assembly.Write(assemblyFile);
Console.WriteLine("Assembly has been written");
}
catch (Exception e)
{
this.Log.LogErrorFromException(e, false, true, null);
Console.Error.WriteLine(e.Message);
return false;
}
return true;
}
}
}
|
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.Cecil;
using System;
using System.IO;
namespace AspectInjector.BuildTask
{
public class AspectInjectorBuildTask : Task
{
[Required]
public string Assembly { get; set; }
[Required]
public string OutputPath { get; set; }
public override bool Execute()
{
try
{
Console.WriteLine("Aspect Injector has started for {0}", Assembly);
var assemblyResolver = new DefaultAssemblyResolver();
assemblyResolver.AddSearchDirectory(OutputPath);
string assemblyFile = Path.Combine(OutputPath, Assembly + ".exe");
string pdbFile = Path.Combine(OutputPath, Assembly + ".pdb");
var assembly = AssemblyDefinition.ReadAssembly(assemblyFile,
new ReaderParameters
{
ReadingMode = Mono.Cecil.ReadingMode.Deferred,
AssemblyResolver = assemblyResolver,
ReadSymbols = true
});
Console.WriteLine("Assembly has been loaded");
var injector = new AspectInjector();
injector.Process(assembly);
Console.WriteLine("Assembly has been patched");
assembly.Write(assemblyFile, new WriterParameters()
{
WriteSymbols = true
});
Console.WriteLine("Assembly has been written");
}
catch (Exception e)
{
this.Log.LogErrorFromException(e, false, true, null);
Console.Error.WriteLine(e.Message);
return false;
}
return true;
}
}
}
|
Support debugging of modified assemblies
|
Support debugging of modified assemblies
|
C#
|
apache-2.0
|
pamidur/aspect-injector
|
eed86d933f53456ce0d54f8ecd01ce56255051bb
|
AllReadyApp/Web-App/AllReady/Models/Activity.cs
|
AllReadyApp/Web-App/AllReady/Models/Activity.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AllReady.Models
{
public class Activity
{
public Activity()
{
Tasks = new List<AllReadyTask>();
UsersSignedUp = new List<ActivitySignup>();
RequiredSkills = new List<ActivitySkill>();
}
public int Id { get; set; }
[Display(Name = "Tenant")]
public int TenantId { get; set; }
public Tenant Tenant { get; set; }
[Display(Name = "Campaign")]
public int CampaignId { get; set; }
public Campaign Campaign { get; set; }
public string Name { get; set; }
public string Description { get; set; }
[Display(Name = "Start date")]
public DateTime StartDateTimeUtc { get; set; }
[Display(Name = "End date")]
public DateTime EndDateTimeUtc { get; set; }
public Location Location { get; set; }
public List<AllReadyTask> Tasks { get; set; }
public List<ActivitySignup> UsersSignedUp { get; set; }
public ApplicationUser Organizer { get; set; }
[Display(Name = "Image")]
public string ImageUrl { get; set; }
[Display(Name = "Required skills")]
public List<ActivitySkill> RequiredSkills { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AllReady.Models
{
public class Activity
{
public int Id { get; set; }
[Display(Name = "Tenant")]
public int TenantId { get; set; }
public Tenant Tenant { get; set; }
[Display(Name = "Campaign")]
public int CampaignId { get; set; }
public Campaign Campaign { get; set; }
public string Name { get; set; }
public string Description { get; set; }
[Display(Name = "Start date")]
public DateTime StartDateTimeUtc { get; set; }
[Display(Name = "End date")]
public DateTime EndDateTimeUtc { get; set; }
public Location Location { get; set; }
public List<AllReadyTask> Tasks { get; set; } = new List<AllReadyTask>();
public List<ActivitySignup> UsersSignedUp { get; set; } = new List<ActivitySignup>();
public ApplicationUser Organizer { get; set; }
[Display(Name = "Image")]
public string ImageUrl { get; set; }
[Display(Name = "Required skills")]
public List<ActivitySkill> RequiredSkills { get; set; } = new List<ActivitySkill>();
}
}
|
Use propert initializers instead of constructor
|
Use propert initializers instead of constructor
|
C#
|
mit
|
joelhulen/allReady,mheggeseth/allReady,jonatwabash/allReady,kmlewis/allReady,mheggeseth/allReady,BarryBurke/allReady,stevejgordon/allReady,SteveStrong/allReady,anobleperson/allReady,auroraocciduusadmin/allReady,JowenMei/allReady,BillWagner/allReady,HTBox/allReady,timstarbuck/allReady,dangle1/allReady,shawnwildermuth/allReady,gftrader/allReady,mgmccarthy/allReady,timstarbuck/allReady,shawnwildermuth/allReady,c0g1t8/allReady,mipre100/allReady,stevejgordon/allReady,jonatwabash/allReady,binaryjanitor/allReady,ksk100/allReady,gftrader/allReady,BarryBurke/allReady,GProulx/allReady,gitChuckD/allReady,JowenMei/allReady,timstarbuck/allReady,arst/allReady,HTBox/allReady,bcbeatty/allReady,JowenMei/allReady,HTBox/allReady,MisterJames/allReady,MisterJames/allReady,joelhulen/allReady,c0g1t8/allReady,colhountech/allReady,BarryBurke/allReady,shanecharles/allReady,SteveStrong/allReady,binaryjanitor/allReady,MisterJames/allReady,enderdickerson/allReady,arst/allReady,c0g1t8/allReady,dangle1/allReady,kmlewis/allReady,GProulx/allReady,VishalMadhvani/allReady,mipre100/allReady,chinwobble/allReady,anobleperson/allReady,aliiftikhar/allReady,mgmccarthy/allReady,dpaquette/allReady,timstarbuck/allReady,BarryBurke/allReady,mikesigs/allReady,MisterJames/allReady,mgmccarthy/allReady,BillWagner/allReady,VishalMadhvani/allReady,stevejgordon/allReady,gitChuckD/allReady,arst/allReady,enderdickerson/allReady,VishalMadhvani/allReady,pranap/allReady,anobleperson/allReady,jonatwabash/allReady,dangle1/allReady,forestcheng/allReady,anobleperson/allReady,enderdickerson/allReady,chinwobble/allReady,shanecharles/allReady,enderdickerson/allReady,BillWagner/allReady,kmlewis/allReady,HamidMosalla/allReady,colhountech/allReady,dpaquette/allReady,binaryjanitor/allReady,HamidMosalla/allReady,shanecharles/allReady,jonhilt/allReady,auroraocciduusadmin/allReady,colhountech/allReady,c0g1t8/allReady,aliiftikhar/allReady,auroraocciduusadmin/allReady,mikesigs/allReady,shawnwildermuth/allReady,arst/allReady,gftrader/allReady,gftrader/allReady,BillWagner/allReady,binaryjanitor/allReady,pranap/allReady,pranap/allReady,joelhulen/allReady,mipre100/allReady,dpaquette/allReady,bcbeatty/allReady,HamidMosalla/allReady,gitChuckD/allReady,jonhilt/allReady,forestcheng/allReady,jonatwabash/allReady,forestcheng/allReady,aliiftikhar/allReady,mikesigs/allReady,VishalMadhvani/allReady,shanecharles/allReady,forestcheng/allReady,joelhulen/allReady,colhountech/allReady,dangle1/allReady,mipre100/allReady,jonhilt/allReady,mikesigs/allReady,bcbeatty/allReady,aliiftikhar/allReady,GProulx/allReady,pranap/allReady,stevejgordon/allReady,gitChuckD/allReady,dpaquette/allReady,ksk100/allReady,ksk100/allReady,shawnwildermuth/allReady,GProulx/allReady,bcbeatty/allReady,SteveStrong/allReady,HamidMosalla/allReady,chinwobble/allReady,JowenMei/allReady,SteveStrong/allReady,kmlewis/allReady,mheggeseth/allReady,chinwobble/allReady,HTBox/allReady,mgmccarthy/allReady,ksk100/allReady,mheggeseth/allReady,jonhilt/allReady,auroraocciduusadmin/allReady
|
e0c2e75290583de1fa60046d026c33b3533e7da4
|
SqlServerHelpers/ExtensionMethods/SqlConnectionExtensions.cs
|
SqlServerHelpers/ExtensionMethods/SqlConnectionExtensions.cs
|
/*
* SqlServerHelpers
* SqlConnectionExtensions - Extension methods for SqlConnection
* Authors:
* Josh Keegan 26/05/2015
*/
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SqlServerHelpers.ExtensionMethods
{
public static class SqlConnectionExtensions
{
public static SqlCommand GetSqlCommand(this SqlConnection conn, SqlTransaction trans = null)
{
return getSqlCommand(null, conn, trans);
}
public static SqlCommand GetSqlCommand(this SqlConnection conn, string txtCmd, SqlTransaction trans = null)
{
return getSqlCommand(txtCmd, conn, trans);
}
private static SqlCommand getSqlCommand(string txtCmd, SqlConnection conn, SqlTransaction trans)
{
SqlCommand command = new SqlCommand(txtCmd, conn, trans);
// Apply default command settings
if (Settings.Command != null)
{
if (Settings.Command.CommandTimeout != null)
{
command.CommandTimeout = (int) Settings.Command.CommandTimeout;
}
// TODO: Support more default settings as they're added to CommandSettings
}
return command;
}
}
}
|
/*
* SqlServerHelpers
* SqlConnectionExtensions - Extension methods for SqlConnection
* Authors:
* Josh Keegan 26/05/2015
*/
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SqlServerHelpers.ExtensionMethods
{
public static class SqlConnectionExtensions
{
#region Public Methods
public static SqlCommand GetSqlCommand(this SqlConnection conn, SqlTransaction trans = null,
CommandSettings commandSettings = null)
{
return getSqlCommand(null, conn, trans, commandSettings);
}
public static SqlCommand GetSqlCommand(this SqlConnection conn, string txtCmd, SqlTransaction trans = null,
CommandSettings commandSettings = null)
{
return getSqlCommand(txtCmd, conn, trans, commandSettings);
}
public static SqlCommand GetSqlCommand(this SqlConnection conn, CommandSettings commandSettings)
{
return GetSqlCommand(conn, null, commandSettings);
}
#endregion
#region Private Methods
private static SqlCommand getSqlCommand(string txtCmd, SqlConnection conn, SqlTransaction trans,
CommandSettings commandSettings)
{
// If no command settings have been supplied, use the default ones as defined statically in Settings
if (commandSettings == null)
{
commandSettings = Settings.Command;
}
// Make the command
SqlCommand command = new SqlCommand(txtCmd, conn, trans);
// Apply command settings
if (commandSettings != null)
{
if (commandSettings.CommandTimeout != null)
{
command.CommandTimeout = (int) commandSettings.CommandTimeout;
}
// TODO: Support more default settings as they're added to CommandSettings
}
return command;
}
#endregion
}
}
|
Allow non-default Command Settings to be passed to GetSqlCommand()
|
Allow non-default Command Settings to be passed to GetSqlCommand()
|
C#
|
mit
|
JoshKeegan/SqlServerHelpers
|
18a17c57370e8cb9fc7ef481845554909275437e
|
com.unity.formats.alembic/Tests/Editor/EditorTests.cs
|
com.unity.formats.alembic/Tests/Editor/EditorTests.cs
|
using NUnit.Framework;
using UnityEngine.Formats.Alembic.Sdk;
namespace UnityEditor.Formats.Alembic.Exporter.UnitTests
{
class EditorTests
{
[Test]
public void MarshalTests()
{
Assert.AreEqual(72,System.Runtime.InteropServices.Marshal.SizeOf(typeof(aePolyMeshData)));
}
}
}
|
using NUnit.Framework;
using UnityEngine.Formats.Alembic.Sdk;
namespace UnityEditor.Formats.Alembic.Exporter.UnitTests
{
class EditorTests
{
[Test]
public void MarshalTests()
{
Assert.AreEqual(72,System.Runtime.InteropServices.Marshal.SizeOf(typeof(aePolyMeshData)));
}
}
}
|
Add whitespace on test file
|
Add whitespace on test file
|
C#
|
mit
|
unity3d-jp/AlembicImporter,unity3d-jp/AlembicImporter,unity3d-jp/AlembicImporter
|
b426019f06aed516c82697d1996aedf6d2dfd01f
|
TFG/Logic/SintromLogic.cs
|
TFG/Logic/SintromLogic.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using TFG.Model;
namespace TFG.Logic {
public class SintromLogic {
private static SintromLogic _instance;
public static SintromLogic Instance() {
if (_instance == null) {
_instance = new SintromLogic();
}
return _instance;
}
private SintromLogic() { }
public NotificationItem GetNotificationitem() {
var sintromItems = DBHelper.Instance.GetSintromItemFromDate(DateTime.Now);
if (sintromItems.Count > 0) {
var sintromItem = sintromItems[0];
var title = HealthModulesInfo.GetStringFromResourceName("sintrom_name");
var description =
string.Format(HealthModulesInfo.GetStringFromResourceName("sintrom_notification_description"),
sintromItem.Fraction, sintromItem.Medicine);
return new NotificationItem(title, description, true);
}
return null;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using TFG.Model;
namespace TFG.Logic {
public class SintromLogic {
private static SintromLogic _instance;
public static SintromLogic Instance() {
if (_instance == null) {
_instance = new SintromLogic();
}
return _instance;
}
private SintromLogic() { }
public NotificationItem GetNotificationitem() {
var controlday = DBHelper.Instance.GetSintromINRItemFromDate(DateTime.Now);
var title = HealthModulesInfo.GetStringFromResourceName("sintrom_name");
//Control Day Notification
if (controlday.Count > 0 && controlday[0].Control) {
var description =
string.Format(HealthModulesInfo.GetStringFromResourceName("sintrom_notification_control_description"));
return new NotificationItem(title, description, true);
}
//Treatment Day Notification
var sintromItems = DBHelper.Instance.GetSintromItemFromDate(DateTime.Now);
if (sintromItems.Count > 0) {
var sintromItem = sintromItems[0];
var description =
string.Format(HealthModulesInfo.GetStringFromResourceName("sintrom_notification_description"),
sintromItem.Fraction, sintromItem.Medicine);
return new NotificationItem(title, description, true);
}
//No Notification
return null;
}
}
}
|
Set notification for sintrom control days
|
Set notification for sintrom control days
|
C#
|
mit
|
AlbertoMoreta/Dr.Handy
|
22029a122b1614eb55abf395d3ae3de367b67d28
|
LazyStorage/Properties/AssemblyInfo.cs
|
LazyStorage/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("LazyStorage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LazyStorage")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("LazyStorage.Tests")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4538ca36-f57b-4bec-b9d1-3540fdd28ae3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LazyStorage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LazyStorage")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("LazyStorage.Tests")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4538ca36-f57b-4bec-b9d1-3540fdd28ae3")]
|
Remove version attributes from assembly info
|
Remove version attributes from assembly info
GitVersion MsBuild task wil fail if they are present
|
C#
|
mit
|
TheEadie/LazyLibrary,TheEadie/LazyStorage,TheEadie/LazyStorage
|
205f2c27e16d076c204c1a5d3ae59ce778c80b27
|
VersionInfo.cs
|
VersionInfo.cs
|
/*
* ******************************************************************************
* Copyright 2014 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
using System.Reflection;
// 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.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
|
/*
* ******************************************************************************
* Copyright 2014 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
using System.Reflection;
// 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.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
|
Change version number to 1.2.1
|
Change version number to 1.2.1
|
C#
|
apache-2.0
|
SpectraLogic/ds3_net_sdk,RachelTucker/ds3_net_sdk,RachelTucker/ds3_net_sdk,rpmoore/ds3_net_sdk,shabtaisharon/ds3_net_sdk,rpmoore/ds3_net_sdk,SpectraLogic/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,shabtaisharon/ds3_net_sdk,rpmoore/ds3_net_sdk
|
67de54908a7eefe93cd7f2b72db43c8f95cf64f6
|
SRPTests/TestRenderer/TestWorkspace.cs
|
SRPTests/TestRenderer/TestWorkspace.cs
|
using SRPCommon.Interfaces;
using SRPCommon.Util;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SRPTests.TestRenderer
{
// Implementation of IWorkspace that finds test files.
class TestWorkspace : IWorkspace
{
private readonly string _baseDir;
private readonly Dictionary<string, string> _files;
public TestWorkspace(string baseDir)
{
_baseDir = baseDir;
// Find all files in the TestScripts dir.
_files = Directory.EnumerateFiles(_baseDir, "*", SearchOption.AllDirectories)
.ToDictionary(path => Path.GetFileName(path));
}
public string FindProjectFile(string name)
{
string path;
if (_files.TryGetValue(name, out path))
{
return path;
}
return null;
}
public string GetAbsolutePath(string path)
{
if (Path.IsPathRooted(path))
{
return path;
}
return Path.Combine(_baseDir, path);
}
}
}
|
using SRPCommon.Interfaces;
using SRPCommon.Util;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SRPTests.TestRenderer
{
// Implementation of IWorkspace that finds test files.
class TestWorkspace : IWorkspace
{
private readonly string _baseDir;
private readonly Dictionary<string, string> _files;
public TestWorkspace(string baseDir)
{
_baseDir = baseDir;
// Find all files in the TestScripts dir.
_files = Directory.EnumerateFiles(_baseDir, "*", SearchOption.AllDirectories)
.ToDictionary(path => Path.GetFileName(path), StringComparer.OrdinalIgnoreCase);
}
public string FindProjectFile(string name)
{
string path;
if (_files.TryGetValue(name, out path))
{
return path;
}
return null;
}
public string GetAbsolutePath(string path)
{
if (Path.IsPathRooted(path))
{
return path;
}
return Path.Combine(_baseDir, path);
}
}
}
|
Test filenames are case insensitive too.
|
Test filenames are case insensitive too.
|
C#
|
mit
|
simontaylor81/Syrup,simontaylor81/Syrup
|
d641726c6f3a971c4d1f301ad3d54f992d411c72
|
src/AppHarbor/CompressionExtensions.cs
|
src/AppHarbor/CompressionExtensions.cs
|
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.SharpZipLib.Tar;
namespace AppHarbor
{
public static class CompressionExtensions
{
public static void ToTar(this DirectoryInfo sourceDirectory, Stream output, string[] excludedDirectoryNames)
{
var archive = TarArchive.CreateOutputTarArchive(output);
archive.RootPath = sourceDirectory.FullName.Replace(Path.DirectorySeparatorChar, '/').TrimEnd('/');
var entries = GetFiles(sourceDirectory, excludedDirectoryNames)
.Select(x => TarEntry.CreateEntryFromFile(x.FullName));
foreach (var entry in entries)
{
archive.WriteEntry(entry, true);
}
archive.Close();
}
private static IEnumerable<FileInfo> GetFiles(DirectoryInfo directory, string[] excludedDirectories)
{
return directory.GetFiles("*", SearchOption.TopDirectoryOnly)
.Concat(directory.GetDirectories()
.Where(x => excludedDirectories.Contains(x.Name))
.SelectMany(x => GetFiles(x, excludedDirectories)));
}
}
}
|
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.SharpZipLib.Tar;
namespace AppHarbor
{
public static class CompressionExtensions
{
public static void ToTar(this DirectoryInfo sourceDirectory, Stream output, string[] excludedDirectoryNames)
{
var archive = TarArchive.CreateOutputTarArchive(output);
archive.RootPath = sourceDirectory.FullName.Replace(Path.DirectorySeparatorChar, '/').TrimEnd('/');
var entries = GetFiles(sourceDirectory, excludedDirectoryNames)
.Select(x => TarEntry.CreateEntryFromFile(x.FullName));
foreach (var entry in entries)
{
archive.WriteEntry(entry, true);
}
archive.Close();
}
private static IEnumerable<FileInfo> GetFiles(DirectoryInfo directory, string[] excludedDirectories)
{
return directory.GetFiles("*", SearchOption.TopDirectoryOnly)
.Concat(directory.GetDirectories()
.Where(x => !excludedDirectories.Contains(x.Name))
.SelectMany(x => GetFiles(x, excludedDirectories)));
}
}
}
|
Fix bug in file selection
|
Fix bug in file selection
|
C#
|
mit
|
appharbor/appharbor-cli
|
8f0b9cac635b39ccd8a56be19da0ae38f7290c77
|
src/IO/DataReaderFactoryFactory.cs
|
src/IO/DataReaderFactoryFactory.cs
|
// dnlib: See LICENSE.txt for more info
using System;
using System.IO;
namespace dnlib.IO {
static class DataReaderFactoryFactory {
static readonly bool isUnix;
static DataReaderFactoryFactory() {
// See http://mono-project.com/FAQ:_Technical#Mono_Platforms for platform detection.
int p = (int)Environment.OSVersion.Platform;
if (p == 4 || p == 6 || p == 128)
isUnix = true;
}
public static DataReaderFactory Create(string fileName, bool mapAsImage) {
var creator = CreateDataReaderFactory(fileName, mapAsImage);
if (creator is not null)
return creator;
return ByteArrayDataReaderFactory.Create(File.ReadAllBytes(fileName), fileName);
}
static DataReaderFactory CreateDataReaderFactory(string fileName, bool mapAsImage) {
if (!isUnix)
return MemoryMappedDataReaderFactory.CreateWindows(fileName, mapAsImage);
else
return MemoryMappedDataReaderFactory.CreateUnix(fileName, mapAsImage);
}
}
}
|
// dnlib: See LICENSE.txt for more info
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace dnlib.IO {
static class DataReaderFactoryFactory {
static readonly bool isUnix;
static DataReaderFactoryFactory() {
// See http://mono-project.com/FAQ:_Technical#Mono_Platforms for platform detection.
int p = (int)Environment.OSVersion.Platform;
if (p == 4 || p == 6 || p == 128)
isUnix = true;
#if NETSTANDARD
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
isUnix = true;
#endif
}
public static DataReaderFactory Create(string fileName, bool mapAsImage) {
var creator = CreateDataReaderFactory(fileName, mapAsImage);
if (creator is not null)
return creator;
return ByteArrayDataReaderFactory.Create(File.ReadAllBytes(fileName), fileName);
}
static DataReaderFactory CreateDataReaderFactory(string fileName, bool mapAsImage) {
if (!isUnix)
return MemoryMappedDataReaderFactory.CreateWindows(fileName, mapAsImage);
else
return MemoryMappedDataReaderFactory.CreateUnix(fileName, mapAsImage);
}
}
}
|
Use RuntimeInformation class to check environment.
|
Use RuntimeInformation class to check environment.
|
C#
|
mit
|
0xd4d/dnlib
|
33d2e2e3bbd763b7769558eea0090bccf177c6ff
|
Hosting/HttpHandlerExtensions.cs
|
Hosting/HttpHandlerExtensions.cs
|
using System.Web;
using System.Web.Routing;
namespace ConsolR.Hosting
{
public static class HttpHandlerExtensions
{
public static void MapHttpHandler<THandler>(this RouteCollection routes, string url) where THandler : IHttpHandler, new()
{
routes.MapHttpHandler<THandler>(null, url, null, null);
}
public static void MapHttpHandler<THandler>(this RouteCollection routes,
string name, string url, object defaults, object constraints)
where THandler : IHttpHandler, new()
{
var route = new Route(url, new HttpHandlerRouteHandler<THandler>());
route.Defaults = new RouteValueDictionary(defaults);
route.Constraints = new RouteValueDictionary(constraints);
routes.Add(name, route);
}
private class HttpHandlerRouteHandler<THandler>
: IRouteHandler where THandler : IHttpHandler, new()
{
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
return new THandler();
}
}
}
}
|
using System.Web;
using System.Web.Routing;
namespace ConsolR.Hosting
{
public static class HttpHandlerExtensions
{
public static void MapHttpHandler<THandler>(this RouteCollection routes, string url) where THandler : IHttpHandler, new()
{
routes.MapHttpHandler<THandler>(null, url, null, null);
}
public static void MapHttpHandler<THandler>(this RouteCollection routes,
string name, string url, object defaults, object constraints)
where THandler : IHttpHandler, new()
{
var route = new Route(url, new HttpHandlerRouteHandler<THandler>());
route.Defaults = new RouteValueDictionary(defaults);
route.Constraints = new RouteValueDictionary();
route.Constraints.Add(name, constraints);
routes.Add(name, route);
}
private class HttpHandlerRouteHandler<THandler>
: IRouteHandler where THandler : IHttpHandler, new()
{
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
return new THandler();
}
}
}
}
|
Fix bug in http handler constraints
|
Fix bug in http handler constraints
|
C#
|
mit
|
appharbor/ConsolR,appharbor/ConsolR
|
e58b206e97ae9ed9738003d0b9fb7d97a076d24e
|
src/RazorLight/Templating/PageLookupResult.cs
|
src/RazorLight/Templating/PageLookupResult.cs
|
using System.Collections.Generic;
namespace RazorLight.Templating
{
public class PageLookupResult
{
public PageLookupResult()
{
this.Success = false;
}
public PageLookupResult(PageLookupItem item, IReadOnlyList<PageLookupItem> viewStartEntries)
{
this.ViewEntry = item;
this.ViewStartEntries = viewStartEntries;
this.Success = true;
}
public bool Success { get; }
public PageLookupItem ViewEntry { get; }
public IReadOnlyList<PageLookupItem> ViewStartEntries { get; }
}
}
|
using System.Collections.Generic;
namespace RazorLight.Templating
{
public class PageLookupResult
{
public static PageLookupResult Failed => new PageLookupResult();
private PageLookupResult()
{
this.Success = false;
}
public PageLookupResult(PageLookupItem item, IReadOnlyList<PageLookupItem> viewStartEntries)
{
this.ViewEntry = item;
this.ViewStartEntries = viewStartEntries;
this.Success = true;
}
public bool Success { get; }
public PageLookupItem ViewEntry { get; }
public IReadOnlyList<PageLookupItem> ViewStartEntries { get; }
}
}
|
Replace default constructor with failed property on PageProvider
|
Replace default constructor with failed property on PageProvider
|
C#
|
apache-2.0
|
toddams/RazorLight,toddams/RazorLight,gr8woo/RazorLight,gr8woo/RazorLight
|
16fd350abf84d87de8d668eb474c55d6b9339502
|
src/StructuredLogger/ObjectModel/TimedNode.cs
|
src/StructuredLogger/ObjectModel/TimedNode.cs
|
using System;
namespace Microsoft.Build.Logging.StructuredLogger
{
public class TimedNode : NamedNode
{
public int Id { get; set; }
public int NodeId { get; set; }
/// <summary>
/// Unique index of the node in the build tree, can be used as a
/// "URL" to node
/// </summary>
public int Index { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public TimeSpan Duration
{
get
{
if (EndTime >= StartTime)
{
return EndTime - StartTime;
}
return TimeSpan.Zero;
}
}
public string DurationText => TextUtilities.DisplayDuration(Duration);
public override string TypeName => nameof(TimedNode);
public string GetTimeAndDurationText(bool fullPrecision = false)
{
var duration = DurationText;
if (string.IsNullOrEmpty(duration))
{
duration = "0";
}
return $@"Start: {TextUtilities.Display(StartTime, displayDate: true, fullPrecision)}
End: {TextUtilities.Display(EndTime, displayDate: true, fullPrecision)}
Duration: {duration}";
}
public override string ToolTip => GetTimeAndDurationText();
}
}
|
using System;
namespace Microsoft.Build.Logging.StructuredLogger
{
public class TimedNode : NamedNode
{
/// <summary>
/// The Id of a Project, ProjectEvaluation, Target and Task.
/// Corresponds to ProjectStartedEventsArgs.ProjectId, TargetStartedEventArgs.TargetId, etc.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Corresponds to BuildEventArgs.BuildEventContext.NodeId,
/// which is the id of the MSBuild.exe node process that built the current project or
/// executed the given target or task.
/// </summary>
public int NodeId { get; set; }
/// <summary>
/// Unique index of the node in the build tree, can be used as a
/// "URL" to node
/// </summary>
public int Index { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public TimeSpan Duration
{
get
{
if (EndTime >= StartTime)
{
return EndTime - StartTime;
}
return TimeSpan.Zero;
}
}
public string DurationText => TextUtilities.DisplayDuration(Duration);
public override string TypeName => nameof(TimedNode);
public string GetTimeAndDurationText(bool fullPrecision = false)
{
var duration = DurationText;
if (string.IsNullOrEmpty(duration))
{
duration = "0";
}
return $@"Start: {TextUtilities.Display(StartTime, displayDate: true, fullPrecision)}
End: {TextUtilities.Display(EndTime, displayDate: true, fullPrecision)}
Duration: {duration}";
}
public override string ToolTip => GetTimeAndDurationText();
}
}
|
Add XML doc comments on Id and NodeId
|
Add XML doc comments on Id and NodeId
|
C#
|
mit
|
KirillOsenkov/MSBuildStructuredLog,KirillOsenkov/MSBuildStructuredLog
|
b593c478096b8919aa7078d5e9607e039c7f72ae
|
osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.cs
|
osu.Game/Overlays/Settings/Sections/Debug/GeneralSettings.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.Configuration;
using osu.Framework.Graphics;
namespace osu.Game.Overlays.Settings.Sections.Debug
{
public class GeneralSettings : SettingsSubsection
{
protected override string Header => "General";
[BackgroundDependencyLoader]
private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = "Bypass caching",
Bindable = config.GetBindable<bool>(DebugSetting.BypassCaching)
},
new SettingsCheckbox
{
LabelText = "Debug logs",
Bindable = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
}
};
}
}
}
|
// 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.Configuration;
using osu.Framework.Graphics;
namespace osu.Game.Overlays.Settings.Sections.Debug
{
public class GeneralSettings : SettingsSubsection
{
protected override string Header => "General";
[BackgroundDependencyLoader]
private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = "Show log overlay",
Bindable = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
},
new SettingsCheckbox
{
LabelText = "Performance logging",
Bindable = frameworkConfig.GetBindable<bool>(FrameworkSetting.PerformanceLogging)
},
new SettingsCheckbox
{
LabelText = "Bypass caching (slow)",
Bindable = config.GetBindable<bool>(DebugSetting.BypassCaching)
},
};
}
}
}
|
Add setting to toggle performance logging
|
Add setting to toggle performance logging
|
C#
|
mit
|
peppy/osu,NeoAdonis/osu,NeoAdonis/osu,naoey/osu,ZLima12/osu,ppy/osu,johnneijzen/osu,smoogipoo/osu,smoogipoo/osu,johnneijzen/osu,DrabWeb/osu,Nabile-Rahmani/osu,EVAST9919/osu,EVAST9919/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,Frontear/osuKyzer,DrabWeb/osu,naoey/osu,peppy/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,ZLima12/osu,smoogipoo/osu,2yangk23/osu,ppy/osu,UselessToucan/osu,peppy/osu-new,smoogipooo/osu,DrabWeb/osu,naoey/osu
|
33e765f8f5c4fd9be839ab0fee418d4c62be1bef
|
src/Discord.Net.Rest/API/Common/Embed.cs
|
src/Discord.Net.Rest/API/Common/Embed.cs
|
#pragma warning disable CS1591
using System;
using Newtonsoft.Json;
namespace Discord.API
{
internal class Embed
{
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("color")]
public uint? Color { get; set; }
[JsonProperty("type")]
public EmbedType Type { get; set; }
[JsonProperty("timestamp")]
public DateTimeOffset? Timestamp { get; set; }
[JsonProperty("author")]
public Optional<EmbedAuthor> Author { get; set; }
[JsonProperty("footer")]
public Optional<EmbedFooter> Footer { get; set; }
[JsonProperty("video")]
public Optional<EmbedVideo> Video { get; set; }
[JsonProperty("thumbnail")]
public Optional<EmbedThumbnail> Thumbnail { get; set; }
[JsonProperty("image")]
public Optional<EmbedImage> Image { get; set; }
[JsonProperty("provider")]
public Optional<EmbedProvider> Provider { get; set; }
[JsonProperty("fields")]
public Optional<EmbedField[]> Fields { get; set; }
}
}
|
#pragma warning disable CS1591
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Discord.API
{
internal class Embed
{
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("color")]
public uint? Color { get; set; }
[JsonProperty("type"), JsonConverter(typeof(StringEnumConverter))]
public EmbedType Type { get; set; }
[JsonProperty("timestamp")]
public DateTimeOffset? Timestamp { get; set; }
[JsonProperty("author")]
public Optional<EmbedAuthor> Author { get; set; }
[JsonProperty("footer")]
public Optional<EmbedFooter> Footer { get; set; }
[JsonProperty("video")]
public Optional<EmbedVideo> Video { get; set; }
[JsonProperty("thumbnail")]
public Optional<EmbedThumbnail> Thumbnail { get; set; }
[JsonProperty("image")]
public Optional<EmbedImage> Image { get; set; }
[JsonProperty("provider")]
public Optional<EmbedProvider> Provider { get; set; }
[JsonProperty("fields")]
public Optional<EmbedField[]> Fields { get; set; }
}
}
|
Use StringEnum converter in API model
|
Use StringEnum converter in API model
|
C#
|
mit
|
AntiTcb/Discord.Net,Confruggy/Discord.Net,RogueException/Discord.Net
|
e6775f87d932f4aad80502ea8dda86d7c5d23b56
|
src/MakingSense.AspNet.HypermediaApi.Seed/Startup.cs
|
src/MakingSense.AspNet.HypermediaApi.Seed/Startup.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Framework.DependencyInjection;
using Microsoft.AspNet.FileProviders;
using Microsoft.Dnx.Runtime;
using MakingSense.AspNet.Documentation;
namespace MakingSense.AspNet.HypermediaApi.Seed
{
public class Startup
{
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IApplicationBuilder app, IApplicationEnvironment appEnv)
{
app.UseStaticFiles();
UseDocumentation(app, appEnv);
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
private static void UseDocumentation(IApplicationBuilder app, IApplicationEnvironment appEnv)
{
var documentationFilesProvider = new PhysicalFileProvider(appEnv.ApplicationBasePath);
app.UseDocumentation(new DocumentationOptions()
{
DefaultFileName = "index",
RequestPath = "/docs",
NotFoundHtmlFile = documentationFilesProvider.GetFileInfo("DocumentationTemplates\\NotFound.html"),
LayoutFile = documentationFilesProvider.GetFileInfo("DocumentationTemplates\\Layout.html")
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Framework.DependencyInjection;
using Microsoft.AspNet.FileProviders;
using Microsoft.Dnx.Runtime;
using MakingSense.AspNet.Documentation;
using MakingSense.AspNet.HypermediaApi.Formatters;
using MakingSense.AspNet.HypermediaApi.ValidationFilters;
namespace MakingSense.AspNet.HypermediaApi.Seed
{
public class Startup
{
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc(options =>
{
options.OutputFormatters.Clear();
options.OutputFormatters.Add(new HypermediaApiJsonOutputFormatter());
options.InputFormatters.Clear();
options.InputFormatters.Add(new HypermediaApiJsonInputFormatter());
options.Filters.Add(new PayloadValidationFilter());
options.Filters.Add(new RequiredPayloadFilter());
});
}
public void Configure(IApplicationBuilder app, IApplicationEnvironment appEnv)
{
app.UseApiErrorHandler();
app.UseMvc();
app.UseStaticFiles();
UseDocumentation(app, appEnv);
app.UseNotFoundHandler();
}
private static void UseDocumentation(IApplicationBuilder app, IApplicationEnvironment appEnv)
{
var documentationFilesProvider = new PhysicalFileProvider(appEnv.ApplicationBasePath);
app.UseDocumentation(new DocumentationOptions()
{
DefaultFileName = "index",
RequestPath = "/docs",
NotFoundHtmlFile = documentationFilesProvider.GetFileInfo("DocumentationTemplates\\NotFound.html"),
LayoutFile = documentationFilesProvider.GetFileInfo("DocumentationTemplates\\Layout.html")
});
}
}
}
|
Add NotFound and ErrorHandling middlewares
|
Add NotFound and ErrorHandling middlewares
Along with MVC middleware because it is required.
This closes #7 and closes #8
|
C#
|
mit
|
MakingSense/aspnet-hypermedia-api-seed,MakingSense/aspnet-hypermedia-api-seed
|
33798a34c787370e5ee6932e630f9835782171af
|
CupCake.Server/Muffins/LogMuffin.cs
|
CupCake.Server/Muffins/LogMuffin.cs
|
using CupCake.Core.Log;
using CupCake.Messages.Receive;
using CupCake.Players;
namespace CupCake.Server.Muffins
{
public class LogMuffin : CupCakeMuffin
{
protected override void Enable()
{
this.Events.Bind<SayPlayerEvent>(this.OnSay);
this.Events.Bind<WriteReceiveEvent>(this.OnWrite);
this.Events.Bind<InfoReceiveEvent>(this.OnInfo);
this.Events.Bind<UpgradeReceiveEvent>(this.OnUpgrade);
}
private void OnUpgrade(object sender, UpgradeReceiveEvent e)
{
this.Logger.Log(LogPriority.Message, "The game has been updated.");
}
private void OnInfo(object sender, InfoReceiveEvent e)
{
this.Logger.LogPlatform.Log(e.Title, LogPriority.Message, e.Text);
}
private void OnWrite(object sender, WriteReceiveEvent e)
{
this.Logger.LogPlatform.Log(e.Title, LogPriority.Message, e.Text);
}
private void OnSay(object sender, SayPlayerEvent e)
{
this.Logger.LogPlatform.Log(e.Player.Username, LogPriority.Message, e.Player.Say);
}
}
}
|
using CupCake.Core.Log;
using CupCake.Messages.Receive;
using CupCake.Players;
namespace CupCake.Server.Muffins
{
public class LogMuffin : CupCakeMuffin
{
protected override void Enable()
{
this.Events.Bind<SayPlayerEvent>(this.OnSay);
this.Events.Bind<WriteReceiveEvent>(this.OnWrite);
this.Events.Bind<InfoReceiveEvent>(this.OnInfo);
this.Events.Bind<UpgradeReceiveEvent>(this.OnUpgrade);
}
private void OnUpgrade(object sender, UpgradeReceiveEvent e)
{
this.Logger.Log(LogPriority.Message, "The game has been updated.");
}
private void OnInfo(object sender, InfoReceiveEvent e)
{
this.Logger.Log(LogPriority.Message, e.Title);
this.Logger.Log(LogPriority.Message, e.Text);
}
private void OnWrite(object sender, WriteReceiveEvent e)
{
this.Logger.LogPlatform.Log(e.Title, LogPriority.Message, e.Text);
}
private void OnSay(object sender, SayPlayerEvent e)
{
this.Logger.LogPlatform.Log(e.Player.Username, LogPriority.Message, e.Player.Say);
}
}
}
|
Make info messages look better
|
Make info messages look better
|
C#
|
mit
|
Yonom/CupCake
|
f5fd81f104e95f0672c36f52b88959f6a6d015e7
|
Assets/SourceCode/MainRoomSelector.cs
|
Assets/SourceCode/MainRoomSelector.cs
|
using UnityEngine;
using System.Collections.Generic;
using System;
[RequireComponent(typeof(RoomGenerator))]
public class MainRoomSelector : MonoBehaviour {
public float aboveMeanWidthFactor = 1.25f;
public float aboveMeanLengthFactor = 1.25f;
[HideInInspector]
public List<Room> mainRooms;
[HideInInspector]
public List<Room> sideRooms;
Room[] _rooms;
public void Run()
{
var generator = this.GetComponent<RoomGenerator> ();
_rooms = generator.generatedRooms;
float meanWidth = 0f;
float meanLength = 0f;
foreach (var room in _rooms) {
meanWidth += room.width;
meanLength += room.length;
}
meanWidth /= _rooms.Length;
meanLength /= _rooms.Length;
foreach (var room in _rooms) {
if (room.width >= meanWidth * aboveMeanWidthFactor
&& room.length >= meanLength * aboveMeanLengthFactor)
{
mainRooms.Add (room);
room.isMainRoom = true;
} else {
sideRooms.Add (room);
room.isMainRoom = false;
}
}
}
}
|
using UnityEngine;
using System.Collections.Generic;
using System;
[RequireComponent(typeof(RoomGenerator))]
public class MainRoomSelector : MonoBehaviour {
public float aboveMeanWidthFactor = 1.25f;
public float aboveMeanLengthFactor = 1.25f;
[HideInInspector]
public List<Room> mainRooms;
[HideInInspector]
public List<Room> sideRooms;
Room[] _rooms;
public void Run()
{
mainRooms = new List<Room>();
sideRooms = new List<Room>();
var generator = this.GetComponent<RoomGenerator> ();
_rooms = generator.generatedRooms;
float meanWidth = 0f;
float meanLength = 0f;
foreach (var room in _rooms) {
meanWidth += room.width;
meanLength += room.length;
}
meanWidth /= _rooms.Length;
meanLength /= _rooms.Length;
foreach (var room in _rooms) {
if (room.width >= meanWidth * aboveMeanWidthFactor
&& room.length >= meanLength * aboveMeanLengthFactor)
{
mainRooms.Add (room);
room.isMainRoom = true;
} else {
sideRooms.Add (room);
room.isMainRoom = false;
}
}
}
}
|
Reset list of main and side rooms on every selection
|
Reset list of main and side rooms on every selection
|
C#
|
mit
|
Saduras/DungeonGenerator
|
6f02bed78375c49bcad27d574f997581876239fc
|
Mollie.Api/Models/Order/Request/OrderRefundRequest.cs
|
Mollie.Api/Models/Order/Request/OrderRefundRequest.cs
|
using System.Collections.Generic;
namespace Mollie.Api.Models.Order {
public class OrderRefundRequest {
/// <summary>
/// An array of objects containing the order line details you want to create a refund for. If you send
/// an empty array, the entire order will be refunded.
/// </summary>
public IEnumerable<OrderLineRequest> Lines { get; set; }
/// <summary>
/// The description of the refund you are creating. This will be shown to the consumer on their card or
/// bank statement when possible. Max. 140 characters.
/// </summary>
public string Description { get; set; }
}
}
|
using System.Collections.Generic;
namespace Mollie.Api.Models.Order {
public class OrderRefundRequest {
/// <summary>
/// An array of objects containing the order line details you want to create a refund for. If you send
/// an empty array, the entire order will be refunded.
/// </summary>
public IEnumerable<OrderLineDetails> Lines { get; set; }
/// <summary>
/// The description of the refund you are creating. This will be shown to the consumer on their card or
/// bank statement when possible. Max. 140 characters.
/// </summary>
public string Description { get; set; }
}
}
|
Fix for Order Lines in Order Refund
|
Fix for Order Lines in Order Refund
|
C#
|
mit
|
Viincenttt/MollieApi,Viincenttt/MollieApi
|
366133a2001270fdf692e79bb3ae4969b44f3323
|
Examples/TraktApiSharp.Example.UWP/App.xaml.cs
|
Examples/TraktApiSharp.Example.UWP/App.xaml.cs
|
namespace TraktApiSharp.Example.UWP
{
using Services.SettingsServices;
using System.Threading.Tasks;
using Template10.Controls;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
[Bindable]
sealed partial class App : Template10.Common.BootStrapper
{
public App()
{
InitializeComponent();
SplashFactory = (e) => new Views.Splash(e);
var settings = SettingsService.Instance;
RequestedTheme = settings.AppTheme;
CacheMaxDuration = settings.CacheMaxDuration;
ShowShellBackButton = settings.UseShellBackButton;
}
public override async Task OnInitializeAsync(IActivatedEventArgs args)
{
if (Window.Current.Content as ModalDialog == null)
{
// create a new frame
var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include);
// create modal root
Window.Current.Content = new ModalDialog
{
DisableBackButtonWhenModal = true,
Content = new Views.Shell(nav),
ModalContent = new Views.Busy(),
};
}
await Task.CompletedTask;
}
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
NavigationService.Navigate(typeof(Views.MainPage));
await Task.CompletedTask;
}
}
}
|
namespace TraktApiSharp.Example.UWP
{
using Services.SettingsServices;
using Services.TraktService;
using System.Threading.Tasks;
using Template10.Controls;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
[Bindable]
sealed partial class App : Template10.Common.BootStrapper
{
public App()
{
InitializeComponent();
SplashFactory = (e) => new Views.Splash(e);
var settings = SettingsService.Instance;
RequestedTheme = settings.AppTheme;
CacheMaxDuration = settings.CacheMaxDuration;
ShowShellBackButton = settings.UseShellBackButton;
}
public override async Task OnInitializeAsync(IActivatedEventArgs args)
{
if (Window.Current.Content as ModalDialog == null)
{
// create a new frame
var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include);
// create modal root
Window.Current.Content = new ModalDialog
{
DisableBackButtonWhenModal = true,
Content = new Views.Shell(nav),
ModalContent = new Views.Busy(),
};
}
await Task.CompletedTask;
}
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
NavigationService.Navigate(typeof(Views.MainPage));
await Task.CompletedTask;
}
public override async Task OnSuspendingAsync(object s, SuspendingEventArgs e, bool prelaunchActivated)
{
var authorization = TraktServiceProvider.Instance.Client.Authorization;
SettingsService.Instance.TraktClientAuthorization = authorization;
await Task.CompletedTask;
}
}
}
|
Save authorization information, when app is suspended.
|
Save authorization information, when app is suspended.
|
C#
|
mit
|
henrikfroehling/TraktApiSharp
|
dece1de8448f35ba1da0432346bd39891238115d
|
CefSharp/IRequest.cs
|
CefSharp/IRequest.cs
|
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.Collections.Specialized;
namespace CefSharp
{
public interface IRequest
{
string Url { get; set; }
string Method { get; }
string Body { get; }
NameValueCollection Headers { get; set; }
TransitionType TransitionType { get; }
}
}
|
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.Collections.Specialized;
namespace CefSharp
{
public interface IRequest
{
string Url { get; set; }
string Method { get; }
string Body { get; }
NameValueCollection Headers { get; set; }
/// <summary>
/// Get the transition type for this request.
/// Applies to requests that represent a main frame or sub-frame navigation.
/// </summary>
TransitionType TransitionType { get; }
}
}
|
Add xml comment to TransitionType
|
Add xml comment to TransitionType
|
C#
|
bsd-3-clause
|
Haraguroicha/CefSharp,ITGlobal/CefSharp,NumbersInternational/CefSharp,battewr/CefSharp,windygu/CefSharp,jamespearce2006/CefSharp,rover886/CefSharp,Octopus-ITSM/CefSharp,ITGlobal/CefSharp,zhangjingpu/CefSharp,haozhouxu/CefSharp,AJDev77/CefSharp,jamespearce2006/CefSharp,joshvera/CefSharp,yoder/CefSharp,rover886/CefSharp,Haraguroicha/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,battewr/CefSharp,zhangjingpu/CefSharp,illfang/CefSharp,yoder/CefSharp,Octopus-ITSM/CefSharp,NumbersInternational/CefSharp,twxstar/CefSharp,NumbersInternational/CefSharp,wangzheng888520/CefSharp,windygu/CefSharp,Livit/CefSharp,dga711/CefSharp,zhangjingpu/CefSharp,gregmartinhtc/CefSharp,Livit/CefSharp,joshvera/CefSharp,windygu/CefSharp,twxstar/CefSharp,haozhouxu/CefSharp,rlmcneary2/CefSharp,Octopus-ITSM/CefSharp,NumbersInternational/CefSharp,ruisebastiao/CefSharp,dga711/CefSharp,dga711/CefSharp,wangzheng888520/CefSharp,rover886/CefSharp,Livit/CefSharp,VioletLife/CefSharp,wangzheng888520/CefSharp,Livit/CefSharp,gregmartinhtc/CefSharp,illfang/CefSharp,zhangjingpu/CefSharp,VioletLife/CefSharp,Haraguroicha/CefSharp,ruisebastiao/CefSharp,rlmcneary2/CefSharp,illfang/CefSharp,rover886/CefSharp,ruisebastiao/CefSharp,VioletLife/CefSharp,Haraguroicha/CefSharp,gregmartinhtc/CefSharp,yoder/CefSharp,battewr/CefSharp,Haraguroicha/CefSharp,AJDev77/CefSharp,haozhouxu/CefSharp,rlmcneary2/CefSharp,dga711/CefSharp,illfang/CefSharp,VioletLife/CefSharp,jamespearce2006/CefSharp,AJDev77/CefSharp,AJDev77/CefSharp,joshvera/CefSharp,joshvera/CefSharp,gregmartinhtc/CefSharp,Octopus-ITSM/CefSharp,twxstar/CefSharp,ITGlobal/CefSharp,battewr/CefSharp,ruisebastiao/CefSharp,yoder/CefSharp,twxstar/CefSharp,ITGlobal/CefSharp,haozhouxu/CefSharp,rover886/CefSharp,windygu/CefSharp,rlmcneary2/CefSharp,wangzheng888520/CefSharp
|
c6eca5afe2dbc12d3a5a6046500f88bd8ccb3376
|
src/live.asp.net/Controllers/HomeController.cs
|
src/live.asp.net/Controllers/HomeController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using live.asp.net.Data;
using live.asp.net.Services;
using live.asp.net.ViewModels;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
namespace live.asp.net.Controllers
{
public class HomeController : Controller
{
private readonly AppDbContext _db;
private readonly IShowsService _showsService;
public HomeController(IShowsService showsService, AppDbContext dbContext)
{
_showsService = showsService;
_db = dbContext;
}
[Route("/")]
public async Task<IActionResult> Index(bool? disableCache, bool? useDesignData)
{
var liveShowDetails = await _db.LiveShowDetails.FirstOrDefaultAsync();
var showList = await _showsService.GetRecordedShowsAsync(User, disableCache ?? false, useDesignData ?? false);
return View(new HomeViewModel
{
AdminMessage = liveShowDetails?.AdminMessage,
NextShowDate = liveShowDetails?.NextShowDate,
LiveShowEmbedUrl = liveShowDetails?.LiveShowEmbedUrl,
PreviousShows = showList.Shows,
MoreShowsUrl = showList.MoreShowsUrl
});
}
[HttpGet("error")]
public IActionResult Error()
{
return View();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using live.asp.net.Data;
using live.asp.net.Services;
using live.asp.net.ViewModels;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
namespace live.asp.net.Controllers
{
public class HomeController : Controller
{
private readonly AppDbContext _db;
private readonly IShowsService _showsService;
public HomeController(IShowsService showsService, AppDbContext dbContext)
{
_showsService = showsService;
_db = dbContext;
}
[Route("/")]
public async Task<IActionResult> Index(bool? disableCache, bool? useDesignData)
{
var liveShowDetails = await _db.LiveShowDetails.FirstOrDefaultAsync();
var showList = await _showsService.GetRecordedShowsAsync(User, disableCache ?? false, useDesignData ?? false);
DateTimeOffset? nextShowDateOffset = null;
if (liveShowDetails != null)
{
nextShowDateOffset= TimeZoneInfo.ConvertTimeBySystemTimeZoneId(liveShowDetails.NextShowDate.Value, "Pacific Standard Time");
}
return View(new HomeViewModel
{
AdminMessage = liveShowDetails?.AdminMessage,
NextShowDate = nextShowDateOffset,
LiveShowEmbedUrl = liveShowDetails?.LiveShowEmbedUrl,
PreviousShows = showList.Shows,
MoreShowsUrl = showList.MoreShowsUrl
});
}
[HttpGet("error")]
public IActionResult Error()
{
return View();
}
}
}
|
Fix home page next show time
|
Fix home page next show time
|
C#
|
mit
|
reactiveui/website,M-Zuber/live.asp.net,pakrym/kudutest,peterblazejewicz/live.asp.net,aspnet/live.asp.net,Janisku7/live.asp.net,pakrym/kudutest,aspnet/live.asp.net,TimMurphy/live.asp.net,hanu412/live.asp.net,M-Zuber/live.asp.net,SaarCohen/live.asp.net,peterblazejewicz/live.asp.net,SaarCohen/live.asp.net,reactiveui/website,dotnetdude/live.asp.net,aspnet/live.asp.net,hanu412/live.asp.net,yongyi781/live.asp.net,matsprea/live.asp.net,yongyi781/live.asp.net,iaingalloway/live.asp.net,sejka/live.asp.net,TimMurphy/live.asp.net,Janisku7/live.asp.net,rmarinho/live.asp.net,dotnetdude/live.asp.net,reactiveui/website,jmatthiesen/VSTACOLive,rmarinho/live.asp.net,sejka/live.asp.net,matsprea/live.asp.net,reactiveui/website,jmatthiesen/VSTACOLive,iaingalloway/live.asp.net
|
2220f3fe007a07170a487ec4916e85ef8d252590
|
T4TS.Tests/Output/MemberOutputAppenderTests.cs
|
T4TS.Tests/Output/MemberOutputAppenderTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace T4TS.Tests
{
[TestClass]
public class MemberOutputAppenderTests
{
[TestMethod]
public void MemberOutputAppenderRespectsCompatibilityVersion()
{
var sb = new StringBuilder();
var member = new TypeScriptInterfaceMember
{
Name = "Foo",
//FullName = "Foo",
Type = new BoolType()
};
var settings = new Settings();
var appender = new MemberOutputAppender(sb, 0, settings);
settings.CompatibilityVersion = new Version(0, 8, 3);
appender.AppendOutput(member);
Assert.IsTrue(sb.ToString().Contains("bool"));
Assert.IsFalse(sb.ToString().Contains("boolean"));
sb.Clear();
settings.CompatibilityVersion = new Version(0, 9, 0);
appender.AppendOutput(member);
Assert.IsTrue(sb.ToString().Contains("boolean"));
sb.Clear();
settings.CompatibilityVersion = null;
appender.AppendOutput(member);
Assert.IsTrue(sb.ToString().Contains("boolean"));
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace T4TS.Tests
{
[TestClass]
public class MemberOutputAppenderTests
{
[TestMethod]
public void TypescriptVersion083YieldsBool()
{
var sb = new StringBuilder();
var member = new TypeScriptInterfaceMember
{
Name = "Foo",
Type = new BoolType()
};
var appender = new MemberOutputAppender(sb, 0, new Settings
{
CompatibilityVersion = new Version(0, 8, 3)
});
appender.AppendOutput(member);
Assert.AreEqual("Foo: bool;", sb.ToString().Trim());
}
[TestMethod]
public void TypescriptVersion090YieldsBoolean()
{
var sb = new StringBuilder();
var member = new TypeScriptInterfaceMember
{
Name = "Foo",
Type = new BoolType()
};
var appender = new MemberOutputAppender(sb, 0, new Settings
{
CompatibilityVersion = new Version(0, 9, 0)
});
appender.AppendOutput(member);
Assert.AreEqual("Foo: boolean;", sb.ToString().Trim());
}
[TestMethod]
public void DefaultTypescriptVersionYieldsBoolean()
{
var sb = new StringBuilder();
var member = new TypeScriptInterfaceMember
{
Name = "Foo",
Type = new BoolType()
};
var appender = new MemberOutputAppender(sb, 0, new Settings
{
CompatibilityVersion = null
});
appender.AppendOutput(member);
Assert.AreEqual("Foo: boolean;", sb.ToString().Trim());
}
}
}
|
Split MemberOutputTests to separate asserts
|
Split MemberOutputTests to separate asserts
|
C#
|
apache-2.0
|
bazubii/t4ts,AkosLukacs/t4ts,AkosLukacs/t4ts,bazubii/t4ts,dolly22/t4ts,cskeppstedt/t4ts,cskeppstedt/t4ts,dolly22/t4ts
|
482b52e6cc2aad897fabf3a6ee032f8202009a64
|
TestMoya.Runner/Runners/TimerDecoratorTests.cs
|
TestMoya.Runner/Runners/TimerDecoratorTests.cs
|
namespace TestMoya.Runner.Runners
{
using System;
using System.Reflection;
using System.Threading;
using Moq;
using Moya.Models;
using Moya.Runner.Runners;
using Xunit;
public class TimerDecoratorTests
{
private readonly Mock<ITestRunner> testRunnerMock;
private readonly TimerDecorator timerDecorator;
public TimerDecoratorTests()
{
testRunnerMock = new Mock<ITestRunner>();
timerDecorator = new TimerDecorator(testRunnerMock.Object);
}
[Fact]
public void TimerDecoratorExecuteRunsMethod()
{
bool methodRun = false;
MethodInfo method = ((Action)(() => methodRun = true)).Method;
testRunnerMock
.Setup(x => x.Execute(method))
.Callback(() => methodRun = true)
.Returns(new TestResult());
timerDecorator.Execute(method);
Assert.True(methodRun);
}
[Fact]
public void TimerDecoratorExecuteAddsDurationToResult()
{
bool methodRun = false;
MethodInfo method = ((Action)(() => Thread.Sleep(1))).Method;
testRunnerMock
.Setup(x => x.Execute(method))
.Callback(() => methodRun = true)
.Returns(new TestResult());
var result = timerDecorator.Execute(method);
Assert.True(result.Duration > 0);
}
}
}
|
namespace TestMoya.Runner.Runners
{
using System;
using System.Reflection;
using Moq;
using Moya.Attributes;
using Moya.Models;
using Moya.Runner.Runners;
using Xunit;
public class TimerDecoratorTests
{
private readonly Mock<ITestRunner> testRunnerMock;
private TimerDecorator timerDecorator;
public TimerDecoratorTests()
{
testRunnerMock = new Mock<ITestRunner>();
}
[Fact]
public void TimerDecoratorExecuteRunsMethod()
{
timerDecorator = new TimerDecorator(testRunnerMock.Object);
bool methodRun = false;
MethodInfo method = ((Action)(() => methodRun = true)).Method;
testRunnerMock
.Setup(x => x.Execute(method))
.Callback(() => methodRun = true)
.Returns(new TestResult());
timerDecorator.Execute(method);
Assert.True(methodRun);
}
[Fact]
public void TimerDecoratorExecuteAddsDurationToResult()
{
MethodInfo method = ((Action)TestClass.MethodWithMoyaAttribute).Method;
timerDecorator = new TimerDecorator(new StressTestRunner());
var result = timerDecorator.Execute(method);
Assert.True(result.Duration > 0);
}
public class TestClass
{
[Stress]
public static void MethodWithMoyaAttribute()
{
}
}
}
}
|
Update timerdecorator test to prevent failed test
|
Update timerdecorator test to prevent failed test
The previous test could fail from time to time, because the duration could be 0. The Thread.Sleep(1) was never executed.
|
C#
|
mit
|
Hammerstad/Moya
|
aefe042310bdeb59ff52a4cd349e2cf1c0b46c64
|
CupCake.Client/Settings/Settings.cs
|
CupCake.Client/Settings/Settings.cs
|
using System;
using System.Collections.Generic;
using CupCake.Protocol;
namespace CupCake.Client.Settings
{
public class Settings
{
public Settings()
: this(false)
{
}
public Settings(bool isNew)
{
this.Accounts = new List<Account>();
this.Profiles = new List<Profile>();
this.RecentWorlds = new List<RecentWorld>();
this.Databases = new List<Database>();
if (isNew)
{
this.Profiles.Add(new Profile
{
Id = SettingsManager.DefaultId,
Name = SettingsManager.DefaultString,
Folder = SettingsManager.ProfilesPath
});
this.Databases.Add(new Database
{
Id = SettingsManager.DefaultId,
Name = SettingsManager.DefaultString,
Type = DatabaseType.SQLite,
ConnectionString = String.Format(Database.SQLiteFormat, SettingsManager.DefaultDatabasePath)
});
}
}
public List<Account> Accounts { get; set; }
public List<Profile> Profiles { get; set; }
public List<RecentWorld> RecentWorlds { get; set; }
public List<Database> Databases { get; set; }
public int LastProfileId { get; set; }
public int LastAccountId { get; set; }
public int LastRecentWorldId { get; set; }
public int LastDatabaseId { get; set; }
public string LastAttachAddress { get; set; }
public string LastAttachPin { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using CupCake.Protocol;
namespace CupCake.Client.Settings
{
public class Settings
{
public Settings()
: this(false)
{
}
public Settings(bool isNew)
{
this.Accounts = new List<Account>();
this.Profiles = new List<Profile>();
this.RecentWorlds = new List<RecentWorld>();
this.Databases = new List<Database>();
if (isNew)
{
this.Profiles.Add(new Profile
{
Id = SettingsManager.DefaultId,
Name = SettingsManager.DefaultString,
Folder = SettingsManager.ProfilesPath,
Database = SettingsManager.DefaultId
});
this.Databases.Add(new Database
{
Id = SettingsManager.DefaultId,
Name = SettingsManager.DefaultString,
Type = DatabaseType.SQLite,
ConnectionString = String.Format(Database.SQLiteFormat, SettingsManager.DefaultDatabasePath)
});
}
}
public List<Account> Accounts { get; set; }
public List<Profile> Profiles { get; set; }
public List<RecentWorld> RecentWorlds { get; set; }
public List<Database> Databases { get; set; }
public int LastProfileId { get; set; }
public int LastAccountId { get; set; }
public int LastRecentWorldId { get; set; }
public int LastDatabaseId { get; set; }
public string LastAttachAddress { get; set; }
public string LastAttachPin { get; set; }
}
}
|
Fix default database is not set properly the first time
|
Fix default database is not set properly the first time
|
C#
|
mit
|
Yonom/CupCake
|
9d79d47ebd43e1a9f20f0be6ba9f9b9c435a03f9
|
DNSAgent/Properties/AssemblyInfo.cs
|
DNSAgent/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("DNSAgent")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DNSAgent")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8424ad23-98aa-4697-a9e7-cb6d5b450c6c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DNSAgent")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DNSAgent")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8424ad23-98aa-4697-a9e7-cb6d5b450c6c")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Change version number to 1.0.
|
Change version number to 1.0.
|
C#
|
mit
|
stackia/DNSAgent
|
84655b0798d16f462ec24bb9727c91c2edcde55e
|
osu.Game/Overlays/Dashboard/Home/News/NewsTitleLink.cs
|
osu.Game/Overlays/Dashboard/Home/News/NewsTitleLink.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.Platform;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Dashboard.Home.News
{
public class NewsTitleLink : OsuHoverContainer
{
private readonly APINewsPost post;
public NewsTitleLink(APINewsPost post)
{
this.post = post;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
[BackgroundDependencyLoader]
private void load(GameHost host)
{
Child = new TextFlowContainer(t =>
{
t.Font = OsuFont.GetFont(weight: FontWeight.Bold);
})
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Text = post.Title
};
TooltipText = "view in browser";
Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
}
}
}
|
// 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.Platform;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Dashboard.Home.News
{
public class NewsTitleLink : OsuHoverContainer
{
private readonly APINewsPost post;
public NewsTitleLink(APINewsPost post)
{
this.post = post;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
[BackgroundDependencyLoader]
private void load(GameHost host, OverlayColourProvider colourProvider)
{
Child = new TextFlowContainer(t =>
{
t.Font = OsuFont.GetFont(weight: FontWeight.Bold);
})
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Text = post.Title
};
HoverColour = colourProvider.Light1;
TooltipText = "view in browser";
Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
}
}
}
|
Change hover colour for news title
|
Change hover colour for news title
|
C#
|
mit
|
ppy/osu,peppy/osu-new,UselessToucan/osu,peppy/osu,ppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu
|
44806f14481d1917b7126acc49e07ba22eb57f0d
|
src/CK.Glouton.Web/Controllers/StatisticsController.cs
|
src/CK.Glouton.Web/Controllers/StatisticsController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CK.Glouton.Lucene;
using Microsoft.AspNetCore.Mvc;
namespace CK.Glouton.Web.Controllers
{
[Route("api/stats")]
public class StatisticsController : Controller
{
LuceneStatistics luceneStatistics;
public StatisticsController()
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CK.Glouton.Lucene;
using CK.Glouton.Model.Lucene;
using Microsoft.AspNetCore.Mvc;
namespace CK.Glouton.Web.Controllers
{
[Route("api/stats")]
public class StatisticsController : Controller
{
private readonly ILuceneStatisticsService _luceneStatistics;
public StatisticsController(ILuceneStatisticsService luceneStatistics)
{
_luceneStatistics = luceneStatistics;
}
[HttpGet("logperappname")]
public Dictionary<string, int> LogPerAppName()
{
return _luceneStatistics.GetLogByAppName();
}
[HttpGet("exceptionperappname")]
public Dictionary<string, int> ExceptionPerAppName()
{
return _luceneStatistics.GetExceptionByAppName();
}
[HttpGet("Log")]
public int AllLogCount() => _luceneStatistics.AllLogCount();
[HttpGet("AppName")]
public int AppNameCount() => _luceneStatistics.AppNameCount;
[HttpGet("Exception")]
public int AllException() => _luceneStatistics.AllExceptionCount;
[HttpGet("AppNames")]
public IEnumerable<string> AppNames() => _luceneStatistics.GetAppNames;
}
}
|
Add api point to controller.
|
Add api point to controller.
|
C#
|
mit
|
ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton
|
132bec180a271a921ce250a9adb695dce9b4a8d0
|
src/TeamCityConsole.Tests/Utils/FileDownloaderTests.cs
|
src/TeamCityConsole.Tests/Utils/FileDownloaderTests.cs
|
using NSubstitute;
using Ploeh.AutoFixture.Xunit;
using TeamCityApi.Domain;
using TeamCityConsole.Tests.Helpers;
using TeamCityConsole.Utils;
using Xunit.Extensions;
namespace TeamCityConsole.Tests.Utils
{
public class FileDownloaderTests
{
[Theory]
[AutoNSubstituteData]
public void Should_unzip_when_double_star_used([Frozen]IFileSystem fileSystem, FileDownloader downloader)
{
var file = new File() { Name = "web.zip!**", ContentHref = ""};
string tempFile = @"c:\temp\abc.tmp";
fileSystem.CreateTempFile().Returns(tempFile);
downloader.Download(@"c:\temp", file).Wait();
fileSystem.Received().ExtractToDirectory(tempFile, @"c:\temp");
}
[Theory]
[AutoNSubstituteData]
public void Should_delete_target_directory_when_unziping([Frozen]IFileSystem fileSystem, FileDownloader downloader)
{
var file = new File() { Name = "web.zip!**", ContentHref = "" };
var destPath = @"c:\temp";
fileSystem.DirectoryExists(destPath).Returns(true);
downloader.Download(destPath, file).Wait();
fileSystem.Received().DeleteDirectory(destPath, true);
}
}
}
|
using NSubstitute;
using Ploeh.AutoFixture.Xunit;
using TeamCityApi.Domain;
using TeamCityConsole.Tests.Helpers;
using TeamCityConsole.Utils;
using Xunit.Extensions;
namespace TeamCityConsole.Tests.Utils
{
public class FileDownloaderTests
{
[Theory]
[AutoNSubstituteData]
public void Should_unzip_when_double_star_used([Frozen]IFileSystem fileSystem, FileDownloader downloader)
{
var file = new File() { Name = "web.zip!**", ContentHref = ""};
string tempFile = @"c:\temp\abc.tmp";
fileSystem.CreateTempFile().Returns(tempFile);
downloader.Download(@"c:\temp", file).Wait();
fileSystem.Received().ExtractToDirectory(tempFile, @"c:\temp");
}
}
}
|
Remove invalid test as the directory should not be deleted since multiple artifacts / dependencies maybe be unzipping into a folder or a child folder.
|
Remove invalid test as the directory should not be deleted since multiple artifacts / dependencies maybe be unzipping into a folder or a child folder.
|
C#
|
mit
|
ComputerWorkware/TeamCityApi
|
e1de187a33b4825cb8fa4a6650f7505d147780a9
|
DesktopWidgets/Widgets/Search/Settings.cs
|
DesktopWidgets/Widgets/Search/Settings.cs
|
using System.ComponentModel;
using DesktopWidgets.Classes;
namespace DesktopWidgets.Widgets.Search
{
public class Settings : WidgetSettingsBase
{
public Settings()
{
Width = 150;
}
[Category("General")]
[DisplayName("Base URL")]
public string BaseUrl { get; set; }
[Category("General")]
[DisplayName("URL Suffix")]
public string URLSuffix { get; set; }
}
}
|
using System.ComponentModel;
using DesktopWidgets.Classes;
namespace DesktopWidgets.Widgets.Search
{
public class Settings : WidgetSettingsBase
{
public Settings()
{
Width = 150;
}
[Category("General")]
[DisplayName("URL Prefix")]
public string BaseUrl { get; set; } = "http://";
[Category("General")]
[DisplayName("URL Suffix")]
public string URLSuffix { get; set; }
}
}
|
Change "Search" widget "Base URL" default value
|
Change "Search" widget "Base URL" default value
|
C#
|
apache-2.0
|
danielchalmers/DesktopWidgets
|
fd8ba7a027e4956de0d7e214762fd07a026e303e
|
Engine/Vehicle/AI/Scripts/TriggerSound.cs
|
Engine/Vehicle/AI/Scripts/TriggerSound.cs
|
using UnityEngine;
using System.Collections;
public class TriggerSound : MonoBehaviour
{
public string tagName1="";
public string tagName2 = "";
public AudioClip triggerSound;
public float soundVolume = 1.0f;
private AudioSource triggerAudioSource;
void Awake()
{
InitSound(out triggerAudioSource, triggerSound, soundVolume, false);
}
void InitSound(out AudioSource myAudioSource, AudioClip myClip, float myVolume, bool looping)
{
myAudioSource = gameObject.AddComponent("AudioSource") as AudioSource;
myAudioSource.playOnAwake = false;
myAudioSource.clip = myClip;
myAudioSource.loop = looping;
myAudioSource.volume = myVolume;
//myAudioSource.rolloffMode = AudioRolloffMode.Linear;
}
void OnTriggerEnter(Collider other)
{
//if (other.gameObject.tag == tagName1 || other.gameObject.tag == tagName2) //2013-08-02
if (other.gameObject.CompareTag(tagName1) || other.gameObject.CompareTag(tagName2)) //2013-08-02
{
if (other.gameObject.layer != 2) //2011-12-27
triggerAudioSource.Play();
}
}
}
|
using UnityEngine;
using System.Collections;
public class TriggerSound : MonoBehaviour {
public string tagName1 = "";
public string tagName2 = "";
public AudioClip triggerSound;
public float soundVolume = 1.0f;
private AudioSource triggerAudioSource;
void Awake() {
InitSound(out triggerAudioSource, triggerSound, soundVolume, false);
}
void InitSound(out AudioSource audioSource, AudioClip clip, float volume, bool looping) {
audioSource = gameObject.AddComponent("AudioSource") as AudioSource;
audioSource.playOnAwake = false;
audioSource.clip = clip;
audioSource.loop = looping;
audioSource.volume = (float)GameProfiles.Current.GetAudioEffectsVolume();
//myAudioSource.rolloffMode = AudioRolloffMode.Linear;
}
void OnTriggerEnter(Collider other) {
//if (other.gameObject.tag == tagName1 || other.gameObject.tag == tagName2) //2013-08-02
if (other.gameObject.CompareTag(tagName1) || other.gameObject.CompareTag(tagName2)) { //2013-08-02
if (other.gameObject.layer != 2) //2011-12-27
triggerAudioSource.Play();
}
}
}
|
Update shadows. Update results screen. Update throttling speed modifier within safe range.
|
Update shadows. Update results screen. Update throttling speed modifier within safe range.
|
C#
|
mit
|
drawcode/game-lib-engine
|
c0db5039b594575378ff302e52434fa72f4dab9b
|
Source/System.Management/Automation/Internal/InternalCommand.cs
|
Source/System.Management/Automation/Internal/InternalCommand.cs
|
// Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/
using System.Management.Automation.Host;
using System.Xml.Schema;
using Pash.Implementation;
namespace System.Management.Automation.Internal
{
public abstract class InternalCommand
{
internal CommandInfo CommandInfo { get; set; }
internal PSHost PSHostInternal { get; private set; }
internal PSObject CurrentPipelineObject { get; set; }
internal SessionState State { get; private set; }
internal ICommandRuntime CommandRuntime { get; set; }
private ExecutionContext _executionContext;
internal ExecutionContext ExecutionContext
{
get
{
return _executionContext;
}
set
{
_executionContext = value;
State = new SessionState(_executionContext.SessionState.SessionStateGlobal);
PSHostInternal = _executionContext.LocalHost;
}
}
internal bool IsStopping
{
get
{
return ((PipelineCommandRuntime)CommandRuntime).IsStopping;
}
}
internal InternalCommand() { }
internal virtual void DoBeginProcessing() { }
internal virtual void DoEndProcessing() { }
internal virtual void DoProcessRecord() { }
internal virtual void DoStopProcessing() { }
internal void ThrowIfStopping() { }
}
}
|
// Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/
using System.Management.Automation.Host;
using System.Xml.Schema;
using Pash.Implementation;
namespace System.Management.Automation.Internal
{
public abstract class InternalCommand
{
internal CommandInfo CommandInfo { get; set; }
internal PSHost PSHostInternal { get; private set; }
internal PSObject CurrentPipelineObject { get; set; }
internal SessionState State { get; private set; }
public ICommandRuntime CommandRuntime { get; set; }
private ExecutionContext _executionContext;
internal ExecutionContext ExecutionContext
{
get
{
return _executionContext;
}
set
{
_executionContext = value;
State = new SessionState(_executionContext.SessionState.SessionStateGlobal);
PSHostInternal = _executionContext.LocalHost;
}
}
internal bool IsStopping
{
get
{
return ((PipelineCommandRuntime)CommandRuntime).IsStopping;
}
}
internal InternalCommand() { }
internal virtual void DoBeginProcessing() { }
internal virtual void DoEndProcessing() { }
internal virtual void DoProcessRecord() { }
internal virtual void DoStopProcessing() { }
internal void ThrowIfStopping() { }
}
}
|
Allow the CommandRuntime to be set for a cmdlet.
|
Allow the CommandRuntime to be set for a cmdlet.
The CommandRuntime property should probably be moved to the Cmdlet class.
http://msdn.microsoft.com/en-us/library/system.management.automation.cmdlet_properties.aspx
|
C#
|
bsd-3-clause
|
sburnicki/Pash,sillvan/Pash,Jaykul/Pash,mrward/Pash,ForNeVeR/Pash,ForNeVeR/Pash,mrward/Pash,Jaykul/Pash,mrward/Pash,WimObiwan/Pash,sillvan/Pash,sillvan/Pash,WimObiwan/Pash,sburnicki/Pash,ForNeVeR/Pash,sillvan/Pash,WimObiwan/Pash,Jaykul/Pash,ForNeVeR/Pash,Jaykul/Pash,sburnicki/Pash,sburnicki/Pash,WimObiwan/Pash,mrward/Pash
|
e01bcdec965292ca33addb312be572f6024067eb
|
RepoZ.Api.Mac/IO/MacPathActionProvider.cs
|
RepoZ.Api.Mac/IO/MacPathActionProvider.cs
|
using System;
using System.Collections.Generic;
using RepoZ.Api.IO;
namespace RepoZ.Api.Mac
{
public class MacPathActionProvider : IPathActionProvider
{
public IEnumerable<PathAction> GetFor(string path)
{
yield return createPathAction("Open", "nil");
}
private PathAction createPathAction(string name, string command)
{
return new PathAction()
{
Name = name,
Action = (sender, args) => sender = null
};
}
private PathAction createDefaultPathAction(string name, string command)
{
var action = createPathAction(name, command);
action.IsDefault = true;
return action;
}
}
}
|
using System.Diagnostics;
using System.Collections.Generic;
using RepoZ.Api.IO;
namespace RepoZ.Api.Mac
{
public class MacPathActionProvider : IPathActionProvider
{
public IEnumerable<PathAction> GetFor(string path)
{
yield return createDefaultPathAction("Open in Finder", path);
}
private PathAction createPathAction(string name, string command)
{
return new PathAction()
{
Name = name,
Action = (sender, args) => startProcess(command)
};
}
private PathAction createDefaultPathAction(string name, string command)
{
var action = createPathAction(name, command);
action.IsDefault = true;
return action;
}
private void startProcess(string command)
{
Process.Start(command);
}
}
}
|
Add default path action provider for Mac
|
Add default path action provider for Mac
|
C#
|
mit
|
awaescher/RepoZ,awaescher/RepoZ
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.