commit
stringlengths 40
40
| old_file
stringlengths 4
237
| new_file
stringlengths 4
237
| old_contents
stringlengths 1
4.24k
| new_contents
stringlengths 1
4.87k
| subject
stringlengths 15
778
| message
stringlengths 15
8.75k
| lang
stringclasses 266
values | license
stringclasses 13
values | repos
stringlengths 5
127k
|
|---|---|---|---|---|---|---|---|---|---|
6113a39d627d9e1115675a0dd1b3a98d1c334347
|
IS24RestApi/Properties/AssemblyInfo.cs
|
IS24RestApi/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("IS24RestApi")]
[assembly: AssemblyDescription("Client for the Immobilienscout24 REST API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Michael Ganss")]
[assembly: AssemblyProduct("IS24RestApi")]
[assembly: AssemblyCopyright("Copyright © 2013 IS24RestApi project contributors")]
[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("ce77545e-5fbe-4b4d-bf1f-1c5d4532070a")]
// 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.*")]
|
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("IS24RestApi")]
[assembly: AssemblyDescription("Client for the Immobilienscout24 REST API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Michael Ganss")]
[assembly: AssemblyProduct("IS24RestApi")]
[assembly: AssemblyCopyright("Copyright © 2013 IS24RestApi project contributors")]
[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("ce77545e-5fbe-4b4d-bf1f-1c5d4532070a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.*")]
|
Change version number to 1.1
|
Change version number to 1.1
|
C#
|
apache-2.0
|
mganss/IS24RestApi,enkol/IS24RestApi
|
104445424cc51a8d485dbe7d337f03dbbad3d578
|
Containerizer/Services/Implementations/StreamOutService.cs
|
Containerizer/Services/Implementations/StreamOutService.cs
|
using System.IO;
using Containerizer.Services.Interfaces;
namespace Containerizer.Services.Implementations
{
public class StreamOutService : IStreamOutService
{
private readonly IContainerPathService containerPathService;
private readonly ITarStreamService tarStreamService;
public StreamOutService(IContainerPathService containerPathService, ITarStreamService tarStreamService)
{
this.containerPathService = containerPathService;
this.tarStreamService = tarStreamService;
}
public Stream StreamOutFile(string id, string source)
{
string rootDir = containerPathService.GetContainerRoot(id);
string path = Path.Combine(rootDir, source);
Stream stream = tarStreamService.WriteTarToStream(path);
return stream;
}
}
}
|
using System.IO;
using Containerizer.Services.Interfaces;
namespace Containerizer.Services.Implementations
{
public class StreamOutService : IStreamOutService
{
private readonly IContainerPathService containerPathService;
private readonly ITarStreamService tarStreamService;
public StreamOutService(IContainerPathService containerPathService, ITarStreamService tarStreamService)
{
this.containerPathService = containerPathService;
this.tarStreamService = tarStreamService;
}
public Stream StreamOutFile(string id, string source)
{
string rootDir = containerPathService.GetContainerRoot(id);
string path = rootDir + source;
Stream stream = tarStreamService.WriteTarToStream(path);
return stream;
}
}
}
|
Fix path issue for StreamOut
|
Fix path issue for StreamOut
|
C#
|
apache-2.0
|
cloudfoundry/garden-windows,cloudfoundry-incubator/garden-windows,cloudfoundry/garden-windows,cloudfoundry-incubator/garden-windows,stefanschneider/garden-windows,stefanschneider/garden-windows,cloudfoundry/garden-windows,cloudfoundry-incubator/garden-windows,stefanschneider/garden-windows
|
e0ca905efa5ef1f4a48e8d0b17a599a4715827aa
|
EncodingConverter/Logic/EncodingManager.cs
|
EncodingConverter/Logic/EncodingManager.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using dokas.FluentStrings;
using Mozilla.CharDet;
namespace dokas.EncodingConverter.Logic
{
internal sealed class EncodingManager
{
private readonly FileManager _fileManager;
private static readonly IEnumerable<Encoding> _encodings;
private static readonly UniversalDetector _detector;
static EncodingManager()
{
_encodings = Encoding.GetEncodings().Select(e => e.GetEncoding()).ToArray();
_detector = new UniversalDetector();
}
public static IEnumerable<Encoding> Encodings
{
get { return _encodings; }
}
public EncodingManager(FileManager fileManager)
{
_fileManager = fileManager;
}
public async Task<Encoding> Resolve(string filePath)
{
_detector.Reset();
await Task.Factory.StartNew(() =>
{
var bytes = _fileManager.Load(filePath);
_detector.HandleData(bytes);
});
return !_detector.DetectedCharsetName.IsEmpty() ? Encoding.GetEncoding(_detector.DetectedCharsetName) : null;
}
public void Convert(string filePath, Encoding from, Encoding to)
{
var bytes = _fileManager.Load(filePath);
var convertedBytes = Encoding.Convert(from, to, bytes);
_fileManager.Save(filePath, convertedBytes);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using dokas.FluentStrings;
using Mozilla.CharDet;
namespace dokas.EncodingConverter.Logic
{
internal sealed class EncodingManager
{
private readonly FileManager _fileManager;
private static readonly IEnumerable<Encoding> _encodings;
static EncodingManager()
{
_encodings = Encoding.GetEncodings().Select(e => e.GetEncoding()).ToArray();
}
public static IEnumerable<Encoding> Encodings
{
get { return _encodings; }
}
public EncodingManager(FileManager fileManager)
{
_fileManager = fileManager;
}
public async Task<Encoding> Resolve(string filePath)
{
UniversalDetector detector = null;
await Task.Factory.StartNew(() =>
{
var bytes = _fileManager.Load(filePath);
detector = new UniversalDetector();
detector.HandleData(bytes);
});
return !detector.DetectedCharsetName.IsEmpty() ? Encoding.GetEncoding(detector.DetectedCharsetName) : null;
}
public void Convert(string filePath, Encoding from, Encoding to)
{
if (from == null)
{
throw new ArgumentOutOfRangeException("from");
}
if (to == null)
{
throw new ArgumentOutOfRangeException("to");
}
var bytes = _fileManager.Load(filePath);
var convertedBytes = Encoding.Convert(from, to, bytes);
_fileManager.Save(filePath, convertedBytes);
}
}
}
|
Fix error with multithreaded UniversalDetector reseting
|
Fix error with multithreaded UniversalDetector reseting
Additional argument checks were added as well
|
C#
|
mit
|
MSayfullin/EncodingConverter
|
c007dcf71c233b61dbc6db0252f1f54724e9a3e3
|
FabricStore/FabricStore.Web/Global.asax.cs
|
FabricStore/FabricStore.Web/Global.asax.cs
|
using FabricStore.Data;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using FabricStore.Data.Migrations;
using FabricStore.Web.Infrastructure.Mapping;
using System.Reflection;
namespace FabricStore.Web
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
Database.SetInitializer<ApplicationDbContext>(new MigrateDatabaseToLatestVersion<ApplicationDbContext, MigrationConfiguration>());
var automapperConfig = new AutoMapperConfig(Assembly.GetExecutingAssembly());
automapperConfig.Execute();
}
}
}
|
using FabricStore.Data;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using FabricStore.Data.Migrations;
using FabricStore.Web.Infrastructure.Mapping;
using System.Reflection;
namespace FabricStore.Web
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
Database.SetInitializer<ApplicationDbContext>(new MigrateDatabaseToLatestVersion<ApplicationDbContext, MigrationConfiguration>());
var automapperConfig = new AutoMapperConfig(Assembly.GetExecutingAssembly());
automapperConfig.Execute();
}
}
}
|
Set Razor to be the only view engine
|
Set Razor to be the only view engine
|
C#
|
mit
|
simoto/FabricStore,simoto/FabricStore,simoto/FabricStore
|
f2a95c24afa4ed918fc01a78c196ce2809bbc789
|
Data-Structures/BinaryTree/Program.cs
|
Data-Structures/BinaryTree/Program.cs
|
#region
using System;
using BinaryTree.Models;
#endregion
namespace BinaryTree
{
internal class Program
{
private static void Main()
{
var binaryTree = new BinaryTree<int> {5, 3, 9, 1, -5, 0, 2};
Console.WriteLine("{0}, count of items: {1}", binaryTree, binaryTree.Count);
const int val = 1;
Console.WriteLine("Removing value - {0}...", val);
binaryTree.Remove(val);
Console.WriteLine("{0}, count of items: {1}", binaryTree, binaryTree.Count);
Console.ReadKey();
}
}
}
|
#region
using System;
using BinaryTree.Models;
#endregion
namespace BinaryTree
{
internal class Program
{
private static void Main()
{
var binaryTree = new BinaryTree<int> {5, 3, 9, 1, -5, 0, 2};
Console.WriteLine("{0}, count of items: {1}", binaryTree, binaryTree.Count);
const int val = 1;
Console.WriteLine("Removing value - {0}...", val);
binaryTree.Remove(val);
Console.WriteLine("{0}, count of items: {1}", binaryTree, binaryTree.Count);
Console.ReadKey();
binaryTree.Clear();
}
}
}
|
Add binaryTree.Clear(); to binary tree test.
|
Add binaryTree.Clear(); to binary tree test.
|
C#
|
apache-2.0
|
Appius/Algorithms-and-Data-Structures
|
4564967108790490ab2179daf88838431bbf7f77
|
exec/csnex/Exceptions.cs
|
exec/csnex/Exceptions.cs
|
using System;
namespace csnex
{
[Serializable()]
public class NeonException: ApplicationException
{
public NeonException() {
}
public NeonException(string message) : base(message) {
}
public NeonException(string message, params object[] args) : base(string.Format(message, args)) {
}
public NeonException(string message, System.Exception innerException) : base(message, innerException) {
}
}
[Serializable]
public class InvalidOpcodeException: NeonException
{
public InvalidOpcodeException() {
}
public InvalidOpcodeException(string message) : base(message) {
}
}
[Serializable]
public class BytecodeException: NeonException
{
public BytecodeException() {
}
public BytecodeException(string message) : base(message) {
}
}
[Serializable]
public class NotImplementedException: NeonException
{
public NotImplementedException() {
}
public NotImplementedException(string message) : base(message) {
}
}
}
|
using System;
using System.Runtime.Serialization;
using System.Security.Permissions;
namespace csnex
{
[Serializable()]
public class NeonException: ApplicationException
{
public NeonException() {
}
public NeonException(string name, string info) : base(name) {
Name = name;
Info = info;
}
public NeonException(string message) : base(message) {
}
public NeonException(string message, params object[] args) : base(string.Format(message, args)) {
}
public NeonException(string message, System.Exception innerException) : base(message, innerException) {
}
// Satisfy Warning CA2240 to implement a GetObjectData() to our custom exception type.
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null) {
throw new ArgumentNullException("info");
}
info.AddValue("NeonException", Name);
info.AddValue("NeonInfo", Info);
base.GetObjectData(info, context);
}
public string Name;
public string Info;
}
[Serializable]
public class InvalidOpcodeException: NeonException
{
public InvalidOpcodeException() {
}
public InvalidOpcodeException(string message) : base(message) {
}
}
[Serializable]
public class BytecodeException: NeonException
{
public BytecodeException() {
}
public BytecodeException(string message) : base(message) {
}
}
[Serializable]
public class NotImplementedException: NeonException
{
public NotImplementedException() {
}
public NotImplementedException(string message) : base(message) {
}
}
[Serializable]
public class NeonRuntimeException: NeonException
{
public NeonRuntimeException()
{
}
public NeonRuntimeException(string name, string info) : base(name, info)
{
}
}
}
|
Add Neon runtime information to NeonException
|
Add Neon runtime information to NeonException
|
C#
|
mit
|
ghewgill/neon-lang,ghewgill/neon-lang,ghewgill/neon-lang,ghewgill/neon-lang,ghewgill/neon-lang,ghewgill/neon-lang,ghewgill/neon-lang,ghewgill/neon-lang,ghewgill/neon-lang,ghewgill/neon-lang
|
7a82c437e9dbfd61897ad37043a214f38e0943ea
|
MonoDevelop.Addins.Tasks/AddinTask.cs
|
MonoDevelop.Addins.Tasks/AddinTask.cs
|
using System;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.Addins;
namespace MonoDevelop.Addins.Tasks
{
public abstract class AddinTask : Task
{
[Required]
public string ConfigDir { get; set; }
[Required]
public string AddinsDir { get; set; }
[Required]
public string DatabaseDir { get; set; }
[Required]
public string BinDir { get; set; }
protected bool InitializeAddinRegistry ()
{
if (string.IsNullOrEmpty (ConfigDir))
Log.LogError ("ConfigDir must be specified");
if (string.IsNullOrEmpty (AddinsDir))
Log.LogError ("AddinsDir must be specified");
if (string.IsNullOrEmpty (DatabaseDir))
Log.LogError ("DatabaseDir must be specified");
if (string.IsNullOrEmpty (BinDir))
Log.LogError ("BinDir must be specified");
Registry = new AddinRegistry (
ConfigDir,
BinDir,
AddinsDir,
DatabaseDir
);
Log.LogMessage (MessageImportance.Normal, "Updating addin database at {0}", DatabaseDir);
Registry.Update (new LogProgressStatus (Log, 2));
return !Log.HasLoggedErrors;
}
protected AddinRegistry Registry { get; private set; }
}
}
|
using System;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.Addins;
namespace MonoDevelop.Addins.Tasks
{
public abstract class AddinTask : Task
{
[Required]
public string ConfigDir { get; set; }
[Required]
public string AddinsDir { get; set; }
[Required]
public string DatabaseDir { get; set; }
[Required]
public string BinDir { get; set; }
protected bool InitializeAddinRegistry ()
{
if (string.IsNullOrEmpty (ConfigDir))
Log.LogError ("ConfigDir must be specified");
if (string.IsNullOrEmpty (AddinsDir))
Log.LogError ("AddinsDir must be specified");
if (string.IsNullOrEmpty (DatabaseDir))
Log.LogError ("DatabaseDir must be specified");
if (string.IsNullOrEmpty (BinDir))
Log.LogError ("BinDir must be specified");
ConfigDir = Path.GetFullPath (ConfigDir);
BinDir = Path.GetFullPath (BinDir);
AddinsDir = Path.GetFullPath (AddinsDir);
DatabaseDir = Path.GetFullPath (DatabaseDir);
Registry = new AddinRegistry (
ConfigDir,
BinDir,
AddinsDir,
DatabaseDir
);
Log.LogMessage (MessageImportance.Normal, "Updating addin database at {0}", DatabaseDir);
Registry.Update (new LogProgressStatus (Log, 2));
return !Log.HasLoggedErrors;
}
protected AddinRegistry Registry { get; private set; }
}
}
|
Fix use of private addin registry
|
Fix use of private addin registry
For some reason the full path to the intermediate
directory was resolving elsewhere.
|
C#
|
mit
|
mhutch/MonoDevelop.AddinMaker,mhutch/MonoDevelop.AddinMaker
|
a0880bfb11af268827252757f37aaa518ce6f875
|
NElasticsearch/NElasticsearch/Models/Hit.cs
|
NElasticsearch/NElasticsearch/Models/Hit.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace NElasticsearch.Models
{
/// <summary>
/// Individual hit response from ElasticSearch.
/// </summary>
[DebuggerDisplay("{_type} in {_index} id {_id}")]
public class Hit<T>
{
public string _index { get; set; }
public string _type { get; set; }
public string _id { get; set; }
public double? _score { get; set; }
public T _source { get; set; }
//public Dictionary<String, JToken> fields = new Dictionary<string, JToken>();
}
}
|
using System.Collections.Generic;
using System.Diagnostics;
namespace NElasticsearch.Models
{
/// <summary>
/// Individual hit response from ElasticSearch.
/// </summary>
[DebuggerDisplay("{_type} in {_index} id {_id}")]
public class Hit<T>
{
public string _index { get; set; }
public string _type { get; set; }
public string _id { get; set; }
public double? _score { get; set; }
public T _source { get; set; }
public Dictionary<string, IEnumerable<object>> fields = new Dictionary<string, IEnumerable<object>>();
public Dictionary<string, IEnumerable<string>> highlight;
}
}
|
Support fields and highlights in responses
|
Support fields and highlights in responses
|
C#
|
agpl-3.0
|
synhershko/HebrewSearch
|
355caf41ae633e4b4ec88fac9e213079e0219e56
|
LocalServer/Program.cs
|
LocalServer/Program.cs
|
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using wslib;
using wslib.Protocol;
namespace LocalServer
{
class Program
{
static void Main(string[] args)
{
TaskScheduler.UnobservedTaskException += LogUnobservedTaskException;
var listenerOptions = new WebSocketListenerOptions { Endpoint = new IPEndPoint(IPAddress.Loopback, 8080) };
using (var listener = new WebSocketListener(listenerOptions, appFunc))
{
listener.StartAccepting();
Console.ReadLine();
}
}
private static void LogUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs)
{
throw new NotImplementedException(); // TODO: log
}
private static async Task appFunc(IWebSocket webSocket)
{
while (webSocket.IsConnected())
{
using (var msg = await webSocket.ReadMessageAsync(CancellationToken.None))
{
if (msg != null)
{
using (var ms = new MemoryStream())
{
await msg.ReadStream.CopyToAsync(ms);
var text = Encoding.UTF8.GetString(ms.ToArray());
using (var w = await webSocket.CreateMessageWriter(MessageType.Text, CancellationToken.None))
{
await w.WriteMessageAsync(ms.ToArray(), 0, (int)ms.Length, CancellationToken.None);
}
}
}
}
}
}
}
}
|
using System;
using System.IO;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using wslib;
namespace LocalServer
{
class Program
{
static void Main(string[] args)
{
TaskScheduler.UnobservedTaskException += LogUnobservedTaskException;
var listenerOptions = new WebSocketListenerOptions { Endpoint = new IPEndPoint(IPAddress.Loopback, 8080) };
using (var listener = new WebSocketListener(listenerOptions, appFunc))
{
listener.StartAccepting();
Console.ReadLine();
}
}
private static void LogUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs)
{
//Console.WriteLine(unobservedTaskExceptionEventArgs.Exception);
}
private static async Task appFunc(IWebSocket webSocket)
{
while (webSocket.IsConnected())
{
using (var msg = await webSocket.ReadMessageAsync(CancellationToken.None))
{
if (msg == null) continue;
using (var ms = new MemoryStream())
{
await msg.ReadStream.CopyToAsync(ms);
byte[] array = ms.ToArray();
using (var w = await webSocket.CreateMessageWriter(msg.Type, CancellationToken.None))
{
await w.WriteMessageAsync(array, 0, array.Length, CancellationToken.None);
}
}
}
}
}
}
}
|
Update local echo server to work with binary messages
|
Update local echo server to work with binary messages
|
C#
|
mit
|
Chelaris182/wslib
|
5f5ebf46464722151ecbe969fc4b8c5f795e9288
|
Source/Treenumerable/Properties/AssemblyInfo.cs
|
Source/Treenumerable/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
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("Treenumerable")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Toshiba")]
[assembly: AssemblyProduct("Treenumerable")]
[assembly: AssemblyCopyright("Copyright © Toshiba 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0")]
[assembly: AssemblyFileVersion("0.5.0")]
|
using System.Reflection;
using System.Resources;
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("Treenumerable")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Toshiba")]
[assembly: AssemblyProduct("Treenumerable")]
[assembly: AssemblyCopyright("Copyright © Toshiba 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
|
Set Treenumerable version to 1.0.0
|
Set Treenumerable version to 1.0.0
|
C#
|
mit
|
jasonmcboyd/Treenumerable
|
cafb24f72c828e5a37794a370c258dcaef8aff99
|
src/UnwindMC/Analysis/Function.cs
|
src/UnwindMC/Analysis/Function.cs
|
namespace UnwindMC.Analysis
{
public class Function
{
public Function(ulong address)
{
Address = address;
Status = FunctionStatus.Created;
}
public ulong Address { get; }
public FunctionStatus Status { get; set; }
}
public enum FunctionStatus
{
Created,
BoundsResolved,
BoundsNotResolvedInvalidAddress,
BoundsNotResolvedIncompleteGraph,
}
}
|
using System;
using System.Collections.Generic;
using UnwindMC.Analysis.Flow;
using UnwindMC.Analysis.IL;
namespace UnwindMC.Analysis
{
public class Function
{
private List<IBlock> _blocks;
public Function(ulong address)
{
Address = address;
Status = FunctionStatus.Created;
}
public ulong Address { get; }
public FunctionStatus Status { get; set; }
public IReadOnlyList<IBlock> Blocks => _blocks;
public ILInstruction FirstInstruction
{
get
{
if (_blocks == null || _blocks.Count == 0)
{
return null;
}
var seq = _blocks[0] as SequentialBlock;
if (seq != null)
{
return seq.Instructions[0];
}
var loop = _blocks[0] as LoopBlock;
if (loop != null)
{
return loop.Condition;
}
var cond = _blocks[0] as ConditionalBlock;
if (cond != null)
{
return cond.Condition;
}
throw new InvalidOperationException("Unknown block type");
}
}
public void ResolveBody(InstructionGraph graph)
{
if (Status != FunctionStatus.BoundsResolved)
{
throw new InvalidOperationException("Cannot resolve function body when bounds are not resolved");
}
_blocks = FlowAnalyzer.Analyze(ILDecompiler.Decompile(graph, Address));
Status = FunctionStatus.BodyResolved;
}
}
public enum FunctionStatus
{
Created,
BoundsResolved,
BoundsNotResolvedInvalidAddress,
BoundsNotResolvedIncompleteGraph,
BodyResolved,
}
}
|
Add flow tree body to the function
|
Add flow tree body to the function
|
C#
|
mit
|
coffeecup-winner/unwind-mc,coffeecup-winner/unwind-mc,coffeecup-winner/unwind-mc,coffeecup-winner/unwind-mc,coffeecup-winner/unwind-mc
|
427f7cb407bda07f0ddad721e4dba4f40653558e
|
SCPI/Display/DISPLAY_GRID.cs
|
SCPI/Display/DISPLAY_GRID.cs
|
using System;
using System.Text;
namespace SCPI.Display
{
public class DISPLAY_GRID : ICommand
{
public string Description => "Set or query the grid type of screen display.";
public string Grid { get; private set; }
private readonly string[] gridRange = new string[] { "FULL", "HALF", "NONE" };
public string Command(params string[] parameters)
{
var cmd = ":DISPlay:GRID";
if (parameters.Length > 0)
{
var grid = parameters[0];
cmd = $"{cmd} {grid}";
}
else
{
cmd += "?";
}
return cmd;
}
public string HelpMessage()
{
var syntax = nameof(DISPLAY_GRID) + "\n" +
nameof(DISPLAY_GRID) + " <grid>";
var parameters = " <grid> = {"+ string.Join("|", gridRange) +"}\n";
var example = "Example: " + nameof(DISPLAY_GRID) + "?";
return $"{syntax}\n{parameters}\n{example}";
}
public bool Parse(byte[] data)
{
if (data != null)
{
Grid = Encoding.ASCII.GetString(data).Trim();
if (Array.Exists(gridRange, g => g.Equals(Grid)))
{
return true;
}
}
Grid = null;
return false;
}
}
}
|
using System;
using System.Text;
namespace SCPI.Display
{
public class DISPLAY_GRID : ICommand
{
public string Description => "Set or query the grid type of screen display.";
public string Grid { get; private set; }
private readonly string[] gridRange = new string[] { "FULL", "HALF", "NONE" };
public string Command(params string[] parameters)
{
var cmd = ":DISPlay:GRID";
if (parameters.Length > 0)
{
var grid = parameters[0];
cmd = $"{cmd} {grid}";
}
else
{
cmd += "?";
}
return cmd;
}
public string HelpMessage()
{
var syntax = nameof(DISPLAY_GRID) + "\n" +
nameof(DISPLAY_GRID) + " <grid>";
var parameters = " <grid> = {"+ string.Join("|", gridRange) +"}\n";
var example = "Example: " + nameof(DISPLAY_GRID) + " FULL";
return $"{syntax}\n{parameters}\n{example}";
}
public bool Parse(byte[] data)
{
if (data != null)
{
Grid = Encoding.ASCII.GetString(data).Trim();
if (Array.Exists(gridRange, g => g.Equals(Grid)))
{
return true;
}
}
Grid = null;
return false;
}
}
}
|
Change example to contain default values
|
Change example to contain default values
|
C#
|
mit
|
tparviainen/oscilloscope
|
f720b23bc413a77e98e09781d389d52c38214ef7
|
source/CroquetAustralia.QueueProcessor/Email/EmailGenerators/U21WorldsEOIEmailGenerator.cs
|
source/CroquetAustralia.QueueProcessor/Email/EmailGenerators/U21WorldsEOIEmailGenerator.cs
|
using CroquetAustralia.Domain.Features.TournamentEntry.Events;
namespace CroquetAustralia.QueueProcessor.Email.EmailGenerators
{
public class U21WorldsEOIEmailGenerator : BaseEmailGenerator
{
/* todo: remove hard coding of email addresses */
private static readonly EmailAddress U21Coordinator = new EmailAddress("ndu21c@croquet-australia.com.au", "Croquet Australia - National Co-ordinator Under 21 Croquet");
private static readonly EmailAddress[] BCC =
{
U21Coordinator,
new EmailAddress("admin@croquet-australia.com.au", "Croquet Australia")
};
public U21WorldsEOIEmailGenerator(EmailMessageSettings emailMessageSettings)
: base(emailMessageSettings, U21Coordinator, BCC)
{
}
protected override string GetTemplateName(EntrySubmitted entrySubmitted)
{
return "EOI";
}
}
}
|
using System.Linq;
using CroquetAustralia.Domain.Features.TournamentEntry.Events;
namespace CroquetAustralia.QueueProcessor.Email.EmailGenerators
{
public class U21WorldsEOIEmailGenerator : BaseEmailGenerator
{
/* todo: remove hard coding of email addresses */
private static readonly EmailAddress U21Coordinator = new EmailAddress("ndu21c@croquet-australia.com.au", "Croquet Australia - National Co-ordinator Under 21 Croquet");
private static readonly EmailAddress[] BCC =
{
U21Coordinator,
new EmailAddress("admin@croquet-australia.com.au", "Croquet Australia")
};
public U21WorldsEOIEmailGenerator(EmailMessageSettings emailMessageSettings)
: base(emailMessageSettings, U21Coordinator, GetBCC(emailMessageSettings))
{
}
protected override string GetTemplateName(EntrySubmitted entrySubmitted)
{
return "EOI";
}
private static EmailAddress[] GetBCC(EmailMessageSettings emailMessageSettings)
{
return emailMessageSettings.Bcc.Any() ? BCC : new EmailAddress[] {};
}
}
}
|
Fix BCC for EOI emails
|
Fix BCC for EOI emails
|
C#
|
mit
|
croquet-australia/api.croquet-australia.com.au
|
2f46e52be23bb03356a2e9c4c46c94dbb1f42707
|
Source/Tests/TraktApiSharp.Tests/TraktConfigurationTests.cs
|
Source/Tests/TraktApiSharp.Tests/TraktConfigurationTests.cs
|
namespace TraktApiSharp.Tests
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class TraktConfigurationTests
{
[TestMethod]
public void TestTraktConfigurationDefaultConstructor()
{
var client = new TraktClient();
client.Configuration.ApiVersion.Should().Be(2);
client.Configuration.UseStagingApi.Should().BeFalse();
client.Configuration.BaseUrl.Should().Be("https://api-v2launch.trakt.tv/");
client.Configuration.UseStagingApi = true;
client.Configuration.BaseUrl.Should().Be("https://api-staging.trakt.tv/");
}
}
}
|
namespace TraktApiSharp.Tests
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class TraktConfigurationTests
{
[TestMethod]
public void TestTraktConfigurationDefaultConstructor()
{
var client = new TraktClient();
client.Configuration.ApiVersion.Should().Be(2);
client.Configuration.UseStagingUrl.Should().BeFalse();
client.Configuration.BaseUrl.Should().Be("https://api-v2launch.trakt.tv/");
client.Configuration.UseStagingUrl = true;
client.Configuration.BaseUrl.Should().Be("https://api-staging.trakt.tv/");
}
}
}
|
Fix issues due to merge conflict.
|
Fix issues due to merge conflict.
|
C#
|
mit
|
henrikfroehling/TraktApiSharp
|
2cd9da5c9682c2a711f69cad19b48434697fb493
|
ToolkitTests/ToolkitTests/ToolkitTests.cs
|
ToolkitTests/ToolkitTests/ToolkitTests.cs
|
using System;
using FormsToolkit;
using Xamarin.Forms;
namespace ToolkitTests
{
public class App : Application
{
public App()
{
var messagingCenter = new Button
{
Text = "Messaging Center",
Command = new Command(()=>MainPage.Navigation.PushAsync(new MessagingServicePage()))
};
var line = new EntryLine
{
Placeholder = "This nifty place for entering text!",
HorizontalTextAlignment = TextAlignment.Center,
HorizontalOptions = LayoutOptions.FillAndExpand,
Text = "",
FontSize = 30,
BorderColor = Color.Red
};
// The root page of your application
MainPage = new NavigationPage(new ContentPage
{
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Padding = new Thickness(32,32,32,32),
Children =
{
messagingCenter,
line
}
}
});
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}
|
using System;
using FormsToolkit;
using Xamarin.Forms;
namespace ToolkitTests
{
public class App : Application
{
public App()
{
var messagingCenter = new Button
{
Text = "Messaging Center",
Command = new Command(()=>MainPage.Navigation.PushAsync(new MessagingServicePage()))
};
var line = new EntryLine
{
Placeholder = "This nifty place for entering text!",
HorizontalTextAlignment = TextAlignment.Center,
HorizontalOptions = LayoutOptions.FillAndExpand,
Text = "",
FontSize = 30,
BorderColor = Color.Red
};
var trigger = new Trigger(typeof(EntryLine));
trigger.Property = EntryLine.IsFocusedProperty;
trigger.Value = true;
Setter setter = new Setter();
setter.Property = EntryLine.BorderColorProperty;
setter.Value = Color.Yellow;
trigger.Setters.Add(setter);
line.Triggers.Add(trigger);
var line2 = new EntryLine
{
PlaceholderColor = Color.Orange,
Placeholder = "This nifty place for entering text!",
HorizontalTextAlignment = TextAlignment.Center,
HorizontalOptions = LayoutOptions.FillAndExpand,
Text = "",
FontSize = 10,
BorderColor = Color.Red
};
// The root page of your application
MainPage = new NavigationPage(new ContentPage
{
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Padding = new Thickness(32,32,32,32),
Children =
{
messagingCenter,
line,
line2
}
}
});
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}
|
Add sample of data trigger
|
Add sample of data trigger
|
C#
|
mit
|
jamesmontemagno/xamarin.forms-toolkit
|
7f0ddcd0df3d369e6cd67c5dd438c430f8910b21
|
Validators/FModalitaPagamentoValidator.cs
|
Validators/FModalitaPagamentoValidator.cs
|
using BusinessObjects.Validators;
namespace FatturaElettronicaPA.Validators
{
/// <summary>
/// Validates FatturaElettronicaBody.DatiPagamento.DettaglioPagamento.ModalitaPagamento.
/// </summary>
public class FModalitaPagamentoValidator : DomainValidator
{
private const string BrokenDescription = "Valori ammessi [MP01], [MP02], [..], [MP17].";
/// <summary>
/// Validates FatturaElettronicaBody.DatiPagamento.DettaglioPagamento.ModalitaPagamento.
/// </summary>
public FModalitaPagamentoValidator() : this(null, BrokenDescription) { }
public FModalitaPagamentoValidator(string propertyName) : this(propertyName, BrokenDescription) { }
public FModalitaPagamentoValidator(string propertyName, string description) : base(propertyName, description)
{
Domain = new[]
{
"MP01", "MP02", "MP03", "MP04", "MP06", "MP07", "MP08", "MP09", "MP10", "MP11", "MP12", "MP13",
"MP14", "MP15", "MP16", "MP17"
};
}
}
}
|
using BusinessObjects.Validators;
namespace FatturaElettronicaPA.Validators
{
/// <summary>
/// Validates FatturaElettronicaBody.DatiPagamento.DettaglioPagamento.ModalitaPagamento.
/// </summary>
public class FModalitaPagamentoValidator : DomainValidator
{
private const string BrokenDescription = "Valori ammessi [MP01], [MP02], [..], [MP21].";
/// <summary>
/// Validates FatturaElettronicaBody.DatiPagamento.DettaglioPagamento.ModalitaPagamento.
/// </summary>
public FModalitaPagamentoValidator() : this(null, BrokenDescription) { }
public FModalitaPagamentoValidator(string propertyName) : this(propertyName, BrokenDescription) { }
public FModalitaPagamentoValidator(string propertyName, string description) : base(propertyName, description)
{
Domain = new[]
{
"MP01", "MP02", "MP03", "MP04", "MP06", "MP07", "MP08", "MP09", "MP10", "MP11", "MP12", "MP13",
"MP14", "MP15", "MP16", "MP17", "MP18", "MP19", "MP20", "MP21"
};
}
}
}
|
Update ModalitaPagamento validator with MP18..21 values
|
Update ModalitaPagamento validator with MP18..21 values
|
C#
|
bsd-3-clause
|
FatturaElettronicaPA/FatturaElettronicaPA,sirmmo/FatturaElettronicaPA
|
7a4a8bab4e9577aebfc934137f2f28677396803b
|
src/Foundation/NSUrlCredential.cs
|
src/Foundation/NSUrlCredential.cs
|
// Copyright 2013 Xamarin Inc.
using System;
using System.Reflection;
using System.Collections;
using System.Runtime.InteropServices;
using MonoMac.ObjCRuntime;
namespace MonoMac.Foundation {
public partial class NSUrlCredential {
public NSUrlCredential (IntPtr trust, bool ignored) : base (NSObjectFlag.Empty)
{
if (IsDirectBinding) {
Handle = MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, Selector.GetHandle ("initWithTrust:"), trust);
} else {
Handle = MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, Selector.GetHandle ("initWithTrust:"), trust);
}
}
}
}
|
// Copyright 2013 Xamarin Inc.
using System;
using System.Reflection;
using System.Collections;
using System.Runtime.InteropServices;
using MonoMac.ObjCRuntime;
namespace MonoMac.Foundation {
public partial class NSUrlCredential {
public NSUrlCredential (IntPtr trust, bool ignored) : base (NSObjectFlag.Empty)
{
if (IsDirectBinding) {
Handle = Messaging.IntPtr_objc_msgSend_IntPtr (this.Handle, Selector.GetHandle ("initWithTrust:"), trust);
} else {
Handle = Messaging.IntPtr_objc_msgSendSuper_IntPtr (this.SuperHandle, Selector.GetHandle ("initWithTrust:"), trust);
}
}
}
}
|
Fix MonoMac/MonoTouch (for MonoMac builds)
|
Fix MonoMac/MonoTouch (for MonoMac builds)
|
C#
|
apache-2.0
|
mono/maccore
|
0e2ab20ccf1e2f8c9f680ba72be87aea5bd59dd2
|
DesktopWidgets/Helpers/DateTimeSyncHelper.cs
|
DesktopWidgets/Helpers/DateTimeSyncHelper.cs
|
using System;
namespace DesktopWidgets.Helpers
{
public static class DateTimeSyncHelper
{
public static DateTime SyncNext(this DateTime dateTime, bool syncYear, bool syncMonth, bool syncDay,
bool syncHour, bool syncMinute, bool syncSecond)
{
var endDateTime = dateTime;
endDateTime = new DateTime(
syncYear
? DateTime.Now.Year
: endDateTime.Year,
syncMonth
? DateTime.Now.Month
: endDateTime.Month,
syncDay
? DateTime.Now.Day
: endDateTime.Day,
syncHour
? DateTime.Now.Hour
: endDateTime.Hour,
syncMinute
? DateTime.Now.Minute
: endDateTime.Minute,
syncSecond
? DateTime.Now.Second
: endDateTime.Second,
endDateTime.Kind);
if (syncYear && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddYears(1);
if (syncMonth && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddMonths(1);
if (syncDay && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddDays(1);
if (syncHour && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddHours(1);
if (syncMinute && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddMinutes(1);
if (syncSecond && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddSeconds(1);
return endDateTime;
}
}
}
|
using System;
namespace DesktopWidgets.Helpers
{
public static class DateTimeSyncHelper
{
public static DateTime SyncNext(this DateTime dateTime, bool syncYear, bool syncMonth, bool syncDay,
bool syncHour, bool syncMinute, bool syncSecond)
{
var endDateTime = dateTime;
endDateTime = new DateTime(
syncYear
? DateTime.Now.Year
: endDateTime.Year,
syncMonth
? DateTime.Now.Month
: endDateTime.Month,
syncDay
? DateTime.Now.Day
: endDateTime.Day,
syncHour
? DateTime.Now.Hour
: endDateTime.Hour,
syncMinute
? DateTime.Now.Minute
: endDateTime.Minute,
syncSecond
? DateTime.Now.Second
: endDateTime.Second,
endDateTime.Kind);
if (syncSecond && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddSeconds(1);
if (syncMinute && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddMinutes(1);
if (syncHour && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddHours(1);
if (syncDay && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddDays(1);
if (syncMonth && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddMonths(1);
if (syncYear && endDateTime < DateTime.Now)
endDateTime = endDateTime.AddYears(1);
return endDateTime;
}
}
}
|
Change "Countdown" syncing priority order
|
Change "Countdown" syncing priority order
|
C#
|
apache-2.0
|
danielchalmers/DesktopWidgets
|
3ffceda5fb5ca782b1b031c6c26710ee6f7e8bb4
|
PhotoLife/PhotoLife.Services/PostsService.cs
|
PhotoLife/PhotoLife.Services/PostsService.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
using PhotoLife.Services.Contracts;
namespace PhotoLife.Services
{
public class PostsService: IPostService
{
private readonly IRepository<Post> postsRepository;
private readonly IUnitOfWork unitOfWork;
public PostsService(
IRepository<Post> postsRepository,
IUnitOfWork unitOfWork)
{
if (postsRepository == null)
{
throw new ArgumentNullException("postsRepository");
}
if (unitOfWork == null)
{
throw new ArgumentNullException("unitOfWorks");
}
this.postsRepository = postsRepository;
this.unitOfWork = unitOfWork;
}
public Post GetPostById(string id)
{
return this.postsRepository.GetById(id);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
using PhotoLife.Services.Contracts;
namespace PhotoLife.Services
{
public class PostsService : IPostService
{
private readonly IRepository<Post> postsRepository;
private readonly IUnitOfWork unitOfWork;
public PostsService(
IRepository<Post> postsRepository,
IUnitOfWork unitOfWork)
{
if (postsRepository == null)
{
throw new ArgumentNullException("postsRepository");
}
if (unitOfWork == null)
{
throw new ArgumentNullException("unitOfWorks");
}
this.postsRepository = postsRepository;
this.unitOfWork = unitOfWork;
}
public Post GetPostById(string id)
{
return this.postsRepository.GetById(id);
}
public IEnumerable<Post> GetTopPosts(int countOfPosts)
{
var res =
this.postsRepository.GetAll(
(Post post) => true,
(Post post) => post.Votes, true)
.Take(countOfPosts);
return res;
}
}
}
|
Add get top to service
|
Add get top to service
|
C#
|
mit
|
Branimir123/PhotoLife,Branimir123/PhotoLife,Branimir123/PhotoLife
|
cd91183a9787d9295efe4e252af2b7535ff21d5a
|
src/SilentHunter.Core/Encoding.cs
|
src/SilentHunter.Core/Encoding.cs
|
namespace SilentHunter
{
public static class Encoding
{
/// <summary>
/// The default encoding to use for parsing Silent Hunter game files.
/// </summary>
public static System.Text.Encoding ParseEncoding { get; } = System.Text.Encoding.GetEncoding(1252);
}
}
|
namespace SilentHunter
{
public static class Encoding
{
/// <summary>
/// The default encoding to use for parsing Silent Hunter game files.
/// </summary>
public static System.Text.Encoding ParseEncoding { get; } = System.Text.Encoding.GetEncoding("ISO-8859-1");
}
}
|
Use ISO encoding, for cross platform
|
Use ISO encoding, for cross platform
|
C#
|
apache-2.0
|
skwasjer/SilentHunter
|
b1559a8fa55aea86d4704a23961c143f10b4a77d
|
Source/MQTTnet/Adapter/MqttConnectingFailedException.cs
|
Source/MQTTnet/Adapter/MqttConnectingFailedException.cs
|
using MQTTnet.Client.Connecting;
using MQTTnet.Exceptions;
namespace MQTTnet.Adapter
{
public class MqttConnectingFailedException : MqttCommunicationException
{
public MqttConnectingFailedException(MqttClientAuthenticateResult resultCode)
: base($"Connecting with MQTT server failed ({resultCode.ToString()}).")
{
Result = resultCode;
}
public MqttClientAuthenticateResult Result { get; }
public MqttClientConnectResultCode ResultCode => Result.ResultCode;
}
}
|
using MQTTnet.Client.Connecting;
using MQTTnet.Exceptions;
namespace MQTTnet.Adapter
{
public class MqttConnectingFailedException : MqttCommunicationException
{
public MqttConnectingFailedException(MqttClientAuthenticateResult resultCode)
: base($"Connecting with MQTT server failed ({resultCode.ResultCode.ToString()}).")
{
Result = resultCode;
}
public MqttClientAuthenticateResult Result { get; }
public MqttClientConnectResultCode ResultCode => Result.ResultCode;
}
}
|
Correct to print right result
|
Correct to print right result
Lost a change while moving from my developement branch to here.
|
C#
|
mit
|
chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet
|
6249ff9a2eb54bac1bebe4e4ebcec4d2a24ae1f0
|
CSharpInternals/1.CSharpInternals.ExceptionHandling/a.Basics.cs
|
CSharpInternals/1.CSharpInternals.ExceptionHandling/a.Basics.cs
|
using System;
using Xunit;
namespace CSharpInternals.ExceptionHandling
{
public class Basics
{
[Fact]
public void Test()
{
Assert.Throws<NullReferenceException>(() => ThrowsNullReferenceException());
}
// Fact - ToString allocates a lot, especially with AggregateException
// http://referencesource.microsoft.com/#mscorlib/system/AggregateException.cs,448
private static void ThrowsNullReferenceException() => throw null;
}
}
|
using System;
using Xunit;
namespace CSharpInternals.ExceptionHandling
{
public class Basics
{
[Fact]
public void ThrowsNull()
{
Assert.Throws<NullReferenceException>(() => ThrowsNullReferenceException());
}
// Fact - ToString allocates a lot, especially with AggregateException
// http://referencesource.microsoft.com/#mscorlib/system/AggregateException.cs,448
private static void ThrowsNullReferenceException() => throw null;
}
}
|
Use more proper name for test
|
Use more proper name for test
|
C#
|
mit
|
Ky7m/DemoCode,Ky7m/DemoCode,Ky7m/DemoCode,Ky7m/DemoCode
|
1fd524ada1078de4afd694a0c95a25edfa6061ae
|
EOLib.Graphics/PEFileCollection.cs
|
EOLib.Graphics/PEFileCollection.cs
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using PELoaderLib;
namespace EOLib.Graphics
{
public sealed class PEFileCollection : Dictionary<GFXTypes, IPEFile>, IPEFileCollection
{
public void PopulateCollectionWithStandardGFX()
{
var gfxTypes = Enum.GetValues(typeof(GFXTypes)).OfType<GFXTypes>();
var modules = gfxTypes.ToDictionary(type => type, CreateGFXFile);
foreach(var modulePair in modules)
Add(modulePair.Key, modulePair.Value);
}
private IPEFile CreateGFXFile(GFXTypes file)
{
var number = ((int)file).ToString("D3");
var fName = Path.Combine("gfx", "gfx" + number + ".egf");
return new PEFile(fName);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
~PEFileCollection()
{
Dispose(false);
}
private void Dispose(bool disposing)
{
if (disposing)
foreach (var pair in this)
pair.Value.Dispose();
}
}
public interface IPEFileCollection : IDictionary<GFXTypes, IPEFile>, IDisposable
{
void PopulateCollectionWithStandardGFX();
}
}
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using System;
using System.Collections.Generic;
using System.IO;
using PELoaderLib;
namespace EOLib.Graphics
{
public sealed class PEFileCollection : Dictionary<GFXTypes, IPEFile>, IPEFileCollection
{
public void PopulateCollectionWithStandardGFX()
{
var gfxTypes = (GFXTypes[])Enum.GetValues(typeof(GFXTypes));
foreach (var type in gfxTypes)
Add(type, CreateGFXFile(type));
}
private IPEFile CreateGFXFile(GFXTypes file)
{
var number = ((int)file).ToString("D3");
var fName = Path.Combine("gfx", "gfx" + number + ".egf");
return new PEFile(fName);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
~PEFileCollection()
{
Dispose(false);
}
private void Dispose(bool disposing)
{
if (disposing)
foreach (var pair in this)
pair.Value.Dispose();
}
}
public interface IPEFileCollection : IDictionary<GFXTypes, IPEFile>, IDisposable
{
void PopulateCollectionWithStandardGFX();
}
}
|
Fix resource leak that occurred when any GFX files were missing from GFX folder
|
Fix resource leak that occurred when any GFX files were missing from GFX folder
|
C#
|
mit
|
ethanmoffat/EndlessClient
|
321920bc857b07f1359ac0407a080c56f2815a6c
|
osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs
|
osu.Game/Overlays/Settings/Sections/MaintenanceSection.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Localisation;
using osu.Game.Overlays.Settings.Sections.Maintenance;
namespace osu.Game.Overlays.Settings.Sections
{
public class MaintenanceSection : SettingsSection
{
public override LocalisableString Header => MaintenanceSettingsStrings.MaintenanceSectionHeader;
public override Drawable CreateIcon() => new SpriteIcon
{
Icon = FontAwesome.Solid.Wrench
};
public MaintenanceSection()
{
Children = new Drawable[]
{
new BeatmapSettings(),
new SkinSettings(),
new CollectionsSettings(),
new ScoreSettings()
};
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Localisation;
using osu.Game.Overlays.Settings.Sections.Maintenance;
namespace osu.Game.Overlays.Settings.Sections
{
public class MaintenanceSection : SettingsSection
{
public override LocalisableString Header => MaintenanceSettingsStrings.MaintenanceSectionHeader;
public override Drawable CreateIcon() => new SpriteIcon
{
Icon = FontAwesome.Solid.Wrench
};
public MaintenanceSection()
{
Children = new Drawable[]
{
new BeatmapSettings(),
new SkinSettings(),
new CollectionsSettings(),
new ScoreSettings()
};
}
}
}
|
Remove one more nullable disable
|
Remove one more nullable disable
|
C#
|
mit
|
ppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu
|
3deab026c82669e70daadcc09d35c8c62740ef3a
|
src/Microsoft.Blazor/Components/RazorToolingWorkaround.cs
|
src/Microsoft.Blazor/Components/RazorToolingWorkaround.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
/*
* Currently if you have a .cshtml file in a project with <Project Sdk="Microsoft.NET.Sdk.Web">,
* Visual Studio will run design-time builds for the .cshtml file that assume certain ASP.NET MVC
* APIs exist. Since those namespaces and types wouldn't normally exist for Blazor client apps,
* this leads to spurious errors in the Errors List pane, even though there aren't actually any
* errors on build. As a workaround, we define here a minimal set of namespaces/types that satisfy
* the design-time build.
*
* TODO: Track down what is triggering the unwanted design-time build and find out how to disable it.
* Then this file can be removed entirely.
*/
using System;
namespace Microsoft.AspNetCore.Mvc
{
public interface IUrlHelper { }
public interface IViewComponentHelper { }
}
namespace Microsoft.AspNetCore.Mvc.Razor
{
public class RazorPage<T> { }
namespace Internal
{
public class RazorInjectAttributeAttribute : Attribute { }
}
}
namespace Microsoft.AspNetCore.Mvc.Rendering
{
public interface IJsonHelper { }
public interface IHtmlHelper<T> { }
}
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public interface IModelExpressionProvider { }
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
/*
* Currently if you have a .cshtml file in a project with <Project Sdk="Microsoft.NET.Sdk.Web">,
* Visual Studio will run design-time builds for the .cshtml file that assume certain ASP.NET MVC
* APIs exist. Since those namespaces and types wouldn't normally exist for Blazor client apps,
* this leads to spurious errors in the Errors List pane, even though there aren't actually any
* errors on build. As a workaround, we define here a minimal set of namespaces/types that satisfy
* the design-time build.
*
* TODO: Track down what is triggering the unwanted design-time build and find out how to disable it.
* Then this file can be removed entirely.
*/
using System;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Mvc
{
public interface IUrlHelper { }
public interface IViewComponentHelper { }
}
namespace Microsoft.AspNetCore.Mvc.Razor
{
public class RazorPage<T> {
// This needs to be defined otherwise the VS tooling complains that there's no ExecuteAsync method to override.
public virtual Task ExecuteAsync()
=> throw new NotImplementedException($"Blazor components do not implement {nameof(ExecuteAsync)}.");
}
namespace Internal
{
public class RazorInjectAttributeAttribute : Attribute { }
}
}
namespace Microsoft.AspNetCore.Mvc.Rendering
{
public interface IJsonHelper { }
public interface IHtmlHelper<T> { }
}
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public interface IModelExpressionProvider { }
}
|
Stop spurious VS "cannot override ExecuteAsync" errors even if you don't specify a base class
|
Stop spurious VS "cannot override ExecuteAsync" errors even if you don't specify a base class
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
f23cc40ad8e6a41354fb65405d4a3a1d2982ee94
|
src/OpenSage.DataViewer.Windows/App.xaml.cs
|
src/OpenSage.DataViewer.Windows/App.xaml.cs
|
using System.Windows;
namespace OpenSage.DataViewer
{
public partial class App : Application
{
}
}
|
using System.Windows;
using System.Globalization;
using System.Threading;
namespace OpenSage.DataViewer
{
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
base.OnStartup(e);
}
}
}
|
Set thread culture to InvariantCulture on startup
|
Set thread culture to InvariantCulture on startup
Fixes the data viewer in locales which use the decimal comma.
|
C#
|
mit
|
feliwir/openSage,feliwir/openSage
|
06f6bbdff806d3cc02d1012e55963638cd247e76
|
src/Core2D.Perspex/Presenters/CachedContentPresenter.cs
|
src/Core2D.Perspex/Presenters/CachedContentPresenter.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Perspex;
using Perspex.Controls;
using Perspex.Controls.Presenters;
using System;
using System.Collections.Generic;
namespace Core2D.Perspex.Presenters
{
public class CachedContentPresenter : ContentPresenter
{
private static IDictionary<Type, Func<Control>> _factory = new Dictionary<Type, Func<Control>>();
private readonly IDictionary<Type, Control> _cache = new Dictionary<Type, Control>();
public static void Register(Type type, Func<Control> create) => _factory[type] = create;
public CachedContentPresenter()
{
this.GetObservable(DataContextProperty).Subscribe((value) => SetContent(value));
}
public Control GetControl(Type type)
{
Control control;
_cache.TryGetValue(type, out control);
if (control == null)
{
Func<Control> createInstance;
_factory.TryGetValue(type, out createInstance);
control = createInstance?.Invoke();
if (control != null)
{
_cache[type] = control;
}
}
return control;
}
public void SetContent(object value)
{
Control control = null;
if (value != null)
{
control = GetControl(value.GetType());
}
this.Content = control;
}
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Perspex;
using Perspex.Controls;
using Perspex.Controls.Presenters;
using System;
using System.Collections.Generic;
namespace Core2D.Perspex.Presenters
{
public class CachedContentPresenter : ContentPresenter
{
private static IDictionary<Type, Func<Control>> _factory = new Dictionary<Type, Func<Control>>();
private readonly IDictionary<Type, Control> _cache = new Dictionary<Type, Control>();
public static void Register(Type type, Func<Control> create) => _factory[type] = create;
public CachedContentPresenter()
{
this.GetObservable(DataContextProperty).Subscribe((value) => SetContent(value));
}
public Control GetControl(Type type)
{
Control control;
_cache.TryGetValue(type, out control);
if (control == null)
{
Func<Control> createInstance;
_factory.TryGetValue(type, out createInstance);
control = createInstance?.Invoke();
if (control != null)
{
_cache[type] = control;
}
else
{
throw new Exception($"Can not find factory method for type: {type}");
}
}
return control;
}
public void SetContent(object value)
{
Control control = null;
if (value != null)
{
control = GetControl(value.GetType());
}
this.Content = control;
}
}
}
|
Throw excpetion when type is not found
|
Throw excpetion when type is not found
|
C#
|
mit
|
Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
087257e210733ac153e3b35502da5efc02b4445f
|
MediaManager/Platforms/Ios/Video/PlayerViewController.cs
|
MediaManager/Platforms/Ios/Video/PlayerViewController.cs
|
using AVKit;
namespace MediaManager.Platforms.Ios.Video
{
public class PlayerViewController : AVPlayerViewController
{
protected MediaManagerImplementation MediaManager => CrossMediaManager.Apple;
public override void ViewWillDisappear(bool animated)
{
base.ViewWillDisappear(animated);
if (MediaManager.MediaPlayer.VideoView == View.Superview)
{
MediaManager.MediaPlayer.VideoView = null;
}
Player = null;
}
}
}
|
using AVKit;
namespace MediaManager.Platforms.Ios.Video
{
public class PlayerViewController : AVPlayerViewController
{
protected static MediaManagerImplementation MediaManager => CrossMediaManager.Apple;
public override void ViewWillDisappear(bool animated)
{
base.ViewWillDisappear(animated);
if (MediaManager.MediaPlayer.VideoView == View.Superview)
{
MediaManager.MediaPlayer.VideoView = null;
}
Player = null;
}
}
}
|
Make MediaManager a static property
|
Make MediaManager a static property
|
C#
|
mit
|
mike-rowley/XamarinMediaManager,mike-rowley/XamarinMediaManager,martijn00/XamarinMediaManager,martijn00/XamarinMediaManager
|
0ac346f8d122f00b829a657248fe18882589bb39
|
Source/MTW_AncestorSpirits/ThoughtWorker_NoShrineRoom.cs
|
Source/MTW_AncestorSpirits/ThoughtWorker_NoShrineRoom.cs
|
using RimWorld;
using Verse;
namespace MTW_AncestorSpirits
{
class ThoughtWorker_NoShrineRoom : ThoughtWorker
{
private static RoomRoleDef shrineRoomDef = DefDatabase<RoomRoleDef>.GetNamed("MTW_ShrineRoom");
protected override ThoughtState CurrentStateInternal(Pawn p)
{
// TODO: There's gotta be a better way of doin' this!
if (!AncestorUtils.IsAncestor(p)) { return ThoughtState.Inactive; }
var shrine = Find.Map.GetComponent<MapComponent_AncestorTicker>().CurrentSpawner;
if (shrine == null) { return ThoughtState.Inactive; }
// HACK ALERT! Change Shrines to have an Interaction cell, and use that instead of a random one!
var room = RoomQuery.RoomAtFast(shrine.RandomAdjacentCellCardinal());
if (room == null)
{
return ThoughtState.ActiveAtStage(1);
}
else if (room.Role != shrineRoomDef)
{
return ThoughtState.ActiveAtStage(1);
}
else
{
return ThoughtState.Inactive;
}
}
}
}
|
using RimWorld;
using Verse;
namespace MTW_AncestorSpirits
{
class ThoughtWorker_NoShrineRoom : ThoughtWorker
{
private static RoomRoleDef shrineRoomDef = DefDatabase<RoomRoleDef>.GetNamed("MTW_ShrineRoom");
protected override ThoughtState CurrentStateInternal(Pawn p)
{
// TODO: There's gotta be a better way of doin' this!
if (!AncestorUtils.IsAncestor(p)) { return ThoughtState.Inactive; }
var shrine = Find.Map.GetComponent<MapComponent_AncestorTicker>().CurrentSpawner;
if (shrine == null) { return ThoughtState.ActiveAtStage(1); }
// HACK ALERT! Change Shrines to have an Interaction cell, and use that instead of a random one!
var room = RoomQuery.RoomAtFast(shrine.RandomAdjacentCellCardinal());
if (room == null)
{
return ThoughtState.ActiveAtStage(1);
}
else if (room.Role != shrineRoomDef)
{
return ThoughtState.ActiveAtStage(1);
}
else
{
return ThoughtState.Inactive;
}
}
}
}
|
Fix NoShrineRoom logic if shrine is null
|
Fix NoShrineRoom logic if shrine is null
If for some reason the Shrine is destroyed, should keep the thought
penalty.
|
C#
|
mit
|
MoyTW/MTW_AncestorSpirits
|
16ef6c2748675dd20255649f443523fff06aaf14
|
LINQToTTree/LINQToTTreeLib/ExecutionCommon/IQueryExectuor.cs
|
LINQToTTree/LINQToTTreeLib/ExecutionCommon/IQueryExectuor.cs
|
using System.Collections.Generic;
using System.IO;
namespace LINQToTTreeLib.ExecutionCommon
{
/// <summary>
/// Runs an execution request
/// </summary>
interface IQueryExectuor
{
/// <summary>
/// Run request, and return the results
/// </summary>
/// <param name="remotePacket"></param>
/// <returns></returns>
IDictionary<string, ROOTNET.Interface.NTObject> Execute(
FileInfo templateFile,
DirectoryInfo queryDirectory,
IEnumerable<KeyValuePair<string, object>> varsToTransfer);
/// <summary>
/// Set the execution envrionment. Must be done before the call, should not
/// change after the first setting.
/// </summary>
ExecutionEnvironment Environment { set; }
}
}
|
using System.Collections.Generic;
using System.IO;
namespace LINQToTTreeLib.ExecutionCommon
{
/// <summary>
/// Runs an execution request
/// </summary>
interface IQueryExectuor
{
/// <summary>
/// Run request, and return the results
/// </summary>
/// <param name="queryDirectory"></param>
/// <param name="templateFile">Path to the main runner file</param>
/// <param name="varsToTransfer">A list of variables that are used as input to the routine.</param>
/// <returns>A list of objects and names pulled from the output root file</returns>
IDictionary<string, ROOTNET.Interface.NTObject> Execute(
FileInfo templateFile,
DirectoryInfo queryDirectory,
IEnumerable<KeyValuePair<string, object>> varsToTransfer);
/// <summary>
/// Set the execution envrionment. Must be done before the call, should not
/// change after the first setting.
/// </summary>
ExecutionEnvironment Environment { set; }
}
}
|
Improve comments on the interface.
|
Improve comments on the interface.
|
C#
|
lgpl-2.1
|
gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT
|
af1aa725a3a5686e0202b87e9d7ac5b37f5c21b7
|
WeCantSpell.Tests/Integration/CSharp/CommentSpellingTests.cs
|
WeCantSpell.Tests/Integration/CSharp/CommentSpellingTests.cs
|
using System.Collections.Generic;
using System.Threading.Tasks;
using FluentAssertions;
using WeCantSpell.Tests.Utilities;
using Xunit;
namespace WeCantSpell.Tests.Integration.CSharp
{
public class CommentSpellingTests : CSharpTestBase
{
public static IEnumerable<object[]> can_find_mistakes_in_comments_data
{
get
{
yield return new object[] { "aardvark", 660 };
yield return new object[] { "simple", 1186 };
yield return new object[] { "under", 1235 };
}
}
[Theory, MemberData(nameof(can_find_mistakes_in_comments_data))]
public async Task can_find_mistakes_in_comments(string expectedWord, int expectedStart)
{
var expectedEnd = expectedStart + expectedWord.Length;
var analyzer = new SpellingAnalyzerCSharp(new WrongWordChecker(expectedWord));
var project = await ReadCodeFileAsProjectAsync("XmlDoc.SimpleExamples.cs");
var diagnostics = await GetDiagnosticsAsync(project, analyzer);
diagnostics.Should().ContainSingle()
.Subject.Should()
.HaveId("SP3112")
.And.HaveLocation(expectedStart, expectedEnd, "XmlDoc.SimpleExamples.cs")
.And.HaveMessageContaining(expectedWord);
}
}
}
|
using System.Collections.Generic;
using System.Threading.Tasks;
using FluentAssertions;
using WeCantSpell.Tests.Utilities;
using Xunit;
namespace WeCantSpell.Tests.Integration.CSharp
{
public class CommentSpellingTests : CSharpTestBase
{
public static IEnumerable<object[]> can_find_mistakes_in_comments_data
{
get
{
yield return new object[] { "aardvark", 660 };
yield return new object[] { "simple", 1186 };
yield return new object[] { "under", 1235 };
yield return new object[] { "inline", 111 };
yield return new object[] { "tag", 320 };
yield return new object[] { "Here", 898 };
yield return new object[] { "Just", 1130 };
}
}
[Theory, MemberData(nameof(can_find_mistakes_in_comments_data))]
public async Task can_find_mistakes_in_comments(string expectedWord, int expectedStart)
{
var expectedEnd = expectedStart + expectedWord.Length;
var analyzer = new SpellingAnalyzerCSharp(new WrongWordChecker(expectedWord));
var project = await ReadCodeFileAsProjectAsync("XmlDoc.SimpleExamples.cs");
var diagnostics = await GetDiagnosticsAsync(project, analyzer);
diagnostics.Should().ContainSingle()
.Subject.Should()
.HaveId("SP3112")
.And.HaveLocation(expectedStart, expectedEnd, "XmlDoc.SimpleExamples.cs")
.And.HaveMessageContaining(expectedWord);
}
}
}
|
Add a few more tests
|
Add a few more tests
|
C#
|
mit
|
aarondandy/we-cant-spell
|
06229ad7b2c39c17bc332ca8ff1ca5e90ba4577f
|
WebScriptHook.Framework/Messages/Outputs/ChannelRequest.cs
|
WebScriptHook.Framework/Messages/Outputs/ChannelRequest.cs
|
namespace WebScriptHook.Framework.Messages.Outputs
{
/// <summary>
/// Sent by the component to request a channel for itself on the server.
/// This tells the server the name of this component, as well as the maximum number of requests
/// the component can handle per tick.
/// Once the server receives this message, a channel will be created, registered under this component's name.
/// Inputs sent by web clients will then be delivered to this component.
/// </summary>
class ChannelRequest : WebOutput
{
const char HEADER_CACHE = 'n';
public ChannelRequest(string ComponentName, int InputQueueLimit)
: base(HEADER_CACHE, new object[] { ComponentName, InputQueueLimit }, null)
{
}
}
}
|
namespace WebScriptHook.Framework.Messages.Outputs
{
/// <summary>
/// Sent by the component to request a channel for itself on the server.
/// This tells the server the name of this component, as well as the maximum number of requests
/// the component can handle per tick.
/// Once the server receives this message, a channel will be created, registered under this component's name.
/// Inputs sent by web clients will then be delivered to this component.
/// </summary>
class ChannelRequest : WebOutput
{
const char HEADER_CHANNEL = 'n';
public ChannelRequest(string ComponentName, int InputQueueLimit)
: base(HEADER_CHANNEL, new object[] { ComponentName, InputQueueLimit }, null)
{
}
}
}
|
Fix a typo in const name
|
Fix a typo in const name
|
C#
|
mit
|
LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC
|
4e10d191756c505d48a56bcaa499954c17f7f0f1
|
src/Microsoft.AspNetCore.ResponseCaching/ResponseCacheOptions.cs
|
src/Microsoft.AspNetCore.ResponseCaching/ResponseCacheOptions.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.ComponentModel;
using Microsoft.AspNetCore.ResponseCaching.Internal;
namespace Microsoft.AspNetCore.Builder
{
public class ResponseCacheOptions
{
/// <summary>
/// The largest cacheable size for the response body in bytes. The default is set to 1 MB.
/// </summary>
public long MaximumBodySize { get; set; } = 1024 * 1024;
/// <summary>
/// <c>true</c> if request paths are case-sensitive; otherwise <c>false</c>. The default is to treat paths as case-insensitive.
/// </summary>
public bool UseCaseSensitivePaths { get; set; } = false;
/// <summary>
/// For testing purposes only.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
internal ISystemClock SystemClock { get; set; } = new SystemClock();
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.ComponentModel;
using Microsoft.AspNetCore.ResponseCaching.Internal;
namespace Microsoft.AspNetCore.Builder
{
public class ResponseCacheOptions
{
/// <summary>
/// The largest cacheable size for the response body in bytes. The default is set to 64 MB.
/// </summary>
public long MaximumBodySize { get; set; } = 64 * 1024 * 1024;
/// <summary>
/// <c>true</c> if request paths are case-sensitive; otherwise <c>false</c>. The default is to treat paths as case-insensitive.
/// </summary>
public bool UseCaseSensitivePaths { get; set; } = false;
/// <summary>
/// For testing purposes only.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
internal ISystemClock SystemClock { get; set; } = new SystemClock();
}
}
|
Update default Max Body Size
|
Update default Max Body Size
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
738c92f1a23b73eebd58d8cd128459d60b284283
|
DamageMeter.UI/HistoryLink.xaml.cs
|
DamageMeter.UI/HistoryLink.xaml.cs
|
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using Data;
using Tera.Game;
namespace DamageMeter.UI
{
/// <summary>
/// Logique d'interaction pour HistoryLink.xaml
/// </summary>
public partial class HistoryLink
{
public HistoryLink(string link, NpcEntity boss)
{
InitializeComponent();
Boss.Content = boss.Info.Name;
Boss.Tag = link;
if (link.StartsWith("!"))
{
Boss.Foreground = Brushes.Red;
Boss.ToolTip = link;
return;
}
Link.Source = BasicTeraData.Instance.ImageDatabase.Link.Source;
}
private void Click_Link(object sender, MouseButtonEventArgs e)
{
if (Boss.Tag.ToString().StartsWith("http://"))
Process.Start("explorer.exe", Boss.Tag.ToString());
}
private void Sender_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var w = Window.GetWindow(this);
try
{
w?.DragMove();
}
catch
{
Console.WriteLine(@"Exception move");
}
}
}
}
|
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using Data;
using Tera.Game;
namespace DamageMeter.UI
{
/// <summary>
/// Logique d'interaction pour HistoryLink.xaml
/// </summary>
public partial class HistoryLink
{
public HistoryLink(string link, NpcEntity boss)
{
InitializeComponent();
Boss.Content = boss.Info.Name;
Boss.Tag = link;
if (link.StartsWith("!"))
{
Boss.Foreground = Brushes.Red;
Boss.ToolTip = link;
return;
}
Link.Source = BasicTeraData.Instance.ImageDatabase.Link.Source;
}
private void Click_Link(object sender, MouseButtonEventArgs e)
{
if (Boss.Tag.ToString().StartsWith("http://"))
Process.Start("explorer.exe", "\""+Boss.Tag+"\"");
}
private void Sender_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var w = Window.GetWindow(this);
try
{
w?.DragMove();
}
catch
{
Console.WriteLine(@"Exception move");
}
}
}
}
|
Fix encounter url not opening
|
Fix encounter url not opening
|
C#
|
mit
|
neowutran/ShinraMeter,neowutran/TeraDamageMeter,Seyuna/ShinraMeter,radasuka/ShinraMeter
|
4ff74cde88ac39a5d78ae90f4dd1f83fd692d96c
|
src/VGAudio.Cli/Batch.cs
|
src/VGAudio.Cli/Batch.cs
|
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
// ReSharper disable AccessToDisposedClosure
namespace VGAudio.Cli
{
internal static class Batch
{
public static bool BatchConvert(Options options)
{
if (options.Job != JobType.Batch) return false;
SearchOption searchOption = options.Recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
string[] files = ContainerTypes.ExtensionList
.SelectMany(x => Directory.GetFiles(options.InDir, $"*.{x}", searchOption))
.ToArray();
using (var progress = new ProgressBar())
{
progress.SetTotal(files.Length);
Parallel.ForEach(files, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount - 1 }, inPath =>
{
string relativePath = inPath.Substring(options.InDir.Length).TrimStart('\\');
string outPath = Path.ChangeExtension(Path.Combine(options.OutDir, relativePath), options.OutTypeName);
var jobFiles = new JobFiles();
jobFiles.InFiles.Add(new AudioFile(inPath));
jobFiles.OutFiles.Add(new AudioFile(outPath));
try
{
progress.LogMessage(Path.GetFileName(inPath));
Convert.ConvertFile(options, jobFiles, false);
}
catch (Exception ex)
{
progress.LogMessage($"Error converting {Path.GetFileName(inPath)}");
progress.LogMessage(ex.ToString());
}
progress.ReportAdd(1);
});
}
return true;
}
}
}
|
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
// ReSharper disable AccessToDisposedClosure
namespace VGAudio.Cli
{
internal static class Batch
{
public static bool BatchConvert(Options options)
{
if (options.Job != JobType.Batch) return false;
SearchOption searchOption = options.Recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
string[] files = ContainerTypes.ExtensionList
.SelectMany(x => Directory.GetFiles(options.InDir, $"*.{x}", searchOption))
.ToArray();
using (var progress = new ProgressBar())
{
progress.SetTotal(files.Length);
Parallel.ForEach(files,
new ParallelOptions { MaxDegreeOfParallelism = Math.Max(Environment.ProcessorCount - 1, 1) },
inPath =>
{
string relativePath = inPath.Substring(options.InDir.Length).TrimStart('\\');
string outPath = Path.ChangeExtension(Path.Combine(options.OutDir, relativePath), options.OutTypeName);
var jobFiles = new JobFiles();
jobFiles.InFiles.Add(new AudioFile(inPath));
jobFiles.OutFiles.Add(new AudioFile(outPath));
try
{
progress.LogMessage(Path.GetFileName(inPath));
Convert.ConvertFile(options, jobFiles, false);
}
catch (Exception ex)
{
progress.LogMessage($"Error converting {Path.GetFileName(inPath)}");
progress.LogMessage(ex.ToString());
}
progress.ReportAdd(1);
});
}
return true;
}
}
}
|
Fix single core batch processing
|
CLI: Fix single core batch processing
An oversight caused the batch converter to try to use '0' cores when running on a single-core processor
|
C#
|
mit
|
Thealexbarney/VGAudio,Thealexbarney/LibDspAdpcm,Thealexbarney/LibDspAdpcm,Thealexbarney/VGAudio
|
4708cb7317f21287ab7448d9209d6c7eedf4681a
|
osu.Game.Benchmarks/BenchmarkRuleset.cs
|
osu.Game.Benchmarks/BenchmarkRuleset.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using BenchmarkDotNet.Attributes;
using osu.Game.Online.API;
using osu.Game.Rulesets.Osu;
namespace osu.Game.Benchmarks
{
public class BenchmarkRuleset : BenchmarkTest
{
private OsuRuleset ruleset;
private APIMod apiModDoubleTime;
private APIMod apiModDifficultyAdjust;
public override void SetUp()
{
base.SetUp();
ruleset = new OsuRuleset();
apiModDoubleTime = new APIMod { Acronym = "DT" };
apiModDifficultyAdjust = new APIMod { Acronym = "DA" };
}
[Benchmark]
public void BenchmarkToModDoubleTime()
{
apiModDoubleTime.ToMod(ruleset);
}
[Benchmark]
public void BenchmarkToModDifficultyAdjust()
{
apiModDifficultyAdjust.ToMod(ruleset);
}
[Benchmark]
public void BenchmarkGetAllMods()
{
ruleset.GetAllMods();
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Engines;
using osu.Game.Online.API;
using osu.Game.Rulesets.Osu;
namespace osu.Game.Benchmarks
{
public class BenchmarkRuleset : BenchmarkTest
{
private OsuRuleset ruleset;
private APIMod apiModDoubleTime;
private APIMod apiModDifficultyAdjust;
public override void SetUp()
{
base.SetUp();
ruleset = new OsuRuleset();
apiModDoubleTime = new APIMod { Acronym = "DT" };
apiModDifficultyAdjust = new APIMod { Acronym = "DA" };
}
[Benchmark]
public void BenchmarkToModDoubleTime()
{
apiModDoubleTime.ToMod(ruleset);
}
[Benchmark]
public void BenchmarkToModDifficultyAdjust()
{
apiModDifficultyAdjust.ToMod(ruleset);
}
[Benchmark]
public void BenchmarkGetAllMods()
{
ruleset.GetAllMods().Consume(new Consumer());
}
}
}
|
Fix enumerable not being consumed
|
Fix enumerable not being consumed
|
C#
|
mit
|
smoogipoo/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu-new,peppy/osu,ppy/osu,ppy/osu
|
13970713d1dedadd380e4d3386003d966818d456
|
DevTyr.Gullap/Model/MetaContentExtensions.cs
|
DevTyr.Gullap/Model/MetaContentExtensions.cs
|
using System.IO;
namespace DevTyr.Gullap.Model
{
public static class MetaContentExtensions
{
public static string GetTargetFileName(this MetaContent content, SitePaths paths)
{
var isPage = content.Page != null;
string userDefinedFileName = content.GetOverriddenFileName();
string targetFileName = string.IsNullOrWhiteSpace(userDefinedFileName) ? Path.GetFileNameWithoutExtension(content.FileName) + ".html" : userDefinedFileName;
string targetDirectory;
if (isPage)
{
targetDirectory = Path.GetDirectoryName(targetFileName.Replace(paths.PagesPath, paths.OutputPath));
}
else
{
targetDirectory =
Path.GetDirectoryName(content.FileName.Replace(paths.PostsPath,
Path.Combine(paths.OutputPath, SitePaths.PostsDirectoryName)));
}
var targetPath = Path.Combine(targetDirectory, targetFileName);
return targetPath;
}
}
}
|
using System.IO;
namespace DevTyr.Gullap.Model
{
public static class MetaContentExtensions
{
public static string GetTargetFileName(this MetaContent content, SitePaths paths)
{
var isPage = content.Page != null;
string userDefinedFileName = content.GetOverriddenFileName();
string targetFileName = string.IsNullOrWhiteSpace(userDefinedFileName) ? Path.GetFileNameWithoutExtension(content.FileName) + ".html" : userDefinedFileName;
string targetDirectory;
if (isPage)
{
targetDirectory = Path.GetDirectoryName(content.FileName.Replace(paths.PagesPath, paths.OutputPath));
}
else
{
targetDirectory =
Path.GetDirectoryName(content.FileName.Replace(paths.PostsPath,
Path.Combine(paths.OutputPath, SitePaths.PostsDirectoryName)));
}
var targetPath = Path.Combine(targetDirectory, targetFileName);
return targetPath;
}
}
}
|
Fix target file name generation
|
Fix target file name generation
|
C#
|
mit
|
devtyr/gullap
|
22a85d633f3458cf1eaa32ab67cf2cfe47ebe7b9
|
src/Glimpse.Agent.AspNet.Sample/Startup.cs
|
src/Glimpse.Agent.AspNet.Sample/Startup.cs
|
using Glimpse.Agent.Web;
using Microsoft.AspNet.Builder;
using Glimpse.Host.Web.AspNet;
using Microsoft.Framework.DependencyInjection;
namespace Glimpse.Agent.AspNet.Sample
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddGlimpse()
.RunningAgent()
.ForWeb()
.Configure<GlimpseAgentWebOptions>(options =>
{
//options.IgnoredStatusCodes.Add(200);
})
.WithRemoteStreamAgent();
//.WithRemoteHttpAgent();
}
public void Configure(IApplicationBuilder app)
{
app.UseGlimpse();
app.UseWelcomePage();
}
}
}
|
using System.Collections.Generic;
using System.Reflection;
using System.Text.RegularExpressions;
using Glimpse.Agent.Web;
using Glimpse.Agent.Web.Framework;
using Glimpse.Agent.Web.Options;
using Microsoft.AspNet.Builder;
using Glimpse.Host.Web.AspNet;
using Microsoft.Framework.DependencyInjection;
namespace Glimpse.Agent.AspNet.Sample
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
/* Example of how to use fixed provider
TODO: This should be cleanned up with help of extenion methods
services.AddSingleton<IIgnoredRequestProvider>(x =>
{
var activator = x.GetService<ITypeActivator>();
var urlPolicy = activator.CreateInstances<IIgnoredRequestPolicy>(new []
{
typeof(UriIgnoredRequestPolicy).GetTypeInfo(),
typeof(ContentTypeIgnoredRequestPolicy).GetTypeInfo()
});
var provider = new FixedIgnoredRequestProvider(urlPolicy);
return provider;
});
*/
services.AddGlimpse()
.RunningAgent()
.ForWeb()
.Configure<GlimpseAgentWebOptions>(options =>
{
//options.IgnoredStatusCodes.Add(200);
})
.WithRemoteStreamAgent();
//.WithRemoteHttpAgent();
}
public void Configure(IApplicationBuilder app)
{
app.UseGlimpse();
app.UseWelcomePage();
}
}
}
|
Add example of using fixed provider
|
Add example of using fixed provider
This is to be cleaned up
|
C#
|
mit
|
peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype
|
23e169adb6e7b562d5a0922aa4688e0a0fead834
|
src/Pioneer.Blog/Views/Home/_Template.cshtml
|
src/Pioneer.Blog/Views/Home/_Template.cshtml
|
@{
Layout = "~/Views/Shared/_LayoutPublic.cshtml";
}
@section metaPage
{
<meta property="og:type" content="website">
<meta property="og:image" content="@(AppConfiguration.Value.SiteUrl + "/content/images/logo-og.jpg")">
}
@RenderBody()
|
@{
Layout = "~/Views/Shared/_LayoutPublic.cshtml";
}
@section metaPage
{
<meta property="og:type" content="website">
<meta property="og:image" content="@(AppConfiguration.Value.SiteUrl + "/images/logo-og.jpg")">
}
@RenderBody()
|
Fix og:image path for home page
|
Fix og:image path for home page
|
C#
|
mit
|
PioneerCode/pioneer-blog,PioneerCode/pioneer-blog,PioneerCode/pioneer-blog,PioneerCode/pioneer-blog
|
d472d794b7a57ffff7d701992465e3c8416d13eb
|
SqlDiffFramework/SqlDiffFramework/Program.cs
|
SqlDiffFramework/SqlDiffFramework/Program.cs
|
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace SqlDiffFramework
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using SqlDiffFramework.Forms;
namespace SqlDiffFramework
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
|
Reorganize forms into project subfolder
|
Reorganize forms into project subfolder
|
C#
|
mit
|
msorens/SqlDiffFramework
|
a5a9a6398966d4f9f61e6cee3ed49ca26425f0a5
|
WeatherDataFunctionApp/WeatherDataService.cs
|
WeatherDataFunctionApp/WeatherDataService.cs
|
namespace WeatherDataFunctionApp
{
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
public static class WeatherDataService
{
private static readonly HttpClient WeatherDataHttpClient = new HttpClient();
private static readonly string ApiUrl;
static WeatherDataService()
{
string apiKey = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
ApiUrl = $"https://api.apixu.com/v1/current.json?key={apiKey}&q={{0}}";
}
[FunctionName("WeatherDataService")]
public static async Task<HttpResponseMessage> RunAsync([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "WeatherDataService/Current/{location}")]HttpRequestMessage req, string location, TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
HttpResponseMessage responseMessage = await GetCurrentWeatherDataForLocation(location);
if (responseMessage.IsSuccessStatusCode)
return req.CreateResponse(HttpStatusCode.OK, responseMessage.Content.ReadAsAsync(typeof(object)).Result);
log.Error($"Error occurred while trying to retrieve weather data for {req.Content.ReadAsStringAsync().Result}");
return req.CreateErrorResponse(HttpStatusCode.InternalServerError, "Internal Server Error.");
}
private static async Task<HttpResponseMessage> GetCurrentWeatherDataForLocation(string location)
{
return await WeatherDataHttpClient.GetAsync(String.Format(ApiUrl, location));
}
}
}
|
namespace WeatherDataFunctionApp
{
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
public static class WeatherDataService
{
private static readonly HttpClient WeatherDataHttpClient = new HttpClient();
private static readonly string ApiUrl;
static WeatherDataService()
{
string apiKey = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
ApiUrl = $"https://api.apixu.com/v1/current.json?key={apiKey}&q={{0}}";
}
[FunctionName("WeatherDataService")]
public static async Task<HttpResponseMessage> RunAsync([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)]HttpRequestMessage req, TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
var queryNameValuePairs = req.GetQueryNameValuePairs();
var location = queryNameValuePairs.Where(pair => pair.Key.Equals("location", StringComparison.InvariantCultureIgnoreCase)).Select(queryParam => queryParam.Value).FirstOrDefault();
HttpResponseMessage responseMessage = await GetCurrentWeatherDataForLocation(location);
if (responseMessage.IsSuccessStatusCode)
return req.CreateResponse(HttpStatusCode.OK, responseMessage.Content.ReadAsAsync(typeof(object)).Result);
log.Error($"Error occurred while trying to retrieve weather data for {req.Content.ReadAsStringAsync().Result}");
return req.CreateErrorResponse(HttpStatusCode.InternalServerError, "Internal Server Error.");
}
private static async Task<HttpResponseMessage> GetCurrentWeatherDataForLocation(string location)
{
return await WeatherDataHttpClient.GetAsync(String.Format(ApiUrl, location));
}
}
}
|
Read querystring instead of using route patterns
|
Read querystring instead of using route patterns
|
C#
|
mit
|
DeepakChoudhari/WeatherData-AzureFunction
|
03addc3270a596e8df5c9a7965e6f2c982c42c71
|
Launcher/Program.cs
|
Launcher/Program.cs
|
using Microsoft.Web.Administration;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
namespace Launcher
{
public class ExecutionMetadata
{
[JsonProperty("start_command")]
public string DetectedStartCommand { get; set; }
[JsonProperty("start_command_args")]
public string[] StartCommandArgs { get; set; }
}
class Program
{
static int Main(string[] args)
{
if (args.Length < 3)
{
Console.Error.WriteLine("Launcher was run with insufficient arguments. The arguments were: {0}",
String.Join(" ", args));
return 1;
}
ExecutionMetadata executionMetadata = null;
try
{
executionMetadata = JsonConvert.DeserializeObject<ExecutionMetadata>(args[2]);
}
catch (Exception ex)
{
Console.Error.WriteLine(
"Launcher was run with invalid JSON for the metadata argument. The JSON was: {0}", args[2]);
return 1;
}
var startInfo = new ProcessStartInfo
{
UseShellExecute = false,
FileName = executionMetadata.DetectedStartCommand,
Arguments = ArgumentEscaper.Escape(executionMetadata.StartCommandArgs),
};
var process = Process.Start(startInfo);
process.WaitForExit();
return process.ExitCode;
}
}
}
|
using Microsoft.Web.Administration;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
namespace Launcher
{
public class ExecutionMetadata
{
[JsonProperty("start_command")]
public string DetectedStartCommand { get; set; }
[JsonProperty("start_command_args")]
public string[] StartCommandArgs { get; set; }
}
class Program
{
static int Main(string[] args)
{
if (args.Length < 3)
{
Console.Error.WriteLine("Launcher was run with insufficient arguments. The arguments were: {0}",
String.Join(" ", args));
return 1;
}
ExecutionMetadata executionMetadata = null;
try
{
executionMetadata = JsonConvert.DeserializeObject<ExecutionMetadata>(args[2]);
}
catch (Exception ex)
{
Console.Error.WriteLine(
"Launcher was run with invalid JSON for the metadata argument. The JSON was: {0}", args[2]);
return 1;
}
var startInfo = new ProcessStartInfo
{
UseShellExecute = false,
FileName = executionMetadata.DetectedStartCommand,
Arguments = ArgumentEscaper.Escape(executionMetadata.StartCommandArgs),
};
Console.Out.WriteLine("Run {0} :with: {1}", startInfo.FileName, startInfo.Arguments);
var process = Process.Start(startInfo);
process.WaitForExit();
return process.ExitCode;
}
}
}
|
Add informational logging to launcher
|
Add informational logging to launcher
|
C#
|
apache-2.0
|
cloudfoundry-incubator/windows_app_lifecycle,cloudfoundry/windows_app_lifecycle,stefanschneider/windows_app_lifecycle
|
53ea6fb1a844e8fd665f9f1e32be8125102a9fce
|
CreviceApp/Threading.cs
|
CreviceApp/Threading.cs
|
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace CreviceApp.Threading
{
// http://www.codeguru.com/csharp/article.php/c18931/Understanding-the-NET-Task-Parallel-Library-TaskScheduler.htm
public class SingleThreadScheduler : TaskScheduler, IDisposable
{
private readonly BlockingCollection<Task> tasks = new BlockingCollection<Task>();
private readonly Thread thread;
public SingleThreadScheduler() : this(ThreadPriority.Normal) { }
public SingleThreadScheduler(ThreadPriority priority)
{
this.thread = new Thread(new ThreadStart(Main));
this.thread.Priority = priority;
this.thread.Start();
}
private void Main()
{
Verbose.Print("SingleThreadScheduler was started; Thread ID: 0x{0:X}", Thread.CurrentThread.ManagedThreadId);
foreach (var t in tasks.GetConsumingEnumerable())
{
TryExecuteTask(t);
}
}
protected override IEnumerable<Task> GetScheduledTasks()
{
return tasks.ToArray();
}
protected override void QueueTask(Task task)
{
tasks.Add(task);
}
protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
{
return false;
}
public void Dispose()
{
GC.SuppressFinalize(this);
tasks.CompleteAdding();
}
~SingleThreadScheduler()
{
Dispose();
}
}
}
|
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace CreviceApp.Threading
{
// http://www.codeguru.com/csharp/article.php/c18931/Understanding-the-NET-Task-Parallel-Library-TaskScheduler.htm
public class SingleThreadScheduler : TaskScheduler, IDisposable
{
private readonly BlockingCollection<Task> tasks = new BlockingCollection<Task>();
private readonly Thread thread;
public SingleThreadScheduler() : this(ThreadPriority.Normal) { }
public SingleThreadScheduler(ThreadPriority priority)
{
this.thread = new Thread(new ThreadStart(Main));
this.thread.Priority = priority;
this.thread.Start();
}
private void Main()
{
Verbose.Print("SingleThreadScheduler(ThreadID: 0x{0:X}) was started.", Thread.CurrentThread.ManagedThreadId);
foreach (var t in tasks.GetConsumingEnumerable())
{
TryExecuteTask(t);
}
}
protected override IEnumerable<Task> GetScheduledTasks()
{
return tasks.ToArray();
}
protected override void QueueTask(Task task)
{
tasks.Add(task);
}
protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
{
return false;
}
public void Dispose()
{
GC.SuppressFinalize(this);
tasks.CompleteAdding();
}
~SingleThreadScheduler()
{
Dispose();
}
}
}
|
Refactor verbose log of SingleThreadScheduler.
|
Refactor verbose log of SingleThreadScheduler.
|
C#
|
mit
|
rubyu/CreviceApp,rubyu/CreviceApp
|
82671c2d839ad7d273b63866ab623b8cd103fc4d
|
ecologylabFundamentalTestCases/Polymorphic/Configuration.cs
|
ecologylabFundamentalTestCases/Polymorphic/Configuration.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ecologylab.serialization;
using ecologylab.attributes;
namespace ecologylabFundamentalTestCases.Polymorphic
{
/**
*
* <configuration>
<pref_double name="index_thumb_dist" value="200"/>
</configuration>
*
*/
public class Configuration : ElementState
{
[simpl_nowrap]
[simpl_scope("testScope")]
//[simpl_classes(new Type[] { typeof(Pref), typeof(PrefDouble) })]
[simpl_map]
public Dictionary<String, Pref> prefs = new Dictionary<string, Pref>();
#region GetterSetters
public Dictionary<String, Pref> Preferences
{
get { return prefs; }
set { prefs = value; }
}
#endregion
internal void fillDictionary()
{
PrefDouble prefDouble = new PrefDouble();
prefDouble.Name = "index_thumb_dist";
prefDouble.Value = 200;
Pref pref = new Pref();
pref.Name = "test_name";
prefs.Add(prefDouble.Name, prefDouble);
prefs.Add(pref.Name, pref);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ecologylab.serialization;
using ecologylab.attributes;
namespace ecologylabFundamentalTestCases.Polymorphic
{
/**
*
* <configuration>
<pref_double name="index_thumb_dist" value="200"/>
</configuration>
*
*/
public class Configuration : ElementState
{
[simpl_nowrap]
[simpl_scope("testScope")]
//[simpl_classes(new Type[] { typeof(Pref), typeof(PrefDouble) })]
[simpl_map]
public Dictionary<String, Pref> prefs = new Dictionary<string, Pref>();
#region GetterSetters
public Dictionary<String, Pref> Preferences
{
get { return prefs; }
set { prefs = value; }
}
#endregion
internal void fillDictionary()
{
PrefDouble prefDouble = new PrefDouble();
prefDouble.Name = "index_thumb_dist \"now with a double quote\" and a 'single quote' ";
prefDouble.Value = 200;
Pref pref = new Pref();
pref.Name = "test_name";
prefs.Add(prefDouble.Name, prefDouble);
prefs.Add(pref.Name, pref);
}
}
}
|
Test case includes string with quotes.
|
Test case includes string with quotes.
|
C#
|
apache-2.0
|
ecologylab/simplCSharp
|
904d258dc34c343d75bfd1fb544af9c759565f09
|
osu.Game/Overlays/Options/CheckBoxOption.cs
|
osu.Game/Overlays/Options/CheckBoxOption.cs
|
using System;
using osu.Framework.Configuration;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class CheckBoxOption : BasicCheckBox
{
private Bindable<bool> bindable;
public Bindable<bool> Bindable
{
set
{
if (bindable != null)
bindable.ValueChanged -= bindableValueChanged;
bindable = value;
if (bindable != null)
{
bool state = State == CheckBoxState.Checked;
if (state != bindable.Value)
State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked;
bindable.ValueChanged += bindableValueChanged;
}
}
}
private void bindableValueChanged(object sender, EventArgs e)
{
State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked;
}
protected override void Dispose(bool isDisposing)
{
if (bindable != null)
bindable.ValueChanged -= bindableValueChanged;
base.Dispose(isDisposing);
}
protected override void OnChecked()
{
if (bindable != null)
bindable.Value = true;
base.OnChecked();
}
protected override void OnUnchecked()
{
if (bindable != null)
bindable.Value = false;
base.OnChecked();
}
}
}
|
using System;
using osu.Framework.Configuration;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class CheckBoxOption : BasicCheckBox
{
private Bindable<bool> bindable;
public Bindable<bool> Bindable
{
set
{
if (bindable != null)
bindable.ValueChanged -= bindableValueChanged;
bindable = value;
if (bindable != null)
{
bool state = State == CheckBoxState.Checked;
if (state != bindable.Value)
State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked;
bindable.ValueChanged += bindableValueChanged;
}
}
}
private void bindableValueChanged(object sender, EventArgs e)
{
State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked;
}
protected override void Dispose(bool isDisposing)
{
if (bindable != null)
bindable.ValueChanged -= bindableValueChanged;
base.Dispose(isDisposing);
}
protected override void OnChecked()
{
if (bindable != null)
bindable.Value = true;
base.OnChecked();
}
protected override void OnUnchecked()
{
if (bindable != null)
bindable.Value = false;
base.OnUnchecked();
}
}
}
|
Fix checkbox not updating correctly.
|
Fix checkbox not updating correctly.
|
C#
|
mit
|
smoogipoo/osu,peppy/osu,nyaamara/osu,peppy/osu,johnneijzen/osu,smoogipooo/osu,ppy/osu,peppy/osu,UselessToucan/osu,default0/osu,EVAST9919/osu,RedNesto/osu,UselessToucan/osu,theguii/osu,UselessToucan/osu,2yangk23/osu,ppy/osu,DrabWeb/osu,ppy/osu,peppy/osu-new,naoey/osu,johnneijzen/osu,smoogipoo/osu,NeoAdonis/osu,Nabile-Rahmani/osu,Frontear/osuKyzer,smoogipoo/osu,ZLima12/osu,osu-RP/osu-RP,Drezi126/osu,NeoAdonis/osu,EVAST9919/osu,NotKyon/lolisu,DrabWeb/osu,NeoAdonis/osu,Damnae/osu,naoey/osu,2yangk23/osu,DrabWeb/osu,ZLima12/osu,naoey/osu,tacchinotacchi/osu
|
e1c66282033fd806938e9cc54167d7cd3e2707d8
|
src/Atata.WebDriverExtras.Tests/SafeWaitTests.cs
|
src/Atata.WebDriverExtras.Tests/SafeWaitTests.cs
|
using System;
using System.Threading;
using NUnit.Framework;
namespace Atata.WebDriverExtras.Tests
{
[TestFixture]
[Parallelizable(ParallelScope.None)]
public class SafeWaitTests
{
private SafeWait<object> wait;
[SetUp]
public void SetUp()
{
wait = new SafeWait<object>(new object())
{
Timeout = TimeSpan.FromSeconds(.3),
PollingInterval = TimeSpan.FromSeconds(.05)
};
}
[Test]
public void SafeWait_Success_Immediate()
{
using (StopwatchAsserter.Within(0, .01))
wait.Until(_ =>
{
return true;
});
}
[Test]
public void SafeWait_Timeout()
{
using (StopwatchAsserter.Within(.3, .015))
wait.Until(_ =>
{
return false;
});
}
[Test]
public void SafeWait_PollingInterval()
{
using (StopwatchAsserter.Within(.3, .2))
wait.Until(_ =>
{
Thread.Sleep(TimeSpan.FromSeconds(.1));
return false;
});
}
[Test]
public void SafeWait_PollingInterval_GreaterThanTimeout()
{
wait.PollingInterval = TimeSpan.FromSeconds(1);
using (StopwatchAsserter.Within(.3, .015))
wait.Until(_ =>
{
return false;
});
}
}
}
|
using System;
using System.Threading;
using NUnit.Framework;
namespace Atata.WebDriverExtras.Tests
{
[TestFixture]
[Parallelizable(ParallelScope.None)]
public class SafeWaitTests
{
private SafeWait<object> wait;
[SetUp]
public void SetUp()
{
wait = new SafeWait<object>(new object())
{
Timeout = TimeSpan.FromSeconds(.3),
PollingInterval = TimeSpan.FromSeconds(.05)
};
}
[Test]
public void SafeWait_Success_Immediate()
{
using (StopwatchAsserter.Within(0, .01))
wait.Until(_ =>
{
return true;
});
}
[Test]
public void SafeWait_Timeout()
{
using (StopwatchAsserter.Within(.3, .015))
wait.Until(_ =>
{
return false;
});
}
[Test]
public void SafeWait_PollingInterval()
{
using (StopwatchAsserter.Within(.3, .2))
wait.Until(_ =>
{
Thread.Sleep(TimeSpan.FromSeconds(.1));
return false;
});
}
[Test]
public void SafeWait_PollingInterval_GreaterThanTimeout()
{
wait.PollingInterval = TimeSpan.FromSeconds(1);
using (StopwatchAsserter.Within(.3, .02))
wait.Until(_ =>
{
return false;
});
}
}
}
|
Increase toleranceSeconds in SafeWait_PollingInterval_GreaterThanTimeout test
|
Increase toleranceSeconds in SafeWait_PollingInterval_GreaterThanTimeout test
|
C#
|
apache-2.0
|
atata-framework/atata-webdriverextras,atata-framework/atata-webdriverextras
|
8eef2303297a36eac07f51378d4afb3dc41bbd96
|
Paymetheus/Send.xaml.cs
|
Paymetheus/Send.xaml.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Paymetheus
{
/// <summary>
/// Interaction logic for Send.xaml
/// </summary>
public partial class Send : Page
{
public Send()
{
InitializeComponent();
}
private void OutputAmountTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = e.Text.All(ch => !((ch >= '0' && ch <= '9') || ch == '.'));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Paymetheus
{
/// <summary>
/// Interaction logic for Send.xaml
/// </summary>
public partial class Send : Page
{
string decimalSep = CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator;
public Send()
{
InitializeComponent();
}
private void OutputAmountTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = e.Text.All(ch => !((ch >= '0' && ch <= '9') || decimalSep.Contains(ch)));
}
}
}
|
Use locale's decimal separator instead of hardcoding period.
|
Use locale's decimal separator instead of hardcoding period.
Fixes #130.
|
C#
|
isc
|
jrick/Paymetheus,decred/Paymetheus
|
fe494447ea2b1e276e04c8ab4accfd3bdbf44e23
|
src/WinApiNet/Properties/AssemblyInfo.cs
|
src/WinApiNet/Properties/AssemblyInfo.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="WinAPI.NET">
// Copyright (c) Marek Dzikiewicz, All Rights Reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
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("WinApiNet")]
[assembly: AssemblyDescription("")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("01efe7d3-2f81-420a-9ba7-290c1d5554e4")]
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="WinAPI.NET">
// Copyright (c) Marek Dzikiewicz, All Rights Reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
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("WinApiNet")]
[assembly: AssemblyDescription("")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("01efe7d3-2f81-420a-9ba7-290c1d5554e4")]
// Assembly is CLS-compliant
[assembly: CLSCompliant(true)]
|
Set WinApiNet assembly as CLS-compliant
|
Set WinApiNet assembly as CLS-compliant
|
C#
|
mit
|
MpDzik/winapinet,MpDzik/winapinet
|
bae91e339defcc1c3a7c2136f98f4eb5ea18793c
|
Silk.Data.SQL.ORM/Operations/DataOperation.cs
|
Silk.Data.SQL.ORM/Operations/DataOperation.cs
|
using Silk.Data.SQL.Expressions;
using Silk.Data.SQL.Queries;
using System.Threading.Tasks;
namespace Silk.Data.SQL.ORM.Operations
{
public abstract class DataOperation
{
/// <summary>
/// Gets a value indicating if the operation can be executed as part of a batch operation.
/// </summary>
public abstract bool CanBeBatched { get; }
/// <summary>
/// Gets the SQL query needed to run the DataOperation.
/// </summary>
/// <returns></returns>
public abstract QueryExpression GetQuery();
/// <summary>
/// Process the result QueryResult set to the correct result set.
/// </summary>
public abstract void ProcessResult(QueryResult queryResult);
/// <summary>
/// Process the result QueryResult set to the correct result set.
/// </summary>
public abstract Task ProcessResultAsync(QueryResult queryResult);
}
public abstract class DataOperationWithResult<T> : DataOperation
{
/// <summary>
/// Gets the result of the data operation.
/// </summary>
public abstract T Result { get; }
}
}
|
using Silk.Data.SQL.Expressions;
using Silk.Data.SQL.Queries;
using System.Threading.Tasks;
namespace Silk.Data.SQL.ORM.Operations
{
public abstract class DataOperation
{
/// <summary>
/// Gets a value indicating if the operation can be executed as part of a batch operation.
/// </summary>
public abstract bool CanBeBatched { get; }
/// <summary>
/// Gets the SQL query needed to run the DataOperation.
/// </summary>
/// <returns></returns>
public abstract QueryExpression GetQuery();
/// <summary>
/// Process the result QueryResult set to the correct result set.
/// </summary>
public abstract void ProcessResult(QueryResult queryResult);
/// <summary>
/// Process the result QueryResult set to the correct result set.
/// </summary>
public abstract Task ProcessResultAsync(QueryResult queryResult);
}
public abstract class DataOperationWithResult : DataOperation
{
/// <summary>
/// Gets the result of the data operation without a known static type.
/// </summary>
public abstract object UntypedResult { get; }
}
public abstract class DataOperationWithResult<T> : DataOperationWithResult
{
/// <summary>
/// Gets the result of the data operation.
/// </summary>
public abstract T Result { get; }
public override object UntypedResult => Result;
}
}
|
Add an API for getting the result of an operation without knowing it's type.
|
Add an API for getting the result of an operation without knowing it's type.
|
C#
|
mit
|
SilkStack/Silk.Data.SQL.ORM
|
1a516f282c24ba3c35cfa835589d9912afce0c63
|
SimpleReport.Model/Replacers/ValueReplacer.cs
|
SimpleReport.Model/Replacers/ValueReplacer.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
namespace SimpleReport.Model.Replacers
{
/// <summary>
/// Used to replace xml code and remove styling from rtf text
/// </summary>
public class ValueReplacer : IValueReplacer
{
public string Replace(string inputstring)
{
var value = IsRtf(inputstring) ? RtfToText(inputstring) : inputstring;
value = XmlTextEncoder.Encode(value);
return value;
}
private static bool IsRtf(string text)
{
return text.TrimStart().StartsWith("{\\rtf1", StringComparison.Ordinal);
}
private static string RtfToText(string text)
{
try
{
var rtBox = new System.Windows.Forms.RichTextBox {Rtf = text};
text = rtBox.Text;
} catch (Exception ex)
{
// do nothing, just return faulty rtf
}
return text;
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
namespace SimpleReport.Model.Replacers
{
/// <summary>
/// Used to replace xml code and remove styling from rtf text
/// </summary>
public class ValueReplacer : IValueReplacer
{
public string Replace(string inputstring)
{
var value = IsRtf(inputstring) ? RtfToText(inputstring) : inputstring;
return value;
}
private static bool IsRtf(string text)
{
return text.TrimStart().StartsWith("{\\rtf1", StringComparison.Ordinal);
}
private static string RtfToText(string text)
{
try
{
var rtBox = new System.Windows.Forms.RichTextBox {Rtf = text};
text = rtBox.Text;
} catch (Exception ex)
{
// do nothing, just return faulty rtf
}
return text;
}
}
}
|
Remove xml encoding in reports.
|
[8182] Remove xml encoding in reports.
|
C#
|
apache-2.0
|
tronelius/simplereport,tronelius/simplereport,tronelius/simplereport
|
9b6068be7bf6dd9b9923e18521feae8cc27a6701
|
src/Server/Infrastructure/PackageUtility.cs
|
src/Server/Infrastructure/PackageUtility.cs
|
using System;
using System.Web;
using System.Web.Hosting;
using System.Configuration;
namespace NuGet.Server.Infrastructure
{
public class PackageUtility
{
internal static string PackagePhysicalPath;
private static string DefaultPackagePhysicalPath = HostingEnvironment.MapPath("~/Packages");
static PackageUtility()
{
string packagePath = ConfigurationManager.AppSettings["NuGetPackagePath"];
if (string.IsNullOrEmpty(packagePath))
{
PackagePhysicalPath = DefaultPackagePhysicalPath;
}
else
{
PackagePhysicalPath = packagePath;
}
}
public static Uri GetPackageUrl(string path, Uri baseUri)
{
return new Uri(baseUri, GetPackageDownloadUrl(path));
}
private static string GetPackageDownloadUrl(string path)
{
return VirtualPathUtility.ToAbsolute("~/Packages/" + path);
}
}
}
|
using System;
using System.Web;
using System.Web.Hosting;
using System.Configuration;
using System.IO;
namespace NuGet.Server.Infrastructure
{
public class PackageUtility
{
internal static string PackagePhysicalPath;
private static string DefaultPackagePhysicalPath = HostingEnvironment.MapPath("~/Packages");
static PackageUtility()
{
string packagePath = ConfigurationManager.AppSettings["NuGetPackagePath"];
if (string.IsNullOrEmpty(packagePath))
{
PackagePhysicalPath = DefaultPackagePhysicalPath;
}
else
{
if (Path.IsPathRooted(packagePath))
{
PackagePhysicalPath = packagePath;
}
else
{
PackagePhysicalPath = HostingEnvironment.MapPath(packagePath);
}
}
}
public static Uri GetPackageUrl(string path, Uri baseUri)
{
return new Uri(baseUri, GetPackageDownloadUrl(path));
}
private static string GetPackageDownloadUrl(string path)
{
return VirtualPathUtility.ToAbsolute("~/Packages/" + path);
}
}
}
|
Check if the specified path is a physical or a virtual path
|
Check if the specified path is a physical or a virtual path
|
C#
|
apache-2.0
|
mdavid/nuget,mdavid/nuget
|
7d697130dee5f03eb58ca33cd8af1e8014e428f5
|
src/ConsoleApp/Program.cs
|
src/ConsoleApp/Program.cs
|
using static System.Console;
namespace ConsoleApp
{
class Program
{
private static void Main()
{
var connectionString = @"Server=.\SQLEXPRESS;Database=LearnORM;Trusted_Connection=True;";
var schemaName = "dbo";
var tableName = "Book";
var columnsProvider = new ColumnsProvider(connectionString);
var columns = columnsProvider.GetColumnsAsync(schemaName, tableName).GetAwaiter().GetResult();
new Table(tableName, columns).OutputMigrationCode(Out);
}
}
}
|
using static System.Console;
namespace ConsoleApp
{
class Program
{
private static void Main(string[] args)
{
if (args.Length != 3)
{
WriteLine("Usage: schema2fm.exe connectionstring schema table");
return;
}
var connectionString = args[0];//@"Server=.\SQLEXPRESS;Database=LearnORM;Trusted_Connection=True;";
var schemaName = args[1];//"dbo";
var tableName = args[2];//"Book";
var columnsProvider = new ColumnsProvider(connectionString);
var columns = columnsProvider.GetColumnsAsync(schemaName, tableName).GetAwaiter().GetResult();
new Table(tableName, columns).OutputMigrationCode(Out);
}
}
}
|
Read parameters from command line arguments
|
Read parameters from command line arguments
|
C#
|
mit
|
TeamnetGroup/schema2fm
|
92fa1ea9410295e0ada133bcc077002abb8a4541
|
Kooboo.CMS/Kooboo.CMS.ModuleArea/Areas/Empty/ModuleAction.cs
|
Kooboo.CMS/Kooboo.CMS.ModuleArea/Areas/Empty/ModuleAction.cs
|
#region License
//
// Copyright (c) 2013, Kooboo team
//
// Licensed under the BSD License
// See the file LICENSE.txt for details.
//
#endregion
using Kooboo.CMS.Sites.Extension.ModuleArea;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Kooboo.CMS.Sites.Extension;
using Kooboo.CMS.ModuleArea.Areas.SampleModule.Models;
namespace Kooboo.CMS.ModuleArea.Areas.Empty
{
[Kooboo.CMS.Common.Runtime.Dependency.Dependency(typeof(IModuleAction), Key = SampleAreaRegistration.ModuleName)]
public class ModuleAction : IModuleAction
{
public void OnExcluded(Sites.Models.Site site)
{
// Add code here that will be executed when the module was excluded to the site.
}
public void OnIncluded(Sites.Models.Site site)
{
// Add code here that will be executed when the module was included to the site.
}
public void OnInstalling(ControllerContext controllerContext)
{
var moduleInfo = ModuleInfo.Get(SampleAreaRegistration.ModuleName);
var installModel = new InstallModel();
Kooboo.CMS.Sites.Extension.PagePluginHelper.BindModel<InstallModel>(installModel, controllerContext);
moduleInfo.DefaultSettings.CustomSettings["DatabaseServer"] = installModel.DatabaseServer;
moduleInfo.DefaultSettings.CustomSettings["UserName"] = installModel.UserName;
moduleInfo.DefaultSettings.CustomSettings["Password"] = installModel.Password;
ModuleInfo.Save(moduleInfo);
// Add code here that will be executed when the module installing.
}
public void OnUninstalling(ControllerContext controllerContext)
{
// Add code here that will be executed when the module uninstalling.
}
}
}
|
#region License
//
// Copyright (c) 2013, Kooboo team
//
// Licensed under the BSD License
// See the file LICENSE.txt for details.
//
#endregion
using Kooboo.CMS.Sites.Extension.ModuleArea;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Kooboo.CMS.Sites.Extension;
using Kooboo.CMS.ModuleArea.Areas.SampleModule.Models;
namespace Kooboo.CMS.ModuleArea.Areas.Empty
{
[Kooboo.CMS.Common.Runtime.Dependency.Dependency(typeof(IModuleAction), Key = ModuleAreaRegistration.ModuleName)]
public class ModuleAction : IModuleAction
{
public void OnExcluded(Sites.Models.Site site)
{
// Add code here that will be executed when the module was excluded to the site.
}
public void OnIncluded(Sites.Models.Site site)
{
// Add code here that will be executed when the module was included to the site.
}
public void OnInstalling(ControllerContext controllerContext)
{
// Add code here that will be executed when the module installing.
}
public void OnUninstalling(ControllerContext controllerContext)
{
// Add code here that will be executed when the module uninstalling.
}
}
}
|
Update the Empty module template.
|
Update the Empty module template.
|
C#
|
bsd-3-clause
|
jtm789/CMS,andyshao/CMS,lingxyd/CMS,Kooboo/CMS,lingxyd/CMS,techwareone/Kooboo-CMS,andyshao/CMS,techwareone/Kooboo-CMS,jtm789/CMS,jtm789/CMS,lingxyd/CMS,techwareone/Kooboo-CMS,andyshao/CMS,Kooboo/CMS,Kooboo/CMS
|
761fb9376e696bc017ce2352bd2272b03908d70f
|
DOAPI/Structs/Droplets.cs
|
DOAPI/Structs/Droplets.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DigitalOcean.Structs
{
public class Droplet
{
public int id { get; set; }
public string name { get; set; }
public int image_id { get; set; }
public int size_id { get; set; }
public int region_id { get; set; }
public bool backups_active { get; set; }
public string ip_address { get; set; }
public object private_ip_address { get; set; }
public bool locked { get; set; }
public string status { get; set; }
public string created_at { get; set; }
}
public class Droplets
{
public string status { get; set; }
public List<Droplet> droplets { get; set; }
}
}
|
using System.Collections.Generic;
namespace DigitalOcean.Structs
{
public class Droplet
{
public int id { get; set; }
public int image_id { get; set; }
public string name { get; set; }
public int region_id { get; set; }
public int size_id { get; set; }
public bool backups_active { get; set; }
public List<object> backups { get; set; } //extended
public List<object> snapshots { get; set; } //extended
public string ip_address { get; set; }
public object private_ip_address { get; set; }
public bool locked { get; set; }
public string status { get; set; }
public string created_at { get; set; }
}
public class Droplets
{
public string status { get; set; }
public List<Droplet> droplets { get; set; }
}
}
|
Make way for the extended information which can be requested using the Show Droplet request.
|
Make way for the extended information which can be requested using the Show Droplet request.
|
C#
|
mit
|
JamieH/DigitalOcean-CSharp
|
b97c63de07571ebf641c119dee78780320627ca8
|
JsonNetDal/SubDocument.cs
|
JsonNetDal/SubDocument.cs
|
using MyDocs.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Windows.Storage;
using Logic = MyDocs.Common.Model.Logic;
namespace JsonNetDal
{
public class SubDocument
{
public string Title { get; set; }
public string File { get; set; }
public List<string> Photos { get; set; }
public SubDocument() { }
public SubDocument(string title, string file, IEnumerable<string> photos)
{
Title = title;
File = file;
Photos = photos.ToList();
}
public static SubDocument FromLogic(Logic.SubDocument subDocument)
{
return new SubDocument(subDocument.Title, subDocument.File.GetUri().AbsoluteUri, subDocument.Photos.Select(p => p.File.GetUri().AbsoluteUri));
}
public async Task<Logic.SubDocument> ToLogic()
{
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(File));
var photoTasks =
Photos
.Select(p => new Uri(p))
.Select(StorageFile.GetFileFromApplicationUriAsync)
.Select(x => x.AsTask());
var photos = await Task.WhenAll(photoTasks);
return new Logic.SubDocument(file, photos.Select(p => new Logic.Photo(p)));
}
}
}
|
using MyDocs.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Windows.Storage;
using Logic = MyDocs.Common.Model.Logic;
namespace JsonNetDal
{
public class SubDocument
{
public string Title { get; set; }
public Uri File { get; set; }
public List<Uri> Photos { get; set; }
public SubDocument() { }
public SubDocument(string title, Uri file, IEnumerable<Uri> photos)
{
Title = title;
File = file;
Photos = photos.ToList();
}
public static SubDocument FromLogic(Logic.SubDocument subDocument)
{
return new SubDocument(subDocument.Title, subDocument.File.GetUri(), subDocument.Photos.Select(p => p.File.GetUri()));
}
public async Task<Logic.SubDocument> ToLogic()
{
var file = await StorageFile.GetFileFromApplicationUriAsync(File);
var photoTasks =
Photos
.Select(StorageFile.GetFileFromApplicationUriAsync)
.Select(x => x.AsTask());
var photos = await Task.WhenAll(photoTasks);
return new Logic.SubDocument(file, photos.Select(p => new Logic.Photo(p)));
}
}
}
|
Use Uri's for subdocument file and photos
|
Use Uri's for subdocument file and photos
|
C#
|
mit
|
eggapauli/MyDocs,eggapauli/MyDocs
|
2b1d536ec9d0f844c9ad4ee8ad0b8670f8fc044c
|
src/Cronus.Core/Eventing/InMemoryEventBus.cs
|
src/Cronus.Core/Eventing/InMemoryEventBus.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading.Tasks;
namespace Cronus.Core.Eventing
{
/// <summary>
/// Represents an in memory event messaging destribution
/// </summary>
public class InMemoryEventBus : AbstractEventBus
{
/// <summary>
/// Publishes the given event to all registered event handlers
/// </summary>
/// <param name="event">An event instance</param>
public override bool Publish(IEvent @event)
{
onPublishEvent(@event);
foreach (var handleMethod in handlers[@event.GetType()])
{
var result = handleMethod(@event);
if (result == false)
return result;
}
onEventPublished(@event);
return true;
}
public override Task<bool> PublishAsync(IEvent @event)
{
return Threading.RunAsync(() => Publish(@event));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Cronus.Core.Eventing
{
/// <summary>
/// Represents an in memory event messaging destribution
/// </summary>
public class InMemoryEventBus : AbstractEventBus
{
/// <summary>
/// Publishes the given event to all registered event handlers
/// </summary>
/// <param name="event">An event instance</param>
public override bool Publish(IEvent @event)
{
onPublishEvent(@event);
List<Func<IEvent, bool>> eventHandlers;
if (handlers.TryGetValue(@event.GetType(), out eventHandlers))
{
foreach (var handleMethod in eventHandlers)
{
var result = handleMethod(@event);
if (result == false)
return result;
}
}
onEventPublished(@event);
return true;
}
public override Task<bool> PublishAsync(IEvent @event)
{
return Threading.RunAsync(() => Publish(@event));
}
}
}
|
Fix major bug when getting event handlers
|
Fix major bug when getting event handlers
|
C#
|
apache-2.0
|
Elders/Cronus,Elders/Cronus
|
10a1557ba86a8b822e11ef1eec370ec3bd0ce75f
|
src/Daterpillar.CommandLine/Program.cs
|
src/Daterpillar.CommandLine/Program.cs
|
using Gigobyte.Daterpillar.Arguments;
using Gigobyte.Daterpillar.Commands;
using System;
namespace Gigobyte.Daterpillar
{
public class Program
{
internal static void Main(string[] args)
{
InitializeWindow();
start:
var options = new Options();
if (args.Length > 0)
{
CommandLine.Parser.Default.ParseArguments(args, options,
onVerbCommand: (verb, arg) =>
{
ICommand command = new CommandFactory().CrateInstance(verb);
try { _exitCode = command.Execute(arg); }
catch (Exception ex)
{
_exitCode = ExitCode.UnhandledException;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex);
}
});
}
else
{
Console.WriteLine(options.GetHelp());
args = Console.ReadLine().Split(new char[] { ' ', '\t', '\n' });
goto start;
}
Environment.Exit(_exitCode);
}
#region Private Members
private static int _exitCode;
private static void InitializeWindow()
{
Console.Title = $"{nameof(Daterpillar)} CLI";
}
#endregion Private Members
}
}
|
using Gigobyte.Daterpillar.Arguments;
using Gigobyte.Daterpillar.Commands;
using System;
namespace Gigobyte.Daterpillar
{
public class Program
{
internal static void Main(string[] args)
{
InitializeWindow();
do
{
var commandLineOptions = new Options();
if (args.Length > 0)
{
CommandLine.Parser.Default.ParseArguments(args, commandLineOptions,
onVerbCommand: (verb, arg) =>
{
ICommand command = new CommandFactory().CrateInstance(verb);
try { _exitCode = command.Execute(arg); }
catch (Exception ex)
{
_exitCode = ExitCode.UnhandledException;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex);
}
finally { Console.ResetColor(); }
}); break;
}
else
{
Console.WriteLine(commandLineOptions.GetHelp());
args = Console.ReadLine().Split(new char[] { ' ', '\t', '\n' });
}
} while (true);
Environment.Exit(_exitCode);
}
#region Private Members
private static int _exitCode;
private static void InitializeWindow()
{
Console.Title = $"{nameof(Daterpillar)} CLI";
}
#endregion Private Members
}
}
|
Remove goto statements from command line program
|
Remove goto statements from command line program
|
C#
|
mit
|
Ackara/Daterpillar
|
ebbb481fea06ca57b8bf16069ac0052272aa2c3c
|
samples/MvcSample/Program.cs
|
samples/MvcSample/Program.cs
|
#if NET45
using System;
using Microsoft.Owin.Hosting;
namespace MvcSample
{
public class Program
{
const string baseUrl = "http://localhost:9001/";
public static void Main()
{
using (WebApp.Start<Startup>(new StartOptions(baseUrl)))
{
Console.WriteLine("Listening at {0}", baseUrl);
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
}
}
#endif
|
using System;
#if NET45
using Microsoft.Owin.Hosting;
#endif
namespace MvcSample
{
public class Program
{
const string baseUrl = "http://localhost:9001/";
public static void Main()
{
#if NET45
using (WebApp.Start<Startup>(new StartOptions(baseUrl)))
{
Console.WriteLine("Listening at {0}", baseUrl);
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
#else
Console.WriteLine("Hello World");
#endif
}
}
}
|
Print hello world for k10 project.
|
Print hello world for k10 project.
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
34a54240d724b9b7610ab907f66286c8b9d151c1
|
AzureBatchSample/TaskWebJob/Program.cs
|
AzureBatchSample/TaskWebJob/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Azure.WebJobs;
namespace TaskWebJob
{
// To learn more about Microsoft Azure WebJobs SDK, please see http://go.microsoft.com/fwlink/?LinkID=320976
class Program
{
// Please set the following connection strings in app.config for this WebJob to run:
// AzureWebJobsDashboard and AzureWebJobsStorage
static void Main()
{
using (var host = new JobHost())
{
host.Call(typeof(Functions).GetMethod(nameof(Functions.RecordTimeAndSleep)), new { startTime = DateTime.UtcNow });
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Azure.WebJobs;
namespace TaskWebJob
{
// To learn more about Microsoft Azure WebJobs SDK, please see http://go.microsoft.com/fwlink/?LinkID=320976
class Program
{
// Please set the following connection strings in app.config for this WebJob to run:
// AzureWebJobsDashboard and AzureWebJobsStorage
static void Main()
{
using (var host = new JobHost())
{
host.Call(typeof(Functions).GetMethod(nameof(Functions.RecordTimeAndSleep)), new { startTime = DateTime.UtcNow });
}
}
}
public static class PrimeNumbers
{
public static IEnumerable<long> GetPrimeNumbers(long minValue, long maxValue) =>
new[]
{
new
{
primes = new List<long>(),
min = Math.Max(minValue, 2),
max = Math.Max(maxValue, 0),
root_max = maxValue >= 0 ? (long)Math.Sqrt(maxValue) : 0,
}
}
.SelectMany(_ => Enumerable2.Range2(2, Math.Min(_.root_max, _.min - 1))
.Concat(Enumerable2.Range2(_.min, _.max))
.Select(i => new { _.primes, i, root_i = (long)Math.Sqrt(i) }))
.Where(_ => _.primes
.TakeWhile(p => p <= _.root_i)
.All(p => _.i % p != 0))
.Do(_ => _.primes.Add(_.i))
.Select(_ => _.i)
.SkipWhile(i => i < minValue);
}
public static class Enumerable2
{
public static IEnumerable<long> Range2(long minValue, long maxValue)
{
for (var i = minValue; i <= maxValue; i++)
{
yield return i;
}
}
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> action)
{
if (source == null) throw new ArgumentNullException("source");
if (action == null) throw new ArgumentNullException("action");
foreach (var item in source)
{
action(item);
yield return item;
}
}
}
}
|
Add classes for prime numbers
|
Add classes for prime numbers
|
C#
|
mit
|
sakapon/Samples-2016,sakapon/Samples-2016
|
81658e2485350c0f4f29125eaf2279f3030f201b
|
vehicle-control/simulation/Assets/Scripts/CarCollisions.cs
|
vehicle-control/simulation/Assets/Scripts/CarCollisions.cs
|
/*
----------------------------------------------------------------------
Numenta Platform for Intelligent Computing (NuPIC)
Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
with Numenta, Inc., for a separate license for this software code, the
following terms and conditions apply:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses.
http://numenta.org/licenses/
----------------------------------------------------------------------
*/
using UnityEngine;
using System.Collections;
public class CarCollisions : MonoBehaviour {
void OnCollisionEnter(Collision collision) {
if (collision.gameObject.tag == "Boundary") {
Application.LoadLevel(Application.loadedLevel);
}
else if (collision.gameObject.tag == "Finish") {
Application.LoadLevel(Application.loadedLevel + 1);
}
}
}
|
/*
----------------------------------------------------------------------
Numenta Platform for Intelligent Computing (NuPIC)
Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
with Numenta, Inc., for a separate license for this software code, the
following terms and conditions apply:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses.
http://numenta.org/licenses/
----------------------------------------------------------------------
*/
using UnityEngine;
using System.Collections;
public class CarCollisions : MonoBehaviour {
void OnCollisionEnter(Collision collision) {
if (collision.gameObject.tag == "Boundary") {
API.instance.Reset();
Application.LoadLevel(Application.loadedLevel);
}
else if (collision.gameObject.tag == "Finish") {
API.instance.Reset();
Application.LoadLevel(Application.loadedLevel + 1);
}
}
}
|
Add resets when reloading level
|
Add resets when reloading level
|
C#
|
agpl-3.0
|
neuroidss/nupic.research,ThomasMiconi/htmresearch,ywcui1990/htmresearch,cogmission/nupic.research,ThomasMiconi/htmresearch,ywcui1990/htmresearch,mrcslws/htmresearch,BoltzmannBrain/nupic.research,mrcslws/htmresearch,ThomasMiconi/htmresearch,subutai/htmresearch,BoltzmannBrain/nupic.research,subutai/htmresearch,subutai/htmresearch,marionleborgne/nupic.research,ywcui1990/htmresearch,cogmission/nupic.research,BoltzmannBrain/nupic.research,marionleborgne/nupic.research,BoltzmannBrain/nupic.research,ThomasMiconi/htmresearch,subutai/htmresearch,mrcslws/htmresearch,chanceraine/nupic.research,ThomasMiconi/nupic.research,BoltzmannBrain/nupic.research,ThomasMiconi/htmresearch,ThomasMiconi/htmresearch,chanceraine/nupic.research,cogmission/nupic.research,chanceraine/nupic.research,numenta/htmresearch,ywcui1990/nupic.research,ywcui1990/nupic.research,mrcslws/htmresearch,ywcui1990/htmresearch,cogmission/nupic.research,numenta/htmresearch,ywcui1990/nupic.research,chanceraine/nupic.research,ywcui1990/nupic.research,subutai/htmresearch,BoltzmannBrain/nupic.research,marionleborgne/nupic.research,ywcui1990/htmresearch,ywcui1990/nupic.research,neuroidss/nupic.research,ywcui1990/htmresearch,mrcslws/htmresearch,ywcui1990/nupic.research,neuroidss/nupic.research,numenta/htmresearch,mrcslws/htmresearch,ThomasMiconi/nupic.research,ThomasMiconi/nupic.research,subutai/htmresearch,ThomasMiconi/nupic.research,marionleborgne/nupic.research,ywcui1990/htmresearch,marionleborgne/nupic.research,neuroidss/nupic.research,ywcui1990/nupic.research,mrcslws/htmresearch,cogmission/nupic.research,subutai/htmresearch,numenta/htmresearch,chanceraine/nupic.research,subutai/htmresearch,ThomasMiconi/nupic.research,cogmission/nupic.research,ThomasMiconi/htmresearch,mrcslws/htmresearch,ywcui1990/htmresearch,neuroidss/nupic.research,numenta/htmresearch,numenta/htmresearch,neuroidss/nupic.research,marionleborgne/nupic.research,ThomasMiconi/nupic.research,ThomasMiconi/nupic.research,cogmission/nupic.research,BoltzmannBrain/nupic.research,ThomasMiconi/nupic.research,numenta/htmresearch,ThomasMiconi/htmresearch,chanceraine/nupic.research,neuroidss/nupic.research,neuroidss/nupic.research,marionleborgne/nupic.research,BoltzmannBrain/nupic.research,cogmission/nupic.research,numenta/htmresearch,ywcui1990/nupic.research,marionleborgne/nupic.research
|
cea2d7feda0a8e93713308aaf20e268ea0898aba
|
NBi.Core/Scalar/Comparer/ToleranceFactory.cs
|
NBi.Core/Scalar/Comparer/ToleranceFactory.cs
|
using NBi.Core.ResultSet;
using System;
using System.Globalization;
using System.Linq;
namespace NBi.Core.Scalar.Comparer
{
public class ToleranceFactory
{
public static Tolerance Instantiate(IColumnDefinition columnDefinition)
{
if (columnDefinition.Role != ColumnRole.Value)
throw new ArgumentException("The ColumnDefinition must have have a role defined as 'Value' and is defined as 'Key'", "columnDefinition");
return Instantiate(columnDefinition.Type, columnDefinition.Tolerance);
}
public static Tolerance Instantiate(ColumnType type, string value)
{
if (string.IsNullOrEmpty(value) || string.IsNullOrWhiteSpace(value))
return null;
Tolerance tolerance=null;
switch (type)
{
case ColumnType.Text:
tolerance = new TextToleranceFactory().Instantiate(value);
break;
case ColumnType.Numeric:
tolerance = new NumericToleranceFactory().Instantiate(value);
break;
case ColumnType.DateTime:
tolerance = new DateTimeToleranceFactory().Instantiate(value);
break;
case ColumnType.Boolean:
break;
default:
break;
}
return tolerance;
}
public static Tolerance None(ColumnType type)
{
Tolerance tolerance = null;
switch (type)
{
case ColumnType.Text:
tolerance = TextSingleMethodTolerance.None;
break;
case ColumnType.Numeric:
tolerance = NumericAbsoluteTolerance.None;
break;
case ColumnType.DateTime:
tolerance = DateTimeTolerance.None;
break;
case ColumnType.Boolean:
break;
default:
break;
}
return tolerance;
}
}
}
|
using NBi.Core.ResultSet;
using System;
using System.Globalization;
using System.Linq;
namespace NBi.Core.Scalar.Comparer
{
public class ToleranceFactory
{
public static Tolerance Instantiate(IColumnDefinition columnDefinition)
{
if (string.IsNullOrEmpty(columnDefinition.Tolerance) || string.IsNullOrWhiteSpace(columnDefinition.Tolerance))
return null;
if (columnDefinition.Role != ColumnRole.Value)
throw new ArgumentException("The ColumnDefinition must have have a role defined as 'Value' and is defined as 'Key'", "columnDefinition");
return Instantiate(columnDefinition.Type, columnDefinition.Tolerance);
}
public static Tolerance Instantiate(ColumnType type, string value)
{
Tolerance tolerance=null;
switch (type)
{
case ColumnType.Text:
tolerance = new TextToleranceFactory().Instantiate(value);
break;
case ColumnType.Numeric:
tolerance = new NumericToleranceFactory().Instantiate(value);
break;
case ColumnType.DateTime:
tolerance = new DateTimeToleranceFactory().Instantiate(value);
break;
case ColumnType.Boolean:
break;
default:
break;
}
return tolerance;
}
public static Tolerance None(ColumnType type)
{
Tolerance tolerance = null;
switch (type)
{
case ColumnType.Text:
tolerance = TextSingleMethodTolerance.None;
break;
case ColumnType.Numeric:
tolerance = NumericAbsoluteTolerance.None;
break;
case ColumnType.DateTime:
tolerance = DateTimeTolerance.None;
break;
case ColumnType.Boolean:
break;
default:
break;
}
return tolerance;
}
}
}
|
Fix huge bug related to instantiation of tolerance
|
Fix huge bug related to instantiation of tolerance
|
C#
|
apache-2.0
|
Seddryck/NBi,Seddryck/NBi
|
3c965548269cc15d4b7ab50e230b072640c2d458
|
NQuery.Language.ActiproWpf/NQueryLanguage.cs
|
NQuery.Language.ActiproWpf/NQueryLanguage.cs
|
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using ActiproSoftware.Text.Implementation;
using NQuery.Language.Services.BraceMatching;
namespace NQuery.Language.ActiproWpf
{
public sealed class NQueryLanguage : SyntaxLanguage, IDisposable
{
private readonly CompositionContainer _compositionContainer;
public NQueryLanguage()
: this(GetDefaultCatalog())
{
}
public NQueryLanguage(ComposablePartCatalog catalog)
: base("NQuery")
{
_compositionContainer = new CompositionContainer(catalog);
_compositionContainer.SatisfyImportsOnce(this);
var serviceProviders = _compositionContainer.GetExportedValues<ILanguageServiceRegistrar>();
foreach (var serviceProvider in serviceProviders)
serviceProvider.RegisterServices(this);
}
private static ComposablePartCatalog GetDefaultCatalog()
{
var servicesAssembly = new AssemblyCatalog(typeof (IBraceMatchingService).Assembly);
var thisAssembly = new AssemblyCatalog(typeof (NQueryLanguage).Assembly);
return new AggregateCatalog(servicesAssembly, thisAssembly);
}
public void Dispose()
{
_compositionContainer.Dispose();
}
}
}
|
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using ActiproSoftware.Text.Implementation;
using NQuery.Language.Services.BraceMatching;
using NQuery.Language.Wpf;
namespace NQuery.Language.ActiproWpf
{
public sealed class NQueryLanguage : SyntaxLanguage, IDisposable
{
private readonly CompositionContainer _compositionContainer;
public NQueryLanguage()
: this(GetDefaultCatalog())
{
}
public NQueryLanguage(ComposablePartCatalog catalog)
: base("NQuery")
{
_compositionContainer = new CompositionContainer(catalog);
_compositionContainer.SatisfyImportsOnce(this);
var serviceProviders = _compositionContainer.GetExportedValues<ILanguageServiceRegistrar>();
foreach (var serviceProvider in serviceProviders)
serviceProvider.RegisterServices(this);
}
private static ComposablePartCatalog GetDefaultCatalog()
{
var servicesAssembly = new AssemblyCatalog(typeof (IBraceMatchingService).Assembly);
var wpfAssembly = new AssemblyCatalog(typeof(INQueryGlyphService).Assembly);
var thisAssembly = new AssemblyCatalog(typeof (NQueryLanguage).Assembly);
return new AggregateCatalog(servicesAssembly, wpfAssembly, thisAssembly);
}
public void Dispose()
{
_compositionContainer.Dispose();
}
}
}
|
Fix Actipro language to construct the correct set of language services
|
Fix Actipro language to construct the correct set of language services
|
C#
|
mit
|
terrajobst/nquery-vnext
|
bf567e6df56fad7ef637a03b274cad2a1afa10fc
|
osu.Game/Overlays/Settings/SettingsTextBox.cs
|
osu.Game/Overlays/Settings/SettingsTextBox.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsTextBox : SettingsItem<string>
{
protected override Drawable CreateControl() => new OsuTextBox
{
Margin = new MarginPadding { Top = 5 },
RelativeSizeAxes = Axes.X,
};
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsTextBox : SettingsItem<string>
{
protected override Drawable CreateControl() => new OsuTextBox
{
Margin = new MarginPadding { Top = 5 },
RelativeSizeAxes = Axes.X,
CommitOnFocusLost = true,
};
}
}
|
Make settings textboxes commit on focus lost
|
Make settings textboxes commit on focus lost
|
C#
|
mit
|
peppy/osu,johnneijzen/osu,peppy/osu-new,smoogipoo/osu,NeoAdonis/osu,johnneijzen/osu,ppy/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,smoogipooo/osu,EVAST9919/osu,peppy/osu,peppy/osu,2yangk23/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,2yangk23/osu,ppy/osu
|
e43dba8084b47fc5b9649f49ce4316cf4b855e7c
|
Core/NuGetConstants.cs
|
Core/NuGetConstants.cs
|
namespace NuGetPe
{
public static class NuGetConstants
{
public static readonly string DefaultFeedUrl = "http://www.nuget.org/api/v2/";
public static readonly string V2LegacyFeedUrl = "https://nuget.org/api/v2/";
public static readonly string PluginFeedUrl = "http://www.myget.org/F/npe/";
public const string V2LegacyNuGetPublishFeed = "https://nuget.org";
public const string NuGetPublishFeed = "https://www.nuget.org";
}
}
|
namespace NuGetPe
{
public static class NuGetConstants
{
public static readonly string DefaultFeedUrl = "https://www.nuget.org/api/v2/";
public static readonly string V2LegacyFeedUrl = "https://nuget.org/api/v2/";
public static readonly string PluginFeedUrl = "http://www.myget.org/F/npe/";
public const string V2LegacyNuGetPublishFeed = "https://nuget.org";
public const string NuGetPublishFeed = "https://www.nuget.org";
}
}
|
Update nuget url to https
|
Update nuget url to https
|
C#
|
mit
|
NuGetPackageExplorer/NuGetPackageExplorer,campersau/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer
|
f75e6c307df4189a75e56aab01ab0a2ab16c475a
|
Take2/NuLog/Targets/ConsoleTarget.cs
|
Take2/NuLog/Targets/ConsoleTarget.cs
|
/* © 2017 Ivan Pointer
MIT License: https://github.com/ivanpointer/NuLog/blob/master/LICENSE
Source on GitHub: https://github.com/ivanpointer/NuLog */
using NuLog.LogEvents;
using System;
using System.Threading.Tasks;
namespace NuLog.Targets
{
public class ConsoleTarget : LayoutTargetBase
{
public override void Write(LogEvent logEvent)
{
var message = Layout.Format(logEvent);
Console.Write(message);
}
}
}
|
/* © 2017 Ivan Pointer
MIT License: https://github.com/ivanpointer/NuLog/blob/master/LICENSE
Source on GitHub: https://github.com/ivanpointer/NuLog */
using NuLog.LogEvents;
using System;
namespace NuLog.Targets
{
public class ConsoleTarget : LayoutTargetBase
{
public override void Write(LogEvent logEvent)
{
var message = Layout.Format(logEvent);
Console.Write(message);
}
}
}
|
Remove reference to unused "Tasks".
|
Remove reference to unused "Tasks".
|
C#
|
mit
|
ivanpointer/NuLog,ivanpointer/NuLog,ivanpointer/NuLog,ivanpointer/NuLog,ivanpointer/NuLog
|
54f6d569fdc0a5a47ee6cef7e16a35e36fa22950
|
packages/QtCreatorBuilder/dev/QtCreatorBuilder.cs
|
packages/QtCreatorBuilder/dev/QtCreatorBuilder.cs
|
// <copyright file="QtCreatorBuilder.cs" company="Mark Final">
// Opus package
// </copyright>
// <summary>QtCreator package</summary>
// <author>Mark Final</author>
[assembly: Opus.Core.DeclareBuilder("QtCreator", typeof(QtCreatorBuilder.QtCreatorBuilder))]
// Automatically generated by Opus v0.20
namespace QtCreatorBuilder
{
public sealed partial class QtCreatorBuilder : Opus.Core.IBuilder
{
public static string GetProFilePath(Opus.Core.DependencyNode node)
{
//string proFileDirectory = System.IO.Path.Combine(node.GetModuleBuildDirectory(), "QMake");
string proFileDirectory = node.GetModuleBuildDirectory();
string proFilePath = System.IO.Path.Combine(proFileDirectory, System.String.Format("{0}_{1}.pro", node.UniqueModuleName, node.Target));
Opus.Core.Log.MessageAll("ProFile : '{0}'", proFilePath);
return proFilePath;
}
public static string GetQtConfiguration(Opus.Core.Target target)
{
if (target.Configuration != Opus.Core.EConfiguration.Debug && target.Configuration != Opus.Core.EConfiguration.Optimized)
{
throw new Opus.Core.Exception("QtCreator only supports debug and optimized configurations");
}
string QtCreatorConfiguration = (target.Configuration == Opus.Core.EConfiguration.Debug) ? "debug" : "release";
return QtCreatorConfiguration;
}
}
}
|
// <copyright file="QtCreatorBuilder.cs" company="Mark Final">
// Opus package
// </copyright>
// <summary>QtCreator package</summary>
// <author>Mark Final</author>
[assembly: Opus.Core.DeclareBuilder("QtCreator", typeof(QtCreatorBuilder.QtCreatorBuilder))]
// Automatically generated by Opus v0.20
namespace QtCreatorBuilder
{
public sealed partial class QtCreatorBuilder : Opus.Core.IBuilder
{
public static string GetProFilePath(Opus.Core.DependencyNode node)
{
//string proFileDirectory = System.IO.Path.Combine(node.GetModuleBuildDirectory(), "QMake");
string proFileDirectory = node.GetModuleBuildDirectory();
//string proFilePath = System.IO.Path.Combine(proFileDirectory, System.String.Format("{0}_{1}.pro", node.UniqueModuleName, node.Target));
string proFilePath = System.IO.Path.Combine(proFileDirectory, System.String.Format("{0}.pro", node.ModuleName));
Opus.Core.Log.MessageAll("ProFile : '{0}'", proFilePath);
return proFilePath;
}
public static string GetQtConfiguration(Opus.Core.Target target)
{
if (target.Configuration != Opus.Core.EConfiguration.Debug && target.Configuration != Opus.Core.EConfiguration.Optimized)
{
throw new Opus.Core.Exception("QtCreator only supports debug and optimized configurations");
}
string QtCreatorConfiguration = (target.Configuration == Opus.Core.EConfiguration.Debug) ? "debug" : "release";
return QtCreatorConfiguration;
}
}
}
|
Simplify the .pro file names
|
[qtcreator] Simplify the .pro file names
|
C#
|
bsd-3-clause
|
markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation
|
a49d6139f709aad72119ddd290a7c7425b369254
|
Zk/App_Start/IocConfig.cs
|
Zk/App_Start/IocConfig.cs
|
using System.Web.Mvc;
using Autofac;
using Autofac.Integration.Mvc;
using Zk.Models;
using Zk.Services;
using Zk.Repositories;
namespace Zk
{
public static class IocConfig
{
public static void RegisterDependencies()
{
var builder = new ContainerBuilder();
builder.RegisterControllers(typeof(MvcApplication).Assembly);
builder.RegisterType<ZkContext>()
.As<IZkContext>()
.InstancePerRequest();
builder.RegisterType<Repository>();
builder.RegisterType<AuthenticationService>();
builder.RegisterType<UserService>()
.Keyed<IUserService>(AuthenticatedStatus.Anonymous);
builder.RegisterType<UserService>()
.Keyed<IUserService>(AuthenticatedStatus.Authenticated);
builder.RegisterType<PasswordRecoveryService>();
builder.RegisterType<CalendarService>();
builder.RegisterType<FarmingActionService>();
builder.RegisterType<CropProvider>();
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
}
}
}
|
using System.Web.Mvc;
using Autofac;
using Autofac.Integration.Mvc;
using Zk.Models;
using Zk.Services;
using Zk.Repositories;
namespace Zk
{
public static class IocConfig
{
public static void RegisterDependencies()
{
var builder = new ContainerBuilder();
builder.RegisterControllers(typeof(MvcApplication).Assembly);
builder.RegisterType<ZkContext>()
.As<IZkContext>()
.InstancePerRequest();
builder.RegisterType<Repository>()
.InstancePerRequest();
builder.RegisterType<AuthenticationService>()
.InstancePerRequest();
builder.RegisterType<UserService>()
.Keyed<IUserService>(AuthenticatedStatus.Anonymous);
builder.RegisterType<UserService>()
.Keyed<IUserService>(AuthenticatedStatus.Authenticated);
builder.RegisterType<PasswordRecoveryService>()
.InstancePerRequest();
builder.RegisterType<CalendarService>()
.InstancePerRequest();
builder.RegisterType<FarmingActionService>()
.InstancePerRequest();
builder.RegisterType<CropProvider>()
.InstancePerRequest();;
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
}
}
}
|
Add instanceperrequest lifetime scope to all services
|
Add instanceperrequest lifetime scope to all services
|
C#
|
mit
|
erooijak/oogstplanner,erooijak/oogstplanner,erooijak/oogstplanner,erooijak/oogstplanner
|
6c602edd18faea59c6a9d2351c175fffebe739a1
|
DAQ/PHBonesawFileSystem.cs
|
DAQ/PHBonesawFileSystem.cs
|
using System;
namespace DAQ.Environment
{
public class PHBonesawFileSystem : DAQ.Environment.FileSystem
{
public PHBonesawFileSystem()
{
Paths.Add("MOTMasterDataPath", "C:\\Users\\cafmot\\Box\\CaF MOT\\MOTData\\MOTMasterData\\");
Paths.Add("scriptListPath", "C:\\ControlPrograms\\EDMSuite\\MoleculeMOTMasterScripts");
Paths.Add("daqDLLPath", "C:\\ControlPrograms\\EDMSuite\\DAQ\\bin\\CaF\\daq.dll");
Paths.Add("MOTMasterExePath", "C:\\ControlPrograms\\EDMSuite\\MOTMaster\\bin\\CaF\\");
Paths.Add("ExternalFilesPath", "C:\\Users\\cafmot\\Documents\\Temp Camera Images\\");
Paths.Add("HardwareClassPath", "C:\\ControlPrograms\\EDMSuite\\DAQ\\MoleculeMOTHardware.cs");
DataSearchPaths.Add(Paths["scanMasterDataPath"]);
SortDataByDate = false;
}
}
}
|
using System;
namespace DAQ.Environment
{
public class PHBonesawFileSystem : DAQ.Environment.FileSystem
{
public PHBonesawFileSystem()
{
Paths.Add("MOTMasterDataPath", "C:\\Users\\cafmot\\Box Sync\\CaF MOT\\MOTData\\MOTMasterData\\");
Paths.Add("scriptListPath", "C:\\ControlPrograms\\EDMSuite\\MoleculeMOTMasterScripts");
Paths.Add("daqDLLPath", "C:\\ControlPrograms\\EDMSuite\\DAQ\\bin\\CaF\\daq.dll");
Paths.Add("MOTMasterExePath", "C:\\ControlPrograms\\EDMSuite\\MOTMaster\\bin\\CaF\\");
Paths.Add("ExternalFilesPath", "C:\\Users\\cafmot\\Documents\\Temp Camera Images\\");
Paths.Add("HardwareClassPath", "C:\\ControlPrograms\\EDMSuite\\DAQ\\MoleculeMOTHardware.cs");
DataSearchPaths.Add(Paths["scanMasterDataPath"]);
SortDataByDate = false;
}
}
}
|
Change CaF file system paths
|
Change CaF file system paths
- We've moved back to using Box sync (instead of Box drive) on lab
computer so file paths have changed
|
C#
|
mit
|
ColdMatter/EDMSuite,ColdMatter/EDMSuite,ColdMatter/EDMSuite,ColdMatter/EDMSuite
|
93411463f182d623d9904aa002ccf7cba8759294
|
src/VisualStudio/Core/Def/Telemetry/ProjectTypeLookupService.cs
|
src/VisualStudio/Core/Def/Telemetry/ProjectTypeLookupService.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.Composition;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.VisualStudio.LanguageServices.Telemetry
{
[ExportWorkspaceService(typeof(IProjectTypeLookupService), ServiceLayer.Host), Shared]
internal class ProjectTypeLookupService : IProjectTypeLookupService
{
public string GetProjectType(Workspace workspace, ProjectId projectId)
{
if (workspace == null || projectId == null)
{
return string.Empty;
}
var vsWorkspace = workspace as VisualStudioWorkspace;
var aggregatableProject = vsWorkspace.GetHierarchy(projectId) as IVsAggregatableProject;
if (aggregatableProject == null)
{
return string.Empty;
}
if (ErrorHandler.Succeeded(aggregatableProject.GetAggregateProjectTypeGuids(out var projectType)))
{
return projectType;
}
return projectType ?? string.Empty;
}
}
}
|
// 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.Composition;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.VisualStudio.LanguageServices.Telemetry
{
[ExportWorkspaceService(typeof(IProjectTypeLookupService), ServiceLayer.Host), Shared]
internal class ProjectTypeLookupService : IProjectTypeLookupService
{
public string GetProjectType(Workspace workspace, ProjectId projectId)
{
if (!(workspace is VisualStudioWorkspace vsWorkspace) || projectId == null)
{
return string.Empty;
}
var aggregatableProject = vsWorkspace.GetHierarchy(projectId) as IVsAggregatableProject;
if (aggregatableProject == null)
{
return string.Empty;
}
if (ErrorHandler.Succeeded(aggregatableProject.GetAggregateProjectTypeGuids(out var projectType)))
{
return projectType;
}
return projectType ?? string.Empty;
}
}
}
|
Fix incorrect assumption that a workspace is a Visual Studio workspace
|
Fix incorrect assumption that a workspace is a Visual Studio workspace
Fixes #27128
|
C#
|
mit
|
paulvanbrenk/roslyn,ErikSchierboom/roslyn,tmeschter/roslyn,weltkante/roslyn,genlu/roslyn,cston/roslyn,davkean/roslyn,abock/roslyn,KevinRansom/roslyn,tmeschter/roslyn,aelij/roslyn,shyamnamboodiripad/roslyn,nguerrera/roslyn,MichalStrehovsky/roslyn,OmarTawfik/roslyn,dotnet/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,panopticoncentral/roslyn,brettfo/roslyn,bartdesmet/roslyn,DustinCampbell/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,swaroop-sridhar/roslyn,eriawan/roslyn,xasx/roslyn,agocke/roslyn,gafter/roslyn,dpoeschl/roslyn,DustinCampbell/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,nguerrera/roslyn,jamesqo/roslyn,eriawan/roslyn,genlu/roslyn,paulvanbrenk/roslyn,bkoelman/roslyn,brettfo/roslyn,physhi/roslyn,sharwell/roslyn,wvdd007/roslyn,davkean/roslyn,swaroop-sridhar/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,bkoelman/roslyn,jcouv/roslyn,CyrusNajmabadi/roslyn,nguerrera/roslyn,cston/roslyn,mavasani/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,AmadeusW/roslyn,mgoertz-msft/roslyn,gafter/roslyn,tmat/roslyn,bartdesmet/roslyn,dpoeschl/roslyn,panopticoncentral/roslyn,weltkante/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,stephentoub/roslyn,reaction1989/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,heejaechang/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,ErikSchierboom/roslyn,tmat/roslyn,genlu/roslyn,bkoelman/roslyn,tannergooding/roslyn,MichalStrehovsky/roslyn,jmarolf/roslyn,diryboy/roslyn,KevinRansom/roslyn,mgoertz-msft/roslyn,jamesqo/roslyn,tmat/roslyn,reaction1989/roslyn,tannergooding/roslyn,diryboy/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,jasonmalinowski/roslyn,gafter/roslyn,dotnet/roslyn,tannergooding/roslyn,dpoeschl/roslyn,diryboy/roslyn,physhi/roslyn,aelij/roslyn,jmarolf/roslyn,agocke/roslyn,sharwell/roslyn,abock/roslyn,ErikSchierboom/roslyn,VSadov/roslyn,tmeschter/roslyn,mavasani/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,xasx/roslyn,shyamnamboodiripad/roslyn,swaroop-sridhar/roslyn,AmadeusW/roslyn,jcouv/roslyn,aelij/roslyn,AmadeusW/roslyn,brettfo/roslyn,paulvanbrenk/roslyn,OmarTawfik/roslyn,jamesqo/roslyn,physhi/roslyn,agocke/roslyn,VSadov/roslyn,abock/roslyn,OmarTawfik/roslyn,KirillOsenkov/roslyn,panopticoncentral/roslyn,heejaechang/roslyn,davkean/roslyn,VSadov/roslyn,KirillOsenkov/roslyn,stephentoub/roslyn,xasx/roslyn,wvdd007/roslyn,MichalStrehovsky/roslyn,cston/roslyn,AlekseyTs/roslyn,jasonmalinowski/roslyn,DustinCampbell/roslyn,KevinRansom/roslyn,jcouv/roslyn,jmarolf/roslyn
|
b37197f66aa4ae86ee7fba0393b38a41e96c347f
|
src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml
|
src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Media.cshtml
|
@model dynamic
@using Umbraco.Web.Templates
@if (Model.value != null)
{
var url = Model.value.image;
if(Model.editor.config != null && Model.editor.config.size != null){
url += "?width=" + Model.editor.config.size.width;
url += "&height=" + Model.editor.config.size.height;
if(Model.value.focalPoint != null){
url += "¢er=" + Model.value.focalPoint.top +"," + Model.value.focalPoint.left;
url += "&mode=crop";
}
}
<img src="@url" alt="@Model.value.caption">
if (Model.value.caption != null)
{
<p class="caption">@Model.value.caption</p>
}
}
|
@model dynamic
@using Umbraco.Web.Templates
@if (Model.value != null)
{
var url = Model.value.image;
if(Model.editor.config != null && Model.editor.config.size != null){
url += "?width=" + Model.editor.config.size.width;
url += "&height=" + Model.editor.config.size.height;
if(Model.value.focalPoint != null){
url += "¢er=" + Model.value.focalPoint.top +"," + Model.value.focalPoint.left;
url += "&mode=crop";
}
}
var altText = Model.value.altText ?? String.Empty;
<img src="@url" alt="@altText">
if (Model.value.caption != null)
{
<p class="caption">@Model.value.caption</p>
}
}
|
Fix for U4-10821, render alt text attribute from grid image editor, or empty string if null (for screen readers)
|
Fix for U4-10821, render alt text attribute from grid image editor, or empty string if null (for screen readers)
|
C#
|
mit
|
abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,rasmuseeg/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,tcmorris/Umbraco-CMS,NikRimington/Umbraco-CMS,umbraco/Umbraco-CMS,leekelleher/Umbraco-CMS,aaronpowell/Umbraco-CMS,marcemarc/Umbraco-CMS,lars-erik/Umbraco-CMS,marcemarc/Umbraco-CMS,abjerner/Umbraco-CMS,lars-erik/Umbraco-CMS,WebCentrum/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,madsoulswe/Umbraco-CMS,leekelleher/Umbraco-CMS,tcmorris/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,lars-erik/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,hfloyd/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,aaronpowell/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,rasmuseeg/Umbraco-CMS,lars-erik/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tompipe/Umbraco-CMS,arknu/Umbraco-CMS,NikRimington/Umbraco-CMS,base33/Umbraco-CMS,WebCentrum/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,rasmuseeg/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,bjarnef/Umbraco-CMS,umbraco/Umbraco-CMS,mattbrailsford/Umbraco-CMS,bjarnef/Umbraco-CMS,base33/Umbraco-CMS,arknu/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,leekelleher/Umbraco-CMS,aaronpowell/Umbraco-CMS,tompipe/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,bjarnef/Umbraco-CMS,madsoulswe/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,NikRimington/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,mattbrailsford/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,KevinJump/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,lars-erik/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,abryukhov/Umbraco-CMS,bjarnef/Umbraco-CMS,base33/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,madsoulswe/Umbraco-CMS,leekelleher/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,dawoe/Umbraco-CMS,tompipe/Umbraco-CMS,marcemarc/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,WebCentrum/Umbraco-CMS
|
f59271f3592c2bdd8e1e8a9ab7834d121cc77be8
|
samples/TabletDesigner/TabletDesignerPage.xaml.cs
|
samples/TabletDesigner/TabletDesignerPage.xaml.cs
|
using System;
using Sancho.DOM.XamarinForms;
using Sancho.XAMLParser;
using TabletDesigner.Helpers;
using Xamarin.Forms;
namespace TabletDesigner
{
public interface ILogAccess
{
void Clear();
string Log { get; }
}
public partial class TabletDesignerPage : ContentPage
{
ILogAccess logAccess;
public TabletDesignerPage()
{
InitializeComponent();
logAccess = DependencyService.Get<ILogAccess>();
}
protected override void OnAppearing()
{
base.OnAppearing();
editor.Text = Settings.Xaml;
}
void Handle_TextChanged(object sender, Xamarin.Forms.TextChangedEventArgs e)
{
try
{
Settings.Xaml = editor.Text;
logAccess.Clear();
var parser = new Parser();
var rootNode = parser.Parse(e.NewTextValue);
rootNode = new ContentNodeProcessor().Process(rootNode);
rootNode = new ExpandedPropertiesProcessor().Process(rootNode);
var view = new XamlDOMCreator().CreateNode(rootNode) as View;
Root.Content = view;
LoggerOutput.Text = logAccess.Log;
LoggerOutput.TextColor = Color.White;
}
catch (Exception ex)
{
LoggerOutput.Text = ex.ToString();
LoggerOutput.TextColor = Color.FromHex("#FF3030");
}
}
}
}
|
using System;
using Sancho.DOM.XamarinForms;
using Sancho.XAMLParser;
using TabletDesigner.Helpers;
using Xamarin.Forms;
namespace TabletDesigner
{
public interface ILogAccess
{
void Clear();
string Log { get; }
}
public partial class TabletDesignerPage : ContentPage
{
ILogAccess logAccess;
public TabletDesignerPage()
{
InitializeComponent();
logAccess = DependencyService.Get<ILogAccess>();
}
protected override void OnAppearing()
{
base.OnAppearing();
editor.Text = Settings.Xaml;
}
void Handle_TextChanged(object sender, Xamarin.Forms.TextChangedEventArgs e)
{
try
{
Settings.Xaml = editor.Text;
logAccess.Clear();
var parser = new Parser();
var rootNode = parser.Parse(e.NewTextValue);
rootNode = new ContentNodeProcessor().Process(rootNode);
rootNode = new ExpandedPropertiesProcessor().Process(rootNode);
var dom = new XamlDOMCreator().CreateNode(rootNode);
if (dom is View)
Root.Content = (View)dom;
else if (dom is ContentPage)
Root.Content = ((ContentPage)dom).Content;
LoggerOutput.Text = logAccess.Log;
LoggerOutput.TextColor = Color.White;
}
catch (Exception ex)
{
LoggerOutput.Text = ex.ToString();
LoggerOutput.TextColor = Color.FromHex("#FF3030");
}
}
}
}
|
Handle content pages as well
|
Handle content pages as well
|
C#
|
mit
|
MassivePixel/Sancho.XAMLParser
|
78f2f09c264637170dd969004a4d5eadf1844b65
|
JSIL/DeclarationHoister.cs
|
JSIL/DeclarationHoister.cs
|
using System;
using System.Collections.Generic;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Ast.Transforms;
using ICSharpCode.NRefactory.CSharp;
namespace JSIL {
public class DeclarationHoister : ContextTrackingVisitor<object> {
public readonly BlockStatement Output;
public VariableDeclarationStatement Statement = null;
public readonly HashSet<string> HoistedNames = new HashSet<string>();
public DeclarationHoister (DecompilerContext context, BlockStatement output)
: base(context) {
Output = output;
}
public override object VisitVariableDeclarationStatement (VariableDeclarationStatement variableDeclarationStatement, object data) {
if (Statement == null) {
Statement = new VariableDeclarationStatement();
Output.Add(Statement);
}
foreach (var variable in variableDeclarationStatement.Variables) {
if (!HoistedNames.Contains(variable.Name)) {
Statement.Variables.Add(new VariableInitializer(
variable.Name
));
HoistedNames.Add(variable.Name);
}
}
var replacement = new BlockStatement();
foreach (var variable in variableDeclarationStatement.Variables) {
replacement.Add(new ExpressionStatement(new AssignmentExpression {
Left = new IdentifierExpression(variable.Name),
Right = variable.Initializer.Clone()
}));
}
if (replacement.Statements.Count == 1) {
var firstChild = replacement.FirstChild;
firstChild.Remove();
variableDeclarationStatement.ReplaceWith(firstChild);
} else if (replacement.Statements.Count > 1) {
variableDeclarationStatement.ReplaceWith(replacement);
}
return null;
}
}
}
|
using System;
using System.Collections.Generic;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Ast.Transforms;
using ICSharpCode.NRefactory.CSharp;
namespace JSIL {
public class DeclarationHoister : ContextTrackingVisitor<object> {
public readonly BlockStatement Output;
public VariableDeclarationStatement Statement = null;
public readonly HashSet<string> HoistedNames = new HashSet<string>();
public DeclarationHoister (DecompilerContext context, BlockStatement output)
: base(context) {
Output = output;
}
public override object VisitVariableDeclarationStatement (VariableDeclarationStatement variableDeclarationStatement, object data) {
if (Statement == null) {
Statement = new VariableDeclarationStatement();
Output.Add(Statement);
}
foreach (var variable in variableDeclarationStatement.Variables) {
if (!HoistedNames.Contains(variable.Name)) {
Statement.Variables.Add(new VariableInitializer(
variable.Name
));
HoistedNames.Add(variable.Name);
}
}
var replacement = new BlockStatement();
foreach (var variable in variableDeclarationStatement.Variables) {
if (variable.IsNull)
continue;
if (variable.Initializer.IsNull)
continue;
replacement.Add(new ExpressionStatement(new AssignmentExpression {
Left = new IdentifierExpression(variable.Name),
Right = variable.Initializer.Clone()
}));
}
if (replacement.Statements.Count == 1) {
var firstChild = replacement.FirstChild;
firstChild.Remove();
variableDeclarationStatement.ReplaceWith(firstChild);
} else if (replacement.Statements.Count > 1) {
variableDeclarationStatement.ReplaceWith(replacement);
} else {
variableDeclarationStatement.Remove();
}
return null;
}
}
}
|
Fix hoisting of null initializers
|
Fix hoisting of null initializers
|
C#
|
mit
|
x335/JSIL,acourtney2015/JSIL,antiufo/JSIL,dmirmilshteyn/JSIL,sq/JSIL,volkd/JSIL,hach-que/JSIL,dmirmilshteyn/JSIL,FUSEEProjectTeam/JSIL,Trattpingvin/JSIL,FUSEEProjectTeam/JSIL,volkd/JSIL,FUSEEProjectTeam/JSIL,acourtney2015/JSIL,iskiselev/JSIL,Trattpingvin/JSIL,hach-que/JSIL,dmirmilshteyn/JSIL,x335/JSIL,antiufo/JSIL,Trattpingvin/JSIL,sander-git/JSIL,sq/JSIL,hach-que/JSIL,acourtney2015/JSIL,iskiselev/JSIL,hach-que/JSIL,TukekeSoft/JSIL,iskiselev/JSIL,iskiselev/JSIL,sq/JSIL,FUSEEProjectTeam/JSIL,acourtney2015/JSIL,x335/JSIL,antiufo/JSIL,acourtney2015/JSIL,mispy/JSIL,iskiselev/JSIL,sander-git/JSIL,mispy/JSIL,volkd/JSIL,sander-git/JSIL,mispy/JSIL,volkd/JSIL,sander-git/JSIL,TukekeSoft/JSIL,TukekeSoft/JSIL,Trattpingvin/JSIL,sander-git/JSIL,x335/JSIL,TukekeSoft/JSIL,sq/JSIL,hach-que/JSIL,volkd/JSIL,mispy/JSIL,FUSEEProjectTeam/JSIL,sq/JSIL,antiufo/JSIL,dmirmilshteyn/JSIL
|
f423dbbb1de22222abf01bdfdcd9f7fec5c20d8c
|
src/Avalonia.Base/Data/Core/SettableNode.cs
|
src/Avalonia.Base/Data/Core/SettableNode.cs
|
using Avalonia.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Avalonia.Data.Core
{
internal abstract class SettableNode : ExpressionNode
{
public bool SetTargetValue(object value, BindingPriority priority)
{
if (ShouldNotSet(value))
{
return true;
}
return SetTargetValueCore(value, priority);
}
private bool ShouldNotSet(object value)
{
if (PropertyType == null)
{
return false;
}
if (PropertyType.IsValueType)
{
return LastValue?.Target.Equals(value) ?? false;
}
return LastValue != null && Object.ReferenceEquals(LastValue?.Target, value);
}
protected abstract bool SetTargetValueCore(object value, BindingPriority priority);
public abstract Type PropertyType { get; }
}
}
|
using Avalonia.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Avalonia.Data.Core
{
internal abstract class SettableNode : ExpressionNode
{
public bool SetTargetValue(object value, BindingPriority priority)
{
if (ShouldNotSet(value))
{
return true;
}
return SetTargetValueCore(value, priority);
}
private bool ShouldNotSet(object value)
{
if (PropertyType == null)
{
return false;
}
if (PropertyType.IsValueType)
{
return LastValue?.Target != null && LastValue.Target.Equals(value);
}
return LastValue != null && Object.ReferenceEquals(LastValue?.Target, value);
}
protected abstract bool SetTargetValueCore(object value, BindingPriority priority);
public abstract Type PropertyType { get; }
}
}
|
Fix codepath where the property is a value type but the weakreference has been collected.
|
Fix codepath where the property is a value type but the weakreference has been collected.
|
C#
|
mit
|
wieslawsoltes/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,akrisiun/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,Perspex/Perspex,grokys/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex
|
fee2f0d58872c0a0ab56e16322d7d0bd20015439
|
services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs
|
services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs
|
using System;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
namespace FilterLists.SharedKernel.Logging
{
public static class HostRunner
{
public static async Task TryRunWithLoggingAsync(this IHost host, Func<Task>? runPreHostAsync = default)
{
_ = host ?? throw new ArgumentNullException(nameof(host));
InitializeLogger(host);
try
{
if (runPreHostAsync != null)
{
Log.Information("Initializing pre-host");
await runPreHostAsync();
}
Log.Information("Initializing host");
await host.RunAsync();
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly");
throw;
}
finally
{
Log.CloseAndFlush();
}
}
private static void InitializeLogger(IHost host)
{
var hostEnvironment = host.Services.GetRequiredService<IHostEnvironment>();
Log.Logger = ConfigurationBuilder.BaseLoggerConfiguration
.ReadFrom.Configuration(host.Services.GetRequiredService<IConfiguration>())
.Enrich.WithProperty("Application", hostEnvironment.ApplicationName)
.Enrich.WithProperty("Environment", hostEnvironment.EnvironmentName)
.WriteTo.Conditional(
_ => !hostEnvironment.IsProduction(),
sc => sc.Console().WriteTo.Debug())
.WriteTo.Conditional(
_ => hostEnvironment.IsProduction(),
sc => sc.ApplicationInsights(
host.Services.GetRequiredService<TelemetryConfiguration>(),
TelemetryConverter.Traces))
.CreateLogger();
}
}
}
|
using System;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
namespace FilterLists.SharedKernel.Logging
{
public static class HostRunner
{
public static async Task TryRunWithLoggingAsync(this IHost host, Func<Task>? runPreHostAsync = default)
{
_ = host ?? throw new ArgumentNullException(nameof(host));
Log.Logger = ConfigurationBuilder.BaseLoggerConfiguration
.WriteTo.Conditional(
_ => host.Services.GetService<IHostEnvironment>().IsProduction(),
c => c.ApplicationInsights(
TelemetryConfiguration.CreateDefault(),
TelemetryConverter.Traces))
.CreateLogger();
try
{
if (runPreHostAsync != null)
{
Log.Information("Initializing pre-host");
await runPreHostAsync();
}
Log.Information("Initializing host");
await host.RunAsync();
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly");
throw;
}
finally
{
Log.CloseAndFlush();
}
}
}
}
|
Revert "fix(logging): 🐛 try yet another AppInsights config"
|
Revert "fix(logging): 🐛 try yet another AppInsights config"
This reverts commit a313ce949202d3cc6263b8ff7136a34cf99715de.
|
C#
|
mit
|
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
|
4eb6026cc3a0b785bd77faa80a64e202a48d1491
|
src/FluentNHibernate/Mapping/ImportPart.cs
|
src/FluentNHibernate/Mapping/ImportPart.cs
|
using System;
using System.Xml;
namespace FluentNHibernate.Mapping
{
public class ImportPart : IMappingPart
{
private readonly Cache<string, string> attributes = new Cache<string, string>();
private readonly Type importType;
public ImportPart(Type importType)
{
this.importType = importType;
}
public void SetAttribute(string name, string value)
{
attributes.Store(name, value);
}
public void SetAttributes(Attributes attrs)
{
foreach (var key in attrs.Keys)
{
SetAttribute(key, attrs[key]);
}
}
public void Write(XmlElement classElement, IMappingVisitor visitor)
{
var importElement = classElement.AddElement("import")
.WithAtt("class", importType.AssemblyQualifiedName);
attributes.ForEachPair((name, value) => importElement.WithAtt(name, value));
}
public void As(string alternativeName)
{
SetAttribute("rename", alternativeName);
}
public int Level
{
get { return 1; }
}
public PartPosition Position
{
get { return PartPosition.First; }
}
}
}
|
using System;
using System.Xml;
namespace FluentNHibernate.Mapping
{
public class ImportPart : IMappingPart
{
private readonly Cache<string, string> attributes = new Cache<string, string>();
private readonly Type importType;
public ImportPart(Type importType)
{
this.importType = importType;
}
public void SetAttribute(string name, string value)
{
attributes.Store(name, value);
}
public void SetAttributes(Attributes attrs)
{
foreach (var key in attrs.Keys)
{
SetAttribute(key, attrs[key]);
}
}
public void Write(XmlElement classElement, IMappingVisitor visitor)
{
var importElement = classElement.AddElement("import")
.WithAtt("class", importType.AssemblyQualifiedName)
.WithAtt("xmlns", "urn:nhibernate-mapping-2.2");
attributes.ForEachPair((name, value) => importElement.WithAtt(name, value));
}
public void As(string alternativeName)
{
SetAttribute("rename", alternativeName);
}
public int Level
{
get { return 1; }
}
public PartPosition Position
{
get { return PartPosition.First; }
}
}
}
|
Fix import tag to have correct namespace
|
Fix import tag to have correct namespace
git-svn-id: a161142445158cf41e00e2afdd70bb78aded5464@138 48f0ce17-cc52-0410-af8c-857c09b6549b
|
C#
|
bsd-3-clause
|
hzhgis/ss,HermanSchoenfeld/fluent-nhibernate,chester89/fluent-nhibernate,narnau/fluent-nhibernate,bogdan7/nhibernate,narnau/fluent-nhibernate,oceanho/fluent-nhibernate,lingxyd/fluent-nhibernate,hzhgis/ss,bogdan7/nhibernate,MiguelMadero/fluent-nhibernate,oceanho/fluent-nhibernate,hzhgis/ss,owerkop/fluent-nhibernate,lingxyd/fluent-nhibernate,MiguelMadero/fluent-nhibernate,chester89/fluent-nhibernate,bogdan7/nhibernate,HermanSchoenfeld/fluent-nhibernate,chester89/fluent-nhibernate,owerkop/fluent-nhibernate
|
4b5e57a4dcb6058077cc547940b874feceae8ea6
|
Source/Monitorian.Core/Views/Behaviors/FocusElementAction.cs
|
Source/Monitorian.Core/Views/Behaviors/FocusElementAction.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Microsoft.Xaml.Behaviors;
namespace Monitorian.Core.Views.Behaviors
{
public class FocusElementAction : TriggerAction<DependencyObject>
{
public UIElement TargetElement
{
get { return (UIElement)GetValue(TargetElementProperty); }
set { SetValue(TargetElementProperty, value); }
}
public static readonly DependencyProperty TargetElementProperty =
DependencyProperty.Register(
"TargetElement",
typeof(UIElement),
typeof(FocusElementAction),
new PropertyMetadata(null));
protected override void Invoke(object parameter)
{
if ((TargetElement is null) || !TargetElement.Focusable || TargetElement.IsFocused)
return;
TargetElement.Focus();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Microsoft.Xaml.Behaviors;
namespace Monitorian.Core.Views.Behaviors
{
public class FocusElementAction : TriggerAction<DependencyObject>
{
public UIElement TargetElement
{
get { return (UIElement)GetValue(TargetElementProperty); }
set { SetValue(TargetElementProperty, value); }
}
public static readonly DependencyProperty TargetElementProperty =
DependencyProperty.Register(
"TargetElement",
typeof(UIElement),
typeof(FocusElementAction),
new PropertyMetadata(default(UIElement)));
protected override void Invoke(object parameter)
{
if ((TargetElement is null) || !TargetElement.Focusable || TargetElement.IsFocused)
return;
TargetElement.Focus();
}
}
}
|
Modify PropertyMetadata for correct overloading
|
Modify PropertyMetadata for correct overloading
|
C#
|
mit
|
emoacht/Monitorian
|
da5d641a9ec7306de0f8147650dc8cac29366b62
|
Assets/FullSerializer/Source/Converters/Unity/UnityEvent_Converter.cs
|
Assets/FullSerializer/Source/Converters/Unity/UnityEvent_Converter.cs
|
#if !NO_UNITY
using System;
using UnityEngine;
using UnityEngine.Events;
namespace FullSerializer {
partial class fsConverterRegistrar {
public static Internal.Converters.UnityEvent_Converter Register_UnityEvent_Converter;
}
}
namespace FullSerializer.Internal.Converters {
// The standard FS reflection converter has started causing Unity to crash when processing
// UnityEvent. We can send the serialization through JsonUtility which appears to work correctly
// instead.
//
// We have to support legacy serialization formats so importing works as expected.
public class UnityEvent_Converter : fsConverter {
public override bool CanProcess(Type type) {
return typeof(UnityEvent).Resolve().IsAssignableFrom(type) && type.IsGenericType == false;
}
public override bool RequestCycleSupport(Type storageType) {
return false;
}
public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) {
Type objectType = (Type)instance;
fsResult result = fsResult.Success;
instance = JsonUtility.FromJson(fsJsonPrinter.CompressedJson(data), objectType);
return result;
}
public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) {
fsResult result = fsResult.Success;
serialized = fsJsonParser.Parse(JsonUtility.ToJson(instance));
return result;
}
}
}
#endif
|
#if !NO_UNITY
using System;
using UnityEngine;
using UnityEngine.Events;
namespace FullSerializer {
partial class fsConverterRegistrar {
// Disable the converter for the time being. Unity's JsonUtility API cannot be called from
// within a C# ISerializationCallbackReceiver callback.
// public static Internal.Converters.UnityEvent_Converter Register_UnityEvent_Converter;
}
}
namespace FullSerializer.Internal.Converters {
// The standard FS reflection converter has started causing Unity to crash when processing
// UnityEvent. We can send the serialization through JsonUtility which appears to work correctly
// instead.
//
// We have to support legacy serialization formats so importing works as expected.
public class UnityEvent_Converter : fsConverter {
public override bool CanProcess(Type type) {
return typeof(UnityEvent).Resolve().IsAssignableFrom(type) && type.IsGenericType == false;
}
public override bool RequestCycleSupport(Type storageType) {
return false;
}
public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) {
Type objectType = (Type)instance;
fsResult result = fsResult.Success;
instance = JsonUtility.FromJson(fsJsonPrinter.CompressedJson(data), objectType);
return result;
}
public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) {
fsResult result = fsResult.Success;
serialized = fsJsonParser.Parse(JsonUtility.ToJson(instance));
return result;
}
}
}
#endif
|
Disable UnityEvent workaround since it is broken in Full Inspector
|
Disable UnityEvent workaround since it is broken in Full Inspector
|
C#
|
mit
|
jacobdufault/fullserializer,jacobdufault/fullserializer,jacobdufault/fullserializer
|
6896a68f2c177e8c9d052bab2e15830c539b757b
|
SurveyMonkey/Containers/Recipient.cs
|
SurveyMonkey/Containers/Recipient.cs
|
using System.Collections.Generic;
using Newtonsoft.Json;
using SurveyMonkey.Enums;
namespace SurveyMonkey.Containers
{
[JsonConverter(typeof(TolerantJsonConverter))]
public class Recipient : IPageableContainer
{
public long? Id { get; set; }
public long? SurveyId { get; set; }
internal string Href { get; set; }
public string Email { get; set; }
public RecipientSurveyResponseStatus? SurveyResponseStatus { get; set; }
public MessageStatus? MailStatus { get; set; }
public Dictionary<string, string> CustomFields { get; set; }
public string SurveyLink { get; set; }
public string RemoveLink { get; set; }
public Dictionary<string, string> ExtraFields { get; set; }
}
}
|
using System.Collections.Generic;
using Newtonsoft.Json;
using SurveyMonkey.Enums;
namespace SurveyMonkey.Containers
{
[JsonConverter(typeof(TolerantJsonConverter))]
public class Recipient : IPageableContainer
{
public long? Id { get; set; }
public long? SurveyId { get; set; }
internal string Href { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public RecipientSurveyResponseStatus? SurveyResponseStatus { get; set; }
public MessageStatus? MailStatus { get; set; }
public Dictionary<string, string> CustomFields { get; set; }
public string SurveyLink { get; set; }
public string RemoveLink { get; set; }
public Dictionary<string, string> ExtraFields { get; set; }
}
}
|
Include first & last names for recipients
|
Include first & last names for recipients
|
C#
|
mit
|
bcemmett/SurveyMonkeyApi-v3
|
5c1f87a719d3c06d0bef766bc57be3ffe03a6b13
|
DspAdpcm/DspAdpcm.Cli/DspAdpcmCli.cs
|
DspAdpcm/DspAdpcm.Cli/DspAdpcmCli.cs
|
using System;
using System.Diagnostics;
using System.IO;
using DspAdpcm.Encode.Adpcm;
using DspAdpcm.Encode.Adpcm.Formats;
using DspAdpcm.Encode.Pcm;
using DspAdpcm.Encode.Pcm.Formats;
namespace DspAdpcm.Cli
{
public static class DspAdpcmCli
{
public static int Main(string[] args)
{
if (args.Length < 2)
{
Console.WriteLine("Usage: dspenc <wavin> <dspout>\n");
return 0;
}
IPcmStream wave;
try
{
using (var file = new FileStream(args[0], FileMode.Open))
{
wave = new Wave(file).AudioStream;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return -1;
}
Stopwatch watch = new Stopwatch();
watch.Start();
IAdpcmStream adpcm = Encode.Adpcm.Encode.PcmToAdpcm(wave);
watch.Stop();
Console.WriteLine($"DONE! {adpcm.NumSamples} samples processed\n");
Console.WriteLine($"Time elapsed: {watch.Elapsed.TotalSeconds}");
Console.WriteLine($"Processed {(adpcm.NumSamples / watch.Elapsed.TotalMilliseconds):N} samples per milisecond.");
var dsp = new Dsp(adpcm);
using (var stream = File.Open(args[1], FileMode.Create))
foreach (var b in dsp.GetFile())
stream.WriteByte(b);
return 0;
}
}
}
|
using System;
using System.Diagnostics;
using System.IO;
using DspAdpcm.Encode.Adpcm;
using DspAdpcm.Encode.Adpcm.Formats;
using DspAdpcm.Encode.Pcm;
using DspAdpcm.Encode.Pcm.Formats;
namespace DspAdpcm.Cli
{
public static class DspAdpcmCli
{
public static int Main(string[] args)
{
if (args.Length < 2)
{
Console.WriteLine("Usage: dspadpcm <wavIn> <brstmOut>\n");
return 0;
}
IPcmStream wave;
try
{
using (var file = new FileStream(args[0], FileMode.Open))
{
wave = new Wave(file).AudioStream;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return -1;
}
Stopwatch watch = new Stopwatch();
watch.Start();
IAdpcmStream adpcm = Encode.Adpcm.Encode.PcmToAdpcmParallel(wave);
watch.Stop();
Console.WriteLine($"DONE! {adpcm.NumSamples} samples processed\n");
Console.WriteLine($"Time elapsed: {watch.Elapsed.TotalSeconds}");
Console.WriteLine($"Processed {(adpcm.NumSamples / watch.Elapsed.TotalMilliseconds):N} samples per milisecond.");
var brstm = new Brstm(adpcm);
using (var stream = File.Open(args[1], FileMode.Create))
foreach (var b in brstm.GetFile())
stream.WriteByte(b);
return 0;
}
}
}
|
Make brstm instead of dsp. Encode adpcm channels in parallel
|
CLI: Make brstm instead of dsp. Encode adpcm channels in parallel
|
C#
|
mit
|
Thealexbarney/VGAudio,Thealexbarney/VGAudio,Thealexbarney/LibDspAdpcm,Thealexbarney/LibDspAdpcm
|
aaa0c4fe7da73944a8b7d9e862ba458f14880227
|
SkypeSharp/Chat.cs
|
SkypeSharp/Chat.cs
|
using System.Collections.Generic;
using System.Linq;
namespace SkypeSharp {
/// <summary>
/// Class representing a Skype CHAT object
/// </summary>
public class Chat : SkypeObject {
/// <summary>
/// List of users in this chat
/// </summary>
public IEnumerable<User> Users {
get {
string[] usernames = GetProperty("MEMBERS").Split(' ');
return usernames.Select(u => new User(Skype, u));
}
}
/// <summary>
/// List of chatmembers, useful for changing roles
/// Skype broke this so it probably doesn't work
/// </summary>
public IEnumerable<ChatMember> ChatMembers {
get {
string[] members = GetProperty("MEMBEROBJECTS").Split(' ');
return members.Select(m => new ChatMember(Skype, m));
}
}
public Chat(Skype skype, string id) : base(skype, id, "CHAT") {}
/// <summary>
/// Send a message to this chat
/// </summary>
/// <param name="text">Text to send</param>
public void Send(string text) {
Skype.Send("CHATMESSAGE " + ID + " " + text);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace SkypeSharp {
/// <summary>
/// Class representing a Skype CHAT object
/// </summary>
public class Chat : SkypeObject {
/// <summary>
/// List of users in this chat
/// </summary>
public IEnumerable<User> Users {
get {
string[] usernames = GetProperty("MEMBERS").Split(' ');
return usernames.Select(u => new User(Skype, u));
}
}
/// <summary>
/// List of chatmembers, useful for changing roles
/// Skype broke this so it probably doesn't work
/// </summary>
public IEnumerable<ChatMember> ChatMembers {
get {
string[] members = GetProperty("MEMBEROBJECTS").Split(' ');
return members.Select(m => new ChatMember(Skype, m));
}
}
public Chat(Skype skype, string id) : base(skype, id, "CHAT") {}
/// <summary>
/// Send a message to this chat
/// </summary>
/// <param name="text">Text to send</param>
public void Send(string text) {
Skype.Send("CHATMESSAGE " + ID + " " + text);
}
/// <summary>
/// Uses xdotool to attempt to send skype a message
/// </summary>
/// <param name="text"></param>
public void SendRaw(string text) {
Skype.Send("OPEN CHAT " + ID);
Process p = new Process();
p.StartInfo.FileName = "/usr/bin/xdotool";
p.StartInfo.Arguments = String.Format("search --name skype type \"{0}\"", text.Replace("\"", "\\\""));
p.Start();
p.WaitForExit();
p.StartInfo.Arguments = "search --name skype key ctrl+shift+Return";
p.Start();
p.WaitForExit();
}
}
}
|
Add raw message sending, requires xdotool
|
Add raw message sending, requires xdotool
|
C#
|
mit
|
Goz3rr/SkypeSharp
|
3b3f4c5fb0218cbd14c2fe523c8a4903613fb93b
|
SeleniumExtension/SauceLabs/SauceDriverKeys.cs
|
SeleniumExtension/SauceLabs/SauceDriverKeys.cs
|
using System;
namespace SeleniumExtension.SauceLabs
{
public class SauceDriverKeys
{
public static string SAUCELABS_USERNAME
{
get
{
var userName = Environment.GetEnvironmentVariable("SAUCELABS_USERNAME", EnvironmentVariableTarget.User);
if(string.IsNullOrEmpty(userName))
throw new Exception("Missing environment variable, name: SAUCELABS_USERNAME");
return userName;
}
}
public static string SAUCELABS_ACCESSKEY
{
get
{
var userName = Environment.GetEnvironmentVariable("SAUCELABS_ACCESSKEY", EnvironmentVariableTarget.User);
if (string.IsNullOrEmpty(userName))
throw new Exception("Missing environment variable, name: SAUCELABS_ACCESSKEY");
return userName;
}
}
}
}
|
using System;
namespace SeleniumExtension.SauceLabs
{
public class SauceDriverKeys
{
public static string SAUCELABS_USERNAME
{
get
{
var userName = Environment.GetEnvironmentVariable("SAUCELABS_USERNAME");
if(string.IsNullOrEmpty(userName))
throw new Exception("Missing environment variable, name: SAUCELABS_USERNAME");
return userName;
}
}
public static string SAUCELABS_ACCESSKEY
{
get
{
var userName = Environment.GetEnvironmentVariable("SAUCELABS_ACCESSKEY");
if (string.IsNullOrEmpty(userName))
throw new Exception("Missing environment variable, name: SAUCELABS_ACCESSKEY");
return userName;
}
}
}
}
|
Change the target to get working on build server
|
Change the target to get working on build server
|
C#
|
mit
|
rcasady616/Selenium.WeDriver.Equip,rcasady616/Selenium.WeDriver.Equip
|
3fa0c5723a64ce6ec994b48a1cd375103eea6b18
|
src/Metrics.Integrations.Linters.Cli/LogManager.cs
|
src/Metrics.Integrations.Linters.Cli/LogManager.cs
|
namespace Metrics.Integrations.Linters
{
using System;
using System.IO;
using System.Text;
// TODO: Improve logging.
public class LogManager : IDisposable
{
public StringBuilder LogWriter { get; }
private bool saved = false;
public LogManager()
{
LogWriter = new StringBuilder();
}
public void Log(string format, params object[] args)
{
LogWriter.AppendLine(string.Format(format, args));
}
public void Trace(string message, params object[] args)
{
Log("TRACE: " + message + " {0}", string.Join(" ", args));
}
public void Error(string message, params object[] args)
{
Log("ERROR: " + message + " {0}", string.Join(" ", args));
System.Console.Error.WriteLine(string.Format(message + " {0}", string.Join(" ", args)));
}
public void Save(string fileName)
{
saved = true;
File.WriteAllText(fileName, LogWriter.ToString());
}
public void Dispose()
{
if (!saved)
{
System.Console.Write(LogWriter.ToString());
}
}
}
}
|
namespace Metrics.Integrations.Linters
{
using System;
using System.IO;
using System.Text;
// TODO: Improve logging.
public class LogManager : IDisposable
{
public StringBuilder LogWriter { get; }
private bool saved = false;
private bool error = false;
public LogManager()
{
LogWriter = new StringBuilder();
}
public void Log(string format, params object[] args)
{
LogWriter.AppendLine(string.Format(format, args));
}
public void Trace(string message, params object[] args)
{
Log("TRACE: " + message + " {0}", string.Join(" ", args));
}
public void Error(string message, params object[] args)
{
error = true;
Log("ERROR: " + message + " {0}", string.Join(" ", args));
System.Console.Error.WriteLine(string.Format(message + " {0}", string.Join(" ", args)));
}
public void Save(string fileName)
{
saved = true;
File.WriteAllText(fileName, LogWriter.ToString());
}
public void Dispose()
{
if (!saved && error)
{
System.Console.Write(LogWriter.ToString());
}
}
}
}
|
Write logs to console only in case of error
|
Write logs to console only in case of error
|
C#
|
mit
|
repometric/linterhub-cli,repometric/linterhub-cli,binore/linterhub-cli,repometric/linterhub-cli,binore/linterhub-cli,binore/linterhub-cli
|
824ab3196e49d657d3185e3c65e838af0fbf01f5
|
KAGTools/Helpers/ApiHelper.cs
|
KAGTools/Helpers/ApiHelper.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using KAGTools.Data;
using Newtonsoft.Json;
namespace KAGTools.Helpers
{
public static class ApiHelper
{
private const string UrlPlayer = "https://api.kag2d.com/v1/player/{0}";
private const string UrlServers = "https://api.kag2d.com/v1/game/thd/kag/servers";
private static readonly HttpClient httpClient;
static ApiHelper()
{
httpClient = new HttpClient();
}
public static async Task<ApiPlayerResults> GetPlayer(string username)
{
return await HttpGetApiResult<ApiPlayerResults>(string.Format(UrlPlayer, username));
}
public static async Task<ApiServerResults> GetServers(params ApiFilter[] filters)
{
string filterJson = "?filters=" + JsonConvert.SerializeObject(filters);
return await HttpGetApiResult<ApiServerResults>(UrlServers + filterJson);
}
private static async Task<T> HttpGetApiResult<T>(string requestUri) where T : class
{
try
{
string data = await httpClient.GetStringAsync(requestUri);
return data != null ? JsonConvert.DeserializeObject<T>(data) : null;
}
catch (HttpRequestException e)
{
MessageBox.Show(e.Message, "HTTP Request Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
return null;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using KAGTools.Data;
using Newtonsoft.Json;
namespace KAGTools.Helpers
{
public static class ApiHelper
{
private const string UrlPlayer = "https://api.kag2d.com/v1/player/{0}";
private const string UrlServers = "https://api.kag2d.com/v1/game/thd/kag/servers";
private static readonly HttpClient httpClient;
static ApiHelper()
{
httpClient = new HttpClient();
}
public static async Task<ApiPlayerResults> GetPlayer(string username)
{
return await HttpGetApiResult<ApiPlayerResults>(string.Format(UrlPlayer, username));
}
public static async Task<ApiServerResults> GetServers(params ApiFilter[] filters)
{
string filterJson = "?filters=" + JsonConvert.SerializeObject(filters);
return await HttpGetApiResult<ApiServerResults>(UrlServers + filterJson);
}
private static async Task<T> HttpGetApiResult<T>(string requestUri) where T : class
{
try
{
string data = await httpClient.GetStringAsync(requestUri);
return data != null ? JsonConvert.DeserializeObject<T>(data) : null;
}
catch (HttpRequestException e)
{
MessageBox.Show(string.Format("{0}{2}{2}Request URL: {1}", e.Message, requestUri, Environment.NewLine), "HTTP Request Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
return null;
}
}
}
|
Include request URL in HTTP error message
|
Include request URL in HTTP error message
|
C#
|
mit
|
CalebChalmers/KAGTools
|
26dda4aa0650a17ff0cd7b8f1a70cf9a5e66cb0c
|
gtksharp_clock/Program.cs
|
gtksharp_clock/Program.cs
|
using System;
using Gtk;
namespace gtksharp_clock
{
class MainClass
{
public static void Main(string[] args)
{
Application.Init();
MainWindow win = new MainWindow();
win.Show();
Application.Run();
}
}
}
|
using System;
using Gtk;
// http://www.mono-project.com/docs/gui/gtksharp/widgets/widget-colours/
namespace gtksharp_clock
{
class MainClass
{
public static void Main(string[] args)
{
Application.Init();
ClockWindow win = new ClockWindow ();
win.Show();
Application.Run();
}
}
class ClockWindow : Window
{
public ClockWindow() : base("ClockWindow")
{
SetDefaultSize(250, 200);
SetPosition(WindowPosition.Center);
ClockFace cf = new ClockFace();
Gdk.Color black = new Gdk.Color();
Gdk.Color.Parse("black", ref black);
Gdk.Color grey = new Gdk.Color();
Gdk.Color.Parse("grey", ref grey);
this.ModifyBg(StateType.Normal, grey);
cf.ModifyBg(StateType.Normal, grey);
this.ModifyFg(StateType.Normal, black);
cf.ModifyFg(StateType.Normal, black);
this.DeleteEvent += DeleteWindow;
Add(cf);
ShowAll();
}
static void DeleteWindow(object obj, DeleteEventArgs args)
{
Application.Quit();
}
}
class ClockFace : DrawingArea
{
public ClockFace() : base()
{
this.SetSizeRequest(600, 600);
this.ExposeEvent += OnExposed;
}
public void OnExposed(object o, ExposeEventArgs args)
{
Gdk.Color black = new Gdk.Color();
Gdk.Color.Parse("black", ref black);
this.ModifyFg(StateType.Normal, black);
this.GdkWindow.DrawLine(this.Style.BaseGC(StateType.Normal), 0, 0, 400, 300);
}
}
}
|
Add clock Face and Window classes. Draw a line. Setting FG color is TODO.
|
Add clock Face and Window classes. Draw a line. Setting FG color is TODO.
|
C#
|
mit
|
clicketyclack/gtksharp_clock
|
576548773f3372fcfaee69c9e8238ace66da276c
|
Enumerable.cs
|
Enumerable.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace RabidWarren.Collections.Generic
{
public static class Enumerable
{
public static Multimap<TKey, TElement> ToMultimap<TSource, TKey, TElement>(
this IEnumerable<TSource> source,
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector)
{
var map = new Multimap<TKey, TElement>();
foreach (var entry in source)
{
map.Add(keySelector(entry), elementSelector(entry));
}
return map;
}
}
}
|
// -----------------------------------------------------------------------
// <copyright file="Enumerable.cs" company="Ron Parker">
// Copyright 2014 Ron Parker
// </copyright>
// <summary>
// Provides an extension method for converting IEnumerables to Multimaps.
// </summary>
// -----------------------------------------------------------------------
namespace RabidWarren.Collections.Generic
{
using System;
using System.Collections.Generic;
/// <summary>
/// Contains extension methods for <see cref="System.Collections.Generic.IEnumerable{TSource}"/>.
/// </summary>
public static class Enumerable
{
/// <summary>
/// Converts the source to an <see cref="RabidWarren.Collections.Generic.Multimap{TSource, TKey, TValue}"/>.
/// </summary>
/// <returns>The <see cref="RabidWarren.Collections.Generic.Multimap{TSource, TKey, TValue}"/>.</returns>
/// <param name="source">The source.</param>
/// <param name="keySelector">The key selector.</param>
/// <param name="valueSelector">The value selector.</param>
/// <typeparam name="TSource">The source type.</typeparam>
/// <typeparam name="TKey">The key type.</typeparam>
/// <typeparam name="TValue">The the value type.</typeparam>
public static Multimap<TKey, TValue> ToMultimap<TSource, TKey, TValue>(
this IEnumerable<TSource> source,
Func<TSource, TKey> keySelector,
Func<TSource, TValue> valueSelector)
{
var map = new Multimap<TKey, TValue>();
foreach (var entry in source)
{
map.Add(keySelector(entry), valueSelector(entry));
}
return map;
}
}
}
|
Document and clean up the binding code
|
Document and clean up the binding code
|
C#
|
mit
|
rdparker/RabidWarren.Collections
|
5b86faaaa273e1c6270401265e2c957f31589e13
|
VotingApplication/VotingApplication.Web/Views/Poll/Index.cshtml
|
VotingApplication/VotingApplication.Web/Views/Poll/Index.cshtml
|
<!DOCTYPE html>
<html ng-app="VoteOn-Poll">
<head>
<title>Vote On</title>
<meta name="viewport" content="initial-scale=1">
@Styles.Render("~/Bundles/StyleLib/AngularMaterial")
@Styles.Render("~/Bundles/StyleLib/FontAwesome")
@Styles.Render("~/Bundles/VotingStyle")
</head>
<body>
<div layout="column" flex layout-fill>
<toolbar></toolbar>
<div ng-view></div>
</div>
@Scripts.Render("~/Bundles/ScriptLib/JQuery");
@Scripts.Render("~/Bundles/ScriptLib/JQuerySignalR");
@Scripts.Render("~/Bundles/ScriptLib/Angular")
@Scripts.Render("~/Bundles/ScriptLib/AngularAnimate")
@Scripts.Render("~/Bundles/ScriptLib/AngularAria")
@Scripts.Render("~/Bundles/ScriptLib/AngularMaterial")
@Scripts.Render("~/Bundles/ScriptLib/AngularMessages")
@Scripts.Render("~/Bundles/ScriptLib/AngularRoute")
@Scripts.Render("~/Bundles/ScriptLib/AngularCharts")
@Scripts.Render("~/Bundles/ScriptLib/AngularSignalR")
@Scripts.Render("~/Bundles/ScriptLib/ngStorage")
@Scripts.Render("~/Bundles/ScriptLib/moment")
@Scripts.Render("~/Bundles/Script")
</body>
</html>
|
<!DOCTYPE html>
<html ng-app="VoteOn-Poll">
<head>
<title>Vote On</title>
<meta name="viewport" content="initial-scale=1">
@Styles.Render("~/Bundles/StyleLib/AngularMaterial")
@Styles.Render("~/Bundles/StyleLib/FontAwesome")
@Styles.Render("~/Bundles/VotingStyle")
</head>
<body>
<div layout="column" flex layout-fill>
<toolbar></toolbar>
<div ng-view></div>
</div>
@Scripts.Render("~/Bundles/ScriptLib/JQuery")
@Scripts.Render("~/Bundles/ScriptLib/JQuerySignalR")
@Scripts.Render("~/Bundles/ScriptLib/Angular")
@Scripts.Render("~/Bundles/ScriptLib/AngularAnimate")
@Scripts.Render("~/Bundles/ScriptLib/AngularAria")
@Scripts.Render("~/Bundles/ScriptLib/AngularMaterial")
@Scripts.Render("~/Bundles/ScriptLib/AngularMessages")
@Scripts.Render("~/Bundles/ScriptLib/AngularRoute")
@Scripts.Render("~/Bundles/ScriptLib/AngularCharts")
@Scripts.Render("~/Bundles/ScriptLib/AngularSignalR")
@Scripts.Render("~/Bundles/ScriptLib/ngStorage")
@Scripts.Render("~/Bundles/ScriptLib/moment")
@Scripts.Render("~/Bundles/Script")
</body>
</html>
|
Remove semicolons from poll page
|
Remove semicolons from poll page
|
C#
|
apache-2.0
|
stevenhillcox/voting-application,tpkelly/voting-application,stevenhillcox/voting-application,tpkelly/voting-application,stevenhillcox/voting-application,Generic-Voting-Application/voting-application,Generic-Voting-Application/voting-application,JDawes-ScottLogic/voting-application,JDawes-ScottLogic/voting-application,tpkelly/voting-application,JDawes-ScottLogic/voting-application,Generic-Voting-Application/voting-application
|
1a474592625ccc97b47b11bdb953dcdbf3fdd8a9
|
osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.cs
|
osu.Game.Rulesets.Taiko/Mods/TaikoModDifficultyAdjust.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.Linq;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Taiko.Mods
{
public class TaikoModDifficultyAdjust : ModDifficultyAdjust
{
[SettingSource("Scroll Speed", "Adjust a beatmap's set scroll speed", LAST_SETTING_ORDER + 1, SettingControlType = typeof(DifficultyAdjustSettingsControl))]
public DifficultyBindable ScrollSpeed { get; } = new DifficultyBindable
{
Precision = 0.05f,
MinValue = 0.25f,
MaxValue = 4,
ReadCurrentFromDifficulty = _ => 1,
};
public override string SettingDescription
{
get
{
string scrollSpeed = ScrollSpeed.IsDefault ? string.Empty : $"Scroll x{ScrollSpeed.Value:N1}";
return string.Join(", ", new[]
{
base.SettingDescription,
scrollSpeed
}.Where(s => !string.IsNullOrEmpty(s)));
}
}
protected override void ApplySettings(BeatmapDifficulty difficulty)
{
base.ApplySettings(difficulty);
if (ScrollSpeed.Value != null) difficulty.SliderMultiplier *= ScrollSpeed.Value.Value;
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Taiko.Mods
{
public class TaikoModDifficultyAdjust : ModDifficultyAdjust
{
[SettingSource("Scroll Speed", "Adjust a beatmap's set scroll speed", LAST_SETTING_ORDER + 1, SettingControlType = typeof(DifficultyAdjustSettingsControl))]
public DifficultyBindable ScrollSpeed { get; } = new DifficultyBindable
{
Precision = 0.05f,
MinValue = 0.25f,
MaxValue = 4,
ReadCurrentFromDifficulty = _ => 1,
};
public override string SettingDescription
{
get
{
string scrollSpeed = ScrollSpeed.IsDefault ? string.Empty : $"Scroll x{ScrollSpeed.Value:N2}";
return string.Join(", ", new[]
{
base.SettingDescription,
scrollSpeed
}.Where(s => !string.IsNullOrEmpty(s)));
}
}
protected override void ApplySettings(BeatmapDifficulty difficulty)
{
base.ApplySettings(difficulty);
if (ScrollSpeed.Value != null) difficulty.SliderMultiplier *= ScrollSpeed.Value.Value;
}
}
}
|
Fix taiko difficulty adjust scroll speed being shown with too low precision
|
Fix taiko difficulty adjust scroll speed being shown with too low precision
|
C#
|
mit
|
ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu
|
a7bcae48694a1ead3949cedcf866c59d3b77d751
|
osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs
|
osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Timing;
using osu.Framework.Configuration;
namespace osu.Game.Screens.Play.ReplaySettings
{
public class PlaybackSettings : ReplayGroup
{
protected override string Title => @"playback";
public IAdjustableClock AdjustableClock { set; get; }
private readonly ReplaySliderBar<double> sliderbar;
public PlaybackSettings()
{
Child = sliderbar = new ReplaySliderBar<double>
{
LabelText = "Playback speed",
Bindable = new BindableDouble
{
Default = 1,
MinValue = 0.5,
MaxValue = 2
},
};
}
protected override void LoadComplete()
{
base.LoadComplete();
if (AdjustableClock == null)
return;
var clockRate = AdjustableClock.Rate;
sliderbar.Bindable.ValueChanged += rateMultiplier => AdjustableClock.Rate = clockRate * rateMultiplier;
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Timing;
using osu.Framework.Configuration;
namespace osu.Game.Screens.Play.ReplaySettings
{
public class PlaybackSettings : ReplayGroup
{
protected override string Title => @"playback";
public IAdjustableClock AdjustableClock { set; get; }
private readonly ReplaySliderBar<double> sliderbar;
public PlaybackSettings()
{
Child = sliderbar = new ReplaySliderBar<double>
{
LabelText = "Playback speed",
Bindable = new BindableDouble(1)
{
Default = 1,
MinValue = 0.5,
MaxValue = 2
},
};
}
protected override void LoadComplete()
{
base.LoadComplete();
if (AdjustableClock == null)
return;
var clockRate = AdjustableClock.Rate;
sliderbar.Bindable.ValueChanged += rateMultiplier => AdjustableClock.Rate = clockRate * rateMultiplier;
}
}
}
|
Add startup value for the slider
|
Add startup value for the slider
|
C#
|
mit
|
peppy/osu,DrabWeb/osu,peppy/osu,naoey/osu,ZLima12/osu,ppy/osu,EVAST9919/osu,Nabile-Rahmani/osu,johnneijzen/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,DrabWeb/osu,smoogipoo/osu,ppy/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu-new,naoey/osu,2yangk23/osu,UselessToucan/osu,Frontear/osuKyzer,ZLima12/osu,EVAST9919/osu,NeoAdonis/osu,johnneijzen/osu,Drezi126/osu,ppy/osu,DrabWeb/osu,UselessToucan/osu,naoey/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu
|
e96dd7982334b22c12e2eec2e3ca08bd48e1fd5c
|
src/Stripe.net/Entities/StripeStatusTransitions.cs
|
src/Stripe.net/Entities/StripeStatusTransitions.cs
|
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;
namespace Stripe
{
public class StripeStatusTransitions : StripeEntity
{
[JsonConverter(typeof(StripeDateTimeConverter))]
[JsonProperty("canceled")]
public DateTime? Canceled { get; set; }
[JsonConverter(typeof(StripeDateTimeConverter))]
[JsonProperty("fulfiled")]
public DateTime? Fulfilled { get; set; }
[JsonConverter(typeof(StripeDateTimeConverter))]
[JsonProperty("paid")]
public DateTime? Paid { get; set; }
[JsonConverter(typeof(StripeDateTimeConverter))]
[JsonProperty("returned")]
public DateTime? Returned { get; set; }
}
}
|
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;
namespace Stripe
{
public class StripeStatusTransitions : StripeEntity
{
[JsonConverter(typeof(StripeDateTimeConverter))]
[JsonProperty("canceled")]
public DateTime? Canceled { get; set; }
[JsonConverter(typeof(StripeDateTimeConverter))]
[JsonProperty("fulfiled")]
public DateTime? Fulfiled { get; set; }
[JsonConverter(typeof(StripeDateTimeConverter))]
[JsonProperty("paid")]
public DateTime? Paid { get; set; }
[JsonConverter(typeof(StripeDateTimeConverter))]
[JsonProperty("returned")]
public DateTime? Returned { get; set; }
}
}
|
Change name of the property for the status transition to match the API too
|
Change name of the property for the status transition to match the API too
|
C#
|
apache-2.0
|
richardlawley/stripe.net,stripe/stripe-dotnet
|
641656b2e3717f830439bd7eb41157efc410a8c6
|
src/Daterpillar.Core/TextTransformation/ScriptBuilderFactory.cs
|
src/Daterpillar.Core/TextTransformation/ScriptBuilderFactory.cs
|
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Acklann.Daterpillar.TextTransformation
{
public class ScriptBuilderFactory
{
public ScriptBuilderFactory()
{
LoadAssemblyTypes();
}
public IScriptBuilder CreateInstance(string name)
{
try { return (IScriptBuilder)Activator.CreateInstance(Type.GetType(_scriptBuilderTypes[name.ToLower()])); }
catch (KeyNotFoundException) { return new NullScriptBuilder(); }
}
public IScriptBuilder CreateInstance(ConnectionType connectionType)
{
return CreateInstance(string.Concat(connectionType, _targetInterface));
}
#region Private Members
private string _targetInterface = nameof(IScriptBuilder).Substring(1);
private IDictionary<string, string> _scriptBuilderTypes = new Dictionary<string, string>();
private void LoadAssemblyTypes()
{
Assembly thisAssembly = Assembly.Load(new AssemblyName(typeof(IScriptBuilder).GetTypeInfo().Assembly.FullName));
foreach (var typeInfo in thisAssembly.DefinedTypes)
if (typeInfo.IsPublic && !typeInfo.IsInterface && !typeInfo.IsAbstract && typeof(IScriptBuilder).GetTypeInfo().IsAssignableFrom(typeInfo))
{
_scriptBuilderTypes.Add(typeInfo.Name.ToLower(), typeInfo.FullName);
}
}
#endregion Private Members
}
}
|
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Acklann.Daterpillar.TextTransformation
{
public class ScriptBuilderFactory
{
public ScriptBuilderFactory()
{
LoadAssemblyTypes();
}
public IScriptBuilder CreateInstance(string name)
{
return CreateInstance(name, ScriptBuilderSettings.Default);
}
public IScriptBuilder CreateInstance(string name, ScriptBuilderSettings settings)
{
try { return (IScriptBuilder)Activator.CreateInstance(Type.GetType(_scriptBuilderTypes[name.ToLower()]), settings); }
catch (KeyNotFoundException) { return new NullScriptBuilder(); }
}
public IScriptBuilder CreateInstance(ConnectionType connectionType)
{
return CreateInstance(string.Concat(connectionType, _targetInterface), ScriptBuilderSettings.Default);
}
public IScriptBuilder CreateInstance(ConnectionType connectionType, ScriptBuilderSettings settings)
{
return CreateInstance(string.Concat(connectionType, _targetInterface), settings);
}
#region Private Members
private string _targetInterface = nameof(IScriptBuilder).Substring(1);
private IDictionary<string, string> _scriptBuilderTypes = new Dictionary<string, string>();
private void LoadAssemblyTypes()
{
Assembly thisAssembly = Assembly.Load(new AssemblyName(typeof(IScriptBuilder).GetTypeInfo().Assembly.FullName));
foreach (var typeInfo in thisAssembly.DefinedTypes)
if (typeInfo.IsPublic && !typeInfo.IsInterface && !typeInfo.IsAbstract && typeof(IScriptBuilder).GetTypeInfo().IsAssignableFrom(typeInfo))
{
_scriptBuilderTypes.Add(typeInfo.Name.ToLower(), typeInfo.FullName);
}
}
#endregion Private Members
}
}
|
Add new createInstance overloads to scriptbuilderfactory.cs to support scriptbuildersettings args
|
Add new createInstance overloads to scriptbuilderfactory.cs to support scriptbuildersettings args
|
C#
|
mit
|
Ackara/Daterpillar
|
a23f8baf25f006956fc66bdcbc9515644450abd4
|
source/CroquetAustralia.WebApi/Controllers/TournamentEntryController.cs
|
source/CroquetAustralia.WebApi/Controllers/TournamentEntryController.cs
|
using System.Threading.Tasks;
using System.Web.Http;
using CroquetAustralia.Domain.Features.TournamentEntry.Commands;
using CroquetAustralia.Domain.Features.TournamentEntry.Events;
using CroquetAustralia.Domain.Services.Queues;
namespace CroquetAustralia.WebApi.Controllers
{
[RoutePrefix("tournament-entry")]
public class TournamentEntryController : ApiController
{
private readonly IEventsQueue _eventsQueue;
public TournamentEntryController(IEventsQueue eventsQueue)
{
_eventsQueue = eventsQueue;
}
[HttpPost]
[Route("add-entry")]
public async Task AddEntryAsync(SubmitEntry command)
{
var entrySubmitted = command.ToEntrySubmitted();
await _eventsQueue.AddMessageAsync(entrySubmitted);
}
[HttpPost]
[Route("payment-received")]
public async Task PaymentReceivedAsync(ReceivePayment command)
{
// todo: extension method command.MapTo<EntrySubmitted>
var @event = new PaymentReceived(command.EntityId, command.PaymentMethod);
await _eventsQueue.AddMessageAsync(@event);
}
}
}
|
using System;
using System.Threading.Tasks;
using System.Web.Http;
using CroquetAustralia.Domain.Features.TournamentEntry;
using CroquetAustralia.Domain.Features.TournamentEntry.Commands;
using CroquetAustralia.Domain.Features.TournamentEntry.Events;
using CroquetAustralia.Domain.Services.Queues;
namespace CroquetAustralia.WebApi.Controllers
{
[RoutePrefix("tournament-entry")]
public class TournamentEntryController : ApiController
{
private readonly IEventsQueue _eventsQueue;
public TournamentEntryController(IEventsQueue eventsQueue)
{
_eventsQueue = eventsQueue;
}
[HttpPost]
[Route("add-entry")]
public async Task AddEntryAsync(SubmitEntry command)
{
// todo: allow javascript to send null
if (command.PaymentMethod.HasValue && (int)command.PaymentMethod.Value == -1)
{
command.PaymentMethod = null;
}
var entrySubmitted = command.ToEntrySubmitted();
await _eventsQueue.AddMessageAsync(entrySubmitted);
}
[HttpPost]
[Route("payment-received")]
public async Task PaymentReceivedAsync(ReceivePayment command)
{
// todo: extension method command.MapTo<EntrySubmitted>
var @event = new PaymentReceived(command.EntityId, command.PaymentMethod);
await _eventsQueue.AddMessageAsync(@event);
}
}
}
|
Fix EOI emails are not sent
|
Fix EOI emails are not sent
|
C#
|
mit
|
croquet-australia/api.croquet-australia.com.au
|
9733593f3eba2c700fc83312c5829a3b256779b1
|
DevelopmentInProgress.DipState/DipStateType.cs
|
DevelopmentInProgress.DipState/DipStateType.cs
|
using System.Xml.Serialization;
namespace DevelopmentInProgress.DipState
{
public enum DipStateType
{
[XmlEnum("1")]
Standard = 1,
[XmlEnum("2")]
Auto = 3
}
}
|
using System.Xml.Serialization;
namespace DevelopmentInProgress.DipState
{
public enum DipStateType
{
[XmlEnum("1")]
Standard = 1,
[XmlEnum("2")]
Auto = 2,
[XmlEnum("3")]
Root = 3
}
}
|
Add a root state type
|
Add a root state type
Add a root state type
|
C#
|
apache-2.0
|
grantcolley/dipstate
|
08ebe7b55b3e0b60ceed0f3f25084b43d0f1e2af
|
test/Sitecore.FakeDb.Serialization.Tests/Deserialize/DeserializeTree.cs
|
test/Sitecore.FakeDb.Serialization.Tests/Deserialize/DeserializeTree.cs
|
namespace Sitecore.FakeDb.Serialization.Tests.Deserialize
{
using System.Linq;
using Xunit;
[Trait("Deserialize", "Deserializing a tree of items")]
public class DeserializeTree : DeserializeTestBase
{
public DeserializeTree()
{
this.Db.Add(new DsDbItem(SerializationId.SampleTemplateFolder, true)
{
ParentID = TemplateIDs.TemplateFolder
});
}
[Fact(DisplayName = "Deserializes templates in tree")]
public void DeserializesTemplates()
{
Assert.NotNull(this.Db.Database.GetTemplate(SerializationId.SampleItemTemplate));
}
[Fact(DisplayName = "Deserializes items in tree")]
public void DeserializesItems()
{
var nonTemplateItemCount =
this.Db.Database.GetItem(TemplateIDs.TemplateFolder)
.Axes.GetDescendants()
.Count(x =>
x.TemplateID != TemplateIDs.Template &&
x.TemplateID != TemplateIDs.TemplateSection &&
x.TemplateID != TemplateIDs.TemplateField);
Assert.Equal(5, nonTemplateItemCount);
}
}
}
|
namespace Sitecore.FakeDb.Serialization.Tests.Deserialize
{
using System.Linq;
using Xunit;
[Trait("Deserialize", "Deserializing a tree of items")]
public class DeserializeTree : DeserializeTestBase
{
public DeserializeTree()
{
this.Db.Add(new DsDbItem(SerializationId.SampleTemplateFolder, true)
{
ParentID = TemplateIDs.TemplateFolder
});
}
[Fact(DisplayName = "Deserializes templates in tree")]
public void DeserializesTemplates()
{
Assert.NotNull(this.Db.Database.GetTemplate(SerializationId.SampleItemTemplate));
}
[Fact(DisplayName = "Deserializes items in tree")]
public void DeserializesItems()
{
var nonTemplateItemCount =
this.Db.Database.GetItem(ItemIDs.TemplateRoot)
.Axes.GetDescendants()
.Count(x =>
x.TemplateID != TemplateIDs.Template &&
x.TemplateID != TemplateIDs.TemplateSection &&
x.TemplateID != TemplateIDs.TemplateField);
Assert.Equal(5, nonTemplateItemCount);
}
}
}
|
Fix broken tests getting items from the valid root
|
Fix broken tests getting items from the valid root
|
C#
|
mit
|
pveller/Sitecore.FakeDb,sergeyshushlyapin/Sitecore.FakeDb
|
1c853a5f501506d98b51a6fd5189cdfa60e8fa56
|
PluginLoader.Tests/Plugins_Tests.cs
|
PluginLoader.Tests/Plugins_Tests.cs
|
using PluginContracts;
using System;
using System.Collections.Generic;
using Xunit;
namespace PluginLoader.Tests
{
public class Plugins_Tests
{
[Fact]
public void PluginsFoundFromLibsFolder()
{
// Arrange
var path = @"..\..\..\..\LAN\bin\Debug\netstandard1.3";
// Act
var plugins = Plugins<IPluginV1>.Load(path);
// Assert
Assert.NotEmpty(plugins);
}
[Fact]
public void PluginsNotFoundFromCurrentFolder()
{
// Arrange
var path = @".";
// Act
var plugins = Plugins<IPluginV1>.Load(path);
// Assert
Assert.Empty(plugins);
}
}
}
|
using PluginContracts;
using System;
using System.Collections.Generic;
using Xunit;
namespace PluginLoader.Tests
{
public class Plugins_Tests
{
[Fact]
public void PluginsFoundFromLibsFolder()
{
// Arrange
var path = @"..\..\..\..\Libs";
// Act
var plugins = Plugins<IPluginV1>.Load(path);
// Assert
Assert.NotEmpty(plugins);
}
[Fact]
public void PluginsNotFoundFromCurrentFolder()
{
// Arrange
var path = @".";
// Act
var plugins = Plugins<IPluginV1>.Load(path);
// Assert
Assert.Empty(plugins);
}
}
}
|
Change the plugin library load path
|
Change the plugin library load path
Instead of pointing to netstandard1.3 folder this change will change the library load path to point to Libs folder that will contain libraries after code has been compiled.
|
C#
|
mit
|
tparviainen/oscilloscope
|
589578d1f403ff8df19078470edfc161536a6876
|
SimpleMvcSitemap/BaseUrlProvider.cs
|
SimpleMvcSitemap/BaseUrlProvider.cs
|
using System.Web;
using System.Web.Mvc;
namespace SimpleMvcSitemap
{
class BaseUrlProvider : IBaseUrlProvider
{
public string GetBaseUrl(HttpContextBase httpContext)
{
//http://stackoverflow.com/a/1288383/205859
HttpRequestBase request = httpContext.Request;
return string.Format("{0}://{1}{2}", request.Url.Scheme,
request.Url.Authority,
UrlHelper.GenerateContentUrl("~", httpContext));
}
}
}
|
using System.Web;
using System.Web.Mvc;
namespace SimpleMvcSitemap
{
class BaseUrlProvider : IBaseUrlProvider
{
public string GetBaseUrl(HttpContextBase httpContext)
{
//http://stackoverflow.com/a/1288383/205859
HttpRequestBase request = httpContext.Request;
return string.Format("{0}://{1}{2}", request.Url.Scheme,
request.Url.Authority,
UrlHelper.GenerateContentUrl("~", httpContext))
.TrimEnd('/');
}
}
}
|
Remove trailing slash from base URL
|
Remove trailing slash from base URL
|
C#
|
mit
|
uhaciogullari/SimpleMvcSitemap,FeodorFitsner/SimpleMvcSitemap
|
b2815afbd8071426b8ed21cfdee71b44dc1c220c
|
test/FetcherTest.cs
|
test/FetcherTest.cs
|
using System.Collections.Specialized;
using System.Text;
using Moq;
using NUnit.Framework;
namespace LastPass.Test
{
[TestFixture]
class FetcherTest
{
[Test]
public void Login()
{
var webClient = new Mock<IWebClient>();
webClient
.Setup(x => x.UploadValues(It.Is<string>(s => s == "https://lastpass.com/login.php"),
It.IsAny<NameValueCollection>()))
.Returns(Encoding.UTF8.GetBytes(""))
.Verifiable();
new Fetcher("username", "password").Login(webClient.Object);
webClient.Verify();
}
}
}
|
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using Moq;
using NUnit.Framework;
namespace LastPass.Test
{
[TestFixture]
class FetcherTest
{
[Test]
public void Login()
{
const string url = "https://lastpass.com/login.php";
const string username = "username";
const string password = "password";
var expectedValues = new NameValueCollection
{
{"method", "mobile"},
{"web", "1"},
{"xml", "1"},
{"username", username},
{"hash", "e379d972c3eb59579abe3864d850b5f54911544adfa2daf9fb53c05d30cdc985"},
{"iterations", "1"}
};
var webClient = new Mock<IWebClient>();
webClient
.Setup(x => x.UploadValues(It.Is<string>(s => s == url),
It.Is<NameValueCollection>(v => AreEqual(v, expectedValues))))
.Returns(Encoding.UTF8.GetBytes(""))
.Verifiable();
new Fetcher(username, password).Login(webClient.Object);
webClient.Verify();
}
private static bool AreEqual(NameValueCollection a, NameValueCollection b)
{
return a.AllKeys.OrderBy(s => s).SequenceEqual(b.AllKeys.OrderBy(s => s)) &&
a.AllKeys.All(s => a[s] == b[s]);
}
}
}
|
Test Fetcher.Login POSTs with correct values
|
Test Fetcher.Login POSTs with correct values
|
C#
|
mit
|
detunized/lastpass-sharp,detunized/lastpass-sharp,rottenorange/lastpass-sharp
|
03dc518f26d92fbe4d839f1f422c3654681c43df
|
examples/simple/PodList.cs
|
examples/simple/PodList.cs
|
namespace simple
{
using System;
using System.IO;
using k8s;
class PodList
{
static void Main(string[] args)
{
var k8sClientConfig = new KubernetesClientConfiguration();
IKubernetes client = new Kubernetes(k8sClientConfig);
Console.WriteLine("Starting Request!");
var listTask = client.ListNamespacedPodWithHttpMessagesAsync("default").Result;
var list = listTask.Body;
foreach (var item in list.Items) {
Console.WriteLine(item.Metadata.Name);
}
if (list.Items.Count == 0) {
Console.WriteLine("Empty!");
}
}
}
}
|
namespace simple
{
using System;
using System.IO;
using k8s;
class PodList
{
static void Main(string[] args)
{
var k8sClientConfig = KubernetesClientConfiguration.BuildConfigFromConfigFile();
IKubernetes client = new Kubernetes(k8sClientConfig);
Console.WriteLine("Starting Request!");
var listTask = client.ListNamespacedPodWithHttpMessagesAsync("default").Result;
var list = listTask.Body;
foreach (var item in list.Items) {
Console.WriteLine(item.Metadata.Name);
}
if (list.Items.Count == 0) {
Console.WriteLine("Empty!");
}
}
}
}
|
Update example for new config file loading.
|
Update example for new config file loading.
|
C#
|
apache-2.0
|
kubernetes-client/csharp,kubernetes-client/csharp
|
c0e708933e3a055392ba7242004605f43472b907
|
SketchSolveC#.NET.Spec/Test.cs
|
SketchSolveC#.NET.Spec/Test.cs
|
using System;
using NUnit.Framework;
using FluentAssertions;
using SketchSolve;
using System.Linq;
namespace SketchSolve.Spec
{
[TestFixture()]
public class Solver
{
[Test()]
public void HorizontalConstraintShouldWork ()
{
var parameters = new Parameter[]{
new Parameter(0),
new Parameter(1),
new Parameter(2),
new Parameter(3)
};
var points = new point[]{
new point(){x = parameters[0], y = parameters[1]},
new point(){x = parameters[2], y = parameters[3]},
};
var lines = new line[]{
new line(){p1 = points[0], p2 = points[1]}
};
var cons = new constraint[] {
new constraint(){
type =ConstraintEnum.horizontal,
line1 = lines[0]
}
};
var r = SketchSolve.Solver.solve(parameters, cons, true);
points [0].y.Value.Should ().Be (points[1].y.Value);
points [0].x.Value.Should ().NotBe (points[1].x.Value);
}
}
}
|
using System;
using NUnit.Framework;
using FluentAssertions;
using SketchSolve;
using System.Linq;
namespace SketchSolve.Spec
{
[TestFixture()]
public class Solver
{
[Test()]
public void HorizontalConstraintShouldWork ()
{
var parameters = new Parameter[]{
new Parameter(0),
new Parameter(1),
new Parameter(2),
new Parameter(3)
};
var points = new point[]{
new point(){x = parameters[0], y = parameters[1]},
new point(){x = parameters[2], y = parameters[3]},
};
var lines = new line[]{
new line(){p1 = points[0], p2 = points[1]}
};
var cons = new constraint[] {
new constraint(){
type =ConstraintEnum.horizontal,
line1 = lines[0]
}
};
var r = SketchSolve.Solver.solve(parameters, cons, true);
points [0].y.Value.Should ().BeInRange (points[1].y.Value-0.001, points[1].y.Value+0.001);
points [0].x.Value.Should ().NotBe (points[1].x.Value);
}
}
}
|
Use range check for floating point
|
Use range check for floating point
|
C#
|
bsd-3-clause
|
bradphelan/SketchSolve.NET,bradphelan/SketchSolve.NET,bradphelan/SketchSolve.NET
|
bc0943d47147a8127c7cf69fafe5e68bfa065236
|
osu.Framework/Development/DebugUtils.cs
|
osu.Framework/Development/DebugUtils.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
namespace osu.Framework.Development
{
public static class DebugUtils
{
public static bool IsDebugBuild => is_debug_build.Value;
private static readonly Lazy<bool> is_debug_build = new Lazy<bool>(() => Assembly.GetExecutingAssembly().GetCustomAttributes(false).OfType<DebuggableAttribute>().Any(da => da.IsJITTrackingEnabled));
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
namespace osu.Framework.Development
{
public static class DebugUtils
{
public static bool IsDebugBuild => is_debug_build.Value;
private static readonly Lazy<bool> is_debug_build = new Lazy<bool>(() =>
// https://stackoverflow.com/a/2186634
Assembly.GetExecutingAssembly().GetCustomAttributes(false).OfType<DebuggableAttribute>().Any(da => da.IsJITTrackingEnabled)
);
}
}
|
Add reference to source of debug lookup method
|
Add reference to source of debug lookup method
|
C#
|
mit
|
smoogipooo/osu-framework,ppy/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,DrabWeb/osu-framework
|
60aec44c57c68bae7c10772492b9ed97c31acb8d
|
CommonMarkSharp/InlineParsers/AnyParser.cs
|
CommonMarkSharp/InlineParsers/AnyParser.cs
|
using CommonMarkSharp.Blocks;
using CommonMarkSharp.Inlines;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CommonMarkSharp.InlineParsers
{
public class AnyParser : IParser<InlineString>
{
public AnyParser(string significantChars)
{
SignificantChars = string.IsNullOrEmpty(significantChars) ? new HashSet<char>(significantChars) : null;
}
public HashSet<char> SignificantChars { get; private set; }
public string StartsWithChars { get { return null; } }
public InlineString Parse(ParserContext context, Subject subject)
{
if (SignificantChars != null)
{
var chars = subject.TakeWhile(c => !SignificantChars.Contains(c));
if (chars.Any())
{
return new InlineString(chars);
}
}
return new InlineString(subject.Take());
}
}
}
|
using CommonMarkSharp.Blocks;
using CommonMarkSharp.Inlines;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace CommonMarkSharp.InlineParsers
{
public class AnyParser : IParser<InlineString>
{
public AnyParser(string significantChars)
{
SignificantChars = significantChars;
}
public string SignificantChars { get; private set; }
public string StartsWithChars { get { return null; } }
public InlineString Parse(ParserContext context, Subject subject)
{
if (SignificantChars != null)
{
var chars = subject.TakeWhile(c => !SignificantChars.Contains(c));
if (chars.Any())
{
return new InlineString(chars);
}
}
return new InlineString(subject.Take());
}
}
}
|
Use string in stead of HashSet - much faster
|
Use string in stead of HashSet - much faster
|
C#
|
mit
|
MortenHoustonLudvigsen/CommonMarkSharp,binki/CommonMarkSharp,MortenHoustonLudvigsen/CommonMarkSharp
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.