commit
stringlengths 40
40
| subject
stringlengths 4
1.73k
| repos
stringlengths 5
127k
| old_file
stringlengths 2
751
| new_file
stringlengths 2
751
| new_contents
stringlengths 1
8.98k
| old_contents
stringlengths 0
6.59k
| license
stringclasses 13
values | lang
stringclasses 23
values |
---|---|---|---|---|---|---|---|---|
0b6a0a9c083384cdb911544488ba71569baea374 | Update GelfAmqpAppender.cs | jjchiw/gelf4net,jjchiw/gelf4net | src/Gelf4net/Appender/GelfAmqpAppender.cs | src/Gelf4net/Appender/GelfAmqpAppender.cs | using log4net.Appender;
using log4net.Util;
using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace gelf4net.Appender
{
public class GelfAmqpAppender : AppenderSkeleton
{
public GelfAmqpAppender()
{
Encoding = Encoding.UTF8;
}
protected ConnectionFactory ConnectionFactory { get; set; }
public string RemoteAddress { get; set; }
public int RemotePort { get; set; }
public string Exchange { get; set; }
public string Key { get; set; }
public string VirtualHost { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public Encoding Encoding { get; set; }
public override void ActivateOptions()
{
base.ActivateOptions();
InitializeConnectionFactory();
}
protected virtual void InitializeConnectionFactory()
{
ConnectionFactory = new ConnectionFactory()
{
Protocol = Protocols.FromEnvironment(),
HostName = RemoteAddress,
Port = RemotePort,
VirtualHost = VirtualHost,
UserName = Username,
Password = Password
};
}
protected override void Append(log4net.Core.LoggingEvent loggingEvent)
{
var message = RenderLoggingEvent(loggingEvent).GzipMessage(Encoding);
using (IConnection conn = ConnectionFactory.CreateConnection())
{
var model = conn.CreateModel();
byte[] messageBodyBytes = message;
model.BasicPublish(Exchange, Key, null, messageBodyBytes);
}
}
}
}
| using log4net.Appender;
using log4net.Util;
using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace gelf4net.Appender
{
public class GelfAmqpAppender : AppenderSkeleton
{
public GelfAmqpAppender()
{
Encoding = Encoding.UTF8;
}
protected ConnectionFactory ConnectionFactory { get; set; }
public string RemoteAddress { get; set; }
public int RemotePort { get; set; }
public string RemoteQueue { get; set; }
public string VirtualHost { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public Encoding Encoding { get; set; }
public override void ActivateOptions()
{
base.ActivateOptions();
InitializeConnectionFactory();
}
protected virtual void InitializeConnectionFactory()
{
ConnectionFactory = new ConnectionFactory()
{
Protocol = Protocols.FromEnvironment(),
HostName = RemoteAddress,
Port = RemotePort,
VirtualHost = VirtualHost,
UserName = Username,
Password = Password
};
}
protected override void Append(log4net.Core.LoggingEvent loggingEvent)
{
var message = RenderLoggingEvent(loggingEvent).GzipMessage(Encoding);
using (IConnection conn = ConnectionFactory.CreateConnection())
{
var model = conn.CreateModel();
model.ExchangeDeclare("sendExchange", ExchangeType.Direct);
model.QueueDeclare(RemoteQueue, true, true, true, null);
model.QueueBind(RemoteQueue, "sendExchange", "key");
byte[] messageBodyBytes = message;
model.BasicPublish(RemoteQueue, "key", null, messageBodyBytes);
}
}
}
}
| mit | C# |
3fe13b9088341f6c0ab2c1c51b6bd61fd947940e | Remove the TODO | jkotas/cli,gkhanna79/cli,blackdwarf/cli,jkotas/cli,gkhanna79/cli,gkhanna79/cli,jkotas/cli,stuartleeks/dotnet-cli,borgdylan/dotnet-cli,blackdwarf/cli,borgdylan/dotnet-cli,gkhanna79/cli,borgdylan/dotnet-cli,borgdylan/dotnet-cli,stuartleeks/dotnet-cli,stuartleeks/dotnet-cli,blackdwarf/cli,stuartleeks/dotnet-cli,blackdwarf/cli,jkotas/cli,anurse/Cli,borgdylan/dotnet-cli,stuartleeks/dotnet-cli,jkotas/cli,gkhanna79/cli | src/Microsoft.DotNet.Tools.Mcg/Program.cs | src/Microsoft.DotNet.Tools.Mcg/Program.cs | // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Microsoft.DotNet.Cli.Utils;
using System.CommandLine;
namespace Microsoft.DotNet.Tools.Compiler.Mcg
{
public class Program
{
private readonly static string HostExecutableName = "corerun" + Constants.ExeSuffix;
private readonly static string McgBinaryName = "mcg.exe";
private static string[] ParseResponseFile(string rspPath)
{
if (!File.Exists(rspPath))
{
Reporter.Error.WriteLine("Invalid Response File Path");
return null;
}
string content;
try
{
content = File.ReadAllText(rspPath);
}
catch (Exception)
{
Reporter.Error.WriteLine("Unable to Read Response File");
return null;
}
var nArgs = content.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
return nArgs;
}
public static int Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
return ExecuteMcg(args);
}
private static int ExecuteMcg(IEnumerable<string> arguments)
{
var executablePath = Path.Combine(AppContext.BaseDirectory, McgBinaryName);
var result = Command.Create(executablePath, arguments)
.ForwardStdErr()
.ForwardStdOut()
.Execute();
return result.ExitCode;
}
}
}
| // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Microsoft.DotNet.Cli.Utils;
using System.CommandLine;
namespace Microsoft.DotNet.Tools.Compiler.Mcg
{
public class Program
{
private readonly static string HostExecutableName = "corerun" + Constants.ExeSuffix;
private readonly static string McgBinaryName = "mcg.exe";
private static string[] ParseResponseFile(string rspPath)
{
if (!File.Exists(rspPath))
{
Reporter.Error.WriteLine("Invalid Response File Path");
return null;
}
string content;
try
{
content = File.ReadAllText(rspPath);
}
catch (Exception)
{
Reporter.Error.WriteLine("Unable to Read Response File");
return null;
}
var nArgs = content.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
return nArgs;
}
public static int Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
return ExecuteMcg(args);
}
private static int ExecuteMcg(IEnumerable<string> arguments)
{
// TODO : Mcg is assumed to be present under the current path.This will change once
// we have mcg working on coreclr and is available as a nuget package.
var executablePath = Path.Combine(AppContext.BaseDirectory, McgBinaryName);
var result = Command.Create(executablePath, arguments)
.ForwardStdErr()
.ForwardStdOut()
.Execute();
return result.ExitCode;
}
}
}
| mit | C# |
b7993a8dcc14533ffdf091b949f67521c1ac28af | Update Program.cs | venky76v/GitTest1 | ConsoleApp1/ConsoleApp1/Program.cs | ConsoleApp1/ConsoleApp1/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
// code was changed in github
Console.WriteLine("Some code changed in github as a part of Git Fundamentals channel 9 msdn tutorial");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
}
}
}
| mit | C# |
0691aadcffe3d315455b0530657402b4fa6b55dc | Bump Version to 2.0 for SemVer | mstum/Simplexcel,amyvmiwei/Simplexcel,mstum/Simplexcel | src/Simplexcel/Properties/AssemblyInfo.cs | src/Simplexcel/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("Simplexcel")]
[assembly: AssemblyDescription("Simplexcel .xlsx library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("http://www.stum.de")]
[assembly: AssemblyProduct("Simplexcel")]
[assembly: AssemblyCopyright("Copyright © 2013-2014 Michael Stum")]
[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("361a0979-d8e7-4897-9258-441b1cd8221a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Simplexcel")]
[assembly: AssemblyDescription("Simplexcel .xlsx library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("http://www.stum.de")]
[assembly: AssemblyProduct("Simplexcel")]
[assembly: AssemblyCopyright("Copyright © 2013-2014 Michael Stum")]
[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("361a0979-d8e7-4897-9258-441b1cd8221a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5.0")]
[assembly: AssemblyFileVersion("1.0.5.0")]
| mit | C# |
6d6134e78f2813a237228e9315d3cd87daf5a807 | Update comments | Minesweeper-6-Team-Project-Telerik/Minesweeper-6 | src2/ConsoleMinesweeper/Program.cs | src2/ConsoleMinesweeper/Program.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="Program.cs" company="Telerik Academy">
// Teamwork Project "Minesweeper-6"
// </copyright>
// <summary>
// The entry point of the program.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ConsoleMinesweeper
{
using ConsoleMinesweeper.Models;
/// <summary>
/// The program.
/// </summary>
public static class Program
{
/// <summary>
/// The main.
/// </summary>
/// <param name="args">
/// The args.
/// </param>
private static void Main(string[] args)
{
ConsoleMenus.StartMainMenu(new ConsoleWrapper());
}
}
}
| // --------------------------------------------------------------------------------------------------------------------
// <copyright file="Program.cs" company="">
//
// </copyright>
// <summary>
// The program.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ConsoleMinesweeper
{
using ConsoleMinesweeper.Models;
/// <summary>
/// The program.
/// </summary>
public static class Program
{
/// <summary>
/// The main.
/// </summary>
/// <param name="args">
/// The args.
/// </param>
private static void Main(string[] args)
{
ConsoleMenus.StartMainMenu(new ConsoleWrapper());
}
}
} | mit | C# |
0dbda70841b319feb30e7e51feb94fab59f131d9 | Update TestExample.cs | QuantConnect/pythonnet,AlexCatarino/pythonnet,pythonnet/pythonnet,yagweb/pythonnet,AlexCatarino/pythonnet,pythonnet/pythonnet,AlexCatarino/pythonnet,pythonnet/pythonnet,QuantConnect/pythonnet,QuantConnect/pythonnet,AlexCatarino/pythonnet,yagweb/pythonnet,yagweb/pythonnet,yagweb/pythonnet | src/embed_tests/TestExample.cs | src/embed_tests/TestExample.cs | using System;
using System.Collections.Generic;
using NUnit.Framework;
using Python.Runtime;
namespace Python.EmbeddingTest
{
public class TestExample
{
[OneTimeSetUp]
public void SetUp()
{
PythonEngine.Initialize();
}
[OneTimeTearDown]
public void Dispose()
{
PythonEngine.Shutdown();
}
[Test]
public void TestReadme()
{
dynamic np;
try
{
np = Py.Import("numpy");
}
catch (PythonException)
{
Assert.Inconclusive("Numpy or dependency not installed");
return;
}
Assert.AreEqual("1.0", np.cos(np.pi * 2).ToString());
dynamic sin = np.sin;
StringAssert.StartsWith("-0.95892", sin(5).ToString());
double c = np.cos(5) + sin(5);
Assert.AreEqual(-0.675262, c, 0.01);
dynamic a = np.array(new List<float> { 1, 2, 3 });
Assert.AreEqual("float64", a.dtype.ToString());
dynamic b = np.array(new List<float> { 6, 5, 4 }, Py.kw("dtype", np.int32));
Assert.AreEqual("int32", b.dtype.ToString());
Assert.AreEqual("[ 6. 10. 12.]", (a * b).ToString().Replace(" ", " "));
}
}
}
| using System;
using System.Collections.Generic;
using NUnit.Framework;
using Python.Runtime;
namespace Python.EmbeddingTest
{
public class TestExample
{
[OneTimeSetUp]
public void SetUp()
{
PythonEngine.Initialize();
}
[OneTimeTearDown]
public void Dispose()
{
PythonEngine.Shutdown();
}
[Test]
public void TestReadme()
{
dynamic np;
try
{
np = Py.Import("numpy");
}
catch (PythonException)
{
Assert.Inconclusive("Numpy or dependency not installed");
return;
}
Assert.AreEqual("1.0", np.cos(np.pi * 2).ToString());
dynamic sin = np.sin;
StringAssert.StartsWith("-0.95892", sin(5).ToString());
double c = np.cos(5) + sin(5);
Assert.AreEqual(-0.675262, c, 0.01);
dynamic a = np.array(new List<float> { 1, 2, 3 });
Assert.AreEqual("float64", a.dtype.ToString());
dynamic b = np.array(new List<float> { 6, 5, 4 }, Py.kw("dtype", np.int32));
Assert.AreEqual("int32", b.dtype.ToString());
Assert.AreEqual("[ 6. 10. 12.]", (a * b).ToString());
}
}
}
| mit | C# |
5cf3c18f89f2d38d0fe07170cc055f10f2742533 | Refactor obj to target in ISerializationConverter | dudzon/Glimpse,Glimpse/Glimpse,dudzon/Glimpse,sorenhl/Glimpse,paynecrl97/Glimpse,SusanaL/Glimpse,paynecrl97/Glimpse,gabrielweyer/Glimpse,gabrielweyer/Glimpse,paynecrl97/Glimpse,flcdrg/Glimpse,gabrielweyer/Glimpse,elkingtonmcb/Glimpse,flcdrg/Glimpse,SusanaL/Glimpse,SusanaL/Glimpse,elkingtonmcb/Glimpse,rho24/Glimpse,rho24/Glimpse,Glimpse/Glimpse,sorenhl/Glimpse,codevlabs/Glimpse,rho24/Glimpse,codevlabs/Glimpse,dudzon/Glimpse,elkingtonmcb/Glimpse,Glimpse/Glimpse,flcdrg/Glimpse,rho24/Glimpse,paynecrl97/Glimpse,sorenhl/Glimpse,codevlabs/Glimpse | source/Glimpse.Core/Extensibility/ISerializationConverter.cs | source/Glimpse.Core/Extensibility/ISerializationConverter.cs | using System;
using System.Collections.Generic;
namespace Glimpse.Core.Extensibility
{
/// <summary>
/// Definition for a converter that will provide a custom object
/// representation for the supported types.
/// </summary>
public interface ISerializationConverter
{
/// <summary>
/// Gets the supported types the converter will be invoked for.
/// </summary>
/// <value>The supported types.</value>
IEnumerable<Type> SupportedTypes { get; }
/// <summary>
/// Converts the specified object.
/// </summary>
/// <param name="target">The object to be converted.</param>
/// <returns>The new object representation.</returns>
object Convert(object target);
}
} | using System;
using System.Collections.Generic;
namespace Glimpse.Core.Extensibility
{
/// <summary>
/// Definition for a converter that will provide a custom object
/// representation for the supported types.
/// </summary>
public interface ISerializationConverter
{
/// <summary>
/// Gets the supported types the converter will be invoked for.
/// </summary>
/// <value>The supported types.</value>
IEnumerable<Type> SupportedTypes { get; }
/// <summary>
/// Converts the specified object.
/// </summary>
/// <param name="obj">The object to be converted.</param>
/// <returns>The new object representation.</returns>
object Convert(object obj);
}
} | apache-2.0 | C# |
7f902496f8fd6a93ff7d66cfdf006edfd70d187e | Work around broken mime-type detection. | nathansamson/F-Spot-Album-Exporter,mans0954/f-spot,GNOME/f-spot,nathansamson/F-Spot-Album-Exporter,mans0954/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,dkoeb/f-spot,Sanva/f-spot,dkoeb/f-spot,dkoeb/f-spot,mono/f-spot,GNOME/f-spot,nathansamson/F-Spot-Album-Exporter,Yetangitu/f-spot,GNOME/f-spot,mono/f-spot,mono/f-spot,mans0954/f-spot,Yetangitu/f-spot,GNOME/f-spot,mono/f-spot,Yetangitu/f-spot,mans0954/f-spot,mono/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,Yetangitu/f-spot,GNOME/f-spot,Sanva/f-spot,nathansamson/F-Spot-Album-Exporter,dkoeb/f-spot,dkoeb/f-spot,Yetangitu/f-spot,dkoeb/f-spot,mans0954/f-spot,mans0954/f-spot,mono/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,Sanva/f-spot | src/Utils/Metadata.cs | src/Utils/Metadata.cs | using Hyena;
using TagLib;
using System;
using GLib;
namespace FSpot.Utils
{
public static class Metadata
{
public static TagLib.Image.File Parse (SafeUri uri)
{
// Detect mime-type
var gfile = FileFactory.NewForUri (uri);
var info = gfile.QueryInfo ("standard::content-type", FileQueryInfoFlags.None, null);
var mime = info.ContentType;
if (mime.StartsWith ("application/x-extension-")) {
// Works around broken metadata detection - https://bugzilla.gnome.org/show_bug.cgi?id=624781
mime = String.Format ("taglib/{0}", mime.Substring (24));
}
// Parse file
var res = new GIOTagLibFileAbstraction () { Uri = uri };
var sidecar_uri = uri.ReplaceExtension (".xmp");
var sidecar_res = new GIOTagLibFileAbstraction () { Uri = sidecar_uri };
TagLib.Image.File file = null;
try {
file = TagLib.File.Create (res, mime, ReadStyle.Average) as TagLib.Image.File;
} catch (Exception e) {
Hyena.Log.Exception (String.Format ("Loading of Metadata failed for file: {0}", uri.ToString ()), e);
return null;
}
// Load XMP sidecar
var sidecar_file = GLib.FileFactory.NewForUri (sidecar_uri);
if (sidecar_file.Exists) {
file.ParseXmpSidecar (sidecar_res);
}
return file;
}
}
}
| using Hyena;
using TagLib;
using System;
using GLib;
namespace FSpot.Utils
{
public static class Metadata
{
public static TagLib.Image.File Parse (SafeUri uri)
{
// Detect mime-type
var gfile = FileFactory.NewForUri (uri);
var info = gfile.QueryInfo ("standard::content-type", FileQueryInfoFlags.None, null);
var mime = info.ContentType;
// Parse file
var res = new GIOTagLibFileAbstraction () { Uri = uri };
var sidecar_uri = uri.ReplaceExtension (".xmp");
var sidecar_res = new GIOTagLibFileAbstraction () { Uri = sidecar_uri };
TagLib.Image.File file = null;
try {
file = TagLib.File.Create (res, mime, ReadStyle.Average) as TagLib.Image.File;
} catch (Exception e) {
Hyena.Log.Exception (String.Format ("Loading of Metadata failed for file: {0}", uri.ToString ()), e);
return null;
}
// Load XMP sidecar
var sidecar_file = GLib.FileFactory.NewForUri (sidecar_uri);
if (sidecar_file.Exists) {
file.ParseXmpSidecar (sidecar_res);
}
return file;
}
}
}
| mit | C# |
470242cbb600a4975b8e8fe578229618fe81181c | update PackageResolver abstract class | tsolarin/dotnet-globals,tsolarin/dotnet-globals | src/DotNet.Executor.Core/PackageResolvers/PackageResolver.cs | src/DotNet.Executor.Core/PackageResolvers/PackageResolver.cs | namespace DotNet.Executor.Core.PackageResolvers
{
using System;
using System.IO;
abstract class PackageResolver
{
protected DirectoryInfo PackagesFolder { get; set; }
protected DirectoryInfo PackageFolder { get; set; }
protected string Source { get; set; }
abstract protected void Acquire();
protected PackageResolver(DirectoryInfo packagesFolder, string source)
{
this.PackagesFolder = packagesFolder;
this.Source = source;
}
public Package Resolve()
{
this.Acquire();
if (this.PackageFolder == null)
throw new Exception("PackageFolder property not set");
if (this.PackagesFolder.FullName != this.PackageFolder.Parent.FullName)
throw new Exception("Package folder not in specified packages folder");
return new Package() { Directory = this.PackageFolder, EntryAssemblyFileName = this.PackageFolder.Name + ".dll" };
}
}
} | namespace DotNet.Executor.Core.PackageResolvers
{
using System.IO;
abstract class PackageResolver
{
protected DirectoryInfo PackagesFolder { get; set; }
protected string Source { get; set; }
abstract protected Package Resolve();
protected PackageResolver(DirectoryInfo packagesFolder, string source)
{
this.PackagesFolder = packagesFolder;
this.Source = source;
}
}
} | mit | C# |
d0cabaddfa6d0188fd34e85a2bfc194cc6f0b336 | Remove unnecessary cast | mysticfall/Alensia | Assets/Alensia/Core/Camera/CameraManager.cs | Assets/Alensia/Core/Camera/CameraManager.cs | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Alensia.Core.Actor;
using Alensia.Core.Common;
using UnityEngine.Assertions;
namespace Alensia.Core.Camera
{
public class CameraManager : ICameraManager
{
private ICameraMode _mode;
public ICameraMode Mode
{
get { return _mode; }
private set
{
if (value == null || value == _mode) return;
if (_mode != null) _mode.Deactivate();
_mode = value;
if (_mode == null) return;
_mode.Activate();
CameraChanged.Fire(_mode);
}
}
public ReadOnlyCollection<ICameraMode> AvailableModes { get; private set; }
public CameraChangeEvent CameraChanged { get; private set; }
public CameraManager(List<ICameraMode> modes, CameraChangeEvent cameraChanged)
{
Assert.IsNotNull(modes, "modes != null");
Assert.IsTrue(modes.Count > 0, "modes.Count > 0");
Assert.IsNotNull(cameraChanged, "cameraChanged != null");
AvailableModes = modes.AsReadOnly();
CameraChanged = cameraChanged;
}
public T Switch<T>() where T : class, ICameraMode
{
return AvailableModes.FirstOrDefault(m => m is T) as T;
}
public IFirstPersonCamera ToFirstPerson(IActor target)
{
var camera = Switch<IFirstPersonCamera>();
if (camera == null) return null;
camera.Initialize(target);
Mode = camera;
return camera;
}
public IThirdPersonCamera ToThirdPerson(IActor target)
{
var camera = Switch<IThirdPersonCamera>();
if (camera == null) return null;
camera.Initialize(target);
Mode = camera;
return camera;
}
public void Follow(ITransformable target)
{
throw new NotImplementedException();
}
}
} | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Alensia.Core.Actor;
using Alensia.Core.Common;
using UnityEngine.Assertions;
namespace Alensia.Core.Camera
{
public class CameraManager : ICameraManager
{
private ICameraMode _mode;
public ICameraMode Mode
{
get { return _mode; }
private set
{
if (value == null || value == _mode) return;
if (_mode != null) _mode.Deactivate();
_mode = value;
if (_mode == null) return;
_mode.Activate();
CameraChanged.Fire(_mode);
}
}
public ReadOnlyCollection<ICameraMode> AvailableModes { get; private set; }
public CameraChangeEvent CameraChanged { get; private set; }
public CameraManager(List<ICameraMode> modes, CameraChangeEvent cameraChanged)
{
Assert.IsNotNull(modes, "modes != null");
Assert.IsTrue(modes.Count > 0, "modes.Count > 0");
Assert.IsNotNull(cameraChanged, "cameraChanged != null");
AvailableModes = modes.AsReadOnly();
CameraChanged = cameraChanged;
}
public T Switch<T>() where T : class, ICameraMode
{
return AvailableModes.FirstOrDefault(m => m is T) as T;
}
public IFirstPersonCamera ToFirstPerson(IActor target)
{
var camera = Switch<IFirstPersonCamera>();
if (camera == null) return null;
camera.Initialize((IHumanoid) target);
Mode = camera;
return camera;
}
public IThirdPersonCamera ToThirdPerson(IActor target)
{
var camera = Switch<IThirdPersonCamera>();
if (camera == null) return null;
camera.Initialize(target);
Mode = camera;
return camera;
}
public void Follow(ITransformable target)
{
throw new NotImplementedException();
}
}
} | apache-2.0 | C# |
60563be691fd08d15abc3ba41c7524c12e1af48c | Revert "Constant update" | MediaBrowser/ImageMagickSharp | ImageMagickSharp/Global/Constants.cs | ImageMagickSharp/Global/Constants.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ImageMagickSharp
{
internal class Constants
{
#region [Constants]
/// <summary> The wand calling convention. </summary>
internal const CallingConvention WandCallingConvention = CallingConvention.Cdecl;
/// <summary> The wand library. </summary>
//internal const string WandLibrary = @"ImageMagickLib\CORE_RL_Wand_.dll";
internal const string WandLibrary = @"C:\DevRepository\ImageMagickSharp\ImageMagickSharp.Tests\bin\Debug\CORE_RL_Wand_.dll";
/// <summary> The magick false. </summary>
internal const int MagickFalse = 0;
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ImageMagickSharp
{
internal class Constants
{
#region [Constants]
/// <summary> The wand calling convention. </summary>
internal const CallingConvention WandCallingConvention = CallingConvention.Cdecl;
/// <summary> The wand library. </summary>
internal const string WandLibrary = @"ImageMagickLib\CORE_RL_Wand_.dll";
/// <summary> The magick false. </summary>
internal const int MagickFalse = 0;
#endregion
}
}
| mit | C# |
9fbc32ecea224cd153ef0eff91bfc1cc759e4584 | Fix addatmos from griduid artifact | space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14 | Content.Server/Atmos/Commands/AddAtmosCommand.cs | Content.Server/Atmos/Commands/AddAtmosCommand.cs | using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Atmos.Commands
{
[AdminCommand(AdminFlags.Debug)]
public sealed class AddAtmosCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
public string Command => "addatmos";
public string Description => "Adds atmos support to a grid.";
public string Help => $"{Command} <GridId>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length < 1)
{
shell.WriteLine(Help);
return;
}
var entMan = IoCManager.Resolve<IEntityManager>();
if (!EntityUid.TryParse(args[0], out var euid))
{
shell.WriteError($"Failed to parse euid '{args[0]}'.");
return;
}
if (!entMan.HasComponent<IMapGridComponent>(euid))
{
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return;
}
if (_entities.HasComponent<IAtmosphereComponent>(euid))
{
shell.WriteLine("Grid already has an atmosphere.");
return;
}
_entities.AddComponent<GridAtmosphereComponent>(euid);
shell.WriteLine($"Added atmosphere to grid {euid}.");
}
}
}
| using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Atmos.Commands
{
[AdminCommand(AdminFlags.Debug)]
public sealed class AddAtmosCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
public string Command => "addatmos";
public string Description => "Adds atmos support to a grid.";
public string Help => $"{Command} <GridId>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length < 1)
{
shell.WriteLine(Help);
return;
}
var entMan = IoCManager.Resolve<IEntityManager>();
if(EntityUid.TryParse(args[0], out var euid))
{
shell.WriteError($"Failed to parse euid '{args[0]}'.");
return;
}
if (!entMan.HasComponent<IMapGridComponent>(euid))
{
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return;
}
if (_entities.HasComponent<IAtmosphereComponent>(euid))
{
shell.WriteLine("Grid already has an atmosphere.");
return;
}
_entities.AddComponent<GridAtmosphereComponent>(euid);
shell.WriteLine($"Added atmosphere to grid {euid}.");
}
}
}
| mit | C# |
3a2fa69992ce67204eb14e20a746e023217b6127 | Fix testGame waiting | EVAST9919/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework | osu.Framework.Tests/IO/BackgroundGameHeadlessGameHost.cs | osu.Framework.Tests/IO/BackgroundGameHeadlessGameHost.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using System.Threading.Tasks;
using osu.Framework.Platform;
namespace osu.Framework.Tests.IO
{
/// <summary>
/// Ad headless host for testing purposes. Contains an arbitrary game that is running after construction.
/// </summary>
public class BackgroundGameHeadlessGameHost : HeadlessGameHost
{
private TestGame testGame;
public BackgroundGameHeadlessGameHost(string gameName = @"", bool bindIPC = false, bool realtime = true, bool portableInstallation = false)
: base(gameName, bindIPC, realtime, portableInstallation)
{
var gameCreated = new ManualResetEventSlim(false);
Task.Run(() =>
{
try
{
testGame = new TestGame();
gameCreated.Set();
Run(testGame);
}
catch
{
// may throw an unobserved exception if we don't handle here.
}
});
using (gameCreated)
gameCreated.Wait();
using (testGame.HasProcessed)
testGame.HasProcessed.Wait();
}
private class TestGame : Game
{
public readonly ManualResetEventSlim HasProcessed = new ManualResetEventSlim(false);
protected override void Update()
{
base.Update();
HasProcessed.Set();
}
}
protected override void Dispose(bool isDisposing)
{
if (ExecutionState != ExecutionState.Stopped)
Exit();
base.Dispose(isDisposing);
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using System.Threading.Tasks;
using osu.Framework.Platform;
namespace osu.Framework.Tests.IO
{
/// <summary>
/// Ad headless host for testing purposes. Contains an arbitrary game that is running after construction.
/// </summary>
public class BackgroundGameHeadlessGameHost : HeadlessGameHost
{
private TestGame testGame;
public BackgroundGameHeadlessGameHost(string gameName = @"", bool bindIPC = false, bool realtime = true, bool portableInstallation = false)
: base(gameName, bindIPC, realtime, portableInstallation)
{
Task.Run(() =>
{
try
{
Run(testGame = new TestGame());
}
catch
{
// may throw an unobserved exception if we don't handle here.
}
});
using (testGame?.HasProcessed)
testGame?.HasProcessed.Wait();
}
private class TestGame : Game
{
public readonly ManualResetEventSlim HasProcessed = new ManualResetEventSlim(false);
protected override void Update()
{
base.Update();
HasProcessed.Set();
}
}
protected override void Dispose(bool isDisposing)
{
if (ExecutionState != ExecutionState.Stopped)
Exit();
base.Dispose(isDisposing);
}
}
}
| mit | C# |
32c6a1f0b6cbef8aff27160c5182235047af8e5b | Use HTTPS for jonathanpeppers.com (#379) | planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin | src/Firehose.Web/Authors/JonPeppers.cs | src/Firehose.Web/Authors/JonPeppers.cs | using System;
using System.Collections.Generic;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
namespace Firehose.Web
{
public class JonPeppers : IAmAXamarinMVP, IFilterMyBlogPosts
{
public string FirstName => "Jon";
public string LastName => "Peppers";
public string ShortBioOrTagLine => "Software Engineer on the Xamarin.Android team";
public string StateOrRegion => "Bowling Green, KY";
public string EmailAddress => "[email protected]";
public string TwitterHandle => "jonathanpeppers";
public string GravatarHash => "ad57dcc21d67832387ce8abb879c3bba";
public string GitHubHandle => "jonathanpeppers";
public GeoPosition Position => new GeoPosition(36.9726673,-86.5600474);
public Uri WebSite => new Uri("https://jonathanpeppers.com/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://jonathanpeppers.com/Home/Feed"); } }
public bool Filter(SyndicationItem item)
{
return item.Title.Text.ToLowerInvariant().Contains("xamarin");
}
}
} | using System;
using System.Collections.Generic;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
namespace Firehose.Web
{
public class JonPeppers : IAmAXamarinMVP, IFilterMyBlogPosts
{
public string FirstName => "Jon";
public string LastName => "Peppers";
public string ShortBioOrTagLine => "develops award-winning apps at Hitcents";
public string StateOrRegion => "Bowling Green, KY";
public string EmailAddress => "[email protected]";
public string TwitterHandle => "jonathanpeppers";
public string GravatarHash => "ad57dcc21d67832387ce8abb879c3bba";
public string GitHubHandle => "jonathanpeppers";
public GeoPosition Position => new GeoPosition(36.9726673,-86.5600474);
public Uri WebSite => new Uri("http://jonathanpeppers.com/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("http://jonathanpeppers.com/Home/Feed"); } }
public bool Filter(SyndicationItem item)
{
return item.Title.Text.ToLowerInvariant().Contains("xamarin");
}
}
} | mit | C# |
d9bf511808d18cff8a850d9b9c4db724385055e1 | Change ip debug (problem seems to be with totallength) | neowutran/TeraDamageMeter,radasuka/ShinraMeter,Seyuna/ShinraMeter,neowutran/ShinraMeter | NetworkSniffer/Packets/IpPacket.cs | NetworkSniffer/Packets/IpPacket.cs | // Copyright (c) CodesInChaos
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace NetworkSniffer.Packets
{
public enum IpProtocol : byte
{
Tcp = 6,
Udp = 17
}
public struct Ip4Packet
{
public readonly ArraySegment<byte> Packet;
public byte VersionAndHeaderLength => Packet.Array[Packet.Offset + 0];
public byte DscpAndEcn => Packet.Array[Packet.Offset + 1];
public ushort TotalLength => ParserHelpers.GetUInt16BigEndian(Packet.Array, Packet.Offset + 2);
public ushort Identification => ParserHelpers.GetUInt16BigEndian(Packet.Array, Packet.Offset + 4);
public byte Flags => (byte) (Packet.Array[Packet.Offset + 6] >> 13);
public ushort FragmentOffset
=> (ushort) (ParserHelpers.GetUInt16BigEndian(Packet.Array, Packet.Offset + 6) & 0x1FFF);
public byte TimeToLive => Packet.Array[Packet.Offset + 8];
public IpProtocol Protocol => (IpProtocol) Packet.Array[Packet.Offset + 9];
public ushort HeaderChecksum => ParserHelpers.GetUInt16BigEndian(Packet.Array, Packet.Offset + 10);
public uint SourceIp => ParserHelpers.GetUInt32BigEndian(Packet.Array, Packet.Offset + 12);
public uint DestinationIp => ParserHelpers.GetUInt32BigEndian(Packet.Array, Packet.Offset + 16);
public int HeaderLength => (VersionAndHeaderLength & 0x0F)*4;
public ArraySegment<byte> Payload
{
get
{
var headerLength = HeaderLength;
if ((Packet.Offset + TotalLength) >= Packet.Array.Length || TotalLength <= headerLength)
{ throw new Exception($"Wrong packet TotalLength:{TotalLength} headerLength:{headerLength} Packet.Array.Length:{Packet.Array.Length} SourceIp:{SourceIp} DestinationIp:{DestinationIp}"); }
return new ArraySegment<byte>(Packet.Array, Packet.Offset + headerLength, TotalLength - headerLength);
}
}
public Ip4Packet(ArraySegment<byte> packet)
{
Packet = packet;
}
}
} | // Copyright (c) CodesInChaos
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace NetworkSniffer.Packets
{
public enum IpProtocol : byte
{
Tcp = 6,
Udp = 17
}
public struct Ip4Packet
{
public readonly ArraySegment<byte> Packet;
public byte VersionAndHeaderLength => Packet.Array[Packet.Offset + 0];
public byte DscpAndEcn => Packet.Array[Packet.Offset + 1];
public ushort TotalLength => ParserHelpers.GetUInt16BigEndian(Packet.Array, Packet.Offset + 2);
public ushort Identification => ParserHelpers.GetUInt16BigEndian(Packet.Array, Packet.Offset + 4);
public byte Flags => (byte) (Packet.Array[Packet.Offset + 6] >> 13);
public ushort FragmentOffset
=> (ushort) (ParserHelpers.GetUInt16BigEndian(Packet.Array, Packet.Offset + 6) & 0x1FFF);
public byte TimeToLive => Packet.Array[Packet.Offset + 8];
public IpProtocol Protocol => (IpProtocol) Packet.Array[Packet.Offset + 9];
public ushort HeaderChecksum => ParserHelpers.GetUInt16BigEndian(Packet.Array, Packet.Offset + 10);
public uint SourceIp => ParserHelpers.GetUInt32BigEndian(Packet.Array, Packet.Offset + 12);
public uint DestinationIp => ParserHelpers.GetUInt32BigEndian(Packet.Array, Packet.Offset + 16);
public int HeaderLength => (VersionAndHeaderLength & 0x0F)*4;
public ArraySegment<byte> Payload
{
get
{
var headerLength = HeaderLength;
if ((Packet.Offset + headerLength) >= Packet.Array.Length || TotalLength <= headerLength)
{ throw new Exception($"Wrong packet TotalLength:{TotalLength} headerLength:{headerLength} Packet.Array.Length:{Packet.Array.Length} SourceIp:{SourceIp} DestinationIp:{DestinationIp}"); }
return new ArraySegment<byte>(Packet.Array, Packet.Offset + headerLength, TotalLength - headerLength);
}
}
public Ip4Packet(ArraySegment<byte> packet)
{
Packet = packet;
}
}
} | mit | C# |
df375dc410156093ef0f92af22f3ff323add07a1 | change equality to equator | yanggujun/commonsfornet,yanggujun/commonsfornet | src/Commons.Collections/Functor/Functors.cs | src/Commons.Collections/Functor/Functors.cs | // Copyright CommonsForNET. Author: Gujun Yang. email: [email protected]
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
namespace Commons.Collections
{
[CLSCompliant(true)]
public delegate bool Equator<in T>(T x, T y);
[CLSCompliant(true)]
public delegate void Closure<in T>(T x);
[CLSCompliant(true)]
public delegate O Transformer<in T, out O>(T x);
}
| // Copyright CommonsForNET. Author: Gujun Yang. email: [email protected]
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
namespace Commons.Collections
{
[CLSCompliant(true)]
public delegate bool Equality<in T>(T x, T y);
[CLSCompliant(true)]
public delegate void Closure<in T>(T x);
[CLSCompliant(true)]
public delegate O Transformer<in T, out O>(T x);
}
| apache-2.0 | C# |
5f6050593a4ae1c14d563c040b7b0199b1e50c06 | Add multiple response handling for diferente score levels | iperoyg/faqtemplatebot | FaqTemplate.Bot/PlainTextMessageReceiver.cs | FaqTemplate.Bot/PlainTextMessageReceiver.cs | using System;
using System.Threading;
using System.Threading.Tasks;
using Lime.Protocol;
using Takenet.MessagingHub.Client;
using Takenet.MessagingHub.Client.Listener;
using Takenet.MessagingHub.Client.Sender;
using System.Diagnostics;
using FaqTemplate.Core.Services;
using FaqTemplate.Core.Domain;
namespace FaqTemplate.Bot
{
public class PlainTextMessageReceiver : IMessageReceiver
{
private readonly IFaqService<string> _faqService;
private readonly IMessagingHubSender _sender;
private readonly Settings _settings;
public PlainTextMessageReceiver(IMessagingHubSender sender, IFaqService<string> faqService, Settings settings)
{
_sender = sender;
_faqService = faqService;
_settings = settings;
}
public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
{
Trace.TraceInformation($"From: {message.From} \tContent: {message.Content}");
var request = new FaqRequest { Ask = message.Content.ToString() };
var response = await _faqService.AskThenIAnswer(request);
if (response.Score >= 0.8)
{
await _sender.SendMessageAsync($"{response.Answer}", message.From, cancellationToken);
}
else if(response.Score >= 0.5)
{
await _sender.SendMessageAsync($"Eu acho que a resposta para o que voc precisa :", message.From, cancellationToken);
cancellationToken.WaitHandle.WaitOne(TimeSpan.FromSeconds(1));
await _sender.SendMessageAsync($"{response.Answer}", message.From, cancellationToken);
}
else
{
await _sender.SendMessageAsync($"Infelizmente eu ainda no sei isso! Mas vou me aprimorar, prometo!", message.From, cancellationToken);
}
await _sender.SendMessageAsync($"{response.Score}: {response.Answer}", message.From, cancellationToken);
}
}
}
| using System;
using System.Threading;
using System.Threading.Tasks;
using Lime.Protocol;
using Takenet.MessagingHub.Client;
using Takenet.MessagingHub.Client.Listener;
using Takenet.MessagingHub.Client.Sender;
using System.Diagnostics;
using FaqTemplate.Core.Services;
using FaqTemplate.Core.Domain;
namespace FaqTemplate.Bot
{
public class PlainTextMessageReceiver : IMessageReceiver
{
private readonly IFaqService<string> _faqService;
private readonly IMessagingHubSender _sender;
private readonly Settings _settings;
public PlainTextMessageReceiver(IMessagingHubSender sender, IFaqService<string> faqService, Settings settings)
{
_sender = sender;
_faqService = faqService;
_settings = settings;
}
public async Task ReceiveAsync(Message message, CancellationToken cancellationToken)
{
Trace.TraceInformation($"From: {message.From} \tContent: {message.Content}");
var request = new FaqRequest { Ask = message.Content.ToString() };
var result = await _faqService.AskThenIAnswer(request);
await _sender.SendMessageAsync($"{result.Score}: {result.Answer}", message.From, cancellationToken);
}
}
}
| mit | C# |
f2a02993391ff0ad3cd69d7e334f0f54920ea6ef | Test added | YossiCohen/MA-SIB,YossiCohen/MA-SIB | GridTest/UntouchedAroundTheGoalHeuristic.cs | GridTest/UntouchedAroundTheGoalHeuristic.cs |
using System;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Grid.Domain;
namespace GridTest
{
[TestClass]
public class UntouchedAroundTheGoalHeuristicTest
{
private static World _basicWorld;
private static World _basicWorld2;
private static World _basicWorld3;
[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
_basicWorld = new World(File.ReadAllText(@"..\..\Grid-10-6-5-4-0.grd"), new UntouchedAroundTheGoalHeuristic());
_basicWorld2 = new World(File.ReadAllText(@"..\..\Grid-10-6-5-4-1.grd"), new UntouchedAroundTheGoalHeuristic());
_basicWorld3 = new World(File.ReadAllText(@"..\..\Clean_Grid_5x5BasicBlocked.grd"), new UntouchedAroundTheGoalHeuristic());
}
[TestMethod]
public void gValue_getFvalueForChildNode_Equals24()
{
GridSearchNode initialState = _basicWorld.GetInitialSearchNode();
Assert.AreEqual(24, initialState.h);
}
[TestMethod]
public void gValue_getFvalueForChildNode_Equals24b()
{
GridSearchNode initialState = _basicWorld2.GetInitialSearchNode();
Assert.AreEqual(24, initialState.h);
}
[TestMethod]
public void gValue_getFvalueForChildNode_Equals20()
{
GridSearchNode initialState = _basicWorld3.GetInitialSearchNode();
Assert.AreEqual(20, initialState.h);
}
}
}
|
using System;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Grid.Domain;
namespace GridTest
{
[TestClass]
public class UntouchedAroundTheGoalHeuristicTest
{
private static World _basicWorld;
private static World _basicWorld2;
[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
_basicWorld = new World(File.ReadAllText(@"..\..\Grid-10-6-5-4-0.grd"), new UntouchedAroundTheGoalHeuristic());
_basicWorld2 = new World(File.ReadAllText(@"..\..\Grid-10-6-5-4-1.grd"), new UntouchedAroundTheGoalHeuristic());
}
[TestMethod]
public void gValue_getFvalueForChildNode_Equals24()
{
GridSearchNode initialState = _basicWorld.GetInitialSearchNode();
Assert.AreEqual(24, initialState.h);
}
[TestMethod]
public void gValue_getFvalueForChildNode_Equals1()
{
GridSearchNode initialState = _basicWorld2.GetInitialSearchNode();
Assert.AreEqual(24, initialState.h);
}
}
}
| mit | C# |
2c549a70d90b9a8d598ebd033670f2d5de522305 | Fix warning. | JohanLarsson/Gu.Wpf.ToolTips | Gu.Wpf.ToolTips.UiTests/Images/TestImage.cs | Gu.Wpf.ToolTips.UiTests/Images/TestImage.cs | namespace Gu.Wpf.ToolTips.UiTests
{
using System.Drawing;
using System.IO;
using Gu.Wpf.UiAutomation;
using NUnit.Framework;
public static class TestImage
{
internal static readonly string Current = GetCurrent();
[Script]
public static void Rename()
{
var folder = @"C:\Git\_GuOrg\Gu.Wpf.ToolTips\Gu.Wpf.ToolTips.UiTests";
var oldName = "Red_border_default_visibility_width_100.png";
var newName = "Red_border_default_visibility_width_100.png";
foreach (var file in Directory.EnumerateFiles(folder, oldName, SearchOption.AllDirectories))
{
File.Move(file, file.Replace(oldName, newName));
}
foreach (var file in Directory.EnumerateFiles(folder, "*.cs", SearchOption.AllDirectories))
{
File.WriteAllText(file, File.ReadAllText(file).Replace(oldName, newName));
}
}
internal static void OnFail(Bitmap? expected, Bitmap actual, string resource)
{
var fullFileName = Path.Combine(Path.GetTempPath(), resource);
//// ReSharper disable once AssignNullToNotNullAttribute
_ = Directory.CreateDirectory(Path.GetDirectoryName(fullFileName));
if (File.Exists(fullFileName))
{
File.Delete(fullFileName);
}
actual.Save(fullFileName);
TestContext.AddTestAttachment(fullFileName);
}
private static string GetCurrent()
{
if (WindowsVersion.IsWindows7())
{
return "Win7";
}
if (WindowsVersion.IsWindows10())
{
return "Win10";
}
if (WindowsVersion.CurrentContains("Windows Server 2019"))
{
return "WinServer2019";
}
return WindowsVersion.CurrentVersionProductName;
}
}
}
| namespace Gu.Wpf.ToolTips.UiTests
{
using System.Drawing;
using System.IO;
using Gu.Wpf.UiAutomation;
using NUnit.Framework;
public static class TestImage
{
internal static readonly string Current = GetCurrent();
[Script]
public static void Rename()
{
var folder = @"C:\Git\_GuOrg\Gu.Wpf.ToolTips\Gu.Wpf.ToolTips.UiTests";
var oldName = "Red_border_default_visibility_width_100.png";
var newName = "Red_border_default_visibility_width_100.png";
foreach (var file in Directory.EnumerateFiles(folder, oldName, SearchOption.AllDirectories))
{
File.Move(file, file.Replace(oldName, newName));
}
foreach (var file in Directory.EnumerateFiles(folder, "*.cs", SearchOption.AllDirectories))
{
File.WriteAllText(file, File.ReadAllText(file).Replace(oldName, newName));
}
}
internal static void OnFail(Bitmap? expected, Bitmap actual, string resource)
{
var fullFileName = Path.Combine(Path.GetTempPath(), resource);
// ReSharper disable once AssignNullToNotNullAttribute
_ = Directory.CreateDirectory(Path.GetDirectoryName(fullFileName));
if (File.Exists(fullFileName))
{
File.Delete(fullFileName);
}
actual.Save(fullFileName);
TestContext.AddTestAttachment(fullFileName);
}
private static string GetCurrent()
{
if (WindowsVersion.IsWindows7())
{
return "Win7";
}
if (WindowsVersion.IsWindows10())
{
return "Win10";
}
if (WindowsVersion.CurrentContains("Windows Server 2019"))
{
return "WinServer2019";
}
return WindowsVersion.CurrentVersionProductName;
}
}
}
| mit | C# |
94f01f571b631b806b0a381a01fef8ee497c373e | Bump version to 1.0.0-alpha1 | HangfireIO/Hangfire.Autofac,mattyway/Hangfire.Autofac | HangFire.Autofac/Properties/AssemblyInfo.cs | HangFire.Autofac/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("HangFire.Autofac")]
[assembly: AssemblyDescription("Autofac IoC Container support for HangFire (background job system for ASP.NET applications).")]
[assembly: AssemblyProduct("HangFire")]
[assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")]
// 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("c38d8acf-7b2c-4d7f-84ad-c477879ade3f")]
[assembly: AssemblyInformationalVersion("1.0.0-alpha1")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HangFire.Autofac")]
[assembly: AssemblyDescription("Autofac IoC Container support for HangFire (background job system for ASP.NET applications).")]
[assembly: AssemblyProduct("HangFire")]
[assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")]
// 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("c38d8acf-7b2c-4d7f-84ad-c477879ade3f")]
[assembly: AssemblyVersion("0.1.2.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
ade46a0e4a2ea607fcbeafb8560723b7696f07d6 | Make that 1.2.1... | kamsar/MicroCHAP | src/MicroCHAP.Tests/ChapServerTests.cs | src/MicroCHAP.Tests/ChapServerTests.cs | using System.Collections.Generic;
using System.Threading;
using FluentAssertions;
using MicroCHAP.Server;
using NSubstitute;
using Xunit;
namespace MicroCHAP.Tests
{
public class ChapServerTests
{
[Fact]
public void GetChallengeToken_ShouldReturnUniqueChallenges()
{
var service = CreateTestServer();
var challenge1 = service.GetChallengeToken();
challenge1.Should().NotBe(service.GetChallengeToken());
}
[Fact]
public void GetChallengeToken_ShouldBeAlphanumeric()
{
var service = CreateTestServer();
var challenge = service.GetChallengeToken();
challenge.Should().MatchRegex("^[A-Za-z0-9]+$");
}
[Fact]
public void ValidateToken_ShouldReturnFalseIfChallengeDoesNotExist()
{
var service = CreateTestServer();
service.ValidateToken("FAKE", "FAKE", "FAKE").Should().BeFalse();
}
[Fact]
public void ValidateToken_ShouldReturnFalseIfChallengeIsTooOld()
{
var service = CreateTestServer();
((ChapServer) service).TokenValidityInMs = 300;
var token = service.GetChallengeToken();
Thread.Sleep(350);
service.ValidateToken(token, "RESPONSE", "FAKE").Should().BeFalse();
}
[Fact]
public void ValidateToken_ShouldReturnTrue_IfTokenIsValid()
{
var service = CreateTestServer();
var token = service.GetChallengeToken();
service.ValidateToken(token, "RESPONSE", "FAKE").Should().BeTrue();
}
[Fact]
public void ValidateToken_ShouldNotAllowReusingTokens()
{
var service = CreateTestServer();
var token = service.GetChallengeToken();
service.ValidateToken(token, "RESPONSE", "FAKE").Should().BeTrue();
service.ValidateToken(token, "RESPONSE", "FAKE").Should().BeFalse();
}
private IChapServer CreateTestServer()
{
var responseService = Substitute.For<ISignatureService>();
responseService.CreateSignature(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<SignatureFactor>>()).Returns("RESPONSE");
return new ChapServer(responseService, new InMemoryChallengeStore());
}
}
}
| using System.Collections.Generic;
using System.Threading;
using FluentAssertions;
using MicroCHAP.Server;
using NSubstitute;
using Xunit;
namespace MicroCHAP.Tests
{
public class ChapServerTests
{
[Fact]
public void GetChallengeToken_ShouldReturnUniqueChallenges()
{
var service = CreateTestServer();
var challenge1 = service.GetChallengeToken();
challenge1.Should().NotBe(service.GetChallengeToken());
}
[Fact]
public void GetChallengeToken_ShouldBeAlphanumeric()
{
var service = CreateTestServer();
var challenge = service.GetChallengeToken();
challenge.Should().MatchRegex("^[A-Za-z0-9]+$");
}
[Fact]
public void ValidateToken_ShouldReturnFalseIfChallengeDoesNotExist()
{
var service = CreateTestServer();
service.ValidateToken("FAKE", "FAKE", "FAKE").Should().BeFalse();
}
[Fact]
public void ValidateToken_ShouldReturnFalseIfChallengeIsTooOld()
{
var service = CreateTestServer();
((ChapServer) service).TokenValidityInMs = 3000;
var token = service.GetChallengeToken();
Thread.Sleep(350);
service.ValidateToken(token, "RESPONSE", "FAKE").Should().BeFalse();
}
[Fact]
public void ValidateToken_ShouldReturnTrue_IfTokenIsValid()
{
var service = CreateTestServer();
var token = service.GetChallengeToken();
service.ValidateToken(token, "RESPONSE", "FAKE").Should().BeTrue();
}
[Fact]
public void ValidateToken_ShouldNotAllowReusingTokens()
{
var service = CreateTestServer();
var token = service.GetChallengeToken();
service.ValidateToken(token, "RESPONSE", "FAKE").Should().BeTrue();
service.ValidateToken(token, "RESPONSE", "FAKE").Should().BeFalse();
}
private IChapServer CreateTestServer()
{
var responseService = Substitute.For<ISignatureService>();
responseService.CreateSignature(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<SignatureFactor>>()).Returns("RESPONSE");
return new ChapServer(responseService, new InMemoryChallengeStore()) { TokenValidityInMs = 300 };
}
}
}
| mit | C# |
b9183da92a492ac2924f7b689bf14e0446d815a5 | Add CreatedDate to IRCMessage | Fredi/NetIRC | src/NetIRC/Messages/IRCMessage.cs | src/NetIRC/Messages/IRCMessage.cs | using System;
using System.Linq;
using System.Text;
namespace NetIRC.Messages
{
public abstract class IRCMessage
{
/// <summary>
/// When this IRC message was created
/// </summary>
public DateTime CreatedDate { get; } = DateTime.Now;
public override string ToString()
{
var clientMessage = this as IClientMessage;
if (clientMessage is null)
{
return base.ToString();
}
var tokens = clientMessage.Tokens.ToArray();
if (tokens.Length == 0)
{
return string.Empty;
}
var lastIndex = tokens.Length - 1;
var sb = new StringBuilder();
for (int i = 0; i < tokens.Length; i++)
{
if (i == lastIndex && tokens[i].Contains(" "))
{
sb.Append(':');
}
sb.Append(tokens[i]);
if (i < lastIndex)
{
sb.Append(' ');
}
}
return sb.ToString().Trim();
}
}
}
| using System.Linq;
using System.Text;
namespace NetIRC.Messages
{
public abstract class IRCMessage
{
public override string ToString()
{
var clientMessage = this as IClientMessage;
if (clientMessage is null)
{
return base.ToString();
}
var tokens = clientMessage.Tokens.ToArray();
if (tokens.Length == 0)
{
return string.Empty;
}
var lastIndex = tokens.Length - 1;
var sb = new StringBuilder();
for (int i = 0; i < tokens.Length; i++)
{
if (i == lastIndex && tokens[i].Contains(" "))
{
sb.Append(':');
}
sb.Append(tokens[i]);
if (i < lastIndex)
{
sb.Append(' ');
}
}
return sb.ToString().Trim();
}
}
}
| mit | C# |
46d06f9d28bbd9b9af9e92c415210f5e3a59521d | Bump version | kamil-mrzyglod/Oxygenize | Oxygenize/Properties/AssemblyInfo.cs | Oxygenize/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("Oxygenize")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Oxygenize")]
[assembly: AssemblyCopyright("Copyright © Microsoft 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("78a5cd71-2e0f-47a3-b553-d7109704dfe5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: InternalsVisibleTo("Oxygenize.Test")] | 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("Oxygenize")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Oxygenize")]
[assembly: AssemblyCopyright("Copyright © Microsoft 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("78a5cd71-2e0f-47a3-b553-d7109704dfe5")]
// 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.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: InternalsVisibleTo("Oxygenize.Test")] | mit | C# |
2825ac43a96df7526669d13ee553e0cf4bbc252e | Rename parameter for consistency | khellang/Scrutor | src/Scrutor/DecorationStrategy.cs | src/Scrutor/DecorationStrategy.cs | using System;
using Microsoft.Extensions.DependencyInjection;
namespace Scrutor;
public abstract class DecorationStrategy
{
protected DecorationStrategy(Type serviceType)
{
ServiceType = serviceType;
}
public Type ServiceType { get; }
public abstract bool CanDecorate(Type serviceType);
public abstract Func<IServiceProvider, object> CreateDecorator(Type serviceType);
internal static DecorationStrategy WithType(Type serviceType, Type decoratorType) =>
Create(serviceType, decoratorType, decoratorFactory: null);
internal static DecorationStrategy WithFactory(Type serviceType, Func<object, IServiceProvider, object> decoratorFactory) =>
Create(serviceType, decoratorType: null, decoratorFactory);
protected static Func<IServiceProvider, object> TypeDecorator(Type serviceType, Type decoratorType) => serviceProvider =>
{
var instanceToDecorate = serviceProvider.GetRequiredService(serviceType);
return ActivatorUtilities.CreateInstance(serviceProvider, decoratorType, instanceToDecorate);
};
protected static Func<IServiceProvider, object> FactoryDecorator(Type decorated, Func<object, IServiceProvider, object> decoratorFactory) => serviceProvider =>
{
var instanceToDecorate = serviceProvider.GetRequiredService(decorated);
return decoratorFactory(instanceToDecorate, serviceProvider);
};
private static DecorationStrategy Create(Type serviceType, Type? decoratorType, Func<object, IServiceProvider, object>? decoratorFactory)
{
if (serviceType.IsOpenGeneric())
{
return new OpenGenericDecorationStrategy(serviceType, decoratorType, decoratorFactory);
}
return new ClosedTypeDecorationStrategy(serviceType, decoratorType, decoratorFactory);
}
}
| using System;
using Microsoft.Extensions.DependencyInjection;
namespace Scrutor;
public abstract class DecorationStrategy
{
protected DecorationStrategy(Type serviceType)
{
ServiceType = serviceType;
}
public Type ServiceType { get; }
public abstract bool CanDecorate(Type serviceType);
public abstract Func<IServiceProvider, object> CreateDecorator(Type serviceType);
internal static DecorationStrategy WithType(Type serviceType, Type decoratorType) =>
Create(serviceType, decoratorType, decoratorFactory: null);
internal static DecorationStrategy WithFactory(Type serviceType, Func<object, IServiceProvider, object> decoratorFactory) =>
Create(serviceType, decoratorType: null, decoratorFactory);
protected static Func<IServiceProvider, object> TypeDecorator(Type serviceType, Type decoratorType) => serviceProvider =>
{
var instanceToDecorate = serviceProvider.GetRequiredService(serviceType);
return ActivatorUtilities.CreateInstance(serviceProvider, decoratorType, instanceToDecorate);
};
protected static Func<IServiceProvider, object> FactoryDecorator(Type decorated, Func<object, IServiceProvider, object> creationFactory) => serviceProvider =>
{
var instanceToDecorate = serviceProvider.GetRequiredService(decorated);
return creationFactory(instanceToDecorate, serviceProvider);
};
private static DecorationStrategy Create(Type serviceType, Type? decoratorType, Func<object, IServiceProvider, object>? decoratorFactory)
{
if (serviceType.IsOpenGeneric())
{
return new OpenGenericDecorationStrategy(serviceType, decoratorType, decoratorFactory);
}
return new ClosedTypeDecorationStrategy(serviceType, decoratorType, decoratorFactory);
}
}
| mit | C# |
5025df896ce56d32cb3d96730191ea5128e7ccf1 | Fix a bug. | Grabacr07/VirtualDesktop | source/VirtualDesktop/Interop/ComInterfaceWrapperBase.cs | source/VirtualDesktop/Interop/ComInterfaceWrapperBase.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace WindowsDesktop.Interop
{
public abstract class ComInterfaceWrapperBase
{
private readonly Dictionary<string, MethodInfo> _methods = new Dictionary<string, MethodInfo>();
private protected ComInterfaceAssembly ComInterfaceAssembly { get; }
public Type ComInterfaceType { get; }
public object ComObject { get; }
private protected ComInterfaceWrapperBase(ComInterfaceAssembly assembly, string comInterfaceName = null, Guid? service = null)
{
var (type, instance) = assembly.CreateInstance(comInterfaceName ?? this.GetType().GetComInterfaceNameIfWrapper(), service);
this.ComInterfaceAssembly = assembly;
this.ComInterfaceType = type;
this.ComObject = instance;
}
private protected ComInterfaceWrapperBase(ComInterfaceAssembly assembly, object comObject, string comInterfaceName = null)
{
this.ComInterfaceAssembly = assembly;
this.ComInterfaceType = assembly.GetType(comInterfaceName ?? this.GetType().GetComInterfaceNameIfWrapper());
this.ComObject = comObject;
}
protected static object[] Args(params object[] args)
=> args;
protected void Invoke(object[] parameters = null, [CallerMemberName] string methodName = "")
=> this.Invoke<object>(parameters, methodName);
protected T Invoke<T>(object[] parameters = null, [CallerMemberName] string methodName = "")
{
if (!this._methods.TryGetValue(methodName, out var methodInfo))
{
this._methods[methodName] = methodInfo = this.ComInterfaceType.GetMethod(methodName);
if (methodInfo == null)
{
throw new NotSupportedException($"{methodName} is not supported.");
}
}
try
{
return (T)methodInfo.Invoke(this.ComObject, parameters);
}
catch (TargetInvocationException ex) when (ex.InnerException != null)
{
throw ex.InnerException;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace WindowsDesktop.Interop
{
public abstract class ComInterfaceWrapperBase
{
private readonly Dictionary<string, MethodInfo> _methods = new Dictionary<string, MethodInfo>();
private protected ComInterfaceAssembly ComInterfaceAssembly { get; }
public Type ComInterfaceType { get; }
public object ComObject { get; }
private protected ComInterfaceWrapperBase(ComInterfaceAssembly assembly, string comInterfaceName = null, Guid? service = null)
{
var (type, instance) = assembly.CreateInstance(comInterfaceName ?? this.GetType().GetComInterfaceNameIfWrapper(), service);
this.ComInterfaceAssembly = assembly;
this.ComInterfaceType = type;
this.ComObject = instance;
}
private protected ComInterfaceWrapperBase(ComInterfaceAssembly assembly, object comObject, string comInterfaceName = null)
{
this.ComInterfaceAssembly = assembly;
this.ComInterfaceType = assembly.GetType(comInterfaceName ?? this.GetType().GetComInterfaceNameIfWrapper());
this.ComObject = comObject;
}
protected static object[] Args(params object[] args)
=> args;
protected void Invoke(object[] parameters = null, [CallerMemberName] string methodName = "")
=> this.Invoke<object>(parameters, methodName);
protected T Invoke<T>(object[] parameters = null, [CallerMemberName] string methodName = "")
{
if (!this._methods.TryGetValue(methodName, out var methodInfo))
{
this._methods[methodName] = methodInfo = this.ComInterfaceType.GetMethod(methodName);
if (methodInfo == null)
{
throw new NotSupportedException($"{methodName} is not supported.");
}
}
return (T)methodInfo.Invoke(this.ComObject, parameters);
}
}
}
| mit | C# |
416c594fa3a7858e2a69ba1fcc66556a04837d8c | set next alpha version | xxMUROxx/MahApps.Metro,chuuddo/MahApps.Metro,Jack109/MahApps.Metro,MahApps/MahApps.Metro,Danghor/MahApps.Metro,p76984275/MahApps.Metro,psinl/MahApps.Metro,pfattisc/MahApps.Metro,batzen/MahApps.Metro,Evangelink/MahApps.Metro,jumulr/MahApps.Metro,ye4241/MahApps.Metro | MahApps.Metro/Properties/AssemblyInfo.cs | MahApps.Metro/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyCopyright("Copyright © MahApps.Metro 2011-2015")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Behaviours")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Converters")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Controls")]
[assembly: AssemblyVersion("1.1.3.0")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyTitleAttribute("MahApps.Metro")]
[assembly: AssemblyDescriptionAttribute("Toolkit for creating Metro styled WPF apps")]
[assembly: AssemblyProductAttribute("MahApps.Metro 1.1.3-ALPHA")]
[assembly: InternalsVisibleTo("Mahapps.Metro.Tests")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyCopyright("Copyright © MahApps.Metro 2011-2015")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Behaviours")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Converters")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Controls")]
[assembly: AssemblyVersion("1.1.2.0")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyTitleAttribute("MahApps.Metro")]
[assembly: AssemblyDescriptionAttribute("Toolkit for creating Metro styled WPF apps")]
[assembly: AssemblyProductAttribute("MahApps.Metro 1.1.2")]
| mit | C# |
00bd4f4ba230bd1c4a561e9a9c40e6665b0c49ad | Fix exceptions | twilio/twilio-csharp | Twilio/Exceptions/RestException.cs | Twilio/Exceptions/RestException.cs | using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Twilio.Exceptions
{
[JsonObject(MemberSerialization.OptIn)]
public class RestException : TwilioException
{
[JsonProperty("code")]
public int Code { get; private set; }
[JsonProperty("status")]
public int Status { get; private set; }
[JsonProperty("message")]
public string Body { get; private set; }
[JsonProperty("more_info")]
public string MoreInfo { get; private set; }
public RestException() {}
private RestException(
[JsonProperty("status")]
int status,
[JsonProperty("message")]
string message,
[JsonProperty("code")]
int code,
[JsonProperty("more_info")]
string moreInfo
) {
Status = status;
Code = code;
Body = message;
MoreInfo = moreInfo;
}
public static RestException FromJson(string json) {
return JsonConvert.DeserializeObject<RestException>(json);
}
}
}
| using System;
using Newtonsoft.Json;
namespace Twilio.Exceptions
{
public class RestException : TwilioException
{
[JsonProperty("code")]
public int Code { get; }
[JsonProperty("status")]
public int Status { get; }
[JsonProperty("message")]
public override string Message { get; }
[JsonProperty("moreInfo")]
public string MoreInfo { get; }
public RestException() {}
public RestException(string message) : base(message) {}
public RestException(string message, Exception exception) : base(message, exception) {}
public RestException(int status, string message, int code, string moreInfo) : base(message) {
Status = status;
Message = message;
Code = code;
MoreInfo = moreInfo;
}
public static RestException FromJson(string json) {
return JsonConvert.DeserializeObject<RestException>(json);
}
}
}
| mit | C# |
0b5f3c00bf2fdac0c6e833155a917dc56251a38e | Revert "Fix WaveOverlayContainer always being present" | ppy/osu,DrabWeb/osu,NeoAdonis/osu,naoey/osu,EVAST9919/osu,johnneijzen/osu,2yangk23/osu,peppy/osu,naoey/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,smoogipoo/osu,ZLima12/osu,2yangk23/osu,EVAST9919/osu,UselessToucan/osu,DrabWeb/osu,UselessToucan/osu,smoogipooo/osu,smoogipoo/osu,ppy/osu,peppy/osu,johnneijzen/osu,smoogipoo/osu,ZLima12/osu,naoey/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,DrabWeb/osu | osu.Game/Overlays/WaveOverlayContainer.cs | osu.Game/Overlays/WaveOverlayContainer.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays
{
public abstract class WaveOverlayContainer : OsuFocusedOverlayContainer
{
protected readonly WaveContainer Waves;
protected override bool BlockNonPositionalInput => true;
protected override Container<Drawable> Content => Waves;
protected WaveOverlayContainer()
{
AddInternal(Waves = new WaveContainer
{
RelativeSizeAxes = Axes.Both,
});
}
protected override void PopIn()
{
base.PopIn();
Waves.Show();
}
protected override void PopOut()
{
base.PopOut();
Waves.Hide();
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays
{
public abstract class WaveOverlayContainer : OsuFocusedOverlayContainer
{
protected readonly WaveContainer Waves;
protected override bool BlockNonPositionalInput => true;
protected override Container<Drawable> Content => Waves;
protected WaveOverlayContainer()
{
AddInternal(Waves = new WaveContainer
{
RelativeSizeAxes = Axes.Both,
});
}
protected override void PopIn()
{
base.PopIn();
Waves.Show();
this.FadeIn();
}
protected override void PopOut()
{
base.PopOut();
Waves.Hide();
// this is required or we will remain present even though our waves are hidden.
this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut();
}
}
}
| mit | C# |
9539ce95e8a72a6ca9ef0cde6861db7f3cb709d8 | fix problem with not virtual method in entity | Eskat0n/Wotstat,Eskat0n/Wotstat,Eskat0n/Wotstat | sources/Domain.Model/Entities/DynamicData.cs | sources/Domain.Model/Entities/DynamicData.cs | namespace Domain.Model.Entities
{
using ByndyuSoft.Infrastructure.Domain;
using JetBrains.Annotations;
public class DynamicData : IEntity
{
[UsedImplicitly]
public DynamicData()
{
}
public DynamicData(int playerId, Period period)
{
Period = period;
PlayerId = playerId;
}
public virtual int Id { get; set; }
public virtual Period Period { get; protected set; }
public virtual int PlayerId { get; protected set; }
public virtual double HitsPercents { get; protected set; }
public virtual double BattleAvgXp { get; protected set; }
public virtual double WinsPercents { get; protected set; }
public virtual int Battles { get; protected set; }
public virtual int DamageDealt { get; protected set; }
public virtual int Frags { get; protected set; }
public virtual int MaxXp { get; protected set; }
public virtual void Update(StatisticalData newData, StatisticalData olData)
{
BattleAvgXp = newData.BattleAvgXp - olData.BattleAvgXp;
Battles = newData.Battles - olData.Battles;
DamageDealt = newData.DamageDealt - olData.DamageDealt;
Frags = newData.Frags - olData.Frags;
HitsPercents = newData.HitsPercents - olData.HitsPercents;
WinsPercents = newData.WinsPercents - olData.WinsPercents;
MaxXp = newData.MaxXp - olData.MaxXp;
}
}
}
| namespace Domain.Model.Entities
{
using ByndyuSoft.Infrastructure.Domain;
using JetBrains.Annotations;
public class DynamicData : IEntity
{
[UsedImplicitly]
public DynamicData()
{
}
public DynamicData(int playerId, Period period)
{
Period = period;
PlayerId = playerId;
}
public virtual int Id { get; set; }
public virtual Period Period { get; protected set; }
public virtual int PlayerId { get; protected set; }
public virtual double HitsPercents { get; protected set; }
public virtual double BattleAvgXp { get; protected set; }
public virtual double WinsPercents { get; protected set; }
public virtual int Battles { get; protected set; }
public virtual int DamageDealt { get; protected set; }
public virtual int Frags { get; protected set; }
public virtual int MaxXp { get; protected set; }
public void Update(StatisticalData newData, StatisticalData olData)
{
BattleAvgXp = newData.BattleAvgXp - olData.BattleAvgXp;
Battles = newData.Battles - olData.Battles;
DamageDealt = newData.DamageDealt - olData.DamageDealt;
Frags = newData.Frags - olData.Frags;
HitsPercents = newData.HitsPercents - olData.HitsPercents;
WinsPercents = newData.WinsPercents - olData.WinsPercents;
MaxXp = newData.MaxXp - olData.MaxXp;
}
}
}
| mit | C# |
287bc752b52f316da3433a0dfc13b29babae1fb6 | clean up the event store after the test has completed | D3-LucaPiombino/NEventStore,gael-ltd/NEventStore,adamfur/NEventStore,AGiorgetti/NEventStore,NEventStore/NEventStore,chris-evans/NEventStore,nerdamigo/NEventStore,jamiegaines/NEventStore,marcoaoteixeira/NEventStore,paritoshmmmec/NEventStore,deltatre-webplu/NEventStore | src/NEventStore.Tests/DefaultSerializationWireupTests.cs | src/NEventStore.Tests/DefaultSerializationWireupTests.cs | namespace NEventStore
{
using NEventStore.Persistence.AcceptanceTests;
using NEventStore.Persistence.AcceptanceTests.BDD;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using Xunit.Should;
public class DefaultSerializationWireupTests
{
public class when_building_an_event_store_without_an_explicit_serializer : SpecificationBase
{
private Wireup wireup;
private Exception exception;
private IStoreEvents eventStore;
protected override void Context()
{
wireup = Wireup.Init()
.UsingSqlPersistence("fakeConnectionString")
.WithDialect(new Persistence.Sql.SqlDialects.MsSqlDialect());
}
protected override void Because()
{
exception = Catch.Exception(() => { eventStore = wireup.Build(); });
}
protected override void Cleanup()
{
eventStore.Dispose();
}
[Fact]
public void should_not_throw_an_argument_null_exception()
{
exception.ShouldNotBeInstanceOf<ArgumentNullException>();
}
}
}
}
| namespace NEventStore
{
using NEventStore.Persistence.AcceptanceTests;
using NEventStore.Persistence.AcceptanceTests.BDD;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using Xunit.Should;
public class DefaultSerializationWireupTests
{
public class when_building_an_event_store_without_an_explicit_serializer : SpecificationBase
{
private Wireup wireup;
private Exception exception;
protected override void Context()
{
wireup = Wireup.Init()
.UsingSqlPersistence("fakeConnectionString")
.WithDialect(new Persistence.Sql.SqlDialects.MsSqlDialect());
}
protected override void Because()
{
exception = Catch.Exception(() => { wireup.Build(); });
}
[Fact]
public void should_not_throw_an_argument_null_exception()
{
exception.ShouldNotBeInstanceOf<ArgumentNullException>();
}
}
}
}
| mit | C# |
578efc16c53605b3338eee05bbc17b74777ac82e | fix random piece generator | vivibau/CanastaCSharpOld,vivibau/CanastaCSharpOld,vivibau/CanastaCSharpOld | Client/Canasta/PieceGenerator.cs | Client/Canasta/PieceGenerator.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Canasta
{
class PieceGenerator
{
List<int> m_pieces;
public PieceGenerator()
{
m_pieces = new List<int>();
List<int> x = new List<int>();
for (int i = 0; i < 107; i++)
x.Add(i + 8);
Random rnd = new Random();
for (int i = 0; i < 107; i++)
{
int r = rnd.Next(x.Count() - 1);
m_pieces.Add(x[r]);
x.Remove(x[r]);
}
// for some reason the last piece is 106 + 8 = 113
// but the rest are random
// so make the series one element bigger and remove the last element (now 114)
m_pieces.Remove(m_pieces[m_pieces.Count() - 1]);
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"log.txt"))
{
for (int i = 0; i < m_pieces.Count(); i++)
{
file.WriteLine(m_pieces[i] + " ");
}
}
}
public int getNext()
{
int result = m_pieces[m_pieces.Count() - 1];
m_pieces.Remove(result);
return result;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Canasta
{
class PieceGenerator
{
List<int> m_pieces;
public PieceGenerator()
{
m_pieces = new List<int>();
List<int> x = new List<int>();
for (int i = 0; i < 106; i++)
x.Add(i + 8);
Random rnd = new Random();
for (int i = 0; i < 106; i++)
{
int r = rnd.Next(x.Count() - 1);
m_pieces.Add(x[r]);
x.Remove(x[r]);
}
}
public int getNext()
{
int result = m_pieces[m_pieces.Count() - 1];
m_pieces.Remove(result);
return result;
}
}
}
| mit | C# |
f6a8d31f425bb974de250ee841874ec78170727e | Remove CompactOnMemoryPressure (dotnet/extensions#1056) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Caching/Memory/src/MemoryCacheOptions.cs | src/Caching/Memory/src/MemoryCacheOptions.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.Extensions.Caching.Memory
{
public class MemoryCacheOptions : IOptions<MemoryCacheOptions>
{
private long? _sizeLimit;
private double _compactionPercentage = 0.05;
public ISystemClock Clock { get; set; }
/// <summary>
/// Gets or sets the minimum length of time between successive scans for expired items.
/// </summary>
public TimeSpan ExpirationScanFrequency { get; set; } = TimeSpan.FromMinutes(1);
/// <summary>
/// Gets or sets the maximum size of the cache.
/// </summary>
public long? SizeLimit
{
get => _sizeLimit;
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException(nameof(value), value, $"{nameof(value)} must be non-negative.");
}
_sizeLimit = value;
}
}
/// <summary>
/// Gets or sets the amount to compact the cache by when the maximum size is exceeded.
/// </summary>
public double CompactionPercentage
{
get => _compactionPercentage;
set
{
if (value < 0 || value > 1)
{
throw new ArgumentOutOfRangeException(nameof(value), value, $"{nameof(value)} must be between 0 and 1 inclusive.");
}
_compactionPercentage = value;
}
}
MemoryCacheOptions IOptions<MemoryCacheOptions>.Value
{
get { return this; }
}
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.Extensions.Caching.Memory
{
public class MemoryCacheOptions : IOptions<MemoryCacheOptions>
{
private long? _sizeLimit;
private double _compactionPercentage = 0.05;
public ISystemClock Clock { get; set; }
[Obsolete("This is obsolete and will be removed in a future version.")]
public bool CompactOnMemoryPressure { get; set; }
/// <summary>
/// Gets or sets the minimum length of time between successive scans for expired items.
/// </summary>
public TimeSpan ExpirationScanFrequency { get; set; } = TimeSpan.FromMinutes(1);
/// <summary>
/// Gets or sets the maximum size of the cache.
/// </summary>
public long? SizeLimit
{
get => _sizeLimit;
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException(nameof(value), value, $"{nameof(value)} must be non-negative.");
}
_sizeLimit = value;
}
}
/// <summary>
/// Gets or sets the amount to compact the cache by when the maximum size is exceeded.
/// </summary>
public double CompactionPercentage
{
get => _compactionPercentage;
set
{
if (value < 0 || value > 1)
{
throw new ArgumentOutOfRangeException(nameof(value), value, $"{nameof(value)} must be between 0 and 1 inclusive.");
}
_compactionPercentage = value;
}
}
MemoryCacheOptions IOptions<MemoryCacheOptions>.Value
{
get { return this; }
}
}
} | apache-2.0 | C# |
979a7284ce2b9983653c7aee2647ed76fbcfbdc0 | Move 'Empty Website' template to Default language | projectkudu/TryAppService,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS,projectkudu/TryAppService,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS,fashaikh/SimpleWAWS,fashaikh/SimpleWAWS,projectkudu/TryAppService,fashaikh/SimpleWAWS,fashaikh/SimpleWAWS,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/TryAppService | SimpleWAWS/Models/WebsiteTemplate.cs | SimpleWAWS/Models/WebsiteTemplate.cs | using System;
using System.Collections.Generic;
using System.EnterpriseServices.Internal;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace SimpleWAWS.Models
{
public class WebsiteTemplate : BaseTemplate
{
[JsonProperty(PropertyName="fileName")]
public string FileName { get; set; }
[JsonProperty(PropertyName="language")]
public string Language { get; set; }
public static WebsiteTemplate EmptySiteTemplate
{
get { return new WebsiteTemplate() { Name = "Empty Site", Language = "Default", SpriteName = "sprite-Large" }; }
}
}
} | using System;
using System.Collections.Generic;
using System.EnterpriseServices.Internal;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace SimpleWAWS.Models
{
public class WebsiteTemplate : BaseTemplate
{
[JsonProperty(PropertyName="fileName")]
public string FileName { get; set; }
[JsonProperty(PropertyName="language")]
public string Language { get; set; }
public static WebsiteTemplate EmptySiteTemplate
{
get { return new WebsiteTemplate() { Name = "Empty Site", Language = "Empty Site", SpriteName = "sprite-Large" }; }
}
}
} | apache-2.0 | C# |
1ad592547df5d84e12a8b61e3c92c829aa797343 | Update CoreXamlSchemaContext.cs | wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D | src/Serializer.Xaml/CoreXamlSchemaContext.cs | src/Serializer.Xaml/CoreXamlSchemaContext.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Portable.Xaml;
using Portable.Xaml.ComponentModel;
using System;
using System.Collections.Generic;
namespace Serializer.Xaml
{
internal class CoreXamlSchemaContext : XamlSchemaContext
{
private readonly Dictionary<Type, XamlType> _typeCache = new Dictionary<Type, XamlType>();
protected override ICustomAttributeProvider GetCustomAttributeProvider(Type type)
{
return new CoreAttributeProvider(type);
}
public override XamlType GetXamlType(Type type)
{
if (!_typeCache.TryGetValue(type, out XamlType xamlType))
{
xamlType = new CoreXamlType(type, this);
_typeCache.Add(type, xamlType);
}
return xamlType;
}
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Portable.Xaml;
using Portable.Xaml.ComponentModel;
using System;
using System.Collections.Generic;
namespace Serializer.Xaml
{
internal class CoreXamlSchemaContext : XamlSchemaContext
{
public const string CoreNamespace = "https://github.com/Core2D";
public const string EditorNamespace = "https://github.com/Core2D.Editor";
public const string SpatialNamespace = "https://github.com/Math.Spatial";
private readonly Dictionary<Type, XamlType> _typeCache = new Dictionary<Type, XamlType>();
protected override ICustomAttributeProvider GetCustomAttributeProvider(Type type)
{
return new CoreAttributeProvider(type);
}
public override XamlType GetXamlType(Type type)
{
if (!_typeCache.TryGetValue(type, out XamlType xamlType))
{
xamlType = new CoreXamlType(type, this);
_typeCache.Add(type, xamlType);
}
return xamlType;
}
}
}
| mit | C# |
64ca14b710bbf87cfb03484e344fe8d5c4da50ec | Remove unused using | mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard | src/Okanshi.Dashboard/OkanshiServer.cs | src/Okanshi.Dashboard/OkanshiServer.cs | namespace Okanshi.Dashboard
{
public class OkanshiServer
{
public OkanshiServer()
{
RefreshRate = 10;
}
public OkanshiServer(string name, string url, long refreshRate)
{
Name = name;
RefreshRate = refreshRate;
Url = url;
}
public string Name
{
get;
set;
}
public string Url
{
get;
set;
}
public long RefreshRate
{
get;
set;
}
}
} | using System;
namespace Okanshi.Dashboard
{
public class OkanshiServer
{
public OkanshiServer()
{
RefreshRate = 10;
}
public OkanshiServer(string name, string url, long refreshRate)
{
Name = name;
RefreshRate = refreshRate;
Url = url;
}
public string Name
{
get;
set;
}
public string Url
{
get;
set;
}
public long RefreshRate
{
get;
set;
}
}
} | mit | C# |
1caa7347be2974ebeaf59446ed012b286f935740 | fix class summary | kreeben/resin,kreeben/resin | src/Sir.Store/ProducerConsumerQueue.cs | src/Sir.Store/ProducerConsumerQueue.cs | using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
namespace Sir.Store
{
/// <summary>
/// Enque items and run a single consumer thread.
/// </summary>
/// <typeparam name="T"></typeparam>
public class ProducerConsumerQueue<T> : IDisposable where T : class
{
private readonly BlockingCollection<T> _queue;
public ProducerConsumerQueue(Action<T> consumingAction)
{
_queue = new BlockingCollection<T>();
Task.Run(() =>
{
while (!_queue.IsCompleted)
{
T item = null;
try
{
item = _queue.Take();
}
catch (InvalidOperationException) { }
if (item != null)
{
consumingAction(item);
}
}
});
}
public void Enqueue(T item)
{
_queue.Add(item);
}
public void Dispose()
{
_queue.CompleteAdding();
while (!_queue.IsCompleted)
{
Thread.Sleep(10);
}
_queue.Dispose();
}
}
}
| using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
namespace Sir.Store
{
/// <summary>
/// Enques items and runs a single consumer thread.
/// </summary>
/// <typeparam name="T"></typeparam>
public class ProducerConsumerQueue<T> : IDisposable where T : class
{
private readonly BlockingCollection<T> _queue;
public ProducerConsumerQueue(Action<T> consumingAction)
{
_queue = new BlockingCollection<T>();
Task.Run(() =>
{
while (!_queue.IsCompleted)
{
T item = null;
try
{
item = _queue.Take();
}
catch (InvalidOperationException) { }
if (item != null)
{
consumingAction(item);
}
}
});
}
public void Enqueue(T item)
{
_queue.Add(item);
}
public void Dispose()
{
_queue.CompleteAdding();
while (!_queue.IsCompleted)
{
Thread.Sleep(10);
}
_queue.Dispose();
}
}
}
| mit | C# |
e27bd15f080242857e4c62d854628c24df235de9 | Fix minor issue with unix time calculation. | TelegramBots/telegram.bot,MrRoundRobin/telegram.bot,AndyDingo/telegram.bot | src/Telegram.Bot/Helpers/Extensions.cs | src/Telegram.Bot/Helpers/Extensions.cs | using System;
namespace Telegram.Bot.Helpers
{
/// <summary>
/// Extension Methods
/// </summary>
public static class Extensions
{
private static readonly DateTime UnixStart = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
/// <summary>
/// Convert a long into a DateTime
/// </summary>
public static DateTime FromUnixTime(this long unixTime)
=> UnixStart.AddSeconds(unixTime).ToLocalTime();
/// <summary>
/// Convert a DateTime into a long
/// </summary>
/// <exception cref="ArgumentOutOfRangeException"></exception>
/// <exception cref="OverflowException"></exception>
public static long ToUnixTime(this DateTime dateTime)
{
if (dateTime == DateTime.MinValue)
return 0;
var utcDateTime = dateTime.ToUniversalTime();
var delta = (utcDateTime - UnixStart).TotalSeconds;
if (delta < 0)
throw new ArgumentOutOfRangeException(nameof(dateTime), "Unix epoch starts January 1st, 1970");
return Convert.ToInt64(delta);
}
}
}
| using System;
namespace Telegram.Bot.Helpers
{
/// <summary>
/// Extension Methods
/// </summary>
public static class Extensions
{
private static readonly DateTime UnixStart = new DateTime(1970, 1, 1);
/// <summary>
/// Convert a long into a DateTime
/// </summary>
public static DateTime FromUnixTime(this long dateTime)
=> UnixStart.AddSeconds(dateTime).ToLocalTime();
/// <summary>
/// Convert a DateTime into a long
/// </summary>
/// <exception cref="ArgumentOutOfRangeException"></exception>
/// <exception cref="OverflowException"></exception>
public static long ToUnixTime(this DateTime dateTime)
{
var utcDateTime = dateTime.ToUniversalTime();
if (utcDateTime == DateTime.MinValue)
return 0;
var delta = dateTime - UnixStart;
if (delta.TotalSeconds < 0)
throw new ArgumentOutOfRangeException(nameof(dateTime), "Unix epoch starts January 1st, 1970");
return Convert.ToInt64(delta.TotalSeconds);
}
}
}
| mit | C# |
9ec4ed0e0c508531fdcaf03eda27c76a1334742a | Update file version to 0.8.1.0. | breezechen/DiscUtils,breezechen/DiscUtils,quamotion/discutils,drebrez/DiscUtils | src/Properties/AssemblyInfo.cs | src/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// 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("DiscUtils")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DiscUtils")]
[assembly: AssemblyCopyright("Copyright Kenneth Bell 2008-2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
// 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("64a0f4ef-c057-4afe-a8fb-3152de41b143")]
// 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("0.8.0.0")]
[assembly: AssemblyVersion("0.8.0.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
| using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// 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("DiscUtils")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DiscUtils")]
[assembly: AssemblyCopyright("Copyright Kenneth Bell 2008-2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
// 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("64a0f4ef-c057-4afe-a8fb-3152de41b143")]
// 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("0.8.0.0")]
[assembly: AssemblyVersion("0.8.0.0")]
[assembly: AssemblyFileVersion("0.8.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
| mit | C# |
4634daaf336a8d741dc6712008cc803c2f91c83e | modify the description | xyting/NPOI.Extension | src/Properties/AssemblyInfo.cs | src/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("NPOI.Extension")]
[assembly: AssemblyDescription("The extensions of NPOI, which provides IEnumerable<T> save to and load from excel functionality.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RigoFunc (xuyingting)")]
[assembly: AssemblyProduct("NPOI.Extension")]
[assembly: AssemblyCopyright("Copyright © RigoFunc (xuyingting). All rights reserved.")]
[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("5addd29d-b3af-4966-b730-5e5192d0e9df")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.1")]
[assembly: AssemblyFileVersion("1.1.0.1")]
| 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("NPOI.Extension")]
[assembly: AssemblyDescription("Extension of NPOI, that use attributes to control enumerable objects export to excel behaviors.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RigoFunc (xuyingting)")]
[assembly: AssemblyProduct("NPOI.Extension")]
[assembly: AssemblyCopyright("Copyright © RigoFunc (xuyingting). All rights reserved.")]
[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("5addd29d-b3af-4966-b730-5e5192d0e9df")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.1")]
[assembly: AssemblyFileVersion("1.1.0.1")]
| apache-2.0 | C# |
d35436a03eea8911eb51a778e0748d442e8b8d4d | Make error message clearer | zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos | source/Cosmos.Build.Builder/Dependencies/ProperRepoNameDependency.cs | source/Cosmos.Build.Builder/Dependencies/ProperRepoNameDependency.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
namespace Cosmos.Build.Builder.Dependencies
{
internal class ProperRepoNameDependency : IDependency
{
public string Name => "Proper Cosmos folder name";
public bool ShouldInstallByDefault => false;
public string OtherDependencysThatAreMissing => "rename the directory from where install-VS2019.bat or userkit install.bat is started to Cosmos.";
private string CosmosDir;
public ProperRepoNameDependency(string CosmosDir)
{
this.CosmosDir = CosmosDir;
}
public Task InstallAsync(CancellationToken cancellationToken) { throw new NotImplementedException("Installing Proper Cosmos Repository name is not supported"); }
public Task<bool> IsInstalledAsync(CancellationToken cancellationToken)
{
var topDir = CosmosDir.Replace(Path.GetDirectoryName(CosmosDir) + Path.DirectorySeparatorChar, "");
if (topDir.ToLower() != "cosmos")
{
return Task.FromResult(false);
}
else
{
return Task.FromResult(true);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
namespace Cosmos.Build.Builder.Dependencies
{
internal class ProperRepoNameDependency : IDependency
{
public string Name => "Proper Cosmos folder name";
public bool ShouldInstallByDefault => false;
public string OtherDependencysThatAreMissing => "make the directory from where the install-VS2019.bat or userkit install.bat is started is called Cosmos.";
private string CosmosDir;
public ProperRepoNameDependency(string CosmosDir)
{
this.CosmosDir = CosmosDir;
}
public Task InstallAsync(CancellationToken cancellationToken) { throw new NotImplementedException("Installing Proper Cosmos Repository name is not supported"); }
public Task<bool> IsInstalledAsync(CancellationToken cancellationToken)
{
var topDir = CosmosDir.Replace(Path.GetDirectoryName(CosmosDir) + Path.DirectorySeparatorChar, "");
if (topDir.ToLower() != "cosmos")
{
return Task.FromResult(false);
}
else
{
return Task.FromResult(true);
}
}
}
}
| bsd-3-clause | C# |
79886e53561661999f34165056ecef96913609ba | Update GrantHubSiteRights.cs | kilasuit/PnP-PowerShell,OfficeDev/PnP-PowerShell | Commands/Admin/GrantHubSiteRights.cs | Commands/Admin/GrantHubSiteRights.cs | #if !ONPREMISES
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base;
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
using System;
using System.Management.Automation;
namespace SharePointPnP.PowerShell.Commands.Admin
{
[Cmdlet(VerbsSecurity.Grant, "PnPHubSiteRights")]
[CmdletHelp(@"Grant Permissions to associate sites to Hub Sites.",
Category = CmdletHelpCategory.TenantAdmin,
SupportedPlatform = CmdletSupportedPlatform.Online)]
[CmdletExample(Code = @"PS:> Grant-PnPHubSiteRights -Identity https://contoso.sharepoint.com/sites/hubsite -Principals "[email protected]","[email protected]" -Rights Join", Remarks = "This example shows how to grant right to myuser and myotheruser to associate their sites with hubsite", SortOrder = 1)]
public class GrantHubSiteRights : PnPAdminCmdlet
{
[Parameter(Position = 0, ValueFromPipeline = true, Mandatory = true)]
[Alias("HubSite")]
public HubSitePipeBind Identity { get; set; }
[Parameter(Mandatory = true)]
public string[] Principals { get; set; }
[Parameter(Mandatory = true)]
public SPOHubSiteUserRights Rights { get; set; }
protected override void ExecuteCmdlet()
{
base.Tenant.GrantHubSiteRights(Identity.Url, Principals, Rights);
ClientContext.ExecuteQueryRetry();
}
}
}
#endif
| #if !ONPREMISES
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base;
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
using System;
using System.Management.Automation;
namespace SharePointPnP.PowerShell.Commands.Admin
{
[Cmdlet(VerbsSecurity.Grant, "PnPHubSiteRights")]
[CmdletHelp(@"Retrieve all or a specific hubsite.",
Category = CmdletHelpCategory.TenantAdmin,
SupportedPlatform = CmdletSupportedPlatform.Online)]
[CmdletExample(Code = @"PS:> Get-PnPStorageEntity", Remarks = "Returns all site storage entities/farm properties", SortOrder = 1)]
[CmdletExample(Code = @"PS:> Get-PnPTenantSite -Key MyKey", Remarks = "Returns the storage entity/farm property with the given key.", SortOrder = 2)]
public class GrantHubSiteRights : PnPAdminCmdlet
{
[Parameter(Position = 0, ValueFromPipeline = true, Mandatory = true)]
[Alias("HubSite")]
public HubSitePipeBind Identity { get; set; }
[Parameter(Mandatory = true)]
public string[] Principals { get; set; }
[Parameter(Mandatory = true)]
public SPOHubSiteUserRights Rights { get; set; }
protected override void ExecuteCmdlet()
{
base.Tenant.GrantHubSiteRights(Identity.Url, Principals, Rights);
ClientContext.ExecuteQueryRetry();
}
}
}
#endif | mit | C# |
97e3ef7c5e3f115d5859ba170381cb736512df1e | Update HomePage.xaml.cs | thehunte199/mAppQuiz | mAppQuiz/mAppQuiz/ContentPages/HomePage.xaml.cs | mAppQuiz/mAppQuiz/ContentPages/HomePage.xaml.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace mAppQuiz
{
public partial class HomePage : ContentPage
{
public HomePage()
{
InitializeComponent();
}
async void ViewClasses(object sender, EventArgs e)
{
await DisplayAlert("wee", "woo", "blah");
}
async void CreateClass(object sender, EventArgs e)
{
await DisplayAlert("I", "AM", "THE", "WALRUS");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace mAppQuiz
{
public partial class HomePage : ContentPage
{
public HomePage()
{
InitializeComponent();
}
async void ViewClasses(object sender, EventArgs e)
{
await DisplayAlert("wee", "woo", "blah");
}
aync void CreateClass(object sender, EventArgs e)
{
await DisplayAlert("I", "AM", "THE", "WALRUS");
}
}
}
| mit | C# |
cfb42037cff74a3db3dbcf80cb176003f428c7ae | Refactor request string logic to avoid linq usage | smoogipooo/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,ppy/osu | osu.Game/Online/API/Requests/GetUsersRequest.cs | osu.Game/Online/API/Requests/GetUsersRequest.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
namespace osu.Game.Online.API.Requests
{
public class GetUsersRequest : APIRequest<GetUsersResponse>
{
private readonly int[] userIds;
private const int max_ids_per_request = 50;
public GetUsersRequest(int[] userIds)
{
if (userIds.Length > max_ids_per_request)
throw new ArgumentException($"{nameof(GetUsersRequest)} calls only support up to {max_ids_per_request} IDs at once");
this.userIds = userIds;
}
protected override string Target => "users/?ids[]=" + string.Join("&ids[]=", userIds);
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
namespace osu.Game.Online.API.Requests
{
public class GetUsersRequest : APIRequest<GetUsersResponse>
{
private readonly int[] userIds;
private const int max_ids_per_request = 50;
public GetUsersRequest(int[] userIds)
{
if (userIds.Length > max_ids_per_request)
throw new ArgumentException($"{nameof(GetUsersRequest)} calls only support up to {max_ids_per_request} IDs at once");
this.userIds = userIds;
}
protected override string Target => $@"users/?{userIds.Select(u => $"ids[]={u}&").Aggregate((a, b) => a + b)}";
}
}
| mit | C# |
8fdca1ec737a747efe79c3ff16dad3217762c4b2 | Build fix | blebougge/Catel | src/Catel.Extensions.Controls/Catel.Extensions.Controls.Shared/ExtensionsControlsModule.cs | src/Catel.Extensions.Controls/Catel.Extensions.Controls.Shared/ExtensionsControlsModule.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="ExtensionsControlsModule.cs" company="Catel development team">
// Copyright (c) 2008 - 2014 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Catel
{
using Catel.IoC;
using Catel.MVVM;
using Catel.Windows.Controls;
/// <summary>
/// Extensions.Controls module which allows the registration of default services in the service locator.
/// </summary>
public class ExtensionsControlsModule : IServiceLocatorInitializer
{
/// <summary>
/// Initializes the specified service locator.
/// </summary>
/// <param name="serviceLocator">The service locator.</param>
public void Initialize(IServiceLocator serviceLocator)
{
Argument.IsNotNull(() => serviceLocator);
#if NET
var viewModelLocator = serviceLocator.ResolveType<IViewModelLocator>();
viewModelLocator.Register(typeof(TraceOutputControl), typeof(TraceOutputViewModel));
#endif
}
}
} | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="ExtensionsControlsModule.cs" company="Catel development team">
// Copyright (c) 2008 - 2014 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Catel
{
using Catel.IoC;
using Catel.MVVM;
using Catel.Windows.Controls;
/// <summary>
/// Extensions.Controls module which allows the registration of default services in the service locator.
/// </summary>
public class ExtensionsControlsModule : IServiceLocatorInitializer
{
/// <summary>
/// Initializes the specified service locator.
/// </summary>
/// <param name="serviceLocator">The service locator.</param>
public void Initialize(IServiceLocator serviceLocator)
{
Argument.IsNotNull(() => serviceLocator);
var viewModelLocator = serviceLocator.ResolveType<IViewModelLocator>();
viewModelLocator.Register(typeof(TraceOutputControl), typeof(TraceOutputViewModel));
}
}
} | mit | C# |
ec7cb2e7f326ac7404cfe4278d9ff32e5e886a7e | Fix #403 : Order the content types by display name. | xkproject/Orchard2,xkproject/Orchard2,xkproject/Orchard2,xkproject/Orchard2,petedavis/Orchard2,jtkech/Orchard2,lukaskabrt/Orchard2,lukaskabrt/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,jtkech/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,yiji/Orchard2,jtkech/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,stevetayloruk/Orchard2,yiji/Orchard2,petedavis/Orchard2,yiji/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,lukaskabrt/Orchard2,jtkech/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,lukaskabrt/Orchard2 | src/Orchard.Cms.Web/Modules/Orchard.ContentTypes/ViewModels/SelectContentTypesViewModel.cs | src/Orchard.Cms.Web/Modules/Orchard.ContentTypes/ViewModels/SelectContentTypesViewModel.cs | using System.Linq;
using Orchard.ContentManagement.Metadata.Models;
using Orchard.ContentManagement.MetaData;
namespace Orchard.ContentTypes.ViewModels
{
public class SelectContentTypesViewModel
{
public string HtmlName { get; set; }
public ContentTypeSelection[] ContentTypeSelections { get; set; }
}
public class ContentTypeSelection
{
public bool IsSelected { get; set; }
public ContentTypeDefinition ContentTypeDefinition { get; set; }
public static ContentTypeSelection[] Build(IContentDefinitionManager contentDefinitionManager, string[] selectedContentTypes)
{
var contentTypes = contentDefinitionManager
.ListTypeDefinitions()
.Select(x =>
new ContentTypeSelection
{
IsSelected = selectedContentTypes.Contains(x.Name),
ContentTypeDefinition = x
})
.OrderBy(type => type.ContentTypeDefinition.DisplayName)
.ToArray();
return contentTypes;
}
}
}
| using System.Linq;
using Orchard.ContentManagement.Metadata.Models;
using Orchard.ContentManagement.MetaData;
namespace Orchard.ContentTypes.ViewModels
{
public class SelectContentTypesViewModel
{
public string HtmlName { get; set; }
public ContentTypeSelection[] ContentTypeSelections { get; set; }
}
public class ContentTypeSelection
{
public bool IsSelected { get; set; }
public ContentTypeDefinition ContentTypeDefinition { get; set; }
public static ContentTypeSelection[] Build(IContentDefinitionManager contentDefinitionManager, string[] selectedContentTypes)
{
var contentTypes = contentDefinitionManager
.ListTypeDefinitions()
.Select(x =>
new ContentTypeSelection
{
IsSelected = selectedContentTypes.Contains(x.Name),
ContentTypeDefinition = x
})
.ToArray();
return contentTypes;
}
}
}
| bsd-3-clause | C# |
9abd0dc16414d9bdeeec898d79bed3c4010258f3 | Remove unused RoleProvider setting from authentication configuration | crowar/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,lkho/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,NipponSysits/IIS.Git-Connector,willdean/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,braegelno5/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,willdean/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,larshg/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,gencer/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,lkho/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,willdean/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,willdean/Bonobo-Git-Server,gencer/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,lkho/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,crowar/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,kfarnung/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,gencer/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,willdean/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,gencer/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,larshg/Bonobo-Git-Server,larshg/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,larshg/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,padremortius/Bonobo-Git-Server,crowar/Bonobo-Git-Server,lkho/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,braegelno5/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,NipponSysits/IIS.Git-Connector,RedX2501/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,crowar/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,crowar/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,PGM-NipponSysits/IIS.Git-Connector,kfarnung/Bonobo-Git-Server,crowar/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector | Bonobo.Git.Server/Configuration/AuthenticationSettings.cs | Bonobo.Git.Server/Configuration/AuthenticationSettings.cs | using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
namespace Bonobo.Git.Server.Configuration
{
public class AuthenticationSettings
{
public static string MembershipService { get; private set; }
static AuthenticationSettings()
{
MembershipService = ConfigurationManager.AppSettings["MembershipService"];
}
}
} | using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
namespace Bonobo.Git.Server.Configuration
{
public class AuthenticationSettings
{
public static string MembershipService { get; private set; }
public static string RoleProvider { get; private set; }
static AuthenticationSettings()
{
MembershipService = ConfigurationManager.AppSettings["MembershipService"];
RoleProvider = ConfigurationManager.AppSettings["RoleProvider"];
}
}
} | mit | C# |
a27c502ebaae34ef6355942caaaaeff44fa08c01 | Update tests for new url resolution behavior | Durwella/UrlShortening,Durwella/UrlShortening | Durwella.UrlShortening.Tests/WebClientUrlUnwrapperTest.cs | Durwella.UrlShortening.Tests/WebClientUrlUnwrapperTest.cs | using System.Net;
using FluentAssertions;
using NUnit.Framework;
namespace Durwella.UrlShortening.Tests
{
public class WebClientUrlUnwrapperTest
{
[Test]
public void ShouldGetResourceLocation()
{
var wrappedUrl = "http://goo.gl/mSkqOi";
var subject = new WebClientUrlUnwrapper();
WebClientUrlUnwrapper.ResolveUrls = true;
var directUrl = subject.GetDirectUrl(wrappedUrl);
directUrl.Should().Be("http://example.com/");
WebClientUrlUnwrapper.ResolveUrls = false;
}
[Test]
public void ShouldReturnGivenLocationIfAuthenticationRequired()
{
var givenUrl = "http://durwella.com/testing/does-not-exist";
var subject = new WebClientUrlUnwrapper
{
IgnoreErrorCodes = new[] { HttpStatusCode.NotFound }
};
WebClientUrlUnwrapper.ResolveUrls = true;
var directUrl = subject.GetDirectUrl(givenUrl);
directUrl.Should().Be(givenUrl);
WebClientUrlUnwrapper.ResolveUrls = false;
}
}
}
| using System.Net;
using FluentAssertions;
using NUnit.Framework;
namespace Durwella.UrlShortening.Tests
{
public class WebClientUrlUnwrapperTest
{
[Test]
public void ShouldGetResourceLocation()
{
var wrappedUrl = "http://goo.gl/mSkqOi";
var subject = new WebClientUrlUnwrapper();
var directUrl = subject.GetDirectUrl(wrappedUrl);
directUrl.Should().Be("http://example.com/");
}
[Test]
public void ShouldReturnGivenLocationIfAuthenticationRequired()
{
var givenUrl = "http://durwella.com/testing/does-not-exist";
var subject = new WebClientUrlUnwrapper
{
IgnoreErrorCodes = new[] { HttpStatusCode.NotFound }
};
var directUrl = subject.GetDirectUrl(givenUrl);
directUrl.Should().Be(givenUrl);
}
}
}
| mit | C# |
786a45f1e81f8363bf5e8b72f499eb17a6b2fc7b | Deploy client | paralin/D2Moddin | ClientCommon/Version.cs | ClientCommon/Version.cs | namespace ClientCommon
{
public class Version
{
public const string ClientVersion = "2.6.1";
}
} | namespace ClientCommon
{
public class Version
{
public const string ClientVersion = "2.6.0";
}
} | apache-2.0 | C# |
0ca1d6d349c4406d9737548ef6e15aca883e855d | Fix two failing tests | ermshiperete/LfMerge,ermshiperete/LfMerge,sillsdev/LfMerge,ermshiperete/LfMerge,sillsdev/LfMerge,sillsdev/LfMerge | src/LfMerge.Tests/Actions/ReceiveActionTests.cs | src/LfMerge.Tests/Actions/ReceiveActionTests.cs | // Copyright (c) 2015 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
using NUnit.Framework;
using LfMerge.Actions;
using System.IO;
namespace LfMerge.Tests.Actions
{
[TestFixture]
public class ReceiveActionTests
{
private TestEnvironment _env;
[SetUp]
public void Setup()
{
_env = new TestEnvironment();
}
[TearDown]
public void TearDown()
{
_env.Dispose();
}
[Test]
public void DoRun_ProjectDoesntExistSetsStateOnHold()
{
// Setup
var nonExistingProject = Path.GetRandomFileName();
// for this test we don't want the test double for InternetCloneSettingsModel
_env.Dispose();
_env = new TestEnvironment(false);
var lfProj = LanguageForgeProject.Create(_env.Settings, nonExistingProject);
var sut = LfMerge.Actions.Action.GetAction(ActionNames.Receive);
// Execute/Verify
Assert.That(() => sut.Run(lfProj), Throws.InstanceOf<UnauthorizedAccessException>());
// Verify
Assert.That(lfProj.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.HOLD));
}
[Test]
public void DoRun_DirDoesntExistClonesProject()
{
// Setup
var projCode = TestContext.CurrentContext.Test.Name;
var lfProj = LanguageForgeProject.Create(_env.Settings, projCode);
var sut = LfMerge.Actions.Action.GetAction(ActionNames.Receive);
// Execute
sut.Run(lfProj);
// Verify
var projDir = Path.Combine(_env.Settings.WebWorkDirectory, projCode.ToLowerInvariant());
Assert.That(Directory.Exists(projDir), Is.True,
"Didn't create webwork directory");
Assert.That(Directory.Exists(Path.Combine(projDir, ".hg")), Is.True,
"Didn't clone project");
}
[Test]
public void DoRun_HgDoesntExistClonesProject()
{
// Setup
var projCode = TestContext.CurrentContext.Test.Name;
var projDir = Path.Combine(_env.Settings.WebWorkDirectory, projCode.ToLowerInvariant());
Directory.CreateDirectory(projDir);
var lfProj = LanguageForgeProject.Create(_env.Settings, projCode);
var sut = LfMerge.Actions.Action.GetAction(ActionNames.Receive);
// Execute
sut.Run(lfProj);
// Verify
Assert.That(Directory.Exists(Path.Combine(projDir, ".hg")), Is.True,
"Didn't clone project");
}
}
}
| // Copyright (c) 2015 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
using NUnit.Framework;
using LfMerge.Actions;
using System.IO;
namespace LfMerge.Tests.Actions
{
[TestFixture]
public class ReceiveActionTests
{
private TestEnvironment _env;
[SetUp]
public void Setup()
{
_env = new TestEnvironment();
}
[TearDown]
public void TearDown()
{
_env.Dispose();
}
[Test]
public void DoRun_ProjectDoesntExistSetsStateOnHold()
{
// Setup
var nonExistingProject = Path.GetRandomFileName();
// for this test we don't want the test double for InternetCloneSettingsModel
_env.Dispose();
_env = new TestEnvironment(false);
var lfProj = LanguageForgeProject.Create(_env.Settings, nonExistingProject);
var sut = LfMerge.Actions.Action.GetAction(ActionNames.Receive);
// Execute/Verify
Assert.That(() => sut.Run(lfProj), Throws.InstanceOf<UnauthorizedAccessException>());
// Verify
Assert.That(lfProj.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.HOLD));
}
[Test]
public void DoRun_DirDoesntExistClonesProject()
{
// Setup
var projCode = TestContext.CurrentContext.Test.Name;
var lfProj = LanguageForgeProject.Create(_env.Settings, projCode);
var sut = LfMerge.Actions.Action.GetAction(ActionNames.Receive);
// Execute
sut.Run(lfProj);
// Verify
var projDir = Path.Combine(_env.Settings.WebWorkDirectory, projCode);
Assert.That(Directory.Exists(projDir), Is.True,
"Didn't create webwork directory");
Assert.That(Directory.Exists(Path.Combine(projDir, ".hg")), Is.True,
"Didn't clone project");
}
[Test]
public void DoRun_HgDoesntExistClonesProject()
{
// Setup
var projCode = TestContext.CurrentContext.Test.Name;
var projDir = Path.Combine(_env.Settings.WebWorkDirectory, projCode);
Directory.CreateDirectory(projDir);
var lfProj = LanguageForgeProject.Create(_env.Settings, projCode);
var sut = LfMerge.Actions.Action.GetAction(ActionNames.Receive);
// Execute
sut.Run(lfProj);
// Verify
Assert.That(Directory.Exists(Path.Combine(projDir, ".hg")), Is.True,
"Didn't clone project");
}
}
}
| mit | C# |
950cb254e5a7c6aadd3ae7853c33c1e3dd1a44cd | Bump version to 1.0.1 | Ky7m/Roslyn.Utilities | src/Roslyn.Utilities/Properties/AssemblyInfo.cs | src/Roslyn.Utilities/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Roslyn.Utilities")]
[assembly: AssemblyProduct("Roslyn.Utilities")]
[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: InternalsVisibleTo("Roslyn.Utilities.Tests")] | using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Roslyn.Utilities")]
[assembly: AssemblyProduct("Roslyn.Utilities")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: InternalsVisibleTo("Roslyn.Utilities.Tests")] | apache-2.0 | C# |
38e336fa9f7a3f730771a958f7ccde61a22bbedd | Use 8192u as lowestBufferSize; Remove tests for LocalMaxChunkCount and MaxMessageSize | convertersystems/opc-ua-client | UaClient.UnitTests/UnitTests/UaApplicationOptionsTests.cs | UaClient.UnitTests/UnitTests/UaApplicationOptionsTests.cs | using FluentAssertions;
using System;
using System.Collections.Generic;
using System.Text;
using Workstation.ServiceModel.Ua;
using Xunit;
namespace Workstation.UaClient.UnitTests
{
public class UaApplicationOptionsTests
{
[Fact]
public void UaTcpTransportChannelOptionsDefaults()
{
var lowestBufferSize = 8192u;
var options = new UaTcpTransportChannelOptions();
options.LocalReceiveBufferSize
.Should().BeGreaterOrEqualTo(lowestBufferSize);
options.LocalSendBufferSize
.Should().BeGreaterOrEqualTo(lowestBufferSize);
}
[Fact]
public void UaTcpSecureChannelOptionsDefaults()
{
var shortestTimespan = TimeSpan.FromMilliseconds(100);
var options = new UaTcpSecureChannelOptions();
TimeSpan.FromMilliseconds(options.TimeoutHint)
.Should().BeGreaterOrEqualTo(shortestTimespan);
options.DiagnosticsHint
.Should().Be(0);
}
[Fact]
public void UaTcpSessionChannelOptionsDefaults()
{
var shortestTimespan = TimeSpan.FromMilliseconds(100);
var options = new UaTcpSessionChannelOptions();
TimeSpan.FromMilliseconds(options.SessionTimeout)
.Should().BeGreaterOrEqualTo(shortestTimespan);
}
}
}
| using FluentAssertions;
using System;
using System.Collections.Generic;
using System.Text;
using Workstation.ServiceModel.Ua;
using Xunit;
namespace Workstation.UaClient.UnitTests
{
public class UaApplicationOptionsTests
{
[Fact]
public void UaTcpTransportChannelOptionsDefaults()
{
var lowestBufferSize = 1024u;
var options = new UaTcpTransportChannelOptions();
options.LocalMaxChunkCount
.Should().BeGreaterOrEqualTo(lowestBufferSize);
options.LocalMaxMessageSize
.Should().BeGreaterOrEqualTo(lowestBufferSize);
options.LocalReceiveBufferSize
.Should().BeGreaterOrEqualTo(lowestBufferSize);
options.LocalSendBufferSize
.Should().BeGreaterOrEqualTo(lowestBufferSize);
}
[Fact]
public void UaTcpSecureChannelOptionsDefaults()
{
var shortestTimespan = TimeSpan.FromMilliseconds(100);
var options = new UaTcpSecureChannelOptions();
TimeSpan.FromMilliseconds(options.TimeoutHint)
.Should().BeGreaterOrEqualTo(shortestTimespan);
options.DiagnosticsHint
.Should().Be(0);
}
[Fact]
public void UaTcpSessionChannelOptionsDefaults()
{
var shortestTimespan = TimeSpan.FromMilliseconds(100);
var options = new UaTcpSessionChannelOptions();
TimeSpan.FromMilliseconds(options.SessionTimeout)
.Should().BeGreaterOrEqualTo(shortestTimespan);
}
}
}
| mit | C# |
3bb73b40d42a3800d9f26535b2c6e9dc5b419aed | fix backwards biginteger json serializer check | halforbit/data-stores | Halforbit.DataStores/FileStores/Serialization/Json/Implementation/BigIntegerJsonConverter.cs | Halforbit.DataStores/FileStores/Serialization/Json/Implementation/BigIntegerJsonConverter.cs | using Newtonsoft.Json;
using System;
using System.Numerics;
namespace Halforbit.DataStores.FileStores.Serialization.Json.Implementation
{
public class BigIntegerJsonConverter : JsonConverter
{
public override bool CanRead => true;
public override bool CanConvert(Type objectType)
{
return typeof(BigInteger).IsAssignableFrom(objectType);
}
public override void WriteJson(
JsonWriter writer,
object value,
Newtonsoft.Json.JsonSerializer serializer)
{
writer.WriteValue(((BigInteger)value).ToString());
}
public override object ReadJson(
JsonReader reader,
Type objectType,
object existingValue,
Newtonsoft.Json.JsonSerializer serializer)
{
return BigInteger.Parse((string)reader.Value);
}
}
}
| using Newtonsoft.Json;
using System;
using System.Numerics;
namespace Halforbit.DataStores.FileStores.Serialization.Json.Implementation
{
public class BigIntegerJsonConverter : JsonConverter
{
public override bool CanRead => true;
public override bool CanConvert(Type objectType)
{
return objectType.IsAssignableFrom(typeof(BigInteger));
}
public override void WriteJson(
JsonWriter writer,
object value,
Newtonsoft.Json.JsonSerializer serializer)
{
writer.WriteValue(((BigInteger)value).ToString());
}
public override object ReadJson(
JsonReader reader,
Type objectType,
object existingValue,
Newtonsoft.Json.JsonSerializer serializer)
{
return BigInteger.Parse((string)reader.Value);
}
}
}
| mit | C# |
d40dc2237fbdfd2825e5f3ce0078f14782f51485 | Test 3 | bioepic-blake/RPG | RPG3/SkeletonWorrior.cs | RPG3/SkeletonWorrior.cs | using System;
namespace RPG3
{
public class SkeletonWorrior : enermy
{
public string weaponName { get; set; }
public SkeletonWorrior(string name, string WeaponS)
: base(name)
{
weaponName = WeaponS;
}
public override int _DamageSet()
{
_weaponDamage += 9;
return _weaponDamage;
}
public override int _HealthSet()
{
_health += 40;
return _health;
}
public override int _speedSet()
{
_speed += 5;
return _speed;
}
public override string ToString()
{
return $"enermy name = {_Name} {Environment.NewLine} health = {_health} {Environment.NewLine} speed = {_speed} {Environment.NewLine} weapon = {weaponName} {Environment.NewLine} weapon damage = {_weaponDamage}";
}
}
}
| using System;
namespace RPG3
{
public class SkeletonWorrior : enermy
{
public string weaponName { get; set; }
public SkeletonWorrior(string name, string WeaponS)
: base(name)
{
weaponName = WeaponS;
}
public void Ignore()
{
}
public override int _DamageSet()
{
_weaponDamage += 9;
return _weaponDamage;
}
public override int _HealthSet()
{
_health += 40;
return _health;
}
public override int _speedSet()
{
_speed += 5;
return _speed;
}
public override string ToString()
{
return $"enermy name = {_Name} {Environment.NewLine} health = {_health} {Environment.NewLine} speed = {_speed} {Environment.NewLine} weapon = {weaponName} {Environment.NewLine} weapon damage = {_weaponDamage}";
}
}
}
| mit | C# |
d22da5f0abbb0a20d2edd2ff478d5aafe6dda2eb | enable limited opening on R14 drawings | IxMilia/BCad,IxMilia/BCad | BCad.FileHandlers/DwgFileHandler.cs | BCad.FileHandlers/DwgFileHandler.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BCad.Collections;
using BCad.Dwg;
using BCad.Entities;
namespace BCad.FileHandlers
{
[ExportFileHandler(DwgFileHandler.DisplayName, true, true, DwgFileHandler.FileExtension)]
public class DwgFileHandler : IFileHandler
{
public const string DisplayName = "DWG Files (" + FileExtension + ")";
public const string FileExtension = ".dwg";
public bool ReadDrawing(string fileName, Stream fileStream, out Drawing drawing, out ViewPort viewPort, out Dictionary<string, object> propertyBag)
{
var file = DwgFile.Load(fileStream);
var layers = new ReadOnlyTree<string, Layer>();
foreach (var layer in file.ObjectMap.Objects.OfType<DwgLayer>())
{
var blayer = new Layer(layer.Name, new IndexedColor((byte)layer.Color));
layers = layers.Insert(blayer.Name, blayer);
}
foreach (var ent in file.ObjectMap.Objects.OfType<DwgEntity>())
{
Entity entity = null;
switch (ent.Type)
{
case DwgObjectType.Line:
var line = (DwgLine)ent;
entity = ToLine(line);
break;
}
if (entity != null)
{
var layerCandidate = file.ObjectMap.Objects.FirstOrDefault(o => o.Handle == ent.LayerHandle);
var dwgLayer = layerCandidate as DwgLayer;
var layerName = dwgLayer.Name;
var newLayer = layers.GetValue(layerName).Add(entity);
layers = layers.Insert(layerName, newLayer);
}
}
drawing = new Drawing(
new DrawingSettings(),
layers);
drawing.Tag = file;
viewPort = null;
propertyBag = null;
return true;
}
public bool WriteDrawing(string fileName, Stream fileStream, Drawing drawing, ViewPort viewPort, Dictionary<string, object> propertyBag)
{
throw new NotImplementedException();
}
private static Line ToLine(DwgLine line)
{
return new Line(ToPoint(line.StartPoint), ToPoint(line.EndPoint), ToColor(line.Color), line);
}
private static IndexedColor ToColor(short color)
{
if (color == 0 || color == 256)
return IndexedColor.Auto;
return new IndexedColor((byte)color);
}
private static Point ToPoint(DwgPoint point)
{
return new Point(point.X, point.Y, point.Z);
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using BCad.Dwg;
namespace BCad.FileHandlers
{
[ExportFileHandler(DwgFileHandler.DisplayName, true, true, DwgFileHandler.FileExtension)]
public class DwgFileHandler : IFileHandler
{
public const string DisplayName = "DWG Files (" + FileExtension + ")";
public const string FileExtension = ".dwg";
public bool ReadDrawing(string fileName, Stream fileStream, out Drawing drawing, out ViewPort viewPort, out Dictionary<string, object> propertyBag)
{
var file = DwgFile.Load(fileStream);
throw new NotImplementedException();
}
public bool WriteDrawing(string fileName, Stream fileStream, Drawing drawing, ViewPort viewPort, Dictionary<string, object> propertyBag)
{
throw new NotImplementedException();
}
}
}
| apache-2.0 | C# |
7c7d51c5ee35f53ceca67e024194b19b601dd8bf | Fix path guide utilisateur | Lan-Manager/lama,Tri125/lama | Lama/UI/Win/GuideUtilisateur.xaml.cs | Lama/UI/Win/GuideUtilisateur.xaml.cs | using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;
namespace Lama.UI.Win
{
/// <summary>
/// Interaction logic for GuideUtilisateur.xaml
/// </summary>
public partial class GuideUtilisateur : MetroWindow
{
public GuideUtilisateur()
{
string fullpath = System.IO.Path.GetFullPath("guide_utilisateur.pdf");
InitializeComponent();
System.Windows.Controls.WebBrowser browser = new System.Windows.Controls.WebBrowser();
browser.Navigate(new Uri("about:blank"));
try
{
pdfWebViewer.Navigate(fullpath);
}
catch (Exception)
{
MessageBox.Show("Erreur lors de l'ouverture du PDF. Vérifiez que Adobe PDF Reader est installé. Vous pouvez l'activer dans Internet Explorer dans les Addons.");
}
}
}
}
| using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;
namespace Lama.UI.Win
{
/// <summary>
/// Interaction logic for GuideUtilisateur.xaml
/// </summary>
public partial class GuideUtilisateur : MetroWindow
{
public GuideUtilisateur()
{
string fullpath = System.IO.Path.GetFullPath(@"\lama\Lama\Resources\guide_utilisateur.pdf");
InitializeComponent();
System.Windows.Controls.WebBrowser browser = new System.Windows.Controls.WebBrowser();
browser.Navigate(new Uri("about:blank"));
try
{
pdfWebViewer.Navigate(fullpath);
}
catch (Exception)
{
MessageBox.Show("Erreur lors de l'ouverture du PDF. Vérifiez que Adobe PDF Reader est installé. Vous pouvez l'activer dans Internet Explorer dans les Addons.");
}
}
}
}
| mit | C# |
2c030b3166c32b718ca23da35e1d16b027e1f54f | fix null entry assembly usage in integration test | yonglehou/NsqSharp,judwhite/NsqSharp | NsqSharp/Bus/Utils/WindowsService.cs | NsqSharp/Bus/Utils/WindowsService.cs | using System;
using System.Diagnostics;
using System.Reflection;
using System.ServiceProcess;
using System.Threading;
using System.Web.Hosting;
using NsqSharp.Bus.Configuration;
namespace NsqSharp.Bus.Utils
{
internal class WindowsService : ServiceBase, IRegisteredObject
{
private readonly BusConfiguration _busConfiguration;
private int _stop;
public WindowsService(BusConfiguration busConfiguration)
{
if (busConfiguration == null)
throw new ArgumentNullException("busConfiguration");
CanStop = true;
CanShutdown = true;
_busConfiguration = busConfiguration;
}
protected override void OnStart(string[] args)
{
Start();
}
protected override void OnStop()
{
if (Interlocked.CompareExchange(ref _stop, value: 1, comparand: 0) == 1)
{
return;
}
StopBus();
}
protected override void OnShutdown()
{
OnStop();
}
public void Start()
{
var entryAssembly = Assembly.GetEntryAssembly();
if (entryAssembly != null)
{
EventLog.Log = "Application";
EventLog.Source = entryAssembly.GetName().Name;
}
else
{
EventLog.Log = "Application";
EventLog.Source = "NsqSharp.Bus Unit Tests";
}
_busConfiguration.StartBus();
Trace.WriteLine(string.Format("{0} bus started", entryAssembly != null ? entryAssembly.GetName().Name : "Test"));
}
private void StopBus()
{
_busConfiguration.StopBus();
}
public void Stop(bool immediate)
{
OnStop();
HostingEnvironment.UnregisterObject(this);
}
}
}
| using System;
using System.Diagnostics;
using System.Reflection;
using System.ServiceProcess;
using System.Threading;
using System.Web.Hosting;
using NsqSharp.Bus.Configuration;
namespace NsqSharp.Bus.Utils
{
internal class WindowsService : ServiceBase, IRegisteredObject
{
private readonly BusConfiguration _busConfiguration;
private int _stop;
public WindowsService(BusConfiguration busConfiguration)
{
if (busConfiguration == null)
throw new ArgumentNullException("busConfiguration");
CanStop = true;
CanShutdown = true;
_busConfiguration = busConfiguration;
}
protected override void OnStart(string[] args)
{
Start();
}
protected override void OnStop()
{
if (Interlocked.CompareExchange(ref _stop, value: 1, comparand: 0) == 1)
{
return;
}
StopBus();
}
protected override void OnShutdown()
{
OnStop();
}
public void Start()
{
var entryAssembly = Assembly.GetEntryAssembly();
if (entryAssembly != null)
{
EventLog.Log = "Application";
EventLog.Source = entryAssembly.GetName().Name;
}
else
{
EventLog.Log = "Application";
EventLog.Source = "NsqSharp.Bus Unit Tests";
}
_busConfiguration.StartBus();
Trace.WriteLine(string.Format("{0} bus started", Assembly.GetEntryAssembly().GetName().Name));
}
private void StopBus()
{
_busConfiguration.StopBus();
}
public void Stop(bool immediate)
{
OnStop();
HostingEnvironment.UnregisterObject(this);
}
}
}
| mit | C# |
8d83456231ef11af4fe61a1a39e77c96257ce1ab | stop server after start | OlegKleyman/IntegrationFtpServer | tests/integration/Omego.SimpleFtp.Tests.Integration/FtpServerTests.cs | tests/integration/Omego.SimpleFtp.Tests.Integration/FtpServerTests.cs | namespace Omego.SimpleFtp.Tests.Integration
{
using System.IO;
using System.IO.Abstractions;
using NUnit.Framework;
[TestFixture]
public class FtpServerTests
{
private readonly string ftpHomeDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
[OneTimeSetUp]
public void Setup()
{
Directory.CreateDirectory(ftpHomeDirectory);
}
[Test]
public void FilesShouldBeListed()
{
var server = GetFtpServer();
server.Start();
server.Stop();
}
private FtpServer GetFtpServer()
{
return new FtpServer(new FtpConfiguration(ftpHomeDirectory, 3435), new FileSystem(), new OperatingSystem());
}
}
}
| namespace Omego.SimpleFtp.Tests.Integration
{
using System.IO;
using System.IO.Abstractions;
using NUnit.Framework;
[TestFixture]
public class FtpServerTests
{
private readonly string ftpHomeDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
[OneTimeSetUp]
public void Setup()
{
Directory.CreateDirectory(ftpHomeDirectory);
}
[Test]
public void FilesShouldBeListed()
{
var server = GetFtpServer();
server.Start();
}
private FtpServer GetFtpServer()
{
return new FtpServer(new FtpConfiguration(ftpHomeDirectory, 3435), new FileSystem(), new OperatingSystem());
}
}
}
| unlicense | C# |
ee6996392a6d245c64ad199e76bb928bd932643c | Bump version | kamil-mrzyglod/Oxygenize | Oxygenize/Properties/AssemblyInfo.cs | Oxygenize/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("Oxygenize")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Codenova.pl")]
[assembly: AssemblyProduct("Oxygenize")]
[assembly: AssemblyCopyright("Copyright © Codenova.pl 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("4edf4eea-cc6f-4d91-a2bf-c5315abf240c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Oxygenize2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Oxygenize2")]
[assembly: AssemblyCopyright("Copyright © Microsoft 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("4edf4eea-cc6f-4d91-a2bf-c5315abf240c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
cd67b635a2cc989c7890b1eeba208e4ef559ffae | Make ContractQuotes factory method internal | smarkets/IronSmarkets | IronSmarkets/Data/ContractQuotes.cs | IronSmarkets/Data/ContractQuotes.cs | // Copyright (c) 2011 Smarkets Limited
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
namespace IronSmarkets.Data
{
public class ContractQuotes
{
private readonly Uuid _uuid;
private readonly List<Quote> _bids;
private readonly List<Quote> _offers;
private readonly List<Execution> _executions;
private readonly Execution? _lastExecution;
public Uuid Uuid { get { return _uuid; } }
public IEnumerable<Quote> Bids { get { return _bids; } }
public IEnumerable<Quote> Offers { get { return _offers; } }
public IEnumerable<Execution> Executions { get { return _executions; } }
public Execution? LastExecution { get { return _lastExecution; } }
private ContractQuotes(
Uuid uuid,
IEnumerable<Quote> bids,
IEnumerable<Quote> offers,
IEnumerable<Execution> executions,
Execution? lastExecution)
{
_uuid = uuid;
_bids = new List<Quote>(bids);
_offers = new List<Quote>(offers);
_executions = new List<Execution>(executions);
_lastExecution = lastExecution;
}
internal static ContractQuotes FromSeto(Proto.Seto.ContractQuotes setoQuotes)
{
return new ContractQuotes(
Uuid.FromUuid128(setoQuotes.Contract),
setoQuotes.Bids.Select(Quote.FromSeto),
setoQuotes.Offers.Select(Quote.FromSeto),
setoQuotes.Executions.Select(Execution.FromSeto),
Execution.MaybeFromSeto(setoQuotes.LastExecution));
}
}
}
| // Copyright (c) 2011 Smarkets Limited
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
namespace IronSmarkets.Data
{
public class ContractQuotes
{
private readonly Uuid _uuid;
private readonly List<Quote> _bids;
private readonly List<Quote> _offers;
private readonly List<Execution> _executions;
private readonly Execution? _lastExecution;
public Uuid Uuid { get { return _uuid; } }
public IEnumerable<Quote> Bids { get { return _bids; } }
public IEnumerable<Quote> Offers { get { return _offers; } }
public IEnumerable<Execution> Executions { get { return _executions; } }
public Execution? LastExecution { get { return _lastExecution; } }
private ContractQuotes(
Uuid uuid,
IEnumerable<Quote> bids,
IEnumerable<Quote> offers,
IEnumerable<Execution> executions,
Execution? lastExecution)
{
_uuid = uuid;
_bids = new List<Quote>(bids);
_offers = new List<Quote>(offers);
_executions = new List<Execution>(executions);
_lastExecution = lastExecution;
}
private static ContractQuotes FromSeto(Proto.Seto.ContractQuotes setoQuotes)
{
return new ContractQuotes(
Uuid.FromUuid128(setoQuotes.Contract),
setoQuotes.Bids.Select(Quote.FromSeto),
setoQuotes.Offers.Select(Quote.FromSeto),
setoQuotes.Executions.Select(Execution.FromSeto),
Execution.MaybeFromSeto(setoQuotes.LastExecution));
}
}
}
| mit | C# |
b2e4e1e62ceec3842c0c8c0e90e4fd58d2294d42 | Add filedirectory null check | deeja/Pigeon | Pigeon.Zipper/Pipelines/FindLogs.cs | Pigeon.Zipper/Pipelines/FindLogs.cs | namespace Pigeon.Zipper.Pipelines
{
using Sitecore.Diagnostics;
using Sitecore.Pipelines;
public class FindLogs: PigeonPipelineProcessor
{
public override void Process(PigeonPipelineArgs args)
{
Assert.IsNotNull(args, "args != null");
Assert.IsNotNull(args.FileDirectory, "args.FileDirectory != null");
FileFinder finder = new FileFinder(args.FileDirectory);
args.FoundFiles = finder.FindLogFiles(args.StartDateTime, args.EndDateTime);
}
}
} | namespace Pigeon.Zipper.Pipelines
{
using Sitecore.Diagnostics;
using Sitecore.Pipelines;
public class FindLogs: PigeonPipelineProcessor
{
public override void Process(PigeonPipelineArgs args)
{
Assert.IsNotNull(args, "args != null");
FileFinder finder = new FileFinder(args.FileDirectory);
args.FoundFiles = finder.FindLogFiles(args.StartDateTime, args.EndDateTime);
}
}
} | mit | C# |
fb6e76a3bd4ab042852294d51c768d0d6c5b01be | Update home page text | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | BatteryCommander.Web/Views/Home/Index.cshtml | BatteryCommander.Web/Views/Home/Index.cshtml | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>Battery Commander</h1>
<p class="lead">Battery Commander is a simple web application for managing a training event and battle roster for small units/teams.</p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Soldiers</h2>
<p>
Easy to use soldier information management and communication tools allow
commanders and leaders to see just the info they need when they need it.
</p>
</div>
<div class="col-md-4">
<h2>Qualifications and Events</h2>
<p>Track progress on qualifications and events for your team as they complete assigned tasks.</p>
</div>
<div class="col-md-4">
<h2>Battle Roster</h2>
<p>See the status of your team and qualifications at a glance, available as an Excel export for easy offline viewing.</p>
</div>
</div> | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a></p>
</div>
</div> | mit | C# |
5ce16a943705bb87227728ef07730c5b23460088 | Update AssemblyInfo | phillipsj/Cake.XdtTransform | Cake.XdtTransform/Properties/AssemblyInfo.cs | Cake.XdtTransform/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("Cake.XdtTransform")]
[assembly: AssemblyDescription("Helper to perform XDT based config file transforms.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jamie Phillips")]
[assembly: AssemblyProduct("Cake.XdtTransform")]
[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("533d0e04-d306-4427-ba0e-29fac90a6867")]
// 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.9.0.0")]
[assembly: AssemblyFileVersion("0.9.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("Cake.XdtTransform")]
[assembly: AssemblyDescription("Helper to perform XDT based config file transforms.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cake.XdtTransform")]
[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("533d0e04-d306-4427-ba0e-29fac90a6867")]
// 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.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
| mit | C# |
d028119cf799e0f7007850b3a811613696b158bd | Fix potential fullscreen checking error | danielchalmers/DesktopWidgets | DesktopWidgets/Helpers/FullScreenHelper.cs | DesktopWidgets/Helpers/FullScreenHelper.cs | using System.Linq;
using System.Windows;
using System.Windows.Forms;
using DesktopWidgets.Classes;
namespace DesktopWidgets.Helpers
{
internal static class FullScreenHelper
{
private static bool DoesMonitorHaveFullscreenApp(Screen screen) => Win32Helper.GetForegroundApp()
.IsFullScreen(screen);
private static bool DoesMonitorHaveFullscreenApp(Screen screen, Win32App ignoreApp)
{
var foregroundApp = Win32Helper.GetForegroundApp();
return foregroundApp.Hwnd != ignoreApp?.Hwnd && foregroundApp.IsFullScreen(screen);
}
public static bool DoesMonitorHaveFullscreenApp(Rect bounds)
=> DoesMonitorHaveFullscreenApp(ScreenHelper.GetScreen(bounds));
public static bool DoesMonitorHaveFullscreenApp(Rect bounds, Win32App ignoreApp)
=> DoesMonitorHaveFullscreenApp(ScreenHelper.GetScreen(bounds), ignoreApp);
public static bool DoesAnyMonitorHaveFullscreenApp() => Screen.AllScreens.Any(DoesMonitorHaveFullscreenApp);
}
} | using System.Linq;
using System.Windows;
using System.Windows.Forms;
using DesktopWidgets.Classes;
namespace DesktopWidgets.Helpers
{
internal static class FullScreenHelper
{
private static bool DoesMonitorHaveFullscreenApp(Screen screen) => Win32Helper.GetForegroundApp()
.IsFullScreen(screen);
private static bool DoesMonitorHaveFullscreenApp(Screen screen, Win32App ignoreApp)
{
var foregroundApp = Win32Helper.GetForegroundApp();
return foregroundApp.Hwnd != ignoreApp.Hwnd && foregroundApp.IsFullScreen(screen);
}
public static bool DoesMonitorHaveFullscreenApp(Rect bounds)
=> DoesMonitorHaveFullscreenApp(ScreenHelper.GetScreen(bounds));
public static bool DoesMonitorHaveFullscreenApp(Rect bounds, Win32App ignoreApp)
=> DoesMonitorHaveFullscreenApp(ScreenHelper.GetScreen(bounds), ignoreApp);
public static bool DoesAnyMonitorHaveFullscreenApp() => Screen.AllScreens.Any(DoesMonitorHaveFullscreenApp);
}
} | apache-2.0 | C# |
b223f66033a120c91c933f557bf9b9ac0f0a9be7 | Update IConsoleService.cs | tiksn/TIKSN-Framework | TIKSN.Core/Shell/IConsoleService.cs | TIKSN.Core/Shell/IConsoleService.cs | using System;
using System.Collections.Generic;
using System.Security;
using System.Threading;
namespace TIKSN.Shell
{
public interface IConsoleService
{
string ReadLine(string promptMessage, ConsoleColor promptForegroundColor);
SecureString ReadPasswordLine(string promptMessage, ConsoleColor promptForegroundColor);
IDisposable RegisterCancellation(CancellationTokenSource cancellationTokenSource);
int UserPrompt(string message, params string[] options);
void WriteError(string errorMessage);
void WriteObject<T>(T value);
void WriteObjects<T>(IEnumerable<T> values);
}
}
| using System;
using System.Collections.Generic;
using System.Security;
using System.Threading;
namespace TIKSN.Shell
{
public interface IConsoleService
{
string ReadLine(string promptMessage, ConsoleColor promptForegroundColor);
SecureString ReadPasswordLine(string promptMessage, ConsoleColor promptForegroundColor);
IDisposable RegisterCancellation(CancellationTokenSource cancellationTokenSource);
int UserPrompt(string message, params string[] options);
void WriteError(string errorMessage);
void WriteObject<T>(T value);
void WriteObjects<T>(IEnumerable<T> values);
}
} | mit | C# |
c0cab96b88698ed294cbe8133c061654ed396b58 | Bump v1.0.22 | karronoli/tiny-sato | TinySato/Properties/AssemblyInfo.cs | TinySato/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("TinySato")]
[assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TinySato")]
[assembly: AssemblyCopyright("Copyright 2016 karronoli")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
[assembly: AssemblyVersion("1.0.22.*")]
[assembly: AssemblyFileVersion("1.0.22")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("TinySato")]
[assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TinySato")]
[assembly: AssemblyCopyright("Copyright 2016 karronoli")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
[assembly: AssemblyVersion("1.0.21.*")]
[assembly: AssemblyFileVersion("1.0.21")]
| apache-2.0 | C# |
d339fae39d46e16751cbf946ba09ba1751cd72d9 | Rename test appropriately | RossLieberman/NEST,adam-mccoy/elasticsearch-net,CSGOpenSource/elasticsearch-net,CSGOpenSource/elasticsearch-net,cstlaurent/elasticsearch-net,TheFireCookie/elasticsearch-net,KodrAus/elasticsearch-net,TheFireCookie/elasticsearch-net,elastic/elasticsearch-net,cstlaurent/elasticsearch-net,UdiBen/elasticsearch-net,KodrAus/elasticsearch-net,UdiBen/elasticsearch-net,azubanov/elasticsearch-net,elastic/elasticsearch-net,adam-mccoy/elasticsearch-net,TheFireCookie/elasticsearch-net,RossLieberman/NEST,azubanov/elasticsearch-net,UdiBen/elasticsearch-net,RossLieberman/NEST,adam-mccoy/elasticsearch-net,KodrAus/elasticsearch-net,azubanov/elasticsearch-net,cstlaurent/elasticsearch-net,CSGOpenSource/elasticsearch-net | src/Tests/ClientConcepts/ConnectionPooling/RequestOverrides/RespectsForceNode.cs | src/Tests/ClientConcepts/ConnectionPooling/RequestOverrides/RespectsForceNode.cs | using System;
using System.Threading.Tasks;
using Elasticsearch.Net;
using Tests.Framework;
using static Elasticsearch.Net.AuditEvent;
namespace Tests.ClientConcepts.ConnectionPooling.RequestOverrides
{
public class RespectsForceNode
{
/** == Forcing nodes
* Sometimes you might want to fire a single request to a specific node. You can do so using the `ForceNode`
* request configuration. This will ignore the pool and not retry.
*/
[U] public async Task OnlyCallsForcedNode()
{
var audit = new Auditor(() => Framework.Cluster
.Nodes(10)
.ClientCalls(r => r.SucceedAlways())
.ClientCalls(r => r.OnPort(9220).FailAlways())
.StaticConnectionPool()
.Settings(s => s.DisablePing())
);
audit = await audit.TraceCall(
new ClientCall(r=>r.ForceNode(new Uri("http://localhost:9220"))) {
{ BadResponse, 9220 }
}
);
}
}
}
| using System;
using System.Threading.Tasks;
using Elasticsearch.Net;
using Tests.Framework;
using static Elasticsearch.Net.AuditEvent;
namespace Tests.ClientConcepts.ConnectionPooling.RequestOverrides
{
public class RespectsForceNode
{
/** == Forcing nodes
* Sometimes you might want to fire a single request to a specific node. You can do so using the `ForceNode`
* request configuration. This will ignore the pool and not retry.
*/
[U] public async Task DefaultMaxIsNumberOfNodes()
{
var audit = new Auditor(() => Framework.Cluster
.Nodes(10)
.ClientCalls(r => r.SucceedAlways())
.ClientCalls(r => r.OnPort(9220).FailAlways())
.StaticConnectionPool()
.Settings(s => s.DisablePing())
);
audit = await audit.TraceCall(
new ClientCall(r=>r.ForceNode(new Uri("http://localhost:9220"))) {
{ BadResponse, 9220 }
}
);
}
}
}
| apache-2.0 | C# |
d25c47be2212bc630c5917d9f3fce09fe5d51345 | Update Extensions.cs | dkapellusch/W-Maze-Application | W_Maze_Gui/W_Maze_Gui/Extensions.cs | W_Maze_Gui/W_Maze_Gui/Extensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace W_Maze_Gui
{
static class Extensions
{
public static byte[] ToBytes(this string message)
{
return Encoding.UTF8.GetBytes(message);
}
public static string EnumerableToString<T>(this IEnumerable<T> message)
{
return string.join("",message);
}
public static string ToAnsii(this byte[] byteMessage)
{
return Encoding.Default.GetString(byteMessage);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace W_Maze_Gui
{
static class Extensions
{
public static byte[] ToBytes(this string message)
{
return Encoding.UTF8.GetBytes(message);
}
public static string EnumerableToString<T>(this IEnumerable<T> message)
{
return string.join(", ",message);
}
public static string ToAnsii(this byte[] byteMessage)
{
return Encoding.Default.GetString(byteMessage);
}
}
}
| mit | C# |
d8461b900aa5db745e11de8eb97e21dee14bd991 | Build and publish nuget package | RockFramework/Rock.Encryption | Rock.Encryption/Properties/AssemblyInfo.cs | Rock.Encryption/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("Rock.Encryption")]
[assembly: AssemblyDescription("An easy-to-use crypto API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Encryption")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a4476f1b-671a-43d1-8bdb-5a275ef62995")]
// 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.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0")]
[assembly: AssemblyInformationalVersion("0.9.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("Rock.Encryption")]
[assembly: AssemblyDescription("An easy-to-use crypto API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Encryption")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a4476f1b-671a-43d1-8bdb-5a275ef62995")]
// 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.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0")]
[assembly: AssemblyInformationalVersion("0.9.0-rc3")]
| mit | C# |
9dd4ef129e1e0769ec87308b10ede3dadb53f074 | add analytics to heartbeat smoke tests | AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud | src/server/Adaptive.ReactiveTrader.Server.IntegrationTests/HeartbeatSmokeTests.cs | src/server/Adaptive.ReactiveTrader.Server.IntegrationTests/HeartbeatSmokeTests.cs | using System;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using Adaptive.ReactiveTrader.Common;
using Xunit;
namespace Adaptive.ReactiveTrader.Server.IntegrationTests
{
public class HeartbeatSmokeTests
{
private readonly TestBroker _broker;
public HeartbeatSmokeTests()
{
_broker = new TestBroker();
}
[Theory]
[InlineData(ServiceTypes.Reference)]
[InlineData(ServiceTypes.Pricing)]
[InlineData(ServiceTypes.Execution)]
[InlineData(ServiceTypes.Blotter)]
[InlineData(ServiceTypes.Analytics)]
public async void ShouldReceiveHeartbeatForServices(string serviceType)
{
var channel = await _broker.OpenChannel();
var heartbeat = await channel.RealmProxy.Services.GetSubject<dynamic>("status")
.Where(hb => hb.Type == serviceType)
.Timeout(TimeSpan.FromSeconds(2))
.Take(1)
.ToTask();
Assert.NotNull(heartbeat);
}
}
}
| using System;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using Adaptive.ReactiveTrader.Common;
using Xunit;
namespace Adaptive.ReactiveTrader.Server.IntegrationTests
{
public class HeartbeatSmokeTests
{
private readonly TestBroker _broker;
public HeartbeatSmokeTests()
{
_broker = new TestBroker();
}
[Theory]
[InlineData(ServiceTypes.Reference)]
[InlineData(ServiceTypes.Pricing)]
[InlineData(ServiceTypes.Execution)]
[InlineData(ServiceTypes.Blotter)]
public async void ShouldReceiveHeartbeatForServices(string serviceType)
{
var channel = await _broker.OpenChannel();
var heartbeat = await channel.RealmProxy.Services.GetSubject<dynamic>("status")
.Where(hb => hb.Type == serviceType)
.Timeout(TimeSpan.FromSeconds(2))
.Take(1)
.ToTask();
Assert.NotNull(heartbeat);
}
}
}
| apache-2.0 | C# |
b270e4ae22bee7005c1a9d26f6d5309a82b4ff67 | Revert "Fix mono compilation error" | k-t/SharpHaven | SharpHaven.Common/Resources/ResourceRef.cs | SharpHaven.Common/Resources/ResourceRef.cs | using System;
namespace SharpHaven.Resources
{
public struct ResourceRef
{
public ResourceRef(string name, ushort version)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
Name = name;
Version = version;
}
public string Name { get; }
public ushort Version { get; }
public override int GetHashCode()
{
return Name.GetHashCode() ^ Version.GetHashCode();
}
public override bool Equals(object obj)
{
if (!(obj is ResourceRef))
return false;
var other = (ResourceRef)obj;
return string.Equals(Name, other.Name) && Version == other.Version;
}
}
}
| using System;
namespace SharpHaven.Resources
{
public struct ResourceRef
{
public ResourceRef(string name, ushort version)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
this.Name = name;
this.Version = version;
}
public string Name { get; }
public ushort Version { get; }
public override int GetHashCode()
{
return Name.GetHashCode() ^ Version.GetHashCode();
}
public override bool Equals(object obj)
{
if (!(obj is ResourceRef))
return false;
var other = (ResourceRef)obj;
return string.Equals(Name, other.Name) && Version == other.Version;
}
}
}
| mit | C# |
a22dc7beb69c9fb58d284770773266134ed9edfc | Revise bullet spacing | mmoening/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,mmoening/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl | Utilities/MarkdigAgg/AggParagraphRenderer.cs | Utilities/MarkdigAgg/AggParagraphRenderer.cs | // Copyright (c) 2016-2017 Nicolas Musset. All rights reserved.
// This file is licensed under the MIT license.
// See the LICENSE.md file in the project root for more information.
using Markdig.Syntax;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
namespace Markdig.Renderers.Agg
{
public class AutoFit : GuiWidget
{
public AutoFit()
{
this.HAnchor = HAnchor.Fit | HAnchor.Left;
this.VAnchor = VAnchor.Fit;
}
}
public class ParagraphX : FlowLeftRightWithWrapping
{
}
//public class ParagraphRenderer :
public class AggParagraphRenderer : AggObjectRenderer<ParagraphBlock>
{
/// <inheritdoc/>
protected override void Write(AggRenderer renderer, ParagraphBlock obj)
{
var paragraph = new ParagraphX()
{
RowMargin = 0,
RowPadding = 3
};
renderer.Push(paragraph);
renderer.WriteLeafInline(obj);
renderer.Pop();
}
}
}
| // Copyright (c) 2016-2017 Nicolas Musset. All rights reserved.
// This file is licensed under the MIT license.
// See the LICENSE.md file in the project root for more information.
using Markdig.Syntax;
using MatterHackers.Agg.UI;
namespace Markdig.Renderers.Agg
{
public class AutoFit : GuiWidget
{
public AutoFit()
{
this.HAnchor = HAnchor.Fit | HAnchor.Left;
this.VAnchor = VAnchor.Fit;
}
}
public class ParagraphX : FlowLeftRightWithWrapping
{
}
//public class ParagraphRenderer :
public class AggParagraphRenderer : AggObjectRenderer<ParagraphBlock>
{
/// <inheritdoc/>
protected override void Write(AggRenderer renderer, ParagraphBlock obj)
{
var paragraph = new ParagraphX();
renderer.Push(paragraph);
renderer.WriteLeafInline(obj);
renderer.Pop();
}
}
}
| bsd-2-clause | C# |
94bfad0783177d0eec05dc02796e33b1a29dbe56 | Add comment for R# additional file layout pattern | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/resharper-unity/src/Unity/CSharp/Psi/CodeStyle/AdditionalFileLayoutPatternProvider.cs | resharper/resharper-unity/src/Unity/CSharp/Psi/CodeStyle/AdditionalFileLayoutPatternProvider.cs | using System;
using JetBrains.Application;
using JetBrains.Application.Settings;
using JetBrains.ReSharper.Feature.Services.CSharp.FileLayout;
using JetBrains.ReSharper.Plugins.Unity.ProjectModel;
using JetBrains.ReSharper.Psi.CSharp.CodeStyle;
using JetBrains.ReSharper.Psi.CSharp.Impl.CodeStyle.MemberReordering;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.Util.Logging;
namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Psi.CodeStyle
{
[ShellComponent]
public class AdditionalFileLayoutPatternProvider : IAdditionalCSharpFileLayoutPatternProvider
{
public Patterns GetPattern(IContextBoundSettingsStore store, ICSharpTypeAndNamespaceHolderDeclaration declaration)
{
if (!declaration.GetSolution().HasUnityReference())
return null;
// TODO: This doesn't work with ReSharper - the resources haven't been added
// If we add them, how do we edit them?
try
{
var pattern = store.GetValue((AdditionalFileLayoutSettings s) => s.Pattern);
return FileLayoutUtil.ParseFileLayoutPattern(pattern);
}
catch (Exception ex)
{
Logger.LogException(ex);
return null;
}
}
}
} | using System;
using JetBrains.Application;
using JetBrains.Application.Settings;
using JetBrains.ReSharper.Feature.Services.CSharp.FileLayout;
using JetBrains.ReSharper.Plugins.Unity.ProjectModel;
using JetBrains.ReSharper.Psi.CSharp.CodeStyle;
using JetBrains.ReSharper.Psi.CSharp.Impl.CodeStyle.MemberReordering;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.Util.Logging;
namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Psi.CodeStyle
{
[ShellComponent]
public class AdditionalFileLayoutPatternProvider : IAdditionalCSharpFileLayoutPatternProvider
{
public Patterns GetPattern(IContextBoundSettingsStore store, ICSharpTypeAndNamespaceHolderDeclaration declaration)
{
if (!declaration.GetSolution().HasUnityReference())
return null;
try
{
var pattern = store.GetValue((AdditionalFileLayoutSettings s) => s.Pattern);
return FileLayoutUtil.ParseFileLayoutPattern(pattern);
}
catch (Exception ex)
{
Logger.LogException(ex);
return null;
}
}
}
} | apache-2.0 | C# |
fba8da5ef6027dc7ee2544c0d4cda864da87977b | Adjust namespace | StefanoFiumara/Harry-Potter-Unity | Assets/Scripts/HarryPotterUnity/Cards/Generic/PlayRequirements/InputRequirement.cs | Assets/Scripts/HarryPotterUnity/Cards/Generic/PlayRequirements/InputRequirement.cs | using HarryPotterUnity.Cards.Generic.Interfaces;
using HarryPotterUnity.Game;
using JetBrains.Annotations;
using UnityEngine;
namespace HarryPotterUnity.Cards.Generic.PlayRequirements
{
[UsedImplicitly]
public class InputRequirement : MonoBehaviour, ICardPlayRequirement
{
private GenericCard _cardInfo;
[SerializeField, UsedImplicitly]
private int _inputRequired;
public int InputRequired { get { return _inputRequired; } }
[UsedImplicitly]
void Awake()
{
_cardInfo = GetComponent<GenericCard>();
if (GetComponent<InputGatherer>() == null)
{
gameObject.AddComponent<InputGatherer>();
}
}
public bool MeetsRequirement()
{
return _cardInfo.GetValidTargets().Count >= _inputRequired;
}
public void OnRequirementMet() { }
}
}
| using HarryPotterUnity.Cards.Generic.Interfaces;
using JetBrains.Annotations;
using UnityEngine;
namespace HarryPotterUnity.Cards.Generic.PlayRequirements
{
[UsedImplicitly]
public class InputRequirement : MonoBehaviour, ICardPlayRequirement
{
private GenericCard _cardInfo;
[SerializeField, UsedImplicitly]
private int _inputRequired;
public int InputRequired { get { return _inputRequired; } }
[UsedImplicitly]
void Awake()
{
_cardInfo = GetComponent<GenericCard>();
if (GetComponent<InputGatherer>() == null)
{
gameObject.AddComponent<InputGatherer>();
}
}
public bool MeetsRequirement()
{
return _cardInfo.GetValidTargets().Count >= _inputRequired;
}
public void OnRequirementMet() { }
}
}
| mit | C# |
390a8aee55f0986771d694333792ce6826d72c3b | Add todo reminder | mattgwagner/alert-roster | alert-roster.web/Models/SMSSender.cs | alert-roster.web/Models/SMSSender.cs | using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using Twilio;
namespace alert_roster.web.Models
{
public class SMSSender
{
public static String PhoneNumber = ConfigurationManager.AppSettings["Twilio.PhoneNumber"];
public static String AccountSid = ConfigurationManager.AppSettings["Twilio.AccountSid"];
public static String AuthToken = ConfigurationManager.AppSettings["Twilio.AuthToken"];
public void Send(String content)
{
var twilio = new TwilioRestClient(AccountSid, AuthToken);
using (var db = new AlertRosterDbContext())
{
var recipients = from u in db.Users
where u.SMSEnabled
select u.PhoneNumber;
foreach (var recipient in recipients)
{
// TODO Handle errors, notify admin on bad #s
twilio.SendSmsMessage(PhoneNumber, recipient, content);
}
}
}
}
} | using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using Twilio;
namespace alert_roster.web.Models
{
public class SMSSender
{
public static String PhoneNumber = ConfigurationManager.AppSettings["Twilio.PhoneNumber"];
public static String AccountSid = ConfigurationManager.AppSettings["Twilio.AccountSid"];
public static String AuthToken = ConfigurationManager.AppSettings["Twilio.AuthToken"];
public void Send(String content)
{
var twilio = new TwilioRestClient(AccountSid, AuthToken);
using (var db = new AlertRosterDbContext())
{
var recipients = from u in db.Users
where u.SMSEnabled
select u.PhoneNumber;
foreach (var recipient in recipients)
{
twilio.SendSmsMessage(PhoneNumber, recipient, content);
}
}
}
}
} | mit | C# |
479b4788020b55293e09862cbb2b12be39483c22 | Update Router.cs | phonicmouse/SharpPaste,phonicmouse/SharpPaste | Routers/Router.cs | Routers/Router.cs | /*
* Created by SharpDevelop.
* User: Phonic Mouse
* Date: 01/08/2016
* Time: 19:36
*/
using System;
using System.Linq;
using System.Text;
using LiteDB;
using MlkPwgen;
using Nancy;
using Newtonsoft.Json;
namespace SharpPaste
{
public class Router : NancyModule
{
public Router()
{
Get["/"] = _ => View["index"];
Get["/paste/{longId}"] = parameters => {
string longId = parameters.longId;
using(var db = new LiteDatabase(Config.DBPATH))
{
var result = db.GetCollection<Paste>("pastes").FindOne(Query.EQ("LongId", longId));
return View["paste", result];
}
};
Get["/paste/{longId}/raw"] = parameters => {
string longId = parameters.longId;
using(var db = new LiteDatabase(Config.DBPATH))
{
var result = db.GetCollection<Paste>("pastes").FindOne(Query.EQ("LongId", longId));
var encodedBytes = Convert.FromBase64String(result.Body);
var decodedString = Encoding.UTF8.GetString(encodedBytes);
return decodedString;
}
};
//Get["/paste/list"] = _ => {
// using(var db = new LiteDatabase(Config.DBPATH))
// {
// var list = db.GetCollection<Paste>("pastes").FindAll().ToArray();
// var jsonList = JsonConvert.SerializeObject(list);
//
// return jsonList;
// }
//};
Post["/paste/add"] = _ => {
var body = this.Request.Body;
int length = (int) body.Length;
var data = new byte[length];
body.Read(data, 0, length);
var decodedPaste = JsonConvert.DeserializeObject<Paste>(Encoding.Default.GetString(data));
string longId = PasswordGenerator.Generate(Config.TOKENLENGTH);
using(var db = new LiteDatabase(Config.DBPATH))
{
var pastes = db.GetCollection<Paste>("pastes");
var paste = new Paste
{
LongId = longId,
Title = decodedPaste.Title,
Body = decodedPaste.Body,
Language = decodedPaste.Language
};
pastes.Insert(paste);
}
return longId;
};
Post["/paste/delete"] = _ => {
return 0; // WIP
};
}
}
}
| /*
* Created by SharpDevelop.
* User: Phonic Mouse
* Date: 01/08/2016
* Time: 19:36
*/
using System;
using System.Linq;
using System.Text;
using LiteDB;
using MlkPwgen;
using Nancy;
using Newtonsoft.Json;
namespace SharpPaste
{
public class Router : NancyModule
{
public Router()
{
Get["/"] = _ => View["index"];
Get["/paste/{longId}"] = parameters => {
string longId = parameters.longId;
using(var db = new LiteDatabase(Config.DBPATH))
{
var result = db.GetCollection<Paste>("pastes").FindOne(Query.EQ("LongId", longId));
return View["paste", result];
}
};
Get["/paste/{longId}/raw"] = parameters => {
string longId = parameters.longId;
using(var db = new LiteDatabase(Config.DBPATH))
{
var result = db.GetCollection<Paste>("pastes").FindOne(Query.EQ("LongId", longId));
var encodedBytes = Convert.FromBase64String(result.Body);
var decodedString = Encoding.UTF8.GetString(encodedBytes);
return decodedString;
}
};
Get["/paste/list"] = _ => {
using(var db = new LiteDatabase(Config.DBPATH))
{
var list = db.GetCollection<Paste>("pastes").FindAll().ToArray();
var jsonList = JsonConvert.SerializeObject(list);
return jsonList;
}
};
Post["/paste/add"] = _ => {
var body = this.Request.Body;
int length = (int) body.Length;
var data = new byte[length];
body.Read(data, 0, length);
var decodedPaste = JsonConvert.DeserializeObject<Paste>(Encoding.Default.GetString(data));
string longId = PasswordGenerator.Generate(Config.TOKENLENGTH);
using(var db = new LiteDatabase(Config.DBPATH))
{
var pastes = db.GetCollection<Paste>("pastes");
var paste = new Paste
{
LongId = longId,
Title = decodedPaste.Title,
Body = decodedPaste.Body,
Language = decodedPaste.Language
};
pastes.Insert(paste);
}
return longId;
};
Post["/paste/delete"] = _ => {
return 0; // WIP
};
}
}
}
| mit | C# |
541c3f7415a1fc3e55337cdf63c08f6b9091907f | Fix encoding fallback | nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke | source/Nuke.Common/IO/TextTasks.cs | source/Nuke.Common/IO/TextTasks.cs | // Copyright Matthias Koch, Sebastian Karasek 2018.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using JetBrains.Annotations;
namespace Nuke.Common.IO
{
[PublicAPI]
public static class TextTasks
{
public static UTF8Encoding UTF8NoBom => new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
public static void WriteAllLines(string path, IEnumerable<string> lines, Encoding encoding = null)
{
WriteAllLines(path, lines.ToArray(), encoding);
}
public static void WriteAllLines(string path, string[] lines, Encoding encoding = null)
{
FileSystemTasks.EnsureExistingParentDirectory(path);
File.WriteAllLines(path, lines, encoding ?? UTF8NoBom);
}
public static void WriteAllText(string path, string content, Encoding encoding = null)
{
FileSystemTasks.EnsureExistingParentDirectory(path);
File.WriteAllText(path, content, encoding ?? UTF8NoBom);
}
public static void WriteAllBytes(string path, byte[] bytes)
{
FileSystemTasks.EnsureExistingParentDirectory(path);
File.WriteAllBytes(path, bytes);
}
public static string ReadAllText(string path, Encoding encoding = null)
{
return File.ReadAllText(path, encoding ?? Encoding.UTF8);
}
public static string[] ReadAllLines(string path, Encoding encoding = null)
{
return File.ReadAllLines(path, encoding ?? Encoding.UTF8);
}
public static byte[] ReadAllBytes(string path)
{
return File.ReadAllBytes(path);
}
}
}
| // Copyright Matthias Koch, Sebastian Karasek 2018.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using JetBrains.Annotations;
namespace Nuke.Common.IO
{
[PublicAPI]
public static class TextTasks
{
public static UTF8Encoding UTF8NoBom => new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
public static void WriteAllLines(string path, IEnumerable<string> lines, Encoding encoding = null)
{
WriteAllLines(path, lines.ToArray(), encoding);
}
public static void WriteAllLines(string path, string[] lines, Encoding encoding = null)
{
FileSystemTasks.EnsureExistingParentDirectory(path);
File.WriteAllLines(path, lines, encoding);
}
public static void WriteAllText(string path, string content, Encoding encoding = null)
{
FileSystemTasks.EnsureExistingParentDirectory(path);
File.WriteAllText(path, content, encoding ?? UTF8NoBom);
}
public static void WriteAllBytes(string path, byte[] bytes)
{
FileSystemTasks.EnsureExistingParentDirectory(path);
File.WriteAllBytes(path, bytes);
}
public static string ReadAllText(string path, Encoding encoding = null)
{
return File.ReadAllText(path, encoding ?? Encoding.UTF8);
}
public static string[] ReadAllLines(string path, Encoding encoding = null)
{
return File.ReadAllLines(path, encoding ?? Encoding.UTF8);
}
public static byte[] ReadAllBytes(string path)
{
return File.ReadAllBytes(path);
}
}
}
| mit | C# |
002de80c30b2f65eb842e8089382ac74cf2e1964 | Add xmldoc to ISkin | 2yangk23/osu,smoogipoo/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,ZLima12/osu,johnneijzen/osu,smoogipooo/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,ZLima12/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,EVAST9919/osu,peppy/osu,peppy/osu-new,2yangk23/osu,johnneijzen/osu,UselessToucan/osu,EVAST9919/osu,ppy/osu,peppy/osu | osu.Game/Skinning/ISkin.cs | osu.Game/Skinning/ISkin.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using JetBrains.Annotations;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Game.Audio;
namespace osu.Game.Skinning
{
/// <summary>
/// Provides access to skinnable elements.
/// </summary>
public interface ISkin
{
/// <summary>
/// Retrieve a <see cref="Drawable"/> component implementation.
/// </summary>
/// <param name="component">The requested component.</param>
/// <returns>A drawable representation for the requested component, or null if unavailable.</returns>
[CanBeNull]
Drawable GetDrawableComponent(ISkinComponent component);
/// <summary>
/// Retrieve a <see cref="Texture"/>.
/// </summary>
/// <param name="componentName">The requested texture.</param>
/// <returns>A matching texture, or null if unavailable.</returns>
[CanBeNull]
Texture GetTexture(string componentName);
/// <summary>
/// Retrieve a <see cref="SampleChannel"/>.
/// </summary>
/// <param name="sampleInfo">The requested sample.</param>
/// <returns>A matching sample channel, or null if unavailable.</returns>
[CanBeNull]
SampleChannel GetSample(ISampleInfo sampleInfo);
/// <summary>
/// Retrieve a configuration value.
/// </summary>
/// <param name="lookup">The requested configuration value.</param>
/// <returns>A matching value boxed in an <see cref="IBindable{TValue}"/>, or null if unavailable.</returns>
[CanBeNull]
IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup);
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Game.Audio;
namespace osu.Game.Skinning
{
/// <summary>
/// Provides access to skinnable elements.
/// </summary>
public interface ISkin
{
Drawable GetDrawableComponent(ISkinComponent component);
Texture GetTexture(string componentName);
SampleChannel GetSample(ISampleInfo sampleInfo);
IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup);
}
}
| mit | C# |
647aa345f7547f66c19cf7ece10cba5e08d17218 | Remove test that is checked by analyzer. | JohanLarsson/Gu.Wpf.Geometry | Gu.Wpf.Geometry.Tests/NamespacesTests.cs | Gu.Wpf.Geometry.Tests/NamespacesTests.cs | namespace Gu.Wpf.Geometry.Tests
{
using System;
using System.Linq;
using System.Reflection;
using System.Windows.Markup;
using NUnit.Framework;
public class NamespacesTests
{
private const string Uri = "http://gu.se/Geometry";
private readonly Assembly assembly;
public NamespacesTests()
{
this.assembly = typeof(GradientPath).Assembly;
}
[Test]
public void XmlnsPrefix()
{
var attributes = this.assembly.CustomAttributes.Where(x => x.AttributeType == typeof(XmlnsPrefixAttribute));
foreach (var attribute in attributes)
{
Assert.AreEqual(Uri, attribute.ConstructorArguments[0].Value);
}
}
}
}
| namespace Gu.Wpf.Geometry.Tests
{
using System;
using System.Linq;
using System.Reflection;
using System.Windows.Markup;
using NUnit.Framework;
public class NamespacesTests
{
private const string Uri = "http://gu.se/Geometry";
private readonly Assembly assembly;
public NamespacesTests()
{
this.assembly = typeof(GradientPath).Assembly;
}
[Test]
public void XmlnsDefinitions()
{
string[] skip = { ".Annotations", ".Properties", "XamlGeneratedNamespace" };
var strings = this.assembly.GetTypes()
.Select(x => x.Namespace)
.Distinct()
.Where(x => x != null && !skip.Any(x.EndsWith))
.OrderBy(x => x)
.ToArray();
var attributes = this.assembly.CustomAttributes.Where(x => x.AttributeType == typeof(XmlnsDefinitionAttribute))
.ToArray();
var actuals = attributes.Select(a => a.ConstructorArguments[1].Value)
.OrderBy(x => x);
foreach (var s in strings)
{
Console.WriteLine(@"[assembly: XmlnsDefinition(""{0}"", ""{1}"")]", Uri, s);
}
Assert.AreEqual(strings, actuals);
foreach (var attribute in attributes)
{
Assert.AreEqual(Uri, attribute.ConstructorArguments[0].Value);
}
}
[Test]
public void XmlnsPrefix()
{
var attributes = this.assembly.CustomAttributes.Where(x => x.AttributeType == typeof(XmlnsPrefixAttribute));
foreach (var attribute in attributes)
{
Assert.AreEqual(Uri, attribute.ConstructorArguments[0].Value);
}
}
}
}
| mit | C# |
a65905bf1ccef23646ed9af883e813f94d9a8a88 | Use nameof for argumentnullexception | FoundatioFx/Foundatio | src/Foundatio/Messaging/Message.cs | src/Foundatio/Messaging/Message.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Foundatio.Messaging {
public interface IMessage {
string Type { get; }
Type ClrType { get; }
byte[] Data { get; }
object GetBody();
IReadOnlyDictionary<string, string> Properties { get; }
}
[DebuggerDisplay("Type: {Type}")]
public class Message : IMessage {
private readonly Lazy<object> _getBody;
public Message(Func<object> getBody) {
if (getBody == null)
throw new ArgumentNullException(nameof(getBody));
_getBody = new Lazy<object>(getBody);
}
public string Type { get; set; }
public Type ClrType { get; set; }
public byte[] Data { get; set; }
public object GetBody() => _getBody.Value;
public IReadOnlyDictionary<string, string> Properties { get; set; } = new Dictionary<string, string>();
}
} | using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Foundatio.Messaging {
public interface IMessage {
string Type { get; }
Type ClrType { get; }
byte[] Data { get; }
object GetBody();
IReadOnlyDictionary<string, string> Properties { get; }
}
[DebuggerDisplay("Type: {Type}")]
public class Message : IMessage {
private Lazy<object> _getBody;
public Message(Func<object> getBody) {
if (getBody == null)
throw new ArgumentNullException("getBody");
_getBody = new Lazy<object>(getBody);
}
public string Type { get; set; }
public Type ClrType { get; set; }
public byte[] Data { get; set; }
public object GetBody() => _getBody.Value;
public IReadOnlyDictionary<string, string> Properties { get; set; } = new Dictionary<string, string>();
}
} | apache-2.0 | C# |
91877bfb7726ddf58068f5cd07ed51e7e84a67b4 | Clean up | nikeee/HolzShots | src/HolzShots.Core/Net/UploadUI.cs | src/HolzShots.Core/Net/UploadUI.cs | using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
namespace HolzShots.Net
{
public sealed class UploadUI : IDisposable
{
private readonly IUploadPayload _payload;
private readonly Uploader _uploader;
private readonly ITransferProgressReporter? _progressReporter;
private readonly SpeedCalculatorProgress _speedCalculator = new();
public UploadUI(IUploadPayload payload, Uploader uploader, ITransferProgressReporter? progressReporter)
{
_payload = payload ?? throw new ArgumentNullException(nameof(payload));
_uploader = uploader ?? throw new ArgumentNullException(nameof(uploader));
_progressReporter = progressReporter;
}
public async Task<UploadResult> InvokeUploadAsync()
{
Debug.Assert(!_speedCalculator.HasStarted);
using var payloadStream = _payload.GetStream();
Debug.Assert(payloadStream != null);
var cts = new CancellationTokenSource();
var speed = _speedCalculator;
if (_progressReporter != null)
speed.ProgressChanged += ProgressChanged;
speed.Start();
try
{
return await _uploader.InvokeAsync(payloadStream, _payload.GetSuggestedFileName(), _payload.MimeType, speed, cts.Token).ConfigureAwait(false);
}
finally
{
speed.Stop();
if (_progressReporter != null)
speed.ProgressChanged -= ProgressChanged;
}
}
public void ShowUI() => _progressReporter?.ShowProgress();
public void HideUI() => _progressReporter?.CloseProgress();
private void ProgressChanged(object? sender, TransferProgress progress) => _progressReporter?.UpdateProgress(progress, _speedCalculator.CurrentSpeed);
public void Dispose() => _progressReporter?.Dispose();
}
}
| #nullable enable
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using HolzShots.Drawing;
namespace HolzShots.Net
{
public sealed class UploadUI : IDisposable
{
private readonly IUploadPayload _payload;
private readonly Uploader _uploader;
private readonly ITransferProgressReporter? _progressReporter;
private readonly SpeedCalculatorProgress _speedCalculator = new SpeedCalculatorProgress();
public UploadUI(IUploadPayload payload, Uploader uploader, ITransferProgressReporter? progressReporter)
{
_payload = payload ?? throw new ArgumentNullException(nameof(payload));
_uploader = uploader ?? throw new ArgumentNullException(nameof(uploader));
_progressReporter = progressReporter;
}
public async Task<UploadResult> InvokeUploadAsync()
{
Debug.Assert(!_speedCalculator.HasStarted);
using var payloadStream = _payload.GetStream();
Debug.Assert(payloadStream != null);
var cts = new CancellationTokenSource();
var speed = _speedCalculator;
if (_progressReporter != null)
speed.ProgressChanged += ProgressChanged;
speed.Start();
try
{
return await _uploader.InvokeAsync(payloadStream, _payload.GetSuggestedFileName(), _payload.MimeType, speed, cts.Token).ConfigureAwait(false);
}
finally
{
speed.Stop();
if (_progressReporter != null)
speed.ProgressChanged -= ProgressChanged;
}
}
public void ShowUI() => _progressReporter?.ShowProgress();
public void HideUI() => _progressReporter?.CloseProgress();
private void ProgressChanged(object? sender, TransferProgress progress) => _progressReporter?.UpdateProgress(progress, _speedCalculator.CurrentSpeed);
public void Dispose() => _progressReporter?.Dispose();
}
}
| agpl-3.0 | C# |
5ae6bcc007509571161c01bdf3247d78ddc71c65 | Use decimal.Parse for consistency. | mysql-net/MySqlConnector,mysql-net/MySqlConnector | src/MySqlConnector/MySqlDecimal.cs | src/MySqlConnector/MySqlDecimal.cs | using System.Globalization;
using System.Text.RegularExpressions;
using MySqlConnector.Utilities;
namespace MySqlConnector;
public readonly struct MySqlDecimal
{
public decimal Value => decimal.Parse(m_value, CultureInfo.InvariantCulture);
public double ToDouble() => double.Parse(m_value, CultureInfo.InvariantCulture);
public override string ToString() => m_value;
internal MySqlDecimal(string value)
{
if (s_pattern.Match(value) is { Success: true } match)
{
var wholeLength = match.Groups[1].Length;
var fractionLength = match.Groups[3].Value.TrimEnd('0').Length;
var isWithinLengthLimits = wholeLength + fractionLength <= 65 && fractionLength <= 30;
var isNegativeZero = value[0] == '-' && match.Groups[1].Value == "0" && fractionLength == 0;
if (isWithinLengthLimits && !isNegativeZero)
{
m_value = value;
return;
}
}
throw new FormatException("Could not parse the value as a MySqlDecimal: {0}".FormatInvariant(value));
}
private static readonly Regex s_pattern = new(@"^-?([1-9][0-9]*|0)(\.([0-9]+))?$");
private readonly string m_value;
}
| using System.Globalization;
using System.Text.RegularExpressions;
using MySqlConnector.Utilities;
namespace MySqlConnector;
public readonly struct MySqlDecimal
{
public decimal Value => Convert.ToDecimal(m_value, CultureInfo.InvariantCulture);
public double ToDouble() => double.Parse(m_value, CultureInfo.InvariantCulture);
public override string ToString() => m_value;
internal MySqlDecimal(string value)
{
if (s_pattern.Match(value) is { Success: true } match)
{
var wholeLength = match.Groups[1].Length;
var fractionLength = match.Groups[3].Value.TrimEnd('0').Length;
var isWithinLengthLimits = wholeLength + fractionLength <= 65 && fractionLength <= 30;
var isNegativeZero = value[0] == '-' && match.Groups[1].Value == "0" && fractionLength == 0;
if (isWithinLengthLimits && !isNegativeZero)
{
m_value = value;
return;
}
}
throw new FormatException("Could not parse the value as a MySqlDecimal: {0}".FormatInvariant(value));
}
private static readonly Regex s_pattern = new(@"^-?([1-9][0-9]*|0)(\.([0-9]+))?$");
private readonly string m_value;
}
| mit | C# |
dd884bc5a635e00ebe6cf43f05444045cd1c7319 | remove unused code | minhhungit/DatabaseMigrateExt | Src/DatabaseMigrateExt/MigrationUtils.cs | Src/DatabaseMigrateExt/MigrationUtils.cs | using FluentMigrator;
using System.Reflection;
namespace DatabaseMigrateExt
{
public static class Utils
{
public static void ExecuteSqlStructure(this Migration migration, string scriptFileName)
{
var appContext = (MigrateDatabaseItem)migration.ApplicationContext;
var embeddedScriptNamespace = $"{appContext.SqlArchitectureRefScriptNamespace}.{scriptFileName.Trim()}";
migration.Execute.EmbeddedScript(embeddedScriptNamespace);
}
public static void ExecuteStoredProcedure(this Migration migration, string scriptFileName)
{
var appContext = (MigrateDatabaseItem)migration.ApplicationContext;
var embeddedScriptNamespace = $"{appContext.SqlStoredRefScriptNamespace}.{scriptFileName.Trim()}";
migration.Execute.EmbeddedScript(embeddedScriptNamespace);
}
public static void ExecuteFunction(this Migration migration, string scriptFileName)
{
var appContext = (MigrateDatabaseItem)migration.ApplicationContext;
var embeddedScriptNamespace = $"{appContext.SqlFunctionRefScriptNamespace}.{scriptFileName.Trim()}";
migration.Execute.EmbeddedScript(embeddedScriptNamespace);
}
}
}
| using FluentMigrator;
using System.Reflection;
namespace DatabaseMigrateExt
{
public static class Utils
{
public static void ExecuteSqlStructure(this Migration migration, string scriptFileName)
{
var appContext = (MigrateDatabaseItem)migration.ApplicationContext;
var assembly = Assembly.GetExecutingAssembly();
var embeddedScriptNamespace = $"{appContext.SqlArchitectureRefScriptNamespace}.{scriptFileName.Trim()}";
migration.Execute.EmbeddedScript(embeddedScriptNamespace);
}
public static void ExecuteStoredProcedure(this Migration migration, string scriptFileName)
{
var appContext = (MigrateDatabaseItem)migration.ApplicationContext;
var embeddedScriptNamespace = $"{appContext.SqlStoredRefScriptNamespace}.{scriptFileName.Trim()}";
migration.Execute.EmbeddedScript(embeddedScriptNamespace);
}
public static void ExecuteFunction(this Migration migration, string scriptFileName)
{
var appContext = (MigrateDatabaseItem)migration.ApplicationContext;
var embeddedScriptNamespace = $"{appContext.SqlFunctionRefScriptNamespace}.{scriptFileName.Trim()}";
migration.Execute.EmbeddedScript(embeddedScriptNamespace);
}
}
}
| mit | C# |
8706c77440af09eb0a20cf61824806a478d2b556 | Add damage attribute to melee attacker | Endure-Game/Endure | Assets/Scripts/MeleeAttacker.cs | Assets/Scripts/MeleeAttacker.cs | using UnityEngine;
using System.Collections;
public class MeleeAttacker : MonoBehaviour {
public int damage = 3;
private GameObject weapon;
private float elapsed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (this.weapon != null) {
this.elapsed += Time.deltaTime;
if (this.elapsed > 0.1f) {
Destroy (this.weapon);
this.weapon = null;
}
}
}
private void CreateOuch (bool horizontal, int direction) {
Destroy (this.weapon);
this.elapsed = 0;
this.weapon = new GameObject ();
this.weapon.name = "meleeWeapon";
this.weapon.transform.parent = this.gameObject.transform;
this.weapon.transform.position = this.gameObject.transform.position;
BoxCollider2D collider = this.weapon.AddComponent<BoxCollider2D> ();
collider.isTrigger = true;
Vector2 playerSize = this.GetComponent<BoxCollider2D> ().size;
collider.size = playerSize;
float width = 0.6f;
if (horizontal) {
collider.size = new Vector2 (collider.size.x, width);
collider.transform.Translate (0, (playerSize.y / 2 + width / 2) * direction, 0);
} else {
collider.size = new Vector2 (width, collider.size.y);
collider.transform.Translate ((playerSize.x / 2 + width / 2) * direction, 0, 0);
}
Ouch ouch = this.weapon.AddComponent<Ouch> ();
ouch.damage = this.damage;
}
public void AttackNorth () {
CreateOuch (true, 1);
print ("Attacking north");
}
public void AttackEast () {
CreateOuch (false, 1);
print ("Attacking east");
}
public void AttackWest () {
CreateOuch (false, -1);
print ("Attacking west");
}
public void AttackSouth () {
CreateOuch (true, -1);
print ("Attacking south");
}
private IEnumerator WaitAndDestroy (float seconds, GameObject obj) {
print ("Waiting");
yield return new WaitForSeconds (seconds);
print ("Wait over");
Destroy (obj);
}
}
| using UnityEngine;
using System.Collections;
public class MeleeAttacker : MonoBehaviour {
private GameObject weapon;
private float elapsed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (this.weapon != null) {
this.elapsed += Time.deltaTime;
if (this.elapsed > 0.1f) {
Destroy (this.weapon);
this.weapon = null;
}
}
}
private void CreateOuch (bool horizontal, int direction) {
Destroy (this.weapon);
this.elapsed = 0;
this.weapon = new GameObject ();
this.weapon.name = "meleeWeapon";
this.weapon.transform.parent = this.gameObject.transform;
this.weapon.transform.position = this.gameObject.transform.position;
BoxCollider2D collider = this.weapon.AddComponent<BoxCollider2D> ();
collider.isTrigger = true;
Vector2 playerSize = this.GetComponent<BoxCollider2D> ().size;
collider.size = playerSize;
float width = 0.6f;
if (horizontal) {
collider.size = new Vector2 (collider.size.x, width);
collider.transform.Translate (0, (playerSize.y / 2 + width / 2) * direction, 0);
} else {
collider.size = new Vector2 (width, collider.size.y);
collider.transform.Translate ((playerSize.x / 2 + width / 2) * direction, 0, 0);
}
this.weapon.AddComponent<Ouch> ();
}
public void AttackNorth () {
CreateOuch (true, 1);
print ("Attacking north");
}
public void AttackEast () {
CreateOuch (false, 1);
print ("Attacking east");
}
public void AttackWest () {
CreateOuch (false, -1);
print ("Attacking west");
}
public void AttackSouth () {
CreateOuch (true, -1);
print ("Attacking south");
}
private IEnumerator WaitAndDestroy (float seconds, GameObject obj) {
print ("Waiting");
yield return new WaitForSeconds (seconds);
print ("Wait over");
Destroy (obj);
}
}
| mit | C# |
04cd68f97029ccac9ede8b8a5c0d3dd99b5e62de | Hide status pill when status is none | EVAST9919/osu,johnneijzen/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,2yangk23/osu,smoogipoo/osu,DrabWeb/osu,NeoAdonis/osu,NeoAdonis/osu,2yangk23/osu,UselessToucan/osu,DrabWeb/osu,peppy/osu,peppy/osu-new,peppy/osu,ppy/osu,peppy/osu,naoey/osu,naoey/osu,smoogipoo/osu,ZLima12/osu,johnneijzen/osu,UselessToucan/osu,DrabWeb/osu,ZLima12/osu,naoey/osu,smoogipooo/osu | osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public class BeatmapSetOnlineStatusPill : CircularContainer
{
private readonly OsuSpriteText statusText;
private BeatmapSetOnlineStatus status;
public BeatmapSetOnlineStatus Status
{
get => status;
set
{
if (status == value)
return;
status = value;
Alpha = value == BeatmapSetOnlineStatus.None ? 0 : 1;
statusText.Text = value.ToString().ToUpperInvariant();
}
}
public float TextSize
{
get => statusText.TextSize;
set => statusText.TextSize = value;
}
public MarginPadding TextPadding
{
get => statusText.Padding;
set => statusText.Padding = value;
}
public BeatmapSetOnlineStatusPill()
{
AutoSizeAxes = Axes.Both;
Masking = true;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.5f,
},
statusText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = @"Exo2.0-Bold",
},
};
Status = BeatmapSetOnlineStatus.None;
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public class BeatmapSetOnlineStatusPill : CircularContainer
{
private readonly OsuSpriteText statusText;
private BeatmapSetOnlineStatus status;
public BeatmapSetOnlineStatus Status
{
get => status;
set
{
if (status == value)
return;
status = value;
statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant();
}
}
public float TextSize
{
get => statusText.TextSize;
set => statusText.TextSize = value;
}
public MarginPadding TextPadding
{
get => statusText.Padding;
set => statusText.Padding = value;
}
public BeatmapSetOnlineStatusPill()
{
AutoSizeAxes = Axes.Both;
Masking = true;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.5f,
},
statusText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = @"Exo2.0-Bold",
},
};
Status = BeatmapSetOnlineStatus.None;
}
}
}
| mit | C# |
1c074ff0182c90f56b370d37f7511c942bedeaea | add `BlockMarkdownImage` | peppy/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu | osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs | osu.Game/Overlays/Wiki/Markdown/WikiMarkdownImageBlock.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Markdig.Syntax.Inlines;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osuTK;
namespace osu.Game.Overlays.Wiki.Markdown
{
public class WikiMarkdownImageBlock : FillFlowContainer
{
[Resolved]
private IMarkdownTextComponent parentTextComponent { get; set; }
private readonly LinkInline linkInline;
public WikiMarkdownImageBlock(LinkInline linkInline)
{
this.linkInline = linkInline;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
Spacing = new Vector2(0, 3);
}
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
new BlockMarkdownImage(linkInline),
parentTextComponent.CreateSpriteText().With(t =>
{
t.Text = linkInline.Title;
t.Anchor = Anchor.TopCentre;
t.Origin = Anchor.TopCentre;
}),
};
}
private class BlockMarkdownImage : WikiMarkdownImage
{
public BlockMarkdownImage(LinkInline linkInline)
: base(linkInline)
{
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
}
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Markdig.Syntax.Inlines;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osuTK;
namespace osu.Game.Overlays.Wiki.Markdown
{
public class WikiMarkdownImageBlock : FillFlowContainer
{
[Resolved]
private IMarkdownTextComponent parentTextComponent { get; set; }
private readonly LinkInline linkInline;
public WikiMarkdownImageBlock(LinkInline linkInline)
{
this.linkInline = linkInline;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
Spacing = new Vector2(0, 3);
}
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
new WikiMarkdownImage(linkInline)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
parentTextComponent.CreateSpriteText().With(t =>
{
t.Text = linkInline.Title;
t.Anchor = Anchor.TopCentre;
t.Origin = Anchor.TopCentre;
}),
};
}
}
}
| mit | C# |
0b6395c0e3910b5761649b0d63800cfe727308cf | Clean file | aloisdg/edx-csharp | edX/Module2/Program.cs | edX/Module2/Program.cs | using System;
namespace Module2
{
class Program
{
static void Main()
{
Print1();
Console.ReadLine();
}
static void Print1()
{
for (var i = 0; i < 8; i++)
for (var j = 0; j < 4; j++)
Console.Write((i % 2 == 0 ? "XO" : "OX")
+ (j == 3 ? Environment.NewLine : String.Empty));
}
static void Print2()
{
for (var i = 0; i < 8; i++)
for (var j = 0; j < 1; j++) // who asked fo a nested loop?
Console.WriteLine(i % 2 == 0 ? "XOXOXOXO" : "OXOXOXOX");
}
static void Print3()
{
while (false) for (;;) if (true) Console.WriteLine("loops? Where we're going, we don't need loops");
Console.Write("XOXOXOXO\n"
+ "OXOXOXOX\n"
+ "XOXOXOXO\n"
+ "OXOXOXOX\n"
+ "XOXOXOXO\n"
+ "OXOXOXOX\n"
+ "XOXOXOXO\n"
+ "OXOXOXOX");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Module2
{
class Program
{
static void Main()
{
Print1();
Console.ReadLine();
}
static void Print1()
{
for (var i = 0; i < 8; i++)
for (var j = 0; j < 4; j++)
Console.Write((i % 2 == 0 ? "XO" : "OX")
+ (j == 3 ? Environment.NewLine : String.Empty));
}
static void Print2()
{
for (var i = 0; i < 8; i++)
for (var j = 0; j < 1; j++) // who asked fo a nested loop?
Console.WriteLine(i % 2 == 0 ? "XOXOXOXO" : "OXOXOXOX");
}
static void Print3()
{
while (false) for (;;) if (true) Console.WriteLine("loops? Where we're going, we don't need loops");
Console.Write("XOXOXOXO\n"
+ "OXOXOXOX\n"
+ "XOXOXOXO\n"
+ "OXOXOXOX\n"
+ "XOXOXOXO\n"
+ "OXOXOXOX\n"
+ "XOXOXOXO\n"
+ "OXOXOXOX");
}
}
}
| mit | C# |
5d3e2c2966da22cd03d81eb8f962f84784a27e0a | Update EvgenyFedorov.cs | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/EvgenyFedorov.cs | src/Firehose.Web/Authors/EvgenyFedorov.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class EvgenyFedorov : IAmACommunityMember
{
public string FirstName => "Evgeny";
public string LastName => "Fedorov";
public string ShortBioOrTagLine => "Software Developer, DevOps Engineer, Chess Player";
public string StateOrRegion => "Prague, Czech Republic";
public string EmailAddress => "[email protected]";
public string GravatarHash => "904c3bb52fa45d319357aa06e7e15f56";
public string TwitterHandle => "yudinetz";
public string GitHubHandle => "evgenyfedorov2";
public GeoPosition Position => new GeoPosition(50.032283, 14.529762);
public Uri WebSite => new Uri("https://evgenyfedorov.com/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://evgenyfedorov.com/rss"); } }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class EvgenyFedorov : IAmACommunityMember
{
public string FirstName => "Evgeny";
public string LastName => "Fedorov";
public string ShortBioOrTagLine => "Software Developer, DevOps Engineer, Chess Player";
public string StateOrRegion => "Prague, Czech Republic";
public string EmailAddress => "[email protected]";
public string TwitterHandle => "yudinetz";
public string GitHubHandle => "evgenyfedorov2";
public GeoPosition Position => new GeoPosition(50.032283, 14.529762);
public Uri WebSite => new Uri("https://evgenyfedorov.com/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://evgenyfedorov.com/rss"); } }
}
}
| mit | C# |
74cbf9f91972fc26244bb008cf20fee432999bfd | Make test file path OS-agnostic | GMSGDataExchange/omf_csharp | OMF/Program.cs | OMF/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OMF
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string baseDir = System.AppDomain.CurrentDomain.BaseDirectory;
string file = System.IO.Path.Combine(baseDir, "..", "..", "test.omf");
if (System.IO.File.Exists(file) == false)
{
Console.WriteLine(string.Format("File '{0}' does not exist.", file));
Console.ReadLine();
return;
}
OMF torun = new OMF();
torun.Execute(file);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OMF
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string baseDir = System.AppDomain.CurrentDomain.BaseDirectory;
string file = System.IO.Path.Combine(baseDir, "..\\..\\test.omf");
if (System.IO.File.Exists(file) == false)
{
Console.WriteLine(string.Format("File '{0}' does not exist.", file));
Console.ReadLine();
return;
}
OMF torun = new OMF();
torun.Execute(file);
}
}
}
| mit | C# |
8f3b3d23e7eed318f2abbcab45e2f86e4c96553b | Update tests for TraktMovieCheckinPostResponse | henrikfroehling/TraktApiSharp | Source/Tests/TraktApiSharp.Tests/Objects/Post/Checkins/Responses/TraktMovieCheckinPostResponseTests.cs | Source/Tests/TraktApiSharp.Tests/Objects/Post/Checkins/Responses/TraktMovieCheckinPostResponseTests.cs | namespace TraktApiSharp.Tests.Objects.Post.Checkins.Responses
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using System;
using TraktApiSharp.Objects.Post.Checkins.Responses;
using Utils;
[TestClass]
public class TraktMovieCheckinPostResponseTests
{
[TestMethod]
public void TestTraktMovieCheckinPostResponseDefaultConstructor()
{
var movieCheckinResponse = new TraktMovieCheckinPostResponse();
movieCheckinResponse.Id.Should().Be(0);
movieCheckinResponse.WatchedAt.Should().NotHaveValue();
movieCheckinResponse.Sharing.Should().BeNull();
movieCheckinResponse.Movie.Should().BeNull();
}
[TestMethod]
public void TestTraktMovieCheckinPostResponseReadFromJson()
{
var jsonFile = TestUtility.ReadFileContents(@"Objects\Post\Checkins\Responses\MovieCheckinPostResponse.json");
jsonFile.Should().NotBeNullOrEmpty();
var movieCheckinResponse = JsonConvert.DeserializeObject<TraktMovieCheckinPostResponse>(jsonFile);
movieCheckinResponse.Should().NotBeNull();
movieCheckinResponse.Id.Should().Be(3373536619);
movieCheckinResponse.WatchedAt.Should().Be(DateTime.Parse("2014-08-06T01:11:37.953Z").ToUniversalTime());
movieCheckinResponse.Sharing.Should().NotBeNull();
movieCheckinResponse.Sharing.Facebook.Should().BeTrue();
movieCheckinResponse.Sharing.Twitter.Should().BeTrue();
movieCheckinResponse.Sharing.Tumblr.Should().BeFalse();
movieCheckinResponse.Movie.Should().NotBeNull();
movieCheckinResponse.Movie.Title.Should().Be("Guardians of the Galaxy");
movieCheckinResponse.Movie.Year.Should().Be(2014);
movieCheckinResponse.Movie.Ids.Should().NotBeNull();
movieCheckinResponse.Movie.Ids.Trakt.Should().Be(28U);
movieCheckinResponse.Movie.Ids.Slug.Should().Be("guardians-of-the-galaxy-2014");
movieCheckinResponse.Movie.Ids.Imdb.Should().Be("tt2015381");
movieCheckinResponse.Movie.Ids.Tmdb.Should().Be(118340U);
}
}
}
| namespace TraktApiSharp.Tests.Objects.Post.Checkins.Responses
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using System;
using TraktApiSharp.Objects.Post.Checkins.Responses;
using Utils;
[TestClass]
public class TraktMovieCheckinPostResponseTests
{
[TestMethod]
public void TestTraktMovieCheckinPostResponseDefaultConstructor()
{
var movieCheckinResponse = new TraktMovieCheckinPostResponse();
movieCheckinResponse.WatchedAt.Should().NotHaveValue();
movieCheckinResponse.Sharing.Should().BeNull();
movieCheckinResponse.Movie.Should().BeNull();
}
[TestMethod]
public void TestTraktMovieCheckinPostResponseReadFromJson()
{
var jsonFile = TestUtility.ReadFileContents(@"Objects\Post\Checkins\Responses\MovieCheckinPostResponse.json");
jsonFile.Should().NotBeNullOrEmpty();
var movieCheckinResponse = JsonConvert.DeserializeObject<TraktMovieCheckinPostResponse>(jsonFile);
movieCheckinResponse.Should().NotBeNull();
movieCheckinResponse.WatchedAt.Should().Be(DateTime.Parse("2014-08-06T01:11:37.953Z").ToUniversalTime());
movieCheckinResponse.Sharing.Should().NotBeNull();
movieCheckinResponse.Sharing.Facebook.Should().BeTrue();
movieCheckinResponse.Sharing.Twitter.Should().BeTrue();
movieCheckinResponse.Sharing.Tumblr.Should().BeFalse();
movieCheckinResponse.Movie.Should().NotBeNull();
movieCheckinResponse.Movie.Title.Should().Be("Guardians of the Galaxy");
movieCheckinResponse.Movie.Year.Should().Be(2014);
movieCheckinResponse.Movie.Ids.Should().NotBeNull();
movieCheckinResponse.Movie.Ids.Trakt.Should().Be(28U);
movieCheckinResponse.Movie.Ids.Slug.Should().Be("guardians-of-the-galaxy-2014");
movieCheckinResponse.Movie.Ids.Imdb.Should().Be("tt2015381");
movieCheckinResponse.Movie.Ids.Tmdb.Should().Be(118340U);
}
}
}
| mit | C# |
e55def9be56a66b52b4fbe6f41d41b22c181e446 | Add validation of ValueType | AspectCore/Lite,AspectCore/AspectCore-Framework,AspectCore/AspectCore-Framework,AspectCore/Abstractions | src/Reflection/src/AspectCore.Extensions.Reflection/Factories/PropertyReflector.Factory.cs | src/Reflection/src/AspectCore.Extensions.Reflection/Factories/PropertyReflector.Factory.cs | using System;
using System.Reflection;
namespace AspectCore.Extensions.Reflection
{
public partial class PropertyReflector
{
internal static PropertyReflector Create(PropertyInfo reflectionInfo, CallOptions callOption)
{
if (reflectionInfo == null)
{
throw new ArgumentNullException(nameof(reflectionInfo));
}
return ReflectorCacheUtils<Tuple<PropertyInfo, CallOptions>, PropertyReflector>.GetOrAdd(Tuple.Create(reflectionInfo, callOption), CreateInternal);
PropertyReflector CreateInternal(Tuple<PropertyInfo, CallOptions> item)
{
var property = item.Item1;
if (property.DeclaringType.GetTypeInfo().ContainsGenericParameters)
{
return new OpenGenericPropertyReflector(item.Item1);
}
if ((property.CanRead && property.GetMethod.IsStatic) || (property.CanWrite && property.SetMethod.IsStatic) || property.DeclaringType.GetTypeInfo().IsValueType)
{
return new StaticPropertyReflector(property);
}
return new PropertyReflector(property, item.Item2);
}
}
}
} | using System;
using System.Reflection;
namespace AspectCore.Extensions.Reflection
{
public partial class PropertyReflector
{
internal static PropertyReflector Create(PropertyInfo reflectionInfo, CallOptions callOption)
{
if (reflectionInfo == null)
{
throw new ArgumentNullException(nameof(reflectionInfo));
}
return ReflectorCacheUtils<Tuple<PropertyInfo, CallOptions>, PropertyReflector>.GetOrAdd(Tuple.Create(reflectionInfo, callOption), CreateInternal);
PropertyReflector CreateInternal(Tuple<PropertyInfo, CallOptions> item)
{
var property = item.Item1;
if (property.DeclaringType.GetTypeInfo().ContainsGenericParameters)
{
return new OpenGenericPropertyReflector(item.Item1);
}
if ((property.CanRead && property.GetMethod.IsStatic) || (property.CanWrite && property.SetMethod.IsStatic))
{
return new StaticPropertyReflector(property);
}
return new PropertyReflector(property, item.Item2);
}
}
}
}
| mit | C# |
74361c6e8867e5df5451342017b41037088c2bcd | fix local text prefix for entitydialog | TukekeSoft/Serenity,WasimAhmad/Serenity,WasimAhmad/Serenity,WasimAhmad/Serenity,TukekeSoft/Serenity,linpiero/Serenity,rolembergfilho/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,linpiero/Serenity,rolembergfilho/Serenity,dfaruque/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,linpiero/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,TukekeSoft/Serenity,dfaruque/Serenity,linpiero/Serenity,dfaruque/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,TukekeSoft/Serenity,linpiero/Serenity | CodeGenerator/Views/EntityScriptDialog.cshtml | CodeGenerator/Views/EntityScriptDialog.cshtml | @{
var dotModule = Model.Module == null ? "" : ("." + Model.Module);
var moduleDot = Model.Module == null ? "" : (Model.Module + ".");
var moduleSlash = Model.Module == null ? "" : (Model.Module + "/");
}
namespace @(Model.RootNamespace)@(dotModule)
{
using jQueryApi;
using Serenity;
using System.Collections.Generic;
[IdProperty("@Model.Identity")@if (Model.NameField != null) {<text>, NameProperty("@Model.NameField")</text>}@if (Model.IsActiveField != null) {<text>, IsActiveProperty("@(Model.IsActiveField)")</text>}]
[FormKey("@(moduleDot)@(Model.ClassName)"), LocalTextPrefix("@(moduleDot)@(Model.ClassName)"), Service("@(moduleSlash)@(Model.ClassName)")]
public class @(Model.ClassName)Dialog : EntityDialog<@(Model.RowClassName)>
{
}
} | @{
var dotModule = Model.Module == null ? "" : ("." + Model.Module);
var moduleDot = Model.Module == null ? "" : (Model.Module + ".");
var moduleSlash = Model.Module == null ? "" : (Model.Module + "/");
}
namespace @(Model.RootNamespace)@(dotModule)
{
using jQueryApi;
using Serenity;
using System.Collections.Generic;
[IdProperty("@Model.Identity")@if (Model.NameField != null) {<text>, NameProperty("@Model.NameField")</text>}@if (Model.IsActiveField != null) {<text>, IsActiveProperty("@(Model.IsActiveField)")</text>}]
[FormKey("@(moduleDot)@(Model.ClassName)"), LocalTextPrefix("@(dotModule).@(Model.ClassName)"), Service("@(moduleSlash)@(Model.ClassName)")]
public class @(Model.ClassName)Dialog : EntityDialog<@(Model.RowClassName)>
{
}
} | mit | C# |
fd73ca27168e2acb84bb90a341820694e2198625 | Add error handling code to the Preloader. | ciniml/TpiProgrammer | FtdiBinding/Native/Preloader.cs | FtdiBinding/Native/Preloader.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace FtdiBinding.Native
{
class Preloader
{
private const uint LOAD_WITH_ALTERED_SEARCH_PATH = 0x00000008u;
[DllImport("kernel32",SetLastError = true)]
private static extern IntPtr LoadLibraryEx(string lpLibFileName, IntPtr hFile, uint dwFlags);
public Preloader(string libraryFileName)
{
var path = (Environment.Is64BitProcess ? @"Native\x64\" : @"Native\x86\") + libraryFileName;
if (LoadLibraryEx(path, IntPtr.Zero, LOAD_WITH_ALTERED_SEARCH_PATH) == IntPtr.Zero)
{
throw new Exception(String.Format("Failed to load library {0}", libraryFileName));
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace FtdiBinding.Native
{
class Preloader
{
private const uint LOAD_WITH_ALTERED_SEARCH_PATH = 0x00000008u;
[DllImport("kernel32",SetLastError = true)]
private static extern IntPtr LoadLibraryEx(string lpLibFileName, IntPtr hFile, uint dwFlags);
public Preloader(string libraryFileName)
{
var path = (Environment.Is64BitProcess ? @"Native\x64\" : @"Native\x86\") + libraryFileName;
LoadLibraryEx(path, IntPtr.Zero, LOAD_WITH_ALTERED_SEARCH_PATH);
}
}
}
| mit | C# |
3fc05989f3cfc90a8ffebdc44717ff2d3ae76efd | Implement IInfrastructure` on CapEFDbTransaction (#868) | ouraspnet/cap,dotnetcore/CAP,dotnetcore/CAP,dotnetcore/CAP | src/DotNetCore.CAP.SqlServer/IDbContextTransaction.CAP.cs | src/DotNetCore.CAP.SqlServer/IDbContextTransaction.CAP.cs | // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
using DotNetCore.CAP;
using Microsoft.EntityFrameworkCore.Infrastructure;
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Storage
{
internal class CapEFDbTransaction : IDbContextTransaction, IInfrastructure<DbTransaction>
{
private readonly ICapTransaction _transaction;
public CapEFDbTransaction(ICapTransaction transaction)
{
_transaction = transaction;
var dbContextTransaction = (IDbContextTransaction)_transaction.DbTransaction;
TransactionId = dbContextTransaction.TransactionId;
}
public Guid TransactionId { get; }
public void Dispose()
{
_transaction.Dispose();
}
public void Commit()
{
_transaction.Commit();
}
public void Rollback()
{
_transaction.Rollback();
}
public async Task CommitAsync(CancellationToken cancellationToken = default)
{
await _transaction.CommitAsync(cancellationToken);
}
public async Task RollbackAsync(CancellationToken cancellationToken = default)
{
await _transaction.RollbackAsync(cancellationToken);
}
public ValueTask DisposeAsync()
{
return new ValueTask(Task.Run(() => _transaction.Dispose()));
}
public DbTransaction Instance
{
get
{
var dbContextTransaction = (IDbContextTransaction)_transaction.DbTransaction;
return dbContextTransaction.GetDbTransaction();
}
}
}
} | // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Threading;
using System.Threading.Tasks;
using DotNetCore.CAP;
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Storage
{
internal class CapEFDbTransaction : IDbContextTransaction
{
private readonly ICapTransaction _transaction;
public CapEFDbTransaction(ICapTransaction transaction)
{
_transaction = transaction;
var dbContextTransaction = (IDbContextTransaction) _transaction.DbTransaction;
TransactionId = dbContextTransaction.TransactionId;
}
public Guid TransactionId { get; }
public void Dispose()
{
_transaction.Dispose();
}
public void Commit()
{
_transaction.Commit();
}
public void Rollback()
{
_transaction.Rollback();
}
public async Task CommitAsync(CancellationToken cancellationToken = default)
{
await _transaction.CommitAsync(cancellationToken);
}
public async Task RollbackAsync(CancellationToken cancellationToken = default)
{
await _transaction.RollbackAsync(cancellationToken);
}
public ValueTask DisposeAsync()
{
return new ValueTask(Task.Run(() => _transaction.Dispose()));
}
}
} | mit | C# |
0ed5a00961102af08bf09be22596926f5d393032 | remove non-required call. | grokys/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,grokys/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex | src/Web/Avalonia.Web.Blazor/BlazorSkiaGpuRenderSession.cs | src/Web/Avalonia.Web.Blazor/BlazorSkiaGpuRenderSession.cs | using Avalonia.Skia;
using SkiaSharp;
namespace Avalonia.Web.Blazor
{
internal class BlazorSkiaGpuRenderSession : ISkiaGpuRenderSession
{
private readonly SKSurface _surface;
public BlazorSkiaGpuRenderSession(BlazorSkiaSurface blazorSkiaSurface, GRBackendRenderTarget renderTarget)
{
_surface = SKSurface.Create(blazorSkiaSurface.Context, renderTarget, blazorSkiaSurface.Origin, blazorSkiaSurface.ColorType);
GrContext = blazorSkiaSurface.Context;
ScaleFactor = blazorSkiaSurface.Scaling;
SurfaceOrigin = blazorSkiaSurface.Origin;
}
public void Dispose()
{
_surface.Flush();
_surface.Dispose();
}
public GRContext GrContext { get; }
public SKSurface SkSurface => _surface;
public double ScaleFactor { get; }
public GRSurfaceOrigin SurfaceOrigin { get; }
}
}
| using Avalonia.Skia;
using SkiaSharp;
namespace Avalonia.Web.Blazor
{
internal class BlazorSkiaGpuRenderSession : ISkiaGpuRenderSession
{
private readonly SKSurface _surface;
public BlazorSkiaGpuRenderSession(BlazorSkiaSurface blazorSkiaSurface, GRBackendRenderTarget renderTarget)
{
_surface = SKSurface.Create(blazorSkiaSurface.Context, renderTarget, blazorSkiaSurface.Origin, blazorSkiaSurface.ColorType);
GrContext = blazorSkiaSurface.Context;
ScaleFactor = blazorSkiaSurface.Scaling;
SurfaceOrigin = blazorSkiaSurface.Origin;
}
public void Dispose()
{
_surface.Flush();
GrContext.Flush();
_surface.Dispose();
}
public GRContext GrContext { get; }
public SKSurface SkSurface => _surface;
public double ScaleFactor { get; }
public GRSurfaceOrigin SurfaceOrigin { get; }
}
}
| mit | C# |
90dc33e716e0473fa2487cb8831788b62d7a774f | change result type to channelId | weedoit/aerogear-cordova-push,matzew/aerogear-pushplugin-cordova,matzew/aerogear-pushplugin-cordova,edewit/aerogear-pushplugin-cordova,danielpassos/aerogear-cordova-push,weedoit/aerogear-cordova-push,weedoit/aerogear-cordova-push,PaoloMessina/aerogear-cordova-push,danielpassos/aerogear-cordova-push,PaoloMessina/aerogear-cordova-push,edewit/aerogear-pushplugin-cordova,matzew/aerogear-pushplugin-cordova,matzew/aerogear-pushplugin-cordova,aerogear/aerogear-cordova-push,aerogear/aerogear-cordova-push,edewit/aerogear-pushplugin-cordova,weedoit/aerogear-cordova-push,PaoloMessina/aerogear-cordova-push,aerogear/aerogear-cordova-push,PaoloMessina/aerogear-cordova-push,edewit/aerogear-pushplugin-cordova,danielpassos/aerogear-cordova-push,aerogear/aerogear-cordova-push,danielpassos/aerogear-cordova-push | src/wp8/shared/Registration.cs | src/wp8/shared/Registration.cs | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace AeroGear.Push
{
public abstract class Registration
{
public event EventHandler<PushReceivedEvent> PushReceivedEvent;
public async Task<string> Register(PushConfig pushConfig)
{
Installation installation = CreateInstallation(pushConfig);
return await Register(installation, CreateUPSHttpClient(pushConfig));
}
public async Task<string> Register(PushConfig pushConfig, IUPSHttpClient client)
{
return await Register(CreateInstallation(pushConfig), client);
}
protected void OnPushNotification(string message, IDictionary<string, string> data)
{
EventHandler<PushReceivedEvent> handler = PushReceivedEvent;
if (handler != null)
{
handler(this, new PushReceivedEvent(new PushNotification() {message = message, data = data}));
}
}
protected abstract Task<string> Register(Installation installation, IUPSHttpClient iUPSHttpClient);
private IUPSHttpClient CreateUPSHttpClient(PushConfig pushConfig)
{
return new UPSHttpClient(pushConfig.UnifiedPushUri, pushConfig.VariantId, pushConfig.VariantSecret);
}
protected abstract Installation CreateInstallation(PushConfig pushConfig);
}
}
| using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace AeroGear.Push
{
public abstract class Registration
{
public event EventHandler<PushReceivedEvent> PushReceivedEvent;
public async Task Register(PushConfig pushConfig)
{
Installation installation = CreateInstallation(pushConfig);
await Register(installation, CreateUPSHttpClient(pushConfig));
}
public async Task Register(PushConfig pushConfig, IUPSHttpClient client)
{
await Register(CreateInstallation(pushConfig), client);
}
protected void OnPushNotification(string message, IDictionary<string, string> data)
{
EventHandler<PushReceivedEvent> handler = PushReceivedEvent;
if (handler != null)
{
handler(this, new PushReceivedEvent(new PushNotification() {message = message, data = data}));
}
}
protected abstract Task Register(Installation installation, IUPSHttpClient iUPSHttpClient);
private IUPSHttpClient CreateUPSHttpClient(PushConfig pushConfig)
{
return new UPSHttpClient(pushConfig.UnifiedPushUri, pushConfig.VariantId, pushConfig.VariantSecret);
}
protected abstract Installation CreateInstallation(PushConfig pushConfig);
}
}
| apache-2.0 | C# |
4ec4bc03a32069e83e339d7338b9851c46b5fd82 | fix compilation | MiloszKrajewski/FAKE,MiloszKrajewski/FAKE,MiloszKrajewski/FAKE,MiloszKrajewski/FAKE | src/test/Test.FAKECore/FileHandling/CopyRecursiveSpecs.cs | src/test/Test.FAKECore/FileHandling/CopyRecursiveSpecs.cs | using System;
using Fake;
using Fake.IO;
using Machine.Specifications;
using Test.FAKECore.FileHandling;
using IOPath = System.IO.Path;
using IOFile = System.IO.File;
namespace Test.FAKECore.FileHandling
{
public class CopyRecursiveSpecs
{
private static readonly string DestinationDir = IOPath.Combine(TestData.TestDir, "destination");
private static readonly string Dir = IOPath.Combine(TestData.TestDir, "Dir6");
public class when_skipping_existing_files : BaseFunctions
{
private const string AltText = "hello mum";
private static readonly string TargetDir = IOPath.Combine(DestinationDir, "Sub1");
private static readonly string TargetFile = IOPath.Combine(TargetDir, "file1.nav");
static void CreateTestFileStructureWithDest()
{
CreateTestFileStructure();
CleanDir(DestinationDir);
CleanDir(TargetDir);
CreateTestFile(IOPath.Combine(TargetFile), AltText);
}
Establish context = CreateTestFileStructureWithDest;
Because of = () => Shell.CopyRecursive2(Shell.CopyRecursiveMethod.Skip, Dir, DestinationDir);
It does_not_overwrite_existing_file = () => IOFile.ReadAllText(TargetFile).ShouldEqual(AltText);
}
public class when_excluding_files_based_on_pattern : BaseFunctions
{
Establish context = CreateTestFileStructure;
Because of = () => Shell.CopyRecursive2(Shell.CopyRecursiveMethod.NewExcludePattern("**/*.nav"), Dir, DestinationDir);
It does_not_include_files_in_pattern = () => IOFile.Exists(IOPath.Combine(DestinationDir, "Sub1/file1.nav")).ShouldBeFalse();
It includes_files_not_in_pattern = () => IOFile.Exists(IOPath.Combine(DestinationDir, "Sub1/file2.nat")).ShouldBeTrue();
}
public class when_including_files_based_on_pattern : BaseFunctions
{
Establish context = CreateTestFileStructure;
Because of = () => Shell.CopyRecursive2(Shell.CopyRecursiveMethod.NewIncludePattern("**/*.nav"), Dir, DestinationDir);
It excludes_files_in_pattern = () => IOFile.Exists(IOPath.Combine(DestinationDir, "Sub1/file2.nat")).ShouldBeFalse();
It does_not_exclude_files_not_in_pattern = () => IOFile.Exists(IOPath.Combine(DestinationDir, "Sub1/file1.nav")).ShouldBeTrue();
}
}
}
| using System;
using Fake;
using Machine.Specifications;
using Test.FAKECore.FileHandling;
using IOPath = System.IO.Path;
using IOFile = System.IO.File;
namespace Test.FAKECore.FileHandling
{
public class CopyRecursiveSpecs
{
private static readonly string DestinationDir = IOPath.Combine(TestData.TestDir, "destination");
private static readonly string Dir = IOPath.Combine(TestData.TestDir, "Dir6");
public class when_skipping_existing_files : BaseFunctions
{
private const string AltText = "hello mum";
private static readonly string TargetDir = IOPath.Combine(DestinationDir, "Sub1");
private static readonly string TargetFile = IOPath.Combine(TargetDir, "file1.nav");
static void CreateTestFileStructureWithDest()
{
CreateTestFileStructure();
CleanDir(DestinationDir);
CleanDir(TargetDir);
CreateTestFile(IOPath.Combine(TargetFile), AltText);
}
Establish context = CreateTestFileStructureWithDest;
Because of = () => Shell.CopyRecursive2(Shell.CopyRecursiveMethod.Skip, Dir, DestinationDir);
It does_not_overwrite_existing_file = () => IOFile.ReadAllText(TargetFile).ShouldEqual(AltText);
}
public class when_excluding_files_based_on_pattern : BaseFunctions
{
Establish context = CreateTestFileStructure;
Because of = () => Shell.CopyRecursive2(Shell.CopyRecursiveMethod.NewExcludePattern("**/*.nav"), Dir, DestinationDir);
It does_not_include_files_in_pattern = () => IOFile.Exists(IOPath.Combine(DestinationDir, "Sub1/file1.nav")).ShouldBeFalse();
It includes_files_not_in_pattern = () => IOFile.Exists(IOPath.Combine(DestinationDir, "Sub1/file2.nat")).ShouldBeTrue();
}
public class when_including_files_based_on_pattern : BaseFunctions
{
Establish context = CreateTestFileStructure;
Because of = () => Shell.CopyRecursive2(Shell.CopyRecursiveMethod.NewIncludePattern("**/*.nav"), Dir, DestinationDir);
It excludes_files_in_pattern = () => IOFile.Exists(IOPath.Combine(DestinationDir, "Sub1/file2.nat")).ShouldBeFalse();
It does_not_exclude_files_not_in_pattern = () => IOFile.Exists(IOPath.Combine(DestinationDir, "Sub1/file1.nav")).ShouldBeTrue();
}
}
}
| apache-2.0 | C# |
4cc5f754a22b4b6b8529a2754ed7bbfb7a354ef1 | Bump version number for 5.0.0 | csf-dev/CSF.Core,csf-dev/CSF.Core | Common/CommonAssemblyInfo.cs | Common/CommonAssemblyInfo.cs | //
// CommonAssemblyInfo.cs
//
// Author:
// Craig Fowler <[email protected]>
//
// Copyright (c) 2015 CSF Software Limited
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyCompany("CSF Software Limited")]
[assembly: AssemblyProduct("CSF Software Utilities")]
[assembly: AssemblyCopyright("CSF Software Limited")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
// 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("5.0.0")]
| //
// CommonAssemblyInfo.cs
//
// Author:
// Craig Fowler <[email protected]>
//
// Copyright (c) 2015 CSF Software Limited
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyCompany("CSF Software Limited")]
[assembly: AssemblyProduct("CSF Software Utilities")]
[assembly: AssemblyCopyright("CSF Software Limited")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
// 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("4.1.1")]
| mit | C# |
e2c646003a51eb90c957d8b2f5961f2c21b94804 | Remove empty comment | davidrynn/monotouch-samples,peteryule/monotouch-samples,kingyond/monotouch-samples,hongnguyenpro/monotouch-samples,sakthivelnagarajan/monotouch-samples,xamarin/monotouch-samples,albertoms/monotouch-samples,albertoms/monotouch-samples,andypaul/monotouch-samples,andypaul/monotouch-samples,iFreedive/monotouch-samples,YOTOV-LIMITED/monotouch-samples,peteryule/monotouch-samples,hongnguyenpro/monotouch-samples,W3SS/monotouch-samples,robinlaide/monotouch-samples,sakthivelnagarajan/monotouch-samples,nelzomal/monotouch-samples,hongnguyenpro/monotouch-samples,sakthivelnagarajan/monotouch-samples,peteryule/monotouch-samples,iFreedive/monotouch-samples,haithemaraissia/monotouch-samples,W3SS/monotouch-samples,a9upam/monotouch-samples,haithemaraissia/monotouch-samples,xamarin/monotouch-samples,a9upam/monotouch-samples,robinlaide/monotouch-samples,markradacz/monotouch-samples,andypaul/monotouch-samples,nervevau2/monotouch-samples,hongnguyenpro/monotouch-samples,W3SS/monotouch-samples,YOTOV-LIMITED/monotouch-samples,YOTOV-LIMITED/monotouch-samples,nelzomal/monotouch-samples,nervevau2/monotouch-samples,haithemaraissia/monotouch-samples,albertoms/monotouch-samples,labdogg1003/monotouch-samples,labdogg1003/monotouch-samples,robinlaide/monotouch-samples,nelzomal/monotouch-samples,kingyond/monotouch-samples,andypaul/monotouch-samples,davidrynn/monotouch-samples,haithemaraissia/monotouch-samples,nelzomal/monotouch-samples,davidrynn/monotouch-samples,nervevau2/monotouch-samples,YOTOV-LIMITED/monotouch-samples,iFreedive/monotouch-samples,robinlaide/monotouch-samples,labdogg1003/monotouch-samples,a9upam/monotouch-samples,xamarin/monotouch-samples,labdogg1003/monotouch-samples,kingyond/monotouch-samples,a9upam/monotouch-samples,markradacz/monotouch-samples,davidrynn/monotouch-samples,nervevau2/monotouch-samples,peteryule/monotouch-samples,sakthivelnagarajan/monotouch-samples,markradacz/monotouch-samples | CoreAnimation/AppDelegate.cs | CoreAnimation/AppDelegate.cs | using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace Example_CoreAnimation
{
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
#region declarations and properties
protected UIWindow window;
protected Screens.iPad.Home.MainSplitView splitView;
#endregion
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create our window
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.MakeKeyAndVisible ();
// instantiate our main split view controller
splitView = new Screens.iPad.Home.MainSplitView ();
window.RootViewController = splitView;
return true;
}
}
}
| using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace Example_CoreAnimation
{
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
#region declarations and properties
protected UIWindow window;
protected Screens.iPad.Home.MainSplitView splitView;
#endregion
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create our window
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.MakeKeyAndVisible ();
// instantiate our main split view controller
splitView = new Screens.iPad.Home.MainSplitView ();
window.RootViewController = splitView;
//
return true;
}
}
}
| mit | C# |
1d4bf8cd07b572ef8802609502939b144dcbafa3 | Update Index.cshtml | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/Home/Index.cshtml | Anlab.Mvc/Views/Home/Index.cshtml | @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:[email protected]">[email protected]</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
| @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Updated: January 11, 2021<br /><br />
A modest rate increase will be implemented on February 1, 2021.
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:[email protected]">[email protected]</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
| mit | C# |
2c8e3b37c536e61ecc427bcfb6f888d816cfb824 | Bump Version | UniqProject/BDInfo | BDInfo/Properties/AssemblyInfo.cs | BDInfo/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("BDInfo")]
[assembly: AssemblyDescription("Blu-ray Video and Audio Specifications Collection Tool")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cinema Squid")]
[assembly: AssemblyProduct("BDInfo")]
[assembly: AssemblyCopyright("Copyright © Cinema Squid 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6a516a5c-6c0d-4ab0-bb8d-f113d544355e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.2")]
[assembly: AssemblyFileVersion("0.7.2")]
| 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("BDInfo")]
[assembly: AssemblyDescription("Blu-ray Video and Audio Specifications Collection Tool")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cinema Squid")]
[assembly: AssemblyProduct("BDInfo")]
[assembly: AssemblyCopyright("Copyright © Cinema Squid 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6a516a5c-6c0d-4ab0-bb8d-f113d544355e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.1")]
[assembly: AssemblyFileVersion("0.7.1")]
| lgpl-2.1 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.