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 |
|---|---|---|---|---|---|---|---|---|
55ce15c0815cd2f703c1fc1b65697fb67799bbc6
|
Add test for tables
|
mwilliamson/java-mammoth
|
dotnet/Mammoth.Tests/DocumentConverterTests.cs
|
dotnet/Mammoth.Tests/DocumentConverterTests.cs
|
using Xunit;
using System.IO;
using Xunit.Sdk;
using System;
namespace Mammoth.Tests {
public class DocumentConverterTests {
[Fact]
public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() {
assertSuccessfulConversion(
ConvertToHtml("single-paragraph.docx"),
"<p>Walking on imported air</p>");
}
[Fact]
public void CanReadFilesWithUtf8Bom() {
assertSuccessfulConversion(
ConvertToHtml("utf8-bom.docx"),
"<p>This XML has a byte order mark.</p>");
}
[Fact]
public void EmptyParagraphsAreIgnoredByDefault() {
assertSuccessfulConversion(
ConvertToHtml("empty.docx"),
"");
}
[Fact]
public void EmptyParagraphsArePreservedIfIgnoreEmptyParagraphsIsFalse() {
assertSuccessfulConversion(
ConvertToHtml("empty.docx", converter => converter.PreserveEmptyParagraphs()),
"<p></p>");
}
// TODO: simple list
[Fact]
public void WordTablesAreConvertedToHtmlTables() {
assertSuccessfulConversion(
ConvertToHtml("tables.docx"),
"<p>Above</p>" +
"<table>" +
"<tr><td><p>Top left</p></td><td><p>Top right</p></td></tr>" +
"<tr><td><p>Bottom left</p></td><td><p>Bottom right</p></td></tr>" +
"</table>" +
"<p>Below</p>");
}
private void assertSuccessfulConversion(IResult<string> result, string expectedValue) {
if (result.Warnings.Count > 0) {
throw new XunitException("Unexpected warnings: " + string.Join(", ", result.Warnings));
}
Assert.Equal(expectedValue, result.Value);
}
private IResult<string> ConvertToHtml(string name) {
return ConvertToHtml(name, converter => converter);
}
private IResult<string> ConvertToHtml(string name, Func<DocumentConverter, DocumentConverter> configure) {
return configure(new DocumentConverter()).ConvertToHtml(TestFilePath(name));
}
private string TestFilePath(string name) {
return Path.Combine("../../TestData", name);
}
}
}
|
using Xunit;
using System.IO;
using Xunit.Sdk;
using System;
namespace Mammoth.Tests {
public class DocumentConverterTests {
[Fact]
public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() {
assertSuccessfulConversion(
ConvertToHtml("single-paragraph.docx"),
"<p>Walking on imported air</p>");
}
[Fact]
public void CanReadFilesWithUtf8Bom() {
assertSuccessfulConversion(
ConvertToHtml("utf8-bom.docx"),
"<p>This XML has a byte order mark.</p>");
}
[Fact]
public void EmptyParagraphsAreIgnoredByDefault() {
assertSuccessfulConversion(
ConvertToHtml("empty.docx"),
"");
}
[Fact]
public void EmptyParagraphsArePreservedIfIgnoreEmptyParagraphsIsFalse() {
assertSuccessfulConversion(
ConvertToHtml("empty.docx", converter => converter.PreserveEmptyParagraphs()),
"<p></p>");
}
private void assertSuccessfulConversion(IResult<string> result, string expectedValue) {
if (result.Warnings.Count > 0) {
throw new XunitException("Unexpected warnings: " + string.Join(", ", result.Warnings));
}
Assert.Equal(expectedValue, result.Value);
}
private IResult<string> ConvertToHtml(string name) {
return ConvertToHtml(name, converter => converter);
}
private IResult<string> ConvertToHtml(string name, Func<DocumentConverter, DocumentConverter> configure) {
return configure(new DocumentConverter()).ConvertToHtml(TestFilePath(name));
}
private string TestFilePath(string name) {
return Path.Combine("../../TestData", name);
}
}
}
|
bsd-2-clause
|
C#
|
3ec308d53a72a1c2b0a9e59819d703f81e41878b
|
Add useful links
|
johnproctor/EFMigrations
|
CodeFirstMigrations/Program.cs
|
CodeFirstMigrations/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeFirstMigrations
{
class Program
{
//EF Migration Links
//http://weblogs.asp.net/scottgu/code-first-development-with-entity-framework-4
//http://www.appetere.com/Blogs/SteveM/April-2012/Entity-Framework-Code-First-Migrations
//http://elegantcode.com/2012/04/12/entity-framework-migrations-tips/
static void Main(string[] args)
{
var context = new MyContext();
context.Addresses.Add(new Address()
{
HouseNumber = 1,
Street = "My Road",
City = "My City",
Postcode = "XXX XXX"
});
context.SaveChanges();
context.Addresses.ToList().ForEach(x => Console.WriteLine("House on Road: " + x.Street));
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeFirstMigrations
{
class Program
{
static void Main(string[] args)
{
var context = new MyContext();
context.Addresses.Add(new Address()
{
HouseNumber = 1,
Street = "My Road",
City = "My City",
Postcode = "XXX XXX"
});
context.SaveChanges();
context.Addresses.ToList().ForEach(x => Console.WriteLine("House on Road: " + x.Street));
Console.ReadKey();
}
}
}
|
mit
|
C#
|
0b97ecae56bc24c22e6dbd7c64dff80bbdc102f9
|
Fix interface.
|
adbre/git-tfs,spraints/git-tfs,NathanLBCooper/git-tfs,guyboltonking/git-tfs,allansson/git-tfs,steveandpeggyb/Public,codemerlin/git-tfs,codemerlin/git-tfs,TheoAndersen/git-tfs,allansson/git-tfs,adbre/git-tfs,hazzik/git-tfs,modulexcite/git-tfs,kgybels/git-tfs,allansson/git-tfs,hazzik/git-tfs,andyrooger/git-tfs,irontoby/git-tfs,bleissem/git-tfs,modulexcite/git-tfs,guyboltonking/git-tfs,WolfVR/git-tfs,bleissem/git-tfs,bleissem/git-tfs,jeremy-sylvis-tmg/git-tfs,WolfVR/git-tfs,hazzik/git-tfs,allansson/git-tfs,pmiossec/git-tfs,spraints/git-tfs,hazzik/git-tfs,PKRoma/git-tfs,TheoAndersen/git-tfs,kgybels/git-tfs,NathanLBCooper/git-tfs,steveandpeggyb/Public,jeremy-sylvis-tmg/git-tfs,WolfVR/git-tfs,NathanLBCooper/git-tfs,irontoby/git-tfs,git-tfs/git-tfs,codemerlin/git-tfs,timotei/git-tfs,spraints/git-tfs,adbre/git-tfs,irontoby/git-tfs,jeremy-sylvis-tmg/git-tfs,TheoAndersen/git-tfs,steveandpeggyb/Public,kgybels/git-tfs,TheoAndersen/git-tfs,timotei/git-tfs,timotei/git-tfs,modulexcite/git-tfs,guyboltonking/git-tfs,vzabavnov/git-tfs
|
GitTfs/Core/TfsInterop/IItem.cs
|
GitTfs/Core/TfsInterop/IItem.cs
|
using System.IO;
namespace Sep.Git.Tfs.Core.TfsInterop
{
public interface IItem
{
IVersionControlServer VersionControlServer { get; }
int ChangesetId { get; }
string ServerItem { get; }
decimal DeletionId { get; }
TfsItemType ItemType { get; }
int ItemId { get; }
long ContentLength { get; }
Stream DownloadFile();
}
public interface IItemDownloadStrategy
{
Stream DownloadFile(IItem item);
}
}
|
using System.IO;
namespace Sep.Git.Tfs.Core.TfsInterop
{
public interface IItem
{
IVersionControlServer VersionControlServer { get; }
int ChangesetId { get; }
string ServerItem { get; }
decimal DeletionId { get; }
TfsItemType ItemType { get; }
int ItemId { get; }
long ContentLength { get; }
Stream DownloadFile();
}
public interface IItemDownloadStrategy
{
Stream Download(IItem item);
}
}
|
apache-2.0
|
C#
|
d7ca85c87926ef3d264c72c0e3047ce338d4b059
|
Improve ParsedText test for compound token
|
Nezaboodka/Nevod.TextParsing,Nezaboodka/Nevod.TextParsing
|
Source/TextParserTests/ParsedTextTests.cs
|
Source/TextParserTests/ParsedTextTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
namespace TextParser.Tests
{
[TestClass]
public class ParsedTextTests
{
private static readonly string[] Xhtml = { "<p>", "Hello, ", "<b>", "my w", "</b>", "orld!", "</p>" };
private static readonly ISet<int> PlainTextInXhtml = new HashSet<int> { 1, 3, 5 };
// Public
[TestMethod]
public void TokenInSinglePlainTextElement()
{
ParsedText parsedText = CreateParsedText(Xhtml, PlainTextInXhtml);
Token testToken = new Token
{
XhtmlIndex = 1,
StringPosition = 0,
StringLength = 5,
TokenKind = TokenKind.Alphabetic
};
string expected = "Hello";
string actual = parsedText.GetPlainText(testToken);
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void CompoundToken()
{
ParsedText parsedText = CreateParsedText(Xhtml, PlainTextInXhtml);
Token testToken = new Token
{
XhtmlIndex = 3,
StringPosition = 3,
StringLength = 5
};
string expected = "world";
string actual = parsedText.GetPlainText(testToken);
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void PlainText()
{
ParsedText parsedText = CreateParsedText(Xhtml, PlainTextInXhtml);
string expected = "Hello, my world!";
string actual = parsedText.GetAllPlainText();
Assert.AreEqual(expected, actual);;
}
// Internal
private ParsedText CreateParsedText(string[] xhtml, ISet<int> plainTextInXhtml)
{
var result = new ParsedText();
result.SetXhtml(xhtml, plainTextInXhtml);
return result;
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
namespace TextParser.Tests
{
[TestClass]
public class ParsedTextTests
{
private static readonly string[] Xhtml = { "<p>", "Hello, ", "<b>", "w", "</b>", "orld", "</p>" };
private static readonly ISet<int> PlainTextInXhtml = new HashSet<int> { 1, 3, 5 };
// Public
[TestMethod]
public void TokenInSinglePlainTextElement()
{
ParsedText parsedText = CreateParsedText(Xhtml, PlainTextInXhtml);
Token testToken = new Token
{
XhtmlIndex = 1,
StringPosition = 0,
StringLength = 5,
TokenKind = TokenKind.Alphabetic
};
string expected = "Hello";
string actual = parsedText.GetPlainText(testToken);
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void CompoundToken()
{
ParsedText parsedText = CreateParsedText(Xhtml, PlainTextInXhtml);
Token testToken = new Token
{
XhtmlIndex = 3,
StringPosition = 0,
StringLength = 5
};
string expected = "world";
string actual = parsedText.GetPlainText(testToken);
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void PlainText()
{
ParsedText parsedText = CreateParsedText(Xhtml, PlainTextInXhtml);
string expected = "Hello, world";
string actual = parsedText.GetAllPlainText();
Assert.AreEqual(expected, actual);;
}
// Internal
private ParsedText CreateParsedText(string[] xhtml, ISet<int> plainTextInXhtml)
{
var result = new ParsedText();
result.SetXhtml(xhtml, plainTextInXhtml);
return result;
}
}
}
|
mit
|
C#
|
e8026ad843d0b6b349856046cb829e243afb34ca
|
Use null-coalescing assignment
|
fluentassertions/fluentassertions,jnyrup/fluentassertions,fluentassertions/fluentassertions,jnyrup/fluentassertions
|
Src/FluentAssertions/Equivalency/Field.cs
|
Src/FluentAssertions/Equivalency/Field.cs
|
using System;
using System.ComponentModel;
using System.Reflection;
using FluentAssertions.Common;
namespace FluentAssertions.Equivalency;
/// <summary>
/// A specialized type of <see cref="INode "/> that represents a field of an object in a structural equivalency assertion.
/// </summary>
public class Field : Node, IMember
{
private readonly FieldInfo fieldInfo;
private bool? isBrowsable;
public Field(FieldInfo fieldInfo, INode parent)
: this(fieldInfo.ReflectedType, fieldInfo, parent)
{
}
public Field(Type reflectedType, FieldInfo fieldInfo, INode parent)
{
this.fieldInfo = fieldInfo;
DeclaringType = fieldInfo.DeclaringType;
ReflectedType = reflectedType;
Path = parent.PathAndName;
GetSubjectId = parent.GetSubjectId;
Name = fieldInfo.Name;
Type = fieldInfo.FieldType;
ParentType = fieldInfo.DeclaringType;
RootIsCollection = parent.RootIsCollection;
}
public Type ReflectedType { get; }
public object GetValue(object obj)
{
return fieldInfo.GetValue(obj);
}
public Type DeclaringType { get; set; }
public override string Description => $"field {GetSubjectId().Combine(PathAndName)}";
public CSharpAccessModifier GetterAccessibility => fieldInfo.GetCSharpAccessModifier();
public CSharpAccessModifier SetterAccessibility => fieldInfo.GetCSharpAccessModifier();
public bool IsBrowsable =>
isBrowsable ??= fieldInfo.GetCustomAttribute<EditorBrowsableAttribute>() is not { State: EditorBrowsableState.Never };
}
|
using System;
using System.ComponentModel;
using System.Reflection;
using FluentAssertions.Common;
namespace FluentAssertions.Equivalency;
/// <summary>
/// A specialized type of <see cref="INode "/> that represents a field of an object in a structural equivalency assertion.
/// </summary>
public class Field : Node, IMember
{
private readonly FieldInfo fieldInfo;
private bool? isBrowsable;
public Field(FieldInfo fieldInfo, INode parent)
: this(fieldInfo.ReflectedType, fieldInfo, parent)
{
}
public Field(Type reflectedType, FieldInfo fieldInfo, INode parent)
{
this.fieldInfo = fieldInfo;
DeclaringType = fieldInfo.DeclaringType;
ReflectedType = reflectedType;
Path = parent.PathAndName;
GetSubjectId = parent.GetSubjectId;
Name = fieldInfo.Name;
Type = fieldInfo.FieldType;
ParentType = fieldInfo.DeclaringType;
RootIsCollection = parent.RootIsCollection;
}
public Type ReflectedType { get; }
public object GetValue(object obj)
{
return fieldInfo.GetValue(obj);
}
public Type DeclaringType { get; set; }
public override string Description => $"field {GetSubjectId().Combine(PathAndName)}";
public CSharpAccessModifier GetterAccessibility => fieldInfo.GetCSharpAccessModifier();
public CSharpAccessModifier SetterAccessibility => fieldInfo.GetCSharpAccessModifier();
public bool IsBrowsable
{
get
{
if (isBrowsable == null)
{
isBrowsable = fieldInfo.GetCustomAttribute<EditorBrowsableAttribute>() is not { State: EditorBrowsableState.Never };
}
return isBrowsable.Value;
}
}
}
|
apache-2.0
|
C#
|
099732e66815cc7990b96ca67272d2b83a203872
|
add debug log. Debug cutting logic
|
MasakiMuto/LifegameGame
|
LifegameGame/AlphaBetaPlayer.cs
|
LifegameGame/AlphaBetaPlayer.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace LifegameGame
{
using PointScoreDictionary = Dictionary<Point, float>;
public class AlphaBetaPlayer : AIPlayerBase
{
readonly int ThinkDepth;
public AlphaBetaPlayer(GameBoard board, CellState side, int thinkDepth)
: base(board, side)
{
ThinkDepth = thinkDepth;
}
protected override Point Think()
{
var list = new PointScoreDictionary();
float alpha = float.MinValue;
var tree = TreeNode.Create(null, 0f);
tree = null;
foreach (var p in GetPlayablePoints().ToArray())
{
float score = EvalPosition(Board.PlayingBoard, p, ThinkDepth, this.Side, alpha, tree);
list[p] = score;
if (score > alpha)
{
alpha = score;
}
Board.SetBoardOrigin();
}
var res = GetMaxPoint(list);
if (tree != null)
{
TreeNode.SetValue(tree, res.Value);
System.IO.File.WriteAllText("tree.txt", tree.ToString());
}
return res.Key;
}
protected virtual float EvalPosition(BoardInstance board, Point p, int depth, CellState side, float alphaBeta, TreeNode<float> t)
{
EvalCount++;
Board.PlayingBoard = board;
Debug.Assert(Board.CanPlay(p));
var next = Board.VirtualPlay(side, p);
if (Board.IsExit())
{
if (Board.GetWinner() == this.Side)
{
TreeNode.AddChild(t, GameBoard.WinnerBonus);
return GameBoard.WinnerBonus;
}
else
{
TreeNode.AddChild(t, -GameBoard.WinnerBonus);
return -GameBoard.WinnerBonus;
}
}
if (depth == 1)
{
var s = Board.EvalScore() * (int)(this.Side);
TreeNode.AddChild(t, s);
return s;
}
else
{
bool isMax = this.Side != side;
float current = (isMax ? float.MinValue : float.MaxValue);
var tr = TreeNode.AddChild(t, 0);
foreach (var item in GetPlayablePoints().ToArray())
{
float score = EvalPosition(next, item, depth - 1, side == CellState.White ? CellState.Black : CellState.White, current, tr);
if ((isMax && score > current) || (!isMax && score < current))
{
current = score;
}
if (isMax && current >= alphaBeta)
{
break;
}
if (!isMax && current <= alphaBeta)
{
break;
}
}
TreeNode.SetValue(tr, current);
return current;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace LifegameGame
{
using PointScoreDictionary = Dictionary<Point, float>;
public class AlphaBetaPlayer : AIPlayerBase
{
readonly int ThinkDepth;
public AlphaBetaPlayer(GameBoard board, CellState side, int thinkDepth)
: base(board, side)
{
ThinkDepth = thinkDepth;
}
protected override Point Think()
{
var list = new PointScoreDictionary();
float alpha = float.MinValue;
foreach (var p in GetPlayablePoints().ToArray())
{
float score = EvalPosition(Board.PlayingBoard, p, ThinkDepth, this.Side, alpha);
list[p] = score;
if (score > alpha)
{
alpha = score;
}
Board.SetBoardOrigin();
}
var res = GetMaxPoint(list);
return res.Key;
}
protected virtual float EvalPosition(BoardInstance board, Point p, int depth, CellState side, float alphaBeta)
{
EvalCount++;
Board.PlayingBoard = board;
Debug.Assert(Board.CanPlay(p));
var next = Board.VirtualPlay(side, p);
if (Board.IsExit())
{
if (Board.GetWinner() == this.Side)
{
return GameBoard.WinnerBonus;
}
else
{
return -GameBoard.WinnerBonus;
}
}
if (depth == 1)
{
return Board.EvalScore() * (int)(this.Side);
}
else
{
bool isMax = this.Side != side;
float current = (isMax ? float.MinValue : float.MaxValue);
foreach (var item in GetPlayablePoints().ToArray())
{
float score = EvalPosition(next, item, depth - 1, side == CellState.White ? CellState.Black : CellState.White, current);
if ((isMax && score > current) || (!isMax && score < current))
{
current = score;
}
if (!isMax && current > alphaBeta)
{
break;
}
if (isMax && current < alphaBeta)
{
break;
}
}
return current;
}
}
}
}
|
mit
|
C#
|
164931c1ab9c6e421f0b6de983b68e77034c2791
|
Clarify task 1 description
|
hjameel/design-patterns-kata
|
Tests/Task1_DependencyInjectionPattern.cs
|
Tests/Task1_DependencyInjectionPattern.cs
|
// ReSharper disable InconsistentNaming
using DesignPatternsKata.Task1;
using NUnit.Framework;
namespace Tests
{
[TestFixture]
public class Task1_DependencyInjectionPattern
{
[Test]
public void My_friend_should_say_hi()
{
var friend = new Friend();
friend.SayHi();
// An important object oriented design principle, which the Gang of Four recommend is:
// "Program to an interface, not an implementation"
// Do this:
// Make sure that your friend used their voice and said Hi! Replace this assertion with
// one using the mock object below. In order to make the test pass, you'll need to update
// the Friend class, so that it adheres to the principle above.
Assert.Fail("I have no idea if my friend spoke or not");
// Some questions for when you're done:
// Where should we instantiate the objects which make up our application, if not at the
// point where they are used?
// How do we test that our application has been constructed and runs correctly?
}
class MockVoice
{
string _words;
public void Say(string words)
{
_words = words;
}
public void AssertWasSpoken(string expectedWords)
{
Assert.That(_words, Is.EqualTo(expectedWords));
}
}
}
}
|
// ReSharper disable InconsistentNaming
using DesignPatternsKata.Task1;
using NUnit.Framework;
namespace Tests
{
[TestFixture]
public class Task1_DependencyInjectionPattern
{
[Test]
public void My_friend_should_say_hi()
{
var friend = new Friend();
friend.SayHi();
// An important object oriented design principle, which the Gang of Four recommend is:
// "Program to an interface, not an implementation"
// Do this:
// Update the Friend class, so that it adheres to this principle. This will enable
// you to use the mock object below to replace this assertion and make sure that your
// friend used their voice and said Hi!
Assert.Fail("I have no idea if my friend spoke or not");
// Question: Where should we construct the objects which make up our application, if
// not at the point where they are used?
// Question: How do we test that our application has been constructed and runs correctly?
}
class MockVoice
{
string _words;
public void Say(string words)
{
_words = words;
}
public void AssertWasSpoken(string expectedWords)
{
Assert.That(_words, Is.EqualTo(expectedWords));
}
}
}
}
|
mit
|
C#
|
908bf5c20052d522f6e4c91173e8fd1cdbcb8a92
|
Remove duplicated semicolon
|
MassTransit/MassTransit,phatboyg/MassTransit,MassTransit/MassTransit,phatboyg/MassTransit
|
docs/code/transports/CloudAmqpConsoleListener.cs
|
docs/code/transports/CloudAmqpConsoleListener.cs
|
namespace CloudAmqpConsoleListener;
using System.Security.Authentication;
using System.Threading.Tasks;
using MassTransit;
public class Program
{
public static async Task Main()
{
var busControl = Bus.Factory.CreateUsingRabbitMq(cfg =>
{
cfg.Host("wombat.rmq.cloudamqp.com", 5671, "your_vhost", h =>
{
h.Username("your_vhost");
h.Password("your_password");
h.UseSsl(s =>
{
s.Protocol = SslProtocols.Tls12;
});
});
});
}
}
|
namespace CloudAmqpConsoleListener;
using System.Security.Authentication;
using System.Threading.Tasks;
using MassTransit;
public class Program
{
public static async Task Main()
{
var busControl = Bus.Factory.CreateUsingRabbitMq(cfg =>
{
cfg.Host("wombat.rmq.cloudamqp.com", 5671, "your_vhost", h =>
{
h.Username("your_vhost");
h.Password("your_password");
h.UseSsl(s =>
{
s.Protocol = SslProtocols.Tls12;
});;
});
});
}
}
|
apache-2.0
|
C#
|
7436e7023a2eef3501f9d0d9439f8ee9f355c3f4
|
update license key extraction to include hazelcast version number
|
asimarslan/hazelcast-csharp-client,asimarslan/hazelcast-csharp-client
|
Hazelcast.Net/Properties/AssemblyInfo.cs
|
Hazelcast.Net/Properties/AssemblyInfo.cs
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyTitle("Hazelcast .Net Client")]
[assembly: System.Reflection.AssemblyDescription("Hazelcast .Net Client ")]
[assembly: System.Reflection.AssemblyCompany("Hazelcast Inc.")]
[assembly: System.Reflection.AssemblyProduct("Hazelcast Enterprise Edition")]
[assembly: System.Reflection.AssemblyCopyright("Copyright (c) 2008-2015, Hazelcast, Inc")]
[assembly: System.Reflection.AssemblyConfiguration("Commit 027d241")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: System.CLSCompliant(true)]
[assembly: System.Reflection.AssemblyVersion("3.6.0")]
[assembly: System.Reflection.AssemblyFileVersion("3.6.0")]
[assembly: System.Reflection.AssemblyInformationalVersion("3.6.0")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"Hazelcast.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001004d81045a994968ac643918d7bbce405b2473471d8de6aed6bbffc0fe1874bfcabf3c0b437c6c5293a589bdcbe884c6d86934069b35deaf5ab2e770cbff41a20dd4014bb53e481c30bd3ead29437b02dec5916a717a4a2b4fd353e81238b89ae09e5ba0ab615c5fef7937aabab4e240c3dffe2b948047769eeb07f674589d0bb3")]
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyTitle("Hazelcast .Net Client")]
[assembly: System.Reflection.AssemblyDescription("Hazelcast .Net Client ")]
[assembly: System.Reflection.AssemblyCompany("Hazelcast Inc.")]
[assembly: System.Reflection.AssemblyProduct("Hazelcast Enterprise Edition")]
[assembly: System.Reflection.AssemblyCopyright("Copyright (c) 2008-2014, Hazelcast, Inc")]
[assembly: System.Reflection.AssemblyConfiguration("Commit 027d241")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: System.CLSCompliant(true)]
[assembly: System.Reflection.AssemblyVersion("3.5.0.5")]
[assembly: System.Reflection.AssemblyFileVersion("3.5.0.5")]
[assembly: System.Reflection.AssemblyInformationalVersion("3.5.0.5")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"Hazelcast.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001004d81045a994968ac643918d7bbce405b2473471d8de6aed6bbffc0fe1874bfcabf3c0b437c6c5293a589bdcbe884c6d86934069b35deaf5ab2e770cbff41a20dd4014bb53e481c30bd3ead29437b02dec5916a717a4a2b4fd353e81238b89ae09e5ba0ab615c5fef7937aabab4e240c3dffe2b948047769eeb07f674589d0bb3")]
|
apache-2.0
|
C#
|
d97dc22e79021f94249a99cae827d1d25003bac7
|
Add missing dependencies for behaviour screen test
|
ppy/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu
|
osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs
|
osu.Game.Tests/Visual/UserInterface/TestSceneFirstRunScreenBehaviour.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Screens;
using osu.Game.Overlays;
using osu.Game.Overlays.FirstRunSetup;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneFirstRunScreenBehaviour : OsuManualInputManagerTestScene
{
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
public TestSceneFirstRunScreenBehaviour()
{
AddStep("load screen", () =>
{
Child = new ScreenStack(new ScreenBehaviour());
});
}
}
}
|
// 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.Screens;
using osu.Game.Overlays.FirstRunSetup;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneFirstRunScreenBehaviour : OsuManualInputManagerTestScene
{
public TestSceneFirstRunScreenBehaviour()
{
AddStep("load screen", () =>
{
Child = new ScreenStack(new ScreenBehaviour());
});
}
}
}
|
mit
|
C#
|
17d4c51712407901b623415d74607c89d2e1c692
|
REmove method
|
eriawan/roslyn,dotnet/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,weltkante/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,mavasani/roslyn,KevinRansom/roslyn,mavasani/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,sharwell/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,weltkante/roslyn,physhi/roslyn,AmadeusW/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,eriawan/roslyn,KevinRansom/roslyn,physhi/roslyn,dotnet/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,diryboy/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,wvdd007/roslyn
|
src/Tools/ExternalAccess/OmniSharp/Completion/OmniSharpCompletionService.cs
|
src/Tools/ExternalAccess/OmniSharp/Completion/OmniSharpCompletionService.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.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Completion
{
internal static class OmniSharpCompletionService
{
public static Task<(CompletionList completionList, bool expandItemsAvailable)> GetCompletionsAsync(
this CompletionService completionService,
Document document,
int caretPosition,
CompletionTrigger trigger = default,
ImmutableHashSet<string>? roles = null,
OptionSet? options = null,
CancellationToken cancellationToken = default)
=> completionService.GetCompletionsInternalAsync(document, caretPosition, trigger, roles, options, cancellationToken);
public static string GetProviderName(this CompletionItem completionItem) => completionItem.ProviderName;
public static PerLanguageOption<bool?> ShowItemsFromUnimportedNamespaces = (PerLanguageOption<bool?>)CompletionOptions.ShowItemsFromUnimportedNamespaces;
}
}
|
// 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.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Completion
{
internal static class OmniSharpCompletionService
{
public static Task<(CompletionList completionList, bool expandItemsAvailable)> GetCompletionsAsync(
this CompletionService completionService,
Document document,
int caretPosition,
CompletionTrigger trigger = default,
ImmutableHashSet<string>? roles = null,
OptionSet? options = null,
CancellationToken cancellationToken = default)
=> completionService.GetCompletionsInternalAsync(document, caretPosition, trigger, roles, options, cancellationToken);
public static Task<CompletionChange> GetChangeAsync(
this CompletionService completionService,
Document document,
CompletionItem item,
TextSpan completionListSpan,
char? commitCharacter = null,
bool disallowAddingImports = false,
CancellationToken cancellationToken = default)
=> completionService.GetChangeAsync(document, item, commitCharacter, cancellationToken);
public static string GetProviderName(this CompletionItem completionItem) => completionItem.ProviderName;
public static PerLanguageOption<bool?> ShowItemsFromUnimportedNamespaces = (PerLanguageOption<bool?>)CompletionOptions.ShowItemsFromUnimportedNamespaces;
}
}
|
mit
|
C#
|
19f68539d2a6ebab89412fc708e87473e34e7000
|
build fix
|
Softlr/Selenium.WebDriver.Extensions
|
test/Selenium.WebDriver.Extensions.IntegrationTests/Fixtures/EdgeFixture.cs
|
test/Selenium.WebDriver.Extensions.IntegrationTests/Fixtures/EdgeFixture.cs
|
namespace Selenium.WebDriver.Extensions.IntegrationTests.Fixtures
{
using System.Diagnostics.CodeAnalysis;
using System.IO;
using OpenQA.Selenium.Edge;
[ExcludeFromCodeCoverage]
public class EdgeFixture : FixtureBase
{
public EdgeFixture()
{
var options = new EdgeOptions();
options.AddArgument("headless");
options.AddArgument("disable-gpu");
Browser = new EdgeDriver(Path.GetDirectoryName(typeof(EdgeFixture).Assembly.Location), options);
}
}
}
|
namespace Selenium.WebDriver.Extensions.IntegrationTests.Fixtures
{
using System.Diagnostics.CodeAnalysis;
using System.IO;
using OpenQA.Selenium.Edge;
[ExcludeFromCodeCoverage]
public class EdgeFixture : FixtureBase
{
public EdgeFixture()
{
var options = new EdgeOptions { UseChromium = true };
options.AddArgument("headless");
options.AddArgument("disable-gpu");
Browser = new EdgeDriver(Path.GetDirectoryName(typeof(EdgeFixture).Assembly.Location), options);
}
}
}
|
apache-2.0
|
C#
|
77459961f816da53374726491f2d29916c46d761
|
Address review comments
|
GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples
|
functions/helloworld/HelloWorld.Tests/HelloGcsTest.cs
|
functions/helloworld/HelloWorld.Tests/HelloGcsTest.cs
|
// Copyright 2020 Google LLC
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace HelloWorld.Tests
{
public class HelloGcsTest : FunctionTestBase<HelloGcs.Function>
{
[Fact]
public async Task CloudEventInput()
{
var client = Server.CreateClient();
var request = new HttpRequestMessage
{
RequestUri = new Uri("uri", System.UriKind.Relative),
// CloudEvent headers
Headers =
{
{ "ce-type", "com.google.cloud.storage.object.finalized.v0" },
{ "ce-id", "1234" },
{ "ce-source", "//storage.googleapis.com/" },
{ "ce-specversion", "1.0" }
},
Content = new StringContent("{\"name\":\"file\"}", Encoding.UTF8, "application/json"),
Method = HttpMethod.Post
};
var response = await client.SendAsync(request);
// Currently we're just testing that the request was successful.
// It would be nice to test the log as well.
// See https://github.com/GoogleCloudPlatform/functions-framework-dotnet/issues/93
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
[Fact]
public async Task NotCloudEvent()
{
var client = Server.CreateClient();
var response = await client.GetAsync("uri");
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}
}
}
|
// Copyright 2020 Google LLC
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace HelloWorld.Tests
{
public class HelloGcsTest : FunctionTestBase<HelloGcs.Function>
{
[Fact]
public async Task CloudEventInput()
{
var client = Server.CreateClient();
var request = new HttpRequestMessage
{
RequestUri = new Uri("uri", System.UriKind.Relative),
Headers =
{
{ "ce-type", "com.google.cloud.storage.object.finalized.v0" },
{ "ce-id", "1234" },
{ "ce-source", "//storage.googleapis.com/" },
{ "ce-specversion", "1.0" }
},
Content = new StringContent("{\"name\":\"file\"}", Encoding.UTF8, "application/json"),
Method = HttpMethod.Post
};
var response = await client.SendAsync(request);
// Currently we're just testing that the request was successful.
// It would be nice to test the log as well.
// See https://github.com/GoogleCloudPlatform/functions-framework-dotnet/issues/93
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
[Fact]
public async Task NotCloudEvent()
{
var client = Server.CreateClient();
var response = await client.GetAsync("uri");
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}
}
}
|
apache-2.0
|
C#
|
442d82a4c69ef13af6b089e967296f7ebb061211
|
use controller selector in sample project
|
JSONAPIdotNET/JSONAPI.NET,SathishN/JSONAPI.NET,SphtKr/JSONAPI.NET,DefactoSoftware/JSONAPI.NET,danshapir/JSONAPI.NET
|
JSONAPI.TodoMVC.API/Startup.cs
|
JSONAPI.TodoMVC.API/Startup.cs
|
using System.Web.Http;
using System.Web.Http.Dispatcher;
using JSONAPI.ActionFilters;
using JSONAPI.Core;
using JSONAPI.EntityFramework.ActionFilters;
using JSONAPI.Http;
using JSONAPI.Json;
using Owin;
namespace JSONAPI.TodoMVC.API
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
var httpConfig = GetWebApiConfiguration();
app.UseWebApi(httpConfig);
}
private static HttpConfiguration GetWebApiConfiguration()
{
var pluralizationService = new PluralizationService();
var config = new HttpConfiguration();
var modelManager = new ModelManager(pluralizationService);
var formatter = new JsonApiFormatter(modelManager);
config.Formatters.Clear();
config.Formatters.Add(formatter);
// Global filters
config.Filters.Add(new EnumerateQueryableAsyncAttribute());
config.Filters.Add(new EnableFilteringAttribute(modelManager));
// Override controller selector
config.Services.Replace(typeof(IHttpControllerSelector), new PascalizedControllerSelector(config));
// Web API routes
config.Routes.MapHttpRoute("DefaultApi", "{controller}/{id}", new { id = RouteParameter.Optional });
return config;
}
}
}
|
using System.Web.Http;
using JSONAPI.ActionFilters;
using JSONAPI.Core;
using JSONAPI.EntityFramework.ActionFilters;
using JSONAPI.Json;
using Owin;
namespace JSONAPI.TodoMVC.API
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
var httpConfig = GetWebApiConfiguration();
app.UseWebApi(httpConfig);
}
private static HttpConfiguration GetWebApiConfiguration()
{
var pluralizationService = new PluralizationService();
var config = new HttpConfiguration();
var modelManager = new ModelManager(pluralizationService);
var formatter = new JsonApiFormatter(modelManager);
config.Formatters.Clear();
config.Formatters.Add(formatter);
// Global filters
config.Filters.Add(new EnumerateQueryableAsyncAttribute());
config.Filters.Add(new EnableFilteringAttribute(modelManager));
// Web API routes
config.Routes.MapHttpRoute("DefaultApi", "{controller}/{id}", new { id = RouteParameter.Optional });
return config;
}
}
}
|
mit
|
C#
|
edaffb36a228841245deafb7a4c69f82a80419ef
|
bump version
|
neutmute/loggly-csharp
|
SolutionItems/Properties/AssemblyInfo.cs
|
SolutionItems/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
[assembly: AssemblyCompany("Karl Seguin")]
[assembly: AssemblyVersion("3.5.0.0")]
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyProduct("loggly-csharp")]
[assembly: InternalsVisibleTo("Loggly.Tests")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyInformationalVersion("3.5.1-alpha-v2")]
#else
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyInformationalVersion("3.5.1")]
#endif
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
[assembly: AssemblyCompany("Karl Seguin")]
[assembly: AssemblyCopyright("Copyright Karl Seguin 2010")]
[assembly: AssemblyVersion("3.5.0.0")]
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyProduct("loggly-csharp")]
[assembly: InternalsVisibleTo("Loggly.Tests")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyInformationalVersion("3.5.1-alpha-v2")]
#else
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyInformationalVersion("3.5.0")]
#endif
|
mit
|
C#
|
f43a8308b9abbe9add3ca4399f31c15b339e36eb
|
Reformat for better readability
|
OrleansContrib/Orleankka,yevhen/Orleankka,pkese/Orleankka,yevhen/Orleankka,mhertis/Orleankka,AntyaDev/Orleankka,pkese/Orleankka,OrleansContrib/Orleankka,mhertis/Orleankka,AntyaDev/Orleankka
|
Source/Orleankka/Ref.cs
|
Source/Orleankka/Ref.cs
|
using System;
using System.Linq.Expressions;
using System.Collections.Generic;
using System.Reflection;
namespace Orleankka
{
using Core;
using Utility;
public abstract class Ref
{
static readonly Dictionary<Type, Func<string, Ref>> deserializers =
new Dictionary<Type, Func<string, Ref>>();
internal static void Reset() => deserializers.Clear();
internal static void Register(ActorType actor)
{
var @ref = ConstructRefType(actor);
var constructor = CompileConstructor(@ref);
RegisterDeserializer(@ref, constructor);
}
static Type ConstructRefType(ActorType actor)
{
return typeof(ActorRef<>).MakeGenericType(actor.Implementation);
}
static Func<ActorRef, Ref> CompileConstructor(Type type)
{
var constructor = type.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic)[0];
var parameter = Expression.Parameter(typeof(ActorRef), "@ref");
var @new = Expression.New(constructor, parameter);
var invoker = Expression.Lambda<Func<ActorRef, Ref>>(@new, parameter);
return invoker.Compile();
}
static void RegisterDeserializer(Type @ref, Func<ActorRef, Ref> constructor)
{
deserializers.Add(@ref, path => constructor(ActorRef.Deserialize(path)));
}
public static Ref Deserialize(string path, Type type)
{
if (type == typeof(ClientRef))
return ClientRef.Deserialize(path);
if (type == typeof(ActorRef))
return ActorRef.Deserialize(path);
if (type == typeof(StreamRef))
return StreamRef.Deserialize(path);
var deserializer = deserializers.Find(type);
if (deserializer != null)
return deserializer(path);
throw new InvalidOperationException("Unknown ref type: " + type);
}
public abstract string Serialize();
}
}
|
using System;
using System.Linq.Expressions;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
namespace Orleankka
{
using Core;
using Utility;
public abstract class Ref
{
static readonly Dictionary<Type, Func<string, Ref>> deserializers =
new Dictionary<Type, Func<string, Ref>>();
internal static void Reset() => deserializers.Clear();
internal static void Register(ActorType type)
{
var @ref = typeof(ActorRef<>).MakeGenericType(type.Implementation);
var constructor = CompileConstructor(@ref);
deserializers.Add(@ref, path => constructor(ActorRef.Deserialize(path)));
}
static Func<ActorRef, Ref> CompileConstructor(Type type)
{
var constructor = type.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic)[0];
Debug.Assert(constructor != null);
var param = Expression.Parameter(typeof(ActorRef), "@ref");
var lambda = Expression.Lambda<Func<ActorRef, Ref>>(Expression.New(constructor, param), param);
return lambda.Compile();
}
public static Ref Deserialize(string path, Type type)
{
if (type == typeof(ClientRef))
return ClientRef.Deserialize(path);
if (type == typeof(ActorRef))
return ActorRef.Deserialize(path);
if (type == typeof(StreamRef))
return StreamRef.Deserialize(path);
var deserializer = deserializers.Find(type);
if (deserializer != null)
return deserializer(path);
throw new InvalidOperationException("Unknown ref type: " + type);
}
public abstract string Serialize();
}
}
|
apache-2.0
|
C#
|
5a65e08fc052593d48963734b444167fe350845b
|
Change namespace of `UriUtilsTests` to `Atata.UnitTests.Utils`
|
atata-framework/atata,atata-framework/atata
|
test/Atata.UnitTests/Utils/UriUtilsTests.cs
|
test/Atata.UnitTests/Utils/UriUtilsTests.cs
|
namespace Atata.UnitTests.Utils;
[TestFixture]
public class UriUtilsTests
{
[TestCase("http://something.com", true)]
[TestCase("https://something.com", true)]
[TestCase("ftp://something.com", true)]
[TestCase("custom://something.com", true)]
[TestCase("http:/something.com", false)]
[TestCase("//something", false)]
[TestCase("/something", false)]
[TestCase("something", false)]
[TestCase(null, false)]
public void TryCreateAbsoluteUrl(string url, bool isAbsolute)
{
var isActuallyAbsolute = UriUtils.TryCreateAbsoluteUrl(url, out Uri result);
isActuallyAbsolute.Should().Be(isAbsolute);
if (isAbsolute)
result.AbsoluteUri.Should().StartWith(url);
else
result.Should().BeNull();
}
[TestCase("http://some.com", "path", ExpectedResult = "http://some.com/path")]
[TestCase("http://some.com/", "path", ExpectedResult = "http://some.com/path")]
[TestCase("http://some.com", "/path", ExpectedResult = "http://some.com/path")]
[TestCase("http://some.com/", "/path", ExpectedResult = "http://some.com/path")]
[TestCase("http://some.com", null, ExpectedResult = "http://some.com/")]
public string Concat(string baseUri, string relativeUri) =>
UriUtils.Concat(baseUri, relativeUri).AbsoluteUri;
[Test]
public void Concat_WithNullBaseUrl() =>
Assert.Throws<ArgumentNullException>(() =>
UriUtils.Concat(null, "/path"));
}
|
namespace Atata.UnitTests;
[TestFixture]
public class UriUtilsTests
{
[TestCase("http://something.com", true)]
[TestCase("https://something.com", true)]
[TestCase("ftp://something.com", true)]
[TestCase("custom://something.com", true)]
[TestCase("http:/something.com", false)]
[TestCase("//something", false)]
[TestCase("/something", false)]
[TestCase("something", false)]
[TestCase(null, false)]
public void TryCreateAbsoluteUrl(string url, bool isAbsolute)
{
var isActuallyAbsolute = UriUtils.TryCreateAbsoluteUrl(url, out Uri result);
isActuallyAbsolute.Should().Be(isAbsolute);
if (isAbsolute)
result.AbsoluteUri.Should().StartWith(url);
else
result.Should().BeNull();
}
[TestCase("http://some.com", "path", ExpectedResult = "http://some.com/path")]
[TestCase("http://some.com/", "path", ExpectedResult = "http://some.com/path")]
[TestCase("http://some.com", "/path", ExpectedResult = "http://some.com/path")]
[TestCase("http://some.com/", "/path", ExpectedResult = "http://some.com/path")]
[TestCase("http://some.com", null, ExpectedResult = "http://some.com/")]
public string Concat(string baseUri, string relativeUri) =>
UriUtils.Concat(baseUri, relativeUri).AbsoluteUri;
[Test]
public void Concat_WithNullBaseUrl() =>
Assert.Throws<ArgumentNullException>(() =>
UriUtils.Concat(null, "/path"));
}
|
apache-2.0
|
C#
|
d52d71f52fb679babc7a73f4aca94425a00eb0dd
|
fix Jpeg strip tool to substitue greates found data segment
|
Clancey/taglib-sharp,archrival/taglib-sharp,CamargoR/taglib-sharp,hwahrmann/taglib-sharp,CamargoR/taglib-sharp,archrival/taglib-sharp,hwahrmann/taglib-sharp,punker76/taglib-sharp,Clancey/taglib-sharp,punker76/taglib-sharp,Clancey/taglib-sharp,mono/taglib-sharp
|
examples/StripImageData.cs
|
examples/StripImageData.cs
|
using System;
using TagLib;
public class StripImageData
{
private static byte[] image_data = new byte[] {
0xFF, 0xDA, 0x00, 0x0C, 0x03, 0x01, 0x00,
0x02, 0x11, 0x03, 0x11, 0x00, 0x3F, 0x00,
0x8C, 0x80, 0x07, 0xFF, 0xD9
};
public static void Main (string [] args)
{
if (args.Length != 1) {
Console.Out.WriteLine ("usage: mono StripImageData.exe [jpegfile]");
return;
}
ImageFile file = new ImageFile (args [0]);
file.Mode = File.AccessMode.Write;
long greatest_segment_position = 0;
long greatest_segment_length = 0;
// collect data segments
while (true) {
long sos = file.Find (new byte [] {0xFF, 0xDA}, file.Tell);
if (sos == -1)
break;
file.Seek (sos);
long segment_length = SkipDataSegment (file);
if (segment_length > greatest_segment_length) {
greatest_segment_length = segment_length;
greatest_segment_position = sos;
}
}
if (greatest_segment_length == 0)
{
Console.Out.WriteLine ("doesn't look like an jpeg file");
return;
}
System.Console.WriteLine ("Stripping data segment at {0}", greatest_segment_position);
file.RemoveBlock (greatest_segment_position, greatest_segment_length);
file.Seek (greatest_segment_position);
file.WriteBlock (image_data);
file.Mode = File.AccessMode.Closed;
}
private static long SkipDataSegment (ImageFile file)
{
long position = file.Tell;
// skip sos maker
if (file.ReadBlock (2).ToUInt () != 0xFFDA)
throw new Exception (String.Format ("Not a data segment at position: {0}", position));
while (true) {
if (0xFF == (byte) file.ReadBlock (1)[0]) {
byte maker = (byte) file.ReadBlock (1)[0];
if (maker != 0x00 && (maker <= 0xD0 || maker >= 0xD7))
break;
}
}
long length = file.Tell - position - 2;
System.Console.WriteLine ("Data segment of length {0} found at {1}", length, position);
return length;
}
private class ImageFile : File {
// Hacky implementation to make use of some methods defined in TagLib.File
public ImageFile (string path)
: base (new File.LocalFileAbstraction (path)) {}
public override Tag GetTag (TagLib.TagTypes type, bool create)
{
throw new System.NotImplementedException ();
}
public override Properties Properties {
get {
throw new System.NotImplementedException ();
}
}
public override void RemoveTags (TagLib.TagTypes types)
{
throw new System.NotImplementedException ();
}
public override void Save ()
{
throw new System.NotImplementedException ();
}
public override Tag Tag {
get {
throw new System.NotImplementedException ();
}
}
}
}
|
using System;
using TagLib;
public class StripImageData
{
private static byte[] image_data = new byte[] {
0xFF, 0xDA, 0x00, 0x0C, 0x03, 0x01, 0x00,
0x02, 0x11, 0x03, 0x11, 0x00, 0x3F, 0x00,
0x8C, 0x80, 0x07, 0xFF, 0xD9
};
public static void Main (string [] args)
{
if (args.Length != 1) {
Console.Out.WriteLine ("usage: mono StripImageData.exe [jpegfile]");
return;
}
ImageFile file = new ImageFile (args [0]);
file.Mode = File.AccessMode.Write;
long sos = file.RFind (new byte [] {0xFF, 0xDA});
if (sos == -1) {
Console.Out.WriteLine ("doesn't look like an jpeg file");
return;
}
file.RemoveBlock (sos, file.Length - sos);
file.Seek (sos);
file.WriteBlock (image_data);
file.Mode = File.AccessMode.Closed;
}
private class ImageFile : File {
// Hacky implementation to make use of some methods defined in TagLib.File
public ImageFile (string path)
: base (new File.LocalFileAbstraction (path)) {}
public override Tag GetTag (TagLib.TagTypes type, bool create)
{
throw new System.NotImplementedException ();
}
public override Properties Properties {
get {
throw new System.NotImplementedException ();
}
}
public override void RemoveTags (TagLib.TagTypes types)
{
throw new System.NotImplementedException ();
}
public override void Save ()
{
throw new System.NotImplementedException ();
}
public override Tag Tag {
get {
throw new System.NotImplementedException ();
}
}
}
}
|
lgpl-2.1
|
C#
|
675d84f955fd602449c17e585d479167b15e3316
|
remove feat...
|
Cologler/jasily.cologler
|
Jasily.Core/Singleton.cs
|
Jasily.Core/Singleton.cs
|
namespace System
{
public static class Singleton
{
public static T Instance<T>() where T : class, new()
{
if (Shared<T>.instance == null)
{
lock (typeof(Shared<T>))
{
if (Shared<T>.instance == null)
{
Shared<T>.instance = new T();
}
}
}
return Shared<T>.instance;
}
private static class Shared<T> where T : class
{
// ReSharper disable once InconsistentNaming
public static T instance;
}
#region thread static
public static T ThreadStaticInstance<T>() where T : class, new()
=> ThreadStatic<T>.instance ?? (ThreadStatic<T>.instance = new T());
private static class ThreadStatic<T> where T : class
{
[ThreadStatic]
// ReSharper disable once InconsistentNaming
public static T instance;
}
#endregion
}
}
|
using JetBrains.Annotations;
namespace System
{
public static class Singleton
{
public static T Instance<T>() where T : class, new()
{
if (Shared<T>.instance == null)
{
lock (typeof(Shared<T>))
{
if (Shared<T>.instance == null)
{
Shared<T>.instance = new T();
}
}
}
return Shared<T>.instance;
}
public static T Instance<T>([NotNull] Func<T> creator) where T : class
{
if (creator == null) throw new ArgumentNullException(nameof(creator));
if (Shared<T>.instance == null)
{
lock (typeof(Shared<T>))
{
if (Shared<T>.instance == null)
{
Shared<T>.instance = creator();
}
}
}
return Shared<T>.instance;
}
private static class Shared<T> where T : class
{
// ReSharper disable once InconsistentNaming
public static T instance;
}
#region thread static
public static T ThreadStaticInstance<T>() where T : class, new()
=> ThreadStatic<T>.instance ?? (ThreadStatic<T>.instance = new T());
private static class ThreadStatic<T> where T : class
{
[ThreadStatic]
// ReSharper disable once InconsistentNaming
public static T instance;
}
#endregion
}
}
|
mit
|
C#
|
225083f99d6e5460ad9adec9a5b79ee42d559995
|
add commandline help message.
|
banban525/InspectCodeViewer,banban525/InspectCodeViewer,banban525/InspectCodeViewer,banban525/InspectCodeViewer
|
src_cs/ParseInspectedCodes/Options.cs
|
src_cs/ParseInspectedCodes/Options.cs
|
using CommandLine;
namespace ParseInspectedCodes
{
class Options
{
[Option('i', "input", Required = true, HelpText = "path fro a InspectCode result file")]
public string Input { get; set; }
[Option("id", Required = false, HelpText = "revision id if you want to change id")]
public string Id { get; set; }
[Option('o', "output", Required = false, HelpText = "\"revisions\" folder path for output.")]
public string OutputDirectory { get; set; }
[Option('b', "base", Required = false, HelpText = "base directory to seach source codes.")]
public string ProgramBaseDirectory { get; set; }
[Option('t', "title", Required = false, HelpText = "revision title")]
public string Title { get; set; }
[Option('l', "link", Required = false, HelpText = "url to a revision in repository")]
public string Link { get; set; }
[HelpOption]
public string GetUsage()
{
var help = new CommandLine.Text.HelpText {AddDashesToOption = true};
help.AddPreOptionsLine("Usage: InspectCodeVisualizer.exe -i <InspectCode Result file> -b <source code base directory>");
help.AddPreOptionsLine("");
help.AddPreOptionsLine("option:");
help.AddOptions(this);
return help;
}
}
}
|
using CommandLine;
namespace ParseInspectedCodes
{
class Options
{
[Option('i', "input", Required = true, HelpText = "path fro a InspectCode result file")]
public string Input { get; set; }
[Option("id", Required = false, HelpText = "revision id if you want to change id")]
public string Id { get; set; }
[Option('o', "output", Required = false, HelpText = "\"revisions\" folder path for output.")]
public string OutputDirectory { get; set; }
[Option('b', "base", Required = false, HelpText = "base directory to seach source codes.")]
public string ProgramBaseDirectory { get; set; }
[Option('t', "title", Required = false, HelpText = "")]
public string Title { get; set; }
[Option('l', "link", Required = false, HelpText = "")]
public string Link { get; set; }
[HelpOption]
public string GetUsage()
{
var help = new CommandLine.Text.HelpText {AddDashesToOption = true};
help.AddPreOptionsLine("Usage: InspectCodeVisualizer.exe -i <InspectCode Result file>");
help.AddPreOptionsLine("");
help.AddPreOptionsLine("Usage: InspectCodeVisualizer.exe -i <InspectCode Result file> -b <source code base directory>");
help.AddPreOptionsLine("");
help.AddPreOptionsLine("Usage: InspectCodeVisualizer.exe -i <InspectCode Result file> -o <\"revisions\" directory>");
help.AddPreOptionsLine("");
help.AddPreOptionsLine("option:");
help.AddOptions(this);
return help;
}
}
}
|
mit
|
C#
|
178187089ba219e8cef4499ac04008767f486128
|
Remove regions
|
foxip/mollie-api-csharp
|
Mollie.Api/Models/Issuer.cs
|
Mollie.Api/Models/Issuer.cs
|
namespace Mollie.Api.Models
{
/// <summary>
/// iDeal issuer
/// </summary>
public class Issuer
{
public string id { get; set; }
public string name { get; set; }
public string method { get; set; }
}
}
|
namespace Mollie.Api.Models
{
#region Enums
#endregion
#region Plain objects
/// <summary>
/// iDeal issuer
/// </summary>
public class Issuer
{
public string id { get; set; }
public string name { get; set; }
public string method { get; set; }
}
#endregion
}
|
bsd-2-clause
|
C#
|
db352168e7959c31279c4486af8def6048f9f770
|
update to the example project
|
florinciubotariu/RiotSharp,BenFradet/RiotSharp,jessehallam/RiotSharp,aktai0/RiotSharp,frederickrogan/RiotSharp,Challengermode/RiotSharp,jono-90/RiotSharp,Qinusty/RiotSharp,RodrigoArantes23/RiotSharp,Oucema90/RiotSharp,Shidesu/RiotSharp,oisindoherty/RiotSharp,JanOuborny/RiotSharp
|
RiotSharpExample/Program.cs
|
RiotSharpExample/Program.cs
|
using System;
using System.Configuration;
using System.Globalization;
using RiotSharp;
namespace RiotSharpExample
{
class Program
{
static void Main(string[] args)
{
var api = RiotApi.GetInstance(ConfigurationManager.AppSettings["ApiKey"]);
var staticApi = StaticRiotApi.GetInstance(ConfigurationManager.AppSettings["ApiKey"]);
var statusApi = StatusRiotApi.GetInstance();
int id = int.Parse(ConfigurationManager.AppSettings["Summoner1Id"]);
string name = ConfigurationManager.AppSettings["Summoner1Name"];
int id2 = int.Parse(ConfigurationManager.AppSettings["Summoner2Id"]);
string name2 = ConfigurationManager.AppSettings["Summoner2Name"];
string team = ConfigurationManager.AppSettings["Team1Id"];
string team2 = ConfigurationManager.AppSettings["Team2Id"];
var shards = statusApi.GetShards();
var shardStatus = statusApi.GetShardStatus(Region.euw);
var games = api.GetRecentGames(Region.euw, id);
Console.ReadLine();
}
}
}
|
using System;
using System.Configuration;
using RiotSharp;
namespace RiotSharpExample
{
class Program
{
static void Main(string[] args)
{
var api = RiotApi.GetInstance(ConfigurationManager.AppSettings["ApiKey"]);
var staticApi = StaticRiotApi.GetInstance(ConfigurationManager.AppSettings["ApiKey"]);
int id = int.Parse(ConfigurationManager.AppSettings["Summoner1Id"]);
string name = ConfigurationManager.AppSettings["Summoner1Name"];
int id2 = int.Parse(ConfigurationManager.AppSettings["Summoner2Id"]);
string name2 = ConfigurationManager.AppSettings["Summoner2Name"];
string team = ConfigurationManager.AppSettings["Team1Id"];
string team2 = ConfigurationManager.AppSettings["Team2Id"];
var games = api.GetRecentGames(Region.euw, id);
Console.ReadLine();
}
}
}
|
mit
|
C#
|
115428ec50d27915b36250e0b17dacca05b95926
|
Fix popups for Google & Apple sign-in
|
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
|
Browser/Handling/General/CustomLifeSpanHandler.cs
|
Browser/Handling/General/CustomLifeSpanHandler.cs
|
using System;
using CefSharp;
using CefSharp.Handler;
using TweetDuck.Controls;
using TweetDuck.Utils;
namespace TweetDuck.Browser.Handling.General {
sealed class CustomLifeSpanHandler : LifeSpanHandler {
private static bool IsPopupAllowed(string url) {
return url.StartsWith("https://twitter.com/teams/authorize?", StringComparison.Ordinal) ||
url.StartsWith("https://accounts.google.com/", StringComparison.Ordinal) ||
url.StartsWith("https://appleid.apple.com/", StringComparison.Ordinal);
}
public static bool HandleLinkClick(IWebBrowser browserControl, WindowOpenDisposition targetDisposition, string targetUrl) {
switch (targetDisposition) {
case WindowOpenDisposition.NewBackgroundTab:
case WindowOpenDisposition.NewForegroundTab:
case WindowOpenDisposition.NewPopup when !IsPopupAllowed(targetUrl):
case WindowOpenDisposition.NewWindow:
browserControl.AsControl().InvokeAsyncSafe(() => BrowserUtils.OpenExternalBrowser(targetUrl));
return true;
default:
return false;
}
}
protected override bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) {
newBrowser = null;
return HandleLinkClick(browserControl, targetDisposition, targetUrl);
}
protected override bool DoClose(IWebBrowser browserControl, IBrowser browser) {
return false;
}
}
}
|
using CefSharp;
using CefSharp.Handler;
using TweetDuck.Controls;
using TweetDuck.Utils;
namespace TweetDuck.Browser.Handling.General {
sealed class CustomLifeSpanHandler : LifeSpanHandler {
private static bool IsPopupAllowed(string url) {
return url.StartsWith("https://twitter.com/teams/authorize?");
}
public static bool HandleLinkClick(IWebBrowser browserControl, WindowOpenDisposition targetDisposition, string targetUrl) {
switch (targetDisposition) {
case WindowOpenDisposition.NewBackgroundTab:
case WindowOpenDisposition.NewForegroundTab:
case WindowOpenDisposition.NewPopup when !IsPopupAllowed(targetUrl):
case WindowOpenDisposition.NewWindow:
browserControl.AsControl().InvokeAsyncSafe(() => BrowserUtils.OpenExternalBrowser(targetUrl));
return true;
default:
return false;
}
}
protected override bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) {
newBrowser = null;
return HandleLinkClick(browserControl, targetDisposition, targetUrl);
}
protected override bool DoClose(IWebBrowser browserControl, IBrowser browser) {
return false;
}
}
}
|
mit
|
C#
|
ada95a245ece747d72be3680c155f7ea31f04931
|
Add CORS headers
|
Dynalon/Rainy,Dynalon/Rainy,Dynalon/Rainy,Dynalon/Rainy
|
Rainy/RainyStandaloneServer.cs
|
Rainy/RainyStandaloneServer.cs
|
using System;
using ServiceStack.WebHost.Endpoints;
using ServiceStack.Common.Web;
using log4net;
using Rainy.OAuth;
using Rainy.WebService;
namespace Rainy
{
public class RainyStandaloneServer : IDisposable
{
public readonly string ListenUrl;
public static OAuthHandlerBase OAuth;
public static string Passkey;
public static IDataBackend DataBackend { get; private set; }
private AppHost appHost;
private ILog logger;
public RainyStandaloneServer (IDataBackend backend, string listen_url)
{
ListenUrl = listen_url;
logger = LogManager.GetLogger (this.GetType ());
OAuth = backend.OAuth;
DataBackend = backend;
}
public void Start ()
{
appHost = new AppHost ();
appHost.Init ();
logger.DebugFormat ("starting http listener at: {0}", ListenUrl);
appHost.Start (ListenUrl);
}
public void Stop ()
{
appHost.Stop ();
appHost.Dispose ();
}
public void Dispose ()
{
Stop ();
}
}
public class AppHost : AppHostHttpListenerBase
{
public AppHost () : base("Rainy", typeof(GetNotesRequest).Assembly)
{
}
public override void Configure (Funq.Container container)
{
// not all tomboy clients send the correct content-type
// so we force application/json
SetConfig (new EndpointHostConfig {
DefaultContentType = ContentType.Json,
GlobalResponseHeaders = {
{ "Access-Control-Allow-Origin", "*" },
{ "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" },
{ "Access-Control-Allow-Headers", "Content-Type" },
},
});
}
}
}
|
using System;
using ServiceStack.WebHost.Endpoints;
using ServiceStack.Common.Web;
using log4net;
using Rainy.OAuth;
using Rainy.WebService;
namespace Rainy
{
public class RainyStandaloneServer : IDisposable
{
public readonly string ListenUrl;
public static OAuthHandlerBase OAuth;
public static string Passkey;
public static IDataBackend DataBackend { get; private set; }
private AppHost appHost;
private ILog logger;
public RainyStandaloneServer (IDataBackend backend, string listen_url)
{
ListenUrl = listen_url;
logger = LogManager.GetLogger (this.GetType ());
OAuth = backend.OAuth;
DataBackend = backend;
}
public void Start ()
{
appHost = new AppHost ();
appHost.Init ();
logger.DebugFormat ("starting http listener at: {0}", ListenUrl);
appHost.Start (ListenUrl);
}
public void Stop ()
{
appHost.Stop ();
appHost.Dispose ();
}
public void Dispose ()
{
Stop ();
}
}
public class AppHost : AppHostHttpListenerBase
{
public AppHost () : base("Rainy", typeof(GetNotesRequest).Assembly)
{
}
public override void Configure (Funq.Container container)
{
// not all tomboy clients send the correct content-type
// so we force application/json
SetConfig (new EndpointHostConfig {
DefaultContentType = ContentType.Json
});
}
}
}
|
agpl-3.0
|
C#
|
e748160f56683e5a3c98c4f1321c5163a3ad1069
|
Update AmiDate data structure
|
kriasoft/amibroker
|
Plugin/Models/AmiDate.cs
|
Plugin/Models/AmiDate.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AmiDate.cs" company="KriaSoft LLC">
// Copyright © 2013 Konstantin Tarkus, KriaSoft LLC. See LICENSE.txt
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace AmiBroker.Plugin.Models
{
using System;
internal class AmiDate
{
private ulong date;
public AmiDate(ulong date)
{
this.date = date;
}
public AmiDate(DateTime date, bool isEOD = false, bool isFuturePad = false)
: this(
date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, date.Millisecond, 0,
isEOD: isEOD, isFuturePad: isFuturePad
)
{
}
public AmiDate(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond,
bool isEOD = false, bool isFuturePad = false)
{
if (isEOD)
{
// EOD markets
hour = 31;
minute = 63;
second = 0;
millisecond = 0;
}
this.date = (ulong)year << 52 | (ulong)month << 48 | (ulong)day << 43 | (ulong)hour << 38 |
(ulong)minute << 32 | (ulong)second << 26 | (ulong)millisecond << 16 | (ulong)microsecond << 6 |
Convert.ToUInt64(isFuturePad);
}
public ulong ToUInt64()
{
return this.date;
}
public static explicit operator AmiDate(ulong date)
{
return new AmiDate(date);
}
public static implicit operator ulong(AmiDate date)
{
return date.ToUInt64();
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AmiDate.cs" company="KriaSoft LLC">
// Copyright © 2013 Konstantin Tarkus, KriaSoft LLC. See LICENSE.txt
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace AmiBroker.Plugin.Models
{
using System;
internal class AmiDate
{
private ulong date;
public AmiDate(ulong date)
{
this.date = date;
}
public AmiDate(DateTime date, bool isEOD = false, bool isFuturePad = false)
: this(
date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, date.Millisecond, 0,
isEOD: isEOD, isFuturePad: isFuturePad
)
{
}
public AmiDate(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond,
bool isEOD = false, bool isFuturePad = false)
{
if (isEOD)
{
// EOD markets
hour = 31;
minute = 63;
}
this.date = (ulong)year << 52 | (ulong)month << 48 | (ulong)day << 43 | (ulong)hour << 38 |
(ulong)minute << 32 | (ulong)second << 26 | (ulong)millisecond << 16 | (ulong)microsecond << 6 |
Convert.ToUInt64(isFuturePad);
}
public ulong ToUInt64()
{
return this.date;
}
public static explicit operator AmiDate(ulong date)
{
return new AmiDate(date);
}
public static implicit operator ulong(AmiDate date)
{
return date.ToUInt64();
}
}
}
|
apache-2.0
|
C#
|
83436b34aa611b76776c55eb90825a4e31213078
|
include child tables
|
henkmeulekamp/IdentityServer3.EntityFramework,faithword/IdentityServer3.EntityFramework,chwilliamson/IdentityServer3.EntityFramework,buybackoff/IdentityServer3.EntityFramework,IdentityServer/IdentityServer3.EntityFramework
|
Source/Core.EntityFramework/Stores/ClientStore.cs
|
Source/Core.EntityFramework/Stores/ClientStore.cs
|
/*
* Copyright 2014 Dominick Baier, Brock Allen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Linq;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.EntityFramework.Entities;
using Thinktecture.IdentityServer.Core.Services;
namespace Thinktecture.IdentityServer.Core.EntityFramework
{
public class ClientStore : IClientStore
{
private readonly string _connectionString;
public ClientStore(string connectionString)
{
_connectionString = connectionString;
}
public Task<Models.Client> FindClientByIdAsync(string clientId)
{
using(var db = new ClientConfigurationDbContext(_connectionString))
{
var client = db.Clients
.Include("RedirectUris")
.Include("PostLogoutRedirectUris")
.Include("ScopeRestrictions")
.Include("IdentityProviderRestrictions")
.Include("Claims")
.Include("ClientSecrets")
.Include("CustomGrantTypeRestrictions")
.SingleOrDefault(x => x.ClientId == clientId);
Models.Client model = client.ToModel();
return Task.FromResult(model);
}
}
}
}
|
/*
* Copyright 2014 Dominick Baier, Brock Allen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Linq;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.EntityFramework.Entities;
using Thinktecture.IdentityServer.Core.Services;
namespace Thinktecture.IdentityServer.Core.EntityFramework
{
public class ClientStore : IClientStore
{
private readonly string _connectionString;
public ClientStore(string connectionString)
{
_connectionString = connectionString;
}
public Task<Models.Client> FindClientByIdAsync(string clientId)
{
using(var db = new ClientConfigurationDbContext(_connectionString))
{
var client = db.Clients
.Include("RedirectUris")
.Include("PostLogoutRedirectUris")
.Include("ScopeRestrictions")
.Include("IdentityProviderRestrictions")
.Include("Claims")
.SingleOrDefault(x => x.ClientId == clientId);
Models.Client model = client.ToModel();
return Task.FromResult(model);
}
}
}
}
|
apache-2.0
|
C#
|
ac66952a8b359817ae6a11542b3b38d4e16cae44
|
Remove whitespaces from AssemblyInfo file
|
AutoFixture/AutoFixture,sean-gilliam/AutoFixture,zvirja/AutoFixture,Pvlerick/AutoFixture
|
Src/AutoFixture.NUnit2/Properties/AssemblyInfo.cs
|
Src/AutoFixture.NUnit2/Properties/AssemblyInfo.cs
|
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: 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("3a54aa4b-be9b-4591-bf8c-0a463e91088f")]
[assembly: CLSCompliant(true)]
[assembly: NeutralResourcesLanguage("en")]
[assembly:
SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes",
Scope = "namespace",
Target = "Ploeh.AutoFixture.NUnit2.Addins",
Justification = "It has been ported from other project and I don't want to introduce the breaking changes.")]
[assembly:
SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes",
Scope = "namespace",
Target = "Ploeh.AutoFixture.NUnit2.Addins.Builders",
Justification = "It has been ported from other project and I don't want to introduce the breaking changes.")]
|
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: 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("3a54aa4b-be9b-4591-bf8c-0a463e91088f")]
[assembly: CLSCompliant(true)]
[assembly: NeutralResourcesLanguage("en")]
[assembly:
SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes",
Scope = "namespace",
Target = "Ploeh.AutoFixture.NUnit2.Addins",
Justification = "It has been ported from other project and I don't want to introduce the breaking changes.")]
[assembly:
SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes",
Scope = "namespace",
Target = "Ploeh.AutoFixture.NUnit2.Addins.Builders",
Justification = "It has been ported from other project and I don't want to introduce the breaking changes.")]
|
mit
|
C#
|
533d56227b2f0ec81d535ac2a3777755d7844c1d
|
Change link to tiny link, that we can change without an update of umbraco
|
KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS
|
src/Umbraco.Web.Common/ActionsResults/PublishedContentNotFoundResult.cs
|
src/Umbraco.Web.Common/ActionsResults/PublishedContentNotFoundResult.cs
|
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Web.Routing;
namespace Umbraco.Web.Common.ActionsResults
{
/// <summary>
/// Returns the Umbraco not found result
/// </summary>
public class PublishedContentNotFoundResult : IActionResult
{
private readonly IUmbracoContext _umbracoContext;
private readonly string _message;
/// <summary>
/// Initializes a new instance of the <see cref="PublishedContentNotFoundResult"/> class.
/// </summary>
public PublishedContentNotFoundResult(IUmbracoContext umbracoContext, string message = null)
{
_umbracoContext = umbracoContext;
_message = message;
}
/// <inheritdoc/>
public async Task ExecuteResultAsync(ActionContext context)
{
HttpResponse response = context.HttpContext.Response;
response.Clear();
response.StatusCode = StatusCodes.Status404NotFound;
IPublishedRequest frequest = _umbracoContext.PublishedRequest;
var reason = "Cannot render the page at URL '{0}'.";
if (frequest.HasPublishedContent() == false)
{
reason = "No umbraco document matches the URL '{0}'.";
}
else if (frequest.HasTemplate() == false)
{
reason = "No template exists to render the document at URL '{0}'.";
}
await response.WriteAsync("<html><body><h1>Page not found</h1>");
await response.WriteAsync("<h2>");
await response.WriteAsync(string.Format(reason, WebUtility.HtmlEncode(_umbracoContext.OriginalRequestUrl.PathAndQuery)));
await response.WriteAsync("</h2>");
if (string.IsNullOrWhiteSpace(_message) == false)
{
await response.WriteAsync("<p>" + _message + "</p>");
}
await response.WriteAsync("<p>This page can be replaced with a custom 404. Check the <a target='_blank' href='https://umbra.co/custom-error-pages'>documentation for \"custom 404\"</a>.</p>");
await response.WriteAsync("<p style=\"border-top: 1px solid #ccc; padding-top: 10px\"><small>This page is intentionally left ugly ;-)</small></p>");
await response.WriteAsync("</body></html>");
}
}
}
|
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Web.Routing;
namespace Umbraco.Web.Common.ActionsResults
{
/// <summary>
/// Returns the Umbraco not found result
/// </summary>
public class PublishedContentNotFoundResult : IActionResult
{
private readonly IUmbracoContext _umbracoContext;
private readonly string _message;
/// <summary>
/// Initializes a new instance of the <see cref="PublishedContentNotFoundResult"/> class.
/// </summary>
public PublishedContentNotFoundResult(IUmbracoContext umbracoContext, string message = null)
{
_umbracoContext = umbracoContext;
_message = message;
}
/// <inheritdoc/>
public async Task ExecuteResultAsync(ActionContext context)
{
HttpResponse response = context.HttpContext.Response;
response.Clear();
response.StatusCode = StatusCodes.Status404NotFound;
IPublishedRequest frequest = _umbracoContext.PublishedRequest;
var reason = "Cannot render the page at URL '{0}'.";
if (frequest.HasPublishedContent() == false)
{
reason = "No umbraco document matches the URL '{0}'.";
}
else if (frequest.HasTemplate() == false)
{
reason = "No template exists to render the document at URL '{0}'.";
}
await response.WriteAsync("<html><body><h1>Page not found</h1>");
await response.WriteAsync("<h2>");
await response.WriteAsync(string.Format(reason, WebUtility.HtmlEncode(_umbracoContext.OriginalRequestUrl.PathAndQuery)));
await response.WriteAsync("</h2>");
if (string.IsNullOrWhiteSpace(_message) == false)
{
await response.WriteAsync("<p>" + _message + "</p>");
}
await response.WriteAsync("<p>This page can be replaced with a custom 404. Check the <a target='_blank' href='https://our.umbraco.com/documentation/tutorials/Custom-Error-Pages/'>documentation for \"custom 404\"</a>.</p>");
await response.WriteAsync("<p style=\"border-top: 1px solid #ccc; padding-top: 10px\"><small>This page is intentionally left ugly ;-)</small></p>");
await response.WriteAsync("</body></html>");
}
}
}
|
mit
|
C#
|
f00c5dc9f1eaecfb7688280a51004c787665bdca
|
update version to 0.5.0
|
kimberlysiva/unity-sdk,kimberlysiva/unity-sdk,watson-developer-cloud/unity-sdk,watson-developer-cloud/unity-sdk,scottdangelo/unity-sdk,watson-developer-cloud/unity-sdk,scottdangelo/unity-sdk
|
Scripts/Utilities/Constants.cs
|
Scripts/Utilities/Constants.cs
|
/**
* Copyright 2015 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using UnityEngine;
using System.Collections;
using UnityEngine.Serialization;
namespace IBM.Watson.DeveloperCloud.Utilities
{
/// <summary>
/// This class wraps all constants.
/// </summary>
public static class Constants
{
/// <summary>
/// All constant path variables liste here. Exp. Configuration file
/// </summary>
public static class Path
{
/// <summary>
/// Configuration file name.
/// </summary>
public const string CONFIG_FILE = "/Config.json";
/// <summary>
/// Cache folder to customize a parent folder for cache directory
/// </summary>
public static string CACHE_FOLDER = ""; //It needs to start with /
/// <summary>
/// Log folder to customize a parent folder for logs
/// </summary>
public static string LOG_FOLDER = ""; //It needs to start with /
}
/// <summary>
/// All resources (files names under resource directory) used in the SDK listed here. Exp. Watson Logo
/// </summary>
public static class Resources
{
/// <summary>
/// Watson icon.
/// </summary>
public const string WATSON_ICON = "watsonSpriteIcon-32x32";
/// <summary>
/// Watson logo.
/// </summary>
public const string WATSON_LOGO = "watsonSpriteLogo-506x506";
}
/// <summary>
/// All string variables or string formats used in the SDK listed here. Exp. Quality Debug Format = Quality {0}
/// </summary>
public static class String
{
/// <exclude />
public const string VERSION = "watson-developer-cloud-unity-sdk-0.5.0";
/// <exclude />
public const string DEBUG_DISPLAY_QUALITY = "Quality: {0}";
}
}
}
|
/**
* Copyright 2015 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using UnityEngine;
using System.Collections;
using UnityEngine.Serialization;
namespace IBM.Watson.DeveloperCloud.Utilities
{
/// <summary>
/// This class wraps all constants.
/// </summary>
public static class Constants
{
/// <summary>
/// All constant path variables liste here. Exp. Configuration file
/// </summary>
public static class Path
{
/// <summary>
/// Configuration file name.
/// </summary>
public const string CONFIG_FILE = "/Config.json";
/// <summary>
/// Cache folder to customize a parent folder for cache directory
/// </summary>
public static string CACHE_FOLDER = ""; //It needs to start with /
/// <summary>
/// Log folder to customize a parent folder for logs
/// </summary>
public static string LOG_FOLDER = ""; //It needs to start with /
}
/// <summary>
/// All resources (files names under resource directory) used in the SDK listed here. Exp. Watson Logo
/// </summary>
public static class Resources
{
/// <summary>
/// Watson icon.
/// </summary>
public const string WATSON_ICON = "watsonSpriteIcon-32x32";
/// <summary>
/// Watson logo.
/// </summary>
public const string WATSON_LOGO = "watsonSpriteLogo-506x506";
}
/// <summary>
/// All string variables or string formats used in the SDK listed here. Exp. Quality Debug Format = Quality {0}
/// </summary>
public static class String
{
/// <exclude />
public const string VERSION = "watson-developer-cloud-unity-sdk-0.4.0";
/// <exclude />
public const string DEBUG_DISPLAY_QUALITY = "Quality: {0}";
}
}
}
|
apache-2.0
|
C#
|
221ed1d7bc9730592b70ea0250c084101cbfd9c7
|
add todo to S_CREATURE_CHANGE_HP
|
Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns
|
TeraPacketParser/Messages/S_CREATURE_CHANGE_HP.cs
|
TeraPacketParser/Messages/S_CREATURE_CHANGE_HP.cs
|
namespace TeraPacketParser.Messages
{
public class S_CREATURE_CHANGE_HP : ParsedMessage
{
public long CurrentHP { get; }
public long MaxHP { get; }
public long Diff { get; }
public ulong Target { get; }
public ulong Source { get; }
public bool Crit { get; } //TODO: not actually used
public S_CREATURE_CHANGE_HP(TeraMessageReader reader) : base(reader)
{
CurrentHP = reader.ReadInt64();
MaxHP = reader.ReadInt64();
Diff = reader.ReadInt64();
reader.Skip(4);
Target = reader.ReadUInt64();
Source = reader.ReadUInt64();
}
}
}
|
namespace TeraPacketParser.Messages
{
public class S_CREATURE_CHANGE_HP : ParsedMessage
{
public long CurrentHP { get; }
public long MaxHP { get; }
public long Diff { get; }
public ulong Target { get; }
public ulong Source { get; }
public bool Crit { get; }
public S_CREATURE_CHANGE_HP(TeraMessageReader reader) : base(reader)
{
CurrentHP = reader.ReadInt64();
MaxHP = reader.ReadInt64();
Diff = reader.ReadInt64();
reader.Skip(4);
Target = reader.ReadUInt64();
Source = reader.ReadUInt64();
}
}
}
|
mit
|
C#
|
ee68fcb4aed1f7c414e36a8f3c04d4db48bd595e
|
add exception handling to motd controlservice request
|
hybrasyl/server,baughj/hybrasylserver,baughj/hybrasylserver,baughj/hybrasylserver,hybrasyl/server,hybrasyl/server
|
hybrasyl/ControlService.cs
|
hybrasyl/ControlService.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;
using Hybrasyl.Objects;
using Newtonsoft.Json.Linq;
using StackExchange.Redis;
namespace Hybrasyl
{
[ServiceContract]
public interface IControlService
{
[OperationContract]
[WebGet(UriTemplate = "/Shutdown/{key}")]
string Shutdown(string key);
[OperationContract]
[WebGet(UriTemplate = "/CurrentUsers")]
List<string> CurrentUsers();
[OperationContract]
[WebGet(UriTemplate = "/User/{name}")]
User User(string name);
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single, IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ControlService : IControlService
{
public string Shutdown(string key)
{
if (key == Constants.ShutdownPassword)
{
World.MessageQueue.Add(new HybrasylControlMessage(ControlOpcodes.ShutdownServer, "build"));
return "Shutdown ControlMessage sent to Server.";
}
return "Shutdown ControlMessage not queued.";
}
public List<string> CurrentUsers() => World.ActiveUsers.Select(x => x.Value.Name).ToList();
public User User(string name)
{
return World.ActiveUsers.All(x => x.Value.Name != name) ? null : World.ActiveUsers.Single(x => x.Value.Name == name).Value;
}
public static string GetMotd()
{
try
{
using (HttpClient client = new HttpClient())
{
client.BaseAddress = new Uri($"http://{Game.Config.ApiEndpoints.RemoteAdminHost.BindAddress}/api/news");
var json = $"[{client.GetAsync(client.BaseAddress + "/GetMotd").Result.Content.ReadAsStringAsync().Result}]";
dynamic motd = JArray.Parse(json);
return motd[0].Data[0].Message;
}
}
catch (Exception)
{
return "There was an error fetching the MOTD.";
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;
using Hybrasyl.Objects;
using Newtonsoft.Json.Linq;
using StackExchange.Redis;
namespace Hybrasyl
{
[ServiceContract]
public interface IControlService
{
[OperationContract]
[WebGet(UriTemplate = "/Shutdown/{key}")]
string Shutdown(string key);
[OperationContract]
[WebGet(UriTemplate = "/CurrentUsers")]
List<string> CurrentUsers();
[OperationContract]
[WebGet(UriTemplate = "/User/{name}")]
User User(string name);
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single, IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ControlService : IControlService
{
public string Shutdown(string key)
{
if (key == Constants.ShutdownPassword)
{
World.MessageQueue.Add(new HybrasylControlMessage(ControlOpcodes.ShutdownServer, "build"));
return "Shutdown ControlMessage sent to Server.";
}
return "Shutdown ControlMessage not queued.";
}
public List<string> CurrentUsers() => World.ActiveUsers.Select(x => x.Value.Name).ToList();
public User User(string name)
{
return World.ActiveUsers.All(x => x.Value.Name != name) ? null : World.ActiveUsers.Single(x => x.Value.Name == name).Value;
}
public static string GetMotd()
{
using (HttpClient client = new HttpClient())
{
client.BaseAddress = new Uri($"http://{Game.Config.ApiEndpoints.RemoteAdminHost.BindAddress}/api/news");
var json = $"[{client.GetAsync(client.BaseAddress + "/GetMotd").Result.Content.ReadAsStringAsync().Result}]";
dynamic motd = JArray.Parse(json);
return motd[0].Data[0].Message;
}
}
}
}
|
agpl-3.0
|
C#
|
9508337b016d612f0fbe16528c01d5e8d3a1009b
|
Throw exception if tool is missing.
|
FacilityApi/FacilityJavaScript,FacilityApi/FacilityCSharp,FacilityApi/FacilityJavaScript,FacilityApi/FacilityJavaScript,FacilityApi/Facility
|
tools/Build/Build.cs
|
tools/Build/Build.cs
|
using System;
using System.Linq;
using Faithlife.Build;
using static Faithlife.Build.BuildUtility;
using static Faithlife.Build.DotNetRunner;
return BuildRunner.Execute(args, build =>
{
var codegen = "fsdgen___";
var gitLogin = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? "");
var dotNetBuildSettings = new DotNetBuildSettings
{
NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
DocsSettings = new DotNetDocsSettings
{
GitLogin = gitLogin,
GitAuthor = new GitAuthorInfo("FacilityApiBot", "facilityapi@gmail.com"),
SourceCodeUrl = "https://github.com/FacilityApi/RepoTemplate/tree/master/src",
ProjectHasDocs = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
},
PackageSettings = new DotNetPackageSettings
{
GitLogin = gitLogin,
PushTagOnPublish = x => $"nuget.{x.Version}",
},
};
build.AddDotNetTargets(dotNetBuildSettings);
build.Target("codegen")
.DependsOn("build")
.Describe("Generates code from the FSD")
.Does(() => CodeGen(verify: false));
build.Target("verify-codegen")
.DependsOn("build")
.Describe("Ensures the generated code is up-to-date")
.Does(() => CodeGen(verify: true));
build.Target("test")
.DependsOn("verify-codegen");
void CodeGen(bool verify)
{
var configuration = dotNetBuildSettings.GetConfiguration();
var toolPath = FindFiles($"src/{codegen}/bin/{configuration}/net5.0/{codegen}.dll").FirstOrDefault() ?? throw new BuildException($"Missing {codegen}.dll.");
var verifyOption = verify ? "--verify" : null;
RunDotNet(toolPath, "___", "___", "--newline", "lf", verifyOption);
}
});
|
using System;
using System.Linq;
using Faithlife.Build;
using static Faithlife.Build.BuildUtility;
using static Faithlife.Build.DotNetRunner;
return BuildRunner.Execute(args, build =>
{
var codegen = "fsdgen___";
var gitLogin = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? "");
var dotNetBuildSettings = new DotNetBuildSettings
{
NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
DocsSettings = new DotNetDocsSettings
{
GitLogin = gitLogin,
GitAuthor = new GitAuthorInfo("FacilityApiBot", "facilityapi@gmail.com"),
SourceCodeUrl = "https://github.com/FacilityApi/RepoTemplate/tree/master/src",
ProjectHasDocs = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
},
PackageSettings = new DotNetPackageSettings
{
GitLogin = gitLogin,
PushTagOnPublish = x => $"nuget.{x.Version}",
},
};
build.AddDotNetTargets(dotNetBuildSettings);
build.Target("codegen")
.DependsOn("build")
.Describe("Generates code from the FSD")
.Does(() => CodeGen(verify: false));
build.Target("verify-codegen")
.DependsOn("build")
.Describe("Ensures the generated code is up-to-date")
.Does(() => CodeGen(verify: true));
build.Target("test")
.DependsOn("verify-codegen");
void CodeGen(bool verify)
{
var configuration = dotNetBuildSettings.GetConfiguration();
var toolPath = FindFiles($"src/{codegen}/bin/{configuration}/net5.0/{codegen}.dll").FirstOrDefault();
var verifyOption = verify ? "--verify" : null;
RunDotNet(toolPath, "___", "___", "--newline", "lf", verifyOption);
}
});
|
mit
|
C#
|
4987695505f2be58c79f5c1e693eda6bb37348c0
|
Update run.cs
|
ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls
|
stubs/cSharp-Net/run.cs
|
stubs/cSharp-Net/run.cs
|
using System;
using System.Net;
public class Run
{
static public void Main (String []args)
{
if (args.Length != 2){
Console.WriteLine("UNSUPPORTED");
Environment.Exit(0);
}
String host, port;
host = args[0];
port = args[1];
try {
string url = "https://" + host + ":" + port;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine ("VERIFY SUCCESS");
} catch (System.Net.WebException e) {
if (! e.ToString().Contains("NameResolutionFailure")){
Console.WriteLine("VERIFY FAILURE");
} else {
Console.WriteLine (e);
Environment.Exit(1);
}
} catch (System.Exception e) {
Console.WriteLine (e);
Environment.Exit(1);
}
Environment.Exit(0);
}
}
|
using System;
using System.Net;
//tested with Mono and Visual Studio:
//* Mono: can't recommend using, test if you do not believe
//* Visual Studio (all Ok). Same for F# and Visual Basic Stubs
public class Run
{
static public void Main (String []args)
{
if (args.Length != 2){
Console.WriteLine("UNSUPPORTED");
Environment.Exit(0);
}
String host, port;
host = args[0];
port = args[1];
try {
string url = "https://" + host + ":" + port;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine ("VERIFY SUCCESS");
} catch (System.Net.WebException e) {
if (! e.ToString().Contains("NameResolutionFailure")){
Console.WriteLine("VERIFY FAILURE");
} else {
Console.WriteLine (e);
Environment.Exit(1);
}
} catch (System.Exception e) {
Console.WriteLine (e);
Environment.Exit(1);
}
Environment.Exit(0);
}
}
|
mit
|
C#
|
1857c91647caa6acf62b35b07b207b1b7f20b0f4
|
Expand APIChangelog; Normalize its line endings
|
NeoAdonis/osu,johnneijzen/osu,ppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,UselessToucan/osu,ZLima12/osu,NeoAdonis/osu,smoogipooo/osu,2yangk23/osu,UselessToucan/osu,peppy/osu-new,EVAST9919/osu,johnneijzen/osu,ZLima12/osu,2yangk23/osu,peppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,peppy/osu,EVAST9919/osu,ppy/osu
|
osu.Game/Online/API/Requests/Responses/APIChangelog.cs
|
osu.Game/Online/API/Requests/Responses/APIChangelog.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIChangelog
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("version")]
public string Version { get; set; }
[JsonProperty("display_version")]
public string DisplayVersion { get; set; }
[JsonProperty("users")]
public long Users { get; set; }
[JsonProperty("is_featured")]
public bool IsFeatured { get; set; }
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt { get; set; }
[JsonProperty("update_stream")]
public UpdateStream UpdateStream { get; set; }
[JsonProperty("changelog_entries")]
public List<object> ChangelogEntries { get; set; }
[JsonProperty("versions")]
public Versions Versions { get; set; }
}
public class Versions
{
[JsonProperty("next")]
public APIChangelog Next { get; set; }
[JsonProperty("previous")]
public APIChangelog Previous { get; set; }
}
public class ChangelogEntry
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("repository")]
public string Repository { get; set; }
[JsonProperty("github_pull_request_id")]
public long GithubPullRequestId { get; set; }
[JsonProperty("github_url")]
public string GithubUrl { get; set; }
[JsonProperty("url")]
public object Url { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("category")]
public string Category { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("message_html")]
public string MessageHtml { get; set; }
[JsonProperty("major")]
public bool Major { get; set; }
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt { get; set; }
[JsonProperty("github_user")]
public GithubUser GithubUser { get; set; }
}
public partial class GithubUser
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("display_name")]
public string DisplayName { get; set; }
[JsonProperty("github_url")]
public string GithubUrl { get; set; }
[JsonProperty("osu_username")]
public string OsuUsername { get; set; }
[JsonProperty("user_id")]
public long? UserId { get; set; }
[JsonProperty("user_url")]
public string UserUrl { get; set; }
}
public class UpdateStream
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("display_name")]
public string DisplayName { get; set; }
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIChangelog
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("version")]
public string Version { get; set; }
[JsonProperty("display_version")]
public string DisplayVersion { get; set; }
[JsonProperty("users")]
public long Users { get; set; }
[JsonProperty("is_featured")]
public bool IsFeatured { get; set; }
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt { get; set; }
[JsonProperty("update_stream")]
public UpdateStream UpdateStream { get; set; }
[JsonProperty("changelog_entries")]
public List<object> ChangelogEntries { get; set; }
}
public class UpdateStream
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("display_name")]
public string DisplayName { get; set; }
}
}
|
mit
|
C#
|
3e6a87046fc015b8f51cfb965f8976fef1bb18a9
|
Revert change.
|
mattscheffer/roslyn,amcasey/roslyn,abock/roslyn,sharwell/roslyn,akrisiun/roslyn,KirillOsenkov/roslyn,swaroop-sridhar/roslyn,Giftednewt/roslyn,jamesqo/roslyn,swaroop-sridhar/roslyn,DustinCampbell/roslyn,AmadeusW/roslyn,bartdesmet/roslyn,bkoelman/roslyn,nguerrera/roslyn,MichalStrehovsky/roslyn,dotnet/roslyn,MattWindsor91/roslyn,aelij/roslyn,dotnet/roslyn,mmitche/roslyn,wvdd007/roslyn,cston/roslyn,akrisiun/roslyn,orthoxerox/roslyn,tmeschter/roslyn,drognanar/roslyn,MichalStrehovsky/roslyn,xasx/roslyn,agocke/roslyn,davkean/roslyn,kelltrick/roslyn,tmeschter/roslyn,davkean/roslyn,bkoelman/roslyn,tvand7093/roslyn,tmat/roslyn,AnthonyDGreen/roslyn,mattscheffer/roslyn,khyperia/roslyn,orthoxerox/roslyn,gafter/roslyn,jkotas/roslyn,pdelvo/roslyn,CaptainHayashi/roslyn,orthoxerox/roslyn,jcouv/roslyn,weltkante/roslyn,AlekseyTs/roslyn,srivatsn/roslyn,amcasey/roslyn,cston/roslyn,mavasani/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,bartdesmet/roslyn,jeffanders/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,panopticoncentral/roslyn,jamesqo/roslyn,jmarolf/roslyn,tmat/roslyn,eriawan/roslyn,CaptainHayashi/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,gafter/roslyn,mgoertz-msft/roslyn,AlekseyTs/roslyn,akrisiun/roslyn,amcasey/roslyn,jmarolf/roslyn,paulvanbrenk/roslyn,jasonmalinowski/roslyn,DustinCampbell/roslyn,MattWindsor91/roslyn,MattWindsor91/roslyn,AlekseyTs/roslyn,agocke/roslyn,TyOverby/roslyn,mattscheffer/roslyn,reaction1989/roslyn,weltkante/roslyn,mavasani/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,AmadeusW/roslyn,KirillOsenkov/roslyn,drognanar/roslyn,brettfo/roslyn,eriawan/roslyn,dpoeschl/roslyn,panopticoncentral/roslyn,mmitche/roslyn,bartdesmet/roslyn,VSadov/roslyn,srivatsn/roslyn,kelltrick/roslyn,srivatsn/roslyn,davkean/roslyn,jcouv/roslyn,bkoelman/roslyn,khyperia/roslyn,aelij/roslyn,khyperia/roslyn,Giftednewt/roslyn,yeaicc/roslyn,Hosch250/roslyn,heejaechang/roslyn,Giftednewt/roslyn,CyrusNajmabadi/roslyn,TyOverby/roslyn,dotnet/roslyn,yeaicc/roslyn,CaptainHayashi/roslyn,yeaicc/roslyn,jeffanders/roslyn,genlu/roslyn,weltkante/roslyn,abock/roslyn,paulvanbrenk/roslyn,CyrusNajmabadi/roslyn,brettfo/roslyn,tmat/roslyn,Hosch250/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,xasx/roslyn,tannergooding/roslyn,jasonmalinowski/roslyn,OmarTawfik/roslyn,nguerrera/roslyn,tmeschter/roslyn,stephentoub/roslyn,robinsedlaczek/roslyn,wvdd007/roslyn,agocke/roslyn,genlu/roslyn,kelltrick/roslyn,MattWindsor91/roslyn,mattwar/roslyn,nguerrera/roslyn,pdelvo/roslyn,OmarTawfik/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,KevinRansom/roslyn,DustinCampbell/roslyn,dpoeschl/roslyn,genlu/roslyn,tvand7093/roslyn,jeffanders/roslyn,lorcanmooney/roslyn,ErikSchierboom/roslyn,eriawan/roslyn,cston/roslyn,sharwell/roslyn,reaction1989/roslyn,TyOverby/roslyn,VSadov/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,brettfo/roslyn,aelij/roslyn,drognanar/roslyn,gafter/roslyn,stephentoub/roslyn,jkotas/roslyn,paulvanbrenk/roslyn,pdelvo/roslyn,KevinRansom/roslyn,MichalStrehovsky/roslyn,robinsedlaczek/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,jamesqo/roslyn,tannergooding/roslyn,KevinRansom/roslyn,lorcanmooney/roslyn,jcouv/roslyn,swaroop-sridhar/roslyn,robinsedlaczek/roslyn,diryboy/roslyn,jmarolf/roslyn,sharwell/roslyn,jkotas/roslyn,Hosch250/roslyn,tvand7093/roslyn,reaction1989/roslyn,panopticoncentral/roslyn,VSadov/roslyn,stephentoub/roslyn,mattwar/roslyn,xasx/roslyn,AmadeusW/roslyn,lorcanmooney/roslyn,OmarTawfik/roslyn,abock/roslyn,mattwar/roslyn,physhi/roslyn,mmitche/roslyn,AnthonyDGreen/roslyn,physhi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,ErikSchierboom/roslyn,dpoeschl/roslyn,physhi/roslyn,AnthonyDGreen/roslyn
|
src/EditorFeatures/Next/NavigateTo/Dev15NavigateToHostVersionService.cs
|
src/EditorFeatures/Next/NavigateTo/Dev15NavigateToHostVersionService.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Editor.Implementation.NavigateTo;
using Microsoft.VisualStudio.Language.NavigateTo.Interfaces;
namespace Microsoft.CodeAnalysis.Editor.NavigateTo
{
[ExportVersionSpecific(typeof(INavigateToHostVersionService), VisualStudioVersion.Dev15)]
internal partial class Dev15NavigateToHostVersionService : INavigateToHostVersionService
{
public bool GetSearchCurrentDocument(INavigateToOptions options)
{
var options2 = options as INavigateToOptions2;
return options2?.SearchCurrentDocument ?? false;
}
public INavigateToItemDisplayFactory CreateDisplayFactory()
=> new Dev15ItemDisplayFactory();
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Editor.Implementation.NavigateTo;
using Microsoft.VisualStudio.Language.NavigateTo.Interfaces;
namespace Microsoft.CodeAnalysis.Editor.NavigateTo
{
[ExportVersionSpecific(typeof(INavigateToHostVersionService), VisualStudioVersion.Dev15)]
internal partial class Dev15NavigateToHostVersionService : INavigateToHostVersionService
{
[ImportingConstructor]
public Dev15NavigateToHostVersionService()
{
}
public bool GetSearchCurrentDocument(INavigateToOptions options)
{
var options2 = options as INavigateToOptions2;
return options2?.SearchCurrentDocument ?? false;
}
public INavigateToItemDisplayFactory CreateDisplayFactory()
=> new Dev15ItemDisplayFactory();
}
}
|
mit
|
C#
|
ecc6563b057ba4afd429ed65a6b3fe1cc49c1a71
|
clean bin folder on build
|
FrankFlamme/AntMeCore,AntMeNet/AntMeCore,FrankFlamme/AntMeCore,AntMeNet/AntMeCore
|
build.cake
|
build.cake
|
/// <summary>
/// Just a simple build script.
/// </summary>
// *********************
// ARGUMENTS
// *********************
var Target = Argument("target", "default");
var Configuration = Argument("configuration", "release");
// *********************
// VARIABLES
// *********************
var Solution = File("AntMeCore.sln");
var Tests = new List<FilePath>();
var BuildVerbosity = Verbosity.Minimal;
// *********************
// TASKS
// *********************
/// <summary>
/// Task to build the solution. Using MSBuild on Windows and MDToolBuild on OSX / Linux
/// </summary>
Task("build")
.WithCriteria(() =>
{
var canBuild = Solution != null && FileExists(Solution);
if(!canBuild)
Information("Build skipped. To run a build set Solution variable before.");
return canBuild;
})
.Does(() =>
{
DotNetBuild(Solution, cfg =>
{
cfg.Configuration = Configuration;
cfg.Verbosity = BuildVerbosity;
});
});
/// <summary>
/// Task to clean all obj and bin directories as well as the ./output folder.
/// Commonly called right before build.
/// </summary>
Task("clean")
.Does(() =>
{
CleanDirectories("./output");
CleanDirectories("./bin");
CleanDirectories(string.Format("./src/**/obj/{0}", Configuration));
CleanDirectories(string.Format("./src/**/bin/{0}", Configuration));
CleanDirectories(string.Format("./tests/**/obj/{0}", Configuration));
CleanDirectories(string.Format("./tests/**/bin/{0}", Configuration));
});
/// <summary>
/// The default task with a predefined flow.
/// </summary>
Task("default")
.IsDependentOn("clean")
.IsDependentOn("restore")
.IsDependentOn("build");
/// <summary>
/// Task to rebuild. Nothing else than a clean followed by build.
/// </summary>
Task("rebuild")
.IsDependentOn("clean")
.IsDependentOn("build");
/// <summary>
/// Task to restore NuGet packages on solution level for all containing projects.
/// </summary>
Task("restore")
.WithCriteria(() =>
{
var canRestore = Solution != null && FileExists(Solution);
if(!canRestore)
Information("Restore skipped. To restore packages set Solution variable.");
return canRestore;
})
.Does(() => NuGetRestore(Solution));
// Execution
RunTarget(Target);
|
/// <summary>
/// Just a simple build script.
/// </summary>
// *********************
// ARGUMENTS
// *********************
var Target = Argument("target", "default");
var Configuration = Argument("configuration", "release");
// *********************
// VARIABLES
// *********************
var Solution = File("AntMeCore.sln");
var Tests = new List<FilePath>();
var BuildVerbosity = Verbosity.Minimal;
// *********************
// TASKS
// *********************
/// <summary>
/// Task to build the solution. Using MSBuild on Windows and MDToolBuild on OSX / Linux
/// </summary>
Task("build")
.WithCriteria(() =>
{
var canBuild = Solution != null && FileExists(Solution);
if(!canBuild)
Information("Build skipped. To run a build set Solution variable before.");
return canBuild;
})
.Does(() =>
{
DotNetBuild(Solution, cfg =>
{
cfg.Configuration = Configuration;
cfg.Verbosity = BuildVerbosity;
});
});
/// <summary>
/// Task to clean all obj and bin directories as well as the ./output folder.
/// Commonly called right before build.
/// </summary>
Task("clean")
.Does(() =>
{
CleanDirectories("./output");
CleanDirectories(string.Format("./src/**/obj/{0}", Configuration));
CleanDirectories(string.Format("./src/**/bin/{0}", Configuration));
CleanDirectories(string.Format("./tests/**/obj/{0}", Configuration));
CleanDirectories(string.Format("./tests/**/bin/{0}", Configuration));
});
/// <summary>
/// The default task with a predefined flow.
/// </summary>
Task("default")
.IsDependentOn("clean")
.IsDependentOn("restore")
.IsDependentOn("build");
/// <summary>
/// Task to rebuild. Nothing else than a clean followed by build.
/// </summary>
Task("rebuild")
.IsDependentOn("clean")
.IsDependentOn("build");
/// <summary>
/// Task to restore NuGet packages on solution level for all containing projects.
/// </summary>
Task("restore")
.WithCriteria(() =>
{
var canRestore = Solution != null && FileExists(Solution);
if(!canRestore)
Information("Restore skipped. To restore packages set Solution variable.");
return canRestore;
})
.Does(() => NuGetRestore(Solution));
// Execution
RunTarget(Target);
|
mit
|
C#
|
b20e2b85abcb4f0296ae34cf8c89da9858ad82cd
|
Fix tests to run in Release configuration
|
thomaslevesque/NString
|
build.cake
|
build.cake
|
using System.Xml.Linq;
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
// Variable definitions
var projectName = "NString";
var libraryProject = $"{projectName}/{projectName}.csproj";
var testProject = $"{projectName}.Tests/{projectName}.Tests.csproj";
var outDir = $"{projectName}/bin/{configuration}";
///////////////////////////////////////////////////////////////////////////////
// TASK DEFINITIONS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(outDir);
});
Task("Restore").Does(() => DotNetCoreRestore());
Task("JustBuild")
.Does(() =>
{
DotNetCoreBuild(".", new DotNetCoreBuildSettings { Configuration = configuration });
});
Task("JustTest")
.Does(() =>
{
DotNetCoreTest(testProject, new DotNetCoreTestSettings { Configuration = configuration });
});
Task("JustPack")
.Does(() =>
{
DotNetCorePack(libraryProject, new DotNetCorePackSettings { Configuration = configuration });
});
Task("JustPush")
.Does(() =>
{
var doc = XDocument.Load(libraryProject);
string version = doc.Root.Elements("PropertyGroup").Elements("Version").First().Value;
string package = $"{projectName}/bin/{configuration}/{projectName}.{version}.nupkg";
NuGetPush(package, new NuGetPushSettings());
});
// Higher level tasks
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("JustBuild");
Task("Test")
.IsDependentOn("Build")
.IsDependentOn("JustTest");
Task("Pack")
.IsDependentOn("Build")
.IsDependentOn("JustPack");
Task("Push")
.IsDependentOn("Pack")
.IsDependentOn("JustPush");
///////////////////////////////////////////////////////////////////////////////
// TARGETS
///////////////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Test")
.IsDependentOn("Pack");
///////////////////////////////////////////////////////////////////////////////
// EXECUTION
///////////////////////////////////////////////////////////////////////////////
RunTarget(target);
|
using System.Xml.Linq;
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
// Variable definitions
var projectName = "NString";
var libraryProject = $"{projectName}/{projectName}.csproj";
var testProject = $"{projectName}.Tests/{projectName}.Tests.csproj";
var outDir = $"{projectName}/bin/{configuration}";
///////////////////////////////////////////////////////////////////////////////
// TASK DEFINITIONS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(outDir);
});
Task("Restore").Does(() => DotNetCoreRestore());
Task("JustBuild")
.Does(() =>
{
DotNetCoreBuild(".", new DotNetCoreBuildSettings { Configuration = configuration });
});
Task("JustTest")
.Does(() => DotNetCoreTest(testProject));
Task("JustPack")
.Does(() =>
{
DotNetCorePack(libraryProject, new DotNetCorePackSettings
{
Configuration = configuration
});
});
Task("JustPush")
.Does(() =>
{
var doc = XDocument.Load(libraryProject);
string version = doc.Root.Elements("PropertyGroup").Elements("Version").First().Value;
string package = $"{projectName}/bin/{configuration}/{projectName}.{version}.nupkg";
NuGetPush(package, new NuGetPushSettings());
});
// Higher level tasks
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("JustBuild");
Task("Test")
.IsDependentOn("Build")
.IsDependentOn("JustTest");
Task("Pack")
.IsDependentOn("Build")
.IsDependentOn("JustPack");
Task("Push")
.IsDependentOn("Pack")
.IsDependentOn("JustPush");
///////////////////////////////////////////////////////////////////////////////
// TARGETS
///////////////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Test")
.IsDependentOn("Pack");
///////////////////////////////////////////////////////////////////////////////
// EXECUTION
///////////////////////////////////////////////////////////////////////////////
RunTarget(target);
|
apache-2.0
|
C#
|
f54fea86c22efaaf6d48635797bb7b0223e1f755
|
Set NPM install in build script to be silent
|
KevMain/kevin.main.com,KevMain/kevin.main.com,KevMain/kevin.main.com,KevMain/kevin.main.com
|
build.cake
|
build.cake
|
#addin "Cake.Npm"
#addin "Cake.Gulp"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var buildDir = Directory("./Source/UI/bin") + Directory(configuration);
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("./Source/kevin-main.com.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
MSBuild("./Source/kevin-main.com.sln", settings => settings.SetConfiguration(configuration)
.WithProperty("Verbosity", "quiet"));
});
Task("Npm")
.Does(() =>
{
((NpmRunner)Npm.WithLogLevel(NpmLogLevel.Silent)).Install(settings => settings.Package("gulp"));
});
Task("BuildSite")
.IsDependentOn("Build")
.IsDependentOn("Npm")
.Does(() =>
{
Gulp.Local.Execute(settings => settings.WithGulpFile("./Source/UI/gulpfile.js"));
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("BuildSite");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
|
#addin "Cake.Npm"
#addin "Cake.Gulp"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var buildDir = Directory("./Source/UI/bin") + Directory(configuration);
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("./Source/kevin-main.com.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
MSBuild("./Source/kevin-main.com.sln", settings => settings.SetConfiguration(configuration)
.WithProperty("Verbosity", "quiet"));
});
Task("Npm")
.Does(() =>
{
Npm.Install(settings => settings.Package("gulp"));
});
Task("BuildSite")
.IsDependentOn("Build")
.IsDependentOn("Npm")
.Does(() =>
{
Gulp.Local.Execute(settings => settings.WithGulpFile("./Source/UI/gulpfile.js"));
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("BuildSite");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
|
mit
|
C#
|
0545f6b74d8e9f87378df75fcd38fcca53ef233d
|
Adjust logs section styling (#1907)
|
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
|
BTCPayServer/Views/Server/Logs.cshtml
|
BTCPayServer/Views/Server/Logs.cshtml
|
@model BTCPayServer.Models.ServerViewModels.LogsViewModel
@{
ViewData.SetActivePageAndTitle(ServerNavPages.Logs);
}
<partial name="_StatusMessage" />
<ul class="list-unstyled">
@foreach (var file in Model.LogFiles)
{
<li>
<a asp-action="LogsView" asp-route-file="@file.Name">@file.Name</a>
</li>
}
</ul>
<nav aria-label="..." class="w-100">
<ul class="pagination float-left">
<li class="page-item @(Model.LogFileOffset == 0 ? "disabled" : null)">
<a class="page-link" asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset - 5)">«</a>
</li>
<li class="page-item disabled">
<span class="page-link">Showing @Model.LogFileOffset - (@(Model.LogFileOffset+Model.LogFiles.Count)) of @Model.LogFileCount</span>
</li>
<li class="page-item @((Model.LogFileOffset + Model.LogFiles.Count) < Model.LogFileCount ? null : "disabled")">
<a class="page-link" asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset + Model.LogFiles.Count)">»</a>
</li>
</ul>
</nav>
@if (!string.IsNullOrEmpty(Model.Log))
{
<br>
<br>
<br>
<pre>
@Model.Log
</pre>
}
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
|
@model BTCPayServer.Models.ServerViewModels.LogsViewModel
@{
ViewData.SetActivePageAndTitle(ServerNavPages.Logs);
}
<partial name="_StatusMessage" />
<div class="row">
<ul>
@foreach (var file in Model.LogFiles)
{
<li>
<a asp-action="LogsView" asp-route-file="@file.Name">@file.Name</a>
</li>
}
<li>
@if (Model.LogFileOffset > 0)
{
<a asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset - 5)"><<</a>
}
Showing @Model.LogFileOffset - (@(Model.LogFileOffset+Model.LogFiles.Count)) of @Model.LogFileCount
@if ((Model.LogFileOffset+ Model.LogFiles.Count) < Model.LogFileCount)
{
<a asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset + Model.LogFiles.Count)">>></a>
}
</li>
</ul>
@if (!string.IsNullOrEmpty(Model.Log))
{
<pre>
@Model.Log
</pre>
}
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
|
mit
|
C#
|
eeab51f3650034d7fffe3d9f23b78ca27741e00f
|
Remove auto-generated files
|
BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB
|
src/portable/BrightstarDB.Portable.MonoTouch/Properties/AssemblyInfo.cs
|
src/portable/BrightstarDB.Portable.MonoTouch/Properties/AssemblyInfo.cs
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: AssemblyTitle("BrightstarDB Portable Class Library MonoTouch Assembly")]
[assembly: AssemblyProduct("BrightstarDB")]
[assembly: AssemblyCopyright("Copyright (c) 2015 Khalil Ahmed, Graham Moore, and other contributors")]
[assembly: AssemblyTrademark("All rights reserved")]
[assembly: AssemblyVersion("1.11.1.0")]
[assembly: AssemblyFileVersion("1.11.1.0")]
// Generated by the MSBuild WriteCodeFragment class on 05/10/2015 12:03:37.
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: AssemblyTitle("BrightstarDB Portable Class Library MonoTouch Assembly")]
[assembly: AssemblyProduct("BrightstarDB")]
[assembly: AssemblyCopyright("Copyright (c) 2015 Khalil Ahmed, Graham Moore, and other contributors")]
[assembly: AssemblyTrademark("All rights reserved")]
[assembly: AssemblyVersion("1.11.0.0")]
[assembly: AssemblyFileVersion("1.11.0.0")]
// Generated by the MSBuild WriteCodeFragment class on 05/08/2015 14:06:58.
|
mit
|
C#
|
48191a086d2425ffc803b364d8543b43fd7bc38f
|
handle null case
|
EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework
|
osu.Framework/Input/FrameworkActionContainer.cs
|
osu.Framework/Input/FrameworkActionContainer.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.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
namespace osu.Framework.Input
{
internal class FrameworkActionContainer : KeyBindingContainer<FrameworkAction>
{
public override IEnumerable<KeyBinding> DefaultKeyBindings => new[]
{
new KeyBinding(new[] { InputKey.Control, InputKey.F1 }, FrameworkAction.ToggleDrawVisualiser),
new KeyBinding(new[] { InputKey.Control, InputKey.F2 }, FrameworkAction.ToggleGlobalStatistics),
new KeyBinding(new[] { InputKey.Control, InputKey.F11 }, FrameworkAction.CycleFrameStatistics),
new KeyBinding(new[] { InputKey.Control, InputKey.F10 }, FrameworkAction.ToggleLogOverlay),
new KeyBinding(new[] { InputKey.Alt, InputKey.Enter }, FrameworkAction.ToggleFullscreen),
};
private readonly Game game;
public FrameworkActionContainer(Game game = null)
{
this.game = game;
}
protected override bool Prioritised => true;
/// <summary>
/// Prioritize the <see cref="Game"/> for input, which handles the toggling of framework overlays.
/// </summary>
protected override IEnumerable<Drawable> KeyBindingInputQueue => game == null ? base.KeyBindingInputQueue : base.KeyBindingInputQueue.Prepend(game);
}
public enum FrameworkAction
{
CycleFrameStatistics,
ToggleDrawVisualiser,
ToggleGlobalStatistics,
ToggleLogOverlay,
ToggleFullscreen
}
}
|
// 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.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
namespace osu.Framework.Input
{
internal class FrameworkActionContainer : KeyBindingContainer<FrameworkAction>
{
public override IEnumerable<KeyBinding> DefaultKeyBindings => new[]
{
new KeyBinding(new[] { InputKey.Control, InputKey.F1 }, FrameworkAction.ToggleDrawVisualiser),
new KeyBinding(new[] { InputKey.Control, InputKey.F2 }, FrameworkAction.ToggleGlobalStatistics),
new KeyBinding(new[] { InputKey.Control, InputKey.F11 }, FrameworkAction.CycleFrameStatistics),
new KeyBinding(new[] { InputKey.Control, InputKey.F10 }, FrameworkAction.ToggleLogOverlay),
new KeyBinding(new[] { InputKey.Alt, InputKey.Enter }, FrameworkAction.ToggleFullscreen),
};
private readonly Game game;
public FrameworkActionContainer(Game game = null)
{
this.game = game;
}
protected override bool Prioritised => true;
/// <summary>
/// Prioritize the <see cref="Game"/> for input, which handles the toggling of framework overlays.
/// </summary>
protected override IEnumerable<Drawable> KeyBindingInputQueue => base.KeyBindingInputQueue.Prepend(game);
}
public enum FrameworkAction
{
CycleFrameStatistics,
ToggleDrawVisualiser,
ToggleGlobalStatistics,
ToggleLogOverlay,
ToggleFullscreen
}
}
|
mit
|
C#
|
1fce0da33189907d8c14588af5b35dd8b5efb13a
|
Reword slightly, to allow better conformity with `IDistanceSnapProvider`
|
NeoAdonis/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,ppy/osu
|
osu.Game/Rulesets/Edit/IPositionSnapProvider.cs
|
osu.Game/Rulesets/Edit/IPositionSnapProvider.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 osuTK;
namespace osu.Game.Rulesets.Edit
{
/// <summary>
/// A snap provider which given a proposed position for a hit object, potentially offers a more correct position and time value inferred from the context of the beatmap.
/// Provided values are inferred in an isolated context, without consideration of other nearby hit objects.
/// </summary>
public interface IPositionSnapProvider
{
/// <summary>
/// Given a position, find a valid time and position snap.
/// </summary>
/// <remarks>
/// This call should be equivalent to running <see cref="FindSnappedPosition"/> with any additional logic that can be performed without the time immutability restriction.
/// </remarks>
/// <param name="screenSpacePosition">The screen-space position to be snapped.</param>
/// <returns>The time and position post-snapping.</returns>
SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition);
/// <summary>
/// Given a position, find a value position snap, restricting time to its input value.
/// </summary>
/// <param name="screenSpacePosition">The screen-space position to be snapped.</param>
/// <returns>The position post-snapping. Time will always be null.</returns>
SnapResult FindSnappedPosition(Vector2 screenSpacePosition);
}
}
|
// 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 osuTK;
namespace osu.Game.Rulesets.Edit
{
/// <summary>
/// A snap provider which given the position of a hit object, offers a more correct position and time value inferred from the context of the beatmap.
/// Provided values are done so in an isolated context, without consideration of other nearby hit objects.
/// </summary>
public interface IPositionSnapProvider
{
/// <summary>
/// Given a position, find a valid time and position snap.
/// </summary>
/// <remarks>
/// This call should be equivalent to running <see cref="FindSnappedPosition"/> with any additional logic that can be performed without the time immutability restriction.
/// </remarks>
/// <param name="screenSpacePosition">The screen-space position to be snapped.</param>
/// <returns>The time and position post-snapping.</returns>
SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition);
/// <summary>
/// Given a position, find a value position snap, restricting time to its input value.
/// </summary>
/// <param name="screenSpacePosition">The screen-space position to be snapped.</param>
/// <returns>The position post-snapping. Time will always be null.</returns>
SnapResult FindSnappedPosition(Vector2 screenSpacePosition);
}
}
|
mit
|
C#
|
eba37e8c1dc340bc2b4bad272953158eedf9f693
|
Update Gear_MyObject_Csharp.cs
|
PedroRossa/GearSDK,PedroRossa/GearSDK,PedroRossa/GearSDK,PedroRossa/GearSDK,PedroRossa/GearSDK
|
_Contribuition_FOLDER/MiddleLevel_GUIDE/C#/_Templates/Gear_MyObject_Csharp.cs
|
_Contribuition_FOLDER/MiddleLevel_GUIDE/C#/_Templates/Gear_MyObject_Csharp.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GearSDK_CSharpDLL.Gear_Objects
{
public class Gear_<MY_OBJECT>_csharp
{
#region Attributes
int id;
string name;
string pin;
int value;
#endregion
#region Constructors
public Gear_<MY_OBJECT>_csharp()
{
}
public Gear_<MY_OBJECT>_csharp(int id, string name, string pin, int value)
{
this.id = id;
this.name = name;
this.pin = pin;
this.value = value;
}
#endregion
#region Gets and Sets
public int Id { get => id; }
public string Name { get => name; }
public string Pin { get => pin; }
public int Value { get => value; set => this.value = value; }
#endregion
}
}
namespace Json.<MY_OBJECT>
{
/*
CREATE ALL THIS CLASSES WITH THE SITE: http://json2csharp.com
Or made your on classes with the names bellow
- USING THE SITE -
Put the header json on this site, and re-name the RootObject to Root_Header
Change the <MY_OBJECT> class generated by site to Header
Put the data json on this same site, and re-name the RootObject to Root_Data
------------------
*/
public class Header
{
public string name { get; set; }
public string pin { get; set; }
public int value { get; set; }
}
public class Root_Header
{
public Header myObject { get; set; }
}
public class Data
{
public string name { get; set; }
public int value { get; set; }
}
public class Root_Data
{
public Data myObject { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GearSDK_CSharpDLL.Gear_Objects
{
public class Gear_<MY_OBJECT>_csharp
{
#region Attributes
int id;
string name;
string pin;
int value;
#endregion
#region Constructors
public Gear_<MY_OBJECT>_csharp()
{
}
public Gear_<MY_OBJECT>_csharp(int id, string name, string pin, int value)
{
this.id = id;
this.name = name;
this.pin = pin;
this.value = value;
}
#endregion
#region Gets and Sets
public int Id { get => id; }
public string Name { get => name; }
public string Pin { get => pin; }
public int Value { get => value; set => this.value = value; }
#endregion
}
}
namespace Json.<MY_OBJECT>
{
/*
CREATE ALL THIS CLASSES WITH THE SITE: http://json2csharp.com
Or made your on classes with the names bellow
- USING THE SITE -
Put the header json on this site, and re-name the RootObject to Root_Header
Change the <MY_OBJECT> class generated by site to Header
Put the data json on this same site, and re-name the RootObject to Root_Data
------------------
*/
public class Header
{
public string name { get; set; }
public string pin { get; set; }
public int value { get; set; }
public int type { get; set; }
}
public class Root_Header
{
public Header myObject { get; set; }
}
public class Data
{
public string name { get; set; }
public int state { get; set; }
}
public class Root_Data
{
public Data myObject { get; set; }
}
}
|
mit
|
C#
|
6e07b46ac1931e5d2a27326daf58bb248ba7b185
|
Remove use of obsolete property.
|
Faithlife/FaithlifeUtility,ejball/ArgsReading,Faithlife/System.Data.SQLite,Faithlife/Parsing,Faithlife/System.Data.SQLite,ejball/XmlDocMarkdown
|
tools/Build/Build.cs
|
tools/Build/Build.cs
|
using System;
using Faithlife.Build;
internal static class Build
{
public static int Main(string[] args) => BuildRunner.Execute(args, build =>
{
build.AddDotNetTargets(
new DotNetBuildSettings
{
NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
DocsSettings = new DotNetDocsSettings
{
GitLogin = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
GitAuthor = new GitAuthorInfo("Faithlife Build Bot", "faithlifebuildbot@users.noreply.github.com"),
SourceCodeUrl = "https://github.com/Faithlife/RepoName/tree/master/src",
},
});
});
}
|
using System;
using Faithlife.Build;
internal static class Build
{
public static int Main(string[] args) => BuildRunner.Execute(args, build =>
{
build.AddDotNetTargets(
new DotNetBuildSettings
{
NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
DocsSettings = new DotNetDocsSettings
{
GitLogin = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
GitAuthor = new GitAuthorInfo("Faithlife Build Bot", "faithlifebuildbot@users.noreply.github.com"),
SourceCodeUrl = "https://github.com/Faithlife/RepoName/tree/master/src",
},
SourceLinkSettings = SourceLinkSettings.Default,
});
});
}
|
mit
|
C#
|
3cf5fb9cf7983b7d8f3ee45bd800a04044f7c4bc
|
Swap channel and shoot
|
JollyCompany/teamjollygame2
|
jollyplatformer/Assets/Scripts/HeroController.cs
|
jollyplatformer/Assets/Scripts/HeroController.cs
|
using UnityEngine;
using System.Collections;
using InControl;
public class HeroController : MonoBehaviour
{
public int PlayerNumber;
void Start ()
{
string playerNumberString = this.name.Substring(this.name.Length-2, 1);
this.PlayerNumber = int.Parse(playerNumberString);
}
public InputDevice InputDevice
{
get
{
if (this.PlayerNumber >= InputManager.Devices.Count)
{
return null;
}
return InputManager.Devices[this.PlayerNumber];
}
}
public float HorizontalMovementAxis
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetAxis ("Horizontal") : inputDevice.LeftStickX;
}
}
public bool Jump
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButtonDown ("Fire1") : inputDevice.Action1.WasPressed;
}
}
public bool Shooting
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButton ("Fire3") : inputDevice.Action2.WasPressed;
}
}
public bool Stomping
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButton ("Fire4") : inputDevice.Action4.WasPressed;
}
}
public bool GetBiggerStart
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButtonDown ("Fire2") : inputDevice.Action3.WasPressed;
}
}
public bool GetBiggerHold
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButton ("Fire2") : inputDevice.Action3.IsPressed;
}
}
public bool GetBiggerEnd
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButtonUp ("Fire2") : inputDevice.Action3.WasReleased;
}
}
public bool GetResetGame
{
get
{
if (this.PlayerNumber == 1)
{
return Input.GetButtonUp ("Fire5");
}
return false;
}
}
}
|
using UnityEngine;
using System.Collections;
using InControl;
public class HeroController : MonoBehaviour
{
public int PlayerNumber;
void Start ()
{
string playerNumberString = this.name.Substring(this.name.Length-2, 1);
this.PlayerNumber = int.Parse(playerNumberString);
}
public InputDevice InputDevice
{
get
{
if (this.PlayerNumber >= InputManager.Devices.Count)
{
return null;
}
return InputManager.Devices[this.PlayerNumber];
}
}
public float HorizontalMovementAxis
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetAxis ("Horizontal") : inputDevice.LeftStickX;
}
}
public bool Jump
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButtonDown ("Fire1") : inputDevice.Action1.WasPressed;
}
}
public bool Shooting
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButton ("Fire2") : inputDevice.Action2.WasPressed;
}
}
public bool Stomping
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButton ("Fire4") : inputDevice.Action4.WasPressed;
}
}
public bool GetBiggerStart
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButtonDown ("Fire3") : inputDevice.Action3.WasPressed;
}
}
public bool GetBiggerHold
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButton ("Fire3") : inputDevice.Action3.IsPressed;
}
}
public bool GetBiggerEnd
{
get
{
InputDevice inputDevice = this.InputDevice;
return inputDevice == null ? Input.GetButtonUp ("Fire3") : inputDevice.Action3.WasReleased;
}
}
public bool GetResetGame
{
get
{
if (this.PlayerNumber == 1)
{
return Input.GetButtonUp ("Fire5");
}
return false;
}
}
}
|
mit
|
C#
|
9a731c01ba72e50d42112f621de35c3adfb4158b
|
Update PartsTests.cs
|
Particular/SyncOMatic
|
src/Tests/PartsTests.cs
|
src/Tests/PartsTests.cs
|
using System;
using System.Threading.Tasks;
using GitHubSync;
using VerifyXunit;
using Xunit;
using Xunit.Abstractions;
[UsesVerify]
public class PartsTests :
XunitContextBase
{
[Fact]
public Task Tree()
{
var parts = new Parts("SimonCropp/Fake", TreeEntryTargetType.Tree, "develop", "buildSupport");
return Verifier.Verify(parts);
}
[Fact]
public Task Blob()
{
var parts = new Parts("SimonCropp/Fake", TreeEntryTargetType.Blob, "develop", "src/settings");
return Verifier.Verify(parts);
}
[Fact]
public async Task CannotEscapeOutOfARootTree()
{
var parts = new Parts("SimonCropp/Fake", TreeEntryTargetType.Tree, "develop", null);
await Verifier.Verify(parts);
// ReSharper disable once UnusedVariable
Assert.Throws<Exception>(() =>
{
var parent = parts.ParentTreePart;
});
}
public PartsTests(ITestOutputHelper output) :
base(output)
{
}
}
|
using System;
using System.Threading.Tasks;
using GitHubSync;
using VerifyXunit;
using Xunit;
using Xunit.Abstractions;
public class PartsTests :
XunitContextBase
{
[Fact]
public Task Tree()
{
var parts = new Parts("SimonCropp/Fake", TreeEntryTargetType.Tree, "develop", "buildSupport");
return Verifier.Verify(parts);
}
[Fact]
public Task Blob()
{
var parts = new Parts("SimonCropp/Fake", TreeEntryTargetType.Blob, "develop", "src/settings");
return Verifier.Verify(parts);
}
[Fact]
public async Task CannotEscapeOutOfARootTree()
{
var parts = new Parts("SimonCropp/Fake", TreeEntryTargetType.Tree, "develop", null);
await Verifier.Verify(parts);
// ReSharper disable once UnusedVariable
Assert.Throws<Exception>(() =>
{
var parent = parts.ParentTreePart;
});
}
public PartsTests(ITestOutputHelper output) :
base(output)
{
}
}
|
mit
|
C#
|
dfaadd6acf8ebf5b4b73fffdeeabb99adcd1ce40
|
Add exeption handling in sample app
|
auth0/Auth0.Windows.UWP,auth0/Auth0.Windows.UWP
|
samples/LoginClientSample.Cs/MainPage.xaml.cs
|
samples/LoginClientSample.Cs/MainPage.xaml.cs
|
using Auth0.LoginClient;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace LoginClientSample.Cs
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
private Auth0Client auth0Client;
public MainPage()
{
this.InitializeComponent();
auth0Client = new Auth0Client("", "");
}
private async void LoginButton_OnClick(object sender, RoutedEventArgs e)
{
try
{
var user = await auth0Client.LoginAsync();
UserInfoTextBox.Text = user.Profile.ToString();
}
catch (Exception ex)
{
UserInfoTextBox.Text = ex.Message;
}
}
private async void LoginWithConnectionButton_OnClick(object sender, RoutedEventArgs e)
{
try
{
var user = await auth0Client.LoginAsync(ConnectionNameTextBox.Text);
UserInfoTextBox.Text = user.Profile.ToString();
}
catch (Exception ex)
{
UserInfoTextBox.Text = ex.Message;
}
}
private async void LoginNoWidgetButton_Click(object sender, RoutedEventArgs e)
{
try
{
var user = await auth0Client.LoginAsync(DBConnectionNameTextBox.Text, UsernameTextBox.Text, PasswordTextBox.Password);
UserInfoTextBox.Text = user.Profile.ToString();
}
catch (Exception ex)
{
UserInfoTextBox.Text = ex.Message;
}
}
}
}
|
using Auth0.LoginClient;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace LoginClientSample.Cs
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
private Auth0Client auth0Client;
public MainPage()
{
this.InitializeComponent();
auth0Client = new Auth0Client("Your domain", "Your client ID");
}
private async void LoginButton_OnClick(object sender, RoutedEventArgs e)
{
var user = await auth0Client.LoginAsync();
UserInfoTextBox.Text = user.Profile.ToString();
}
private async void LoginWithConnectionButton_OnClick(object sender, RoutedEventArgs e)
{
var user = await auth0Client.LoginAsync(ConnectionNameTextBox.Text);
UserInfoTextBox.Text = user.Profile.ToString();
}
private async void LoginNoWidgetButton_Click(object sender, RoutedEventArgs e)
{
var user = await auth0Client.LoginAsync(DBConnectionNameTextBox.Text, UsernameTextBox.Text, PasswordTextBox.Password);
UserInfoTextBox.Text = user.Profile.ToString();
}
}
}
|
mit
|
C#
|
1a22b1451c8659ba35f2d55273461197ee03ef20
|
バージョンを1.0.3に変更
|
karamem0/LinqToCalil
|
source/LinqToCalil/Properties/AssemblyInfo.cs
|
source/LinqToCalil/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("LinqToCalil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("karamem0")]
[assembly: AssemblyProduct("LinqToCalil")]
[assembly: AssemblyCopyright("Copyright © 2011-2016 karamem0")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("LinqToCalil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("karamem0")]
[assembly: AssemblyProduct("LinqToCalil")]
[assembly: AssemblyCopyright("Copyright © 2011-2016 karamem0")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
|
apache-2.0
|
C#
|
91d337fe553e4b139a54d236b71c10f36c21d999
|
Fix duplicate content in LessContentTransformer
|
irii/Bundler,irii/Bundler
|
Bundler.Less/LessContentTransformer.cs
|
Bundler.Less/LessContentTransformer.cs
|
using System;
using System.IO;
using Bundler.Infrastructure;
using dotless.Core;
using dotless.Core.configuration;
namespace Bundler.Less {
public class LessContentTransformer : IContentTransformer {
void IDisposable.Dispose() { }
bool IContentTransformer.Process(IBundleContext bundleContext, IFileContent fileContent) {
if (string.IsNullOrWhiteSpace(fileContent.Content)) {
fileContent.Content = string.Empty;
return true;
}
var configuration = new DotlessConfiguration {
MinifyOutput = bundleContext.Optimization,
MapPathsToWeb = false,
DisableParameters = false,
RootPath = bundleContext.GetFullPath(Path.GetDirectoryName(fileContent.VirtualFile))
};
var lessEngine = new EngineFactory(configuration).GetEngine();
lessEngine.CurrentDirectory = configuration.RootPath;
try {
fileContent.Content = lessEngine.TransformToCss(fileContent.Content, null) ?? string.Empty;
return true;
}
catch (Exception) {
fileContent.Content = $"/* Error while parsing LESS/CSS source '{fileContent.VirtualFile}' */" + Environment.NewLine;
}
return false;
}
}
}
|
using System;
using System.IO;
using Bundler.Infrastructure;
using dotless.Core;
using dotless.Core.configuration;
namespace Bundler.Less {
public class LessContentTransformer : IContentTransformer {
void IDisposable.Dispose() { }
bool IContentTransformer.Process(IBundleContext bundleContext, IFileContent fileContent) {
if (string.IsNullOrWhiteSpace(fileContent.Content)) {
fileContent.Content = string.Empty;
return true;
}
var configuration = new DotlessConfiguration {
MinifyOutput = bundleContext.Optimization,
MapPathsToWeb = false,
DisableParameters = false,
RootPath = bundleContext.GetFullPath(Path.GetDirectoryName(fileContent.VirtualFile))
};
var lessEngine = new EngineFactory(configuration).GetEngine();
lessEngine.CurrentDirectory = configuration.RootPath;
try {
fileContent.Content = lessEngine.TransformToCss(fileContent.Content, null) ?? string.Empty;
return true;
}
catch (Exception) {
fileContent.Content = $"/* Error while parsing LESS/CSS source '{fileContent.VirtualFile}' */";
if (bundleContext.FallbackOnError) {
fileContent.Content += Environment.NewLine + fileContent.Content;
}
}
return false;
}
}
}
|
mit
|
C#
|
64a50ee4a489c169e93794913849fa1c57753217
|
Set auto-incrementing file version, starting with 0.1, since we're at alpha stage
|
j2jensen/CallMeMaybe
|
CallMeMaybe/Properties/AssemblyInfo.cs
|
CallMeMaybe/Properties/AssemblyInfo.cs
|
using System.Resources;
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("CallMeMaybe")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("CallMeMaybe")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.1.*")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Resources;
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("CallMeMaybe")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("CallMeMaybe")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
fe0bf70df1fa41a49aff61b3177123eb50a4f347
|
Update IDataRow.cs
|
haskox/DotNetSiemensPLCToolBoxLibrary,Nick135/DotNetSiemensPLCToolBoxLibrary,Nick135/DotNetSiemensPLCToolBoxLibrary,dotnetprojects/DotNetSiemensPLCToolBoxLibrary,jogibear9988/DotNetSiemensPLCToolBoxLibrary,proemmer/DotNetSiemensPLCToolBoxLibrary,StefanHasensperling/DotNetSiemensPLCToolBoxLibrary,dotnetprojects/DotNetSiemensPLCToolBoxLibrary,Nick135/DotNetSiemensPLCToolBoxLibrary,haskox/DotNetSiemensPLCToolBoxLibrary,jogibear9988/DotNetSiemensPLCToolBoxLibrary,StefanHasensperling/DotNetSiemensPLCToolBoxLibrary,devolegf/DotNetSiemensPLCToolBoxLibrary,StefanHasensperling/DotNetSiemensPLCToolBoxLibrary,devolegf/DotNetSiemensPLCToolBoxLibrary,proemmer/DotNetSiemensPLCToolBoxLibrary,dotnetprojects/DotNetSiemensPLCToolBoxLibrary,devolegf/DotNetSiemensPLCToolBoxLibrary,haskox/DotNetSiemensPLCToolBoxLibrary,StefanHasensperling/DotNetSiemensPLCToolBoxLibrary,jogibear9988/DotNetSiemensPLCToolBoxLibrary
|
LibNoDaveConnectionLibrary/DataTypes/Blocks/IDataRow.cs
|
LibNoDaveConnectionLibrary/DataTypes/Blocks/IDataRow.cs
|
/*
This implements a high level Wrapper between libnodave.dll and applications written
in MS .Net languages.
This ConnectionLibrary was written by Jochen Kuehner
* http://jfk-solutuions.de/
*
* Thanks go to:
* Steffen Krayer -> For his work on MC7 decoding and the Source for his Decoder
* Zottel -> For LibNoDave
WPFToolboxForSiemensPLCs is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
WPFToolboxForSiemensPLCs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with Libnodave; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using DotNetSiemensPLCToolBoxLibrary.Communication;
using DotNetSiemensPLCToolBoxLibrary.Communication.LibNoDave;
using DotNetSiemensPLCToolBoxLibrary.DataTypes.Blocks.Step7V5;
using DotNetSiemensPLCToolBoxLibrary.DataTypes.Projectfolders.Step7V5;
using DotNetSiemensPLCToolBoxLibrary.PLCs.S7_xxx.MC7;
using DotNetSiemensPLCToolBoxLibrary.General;
namespace DotNetSiemensPLCToolBoxLibrary.DataTypes.Blocks
{
public interface IDataRow
{
List<IDataRow> Children { get; }
S7DataRowType DataType { get; set; }
string Name { get; set; }
string FullName { get; }
string Comment { get; set; }
string FullComment { get; }
IDataRow Parent { get; set; }
ByteBitAddress BlockAddress { get; }
Block PlcBlock { get; }
string StructuredName { get; }
}
}
|
/*
This implements a high level Wrapper between libnodave.dll and applications written
in MS .Net languages.
This ConnectionLibrary was written by Jochen Kuehner
* http://jfk-solutuions.de/
*
* Thanks go to:
* Steffen Krayer -> For his work on MC7 decoding and the Source for his Decoder
* Zottel -> For LibNoDave
WPFToolboxForSiemensPLCs is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
WPFToolboxForSiemensPLCs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with Libnodave; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using DotNetSiemensPLCToolBoxLibrary.Communication;
using DotNetSiemensPLCToolBoxLibrary.Communication.LibNoDave;
using DotNetSiemensPLCToolBoxLibrary.DataTypes.Blocks.Step7V5;
using DotNetSiemensPLCToolBoxLibrary.DataTypes.Projectfolders.Step7V5;
using DotNetSiemensPLCToolBoxLibrary.PLCs.S7_xxx.MC7;
using DotNetSiemensPLCToolBoxLibrary.General;
namespace DotNetSiemensPLCToolBoxLibrary.DataTypes.Blocks
{
public interface IDataRow
{
List<IDataRow> Children { get; }
S7DataRowType DataType { get; set; }
string Name { get; set; }
string Comment { get; set; }
IDataRow Parent { get; set; }
ByteBitAddress BlockAddress { get; }
Block PlcBlock { get; }
string StructuredName { get; }
}
}
|
lgpl-2.1
|
C#
|
807ff5b3821c80fc63b0e542bb48cd669487596f
|
Fix error counter logic
|
yawaramin/TDDUnit
|
TestSuite.cs
|
TestSuite.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace TDDUnit {
class TestSuite {
public TestSuite(Type type = null) {
if (type != null) {
var methodInfos = from methodInfo in type.GetMethods()
where methodInfo.Name.StartsWith("Test")
select methodInfo;
foreach (var methodInfo in methodInfos)
Add((TestCase)type.GetConstructor(new Type[] { typeof(string) }).Invoke(new string[] { methodInfo.Name }));
}
}
public void Add(TestCase test) {
m_tests.Add(test);
}
public void Run(TestResult result) {
foreach (TestCase test in m_tests) test.Run(result);
}
public IEnumerable<string> FailedTests(TestResult result) {
int oldErrorCount;
foreach (TestCase test in m_tests) {
oldErrorCount = result.ErrorCount;
test.Run(result);
if (result.ErrorCount == oldErrorCount + 1) {
yield return test.Name;
}
}
}
private List<TestCase> m_tests = new List<TestCase>();
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace TDDUnit {
class TestSuite {
public TestSuite(Type type = null) {
if (type != null) {
var methodInfos = from methodInfo in type.GetMethods()
where methodInfo.Name.StartsWith("Test")
select methodInfo;
foreach (var methodInfo in methodInfos)
Add((TestCase)type.GetConstructor(new Type[] { typeof(string) }).Invoke(new string[] { methodInfo.Name }));
}
}
public void Add(TestCase test) {
m_tests.Add(test);
}
public void Run(TestResult result) {
foreach (TestCase test in m_tests) test.Run(result);
}
public IEnumerable<string> FailedTests(TestResult result) {
int oldErrorCount = result.ErrorCount;
foreach (TestCase test in m_tests) {
test.Run(result);
if (result.ErrorCount == oldErrorCount + 1) {
yield return test.Name;
}
}
}
private List<TestCase> m_tests = new List<TestCase>();
}
}
|
apache-2.0
|
C#
|
c013fd9ed73ff8e6de6309c84d37eff20cb420f2
|
Test rebind instance.
|
JohanLarsson/Gu.Inject
|
Gu.Inject.Tests/KernelTests.Rebind.cs
|
Gu.Inject.Tests/KernelTests.Rebind.cs
|
namespace Gu.Inject.Tests
{
using System;
using Gu.Inject.Tests.Types;
using Moq;
using NUnit.Framework;
public partial class KernelTests
{
public class Rebind
{
[Test]
public void BindThenReBindThenGet()
{
using (var kernel = new Kernel())
{
kernel.Bind<IWith, With<DefaultCtor>>();
kernel.ReBind<IWith, With<With<DefaultCtor>>>();
var actual = kernel.Get<IWith>();
Assert.AreSame(actual, kernel.Get<With<With<DefaultCtor>>>());
}
}
[Test]
public void BindThenReBindInstanceThenGet()
{
using (var kernel = new Kernel())
{
kernel.Bind<IWith, With<DefaultCtor>>();
var instance = new With<DefaultCtor>(new DefaultCtor());
kernel.ReBind<IWith>(instance);
var actual = kernel.Get<IWith>();
Assert.AreSame(instance, actual);
Assert.AreNotSame(instance.Value, kernel.Get<DefaultCtor>());
}
}
[Test]
public void Func()
{
Mock<IDisposable> mock;
using (var kernel = new Kernel())
{
using (var instance = new Disposable())
{
kernel.Bind(instance);
kernel.Bind(Mock.Of<IDisposable>);
var actual = kernel.Get<IDisposable>();
Assert.AreNotSame(actual, instance);
Assert.AreEqual(0, instance.Disposed);
mock = Mock.Get(actual);
mock.Setup(x => x.Dispose());
}
}
mock.Verify(x => x.Dispose(), Times.Once);
}
}
}
}
|
namespace Gu.Inject.Tests
{
using System;
using Gu.Inject.Tests.Types;
using Moq;
using NUnit.Framework;
public partial class KernelTests
{
public class Rebind
{
[Test]
public void BindThenReBindThenGet()
{
using (var kernel = new Kernel())
{
kernel.Bind<IWith, With<DefaultCtor>>();
kernel.ReBind<IWith, With<With<DefaultCtor>>>();
var actual = kernel.Get<IWith>();
Assert.AreSame(actual, kernel.Get<With<With<DefaultCtor>>>());
}
}
[Test]
public void Func()
{
Mock<IDisposable> mock;
using (var kernel = new Kernel())
{
using (var instance = new Disposable())
{
kernel.Bind(instance);
kernel.Bind(Mock.Of<IDisposable>);
var actual = kernel.Get<IDisposable>();
Assert.AreNotSame(actual, instance);
Assert.AreEqual(0, instance.Disposed);
mock = Mock.Get(actual);
mock.Setup(x => x.Dispose());
}
}
mock.Verify(x => x.Dispose(), Times.Once);
}
}
}
}
|
mit
|
C#
|
25120c52cbfe299697e3331429fd73d8b77d4d32
|
Update DataTool.cs
|
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D
|
src/Core2D/UI/Avalonia/Dock/Tools/DataTool.cs
|
src/Core2D/UI/Avalonia/Dock/Tools/DataTool.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 DMC = Dock.Model.Controls;
namespace Core2D.UI.Avalonia.Dock.Tools
{
/// <summary>
/// Data view.
/// </summary>
public class DataTool : DMC.Tool
{
}
}
|
// 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 DMC=Dock.Model.Controls;
namespace Core2D.UI.Avalonia.Dock.Tools
{
/// <summary>
/// Data view.
/// </summary>
public class DataTool : DMC.Tool
{
}
}
|
mit
|
C#
|
7a4a3779ab7867a3d89948bd4a63a71f79845753
|
increment patch version,
|
jwChung/Experimentalism,jwChung/Experimentalism
|
build/CommonAssemblyInfo.cs
|
build/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.8.14")]
[assembly: AssemblyInformationalVersion("0.8.14")]
/*
* Version 0.8.14
*
* Change the base class of the FirstClassCommand class to the TestCommand
* class.
*
* BREAKING CHANGE
* before:
* public class FirstClassCommand : FactCommand { ... }
* after:
* public class FirstClassCommand : TestCommand { ... }
*/
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.8.13")]
[assembly: AssemblyInformationalVersion("0.8.13")]
/*
* Version 0.8.13
*
* While publishing v0.8.12 to NuGet server, exception was thrown,
* so v0.8.13 is published to ignore the exception.
*
* Rename some properties of FirstClassCommand to clarify
*
* BREAKING CHANGE
* FirstClassCommand class
* before:
* Method
* after:
* DeclaredMethod
*
* before:
* TestCase
* after:
* TestMethod
*/
|
mit
|
C#
|
9f2b631669d163dd7d0d0433c795c1681051d678
|
make it public
|
mono-soc-2013/gstreamer-sharp,mono-soc-2013/gstreamer-sharp,mono-soc-2013/gstreamer-sharp
|
sources/custom/Adapter.cs
|
sources/custom/Adapter.cs
|
// Copyright (C) 2013 Stephan Sundermann <stephansundermann@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Gst.Base {
using System;
using System.Runtime.InteropServices;
public partial class Adapter
{
[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_adapter_copy(IntPtr raw, out IntPtr dest, int offset, int size);
public byte[] Copy(int offset, int size) {
IntPtr mem = Marshal.AllocHGlobal (size);
gst_adapter_copy(Handle, out mem, offset, size);
byte[] bytes = new byte[size];
Marshal.Copy (mem, bytes, 0, size);
return bytes;
}
[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_adapter_map(IntPtr raw, out int size);
public byte[] Map() {
int size;
IntPtr mem = gst_adapter_map (Handle, out size);
byte[] ret = new byte[size];
Marshal.Copy (mem, ret , 0, size);
return ret;
}
}
}
|
// Copyright (C) 2013 Stephan Sundermann <stephansundermann@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Gst.Base {
using System;
using System.Runtime.InteropServices;
partial class Adapter
{
[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_adapter_copy(IntPtr raw, out IntPtr dest, int offset, int size);
public byte[] Copy(int offset, int size) {
IntPtr mem = Marshal.AllocHGlobal (size);
gst_adapter_copy(Handle, out mem, offset, size);
byte[] bytes = new byte[size];
Marshal.Copy (mem, bytes, 0, size);
return bytes;
}
[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_adapter_map(IntPtr raw, out int size);
public byte[] Map() {
int size;
IntPtr mem = gst_adapter_map (Handle, out size);
byte[] ret = new byte[size];
Marshal.Copy (mem, ret , 0, size);
return ret;
}
}
}
|
agpl-3.0
|
C#
|
ddefd758fdf02ea9450aa256a19e55aca8ac2039
|
Update AutofilterData.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET
|
Examples/CSharp/Data/Processing/FilteringAndValidation/AutofilterData.cs
|
Examples/CSharp/Data/Processing/FilteringAndValidation/AutofilterData.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.Processing.Processing.FilteringAndValidation
{
public class AutofilterData
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiating a Workbook object
//Opening the Excel file through the file stream
Workbook workbook = new Workbook(dataDir + "book1.xls");
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];
//Creating AutoFilter by giving the cells range of the heading row
worksheet.AutoFilter.Range = "A1:B1";
//Saving the modified Excel file
workbook.Save(dataDir + "output.out.xls");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.Processing.Processing.FilteringAndValidation
{
public class AutofilterData
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiating a Workbook object
//Opening the Excel file through the file stream
Workbook workbook = new Workbook(dataDir + "book1.xls");
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];
//Creating AutoFilter by giving the cells range of the heading row
worksheet.AutoFilter.Range = "A1:B1";
//Saving the modified Excel file
workbook.Save(dataDir + "output.out.xls");
}
}
}
|
mit
|
C#
|
7fdca74ee61c4891142ee1ab1cd0bc45f0aebacc
|
Add remarks on difference between binary SerializationFormat and transport/protocol format. Binary could be Json with a header, potentially even the same data type could be serialized as blittable or as Json, yet this should not be supported supported inside a single strongly-typed data stream.
|
Spreads/Spreads
|
src/Spreads.Core/Serialization/SerializationFormat.cs
|
src/Spreads.Core/Serialization/SerializationFormat.cs
|
namespace Spreads.Serialization
{
/// <summary>
/// Binary serialization format. Serialized data always has a header describing the method of
/// binary serialization. The data could be Json, but because of the header it is not directly
/// consumable by e.g. browsers. However, for JSON/JSONDeflate cases the only difference is
/// the header and the reast payload could be directly sent to a browser expecting 'application/json'
/// MIME type.
/// </summary>
/// <remarks>
/// JsonDeflate:
/// Objects are converted to JSON and compressed with raw deflate method
/// if compression gives smaller size. This format is compatible with raw
/// http payload with 'Accept-encoding: deflate' headers past the 8 bytes header.
///
/// BinaryLz4/Zstd:
/// Binary is stored as blittable representation with Blosc byteshuffle for arrays with fixed-size elements.
/// Then serialized (and byteshuffled) buffer is compressed with LZ4 (super fast but lower compression) or
/// Zstd (still fast and high compression, preferred method) if compression gives smaller size.
/// Actual buffer layout is type dependent.
///
/// Serialized buffer has a header with a flag indicating the format and
/// wether or not the buffer is compressed. Some data types are stored as deltas
/// with diffing performed before byteshuffling and the header must have such flag as well.
///
/// SerializationFormat should not be confused with Transport/Protocol format:
/// * Text trasport/protocol supports only JSON and the payload is plain or deflated JSON that
/// could be consumed by browsers or http servers (with headers indicating the actual format - compressed or not).
/// * Binary trasport/protocol cannot be consumed directly by browsers or http servers. The exact data layout of payload
/// depends on data type and is encoded in a 4 (+ optional 4 bytes length for variable sized data) bytes header.
/// Data could be serialized as JSON (mostly for convenience if a type is not used a lot and not blittable)
/// but it is still a binary format, though one that could be trivially converted to JSON.
/// </remarks>
public enum SerializationFormat : byte
{
/// <summary>
/// Custom binary format without compression.
/// </summary>
Binary = 0,
/// <summary>
/// Use blittable reprezentation, byteshuffle with Blosc where possibe,
/// fallback to JSON for non-blittable types and compress with BinaryLz4.
/// </summary>
// ReSharper disable once InconsistentNaming
BinaryLz4 = 1,
/// <summary>
/// Use blittable reprezentation, byteshuffle with Blosc where possibe,
/// fallback to JSON for non-blittable types and compress with BinaryZstd.
/// </summary>
BinaryZstd = 2,
// NB we use check < 100 in some places to detect binary
/// <summary>
/// Uncompressed JSON
/// </summary>
Json = 100,
/// <summary>
/// Serialize to JSON and compress with raw deflate method.
/// </summary>
JsonDeflate = 101,
#if NETCOREAPP2_1
JsonBrotli = 102
#endif
}
}
|
namespace Spreads.Serialization
{
/// <summary>
/// JsonDeflate:
/// Objects are converted to JSON and compressed with raw deflate method
/// if compression gives smaller size. This format is compatible with raw
/// http payload with 'Accept-encoding: deflate' headers.
///
/// BinaryLz4/Zstd:
/// Binary is stored as blittable representation with Blosc byteshuffle for arrays with fixed-size elements.
/// Then serialized (and byteshuffled) buffer is compressed with LZ4 (super fast) or Zstd (high compression)
/// if compression gives smaller size. Actual buffer layout is type dependent.
///
/// Serialized buffer should have a header with a flag indicating the format and
/// wether or not the buffer is compressed. Some data types are stored as deltas
/// with diffing performed before byteshuffling and the header must have such flag as well.
/// </summary>
public enum SerializationFormat : byte
{
/// <summary>
/// Custom binary format without compression.
/// </summary>
Binary = 0,
/// <summary>
/// Use blittable reprezentation, byteshuffle with Blosc where possibe,
/// fallback to JSON for non-blittable types and compress with BinaryLz4.
/// </summary>
// ReSharper disable once InconsistentNaming
BinaryLz4 = 1,
/// <summary>
/// Use blittable reprezentation, byteshuffle with Blosc where possibe,
/// fallback to JSON for non-blittable types and compress with BinaryZstd.
/// </summary>
BinaryZstd = 2,
// NB we use check < 100 in some places to detect binary
/// <summary>
/// Uncompressed JSON
/// </summary>
Json = 100,
/// <summary>
/// Serialize to JSON and compress with raw deflate method.
/// </summary>
JsonDeflate = 101,
#if NETCOREAPP2_1
JsonBrotli = 102
#endif
}
}
|
mpl-2.0
|
C#
|
cf323deae32c01b9f3b0942fe3752b04aba26168
|
Change extension method name to avoid collision.
|
PCFDev/RoleAuthorizeAttribute,PCFDev/RoleAuthorizeAttribute,PCFDev/RoleAuthorizeAttribute
|
RoleAuthorizeAttribute/RoleAuthorizeAttribute/RoleAuthorizeExtensions.cs
|
RoleAuthorizeAttribute/RoleAuthorizeAttribute/RoleAuthorizeExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
namespace RoleAuthorize.Extensions
{
public static class RoleAuthorizeExtensions
{
private static readonly char[] Delimiter = new char[] { ',' };
/// <summary>
/// Checks if a user is in any of a set of named roles.
/// </summary>
/// <param name="user"></param>
/// <param name="names">A comma separated list of role names.</param>
/// <returns>True if the user is in at least one named role, otherwise false.</returns>
public static bool IsInNamedRole(this IPrincipal user, string names)
{
var roleNamesSplit = names.Split(Delimiter).Select(_ => _.Trim()).Where(_ => !String.IsNullOrEmpty(_));
return user.IsInNamedRole(roleNamesSplit);
}
/// <summary>
/// Checks if a user is in any of a set of named roles.
/// </summary>
/// <param name="user"></param>
/// <param name="names">An enumerable of role names.</param>
/// <returns>True if the user is in at least one named role, otherwise false.</returns>
public static bool IsInNamedRole(this IPrincipal user, IEnumerable<string> names)
{
var users = names.SelectMany(_ => Config.RoleConfig.GetUsers(_)).ToList();
if (users.Count > 0 && users.Contains(user.Identity.Name, StringComparer.OrdinalIgnoreCase))
return true;
var roles = names.SelectMany(_ => Config.RoleConfig.GetRoles(_)).ToList();
if (roles.Count > 0 && roles.Any(user.IsInRole))
return true;
return false;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
namespace RoleAuthorize.Extensions
{
public static class RoleAuthorizeExtensions
{
private static readonly char[] Delimiter = new char[] { ',' };
/// <summary>
/// Checks if a user is in any of a set of named roles.
/// </summary>
/// <param name="user"></param>
/// <param name="names">A comma separated list of role names.</param>
/// <returns>True if the user is in at least one named role, otherwise false.</returns>
public static bool IsInRole(this IPrincipal user, string names)
{
var roleNamesSplit = names.Split(Delimiter).Select(_ => _.Trim()).Where(_ => !String.IsNullOrEmpty(_));
return user.IsInRole(roleNamesSplit);
}
/// <summary>
/// Checks if a user is in any of a set of named roles.
/// </summary>
/// <param name="user"></param>
/// <param name="names">An enumerable of role names.</param>
/// <returns>True if the user is in at least one named role, otherwise false.</returns>
public static bool IsInRole(this IPrincipal user, IEnumerable<string> names)
{
var users = names.SelectMany(_ => Config.RoleConfig.GetUsers(_)).ToList();
if (users.Count > 0 && users.Contains(user.Identity.Name, StringComparer.OrdinalIgnoreCase))
return true;
var roles = names.SelectMany(_ => Config.RoleConfig.GetRoles(_)).ToList();
if (roles.Count > 0 && roles.Any(user.IsInRole))
return true;
return false;
}
}
}
|
mit
|
C#
|
9992d623e88b818474e937037ef43e1610a3204c
|
make Doors list private, add getter
|
whoa-algebraic/game-off-2016,virtuoushub/game-off-2016,virtuoushub/game-off-2016,whoa-algebraic/game-off-2016,virtuoushub/game-off-2016,whoa-algebraic/game-off-2016
|
Assets/Scripts/RoomDetails.cs
|
Assets/Scripts/RoomDetails.cs
|
using System.Collections.Generic;
using UnityEngine;
public class RoomDetails : MonoBehaviour {
public int HorizontalSize;
public int VerticalSize;
private List<GameObject> Doors;
void Start() {
int doorIndex = 0;
for(int i = 0; i < transform.childCount; i++) {
GameObject child = transform.GetChild(i).gameObject;
if (child.tag == "door") {
Doors.Add(child);
child.GetComponent<DoorDetails>().ID = doorIndex;
doorIndex++;
}
}
}
public List<GameObject> GetDoors() {
return Doors;
}
}
|
using System.Collections.Generic;
using UnityEngine;
public class RoomDetails : MonoBehaviour {
public int HorizontalSize;
public int VerticalSize;
public List<GameObject> Doors;
void Start() {
int doorIndex = 0;
for(int i = 0; i < transform.childCount; i++) {
GameObject child = transform.GetChild(i).gameObject;
if (child.tag == "door") {
Doors.Add(child);
child.GetComponent<DoorDetails>().ID = doorIndex;
doorIndex++;
}
}
}
}
|
mit
|
C#
|
2bbdd920b7af637884c97cb57001dc3fa950e929
|
Fix fault with subcommand server attribute
|
HelloKitty/Booma.Proxy
|
src/Booma.Proxy.Packets.BlockServer/Attributes/SubCommand60ServerAttribute.cs
|
src/Booma.Proxy.Packets.BlockServer/Attributes/SubCommand60ServerAttribute.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreecraftCore.Serializer;
using JetBrains.Annotations;
namespace Booma.Proxy
{
/// <summary>
/// Marks the 0x60 command server payload with the associated operation code.
/// Should be marked on <see cref="BlockNetworkCommandEventServerPayload"/>.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public sealed class SubCommand60ServerAttribute : WireDataContractBaseLinkAttribute
{
/// <inheritdoc />
public SubCommand60ServerAttribute(SubCommand60OperationCode opCode)
: base((int)opCode, typeof(BlockNetworkCommandEventServerPayload))
{
if(!Enum.IsDefined(typeof(SubCommand60OperationCode), opCode)) throw new InvalidEnumArgumentException(nameof(opCode), (int)opCode, typeof(SubCommand60OperationCode));
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreecraftCore.Serializer;
using JetBrains.Annotations;
namespace Booma.Proxy
{
/// <summary>
/// Marks the 0x60 command server payload with the associated operation code.
/// Should be marked on <see cref="BlockNetworkCommandEventServerPayload"/>.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public sealed class SubCommand60ServerAttribute : WireDataContractBaseLinkAttribute
{
/// <inheritdoc />
public SubCommand60ServerAttribute(SubCommand60OperationCode opCode)
: base((int)opCode, typeof(BlockNetworkCommandEventClientPayload))
{
if(!Enum.IsDefined(typeof(SubCommand60OperationCode), opCode)) throw new InvalidEnumArgumentException(nameof(opCode), (int)opCode, typeof(SubCommand60OperationCode));
}
}
}
|
agpl-3.0
|
C#
|
b1b3e01abdc6dc7ccde647f262b1936cc6e7265b
|
Apply review suggestion.
|
smoogipoo/osu,ppy/osu,ppy/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,smoogipooo/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu
|
osu.Game/Online/Placeholders/LoginPlaceholder.cs
|
osu.Game/Online/Placeholders/LoginPlaceholder.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
namespace osu.Game.Online.Placeholders
{
public sealed class LoginPlaceholder : Placeholder
{
public LoginPlaceholder(string actionMessage)
{
AddArbitraryDrawable(new LoginButton(actionMessage));
}
private class LoginButton : OsuAnimatedButton
{
[Resolved(CanBeNull = true)]
private LoginOverlay login { get; set; }
public LoginButton(string actionMessage)
{
AutoSizeAxes = Axes.Both;
var textFlowContainer = new OsuTextFlowContainer(cp => cp.Font = cp.Font.With(size: TEXT_SIZE))
{
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding(5)
};
Child = textFlowContainer;
textFlowContainer.AddIcon(FontAwesome.Solid.UserLock, icon =>
{
icon.Padding = new MarginPadding { Right = 10 };
});
textFlowContainer.AddText(actionMessage);
Action = () => login?.Show();
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
namespace osu.Game.Online.Placeholders
{
public sealed class LoginPlaceholder : Placeholder
{
public LoginPlaceholder(string actionMessage)
{
AddArbitraryDrawable(new LoginButton(actionMessage));
}
private class LoginButton : OsuAnimatedButton
{
[Resolved(CanBeNull = true)]
private LoginOverlay login { get; set; }
public LoginButton(string actionMessage)
{
AutoSizeAxes = Axes.Both;
Child = new OsuTextFlowContainer(cp => cp.Font = cp.Font.With(size: TEXT_SIZE))
.With(t => t.AutoSizeAxes = Axes.Both)
.With(t => t.AddIcon(FontAwesome.Solid.UserLock, icon =>
{
icon.Padding = new MarginPadding { Right = 10 };
}))
.With(t => t.AddText(actionMessage))
.With(t => t.Margin = new MarginPadding(5));
Action = () => login?.Show();
}
}
}
}
|
mit
|
C#
|
d8b644704fbe134c42a1c701f6ab20626ebb5cb0
|
fix bugs
|
johnsmilee0611/psake-demo,johnsmilee0611/psake-demo,johnsmilee0611/psake-demo
|
ConsoleApplication/Program.cs
|
ConsoleApplication/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication
{
internal class Program
{
private static void Main(string[] args)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
}
}
|
mit
|
C#
|
fff1d23237147dd5f0d1390e12955e5f2a237358
|
Improve readability
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Controls/QrEncoder/Masking/Pattern7.cs
|
WalletWasabi.Gui/Controls/QrEncoder/Masking/Pattern7.cs
|
using System;
namespace Gma.QrCodeNet.Encoding.Masking
{
internal class Pattern7 : Pattern
{
public override bool this[int i, int j]
{
get { return ((((i * j) % 3) + (((i + j) % 2)) % 2)) == 0; }
set { throw new NotSupportedException(); }
}
public override MaskPatternType MaskPatternType
{
get { return MaskPatternType.Type7; }
}
}
}
|
using System;
namespace Gma.QrCodeNet.Encoding.Masking
{
internal class Pattern7 : Pattern
{
public override bool this[int i, int j]
{
get { return ((((i * j) % 3) + (i + j) % 2) % 2) == 0; }
set { throw new NotSupportedException(); }
}
public override MaskPatternType MaskPatternType
{
get { return MaskPatternType.Type7; }
}
}
}
|
mit
|
C#
|
4400102d13dbee409c8c1413d839f3fba417839f
|
Change DefaultAuthenticationType to Google
|
TerribleDev/OwinOAuthProviders,tparnell8/OwinOAuthProviders,tparnell8/OwinOAuthProviders,TerribleDev/OwinOAuthProviders,RockstarLabs/OwinOAuthProviders,tparnell8/OwinOAuthProviders,TerribleDev/OwinOAuthProviders,TerribleDev/OwinOAuthProviders,RockstarLabs/OwinOAuthProviders,RockstarLabs/OwinOAuthProviders
|
src/Owin.Security.Providers.Google/Constants.cs
|
src/Owin.Security.Providers.Google/Constants.cs
|
namespace Owin.Security.Providers.Google
{
internal static class Constants
{
public const string DefaultAuthenticationType = "Google";
}
}
|
namespace Owin.Security.Providers.Google
{
internal static class Constants
{
public const string DefaultAuthenticationType = "GooglePlus";
}
}
|
mit
|
C#
|
3dc9cdccffb9e19fa8d45986277263063cf10967
|
Set geometry in constructor
|
charlenni/Mapsui,pauldendulk/Mapsui,charlenni/Mapsui
|
Mapsui/Extensions/FeatureExtensions.cs
|
Mapsui/Extensions/FeatureExtensions.cs
|
using System.Collections.Generic;
using System.Linq;
using Mapsui.GeometryLayer;
namespace Mapsui.Extensions
{
public static class FeatureExtensions
{
public static GeometryFeature Copy(this GeometryFeature original)
{
var geometryFeature = new GeometryFeature(original.Geometry.Copy());
geometryFeature.RenderedGeometry =
original.RenderedGeometry.ToDictionary(entry => entry.Key, entry => entry.Value);
geometryFeature.Styles = original.Styles.ToList();
foreach (var field in original.Fields)
geometryFeature[field] = original[field];
return geometryFeature;
}
public static IEnumerable<GeometryFeature> Copy(this IEnumerable<GeometryFeature> original)
{
return original.Select(f => f.Copy()).ToList();
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Mapsui.GeometryLayer;
namespace Mapsui.Extensions
{
public static class FeatureExtensions
{
public static GeometryFeature Copy(this GeometryFeature original)
{
var geometryFeature = new GeometryFeature();
geometryFeature.Geometry = original.Geometry.Copy();
geometryFeature.RenderedGeometry =
original.RenderedGeometry.ToDictionary(entry => entry.Key, entry => entry.Value);
geometryFeature.Styles = original.Styles.ToList();
foreach (var field in original.Fields)
geometryFeature[field] = original[field];
return geometryFeature;
}
public static IEnumerable<GeometryFeature> Copy(this IEnumerable<GeometryFeature> original)
{
return original.Select(f => f.Copy()).ToList();
}
}
}
|
mit
|
C#
|
02fe638c64bfd8ac0ed252697f6bf414c6f17a02
|
Bump version to 2.2
|
kreuzhofer/SQLite.Net-PCL,fernandovm/SQLite.Net-PCL,TiendaNube/SQLite.Net-PCL,molinch/SQLite.Net-PCL,mattleibow/SQLite.Net-PCL,igrali/SQLite.Net-PCL,igrali/SQLite.Net-PCL,oysteinkrog/SQLite.Net-PCL,caseydedore/SQLite.Net-PCL
|
src/GlobalAssemblyInfo.cs
|
src/GlobalAssemblyInfo.cs
|
using System.Reflection;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
|
using System.Reflection;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
|
mit
|
C#
|
9ddafb64af604e8a9ef0c52fd6157efad1bc2cfa
|
update vs
|
Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal
|
Master/Appleseed/Projects/PortableAreas/SelfUpdater/Properties/AssemblyInfo.cs
|
Master/Appleseed/Projects/PortableAreas/SelfUpdater/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Web;
// 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("SelfUpdater")]
[assembly: AssemblyDescription("Appleseed Portal and Content Management System : Portal Self Update")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("SelfUpdater")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-2017")]
[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("1bbaa317-aebe-425c-8db3-a1aee724365d")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.4.131.463")]
[assembly: AssemblyFileVersion("1.4.131.463")]
[assembly: PreApplicationStartMethod(typeof(SelfUpdater.Initializer), "Initialize")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Web;
// 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("SelfUpdater")]
[assembly: AssemblyDescription("Appleseed Portal and Content Management System : Portal Self Update")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("SelfUpdater")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-2017")]
[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("1bbaa317-aebe-425c-8db3-a1aee724365d")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.4.98.383")]
[assembly: AssemblyFileVersion("1.4.98.383")]
[assembly: PreApplicationStartMethod(typeof(SelfUpdater.Initializer), "Initialize")]
|
apache-2.0
|
C#
|
dbfa1c6717eb736e444a23f4724f1b819b450d4f
|
Undo wrong changes by previous commit
|
magenta-aps/cprbroker,OS2CPRbroker/cprbroker,magenta-aps/cprbroker,OS2CPRbroker/cprbroker,magenta-aps/cprbroker
|
PART/Source/CprBroker/BatchClient/Program.cs
|
PART/Source/CprBroker/BatchClient/Program.cs
|
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The CPR Broker concept was initally developed by
* Gentofte Kommune / Municipality of Gentofte, Denmark.
* Contributor(s):
* Steen Deth
*
*
* The Initial Code for CPR Broker and related components is made in
* cooperation between Magenta, Gentofte Kommune and IT- og Telestyrelsen /
* Danish National IT and Telecom Agency
*
* Contributor(s):
* Beemen Beshara
* Niels Elgaard Larsen
* Leif Lodahl
* Steen Deth
*
* The code is currently governed by IT- og Telestyrelsen / Danish National
* IT and Telecom Agency
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using CprBroker.Utilities.ConsoleApps;
namespace BatchClient
{
public class Program
{
public static void Main(params string[] args)
{
ConsoleEnvironment env = ConsoleEnvironment.Create(args);
env.Run();
}
}
}
|
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The CPR Broker concept was initally developed by
* Gentofte Kommune / Municipality of Gentofte, Denmark.
* Contributor(s):
* Steen Deth
*
*
* The Initial Code for CPR Broker and related components is made in
* cooperation between Magenta, Gentofte Kommune and IT- og Telestyrelsen /
* Danish National IT and Telecom Agency
*
* Contributor(s):
* Beemen Beshara
* Niels Elgaard Larsen
* Leif Lodahl
* Steen Deth
*
* The code is currently governed by IT- og Telestyrelsen / Danish National
* IT and Telecom Agency
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using CprBroker.Utilities.ConsoleApps;
namespace BatchClient
{
public class Program
{
public static void Main(params string[] args)
{
var config = System.Configuration.ConfigurationManager.OpenExeConfiguration(typeof(Program).Assembly.Location);
CprBroker.Utilities.Config.DataProviderKeysSection.RegisterNewKeys(config);
ConsoleEnvironment env = ConsoleEnvironment.Create(args);
env.Run();
}
}
}
|
mpl-2.0
|
C#
|
e65ce9e230f7a5de6047ec4f05b05ba83c1fc7b9
|
Improve ConnectableObservable
|
neuecc/UniRx,endo0407/UniRx,OC-Leon/UniRx,cruwel/UniRx,ufcpp/UniRx,cruwel/UniRx,TORISOUP/UniRx,ataihei/UniRx,cruwel/UniRx,kimsama/UniRx,saruiwa/UniRx,m-ishikawa/UniRx,OrangeCube/UniRx,ppcuni/UniRx
|
Assets/UniRx/Scripts/Subjects/ConnectableObservable.cs
|
Assets/UniRx/Scripts/Subjects/ConnectableObservable.cs
|
using System;
namespace UniRx
{
public interface IConnectableObservable<T> : IObservable<T>
{
IDisposable Connect();
}
public static partial class Observable
{
class ConnectableObservable<T> : IConnectableObservable<T>
{
readonly IObservable<T> source;
readonly ISubject<T> subject;
readonly object gate = new object();
Connection connection;
public ConnectableObservable(IObservable<T> source, ISubject<T> subject)
{
this.source = source.AsObservable();
this.subject = subject;
}
public IDisposable Connect()
{
lock (gate)
{
// don't subscribe twice
if (connection == null)
{
var subscription = source.Subscribe(subject);
connection = new Connection(this, subscription);
}
return connection;
}
}
public IDisposable Subscribe(IObserver<T> observer)
{
return subject.Subscribe(observer);
}
class Connection : IDisposable
{
readonly ConnectableObservable<T> parent;
IDisposable subscription;
public Connection(ConnectableObservable<T> parent, IDisposable subscription)
{
this.parent = parent;
this.subscription = subscription;
}
public void Dispose()
{
lock (parent.gate)
{
if (subscription != null)
{
subscription.Dispose();
subscription = null;
parent.connection = null;
}
}
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace UniRx
{
public interface IConnectableObservable<T> : IObservable<T>
{
IDisposable Connect();
}
public static partial class Observable
{
class ConnectableObservable<T> : IConnectableObservable<T>
{
readonly IObservable<T> source;
readonly ISubject<T> subject;
public ConnectableObservable(IObservable<T> source, ISubject<T> subject)
{
this.source = source;
this.subject = subject;
}
public IDisposable Connect()
{
var subscription = source.Subscribe(subject);
return subscription;
}
public IDisposable Subscribe(IObserver<T> observer)
{
return subject.Subscribe(observer);
}
}
}
}
|
mit
|
C#
|
12f80ad0a4979acd78e7c1ed2e00b1e3d100327f
|
Change equality
|
Michael-Gungaram/StringBuilder
|
FirstSolution/IntechCode/IntechCollection/MyHashSet.cs
|
FirstSolution/IntechCode/IntechCollection/MyHashSet.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace IntechCode.IntechCollection
{
public class MyHashSet<T> : IMyHashSet<T>
{
T[] _items;
int _count;
const int DefaultCapacity = 16;
public MyHashSet()
{
_count = 0;
_items = new T[DefaultCapacity];
}
public int Count => _count;
public bool Add(T item)
{
if( Contains( item ) ) return false;
if( _count == _items.Length )
{
T[] newItems = new T[ _items.Length * 2 ];
Array.Copy( _items, 0, newItems, 0, _count );
_items = newItems;
}
else
{
_items[ _count ] = item;
}
++_count;
return true;
}
public void Clear()
{
throw new NotImplementedException();
}
public bool Remove(T item)
{
if( !Contains( item ) ) return false;
Array.Copy( _items, _count + 1, _items, _count, _count - _count - 1 );
_items[ --_count ] = default( T );
return true;
}
public bool Contains(T item)
{
if( item == null ) throw new ArgumentNullException();
int itemIndex = FindItem( item );
if( itemIndex >= 0 ) return true;
return false;
}
private int FindItem(T item)
{
int i = 0;
while( i < _items.Length )
{
if( item.Equals( _items[ i ] ) ) return i;
i++;
}
return -1;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace IntechCode.IntechCollection
{
public class MyHashSet<T> : IMyHashSet<T>
{
T[] _items;
int _count;
const int DefaultCapacity = 16;
public MyHashSet()
{
_count = 0;
_items = new T[DefaultCapacity];
}
public int Count => _count;
public bool Add(T item)
{
if( Contains( item ) ) return false;
if( _count == _items.Length )
{
T[] newItems = new T[ _items.Length * 2 ];
Array.Copy( _items, 0, newItems, 0, _count );
_items = newItems;
}
else
{
_items[ _count ] = item;
}
++_count;
return true;
}
public void Clear()
{
throw new NotImplementedException();
}
public bool Remove(T item)
{
if( !Contains( item ) ) return false;
Array.Copy( _items, _count + 1, _items, _count, _count - _count - 1 );
_items[ --_count ] = default( T );
return true;
}
public bool Contains(T item)
{
if( item == null ) throw new ArgumentNullException();
int itemIndex = FindItem( item );
if( itemIndex >= 0 ) return true;
return false;
}
private int FindItem(T item)
{
int i = 0;
while( i <= _items.Length )
{
if( item.Equals( _items[ i ] ) ) return i;
i++;
}
return -1;
}
}
}
|
mit
|
C#
|
d2c0cc41366d6e3eb1d3f6d398fb303454073c58
|
Rename ActionItemSubMenu.Id to ID to be consistent
|
l8s/Eto,l8s/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,l8s/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,PowerOfCode/Eto
|
Source/Eto/Forms/Actions/ActionItem.cs
|
Source/Eto/Forms/Actions/ActionItem.cs
|
using System;
using System.Collections;
namespace Eto.Forms
{
public partial interface IActionItem
{
void Generate(ToolBar toolBar);
int Order { get; }
}
public abstract partial class ActionItemBase : IActionItem
{
int order = 500;
public abstract void Generate(ToolBar toolBar);
public int Order
{
get { return order; }
set { order = value; }
}
public string ToolBarItemStyle { get; set; }
public string MenuItemStyle { get; set; }
}
public partial class ActionItemSeparator : ActionItemBase
{
public SeparatorToolBarItemType ToolBarType { get; set; }
public override void Generate(ToolBar toolBar)
{
var tbb = new SeparatorToolBarItem(toolBar.Generator) { Type = this.ToolBarType };
if (!string.IsNullOrEmpty (ToolBarItemStyle))
tbb.Style = ToolBarItemStyle;
toolBar.Items.Add(tbb);
}
}
public partial class ActionItemSubMenu : ActionItemBase
{
public ActionItemSubMenu(ActionCollection actions, string subMenuText)
{
this.Actions = new ActionItemCollection(actions);
this.SubMenuText = subMenuText;
}
public string Icon { get; set; }
public string ID { get; set; }
public string SubMenuText { get; set; }
public ActionItemCollection Actions { get; private set; }
public override void Generate(ToolBar toolBar)
{
}
}
public partial class ActionItem : ActionItemBase
{
public ActionItem(BaseAction action) : this(action, false)
{
}
public ActionItem(BaseAction action, bool showLabel)
{
if (action == null) throw new ArgumentNullException("action", "Action cannot be null for an action item");
this.Action = action;
this.ShowLabel = showLabel;
}
public BaseAction Action { get; set; }
public bool ShowLabel { get; set; }
public override void Generate(ToolBar toolBar)
{
var item = Action.Generate(this, toolBar);
if (item != null) {
if (!string.IsNullOrEmpty (ToolBarItemStyle))
item.Style = ToolBarItemStyle;
toolBar.Items.Add (item);
}
}
}
}
|
using System;
using System.Collections;
namespace Eto.Forms
{
public partial interface IActionItem
{
void Generate(ToolBar toolBar);
int Order { get; }
}
public abstract partial class ActionItemBase : IActionItem
{
int order = 500;
public abstract void Generate(ToolBar toolBar);
public int Order
{
get { return order; }
set { order = value; }
}
public string ToolBarItemStyle { get; set; }
public string MenuItemStyle { get; set; }
}
public partial class ActionItemSeparator : ActionItemBase
{
public SeparatorToolBarItemType ToolBarType { get; set; }
public override void Generate(ToolBar toolBar)
{
var tbb = new SeparatorToolBarItem(toolBar.Generator) { Type = this.ToolBarType };
if (!string.IsNullOrEmpty (ToolBarItemStyle))
tbb.Style = ToolBarItemStyle;
toolBar.Items.Add(tbb);
}
}
public partial class ActionItemSubMenu : ActionItemBase
{
public ActionItemSubMenu(ActionCollection actions, string subMenuText)
{
this.Actions = new ActionItemCollection(actions);
this.SubMenuText = subMenuText;
}
public string Icon { get; set; }
public string Id { get; set; }
public string SubMenuText { get; set; }
public ActionItemCollection Actions { get; private set; }
public override void Generate(ToolBar toolBar)
{
}
}
public partial class ActionItem : ActionItemBase
{
public ActionItem(BaseAction action) : this(action, false)
{
}
public ActionItem(BaseAction action, bool showLabel)
{
if (action == null) throw new ArgumentNullException("action", "Action cannot be null for an action item");
this.Action = action;
this.ShowLabel = showLabel;
}
public BaseAction Action { get; set; }
public bool ShowLabel { get; set; }
public override void Generate(ToolBar toolBar)
{
var item = Action.Generate(this, toolBar);
if (item != null) {
if (!string.IsNullOrEmpty (ToolBarItemStyle))
item.Style = ToolBarItemStyle;
toolBar.Items.Add (item);
}
}
}
}
|
bsd-3-clause
|
C#
|
a81601b7ccd98a010326114168f8c8d4f82a2745
|
Change text style for project status in project details.
|
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
|
src/CompetitionPlatform/Views/Project/ProjectDetailsStatusPartial.cshtml
|
src/CompetitionPlatform/Views/Project/ProjectDetailsStatusPartial.cshtml
|
@using System.Threading.Tasks
@model CompetitionPlatform.Models.ProjectViewModels.ProjectDetailsStatusViewModel
@if (Model.Status == Status.Initiative)
{
<div>
<p class="project-voting-text text-muted">Cast your vote for or against the competition. Do you think this is the project that Lykke City needs?</p>
<div class="project-voting-buttons">
<button id="voteForButton" class="btn btn-sm btn-primary alert-success">
<span class="glyphicon glyphicon-thumbs-up"></span>
</button>
<button id="voteAgainstButton" class="btn btn-sm btn-primary alert-danger">
<span class="glyphicon glyphicon-thumbs-down"></span>
</button>
<input asp-for="@Model.ProjectId" type="hidden" />
<p class="inline">@(Model.VotesFor + Model.VotesAgainst) Votes</p>
<div id="projectVoteResults" class="project-details-voting-bars">
</div>
</div>
</div>
}
@if (Model.Status == Status.CompetitionRegistration)
{
<div>
<p class="project-voting-text text-muted">To participate in the contest with the prize, you must be registered in the competition. Registration can be completed any time.</p>
<a asp-area="" asp-controller="ProjectDetails" asp-action="AddParticipant" asp-route-id="@Model.ProjectId" type="button" class="btn btn-primary project-details-status-button">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span> Participate
</a>
</div>
}
@if (Model.Status == Status.Implementation)
{
<p class="project-voting-text text-muted">The contest began. You can no longer participate, but will be able to evaluate the results of the competition after @Model.ImplementationDeadline.ToString("MMMM d").</p>
}
@if (Model.Status == Status.Voting)
{
<div>
<p class="project-voting-text text-muted">The contest is finished You can help us determine the winners. Voting ends on @Model.VotingDeadline.ToString("MMMM d").</p>
<button class="btn btn-primary project-details-status-button">
<span class="glyphicon glyphicon-ok-circle" aria-hidden="true"></span> Vote/Test
</button>
</div>
}
@if (Model.Status == Status.Archive)
{
<div>
<p class="project-voting-text text-muted">The competition and voting have completed. Winners were determined by the citizens of Lykke City.</p>
</div>
}
|
@using System.Threading.Tasks
@model CompetitionPlatform.Models.ProjectViewModels.ProjectDetailsStatusViewModel
@if (Model.Status == Status.Initiative)
{
<div>
<p class="project-voting-text text-muted">Cast your vote for or against the competition. Do you think this is the project that Lykke City needs?</p>
<div class="project-voting-buttons">
<button id="voteForButton" class="btn btn-sm btn-primary alert-success">
<span class="glyphicon glyphicon-thumbs-up"></span>
</button>
<button id="voteAgainstButton" class="btn btn-sm btn-primary alert-danger">
<span class="glyphicon glyphicon-thumbs-down"></span>
</button>
<input asp-for="@Model.ProjectId" type="hidden" />
<p class="inline">@(Model.VotesFor + Model.VotesAgainst) Votes</p>
<div id="projectVoteResults" class="project-details-voting-bars">
</div>
</div>
</div>
}
@if (Model.Status == Status.CompetitionRegistration)
{
<div>
<p class="project-voting-text text-muted">To participate in the contest with the prize, you must be registered in the competition. Registration can be completed any time.</p>
<a asp-area="" asp-controller="ProjectDetails" asp-action="AddParticipant" asp-route-id="@Model.ProjectId" type="button" class="btn btn-primary project-details-status-button">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span> Participate
</a>
</div>
}
@if (Model.Status == Status.Implementation)
{
<p class="project-voting-text">The contest began. You can no longer participate, but will be able to evaluate the results of the competition after @Model.ImplementationDeadline.ToString("MMMM d").</p>
}
@if (Model.Status == Status.Voting)
{
<div>
<p class="project-voting-text">The contest is finished You can help us determine the winners. Voting ends on @Model.VotingDeadline.ToString("MMMM d").</p>
<button class="btn btn-primary project-details-status-button">
<span class="glyphicon glyphicon-ok-circle" aria-hidden="true"></span> Vote/Test
</button>
</div>
}
@if (Model.Status == Status.Archive)
{
<div>
<p class="project-voting-text">The competition and voting have completed. Winners were determined by the citizens of Lykke City.</p>
</div>
}
|
mit
|
C#
|
64fb465d932b21ace0fe14846fb9205a01c1774d
|
Update Program.cs
|
adel-qod/flying-monkey-retrieval
|
IR/Program.cs
|
IR/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Collections;
using System.IO;
namespace IR
{
class Program
{
static void Main(string[] args)
{
// Debug by default sends to the Output message (below ..) so redirect it to Console
Debug.Listeners.Clear();
Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
String path = @"C:\Users\Adel\Documents\Visual Studio 2010\Projects\IR\IR\Tests";
VectorModeler mySystem = new VectorModeler(path);
DocumentDistance[] docs = mySystem.GetRelevantDocuments("do i do", threshold: 1, useVectorDistance: true);
if (docs == null)
{
Console.WriteLine("Hey! what kind of query is that?");
System.Environment.Exit(0);
}
for (int i = 0; i < docs.Length; i++)
{
Console.WriteLine(docs[i].docName);
Console.WriteLine(String.Format("{0:0.0######}", docs[i].distance));
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Collections;
using System.IO;
namespace IR
{
class Program
{
static void Main(string[] args)
{
// Debug by default sends to the Output message (below ..) so redirect it to Console
Debug.Listeners.Clear();
Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
String path = @"C:\Users\Adel\Documents\Visual Studio 2010\Projects\IR\IR\Sarah's test";
VectorModeler mySystem = new VectorModeler(path);
DocumentDistance[] docs = mySystem.GetRelevantDocuments("sadadasqr", threshold: 1, useVectorDistance: true);
if (docs == null)
{
Console.WriteLine("Hey! what kind of query is that?");
System.Environment.Exit(0);
}
for (int i = 0; i < docs.Length; i++)
{
Console.WriteLine(docs[i].docName);
Console.WriteLine(String.Format("{0:0.0######}", docs[i].distance));
}
}
}
}
|
bsd-2-clause
|
C#
|
eb33d26fffe85f1cefa0bc976831eae93a9ddabc
|
Add OverrideReceiver to AkkaReceiverNotificationChannel.
|
SaladbowlCreative/Akka.Interfaced,SaladLab/Akka.Interfaced,SaladLab/Akka.Interfaced,SaladbowlCreative/Akka.Interfaced
|
core/Akka.Interfaced/AkkaReceiverNotificationChannel.cs
|
core/Akka.Interfaced/AkkaReceiverNotificationChannel.cs
|
using Akka.Actor;
namespace Akka.Interfaced
{
public class AkkaReceiverNotificationChannel : INotificationChannel
{
public ICanTell Receiver { get; private set; }
private int _lastNotificationId;
public AkkaReceiverNotificationChannel(ICanTell receiver)
{
Receiver = receiver;
}
public void Notify(NotificationMessage notificationMessage)
{
var notificationId = ++_lastNotificationId;
if (notificationId <= 0)
notificationId = _lastNotificationId = 1;
notificationMessage.NotificationId = notificationId;
var sender = ActorCell.GetCurrentSelfOrNoSender();
Receiver.Tell(notificationMessage, sender);
}
public override bool Equals(object obj)
{
var c = obj as AkkaReceiverNotificationChannel;
if (c == null)
return false;
return Receiver.Equals(c.Receiver);
}
public override int GetHashCode()
{
return Receiver.GetHashCode();
}
public static bool OverrideReceiver(INotificationChannel channel, ICanTell receiver)
{
var akkaChannel = channel as AkkaReceiverNotificationChannel;
if (akkaChannel != null)
{
akkaChannel.Receiver = receiver;
return true;
}
else
{
return false;
}
}
}
}
|
using Akka.Actor;
namespace Akka.Interfaced
{
public class AkkaReceiverNotificationChannel : INotificationChannel
{
public ICanTell Receiver { get; }
private int _lastNotificationId;
public AkkaReceiverNotificationChannel(ICanTell receiver)
{
Receiver = receiver;
}
public void Notify(NotificationMessage notificationMessage)
{
var notificationId = ++_lastNotificationId;
if (notificationId <= 0)
notificationId = _lastNotificationId = 1;
notificationMessage.NotificationId = notificationId;
var sender = ActorCell.GetCurrentSelfOrNoSender();
Receiver.Tell(notificationMessage, sender);
}
public override bool Equals(object obj)
{
var c = obj as AkkaReceiverNotificationChannel;
if (c == null)
return false;
return Receiver.Equals(c.Receiver);
}
public override int GetHashCode()
{
return Receiver.GetHashCode();
}
}
}
|
mit
|
C#
|
fd321109da8f9f621c7ae5b0e3dfb974154a1fc6
|
Remove unnecessary `virtual` specification on `Refresh`
|
NeoAdonis/osu,peppy/osu,peppy/osu,ppy/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu
|
osu.Game/Database/DatabaseBackedStore.cs
|
osu.Game/Database/DatabaseBackedStore.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Platform;
namespace osu.Game.Database
{
public abstract class DatabaseBackedStore
{
protected readonly Storage Storage;
protected readonly IDatabaseContextFactory ContextFactory;
/// <summary>
/// Refresh an instance potentially from a different thread with a local context-tracked instance.
/// </summary>
/// <param name="obj">The object to use as a reference when negotiating a local instance.</param>
/// <param name="lookupSource">An optional lookup source which will be used to query and populate a freshly retrieved replacement. If not provided, the refreshed object will still be returned but will not have any includes.</param>
/// <typeparam name="T">A valid EF-stored type.</typeparam>
protected void Refresh<T>(ref T obj, IQueryable<T> lookupSource = null) where T : class, IHasPrimaryKey
{
using (var usage = ContextFactory.GetForWrite())
{
var context = usage.Context;
if (context.Entry(obj).State != EntityState.Detached) return;
int id = obj.ID;
var foundObject = lookupSource?.SingleOrDefault(t => t.ID == id) ?? context.Find<T>(id);
if (foundObject != null)
obj = foundObject;
else
context.Add(obj);
}
}
protected DatabaseBackedStore(IDatabaseContextFactory contextFactory, Storage storage = null)
{
ContextFactory = contextFactory;
Storage = storage;
}
/// <summary>
/// Perform any common clean-up tasks. Should be run when idle, or whenever necessary.
/// </summary>
public virtual void Cleanup()
{
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Platform;
namespace osu.Game.Database
{
public abstract class DatabaseBackedStore
{
protected readonly Storage Storage;
protected readonly IDatabaseContextFactory ContextFactory;
/// <summary>
/// Refresh an instance potentially from a different thread with a local context-tracked instance.
/// </summary>
/// <param name="obj">The object to use as a reference when negotiating a local instance.</param>
/// <param name="lookupSource">An optional lookup source which will be used to query and populate a freshly retrieved replacement. If not provided, the refreshed object will still be returned but will not have any includes.</param>
/// <typeparam name="T">A valid EF-stored type.</typeparam>
protected virtual void Refresh<T>(ref T obj, IQueryable<T> lookupSource = null) where T : class, IHasPrimaryKey
{
using (var usage = ContextFactory.GetForWrite())
{
var context = usage.Context;
if (context.Entry(obj).State != EntityState.Detached) return;
int id = obj.ID;
var foundObject = lookupSource?.SingleOrDefault(t => t.ID == id) ?? context.Find<T>(id);
if (foundObject != null)
obj = foundObject;
else
context.Add(obj);
}
}
protected DatabaseBackedStore(IDatabaseContextFactory contextFactory, Storage storage = null)
{
ContextFactory = contextFactory;
Storage = storage;
}
/// <summary>
/// Perform any common clean-up tasks. Should be run when idle, or whenever necessary.
/// </summary>
public virtual void Cleanup()
{
}
}
}
|
mit
|
C#
|
a47ebca8ce63ff32b42dcb59b7f26f812825cd6b
|
Add administrator user by default
|
denismaster/dcs,denismaster/dcs,denismaster/dcs,denismaster/dcs
|
src/Diploms.DataLayer/DiplomContextExtensions.cs
|
src/Diploms.DataLayer/DiplomContextExtensions.cs
|
using System;
using System.Linq;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Diploms.Core;
using System.Collections.Generic;
namespace Diploms.DataLayer
{
public static class DiplomContentSystemExtensions
{
public static void EnsureSeedData(this DiplomContext context)
{
if (context.AllMigrationsApplied())
{
if (!context.Roles.Any())
{
context.Roles.AddRange(Role.Admin, Role.Owner, Role.Student, Role.Teacher);
context.SaveChanges();
}
if(!context.Users.Any())
{
context.Users.Add(new User{
Id = 1,
Login = "admin",
PasswordHash = @"WgHWgYQpzkpETS0VemCGE15u2LNPjTbtocMdxtqLll8=",
Roles = new List<UserRole>
{
new UserRole
{
UserId = 1,
RoleId = 1
}
}
});
}
}
}
private static bool AllMigrationsApplied(this DiplomContext context)
{
var applied = context.GetService<IHistoryRepository>()
.GetAppliedMigrations()
.Select(m => m.MigrationId);
var total = context.GetService<IMigrationsAssembly>()
.Migrations
.Select(m => m.Key);
return !total.Except(applied).Any();
}
}
}
|
using System.Linq;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Diploms.Core;
namespace Diploms.DataLayer
{
public static class DiplomContentSystemExtensions
{
public static void EnsureSeedData(this DiplomContext context)
{
if (context.AllMigrationsApplied())
{
if (!context.Roles.Any())
{
context.Roles.AddRange(Role.Admin, Role.Owner, Role.Student, Role.Teacher);
context.SaveChanges();
}
}
}
private static bool AllMigrationsApplied(this DiplomContext context)
{
var applied = context.GetService<IHistoryRepository>()
.GetAppliedMigrations()
.Select(m => m.MigrationId);
var total = context.GetService<IMigrationsAssembly>()
.Migrations
.Select(m => m.Key);
return !total.Except(applied).Any();
}
}
}
|
mit
|
C#
|
6aacfa87f46032367bab956126b8fd35187b5a0b
|
Add some doc to IoC
|
cH40z-Lord/Stylet,canton7/Stylet,cH40z-Lord/Stylet,canton7/Stylet
|
Stylet/IoC.cs
|
Stylet/IoC.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Stylet
{
/// <summary>
/// A lightweight wrapper around the IoC container of your choice. Configured in the bootstrapper
/// </summary>
public static class IoC
{
/// <summary>
/// Assign this to a func which can get a single instance of a service, with a given key
/// </summary>
public static Func<Type, string, object> GetInstance = (service, key) => { throw new InvalidOperationException("IoC is not initialized"); };
/// <summary>
/// Assign this to a func which can get an IEnumerable of all instances of a service
/// </summary>
public static Func<Type, IEnumerable<object>> GetAllInstances = service => { throw new InvalidOperationException("IoC is not initialized"); };
/// <summary>
/// Assign this to a fun which can build up a given object
/// </summary>
public static Action<object> BuildUp = instance => { throw new InvalidOperationException("IoC is not initialized"); };
/// <summary>
/// Wraps GetInstance, adding typing
/// </summary>
public static T Get<T>(string key = null)
{
return (T)GetInstance(typeof(T), key);
}
/// <summary>
/// Wraps GetAllInstances, adding typing
/// </summary>
public static IEnumerable<T> GetAll<T>()
{
return GetAllInstances(typeof(T)).Cast<T>();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Stylet
{
public static class IoC
{
public static Func<Type, string, object> GetInstance = (service, key) => { throw new InvalidOperationException("IoC is not initialized"); };
public static Func<Type, IEnumerable<object>> GetAllInstances = service => { throw new InvalidOperationException("IoC is not initialized"); };
public static Action<object> BuildUp = instance => { throw new InvalidOperationException("IoC is not initialized"); };
public static T Get<T>(string key = null)
{
return (T)GetInstance(typeof(T), key);
}
public static IEnumerable<T> GetAll<T>()
{
return GetAllInstances(typeof(T)).Cast<T>();
}
}
}
|
mit
|
C#
|
4480b817a7d1b9579af9c9b8f1f50a20b81f277e
|
Fix popups
|
danielchalmers/SteamAccountSwitcher
|
SteamAccountSwitcher/Popup.cs
|
SteamAccountSwitcher/Popup.cs
|
#region
using System.Windows;
using SteamAccountSwitcher.Properties;
#endregion
namespace SteamAccountSwitcher
{
internal static class Popup
{
public static MessageBoxResult Show(string text, MessageBoxButton button = MessageBoxButton.OK,
MessageBoxImage image = MessageBoxImage.Information, MessageBoxResult defaultButton = MessageBoxResult.OK)
{
try
{
return MessageBox.Show(text, Resources.AppName, button, image, defaultButton);
}
catch
{
return MessageBoxResult.Cancel;
}
}
}
}
|
#region
using System.Windows;
using SteamAccountSwitcher.Properties;
#endregion
namespace SteamAccountSwitcher
{
internal static class Popup
{
public static MessageBoxResult Show(string text, MessageBoxButton button = MessageBoxButton.OK,
MessageBoxImage image = MessageBoxImage.Information, MessageBoxResult defaultButton = MessageBoxResult.OK)
{
try
{
return MessageBox.Show(App.SwitchWindow, text, Resources.AppName, button, image, defaultButton);
}
catch
{
return MessageBoxResult.Cancel;
}
}
}
}
|
mit
|
C#
|
ab5074b702b2cf505ac3e24f8beffaaba44ee31d
|
Increase size 10 times for MTOM
|
teerachail/SoapWithAttachments
|
WebsiteForSpike/MtomTestSite/Service1.svc.cs
|
WebsiteForSpike/MtomTestSite/Service1.svc.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace MtomTestSite
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public string GetDataLen(string name, byte[] data)
{
return string.Format("{0}: {1}", name, data.Length);
}
public string GetDataLenStream(Stream data)
{
byte[] buffer = new byte[2048];
var n = data.Read(buffer, 0, buffer.Length);
return string.Format("Data Length: {0}", n);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
public MyMtomData GetMyMtomData()
{
return new MtomTestSite.MyMtomData
{
Name = string.Format("My Mtom Data @{0}", DateTime.Now),
File1 = new byte[21500],
File2 = new byte[128009],
};
}
public MyMtomData RoundTripMyMtomData(MyMtomData data)
{
data.Name = string.Format("Received: {0}", data.Name);
return data;
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace MtomTestSite
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public string GetDataLen(string name, byte[] data)
{
return string.Format("{0}: {1}", name, data.Length);
}
public string GetDataLenStream(Stream data)
{
byte[] buffer = new byte[2048];
var n = data.Read(buffer, 0, buffer.Length);
return string.Format("Data Length: {0}", n);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
public MyMtomData GetMyMtomData()
{
return new MtomTestSite.MyMtomData
{
Name = string.Format("My Mtom Data @{0}", DateTime.Now),
File1 = new byte[21500],
File2 = new byte[12800],
};
}
public MyMtomData RoundTripMyMtomData(MyMtomData data)
{
data.Name = string.Format("Received: {0}", data.Name);
return data;
}
}
}
|
mit
|
C#
|
cc73cda469d5b9f58e028f6dcf35eda67d4c9a7d
|
Refactor DownloadZip in terms of Download
|
weblinq/WebLinq,atifaziz/WebLinq,atifaziz/WebLinq,weblinq/WebLinq
|
src/Core/Zip/ZipQuery.cs
|
src/Core/Zip/ZipQuery.cs
|
#region Copyright (c) 2016 Atif Aziz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
namespace WebLinq.Zip
{
using System;
using System.Net.Http;
using System.Reactive.Linq;
public static class ZipQuery
{
[Obsolete("Use " + nameof(HttpObservable.Download)
+ " or " + nameof(HttpObservable.DownloadTemp)
+ " with " + nameof(AsZip) + " instead.")]
public static IObservable<HttpFetch<Zip>> DownloadZip(this IHttpObservable query) =>
query.DownloadTemp("zip").AsZip();
[Obsolete("Use " + nameof(HttpObservable.Download)
+ " or " + nameof(HttpObservable.DownloadTemp)
+ " with " + nameof(AsZip) + " instead.")]
public static IObservable<HttpFetch<Zip>> DownloadZip(this IObservable<HttpFetch<HttpContent>> query) =>
from fetch in query.DownloadTemp("zip")
select fetch.WithContent(new Zip(fetch.Content.Path));
public static IObservable<HttpFetch<Zip>> AsZip(this IObservable<HttpFetch<LocalFileContent>> query) =>
from fetch in query
select fetch.WithContent(new Zip(fetch.Content.Path));
}
}
|
#region Copyright (c) 2016 Atif Aziz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
namespace WebLinq.Zip
{
using System;
using System.IO;
using System.Net.Http;
using System.Reactive.Linq;
using System.Threading.Tasks;
public static class ZipQuery
{
public static IObservable<HttpFetch<Zip>> DownloadZip(this IHttpObservable query) =>
from fetch in query.WithReader(f => DownloadZip(f.Content))
select fetch.WithContent(new Zip(fetch.Content));
public static IObservable<HttpFetch<Zip>> DownloadZip(this IObservable<HttpFetch<HttpContent>> query) =>
from fetch in query
from path in DownloadZip(fetch.Content)
select fetch.WithContent(new Zip(path));
static async Task<string> DownloadZip(HttpContent content)
{
var path = Path.GetTempFileName();
using (var output = File.Create(path))
await content.CopyToAsync(output).DontContinueOnCapturedContext();
return path;
}
}
}
|
apache-2.0
|
C#
|
3e51f3489d4bd1de8bf68e3ada1d8fe28b1f28d3
|
remove unused example
|
KevM/Reactive.Config
|
src/Reactive.Config/IConfigured.cs
|
src/Reactive.Config/IConfigured.cs
|
namespace Reactive.Config
{
public interface IConfigured {}
}
|
using System;
namespace Reactive.Config
{
public interface IConfigured {}
public class MyExampleConfiguration : IConfigured {
public bool IsEnabled { get;set;} = false;
public DateTime EnabledOn { get;set;} = new DateTime(2017, 1, 1, 10, 30, 0);
public string ShutoffMessage { get;set;} = "Sorry this feature has been disabled";
}
}
|
mit
|
C#
|
68d6e8c138c5d0b81f3d592dc6f335d2485fc40e
|
Use full path to source folder
|
davidebbo/WAWSDeploy,davidebbo/WAWSDeploy
|
WAWSDeploy/WebDeployHelper.cs
|
WAWSDeploy/WebDeployHelper.cs
|
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.Web.Deployment;
namespace WAWSDeploy
{
public class WebDeployHelper
{
public DeploymentChangeSummary DeployContentToOneSite(string contentPath, string publishSettingsFile)
{
contentPath = Path.GetFullPath(contentPath);
var sourceBaseOptions = new DeploymentBaseOptions();
DeploymentBaseOptions destBaseOptions;
string siteName = ParsePublishSettings(publishSettingsFile, out destBaseOptions);
Trace.TraceInformation("Starting WebDeploy for {0}", Path.GetFileName(publishSettingsFile));
// Publish the content to the remote site
using (var deploymentObject = DeploymentManager.CreateObject(DeploymentWellKnownProvider.ContentPath, contentPath, sourceBaseOptions))
{
// Note: would be nice to have an async flavor of this API...
return deploymentObject.SyncTo(DeploymentWellKnownProvider.ContentPath, siteName, destBaseOptions, new DeploymentSyncOptions());
}
}
private string ParsePublishSettings(string path, out DeploymentBaseOptions deploymentBaseOptions)
{
var document = XDocument.Load(path);
var profile = document.Descendants("publishProfile").First();
string siteName = profile.Attribute("msdeploySite").Value;
deploymentBaseOptions = new DeploymentBaseOptions
{
ComputerName = String.Format("https://{0}/msdeploy.axd?site={1}", profile.Attribute("publishUrl").Value, siteName),
UserName = profile.Attribute("userName").Value,
Password = profile.Attribute("userPWD").Value,
AuthenticationType = "Basic"
};
return siteName;
}
}
}
|
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.Web.Deployment;
namespace WAWSDeploy
{
public class WebDeployHelper
{
public DeploymentChangeSummary DeployContentToOneSite(string contentPath, string publishSettingsFile)
{
var sourceBaseOptions = new DeploymentBaseOptions();
DeploymentBaseOptions destBaseOptions;
string siteName = ParsePublishSettings(publishSettingsFile, out destBaseOptions);
Trace.TraceInformation("Starting WebDeploy for {0}", Path.GetFileName(publishSettingsFile));
// Publish the content to the remote site
using (var deploymentObject = DeploymentManager.CreateObject(DeploymentWellKnownProvider.ContentPath, contentPath, sourceBaseOptions))
{
// Note: would be nice to have an async flavor of this API...
return deploymentObject.SyncTo(DeploymentWellKnownProvider.ContentPath, siteName, destBaseOptions, new DeploymentSyncOptions());
}
}
private string ParsePublishSettings(string path, out DeploymentBaseOptions deploymentBaseOptions)
{
var document = XDocument.Load(path);
var profile = document.Descendants("publishProfile").First();
string siteName = profile.Attribute("msdeploySite").Value;
deploymentBaseOptions = new DeploymentBaseOptions
{
ComputerName = String.Format("https://{0}/msdeploy.axd?site={1}", profile.Attribute("publishUrl").Value, siteName),
UserName = profile.Attribute("userName").Value,
Password = profile.Attribute("userPWD").Value,
AuthenticationType = "Basic"
};
return siteName;
}
}
}
|
apache-2.0
|
C#
|
dd8da6a59acf3a05530c14524f1a9aff88f6b83d
|
Make it TryFind
|
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.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> 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;
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);
reportPercentage.Invoke(percentage);
}
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.Linq;
using System.Security;
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 string? Find(Wallet wallet, string language, bool useNumbers, bool useSymbols, string likelyPassword, Action<int> reportPercentage)
{
BitcoinEncryptedSecretNoEC encryptedSecret = wallet.KeyManager.EncryptedSecret;
var charset = Charsets[language] + (useNumbers ? "0123456789" : "") + (useSymbols ? "|!¡@$¿?_-\"#$/%&()´+*=[]{},;:.^`<>" : "");
var found = false;
var lastpwd = "";
var attempts = 0;
var maxNumberAttempts = likelyPassword.Length * charset.Length;
foreach (var pwd in GeneratePasswords(likelyPassword, charset.ToArray()))
{
lastpwd = pwd;
try
{
encryptedSecret.GetKey(pwd);
found = true;
break;
}
catch (SecurityException)
{
}
attempts++;
var percentage = (int)((float)attempts / maxNumberAttempts * 100);
reportPercentage.Invoke(percentage);
}
return found ? lastpwd : null;
}
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#
|
b8678b64594b3c77a2c5948c0a9b8d2c8e52289e
|
Update InputToController.cs
|
fqlx/XboxKeyboardMouse
|
XboxKeyboardMouse/InputToController.cs
|
XboxKeyboardMouse/InputToController.cs
|
using ScpDriverInterface;
using System;
using System.Windows.Forms;
namespace XboxKeyboardMouse
{
class InputToController
{
const int CONTROLLER_NUMBER = 1;
static ScpBus scpbus = null;
public static void ActivateKeyboardAndMouse()
{
X360Controller controller = new X360Controller();
byte[] report = controller.GetReport();
byte[] output = new byte[8];
try
{
scpbus = new ScpBus();
}
catch (Exception ex)
{
MessageBox.Show("SCP Bus failed to initialize");
MessageBox.Show(ex.ToString());
}
scpbus.PlugIn(1);
while(true)
{
TranslateInput.TranslateInput(controller);
report = controller.GetReport();
bool ret = scpbus.Report(CONTROLLER_NUMBER, report, output);
}
}
public static void OnProcessExit(object sender, EventArgs e)
{
scpbus.Unplug(CONTROLLER_NUMBER);
Application.ExitThread();
}
}
}
|
using ScpDriverInterface;
using System;
using System.Windows.Forms;
namespace XboxKeyboardMouse
{
class InputToController
{
const int CONTROLLER_NUMBER = 1;
static ScpBus scpbus = null;
public static void ActivateKeyboardAndMouse()
{
X360Controller controller = new X360Controller();
byte[] report = controller.GetReport();
byte[] output = new byte[8];
try
{
scpbus = new ScpBus();
}
catch (Exception ex)
{
MessageBox.Show("SCP Bus failed to initialize");
MessageBox.Show(ex.ToString());
}
scpbus.PlugIn(1);
while(true)
{
TranslateInput.translateInput(controller);
report = controller.GetReport();
bool ret = scpbus.Report(CONTROLLER_NUMBER, report, output);
}
}
public static void OnProcessExit(object sender, EventArgs e)
{
scpbus.Unplug(CONTROLLER_NUMBER);
Application.ExitThread();
}
}
}
|
apache-2.0
|
C#
|
336eedc728e3cd8c1391b633886fa1b706469bb7
|
Add comment on how to configure environment variables
|
amoerie/teamcity-theatre,amoerie/teamcity-theatre,amoerie/teamcity-theatre,amoerie/teamcity-theatre,amoerie/teamcity-theatre
|
src/TeamCityTheatre.Web/Program.cs
|
src/TeamCityTheatre.Web/Program.cs
|
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
namespace TeamCityTheatre.Web {
public class Program {
public static void Main(string[] args) {
var environment = Environment();
var configuration = BuildConfiguration(args, environment);
var logger = BuildLogger(configuration);
BuildWebHost(args, configuration, logger).Run();
}
public static IWebHost BuildWebHost(string[] args, IConfiguration configuration, ILogger logger) {
return new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseConfiguration(configuration)
.UseIISIntegration()
.CaptureStartupErrors(true)
.UseSetting(WebHostDefaults.DetailedErrorsKey, "True")
.UseDefaultServiceProvider((context, options) => options.ValidateScopes = context.HostingEnvironment.IsDevelopment())
.ConfigureServices(sc => sc.AddSingleton(logger))
.UseStartup<Startup>()
.UseSerilog(logger, dispose: true)
.Build();
}
static ILogger BuildLogger(IConfiguration configuration) => new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.CreateLogger();
static IConfigurationRoot BuildConfiguration(string[] args, string environment) {
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory());
config.AddJsonFile("appsettings.json", false, true);
// see https://stackoverflow.com/questions/31049152/publish-to-iis-setting-environment-variable
config.AddEnvironmentVariables();
if (args != null) {
config.AddCommandLine(args);
}
return config.Build();
}
static string Environment() => System.Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")
?? EnvironmentName.Production;
}
}
|
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
namespace TeamCityTheatre.Web {
public class Program {
public static void Main(string[] args) {
var environment = Environment();
var configuration = BuildConfiguration(args, environment);
var logger = BuildLogger(configuration);
BuildWebHost(args, configuration, logger).Run();
}
public static IWebHost BuildWebHost(string[] args, IConfiguration configuration, ILogger logger) {
return new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseConfiguration(configuration)
.UseIISIntegration()
.CaptureStartupErrors(true)
.UseSetting(WebHostDefaults.DetailedErrorsKey, "True")
.UseDefaultServiceProvider((context, options) => options.ValidateScopes = context.HostingEnvironment.IsDevelopment())
.ConfigureServices(sc => sc.AddSingleton(logger))
.UseStartup<Startup>()
.UseSerilog(logger, dispose: true)
.Build();
}
static ILogger BuildLogger(IConfiguration configuration) => new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.CreateLogger();
static IConfigurationRoot BuildConfiguration(string[] args, string environment) {
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory());
config.AddJsonFile("appsettings.json", false, true);
config.AddEnvironmentVariables();
if (args != null) {
config.AddCommandLine(args);
}
return config.Build();
}
static string Environment() => System.Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")
?? EnvironmentName.Production;
}
}
|
mit
|
C#
|
4691a0abc889269f83b9efc1b72808bd598df6a1
|
bump version, replace default copyright message
|
mono/ServiceStack.Text,NServiceKit/NServiceKit.Text,gerryhigh/ServiceStack.Text,mono/ServiceStack.Text,gerryhigh/ServiceStack.Text,meebey/ServiceStack.Text,NServiceKit/NServiceKit.Text
|
src/ServiceStack.Text/Properties/AssemblyInfo.cs
|
src/ServiceStack.Text/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("ServiceStack.Text")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ServiceStack.Text")]
[assembly: AssemblyCopyright("Copyright © Liquidbit 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a352d4d3-df2a-4c78-b646-67181a6333a6")]
// 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.5.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ServiceStack.Text")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ServiceStack.Text")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[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("a352d4d3-df2a-4c78-b646-67181a6333a6")]
// 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.4.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
bsd-3-clause
|
C#
|
b9b0215f580c07790ea62ddee259c5bc25222290
|
Remove public constructor for MySqlConversionException.
|
mysql-net/MySqlConnector,mysql-net/MySqlConnector
|
src/MySqlConnector/MySqlConversionException.cs
|
src/MySqlConnector/MySqlConversionException.cs
|
using System;
#if !NETSTANDARD1_3
using System.Runtime.Serialization;
#endif
namespace MySqlConnector
{
/// <summary>
/// <see cref="MySqlConversionException"/> is thrown when a MySQL value can't be converted to another type.
/// </summary>
#if !NETSTANDARD1_3
[Serializable]
#endif
public class MySqlConversionException : Exception
{
/// <summary>
/// Initializes a new instance of <see cref="MySqlConversionException"/>.
/// </summary>
/// <param name="message">The exception message.</param>
internal MySqlConversionException(string message)
: base(message)
{
}
#if !NETSTANDARD1_3
private MySqlConversionException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
}
|
using System;
#if !NETSTANDARD1_3
using System.Runtime.Serialization;
#endif
namespace MySqlConnector
{
/// <summary>
/// <see cref="MySqlConversionException"/> is thrown when a MySQL value can't be converted to another type.
/// </summary>
#if !NETSTANDARD1_3
[Serializable]
#endif
public class MySqlConversionException : Exception
{
/// <summary>
/// Initializes a new instance of <see cref="MySqlConversionException"/>.
/// </summary>
/// <param name="message">The exception message.</param>
public MySqlConversionException(string message)
: base(message)
{
}
#if !NETSTANDARD1_3
private MySqlConversionException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
}
|
mit
|
C#
|
3c56b565066f623ae202257ab442c976a9a42399
|
Update version number to 0.7.1
|
PhannGor/unity3d-rainbow-folders
|
Assets/Plugins/RainbowFolders/Editor/Scripts/Info/AssetInfo.cs
|
Assets/Plugins/RainbowFolders/Editor/Scripts/Info/AssetInfo.cs
|
/*
* 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.
*/
namespace Borodar.RainbowFolders.Editor
{
public class AssetInfo
{
public const string STORE_ID = "50668";
public const string NAME = "Rainbow Folders";
public const string VERSION = "0.7.1";
public const string HELP_URL = "http://www.borodar.com/stuff/rainbowfolders/docs/quickstart_v" + VERSION + ".pdf";
}
}
|
/*
* 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.
*/
namespace Borodar.RainbowFolders.Editor
{
public class AssetInfo
{
public const string STORE_ID = "50668";
public const string NAME = "Rainbow Folders";
public const string VERSION = "0.7";
public const string HELP_URL = "http://www.borodar.com/stuff/rainbowfolders/docs/quickstart_v" + VERSION + ".pdf";
}
}
|
apache-2.0
|
C#
|
40936f9d1120b160beb411e1f5b78c12c672b20f
|
Test program
|
Raimmaster/Compiler
|
Compiler/Program.cs
|
Compiler/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Compiler
{
class Program
{
static void Main(string[] args)
{
var input = @"read a; read b; c = a + b;
d = b*c; print c; print d;";
var inputString = new InputString(input);
var lexer = new Lexer(inputString);
var parser = new Parser(lexer);
var code = parser.Parse();
foreach(var production in code)
{
production.Interpret();
}
System.Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Compiler
{
class Program
{
static void Main(string[] args)
{
var input = @"read a; read b; c = a + b;
d = b*c; print c; print d;";
//var input = @" print(1+2);";
var inputString = new InputString(input);
var lexer = new Lexer(inputString);
var parser = new Parser(lexer);
var code = parser.Parse();
foreach(var production in code)
{
production.Interpret();
}
Console.Out.WriteLine("EXIT!!");
System.Console.ReadKey();
}
}
}
|
mit
|
C#
|
177edfe086cd2734c9a20cb19170ceb3e402496c
|
Bump assembly version
|
Deadpikle/NetSparkle,Deadpikle/NetSparkle
|
AssemblyInfo.cs
|
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("NetSparkle")]
[assembly: AssemblyDescription("NetSparkle is an auto update framework for .NET developers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NetSparkle")]
[assembly: AssemblyCopyright("Portions Copyright © Dirk Eisenberg 2010, Deadpikle 2017")]
[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("279448fc-5103-475e-b209-68f3268df7b5")]
// 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.16.2")]
[assembly: AssemblyFileVersion("0.16.2")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NetSparkle")]
[assembly: AssemblyDescription("NetSparkle is an auto update framework for .NET developers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NetSparkle")]
[assembly: AssemblyCopyright("Portions Copyright © Dirk Eisenberg 2010, Deadpikle 2017")]
[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("279448fc-5103-475e-b209-68f3268df7b5")]
// 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.16.0")]
[assembly: AssemblyFileVersion("0.16.0")]
|
mit
|
C#
|
5c5e8fdb859c25a87a915f26122c523d634363f1
|
Rename for clarity
|
eatdrinksleepcode/casper,eatdrinksleepcode/casper
|
Core/ProjectBase.cs
|
Core/ProjectBase.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Casper
{
public abstract class ProjectBase
{
private readonly TaskCollection tasks;
private readonly ProjectCollection subprojects;
protected readonly ProjectBase parent;
private readonly DirectoryInfo location;
protected ProjectBase(ProjectBase parent, DirectoryInfo location) : this(parent, location, location.Name) {
}
protected ProjectBase(ProjectBase parent, DirectoryInfo location, string name) {
this.parent = parent;
this.location = location;
this.Name = name;
this.PathPrefix = null == parent ? "" : parent.PathPrefix + this.Name + ":";
this.PathDescription = null == parent ? "root project" : "project '" + parent.PathPrefix + this.Name + "'";
this.subprojects = new ProjectCollection(this);
this.tasks = new TaskCollection(this);
if (null != parent) {
parent.subprojects.Add(this);
}
}
public abstract void Configure();
public void AddTask(string name, TaskBase task) {
task.Name = name;
task.Project = this;
tasks.Add(task);
}
public string Name {
get;
private set;
}
private string PathPrefix {
get;
set;
}
public string PathDescription {
get;
private set;
}
public TaskCollection Tasks {
get { return tasks; }
}
public void Execute(TaskBase task) {
var currentDirectory = Directory.GetCurrentDirectory();
try {
Directory.SetCurrentDirectory(location.FullName);
task.Execute();
} finally {
Directory.SetCurrentDirectory(currentDirectory);
}
}
public void ExecuteTasks(IEnumerable<string> taskNamesToExecute) {
var tasksToExecute = taskNamesToExecute.Select(a => this.GetTaskByName(a)).ToArray();
var taskGraphClosure = tasksToExecute.SelectMany(t => t.AllDependencies()).Distinct().ToArray();
Array.Sort(taskGraphClosure, (t1, t2) => t1.AllDependencies().Contains(t2) ? 1 : t2.AllDependencies().Contains(t1) ? -1 : 0);
foreach (var task in taskGraphClosure) {
Console.WriteLine(task.Name + ":");
// HACK: this is awkward
task.Project.Execute(task);
}
}
private TaskBase GetTaskByName(string name) {
string[] path = name.Split(':');
return GetTaskByPath(new Queue<string>(path));
}
private TaskBase GetTaskByPath(Queue<string> path) {
if (path.Count > 1) {
var projectName = path.Dequeue();
return this.subprojects[projectName].GetTaskByPath(path);
} else {
return this.tasks[path.Dequeue()];
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Casper
{
public abstract class ProjectBase
{
private readonly TaskCollection tasks;
private readonly ProjectCollection subprojects;
protected readonly ProjectBase parent;
private readonly DirectoryInfo location;
protected ProjectBase(ProjectBase parent, DirectoryInfo location) : this(parent, location, location.Name) {
}
protected ProjectBase(ProjectBase parent, DirectoryInfo location, string name) {
this.parent = parent;
this.location = location;
this.Name = name;
this.PathPrefix = null == parent ? "" : parent.PathPrefix + this.Name + ":";
this.PathDescription = null == parent ? "root project" : "project '" + parent.PathPrefix + this.Name + "'";
this.subprojects = new ProjectCollection(this);
this.tasks = new TaskCollection(this);
if (null != parent) {
parent.subprojects.Add(this);
}
}
public abstract void Configure();
public void AddTask(string name, TaskBase task) {
task.Name = name;
task.Project = this;
tasks.Add(task);
}
public string Name {
get;
private set;
}
private string PathPrefix {
get;
set;
}
public string PathDescription {
get;
private set;
}
public TaskCollection Tasks {
get { return tasks; }
}
public void Execute(TaskBase task) {
var currentDirectory = Directory.GetCurrentDirectory();
try {
Directory.SetCurrentDirectory(location.FullName);
task.Execute();
} finally {
Directory.SetCurrentDirectory(currentDirectory);
}
}
public void ExecuteTasks(IEnumerable<string> taskNamesToExecute) {
var tasks = taskNamesToExecute.Select(a => this.GetTaskByName(a)).ToArray();
var taskGraphClosure = tasks.SelectMany(t => t.AllDependencies()).Distinct().ToArray();
Array.Sort(taskGraphClosure, (t1, t2) => t1.AllDependencies().Contains(t2) ? 1 : t2.AllDependencies().Contains(t1) ? -1 : 0);
foreach (var task in taskGraphClosure) {
Console.WriteLine(task.Name + ":");
// HACK: this is awkward
task.Project.Execute(task);
}
}
private TaskBase GetTaskByName(string name) {
string[] path = name.Split(':');
return GetTaskByPath(new Queue<string>(path));
}
private TaskBase GetTaskByPath(Queue<string> path) {
if (path.Count > 1) {
var projectName = path.Dequeue();
return this.subprojects[projectName].GetTaskByPath(path);
} else {
return this.tasks[path.Dequeue()];
}
}
}
}
|
mit
|
C#
|
e867ad37caf2f1bea180ee52291adbcaa9e5bd9a
|
Use test cases.
|
JohanLarsson/Gu.Settings,JohanLarsson/Gu.Persist
|
Gu.Persist.Core.Tests/Helpers/RepositoryExt.cs
|
Gu.Persist.Core.Tests/Helpers/RepositoryExt.cs
|
namespace Gu.Persist.Core.Tests
{
using System.Reflection;
using Gu.Persist.Core;
using NUnit.Framework;
public static class RepositoryExt
{
public static FileCache GetCache(this ISingletonRepository repo)
{
if (repo == null)
{
return null;
}
// ReSharper disable once PossibleNullReferenceException
var cacheField = repo.GetType().BaseType.GetField("fileCache", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField);
Assert.NotNull(cacheField);
return (FileCache)cacheField.GetValue(repo);
}
public static void ClearCache(this IRepository repository)
{
var cache = (repository as ISingletonRepository)?.GetCache();
cache?.Clear(); // nUnit does some optimization keeping this alive
}
}
}
|
namespace Gu.Persist.Core.Tests
{
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using Gu.Persist.Core;
using Gu.Persist.Core.Backup;
using NUnit.Framework;
public static class RepositoryExt
{
public static FileInfo GetTestFileInfo(this IRepository repository, [CallerMemberName] string name = null) => repository.GetFileInfo(name);
public static FileInfo GetTestBackupFileInfo(this IRepository repository, [CallerMemberName] string name = null)
{
return repository.Settings.BackupSettings is IBackupSettings backupSettings
? BackupFile.CreateFor(GetTestFileInfo(repository, name), backupSettings)
: null;
}
#pragma warning disable CA1707, SA1313 // Identifiers should not contain underscores
public static FileInfo GetGenericTestFileInfo<T>(this IRepository repository, T _ = default) => repository.GetFileInfo(typeof(T).Name);
#pragma warning restore CA1707, SA1313 // Identifiers should not contain underscores
#pragma warning disable CA1707, SA1313 // Identifiers should not contain underscores
public static FileInfo GetGenericTestBackupFileInfo<T>(this IRepository repository, T _ = default)
#pragma warning restore CA1707, SA1313 // Identifiers should not contain underscores
{
return repository.Settings.BackupSettings is IBackupSettings backupSettings
? BackupFile.CreateFor(GetGenericTestFileInfo<T>(repository), backupSettings)
: null;
}
public static FileCache GetCache(this ISingletonRepository repo)
{
if (repo == null)
{
return null;
}
// ReSharper disable once PossibleNullReferenceException
var cacheField = repo.GetType().BaseType.GetField("fileCache", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField);
Assert.NotNull(cacheField);
return (FileCache)cacheField.GetValue(repo);
}
public static void ClearCache(this IRepository repository)
{
var cache = (repository as ISingletonRepository)?.GetCache();
cache?.Clear(); // nUnit does some optimization keeping this alive
}
}
}
|
mit
|
C#
|
a7cc8b3c3a8b09cef94f7acf4b9b8f28c08ddab8
|
Rename ExpirationMode.ImmediateExpiry => ExpirationMode.ImmediateEviction
|
alastairtree/LazyCache,alastairtree/LazyCache
|
LazyCache/MemoryCacheEntryOptionsExtensions.cs
|
LazyCache/MemoryCacheEntryOptionsExtensions.cs
|
using System;
using Microsoft.Extensions.Caching.Memory;
namespace LazyCache
{
public class LazyCacheEntryOptions : MemoryCacheEntryOptions
{
public ExpirationMode ExpirationMode { get; set; }
public TimeSpan ImmediateAbsoluteExpirationRelativeToNow { get; set; }
public static LazyCacheEntryOptions WithImmediateAbsoluteExpiration(DateTimeOffset absoluteExpiration)
{
var delay = absoluteExpiration.Subtract(DateTimeOffset.UtcNow);
return new LazyCacheEntryOptions
{
AbsoluteExpiration = absoluteExpiration,
ExpirationMode = ExpirationMode.ImmediateEviction,
ImmediateAbsoluteExpirationRelativeToNow = delay
};
}
public static LazyCacheEntryOptions WithImmediateAbsoluteExpiration(TimeSpan absoluteExpiration)
{
return new LazyCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = absoluteExpiration,
ExpirationMode = ExpirationMode.ImmediateEviction,
ImmediateAbsoluteExpirationRelativeToNow = absoluteExpiration
};
}
}
public static class LazyCacheEntryOptionsExtension {
public static LazyCacheEntryOptions SetAbsoluteExpiration(this LazyCacheEntryOptions option, DateTimeOffset absoluteExpiration,
ExpirationMode mode)
{
if (option == null) throw new ArgumentNullException(nameof(option));
var delay = absoluteExpiration.Subtract(DateTimeOffset.UtcNow);
option.AbsoluteExpiration = absoluteExpiration;
option.ExpirationMode = mode;
option.ImmediateAbsoluteExpirationRelativeToNow = delay;
return option;
}
public static LazyCacheEntryOptions SetAbsoluteExpiration(this LazyCacheEntryOptions option, TimeSpan absoluteExpiration,
ExpirationMode mode)
{
if (option == null) throw new ArgumentNullException(nameof(option));
option.AbsoluteExpirationRelativeToNow = absoluteExpiration;
option.ExpirationMode = mode;
option.ImmediateAbsoluteExpirationRelativeToNow = absoluteExpiration;
return option;
}
}
}
|
using System;
using Microsoft.Extensions.Caching.Memory;
namespace LazyCache
{
public class LazyCacheEntryOptions : MemoryCacheEntryOptions
{
public ExpirationMode ExpirationMode { get; set; }
public TimeSpan ImmediateAbsoluteExpirationRelativeToNow { get; set; }
public static LazyCacheEntryOptions WithImmediateAbsoluteExpiration(DateTimeOffset absoluteExpiration)
{
var delay = absoluteExpiration.Subtract(DateTimeOffset.UtcNow);
return new LazyCacheEntryOptions
{
AbsoluteExpiration = absoluteExpiration,
ExpirationMode = ExpirationMode.ImmediateExpiration,
ImmediateAbsoluteExpirationRelativeToNow = delay
};
}
public static LazyCacheEntryOptions WithImmediateAbsoluteExpiration(TimeSpan absoluteExpiration)
{
return new LazyCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = absoluteExpiration,
ExpirationMode = ExpirationMode.ImmediateExpiration,
ImmediateAbsoluteExpirationRelativeToNow = absoluteExpiration
};
}
}
public static class LazyCacheEntryOptionsExtension {
public static LazyCacheEntryOptions SetAbsoluteExpiration(this LazyCacheEntryOptions option, DateTimeOffset absoluteExpiration,
ExpirationMode mode)
{
if (option == null) throw new ArgumentNullException(nameof(option));
var delay = absoluteExpiration.Subtract(DateTimeOffset.UtcNow);
option.AbsoluteExpiration = absoluteExpiration;
option.ExpirationMode = mode;
option.ImmediateAbsoluteExpirationRelativeToNow = delay;
return option;
}
public static LazyCacheEntryOptions SetAbsoluteExpiration(this LazyCacheEntryOptions option, TimeSpan absoluteExpiration,
ExpirationMode mode)
{
if (option == null) throw new ArgumentNullException(nameof(option));
option.AbsoluteExpirationRelativeToNow = absoluteExpiration;
option.ExpirationMode = mode;
option.ImmediateAbsoluteExpirationRelativeToNow = absoluteExpiration;
return option;
}
}
}
|
mit
|
C#
|
cdb721b79d2cdb1f454a9db53f2df3ec7c897373
|
Allow access to standalone queue storage
|
Drewan/LightBlue,Drewan/LightBlue,Drewan/LightBlue,LightBlueProject/LightBlue,wangdoubleyan/LightBlue,LightBlueProject/LightBlue,LightBlueProject/LightBlue,ColinScott/LightBlue,ColinScott/LightBlue,wangdoubleyan/LightBlue,wangdoubleyan/LightBlue,ColinScott/LightBlue
|
LightBlue/Standalone/StandaloneAzureStorage.cs
|
LightBlue/Standalone/StandaloneAzureStorage.cs
|
using System;
using System.IO;
using System.Linq;
namespace LightBlue.Standalone
{
public class StandaloneAzureStorage : IAzureStorage
{
public const string DevelopmentAccountName = "dev";
private readonly string _storageAccountDirectory;
public StandaloneAzureStorage(string connectionString)
{
var storageAccountName = ExtractAccountName(connectionString);
_storageAccountDirectory = Path.Combine(StandaloneEnvironment.LightBlueDataDirectory, storageAccountName);
Directory.CreateDirectory(_storageAccountDirectory);
}
public IAzureBlobStorageClient CreateAzureBlobStorageClient()
{
return new StandaloneAzureBlobStorageClient(_storageAccountDirectory);
}
public IAzureQueueStorageClient CreateAzureQueueStorageClient()
{
return new StandaloneAzureQueueStorageClient(_storageAccountDirectory);
}
private static string ExtractAccountName(string connectionString)
{
try
{
var valuePairs = connectionString.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
.Select(component => component.Split(new[] {'='}, StringSplitOptions.RemoveEmptyEntries))
.ToDictionary(c => c[0].ToLowerInvariant(), c => c[1]);
if (valuePairs.ContainsKey("accountname"))
{
return valuePairs["accountname"];
}
if (valuePairs.ContainsKey("usedevelopmentstorage"))
{
return DevelopmentAccountName;
}
}
catch (IndexOutOfRangeException ex)
{
throw new FormatException("Settings must be of the form \"name=value\".", ex);
}
throw new FormatException("Could not parse the connection string.");
}
}
}
|
using System;
using System.IO;
using System.Linq;
namespace LightBlue.Standalone
{
public class StandaloneAzureStorage : IAzureStorage
{
public const string DevelopmentAccountName = "dev";
private readonly string _storageAccountDirectory;
public StandaloneAzureStorage(string connectionString)
{
var storageAccountName = ExtractAccountName(connectionString);
_storageAccountDirectory = Path.Combine(StandaloneEnvironment.LightBlueDataDirectory, storageAccountName);
Directory.CreateDirectory(_storageAccountDirectory);
}
public IAzureBlobStorageClient CreateAzureBlobStorageClient()
{
return new StandaloneAzureBlobStorageClient(_storageAccountDirectory);
}
public IAzureQueueStorageClient CreateAzureQueueStorageClient()
{
throw new NotSupportedException();
}
private static string ExtractAccountName(string connectionString)
{
try
{
var valuePairs = connectionString.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
.Select(component => component.Split(new[] {'='}, StringSplitOptions.RemoveEmptyEntries))
.ToDictionary(c => c[0].ToLowerInvariant(), c => c[1]);
if (valuePairs.ContainsKey("accountname"))
{
return valuePairs["accountname"];
}
if (valuePairs.ContainsKey("usedevelopmentstorage"))
{
return DevelopmentAccountName;
}
}
catch (IndexOutOfRangeException ex)
{
throw new FormatException("Settings must be of the form \"name=value\".", ex);
}
throw new FormatException("Could not parse the connection string.");
}
}
}
|
apache-2.0
|
C#
|
b9e4f73f78fa5bf3cdacefdd10d3a186079913be
|
Add concurrent objects check to `BeatmapVerifier`
|
smoogipoo/osu,ppy/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,ppy/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu
|
osu.Game/Rulesets/Edit/BeatmapVerifier.cs
|
osu.Game/Rulesets/Edit/BeatmapVerifier.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.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit.Checks;
using osu.Game.Rulesets.Edit.Checks.Components;
namespace osu.Game.Rulesets.Edit
{
/// <summary>
/// A ruleset-agnostic beatmap verifier that identifies issues in common metadata or mapping standards.
/// </summary>
public class BeatmapVerifier : IBeatmapVerifier
{
private readonly List<ICheck> checks = new List<ICheck>
{
// Resources
new CheckBackgroundPresence(),
new CheckBackgroundQuality(),
// Audio
new CheckAudioPresence(),
new CheckAudioQuality(),
// Compose
new CheckUnsnaps(),
new CheckConcurrentObjects()
};
public IEnumerable<Issue> Run(IBeatmap playableBeatmap, WorkingBeatmap workingBeatmap)
{
return checks.SelectMany(check => check.Run(playableBeatmap, workingBeatmap));
}
}
}
|
// 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.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit.Checks;
using osu.Game.Rulesets.Edit.Checks.Components;
namespace osu.Game.Rulesets.Edit
{
/// <summary>
/// A ruleset-agnostic beatmap verifier that identifies issues in common metadata or mapping standards.
/// </summary>
public class BeatmapVerifier : IBeatmapVerifier
{
private readonly List<ICheck> checks = new List<ICheck>
{
// Resources
new CheckBackgroundPresence(),
new CheckBackgroundQuality(),
// Audio
new CheckAudioPresence(),
new CheckAudioQuality(),
// Compose
new CheckUnsnaps()
};
public IEnumerable<Issue> Run(IBeatmap playableBeatmap, WorkingBeatmap workingBeatmap)
{
return checks.SelectMany(check => check.Run(playableBeatmap, workingBeatmap));
}
}
}
|
mit
|
C#
|
ff1b1549eb83df817e3b068018cb94f0ceecf3ba
|
Add failing test for get paused trigger groups
|
lukeryannetnz/quartznet-dynamodb,lukeryannetnz/quartznet-dynamodb
|
src/QuartzNET-DynamoDB.Tests/Integration/JobStore/TriggerGroupGetTests.cs
|
src/QuartzNET-DynamoDB.Tests/Integration/JobStore/TriggerGroupGetTests.cs
|
using System;
using Quartz.Simpl;
using Quartz.Spi;
using Xunit;
namespace Quartz.DynamoDB.Tests
{
public class TriggerGroupGetTests
{
IJobStore _sut;
public TriggerGroupGetTests()
{
_sut = new JobStore();
var signaler = new Quartz.DynamoDB.Tests.Integration.RamJobStoreTests.SampleSignaler();
var loadHelper = new SimpleTypeLoadHelper();
_sut.Initialize(loadHelper, signaler);
}
/// <summary>
/// Get paused trigger groups returns one record.
/// </summary>
[Fact]
[Trait("Category", "Integration")]
public void GetPausedTriggerGroupReturnsOneRecord()
{
//create a trigger group by calling for it to be paused.
string triggerGroup = Guid.NewGuid().ToString();
_sut.PauseTriggers(Quartz.Impl.Matchers.GroupMatcher<TriggerKey>.GroupEquals(triggerGroup));
var result = _sut.GetPausedTriggerGroups();
Assert.True(result.Contains(triggerGroup));
}
}
}
|
using System;
using Quartz.Simpl;
using Quartz.Spi;
namespace Quartz.DynamoDB.Tests
{
public class TriggerGroupGetTests
{
IJobStore _sut;
public TriggerGroupGetTests()
{
_sut = new JobStore();
var signaler = new Quartz.DynamoDB.Tests.Integration.RamJobStoreTests.SampleSignaler();
var loadHelper = new SimpleTypeLoadHelper();
_sut.Initialize(loadHelper, signaler);
}
}
}
|
apache-2.0
|
C#
|
f07b30f982f11f60a072a69444e79591fc439bd4
|
Fix CopyCodeLinkLabel
|
nikeee/HolzShots
|
src/HolzShots.Windows/Forms/CopyCodeLinkLabel.cs
|
src/HolzShots.Windows/Forms/CopyCodeLinkLabel.cs
|
using System;
using System.ComponentModel;
using System.Drawing;
namespace HolzShots.Windows.Forms
{
public class CopyCodeLinkLabel : ExplorerLinkLabel
{
private static readonly Font _font = new Font("Consolas", 9.75f, FontStyle.Regular, GraphicsUnit.Point); // Consolas; 9,75pt
public CopyCodeLinkLabel()
{
Font = _font;
}
}
}
|
using System.ComponentModel;
using System.Drawing;
namespace HolzShots.Windows.Forms
{
public class CopyCodeLinkLabel : ExplorerLinkLabel
{
private static readonly Font _font = new Font("Consolas", 9.75f, FontStyle.Regular, GraphicsUnit.Point); // Consolas; 9,75pt
[ReadOnly(true)]
public new Font Font
{
get => _font;
set { }
}
}
}
|
agpl-3.0
|
C#
|
826ce9dce965049ed39b1101842b96e63b876b02
|
Fix doc string.
|
mthamil/SharpEssentials
|
SharpEssentials.Controls/TreeViewExtensions.cs
|
SharpEssentials.Controls/TreeViewExtensions.cs
|
// Sharp Essentials
// Copyright 2017 Matthew Hamilton - matthamilton@live.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Linq;
using System.Windows.Controls;
namespace SharpEssentials.Controls
{
/// <summary>
/// Contains extension methods for <see cref="TreeView"/>s.
/// </summary>
public static class TreeViewExtensions
{
/// <summary>
/// Performs a depth-first search of the already generated items in a tree for a given item's
/// corresponding <see cref="TreeViewItem"/>.
/// </summary>
/// <param name="treeView">The tree to search</param>
/// <param name="item">The object to search for</param>
/// <returns>The corresponding <see cref="TreeViewItem"/> or <see cref="Option.None{TreeViewItem}()"/></returns>
public static Option<TreeViewItem> FindContainerFromItem(this TreeView treeView, object item)
{
var found = FindGeneratedItem(treeView.ItemContainerGenerator, item);
return Option.From(found as TreeViewItem);
}
/// <summary>
/// Attempts to find an item in a tree.
/// </summary>
private static object FindGeneratedItem(ItemContainerGenerator containerGenerator, object item)
{
var container = containerGenerator.ContainerFromItem(item);
if (container != null)
return container;
return containerGenerator.Items
.Select(containerGenerator.ContainerFromItem)
.Where(c => c != null)
.OfType<TreeViewItem>()
.Select(c => FindGeneratedItem(c.ItemContainerGenerator, item))
.FirstOrDefault(foundItem => foundItem != null);
}
}
}
|
// Sharp Essentials
// Copyright 2017 Matthew Hamilton - matthamilton@live.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Linq;
using System.Windows.Controls;
namespace SharpEssentials.Controls
{
/// <summary>
/// Contains extension methods for <see cref="TreeView"/>s.
/// </summary>
public static class TreeViewExtensions
{
/// <summary>
/// Performs a depth-first search of the already generated items in a tree for a given item's
/// corresponding <see cref="TreeViewItem"/>.
/// </summary>
/// <param name="treeView">The tree to search</param>
/// <param name="item">The object to search for</param>
/// <returns>The corresponding <see cref="TreeViewItem"/> or <see cref="Option{TreeViewItem}.None"/></returns>
public static Option<TreeViewItem> FindContainerFromItem(this TreeView treeView, object item)
{
var found = FindGeneratedItem(treeView.ItemContainerGenerator, item);
return Option.From(found as TreeViewItem);
}
/// <summary>
/// Attempts to find an item in a tree.
/// </summary>
private static object FindGeneratedItem(ItemContainerGenerator containerGenerator, object item)
{
var container = containerGenerator.ContainerFromItem(item);
if (container != null)
return container;
return containerGenerator.Items
.Select(containerGenerator.ContainerFromItem)
.Where(c => c != null)
.OfType<TreeViewItem>()
.Select(c => FindGeneratedItem(c.ItemContainerGenerator, item))
.FirstOrDefault(foundItem => foundItem != null);
}
}
}
|
apache-2.0
|
C#
|
5830d0e2d5e362801f4dfcb653e95d23f91267be
|
Update OperandSizeAttribute.cs (#285)
|
AntShares/AntShares.VM
|
src/neo-vm/OperandSizeAttribute.cs
|
src/neo-vm/OperandSizeAttribute.cs
|
using System;
namespace Neo.VM
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
public class OperandSizeAttribute : Attribute
{
public int Size { get; set; }
public int SizePrefix { get; set; }
}
}
|
using System;
namespace Neo.VM
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
internal class OperandSizeAttribute : Attribute
{
public int Size { get; set; }
public int SizePrefix { get; set; }
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.