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 |
---|---|---|---|---|---|---|---|---|
b57d1a7f19e0fa45dd3eee969a68eded612bd59c
|
fix path expander
|
Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek
|
core/Engine/Engine/Rules/Creation/RulesLoader.cs
|
core/Engine/Engine/Rules/Creation/RulesLoader.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Engine.Core;
using Engine.Core.Rules;
using Engine.DataTypes;
using Engine.Drivers.Rules;
using LanguageExt;
using static Engine.Core.Utils.TraceHelpers;
namespace Engine.Rules.Creation
{
public static class RulesLoader
{
public static async Task<Func<(RulesRepository, PathExpander)>> Factory(IRulesDriver driver, IRuleParser parser)
{
var instance = Parse(await driver.GetAllRules(), parser);
driver.OnRulesChange += (newRules) =>
{
using (TraceTime("loading new rules"))
{
instance = Parse(newRules, parser);
}
};
return () => instance;
}
public static (RulesRepository, PathExpander) Parse(IDictionary<string, RuleDefinition> rules, IRuleParser parser)
{
var tree = new RadixTree<IRule>(rules.ToDictionary(x => x.Key.ToLower(), x => parser.Parse(x.Value.Payload)));
Option<IRule> RulesRepository(ConfigurationPath path) => tree.TryGetValue(path, out var rule) ? Option<IRule>.Some(rule) : Option<IRule>.None;
IEnumerable<ConfigurationPath> PathExpander(ConfigurationPath path) => tree.ListPrefix(path.Location).Select(c => c.key).Select(ConfigurationPath.New);
return (RulesRepository, PathExpander);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Engine.Core;
using Engine.Core.Rules;
using Engine.DataTypes;
using Engine.Drivers.Rules;
using LanguageExt;
using static Engine.Core.Utils.TraceHelpers;
namespace Engine.Rules.Creation
{
public static class RulesLoader
{
public static async Task<Func<(RulesRepository, PathExpander)>> Factory(IRulesDriver driver, IRuleParser parser)
{
var instance = Parse(await driver.GetAllRules(), parser);
driver.OnRulesChange += (newRules) =>
{
using (TraceTime("loading new rules"))
{
instance = Parse(newRules, parser);
}
};
return () => instance;
}
public static (RulesRepository, PathExpander) Parse(IDictionary<string, RuleDefinition> rules, IRuleParser parser)
{
var tree = new RadixTree<IRule>(rules.ToDictionary(x => x.Key.ToLower(), x => parser.Parse(x.Value.Payload)));
Option<IRule> RulesRepository(ConfigurationPath path) => tree.TryGetValue(path, out var rule) ? Option<IRule>.Some(rule) : Option<IRule>.None;
IEnumerable<ConfigurationPath> PathExpander(ConfigurationPath path) => tree.ListPrefix(path).Select(c => c.key).Select(ConfigurationPath.New);
return (RulesRepository, PathExpander);
}
}
}
|
mit
|
C#
|
59e77cd70690ec2e351d6ce59760d904bdbaeda4
|
Update XML comment of ClickUsingActionsAttribute
|
YevgeniyShunevych/Atata,atata-framework/atata,YevgeniyShunevych/Atata,atata-framework/atata
|
src/Atata/Attributes/Behaviors/Click/ClickUsingActionsAttribute.cs
|
src/Atata/Attributes/Behaviors/Click/ClickUsingActionsAttribute.cs
|
using OpenQA.Selenium;
using OpenQA.Selenium.Interactions;
namespace Atata
{
/// <summary>
/// Represents the behavior for control clicking by using a set of actions:
/// <see cref="Actions.MoveToElement(IWebElement)"/> or <see cref="Actions.MoveToElement(IWebElement, int, int, MoveToElementOffsetOrigin)"/> and <see cref="Actions.Click()"/>.
/// </summary>
public class ClickUsingActionsAttribute : ClickBehaviorAttribute
{
/// <summary>
/// Gets or sets the kind of the offset.
/// </summary>
public UIComponentOffsetKind OffsetKind { get; set; }
/// <summary>
/// Gets or sets the horizontal offset to which to move the mouse.
/// </summary>
public int OffsetX { get; set; }
/// <summary>
/// Gets or sets the vertical offset to which to move the mouse.
/// </summary>
public int OffsetY { get; set; }
/// <inheritdoc/>
public override void Execute<TOwner>(IUIComponent<TOwner> component)
{
var scopeElement = component.Scope;
component.Owner.Driver.Perform(
x => x.MoveToElement(scopeElement, OffsetX, OffsetY, OffsetKind).Click());
}
}
}
|
using OpenQA.Selenium;
using OpenQA.Selenium.Interactions;
namespace Atata
{
/// <summary>
/// Represents the behavior for control clicking by using a set of actions:
/// <see cref="Actions.MoveToElement(IWebElement)"/> and <see cref="Actions.Click()"/>.
/// </summary>
public class ClickUsingActionsAttribute : ClickBehaviorAttribute
{
/// <summary>
/// Gets or sets the kind of the offset.
/// </summary>
public UIComponentOffsetKind OffsetKind { get; set; }
/// <summary>
/// Gets or sets the horizontal offset to which to move the mouse.
/// </summary>
public int OffsetX { get; set; }
/// <summary>
/// Gets or sets the vertical offset to which to move the mouse.
/// </summary>
public int OffsetY { get; set; }
/// <inheritdoc/>
public override void Execute<TOwner>(IUIComponent<TOwner> component)
{
var scopeElement = component.Scope;
component.Owner.Driver.Perform(
x => x.MoveToElement(scopeElement, OffsetX, OffsetY, OffsetKind).Click());
}
}
}
|
apache-2.0
|
C#
|
6894a4831c55cbd22fcd16639cc207c1c8505cac
|
Bump assembly version to 4.1.333.0.
|
rubyu/CreviceApp,rubyu/CreviceApp
|
CreviceApp/Properties/AssemblyInfo.cs
|
CreviceApp/Properties/AssemblyInfo.cs
|
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("Crevice 4")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Crevice 4")]
[assembly: AssemblyCopyright("Copyright @rubyu")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから
// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("82b56652-6380-44ed-a193-742f7eef290f")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.1.333.0")]
[assembly: AssemblyFileVersion("4.1.333.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: InternalsVisibleTo("Crevice4Tests")]
|
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("Crevice4")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Crevice4")]
[assembly: AssemblyCopyright("Copyright @rubyu")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから
// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("82b56652-6380-44ed-a193-742f7eef290f")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.332.0")]
[assembly: AssemblyFileVersion("4.0.332.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: InternalsVisibleTo("Crevice4Tests")]
|
mit
|
C#
|
aa8c7a29da7ff7f472dbab0ea9226c0b04002ae0
|
Change comments header
|
Minesweeper-6-Team-Project-Telerik/Minesweeper-6
|
src2/ConsoleMinesweeper.Test/TestTimer.cs
|
src2/ConsoleMinesweeper.Test/TestTimer.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TestTimer.cs" company="Telerik Academy">
// Teamwork Project "Minesweeper-6"
// </copyright>
// <summary>
// The test timer.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ConsoleMinesweeper.Test
{
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using ConsoleMinesweeper.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;
/// <summary>
/// The test timer.
/// </summary>
[TestClass]
[ExcludeFromCodeCoverage]
public class TestTimer
{
/// <summary>
/// The test timer should increment.
/// </summary>
[TestMethod]
public void TestTimerShouldIncrement()
{
var cnt = 0;
var timer = new ConsoleTimer();
timer.TickEvent += (sender, args) => { cnt++; };
timer.Start();
Thread.Sleep(1100);
Assert.AreEqual(cnt, 2, "timer is not ticking");
timer.Stop();
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TestTimer.cs" company="">
//
// </copyright>
// <summary>
// The test timer.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ConsoleMinesweeper.Test
{
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using ConsoleMinesweeper.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;
/// <summary>
/// The test timer.
/// </summary>
[TestClass]
[ExcludeFromCodeCoverage]
public class TestTimer
{
/// <summary>
/// The test timer should increment.
/// </summary>
[TestMethod]
public void TestTimerShouldIncrement()
{
var cnt = 0;
var timer = new ConsoleTimer();
timer.TickEvent += (sender, args) => { cnt++; };
timer.Start();
Thread.Sleep(1100);
Assert.AreEqual(cnt, 2, "timer is not ticking");
timer.Stop();
}
}
}
|
mit
|
C#
|
8ad397437a138431348257ec328a3ff183d412bc
|
use siml package from the project
|
idoban/FinBotApp,borismod/FinBotApp,idoban/FinBotApp,borismod/FinBotApp
|
FinBot/Engine/BotResponseGenerator.cs
|
FinBot/Engine/BotResponseGenerator.cs
|
using Syn.Bot.Siml;
using BotResponse = FinBot.Models.BotResponse;
namespace FinBot.Engine
{
public interface IBotResponseGenerator
{
BotResponse GetBotResponse(string input);
}
public class BotResponseGenerator : IBotResponseGenerator
{
private readonly SimlBot _simlBot;
public BotResponseGenerator(IAdaptersRepository adaptersRepository, ISimlPackageLoader simlPackageLoader)
{
_simlBot = new SimlBot();
_simlBot.PackageManager.LoadFromString(simlPackageLoader.LoadSimlPackage());
_simlBot.Adapters.AddRange(adaptersRepository.GetAdapters());
;
}
public BotResponse GetBotResponse(string input)
{
var chatResult = _simlBot.Chat(input);
return new BotResponse
{
ResponseText = chatResult.BotMessage
};
}
}
}
|
using System.IO;
using Syn.Bot.Siml;
using BotResponse = FinBot.Models.BotResponse;
namespace FinBot.Engine
{
public interface IBotResponseGenerator
{
BotResponse GetBotResponse(string input);
}
public class BotResponseGenerator : IBotResponseGenerator
{
private readonly SimlBot _simlBot;
public BotResponseGenerator(IAdaptersRepository adaptersRepository)
{
_simlBot = new SimlBot();
_simlBot.PackageManager.LoadFromString(
File.ReadAllText(@"C:\work\github\automated-live-chat-demo\Assistant\Package1.txt"));
_simlBot.Adapters.AddRange(adaptersRepository.GetAdapters());
;
}
public BotResponse GetBotResponse(string input)
{
var chatResult = _simlBot.Chat(input);
return new BotResponse
{
ResponseText = chatResult.BotMessage
};
}
}
}
|
mit
|
C#
|
949b7e4b4e89d8cb4d7186185f85aea890fa21d6
|
Fix to make WPF sample executable
|
SimControl/SimControl.Reactive
|
SimControl.Samples.CSharp.WpfApplication/Properties/AssemblyInfo.cs
|
SimControl.Samples.CSharp.WpfApplication/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SimControl.Samples.CSharp.WpfApplication")]
[assembly: AssemblyDescription("")]
[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)]
[assembly: CLSCompliant(true)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
|
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SimControl.Samples.CSharp.WpfApplication")]
[assembly: AssemblyDescription("")]
[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)]
[assembly: CLSCompliant(true)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
|
mit
|
C#
|
218baecdf0f8bcc0495a8cdf4fe7300fbcc591c8
|
Add an integration test for reading the current user.
|
tgstation/tgstation-server,tgstation/tgstation-server-tools,tgstation/tgstation-server
|
tests/Tgstation.Server.Tests/UsersTest.cs
|
tests/Tgstation.Server.Tests/UsersTest.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Client;
namespace Tgstation.Server.Tests
{
sealed class UsersTest
{
readonly IUsersClient client;
public UsersTest(IUsersClient client)
{
this.client = client ?? throw new ArgumentNullException(nameof(client));
}
public async Task Run(CancellationToken cancellationToken)
{
await TestRetrieveCurrentUser(cancellationToken).ConfigureAwait(false);
await TestSpamCreation(cancellationToken).ConfigureAwait(false);
}
async Task TestRetrieveCurrentUser(CancellationToken cancellationToken)
{
var user = await this.client.Read(cancellationToken).ConfigureAwait(false);
Assert.IsNotNull(user);
Assert.AreEqual("Admin", user.Name);
Assert.IsNull(user.SystemIdentifier);
Assert.AreEqual(true, user.Enabled);
}
async Task TestSpamCreation(CancellationToken cancellationToken)
{
ICollection<Task<User>> tasks = new List<Task<User>>();
// Careful with this, very easy to overload the thread pool
const int RepeatCount = 100;
ThreadPool.GetMaxThreads(out var defaultMaxWorker, out var defaultMaxCompletion);
ThreadPool.GetMinThreads(out var defaultMinWorker, out var defaultMinCompletion);
try
{
ThreadPool.SetMinThreads(Math.Min(RepeatCount * 4, defaultMaxWorker), Math.Min(RepeatCount * 4, defaultMaxCompletion));
for (int i = 0; i < RepeatCount; ++i)
{
tasks.Add(
client.Create(
new UserUpdate
{
Name = $"SpamTestUser_{i}",
Password = "asdfasdjfhauwiehruiy273894234jhndjkwh"
},
cancellationToken));
}
await Task.WhenAll(tasks).ConfigureAwait(false);
}
finally
{
ThreadPool.SetMinThreads(defaultMinWorker, defaultMinCompletion);
}
Assert.AreEqual(RepeatCount, tasks.Select(task => task.Result.Id).Distinct().Count(), "Did not receive expected number of unique user IDs!");
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Client;
namespace Tgstation.Server.Tests
{
sealed class UsersTest
{
readonly IUsersClient client;
public UsersTest(IUsersClient client)
{
this.client = client ?? throw new ArgumentNullException(nameof(client));
}
public async Task Run(CancellationToken cancellationToken)
{
await TestSpamCreation(cancellationToken).ConfigureAwait(false);
}
public async Task TestSpamCreation(CancellationToken cancellationToken)
{
ICollection<Task<User>> tasks = new List<Task<User>>();
// Careful with this, very easy to overload the thread pool
const int RepeatCount = 100;
ThreadPool.GetMaxThreads(out var defaultMaxWorker, out var defaultMaxCompletion);
ThreadPool.GetMinThreads(out var defaultMinWorker, out var defaultMinCompletion);
try
{
ThreadPool.SetMinThreads(Math.Min(RepeatCount * 4, defaultMaxWorker), Math.Min(RepeatCount * 4, defaultMaxCompletion));
for (int i = 0; i < RepeatCount; ++i)
{
tasks.Add(
client.Create(
new UserUpdate
{
Name = $"SpamTestUser_{i}",
Password = "asdfasdjfhauwiehruiy273894234jhndjkwh"
},
cancellationToken));
}
await Task.WhenAll(tasks).ConfigureAwait(false);
}
finally
{
ThreadPool.SetMinThreads(defaultMinWorker, defaultMinCompletion);
}
Assert.AreEqual(RepeatCount, tasks.Select(task => task.Result.Id).Distinct().Count(), "Did not receive expected number of unique user IDs!");
}
}
}
|
agpl-3.0
|
C#
|
8077fd2f94aaec2e12a51d6844c0095314b13e1b
|
Update error categories to match libgit2
|
GeertvanHorrik/libgit2sharp,rcorre/libgit2sharp,xoofx/libgit2sharp,Zoxive/libgit2sharp,mono/libgit2sharp,AMSadek/libgit2sharp,AArnott/libgit2sharp,PKRoma/libgit2sharp,github/libgit2sharp,psawey/libgit2sharp,GeertvanHorrik/libgit2sharp,github/libgit2sharp,OidaTiftla/libgit2sharp,sushihangover/libgit2sharp,jeffhostetler/public_libgit2sharp,libgit2/libgit2sharp,red-gate/libgit2sharp,sushihangover/libgit2sharp,nulltoken/libgit2sharp,whoisj/libgit2sharp,psawey/libgit2sharp,xoofx/libgit2sharp,Zoxive/libgit2sharp,whoisj/libgit2sharp,shana/libgit2sharp,dlsteuer/libgit2sharp,oliver-feng/libgit2sharp,rcorre/libgit2sharp,jorgeamado/libgit2sharp,jeffhostetler/public_libgit2sharp,vorou/libgit2sharp,OidaTiftla/libgit2sharp,Skybladev2/libgit2sharp,mono/libgit2sharp,shana/libgit2sharp,ethomson/libgit2sharp,red-gate/libgit2sharp,oliver-feng/libgit2sharp,vivekpradhanC/libgit2sharp,jamill/libgit2sharp,nulltoken/libgit2sharp,jamill/libgit2sharp,AArnott/libgit2sharp,ethomson/libgit2sharp,AMSadek/libgit2sharp,vorou/libgit2sharp,jorgeamado/libgit2sharp,Skybladev2/libgit2sharp,vivekpradhanC/libgit2sharp,dlsteuer/libgit2sharp
|
LibGit2Sharp/Core/GitErrorCategory.cs
|
LibGit2Sharp/Core/GitErrorCategory.cs
|
namespace LibGit2Sharp.Core
{
internal enum GitErrorCategory
{
Unknown = -1,
None,
NoMemory,
Os,
Invalid,
Reference,
Zlib,
Repository,
Config,
Regex,
Odb,
Index,
Object,
Net,
Tag,
Tree,
Indexer,
Ssl,
Submodule,
Thread,
Stash,
Checkout,
FetchHead,
Merge,
Ssh,
Filter,
Revert,
Callback,
}
}
|
namespace LibGit2Sharp.Core
{
internal enum GitErrorCategory
{
Unknown = -1,
NoMemory,
Os,
Invalid,
Reference,
Zlib,
Repository,
Config,
Regex,
Odb,
Index,
Object,
Net,
Tag,
Tree,
Indexer,
Ssl,
Submodule,
Thread,
Stash,
Checkout,
FetchHead,
Merge,
Ssh,
Filter,
}
}
|
mit
|
C#
|
b0debaff8d4d01777b36d6bf0e1ed77ad38f7aa4
|
fix lazy loading the nasted items
|
benhallouk/syntactic-docs,benhallouk/syntactic-docs
|
src/SyntacticDocs/Services/DocumentService.cs
|
src/SyntacticDocs/Services/DocumentService.cs
|
using System.Collections.Generic;
using System.Linq;
using SyntacticDocs.Models;
using SyntacticDocs.Data;
using Microsoft.EntityFrameworkCore;
namespace SyntacticDocs.Services
{
public class DocumentService
{
private readonly ApplicationDbContext _db;
public DocumentService(ApplicationDbContext db)
{
_db = db;
_db.SeedData();
}
public Document GetDocument(string alias)
{
return _db.Docs
.Include(doc => doc.Documents)
.ThenInclude(doc => doc.Documents)
.Where(doc => doc.Alias==alias)
.Single();
}
public IEnumerable<Document> GetRelatedDocuments(Document document)
{
return _db.Docs.Where(doc=>doc.Tags.Any(tag=>document.Tags.Contains(tag)));
}
public Document Save(Document document)
{
var oldDocument = _db.Docs.FirstOrDefault(doc=>doc.Id==document.Id);
oldDocument.Content = document.Content;
_db.SaveChanges();
return oldDocument;
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using SyntacticDocs.Models;
using SyntacticDocs.Data;
using Microsoft.EntityFrameworkCore;
namespace SyntacticDocs.Services
{
public class DocumentService
{
private readonly ApplicationDbContext _db;
public DocumentService(ApplicationDbContext db)
{
_db = db;
_db.SeedData();
}
public Document GetDocument(string alias)
{
return _db.Docs
.Include(doc => doc.Documents)
.FirstOrDefault(doc=>doc.Alias==alias);
}
public IEnumerable<Document> GetRelatedDocuments(Document document)
{
return _db.Docs.Where(doc=>doc.Tags.Any(tag=>document.Tags.Contains(tag)));
}
public Document Save(Document document)
{
var oldDocument = _db.Docs.FirstOrDefault(doc=>doc.Id==document.Id);
oldDocument.Content = document.Content;
_db.SaveChanges();
return oldDocument;
}
}
}
|
apache-2.0
|
C#
|
993f64099efee78f577fcea85992ab86c39c2415
|
Update to version 1.0.3
|
ManuelRin/NServiceMVC,ManuelRin/NServiceMVC,gregmac/NServiceMVC,gregmac/NServiceMVC,gregmac/NServiceMVC
|
src/NServiceMVC/Properties/AssemblyInfo.cs
|
src/NServiceMVC/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("NServiceMVC")]
[assembly: AssemblyDescription("A lightweight framework enabling the creation of REST services within ASP.NET MVC 3")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Greg MacLellan")]
[assembly: AssemblyProduct("NServiceMVC.com")]
[assembly: AssemblyCopyright("Copyright © Greg MacLellan 2012")]
[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("5ca0313a-713d-44ce-8f1a-501088f81e4e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
|
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("NServiceMVC")]
[assembly: AssemblyDescription("A lightweight framework enabling the creation of REST services within ASP.NET MVC 3")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Greg MacLellan")]
[assembly: AssemblyProduct("NServiceMVC.com")]
[assembly: AssemblyCopyright("Copyright © Greg MacLellan 2012")]
[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("5ca0313a-713d-44ce-8f1a-501088f81e4e")]
// 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.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
|
mit
|
C#
|
0359acfa09ea58ffb331e9d1922d25820aee39df
|
Implement DOMNodeList
|
peachpiecompiler/peachpie,iolevel/peachpie,iolevel/peachpie-concept,iolevel/peachpie,peachpiecompiler/peachpie,iolevel/peachpie-concept,iolevel/peachpie,iolevel/peachpie-concept,peachpiecompiler/peachpie
|
src/Peachpie.Library.XmlDom/DOMNodeList.cs
|
src/Peachpie.Library.XmlDom/DOMNodeList.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using Pchp.Core;
namespace Peachpie.Library.XmlDom
{
[PhpType(PhpTypeAttribute.InheritName)]
public class DOMNodeList : Traversable, Iterator
{
#region Fields and Properties
/// <summary>
/// List of the nodes.
/// </summary>
private List<DOMNode>/*!*/ _list;
/// <summary>
/// Current element index.
/// </summary>
private int _element;
/// <summary>
/// The number of nodes in the list. The range of valid child node indices is 0 to length - 1 inclusive.
/// </summary>
public int length => _list.Count;
#endregion
#region Construction
public DOMNodeList()
{
_list = new List<DOMNode>();
_element = 0;
}
#endregion
#region Item access
internal void AppendNode(DOMNode/*!*/ node)
{
Debug.Assert(node != null);
_list.Add(node);
}
/// <summary>
/// Retrieves a node specified by an index.
/// </summary>
/// <param name="index">The index.</param>
/// <returns>The node or <B>NULL</B> if the <paramref name="index"/> is invalid.</returns>
public DOMNode item(int index)
{
if (index < 0 || index >= _list.Count) return null;
return _list[index];
}
#endregion
#region Iterator
void Iterator.rewind()
{
_element = 0;
}
void Iterator.next()
{
_element++;
}
bool Iterator.valid() => _element < _list.Count;
PhpValue Iterator.key() => PhpValue.Create(_element);
PhpValue Iterator.current() => PhpValue.FromClass(_list[_element]);
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using Pchp.Core;
namespace Peachpie.Library.XmlDom
{
[PhpType(PhpTypeAttribute.InheritName)]
public class DOMNodeList
{
}
}
|
apache-2.0
|
C#
|
fe7a5f082ca14f5945eedc8d0d23311c0d3701a0
|
Cut down FormatterServices (#10653)
|
pgavlin/coreclr,parjong/coreclr,mskvortsov/coreclr,ruben-ayrapetyan/coreclr,pgavlin/coreclr,James-Ko/coreclr,wtgodbe/coreclr,qiudesong/coreclr,russellhadley/coreclr,gkhanna79/coreclr,James-Ko/coreclr,wateret/coreclr,tijoytom/coreclr,krk/coreclr,cmckinsey/coreclr,botaberg/coreclr,botaberg/coreclr,JosephTremoulet/coreclr,yizhang82/coreclr,JosephTremoulet/coreclr,hseok-oh/coreclr,wtgodbe/coreclr,cshung/coreclr,krytarowski/coreclr,cmckinsey/coreclr,mskvortsov/coreclr,wtgodbe/coreclr,dpodder/coreclr,alexperovich/coreclr,tijoytom/coreclr,yizhang82/coreclr,JosephTremoulet/coreclr,alexperovich/coreclr,rartemev/coreclr,mmitche/coreclr,poizan42/coreclr,poizan42/coreclr,cydhaselton/coreclr,mskvortsov/coreclr,tijoytom/coreclr,yeaicc/coreclr,yeaicc/coreclr,cshung/coreclr,tijoytom/coreclr,wateret/coreclr,pgavlin/coreclr,ragmani/coreclr,JosephTremoulet/coreclr,cydhaselton/coreclr,wtgodbe/coreclr,krytarowski/coreclr,wtgodbe/coreclr,mskvortsov/coreclr,James-Ko/coreclr,cshung/coreclr,mskvortsov/coreclr,jamesqo/coreclr,dpodder/coreclr,ruben-ayrapetyan/coreclr,yizhang82/coreclr,yeaicc/coreclr,krk/coreclr,jamesqo/coreclr,kyulee1/coreclr,ruben-ayrapetyan/coreclr,wateret/coreclr,AlexGhiondea/coreclr,mmitche/coreclr,YongseopKim/coreclr,alexperovich/coreclr,poizan42/coreclr,botaberg/coreclr,ruben-ayrapetyan/coreclr,YongseopKim/coreclr,AlexGhiondea/coreclr,AlexGhiondea/coreclr,kyulee1/coreclr,sagood/coreclr,gkhanna79/coreclr,cmckinsey/coreclr,qiudesong/coreclr,parjong/coreclr,JonHanna/coreclr,yeaicc/coreclr,JosephTremoulet/coreclr,qiudesong/coreclr,poizan42/coreclr,yizhang82/coreclr,gkhanna79/coreclr,mskvortsov/coreclr,rartemev/coreclr,cshung/coreclr,JonHanna/coreclr,gkhanna79/coreclr,russellhadley/coreclr,ragmani/coreclr,alexperovich/coreclr,krk/coreclr,qiudesong/coreclr,sagood/coreclr,parjong/coreclr,wateret/coreclr,James-Ko/coreclr,tijoytom/coreclr,JonHanna/coreclr,cydhaselton/coreclr,cydhaselton/coreclr,gkhanna79/coreclr,ragmani/coreclr,jamesqo/coreclr,James-Ko/coreclr,dpodder/coreclr,russellhadley/coreclr,mmitche/coreclr,krk/coreclr,krytarowski/coreclr,sagood/coreclr,sagood/coreclr,jamesqo/coreclr,alexperovich/coreclr,ruben-ayrapetyan/coreclr,wateret/coreclr,jamesqo/coreclr,YongseopKim/coreclr,yizhang82/coreclr,cmckinsey/coreclr,russellhadley/coreclr,parjong/coreclr,cmckinsey/coreclr,AlexGhiondea/coreclr,cshung/coreclr,AlexGhiondea/coreclr,ragmani/coreclr,kyulee1/coreclr,dpodder/coreclr,mmitche/coreclr,botaberg/coreclr,krk/coreclr,ruben-ayrapetyan/coreclr,hseok-oh/coreclr,JonHanna/coreclr,parjong/coreclr,cydhaselton/coreclr,qiudesong/coreclr,hseok-oh/coreclr,pgavlin/coreclr,hseok-oh/coreclr,parjong/coreclr,rartemev/coreclr,krytarowski/coreclr,ragmani/coreclr,poizan42/coreclr,russellhadley/coreclr,rartemev/coreclr,cydhaselton/coreclr,YongseopKim/coreclr,gkhanna79/coreclr,wtgodbe/coreclr,YongseopKim/coreclr,krk/coreclr,cshung/coreclr,cmckinsey/coreclr,dpodder/coreclr,sagood/coreclr,russellhadley/coreclr,yizhang82/coreclr,qiudesong/coreclr,yeaicc/coreclr,kyulee1/coreclr,yeaicc/coreclr,alexperovich/coreclr,poizan42/coreclr,mmitche/coreclr,YongseopKim/coreclr,yeaicc/coreclr,ragmani/coreclr,pgavlin/coreclr,mmitche/coreclr,AlexGhiondea/coreclr,kyulee1/coreclr,dpodder/coreclr,pgavlin/coreclr,jamesqo/coreclr,rartemev/coreclr,hseok-oh/coreclr,James-Ko/coreclr,JonHanna/coreclr,botaberg/coreclr,JosephTremoulet/coreclr,wateret/coreclr,sagood/coreclr,hseok-oh/coreclr,kyulee1/coreclr,krytarowski/coreclr,JonHanna/coreclr,cmckinsey/coreclr,rartemev/coreclr,tijoytom/coreclr,botaberg/coreclr,krytarowski/coreclr
|
src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs
|
src/mscorlib/src/System/Runtime/Serialization/FormatterServices.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.
/*============================================================
**
**
**
** Purpose: Provides some static methods to aid with the implementation
** of a Formatter for Serialization.
**
**
============================================================*/
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Security;
using System.Runtime.Remoting;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Diagnostics.Contracts;
namespace System.Runtime.Serialization
{
// This class duplicates a class on CoreFX. We are keeping it here -- just this one method --
// as it was widely invoked by reflection to workaround it being missing in .NET Core 1.0
internal static class FormatterServices
{
// Gets a new instance of the object. The entire object is initalized to 0 and no
// constructors have been run. **THIS MEANS THAT THE OBJECT MAY NOT BE IN A STATE
// CONSISTENT WITH ITS INTERNAL REQUIREMENTS** This method should only be used for
// deserialization when the user intends to immediately populate all fields. This method
// will not create an unitialized string because it is non-sensical to create an empty
// instance of an immutable type.
//
public static Object GetUninitializedObject(Type type)
{
if ((object)type == null)
{
throw new ArgumentNullException(nameof(type));
}
Contract.EndContractBlock();
if (!(type is RuntimeType))
{
throw new SerializationException(SR.Format(SR.Serialization_InvalidType, type.ToString()));
}
return nativeGetUninitializedObject((RuntimeType)type);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern Object nativeGetUninitializedObject(RuntimeType type);
}
}
|
// 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.
/*============================================================
**
**
**
** Purpose: Provides some static methods to aid with the implementation
** of a Formatter for Serialization.
**
**
============================================================*/
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Security;
using System.Runtime.Remoting;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Diagnostics.Contracts;
namespace System.Runtime.Serialization
{
internal static class FormatterServices
{
// Gets a new instance of the object. The entire object is initalized to 0 and no
// constructors have been run. **THIS MEANS THAT THE OBJECT MAY NOT BE IN A STATE
// CONSISTENT WITH ITS INTERNAL REQUIREMENTS** This method should only be used for
// deserialization when the user intends to immediately populate all fields. This method
// will not create an unitialized string because it is non-sensical to create an empty
// instance of an immutable type.
//
public static Object GetUninitializedObject(Type type)
{
if ((object)type == null)
{
throw new ArgumentNullException(nameof(type));
}
Contract.EndContractBlock();
if (!(type is RuntimeType))
{
throw new SerializationException(SR.Format(SR.Serialization_InvalidType, type.ToString()));
}
return nativeGetUninitializedObject((RuntimeType)type);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern Object nativeGetUninitializedObject(RuntimeType type);
private static Binder s_binder = Type.DefaultBinder;
/*============================LoadAssemblyFromString============================
**Action: Loads an assembly from a given string. The current assembly loading story
** is quite confusing. If the assembly is in the fusion cache, we can load it
** using the stringized-name which we transmitted over the wire. If that fails,
** we try for a lookup of the assembly using the simple name which is the first
** part of the assembly name. If we can't find it that way, we'll return null
** as our failure result.
**Returns: The loaded assembly or null if it can't be found.
**Arguments: assemblyName -- The stringized assembly name.
**Exceptions: None
==============================================================================*/
internal static Assembly LoadAssemblyFromString(String assemblyName)
{
//
// Try using the stringized assembly name to load from the fusion cache.
//
BCLDebug.Trace("SER", "[LoadAssemblyFromString]Looking for assembly: ", assemblyName);
Assembly found = Assembly.Load(assemblyName);
return found;
}
}
}
|
mit
|
C#
|
70ea2df33413fba59cca2a20abe64246ad1672c9
|
Update ContentItem.cs
|
DonnotRain/Orchard,bedegaming-aleksej/Orchard,ehe888/Orchard,aaronamm/Orchard,jagraz/Orchard,huoxudong125/Orchard,jtkech/Orchard,spraiin/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,xiaobudian/Orchard,fassetar/Orchard,johnnyqian/Orchard,Serlead/Orchard,li0803/Orchard,Fogolan/OrchardForWork,li0803/Orchard,jtkech/Orchard,Serlead/Orchard,geertdoornbos/Orchard,brownjordaninternational/OrchardCMS,omidnasri/Orchard,qt1/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,TalaveraTechnologySolutions/Orchard,fassetar/Orchard,fortunearterial/Orchard,xiaobudian/Orchard,JRKelso/Orchard,grapto/Orchard.CloudBust,JRKelso/Orchard,yersans/Orchard,neTp9c/Orchard,kgacova/Orchard,kouweizhong/Orchard,xkproject/Orchard,infofromca/Orchard,Codinlab/Orchard,cooclsee/Orchard,planetClaire/Orchard-LETS,escofieldnaxos/Orchard,fortunearterial/Orchard,jchenga/Orchard,SouleDesigns/SouleDesigns.Orchard,LaserSrl/Orchard,brownjordaninternational/OrchardCMS,SeyDutch/Airbrush,omidnasri/Orchard,kouweizhong/Orchard,abhishekluv/Orchard,alejandroaldana/Orchard,TalaveraTechnologySolutions/Orchard,Dolphinsimon/Orchard,sfmskywalker/Orchard,hannan-azam/Orchard,li0803/Orchard,SouleDesigns/SouleDesigns.Orchard,RoyalVeterinaryCollege/Orchard,ehe888/Orchard,armanforghani/Orchard,dburriss/Orchard,johnnyqian/Orchard,emretiryaki/Orchard,Codinlab/Orchard,RoyalVeterinaryCollege/Orchard,hannan-azam/Orchard,bedegaming-aleksej/Orchard,hannan-azam/Orchard,Serlead/Orchard,rtpHarry/Orchard,yersans/Orchard,sfmskywalker/Orchard,Codinlab/Orchard,omidnasri/Orchard,gcsuk/Orchard,SzymonSel/Orchard,SzymonSel/Orchard,SouleDesigns/SouleDesigns.Orchard,jersiovic/Orchard,jersiovic/Orchard,fassetar/Orchard,aaronamm/Orchard,kouweizhong/Orchard,AdvantageCS/Orchard,Sylapse/Orchard.HttpAuthSample,vairam-svs/Orchard,escofieldnaxos/Orchard,TaiAivaras/Orchard,qt1/Orchard,rtpHarry/Orchard,DonnotRain/Orchard,jersiovic/Orchard,omidnasri/Orchard,sfmskywalker/Orchard,armanforghani/Orchard,spraiin/Orchard,Lombiq/Orchard,AdvantageCS/Orchard,abhishekluv/Orchard,bedegaming-aleksej/Orchard,yersans/Orchard,TaiAivaras/Orchard,yonglehou/Orchard,jchenga/Orchard,grapto/Orchard.CloudBust,OrchardCMS/Orchard,brownjordaninternational/OrchardCMS,SeyDutch/Airbrush,kgacova/Orchard,omidnasri/Orchard,jagraz/Orchard,johnnyqian/Orchard,Dolphinsimon/Orchard,phillipsj/Orchard,spraiin/Orchard,infofromca/Orchard,Ermesx/Orchard,Praggie/Orchard,armanforghani/Orchard,oxwanawxo/Orchard,alejandroaldana/Orchard,li0803/Orchard,Ermesx/Orchard,geertdoornbos/Orchard,qt1/Orchard,omidnasri/Orchard,fortunearterial/Orchard,jagraz/Orchard,IDeliverable/Orchard,hbulzy/Orchard,Praggie/Orchard,aaronamm/Orchard,hbulzy/Orchard,Lombiq/Orchard,vairam-svs/Orchard,geertdoornbos/Orchard,dburriss/Orchard,openbizgit/Orchard,dburriss/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,planetClaire/Orchard-LETS,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,OrchardCMS/Orchard,hannan-azam/Orchard,dcinzona/Orchard,jimasp/Orchard,Fogolan/OrchardForWork,openbizgit/Orchard,DonnotRain/Orchard,DonnotRain/Orchard,aaronamm/Orchard,mvarblow/Orchard,TalaveraTechnologySolutions/Orchard,Serlead/Orchard,planetClaire/Orchard-LETS,kouweizhong/Orchard,OrchardCMS/Orchard,rtpHarry/Orchard,fortunearterial/Orchard,ehe888/Orchard,jtkech/Orchard,xkproject/Orchard,RoyalVeterinaryCollege/Orchard,SouleDesigns/SouleDesigns.Orchard,planetClaire/Orchard-LETS,openbizgit/Orchard,armanforghani/Orchard,oxwanawxo/Orchard,Praggie/Orchard,jchenga/Orchard,vairam-svs/Orchard,LaserSrl/Orchard,Serlead/Orchard,RoyalVeterinaryCollege/Orchard,sfmskywalker/Orchard,TaiAivaras/Orchard,huoxudong125/Orchard,xkproject/Orchard,TalaveraTechnologySolutions/Orchard,xkproject/Orchard,Praggie/Orchard,sfmskywalker/Orchard,dburriss/Orchard,JRKelso/Orchard,omidnasri/Orchard,Ermesx/Orchard,neTp9c/Orchard,DonnotRain/Orchard,oxwanawxo/Orchard,grapto/Orchard.CloudBust,neTp9c/Orchard,SzymonSel/Orchard,xiaobudian/Orchard,IDeliverable/Orchard,hbulzy/Orchard,Codinlab/Orchard,grapto/Orchard.CloudBust,OrchardCMS/Orchard,tobydodds/folklife,jimasp/Orchard,TaiAivaras/Orchard,yonglehou/Orchard,cooclsee/Orchard,xkproject/Orchard,jimasp/Orchard,huoxudong125/Orchard,dcinzona/Orchard,xiaobudian/Orchard,huoxudong125/Orchard,Sylapse/Orchard.HttpAuthSample,escofieldnaxos/Orchard,Fogolan/OrchardForWork,alejandroaldana/Orchard,Lombiq/Orchard,abhishekluv/Orchard,escofieldnaxos/Orchard,geertdoornbos/Orchard,infofromca/Orchard,emretiryaki/Orchard,mvarblow/Orchard,Dolphinsimon/Orchard,LaserSrl/Orchard,abhishekluv/Orchard,brownjordaninternational/OrchardCMS,hbulzy/Orchard,cooclsee/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,bedegaming-aleksej/Orchard,SeyDutch/Airbrush,Sylapse/Orchard.HttpAuthSample,tobydodds/folklife,sfmskywalker/Orchard,abhishekluv/Orchard,vairam-svs/Orchard,oxwanawxo/Orchard,tobydodds/folklife,alejandroaldana/Orchard,IDeliverable/Orchard,planetClaire/Orchard-LETS,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,gcsuk/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,gcsuk/Orchard,mvarblow/Orchard,gcsuk/Orchard,vairam-svs/Orchard,SeyDutch/Airbrush,hbulzy/Orchard,Lombiq/Orchard,phillipsj/Orchard,openbizgit/Orchard,LaserSrl/Orchard,mvarblow/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,yonglehou/Orchard,jimasp/Orchard,johnnyqian/Orchard,dcinzona/Orchard,Codinlab/Orchard,RoyalVeterinaryCollege/Orchard,SouleDesigns/SouleDesigns.Orchard,kgacova/Orchard,emretiryaki/Orchard,jagraz/Orchard,IDeliverable/Orchard,jchenga/Orchard,AdvantageCS/Orchard,fassetar/Orchard,cooclsee/Orchard,dozoft/Orchard,TalaveraTechnologySolutions/Orchard,emretiryaki/Orchard,JRKelso/Orchard,oxwanawxo/Orchard,emretiryaki/Orchard,yersans/Orchard,grapto/Orchard.CloudBust,huoxudong125/Orchard,Sylapse/Orchard.HttpAuthSample,dburriss/Orchard,jchenga/Orchard,openbizgit/Orchard,TalaveraTechnologySolutions/Orchard,dozoft/Orchard,IDeliverable/Orchard,spraiin/Orchard,dozoft/Orchard,omidnasri/Orchard,aaronamm/Orchard,spraiin/Orchard,tobydodds/folklife,AdvantageCS/Orchard,gcsuk/Orchard,geertdoornbos/Orchard,fassetar/Orchard,SzymonSel/Orchard,rtpHarry/Orchard,SzymonSel/Orchard,yonglehou/Orchard,LaserSrl/Orchard,bedegaming-aleksej/Orchard,OrchardCMS/Orchard,jtkech/Orchard,grapto/Orchard.CloudBust,jersiovic/Orchard,dozoft/Orchard,TaiAivaras/Orchard,tobydodds/folklife,abhishekluv/Orchard,kouweizhong/Orchard,phillipsj/Orchard,dozoft/Orchard,fortunearterial/Orchard,AdvantageCS/Orchard,neTp9c/Orchard,Dolphinsimon/Orchard,qt1/Orchard,johnnyqian/Orchard,alejandroaldana/Orchard,Fogolan/OrchardForWork,ehe888/Orchard,Sylapse/Orchard.HttpAuthSample,cooclsee/Orchard,xiaobudian/Orchard,TalaveraTechnologySolutions/Orchard,dcinzona/Orchard,sfmskywalker/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,escofieldnaxos/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,Lombiq/Orchard,jtkech/Orchard,jersiovic/Orchard,infofromca/Orchard,armanforghani/Orchard,yonglehou/Orchard,omidnasri/Orchard,kgacova/Orchard,neTp9c/Orchard,phillipsj/Orchard,phillipsj/Orchard,dcinzona/Orchard,yersans/Orchard,rtpHarry/Orchard,Ermesx/Orchard,infofromca/Orchard,kgacova/Orchard,Ermesx/Orchard,SeyDutch/Airbrush,Dolphinsimon/Orchard,mvarblow/Orchard,Praggie/Orchard,brownjordaninternational/OrchardCMS,TalaveraTechnologySolutions/Orchard,JRKelso/Orchard,jagraz/Orchard,jimasp/Orchard,sfmskywalker/Orchard,li0803/Orchard,qt1/Orchard,Fogolan/OrchardForWork,ehe888/Orchard,tobydodds/folklife,hannan-azam/Orchard
|
src/Orchard/ContentManagement/ContentItem.cs
|
src/Orchard/ContentManagement/ContentItem.cs
|
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.Records;
namespace Orchard.ContentManagement {
public class ContentItem : DynamicObject, IContent {
public ContentItem() {
_parts = new List<ContentPart>();
}
private readonly IList<ContentPart> _parts;
ContentItem IContent.ContentItem { get { return this; } }
public int Id { get { return Record == null ? 0 : Record.Id; } }
public int Version { get { return VersionRecord == null ? 0 : VersionRecord.Number; } }
public string ContentType { get; set; }
public ContentTypeDefinition TypeDefinition { get; set; }
public ContentItemRecord Record { get { return VersionRecord == null ? null : VersionRecord.ContentItemRecord; } }
public ContentItemVersionRecord VersionRecord { get; set; }
public IEnumerable<ContentPart> Parts { get { return _parts; } }
public IContentManager ContentManager { get; set; }
public bool Has(Type partType) {
return partType == typeof(ContentItem) || _parts.Any(partType.IsInstanceOfType);
}
public IContent Get(Type partType) {
if (partType == typeof(ContentItem))
return this;
return _parts.FirstOrDefault(partType.IsInstanceOfType);
}
public void Weld(ContentPart part) {
part.ContentItem = this;
_parts.Add(part);
}
public override bool TryGetMember(GetMemberBinder binder, out object result) {
var found = base.TryGetMember(binder, out result);
if (!found) {
foreach (var part in Parts) {
if (part.PartDefinition.Name == binder.Name) {
result = part;
return true;
}
}
result = null;
return true;
}
return true;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.Records;
namespace Orchard.ContentManagement {
public class ContentItem : DynamicObject, IContent {
public ContentItem() {
_parts = new List<ContentPart>();
}
private readonly IList<ContentPart> _parts;
ContentItem IContent.ContentItem { get { return this; } }
public int Id { get { return Record == null ? 0 : Record.Id; } }
public int Version { get { return VersionRecord == null ? 0 : VersionRecord.Number; } }
public string ContentType { get; set; }
public ContentTypeDefinition TypeDefinition { get; set; }
public ContentItemRecord Record { get { return VersionRecord == null ? null : VersionRecord.ContentItemRecord; } }
public ContentItemVersionRecord VersionRecord { get; set; }
public IEnumerable<ContentPart> Parts { get { return _parts; } }
public IContentManager ContentManager { get; set; }
public bool Has(Type partType) {
return partType == typeof(ContentItem) || _parts.Any(partType.IsInstanceOfType);
}
public IContent Get(Type partType) {
if (partType == typeof(ContentItem))
return this;
return _parts.FirstOrDefault(partType.IsInstanceOfType);
}
public void Weld(ContentPart part) {
part.ContentItem = this;
_parts.Add(part);
}
public override bool TryGetMember(GetMemberBinder binder, out object result) {
var found = base.TryGetMember(binder, out result);
if (!found) {
foreach (var part in Parts) {
if (part.PartDefinition.Name == binder.Name) {
result = part;
return true;
}
}
return false;
}
return true;
}
}
}
|
bsd-3-clause
|
C#
|
1649337800d009eb67a050a6887dda3dcebe9d4c
|
increase version number
|
hillin/gettime
|
Source/Properties/AssemblyInfo.cs
|
Source/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("GetTime")]
[assembly: AssemblyDescription("A command line utility to get time")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hillinworks")]
[assembly: AssemblyProduct("Hillinworks.Utilities")]
[assembly: AssemblyCopyright("Copyright © 2017 Hillinworks")]
[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("a34cd3de-8319-4dfb-b25d-b107880ac967")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GetTime")]
[assembly: AssemblyDescription("A command line utility to get time")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hillinworks")]
[assembly: AssemblyProduct("Hillinworks.Utilities")]
[assembly: AssemblyCopyright("Copyright © 2017 Hillinworks")]
[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("a34cd3de-8319-4dfb-b25d-b107880ac967")]
// 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#
|
60dbc41894d76710d711b6061c638cca170e66a3
|
Change to version number for 1.0 Release
|
Statyk7/log2console
|
src/Log2Console/Properties/AssemblyInfo.cs
|
src/Log2Console/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("Log2Console")]
[assembly: AssemblyDescription("Log2Console is an advanced log message viewer for log4net, log4j and log4cxx.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Remy Baudet aka Statyk7")]
[assembly: AssemblyProduct("Log2Console")]
[assembly: AssemblyCopyright("Copyright © Remy Baudet 2007")]
[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("d9e8e589-75a9-4851-9ca5-f10f0522aa37")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.1009.1")]
[assembly: AssemblyFileVersion("1.0.1009.1")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Log2Console")]
[assembly: AssemblyDescription("Log2Console is an advanced log message viewer for log4net, log4j and log4cxx.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Remy Baudet aka Statyk7")]
[assembly: AssemblyProduct("Log2Console")]
[assembly: AssemblyCopyright("Copyright © Remy Baudet 2007")]
[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("d9e8e589-75a9-4851-9ca5-f10f0522aa37")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.2.3307.13")]
[assembly: AssemblyFileVersion("0.2.3307.13")]
|
bsd-3-clause
|
C#
|
a1109289fe78d583cf8e4c3f582edacedc29b2b2
|
add test for server start/stop events
|
rjw57/streamkinect2.net
|
StreamKinect2Tests/ServerTests.cs
|
StreamKinect2Tests/ServerTests.cs
|
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using StreamKinect2;
using System.Threading;
using System.Collections.Generic;
using System;
using StreamKinect2Tests.Mocks;
namespace StreamKinect2Tests
{
[TestClass]
public class StoppedServerTests
{
// Re-initialised for each test
private Server m_server;
// Should be passed to Server.Start()
private IZeroconfServiceBrowser m_mockZcBrowser;
[TestInitialize]
public void Initialize()
{
m_server = new Server();
m_mockZcBrowser = new MockZeroconfServiceBrowser();
}
[TestCleanup]
public void Cleanup()
{
// Dispose server
m_server.Dispose();
m_server = null;
}
[TestMethod]
public void ServerInitialized()
{
Assert.IsNotNull(m_server);
}
[TestMethod]
public void ServerDoesNotStartImmediately()
{
Assert.IsFalse(m_server.IsRunning);
}
[TestMethod, Timeout(3000)]
public void ServerDoesStartEventually()
{
Assert.IsFalse(m_server.IsRunning);
m_server.Start(m_mockZcBrowser);
while (!m_server.IsRunning) { Thread.Sleep(100); }
m_server.Stop();
}
[TestMethod, Timeout(3000)]
public void ServerFiresStartedAndStoppedEvents()
{
Assert.IsFalse(m_server.IsRunning);
int startedCalls = 0, stoppedCalls = 0;
m_server.Started += (Server s) => startedCalls += 1;
m_server.Stopped += (Server s) => stoppedCalls += 1;
Debug.WriteLine("Starting server.");
m_server.Start(m_mockZcBrowser);
while (startedCalls==0)
{
Debug.WriteLine("startedCalls = " + startedCalls);
Thread.Sleep(100);
}
Debug.WriteLine("Stopping server.");
m_server.Stop();
while (stoppedCalls == 0)
{
Debug.WriteLine("stoppedCalls = " + stoppedCalls);
Thread.Sleep(100);
}
Assert.AreEqual(1, startedCalls);
Assert.AreEqual(1, stoppedCalls);
}
}
}
|
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using StreamKinect2;
using System.Threading;
using System.Collections.Generic;
using System;
using StreamKinect2Tests.Mocks;
namespace StreamKinect2Tests
{
[TestClass]
public class StoppedServerTests
{
// Re-initialised for each test
private Server m_server;
// Should be passed to Server.Start()
private IZeroconfServiceBrowser m_mockZcBrowser;
[TestInitialize]
public void Initialize()
{
m_server = new Server();
m_mockZcBrowser = new MockZeroconfServiceBrowser();
}
[TestCleanup]
public void Cleanup()
{
// Dispose server
m_server.Dispose();
m_server = null;
}
[TestMethod]
public void ServerInitialized()
{
Assert.IsNotNull(m_server);
}
[TestMethod]
public void ServerDoesNotStartImmediately()
{
Assert.IsFalse(m_server.IsRunning);
}
[TestMethod, Timeout(3000)]
public void ServerDoesStartEventually()
{
Assert.IsFalse(m_server.IsRunning);
m_server.Start(m_mockZcBrowser);
while (!m_server.IsRunning) { Thread.Sleep(100); }
m_server.Stop();
}
}
}
|
bsd-2-clause
|
C#
|
85c9ba8ced5cf0ebda52a1e76e7e0d30e7fc2f58
|
Bump version
|
canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor
|
src/SyncTrayzor/Properties/AssemblyInfo.cs
|
src/SyncTrayzor/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SyncTrayzor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SyncTrayzor")]
[assembly: AssemblyCopyright("Copyright © Antony Male 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.9.0")]
[assembly: AssemblyFileVersion("1.0.9.0")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SyncTrayzor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SyncTrayzor")]
[assembly: AssemblyCopyright("Copyright © Antony Male 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.8.0")]
[assembly: AssemblyFileVersion("1.0.8.0")]
|
mit
|
C#
|
6d6975ca3a61f10c53a0c01bb56947804b44ff17
|
Add tests for FY handling
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
Battery-Commander.Tests/FiscalYearTests.cs
|
Battery-Commander.Tests/FiscalYearTests.cs
|
using BatteryCommander.Web.Models;
using System;
using System.Collections.Generic;
using Xunit;
using BatteryCommander.Web.Services;
namespace BatteryCommander.Tests
{
public class FiscalYearTests
{
[Fact]
public void Check_FY_2017_Start()
{
Assert.Equal(new DateTime(2016, 10, 1), FiscalYear.FY2017.Start());
}
[Fact]
public void Check_FY_2017_Next()
{
Assert.Equal(FiscalYear.FY2018, FiscalYear.FY2017.Next());
}
[Fact]
public void Check_FY_2017_End()
{
Assert.Equal(new DateTime(2017, 9, 30), FiscalYear.FY2017.End());
}
}
}
|
using BatteryCommander.Web.Models;
using System;
using System.Collections.Generic;
using Xunit;
namespace BatteryCommander.Tests
{
public class FiscalYearTests
{
[Fact]
public void Check_FY_2017_Start()
{
}
}
}
|
mit
|
C#
|
ba01b50f36f42db639c3f74feea961c401ed4aa9
|
increase the internal number of the assembly
|
TUD-INF-IAI-MCI/BrailleIO,TUD-INF-IAI-MCI/BrailleIO,TUD-INF-IAI-MCI/BrailleIO,TUD-INF-IAI-MCI/BrailleIO
|
BrailleRenderer/Properties/AssemblyInfo.cs
|
BrailleRenderer/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("BrailleRenderer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("TU Dresden, Germany")]
[assembly: AssemblyProduct("BrailleRenderer")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("7a910834-5370-42af-9938-06c7a2b8ef90")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("BrailleRenderer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("TU Dresden, Germany")]
[assembly: AssemblyProduct("BrailleRenderer")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("7a910834-5370-42af-9938-06c7a2b8ef90")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
bsd-2-clause
|
C#
|
3b15b7b73390591ee18a0d542faa157ddcc0d1bd
|
Update QueryableExtensions.cs
|
keith-hall/Extensions,keith-hall/Extensions
|
src/QueryableExtensions.cs
|
src/QueryableExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace HallLibrary.Extensions
{
/// <summary>
/// Contains static methods for working with queryables.
/// </summary>
public static class QueryableExtensions
{
/// <summary>
/// Returns a single value from the specified <paramref name="queryable"/>, or throws an Exception if it contains no or multiple values.
/// </summary>
/// <typeparam name="T">The type of elements in the queryable.</typeparam>
/// <param name="queryable">The queryable sequence to get the single value of.</param>
/// <returns>Returns the single value from the specified <paramref name="queryable"/>, using the most efficient method possible to determine that it is a single value.</returns>
/// <remarks>More efficient than the built in LINQ to SQL "Single" method, because this one takes the minimum number of results necessary to determine if the queryable contains a single value or not.</remarks>
/// <exception cref="InvalidOperationException"><paramref name="queryable" /> contains 0 or more than 1 element.</exception>
public static T EnsureSingle<T>(this IQueryable<T> queryable)
{
// note that this is possible because if only one element exists, the Take will only return 1, and by only taking a maximum of 2 elements, we are not unnecessarily extracting more data than we need from the queryable.
return queryable.Take(2).Single();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace HallLibrary.Extensions
{
/// <summary>
/// Contains static methods for working with queryables.
/// </summary>
public static class QueryableExtensions
{
/// <summary>
/// Returns a single value from the specified <paramref name="queryable"/>, or throws an Exception if it contains no or multiple values.
/// </summary>
/// <typeparam name="T">The type of elements in the queryable.</typeparam>
/// <param name="queryable">The queryable sequence to get the single value of.</param>
/// <returns>Returns the single value from the specified <paramref name="queryable"/>, using the most efficient method possible to determine that it is a single value.</returns>
/// <remarks>More efficient than the built in LINQ to SQL "Single" method, because this one takes the minimum number of results necessary to determine if the queryable contains a single value or not.</remarks>
/// <exception cref="InvalidOperationException"><paramref name="queryable" /> contains 0 or more than 1 element.</exception>
public static T EnsureSingle<T>(this IQueryable<T> queryable)
{
return queryable.Take(2).Single();
}
}
}
|
apache-2.0
|
C#
|
538e067bded5f35872be65282b409f4be1c1a4ef
|
change noteId by id
|
orodriguez/FTF,orodriguez/FTF,orodriguez/FTF
|
FTF.Api.Web/Controllers/NotesController.cs
|
FTF.Api.Web/Controllers/NotesController.cs
|
using System.Collections.Generic;
using System.Web.Http;
using FTF.Api.Requests.Notes;
using FTF.Api.Responses;
using FTF.Api.Services;
namespace FTF.Api.Web.Controllers
{
public class NotesController : ApiController
{
private readonly INotesService _notes;
public NotesController(INotesService notes)
{
_notes = notes;
}
public int Post(CreateRequest request) => _notes.Create(request);
public INote Get(int id) => _notes.Retrieve(id);
public void Update(int id, UpdateRequest request) => _notes.Update(id, request);
public void Delete(int id) => _notes.Delete(id);
public IEnumerable<INote> Get() => _notes.All();
public IEnumerable<INote> Get(string tagName) => _notes.ByTag(tagName);
}
}
|
using System.Collections.Generic;
using System.Web.Http;
using FTF.Api.Requests.Notes;
using FTF.Api.Responses;
using FTF.Api.Services;
namespace FTF.Api.Web.Controllers
{
public class NotesController : ApiController
{
private readonly INotesService _notes;
public NotesController(INotesService notes)
{
_notes = notes;
}
public int Post(CreateRequest request) => _notes.Create(request);
public INote Get(int noteId) => _notes.Retrieve(noteId);
public void Update(int id, UpdateRequest request) => _notes.Update(id, request);
public void Delete(int noteId) => _notes.Delete(noteId);
public IEnumerable<INote> Get() => _notes.All();
public IEnumerable<INote> Get(string tagName) => _notes.ByTag(tagName);
}
}
|
mit
|
C#
|
de7dd29d791304fe588ae1f297ecff8e128168c4
|
Add "Nominations" and "Updated" sorting criteria in beatmap listing
|
peppy/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu,ppy/osu
|
osu.Game/Overlays/BeatmapListing/SortCriteria.cs
|
osu.Game/Overlays/BeatmapListing/SortCriteria.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.BeatmapListing
{
public enum SortCriteria
{
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingTitle))]
Title,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingArtist))]
Artist,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingDifficulty))]
Difficulty,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingUpdated))]
Updated,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingRanked))]
Ranked,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingRating))]
Rating,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingPlays))]
Plays,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingFavourites))]
Favourites,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingRelevance))]
Relevance,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingNominations))]
Nominations,
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.BeatmapListing
{
public enum SortCriteria
{
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingTitle))]
Title,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingArtist))]
Artist,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingDifficulty))]
Difficulty,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingRanked))]
Ranked,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingRating))]
Rating,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingPlays))]
Plays,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingFavourites))]
Favourites,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingRelevance))]
Relevance
}
}
|
mit
|
C#
|
2ae479fbd1742ac91a93c34d080cc9db2cd8872c
|
Hide TabControl's dropdown's header when no items are inside the dropdown.
|
EVAST9919/osu-framework,paparony03/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,naoey/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,paparony03/osu-framework,default0/osu-framework,RedNesto/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,Tom94/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework,naoey/osu-framework,Nabile-Rahmani/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,default0/osu-framework
|
osu.Framework/Graphics/UserInterface/Tab/TabDropDownMenu.cs
|
osu.Framework/Graphics/UserInterface/Tab/TabDropDownMenu.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Linq;
namespace osu.Framework.Graphics.UserInterface.Tab
{
public abstract class TabDropDownMenu<T> : DropDownMenu<T>
{
protected TabDropDownMenu()
{
RelativeSizeAxes = Axes.X;
Header.Anchor = Anchor.TopRight;
Header.Origin = Anchor.TopRight;
ContentContainer.Anchor = Anchor.TopRight;
ContentContainer.Origin = Anchor.TopRight;
}
internal float HeaderHeight
{
get { return Header.DrawHeight; }
set { Header.Height = value; }
}
internal float HeaderWidth
{
get { return Header.DrawWidth; }
set { Header.Width = value; }
}
internal void HideItem(T val)
{
int index;
if (ItemDictionary.TryGetValue(val, out index))
ItemList[index]?.Hide();
updateAlphaVisibility();
}
internal void ShowItem(T val)
{
int index;
if (ItemDictionary.TryGetValue(val, out index))
ItemList[index]?.Show();
updateAlphaVisibility();
}
private void updateAlphaVisibility() => Header.Alpha = ItemList.Any(i => i.IsPresent) ? 1 : 0;
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
// TODO: Hide header when no items in dropdown
namespace osu.Framework.Graphics.UserInterface.Tab
{
public abstract class TabDropDownMenu<T> : DropDownMenu<T>
{
protected TabDropDownMenu()
{
RelativeSizeAxes = Axes.X;
Header.Anchor = Anchor.TopRight;
Header.Origin = Anchor.TopRight;
ContentContainer.Anchor = Anchor.TopRight;
ContentContainer.Origin = Anchor.TopRight;
}
internal float HeaderHeight
{
get { return Header.DrawHeight; }
set { Header.Height = value; }
}
internal float HeaderWidth
{
get { return Header.DrawWidth; }
set { Header.Width = value; }
}
internal void HideItem(T val)
{
int index;
if (ItemDictionary.TryGetValue(val, out index))
ItemList[index]?.Hide();
}
internal void ShowItem(T val)
{
int index;
if (ItemDictionary.TryGetValue(val, out index))
ItemList[index]?.Show();
}
}
}
|
mit
|
C#
|
bffde3c9984e8f32df55986e53ca40e4ead76d67
|
Allow ExcludeFromDynamicCompile on enums
|
peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework
|
osu.Framework/Testing/ExcludeFromDynamicCompileAttribute.cs
|
osu.Framework/Testing/ExcludeFromDynamicCompileAttribute.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;
namespace osu.Framework.Testing
{
/// <summary>
/// Indicates that a type should be excluded from dynamic compilation. Does not affect derived types.
/// </summary>
/// <remarks>
/// This should be used as sparingly as possible for cases where compiling a type changes fundamental testing components (e.g. <see cref="TestBrowser"/>).
/// </remarks>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Enum, Inherited = false)]
public class ExcludeFromDynamicCompileAttribute : Attribute
{
}
}
|
// 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;
namespace osu.Framework.Testing
{
/// <summary>
/// Indicates that a type should be excluded from dynamic compilation. Does not affect derived types.
/// </summary>
/// <remarks>
/// This should be used as sparingly as possible for cases where compiling a type changes fundamental testing components (e.g. <see cref="TestBrowser"/>).
/// </remarks>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
public class ExcludeFromDynamicCompileAttribute : Attribute
{
}
}
|
mit
|
C#
|
9005bce0fa574ec9be7661bbeb5029e1ad8797fc
|
Add "counter" keyword for key overlay setting
|
ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu
|
osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs
|
osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.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.Localisation;
using osu.Game.Configuration;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Settings.Sections.Gameplay
{
public class HUDSettings : SettingsSubsection
{
protected override LocalisableString Header => GameplaySettingsStrings.HUDHeader;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SettingsEnumDropdown<HUDVisibilityMode>
{
LabelText = GameplaySettingsStrings.HUDVisibilityMode,
Current = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode)
},
new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.ShowDifficultyGraph,
Current = config.GetBindable<bool>(OsuSetting.ShowProgressGraph)
},
new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,
Current = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
Keywords = new[] { "hp", "bar" }
},
new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.AlwaysShowKeyOverlay,
Current = config.GetBindable<bool>(OsuSetting.KeyOverlay),
Keywords = new[] { "counter" },
},
};
}
}
}
|
// 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.Localisation;
using osu.Game.Configuration;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Settings.Sections.Gameplay
{
public class HUDSettings : SettingsSubsection
{
protected override LocalisableString Header => GameplaySettingsStrings.HUDHeader;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SettingsEnumDropdown<HUDVisibilityMode>
{
LabelText = GameplaySettingsStrings.HUDVisibilityMode,
Current = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode)
},
new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.ShowDifficultyGraph,
Current = config.GetBindable<bool>(OsuSetting.ShowProgressGraph)
},
new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,
Current = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
Keywords = new[] { "hp", "bar" }
},
new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.AlwaysShowKeyOverlay,
Current = config.GetBindable<bool>(OsuSetting.KeyOverlay)
},
};
}
}
}
|
mit
|
C#
|
0fb8ba89583fd4f44246a3a6732bd4214d129ef7
|
Remove backing types
|
mstrother/BmpListener
|
BMPClient/BGP/BGP.cs
|
BMPClient/BGP/BGP.cs
|
using System;
namespace BmpListener.Bgp
{
public enum AddressFamily
{
IPv4 = 1,
IPv6,
L2VPN = 25
}
[Flags]
public enum AttributeFlags
{
EXTENDED_LENGTH = 1 << 4,
PARTIAL = 1 << 5,
TRANSITIVE = 1 << 6,
OPTIONAL = 1 << 7
}
public enum AttributeType
{
ORIGIN = 1,
AS_PATH,
NEXT_HOP,
MULTI_EXIT_DISC,
LOCAL_PREF,
ATOMIC_AGGREGATE,
AGGREGATOR,
COMMUNITY,
ORIGINATOR_ID,
CLUSTER_LIST,
MP_REACH_NLRI = 14,
MP_UNREACH_NLRI,
EXTENDED_COMMUNITIES,
AS4_PATH,
AS4_AGGREGATOR,
PMSI_TUNNEL = 22,
TUNNEL_ENCAP,
AIGP = 26,
LARGE_COMMUNITY = 32
}
public enum MessageType
{
Open = 1,
Update,
Notification,
Keepalive,
RouteRefresh
}
public enum Origin
{
IGP,
EGP,
Incomplete
}
public enum SegmentType
{
AS_SET = 1,
AS_SEQUENCE,
AS_CONFED_SEQUENCE,
AS_CONFED_SET
}
public enum SubsequentAddressFamily
{
Unicast = 1,
Multicast = 2
}
}
|
using System;
namespace BmpListener.Bgp
{
public enum AddressFamily
{
IPv4 = 1,
IPv6,
L2VPN = 25
}
[Flags]
public enum AttributeFlags : byte
{
EXTENDED_LENGTH = 1 << 4,
PARTIAL = 1 << 5,
TRANSITIVE = 1 << 6,
OPTIONAL = 1 << 7
}
public enum AttributeType
{
ORIGIN = 1,
AS_PATH,
NEXT_HOP,
MULTI_EXIT_DISC,
LOCAL_PREF,
ATOMIC_AGGREGATE,
AGGREGATOR,
COMMUNITY,
ORIGINATOR_ID,
CLUSTER_LIST,
MP_REACH_NLRI = 14,
MP_UNREACH_NLRI,
EXTENDED_COMMUNITIES,
AS4_PATH,
AS4_AGGREGATOR,
PMSI_TUNNEL = 22,
TUNNEL_ENCAP,
AIGP = 26,
LARGE_COMMUNITY = 32
}
public enum MessageType
{
Open = 1,
Update,
Notification,
Keepalive,
RouteRefresh
}
public enum Origin : byte
{
IGP,
EGP,
Incomplete
}
public enum SegmentType : byte
{
AS_SET = 1,
AS_SEQUENCE,
AS_CONFED_SEQUENCE,
AS_CONFED_SET
}
public enum SubsequentAddressFamily : byte
{
Unicast = 1,
Multicast = 2
}
}
|
mit
|
C#
|
aeb023b752f20589aaae5fcab0751b9b55390600
|
fix few bugs
|
PeterXUYAOHAI/DataTrek-VR
|
Assets/dataCreator.cs
|
Assets/dataCreator.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = System.Random;
public class dataCreator : MonoBehaviour {
public GameObject ball;
public GameObject cube;
public GameObject capsule;
// Use this for initialization
void Start () {
Physics.gravity = new Vector3(0,0,0);
float scale = 60;
int number = 2000;
Random rnd = new Random ();
for (int i = 0; i < number; i++) {
Instantiate (ball, new Vector3 ((float)(103 + rnd.NextDouble()*scale), (float)(103 + rnd.NextDouble()*scale), (float)(103 + rnd.NextDouble()*scale)), Quaternion.identity);
Instantiate(cube, new Vector3 ((float)(60 + rnd.NextDouble()*scale), (float)(60 + rnd.NextDouble()*scale), (float)(97 + rnd.NextDouble()*scale)), Quaternion.identity);
Instantiate(capsule, new Vector3 ((float)(93 + rnd.NextDouble()*scale), (float)(70 + rnd.NextDouble()*scale), (float)(70 + rnd.NextDouble()*scale)), Quaternion.identity);
}
// Instantiate (ball, transform.position, transform.rotation);
}
// Update is called once per frame
void Update () {
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = System.Random;
public class dataCreator : MonoBehaviour {
public GameObject ball;
public GameObject cube;
public GameObject capsule;
// Use this for initialization
void Start () {
Physics.gravity = new Vector3(0,0,0);
float scale = 50;
int number = 800;
Random rnd = new Random ();
for (int i = 0; i < number; i++) {
Instantiate (ball, new Vector3 ((float)(101 + rnd.NextDouble()*scale), (float)(101 + rnd.NextDouble()*scale), (float)(101 + rnd.NextDouble()*scale)), Quaternion.identity);
Instantiate(cube, new Vector3 ((float)(99 + rnd.NextDouble()*scale), (float)(99 + rnd.NextDouble()*scale), (float)(99 + rnd.NextDouble()*scale)), Quaternion.identity);
Instantiate(capsule, new Vector3 ((float)(95 + rnd.NextDouble()*scale), (float)(70 + rnd.NextDouble()*scale), (float)(70 + rnd.NextDouble()*scale)), Quaternion.identity);
}
// Instantiate (ball, transform.position, transform.rotation);
}
// Update is called once per frame
void Update () {
}
}
|
apache-2.0
|
C#
|
43cf95e0c2bffdb47882691ff6bef4cc4647e1a5
|
Remove unused usings.
|
jcheng31/DarkSkyApi,jcheng31/ForecastPCL
|
ForecastPCL.Test/ApiTests.cs
|
ForecastPCL.Test/ApiTests.cs
|
namespace ForecastPCL.Test
{
using System.Configuration;
using ForecastIOPortable;
using NUnit.Framework;
/// <summary>
/// Tests for the main ForecastApi class.
/// </summary>
[TestFixture]
public class ApiTests
{
/// <summary>
/// Checks that attempting to retrieve data with a null API key throws
/// an exception.
/// </summary>
[Test]
public void NullKeyThrowsException()
{
var client = new ForecastApi(null);
Assert.That(async () => await client.GetWeatherDataAsync(1, 1), Throws.InvalidOperationException);
}
/// <summary>
/// Checks that attempting to retrieve data with an empty string as the
/// API key throws an exception.
/// </summary>
[Test]
public void EmptyKeyThrowsException()
{
var client = new ForecastApi(string.Empty);
Assert.That(async () => await client.GetWeatherDataAsync(1, 1), Throws.InvalidOperationException);
}
/// <summary>
/// Checks that using a valid API key will allow requests to be made.
/// <para>An API key can be specified in the project's app.config file.</para>
/// </summary>
[Test]
public async void ValidKeyRetrievesData()
{
var key = ConfigurationManager.AppSettings["ApiKey"];
var client = new ForecastApi(key);
var result = await client.GetWeatherDataAsync(1, 1);
Assert.That(result, Is.Not.Null);
Assert.That(result.Currently, Is.Not.Null);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForecastPCL.Test
{
using System.Configuration;
using ForecastIOPortable;
using NUnit.Framework;
/// <summary>
/// Tests for the main ForecastApi class.
/// </summary>
[TestFixture]
public class ApiTests
{
/// <summary>
/// Checks that attempting to retrieve data with a null API key throws
/// an exception.
/// </summary>
[Test]
public void NullKeyThrowsException()
{
var client = new ForecastApi(null);
Assert.That(async () => await client.GetWeatherDataAsync(1, 1), Throws.InvalidOperationException);
}
/// <summary>
/// Checks that attempting to retrieve data with an empty string as the
/// API key throws an exception.
/// </summary>
[Test]
public void EmptyKeyThrowsException()
{
var client = new ForecastApi(string.Empty);
Assert.That(async () => await client.GetWeatherDataAsync(1, 1), Throws.InvalidOperationException);
}
/// <summary>
/// Checks that using a valid API key will allow requests to be made.
/// <para>An API key can be specified in the project's app.config file.</para>
/// </summary>
[Test]
public async void ValidKeyRetrievesData()
{
var key = ConfigurationManager.AppSettings["ApiKey"];
var client = new ForecastApi(key);
var result = await client.GetWeatherDataAsync(1, 1);
Assert.That(result, Is.Not.Null);
Assert.That(result.Currently, Is.Not.Null);
}
}
}
|
mit
|
C#
|
c3d80abf0725116789bea9a058dda9a9f576b038
|
Allow combining lifetime scope tags
|
HangfireIO/Hangfire.Autofac
|
HangFire.Autofac/RegistrationExtensions.cs
|
HangFire.Autofac/RegistrationExtensions.cs
|
using System;
using System.Linq;
using Autofac.Builder;
using Hangfire.Annotations;
namespace Hangfire
{
/// <summary>
/// Adds registration syntax to the <see cref="Autofac.ContainerBuilder"/> type.
/// </summary>
public static class RegistrationExtensions
{
/// <summary>
/// Share one instance of the component within the context of a single
/// processing background job instance.
/// </summary>
/// <typeparam name="TLimit">Registration limit type.</typeparam>
/// <typeparam name="TActivatorData">Activator data type.</typeparam>
/// <typeparam name="TStyle">Registration style.</typeparam>
/// <param name="registration">The registration to configure.</param>
/// <param name="lifetimeScopeTags">Additional tags applied for matching lifetime scopes.</param>
/// <returns>A registration builder allowing further configuration of the component.</returns>
/// <exception cref="ArgumentNullException">
/// Thrown when <paramref name="registration"/> is <see langword="null"/>.
/// </exception>
public static IRegistrationBuilder<TLimit, TActivatorData, TStyle>
InstancePerBackgroundJob<TLimit, TActivatorData, TStyle>(
[NotNull] this IRegistrationBuilder<TLimit, TActivatorData, TStyle> registration,
params object[] lifetimeScopeTags)
{
if (registration == null) throw new ArgumentNullException("registration");
var tags = new[] { AutofacJobActivator.LifetimeScopeTag }.Concat(lifetimeScopeTags).ToArray();
return registration.InstancePerMatchingLifetimeScope(tags);
}
}
}
|
using System;
using Autofac.Builder;
using Hangfire.Annotations;
namespace Hangfire
{
/// <summary>
/// Adds registration syntax to the <see cref="Autofac.ContainerBuilder"/> type.
/// </summary>
public static class RegistrationExtensions
{
/// <summary>
/// Share one instance of the component within the context of a single
/// processing background job instance.
/// </summary>
/// <typeparam name="TLimit">Registration limit type.</typeparam>
/// <typeparam name="TActivatorData">Activator data type.</typeparam>
/// <typeparam name="TStyle">Registration style.</typeparam>
/// <param name="registration">The registration to configure.</param>
/// <returns>A registration builder allowing further configuration of the component.</returns>
/// <exception cref="ArgumentNullException">
/// Thrown when <paramref name="registration"/> is <see langword="null"/>.
/// </exception>
public static IRegistrationBuilder<TLimit, TActivatorData, TStyle>
InstancePerBackgroundJob<TLimit, TActivatorData, TStyle>(
[NotNull] this IRegistrationBuilder<TLimit, TActivatorData, TStyle> registration)
{
if (registration == null) throw new ArgumentNullException("registration");
return registration.InstancePerMatchingLifetimeScope(AutofacJobActivator.LifetimeScopeTag);
}
}
}
|
mit
|
C#
|
40ed6ebd5f5ed6f0422e32c71a7614bc975f6fb9
|
Change signatures
|
sakapon/Samples-2017
|
ProxySample/CrossCuttingConsole/Aspects.cs
|
ProxySample/CrossCuttingConsole/Aspects.cs
|
using System;
using System.Runtime.Remoting.Messaging;
using System.Transactions;
namespace CrossCuttingConsole
{
public class TraceLogAttribute : AspectAttribute
{
public override IMethodReturnMessage Invoke(Func<IMethodReturnMessage> baseInvoke, MarshalByRefObject target, IMethodCallMessage methodCall)
{
var methodLog = $"{methodCall.MethodBase.DeclaringType.Name}.{methodCall.MethodName}({string.Join(", ", methodCall.InArgs)})";
Console.WriteLine($"{DateTime.Now:HH:mm:ss.fff}: Begin: {methodLog}");
var result = baseInvoke();
if (result.Exception == null)
Console.WriteLine($"{DateTime.Now:HH:mm:ss.fff}: Success: {methodLog}");
else
{
Console.WriteLine($"{DateTime.Now:HH:mm:ss.fff}: Error: {methodLog}");
Console.WriteLine(result.Exception);
}
return result;
}
}
public class TransactionScopeAttribute : AspectAttribute
{
public TransactionOptions TransactionOptions { get; }
public TransactionScopeOption TransactionScopeOption { get; }
public TransactionScopeAttribute(
IsolationLevel isolationLevel = IsolationLevel.ReadCommitted,
double timeoutInSeconds = 30,
TransactionScopeOption scopeOption = TransactionScopeOption.Required)
{
TransactionOptions = new TransactionOptions
{
IsolationLevel = isolationLevel,
Timeout = TimeSpan.FromSeconds(timeoutInSeconds),
};
TransactionScopeOption = scopeOption;
}
public override IMethodReturnMessage Invoke(Func<IMethodReturnMessage> baseInvoke, MarshalByRefObject target, IMethodCallMessage methodCall)
{
using (var scope = new TransactionScope(TransactionScopeOption, TransactionOptions))
{
var result = baseInvoke();
scope.Complete();
return result;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Transactions;
namespace CrossCuttingConsole
{
public class TraceLogAttribute : AspectAttribute
{
public override IMethodReturnMessage Invoke(Func<IMethodReturnMessage> baseInvoke, MarshalByRefObject target, IMethodCallMessage methodCall)
{
var methodLog = $"{methodCall.MethodBase.DeclaringType.Name}.{methodCall.MethodName}({string.Join(", ", methodCall.InArgs)})";
Console.WriteLine($"{DateTime.Now:HH:mm:ss.fff}: Begin: {methodLog}");
var result = baseInvoke();
if (result.Exception == null)
Console.WriteLine($"{DateTime.Now:HH:mm:ss.fff}: Success: {methodLog}");
else
{
Console.WriteLine($"{DateTime.Now:HH:mm:ss.fff}: Error: {methodLog}");
Console.WriteLine(result.Exception);
}
return result;
}
}
public class TransactionScopeAttribute : AspectAttribute
{
public TransactionScopeOption TransactionScopeOption { get; }
public TransactionOptions TransactionOptions { get; }
public TransactionScopeAttribute(
TransactionScopeOption scopeOption = TransactionScopeOption.Required,
IsolationLevel isolationLevel = IsolationLevel.ReadCommitted,
double timeoutInSeconds = 30)
{
TransactionScopeOption = scopeOption;
TransactionOptions = new TransactionOptions
{
IsolationLevel = isolationLevel,
Timeout = TimeSpan.FromSeconds(timeoutInSeconds),
};
}
public override IMethodReturnMessage Invoke(Func<IMethodReturnMessage> baseInvoke, MarshalByRefObject target, IMethodCallMessage methodCall)
{
using (var scope = new TransactionScope(TransactionScopeOption, TransactionOptions))
{
var result = baseInvoke();
scope.Complete();
return result;
}
}
}
}
|
mit
|
C#
|
cc00e5ad37d6291994cd41c35d079c59bc76b46a
|
Fix Semantics in CommandConnection
|
rit-sse-mycroft/core
|
Mycroft/CommandConnection.cs
|
Mycroft/CommandConnection.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mycroft
{
class CommandConnection
{
/// <summary>
/// Source of all commands
/// </summary>
public Stream input {get; private set;}
/// <summary>
/// Wrap a command connection around a generic input stream
/// </summary>
/// <param name="input">The source of all commands</param>
public CommandConnection(Stream input)
{
this.input = input;
}
public async Task<string> GetCommandAsync()
{
int msgLen = await Task.Run<int>((Func<int>)(GetMsgLen));
byte[] buff = new byte[msgLen];
input.Read(buff, 0, buff.Length);
string msg = Encoding.UTF8.GetString(buff, 0, buff.Length);
System.Diagnostics.Debug.WriteLine("Got message: " + msg);
return msg;
}
private int GetMsgLen()
{
byte[] smallBuf = new byte[100];
string soFar = "";
for (int i = 0; i < smallBuf.Length; i++ ) // read until we find a newline
{
smallBuf[i] = (byte)input.ReadByte();
try
{
soFar = Encoding.UTF8.GetString(smallBuf, 0, i+1);
if (soFar.EndsWith("\n"))
{
break;
}
}
catch (ArgumentException ex) { } // do nothing, it's just not valid yet
}
soFar.Trim();
return int.Parse(soFar);
}
/// <summary>
/// Closes the underlying connection
/// </summary>
public void Close()
{
input.Close();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mycroft
{
class CommandConnection
{
/// <summary>
/// Source of all commands
/// </summary>
private Stream input;
/// <summary>
/// Wrap a command connection around a generic input stream
/// </summary>
/// <param name="input">The source of all commands</param>
public CommandConnection(Stream input)
{
this.input = input;
}
public async Task<string> getCommandAsync()
{
int msgLen = await Task.Run<int>((Func<int>)(getMsgLen));
byte[] buff = new byte[msgLen];
input.Read(buff, 0, buff.Length);
string msg = Encoding.UTF8.GetString(buff, 0, buff.Length);
System.Diagnostics.Debug.WriteLine("Got message: " + msg);
return msg;
}
private int getMsgLen()
{
byte[] smallBuf = new byte[100];
string soFar = "";
for (int i = 0; i < smallBuf.Length; i++ ) // read until we find a newline
{
smallBuf[i] = (byte)input.ReadByte();
try
{
soFar = Encoding.UTF8.GetString(smallBuf, 0, i+1);
if (soFar.EndsWith("\n"))
{
break;
}
}
catch (ArgumentException ex) { } // do nothing, it's just not valid yet
}
soFar.Trim();
return int.Parse(soFar);
}
/// <summary>
/// Closes the underlying connection
/// </summary>
public void Close()
{
input.Close();
}
}
}
|
bsd-3-clause
|
C#
|
9570d22bbc2621c29921fda0a066831ff18aba96
|
update hello message
|
alisonvogel12/personalsite,alisonvogel12/personalsite
|
AlisonVogel.Web/Views/Home/Index.cshtml
|
AlisonVogel.Web/Views/Home/Index.cshtml
|
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<div>
Hello. Now I am in the cloud!!
</div>
</body>
</html>
|
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<div>
Hello!
</div>
</body>
</html>
|
mit
|
C#
|
40627a5c8bae0a4961de463f3a09b43c062b0b97
|
Fix title
|
vbliznikov/colabedit,vbliznikov/colabedit,vbliznikov/colabedit,vbliznikov/colabedit
|
src/web-editor/Views/Shared/_Layout.cshtml
|
src/web-editor/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"]</title>
<base href="/" />
<link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true" />
</head>
<body>
@RenderBody()
@RenderSection("scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - WebApplicationBasic</title>
<base href="/" />
<link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true" />
</head>
<body>
@RenderBody()
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
ba09179001fea12560519bbd8070e889df32aa14
|
Add ctor to pipe the http factory
|
joaoasrosa/website-performance,joaoasrosa/website-performance
|
src/website-performance/Entities/Robots.cs
|
src/website-performance/Entities/Robots.cs
|
using System;
using System.Collections.Generic;
using website_performance.Infrastructure;
namespace website_performance.Entities
{
public class Robots
{
private readonly IHttpMessageHandlerFactory _httpMessageHandlerFactory;
private readonly List<Uri> _sitemaps = new List<Uri>();
public Robots(string url)
{
if (Uri.TryCreate(url, UriKind.Absolute, out var robotsUrl))
Url = robotsUrl;
else
throw new UriFormatException($"Fail to parse URL \"{url}\"");
}
public Robots(string url, IHttpMessageHandlerFactory httpMessageHandlerFactory)
{
_httpMessageHandlerFactory = httpMessageHandlerFactory ?? throw new ArgumentNullException(nameof(httpMessageHandlerFactory));
if (Uri.TryCreate(url, UriKind.Absolute, out var robotsUrl))
Url = robotsUrl;
else
throw new UriFormatException($"Fail to parse URL \"{url}\"");
}
public Uri Url { get; }
public IReadOnlyCollection<Uri> Sitemaps => _sitemaps;
public void AddSitemap(string sitemapUrl)
{
if (Uri.TryCreate(sitemapUrl, UriKind.Absolute, out var sitemap))
{
if (_sitemaps.Contains(sitemap) == false)
_sitemaps.Add(sitemap);
}
else
{
throw new UriFormatException($"Fail to parse URL \"{sitemapUrl}\"");
}
}
// New code
public void GeneratePerformanceReport()
{
throw new NotImplementedException();
}
}
}
|
using System;
using System.Collections.Generic;
namespace website_performance.Entities
{
public class Robots
{
private readonly List<Uri> _sitemaps = new List<Uri>();
public Robots(string url)
{
if (Uri.TryCreate(url, UriKind.Absolute, out var robotsUrl))
Url = robotsUrl;
else
throw new UriFormatException($"Fail to parse URL \"{url}\"");
}
public Uri Url { get; }
public IReadOnlyCollection<Uri> Sitemaps => _sitemaps;
public void AddSitemap(string sitemapUrl)
{
if (Uri.TryCreate(sitemapUrl, UriKind.Absolute, out var sitemap))
{
if (_sitemaps.Contains(sitemap) == false)
_sitemaps.Add(sitemap);
}
else
{
throw new UriFormatException($"Fail to parse URL \"{sitemapUrl}\"");
}
}
// New code
public void GeneratePerformanceReport()
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
a0b5224a1e0d1a9e1760634c768f7e3ac2457aef
|
Change the FROM address to redleg.app
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
Battery-Commander.Web/Services/EmailService.cs
|
Battery-Commander.Web/Services/EmailService.cs
|
using Microsoft.Extensions.Options;
using SendGrid.Helpers.Mail;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Services
{
public interface IEmailService
{
Task Send(SendGridMessage message);
}
public class EmailService : IEmailService
{
public static readonly EmailAddress FROM_ADDRESS = new EmailAddress("BatteryCommander@redleg.app");
private readonly IOptions<SendGridSettings> settings;
private SendGrid.ISendGridClient client => new SendGrid.SendGridClient(apiKey: settings.Value.APIKey);
public EmailService(IOptions<SendGridSettings> settings)
{
this.settings = settings;
}
public virtual async Task Send(SendGridMessage message)
{
// TODO Add logging
// TODO Handle if it doesn't send successfully
var response = await client.SendEmailAsync(message);
}
}
}
|
using Microsoft.Extensions.Options;
using SendGrid.Helpers.Mail;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Services
{
public interface IEmailService
{
Task Send(SendGridMessage message);
}
public class EmailService : IEmailService
{
public static readonly EmailAddress FROM_ADDRESS = new EmailAddress("BatteryCommander@red-leg-dev.com");
private readonly IOptions<SendGridSettings> settings;
private SendGrid.ISendGridClient client => new SendGrid.SendGridClient(apiKey: settings.Value.APIKey);
public EmailService(IOptions<SendGridSettings> settings)
{
this.settings = settings;
}
public virtual async Task Send(SendGridMessage message)
{
// TODO Add logging
// TODO Handle if it doesn't send successfully
var response = await client.SendEmailAsync(message);
}
}
}
|
mit
|
C#
|
c709c6c559cb10263a8fb0348cc66c08102663cb
|
Load the videos before enumerating them
|
flagbug/Espera,punker76/Espera
|
Espera/Espera.Core/YoutubeSongFinder.cs
|
Espera/Espera.Core/YoutubeSongFinder.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Google.GData.Client;
using Google.GData.YouTube;
using Google.YouTube;
namespace Espera.Core
{
public sealed class YoutubeSongFinder : IYoutubeSongFinder
{
private const string ApiKey =
"AI39si5_zcffmO_ErRSZ9xUkfy_XxPZLWuxTOzI_1RH9HhXDI-GaaQ-j6MONkl2JiF01yBDgBFPbC8-mn6U9Qo4Ek50nKcqH5g";
public async Task<IReadOnlyList<YoutubeSong>> GetSongsAsync(string searchTerm)
{
var query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri)
{
OrderBy = "relevance",
Query = searchTerm,
SafeSearch = YouTubeQuery.SafeSearchValues.None
};
// NB: I have no idea where this API blocks exactly
var settings = new YouTubeRequestSettings("Espera", ApiKey);
var request = new YouTubeRequest(settings);
Feed<Video> feed = await Task.Run(() => request.Get<Video>(query));
List<Video> entries = await Task.Run(() => feed.Entries.ToList());
var songs = new List<YoutubeSong>();
foreach (Video video in entries)
{
var duration = TimeSpan.FromSeconds(Int32.Parse(video.YouTubeEntry.Duration.Seconds));
string url = video.WatchPage.OriginalString
.Replace("&feature=youtube_gdata_player", String.Empty) // Unnecessary long url
.Replace("https://", "http://"); // Secure connections are not always easy to handle when streaming
var song = new YoutubeSong(url, duration)
{
Title = video.Title,
Description = video.Description,
Rating = video.RatingAverage >= 1 ? video.RatingAverage : (double?)null,
ThumbnailSource = new Uri(video.Thumbnails[0].Url),
Views = video.ViewCount
};
songs.Add(song);
}
return songs;
}
}
}
|
using Google.GData.Client;
using Google.GData.YouTube;
using Google.YouTube;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Espera.Core
{
public sealed class YoutubeSongFinder : IYoutubeSongFinder
{
private const string ApiKey =
"AI39si5_zcffmO_ErRSZ9xUkfy_XxPZLWuxTOzI_1RH9HhXDI-GaaQ-j6MONkl2JiF01yBDgBFPbC8-mn6U9Qo4Ek50nKcqH5g";
public async Task<IReadOnlyList<YoutubeSong>> GetSongsAsync(string searchTerm)
{
var query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri)
{
OrderBy = "relevance",
Query = searchTerm,
SafeSearch = YouTubeQuery.SafeSearchValues.None
};
// NB: I have no idea where this API blocks exactly
var settings = new YouTubeRequestSettings("Espera", ApiKey);
var request = new YouTubeRequest(settings);
Feed<Video> feed = await Task.Run(() => request.Get<Video>(query));
var songs = new List<YoutubeSong>();
foreach (Video video in await Task.Run(() => feed.Entries))
{
var duration = TimeSpan.FromSeconds(Int32.Parse(video.YouTubeEntry.Duration.Seconds));
string url = video.WatchPage.OriginalString
.Replace("&feature=youtube_gdata_player", String.Empty) // Unnecessary long url
.Replace("https://", "http://"); // Secure connections are not always easy to handle when streaming
var song = new YoutubeSong(url, duration)
{
Title = video.Title,
Description = video.Description,
Rating = video.RatingAverage >= 1 ? video.RatingAverage : (double?)null,
ThumbnailSource = new Uri(video.Thumbnails[0].Url),
Views = video.ViewCount
};
songs.Add(song);
}
return songs;
}
}
}
|
mit
|
C#
|
b3a9ad5d218961e9a3b78a144307a4959109d2bf
|
Fix travelstone search.
|
uoinfusion/Infusion
|
ExampleScripts/UOErebor/travelstone.csx
|
ExampleScripts/UOErebor/travelstone.csx
|
#load "Specs.csx"
#load "common.csx"
using Infusion.Commands;
public static class TravelStone
{
// doesn't support destinations on the second page yet
public static void TravelTo(string destination)
{
var travelStone = UO.Items.OnGround().MaxDistance(4).Matching(Specs.TravelStone).FirstOrDefault();
if (travelStone != null)
{
UO.Use(travelStone);
UO.WaitForGump();
UO.LastGumpInfo();
UO.SelectGumpButton(destination, Infusion.Gumps.GumpLabelPosition.Before);
}
else
{
UO.Console.Error("Cannot find travelstone.");
}
}
public static void TravelToCommand(string parameters)
{
if (string.IsNullOrEmpty(parameters))
throw new CommandInvocationException("Destination name not specified.");
TravelTo(parameters);
Common.WaitForChangedLocation();
}
}
UO.RegisterCommand("travelto", TravelStone.TravelToCommand);
|
#load "Specs.csx"
#load "common.csx"
using Infusion.Commands;
public static class TravelStone
{
// doesn't support destinations on the second page yet
public static void TravelTo(string destination)
{
UO.Use(Specs.TravelStone);
UO.WaitForGump();
UO.LastGumpInfo();
UO.SelectGumpButton(destination, Infusion.Gumps.GumpLabelPosition.Before);
}
public static void TravelToCommand(string parameters)
{
if (string.IsNullOrEmpty(parameters))
throw new CommandInvocationException("Destination name not specified.");
TravelTo(parameters);
Common.WaitForChangedLocation();
}
}
UO.RegisterCommand("travelto", TravelStone.TravelToCommand);
|
mit
|
C#
|
39a4672caaa65e8d682380e184ea71e55f9ec667
|
fix bomb eating
|
daknauff/ld34_fish
|
ld34/Assets/Scripts/playereat.cs
|
ld34/Assets/Scripts/playereat.cs
|
using UnityEngine;
using System.Collections;
public class playereat : MonoBehaviour {
void start()
{
}
void OnCollisionEnter2D(Collision2D col)
{
float newscale = transform.localScale.x;
if (col.transform.localScale.x <= transform.localScale.x)
{
if (col.gameObject.tag == "Fish")
{
Destroy(col.gameObject);
newscale++;
transform.localScale = new Vector3(newscale, newscale, newscale);
}
}
}
}
|
using UnityEngine;
using System.Collections;
public class playereat : MonoBehaviour {
void start()
{
}
void OnCollisionEnter2D(Collision2D col)
{
float newscale = transform.localScale.x;
if (col.transform.localScale.x <= transform.localScale.x)
{
Destroy(col.gameObject);
newscale++;
transform.localScale = new Vector3(newscale, newscale, newscale);
}
}
}
|
cc0-1.0
|
C#
|
dcc118abb60bbc6d21fa772e2f7f60bcd57bbcdc
|
Add test
|
sakapon/KLibrary.Linq
|
KLibrary4/UnitTest/Linq/Lab/Enumerable2Test.cs
|
KLibrary4/UnitTest/Linq/Lab/Enumerable2Test.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using static KLibrary.Linq.Lab.Enumerable2;
namespace UnitTest.Linq.Lab
{
[TestClass]
public class Enumerable2Test
{
[TestMethod]
public void Range_1()
{
CollectionAssert.AreEqual(Enumerable.Range(0, 10).ToArray(), Range().Take(10).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(3, 10).ToArray(), Range(3).Take(10).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(0, 10).ToArray(), Range(0, 10).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(3, 10).ToArray(), Range(3, 10).ToArray());
CollectionAssert.AreEqual(Enumerable.Empty<int>().ToArray(), Range(3, 0).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(0, 10).Select(i => 2 * i).ToArray(), Range(0, null, 2).Take(10).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(0, 10).Select(i => 2 * i + 3).ToArray(), Range(3, 10, 2).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(-6, 10).Reverse().ToArray(), Range(3, 10, -1).ToArray());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using static KLibrary.Linq.Lab.Enumerable2;
namespace UnitTest.Linq.Lab
{
[TestClass]
public class Enumerable2Test
{
[TestMethod]
public void Range_1()
{
CollectionAssert.AreEqual(Enumerable.Range(0, 10).ToArray(), Range().Take(10).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(3, 10).ToArray(), Range(3).Take(10).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(0, 10).ToArray(), Range(0, 10).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(3, 10).ToArray(), Range(3, 10).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(0, 10).Select(i => 2 * i).ToArray(), Range(0, null, 2).Take(10).ToArray());
CollectionAssert.AreEqual(Enumerable.Range(0, 10).Select(i => 2 * i + 3).ToArray(), Range(3, 10, 2).ToArray());
}
}
}
|
mit
|
C#
|
69bf852d7bb15a5bc05747a5e5f3c34e6bdff42a
|
Fix not to set UnsetValue.
|
cube-soft/Cube.Core,cube-soft/Cube.Core
|
Libraries/Sources/Behaviors/DisposeBehavior.cs
|
Libraries/Sources/Behaviors/DisposeBehavior.cs
|
/* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, Inc.
//
// 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;
using System.Windows;
using System.Windows.Interactivity;
namespace Cube.Xui.Behaviors
{
/* --------------------------------------------------------------------- */
///
/// DisposeBehavior
///
/// <summary>
/// Provides functionality to dispose the DataContext when the
/// Closed event is fired.
/// </summary>
///
/* --------------------------------------------------------------------- */
public class DisposeBehavior : Behavior<Window>
{
/* ----------------------------------------------------------------- */
///
/// OnAttached
///
/// <summary>
/// Occurs when the instance is attached to the Window.
/// </summary>
///
/* ----------------------------------------------------------------- */
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.Closed -= OnClosed;
AssociatedObject.Closed += OnClosed;
}
/* ----------------------------------------------------------------- */
///
/// OnDetaching
///
/// <summary>
/// Occurs when the instance is detaching from the Window.
/// </summary>
///
/* ----------------------------------------------------------------- */
protected override void OnDetaching()
{
AssociatedObject.Closing -= OnClosed;
base.OnDetaching();
}
/* ----------------------------------------------------------------- */
///
/// OnClosed
///
/// <summary>
/// Occurs when the Closed event is fired.
/// </summary>
///
/* ----------------------------------------------------------------- */
private void OnClosed(object s, EventArgs e)
{
if (AssociatedObject?.DataContext is IDisposable dc) dc.Dispose();
}
}
}
|
/* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, Inc.
//
// 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;
using System.Windows;
using System.Windows.Interactivity;
namespace Cube.Xui.Behaviors
{
/* --------------------------------------------------------------------- */
///
/// DisposeBehavior
///
/// <summary>
/// Provides functionality to dispose the DataContext when the
/// Closed event is fired.
/// </summary>
///
/* --------------------------------------------------------------------- */
public class DisposeBehavior : Behavior<Window>
{
/* ----------------------------------------------------------------- */
///
/// OnAttached
///
/// <summary>
/// Occurs when the instance is attached to the Window.
/// </summary>
///
/* ----------------------------------------------------------------- */
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.Closed -= OnClosed;
AssociatedObject.Closed += OnClosed;
}
/* ----------------------------------------------------------------- */
///
/// OnDetaching
///
/// <summary>
/// Occurs when the instance is detaching from the Window.
/// </summary>
///
/* ----------------------------------------------------------------- */
protected override void OnDetaching()
{
AssociatedObject.Closing -= OnClosed;
base.OnDetaching();
}
/* ----------------------------------------------------------------- */
///
/// OnClosed
///
/// <summary>
/// Occurs when the Closed event is fired.
/// </summary>
///
/* ----------------------------------------------------------------- */
private void OnClosed(object s, EventArgs e)
{
if (AssociatedObject == null) return;
var dc = AssociatedObject.DataContext as IDisposable;
AssociatedObject.DataContext = DependencyProperty.UnsetValue;
dc?.Dispose();
}
}
}
|
apache-2.0
|
C#
|
0a52f17adcaa8a02a0b39db7f08872bf8b4c2f20
|
Bump version to 1.6.0
|
mhutch/MonoDevelop.AddinMaker,mhutch/MonoDevelop.AddinMaker
|
MonoDevelop.AddinMaker/Properties/AddinInfo.cs
|
MonoDevelop.AddinMaker/Properties/AddinInfo.cs
|
using Mono.Addins;
using Mono.Addins.Description;
[assembly: Addin (
"AddinMaker",
Namespace = "MonoDevelop",
Version = "1.6.0",
Url = "http://github.com/mhutch/MonoDevelop.AddinMaker"
)]
[assembly: AddinName ("AddinMaker")]
[assembly: AddinCategory ("Extension Development")]
[assembly: AddinDescription ("Makes it easy to create and edit IDE extensions")]
[assembly: AddinAuthor ("Mikayla Hutchinson")]
|
using Mono.Addins;
using Mono.Addins.Description;
[assembly: Addin (
"AddinMaker",
Namespace = "MonoDevelop",
Version = "1.5.0",
Url = "http://github.com/mhutch/MonoDevelop.AddinMaker"
)]
[assembly: AddinName ("AddinMaker")]
[assembly: AddinCategory ("Extension Development")]
[assembly: AddinDescription ("Makes it easy to create and edit IDE extensions")]
[assembly: AddinAuthor ("Mikayla Hutchinson")]
|
mit
|
C#
|
fe9527c413536c52fbc88f11bdef7986dc8197b3
|
fix spacing
|
stefanprodan/MvcThrottle,stefanprodan/MvcThrottle,stefanprodan/MvcThrottle
|
MvcThrottle.Demo/Controllers/BaseController.cs
|
MvcThrottle.Demo/Controllers/BaseController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcThrottle.Demo.Controllers
{
[EnableThrottling]
public class BaseController : Controller
{
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcThrottle.Demo.Controllers
{
[EnableThrottling]
public class BaseController : Controller
{
}
}
|
mit
|
C#
|
8762277fee65f1b41c2966a76c0c5760daaa3290
|
Remove debug info.
|
AmadeusW/SourceBrowser,CodeConnect/SourceBrowser,CodeConnect/SourceBrowser,AmadeusW/SourceBrowser,AmadeusW/SourceBrowser
|
src/SourceBrowser.Generator/Model/FolderModel.cs
|
src/SourceBrowser.Generator/Model/FolderModel.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SourceBrowser.Generator.Model
{
public class FolderModel : IProjectItem
{
public ICollection<IProjectItem> Children { get; set; }
public IProjectItem Parent { get; private set; }
public string Name { get; set; }
public string RelativePath { get; set; }
public FolderModel(IProjectItem parent, string name, string path)
{
Parent = parent;
Name = name;
RelativePath = findRelativePath(path);
Children = new List<IProjectItem>();
}
private string findRelativePath(string path)
{
//Find the root WorkspaceModel
IProjectItem currentNode = this;
while (currentNode.Parent != null)
{
currentNode = currentNode.Parent;
}
string rootPath = ((WorkspaceModel)currentNode).ContainingPath;
var relativePath = path.Remove(0, rootPath.Length);
return relativePath;
}
public string GetPath()
{
return RelativePath;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SourceBrowser.Generator.Model
{
public class FolderModel : IProjectItem
{
public ICollection<IProjectItem> Children { get; set; }
public IProjectItem Parent { get; private set; }
public string Name { get; set; }
public string RelativePath { get; set; }
public FolderModel(IProjectItem parent, string name, string path)
{
Parent = parent;
Name = name;
RelativePath = findRelativePath(path);
Children = new List<IProjectItem>();
}
private string findRelativePath(string path)
{
//Find the root WorkspaceModel
IProjectItem currentNode = this;
while (currentNode.Parent != null)
{
currentNode = currentNode.Parent;
}
string relativePath;
string rootPath = ((WorkspaceModel)currentNode).ContainingPath;
System.Diagnostics.Debug.WriteLine(rootPath);
System.Diagnostics.Debug.WriteLine(path);
relativePath = path.Remove(0, rootPath.Length);
return relativePath;
}
public string GetPath()
{
return RelativePath;
}
}
}
|
mit
|
C#
|
7e4c9d41fc523772091e85a90caa71f49064c645
|
Update UmbShopProduct
|
umbShop/umbShop,umbShop/umbShop,umbShop/umbShop
|
umbShop/Models/Product/UmbShopProduct.cs
|
umbShop/Models/Product/UmbShopProduct.cs
|
using Newtonsoft.Json;
using System;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace umbShop.Models.Product
{
public class UmbShopProduct
{
#region Properties
[JsonProperty("id")]
public int Id { get; private set; }
[JsonProperty("udi")]
public Guid Udi { get; private set; }
[JsonProperty("name")]
public string Name { get; private set; }
[JsonProperty("url")]
public string Url { get; private set; }
#endregion
#region Constructors
public UmbShopProduct(IPublishedContent content) {
Id = content.Id;
Udi = content.GetKey();
Name = content.Name;
Url = content.Url;
}
#endregion
#region Statics
public static UmbShopProduct GetFromContent(IPublishedContent content)
{
if (content == null) return null;
return new UmbShopProduct(content);
}
#endregion
}
}
|
using Newtonsoft.Json;
using Umbraco.Core.Models;
namespace umbShop.Models.Product
{
public class UmbShopProduct
{
#region Properties
[JsonProperty("id")]
public int Id { get; private set; }
[JsonProperty("name")]
public string Name { get; private set; }
#endregion
#region Constructors
public UmbShopProduct(IPublishedContent content) {
Id = content.Id;
Name = content.Name;
}
#endregion
#region Statics
public static UmbShopProduct GetFromContent(IPublishedContent content)
{
if (content == null) return null;
return new UmbShopProduct(content);
}
#endregion
}
}
|
mit
|
C#
|
cedf399d5302b4fcb0788b294c2410a214f2267a
|
Remove EditorBrowsable attribute. No reason to hide the property. Fixes #108
|
PedroLamas/XamlBehaviors,Microsoft/XamlBehaviors,PedroLamas/XamlBehaviors,Microsoft/XamlBehaviors,PedroLamas/XamlBehaviors,Microsoft/XamlBehaviors
|
src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/BehaviorOfT.cs
|
src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity/BehaviorOfT.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Windows.UI.Xaml;
namespace Microsoft.Xaml.Interactivity
{
/// <summary>
/// A base class for behaviors making them code compatible with older frameworks,
/// and allow for typed associtated objects.
/// </summary>
/// <typeparam name="T">The object type to attach to</typeparam>
public abstract class Behavior<T> : Behavior where T : DependencyObject
{
/// <summary>
/// Gets the object to which this behavior is attached.
/// </summary>
public new T AssociatedObject
{
get { return base.AssociatedObject as T; }
}
/// <summary>
/// Called after the behavior is attached to the <see cref="Microsoft.Xaml.Interactivity.Behavior.AssociatedObject"/>.
/// </summary>
/// <remarks>
/// Override this to hook up functionality to the <see cref="Microsoft.Xaml.Interactivity.Behavior.AssociatedObject"/>
/// </remarks>
protected override void OnAttached()
{
base.OnAttached();
if (this.AssociatedObject == null)
{
string actualType = base.AssociatedObject.GetType().FullName;
string expectedType = typeof (T).FullName;
string message = string.Format(ResourceHelper.GetString("InvalidAssociatedObjectExceptionMessage"), actualType, expectedType);
throw new InvalidOperationException(message);
}
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Windows.UI.Xaml;
namespace Microsoft.Xaml.Interactivity
{
/// <summary>
/// A base class for behaviors making them code compatible with older frameworks,
/// and allow for typed associtated objects.
/// </summary>
/// <typeparam name="T">The object type to attach to</typeparam>
public abstract class Behavior<T> : Behavior where T : DependencyObject
{
/// <summary>
/// Gets the object to which this behavior is attached.
/// </summary>
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public new T AssociatedObject
{
get { return base.AssociatedObject as T; }
}
/// <summary>
/// Called after the behavior is attached to the <see cref="Microsoft.Xaml.Interactivity.Behavior.AssociatedObject"/>.
/// </summary>
/// <remarks>
/// Override this to hook up functionality to the <see cref="Microsoft.Xaml.Interactivity.Behavior.AssociatedObject"/>
/// </remarks>
protected override void OnAttached()
{
base.OnAttached();
if (this.AssociatedObject == null)
{
string actualType = base.AssociatedObject.GetType().FullName;
string expectedType = typeof (T).FullName;
string message = string.Format(ResourceHelper.GetString("InvalidAssociatedObjectExceptionMessage"), actualType, expectedType);
throw new InvalidOperationException(message);
}
}
}
}
|
mit
|
C#
|
1e49d91ab7295efe22d735b3ce70bf2f5dcb707f
|
Update MultitenancyServiceCollectionExtensions.cs
|
saaskit/saaskit,rdefreitas/saaskit
|
src/SaasKit.Multitenancy/MultitenancyServiceCollectionExtensions.cs
|
src/SaasKit.Multitenancy/MultitenancyServiceCollectionExtensions.cs
|
using Microsoft.AspNetCore.Http;
using SaasKit.Multitenancy;
using SaasKit.Multitenancy.Internal;
namespace Microsoft.Extensions.DependencyInjection
{
using Extensions;
using System.Reflection;
public static class MultitenancyServiceCollectionExtensions
{
public static IServiceCollection AddMultitenancy<TTenant, TResolver>(this IServiceCollection services)
where TResolver : class, ITenantResolver<TTenant>
where TTenant : class
{
Ensure.Argument.NotNull(services, nameof(services));
services.AddScoped<ITenantResolver<TTenant>, TResolver>();
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
// Make Tenant and TenantContext injectable
services.AddScoped(prov =>
prov.GetService<IHttpContextAccessor>()?.HttpContext?.GetTenant<TTenant>());
services.AddScoped(prov =>
prov.GetService<IHttpContextAccessor>()?.HttpContext?.GetTenantContext<TTenant>());
// Ensure caching is available for caching resolvers
var resolverType = typeof(TResolver);
if (typeof(MemoryCacheTenantResolver<TTenant>).IsAssignableFrom(resolverType))
{
services.AddMemoryCache();
}
return services;
}
}
}
|
using Microsoft.AspNetCore.Http;
using SaasKit.Multitenancy;
using SaasKit.Multitenancy.Internal;
namespace Microsoft.Extensions.DependencyInjection
{
using Extensions;
using System.Reflection;
public static class MultitenancyServiceCollectionExtensions
{
public static IServiceCollection AddMultitenancy<TTenant, TResolver>(this IServiceCollection services)
where TResolver : class, ITenantResolver<TTenant>
where TTenant : class
{
Ensure.Argument.NotNull(services, nameof(services));
services.AddScoped<ITenantResolver<TTenant>, TResolver>();
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
// Make Tenant and TenantContext injectable
services.AddScoped(prov =>
prov.GetService<IHttpContextAccessor>()?.HttpContext?.GetTenant<TTenant>());
services.AddScoped(prov =>
prov.GetService<IHttpContextAccessor>()?.HttpContext?.GetTenantContext<TTenant>());
// Ensure caching is available for caching resolvers
var resolverType = typeof(TResolver);
if (typeof(MemoryCacheTenantResolver<TTenant>).IsAssignableFrom(resolverType))
{
services.AddMemoryCache();
}
return services;
}
}
}
|
mit
|
C#
|
846f0fd3cc4217582c00da10ad590704288190af
|
Remove call to .Any() from ProblemDetailsDefaultWriter (#43055)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Http/Http.Extensions/src/DefaultProblemDetailsWriter.cs
|
src/Http/Http.Extensions/src/DefaultProblemDetailsWriter.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Http;
internal sealed partial class DefaultProblemDetailsWriter : IProblemDetailsWriter
{
private static readonly MediaTypeHeaderValue _jsonMediaType = new("application/json");
private static readonly MediaTypeHeaderValue _problemDetailsJsonMediaType = new("application/problem+json");
private readonly ProblemDetailsOptions _options;
public DefaultProblemDetailsWriter(IOptions<ProblemDetailsOptions> options)
{
_options = options.Value;
}
public bool CanWrite(ProblemDetailsContext context)
{
var httpContext = context.HttpContext;
var acceptHeader = httpContext.Request.Headers.Accept.GetList<MediaTypeHeaderValue>();
if (acceptHeader is { Count: > 0 })
{
for (var i = 0; i < acceptHeader.Count; i++)
{
var acceptHeaderValue = acceptHeader[i];
if (_jsonMediaType.IsSubsetOf(acceptHeaderValue) ||
_problemDetailsJsonMediaType.IsSubsetOf(acceptHeaderValue))
{
return true;
}
}
}
return false;
}
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "JSON serialization of ProblemDetails.Extensions might require types that cannot be statically analyzed and we need to fallback" +
"to reflection-based. The ProblemDetailsConverter is marked as RequiresUnreferencedCode already.")]
public ValueTask WriteAsync(ProblemDetailsContext context)
{
var httpContext = context.HttpContext;
ProblemDetailsDefaults.Apply(context.ProblemDetails, httpContext.Response.StatusCode);
_options.CustomizeProblemDetails?.Invoke(context);
if (context.ProblemDetails.Extensions is { Count: 0 })
{
// We can use the source generation in this case
return new ValueTask(httpContext.Response.WriteAsJsonAsync(
context.ProblemDetails,
ProblemDetailsJsonContext.Default.ProblemDetails,
contentType: "application/problem+json"));
}
return new ValueTask(httpContext.Response.WriteAsJsonAsync(
context.ProblemDetails,
options: null,
contentType: "application/problem+json"));
}
[JsonSerializable(typeof(ProblemDetails))]
internal sealed partial class ProblemDetailsJsonContext : JsonSerializerContext
{ }
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Http;
internal sealed partial class DefaultProblemDetailsWriter : IProblemDetailsWriter
{
private static readonly MediaTypeHeaderValue _jsonMediaType = new("application/json");
private static readonly MediaTypeHeaderValue _problemDetailsJsonMediaType = new("application/problem+json");
private readonly ProblemDetailsOptions _options;
public DefaultProblemDetailsWriter(IOptions<ProblemDetailsOptions> options)
{
_options = options.Value;
}
public bool CanWrite(ProblemDetailsContext context)
{
var httpContext = context.HttpContext;
var acceptHeader = httpContext.Request.Headers.Accept.GetList<MediaTypeHeaderValue>();
if (acceptHeader?.Any(h => _jsonMediaType.IsSubsetOf(h) || _problemDetailsJsonMediaType.IsSubsetOf(h)) == true)
{
return true;
}
return false;
}
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "JSON serialization of ProblemDetails.Extensions might require types that cannot be statically analyzed and we need to fallback" +
"to reflection-based. The ProblemDetailsConverter is marked as RequiresUnreferencedCode already.")]
public ValueTask WriteAsync(ProblemDetailsContext context)
{
var httpContext = context.HttpContext;
ProblemDetailsDefaults.Apply(context.ProblemDetails, httpContext.Response.StatusCode);
_options.CustomizeProblemDetails?.Invoke(context);
if (context.ProblemDetails.Extensions is { Count: 0 })
{
// We can use the source generation in this case
return new ValueTask(httpContext.Response.WriteAsJsonAsync(
context.ProblemDetails,
ProblemDetailsJsonContext.Default.ProblemDetails,
contentType: "application/problem+json"));
}
return new ValueTask(httpContext.Response.WriteAsJsonAsync(
context.ProblemDetails,
options: null,
contentType: "application/problem+json"));
}
[JsonSerializable(typeof(ProblemDetails))]
internal sealed partial class ProblemDetailsJsonContext : JsonSerializerContext
{ }
}
|
apache-2.0
|
C#
|
0e8c5a59dbdaa0c2014c1015fefc9faad4e20f5e
|
Use PropertyChangedCallback
|
sakapon/Samples-2014,sakapon/Samples-2014,sakapon/Samples-2014
|
RxSample/MouseRx2Wpf/MainWindow.xaml.cs
|
RxSample/MouseRx2Wpf/MainWindow.xaml.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MouseRx2Wpf
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public static readonly DependencyProperty DeltaProperty =
DependencyProperty.Register(nameof(Delta), typeof(Vector?), typeof(MainWindow), new PropertyMetadata(null, (d, e) => DeltaChanged((MainWindow)d, (Vector?)e.NewValue)));
public Vector? Delta
{
get { return (Vector?)GetValue(DeltaProperty); }
set { SetValue(DeltaProperty, value); }
}
public static readonly DependencyProperty OrientationProperty =
DependencyProperty.Register(nameof(Orientation), typeof(string), typeof(MainWindow), new PropertyMetadata(null));
public string Orientation
{
get { return (string)GetValue(OrientationProperty); }
private set { SetValue(OrientationProperty, value); }
}
public MainWindow()
{
InitializeComponent();
var events = new EventsExtension(this);
events.MouseDrag.Subscribe(d => d.Subscribe(v => Delta = v, () => Delta = null));
}
const double π = Math.PI;
static readonly string[] orientationSymbols = new[] { "→", "↘", "↓", "↙", "←", "↖", "↑", "↗" };
static readonly double zoneAngleRange = 2 * π / orientationSymbols.Length;
static string ToOrientation(Vector v)
{
var angle = 2 * π + Math.Atan2(v.Y, v.X);
var zone = (int)Math.Round(angle / zoneAngleRange) % orientationSymbols.Length;
return orientationSymbols[zone];
}
static void DeltaChanged(MainWindow window, Vector? delta)
{
window.Orientation = delta == null ? null : ToOrientation(delta.Value);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MouseRx2Wpf
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public static readonly DependencyProperty DeltaProperty =
DependencyProperty.Register(nameof(Delta), typeof(Vector?), typeof(MainWindow), new PropertyMetadata(null));
public Vector? Delta
{
get { return (Vector?)GetValue(DeltaProperty); }
set { SetValue(DeltaProperty, value); }
}
public static readonly DependencyProperty OrientationProperty =
DependencyProperty.Register(nameof(Orientation), typeof(string), typeof(MainWindow), new PropertyMetadata(null));
public string Orientation
{
get { return (string)GetValue(OrientationProperty); }
private set { SetValue(OrientationProperty, value); }
}
public MainWindow()
{
InitializeComponent();
var π = Math.PI;
var orientationSymbols = new[] { "→", "↘", "↓", "↙", "←", "↖", "↑", "↗" };
var zoneAngleRange = 2 * π / orientationSymbols.Length;
Func<Vector, string> ToOrientation = v =>
{
var angle = 2 * π + Math.Atan2(v.Y, v.X);
var zone = (int)Math.Round(angle / zoneAngleRange) % orientationSymbols.Length;
return orientationSymbols[zone];
};
var events = new EventsExtension(this);
events.MouseDrag.Subscribe(d => d.Subscribe(v =>
{
Delta = v;
Orientation = ToOrientation(v);
},
() =>
{
Delta = null;
Orientation = null;
}));
}
}
}
|
mit
|
C#
|
87309cf7df84e9cd90dda23747eea4c3c1f54b08
|
Fix JsonApiServer breaking if parameter operator was not present
|
SnowflakePowered/snowflake,RonnChyran/snowflake,RonnChyran/snowflake,faint32/snowflake-1,SnowflakePowered/snowflake,SnowflakePowered/snowflake,faint32/snowflake-1,faint32/snowflake-1,RonnChyran/snowflake
|
Snowflake.API/Core/Server/JsonApiServer.cs
|
Snowflake.API/Core/Server/JsonApiServer.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mono.Net;
using System.IO;
using System.Threading;
using Newtonsoft.Json;
using System.Web;
using Snowflake.Ajax;
using Snowflake.Extensions;
namespace Snowflake.Core.Server
{
public class ApiServer : BaseHttpServer
{
public ApiServer():base(30001)
{
}
protected override async Task Process(HttpListenerContext context)
{
context.AddAccessControlHeaders();
string getRequest = context.Request.Url.AbsolutePath.Remove(0,1); //Remove first slash
string getUri = context.Request.Url.AbsoluteUri;
int index = getUri.IndexOf("?", StringComparison.Ordinal);
var dictParams = new Dictionary<string, string>();
if (index > 0)
{
string rawParams = getUri.Substring(index).Remove(0, 1);
var nvcParams = HttpUtility.ParseQueryString(rawParams);
dictParams = nvcParams.AllKeys.ToDictionary(o => o, o => nvcParams[o]);
}
var request = getRequest.Split('/').Count() >= 2 ?
new JSRequest(getRequest.Split('/')[0], getRequest.Split('/')[1], dictParams) :
new JSRequest("","",new Dictionary<string, string>());
var writer = new StreamWriter(context.Response.OutputStream);
writer.WriteLine(await ProcessRequest(request));
writer.Flush();
context.Response.OutputStream.Close();
}
private async Task<string> ProcessRequest(JSRequest args)
{
return await FrontendCore.LoadedCore.PluginManager.AjaxNamespace.CallMethodAsync(args);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mono.Net;
using System.IO;
using System.Threading;
using Newtonsoft.Json;
using System.Web;
using Snowflake.Ajax;
using Snowflake.Extensions;
namespace Snowflake.Core.Server
{
public class ApiServer : BaseHttpServer
{
public ApiServer():base(30001)
{
}
protected override async Task Process(HttpListenerContext context)
{
context.AddAccessControlHeaders();
string getRequest = context.Request.Url.AbsolutePath.Remove(0,1); //Remove first slash
string getUri = context.Request.Url.AbsoluteUri;
int index = getUri.IndexOf("?", StringComparison.Ordinal);
var dictParams = new Dictionary<string, string>();
JSRequest request;
if (index > 0)
{
string rawParams = getUri.Substring(index).Remove(0, 1);
var nvcParams = HttpUtility.ParseQueryString(rawParams);
dictParams = nvcParams.AllKeys.ToDictionary(o => o, o => nvcParams[o]);
request = new JSRequest(getRequest.Split('/')[0], getRequest.Split('/')[1], dictParams);
}
else
{
request = new JSRequest("", "", new Dictionary<string, string>());
}
var writer = new StreamWriter(context.Response.OutputStream);
writer.WriteLine(await ProcessRequest(request));
writer.Flush();
context.Response.OutputStream.Close();
}
private async Task<string> ProcessRequest(JSRequest args)
{
return await FrontendCore.LoadedCore.PluginManager.AjaxNamespace.CallMethodAsync(args);
}
}
}
|
mpl-2.0
|
C#
|
7438684441520738aa0c0d662d992688cc1de211
|
Add DbConfigurationType to Context
|
SteelToeOSS/Samples,SteelToeOSS/Samples,SteelToeOSS/Samples,SteelToeOSS/Samples
|
Connectors/src/MySqlEF6/Models/TestContext.cs
|
Connectors/src/MySqlEF6/Models/TestContext.cs
|
using MySql.Data.Entity;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
namespace MySqlEF6.Models
{
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class TestContext : DbContext
{
public TestContext(string connectionString) : base(connectionString)
{
}
public DbSet<TestData> TestData { get; set; }
}
public class TestData
{
public int Id { get; set; }
public string Data { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
namespace MySqlEF6.Models
{
public class TestContext : DbContext
{
public TestContext(string connectionString) : base(connectionString)
{
}
public DbSet<TestData> TestData { get; set; }
}
public class TestData
{
public int Id { get; set; }
public string Data { get; set; }
}
}
|
apache-2.0
|
C#
|
8cbbc468641a44348e2a117c828e14aa62075b05
|
Comment out InvalidOperationException (is there anything to implement here)?
|
PowerOfCode/Eto,l8s/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,l8s/Eto,l8s/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1
|
Source/Eto/Forms/Controls/Navigation.cs
|
Source/Eto/Forms/Controls/Navigation.cs
|
using System;
using System.Collections.Generic;
namespace Eto.Forms
{
public interface INavigation : IContainer
{
void Push (INavigationItem item);
void Pop ();
}
public class Navigation : Container
{
new INavigation Handler { get { return (INavigation)base.Handler; } }
public override IEnumerable<Control> Controls
{
get
{
yield break;
}
}
[Obsolete("Use IsSupported() instead")]
public static bool Supported { get { return IsSupported(); } }
public static bool IsSupported(Generator generator = null)
{
return (generator ?? Generator.Current).Supports<INavigation>();
}
public event EventHandler<EventArgs> ItemShown;
public virtual void OnItemShown (EventArgs e)
{
if (ItemShown != null)
ItemShown (this, e);
}
public Navigation()
: this((Generator)null)
{
}
public Navigation (Generator generator)
: base(generator, typeof(INavigation))
{
}
public Navigation (Control content, string title = null)
: this()
{
Push (content, title);
}
public Navigation (NavigationItem item)
: this()
{
Push (item);
}
public void Push (Control content, string title = null)
{
Push (new NavigationItem { Content = content, Text = title });
}
public void Push (INavigationItem item)
{
var load = SetParent(item.Content);
Handler.Push (item);
if (load)
item.Content.OnLoadComplete (EventArgs.Empty);
}
public virtual void Pop ()
{
Handler.Pop ();
}
public override void Remove(Control child)
{
//throw new NotImplementedException();
}
}
}
|
using System;
using System.Collections.Generic;
namespace Eto.Forms
{
public interface INavigation : IContainer
{
void Push (INavigationItem item);
void Pop ();
}
public class Navigation : Container
{
new INavigation Handler { get { return (INavigation)base.Handler; } }
public override IEnumerable<Control> Controls
{
get
{
yield break;
}
}
[Obsolete("Use IsSupported() instead")]
public static bool Supported { get { return IsSupported(); } }
public static bool IsSupported(Generator generator = null)
{
return (generator ?? Generator.Current).Supports<INavigation>();
}
public event EventHandler<EventArgs> ItemShown;
public virtual void OnItemShown (EventArgs e)
{
if (ItemShown != null)
ItemShown (this, e);
}
public Navigation()
: this((Generator)null)
{
}
public Navigation (Generator generator)
: base(generator, typeof(INavigation))
{
}
public Navigation (Control content, string title = null)
: this()
{
Push (content, title);
}
public Navigation (NavigationItem item)
: this()
{
Push (item);
}
public void Push (Control content, string title = null)
{
Push (new NavigationItem { Content = content, Text = title });
}
public void Push (INavigationItem item)
{
var load = SetParent(item.Content);
Handler.Push (item);
if (load)
item.Content.OnLoadComplete (EventArgs.Empty);
}
public virtual void Pop ()
{
Handler.Pop ();
}
public override void Remove(Control child)
{
throw new NotImplementedException();
}
}
}
|
bsd-3-clause
|
C#
|
b8cf0439e5bab95fcdc976d17fcfaf4ee65036d5
|
Update for fix to url encoding
|
mike-ward/tweetz-desktop
|
tweetz5/tweetz5/Properties/AssemblyInfo.cs
|
tweetz5/tweetz5/Properties/AssemblyInfo.cs
|
// Copyright (c) 2013 Blue Onion Software - All rights reserved
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tweetz Desktop")]
[assembly: AssemblyDescription("Gadget-Like desktop twitter client")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mike-Ward.Net")]
[assembly: AssemblyProduct("Tweetz Desktop")]
[assembly: AssemblyCopyright("Copyright © 2013 Mike-Ward.Net, All rights reserved")]
[assembly: AssemblyTrademark("Tweetz is a trademark of Mike Ward")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None,ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyVersion("0.7.1")]
[assembly: AssemblyFileVersion("0.7.1")]
[assembly: Guid("B21EBDFF-5222-451A-AB7D-F07EF6DF2813")]
|
// Copyright (c) 2013 Blue Onion Software - All rights reserved
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tweetz Desktop")]
[assembly: AssemblyDescription("Gadget-Like desktop twitter client")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mike-Ward.Net")]
[assembly: AssemblyProduct("Tweetz Desktop")]
[assembly: AssemblyCopyright("Copyright © 2013 Mike-Ward.Net, All rights reserved")]
[assembly: AssemblyTrademark("Tweetz is a trademark of Mike Ward")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None,ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyVersion("0.6.3")]
[assembly: AssemblyFileVersion("0.6.3")]
[assembly: Guid("B21EBDFF-5222-451A-AB7D-F07EF6DF2813")]
|
mit
|
C#
|
0df23168127bc6f685b6373a209a5bfd87342b39
|
Prepare 0.2.0 release
|
LouisTakePILLz/ArgumentParser
|
ArgumentParser/Properties/AssemblyInfo.cs
|
ArgumentParser/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ArgumentParser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LouisTakePILLz")]
[assembly: AssemblyProduct("ArgumentParser")]
[assembly: AssemblyCopyright("Copyright © LouisTakePILLz 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a67b27e2-8841-4951-a6f0-a00d93f59560")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ArgumentsParser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LouisTakePILLz")]
[assembly: AssemblyProduct("ArgumentsParser")]
[assembly: AssemblyCopyright("Copyright © LouisTakePILLz 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a67b27e2-8841-4951-a6f0-a00d93f59560")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
17f7637e4a680f14f4b94b14fa3ad71c17934af6
|
Mark as PublicAPI.
|
jherby2k/AudioWorks
|
AudioWorks/AudioWorks.Common/AudioInfo.cs
|
AudioWorks/AudioWorks.Common/AudioInfo.cs
|
using JetBrains.Annotations;
namespace AudioWorks.Common
{
[PublicAPI]
public class AudioInfo
{
}
}
|
namespace AudioWorks.Common
{
public class AudioInfo
{
}
}
|
agpl-3.0
|
C#
|
939a7e601328d6e3437c5dee0fddb773ed25a9cc
|
Print doubles with InvariantCulture
|
json5/json5-dotnet
|
Json5/Json5Number.cs
|
Json5/Json5Number.cs
|
using System.Globalization;
namespace Json5
{
public class Json5Number : Json5Primitive
{
private double value;
public Json5Number(double value)
{
this.value = value;
}
public override Json5Type Type
{
get { return Json5Type.Number; }
}
protected override object Value
{
get { return this.value; }
}
internal override string ToJson5String(string space, string indent)
{
return this.value.ToString(CultureInfo.InvariantCulture);
}
public static implicit operator double(Json5Number value)
{
return value.value;
}
}
}
|
namespace Json5
{
public class Json5Number : Json5Primitive
{
private double value;
public Json5Number(double value)
{
this.value = value;
}
public override Json5Type Type
{
get { return Json5Type.Number; }
}
protected override object Value
{
get { return this.value; }
}
internal override string ToJson5String(string space, string indent)
{
return this.value.ToString();
}
public static implicit operator double(Json5Number value)
{
return value.value;
}
}
}
|
mit
|
C#
|
9da99b9ba27b5d8a4db162b2ea382ac27407ddca
|
Update existing documentation for season ids.
|
henrikfroehling/TraktApiSharp
|
Source/Lib/TraktApiSharp/Objects/Get/Shows/Seasons/TraktSeasonIds.cs
|
Source/Lib/TraktApiSharp/Objects/Get/Shows/Seasons/TraktSeasonIds.cs
|
namespace TraktApiSharp.Objects.Get.Shows.Seasons
{
using Newtonsoft.Json;
/// <summary>A collection of ids for various web services, including the Trakt id, for a Trakt season.</summary>
public class TraktSeasonIds
{
/// <summary>Gets or sets the Trakt numeric id.</summary>
[JsonProperty(PropertyName = "trakt")]
public int Trakt { get; set; }
/// <summary>Gets or sets the numeric id from thetvdb.com</summary>
[JsonProperty(PropertyName = "tvdb")]
public int? Tvdb { get; set; }
/// <summary>Gets or sets the numeric id from themoviedb.org</summary>
[JsonProperty(PropertyName = "tmdb")]
public int? Tmdb { get; set; }
/// <summary>Gets or sets the numeric id from tvrage.com</summary>
[JsonProperty(PropertyName = "tvrage")]
public int? TvRage { get; set; }
/// <summary>Returns, whether any id has been set.</summary>
[JsonIgnore]
public bool HasAnyId => Trakt > 0 || Tvdb > 0 || Tvdb > 0 || TvRage > 0;
}
}
|
namespace TraktApiSharp.Objects.Get.Shows.Seasons
{
using Newtonsoft.Json;
/// <summary>
/// A collection of ids for various web services for a Trakt season.
/// </summary>
public class TraktSeasonIds
{
/// <summary>
/// The Trakt numeric id for the season.
/// </summary>
[JsonProperty(PropertyName = "trakt")]
public int Trakt { get; set; }
/// <summary>
/// The numeric id for the season from thetvdb.com
/// </summary>
[JsonProperty(PropertyName = "tvdb")]
public int? Tvdb { get; set; }
/// <summary>
/// The numeric id for the season from themoviedb.org
/// </summary>
[JsonProperty(PropertyName = "tmdb")]
public int? Tmdb { get; set; }
/// <summary>
/// The numeric id for the season from tvrage.com
/// </summary>
[JsonProperty(PropertyName = "tvrage")]
public int? TvRage { get; set; }
/// <summary>
/// Tests, if at least one id has been set.
/// </summary>
[JsonIgnore]
public bool HasAnyId => Trakt > 0 || Tvdb > 0 || Tvdb > 0 || TvRage > 0;
}
}
|
mit
|
C#
|
0bea9541d95725e65d2fc6df561861646f7b7571
|
allow additional claims in IssueClientJwtAsync (see #2884)
|
MienDev/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4
|
src/IdentityServer4/src/Extensions/IdentityServerToolsExtensions.cs
|
src/IdentityServer4/src/Extensions/IdentityServerToolsExtensions.cs
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityModel;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
using IdentityServer4.Extensions;
namespace IdentityServer4
{
/// <summary>
/// Extensions for IdentityServerTools
/// </summary>
public static class IdentityServerToolsExtensions
{
/// <summary>
/// Issues the client JWT.
/// </summary>
/// <param name="tools">The tools.</param>
/// <param name="clientId">The client identifier.</param>
/// <param name="lifetime">The lifetime.</param>
/// <param name="scopes">The scopes.</param>
/// <param name="audiences">The audiences.</param>
/// <param name="additionalClaims">Additional claims</param>
/// <returns></returns>
public static async Task<string> IssueClientJwtAsync(this IdentityServerTools tools,
string clientId,
int lifetime,
IEnumerable<string> scopes = null,
IEnumerable<string> audiences = null,
IEnumerable<Claim> additionalClaims = null)
{
var claims = new HashSet<Claim>(new ClaimComparer());
if (additionalClaims != null)
{
foreach (var claim in additionalClaims)
{
claims.Add(claim);
}
}
claims.Add(new Claim(JwtClaimTypes.ClientId, clientId));
if (!scopes.IsNullOrEmpty())
{
foreach (var scope in scopes)
{
claims.Add(new Claim(JwtClaimTypes.Scope, scope));
}
}
claims.Add(new Claim(JwtClaimTypes.Audience, string.Format(IdentityServerConstants.AccessTokenAudience, tools.ContextAccessor.HttpContext.GetIdentityServerIssuerUri().EnsureTrailingSlash())));
if (!audiences.IsNullOrEmpty())
{
foreach (var audience in audiences)
{
claims.Add(new Claim(JwtClaimTypes.Audience, audience));
}
}
return await tools.IssueJwtAsync(lifetime, claims);
}
}
}
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityModel;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
using IdentityServer4.Extensions;
namespace IdentityServer4
{
/// <summary>
/// Extensions for IdentityServerTools
/// </summary>
public static class IdentityServerToolsExtensions
{
/// <summary>
/// Issues the client JWT.
/// </summary>
/// <param name="tools">The tools.</param>
/// <param name="clientId">The client identifier.</param>
/// <param name="lifetime">The lifetime.</param>
/// <param name="scopes">The scopes.</param>
/// <param name="audiences">The audiences.</param>
/// <returns></returns>
public static async Task<string> IssueClientJwtAsync(this IdentityServerTools tools, string clientId, int lifetime, IEnumerable<string> scopes = null, IEnumerable<string> audiences = null)
{
var claims = new HashSet<Claim>(new ClaimComparer());
claims.Add(new Claim(JwtClaimTypes.ClientId, clientId));
if (!scopes.IsNullOrEmpty())
{
foreach (var scope in scopes)
{
claims.Add(new Claim(JwtClaimTypes.Scope, scope));
}
}
claims.Add(new Claim(JwtClaimTypes.Audience, string.Format(IdentityServerConstants.AccessTokenAudience, tools.ContextAccessor.HttpContext.GetIdentityServerIssuerUri().EnsureTrailingSlash())));
if (!audiences.IsNullOrEmpty())
{
foreach (var audience in audiences)
{
claims.Add(new Claim(JwtClaimTypes.Audience, audience));
}
}
return await tools.IssueJwtAsync(lifetime, claims);
}
}
}
|
apache-2.0
|
C#
|
6d8b35fcdacf844301d3239d1a8ad26601c1446b
|
Modify NetToolProxy to accept any ToolBase object (preparation for FRH compatibility)
|
Simie/PrecisionEngineering
|
Src/PrecisionEngineering/Data/NetToolProxy.cs
|
Src/PrecisionEngineering/Data/NetToolProxy.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
namespace PrecisionEngineering.Data
{
/// <summary>
/// Wrapper around NetTool to expose private properties so we can calculate for our GUI
/// </summary>
public class NetToolProxy
{
public bool IsValid { get { return _target != null; } }
public bool IsEnabled { get { return _target.enabled; } }
public bool IsSnappingEnabled
{
get { return (bool) _snapField.GetValue(_target); }
set { _snapField.SetValue(_target, value); }
}
public NetTool.Mode Mode { get
{
return (NetTool.Mode)_modeField.GetValue(_target); } }
public ToolBase.ToolErrors BuildErrors
{
get { return _target.GetErrors(); }
}
public int ControlPointsCount { get { return (int)_controlPointCountField.GetValue(_target); } }
public IList<NetTool.ControlPoint> ControlPoints
{
get { return (IList<NetTool.ControlPoint>) _controlPointsField.GetValue(_target); }
}
public FastList<NetTool.NodePosition> NodePositions
{
get { return (FastList<NetTool.NodePosition>) _nodePositionsStaticField.GetValue(null); }
}
public NetInfo NetInfo
{
get
{ return (NetInfo) _netInfoField.GetValue(_target); }
}
public ToolController ToolController
{
get { return (ToolController)_toolControllerField.GetValue(_target); }
}
private ToolBase _target;
private readonly FieldInfo _controlPointCountField;
private readonly FieldInfo _controlPointsField;
private readonly FieldInfo _toolControllerField;
private readonly FieldInfo _netInfoField;
private readonly FieldInfo _snapField;
private readonly FieldInfo _modeField;
private readonly FieldInfo _nodePositionsStaticField;
public NetToolProxy(ToolBase target)
{
_target = target;
var t = target.GetType();
_controlPointCountField = GetPrivateField(t, "m_controlPointCount");
_controlPointsField = GetPrivateField(t, "m_controlPoints");
_toolControllerField = GetPrivateField(t, "m_toolController");
_netInfoField = GetPublicField(t, "m_prefab");
_snapField = GetPublicField(t, "m_snap");
_modeField = GetPublicField(t, "m_mode");
_nodePositionsStaticField = t.GetField("m_nodePositionsMain", BindingFlags.Static | BindingFlags.Public);
}
private static FieldInfo GetPrivateField(Type t, string name)
{
var f = t.GetField(name, BindingFlags.NonPublic | BindingFlags.Instance);
if(f == null)
Debug.LogError(string.Format("Error getting field: {0}", name));
return f;
}
private static FieldInfo GetPublicField(Type t, string name)
{
var f = t.GetField(name, BindingFlags.Public | BindingFlags.Instance);
if(f == null)
Debug.LogError(string.Format("Error getting field: {0}", name));
return f;
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
namespace PrecisionEngineering.Data
{
/// <summary>
/// Wrapper around NetTool to expose private properties so we can calculate for our GUI
/// </summary>
public class NetToolProxy
{
public bool IsValid { get { return _target != null; } }
public bool IsEnabled { get { return _target.enabled; } }
public bool IsSnappingEnabled { get { return _target.m_snap; } }
public NetTool.Mode Mode { get { return _target.m_mode; } }
public ToolBase.ToolErrors BuildErrors
{
get { return _target.GetErrors(); }
}
public int ControlPointsCount { get { return (int)_controlPointCountField.GetValue(_target); } }
public IList<NetTool.ControlPoint> ControlPoints
{
get { return (IList<NetTool.ControlPoint>) _controlPointsField.GetValue(_target); }
}
public FastList<NetTool.NodePosition> NodePositions
{
get { return NetTool.m_nodePositionsMain; }
}
public NetInfo NetInfo
{
get { return _target.m_prefab; }
}
public ToolController ToolController
{
get { return (ToolController)_toolControllerField.GetValue(_target); }
}
private NetTool _target;
private readonly FieldInfo _controlPointCountField;
private readonly FieldInfo _controlPointsField;
private readonly FieldInfo _toolControllerField;
public NetToolProxy(NetTool target)
{
_target = target;
_controlPointCountField = GetPrivateField("m_controlPointCount");
_controlPointsField = GetPrivateField("m_controlPoints");
_toolControllerField = GetPrivateField("m_toolController");
}
private static FieldInfo GetPrivateField(string name)
{
var f = typeof (NetTool).GetField(name, BindingFlags.NonPublic | BindingFlags.Instance);
if(f == null)
Debug.LogError(string.Format("Error getting field: {0}", name));
return f;
}
}
}
|
mit
|
C#
|
f9a320a6b70137ddd89968b900a479b41d659895
|
Update ICustomSerializer.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Serialization/ICustomSerializer.cs
|
TIKSN.Core/Serialization/ICustomSerializer.cs
|
namespace TIKSN.Serialization
{
/// <summary>
/// Custom (specialized or typed) serializer interface
/// </summary>
/// <typeparam name="TSerial">Type to serialize to, usually string or byte array</typeparam>
public interface ICustomSerializer<TSerial, TModel>
{
/// <summary>
/// Serialize <typeparamref name="TModel" /> to <typeparamref name="TSerial" /> type
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
TSerial Serialize(TModel obj);
}
}
|
namespace TIKSN.Serialization
{
/// <summary>
/// Custom (specialized or typed) serializer interface
/// </summary>
/// <typeparam name="TSerial">Type to serialize to, usually string or byte array</typeparam>
public interface ICustomSerializer<TSerial, TModel>
{
/// <summary>
/// Serialize <typeparamref name="TModel"/> to <typeparamref name="TSerial"/> type
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
TSerial Serialize(TModel obj);
}
}
|
mit
|
C#
|
33d772dec6644fe50421326279b55ef054369b64
|
Make static
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Tests/Helpers/TestNodeBuilder.cs
|
WalletWasabi.Tests/Helpers/TestNodeBuilder.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using WalletWasabi.BitcoinCore;
using WalletWasabi.Helpers;
namespace WalletWasabi.Tests.Helpers
{
public static class TestNodeBuilder
{
public static async Task<CoreNode> CreateAsync([CallerFilePath]string callerFilePath = null, [CallerMemberName]string callerMemberName = null, string additionalFolder = null)
=> await CoreNode.CreateAsync(Path.Combine(Global.Instance.DataDir, EnvironmentHelpers.ExtractFileName(callerFilePath), callerMemberName, additionalFolder ?? ""));
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using WalletWasabi.BitcoinCore;
using WalletWasabi.Helpers;
namespace WalletWasabi.Tests.Helpers
{
public class TestNodeBuilder
{
public static async Task<CoreNode> CreateAsync([CallerFilePath]string callerFilePath = null, [CallerMemberName]string callerMemberName = null, string additionalFolder = null)
=> await CoreNode.CreateAsync(Path.Combine(Global.Instance.DataDir, EnvironmentHelpers.ExtractFileName(callerFilePath), callerMemberName, additionalFolder ?? ""));
}
}
|
mit
|
C#
|
f781c68e3346f03345a21c08f06870d0e495d246
|
Reduce the test class size using AutoFixture
|
pveller/Sitecore.FakeDb,sergeyshushlyapin/Sitecore.FakeDb,hermanussen/Sitecore.FakeDb
|
src/Sitecore.FakeDb.Tests/DbTemplateTest.cs
|
src/Sitecore.FakeDb.Tests/DbTemplateTest.cs
|
namespace Sitecore.FakeDb.Tests
{
using System.Linq;
using FluentAssertions;
using Ploeh.AutoFixture.Xunit2;
using Sitecore.Data;
using Xunit;
public class DbTemplateTest
{
[Theory, AutoData]
public void ShouldBeAnItem([NoAutoProperties]DbTemplate template)
{
template.Should().BeAssignableTo<DbItem>();
}
[Theory, AutoData]
public void ShouldInstantiateStandardValuesCollection([NoAutoProperties]DbTemplate template)
{
template.StandardValues.Should().NotBeNull();
}
// TODO:[High] The test below states that we cannot get fake item fields by id.
[Fact]
public void ShouldCreateTemplateFieldsUsingNamesAsLowercaseKeys()
{
// arrange
var template = new DbTemplate { "Title", "Description" };
// assert
template.Fields.Where(f => !f.Name.StartsWith("__")).Select(f => f.Name).ShouldBeEquivalentTo(new[] { "Title", "Description" });
}
[Theory, AutoData]
public void ShouldSetStandardValues([NoAutoProperties]DbTemplate template)
{
// act
template.Add("Title", "$name");
// assert
var id = template.Fields.Single(f => f.Name == "Title").ID;
template.Fields[id].Value.Should().Be(string.Empty);
template.StandardValues[id].Value.Should().Be("$name");
}
[Theory, AutoData]
public void ShouldAddFieldById([NoAutoProperties]DbTemplate template, ID fieldId)
{
// act
template.Add(fieldId);
// assert
template.Fields[fieldId].Should().NotBeNull();
template.Fields[fieldId].Name.Should().Be(fieldId.ToShortID().ToString());
}
[Theory, AutoData]
public void ShouldBeEmptyBaseIds([NoAutoProperties]DbTemplate template)
{
template.BaseIDs.Should().BeEmpty();
}
[Theory, AutoData]
public void ShouldGetBaseIdsFromFieldsIfExist([NoAutoProperties]DbTemplate template, ID id1, ID id2)
{
// arrange
template.Fields.Add(new DbField(FieldIDs.BaseTemplate) { Value = id1 + "|" + id2 });
// act & assert
template.BaseIDs[0].Should().Be(id1);
template.BaseIDs[1].Should().Be(id2);
}
[Theory, AutoData]
public void ShouldSetDefaultParentId([NoAutoProperties] DbTemplate template)
{
template.ParentID.Should().Be(ItemIDs.TemplateRoot);
}
}
}
|
namespace Sitecore.FakeDb.Tests
{
using System.Linq;
using FluentAssertions;
using Ploeh.AutoFixture.Xunit2;
using Sitecore.Data;
using Xunit;
public class DbTemplateTest
{
[Fact]
public void ShouldBeAnItem()
{
// arrange
var template = new DbTemplate();
// assert
template.Should().BeAssignableTo<DbItem>();
}
[Fact]
public void ShouldInstantiateStandardValuesCollection()
{
// arrange & act
var template = new DbTemplate();
// assert
template.StandardValues.Should().NotBeNull();
}
// TODO:[High] The test below states that we cannot get fake item fields by id.
[Fact]
public void ShouldCreateTemplateFieldsUsingNamesAsLowercaseKeys()
{
// arrange
var template = new DbTemplate { "Title", "Description" };
// assert
template.Fields.Where(f => !f.Name.StartsWith("__")).Select(f => f.Name).ShouldBeEquivalentTo(new[] { "Title", "Description" });
}
[Fact]
public void ShouldSetStandardValues()
{
// arrange & act
var template = new DbTemplate { { "Title", "$name" } };
// assert
var id = template.Fields.Single(f => f.Name == "Title").ID;
template.Fields[id].Value.Should().Be(string.Empty);
template.StandardValues[id].Value.Should().Be("$name");
}
[Fact]
public void ShouldAddFieldById()
{
// arrange
var fieldId = ID.NewID;
// act
var template = new DbTemplate { fieldId };
// assert
template.Fields[fieldId].Should().NotBeNull();
template.Fields[fieldId].Name.Should().Be(fieldId.ToShortID().ToString());
}
[Fact]
public void ShouldBeEmptyBaseIds()
{
// arrange
var template = new DbTemplate();
// act & assert
template.BaseIDs.Should().BeEmpty();
}
[Fact]
public void ShouldGetBaseIdsFromFieldsIfExist()
{
// arrange
var id1 = ID.NewID;
var id2 = ID.NewID;
var template = new DbTemplate();
template.Fields.Add(new DbField(FieldIDs.BaseTemplate) { Value = id1 + "|" + id2 });
// act & assert
template.BaseIDs[0].Should().Be(id1);
template.BaseIDs[1].Should().Be(id2);
}
[Theory, AutoData]
public void ShouldSetDefaultParentId([NoAutoProperties] DbTemplate template)
{
template.ParentID.Should().Be(ItemIDs.TemplateRoot);
}
}
}
|
mit
|
C#
|
a71f769cce26eb9a010e2dd67d2ee637f74cd932
|
Add missing license header
|
NeoAdonis/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,smoogipooo/osu,UselessToucan/osu,ppy/osu,peppy/osu,peppy/osu
|
osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.cs
|
osu.Game.Tests/Visual/Editing/TestSceneTimelineHitObjectBlueprint.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 NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osuTK;
using osuTK.Input;
using static osu.Game.Screens.Edit.Compose.Components.Timeline.TimelineHitObjectBlueprint;
namespace osu.Game.Tests.Visual.Editing
{
public class TestSceneTimelineHitObjectBlueprint : TimelineTestScene
{
public override Drawable CreateTestComponent() => new TimelineBlueprintContainer(Composer);
[Test]
public void TestDisallowZeroDurationObjects()
{
DragBar dragBar;
AddStep("add spinner", () =>
{
EditorBeatmap.Clear();
EditorBeatmap.Add(new Spinner
{
Position = new Vector2(256, 256),
StartTime = 150,
Duration = 500
});
});
AddStep("hold down drag bar", () =>
{
// distinguishes between the actual drag bar and its "underlay shadow".
dragBar = this.ChildrenOfType<DragBar>().Single(bar => bar.HandlePositionalInput);
InputManager.MoveMouseTo(dragBar);
InputManager.PressButton(MouseButton.Left);
});
AddStep("try to drag bar past start", () =>
{
var blueprint = this.ChildrenOfType<TimelineHitObjectBlueprint>().Single();
InputManager.MoveMouseTo(blueprint.SelectionQuad.TopLeft - new Vector2(100, 0));
InputManager.ReleaseButton(MouseButton.Left);
});
AddAssert("object has non-zero duration", () => EditorBeatmap.HitObjects.OfType<IHasDuration>().Single().Duration > 0);
}
}
}
|
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osuTK;
using osuTK.Input;
using static osu.Game.Screens.Edit.Compose.Components.Timeline.TimelineHitObjectBlueprint;
namespace osu.Game.Tests.Visual.Editing
{
public class TestSceneTimelineHitObjectBlueprint : TimelineTestScene
{
public override Drawable CreateTestComponent() => new TimelineBlueprintContainer(Composer);
[Test]
public void TestDisallowZeroDurationObjects()
{
DragBar dragBar;
AddStep("add spinner", () =>
{
EditorBeatmap.Clear();
EditorBeatmap.Add(new Spinner
{
Position = new Vector2(256, 256),
StartTime = 150,
Duration = 500
});
});
AddStep("hold down drag bar", () =>
{
// distinguishes between the actual drag bar and its "underlay shadow".
dragBar = this.ChildrenOfType<DragBar>().Single(bar => bar.HandlePositionalInput);
InputManager.MoveMouseTo(dragBar);
InputManager.PressButton(MouseButton.Left);
});
AddStep("try to drag bar past start", () =>
{
var blueprint = this.ChildrenOfType<TimelineHitObjectBlueprint>().Single();
InputManager.MoveMouseTo(blueprint.SelectionQuad.TopLeft - new Vector2(100, 0));
InputManager.ReleaseButton(MouseButton.Left);
});
AddAssert("object has non-zero duration", () => EditorBeatmap.HitObjects.OfType<IHasDuration>().Single().Duration > 0);
}
}
}
|
mit
|
C#
|
5b905e307bd1b024849f7094dd0a5acd21039cf8
|
Fix "Weather" widget API result error
|
danielchalmers/DesktopWidgets
|
DesktopWidgets/Classes/OpenWeatherMapApiResult.cs
|
DesktopWidgets/Classes/OpenWeatherMapApiResult.cs
|
using System.Collections.Generic;
namespace DesktopWidgets.Classes
{
public class Coord
{
public double lon { get; set; }
public double lat { get; set; }
}
public class Weather
{
public int id { get; set; }
public string main { get; set; }
public string description { get; set; }
public string icon { get; set; }
}
public class Main
{
public double temp { get; set; }
public double pressure { get; set; }
public int humidity { get; set; }
public double temp_min { get; set; }
public double temp_max { get; set; }
public double sea_level { get; set; }
public double grnd_level { get; set; }
}
public class Wind
{
public double speed { get; set; }
public double deg { get; set; }
}
public class Rain
{
public double __invalid_name__3h { get; set; }
}
public class Clouds
{
public int all { get; set; }
}
public class Sys
{
public double message { get; set; }
public string country { get; set; }
public int sunrise { get; set; }
public int sunset { get; set; }
}
public class OpenWeatherMapApiResult
{
public Coord coord { get; set; }
public List<Weather> weather { get; set; }
public string @base { get; set; }
public Main main { get; set; }
public Wind wind { get; set; }
public Rain rain { get; set; }
public Clouds clouds { get; set; }
public int dt { get; set; }
public Sys sys { get; set; }
public int id { get; set; }
public string name { get; set; }
public int cod { get; set; }
}
}
|
using System.Collections.Generic;
namespace DesktopWidgets.Classes
{
public abstract class Coord
{
public double lon { get; set; }
public double lat { get; set; }
}
public abstract class Weather
{
public int id { get; set; }
public string main { get; set; }
public string description { get; set; }
public string icon { get; set; }
}
public abstract class Main
{
public double temp { get; set; }
public double pressure { get; set; }
public int humidity { get; set; }
public double temp_min { get; set; }
public double temp_max { get; set; }
public double sea_level { get; set; }
public double grnd_level { get; set; }
}
public abstract class Wind
{
public double speed { get; set; }
public double deg { get; set; }
}
public abstract class Rain
{
public double __invalid_name__3h { get; set; }
}
public abstract class Clouds
{
public int all { get; set; }
}
public abstract class Sys
{
public double message { get; set; }
public string country { get; set; }
public int sunrise { get; set; }
public int sunset { get; set; }
}
public abstract class OpenWeatherMapApiResult
{
public Coord coord { get; set; }
public List<Weather> weather { get; set; }
public string @base { get; set; }
public Main main { get; set; }
public Wind wind { get; set; }
public Rain rain { get; set; }
public Clouds clouds { get; set; }
public int dt { get; set; }
public Sys sys { get; set; }
public int id { get; set; }
public string name { get; set; }
public int cod { get; set; }
}
}
|
apache-2.0
|
C#
|
3b6a20cafeab937fe79f4b76e698b8335232596c
|
Update OpeningCSVFiles.cs
|
asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET
|
Examples/CSharp/Files/Handling/OpeningCSVFiles.cs
|
Examples/CSharp/Files/Handling/OpeningCSVFiles.cs
|
using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.Files.Handling
{
public class OpeningCSVFiles
{
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);
//Instantiate LoadOptions specified by the LoadFormat.
LoadOptions loadOptions4 = new LoadOptions(LoadFormat.CSV);
//Create a Workbook object and opening the file from its path
Workbook wbCSV = new Workbook(dataDir + "Book_CSV.csv", loadOptions4);
Console.WriteLine("CSV file opened successfully!");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.Files.Handling
{
public class OpeningCSVFiles
{
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);
//Instantiate LoadOptions specified by the LoadFormat.
LoadOptions loadOptions4 = new LoadOptions(LoadFormat.CSV);
//Create a Workbook object and opening the file from its path
Workbook wbCSV = new Workbook(dataDir + "Book_CSV.csv", loadOptions4);
Console.WriteLine("CSV file opened successfully!");
//ExEnd:1
}
}
}
|
mit
|
C#
|
5fbb8302fae5ffd0aaf7cdd58a58bed3d1fd8dcd
|
Add scope to OAuth2AccessToken
|
WestDiscGolf/Fitbit.NET,WestDiscGolf/Fitbit.NET,amammay/Fitbit.NET,amammay/Fitbit.NET,AlexGhiondea/Fitbit.NET,AlexGhiondea/Fitbit.NET,aarondcoleman/Fitbit.NET,AlexGhiondea/Fitbit.NET,aarondcoleman/Fitbit.NET,WestDiscGolf/Fitbit.NET,amammay/Fitbit.NET,aarondcoleman/Fitbit.NET
|
Fitbit.Portable/OAuth2/OAuth2AccessToken.cs
|
Fitbit.Portable/OAuth2/OAuth2AccessToken.cs
|
using System;
using Newtonsoft.Json;
namespace Fitbit.Api.Portable.OAuth2
{
public class OAuth2AccessToken
{
[JsonProperty("access_token")]
public string Token { get; set; }
[JsonProperty("token_type")]
public string TokenType { get; set; } // "Bearer" is expected
[JsonProperty("scope")]
public string Scope { get; set; }
[JsonProperty("expires_in")]
public int ExpiresIn { get; set; } //maybe convert this to a DateTime ?
[JsonProperty("refresh_token")]
public string RefreshToken { get; set; }
[JsonProperty("user_id")]
public string UserId { get; set; }
/// <summary>
/// This property is NOT set by the library. It is simply provided as a covenience placeholder. The library consumer is responsible for setting up this field.
/// The library assums this DateTime is UTC for token validation purposes.
/// </summary>
public DateTime UtcExpirationDate { get; set; }
public bool IsFresh()
{
if (DateTime.MinValue == UtcExpirationDate)
throw new InvalidOperationException(
$"The {nameof(UtcExpirationDate)} property needs to be set before using this method.");
return DateTime.Compare(DateTime.UtcNow, UtcExpirationDate) < 0;
}
}
}
|
using System;
using Newtonsoft.Json;
namespace Fitbit.Api.Portable.OAuth2
{
public class OAuth2AccessToken
{
[JsonProperty("access_token")]
public string Token { get; set; }
[JsonProperty("token_type")]
public string TokenType { get; set; } // "Bearer" is expected
[JsonProperty("expires_in")]
public int ExpiresIn { get; set; } //maybe convert this to a DateTime ?
[JsonProperty("refresh_token")]
public string RefreshToken { get; set; }
[JsonProperty("user_id")]
public string UserId { get; set; }
/// <summary>
/// This property is NOT set by the library. It is simply provided as a covenience placeholder. The library consumer is responsible for setting up this field.
/// The library assums this DateTime is UTC for token validation purposes.
/// </summary>
public DateTime UtcExpirationDate { get; set; }
public bool IsFresh()
{
if (DateTime.MinValue == UtcExpirationDate)
throw new InvalidOperationException(
$"The {nameof(UtcExpirationDate)} property needs to be set before using this method.");
return DateTime.Compare(DateTime.UtcNow, UtcExpirationDate) < 0;
}
}
}
|
mit
|
C#
|
cbf3b11d44898eff42515843317667efcacb5552
|
Set the the game width and height to the console window size or to a maximum value.
|
darkriszty/SnakeApp
|
src/SnakeApp/Controllers/GameController.cs
|
src/SnakeApp/Controllers/GameController.cs
|
using SnakeApp.Models;
using System;
namespace SnakeApp.Controllers
{
public class GameController
{
private byte MAX_WIDTH = 80;
private byte MAX_HEIGHT = 25;
public void StartNewGame()
{
PrepareConsole();
var game = new Game(Math.Min((byte)(Console.WindowWidth - 1), MAX_WIDTH), Math.Min((byte)(Console.WindowHeight - 1), MAX_HEIGHT), 5, 100);
game.StartAsync();
ConsoleKeyInfo userInput = new ConsoleKeyInfo();
do
{
userInput = Console.ReadKey(true);
game.ReceiveInput(userInput.Key);
} while (userInput.Key != ConsoleKey.Q);
RestoreConsole();
}
private void PrepareConsole()
{
// getting the current cursor visibility is not supported on linux, so just hide then restore it
Console.Clear();
Console.CursorVisible = false;
}
private void RestoreConsole()
{
Console.Clear();
Console.CursorVisible = true;
}
}
}
|
using SnakeApp.Models;
using System;
namespace SnakeApp.Controllers
{
public class GameController
{
public void StartNewGame()
{
PrepareConsole();
var game = new Game(80, 25, 5, 100);
game.StartAsync();
ConsoleKeyInfo userInput = new ConsoleKeyInfo();
do
{
userInput = Console.ReadKey(true);
game.ReceiveInput(userInput.Key);
} while (userInput.Key != ConsoleKey.Q);
RestoreConsole();
}
private void PrepareConsole()
{
// getting the current cursor visibility is not supported on linux, so just hide then restore it
Console.Clear();
Console.CursorVisible = false;
}
private void RestoreConsole()
{
Console.Clear();
Console.CursorVisible = true;
}
}
}
|
mit
|
C#
|
4a5ad6209a4d81dff964c3b453cd27c2890f001e
|
Revert "Make Distributor require EndpointDeliveryService."
|
justinjstark/Delivered,justinjstark/Verdeler
|
Verdeler/Distributor.cs
|
Verdeler/Distributor.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Verdeler
{
public class Distributor<TDistributable> : IDistributor<TDistributable> where TDistributable : IDistributable
{
private readonly List<IEndpointRepository> _endpointRepositories
= new List<IEndpointRepository>();
private readonly Dictionary<Type, IEndpointDeliveryService> _endpointDeliveryServices
= new Dictionary<Type, IEndpointDeliveryService>();
public void RegisterEndpointRepository(IEndpointRepository endpointRepository)
{
if (!_endpointRepositories.Contains(endpointRepository))
{
_endpointRepositories.Add(endpointRepository);
}
}
public void RegisterEndpointDeliveryService<TEndpoint>(IEndpointDeliveryService<TEndpoint> endpointDeliveryService)
{
_endpointDeliveryServices[typeof(TEndpoint)] = endpointDeliveryService;
}
public void Distribute(TDistributable distributable, string recipientName)
{
var endpoints = _endpointRepositories.SelectMany(r => r.GetEndpointsForRecipient(recipientName));
foreach (var endpoint in endpoints)
{
var endpointDeliveryService = _endpointDeliveryServices[endpoint.GetType()];
endpointDeliveryService.Deliver(distributable, endpoint);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Verdeler
{
public class Distributor<TDistributable> : IDistributor<TDistributable> where TDistributable : IDistributable
{
private readonly List<IEndpointRepository> _endpointRepositories
= new List<IEndpointRepository>();
private readonly Dictionary<Type, IEndpointDeliveryService> _endpointDeliveryServices
= new Dictionary<Type, IEndpointDeliveryService>();
public void RegisterEndpointRepository(IEndpointRepository endpointRepository)
{
if (!_endpointRepositories.Contains(endpointRepository))
{
_endpointRepositories.Add(endpointRepository);
}
}
public void RegisterEndpointDeliveryService<TEndpoint>(EndpointDeliveryService<TDistributable, TEndpoint> endpointDeliveryService)
where TEndpoint : IEndpoint
{
_endpointDeliveryServices[typeof(TEndpoint)] = endpointDeliveryService;
}
public void Distribute(TDistributable distributable, string recipientName)
{
var endpoints = _endpointRepositories.SelectMany(r => r.GetEndpointsForRecipient(recipientName));
foreach (var endpoint in endpoints)
{
var endpointDeliveryService = _endpointDeliveryServices[endpoint.GetType()];
endpointDeliveryService.Deliver(distributable, endpoint);
}
}
}
}
|
mit
|
C#
|
ba56e6c2bbffdc2f3ed43fee0ecc749dfcd40fba
|
Fix min/max expression funcs
|
falahati/LiteDB,89sos98/LiteDB,falahati/LiteDB,mbdavid/LiteDB,89sos98/LiteDB
|
LiteDB/Document/Expression/Functions/Aggregate.cs
|
LiteDB/Document/Expression/Functions/Aggregate.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace LiteDB
{
public partial class BsonExpression
{
public static IEnumerable<BsonValue> COUNT(IEnumerable<BsonValue> values)
{
yield return values.Count();
}
public static IEnumerable<BsonValue> MIN(IEnumerable<BsonValue> values)
{
var min = BsonValue.MaxValue;
foreach(var value in values.Where(x => x.IsNumber))
{
min = value < min ? value : min;
}
yield return min == BsonValue.MaxValue ? BsonValue.MinValue : min;
}
public static IEnumerable<BsonValue> MAX(IEnumerable<BsonValue> values)
{
var max = BsonValue.MinValue;
foreach (var value in values.Where(x => x.IsNumber))
{
max = value > max ? value : max;
}
yield return max == BsonValue.MinValue ? BsonValue.MaxValue : max;
}
public static IEnumerable<BsonValue> AVG(IEnumerable<BsonValue> values)
{
var sum = new BsonValue(0);
var count = 0;
foreach (var value in values.Where(x => x.IsNumber))
{
sum += value;
count++;
}
if (count > 0)
{
yield return sum / count;
}
}
public static IEnumerable<BsonValue> SUM(IEnumerable<BsonValue> values)
{
var sum = new BsonValue(0);
foreach (var value in values.Where(x => x.IsNumber))
{
sum += value;
}
yield return sum;
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace LiteDB
{
public partial class BsonExpression
{
public static IEnumerable<BsonValue> COUNT(IEnumerable<BsonValue> values)
{
yield return values.Count();
}
public static IEnumerable<BsonValue> MIN(IEnumerable<BsonValue> values)
{
yield return values.Min();
}
public static IEnumerable<BsonValue> MAX(IEnumerable<BsonValue> values)
{
yield return values.Max();
}
public static IEnumerable<BsonValue> AVG(IEnumerable<BsonValue> values)
{
var sum = new BsonValue(0);
var count = 0;
foreach (var value in values.Where(x => x.IsNumber))
{
sum += value;
count++;
}
if (count > 0)
{
yield return sum / count;
}
}
public static IEnumerable<BsonValue> SUM(IEnumerable<BsonValue> values)
{
var sum = new BsonValue(0);
foreach (var value in values.Where(x => x.IsNumber))
{
sum += value;
}
yield return sum;
}
}
}
|
mit
|
C#
|
dc96d7f2e7d1730632ff06f798921743534aa58c
|
Update ItemComponent.cs
|
williambl/Haunt
|
Haunt/Assets/Scripts/Items/ItemComponent.cs
|
Haunt/Assets/Scripts/Items/ItemComponent.cs
|
using UnityEngine;
public class ItemComponent : MonoBehaviour {
[Header("Properties")]
public Item item;
public bool isHeld = false;
}
|
using UnityEngine;
public class ItemComponent : MonoBehaviour {
public Item item;
public bool isHeld = false;
}
|
mit
|
C#
|
d20011ba58a849c0cca543b13149458d03f05f39
|
Fix an endless feedback loop
|
naoey/osu,NeoAdonis/osu,peppy/osu-new,naoey/osu,peppy/osu,smoogipoo/osu,johnneijzen/osu,UselessToucan/osu,ppy/osu,ppy/osu,UselessToucan/osu,johnneijzen/osu,NeoAdonis/osu,2yangk23/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu,DrabWeb/osu,smoogipoo/osu,peppy/osu,ppy/osu,naoey/osu,ZLima12/osu,smoogipoo/osu,smoogipooo/osu,UselessToucan/osu,ZLima12/osu,EVAST9919/osu,EVAST9919/osu,DrabWeb/osu,DrabWeb/osu
|
osu.Game/Screens/Select/MatchSongSelect.cs
|
osu.Game/Screens/Select/MatchSongSelect.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Screens.Select
{
public class MatchSongSelect : SongSelect
{
protected override bool OnSelectionFinalised()
{
Schedule(() =>
{
// needs to be scheduled else we enter an infinite feedback loop.
if (IsCurrentScreen) Exit();
});
return true;
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Screens.Select
{
public class MatchSongSelect : SongSelect
{
protected override bool OnSelectionFinalised()
{
Exit();
return true;
}
}
}
|
mit
|
C#
|
f5e3ca5b863ff95da21e3b4a0c16b5546299ee27
|
Fix DeadPlayer Attack
|
bunashibu/kikan
|
Assets/Scripts/Skill/SkillInstantiator.cs
|
Assets/Scripts/Skill/SkillInstantiator.cs
|
using UnityEngine;
using System;
using System.Collections;
namespace Bunashibu.Kikan {
public class SkillInstantiator : Photon.MonoBehaviour {
void Update() {
if (!photonView.isMine || _player.Hp.Cur <= 0)
return;
for (int i=0; i<_keys.Length; ++i) {
if (_canUse && Input.GetKey(_keys[i])) {
InstantiateSkill(i);
UpdateCT(i);
break;
}
}
}
private void InstantiateSkill(int i) {
string path = "Prefabs/Skill/" + _jobName + "/" + _names[i];
var offset = _appearOffset[i];
if (_renderer.flipX)
offset.x *= -1;
var pos = this.transform.position + offset;
var skill = PhotonNetwork.Instantiate(path, pos, Quaternion.identity, 0).GetComponent<Skill>();
skill.Init(_renderer.flipX, _player.PhotonView.viewID);
}
private void UpdateCT(int i) {
_canUse = false;
MonoUtility.Instance.DelaySec(_skillCT[i], () => {
_canUse = true;
});
_player.SkillInfo.SetState(_names[i], SkillState.Using);
MonoUtility.Instance.DelaySec(_skillCT[i], () => {
_player.SkillInfo.SetState(_names[i], SkillState.Ready);
});
_player.State.Rigor = true;
MonoUtility.Instance.DelaySec(_rigorCT[i], () => {
_player.State.Rigor = false;
_player.SkillInfo.SetState(_names[i], SkillState.Used);
});
}
[SerializeField] private string _jobName;
[SerializeField] private KeyCode[] _keys;
[SerializeField] private SkillName[] _names;
[SerializeField] private float[] _skillCT;
[SerializeField] private float[] _rigorCT;
[SerializeField] private Vector3[] _appearOffset;
[SerializeField] private SpriteRenderer _renderer;
[SerializeField] private BattlePlayer _player;
private bool _canUse = true;
}
}
|
using UnityEngine;
using System;
using System.Collections;
namespace Bunashibu.Kikan {
public class SkillInstantiator : Photon.MonoBehaviour {
void Update() {
if (!photonView.isMine)
return;
for (int i=0; i<_keys.Length; ++i) {
if (_canUse && Input.GetKey(_keys[i])) {
InstantiateSkill(i);
UpdateCT(i);
break;
}
}
}
private void InstantiateSkill(int i) {
string path = "Prefabs/Skill/" + _jobName + "/" + _names[i];
var offset = _appearOffset[i];
if (_renderer.flipX)
offset.x *= -1;
var pos = this.transform.position + offset;
var skill = PhotonNetwork.Instantiate(path, pos, Quaternion.identity, 0).GetComponent<Skill>();
skill.Init(_renderer.flipX, _player.PhotonView.viewID);
}
private void UpdateCT(int i) {
_canUse = false;
MonoUtility.Instance.DelaySec(_skillCT[i], () => {
_canUse = true;
});
_player.SkillInfo.SetState(_names[i], SkillState.Using);
MonoUtility.Instance.DelaySec(_skillCT[i], () => {
_player.SkillInfo.SetState(_names[i], SkillState.Ready);
});
_player.State.Rigor = true;
MonoUtility.Instance.DelaySec(_rigorCT[i], () => {
_player.State.Rigor = false;
_player.SkillInfo.SetState(_names[i], SkillState.Used);
});
}
[SerializeField] private string _jobName;
[SerializeField] private KeyCode[] _keys;
[SerializeField] private SkillName[] _names;
[SerializeField] private float[] _skillCT;
[SerializeField] private float[] _rigorCT;
[SerializeField] private Vector3[] _appearOffset;
[SerializeField] private SpriteRenderer _renderer;
[SerializeField] private BattlePlayer _player;
private bool _canUse = true;
}
}
|
mit
|
C#
|
a53a5944f80dd196bd987cbe9f25ced406fb88a6
|
Remove empty row if no validation
|
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
|
BTCPayServer/Views/Server/Policies.cshtml
|
BTCPayServer/Views/Server/Policies.cshtml
|
@model BTCPayServer.Services.PoliciesSettings
@{
ViewData.SetActivePageAndTitle(ServerNavPages.Policies);
}
<partial name="_StatusMessage" for="@TempData["StatusMessage"]" />
@if (!this.ViewContext.ModelState.IsValid)
{
<div class="row">
<div class="col-lg-6">
<div asp-validation-summary="All" class="text-danger"></div>
</div>
</div>
}
<div class="row">
<div class="col-lg-6">
<form method="post">
<div class="form-group">
<label asp-for="RequiresConfirmedEmail"></label>
<input asp-for="RequiresConfirmedEmail" type="checkbox" class="form-check-inline" />
</div>
<div class="form-group">
<label asp-for="LockSubscription"></label>
<input asp-for="LockSubscription" type="checkbox" class="form-check-inline" />
</div>
<div class="form-group">
<label asp-for="DiscourageSearchEngines"></label>
<input asp-for="DiscourageSearchEngines" type="checkbox" class="form-check-inline" />
</div>
<div class="form-group">
<label asp-for="RootAppId"></label>
<select asp-for="RootAppId" asp-items="ViewBag.AppsList" class="form-control"></select>
</div>
<button type="submit" class="btn btn-primary" name="command" value="Save">Save</button>
</form>
</div>
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
|
@model BTCPayServer.Services.PoliciesSettings
@{
ViewData.SetActivePageAndTitle(ServerNavPages.Policies);
}
<partial name="_StatusMessage" for="@TempData["StatusMessage"]" />
<div class="row">
<div class="col-lg-6">
<div asp-validation-summary="All" class="text-danger"></div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<form method="post">
<div class="form-group">
<label asp-for="RequiresConfirmedEmail"></label>
<input asp-for="RequiresConfirmedEmail" type="checkbox" class="form-check-inline" />
</div>
<div class="form-group">
<label asp-for="LockSubscription"></label>
<input asp-for="LockSubscription" type="checkbox" class="form-check-inline" />
</div>
<div class="form-group">
<label asp-for="DiscourageSearchEngines"></label>
<input asp-for="DiscourageSearchEngines" type="checkbox" class="form-check-inline" />
</div>
<div class="form-group">
<label asp-for="RootAppId"></label>
<select asp-for="RootAppId" asp-items="ViewBag.AppsList" class="form-control"></select>
</div>
<button type="submit" class="btn btn-primary" name="command" value="Save">Save</button>
</form>
</div>
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
|
mit
|
C#
|
b3018505bba2d96db07c0a8c0f053f99ffd66f22
|
implement dfa building
|
miraimann/Knuth-Morris-Pratt
|
KnuthMorrisPratt/KnuthMorrisPratt/Finder.cs
|
KnuthMorrisPratt/KnuthMorrisPratt/Finder.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace KnuthMorrisPratt
{
internal class Finder<T> : IFinder<T>
{
private readonly T[] _pattern;
private readonly int[,] _dfa;
public Finder(IEnumerable<T> word)
{
_pattern = word as T[] ?? word.ToArray();
var abc = _pattern.Distinct().ToList();
_dfa = new int[abc.Count, _pattern.Length];
_dfa[0, 0] = 1;
for (int x = 0, j = 1; j < _pattern.Length; x = _dfa[abc.IndexOf(_pattern[j++]), x])
{
for (int c = 0; c < abc.Count; c++)
_dfa[c, j] = _dfa[c, x];
_dfa[abc.IndexOf(_pattern[j]), j] = j + 1;
}
}
public int FindIn(IEnumerable<T> sequence)
{
throw new NotImplementedException();
}
public int FindLastIn(IEnumerable<T> sequence)
{
throw new NotImplementedException();
}
public IEnumerable<int> FindAllIn(IEnumerable<T> sequence)
{
throw new NotImplementedException();
}
public bool ExistsIn(IEnumerable<T> sequence)
{
throw new NotImplementedException();
}
}
}
|
using System;
using System.Collections.Generic;
namespace KnuthMorrisPratt
{
internal class Finder<T> : IFinder<T>
{
public Finder(IEnumerable<T> word)
{
throw new NotImplementedException();
}
public int FindIn(IEnumerable<T> sequence)
{
throw new NotImplementedException();
}
public int FindLastIn(IEnumerable<T> sequence)
{
throw new NotImplementedException();
}
public IEnumerable<int> FindAllIn(IEnumerable<T> sequence)
{
throw new NotImplementedException();
}
public bool ExistsIn(IEnumerable<T> sequence)
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
8a6f67a84b2054b938a62db954f64af53272ae4d
|
Fix no build option in dotnet test task
|
EdwardBlair/cli,blackdwarf/cli,blackdwarf/cli,mlorbetske/cli,svick/cli,harshjain2/cli,johnbeisner/cli,nguerrera/cli,ravimeda/cli,ravimeda/cli,livarcocc/cli-1,livarcocc/cli-1,AbhitejJohn/cli,Faizan2304/cli,mlorbetske/cli,johnbeisner/cli,nguerrera/cli,harshjain2/cli,EdwardBlair/cli,jonsequitur/cli,jonsequitur/cli,dasMulli/cli,AbhitejJohn/cli,johnbeisner/cli,svick/cli,livarcocc/cli-1,dasMulli/cli,jonsequitur/cli,AbhitejJohn/cli,Faizan2304/cli,blackdwarf/cli,ravimeda/cli,Faizan2304/cli,EdwardBlair/cli,svick/cli,AbhitejJohn/cli,mlorbetske/cli,mlorbetske/cli,nguerrera/cli,dasMulli/cli,nguerrera/cli,jonsequitur/cli,blackdwarf/cli,harshjain2/cli
|
build_projects/dotnet-cli-build/DotNetTest.cs
|
build_projects/dotnet-cli-build/DotNetTest.cs
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DotNet.Cli.Build
{
public class DotNetTest : DotNetTool
{
protected override string Command
{
get { return "test"; }
}
protected override string Args
{
get { return $"{GetProjectPath()} {GetConfiguration()} {GetLogger()} {GetNoBuild()}"; }
}
public string Configuration { get; set; }
public string Logger { get; set; }
public string ProjectPath { get; set; }
public bool NoBuild { get; set; }
private string GetConfiguration()
{
if (!string.IsNullOrEmpty(Configuration))
{
return $"--configuration {Configuration}";
}
return null;
}
private string GetLogger()
{
if (!string.IsNullOrEmpty(Logger))
{
return $"--logger:{Logger}";
}
return null;
}
private string GetProjectPath()
{
if (!string.IsNullOrEmpty(ProjectPath))
{
return $"{ProjectPath}";
}
return null;
}
private string GetNoBuild()
{
if (NoBuild)
{
return "--no-build";
}
return null;
}
}
}
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DotNet.Cli.Build
{
public class DotNetTest : DotNetTool
{
protected override string Command
{
get { return "test"; }
}
protected override string Args
{
get { return $"{GetProjectPath()} {GetConfiguration()} {GetLogger()} {GetNoBuild()}"; }
}
public string Configuration { get; set; }
public string Logger { get; set; }
public string ProjectPath { get; set; }
public bool NoBuild { get; set; }
private string GetConfiguration()
{
if (!string.IsNullOrEmpty(Configuration))
{
return $"--configuration {Configuration}";
}
return null;
}
private string GetLogger()
{
if (!string.IsNullOrEmpty(Logger))
{
return $"--logger:{Logger}";
}
return null;
}
private string GetProjectPath()
{
if (!string.IsNullOrEmpty(ProjectPath))
{
return $"{ProjectPath}";
}
return null;
}
private string GetNoBuild()
{
if (NoBuild)
{
return "--noBuild";
}
return null;
}
}
}
|
mit
|
C#
|
66072d149944a3d65310ed284009507fd71140e9
|
Reduce default access token expiration timespan
|
eocampo/KatanaProject301,HongJunRen/katanaproject,eocampo/KatanaProject301,abrodersen/katana,eocampo/KatanaProject301,HongJunRen/katanaproject,HongJunRen/katanaproject,abrodersen/katana,tomi85/Microsoft.Owin,abrodersen/katana,HongJunRen/katanaproject,HongJunRen/katanaproject,PxAndy/Katana,monkeysquare/katana,monkeysquare/katana,julianpaulozzi/katanaproject,evicertia/Katana,julianpaulozzi/katanaproject,julianpaulozzi/katanaproject,julianpaulozzi/katanaproject,eocampo/KatanaProject301,PxAndy/Katana,eocampo/KatanaProject301,HongJunRen/katanaproject,tomi85/Microsoft.Owin,abrodersen/katana,eocampo/KatanaProject301,evicertia/Katana,evicertia/Katana,evicertia/Katana,PxAndy/Katana,julianpaulozzi/katanaproject,monkeysquare/katana,julianpaulozzi/katanaproject,tomi85/Microsoft.Owin,tomi85/Microsoft.Owin,abrodersen/katana,PxAndy/Katana,evicertia/Katana,abrodersen/katana,evicertia/Katana
|
src/Microsoft.Owin.Security.OAuth/OAuthAuthorizationServerOptions.cs
|
src/Microsoft.Owin.Security.OAuth/OAuthAuthorizationServerOptions.cs
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using Microsoft.Owin.Infrastructure;
using Microsoft.Owin.Security.Infrastructure;
namespace Microsoft.Owin.Security.OAuth
{
public class OAuthAuthorizationServerOptions : AuthenticationOptions
{
public OAuthAuthorizationServerOptions() : base("Bearer")
{
AuthorizationCodeExpireTimeSpan = TimeSpan.FromMinutes(5);
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(20);
SystemClock = new SystemClock();
}
public string AuthorizeEndpointPath { get; set; }
public string TokenEndpointPath { get; set; }
public IOAuthAuthorizationServerProvider Provider { get; set; }
public ISecureDataFormat<AuthenticationTicket> AuthorizationCodeFormat { get; set; }
public ISecureDataFormat<AuthenticationTicket> AccessTokenFormat { get; set; }
public ISecureDataFormat<AuthenticationTicket> RefreshTokenFormat { get; set; }
public TimeSpan AuthorizationCodeExpireTimeSpan { get; set; }
public TimeSpan AccessTokenExpireTimeSpan { get; set; }
public IAuthenticationTokenProvider AuthorizationCodeProvider { get; set; }
public IAuthenticationTokenProvider AccessTokenProvider { get; set; }
public IAuthenticationTokenProvider RefreshTokenProvider { get; set; }
public bool AuthorizeEndpointDisplaysError { get; set; }
public ISystemClock SystemClock { get; set; }
}
}
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using Microsoft.Owin.Infrastructure;
using Microsoft.Owin.Security.Infrastructure;
namespace Microsoft.Owin.Security.OAuth
{
public class OAuthAuthorizationServerOptions : AuthenticationOptions
{
public OAuthAuthorizationServerOptions() : base("Bearer")
{
AuthorizationCodeExpireTimeSpan = TimeSpan.FromMinutes(5);
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14);
SystemClock = new SystemClock();
}
public string AuthorizeEndpointPath { get; set; }
public string TokenEndpointPath { get; set; }
public IOAuthAuthorizationServerProvider Provider { get; set; }
public ISecureDataFormat<AuthenticationTicket> AuthorizationCodeFormat { get; set; }
public ISecureDataFormat<AuthenticationTicket> AccessTokenFormat { get; set; }
public ISecureDataFormat<AuthenticationTicket> RefreshTokenFormat { get; set; }
public TimeSpan AuthorizationCodeExpireTimeSpan { get; set; }
public TimeSpan AccessTokenExpireTimeSpan { get; set; }
public IAuthenticationTokenProvider AuthorizationCodeProvider { get; set; }
public IAuthenticationTokenProvider AccessTokenProvider { get; set; }
public IAuthenticationTokenProvider RefreshTokenProvider { get; set; }
public bool AuthorizeEndpointDisplaysError { get; set; }
public ISystemClock SystemClock { get; set; }
}
}
|
apache-2.0
|
C#
|
a2d1d52005624d1bfc14f4a1f6eeac809b9a3b69
|
Use correct order of equality assertion for better error message (xUnit analyzer)
|
EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an
|
A-vs-An/WikipediaAvsAnTrieExtractorTest/TriePrefixIncrementorTest.cs
|
A-vs-An/WikipediaAvsAnTrieExtractorTest/TriePrefixIncrementorTest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using AvsAnLib.Internals;
using WikipediaAvsAnTrieExtractor;
using Xunit;
namespace WikipediaAvsAnTrieExtractorTest {
public class TriePrefixIncrementorTest {
[Fact]
public void BasicIncrementWorks() {
var node = new Node();
IncrementPrefixExtensions.IncrementPrefix(ref node, true, "test", 0);
Assert.Equal(@"(0:1)t(0:1)te(0:1)tes(0:1)test(0:1)test (0:1)" , NodeSerializer.Serialize(node));
}
[Fact]
public void IncrementWithSharedPrefixWorks() {
var node = new Node();
IncrementPrefixExtensions.IncrementPrefix(ref node, true, "test", 0);
IncrementPrefixExtensions.IncrementPrefix(ref node, true, "taste", 0);
Assert.Equal(@"(0:2)t(0:2)ta(0:1)tas(0:1)tast(0:1)taste(0:1)taste (0:1)te(0:1)tes(0:1)test(0:1)test (0:1)", NodeSerializer.Serialize(node));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using AvsAnLib.Internals;
using WikipediaAvsAnTrieExtractor;
using Xunit;
namespace WikipediaAvsAnTrieExtractorTest {
public class TriePrefixIncrementorTest {
[Fact]
public void BasicIncrementWorks() {
var node = new Node();
IncrementPrefixExtensions.IncrementPrefix(ref node, true, "test", 0);
Assert.Equal(NodeSerializer.Serialize(node), @"(0:1)t(0:1)te(0:1)tes(0:1)test(0:1)test (0:1)" );
}
[Fact]
public void IncrementWithSharedPrefixWorks() {
var node = new Node();
IncrementPrefixExtensions.IncrementPrefix(ref node, true, "test", 0);
IncrementPrefixExtensions.IncrementPrefix(ref node, true, "taste", 0);
Assert.Equal(NodeSerializer.Serialize(node), @"(0:2)t(0:2)ta(0:1)tas(0:1)tast(0:1)taste(0:1)taste (0:1)te(0:1)tes(0:1)test(0:1)test (0:1)");
}
}
}
|
apache-2.0
|
C#
|
7549d5903854f9d064a843273b2e0c60ef60da8b
|
Remove unused ClickMacro controller method
|
ethanmoffat/EndlessClient
|
EndlessClient/HUD/IHudButtonController.cs
|
EndlessClient/HUD/IHudButtonController.cs
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
namespace EndlessClient.HUD
{
public interface IHudButtonController
{
void ClickInventory();
void ClickViewMapToggle();
void ClickActiveSpells();
void ClickPassiveSpells();
void ClickChat();
void ClickStats();
void ClickOnlineList();
void ClickParty();
void ClickSettings();
void ClickHelp();
//friend/ignore
//E/Q
}
}
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
namespace EndlessClient.HUD
{
public interface IHudButtonController
{
void ClickInventory();
void ClickViewMapToggle();
void ClickActiveSpells();
void ClickPassiveSpells();
void ClickChat();
void ClickStats();
void ClickOnlineList();
void ClickParty();
//void ClickMacro();
void ClickSettings();
void ClickHelp();
//friend/ignore
//E/Q
}
}
|
mit
|
C#
|
8a119ecdc472bc51adc79fb78128c42474e5b16e
|
Update version to 4.1.0
|
TheOtherTimDuncan/TOTD
|
SharedAssemblyInfo.cs
|
SharedAssemblyInfo.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: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Other Tim Duncan")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
// 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("4.1.0.0")]
[assembly: AssemblyFileVersion("4.1.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Other Tim Duncan")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
// 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("4.0.0.0")]
[assembly: AssemblyFileVersion("4.0.0.0")]
|
mit
|
C#
|
b4437f3f8b9d7dd84816a48c081aec0866714ca1
|
fix type conversion of short enums
|
domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore
|
src/Swashbuckle.AspNetCore.SwaggerGen/Generator/OpenApiAnyFactory.cs
|
src/Swashbuckle.AspNetCore.SwaggerGen/Generator/OpenApiAnyFactory.cs
|
using System;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
namespace Swashbuckle.AspNetCore.SwaggerGen
{
public static class OpenApiAnyFactory
{
public static bool TryCreateFor(OpenApiSchema schema, object value, out IOpenApiAny openApiAny)
{
openApiAny = null;
if (schema.Type == "boolean" && TryCast(value, out bool boolValue))
openApiAny = new OpenApiBoolean(boolValue);
else if (schema.Type == "integer" && schema.Format == "int32" && TryCast(value, out short shortValue))
openApiAny = new OpenApiInteger(shortValue); // preliminary unboxing is required; simply casting to int won't suffice
else if (schema.Type == "integer" && schema.Format == "int32" && TryCast(value, out int intValue))
openApiAny = new OpenApiInteger(intValue);
else if (schema.Type == "integer" && schema.Format == "int64" && TryCast(value, out long longValue))
openApiAny = new OpenApiLong(longValue);
else if (schema.Type == "number" && schema.Format == "float" && TryCast(value, out float floatValue))
openApiAny = new OpenApiFloat(floatValue);
else if (schema.Type == "number" && schema.Format == "double" && TryCast(value, out double doubleValue))
openApiAny = new OpenApiDouble(doubleValue);
else if (schema.Type == "string" && value.GetType().IsEnum)
openApiAny = new OpenApiString(Enum.GetName(value.GetType(), value));
else if (schema.Type == "string" && schema.Format == "datetime" && TryCast(value, out DateTime dateTimeValue))
openApiAny = new OpenApiDate(dateTimeValue);
else if (schema.Type == "string")
openApiAny = new OpenApiString(value.ToString());
return openApiAny != null;
}
private static bool TryCast<T>(object value, out T typedValue)
{
try
{
typedValue = (T)value;
return true;
}
catch (InvalidCastException)
{
typedValue = default(T);
return false;
}
}
}
}
|
using System;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
namespace Swashbuckle.AspNetCore.SwaggerGen
{
public static class OpenApiAnyFactory
{
public static bool TryCreateFor(OpenApiSchema schema, object value, out IOpenApiAny openApiAny)
{
openApiAny = null;
if (schema.Type == "boolean" && TryCast(value, out bool boolValue))
openApiAny = new OpenApiBoolean(boolValue);
else if (schema.Type == "integer" && schema.Format == "int32" && TryCast(value, out int intValue))
openApiAny = new OpenApiInteger(intValue);
else if (schema.Type == "integer" && schema.Format == "int64" && TryCast(value, out long longValue))
openApiAny = new OpenApiLong(longValue);
else if (schema.Type == "number" && schema.Format == "float" && TryCast(value, out float floatValue))
openApiAny = new OpenApiFloat(floatValue);
else if (schema.Type == "number" && schema.Format == "double" && TryCast(value, out double doubleValue))
openApiAny = new OpenApiDouble(doubleValue);
else if (schema.Type == "string" && value.GetType().IsEnum)
openApiAny = new OpenApiString(Enum.GetName(value.GetType(), value));
else if (schema.Type == "string" && schema.Format == "datetime" && TryCast(value, out DateTime dateTimeValue))
openApiAny = new OpenApiDate(dateTimeValue);
else if (schema.Type == "string")
openApiAny = new OpenApiString(value.ToString());
return openApiAny != null;
}
private static bool TryCast<T>(object value, out T typedValue)
{
try
{
typedValue = (T)value;
return true;
}
catch (InvalidCastException)
{
typedValue = default(T);
return false;
}
}
}
}
|
mit
|
C#
|
0b42c8ea794871c71eff321fc13ba936d7b2a3e3
|
同步版本号,Senparc.Weixin SDK 全面支持 .NET Core 2.1.0-rc1-final
|
JeffreySu/Senparc.WebSocket
|
src/Senparc.WebSocket/Senparc.WebSocket/Properties/AssemblyInfo.cs
|
src/Senparc.WebSocket/Senparc.WebSocket/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
//[assembly: AssemblyTitle("Senparc.WebSocket")]
//[assembly: AssemblyDescription("")]
//[assembly: AssemblyConfiguration("")]
//[assembly: AssemblyCompany("")]
//[assembly: AssemblyProduct("Senparc.WebSocket")]
//[assembly: AssemblyCopyright("Copyright © 2017")]
//[assembly: AssemblyTrademark("")]
//[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b745f5f5-9120-4d56-a86d-ed34eadb703c")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
//[assembly: AssemblyTitle("Senparc.WebSocket")]
//[assembly: AssemblyDescription("")]
//[assembly: AssemblyConfiguration("")]
//[assembly: AssemblyCompany("")]
//[assembly: AssemblyProduct("Senparc.WebSocket")]
//[assembly: AssemblyCopyright("Copyright © 2017")]
//[assembly: AssemblyTrademark("")]
//[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b745f5f5-9120-4d56-a86d-ed34eadb703c")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
3e9f48223acfa21c2e2d45314d8b4e1e5c271a80
|
Change amount to nullable
|
stripe/stripe-dotnet,Raganhar/stripe.net,chickenham/stripe.net,AvengingSyndrome/stripe.net,matthewcorven/stripe.net,craigmckeachie/stripe.net,AvengingSyndrome/stripe.net,brentdavid2008/stripe.net,shirley-truong-volusion/stripe.net,shirley-truong-volusion/stripe.net,haithemaraissia/stripe.net,chickenham/stripe.net,haithemaraissia/stripe.net,matthewcorven/stripe.net,craigmckeachie/stripe.net,duckwaffle/stripe.net,Raganhar/stripe.net,richardlawley/stripe.net
|
src/Stripe/Services/InvoiceItems/StripeInvoiceItemUpdateOptions.cs
|
src/Stripe/Services/InvoiceItems/StripeInvoiceItemUpdateOptions.cs
|
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Stripe
{
public class StripeInvoiceItemUpdateOptions
{
[JsonProperty("amount")]
public int? Amount { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
}
}
|
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Stripe
{
public class StripeInvoiceItemUpdateOptions
{
[JsonProperty("amount")]
public int Amount { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
}
}
|
apache-2.0
|
C#
|
1c32cb7e6d4d5488695f21704792b7d81ff894d5
|
Fix serializable bug when using plugins during pdf generation (#2210)
|
pascalberger/docfx,dotnet/docfx,dotnet/docfx,superyyrrzz/docfx,dotnet/docfx,pascalberger/docfx,pascalberger/docfx,superyyrrzz/docfx,superyyrrzz/docfx
|
src/docfx/Models/PdfJsonConfig.cs
|
src/docfx/Models/PdfJsonConfig.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
[Serializable]
public class PdfJsonConfig : BuildJsonConfig
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("host")]
public new string Host { get; set; }
[JsonProperty("locale")]
public string Locale { get; set; }
[JsonProperty("generatesAppendices")]
public bool GeneratesAppendices { get; set; }
[JsonProperty("generatesExternalLink")]
public bool GeneratesExternalLink { get; set; }
[JsonProperty("keepRawFiles")]
public bool KeepRawFiles { get; set; }
[JsonProperty("rawOutputFolder")]
public string RawOutputFolder { get; set; }
[JsonProperty("excludedTocs")]
public List<string> ExcludedTocs { get; set; }
[JsonProperty("css")]
public string CssFilePath { get; set; }
[JsonProperty("base")]
public string BasePath { get; set; }
/// <summary>
/// Specify how to handle pages that fail to load: abort, ignore or skip(default abort)
/// </summary>
[JsonProperty("errorHandling")]
public string LoadErrorHandling { get; set; }
/// <summary>
/// Specify options specific to the wkhtmltopdf tooling used by the pdf command.
/// </summary>
[JsonProperty("wkhtmltopdf")]
public WkhtmltopdfJsonConfig Wkhtmltopdf { get; set; }
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode
{
using System.Collections.Generic;
using Newtonsoft.Json;
public class PdfJsonConfig : BuildJsonConfig
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("host")]
public new string Host { get; set; }
[JsonProperty("locale")]
public string Locale { get; set; }
[JsonProperty("generatesAppendices")]
public bool GeneratesAppendices { get; set; }
[JsonProperty("generatesExternalLink")]
public bool GeneratesExternalLink { get; set; }
[JsonProperty("keepRawFiles")]
public bool KeepRawFiles { get; set; }
[JsonProperty("rawOutputFolder")]
public string RawOutputFolder { get; set; }
[JsonProperty("excludedTocs")]
public List<string> ExcludedTocs { get; set; }
[JsonProperty("css")]
public string CssFilePath { get; set; }
[JsonProperty("base")]
public string BasePath { get; set; }
/// <summary>
/// Specify how to handle pages that fail to load: abort, ignore or skip(default abort)
/// </summary>
[JsonProperty("errorHandling")]
public string LoadErrorHandling { get; set; }
/// <summary>
/// Specify options specific to the wkhtmltopdf tooling used by the pdf command.
/// </summary>
[JsonProperty("wkhtmltopdf")]
public WkhtmltopdfJsonConfig Wkhtmltopdf { get; set; }
}
}
|
mit
|
C#
|
4039ec7c7fca034bcb4dda1f28e714c403d1f53d
|
Simplify the conditional compilation of VisualStudioMSBuildInstalled
|
mavasani/roslyn,mavasani/roslyn,dotnet/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn
|
src/Workspaces/MSBuildTest/Utilities/VisualStudioMSBuildInstalled.cs
|
src/Workspaces/MSBuildTest/Utilities/VisualStudioMSBuildInstalled.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.Build.Locator;
using Roslyn.Test.Utilities;
namespace Microsoft.CodeAnalysis.MSBuild.UnitTests
{
internal class VisualStudioMSBuildInstalled : ExecutionCondition
{
#if NET472_OR_GREATER
private static readonly VisualStudioInstance? s_instance;
private readonly Version _minimumVersion;
static VisualStudioMSBuildInstalled()
{
var latestInstalledInstance = (VisualStudioInstance?)null;
foreach (var visualStudioInstance in MSBuildLocator.QueryVisualStudioInstances())
{
if (latestInstalledInstance == null || visualStudioInstance.Version > latestInstalledInstance.Version)
{
latestInstalledInstance = visualStudioInstance;
}
}
if (latestInstalledInstance != null)
{
MSBuildLocator.RegisterInstance(latestInstalledInstance);
s_instance = latestInstalledInstance;
}
}
#endif
public VisualStudioMSBuildInstalled()
: this(new Version(17, 0))
{
}
internal VisualStudioMSBuildInstalled(Version minimumVersion)
{
#if NET472_OR_GREATER
_minimumVersion = minimumVersion;
#endif
}
public override bool ShouldSkip
#if NET472_OR_GREATER
=> s_instance is null || s_instance.Version < _minimumVersion;
#else
=> true;
#endif
public override string SkipReason
#if NET472_OR_GREATER
=> $"Could not locate Visual Studio with MSBuild {_minimumVersion} or higher installed";
#else
=> $"Test runs on .NET Framework only.";
#endif
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.Linq;
using Microsoft.Build.Locator;
using Roslyn.Test.Utilities;
namespace Microsoft.CodeAnalysis.MSBuild.UnitTests
{
internal class VisualStudioMSBuildInstalled : ExecutionCondition
{
#if NET472_OR_GREATER
private static readonly VisualStudioInstance? s_instance;
private readonly Version _minimumVersion;
static VisualStudioMSBuildInstalled()
{
var latestInstalledInstance = (VisualStudioInstance?)null;
foreach (var visualStudioInstance in MSBuildLocator.QueryVisualStudioInstances())
{
if (latestInstalledInstance == null || visualStudioInstance.Version > latestInstalledInstance.Version)
{
latestInstalledInstance = visualStudioInstance;
}
}
if (latestInstalledInstance != null)
{
MSBuildLocator.RegisterInstance(latestInstalledInstance);
s_instance = latestInstalledInstance;
}
}
#endif
public VisualStudioMSBuildInstalled()
#if NET472_OR_GREATER
: this(new Version(16, 9))
#endif
{
}
#if NET472_OR_GREATER
internal VisualStudioMSBuildInstalled(Version minimumVersion)
{
_minimumVersion = minimumVersion;
}
#endif
public override bool ShouldSkip
#if NET472_OR_GREATER
=> s_instance is null || s_instance.Version < _minimumVersion;
#else
=> true;
#endif
public override string SkipReason
#if NET472_OR_GREATER
=> $"Could not locate Visual Studio with MSBuild {_minimumVersion} or higher installed";
#else
=> $"Test runs on .NET Framework only.";
#endif
}
}
|
mit
|
C#
|
49256ea026b6cb39a54e13332ffca71c0fe7da4b
|
Rename method
|
sakapon/Tutorials-2014
|
LeapTutorial02/FingersTracker/AppModel.cs
|
LeapTutorial02/FingersTracker/AppModel.cs
|
using KLibrary.ComponentModel;
using Leap;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media.Media3D;
namespace FingersTracker
{
public class AppModel : NotifyBase
{
const int ScreenWidth = 1920;
const int ScreenHeight = 1080;
const int MappingScale = 3;
Controller controller;
FrameListener listener;
public double FrameRate
{
get { return GetValue<double>(); }
private set { SetValue(value); }
}
public Point3D[] Positions
{
get { return GetValue<Point3D[]>(); }
private set { SetValue(value); }
}
public AppModel()
{
controller = new Controller();
listener = new FrameListener();
controller.AddListener(listener);
listener.FrameArrived += listener_FrameArrived;
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
}
void CurrentDomain_ProcessExit(object sender, EventArgs e)
{
controller.RemoveListener(listener);
listener.Dispose();
controller.Dispose();
}
void listener_FrameArrived(Leap.Frame frame)
{
FrameRate = frame.CurrentFramesPerSecond;
Positions = frame.Pointables
.Where(p => p.IsValid)
.Where(p => p.StabilizedTipPosition.IsValid())
.Select(p => ToScreenPoint(p.StabilizedTipPosition))
.ToArray();
}
static Point3D ToScreenPoint(Leap.Vector v)
{
return new Point3D(ScreenWidth / 2 + MappingScale * v.x, ScreenHeight - MappingScale * v.y, MappingScale * v.z);
}
}
}
|
using KLibrary.ComponentModel;
using Leap;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media.Media3D;
namespace FingersTracker
{
public class AppModel : NotifyBase
{
const int ScreenWidth = 1920;
const int ScreenHeight = 1080;
const int MappingScale = 3;
Controller controller;
FrameListener listener;
public double FrameRate
{
get { return GetValue<double>(); }
private set { SetValue(value); }
}
public Point3D[] Positions
{
get { return GetValue<Point3D[]>(); }
private set { SetValue(value); }
}
public AppModel()
{
controller = new Controller();
listener = new FrameListener();
controller.AddListener(listener);
listener.FrameArrived += listener_FrameArrived;
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
}
void CurrentDomain_ProcessExit(object sender, EventArgs e)
{
controller.RemoveListener(listener);
listener.Dispose();
controller.Dispose();
}
void listener_FrameArrived(Leap.Frame frame)
{
FrameRate = frame.CurrentFramesPerSecond;
Positions = frame.Pointables
.Where(p => p.IsValid)
.Where(p => p.StabilizedTipPosition.IsValid())
.Select(p => ToStylusPoint(p.StabilizedTipPosition))
.ToArray();
}
static Point3D ToStylusPoint(Leap.Vector v)
{
return new Point3D(ScreenWidth / 2 + MappingScale * v.x, ScreenHeight - MappingScale * v.y, MappingScale * v.z);
}
}
}
|
mit
|
C#
|
191922be0058100ded2e5ddbb4f5aca9c879283e
|
Update version to 4.0.11.0
|
mikefourie/MSBuildExtensionPack
|
Solutions/Main/Common/CommonAssemblyInfo.cs
|
Solutions/Main/Common/CommonAssemblyInfo.cs
|
//-----------------------------------------------------------------------
// <copyright file="CommonAssemblyInfo.cs">(c) http://www.msbuildextensionpack.com. This source is subject to the Microsoft Permissive License. See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. All other rights reserved.</copyright>
//-----------------------------------------------------------------------
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("4.0.0.0")]
[assembly: AssemblyFileVersion("4.0.11.0")]
[assembly: AssemblyInformationalVersion("4.0.0.0")]
[assembly: AssemblyCompany("http://www.MSBuildExtensionPack.com")]
[assembly: AssemblyCopyright("Copyright 2008 - 2015 http://www.MSBuildExtensionPack.com")]
[assembly: AssemblyTrademark("Mike Fourie")]
[assembly: NeutralResourcesLanguage("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyProduct("MSBuild Extension Pack 4.0")]
// 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)]
|
//-----------------------------------------------------------------------
// <copyright file="CommonAssemblyInfo.cs">(c) http://www.msbuildextensionpack.com. This source is subject to the Microsoft Permissive License. See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. All other rights reserved.</copyright>
//-----------------------------------------------------------------------
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("4.0.0.0")]
[assembly: AssemblyFileVersion("4.0.10.0")]
[assembly: AssemblyInformationalVersion("4.0.0.0")]
[assembly: AssemblyCompany("http://www.MSBuildExtensionPack.com")]
[assembly: AssemblyCopyright("Copyright 2008 - 2014 http://www.MSBuildExtensionPack.com")]
[assembly: AssemblyTrademark("Mike Fourie")]
[assembly: NeutralResourcesLanguage("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyProduct("MSBuild Extension Pack 4.0")]
// 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)]
|
mit
|
C#
|
70972fb7a19ec9728b97a98cb4a7ac36fa0b0aae
|
Rebase cleanup
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
test/Microsoft.AspNet.TestHost.Tests/TestApplicationEnvironment.cs
|
test/Microsoft.AspNet.TestHost.Tests/TestApplicationEnvironment.cs
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Runtime.Versioning;
using Microsoft.Framework.Runtime;
namespace Microsoft.AspNet.TestHost
{
public class TestApplicationEnvironment : IApplicationEnvironment
{
public string ApplicationName
{
get { return "Test App environment"; }
}
public string Version
{
get { return "1.0.0"; }
}
public string ApplicationBasePath
{
get { return Environment.CurrentDirectory; }
}
public string Configuration
{
get { return "Test"; }
}
public FrameworkName TargetFramework
{
get { return new FrameworkName(".NETFramework", new Version(4, 5)); }
}
}
}
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Runtime.Versioning;
using Microsoft.Framework.Runtime;
namespace Microsoft.AspNet.TestHost
{
public class TestApplicationEnvironment : IApplicationEnvironment
{
public string ApplicationName
{
get { return "Test App environment"; }
}
public string Version
{
get { return "1.0.0"; }
}
public string ApplicationBasePath
{
get { return Environment.CurrentDirectory; }
}
public string Configuration
{
get
{
return "debug";
}
}
public FrameworkName TargetFramework
{
get { return new FrameworkName(".NETFramework", new Version(4, 5)); }
}
public string Configuration
{
get { return "Test"; }
}
}
}
|
apache-2.0
|
C#
|
3fd92a36d9c7b5a4a4ee65a4670daf638b22b447
|
Fix for closing window.
|
cube-soft/Cube.Core,cube-soft/Cube.Core
|
Triggers/CloseTrigger.cs
|
Triggers/CloseTrigger.cs
|
/* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, Inc.
//
// 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.Windows;
using System.Windows.Interactivity;
namespace Cube.Xui.Triggers
{
/* --------------------------------------------------------------------- */
///
/// CloseMessage
///
/// <summary>
/// ウィンドウを閉じることを示すメッセージクラスです。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseMessage { }
/* --------------------------------------------------------------------- */
///
/// CloseTrigger
///
/// <summary>
/// Messenger オブジェクト経由でウィンドウを閉じるための
/// Trigger クラスです。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseTrigger : MessengerTrigger<CloseMessage> { }
/* --------------------------------------------------------------------- */
///
/// CloseAction
///
/// <summary>
/// Window を閉じる TriggerAction です。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseAction : TriggerAction<DependencyObject>
{
/* ----------------------------------------------------------------- */
///
/// Invoke
///
/// <summary>
/// 処理を実行します。
/// </summary>
///
/* ----------------------------------------------------------------- */
protected override void Invoke(object notused)
{
if (AssociatedObject is Window w)
{
w.DataContext = null;
w.Close();
}
}
}
}
|
/* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, Inc.
//
// 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.Windows;
using System.Windows.Interactivity;
namespace Cube.Xui.Triggers
{
/* --------------------------------------------------------------------- */
///
/// CloseMessage
///
/// <summary>
/// ウィンドウを閉じることを示すメッセージクラスです。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseMessage { }
/* --------------------------------------------------------------------- */
///
/// CloseTrigger
///
/// <summary>
/// Messenger オブジェクト経由でウィンドウを閉じるための
/// Trigger クラスです。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseTrigger : MessengerTrigger<CloseMessage> { }
/* --------------------------------------------------------------------- */
///
/// CloseAction
///
/// <summary>
/// Window を閉じる TriggerAction です。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class CloseAction : TriggerAction<DependencyObject>
{
/* ----------------------------------------------------------------- */
///
/// Invoke
///
/// <summary>
/// 処理を実行します。
/// </summary>
///
/* ----------------------------------------------------------------- */
protected override void Invoke(object notused)
{
if (AssociatedObject is Window w) w.Close();
}
}
}
|
apache-2.0
|
C#
|
462e14cc63606c8116f5215c4f7663dc803209e2
|
Fix nullable errors
|
RehanSaeed/Schema.NET
|
Tests/Schema.NET.Test/ContextJsonConverterTest.cs
|
Tests/Schema.NET.Test/ContextJsonConverterTest.cs
|
namespace Schema.NET.Test
{
using Newtonsoft.Json;
using Xunit;
public class ContextJsonConverterTest
{
[Fact]
public void ReadJson_StringContext_ContextHasName()
{
var json = "{\"@context\":\"foo\",\"@type\":\"Thing\"}";
var thing = JsonConvert.DeserializeObject<Thing>(json);
Assert.NotNull(thing?.Context);
Assert.Equal("foo", thing?.Context.Name);
Assert.Null(thing?.Context.Language);
}
[Fact]
public void ReadJson_ObjectContextWithName_ContextHasName()
{
var json = "{\"@context\":{\"name\":\"foo\"},\"@type\":\"Thing\"}";
var thing = JsonConvert.DeserializeObject<Thing>(json);
Assert.NotNull(thing?.Context);
Assert.Equal("foo", thing?.Context.Name);
Assert.Null(thing?.Context.Language);
}
[Fact]
public void ReadJson_ObjectContextWithNameAndLanguage_ContextHasNameAndLanguage()
{
var json = "{\"@context\":{\"name\":\"foo\",\"@language\":\"en\"},\"@type\":\"Thing\"}";
var thing = JsonConvert.DeserializeObject<Thing>(json);
Assert.NotNull(thing?.Context);
Assert.Equal("foo", thing?.Context.Name);
Assert.Equal("en", thing?.Context.Language);
}
[Fact]
public void WriteJson_StringContext_ContextHasName()
{
var json = new Thing().ToString();
Assert.Equal("{\"@context\":\"https://schema.org\",\"@type\":\"Thing\"}", json);
}
[Fact]
public void WriteJson_ObjectContextWithLanguage_ContextHasName()
{
var thing = new Thing();
thing.Context.Language = "en";
var json = thing.ToString();
Assert.Equal("{\"@context\":{\"name\":\"https://schema.org\",\"@language\":\"en\"},\"@type\":\"Thing\"}", json);
}
}
}
|
namespace Schema.NET.Test
{
using Newtonsoft.Json;
using Xunit;
public class ContextJsonConverterTest
{
[Fact]
public void ReadJson_StringContext_ContextHasName()
{
var json = "{\"@context\":\"foo\",\"@type\":\"Thing\"}";
var thing = JsonConvert.DeserializeObject<Thing>(json);
Assert.NotNull(thing.Context);
Assert.Equal("foo", thing.Context.Name);
Assert.Null(thing.Context.Language);
}
[Fact]
public void ReadJson_ObjectContextWithName_ContextHasName()
{
var json = "{\"@context\":{\"name\":\"foo\"},\"@type\":\"Thing\"}";
var thing = JsonConvert.DeserializeObject<Thing>(json);
Assert.NotNull(thing.Context);
Assert.Equal("foo", thing.Context.Name);
Assert.Null(thing.Context.Language);
}
[Fact]
public void ReadJson_ObjectContextWithNameAndLanguage_ContextHasNameAndLanguage()
{
var json = "{\"@context\":{\"name\":\"foo\",\"@language\":\"en\"},\"@type\":\"Thing\"}";
var thing = JsonConvert.DeserializeObject<Thing>(json);
Assert.NotNull(thing.Context);
Assert.Equal("foo", thing.Context.Name);
Assert.Equal("en", thing.Context.Language);
}
[Fact]
public void WriteJson_StringContext_ContextHasName()
{
var json = new Thing().ToString();
Assert.Equal("{\"@context\":\"https://schema.org\",\"@type\":\"Thing\"}", json);
}
[Fact]
public void WriteJson_ObjectContextWithLanguage_ContextHasName()
{
var thing = new Thing();
thing.Context.Language = "en";
var json = thing.ToString();
Assert.Equal("{\"@context\":{\"name\":\"https://schema.org\",\"@language\":\"en\"},\"@type\":\"Thing\"}", json);
}
}
}
|
mit
|
C#
|
825941cfffe04d5b99a220768cfbf2434d37046d
|
Drop the Retain from the constructor, the proper fix is going into monotouch
|
cwensley/maccore,mono/maccore,jorik041/maccore
|
src/CoreAnimation/CALayer.cs
|
src/CoreAnimation/CALayer.cs
|
//
// CALayer.cs: support for CALayer
//
// Authors:
// Geoff Norton.
//
// Copyright 2009-2010 Novell, Inc
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.ObjCRuntime;
using MonoMac.CoreGraphics;
namespace MonoMac.CoreAnimation {
public partial class CALayer {
static IntPtr selInitWithLayer = Selector.sel_registerName ("initWithLayer:");
[Export ("initWithLayer:")]
public CALayer (CALayer other)
{
if (this.GetType () == typeof (CALayer)){
Messaging.intptr_objc_msgSend_intptr (Handle, selInitWithLayer, other.Handle);
} else {
Messaging.intptr_objc_msgSendSuper_intptr (SuperHandle, selInitWithLayer, other.Handle);
Clone (other);
}
}
public virtual void Clone (CALayer other)
{
// Subclasses must copy any instance values that they care from other
}
[Obsolete ("Use BeginTime instead")]
public double CFTimeInterval {
get { return BeginTime; }
set { BeginTime = value; }
}
[Obsolete ("Use ConvertRectFromLayer instead")]
public RectangleF ConvertRectfromLayer (RectangleF rect, CALayer layer)
{
return ConvertRectFromLayer (rect, layer);
}
}
#if !MONOMAC
public partial class CADisplayLink {
public static CADisplayLink Create (NSAction action)
{
var d = new NSActionDispatcher (action);
return Create (d, NSActionDispatcher.Selector);
}
}
#endif
public partial class CAAnimation {
[Obsolete ("Use BeginTime instead")]
public double CFTimeInterval {
get { return BeginTime; }
set { BeginTime = value; }
}
}
}
|
//
// CALayer.cs: support for CALayer
//
// Authors:
// Geoff Norton.
//
// Copyright 2009-2010 Novell, Inc
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.ObjCRuntime;
using MonoMac.CoreGraphics;
namespace MonoMac.CoreAnimation {
public partial class CALayer {
static IntPtr selInitWithLayer = Selector.sel_registerName ("initWithLayer:");
[Export ("initWithLayer:")]
public CALayer (CALayer other)
{
if (this.GetType () == typeof (CALayer)){
Messaging.intptr_objc_msgSend_intptr (Handle, selInitWithLayer, other.Handle);
} else {
Messaging.intptr_objc_msgSendSuper_intptr (SuperHandle, selInitWithLayer, other.Handle);
Clone (other);
}
Retain ();
}
public virtual void Clone (CALayer other)
{
// Subclasses must copy any instance values that they care from other
}
[Obsolete ("Use BeginTime instead")]
public double CFTimeInterval {
get { return BeginTime; }
set { BeginTime = value; }
}
[Obsolete ("Use ConvertRectFromLayer instead")]
public RectangleF ConvertRectfromLayer (RectangleF rect, CALayer layer)
{
return ConvertRectFromLayer (rect, layer);
}
}
#if !MONOMAC
public partial class CADisplayLink {
public static CADisplayLink Create (NSAction action)
{
var d = new NSActionDispatcher (action);
return Create (d, NSActionDispatcher.Selector);
}
}
#endif
public partial class CAAnimation {
[Obsolete ("Use BeginTime instead")]
public double CFTimeInterval {
get { return BeginTime; }
set { BeginTime = value; }
}
}
}
|
apache-2.0
|
C#
|
a9671e333180783b0c824ea3f453d0d03ddbffde
|
Fix misnamed LOWFONT enumeration to LOWERFONT
|
boumenot/Grobid.NET
|
src/Grobid/FontSizeStatus.cs
|
src/Grobid/FontSizeStatus.cs
|
namespace Grobid.NET
{
public enum FontSizeStatus
{
HIGHERFONT,
SAMEFONTSIZE,
LOWERFONT,
}
}
|
namespace Grobid.NET
{
public enum FontSizeStatus
{
HIGHERFONT,
SAMEFONTSIZE,
LOWFONT,
}
}
|
apache-2.0
|
C#
|
2982cc6ad28194b232409c67c59352bc3d6697f3
|
Make the default BrstmTrackType Standard
|
Thealexbarney/VGAudio,Thealexbarney/VGAudio,Thealexbarney/LibDspAdpcm,Thealexbarney/LibDspAdpcm
|
DspAdpcm/DspAdpcm/Adpcm/Formats/Configuration/BrstmConfiguration.cs
|
DspAdpcm/DspAdpcm/Adpcm/Formats/Configuration/BrstmConfiguration.cs
|
using DspAdpcm.Adpcm.Formats.Internal;
using DspAdpcm.Adpcm.Formats.Structures;
namespace DspAdpcm.Adpcm.Formats.Configuration
{
/// <summary>
/// Contains the options used to build the BRSTM file.
/// </summary>
public class BrstmConfiguration : B_stmConfiguration
{
/// <summary>
/// The type of track description to be used when building the
/// BRSTM header.
/// Default is <see cref="BrstmTrackType.Standard"/>
/// </summary>
public BrstmTrackType TrackType { get; set; } = BrstmTrackType.Standard;
/// <summary>
/// The type of seek table to use when building the BRSTM
/// ADPC chunk.
/// Default is <see cref="BrstmSeekTableType.Standard"/>
/// </summary>
public BrstmSeekTableType SeekTableType { get; set; } = BrstmSeekTableType.Standard;
}
}
|
using DspAdpcm.Adpcm.Formats.Internal;
using DspAdpcm.Adpcm.Formats.Structures;
namespace DspAdpcm.Adpcm.Formats.Configuration
{
/// <summary>
/// Contains the options used to build the BRSTM file.
/// </summary>
public class BrstmConfiguration : B_stmConfiguration
{
/// <summary>
/// The type of track description to be used when building the
/// BRSTM header.
/// Default is <see cref="BrstmTrackType.Short"/>
/// </summary>
public BrstmTrackType TrackType { get; set; } = BrstmTrackType.Short;
/// <summary>
/// The type of seek table to use when building the BRSTM
/// ADPC chunk.
/// Default is <see cref="BrstmSeekTableType.Standard"/>
/// </summary>
public BrstmSeekTableType SeekTableType { get; set; } = BrstmSeekTableType.Standard;
}
}
|
mit
|
C#
|
be157ba5fb9d0746b8c547af126f1e69623e57c9
|
Support server messages in the Image widget
|
k-t/SharpHaven
|
MonoHaven.Client/UI/Remote/ServerImage.cs
|
MonoHaven.Client/UI/Remote/ServerImage.cs
|
using MonoHaven.UI.Widgets;
namespace MonoHaven.UI.Remote
{
public class ServerImage : ServerWidget
{
public static ServerWidget Create(ushort id, ServerWidget parent, object[] args)
{
var resName = (string)args[0];
var widget = new Image(parent.Widget);
widget.Drawable = App.Resources.GetImage(resName);
widget.Resize(widget.Drawable.Size);
return new ServerImage(id, parent, widget);
}
private readonly Image widget;
public ServerImage(ushort id, ServerWidget parent, Image widget)
: base(id, parent, widget)
{
this.widget = widget;
}
public override void ReceiveMessage(string message, object[] args)
{
if (message == "ch")
widget.Drawable = App.Resources.GetImage((string)args[0]);
else
base.ReceiveMessage(message, args);
}
}
}
|
using MonoHaven.UI.Widgets;
namespace MonoHaven.UI.Remote
{
public class ServerImage : ServerWidget
{
public static ServerWidget Create(ushort id, ServerWidget parent, object[] args)
{
var resName = (string)args[0];
var widget = new Image(parent.Widget);
widget.Drawable = App.Resources.GetImage(resName);
widget.Resize(widget.Drawable.Size);
return new ServerImage(id, parent, widget);
}
public ServerImage(ushort id, ServerWidget parent, Image widget)
: base(id, parent, widget)
{
}
}
}
|
mit
|
C#
|
2ffd1773ffde7a9ef34886b81d7271afc1396819
|
Use var instead.
|
dlemstra/Magick.NET,dlemstra/Magick.NET
|
tests/Magick.NET.Tests/Colors/ColorCMYKTests/TheGetHashCodeMethod.cs
|
tests/Magick.NET.Tests/Colors/ColorCMYKTests/TheGetHashCodeMethod.cs
|
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.
using ImageMagick;
using Xunit;
namespace Magick.NET.Tests
{
public partial class ColorCMYKTests : ColorBaseTests<ColorCMYK>
{
public class TheGetHashCodeMethod
{
[Fact]
public void ShouldReturnDifferentValueWhenChannelChanged()
{
var first = new ColorCMYK(0, 0, 0, 0);
var hashCode = first.GetHashCode();
first.K = Quantum.Max;
Assert.NotEqual(hashCode, first.GetHashCode());
}
}
}
}
|
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.
using ImageMagick;
using Xunit;
namespace Magick.NET.Tests
{
public partial class ColorCMYKTests : ColorBaseTests<ColorCMYK>
{
public class TheGetHashCodeMethod
{
[Fact]
public void ShouldReturnDifferentValueWhenChannelChanged()
{
ColorCMYK first = new ColorCMYK(0, 0, 0, 0);
int hashCode = first.GetHashCode();
first.K = Quantum.Max;
Assert.NotEqual(hashCode, first.GetHashCode());
}
}
}
}
|
apache-2.0
|
C#
|
4fb01d21894e568bb6a318d61ea683b264a759e1
|
Update ApplicationInsightsTraceTelemeter.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Analytics/Telemetry/ApplicationInsightsTraceTelemeter.cs
|
TIKSN.Core/Analytics/Telemetry/ApplicationInsightsTraceTelemeter.cs
|
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights.DataContracts;
namespace TIKSN.Analytics.Telemetry
{
public class ApplicationInsightsTraceTelemeter : ITraceTelemeter
{
[Obsolete]
public Task TrackTraceAsync(string message, TelemetrySeverityLevel severityLevel) =>
TrackTraceInternalAsync(message, severityLevel);
[Obsolete]
public Task TrackTraceAsync(string message) => TrackTraceInternalAsync(message, null);
[Obsolete]
private static Task TrackTraceInternalAsync(string message, TelemetrySeverityLevel? severityLevel)
{
try
{
var telemetry = new TraceTelemetry(message)
{
SeverityLevel = ApplicationInsightsHelper.ConvertSeverityLevel(severityLevel)
};
ApplicationInsightsHelper.TrackTrace(telemetry);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
return Task.FromResult<object>(null);
}
}
}
|
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights.DataContracts;
namespace TIKSN.Analytics.Telemetry
{
public class ApplicationInsightsTraceTelemeter : ITraceTelemeter
{
public Task TrackTrace(string message, TelemetrySeverityLevel severityLevel) =>
this.TrackTraceInternal(message, severityLevel);
public Task TrackTrace(string message) => this.TrackTraceInternal(message, null);
private Task TrackTraceInternal(string message, TelemetrySeverityLevel? severityLevel)
{
try
{
var telemetry = new TraceTelemetry(message);
telemetry.SeverityLevel = ApplicationInsightsHelper.ConvertSeverityLevel(severityLevel);
ApplicationInsightsHelper.TrackTrace(telemetry);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
return Task.FromResult<object>(null);
}
}
}
|
mit
|
C#
|
80a2c6be80293f454d6a615698dc9bcf319ac1ef
|
update validation settings earlier
|
ucdavis/Purchasing,ucdavis/Purchasing,ucdavis/Purchasing
|
Purchasing.Mvc/Views/Order/Request.cshtml
|
Purchasing.Mvc/Views/Order/Request.cshtml
|
@model OrderModifyModel
@{
ViewBag.Title = "Request";
ViewBag.ShowTour = true;
}
@section AdditionalStyles
{
@Styles.Render("~/Css/order")
}
@section AdditionalScripts{
<script type="text/javascript">
$.validator.setDefaults({ ignore: ':hidden :not(.chzn-done)' }); //do not ignore hidden chosen select lists for validation
$(function () {
@Html.Partial("_Options")
purchasing.init();
purchasing.initLocalStorage();
purchasing.initSaveOrderRequest('@Url.Action("SaveOrderRequest")');
});
</script>
@Scripts.Render("~/bundles/order")
}
@Html.Partial("_SideNavigation")
<div class="orders-right">
@using (Html.BeginForm("Request", "Order", new { Model.Workgroup.Id }, FormMethod.Post, new { id = "order-form" }))
{
@Html.Partial("_OrderForm")
}
</div>
@Html.Partial("_OrderTemplates")
@Html.Partial("_OrderDialogs")
|
@model OrderModifyModel
@{
ViewBag.Title = "Request";
ViewBag.ShowTour = true;
}
@section AdditionalStyles
{
@Styles.Render("~/Css/order")
}
@section AdditionalScripts{
<script type="text/javascript">
$(function () {
@Html.Partial("_Options")
purchasing.init();
purchasing.initLocalStorage();
purchasing.initSaveOrderRequest('@Url.Action("SaveOrderRequest")');
});
</script>
@Scripts.Render("~/bundles/order")
}
@Html.Partial("_SideNavigation")
<div class="orders-right">
@using (Html.BeginForm("Request", "Order", new { Model.Workgroup.Id }, FormMethod.Post, new { id = "order-form" }))
{
@Html.Partial("_OrderForm")
}
</div>
@Html.Partial("_OrderTemplates")
@Html.Partial("_OrderDialogs")
|
mit
|
C#
|
9ed012d0cebdcca16e9aba4e816dd94211de64a2
|
Add UnusedHandCannonWarning property
|
villermen/runescape-cache-tools,villermen/runescape-cache-tools
|
RuneScapeCacheTools/Model/ItemProperty.cs
|
RuneScapeCacheTools/Model/ItemProperty.cs
|
using Villermen.RuneScapeCacheTools.File;
namespace Villermen.RuneScapeCacheTools.Model
{
/// <summary>
/// The identifier for a parameter of an <see cref="ItemDefinitionFile" />.
/// </summary>
public enum ItemProperty
{
WeaponRange = 13,
EquipOption1 = 528,
EquipOption2 = 529,
EquipOption3 = 530,
EquipOption4 = 531,
DropSoundId = 537,
StrengthBonus = 641,
RangedBonus = 643,
/// <summary>
/// Can only be traded for an equal amount of items with the same category.
/// </summary>
RestrictedTrade = 689,
UnusedHandCannonWarning = 690,
MobilisingArmiesSquad = 802,
MagicBonus = 965,
/// <summary>
/// 0 = attack, 1 = defence, 2= strength, 4 = ranged, 5 = prayer, 6 = magic
/// </summary>
EquipSkillRequired = 749,
EquipLevelRequired = 750,
EquipSkillRequired2 = 751,
EquipLevelRequired2 = 752,
LifePointBonus = 1326,
UnknownRestrictedTradeRelated = 1397,
GeCategory = 2195,
BeastOfBurdenStorable = 2240,
MeleeAffinity = 2866,
RangedAffinity = 2867,
MagicAffinity = 2868,
ArmourBonus = 2870,
PrayerBonus = 2946,
PotionEffectValue = 3000,
UnknownPopItemCharge = 3109,
WeaponAccuracy = 3267,
RepairCost = 3383,
CombatCharges = 3385,
PortentOfDegradationHealAmount = 3698,
Broken = 3793,
MtxDescription = 4085,
SpecialAttackCost = 4332,
SpecialAttackName = 4333,
SpecialAttackDescription = 4334,
DestroyForGp = 4907,
DestroyText = 5417,
ZarosItem = 5440,
UnknownBookcaseReclaimCost = 5637,
UnknownFayreTokenRelated = 6405,
SigilCooldownDefault = 6520,
SigilCooldown = 6521,
SigilMaxCharges = 6522,
PofFarmLevel = 7477,
}
}
|
using Villermen.RuneScapeCacheTools.File;
namespace Villermen.RuneScapeCacheTools.Model
{
/// <summary>
/// The identifier for a parameter of an <see cref="ItemDefinitionFile" />.
/// </summary>
public enum ItemProperty
{
WeaponRange = 13,
EquipOption1 = 528,
EquipOption2 = 529,
EquipOption3 = 530,
EquipOption4 = 531,
DropSoundId = 537,
StrengthBonus = 641,
RangedBonus = 643,
/// <summary>
/// Can only be traded for an equal amount of items with the same category.
/// </summary>
RestrictedTrade = 689,
MobilisingArmiesSquad = 802,
MagicBonus = 965,
/// <summary>
/// 0 = attack, 1 = defence, 2= strength, 4 = ranged, 5 = prayer, 6 = magic
/// </summary>
EquipSkillRequired = 749,
EquipLevelRequired = 750,
EquipSkillRequired2 = 751,
EquipLevelRequired2 = 752,
LifePointBonus = 1326,
UnknownRestrictedTradeRelated = 1397,
GeCategory = 2195,
BeastOfBurdenStorable = 2240,
MeleeAffinity = 2866,
RangedAffinity = 2867,
MagicAffinity = 2868,
ArmourBonus = 2870,
PrayerBonus = 2946,
PotionEffectValue = 3000,
UnknownPopItemCharge = 3109,
WeaponAccuracy = 3267,
RepairCost = 3383,
CombatCharges = 3385,
PortentOfDegradationHealAmount = 3698,
Broken = 3793,
MtxDescription = 4085,
SpecialAttackCost = 4332,
SpecialAttackName = 4333,
SpecialAttackDescription = 4334,
DestroyForGp = 4907,
DestroyText = 5417,
ZarosItem = 5440,
UnknownBookcaseReclaimCost = 5637,
UnknownFayreTokenRelated = 6405,
SigilCooldownDefault = 6520,
SigilCooldown = 6521,
SigilMaxCharges = 6522,
PofFarmLevel = 7477,
}
}
|
mit
|
C#
|
749686defa480d83ef1ab9740998e9e6db7dbd52
|
Reduce allocations while maintaining read-only-ness
|
smoogipooo/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework
|
osu.Framework/Graphics/Containers/TextPart.cs
|
osu.Framework/Graphics/Containers/TextPart.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
namespace osu.Framework.Graphics.Containers
{
/// <summary>
/// A basic implementation of <see cref="ITextPart"/>,
/// which automatically handles returning correct <see cref="Drawables"/>
/// and raising <see cref="DrawablePartsRecreated"/>.
/// </summary>
public abstract class TextPart : ITextPart
{
public IEnumerable<Drawable> Drawables { get; }
public event Action<IEnumerable<Drawable>> DrawablePartsRecreated;
private readonly List<Drawable> drawables = new List<Drawable>();
protected TextPart()
{
Drawables = drawables.AsReadOnly();
}
public void RecreateDrawablesFor(TextFlowContainer textFlowContainer)
{
drawables.Clear();
drawables.AddRange(CreateDrawablesFor(textFlowContainer));
DrawablePartsRecreated?.Invoke(drawables);
}
/// <summary>
/// Creates drawables representing the contents of this <see cref="TextPart"/>,
/// to be appended to the <paramref name="textFlowContainer"/>.
/// </summary>
protected abstract IEnumerable<Drawable> CreateDrawablesFor(TextFlowContainer textFlowContainer);
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Extensions.ListExtensions;
namespace osu.Framework.Graphics.Containers
{
/// <summary>
/// A basic implementation of <see cref="ITextPart"/>,
/// which automatically handles returning correct <see cref="Drawables"/>
/// and raising <see cref="DrawablePartsRecreated"/>.
/// </summary>
public abstract class TextPart : ITextPart
{
public IEnumerable<Drawable> Drawables => drawables.AsSlimReadOnly();
private readonly List<Drawable> drawables = new List<Drawable>();
public event Action<IEnumerable<Drawable>> DrawablePartsRecreated;
public void RecreateDrawablesFor(TextFlowContainer textFlowContainer)
{
drawables.Clear();
drawables.AddRange(CreateDrawablesFor(textFlowContainer));
DrawablePartsRecreated?.Invoke(drawables);
}
/// <summary>
/// Creates drawables representing the contents of this <see cref="TextPart"/>,
/// to be appended to the <paramref name="textFlowContainer"/>.
/// </summary>
protected abstract IEnumerable<Drawable> CreateDrawablesFor(TextFlowContainer textFlowContainer);
}
}
|
mit
|
C#
|
5ef1f30c754a6bc39239ad61042daabf17ca2709
|
Add logging of unhandled tumbler exception
|
DanGould/NTumbleBit,NTumbleBit/NTumbleBit
|
NTumbleBit/ClassicTumbler/Server/Startup.cs
|
NTumbleBit/ClassicTumbler/Server/Startup.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Net.Http.Headers;
using Microsoft.AspNetCore.Diagnostics;
using NTumbleBit.Logging;
namespace NTumbleBit.ClassicTumbler.Server
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IObjectModelValidator, NoObjectModelValidator>();
services.AddMvcCore(o =>
{
o.Filters.Add(new ActionResultExceptionFilter());
o.Filters.Add(new TumblerExceptionFilter());
o.InputFormatters.Add(new BitcoinInputFormatter());
o.OutputFormatters.Add(new BitcoinOutputFormatter());
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env,
ILoggerFactory loggerFactory,
IServiceProvider serviceProvider)
{
app.Use(req =>
{
return async (ctx) =>
{
try
{
await req(ctx);
}
catch(Exception ex)
{
Logs.Tumbler.LogCritical("Unhandled exception thrown by the Tumbler Service", ex);
throw;
}
};
});
var logging = new FilterLoggerSettings();
logging.Add("Microsoft.AspNetCore.Hosting.Internal.WebHost", LogLevel.Error);
logging.Add("Microsoft.AspNetCore.Mvc", LogLevel.Error);
logging.Add("Microsoft.AspNetCore.Server.Kestrel", LogLevel.Error);
loggerFactory
.WithFilter(logging)
.AddConsole();
app.UseMvc();
var builder = serviceProvider.GetService<ConfigurationBuilder>() ?? new ConfigurationBuilder();
Configuration = builder.Build();
var config = serviceProvider.GetService<TumblerRuntime>();
var options = GetMVCOptions(serviceProvider);
Serializer.RegisterFrontConverters(options.SerializerSettings, config.Network);
}
public IConfiguration Configuration
{
get; set;
}
private static MvcJsonOptions GetMVCOptions(IServiceProvider serviceProvider)
{
return serviceProvider.GetRequiredService<IOptions<MvcJsonOptions>>().Value;
}
}
internal class NoObjectModelValidator : IObjectModelValidator
{
public void Validate(ActionContext actionContext, ValidationStateDictionary validationState, string prefix, object model)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Net.Http.Headers;
namespace NTumbleBit.ClassicTumbler.Server
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IObjectModelValidator, NoObjectModelValidator>();
services.AddMvcCore(o =>
{
o.Filters.Add(new ActionResultExceptionFilter());
o.Filters.Add(new TumblerExceptionFilter());
o.InputFormatters.Add(new BitcoinInputFormatter());
o.OutputFormatters.Add(new BitcoinOutputFormatter());
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env,
ILoggerFactory loggerFactory,
IServiceProvider serviceProvider)
{
var logging = new FilterLoggerSettings();
logging.Add("Microsoft.AspNetCore.Hosting.Internal.WebHost", LogLevel.Error);
logging.Add("Microsoft.AspNetCore.Mvc", LogLevel.Error);
logging.Add("Microsoft.AspNetCore.Server.Kestrel", LogLevel.Error);
loggerFactory
.WithFilter(logging)
.AddConsole();
app.UseMvc();
var builder = serviceProvider.GetService<ConfigurationBuilder>() ?? new ConfigurationBuilder();
Configuration = builder.Build();
var config = serviceProvider.GetService<TumblerRuntime>();
var options = GetMVCOptions(serviceProvider);
Serializer.RegisterFrontConverters(options.SerializerSettings, config.Network);
}
public IConfiguration Configuration
{
get; set;
}
private static MvcJsonOptions GetMVCOptions(IServiceProvider serviceProvider)
{
return serviceProvider.GetRequiredService<IOptions<MvcJsonOptions>>().Value;
}
}
internal class NoObjectModelValidator : IObjectModelValidator
{
public void Validate(ActionContext actionContext, ValidationStateDictionary validationState, string prefix, object model)
{
}
}
}
|
mit
|
C#
|
903bab788594a210ad7577c572676bc5a4511367
|
Integrate Specialities and Institutes with Startup
|
denismaster/dcs,denismaster/dcs,denismaster/dcs,denismaster/dcs
|
src/Diploms.WebUI/Startup.cs
|
src/Diploms.WebUI/Startup.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Diploms.DataLayer;
using Diploms.WebUI.Configuration;
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SpaServices.Webpack;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using AutoMapper;
namespace Diploms.WebUI
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services
.AddMvc()
.AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining<Startup>());
services.AddAutoMapper();
services.AddInstitutes();
services.AddDepartments();
services.AddSpecialities();
services.AddDbContext<DiplomContext>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true
});
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Diploms.DataLayer;
using Diploms.WebUI.Configuration;
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SpaServices.Webpack;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using AutoMapper;
namespace Diploms.WebUI
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services
.AddMvc()
.AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining<Startup>());
services.AddAutoMapper();
services.AddDepartments();
services.AddDbContext<DiplomContext>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true
});
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });
});
}
}
}
|
mit
|
C#
|
907d596c6e66faa5e02a5cdc2a3a639a8785247d
|
Fix UserAgent
|
KriBetko/KryBot
|
src/KryBot/Bot.cs
|
src/KryBot/Bot.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Xml.Serialization;
namespace KryBot
{
public class Bot
{
public Bot()
{
GameMiner = new GameMiner();
SteamGifts = new SteamGifts();
SteamCompanion = new SteamCompanion();
UseGamble = new UseGamble();
SteamTrade = new SteamTrade();
PlayBlink = new PlayBlink();
Steam = new Steam();
GameAways = new GameAways();
}
public string UserAgent { get; set; }
public GameMiner GameMiner { get; set; }
public SteamGifts SteamGifts { get; set; }
public SteamCompanion SteamCompanion { get; set; }
public UseGamble UseGamble { get; set; }
public SteamTrade SteamTrade { get; set; }
public PlayBlink PlayBlink { get; set; }
public Steam Steam { get; set; }
public GameAways GameAways { get; set; }
public void ClearGiveawayList()
{
GameMiner.Giveaways = new List<GameMiner.GmGiveaway>();
SteamGifts.Giveaways = new List<SteamGifts.SgGiveaway>();
SteamGifts.WishlistGiveaways = new List<SteamGifts.SgGiveaway>();
SteamCompanion.Giveaways = new List<SteamCompanion.ScGiveaway>();
SteamCompanion.WishlistGiveaways = new List<SteamCompanion.ScGiveaway>();
UseGamble.Giveaways = new List<UseGamble.UgGiveaway>();
SteamTrade.Giveaways = new List<SteamTrade.StGiveaway>();
PlayBlink.Giveaways = new List<PlayBlink.PbGiveaway>();
}
public bool Save()
{
ClearGiveawayList();
try
{
using (var fileStream = new FileStream("profile.xml", FileMode.Create, FileAccess.Write))
{
var serializer = new XmlSerializer(typeof(Bot));
serializer.Serialize(fileStream, this);
}
return true;
}
catch (Exception ex)
{
MessageBox.Show(@"Ошибка", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
public bool Save(string path)
{
ClearGiveawayList();
try
{
using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write))
{
var serializer = new XmlSerializer(typeof(Bot));
serializer.Serialize(fileStream, this);
}
return true;
}
catch (Exception ex)
{
MessageBox.Show(@"Ошибка", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Xml.Serialization;
namespace KryBot
{
public class Bot
{
public Bot()
{
GameMiner = new GameMiner();
SteamGifts = new SteamGifts();
SteamCompanion = new SteamCompanion();
UseGamble = new UseGamble();
SteamTrade = new SteamTrade();
PlayBlink = new PlayBlink();
Steam = new Steam();
GameAways = new GameAways();
}
public string UserAgent { get; set; }
public GameMiner GameMiner { get; set; }
public SteamGifts SteamGifts { get; set; }
public SteamCompanion SteamCompanion { get; set; }
public UseGamble UseGamble { get; set; }
public SteamTrade SteamTrade { get; set; }
public PlayBlink PlayBlink { get; set; }
public Steam Steam { get; set; }
public GameAways GameAways { get; set; }
public void ClearGiveawayList()
{
UserAgent = "";
GameMiner.Giveaways = new List<GameMiner.GmGiveaway>();
SteamGifts.Giveaways = new List<SteamGifts.SgGiveaway>();
SteamGifts.WishlistGiveaways = new List<SteamGifts.SgGiveaway>();
SteamCompanion.Giveaways = new List<SteamCompanion.ScGiveaway>();
SteamCompanion.WishlistGiveaways = new List<SteamCompanion.ScGiveaway>();
UseGamble.Giveaways = new List<UseGamble.UgGiveaway>();
SteamTrade.Giveaways = new List<SteamTrade.StGiveaway>();
PlayBlink.Giveaways = new List<PlayBlink.PbGiveaway>();
}
public bool Save()
{
ClearGiveawayList();
try
{
using (var fileStream = new FileStream("profile.xml", FileMode.Create, FileAccess.Write))
{
var serializer = new XmlSerializer(typeof(Bot));
serializer.Serialize(fileStream, this);
}
return true;
}
catch (Exception ex)
{
MessageBox.Show(@"Ошибка", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
public bool Save(string path)
{
ClearGiveawayList();
try
{
using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write))
{
var serializer = new XmlSerializer(typeof(Bot));
serializer.Serialize(fileStream, this);
}
return true;
}
catch (Exception ex)
{
MessageBox.Show(@"Ошибка", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
}
}
|
apache-2.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.