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 |
|---|---|---|---|---|---|---|---|---|
58640f4fa70845116bd13df041611a21b222dce4 | Set up and connect client/server. | SmartCasual/ksp-multiplayer | KSPMultiplayer.cs | KSPMultiplayer.cs | using System;
using UnityEngine;
namespace SC {
[KSPAddon(KSPAddon.Startup.Flight, false)]
public class KSPMultiplayer : MonoBehaviour {
private Vessel currVessel;
private Vessel prevVessel;
public void Awake() {
RenderingManager.AddToPostDrawQueue (3, new Callback (drawGUI));
}
public void Update() {
if (currVessel == null || FlightGlobals.ActiveVessel != currVessel) {
prevVessel = currVessel;
currVessel = FlightGlobals.ActiveVessel;
if (prevVessel != null) {
Debug.Log("SCMP: "+prevVessel.vesselName);
}
Debug.Log("SCMP: "+currVessel.vesselName);
Debug.Log("SCMP: "+currVessel.gameObject);
Debug.Log("SCMP: " + currVessel.transform);
Debug.Log("SCMP: " + currVessel.transform.position);
Debug.Log("SCMP: "+currVessel.gameObject.transform);
Debug.Log("SCMP: "+currVessel.gameObject.transform.position);
}
}
// Private methods
protected Rect windowPos;
private void drawGUI() {
GUI.skin = HighLogic.Skin;
windowPos = GUILayout.Window(1, windowPos, WindowGUI, "Server or client?", GUILayout.MinWidth(200));
windowPos = new Rect(Screen.width / 2, Screen.height / 2, 10, 10);
}
private void WindowGUI(int windowID) {
GUIStyle mySty = new GUIStyle(GUI.skin.button);
mySty.normal.textColor = mySty.focused.textColor = Color.white;
mySty.hover.textColor = mySty.active.textColor = Color.yellow;
mySty.onNormal.textColor = mySty.onFocused.textColor = mySty.onHover.textColor = mySty.onActive.textColor = Color.green;
mySty.padding = new RectOffset(8, 8, 8, 8);
GUILayout.BeginVertical();
if (GUILayout.Button("Server",mySty,GUILayout.ExpandWidth(true))) {
Network.InitializeServer (100, 12345, true);
RenderingManager.RemoveFromPostDrawQueue(3, new Callback(drawGUI));
}
if (GUILayout.Button("Client",mySty,GUILayout.ExpandWidth(true))) {
Network.Connect ("10.0.0.11", 12345);
RenderingManager.RemoveFromPostDrawQueue(3, new Callback(drawGUI));
}
GUILayout.EndVertical();
}
}
}
| using System;
using UnityEngine;
namespace SC {
[KSPAddon(KSPAddon.Startup.Flight, false)]
public class KSPMultiplayer : MonoBehaviour {
private Vessel currVessel;
private Vessel prevVessel;
public void Update() {
if (currVessel == null || FlightGlobals.ActiveVessel != currVessel) {
prevVessel = currVessel;
currVessel = FlightGlobals.ActiveVessel;
if (prevVessel != null) {
Debug.Log("SCMP: "+prevVessel.vesselName);
}
Debug.Log("SCMP: "+currVessel.vesselName);
Debug.Log("SCMP: "+currVessel.gameObject);
Debug.Log("SCMP: " + currVessel.transform);
Debug.Log("SCMP: " + currVessel.transform.position);
Debug.Log("SCMP: "+currVessel.gameObject.transform);
Debug.Log("SCMP: "+currVessel.gameObject.transform.position);
}
}
}
}
| mit | C# |
c9c28603a7f1d0fa01f65782e26108242c0fa2d8 | Remove code which logs empty responses | canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor | src/SyncTrayzor/Syncthing/ApiClient/SyncthingHttpClientHandler.cs | src/SyncTrayzor/Syncthing/ApiClient/SyncthingHttpClientHandler.cs | using NLog;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System;
namespace SyncTrayzor.Syncthing.ApiClient
{
public class SyncthingHttpClientHandler : WebRequestHandler
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public SyncthingHttpClientHandler()
{
// We expect Syncthing to return invalid certs
this.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var response = await base.SendAsync(request, cancellationToken);
if (response.IsSuccessStatusCode)
logger.Trace(() => response.Content.ReadAsStringAsync().Result.Trim());
else
logger.Warn("Non-successful status code. {0} {1}", response, (await response.Content.ReadAsStringAsync()).Trim());
return response;
}
}
}
| using NLog;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System;
namespace SyncTrayzor.Syncthing.ApiClient
{
public class SyncthingHttpClientHandler : WebRequestHandler
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public SyncthingHttpClientHandler()
{
// We expect Syncthing to return invalid certs
this.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var response = await base.SendAsync(request, cancellationToken);
// We're getting null bodies from somewhere: try and figure out where
var responseString = await response.Content.ReadAsStringAsync();
if (String.IsNullOrWhiteSpace(responseString))
logger.Warn($"Null response received from {request.RequestUri}. {response}. Content (again): {response.Content.ReadAsStringAsync()}");
if (response.IsSuccessStatusCode)
logger.Trace(() => response.Content.ReadAsStringAsync().Result.Trim());
else
logger.Warn("Non-successful status code. {0} {1}", response, (await response.Content.ReadAsStringAsync()).Trim());
return response;
}
}
}
| mit | C# |
9b6b29b27a4efa238fc55b462ade3dbefbb89616 | Add documentation | SimpleStack/simplestack.orm,SimpleStack/simplestack.orm | src/SimpleStack.Orm/ColumnDefinition.cs | src/SimpleStack.Orm/ColumnDefinition.cs | using System.Data;
namespace SimpleStack.Orm
{
public interface IColumnDefinition
{
/// <summary>
/// Column Name
/// </summary>
string Name { get; }
/// <summary>
/// Is nullable or not
/// </summary>
bool Nullable { get; }
/// <summary>
/// Column Length
/// </summary>
int? Length { get; }
/// <summary>
/// Numeric precision
/// </summary>
int? Precision { get; }
/// <summary>
/// Numeric Scale
/// </summary>
int? Scale { get; }
/// <summary>
/// Columns definition as returned by database server
/// </summary>
string Definition { get; }
/// <summary>
/// Columns type
/// </summary>
DbType DbType { get; }
/// <summary>
/// True if column is part of the primary key
/// </summary>
bool PrimaryKey { get; }
/// <summary>
/// True if there is a unique index on that column
/// </summary>
bool Unique { get; }
/// <summary>
/// Column default value
/// </summary>
string DefaultValue { get; }
}
public class ColumnType
{
public int? Length { get; set; }
public int? Precision { get; set; }
public int? Scale { get; set; }
public string Definition { get; set; }
public DbType DbType { get; set; }
}
public class ColumnDefinition : ColumnType, IColumnDefinition
{
/// <inheritdoc />
public string Name { get; set; }
/// <inheritdoc />
public bool Nullable { get; set; }
/// <inheritdoc />
public bool PrimaryKey { get; set; }
public bool Unique { get; set; }
/// <inheritdoc />
public string DefaultValue { get; set; }
}
} | using System.Data;
namespace SimpleStack.Orm
{
public interface IColumnDefinition
{
string Name { get; }
bool Nullable { get; }
int? Length { get; }
int? Precision { get; }
int? Scale { get; }
string Definition { get; }
DbType DbType { get; }
bool PrimaryKey { get; }
bool Unique { get; }
string DefaultValue { get; }
}
public class ColumnType
{
public int? Length { get; set; }
public int? Precision { get; set; }
public int? Scale { get; set; }
public string Definition { get; set; }
public DbType DbType { get; set; }
}
public class ColumnDefinition : ColumnType, IColumnDefinition
{
/// <inheritdoc />
public string Name { get; set; }
/// <inheritdoc />
public bool Nullable { get; set; }
/// <inheritdoc />
public bool PrimaryKey { get; set; }
public bool Unique { get; set; }
/// <inheritdoc />
public string DefaultValue { get; set; }
}
} | bsd-3-clause | C# |
d3541816a637f8ccb105622ac71027a096b9009c | Reset console color on exit. | sqc1999/LxRunOffline | LxRunOffline/Program.cs | LxRunOffline/Program.cs | using System;
using System.Diagnostics;
using EasyHook;
namespace LxRunOffline
{
class Program
{
static void Main(string[] args)
{
int pId = 0;
try
{
RemoteHooking.CreateAndInject(@"C:\Windows\System32\LxRun.exe", string.Join(" ", args), 0, "LxRunHook.dll", "LxRunHook.dll", out pId);
}
catch (Exception e)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Error: Failed to launch LxRun.");
Console.WriteLine(e);
Console.ResetColor();
Environment.Exit(-1);
}
var process = Process.GetProcessById(pId);
process.WaitForExit();
}
}
}
| using System;
using System.Diagnostics;
using EasyHook;
namespace LxRunOffline
{
class Program
{
static void Main(string[] args)
{
int pId = 0;
try
{
RemoteHooking.CreateAndInject(@"C:\Windows\System32\LxRun.exe", string.Join(" ", args), 0, "LxRunHook.dll", "LxRunHook.dll", out pId);
}
catch (Exception e)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Error: Failed to launch LxRun.");
Console.WriteLine(e);
Environment.Exit(-1);
}
var process = Process.GetProcessById(pId);
process.WaitForExit();
}
}
}
| mit | C# |
a0d6e8cb97848c490ca51d802768a68996c3f2ca | Allow suppression of colour for specific glyphs. | SirSengir/QuickFont | QuickFont/QFontGlyph.cs | QuickFont/QFontGlyph.cs | using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace QuickFont {
public sealed class QFontGlyph {
/// <summary>
/// Which texture page the glyph is on
/// </summary>
public int Page {
get;
private set;
}
/// <summary>
/// The rectangle defining the glyphs position on the page
/// </summary>
public Rectangle Rect {
get;
set;
}
/// <summary>
/// How far the glyph would need to be vertically offset to be vertically in line with the tallest glyph in the set of all glyphs
/// </summary>
public int YOffset {
get;
set;
}
/// <summary>
/// Which character this glyph represents
/// </summary>
public char Character {
get;
private set;
}
/// <summary>
/// Indicates whether colouring should be suppressed for this glyph.
/// </summary>
/// <value><c>true</c> if suppress colouring; otherwise, <c>false</c>.</value>
public bool SuppressColouring {
get;
set;
}
public QFontGlyph (int page, Rectangle rect, int yOffset, char character) {
Page = page;
Rect = rect;
YOffset = yOffset;
Character = character;
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace QuickFont {
public sealed class QFontGlyph {
/// <summary>
/// Which texture page the glyph is on
/// </summary>
public int Page {
get;
private set;
}
/// <summary>
/// The rectangle defining the glyphs position on the page
/// </summary>
public Rectangle Rect {
get;
set;
}
/// <summary>
/// How far the glyph would need to be vertically offset to be vertically in line with the tallest glyph in the set of all glyphs
/// </summary>
public int YOffset {
get;
set;
}
/// <summary>
/// Which character this glyph represents
/// </summary>
public char Character {
get;
private set;
}
public QFontGlyph (int page, Rectangle rect, int yOffset, char character) {
Page = page;
Rect = rect;
YOffset = yOffset;
Character = character;
}
}
}
| mit | C# |
97236e5d260c8adfe8d3aeeff4ac7a37217d057b | Fix issue with PhiAccrualFailureDetector | cdmdotnet/akka.net,skotzko/akka.net,ashic/akka.net,akoshelev/akka.net,MAOliver/akka.net,bruinbrown/akka.net,JeffCyr/akka.net,thelegendofando/akka.net,alexvaluyskiy/akka.net,tillr/akka.net,chris-ray/akka.net,naveensrinivasan/akka.net,d--g/akka.net,linearregression/akka.net,akoshelev/akka.net,eloraiby/akka.net,ali-ince/akka.net,simonlaroche/akka.net,alexpantyukhin/akka.net,rodrigovidal/akka.net,Chinchilla-Software-Com/akka.net,adamhathcock/akka.net,willieferguson/akka.net,michal-franc/akka.net,billyxing/akka.net,stefansedich/akka.net,simonlaroche/akka.net,linearregression/akka.net,chris-ray/akka.net,dyanarose/akka.net,eisendle/akka.net,gwokudasam/akka.net,dbolkensteyn/akka.net,GeorgeFocas/akka.net,dbolkensteyn/akka.net,heynickc/akka.net,nvivo/akka.net,adamhathcock/akka.net,heynickc/akka.net,bruinbrown/akka.net,JeffCyr/akka.net,nanderto/akka.net,AntoineGa/akka.net,forki/akka.net,forki/akka.net,matiii/akka.net,neekgreen/akka.net,ashic/akka.net,vchekan/akka.net,cdmdotnet/akka.net,KadekM/akka.net,GeorgeFocas/akka.net,neekgreen/akka.net,tillr/akka.net,nanderto/akka.net,gwokudasam/akka.net,numo16/akka.net,kerryjiang/akka.net,KadekM/akka.net,Chinchilla-Software-Com/akka.net,Silv3rcircl3/akka.net,cpx/akka.net,jordansjones/akka.net,alexpantyukhin/akka.net,silentnull/akka.net,kekekeks/akka.net,numo16/akka.net,MAOliver/akka.net,amichel/akka.net,Micha-kun/akka.net,Silv3rcircl3/akka.net,eloraiby/akka.net,amichel/akka.net,ali-ince/akka.net,kstaruch/akka.net,willieferguson/akka.net,naveensrinivasan/akka.net,derwasp/akka.net,zbrad/akka.net,alex-kondrashov/akka.net,kerryjiang/akka.net,rodrigovidal/akka.net,Micha-kun/akka.net,zbrad/akka.net,vchekan/akka.net,dyanarose/akka.net,michal-franc/akka.net,trbngr/akka.net,d--g/akka.net,trbngr/akka.net,rogeralsing/akka.net,derwasp/akka.net,silentnull/akka.net,eisendle/akka.net,stefansedich/akka.net,jordansjones/akka.net,forki/akka.net,AntoineGa/akka.net,forki/akka.net,kstaruch/akka.net,cpx/akka.net,nvivo/akka.net,matiii/akka.net,alex-kondrashov/akka.net,billyxing/akka.net,thelegendofando/akka.net,skotzko/akka.net,kekekeks/akka.net,alexvaluyskiy/akka.net,rogeralsing/akka.net | src/core/Akka.Remote/FailureDetector.cs | src/core/Akka.Remote/FailureDetector.cs | using System;
using Akka.Configuration;
using Akka.Event;
namespace Akka.Remote
{
/// <summary>
/// A failure detector must be a thread-safe, mutable construct that registers heartbeat events of a resource and
/// is able to decide the availability of that monitored resource
/// </summary>
public abstract class FailureDetector
{
/// <summary>
/// Returns true if the resource is considered to be up and healthy; false otherwise
/// </summary>
public abstract bool IsAvailable { get; }
/// <summary>
/// Returns true if the failure detector has received any heartbeats and started monitoring
/// the resource
/// </summary>
public abstract bool IsMonitoring { get; }
/// <summary>
/// Notifies the <see cref="FailureDetector"/> that a heartbeat arrived from the monitored resource.
/// This causes the <see cref="FailureDetector"/> to update its state.
/// </summary>
public abstract void HeartBeat();
#region Static members
public static readonly Clock DefaultClock = () => Environment.TickCount;
#endregion
}
/// <summary>
/// Abstraction of a clock that returns time in milliseconds. Can only be used to measure the elapsed time
/// and is not related to any other notion of system or wall-clock time.
/// </summary>
public delegate long Clock();
}
| using System;
using Akka.Configuration;
using Akka.Event;
namespace Akka.Remote
{
/// <summary>
/// A failure detector must be a thread-safe, mutable construct that registers heartbeat events of a resource and
/// is able to decide the availability of that monitored resource
/// </summary>
public abstract class FailureDetector
{
/// <summary>
/// Returns true if the resource is considered to be up and healthy; false otherwise
/// </summary>
public abstract bool IsAvailable { get; }
/// <summary>
/// Returns true if the failure detector has received any heartbeats and started monitoring
/// the resource
/// </summary>
public abstract bool IsMonitoring { get; }
/// <summary>
/// Notifies the <see cref="FailureDetector"/> that a heartbeat arrived from the monitored resource.
/// This causes the <see cref="FailureDetector"/> to update its state.
/// </summary>
public abstract void HeartBeat();
#region Static members
public static readonly Clock DefaultClock = () => Environment.TickCount / TimeSpan.TicksPerMillisecond;
#endregion
}
/// <summary>
/// Abstraction of a clock that returns time in milliseconds. Can only be used to measure the elapsed time
/// and is not related to any other notion of system or wall-clock time.
/// </summary>
public delegate long Clock();
}
| apache-2.0 | C# |
7caea52e3075dbef6ea60aade33bb9ae49c65985 | Add header for video steramer section | dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo | Quadruped.WebInterface/Pages/SettingsPage.cshtml | Quadruped.WebInterface/Pages/SettingsPage.cshtml | @page
@using Quadruped.WebInterface.Pages
@model global::Quadruped.WebInterface.Pages.SettingsPageModel
@{
ViewData["Title"] = "SettingsPage";
}
<h2>SettingsPage</h2>
<div>
<form method="post">
<h3>Video streamer settings</h3>
<div>Framerate <input asp-for="StreamConfiguration.Framerate" /></div>
<div>HorizontalResolution <input asp-for="StreamConfiguration.HorizontalResolution"/></div>
<div>VerticalResolution <input asp-for="StreamConfiguration.VerticalResolution" /></div>
<div>ImageQuality <input asp-for="StreamConfiguration.ImageQuality" /></div>
<h3>Relaxed stance adjustment</h3>
<div>X:<input asp-for="RelaxedStance.X" /></div>
<div>Y:<input asp-for="RelaxedStance.Y" /></div>
<div>Z:<input asp-for="RelaxedStance.Z" /></div>
<h3>gait configuration</h3>
<div>FrontLegShift:<input asp-for="RobotConfiguration.FrontLegShift" /> default: @Model.DefaultRobotConfiguration.FrontLegShift</div>
<div>RearLegShift:<input asp-for="RobotConfiguration.RearLegShift" /> default: @Model.DefaultRobotConfiguration.RearLegShift</div>
<div>LiftHeight:<input asp-for="RobotConfiguration.LiftHeight" /> default: @Model.DefaultRobotConfiguration.LiftHeight</div>
<div>Speed:<input asp-for="RobotConfiguration.Speed" /> default: @Model.DefaultRobotConfiguration.Speed</div>
<input type="submit"/>
</form>
</div>
| @page
@using Quadruped.WebInterface.Pages
@model global::Quadruped.WebInterface.Pages.SettingsPageModel
@{
ViewData["Title"] = "SettingsPage";
}
<h2>SettingsPage</h2>
<div>
<form method="post">
<div>Framerate <input asp-for="StreamConfiguration.Framerate" /></div>
<div>HorizontalResolution <input asp-for="StreamConfiguration.HorizontalResolution"/></div>
<div>VerticalResolution <input asp-for="StreamConfiguration.VerticalResolution" /></div>
<div>ImageQuality <input asp-for="StreamConfiguration.ImageQuality" /></div>
<h3>Relaxed stance adjustment</h3>
<div>X:<input asp-for="RelaxedStance.X" /></div>
<div>Y:<input asp-for="RelaxedStance.Y" /></div>
<div>Z:<input asp-for="RelaxedStance.Z" /></div>
<h3>gait configuration</h3>
<div>FrontLegShift:<input asp-for="RobotConfiguration.FrontLegShift" /> default: @Model.DefaultRobotConfiguration.FrontLegShift</div>
<div>RearLegShift:<input asp-for="RobotConfiguration.RearLegShift" /> default: @Model.DefaultRobotConfiguration.RearLegShift</div>
<div>LiftHeight:<input asp-for="RobotConfiguration.LiftHeight" /> default: @Model.DefaultRobotConfiguration.LiftHeight</div>
<div>Speed:<input asp-for="RobotConfiguration.Speed" /> default: @Model.DefaultRobotConfiguration.Speed</div>
<input type="submit"/>
</form>
</div>
| apache-2.0 | C# |
58c71090998ae40865ef236c9b570b1f91eb75ea | Move config.Configure to BeforeStart which gives the overloads the chance to change it before it throw because it dose not found an configuration. | hibernating-rhinos/rhino-esb,ketiko/rhino-esb | Rhino.ServiceBus/Hosting/AbstractBootStrapper.cs | Rhino.ServiceBus/Hosting/AbstractBootStrapper.cs | using System;
using System.Reflection;
using Rhino.ServiceBus.Config;
using Rhino.ServiceBus.Impl;
namespace Rhino.ServiceBus.Hosting
{
public abstract class AbstractBootStrapper : IDisposable
{
private AbstractRhinoServiceBusConfiguration config;
public virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public virtual void InitializeContainer()
{
CreateContainer();
config = CreateConfiguration();
ConfigureBusFacility(config);
}
public virtual void UseConfiguration(BusConfigurationSection configurationSection)
{
config.UseConfiguration(configurationSection);
}
public abstract void CreateContainer();
public abstract void ExecuteDeploymentActions(string user);
public abstract void ExecuteEnvironmentValidationActions();
public abstract T GetInstance<T>();
protected virtual bool IsTypeAcceptableForThisBootStrapper(Type t)
{
return true;
}
protected virtual AbstractRhinoServiceBusConfiguration CreateConfiguration()
{
return new RhinoServiceBusConfiguration();
}
protected virtual void ConfigureBusFacility(AbstractRhinoServiceBusConfiguration configuration)
{
}
public virtual void BeforeStart()
{
config.Configure();
}
public virtual void AfterStart()
{
}
public abstract void Dispose();
}
} | using System;
using System.Reflection;
using Rhino.ServiceBus.Config;
using Rhino.ServiceBus.Impl;
namespace Rhino.ServiceBus.Hosting
{
public abstract class AbstractBootStrapper : IDisposable
{
private AbstractRhinoServiceBusConfiguration config;
public virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public virtual void AfterStart()
{
}
public virtual void InitializeContainer()
{
CreateContainer();
config = CreateConfiguration();
ConfigureBusFacility(config);
config.Configure();
}
public virtual void UseConfiguration(BusConfigurationSection configurationSection)
{
config.UseConfiguration(configurationSection);
}
public abstract void CreateContainer();
public abstract void ExecuteDeploymentActions(string user);
public abstract void ExecuteEnvironmentValidationActions();
public abstract T GetInstance<T>();
protected virtual bool IsTypeAcceptableForThisBootStrapper(Type t)
{
return true;
}
protected virtual AbstractRhinoServiceBusConfiguration CreateConfiguration()
{
return new RhinoServiceBusConfiguration();
}
protected virtual void ConfigureBusFacility(AbstractRhinoServiceBusConfiguration configuration)
{
}
public virtual void BeforeStart()
{
}
public abstract void Dispose();
}
} | bsd-3-clause | C# |
38fbcfb50a1159a2f07828a96005ed606a6123a2 | Update ModuleMirror from mono/mono | Unity-Technologies/debugger-libs,mono/debugger-libs,Unity-Technologies/debugger-libs,mono/debugger-libs | Mono.Debugger.Soft/Mono.Debugger.Soft/ModuleMirror.cs | Mono.Debugger.Soft/Mono.Debugger.Soft/ModuleMirror.cs | using System;
using Mono.Debugger;
namespace Mono.Debugger.Soft
{
public class ModuleMirror : Mirror
{
ModuleInfo info;
Guid guid;
AssemblyMirror assembly;
internal ModuleMirror (VirtualMachine vm, long id) : base (vm, id)
{
}
void ReadInfo ()
{
if (info == null)
info = vm.conn.Module_GetInfo (id);
}
public string Name {
get {
ReadInfo ();
return info.Name;
}
}
public string ScopeName {
get {
ReadInfo ();
return info.ScopeName;
}
}
public string FullyQualifiedName {
get {
ReadInfo ();
return info.FQName;
}
}
public Guid ModuleVersionId {
get {
if (guid == Guid.Empty) {
ReadInfo ();
guid = new Guid (info.Guid);
}
return guid;
}
}
public AssemblyMirror Assembly {
get {
if (assembly == null) {
ReadInfo ();
if (info.Assembly == 0)
return null;
assembly = vm.GetAssembly (info.Assembly);
}
return assembly;
}
}
// FIXME: Add function to query the guid, check in Metadata
// Since protocol version 2.48
public string SourceLink {
get {
vm.CheckProtocolVersion (2, 48);
ReadInfo ();
return info.SourceLink;
}
}
}
} | using System;
using Mono.Debugger;
using Mono.Cecil;
namespace Mono.Debugger.Soft
{
public class ModuleMirror : Mirror
{
ModuleInfo info;
Guid guid;
AssemblyMirror assembly;
internal ModuleMirror (VirtualMachine vm, long id) : base (vm, id) {
}
void ReadInfo () {
if (info == null)
info = vm.conn.Module_GetInfo (id);
}
public string Name {
get {
ReadInfo ();
return info.Name;
}
}
public string ScopeName {
get {
ReadInfo ();
return info.ScopeName;
}
}
public string FullyQualifiedName {
get {
ReadInfo ();
return info.FQName;
}
}
public Guid ModuleVersionId {
get {
if (guid == Guid.Empty) {
ReadInfo ();
guid = new Guid (info.Guid);
}
return guid;
}
}
public AssemblyMirror Assembly {
get {
if (assembly == null) {
ReadInfo ();
if (info.Assembly == 0)
return null;
assembly = vm.GetAssembly (info.Assembly);
}
return assembly;
}
}
// FIXME: Add function to query the guid, check in Metadata
}
}
| mit | C# |
2eaffc7fc4487ac0fb8c83f7d650c0954eee0439 | Update IExchangeRateRepository.cs | tiksn/TIKSN-Framework | TIKSN.Core/Finance/ForeignExchange/Data/IExchangeRateRepository.cs | TIKSN.Core/Finance/ForeignExchange/Data/IExchangeRateRepository.cs | using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using TIKSN.Data;
namespace TIKSN.Finance.ForeignExchange.Data
{
public interface IExchangeRateRepository : IQueryRepository<ExchangeRateEntity, Guid>,
IRepository<ExchangeRateEntity>
{
Task<IReadOnlyCollection<ExchangeRateEntity>> SearchAsync(
Guid foreignExchangeID,
string baseCurrencyCode,
string counterCurrencyCode,
DateTimeOffset dateFrom,
DateTimeOffset dateTo,
CancellationToken cancellationToken);
}
}
| using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using TIKSN.Data;
namespace TIKSN.Finance.ForeignExchange.Data
{
public interface IExchangeRateRepository : IQueryRepository<ExchangeRateEntity, Guid>,
IRepository<ExchangeRateEntity>
{
Task<ExchangeRateEntity> GetOrDefaultAsync(
Guid foreignExchangeID,
string baseCurrencyCode,
string counterCurrencyCode,
DateTimeOffset asOn,
CancellationToken cancellationToken);
Task<IReadOnlyCollection<ExchangeRateEntity>> SearchAsync(
Guid foreignExchangeID,
string baseCurrencyCode,
string counterCurrencyCode,
DateTimeOffset dateFrom,
DateTimeOffset dateTo,
CancellationToken cancellationToken);
}
}
| mit | C# |
a88391b52fb9dc6c615461b9d53f797461b85c55 | remove unused usings | tugberkugurlu/AspNetCore.Identity.MongoDB,tugberkugurlu/AspNetCore.Identity.MongoDB | samples/IdentitySample.Mvc/Program.cs | samples/IdentitySample.Mvc/Program.cs | using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
namespace IdentitySample
{
public static class Program
{
public static void Main(string[] args) => BuildWebHost(args).Run();
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
} | using System.IO;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
namespace IdentitySample
{
public static class Program
{
public static void Main(string[] args) => BuildWebHost(args).Run();
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
} | mit | C# |
09f63b7b0d8c056c3a28da1ed85c8ac1d54c8b11 | Initialize InfoAppCommand with an IApplicationConfiguration | appharbor/appharbor-cli | src/AppHarbor/Commands/InfoAppCommand.cs | src/AppHarbor/Commands/InfoAppCommand.cs | using System;
namespace AppHarbor.Commands
{
public class InfoAppCommand : ICommand
{
private readonly IAppHarborClient _client;
private readonly IApplicationConfiguration _applicationConfiguration;
public InfoAppCommand(IAppHarborClient client, IApplicationConfiguration applicationConfiguration)
{
_client = client;
_applicationConfiguration = applicationConfiguration;
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| using System;
namespace AppHarbor.Commands
{
public class InfoAppCommand : ICommand
{
private readonly IAppHarborClient _client;
public InfoAppCommand(IAppHarborClient client)
{
_client = client;
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
505a63f8e05692c0b65cfc005b6e07a39b2b47fd | Update IMessage.cs | AntiTcb/Discord.Net,LassieME/Discord.Net,Confruggy/Discord.Net,RogueException/Discord.Net | src/Discord.Net.Core/Entities/Messages/IMessage.cs | src/Discord.Net.Core/Entities/Messages/IMessage.cs | using System;
using System.Collections.Generic;
namespace Discord
{
public interface IMessage : ISnowflakeEntity, IDeletable
{
/// <summary> Gets the type of this system message. </summary>
MessageType Type { get; }
/// <summary> Returns true if this message was sent as a text-to-speech message. </summary>
bool IsTTS { get; }
/// <summary> Returns true if this message was added to its channel's pinned messages. </summary>
bool IsPinned { get; }
/// <summary> Returns true if this message was created using a webhook. </summary>
bool IsWebhook { get; }
/// <summary> Returns the content for this message. </summary>
string Content { get; }
/// <summary> Gets the time this message was sent. </summary>
DateTimeOffset Timestamp { get; }
/// <summary> Gets the time of this message's last edit, if any. </summary>
DateTimeOffset? EditedTimestamp { get; }
/// <summary> Gets the channel this message was sent to. </summary>
IMessageChannel Channel { get; }
/// <summary> Gets the author of this message. </summary>
IUser Author { get; }
/// <summary> Gets the id of the webhook used to created this message, if any. </summary>
ulong? WebhookId { get; }
/// <summary> Returns all attachments included in this message. </summary>
IReadOnlyCollection<IAttachment> Attachments { get; }
/// <summary> Returns all embeds included in this message. </summary>
IReadOnlyCollection<IEmbed> Embeds { get; }
/// <summary> Returns all tags included in this message's content. </summary>
IReadOnlyCollection<ITag> Tags { get; }
/// <summary> Returns the ids of channels mentioned in this message. </summary>
IReadOnlyCollection<ulong> MentionedChannelIds { get; }
/// <summary> Returns the ids of roles mentioned in this message. </summary>
IReadOnlyCollection<ulong> MentionedRoleIds { get; }
/// <summary> Returns the ids of users mentioned in this message. </summary>
IReadOnlyCollection<ulong> MentionedUserIds { get; }
}
}
| using System;
using System.Collections.Generic;
namespace Discord
{
public interface IMessage : ISnowflakeEntity
{
/// <summary> Gets the type of this system message. </summary>
MessageType Type { get; }
/// <summary> Returns true if this message was sent as a text-to-speech message. </summary>
bool IsTTS { get; }
/// <summary> Returns true if this message was added to its channel's pinned messages. </summary>
bool IsPinned { get; }
/// <summary> Returns true if this message was created using a webhook. </summary>
bool IsWebhook { get; }
/// <summary> Returns the content for this message. </summary>
string Content { get; }
/// <summary> Gets the time this message was sent. </summary>
DateTimeOffset Timestamp { get; }
/// <summary> Gets the time of this message's last edit, if any. </summary>
DateTimeOffset? EditedTimestamp { get; }
/// <summary> Gets the channel this message was sent to. </summary>
IMessageChannel Channel { get; }
/// <summary> Gets the author of this message. </summary>
IUser Author { get; }
/// <summary> Gets the id of the webhook used to created this message, if any. </summary>
ulong? WebhookId { get; }
/// <summary> Returns all attachments included in this message. </summary>
IReadOnlyCollection<IAttachment> Attachments { get; }
/// <summary> Returns all embeds included in this message. </summary>
IReadOnlyCollection<IEmbed> Embeds { get; }
/// <summary> Returns all tags included in this message's content. </summary>
IReadOnlyCollection<ITag> Tags { get; }
/// <summary> Returns the ids of channels mentioned in this message. </summary>
IReadOnlyCollection<ulong> MentionedChannelIds { get; }
/// <summary> Returns the ids of roles mentioned in this message. </summary>
IReadOnlyCollection<ulong> MentionedRoleIds { get; }
/// <summary> Returns the ids of users mentioned in this message. </summary>
IReadOnlyCollection<ulong> MentionedUserIds { get; }
}
} | mit | C# |
72c830cc1c7e2b598b9891d23ca58088d880e0a5 | increment minor version, | jwChung/Experimentalism,jwChung/Experimentalism | build/CommonAssemblyInfo.cs | build/CommonAssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.12.0")]
[assembly: AssemblyInformationalVersion("0.12.0")]
/*
* Version 0.12.0
*
* - [NEW] ConstructingMemberAssertionTestCases
* This verifies members initialized correctly by a constructor.
*
* [FirstClassTheorem]
* public IEnumerable<ITestCase> DemoOnTypeLevel()
* {
* return new GuardClauseAssertionTestCases(typeof(Foo));
* }
*
* [FirstClassTheorem]
* public IEnumerable<ITestCase> DemoOnAssemblyLevel()
* {
* return new GuardClauseAssertionTestCases(typeof(Foo).Assembly);
* }
*/ | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.11.0")]
[assembly: AssemblyInformationalVersion("0.11.0")]
/*
* Version 0.12.0
*
* - [NEW] ConstructingMemberAssertionTestCases
* This verifies members initialized correctly by a constructor.
*
* [FirstClassTheorem]
* public IEnumerable<ITestCase> DemoOnTypeLevel()
* {
* return new GuardClauseAssertionTestCases(typeof(Foo));
* }
*
* [FirstClassTheorem]
* public IEnumerable<ITestCase> DemoOnAssemblyLevel()
* {
* return new GuardClauseAssertionTestCases(typeof(Foo).Assembly);
* }
*/ | mit | C# |
b9e5ff94ef042bc52420d712b2813d4ce804778b | add release note for ConstructingMemberAssertionTestCases. | jwChung/Experimentalism,jwChung/Experimentalism | build/CommonAssemblyInfo.cs | build/CommonAssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.11.0")]
[assembly: AssemblyInformationalVersion("0.11.0")]
/*
* Version 0.12.0
*
* - [NEW] ConstructingMemberAssertionTestCases
* This verifies members initialized correctly by a constructor.
*
* [FirstClassTheorem]
* public IEnumerable<ITestCase> DemoOnTypeLevel()
* {
* return new GuardClauseAssertionTestCases(typeof(Foo));
* }
*
* [FirstClassTheorem]
* public IEnumerable<ITestCase> DemoOnAssemblyLevel()
* {
* return new GuardClauseAssertionTestCases(typeof(Foo).Assembly);
* }
*/ | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.11.0")]
[assembly: AssemblyInformationalVersion("0.11.0")]
/*
* Version 0.11.0
*
* Supports guard clause test-cases on assembly level.
*
* [FirstClassTheorem]
* public IEnumerable<ITestCase> Demo()
* {
* return new GuardClauseAssertionTestCases(typeof(Foo).Assembly);
* }
*/ | mit | C# |
104b12550922ecc7fed4869dd831a0d998e32255 | increment patch version, | jwChung/Experimentalism,jwChung/Experimentalism | build/CommonAssemblyInfo.cs | build/CommonAssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.8.19")]
[assembly: AssemblyInformationalVersion("0.8.19")]
/*
* Version 0.8.19
*
* This version lets the xunit.extensions.dll library is copied to a output
* directory of a target project but prevents it from being directly added
* to references of the project.
*/ | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.8.18")]
[assembly: AssemblyInformationalVersion("0.8.18")]
/*
* Version 0.8.18
*
* This version publishes the Experiment nuget package again.
*/ | mit | C# |
68c5f208b6597a36cef07fd2450e8dc59bf529df | Fix for Google Analytics Service name | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EAS.Web/Models/GoogleAnalyticsModel.cs | src/SFA.DAS.EAS.Web/Models/GoogleAnalyticsModel.cs | using System;
using System.Configuration;
using Microsoft.Azure;
using SFA.DAS.Configuration;
using SFA.DAS.Configuration.AzureTableStorage;
using SFA.DAS.Configuration.FileStorage;
using SFA.DAS.EAS.Domain.Configuration;
namespace SFA.DAS.EAS.Web.Models
{
public class GoogleAnalyticsModel
{
private const string ServiceName = "SFA.DAS.GoogleAnalyticsValues";
private static GoogleAnalyticsModel _instance;
private GoogleAnalyticsModel()
{
GetConfiguration();
}
public static GoogleAnalyticsModel Instance
{
get
{
if (_instance == null)
{
_instance = new GoogleAnalyticsModel();
}
return _instance;
}
}
public string GoogleHeaderUrl { get; private set; }
public string GoogleBodyUrl { get; private set; }
public void GetConfiguration()
{
var environment = Environment.GetEnvironmentVariable("DASENV");
if (string.IsNullOrEmpty(environment))
{
environment = CloudConfigurationManager.GetSetting("EnvironmentName");
}
var configurationRepository = GetConfigurationRepository();
var configurationService = new ConfigurationService(configurationRepository,
new ConfigurationOptions(ServiceName, environment, "1.0"));
PopulateGoogleEnvironmentDetails(configurationService.Get<GoogleAnalyticsSnippets>());
}
private void PopulateGoogleEnvironmentDetails(GoogleAnalyticsSnippets environmentConfig)
{
GoogleHeaderUrl = environmentConfig.GoogleAnalyticsValues.GoogleHeaderUrl;
GoogleBodyUrl = environmentConfig.GoogleAnalyticsValues.GoogleBodyUrl;
}
private static IConfigurationRepository GetConfigurationRepository()
{
IConfigurationRepository configurationRepository;
if (bool.Parse(ConfigurationManager.AppSettings["LocalConfig"]))
{
configurationRepository = new FileStorageConfigurationRepository();
}
else
{
configurationRepository = new AzureTableStorageConfigurationRepository(CloudConfigurationManager.GetSetting("ConfigurationStorageConnectionString"));
}
return configurationRepository;
}
}
} | using System;
using System.Configuration;
using Microsoft.Azure;
using SFA.DAS.Configuration;
using SFA.DAS.Configuration.AzureTableStorage;
using SFA.DAS.Configuration.FileStorage;
using SFA.DAS.EAS.Domain.Configuration;
namespace SFA.DAS.EAS.Web.Models
{
public class GoogleAnalyticsModel
{
private const string ServiceName = "SFA.DAS.GoogleAnalytics";
private const string ServiceNamespace = "SFA.DAS";
private static GoogleAnalyticsModel _instance;
private GoogleAnalyticsModel()
{
GetConfiguration();
}
public static GoogleAnalyticsModel Instance
{
get
{
if (_instance == null)
{
_instance = new GoogleAnalyticsModel();
}
return _instance;
}
}
public string GoogleHeaderUrl { get; private set; }
public string GoogleBodyUrl { get; private set; }
public void GetConfiguration()
{
var environment = Environment.GetEnvironmentVariable("DASENV");
if (string.IsNullOrEmpty(environment))
{
environment = CloudConfigurationManager.GetSetting("EnvironmentName");
}
var configurationRepository = GetConfigurationRepository();
var configurationService = new ConfigurationService(configurationRepository,
new ConfigurationOptions(ServiceName, environment, "1.0"));
PopulateGoogleEnvironmentDetails(configurationService.Get<GoogleAnalyticsSnippets>());
}
private void PopulateGoogleEnvironmentDetails(GoogleAnalyticsSnippets environmentConfig)
{
GoogleHeaderUrl = environmentConfig.GoogleAnalyticsValues.GoogleHeaderUrl;
GoogleBodyUrl = environmentConfig.GoogleAnalyticsValues.GoogleBodyUrl;
}
private static IConfigurationRepository GetConfigurationRepository()
{
IConfigurationRepository configurationRepository;
if (bool.Parse(ConfigurationManager.AppSettings["LocalConfig"]))
{
configurationRepository = new FileStorageConfigurationRepository();
}
else
{
configurationRepository = new AzureTableStorageConfigurationRepository(CloudConfigurationManager.GetSetting("ConfigurationStorageConnectionString"));
}
return configurationRepository;
}
}
} | mit | C# |
3031b6692e08973469fc3b4d7ec2734dd0a8c8d1 | fix dispose warning | bcuff/dd-trace-csharp | src/DataDog.Tracing/TraceContextScope.cs | src/DataDog.Tracing/TraceContextScope.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace DataDog.Tracing
{
/// <summary>
/// Sets up the TraceContext.Current with the specified trace.
/// </summary>
public sealed class TraceContextScope : IDisposable
{
readonly ISpan _old;
ISpan _span;
public TraceContextScope(ISpan span)
{
_span = span;
_old = TraceContext.Current;
TraceContext.Current = span;
}
public void Dispose()
{
var span = _span;
_span = null;
var c = TraceContext.Current;
if (c != span) throw new InvalidOperationException("Overlapped scopes are not allowed.");
TraceContext.Current = _old;
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace DataDog.Tracing
{
/// <summary>
/// Sets up the TraceContext.Current with the specified trace.
/// </summary>
public class TraceContextScope : IDisposable
{
readonly ISpan _old;
ISpan _span;
public TraceContextScope(ISpan span)
{
_span = span;
_old = TraceContext.Current;
TraceContext.Current = span;
}
public void Dispose()
{
var span = _span;
_span = null;
var c = TraceContext.Current;
if (c != span) throw new InvalidOperationException("Overlapped scopes are not allowed.");
TraceContext.Current = _old;
}
}
}
| apache-2.0 | C# |
3fbd9ddd6b2fc0db207ca625038ba9db0e50aa7e | Remove unused usings | lecaillon/Evolve | src/Evolve/Migration/MigrationVersion.cs | src/Evolve/Migration/MigrationVersion.cs | using Evolve.Utilities;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Evolve.Migration
{
public class MigrationVersion
{
public MigrationVersion(string version)
{
Check.NotNullOrEmpty(version, nameof(version));
Version = version.Replace('_', '.');
if (!MatchPattern.IsMatch(Version)) throw new EvolveConfigurationException();
VersionParts = Version.Split('.').Select(int.Parse).ToList();
}
public static Regex MatchPattern => new Regex("^[0-9]+(?:.[0-9]+)*$");
public string Version { get; private set; }
public List<int> VersionParts { get; set; }
}
}
| using Evolve.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Evolve.Migration
{
public class MigrationVersion
{
public MigrationVersion(string version)
{
Check.NotNullOrEmpty(version, nameof(version));
Version = version.Replace('_', '.');
if (!MatchPattern.IsMatch(Version)) throw new EvolveConfigurationException();
VersionParts = Version.Split('.').Select(int.Parse).ToList();
}
public static Regex MatchPattern => new Regex("^[0-9]+(?:.[0-9]+)*$");
public string Version { get; private set; }
public List<int> VersionParts { get; set; }
}
}
| mit | C# |
5733e00c4077eeef2a5f14cdd471960063d660a4 | Move timing in program | fluttert/AdventOfCode | AdventOfCode/Program.cs | AdventOfCode/Program.cs | using System;
using System.Diagnostics;
namespace AdventOfCode
{
internal class AdventOfCode
{
private static void Main()
{
var aoc = new AdventOfCode();
// Change this to the day you want to run
aoc.Solve(new Year2015.Day08());
//aoc.Solve(new Year2015.Day07());
//aoc.Solve(new Year2015.Day06());
//aoc.Solve(new Year2015.Day05());
//aoc.Solve(new Year2015.Day04()); // slow: 18370ms
//aoc.Solve(new Year2015.Day03());
//aoc.Solve(new Year2015.Day02());
//aoc.Solve(new Year2015.Day01());
// timing
Console.ReadLine();
}
public void Solve(IAoC aoc)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
Console.WriteLine($"{aoc.GetType().Name}, part 1: {aoc.SolvePart1(aoc.GetInput())}");
Console.WriteLine($"{aoc.GetType().Name}, part 2: {aoc.SolvePart2(aoc.GetInput())}");
Console.WriteLine("");
Console.WriteLine($"Execution time was about {stopwatch.ElapsedMilliseconds}ms");
}
}
} | using System;
using System.Diagnostics;
namespace AdventOfCode
{
internal class AdventOfCode
{
private static void Main()
{
var aoc = new AdventOfCode();
var stopwatch = new Stopwatch();
stopwatch.Start();
// Change this to the day you want to run
aoc.Solve(new Year2015.Day08());
//aoc.Solve(new Year2015.Day07());
//aoc.Solve(new Year2015.Day06());
//aoc.Solve(new Year2015.Day05());
//aoc.Solve(new Year2015.Day04()); // slow: 18370ms
//aoc.Solve(new Year2015.Day03());
//aoc.Solve(new Year2015.Day02());
//aoc.Solve(new Year2015.Day01());
// timing
Console.WriteLine("");
Console.WriteLine($"Execution time was about {stopwatch.ElapsedMilliseconds}ms");
Console.ReadLine();
}
public void Solve(IAoC aoc)
{
Console.WriteLine($"{aoc.GetType().Name}, part 1: {aoc.SolvePart1(aoc.GetInput())}");
Console.WriteLine($"{aoc.GetType().Name}, part 2: {aoc.SolvePart2(aoc.GetInput())}");
}
}
} | mit | C# |
aea03409a37d3f35379bcbb94d2e68bb5abb6746 | Fix url of api test | andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,gmartin7/myBloomFork,JohnThomson/BloomDesktop,gmartin7/myBloomFork,gmartin7/myBloomFork,JohnThomson/BloomDesktop,andrew-polk/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,StephenMcConnel/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,andrew-polk/BloomDesktop,BloomBooks/BloomDesktop,andrew-polk/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop | src/BloomTests/web/ReadersApiTests.cs | src/BloomTests/web/ReadersApiTests.cs | using Bloom.Api;
using Bloom.Book;
using Bloom.Collection;
using NUnit.Framework;
namespace BloomTests.web
{
[TestFixture]
public class ReadersApiTests
{
private EnhancedImageServer _server;
[SetUp]
public void Setup()
{
var bookSelection = new BookSelection();
bookSelection.SelectBook(new Bloom.Book.Book());
_server = new EnhancedImageServer(bookSelection);
//needed to avoid a check in the server
_server.CurrentCollectionSettings = new CollectionSettings();
var controller = new ReadersApi(bookSelection);
controller.RegisterWithServer(_server);
}
[TearDown]
public void TearDown()
{
_server.Dispose();
_server = null;
}
[Test]
public void IsReceivingApiCalls()
{
var result = ApiTest.GetString(_server,"readers/io/test");
Assert.That(result, Is.EqualTo("OK"));
}
}
} | using Bloom.Api;
using Bloom.Book;
using Bloom.Collection;
using NUnit.Framework;
namespace BloomTests.web
{
[TestFixture]
public class ReadersApiTests
{
private EnhancedImageServer _server;
[SetUp]
public void Setup()
{
var bookSelection = new BookSelection();
bookSelection.SelectBook(new Bloom.Book.Book());
_server = new EnhancedImageServer(bookSelection);
//needed to avoid a check in the server
_server.CurrentCollectionSettings = new CollectionSettings();
var controller = new ReadersApi(bookSelection);
controller.RegisterWithServer(_server);
}
[TearDown]
public void TearDown()
{
_server.Dispose();
_server = null;
}
[Test]
public void IsReceivingApiCalls()
{
var result = ApiTest.GetString(_server,"readers/test");
Assert.That(result, Is.EqualTo("OK"));
}
}
} | mit | C# |
c4fa3e6b20259addf3893c7003c6d3bbdfc816a8 | clean xml | kleberksms/StaticCommons | src/StaticCommons/Class/Inflector/XML.cs | src/StaticCommons/Class/Inflector/XML.cs |
using System.Xml;
using System.Xml.Serialization;
namespace StaticCommons.Class.Inflector
{
/**
* Base
* https://stackoverflow.com/questions/11447529/convert-an-object-to-an-xml-string
*/
public static class Xml
{
public static string ToXml(this object obj)
{
var stringwriter = new System.IO.StringWriter();
var serializer = new XmlSerializer(obj.GetType());
serializer.Serialize(stringwriter, obj);
return stringwriter.ToString();
}
public static string ToCleanXml(this object obj)
{
var emptyNamepsaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty });
var serializer = new XmlSerializer(obj.GetType());
var settings = new XmlWriterSettings
{
Indent = true,
OmitXmlDeclaration = true
};
using (var stream = new System.IO.StringWriter())
using (var writer = XmlWriter.Create(stream, settings))
{
serializer.Serialize(writer, obj, emptyNamepsaces);
return stream.ToString();
}
}
public static T ToObject<T>(string xmlText)
{
var stringReader = new System.IO.StringReader(xmlText);
var serializer = new XmlSerializer(typeof(T));
return (T) serializer.Deserialize(stringReader);
}
}
}
|
using System.Xml.Serialization;
namespace StaticCommons.Class.Inflector
{
/**
* Base
* https://stackoverflow.com/questions/11447529/convert-an-object-to-an-xml-string
*/
public static class Xml
{
public static string ToXml(this object obj)
{
var stringwriter = new System.IO.StringWriter();
var serializer = new XmlSerializer(obj.GetType());
serializer.Serialize(stringwriter, obj);
return stringwriter.ToString();
}
public static T ToObject<T>(string xmlText)
{
var stringReader = new System.IO.StringReader(xmlText);
var serializer = new XmlSerializer(typeof(T));
return (T) serializer.Deserialize(stringReader);
}
}
}
| mit | C# |
5eb8aea74ab40f77a9b23a4c5a620b769ca0d84b | fix line endings in findreplace code | c960657/dd-agent,zendesk/dd-agent,AniruddhaSAtre/dd-agent,indeedops/dd-agent,guruxu/dd-agent,urosgruber/dd-agent,takus/dd-agent,zendesk/dd-agent,JohnLZeller/dd-agent,Wattpad/dd-agent,GabrielNicolasAvellaneda/dd-agent,joelvanvelden/dd-agent,zendesk/dd-agent,takus/dd-agent,eeroniemi/dd-agent,amalakar/dd-agent,benmccann/dd-agent,jvassev/dd-agent,GabrielNicolasAvellaneda/dd-agent,joelvanvelden/dd-agent,takus/dd-agent,joelvanvelden/dd-agent,Wattpad/dd-agent,joelvanvelden/dd-agent,relateiq/dd-agent,pmav99/praktoras,PagerDuty/dd-agent,pmav99/praktoras,benmccann/dd-agent,lookout/dd-agent,indeedops/dd-agent,urosgruber/dd-agent,PagerDuty/dd-agent,jyogi/purvar-agent,relateiq/dd-agent,guruxu/dd-agent,jamesandariese/dd-agent,a20012251/dd-agent,ess/dd-agent,c960657/dd-agent,zendesk/dd-agent,tebriel/dd-agent,AntoCard/powerdns-recursor_check,urosgruber/dd-agent,huhongbo/dd-agent,lookout/dd-agent,Shopify/dd-agent,Shopify/dd-agent,jvassev/dd-agent,remh/dd-agent,joelvanvelden/dd-agent,jraede/dd-agent,JohnLZeller/dd-agent,JohnLZeller/dd-agent,polynomial/dd-agent,cberry777/dd-agent,gphat/dd-agent,polynomial/dd-agent,jraede/dd-agent,oneandoneis2/dd-agent,AniruddhaSAtre/dd-agent,Wattpad/dd-agent,a20012251/dd-agent,Mashape/dd-agent,cberry777/dd-agent,jamesandariese/dd-agent,darron/dd-agent,benmccann/dd-agent,tebriel/dd-agent,Mashape/dd-agent,jshum/dd-agent,oneandoneis2/dd-agent,truthbk/dd-agent,jshum/dd-agent,Mashape/dd-agent,jyogi/purvar-agent,jshum/dd-agent,c960657/dd-agent,pmav99/praktoras,ess/dd-agent,lookout/dd-agent,relateiq/dd-agent,indeedops/dd-agent,polynomial/dd-agent,indeedops/dd-agent,darron/dd-agent,PagerDuty/dd-agent,gphat/dd-agent,cberry777/dd-agent,Mashape/dd-agent,a20012251/dd-agent,Wattpad/dd-agent,pfmooney/dd-agent,GabrielNicolasAvellaneda/dd-agent,Shopify/dd-agent,huhongbo/dd-agent,gphat/dd-agent,citrusleaf/dd-agent,takus/dd-agent,truthbk/dd-agent,pfmooney/dd-agent,jraede/dd-agent,guruxu/dd-agent,GabrielNicolasAvellaneda/dd-agent,lookout/dd-agent,citrusleaf/dd-agent,mderomph-coolblue/dd-agent,amalakar/dd-agent,packetloop/dd-agent,c960657/dd-agent,indeedops/dd-agent,jyogi/purvar-agent,Shopify/dd-agent,packetloop/dd-agent,jyogi/purvar-agent,brettlangdon/dd-agent,manolama/dd-agent,amalakar/dd-agent,truthbk/dd-agent,pfmooney/dd-agent,huhongbo/dd-agent,eeroniemi/dd-agent,packetloop/dd-agent,tebriel/dd-agent,Mashape/dd-agent,jshum/dd-agent,oneandoneis2/dd-agent,yuecong/dd-agent,AntoCard/powerdns-recursor_check,benmccann/dd-agent,yuecong/dd-agent,ess/dd-agent,Wattpad/dd-agent,PagerDuty/dd-agent,amalakar/dd-agent,oneandoneis2/dd-agent,cberry777/dd-agent,GabrielNicolasAvellaneda/dd-agent,brettlangdon/dd-agent,jvassev/dd-agent,lookout/dd-agent,jamesandariese/dd-agent,darron/dd-agent,darron/dd-agent,citrusleaf/dd-agent,pmav99/praktoras,gphat/dd-agent,takus/dd-agent,mderomph-coolblue/dd-agent,polynomial/dd-agent,urosgruber/dd-agent,jamesandariese/dd-agent,mderomph-coolblue/dd-agent,c960657/dd-agent,manolama/dd-agent,manolama/dd-agent,jamesandariese/dd-agent,ess/dd-agent,remh/dd-agent,relateiq/dd-agent,AntoCard/powerdns-recursor_check,brettlangdon/dd-agent,yuecong/dd-agent,AntoCard/powerdns-recursor_check,pfmooney/dd-agent,Shopify/dd-agent,manolama/dd-agent,a20012251/dd-agent,citrusleaf/dd-agent,pfmooney/dd-agent,manolama/dd-agent,yuecong/dd-agent,pmav99/praktoras,remh/dd-agent,benmccann/dd-agent,amalakar/dd-agent,relateiq/dd-agent,mderomph-coolblue/dd-agent,truthbk/dd-agent,jyogi/purvar-agent,packetloop/dd-agent,mderomph-coolblue/dd-agent,cberry777/dd-agent,jshum/dd-agent,a20012251/dd-agent,eeroniemi/dd-agent,PagerDuty/dd-agent,polynomial/dd-agent,AniruddhaSAtre/dd-agent,gphat/dd-agent,zendesk/dd-agent,guruxu/dd-agent,huhongbo/dd-agent,eeroniemi/dd-agent,jraede/dd-agent,truthbk/dd-agent,AntoCard/powerdns-recursor_check,tebriel/dd-agent,ess/dd-agent,jraede/dd-agent,AniruddhaSAtre/dd-agent,packetloop/dd-agent,remh/dd-agent,guruxu/dd-agent,jvassev/dd-agent,remh/dd-agent,huhongbo/dd-agent,oneandoneis2/dd-agent,tebriel/dd-agent,AniruddhaSAtre/dd-agent,JohnLZeller/dd-agent,citrusleaf/dd-agent,brettlangdon/dd-agent,jvassev/dd-agent,brettlangdon/dd-agent,yuecong/dd-agent,urosgruber/dd-agent,JohnLZeller/dd-agent,eeroniemi/dd-agent,darron/dd-agent | packaging/datadog-agent/win32/wix/FindReplace/Program.cs | packaging/datadog-agent/win32/wix/FindReplace/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace FindReplace
{
class Program
{
static void Main(string[] args)
{
if (args.Length != 3)
{
Console.Write("Usage: FindReplace.exe path_to_file search_text replace_text\n");
return;
}
// Load in the arguments from the user
String filePath = args[0];
String searchText = args[1];
String replaceText = args[2];
// Don't overwrite the text with nothing
if (replaceText.Trim() == "")
{
return;
}
// If we are given "key: val" but val doesn't exist, don't do the replacement
String[] parts = replaceText.Split(new string[] {":"}, StringSplitOptions.None);
if (parts.Length == 2 && parts[1].Trim() == "")
{
return;
}
// Read the contents of the file
String contents;
try
{
contents = File.ReadAllText(filePath);
}
catch (Exception e)
{
Console.Write(String.Format("Unable to open file {0}, {1}", filePath, e));
return;
}
// Replace all instances of the text in the file
contents = contents.Replace(searchText, replaceText);
// Write it back to the file
try
{
File.WriteAllText(filePath, contents);
}
catch (Exception e)
{
Console.Write(String.Format("Unable to write contents to file {0}, {1}", filePath, e));
return;
}
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace FindReplace
{
class Program
{
static void Main(string[] args)
{
if (args.Length != 3)
{
Console.Write("Usage: FindReplace.exe path_to_file search_text replace_text\n");
return;
}
// Load in the arguments from the user
String filePath = args[0];
String searchText = args[1];
String replaceText = args[2];
// Don't overwrite the text with nothing
if (replaceText.Trim() == "")
{
return;
}
// If we are given "key: val" but val doesn't exist, don't do the replacement
String[] parts = replaceText.Split(new string[] {":"}, StringSplitOptions.None);
if (parts.Length == 2 && parts[1].Trim() == "")
{
return;
}
// Read the contents of the file
String contents;
try
{
contents = File.ReadAllText(filePath);
}
catch (Exception e)
{
Console.Write(String.Format("Unable to open file {0}, {1}", filePath, e));
return;
}
// Replace all instances of the text in the file
contents = contents.Replace(searchText, replaceText);
// Write it back to the file
try
{
File.WriteAllText(filePath, contents);
}
catch (Exception e)
{
Console.Write(String.Format("Unable to write contents to file {0}, {1}", filePath, e));
return;
}
}
}
} | bsd-3-clause | C# |
238eb1a964f6a8ac2f4a0cbb62dbfa6af7b7ae47 | Update RyanYates.cs | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/RyanYates.cs | src/Firehose.Web/Authors/RyanYates.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 RyanYatesMVP : IFilterMyBlogPosts, IAmAMicrosoftMVP
{
public string FirstName => "Ryan";
public string LastName => "Yates";
public string ShortBioOrTagLine => "is a Microsoft MVP, Consultant at Black Marble, Lead Coordinator for UK PowerShell User Groups.";
public string StateOrRegion => "England, UK";
public string EmailAddress => "ryan.yates@kilasuit.org";
public string TwitterHandle => "ryanyates1990";
public string GravatarHash => "3dfa95e0c1d6efa49d57dfd89010d0a7";
public GeoPosition Position => new GeoPosition(53.690760, -1.629070);
public Uri WebSite => new Uri("https://blog.kilasuit.org/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://blog.kilasuit.org/index.xml"); }
}
public string GitHubHandle => "kilasuit";
public string FeedLanguageCode => "en";
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class RyanYatesMVP : IFilterMyBlogPosts, IAmAMicrosoftMVP
{
public string FirstName => "Ryan";
public string LastName => "Yates";
public string ShortBioOrTagLine => "is a Microsoft MVP, Consultant at Black Marble, Lead Coordinator for UK PowerShell User Groups.";
public string StateOrRegion => "England, UK";
public string EmailAddress => "ryan.yates@kilasuit.org";
public string TwitterHandle => "ryanyates1990";
public string GravatarHash => "3dfa95e0c1d6efa49d57dfd89010d0a7";
public GeoPosition Position => new GeoPosition(53.690760, -1.629070);
public Uri WebSite => new Uri("https://blog.kilasuit.org/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://blog.kilasuit.org/feed/"); }
}
public string GitHubHandle => "kilasuit";
public bool Filter(SyndicationItem item)
{
return item.Categories?.Any(c => c.Name.ToLowerInvariant().Contains("powershell")) ?? false;
}
public string FeedLanguageCode => "en";
}
}
| mit | C# |
dc6c18a6e0672a1677746a847d8e19b123dc5726 | Update QuorumAccount.cs | Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum | src/Nethereum.Quorum/QuorumAccount.cs | src/Nethereum.Quorum/QuorumAccount.cs | using Nethereum.Signer;
using Nethereum.Web3.Accounts;
using System.Numerics;
namespace Nethereum.Quorum
{
public class QuorumAccount : Account
{
public QuorumAccount(EthECKey key) : base(key)
{
}
public QuorumAccount(string privateKey, BigInteger? chainId = null) : base(privateKey, chainId)
{
}
public QuorumAccount(byte[] privateKey, BigInteger? chainId = null) : base(privateKey, chainId)
{
}
protected override void InitialiseDefaultTransactionManager()
{
TransactionManager = new QuorumTransactionManager(null, null, this);
}
}
}
| using Nethereum.Signer;
using Nethereum.Web3.Accounts;
namespace Nethereum.Quorum
{
public class QuorumAccount : Account
{
public QuorumAccount(EthECKey key):base(key)
{
}
public QuorumAccount(string privateKey):base(privateKey)
{
}
public QuorumAccount(byte[] privateKey):base(privateKey)
{
}
protected override void InitialiseDefaultTransactionManager()
{
TransactionManager = new QuorumTransactionManager(null, null, this);
}
}
}
| mit | C# |
606c3b4a7849b259a33e8e79952b5dbb6d283003 | Refactor deserialization | mstrother/BmpListener | src/BmpListener/Bmp/BmpHeader.cs | src/BmpListener/Bmp/BmpHeader.cs | using BmpListener.MiscUtil.Conversion;
using System;
namespace BmpListener.Bmp
{
public class BmpHeader
{
public BmpHeader()
{
}
public BmpHeader(byte[] data)
{
Decode(data);
}
public byte Version { get; private set; }
public int MessageLength { get; private set; }
public BmpMessageType MessageType { get; private set; }
public void Decode(byte[] data)
{
Version = data[0];
if (Version != 3)
{
throw new NotSupportedException("version error");
}
MessageLength = EndianBitConverter.Big.ToInt32(data, 1);
MessageType = (BmpMessageType)data[5];
}
}
} | using BmpListener.MiscUtil.Conversion;
using System;
using System.Linq;
namespace BmpListener.Bmp
{
public class BmpHeader
{
public BmpHeader()
{
}
public BmpHeader(byte[] data)
{
Decode(data);
}
private readonly int bmpVersion = 3;
EndianBitConverter bigEndianBitConverter = EndianBitConverter.Big;
public byte Version { get; private set; }
public int MessageLength { get; private set; }
public BmpMessageType MessageType { get; private set; }
public void Decode(byte[] data)
{
Version = data[0];
if (Version != bmpVersion)
{
throw new NotSupportedException("version error");
}
MessageLength = bigEndianBitConverter.ToInt32(data, 1);
MessageType = (BmpMessageType)data.ElementAt(5);
}
}
} | mit | C# |
3c8728124e4e5090ee371e8aa30bdeaf4901e57e | Rename FQDN Tag cmdlet to include AzureRMPrefix | ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell | src/ResourceManager/Network/Commands.Network/AzureFirewallFqdnTag/GetAzureFirewallFqdnTagCmdlet.cs | src/ResourceManager/Network/Commands.Network/AzureFirewallFqdnTag/GetAzureFirewallFqdnTagCmdlet.cs | // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Network.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
using Microsoft.Azure.Management.Network;
using Microsoft.Azure.Management.Network.Models;
using Microsoft.Rest.Azure;
namespace Microsoft.Azure.Commands.Network
{
[Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "FirewallFqdnTag"), OutputType(typeof(PSAzureFirewallFqdnTag), typeof(IEnumerable<PSAzureFirewallFqdnTag>))]
public class GetAzureFirewallFqdnTagCommand : NetworkBaseCmdlet
{
private IAzureFirewallFqdnTagsOperations AzureFirewallFqdnTagClient
{
get
{
return NetworkClient.NetworkManagementClient.AzureFirewallFqdnTags;
}
}
public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
IPage<AzureFirewallFqdnTag> azureFirewallFqdnTagPage = this.AzureFirewallFqdnTagClient.ListAll();
// Get all resources by polling on next page link
var azfwFqdnTagsResponseLIst = ListNextLink<AzureFirewallFqdnTag>.GetAllResourcesByPollingNextLink(azureFirewallFqdnTagPage, this.AzureFirewallFqdnTagClient.ListAllNext);
var psAzureFirewallFqdnTags = azfwFqdnTagsResponseLIst.Select(ToPsAzureFirewallFqdnTag).ToList();
WriteObject(psAzureFirewallFqdnTags, true);
}
public PSAzureFirewallFqdnTag ToPsAzureFirewallFqdnTag(AzureFirewallFqdnTag fqdnTag)
{
var azfwFqdnTag = NetworkResourceManagerProfile.Mapper.Map<PSAzureFirewallFqdnTag>(fqdnTag);
azfwFqdnTag.Tag = TagsConversionHelper.CreateTagHashtable(fqdnTag.Tags);
return azfwFqdnTag;
}
}
}
| // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Network.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
using Microsoft.Azure.Management.Network;
using Microsoft.Azure.Management.Network.Models;
using Microsoft.Rest.Azure;
namespace Microsoft.Azure.Commands.Network
{
[Cmdlet(VerbsCommon.Get, "AzureRmFirewallFqdnTag"), OutputType(typeof(PSAzureFirewallFqdnTag), typeof(IEnumerable<PSAzureFirewallFqdnTag>))]
public class GetAzureFirewallFqdnTagCommand : NetworkBaseCmdlet
{
private IAzureFirewallFqdnTagsOperations AzureFirewallFqdnTagClient
{
get
{
return NetworkClient.NetworkManagementClient.AzureFirewallFqdnTags;
}
}
public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
IPage<AzureFirewallFqdnTag> azureFirewallFqdnTagPage = this.AzureFirewallFqdnTagClient.ListAll();
// Get all resources by polling on next page link
var azfwFqdnTagsResponseLIst = ListNextLink<AzureFirewallFqdnTag>.GetAllResourcesByPollingNextLink(azureFirewallFqdnTagPage, this.AzureFirewallFqdnTagClient.ListAllNext);
var psAzureFirewallFqdnTags = azfwFqdnTagsResponseLIst.Select(ToPsAzureFirewallFqdnTag).ToList();
WriteObject(psAzureFirewallFqdnTags, true);
}
public PSAzureFirewallFqdnTag ToPsAzureFirewallFqdnTag(AzureFirewallFqdnTag fqdnTag)
{
var azfwFqdnTag = NetworkResourceManagerProfile.Mapper.Map<PSAzureFirewallFqdnTag>(fqdnTag);
azfwFqdnTag.Tag = TagsConversionHelper.CreateTagHashtable(fqdnTag.Tags);
return azfwFqdnTag;
}
}
}
| apache-2.0 | C# |
33a34c6678e7b63d7a1f1a3996ac73e2ff47405f | update version to 1.3.56.0 | agileharbor/shipStationAccess | src/Global/GlobalAssemblyInfo.cs | src/Global/GlobalAssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.InteropServices;
[ assembly : ComVisible( false ) ]
[ assembly : AssemblyProduct( "ShipStationAccess" ) ]
[ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ]
[ assembly : AssemblyCopyright( "Copyright (C) Agile Harbor, LLC" ) ]
[ assembly : AssemblyDescription( "ShipStation webservices API wrapper." ) ]
[ assembly : AssemblyTrademark( "" ) ]
[ assembly : AssemblyCulture( "" ) ]
[ assembly : CLSCompliant( false ) ]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
// Keep in track with CA API version
[ assembly : AssemblyVersion( "1.3.56.0" ) ] | using System;
using System.Reflection;
using System.Runtime.InteropServices;
[ assembly : ComVisible( false ) ]
[ assembly : AssemblyProduct( "ShipStationAccess" ) ]
[ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ]
[ assembly : AssemblyCopyright( "Copyright (C) Agile Harbor, LLC" ) ]
[ assembly : AssemblyDescription( "ShipStation webservices API wrapper." ) ]
[ assembly : AssemblyTrademark( "" ) ]
[ assembly : AssemblyCulture( "" ) ]
[ assembly : CLSCompliant( false ) ]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
// Keep in track with CA API version
[ assembly : AssemblyVersion( "1.3.54.0" ) ] | bsd-3-clause | C# |
0fe07e157f982c8c211585a331b047ad3c61bf63 | prepend "is" to bool | smbc-digital/iag-contentapi | src/StockportContentApi/Model/Link.cs | src/StockportContentApi/Model/Link.cs | namespace StockportContentApi.Model
{
public record Link(string Url, string Text, bool IsExternal);
}
| namespace StockportContentApi.Model
{
public record Link(string Url, string Text, bool External);
}
| mit | C# |
2d43338495ac47c430903dcedd29e0c75260d3db | Fix PullRequest property to be long. | nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke | source/Nuke.Common/BuildServers/Bitrise.cs | source/Nuke.Common/BuildServers/Bitrise.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.Linq;
using JetBrains.Annotations;
using static Nuke.Common.EnvironmentInfo;
namespace Nuke.Common.BuildServers
{
/// <summary>
/// Interface according to the <a href="http://devcenter.bitrise.io/faq/available-environment-variables/#exposed-by-bitriseio">official website</a>.
/// </summary>
[PublicAPI]
[BuildServer]
public class Bitrise
{
private static Lazy<Bitrise> s_instance = new Lazy<Bitrise>(() => new Bitrise());
public static Bitrise Instance => NukeBuild.Instance?.Host == HostType.Bitrise ? s_instance.Value : null;
internal static bool IsRunningBitrise => Environment.GetEnvironmentVariable("BITRISE_BUILD_URL") != null;
private static DateTime ConvertUnixTimestamp(long timestamp)
{
return new DateTime(year: 1970, month: 1, day: 1, hour: 0, minute: 0, second: 0, kind: DateTimeKind.Utc)
.AddSeconds(value: 1501444668)
.ToLocalTime();
}
internal Bitrise()
{
}
public string BuildUrl => Variable("BITRISE_BUILD_URL");
public long BuildNumber => Variable<long>("BITRISE_BUILD_NUMBER");
public string AppTitle => Variable("BITRISE_APP_TITLE");
public string AppUrl => Variable("BITRISE_APP_URL");
public string AppSlug => Variable("BITRISE_APP_SLUG");
public string BuildSlug => Variable("BITRISE_BUILD_SLUG");
public DateTime BuildTriggerTimestamp => ConvertUnixTimestamp(Variable<long>("BITRISE_BUILD_TRIGGER_TIMESTAMP"));
public string RepositoryUrl => Variable("GIT_REPOSITORY_URL");
public string GitBranch => Variable("BITRISE_GIT_BRANCH");
[CanBeNull] public string GitTag => Variable("BITRISE_GIT_TAG");
[CanBeNull] public string GitCommit => Variable("BITRISE_GIT_COMMIT");
[CanBeNull] public string GitMessage => Variable("BITRISE_GIT_MESSAGE");
[CanBeNull] public long? PullRequest => Variable<long?>("BITRISE_PULL_REQUEST");
[CanBeNull] public string ProvisionUrl => Variable("BITRISE_PROVISION_URL");
[CanBeNull] public string CertificateUrl => Variable("BITRISE_CERTIFICATE_URL");
[CanBeNull] public string CertificatePassphrase => Variable("BITRISE_CERTIFICATE_PASSPHRASE");
}
}
| // Copyright Matthias Koch, Sebastian Karasek 2018.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using JetBrains.Annotations;
using static Nuke.Common.EnvironmentInfo;
namespace Nuke.Common.BuildServers
{
/// <summary>
/// Interface according to the <a href="http://devcenter.bitrise.io/faq/available-environment-variables/#exposed-by-bitriseio">official website</a>.
/// </summary>
[PublicAPI]
[BuildServer]
public class Bitrise
{
private static Lazy<Bitrise> s_instance = new Lazy<Bitrise>(() => new Bitrise());
public static Bitrise Instance => NukeBuild.Instance?.Host == HostType.Bitrise ? s_instance.Value : null;
internal static bool IsRunningBitrise => Environment.GetEnvironmentVariable("BITRISE_BUILD_URL") != null;
private static DateTime ConvertUnixTimestamp(long timestamp)
{
return new DateTime(year: 1970, month: 1, day: 1, hour: 0, minute: 0, second: 0, kind: DateTimeKind.Utc)
.AddSeconds(value: 1501444668)
.ToLocalTime();
}
internal Bitrise()
{
}
public string BuildUrl => Variable("BITRISE_BUILD_URL");
public long BuildNumber => Variable<long>("BITRISE_BUILD_NUMBER");
public string AppTitle => Variable("BITRISE_APP_TITLE");
public string AppUrl => Variable("BITRISE_APP_URL");
public string AppSlug => Variable("BITRISE_APP_SLUG");
public string BuildSlug => Variable("BITRISE_BUILD_SLUG");
public DateTime BuildTriggerTimestamp => ConvertUnixTimestamp(Variable<long>("BITRISE_BUILD_TRIGGER_TIMESTAMP"));
public string RepositoryUrl => Variable("GIT_REPOSITORY_URL");
public string GitBranch => Variable("BITRISE_GIT_BRANCH");
[CanBeNull] public string GitTag => Variable("BITRISE_GIT_TAG");
[CanBeNull] public string GitCommit => Variable("BITRISE_GIT_COMMIT");
[CanBeNull] public string GitMessage => Variable("BITRISE_GIT_MESSAGE");
[CanBeNull] public string PullRequest => Variable("BITRISE_PULL_REQUEST");
[CanBeNull] public string ProvisionUrl => Variable("BITRISE_PROVISION_URL");
[CanBeNull] public string CertificateUrl => Variable("BITRISE_CERTIFICATE_URL");
[CanBeNull] public string CertificatePassphrase => Variable("BITRISE_CERTIFICATE_PASSPHRASE");
}
}
| mit | C# |
4fb4f788217c7ace6c59e5ded38c6dfdbf774130 | remove unused using statements | kreeben/resin,kreeben/resin | src/ResinCore/DocumentPosting.cs | src/ResinCore/DocumentPosting.cs | using System.Diagnostics;
namespace Resin
{
[DebuggerDisplay("{DocumentId}:{Position}")]
public class DocumentPosting
{
public int DocumentId { get; private set; }
public int Position { get; set; }
public DocumentPosting(int documentId, int position)
{
DocumentId = documentId;
Position = position;
}
public override string ToString()
{
return string.Format("{0}:{1}", DocumentId, Position);
}
}
[DebuggerDisplay("{DocumentId}:{Position}")]
public struct Posting
{
public int DocumentId { get; private set; }
public int Position { get; set; }
public Posting(int documentId, int position)
{
DocumentId = documentId;
Position = position;
}
public override string ToString()
{
return string.Format("{0}:{1}", DocumentId, Position);
}
}
} | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace Resin
{
[DebuggerDisplay("{DocumentId}:{Position}")]
public class DocumentPosting
{
public int DocumentId { get; private set; }
public int Position { get; set; }
public DocumentPosting(int documentId, int position)
{
DocumentId = documentId;
Position = position;
}
public override string ToString()
{
return string.Format("{0}:{1}", DocumentId, Position);
}
}
[DebuggerDisplay("{DocumentId}:{Position}")]
public struct Posting
{
public int DocumentId { get; private set; }
public int Position { get; set; }
public Posting(int documentId, int position)
{
DocumentId = documentId;
Position = position;
}
public override string ToString()
{
return string.Format("{0}:{1}", DocumentId, Position);
}
}
} | mit | C# |
a1bfaeca53fa2ffd48084449487988f16022a224 | Make AppDeleteCommand implement ICommand | appharbor/appharbor-cli | src/AppHarbor/Commands/AppDeleteCommand.cs | src/AppHarbor/Commands/AppDeleteCommand.cs | using System;
namespace AppHarbor.Commands
{
public class AppDeleteCommand : ICommand
{
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| namespace AppHarbor.Commands
{
public class AppDeleteCommand
{
}
}
| mit | C# |
e443594a291f434921dfa5fabdef0e6a8ab6ec04 | Prepare for 2017.0.0 beta1. | sshnet/SSH.NET | src/Renci.SshNet/Properties/CommonAssemblyInfo.cs | src/Renci.SshNet/Properties/CommonAssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyDescription("SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.")]
[assembly: AssemblyCompany("Renci")]
[assembly: AssemblyProduct("SSH.NET")]
[assembly: AssemblyCopyright("Copyright Renci 2010-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2017.0.0")]
[assembly: AssemblyFileVersion("2017.0.0")]
[assembly: AssemblyInformationalVersion("2017.0.0-beta1")]
[assembly: CLSCompliant(false)]
// 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)]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif | using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyDescription("SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.")]
[assembly: AssemblyCompany("Renci")]
[assembly: AssemblyProduct("SSH.NET")]
[assembly: AssemblyCopyright("Copyright Renci 2010-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2016.1.0")]
[assembly: AssemblyFileVersion("2016.1.0")]
[assembly: AssemblyInformationalVersion("2016.1.0-beta4")]
[assembly: CLSCompliant(false)]
// 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)]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif | mit | C# |
9aede25a9ea7cddf2d28e8f68cf23572881c0940 | Make ETag readonly and update the GetHashCode method. | ayeletshpigelman/azure-sdk-for-net,hyonholee/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,stankovski/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,hyonholee/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jamestao/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jamestao/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,jamestao/azure-sdk-for-net,jamestao/azure-sdk-for-net,hyonholee/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,hyonholee/azure-sdk-for-net,stankovski/azure-sdk-for-net,markcowl/azure-sdk-for-net,hyonholee/azure-sdk-for-net | src/SDKs/Azure.Core/data-plane/Azure.Core/ETag.cs | src/SDKs/Azure.Core/data-plane/Azure.Core/ETag.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.ComponentModel;
using System.Text;
namespace Azure.Core
{
public readonly struct ETag : IEquatable<ETag>
{
readonly byte[] _ascii;
public ETag(string etag) => _ascii = Encoding.ASCII.GetBytes(etag);
public bool Equals(ETag other)
{
return this._ascii == other._ascii;
}
public override int GetHashCode() => _ascii.GetHashCode();
public static bool operator ==(ETag left, ETag rigth)
=> left.Equals(rigth);
public static bool operator !=(ETag left, ETag rigth)
=> !left.Equals(rigth);
public override string ToString()
=> Encoding.ASCII.GetString(_ascii);
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
{
if (obj is ETag other) return this == other;
return false;
}
}
}
| // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.ComponentModel;
using System.Text;
namespace Azure.Core
{
public struct ETag : IEquatable<ETag>
{
byte[] _ascii;
public ETag(string etag) => _ascii = Encoding.ASCII.GetBytes(etag);
public bool Equals(ETag other)
{
return this._ascii == other._ascii;
}
public override int GetHashCode() => 0;
public static bool operator ==(ETag left, ETag rigth)
=> left.Equals(rigth);
public static bool operator !=(ETag left, ETag rigth)
=> !left.Equals(rigth);
public override string ToString()
=> Encoding.ASCII.GetString(_ascii);
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
{
if (obj is ETag other) return this == other;
return false;
}
}
}
| mit | C# |
ca3775529edb05e40f72c6477e725bfe0c109cab | introduce constructor with Android.Drawing.Typeface | lytico/xwt-mobile,lytico/xwt-mobile | src/Xwt.Droid/Xwt.DroidBackend/FontData.cs | src/Xwt.Droid/Xwt.DroidBackend/FontData.cs | //
// FontData.cs
//
// Author:
// Lytico
//
// Copyright (c) 2014 Lytico (http://www.limada.org)
//
// 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 Android.Graphics;
using Xwt.Drawing;
namespace Xwt.DroidBackend
{
public class FontData
{
public FontData ()
{
Stretch = FontStretch.Normal;
Weight = FontWeight.Normal;
Style = FontStyle.Normal;
}
internal FontData (Typeface typeface) {
_family = typeface.FamilyName();
_style = typeface.Style.ToXwt ();
_typeface = typeface;
}
Typeface _typeface = null;
public Typeface Typeface {
get {
if (_typeface == null) {
_typeface = Typeface.Create (Family, this.Style.ToDroid ());
}
return _typeface;
}
}
string _family = null;
public string Family {
get { return _family; }
set {
if (value != _family) {
_typeface = null;
}
_family = value;
}
}
FontStyle _style;
public FontStyle Style {
get { return _style; }
set {
if (_style != value)
_typeface = null;
_style = value;
}
}
public double Size {
get;
set;
}
public FontWeight Weight { get; set; }
public FontStretch Stretch { get; set; }
public void CopyFrom (Font font)
{
Family = font.Family;
Size = font.Size;
Style = font.Style;
Weight = font.Weight;
Stretch = font.Stretch;
}
public void CopyFrom (FontData font)
{
Family = font.Family;
Size = font.Size;
Style = font.Style;
Weight = font.Weight;
Stretch = font.Stretch;
}
public FontData Clone() {
var result = new FontData ();
result.CopyFrom (this);
return result;
}
public static FontData Default {
get {
return new FontData(Typeface.Default) {
Size = 10,
};
}
}
}
} | //
// FontData.cs
//
// Author:
// Lytico
//
// Copyright (c) 2014 Lytico (http://www.limada.org)
//
// 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 Android.Graphics;
using Xwt.Drawing;
namespace Xwt.DroidBackend
{
public class FontData
{
public FontData ()
{
Stretch = FontStretch.Normal;
Weight = FontWeight.Normal;
Style = FontStyle.Normal;
}
Typeface _typeface = null;
public Typeface Typeface {
get {
if (_typeface == null) {
_typeface = Typeface.Create (Family, this.Style.ToDroid ());
}
return _typeface;
}
}
string _family = null;
public string Family {
get { return _family; }
set {
if (value != _family) {
_typeface = null;
}
_family = value;
}
}
FontStyle _style;
public FontStyle Style {
get { return _style; }
set {
if (_style != value)
_typeface = null;
_style = value;
}
}
public double Size {
get;
set;
}
public FontWeight Weight { get; set; }
public FontStretch Stretch { get; set; }
public void CopyFrom (Font font)
{
Family = font.Family;
Size = font.Size;
Style = font.Style;
Weight = font.Weight;
Stretch = font.Stretch;
}
public void CopyFrom (FontData font)
{
Family = font.Family;
Size = font.Size;
Style = font.Style;
Weight = font.Weight;
Stretch = font.Stretch;
}
public FontData Clone() {
var result = new FontData ();
result.CopyFrom (this);
return result;
}
public static FontData Default {
get {
return new FontData {
Family = "sans-serif",
Size = 10,
};
}
}
}
} | mit | C# |
aa2277d8319842acdab6dc4df0dbda28d62b0481 | Update server side API for single multiple answer question | Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist | Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs | Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs | using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRepository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOption);
_dbContext.SaveChanges();
}
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SaveChanges();
}
/// <summary>
/// Add option of single multiple answer question into SingleMultipleAnswerQuestionOption model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
public void AddSingleMultipleAnswerQuestionOption(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOption);
_dbContext.SaveChanges();
}
}
}
| using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRepository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOption);
_dbContext.SaveChanges();
}
/// <summary>
/// Adding single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SaveChanges();
}
}
}
| mit | C# |
441ab4d231404f77b65f1ff884d1e1460dbc0697 | Move local function. | FacilityApi/FacilityCSharp | tools/Build/Build.cs | tools/Build/Build.cs | using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Faithlife.Build;
using static Faithlife.Build.AppRunner;
using static Faithlife.Build.BuildUtility;
using static Faithlife.Build.DotNetRunner;
internal static class Build
{
public static int Main(string[] args) => BuildRunner.Execute(args, build =>
{
var codegen = "fsdgencsharp";
var dotNetTools = new DotNetTools(Path.Combine("tools", "bin")).AddSource(Path.Combine("tools", "bin"));
var dotNetBuildSettings = new DotNetBuildSettings
{
DocsSettings = new DotNetDocsSettings
{
GitLogin = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
GitAuthor = new GitAuthorInfo("FacilityApiBot", "facilityapi@gmail.com"),
SourceCodeUrl = "https://github.com/FacilityApi/FacilityCSharp/tree/master/src",
},
DotNetTools = dotNetTools,
ProjectUsesSourceLink = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
};
build.AddDotNetTargets(dotNetBuildSettings);
build.Target("codegen")
.DependsOn("build")
.Does(() => codeGen(verify: false));
build.Target("verify-codegen")
.DependsOn("build")
.Does(() => codeGen(verify: true));
build.Target("test")
.DependsOn("verify-codegen");
build.Target("default")
.DependsOn("build");
void codeGen(bool verify)
{
string configuration = dotNetBuildSettings.BuildOptions.ConfigurationOption.Value;
string versionSuffix = $"cg{DateTime.UtcNow:yyyyMMddHHmmss}";
RunDotNet("pack", Path.Combine("src", codegen, $"{codegen}.csproj"), "-c", configuration, "--no-build",
"--output", Path.GetFullPath(Path.Combine("tools", "bin")), "--version-suffix", versionSuffix);
string packagePath = FindFiles($"tools/bin/{codegen}.*-{versionSuffix}.nupkg").Single();
string packageVersion = Regex.Match(packagePath, @"[/\\][^/\\]*\.([0-9]+\.[0-9]+\.[0-9]+(-.+)?)\.nupkg$").Groups[1].Value;
string toolPath = dotNetTools.GetToolPath($"{codegen}/{packageVersion}");
string verifyOption = verify ? "--verify" : null;
RunApp(toolPath, "fsd/FacilityCore.fsd", "src/Facility.Core/", verifyOption);
RunApp(toolPath, "conformance/ConformanceApi.fsd", "tools/Facility.ConformanceApi/", "--clean", verifyOption);
RunApp(toolPath, "tools/EdgeCases.fsd", "tools/EdgeCases/", "--clean", verifyOption);
}
});
}
| using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Faithlife.Build;
using static Faithlife.Build.AppRunner;
using static Faithlife.Build.BuildUtility;
using static Faithlife.Build.DotNetRunner;
internal static class Build
{
public static int Main(string[] args) => BuildRunner.Execute(args, build =>
{
var codegen = "fsdgencsharp";
var dotNetTools = new DotNetTools(Path.Combine("tools", "bin")).AddSource(Path.Combine("tools", "bin"));
var dotNetBuildSettings = new DotNetBuildSettings
{
DocsSettings = new DotNetDocsSettings
{
GitLogin = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
GitAuthor = new GitAuthorInfo("FacilityApiBot", "facilityapi@gmail.com"),
SourceCodeUrl = "https://github.com/FacilityApi/Facility/tree/master/src",
},
DotNetTools = dotNetTools,
ProjectUsesSourceLink = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
};
build.AddDotNetTargets(dotNetBuildSettings);
void codeGen(bool verify)
{
string configuration = dotNetBuildSettings.BuildOptions.ConfigurationOption.Value;
string versionSuffix = $"cg{DateTime.UtcNow:yyyyMMddHHmmss}";
RunDotNet("pack", Path.Combine("src", codegen, $"{codegen}.csproj"), "-c", configuration, "--no-build",
"--output", Path.GetFullPath(Path.Combine("tools", "bin")), "--version-suffix", versionSuffix);
string packagePath = FindFiles($"tools/bin/{codegen}.*-{versionSuffix}.nupkg").Single();
string packageVersion = Regex.Match(packagePath, @"[/\\][^/\\]*\.([0-9]+\.[0-9]+\.[0-9]+(-.+)?)\.nupkg$").Groups[1].Value;
string toolPath = dotNetTools.GetToolPath($"{codegen}/{packageVersion}");
string verifyOption = verify ? "--verify" : null;
RunApp(toolPath, "fsd/FacilityCore.fsd", "src/Facility.Core/", verifyOption);
RunApp(toolPath, "conformance/ConformanceApi.fsd", "tools/Facility.ConformanceApi/", "--clean", verifyOption);
RunApp(toolPath, "tools/EdgeCases.fsd", "tools/EdgeCases/", "--clean", verifyOption);
}
build.Target("codegen")
.DependsOn("build")
.Does(() => codeGen(verify: false));
build.Target("verify-codegen")
.DependsOn("build")
.Does(() => codeGen(verify: true));
build.Target("test")
.DependsOn("verify-codegen");
build.Target("default")
.DependsOn("build");
});
}
| mit | C# |
8353ced91f636bb7f994de7719d41b360153d9cc | use BenchmarkSwitcher | benjamin-hodgson/Pidgin | Pidgin.Bench/Program.cs | Pidgin.Bench/Program.cs | using BenchmarkDotNet.Running;
namespace Pidgin.Bench
{
public class Program
{
static void Main()
{
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).RunAll();
}
}
}
| using BenchmarkDotNet.Running;
namespace Pidgin.Bench
{
public class Program
{
static void Main()
{
BenchmarkRunner.Run<StringBench>();
BenchmarkRunner.Run<NumberBench>();
BenchmarkRunner.Run<JsonBench>();
BenchmarkRunner.Run<ExpressionBench>();
}
}
}
| mit | C# |
cc576b16fc5ca00bdcd55f51a58f85163f6cddd4 | Remove unused variable. | queueit/FeatureSwitcher.AwsConfiguration | src/FeatureSwitcher.AwsConfiguration/Behaviours/InStringListBehaviour.cs | src/FeatureSwitcher.AwsConfiguration/Behaviours/InStringListBehaviour.cs | using System.Collections.Generic;
using Microsoft.CSharp.RuntimeBinder;
namespace FeatureSwitcher.AwsConfiguration.Behaviours
{
public abstract class InStringListBehaviour : IBehaviour
{
private HashSet<string> _list = new HashSet<string>();
public bool? Behaviour(Feature.Name name)
{
return this.IsInList();
}
public void SetConfiguration(dynamic configValue)
{
if (configValue == null)
return;
try
{
this._list = this.DeserializeList(configValue);
}
catch (RuntimeBinderException)
{
// fallback to false;
}
}
protected bool IsInList(string value)
{
if (value == null)
return false;
return this._list.Contains(value);
}
protected abstract bool IsInList();
private HashSet<string> DeserializeList(dynamic configValue)
{
HashSet<string> itemsInList = new HashSet<string>();
var list = configValue["L"];
for (int i = 0; i < list.Count; i++)
{
string value = list[i]["S"].ToString();
if (!itemsInList.Contains(value))
itemsInList.Add(value);
}
return itemsInList;
}
}
}
| using System.Collections.Generic;
using Microsoft.CSharp.RuntimeBinder;
namespace FeatureSwitcher.AwsConfiguration.Behaviours
{
public abstract class InStringListBehaviour : IBehaviour
{
private HashSet<string> _list = new HashSet<string>();
public bool? Behaviour(Feature.Name name)
{
return this.IsInList();
}
public void SetConfiguration(dynamic configValue)
{
if (configValue == null)
return;
try
{
this._list = this.DeserializeList(configValue);
}
catch (RuntimeBinderException ex)
{
// fallback to false;
}
}
protected bool IsInList(string value)
{
if (value == null)
return false;
return this._list.Contains(value);
}
protected abstract bool IsInList();
private HashSet<string> DeserializeList(dynamic configValue)
{
HashSet<string> itemsInList = new HashSet<string>();
var list = configValue["L"];
for (int i = 0; i < list.Count; i++)
{
string value = list[i]["S"].ToString();
if (!itemsInList.Contains(value))
itemsInList.Add(value);
}
return itemsInList;
}
}
}
| apache-2.0 | C# |
6d98b17df9a8be4c3ad17d0c0c979a9e1f4e096c | Update ThemingFileProvider.cs (#868) | stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,OrchardCMS/Brochard,lukaskabrt/Orchard2,petedavis/Orchard2,petedavis/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,lukaskabrt/Orchard2,OrchardCMS/Brochard,lukaskabrt/Orchard2,xkproject/Orchard2,lukaskabrt/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2 | src/OrchardCore/Orchard.DisplayManagement/Theming/ThemingFileProvider.cs | src/OrchardCore/Orchard.DisplayManagement/Theming/ThemingFileProvider.cs | using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Primitives;
namespace Orchard.DisplayManagement.Theming
{
/// <summary>
/// This custom <see cref="IFileProvider"/> implementation provides the file contents
/// necessary to override the default Layout system from Razor with a Shape based one.
/// </summary>
public class ThemingFileProvider : IFileProvider
{
private readonly ContentFileInfo _viewImportsFileInfo;
public ThemingFileProvider()
{
_viewImportsFileInfo = new ContentFileInfo("_ViewImports.cshtml", "@inherits Orchard.DisplayManagement.Razor.RazorPage<TModel>");
}
public IDirectoryContents GetDirectoryContents(string subpath)
{
return null;
}
public IFileInfo GetFileInfo(string subpath)
{
if (subpath == "/_ViewImports.cshtml")
{
return _viewImportsFileInfo;
}
return null;
}
public IChangeToken Watch(string filter)
{
return null;
}
}
}
| using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Primitives;
namespace Orchard.DisplayManagement.Theming
{
/// <summary>
/// This custom <see cref="IFileProvider"/> implementation provides the file contents
/// necessary to override the default Layout system from Razor with a Shape based one.
/// </summary>
public class ThemingFileProvider : IFileProvider
{
private readonly ContentFileInfo _viewImportsFileInfo;
public ThemingFileProvider()
{
_viewImportsFileInfo = new ContentFileInfo("_ViewImports.cshtml", "@inherits Orchard.DisplayManagement.Razor.RazorPage<TModel>");
}
public IDirectoryContents GetDirectoryContents(string subpath)
{
return null;
}
public IFileInfo GetFileInfo(string subpath)
{
if (subpath == "/Views/_ViewImports.cshtml")
{
return _viewImportsFileInfo;
}
return null;
}
public IChangeToken Watch(string filter)
{
return null;
}
}
}
| bsd-3-clause | C# |
01a963ebc2413de4c438a1b13fb62420b3134a98 | Fix for model namespace issue following latest master merge | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EmployerAccounts.Web/ViewModels/AccountDashboardViewModel.cs | src/SFA.DAS.EmployerAccounts.Web/ViewModels/AccountDashboardViewModel.cs | using System;
using System.Collections.Generic;
using System.Linq;
using SFA.DAS.Authorization;
using SFA.DAS.EAS.Portal.Client.Types;
using SFA.DAS.EmployerAccounts.Models.Account;
namespace SFA.DAS.EmployerAccounts.Web.ViewModels
{
public class AccountDashboardViewModel
{
public EmployerAccounts.Models.Account.Account Account { get; set; }
public string EmployerAccountType { get; set; }
public string HashedAccountId { get; set; }
public string HashedUserId { get; set; }
public int OrgainsationCount { get; set; }
public int PayeSchemeCount { get; set; }
public int RequiresAgreementSigning { get; set; }
public bool ShowAcademicYearBanner { get; set; }
public bool ShowWizard { get; set; }
public ICollection<AccountTask> Tasks { get; set; }
public int TeamMemberCount { get; set; }
public int TeamMembersInvited { get; set; }
public string UserFirstName { get; set; }
public Role UserRole { get; set; }
public bool AgreementsToSign { get; set; }
public int SignedAgreementCount { get; set; }
public List<PendingAgreementsViewModel> PendingAgreements { get; set; }
public bool ApprenticeshipAdded { get; set; }
public bool ShowSearchBar { get; set; }
public bool ShowMostActiveLinks { get; set; }
public EAS.Portal.Client.Types.Account AccountViewModel { get; set; }
public Guid? RecentlyAddedReservationId { get; set; }
public Reservation ReservedFundingToShow => AccountViewModel?.Organisations?.SelectMany(org => org.Reservations).FirstOrDefault(rf => rf.Id == RecentlyAddedReservationId) ?? AccountViewModel?.Organisations?.SelectMany(org => org.Reservations)?.LastOrDefault();
public string ReservedFundingOrgName => AccountViewModel?.Organisations?.Where(org => org.Reservations.Contains(ReservedFundingToShow)).Select(org => org.Name).FirstOrDefault();
public bool ShowReservations => AccountViewModel?.Organisations?.FirstOrDefault().Reservations?.Count > 0;
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using SFA.DAS.Authorization;
using SFA.DAS.EAS.Portal.Client.Types;
using SFA.DAS.EmployerAccounts.Models.Account;
namespace SFA.DAS.EmployerAccounts.Web.ViewModels
{
public class AccountDashboardViewModel
{
public Models.Account.Account Account { get; set; }
public string EmployerAccountType { get; set; }
public string HashedAccountId { get; set; }
public string HashedUserId { get; set; }
public int OrgainsationCount { get; set; }
public int PayeSchemeCount { get; set; }
public int RequiresAgreementSigning { get; set; }
public bool ShowAcademicYearBanner { get; set; }
public bool ShowWizard { get; set; }
public ICollection<AccountTask> Tasks { get; set; }
public int TeamMemberCount { get; set; }
public int TeamMembersInvited { get; set; }
public string UserFirstName { get; set; }
public Role UserRole { get; set; }
public bool AgreementsToSign { get; set; }
public int SignedAgreementCount { get; set; }
public List<PendingAgreementsViewModel> PendingAgreements { get; set; }
public bool ApprenticeshipAdded { get; set; }
public bool ShowSearchBar { get; set; }
public bool ShowMostActiveLinks { get; set; }
public EAS.Portal.Client.Types.Account AccountViewModel { get; set; }
public Guid? RecentlyAddedReservationId { get; set; }
public Reservation ReservedFundingToShow => AccountViewModel?.Organisations?.SelectMany(org => org.Reservations).FirstOrDefault(rf => rf.Id == RecentlyAddedReservationId) ?? AccountViewModel?.Organisations?.SelectMany(org => org.Reservations)?.LastOrDefault();
public string ReservedFundingOrgName => AccountViewModel?.Organisations?.Where(org => org.Reservations.Contains(ReservedFundingToShow)).Select(org => org.Name).FirstOrDefault();
public bool ShowReservations => AccountViewModel?.Organisations?.FirstOrDefault().Reservations?.Count > 0;
}
} | mit | C# |
db5824d99099ca9fb990e8f1c08811184410cdd5 | Add tracing to awesomium closing on exception | sjoerd222888/MVVM.CEF.Glue,David-Desmaisons/Neutronium,NeutroniumCore/Neutronium,sjoerd222888/MVVM.CEF.Glue,NeutroniumCore/Neutronium,sjoerd222888/MVVM.CEF.Glue,David-Desmaisons/Neutronium,NeutroniumCore/Neutronium,David-Desmaisons/Neutronium | HTMLEngine/Awesomium/HTMLEngine.Awesomium/AwesomiumWPFWebWindowFactory.cs | HTMLEngine/Awesomium/HTMLEngine.Awesomium/AwesomiumWPFWebWindowFactory.cs | using System.Diagnostics;
using System.Threading;
using Awesomium.Core;
using HTML_WPF.Component;
namespace HTMLEngine.Awesomium
{
public class AwesomiumWPFWebWindowFactory : IWPFWebWindowFactory
{
private static WebConfig _WebConfig = new WebConfig() { RemoteDebuggingPort = 8001, RemoteDebuggingHost = "127.0.0.1" };
private static WebSession _Session = null;
static AwesomiumWPFWebWindowFactory()
{
WebCore.Started += (o, e) => { WebCoreThread = Thread.CurrentThread; };
if (!WebCore.IsInitialized)
{
WebCore.Initialize(_WebConfig);
WebCore.ShuttingDown += WebCore_ShuttingDown;
}
}
private static void WebCore_ShuttingDown(object sender, CoreShutdownEventArgs e)
{
if (e.Exception == null)
return;
Trace.WriteLine(string.Format("HTMLEngine.Awesomium : WebCoreShutting Down, due to exception: {0}", e.Exception));
}
public static Thread WebCoreThread { get; internal set; }
public AwesomiumWPFWebWindowFactory(string iWebSessionPath=null)
{
if (_Session == null)
{
_Session = (iWebSessionPath != null) ?
WebCore.CreateWebSession(iWebSessionPath, new WebPreferences()) :
WebCore.CreateWebSession(new WebPreferences());
}
}
public string EngineName
{
get { return "Chromium 19"; }
}
public string Name
{
get { return "Awesomium"; }
}
public IWPFWebWindow Create()
{
return new AwesomiumWPFWebWindow(_Session, _WebConfig);
}
public void Dispose()
{
if (_Session != null)
_Session.Dispose();
WebCore.Shutdown();
}
}
}
| using System.Threading;
using Awesomium.Core;
using HTML_WPF.Component;
namespace HTMLEngine.Awesomium
{
public class AwesomiumWPFWebWindowFactory : IWPFWebWindowFactory
{
private static WebConfig _WebConfig = new WebConfig() { RemoteDebuggingPort = 8001, RemoteDebuggingHost = "127.0.0.1" };
private static WebSession _Session = null;
static AwesomiumWPFWebWindowFactory()
{
WebCore.Started += (o, e) => { WebCoreThread = Thread.CurrentThread; };
if (!WebCore.IsInitialized)
WebCore.Initialize(_WebConfig);
}
public static Thread WebCoreThread { get; internal set; }
public AwesomiumWPFWebWindowFactory(string iWebSessionPath=null)
{
if (_Session == null)
{
_Session = (iWebSessionPath != null) ?
WebCore.CreateWebSession(iWebSessionPath, new WebPreferences()) :
WebCore.CreateWebSession(new WebPreferences());
}
}
public string EngineName
{
get { return "Chromium 19"; }
}
public string Name
{
get { return "Awesomium"; }
}
public IWPFWebWindow Create()
{
return new AwesomiumWPFWebWindow(_Session, _WebConfig);
}
public void Dispose()
{
if (_Session != null)
_Session.Dispose();
WebCore.Shutdown();
}
}
}
| mit | C# |
e7f41982bea4131c761844fb54c17a18e092996f | Update CreateObjectAction.cs | UnityTechnologies/PlaygroundProject,UnityTechnologies/PlaygroundProject | PlaygroundProject/Assets/Scripts/Conditions/Actions/CreateObjectAction.cs | PlaygroundProject/Assets/Scripts/Conditions/Actions/CreateObjectAction.cs | using UnityEngine;
using System.Collections;
[AddComponentMenu("Playground/Actions/Create Object")]
public class CreateObjectAction : Action
{
public GameObject prefabToCreate;
public Vector2 newPosition;
public bool relativeToThisObject;
void Update ()
{
if (relativeToThisObject)
{
newPosition = (Vector2)transform.localPosition + newPosition;
}
}
// Moves the gameObject instantly to a custom position
public override bool ExecuteAction(GameObject dataObject)
{
if(prefabToCreate != null)
{
//create the new object by copying the prefab
GameObject newObject = Instantiate<GameObject>(prefabToCreate);
//let's place it in the desired position!
newObject.transform.position = newPosition;
return true;
}
else
{
return false;
}
}
}
| using UnityEngine;
using System.Collections;
[AddComponentMenu("Playground/Actions/Create Object")]
public class CreateObjectAction : Action
{
public GameObject prefabToCreate;
public Vector2 newPosition;
public bool relative;
void Update ()
{
if (relative)
{
newPosition = transform.localPosition;
}
}
// Moves the gameObject instantly to a custom position
public override bool ExecuteAction(GameObject dataObject)
{
if(prefabToCreate != null)
{
//create the new object by copying the prefab
GameObject newObject = Instantiate<GameObject>(prefabToCreate);
//let's place it in the desired position!
newObject.transform.position = newPosition;
return true;
}
else
{
return false;
}
}
}
| mit | C# |
465dbce4bc38b4069131503a21bf2e84dc4ff8d8 | Order accommodations by PublishedDate | ahmedmatem/vs-bgb,ahmedmatem/vs-bgb,ahmedmatem/vs-bgb | BGB.WebAPI/Controllers/AccommodationsController.cs | BGB.WebAPI/Controllers/AccommodationsController.cs | namespace BGB.WebAPI.Controllers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Data.Common.Repository;
using Models;
using ViewModels;
using System.Data.Entity;
using Data;
[RoutePrefix("api/accommodations")]
public class AccommodationsController : BaseController
{
// GET api/accommodations/id
public HttpResponseMessage Get(int id)
{
AccommodationAd result = context.AccommodationAds.Find(id);
if(result == null)
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
return Request.CreateResponse(HttpStatusCode.OK, result);
}
// GET api/accommodations/all
[Route("All")]
public HttpResponseMessage GetAll()
{
var result = context.AccommodationAds
.OrderBy(x => x.PublishedDate)
.Select(a => a)
.ToList<AccommodationAd>();
if (result == null)
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
return Request.CreateResponse(HttpStatusCode.OK, new { accommodations = result });
}
// POST api/accommodations/save
[Route("Save")]
public IHttpActionResult Post(AccViewModel model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
var accomodationAd = new AccommodationAd()
{
Title = model.Title,
Author = model.Author,
Content = model.Content,
PublishedDate = DateTime.Now
};
context.AccommodationAds.Add(accomodationAd);
context.SaveChanges();
return Ok();
}
}
}
| namespace BGB.WebAPI.Controllers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Data.Common.Repository;
using Models;
using ViewModels;
using System.Data.Entity;
using Data;
[RoutePrefix("api/accommodations")]
public class AccommodationsController : BaseController
{
// GET api/accommodations/id
public HttpResponseMessage Get(int id)
{
AccommodationAd result = context.AccommodationAds.Find(id);
if(result == null)
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
return Request.CreateResponse(HttpStatusCode.OK, result);
}
// GET api/accommodations/all
[Route("All")]
public HttpResponseMessage GetAll()
{
var result = context.AccommodationAds
.Select(a => a)
.ToList<AccommodationAd>();
if (result == null)
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
return Request.CreateResponse(HttpStatusCode.OK, new { accommodations = result });
}
// POST api/accommodations/save
[Route("Save")]
public IHttpActionResult Post(AccViewModel model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
var accomodationAd = new AccommodationAd()
{
Title = model.Title,
Author = model.Author,
Content = model.Content,
PublishedDate = DateTime.Now
};
context.AccommodationAds.Add(accomodationAd);
context.SaveChanges();
return Ok();
}
}
}
| mit | C# |
de891b0fd26c129d54de9328b82b02124217e51a | use rx.net for dataflow toenumerable in tests | ArsenShnurkov/BitSharp | BitSharp.Common.Test/ExtensionMethods.cs | BitSharp.Common.Test/ExtensionMethods.cs | using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks.Dataflow;
using System.Reactive.Linq;
namespace BitSharp.Common.Test
{
public static class ExtensionMethods
{
public static IEnumerable<T> ToEnumerable<T>(this ISourceBlock<T> source, CancellationToken cancelToken = default(CancellationToken))
{
return source.AsObservable().ToEnumerable();
}
public static BufferBlock<T> ToBufferBlock<T>(this IEnumerable<T> items)
{
var bufferBlock = new BufferBlock<T>();
foreach (var item in items)
bufferBlock.Post(item);
bufferBlock.Complete();
return bufferBlock;
}
}
}
| using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks.Dataflow;
namespace BitSharp.Common.Test
{
public static class ExtensionMethods
{
public static IEnumerable<T> ToEnumerable<T>(this ISourceBlock<T> source, CancellationToken cancelToken = default(CancellationToken))
{
while (source.OutputAvailableAsync(cancelToken).Result)
{
yield return source.Receive(cancelToken);
}
source.Completion.Wait();
}
public static BufferBlock<T> ToBufferBlock<T>(this IEnumerable<T> items)
{
var bufferBlock = new BufferBlock<T>();
foreach (var item in items)
bufferBlock.Post(item);
bufferBlock.Complete();
return bufferBlock;
}
}
}
| unlicense | C# |
4e2ec8e80edabe5ca425c348adec65cd09f5f870 | fix using #2 | phonicmouse/SharpPaste,phonicmouse/SharpPaste | Bootstrappers/StaticServeBootstrapper.cs | Bootstrappers/StaticServeBootstrapper.cs | /*
* Created by SharpDevelop.
* User: Phonic Mouse
* Date: 02/08/2016
* Time: 17:32
*/
using Nancy
using Nancy.Conventions
namespace SharpPaste
{
public class StaticServeBootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/custom", @"custom")); // Serve custom CSS & JS folder
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/fonts", @"packages\bootstrap.3.3.4\content\fonts")); // Serve bootstrap's fonts folder
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/css/bootstrap.css", @"packages\bootstrap.3.3.4\content\content\bootstrap.min.css")); // Serve Bootstrap CSS
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/css/bootstrap-flat.css", @"packages\bootstrap.flat.3.3.4\content\content\bootstrap-flat.min.css")); // Serve Bootstrap Flat Theme CSS
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/js/bootstrap.js", @"packages\bootstrap.3.3.4\content\scripts\bootstrap.min.js")); // Serve Bootstrap JS
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/js/jquery.js", @"packages\jquery.3.1.1\content\scripts\jquery-3.1.1.min.js")); // Serve jQuery
base.ConfigureConventions(nancyConventions);
}
}
}
| /*
* Created by SharpDevelop.
* User: Phonic Mouse
* Date: 02/08/2016
* Time: 17:32
*/
using Nancy.Conventions
namespace SharpPaste
{
public class StaticServeBootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/custom", @"custom")); // Serve custom CSS & JS folder
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/fonts", @"packages\bootstrap.3.3.4\content\fonts")); // Serve bootstrap's fonts folder
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/css/bootstrap.css", @"packages\bootstrap.3.3.4\content\content\bootstrap.min.css")); // Serve Bootstrap CSS
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/css/bootstrap-flat.css", @"packages\bootstrap.flat.3.3.4\content\content\bootstrap-flat.min.css")); // Serve Bootstrap Flat Theme CSS
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/js/bootstrap.js", @"packages\bootstrap.3.3.4\content\scripts\bootstrap.min.js")); // Serve Bootstrap JS
nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/js/jquery.js", @"packages\jquery.3.1.1\content\scripts\jquery-3.1.1.min.js")); // Serve jQuery
base.ConfigureConventions(nancyConventions);
}
}
}
| mit | C# |
bdf6733e26544e5f521638ede360e8ee6a214589 | Use UncachedFileService by default. | Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver | src/AsmResolver.PE/PEReaderParameters.cs | src/AsmResolver.PE/PEReaderParameters.cs | using System;
using AsmResolver.IO;
using AsmResolver.PE.Debug;
using AsmResolver.PE.DotNet.Metadata;
namespace AsmResolver.PE
{
/// <summary>
/// Provides parameters for the reading process of a PE image.
/// </summary>
public class PEReaderParameters
{
/// <summary>
/// Initializes the PE reader parameters.
/// </summary>
public PEReaderParameters()
: this(ThrowErrorListener.Instance)
{
}
/// <summary>
/// Initializes the PE reader parameters.
/// </summary>
/// <param name="errorListener">The object responsible for recording parser errors.</param>
public PEReaderParameters(IErrorListener errorListener)
{
MetadataStreamReader = new DefaultMetadataStreamReader();
DebugDataReader = new DefaultDebugDataReader();
ErrorListener = errorListener ?? throw new ArgumentNullException(nameof(errorListener));
}
/// <summary>
/// Gets the object responsible for collecting any errors during the parsing.
/// </summary>
public IErrorListener ErrorListener
{
get;
set;
}
/// <summary>
/// Gets or sets the object responsible for reading metadata streams in the .NET data directory.
/// </summary>
public IMetadataStreamReader MetadataStreamReader
{
get;
set;
}
/// <summary>
/// Gets or sets the object responsible for reading debug data streams in the debug data directory.
/// </summary>
public IDebugDataReader DebugDataReader
{
get;
set;
}
/// <summary>
/// Gets the service to use for reading any additional files from the disk while reading the portable executable.
/// </summary>
public IFileService FileService
{
get;
set;
} = UncachedFileService.Instance;
}
}
| using System;
using AsmResolver.IO;
using AsmResolver.PE.Debug;
using AsmResolver.PE.DotNet.Metadata;
namespace AsmResolver.PE
{
/// <summary>
/// Provides parameters for the reading process of a PE image.
/// </summary>
public class PEReaderParameters
{
/// <summary>
/// Initializes the PE reader parameters.
/// </summary>
public PEReaderParameters()
: this(ThrowErrorListener.Instance)
{
}
/// <summary>
/// Initializes the PE reader parameters.
/// </summary>
/// <param name="errorListener">The object responsible for recording parser errors.</param>
public PEReaderParameters(IErrorListener errorListener)
{
MetadataStreamReader = new DefaultMetadataStreamReader();
DebugDataReader = new DefaultDebugDataReader();
ErrorListener = errorListener ?? throw new ArgumentNullException(nameof(errorListener));
}
/// <summary>
/// Gets the object responsible for collecting any errors during the parsing.
/// </summary>
public IErrorListener ErrorListener
{
get;
set;
}
/// <summary>
/// Gets or sets the object responsible for reading metadata streams in the .NET data directory.
/// </summary>
public IMetadataStreamReader MetadataStreamReader
{
get;
set;
}
/// <summary>
/// Gets or sets the object responsible for reading debug data streams in the debug data directory.
/// </summary>
public IDebugDataReader DebugDataReader
{
get;
set;
}
public IFileService FileService
{
get;
set;
} = new ByteArrayFileService();
}
}
| mit | C# |
796e2edb1e58e9cd42be984719fbdac15d2c7bd6 | add xml comments | Pondidum/Conifer,Pondidum/Conifer | Conifer/RouterConfigurationExpression.cs | Conifer/RouterConfigurationExpression.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Web.Http.Controllers;
namespace Conifer
{
public class RouterConfigurationExpression
{
private readonly List<IRouteConvention> _defaultConventions;
private readonly IConventionalRouter _router;
public RouterConfigurationExpression(IConventionalRouter router)
{
_defaultConventions = Default.Conventions.ToList();
_router = router;
}
/// <summary>
/// Setup the default convetions to create routes
/// </summary>
public void DefaultConventionsAre(IEnumerable<IRouteConvention> conventions)
{
_defaultConventions.Clear();
_defaultConventions.AddRange(conventions);
}
/// <summary>
/// Create routes for all the applicable methods in the controller
/// </summary>
public void AddAll<TController>()
where TController : IHttpController
{
AddAll<TController>(_defaultConventions);
}
/// <summary>
/// Create routes for all the applicable methods in the controller
/// </summary>
/// <param name="conventions">Override the default conventions with a custom set</param>
public void AddAll<TController>(IEnumerable<IRouteConvention> conventions)
where TController : IHttpController
{
if (conventions == null) conventions = Enumerable.Empty<IRouteConvention>();
_router.AddRoutes<TController>(conventions.ToList());
}
/// <summary>
/// Creates a route for the specified method in the controller
/// </summary>
public void Add<TController>(Expression<Action<TController>> expression)
where TController : IHttpController
{
Add(expression, _defaultConventions);
}
/// <summary>
/// Creates a route for the specified method in the controller
/// </summary>
/// <param name="conventions">Override the default conventions with a custom set</param>
public void Add<TController>(Expression<Action<TController>> expression, IEnumerable<IRouteConvention> conventions)
where TController : IHttpController
{
if (conventions == null) conventions = Enumerable.Empty<IRouteConvention>();
_router.AddRoute(expression, conventions.ToList());
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Web.Http.Controllers;
namespace Conifer
{
public class RouterConfigurationExpression
{
private readonly List<IRouteConvention> _defaultConventions;
private readonly IConventionalRouter _router;
public RouterConfigurationExpression(IConventionalRouter router)
{
_defaultConventions = Default.Conventions.ToList();
_router = router;
}
/// <summary>
/// Setup the default convetions to create routes
/// </summary>
public void DefaultConventionsAre(IEnumerable<IRouteConvention> conventions)
{
_defaultConventions.Clear();
_defaultConventions.AddRange(conventions);
}
/// <summary>
/// Create routes for all the applicable methods in the controller
/// </summary>
public void AddAll<TController>()
where TController : IHttpController
{
AddAll<TController>(_defaultConventions);
}
/// <summary>
/// Create routes for all the applicable methods in the controller
/// </summary>
/// <param name="conventions">Override the default conventions with a custom set</param>
public void AddAll<TController>(IEnumerable<IRouteConvention> conventions)
where TController : IHttpController
{
if (conventions == null) conventions = Enumerable.Empty<IRouteConvention>();
_router.AddRoutes<TController>(conventions.ToList());
}
public void Add<TController>(Expression<Action<TController>> expression)
where TController : IHttpController
{
Add(expression, _defaultConventions);
}
public void Add<TController>(Expression<Action<TController>> expression, IEnumerable<IRouteConvention> conventions)
where TController : IHttpController
{
if (conventions == null) conventions = Enumerable.Empty<IRouteConvention>();
_router.AddRoute(expression, conventions.ToList());
}
}
}
| lgpl-2.1 | C# |
4509c8bcfbcf9fc2a9d6010d707868312fc13cea | Use the more consistent `lastVertex`, with a comment | peppy/osu-new,UselessToucan/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu | osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs | osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Rulesets.Catch.Objects;
using osuTK;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
{
public class PlacementEditablePath : EditablePath
{
/// <summary>
/// The original position of the last added vertex.
/// This is not same as the last vertex of the current path because the vertex ordering can change.
/// </summary>
private JuiceStreamPathVertex lastVertex;
public PlacementEditablePath(Func<float, double> positionToDistance)
: base(positionToDistance)
{
}
public void AddNewVertex()
{
var endVertex = Vertices[^1];
int index = AddVertex(endVertex.Distance, endVertex.X);
for (int i = 0; i < VertexCount; i++)
{
VertexStates[i].IsSelected = i == index;
VertexStates[i].VertexBeforeChange = Vertices[i];
}
lastVertex = Vertices[index];
}
/// <summary>
/// Move the vertex added by <see cref="AddNewVertex"/> in the last time.
/// </summary>
public void MoveLastVertex(Vector2 screenSpacePosition)
{
Vector2 position = ToRelativePosition(screenSpacePosition);
double distanceDelta = PositionToDistance(position.Y) - lastVertex.Distance;
float xDelta = position.X - lastVertex.X;
MoveSelectedVertices(distanceDelta, xDelta);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Rulesets.Catch.Objects;
using osuTK;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
{
public class PlacementEditablePath : EditablePath
{
private JuiceStreamPathVertex originalNewVertex;
public PlacementEditablePath(Func<float, double> positionToDistance)
: base(positionToDistance)
{
}
public void AddNewVertex()
{
var endVertex = Vertices[^1];
int index = AddVertex(endVertex.Distance, endVertex.X);
for (int i = 0; i < VertexCount; i++)
{
VertexStates[i].IsSelected = i == index;
VertexStates[i].VertexBeforeChange = Vertices[i];
}
originalNewVertex = Vertices[index];
}
/// <summary>
/// Move the vertex added by <see cref="AddNewVertex"/> in the last time.
/// </summary>
public void MoveLastVertex(Vector2 screenSpacePosition)
{
Vector2 position = ToRelativePosition(screenSpacePosition);
double distanceDelta = PositionToDistance(position.Y) - originalNewVertex.Distance;
float xDelta = position.X - originalNewVertex.X;
MoveSelectedVertices(distanceDelta, xDelta);
}
}
}
| mit | C# |
12ec65bab56e2aeda12c2364cad8947f827c5382 | adjust font | GusJassal/agri-nmp,GusJassal/agri-nmp,GusJassal/agri-nmp,GusJassal/agri-nmp | Server/src/SERVERAPI/Views/Report/ReportHeader.cshtml | Server/src/SERVERAPI/Views/Report/ReportHeader.cshtml | <head>
<style>
body {
font-family: FreeSans, Arial, Helvetica, "Nimbus Sans L", "Liberation Sans", Sans-serif;
font-size: 10px;
}
td{
font-size: 10px;
}
.CellHdg {
font-size: 11px;
background-color: #a4cdd8;
border: 1px solid black;
padding: 4px;
font-weight:bold;
}
.CellHdgNBd {
font-size: 11px;
padding: 4px;
vertical-align: top;
}
.CellDtl {
font-size: 10px;
border: 1px solid black;
padding: 4px;
}
</style>
</head>
| <head>
<style>
body {
font-family: Arial, Helvetica, "Nimbus Sans L", "Liberation Sans", FreeSans, Sans-serif;
font-size: 13px;
}
td{
font-size: 13px;
}
.CellHdg {
font-size: 11px;
background-color: #a4cdd8;
border: 1px solid black;
padding: 4px;
font-weight:bold;
}
.CellHdgNBd {
font-size: 11px;
padding: 4px;
vertical-align: top;
}
.CellDtl {
font-size: 10px;
border: 1px solid black;
padding: 4px;
}
</style>
</head>
| apache-2.0 | C# |
1de6b9fcdf89a1d6b7c31b180e2a445596c270ff | Update patridgedev.com URLs to HTTPS (#349) | planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin | src/Firehose.Web/Authors/AdamPatridge.cs | src/Firehose.Web/Authors/AdamPatridge.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class AdamPatridge : IWorkAtXamarinOrMicrosoft, IFilterMyBlogPosts
{
public string FirstName => "Adam";
public string LastName => "Patridge";
public string StateOrRegion => "Cheyenne, WY";
public string TwitterHandle => "patridgedev";
public string EmailAddress => "";
public string ShortBioOrTagLine => string.Empty;
public string GravatarHash => "29f7fb03af5c354d6098f0300114056b";
public Uri WebSite => new Uri("https://www.patridgedev.com/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://www.patridgedev.com/feed/"); }
}
public string GitHubHandle => "patridge";
public bool Filter(SyndicationItem item) =>
item.Title.Text.ToLowerInvariant().Contains("xamarin") ||
item.Categories.Any(category => category.Name.ToLowerInvariant().Contains("xamarin"));
public GeoPosition Position => new GeoPosition(41.1399810, -104.8202460);
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class AdamPatridge : IWorkAtXamarinOrMicrosoft, IFilterMyBlogPosts
{
public string FirstName => "Adam";
public string LastName => "Patridge";
public string StateOrRegion => "Cheyenne, WY";
public string TwitterHandle => "patridgedev";
public string EmailAddress => "";
public string ShortBioOrTagLine => string.Empty;
public string GravatarHash => "29f7fb03af5c354d6098f0300114056b";
public Uri WebSite => new Uri("http://www.patridgedev.com/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.patridgedev.com/feed/"); }
}
public string GitHubHandle => "patridge";
public bool Filter(SyndicationItem item) =>
item.Title.Text.ToLowerInvariant().Contains("xamarin") ||
item.Categories.Any(category => category.Name.ToLowerInvariant().Contains("xamarin"));
public GeoPosition Position => new GeoPosition(41.1399810, -104.8202460);
}
}
| mit | C# |
2939cb6633b7c69d245bd8c2b7b774f01d011c83 | Update AddPublicaton method | dncuug/dot-net.in.ua,dncuug/dot-net.in.ua,dncuug/dot-net.in.ua | src/WebSite/Controllers/ApiController.cs | src/WebSite/Controllers/ApiController.cs |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Core;
using Core.ViewModels;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using X.Web.MetaExtractor;
namespace WebSite.Controllers
{
public class ApiController : Controller
{
private readonly PublicationManager _publicationManager;
private readonly UserManager _userManager;
public ApiController(IMemoryCache cache)
{
_publicationManager = new PublicationManager(Core.Settings.Current.ConnectionString, cache);
_userManager = new UserManager(Core.Settings.Current.ConnectionString);
}
[HttpGet]
[Route("api/publications/new")]
public async Task<IActionResult> AddPublicaton(string url, Guid key, int categoryId = 1)
{
DAL.User user = _userManager.GetBySecretKey(key);
if (user == null)
{
return StatusCode((int)HttpStatusCode.Forbidden);
}
var extractor = new X.Web.MetaExtractor.Extractor();
var metadata = await extractor.Extract(new Uri(url));
var publication = new DAL.Publication
{
Title = metadata.Title,
Description = metadata.Description,
Link = metadata.Url,
Image = metadata.Image.FirstOrDefault(),
Type = metadata.Type,
DateTime = DateTime.Now,
UserId = user.Id,
CategoryId = categoryId
};
publication = await _publicationManager.Save(publication);
if (publication != null)
{
var model = new PublicationViewModel(publication, Settings.Current.WebSiteUrl);
return Created(new Uri($"{Core.Settings.Current.WebSiteUrl}post/{publication.Id}"), model);
}
return StatusCode((int)HttpStatusCode.BadRequest);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Core;
using Core.ViewModels;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using X.Web.MetaExtractor;
namespace WebSite.Controllers
{
public class ApiController : Controller
{
private readonly PublicationManager _manager;
public ApiController(IMemoryCache cache)
{
_manager = new PublicationManager(Core.Settings.Current.ConnectionString, cache);
}
[HttpGet]
[Route("api/publications/new")]
public async Task<IActionResult> AddPublicaton(string url, Guid key)
{
if (key != Settings.Current.PublicationKey)
{
return StatusCode((int)HttpStatusCode.Forbidden);
}
var extractor = new X.Web.MetaExtractor.Extractor();
var metadata = await extractor.Extract(new Uri(url));
var publication = new DAL.Publication
{
Title = metadata.Title,
Description = metadata.Description,
Link = metadata.Url,
Image = metadata.Image.FirstOrDefault(),
Type = metadata.Type,
DateTime = DateTime.Now
};
publication = await _manager.Save(publication);
if (publication != null)
{
var model = new PublicationViewModel(publication, Settings.Current.WebSiteUrl);
return Created(new Uri($"{Core.Settings.Current.WebSiteUrl}post/{publication.Id}"), model);
}
return StatusCode((int)HttpStatusCode.BadRequest);
}
}
}
| mit | C# |
2211ae918252d06a90c7aac47c14dab6ec9115d2 | make it an actual Alexa skill | MaxHorstmann/StackExchange-Alexa,MaxHorstmann/StackExchange-Alexa | src/csharp/StackExchangeAlexa.cs | src/csharp/StackExchangeAlexa.cs | using Amazon.Lambda.Core;
namespace StackExchange.Alexa
{
public class Skill
{
public string MyHandler(int count, ILambdaContext context)
{
var logger = context.Logger;
logger.log("received : " + count);
return count.ToString();
}
}
}
| using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
| mit | C# |
6dbdfcc70cd9f228707977e34bb56329e97b867f | Fix room password not being percent-encoded in join request | UselessToucan/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,UselessToucan/osu,peppy/osu-new,smoogipoo/osu,smoogipoo/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu | osu.Game/Online/Rooms/JoinRoomRequest.cs | osu.Game/Online/Rooms/JoinRoomRequest.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Net.Http;
using osu.Framework.IO.Network;
using osu.Game.Online.API;
namespace osu.Game.Online.Rooms
{
public class JoinRoomRequest : APIRequest
{
public readonly Room Room;
public readonly string Password;
public JoinRoomRequest(Room room, string password)
{
Room = room;
Password = password;
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
req.Method = HttpMethod.Put;
req.AddParameter(@"password", Password, RequestParameterType.Query);
return req;
}
protected override string Target => $@"rooms/{Room.RoomID.Value}/users/{User.Id}";
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Net.Http;
using osu.Framework.IO.Network;
using osu.Game.Online.API;
namespace osu.Game.Online.Rooms
{
public class JoinRoomRequest : APIRequest
{
public readonly Room Room;
public readonly string Password;
public JoinRoomRequest(Room room, string password)
{
Room = room;
Password = password;
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
req.Method = HttpMethod.Put;
return req;
}
// Todo: Password needs to be specified here rather than via AddParameter() because this is a PUT request. May be a framework bug.
protected override string Target => $"rooms/{Room.RoomID.Value}/users/{User.Id}?password={Password}";
}
}
| mit | C# |
6ecc728c0121e4821cf83346e2cf8a5401a6210e | Remove override | smoogipoo/osu,NeoAdonis/osu,peppy/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,ppy/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu | osu.Game/Rulesets/Mods/ModSuddenDeath.cs | osu.Game/Rulesets/Mods/ModSuddenDeath.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModSuddenDeath : ModFailCondition
{
public override string Name => "Sudden Death";
public override string Acronym => "SD";
public override IconUsage? Icon => OsuIcon.ModSuddendeath;
public override ModType Type => ModType.DifficultyIncrease;
public override string Description => "Miss and fail.";
public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModPerfect)).ToArray();
protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result)
=> result.Type.AffectsCombo()
&& !result.IsHit;
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModSuddenDeath : ModFailCondition
{
public override string Name => "Sudden Death";
public override string Acronym => "SD";
public override IconUsage? Icon => OsuIcon.ModSuddendeath;
public override ModType Type => ModType.DifficultyIncrease;
public override string Description => "Miss and fail.";
public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModPerfect)).ToArray();
public override bool PerformFail() => true;
protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result)
=> result.Type.AffectsCombo()
&& !result.IsHit;
}
}
| mit | C# |
2c82cc87abd53a85ac0ae9303cd1362948bc0171 | update for contract length description on list of offers | Paymentsense/Dapper.SimpleSave | PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/MerchantOfferDto.cs | PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/MerchantOfferDto.cs | using System.Runtime.Serialization;
using PS.Mothership.Core.Common.Template.Gen;
using PS.Mothership.Core.Common.Template.Opp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PS.Mothership.Core.Common.Dto.Merchant
{
[DataContract]
public class MerchantOfferDto
{
[DataMember]
public Guid CustomerGuid { get; set; }
[DataMember]
public Guid OfferGuid { get; set; }
[DataMember]
public string Reference { get; set; }
[DataMember]
public string Description { get; set; }
//[DataMember]
//public GenOpportunityStatus Status { get; set; }
//[DataMember]
//public string StatusDescription
//{
// get
// {
// return GenOpportunityStatusCollection.GenOpportunityStatusList.Single(x => x.EnumValue == Status.EnumValue).EnumDescription;
// }
//}
[DataMember]
public decimal Credit { get; set; }
[DataMember]
public decimal Debit { get; set; }
[DataMember]
public int ContractLengthKey { get; set; }
[DataMember]
public string ContractLengthDescription { get; set; }
[DataMember]
public DateTimeOffset UpdateDate { get; set; }
[DataMember]
public string UpdateUsername { get; set; }
[DataMember]
public Guid UpdateSessionGuid { get; set; }
}
}
| using System.Runtime.Serialization;
using PS.Mothership.Core.Common.Template.Gen;
using PS.Mothership.Core.Common.Template.Opp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PS.Mothership.Core.Common.Dto.Merchant
{
[DataContract]
public class MerchantOfferDto
{
[DataMember]
public Guid CustomerGuid { get; set; }
[DataMember]
public Guid OfferGuid { get; set; }
[DataMember]
public string Reference { get; set; }
[DataMember]
public string Description { get; set; }
//[DataMember]
//public GenOpportunityStatus Status { get; set; }
//[DataMember]
//public string StatusDescription
//{
// get
// {
// return GenOpportunityStatusCollection.GenOpportunityStatusList.Single(x => x.EnumValue == Status.EnumValue).EnumDescription;
// }
//}
[DataMember]
public decimal Credit { get; set; }
[DataMember]
public decimal Debit { get; set; }
[DataMember]
public int DurationKey { get; set; }
[DataMember]
public string DurationDescription { get; set; }
[DataMember]
public DateTimeOffset UpdateDate { get; set; }
[DataMember]
public string UpdateUsername { get; set; }
[DataMember]
public Guid UpdateSessionGuid { get; set; }
}
}
| mit | C# |
d44a89e32b735164e38339e7a9fbd5cd60cba8c6 | Disable document selection by id. | FloodProject/flood,FloodProject/flood,FloodProject/flood | src/Editor/Editor.Client/Tools/ToolClose.cs | src/Editor/Editor.Client/Tools/ToolClose.cs | using System.ComponentModel.Composition;
namespace Flood.Editor.Controls
{
class ToolClose : EditorTool, BarTool
{
[Import]
DocumentManager docManager;
public void OnSelect()
{
//if (docManager.Current != null)
// docManager.Close(docManager.Current.Id);
}
public string Text
{
get { return "Close"; }
}
public string Image
{
get { return "close.png"; }
}
}
}
| using System.ComponentModel.Composition;
namespace Flood.Editor.Controls
{
class ToolClose : EditorTool, BarTool
{
[Import]
DocumentManager docManager;
public void OnSelect()
{
if (docManager.Current != null)
docManager.Close(docManager.Current.Id);
}
public string Text
{
get { return "Close"; }
}
public string Image
{
get { return "close.png"; }
}
}
}
| bsd-2-clause | C# |
e688d76df302fea34cb3d899cbcd6c36b07fa27b | Update info author Juliano Custódio (#534) | planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin | src/Firehose.Web/Authors/JulianoCustodio.cs | src/Firehose.Web/Authors/JulianoCustodio.cs | using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class JulianoCustodio : IAmAMicrosoftMVP
{
public string FirstName => "Juliano";
public string LastName => "Custódio";
public string StateOrRegion => "Piracicaba, Brasil";
public string TwitterHandle => "JuuCustodio";
public string GitHubHandle => "JuuCustodio";
public string ShortBioOrTagLine => "Microsoft MVP, Blogger and Speaker";
public string EmailAddress => "juliano.custodio@hotmail.com.br";
public string GravatarHash => "71de9936f2ffbc93e9918066479331f1";
public GeoPosition Position => new GeoPosition(-22.7342864, -47.6480644);
public Uri WebSite => new Uri("https://www.julianocustodio.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://www.julianocustodio.com/rss"); }
}
public string FeedLanguageCode => "pt";
}
} | using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class JulianoCustodio : IAmACommunityMember
{
public string FirstName => "Juliano";
public string LastName => "Custódio";
public string StateOrRegion => "Sorocaba, Brasil";
public string TwitterHandle => "JuuCustodio";
public string GitHubHandle => "JuuCustodio";
public string ShortBioOrTagLine => "Mobile developer";
public string EmailAddress => "juliano.custodio@hotmail.com.br";
public string GravatarHash => "71de9936f2ffbc93e9918066479331f1";
public GeoPosition Position => new GeoPosition(-23.52425, -47.46501);
public Uri WebSite => new Uri("https://www.julianocustodio.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://www.julianocustodio.com/rss"); }
}
public string FeedLanguageCode => "pt";
}
} | mit | C# |
adb79d1a3336d3e51911fe7cb3880b23a94bd08a | change OdooRpcClient class scope to public | vmlf01/OdooRpc.CoreCLR.Client | src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs | src/OdooRpc.CoreCLR.Client/OdooRpcClient.cs | using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using OdooRpc.CoreCLR.Client.Interfaces;
using OdooRpc.CoreCLR.Client.Models;
using OdooRpc.CoreCLR.Client.Internals;
using OdooRpc.CoreCLR.Client.Internals.Interfaces;
[assembly: InternalsVisibleTo("OdooRpc.CoreCLR.Client.Tests")]
namespace OdooRpc.CoreCLR.Client
{
public class OdooRpcClient : IOdooRpcClient
{
public OdooConnectionInfo ConnectionInfo { get { return this.OdooConnection.ConnectionInfo; } }
public OdooSessionInfo SessionInfo { get { return this.OdooConnection.SessionInfo; } }
private IOdooConnection OdooConnection { get; set; }
public OdooRpcClient()
: this(new OdooConnection())
{
}
internal OdooRpcClient(IOdooConnection connection)
{
this.OdooConnection = connection;
}
public async Task Connect(OdooConnectionInfo connectionInfo)
{
await this.OdooConnection.Connect(connectionInfo);
}
}
} | using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using OdooRpc.CoreCLR.Client.Interfaces;
using OdooRpc.CoreCLR.Client.Models;
using OdooRpc.CoreCLR.Client.Internals;
using OdooRpc.CoreCLR.Client.Internals.Interfaces;
[assembly: InternalsVisibleTo("OdooRpc.CoreCLR.Client.Tests")]
namespace OdooRpc.CoreCLR.Client
{
internal class OdooRpcClient : IOdooRpcClient
{
public OdooConnectionInfo ConnectionInfo { get { return this.OdooConnection.ConnectionInfo; } }
public OdooSessionInfo SessionInfo { get { return this.OdooConnection.SessionInfo; } }
private IOdooConnection OdooConnection { get; set; }
public OdooRpcClient()
: this(new OdooConnection())
{
}
public OdooRpcClient(IOdooConnection connection)
{
this.OdooConnection = connection;
}
public async Task Connect(OdooConnectionInfo connectionInfo)
{
await this.OdooConnection.Connect(connectionInfo);
}
}
} | mit | C# |
339c266a4bec1f9dcd7a593b0a85cf7f8b842a88 | Make ask form linkable | ridercz/AskMe,ridercz/AskMe,ridercz/AskMe | Altairis.AskMe.Web/Pages/Questions.cshtml | Altairis.AskMe.Web/Pages/Questions.cshtml | @page "{pageNumber:int:min(1)=1}"
@model QuestionsModel
<section class="form" id="ask">
<form method="post">
<header>
<h2>Nová otázka</h2>
</header>
<div><textarea asp-for="Input.QuestionText" placeholder="Zadejte text své otázky..."></textarea></div>
<div>
<select asp-for="Input.CategoryId" asp-items="Model.Categories"></select>
</div>
<div>
<input asp-for="Input.DisplayName" placeholder="Jméno (nepovinné)" class="half-width" />
<input asp-for="Input.EmailAddress" placeholder="E-mail (nepovinné)" class="half-width" />
</div>
<div asp-validation-summary="All"></div>
<footer>
<input type="submit" value="Odeslat" />
</footer>
</form>
</section>
@if (Model.Paging.TotalRecords > 0) {
<h2>Nezodpovězené otázky</h2>
@foreach (var item in Model.Data) {
var id = $"q_{item.Id}";
<article class="question" id="@id">
<header>
<span class="fa-stack fa-lg">
<i class="fa fa-square-o fa-stack-2x"></i>
<i class="fa fa-question fa-stack-1x"></i>
</span>
<span class="info">
<i class="fa fa-tag"></i> @item.Category.Name
<i class="fa fa-clock-o"></i> <time value="@item.DateCreated"></time>
@if (!string.IsNullOrWhiteSpace(item.DisplayName)) {
<span><i class="fa fa-user"></i> @item.DisplayName</span>
}
</span>
</header>
<plainText text="@item.QuestionText" html-encode="true"></plainText>
</article>
}
<vc:pager model="Model.Paging"></vc:pager>
} | @page "{pageNumber:int:min(1)=1}"
@model QuestionsModel
<section class="form">
<form method="post">
<header>
<h2>Nová otázka</h2>
</header>
<div><textarea asp-for="Input.QuestionText" placeholder="Zadejte text své otázky..."></textarea></div>
<div>
<select asp-for="Input.CategoryId" asp-items="Model.Categories"></select>
</div>
<div>
<input asp-for="Input.DisplayName" placeholder="Jméno (nepovinné)" class="half-width" />
<input asp-for="Input.EmailAddress" placeholder="E-mail (nepovinné)" class="half-width" />
</div>
<div asp-validation-summary="All"></div>
<footer>
<input type="submit" value="Odeslat" />
</footer>
</form>
</section>
@if (Model.Paging.TotalRecords > 0) {
<h2>Nezodpovězené otázky</h2>
@foreach (var item in Model.Data) {
var id = $"q_{item.Id}";
<article class="question" id="@id">
<header>
<span class="fa-stack fa-lg">
<i class="fa fa-square-o fa-stack-2x"></i>
<i class="fa fa-question fa-stack-1x"></i>
</span>
<span class="info">
<i class="fa fa-tag"></i> @item.Category.Name
<i class="fa fa-clock-o"></i> <time value="@item.DateCreated"></time>
@if (!string.IsNullOrWhiteSpace(item.DisplayName)) {
<span><i class="fa fa-user"></i> @item.DisplayName</span>
}
</span>
</header>
<plainText text="@item.QuestionText" html-encode="true"></plainText>
</article>
}
<vc:pager model="Model.Paging"></vc:pager>
} | mit | C# |
fc12c9687edf86fe30004787e2880cbc51c750cf | Prepare 0.1.1 release | LouisTakePILLz/ArgumentParser | ArgumentParser/Properties/AssemblyInfo.cs | ArgumentParser/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
// 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("ArgumentsParser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LouisTakePILLz")]
[assembly: AssemblyProduct("ArgumentsParser")]
[assembly: AssemblyCopyright("Copyright © LouisTakePILLz 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("a67b27e2-8841-4951-a6f0-a00d93f59560")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] | using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
// 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("ArgumentsParser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LouisTakePILLz")]
[assembly: AssemblyProduct("ArgumentsParser")]
[assembly: AssemblyCopyright("Copyright © LouisTakePILLz 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("a67b27e2-8841-4951-a6f0-a00d93f59560")]
// 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")] | apache-2.0 | C# |
49677714783bacd66ee637b626945de4910a50a0 | Fix ZipEntryInfo | Redth/Cake.Xamarin.Build | Cake.Xamarin.Build/PartialZip.cs | Cake.Xamarin.Build/PartialZip.cs | using System;
using System.Collections.Generic;
using System.IO;
using Cake.Core.IO;
using ICSharpCode.SharpZipLib.Zip;
namespace Cake.Xamarin.Build
{
public class ZipEntryInfo
{
public long RangeStart { get; set; }
public string EntryName { get; set; }
public long CompressedSize { get; set; }
public long RangeEnd
{
get { return RangeStart + CompressedSize; }
}
}
internal static class PartialZip
{
internal static Stream ReadZipEntry(string zipFilename, string entryName)
{
using (var fs = File.OpenRead(zipFilename))
using (var zipFile = new ZipFile(fs))
{
var entry = zipFile.GetEntry(entryName);
if (entry != null)
return zipFile.GetInputStream(entry);
}
return null;
}
internal static string ReadEntryText(string zipFilename, string entryName, bool readBinaryAsHex = false)
{
using (var entryStream = ReadZipEntry(zipFilename, entryName))
{
if (entryStream == null)
return null;
if (readBinaryAsHex)
{
using (var ms = new MemoryStream())
{
entryStream.CopyTo(ms);
var data = ms.ToArray();
var sb = new System.Text.StringBuilder();
for (int i = 0; i < data.Length; i++)
sb.Append(data[i].ToString("X2"));
return sb.ToString().ToLower();
}
}
else
{
string result = null;
using (var sr = new StreamReader(entryStream))
result = sr.ReadToEnd();
return result;
}
}
}
internal static List<ZipEntryInfo> FindZipFileRanges(string zipFilename)
{
var downloadInfo = new List<ZipEntryInfo>();
using (var fs = File.OpenRead(zipFilename))
using (var zipFile = new ZipFile(fs))
{
var entriesEnumerator = zipFile.GetEnumerator();
while (entriesEnumerator.MoveNext())
{
var entry = entriesEnumerator.Current as ZipEntry;
// DRAGONS! Using a private method to get the location of the start of the entry in the zip file
var locateEntryMethod = zipFile.GetType().GetMethod("LocateEntry", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var locateOffset = (long)locateEntryMethod.Invoke(zipFile, new object[] { entry });
downloadInfo.Add(new ZipEntryInfo
{
EntryName = entry.Name,
RangeStart = locateOffset,
CompressedSize = entry.CompressedSize,
});
}
return downloadInfo;
}
}
}
}
| using System;
namespace Cake.Xamarin.Build
{
public class PartialZip
{
public PartialZip()
{
}
}
}
| mit | C# |
73a2873d760ee61f8a642ceb911c1a2ea079cde0 | Add deleted and copied to the parsed statuses | Thulur/GitStatisticsAnalyzer,Thulur/GitDataExplorer | GitDataExplorer/Results/ListSimpleCommitsResult.cs | GitDataExplorer/Results/ListSimpleCommitsResult.cs | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using GitDataExplorer.Results.Commits;
namespace GitDataExplorer.Results
{
class ListSimpleCommitsResult : IResult
{
private char[] statusLetters = { 'M', 'A', 'R', 'C', 'D' };
public ExecutionResult ExecutionResult { get; private set; }
public IList<SimpleCommitResult> Commits { get; } = new List<SimpleCommitResult>();
public void ParseResult(IList<string> lines)
{
var tmpList = new List<string>();
foreach (var line in lines)
{
if (Array.IndexOf(statusLetters, line[0]) >= 0)
{
tmpList.Add(line);
}
else
{
if (tmpList.Count > 0)
{
var result = new SimpleCommitResult();
result.ParseResult(tmpList);
Commits.Add(result);
}
tmpList.Clear();
tmpList.Add(line);
}
}
if (tmpList.Count > 0)
{
var result = new SimpleCommitResult();
result.ParseResult(tmpList);
Commits.Add(result);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using GitDataExplorer.Results.Commits;
namespace GitDataExplorer.Results
{
class ListSimpleCommitsResult : IResult
{
public ExecutionResult ExecutionResult { get; private set; }
public IList<SimpleCommitResult> Commits { get; } = new List<SimpleCommitResult>();
public void ParseResult(IList<string> lines)
{
var tmpList = new List<string>();
foreach (var line in lines)
{
if (line.StartsWith("A") || line.StartsWith("M") || line.StartsWith("R"))
{
tmpList.Add(line);
}
else
{
if (tmpList.Count > 0)
{
var result = new SimpleCommitResult();
result.ParseResult(tmpList);
Commits.Add(result);
}
tmpList.Clear();
tmpList.Add(line);
}
}
if (tmpList.Count > 0)
{
var result = new SimpleCommitResult();
result.ParseResult(tmpList);
Commits.Add(result);
}
}
}
}
| apache-2.0 | C# |
35918c9970c1ca98f6ce5d654284c2a44a87b7f1 | Add missing Nullable example [ci skip] | brycekbargar/Nilgiri,brycekbargar/Nilgiri | Nilgiri.Tests/Examples/Should/NotBeOk.cs | Nilgiri.Tests/Examples/Should/NotBeOk.cs | namespace Nilgiri.Examples
{
using Xunit;
using Nilgiri.Tests.Common;
using static Nilgiri.ShouldStyle;
public partial class ExampleOf_Should
{
public class Not_Be_Ok
{
[Fact]
public void Int32()
{
_(0).Should.Not.Be.Ok();
_(() => 0).Should.Not.Be.Ok();
}
[Fact]
public void Nullable()
{
_((bool?)false).Should.Not.Be.Ok();
_(() => (bool?)false).Should.Not.Be.Ok();
_((bool?)null).Should.Not.Be.Ok();
_(() => (bool?)null).Should.Not.Be.Ok();
}
[Fact]
public void String()
{
_((string)null).Should.Not.Be.Ok();
_(() => (string)null).Should.Not.Be.Ok();
_(System.String.Empty).Should.Not.Be.Ok();
_(() => System.String.Empty).Should.Not.Be.Ok();
_("").Should.Not.Be.Ok();
_(() => "").Should.Not.Be.Ok();
_(" ").Should.Not.Be.Ok();
_(() => " ").Should.Not.Be.Ok();
}
[Fact]
public void ReferenceTypes()
{
_((StubClass)null).Should.Not.Be.Ok();
_(() => (StubClass)null).Should.Not.Be.Ok();
}
}
}
}
| namespace Nilgiri.Examples
{
using Xunit;
using Nilgiri.Tests.Common;
using static Nilgiri.ShouldStyle;
public partial class ExampleOf_Should
{
public class Not_Be_Ok
{
[Fact]
public void Int32()
{
_(0).Should.Not.Be.Ok();
_(() => 0).Should.Not.Be.Ok();
}
[Fact]
public void Nullable()
{
_((bool?)false).Should.Not.Be.Ok();
_(() => (bool?)false).Should.Not.Be.Ok();
}
[Fact]
public void String()
{
_((string)null).Should.Not.Be.Ok();
_(() => (string)null).Should.Not.Be.Ok();
_(System.String.Empty).Should.Not.Be.Ok();
_(() => System.String.Empty).Should.Not.Be.Ok();
_("").Should.Not.Be.Ok();
_(() => "").Should.Not.Be.Ok();
_(" ").Should.Not.Be.Ok();
_(() => " ").Should.Not.Be.Ok();
}
[Fact]
public void ReferenceTypes()
{
_((StubClass)null).Should.Not.Be.Ok();
_(() => (StubClass)null).Should.Not.Be.Ok();
}
}
}
}
| mit | C# |
fee4986ff8f6c739de7bd82ef2b4374216259095 | Change the web hook names | SevenSpikes/api-plugin-for-nopcommerce,SevenSpikes/api-plugin-for-nopcommerce | Nop.Plugin.Api/Constants/WebHookNames.cs | Nop.Plugin.Api/Constants/WebHookNames.cs | namespace Nop.Plugin.Api.Constants
{
public static class WebHookNames
{
public const string FiltersGetAction = "FiltersGetAction";
public const string GetWebhookByIdAction = "GetWebHookByIdAction";
public const string CustomerCreated = "customers/created";
public const string CustomerUpdated = "customers/updated";
public const string CustomerDeleted = "customers/deleted";
public const string ProductCreated = "products/created";
public const string ProductUpdated = "products/updated";
public const string ProductDeleted = "products/deleted";
public const string CategoryCreated = "categories/created";
public const string CategoryUpdated = "categories/updated";
public const string CategoryDeleted = "categories/deleted";
public const string OrderCreated = "orders/created";
public const string OrderUpdated = "orders/updated";
public const string OrderDeleted = "orders/deleted";
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nop.Plugin.Api.Constants
{
public static class WebHookNames
{
public const string FiltersGetAction = "FiltersGetAction";
public const string GetWebhookByIdAction = "GetWebHookByIdAction";
public const string CustomerCreated = "customer/created";
public const string CustomerUpdated = "customer/updated";
public const string CustomerDeleted = "customer/deleted";
public const string ProductCreated = "product/created";
public const string ProductUpdated = "product/updated";
public const string ProductDeleted = "product/deleted";
public const string CategoryCreated = "category/created";
public const string CategoryUpdated = "category/updated";
public const string CategoryDeleted = "category/deleted";
public const string OrderCreated = "order/created";
public const string OrderUpdated = "order/updated";
public const string OrderDeleted = "order/deleted";
}
}
| mit | C# |
50c15ad6cef5957b60db2432d26aac96981e6db5 | remove exception debug code | ceee/PocketSharp | PocketSharp/Utilities/PocketException.cs | PocketSharp/Utilities/PocketException.cs | using System;
namespace PocketSharp
{
/// <summary>
/// custom Pocket API Exceptions
/// </summary>
public class PocketException : Exception
{
/// <summary>
/// Gets or sets the pocket error code.
/// </summary>
/// <value>
/// The pocket error code.
/// </value>
public int? PocketErrorCode { get; set; }
/// <summary>
/// Gets or sets the pocket error.
/// </summary>
/// <value>
/// The pocket error.
/// </value>
public string PocketError { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="PocketException"/> class.
/// </summary>
public PocketException()
: base() { }
/// <summary>
/// Initializes a new instance of the <see cref="PocketException"/> class.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public PocketException(string message)
: base(message) { }
/// <summary>
/// Initializes a new instance of the <see cref="PocketException"/> class.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
public PocketException(string message, Exception innerException)
: base(message, innerException) { }
}
}
| using System;
using System.Diagnostics;
namespace PocketSharp
{
/// <summary>
/// custom Pocket API Exceptions
/// </summary>
public class PocketException : Exception
{
/// <summary>
/// Gets or sets the pocket error code.
/// </summary>
/// <value>
/// The pocket error code.
/// </value>
public int? PocketErrorCode { get; set; }
/// <summary>
/// Gets or sets the pocket error.
/// </summary>
/// <value>
/// The pocket error.
/// </value>
public string PocketError { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="PocketException"/> class.
/// </summary>
public PocketException()
: base() { }
/// <summary>
/// Initializes a new instance of the <see cref="PocketException"/> class.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public PocketException(string message)
: base(message) { Debug.WriteLine(message); }
/// <summary>
/// Initializes a new instance of the <see cref="PocketException"/> class.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
public PocketException(string message, Exception innerException)
: base(message, innerException) { Debug.WriteLine(message); }
}
}
| mit | C# |
3b383e74f5d9e2bc431f57869c5b11d4fee6d447 | Document IDrawable | Nabile-Rahmani/osu-framework,Tom94/osu-framework,paparony03/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,default0/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,Nabile-Rahmani/osu-framework,ppy/osu-framework,default0/osu-framework,paparony03/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,naoey/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,RedNesto/osu-framework,ppy/osu-framework,RedNesto/osu-framework,naoey/osu-framework,DrabWeb/osu-framework | osu.Framework/Graphics/IDrawable.cs | osu.Framework/Graphics/IDrawable.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Lists;
using osu.Framework.Timing;
using OpenTK;
namespace osu.Framework.Graphics
{
public interface IDrawable : IHasLifetime
{
/// <summary>
/// Absolute size of this Drawable in the <see cref="Parent"/>'s coordinate system.
/// </summary>
Vector2 DrawSize { get; }
/// <summary>
/// Contains a linear transformation, colour information, and blending information
/// of this drawable.
/// </summary>
DrawInfo DrawInfo { get; }
/// <summary>
/// The parent of this drawable in the scene graph.
/// </summary>
IContainer Parent { get; set; }
/// <summary>
/// Whether this drawable is present for any sort of user-interaction.
/// If this is false, then this drawable will not be drawn, it will not handle input,
/// and it will not affect layouting (e.g. autosizing and flow).
/// </summary>
bool IsPresent { get; }
/// <summary>
/// The clock of this drawable. Used for keeping track of time across frames.
/// </summary>
IFrameBasedClock Clock { get; }
/// <summary>
/// Accepts a vector in local coordinates and converts it to coordinates in another Drawable's space.
/// </summary>
/// <param name="input">A vector in local coordinates.</param>
/// <param name="other">The drawable in which space we want to transform the vector to.</param>
/// <returns>The vector in other's coordinates.</returns>
Vector2 ToSpaceOfOtherDrawable(Vector2 input, IDrawable other);
/// <summary>
/// Convert a position to the local coordinate system from either native or local to another drawable.
/// This is *not* the same space as the Position member variable (use Parent.GetLocalPosition() in this case).
/// </summary>
/// <param name="screenSpacePos">The input position.</param>
/// <returns>The output position.</returns>
Vector2 ToLocalSpace(Vector2 screenSpacePos);
/// <summary>
/// Determines how this Drawable is blended with other already drawn Drawables.
/// </summary>
BlendingMode BlendingMode { get; }
}
} | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Lists;
using osu.Framework.Timing;
using OpenTK;
namespace osu.Framework.Graphics
{
public interface IDrawable : IHasLifetime
{
Vector2 DrawSize { get; }
DrawInfo DrawInfo { get; }
IContainer Parent { get; set; }
/// <summary>
/// Whether this drawable is present for any sort of user-interaction.
/// If this is false, then this drawable will not be drawn, it will not handle input,
/// and it will not affect layouting (e.g. autosizing and flow).
/// </summary>
bool IsPresent { get; }
IFrameBasedClock Clock { get; }
/// <summary>
/// Accepts a vector in local coordinates and converts it to coordinates in another Drawable's space.
/// </summary>
/// <param name="input">A vector in local coordinates.</param>
/// <param name="other">The drawable in which space we want to transform the vector to.</param>
/// <returns>The vector in other's coordinates.</returns>
Vector2 ToSpaceOfOtherDrawable(Vector2 input, IDrawable other);
/// <summary>
/// Convert a position to the local coordinate system from either native or local to another drawable.
/// This is *not* the same space as the Position member variable (use Parent.GetLocalPosition() in this case).
/// </summary>
/// <param name="screenSpacePos">The input position.</param>
/// <returns>The output position.</returns>
Vector2 ToLocalSpace(Vector2 screenSpacePos);
BlendingMode BlendingMode { get; }
}
} | mit | C# |
3256f4c11649c27775fda9db5c273e349afaa34c | Change ExchangeType.Header to "headers" | zidad/EasyNetQ,micdenny/EasyNetQ,GeckoInformasjonssystemerAS/EasyNetQ,alexwiese/EasyNetQ,ar7z1/EasyNetQ,Ascendon/EasyNetQ,lukasz-lysik/EasyNetQ,blackcow02/EasyNetQ,nicklv/EasyNetQ,mleenhardt/EasyNetQ,scratch-net/EasyNetQ,chinaboard/EasyNetQ,mcthuesen/EasyNetQ,sanjaysingh/EasyNetQ,mcthuesen/EasyNetQ,blackcow02/EasyNetQ,Pliner/EasyNetQ,EIrwin/EasyNetQ,lukasz-lysik/EasyNetQ,fpommerening/EasyNetQ,fpommerening/EasyNetQ,tkirill/EasyNetQ,danbarua/EasyNetQ,alexwiese/EasyNetQ,maverix/EasyNetQ,GeckoInformasjonssystemerAS/EasyNetQ,danbarua/EasyNetQ,EasyNetQ/EasyNetQ,zidad/EasyNetQ,sanjaysingh/EasyNetQ,EIrwin/EasyNetQ,scratch-net/EasyNetQ,chinaboard/EasyNetQ,Ascendon/EasyNetQ,mcthuesen/EasyNetQ,alexwiese/EasyNetQ,reisenberger/EasyNetQ,mleenhardt/EasyNetQ,Pliner/EasyNetQ,maverix/EasyNetQ,ar7z1/EasyNetQ,nicklv/EasyNetQ,reisenberger/EasyNetQ,tkirill/EasyNetQ | Source/EasyNetQ/Topology/ExchangeType.cs | Source/EasyNetQ/Topology/ExchangeType.cs | namespace EasyNetQ.Topology
{
public class ExchangeType
{
public const string Direct = "direct";
public const string Topic = "topic";
public const string Fanout = "fanout";
public const string Header = "headers";
}
} | namespace EasyNetQ.Topology
{
public class ExchangeType
{
public const string Direct = "direct";
public const string Topic = "topic";
public const string Fanout = "fanout";
public const string Header = "header";
}
} | mit | C# |
dda88557a57b384b0539aa28475ea4ddebf52fcf | Add supporting 2D mode | t-mat/UnitySceneViewFovControl | Assets/SceneViewFovControl/Editor/Status.cs | Assets/SceneViewFovControl/Editor/Status.cs | using UnityEngine;
using UnityEditor;
#if !UNITY_EDITOR
#error This script must be placed under "Editor/" directory.
#endif
namespace UTJ.UnityEditor.Extension.SceneViewFovControl {
class Status {
float fov = 0.0f;
public void OnScene(SceneView sceneView) {
if(sceneView == null || sceneView.camera == null) {
return;
}
if(sceneView.in2DMode) {
return;
}
Camera camera = sceneView.camera;
if(fov == 0.0f) {
fov = camera.fieldOfView;
}
var ev = Event.current;
float deltaFov = 0.0f;
if(ev.modifiers == Settings.ModifiersNormal || ev.modifiers == Settings.ModifiersQuick) {
if(ev.type == EventType.ScrollWheel) {
// todo : Check compatibility of Event.delta.y.
// e.g. Platform, mice, etc.
deltaFov = ev.delta.y;
ev.Use();
} else if(ev.type == EventType.KeyDown && ev.keyCode == Settings.KeyCodeIncreaseFov) {
deltaFov = +1.0f;
ev.Use();
} else if(ev.type == EventType.KeyDown && ev.keyCode == Settings.KeyCodeDecreaseFov) {
deltaFov = -1.0f;
ev.Use();
}
}
if(deltaFov != 0.0f) {
deltaFov *= Settings.FovSpeed;
if(ev.modifiers == Settings.ModifiersQuick) {
deltaFov *= Settings.FovQuickMultiplier;
}
fov += deltaFov;
fov = Mathf.Clamp(fov, Settings.MinFov, Settings.MaxFov);
}
camera.fieldOfView = fov;
}
}
} // namespace
| using UnityEngine;
using UnityEditor;
#if !UNITY_EDITOR
#error This script must be placed under "Editor/" directory.
#endif
namespace UTJ.UnityEditor.Extension.SceneViewFovControl {
class Status {
float fov = 0.0f;
public void OnScene(SceneView sceneView) {
if(sceneView == null || sceneView.camera == null) {
return;
}
Camera camera = sceneView.camera;
if(fov == 0.0f) {
fov = camera.fieldOfView;
}
var ev = Event.current;
float deltaFov = 0.0f;
if(ev.modifiers == Settings.ModifiersNormal || ev.modifiers == Settings.ModifiersQuick) {
if(ev.type == EventType.ScrollWheel) {
// todo : Check compatibility of Event.delta.y.
// e.g. Platform, mice, etc.
deltaFov = ev.delta.y;
ev.Use();
} else if(ev.type == EventType.KeyDown && ev.keyCode == Settings.KeyCodeIncreaseFov) {
deltaFov = +1.0f;
ev.Use();
} else if(ev.type == EventType.KeyDown && ev.keyCode == Settings.KeyCodeDecreaseFov) {
deltaFov = -1.0f;
ev.Use();
}
}
if(deltaFov != 0.0f) {
deltaFov *= Settings.FovSpeed;
if(ev.modifiers == Settings.ModifiersQuick) {
deltaFov *= Settings.FovQuickMultiplier;
}
fov += deltaFov;
fov = Mathf.Clamp(fov, Settings.MinFov, Settings.MaxFov);
}
camera.fieldOfView = fov;
}
}
} // namespace
| mit | C# |
fc095820400c083859d72a93baff8c57cd3fd5ae | remove disabled attribute and disable it in js | KristianMariyanov/VotingSystem,KristianMariyanov/VotingSystem,KristianMariyanov/VotingSystem | VotingSystem.Web/Views/Votes/Vote.cshtml | VotingSystem.Web/Views/Votes/Vote.cshtml | @model VotingSystem.Web.ViewModels.Votes.VoteWithCandidatesInputModel
@{
ViewBag.Title = "Vote";
}
<h1>@Model.Title</h1>
<h2>You must vote for exactly <span id="count">@Model.NumberOfVotes</span> candidates</h2>
@using (Html.BeginForm("Vote", "Votes", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(x => x.Id)
@Html.HiddenFor(x => x.IdentificationCode)
@Html.EditorFor(c => c.Candidates)
<input id="submit" type="submit" value="Submit"class="btn btn-success btn-lg btn-block"/>
}
@section scripts {
@Scripts.Render("~/bundles/checkbox")
}
| @model VotingSystem.Web.ViewModels.Votes.VoteWithCandidatesInputModel
@{
ViewBag.Title = "Vote";
}
<h1>@Model.Title</h1>
<h2>You must vote for exactly <span id="count">@Model.NumberOfVotes</span> candidates</h2>
@using (Html.BeginForm("Vote", "Votes", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(x => x.Id)
@Html.HiddenFor(x => x.IdentificationCode)
@Html.EditorFor(c => c.Candidates)
<input id="submit" type="submit" disabled ="disabled" value="Submit"class="btn btn-success btn-lg btn-block"/>
}
@section scripts {
@Scripts.Render("~/bundles/checkbox")
}
| mit | C# |
c6c164f29e93bbe42d6d24eee60b15d4e0d4de89 | Change "Search" "Frame Padding" option default value | danielchalmers/DesktopWidgets | DesktopWidgets/Widgets/Search/Settings.cs | DesktopWidgets/Widgets/Search/Settings.cs | using System.ComponentModel;
using System.Windows;
using DesktopWidgets.WidgetBase.Settings;
namespace DesktopWidgets.Widgets.Search
{
public class Settings : WidgetSettingsBase
{
public Settings()
{
Style.Width = 150;
Style.FramePadding = new Thickness(0);
}
[Category("General")]
[DisplayName("URL Prefix")]
public string BaseUrl { get; set; } = "http://";
[Category("General")]
[DisplayName("URL Suffix")]
public string URLSuffix { get; set; }
[Category("Behavior (Hideable)")]
[DisplayName("Hide On Search")]
public bool HideOnSearch { get; set; } = true;
}
} | using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;
namespace DesktopWidgets.Widgets.Search
{
public class Settings : WidgetSettingsBase
{
public Settings()
{
Style.Width = 150;
}
[Category("General")]
[DisplayName("URL Prefix")]
public string BaseUrl { get; set; } = "http://";
[Category("General")]
[DisplayName("URL Suffix")]
public string URLSuffix { get; set; }
[Category("Behavior (Hideable)")]
[DisplayName("Hide On Search")]
public bool HideOnSearch { get; set; } = true;
}
} | apache-2.0 | C# |
ce00d33c47267bf33548b5046a1ed4a5827c0762 | remove RemoveUser | dataccountzXJ9/Lynx | Lynx/Services/Mute/Extensions.cs | Lynx/Services/Mute/Extensions.cs | using Discord;
using Discord.WebSocket;
using Lynx.Handler;
using Lynx.Methods;
using Lynx.Services.Embed;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Lynx.Services.Mute
{
public static class Extensions
{
public static DateTime GetTime(int Value, string Time)
{
var DT = DateTime.Now;
switch (Time.ToLowerInvariant())
{
case "hour":
case "hours":
return DT.AddHours(Value);
case "minutes":
case "minute":
return DT.AddMinutes(Value);
case "day":
case "days":
return DT.AddDays(Value);
case "second":
case "seconds":
return DT.AddSeconds(Value);
default:
return DT;
}
}
}
}
| using Discord;
using Discord.WebSocket;
using Lynx.Handler;
using Lynx.Methods;
using Lynx.Services.Embed;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Lynx.Services.Mute
{
public static class Extensions
{
static Timer Timer;
public static void RemoveUser(DiscordSocketClient Client)
{
Timer = new Timer(_ =>
{
var Config = Client.LoadMuteList();
var Mutelist = Config.MuteList;
Task.WhenAll(Mutelist.Select(async snc =>
{
if (DateTime.Now > snc.Value.UnmuteTime)
{
var Guild = Client.GetGuild(Convert.ToUInt64(snc.Value.GuildId));
var User = Client.GetGuild(Convert.ToUInt64(snc.Value.GuildId)).GetUser(Convert.ToUInt64(snc.Key)) as SocketGuildUser;
await (User as SocketGuildUser).RemoveRoleAsync((Guild.GetRole(Convert.ToUInt64(Guild.LoadServerConfig().Moderation.MuteRoleID))));
await User.Guild.GetLogChannel().SendMessageAsync($"", embed: new EmbedBuilder().WithSuccesColor().WithDescription($"**{User}** has been **unmuted** from text and voice chat.").WithFooter(x =>
{
x.Text = $"{User} | [Automatic Message]";
x.IconUrl = User.GetAvatarUrl();
}).Build());
await User.GetOrCreateDMChannelAsync().Result.SendMessageAsync("");
await Client.UpdateMuteList(User, null, UpdateHandler.MuteOption.Unmute);
}
}));
}, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1));
}
public static DateTime GetTime(int Value, string Time)
{
var DT = DateTime.Now;
switch (Time.ToLowerInvariant())
{
case "hour":
case "hours":
return DT.AddHours(Value);
case "minutes":
case "minute":
return DT.AddMinutes(Value);
case "day":
case "days":
return DT.AddDays(Value);
case "second":
case "seconds":
return DT.AddSeconds(Value);
default:
return DT;
}
}
}
}
| mit | C# |
225bc2d84a07dd7ac53a6548183271c46fd946bc | Fix ProfilePack.ProfileXml | emoacht/ManagedNativeWifi | ManagedNativeWifi/ProfilePack.cs | ManagedNativeWifi/ProfilePack.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ManagedNativeWifi
{
/// <summary>
/// Wireless profile information
/// </summary>
public class ProfilePack
{
/// <summary>
/// Profile name
/// </summary>
public string Name { get; }
/// <summary>
/// Associated wireless interface information
/// </summary>
public InterfaceInfo Interface { get; }
/// <summary>
/// Profile type
/// </summary>
public ProfileType ProfileType { get; }
/// <summary>
/// Profile XML document
/// </summary>
public ProfileDocument Document { get; }
/// <summary>
/// Profile XML string
/// </summary>
[Obsolete("Use Document.Xml method instead.")]
public string ProfileXml => Document.Xml;
/// <summary>
/// SSID of associated wireless LAN
/// </summary>
[Obsolete("Use Document.Ssid property instead.")]
public NetworkIdentifier Ssid => Document.Ssid;
/// <summary>
/// BSS network type of associated wireless LAN
/// </summary>
[Obsolete("Use Document.BssType property instead.")]
public BssType BssType => Document.BssType;
/// <summary>
/// Authentication of associated wireless LAN
/// </summary>
[Obsolete("Use Document.Authentication property instead.")]
public string Authentication => Document.AuthenticationString;
/// <summary>
/// Encryption of associated wireless LAN
/// </summary>
[Obsolete("Use Document.Encryption property instead.")]
public string Encryption => Document.EncryptionString;
/// <summary>
/// Whether this profile is set to be automatically connected
/// </summary>
[Obsolete("Use Document.IsAutoConnectEnabled property instead.")]
public bool IsAutomatic => Document.IsAutoConnectEnabled;
/// <summary>
/// Position in preference order of associated wireless interface
/// </summary>
public int Position { get; }
/// <summary>
/// Whether radio of associated wireless interface is on
/// </summary>
public bool IsRadioOn { get; }
/// <summary>
/// Signal quality of associated wireless LAN
/// </summary>
public int SignalQuality { get; }
/// <summary>
/// Whether associated wireless interface is connected to associated wireless LAN
/// </summary>
public bool IsConnected { get; }
/// <summary>
/// Constructor
/// </summary>
public ProfilePack(
string name,
InterfaceInfo interfaceInfo,
ProfileType profileType,
string profileXml,
int position,
bool isRadioOn,
int signalQuality,
bool isConnected)
{
this.Name = name;
this.Interface = interfaceInfo;
this.ProfileType = profileType;
Document = new ProfileDocument(profileXml);
this.Position = position;
this.IsRadioOn = isRadioOn;
this.SignalQuality = signalQuality;
this.IsConnected = isConnected;
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ManagedNativeWifi
{
/// <summary>
/// Wireless profile information
/// </summary>
public class ProfilePack
{
/// <summary>
/// Profile name
/// </summary>
public string Name { get; }
/// <summary>
/// Associated wireless interface information
/// </summary>
public InterfaceInfo Interface { get; }
/// <summary>
/// Profile type
/// </summary>
public ProfileType ProfileType { get; }
/// <summary>
/// Profile XML document
/// </summary>
public ProfileDocument Document { get; }
/// <summary>
/// Profile XML string
/// </summary>
[Obsolete("Use Document.ToString method instead.")]
public string ProfileXml => Document.ToString();
/// <summary>
/// SSID of associated wireless LAN
/// </summary>
[Obsolete("Use Document.Ssid property instead.")]
public NetworkIdentifier Ssid => Document.Ssid;
/// <summary>
/// BSS network type of associated wireless LAN
/// </summary>
[Obsolete("Use Document.BssType property instead.")]
public BssType BssType => Document.BssType;
/// <summary>
/// Authentication of associated wireless LAN
/// </summary>
[Obsolete("Use Document.Authentication property instead.")]
public string Authentication => Document.AuthenticationString;
/// <summary>
/// Encryption of associated wireless LAN
/// </summary>
[Obsolete("Use Document.Encryption property instead.")]
public string Encryption => Document.EncryptionString;
/// <summary>
/// Whether this profile is set to be automatically connected
/// </summary>
[Obsolete("Use Document.IsAutoConnectEnabled property instead.")]
public bool IsAutomatic => Document.IsAutoConnectEnabled;
/// <summary>
/// Position in preference order of associated wireless interface
/// </summary>
public int Position { get; }
/// <summary>
/// Whether radio of associated wireless interface is on
/// </summary>
public bool IsRadioOn { get; }
/// <summary>
/// Signal quality of associated wireless LAN
/// </summary>
public int SignalQuality { get; }
/// <summary>
/// Whether associated wireless interface is connected to associated wireless LAN
/// </summary>
public bool IsConnected { get; }
/// <summary>
/// Constructor
/// </summary>
public ProfilePack(
string name,
InterfaceInfo interfaceInfo,
ProfileType profileType,
string profileXml,
int position,
bool isRadioOn,
int signalQuality,
bool isConnected)
{
this.Name = name;
this.Interface = interfaceInfo;
this.ProfileType = profileType;
Document = new ProfileDocument(profileXml);
this.Position = position;
this.IsRadioOn = isRadioOn;
this.SignalQuality = signalQuality;
this.IsConnected = isConnected;
}
}
} | mit | C# |
da97efc53e5089a2bdd8894a61cbb128aa2346ad | update samples | ysinjab/InstagramCSharp | Samples/RealTime-Updates/Console/Program.cs | Samples/RealTime-Updates/Console/Program.cs | using InstagramCSharp;
using InstagramCSharp.Enums;
using InstagramCSharp.Models;
using Newtonsoft.Json;
using System;
namespace InstagramCSharp_ConsoleApp
{
class Program
{
static void Main(string[] args)
{
//Create RealTime subscription sample
string clientId = "YOUR_CLIENT_ID";
string clientSecret = "YOUR_CLIENT_SECRET";
string callbackUrl = "YOUR_CALLBACK_URI";
InstagramClient instagramClient = new InstagramClient(clientId, clientSecret);
try
{
var responseString = instagramClient.SubscriptionsEndpoints.CreateUserSubscriptionAsync("YOUR_VERIFY_TOKEN", callbackUrl, RealTimeAspects.Media).Result;
var newSubscription = JsonConvert.DeserializeObject<Envelope<Subscription>>(responseString);
}
catch (Exception ex)
{
//Log Exception
}
}
}
}
| using InstagramCSharp;
using InstagramCSharp.Enums;
using InstagramCSharp.Models;
using Newtonsoft.Json;
using System;
namespace InstagramCSharp_ConsoleApp
{
class Program
{
static void Main(string[] args)
{
//Create RealTime subscription sample
string clientId = "YOUR_CLIENT_ID";
string clientSecret = "YOUR_CLIENT_SECRET";
string callbackUrl = "YOUR_CALLBACK_URI";
InstagramClient instagramClient = new InstagramClient(clientId, clientSecret, null);
try
{
var response = instagramClient.SubscriptionsEndpoints.CreateGeographySubscriptionAsync("YOUR_VERIFY_TOKEN", callbackUrl, 52.521706, 13.365218, 5000, RealTimeAspects.Media).Result;
var newSubscription = JsonConvert.DeserializeObject<CreatedSubscription>(response);
}
catch (Exception ex)
{
//Log Exception
}
}
}
}
| mit | C# |
a74c207dd78f6ac4bbb4f9ec44d48bd7e3b9f2da | update assemblyinfo | gdbd/sharepointcommon | SharepointCommon/Properties/AssemblyInfo.cs | SharepointCommon/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("SharepointCommon")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("SharepointCommon")]
[assembly: AssemblyCopyright("Copyright © devi_ous 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: InternalsVisibleTo("SharepointCommon.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100E5BA2A2111EF698864E0AD4956A464642083581786AB9A60ADC32F1E46EEAD872B4349E8BBD6FD4FCC28230AF2406AB96B863B747E2D5C47E94EBC1C3FC83B14B3BB5E7B93EB44D9B79D55081D226B73209B30F93B0D208A418FF712F16C3961FC8B9BA24D2991B4FF155D91ED48D9BD83E477236F4FEF27967F39AC4AA9B4D1")] | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("SharepointCommon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("SharepointCommon")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: InternalsVisibleTo("SharepointCommon.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100E5BA2A2111EF698864E0AD4956A464642083581786AB9A60ADC32F1E46EEAD872B4349E8BBD6FD4FCC28230AF2406AB96B863B747E2D5C47E94EBC1C3FC83B14B3BB5E7B93EB44D9B79D55081D226B73209B30F93B0D208A418FF712F16C3961FC8B9BA24D2991B4FF155D91ED48D9BD83E477236F4FEF27967F39AC4AA9B4D1")] | mit | C# |
8e8ad6ba1028efd781e0daa6fec1b40db0d9eaf9 | Initialize InfoAppCommand with an IAppHarborClient | appharbor/appharbor-cli | src/AppHarbor/Commands/InfoAppCommand.cs | src/AppHarbor/Commands/InfoAppCommand.cs | using System;
namespace AppHarbor.Commands
{
public class InfoAppCommand : ICommand
{
private readonly IAppHarborClient _client;
public InfoAppCommand(IAppHarborClient client)
{
_client = client;
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| using System;
namespace AppHarbor.Commands
{
public class InfoAppCommand : ICommand
{
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
81a5b570dc6f6246000ef1c1eef71fa7e3ac40df | Reduce overheads of NullOperationListener.Delay | wvdd007/roslyn,eriawan/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,mavasani/roslyn,KevinRansom/roslyn,eriawan/roslyn,dotnet/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,physhi/roslyn,physhi/roslyn,weltkante/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,wvdd007/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,eriawan/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,physhi/roslyn,dotnet/roslyn,diryboy/roslyn | src/Workspaces/Core/Portable/Shared/TestHooks/AsynchronousOperationListenerProvider+NullOperationListener.cs | src/Workspaces/Core/Portable/Shared/TestHooks/AsynchronousOperationListenerProvider+NullOperationListener.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Shared.TestHooks
{
internal sealed partial class AsynchronousOperationListenerProvider
{
private sealed class NullOperationListener : IAsynchronousOperationListener
{
public IAsyncToken BeginAsyncOperation(
string name,
object? tag = null,
[CallerFilePath] string filePath = "",
[CallerLineNumber] int lineNumber = 0) => EmptyAsyncToken.Instance;
public Task<bool> Delay(TimeSpan delay, CancellationToken cancellationToken)
{
// This could be as simple as:
// await Task.Delay(delay, cancellationToken).ConfigureAwait(false);
// return true;
// However, whereas in general cancellation is expected to be rare and thus throwing
// an exception in response isn't very impactful, here it's expected to be the case
// more often than not as the operation is being used to delay an operation because
// it's expected something else is going to happen to obviate the need for that
// operation. Thus, we can spend a little more code avoiding the additional throw
// for the common case of an exception occurring.
if (cancellationToken.IsCancellationRequested)
{
return Task.FromCanceled<bool>(cancellationToken);
}
var t = Task.Delay(delay, cancellationToken);
if (t.IsCompleted)
{
return t.Status == TaskStatus.RanToCompletion ?
SpecializedTasks.True :
Task.FromCanceled<bool>(cancellationToken);
}
return t.ContinueWith(
_ => true,
CancellationToken.None,
TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.NotOnCanceled,
TaskScheduler.Default);
// Note the above passes CancellationToken.None and TaskContinuationOptions.NotOnCanceled.
// That's cheaper than passing cancellationToken and with the same semantics except
// that if the returned task does end up being canceled, any operation canceled exception
// thrown won't contain the cancellationToken. If that ends up being impactful, it can
// be switched to use `cancellationToken, TaskContinuationOptions.ExecuteSynchronously`.
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.CodeAnalysis.Shared.TestHooks
{
internal sealed partial class AsynchronousOperationListenerProvider
{
private sealed class NullOperationListener : IAsynchronousOperationListener
{
public IAsyncToken BeginAsyncOperation(
string name,
object? tag = null,
[CallerFilePath] string filePath = "",
[CallerLineNumber] int lineNumber = 0) => EmptyAsyncToken.Instance;
public async Task<bool> Delay(TimeSpan delay, CancellationToken cancellationToken)
{
await Task.Delay(delay, cancellationToken).ConfigureAwait(false);
return true;
}
}
}
}
| mit | C# |
0b105928016f1432c731d8809434470bf3883213 | stop outputting parse errors | x335/omnisharp-server,corngood/omnisharp-server,x335/omnisharp-server,syl20bnr/omnisharp-server,corngood/omnisharp-server,syl20bnr/omnisharp-server,OmniSharp/omnisharp-server,mispencer/OmniSharpServer,svermeulen/omnisharp-server | OmniSharp/Solution/CSharpFile.cs | OmniSharp/Solution/CSharpFile.cs | using System;
using System.IO;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.TypeSystem;
namespace OmniSharp.Solution
{
public class CSharpFile
{
public string FileName;
public ITextSource Content;
public SyntaxTree SyntaxTree;
public IUnresolvedFile ParsedFile;
public StringBuilderDocument Document { get; set; }
public CSharpFile(IProject project, string fileName) : this(project, fileName, File.ReadAllText(fileName))
{
}
public CSharpFile(IProject project, string fileName, string source)
{
Parse(project, fileName, source);
}
private void Parse(IProject project, string fileName, string source)
{
Console.WriteLine("Loading " + fileName);
this.FileName = fileName;
this.Content = new StringTextSource(source);
this.Document = new StringBuilderDocument(this.Content);
this.Project = project;
CSharpParser p = project.CreateParser();
this.SyntaxTree = p.Parse(Content.CreateReader(), fileName);
this.ParsedFile = this.SyntaxTree.ToTypeSystem();
if(this.Project.ProjectContent != null)
this.Project.ProjectContent.AddOrUpdateFiles(this.ParsedFile);
}
protected IProject Project { get; set; }
public void Update(string source)
{
this.Content = new StringTextSource(source);
Parse(Project, this.FileName, source);
}
}
}
| using System;
using System.IO;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.TypeSystem;
namespace OmniSharp.Solution
{
public class CSharpFile
{
public string FileName;
public ITextSource Content;
public SyntaxTree SyntaxTree;
public IUnresolvedFile ParsedFile;
public StringBuilderDocument Document { get; set; }
public CSharpFile(IProject project, string fileName) : this(project, fileName, File.ReadAllText(fileName))
{
}
public CSharpFile(IProject project, string fileName, string source)
{
Parse(project, fileName, source);
}
private void Parse(IProject project, string fileName, string source)
{
Console.WriteLine("Loading " + fileName);
this.FileName = fileName;
this.Content = new StringTextSource(source);
this.Document = new StringBuilderDocument(this.Content);
this.Project = project;
CSharpParser p = project.CreateParser();
this.SyntaxTree = p.Parse(Content.CreateReader(), fileName);
if (p.HasErrors)
{
Console.WriteLine("Error parsing " + fileName + ":");
foreach (var error in p.Errors)
{
Console.WriteLine(" " + error.Region + " " + error.Message);
}
}
this.ParsedFile = this.SyntaxTree.ToTypeSystem();
if(this.Project.ProjectContent != null)
this.Project.ProjectContent.AddOrUpdateFiles(this.ParsedFile);
}
protected IProject Project { get; set; }
public void Update(string source)
{
this.Content = new StringTextSource(source);
Parse(Project, this.FileName, source);
}
}
} | mit | C# |
e0d7b049a2d963949da6a028e7f94fadd85d0e25 | Change AssemblyInfo in Cruciatus project. | 2gis/Winium.Cruciatus | src/Cruciatus/Properties/AssemblyInfo.cs | src/Cruciatus/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("Cruciatus")]
[assembly: AssemblyDescription("Фреймворк для автоматизации тестирования пользовательского интерфейса WPF приложений.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("2ГИС")]
[assembly: AssemblyProduct("Cruciatus")]
[assembly: AssemblyCopyright("Copyright © 2ГИС 2014")]
[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("8d0fd035-b765-414a-a9f5-0f39ed1085cd")]
// Version information for an assembly consists of the following four values:
//
// Major Version - увеличение при сделаных обратно несовместимых изменениях
// Minor Version - увеличение при добавлении нового функционала, не нарушая обратной совместимости
// Build Number - увеличение при обратно совместимых исправлениях
// Revision - auto
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.*")]
[assembly: AssemblyFileVersion("1.1.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("Cruciatus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("2ГИС")]
[assembly: AssemblyProduct("Cruciatus")]
[assembly: AssemblyCopyright("Copyright © 2ГИС 2013")]
[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("8d0fd035-b765-414a-a9f5-0f39ed1085cd")]
// 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")]
| mpl-2.0 | C# |
a6877071f4814f1c52358dcc5b1ee716b0e719ee | Set continuation opcode for non-first frames in the writer | Chelaris182/wslib | wslib/Protocol/Writer/WsMessageWriter.cs | wslib/Protocol/Writer/WsMessageWriter.cs | using System;
using System.Threading;
using System.Threading.Tasks;
namespace wslib.Protocol.Writer
{
public class WsMessageWriter : IDisposable
{
private readonly MessageType messageType;
private readonly Action onDispose;
private readonly IWsMessageWriteStream stream;
private bool firstFrame = true;
public WsMessageWriter(MessageType messageType, Action onDispose, IWsMessageWriteStream stream)
{
this.messageType = messageType;
this.onDispose = onDispose;
this.stream = stream;
}
public Task WriteFrameAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
var header = generateFrameHeader(false);
firstFrame = false;
return stream.WriteFrame(header, buffer, offset, count, cancellationToken);
}
public Task CloseMessageAsync(CancellationToken cancellationToken)
{
var header = generateFrameHeader(true);
return stream.WriteFrame(header, new byte[0], 0, 0, cancellationToken);
}
public Task WriteMessageAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
var header = generateFrameHeader(true);
return stream.WriteFrame(header, buffer, offset, count, cancellationToken);
}
private WsFrameHeader generateFrameHeader(bool finFlag)
{
var opcode = firstFrame ?
(messageType == MessageType.Text ? WsFrameHeader.Opcodes.TEXT : WsFrameHeader.Opcodes.BINARY)
: WsFrameHeader.Opcodes.CONTINUATION;
return new WsFrameHeader { FIN = finFlag, OPCODE = opcode };
}
public void Dispose()
{
stream.Dispose();
onDispose();
}
}
} | using System;
using System.Threading;
using System.Threading.Tasks;
namespace wslib.Protocol.Writer
{
public class WsMessageWriter : IDisposable
{
private readonly MessageType messageType;
private readonly Action onDispose;
private readonly IWsMessageWriteStream stream;
public WsMessageWriter(MessageType messageType, Action onDispose, IWsMessageWriteStream stream)
{
this.messageType = messageType;
this.onDispose = onDispose;
this.stream = stream;
}
public Task WriteFrame(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
var header = generateFrameHeader(false); // TODO: change opcode to continuation
return stream.WriteFrame(header, buffer, offset, count, cancellationToken);
}
public Task CloseMessageAsync(CancellationToken cancellationToken)
{
var header = generateFrameHeader(true);
return stream.WriteFrame(header, new byte[0], 0, 0, cancellationToken);
}
public Task WriteMessageAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
var header = generateFrameHeader(true);
return stream.WriteFrame(header, buffer, offset, count, cancellationToken);
}
private WsFrameHeader generateFrameHeader(bool finFlag)
{
var opcode = messageType == MessageType.Text ? WsFrameHeader.Opcodes.TEXT : WsFrameHeader.Opcodes.BINARY;
return new WsFrameHeader { FIN = finFlag, OPCODE = opcode };
}
public void Dispose()
{
stream.Dispose();
onDispose();
}
}
} | mit | C# |
90e23daba4bdddc1122db8c1b955376c51f79ff7 | update user notification settings endpoint added | noordwind/Collectively.Api,noordwind/Coolector,noordwind/Coolector.Api,noordwind/Coolector,noordwind/Coolector.Api,noordwind/Collectively.Api | Collectively.Api/Modules/AccountModule.cs | Collectively.Api/Modules/AccountModule.cs | using Collectively.Api.Commands;
using Collectively.Api.Queries;
using Collectively.Api.Storages;
using Collectively.Api.Validation;
using Collectively.Messages.Commands.Notifications;
using Collectively.Messages.Commands.Users;
using Collectively.Services.Storage.Models.Notifications;
using Collectively.Services.Storage.Models.Users;
namespace Collectively.Api.Modules
{
public class AccountModule : ModuleBase
{
public AccountModule(ICommandDispatcher commandDispatcher,
IValidatorResolver validatorResolver,
IUserStorage userStorage,
INotificationSettingsStorage notificationSettingsStorage)
: base(commandDispatcher, validatorResolver)
{
Get("account", async args => await Fetch<GetAccount, User>
(async x => await userStorage.GetAsync(x.UserId)).HandleAsync());
Get("account/settings/notifications", async args => await Fetch<GetNotificationSettings, UserNotificationSettings>
(async x => await notificationSettingsStorage.GetAsync(x.UserId))
.HandleAsync());
Get("account/names/{name}/available", async args => await Fetch<GetNameAvailability, AvailableResource>
(async x => await userStorage.IsNameAvailableAsync(x.Name)).HandleAsync());
Put("account/name", async args => await For<ChangeUsername>()
.OnSuccessAccepted("account")
.DispatchAsync());
Put("account/settings/notifications", async args => await For<UpdateUserNotificationSettings>()
.OnSuccessAccepted("account")
.DispatchAsync());
Post("account/avatar", async args => await For<UploadAvatar>()
.OnSuccessAccepted("account")
.DispatchAsync());
Delete("account/avatar", async args => await For<RemoveAvatar>()
.OnSuccessAccepted()
.DispatchAsync());
Put("account/password", async args => await For<ChangePassword>()
.OnSuccessAccepted("account")
.DispatchAsync());
}
}
} | using Collectively.Api.Commands;
using Collectively.Api.Queries;
using Collectively.Api.Storages;
using Collectively.Api.Validation;
using Collectively.Messages.Commands.Users;
using Collectively.Services.Storage.Models.Notifications;
using Collectively.Services.Storage.Models.Users;
namespace Collectively.Api.Modules
{
public class AccountModule : ModuleBase
{
public AccountModule(ICommandDispatcher commandDispatcher,
IValidatorResolver validatorResolver,
IUserStorage userStorage,
INotificationSettingsStorage notificationSettingsStorage)
: base(commandDispatcher, validatorResolver)
{
Get("account", async args => await Fetch<GetAccount, User>
(async x => await userStorage.GetAsync(x.UserId)).HandleAsync());
Get("account/settings/notifications", async args => await Fetch<GetNotificationSettings, UserNotificationSettings>
(async x => await notificationSettingsStorage.GetAsync(x.UserId))
.HandleAsync());
Get("account/names/{name}/available", async args => await Fetch<GetNameAvailability, AvailableResource>
(async x => await userStorage.IsNameAvailableAsync(x.Name)).HandleAsync());
Put("account/name", async args => await For<ChangeUsername>()
.OnSuccessAccepted("account")
.DispatchAsync());
Post("account/avatar", async args => await For<UploadAvatar>()
.OnSuccessAccepted("account")
.DispatchAsync());
Delete("account/avatar", async args => await For<RemoveAvatar>()
.OnSuccessAccepted()
.DispatchAsync());
Put("account/password", async args => await For<ChangePassword>()
.OnSuccessAccepted("account")
.DispatchAsync());
}
}
} | mit | C# |
eb939eed20326e07225d899859dc7755bc17f05a | make argument helper public, its useful | splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net | IPTables.Net/Supporting/ArgumentHelper.cs | IPTables.Net/Supporting/ArgumentHelper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IPTables.Net.Supporting
{
public class ArgumentHelper
{
public static string[] SplitArguments(string commandLine)
{
char[] parmChars = commandLine.ToCharArray();
bool inSingleQuote = false;
bool inDoubleQuote = false;
for (int index = 0; index < parmChars.Length; index++)
{
if (parmChars[index] == '"' && !inSingleQuote)
{
inDoubleQuote = !inDoubleQuote;
parmChars[index] = '\n';
}
if (parmChars[index] == '\'' && !inDoubleQuote)
{
inSingleQuote = !inSingleQuote;
parmChars[index] = '\n';
}
if (!inSingleQuote && !inDoubleQuote && parmChars[index] == ' ')
parmChars[index] = '\n';
}
return (new string(parmChars)).Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IPTables.Net.Supporting
{
internal class ArgumentHelper
{
internal static string[] SplitArguments(string commandLine)
{
char[] parmChars = commandLine.ToCharArray();
bool inSingleQuote = false;
bool inDoubleQuote = false;
for (int index = 0; index < parmChars.Length; index++)
{
if (parmChars[index] == '"' && !inSingleQuote)
{
inDoubleQuote = !inDoubleQuote;
parmChars[index] = '\n';
}
if (parmChars[index] == '\'' && !inDoubleQuote)
{
inSingleQuote = !inSingleQuote;
parmChars[index] = '\n';
}
if (!inSingleQuote && !inDoubleQuote && parmChars[index] == ' ')
parmChars[index] = '\n';
}
return (new string(parmChars)).Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
}
}
}
| apache-2.0 | C# |
221941b0b8f4ffd62168673ba77bc7bca439d396 | update in noise machine | p-org/PSharp | Libraries/Common/Machines/NoiseMachine.cs | Libraries/Common/Machines/NoiseMachine.cs | //-----------------------------------------------------------------------
// <copyright file="NoiseMachine.cs">
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// 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.
// </copyright>
//-----------------------------------------------------------------------
namespace Microsoft.PSharp.Common
{
public class NoiseMachine : Machine
{
public class Configure : Event
{
public MachineId Sender;
public int Duration;
public Configure(MachineId sender, int duration)
: base()
{
this.Sender = sender;
this.Duration = duration;
}
}
public class Done : Event { }
private class NoiseEvent : Event { }
private MachineId Sender;
private int Duration;
[Start]
[OnEntry(nameof(InitOnEntry))]
private class Init : MachineState { }
private void InitOnEntry()
{
this.Sender = (this.ReceivedEvent as Configure).Sender;
this.Duration = (this.ReceivedEvent as Configure).Duration;
this.Goto(typeof(Active));
}
[OnEntry(nameof(ActiveOnEntry))]
[OnEventGotoState(typeof(NoiseEvent), typeof(Active))]
private class Active : MachineState { }
private void ActiveOnEntry()
{
this.Send(this.Id, new NoiseEvent());
this.Duration--;
if (this.Duration <= 0)
{
this.Send(this.Sender, new Done());
this.Raise(new Halt());
}
}
}
}
| //-----------------------------------------------------------------------
// <copyright file="NoiseMachine.cs">
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// 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.
// </copyright>
//-----------------------------------------------------------------------
namespace Microsoft.PSharp.Common
{
public class NoiseMachine : Machine
{
public class ConfigureEvent : Event
{
public MachineId Sender;
public int Duration;
public ConfigureEvent(MachineId sender, int duration)
: base()
{
this.Sender = sender;
this.Duration = duration;
}
}
public class Done : Event { }
private class NoiseEvent : Event { }
private MachineId Sender;
private int Duration;
[Start]
[OnEntry(nameof(InitOnEntry))]
private class Init : MachineState { }
private void InitOnEntry()
{
this.Sender = (this.ReceivedEvent as ConfigureEvent).Sender;
this.Duration = (this.ReceivedEvent as ConfigureEvent).Duration;
this.Goto(typeof(Active));
}
[OnEntry(nameof(ActiveOnEntry))]
[OnEventGotoState(typeof(NoiseEvent), typeof(Active))]
private class Active : MachineState { }
private void ActiveOnEntry()
{
this.Send(this.Id, new NoiseEvent());
this.Duration--;
if (this.Duration <= 0)
{
this.Send(this.Sender, new Done());
this.Raise(new Halt());
}
}
}
}
| mit | C# |
236133825949d1fa37c1cd0cfb31a18c0515db19 | Update video player | anbinhtrong/PlayEmbededHttpVideo,anbinhtrong/PlayEmbededHttpVideo | PlayVideo/Views/EmbedContent/Index.cshtml | PlayVideo/Views/EmbedContent/Index.cshtml |
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<div>
<iframe height="283" frameborder="0" width="452" src="http://www.tudou.com/v/www7AcxRtY4/&resourceId=0_04_05_99&autoPlay=true&autostart=true/v.swf"></iframe>
</div>
<h2>Video 2</h2>
<video width="480" height="320" src="http://v.youku.com/player/getRealM3U8/vid/XMzkxMTM3MDQw/type//video.m3u8" controls>
<embed src="http://player.youku.com/player.php/sid/XMzkxMTM3MDQw/v.swf" allowfullscreen="true" quality="high" width="480" height="320" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash"></embed>
</video>
<h3>Video 3</h3>
<div>
<embed src="//www.tudou.com/l/p6Ne7L01n9E/&resourceId=0_05_05_99&iid=184846681&bid=05/v.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="480" height="400"></embed>
</div>
<!-- Start of Brightcove Player -->
<div style="display:none">
Player description
</div>
<!--
By use of this code snippet, I agree to the Brightcove Publisher T and C
found at http://corp.brightcove.com/legal/terms_publisher.cfm.
-->
<script language="JavaScript" type="text/javascript"
src="https://sadmin.brightcove.com/js/BrightcoveExperiences.js">
</script>
<object id="myExperience" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="486" />
<param name="height" value="412" />
<param name="playerID" value="1726689948" />
<param name="publisherID" value="270881183" />
<param name="playerKey" value="AQ~~,AAAAstMe5SE~,5vOZeV6rFDb4JUBomUtNzVLbOfHyhc1i" />
<param name="isVid" value="true" />
<param name="secureConnections" value="true" />
<param name="secureHTMLConnections" value="true" />
</object>
<!-- End of Brightcove Player -->
<script>
!function (a) { var b = "embedly-platform", c = "script"; if (!a.getElementById(b)) { var d = a.createElement(c); d.id = b, d.src = ("https:" === document.location.protocol ? "https" : "http") + "://cdn.embedly.com/widgets/platform.js"; var e = document.getElementsByTagName(c)[0]; e.parentNode.insertBefore(d, e) } }(document);
</script>
@section scripts{
}
|
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<div>
<iframe height="283" frameborder="0" width="452" src="http://www.tudou.com/v/www7AcxRtY4/&resourceId=0_04_05_99&autoPlay=true&autostart=true/v.swf"></iframe>
</div>
@section scripts{
}
| mit | C# |
8cb6bfcf4491f226e3005a6b16357babc0b7fd9d | append the thirdparty in `glTFForUE4Ed` | code4game/glTFForUE4,code4game/glTFForUE4,code4game/glTFForUE4 | Source/glTFForUE4Ed/glTFForUE4Ed.Build.cs | Source/glTFForUE4Ed/glTFForUE4Ed.Build.cs | // Copyright 2017 - 2018 Code 4 Game, Org. All Rights Reserved.
using UnrealBuildTool;
public class glTFForUE4Ed : ModuleRules
{
public glTFForUE4Ed(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseSharedPCHs;
PrivatePCHHeaderFile = "Private/glTFForUE4EdPrivatePCH.h";
PrivateIncludePaths.AddRange(new [] {
"glTFForUE4Ed/Private",
});
PublicDependencyModuleNames.AddRange(new [] {
"Core",
});
PrivateDependencyModuleNames.AddRange(new [] {
"CoreUObject",
"Engine",
"RHI",
"InputCore",
"RenderCore",
"SlateCore",
"Slate",
"ImageWrapper",
"AssetRegistry",
"UnrealEd",
"MainFrame",
"Documentation",
"PropertyEditor",
"EditorStyle",
"RawMesh",
"MeshUtilities",
"glTFForUE4",
"libgltf_ue4",
"libdraco_ue4",
});
}
}
| // Copyright 2017 - 2018 Code 4 Game, Org. All Rights Reserved.
using UnrealBuildTool;
public class glTFForUE4Ed : ModuleRules
{
public glTFForUE4Ed(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseSharedPCHs;
PrivatePCHHeaderFile = "Private/glTFForUE4EdPrivatePCH.h";
PrivateIncludePaths.AddRange(new [] {
"glTFForUE4Ed/Private",
});
PublicDependencyModuleNames.AddRange(new [] {
"Core",
});
PrivateDependencyModuleNames.AddRange(new [] {
"CoreUObject",
"Engine",
"RHI",
"InputCore",
"RenderCore",
"SlateCore",
"Slate",
"ImageWrapper",
"AssetRegistry",
"UnrealEd",
"MainFrame",
"Documentation",
"PropertyEditor",
"EditorStyle",
"RawMesh",
"MeshUtilities",
"glTFForUE4",
});
}
}
| mit | C# |
ee237498e6075988507cd281e7bf668076f070ff | Reorder source types enums. | GetTabster/Tabster | Tabster.Core/Types/TablatureSourceType.cs | Tabster.Core/Types/TablatureSourceType.cs | namespace Tabster.Core.Types
{
public enum TablatureSourceType
{
UserCreated,
FileImport,
Download
}
} | namespace Tabster.Core.Types
{
public enum TablatureSourceType
{
Download,
FileImport,
UserCreated
}
} | apache-2.0 | C# |
4adc7c346fa33397bd8f0290c967d35f269a9306 | Fix resource leak in PanelAnnounce | iridinite/shiftdrive | Client/PanelAnnounce.cs | Client/PanelAnnounce.cs | /*
** Project ShiftDrive
** (C) Mika Molenkamp, 2016-2017.
*/
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace ShiftDrive {
/// <summary>
/// Represents a UI element that shows the server's last announcement text.
/// </summary>
internal sealed class PanelAnnounce : Control {
private string announceText = String.Empty;
private float announceHoldTime;
public PanelAnnounce() {
// subscribe to networking events
NetClient.Announcement += NetClient_Announcement;
}
private void NetClient_Announcement(string text) {
announceHoldTime = 10f;
announceText = text;
}
protected override void OnDraw(SpriteBatch spriteBatch) {
spriteBatch.Draw(Assets.GetTexture("ui/announcepanel"), new Rectangle(SDGame.Inst.GameWidth - 450, -20, 512, 64), Color.White);
spriteBatch.DrawString(Assets.fontDefault, announceText, new Vector2(SDGame.Inst.GameWidth - 430, 12), Color.White);
}
protected override void OnUpdate(GameTime gameTime) {
// animate announcement text
var dt = (float)gameTime.ElapsedGameTime.TotalSeconds;
announceHoldTime -= dt;
if (announceHoldTime < 0f)
announceText = "";
}
protected override void OnDestroy() {
NetClient.Announcement -= NetClient_Announcement;
}
}
}
| /*
** Project ShiftDrive
** (C) Mika Molenkamp, 2016-2017.
*/
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace ShiftDrive {
/// <summary>
/// Represents a UI element that shows the server's last announcement text.
/// </summary>
internal sealed class PanelAnnounce : Control {
private string announceText = String.Empty;
private float announceHoldTime;
public PanelAnnounce() {
// subscribe to networking events
NetClient.Announcement += text => {
announceHoldTime = 10f;
announceText = text;
};
}
protected override void OnDraw(SpriteBatch spriteBatch) {
spriteBatch.Draw(Assets.GetTexture("ui/announcepanel"), new Rectangle(SDGame.Inst.GameWidth - 450, -20, 512, 64), Color.White);
spriteBatch.DrawString(Assets.fontDefault, announceText, new Vector2(SDGame.Inst.GameWidth - 430, 12), Color.White);
}
protected override void OnUpdate(GameTime gameTime) {
// animate announcement text
var dt = (float)gameTime.ElapsedGameTime.TotalSeconds;
announceHoldTime -= dt;
if (announceHoldTime < 0f)
announceText = "";
}
}
}
| bsd-3-clause | C# |
84aeac2049c18f6f2561978be717693d0bbe6a87 | Use string instead of String. | Quickshot/DupImageLib,Quickshot/DupImage | DupImage/ImageStruct.cs | DupImage/ImageStruct.cs | using System;
using System.Collections.Generic;
using System.IO;
namespace DupImage
{
/// <summary>
/// Structure for containing image information and hash values.
/// </summary>
public class ImageStruct
{
/// <summary>
/// Construct a new ImageStruct from FileInfo.
/// </summary>
/// <param name="file">FileInfo to be used.</param>
public ImageStruct(FileInfo file)
{
if (file == null) throw new ArgumentNullException(nameof(file));
ImagePath = file.FullName;
// Init Hash
Hash = new long[1];
}
/// <summary>
/// Construct a new ImageStruct from image path.
/// </summary>
/// <param name="pathToImage">Image location</param>
public ImageStruct(string pathToImage)
{
ImagePath = pathToImage;
// Init Hash
Hash = new long[1];
}
/// <summary>
/// ImagePath information.
/// </summary>
public string ImagePath { get; private set; }
/// <summary>
/// Hash of the image. Uses longs instead of ulong to be CLS compliant.
/// </summary>
public long[] Hash { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.IO;
namespace DupImage
{
/// <summary>
/// Structure for containing image information and hash values.
/// </summary>
public class ImageStruct
{
/// <summary>
/// Construct a new ImageStruct from FileInfo.
/// </summary>
/// <param name="file">FileInfo to be used.</param>
public ImageStruct(FileInfo file)
{
if (file == null) throw new ArgumentNullException(nameof(file));
ImagePath = file.FullName;
// Init Hash
Hash = new long[1];
}
/// <summary>
/// Construct a new ImageStruct from image path.
/// </summary>
/// <param name="pathToImage">Image location</param>
public ImageStruct(String pathToImage)
{
ImagePath = pathToImage;
// Init Hash
Hash = new long[1];
}
/// <summary>
/// ImagePath information.
/// </summary>
public String ImagePath { get; private set; }
/// <summary>
/// Hash of the image. Uses longs instead of ulong to be CLS compliant.
/// </summary>
public long[] Hash { get; set; }
}
}
| unknown | C# |
09ca47b7b6f1e908adce6fdda9cb0f10fb82f877 | Handle NRE | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/BitcoinCore/Monitoring/RpcFeeProvider.cs | WalletWasabi/BitcoinCore/Monitoring/RpcFeeProvider.cs | using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using NBitcoin;
using NBitcoin.RPC;
using WalletWasabi.Bases;
using WalletWasabi.Blockchain.Analysis.FeesEstimation;
using WalletWasabi.Helpers;
namespace WalletWasabi.BitcoinCore.Monitoring
{
public class RpcFeeProvider : PeriodicRunner<AllFeeEstimate>, IFeeProvider
{
public RPCClient RpcClient { get; set; }
public RpcFeeProvider(TimeSpan period, RPCClient rpcClient) : base(period, null)
{
RpcClient = Guard.NotNull(nameof(rpcClient), rpcClient);
}
public override async Task<AllFeeEstimate> ActionAsync(CancellationToken cancel)
{
try
{
return await RpcClient.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative, true, true).ConfigureAwait(false);
}
catch
{
if (Status != null)
{
Status = new AllFeeEstimate(Status, false);
}
throw;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using NBitcoin;
using NBitcoin.RPC;
using WalletWasabi.Bases;
using WalletWasabi.Blockchain.Analysis.FeesEstimation;
using WalletWasabi.Helpers;
namespace WalletWasabi.BitcoinCore.Monitoring
{
public class RpcFeeProvider : PeriodicRunner<AllFeeEstimate>, IFeeProvider
{
public RPCClient RpcClient { get; set; }
public RpcFeeProvider(TimeSpan period, RPCClient rpcClient) : base(period, null)
{
RpcClient = Guard.NotNull(nameof(rpcClient), rpcClient);
}
public override async Task<AllFeeEstimate> ActionAsync(CancellationToken cancel)
{
try
{
return await RpcClient.EstimateAllFeeAsync(EstimateSmartFeeMode.Conservative, true, true).ConfigureAwait(false);
}
catch
{
Status = new AllFeeEstimate(Status, false);
throw;
}
}
}
}
| mit | C# |
22e68c4d74652f25654d2650b4965c8470022950 | Improve diff. | wvdd007/roslyn,aelij/roslyn,ErikSchierboom/roslyn,lorcanmooney/roslyn,weltkante/roslyn,TyOverby/roslyn,srivatsn/roslyn,MichalStrehovsky/roslyn,AlekseyTs/roslyn,mavasani/roslyn,jamesqo/roslyn,brettfo/roslyn,heejaechang/roslyn,sharwell/roslyn,xasx/roslyn,bartdesmet/roslyn,mmitche/roslyn,sharwell/roslyn,genlu/roslyn,CyrusNajmabadi/roslyn,physhi/roslyn,bkoelman/roslyn,jcouv/roslyn,abock/roslyn,Giftednewt/roslyn,kelltrick/roslyn,cston/roslyn,swaroop-sridhar/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,genlu/roslyn,OmarTawfik/roslyn,MattWindsor91/roslyn,KirillOsenkov/roslyn,robinsedlaczek/roslyn,kelltrick/roslyn,brettfo/roslyn,jkotas/roslyn,physhi/roslyn,tmeschter/roslyn,DustinCampbell/roslyn,reaction1989/roslyn,dpoeschl/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,orthoxerox/roslyn,MattWindsor91/roslyn,AnthonyDGreen/roslyn,MattWindsor91/roslyn,shyamnamboodiripad/roslyn,amcasey/roslyn,mmitche/roslyn,diryboy/roslyn,eriawan/roslyn,dotnet/roslyn,nguerrera/roslyn,aelij/roslyn,kelltrick/roslyn,bkoelman/roslyn,KevinRansom/roslyn,Giftednewt/roslyn,orthoxerox/roslyn,jamesqo/roslyn,agocke/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,AlekseyTs/roslyn,tmat/roslyn,davkean/roslyn,eriawan/roslyn,tannergooding/roslyn,tvand7093/roslyn,AmadeusW/roslyn,heejaechang/roslyn,brettfo/roslyn,davkean/roslyn,wvdd007/roslyn,xasx/roslyn,dpoeschl/roslyn,mgoertz-msft/roslyn,stephentoub/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,lorcanmooney/roslyn,jamesqo/roslyn,tmat/roslyn,pdelvo/roslyn,pdelvo/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,bartdesmet/roslyn,tvand7093/roslyn,weltkante/roslyn,jmarolf/roslyn,khyperia/roslyn,lorcanmooney/roslyn,amcasey/roslyn,CyrusNajmabadi/roslyn,gafter/roslyn,aelij/roslyn,MichalStrehovsky/roslyn,stephentoub/roslyn,dpoeschl/roslyn,reaction1989/roslyn,yeaicc/roslyn,jkotas/roslyn,tmat/roslyn,mgoertz-msft/roslyn,mattscheffer/roslyn,jasonmalinowski/roslyn,AmadeusW/roslyn,eriawan/roslyn,AlekseyTs/roslyn,abock/roslyn,xasx/roslyn,VSadov/roslyn,srivatsn/roslyn,CyrusNajmabadi/roslyn,paulvanbrenk/roslyn,bkoelman/roslyn,panopticoncentral/roslyn,KevinRansom/roslyn,diryboy/roslyn,physhi/roslyn,MattWindsor91/roslyn,OmarTawfik/roslyn,dotnet/roslyn,khyperia/roslyn,KevinRansom/roslyn,jmarolf/roslyn,MichalStrehovsky/roslyn,TyOverby/roslyn,robinsedlaczek/roslyn,AnthonyDGreen/roslyn,AmadeusW/roslyn,srivatsn/roslyn,swaroop-sridhar/roslyn,mmitche/roslyn,genlu/roslyn,CaptainHayashi/roslyn,agocke/roslyn,DustinCampbell/roslyn,Giftednewt/roslyn,VSadov/roslyn,CaptainHayashi/roslyn,jcouv/roslyn,cston/roslyn,jmarolf/roslyn,nguerrera/roslyn,mavasani/roslyn,yeaicc/roslyn,tvand7093/roslyn,mgoertz-msft/roslyn,paulvanbrenk/roslyn,yeaicc/roslyn,gafter/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,jasonmalinowski/roslyn,abock/roslyn,amcasey/roslyn,mavasani/roslyn,Hosch250/roslyn,pdelvo/roslyn,weltkante/roslyn,bartdesmet/roslyn,stephentoub/roslyn,robinsedlaczek/roslyn,nguerrera/roslyn,khyperia/roslyn,tmeschter/roslyn,tmeschter/roslyn,mattscheffer/roslyn,sharwell/roslyn,TyOverby/roslyn,mattscheffer/roslyn,reaction1989/roslyn,jasonmalinowski/roslyn,Hosch250/roslyn,paulvanbrenk/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,VSadov/roslyn,jcouv/roslyn,AnthonyDGreen/roslyn,cston/roslyn,orthoxerox/roslyn,panopticoncentral/roslyn,KirillOsenkov/roslyn,jkotas/roslyn,Hosch250/roslyn,agocke/roslyn,tannergooding/roslyn,ErikSchierboom/roslyn,CaptainHayashi/roslyn,gafter/roslyn,swaroop-sridhar/roslyn,davkean/roslyn,DustinCampbell/roslyn,heejaechang/roslyn,panopticoncentral/roslyn,OmarTawfik/roslyn | src/Features/Core/Portable/DocumentHighlighting/IDocumentHighlightsService.cs | src/Features/Core/Portable/DocumentHighlighting/IDocumentHighlightsService.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.DocumentHighlighting
{
internal enum HighlightSpanKind
{
None,
Definition,
Reference,
WrittenReference,
}
internal struct HighlightSpan
{
public TextSpan TextSpan { get; }
public HighlightSpanKind Kind { get; }
public HighlightSpan(TextSpan textSpan, HighlightSpanKind kind) : this()
{
this.TextSpan = textSpan;
this.Kind = kind;
}
}
internal struct DocumentHighlights
{
public Document Document { get; }
public ImmutableArray<HighlightSpan> HighlightSpans { get; }
public DocumentHighlights(Document document, ImmutableArray<HighlightSpan> highlightSpans)
{
this.Document = document;
this.HighlightSpans = highlightSpans;
}
}
/// <summary>
/// Note: This is the new version of the language service and superceded the same named type
/// in the EditorFeatures layer.
/// </summary>
internal interface IDocumentHighlightsService : ILanguageService
{
Task<ImmutableArray<DocumentHighlights>> GetDocumentHighlightsAsync(
Document document, int position, IImmutableSet<Document> documentsToSearch, CancellationToken cancellationToken);
}
} | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.DocumentHighlighting
{
internal enum HighlightSpanKind
{
None,
Definition,
Reference,
WrittenReference,
}
internal struct HighlightSpan
{
public TextSpan TextSpan { get; }
public HighlightSpanKind Kind { get; }
public HighlightSpan(TextSpan textSpan, HighlightSpanKind kind) : this()
{
this.TextSpan = textSpan;
this.Kind = kind;
}
}
internal struct DocumentHighlights
{
public Document Document { get; }
public ImmutableArray<HighlightSpan> HighlightSpans { get; }
public DocumentHighlights(Document document, ImmutableArray<HighlightSpan> highlightSpans)
{
this.Document = document;
this.HighlightSpans = highlightSpans;
}
}
internal interface IDocumentHighlightsService : ILanguageService
{
Task<ImmutableArray<DocumentHighlights>> GetDocumentHighlightsAsync(
Document document, int position, IImmutableSet<Document> documentsToSearch, CancellationToken cancellationToken);
}
}
| mit | C# |
f8ac9c2f97d0b2cb553416a73523bfe09887f013 | Support X-Forwarded-Host for tenants (#1185) | stevetayloruk/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,OrchardCMS/Brochard,petedavis/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,petedavis/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,xkproject/Orchard2 | src/OrchardCore/OrchardCore.Modules/Extensions/RunningShellTableExtensions.cs | src/OrchardCore/OrchardCore.Modules/Extensions/RunningShellTableExtensions.cs | using System;
using Microsoft.AspNetCore.Http;
using OrchardCore.Environment.Shell;
namespace OrchardCore.Modules
{
public static class RunningShellTableExtensions
{
private const string XForwardedHost = "X-Forwarded-Host";
public static ShellSettings Match(this IRunningShellTable table, HttpContext httpContext)
{
if (httpContext == null)
{
throw new ArgumentNullException(nameof(httpContext));
}
var httpRequest = httpContext.Request;
// The Host property contains the value as set from the client. It is replaced automatically
// to the value of X-Forwarded-Host when UseIISIntegration() is invoked.
// The same way .Scheme contains the protocol that the user set and not what a proxy
// could be using (see X-Forwarded-Proto).
return table.Match(httpRequest.Host.ToString(), httpRequest.Path);
}
}
} | using System;
using Microsoft.AspNetCore.Http;
using OrchardCore.Environment.Shell;
namespace OrchardCore.Modules
{
public static class RunningShellTableExtensions
{
public static ShellSettings Match(this IRunningShellTable table, HttpContext httpContext)
{
// use Host header to prevent proxy alteration of the orignal request
try
{
var httpRequest = httpContext.Request;
if (httpRequest == null)
{
return null;
}
var host = httpRequest.Headers["Host"].ToString();
return table.Match(host ?? string.Empty, httpRequest.Path);
}
catch (Exception)
{
// can happen on cloud service for an unknown reason
return null;
}
}
}
} | bsd-3-clause | C# |
5f0251d10f4ef5070b76ea3b25afce204bbc124f | Fix deadlock in SslStream_SameCertUsedForClientAndServer_Ok test on single core | ViktorHofer/corefx,ravimeda/corefx,mazong1123/corefx,ptoonen/corefx,zhenlan/corefx,nbarbettini/corefx,yizhang82/corefx,gkhanna79/corefx,nbarbettini/corefx,alexperovich/corefx,alexperovich/corefx,gkhanna79/corefx,dhoehna/corefx,fgreinacher/corefx,ViktorHofer/corefx,billwert/corefx,stephenmichaelf/corefx,ericstj/corefx,alexperovich/corefx,ravimeda/corefx,the-dwyer/corefx,nchikanov/corefx,krk/corefx,yizhang82/corefx,dotnet-bot/corefx,krytarowski/corefx,mazong1123/corefx,richlander/corefx,mazong1123/corefx,tijoytom/corefx,DnlHarvey/corefx,mmitche/corefx,DnlHarvey/corefx,nbarbettini/corefx,billwert/corefx,the-dwyer/corefx,jlin177/corefx,dhoehna/corefx,jlin177/corefx,the-dwyer/corefx,ravimeda/corefx,parjong/corefx,wtgodbe/corefx,jlin177/corefx,cydhaselton/corefx,yizhang82/corefx,seanshpark/corefx,elijah6/corefx,BrennanConroy/corefx,cydhaselton/corefx,rubo/corefx,stone-li/corefx,tijoytom/corefx,cydhaselton/corefx,billwert/corefx,seanshpark/corefx,ViktorHofer/corefx,billwert/corefx,tijoytom/corefx,nchikanov/corefx,dotnet-bot/corefx,ptoonen/corefx,krytarowski/corefx,gkhanna79/corefx,ericstj/corefx,twsouthwick/corefx,JosephTremoulet/corefx,elijah6/corefx,alexperovich/corefx,Ermiar/corefx,elijah6/corefx,Jiayili1/corefx,YoupHulsebos/corefx,stephenmichaelf/corefx,rubo/corefx,stephenmichaelf/corefx,the-dwyer/corefx,ericstj/corefx,elijah6/corefx,Ermiar/corefx,seanshpark/corefx,billwert/corefx,shimingsg/corefx,Jiayili1/corefx,YoupHulsebos/corefx,fgreinacher/corefx,parjong/corefx,twsouthwick/corefx,BrennanConroy/corefx,JosephTremoulet/corefx,nchikanov/corefx,dhoehna/corefx,twsouthwick/corefx,Ermiar/corefx,rubo/corefx,yizhang82/corefx,zhenlan/corefx,JosephTremoulet/corefx,DnlHarvey/corefx,krytarowski/corefx,ravimeda/corefx,nbarbettini/corefx,richlander/corefx,gkhanna79/corefx,the-dwyer/corefx,wtgodbe/corefx,twsouthwick/corefx,krytarowski/corefx,wtgodbe/corefx,ericstj/corefx,ravimeda/corefx,nchikanov/corefx,mazong1123/corefx,Ermiar/corefx,dotnet-bot/corefx,ptoonen/corefx,JosephTremoulet/corefx,fgreinacher/corefx,JosephTremoulet/corefx,dotnet-bot/corefx,axelheer/corefx,krytarowski/corefx,elijah6/corefx,stone-li/corefx,nbarbettini/corefx,the-dwyer/corefx,ptoonen/corefx,DnlHarvey/corefx,alexperovich/corefx,ptoonen/corefx,ViktorHofer/corefx,ravimeda/corefx,ptoonen/corefx,zhenlan/corefx,ericstj/corefx,dhoehna/corefx,ptoonen/corefx,zhenlan/corefx,krytarowski/corefx,BrennanConroy/corefx,parjong/corefx,cydhaselton/corefx,rubo/corefx,Ermiar/corefx,billwert/corefx,zhenlan/corefx,elijah6/corefx,krk/corefx,krk/corefx,DnlHarvey/corefx,richlander/corefx,stone-li/corefx,dhoehna/corefx,nchikanov/corefx,stone-li/corefx,wtgodbe/corefx,dotnet-bot/corefx,DnlHarvey/corefx,stone-li/corefx,parjong/corefx,shimingsg/corefx,shimingsg/corefx,MaggieTsang/corefx,yizhang82/corefx,Jiayili1/corefx,seanshpark/corefx,mmitche/corefx,MaggieTsang/corefx,mmitche/corefx,tijoytom/corefx,mmitche/corefx,gkhanna79/corefx,richlander/corefx,nchikanov/corefx,richlander/corefx,axelheer/corefx,shimingsg/corefx,gkhanna79/corefx,alexperovich/corefx,seanshpark/corefx,fgreinacher/corefx,ericstj/corefx,mmitche/corefx,ViktorHofer/corefx,twsouthwick/corefx,ViktorHofer/corefx,axelheer/corefx,the-dwyer/corefx,zhenlan/corefx,JosephTremoulet/corefx,cydhaselton/corefx,dotnet-bot/corefx,krk/corefx,stone-li/corefx,wtgodbe/corefx,ravimeda/corefx,krk/corefx,Jiayili1/corefx,jlin177/corefx,shimingsg/corefx,cydhaselton/corefx,mazong1123/corefx,parjong/corefx,nbarbettini/corefx,jlin177/corefx,YoupHulsebos/corefx,mazong1123/corefx,twsouthwick/corefx,YoupHulsebos/corefx,tijoytom/corefx,yizhang82/corefx,ViktorHofer/corefx,dhoehna/corefx,YoupHulsebos/corefx,stephenmichaelf/corefx,seanshpark/corefx,wtgodbe/corefx,Jiayili1/corefx,stephenmichaelf/corefx,Ermiar/corefx,krk/corefx,zhenlan/corefx,stephenmichaelf/corefx,MaggieTsang/corefx,MaggieTsang/corefx,krytarowski/corefx,richlander/corefx,Jiayili1/corefx,axelheer/corefx,JosephTremoulet/corefx,dhoehna/corefx,parjong/corefx,DnlHarvey/corefx,stephenmichaelf/corefx,elijah6/corefx,Ermiar/corefx,yizhang82/corefx,cydhaselton/corefx,tijoytom/corefx,YoupHulsebos/corefx,axelheer/corefx,parjong/corefx,shimingsg/corefx,mazong1123/corefx,tijoytom/corefx,wtgodbe/corefx,richlander/corefx,stone-li/corefx,Jiayili1/corefx,dotnet-bot/corefx,MaggieTsang/corefx,twsouthwick/corefx,alexperovich/corefx,rubo/corefx,nchikanov/corefx,mmitche/corefx,billwert/corefx,jlin177/corefx,seanshpark/corefx,nbarbettini/corefx,mmitche/corefx,axelheer/corefx,shimingsg/corefx,ericstj/corefx,krk/corefx,gkhanna79/corefx,MaggieTsang/corefx,jlin177/corefx,MaggieTsang/corefx,YoupHulsebos/corefx | src/System.Net.Security/tests/FunctionalTests/SslStreamCredentialCacheTest.cs | src/System.Net.Security/tests/FunctionalTests/SslStreamCredentialCacheTest.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
using System.Net.Test.Common;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using Xunit;
namespace System.Net.Security.Tests
{
using Configuration = System.Net.Test.Common.Configuration;
public class SslStreamCredentialCacheTest
{
[ActiveIssue(19699, TestPlatforms.Windows)]
[Fact]
public async Task SslStream_SameCertUsedForClientAndServer_Ok()
{
VirtualNetwork network = new VirtualNetwork();
using (var clientStream = new VirtualNetworkStream(network, isServer: false))
using (var serverStream = new VirtualNetworkStream(network, isServer: true))
using (var client = new SslStream(clientStream, true, AllowAnyCertificate))
using (var server = new SslStream(serverStream, true, AllowAnyCertificate))
using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate())
{
// Using the same certificate for server and client auth.
X509Certificate2Collection clientCertificateCollection =
new X509Certificate2Collection(certificate);
var tasks = new Task[2];
tasks[0] = server.AuthenticateAsServerAsync(certificate, true, false);
tasks[1] = client.AuthenticateAsClientAsync(
certificate.GetNameInfo(X509NameType.SimpleName, false),
clientCertificateCollection, false);
await Task.WhenAll(tasks).TimeoutAfter(15 * 1000);
Assert.True(client.IsMutuallyAuthenticated);
Assert.True(server.IsMutuallyAuthenticated);
}
}
private static bool AllowAnyCertificate(
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
return true;
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
using System.Net.Test.Common;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using Xunit;
namespace System.Net.Security.Tests
{
using Configuration = System.Net.Test.Common.Configuration;
public class SslStreamCredentialCacheTest
{
[ActiveIssue(19699, TestPlatforms.Windows)]
[Fact]
public void SslStream_SameCertUsedForClientAndServer_Ok()
{
SslSessionsCacheTest().GetAwaiter().GetResult();
}
private static async Task SslSessionsCacheTest()
{
VirtualNetwork network = new VirtualNetwork();
using (var clientStream = new VirtualNetworkStream(network, isServer: false))
using (var serverStream = new VirtualNetworkStream(network, isServer: true))
using (var client = new SslStream(clientStream, true, AllowAnyCertificate))
using (var server = new SslStream(serverStream, true, AllowAnyCertificate))
using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate())
{
// Using the same certificate for server and client auth.
X509Certificate2Collection clientCertificateCollection =
new X509Certificate2Collection(certificate);
var tasks = new Task[2];
tasks[0] = server.AuthenticateAsServerAsync(certificate, true, false);
tasks[1] = client.AuthenticateAsClientAsync(
certificate.GetNameInfo(X509NameType.SimpleName, false),
clientCertificateCollection, false);
await Task.WhenAll(tasks).TimeoutAfter(15 * 1000);
Assert.True(client.IsMutuallyAuthenticated);
Assert.True(server.IsMutuallyAuthenticated);
}
}
private static bool AllowAnyCertificate(
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
return true;
}
}
}
| mit | C# |
9bc7395e02b1adc990f6c5409f848095284a18c1 | Add default value for Date; update Default documentation | frhagn/Typewriter | src/CodeModel/Extensions/Types/TypeExtensions.cs | src/CodeModel/Extensions/Types/TypeExtensions.cs | using System.Linq;
using Type = Typewriter.CodeModel.Type;
namespace Typewriter.Extensions.Types
{
/// <summary>
/// Extension methods for working with types.
/// </summary>
public static class TypeExtensions
{
/// <summary>
/// Returns the name of the type without []
/// </summary>
public static string ClassName(this Type type)
{
return type.Name.TrimEnd('[', ']');
}
/// <summary>
/// The default value of the type.
/// (Dictionary types returns {}, enumerable types returns [],
/// boolean types returns false, numeric types returns 0, void returns void(0),
/// Guid types return empty guid string, Date types return new Date(0),
/// all other types return null)
/// </summary>
public static string Default(this Type type)
{
// Dictionary = { [key: type]: type; }
if (type.Name.StartsWith("{")) return "{}";
if (type.IsEnumerable) return "[]";
if (type.Name == "boolean" && type.IsNullable == false) return "false";
if (type.Name == "number" && type.IsNullable == false) return "0";
if (type.Name == "void") return "void(0)";
if (type.IsGuid && type.IsNullable == false) return "\"00000000-0000-0000-0000-000000000000\"";
if (type.IsDate && type.IsNullable == false) return "new Date(0)";
return "null";
}
/// <summary>
/// Returns the first TypeArgument of a generic type or the type itself if it's not generic.
/// </summary>
public static Type Unwrap(this Type type)
{
return type.IsGeneric ? type.TypeArguments.First() : type;
}
}
}
| using System.Linq;
using Type = Typewriter.CodeModel.Type;
namespace Typewriter.Extensions.Types
{
/// <summary>
/// Extension methods for working with types.
/// </summary>
public static class TypeExtensions
{
/// <summary>
/// Returns the name of the type without []
/// </summary>
public static string ClassName(this Type type)
{
return type.Name.TrimEnd('[', ']');
}
/// <summary>
/// The default value of the type.
/// (Dictionary types returns {}, enumerable types returns [], boolean types returns false,
/// numeric types returns 0, void returns void(0), all other types return null)
/// </summary>
public static string Default(this Type type)
{
// Dictionary = { [key: type]: type; }
if (type.Name.StartsWith("{")) return "{}";
if (type.IsEnumerable) return "[]";
if (type.Name == "boolean" && type.IsNullable == false) return "false";
if (type.Name == "number" && type.IsNullable == false) return "0";
if (type.Name == "void") return "void(0)";
if (type.IsGuid && type.IsNullable == false) return "\"00000000-0000-0000-0000-000000000000\"";
return "null";
}
/// <summary>
/// Returns the first TypeArgument of a generic type or the type itself if it's not generic.
/// </summary>
public static Type Unwrap(this Type type)
{
return type.IsGeneric ? type.TypeArguments.First() : type;
}
}
}
| apache-2.0 | C# |
2161b2596283a67f71023bc15c2c03a93254bc41 | Rewrite of summary | Geta/EPi.Extensions | Geta.EPi.Extensions/Helpers/PageHelper.cs | Geta.EPi.Extensions/Helpers/PageHelper.cs | using EPiServer;
using EPiServer.Core;
using EPiServer.ServiceLocation;
namespace Geta.EPi.Extensions.Helpers
{
/// <summary>
/// Helper methods for working with EPiServer PageData objects
/// </summary>
public static class PageHelper
{
/// <summary>
/// Gets the start page for current site.
/// </summary>
/// <returns>PageData object</returns>
public static PageData GetStartPage()
{
return GetStartPage<PageData>();
}
/// <summary>
/// Gets the start page of concrete type for current site.
/// </summary>
/// <typeparam name="T">StartPage type</typeparam>
/// <returns>StartPage of <typeparamref name="T"/></returns>
public static T GetStartPage<T>() where T : PageData
{
var loader = ServiceLocator.Current.GetInstance<IContentLoader>();
return loader.Get<PageData>(ContentReference.StartPage) as T;
}
}
} | using EPiServer;
using EPiServer.Core;
using EPiServer.ServiceLocation;
namespace Geta.EPi.Extensions.Helpers
{
/// <summary>
/// Utility class to help work with EPiServer PageData objects
/// </summary>
public static class PageHelper
{
/// <summary>
/// Gets the start page for current site.
/// </summary>
/// <returns>PageData object</returns>
public static PageData GetStartPage()
{
return GetStartPage<PageData>();
}
/// <summary>
/// Gets the start page of concrete type for current site.
/// </summary>
/// <typeparam name="T">StartPage type</typeparam>
/// <returns>StartPage of <typeparamref name="T"/></returns>
public static T GetStartPage<T>() where T : PageData
{
var loader = ServiceLocator.Current.GetInstance<IContentLoader>();
return loader.Get<PageData>(ContentReference.StartPage) as T;
}
}
} | mit | C# |
f05f14fc382cf60cbc3a7f3a23669ffdc5d0fc46 | Add Support for MysqlConnector 1 namespace changes | stsrki/fluentmigrator,spaccabit/fluentmigrator,amroel/fluentmigrator,fluentmigrator/fluentmigrator,amroel/fluentmigrator,fluentmigrator/fluentmigrator,stsrki/fluentmigrator,spaccabit/fluentmigrator | src/FluentMigrator.Runner.MySql/Processors/MySql/MySqlDbFactory.cs | src/FluentMigrator.Runner.MySql/Processors/MySql/MySqlDbFactory.cs | #region License
// Copyright (c) 2007-2018, FluentMigrator Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
namespace FluentMigrator.Runner.Processors.MySql
{
public class MySqlDbFactory : ReflectionBasedDbFactory
{
private static readonly TestEntry[] _entries =
{
new TestEntry("MySql.Data", "MySql.Data.MySqlClient.MySqlClientFactory"),
new TestEntry("MySqlConnector", "MySql.Data.MySqlClient.MySqlClientFactory"),
new TestEntry("MySqlConnector", "MySqlConnector.MySqlConnectorFactory")
};
[Obsolete]
public MySqlDbFactory()
: this(serviceProvider: null)
{
}
public MySqlDbFactory(IServiceProvider serviceProvider)
: base(serviceProvider, _entries)
{
}
}
}
| #region License
// Copyright (c) 2007-2018, FluentMigrator Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
namespace FluentMigrator.Runner.Processors.MySql
{
public class MySqlDbFactory : ReflectionBasedDbFactory
{
private static readonly TestEntry[] _entries =
{
new TestEntry("MySql.Data", "MySql.Data.MySqlClient.MySqlClientFactory"),
new TestEntry("MySqlConnector", "MySql.Data.MySqlClient.MySqlClientFactory"),
};
[Obsolete]
public MySqlDbFactory()
: this(serviceProvider: null)
{
}
public MySqlDbFactory(IServiceProvider serviceProvider)
: base(serviceProvider, _entries)
{
}
}
}
| apache-2.0 | C# |
32fe4a5d05b3cc3ceba1be8e7d913b6eb0ce61d9 | Update Viktor.cs | FireBuddy/adevade | AdEvade/AdEvade/Data/Spells/SpecialSpells/Viktor.cs | AdEvade/AdEvade/Data/Spells/SpecialSpells/Viktor.cs | using System;
using EloBuddy;
using EloBuddy.SDK;
namespace AdEvade.Data.Spells.SpecialSpells
{
class Viktor : IChampionPlugin
{
static Viktor()
{
}
public const string ChampionName = "Viktor";
public string GetChampionName()
{
return ChampionName;
}
public void LoadSpecialSpell(SpellData spellData)
{
if (spellData.SpellName == "ViktorDeathRay3")
{
GameObject.OnCreate += OnCreateObj_ViktorDeathRay3;
}
}
private static void OnCreateObj_ViktorDeathRay3(GameObject obj, EventArgs args)
{
if (obj.GetType() != typeof(MissileClient) || !((MissileClient) obj).IsValidMissile())
return;
MissileClient missile = (MissileClient)obj;
SpellData spellData;
if (missile.SpellCaster != null && missile.SpellCaster.Team != ObjectManager.Player.Team &&
missile.SData.Name != null && missile.SData.Name == "viktoreaugmissile"
&& SpellDetector.OnMissileSpells.TryGetValue("ViktorDeathRay3", out spellData)
&& missile.StartPosition != null && missile.EndPosition != null)
{
var missileDist = missile.EndPosition.To2D().Distance(missile.StartPosition.To2D());
var delay = missileDist / 1.5f + 600;
spellData.SpellDelay = delay;
SpellDetector.CreateSpellData(missile.SpellCaster, missile.StartPosition, missile.EndPosition, spellData);
}
}
}
}
| using System;
using EloBuddy;
using EloBuddy.SDK;
namespace AdEvade.Data.Spells.SpecialSpells
{
class Viktor : IChampionPlugin
{
static Viktor()
{
}
public const string ChampionName = "Viktor";
public string GetChampionName()
{
return ChampionName;
}
public void LoadSpecialSpell(SpellData spellData)
{
if (spellData.SpellName == "ViktorDeathRay")
{
GameObject.OnCreate += OnCreateObj_ViktorDeathRay3;
}
}
private static void OnCreateObj_ViktorDeathRay3(GameObject obj, EventArgs args)
{
if (obj.GetType() != typeof(MissileClient) || !((MissileClient) obj).IsValidMissile())
return;
MissileClient missile = (MissileClient)obj;
SpellData spellData;
if (missile.SpellCaster != null && missile.SpellCaster.Team != ObjectManager.Player.Team &&
missile.SData.Name != null && missile.SData.Name == "viktoreaugmissile"
&& SpellDetector.OnMissileSpells.TryGetValue("ViktorDeathRay3", out spellData)
&& missile.StartPosition != null && missile.EndPosition != null)
{
var missileDist = missile.EndPosition.To2D().Distance(missile.StartPosition.To2D());
var delay = missileDist / 1.5f + 600;
spellData.SpellDelay = delay;
SpellDetector.CreateSpellData(missile.SpellCaster, missile.StartPosition, missile.EndPosition, spellData);
}
}
}
}
| mit | C# |
2dc29ebc0d1e5196b5a5a310dfdfc40f429c4ad2 | Update AssemblyInfo.cs | trevorreeves/Treevs.Essentials.AutoFixture.Xunit | src/Treevs.Essentials.AutoFixture.Xunit/Properties/AssemblyInfo.cs | src/Treevs.Essentials.AutoFixture.Xunit/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("Treevs.Essentials.AutoFixture.Xunit")]
[assembly: AssemblyDescription("Additions to AutoFixture.Xunit that I wouldn't leave the house without.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Treevs.Essentials.AutoFixture.Xunit")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[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("d1e57e0b-afba-4421-be39-c2f5b3e3a50d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]
| 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("treeves.essentials.AutoFixture.Xunit")]
[assembly: AssemblyDescription("Additions to AutoFixture.Xunit that I wouldn't leave the house without.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("treeves.essentials.AutoFixture.Xunit")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[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("d1e57e0b-afba-4421-be39-c2f5b3e3a50d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]
| mit | C# |
4f948c96ef0ab2d84994ef3f93855d3cc495a3c8 | Return the provided default value | zedr0n/AngleSharp.Local,AngleSharp/AngleSharp,FlorianRappl/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,Livven/AngleSharp,Livven/AngleSharp,FlorianRappl/AngleSharp,zedr0n/AngleSharp.Local,Livven/AngleSharp,FlorianRappl/AngleSharp,zedr0n/AngleSharp.Local,AngleSharp/AngleSharp,FlorianRappl/AngleSharp | AngleSharp/Extensions/ObjectExtensions.cs | AngleSharp/Extensions/ObjectExtensions.cs | namespace AngleSharp.Extensions
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
/// <summary>
/// Some methods for working with bare objects.
/// </summary>
[DebuggerStepThrough]
static class ObjectExtensions
{
public static Dictionary<String, T> ToDictionary<T>(this Object values, Func<Object, T> converter)
{
var symbols = new Dictionary<String, T>();
if (values != null)
{
var properties = values.GetType().GetProperties();
foreach (var property in properties)
{
var value = property.GetValue(values, null) ?? String.Empty;
symbols.Add(property.Name, converter(value));
}
}
return symbols;
}
public static Dictionary<String, Object> ToDictionary(this Object values)
{
return values.ToDictionary(m => m);
}
public static T? TryGet<T>(this IDictionary<String, Object> values, String key)
where T : struct
{
Object value;
if (values.TryGetValue(key, out value) && value is T)
return (T)value;
return null;
}
public static Object TryGet(this IDictionary<String, Object> values, String key)
{
Object value;
if (values.TryGetValue(key, out value))
return value;
return null;
}
public static U GetOrDefault<T, U>(this IDictionary<T, U> values, T key, U defaultValue)
{
U value;
return values.TryGetValue(key, out value) ? value : defaultValue;
}
public static Double Constraint(this Double value, Double min, Double max)
{
return value < min ? min : (value > max ? max : value);
}
}
}
| namespace AngleSharp.Extensions
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
/// <summary>
/// Some methods for working with bare objects.
/// </summary>
[DebuggerStepThrough]
static class ObjectExtensions
{
public static Dictionary<String, T> ToDictionary<T>(this Object values, Func<Object, T> converter)
{
var symbols = new Dictionary<String, T>();
if (values != null)
{
var properties = values.GetType().GetProperties();
foreach (var property in properties)
{
var value = property.GetValue(values, null) ?? String.Empty;
symbols.Add(property.Name, converter(value));
}
}
return symbols;
}
public static Dictionary<String, Object> ToDictionary(this Object values)
{
return values.ToDictionary(m => m);
}
public static T? TryGet<T>(this IDictionary<String, Object> values, String key)
where T : struct
{
Object value;
if (values.TryGetValue(key, out value) && value is T)
return (T)value;
return null;
}
public static Object TryGet(this IDictionary<String, Object> values, String key)
{
Object value;
if (values.TryGetValue(key, out value))
return value;
return null;
}
public static U GetOrDefault<T, U>(this IDictionary<T, U> values, T key, U defaultValue)
{
U value;
return values.TryGetValue(key, out value) ? value : default(U);
}
public static Double Constraint(this Double value, Double min, Double max)
{
return value < min ? min : (value > max ? max : value);
}
}
}
| mit | C# |
4679c4376b37df2c7d22c1f614d3e31ede5b9c4e | Update the assembly info | sqt/cactbot,sqt/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,sqt/cactbot,sqt/cactbot,quisquous/cactbot,quisquous/cactbot,sqt/cactbot | CactbotOverlay/Properties/AssemblyInfo.cs | CactbotOverlay/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("ExternalOverlayTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExternalOverlayTest")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
[assembly: Guid("1b559a2c-b75c-42f0-83d6-bf31c0cb8289")]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] | apache-2.0 | C# |
840a5f7b949ed34c3d5919a4d6b0c361a4fce3c9 | Bump version to 0.10.2 | quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot | CactbotOverlay/Properties/AssemblyInfo.cs | CactbotOverlay/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.10.2.0")]
[assembly: AssemblyFileVersion("0.10.2.0")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.10.1.0")]
[assembly: AssemblyFileVersion("0.10.1.0")] | apache-2.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.