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 |
|---|---|---|---|---|---|---|---|---|
e60a1b8c693fa802d7d021d1df57a966d12128ad | update TraceTransaction return type | Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum | src/Nethereum.Parity/RPC/Trace/ITraceTransaction.cs | src/Nethereum.Parity/RPC/Trace/ITraceTransaction.cs | using System.Threading.Tasks;
using Nethereum.JsonRpc.Client;
using Newtonsoft.Json.Linq;
namespace Nethereum.Parity.RPC.Trace
{
public interface ITraceTransaction
{
RpcRequest BuildRequest(string transactionHash, object id = null);
Task<JArray> SendRequestAsync(string transactionHash, object id = null);
}
}
| using System.Threading.Tasks;
using Nethereum.JsonRpc.Client;
using Newtonsoft.Json.Linq;
namespace Nethereum.Parity.RPC.Trace
{
public interface ITraceTransaction
{
RpcRequest BuildRequest(string transactionHash, object id = null);
Task<JObject> SendRequestAsync(string transactionHash, object id = null);
}
} | mit | C# |
f358778ec834576b199d7c7f4cd5a42deb2d9a49 | Add medium breakpoint to home latests posts. | PioneerCode/pioneer-blog,PioneerCode/pioneer-blog,PioneerCode/pioneer-blog,PioneerCode/pioneer-blog | src/Pioneer.Blog/Views/Home/_HomeLatestPosts.cshtml | src/Pioneer.Blog/Views/Home/_HomeLatestPosts.cshtml | @model List<Post>
<section class="home-latest-posts">
<h3 class="header-surround-bar"><span>Latest Posts</span></h3>
<div class="row width-100">
@foreach (var post in Model.Take(4))
{
<div class="large-3 medium-6 columns end">
@Html.Partial("_HomePostCard", post)
</div>
}
</div>
<div class="row width-100">
@foreach (var post in Model.Skip(4))
{
<div class="large-3 medium-6 columns end">
@Html.Partial("_HomePostCard", post)
</div>
}
</div>
</section> | @model List<Post>
<section class="home-latest-posts">
<h3 class="header-surround-bar"><span>Latest Posts</span></h3>
<div class="row width-100">
@foreach (var post in Model.Take(4))
{
<div class="large-3 columns end">
@Html.Partial("_HomePostCard", post)
</div>
}
</div>
<div class="row width-100">
@foreach (var post in Model.Skip(4))
{
<div class="large-3 columns end">
@Html.Partial("_HomePostCard", post)
</div>
}
</div>
</section> | mit | C# |
e45a38b888da60837bc47da75e34bae4901d3e5e | Make VsTargetProject's GetHashCode case-insensitive. | antiufo/NuGet2,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,jholovacs/NuGet,jholovacs/NuGet,antiufo/NuGet2,oliver-feng/nuget,jmezach/NuGet2,mrward/nuget,xoofx/NuGet,antiufo/NuGet2,antiufo/NuGet2,GearedToWar/NuGet2,akrisiun/NuGet,mrward/nuget,mrward/NuGet.V2,akrisiun/NuGet,oliver-feng/nuget,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,GearedToWar/NuGet2,jmezach/NuGet2,mrward/nuget,jholovacs/NuGet,GearedToWar/NuGet2,jmezach/NuGet2,mrward/NuGet.V2,xoofx/NuGet,mrward/NuGet.V2,RichiCoder1/nuget-chocolatey,oliver-feng/nuget,oliver-feng/nuget,jholovacs/NuGet,xoofx/NuGet,jmezach/NuGet2,antiufo/NuGet2,RichiCoder1/nuget-chocolatey,xoofx/NuGet,oliver-feng/nuget,mrward/nuget,RichiCoder1/nuget-chocolatey,GearedToWar/NuGet2,jmezach/NuGet2,oliver-feng/nuget,jholovacs/NuGet,GearedToWar/NuGet2,antiufo/NuGet2,mrward/nuget,RichiCoder1/nuget-chocolatey,GearedToWar/NuGet2,xoofx/NuGet,xoofx/NuGet,jmezach/NuGet2,jholovacs/NuGet,mrward/nuget,mrward/NuGet.V2 | src/V3/NuGet.Client.VisualStudio/VsTargetProject.cs | src/V3/NuGet.Client.VisualStudio/VsTargetProject.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using EnvDTE;
using Newtonsoft.Json.Linq;
using NuGet.Client.Diagnostics;
using NuGet.Client.Interop;
using NuGet.Client.Resolution;
using NuGet.Resolver;
using NuGet.Versioning;
using NuGet.VisualStudio;
using NewPackageAction = NuGet.Client.Resolution.PackageAction;
namespace NuGet.Client.VisualStudio
{
public class VsTargetProject : CoreInteropTargetProjectBase
{
private readonly IProjectManager _projectManager;
private readonly InstalledPackagesList _installedPackages;
public Project Project { get; private set; }
public override string Name
{
get { return Project.Name; }
}
public override IProjectSystem ProjectSystem
{
get { return _projectManager.Project; }
}
public override InstalledPackagesList InstalledPackages
{
get { return _installedPackages; }
}
public VsTargetProject(Project project, IProjectManager projectManager)
: this(project, projectManager, (IPackageReferenceRepository2)projectManager.LocalRepository)
{
}
public VsTargetProject(Project project, IProjectManager projectManager, IPackageReferenceRepository2 localRepository)
{
Project = project;
_projectManager = projectManager;
_installedPackages = new ProjectInstalledPackagesList(localRepository);
}
public override IEnumerable<FrameworkName> GetSupportedFrameworks()
{
yield return Project.GetTargetFrameworkName();
}
protected override IProjectManager GetProjectManager()
{
return _projectManager;
}
public override bool Equals(object obj)
{
return Equals(obj as TargetProject);
}
public override bool Equals(TargetProject other)
{
var vsProj = other as VsTargetProject;
return vsProj != null &&
String.Equals(vsProj.Project.UniqueName, Project.UniqueName, StringComparison.OrdinalIgnoreCase);
}
public override int GetHashCode()
{
return Project.UniqueName.ToLowerInvariant().GetHashCode();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using EnvDTE;
using Newtonsoft.Json.Linq;
using NuGet.Client.Diagnostics;
using NuGet.Client.Interop;
using NuGet.Client.Resolution;
using NuGet.Resolver;
using NuGet.Versioning;
using NuGet.VisualStudio;
using NewPackageAction = NuGet.Client.Resolution.PackageAction;
namespace NuGet.Client.VisualStudio
{
public class VsTargetProject : CoreInteropTargetProjectBase
{
private readonly IProjectManager _projectManager;
private readonly InstalledPackagesList _installedPackages;
public Project Project { get; private set; }
public override string Name
{
get { return Project.Name; }
}
public override IProjectSystem ProjectSystem
{
get { return _projectManager.Project; }
}
public override InstalledPackagesList InstalledPackages
{
get { return _installedPackages; }
}
public VsTargetProject(Project project, IProjectManager projectManager)
: this(project, projectManager, (IPackageReferenceRepository2)projectManager.LocalRepository)
{
}
public VsTargetProject(Project project, IProjectManager projectManager, IPackageReferenceRepository2 localRepository)
{
Project = project;
_projectManager = projectManager;
_installedPackages = new ProjectInstalledPackagesList(localRepository);
}
public override IEnumerable<FrameworkName> GetSupportedFrameworks()
{
yield return Project.GetTargetFrameworkName();
}
protected override IProjectManager GetProjectManager()
{
return _projectManager;
}
public override bool Equals(object obj)
{
return Equals(obj as TargetProject);
}
public override bool Equals(TargetProject other)
{
var vsProj = other as VsTargetProject;
return vsProj != null &&
String.Equals(vsProj.Project.UniqueName, Project.UniqueName, StringComparison.OrdinalIgnoreCase);
}
public override int GetHashCode()
{
return Project.UniqueName.GetHashCode();
}
}
}
| apache-2.0 | C# |
3964fe9360f41b80f590f558a83a7b3aa3bd8fa4 | Update my Telegram username | matteocontrini/locuspocusbot | LocusPocusBot/Handlers/HelpHandler.cs | LocusPocusBot/Handlers/HelpHandler.cs | using LocusPocusBot.Rooms;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot;
using Telegram.Bot.Types.Enums;
namespace LocusPocusBot.Handlers
{
public class HelpHandler : HandlerBase
{
private readonly IBotService bot;
private readonly Department[] departments;
public HelpHandler(IBotService botService,
Department[] departments)
{
this.bot = botService;
this.departments = departments;
}
public override async Task Run()
{
StringBuilder msg = new StringBuilder();
msg.AppendLine("*LocusPocus* è il bot per controllare la disponibilità delle aule presso i poli dell'Università di Trento 🎓");
msg.AppendLine();
msg.AppendLine("👉 *Usa uno di questi comandi per ottenere la lista delle aule libere*");
msg.AppendLine();
foreach (Department dep in this.departments)
{
msg.Append('/');
msg.AppendLine(dep.Slug);
}
msg.AppendLine();
msg.AppendLine("🤫 Il bot è sviluppato da Matteo Contrini (@matteosonoio) con la collaborazione di Emilio Molinari");
msg.AppendLine();
msg.AppendLine("👏 Un grazie speciale a Alessandro Conti per il nome del bot e a [Dario Crisafulli](https://botfactory.it/#chisiamo) per il logo!");
msg.AppendLine();
msg.AppendLine("🤓 Il bot è [open source](https://github.com/matteocontrini/locuspocusbot)");
await this.bot.Client.SendTextMessageAsync(
chatId: this.Chat.Id,
text: msg.ToString(),
parseMode: ParseMode.Markdown,
disableWebPagePreview: true
);
}
}
}
| using LocusPocusBot.Rooms;
using System.Text;
using System.Threading.Tasks;
using Telegram.Bot;
using Telegram.Bot.Types.Enums;
namespace LocusPocusBot.Handlers
{
public class HelpHandler : HandlerBase
{
private readonly IBotService bot;
private readonly Department[] departments;
public HelpHandler(IBotService botService,
Department[] departments)
{
this.bot = botService;
this.departments = departments;
}
public override async Task Run()
{
StringBuilder msg = new StringBuilder();
msg.AppendLine("*LocusPocus* è il bot per controllare la disponibilità delle aule presso i poli dell'Università di Trento 🎓");
msg.AppendLine();
msg.AppendLine("👉 *Usa uno di questi comandi per ottenere la lista delle aule libere*");
msg.AppendLine();
foreach (Department dep in this.departments)
{
msg.Append('/');
msg.AppendLine(dep.Slug);
}
msg.AppendLine();
msg.AppendLine("🤫 Il bot è sviluppato da Matteo Contrini (@matteocontrini) con la collaborazione di Emilio Molinari");
msg.AppendLine();
msg.AppendLine("👏 Un grazie speciale a Alessandro Conti per il nome del bot e a [Dario Crisafulli](https://botfactory.it/#chisiamo) per il logo!");
msg.AppendLine();
msg.AppendLine("🤓 Il bot è [open source](https://github.com/matteocontrini/locuspocusbot)");
await this.bot.Client.SendTextMessageAsync(
chatId: this.Chat.Id,
text: msg.ToString(),
parseMode: ParseMode.Markdown,
disableWebPagePreview: true
);
}
}
}
| mit | C# |
6ab62c4f8a8ff3d614744b7dc1a8efac83c0d98a | Update SvenMichaelStuebe.cs | beraybentesen/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin | src/Firehose.Web/Authors/SvenMichaelStuebe.cs | src/Firehose.Web/Authors/SvenMichaelStuebe.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class SvenMichaelStuebe : IAmAMicrosoftMVP, IFilterMyBlogPosts
{
public string FirstName => "Sven-Michael";
public string LastName => "Stübe";
public string Title => "software engineer at Zühlke";
public string StateOrRegion => "Munich, Germany";
public string EmailAddress => string.Empty;
public string TwitterHandle => "stuebe2k14";
public Uri WebSite => new Uri("http://smstuebe.de/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://smstuebe.de/feed.xml"); }
}
DateTime IAmAMicrosoftMVP.FirstAwarded => new DateTime(2017, 1, 1);
public string GravatarHash => "08b73d0a58fc120a8cc8dc561d83b3d6";
public bool Filter(SyndicationItem item)
{
return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("xamarin"));
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class SvenMichaelStuebe : IAmAMicrosoftMVP, IFilterMyBlogPosts
{
public string FirstName => "Sven-Michael";
public string LastName => "Stübe";
public string Title => "Expert Software at Zühlke";
public string StateOrRegion => "Munich, Germany";
public string EmailAddress => string.Empty;
public string TwitterHandle => "stuebe2k14";
public Uri WebSite => new Uri("http://smstuebe.de/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://smstuebe.de/feed.xml"); }
}
DateTime IAmAMicrosoftMVP.FirstAwarded => new DateTime(2017, 1, 1);
public string GravatarHash => "08b73d0a58fc120a8cc8dc561d83b3d6";
public bool Filter(SyndicationItem item)
{
return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("xamarin"));
}
}
} | mit | C# |
ee66f688d0fa83fdd73824515d58f8a082b555ef | Fix for breapoint issue 3696. | MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS | src/Host/Client/Impl/Definitions/IRContext.cs | src/Host/Client/Impl/Definitions/IRContext.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.R.Host.Client {
/// <summary>
/// Representation of <c>struct RCTXT</c> in R.
/// </summary>
public interface IRContext {
RContextType CallFlag { get; }
}
public static class RContextExtensions {
public static bool IsBrowser(this IReadOnlyList<IRContext> contexts) {
bool isBrowser = contexts.SkipWhile(context => context.CallFlag.HasFlag(RContextType.Restart)).FirstOrDefault()?.CallFlag.HasFlag(RContextType.Browser) == true;
if (!isBrowser) {
isBrowser = contexts.Skip(1).SkipWhile(context => context.CallFlag.HasFlag(RContextType.Restart)).FirstOrDefault()?.CallFlag.HasFlag(RContextType.Browser) == true;
}
return isBrowser;
}
}
}
| // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.R.Host.Client {
/// <summary>
/// Representation of <c>struct RCTXT</c> in R.
/// </summary>
public interface IRContext {
RContextType CallFlag { get; }
}
public static class RContextExtensions {
public static bool IsBrowser(this IReadOnlyList<IRContext> contexts) {
return contexts.SkipWhile(context => context.CallFlag.HasFlag(RContextType.Restart))
.FirstOrDefault()?.CallFlag.HasFlag(RContextType.Browser) == true;
}
}
}
| mit | C# |
b494af15f3ab2d20055f89bd7572705657d230f9 | Remove unused usings | TheEadie/LazyStorage,TheEadie/LazyStorage,TheEadie/LazyLibrary | src/LazyStorage/InMemory/InMemorySingleton.cs | src/LazyStorage/InMemory/InMemorySingleton.cs | using System.Collections.Generic;
namespace LazyStorage.InMemory
{
internal static class InMemorySingleton
{
private static Dictionary<string, IEnumerable<Dictionary<string,string>>> _repos = new Dictionary<string, IEnumerable<Dictionary<string,string>>>();
public static void Sync<T>(string type, IEnumerable<Dictionary<string, string>> items)
{
if (!_repos.ContainsKey(type))
{
_repos.Add(type, items);
}
else
{
_repos[type] = items;
}
}
public static IEnumerable<Dictionary<string, string>> GetRepo<T>()
{
if (_repos.ContainsKey(nameof(T)))
{
return _repos[nameof(T)];
}
else
{
return new List<Dictionary<string,string>>();
}
}
public static void Clear()
{
_repos.Clear();
}
}
} | using System.Collections;
using System.Collections.Generic;
using LazyStorage.Interfaces;
namespace LazyStorage.InMemory
{
internal static class InMemorySingleton
{
private static Dictionary<string, IEnumerable<Dictionary<string,string>>> _repos = new Dictionary<string, IEnumerable<Dictionary<string,string>>>();
public static void Sync<T>(string type, IEnumerable<Dictionary<string, string>> items)
{
if (!_repos.ContainsKey(type))
{
_repos.Add(type, items);
}
else
{
_repos[type] = items;
}
}
public static IEnumerable<Dictionary<string, string>> GetRepo<T>()
{
if (_repos.ContainsKey(nameof(T)))
{
return _repos[nameof(T)];
}
else
{
return new List<Dictionary<string,string>>();
}
}
public static void Clear()
{
_repos.Clear();
}
}
} | mit | C# |
1b26f5e1097cea445f02014db024f5f87d3848cd | Bump version to 10.4.0.23576 | HearthSim/HearthDb | HearthDb/Properties/AssemblyInfo.cs | HearthDb/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("10.4.0.23576")]
[assembly: AssemblyFileVersion("10.4.0.23576")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("10.2.0.23180")]
[assembly: AssemblyFileVersion("10.2.0.23180")]
| mit | C# |
b0781aba67c4fe22a43b53baec495929efdb7441 | Change the SourceRouter configuration from local to remote | ButchersBoy/MaterialDesignInXamlToolkit,ButchersBoy/MaterialDesignInXamlToolkit,ButchersBoy/MaterialDesignInXamlToolkit | MainDemo.Wpf/Helper/SourceRouter.cs | MainDemo.Wpf/Helper/SourceRouter.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using CodeDisplayer;
namespace MaterialDesignDemo.Helper {
public class SourceRouter {
private string _typeName;
private const bool GetFromLocalSource = false;
public SourceRouter(string typeName) {
_typeName = typeName;
}
public XmlDocument GetSource() {
if (GetFromLocalSource)
return Local();
else
return Remote();
}
public XmlDocument Local() {
var xmlDoc = new XmlDocument();
string source = File.ReadAllText($@"..\..\{_typeName}.xaml");
xmlDoc.LoadXml(source);
return xmlDoc;
}
public XmlDocument Remote() {
string ownerName = "wongjiahau";
string branchName = "New-Demo-2";
string sourceCode = DownloadFile(
@"https://raw.githubusercontent.com/" +
$"{ownerName}/" +
"MaterialDesignInXamlToolkit/" +
$"{branchName}/"+
"MainDemo.Wpf/" +
$"{_typeName}.xaml"
);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(sourceCode);
return xmlDoc;
}
private static string DownloadFile(string sourceUrl)
//Refered from : https://gist.github.com/nboubakr/7812375
{
long existLen = 0;
var httpReq = (HttpWebRequest)WebRequest.Create(sourceUrl);
httpReq.AddRange((int)existLen);
var httpRes = (HttpWebResponse)httpReq.GetResponse();
var responseStream = httpRes.GetResponseStream();
if (responseStream == null) return "Fail to fetch file";
var streamReader = new StreamReader(responseStream);
return streamReader.ReadToEnd();
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using CodeDisplayer;
namespace MaterialDesignDemo.Helper {
public class SourceRouter {
private string _typeName;
private const bool GetFromLocalSource = true;
public SourceRouter(string typeName) {
_typeName = typeName;
}
public XmlDocument GetSource() {
if (GetFromLocalSource)
return Local();
else
return Remote();
}
public XmlDocument Local() {
var xmlDoc = new XmlDocument();
string source = File.ReadAllText($@"..\..\{_typeName}.xaml");
xmlDoc.LoadXml(source);
return xmlDoc;
}
public XmlDocument Remote() {
string ownerName = "wongjiahau";
string branchName = "New-Demo-2";
string sourceCode = DownloadFile(
@"https://raw.githubusercontent.com/" +
$"{ownerName}/" +
"MaterialDesignInXamlToolkit/" +
$"{branchName}/"+
"MainDemo.Wpf/" +
$"{_typeName}.xaml"
);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(sourceCode);
return xmlDoc;
}
private static string DownloadFile(string sourceUrl)
//Refered from : https://gist.github.com/nboubakr/7812375
{
long existLen = 0;
var httpReq = (HttpWebRequest)WebRequest.Create(sourceUrl);
httpReq.AddRange((int)existLen);
var httpRes = (HttpWebResponse)httpReq.GetResponse();
var responseStream = httpRes.GetResponseStream();
if (responseStream == null) return "Fail to fetch file";
var streamReader = new StreamReader(responseStream);
return streamReader.ReadToEnd();
}
}
}
| mit | C# |
01dd90dad43bb8e87b7c6ad87c0c8a01dd2c8ebd | Change class visibility from public to internal for Jira string extensions | GitTools/GitTools.IssueTrackers | src/GitTools.IssueTrackers/IssueTrackers/Jira/Extensions/StringExtensions.cs | src/GitTools.IssueTrackers/IssueTrackers/Jira/Extensions/StringExtensions.cs | namespace GitTools.IssueTrackers.Jira
{
internal static class StringExtensions
{
public static string AddJiraFilter(this string value, string additionalValue, string joinText = "AND")
{
if (!string.IsNullOrWhiteSpace(value))
{
value += string.Format(" {0} ", joinText);
}
else
{
value = string.Empty;
}
value += additionalValue;
return value;
}
}
} | namespace GitTools.IssueTrackers.Jira
{
public static class StringExtensions
{
public static string AddJiraFilter(this string value, string additionalValue, string joinText = "AND")
{
if (!string.IsNullOrWhiteSpace(value))
{
value += string.Format(" {0} ", joinText);
}
else
{
value = string.Empty;
}
value += additionalValue;
return value;
}
}
} | mit | C# |
965d0603ce4346f6be847568336eff24c4b469e0 | Fix slider tick colour not being applied properly | peppy/osu,ppy/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu | osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSliderScorePoint.cs | osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSliderScorePoint.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.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Skinning.Argon
{
public class ArgonSliderScorePoint : CircularContainer
{
private Bindable<Color4> accentColour = null!;
private const float size = 12;
[BackgroundDependencyLoader]
private void load(DrawableHitObject hitObject)
{
Masking = true;
Origin = Anchor.Centre;
Size = new Vector2(size);
BorderThickness = 3;
BorderColour = Color4.White;
Child = new Box
{
RelativeSizeAxes = Axes.Both,
AlwaysPresent = true,
Alpha = 0,
};
accentColour = hitObject.AccentColour.GetBoundCopy();
accentColour.BindValueChanged(accent => BorderColour = accent.NewValue, true);
}
}
}
| // 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.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Skinning.Argon
{
public class ArgonSliderScorePoint : CircularContainer
{
private Bindable<Color4> accentColour = null!;
private const float size = 12;
[BackgroundDependencyLoader]
private void load(DrawableHitObject hitObject)
{
Masking = true;
Origin = Anchor.Centre;
Size = new Vector2(size);
BorderThickness = 3;
BorderColour = Color4.White;
Child = new Box
{
RelativeSizeAxes = Axes.Both,
AlwaysPresent = true,
Alpha = 0,
};
accentColour = hitObject.AccentColour.GetBoundCopy();
accentColour.BindValueChanged(accent => BorderColour = accent.NewValue);
}
}
}
| mit | C# |
fef03a37a374c1cbd6838698cb6d38fb96bd1318 | allow for different casing on Boo.Lang.Compiler.dll | wbardzinski/boo,KingJiangNet/boo,wbardzinski/boo,drslump/boo,BitPuffin/boo,bamboo/boo,KingJiangNet/boo,KingJiangNet/boo,scottstephens/boo,wbardzinski/boo,BITechnologies/boo,drslump/boo,hmah/boo,BITechnologies/boo,KingJiangNet/boo,boo-lang/boo,KingJiangNet/boo,BillHally/boo,rmartinho/boo,wbardzinski/boo,hmah/boo,BitPuffin/boo,scottstephens/boo,Unity-Technologies/boo,Unity-Technologies/boo,KidFashion/boo,BITechnologies/boo,drslump/boo,rmartinho/boo,boo-lang/boo,drslump/boo,BillHally/boo,BITechnologies/boo,BitPuffin/boo,KidFashion/boo,bamboo/boo,rmartinho/boo,BillHally/boo,BitPuffin/boo,KidFashion/boo,scottstephens/boo,hmah/boo,wbardzinski/boo,rmartinho/boo,BillHally/boo,boo-lang/boo,scottstephens/boo,rmartinho/boo,BitPuffin/boo,scottstephens/boo,BillHally/boo,boo-lang/boo,KidFashion/boo,hmah/boo,scottstephens/boo,Unity-Technologies/boo,drslump/boo,drslump/boo,drslump/boo,bamboo/boo,hmah/boo,rmboggs/boo,bamboo/boo,boo-lang/boo,bamboo/boo,Unity-Technologies/boo,BITechnologies/boo,KingJiangNet/boo,scottstephens/boo,rmboggs/boo,wbardzinski/boo,BillHally/boo,BitPuffin/boo,wbardzinski/boo,rmboggs/boo,Unity-Technologies/boo,BitPuffin/boo,KingJiangNet/boo,Unity-Technologies/boo,boo-lang/boo,wbardzinski/boo,rmboggs/boo,boo-lang/boo,bamboo/boo,hmah/boo,rmboggs/boo,KidFashion/boo,BitPuffin/boo,BITechnologies/boo,rmartinho/boo,Unity-Technologies/boo,rmboggs/boo,KidFashion/boo,rmboggs/boo,rmartinho/boo,hmah/boo,hmah/boo,rmartinho/boo,BITechnologies/boo,rmboggs/boo,BITechnologies/boo,scottstephens/boo,Unity-Technologies/boo,hmah/boo,bamboo/boo,KingJiangNet/boo,KidFashion/boo,BillHally/boo,boo-lang/boo | src/Boo.Lang.Compiler/Steps/Parsing.cs | src/Boo.Lang.Compiler/Steps/Parsing.cs | using System;
using System.IO;
using System.Reflection;
using Boo.Lang.Compiler.Util;
using Boo.Lang.Environments;
namespace Boo.Lang.Compiler.Steps
{
public class Parsing : ICompilerStep
{
private ICompilerStep _parser;
public void Initialize(CompilerContext context)
{
Parser.Initialize(context);
}
public void Run()
{
Parser.Run();
}
public void Dispose()
{
if (_parser != null)
{
_parser.Dispose();
_parser = null;
}
}
private ICompilerStep Parser
{
get { return (_parser ?? (_parser = NewParserStep())); }
}
static ICompilerStep NewParserStep()
{
return (ICompilerStep)Activator.CreateInstance(ConfiguredParserType);
}
private static Type ConfiguredParserType
{
get
{
var parserType = My<CompilerParameters>.Instance.WhiteSpaceAgnostic ? "Boo.Lang.Parser.WSABooParsingStep" : "Boo.Lang.Parser.BooParsingStep";
return ParserAssembly().GetType(parserType, true);
}
}
static Assembly _parserAssembly;
static Assembly ParserAssembly()
{
return _parserAssembly ?? (_parserAssembly = FindParserAssembly());
}
private static Assembly FindParserAssembly()
{
var thisLocation = Permissions.WithDiscoveryPermission(() => ThisAssembly().Location) ?? "";
if (string.IsNullOrEmpty(thisLocation))
return LoadParserAssemblyByName();
var parserLocation = thisLocation.EndsWith("Boo.Lang.Compiler.dll", StringComparison.OrdinalIgnoreCase)
? thisLocation.Substring(0, thisLocation.Length - "Boo.Lang.Compiler.dll".Length) + "Boo.Lang.Parser.dll"
: "";
return File.Exists(parserLocation) ? Assembly.LoadFrom(parserLocation) : LoadParserAssemblyByName();
}
private static Assembly LoadParserAssemblyByName()
{
return Assembly.Load(ThisAssembly().FullName.Replace("Boo.Lang.Compiler", "Boo.Lang.Parser"));
}
private static Assembly ThisAssembly()
{
return typeof(Parsing).Assembly;
}
}
}
| using System;
using System.IO;
using System.Reflection;
using Boo.Lang.Compiler.Util;
using Boo.Lang.Environments;
namespace Boo.Lang.Compiler.Steps
{
public class Parsing : ICompilerStep
{
private ICompilerStep _parser;
public void Initialize(CompilerContext context)
{
Parser.Initialize(context);
}
public void Run()
{
Parser.Run();
}
public void Dispose()
{
if (_parser != null)
{
_parser.Dispose();
_parser = null;
}
}
private ICompilerStep Parser
{
get { return (_parser ?? (_parser = NewParserStep())); }
}
static ICompilerStep NewParserStep()
{
return (ICompilerStep)Activator.CreateInstance(ConfiguredParserType);
}
private static Type ConfiguredParserType
{
get
{
var parserType = My<CompilerParameters>.Instance.WhiteSpaceAgnostic ? "Boo.Lang.Parser.WSABooParsingStep" : "Boo.Lang.Parser.BooParsingStep";
return ParserAssembly().GetType(parserType, true);
}
}
static Assembly _parserAssembly;
static Assembly ParserAssembly()
{
return _parserAssembly ?? (_parserAssembly = FindParserAssembly());
}
private static Assembly FindParserAssembly()
{
var thisLocation = Permissions.WithDiscoveryPermission(() => ThisAssembly().Location) ?? "";
if (string.IsNullOrEmpty(thisLocation))
return LoadParserAssemblyByName();
var parserLocation = thisLocation.EndsWith("Boo.Lang.Compiler.dll")
? thisLocation.Substring(0, thisLocation.Length - "Boo.Lang.Compiler.dll".Length) + "Boo.Lang.Parser.dll"
: "";
return File.Exists(parserLocation) ? Assembly.LoadFrom(parserLocation) : LoadParserAssemblyByName();
}
private static Assembly LoadParserAssemblyByName()
{
return Assembly.Load(ThisAssembly().FullName.Replace("Boo.Lang.Compiler", "Boo.Lang.Parser"));
}
private static Assembly ThisAssembly()
{
return typeof(Parsing).Assembly;
}
}
}
| bsd-3-clause | C# |
9bc830cacc57dd6e197e3235df614d70419d8250 | Fix error with merge on TModLoader GameState. | antonpup/Aurora,antonpup/Aurora,antonpup/Aurora,antonpup/Aurora,antonpup/Aurora | Project-Aurora/Project-Aurora/Profiles/TModLoader/GSI/GameState_TModLoader.cs | Project-Aurora/Project-Aurora/Profiles/TModLoader/GSI/GameState_TModLoader.cs | using Aurora.Profiles.Generic.GSI.Nodes;
using Aurora.Profiles.TModLoader.GSI.Nodes;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aurora.Profiles.TModLoader.GSI {
public class GameState_TModLoader : GameState {
public ProviderNode Provider => NodeFor<ProviderNode>("provider");
public WorldNode World => NodeFor<WorldNode>("world");
public PlayerNode Player => NodeFor<PlayerNode>("player");
public GameState_TModLoader() : base() { }
/// <summary>
/// Creates a GameState_Terraria instance based on the passed JSON data.
/// </summary>
/// <param name="JSONstring"></param>
public GameState_TModLoader(string JSONstring) : base(JSONstring) { }
}
}
| using Aurora.Profiles.Generic.GSI.Nodes;
using Aurora.Profiles.TModLoader.GSI.Nodes;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aurora.Profiles.TModLoader.GSI {
public class GameState_TModLoader : GameState<GameState_TModLoader> {
public ProviderNode Provider => NodeFor<ProviderNode>("provider");
public WorldNode World => NodeFor<WorldNode>("world");
public PlayerNode Player => NodeFor<PlayerNode>("player");
public GameState_TModLoader() : base() { }
/// <summary>
/// Creates a GameState_Terraria instance based on the passed JSON data.
/// </summary>
/// <param name="JSONstring"></param>
public GameState_TModLoader(string JSONstring) : base(JSONstring) { }
}
}
| mit | C# |
cdf6d3dc86ffb6069a3181c26e07b942dbda7580 | Improve AppModel | sakapon/Tools-2015 | PlanetClock/PlanetClock/AppModel.cs | PlanetClock/PlanetClock/AppModel.cs | using System;
using System.Collections.Generic;
using System.Linq;
using KLibrary.Labs.Reactive;
using KLibrary.Labs.Reactive.Models;
namespace PlanetClock
{
public class AppModel
{
public IObservable<DateTime> JustMinutesArrived { get; private set; }
public IObservableGetProperty<DateTime> JustMinutes { get; private set; }
public IObservableGetProperty<int> Hour { get; private set; }
public IObservableGetProperty<int> Minute { get; private set; }
public AppModel()
{
var initialTime = DateTime.Now;
JustMinutesArrived = new PeriodicTimer2(TimeSpan.FromMinutes(1), () => GetNextJustTime(initialTime));
JustMinutes = JustMinutesArrived.ToGetProperty(GetJustTime(initialTime));
Hour = JustMinutesArrived
.Map(dt => dt.Hour)
.ToGetProperty(initialTime.Hour);
Minute = JustMinutesArrived
.Map(dt => dt.Minute)
.ToGetProperty(initialTime.Minute);
}
static DateTime GetJustTime(DateTime dt)
{
return new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0);
}
static DateTime GetNextJustTime(DateTime dt)
{
return GetJustTime(dt.AddMinutes(1));
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using KLibrary.Labs.Reactive;
using KLibrary.Labs.Reactive.Models;
namespace PlanetClock
{
public class AppModel
{
public IObservable<DateTime> JustMinutesArrived { get; private set; }
public IObservableGetProperty<int> Hour { get; private set; }
public IObservableGetProperty<int> Minute { get; private set; }
public AppModel()
{
JustMinutesArrived = new PeriodicTimer2(TimeSpan.FromMinutes(1), GetNextJustTime);
Hour = JustMinutesArrived
.Map(dt => dt.Hour)
.ToGetProperty(DateTime.Now.Hour);
Minute = JustMinutesArrived
.Map(dt => dt.Minute)
.ToGetProperty(DateTime.Now.Minute);
}
static DateTime GetNextJustTime()
{
var n = DateTime.Now.AddMinutes(1);
return new DateTime(n.Year, n.Month, n.Day, n.Hour, n.Minute, 0);
}
}
}
| mit | C# |
45d33a39244642d69fcad9ebb7cee5e9f835cf34 | Update version | Weingartner/XUnitRemote | XUnitRemote/Properties/AssemblyInfo.cs | XUnitRemote/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("XUnitRemote")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weingartner")]
[assembly: AssemblyProduct("XUnitRemote")]
[assembly: AssemblyCopyright("Copyright © Weingartner Machinenbau Gmbh 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21248cf4-3629-4cfa-8632-9e4468a0526e")]
// 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.14")]
[assembly: AssemblyFileVersion("1.0.0.14")]
| 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("XUnitRemote")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weingartner")]
[assembly: AssemblyProduct("XUnitRemote")]
[assembly: AssemblyCopyright("Copyright © Weingartner Machinenbau Gmbh 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21248cf4-3629-4cfa-8632-9e4468a0526e")]
// 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.13")]
[assembly: AssemblyFileVersion("1.0.0.13")]
| mit | C# |
e0e7d1b9904b2e055a6c0ef77cf54f4b66f51c13 | set synced rev. nr. in assembly info | dawidcieszynski/ZXing.Net,dawidcieszynski/ZXing.Net | Source/lib/Properties/AssemblyInfo.cs | Source/lib/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.
#if NET20
[assembly: AssemblyTitle("zxing.net for .net 2.0")]
#endif
#if NET40
[assembly: AssemblyTitle("zxing.net for .net 4.0")]
#endif
#if SILVERLIGHT4
[assembly: AssemblyTitle("zxing.net for silverlight 4")]
#endif
#if WINDOWS_PHONE70
[assembly: AssemblyTitle("zxing.net for windows phone 7.0")]
#endif
#if WINDOWS_PHONE71
[assembly: AssemblyTitle("zxing.net for windows phone 7.1")]
#endif
[assembly: AssemblyDescription("port of the java based barcode scanning library for .net (java zxing rev. 2196)")]
[assembly: AssemblyCompany("ZXing.Net Developement")]
[assembly: AssemblyProduct("ZXing.Net")]
[assembly: AssemblyCopyright("Copyright 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: Guid("ECE3AB74-9DD1-4CFB-9D48-FCBFB30E06D6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Revision
// Build Number
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: InternalsVisibleTo("zxing.test, PublicKey=0024000004800000140100000602000000240000525341310008000001000100014c9a01956f13a339130616473f69f975e086d9a3a56278936b12c48ca45a4ddfee05c21cdc22aedd84e9468283127a20bba4761c4e0d9836623fc991d562a508845fe314a435bd6c6ff4b0b1d7a141ef93dc1c62252438723f0f93668288673ea6042e583b0eed040e3673aca584f96d4dca19937fbed30e6cd3c0409db82d5c5d2067710d8d86e008447201d99238b94d91171bb0edf3e854985693051ba5167ca6ae650aca5dd65471d68835db00ce1728c58c7bbf9a5d152f491123caf9c0f686dc4e48e1ef63eaf738a12b3771c24d595cc5a5b5daf2cc7611756e9ba3cc89f08fb9adf39685bd5356858c010eb9aa8a767e5ef020408e0c9746cbb5a8")] | 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.
#if NET20
[assembly: AssemblyTitle("zxing.net for .net 2.0")]
#endif
#if NET40
[assembly: AssemblyTitle("zxing.net for .net 4.0")]
#endif
#if SILVERLIGHT4
[assembly: AssemblyTitle("zxing.net for silverlight 4")]
#endif
#if WINDOWS_PHONE70
[assembly: AssemblyTitle("zxing.net for windows phone 7.0")]
#endif
#if WINDOWS_PHONE71
[assembly: AssemblyTitle("zxing.net for windows phone 7.1")]
#endif
[assembly: AssemblyDescription("port of the java based barcode scanning library for .net (java zxing rev. 2181)")]
[assembly: AssemblyCompany("ZXing.Net Developement")]
[assembly: AssemblyProduct("ZXing.Net")]
[assembly: AssemblyCopyright("Copyright 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: Guid("ECE3AB74-9DD1-4CFB-9D48-FCBFB30E06D6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Revision
// Build Number
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: InternalsVisibleTo("zxing.test, PublicKey=0024000004800000140100000602000000240000525341310008000001000100014c9a01956f13a339130616473f69f975e086d9a3a56278936b12c48ca45a4ddfee05c21cdc22aedd84e9468283127a20bba4761c4e0d9836623fc991d562a508845fe314a435bd6c6ff4b0b1d7a141ef93dc1c62252438723f0f93668288673ea6042e583b0eed040e3673aca584f96d4dca19937fbed30e6cd3c0409db82d5c5d2067710d8d86e008447201d99238b94d91171bb0edf3e854985693051ba5167ca6ae650aca5dd65471d68835db00ce1728c58c7bbf9a5d152f491123caf9c0f686dc4e48e1ef63eaf738a12b3771c24d595cc5a5b5daf2cc7611756e9ba3cc89f08fb9adf39685bd5356858c010eb9aa8a767e5ef020408e0c9746cbb5a8")] | apache-2.0 | C# |
138969b6327747e9bd5d3b789b46973b60f258da | Update AssemblyInfo.cs | fredatgithub/UsefulFunctions | XUnitTests/Properties/AssemblyInfo.cs | XUnitTests/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("XUnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Freddy Juhel")]
[assembly: AssemblyProduct("XUnitTests")]
[assembly: AssemblyCopyright("Copyright © Freddy Juhel MIT 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("92e97b44-5dd3-4cdc-8468-6a2559e5e71b")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("XUnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hewlett-Packard Company")]
[assembly: AssemblyProduct("XUnitTests")]
[assembly: AssemblyCopyright("Copyright © Hewlett-Packard Company 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("92e97b44-5dd3-4cdc-8468-6a2559e5e71b")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
4380009ca58cb70576559cfae0c655c75b7d715a | Test updated with cases | techphernalia/MyPersonalAccounts | TestController/Program.cs | TestController/Program.cs | using com.techphernalia.MyPersonalAccounts.Controller;
using com.techphernalia.MyPersonalAccounts.Model.Controller;
using com.techphernalia.MyPersonalAccounts.Model.Inventory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TestController
{
class Program
{
static void Main(string[] args)
{
IInventoryController controller = new InventoryController();
Print(controller.GetAllStockGroups());
Print(controller.GetAllStockItems());
Print(controller.GetAllStockUnits());
Console.Write("Press any key to exit...");
Console.ReadLine();
}
public static void Print(IEnumerable<object> items)
{
foreach(var i in items)
{
Console.WriteLine(i);
}
}
}
}
| using com.techphernalia.MyPersonalAccounts.Controller;
using com.techphernalia.MyPersonalAccounts.Model.Controller;
using com.techphernalia.MyPersonalAccounts.Model.Inventory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TestController
{
class Program
{
static void Main(string[] args)
{
IInventoryController controller = new InventoryController();
//controller.AddStockUnit(new StockUnit { StockUnitName = "_Primary", StockUnitSymbol = "" , StockUnitDecimalPlaces = 0 });
Print(controller.GetAllStockUnits());
Print(controller.GetAllStockItems());
Print(controller.GetAllStockGroups());
Console.Write("Press any key to exit...");
Console.ReadLine();
}
public static void Print(IEnumerable<object> items)
{
foreach(var i in items)
{
Console.WriteLine(i);
}
}
}
}
| mit | C# |
9b3afdfca1db4a1a204d8c0fb472cab102b0ee0e | Switch the settings back for the mobile site. Fix this later | GeraldBecker/TechProFantasySoccer,GeraldBecker/TechProFantasySoccer,GeraldBecker/TechProFantasySoccer | TechProFantasySoccer/TechProFantasySoccer/App_Start/RouteConfig.cs | TechProFantasySoccer/TechProFantasySoccer/App_Start/RouteConfig.cs | using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Routing;
using Microsoft.AspNet.FriendlyUrls;
namespace TechProFantasySoccer
{
public static class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
var settings = new FriendlyUrlSettings();
settings.AutoRedirectMode = RedirectMode.Permanent;
routes.EnableFriendlyUrls(settings);
//Commenting the above code and using the below line gets rid of the master mobile site.
//routes.EnableFriendlyUrls();
}
}
}
| using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Routing;
using Microsoft.AspNet.FriendlyUrls;
namespace TechProFantasySoccer
{
public static class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
/*var settings = new FriendlyUrlSettings();
settings.AutoRedirectMode = RedirectMode.Permanent;
routes.EnableFriendlyUrls(settings);*/
//Commenting the above code and using the below line gets rid of the master mobile site.
routes.EnableFriendlyUrls();
}
}
}
| mit | C# |
87739e013cbe8df13ecc1fe69eef8f12d85272be | fix example static handler | zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,303248153/ZKWeb,zkweb-framework/ZKWeb | Tools/Templates/BootstrapPlugin/src/Controllers/HelloController.cs | Tools/Templates/BootstrapPlugin/src/Controllers/HelloController.cs | using ZKWeb;
using ZKWeb.Storage;
using ZKWeb.Web;
using ZKWeb.Web.ActionResults;
using ZKWebStandard.Extensions;
using ZKWebStandard.Utils;
using ZKWebStandard.Web;
namespace ${ProjectName}.Plugins.${ProjectName}.src.Controllers {
/// <summary>
/// Example controller only for learning, delete it if you don't need
/// </summary>
public class HelloController : IController {
[Action("/")]
public IActionResult Index() {
return new TemplateResult("${ProjectNameLower}/hello.html", new { text = "World" });
}
[Action("/hello")]
public IActionResult Hello() {
return new PlainResult("Hello World In Plain Text");
}
}
/// <summary>
/// Static file handler, delete it if you are already use default plugin collections
/// </summary>
public class HelloStaticHandler : IHttpRequestHandler {
public const string Prefix = "/static/";
public void OnRequest() {
var context = HttpManager.CurrentContext;
var path = context.Request.Path;
if (path.StartsWith(Prefix)) {
var fileStorage = Application.Ioc.Resolve<IFileStorage>();
var subPath = HttpUtils.UrlDecode(path.Substring(Prefix.Length));
var fileEntry = fileStorage.GetResourceFile("static", subPath);
if (fileEntry.Exists) {
var ifModifiedSince = context.Request.GetIfModifiedSince();
new FileEntryResult(fileEntry, ifModifiedSince).WriteResponse(context.Response);
context.Response.End();
}
}
}
}
}
| using ZKWeb;
using ZKWeb.Storage;
using ZKWeb.Web;
using ZKWeb.Web.ActionResults;
using ZKWebStandard.Extensions;
using ZKWebStandard.Web;
namespace ${ProjectName}.Plugins.${ProjectName}.src.Controllers {
/// <summary>
/// Example controller only for learning, delete it if you don't need
/// </summary>
public class HelloController : IController {
[Action("/")]
public IActionResult Index() {
return new TemplateResult("${ProjectNameLower}/hello.html", new { text = "World" });
}
[Action("/hello")]
public IActionResult Hello() {
return new PlainResult("Hello World In Plain Text");
}
}
/// <summary>
/// Static file handler, delete it if you are already use default plugin collections
/// </summary>
public class HelloStaticHandler : IHttpRequestHandler {
public const string Prefix = "/static/";
public void OnRequest() {
var context = HttpManager.CurrentContext;
var path = context.Request.Path;
if (path.StartsWith(Prefix)) {
var fileStorage = Application.Ioc.Resolve<IFileStorage>();
var fileEntry = fileStorage.GetResourceFile("static", path.Substring(Prefix.Length));
if (fileEntry.Exists) {
var ifModifiedSince = context.Request.GetIfModifiedSince();
new FileEntryResult(fileEntry, ifModifiedSince).WriteResponse(context.Response);
context.Response.End();
}
}
}
}
}
| mit | C# |
6d69e97527a9e5c5120d4238324ddd3781d2cb00 | Fix #3330 Add additional translog properties as per elastic/elasticsearch#28613… (#3358) | elastic/elasticsearch-net,elastic/elasticsearch-net | src/Nest/CommonOptions/Stats/TranslogStats.cs | src/Nest/CommonOptions/Stats/TranslogStats.cs | using Newtonsoft.Json;
namespace Nest
{
[JsonObject]
public class TranslogStats
{
[JsonProperty("operations")]
public long Operations { get; set; }
[JsonProperty("uncommitted_operations")]
public int UncommittedOperations { get; set; }
[JsonProperty("size")]
public string Size { get; set; }
[JsonProperty("size_in_bytes")]
public long SizeInBytes { get; set; }
[JsonProperty("uncommitted_size")]
public string UncommittedSize { get; set; }
[JsonProperty("uncommitted_size_in_bytes")]
public long UncommittedSizeInBytes { get; set; }
/// <remarks>
/// Valid only for Elasticsearch 6.3.0+
/// </remarks>
[JsonProperty("earliest_last_modified_age")]
public long EarliestLastModifiedAge { get; set; }
}
}
| using Newtonsoft.Json;
namespace Nest
{
[JsonObject]
public class TranslogStats
{
[JsonProperty("operations")]
public long Operations { get; set; }
[JsonProperty("size")]
public string Size { get; set; }
[JsonProperty("size_in_bytes")]
public long SizeInBytes { get; set; }
}
} | apache-2.0 | C# |
0d06f35fdd744a49dbf36bd5f924a52df95ad997 | add namespace | hitesh97/omnisharp-roslyn,haled/omnisharp-roslyn,ChrisHel/omnisharp-roslyn,khellang/omnisharp-roslyn,haled/omnisharp-roslyn,david-driscoll/omnisharp-roslyn,sriramgd/omnisharp-roslyn,david-driscoll/omnisharp-roslyn,ianbattersby/omnisharp-roslyn,jtbm37/omnisharp-roslyn,xdegtyarev/omnisharp-roslyn,fishg/omnisharp-roslyn,sriramgd/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,nabychan/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,hach-que/omnisharp-roslyn,RichiCoder1/omnisharp-roslyn,hal-ler/omnisharp-roslyn,jtbm37/omnisharp-roslyn,sreal/omnisharp-roslyn,khellang/omnisharp-roslyn,RichiCoder1/omnisharp-roslyn,nabychan/omnisharp-roslyn,sreal/omnisharp-roslyn,hitesh97/omnisharp-roslyn,xdegtyarev/omnisharp-roslyn,hal-ler/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,ChrisHel/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,ianbattersby/omnisharp-roslyn,hach-que/omnisharp-roslyn,fishg/omnisharp-roslyn | src/OmniSharp/MSBuild/SolutionPickerResult.cs | src/OmniSharp/MSBuild/SolutionPickerResult.cs | namespace OmniSharp.MSBuild
{
public class SolutionPickerResult
{
public SolutionPickerResult(string solution, string message = null)
{
Solution = solution;
Message = message;
}
public string Solution { get; private set; }
public string Message { get; private set; }
}
} | public class SolutionPickerResult
{
public SolutionPickerResult(string solution, string message = null)
{
Solution = solution;
Message = message;
}
public string Solution { get; private set; }
public string Message { get; private set; }
} | mit | C# |
e6c3f72d32df17e8a1e49940f4797fca28a49479 | Remove unnecessary Reverse() method in simple-linked-list | GKotfis/csharp,robkeim/xcsharp,exercism/xcsharp,robkeim/xcsharp,ErikSchierboom/xcsharp,ErikSchierboom/xcsharp,exercism/xcsharp,GKotfis/csharp | exercises/simple-linked-list/Example.cs | exercises/simple-linked-list/Example.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class SimpleLinkedList<T> : IEnumerable<T>
{
public SimpleLinkedList(T value) :
this(new[] { value })
{
}
public SimpleLinkedList(IEnumerable<T> values)
{
var array = values.ToArray();
if (array.Length == 0)
{
throw new ArgumentException("Cannot create tree from empty list");
}
Value = array[0];
Next = null;
foreach (var value in array.Skip(1))
{
Add(value);
}
}
public T Value { get; }
public SimpleLinkedList<T> Next { get; private set; }
public SimpleLinkedList<T> Add(T value)
{
var last = this;
while (last.Next != null)
{
last = last.Next;
}
last.Next = new SimpleLinkedList<T>(value);
return this;
}
public IEnumerator<T> GetEnumerator()
{
yield return Value;
foreach (var next in Next?.AsEnumerable() ?? Enumerable.Empty<T>())
{
yield return next;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
} | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class SimpleLinkedList<T> : IEnumerable<T>
{
public SimpleLinkedList(T value) :
this(new[] { value })
{
}
public SimpleLinkedList(IEnumerable<T> values)
{
var array = values.ToArray();
if (array.Length == 0)
{
throw new ArgumentException("Cannot create tree from empty list");
}
Value = array[0];
Next = null;
foreach (var value in array.Skip(1))
{
Add(value);
}
}
public T Value { get; }
public SimpleLinkedList<T> Next { get; private set; }
public SimpleLinkedList<T> Add(T value)
{
var last = this;
while (last.Next != null)
{
last = last.Next;
}
last.Next = new SimpleLinkedList<T>(value);
return this;
}
public SimpleLinkedList<T> Reverse()
{
return new SimpleLinkedList<T>(this.AsEnumerable().Reverse());
}
public IEnumerator<T> GetEnumerator()
{
yield return Value;
foreach (var next in Next?.AsEnumerable() ?? Enumerable.Empty<T>())
{
yield return next;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
} | mit | C# |
fabb0eeb29a35c7e0d212d9c7be9f1aad8e90c35 | Add signalr messagepack key attribute | peppy/osu,peppy/osu,peppy/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu-new,smoogipoo/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu | osu.Game/Online/Rooms/BeatmapAvailability.cs | osu.Game/Online/Rooms/BeatmapAvailability.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 MessagePack;
using Newtonsoft.Json;
namespace osu.Game.Online.Rooms
{
/// <summary>
/// The local availability information about a certain beatmap for the client.
/// </summary>
[MessagePackObject]
public class BeatmapAvailability : IEquatable<BeatmapAvailability>
{
/// <summary>
/// The beatmap's availability state.
/// </summary>
[Key(0)]
public readonly DownloadState State;
/// <summary>
/// The beatmap's downloading progress, null when not in <see cref="DownloadState.Downloading"/> state.
/// </summary>
[Key(1)]
public readonly float? DownloadProgress;
[JsonConstructor]
private BeatmapAvailability(DownloadState state, float? downloadProgress = null)
{
State = state;
DownloadProgress = downloadProgress;
}
public static BeatmapAvailability NotDownloaded() => new BeatmapAvailability(DownloadState.NotDownloaded);
public static BeatmapAvailability Downloading(float progress) => new BeatmapAvailability(DownloadState.Downloading, progress);
public static BeatmapAvailability Importing() => new BeatmapAvailability(DownloadState.Importing);
public static BeatmapAvailability LocallyAvailable() => new BeatmapAvailability(DownloadState.LocallyAvailable);
public bool Equals(BeatmapAvailability other) => other != null && State == other.State && DownloadProgress == other.DownloadProgress;
public override string ToString() => $"{string.Join(", ", State, $"{DownloadProgress:0.00%}")}";
}
}
| // 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 MessagePack;
using Newtonsoft.Json;
namespace osu.Game.Online.Rooms
{
/// <summary>
/// The local availability information about a certain beatmap for the client.
/// </summary>
[MessagePackObject]
public class BeatmapAvailability : IEquatable<BeatmapAvailability>
{
/// <summary>
/// The beatmap's availability state.
/// </summary>
[Key(0)]
public readonly DownloadState State;
/// <summary>
/// The beatmap's downloading progress, null when not in <see cref="DownloadState.Downloading"/> state.
/// </summary>
public readonly float? DownloadProgress;
[JsonConstructor]
private BeatmapAvailability(DownloadState state, float? downloadProgress = null)
{
State = state;
DownloadProgress = downloadProgress;
}
public static BeatmapAvailability NotDownloaded() => new BeatmapAvailability(DownloadState.NotDownloaded);
public static BeatmapAvailability Downloading(float progress) => new BeatmapAvailability(DownloadState.Downloading, progress);
public static BeatmapAvailability Importing() => new BeatmapAvailability(DownloadState.Importing);
public static BeatmapAvailability LocallyAvailable() => new BeatmapAvailability(DownloadState.LocallyAvailable);
public bool Equals(BeatmapAvailability other) => other != null && State == other.State && DownloadProgress == other.DownloadProgress;
public override string ToString() => $"{string.Join(", ", State, $"{DownloadProgress:0.00%}")}";
}
}
| mit | C# |
9b66fcc5e62ca801a814743aca6f224df85fd6bc | Disable timestamp check for now | anilmujagic/DeploymentCockpit,anilmujagic/DeploymentCockpit,anilmujagic/DeploymentCockpit | src/DeploymentCockpit.BusinessLogic/ScriptExecution/TargetCommandProcessor.cs | src/DeploymentCockpit.BusinessLogic/ScriptExecution/TargetCommandProcessor.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DeploymentCockpit.Common;
using DeploymentCockpit.Interfaces;
using DeploymentCockpit.Models;
using Insula.Common;
using Newtonsoft.Json;
using ZeroMQ;
namespace DeploymentCockpit.ScriptExecution
{
public class TargetCommandProcessor : ITargetCommandProcessor
{
private readonly IScriptRunner _scriptRunner;
public TargetCommandProcessor(IScriptRunner scriptRunner)
{
if (scriptRunner == null)
throw new ArgumentNullException("scriptRunner");
_scriptRunner = scriptRunner;
}
public void ProcessCommand()
{
var ipAddress = DomainContext.IPAddress;
if (ipAddress.IsNullOrWhiteSpace())
ipAddress = "*"; // Bind to all interfaces
var portNumber = DomainContext.PortNumber;
var endpoint = "tcp://{0}:{1}".FormatString(ipAddress, portNumber);
var encriptionKey = DomainContext.TargetKey;
var encriptionSalt = DomainContext.ServerKey;
using (var context = ZmqContext.Create())
{
using (var socket = context.CreateSocket(SocketType.REP))
{
socket.Bind(endpoint);
var encryptedJson = socket.Receive(Encoding.UTF8);
var json = EncryptionHelper.Decrypt(encryptedJson, encriptionKey, encriptionSalt);
var command = JsonConvert.DeserializeObject<ScriptExecutionCommand>(json);
// if (command.CommandTime.AddSeconds(60) < DateTime.UtcNow)
// throw new TimeoutException(); // To prevent re-execution of script by using sniffed packet.
#if DEBUG
Console.WriteLine("Executing {0} script.", command.ScriptType);
#endif
var output = _scriptRunner.Run(command.ScriptBody, command.ScriptType.ToEnum<ScriptType>());
var encryptedOutput = EncryptionHelper.Encrypt(output, encriptionKey, encriptionSalt);
socket.Send(encryptedOutput, Encoding.UTF8);
}
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DeploymentCockpit.Common;
using DeploymentCockpit.Interfaces;
using DeploymentCockpit.Models;
using Insula.Common;
using Newtonsoft.Json;
using ZeroMQ;
namespace DeploymentCockpit.ScriptExecution
{
public class TargetCommandProcessor : ITargetCommandProcessor
{
private readonly IScriptRunner _scriptRunner;
public TargetCommandProcessor(IScriptRunner scriptRunner)
{
if (scriptRunner == null)
throw new ArgumentNullException("scriptRunner");
_scriptRunner = scriptRunner;
}
public void ProcessCommand()
{
var ipAddress = DomainContext.IPAddress;
if (ipAddress.IsNullOrWhiteSpace())
ipAddress = "*"; // Bind to all interfaces
var portNumber = DomainContext.PortNumber;
var endpoint = "tcp://{0}:{1}".FormatString(ipAddress, portNumber);
var encriptionKey = DomainContext.TargetKey;
var encriptionSalt = DomainContext.ServerKey;
using (var context = ZmqContext.Create())
{
using (var socket = context.CreateSocket(SocketType.REP))
{
socket.Bind(endpoint);
var encryptedJson = socket.Receive(Encoding.UTF8);
var json = EncryptionHelper.Decrypt(encryptedJson, encriptionKey, encriptionSalt);
var command = JsonConvert.DeserializeObject<ScriptExecutionCommand>(json);
if (command.CommandTime.AddSeconds(60) < DateTime.UtcNow)
throw new TimeoutException(); // To prevent re-execution of script by using sniffed packet.
#if DEBUG
Console.WriteLine("Executing {0} script.", command.ScriptType);
#endif
var output = _scriptRunner.Run(command.ScriptBody, command.ScriptType.ToEnum<ScriptType>());
var encryptedOutput = EncryptionHelper.Encrypt(output, encriptionKey, encriptionSalt);
socket.Send(encryptedOutput, Encoding.UTF8);
}
}
}
}
}
| apache-2.0 | C# |
5860bacf5bcf29d14532094d9226b0a3fc3fe660 | Use Log.Logger in sample to allow flush | serilog/serilog-sinks-elmahio | examples/Serilog.Sinks.ElmahIo.Example/Program.cs | examples/Serilog.Sinks.ElmahIo.Example/Program.cs | // Copyright 2014 Serilog Contributors
//
// 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 Serilog.Context;
namespace Serilog.Sinks.ElmahIo.Example
{
public class Program
{
static void Main(string[] args)
{
Log.Logger =
new LoggerConfiguration()
.Enrich.WithProperty("Hello", "World")
.Enrich.FromLogContext()
.WriteTo.ElmahIo(new ElmahIoSinkOptions
{
ApiKey = "API_KEY",
LogId = new Guid("LOG_ID"),
})
.CreateLogger();
using (LogContext.PushProperty("LogContext property", "with some value"))
{
Log.Error("This is a log message with a {TypeOfProperty} message", "structured");
}
try
{
var i = 0;
var result = 42 / i;
}
catch (Exception e)
{
Log.Error(e, "Some exception");
}
Log.Information("A message with {type} {hostname} {application} {user} {source} {method} {version} {url} and {statusCode}",
"custom type", "custom hostname", "custom application", "custom user", "custom source", "custom method",
"custom version", "custom url", 500);
// Make sure to emit any batched messages not already sent to elmah.io.
Log.CloseAndFlush();
}
}
}
| // Copyright 2014 Serilog Contributors
//
// 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 Serilog.Context;
namespace Serilog.Sinks.ElmahIo.Example
{
public class Program
{
static void Main(string[] args)
{
var logger =
new LoggerConfiguration()
.Enrich.WithProperty("Hello", "World")
.Enrich.FromLogContext()
.WriteTo.ElmahIo(new ElmahIoSinkOptions
{
ApiKey = "API_KEY",
LogId = new Guid("LOG_ID"),
})
.CreateLogger();
using (LogContext.PushProperty("LogContext property", "with some value"))
{
logger.Error("This is a log message with a {TypeOfProperty} message", "structured");
}
try
{
var i = 0;
var result = 42 / i;
}
catch (Exception e)
{
logger.Error(e, "Some exception");
}
logger.Information("A message with {type} {hostname} {application} {user} {source} {method} {version} {url} and {statusCode}",
"custom type", "custom hostname", "custom application", "custom user", "custom source", "custom method",
"custom version", "custom url", 500);
Console.WriteLine("Wait 5 seconds and press any key to exit.");
Console.ReadKey();
}
}
}
| apache-2.0 | C# |
b406ab3eea9a36c5369eba81417af7899c3d0ac5 | Use smaller epub for saving test, so that online validators accept the size. | Asido/EpubSharp,pgung/EpubSharp | EpubSharp.Tests/EpubWriterTests.cs | EpubSharp.Tests/EpubWriterTests.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace EpubSharp.Tests
{
[TestClass]
public class EpubWriterTests
{
[TestMethod]
public void SaveTest()
{
var book = EpubReader.Read(@"../../Samples/epub-assorted/Inversions - Iain M. Banks.epub");
var writer = new EpubWriter(book);
writer.Save("saved.epub");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace EpubSharp.Tests
{
[TestClass]
public class EpubWriterTests
{
[TestMethod]
public void SaveTest()
{
var book = EpubReader.Read(@"../../Samples/epub-assorted/iOS Hackers Handbook.epub");
var writer = new EpubWriter(book);
writer.Save("saved.epub");
}
}
}
| mpl-2.0 | C# |
e490dda060f7185f727cdd14892658d6909471fb | Update ReceiveWalletActionViewModel.cs | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/ViewModels/Wallets/Actions/ReceiveWalletActionViewModel.cs | WalletWasabi.Fluent/ViewModels/Wallets/Actions/ReceiveWalletActionViewModel.cs | using WalletWasabi.Fluent.ViewModels.NavBar;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Actions
{
[NavigationMetaData(
Title = "Receive",
Caption = "",
IconName = "wallet_action_receive",
NavBarPosition = NavBarPosition.None,
Searchable = false,
NavigationTarget = NavigationTarget.DialogScreen)]
public partial class ReceiveWalletActionViewModel : WalletActionViewModel
{
public ReceiveWalletActionViewModel(WalletViewModelBase wallet) : base(wallet)
{
Title = "Receive";
SelectionMode = NavBarItemSelectionMode.Button;
}
}
} | namespace WalletWasabi.Fluent.ViewModels.Wallets.Actions
{
[NavigationMetaData(
Title = "Receive",
Caption = "",
IconName = "wallet_action_receive",
NavBarPosition = NavBarPosition.None,
Searchable = false,
NavigationTarget = NavigationTarget.HomeScreen)]
public partial class ReceiveWalletActionViewModel : WalletActionViewModel
{
public ReceiveWalletActionViewModel(WalletViewModelBase wallet) : base(wallet)
{
Title = "Receive";
SelectionMode = NavBarItemSelectionMode.Button;
}
}
} | mit | C# |
e5105d0534ccea3f019cc9550565ad321172c611 | Fix a typo | riganti/dotvvm-samples-academy,riganti/dotvvm-samples-academy,riganti/dotvvm-samples-academy | DotvvmAcademy/DotvvmAcademy.Validation/Unit/IValidationUnit.cs | DotvvmAcademy/DotvvmAcademy.Validation/Unit/IValidationUnit.cs | namespace DotvvmAcademy.Validation.Unit
{
/// <summary>
/// A unit of validation.
/// </summary>
/// <remarks>
/// A Validation Method is given an <see cref="IValidationUnit"/> as a parameter.
/// </remarks>
public interface IValidationUnit
{
}
} | namespace DotvvmAcademy.Validation.Unit
{
/// <summary>
/// A unit of validation.
/// </summary>
/// <remarks>
/// A Validation Method is given a <see cref="IValidationUnit"/> as a parameter.
/// </remarks>
public interface IValidationUnit
{
}
} | apache-2.0 | C# |
26bdeb4822a854dc3559edba7ed774f44b32ba86 | Change class name | mattyway/Hangfire.Autofac,HangfireIO/Hangfire.Autofac | HangFire.Autofac/AutofacBootstrapperConfigurationExtensions.cs | HangFire.Autofac/AutofacBootstrapperConfigurationExtensions.cs | using Autofac;
namespace Hangfire
{
public static class AutofacBootstrapperConfigurationExtensions
{
/// <summary>
/// Tells bootstrapper to use the specified Autofac
/// lifetime scope as a global job activator.
/// </summary>
/// <param name="configuration">Configuration</param>
/// <param name="lifetimeScope">Autofac lifetime scope that will be used to activate jobs</param>
public static void UseAutofacActivator(
this IBootstrapperConfiguration configuration,
ILifetimeScope lifetimeScope)
{
configuration.UseActivator(new AutofacJobActivator(lifetimeScope));
}
}
}
| using Autofac;
namespace Hangfire
{
public static class NinjectBootstrapperConfigurationExtensions
{
/// <summary>
/// Tells bootstrapper to use the specified Autofac
/// lifetime scope as a global job activator.
/// </summary>
/// <param name="configuration">Configuration</param>
/// <param name="lifetimeScope">Autofac lifetime scope that will be used to activate jobs</param>
public static void UseAutofacActivator(
this IBootstrapperConfiguration configuration,
ILifetimeScope lifetimeScope)
{
configuration.UseActivator(new AutofacJobActivator(lifetimeScope));
}
}
}
| mit | C# |
7fd3e5eb823f8eb2b9ff46ce4440c20424454b03 | fix comment doc | tmichel/thesis | Interfaces/DMT.Partition.Interfaces/IPartitionEntityFactory.cs | Interfaces/DMT.Partition.Interfaces/IPartitionEntityFactory.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DMT.Core.Interfaces;
namespace DMT.Partition.Interfaces
{
/// <summary>
/// Entity factory with partition specific entity types.
/// </summary>
public interface IPartitionEntityFactory
{
/// <summary>
/// Creates a ISuperNode object.
/// </summary>
/// <returns></returns>
ISuperNode CreateSuperNode();
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DMT.Core.Interfaces;
namespace DMT.Partition.Interfaces
{
/// <summary>
/// Entity factory with partition specific entity types.
/// </summary>
public interface IPartitionEntityFactory
{
/// <summary>
/// Creates a IMutliNode object.
/// </summary>
/// <returns></returns>
ISuperNode CreateSuperNode();
}
}
| mit | C# |
2f312fd49605bd3f78d916511af0ed833b4240b4 | Remove unused variable | couchbaselabs/GitHubReleaseNotes,couchbaselabs/GitHubReleaseNotes,Particular/GitHubReleaseNotes | src/Tests/ReleaseNotesBuilderTests.cs | src/Tests/ReleaseNotesBuilderTests.cs | namespace ReleaseNotesCompiler.Tests
{
using System.Diagnostics;
using NUnit.Framework;
using ReleaseNotesCompiler;
[TestFixture]
public class ReleaseNotesBuilderTests
{
[Test]
[Explicit]
public async void SingleMilestone()
{
var gitHubClient = ClientBuilder.Build();
var releaseNotesBuilder = new ReleaseNotesBuilder(gitHubClient, "Particular", "NServiceBus", "4.6.5");
var result = await releaseNotesBuilder.BuildReleaseNotes();
Debug.WriteLine(result);
ClipBoardHelper.SetClipboard(result);
}
[Test]
[Explicit]
public async void SingleMilestone3()
{
var gitHubClient = ClientBuilder.Build();
var releaseNotesBuilder = new ReleaseNotesBuilder(gitHubClient, "Particular", "ServiceControl", "1.0.0-Beta4");
var result = await releaseNotesBuilder.BuildReleaseNotes();
Debug.WriteLine(result);
ClipBoardHelper.SetClipboard(result);
}
[Test]
[Explicit]
public void OctokitTests()
{
ClientBuilder.Build();
}
}
}
| namespace ReleaseNotesCompiler.Tests
{
using System.Diagnostics;
using NUnit.Framework;
using ReleaseNotesCompiler;
[TestFixture]
public class ReleaseNotesBuilderTests
{
[Test]
[Explicit]
public async void SingleMilestone()
{
var gitHubClient = ClientBuilder.Build();
var releaseNotesBuilder = new ReleaseNotesBuilder(gitHubClient, "Particular", "NServiceBus", "4.6.5");
var result = await releaseNotesBuilder.BuildReleaseNotes();
Debug.WriteLine(result);
ClipBoardHelper.SetClipboard(result);
}
[Test]
[Explicit]
public async void SingleMilestone3()
{
var gitHubClient = ClientBuilder.Build();
var releaseNotesBuilder = new ReleaseNotesBuilder(gitHubClient, "Particular", "ServiceControl", "1.0.0-Beta4");
var result = await releaseNotesBuilder.BuildReleaseNotes();
Debug.WriteLine(result);
ClipBoardHelper.SetClipboard(result);
}
[Test]
[Explicit]
public void OctokitTests()
{
var gitHubClient = ClientBuilder.Build();
}
}
}
| mit | C# |
5e4484167735f77ef958cabbf30a8b9299909376 | Add documentation for FreeFlyCamera | xfleckx/BeMoBI,xfleckx/BeMoBI | Assets/PhaseSpaceTesting/FreeFlyRiftPSRigid.cs | Assets/PhaseSpaceTesting/FreeFlyRiftPSRigid.cs |
using UnityEngine.Assertions;
/// <summary>
/// This an instance of this class
/// </summary>
public class FreeFlyRiftPSRigid : OWLCustomLRigidController
{
public OVRCameraRig targetCamRig;
public override void Start()
{
if(targetCamRig == null)
targetCamRig = FindObjectOfType<OVRCameraRig>();
Assert.IsNotNull(targetCamRig, "There is no OVRCameraRig Instance in the Scene.");
targetCamRig.UpdatedAnchors += Rig_UpdatedAnchors;
}
/// <summary>
/// This got called after OVR Anchors got all updates from the headset sensors.
/// </summary>
/// <param name="rig"></param>
private void Rig_UpdatedAnchors(OVRCameraRig rig)
{
rig.transform.position = prevPos;
}
/// <summary>
/// Message from Unity got called before the camera gets rendered.
/// </summary>
void OnPreRender()
{
// call right before render as well, to ensure most recent data.
_Update();
}
}
| using UnityEngine;
using System.Collections;
public class FreeFlyRiftPSRigid : OWLRigidController
{
public override void Start()
{
OVRCameraRig rig = FindObjectOfType<OVRCameraRig>();
rig.UpdatedAnchors += Rig_UpdatedAnchors;
}
private void Rig_UpdatedAnchors(OVRCameraRig obj)
{
obj.transform.position = prevPos;
}
//
void OnPreRender()
{
// call right before render as well, to ensure most recent data.
_Update();
}
}
| mit | C# |
68cf269af067a2959685e93111f594fbc29b4377 | Move serviceName to variable - makes for easier debugging | battewr/CefSharp,twxstar/CefSharp,dga711/CefSharp,NumbersInternational/CefSharp,joshvera/CefSharp,battewr/CefSharp,VioletLife/CefSharp,haozhouxu/CefSharp,wangzheng888520/CefSharp,jamespearce2006/CefSharp,gregmartinhtc/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,twxstar/CefSharp,yoder/CefSharp,twxstar/CefSharp,Octopus-ITSM/CefSharp,ITGlobal/CefSharp,zhangjingpu/CefSharp,haozhouxu/CefSharp,illfang/CefSharp,zhangjingpu/CefSharp,rover886/CefSharp,yoder/CefSharp,ruisebastiao/CefSharp,AJDev77/CefSharp,Octopus-ITSM/CefSharp,twxstar/CefSharp,VioletLife/CefSharp,rover886/CefSharp,jamespearce2006/CefSharp,dga711/CefSharp,wangzheng888520/CefSharp,gregmartinhtc/CefSharp,illfang/CefSharp,ruisebastiao/CefSharp,Livit/CefSharp,rlmcneary2/CefSharp,dga711/CefSharp,yoder/CefSharp,haozhouxu/CefSharp,wangzheng888520/CefSharp,NumbersInternational/CefSharp,ITGlobal/CefSharp,Haraguroicha/CefSharp,VioletLife/CefSharp,rover886/CefSharp,battewr/CefSharp,NumbersInternational/CefSharp,AJDev77/CefSharp,windygu/CefSharp,AJDev77/CefSharp,Haraguroicha/CefSharp,Haraguroicha/CefSharp,illfang/CefSharp,rlmcneary2/CefSharp,jamespearce2006/CefSharp,rover886/CefSharp,rlmcneary2/CefSharp,Livit/CefSharp,ITGlobal/CefSharp,zhangjingpu/CefSharp,joshvera/CefSharp,Livit/CefSharp,windygu/CefSharp,ITGlobal/CefSharp,dga711/CefSharp,rlmcneary2/CefSharp,VioletLife/CefSharp,jamespearce2006/CefSharp,gregmartinhtc/CefSharp,illfang/CefSharp,AJDev77/CefSharp,zhangjingpu/CefSharp,Haraguroicha/CefSharp,ruisebastiao/CefSharp,Haraguroicha/CefSharp,gregmartinhtc/CefSharp,wangzheng888520/CefSharp,Octopus-ITSM/CefSharp,joshvera/CefSharp,joshvera/CefSharp,ruisebastiao/CefSharp,NumbersInternational/CefSharp,Octopus-ITSM/CefSharp,battewr/CefSharp,windygu/CefSharp,windygu/CefSharp,haozhouxu/CefSharp,yoder/CefSharp,rover886/CefSharp | CefSharp.BrowserSubprocess/CefRenderProcess.cs | CefSharp.BrowserSubprocess/CefRenderProcess.cs | using CefSharp.Internals;
using System.Collections.Generic;
using System.ServiceModel;
namespace CefSharp.BrowserSubprocess
{
public class CefRenderProcess : CefSubProcess, IRenderProcess
{
private DuplexChannelFactory<IBrowserProcess> channelFactory;
private CefBrowserBase browser;
public CefBrowserBase Browser
{
get { return browser; }
}
public CefRenderProcess(IEnumerable<string> args)
: base(args)
{
}
protected override void DoDispose(bool isDisposing)
{
//DisposeMember(ref renderprocess);
DisposeMember(ref browser);
base.DoDispose(isDisposing);
}
public override void OnBrowserCreated(CefBrowserBase cefBrowserWrapper)
{
browser = cefBrowserWrapper;
if (ParentProcessId == null)
{
return;
}
var serviceName = RenderprocessClientFactory.GetServiceName(ParentProcessId.Value, cefBrowserWrapper.BrowserId);
channelFactory = new DuplexChannelFactory<IBrowserProcess>(
this,
new NetNamedPipeBinding(),
new EndpointAddress(serviceName)
);
channelFactory.Open();
Bind(CreateBrowserProxy().GetRegisteredJavascriptObjects());
}
public object EvaluateScript(int frameId, string script, double timeout)
{
var result = Browser.EvaluateScript(frameId, script, timeout);
return result;
}
public override IBrowserProcess CreateBrowserProxy()
{
return channelFactory.CreateChannel();
}
}
}
| using CefSharp.Internals;
using System.Collections.Generic;
using System.ServiceModel;
namespace CefSharp.BrowserSubprocess
{
public class CefRenderProcess : CefSubProcess, IRenderProcess
{
private DuplexChannelFactory<IBrowserProcess> channelFactory;
private CefBrowserBase browser;
public CefBrowserBase Browser
{
get { return browser; }
}
public CefRenderProcess(IEnumerable<string> args)
: base(args)
{
}
protected override void DoDispose(bool isDisposing)
{
//DisposeMember(ref renderprocess);
DisposeMember(ref browser);
base.DoDispose(isDisposing);
}
public override void OnBrowserCreated(CefBrowserBase cefBrowserWrapper)
{
browser = cefBrowserWrapper;
if (ParentProcessId == null)
{
return;
}
channelFactory = new DuplexChannelFactory<IBrowserProcess>(
this,
new NetNamedPipeBinding(),
new EndpointAddress(RenderprocessClientFactory.GetServiceName(ParentProcessId.Value, cefBrowserWrapper.BrowserId))
);
channelFactory.Open();
Bind(CreateBrowserProxy().GetRegisteredJavascriptObjects());
}
public object EvaluateScript(int frameId, string script, double timeout)
{
var result = Browser.EvaluateScript(frameId, script, timeout);
return result;
}
public override IBrowserProcess CreateBrowserProxy()
{
return channelFactory.CreateChannel();
}
}
}
| bsd-3-clause | C# |
8d5eec9958b9b36ac911f06acc1c8e80233c4736 | Update Index.cshtml | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/Home/Index.cshtml | Anlab.Mvc/Views/Home/Index.cshtml | @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<h2 style="color: blue">Posted: April 6, 2020<br /><br />
We are scaling back to a bare minimum staff at this time. We will only be working on samples where immediate testing is essential. Assisting you with your research is very important to us and we are eager to return to full staffing as soon as it is safe.<br /> <br />
For the week of April 6-10, receiving will be open from 9am to noon.<br /><br />
Starting April 13th for sample drop-off please email us at <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a> to arrange a time to meet at receiving. If you need to ship samples to us, please email us with the expected delivery date.<br /><br />
Please use this option for samples requiring immediate testing for essential research. We can also arrange for receipt of more routine samples if proper storage of samples cannot be arranged in your own facility as we await a return to normal business operations.<br /><br />
Please monitor our homepage for updates and thank you for your patience!<br /><br />
Please be safe.</h2>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses.
</p>
<p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the
operation of a number of analytical methods and instruments.</p>
<p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory.
We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service
as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/>
Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
</address>
</div>
| @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<h2 style="color: green">We are currently open with normal business hours in order to support on-going essential agricultural research. Please feel free to email us before shipping samples if there is any concern about a future closure.</h2>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses.
</p>
<p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the
operation of a number of analytical methods and instruments.</p>
<p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory.
We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service
as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/>
Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
</address>
</div>
| mit | C# |
1456efc3414342ebcf261992830d73ac671a20cb | Update Utilities.cs | JustArchi/ArchiSteamFarm,JustArchi/ArchiSteamFarm,JustArchi/ArchiSteamFarm,JustArchi/ArchiSteamFarm | ArchiSteamFarm.Tests/Utilities.cs | ArchiSteamFarm.Tests/Utilities.cs | // _ _ _ ____ _ _____
// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
// |
// Copyright 2015-2021 Łukasz "JustArchi" Domeradzki
// Contact: JustArchi@JustArchi.net
// |
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// |
// http://www.apache.org/licenses/LICENSE-2.0
// |
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using static ArchiSteamFarm.Core.Utilities;
namespace ArchiSteamFarm.Tests {
[TestClass]
#pragma warning disable CA1724 // We don't care about the potential conflict, as ASF class name has a priority
public sealed class Utilities {
[TestMethod]
public void AdditionallyForbiddenWordsWeakenPassphrases() => Assert.IsTrue(TestPasswordStrength("10chars<!>asdf", new HashSet<string> { "chars<!>" }).IsWeak);
[TestMethod]
public void ContextSpecificWordsWeakenPassphrases() => Assert.IsTrue(TestPasswordStrength("archisteamfarmpassword").IsWeak);
[TestMethod]
public void LongPassphraseIsNotWeak() => Assert.IsFalse(TestPasswordStrength("10chars<!>asdf").IsWeak);
[TestMethod]
public void RepetitiveCharactersWeakenPassphrases() => Assert.IsTrue(TestPasswordStrength("testaaaatest").IsWeak);
[TestMethod]
public void SequentialCharactersWeakenPassphrases() => Assert.IsTrue(TestPasswordStrength("testabcdtest").IsWeak);
[TestMethod]
public void SequentialDescendingCharactersWeakenPassphrases() => Assert.IsTrue(TestPasswordStrength("testdcbatest").IsWeak);
[TestMethod]
public void ShortPassphraseIsWeak() => Assert.IsTrue(TestPasswordStrength("four").IsWeak);
}
#pragma warning restore CA1724 // We don't care about the potential conflict, as ASF class name has a priority
}
| // _ _ _ ____ _ _____
// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
// |
// Copyright 2015-2021 Łukasz "JustArchi" Domeradzki
// Contact: JustArchi@JustArchi.net
// |
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// |
// http://www.apache.org/licenses/LICENSE-2.0
// |
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using static ArchiSteamFarm.Core.Utilities;
namespace ArchiSteamFarm.Tests {
[TestClass]
#pragma warning disable CA1724
public sealed class Utilities {
[TestMethod]
public void AdditionallyForbiddenWordsWeakenPassphrases() => Assert.IsTrue(TestPasswordStrength("10chars<!>asdf", new HashSet<string> { "chars<!>" }).IsWeak);
[TestMethod]
public void ContextSpecificWordsWeakenPassphrases() => Assert.IsTrue(TestPasswordStrength("archisteamfarmpassword").IsWeak);
[TestMethod]
public void LongPassphraseIsNotWeak() => Assert.IsFalse(TestPasswordStrength("10chars<!>asdf").IsWeak);
[TestMethod]
public void RepetitiveCharactersWeakenPassphrases() => Assert.IsTrue(TestPasswordStrength("testaaaatest").IsWeak);
[TestMethod]
public void SequentialCharactersWeakenPassphrases() => Assert.IsTrue(TestPasswordStrength("testabcdtest").IsWeak);
[TestMethod]
public void SequentialDescendingCharactersWeakenPassphrases() => Assert.IsTrue(TestPasswordStrength("testdcbatest").IsWeak);
[TestMethod]
public void ShortPassphraseIsWeak() => Assert.IsTrue(TestPasswordStrength("four").IsWeak);
}
#pragma warning restore CA1724
}
| apache-2.0 | C# |
3c13fc1be533e9ed199bad5fbd26182bdb11421e | add AccountLegalEntityPublicHashedId to Apprenticeship | SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments | src/SFA.DAS.Commitments.Api.Types/Apprenticeship/Apprenticeship.cs | src/SFA.DAS.Commitments.Api.Types/Apprenticeship/Apprenticeship.cs | using System;
using SFA.DAS.Commitments.Api.Types.Apprenticeship.Types;
namespace SFA.DAS.Commitments.Api.Types.Apprenticeship
{
public class Apprenticeship
{
public long Id { get; set; }
public long CommitmentId { get; set; }
public long EmployerAccountId { get; set; }
public long ProviderId { get; set; }
public long? TransferSenderId { get; set; }
public string Reference { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime? DateOfBirth { get; set; }
public string NINumber { get; set; }
public string ULN { get; set; }
public TrainingType TrainingType { get; set; }
public string TrainingCode { get; set; }
public string TrainingName { get; set; }
public decimal? Cost { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public DateTime? PauseDate { get; set; }
public DateTime? StopDate { get; set; }
public PaymentStatus PaymentStatus { get; set; }
public AgreementStatus AgreementStatus { get; set; }
public string EmployerRef { get; set; }
public string ProviderRef { get; set; }
public bool CanBeApproved { get; set; }
public Originator? PendingUpdateOriginator { get; set; }
public string ProviderName { get; set; }
public string LegalEntityId { get; set; }
public string LegalEntityName { get; set; }
public string AccountLegalEntityPublicHashedId { get; set; }
public bool DataLockPrice { get; set; }
public bool DataLockPriceTriaged { get; set; }
public bool DataLockCourse { get; set; }
public bool DataLockCourseTriaged { get; set; }
public bool DataLockCourseChangeTriaged { get; set; }
public bool DataLockTriagedAsRestart { get; set; }
public bool HasHadDataLockSuccess { get; set; }
public string ApprenticeshipName => $"{FirstName} {LastName}";
public string EndpointAssessorName { get; set; }
}
} | using System;
using SFA.DAS.Commitments.Api.Types.Apprenticeship.Types;
namespace SFA.DAS.Commitments.Api.Types.Apprenticeship
{
public class Apprenticeship
{
public long Id { get; set; }
public long CommitmentId { get; set; }
public long EmployerAccountId { get; set; }
public long ProviderId { get; set; }
public long? TransferSenderId { get; set; }
public string Reference { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime? DateOfBirth { get; set; }
public string NINumber { get; set; }
public string ULN { get; set; }
public TrainingType TrainingType { get; set; }
public string TrainingCode { get; set; }
public string TrainingName { get; set; }
public decimal? Cost { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public DateTime? PauseDate { get; set; }
public DateTime? StopDate { get; set; }
public PaymentStatus PaymentStatus { get; set; }
public AgreementStatus AgreementStatus { get; set; }
public string EmployerRef { get; set; }
public string ProviderRef { get; set; }
public bool CanBeApproved { get; set; }
public Originator? PendingUpdateOriginator { get; set; }
public string ProviderName { get; set; }
public string LegalEntityId { get; set; }
public string LegalEntityName { get; set; }
public bool DataLockPrice { get; set; }
public bool DataLockPriceTriaged { get; set; }
public bool DataLockCourse { get; set; }
public bool DataLockCourseTriaged { get; set; }
public bool DataLockCourseChangeTriaged { get; set; }
public bool DataLockTriagedAsRestart { get; set; }
public bool HasHadDataLockSuccess { get; set; }
public string ApprenticeshipName => $"{FirstName} {LastName}";
public string EndpointAssessorName { get; set; }
}
} | mit | C# |
afac293cd205e9f858cfcc65f105fd85f981cd26 | update to version 1.0.0 | WebApiContrib/WebApiContrib.IoC.CastleWindsor,kalyanraman/WebApiContrib.IoC.CastleWindsor,modulexcite/WebApiContrib.IoC.CastleWindsor,WebApiContrib/WebApiContrib.IoC.CastleWindsor | src/WebApiContrib.IoC.CastleWindsor/Properties/AssemblyInfo.cs | src/WebApiContrib.IoC.CastleWindsor/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("WebApiContrib.IoC.CastleWindsor")]
[assembly: AssemblyDescription("The WebApiContrib.IoC.CastleWindsor library provides dependency injection helpers for ASP.NET Web API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WebApiContrib")]
[assembly: AssemblyProduct("WebApiContrib.IoC.CastleWindsor")]
[assembly: AssemblyCopyright("Copyright © WebApiContrib 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("087a0a37-a64a-41bb-bce6-fb2e2aa1b6a5")]
// 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.0")]
[assembly: AssemblyFileVersion("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("WebApiContrib.IoC.CastleWindsor")]
[assembly: AssemblyDescription("The WebApiContrib.IoC.CastleWindsor library provides dependency injection helpers for ASP.NET Web API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WebApiContrib")]
[assembly: AssemblyProduct("WebApiContrib.IoC.CastleWindsor")]
[assembly: AssemblyCopyright("Copyright © WebApiContrib 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("087a0a37-a64a-41bb-bce6-fb2e2aa1b6a5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.10.0")]
[assembly: AssemblyFileVersion("0.10.0")]
| mit | C# |
65ab3e7a67e7f11b2d6c301fc73bce9909b97220 | Remove unused member variable in AssemblyHelper | Hammerstad/Moya | Moya.Runner/Utility/AssemblyHelper.cs | Moya.Runner/Utility/AssemblyHelper.cs | namespace Moya.Runner.Utility
{
using System;
using System.Reflection;
public class AssemblyHelper
{
private readonly Assembly assembly;
public AssemblyHelper(string assemblyPath)
{
assembly = Assembly.LoadFile(assemblyPath);
}
public MethodInfo GetMethodFromAssembly(string className, string methodName)
{
Type type = assembly.GetType(className);
if (type != null)
{
return type.GetMethod(methodName);
}
return null;
}
}
} | namespace Moya.Runner.Utility
{
using System;
using System.Reflection;
public class AssemblyHelper
{
private readonly string assemblyPath;
private readonly Assembly assembly;
public AssemblyHelper(string assemblyPath)
{
this.assemblyPath = assemblyPath;
assembly = Assembly.LoadFile(this.assemblyPath);
}
public MethodInfo GetMethodFromAssembly(string className, string methodName)
{
Type type = assembly.GetType(className);
if (type != null)
{
return type.GetMethod(methodName);
}
return null;
}
}
} | mit | C# |
5c154dc241a358dd16f75f02cb4e721cbfd03d12 | Update to use modern infrastructure #149 Fixes #151 | LHCAtlas/AtlasSSH | PSAtlasDatasetCommands/GetGRIDDataLocations.cs | PSAtlasDatasetCommands/GetGRIDDataLocations.cs | using AtlasWorkFlows;
using PSAtlasDatasetCommands.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Management.Automation;
using System.Text;
using System.Threading.Tasks;
namespace PSAtlasDatasetCommands
{
/// <summary>
/// Return the list of locations that are active right now where a GRID dataset
/// can be downloaded to.
/// </summary>
[Cmdlet(VerbsCommon.Get, "GRIDDataLocations")]
public class GetGRIDDataLocations : PSCmdlet
{
/// <summary>
/// Get the list and write it out as objects.
/// </summary>
protected override void ProcessRecord()
{
var listener = new PSListener(this);
Trace.Listeners.Add(listener);
try
{
var list = DatasetManager.ValidLocations;
foreach (var l in list)
{
using (var pl = listener.PauseListening())
{
WriteObject(l);
}
}
} finally
{
Trace.Listeners.Remove(listener);
}
}
}
}
| using AtlasWorkFlows;
using PSAtlasDatasetCommands.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Management.Automation;
using System.Text;
using System.Threading.Tasks;
namespace PSAtlasDatasetCommands
{
/// <summary>
/// Return the list of locations that are active right now where a GRID dataset
/// can be downloaded to.
/// </summary>
[Cmdlet(VerbsCommon.Get, "GRIDDataLocations")]
public class GetGRIDDataLocations : PSCmdlet
{
/// <summary>
/// Get the list and write it out as objects.
/// </summary>
protected override void ProcessRecord()
{
var listener = new PSListener(this);
Trace.Listeners.Add(listener);
try
{
var list = GRIDDatasetLocator.GetActiveLocations();
foreach (var l in list)
{
using (var pl = listener.PauseListening())
{
WriteObject(l.Name);
}
}
} finally
{
Trace.Listeners.Remove(listener);
}
}
}
}
| mit | C# |
ef0efdc619b9a462d15767026a45afcd68350443 | revert changes to assembly info with generated version numbers | ZEISS-PiWeb/PiWeb-Api | SDK/Api/Properties/AssemblyInfo.cs | SDK/Api/Properties/AssemblyInfo.cs | using System.Resources;
using System.Reflection;
[assembly: AssemblyTitle( "PiWeb Api" )]
[assembly: AssemblyVersion( "1.0.1" )]
[assembly: AssemblyCompany( "Carl Zeiss IZfM Dresden" )]
[assembly: AssemblyProduct( "PiWeb Api" )]
[assembly: NeutralResourcesLanguage( "en" )]
| using System.Resources;
using System.Reflection;
[assembly: AssemblyTitle( "PiWeb Api" )]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyCompany( "Carl Zeiss IZfM Dresden" )]
[assembly: AssemblyProduct( "PiWeb Api" )]
[assembly: NeutralResourcesLanguage( "en" )]
[assembly: AssemblyInformationalVersion("1.0.2+4.Branch.master.Sha.abf0837a60fab7a3f1e608ab47da60fd118eb780")]
[assembly: AssemblyFileVersion("1.0.2.0")]
| bsd-3-clause | C# |
d4567ecac7cf804b72e1f8f06944081b43a95e0e | Update menu entry name | bartlomiejwolk/FileLogger | Editor/LoggerWindow.cs | Editor/LoggerWindow.cs | using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
namespace FileLogger {
public class LoggerWindow : EditorWindow {
private Logger loggerInstance;
public Logger LoggerInstance {
get {
if (loggerInstance == null) {
loggerInstance = FindObjectOfType<Logger>();
if (loggerInstance == null) {
GameObject loggerGO = new GameObject();
loggerGO.AddComponent<Logger>();
loggerInstance = loggerGO.GetComponent<Logger>();
}
}
return loggerInstance;
}
}
[MenuItem("Window/FileLogger")]
public static void Init() {
LoggerWindow window =
(LoggerWindow)EditorWindow.GetWindow(typeof(LoggerWindow));
window.title = "Logger";
window.minSize = new Vector2(100f, 60f);
}
private void OnGUI() {
EditorGUILayout.BeginHorizontal();
// Draw Start/Stop button.
LoggerInstance.LoggingEnabled =
InspectorControls.DrawStartStopButton(
LoggerInstance.LoggingEnabled,
LoggerInstance.EnableOnPlay,
null,
() => LoggerInstance.LogWriter.Add("[PAUSE]", true),
() => LoggerInstance.LogWriter.WriteAll(
LoggerInstance.FilePath,
false));
// Draw -> button.
if (GUILayout.Button("->", GUILayout.Width(30))) {
EditorGUIUtility.PingObject(LoggerInstance);
Selection.activeGameObject = LoggerInstance.gameObject;
}
EditorGUILayout.EndHorizontal();
Repaint();
}
}
}
| using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
namespace FileLogger {
public class LoggerWindow : EditorWindow {
private Logger loggerInstance;
public Logger LoggerInstance {
get {
if (loggerInstance == null) {
loggerInstance = FindObjectOfType<Logger>();
if (loggerInstance == null) {
GameObject loggerGO = new GameObject();
loggerGO.AddComponent<Logger>();
loggerInstance = loggerGO.GetComponent<Logger>();
}
}
return loggerInstance;
}
}
[MenuItem("Window/mLogger")]
public static void Init() {
LoggerWindow window =
(LoggerWindow)EditorWindow.GetWindow(typeof(LoggerWindow));
window.title = "Logger";
window.minSize = new Vector2(100f, 60f);
}
private void OnGUI() {
EditorGUILayout.BeginHorizontal();
// Draw Start/Stop button.
LoggerInstance.LoggingEnabled =
InspectorControls.DrawStartStopButton(
LoggerInstance.LoggingEnabled,
LoggerInstance.EnableOnPlay,
null,
() => LoggerInstance.LogWriter.Add("[PAUSE]", true),
() => LoggerInstance.LogWriter.WriteAll(
LoggerInstance.FilePath,
false));
// Draw -> button.
if (GUILayout.Button("->", GUILayout.Width(30))) {
EditorGUIUtility.PingObject(LoggerInstance);
Selection.activeGameObject = LoggerInstance.gameObject;
}
EditorGUILayout.EndHorizontal();
Repaint();
}
}
}
| mit | C# |
ad297f0b9ef1dce9fd78f5eb6a2ff8dbe47fbc6d | Use the chain way for registering services and view models. | minidfx/BulkRename | Solution/App/Infrastructure/UWPBootstrapper.cs | Solution/App/Infrastructure/UWPBootstrapper.cs | using System;
using App.Services;
using App.Services.Contracts;
using App.ViewModels;
using App.ViewModels.Contracts;
using Microsoft.Practices.Unity;
namespace App.Infrastructure
{
// ReSharper disable once InconsistentNaming
public sealed class UWPBootstrapper : CaliburnBootstrapper
{
public UWPBootstrapper(Action createWindow) : base(createWindow)
{
}
protected override void Configure()
{
base.Configure();
this.UnityContainer
.RegisterType<IOpenFolderService, OpenFolderService>()
.RegisterType<IShellViewModel, ShellViewModel>();
}
public override void Dispose()
{
base.Dispose();
GC.Collect();
GC.WaitForPendingFinalizers();
GC.SuppressFinalize(this);
}
}
} | using System;
using App.Services;
using App.Services.Contracts;
using App.ViewModels;
using App.ViewModels.Contracts;
using Microsoft.Practices.Unity;
namespace App.Infrastructure
{
// ReSharper disable once InconsistentNaming
public sealed class UWPBootstrapper : CaliburnBootstrapper
{
public UWPBootstrapper(Action createWindow) : base(createWindow)
{
}
protected override void Configure()
{
base.Configure();
this.UnityContainer.RegisterType<IOpenFolderService, OpenFolderService>();
this.UnityContainer.RegisterType<IShellViewModel, ShellViewModel>();
}
public override void Dispose()
{
base.Dispose();
GC.Collect();
GC.WaitForPendingFinalizers();
GC.SuppressFinalize(this);
}
}
} | mit | C# |
ea2c67ca5fe03415fe7a79831738131f8ebb1585 | Fix incorrect serialization condition | peppy/osu,johnneijzen/osu,peppy/osu,NeoAdonis/osu,ppy/osu,Nabile-Rahmani/osu,UselessToucan/osu,naoey/osu,peppy/osu-new,peppy/osu,smoogipooo/osu,2yangk23/osu,smoogipoo/osu,ppy/osu,naoey/osu,EVAST9919/osu,johnneijzen/osu,smoogipoo/osu,smoogipoo/osu,DrabWeb/osu,DrabWeb/osu,DrabWeb/osu,EVAST9919/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,Frontear/osuKyzer,ZLima12/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,ZLima12/osu,naoey/osu | osu.Game/Audio/SampleInfo.cs | osu.Game/Audio/SampleInfo.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using Newtonsoft.Json;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Audio
{
[Serializable]
public class SampleInfo
{
public const string HIT_WHISTLE = @"hitwhistle";
public const string HIT_FINISH = @"hitfinish";
public const string HIT_NORMAL = @"hitnormal";
public const string HIT_CLAP = @"hitclap";
[JsonIgnore]
public SoundControlPoint ControlPoint;
private string bank;
/// <summary>
/// The bank to load the sample from.
/// </summary>
public string Bank
{
get { return string.IsNullOrEmpty(bank) ? (ControlPoint?.SampleBank ?? "normal") : bank; }
set { bank = value; }
}
public bool ShouldSerializeBank() => Bank != ControlPoint.SampleBank;
/// <summary>
/// The name of the sample to load.
/// </summary>
public string Name { get; set; }
private int volume;
/// <summary>
/// The sample volume.
/// </summary>
public int Volume
{
get { return volume == 0 ? (ControlPoint?.SampleVolume ?? 0) : volume; }
set { volume = value; }
}
public bool ShouldSerializeVolume() => Volume != ControlPoint.SampleVolume;
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using Newtonsoft.Json;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Audio
{
[Serializable]
public class SampleInfo
{
public const string HIT_WHISTLE = @"hitwhistle";
public const string HIT_FINISH = @"hitfinish";
public const string HIT_NORMAL = @"hitnormal";
public const string HIT_CLAP = @"hitclap";
[JsonIgnore]
public SoundControlPoint ControlPoint;
private string bank;
/// <summary>
/// The bank to load the sample from.
/// </summary>
public string Bank
{
get { return string.IsNullOrEmpty(bank) ? (ControlPoint?.SampleBank ?? "normal") : bank; }
set { bank = value; }
}
public bool ShouldSerializeBank() => Bank == ControlPoint.SampleBank;
/// <summary>
/// The name of the sample to load.
/// </summary>
public string Name { get; set; }
private int volume;
/// <summary>
/// The sample volume.
/// </summary>
public int Volume
{
get { return volume == 0 ? (ControlPoint?.SampleVolume ?? 0) : volume; }
set { volume = value; }
}
public bool ShouldSerializeVolume() => Volume == ControlPoint.SampleVolume;
}
}
| mit | C# |
492bfe74738ae05dafae492a4267a05c5322ca93 | Update version number | ermshiperete/undisposed-fody,ermshiperete/undisposed-fody | Undisposed/Properties/AssemblyInfo.cs | Undisposed/Properties/AssemblyInfo.cs | // Copyright (c) 2014 Eberhard Beilharz
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Undisposed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Eberhard Beilharz")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.2.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
[assembly: InternalsVisibleTo("UndisposedTests")]
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| // Copyright (c) 2014 Eberhard Beilharz
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Undisposed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Eberhard Beilharz")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.1.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
[assembly: InternalsVisibleTo("UndisposedTests")]
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| mit | C# |
04887bacbd543f24683bc636670ec435b69adb8b | Bump version | BrianLima/UWPHook | UWPHook/Properties/AssemblyInfo.cs | UWPHook/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("UWPHook")]
[assembly: AssemblyDescription("Add your UWP games and apps to Steam!")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Briano")]
[assembly: AssemblyProduct("UWPHook")]
[assembly: AssemblyCopyright("Copyright Brian Lima © 2020 2021 2022")]
[assembly: AssemblyTrademark("Briano")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.11.0.0")]
[assembly: AssemblyFileVersion("2.11.0.0")]
[assembly: NeutralResourcesLanguage("en")]
| 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("UWPHook")]
[assembly: AssemblyDescription("Add your UWP games and apps to Steam!")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Briano")]
[assembly: AssemblyProduct("UWPHook")]
[assembly: AssemblyCopyright("Copyright Brian Lima © 2020 2021")]
[assembly: AssemblyTrademark("Briano")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.10.0.0")]
[assembly: AssemblyFileVersion("2.10.0.0")]
[assembly: NeutralResourcesLanguage("en")]
| mit | C# |
28a4cde5dd7568b7c91602d9822db16d3a4119f1 | Fix remaining usage of DI instead of direct `Create()` call | ppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework | osu.Framework.Benchmarks/BenchmarkTabletDriver.cs | osu.Framework.Benchmarks/BenchmarkTabletDriver.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.
#if NET5_0
using BenchmarkDotNet.Attributes;
using osu.Framework.Input.Handlers.Tablet;
namespace osu.Framework.Benchmarks
{
public class BenchmarkTabletDriver : BenchmarkTest
{
private TabletDriver driver;
public override void SetUp()
{
driver = TabletDriver.Create();
}
[Benchmark]
public void DetectBenchmark()
{
driver.Detect();
}
}
}
#endif
| // 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.
#if NET5_0
using BenchmarkDotNet.Attributes;
using Microsoft.Extensions.DependencyInjection;
using OpenTabletDriver;
using osu.Framework.Input.Handlers.Tablet;
namespace osu.Framework.Benchmarks
{
public class BenchmarkTabletDriver : BenchmarkTest
{
private TabletDriver driver;
public override void SetUp()
{
var collection = new DriverServiceCollection()
.AddTransient<TabletDriver>();
var serviceProvider = collection.BuildServiceProvider();
driver = serviceProvider.GetRequiredService<TabletDriver>();
}
[Benchmark]
public void DetectBenchmark()
{
driver.Detect();
}
}
}
#endif
| mit | C# |
9cd4693eec1c499a2862bf928547a989fe52f1c4 | FIX THAT DEBUG! | veselin-/Team4BabelGame | Babel/Assets/Core/Camera/CameraMovementArea.cs | Babel/Assets/Core/Camera/CameraMovementArea.cs | using UnityEngine;
using System.Collections;
public class CameraMovementArea : MonoBehaviour {
private Transform cameraParent;
[SerializeField]
public Vector3 lastPos = Vector3.zero;
public bool isInsideArea = true;
// trqbva da vzema last positiona ot stay i kogato exit-na da varna parent position-a na last position
// Use this for initialization
void Start () {
cameraParent = transform.parent;
}
// Update is called once per frame
void Update () {
}
void OnTriggerStay(Collider other) {
//Debug.Log ("Inside");
isInsideArea = true;
lastPos = transform.position;
//Debug.Log (other);
/*
if (other.attachedRigidbody)
other.attachedRigidbody.AddForce(Vector3.up * 10);
*/
}
void OnTriggerExit(Collider other) {
//lastPos = cameraParent.position;
//Debug.Log (lastPos);
isInsideArea = false;
}
}
| using UnityEngine;
using System.Collections;
public class CameraMovementArea : MonoBehaviour {
private Transform cameraParent;
[SerializeField]
public Vector3 lastPos = Vector3.zero;
public bool isInsideArea = true;
// trqbva da vzema last positiona ot stay i kogato exit-na da varna parent position-a na last position
// Use this for initialization
void Start () {
cameraParent = transform.parent;
}
// Update is called once per frame
void Update () {
}
void OnTriggerStay(Collider other) {
Debug.Log ("Inside");
isInsideArea = true;
lastPos = transform.position;
//Debug.Log (other);
/*
if (other.attachedRigidbody)
other.attachedRigidbody.AddForce(Vector3.up * 10);
*/
}
void OnTriggerExit(Collider other) {
//lastPos = cameraParent.position;
//Debug.Log (lastPos);
isInsideArea = false;
}
}
| mit | C# |
6ff5815bf98d667d166ace7485f032f62ab3d188 | Revert Mistake | Cryru/SoulEngine | EmotionCore/src/Game/UI/ScrollInputSelector.cs | EmotionCore/src/Game/UI/ScrollInputSelector.cs | // Emotion - https://github.com/Cryru/Emotion
#region Using
using Emotion.GLES;
using Emotion.Input;
using Emotion.IO;
using Emotion.Primitives;
#endregion
namespace Emotion.Game.UI
{
public class ScrollInputSelector : Control
{
#region Properties
/// <summary>
/// The color of the selector.
/// </summary>
public Color Color { get; set; } = Color.White;
/// <summary>
/// The color of the selector when held.
/// </summary>
public Color HeldColor { get; set; } = Color.Red;
#endregion
/// <summary>
/// The parent scroll input.
/// </summary>
private ScrollInput _parent;
public ScrollInputSelector(ScrollInput parent, Controller controller, Rectangle bounds, int priority) : base(controller, bounds, priority)
{
_parent = parent;
}
public override void Draw(Renderer renderer)
{
// Sync active states.
Active = _parent.Active;
// Render the selector according to whether it is held or not.
renderer.DrawRectangle(Bounds, Held[0] ? HeldColor : Color, false);
}
public override void MouseMoved(Vector2 oldPosition, Vector2 newPosition)
{
// Check if held with the left click.
if (!Held[0]) return;
// Calculate the new value form the new mouse position.
float posWithinParent = newPosition.X - _parent.Bounds.X;
float increment = _parent.Bounds.Width / 100;
_parent.Value = (int) (posWithinParent / increment);
}
}
} | // Emotion - https://github.com/Cryru/Emotion
#region Using
using Emotion.GLES;
using Emotion.Input;
using Emotion.IO;
using Emotion.Primitives;
#endregion
namespace Emotion.Game.UI
{
public class ScrollInputSelector : Control
{
#region Properties
/// <summary>
/// The color of the selector.
/// </summary>
public Color Color { get; set; } = Color.White;
/// <summary>
/// The color of the selector when held.
/// </summary>
public Color HeldColor { get; set; } = Color.Red;
#endregion
/// <summary>
/// The parent scroll input.
/// </summary>
private ScrollInput _parent;
private SoundFile _scrollSound;
public ScrollInputSelector(ScrollInput parent, Controller controller, Rectangle bounds, int priority) : base(controller, bounds, priority)
{
_parent = parent;
_scrollSound = _controller.Context.AssetLoader.Get<SoundFile>("Music/UI/slider_short.wav");
}
public override void Draw(Renderer renderer)
{
// Sync active states.
Active = _parent.Active;
// Render the selector according to whether it is held or not.
renderer.DrawRectangle(Bounds, Held[0] ? HeldColor : Color, false);
}
public override void MouseMoved(Vector2 oldPosition, Vector2 newPosition)
{
// Check if held with the left click.
if (!Held[0]) return;
// Calculate the new value form the new mouse position.
float posWithinParent = newPosition.X - _parent.Bounds.X;
float increment = _parent.Bounds.Width / 100;
_parent.Value = (int) (posWithinParent / increment);
if (_controller.Context.SoundManager.GetLayer("UI").Source.Paused)
{
_controller.Context.SoundManager.GetLayer("UI").Source.Play();
}
}
public override void MouseDown(MouseKeys key)
{
_controller.Context.SoundManager.PlayOnLayer("UI", _scrollSound);
_controller.Context.SoundManager.GetLayer("UI").Source.Looping = true;
}
public override void MouseUp(MouseKeys key)
{
_controller.Context.SoundManager.GetLayer("UI").Source.Destroy();
}
}
} | mit | C# |
983f4b3485d33cf73178ea38a80bbf97674ad314 | remove todo only | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EmployerAccounts/Queries/GetStatistics/GetStatisticsQueryHandler.cs | src/SFA.DAS.EmployerAccounts/Queries/GetStatistics/GetStatisticsQueryHandler.cs | using System;
using System.Linq;
using System.Threading.Tasks;
using MediatR;
using SFA.DAS.EmployerAccounts.Api.Types;
using SFA.DAS.EmployerAccounts.Data;
using SFA.DAS.EmployerAccounts.Extensions;
using SFA.DAS.EmployerAccounts.Models.EmployerAgreement;
using SFA.DAS.EntityFramework;
namespace SFA.DAS.EmployerAccounts.Queries.GetStatistics
{
public class GetStatisticsQueryHandler : IAsyncRequestHandler<GetStatisticsQuery, GetStatisticsResponse>
{
private readonly Lazy<EmployerAccountsDbContext> _accountDb;
public GetStatisticsQueryHandler(Lazy<EmployerAccountsDbContext> accountDb)
{
_accountDb = accountDb;
}
public async Task<GetStatisticsResponse> Handle(GetStatisticsQuery message)
{
var accountsQuery = _accountDb.Value.Accounts.FutureCount();
var legalEntitiesQuery = _accountDb.Value.LegalEntities.FutureCount();
var payeSchemesQuery = _accountDb.Value.Payees.FutureCount();
var agreementsQuery = _accountDb.Value.Agreements.Where(a => a.StatusId == EmployerAgreementStatus.Signed).FutureCount();
var statistics = new Statistics
{
TotalAccounts = await accountsQuery.ValueAsync(),
TotalLegalEntities = await legalEntitiesQuery.ValueAsync(),
TotalPayeSchemes = await payeSchemesQuery.ValueAsync(),
TotalAgreements = await agreementsQuery.ValueAsync()
};
return new GetStatisticsResponse
{
Statistics = statistics
};
}
}
} | using System;
using System.Linq;
using System.Threading.Tasks;
using MediatR;
using SFA.DAS.EmployerAccounts.Api.Types;
using SFA.DAS.EmployerAccounts.Data;
using SFA.DAS.EmployerAccounts.Extensions;
using SFA.DAS.EmployerAccounts.Models.EmployerAgreement;
using SFA.DAS.EntityFramework;
namespace SFA.DAS.EmployerAccounts.Queries.GetStatistics
{
public class GetStatisticsQueryHandler : IAsyncRequestHandler<GetStatisticsQuery, GetStatisticsResponse>
{
private readonly Lazy<EmployerAccountsDbContext> _accountDb;
public GetStatisticsQueryHandler(Lazy<EmployerAccountsDbContext> accountDb)
{
_accountDb = accountDb;
}
public async Task<GetStatisticsResponse> Handle(GetStatisticsQuery message)
{
//todo: make note in pr: adds reference to infrastructure
var accountsQuery = _accountDb.Value.Accounts.FutureCount();
var legalEntitiesQuery = _accountDb.Value.LegalEntities.FutureCount();
var payeSchemesQuery = _accountDb.Value.Payees.FutureCount();
var agreementsQuery = _accountDb.Value.Agreements.Where(a => a.StatusId == EmployerAgreementStatus.Signed).FutureCount();
var statistics = new Statistics
{
TotalAccounts = await accountsQuery.ValueAsync(),
TotalLegalEntities = await legalEntitiesQuery.ValueAsync(),
TotalPayeSchemes = await payeSchemesQuery.ValueAsync(),
TotalAgreements = await agreementsQuery.ValueAsync()
};
return new GetStatisticsResponse
{
Statistics = statistics
};
}
}
} | mit | C# |
95f756d86b1d878731690e78a0b6218923069919 | Add non-generic IAwaiter | ericstj/corefxlab,whoisj/corefxlab,dotnet/corefxlab,tarekgh/corefxlab,ericstj/corefxlab,VSadov/corefxlab,ericstj/corefxlab,joshfree/corefxlab,ericstj/corefxlab,VSadov/corefxlab,stephentoub/corefxlab,VSadov/corefxlab,adamsitnik/corefxlab,stephentoub/corefxlab,joshfree/corefxlab,VSadov/corefxlab,dotnet/corefxlab,KrzysztofCwalina/corefxlab,stephentoub/corefxlab,ahsonkhan/corefxlab,KrzysztofCwalina/corefxlab,whoisj/corefxlab,VSadov/corefxlab,VSadov/corefxlab,stephentoub/corefxlab,ericstj/corefxlab,stephentoub/corefxlab,stephentoub/corefxlab,adamsitnik/corefxlab,ericstj/corefxlab,ahsonkhan/corefxlab,benaadams/corefxlab,benaadams/corefxlab,tarekgh/corefxlab | src/System.Threading.Tasks.Channels/System/Runtime/CompilerServices/IAwaiter.cs | src/System.Threading.Tasks.Channels/System/Runtime/CompilerServices/IAwaiter.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.
namespace System.Runtime.CompilerServices
{
/// <summary>Provides an interface that may be implemented by an awaiter.</summary>
/// <typeparam name="T">Specifies the result type of the await operation using this awaiter.</typeparam>
public interface IAwaiter : ICriticalNotifyCompletion
{
/// <summary>Gets whether the awaiter is completed.</summary>
bool IsCompleted { get; }
/// <summary>Gets the result of the completed, awaited operation.</summary>
void GetResult();
}
/// <summary>Provides an interface that may be implemented by an awaiter.</summary>
/// <typeparam name="T">Specifies the result type of the await operation using this awaiter.</typeparam>
public interface IAwaiter<T> : ICriticalNotifyCompletion
{
/// <summary>Gets whether the awaiter is completed.</summary>
bool IsCompleted { get; }
/// <summary>Gets the result of the completed, awaited operation.</summary>
T GetResult();
}
}
| // 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.
namespace System.Runtime.CompilerServices
{
/// <summary>Provides an interface that may be implemented by an awaiter.</summary>
/// <typeparam name="T">Specifies the result type of the await operation using this awaiter.</typeparam>
public interface IAwaiter<T> : ICriticalNotifyCompletion
{
/// <summary>Gets whether the awaiter is completed.</summary>
bool IsCompleted { get; }
/// <summary>Gets the result of the completed, awaited operation.</summary>
T GetResult();
}
}
| mit | C# |
ce52a66ddfffc04433830f8eb395bda9755cbcdb | fix line ending comparison | aloneguid/support | src/NetBox.Tests/Extensions/AssemblyExtensionsTest.cs | src/NetBox.Tests/Extensions/AssemblyExtensionsTest.cs | using Xunit;
using System;
using System.Diagnostics;
using System.Reflection;
namespace NetBox.Tests.Extensions
{
/// <summary>
/// These don't test much but at least verify calls don't crash
/// </summary>
public class AssemblyExtensionsTest
{
private Assembly _asm = Assembly.Load(new AssemblyName("NetBox.Tests"));
[Fact]
public void GetFileVersion_ThisAssembly_ReturnsSomething()
{
Version v = _asm.FileVersion();
Assert.Equal(v, new Version("1.0.0.0"));
}
[Fact]
public void GetProductVersion_ThisAssembly_ReturnsSomething()
{
Version v = _asm.ProductVersion();
Assert.Equal(v, new Version("1.0.0.0"));
}
[Fact]
public void GetSameFolderEmbeddedResourceFileAsText_EmbeddedTextFile_TextMatches()
{
string content = _asm.GetSameFolderEmbeddedResourceFileAsText<AssemblyExtensionsTest>("EmbeddedResource.txt");
Assert.Equal("text file content\r\nwith two lines", content, false, true);
}
[Fact]
public void GetSameFolderEmbeddedResourceFileAsLines_EmbeddedTextFile_TextMatches()
{
string[] content = _asm.GetSameFolderEmbeddedResourceFileAsLines<AssemblyExtensionsTest>("EmbeddedResource.txt");
Assert.Equal(2, content.Length);
Assert.Equal("text file content", content[0]);
Assert.Equal("with two lines", content[1]);
}
}
} | using Xunit;
using System;
using System.Diagnostics;
using System.Reflection;
namespace NetBox.Tests.Extensions
{
/// <summary>
/// These don't test much but at least verify calls don't crash
/// </summary>
public class AssemblyExtensionsTest
{
private Assembly _asm = Assembly.Load(new AssemblyName("NetBox.Tests"));
[Fact]
public void GetFileVersion_ThisAssembly_ReturnsSomething()
{
Version v = _asm.FileVersion();
Assert.Equal(v, new Version("1.0.0.0"));
}
[Fact]
public void GetProductVersion_ThisAssembly_ReturnsSomething()
{
Version v = _asm.ProductVersion();
Assert.Equal(v, new Version("1.0.0.0"));
}
[Fact]
public void GetSameFolderEmbeddedResourceFileAsText_EmbeddedTextFile_TextMatches()
{
string content = _asm.GetSameFolderEmbeddedResourceFileAsText<AssemblyExtensionsTest>("EmbeddedResource.txt");
Assert.Equal("text file content\r\nwith two lines", content);
}
[Fact]
public void GetSameFolderEmbeddedResourceFileAsLines_EmbeddedTextFile_TextMatches()
{
string[] content = _asm.GetSameFolderEmbeddedResourceFileAsLines<AssemblyExtensionsTest>("EmbeddedResource.txt");
Assert.Equal(2, content.Length);
Assert.Equal("text file content", content[0]);
Assert.Equal("with two lines", content[1]);
}
}
} | mit | C# |
e4b99fbaefb2e53ebeabbc96675652f4346350c5 | Revert "Attempt to fix #377 by ignoring a test fixture" | csf-dev/agiil,csf-dev/agiil,csf-dev/agiil,csf-dev/agiil | Tests/Agiil.Tests.Web/Services/Tickets/TicketUriProviderTests.cs | Tests/Agiil.Tests.Web/Services/Tickets/TicketUriProviderTests.cs | using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Agiil.Domain;
using Agiil.Domain.Tickets;
using Agiil.Tests.Attributes;
using Agiil.Web;
using Agiil.Web.Controllers;
using Agiil.Web.Services.Tickets;
using log4net;
using Moq;
using NUnit.Framework;
namespace Agiil.Tests.Web.Services.Tickets
{
[TestFixture,Parallelizable]
public class TicketUriProviderTests
{
[Test, AutoMoqData]
public void GetViewTicketUri_gets_correct_Uri_for_viewing_a_ticket(TicketReference reference)
{
var helper = Mock.Of<UrlHelper>();
var baseUriProvider = Mock.Of<IProvidesApplicationBaseUri>(x => x.GetBaseUri() == new Uri("http://example.com/"));
var sut = new TicketUriProvider(helper, Mock.Of<ILog>(), baseUriProvider);
Mock.Get(helper)
.Setup(x => x.Action(nameof(TicketController.Index), typeof(TicketController).AsControllerName(), It.IsAny<object>()))
.Returns("/One/Two");
var result = sut.GetViewTicketUri(reference);
Assert.That(result, Is.EqualTo(new Uri("http://example.com/One/Two")));
}
[Test, AutoMoqData]
public void GetViewTicketUri_gets_correct_Uri_for_editing_a_ticket(TicketReference reference, Uri expected)
{
var helper = Mock.Of<UrlHelper>();
var baseUriProvider = Mock.Of<IProvidesApplicationBaseUri>(x => x.GetBaseUri() == new Uri("http://example.com/"));
var sut = new TicketUriProvider(helper, Mock.Of<ILog>(), baseUriProvider);
Mock.Get(helper)
.Setup(x => x.Action(nameof(TicketController.Edit), typeof(TicketController).AsControllerName(), It.IsAny<object>()))
.Returns("/One/Two");
var result = sut.GetEditTicketUri(reference);
Assert.That(result, Is.EqualTo(new Uri("http://example.com/One/Two")));
}
}
}
| using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Agiil.Domain;
using Agiil.Domain.Tickets;
using Agiil.Tests.Attributes;
using Agiil.Web;
using Agiil.Web.Controllers;
using Agiil.Web.Services.Tickets;
using log4net;
using Moq;
using NUnit.Framework;
namespace Agiil.Tests.Web.Services.Tickets
{
[TestFixture,Parallelizable,Ignore("Temporarily ignored to see if this is the cause of hanging builds #AG377")]
public class TicketUriProviderTests
{
[Test, AutoMoqData]
public void GetViewTicketUri_gets_correct_Uri_for_viewing_a_ticket(TicketReference reference)
{
var helper = Mock.Of<UrlHelper>();
var baseUriProvider = Mock.Of<IProvidesApplicationBaseUri>(x => x.GetBaseUri() == new Uri("http://example.com/"));
var sut = new TicketUriProvider(helper, Mock.Of<ILog>(), baseUriProvider);
Mock.Get(helper)
.Setup(x => x.Action(nameof(TicketController.Index), typeof(TicketController).AsControllerName(), It.IsAny<object>()))
.Returns("/One/Two");
var result = sut.GetViewTicketUri(reference);
Assert.That(result, Is.EqualTo(new Uri("http://example.com/One/Two")));
}
[Test, AutoMoqData]
public void GetViewTicketUri_gets_correct_Uri_for_editing_a_ticket(TicketReference reference, Uri expected)
{
var helper = Mock.Of<UrlHelper>();
var baseUriProvider = Mock.Of<IProvidesApplicationBaseUri>(x => x.GetBaseUri() == new Uri("http://example.com/"));
var sut = new TicketUriProvider(helper, Mock.Of<ILog>(), baseUriProvider);
Mock.Get(helper)
.Setup(x => x.Action(nameof(TicketController.Edit), typeof(TicketController).AsControllerName(), It.IsAny<object>()))
.Returns("/One/Two");
var result = sut.GetEditTicketUri(reference);
Assert.That(result, Is.EqualTo(new Uri("http://example.com/One/Two")));
}
}
}
| mit | C# |
e18a055415c856db83520094e60d3109871a23f0 | add of provider run method, this will allow developers to define how they want to run an alert operation | Appleseed/base,Appleseed/base | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/IAlert.cs | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/IAlert.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
interface IAlert
{
List<UserAlert> GetUserAlertSchedules(string scheudle);
JSONRootObject GetAlert(string query);
Task SendAlert(string email, string link, JSONRootObject results, object mailResponse);
bool UpdateUserSendDate(Guid userID, DateTime date);
bool Run();
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
interface IAlert
{
List<UserAlert> GetUserAlertSchedules(string scheudle);
JSONRootObject GetAlert(string query);
Task SendAlert(string email, string link, JSONRootObject results, object mailResponse);
bool UpdateUserSendDate(Guid userID, DateTime date);
}
}
| apache-2.0 | C# |
da7e3d9dab3d45a86dcc6c7e23f5ceeb4baf9674 | Add a message of the InvalidOperationException. | averrunci/Carna | Source/Carna/Assertions/ActualValueProperty.cs | Source/Carna/Assertions/ActualValueProperty.cs | // Copyright (C) 2019 Fievus
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
using System;
namespace Carna.Assertions
{
/// <summary>
/// Represents a property that is asserted by an assertion object.
/// This property does not assert any assertion properties.
/// </summary>
/// <typeparam name="TValue">The type of the property value to assert.</typeparam>
public class ActualValueProperty<TValue> : AssertionProperty<TValue>
{
/// <summary>
/// Initializes a new instance of the <see cref="ActualValueProperty{TValue}"/> class
/// with the specified property value to assert.
/// </summary>
/// <param name="value">The value of the property to assert.</param>
public ActualValueProperty(TValue value) : base(value)
{
}
/// <summary>
/// Asserts the specified property value.
/// </summary>
/// <param name="other">The value of the property to assert.</param>
/// <returns>
/// <c>true</c> if the specified property value is asserted; otherwise <c>false</c>.
/// </returns>
protected override bool Assert(TValue other) => throw new InvalidOperationException($"{nameof(ActualValueProperty<TValue>)} can't assert any values.");
/// <summary>
/// Asserts the specified <see cref="IAssertionProperty"/>.
/// </summary>
/// <param name="other">The <see cref="IAssertionProperty"/> to assert.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="IAssertionProperty"/> is asserted; otherwise <c>false</c>.
/// </returns>
protected override bool Assert(IAssertionProperty other) => throw new InvalidOperationException($"{nameof(ActualValueProperty<TValue>)} can't assert any assertion properties.");
}
}
| // Copyright (C) 2019 Fievus
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
using System;
namespace Carna.Assertions
{
/// <summary>
/// Represents a property that is asserted by an assertion object.
/// This property does not assert any assertion properties.
/// </summary>
/// <typeparam name="TValue">The type of the property value to assert.</typeparam>
public class ActualValueProperty<TValue> : AssertionProperty<TValue>
{
/// <summary>
/// Initializes a new instance of the <see cref="ActualValueProperty{TValue}"/> class
/// with the specified property value to assert.
/// </summary>
/// <param name="value">The value of the property to assert.</param>
public ActualValueProperty(TValue value) : base(value)
{
}
/// <summary>
/// Asserts the specified property value.
/// </summary>
/// <param name="other">The value of the property to assert.</param>
/// <returns>
/// <c>true</c> if the specified property value is asserted; otherwise <c>false</c>.
/// </returns>
protected override bool Assert(TValue other) => throw new InvalidOperationException();
/// <summary>
/// Asserts the specified <see cref="IAssertionProperty"/>.
/// </summary>
/// <param name="other">The <see cref="IAssertionProperty"/> to assert.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="IAssertionProperty"/> is asserted; otherwise <c>false</c>.
/// </returns>
protected override bool Assert(IAssertionProperty other) => throw new InvalidOperationException();
}
}
| mit | C# |
5957b42aa8ff32e641c15fd2eddd80c2372a53a4 | fix wpf clipboard functionality (#1121) | lbochenek/react-native-windows,lbochenek/react-native-windows,lbochenek/react-native-windows,lbochenek/react-native-windows | ReactWindows/ReactNative.Net46/Modules/Clipboard/ClipboardModule.cs | ReactWindows/ReactNative.Net46/Modules/Clipboard/ClipboardModule.cs | using ReactNative.Bridge;
using System;
namespace ReactNative.Modules.Clipboard
{
/// <summary>
/// A module that allows JS to get/set clipboard contents.
/// </summary>
class ClipboardModule : NativeModuleBase
{
private readonly IClipboardInstance _clipboard;
public ClipboardModule() : this(new ClipboardInstance())
{
}
public ClipboardModule(IClipboardInstance clipboard)
{
_clipboard = clipboard;
}
/// <summary>
/// The name of the native module.
/// </summary>
public override string Name
{
get
{
return "Clipboard";
}
}
/// <summary>
/// Get the clipboard content through a promise.
/// </summary>
/// <param name="promise">The promise.</param>
[ReactMethod]
public void getString(IPromise promise)
{
if (promise == null)
{
throw new ArgumentNullException(nameof(promise));
}
DispatcherHelpers.RunOnDispatcher(() =>
{
if (_clipboard.ContainsText())
{
var text = _clipboard.GetText();
promise.Resolve(text);
}
else
{
promise.Resolve("");
}
});
}
/// <summary>
/// Add text to the clipboard or clear the clipboard.
/// </summary>
/// <param name="text">The text. If null clear clipboard.</param>
[ReactMethod]
public void setString(string text)
{
DispatcherHelpers.RunOnDispatcher(new Action(() =>
{
_clipboard.SetText(text);
}));
}
}
}
| using ReactNative.Bridge;
using System;
namespace ReactNative.Modules.Clipboard
{
/// <summary>
/// A module that allows JS to get/set clipboard contents.
/// </summary>
class ClipboardModule : NativeModuleBase
{
private readonly IClipboardInstance _clipboard;
public ClipboardModule() : this(new ClipboardInstance())
{
}
public ClipboardModule(IClipboardInstance clipboard)
{
_clipboard = clipboard;
}
/// <summary>
/// The name of the native module.
/// </summary>
public override string Name
{
get
{
return "Clipboard";
}
}
/// <summary>
/// Get the clipboard content through a promise.
/// </summary>
/// <param name="promise">The promise.</param>
[ReactMethod]
public void getString(IPromise promise)
{
if (promise == null)
{
throw new ArgumentNullException(nameof(promise));
}
if (_clipboard.ContainsText())
{
var text = _clipboard.GetText();
promise.Resolve(text);
}
else
{
promise.Resolve("");
}
}
/// <summary>
/// Add text to the clipboard or clear the clipboard.
/// </summary>
/// <param name="text">The text. If null clear clipboard.</param>
[ReactMethod]
public void setString(string text)
{
_clipboard.SetText(text);
}
}
}
| mit | C# |
5498ea531b566e32667319f6ff3f65715938d63d | Update test.cs | johnmott59/PolygonClippingInCSharp | GrinerTest/PolygonClip/test.cs | GrinerTest/PolygonClip/test.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GrienerTest
{
public partial class PolygonClip
{
#if false
/*
* This is a test for crossing from one polygon to another. I think it determines whether the first point is inside or outside
*/
int test(node *point, node *p)
{
node *aux, *left, i;
int type=0;
left = create(0, point->y, 0, 0, 0, 0, 0, 0, 0, 0.);
for(aux=p; aux->next; aux=aux->next)
if(I(left, point, aux, aux->next, &i.alpha, &i.alpha, &i.x, &i.y)) type++;
return type%2;
}
#endif
int test(Node point, Node p)
{
Node aux, left, i;
int type = 0;
i = new Node();
/*
* Note that this create call uses '0' as the x value. This works fine
* as long as all points are in the first quadrant. If you have negative
* points this call should find a point larger or smaller than all
* points in the test polygon denoted by 'p'
*/
left = create(0, point.y, null,null,null,null , 0, 0, 0, 0);
for (aux = p; aux.next != null; aux = aux.next)
{
float alpha = 0;
int x = 0;
int y = 0;
if (I(left, point, aux, aux.next, out alpha, out alpha, out x, out y) == 1) type++;
i.alpha = alpha;
i.x = x;
i.y = y;
}
return type % 2;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GrienerTest
{
public partial class PolygonClip
{
#if false
/*
* This is a test for crossing from one polygon to another. I think it determines whether the first point is inside or outside
*/
int test(node *point, node *p)
{
node *aux, *left, i;
int type=0;
left = create(0, point->y, 0, 0, 0, 0, 0, 0, 0, 0.);
for(aux=p; aux->next; aux=aux->next)
if(I(left, point, aux, aux->next, &i.alpha, &i.alpha, &i.x, &i.y)) type++;
return type%2;
}
#endif
int test(Node point, Node p)
{
Node aux, left, i;
int type = 0;
i = new Node();
left = create(0, point.y, null,null,null,null , 0, 0, 0, 0);
for (aux = p; aux.next != null; aux = aux.next)
{
float alpha = 0;
int x = 0;
int y = 0;
if (I(left, point, aux, aux.next, out alpha, out alpha, out x, out y) == 1) type++;
i.alpha = alpha;
i.x = x;
i.y = y;
}
return type % 2;
}
}
}
| unlicense | C# |
55607634b4cebcd74c1130293222845923099525 | Fix covers being loaded even when off-screen | 2yangk23/osu,DrabWeb/osu,peppy/osu,UselessToucan/osu,2yangk23/osu,DrabWeb/osu,ppy/osu,naoey/osu,johnneijzen/osu,ZLima12/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,smoogipooo/osu,peppy/osu-new,smoogipoo/osu,DrabWeb/osu,ZLima12/osu,smoogipoo/osu,naoey/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,peppy/osu,naoey/osu,UselessToucan/osu,EVAST9919/osu,ppy/osu | osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs | osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Beatmaps.Drawables
{
/// <summary>
/// Display a baetmap background from a local source, but fallback to online source if not available.
/// </summary>
public class UpdateableBeatmapBackgroundSprite : ModelBackedDrawable<BeatmapInfo>
{
public readonly IBindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
[Resolved]
private BeatmapManager beatmaps { get; set; }
public UpdateableBeatmapBackgroundSprite()
{
Beatmap.BindValueChanged(b => Model = b);
}
protected override Drawable CreateDrawable(BeatmapInfo model)
{
return new DelayedLoadUnloadWrapper(() => {
Drawable drawable;
var localBeatmap = beatmaps.GetWorkingBeatmap(model);
if (localBeatmap.BeatmapInfo.ID == 0 && model?.BeatmapSet?.OnlineInfo != null)
drawable = new BeatmapSetCover(model.BeatmapSet);
else
drawable = new BeatmapBackgroundSprite(localBeatmap);
drawable.RelativeSizeAxes = Axes.Both;
drawable.Anchor = Anchor.Centre;
drawable.Origin = Anchor.Centre;
drawable.FillMode = FillMode.Fill;
drawable.OnLoadComplete = d => d.FadeInFromZero(400);
return drawable;
}, 500, 10000);
}
protected override double FadeDuration => 0;
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Beatmaps.Drawables
{
/// <summary>
/// Display a baetmap background from a local source, but fallback to online source if not available.
/// </summary>
public class UpdateableBeatmapBackgroundSprite : ModelBackedDrawable<BeatmapInfo>
{
public readonly IBindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
[Resolved]
private BeatmapManager beatmaps { get; set; }
public UpdateableBeatmapBackgroundSprite()
{
Beatmap.BindValueChanged(b => Model = b);
}
protected override Drawable CreateDrawable(BeatmapInfo model)
{
Drawable drawable;
var localBeatmap = beatmaps.GetWorkingBeatmap(model);
if (localBeatmap.BeatmapInfo.ID == 0 && model?.BeatmapSet?.OnlineInfo != null)
drawable = new BeatmapSetCover(model.BeatmapSet);
else
drawable = new BeatmapBackgroundSprite(localBeatmap);
drawable.RelativeSizeAxes = Axes.Both;
drawable.Anchor = Anchor.Centre;
drawable.Origin = Anchor.Centre;
drawable.FillMode = FillMode.Fill;
return drawable;
}
protected override double FadeDuration => 400;
}
}
| mit | C# |
0daa2b97c7219344c4d235212916d1e5af16f410 | Comment IMetadataStringDecoderProvider | krytarowski/corert,kyulee1/corert,botaberg/corert,schellap/corert,shrah/corert,shrah/corert,schellap/corert,mjp41/corert,manu-silicon/corert,krytarowski/corert,manu-silicon/corert,sandreenko/corert,kyulee1/corert,tijoytom/corert,gregkalapos/corert,botaberg/corert,gregkalapos/corert,sandreenko/corert,kyulee1/corert,sandreenko/corert,manu-silicon/corert,tijoytom/corert,botaberg/corert,shrah/corert,manu-silicon/corert,mjp41/corert,schellap/corert,krytarowski/corert,schellap/corert,yizhang82/corert,manu-silicon/corert,mjp41/corert,yizhang82/corert,mjp41/corert,tijoytom/corert,schellap/corert,yizhang82/corert,gregkalapos/corert,gregkalapos/corert,tijoytom/corert,kyulee1/corert,krytarowski/corert,sandreenko/corert,yizhang82/corert,mjp41/corert,botaberg/corert,shrah/corert | src/Common/src/TypeSystem/Ecma/IMetadataStringDecoderProvider.cs | src/Common/src/TypeSystem/Ecma/IMetadataStringDecoderProvider.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 System.Reflection.Metadata;
namespace Internal.TypeSystem.Ecma
{
/// <summary>
/// Interface implemented by TypeSystemContext to provide MetadataStringDecoder
/// instance for MetadataReaders created by the type system.
/// </summary>
public interface IMetadataStringDecoderProvider
{
MetadataStringDecoder GetMetadataStringDecoder();
}
}
| // 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 System.Reflection.Metadata;
namespace Internal.TypeSystem.Ecma
{
public interface IMetadataStringDecoderProvider
{
MetadataStringDecoder GetMetadataStringDecoder();
}
}
| mit | C# |
d0c0e8dd853054ae5c821ea73ac0c7cc86b1413b | Make ILSpan internal | rgani/roslyn,rgani/roslyn,tannergooding/roslyn,jmarolf/roslyn,diryboy/roslyn,ljw1004/roslyn,mavasani/roslyn,Hosch250/roslyn,paulvanbrenk/roslyn,orthoxerox/roslyn,OmarTawfik/roslyn,agocke/roslyn,SeriaWei/roslyn,zooba/roslyn,jhendrixMSFT/roslyn,xasx/roslyn,genlu/roslyn,kelltrick/roslyn,vslsnap/roslyn,jmarolf/roslyn,aelij/roslyn,zooba/roslyn,VSadov/roslyn,TyOverby/roslyn,Hosch250/roslyn,DustinCampbell/roslyn,davkean/roslyn,ValentinRueda/roslyn,tmeschter/roslyn,basoundr/roslyn,abock/roslyn,abock/roslyn,Giftednewt/roslyn,Giftednewt/roslyn,KevinH-MS/roslyn,yeaicc/roslyn,pdelvo/roslyn,amcasey/roslyn,AlekseyTs/roslyn,balajikris/roslyn,budcribar/roslyn,OmarTawfik/roslyn,Shiney/roslyn,jamesqo/roslyn,SeriaWei/roslyn,ValentinRueda/roslyn,cston/roslyn,khyperia/roslyn,genlu/roslyn,khellang/roslyn,jeffanders/roslyn,Pvlerick/roslyn,KirillOsenkov/roslyn,ErikSchierboom/roslyn,michalhosala/roslyn,eriawan/roslyn,natgla/roslyn,eriawan/roslyn,dotnet/roslyn,MattWindsor91/roslyn,AArnott/roslyn,bartdesmet/roslyn,ErikSchierboom/roslyn,jcouv/roslyn,gafter/roslyn,ErikSchierboom/roslyn,brettfo/roslyn,michalhosala/roslyn,TyOverby/roslyn,VSadov/roslyn,gafter/roslyn,robinsedlaczek/roslyn,aelij/roslyn,sharwell/roslyn,stephentoub/roslyn,kelltrick/roslyn,amcasey/roslyn,dotnet/roslyn,xasx/roslyn,heejaechang/roslyn,mattwar/roslyn,AlekseyTs/roslyn,Shiney/roslyn,lorcanmooney/roslyn,abock/roslyn,drognanar/roslyn,jamesqo/roslyn,swaroop-sridhar/roslyn,physhi/roslyn,bkoelman/roslyn,khellang/roslyn,mmitche/roslyn,KevinRansom/roslyn,orthoxerox/roslyn,khyperia/roslyn,amcasey/roslyn,tvand7093/roslyn,swaroop-sridhar/roslyn,sharadagrawal/Roslyn,khellang/roslyn,ericfe-ms/roslyn,robinsedlaczek/roslyn,MatthieuMEZIL/roslyn,jhendrixMSFT/roslyn,heejaechang/roslyn,mmitche/roslyn,srivatsn/roslyn,budcribar/roslyn,weltkante/roslyn,ericfe-ms/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,CaptainHayashi/roslyn,mmitche/roslyn,jaredpar/roslyn,nguerrera/roslyn,mgoertz-msft/roslyn,xoofx/roslyn,jcouv/roslyn,jasonmalinowski/roslyn,tmat/roslyn,dotnet/roslyn,bbarry/roslyn,AnthonyDGreen/roslyn,ValentinRueda/roslyn,dpoeschl/roslyn,MattWindsor91/roslyn,natidea/roslyn,heejaechang/roslyn,reaction1989/roslyn,panopticoncentral/roslyn,jcouv/roslyn,mavasani/roslyn,leppie/roslyn,leppie/roslyn,vcsjones/roslyn,AnthonyDGreen/roslyn,jasonmalinowski/roslyn,xoofx/roslyn,MichalStrehovsky/roslyn,balajikris/roslyn,sharadagrawal/Roslyn,eriawan/roslyn,pdelvo/roslyn,davkean/roslyn,mattscheffer/roslyn,sharwell/roslyn,xoofx/roslyn,natgla/roslyn,physhi/roslyn,gafter/roslyn,shyamnamboodiripad/roslyn,rgani/roslyn,bartdesmet/roslyn,panopticoncentral/roslyn,Pvlerick/roslyn,ericfe-ms/roslyn,tmat/roslyn,AmadeusW/roslyn,cston/roslyn,AArnott/roslyn,VSadov/roslyn,MattWindsor91/roslyn,pdelvo/roslyn,physhi/roslyn,jaredpar/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,leppie/roslyn,kelltrick/roslyn,DustinCampbell/roslyn,aelij/roslyn,KevinRansom/roslyn,sharadagrawal/Roslyn,KevinRansom/roslyn,jaredpar/roslyn,stephentoub/roslyn,bkoelman/roslyn,jmarolf/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,cston/roslyn,jkotas/roslyn,akrisiun/roslyn,MichalStrehovsky/roslyn,CyrusNajmabadi/roslyn,paulvanbrenk/roslyn,shyamnamboodiripad/roslyn,tvand7093/roslyn,stephentoub/roslyn,lorcanmooney/roslyn,zooba/roslyn,mgoertz-msft/roslyn,jasonmalinowski/roslyn,srivatsn/roslyn,bbarry/roslyn,KevinH-MS/roslyn,TyOverby/roslyn,mattwar/roslyn,ljw1004/roslyn,OmarTawfik/roslyn,mgoertz-msft/roslyn,nguerrera/roslyn,balajikris/roslyn,tmeschter/roslyn,wvdd007/roslyn,Giftednewt/roslyn,xasx/roslyn,mattscheffer/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,CaptainHayashi/roslyn,weltkante/roslyn,mattwar/roslyn,mavasani/roslyn,yeaicc/roslyn,dpoeschl/roslyn,jeffanders/roslyn,brettfo/roslyn,basoundr/roslyn,KirillOsenkov/roslyn,a-ctor/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,khyperia/roslyn,KiloBravoLima/roslyn,Pvlerick/roslyn,bkoelman/roslyn,KirillOsenkov/roslyn,MattWindsor91/roslyn,vslsnap/roslyn,dpoeschl/roslyn,vslsnap/roslyn,tmeschter/roslyn,swaroop-sridhar/roslyn,jhendrixMSFT/roslyn,wvdd007/roslyn,KevinH-MS/roslyn,lorcanmooney/roslyn,AnthonyDGreen/roslyn,tannergooding/roslyn,SeriaWei/roslyn,natidea/roslyn,MatthieuMEZIL/roslyn,AArnott/roslyn,Hosch250/roslyn,ljw1004/roslyn,tvand7093/roslyn,a-ctor/roslyn,agocke/roslyn,reaction1989/roslyn,DustinCampbell/roslyn,jkotas/roslyn,davkean/roslyn,tmat/roslyn,MatthieuMEZIL/roslyn,wvdd007/roslyn,nguerrera/roslyn,bbarry/roslyn,mattscheffer/roslyn,akrisiun/roslyn,natidea/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,vcsjones/roslyn,weltkante/roslyn,AlekseyTs/roslyn,agocke/roslyn,jeffanders/roslyn,jamesqo/roslyn,MichalStrehovsky/roslyn,a-ctor/roslyn,reaction1989/roslyn,drognanar/roslyn,yeaicc/roslyn,Shiney/roslyn,tannergooding/roslyn,KiloBravoLima/roslyn,basoundr/roslyn,brettfo/roslyn,srivatsn/roslyn,vcsjones/roslyn,drognanar/roslyn,jkotas/roslyn,michalhosala/roslyn,CyrusNajmabadi/roslyn,orthoxerox/roslyn,budcribar/roslyn,CaptainHayashi/roslyn,KiloBravoLima/roslyn,genlu/roslyn,diryboy/roslyn,akrisiun/roslyn,diryboy/roslyn,robinsedlaczek/roslyn,paulvanbrenk/roslyn,natgla/roslyn,AmadeusW/roslyn | src/ExpressionEvaluator/Core/Source/ExpressionCompiler/ILSpan.cs | src/ExpressionEvaluator/Core/Source/ExpressionCompiler/ILSpan.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.ExpressionEvaluator
{
// TODO: use TextSpan?
internal struct ILSpan : IEquatable<ILSpan>
{
public static readonly ILSpan MaxValue = new ILSpan(0, uint.MaxValue);
public readonly uint StartOffset;
public readonly uint EndOffsetExclusive;
public ILSpan(uint start, uint end)
{
Debug.Assert(start <= end);
StartOffset = start;
EndOffsetExclusive = end;
}
public bool Contains(int offset) => offset >= StartOffset && offset < EndOffsetExclusive;
public bool Equals(ILSpan other) => StartOffset == other.StartOffset && EndOffsetExclusive == other.EndOffsetExclusive;
public override bool Equals(object obj) => obj is ILSpan && Equals((ILSpan)obj);
public override int GetHashCode() => Hash.Combine(StartOffset.GetHashCode(), EndOffsetExclusive.GetHashCode());
public override string ToString() => $"[{StartOffset}, {EndOffsetExclusive})";
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.ExpressionEvaluator
{
// TODO: use TextSpan?
public struct ILSpan : IEquatable<ILSpan>
{
public static readonly ILSpan MaxValue = new ILSpan(0, uint.MaxValue);
public readonly uint StartOffset;
public readonly uint EndOffsetExclusive;
public ILSpan(uint start, uint end)
{
Debug.Assert(start <= end);
StartOffset = start;
EndOffsetExclusive = end;
}
public bool Contains(int offset) => offset >= StartOffset && offset < EndOffsetExclusive;
public bool Equals(ILSpan other) => StartOffset == other.StartOffset && EndOffsetExclusive == other.EndOffsetExclusive;
public override bool Equals(object obj) => obj is ILSpan && Equals((ILSpan)obj);
public override int GetHashCode() => Hash.Combine(StartOffset.GetHashCode(), EndOffsetExclusive.GetHashCode());
public override string ToString() => $"[{StartOffset}, {EndOffsetExclusive})";
}
}
| mit | C# |
aecd1c5ea46353fc73ccee8a85af6287c2aeec08 | Fix description | kraskoo/AssemblyPoolLibrary | AssemblyPoolLibrary/Library/Properties/AssemblyInfo.cs | AssemblyPoolLibrary/Library/Properties/AssemblyInfo.cs | using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AssemblyPoolLibrary")]
[assembly: AssemblyDescription("Contains three classes with dependency between them, ProjectNameContainer is a public non-static")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Library")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f1fda31b-4bf7-4efc-875c-5246b4489b7a")]
// 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.1.1")]
[assembly: AssemblyFileVersion("1.1.1.1")]
[assembly: NeutralResourcesLanguage("en")]
| using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AssemblyPoolLibrary")]
[assembly: AssemblyDescription("Contains three classes with dependency between them, ProjectNameContainer is a public non-static class with")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Library")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f1fda31b-4bf7-4efc-875c-5246b4489b7a")]
// 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.1.1")]
[assembly: AssemblyFileVersion("1.1.1.1")]
[assembly: NeutralResourcesLanguage("en")]
| mit | C# |
dec6bdb917a85c21c64571c406ab84afc2134a0b | update comment | bitzhuwei/CSharpGL,bitzhuwei/CSharpGL,bitzhuwei/CSharpGL | CSharpGL/Scene/SceneNodes/RenderUnits/IBufferSource.cs | CSharpGL/Scene/SceneNodes/RenderUnits/IBufferSource.cs | using System.Collections.Generic;
namespace CSharpGL
{
/// <summary>
/// Provides <see cref="VertexBuffer"/>s and <see cref="IDrawCommand"/>s for GPU memory from data in CPU memory.
/// </summary>
public interface IBufferSource
{
/// <summary>
/// Gets vertex buffers of the vertex attribute specified with <paramref name="bufferName"/>.
/// <para>The vertex buffer is sliced into blocks of same size(except the last one when the remainder is not 0.) I recommend 1024*1024*4(bytes) as block size, which is the block size in OVITO.</para>
/// </summary>
/// <param name="bufferName">user defined buffer name used to specify vertex attribute.</param>
/// <returns></returns>
IEnumerable<VertexBuffer> GetVertexAttributeBuffer(string bufferName);
/// <summary>
/// Gets the <see cref="IDrawCommand"/> used to draw with vertex attribute buffers.
/// </summary>
/// <returns></returns>
IEnumerable<IDrawCommand> GetDrawCommand();
}
} | using System.Collections.Generic;
namespace CSharpGL
{
/// <summary>
/// Data for CPU(model) -> Data for GPU(opengl buffer)
/// <para>从模型的数据格式转换为<see cref="GLBuffer"/></para>,
/// <see cref="GLBuffer"/>则可用于控制GPU的渲染操作。
/// </summary>
public interface IBufferSource
{
/// <summary>
/// Gets vertex buffer of some vertex attribute specified with <paramref name="bufferName"/>.
/// <para>The vertex buffer is sliced into blocks of same size(except the last one when the remainder is not 0.) I recommend 1024*1024*4 as block size, which is the block size in OVITO.</para>
/// </summary>
/// <param name="bufferName">CPU代码指定的buffer名字,用以区分各个用途的buffer。</param>
/// <returns></returns>
IEnumerable<VertexBuffer> GetVertexAttributeBuffer(string bufferName);
/// <summary>
/// </summary>
/// <returns></returns>
IEnumerable<IDrawCommand> GetDrawCommand();
}
} | mit | C# |
e1d0481ee71ce8ca1b0b059fe22f6d8407355c14 | bump minor | FacturAPI/facturapi-net | facturapi-net/Properties/AssemblyInfo.cs | facturapi-net/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("Facturapi")]
[assembly: AssemblyDescription("Factura electrónica para desarrolladores")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Facturapi")]
[assembly: AssemblyProduct("Facturapi")]
[assembly: AssemblyCopyright("Copyright © Facturapi 2017")]
[assembly: AssemblyTrademark("Facturapi")]
[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("a91d3cf3-1051-41f4-833e-c52ee8fbce20")]
// 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.1.*")]
[assembly: AssemblyFileVersion("0.2.1.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Facturapi")]
[assembly: AssemblyDescription("Factura electrónica para desarrolladores")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Facturapi")]
[assembly: AssemblyProduct("Facturapi")]
[assembly: AssemblyCopyright("Copyright © Facturapi 2017")]
[assembly: AssemblyTrademark("Facturapi")]
[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("a91d3cf3-1051-41f4-833e-c52ee8fbce20")]
// 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.4.*")]
[assembly: AssemblyFileVersion("0.1.4.0")]
| mit | C# |
330ec127adf7276f9235d50f089892b5719e434f | Use a workaround to make Mapping_from_the_default_file_path pass on .NET Core | edpollitt/Nerdle.AutoConfig | Nerdle.AutoConfig.Tests.Integration/UsingDefaultConfigFilePath.cs | Nerdle.AutoConfig.Tests.Integration/UsingDefaultConfigFilePath.cs | using FluentAssertions;
using NUnit.Framework;
namespace Nerdle.AutoConfig.Tests.Integration
{
[TestFixture]
public class UsingDefaultConfigFilePath
#if NETCOREAPP
: System.IDisposable
{
private readonly string _configFilePath;
// In order to workaround flaky interaction between the test runner and System.Configuration.ConfigurationManager
// See https://github.com/nunit/nunit3-vs-adapter/issues/356#issuecomment-700754225
public UsingDefaultConfigFilePath()
{
_configFilePath = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None).FilePath;
System.IO.File.Copy($"{System.Reflection.Assembly.GetExecutingAssembly().Location}.config", _configFilePath, overwrite: true);
}
public void Dispose()
{
System.IO.File.Delete(_configFilePath);
}
#else
{
#endif
[Test]
public void Mapping_from_the_default_file_path()
{
var foo = AutoConfig.Map<IFoo>();
var bar = AutoConfig.Map<IFoo>("bar");
foo.Should().NotBeNull();
foo.Name.Should().Be("foo");
bar.Should().NotBeNull();
bar.Name.Should().Be("bar");
}
public interface IFoo
{
string Name { get; }
}
}
}
| using FluentAssertions;
using NUnit.Framework;
namespace Nerdle.AutoConfig.Tests.Integration
{
[TestFixture]
public class UsingDefaultConfigFilePath
{
[Test]
#if NETCOREAPP
[Ignore("Buggy interaction between the test runner and System.Configuration.ConfigurationManager, see https://github.com/nunit/nunit3-vs-adapter/issues/356")]
#endif
public void Mapping_from_the_default_file_path()
{
var foo = AutoConfig.Map<IFoo>();
var bar = AutoConfig.Map<IFoo>("bar");
foo.Should().NotBeNull();
foo.Name.Should().Be("foo");
bar.Should().NotBeNull();
bar.Name.Should().Be("bar");
}
public interface IFoo
{
string Name { get; }
}
}
}
| mit | C# |
072bddbded78e5ad9a27b417ef1b85efe1eef5be | add plus score using game manager, also dead method too | endlessz/Flappy-Cube | Assets/Scripts/Player.cs | Assets/Scripts/Player.cs | using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
public class Player : MonoBehaviour {
[Header("Movement of the player")]
public float jumpHeight;
public float forwardSpeed;
private Rigidbody2D mainRigidbody2D;
void Start()
{
mainRigidbody2D = GetComponent<Rigidbody2D> ();
mainRigidbody2D.isKinematic = true; //Player not fall when in PREGAME states
}
// Update is called once per frame
void Update () {
//If Player go out off screen
if ((transform.position.y > getMaxWidth() || transform.position.y < -getMaxWidth() ) && GameManager.instance.currentState == GameStates.INGAME) {
Dead();
}
//When click or touch and in INGAME states
if ((Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space)) && GameManager.instance.currentState == GameStates.INGAME){
Jump();
}
//When click or touch and in PREGAME states
if ((Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space)) && GameManager.instance.currentState == GameStates.PREGAME){
mainRigidbody2D.isKinematic = false;
GameManager.instance.startGame();
}
}
private void Jump(){
mainRigidbody2D.velocity = new Vector2(forwardSpeed,jumpHeight);
}
private void Dead(){
mainRigidbody2D.freezeRotation = false;
GameManager.instance.gameOver ();
}
void OnCollisionEnter2D(Collision2D other)
{
if (other.transform.tag == "Obstacle" && GameManager.instance.currentState == GameStates.INGAME) {
Dead ();
}
}
void OnTriggerEnter2D(Collider2D other){
if (other.tag == "Score" && GameManager.instance.currentState == GameStates.INGAME) {
ObstacleSpawner.instance.spawnObstacle();
GameManager.instance.addScore();
Destroy(other.gameObject);
}
}
private float getMaxWidth(){
Vector2 cameraWidth = Camera.main.ScreenToWorldPoint (new Vector2 (Screen.width, Screen.height));
float playerWidth = GetComponent<Renderer>().bounds.extents.y;
return cameraWidth.y + playerWidth;
}
}
| using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
public class Player : MonoBehaviour {
[Header("Movement of the player")]
public float jumpHeight;
public float forwardSpeed;
private Rigidbody2D mainRigidbody2D;
void Start()
{
mainRigidbody2D = GetComponent<Rigidbody2D> ();
mainRigidbody2D.isKinematic = true; //Player not fall when in PREGAME states
}
// Update is called once per frame
void Update () {
//If Player go out off screen
if ((transform.position.y > getMaxWidth() || transform.position.y < -getMaxWidth() ) && GameManager.instance.currentState == GameStates.INGAME) {
Dead();
}
//When click or touch and in INGAME states
if ((Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space)) && GameManager.instance.currentState == GameStates.INGAME){
Jump();
}
//When click or touch and in PREGAME states
if ((Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space)) && GameManager.instance.currentState == GameStates.PREGAME){
mainRigidbody2D.isKinematic = false;
GameManager.instance.startGame();
}
}
private void Jump(){
mainRigidbody2D.velocity = new Vector2(forwardSpeed,jumpHeight);
}
private void Dead(){
mainRigidbody2D.freezeRotation = false;
Debug.Log("Game Over");
}
void OnCollisionEnter2D(Collision2D other)
{
if (other.transform.tag == "Obstacle") {
Dead ();
}
}
void OnTriggerEnter2D(Collider2D other){
if (other.tag == "Score") {
ObstacleSpawner.instance.spawnObstacle();
Destroy(other.gameObject);
}
}
private float getMaxWidth(){
Vector2 cameraWidth = Camera.main.ScreenToWorldPoint (new Vector2 (Screen.width, Screen.height));
float playerWidth = GetComponent<Renderer>().bounds.extents.y;
return cameraWidth.y + playerWidth;
}
}
| mit | C# |
bdaa15dbfbbb26805795f5abf63e0db56aadb12e | Throw exception if more than one expression is passed to Evaluate | ckuhn203/Antlr4Calculator | Calculator/Calculator.cs | Calculator/Calculator.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Antlr4;
using Antlr4.Runtime;
namespace Rubberduck.Math
{
public static class Calculator
{
public static int Evaluate(string expression)
{
var lexer = new BasicMathLexer(new AntlrInputStream(expression));
lexer.RemoveErrorListeners();
lexer.AddErrorListener(new ThrowExceptionErrorListener());
var tokens = new CommonTokenStream(lexer);
var parser = new BasicMathParser(tokens);
var tree = parser.compileUnit();
var exprCount = tree.expression().Count;
if (exprCount > 1)
{
throw new ArgumentException(String.Format("Too many expressions. Only one can be evaluated. {0} expressions were entered.", exprCount));
}
var visitor = new IntegerMathVisitor();
return visitor.Visit(tree);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Antlr4;
using Antlr4.Runtime;
namespace Rubberduck.Math
{
public static class Calculator
{
public static int Evaluate(string expression)
{
var lexer = new BasicMathLexer(new AntlrInputStream(expression));
lexer.RemoveErrorListeners();
lexer.AddErrorListener(new ThrowExceptionErrorListener());
var tokens = new CommonTokenStream(lexer);
var parser = new BasicMathParser(tokens);
var tree = parser.compileUnit();
var visitor = new IntegerMathVisitor();
return visitor.Visit(tree);
}
}
}
| mit | C# |
8e48639379a28a92ec753ad82ac91f8116ae0776 | switch cors to be after mvc | MassDebaters/DebateApp,MassDebaters/DebateApp,MassDebaters/DebateApp | DebateAppDomain/DebateAppDomainAPI/Startup.cs | DebateAppDomain/DebateAppDomainAPI/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.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace DebateAppDomainAPI
{
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();
services.AddCors();
}
// 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.UseCors(builder =>
builder.WithOrigins("http://localhost:8000")
.AllowAnyHeader().WithOrigins("http://localhost/Mansion"));
app.UseMvc();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace DebateAppDomainAPI
{
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();
services.AddCors();
}
// 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.UseMvc();
app.UseCors(builder =>
builder.WithOrigins("http://localhost:8000")
.AllowAnyHeader().WithOrigins("http://localhost/Mansion"));
}
}
}
| mit | C# |
d358c31649b65fdc8f58408f4e174bc00a4ad741 | Rename status | grantcolley/dipstate | DevelopmentInProgress.DipState/StateStatus.cs | DevelopmentInProgress.DipState/StateStatus.cs | namespace DevelopmentInProgress.DipState
{
/// <summary>
/// The status of the state.
/// </summary>
public enum StateStatus
{
/// <summary>
/// Indicates the state has not been entered.
/// </summary>
Uninitialise = 1,
/// <summary>
/// Indicates the state has been entered and is active.
/// </summary>
Initialise = 2,
/// <summary>
/// Indicates the state is active and in progress.
/// </summary>
InProgress = 3,
/// <summary>
/// Indiactes the state has been successfully completed.
/// </summary>
Complete = 4,
/// <summary>
/// Indiactes the state has failed.
/// </summary>
Fail = 5
}
} | namespace DevelopmentInProgress.DipState
{
/// <summary>
/// The status of the state.
/// </summary>
public enum StateStatus
{
/// <summary>
/// Indicates the state has not been entered.
/// </summary>
Uninitialised = 1,
/// <summary>
/// Indicates the state has been entered and is active.
/// </summary>
Initialised = 2,
/// <summary>
/// Indicates the state is active and in progress.
/// </summary>
InProgress = 3,
/// <summary>
/// Indiactes the state has been successfully completed.
/// </summary>
Completed = 4,
/// <summary>
/// Indiactes the state has failed.
/// </summary>
Failed = 5
}
} | apache-2.0 | C# |
e33c778ad8633864afc3c8587b6acb11a8dc18e4 | Fix null references when game object is destroyed | DarrenTsung/DTCommandPalette | Editor/GameObjectCommand/GameObjectCommand.cs | Editor/GameObjectCommand/GameObjectCommand.cs | using System.IO;
using UnityEditor;
using UnityEngine;
namespace DTCommandPalette {
public abstract class GameObjectCommand : ICommand {
// PRAGMA MARK - ICommand
public string DisplayTitle {
get {
if (!IsValid()) {
return "";
}
return _obj.name;
}
}
public string DisplayDetailText {
get {
if (!IsValid()) {
return "";
}
return _obj.FullName();
}
}
public abstract Texture2D DisplayIcon {
get;
}
public bool IsValid() {
return _obj != null;
}
public abstract void Execute();
// PRAGMA MARK - Constructors
public GameObjectCommand(GameObject obj) {
_obj = obj;
}
// PRAGMA MARK - Internal
protected GameObject _obj;
}
} | using System.IO;
using UnityEditor;
using UnityEngine;
namespace DTCommandPalette {
public abstract class GameObjectCommand : ICommand {
// PRAGMA MARK - ICommand
public string DisplayTitle {
get {
return _obj.name;
}
}
public string DisplayDetailText {
get {
return _obj.FullName();
}
}
public abstract Texture2D DisplayIcon {
get;
}
public bool IsValid() {
return _obj != null;
}
public abstract void Execute();
// PRAGMA MARK - Constructors
public GameObjectCommand(GameObject obj) {
_obj = obj;
}
// PRAGMA MARK - Internal
protected GameObject _obj;
}
} | mit | C# |
dffb804c7e15e4fc908a1d31c196f3b6bc8c8cd0 | Update StephanosConstantinou.cs | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/StephanosConstantinou.cs | src/Firehose.Web/Authors/StephanosConstantinou.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class StephanosConstantinou : IAmACommunityMember
{
public string FirstName => "Stephanos";
public string LastName => "Constantinou";
public string ShortBioOrTagLine => "Senior System Administrator. I am using PowerShell a lot to perform day to day tasks and automate procedures.";
public string StateOrRegion => "Limassol,Cyprus";
public string EmailAddress => "stephanos@sconstantinou.com";
public string TwitterHandle => "SCPowerShell";
public string GravatarHash => "04de5e0523cf48e9493c11905fd5999f";
public string GitHubHandle => "SConstantinou";
public GeoPosition Position => new GeoPosition(34.706249, 33.022578);
public Uri WebSite => new Uri("https://www.sconstantinou.com");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.sconstantinou.com/feed/"); } }
public bool Filter(SyndicationItem item)
{
return item.Categories.Any(c => c.Name.ToLowerInvariant().Contains("powershell"));
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class StephanosConstantinou : IAmACommunityMember
{
public string FirstName => "Stephanos";
public string LastName => "Constantinou";
public string ShortBioOrTagLine => "Senior System Administrator. I am using PowerShell a lot to perform day to day tasks and automate procedures.";
public string StateOrRegion => "Limassol,Cyprus";
public string EmailAddress => "stephanos@sconstantinou.com";
public string TwitterHandle => "SCPowerShell";
public string GravatarHash => "04de5e0523cf48e9493c11905fd5999f";
public string GitHubHandle => "SConstantinou";
public GeoPosition Position => new GeoPosition(34.706249, 33.022578);
public Uri WebSite => new Uri("https://www.sconstantinou.com");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.sconstantinou.com/feed/"); } }
public bool Filter(SyndicationItem item)
{
return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell scripts"));
return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell tutorials"));
}
}
}
| mit | C# |
7e732dd36c5e41e339433139eabd6a1efc30452f | Revert "Add singleton CallContext.Default (#1740)" (#1745) | AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet,AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet,AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet,AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet | src/Microsoft.IdentityModel.Tokens/CallContext.cs | src/Microsoft.IdentityModel.Tokens/CallContext.cs | //------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// 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.Collections.Generic;
using System.Collections.ObjectModel;
namespace Microsoft.IdentityModel.Tokens
{
/// <summary>
/// An opaque context used to store work when working with authentication artifacts.
/// </summary>
public class CallContext
{
/// <summary>
/// Instantiates a new <see cref="CallContext"/> with a default activityId.
/// </summary>
public CallContext()
{
}
/// <summary>
/// Instantiates a new <see cref="CallContext"/> with an activityId.
/// </summary>
public CallContext(Guid activityId)
{
ActivityId = activityId;
}
/// <summary>
/// Gets or set a <see cref="Guid"/> that will be used in the call to EventSource.SetCurrentThreadActivityId before logging.
/// </summary>
public Guid ActivityId { get; set; } = Guid.Empty;
/// <summary>
/// Gets or sets a boolean controlling if logs are written into the context.
/// Useful when debugging.
/// </summary>
public bool CaptureLogs { get; set; } = false;
/// <summary>
/// The collection of logs associated with a request. Use <see cref="CaptureLogs"/> to control capture.
/// </summary>
public ICollection<string> Logs { get; private set; } = new Collection<string>();
/// <summary>
/// Gets or sets an <see cref="IDictionary{String, Object}"/> that enables custom extensibility scenarios.
/// </summary>
public IDictionary<string, object> PropertyBag { get; set; }
}
}
| //------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// 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.Collections.Generic;
using System.Collections.ObjectModel;
namespace Microsoft.IdentityModel.Tokens
{
/// <summary>
/// An opaque context used to store work when working with authentication artifacts.
/// </summary>
public class CallContext
{
private static CallContext _defaultContext = new CallContext(Guid.NewGuid()) { CaptureLogs = false };
/// <summary>
/// Instantiates a new <see cref="CallContext"/> with a default activityId.
/// </summary>
public CallContext()
{
}
/// <summary>
/// Instantiates a new <see cref="CallContext"/> with an activityId.
/// </summary>
public CallContext(Guid activityId)
{
ActivityId = activityId;
}
/// <summary>
/// Gets or set a <see cref="Guid"/> that will be used in the call to EventSource.SetCurrentThreadActivityId before logging.
/// </summary>
public Guid ActivityId { get; set; } = Guid.Empty;
/// <summary>
/// Gets or sets a boolean controlling if logs are written into the context.
/// Useful when debugging.
/// </summary>
public bool CaptureLogs { get; set; } = false;
/// <summary>
/// Instantiates a new singleton <see cref="CallContext"/> with a false <see cref="CaptureLogs"/>.
/// </summary>
public static CallContext Default { get => _defaultContext; }
/// <summary>
/// The collection of logs associated with a request. Use <see cref="CaptureLogs"/> to control capture.
/// </summary>
public ICollection<string> Logs { get; private set; } = new Collection<string>();
/// <summary>
/// Gets or sets an <see cref="IDictionary{String, Object}"/> that enables custom extensibility scenarios.
/// </summary>
public IDictionary<string, object> PropertyBag { get; set; }
}
}
| mit | C# |
49255dd12003c8dea8d1d25fef35dc9105b4d3df | Add autocomplete to Get-UnicornConfiguration | kamsar/Unicorn,kamsar/Unicorn | src/Unicorn/PowerShell/GetUnicornConfiguration.cs | src/Unicorn/PowerShell/GetUnicornConfiguration.cs | using System.Linq;
using System.Management.Automation;
using Cognifide.PowerShell.Commandlets;
using Cognifide.PowerShell.Core.Validation;
using Unicorn.Configuration;
namespace Unicorn.PowerShell
{
/// <summary>
/// Get-UnicornConfiguration "Foundation.Foo" # Get one
/// Get-UnicornConfiguration "Foundation.*" # Get by filter
/// Get-UnicornConfiguration # Get all
/// </summary>
[OutputType(typeof(IConfiguration)), Cmdlet("Get", "UnicornConfiguration")]
public class GetUnicornConfigurationCommand : BaseCommand
{
public static string[] Autocomplete = UnicornConfigurationManager.Configurations.Select(cfg => cfg.Name).ToArray();
protected override void ProcessRecord()
{
var configs = UnicornConfigurationManager.Configurations;
if (!string.IsNullOrWhiteSpace(Filter))
{
configs = WildcardFilter(Filter, configs, configuration => configuration.Name).ToArray();
}
foreach (var config in configs)
{
WriteObject(config);
}
}
[Parameter(Position = 0), AutocompleteSet("Autocomplete")]
public string Filter { get; set; }
}
} | using System.Linq;
using System.Management.Automation;
using Cognifide.PowerShell.Commandlets;
using Unicorn.Configuration;
namespace Unicorn.PowerShell
{
/// <summary>
/// Get-UnicornConfiguration "Foundation.Foo" # Get one
/// Get-UnicornConfiguration "Foundation.*" # Get by filter
/// Get-UnicornConfiguration # Get all
/// </summary>
[OutputType(typeof(IConfiguration)), Cmdlet("Get", "UnicornConfiguration")]
public class GetUnicornConfigurationCommand : BaseCommand
{
protected override void ProcessRecord()
{
var configs = UnicornConfigurationManager.Configurations;
if (!string.IsNullOrWhiteSpace(Filter))
{
configs = WildcardFilter(Filter, configs, configuration => configuration.Name).ToArray();
}
foreach (var config in configs)
{
WriteObject(config);
}
}
[Parameter(Position = 0)]
public string Filter { get; set; }
}
} | mit | C# |
29c024bfc5e3cbff409ab47dcfa88e581b7849ce | Fix sample project | toddams/RazorLight,toddams/RazorLight | samples/RazorLight.Samples/Program.cs | samples/RazorLight.Samples/Program.cs | using Microsoft.EntityFrameworkCore;
using RazorLight;
using System;
namespace Samples.EntityFrameworkProject
{
class Program
{
static void Main(string[] args)
{
var options = new DbContextOptionsBuilder<AppDbContext>()
.UseInMemoryDatabase(databaseName: "TestDatabase")
.Options;
// Create and fill database with test data
var db = new AppDbContext(options);
FillDatabase(db);
// Create engine that uses entityFramework to fetch templates from db
// You can create project that uses your IRepository<T>
var project = new EntityFrameworkRazorLightProject(db);
var engine = new RazorLightEngineBuilder().UseProject(project).Build();
// As our key in database is integer, but engine takes string as a key - pass integer ID as a string
string templateKey = "2";
var model = new TestViewModel() { Name = "Johny", Age = 22 };
string result = engine.CompileRenderAsync(templateKey, model).Result;
//Identation will be a bit fuzzy, as we formatted a string for readability
Console.WriteLine(result);
db.Dispose();
}
static void FillDatabase(AppDbContext dbContext)
{
dbContext.Templates.Add(new TemplateEntity()
{
Id = 1,
Content = @"
<html>
@RenderBody()
</html>"
});
dbContext.Templates.Add(new TemplateEntity()
{
Id = 2,
Content = @"
@model Samples.EntityFrameworkProject.TestViewModel
@{
Layout = 1.ToString(); //This is an ID of your layout in database
}
<body> Hello, my name is @Model.Name and I am @Model.Age </body>"
});
}
}
}
| using Microsoft.EntityFrameworkCore;
using RazorLight;
using System;
namespace Samples.EntityFrameworkProject
{
class Program
{
static void Main(string[] args)
{
var options = new DbContextOptionsBuilder<AppDbContext>()
.UseInMemoryDatabase(databaseName: "TestDatabase")
.Options;
// Create and fill database with test data
var db = new AppDbContext(options);
FillDatabase(db);
// Create engine that uses entityFramework to fetch templates from db
// You can create project that uses your IRepository<T>
var project = new EntityFrameworkRazorLightProject(db);
IRazorLightEngine engine = new EngineFactory().Create(project);
// As our key in database is integer, but engine takes string as a key - pass integer ID as a string
string templateKey = "2";
var model = new TestViewModel() { Name = "Johny", Age = 22 };
string result = engine.CompileRenderAsync(templateKey, model).Result;
//Identation will be a bit fuzzy, as we formatted a string for readability
Console.WriteLine(result);
db.Dispose();
}
static void FillDatabase(AppDbContext dbContext)
{
dbContext.Templates.Add(new TemplateEntity()
{
Id = 1,
Content = @"
<html>
@RenderBody()
</html>"
});
dbContext.Templates.Add(new TemplateEntity()
{
Id = 2,
Content = @"
@model Samples.EntityFrameworkProject.TestViewModel
@{
Layout = 1.ToString(); //This is an ID of your layout in database
}
<body> Hello, my name is @Model.Name and I am @Model.Age </body>"
});
}
}
}
| apache-2.0 | C# |
41f6a5482208714acbff5d4ac45a5696570f82c2 | fix documentation in interface | rozzo/HelicopterControl,rozzo/HelicopterControl | OmniResources.InfraredControl/IHeliCommand.cs | OmniResources.InfraredControl/IHeliCommand.cs | using System.Collections.Generic;
namespace OmniResources.InfraredControl
{
/// <summary>
/// Defines common commands for all helicopters
/// </summary>
public interface IHeliCommand
{
/// <summary>
/// Gets or sets a value indicating the channel (false = A, true = B)
/// </summary>
bool Channel { get; set; }
/// <summary>
/// Gets or sets the value for throttle (up/down, 0 - 1000)
/// </summary>
int MainThrottle { get; set; }
/// <summary>
/// Gets or sets the value for pitch (forward: 1000, still: 0, back: -1000)
/// </summary>
int Pitch { get; set; }
/// <summary>
/// Gets the max value that the pitch can be set to based on trim
/// </summary>
int PitchMax { get; }
/// <summary>
/// Gets the min value that the pitch can be set to based on trim
/// </summary>
int PitchMin { get; }
/// <summary>
/// Gets the neutral value of the pitch based on trim
/// </summary>
int PitchNeutral { get; }
/// <summary>
/// Gets or sets the value for the pitch trim (left: 1000, still: 0, right: -1000)
/// </summary>
int PitchTrim { get; set; }
/// <summary>
/// Gets or sets the value for yaw (left: 1000, still: 0, right: -1000)
/// </summary>
int Yaw { get; set; }
/// <summary>
/// Gets the max value that the yaw can be set to based on trim
/// </summary>
int YawMax { get; }
/// <summary>
/// Gets the min value that the yaw can be set to based on trim
/// </summary>
int YawMin { get; }
/// <summary>
/// Gets the neutral value of the yaw based on trim
/// </summary>
int YawNeutral { get; }
/// <summary>
/// Gets or sets the value for the yaw trim (left: 1000, still: 0, right: -1000)
/// </summary>
int YawTrim { get; set; }
/// <summary>
/// Returns the IR pulses needed to transmit this command
/// </summary>
IEnumerable<PulseData> GetPulses();
}
} | using System.Collections.Generic;
namespace OmniResources.InfraredControl
{
/// <summary>
/// Defines common commands for all helicopters
/// </summary>
public interface IHeliCommand
{
/// <summary>
/// Gets or sets a value indicating the channel (false = A, true = B)
/// </summary>
bool Channel { get; set; }
/// <summary>
/// Gets or sets the value for throttle (up/down, 0 - 1000)
/// </summary>
int MainThrottle { get; set; }
/// <summary>
/// Gets or sets the value for pitch (forward: 1000, still: 0, back: -1000)
/// </summary>
int Pitch { get; set; }
/// <summary>
/// Gets the max value that the pitch can be set to based on trim
/// </summary>
int PitchMax { get; }
/// <summary>
/// Gets the min value that the pitch can be set to based on trim
/// </summary>
int PitchMin { get; }
/// <summary>
/// Gets the neutral value of the pitch based on trim
/// </summary>
int PitchNeutral { get; }
/// <summary>
/// Gets or sets the value for the pitch trim (left: 1000, still: 0, right: -1000)
/// </summary>
int PitchTrim { get; set; }
/// <summary>
/// Gets or sets the value for yaw (left: 1000, still: 0, right: -10000)
/// </summary>
int Yaw { get; set; }
/// <summary>
/// Gets the max value that the yaw can be set to based on trim
/// </summary>
int YawMax { get; }
/// <summary>
/// Gets the min value that the yaw can be set to based on trim
/// </summary>
int YawMin { get; }
/// <summary>
/// Gets the neutral value of the yaw based on trim
/// </summary>
int YawNeutral { get; }
/// <summary>
/// Gets or sets the value for the yaw trim (left: 1000, still: 0, right: -1000)
/// </summary>
int YawTrim { get; set; }
/// <summary>
/// Returns the IR pulses needed to transmit this command
/// </summary>
IEnumerable<PulseData> GetPulses();
}
} | mit | C# |
b1e34f9cabed8bb12041f1cc44d616e096d09499 | Fix one last issue | horia141/nvalidate,horia141/nvalidate | src/Runner.cs | src/Runner.cs | using NValidate.Attributes;
using NValidate.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace NValidate
{
public class Runner
{
DateTime _dateToRun;
Environ _environ;
public Runner(DateTime dateToRun, Environ environ)
{
_dateToRun = dateToRun;
_environ = environ;
}
public ValidatorRunResult Run(Assembly currentAssembly)
{
var validatorRunResult = new ValidatorRunResult();
validatorRunResult.RunDate = _dateToRun;
validatorRunResult.SummaryAtFixtureLevel = new ResultSummary();
validatorRunResult.SummaryAtTemplateLevel = new ResultSummary();
validatorRunResult.SummaryAtInstanceLevel = new ResultSummary();
validatorRunResult.FixtureResults = new List<ValidatorFixtureResult>();
try
{
foreach (var validatorFixtureInfo in currentAssembly.DefinedTypes.Where(ValidatorFixtureAttribute.HasAttribute))
{
var validatorFixtureRunner = new FixtureRunner(_environ, validatorFixtureInfo);
var validatorFixtureResult = validatorFixtureRunner.Run();
validatorRunResult.AddFixtureResult(validatorFixtureResult);
}
}
catch (Exception e)
{
validatorRunResult.Error = e;
}
if (validatorRunResult.Error != null)
validatorRunResult.Status = GroupStatus.Error;
else if (validatorRunResult.SummaryAtFixtureLevel.Failure > 0)
validatorRunResult.Status = GroupStatus.Failure;
else
validatorRunResult.Status = GroupStatus.Success;
return validatorRunResult;
}
}
} | using NValidate.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace NValidate
{
public class Runner
{
DateTime _dateToRun;
Environ _environ;
public Runner(DateTime dateToRun, Environ environ)
{
_dateToRun = dateToRun;
_environ = environ;
}
public ValidatorRunResult Run(Assembly currentAssembly)
{
var validatorRunResult = new ValidatorRunResult();
validatorRunResult.RunDate = _dateToRun;
validatorRunResult.SummaryAtFixtureLevel = new ResultSummary();
validatorRunResult.SummaryAtTemplateLevel = new ResultSummary();
validatorRunResult.SummaryAtInstanceLevel = new ResultSummary();
validatorRunResult.FixtureResults = new List<ValidatorFixtureResult>();
try
{
foreach (var validatorFixtureInfo in currentAssembly.DefinedTypes.Where(ValidatorFixtureAttribute.HasAttribute))
{
var validatorFixtureRunner = new FixtureRunner(_environ, validatorFixtureInfo);
var validatorFixtureResult = validatorFixtureRunner.Run();
validatorRunResult.AddFixtureResult(validatorFixtureResult);
}
}
catch (Exception e)
{
validatorRunResult.Error = e;
}
if (validatorRunResult.Error != null)
validatorRunResult.Status = GroupStatus.Error;
else if (validatorRunResult.SummaryAtFixtureLevel.Failure > 0)
validatorRunResult.Status = GroupStatus.Failure;
else
validatorRunResult.Status = GroupStatus.Success;
return validatorRunResult;
}
}
} | mit | C# |
2b67dcc66bb24a2c023b4a760c97d62846bc3bad | Fix not-drawing when paint is raised | pleonex/Ninokuni,pleonex/Ninokuni,pleonex/Ninokuni | Programs/NinoPatcher/NinoPatcher/Animation.cs | Programs/NinoPatcher/NinoPatcher/Animation.cs | //
// Animation.cs
//
// Author:
// Benito Palacios Sánchez <benito356@gmail.com>
//
// Copyright (c) 2015 Benito Palacios Sánchez
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace NinoPatcher
{
public class Animation
{
private Control parent;
private AnimationElement[] elements;
private Timer timer;
private int tick;
public Animation(int period, Control parent, params AnimationElement[] elements)
{
this.parent = parent;
this.parent.Paint += delegate { PaintFrame(null, null); };
this.elements = elements;
timer = new Timer();
timer.Tick += PaintFrame;
timer.Interval = period;
}
public void Start()
{
timer.Start();
tick = 0;
}
public void Stop()
{
timer.Stop();
}
private void PaintFrame(object sender, EventArgs e)
{
Bitmap bufl = new Bitmap(parent.Width, parent.Height);
using (Graphics g = Graphics.FromImage(bufl))
{
// Draw background color
g.FillRectangle(
new SolidBrush(parent.BackColor),
new Rectangle(Point.Empty, parent.Size));
// Draw animations
foreach (AnimationElement el in elements)
el.Draw(g, tick);
// Draw image
parent.CreateGraphics().DrawImageUnscaled(bufl, Point.Empty);
bufl.Dispose();
}
tick++;
}
}
}
| //
// Animation.cs
//
// Author:
// Benito Palacios Sánchez <benito356@gmail.com>
//
// Copyright (c) 2015 Benito Palacios Sánchez
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace NinoPatcher
{
public class Animation
{
private Control parent;
private AnimationElement[] elements;
private Timer timer;
private int tick;
public Animation(int period, Control parent, params AnimationElement[] elements)
{
this.parent = parent;
this.elements = elements;
timer = new Timer();
timer.Tick += PaintFrame;
timer.Interval = period;
}
public void Start()
{
timer.Start();
tick = 0;
}
public void Stop()
{
timer.Stop();
}
private void PaintFrame(object sender, EventArgs e)
{
Bitmap bufl = new Bitmap(parent.Width, parent.Height);
using (Graphics g = Graphics.FromImage(bufl))
{
// Draw background color
g.FillRectangle(
new SolidBrush(parent.BackColor),
new Rectangle(Point.Empty, parent.Size));
// Draw animations
foreach (AnimationElement el in elements)
el.Draw(g, tick);
// Draw image
parent.CreateGraphics().DrawImageUnscaled(bufl, Point.Empty);
bufl.Dispose();
}
tick++;
}
}
}
| apache-2.0 | C# |
59a08a3faff2e3b11130f7cc425b7a20bd2b1722 | Update samples/FishTank/Properties/AssemblyInfo.cs | nikhilk/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp | samples/FishTank/Properties/AssemblyInfo.cs | samples/FishTank/Properties/AssemblyInfo.cs | // AssemblyInfo.cs
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FishTank")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Script# Samples")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ScriptAssembly("ft")]
[assembly: ScriptTemplate(@"
// {name}.js
//
'use strict';
(function($global) {
{script}
})(this);
")]
| // AssemblyInfo.cs
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FishTank")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Script# Samples")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ScriptAssembly("ft")]
[assembly: ScriptTemplate(@"
// {name}.js
//
'use script';
(function($global) {
{script}
})(this);
")]
| apache-2.0 | C# |
57f830cdfe9a14861738becad2bfbcc7c70e6e93 | Fix UpdateIndexSettingsRequest unit tests | elastic/elasticsearch-net,elastic/elasticsearch-net | src/Nest/Indices/IndexSettings/UpdateIndexSettings/UpdateIndexSettingsRequest.cs | src/Nest/Indices/IndexSettings/UpdateIndexSettings/UpdateIndexSettingsRequest.cs | using System;
using Utf8Json;
namespace Nest
{
[MapsApi("indices.put_settings.json")]
[JsonFormatter(typeof(UpdateIndexSettingsRequestFormatter))]
public partial interface IUpdateIndexSettingsRequest
{
IDynamicIndexSettings IndexSettings { get; set; }
}
public partial class UpdateIndexSettingsRequest
{
public IDynamicIndexSettings IndexSettings { get; set; }
}
public partial class UpdateIndexSettingsDescriptor
{
IDynamicIndexSettings IUpdateIndexSettingsRequest.IndexSettings { get; set; }
/// <inheritdoc />
public UpdateIndexSettingsDescriptor IndexSettings(Func<DynamicIndexSettingsDescriptor, IPromise<IDynamicIndexSettings>> settings) =>
Assign(a => a.IndexSettings = settings?.Invoke(new DynamicIndexSettingsDescriptor())?.Value);
}
internal class UpdateIndexSettingsRequestFormatter : IJsonFormatter<IUpdateIndexSettingsRequest>
{
private static readonly DynamicIndexSettingsFormatter DynamicIndexSettingsFormatter =
new DynamicIndexSettingsFormatter();
public IUpdateIndexSettingsRequest Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
{
var dynamicSettings = DynamicIndexSettingsFormatter.Deserialize(ref reader, formatterResolver);
return new UpdateIndexSettingsRequest { IndexSettings = dynamicSettings };
}
public void Serialize(ref JsonWriter writer, IUpdateIndexSettingsRequest value, IJsonFormatterResolver formatterResolver)
{
if (value == null)
{
writer.WriteNull();
return;
}
DynamicIndexSettingsFormatter.Serialize(ref writer, value.IndexSettings, formatterResolver);
}
}
}
| using System;
namespace Nest
{
[MapsApi("indices.put_settings.json")]
[ReadAs(typeof(UpdateIndexSettingsRequest))]
public partial interface IUpdateIndexSettingsRequest
{
IDynamicIndexSettings IndexSettings { get; set; }
}
public partial class UpdateIndexSettingsRequest
{
public IDynamicIndexSettings IndexSettings { get; set; }
}
public partial class UpdateIndexSettingsDescriptor
{
IDynamicIndexSettings IUpdateIndexSettingsRequest.IndexSettings { get; set; }
/// <inheritdoc />
public UpdateIndexSettingsDescriptor IndexSettings(Func<DynamicIndexSettingsDescriptor, IPromise<IDynamicIndexSettings>> settings) =>
Assign(a => a.IndexSettings = settings?.Invoke(new DynamicIndexSettingsDescriptor())?.Value);
}
}
| apache-2.0 | C# |
c446e60f4edc0176c47a0926ddc32fe55acecd3d | prepare for release | bjartebore/azure-activedirectory-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/azure-activedirectory-library-for-dotnet,yamamoWorks/azure-activedirectory-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet | src/ADAL.Common/CommonAssemblyInfo.cs | src/ADAL.Common/CommonAssemblyInfo.cs | //------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// 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.Reflection;
[assembly: AssemblyProduct("Active Directory Authentication Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyVersion("3.12.0.0")]
// On official build, attribute AssemblyInformationalVersionAttribute is added as well
// with its value equal to the hash of the last commit to the git branch.
// e.g.: [assembly: AssemblyInformationalVersionAttribute("4392c9835a38c27516fc0cd7bad7bccdcaeab161")]
[assembly: CLSCompliant(false)]
| //------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// 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.Reflection;
[assembly: AssemblyProduct("Active Directory Authentication Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyVersion("3.11.0.0")]
// On official build, attribute AssemblyInformationalVersionAttribute is added as well
// with its value equal to the hash of the last commit to the git branch.
// e.g.: [assembly: AssemblyInformationalVersionAttribute("4392c9835a38c27516fc0cd7bad7bccdcaeab161")]
[assembly: CLSCompliant(false)]
| mit | C# |
5370a74a75ea2b7c87390d3db5539ebf1c68e575 | update assembly version | mcneel/compat,mcneel/compat,mcneel/compat,mcneel/compat,mcneel/compat | src/Compat/Properties/AssemblyInfo.cs | src/Compat/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("Compat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Compat")]
[assembly: AssemblyCopyright("Copyright © 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("183015d9-ae48-4443-8c1f-94777c367b1f")]
// 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.*")]
[assembly: AssemblyFileVersion("0.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("Compat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Compat")]
[assembly: AssemblyCopyright("Copyright © 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("183015d9-ae48-4443-8c1f-94777c367b1f")]
// 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# |
013e65f157585971d52856c9826dd8030da690ac | Update MeleeStun.cs | fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation | UnityProject/Assets/Scripts/Weapons/Melee/MeleeStun.cs | UnityProject/Assets/Scripts/Weapons/Melee/MeleeStun.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Timers;
using UnityEngine;
/// <summary>
/// Adding this to a weapon stuns the target on hit
/// If the weapon has the StunBaton behaviour it only stuns when the baton is active
/// </summary>
public class MeleeStun : MonoBehaviour, ICheckedInteractable<HandApply>
{
/// <summary>
/// How long to stun for (in seconds)
/// </summary>
[SerializeField]
private float stunTime = 0;
/// <summary>
/// how long till you can stun again
/// </summary>
[SerializeField]
private int delay = 3;
/// <summary>
/// if you can stun
/// </summary>
private bool canStun = true;
/// <summary>
/// Sounds to play when stunning someone
/// </summary>
[SerializeField]
private string stunSound = "EGloves";
private StunBaton stunBaton;
public void Start()
{
stunBaton = GetComponent<StunBaton>();
}
public bool WillInteract(HandApply interaction, NetworkSide side)
{
if (!DefaultWillInteract.Default(interaction, side)) return false;
return interaction.UsedObject == gameObject
&& (!stunBaton || stunBaton.isActive)
&& interaction.TargetObject.GetComponent<RegisterPlayer>();
}
public void ServerPerformInteraction(HandApply interaction)
{
GameObject target = interaction.TargetObject;
GameObject performer = interaction.Performer;
// Direction for lerp
Vector2 dir = (target.transform.position - performer.transform.position).normalized;
WeaponNetworkActions wna = performer.GetComponent<WeaponNetworkActions>();
// If we're not on help intent we deal damage!
// Note: this has to be done before the stun, because otherwise if we hit ourselves with an activated stun baton on harm intent
// we wouldn't deal damage to ourselves because CmdRequestMeleeAttack checks whether we're stunned
if (interaction.Intent != Intent.Help)
{
// Direction of attack towards the attack target.
wna.ServerPerformMeleeAttack(target, dir, interaction.TargetBodyPart, LayerType.None);
}
RegisterPlayer registerPlayerVictim = target.GetComponent<RegisterPlayer>();
// Stun the victim. We checke whether the baton is activated in WillInteract and if the user has a charge to stun
if (registerPlayerVictim && canStun)
{
registerPlayerVictim.ServerStun(stunTime);
SoundManager.PlayNetworkedAtPos(stunSound, target.transform.position, sourceObj: target.gameObject);
// deactivates the stun and makes you wait;
DisableStun();
// Special case: If we're on help intent (only stun), we should still show the lerp (unless we're hitting ourselves)
if (interaction.Intent == Intent.Help && performer != target)
{
wna.RpcMeleeAttackLerp(dir, gameObject);
}
}
}
// creates the timer needed to let you stun again'
private void DisableStun()
{
canStun = false;
Timer stunTimer = new Timer();
stunTimer.Interval = delay * 1000;
stunTimer.Elapsed += StunTimer_Elapsed;
stunTimer.Enabled = true;
}
// lets you stun again
private void StunTimer_Elapsed(object sender, ElapsedEventArgs e)
{
canStun = true;
}
}
| using System;
using System.Collections;
using System.Collections.Generic;
using System.Timers;
using UnityEngine;
/// <summary>
/// Adding this to a weapon stuns the target on hit
/// If the weapon has the StunBaton behaviour it only stuns when the baton is active
/// </summary>
public class MeleeStun : MonoBehaviour, ICheckedInteractable<HandApply>
{
/// <summary>
/// How long to stun for (in seconds)
/// </summary>
[SerializeField]
private float stunTime = 0;
/// <summary>
/// how long till you can stun again
/// </summary>
[SerializeField]
private int delay = 3;
/// <summary>
/// if you can stun
/// </summary>
private bool canStun = true;
/// <summary>
/// Sounds to play when stunning someone
/// </summary>
[SerializeField]
private string stunSound = "EGloves";
private StunBaton stunBaton;
public void Start()
{
stunBaton = GetComponent<StunBaton>();
}
public bool WillInteract(HandApply interaction, NetworkSide side)
{
if (!DefaultWillInteract.Default(interaction, side)) return false;
return interaction.UsedObject == gameObject
&& (!stunBaton || stunBaton.isActive)
&& interaction.TargetObject.GetComponent<RegisterPlayer>();
}
public void ServerPerformInteraction(HandApply interaction)
{
GameObject target = interaction.TargetObject;
GameObject performer = interaction.Performer;
// Direction for lerp
Vector2 dir = (target.transform.position - performer.transform.position).normalized;
WeaponNetworkActions wna = performer.GetComponent<WeaponNetworkActions>();
// If we're not on help intent we deal damage!
// Note: this has to be done before the stun, because otherwise if we hit ourselves with an activated stun baton on harm intent
// we wouldn't deal damage to ourselves because CmdRequestMeleeAttack checks whether we're stunned
if (interaction.Intent != Intent.Help)
{
// Direction of attack towards the attack target.
wna.ServerPerformMeleeAttack(target, dir, interaction.TargetBodyPart, LayerType.None);
}
RegisterPlayer registerPlayerVictim = target.GetComponent<RegisterPlayer>();
// Stun the victim. We checke whether the baton is activated in WillInteract and if the user has a charge to stun
if (registerPlayerVictim && canStun)
{
registerPlayerVictim.ServerStun(stunTime);
SoundManager.PlayNetworkedAtPos(stunSound, target.transform.position, sourceObj: target.gameObject);
// deactivates the stun and makes you wait;
canStun = false;
CreateTimer();
// Special case: If we're on help intent (only stun), we should still show the lerp (unless we're hitting ourselves)
if (interaction.Intent == Intent.Help && performer != target)
{
wna.RpcMeleeAttackLerp(dir, gameObject);
}
}
}
// creates the timer needed to let you stun again'
private void CreateTimer()
{
Timer stunTimer = new Timer();
stunTimer.Interval = delay * 1000;
stunTimer.Elapsed += StunTimer_Elapsed;
stunTimer.Enabled = true;
}
// lets you stun again
private void StunTimer_Elapsed(object sender, ElapsedEventArgs e)
{
canStun = true;
}
}
| agpl-3.0 | C# |
6a63ba1bb826235cdca903ccdc855188d4e3d584 | use humanizer for ModEasy lives setting | peppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,NeoAdonis/osu,UselessToucan/osu,EVAST9919/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,EVAST9919/osu,smoogipooo/osu,UselessToucan/osu,smoogipoo/osu | osu.Game/Rulesets/Mods/ModEasy.cs | osu.Game/Rulesets/Mods/ModEasy.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 Humanizer;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableFailOverride, IApplicableToHealthProcessor
{
public override string Name => "Easy";
public override string Acronym => "EZ";
public override IconUsage? Icon => OsuIcon.ModEasy;
public override ModType Type => ModType.DifficultyReduction;
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock), typeof(ModDifficultyAdjust) };
[SettingSource("Extra Lives", "Number of extra lives")]
public Bindable<int> Retries { get; } = new BindableInt(2)
{
MinValue = 0,
MaxValue = 10
};
public override string SettingDescription => Retries.IsDefault ? "" : $"{"lives".ToQuantity(Retries.Value)}";
private int retries;
private BindableNumber<double> health;
public void ReadFromDifficulty(BeatmapDifficulty difficulty) { }
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
const float ratio = 0.5f;
difficulty.CircleSize *= ratio;
difficulty.ApproachRate *= ratio;
difficulty.DrainRate *= ratio;
difficulty.OverallDifficulty *= ratio;
retries = Retries.Value;
}
public bool AllowFail
{
get
{
if (retries == 0) return true;
health.Value = health.MaxValue;
retries--;
return false;
}
}
public bool RestartOnFail => false;
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
{
health = healthProcessor.Health.GetBoundCopy();
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableFailOverride, IApplicableToHealthProcessor
{
public override string Name => "Easy";
public override string Acronym => "EZ";
public override IconUsage? Icon => OsuIcon.ModEasy;
public override ModType Type => ModType.DifficultyReduction;
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock), typeof(ModDifficultyAdjust) };
[SettingSource("Extra Lives", "Number of extra lives")]
public Bindable<int> Retries { get; } = new BindableInt(2)
{
MinValue = 0,
MaxValue = 10
};
public override string SettingDescription => Retries.IsDefault ? "" : $" ({Retries.Value} lives)";
private int retries;
private BindableNumber<double> health;
public void ReadFromDifficulty(BeatmapDifficulty difficulty) { }
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
const float ratio = 0.5f;
difficulty.CircleSize *= ratio;
difficulty.ApproachRate *= ratio;
difficulty.DrainRate *= ratio;
difficulty.OverallDifficulty *= ratio;
retries = Retries.Value;
}
public bool AllowFail
{
get
{
if (retries == 0) return true;
health.Value = health.MaxValue;
retries--;
return false;
}
}
public bool RestartOnFail => false;
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
{
health = healthProcessor.Health.GetBoundCopy();
}
}
}
| mit | C# |
957eb4fa632c164b15c0a4d6ca3e3be13ba8bf9c | Add user agent contains only from enum | wangkanai/Detection | src/Extensions/UserAgentExtensions.cs | src/Extensions/UserAgentExtensions.cs | // Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Wangkanai.Detection.Models;
namespace Wangkanai.Detection.Extensions
{
internal static class UserAgentExtensions
{
public static UserAgent UserAgentFromHeader(this HttpContext context)
=> new UserAgent(context.Request.Headers["User-Agent"].FirstOrDefault());
public static bool IsNullOrEmpty(this UserAgent agent)
=> agent == null
|| string.IsNullOrEmpty(agent.ToLower());
public static string ToLower(this UserAgent agent)
=> agent.ToString().ToLower();
public static int Length(this UserAgent agent)
=> agent.ToString().Length;
public static bool Contains(this UserAgent agent, string word)
=> agent.ToLower().Contains(word.ToLower());
public static bool Contains(this UserAgent agent, string[] array)
=> array.Any(agent.Contains)
&& !agent.IsNullOrEmpty();
public static bool Contains<T>(this UserAgent agent, T t) where T : Enum
=> agent.Contains(t.ToString().ToLower());
public static bool Contains<T>(this UserAgent agent, Type type) where T : Enum
=> Enum.GetValues(type).Cast<T>().Any(agent.Contains);
public static bool StartsWith(this UserAgent agent, string word)
=> agent.ToLower().StartsWith(word.ToLower())
&& !agent.IsNullOrEmpty();
public static bool StartsWith(this UserAgent agent, string[] array)
=> array.Any(agent.StartsWith);
public static bool StartsWith(this UserAgent agent, string[] array, int minimum)
=> agent.Length() >= minimum
&& agent.StartsWith(array);
}
}
| // Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Wangkanai.Detection.Models;
namespace Wangkanai.Detection.Extensions
{
internal static class UserAgentExtensions
{
public static UserAgent UserAgentFromHeader(this HttpContext context)
=> new UserAgent(context.Request.Headers["User-Agent"].FirstOrDefault());
public static bool IsNullOrEmpty(this UserAgent agent)
=> agent == null
|| string.IsNullOrEmpty(agent.ToLower());
public static string ToLower(this UserAgent agent)
=> agent.ToString().ToLower();
public static int Length(this UserAgent agent)
=> agent.ToString().Length;
public static bool Contains(this UserAgent agent, string word)
=> agent.ToLower().Contains(word.ToLower());
public static bool Contains(this UserAgent agent, string[] array)
=> array.Any(agent.Contains)
&& !agent.IsNullOrEmpty();
public static bool Contains<T>(this UserAgent agent, T t)
=> agent.Contains(t.ToString().ToLower());
public static bool Contains<T>(this UserAgent agent, Type type) where T : Enum
=> Enum.GetValues(type).Cast<T>().Any(agent.Contains);
public static bool StartsWith(this UserAgent agent, string word)
=> agent.ToLower().StartsWith(word.ToLower())
&& !agent.IsNullOrEmpty();
public static bool StartsWith(this UserAgent agent, string[] array)
=> array.Any(agent.StartsWith);
public static bool StartsWith(this UserAgent agent, string[] array, int minimum)
=> agent.Length() >= minimum
&& agent.StartsWith(array);
}
}
| apache-2.0 | C# |
eb377c3208ccfb197b9355ef7009d1ba47106032 | Add basic IdentityMap and use for loading | mysticmind/marten,jokokko/marten,jmbledsoe/marten,jmbledsoe/marten,JasperFx/Marten,tim-cools/Marten,jamesfarrer/marten,ericgreenmix/marten,JasperFx/Marten,jamesfarrer/marten,JasperFx/Marten,tim-cools/Marten,mysticmind/marten,ericgreenmix/marten,jokokko/marten,mysticmind/marten,tim-cools/Marten,mdissel/Marten,jamesfarrer/marten,jmbledsoe/marten,jokokko/marten,jamesfarrer/marten,ericgreenmix/marten,mdissel/Marten,jokokko/marten,ericgreenmix/marten,jmbledsoe/marten,jmbledsoe/marten,mysticmind/marten,jokokko/marten | src/Marten/IdentityMap.cs | src/Marten/IdentityMap.cs | using System;
using System.Collections.Generic;
namespace Marten
{
internal class IdentityMap
{
private readonly Dictionary<EntityKey, object> _map = new Dictionary<EntityKey, object>();
public void Set<T>(T entity)
{
var id = GetOrSetId(entity);
var key = new EntityKey(typeof(T), id);
if (_map.ContainsKey(key))
{
if (!ReferenceEquals(_map[key], entity))
{
throw new InvalidOperationException($"Entity '{typeof(T).FullName}' with same Id already added to the session.");
}
return;
}
_map[key] = entity;
}
private static dynamic GetOrSetId<T>(T entity)
{
dynamic dynamicEntity = entity;
if (dynamicEntity.Id == null)
{
dynamicEntity.Id = Guid.NewGuid();
}
return dynamicEntity.Id;
}
public T Get<T>(object id) where T : class
{
object value;
var key = new EntityKey(typeof(T), id);
return _map.TryGetValue(key, out value) ? (T) value : default(T);
}
}
} | using System;
using System.Collections.Generic;
namespace Marten
{
internal class IdentityMap
{
private readonly Dictionary<EntityKey, object> _map = new Dictionary<EntityKey, object>();
public bool Set<T>(T entity)
{
var id = GetOrSetId(entity);
var key = new EntityKey(typeof(T), id);
if (_map.ContainsKey(key))
{
if (!ReferenceEquals(_map[key], entity))
{
throw new InvalidOperationException($"Entity '{typeof(T).FullName}' with same Id already added to the session.");
}
}
_map[key] = entity;
return true;
}
private static dynamic GetOrSetId<T>(T entity)
{
dynamic dynamicEntity = entity;
if (dynamicEntity.Id == null)
{
dynamicEntity.Id = Guid.NewGuid();
}
return dynamicEntity.Id;
}
public T Get<T>(object id) where T : class
{
object value;
var key = new EntityKey(typeof(T), id);
return _map.TryGetValue(key, out value) ? (T) value : default(T);
}
}
} | mit | C# |
655c5d525c2324ae72bd26aa066484c9c87b601c | Update FocusProviderInspector.cs | killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity | Assets/MixedRealityToolkit/Inspectors/ServiceInspectors/FocusProviderInspector.cs | Assets/MixedRealityToolkit/Inspectors/ServiceInspectors/FocusProviderInspector.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.MixedReality.Toolkit.Input;
using UnityEditor;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Editor
{
[MixedRealityServiceInspector(typeof(FocusProvider))]
public class FocusProviderInspector : BaseMixedRealityServiceInspector
{
private static readonly Color enabledColor = GUI.backgroundColor;
private static readonly Color disabledColor = Color.Lerp(enabledColor, Color.clear, 0.5f);
public override void DrawInspectorGUI(object target)
{
IMixedRealityFocusProvider focusProvider = (IMixedRealityFocusProvider)target;
EditorGUILayout.LabelField("Active Pointers", EditorStyles.boldLabel);
if (!Application.isPlaying)
{
EditorGUILayout.HelpBox("Pointers will be populated once you enter play mode.", MessageType.Info);
return;
}
bool pointerFound = false;
foreach (IMixedRealityPointer pointer in focusProvider.GetPointers<IMixedRealityPointer>())
{
GUI.color = pointer.IsInteractionEnabled ? enabledColor : disabledColor;
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
EditorGUILayout.LabelField(pointer.PointerName);
EditorGUILayout.Toggle("Interaction Enabled", pointer.IsInteractionEnabled);
EditorGUILayout.Toggle("Focus Locked", pointer.IsFocusLocked);
IPointerResult pointerResult = pointer.Result;
if (pointerResult == null)
{
EditorGUILayout.ObjectField("Focus Result", null, typeof(GameObject), true);
}
else
{
EditorGUILayout.ObjectField("Focus Result", pointerResult.CurrentPointerTarget, typeof(GameObject), true);
}
EditorGUILayout.EndVertical();
pointerFound = true;
}
if (!pointerFound)
{
EditorGUILayout.LabelField("(None found)", EditorStyles.miniLabel);
}
GUI.color = enabledColor;
}
}
} | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.MixedReality.Toolkit.Input;
using UnityEditor;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Editor
{
[MixedRealityServiceInspector(typeof(FocusProvider))]
public class FocusProviderInspector : BaseMixedRealityServiceInspector
{
private static readonly Color enabledColor = GUI.backgroundColor;
private static readonly Color disabledColor = Color.Lerp(enabledColor, Color.clear, 0.5f);
public override void DrawInspectorGUI(object target)
{
IMixedRealityFocusProvider focusProvider = (IMixedRealityFocusProvider)target;
EditorGUILayout.LabelField("Active Pointers", EditorStyles.boldLabel);
if (!Application.isPlaying)
{
EditorGUILayout.HelpBox("Pointers will be populated once you enter play mode.", MessageType.Info);
return;
}
int numPointersFound = 0;
foreach (IMixedRealityPointer pointer in focusProvider.GetPointers<IMixedRealityPointer>())
{
GUI.color = pointer.IsInteractionEnabled ? enabledColor : disabledColor;
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
EditorGUILayout.LabelField(pointer.PointerName);
EditorGUILayout.Toggle("Interaction Enabled", pointer.IsInteractionEnabled);
EditorGUILayout.Toggle("Focus Locked", pointer.IsFocusLocked);
IPointerResult pointerResult = pointer.Result;
if (pointerResult == null)
{
EditorGUILayout.ObjectField("Focus Result", null, typeof(GameObject), true);
}
else
{
EditorGUILayout.ObjectField("Focus Result", pointerResult.CurrentPointerTarget, typeof(GameObject), true);
}
EditorGUILayout.EndVertical();
numPointersFound++;
}
if (numPointersFound == 0)
{
EditorGUILayout.LabelField("(None found)", EditorStyles.miniLabel);
}
GUI.color = enabledColor;
}
}
} | mit | C# |
90506bf26750b70eaee8ce955be2f2e761a7c730 | Add a TODO. | TTExtensions/MouseClickSimulator | TTMouseclickSimulator/Core/ToontownRewritten/Actions/Fishing/FishingSpotFlavor.cs | TTMouseclickSimulator/Core/ToontownRewritten/Actions/Fishing/FishingSpotFlavor.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TTMouseclickSimulator.Core.Environment;
namespace TTMouseclickSimulator.Core.ToontownRewritten.Actions.Fishing
{
public class FishingSpotFlavor
{
public Coordinates Scan1 { get; }
public Coordinates Scan2 { get; }
public ScreenshotColor BubbleColor { get; }
public int Tolerance { get; }
public FishingSpotFlavor(Coordinates scan1, Coordinates scan2,
ScreenshotColor bubbleColor, int tolerance)
{
this.Scan1 = scan1;
this.Scan2 = scan2;
this.BubbleColor = bubbleColor;
this.Tolerance = tolerance;
}
// TODO: The Color value needs some adjustment!
public static readonly FishingSpotFlavor PunchlinePlace =
new FishingSpotFlavor(new Coordinates(260, 196), new Coordinates(1349, 626),
new ScreenshotColor(20, 140, 144), 16);
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TTMouseclickSimulator.Core.Environment;
namespace TTMouseclickSimulator.Core.ToontownRewritten.Actions.Fishing
{
public class FishingSpotFlavor
{
public Coordinates Scan1 { get; }
public Coordinates Scan2 { get; }
public ScreenshotColor BubbleColor { get; }
public int Tolerance { get; }
public FishingSpotFlavor(Coordinates scan1, Coordinates scan2,
ScreenshotColor bubbleColor, int tolerance)
{
this.Scan1 = scan1;
this.Scan2 = scan2;
this.BubbleColor = bubbleColor;
this.Tolerance = tolerance;
}
public static readonly FishingSpotFlavor PunchlinePlace =
new FishingSpotFlavor(new Coordinates(260, 196), new Coordinates(1349, 626),
new ScreenshotColor(20, 140, 144), 16);
}
}
| mit | C# |
7ce0049ad50e6ddf7b041b4f5fbc3a7d4d0239f2 | Bump version to 1.0.2 | damianh/LimitsMiddleware,damianh/LimitsMiddleware,tugberkugurlu/Owin.Limits | src/SharedAssemblyInfo.cs | src/SharedAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Damian Hickey")]
[assembly: AssemblyProduct("Owin.Limits")]
[assembly: AssemblyCopyright("Copyright © Damian Hickey 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
| using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Damian Hickey")]
[assembly: AssemblyProduct("Owin.Limits")]
[assembly: AssemblyCopyright("Copyright © Damian Hickey 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
| mit | C# |
7208452a12cce296b6abd6ee5275a2cb54ffecbc | Allow CsvAttribute to be applied on structs as well | NServiceKit/NServiceKit.Text,mono/ServiceStack.Text,mono/ServiceStack.Text,NServiceKit/NServiceKit.Text | src/ServiceStack.Text/CsvAttribute.cs | src/ServiceStack.Text/CsvAttribute.cs | using System;
namespace ServiceStack.Text
{
public enum CsvBehavior
{
FirstEnumerable
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
public class CsvAttribute : Attribute
{
public CsvBehavior CsvBehavior { get; set; }
public CsvAttribute(CsvBehavior csvBehavior)
{
this.CsvBehavior = csvBehavior;
}
}
} | using System;
namespace ServiceStack.Text
{
public enum CsvBehavior
{
FirstEnumerable
}
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public class CsvAttribute : Attribute
{
public CsvBehavior CsvBehavior { get; set; }
public CsvAttribute(CsvBehavior csvBehavior)
{
this.CsvBehavior = csvBehavior;
}
}
} | bsd-3-clause | C# |
8edddc67a47cc808d25b62e111abd69c25619253 | Remove AppDomain usage | InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform | InfinniPlatform.ServiceHost/Program.cs | InfinniPlatform.ServiceHost/Program.cs | using System;
using System.Threading;
using InfinniPlatform.NodeServiceHost;
using InfinniPlatform.ServiceHost.Properties;
namespace InfinniPlatform.ServiceHost
{
public class Program
{
public static void Main()
{
var infinniPlatformServiceHost = new InfinniPlatformServiceHost();
try
{
infinniPlatformServiceHost.Start(Timeout.InfiniteTimeSpan);
Console.WriteLine(Resources.ServerStarted);
Console.ReadLine();
}
catch (Exception error)
{
Console.WriteLine(error);
}
}
}
} | using System;
using InfinniPlatform.NodeServiceHost;
using InfinniPlatform.ServiceHost.Properties;
namespace InfinniPlatform.ServiceHost
{
public class Program
{
public static void Main()
{
try
{
InfinniPlatformInprocessHost.Start();
Console.WriteLine(Resources.ServerStarted);
Console.ReadLine();
}
catch (Exception error)
{
Console.WriteLine(error);
}
}
}
} | agpl-3.0 | C# |
d2155ce0124e79f9f7c5f77f89e60b097125f3bc | Add usual level control params to WriteTo.Providers() | serilog/serilog-extensions-logging,serilog/serilog-framework-logging,serilog/serilog-extensions-logging | src/Serilog.Extensions.Logging/LoggerSinkConfigurationExtensions.cs | src/Serilog.Extensions.Logging/LoggerSinkConfigurationExtensions.cs | // Copyright 2019 Serilog Contributors
//
// 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 Serilog.Configuration;
using Serilog.Core;
using Serilog.Events;
using Serilog.Extensions.Logging;
namespace Serilog
{
/// <summary>
/// Extensions for <see cref="LoggerSinkConfiguration"/>.
/// </summary>
public static class LoggerSinkConfigurationExtensions
{
/// <summary>
/// Write Serilog events to the providers in <paramref name="providers"/>.
/// </summary>
/// <param name="configuration">The `WriteTo` object.</param>
/// <param name="providers">A <see cref="LoggerProviderCollection"/> to write events to.</param>
/// <param name="restrictedToMinimumLevel">The minimum level for
/// events passed through the sink. Ignored when <paramref name="levelSwitch"/> is specified.</param>
/// <param name="levelSwitch">A switch allowing the pass-through minimum level
/// to be changed at runtime.</param>
/// <returns>A <see cref="LoggerConfiguration"/> to allow method chaining.</returns>
public static LoggerConfiguration Providers(
this LoggerSinkConfiguration configuration,
LoggerProviderCollection providers,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
LoggingLevelSwitch levelSwitch = null)
{
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
if (providers == null) throw new ArgumentNullException(nameof(providers));
return configuration.Sink(new LoggerProviderCollectionSink(providers), restrictedToMinimumLevel, levelSwitch);
}
}
}
| // Copyright 2019 Serilog Contributors
//
// 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 Serilog.Configuration;
using Serilog.Extensions.Logging;
namespace Serilog
{
/// <summary>
/// Extensions for <see cref="LoggerSinkConfiguration"/>.
/// </summary>
public static class LoggerSinkConfigurationExtensions
{
/// <summary>
/// Write Serilog events to the providers in <paramref name="providers"/>.
/// </summary>
/// <param name="configuration">The `WriteTo` object.</param>
/// <param name="providers">A <see cref="LoggerProviderCollection"/> to write events to.</param>
/// <returns>A <see cref="LoggerConfiguration"/> to allow method chaining.</returns>
public static LoggerConfiguration Providers(this LoggerSinkConfiguration configuration, LoggerProviderCollection providers)
{
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
if (providers == null) throw new ArgumentNullException(nameof(providers));
return configuration.Sink(new LoggerProviderCollectionSink(providers));
}
}
}
| apache-2.0 | C# |
82be76f17cfd245315479c41c869fbd0348ccf53 | remove code gen test | bitsummation/pickaxe,bitsummation/pickaxe | PickAxe.Tests/CodeGen.cs | PickAxe.Tests/CodeGen.cs | /* Copyright 2015 Brock Reeve
* 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 NUnit.Framework;
using Pickaxe.Emit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PickAxe.Tests
{
[TestFixture]
public class CodeGen
{
[Test]
public void TestCodeRunner()
{
}
[Test]
public void BasicCodeGenTest()
{
var input = @"
create mssql prices(
rentalId int,
season string
)
with (
connectionstring = 'Server=sandbagger;Database=scrape;Trusted_Connection=True;',
dbtable = 'prices'
)
";
var compiler = new Compiler(input);
var sources = compiler.ToCode();
Assert.IsTrue(compiler.Errors.Count == 0);
}
}
}
| /* Copyright 2015 Brock Reeve
* 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 NUnit.Framework;
using Pickaxe.Emit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PickAxe.Tests
{
[TestFixture]
public class CodeGen
{
[Test]
public void TestCodeRunner()
{
Code code = new Code(new string[0]);
code.Run();
}
[Test]
public void BasicCodeGenTest()
{
var input = @"
create mssql prices(
rentalId int,
season string
)
with (
connectionstring = 'Server=sandbagger;Database=scrape;Trusted_Connection=True;',
dbtable = 'prices'
)
";
var compiler = new Compiler(input);
var sources = compiler.ToCode();
Assert.IsTrue(compiler.Errors.Count == 0);
}
}
}
| apache-2.0 | C# |
276d2cd2bb198419a9f8070f60aaf1f50556299a | Fix null check | pacificIT/cxxi,zillemarco/CppSharp,shana/cppinterop,zillemarco/CppSharp,mydogisbox/CppSharp,imazen/CppSharp,corngood/cxxi,genuinelucifer/CppSharp,genuinelucifer/CppSharp,zillemarco/CppSharp,pacificIT/cxxi,zillemarco/CppSharp,mydogisbox/CppSharp,inordertotest/CppSharp,KonajuGames/CppSharp,ddobrev/CppSharp,inordertotest/CppSharp,mono/cxxi,nalkaro/CppSharp,nalkaro/CppSharp,xistoso/CppSharp,genuinelucifer/CppSharp,mohtamohit/CppSharp,ktopouzi/CppSharp,mono/CppSharp,mydogisbox/CppSharp,txdv/CppSharp,mono/CppSharp,mono/cxxi,nalkaro/CppSharp,xistoso/CppSharp,SonyaSa/CppSharp,SonyaSa/CppSharp,mohtamohit/CppSharp,ktopouzi/CppSharp,mydogisbox/CppSharp,zillemarco/CppSharp,corngood/cxxi,Samana/CppSharp,txdv/CppSharp,genuinelucifer/CppSharp,genuinelucifer/CppSharp,imazen/CppSharp,imazen/CppSharp,txdv/CppSharp,u255436/CppSharp,SonyaSa/CppSharp,corngood/cxxi,inordertotest/CppSharp,mohtamohit/CppSharp,inordertotest/CppSharp,mono/CppSharp,xistoso/CppSharp,Samana/CppSharp,mohtamohit/CppSharp,pacificIT/cxxi,Samana/CppSharp,ddobrev/CppSharp,shana/cppinterop,mono/cxxi,SonyaSa/CppSharp,shana/cppinterop,mohtamohit/CppSharp,Samana/CppSharp,txdv/CppSharp,ddobrev/CppSharp,ktopouzi/CppSharp,shana/cppinterop,ktopouzi/CppSharp,SonyaSa/CppSharp,ddobrev/CppSharp,inordertotest/CppSharp,u255436/CppSharp,mono/CppSharp,nalkaro/CppSharp,KonajuGames/CppSharp,mydogisbox/CppSharp,KonajuGames/CppSharp,u255436/CppSharp,nalkaro/CppSharp,u255436/CppSharp,KonajuGames/CppSharp,xistoso/CppSharp,ddobrev/CppSharp,mono/CppSharp,txdv/CppSharp,Samana/CppSharp,mono/CppSharp,u255436/CppSharp,KonajuGames/CppSharp,imazen/CppSharp,xistoso/CppSharp,mono/cxxi,ktopouzi/CppSharp,imazen/CppSharp | Mono.VisualC.Code/CodeDomExtensions.cs | Mono.VisualC.Code/CodeDomExtensions.cs | using System;
using System.Linq;
using System.Text;
using System.CodeDom;
using Mono.VisualC.Interop;
namespace Mono.VisualC.Code {
public static class CodeDomExtensions {
public static CodeTypeReference TypeReference (this CodeTypeDeclaration ctd)
{
return new CodeTypeReference (ctd.Name, ctd.TypeParameterReferences ());
}
public static CodeTypeReference TypeReference (this CppType t)
{
return t.TypeReference (false);
}
public static CodeTypeReference TypeReference (this CppType t, bool useManagedType)
{
var tempParm = from m in t.Modifiers.OfType<CppModifiers.TemplateModifier> ()
from p in m.Types
select p.TypeReference (true);
Type managedType = useManagedType? t.ToManagedType () : null;
if (managedType == typeof (ICppObject))
managedType = null;
return new CodeTypeReference (managedType != null ? managedType.FullName : t.ElementTypeName, tempParm.ToArray ());
}
public static CodeTypeReference [] TypeParameterReferences (this CodeTypeDeclaration ctd)
{
return ctd.TypeParameters.Cast<CodeTypeParameter> ().Select (p => new CodeTypeReference (p)).ToArray ();
}
}
}
| using System;
using System.Linq;
using System.Text;
using System.CodeDom;
using Mono.VisualC.Interop;
namespace Mono.VisualC.Code {
public static class CodeDomExtensions {
public static CodeTypeReference TypeReference (this CodeTypeDeclaration ctd)
{
return new CodeTypeReference (ctd.Name, ctd.TypeParameterReferences ());
}
public static CodeTypeReference TypeReference (this CppType t)
{
return t.TypeReference (false);
}
public static CodeTypeReference TypeReference (this CppType t, bool useManagedType)
{
var tempParm = from m in t.Modifiers.OfType<CppModifiers.TemplateModifier> ()
from p in m.Types
select p.TypeReference (true);
Type managedType = useManagedType? t.ToManagedType () : null;
if (managedType == typeof (ICppObject))
managedType = null;
return new CodeTypeReference (managedType.FullName ?? t.ElementTypeName, tempParm.ToArray ());
}
public static CodeTypeReference [] TypeParameterReferences (this CodeTypeDeclaration ctd)
{
return ctd.TypeParameters.Cast<CodeTypeParameter> ().Select (p => new CodeTypeReference (p)).ToArray ();
}
}
}
| mit | C# |
bd7e87553c93021f3a9ee5edb414c2a4b07a3401 | Define an implicit conversion from strings to markup nodes | jonathanvdc/Pixie,jonathanvdc/Pixie | Pixie/MarkupNode.cs | Pixie/MarkupNode.cs | using System;
using Pixie.Markup;
namespace Pixie
{
/// <summary>
/// A base class for markup nodes: composable elements that can
/// be rendered.
/// </summary>
public abstract class MarkupNode
{
/// <summary>
/// Gets a fallback version of this node for when the renderer
/// doesn't know how to render this node's type. Null is
/// returned if no reasonable fallback can be provided.
/// </summary>
/// <returns>The node's fallback version, or <c>null</c>.</returns>
public abstract MarkupNode Fallback { get; }
/// <summary>
/// Applies a mapping to this markup node's children and returns
/// a new instance of this node's type that contains the modified
/// children.
/// </summary>
/// <param name="mapping">A mapping function.</param>
/// <returns>A new markup node.</returns>
public abstract MarkupNode Map(Func<MarkupNode, MarkupNode> mapping);
/// <summary>
/// Creates a text markup node from a string of characters.
/// </summary>
/// <param name="text">
/// The text to wrap in a text markup node.
/// </param>
public static implicit operator MarkupNode(string text)
{
return new Text(text);
}
}
}
| using System;
namespace Pixie
{
/// <summary>
/// A base class for markup nodes: composable elements that can
/// be rendered.
/// </summary>
public abstract class MarkupNode
{
/// <summary>
/// Gets a fallback version of this node for when the renderer
/// doesn't know how to render this node's type. Null is
/// returned if no reasonable fallback can be provided.
/// </summary>
/// <returns>The node's fallback version, or <c>null</c>.</returns>
public abstract MarkupNode Fallback { get; }
/// <summary>
/// Applies a mapping to this markup node's children and returns
/// a new instance of this node's type that contains the modified
/// children.
/// </summary>
/// <param name="mapping">A mapping function.</param>
/// <returns>A new markup node.</returns>
public abstract MarkupNode Map(Func<MarkupNode, MarkupNode> mapping);
}
} | mit | C# |
3828e4b8735b494e7384f83b34816a15afdf6cf3 | add Digits() tests | martinlindhe/Punku | PunkuTests/Extensions/IntExtensions.cs | PunkuTests/Extensions/IntExtensions.cs | using System;
using NUnit.Framework;
using Punku;
[TestFixture]
[Category ("Extensions")]
public class Extensions_Int
{
[Test]
public void Negative01 ()
{
int x = 1;
Assert.AreEqual (x.IsNegative (), false);
}
[Test]
public void Negative02 ()
{
int x = 0;
Assert.AreEqual (x.IsNegative (), false);
}
[Test]
public void Negative03 ()
{
int x = -1;
Assert.AreEqual (x.IsNegative (), true);
}
[Test]
public void CountDigits01 ()
{
int x = 1;
Assert.AreEqual (x.CountDigits (), 1);
}
[Test]
public void CountDigits02 ()
{
int x = 1234;
Assert.AreEqual (x.CountDigits (), 4);
}
[Test]
public void CountDigits03 ()
{
int x = 99999999;
Assert.AreEqual (x.CountDigits (), 8);
}
[Test]
public void CountDigits04 ()
{
int x = 123456789;
Assert.AreEqual (x.CountDigits (), 9);
}
[Test]
public void Digits01 ()
{
int x = 7;
Assert.AreEqual (
x.Digits (),
new byte[] { 7 }
);
}
[Test]
public void Digits02 ()
{
int x = 123456789;
Assert.AreEqual (
x.Digits (),
new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
);
}
} | using System;
using NUnit.Framework;
using Punku;
[TestFixture]
[Category ("Extensions")]
public class Extensions_Int
{
[Test]
public void Negative01 ()
{
int x = 1;
Assert.AreEqual (x.IsNegative (), false);
}
[Test]
public void Negative02 ()
{
int x = 0;
Assert.AreEqual (x.IsNegative (), false);
}
[Test]
public void Negative03 ()
{
int x = -1;
Assert.AreEqual (x.IsNegative (), true);
}
[Test]
public void GetDigitCount01 ()
{
int x = 1;
Assert.AreEqual (x.CountDigits (), 1);
}
[Test]
public void GetDigitCount02 ()
{
int x = 1234;
Assert.AreEqual (x.CountDigits (), 4);
}
[Test]
public void GetDigitCount03 ()
{
int x = 99999999;
Assert.AreEqual (x.CountDigits (), 8);
}
[Test]
public void GetDigitCount04 ()
{
int x = 123456789;
Assert.AreEqual (x.CountDigits (), 9);
}
} | mit | C# |
4688f63632324d54c8f7e2b471f795babb050e60 | Simplify the code a bit | SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,grokys/Perspex,jkoritzinsky/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,Perspex/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,Perspex/Perspex | src/Avalonia.Styling/ClassBindingManager.cs | src/Avalonia.Styling/ClassBindingManager.cs | using System;
using System.Collections.Generic;
using Avalonia.Data;
namespace Avalonia
{
internal static class ClassBindingManager
{
private static readonly Dictionary<string, AvaloniaProperty> s_RegisteredProperties =
new Dictionary<string, AvaloniaProperty>();
public static IDisposable Bind(IStyledElement target, string className, IBinding source, object anchor)
{
if (!s_RegisteredProperties.TryGetValue(className, out var prop))
s_RegisteredProperties[className] = prop = RegisterClassProxyProperty(className);
return target.Bind(prop, source, anchor);
}
private static AvaloniaProperty RegisterClassProxyProperty(string className)
{
var prop = AvaloniaProperty.Register<StyledElement, bool>("__AvaloniaReserved::Classes::" + className);
prop.Changed.Subscribe(args =>
{
var classes = ((IStyledElement)args.Sender).Classes;
classes.Set(className, args.NewValue.GetValueOrDefault());
});
return prop;
}
}
}
| using System;
using System.Collections.Generic;
using Avalonia.Data;
namespace Avalonia
{
internal static class ClassBindingManager
{
private static readonly Dictionary<string, AvaloniaProperty> s_RegisteredProperties =
new Dictionary<string, AvaloniaProperty>();
public static IDisposable Bind(IStyledElement target, string className, IBinding source, object anchor)
{
if (!s_RegisteredProperties.TryGetValue(className, out var prop))
s_RegisteredProperties[className] = prop = RegisterClassProxyProperty(className);
return target.Bind(prop, source, anchor);
}
private static AvaloniaProperty RegisterClassProxyProperty(string className)
{
var prop = AvaloniaProperty.Register<StyledElement, bool>("__AvaloniaReserved::Classes::" + className);
prop.Changed.Subscribe(args =>
{
var enable = args.NewValue.GetValueOrDefault();
var classes = ((IStyledElement)args.Sender).Classes;
if (enable)
{
if (!classes.Contains(className))
classes.Add(className);
}
else
classes.Remove(className);
});
return prop;
}
}
}
| mit | C# |
f98c2c28950170c75517f2eead4b67f0474ba451 | remove bad key | tparnell8/AspNetCache-AzureTableStorage,tparnell8/AspNetCache-AzureTableStorage,tparnell8/AspNetCache-AzureTableStorage | src/AzureTableStorageCacheSample/Startup.cs | src/AzureTableStorageCacheSample/Startup.cs | using AzureTableStorageCache;
using AzureTableStorageCacheSample;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AzureTableStorageCacheSample
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddAzureTableStorageCache("connectionstring", "table", "partitionKey");
// Add framework services.
services.AddMvc();
}
// 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)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
} | using AzureTableStorageCache;
using AzureTableStorageCacheSample;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AzureTableStorageCacheSample
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddAzureTableStorageCache("DefaultEndpointsProtocol=https;AccountName=tparnell;AccountKey=cEHdbvM6bljcIYOaODs16vRokLDvxujEn+JR/8MWgYE/9g4mw95n/jusTAdvhc/JrySfZGwaq/WIg9Bi/TeoOw==", "yodawg", "cachingforlyfe");
// Add framework services.
services.AddMvc();
}
// 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)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
} | mit | C# |
1f6e57c894122551ad3111e91e695a7f29689ae1 | Update Settings.cs | unvell/ReoGrid,unvell/ReoGrid | ReoGrid/Settings.cs | ReoGrid/Settings.cs | /*****************************************************************************
*
* ReoGrid - .NET Spreadsheet Control
*
* http://reogrid.net/
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
* PURPOSE.
*
* Author: Jing <lujing at unvell.com>
*
* Copyright (c) 2012-2016 Jing <lujing at unvell.com>
* Copyright (c) 2012-2016 unvell.com, all rights reserved.
*
****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace unvell.ReoGrid
{
/// <summary>
/// Obsoleted control settings, changed to WorkbookSettings and WorksheetSettings
/// </summary>
[Obsolete("changed to WorksheetSettings and WorkbookSettings, http://reogrid.net/document/settings")]
public enum ReoGridSettings
{
}
#region Settings
/// <summary>
/// Workbook Control Settings
/// </summary>
public enum WorkbookSettings : ulong
{
/// <summary>
/// None
/// </summary>
None = 0x000000000L,
/// <summary>
/// Default Settings
/// </summary>
Default = View_Default | Behavior_Default | View_ShowScrolls
#if EX_SCRIPT
| Script_Default
#endif // EX_SCRIPT
,
#region Behavior
/// <summary>
/// Default behavior settings
/// </summary>
Behavior_Default = 0L,
#endregion // Behavior
#region View
/// <summary>
/// Default View Settings
/// </summary>
View_Default = View_ShowSheetTabControl,
/// <summary>
/// Determine whether or not to show sheet tab control
/// </summary>
View_ShowSheetTabControl = 0x00010000L,
/// <summary>
/// Determine whether or not to show horizontal and vertical scroll bars
/// </summary>
View_ShowScrolls = View_ShowHorScroll | View_ShowVerScroll,
/// <summary>
/// Determine whether or not to show horizontal scroll bar
/// </summary>
View_ShowHorScroll = 0x00020000L,
/// <summary>
/// Determine whether or not to show vertical scroll bar
/// </summary>
View_ShowVerScroll = 0x00040000L,
#endregion // View
#region Script
#if EX_SCRIPT
/// <summary>
/// Default settings of script
/// </summary>
Script_Default = Script_AutoRunOnload | Script_PromptBeforeAutoRun,
/// <summary>
/// Whether to run script if grid loaded from file which contains script
/// </summary>
Script_AutoRunOnload = 0x10000000L,
/// <summary>
/// Confirm to user that whether allowed to run script if the script is loaded from a file
/// </summary>
Script_PromptBeforeAutoRun = 0x20000000L,
#endif // EX_SCRIPT
#endregion // Script
}
#endregion
}
| /*****************************************************************************
*
* ReoGrid - .NET Spreadsheet Control
*
* http://reogrid.net/
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
* PURPOSE.
*
* Author: Jing <lujing at unvell.com>
*
* Copyright (c) 2012-2016 Jing <lujing at unvell.com>
* Copyright (c) 2012-2016 unvell.com, all rights reserved.
*
****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace unvell.ReoGrid
{
/// <summary>
/// Obsoleted control settings, changed to WorkbookSettings and WorksheetSettings
/// </summary>
[Obsolete("changed to WorksheetSettings and WorkbookSettings, http://reogrid.net/document/settings")]
public enum ReoGridSettings
{
}
#region Settings
/// <summary>
/// Workbook Control Settings
/// </summary>
public enum WorkbookSettings : ulong
{
/// <summary>
/// None
/// </summary>
None = 0x000000000L,
/// <summary>
/// Default Settings
/// </summary>
Default = View_Default | Behaivor_Default | View_ShowScrolls
#if EX_SCRIPT
| Script_Default
#endif // EX_SCRIPT
,
#region Behaivor
/// <summary>
/// Default behaivor settings
/// </summary>
Behaivor_Default = 0L,
#endregion // Behaivor
#region View
/// <summary>
/// Default View Settings
/// </summary>
View_Default = View_ShowSheetTabControl,
/// <summary>
/// Determine whether or not to show sheet tab control
/// </summary>
View_ShowSheetTabControl = 0x00010000L,
/// <summary>
/// Determine whether or not to show horizontal and vertical scroll bars
/// </summary>
View_ShowScrolls = View_ShowHorScroll | View_ShowVerScroll,
/// <summary>
/// Determine whether or not to show horizontal scroll bar
/// </summary>
View_ShowHorScroll = 0x00020000L,
/// <summary>
/// Determine whether or not to show vertical scroll bar
/// </summary>
View_ShowVerScroll = 0x00040000L,
#endregion // View
#region Script
#if EX_SCRIPT
/// <summary>
/// Default settings of script
/// </summary>
Script_Default = Script_AutoRunOnload | Script_PromptBeforeAutoRun,
/// <summary>
/// Whether to run script if grid loaded from file which contains script
/// </summary>
Script_AutoRunOnload = 0x10000000L,
/// <summary>
/// Confirm to user that whether allowed to run script if the script is loaded from a file
/// </summary>
Script_PromptBeforeAutoRun = 0x20000000L,
#endif // EX_SCRIPT
#endregion // Script
}
#endregion
}
| mit | C# |
260b7f5ef335983dfcb3b255b6f5c9ede3834e74 | add setter | sebas77/Svelto.ECS,sebas77/Svelto-ECS | Svelto.ECS/EntityDescriptor.cs | Svelto.ECS/EntityDescriptor.cs | using System;
using DesignByContract;
using Svelto.DataStructures;
using Svelto.ECS.Internal;
namespace Svelto.ECS
{
public interface IEntityDescriptor
{
IEntityViewBuilder[] entityViewsToBuild { get; }
}
public class EntityDescriptor : IEntityDescriptor
{
protected EntityDescriptor(IEntityViewBuilder[] entityViewsToBuild)
{
this.entityViewsToBuild = entityViewsToBuild;
}
public IEntityViewBuilder[] entityViewsToBuild { get; private set; }
}
public interface IEntityDescriptorInfo
{
}
public static class EntityDescriptorTemplate<TType> where TType : IEntityDescriptor, new()
{
public static readonly IEntityDescriptorInfo Default = new EntityDescriptorInfo(new TType());
}
public class DynamicEntityDescriptorInfo<TType> : EntityDescriptorInfo where TType : IEntityDescriptor, new()
{
public DynamicEntityDescriptorInfo(FasterList<IEntityViewBuilder> extraEntityViews)
{
Check.Require(extraEntityViews.Count > 0,
"don't use a DynamicEntityDescriptorInfo if you don't need to use extra EntityViews");
var descriptor = new TType();
var length = descriptor.entityViewsToBuild.Length;
entityViewsToBuild = new IEntityViewBuilder[length + extraEntityViews.Count];
Array.Copy(descriptor.entityViewsToBuild, 0, entityViewsToBuild, 0, length);
Array.Copy(extraEntityViews.ToArrayFast(), 0, entityViewsToBuild, length, extraEntityViews.Count);
name = descriptor.ToString();
}
}
}
namespace Svelto.ECS.Internal
{
public class EntityDescriptorInfo : IEntityDescriptorInfo
{
internal IEntityViewBuilder[] entityViewsToBuild;
internal string name;
internal EntityDescriptorInfo(IEntityDescriptor descriptor)
{
name = descriptor.ToString();
entityViewsToBuild = descriptor.entityViewsToBuild;
}
protected EntityDescriptorInfo()
{
}
}
} | using System;
using DesignByContract;
using Svelto.DataStructures;
using Svelto.ECS.Internal;
namespace Svelto.ECS
{
public interface IEntityDescriptor
{
IEntityViewBuilder[] entityViewsToBuild { get; }
}
public class EntityDescriptor : IEntityDescriptor
{
protected EntityDescriptor(IEntityViewBuilder[] entityViewsToBuild)
{
this.entityViewsToBuild = entityViewsToBuild;
}
public IEntityViewBuilder[] entityViewsToBuild { get; }
}
public interface IEntityDescriptorInfo
{
}
public static class EntityDescriptorTemplate<TType> where TType : IEntityDescriptor, new()
{
public static readonly IEntityDescriptorInfo Default = new EntityDescriptorInfo(new TType());
}
public class DynamicEntityDescriptorInfo<TType> : EntityDescriptorInfo where TType : IEntityDescriptor, new()
{
public DynamicEntityDescriptorInfo(FasterList<IEntityViewBuilder> extraEntityViews)
{
Check.Require(extraEntityViews.Count > 0,
"don't use a DynamicEntityDescriptorInfo if you don't need to use extra EntityViews");
var descriptor = new TType();
var length = descriptor.entityViewsToBuild.Length;
entityViewsToBuild = new IEntityViewBuilder[length + extraEntityViews.Count];
Array.Copy(descriptor.entityViewsToBuild, 0, entityViewsToBuild, 0, length);
Array.Copy(extraEntityViews.ToArrayFast(), 0, entityViewsToBuild, length, extraEntityViews.Count);
name = descriptor.ToString();
}
}
}
namespace Svelto.ECS.Internal
{
public class EntityDescriptorInfo : IEntityDescriptorInfo
{
internal IEntityViewBuilder[] entityViewsToBuild;
internal string name;
internal EntityDescriptorInfo(IEntityDescriptor descriptor)
{
name = descriptor.ToString();
entityViewsToBuild = descriptor.entityViewsToBuild;
}
protected EntityDescriptorInfo()
{
}
}
} | mit | C# |
d0407b9515bc0a7f33299ba495d87c33fa086402 | Check invoke command length | Deliay/osuSync,Deliay/Sync | Sync/Command/CommandManager.cs | Sync/Command/CommandManager.cs | using Sync.Tools;
using static Sync.Tools.DefaultI18n;
using System;
namespace Sync.Command
{
public class CommandManager
{
CommandDispatch dispatch;
public CommandManager()
{
dispatch = new CommandDispatch();
}
public CommandDispatch Dispatch
{
get { return dispatch; }
}
public void invokeCmdString(string cmd)
{
if (cmd.Length == 0) return;
string[] args = cmd.Split(" ".ToCharArray(), 2);
if(args.Length < 1 )
{
IO.CurrentIO.Write(LANG_UnknowCommand);
return;
}
string arg = string.Empty;
if (args.Length > 1) arg = args[1];
if (!dispatch.invoke(args[0], (arg == string.Empty ? new Arguments() : arg.Split(' '))))
{
IO.CurrentIO.Write(LANG_CommandFail);
}
}
}
}
| using Sync.Tools;
using static Sync.Tools.DefaultI18n;
using System;
namespace Sync.Command
{
public class CommandManager
{
CommandDispatch dispatch;
public CommandManager()
{
dispatch = new CommandDispatch();
}
public CommandDispatch Dispatch
{
get { return dispatch; }
}
public void invokeCmdString(string cmd)
{
string[] args = cmd.Split(" ".ToCharArray(), 2);
if(args.Length < 1 )
{
IO.CurrentIO.Write(LANG_UnknowCommand);
return;
}
string arg = string.Empty;
if (args.Length > 1) arg = args[1];
if (!dispatch.invoke(args[0], (arg == string.Empty ? new Arguments() : arg.Split(' '))))
{
IO.CurrentIO.Write(LANG_CommandFail);
}
}
}
}
| mit | C# |
713a09818ca8bbab60928c2c50c2cda16e6280be | Update ListCategories.cshtml | SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery | AstroPhotoGallery/AstroPhotoGallery/Views/Home/ListCategories.cshtml | AstroPhotoGallery/AstroPhotoGallery/Views/Home/ListCategories.cshtml | @model PagedList.IPagedList<AstroPhotoGallery.Models.Category>
@using PagedList.Mvc;
@using System.Linq;
@{
ViewBag.Title = "Categories";
}
<div class="container">
<h2 class="text-center">Browse by categories</h2>
<br />
@foreach (var category in Model)
{
<div class="col-sm-4">
<div class="thumbnail">
<a href="/Home/ListPictures/?categoryId=@category.Id">
@if (category.Pictures.Any(p => p.CategoryId == category.Id))
{
<img src="@Url.Content(category.Pictures.Where(p => p.CategoryId == category.Id).FirstOrDefault().ImagePath)" style="width: 360px; height:270px">
}
else
{
<img src="~/Content/images/default-gallery-image.jpg" style="width: 360px; height:270px" />
}
</a>
<div class="caption text-center">
<h4>
@string.Format($"{category.Name} ({category.Pictures.Count()})")
</h4>
</div>
</div>
</div>
}
</div>
<div class="container">
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
@Html.PagedListPager(Model, page => Url.Action("ListCategories",
new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))
</div>
| @model PagedList.IPagedList<AstroPhotoGallery.Models.Category>
@using PagedList.Mvc;
@using System.Linq;
@{
ViewBag.Title = "Categories";
}
<div class="container">
<h2 class="text-center">Browse by categories</h2>
<br/>
@foreach (var category in Model)
{
<div class="col-sm-4">
<div class="thumbnail">
@if (category.Pictures.Any(p => p.CategoryId == category.Id))
{
<img src="@Url.Content(category.Pictures.Where(p => p.CategoryId == category.Id).FirstOrDefault().ImagePath)" style="width: 360px; height:270px" >
}
else
{
<img src="~/Content/images/default-gallery-image.jpg" style="width: 360px; height:270px"/>
}
<div class="caption text-center">
<h4>
@Html.ActionLink(string.Format($"{category.Name} ({category.Pictures.Count})"),
"ListPictures", "Home", new { @categoryId = category.Id }, null)
</h4>
</div>
</div>
</div>
}
</div>
<div class="container">
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
@Html.PagedListPager(Model, page => Url.Action("ListCategories",
new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))
</div>
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.