commit
stringlengths 40
40
| subject
stringlengths 4
1.73k
| repos
stringlengths 5
127k
| old_file
stringlengths 2
751
| new_file
stringlengths 2
751
| new_contents
stringlengths 1
8.98k
| old_contents
stringlengths 0
6.59k
| license
stringclasses 13
values | lang
stringclasses 23
values |
---|---|---|---|---|---|---|---|---|
f90397a8d39873987669e7950d45116513e4c9d2
|
throw if member name stack empty, it's never null
|
HarshPoint/HarshPoint,NaseUkolyCZ/HarshPoint,the-ress/HarshPoint
|
HarshPoint/ExpressionExtensions.cs
|
HarshPoint/ExpressionExtensions.cs
|
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
namespace HarshPoint
{
public static class ExpressionExtensions
{
public static String GetMemberName<T, TResult>(this Expression<Func<T, TResult>> expression)
{
return GetMemberNameCore(expression);
}
public static String GetMemberName<T>(this Expression<Func<T>> expression)
{
return GetMemberNameCore(expression);
}
private static String GetMemberNameCore(Expression expression)
{
if (expression == null)
{
throw Error.ArgumentNull("expression");
}
var visitor = new MemberNameVisitor();
visitor.Visit(expression);
if (visitor.MemberNames.IsEmpty)
{
throw Error.ArgumentOutOfRangeFormat(
"expression",
expression,
SR.ExpressionExtensions_MemberExpressionNotFound
);
}
return String.Join(".", visitor.MemberNames);
}
private sealed class MemberNameVisitor : ExpressionVisitor
{
public MemberNameVisitor()
{
MemberNames = ImmutableStack.Create<String>();
}
public ImmutableStack<String> MemberNames
{
get;
private set;
}
protected override Expression VisitMember(MemberExpression node)
{
if (node.Member != null)
{
MemberNames = MemberNames.Push(node.Member.Name);
}
return base.VisitMember(node);
}
}
}
}
|
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
namespace HarshPoint
{
public static class ExpressionExtensions
{
public static String GetMemberName<T, TResult>(this Expression<Func<T, TResult>> expression)
{
return GetMemberNameCore(expression);
}
public static String GetMemberName<T>(this Expression<Func<T>> expression)
{
return GetMemberNameCore(expression);
}
private static String GetMemberNameCore(Expression expression)
{
if (expression == null)
{
throw Error.ArgumentNull("expression");
}
var visitor = new MemberNameVisitor();
visitor.Visit(expression);
if (visitor.MemberNames == null)
{
throw Error.ArgumentOutOfRangeFormat(
"expression",
expression,
SR.ExpressionExtensions_MemberExpressionNotFound
);
}
return String.Join(".", visitor.MemberNames);
}
private sealed class MemberNameVisitor : ExpressionVisitor
{
public MemberNameVisitor()
{
MemberNames = ImmutableStack.Create<String>();
}
public ImmutableStack<String> MemberNames
{
get;
private set;
}
protected override Expression VisitMember(MemberExpression node)
{
if (node.Member != null)
{
MemberNames = MemberNames.Push(node.Member.Name);
}
return base.VisitMember(node);
}
}
}
}
|
bsd-2-clause
|
C#
|
0266f255af05effb4191a322ddde5488a1da27ed
|
Add missing XML comment
|
jamill/libgit2sharp,ethomson/libgit2sharp,libgit2/libgit2sharp,nulltoken/libgit2sharp,GeertvanHorrik/libgit2sharp,xoofx/libgit2sharp,red-gate/libgit2sharp,xoofx/libgit2sharp,jamill/libgit2sharp,AMSadek/libgit2sharp,Zoxive/libgit2sharp,AArnott/libgit2sharp,psawey/libgit2sharp,mono/libgit2sharp,ethomson/libgit2sharp,OidaTiftla/libgit2sharp,GeertvanHorrik/libgit2sharp,sushihangover/libgit2sharp,shana/libgit2sharp,red-gate/libgit2sharp,nulltoken/libgit2sharp,psawey/libgit2sharp,jorgeamado/libgit2sharp,OidaTiftla/libgit2sharp,oliver-feng/libgit2sharp,github/libgit2sharp,vivekpradhanC/libgit2sharp,jorgeamado/libgit2sharp,rcorre/libgit2sharp,PKRoma/libgit2sharp,Zoxive/libgit2sharp,vorou/libgit2sharp,AMSadek/libgit2sharp,vivekpradhanC/libgit2sharp,dlsteuer/libgit2sharp,dlsteuer/libgit2sharp,github/libgit2sharp,Skybladev2/libgit2sharp,sushihangover/libgit2sharp,oliver-feng/libgit2sharp,AArnott/libgit2sharp,Skybladev2/libgit2sharp,jeffhostetler/public_libgit2sharp,jeffhostetler/public_libgit2sharp,shana/libgit2sharp,rcorre/libgit2sharp,whoisj/libgit2sharp,mono/libgit2sharp,vorou/libgit2sharp,whoisj/libgit2sharp
|
LibGit2Sharp/Stash.cs
|
LibGit2Sharp/Stash.cs
|
namespace LibGit2Sharp
{
///<summary>
/// A Stash
/// <para>A stash is a snapshot of the dirty state of the working directory (i.e. the modified tracked files and staged changes)</para>
///</summary>
public class Stash : ReferenceWrapper<Commit>
{
/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected Stash()
{ }
internal Stash(Repository repo, ObjectId targetId, int index)
: base(repo, new DirectReference(string.Format("stash@{{{0}}}", index), repo, targetId), r => r.CanonicalName)
{ }
/// <summary>
/// Gets the <see cref = "Commit" /> that this stash points to.
/// </summary>
public virtual Commit Target
{
get { return TargetObject; }
}
/// <summary>
/// Gets the message associated to this <see cref="Stash"/>.
/// </summary>
public virtual string Message
{
get { return Target.Message; }
}
/// <summary>
/// Returns "stash@{i}", where i is the index of this <see cref="Stash"/>.
/// </summary>
protected override string Shorten()
{
return CanonicalName;
}
}
}
|
namespace LibGit2Sharp
{
///<summary>
/// A Stash
/// <para>A stash is a snapshot of the dirty state of the working directory (i.e. the modified tracked files and staged changes)</para>
///</summary>
public class Stash : ReferenceWrapper<Commit>
{
/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected Stash()
{ }
internal Stash(Repository repo, ObjectId targetId, int index)
: base(repo, new DirectReference(string.Format("stash@{{{0}}}", index), repo, targetId), r => r.CanonicalName)
{ }
/// <summary>
/// Gets the <see cref = "Commit" /> that this stash points to.
/// </summary>
public virtual Commit Target
{
get { return TargetObject; }
}
/// <summary>
/// Gets the message associated to this <see cref="Stash"/>.
/// </summary>
public virtual string Message
{
get { return Target.Message; }
}
protected override string Shorten()
{
return CanonicalName;
}
}
}
|
mit
|
C#
|
b6c9cc5aad00c44f1d83990c8310b8ebc27dc87b
|
Fix Autofac registration.
|
xjpeter/Naru
|
Naru.WPF/WPFModule.cs
|
Naru.WPF/WPFModule.cs
|
using Autofac;
using Naru.WPF.Dialog;
using Naru.WPF.Menu;
using Naru.WPF.MVVM;
using Naru.WPF.Scheduler;
using Naru.WPF.ToolBar;
using Naru.WPF.ViewModel;
namespace Naru.WPF
{
public class WPFModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<SchedulerProvider>().As<ISchedulerProvider>();
builder.RegisterType<ViewService>().As<IViewService>();
// Dialogs
builder.RegisterGeneric(typeof(DialogBuilder<>)).As(typeof(IDialogBuilder<>)).InstancePerDependency();
builder.RegisterType<StandardDialogBuilder>().As<IStandardDialogBuilder>().InstancePerDependency();
// ToolBar
builder.RegisterType<ToolBarService>().As<IToolBarService>().SingleInstance();
builder.RegisterType<ToolBarButtonItem>().AsSelf().InstancePerDependency();
// Menu
builder.RegisterType<MenuService>().As<IMenuService>().SingleInstance();
builder.RegisterType<MenuButtonItem>().AsSelf().InstancePerDependency();
builder.RegisterType<MenuGroupItem>().AsSelf().InstancePerDependency();
builder.RegisterType<MenuSeperatorItem>().AsSelf().InstancePerDependency();
// Collections
builder.RegisterGeneric(typeof(BindableCollection<>)).AsSelf().InstancePerDependency();
builder.RegisterGeneric(typeof(ReactiveSingleSelectCollection<>)).AsSelf().InstancePerDependency();
builder.RegisterGeneric(typeof(ReactiveMultiSelectCollection<>)).AsSelf().InstancePerDependency();
}
}
}
|
using Autofac;
using Naru.WPF.Dialog;
using Naru.WPF.Menu;
using Naru.WPF.MVVM;
using Naru.WPF.Scheduler;
using Naru.WPF.ToolBar;
using Naru.WPF.ViewModel;
namespace Naru.WPF
{
public class WPFModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<SchedulerProvider>().As<ISchedulerProvider>();
builder.RegisterType<ViewService>().As<IViewService>();
// Dialogs
builder.RegisterGeneric(typeof(DialogBuilder<>)).As(typeof(IDialogBuilder<>)).InstancePerDependency();
builder.RegisterType<StandardDialogBuilder>().As<StandardDialogBuilder>().InstancePerDependency();
// ToolBar
builder.RegisterType<ToolBarService>().As<IToolBarService>().SingleInstance();
builder.RegisterType<ToolBarButtonItem>().AsSelf().InstancePerDependency();
// Menu
builder.RegisterType<MenuService>().As<IMenuService>().SingleInstance();
builder.RegisterType<MenuButtonItem>().AsSelf().InstancePerDependency();
builder.RegisterType<MenuGroupItem>().AsSelf().InstancePerDependency();
builder.RegisterType<MenuSeperatorItem>().AsSelf().InstancePerDependency();
// Collections
builder.RegisterGeneric(typeof(BindableCollection<>)).AsSelf().InstancePerDependency();
builder.RegisterGeneric(typeof(ReactiveSingleSelectCollection<>)).AsSelf().InstancePerDependency();
builder.RegisterGeneric(typeof(ReactiveMultiSelectCollection<>)).AsSelf().InstancePerDependency();
}
}
}
|
mit
|
C#
|
e86fcbf41337db7905ee3665aa08d1b2261b59bd
|
Update 批量合并同名文档:format code && fix IndexOutOfRangeException
|
imba-tjd/CSharp-Code-Repository
|
单个文件的程序/批量合并同名文档.cs
|
单个文件的程序/批量合并同名文档.cs
|
// https://www.zhihu.com/question/284015230
using System;
// using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
namespace DotNet
{
class Program
{
static void Main(string[] args)
{
Directory.GetFiles(
args.Length > 0 ? args[1] : Environment.CurrentDirectory, "*.txt", SearchOption.AllDirectories
).GroupBy(x => Path.GetFileName(x)
).AsParallel().ForAll(x =>
{
StringBuilder sb = new StringBuilder();
foreach (var item in x)
sb.AppendLine(File.ReadAllText(item) + Environment.NewLine);
File.WriteAllText(x.Key, sb.ToString());
// foreach (var item in x)
// using (TextReader tr = new StreamReader(item))
// {
// sb.AppendLine(tr.ReadToEnd());
// sb.AppendLine();
// }
// using (TextWriter tw = new StreamWriter(x.Key))
// {
// tw.Write(sb.ToString());
// }
}
);
}
}
}
|
// https://www.zhihu.com/question/284015230
using System;
// using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
namespace DotNet
{
class Program
{
static void Main(string[] args)
{
Directory.GetFiles(
args?[1] ?? Environment.CurrentDirectory, "*.txt", SearchOption.AllDirectories
).GroupBy(
x => Path.GetFileName(x)
).AsParallel().ForAll(
x =>
{
StringBuilder sb = new StringBuilder();
foreach (var item in x)
sb.AppendLine(File.ReadAllText(item) + Environment.NewLine);
File.WriteAllText(x.Key, sb.ToString());
// foreach (var item in x)
// using (TextReader tr = new StreamReader(item))
// {
// sb.AppendLine(tr.ReadToEnd());
// sb.AppendLine();
// }
// using (TextWriter tw = new StreamWriter(x.Key))
// {
// tw.Write(sb.ToString());
// }
}
);
}
}
}
|
mit
|
C#
|
1676df4f4c706e6b01efc7a5f173e316598955d8
|
fix and rename GetCurrent to TryGetCurrent in AdoNetUnitOfWorkManager
|
evicertia/Rebus.AdoNet
|
Rebus.AdoNet/AdoNetUnitOfWorkManager.cs
|
Rebus.AdoNet/AdoNetUnitOfWorkManager.cs
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rebus;
using Rebus.Bus;
using Rebus.AdoNet.Dialects;
namespace Rebus.AdoNet
{
public class AdoNetUnitOfWorkManager : IUnitOfWorkManager
{
private const string CONTEXT_ITEM_KEY = nameof(AdoNetUnitOfWork);
private readonly AdoNetConnectionFactory _factory;
public AdoNetUnitOfWorkManager(AdoNetConnectionFactory factory)
{
Guard.NotNull(() => factory, factory);
_factory = factory;
}
internal static AdoNetUnitOfWork TryGetCurrent()
{
object result = null;
var context = MessageContext.HasCurrent ? MessageContext.GetCurrent() : null;
if (context != null)
{
if (context.Items.TryGetValue(CONTEXT_ITEM_KEY, out result))
{
return (AdoNetUnitOfWork)result;
}
}
return null;
}
internal AdoNetUnitOfWorkScope GetScope(bool autonomous = true, bool autocomplete = false)
{
var uow = TryGetCurrent();
if (!autonomous && uow == null)
{
throw new InvalidOperationException("An scope was requested, but no UnitOfWork was avaialble?!");
}
uow = uow ?? new AdoNetUnitOfWork(_factory, null);
var result = uow.GetScope();
if (autocomplete) result.Complete();
return result;
}
public IUnitOfWork Create()
{
var context = MessageContext.GetCurrent();
var result = new AdoNetUnitOfWork(_factory, context);
// Remove from context on disposal..
//result.OnDispose += () => context.Items.Remove(CONTEXT_ITEM_KEY);
context.Items.Add(CONTEXT_ITEM_KEY, result);
return result;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rebus;
using Rebus.Bus;
using Rebus.AdoNet.Dialects;
namespace Rebus.AdoNet
{
public class AdoNetUnitOfWorkManager : IUnitOfWorkManager
{
private const string CONTEXT_ITEM_KEY = nameof(AdoNetUnitOfWork);
private readonly AdoNetConnectionFactory _factory;
public AdoNetUnitOfWorkManager(AdoNetConnectionFactory factory)
{
Guard.NotNull(() => factory, factory);
_factory = factory;
}
internal static AdoNetUnitOfWork GetCurrent()
{
object result = null;
var context = MessageContext.HasCurrent ? MessageContext.GetCurrent() : null;
if ((bool)context?.Items.TryGetValue(CONTEXT_ITEM_KEY, out result))
{
return (AdoNetUnitOfWork)result;
}
return null;
}
internal AdoNetUnitOfWorkScope GetScope(bool autonomous = true, bool autocomplete = false)
{
var uow = GetCurrent();
if (!autonomous && uow == null)
{
throw new InvalidOperationException("An scope was requested, but no UnitOfWork was avaialble?!");
}
uow = uow ?? new AdoNetUnitOfWork(_factory, null);
var result = uow.GetScope();
if (autocomplete) result.Complete();
return result;
}
public IUnitOfWork Create()
{
var context = MessageContext.GetCurrent();
var result = new AdoNetUnitOfWork(_factory, context);
// Remove from context on disposal..
//result.OnDispose += () => context.Items.Remove(CONTEXT_ITEM_KEY);
context.Items.Add(CONTEXT_ITEM_KEY, result);
return result;
}
}
}
|
mit
|
C#
|
aa1fc5a79915d0fa49d30356d7f4c9a46b23acbb
|
Update AssemblyInfo.
|
addsb/ShopifySharp
|
ShopifySharp/Properties/AssemblyInfo.cs
|
ShopifySharp/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("ShopifySharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShopifySharp")]
[assembly: AssemblyCopyright("Copyright © Nozzlegear Software 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("833ec12b-956d-427b-a598-2f12b84589ef")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.3.1")]
[assembly: AssemblyFileVersion("2.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ShopifySharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShopifySharp")]
[assembly: AssemblyCopyright("Copyright © Nozzlegear Software 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("833ec12b-956d-427b-a598-2f12b84589ef")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.3.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
|
mit
|
C#
|
ac81e730e45616d9de31c8c75ddead61fcb81b56
|
Support Qiitadon <https://qiitadon.com>
|
OrionDevelop/Orion,mika-f/Orion
|
Source/Orion.Shared/ProviderRedirect.cs
|
Source/Orion.Shared/ProviderRedirect.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Orion.Shared
{
// F**king mstdn.jp
internal static class ProviderRedirect
{
private static readonly List<Tuple<string, string>> RedirectHosts = new List<Tuple<string, string>>
{
new Tuple<string, string>("mstdn.jp", "streaming.mstdn.jp"),
new Tuple<string, string>("qiitadon.com", "streaming.qiitadon.com:4000")
};
public static string Redirect(string url)
{
var host = new Uri(url).Host;
return RedirectHosts.Any(w => w.Item1 == host) ? RedirectHosts.First(w => w.Item1 == host).Item2 : host;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Orion.Shared
{
// F**king mstdn.jp
internal static class ProviderRedirect
{
private static readonly List<Tuple<string, string>> RedirectHosts = new List<Tuple<string, string>>
{
new Tuple<string, string>("mstdn.jp", "streaming.mstdn.jp")
};
public static string Redirect(string url)
{
var host = new Uri(url).Host;
return RedirectHosts.Any(w => w.Item1 == host) ? RedirectHosts.First(w => w.Item1 == host).Item2 : host;
}
}
}
|
mit
|
C#
|
043f68c23dd808fc0d1909bd0139bec46ea7e358
|
Update assembly
|
bringking/mailgun_csharp
|
Mailgun.AspNet.Identity/Properties/AssemblyInfo.cs
|
Mailgun.AspNet.Identity/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mailgun API Wrapper- ASP.net Identity services")]
[assembly: AssemblyDescription("An IIdentityMessageService implemention using the mailgun_csharp API wrapper")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Charles King")]
[assembly: AssemblyProduct("Mailgun.AspNet.Identity")]
[assembly: AssemblyCopyright("Copyright Charles King © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c7633e64-9745-4341-b230-1e7450790ade")]
// 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")]
[assembly: AssemblyInformationalVersion("0.5.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mailgun API Wrapper- ASP.net Identity services")]
[assembly: AssemblyDescription("An IIdentityMessageService implemention using the mailgun_csharp API wrapper")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Charles King")]
[assembly: AssemblyProduct("Mailgun.AspNet.Identity")]
[assembly: AssemblyCopyright("Copyright Charles King © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c7633e64-9745-4341-b230-1e7450790ade")]
// 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")]
[assembly: AssemblyInformationalVersion("0.4.0")]
|
mit
|
C#
|
13a33a3274d8935a881b6baa0c68e4edb89bf089
|
Refactor or expression
|
ajlopez/BScript
|
Src/BScript/Expressions/OrExpression.cs
|
Src/BScript/Expressions/OrExpression.cs
|
namespace BScript.Expressions
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualBasic.CompilerServices;
public class OrExpression : IExpression
{
private IExpression left;
private IExpression right;
public OrExpression(IExpression left, IExpression right)
{
this.left = left;
this.right = right;
}
public IExpression LeftExpression { get { return this.left; } }
public IExpression RightExpression { get { return this.right; } }
public object Evaluate(Context context)
{
object lvalue = this.left.Evaluate(context);
if (lvalue != null && !false.Equals(lvalue))
return true;
object rvalue = this.right.Evaluate(context);
if (rvalue != null && !false.Equals(rvalue))
return true;
return false;
}
}
}
|
namespace BScript.Expressions
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualBasic.CompilerServices;
public class OrExpression : IExpression
{
private IExpression left;
private IExpression right;
public OrExpression(IExpression left, IExpression right)
{
this.left = left;
this.right = right;
}
public IExpression LeftExpression { get { return this.left; } }
public IExpression RightExpression { get { return this.right; } }
public object Evaluate(Context context)
{
if (true.Equals(this.left.Evaluate(context)))
return true;
if (true.Equals(this.right.Evaluate(context)))
return true;
return false;
}
}
}
|
mit
|
C#
|
9f31b559718b8fa1d8161ecff25c0b0804603647
|
Update middleware
|
ZyshchykMaksim/NLayer.NET,ZyshchykMaksim/NLayer.NET
|
NLayer.NET.PL.API/Middlewares/LoggingMiddleware.cs
|
NLayer.NET.PL.API/Middlewares/LoggingMiddleware.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Microsoft.Owin;
using NLayer.NET.BLL.Logger;
using NLayer.NET.PL.API.Extensions;
namespace NLayer.NET.PL.API.Middlewares
{
/// <summary>
///
/// </summary>
public class LoggingMiddleware : OwinMiddleware
{
private readonly ILog<LoggingMiddleware> _logService;
/// <summary>
///
/// </summary>
/// <param name="next"></param>
/// <param name="logFactory">The logging service</param>
public LoggingMiddleware(OwinMiddleware next, ILogFactory logFactory) : base(next)
{
_logService = logFactory.CreateLogger<LoggingMiddleware>();
}
/// <summary>
/// Process an individual request.
/// </summary>
/// <param name="context">The context</param>
/// <returns></returns>
public override async Task Invoke(IOwinContext context)
{
var startTime = DateTime.UtcNow;
var watch = Stopwatch.StartNew();
await Next.Invoke(context);
watch.Stop();
string userName = context.Request.User != null && context.Request.User.Identity.IsAuthenticated ? context.Request.User.Identity.Name : "Anonymous";
string logTemplate = $"{context.Request.Method} {userName} {context.Request.Path} {Environment.NewLine}" +
$"Start time: {startTime} Duration: {watch.ElapsedMilliseconds} milliseconds {Environment.NewLine}" +
$"Request Headers:{Environment.NewLine}{context.Request.GetHeaderParameters().ConvertToString()}{Environment.NewLine}" +
$"Body:{Environment.NewLine}{context.Request.GetBody()}";
_logService.Info(logTemplate);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Microsoft.Owin;
using NLayer.NET.BLL.Logger;
using NLayer.NET.PL.API.Extensions;
namespace NLayer.NET.PL.API.Middlewares
{
/// <summary>
///
/// </summary>
public class LoggingMiddleware : OwinMiddleware
{
private readonly ILog<LoggingMiddleware> _logService;
/// <summary>
///
/// </summary>
/// <param name="next"></param>
/// <param name="logFactory">The logging service</param>
public LoggingMiddleware(OwinMiddleware next, ILogFactory logFactory) : base(next)
{
_logService = logFactory.CreateLogger<LoggingMiddleware>();
}
/// <summary>
/// Process an individual request.
/// </summary>
/// <param name="context">The context</param>
/// <returns></returns>
public override async Task Invoke(IOwinContext context)
{
try
{
var startTime = DateTime.UtcNow;
var watch = Stopwatch.StartNew();
await Next.Invoke(context);
watch.Stop();
string userName = context.Request.User != null && context.Request.User.Identity.IsAuthenticated ? context.Request.User.Identity.Name : "Anonymous";
string logTemplate = $"{context.Request.Method} {userName} {context.Request.Path} {Environment.NewLine}" +
$"Start time: {startTime} Duration: {watch.ElapsedMilliseconds} milliseconds {Environment.NewLine}" +
$"Request Headers:{Environment.NewLine}{context.Request.GetHeaderParameters().ConvertToString()}{Environment.NewLine}" +
$"Body:{Environment.NewLine}{context.Request.GetBody()}";
_logService.Info(logTemplate);
}
catch (Exception e)
{
Trace.WriteLine(e);
}
}
}
}
|
apache-2.0
|
C#
|
e86e44686ddffbfb2c165997b633c05c4c8eb153
|
Remove un-used search code
|
lukecahill/notepad
|
notepad/Utilities.cs
|
notepad/Utilities.cs
|
using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace notepad {
/// <summary>
/// Static class of text utilities such as word count, line count, set up font dialog, return time, and search the text.
/// </summary>
public static class Utilities {
/// <summary>
/// Counts the number of lines of text there are in the program
/// </summary>
/// <param name="textArea">Textbox area item</param>
/// <returns>Integer with the count of the number of lines found</returns>
public static int LineCount(TextBox textArea) {
string[] lines = Regex.Split(textArea.Text.Trim(), "\r\n");
var lineCount = lines.Count();
return lineCount;
}
/// <summary>
/// Counts the number of words of text there are in the program
/// </summary>
/// <param name="textArea">Textbox area item</param>
/// <returns>Integer with the count of the number of lines found</returns>
public static int WordCount(TextBox textArea) {
string[] words = Regex.Split(textArea.Text.Trim(), "\\w+");
var wordCounter = 0;
wordCounter = words.Count();
return wordCounter -= 1;
}
/// <summary>
/// Creates a new FontDialog item with the initilaised parameters set
/// </summary>
/// <returns>FontDialog item</returns>
public static FontDialog SetUpFontDialog() {
return new FontDialog {
ShowColor = true,
ShowApply = true,
ShowEffects = true,
ShowHelp = true
};
}
/// <summary>
/// Used to get the current datetime
/// </summary>
/// <returns>String with UTC datetime</returns>
public static string ReturnTime() {
return DateTime.UtcNow.ToString();
}
}
}
|
using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace notepad {
/// <summary>
/// Static class of text utilities such as word count, line count, set up font dialog, return time, and search the text.
/// </summary>
public static class Utilities {
/// <summary>
/// Counts the number of lines of text there are in the program
/// </summary>
/// <param name="textArea">Textbox area item</param>
/// <returns>Integer with the count of the number of lines found</returns>
public static int LineCount(TextBox textArea) {
string[] lines = Regex.Split(textArea.Text.Trim(), "\r\n");
var lineCount = lines.Count();
return lineCount;
}
/// <summary>
/// Counts the number of words of text there are in the program
/// </summary>
/// <param name="textArea">Textbox area item</param>
/// <returns>Integer with the count of the number of lines found</returns>
public static int WordCount(TextBox textArea) {
string[] words = Regex.Split(textArea.Text.Trim(), "\\w+");
var wordCounter = 0;
wordCounter = words.Count();
return wordCounter -= 1;
}
/// <summary>
/// Creates a new FontDialog item with the initilaised parameters set
/// </summary>
/// <returns>FontDialog item</returns>
public static FontDialog SetUpFontDialog() {
return new FontDialog {
ShowColor = true,
ShowApply = true,
ShowEffects = true,
ShowHelp = true
};
}
/// <summary>
/// Used to get the current datetime
/// </summary>
/// <returns>String with UTC datetime</returns>
public static string ReturnTime() {
return DateTime.UtcNow.ToString();
}
/// <summary>
/// Searches the textbox for the specified text
/// </summary>
/// <param name="textArea">Textbox item which contains the text which is being searched for</param>
/// <param name="search">String text which is being searched for</param>
/// <returns>Int array containing the position at [0], and the length at [1] if the text is found. If it is not found returns null, which is later checked.</returns>
public static int[] ReturnSearch(TextBox textArea, string search) {
int[] array = new int[2];
var postion = textArea.Text.IndexOf(search);
var length = search.Length;
if(postion != -1) {
array[0] = postion;
array[1] = length;
return array;
}
return null;
}
}
}
|
mit
|
C#
|
a7957298c1de4cab445ca204ff23055994bd09fb
|
Add (temporary) event handler delegate.
|
jcheng31/IntervalTimer
|
IntervalTimer.cs
|
IntervalTimer.cs
|
using System;
using Microsoft.SPOT;
namespace IntervalTimer
{
public delegate void IntervalEventHandler(object sender, EventArgs e);
public class IntervalTimer
{
public TimeSpan ShortDuration { get; set; }
public TimeSpan LongDuration { get; set; }
public IntervalTimer(TimeSpan shortDuration, TimeSpan longDuration)
{
ShortDuration = shortDuration;
LongDuration = longDuration;
}
public IntervalTimer(int shortSeconds, int longSeconds)
{
ShortDuration = new TimeSpan(0, 0, shortSeconds);
LongDuration = new TimeSpan(0, 0, longSeconds);
}
}
}
|
using System;
using Microsoft.SPOT;
namespace IntervalTimer
{
public class IntervalTimer
{
public TimeSpan ShortDuration { get; set; }
public TimeSpan LongDuration { get; set; }
public IntervalTimer(TimeSpan shortDuration, TimeSpan longDuration)
{
ShortDuration = shortDuration;
LongDuration = longDuration;
}
public IntervalTimer(int shortSeconds, int longSeconds)
{
ShortDuration = new TimeSpan(0, 0, shortSeconds);
LongDuration = new TimeSpan(0, 0, longSeconds);
}
}
}
|
mit
|
C#
|
2913f57d2f68a7bbd4697b3f30a90fa94a6f12b2
|
Add FuzzyEquals extension method to double and float.
|
mcneel/RhinoCycles
|
ExtensionMethods/RhinoCyclesExtensions.cs
|
ExtensionMethods/RhinoCyclesExtensions.cs
|
using System;
using System.Drawing;
using Rhino.Geometry.Collections;
namespace RhinoCyclesCore.ExtensionMethods
{
public static class NumericExtensions
{
public static bool FuzzyEquals(this double orig, double test)
{
var rc = false;
rc = Math.Abs(orig - test) < 0.000001;
return rc;
}
public static bool FuzzyEquals(this float orig, float test)
{
var rc = false;
rc = Math.Abs(orig - test) < 0.000001;
return rc;
}
}
public static class SizeExtensions
{
public static void Deconstruct(this Size size, out int x, out int y)
{
x = size.Width;
y = size.Height;
}
}
public static class MeshVertexColorListExtensions
{
/// <summary>
/// Copies all vertex colors to a linear array of float in rgb order
/// </summary>
/// <returns>The float array.</returns>
public static float[] ToFloatArray(this MeshVertexColorList cl)
{
int count = cl.Count;
var rc = new float[count * 3];
int index = 0;
foreach (var c in cl)
{
Rhino.Display.Color4f c4f = new Rhino.Display.Color4f(c);
rc[index++] = c4f.R;
rc[index++] = c4f.G;
rc[index++] = c4f.B;
}
return rc;
}
/// <summary>
/// Copies all vertex colors to a linear array of float in rgb order
/// if cl.Count==count
/// </summary>
/// <returns>The float array, or null if cl.Count!=count</returns>
public static float[] ToFloatArray(this MeshVertexColorList cl, int count)
{
if (count != cl.Count) return null;
return cl.ToFloatArray();
}
}
}
|
using System;
using System.Drawing;
using Rhino.Geometry.Collections;
namespace RhinoCyclesCore.ExtensionMethods
{
public static class SizeExtensions
{
public static void Deconstruct(this Size size, out int x, out int y)
{
x = size.Width;
y = size.Height;
}
}
public static class MeshVertexColorListExtensions
{
/// <summary>
/// Copies all vertex colors to a linear array of float in rgb order
/// </summary>
/// <returns>The float array.</returns>
public static float[] ToFloatArray(this MeshVertexColorList cl)
{
int count = cl.Count;
var rc = new float[count * 3];
int index = 0;
foreach (var c in cl)
{
Rhino.Display.Color4f c4f = new Rhino.Display.Color4f(c);
rc[index++] = c4f.R;
rc[index++] = c4f.G;
rc[index++] = c4f.B;
}
return rc;
}
/// <summary>
/// Copies all vertex colors to a linear array of float in rgb order
/// if cl.Count==count
/// </summary>
/// <returns>The float array, or null if cl.Count!=count</returns>
public static float[] ToFloatArray(this MeshVertexColorList cl, int count)
{
if (count != cl.Count) return null;
return cl.ToFloatArray();
}
}
}
|
apache-2.0
|
C#
|
9f927daf453041b8955e372506943a2c80c198d9
|
revert logging config causing bug
|
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
|
api/src/FilterLists.Api/Startup.cs
|
api/src/FilterLists.Api/Startup.cs
|
using FilterLists.Api.DependencyInjection.Extensions;
using FilterLists.Data.DependencyInjection.Extensions;
using FilterLists.Services.DependencyInjection.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace FilterLists.Api
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", false, true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddFilterListsRepositories(Configuration);
services.AddFilterListsServices();
services.AddFilterListsApi();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseMvc();
//TODO: maybe move to Startup() per Scott Allen
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
}
}
}
|
using FilterLists.Api.DependencyInjection.Extensions;
using FilterLists.Data.DependencyInjection.Extensions;
using FilterLists.Services.DependencyInjection.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace FilterLists.Api
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", false, true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true)
.AddEnvironmentVariables();
Configuration = builder.Build();
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
}
public IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddFilterListsRepositories(Configuration);
services.AddFilterListsServices();
services.AddFilterListsApi();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseMvc();
}
}
}
|
mit
|
C#
|
4ba2ed3e6494b002bf29fb2447e73fb78fccf763
|
fix exposing ApiDocumentation's @context
|
wikibus/Argolis
|
src/Hydra/ApiDocumentation.cs
|
src/Hydra/ApiDocumentation.cs
|
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Hydra
{
/// <summary>
/// Base class for Hydra API documentation
/// </summary>
public abstract class ApiDocumentation
{
/// <summary>
/// Initializes a new instance of the <see cref="ApiDocumentation"/> class.
/// </summary>
/// <param name="entrypoint">The entrypoint Uri.</param>
protected ApiDocumentation(Uri entrypoint)
{
Entrypoint = entrypoint;
}
/// <summary>
/// Gets the entrypoint Uri.
/// </summary>
public Uri Entrypoint { get; private set; }
/// <summary>
/// Gets the supported classes.
/// </summary>
[JsonProperty("supportedClass")]
public virtual IEnumerable<Class> SupportedClasses
{
get { yield break; }
}
[JsonProperty, UsedImplicitly]
private string Type
{
get { return Hydra.ApiDocumentation; }
}
/// <summary>
/// Gets the context.
/// </summary>
/// <param name="doc">The document.</param>
[UsedImplicitly]
protected static JToken GetContext(ApiDocumentation doc)
{
return new JArray(Hydra.Context, doc.GetLocalContext());
}
/// <summary>
/// Gets the local @context for API documentation.
/// </summary>
protected abstract JToken GetLocalContext();
}
}
|
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Hydra
{
/// <summary>
/// Base class for Hydra API documentation
/// </summary>
public abstract class ApiDocumentation
{
/// <summary>
/// Initializes a new instance of the <see cref="ApiDocumentation"/> class.
/// </summary>
/// <param name="entrypoint">The entrypoint Uri.</param>
protected ApiDocumentation(Uri entrypoint)
{
Entrypoint = entrypoint;
}
/// <summary>
/// Gets the entrypoint Uri.
/// </summary>
public Uri Entrypoint { get; private set; }
/// <summary>
/// Gets the supported classes.
/// </summary>
[JsonProperty("supportedClass")]
public virtual IEnumerable<Class> SupportedClasses
{
get { yield break; }
}
[JsonProperty, UsedImplicitly]
private string Type
{
get { return Hydra.ApiDocumentation; }
}
/// <summary>
/// Gets the local @context for API documentation.
/// </summary>
protected abstract JToken GetLocalContext();
[UsedImplicitly]
private static JToken GetContext(ApiDocumentation doc)
{
return new JArray(Hydra.Context, doc.GetLocalContext());
}
}
}
|
mit
|
C#
|
081595cd0726e17a4ff88bc4454050e4a8b51886
|
Make structs public
|
SICU-Stress-Measurement-System/frontend-cs
|
StressMeasurementSystem/Models/Patient.cs
|
StressMeasurementSystem/Models/Patient.cs
|
using System.Net.Mail;
namespace StressMeasurementSystem.Models
{
public class Patient
{
#region Structs
public struct Name
{
public string Prefix { get; set; }
public string First { get; set; }
public string Middle { get; set; }
public string Last { get; set; }
public string Suffix { get; set; }
}
public struct Organization
{
public string Company { get; set; }
public string JobTitle { get; set; }
}
public struct PhoneNumber
{
public enum Type {Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other}
public string Number { get; set; }
public Type T { get; set; }
}
public struct Email
{
public enum Type {Home, Work, Other}
public MailAddress Address { get; set; }
public Type T { get; set; }
}
#endregion
#region Fields
private Name _name;
private uint _age;
private Organization _organization;
private PhoneNumber _phoneNumber;
private Email _email;
#endregion
#region Constructors
#endregion
}
}
|
using System.Net.Mail;
namespace StressMeasurementSystem.Models
{
public class Patient
{
#region Structs
struct Name
{
public string Prefix { get; set; }
public string First { get; set; }
public string Middle { get; set; }
public string Last { get; set; }
public string Suffix { get; set; }
}
struct Organization
{
public string Company { get; set; }
public string JobTitle { get; set; }
}
struct PhoneNumber
{
internal enum Type {Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other}
public string Number { get; set; }
public Type T { get; set; }
}
struct Email
{
internal enum Type {Home, Work, Other}
public MailAddress Address { get; set; }
public Type T { get; set; }
}
#endregion
#region Fields
private Name _name;
private uint _age;
private Organization _organization;
private PhoneNumber _phoneNumber;
private Email _email;
#endregion
#region Constructors
#endregion
}
}
|
apache-2.0
|
C#
|
989add482a28fdf026665f8a71cbfbef7015cbfd
|
Document PoEStashRequestError
|
jcmoyer/Yeena
|
Yeena/PathOfExile/PoEStashRequestError.cs
|
Yeena/PathOfExile/PoEStashRequestError.cs
|
// Copyright 2013 J.C. Moyer
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma warning disable 649
using Newtonsoft.Json;
namespace Yeena.PathOfExile {
/// <summary>
/// Represents an error that has occurred while retreiving the stash.
/// </summary>
[JsonObject]
class PoEStashRequestError {
[JsonProperty("message")]
private readonly string _message;
/// <summary>
/// Returns the message associated with this error.
/// </summary>
public string Message {
get { return _message; }
}
}
}
|
// Copyright 2013 J.C. Moyer
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma warning disable 649
using Newtonsoft.Json;
namespace Yeena.PathOfExile {
[JsonObject]
class PoEStashRequestError {
[JsonProperty("message")]
private readonly string _message;
public string Message {
get { return _message; }
}
}
}
|
apache-2.0
|
C#
|
fc2bda0a96afffababadd697341a4cf46847d3c9
|
Add double click to copy functionality
|
Schlechtwetterfront/snipp
|
Views/ClipList.xaml.cs
|
Views/ClipList.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 clipman.Views
{
/// <summary>
/// Interaction logic for ClipList.xaml
/// </summary>
public partial class ClipList : UserControl
{
public ClipList()
{
InitializeComponent();
}
private void Copy(object sender, MouseButtonEventArgs e)
{
Console.WriteLine("Trying to copy");
var clip = (Models.Clip)(sender as ListBoxItem).DataContext;
var parentWindow = Window.GetWindow(this) as MainWindow;
if (parentWindow != null)
{
parentWindow.HasJustCopied = true;
}
clip.Copy();
}
}
}
|
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 clipman.Views
{
/// <summary>
/// Interaction logic for ClipList.xaml
/// </summary>
public partial class ClipList : UserControl
{
public ClipList()
{
InitializeComponent();
}
}
}
|
apache-2.0
|
C#
|
5de6ab8b20df0e5b8325f94fc3120e7debb5e5ff
|
Use different dictionaries and make fastactivator threadsafe
|
sillsdev/gtk-sharp,sillsdev/gtk-sharp,sillsdev/gtk-sharp,sillsdev/gtk-sharp,sillsdev/gtk-sharp
|
glib/FastActivator.cs
|
glib/FastActivator.cs
|
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace GLib
{
static class FastActivator
{
const BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance;
delegate object FastCreateObjectPtr (IntPtr ptr);
static FastCreateObjectPtr FastCtorPtr (Type t, Dictionary<Type, FastCreateObjectPtr> cache)
{
FastCreateObjectPtr method;
lock (cache) {
if (!cache.TryGetValue (t, out method)) {
var param = Expression.Parameter (typeof (IntPtr));
var newExpr = Expression.New (
t.GetConstructor (flags, null, new [] { typeof (IntPtr) }, new ParameterModifier [0]),
param
);
cache [t] = method = (FastCreateObjectPtr)Expression.Lambda (typeof (FastCreateObjectPtr), newExpr, param).Compile ();
}
}
return method;
}
delegate object FastCreateObject ();
static FastCreateObject FastCtor (Type t, Dictionary<Type, FastCreateObject> cache)
{
FastCreateObject method;
lock (cache) {
if (!cache.TryGetValue (t, out method)) {
var newExpr = Expression.New (t);
cache [t] = method = (FastCreateObject)Expression.Lambda (typeof (FastCreateObject), newExpr).Compile ();
}
}
return method;
}
static readonly Dictionary<Type, FastCreateObjectPtr> cacheOpaque = new Dictionary<Type, FastCreateObjectPtr> (new TypeEqualityComparer ());
public static Opaque CreateOpaque (IntPtr o, Type type)
{
return (Opaque)FastCtorPtr (type, cacheOpaque)(o);
}
static readonly Dictionary<Type, FastCreateObjectPtr> cacheObject = new Dictionary<Type, FastCreateObjectPtr> (new TypeEqualityComparer ());
public static Object CreateObject (IntPtr o, Type type)
{
return (Object)FastCtorPtr (type, cacheObject)(o);
}
static readonly Dictionary<Type, FastCreateObject> cacheSignalArgs = new Dictionary<Type, FastCreateObject> (new TypeEqualityComparer ());
public static SignalArgs CreateSignalArgs (Type type)
{
return (SignalArgs)FastCtor (type, cacheSignalArgs)();
}
class TypeEqualityComparer : IEqualityComparer<Type>
{
public bool Equals (Type x, Type y)
{
return x == y;
}
public int GetHashCode (Type obj)
{
if (obj == null)
return 0;
return obj.GetHashCode ();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace GLib
{
static class FastActivator
{
const BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance;
static readonly Dictionary<Type, Delegate> cache = new Dictionary<Type, Delegate> (new TypeEqualityComparer ());
delegate object FastCreateObjectPtr (IntPtr ptr);
static FastCreateObjectPtr FastCtorPtr (Type t)
{
Delegate method;
if (!cache.TryGetValue (t, out method)) {
var param = Expression.Parameter (typeof (IntPtr));
var newExpr = Expression.New (
t.GetConstructor (flags, null, new [] { typeof (IntPtr) }, new ParameterModifier [0]),
param
);
cache [t] = method = (FastCreateObjectPtr)Expression.Lambda (typeof (FastCreateObjectPtr), newExpr, param).Compile ();
}
return (FastCreateObjectPtr)method;
}
delegate object FastCreateObject ();
static FastCreateObject FastCtor (Type t)
{
Delegate method;
if (!cache.TryGetValue (t, out method)) {
var newExpr = Expression.New (t);
cache [t] = method = (FastCreateObject)Expression.Lambda (typeof (FastCreateObject), newExpr).Compile ();
}
return (FastCreateObject)method;
}
public static Opaque CreateOpaque (IntPtr o, Type type)
{
return (Opaque)FastCtorPtr (type)(o);
}
public static Object CreateObject (IntPtr o, Type type)
{
return (Object)FastCtorPtr (type)(o);
}
public static SignalArgs CreateSignalArgs (Type type)
{
return (SignalArgs)FastCtor (type)();
}
class TypeEqualityComparer : IEqualityComparer<Type>
{
public bool Equals (Type x, Type y)
{
return x == y;
}
public int GetHashCode (Type obj)
{
if (obj == null)
return 0;
return obj.GetHashCode ();
}
}
}
}
|
lgpl-2.1
|
C#
|
03b8bd0c025ba4926a6fb69737017d7a36ff155f
|
make proxy generator a static variable of create task
|
ResourceDataInc/Simpler.Data,gregoryjscott/Simpler,ResourceDataInc/Simpler.Data,gregoryjscott/Simpler,ResourceDataInc/Simpler.Data
|
Simpler/Construction/Tasks/CreateTask.cs
|
Simpler/Construction/Tasks/CreateTask.cs
|
using Castle.DynamicProxy;
using System;
using Simpler.Construction.Interceptors;
namespace Simpler.Construction.Tasks
{
public class CreateTask : Task
{
static readonly ProxyGenerator ProxyGenerator = new ProxyGenerator();
// Inputs
public virtual Type TaskType { get; set; }
// Outputs
public virtual object TaskInstance { get; private set; }
public override void Execute()
{
if (Attribute.IsDefined(TaskType, typeof(ExecutionCallbacksAttribute)))
{
TaskInstance = ProxyGenerator.CreateClassProxy(TaskType, new TaskExecutionInterceptor());
}
else
{
TaskInstance = Activator.CreateInstance(TaskType);
}
}
}
}
|
using Castle.DynamicProxy;
using System;
using Simpler.Construction.Interceptors;
namespace Simpler.Construction.Tasks
{
public class CreateTask : Task
{
// Inputs
public virtual Type TaskType { get; set; }
// Outputs
public virtual object TaskInstance { get; private set; }
public override void Execute()
{
if (Attribute.IsDefined(TaskType, typeof(ExecutionCallbacksAttribute)))
{
TaskInstance = new ProxyGenerator().CreateClassProxy(TaskType, new TaskExecutionInterceptor());
}
else
{
TaskInstance = Activator.CreateInstance(TaskType);
}
}
}
}
|
mit
|
C#
|
9f35d48f4e8b1982c2cad5309dd72b64e59233f8
|
Update to release 4.5.50 Work Item #34097
|
tfreitasleal/cslacontrib,MarimerLLC/cslacontrib,tfreitasleal/cslacontrib,tfreitasleal/cslacontrib,MarimerLLC/cslacontrib,MarimerLLC/cslacontrib,MarimerLLC/cslacontrib
|
trunk/Source/GlobalAssemblyInfo.cs
|
trunk/Source/GlobalAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("CslaContrib project")]
[assembly: AssemblyCopyright("Copyright CslaContrib 2009-2013")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("4.5.50")]
[assembly: AssemblyFileVersion("4.5.50")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("CslaContrib project")]
[assembly: AssemblyCopyright("Copyright CslaContrib 2009-2013")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("4.5.31")]
[assembly: AssemblyFileVersion("4.5.31")]
|
mit
|
C#
|
10d709dd6c6b942837de1723299768ef079bd1b3
|
create a PersonChange using a Person object
|
jgraber/atom_exchange,jgraber/atom_exchange,jgraber/atom_exchange
|
AtomProducer/Models/PersonChange.cs
|
AtomProducer/Models/PersonChange.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.ServiceModel.Syndication;
using System.Web;
using System.Xml;
namespace AtomProducer.Models
{
public class PersonChange : SyndicationItem
{
private string _personNamespace = "AtomExchange.Person";
public int PersonId { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public PersonChange()
{
}
public PersonChange(Person person)
{
LastName = person.LastName;
FirstName = person.FirstName;
PersonId = person.Id;
}
protected override bool TryParseElement(XmlReader reader, string version)
{
if (reader.LocalName.Equals("LastName") &&
reader.NamespaceURI.Equals(_personNamespace))
{
LastName = reader.Value;
return true;
}
if (reader.LocalName.Equals("FirstName") &&
reader.NamespaceURI.Equals(_personNamespace))
{
FirstName = reader.Value;
return true;
}
if (reader.LocalName.Equals("PersonId") &&
reader.NamespaceURI.Equals(_personNamespace))
{
int id;
Int32.TryParse(reader.Value, out id);
PersonId = id;
return true;
}
return base.TryParseElement(reader, version);
}
protected override void WriteElementExtensions(XmlWriter writer, string version)
{
ElementExtensions.Add("PersonId", _personNamespace, PersonId);
ElementExtensions.Add("LastName", _personNamespace, LastName);
ElementExtensions.Add("FirstName", _personNamespace, FirstName);
base.WriteElementExtensions(writer, version);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.ServiceModel.Syndication;
using System.Web;
using System.Xml;
namespace AtomProducer.Models
{
public class PersonChange : SyndicationItem
{
private string _personNamespace = "AtomExchange.Person";
public int PersonId { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public PersonChange()
{
}
protected override bool TryParseElement(XmlReader reader, string version)
{
if (reader.LocalName.Equals("LastName") &&
reader.NamespaceURI.Equals(_personNamespace))
{
LastName = reader.Value;
return true;
}
if (reader.LocalName.Equals("FirstName") &&
reader.NamespaceURI.Equals(_personNamespace))
{
FirstName = reader.Value;
return true;
}
if (reader.LocalName.Equals("PersonId") &&
reader.NamespaceURI.Equals(_personNamespace))
{
int id;
Int32.TryParse(reader.Value, out id);
PersonId = id;
return true;
}
return base.TryParseElement(reader, version);
}
protected override void WriteElementExtensions(XmlWriter writer, string version)
{
ElementExtensions.Add("PersonId", _personNamespace, PersonId);
ElementExtensions.Add("LastName", _personNamespace, LastName);
ElementExtensions.Add("FirstName", _personNamespace, FirstName);
base.WriteElementExtensions(writer, version);
}
}
}
|
apache-2.0
|
C#
|
65f04f4158843f9404a963d9d86b5ac7058b5308
|
Change invalid character enum to make more send (None becomes Error)
|
mediaburst/clockwork-dotnet
|
Clockwork/InvalidCharacterAction.cs
|
Clockwork/InvalidCharacterAction.cs
|
/// <summary>
/// Action to take if the message text contains an invalid character
/// Valid characters are defined in the GSM 03.38 character set
/// </summary>
public enum InvalidCharacterAction
{
/// <summary>
/// Use the default setting from your account
/// </summary>
AccountDefault = 0,
/// <summary>
/// Return an error if a Non-GSM character is found
/// </summary>
Error = 1,
/// <summary>
/// Remove any Non-GSM character
/// </summary>
Remove = 2,
/// <summary>
/// Replace Non-GSM characters where possible
/// remove any others
/// </summary>
Replace = 3
}
|
/// <summary>
/// Action to take if the message text contains an invalid character
/// Valid characters are defined in the GSM 03.38 character set
/// </summary>
public enum InvalidCharacterAction
{
/// <summary>
/// Use the default setting from your account
/// </summary>
AccountDefault = 0,
/// <summary>
/// Take no action
/// </summary>
None = 1,
/// <summary>
/// Remove any Non-GSM character
/// </summary>
Remove = 2,
/// <summary>
/// Replace Non-GSM characters where possible
/// remove any others
/// </summary>
Replace = 3
}
|
mit
|
C#
|
39614a3b8dabc0c5fb1705d7791e770c4a6cfd15
|
Bump version to 16.6.0.43246
|
HearthSim/HearthDb
|
HearthDb/Properties/AssemblyInfo.cs
|
HearthDb/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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2020")]
[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("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("16.6.0.43246")]
[assembly: AssemblyFileVersion("16.6.0.43246")]
|
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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2020")]
[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("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("16.4.0.42174")]
[assembly: AssemblyFileVersion("16.4.0.42174")]
|
mit
|
C#
|
99c72af80e3ee112cd7f3a2030e65f1ff15eaa31
|
Bump version to 16.0.0.37060
|
HearthSim/HearthDb
|
HearthDb/Properties/AssemblyInfo.cs
|
HearthDb/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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("16.0.0.37060")]
[assembly: AssemblyFileVersion("16.0.0.37060")]
|
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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("15.6.2.36393")]
[assembly: AssemblyFileVersion("15.6.2.36393")]
|
mit
|
C#
|
f29e66141cb704bfa75b487fbf1be23ca68552c5
|
Update Index.cshtml
|
tolu/tobiaslundin.se
|
ItsPersonal/Views/Home/Index.cshtml
|
ItsPersonal/Views/Home/Index.cshtml
|
@{
ViewBag.Title = "Tobias Lundin";
}
<div class="jumbotron">
<h1>Welcome!</h1>
<p class="lead">Snick snack on track</p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Sweet binary home</h2>
<p>
This is where I put things I cant fit into my apartment.
</p>
<p><a class="btn btn-default" target="_blank" href="https://www.google.se/maps/place/Akersveien+19,+0180+Oslo,+Norway/">Map »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a></p>
</div>
</div>
|
@{
ViewBag.Title = "Tobias Lundin";
}
<div class="jumbotron">
<h1>Welcome</h1>
<p class="lead">Snick snack on track</p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Sweet binary home</h2>
<p>
This is where I put things I cant fit into my apartment.
</p>
<p><a class="btn btn-default" target="_blank" href="https://www.google.se/maps/place/Akersveien+19,+0180+Oslo,+Norway/">Map »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a></p>
</div>
</div>
|
mit
|
C#
|
7121256795677d44283bb67230579a3f28c41433
|
Make -Context positional.
|
sharpjs/PSql,sharpjs/PSql
|
PSql/_Commands/ConnectSqlCommand.cs
|
PSql/_Commands/ConnectSqlCommand.cs
|
using System.Management.Automation;
using Microsoft.Data.SqlClient;
namespace PSql
{
[Cmdlet(VerbsCommunications.Connect, "Sql")]
[OutputType(typeof(SqlConnection))]
public class ConnectSqlCommand : Cmdlet
{
// -Context
[Parameter(Position = 0, ValueFromPipeline = true)]
public SqlContext Context { get; set; }
// -DatabaseName
[Parameter]
[Alias("Database")]
public string DatabaseName { get; set; }
protected override void ProcessRecord()
{
(var connection, _) = EnsureConnection(null, Context, DatabaseName);
WriteObject(connection);
}
}
}
|
using System.Management.Automation;
using Microsoft.Data.SqlClient;
namespace PSql
{
[Cmdlet(VerbsCommunications.Connect, "Sql")]
[OutputType(typeof(SqlConnection))]
public class ConnectSqlCommand : Cmdlet
{
// -Context
[Parameter(ValueFromPipeline = true)]
public SqlContext Context { get; set; }
// -DatabaseName
[Parameter]
[Alias("Database")]
public string DatabaseName { get; set; }
protected override void ProcessRecord()
{
(var connection, _) = EnsureConnection(null, Context, DatabaseName);
WriteObject(connection);
}
}
}
|
isc
|
C#
|
0a932842465a13dbbfc133a3a2ec5d1fc912045c
|
Fix MailToEmailProvider recipients list
|
marksvc/libpalaso,gmartin7/libpalaso,gmartin7/libpalaso,sillsdev/libpalaso,tombogle/libpalaso,gtryus/libpalaso,mccarthyrb/libpalaso,hatton/libpalaso,gtryus/libpalaso,tombogle/libpalaso,ddaspit/libpalaso,JohnThomson/libpalaso,mccarthyrb/libpalaso,glasseyes/libpalaso,gmartin7/libpalaso,darcywong00/libpalaso,sillsdev/libpalaso,sillsdev/libpalaso,glasseyes/libpalaso,gmartin7/libpalaso,hatton/libpalaso,tombogle/libpalaso,JohnThomson/libpalaso,chrisvire/libpalaso,hatton/libpalaso,mccarthyrb/libpalaso,darcywong00/libpalaso,chrisvire/libpalaso,marksvc/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,andrew-polk/libpalaso,darcywong00/libpalaso,andrew-polk/libpalaso,JohnThomson/libpalaso,sillsdev/libpalaso,andrew-polk/libpalaso,glasseyes/libpalaso,mccarthyrb/libpalaso,marksvc/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,ddaspit/libpalaso,ermshiperete/libpalaso,hatton/libpalaso,gtryus/libpalaso,ddaspit/libpalaso,chrisvire/libpalaso,ermshiperete/libpalaso,JohnThomson/libpalaso,ddaspit/libpalaso,andrew-polk/libpalaso,ermshiperete/libpalaso,chrisvire/libpalaso
|
Palaso/Email/MailToEmailProvider.cs
|
Palaso/Email/MailToEmailProvider.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace Palaso.Email
{
public class MailToEmailProvider : IEmailProvider
{
public IEmailMessage CreateMessage()
{
return new EmailMessage();
}
public bool SendMessage(IEmailMessage message)
{
//string body = _body.Replace(System.Environment.NewLine, "%0A").Replace("\"", "%22").Replace("&", "%26");
string body = Uri.EscapeDataString(message.Body);
string subject = Uri.EscapeDataString(message.Subject);
var recipientTo = message.To;
var toBuilder = new StringBuilder();
for (int i = 0; i < recipientTo.Count; ++i)
{
if (i > 0)
{
toBuilder.Append(",");
}
toBuilder.Append(recipientTo[i]);
}
var p = new Process
{
StartInfo =
{
FileName = String.Format("mailto:{0}?subject={1}&body={2}", toBuilder, subject, body),
UseShellExecute = true,
ErrorDialog = true
}
};
p.Start();
// Always return true. The false from p.Start may only indicate that the email client
// was already open.
return true;
}
}
}
|
using System;
using System.Diagnostics;
namespace Palaso.Email
{
public class MailToEmailProvider : IEmailProvider
{
public IEmailMessage CreateMessage()
{
return new EmailMessage();
}
public bool SendMessage(IEmailMessage message)
{
//string body = _body.Replace(System.Environment.NewLine, "%0A").Replace("\"", "%22").Replace("&", "%26");
string body = Uri.EscapeDataString(message.Body);
string subject = Uri.EscapeDataString(message.Subject);
var p = new Process
{
StartInfo =
{
FileName = String.Format("mailto:{0}?subject={1}&body={2}", message.To, subject, body),
UseShellExecute = true,
ErrorDialog = true
}
};
p.Start();
// Always return true. The false from p.Start may only indicate that the email client
// was already open.
return true;
}
}
}
|
mit
|
C#
|
ed8fe966cc2995e46f19d82b9ee301521550dd03
|
remove redundant versions
|
pashute/docs.particular.net,yuxuac/docs.particular.net,SzymonPobiega/docs.particular.net,WojcikMike/docs.particular.net,pedroreys/docs.particular.net,eclaus/docs.particular.net
|
Snippets/Snippets_4/EndpointName.cs
|
Snippets/Snippets_4/EndpointName.cs
|
using NServiceBus;
public class EndpointName
{
public void Simple()
{
#region EndpointNameFluent
Configure.With()
.DefineEndpointName("MyEndpoint");
#endregion
}
}
// startcode EndpointNameByAttribute
[EndpointName("MyEndpointName")]
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
{
// ... your custom config
// endcode
}
// startcode EndpointNameByNamespace
namespace MyServer
{
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
{
// ... your custom config
// endcode
}
}
|
using NServiceBus;
public class EndpointName
{
public void Simple()
{
#region EndpointNameFluent 4
Configure.With()
.DefineEndpointName("MyEndpoint");
#endregion
}
}
// startcode EndpointNameByAttribute 4
[EndpointName("MyEndpointName")]
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
{
// ... your custom config
// endcode
}
// startcode EndpointNameByNamespace 4
namespace MyServer
{
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
{
// ... your custom config
// endcode
}
}
|
apache-2.0
|
C#
|
1526819afc00be0af3b6f02de3d61b899a29b45f
|
Update version number to 0.3.0.0.
|
beppler/trayleds
|
TrayLeds/Properties/AssemblyInfo.cs
|
TrayLeds/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TrayLeds")]
[assembly: AssemblyDescription("Tray Notification Leds")]
[assembly: AssemblyProduct("TrayLeds")]
[assembly: AssemblyCopyright("Copyright © Carlos Alberto Costa Beppler 2017")]
// 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("eecfb156-872b-498d-9a01-42d37066d3d4")]
// 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.3.0.0")]
[assembly: AssemblyFileVersion("0.3.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TrayLeds")]
[assembly: AssemblyDescription("Tray Notification Leds")]
[assembly: AssemblyProduct("TrayLeds")]
[assembly: AssemblyCopyright("Copyright © Carlos Alberto Costa Beppler 2017")]
// 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("eecfb156-872b-498d-9a01-42d37066d3d4")]
// 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.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
|
mit
|
C#
|
ec53343dea87a9cab677329d696579d250d59ba8
|
Package Update #CHANGE: Pushed AdamsLair.WinForms 1.0.10
|
windygu/winforms,AdamsLair/winforms
|
WinForms/Properties/AssemblyInfo.cs
|
WinForms/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("AdamsLair.WinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdamsLair.WinForms")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("735ee5dc-8c18-4a06-8e64-2f172ddd01cc")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.10")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("AdamsLair.WinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdamsLair.WinForms")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("735ee5dc-8c18-4a06-8e64-2f172ddd01cc")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.9")]
|
mit
|
C#
|
80c3def78dd128a24dffe0eb104cd811c708d792
|
Package Update #CHANGE: Pushed AdamsLair.WinForms 1.0.12
|
windygu/winforms,AdamsLair/winforms
|
WinForms/Properties/AssemblyInfo.cs
|
WinForms/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("AdamsLair.WinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdamsLair.WinForms")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("735ee5dc-8c18-4a06-8e64-2f172ddd01cc")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.12")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("AdamsLair.WinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdamsLair.WinForms")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("735ee5dc-8c18-4a06-8e64-2f172ddd01cc")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.11")]
|
mit
|
C#
|
8e6af714aaf9c40a9c4b6d571fb7ffe179777092
|
debug info
|
kboronka/win-service-launcher
|
WinServiceLauncherTester/Program.cs
|
WinServiceLauncherTester/Program.cs
|
/* Copyright (C) 2013 Kevin Boronka
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.IO;
using skylib.Tools;
namespace WinServiceLauncherTester
{
using skylib.Tools;
class Program
{
public static void Main(string[] args)
{
try
{
ConsoleHelper.Start();
ConsoleHelper.ApplicationTitle();
ConsoleHelper.WriteLine("Environment.UserInteractive = " + Environment.UserInteractive.ToString());
ConsoleHelper.WriteLine("Username = " + System.Security.Principal.WindowsIdentity.GetCurrent().Name);
// rename service exe file
string serviceEXE = IO.FindFile("WinServiceLauncher.exe");
string serviceFilename = IO.GetFilename(serviceEXE);
string serviceName = StringHelper.TrimEnd(serviceFilename, IO.GetFileExtension(serviceEXE).Length + 1);
string serviceRoot = IO.GetRoot(serviceEXE);
ServiceHelper.TryStop("demo_service");
ServiceHelper.TryUninstall("demo_service");
ServiceHelper.TryStop(serviceEXE);
ServiceHelper.TryUninstall(serviceEXE);
ServiceHelper.Install("4.0", serviceEXE);
ConsoleHelper.WriteLine(serviceName + " installed");
ServiceHelper.Start(serviceEXE);
ConsoleHelper.WriteLine(serviceName + " started");
ConsoleHelper.Write("done - press any key to stop and uninstall the service", ConsoleColor.Yellow);
ConsoleHelper.ReadKey();
ConsoleHelper.WriteLine();
ServiceHelper.TryStop(serviceEXE);
ConsoleHelper.WriteLine(serviceName + " stopped");
ServiceHelper.Uninstall("4.0", serviceEXE);
ConsoleHelper.WriteLine(serviceName + " uninstalled");
ConsoleHelper.Write("done - press any key to exit", ConsoleColor.Yellow);
ConsoleHelper.ReadKey();
ConsoleHelper.WriteLine();
}
catch (Exception ex)
{
ServiceHelper.TryStop("WinServiceLauncher");
ServiceHelper.TryUninstall("WinServiceLauncher");
ConsoleHelper.WriteException(ex);
ConsoleHelper.ReadKey();
}
ConsoleHelper.Shutdown();
}
}
}
|
/* Copyright (C) 2013 Kevin Boronka
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.IO;
using skylib.Tools;
namespace WinServiceLauncherTester
{
using skylib.Tools;
class Program
{
public static void Main(string[] args)
{
try
{
ConsoleHelper.Start();
ConsoleHelper.ApplicationTitle();
// rename service exe file
string serviceEXE = IO.FindFile("WinServiceLauncher.exe");
string serviceFilename = IO.GetFilename(serviceEXE);
string serviceName = StringHelper.TrimEnd(serviceFilename, IO.GetFileExtension(serviceEXE).Length + 1);
string serviceRoot = IO.GetRoot(serviceEXE);
ServiceHelper.TryStop("demo_service");
ServiceHelper.TryUninstall("demo_service");
ServiceHelper.TryStop(serviceEXE);
ServiceHelper.TryUninstall(serviceEXE);
ServiceHelper.Install("4.0", serviceEXE);
ConsoleHelper.WriteLine(serviceName + " installed");
ServiceHelper.Start(serviceEXE);
ConsoleHelper.WriteLine(serviceName + " started");
ConsoleHelper.Write("done - press any key to stop and uninstall the service", ConsoleColor.Yellow);
ConsoleHelper.ReadKey();
ConsoleHelper.WriteLine();
ServiceHelper.TryStop(serviceEXE);
ConsoleHelper.WriteLine(serviceName + " stopped");
ServiceHelper.Uninstall("4.0", serviceEXE);
ConsoleHelper.WriteLine(serviceName + " uninstalled");
ConsoleHelper.Write("done - press any key to exit", ConsoleColor.Yellow);
ConsoleHelper.ReadKey();
ConsoleHelper.WriteLine();
}
catch (Exception ex)
{
ServiceHelper.TryStop("WinServiceLauncher");
ServiceHelper.TryUninstall("WinServiceLauncher");
ConsoleHelper.WriteException(ex);
ConsoleHelper.ReadKey();
}
ConsoleHelper.Shutdown();
}
}
}
|
bsd-2-clause
|
C#
|
a53c26aa16a09535c780b55c83a0af43691abe73
|
set server's current directory to the one where server.exe is
|
AlonAmsalem/quartznet,RafalSladek/quartznet,zhangjunhao/quartznet,sean-gilliam/quartznet,AndreGleichner/quartznet,quartznet/quartznet,quartznet/quartznet,huoxudong125/quartznet,sean-gilliam/quartznet,andyshao/quartznet,quartznet/quartznet,sean-gilliam/quartznet,quartznet/quartznet,neuronesb/quartznet,quartznet/quartznet,sean-gilliam/quartznet,sean-gilliam/quartznet,xlgwr/quartznet
|
server/Quartz.Server/Program.cs
|
server/Quartz.Server/Program.cs
|
using System.IO;
using Topshelf;
namespace Quartz.Server
{
/// <summary>
/// The server's main entry point.
/// </summary>
public static class Program
{
/// <summary>
/// Main.
/// </summary>
public static void Main()
{
// change from service account's dir to more logical one
Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory);
HostFactory.Run(x =>
{
x.RunAsLocalSystem();
x.SetDescription(Configuration.ServiceDescription);
x.SetDisplayName(Configuration.ServiceDisplayName);
x.SetServiceName(Configuration.ServiceName);
x.Service(factory =>
{
QuartzServer server = new QuartzServer();
server.Initialize();
return server;
});
});
}
}
}
|
using Topshelf;
namespace Quartz.Server
{
/// <summary>
/// The server's main entry point.
/// </summary>
public static class Program
{
/// <summary>
/// Main.
/// </summary>
public static void Main()
{
HostFactory.Run(x =>
{
x.RunAsLocalSystem();
x.SetDescription(Configuration.ServiceDescription);
x.SetDisplayName(Configuration.ServiceDisplayName);
x.SetServiceName(Configuration.ServiceName);
x.Service(factory =>
{
QuartzServer server = new QuartzServer();
server.Initialize();
return server;
});
});
}
}
}
|
apache-2.0
|
C#
|
ab3c1b3dddfa86e759eadb8e8c45905d61216e16
|
Set title for console window.
|
mitchfizz05/DangerousPanel,mitchfizz05/DangerousPanel,mitchfizz05/DangerousPanel
|
Program.cs
|
Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DangerousPanel_Server
{
class Program
{
static void Log(string text, ConsoleColor color)
{
ConsoleColor oldColor = Console.ForegroundColor;
Console.ForegroundColor = color;
Console.WriteLine(text);
Console.ForegroundColor = oldColor;
}
static void Main(string[] args)
{
Console.Title = "Dangerous Panel Server";
Log("Dangerous Panel Server (by Mitchfizz05)", ConsoleColor.Cyan);
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DangerousPanel_Server
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
mit
|
C#
|
42460b46ad06eb7c3ceb3be9f6c66ccb594e795a
|
Allow building this
|
mono/maccore,jorik041/maccore,cwensley/maccore,beni55/maccore
|
src/CoreGraphics/CGPDFPage-2.cs
|
src/CoreGraphics/CGPDFPage-2.cs
|
//
// CGPDFPage.cs: Implements the managed CGPDFPage
//
// Authors: Mono Team
//
// Copyright 2009 Novell, Inc
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
using System.Drawing;
using MonoMac.ObjCRuntime;
using MonoMac.Foundation;
namespace MonoMac.CoreGraphics {
public enum CGPDFBox {
Media = 0,
Crop = 1,
Bleed = 2,
Trim = 3,
Art = 4
}
public partial class CGPDFPage {
CGPDFDocument doc;
internal CGPDFPage (CGPDFDocument doc, IntPtr handle)
{
this.doc = doc;
this.handle = handle;
CGPDFPageRetain (handle);
}
public CGPDFDocument Document {
get {
return doc;
}
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static int CGPDFPageGetPageNumber (IntPtr handle);
public int PageNumber {
get {
return CGPDFPageGetPageNumber (handle);
}
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static RectangleF CGPDFPageGetBoxRect (IntPtr handle, CGPDFBox box);
public RectangleF GetBoxRect (CGPDFBox box)
{
return CGPDFPageGetBoxRect (handle, box);
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static int CGPDFPageGetRotationAngle (IntPtr handle);
public int RotationAngle {
get {
return CGPDFPageGetRotationAngle (handle);
}
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static CGAffineTransform CGPDFPageGetDrawingTransform (IntPtr handle, CGPDFBox box, RectangleF rect, int rotate, int preserveAspectRatio);
public CGAffineTransform GetDrawingTransform (CGPDFBox box, RectangleF rect, int rotate, bool preserveAspectRatio)
{
return CGPDFPageGetDrawingTransform (handle, box, rect, rotate, preserveAspectRatio ? 1 : 0);
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static IntPtr CGPDFPageGetDictionary (IntPtr pageHandle);
#if !COREBUILD
public CGPDFDictionary Dictionary {
get {
return new CGPDFDictionary (handle);
}
}
#endif
}
}
|
//
// CGPDFPage.cs: Implements the managed CGPDFPage
//
// Authors: Mono Team
//
// Copyright 2009 Novell, Inc
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
using System.Drawing;
using MonoMac.ObjCRuntime;
using MonoMac.Foundation;
namespace MonoMac.CoreGraphics {
public enum CGPDFBox {
Media = 0,
Crop = 1,
Bleed = 2,
Trim = 3,
Art = 4
}
public partial class CGPDFPage {
CGPDFDocument doc;
internal CGPDFPage (CGPDFDocument doc, IntPtr handle)
{
this.doc = doc;
this.handle = handle;
CGPDFPageRetain (handle);
}
public CGPDFDocument Document {
get {
return doc;
}
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static int CGPDFPageGetPageNumber (IntPtr handle);
public int PageNumber {
get {
return CGPDFPageGetPageNumber (handle);
}
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static RectangleF CGPDFPageGetBoxRect (IntPtr handle, CGPDFBox box);
public RectangleF GetBoxRect (CGPDFBox box)
{
return CGPDFPageGetBoxRect (handle, box);
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static int CGPDFPageGetRotationAngle (IntPtr handle);
public int RotationAngle {
get {
return CGPDFPageGetRotationAngle (handle);
}
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static CGAffineTransform CGPDFPageGetDrawingTransform (IntPtr handle, CGPDFBox box, RectangleF rect, int rotate, int preserveAspectRatio);
public CGAffineTransform GetDrawingTransform (CGPDFBox box, RectangleF rect, int rotate, bool preserveAspectRatio)
{
return CGPDFPageGetDrawingTransform (handle, box, rect, rotate, preserveAspectRatio ? 1 : 0);
}
[DllImport (Constants.CoreGraphicsLibrary)]
extern static IntPtr CGPDFPageGetDictionary (IntPtr pageHandle);
public CGPDFDictionary Dictionary {
get {
return new CGPDFDictionary (handle);
}
}
}
}
|
apache-2.0
|
C#
|
a66bac967659f300292f73060c51f007210d770c
|
update script var to 0.1.2-a
|
austinlparker/Cake.ISO,austinlparker/Cake.ISO
|
build.cake
|
build.cake
|
#tool "nuget:?package=xunit.runner.console&version=2.2.0"
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
// vars
var isLocalBuild = !AppVeyor.IsRunningOnAppVeyor;
var version = "0.1.2-alpha";
var semVersion = isLocalBuild ? version : string.Concat(version, "-build-", AppVeyor.Environment.Build.Number);
// Definitions
var buildDir = Directory("./src/Cake.ISO/bin") + Directory(configuration);
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("./Cake.ISO.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
MSBuild("./Cake.ISO.sln", settings =>
settings.SetConfiguration(configuration));
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
XUnit2("./tests/**/bin/" + configuration + "/*.Tests.dll");
});
Task("Create-Nuget-Package")
.IsDependentOn("Build")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
var packSettings = new NuGetPackSettings {
Version = version,
BasePath = "./src/Cake.ISO/bin/Release",
OutputDirectory = "./nuget"
};
NuGetPack("./Cake.ISO.nuspec", packSettings);
});
Task("Publish-Nuget-Package")
.IsDependentOn("Create-Nuget-Package")
.Does(() =>
{
var packages = GetFiles("./nuget/*.nupkg");
NuGetPush(packages, new NuGetPushSettings {
Source = "https://www.nuget.org/api/v2/package",
ApiKey = EnvironmentVariable("NugetApiKey")
});
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Run-Unit-Tests");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
|
#tool "nuget:?package=xunit.runner.console&version=2.2.0"
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
// vars
var isLocalBuild = !AppVeyor.IsRunningOnAppVeyor;
var version = "0.1.1-alpha";
var semVersion = isLocalBuild ? version : string.Concat(version, "-build-", AppVeyor.Environment.Build.Number);
// Definitions
var buildDir = Directory("./src/Cake.ISO/bin") + Directory(configuration);
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("./Cake.ISO.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
MSBuild("./Cake.ISO.sln", settings =>
settings.SetConfiguration(configuration));
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
XUnit2("./tests/**/bin/" + configuration + "/*.Tests.dll");
});
Task("Create-Nuget-Package")
.IsDependentOn("Build")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
var packSettings = new NuGetPackSettings {
Version = version,
BasePath = "./src/Cake.ISO/bin/Release",
OutputDirectory = "./nuget"
};
NuGetPack("./Cake.ISO.nuspec", packSettings);
});
Task("Publish-Nuget-Package")
.IsDependentOn("Create-Nuget-Package")
.Does(() =>
{
var packages = GetFiles("./nuget/*.nupkg");
NuGetPush(packages, new NuGetPushSettings {
Source = "https://www.nuget.org/api/v2/package",
ApiKey = EnvironmentVariable("NugetApiKey")
});
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Run-Unit-Tests");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
|
mit
|
C#
|
80f9b4960aaae298c0b2ba88a10781925a218330
|
Update HeartBeat.cs
|
cfairchi/MulticastUDP
|
udp/HeartBeat.cs
|
udp/HeartBeat.cs
|
using System.ComponentModel;
using com.csf.netutils.packets;
namespace com.csf.NetUtils.udp {
// The HeartBeat class os responsible for sending out periodic "HeartBeat" packets.
// Currently configured to send heartbeat every 10 seconds. Allows clients to
// detect servers that exist on the the same multicast address/port
public class HeartBeat {
private Packet.PACKETTYPE thePacketType, UDPMultiCastServer theUDPServer);
private BackgroundWorker m_HeartBeatWorker;
private UDPMultiCastServer m_Server;
public HeartBeat(Packet.PACKETTYPE thePacketType, UDPMultiCastServer theUDPServer) {
m_Server = theUDPServer;
m_PacketType = thePacketType;
m_HeartBeatWorker = new BackgroundWorker();
m_HeartBeatWorker.WorkerSupportsCancellation = true;
m_HeartBeatWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.HeartBeatWorker_DoWorker);
}
public void startHeartBeat() {
m_HeartBeatWorker.RunWorkerAsync();
}
public void stopHeartBeat() {
m_HeartBeatWorker.CancelAsync();
}
private void HeartBeatWorker_DoWork(object sender, DoWorkEventArgs e){
while (!m_HeartBeatWorker.CancellationPending) {
packet hbPacket = null;
switch (m_PacketType) {
case Packet.PACKETTYPE.AIRCRAFTPACKET:
hbPakcet = new AIRCRAFTPACKET(true);
break;
}
if (hbPacket != null) m_Server.broadcastPacket(hbPacket);
SystemThreading.Thread.Sleep(10000);
}
}
}
}
|
using System.ComponentModel;
using com.csf.netutils.packets;
namespace com.csf.NetUtils.udp {
public class HeartBeat {
private Packet.PACKETTYPE thePacketType, UDPMultiCastServer theUDPServer);
private BackgroundWorker m_HeartBeatWorker;
private UDPMultiCastServer m_Server;
public HeartBeat(Packet.PACKETTYPE thePacketType, UDPMultiCastServer theUDPServer) {
m_Server = theUDPServer;
m_PacketType = thePacketType;
m_HeartBeatWorker = new BackgroundWorker();
m_HeartBeatWorker.WorkerSupportsCancellation = true;
m_HeartBeatWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.HeartBeatWorker_DoWorker);
}
public void startHeartBeat() {
m_HeartBeatWorker.RunWorkerAsync();
}
public void stopHeartBeat() {
m_HeartBeatWorker.CancelAsync();
}
private void HeartBeatWorker_DoWork(object sender, DoWorkEventArgs e){
while (!m_HeartBeatWorker.CancellationPending) {
packet hbPacket = null;
switch (m_PacketType) {
case Packet.PACKETTYPE.AIRCRAFTPACKET:
hbPakcet = new AIRCRAFTPACKET(true);
break;
}
if (hbPacket != null) m_Server.broadcastPacket(hbPacket);
SystemThreading.Thread.Sleep(10000);
}
}
}
}
|
mit
|
C#
|
25d5a4b85753fe28579f25aa169d1b7c411aeaf1
|
Use shorter notation.
|
jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr
|
test/ActionFactoryTest.cs
|
test/ActionFactoryTest.cs
|
using FluentAssertions;
using Moq;
using Xunit;
namespace HelloWorldApp
{
public class ActionFactoryTest
{
[Fact]
public void CreateGetHelloWorldActionTest()
{
var getHelloWorldAction = Mock.Of<IGetHelloWorldAction>();
var resourceProvider = Mock.Of<IResourceProvider>(r =>
r.CreateResource<IGetHelloWorldAction>() == getHelloWorldAction);
var sut = new ActionFactory(resourceProvider);
var action = sut.CreateGetHelloWorldAction();
action.Should().NotBeNull();
}
}
}
|
using FluentAssertions;
using Moq;
using Xunit;
namespace HelloWorldApp
{
public class ActionFactoryTest
{
[Fact]
public void CreateGetHelloWorldActionTest()
{
var getHelloWorldAction = new Mock<IGetHelloWorldAction>();
var resourceProvider = new Mock<IResourceProvider>();
resourceProvider.Setup(m => m.CreateResource<IGetHelloWorldAction>()).Returns(getHelloWorldAction.Object);
var sut = new ActionFactory(resourceProvider.Object);
var action = sut.CreateGetHelloWorldAction();
action.Should().NotBeNull();
}
}
}
|
mit
|
C#
|
0aa40cba58aa45fe9833f2c3543a6da3a821486a
|
Bump version to 1.0.0rc3
|
github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity
|
common/SolutionInfo.cs
|
common/SolutionInfo.cs
|
#pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
// this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics
internal const string VersionForAssembly = "1.0.0";
// Actual real version
internal const string Version = "1.0.0rc3";
}
}
|
#pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
// this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics
internal const string VersionForAssembly = "1.0.0";
// Actual real version
internal const string Version = "1.0.0rc2";
}
}
|
mit
|
C#
|
b5cac62f81af51bd9f531c1d374dace684c72adb
|
Fix - WIP
|
Red-Folder/WebCrawl-Functions
|
WebCrawlProcess/run.csx
|
WebCrawlProcess/run.csx
|
#r "Newtonsoft.Json"
using System;
using Red_Folder.WebCrawl;
using Red_Folder.WebCrawl.Data;
using Red_Folder.Logging;
using Newtonsoft.Json;
public static void Run(string request, out object outputDocument, TraceWriter log)
{
log.Info($"Started");
CrawlRequest crawlRequest = null;
try
{
crawlRequest = JsonConvert.DeserializeObject<CrawlRequest>(request);
log.Info($"C# Queue trigger function processed: {crawlRequest.Id}");
}
catch (Exception ex)
{
log.Info($"Failed to get object - likely wrong format: {ex.Message}");
outputDocument = null;
return;
}
var azureLogger = new AzureLogger(log);
var crawler = new Crawler(crawlRequest, azureLogger);
crawler.AddUrl($"{crawlRequest.Host}/sitemap.xml");
var crawlResult = crawler.Crawl();
outputDocument = crawlResult;
//outputDocument = new { id = Guid.NewGuid().ToString() };
log.Info($"Finished");
}
public class AzureLogger : ILogger
{
private TraceWriter _log;
public AzureLogger(TraceWriter log)
{
_log = log;
}
public void Info(string message)
{
_log.Info(message);
}
}
|
#r "Newtonsoft.Json"
using System;
using Red_Folder.WebCrawl;
using Red_Folder.WebCrawl.Data;
using Red_Folder.Logging;
using Newtonsoft.Json;
public static void Run(string request, out object outputDocument, TraceWriter log)
{
log.Info($"Started");
try
{
var crawlRequest = JsonConvert.DeserializeObject<CrawlRequest>(request);
log.Info($"C# Queue trigger function processed: {crawlRequest.Id}");
}
catch (Exception ex)
{
log.Info($"Failed to get object - likely wrong format: {ex.Message}");
outputDocument = null;
return;
}
var azureLogger = new AzureLogger(log);
var crawler = new Crawler(crawlRequest, azureLogger);
crawler.AddUrl($"{crawlRequest.Host}/sitemap.xml");
var crawlResult = crawler.Crawl();
outputDocument = crawlResult;
//outputDocument = new { id = Guid.NewGuid().ToString() };
log.Info($"Finished");
}
public class AzureLogger : ILogger
{
private TraceWriter _log;
public AzureLogger(TraceWriter log)
{
_log = log;
}
public void Info(string message)
{
_log.Info(message);
}
}
|
mit
|
C#
|
960bbae87f84e588f3300ea9e872ee4cd99a2b23
|
Update osu.Game/Users/UserActivity.cs
|
NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,EVAST9919/osu,ppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,johnneijzen/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,2yangk23/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,johnneijzen/osu,peppy/osu-new,smoogipoo/osu,UselessToucan/osu,2yangk23/osu
|
osu.Game/Users/UserActivity.cs
|
osu.Game/Users/UserActivity.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Users
{
public abstract class UserActivity
{
public abstract string Status { get; }
public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker;
public class Modding : UserActivity
{
public override string Status => "Modding a map";
public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark;
}
public class ChoosingBeatmap : UserActivity
{
public override string Status => "Choosing a beatmap";
}
public class MultiplayerGame : UserActivity
{
public override string Status => "Playing with others";
}
public class Editing : UserActivity
{
public BeatmapInfo Beatmap { get; }
public Editing(BeatmapInfo info)
{
Beatmap = info;
}
public override string Status => @"Editing a beatmap";
}
public class SoloGame : UserActivity
{
public BeatmapInfo Beatmap { get; }
public Rulesets.RulesetInfo Ruleset { get; }
public SoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset)
{
Beatmap = info;
Ruleset = ruleset;
}
public override string Status => Ruleset.CreateInstance().PlayingVerb;
}
public class Spectating : UserActivity
{
public override string Status => @"Spectating a game";
}
public class InLobby : UserActivity
{
public override string Status => @"In a multiplayer lobby";
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Users
{
public abstract class UserActivity
{
public abstract string Status { get; }
public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker;
public class Modding : UserActivity
{
public override string Status => "Modding a map";
public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark;
}
public class ChoosingBeatmap : UserActivity
{
public override string Status => "Choosing a beatmap";
}
public class MultiplayerGame : UserActivity
{
public override string Status => "Playing with others";
}
public class Editing : UserActivity
{
public BeatmapInfo Beatmap { get; }
public Editing(BeatmapInfo info)
{
Beatmap = info;
}
public override string Status => @"Editing a beatmap";
}
public class SoloGame : UserActivity
{
public BeatmapInfo Beatmap { get; }
public Rulesets.RulesetInfo Ruleset { get; }
public SoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset)
{
Beatmap = info;
Ruleset = ruleset;
}
public override string Status => Beatmap.Ruleset.CreateInstance().PlayingVerb;
}
public class Spectating : UserActivity
{
public override string Status => @"Spectating a game";
}
public class InLobby : UserActivity
{
public override string Status => @"In a multiplayer lobby";
}
}
}
|
mit
|
C#
|
fa7ac5b2640f48dcd9c47e3bb98467fffae59835
|
Rewrite request path to serve up index instead of sending it without content type
|
Nemo157/DocNuget,Nemo157/DocNuget,Nemo157/DocNuget,Nemo157/DocNuget,Nemo157/DocNuget
|
src/DocNuget/Startup.cs
|
src/DocNuget/Startup.cs
|
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.StaticFiles;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
namespace DocNuget {
public class Startup {
public void ConfigureServices(IServiceCollection services) {
services.AddMvc();
}
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) {
loggerFactory.MinimumLevel = LogLevel.Debug;
loggerFactory.AddConsole(LogLevel.Debug);
app
.UseErrorPage()
.UseDefaultFiles()
.UseStaticFiles(new StaticFileOptions {
ServeUnknownFileTypes = true,
})
.UseMvc()
.Use((context, next) => {
context.Request.Path = new PathString("/index.html");
return next();
})
.UseStaticFiles();
}
}
}
|
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.StaticFiles;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
namespace DocNuget {
public class Startup {
public void ConfigureServices(IServiceCollection services) {
services.AddMvc();
}
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) {
loggerFactory.MinimumLevel = LogLevel.Debug;
loggerFactory.AddConsole(LogLevel.Debug);
app
.UseErrorPage()
.UseDefaultFiles()
.UseStaticFiles(new StaticFileOptions {
ServeUnknownFileTypes = true,
})
.UseMvc()
.UseSendFileFallback()
.Use(async (context, next) => {
await context.Response.SendFileAsync("wwwroot/index.html");
});
}
}
}
|
mit
|
C#
|
ff47b0116b4049898a4c6930488521eb7f56168d
|
remove hardcoded device name.
|
salfab/Plexito,salfab/Plexito
|
src/Plexito/App.xaml.cs
|
src/Plexito/App.xaml.cs
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace Plexito
{
using SandboxConsole.Services;
using System.Threading;
using System.Windows.Navigation;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private PlexMediaKeysProxy plexMediaKeysProxy;
public App()
{
var plexApi = PlexBinding.Instance.Value;
var device = plexApi.GetDevices()[ConfigurationManager.AppSettings["playerName"]];
this.plexMediaKeysProxy = new PlexMediaKeysProxy(plexApi);
this.plexMediaKeysProxy.SetDevice(device);
this.plexMediaKeysProxy.Start();
}
protected override void OnExit(ExitEventArgs e)
{
this.plexMediaKeysProxy.Dispose();
base.OnExit(e);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace Plexito
{
using SandboxConsole.Services;
using System.Threading;
using System.Windows.Navigation;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private PlexMediaKeysProxy plexMediaKeysProxy;
public App()
{
var plexApi = PlexBinding.Instance.Value;
var device = plexApi.GetDevices()["Hubert"];
this.plexMediaKeysProxy = new PlexMediaKeysProxy(plexApi);
this.plexMediaKeysProxy.SetDevice(device);
this.plexMediaKeysProxy.Start();
}
protected override void OnExit(ExitEventArgs e)
{
this.plexMediaKeysProxy.Dispose();
base.OnExit(e);
}
}
}
|
mit
|
C#
|
a8ff714e59c3b93421a1dd67cb4153d6504502db
|
Add a GetRootNode method, to match the interface of the sdk.
|
izrik/FbxSharp,izrik/FbxSharp,izrik/FbxSharp,izrik/FbxSharp,izrik/FbxSharp
|
Scene.cs
|
Scene.cs
|
using System;
using System.Collections.Generic;
namespace FbxSharp
{
public class Scene : Document
{
public Scene(string name="")
{
RootNode = new Node();
Nodes.Add(RootNode);
}
public List<Node> Nodes = new List<Node>();
public Node RootNode { get; protected set; }
public Node GetRootNode()
{
return RootNode;
}
}
}
|
using System;
using System.Collections.Generic;
namespace FbxSharp
{
public class Scene : Document
{
public Scene(string name="")
{
RootNode = new Node();
Nodes.Add(RootNode);
}
public List<Node> Nodes = new List<Node>();
public Node RootNode { get; protected set; }
}
}
|
lgpl-2.1
|
C#
|
76618d1d8e4632deb5cf96fe8c0803d8dec744e9
|
Update RegionFixAllProvider
|
DotNetAnalyzers/StyleCopAnalyzers
|
StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/RemoveRegionFixAllProvider.cs
|
StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/RemoveRegionFixAllProvider.cs
|
namespace StyleCop.Analyzers.ReadabilityRules
{
using System.Linq;
using System.Threading.Tasks;
using Helpers;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.Syntax;
internal sealed class RemoveRegionFixAllProvider : DocumentBasedFixAllProvider
{
protected override string CodeActionTitle => "Remove region";
protected override async Task<SyntaxNode> FixAllInDocumentAsync(FixAllContext fixAllContext, Document document)
{
var diagnostics = await fixAllContext.GetDocumentDiagnosticsAsync(document).ConfigureAwait(false);
SyntaxNode root = await document.GetSyntaxRootAsync().ConfigureAwait(false);
var nodesToRemove = diagnostics.Select(d => root.FindNode(d.Location.SourceSpan, findInsideTrivia: true))
.Where(node => node != null && !node.IsMissing)
.OfType<RegionDirectiveTriviaSyntax>()
.SelectMany(node => node.GetRelatedDirectives())
.Where(node => !node.IsMissing);
return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.AddElasticMarker);
}
}
}
|
namespace StyleCop.Analyzers.ReadabilityRules
{
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Helpers;
internal sealed class RemoveRegionFixAllProvider : DocumentBasedFixAllProvider
{
protected override string CodeActionTitle => "Remove region";
protected override async Task<SyntaxNode> FixAllInDocumentAsync(FixAllContext fixAllContext, Document document)
{
try
{
var diagnostics = await fixAllContext.GetDocumentDiagnosticsAsync(document).ConfigureAwait(false);
SyntaxNode root = await document.GetSyntaxRootAsync().ConfigureAwait(false);
var nodesToRemove = diagnostics.Select(d => root.FindNode(d.Location.SourceSpan, findInsideTrivia: true))
.Where(node => node != null && !node.IsMissing)
.OfType<RegionDirectiveTriviaSyntax>()
.SelectMany(node => node.GetRelatedDirectives())
.Where(node => !node.IsMissing);
return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.AddElasticMarker);
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
return null;
}
}
}
}
|
mit
|
C#
|
8da5f45b776008fdcc32aca423fc52e3fc14ffb1
|
Add GameRepoForSocketHandlers.RegisterChatMessage
|
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
|
src/ChessVariantsTraining/MemoryRepositories/Variant960/GameRepoForSocketHandlers.cs
|
src/ChessVariantsTraining/MemoryRepositories/Variant960/GameRepoForSocketHandlers.cs
|
using ChessDotNet;
using ChessVariantsTraining.DbRepositories.Variant960;
using ChessVariantsTraining.Models.Variant960;
using ChessVariantsTraining.Services;
using System.Collections.Generic;
namespace ChessVariantsTraining.MemoryRepositories.Variant960
{
public class GameRepoForSocketHandlers : IGameRepoForSocketHandlers
{
Dictionary<string, Game> cache = new Dictionary<string, Game>();
IGameRepository gameRepository;
IGameConstructor gameConstructor;
public GameRepoForSocketHandlers(IGameRepository _gameRepository, IGameConstructor _gameConstructor)
{
gameRepository = _gameRepository;
gameConstructor = _gameConstructor;
}
public Game Get(string id)
{
if (cache.ContainsKey(id))
{
return cache[id];
}
else
{
Game g = gameRepository.Get(id);
g.ChessGame = gameConstructor.Construct(g.ShortVariantName, g.LatestFEN);
cache[id] = g;
return cache[id];
}
}
public void RegisterMove(Game subject, Move move)
{
subject.ChessGame.ApplyMove(move, true);
subject.LatestFEN = subject.ChessGame.GetFen();
gameRepository.Update(subject);
}
public void RegisterGameOutcome(Game subject, string outcome)
{
subject.Outcome = outcome;
gameRepository.Update(subject);
}
public void RegisterChatMessage(Game subject, ChatMessage msg)
{
subject.Chats.Add(msg);
gameRepository.Update(subject);
}
}
}
|
using ChessDotNet;
using ChessVariantsTraining.DbRepositories.Variant960;
using ChessVariantsTraining.Models.Variant960;
using ChessVariantsTraining.Services;
using System.Collections.Generic;
namespace ChessVariantsTraining.MemoryRepositories.Variant960
{
public class GameRepoForSocketHandlers : IGameRepoForSocketHandlers
{
Dictionary<string, Game> cache = new Dictionary<string, Game>();
IGameRepository gameRepository;
IGameConstructor gameConstructor;
public GameRepoForSocketHandlers(IGameRepository _gameRepository, IGameConstructor _gameConstructor)
{
gameRepository = _gameRepository;
gameConstructor = _gameConstructor;
}
public Game Get(string id)
{
if (cache.ContainsKey(id))
{
return cache[id];
}
else
{
Game g = gameRepository.Get(id);
g.ChessGame = gameConstructor.Construct(g.ShortVariantName, g.LatestFEN);
cache[id] = g;
return cache[id];
}
}
public void RegisterMove(Game subject, Move move)
{
subject.ChessGame.ApplyMove(move, true);
subject.LatestFEN = subject.ChessGame.GetFen();
gameRepository.Update(subject);
}
public void RegisterGameOutcome(Game subject, string outcome)
{
subject.Outcome = outcome;
gameRepository.Update(subject);
}
}
}
|
agpl-3.0
|
C#
|
4baeb11badce77d7df525243f4b6d26e95f3afeb
|
Fix typo: ouath -> oauth
|
chunkychode/octokit.net,Sarmad93/octokit.net,shiftkey-tester/octokit.net,devkhan/octokit.net,octokit-net-test/octokit.net,editor-tools/octokit.net,M-Zuber/octokit.net,SmithAndr/octokit.net,ivandrofly/octokit.net,fake-organization/octokit.net,shiftkey/octokit.net,shana/octokit.net,TattsGroup/octokit.net,octokit-net-test-org/octokit.net,ChrisMissal/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,michaKFromParis/octokit.net,geek0r/octokit.net,dampir/octokit.net,mminns/octokit.net,eriawan/octokit.net,daukantas/octokit.net,editor-tools/octokit.net,Sarmad93/octokit.net,TattsGroup/octokit.net,octokit-net-test-org/octokit.net,rlugojr/octokit.net,gabrielweyer/octokit.net,SamTheDev/octokit.net,kdolan/octokit.net,dampir/octokit.net,gdziadkiewicz/octokit.net,alfhenrik/octokit.net,shiftkey-tester/octokit.net,octokit/octokit.net,devkhan/octokit.net,khellang/octokit.net,fffej/octokit.net,rlugojr/octokit.net,shana/octokit.net,darrelmiller/octokit.net,eriawan/octokit.net,SmithAndr/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,thedillonb/octokit.net,bslliw/octokit.net,M-Zuber/octokit.net,hahmed/octokit.net,SamTheDev/octokit.net,cH40z-Lord/octokit.net,hitesh97/octokit.net,nsnnnnrn/octokit.net,octokit/octokit.net,hahmed/octokit.net,dlsteuer/octokit.net,Red-Folder/octokit.net,magoswiat/octokit.net,kolbasov/octokit.net,adamralph/octokit.net,mminns/octokit.net,takumikub/octokit.net,ivandrofly/octokit.net,thedillonb/octokit.net,khellang/octokit.net,gdziadkiewicz/octokit.net,brramos/octokit.net,forki/octokit.net,naveensrinivasan/octokit.net,chunkychode/octokit.net,alfhenrik/octokit.net,shiftkey/octokit.net,nsrnnnnn/octokit.net,gabrielweyer/octokit.net,SLdragon1989/octokit.net
|
Octokit/Http/ApiInfo.cs
|
Octokit/Http/ApiInfo.cs
|
using System;
using System.Collections.Generic;
#if NET_45
using System.Collections.ObjectModel;
#endif
namespace Octokit
{
/// <summary>
/// Extra information returned as part of each api response.
/// </summary>
public class ApiInfo
{
public ApiInfo(IDictionary<string, Uri> links,
IList<string> oauthScopes,
IList<string> acceptedOauthScopes,
string etag,
RateLimit rateLimit)
{
Ensure.ArgumentNotNull(links, "links");
Ensure.ArgumentNotNull(oauthScopes, "oauthScopes");
Links = new ReadOnlyDictionary<string, Uri>(links);
OauthScopes = new ReadOnlyCollection<string>(oauthScopes);
AcceptedOauthScopes = new ReadOnlyCollection<string>(acceptedOauthScopes);
Etag = etag;
RateLimit = rateLimit;
}
/// <summary>
/// Oauth scopes that were included in the token used to make the request.
/// </summary>
public IReadOnlyList<string> OauthScopes { get; private set; }
/// <summary>
/// Oauth scopes accepted for this particular call.
/// </summary>
public IReadOnlyList<string> AcceptedOauthScopes { get; private set; }
/// <summary>
/// Etag
/// </summary>
public string Etag { get; private set; }
/// <summary>
/// Links to things like next/previous pages
/// </summary>
public IReadOnlyDictionary<string, Uri> Links { get; private set; }
/// <summary>
/// Information about the API rate limit
/// </summary>
public RateLimit RateLimit { get; private set; }
}
}
|
using System;
using System.Collections.Generic;
#if NET_45
using System.Collections.ObjectModel;
#endif
namespace Octokit
{
/// <summary>
/// Extra information returned as part of each api response.
/// </summary>
public class ApiInfo
{
public ApiInfo(IDictionary<string, Uri> links,
IList<string> oauthScopes,
IList<string> acceptedOauthScopes,
string etag,
RateLimit rateLimit)
{
Ensure.ArgumentNotNull(links, "links");
Ensure.ArgumentNotNull(oauthScopes, "ouathScopes");
Links = new ReadOnlyDictionary<string, Uri>(links);
OauthScopes = new ReadOnlyCollection<string>(oauthScopes);
AcceptedOauthScopes = new ReadOnlyCollection<string>(acceptedOauthScopes);
Etag = etag;
RateLimit = rateLimit;
}
/// <summary>
/// Oauth scopes that were included in the token used to make the request.
/// </summary>
public IReadOnlyList<string> OauthScopes { get; private set; }
/// <summary>
/// Oauth scopes accepted for this particular call.
/// </summary>
public IReadOnlyList<string> AcceptedOauthScopes { get; private set; }
/// <summary>
/// Etag
/// </summary>
public string Etag { get; private set; }
/// <summary>
/// Links to things like next/previous pages
/// </summary>
public IReadOnlyDictionary<string, Uri> Links { get; private set; }
/// <summary>
/// Information about the API rate limit
/// </summary>
public RateLimit RateLimit { get; private set; }
}
}
|
mit
|
C#
|
59df84caea6e0c80092428719afae4491f9cb4f8
|
Fix template build failure
|
smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework
|
osu.Framework.Templates/templates/template-flappy/FlappyDon.Game/FlappyDonGameBase.cs
|
osu.Framework.Templates/templates/template-flappy/FlappyDon.Game/FlappyDonGameBase.cs
|
using FlappyDon.Resources;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osuTK.Graphics.ES30;
namespace FlappyDon.Game
{
/// <summary>
/// Set up the relevant resource stores and texture settings.
/// </summary>
public abstract class FlappyDonGameBase : osu.Framework.Game
{
private TextureStore textures;
private DependencyContainer dependencies;
[BackgroundDependencyLoader]
private void load()
{
// Load the assets from our Resources project
Resources.AddStore(new DllResourceStore(FlappyDonResources.ResourceAssembly));
// To preserve the 8-bit aesthetic, disable texture filtering
// so they won't become blurry when upscaled
textures = new TextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore<byte[]>(Resources, @"Textures")), filteringMode: All.Nearest);
dependencies.Cache(textures);
}
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
}
}
|
using FlappyDon.Resources;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osuTK.Graphics.ES30;
namespace FlappyDon.Game
{
/// <summary>
/// Set up the relevant resource stores and texture settings.
/// </summary>
public abstract class FlappyDonGameBase : osu.Framework.Game
{
private TextureStore textures;
private DependencyContainer dependencies;
[BackgroundDependencyLoader]
private void load()
{
// Load the assets from our Resources project
Resources.AddStore(new DllResourceStore(FlappyDonResources.ResourceAssembly));
// To preserve the 8-bit aesthetic, disable texture filtering
// so they won't become blurry when upscaled
textures = new TextureStore(Textures, filteringMode: All.Nearest);
dependencies.Cache(textures);
}
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
}
}
|
mit
|
C#
|
dbe5a9d2065c437d0c0cd83909fd9695ecb985db
|
Implement 3-ways quick sort
|
cschen1205/cs-algorithms,cschen1205/cs-algorithms
|
Algorithms/Sorting/ThreeWayQuickSort.cs
|
Algorithms/Sorting/ThreeWayQuickSort.cs
|
using System;
using Algorithms.Utils;
namespace Algorithms.Sorting
{
public class ThreeWayQuickSort
{
public static void Sort<T>(T[] a) where T : IComparable<T>
{
Sort(a, 0, a.Length-1, (a1, a2) => a1.CompareTo(a2));
}
public static void Sort<T>(T[] a, int lo, int hi, Comparison<T> compare)
{
if (lo >= hi)
{
return;
}
if (hi - lo < 7)
{
InsertionSort.Sort(a, lo, hi, compare);
return;
}
int i = lo, lt = lo, gt = hi;
while (i < gt)
{
if (SortUtil.IsLessThan(a[lo], a[lt], compare))
{
SortUtil.Exchange(a, i++, lt++);
}
if (SortUtil.IsLessThan(a[gt], a[lo], compare))
{
SortUtil.Exchange(a, i, gt--);
}
}
Sort(a, lo, lt-1, compare);
Sort(a, gt+1, hi, compare);
}
}
}
|
using System;
using Algorithms.Utils;
namespace Algorithms.Sorting
{
public class ThreeWayQuickSort
{
public static void Sort<T>(T[] a) where T : IComparable<T>
{
Sort(a, 0, a.Length-1, (a1, a2) => a1.CompareTo(a2));
}
public static void Sort<T>(T[] a, int lo, int hi, Comparison<T> compare)
{
if (lo >= hi)
{
return;
}
if (hi - lo < 7)
{
InsertionSort.Sort(a, lo, hi, compare);
return;
}
int i = lo, lt = lo, gt = hi;
while (i < gt)
{
if (SortUtil.IsLessThan(a[lo], a[lt], compare))
{
SortUtil.Exchange(a, i++, lt++);
}
if (SortUtil.IsLessThan(a[gt], a[lo], compare))
{
SortUtil.Exchange(a, i, gt--);
}
}
Sort(a, lo, lt-1, compare);
Sort(a, gt+1, hi, compare);
}
}
}
|
mit
|
C#
|
7db148b820e178cf79ce4d4e921856a5c94d10b2
|
Bump version
|
nixxquality/GitHubUpdate
|
GitHubUpdate/Properties/AssemblyInfo.cs
|
GitHubUpdate/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GitHub Update Check")]
[assembly: AssemblyDescription("Easily check if your program is up to date, using GitHub Releases")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("nixx quality")]
[assembly: AssemblyProduct("GitHubUpdate")]
[assembly: AssemblyCopyright("Copyright © nixx quality 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("747a3829-ff9f-461e-8dbb-e606e98fa25e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GitHub Update Check")]
[assembly: AssemblyDescription("Easily check if your program is up to date, using GitHub Releases")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("nixx quality")]
[assembly: AssemblyProduct("GitHubUpdate")]
[assembly: AssemblyCopyright("Copyright © nixx quality 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("747a3829-ff9f-461e-8dbb-e606e98fa25e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
|
mit
|
C#
|
e850d63ac1a45312bc71a180a18119b823f9c54e
|
modify home/index with day3 homework rule
|
hatelove/MyMvcHomework,hatelove/MyMvcHomework,hatelove/MyMvcHomework
|
MyMoney/MyMoney/Views/Home/Index.cshtml
|
MyMoney/MyMoney/Views/Home/Index.cshtml
|
@{
ViewBag.Title = "Home Page";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Day3 homework</h2>
<ul>
<li>必須新增進DB中</li>
<li>
所有欄位必填
<ul>
<li>金額只能輸入正整數</li>
<li>日期不得大於今天</li>
<li>備註最大長度100字元</li>
</ul>
</li>
<li>
列表加入顏色變換
<ul>
<li>類型的支出,顯示為紅色</li>
<li>類型的收入,顯示為藍色</li>
</ul>
</li>
</ul>
<p>
@Html.ActionLink("記帳本由此去", "Add", "Accounting")
</p>
</div>
<div class="col-md-4">
<h2>Getting started</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a></p>
</div>
</div>
|
@{
ViewBag.Title = "Home Page";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Day2 homework</h2>
<p>
實際透過DB來存取記帳本資料
</p>
<p>
@Html.ActionLink("記帳本由此去", "Add", "Accounting")
</p>
</div>
<div class="col-md-4">
<h2>Getting started</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a></p>
</div>
</div>
|
mit
|
C#
|
128118cd783b070a03fcce4b9832ac85df20b5ed
|
Use linq expression to create dictionary
|
TattsGroup/octokit.net,rlugojr/octokit.net,shana/octokit.net,eriawan/octokit.net,shana/octokit.net,khellang/octokit.net,Sarmad93/octokit.net,octokit/octokit.net,dampir/octokit.net,rlugojr/octokit.net,gabrielweyer/octokit.net,alfhenrik/octokit.net,SamTheDev/octokit.net,thedillonb/octokit.net,khellang/octokit.net,octokit/octokit.net,ivandrofly/octokit.net,hahmed/octokit.net,hahmed/octokit.net,SamTheDev/octokit.net,SmithAndr/octokit.net,shiftkey-tester/octokit.net,shiftkey/octokit.net,thedillonb/octokit.net,eriawan/octokit.net,gdziadkiewicz/octokit.net,editor-tools/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,chunkychode/octokit.net,gabrielweyer/octokit.net,TattsGroup/octokit.net,adamralph/octokit.net,dampir/octokit.net,gdziadkiewicz/octokit.net,shiftkey/octokit.net,SmithAndr/octokit.net,alfhenrik/octokit.net,chunkychode/octokit.net,ivandrofly/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,devkhan/octokit.net,M-Zuber/octokit.net,Sarmad93/octokit.net,devkhan/octokit.net,M-Zuber/octokit.net,octokit-net-test-org/octokit.net,editor-tools/octokit.net,octokit-net-test-org/octokit.net,shiftkey-tester/octokit.net
|
Octokit/Helpers/CollectionExtensions.cs
|
Octokit/Helpers/CollectionExtensions.cs
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace Octokit
{
internal static class CollectionExtensions
{
public static TValue SafeGet<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)
{
Ensure.ArgumentNotNull(dictionary, "dictionary");
TValue value;
return dictionary.TryGetValue(key, out value) ? value : default(TValue);
}
public static IList<string> Clone(this IReadOnlyList<string> input)
{
if (input == null)
return null;
return input.Select(item => new String(item.ToCharArray())).ToList();
}
public static IDictionary<string, Uri> Clone(this IReadOnlyDictionary<string, Uri> input)
{
if (input == null)
return null;
return input.ToDictionary(item => new String(item.Key.ToCharArray()), item => new Uri(item.Value.ToString()));
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace Octokit
{
internal static class CollectionExtensions
{
public static TValue SafeGet<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)
{
Ensure.ArgumentNotNull(dictionary, "dictionary");
TValue value;
return dictionary.TryGetValue(key, out value) ? value : default(TValue);
}
public static IList<string> Clone(this IReadOnlyList<string> input)
{
List<string> output = null;
if (input == null)
return output;
output = new List<string>();
foreach (var item in input)
{
output.Add(new String(item.ToCharArray()));
}
return output;
}
public static IDictionary<string, Uri> Clone(this IReadOnlyDictionary<string, Uri> input)
{
Dictionary<string, Uri> output = null;
if (input == null)
return output;
output = new Dictionary<string, Uri>();
foreach (var item in input)
{
output.Add(new String(item.Key.ToCharArray()), new Uri(item.Value.ToString()));
}
return output;
}
}
}
|
mit
|
C#
|
a33ea0a50bf4c830bf15a2bf6c8b5c575f290366
|
bump version number
|
martin2250/OpenCNCPilot
|
OpenCNCPilot/Properties/AssemblyInfo.cs
|
OpenCNCPilot/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// 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("OpenCNCPilot")]
[assembly: AssemblyDescription("GCode Sender and AutoLeveller")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("martin2250")]
[assembly: AssemblyProduct("OpenCNCPilot")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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.5.7.0")]
[assembly: AssemblyFileVersion("1.5.7.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// 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("OpenCNCPilot")]
[assembly: AssemblyDescription("GCode Sender and AutoLeveller")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("martin2250")]
[assembly: AssemblyProduct("OpenCNCPilot")]
[assembly: AssemblyCopyright("Copyright ©martin2250 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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.5.6.0")]
[assembly: AssemblyFileVersion("1.5.6.0")]
|
mit
|
C#
|
29bc3d08d8ef30970945e65e97a4922ffd7c3e0f
|
Use String.IsNullOrEmpty
|
mono/dbus-sharp,openmedicus/dbus-sharp,mono/dbus-sharp,arfbtwn/dbus-sharp,openmedicus/dbus-sharp,arfbtwn/dbus-sharp,Tragetaschen/dbus-sharp,Tragetaschen/dbus-sharp
|
src/Address.cs
|
src/Address.cs
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
namespace NDesk.DBus
{
public class Address
{
//this method is not pretty
//not worth improving until there is a spec for this format
//TODO: confirm that return value represents parse errors
public static bool Parse (string addr, out string path, out bool abstr)
{
//(unix:(path|abstract)=.*,guid=.*|tcp:host=.*(,port=.*)?);? ...
path = null;
abstr = false;
if (String.IsNullOrEmpty (addr))
return false;
string[] parts;
parts = addr.Split (':');
if (parts[0] == "unix") {
parts = parts[1].Split (',');
parts = parts[0].Split ('=');
if (parts[0] == "path")
abstr = false;
else if (parts[0] == "abstract")
abstr = true;
else
return false;
path = parts[1];
} else {
return false;
}
return true;
}
}
}
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
namespace NDesk.DBus
{
public class Address
{
//this method is not pretty
//not worth improving until there is a spec for this format
//TODO: confirm that return value represents parse errors
public static bool Parse (string addr, out string path, out bool abstr)
{
//(unix:(path|abstract)=.*,guid=.*|tcp:host=.*(,port=.*)?);? ...
path = null;
abstr = false;
if (addr == null || addr == "")
return false;
string[] parts;
parts = addr.Split (':');
if (parts[0] == "unix") {
parts = parts[1].Split (',');
parts = parts[0].Split ('=');
if (parts[0] == "path")
abstr = false;
else if (parts[0] == "abstract")
abstr = true;
else
return false;
path = parts[1];
} else {
return false;
}
return true;
}
}
}
|
mit
|
C#
|
7eac001dcdaf7d595808699b1491e45f5992bf63
|
bump version
|
Dalet/140-speedrun-timer,Dalet/140-speedrun-timer,Dalet/140-speedrun-timer
|
SharedAssemblyInfo.cs
|
SharedAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyVersion("0.7.3.6")]
[assembly: AssemblyFileVersion("0.7.3.6")]
|
using System.Reflection;
[assembly: AssemblyVersion("0.7.3.5")]
[assembly: AssemblyFileVersion("0.7.3.5")]
|
unlicense
|
C#
|
900ca8f5ed955edfb991b0c7c0c518f1785618d8
|
Fix for OrderedEnumerable null comparer
|
theraot/Theraot
|
Core/Theraot/Core/OrderedEnumerable.cs
|
Core/Theraot/Core/OrderedEnumerable.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Theraot.Collections;
namespace Theraot.Core
{
public class OrderedEnumerable<TElement, TKey> : IOrderedEnumerable<TElement>
{
private readonly IComparer<TKey> _comparer;
private readonly Func<TElement, TKey> _selector;
private readonly IEnumerable<TElement> _source;
public OrderedEnumerable(IEnumerable<TElement> source, Func<TElement, TKey> keySelector, IComparer<TKey> comparer)
{
_comparer = comparer ?? Comparer<TKey>.Default;
_source = Check.NotNullArgument(source, "source");
_selector = Check.NotNullArgument(keySelector, "keySelector");
}
public IOrderedEnumerable<TElement> CreateOrderedEnumerable<TNewKey>(Func<TElement, TNewKey> keySelector, IComparer<TNewKey> comparer, bool descending)
{
comparer = comparer ?? Comparer<TNewKey>.Default;
if (descending)
{
comparer = comparer.Reverse();
}
return new OrderedEnumerable<TElement, TNewKey>(_source, keySelector, comparer);
}
public IEnumerator<TElement> GetEnumerator()
{
return Sort(_source).GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
private IEnumerable<TElement> Sort(IEnumerable<TElement> source)
{
var list = new SortedList<TKey, TElement>(_comparer);
foreach (var item in source)
{
list.Add(_selector.Invoke(item), item);
}
return list.ConvertProgressive(input => input.Value);
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Theraot.Collections;
namespace Theraot.Core
{
public class OrderedEnumerable<TElement, TKey> : IOrderedEnumerable<TElement>
{
private readonly IComparer<TKey> _comparer;
private readonly Func<TElement, TKey> _selector;
private readonly IEnumerable<TElement> _source;
public OrderedEnumerable(IEnumerable<TElement> source, Func<TElement, TKey> keySelector, IComparer<TKey> comparer)
{
_source = Check.NotNullArgument(source, "source");
_selector = Check.NotNullArgument(keySelector, "keySelector");
_comparer = Check.NotNullArgument(comparer, "comparer");
}
public IOrderedEnumerable<TElement> CreateOrderedEnumerable<TNewKey>(Func<TElement, TNewKey> keySelector, IComparer<TNewKey> comparer, bool descending)
{
comparer = comparer ?? Comparer<TNewKey>.Default;
if (descending)
{
comparer = comparer.Reverse();
}
return new OrderedEnumerable<TElement, TNewKey>(_source, keySelector, comparer);
}
public IEnumerator<TElement> GetEnumerator()
{
return Sort(_source).GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
private IEnumerable<TElement> Sort(IEnumerable<TElement> source)
{
var list = new SortedList<TKey, TElement>(_comparer);
foreach (var item in source)
{
list.Add(_selector.Invoke(item), item);
}
return list.ConvertProgressive(input => input.Value);
}
}
}
|
mit
|
C#
|
1e579aacedc3d81a7e537f23f71986cbb7974f95
|
Update TermsViewModels
|
lucasdavid/Gamedalf,lucasdavid/Gamedalf
|
Gamedalf/ViewModels/TermsViewModels.cs
|
Gamedalf/ViewModels/TermsViewModels.cs
|
using Gamedalf.Core.Attributes;
using System.ComponentModel.DataAnnotations;
namespace Gamedalf.ViewModels
{
public class TermsCreateViewModel
{
[Required]
[StringLength(100, MinimumLength = 1)]
public string Title { get; set; }
[Required]
public string Content { get; set; }
}
public class TermsEditViewModel
{
public int Id { get; set; }
public string Title { get; set; }
[Required]
public string Content { get; set; }
}
public class AcceptTermsViewModel
{
[EnforceTrue]
[Display(Name = "I hereby accept the presented terms")]
public bool AcceptTerms { get; set; }
}
}
|
using System.ComponentModel.DataAnnotations;
namespace Gamedalf.ViewModels
{
public class TermsCreateViewModel
{
[Required]
[StringLength(100, MinimumLength = 1)]
public string Title { get; set; }
[Required]
public string Content { get; set; }
}
public class TermsEditViewModel
{
public int Id { get; set; }
public string Title { get; set; }
[Required]
public string Content { get; set; }
}
public class TermsGroupViewModel
{
//
}
}
|
mit
|
C#
|
3d093e80d4ee21acb1c7e0956f981f75ce25274c
|
Fix the type returned by project.Properties.
|
srivatsn/MSBuildSdkDiffer
|
MSBuildSdkDiffer/src/MSBuildProject.cs
|
MSBuildSdkDiffer/src/MSBuildProject.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Build.Evaluation;
namespace MSBuildSdkDiffer
{
/// <summary>
/// Interface used to Mock access to MSBuild's Project apis.
/// </summary>
public interface IProject
{
ICollection<IProjectProperty> Properties { get; }
ICollection<IProjectItem> Items { get; }
IProjectProperty GetProperty(string name);
string GetPropertyValue(string name);
}
public interface IProjectProperty
{
string Name { get; }
string EvaluatedValue { get; }
}
public interface IProjectItem
{
string ItemType { get; }
string EvaluatedInclude { get; }
}
internal class MSBuildProjectProperty : IProjectProperty
{
private readonly ProjectProperty _property;
public MSBuildProjectProperty(ProjectProperty property)
{
_property = property;
}
public string Name => _property.Name;
public string EvaluatedValue => _property.EvaluatedValue;
}
internal class MSBuildProjectItem : IProjectItem
{
private readonly ProjectItem _item;
public MSBuildProjectItem(ProjectItem item)
{
_item = item;
}
public string ItemType => _item.ItemType;
public string EvaluatedInclude => _item.EvaluatedInclude;
}
internal class MSBuildProject : IProject
{
private readonly Project _project;
public MSBuildProject(Project project) => _project = project ?? throw new ArgumentNullException(nameof(project));
public ICollection<IProjectProperty> Properties => _project.Properties.Select(p => new MSBuildProjectProperty(p)).ToArray();
public ICollection<IProjectItem> Items => _project.Items.Select(i => new MSBuildProjectItem(i)).ToArray();
public IProjectProperty GetProperty(string name) => new MSBuildProjectProperty(_project.GetProperty(name));
public string GetPropertyValue(string name) => _project.GetPropertyValue(name);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Build.Evaluation;
namespace MSBuildSdkDiffer
{
/// <summary>
/// Interface used to Mock access to MSBuild's Project apis.
/// </summary>
public interface IProject
{
ICollection<ProjectProperty> Properties { get; }
ICollection<IProjectItem> Items { get; }
IProjectProperty GetProperty(string name);
string GetPropertyValue(string name);
}
public interface IProjectProperty
{
string Name { get; }
string EvaluatedValue { get; }
}
public interface IProjectItem
{
string ItemType { get; }
string EvaluatedInclude { get; }
}
internal class MSBuildProjectProperty : IProjectProperty
{
private readonly ProjectProperty _property;
public MSBuildProjectProperty(ProjectProperty property)
{
_property = property;
}
public string Name => _property.Name;
public string EvaluatedValue => _property.EvaluatedValue;
}
internal class MSBuildProjectItem : IProjectItem
{
private readonly ProjectItem _item;
public MSBuildProjectItem(ProjectItem item)
{
_item = item;
}
public string ItemType => _item.ItemType;
public string EvaluatedInclude => _item.EvaluatedInclude;
}
internal class MSBuildProject : IProject
{
private readonly Project _project;
public MSBuildProject(Project project) => _project = project ?? throw new ArgumentNullException(nameof(project));
public ICollection<ProjectProperty> Properties => _project.Properties;
public ICollection<IProjectItem> Items => _project.Items.Select(i => new MSBuildProjectItem(i)).ToArray();
public IProjectProperty GetProperty(string name) => new MSBuildProjectProperty(_project.GetProperty(name));
public string GetPropertyValue(string name) => _project.GetPropertyValue(name);
}
}
|
mit
|
C#
|
24dd60127b91b07d64920ab0e63cf7bd439ec0be
|
Fix build for Net 4.0
|
Oceanswave/NiL.JS,nilproject/NiL.JS,nilproject/NiL.JS,Oceanswave/NiL.JS,nilproject/NiL.JS,Oceanswave/NiL.JS
|
NiL.JS/Expressions/ConvertToInteger.cs
|
NiL.JS/Expressions/ConvertToInteger.cs
|
using System;
using System.Collections.Generic;
using System.Reflection;
using NiL.JS.Core;
#if NET40
using NiL.JS.Backward;
#endif
namespace NiL.JS.Expressions
{
#if !(PORTABLE || NETCORE)
[Serializable]
#endif
public sealed class ConvertToInteger : Expression
{
protected internal override PredictedType ResultType
{
get
{
return PredictedType.Int;
}
}
internal override bool ResultInTempContainer
{
get { return true; }
}
public ConvertToInteger(Expression first)
: base(first, null, true)
{
}
public override JSValue Evaluate(Context context)
{
var t = first.Evaluate(context);
if (t._valueType == JSValueType.Integer)
tempContainer._iValue = t._iValue;
else
tempContainer._iValue = Tools.JSObjectToInt32(t, 0, false);
tempContainer._valueType = JSValueType.Integer;
return tempContainer;
}
#if !PORTABLE
internal override System.Linq.Expressions.Expression TryCompile(bool selfCompile, bool forAssign, Type expectedType, List<CodeNode> dynamicValues)
{
var st = first.TryCompile(false, false, typeof(int), dynamicValues);
if (st == null)
return null;
if (st.Type == typeof(int))
return st;
if (st.Type == typeof(bool))
return System.Linq.Expressions.Expression.Condition(st, System.Linq.Expressions.Expression.Constant(1), System.Linq.Expressions.Expression.Constant(0));
if (st.Type == typeof(double))
return System.Linq.Expressions.Expression.Convert(st, typeof(double));
return System.Linq.Expressions.Expression.Call(new Func<object, int>(Convert.ToInt32).GetMethodInfo(), st);
}
#endif
public override T Visit<T>(Visitor<T> visitor)
{
return visitor.Visit(this);
}
public override string ToString()
{
return "(" + first + " | 0)";
}
}
}
|
using System;
using System.Collections.Generic;
using NiL.JS.Core;
using System.Reflection;
namespace NiL.JS.Expressions
{
#if !(PORTABLE || NETCORE)
[Serializable]
#endif
public sealed class ConvertToInteger : Expression
{
protected internal override PredictedType ResultType
{
get
{
return PredictedType.Int;
}
}
internal override bool ResultInTempContainer
{
get { return true; }
}
public ConvertToInteger(Expression first)
: base(first, null, true)
{
}
public override JSValue Evaluate(Context context)
{
var t = first.Evaluate(context);
if (t._valueType == JSValueType.Integer)
tempContainer._iValue = t._iValue;
else
tempContainer._iValue = Tools.JSObjectToInt32(t, 0, false);
tempContainer._valueType = JSValueType.Integer;
return tempContainer;
}
#if !PORTABLE
internal override System.Linq.Expressions.Expression TryCompile(bool selfCompile, bool forAssign, Type expectedType, List<CodeNode> dynamicValues)
{
var st = first.TryCompile(false, false, typeof(int), dynamicValues);
if (st == null)
return null;
if (st.Type == typeof(int))
return st;
if (st.Type == typeof(bool))
return System.Linq.Expressions.Expression.Condition(st, System.Linq.Expressions.Expression.Constant(1), System.Linq.Expressions.Expression.Constant(0));
if (st.Type == typeof(double))
return System.Linq.Expressions.Expression.Convert(st, typeof(double));
return System.Linq.Expressions.Expression.Call(new Func<object, int>(Convert.ToInt32).GetMethodInfo(), st);
}
#endif
public override T Visit<T>(Visitor<T> visitor)
{
return visitor.Visit(this);
}
public override string ToString()
{
return "(" + first + " | 0)";
}
}
}
|
bsd-3-clause
|
C#
|
c32a606a7064aef784f9042604b0af16d5d3e8b1
|
add memory diagnoser
|
JTrotta/MQTTnet,JTrotta/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,JTrotta/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,JTrotta/MQTTnet
|
Tests/MQTTnet.Benchmarks/MessageProcessingBenchmark.cs
|
Tests/MQTTnet.Benchmarks/MessageProcessingBenchmark.cs
|
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Columns;
using BenchmarkDotNet.Attributes.Exporters;
using BenchmarkDotNet.Attributes.Jobs;
using MQTTnet.Client;
using MQTTnet.Server;
namespace MQTTnet.Benchmarks
{
[ClrJob]
[RPlotExporter, RankColumn]
[MemoryDiagnoser]
public class MessageProcessingBenchmark
{
private IMqttServer _mqttServer;
private IMqttClient _mqttClient;
private MqttApplicationMessage _message;
[GlobalSetup]
public void Setup()
{
var factory = new MqttFactory();
_mqttServer = factory.CreateMqttServer();
_mqttClient = factory.CreateMqttClient();
var serverOptions = new MqttServerOptionsBuilder().Build();
_mqttServer.StartAsync(serverOptions).GetAwaiter().GetResult();
var clientOptions = new MqttClientOptionsBuilder()
.WithTcpServer("localhost").Build();
_mqttClient.ConnectAsync(clientOptions).GetAwaiter().GetResult();
_message = new MqttApplicationMessageBuilder()
.WithTopic("A")
.Build();
}
[Benchmark]
public void Send_10000_Messages()
{
for (var i = 0; i < 10000; i++)
{
_mqttClient.PublishAsync(_message).GetAwaiter().GetResult();
}
}
}
}
|
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Columns;
using BenchmarkDotNet.Attributes.Exporters;
using BenchmarkDotNet.Attributes.Jobs;
using MQTTnet.Client;
using MQTTnet.Server;
namespace MQTTnet.Benchmarks
{
[ClrJob]
[RPlotExporter, RankColumn]
public class MessageProcessingBenchmark
{
private IMqttServer _mqttServer;
private IMqttClient _mqttClient;
private MqttApplicationMessage _message;
[GlobalSetup]
public void Setup()
{
var factory = new MqttFactory();
_mqttServer = factory.CreateMqttServer();
_mqttClient = factory.CreateMqttClient();
var serverOptions = new MqttServerOptionsBuilder().Build();
_mqttServer.StartAsync(serverOptions).GetAwaiter().GetResult();
var clientOptions = new MqttClientOptionsBuilder()
.WithTcpServer("localhost").Build();
_mqttClient.ConnectAsync(clientOptions).GetAwaiter().GetResult();
_message = new MqttApplicationMessageBuilder()
.WithTopic("A")
.Build();
}
[Benchmark]
public void Send_10000_Messages()
{
for (var i = 0; i < 10000; i++)
{
_mqttClient.PublishAsync(_message).GetAwaiter().GetResult();
}
}
}
}
|
mit
|
C#
|
c27a08792ef78571ff2be080445feb0c2ef40880
|
Update Configuration.cs
|
dlidstrom/Tasks,dlidstrom/Tasks,dlidstrom/Tasks
|
Tasks/Data/Migrations/Configuration.cs
|
Tasks/Data/Migrations/Configuration.cs
|
using System.Data.Entity.Migrations;
using Tasks.Data.Models;
namespace Tasks.Data.Migrations
{
internal sealed class Configuration : DbMigrationsConfiguration<Context>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
}
protected override void Seed(Context context)
{
// This method will be called after migrating to the latest version.
// You can use the DbSet<T>.AddOrUpdate() helper extension method
// to avoid creating duplicate seed data. E.g.
//
// context.People.AddOrUpdate(
// p => p.FullName,
// new Person { FullName = "Andrew Peters" },
// new Person { FullName = "Brice Lambson" },
// new Person { FullName = "Rowan Miller" }
// );
//
context.Persons.AddOrUpdate(
p => p.Name,
new Person("Daniel"),
new Person("Klas"),
new Person("Christoffer"),
new Person("Rickard"));
}
}
}
|
using System.Data.Entity.Migrations;
using Tasks.Data.Models;
namespace Tasks.Data.Migrations
{
internal sealed class Configuration : DbMigrationsConfiguration<Context>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
}
protected override void Seed(Context context)
{
// This method will be called after migrating to the latest version.
// You can use the DbSet<T>.AddOrUpdate() helper extension method
// to avoid creating duplicate seed data. E.g.
//
// context.People.AddOrUpdate(
// p => p.FullName,
// new Person { FullName = "Andrew Peters" },
// new Person { FullName = "Brice Lambson" },
// new Person { FullName = "Rowan Miller" }
// );
//
context.Persons.AddOrUpdate(
p => p.Name,
new Person("Daniel"),
new Person("Klas"),
new Person("Christoffer"));
}
}
}
|
mit
|
C#
|
efe250f5a2fd45ad96f3dca4be0cd092433b057b
|
Remove redundant 1* multiplier
|
BrandonLWhite/UnitsNet,anjdreas/UnitsNet,neutmute/UnitsNet,BoGrevyDynatest/UnitsNet,BrandonLWhite/UnitsNet,anjdreas/UnitsNet
|
UnitsNet.Tests/CustomCode/FlowTests.cs
|
UnitsNet.Tests/CustomCode/FlowTests.cs
|
// Copyright © 2007 by Initial Force AS. All rights reserved.
// https://github.com/InitialForce/UnitsNet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
namespace UnitsNet.Tests.CustomCode
{
public class FlowTests : FlowTestsBase
{
protected override double CubicMetersPerHourInOneCubicMeterPerSecond
{
get { return 3600.0; }
}
protected override double CubicFeetPerSecondInOneCubicMeterPerSecond
{
get { return 35.314666213; }
}
protected override double MillionUsGallonsPerDayInOneCubicMeterPerSecond
{
get { return 22.824465227; }
}
protected override double CubicMetersPerSecondInOneCubicMeterPerSecond
{
get { return 1; }
}
protected override double UsGallonsPerMinuteInOneCubicMeterPerSecond
{
get { return 15850.323141489; }
}
protected override double LitersPerMinuteInOneCubicMeterPerSecond
{
get { return 60000.00000; }
}
}
}
|
// Copyright © 2007 by Initial Force AS. All rights reserved.
// https://github.com/InitialForce/UnitsNet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
namespace UnitsNet.Tests.CustomCode
{
public class FlowTests : FlowTestsBase
{
protected override double CubicMetersPerHourInOneCubicMeterPerSecond
{
get { return 1*3600.0; }
}
protected override double CubicFeetPerSecondInOneCubicMeterPerSecond
{
get { return 1*35.314666213; }
}
protected override double MillionUsGallonsPerDayInOneCubicMeterPerSecond
{
get { return 1*22.824465227; }
}
protected override double CubicMetersPerSecondInOneCubicMeterPerSecond
{
get { return 1; }
}
protected override double UsGallonsPerMinuteInOneCubicMeterPerSecond
{
get { return 1 * 15850.323141489; }
}
protected override double LitersPerMinuteInOneCubicMeterPerSecond
{
get { return 1 * 60000.00000; }
}
}
}
|
mit
|
C#
|
bb95aae027e8d5286d3841876f369a3813331053
|
Update WalletWasabi.Packager/ArgsProcessor.cs
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Packager/ArgsProcessor.cs
|
WalletWasabi.Packager/ArgsProcessor.cs
|
#nullable enable
using System;
namespace WalletWasabi.Packager
{
/// <summary>
/// Class for processing program's command line arguments.
/// </summary>
public class ArgsProcessor
{
public ArgsProcessor(string[]? args)
{
if (args is null)
{
throw new ArgumentNullException(nameof(args));
}
Args = args;
}
public string[] Args { get; }
public bool IsReduceOnionsMode()
{
foreach (var arg in Args)
{
string value = arg.Trim().TrimStart('-');
if (value.Equals("reduceonions", StringComparison.OrdinalIgnoreCase)
|| value.Equals("reduceonion", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
public bool IsOnlyCreateDigestsMode()
{
foreach (var arg in Args)
{
string value = arg.Trim().TrimStart('-');
if (value.Equals("onlycreatedigests", StringComparison.OrdinalIgnoreCase)
|| value.Equals("onlycreatedigest", StringComparison.OrdinalIgnoreCase)
|| value.Equals("onlydigests", StringComparison.OrdinalIgnoreCase)
|| value.Equals("onlydigest", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
public bool IsOnlyBinariesMode()
{
foreach (var arg in Args)
{
if (arg.Trim().TrimStart('-').Equals("onlybinaries", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
public bool IsGetOnionsMode()
{
foreach (var arg in Args)
{
string value = arg.Trim().TrimStart('-');
if (value.Equals("getonions", StringComparison.OrdinalIgnoreCase)
|| value.Equals("getonion", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
}
}
|
#nullable enable
using System;
namespace WalletWasabi.Packager
{
/// <summary>
/// Class for processing program's command line arguments.
/// </summary>
public class ArgsProcessor
{
public ArgsProcessor(string[]? args)
{
if (args == null)
{
throw new ArgumentNullException(nameof(args));
}
Args = args;
}
public string[] Args { get; }
public bool IsReduceOnionsMode()
{
foreach (var arg in Args)
{
string value = arg.Trim().TrimStart('-');
if (value.Equals("reduceonions", StringComparison.OrdinalIgnoreCase)
|| value.Equals("reduceonion", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
public bool IsOnlyCreateDigestsMode()
{
foreach (var arg in Args)
{
string value = arg.Trim().TrimStart('-');
if (value.Equals("onlycreatedigests", StringComparison.OrdinalIgnoreCase)
|| value.Equals("onlycreatedigest", StringComparison.OrdinalIgnoreCase)
|| value.Equals("onlydigests", StringComparison.OrdinalIgnoreCase)
|| value.Equals("onlydigest", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
public bool IsOnlyBinariesMode()
{
foreach (var arg in Args)
{
if (arg.Trim().TrimStart('-').Equals("onlybinaries", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
public bool IsGetOnionsMode()
{
foreach (var arg in Args)
{
string value = arg.Trim().TrimStart('-');
if (value.Equals("getonions", StringComparison.OrdinalIgnoreCase)
|| value.Equals("getonion", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
}
}
|
mit
|
C#
|
ba748f9982f28908edb83f11526e739a0603badb
|
Make it static
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi/Wallets/PasswordFinder.cs
|
WalletWasabi/Wallets/PasswordFinder.cs
|
using NBitcoin;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security;
using System.Threading;
namespace WalletWasabi.Wallets
{
public static class PasswordFinder
{
public static readonly Dictionary<string, string> Charsets = new Dictionary<string, string>
{
["en"] = "abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
["es"] = "aábcdeéfghiíjkmnñoópqrstuúüvwxyzAÁBCDEÉFGHIÍJKLMNNOÓPQRSTUÚÜVWXYZ",
["pt"] = "aáàâābcçdeéêfghiíjkmnoóôōpqrstuúvwxyzAÁÀÂĀBCÇDEÉÊFGHIÍJKMNOÓÔŌPQRSTUÚVWXYZ",
["it"] = "abcdefghimnopqrstuvxyzABCDEFGHILMNOPQRSTUVXYZ",
["fr"] = "aâàbcçdæeéèëœfghiîïjkmnoôpqrstuùüvwxyÿzAÂÀBCÇDÆEÉÈËŒFGHIÎÏJKMNOÔPQRSTUÙÜVWXYŸZ",
};
public static bool TryFind(Wallet wallet, string language, bool useNumbers, bool useSymbols, string likelyPassword, Action<int, TimeSpan> reportPercentage, out string? foundPassword, CancellationToken cancellationToken = default)
{
foundPassword = null;
BitcoinEncryptedSecretNoEC encryptedSecret = wallet.KeyManager.EncryptedSecret;
var charset = Charsets[language] + (useNumbers ? "0123456789" : "") + (useSymbols ? "|!¡@$¿?_-\"#$/%&()´+*=[]{},;:.^`<>" : "");
var attempts = 0;
var maxNumberAttempts = likelyPassword.Length * charset.Length;
Stopwatch sw = Stopwatch.StartNew();
foreach (var pwd in GeneratePasswords(likelyPassword, charset.ToArray()))
{
cancellationToken.ThrowIfCancellationRequested();
try
{
encryptedSecret.GetKey(pwd);
foundPassword = pwd;
return true;
}
catch (SecurityException)
{
}
attempts++;
var percentage = (int)((float)attempts / maxNumberAttempts * 100);
var remainingTime = sw.Elapsed / percentage * (100 - percentage);
reportPercentage?.Invoke(percentage, remainingTime);
}
return false;
}
private static IEnumerable<string> GeneratePasswords(string password, char[] charset)
{
var pwChar = password.ToCharArray();
for (var i = 0; i < pwChar.Length; i++)
{
var original = pwChar[i];
foreach (var c in charset)
{
pwChar[i] = c;
yield return new string(pwChar);
}
pwChar[i] = original;
}
}
}
}
|
using NBitcoin;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security;
using System.Threading;
namespace WalletWasabi.Wallets
{
public class PasswordFinder
{
public static readonly Dictionary<string, string> Charsets = new Dictionary<string, string>
{
["en"] = "abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
["es"] = "aábcdeéfghiíjkmnñoópqrstuúüvwxyzAÁBCDEÉFGHIÍJKLMNNOÓPQRSTUÚÜVWXYZ",
["pt"] = "aáàâābcçdeéêfghiíjkmnoóôōpqrstuúvwxyzAÁÀÂĀBCÇDEÉÊFGHIÍJKMNOÓÔŌPQRSTUÚVWXYZ",
["it"] = "abcdefghimnopqrstuvxyzABCDEFGHILMNOPQRSTUVXYZ",
["fr"] = "aâàbcçdæeéèëœfghiîïjkmnoôpqrstuùüvwxyÿzAÂÀBCÇDÆEÉÈËŒFGHIÎÏJKMNOÔPQRSTUÙÜVWXYŸZ",
};
public static bool TryFind(Wallet wallet, string language, bool useNumbers, bool useSymbols, string likelyPassword, Action<int, TimeSpan> reportPercentage, out string? foundPassword, CancellationToken cancellationToken = default)
{
foundPassword = null;
BitcoinEncryptedSecretNoEC encryptedSecret = wallet.KeyManager.EncryptedSecret;
var charset = Charsets[language] + (useNumbers ? "0123456789" : "") + (useSymbols ? "|!¡@$¿?_-\"#$/%&()´+*=[]{},;:.^`<>" : "");
var attempts = 0;
var maxNumberAttempts = likelyPassword.Length * charset.Length;
Stopwatch sw = Stopwatch.StartNew();
foreach (var pwd in GeneratePasswords(likelyPassword, charset.ToArray()))
{
cancellationToken.ThrowIfCancellationRequested();
try
{
encryptedSecret.GetKey(pwd);
foundPassword = pwd;
return true;
}
catch (SecurityException)
{
}
attempts++;
var percentage = (int)((float)attempts / maxNumberAttempts * 100);
var remainingTime = sw.Elapsed / percentage * (100 - percentage);
reportPercentage?.Invoke(percentage, remainingTime);
}
return false;
}
private static IEnumerable<string> GeneratePasswords(string password, char[] charset)
{
var pwChar = password.ToCharArray();
for (var i = 0; i < pwChar.Length; i++)
{
var original = pwChar[i];
foreach (var c in charset)
{
pwChar[i] = c;
yield return new string(pwChar);
}
pwChar[i] = original;
}
}
}
}
|
mit
|
C#
|
09704d8e5f2f65f301ea63042de0f51247665c20
|
Make internals visible to test assembly
|
MSayfullin/Basics
|
Basics.Algorithms/Properties/AssemblyInfo.cs
|
Basics.Algorithms/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
// 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("Basics Algorithms")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("Basics.Algorithms.Tests")]
|
using System.Reflection;
// 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("Basics Algorithms")]
[assembly: AssemblyCulture("")]
|
mit
|
C#
|
8a6b3327e3e637170ce3a7812868fbf2a3864181
|
Use prepared http client to build odata client.
|
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
|
src/CSharpClient/Bit.CSharpClient.OData/ViewModel/Extensions/ContainerBuilderExtensions.cs
|
src/CSharpClient/Bit.CSharpClient.OData/ViewModel/Extensions/ContainerBuilderExtensions.cs
|
using Autofac;
using Bit.ViewModel.Contracts;
using Simple.OData.Client;
using System;
using System.Net.Http;
namespace Prism.Ioc
{
public static class ContainerBuilderExtensions
{
public static ContainerBuilder RegisterODataClient(this ContainerBuilder containerBuilder)
{
if (containerBuilder == null)
throw new ArgumentNullException(nameof(containerBuilder));
Simple.OData.Client.V4Adapter.Reference();
containerBuilder.Register(c =>
{
IClientAppProfile clientAppProfile = c.Resolve<IClientAppProfile>();
IODataClient odataClient = new ODataClient(new ODataClientSettings(httpClient: c.Resolve<HttpClient>(), new Uri(clientAppProfile.ODataRoute, uriKind: UriKind.Relative))
{
RenewHttpConnection = false
});
return odataClient;
}).PreserveExistingDefaults();
containerBuilder
.Register(c => new ODataBatch(c.Resolve<IODataClient>(), reuseSession: true))
.PreserveExistingDefaults();
return containerBuilder;
}
}
}
|
using Autofac;
using Bit.ViewModel.Contracts;
using Simple.OData.Client;
using System;
using System.Net.Http;
namespace Prism.Ioc
{
public static class ContainerBuilderExtensions
{
public static ContainerBuilder RegisterODataClient(this ContainerBuilder containerBuilder)
{
if (containerBuilder == null)
throw new ArgumentNullException(nameof(containerBuilder));
Simple.OData.Client.V4Adapter.Reference();
containerBuilder.Register(c =>
{
HttpMessageHandler authenticatedHttpMessageHandler = c.ResolveNamed<HttpMessageHandler>(ContractKeys.AuthenticatedHttpMessageHandler);
IClientAppProfile clientAppProfile = c.Resolve<IClientAppProfile>();
IODataClient odataClient = new ODataClient(new ODataClientSettings(new Uri(clientAppProfile.HostUri, clientAppProfile.ODataRoute))
{
RenewHttpConnection = false,
OnCreateMessageHandler = () => authenticatedHttpMessageHandler
});
return odataClient;
}).PreserveExistingDefaults();
containerBuilder
.Register(c => new ODataBatch(c.Resolve<IODataClient>(), reuseSession: true))
.PreserveExistingDefaults();
return containerBuilder;
}
}
}
|
mit
|
C#
|
6ea6c55f133f7f62c186a82ba5d8486c4a392f03
|
Update Home.cs
|
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
|
Test/NakedObjects.Rest.Test.EndToEnd/Home.cs
|
Test/NakedObjects.Rest.Test.EndToEnd/Home.cs
|
// Copyright © Naked Objects Group Ltd ( http://www.nakedobjects.net).
// All Rights Reserved. This code released under the terms of the
// Microsoft Public License (MS-PL) ( http://opensource.org/licenses/ms-pl.html)
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace RestfulObjects.Test.EndToEnd {
[TestClass]
public class Home : AbstractSecondaryResource {
protected override string Filename() {
return "Home";
}
protected override string ResourceUrl() {
return Urls.BaseUrl;
}
protected override string ProfileType() {
return MediaTypes.Homepage;
}
[TestMethod]
public override void GetResource() {
DoGetResource();
}
[TestMethod, Ignore]
public override void WithGenericAcceptHeader() {
DoWithGenericAcceptHeader();
}
[TestMethod, Ignore]
public override void WithProfileAcceptHeader() {
DoWithProfileAcceptHeader();
}
[TestMethod, Ignore]
public override void AttemptWithInvalidProfileAcceptHeader() {
DoAttemptWithInvalidProfileAcceptHeader();
}
[TestMethod, Ignore]
public override void AttemptPost() {
DoAttemptPost();
}
[TestMethod, Ignore]
public override void AttemptPut() {
DoAttemptPut();
}
[TestMethod, Ignore]
public override void AttemptDelete() {
DoAttemptDelete();
}
[TestMethod, Ignore]
public override void WithFormalDomainModel() {
DoWithFormalDomainModel();
}
[TestMethod, Ignore]
public override void WithSimpleDomainModel() {
DoWithSimpleDomainModel();
}
[TestMethod, Ignore] //http://restfulobjects.codeplex.com/workitem/26
public override void AttemptWithDomainModelMalformed() {
DoAttemptWithDomainModelMalformed();
}
}
}
|
// Copyright © Naked Objects Group Ltd ( http://www.nakedobjects.net).
// All Rights Reserved. This code released under the terms of the
// Microsoft Public License (MS-PL) ( http://opensource.org/licenses/ms-pl.html)
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace RestfulObjects.Test.EndToEnd {
[TestClass, Ignore]
public class Home : AbstractSecondaryResource {
protected override string Filename() {
return "Home";
}
protected override string ResourceUrl() {
return Urls.BaseUrl;
}
protected override string ProfileType() {
return MediaTypes.Homepage;
}
[TestMethod]
public override void GetResource() {
DoGetResource();
}
[TestMethod]
public override void WithGenericAcceptHeader() {
DoWithGenericAcceptHeader();
}
[TestMethod]
public override void WithProfileAcceptHeader() {
DoWithProfileAcceptHeader();
}
[TestMethod]
public override void AttemptWithInvalidProfileAcceptHeader() {
DoAttemptWithInvalidProfileAcceptHeader();
}
[TestMethod]
public override void AttemptPost() {
DoAttemptPost();
}
[TestMethod]
public override void AttemptPut() {
DoAttemptPut();
}
[TestMethod]
public override void AttemptDelete() {
DoAttemptDelete();
}
[TestMethod]
public override void WithFormalDomainModel() {
DoWithFormalDomainModel();
}
[TestMethod]
public override void WithSimpleDomainModel() {
DoWithSimpleDomainModel();
}
[TestMethod] //http://restfulobjects.codeplex.com/workitem/26
public override void AttemptWithDomainModelMalformed() {
DoAttemptWithDomainModelMalformed();
}
}
}
|
apache-2.0
|
C#
|
c903c6b28e0da86e344ef125a43da6bc1d17a8d8
|
add interface implmentation.
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/ViewModels/ViewModelBase.cs
|
WalletWasabi.Gui/ViewModels/ViewModelBase.cs
|
using ReactiveUI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using WalletWasabi.Gui.ViewModels.Validation;
using WalletWasabi.Models;
namespace WalletWasabi.Gui.ViewModels
{
public class ViewModelBase : ReactiveObject, INotifyDataErrorInfo
{
private Dictionary<string, ErrorDescriptors> _errorsByPropertyName;
private Dictionary<string, ValidateMethod> _validationMethods;
public ViewModelBase()
{
_errorsByPropertyName = new Dictionary<string, ErrorDescriptors>();
_validationMethods = new Dictionary<string, ValidateMethod>();
PropertyChanged += ViewModelBase_PropertyChanged;
}
protected void RegisterValidationMethod(string propertyName, ValidateMethod validateMethod)
{
if (string.IsNullOrWhiteSpace(propertyName))
{
throw new ArgumentException("PropertyName must be valid.", nameof(propertyName));
}
_validationMethods[propertyName] = validateMethod;
}
private void ViewModelBase_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (string.IsNullOrWhiteSpace(e.PropertyName))
{
foreach (var propertyName in _validationMethods.Keys)
{
ValidateProperty(propertyName);
}
}
else
{
ValidateProperty(e.PropertyName);
}
}
private void ValidateProperty(string propertyName)
{
if (_validationMethods.ContainsKey(propertyName))
{
ClearErrors(propertyName);
_validationMethods[propertyName]((severity, error) =>
{
AddError(propertyName, severity, error);
});
}
}
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;
public bool HasErrors => _errorsByPropertyName.Where(x => x.Value.HasErrors).Any();
public IEnumerable GetErrors(string propertyName)
{
return _errorsByPropertyName.ContainsKey(propertyName) && _errorsByPropertyName[propertyName].HasErrors
? _errorsByPropertyName[propertyName]
: ErrorDescriptors.Empty;
}
private void AddError(string propertyName, ErrorSeverity severity, string error)
{
if (!_errorsByPropertyName.ContainsKey(propertyName))
{
_errorsByPropertyName[propertyName] = new ErrorDescriptors();
}
_errorsByPropertyName[propertyName].Add(new ErrorDescriptor(severity, error));
OnErrorsChanged(propertyName);
//this.RaisePropertyChanged(nameof(HasErrors));
}
private void ClearErrors(string propertyName)
{
if (_errorsByPropertyName.ContainsKey(propertyName))
{
_errorsByPropertyName.Remove(propertyName);
OnErrorsChanged(propertyName);
//this.RaisePropertyChanged(nameof(HasErrors));
}
}
private void OnErrorsChanged(string propertyName)
{
ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(propertyName));
}
}
}
|
using ReactiveUI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using WalletWasabi.Gui.ViewModels.Validation;
using WalletWasabi.Models;
namespace WalletWasabi.Gui.ViewModels
{
public class ViewModelBase : ReactiveObject
{
private Dictionary<string, ErrorDescriptors> _errorsByPropertyName;
private Dictionary<string, ValidateMethod> _validationMethods;
public ViewModelBase()
{
_errorsByPropertyName = new Dictionary<string, ErrorDescriptors>();
_validationMethods = new Dictionary<string, ValidateMethod>();
PropertyChanged += ViewModelBase_PropertyChanged;
}
protected void RegisterValidationMethod(string propertyName, ValidateMethod validateMethod)
{
if (string.IsNullOrWhiteSpace(propertyName))
{
throw new ArgumentException("PropertyName must be valid.", nameof(propertyName));
}
_validationMethods[propertyName] = validateMethod;
}
private void ViewModelBase_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (string.IsNullOrWhiteSpace(e.PropertyName))
{
foreach (var propertyName in _validationMethods.Keys)
{
ValidateProperty(propertyName);
}
}
else
{
ValidateProperty(e.PropertyName);
}
}
private void ValidateProperty(string propertyName)
{
if (_validationMethods.ContainsKey(propertyName))
{
ClearErrors(propertyName);
_validationMethods[propertyName]((severity, error) =>
{
AddError(propertyName, severity, error);
});
}
}
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;
public bool HasErrors => _errorsByPropertyName.Where(x => x.Value.HasErrors).Any();
public IEnumerable GetErrors(string propertyName)
{
return _errorsByPropertyName.ContainsKey(propertyName) && _errorsByPropertyName[propertyName].HasErrors
? _errorsByPropertyName[propertyName]
: ErrorDescriptors.Empty;
}
private void AddError(string propertyName, ErrorSeverity severity, string error)
{
if (!_errorsByPropertyName.ContainsKey(propertyName))
{
_errorsByPropertyName[propertyName] = new ErrorDescriptors();
}
_errorsByPropertyName[propertyName].Add(new ErrorDescriptor(severity, error));
OnErrorsChanged(propertyName);
//this.RaisePropertyChanged(nameof(HasErrors));
}
private void ClearErrors(string propertyName)
{
if (_errorsByPropertyName.ContainsKey(propertyName))
{
_errorsByPropertyName.Remove(propertyName);
OnErrorsChanged(propertyName);
//this.RaisePropertyChanged(nameof(HasErrors));
}
}
private void OnErrorsChanged(string propertyName)
{
ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(propertyName));
}
}
}
|
mit
|
C#
|
fb844edf00f71c6ca8d064c3761ba2e72a2cc7ce
|
Add alpha channel support
|
tobyclh/UnityCNTK,tobyclh/UnityCNTK
|
Assets/Extensions.cs
|
Assets/Extensions.cs
|
using UnityEngine;
using CNTK;
using System;
using System.Linq;
using System.Collections.Generic;
using System;
namespace DeepUnity
{
public static class Extensionas
{
public static Value Create(this Value value, Texture2D texture, bool useAlpha = false)
{
var shape = NDShape.CreateNDShape(new int[] { useAlpha ? 4 : 3, texture.width, texture.height });
var rawData = texture.GetRawTextureData();
NDArrayViewPtrVector pVec = new NDArrayViewPtrVector(rawData);
var inputVal = Value.Create(shape, pVec, new BoolVector(), DeviceDescriptor.CPUDevice, false, false);
return inputVal;
}
}
}
|
using UnityEngine;
using CNTK;
using System;
using System.Linq;
using System.Collections.Generic;
using System;
namespace DeepUnity
{
public static class Extensionas
{
public static Value Create(this Value value, Texture2D texture)
{
var shape = NDShape.CreateNDShape(new int[] { texture.width, texture.height, 3 });
var rawData = texture.GetRawTextureData();
NDArrayViewPtrVector pVec = new NDArrayViewPtrVector(rawData);
var inputVal = Value.Create(shape, pVec, new BoolVector(), DeviceDescriptor.CPUDevice, false, false);
return inputVal;
}
}
}
|
mit
|
C#
|
02f26e4a4d02a1aba90aa88829d694631aba4cce
|
Update comment
|
johnneijzen/osu,ppy/osu,johnneijzen/osu,EVAST9919/osu,ppy/osu,UselessToucan/osu,2yangk23/osu,peppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu,2yangk23/osu,ppy/osu,peppy/osu-new,smoogipoo/osu
|
osu.Game/Rulesets/Mods/Mod.cs
|
osu.Game/Rulesets/Mods/Mod.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using Newtonsoft.Json;
using osu.Framework.Graphics.Sprites;
using osu.Game.IO.Serialization;
namespace osu.Game.Rulesets.Mods
{
/// <summary>
/// The base class for gameplay modifiers.
/// </summary>
public abstract class Mod : IMod, IJsonSerializable
{
/// <summary>
/// The name of this mod.
/// </summary>
[JsonIgnore]
public abstract string Name { get; }
/// <summary>
/// The shortened name of this mod.
/// </summary>
public abstract string Acronym { get; }
/// <summary>
/// The icon of this mod.
/// </summary>
[JsonIgnore]
public virtual IconUsage? Icon => null;
/// <summary>
/// The type of this mod.
/// </summary>
[JsonIgnore]
public virtual ModType Type => ModType.Fun;
/// <summary>
/// The user readable description of this mod.
/// </summary>
[JsonIgnore]
public virtual string Description => string.Empty;
/// <summary>
/// The score multiplier of this mod.
/// </summary>
[JsonIgnore]
public abstract double ScoreMultiplier { get; }
/// <summary>
/// Returns true if this mod is implemented (and playable).
/// </summary>
[JsonIgnore]
public virtual bool HasImplementation => this is IApplicableMod;
/// <summary>
/// Returns if this mod is ranked.
/// </summary>
[JsonIgnore]
public virtual bool Ranked => false;
/// <summary>
/// Whether this mod requires configuration to apply changes to the game.
/// </summary>
[JsonIgnore]
public virtual bool RequiresConfiguration => false;
/// <summary>
/// The mods this mod cannot be enabled with.
/// </summary>
[JsonIgnore]
public virtual Type[] IncompatibleMods => Array.Empty<Type>();
/// <summary>
/// Creates a copy of this <see cref="Mod"/> initialised to a default state.
/// </summary>
public virtual Mod CreateCopy() => (Mod)MemberwiseClone();
public bool Equals(IMod other) => GetType() == other?.GetType();
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using Newtonsoft.Json;
using osu.Framework.Graphics.Sprites;
using osu.Game.IO.Serialization;
namespace osu.Game.Rulesets.Mods
{
/// <summary>
/// The base class for gameplay modifiers.
/// </summary>
public abstract class Mod : IMod, IJsonSerializable
{
/// <summary>
/// The name of this mod.
/// </summary>
[JsonIgnore]
public abstract string Name { get; }
/// <summary>
/// The shortened name of this mod.
/// </summary>
public abstract string Acronym { get; }
/// <summary>
/// The icon of this mod.
/// </summary>
[JsonIgnore]
public virtual IconUsage? Icon => null;
/// <summary>
/// The type of this mod.
/// </summary>
[JsonIgnore]
public virtual ModType Type => ModType.Fun;
/// <summary>
/// The user readable description of this mod.
/// </summary>
[JsonIgnore]
public virtual string Description => string.Empty;
/// <summary>
/// The score multiplier of this mod.
/// </summary>
[JsonIgnore]
public abstract double ScoreMultiplier { get; }
/// <summary>
/// Returns true if this mod is implemented (and playable).
/// </summary>
[JsonIgnore]
public virtual bool HasImplementation => this is IApplicableMod;
/// <summary>
/// Returns if this mod is ranked.
/// </summary>
[JsonIgnore]
public virtual bool Ranked => false;
/// <summary>
/// Returns true if this mod requires configuration. If true, opens mod customisation menu every time user enables mod.
/// </summary>
[JsonIgnore]
public virtual bool RequiresConfiguration => false;
/// <summary>
/// The mods this mod cannot be enabled with.
/// </summary>
[JsonIgnore]
public virtual Type[] IncompatibleMods => Array.Empty<Type>();
/// <summary>
/// Creates a copy of this <see cref="Mod"/> initialised to a default state.
/// </summary>
public virtual Mod CreateCopy() => (Mod)MemberwiseClone();
public bool Equals(IMod other) => GetType() == other?.GetType();
}
}
|
mit
|
C#
|
947b8c67053f7a1ab523c04c072074e8679c91d3
|
add new skip data
|
jasarsoft/mmrtw
|
Class/Mod/ModSkip.cs
|
Class/Mod/ModSkip.cs
|
namespace Jasarsoft.ModManager.RTW
{
public sealed class ModSkip
{
//field
private string[] names;
//constructor
public ModSkip()
{
names = new string[]
{
"alexander",
"bi",
"custom",
"data",
"manager",
"miles",
"preferences",
"replays",
"saves",
"temp",
"uninstall"
};
}
//property
public string[] Names
{
get { return names; }
}
}
}
|
namespace Jasarsoft.ModManager.RTW
{
public sealed class ModSkip
{
string[] names;
//constructor
public ModSkip()
{
names = new string[]
{
"alexander",
"bi",
"data",
"manager",
"miles",
"preferences",
"saves",
"temp",
"uninstall"
};
}
//property
public string[] Names
{
get { return names; }
}
}
}
|
apache-2.0
|
C#
|
d5d52012eb1e2655bfbf72d6db72efc98c76302f
|
Increment minor -> 0.2.0
|
awseward/restivus
|
AssemblyInfo.sln.cs
|
AssemblyInfo.sln.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
|
mit
|
C#
|
26fba6585ccf238958f5d2f28715eb53b06a8ae1
|
Update css reference for site.css in Blazor Server templates (#34113)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/Error.cshtml
|
src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/Error.cshtml
|
@page
@model BlazorServerWeb_CSharp.Pages.ErrorModel
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>
<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>
</html>
|
@page
@model BlazorServerWeb_CSharp.Pages.ErrorModel
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/app.css" rel="stylesheet" asp-append-version="true" />
</head>
<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>
</html>
|
apache-2.0
|
C#
|
d27907f9a9c4808dcdc392f9cd1a6313967d93c7
|
Add xml comments to Helper class
|
nathanpjones/DecimalMath
|
DecimalEx/Helper.cs
|
DecimalEx/Helper.cs
|
namespace DecimalMath
{
/// <summary>
/// Helper functions.
/// </summary>
public static class Helper
{
/// <summary>
/// Swaps the value between two variables.
/// </summary>
public static void Swap<T>(ref T lhs, ref T rhs)
{
var temp = lhs;
lhs = rhs;
rhs = temp;
}
/// <summary>
/// Prime number to use to begin a hash of an object.
/// </summary>
/// <remarks>
/// See: http://stackoverflow.com/questions/263400
/// </remarks>
public const int HashStart = 17;
private const int HashPrime = 397;
/// <summary>
/// Adds a hash of an object to a running hash value.
/// </summary>
/// <param name="hash">A running hash value.</param>
/// <param name="obj">The object to hash and incorporate into the running hash.</param>
public static int HashObject(this int hash, object obj)
{
unchecked { return hash * HashPrime ^ (ReferenceEquals(null, obj) ? 0 : obj.GetHashCode()); }
}
/// <summary>
/// Adds a hash of a struct to a running hash value.
/// </summary>
/// <param name="hash">A running hash value.</param>
/// <param name="value">The struct to hash and incorporate into the running hash.</param>
public static int HashValue<T>(this int hash, T value) where T : struct
{
unchecked { return hash * HashPrime ^ value.GetHashCode(); }
}
}
}
|
namespace DecimalMath
{
public static class Helper
{
public static void Swap<T>(ref T lhs, ref T rhs)
{
var temp = lhs;
lhs = rhs;
rhs = temp;
}
// See: http://stackoverflow.com/questions/263400
public const int HashStart = 17;
private const int HashPrime = 397;
public static int HashObject(this int hash, object obj)
{
unchecked { return hash * HashPrime ^ (ReferenceEquals(null, obj) ? 0 : obj.GetHashCode()); }
}
public static int HashValue<T>(this int hash, T value) where T : struct
{
unchecked { return hash * HashPrime ^ value.GetHashCode(); }
}
}
}
|
mit
|
C#
|
37135d5e065199a8ac83d960fa7f93034ff1ef7d
|
Make our simple Contract class throw an exception.
|
SuperJMN/Avalonia,wieslawsoltes/Perspex,MrDaedra/Avalonia,SuperJMN/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,susloparovdenis/Avalonia,susloparovdenis/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,jkoritzinsky/Perspex,akrisiun/Perspex,SuperJMN/Avalonia,tshcherban/Perspex,wieslawsoltes/Perspex,kekekeks/Perspex,AvaloniaUI/Avalonia,susloparovdenis/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jazzay/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,kekekeks/Perspex,danwalmsley/Perspex,AvaloniaUI/Avalonia,OronDF343/Avalonia,MrDaedra/Avalonia,ncarrillo/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,punker76/Perspex,susloparovdenis/Perspex,OronDF343/Avalonia,wieslawsoltes/Perspex,DavidKarlas/Perspex,bbqchickenrobot/Perspex,sagamors/Perspex,jkoritzinsky/Avalonia
|
Perspex/Contract.cs
|
Perspex/Contract.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Perspex
{
internal static class Contract
{
public static void Requires<TException>(bool condition) where TException : Exception, new()
{
#if DEBUG
if (!condition)
{
throw new TException();
}
#endif
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Perspex
{
internal static class Contract
{
public static void Requires<TException>(bool condition) where TException : Exception
{
}
}
}
|
mit
|
C#
|
0a0f182797d00cd998220fd0eac556aabe5be026
|
Add support for ReactDOM.unmountComponentAtNode
|
ProductiveRage/Bridge.React,ProductiveRage/Bridge.React
|
Bridge.React/React.cs
|
Bridge.React/React.cs
|
using System;
using Bridge.Html5;
namespace Bridge.React
{
[Name("ReactDOM")]
[External]
public static class React
{
/// <summary>
/// Render a React element into the DOM in the supplied container.
///
/// If the React element was previously rendered into container, this will perform an update on it and
/// only mutate the DOM as necessary to reflect the latest React element.
/// </summary>
// NOTE: ReactDOM.render actually returns "a reference to the component (or returns null for stateless components)",
// but I'm not quite sure what type to use for those (they're not the same as the ReactElement passed in, and for
// DOM HTML elements they return those HTML elements themselves).
[Name("render")]
public extern static void Render(ReactElement element, Element container);
/// <summary>
/// Render a React element into the DOM in the supplied container.
///
/// If the React element was previously rendered into container, this will perform an update on it and
/// only mutate the DOM as necessary to reflect the latest React element.
///
/// The provided callback will be executed after the component is rendered or updated.
/// </summary>
// NOTE: ReactDOM.render actually returns "a reference to the component (or returns null for stateless components)",
// but I'm not quite sure what type to use for those (they're not the same as the ReactElement passed in, and for
// DOM HTML elements they return those HTML elements themselves).
[Name("render")]
public extern static void Render(ReactElement element, Element container, Action callback);
/// <summary>
/// Remove a mounted React component from the DOM and clean up its event handlers and state.
/// If no component was mounted in the container, calling this function does nothing.
/// Returns true if a component was unmounted and false if there was no component to unmount.
/// </summary>
[Name("unmountComponentAtNode")]
public extern static bool UnmountComponentAtNode(Element container);
}
}
|
using Bridge.Html5;
namespace Bridge.React
{
[Name("ReactDOM")]
[External]
public static class React
{
[Name("render")]
public extern static void Render(ReactElement element, Element container);
}
}
|
mit
|
C#
|
542df64f2e1aec4d6d0e645d5b39dff44c2c7f40
|
Set status code for not found servlet
|
Metapyziks/WebServer
|
Default404Servlet.cs
|
Default404Servlet.cs
|
namespace WebServer
{
public class Default404Servlet : HTMLServlet
{
protected override void OnService()
{
Response.StatusCode = 404;
Write(
DocType("html"),
Tag("html", lang => "en", another => "blah")(
Tag("head")(
Tag("title")("Error 404")
),
Tag("body")(
Tag("p")(
"The URL you requested could not be found", Ln,
Tag("code")(Request.RawUrl)
)
)
)
);
}
}
}
|
namespace WebServer
{
public class Default404Servlet : HTMLServlet
{
protected override void OnService()
{
Write(
DocType("html"),
Tag("html", lang => "en", another => "blah")(
Tag("head")(
Tag("title")("Error 404")
),
Tag("body")(
Tag("p")(
"The URL you requested could not be found", Ln,
Tag("code")(Request.RawUrl)
)
)
)
);
}
}
}
|
mit
|
C#
|
31d2c7fb1bf6a722a3938befbde83600ebeee20e
|
Make CharacterGuildCardDataHeaderResponsePayload constructable
|
HelloKitty/Booma.Proxy
|
src/Booma.Packet.Game/Character/Payloads/Server/CharacterGuildCardDataHeaderResponsePayload.cs
|
src/Booma.Packet.Game/Character/Payloads/Server/CharacterGuildCardDataHeaderResponsePayload.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreecraftCore.Serializer;
namespace Booma.Proxy
{
/* Blue Burst packet that acts as a header for the client's guildcard data.
typedef struct bb_guildcard_hdr
{
bb_pkt_hdr_t hdr;
uint8_t one;
uint8_t padding1[3];
uint16_t len;
uint8_t padding2[2];
uint32_t checksum;
}
PACKED bb_guildcard_hdr_pkt;*/
/// <summary>
/// Payload sent as a response to <see cref="CharacterGuildHeaderRequestPayload"/>.
/// Contains initial information about the guild info.
/// </summary>
[WireDataContract]
[GameServerPacketPayload(GameNetworkOperationCode.BB_GUILDCARD_HEADER_TYPE)]
public sealed partial class CharacterGuildCardDataHeaderResponsePayload : PSOBBGamePacketPayloadServer
{
/// <summary>
/// One? Not sure why.
/// </summary>
[WireMember(1)]
internal int One { get; set; } = 1;
//TODO: What is this length?
[WireMember(2)]
public uint Length { get; internal set; }
//TODO: What is this checksum?
[WireMember(3)]
public uint CheckSum { get; internal set; }
public CharacterGuildCardDataHeaderResponsePayload(uint length, uint checkSum)
: this()
{
Length = length;
CheckSum = checkSum;
}
/// <summary>
/// Serializer ctor.
/// </summary>
public CharacterGuildCardDataHeaderResponsePayload()
: base(GameNetworkOperationCode.BB_GUILDCARD_HEADER_TYPE)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreecraftCore.Serializer;
namespace Booma.Proxy
{
/* Blue Burst packet that acts as a header for the client's guildcard data.
typedef struct bb_guildcard_hdr
{
bb_pkt_hdr_t hdr;
uint8_t one;
uint8_t padding1[3];
uint16_t len;
uint8_t padding2[2];
uint32_t checksum;
}
PACKED bb_guildcard_hdr_pkt;*/
/// <summary>
/// Payload sent as a response to <see cref="CharacterGuildHeaderRequestPayload"/>.
/// Contains initial information about the guild info.
/// </summary>
[WireDataContract]
[GameServerPacketPayload(GameNetworkOperationCode.BB_GUILDCARD_HEADER_TYPE)]
public sealed partial class CharacterGuildCardDataHeaderResponsePayload : PSOBBGamePacketPayloadServer
{
/// <summary>
/// One? Not sure why.
/// </summary>
[WireMember(1)]
internal int One { get; set; } = 1;
//TODO: What is this length?
[WireMember(2)]
public uint Length { get; internal set; }
//TODO: What is this checksum?
[WireMember(3)]
public uint CheckSum { get; internal set; }
/// <summary>
/// Serializer ctor.
/// </summary>
public CharacterGuildCardDataHeaderResponsePayload()
: base(GameNetworkOperationCode.BB_GUILDCARD_HEADER_TYPE)
{
}
}
}
|
agpl-3.0
|
C#
|
421e1451278aefa785b65117a0696fa93d56cd9b
|
Fix build break
|
MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS
|
src/Package/Test/Utility/RHostScript.cs
|
src/Package/Test/Utility/RHostScript.cs
|
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.R.Host.Client;
using Microsoft.VisualStudio.R.Package.Repl;
using Microsoft.VisualStudio.R.Package.Shell;
namespace Microsoft.VisualStudio.R.Package.Test.Utility {
[ExcludeFromCodeCoverage]
public sealed class RHostScript : IDisposable {
public IRSessionProvider SessionProvider { get; private set; }
public IRSession Session { get; private set; }
public RHostScript() {
SessionProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IRSessionProvider>();
Session = SessionProvider.Create(0, new RHostClientApp());
Session.StartHostAsync("RHostScript", IntPtr.Zero).Wait();
}
public void Dispose() {
if (Session != null) {
Session.StopHostAsync().Wait();
Session.Dispose();
Session = null;
}
if(SessionProvider != null) {
SessionProvider.Dispose();
SessionProvider = null;
}
}
}
}
|
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.R.Host.Client;
using Microsoft.VisualStudio.R.Package.Repl;
using Microsoft.VisualStudio.R.Package.Shell;
namespace Microsoft.VisualStudio.R.Package.Test.Utility {
[ExcludeFromCodeCoverage]
public sealed class RHostScript : IDisposable {
public IRSessionProvider SessionProvider { get; private set; }
public IRSession Session { get; private set; }
public RHostScript() {
SessionProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IRSessionProvider>();
Session = SessionProvider.Create(0, new RHostClientApp());
Session.StartHostAsync(IntPtr.Zero).Wait();
}
public void Dispose() {
if (Session != null) {
Session.StopHostAsync().Wait();
Session.Dispose();
Session = null;
}
if(SessionProvider != null) {
SessionProvider.Dispose();
SessionProvider = null;
}
}
}
}
|
mit
|
C#
|
3cbbe1d198d943d2125596cb95aebedf6e6930f2
|
Fix the Limits to also handle "-infinity"
|
AlexGhiondea/SmugMug.NET
|
src/SmugMugShared/Descriptors/Limits.cs
|
src/SmugMugShared/Descriptors/Limits.cs
|
// Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace SmugMug.Shared.Descriptors
{
public class Limits
{
// INFINITY, NEGATIVE_INFINITY, POSITIVE_INFINITY, and numbers
private double maxVal, minVal;
public Limits(string min, string max)
{
minVal = Parse(min);
maxVal = Parse(max);
}
private double Parse(string value)
{
if (StringComparer.OrdinalIgnoreCase.Equals("infinity", value) ||
StringComparer.OrdinalIgnoreCase.Equals("positive_infinity", value))
return double.PositiveInfinity;
if (StringComparer.OrdinalIgnoreCase.Equals("-infinity", value) ||
StringComparer.OrdinalIgnoreCase.Equals("negative_infinity", value))
return double.NegativeInfinity;
return double.Parse(value);
}
public double Min { get { return minVal; } }
public double Max { get { return maxVal; } }
}
}
|
// Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace SmugMug.Shared.Descriptors
{
public class Limits
{
// INFINITY, NEGATIVE_INFINITY, POSITIVE_INFINITY, and numbers
private double maxVal, minVal;
public Limits(string min, string max)
{
minVal = Parse(min);
maxVal = Parse(max);
}
private double Parse(string value)
{
if (StringComparer.OrdinalIgnoreCase.Equals("infinity", value) ||
StringComparer.OrdinalIgnoreCase.Equals("positive_infinity", value))
return double.PositiveInfinity;
if (StringComparer.OrdinalIgnoreCase.Equals("negative_infinity", value))
return double.NegativeInfinity;
return double.Parse(value);
}
public double Min { get { return minVal; } }
public double Max { get { return maxVal; } }
}
}
|
mit
|
C#
|
ecee4d4bca1d58216b68fb55c19f53ab824f3ba6
|
Check if initialize string is available before setting it
|
ADAPT/ADAPT,tarakreddy/ADAPT
|
source/Visualizer/DataProvider.cs
|
source/Visualizer/DataProvider.cs
|
using System.Collections.Generic;
using AgGateway.ADAPT.ApplicationDataModel;
using AgGateway.ADAPT.PluginManager;
namespace AgGateway.ADAPT.Visualizer
{
public class DataProvider
{
private PluginFactory _pluginFactory;
public void Initialize(string pluginsPath)
{
_pluginFactory = new PluginFactory(pluginsPath);
}
public List<string> AvailablePlugins
{
get { return PluginFactory.AvailablePlugins; }
}
public PluginFactory PluginFactory
{
get { return _pluginFactory; }
}
public ApplicationDataModel.ApplicationDataModel Import(string datacardPath, string initializeString)
{
foreach (var availablePlugin in AvailablePlugins)
{
var plugin = GetPlugin(availablePlugin);
InitializePlugin(plugin, initializeString);
if (plugin.IsDataCardSupported(datacardPath))
{
return plugin.Import(datacardPath);
}
}
return null;
}
public IPlugin GetPlugin(string pluginName)
{
return _pluginFactory.GetPlugin(pluginName);
}
public static void Export(IPlugin plugin, ApplicationDataModel.ApplicationDataModel applicationDataModel, string initializeString, string exportPath)
{
InitializePlugin(plugin, initializeString);
plugin.Export(applicationDataModel, exportPath);
}
private static void InitializePlugin(IPlugin plugin, string initializeString)
{
if (string.IsNullOrEmpty(initializeString))
{
plugin.Initialize(initializeString);
}
}
}
}
|
using System.Collections.Generic;
using AgGateway.ADAPT.ApplicationDataModel;
using AgGateway.ADAPT.PluginManager;
namespace AgGateway.ADAPT.Visualizer
{
public class DataProvider
{
private PluginFactory _pluginFactory;
public void Initialize(string pluginsPath)
{
_pluginFactory = new PluginFactory(pluginsPath);
}
public List<string> AvailablePlugins
{
get { return PluginFactory.AvailablePlugins; }
}
public PluginFactory PluginFactory
{
get { return _pluginFactory; }
}
public ApplicationDataModel.ApplicationDataModel Import(string datacardPath, string initializeString)
{
foreach (var availablePlugin in AvailablePlugins)
{
var plugin = GetPlugin(availablePlugin);
plugin.Initialize(initializeString);
if (plugin.IsDataCardSupported(datacardPath))
{
return plugin.Import(datacardPath);
}
}
return null;
}
public IPlugin GetPlugin(string pluginName)
{
return _pluginFactory.GetPlugin(pluginName);
}
public static void Export(IPlugin plugin, ApplicationDataModel.ApplicationDataModel applicationDataModel, string initializeString, string exportPath)
{
if (string.IsNullOrEmpty(initializeString))
{
plugin.Initialize(initializeString);
}
plugin.Export(applicationDataModel, exportPath);
}
}
}
|
epl-1.0
|
C#
|
46e71e9ead75227f63080ed4751e3f61228d1f40
|
Add missing licence header
|
peppy/osu,UselessToucan/osu,johnneijzen/osu,ppy/osu,peppy/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,EVAST9919/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu-new,UselessToucan/osu,2yangk23/osu,EVAST9919/osu,peppy/osu,smoogipoo/osu,johnneijzen/osu,ppy/osu,NeoAdonis/osu
|
osu.Game/Overlays/News/NewsContent.cs
|
osu.Game/Overlays/News/NewsContent.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.Framework.Graphics.Containers;
namespace osu.Game.Overlays.News
{
public abstract class NewsContent : FillFlowContainer
{
public NewsContent()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
Padding = new MarginPadding { Bottom = 100 };
}
}
}
|
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.News
{
public abstract class NewsContent : FillFlowContainer
{
public NewsContent()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
Padding = new MarginPadding { Bottom = 100 };
}
}
}
|
mit
|
C#
|
b434f4072e5777cbf6412f2c78fefb732b623e38
|
Update Mvc.cs
|
dd4t/DD4T.DI.Autofac,dd4t/dd4t-di-autofac
|
source/DD4T.DI.Autofac/Mvc.cs
|
source/DD4T.DI.Autofac/Mvc.cs
|
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using Autofac;
namespace DD4T.DI.Autofac
{
public static class Mvc
{
public static void RegisterMvc(this ContainerBuilder builder)
{
var location = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin");
var file = Directory.GetFiles(location, "DD4T.MVC.dll").FirstOrDefault();
if (file == null)
return;
Assembly.LoadFile(file);
var provider = AppDomain.CurrentDomain.GetAssemblies().Where(ass => ass.FullName.StartsWith("DD4T.MVC", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (provider == null)
return;
var providerTypes = provider.GetTypes();
var iComponentPresentationRenderer = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.Html.IComponentPresentationRenderer", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
var defaultComponentPresentationRenderer = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.Html.DefaultComponentPresentationRenderer", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
var iXpmMarkupService = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.ViewModels.XPM.IXpmMarkupService", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
var defaultXpmMarkupService = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.ViewModels.XPM.XpmMarkupService", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
//register default ComponentPresentationRenderer
if (iComponentPresentationRenderer != null || defaultComponentPresentationRenderer != null)
{
builder.RegisterType(defaultComponentPresentationRenderer).As(iComponentPresentationRenderer).PreserveExistingDefaults();
}
//register default XPmMarkupService
if (iXpmMarkupService != null || defaultXpmMarkupService != null)
{
builder.RegisterType(defaultXpmMarkupService).As(iXpmMarkupService).PreserveExistingDefaults();
}
}
}
}
|
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using Autofac;
namespace DD4T.DI.Autofac
{
public static class Mvc
{
public static void RegisterMvc(this ContainerBuilder builder)
{
var location = string.Format(@"{0}\bin\", AppDomain.CurrentDomain.BaseDirectory);
var file = Directory.GetFiles(location, "DD4T.MVC.dll").FirstOrDefault();
if (file == null)
return;
Assembly.LoadFile(file);
var provider = AppDomain.CurrentDomain.GetAssemblies().Where(ass => ass.FullName.StartsWith("DD4T.MVC", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (provider == null)
return;
var providerTypes = provider.GetTypes();
var iComponentPresentationRenderer = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.Html.IComponentPresentationRenderer", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
var defaultComponentPresentationRenderer = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.Html.DefaultComponentPresentationRenderer", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
var iXpmMarkupService = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.ViewModels.XPM.IXpmMarkupService", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
var defaultXpmMarkupService = providerTypes.Where(a => a.FullName.Equals("DD4T.Mvc.ViewModels.XPM.XpmMarkupService", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
//register default ComponentPresentationRenderer
if (iComponentPresentationRenderer != null || defaultComponentPresentationRenderer != null)
{
builder.RegisterType(defaultComponentPresentationRenderer).As(iComponentPresentationRenderer).PreserveExistingDefaults();
}
//register default XPmMarkupService
if (iXpmMarkupService != null || defaultXpmMarkupService != null)
{
builder.RegisterType(defaultXpmMarkupService).As(iXpmMarkupService).PreserveExistingDefaults();
}
}
}
}
|
apache-2.0
|
C#
|
b34a12e71dfc15f415fe876c80c0891e3cd50133
|
Add boxed default structure
|
KodamaSakuno/Sakuno.Base
|
src/Sakuno.Base/BoxedConstants.cs
|
src/Sakuno.Base/BoxedConstants.cs
|
namespace Sakuno
{
public static class BoxedConstants
{
public static class Boolean
{
public static readonly object True = true;
public static readonly object False = false;
}
public static class Int32
{
public static readonly object Zero = 0;
public static readonly object NegativeOne = -1;
}
public static class Int64
{
public static readonly object Zero = 0L;
public static readonly object NegativeOne = -1L;
}
public static class Double
{
public static readonly object Zero = 0.0;
public static readonly object One = 1.0;
public static readonly object NaN = double.NaN;
}
public static class Structure<T> where T : struct
{
public static readonly object Default = default(T);
}
}
}
|
namespace Sakuno
{
public static class BoxedConstants
{
public static class Boolean
{
public static readonly object True = true;
public static readonly object False = false;
}
public static class Int32
{
public static readonly object Zero = 0;
public static readonly object NegativeOne = -1;
}
public static class Int64
{
public static readonly object Zero = 0L;
public static readonly object NegativeOne = -1L;
}
public static class Double
{
public static readonly object Zero = 0.0;
public static readonly object One = 1.0;
public static readonly object NaN = double.NaN;
}
}
}
|
mit
|
C#
|
6a5beeb3d7fd896ea35625813e77a53d6f8fb2d4
|
clean imports
|
gleroi/selfnet,gleroi/selfnet
|
Selfnet/Status.cs
|
Selfnet/Status.cs
|
namespace Selfnet
{
public enum Status
{
Any,
Unread,
Starred
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Selfnet
{
public enum Status
{
Any,
Unread,
Starred
}
}
|
mit
|
C#
|
0f3197944240439ba49b7c5d6ba2d82931a7aefa
|
Update ShortYear.cs
|
maniero/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,bigown/SOpt
|
CSharp/Struct/ShortYear.cs
|
CSharp/Struct/ShortYear.cs
|
using System;
using System.Diagnostics.Contracts;
public struct Program {
public static void Main() {
short numero = 2017;
var m = new ShortYear(numero);
Console.WriteLine(m);
}
}
//provavelmente teria implemnetações de operadores, outros métodos e das interfaces
//IFormattable, IConvertible, IComparable<ShortYear>, IEquatable<ShortYear> e outras
public class ShortYear {
public byte Year;
public const short Century = 1900;
public ShortYear(short value) {
Contract.Ensures(value >= 1900 && value < 2156);
Year = (byte)(value - Century);
}
public ShortYear(int value) {
Contract.Ensures(value >= 1900 && value < 2156);
Year = (byte)(value - Century);
}
public static implicit operator short(ShortYear value) => (short)(value.Year + Century);
public static implicit operator int(ShortYear value) => value.Year + Century;
public override int GetHashCode() => Year.GetHashCode();
public override String ToString() => (Year + Century).ToString();
}
//https://pt.stackoverflow.com/q/221079/101
|
using System;
using System.Diagnostics.Contracts;
public class Program {
public static void Main() {
short numero = 2017;
var m = new ShortYear(numero);
Console.WriteLine(m);
}
}
public class ShortYear { //provavelmente teria implemnetações de IFormattable, IConvertible, IComparable<ShortYear>, IEquatable<ShortYear> e operadores
public byte Year;
public const short Century = 1900;
public ShortYear(short value) {
Contract.Ensures(value >= 1900 && value < 2156);
Year = (byte)(value - Century);
}
public ShortYear(int value) {
Contract.Ensures(value >= 1900 && value < 2156);
Year = (byte)(value - Century);
}
public static implicit operator short(ShortYear value) => (short)(value.Year + Century);
public static implicit operator int(ShortYear value) => value.Year + Century;
public override int GetHashCode() => Year.GetHashCode();
public override String ToString() {
return (Year + Century).ToString();
}
}
//https://pt.stackoverflow.com/q/221079/101
|
mit
|
C#
|
25e40da1a8eabd48063296b760a56735e5114e1a
|
Make EventArgs base class serializable (#15541)
|
ruben-ayrapetyan/coreclr,wtgodbe/coreclr,cshung/coreclr,poizan42/coreclr,JosephTremoulet/coreclr,ruben-ayrapetyan/coreclr,cshung/coreclr,yizhang82/coreclr,mmitche/coreclr,cshung/coreclr,JosephTremoulet/coreclr,wtgodbe/coreclr,ruben-ayrapetyan/coreclr,yizhang82/coreclr,JosephTremoulet/coreclr,cshung/coreclr,JosephTremoulet/coreclr,krk/coreclr,wtgodbe/coreclr,yizhang82/coreclr,krk/coreclr,krk/coreclr,poizan42/coreclr,poizan42/coreclr,krk/coreclr,yizhang82/coreclr,wtgodbe/coreclr,mmitche/coreclr,ruben-ayrapetyan/coreclr,JosephTremoulet/coreclr,poizan42/coreclr,mmitche/coreclr,ruben-ayrapetyan/coreclr,cshung/coreclr,krk/coreclr,mmitche/coreclr,ruben-ayrapetyan/coreclr,wtgodbe/coreclr,mmitche/coreclr,krk/coreclr,mmitche/coreclr,cshung/coreclr,yizhang82/coreclr,poizan42/coreclr,JosephTremoulet/coreclr,yizhang82/coreclr,wtgodbe/coreclr,poizan42/coreclr
|
src/mscorlib/shared/System/EventArgs.cs
|
src/mscorlib/shared/System/EventArgs.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace System
{
// The base class for all event classes.
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public class EventArgs
{
public static readonly EventArgs Empty = new EventArgs();
public EventArgs()
{
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace System
{
// The base class for all event classes.
public class EventArgs
{
public static readonly EventArgs Empty = new EventArgs();
public EventArgs()
{
}
}
}
|
mit
|
C#
|
5cb9d1e2af55da5db7939752684552e165f7c8f2
|
Attach dev tools only in debug builds
|
wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D
|
src/Core2D.Avalonia/MainWindow.xaml.cs
|
src/Core2D.Avalonia/MainWindow.xaml.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 Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Core2D.Avalonia
{
public class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|
// 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 Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Core2D.Avalonia
{
public class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
this.AttachDevTools();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|
mit
|
C#
|
f4f63cbc8ffb533ab59fab3366d773ba73e3f1c5
|
Update AssemblyInfo
|
ryans610/CSharp-SurveyCount
|
SurveyCount/Properties/AssemblyInfo.cs
|
SurveyCount/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 組件的一般資訊是由下列的屬性集控制。
// 變更這些屬性的值即可修改組件的相關
// 資訊。
[assembly: AssemblyTitle("SurveyCount")]
[assembly: AssemblyDescription("Calculate the repeat time of each words.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SurveyCount")]
[assembly: AssemblyCopyright("Copyright © ryans610 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 將 ComVisible 設定為 false 會使得這個組件中的類型
// 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
[assembly: ComVisible(false)]
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("6d0940cd-5627-423e-8e0f-bc40f1db985f")]
// 組件的版本資訊是由下列四項值構成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂編號
//
// 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號
// 指定為預設值:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyCompanyAttribute("ryans610")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 組件的一般資訊是由下列的屬性集控制。
// 變更這些屬性的值即可修改組件的相關
// 資訊。
[assembly: AssemblyTitle("SurveyCount")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SurveyCount")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 將 ComVisible 設定為 false 會使得這個組件中的類型
// 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
[assembly: ComVisible(false)]
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("6d0940cd-5627-423e-8e0f-bc40f1db985f")]
// 組件的版本資訊是由下列四項值構成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂編號
//
// 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號
// 指定為預設值:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
ddc659276bf2759277bb14b0775170dd8fec9840
|
Add default value
|
loicteixeira/gj-unity-api
|
Assets/Plugins/GameJolt/Core/Response.cs
|
Assets/Plugins/GameJolt/Core/Response.cs
|
using System.Collections.Generic;
using System.Linq;
using GJAPI.External.SimpleJSON;
namespace GJAPI.Core
{
public enum ResponseFormat { KeyPair, Json, Dump }
public class Response
{
public readonly ResponseFormat format;
public readonly bool success = false;
public readonly string raw = null;
public readonly string dump = null;
public readonly JSONNode json = null;
public Response(string response, ResponseFormat format = ResponseFormat.Json)
{
this.format = format;
switch (format)
{
case ResponseFormat.Dump:
this.success = response.StartsWith("SUCCESS");
var returnIndex = response.IndexOf ('\n');
if (returnIndex != -1)
{
this.dump = response.Substring(returnIndex + 1);
}
if (!this.success)
{
UnityEngine.Debug.LogWarning(this.dump);
this.dump = null;
}
break;
case ResponseFormat.Json:
this.json = JSON.Parse(response)["response"];
this.success = this.json["success"].AsBool;
if (!this.success)
{
UnityEngine.Debug.LogWarning(this.json["message"]);
this.json = null;
}
break;
default:
this.success = response.StartsWith("success:\"true\"");
if (this.success)
{
// Note:
this.raw = response;
}
else
{
var lines = response.Split('\n');
foreach (var line in lines)
{
if (line != string.Empty)
{
var pair = line.Split(':');
if (pair.Length >= 1 && pair[0] == "message")
{
UnityEngine.Debug.LogWarning(pair[1]);
break;
}
}
}
}
break;
}
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using GJAPI.External.SimpleJSON;
namespace GJAPI.Core
{
public enum ResponseFormat { KeyPair, Json, Dump }
public class Response
{
public readonly ResponseFormat format;
public readonly bool success;
public readonly string raw;
public readonly string dump;
public readonly JSONNode json;
public Response(string response, ResponseFormat format = ResponseFormat.Json)
{
this.format = format;
switch (format)
{
case ResponseFormat.Dump:
this.success = response.StartsWith("SUCCESS");
var returnIndex = response.IndexOf ('\n');
if (returnIndex != -1)
{
this.dump = response.Substring(returnIndex + 1);
}
if (!this.success)
{
UnityEngine.Debug.LogWarning(this.dump);
this.dump = null;
}
break;
case ResponseFormat.Json:
this.json = JSON.Parse(response)["response"];
this.success = this.json["success"].AsBool;
if (!this.success)
{
UnityEngine.Debug.LogWarning(this.json["message"]);
this.json = null;
}
break;
default:
this.success = response.StartsWith("success:\"true\"");
if (this.success)
{
// Note:
this.raw = response;
}
else
{
var lines = response.Split('\n');
foreach (var line in lines)
{
if (line != string.Empty)
{
var pair = line.Split(':');
if (pair.Length >= 1 && pair[0] == "message")
{
UnityEngine.Debug.LogWarning(pair[1]);
break;
}
}
}
}
break;
}
}
}
}
|
mit
|
C#
|
4eac89daf06fb83f574ec71809d432c1b86a1778
|
Add reading event positions.
|
roblillack/monoberry,roblillack/monoberry,roblillack/monoberry,roblillack/monoberry
|
libblackberry/screen/ScreenEvent.cs
|
libblackberry/screen/ScreenEvent.cs
|
using System;
using System.Runtime.InteropServices;
namespace BlackBerry.Screen
{
public class ScreenEvent
{
[DllImport ("screen")]
static extern IntPtr screen_event_get_event (IntPtr bps_event);
[DllImport ("screen")]
static extern int screen_get_event_property_iv (IntPtr handle, Property prop, out int val);
[DllImport ("screen")]
static extern int screen_get_event_property_pv (IntPtr handle, Property prop, out IntPtr val);
[DllImport ("screen")]
static extern int screen_get_event_property_iv (IntPtr handle, Property prop, int[] vals);
IntPtr handle;
public ScreenEvent (IntPtr e)
{
handle = e;
}
public static ScreenEvent FromEventHandle (IntPtr e)
{
return new ScreenEvent (screen_event_get_event (e));
}
public int GetIntProperty (Property property)
{
int val;
screen_get_event_property_iv (handle, property, out val);
return val;
}
public IntPtr GetIntPtrProperty (Property property)
{
IntPtr val;
screen_get_event_property_pv (handle, property, out val);
return val;
}
public int X {
get {
var ints = new int[2];
if (screen_get_event_property_iv (handle, Property.SCREEN_PROPERTY_POSITION, ints) != 0) {
throw new Exception("Unable to read X position.");
}
return ints[0];
}
}
public int Y {
get {
var ints = new int[2];
if (screen_get_event_property_iv (handle, Property.SCREEN_PROPERTY_POSITION, ints) != 0) {
throw new Exception("Unable to read Y position.");
}
return ints[1];
}
}
public EventType Type {
get {
return (EventType)GetIntProperty (Property.SCREEN_PROPERTY_TYPE);
}
}
}
}
|
using System;
using System.Runtime.InteropServices;
namespace BlackBerry.Screen
{
public class ScreenEvent
{
[DllImport ("screen")]
static extern IntPtr screen_event_get_event (IntPtr bps_event);
[DllImport ("screen")]
static extern IntPtr screen_get_event_property_iv (IntPtr handle, Property prop, out int val);
[DllImport ("screen")]
static extern IntPtr screen_get_event_property_pv (IntPtr handle, Property prop, out IntPtr val);
IntPtr handle;
public ScreenEvent (IntPtr e)
{
handle = e;
}
public static ScreenEvent FromEventHandle (IntPtr e)
{
return new ScreenEvent (screen_event_get_event (e));
}
public int GetIntProperty (Property property)
{
int val;
screen_get_event_property_iv (handle, property, out val);
return val;
}
public IntPtr GetIntPtrProperty (Property property)
{
IntPtr val;
screen_get_event_property_pv (handle, property, out val);
return val;
}
public EventType Type {
get {
return (EventType)GetIntProperty (Property.SCREEN_PROPERTY_TYPE);
}
}
}
}
|
mit
|
C#
|
f2139b95c4e0c238fb62fefd38ed17ff028eb064
|
remove build optimization
|
ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET,ElectronNET/Electron.NET
|
ElectronNET.CLI/Commands/BuildCommand.cs
|
ElectronNET.CLI/Commands/BuildCommand.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace ElectronNET.CLI.Commands
{
public class BuildCommand : ICommand
{
public const string COMMAND_NAME = "build";
public const string COMMAND_DESCRIPTION = "Build your Electron Application.";
public const string COMMAND_ARGUMENTS = "<Path> from ASP.NET Core Project.";
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
Console.WriteLine("Build Windows Application...");
string currentAssemblyPath = AppDomain.CurrentDomain.BaseDirectory;
string tempPath = Path.Combine(currentAssemblyPath, "Host");
ProcessHelper.CmdExecute("dotnet publish -r win10-x64 --output " + Path.Combine(tempPath, "bin"), Directory.GetCurrentDirectory());
if (Directory.Exists(tempPath) == false)
{
Directory.CreateDirectory(tempPath);
}
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js");
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json");
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package-lock.json");
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
Console.WriteLine("Start npm install electron-packager...");
ProcessHelper.CmdExecute("npm install electron-packager --global", tempPath);
Console.WriteLine("Build Electron Desktop Application...");
string buildPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "desktop");
// Need a solution for --asar support
ProcessHelper.CmdExecute($"electron-packager . --platform=win32 --arch=x64 --electronVersion=1.7.8 --out=\"{buildPath}\" --overwrite", tempPath);
return true;
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace ElectronNET.CLI.Commands
{
public class BuildCommand : ICommand
{
public const string COMMAND_NAME = "build";
public const string COMMAND_DESCRIPTION = "Build your Electron Application.";
public const string COMMAND_ARGUMENTS = "<Path> from ASP.NET Core Project.";
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
Console.WriteLine("Build Windows Application...");
string currentAssemblyPath = AppDomain.CurrentDomain.BaseDirectory;
string tempPath = Path.Combine(currentAssemblyPath, "Host");
ProcessHelper.CmdExecute("dotnet publish -r win10-x64 --output " + Path.Combine(tempPath, "bin"), Directory.GetCurrentDirectory());
if (Directory.Exists(tempPath) == false)
{
Directory.CreateDirectory(tempPath);
}
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js");
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json");
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package-lock.json");
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
Console.WriteLine("Start npm install electron-packager...");
ProcessHelper.CmdExecute("npm install electron-packager --global", tempPath);
Console.WriteLine("Build Electron Desktop Application...");
string buildPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "desktop");
ProcessHelper.CmdExecute($"electron-packager . --platform=win32 --arch=x64 --electronVersion=1.7.8 --out=\"{buildPath}\" --overwrite --asar", tempPath);
return true;
});
}
}
}
|
mit
|
C#
|
eb713a24cbcaf77a15ce550b3f974544015a4abb
|
Fix spelling mistake
|
gpvigano/AsImpL
|
Assets/AsImpL/Scripts/IO/IFilesystem.cs
|
Assets/AsImpL/Scripts/IO/IFilesystem.cs
|
using System.Collections;
using System.IO;
namespace AsImpL
{
/// <summary>
/// Interface for classes that access the filesystem.
/// </summary>
public interface IFilesystem
{
/// <summary>
/// Reads all data from the specified path into a byte array.
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
byte[] ReadAllBytes(string path);
/// <summary>
/// Reads all lines in the specified file into an array of strings.
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
string[] ReadAllLines(string path);
/// <summary>
/// Opens the file at the specified path for reading.
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
FileStream OpenRead(string path);
/// <summary>
/// Downloads the specified URI.
/// </summary>
/// <param name="uri">The URI to download.</param>
/// <param name="notifyErrors">Whether to notify of errors.</param>
/// <returns>An enumerator usable as Coroutine in Unity.</returns>
IEnumerator DownloadUri(string uri, bool notifyErrors);
}
}
|
using System.Collections;
using System.IO;
namespace AsImpL
{
/// <summary>
/// Interface for classes that access the filesystem.
/// </summary>
public interface IFilesystem
{
/// <summary>
/// Reads all data from the specified path into a byte array.
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
byte[] ReadAllBytes(string path);
/// <summary>
/// Reads all lines in the specified file into an array of strings.
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
string[] ReadAllLines(string path);
/// <summary>
/// Opens the file at the specified path for reading.
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
FileStream OpenRead(string path);
/// <summary>
/// Downloads the specified URI.
/// </summary>
/// <param name="uri">The URI to download.</param>
/// <param name="notifyErrors">Whether to notify of errors.</param>
/// <returns>An enumrator usable as Coroutine in Unity.</returns>
IEnumerator DownloadUri(string uri, bool notifyErrors);
}
}
|
mit
|
C#
|
4d19da3e9793405ae7e87dc557320804dbd0e24f
|
remove unused using
|
rebuy-de/xamarin-webtrekk-bindings
|
IOS.Libraries/Properties/AssemblyInfo.cs
|
IOS.Libraries/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using Foundation;
// This attribute allows you to mark your assemblies as “safe to link”.
// When the attribute is present, the linker—if enabled—will process the assembly
// even if you’re using the “Link SDK assemblies only” option, which is the default for device builds.
[assembly: LinkerSafe]
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("IOS.Libraries")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("fokkevermeulen")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using Foundation;
// This attribute allows you to mark your assemblies as “safe to link”.
// When the attribute is present, the linker—if enabled—will process the assembly
// even if you’re using the “Link SDK assemblies only” option, which is the default for device builds.
using ObjCRuntime;
[assembly: LinkerSafe]
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("IOS.Libraries")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("fokkevermeulen")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
mit
|
C#
|
c2f63efea993b01d0f918268ea8b687a18adacc0
|
Revert "test"
|
NiallHow/Software-Eng,qchouleur/MyHome,M-Zuber/MyHome
|
BusinessLogic/GeneralCategoryHandler.cs
|
BusinessLogic/GeneralCategoryHandler.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BusinessLogic
{
public static class GeneralCategoryHandler
{
public static List<string> GetAllCategoryNames()
{
List<string> allCategoryNames = new List<string>();
allCategoryNames.Add("Total Expenses");
allCategoryNames.AddRange((new ExpenseCategoryHandler()).LoadAll().Select(cat => cat.Name).ToList<string>());
allCategoryNames.Add("Total Income");
foreach (string incomeCategoryName in (new IncomeCategoryHandler()).LoadAll().Select(cat => cat.Name).ToList<string>())
{
if (allCategoryNames.Contains(incomeCategoryName))
{
allCategoryNames[allCategoryNames.IndexOf(incomeCategoryName)] = string.Format("{0} - {1}", incomeCategoryName, "Expense");
allCategoryNames.Add(string.Format("{0} - {1}", incomeCategoryName, "Income"));
}
else
{
allCategoryNames.Add(incomeCategoryName);
}
}
return allCategoryNames;
}
public static List<string> GetAllCategoryNames(string categoryType)
{
switch (categoryType.ToLower())
{
case ("expense"):
{
return (new ExpenseCategoryHandler()).LoadAll().Select(exCat => exCat.Name).ToList<string>();
}
case ("income"):
{
return (new IncomeCategoryHandler()).LoadAll().Select(inCat => inCat.Name).ToList<string>();
}
default:
{
return null;
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BusinessLogic
{
public static class GeneralCategoryHandler
{
public static List<string> GetAllCategoryNames()
{
List<string> allCategoryNames = new List<string>();
allCategoryNames.Add("Total Expenses");
allCategoryNames.AddRange((new ExpenseCategoryHandler()).LoadAll().Select(cat => cat.Name).ToList<string>());
allCategoryNames.Add("Total Income");
foreach (string incomeCategoryName in (new IncomeCategoryHandler()).LoadAll().Select(cat => cat.Name).ToList<string>())
{
if (allCategoryNames.Contains(incomeCategoryName))
{
allCategoryNames[allCategoryNames.IndexOf(incomeCategoryName)] = string.Format("{0} - {1}", incomeCategoryName, "Expense");
allCategoryNames.Add(string.Format("{0} - {1}", incomeCategoryName, "Income"));
}
else
{
allCategoryNames.Add(incomeCategoryName);
}
}
return allCategoryNames;
}
public static List<string> GetAllCategoryNames(string categoryType)
{
switch (categoryType.ToLower())
{
case ("expense"):
{
return (new ExpenseCategoryHandler()).LoadAll().Select(exCat => exCat.Name).ToList<string>();
}
case ("income"):
{
return (new IncomeCategoryHandler()).LoadAll().Select(inCat => inCat.Name).ToList<string>();
}
default:
{
return null;
}
}
}
}
}
|
mit
|
C#
|
884a5c5f7efd5a5bbf89388be40717a2f9235c70
|
Make SetUp test pass
|
yawaramin/TDDUnit
|
TestCase.cs
|
TestCase.cs
|
using System;
namespace TDDUnit {
class TestCase {
public TestCase(string name) {
m_name = name;
}
public virtual void SetUp() {
}
public TestResult Run() {
TestResult result = new TestResult();
result.TestStarted();
try {
SetUp();
GetType().GetMethod(m_name).Invoke(this, null);
} catch (Exception) {
result.TestFailed();
}
TearDown();
return result;
}
public virtual void TearDown() {
}
private string m_name;
}
}
|
using System;
namespace TDDUnit {
class TestCase {
public TestCase(string name) {
m_name = name;
}
public virtual void SetUp() {
}
public TestResult Run() {
TestResult result = new TestResult();
result.TestStarted();
SetUp();
try {
GetType().GetMethod(m_name).Invoke(this, null);
} catch (Exception) {
result.TestFailed();
}
TearDown();
return result;
}
public virtual void TearDown() {
}
private string m_name;
}
}
|
apache-2.0
|
C#
|
a428b01a5299ac79624a0ee2e3304ec6ce28be75
|
bump version to 2.1.0
|
piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker
|
Piwik.Tracker/Properties/AssemblyInfo.cs
|
Piwik.Tracker/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.3")]
|
bsd-3-clause
|
C#
|
99f6af0d61cd7c66ed3bc8e69c7457447a57d3b0
|
Test folder change
|
rdadbhawala-cmspl/Workspace
|
Product/Src/Jenkins/GitRegions/Class1.cs
|
Product/Src/Jenkins/GitRegions/Class1.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitRegions
{
public class Class1
{
public string TestProp { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitRegions
{
public class Class1
{
}
}
|
mit
|
C#
|
679a7d9f5f54dc02bf6d982174cb71b05026de34
|
Fix visibility
|
cra0zy/xwt,hamekoz/xwt,antmicro/xwt,directhex/xwt,lytico/xwt,akrisiun/xwt,mminns/xwt,sevoku/xwt,TheBrainTech/xwt,steffenWi/xwt,residuum/xwt,hwthomas/xwt,mono/xwt,iainx/xwt,mminns/xwt
|
Xwt/Xwt.Backends/IMarkdownViewBackend.cs
|
Xwt/Xwt.Backends/IMarkdownViewBackend.cs
|
//
// IMarkdownViewBackend.cs
//
// Author:
// Jérémie Laval <jeremie.laval@xamarin.com>
//
// Copyright (c) 2012 Xamarin, Inc.
using System;
namespace Xwt.Backends
{
[Flags]
public enum MarkdownInlineStyle
{
Italic,
Bold,
Monospace
}
public interface IMarkdownViewBackend : IWidgetBackend
{
object CreateBuffer ();
// Emit unstyled text
void EmitText (object buffer, string text);
// Emit text using combination of the MarkdownInlineStyle
void EmitStyledText (object buffer, string text, MarkdownInlineStyle style);
// Emit a header (h1, h2, ...)
void EmitHeader (object buffer, string title, int level);
// What's outputed afterwards will be a in new paragrapgh
void EmitStartParagraph (object buffer);
void EmitEndParagraph (object buffer);
// Emit a list
// Chain is:
// open-list, open-bullet, <above methods>, close-bullet, close-list
void EmitOpenList (object buffer);
void EmitOpenBullet (object buffer);
void EmitCloseBullet (object buffet);
void EmitCloseList (object buffer);
// Emit a link displaying text and opening the href URL
void EmitLink (object buffer, string href, string text);
// Emit code in a preformated blockquote
void EmitCodeBlock (object buffer, string code);
// Emit an horizontal ruler
void EmitHorizontalRuler (object buffer);
// Display the passed buffer
void SetBuffer (object buffer);
}
}
|
//
// IMarkdownViewBackend.cs
//
// Author:
// Jérémie Laval <jeremie.laval@xamarin.com>
//
// Copyright (c) 2012 Xamarin, Inc.
using System;
namespace Xwt.Backends
{
[Flags]
enum MarkdownInlineStyle
{
Italic,
Bold,
Monospace
}
public interface IMarkdownViewBackend : IWidgetBackend
{
object CreateBuffer ();
// Emit unstyled text
void EmitText (object buffer, string text);
// Emit text using combination of the MarkdownInlineStyle
void EmitStyledText (object buffer, string text, MarkdownInlineStyle style);
// Emit a header (h1, h2, ...)
void EmitHeader (object buffer, string title, int level);
// What's outputed afterwards will be a in new paragrapgh
void EmitStartParagraph (object buffer);
void EmitEndParagraph (object buffer);
// Emit a list
// Chain is:
// open-list, open-bullet, <above methods>, close-bullet, close-list
void EmitOpenList (object buffer);
void EmitOpenBullet (object buffer);
void EmitCloseBullet (object buffet);
void EmitCloseList (object buffer);
// Emit a link displaying text and opening the href URL
void EmitLink (object buffer, string href, string text);
// Emit code in a preformated blockquote
void EmitCodeBlock (object buffer, string code);
// Emit an horizontal ruler
void EmitHorizontalRuler (object buffer);
// Display the passed buffer
void SetBuffer (object buffer);
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.