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 |
|---|---|---|---|---|---|---|---|---|
6eff92b5a22d2e1f3ad4d083386e43e3739d7835
|
fix processor
|
volak/Aggregates.NET,volak/Aggregates.NET
|
src/Aggregates.NET.Testing/Internal/TestableProcessor.cs
|
src/Aggregates.NET.Testing/Internal/TestableProcessor.cs
|
using Aggregates.Contracts;
using Aggregates.Exceptions;
using Newtonsoft.Json;
using NServiceBus.MessageInterfaces.MessageMapper.Reflection;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Threading.Tasks;
namespace Aggregates.Internal
{
[ExcludeFromCodeCoverage]
class TestableProcessor : ITestableProcessor
{
private readonly TestableEventFactory _factory;
public TestableProcessor()
{
_factory = new TestableEventFactory(new MessageMapper());
Planned = new Dictionary<string, object>();
Requested = new List<string>();
}
internal Dictionary<string, object> Planned;
internal List<string> Requested;
public IServicePlanner<TService, TResponse> Plan<TService, TResponse>(TService service) where TService : IService<TResponse>
{
return new ServicePlanner<TService, TResponse>(this, service);
}
public IServiceChecker<TService, TResponse> Check<TService, TResponse>(TService service) where TService : IService<TResponse>
{
return new ServiceChecker<TService, TResponse>(this, service);
}
public Task<TResponse> Process<TService, TResponse>(TService service, IContainer container) where TService : IService<TResponse>
{
var serviceString = JsonConvert.SerializeObject(service);
if (!Planned.ContainsKey($"{typeof(TService).FullName}.{serviceString}"))
throw new ArgumentException($"Service {typeof(TService).FullName} body {serviceString} was not planned");
return Task.FromResult((TResponse)Planned[$"{typeof(TService).FullName}.{serviceString}"]);
}
public Task<TResponse> Process<TService, TResponse>(Action<TService> service, IContainer container) where TService : IService<TResponse>
{
return Process<TService, TResponse>(_factory.Create(service), container);
}
}
}
|
using Aggregates.Contracts;
using Aggregates.Exceptions;
using Newtonsoft.Json;
using NServiceBus.MessageInterfaces.MessageMapper.Reflection;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Threading.Tasks;
namespace Aggregates.Internal
{
[ExcludeFromCodeCoverage]
class TestableProcessor : ITestableProcessor
{
private readonly TestableEventFactory _factory;
public TestableProcessor()
{
_factory = new TestableEventFactory(new MessageMapper());
Planned = new Dictionary<string, object>();
Requested = new List<string>();
}
internal Dictionary<string, object> Planned;
internal List<string> Requested;
public IServicePlanner<TService, TResponse> Plan<TService, TResponse>(TService service) where TService : IService<TResponse>
{
return new ServicePlanner<TService, TResponse>(this, service);
}
public IServiceChecker<TService, TResponse> Check<TService, TResponse>(TService service) where TService : IService<TResponse>
{
return new ServiceChecker<TService, TResponse>(this, service);
}
public Task<TResponse> Process<TService, TResponse>(TService service, IContainer container) where TService : IService<TResponse>
{
var serviceString = JsonConvert.SerializeObject(service);
if (!Planned.ContainsKey(serviceString))
throw new ArgumentException($"Service {typeof(TService).FullName} body {serviceString} was not planned");
return Task.FromResult((TResponse)Planned[serviceString]);
}
public Task<TResponse> Process<TService, TResponse>(Action<TService> service, IContainer container) where TService : IService<TResponse>
{
return Process<TService, TResponse>(_factory.Create(service), container);
}
}
}
|
mit
|
C#
|
a9228847dc55419bd01f6ec1e6867142da0aaedf
|
Add possibility to register a rdl file in test definition
|
Seddryck/NBi,Seddryck/NBi
|
NBi.Xml/Items/ReportXml.cs
|
NBi.Xml/Items/ReportXml.cs
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Xml.Serialization;
using NBi.Core;
using NBi.Core.Report;
namespace NBi.Xml.Items
{
public class ReportXml : QueryableXml
{
[XmlAttribute("source")]
public string Source { get; set; }
[XmlAttribute("path")]
public string Path { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
[XmlAttribute("dataset")]
public string Dataset { get; set; }
[XmlElement("parameter")]
public List<QueryParameterXml> Parameters { get; set; }
public ReportXml()
{
Parameters = new List<QueryParameterXml>();
}
public override string GetQuery()
{
var parser = ParserFactory.GetParser(
Source
, Path
, Name
, Dataset
);
var request = ParserFactory.GetRequest(
Source
, Settings.BasePath
, Path
, Name
, Dataset
);
var query = parser.ExtractQuery(request);
return query;
}
public List<QueryParameterXml> GetParameters()
{
var list = Parameters;
foreach (var param in Default.Parameters)
if (!Parameters.Exists(p => p.Name == param.Name))
list.Add(param);
return list;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries for security vulnerabilities")]
public virtual IDbCommand GetCommand()
{
var conn = new ConnectionFactory().Get(GetConnectionString());
var cmd = conn.CreateCommand();
cmd.CommandText = GetQuery();
return cmd;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Xml.Serialization;
using NBi.Core;
using NBi.Core.Report;
namespace NBi.Xml.Items
{
public class ReportXml : QueryableXml
{
[XmlAttribute("source")]
public string Source { get; set; }
[XmlAttribute("path")]
public string Path { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
[XmlAttribute("dataset")]
public string Dataset { get; set; }
[XmlElement("parameter")]
public List<QueryParameterXml> Parameters { get; set; }
public ReportXml()
{
Parameters = new List<QueryParameterXml>();
}
public override string GetQuery()
{
var request = new DatabaseRequest(
Source
, Path
, Name
, Dataset
);
var parser = new DatabaseParser();
var query = parser.ExtractQuery(request);
return query;
}
public List<QueryParameterXml> GetParameters()
{
var list = Parameters;
foreach (var param in Default.Parameters)
if (!Parameters.Exists(p => p.Name == param.Name))
list.Add(param);
return list;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries for security vulnerabilities")]
public virtual IDbCommand GetCommand()
{
var conn = new ConnectionFactory().Get(GetConnectionString());
var cmd = conn.CreateCommand();
cmd.CommandText = GetQuery();
return cmd;
}
}
}
|
apache-2.0
|
C#
|
b08d98a83e5613e6740e206ba268e5c320675f95
|
Add doc
|
jasonmalinowski/roslyn,weltkante/roslyn,davkean/roslyn,jasonmalinowski/roslyn,AlekseyTs/roslyn,tannergooding/roslyn,KevinRansom/roslyn,davkean/roslyn,panopticoncentral/roslyn,KevinRansom/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,davkean/roslyn,mgoertz-msft/roslyn,gafter/roslyn,mgoertz-msft/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,eriawan/roslyn,panopticoncentral/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,ErikSchierboom/roslyn,genlu/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,mavasani/roslyn,aelij/roslyn,heejaechang/roslyn,bartdesmet/roslyn,reaction1989/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,eriawan/roslyn,ErikSchierboom/roslyn,stephentoub/roslyn,gafter/roslyn,tmat/roslyn,AmadeusW/roslyn,brettfo/roslyn,wvdd007/roslyn,diryboy/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,tmat/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,jmarolf/roslyn,reaction1989/roslyn,mgoertz-msft/roslyn,gafter/roslyn,genlu/roslyn,tmat/roslyn,physhi/roslyn,sharwell/roslyn,AmadeusW/roslyn,stephentoub/roslyn,dotnet/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,tannergooding/roslyn,diryboy/roslyn,heejaechang/roslyn,AlekseyTs/roslyn,diryboy/roslyn,aelij/roslyn,brettfo/roslyn,AlekseyTs/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,KirillOsenkov/roslyn,brettfo/roslyn,stephentoub/roslyn,heejaechang/roslyn,aelij/roslyn,ErikSchierboom/roslyn,jmarolf/roslyn,physhi/roslyn,jmarolf/roslyn,wvdd007/roslyn,KirillOsenkov/roslyn,dotnet/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,tannergooding/roslyn,mavasani/roslyn,sharwell/roslyn
|
src/EditorFeatures/Core/FindUsages/IFindUsagesContext.cs
|
src/EditorFeatures/Core/FindUsages/IFindUsagesContext.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Shared.Utilities;
namespace Microsoft.CodeAnalysis.FindUsages
{
internal interface IFindUsagesContext
{
CancellationToken CancellationToken { get; }
/// <summary>
/// Used for clients that are finding usages to push information about how far along they
/// are in their search.
/// </summary>
IStreamingProgressTracker ProgressTracker { get; }
/// <summary>
/// Report a message to be displayed to the user.
/// </summary>
Task ReportMessageAsync(string message);
/// <summary>
/// Set the title of the window that results are displayed in.
/// </summary>
Task SetSearchTitleAsync(string title);
Task OnDefinitionFoundAsync(DefinitionItem definition);
Task OnReferenceFoundAsync(SourceReferenceItem reference);
[Obsolete("Use ProgressTracker instead", error: false)]
Task ReportProgressAsync(int current, int maximum);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Shared.Utilities;
namespace Microsoft.CodeAnalysis.FindUsages
{
internal interface IFindUsagesContext
{
CancellationToken CancellationToken { get; }
IStreamingProgressTracker ProgressTracker { get; }
/// <summary>
/// Report a message to be displayed to the user.
/// </summary>
Task ReportMessageAsync(string message);
/// <summary>
/// Set the title of the window that results are displayed in.
/// </summary>
Task SetSearchTitleAsync(string title);
Task OnDefinitionFoundAsync(DefinitionItem definition);
Task OnReferenceFoundAsync(SourceReferenceItem reference);
[Obsolete("Use ProgressTracker instead", error: false)]
Task ReportProgressAsync(int current, int maximum);
}
}
|
mit
|
C#
|
1f30255e7ebd86e8714d18ff4b286849cb1c4291
|
Bump version
|
nixxquality/WebMConverter,Yuisbean/WebMConverter,o11c/WebMConverter
|
Properties/AssemblyInfo.cs
|
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("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// 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.7.3")]
|
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("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// 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.7.2")]
|
mit
|
C#
|
ee5e48223bac3afd8da798b2531c401a5ee6e553
|
Modify the AssemblyInfo.cs file.
|
Zongsoft/Zongsoft.Externals.Redis
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Zongsoft.Externals.Redis")]
[assembly: AssemblyDescription("Zongsoft Externals Redis Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Zongsoft Corporation")]
[assembly: AssemblyProduct("Zongsoft.Externals.Redis Library")]
[assembly: AssemblyCopyright("Copyright(C) Zongsoft Corporation 2014. All rights reserved.")]
[assembly: AssemblyTrademark("Zongsoft is registered trademarks of Zongsoft Corporation in the P.R.C. and/or other countries.")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.1407.*")]
[assembly: AssemblyFileVersion("1.0.1407.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Zongsoft.Externals.Redis")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Zongsoft.Externals.Redis")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
lgpl-2.1
|
C#
|
84a5cf1d9ec46fb500bab98bb8e3e328466ee791
|
set version to 0.1.0
|
mastersign/mediacategorizer-ui
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("MediaCategorizer")]
[assembly: AssemblyDescription("Benutzeroberfläche zur Erstellung und Verwaltung von Projekten zur Kategorisierung von Videos.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Brandenburg University of Applied Sciences")]
[assembly: AssemblyProduct("MediaCategorizer")]
[assembly: AssemblyCopyright("Copyright © Tobias Kiertscher 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
//Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie
//<UICulture>ImCodeVerwendeteKultur</UICulture> in der .csproj-Datei
//in einer <PropertyGroup> fest. Wenn Sie in den Quelldateien beispielsweise Deutsch
//(Deutschland) verwenden, legen Sie <UICulture> auf \"de-DE\" fest. Heben Sie dann die Auskommentierung
//des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile,
//sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher
//(wird verwendet, wenn eine Ressource auf der Seite
// oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.)
ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs
//(wird verwendet, wenn eine Ressource auf der Seite, in der Anwendung oder einem
// designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.)
)]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("MediaCategorizer")]
[assembly: AssemblyDescription("Benutzeroberfläche zur Erstellung und Verwaltung von Projekten zur Kategorisierung von Videos.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Brandenburg University of Applied Sciences")]
[assembly: AssemblyProduct("MediaCategorizer")]
[assembly: AssemblyCopyright("Copyright © Tobias Kiertscher 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
//Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie
//<UICulture>ImCodeVerwendeteKultur</UICulture> in der .csproj-Datei
//in einer <PropertyGroup> fest. Wenn Sie in den Quelldateien beispielsweise Deutsch
//(Deutschland) verwenden, legen Sie <UICulture> auf \"de-DE\" fest. Heben Sie dann die Auskommentierung
//des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile,
//sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher
//(wird verwendet, wenn eine Ressource auf der Seite
// oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.)
ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs
//(wird verwendet, wenn eine Ressource auf der Seite, in der Anwendung oder einem
// designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.)
)]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
e55b6c52d710697f9ae40fe823a0c7c25a1811c8
|
Update version to 1.2.9
|
anonymousthing/ListenMoeClient
|
Properties/AssemblyInfo.cs
|
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("Listen.moe Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Listen.moe Client")]
[assembly: AssemblyCopyright("Copyright © 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("88b02799-425e-4622-a849-202adb19601b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.9.0")]
[assembly: AssemblyFileVersion("1.2.9.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("Listen.moe Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Listen.moe Client")]
[assembly: AssemblyCopyright("Copyright © 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("88b02799-425e-4622-a849-202adb19601b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.8.0")]
[assembly: AssemblyFileVersion("1.2.8.0")]
|
mit
|
C#
|
51df49b96c36807460183f05fdbb066b649df68c
|
Update AssemblyInfo.cs
|
sarbian/DDSLoader
|
Properties/AssemblyInfo.cs
|
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("DDSLoader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DDSLoader")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f6bca58e-dd5c-4f90-89dd-7959143459b3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: KSPAssembly("DDSLoader", 1, 5)]
|
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("DDSLoader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DDSLoader")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f6bca58e-dd5c-4f90-89dd-7959143459b3")]
// 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.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: KSPAssembly("DDSLoader", 1, 4)]
|
mit
|
C#
|
60b38b27764bc1de1a6033c86124146b075b533d
|
Add the most basic score calculation for catch
|
peppy/osu,Nabile-Rahmani/osu,DrabWeb/osu,peppy/osu,DrabWeb/osu,ppy/osu,naoey/osu,DrabWeb/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,naoey/osu,Frontear/osuKyzer,ZLima12/osu,johnneijzen/osu,naoey/osu,peppy/osu-new,NeoAdonis/osu,Drezi126/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,EVAST9919/osu,2yangk23/osu,ZLima12/osu,EVAST9919/osu,peppy/osu,smoogipooo/osu,johnneijzen/osu,UselessToucan/osu
|
osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs
|
osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Catch.Scoring
{
internal class CatchScoreProcessor : ScoreProcessor<CatchBaseHit>
{
public CatchScoreProcessor(RulesetContainer<CatchBaseHit> rulesetContainer)
: base(rulesetContainer)
{
}
protected override void SimulateAutoplay(Beatmap<CatchBaseHit> beatmap)
{
foreach (var obj in beatmap.HitObjects)
{
var fruit = obj as Fruit;
if (fruit != null)
AddJudgement(new CatchJudgement { Result = HitResult.Perfect });
}
base.SimulateAutoplay(beatmap);
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Catch.Scoring
{
internal class CatchScoreProcessor : ScoreProcessor<CatchBaseHit>
{
public CatchScoreProcessor()
{
}
public CatchScoreProcessor(RulesetContainer<CatchBaseHit> rulesetContainer)
: base(rulesetContainer)
{
}
}
}
|
mit
|
C#
|
e20700711cdf95a7da2fb69f138c1c0b10bf2937
|
Fix test failures
|
bartdesmet/roslyn,dotnet/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn
|
src/Compilers/CSharp/Portable/Compilation/CSharpCompilerDiagnosticAnalyzer.cs
|
src/Compilers/CSharp/Portable/Compilation/CSharpCompilerDiagnosticAnalyzer.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.
#nullable disable
using System;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.PooledObjects;
namespace Microsoft.CodeAnalysis.Diagnostics.CSharp
{
/// <summary>
/// DiagnosticAnalyzer for C# compiler's syntax/semantic/compilation diagnostics.
/// </summary>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
internal sealed class CSharpCompilerDiagnosticAnalyzer : CompilerDiagnosticAnalyzer
{
internal override CommonMessageProvider MessageProvider
{
get
{
return CodeAnalysis.CSharp.MessageProvider.Instance;
}
}
internal override ImmutableArray<int> GetSupportedErrorCodes()
{
var errorCodes = Enum.GetValues(typeof(ErrorCode));
var builder = ArrayBuilder<int>.GetInstance(errorCodes.Length);
foreach (ErrorCode errorCode in errorCodes)
{
// Compiler diagnostic analyzer does not support build-only diagnostics.
if (!ErrorFacts.IsBuildOnlyDiagnostic(errorCode) &&
errorCode is not (ErrorCode.Void or ErrorCode.Unknown))
{
builder.Add((int)errorCode);
}
}
return builder.ToImmutableAndFree();
}
}
}
|
// 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.
#nullable disable
using System;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.PooledObjects;
namespace Microsoft.CodeAnalysis.Diagnostics.CSharp
{
/// <summary>
/// DiagnosticAnalyzer for C# compiler's syntax/semantic/compilation diagnostics.
/// </summary>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
internal sealed class CSharpCompilerDiagnosticAnalyzer : CompilerDiagnosticAnalyzer
{
internal override CommonMessageProvider MessageProvider
{
get
{
return CodeAnalysis.CSharp.MessageProvider.Instance;
}
}
internal override ImmutableArray<int> GetSupportedErrorCodes()
{
var errorCodes = Enum.GetValues(typeof(ErrorCode));
var builder = ArrayBuilder<int>.GetInstance(errorCodes.Length);
foreach (ErrorCode errorCode in errorCodes)
{
// Compiler diagnostic analyzer does not support build-only diagnostics.
if (!ErrorFacts.IsBuildOnlyDiagnostic(errorCode) &&
errorCode is not ErrorCode.Void or ErrorCode.Unknown)
{
builder.Add((int)errorCode);
}
}
return builder.ToImmutableAndFree();
}
}
}
|
mit
|
C#
|
837c00fcefb251dee8771e088806001b6f5c2fe1
|
simplify null checking of array
|
CyrusNajmabadi/roslyn,KevinRansom/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,sharwell/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,AmadeusW/roslyn,eriawan/roslyn,physhi/roslyn,dotnet/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,wvdd007/roslyn,dotnet/roslyn,weltkante/roslyn,KevinRansom/roslyn,diryboy/roslyn,weltkante/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,wvdd007/roslyn,sharwell/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,bartdesmet/roslyn,sharwell/roslyn,weltkante/roslyn,eriawan/roslyn,diryboy/roslyn
|
src/EditorFeatures/Core/EditorConfigSettings/DataProvider/CombinedProvider.cs
|
src/EditorFeatures/Core/EditorConfigSettings/DataProvider/CombinedProvider.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.EditorConfigSettings.DataProvider
{
internal class CombinedProvider<T> : ISettingsProvider<T>
{
private readonly ImmutableArray<ISettingsProvider<T>> _providers;
public CombinedProvider(ImmutableArray<ISettingsProvider<T>> providers)
{
_providers = providers;
}
public async Task<IReadOnlyList<TextChange>?> GetChangedEditorConfigAsync()
{
var changesArray = await Task.WhenAll(_providers.Select(x => x.GetChangedEditorConfigAsync())).ConfigureAwait(false);
var changes = changesArray.WhereNotNull();
if (!changes.Any())
return null;
var result = new List<TextChange>();
foreach (var change in changes)
{
result.AddRange(change);
}
return result;
}
public ImmutableArray<T> GetCurrentDataSnapshot()
{
var snapShot = ImmutableArray<T>.Empty;
foreach (var provider in _providers)
{
snapShot = snapShot.Concat(provider.GetCurrentDataSnapshot());
}
return snapShot;
}
public void RegisterViewModel(ISettingsEditorViewModel model)
{
foreach (var provider in _providers)
{
provider.RegisterViewModel(model);
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.EditorConfigSettings.DataProvider
{
internal class CombinedProvider<T> : ISettingsProvider<T>
{
private readonly ImmutableArray<ISettingsProvider<T>> _providers;
public CombinedProvider(ImmutableArray<ISettingsProvider<T>> providers)
{
_providers = providers;
}
public async Task<IReadOnlyList<TextChange>?> GetChangedEditorConfigAsync()
{
var changes = await Task.WhenAll(_providers.Select(x => x.GetChangedEditorConfigAsync())).ConfigureAwait(false);
changes = changes.WhereNotNull().ToArray();
if (!changes.Any())
return null;
var result = new List<TextChange>();
foreach (var change in changes)
{
result.AddRange(change);
}
return result;
}
public ImmutableArray<T> GetCurrentDataSnapshot()
{
var snapShot = ImmutableArray<T>.Empty;
foreach (var provider in _providers)
{
snapShot = snapShot.Concat(provider.GetCurrentDataSnapshot());
}
return snapShot;
}
public void RegisterViewModel(ISettingsEditorViewModel model)
{
foreach (var provider in _providers)
{
provider.RegisterViewModel(model);
}
}
}
}
|
mit
|
C#
|
9021840e77b9514eecb04150a6aa5fd87e1cf6c8
|
Fix implementation of MemberSearchFilters so it correctly implements IMemberSearchFilterRepository.
|
GiveCampUK/GiveCRM,GiveCampUK/GiveCRM
|
src/GiveCRM.DataAccess/MemberSearchFilters.cs
|
src/GiveCRM.DataAccess/MemberSearchFilters.cs
|
using System.Collections.Generic;
using GiveCRM.BusinessLogic;
using GiveCRM.Models;
using Simple.Data;
namespace GiveCRM.DataAccess
{
public class MemberSearchFilters : IMemberSearchFilterRepository
{
private readonly dynamic _db = Database.OpenNamedConnection("GiveCRM");
public IEnumerable<MemberSearchFilter> GetByCampaignId(int campaignId)
{
return _db.MemberSearchFilters.FindAllByCampaignId(campaignId).Cast<MemberSearchFilter>();
}
public IEnumerable<MemberSearchFilter> GetAll()
{
return _db.MemberSearchFilters.All();
}
public MemberSearchFilter GetById(int id)
{
return _db.MemberSearchFilters.FindById(id);
}
public void Update(MemberSearchFilter item)
{
_db.MemberSearchFilters.UpdateById(item);
}
public MemberSearchFilter Insert(MemberSearchFilter memberSearchFilter)
{
return _db.MemberSearchFilters.Insert(memberSearchFilter);
}
public void DeleteById(int id)
{
_db.MemberSearchFilters.DeleteById(id);
}
}
}
|
using System.Collections.Generic;
using GiveCRM.BusinessLogic;
using GiveCRM.Models;
using Simple.Data;
namespace GiveCRM.DataAccess
{
public class MemberSearchFilters : IMemberSearchFilterRepository
{
private readonly dynamic _db = Database.OpenNamedConnection("GiveCRM");
public IEnumerable<MemberSearchFilter> ForCampaign(int campaignId)
{
return _db.MemberSearchFilters.FindAllByCampaignId(campaignId).Cast<MemberSearchFilter>();
}
public IEnumerable<MemberSearchFilter> GetAll()
{
return _db.MemberSearchFilters.All();
}
public MemberSearchFilter GetById(int id)
{
return _db.MemberSearchFilters.FindById(id);
}
public void Update(MemberSearchFilter item)
{
_db.MemberSearchFilters.UpdateById(item);
}
public MemberSearchFilter Insert(MemberSearchFilter memberSearchFilter)
{
return _db.MemberSearchFilters.Insert(memberSearchFilter);
}
public void DeleteById(int id)
{
_db.MemberSearchFilters.DeleteById(id);
}
/// <summary>
/// Gets a list of all the <see cref="MemberSearchFilter"/>s associated with the specified <see cref="Campaign"/>.
/// </summary>
/// <param name="id">The campaign identifier.</param>
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="MemberSearchFilter"/> used in the
/// specified <see cref="Campaign"/>.</returns>
public IEnumerable<MemberSearchFilter> GetByCampaignId(int id)
{
throw new System.NotImplementedException();
}
}
}
|
mit
|
C#
|
6d03773c50826dd95ecb49f30a24423f0521de66
|
fix build
|
ralbu/randomuser
|
RandomUser/RandomUserApi.cs
|
RandomUser/RandomUserApi.cs
|
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using RandomUser.Models;
namespace RandomUser
{
public class RandomUserApi
{
/// <summary>
/// Get a random user from http://api.randomuser.me
/// </summary>
/// <returns>Returns a random user.</returns>
public static async Task<User> GetUser()
{
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Accept.Clear();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = await httpClient.GetAsync("http://api.randomuser.me");
if (response.IsSuccessStatusCode)
{
var user = User.Create(await response.Content.ReadAsStringAsync());
return user;
}
}
return null;
}
}
}
|
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using RandomUser.Models;
namespace RandomUser
{
public class RandomUserApi
{
/// <summary>
/// Get a random user from http://api.randomuser.me
/// </summary>
/// <returns>Returns a random user.</returns>
public static async Task<Use> GetUser()
{
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Accept.Clear();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = await httpClient.GetAsync("http://api.randomuser.me");
if (response.IsSuccessStatusCode)
{
var user = User.Create(await response.Content.ReadAsStringAsync());
return user;
}
}
return null;
}
}
}
|
mit
|
C#
|
73fed378d9ac58324960c378be1ee56321b14043
|
Fix test
|
joaoasrosa/nppxmltreeview,joaoasrosa/nppxmltreeview
|
tests/NppXmlTreeviewPlugin.Parsers.Tests.Unit/WhenParsingValidXml.cs
|
tests/NppXmlTreeviewPlugin.Parsers.Tests.Unit/WhenParsingValidXml.cs
|
using System.IO;
using FluentAssertions;
using Xunit;
namespace NppXmlTreeviewPlugin.Parsers.Tests.Unit
{
public class WhenParsingValidXml
{
[Theory]
[InlineData(@"./TestFiles/NPP_comments.xml")]
[InlineData(@"./TestFiles/NPP_nocomments.xml")]
public void GivenValidXml_ThenFoo(string path)
{
var xml = File.ReadAllText(path);
NppXmlNode nppXmlNode;
var result = NppXmlNode.TryParse(xml, out nppXmlNode);
result.Should().BeTrue();
}
}
}
|
using System.IO;
using FluentAssertions;
using Xunit;
namespace NppXmlTreeviewPlugin.Parsers.Tests.Unit
{
public class WhenParsingValidXml
{
[Theory]
[InlineData(@"./TestFiles/NPP_comments.xml")]
[InlineData(@"./Test/FilesNPP_nocomments.xml")]
public void GivenValidXml_ThenFoo(string path)
{
var xml = File.ReadAllText(path);
NppXmlNode nppXmlNode;
var result = NppXmlNode.TryParse(xml, out nppXmlNode);
result.Should().BeTrue();
}
}
}
|
apache-2.0
|
C#
|
41f942d4fdc68a5a9370cfd5bb5f03d484e782cd
|
add .HasPrecision(11, 0);
|
zbw911/Dev.All,zbw911/Dev.All,zbw911/Dev.All,zbw911/Dev.All
|
CasSolution/CASServer/Domain/Entities/Models/Mapping/UserExtendMap.cs
|
CasSolution/CASServer/Domain/Entities/Models/Mapping/UserExtendMap.cs
|
// ***********************************************************************************
// Created by zbw911
// ڣ20130603 16:48
//
// ڣ20130603 17:25
// ļCASServer/Domain.Entities/UserExtendMap.cs
//
// иõĽʼ zbw911#gmail.com
// ***********************************************************************************
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
namespace Domain.Entities.Models.Mapping
{
public class UserExtendMap : EntityTypeConfiguration<UserExtend>
{
#region C'tors
public UserExtendMap()
{
// Primary Key
this.HasKey(t => t.UserId);
// Properties
this.Property(t => t.UserId)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Uid)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity).HasPrecision(11, 0);
// Table & Column Mappings
this.ToTable("UserExtend");
this.Property(t => t.UserId).HasColumnName("UserId");
this.Property(t => t.Uid).HasColumnName("Uid");
}
#endregion
}
}
|
// ***********************************************************************************
// Created by zbw911
// ڣ20130603 16:48
//
// ڣ20130603 17:25
// ļCASServer/Domain.Entities/UserExtendMap.cs
//
// иõĽʼ zbw911#gmail.com
// ***********************************************************************************
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
namespace Domain.Entities.Models.Mapping
{
public class UserExtendMap : EntityTypeConfiguration<UserExtend>
{
#region C'tors
public UserExtendMap()
{
// Primary Key
this.HasKey(t => t.UserId);
// Properties
this.Property(t => t.UserId)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Uid)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
// Table & Column Mappings
this.ToTable("UserExtend");
this.Property(t => t.UserId).HasColumnName("UserId");
this.Property(t => t.Uid).HasColumnName("Uid");
}
#endregion
}
}
|
apache-2.0
|
C#
|
6f334c3f4c24e7d3cebb538abbc3a06f8c231daa
|
Remove blocks duplication
|
BioWareRu/BioEngine,BioWareRu/BioEngine,BioWareRu/BioEngine
|
src/BioEngine.Admin/AdminApplication.cs
|
src/BioEngine.Admin/AdminApplication.cs
|
using BioEngine.Admin.Old;
using BioEngine.Core.IPB;
using BioEngine.Core.IPB.Users;
using Microsoft.Extensions.DependencyInjection;
using Sitko.Blockly.AntDesignComponents;
using Sitko.Blockly.AntDesignComponents.Blocks;
using Sitko.Blockly.Blocks;
using Sitko.Core.Db.Postgres;
namespace BioEngine.Admin
{
using Blocks;
public class AdminApplication : Core.BioEngineApp<Startup>
{
public AdminApplication(string[] args) : base(args)
{
AddPostgresDb(typeof(AdminApplication).Assembly)
.AddS3Storage()
.AddModule<IPBAdminModule, IpbAdminModuleOptions>();
AddModule<IPBUsersModule<IpbAdminModuleOptions>, IPBUsersModuleOptions>();
this.AddPostgresDatabase<OldBrcContext>(options =>
{
options.EnableSensitiveLogging = false;
});
AddModule<AntDesignBlocklyModule, AntDesignBlocklyModuleOptions>(
(_, _, moduleConfig) =>
{
moduleConfig.AddBlock<AntTextBlockDescriptor, TextBlock>();
moduleConfig.AddBlock<AntCutBlockDescriptor, CutBlock>();
moduleConfig.AddBlock<AntIframeBlockDescriptor, IframeBlock>();
moduleConfig.AddBlock<AntQuoteBlockDescriptor, QuoteBlock>();
moduleConfig.AddBlock<AntTwitchBlockDescriptor, TwitchBlock>();
moduleConfig.AddBlock<AntTwitterBlockDescriptor, TwitterBlock>();
moduleConfig.AddBlock<AntYoutubeBlockDescriptor, YoutubeBlock>();
moduleConfig.AddBlock<BioEngineGalleryBlockDescriptor, GalleryBlock>();
moduleConfig.AddBlock<BioEngineFilesBlockDescriptor, FilesBlock>();
moduleConfig.AddBlock<BioEngineDividerBlockDescriptor, DividerBlock>();
});
ConfigureServices((_, _, services) =>
{
services.AddScoped<BrcConverter>();
});
}
}
}
|
using BioEngine.Admin.Old;
using BioEngine.Core.IPB;
using BioEngine.Core.IPB.Users;
using Microsoft.Extensions.DependencyInjection;
using Sitko.Blockly.AntDesignComponents;
using Sitko.Blockly.AntDesignComponents.Blocks;
using Sitko.Blockly.Blocks;
using Sitko.Core.Db.Postgres;
namespace BioEngine.Admin
{
using Blocks;
public class AdminApplication : Core.BioEngineApp<Startup>
{
public AdminApplication(string[] args) : base(args)
{
AddPostgresDb(typeof(AdminApplication).Assembly)
.AddS3Storage()
.AddModule<IPBAdminModule, IpbAdminModuleOptions>();
AddModule<IPBUsersModule<IpbAdminModuleOptions>, IPBUsersModuleOptions>();
this.AddPostgresDatabase<OldBrcContext>(options =>
{
options.EnableSensitiveLogging = false;
});
AddModule<AntDesignBlocklyModule, AntDesignBlocklyModuleOptions>(
(_, _, moduleConfig) =>
{
moduleConfig.AddBlock<AntTextBlockDescriptor, TextBlock>();
moduleConfig.AddBlock<AntCutBlockDescriptor, CutBlock>();
moduleConfig.AddBlock<AntIframeBlockDescriptor, IframeBlock>();
moduleConfig.AddBlock<AntQuoteBlockDescriptor, QuoteBlock>();
moduleConfig.AddBlock<AntTextBlockDescriptor, TextBlock>();
moduleConfig.AddBlock<AntTwitchBlockDescriptor, TwitchBlock>();
moduleConfig.AddBlock<AntTwitterBlockDescriptor, TwitterBlock>();
moduleConfig.AddBlock<AntYoutubeBlockDescriptor, YoutubeBlock>();
moduleConfig.AddBlock<BioEngineGalleryBlockDescriptor, GalleryBlock>();
moduleConfig.AddBlock<BioEngineFilesBlockDescriptor, FilesBlock>();
moduleConfig.AddBlock<BioEngineDividerBlockDescriptor, DividerBlock>();
});
ConfigureServices((_, _, services) =>
{
services.AddScoped<BrcConverter>();
});
}
}
}
|
mit
|
C#
|
6f053bdfe677bec634f16f292fb99296c656d949
|
Add interface rotation to Swapping Views method, bug #11681
|
hongnguyenpro/monotouch-samples,peteryule/monotouch-samples,sakthivelnagarajan/monotouch-samples,iFreedive/monotouch-samples,robinlaide/monotouch-samples,markradacz/monotouch-samples,kingyond/monotouch-samples,albertoms/monotouch-samples,robinlaide/monotouch-samples,haithemaraissia/monotouch-samples,andypaul/monotouch-samples,a9upam/monotouch-samples,markradacz/monotouch-samples,iFreedive/monotouch-samples,davidrynn/monotouch-samples,hongnguyenpro/monotouch-samples,nelzomal/monotouch-samples,xamarin/monotouch-samples,labdogg1003/monotouch-samples,nervevau2/monotouch-samples,YOTOV-LIMITED/monotouch-samples,kingyond/monotouch-samples,labdogg1003/monotouch-samples,davidrynn/monotouch-samples,labdogg1003/monotouch-samples,hongnguyenpro/monotouch-samples,a9upam/monotouch-samples,markradacz/monotouch-samples,haithemaraissia/monotouch-samples,haithemaraissia/monotouch-samples,sakthivelnagarajan/monotouch-samples,davidrynn/monotouch-samples,albertoms/monotouch-samples,xamarin/monotouch-samples,haithemaraissia/monotouch-samples,robinlaide/monotouch-samples,YOTOV-LIMITED/monotouch-samples,kingyond/monotouch-samples,andypaul/monotouch-samples,hongnguyenpro/monotouch-samples,a9upam/monotouch-samples,sakthivelnagarajan/monotouch-samples,andypaul/monotouch-samples,nelzomal/monotouch-samples,YOTOV-LIMITED/monotouch-samples,nervevau2/monotouch-samples,W3SS/monotouch-samples,peteryule/monotouch-samples,W3SS/monotouch-samples,W3SS/monotouch-samples,andypaul/monotouch-samples,peteryule/monotouch-samples,nelzomal/monotouch-samples,albertoms/monotouch-samples,nervevau2/monotouch-samples,a9upam/monotouch-samples,xamarin/monotouch-samples,peteryule/monotouch-samples,sakthivelnagarajan/monotouch-samples,labdogg1003/monotouch-samples,iFreedive/monotouch-samples,nervevau2/monotouch-samples,davidrynn/monotouch-samples,robinlaide/monotouch-samples,YOTOV-LIMITED/monotouch-samples,nelzomal/monotouch-samples
|
Rotation/HandlingRotation/Screens/iPad/Method3SwapViews/Controller.cs
|
Rotation/HandlingRotation/Screens/iPad/Method3SwapViews/Controller.cs
|
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace HandlingRotation.Screens.iPad.Method3SwapViews
{
public class Controller : UIViewController
{
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
switch (InterfaceOrientation) {
case UIInterfaceOrientation.LandscapeLeft:
case UIInterfaceOrientation.LandscapeRight:
NSBundle.MainBundle.LoadNib ("LandscapeView", this, null);
break;
case UIInterfaceOrientation.Portrait:
case UIInterfaceOrientation.PortraitUpsideDown:
NSBundle.MainBundle.LoadNib ("PortraitView", this, null);
break;
}
}
public override void WillAnimateRotation (UIInterfaceOrientation toInterfaceOrientation, double duration)
{
base.WillAnimateRotation (toInterfaceOrientation, duration);
switch (toInterfaceOrientation) {
case UIInterfaceOrientation.LandscapeLeft:
case UIInterfaceOrientation.LandscapeRight:
NSBundle.MainBundle.LoadNib ("LandscapeView", this, null);
break;
case UIInterfaceOrientation.Portrait:
case UIInterfaceOrientation.PortraitUpsideDown:
NSBundle.MainBundle.LoadNib ("PortraitView", this, null);
break;
}
}
}
}
|
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace HandlingRotation.Screens.iPad.Method3SwapViews
{
public class Controller : UIViewController
{
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
switch (InterfaceOrientation) {
case UIInterfaceOrientation.LandscapeLeft:
case UIInterfaceOrientation.LandscapeRight:
NSBundle.MainBundle.LoadNib ("LandscapeView", this, null);
break;
case UIInterfaceOrientation.Portrait:
case UIInterfaceOrientation.PortraitUpsideDown:
NSBundle.MainBundle.LoadNib ("PortraitView", this, null);
break;
}
}
}
}
|
mit
|
C#
|
91754e2de440cde3a6cf1dee074e34ba0cbc34cb
|
Remove debug logging
|
allmonty/BrokenShield,allmonty/BrokenShield
|
Assets/Scripts/Enemy/Decision_LowOnStamina.cs
|
Assets/Scripts/Enemy/Decision_LowOnStamina.cs
|
using UnityEngine;
[CreateAssetMenu (menuName = "AI/Decisions/LowOnStamina")]
public class Decision_LowOnStamina : Decision {
[SerializeField] float lowStamina;
public override bool Decide(StateController controller) {
return isLowOnStamina(controller);
}
private bool isLowOnStamina(StateController controller) {
Enemy_StateController enemyController = controller as Enemy_StateController;
var characterStamina = enemyController.characterStatus.stamina;
if( characterStamina.stamina <= lowStamina ) {
return true;
}
return false;
}
}
|
using UnityEngine;
[CreateAssetMenu (menuName = "AI/Decisions/LowOnStamina")]
public class Decision_LowOnStamina : Decision {
[SerializeField] float lowStamina;
public override bool Decide(StateController controller) {
return isLowOnStamina(controller);
}
private bool isLowOnStamina(StateController controller) {
Enemy_StateController enemyController = controller as Enemy_StateController;
var characterStamina = enemyController.characterStatus.stamina;
if( characterStamina.stamina <= lowStamina ) {
Debug.Log("IS LOW ON STAMINA");
return true;
}
Debug.Log("STAMINA OK");
return false;
}
}
|
apache-2.0
|
C#
|
2dfb1b51b6e9661c48080ea6c007d912c891636e
|
Add useful comment
|
jquintus/spikes,jquintus/spikes,jquintus/spikes,jquintus/spikes
|
ConsoleApps/FunWithSpikes/FunWithNinject/NamedScopes/NamedScopesTests.cs
|
ConsoleApps/FunWithSpikes/FunWithNinject/NamedScopes/NamedScopesTests.cs
|
using Ninject;
using Ninject.Extensions.NamedScope;
using NUnit.Framework;
namespace FunWithNinject.NamedScopes
{
[TestFixture]
public class NamedScopesTests
{
[Test]
public void Get_FuncBoundInNamedScope_ResolvedFuncIsInSameScopeAsParent()
{
// This test depends on Ninject.Extensions.ContextPreservation being loaded.
// Assemble
using (var k = new StandardKernel())
{
const string scope = "Telescope";
k.Bind<IRoot>().To<Root>().DefinesNamedScope(scope);
k.Bind<IHaveFunc>().To<HaveFunc>();
k.Bind<IEventAggregator>().To<EventAggregator>().InNamedScope(scope);
// Act
var root1 = k.Get<IRoot>();
var root2 = k.Get<IRoot>();
// Assert
Assert.AreNotEqual(root1, root2);
Assert.AreNotEqual(root1.ChildFuncHaver, root2.ChildFuncHaver);
Assert.AreNotEqual(root1.ChildEventAggregator, root2.ChildEventAggregator);
Assert.AreEqual(root1.EventAggregator, root1.ChildEventAggregator);
}
}
}
}
|
using Ninject;
using Ninject.Extensions.NamedScope;
using NUnit.Framework;
namespace FunWithNinject.NamedScopes
{
[TestFixture]
public class NamedScopesTests
{
[Test]
public void Get_FuncBoundInNamedScope_ResolvedFuncIsInSameScopeAsParent()
{
// Assemble
using (var k = new StandardKernel())
{
const string scope = "Telescope";
k.Bind<IRoot>().To<Root>().DefinesNamedScope(scope);
k.Bind<IHaveFunc>().To<HaveFunc>();
k.Bind<IEventAggregator>().To<EventAggregator>().InNamedScope(scope);
// Act
var root1 = k.Get<IRoot>();
var root2 = k.Get<IRoot>();
// Assert
Assert.AreNotEqual(root1, root2);
Assert.AreNotEqual(root1.ChildFuncHaver, root2.ChildFuncHaver);
Assert.AreNotEqual(root1.ChildEventAggregator, root2.ChildEventAggregator);
Assert.AreEqual(root1.EventAggregator, root1.ChildEventAggregator);
}
}
}
}
|
mit
|
C#
|
05accfb7eb6eeb2cb0b0f7ccf64ce12e68a9386c
|
Update Node.cs
|
primo-ppcg/BF-Crunch
|
src/Node.cs
|
src/Node.cs
|
using System;
namespace ppcg {
public struct Node : IEquatable<Node> {
public int Pointer;
public int Cost;
public bool Rolling;
public Node(int pointer, int cost, bool rolling = false) {
this.Pointer = pointer;
this.Cost = cost;
this.Rolling = rolling;
}
public override string ToString() {
return string.Format("({0} {1})", this.Pointer, this.Cost);
}
public bool Equals(Node other) {
return this.Pointer == other.Pointer;
}
}
}
|
using System;
namespace ppcg {
public struct Node {
public int Pointer;
public int Cost;
public Node(int pointer, int cost) {
this.Pointer = pointer;
this.Cost = cost;
}
public override string ToString() {
return string.Format("({0}, {1})", this.Pointer, this.Cost);
}
}
}
|
mit
|
C#
|
16f9dd44521306d464aa7f6b65b28025ba77e865
|
Update RobotName name test to be more restrictive
|
robkeim/xcsharp,exercism/xcsharp,ErikSchierboom/xcsharp,ErikSchierboom/xcsharp,exercism/xcsharp,robkeim/xcsharp
|
exercises/robot-name/RobotNameTest.cs
|
exercises/robot-name/RobotNameTest.cs
|
using Xunit;
public class RobotNameTest
{
private readonly Robot robot = new Robot();
[Fact]
public void Robot_has_a_name()
{
Assert.Matches(@"^[A-Z]{2}\d{3}$", robot.Name);
}
[Fact(Skip = "Remove to run test")]
public void Name_is_the_same_each_time()
{
Assert.Equal(robot.Name, robot.Name);
}
[Fact(Skip = "Remove to run test")]
public void Different_robots_have_different_names()
{
var robot2 = new Robot();
Assert.NotEqual(robot2.Name, robot.Name);
}
[Fact(Skip = "Remove to run test")]
public void Can_reset_the_name()
{
var originalName = robot.Name;
robot.Reset();
Assert.NotEqual(originalName, robot.Name);
}
}
|
using Xunit;
public class RobotNameTest
{
private readonly Robot robot = new Robot();
[Fact]
public void Robot_has_a_name()
{
Assert.Matches(@"[A-Z]{2}\d{3}", robot.Name);
}
[Fact(Skip = "Remove to run test")]
public void Name_is_the_same_each_time()
{
Assert.Equal(robot.Name, robot.Name);
}
[Fact(Skip = "Remove to run test")]
public void Different_robots_have_different_names()
{
var robot2 = new Robot();
Assert.NotEqual(robot2.Name, robot.Name);
}
[Fact(Skip = "Remove to run test")]
public void Can_reset_the_name()
{
var originalName = robot.Name;
robot.Reset();
Assert.NotEqual(originalName, robot.Name);
}
}
|
mit
|
C#
|
233caa379d180d18093c1ce69ae968d15eb5014c
|
Fix bug in album gain calculation.
|
karamanolev/NReplayGain
|
NReplayGain/AlbumGain.cs
|
NReplayGain/AlbumGain.cs
|
using System;
using System.Linq;
namespace NReplayGain
{
/// <summary>
/// Contains ReplayGain data for an album.
/// </summary>
public class AlbumGain
{
private GainData albumData;
public AlbumGain()
{
this.albumData = new GainData();
}
/// <summary>
/// After calculating the ReplayGain data for an album, call this to append the data to the album.
/// </summary>
public void AppendTrackData(TrackGain trackGain)
{
int[] sourceAccum = trackGain.gainData.Accum;
for (int i = 0; i < sourceAccum.Length; ++i)
{
this.albumData.Accum[i] += sourceAccum[i];
}
this.albumData.PeakSample = Math.Max(this.albumData.PeakSample, trackGain.gainData.PeakSample);
}
/// <summary>
/// Returns the normalization gain for the entire album in decibels.
/// </summary>
public double GetGain()
{
return ReplayGain.AnalyzeResult(this.albumData.Accum);
}
/// <summary>
/// Returns the peak album value, normalized to the [0,1] interval.
/// </summary>
public double GetPeak()
{
return this.albumData.PeakSample / ReplayGain.MAX_SAMPLE_VALUE;
}
}
}
|
using System;
using System.Linq;
namespace NReplayGain
{
/// <summary>
/// Contains ReplayGain data for an album.
/// </summary>
public class AlbumGain
{
private GainData albumData;
public AlbumGain()
{
this.albumData = new GainData();
}
/// <summary>
/// After calculating the ReplayGain data for an album, call this to append the data to the album.
/// </summary>
public void AppendTrackData(TrackGain trackGain)
{
int[] sourceAccum = trackGain.gainData.Accum;
for (int i = 0; i < sourceAccum.Length; ++i)
{
this.albumData.Accum[i] = sourceAccum[i];
}
this.albumData.PeakSample = Math.Max(this.albumData.PeakSample, trackGain.gainData.PeakSample);
}
/// <summary>
/// Returns the normalization gain for the entire album in decibels.
/// </summary>
public double GetGain()
{
return ReplayGain.AnalyzeResult(this.albumData.Accum);
}
/// <summary>
/// Returns the peak album value, normalized to the [0,1] interval.
/// </summary>
public double GetPeak()
{
return this.albumData.PeakSample / ReplayGain.MAX_SAMPLE_VALUE;
}
}
}
|
lgpl-2.1
|
C#
|
a6946b21abe59fc01f7bca6e27066c2dd74a8731
|
Update dbContext facade
|
Database-2015-Team-Chlorine/Teamwork
|
MediaMonitoringSystem/MediaMonitoringSystem.Data/MySQL/MySqlDbContext.cs
|
MediaMonitoringSystem/MediaMonitoringSystem.Data/MySQL/MySqlDbContext.cs
|
namespace MediaMonitoringSystem.Data.MySQL
{
using Telerik.OpenAccess;
public class MySqlDbContext : FluentModel
{
// Ensures that the Database always exists
public MySqlDbContext()
{
UpdateDatabase();
}
private static void UpdateDatabase()
{
using (var context = new FluentModel())
{
var schemaHandler = context.GetSchemaHandler();
EnsureDB(schemaHandler);
}
}
private static void EnsureDB(ISchemaHandler schemaHandler)
{
string script = null;
if (schemaHandler.DatabaseExists())
{
script = schemaHandler.CreateUpdateDDLScript(null);
}
else
{
schemaHandler.CreateDatabase();
script = schemaHandler.CreateDDLScript();
}
if (!string.IsNullOrEmpty(script))
{
schemaHandler.ExecuteDDLScript(script);
}
}
}
}
|
namespace MediaMonitoringSystem.Data.MySQL
{
using Telerik.OpenAccess;
public class MySqlDbContext : FluentModel
{
public MySqlDbContext()
{
UpdateDatabase();
}
private static void UpdateDatabase()
{
using (var context = new FluentModel())
{
var schemaHandler = context.GetSchemaHandler();
EnsureDB(schemaHandler);
}
}
private static void EnsureDB(ISchemaHandler schemaHandler)
{
string script = null;
if (schemaHandler.DatabaseExists())
{
script = schemaHandler.CreateUpdateDDLScript(null);
}
else
{
schemaHandler.CreateDatabase();
script = schemaHandler.CreateDDLScript();
}
if (!string.IsNullOrEmpty(script))
{
schemaHandler.ExecuteDDLScript(script);
}
}
}
}
|
mit
|
C#
|
6bab43a6ae842290195c162364f9985da348c051
|
update xmldoc
|
EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework
|
osu.Framework/Input/FrameworkActionContainer.cs
|
osu.Framework/Input/FrameworkActionContainer.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
namespace osu.Framework.Input
{
internal class FrameworkActionContainer : KeyBindingContainer<FrameworkAction>
{
public override IEnumerable<KeyBinding> DefaultKeyBindings => new[]
{
new KeyBinding(new[] { InputKey.Control, InputKey.F1 }, FrameworkAction.ToggleDrawVisualiser),
new KeyBinding(new[] { InputKey.Control, InputKey.F2 }, FrameworkAction.ToggleGlobalStatistics),
new KeyBinding(new[] { InputKey.Control, InputKey.F11 }, FrameworkAction.CycleFrameStatistics),
new KeyBinding(new[] { InputKey.Control, InputKey.F10 }, FrameworkAction.ToggleLogOverlay),
new KeyBinding(new[] { InputKey.Alt, InputKey.Enter }, FrameworkAction.ToggleFullscreen),
};
private readonly Game game;
public FrameworkActionContainer(Game game = null)
{
this.game = game;
}
protected override bool Prioritised => true;
/// <summary>
/// Prioritize the <see cref="Game"/> for input, which handles the toggling of framework overlays.
/// </summary>
protected override IEnumerable<Drawable> KeyBindingInputQueue => base.KeyBindingInputQueue.Prepend(game);
}
public enum FrameworkAction
{
CycleFrameStatistics,
ToggleDrawVisualiser,
ToggleGlobalStatistics,
ToggleLogOverlay,
ToggleFullscreen
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
namespace osu.Framework.Input
{
internal class FrameworkActionContainer : KeyBindingContainer<FrameworkAction>
{
public override IEnumerable<KeyBinding> DefaultKeyBindings => new[]
{
new KeyBinding(new[] { InputKey.Control, InputKey.F1 }, FrameworkAction.ToggleDrawVisualiser),
new KeyBinding(new[] { InputKey.Control, InputKey.F2 }, FrameworkAction.ToggleGlobalStatistics),
new KeyBinding(new[] { InputKey.Control, InputKey.F11 }, FrameworkAction.CycleFrameStatistics),
new KeyBinding(new[] { InputKey.Control, InputKey.F10 }, FrameworkAction.ToggleLogOverlay),
new KeyBinding(new[] { InputKey.Alt, InputKey.Enter }, FrameworkAction.ToggleFullscreen),
};
private readonly Game game;
public FrameworkActionContainer(Game game = null)
{
this.game = game;
}
protected override bool Prioritised => true;
/// <summary>
/// Propagate key-binding input to the game, which contains logic for handling <see cref="FrameworkAction"/>s
/// </summary>
protected override IEnumerable<Drawable> KeyBindingInputQueue => base.KeyBindingInputQueue.Prepend(game);
}
public enum FrameworkAction
{
CycleFrameStatistics,
ToggleDrawVisualiser,
ToggleGlobalStatistics,
ToggleLogOverlay,
ToggleFullscreen
}
}
|
mit
|
C#
|
4dd4efb43e25f799cd0578d3af0cf6aa52bec662
|
disable light mover
|
ChrisJansson/ProceduralGeneration,ChrisJansson/ProceduralGeneration,ChrisJansson/ProceduralGeneration
|
source/CjClutter.OpenGl/EntityComponent/LightMoverSystem.cs
|
source/CjClutter.OpenGl/EntityComponent/LightMoverSystem.cs
|
using System;
using System.Linq;
using OpenTK;
namespace CjClutter.OpenGl.EntityComponent
{
public class LightMoverSystem : IEntitySystem
{
public void Update(double elapsedTime, EntityManager entityManager)
{
var light= entityManager.GetEntitiesWithComponent<PositionalLightComponent>()
.Single();
var component = entityManager.GetComponent<PositionalLightComponent>(light);
//component.Position = new Vector3d(Math.Cos(elapsedTime) * 5, 2, Math.Sin(elapsedTime) * 5);
}
}
}
|
using System;
using System.Linq;
using OpenTK;
namespace CjClutter.OpenGl.EntityComponent
{
public class LightMoverSystem : IEntitySystem
{
public void Update(double elapsedTime, EntityManager entityManager)
{
var light= entityManager.GetEntitiesWithComponent<PositionalLightComponent>()
.Single();
var component = entityManager.GetComponent<PositionalLightComponent>(light);
component.Position = new Vector3d(Math.Cos(elapsedTime) * 5, 2, Math.Sin(elapsedTime) * 5);
}
}
}
|
mit
|
C#
|
6e6be17442475d16980174ed56bcbfc464328691
|
Fix GitHubIssue4703 test
|
elastic/elasticsearch-net,elastic/elasticsearch-net
|
tests/Tests.Reproduce/GithubIssue4703.cs
|
tests/Tests.Reproduce/GithubIssue4703.cs
|
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
using System;
using System.Text;
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
using Elasticsearch.Net;
using FluentAssertions;
using Nest;
using Tests.Core.Client;
namespace Tests.Reproduce
{
public class GithubIssue4703
{
[U]
public void NullableValueTupleDoesNotThrow()
{
var connectionSettings = new ConnectionSettings(new InMemoryConnection()).DisableDirectStreaming();
var client = new ElasticClient(connectionSettings);
Func<IndexResponse> action = () =>
client.Index(
new ExampleDoc
{
tupleNullable = ("somestring", 42),
}, i => i.Index("index"));
var a = action.Should().NotThrow();
var response = a.Subject;
var json = Encoding.UTF8.GetString(response.ApiCall.RequestBodyInBytes);
json.Should().Be(@"{""tupleNullable"":{""Item1"":""somestring"",""Item2"":42}}");
}
}
public class ExampleDoc
{
public (string info, int number)? tupleNullable { get; set; }
}
}
|
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
using System;
using System.Text;
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
using FluentAssertions;
using Nest;
using Tests.Core.Client;
namespace Tests.Reproduce
{
public class GithubIssue4703
{
[U]
public void NullableValueTupleDoesNotThrow()
{
Func<IndexResponse> action = () =>
TestClient.DefaultInMemoryClient.Index(
new ExampleDoc
{
tupleNullable = ("somestring", 42),
}, i => i.Index("index"));
var a = action.Should().NotThrow();
var response = a.Subject;
var json = Encoding.UTF8.GetString(response.ApiCall.RequestBodyInBytes);
json.Should().Be(@"{""tupleNullable"":{""Item1"":""somestring"",""Item2"":42}}");
}
}
public class ExampleDoc
{
public (string info, int number)? tupleNullable { get; set; }
}
}
|
apache-2.0
|
C#
|
8ed11bd03183c780b9cc66ef5270d37f02ecbe50
|
add InterceptorsFilter for AttributeInterceptorMatcher
|
AspectCore/AspectCore-Framework,AspectCore/Abstractions,AspectCore/AspectCore-Framework,AspectCore/Lite
|
src/AspectCore.Lite/Internal/AttributeInterceptorMatcher.cs
|
src/AspectCore.Lite/Internal/AttributeInterceptorMatcher.cs
|
using System;
using System.Collections.Concurrent;
using AspectCore.Lite.Abstractions;
using AspectCore.Lite.Common;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace AspectCore.Lite.Internal
{
internal sealed class AttributeInterceptorMatcher : IInterceptorMatcher
{
private static readonly ConcurrentDictionary<MethodInfo, IInterceptor[]> AttributeInterceptorCache =
new ConcurrentDictionary<MethodInfo, IInterceptor[]>();
private readonly IInterceptorCollection interceptorCollection;
public AttributeInterceptorMatcher(IInterceptorCollection interceptorCollection)
{
this.interceptorCollection = interceptorCollection;
}
public IInterceptor[] Match(MethodInfo method, TypeInfo typeInfo)
{
ExceptionHelper.ThrowArgumentNull(method, nameof(method));
ExceptionHelper.ThrowArgumentNull(typeInfo, nameof(typeInfo));
return AttributeInterceptorCache.GetOrAdd(method, key =>
{
var interceptorAttributes = InterceptorsIterator(method, typeInfo, interceptorCollection);
return InterceptorsFilter(interceptorAttributes).OrderBy(i => i.Order).ToArray();
});
}
private static IEnumerable<IInterceptor> InterceptorsIterator(
MethodInfo methodInfo, TypeInfo typeInfo, IEnumerable<IInterceptor> interceptorCollection)
{
foreach (var attribute in methodInfo.GetCustomAttributes())
{
var interceptor = attribute as IInterceptor;
if (interceptor != null) yield return interceptor;
}
foreach (var attribute in typeInfo.GetCustomAttributes())
{
var interceptor = attribute as IInterceptor;
if (interceptor != null) yield return interceptor;
}
foreach (var interceptor in interceptorCollection)
{
yield return interceptor;
}
}
private static IEnumerable<IInterceptor> InterceptorsFilter(IEnumerable<IInterceptor> interceptors)
{
var set = new HashSet<Type>();
foreach (var interceptor in interceptors)
{
if (interceptor.AllowMultiple)
{
yield return interceptor;
}
else
{
if (set.Add(interceptor.GetType()))
{
yield return interceptor;
}
}
}
}
}
}
|
using System.Collections.Concurrent;
using AspectCore.Lite.Abstractions;
using AspectCore.Lite.Common;
using AspectCore.Lite.Extensions;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace AspectCore.Lite.Internal
{
internal sealed class AttributeInterceptorMatcher : IInterceptorMatcher
{
private static readonly ConcurrentDictionary<MethodInfo, IInterceptor[]> AttributeInterceptorCache =
new ConcurrentDictionary<MethodInfo, IInterceptor[]>();
private static IEnumerable<IInterceptor> InterceptorsIterator(MethodInfo methodInfo, TypeInfo typeInfo)
{
foreach (var attribute in typeInfo.GetCustomAttributes())
{
var interceptor = attribute as IInterceptor;
if (interceptor != null) yield return interceptor;
}
foreach (var attribute in methodInfo.GetCustomAttributes())
{
var interceptor = attribute as IInterceptor;
if (interceptor != null) yield return interceptor;
}
}
public IInterceptor[] Match(MethodInfo method, TypeInfo typeInfo)
{
ExceptionHelper.ThrowArgumentNull(method, nameof(method));
ExceptionHelper.ThrowArgumentNull(typeInfo, nameof(typeInfo));
return AttributeInterceptorCache.GetOrAdd(method, key =>
{
var interceptorAttributes = InterceptorsIterator(method, typeInfo);
return interceptorAttributes.Distinct(i => i.GetType()).OrderBy(i => i.Order).ToArray();
});
}
}
}
|
mit
|
C#
|
9da0e4459fe91920478783b075b945467acc1486
|
reduce nesting and check collection for null
|
DustinCampbell/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn
|
src/OmniSharp.Roslyn.CSharp/Helpers/DiagnosticExtensions.cs
|
src/OmniSharp.Roslyn.CSharp/Helpers/DiagnosticExtensions.cs
|
using Microsoft.CodeAnalysis;
using OmniSharp.Models.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace OmniSharp.Helpers
{
internal static class DiagnosticExtensions
{
internal static DiagnosticLocation ToDiagnosticLocation(this Diagnostic diagnostic)
{
var span = diagnostic.Location.GetMappedLineSpan();
return new DiagnosticLocation
{
FileName = span.Path,
Line = span.StartLinePosition.Line,
Column = span.StartLinePosition.Character,
EndLine = span.EndLinePosition.Line,
EndColumn = span.EndLinePosition.Character,
Text = diagnostic.GetMessage(),
LogLevel = diagnostic.Severity.ToString()
};
}
internal static async Task<IEnumerable<DiagnosticLocation>> FindDiagnosticLocationsAsync(this IEnumerable<Document> documents)
{
if (documents == null || !documents.Any()) return Enumerable.Empty<DiagnosticLocation>();
var items = new List<DiagnosticLocation>();
foreach (var document in documents)
{
var semanticModel = await document.GetSemanticModelAsync();
IEnumerable<Diagnostic> diagnostics = semanticModel.GetDiagnostics();
foreach (var quickFix in diagnostics.Select(d => d.ToDiagnosticLocation()))
{
var existingQuickFix = items.FirstOrDefault(q => q.Equals(quickFix));
if (existingQuickFix == null)
{
quickFix.Projects.Add(document.Project.Name);
items.Add(quickFix);
}
else
{
existingQuickFix.Projects.Add(document.Project.Name);
}
}
}
return items;
}
}
}
|
using Microsoft.CodeAnalysis;
using OmniSharp.Models.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace OmniSharp.Helpers
{
internal static class DiagnosticExtensions
{
internal static DiagnosticLocation ToDiagnosticLocation(this Diagnostic diagnostic)
{
var span = diagnostic.Location.GetMappedLineSpan();
return new DiagnosticLocation
{
FileName = span.Path,
Line = span.StartLinePosition.Line,
Column = span.StartLinePosition.Character,
EndLine = span.EndLinePosition.Line,
EndColumn = span.EndLinePosition.Character,
Text = diagnostic.GetMessage(),
LogLevel = diagnostic.Severity.ToString()
};
}
internal static async Task<IEnumerable<DiagnosticLocation>> FindDiagnosticLocationsAsync(this IEnumerable<Document> documents)
{
var items = new List<DiagnosticLocation>();
if (documents.Any())
{
foreach (var document in documents)
{
var semanticModel = await document.GetSemanticModelAsync();
IEnumerable<Diagnostic> diagnostics = semanticModel.GetDiagnostics();
foreach (var quickFix in diagnostics.Select(d => d.ToDiagnosticLocation()))
{
var existingQuickFix = items.FirstOrDefault(q => q.Equals(quickFix));
if (existingQuickFix == null)
{
quickFix.Projects.Add(document.Project.Name);
items.Add(quickFix);
}
else
{
existingQuickFix.Projects.Add(document.Project.Name);
}
}
}
}
return items;
}
}
}
|
mit
|
C#
|
5d4aa97f00d2fff23cdd18a5b75f297c07b39f52
|
Fix route matching for typed-in urls
|
brondavies/wwwplatform.net,brondavies/wwwplatform.net,brondavies/wwwplatform.net
|
src/web/Extensions/SitePageRouteConstraint.cs
|
src/web/Extensions/SitePageRouteConstraint.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Routing;
namespace wwwplatform.Extensions
{
public class SitePageRouteConstraint : IRouteConstraint
{
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
{
string path = httpContext.Request.Url.AbsolutePath;
string controller = path.Split("/".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).First();
var controllers = Assembly.GetExecutingAssembly().DefinedTypes.Where(t => t.Name.EndsWith("Controller") && t.Name.StartsWith(controller, StringComparison.InvariantCultureIgnoreCase));
return controllers.Count() == 0;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Routing;
namespace wwwplatform.Extensions
{
public class SitePageRouteConstraint : IRouteConstraint
{
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
{
string path = httpContext.Request.Url.AbsolutePath;
string controller = path.Split("/".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).First();
var controllers = Assembly.GetExecutingAssembly().DefinedTypes.Where(t => t.Name.EndsWith("Controller") && t.Name.StartsWith(controller));
return controllers.Count() == 0;
}
}
}
|
apache-2.0
|
C#
|
d5455ea87e0e77e3767ef5df1986c30e2d99e654
|
Fix KademliaId constructor
|
zr40/kyru-dotnet,zr40/kyru-dotnet
|
Kyru/Network/KademliaId.cs
|
Kyru/Network/KademliaId.cs
|
using System;
using System.Linq;
using ProtoBuf;
namespace Kyru.Network
{
[ProtoContract]
internal sealed class KademliaId
{
internal const int Size = 160;
private const int ArraySize = Size / 8;
[ProtoMember(1)]
private readonly byte[] id = new byte[ArraySize];
private KademliaId()
{
}
public KademliaId(byte[] bytes)
{
if (bytes.Length != ArraySize)
throw new Exception("The array must of size " + ArraySize);
id = bytes;
}
public static KademliaId operator -(KademliaId left, KademliaId right)
{
var result = new KademliaId();
for (int i = 0; i < ArraySize; i++)
{
result.id[i] = (byte) (left.id[i] ^ right.id[i]);
}
return result;
}
public static KademliaId RandomId
{
get
{
var bytes = Random.Bytes(ArraySize * sizeof(uint));
return new KademliaId(bytes);
}
}
public static implicit operator byte[](KademliaId id)
{
var bytes = new byte[ArraySize];
id.id.CopyTo(bytes, ArraySize);
return bytes;
}
public override string ToString()
{
return id.Aggregate("", (s, u) => s + u.ToString("0,8:X"));
}
internal int KademliaBucket()
{
if (id.All(i => i == 0))
{
throw new InvalidOperationException("BUG: the local node must not be added as a Kademlia contact");
}
throw new NotImplementedException();
}
#region Equality (generated code)
private bool Equals(KademliaId other)
{
return Equals(id, other.id);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj is KademliaId && Equals((KademliaId) obj);
}
public override int GetHashCode()
{
int hashCode = 0;
foreach (uint n in id)
{
hashCode = (hashCode * 397) ^ (int) n;
}
return hashCode;
}
public static bool operator ==(KademliaId left, KademliaId right)
{
return Equals(left, right);
}
public static bool operator !=(KademliaId left, KademliaId right)
{
return !Equals(left, right);
}
#endregion
}
}
|
using System;
using System.Linq;
using ProtoBuf;
namespace Kyru.Network
{
[ProtoContract]
internal sealed class KademliaId
{
internal const int Size = 160;
private const int ArraySize = Size / 8;
[ProtoMember(1)]
private readonly byte[] id = new byte[ArraySize];
private KademliaId()
{
}
public KademliaId(byte[] bytes)
{
if (bytes.Length != ArraySize * sizeof(uint))
throw new Exception("The array must of size " + ArraySize * sizeof(uint));
id = bytes;
}
public static KademliaId operator -(KademliaId left, KademliaId right)
{
var result = new KademliaId();
for (int i = 0; i < ArraySize; i++)
{
result.id[i] = (byte) (left.id[i] ^ right.id[i]);
}
return result;
}
public static KademliaId RandomId
{
get
{
var bytes = Random.Bytes(ArraySize * sizeof(uint));
return new KademliaId(bytes);
}
}
public static implicit operator byte[](KademliaId id)
{
var bytes = new byte[ArraySize];
id.id.CopyTo(bytes, ArraySize);
return bytes;
}
public override string ToString()
{
return id.Aggregate("", (s, u) => s + u.ToString("0,8:X"));
}
internal int KademliaBucket()
{
if (id.All(i => i == 0))
{
throw new InvalidOperationException("BUG: the local node must not be added as a Kademlia contact");
}
throw new NotImplementedException();
}
#region Equality (generated code)
private bool Equals(KademliaId other)
{
return Equals(id, other.id);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj is KademliaId && Equals((KademliaId) obj);
}
public override int GetHashCode()
{
int hashCode = 0;
foreach (uint n in id)
{
hashCode = (hashCode * 397) ^ (int) n;
}
return hashCode;
}
public static bool operator ==(KademliaId left, KademliaId right)
{
return Equals(left, right);
}
public static bool operator !=(KademliaId left, KademliaId right)
{
return !Equals(left, right);
}
#endregion
}
}
|
bsd-3-clause
|
C#
|
b77e6013d2ac0fe9d96abf0a66d05809bd47fe5f
|
Use MergeWithGremlinqSection.
|
ExRam/ExRam.Gremlinq
|
src/ExRam.Gremlinq.Providers.WebSocket.AspNet/Extensions/ProviderSetupExtensions.cs
|
src/ExRam.Gremlinq.Providers.WebSocket.AspNet/Extensions/ProviderSetupExtensions.cs
|
// ReSharper disable HeapView.PossibleBoxingAllocation
using ExRam.Gremlinq.Providers.WebSocket;
namespace ExRam.Gremlinq.Providers.Core.AspNet
{
public static class ProviderSetupExtensions
{
public static ProviderSetup<TConfigurator> ConfigureWebSocket<TConfigurator>(this ProviderSetup<TConfigurator> setup)
where TConfigurator : IWebSocketProviderConfigurator<TConfigurator>
{
return setup
.Configure((configurator, providerSection) => configurator
.ConfigureWebSocket(webSocketConfigurator => webSocketConfigurator
.ConfigureFrom(providerSection
.MergeWithGremlinqSection())));
}
}
}
|
// ReSharper disable HeapView.PossibleBoxingAllocation
using ExRam.Gremlinq.Providers.WebSocket;
namespace ExRam.Gremlinq.Providers.Core.AspNet
{
public static class ProviderSetupExtensions
{
public static ProviderSetup<TConfigurator> ConfigureWebSocket<TConfigurator>(this ProviderSetup<TConfigurator> setup)
where TConfigurator : IWebSocketProviderConfigurator<TConfigurator>
{
return setup
.Configure((configurator, gremlinqSection, providerSection) => configurator
.ConfigureWebSocket(webSocketConfigurator => webSocketConfigurator
.ConfigureFrom(gremlinqSection)
.ConfigureFrom(providerSection)));
}
}
}
|
mit
|
C#
|
32db1cd420510075c9c1317f884cd08910e5db8f
|
Refactor user agent extensions
|
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.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 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.Linq;
using Microsoft.AspNetCore.Http;
using Wangkanai.Detection.Models;
namespace Wangkanai.Detection.Extensions
{
internal static class UserAgentExtensions
{
public static UserAgent UserAgentFromHeader(this HttpContext context)
{
return new UserAgent(context.Request.Headers["User-Agent"].FirstOrDefault());
}
public static bool IsNullOrEmpty(this UserAgent agent)
{
return agent == null
|| string.IsNullOrEmpty(agent.ToLower());
}
public static string ToLower(this UserAgent agent)
{
return agent.ToString().ToLower();
}
public static int Length(this UserAgent agent)
{
return agent.ToString().Length;
}
public static bool Contains(this UserAgent agent, string word)
{
return agent.ToLower().Contains(word.ToLower());
}
public static bool Contains(this UserAgent agent, string[] array)
{
return array.Any(agent.Contains)
&& !agent.IsNullOrEmpty();
}
public static bool StartsWith(this UserAgent agent, string word)
{
return agent.ToLower().StartsWith(word.ToLower())
&& !agent.IsNullOrEmpty();
}
public static bool StartsWith(this UserAgent agent, string[] array)
{
return array.Any(agent.StartsWith);
}
public static bool StartsWith(this UserAgent agent, string[] array, int minimum)
{
return agent.Length() >= minimum
&& agent.StartsWith(array);
}
}
}
|
apache-2.0
|
C#
|
9cfa83ad5bdaa43722b1931463688f0cfd6bd67f
|
Add a constructor that only requires messages.
|
Qowaiv/Qowaiv
|
src/Qowaiv.ComponentModel/Result_T.cs
|
src/Qowaiv.ComponentModel/Result_T.cs
|
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace Qowaiv.ComponentModel
{
/// <summary>Represents a result of a validation, executed command, etcetera.</summary>
public class Result<T> : Result
{
/// <summary>Creates a new instance of a <see cref="Result{T}"/>.</summary>
public Result(IEnumerable<ValidationResult> messages) : this(default(T), messages) { }
/// <summary>Creates a new instance of a <see cref="Result{T}"/>.</summary>
/// <param name="data">
/// The data related to the result.
/// </param>
public Result(T data) : this(data, Enumerable.Empty<ValidationResult>()) { }
/// <summary>Creates a new instance of a <see cref="Result{T}"/>.</summary>
/// <param name="data">
/// The data related to the result.
/// </param>
/// <param name="messages">
/// The messages related to the result.
/// </param>
public Result(T data, IEnumerable<ValidationResult> messages) : base(messages)
{
Data = data;
}
/// <summary>Gets the data related to result.</summary>
public T Data { get; }
/// <summary>Implicitly casts a model to the <see cref="Result"/>.</summary>
public static implicit operator Result<T>(T model) => new Result<T>(model);
/// <summary>Explicitly casts the <see cref="Result"/> to the type of the related model.</summary>
public static explicit operator T(Result<T> result) => result == null ? default(T) : result.Data;
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace Qowaiv.ComponentModel
{
/// <summary>Represents a result of a validation, executed command, etcetera.</summary>
public class Result<T> : Result
{
/// <summary>Creates a new instance of a <see cref="Result{T}"/>.</summary>
/// <param name="data">
/// The data related to the result.
/// </param>
public Result(T data) : this(data, Enumerable.Empty<ValidationResult>()) { }
/// <summary>Creates a new instance of a <see cref="Result{T}"/>.</summary>
/// <param name="data">
/// The data related to the result.
/// </param>
/// <param name="messages">
/// The messages related to the result.
/// </param>
public Result(T data, IEnumerable<ValidationResult> messages) : base(messages)
{
Data = data;
}
/// <summary>Gets the data related to result.</summary>
public T Data { get; }
/// <summary>Implicitly casts the <see cref="Result"/> to the type of the related model.</summary>
public static implicit operator T(Result<T> result) => result == null ? default(T) : result.Data;
/// <summary>Implicitly casts a model to the <see cref="Result"/>.</summary>
public static explicit operator Result<T>(T model) => new Result<T>(model);
}
}
|
mit
|
C#
|
bf5af3310aa1d643e08a0135531fff7b9aff9416
|
Update break colour to not look like kiai time
|
NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,UselessToucan/osu,peppy/osu,ppy/osu,ppy/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,smoogipooo/osu,ppy/osu
|
osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs
|
osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.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.Game.Beatmaps.Timing;
using osu.Game.Graphics;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{
/// <summary>
/// The part of the timeline that displays breaks in the song.
/// </summary>
public class BreakPart : TimelinePart
{
protected override void LoadBeatmap(EditorBeatmap beatmap)
{
base.LoadBeatmap(beatmap);
foreach (var breakPeriod in beatmap.Breaks)
Add(new BreakVisualisation(breakPeriod));
}
private class BreakVisualisation : DurationVisualisation
{
public BreakVisualisation(BreakPeriod breakPeriod)
: base(breakPeriod.StartTime, breakPeriod.EndTime)
{
}
[BackgroundDependencyLoader]
private void load(OsuColour colours) => Colour = colours.GreyCarmineLight;
}
}
}
|
// 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.Game.Beatmaps.Timing;
using osu.Game.Graphics;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{
/// <summary>
/// The part of the timeline that displays breaks in the song.
/// </summary>
public class BreakPart : TimelinePart
{
protected override void LoadBeatmap(EditorBeatmap beatmap)
{
base.LoadBeatmap(beatmap);
foreach (var breakPeriod in beatmap.Breaks)
Add(new BreakVisualisation(breakPeriod));
}
private class BreakVisualisation : DurationVisualisation
{
public BreakVisualisation(BreakPeriod breakPeriod)
: base(breakPeriod.StartTime, breakPeriod.EndTime)
{
}
[BackgroundDependencyLoader]
private void load(OsuColour colours) => Colour = colours.Yellow;
}
}
}
|
mit
|
C#
|
12d3e0ae099f8360dab1062bc1c41fc0269aa297
|
Create separate mesh when MjMeshfilter is first instantiated, to support duplicating in Editor
|
deepmind/mujoco,deepmind/mujoco,deepmind/mujoco,deepmind/mujoco,deepmind/mujoco
|
unity/Runtime/Components/Shapes/MjMeshFilter.cs
|
unity/Runtime/Components/Shapes/MjMeshFilter.cs
|
// Copyright 2019 DeepMind Technologies Limited
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Mujoco {
[RequireComponent(typeof(MjShapeComponent))]
[RequireComponent(typeof(MeshFilter))]
[ExecuteInEditMode]
public class MjMeshFilter : MonoBehaviour {
private MjShapeComponent _geom;
private Vector4 _shapeChangeStamp;
private MeshFilter _meshFilter;
protected void Awake() {
_geom = GetComponent<MjShapeComponent>();
_shapeChangeStamp = new Vector4(0, 0, 0, -1);
_meshFilter = GetComponent<MeshFilter>();
_meshFilter.mesh = new Mesh();
}
protected void Update() {
var currentChangeStamp = _geom.GetChangeStamp();
if ((_shapeChangeStamp - currentChangeStamp).magnitude <= 1e-3f) {
return;
}
_shapeChangeStamp = currentChangeStamp;
Tuple<Vector3[], int[]> meshData = _geom.BuildMesh();
if (meshData == null) {
throw new ArgumentException("Unsupported geom shape detected");
}
DisposeCurrentMesh();
var mesh = new Mesh();
// Name this mesh to easily track resources in Unity analysis tools.
mesh.name = $"Mujoco mesh for {gameObject.name}, id:{mesh.GetInstanceID()}";
_meshFilter.sharedMesh = mesh;
mesh.vertices = meshData.Item1;
mesh.triangles = meshData.Item2;
Vector2[] uvs = new Vector2[mesh.vertices.Length];
for (int i = 0; i < uvs.Length; i++){
uvs[i] = new Vector2(mesh.vertices[i].x, mesh.vertices[i].z);
}
mesh.uv = uvs;
mesh.RecalculateNormals();
mesh.RecalculateTangents();
}
protected void OnDestroy() {
DisposeCurrentMesh();
}
// Dynamically created meshes with no references are only disposed automatically on scene changes.
// This prevents resource leaks in case the host environment doesn't reload scenes.
private void DisposeCurrentMesh() {
if (_meshFilter.sharedMesh != null) {
#if UNITY_EDITOR
DestroyImmediate(_meshFilter.sharedMesh);
#else
Destroy(_meshFilter.sharedMesh);
#endif
}
}
}
}
|
// Copyright 2019 DeepMind Technologies Limited
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Mujoco {
[RequireComponent(typeof(MjShapeComponent))]
[RequireComponent(typeof(MeshFilter))]
[ExecuteInEditMode]
public class MjMeshFilter : MonoBehaviour {
private MjShapeComponent _geom;
private Vector4 _shapeChangeStamp;
private MeshFilter _meshFilter;
protected void Awake() {
_geom = GetComponent<MjShapeComponent>();
_shapeChangeStamp = new Vector4(0, 0, 0, -1);
_meshFilter = GetComponent<MeshFilter>();
}
protected void Update() {
var currentChangeStamp = _geom.GetChangeStamp();
if ((_shapeChangeStamp - currentChangeStamp).magnitude <= 1e-3f) {
return;
}
_shapeChangeStamp = currentChangeStamp;
Tuple<Vector3[], int[]> meshData = _geom.BuildMesh();
if (meshData == null) {
throw new ArgumentException("Unsupported geom shape detected");
}
DisposeCurrentMesh();
var mesh = new Mesh();
// Name this mesh to easily track resources in Unity analysis tools.
mesh.name = $"Mujoco mesh for {gameObject.name}, id:{mesh.GetInstanceID()}";
_meshFilter.sharedMesh = mesh;
mesh.vertices = meshData.Item1;
mesh.triangles = meshData.Item2;
Vector2[] uvs = new Vector2[mesh.vertices.Length];
for (int i = 0; i < uvs.Length; i++){
uvs[i] = new Vector2(mesh.vertices[i].x, mesh.vertices[i].z);
}
mesh.uv = uvs;
mesh.RecalculateNormals();
mesh.RecalculateTangents();
}
protected void OnDestroy() {
DisposeCurrentMesh();
}
// Dynamically created meshes with no references are only disposed automatically on scene changes.
// This prevents resource leaks in case the host environment doesn't reload scenes.
private void DisposeCurrentMesh() {
if (_meshFilter.sharedMesh != null) {
#if UNITY_EDITOR
DestroyImmediate(_meshFilter.sharedMesh);
#else
Destroy(_meshFilter.sharedMesh);
#endif
}
}
}
}
|
apache-2.0
|
C#
|
5140cd3c4b3de659a061e652936aa3f0d9571a54
|
Refactor parallel exception util
|
app-enhance/ae-di,app-enhance/ae-di
|
src/AE.Extensions.DependencyInjection/ParallelExceptionsExtensions.cs
|
src/AE.Extensions.DependencyInjection/ParallelExceptionsExtensions.cs
|
namespace AE.Extensions.DependencyInjection
{
using System;
using System.Linq;
internal static class ParallelExceptionsExtensions
{
public static Exception FlattenAndCast<T>(this AggregateException e) where T : Exception, new()
{
var flattenException = e.Flatten();
return TryBubbleUpException<T>(flattenException)
?? CreateException<T>("Unhandled exceptions during paraller operations", flattenException);
}
private static Exception TryBubbleUpException<T>(AggregateException flattenException) where T : Exception, new()
{
if (flattenException.InnerExceptions.Count == 1)
{
var exception = flattenException.InnerExceptions.First();
return exception is T ? exception : CreateException<T>(exception.Message, exception);
}
return null;
}
private static Exception CreateException<T>(params object[] parameters)
{
return Activator.CreateInstance(typeof(T), parameters) as Exception;
}
}
}
|
namespace AE.Extensions.DependencyInjection
{
using System;
using System.Linq;
internal static class ParallelExceptionsExtensions
{
public static T FlattenAndCast<T>(this AggregateException e) where T : Exception, new()
{
var flattenException = e.Flatten();
if (flattenException.InnerExceptions.Count == 1)
{
return Activator.CreateInstance(typeof(T), new[] { flattenException.InnerExceptions.First().Message }) as T;
}
return Activator.CreateInstance(typeof(T), new object[] { "Unhandled exceptions during descrive service type", flattenException }) as T;
}
}
}
|
mit
|
C#
|
67096961ce159df6b0f1f6c44a06c5f5e1e91cc7
|
Update CacheItemRecord.cs
|
SouleDesigns/SouleDesigns.Orchard,ehe888/Orchard,dcinzona/Orchard,Serlead/Orchard,dcinzona/Orchard,Praggie/Orchard,Serlead/Orchard,omidnasri/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,omidnasri/Orchard,yersans/Orchard,jtkech/Orchard,OrchardCMS/Orchard,TalaveraTechnologySolutions/Orchard,TalaveraTechnologySolutions/Orchard,abhishekluv/Orchard,AdvantageCS/Orchard,neTp9c/Orchard,sfmskywalker/Orchard,jtkech/Orchard,planetClaire/Orchard-LETS,abhishekluv/Orchard,grapto/Orchard.CloudBust,jagraz/Orchard,jersiovic/Orchard,phillipsj/Orchard,RoyalVeterinaryCollege/Orchard,bedegaming-aleksej/Orchard,Lombiq/Orchard,abhishekluv/Orchard,AdvantageCS/Orchard,armanforghani/Orchard,hannan-azam/Orchard,Praggie/Orchard,phillipsj/Orchard,planetClaire/Orchard-LETS,SzymonSel/Orchard,xkproject/Orchard,omidnasri/Orchard,johnnyqian/Orchard,ehe888/Orchard,ehe888/Orchard,jchenga/Orchard,jagraz/Orchard,OrchardCMS/Orchard,geertdoornbos/Orchard,jchenga/Orchard,AdvantageCS/Orchard,Lombiq/Orchard,gcsuk/Orchard,TalaveraTechnologySolutions/Orchard,Fogolan/OrchardForWork,jchenga/Orchard,mvarblow/Orchard,hbulzy/Orchard,RoyalVeterinaryCollege/Orchard,fassetar/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,Praggie/Orchard,brownjordaninternational/OrchardCMS,TalaveraTechnologySolutions/Orchard,vairam-svs/Orchard,armanforghani/Orchard,Fogolan/OrchardForWork,mvarblow/Orchard,IDeliverable/Orchard,neTp9c/Orchard,tobydodds/folklife,gcsuk/Orchard,qt1/Orchard,TalaveraTechnologySolutions/Orchard,Fogolan/OrchardForWork,SouleDesigns/SouleDesigns.Orchard,grapto/Orchard.CloudBust,RoyalVeterinaryCollege/Orchard,SzymonSel/Orchard,grapto/Orchard.CloudBust,phillipsj/Orchard,li0803/Orchard,planetClaire/Orchard-LETS,jagraz/Orchard,rtpHarry/Orchard,hannan-azam/Orchard,Codinlab/Orchard,AdvantageCS/Orchard,neTp9c/Orchard,aaronamm/Orchard,OrchardCMS/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Dolphinsimon/Orchard,SzymonSel/Orchard,fassetar/Orchard,omidnasri/Orchard,aaronamm/Orchard,fassetar/Orchard,armanforghani/Orchard,bedegaming-aleksej/Orchard,TalaveraTechnologySolutions/Orchard,sfmskywalker/Orchard,qt1/Orchard,tobydodds/folklife,LaserSrl/Orchard,SouleDesigns/SouleDesigns.Orchard,jimasp/Orchard,hannan-azam/Orchard,SouleDesigns/SouleDesigns.Orchard,yersans/Orchard,vairam-svs/Orchard,grapto/Orchard.CloudBust,bedegaming-aleksej/Orchard,dcinzona/Orchard,johnnyqian/Orchard,sfmskywalker/Orchard,armanforghani/Orchard,abhishekluv/Orchard,brownjordaninternational/OrchardCMS,omidnasri/Orchard,rtpHarry/Orchard,vairam-svs/Orchard,brownjordaninternational/OrchardCMS,tobydodds/folklife,gcsuk/Orchard,hannan-azam/Orchard,qt1/Orchard,vairam-svs/Orchard,Lombiq/Orchard,fassetar/Orchard,geertdoornbos/Orchard,planetClaire/Orchard-LETS,IDeliverable/Orchard,JRKelso/Orchard,abhishekluv/Orchard,armanforghani/Orchard,bedegaming-aleksej/Orchard,yersans/Orchard,jtkech/Orchard,sfmskywalker/Orchard,Serlead/Orchard,TalaveraTechnologySolutions/Orchard,Dolphinsimon/Orchard,jagraz/Orchard,Praggie/Orchard,AdvantageCS/Orchard,sfmskywalker/Orchard,dcinzona/Orchard,jchenga/Orchard,LaserSrl/Orchard,brownjordaninternational/OrchardCMS,dmitry-urenev/extended-orchard-cms-v10.1,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,yersans/Orchard,mvarblow/Orchard,omidnasri/Orchard,Praggie/Orchard,geertdoornbos/Orchard,qt1/Orchard,sfmskywalker/Orchard,xkproject/Orchard,hbulzy/Orchard,grapto/Orchard.CloudBust,xkproject/Orchard,rtpHarry/Orchard,jtkech/Orchard,li0803/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,phillipsj/Orchard,jersiovic/Orchard,Codinlab/Orchard,Dolphinsimon/Orchard,JRKelso/Orchard,LaserSrl/Orchard,aaronamm/Orchard,jimasp/Orchard,grapto/Orchard.CloudBust,JRKelso/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,sfmskywalker/Orchard,Codinlab/Orchard,jimasp/Orchard,Codinlab/Orchard,RoyalVeterinaryCollege/Orchard,JRKelso/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,hbulzy/Orchard,Codinlab/Orchard,jchenga/Orchard,IDeliverable/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,OrchardCMS/Orchard,jtkech/Orchard,neTp9c/Orchard,johnnyqian/Orchard,neTp9c/Orchard,xkproject/Orchard,brownjordaninternational/OrchardCMS,IDeliverable/Orchard,jersiovic/Orchard,xkproject/Orchard,Serlead/Orchard,SzymonSel/Orchard,jersiovic/Orchard,SouleDesigns/SouleDesigns.Orchard,gcsuk/Orchard,bedegaming-aleksej/Orchard,rtpHarry/Orchard,li0803/Orchard,Dolphinsimon/Orchard,planetClaire/Orchard-LETS,hbulzy/Orchard,SzymonSel/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,omidnasri/Orchard,aaronamm/Orchard,rtpHarry/Orchard,omidnasri/Orchard,mvarblow/Orchard,johnnyqian/Orchard,fassetar/Orchard,geertdoornbos/Orchard,IDeliverable/Orchard,hannan-azam/Orchard,LaserSrl/Orchard,Lombiq/Orchard,Serlead/Orchard,Fogolan/OrchardForWork,ehe888/Orchard,ehe888/Orchard,jagraz/Orchard,tobydodds/folklife,Fogolan/OrchardForWork,dcinzona/Orchard,qt1/Orchard,li0803/Orchard,johnnyqian/Orchard,vairam-svs/Orchard,phillipsj/Orchard,RoyalVeterinaryCollege/Orchard,tobydodds/folklife,hbulzy/Orchard,JRKelso/Orchard,Lombiq/Orchard,geertdoornbos/Orchard,yersans/Orchard,gcsuk/Orchard,jimasp/Orchard,li0803/Orchard,LaserSrl/Orchard,OrchardCMS/Orchard,jimasp/Orchard,TalaveraTechnologySolutions/Orchard,omidnasri/Orchard,Dolphinsimon/Orchard,sfmskywalker/Orchard,jersiovic/Orchard,tobydodds/folklife,mvarblow/Orchard,abhishekluv/Orchard,aaronamm/Orchard
|
src/Orchard.Web/Modules/Orchard.OutputCache/Models/CacheItemRecord.cs
|
src/Orchard.Web/Modules/Orchard.OutputCache/Models/CacheItemRecord.cs
|
using System;
using System.ComponentModel.DataAnnotations;
using Orchard.Data.Conventions;
using Orchard.Environment.Extensions;
namespace Orchard.OutputCache.Models {
[OrchardFeature("Orchard.OutputCache.Database")]
public class CacheItemRecord {
public virtual int Id { get; set; }
public virtual DateTime CachedOnUtc { get; set; }
public virtual int Duration { get; set; }
public virtual int GraceTime { get; set; }
public virtual DateTime ValidUntilUtc { get; set; }
public virtual DateTime StoredUntilUtc { get; set; }
[StringLengthMax] public virtual byte[] Output { get; set; }
public virtual string ContentType { get; set; }
[StringLength(2048)] public virtual string QueryString { get; set; }
[StringLength(2048)] public virtual string CacheKey { get; set; }
[StringLength(2048)] public virtual string InvariantCacheKey { get; set; }
[StringLength(2048)] public virtual string Url { get; set; }
public virtual string Tenant { get; set; }
public virtual int StatusCode { get; set; }
[StringLengthMax] public virtual string Tags { get; set; }
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
using Orchard.Data.Conventions;
using Orchard.Environment.Extensions;
namespace Orchard.OutputCache.Models {
[OrchardFeature("Orchard.OutputCache.Database")]
public class CacheItemRecord {
public virtual int Id { get; set; }
public virtual DateTime CachedOnUtc { get; set; }
public virtual int Duration { get; set; }
public virtual int GraceTime { get; set; }
public virtual DateTime ValidUntilUtc { get; set; }
public virtual DateTime StoredUntilUtc { get; set; }
public virtual byte[] Output { get; set; }
public virtual string ContentType { get; set; }
[StringLength(2048)] public virtual string QueryString { get; set; }
[StringLength(2048)] public virtual string CacheKey { get; set; }
[StringLength(2048)] public virtual string InvariantCacheKey { get; set; }
[StringLength(2048)] public virtual string Url { get; set; }
public virtual string Tenant { get; set; }
public virtual int StatusCode { get; set; }
[StringLengthMax] public virtual string Tags { get; set; }
}
}
|
bsd-3-clause
|
C#
|
f633e28e94ea93a856e88ab5fab0023aa1e82339
|
update AttributeUnit define definition
|
LagoVista/DeviceAdmin
|
src/LagoVista.IoT.DeviceAdmin/Models/AttributeUnit.cs
|
src/LagoVista.IoT.DeviceAdmin/Models/AttributeUnit.cs
|
using LagoVista.Core.Attributes;
using LagoVista.Core.Interfaces;
using LagoVista.IoT.DeviceAdmin.Resources;
using Newtonsoft.Json;
using System;
namespace LagoVista.IoT.DeviceAdmin.Models
{
[EntityDescription(DeviceAdminDomain.DeviceAdmin, DeviceLibraryResources.Names.AttributeUnit_Title, Resources.DeviceLibraryResources.Names.AttributeUnit_Help, DeviceLibraryResources.Names.AttributeUnit_Description, EntityDescriptionAttribute.EntityTypes.SimpleModel,typeof(DeviceLibraryResources))]
public class AttributeUnit : IKeyedEntity, INamedEntity
{
[JsonProperty("id")]
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Common_UniqueId, IsUserEditable: false, ResourceType: typeof(DeviceLibraryResources), IsRequired: true)]
public String Id { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Common_Name, ResourceType: typeof(DeviceLibraryResources), IsRequired: true)]
public String Name { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Common_Key, HelpResource: Resources.DeviceLibraryResources.Names.Common_Key_Help, FieldType: FieldTypes.Key, RegExValidationMessageResource: Resources.DeviceLibraryResources.Names.Common_Key_Validation, ResourceType: typeof(DeviceLibraryResources), IsRequired: true)]
public String Key { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.AttributeUnit_Abbreviation, IsRequired: true, MaxLength: 6, ResourceType: typeof(DeviceLibraryResources))]
public String Abbreviation { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Common_Description, ResourceType: typeof(DeviceLibraryResources))]
public String Description { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.AttributeUnit_NumberDecimal, IsRequired: true, FieldType: FieldTypes.Integer, ResourceType: typeof(DeviceLibraryResources))]
public int NumberDecimalPoints { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.AttributeUnit_ConversionScript, FieldType:FieldTypes.NodeScript, HelpResource: Resources.DeviceLibraryResources.Names.AttributeUnit_ConversionScript_Help, ResourceType: typeof(DeviceLibraryResources))]
public String ConversionScript { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.AttributeUnit_IsDefault, HelpResource: Resources.DeviceLibraryResources.Names.AttributeUnit_ConversionScript_Help, ResourceType: typeof(DeviceLibraryResources))]
public String IsDefault { get; set; }
}
}
|
using LagoVista.Core.Attributes;
using LagoVista.Core.Interfaces;
using LagoVista.IoT.DeviceAdmin.Resources;
using Newtonsoft.Json;
using System;
namespace LagoVista.IoT.DeviceAdmin.Models
{
[EntityDescription(DeviceAdminDomain.DeviceAdmin, DeviceLibraryResources.Names.AttributeUnit_Title, Resources.DeviceLibraryResources.Names.AttributeUnit_Help, DeviceLibraryResources.Names.AttributeUnit_Description, EntityDescriptionAttribute.EntityTypes.SimpleModel,typeof(DeviceLibraryResources))]
public class AttributeUnit : IKeyedEntity, INamedEntity
{
[JsonProperty("id")]
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Common_UniqueId, IsUserEditable: false, ResourceType: typeof(DeviceLibraryResources), IsRequired: true)]
public String Id { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Common_Name, ResourceType: typeof(DeviceLibraryResources), IsRequired: true)]
public String Name { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Common_Key, HelpResource: Resources.DeviceLibraryResources.Names.Common_Key_Help, FieldType: FieldTypes.Key, RegExValidationMessageResource: Resources.DeviceLibraryResources.Names.Common_Key_Validation, ResourceType: typeof(DeviceLibraryResources), IsRequired: true)]
public String Key { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.AttributeUnit_Abbreviation, IsRequired: true, MaxLength: 6, ResourceType: typeof(DeviceLibraryResources))]
public String Abbreviation { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Common_Description, ResourceType: typeof(DeviceLibraryResources))]
public String Description { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.AttributeUnit_NumberDecimal, IsRequired: true, FieldType: FieldTypes.Integer, ResourceType: typeof(DeviceLibraryResources))]
public int NumberDecimalPoints { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.AttributeUnit_ConversionScript, HelpResource: Resources.DeviceLibraryResources.Names.AttributeUnit_ConversionScript_Help, ResourceType: typeof(DeviceLibraryResources))]
public String ConversionScript { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.AttributeUnit_IsDefault, HelpResource: Resources.DeviceLibraryResources.Names.AttributeUnit_ConversionScript_Help, ResourceType: typeof(DeviceLibraryResources))]
public String IsDefault { get; set; }
}
}
|
mit
|
C#
|
4f511e5bfca883f1ede29f816a70a6cd9eed870f
|
Remove quota because quota filter exists.
|
yonglehou/msgpack-rpc-cli,yfakariya/msgpack-rpc-cli
|
src/MsgPack.Rpc.Client/Rpc/Client/ErrorInterpreter.cs
|
src/MsgPack.Rpc.Client/Rpc/Client/ErrorInterpreter.cs
|
#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion -- License Terms --
using System;
using System.Diagnostics.Contracts;
using System.Linq;
using MsgPack.Rpc.Client.Protocols;
namespace MsgPack.Rpc.Client
{
/// <summary>
/// Interprets error stream.
/// </summary>
internal static class ErrorInterpreter
{
/// <summary>
/// Unpacks <see cref="RpcErrorMessage"/> from stream in the specified context.
/// </summary>
/// <param name="context"><see cref="ClientResponseContext"/> which stores serialized error.</param>
/// <returns>An unpacked <see cref="RpcErrorMessage"/>.</returns>
internal static RpcErrorMessage UnpackError( ClientResponseContext context )
{
Contract.Assert( context != null );
Contract.Assert( context.ErrorBuffer != null );
Contract.Assert( context.ErrorBuffer.Length > 0 );
Contract.Assert( context.ResultBuffer != null );
Contract.Assert( context.ResultBuffer.Length > 0 );
MessagePackObject error;
try
{
error = Unpacking.UnpackObject( context.ErrorBuffer );
}
catch ( UnpackException )
{
error = new MessagePackObject( context.ErrorBuffer.GetBuffer().SelectMany( segment => segment.AsEnumerable() ).ToArray() );
}
if ( error.IsNil )
{
return RpcErrorMessage.Success;
}
RpcError errorIdentifier;
if ( error.IsTypeOf<string>().GetValueOrDefault() )
{
errorIdentifier = RpcError.FromIdentifier( error.AsString(), null );
}
else if ( error.IsTypeOf<int>().GetValueOrDefault() )
{
errorIdentifier = RpcError.FromIdentifier( null, error.AsInt32() );
}
else
{
errorIdentifier = RpcError.Unexpected;
}
MessagePackObject detail;
if ( context.ResultBuffer.Length == 0 )
{
detail = MessagePackObject.Nil;
}
else
{
try
{
detail = Unpacking.UnpackObject( context.ResultBuffer );
}
catch ( UnpackException )
{
detail = new MessagePackObject( context.ResultBuffer.GetBuffer().SelectMany( segment => segment.AsEnumerable() ).ToArray() );
}
}
return new RpcErrorMessage( errorIdentifier, detail );
}
}
}
|
#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion -- License Terms --
using System;
using System.Diagnostics.Contracts;
using System.Linq;
using MsgPack.Rpc.Client.Protocols;
namespace MsgPack.Rpc.Client
{
/// <summary>
/// Interprets error stream.
/// </summary>
internal static class ErrorInterpreter
{
// TODO: Configurable
private const int _unknownErrorQuota = 1024;
/// <summary>
/// Unpacks <see cref="RpcErrorMessage"/> from stream in the specified context.
/// </summary>
/// <param name="context"><see cref="ClientResponseContext"/> which stores serialized error.</param>
/// <returns>An unpacked <see cref="RpcErrorMessage"/>.</returns>
internal static RpcErrorMessage UnpackError( ClientResponseContext context )
{
Contract.Assert( context != null );
Contract.Assert( context.ErrorBuffer != null );
Contract.Assert( context.ErrorBuffer.Length > 0 );
Contract.Assert( context.ResultBuffer != null );
Contract.Assert( context.ResultBuffer.Length > 0 );
MessagePackObject error;
try
{
error = Unpacking.UnpackObject( context.ErrorBuffer );
}
catch ( UnpackException )
{
error = new MessagePackObject( context.ErrorBuffer.GetBuffer( 0, _unknownErrorQuota ).SelectMany( segment => segment.AsEnumerable() ).ToArray() );
}
if ( error.IsNil )
{
return RpcErrorMessage.Success;
}
RpcError errorIdentifier;
if ( error.IsTypeOf<string>().GetValueOrDefault() )
{
errorIdentifier = RpcError.FromIdentifier( error.AsString(), null );
}
else if ( error.IsTypeOf<int>().GetValueOrDefault() )
{
errorIdentifier = RpcError.FromIdentifier( null, error.AsInt32() );
}
else
{
errorIdentifier = RpcError.Unexpected;
}
MessagePackObject detail;
if ( context.ResultBuffer.Length == 0 )
{
detail = MessagePackObject.Nil;
}
else
{
try
{
detail = Unpacking.UnpackObject( context.ResultBuffer );
}
catch ( UnpackException )
{
detail = new MessagePackObject( context.ResultBuffer.GetBuffer( 0, _unknownErrorQuota ).SelectMany( segment => segment.AsEnumerable() ).ToArray() );
}
}
return new RpcErrorMessage( errorIdentifier, detail );
}
}
}
|
apache-2.0
|
C#
|
7b4f1e0ac9b8db31bf51fae56f87db50cb7c712c
|
Update CupShuffle with proper command call
|
plrusek/NitoriWare,Barleytree/NitoriWare,uulltt/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare,NitorInc/NitoriWare
|
Assets/Resources/Microgames/CupShuffle/Scripts/CupShuffleController.cs
|
Assets/Resources/Microgames/CupShuffle/Scripts/CupShuffleController.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CupShuffleController : MonoBehaviour
{
public static CupShuffleController instance;
public int cupCount, shuffleCount;
public float shuffleTime, shuffleStartDelay;
public GameObject cupPrefab;
public AudioClip shuffleClip, correctClip, incorrectClip;
private CupShuffleCup[] cups;
private AudioSource _audioSource;
[SerializeField]
private State _state;
public State state
{
get { return _state; }
set { _state = value; for (int i = 0; i < cups.Length; cups[i++].state = state);}
}
public enum State
{
Idle,
Shuffling,
Choose,
Victory,
Loss
}
void Awake()
{
instance = this;
_audioSource = GetComponent<AudioSource>();
_audioSource.pitch = Time.timeScale;
}
void Start()
{
int correctCup = Random.Range(0, cupCount);
cups = new CupShuffleCup[cupCount];
for (int i = 0; i < cupCount; i++)
{
cups[i] = GameObject.Instantiate(cupPrefab).GetComponent<CupShuffleCup>();
cups[i].position = i;
cups[i].isCorrect = i == correctCup;
}
StartCoroutine(playAnimations());
}
private IEnumerator playAnimations()
{
yield return new WaitForSeconds(shuffleStartDelay);
state = State.Shuffling;
for (int i = 0; i < shuffleCount; i++)
{
shuffle();
yield return new WaitForSeconds(shuffleTime);
}
yield return new WaitForSeconds(shuffleTime / 3f);
MicrogameController.instance.displayLocalizedCommand("commandb", "Choose!");
state = State.Choose;
}
public void victory()
{
state = State.Victory;
MicrogameController.instance.setVictory(true, true);
_audioSource.PlayOneShot(correctClip);
}
public void failure()
{
state = State.Loss;
MicrogameController.instance.setVictory(false, true);
_audioSource.PlayOneShot(incorrectClip);
}
void shuffle()
{
int indexA = Random.Range(0, cupCount), indexB;
do {indexB = Random.Range(0, cupCount);} while (indexA == indexB);
bool cupAUp = Random.value < .5f;
CupShuffleCup cupA = cups[indexA], cupB = cups[indexB];
cupA.endAnimation();
cupB.endAnimation();
cupA.startAnimation(cupB.position - cupA.position, shuffleTime, cupAUp);
cupB.startAnimation(cupA.position - cupB.position, shuffleTime, !cupAUp);
_audioSource.PlayOneShot(shuffleClip);
}
void Update ()
{
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CupShuffleController : MonoBehaviour
{
public static CupShuffleController instance;
public int cupCount, shuffleCount;
public float shuffleTime, shuffleStartDelay;
public GameObject cupPrefab;
public AudioClip shuffleClip, correctClip, incorrectClip;
private CupShuffleCup[] cups;
private AudioSource _audioSource;
[SerializeField]
private State _state;
public State state
{
get { return _state; }
set { _state = value; for (int i = 0; i < cups.Length; cups[i++].state = state);}
}
public enum State
{
Idle,
Shuffling,
Choose,
Victory,
Loss
}
void Awake()
{
instance = this;
_audioSource = GetComponent<AudioSource>();
_audioSource.pitch = Time.timeScale;
}
void Start()
{
int correctCup = Random.Range(0, cupCount);
cups = new CupShuffleCup[cupCount];
for (int i = 0; i < cupCount; i++)
{
cups[i] = GameObject.Instantiate(cupPrefab).GetComponent<CupShuffleCup>();
cups[i].position = i;
cups[i].isCorrect = i == correctCup;
}
StartCoroutine(playAnimations());
}
private IEnumerator playAnimations()
{
yield return new WaitForSeconds(shuffleStartDelay);
state = State.Shuffling;
for (int i = 0; i < shuffleCount; i++)
{
shuffle();
yield return new WaitForSeconds(shuffleTime);
}
yield return new WaitForSeconds(shuffleTime / 3f);
MicrogameController.instance.displayCommand(TextHelper.getLocalizedMicrogameText("command.b", "Choose!"));
state = State.Choose;
}
public void victory()
{
state = State.Victory;
MicrogameController.instance.setVictory(true, true);
_audioSource.PlayOneShot(correctClip);
}
public void failure()
{
state = State.Loss;
MicrogameController.instance.setVictory(false, true);
_audioSource.PlayOneShot(incorrectClip);
}
void shuffle()
{
int indexA = Random.Range(0, cupCount), indexB;
do {indexB = Random.Range(0, cupCount);} while (indexA == indexB);
bool cupAUp = Random.value < .5f;
CupShuffleCup cupA = cups[indexA], cupB = cups[indexB];
cupA.endAnimation();
cupB.endAnimation();
cupA.startAnimation(cupB.position - cupA.position, shuffleTime, cupAUp);
cupB.startAnimation(cupA.position - cupB.position, shuffleTime, !cupAUp);
_audioSource.PlayOneShot(shuffleClip);
}
void Update ()
{
}
}
|
mit
|
C#
|
a02a9634a72e6afddc54ffd3fe8f2b66ed38ddbf
|
Allow the static property to be protected
|
cdmdotnet/CQRS,Chinchilla-Software-Com/CQRS
|
Cqrs/Framework/Cqrs.Ninject/Configuration/NinjectDependencyResolver.cs
|
Cqrs/Framework/Cqrs.Ninject/Configuration/NinjectDependencyResolver.cs
|
using System;
using System.Linq;
using Cqrs.Configuration;
using Ninject;
using Ninject.Parameters;
namespace Cqrs.Ninject.Configuration
{
public class NinjectDependencyResolver : IServiceLocator
{
public static IServiceLocator Current { get; protected set; }
static NinjectDependencyResolver()
{
Current = new NinjectDependencyResolver(new StandardKernel());
}
protected IKernel Kernel { get; private set; }
public NinjectDependencyResolver(IKernel kernel)
{
Kernel = kernel;
}
/// <summary>
/// Starts the <see cref="NinjectDependencyResolver"/>
/// </summary>
/// <remarks>
/// this exists to the static constructor can be triggered.
/// </remarks>
public static void Start()
{
}
public T GetService<T>()
{
return Resolve<T>();
}
public object GetService(Type type)
{
return Resolve(type);
}
protected T Resolve<T>()
{
return (T)Resolve(typeof(T));
}
protected object Resolve(Type serviceType)
{
return Kernel.Resolve(Kernel.CreateRequest(serviceType, null, new Parameter[0], true, true)).SingleOrDefault();
}
}
}
|
using System;
using System.Linq;
using Cqrs.Configuration;
using Ninject;
using Ninject.Parameters;
namespace Cqrs.Ninject.Configuration
{
public class NinjectDependencyResolver : IServiceLocator
{
public static IServiceLocator Current { get; private set; }
static NinjectDependencyResolver()
{
Current = new NinjectDependencyResolver(new StandardKernel());
}
protected IKernel Kernel { get; private set; }
public NinjectDependencyResolver(IKernel kernel)
{
Kernel = kernel;
}
/// <summary>
/// Starts the <see cref="NinjectDependencyResolver"/>
/// </summary>
/// <remarks>
/// this exists to the static constructor can be triggered.
/// </remarks>
public static void Start()
{
}
public T GetService<T>()
{
return Resolve<T>();
}
public object GetService(Type type)
{
return Resolve(type);
}
protected T Resolve<T>()
{
return (T)Resolve(typeof(T));
}
protected object Resolve(Type serviceType)
{
return Kernel.Resolve(Kernel.CreateRequest(serviceType, null, new Parameter[0], true, true)).SingleOrDefault();
}
}
}
|
lgpl-2.1
|
C#
|
25988ee84c69619985adb88bcb4cb6fe61ec4ec9
|
Fix error in user authorization service.
|
BibliothecaTeam/Bibliotheca.Server.Gateway,BibliothecaTeam/Bibliotheca.Server.Gateway
|
src/Bibliotheca.Server.Gateway.Api/UserTokenAuthorization/UserTokenOptionsService.cs
|
src/Bibliotheca.Server.Gateway.Api/UserTokenAuthorization/UserTokenOptionsService.cs
|
using Bibliotheca.Server.Gateway.Core.Parameters;
using Bibliotheca.Server.Mvc.Middleware.Authorization.UserTokenAuthentication;
using Bibliotheca.Server.ServiceDiscovery.ServiceClient;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Bibliotheca.Server.Gateway.Api.UserTokenAuthorization
{
/// <summary>
/// Class which is used to retrieve address to authorization service.
/// </summary>
public class UserTokenConfiguration : IUserTokenConfiguration
{
private readonly ILogger<UserTokenConfiguration> _logger;
private readonly IServiceDiscoveryQuery _serviceDiscoveryQuery;
IOptions<ApplicationParameters> _applicationParameters;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="logger">Logger.</param>
/// <param name="serviceDiscoveryQuery">Service discovery query.</param>
/// <param name="applicationParameters">Application parameters.</param>
public UserTokenConfiguration(
ILogger<UserTokenConfiguration> logger,
IServiceDiscoveryQuery serviceDiscoveryQuery,
IOptions<ApplicationParameters> applicationParameters)
{
_logger = logger;
_serviceDiscoveryQuery = serviceDiscoveryQuery;
_applicationParameters = applicationParameters;
}
/// <summary>
/// Get url to authorization service.
/// </summary>
/// <returns>Url to authorization service.</returns>
public string GetAuthorizationUrl()
{
_logger.LogInformation("Retrieving authorization url...");
var instance = _serviceDiscoveryQuery.GetServiceInstanceAsync(
new ServerOptions { Address = _applicationParameters.Value.ServiceDiscovery.ServerAddress },
new string[] { "authorization" }
).GetAwaiter().GetResult();
if (instance != null)
{
var address = $"http://{instance.Address}:{instance.Port}/api/";
_logger.LogInformation($"Authorization url was retrieved ({address}).");
return address;
}
_logger.LogInformation($"Authorization url was not retrieved.");
return null;
}
}
}
|
using Bibliotheca.Server.Gateway.Core.Parameters;
using Bibliotheca.Server.Mvc.Middleware.Authorization.UserTokenAuthentication;
using Bibliotheca.Server.ServiceDiscovery.ServiceClient;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Bibliotheca.Server.Gateway.Api.UserTokenAuthorization
{
/// <summary>
/// Class which is used to retrieve address to authorization service.
/// </summary>
public class UserTokenConfiguration : IUserTokenConfiguration
{
private readonly ILogger<UserTokenConfiguration> _logger;
private readonly IServiceDiscoveryQuery _serviceDiscoveryQuery;
IOptions<ApplicationParameters> _applicationParameters;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="logger">Logger.</param>
/// <param name="serviceDiscoveryQuery">Service discovery query.</param>
/// <param name="applicationParameters">Application parameters.</param>
public UserTokenConfiguration(
ILogger<UserTokenConfiguration> logger,
IServiceDiscoveryQuery serviceDiscoveryQuery,
IOptions<ApplicationParameters> applicationParameters)
{
_logger = logger;
_serviceDiscoveryQuery = serviceDiscoveryQuery;
_applicationParameters = applicationParameters;
}
/// <summary>
/// Get url to authorization service.
/// </summary>
/// <returns>Url to authorization service.</returns>
public string GetAuthorizationUrl()
{
_logger.LogInformation("Retrieving authorization url...");
var service = _serviceDiscoveryQuery.GetServiceAsync(
new ServerOptions { Address = _applicationParameters.Value.ServiceDiscovery.ServerAddress },
new string[] { "heimdall" }
).GetAwaiter().GetResult();
if (service != null)
{
var address = $"http://{service.Address}:{service.Port}/api/";
_logger.LogInformation($"Authorization url was retrieved ({address}).");
return address;
}
_logger.LogInformation($"Authorization url was not retrieved.");
return null;
}
}
}
|
mit
|
C#
|
d68b3004f093cdf67a787b8068a21a7e76193a59
|
Add NOINDEX to error pages
|
martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site
|
src/LondonTravel.Site/Views/Shared/Error.cshtml
|
src/LondonTravel.Site/Views/Shared/Error.cshtml
|
@model int?
@{
ViewBag.MetaDescription = string.Empty;
ViewBag.MetaRobots = "NOINDEX";
ViewBag.Title = "Error";
ViewBag.Message = ViewBag.Message ?? "An error occurred while processing your request.";
}
<h1 class="text-danger">Error (HTTP @(Model ?? 500))</h1>
<h2 class="text-danger">@ViewBag.Message</h2>
|
@model int?
@{
ViewBag.Title = "Error";
ViewBag.Message = ViewBag.Message ?? "An error occurred while processing your request.";
}
<h1 class="text-danger">Error (HTTP @(Model ?? 500))</h1>
<h2 class="text-danger">@ViewBag.Message</h2>
|
apache-2.0
|
C#
|
339bfc5b7f2b1b65b31623df472b75b242a46450
|
fix missing to use invalid propery
|
MeilCli/CrossFormattedText
|
Source/Plugin.CrossFormattedText.Android/ExtendedLinkMovementMethod.cs
|
Source/Plugin.CrossFormattedText.Android/ExtendedLinkMovementMethod.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Text;
using Android.Text.Method;
using Android.Views;
using Android.Widget;
namespace Plugin.CrossFormattedText {
public class ExtendedLinkMovementMethod : LinkMovementMethod {
private static ExtendedLinkMovementMethod _instance;
public static new ExtendedLinkMovementMethod Instance {
get {
if(_instance == null) {
_instance = new ExtendedLinkMovementMethod();
}
return _instance;
}
}
public override bool OnTouchEvent(TextView widget,ISpannable buffer,MotionEvent e) {
var action = e.Action;
if(action == MotionEventActions.Up || action == MotionEventActions.Down) {
int x = (int)e.GetX() - widget.TotalPaddingLeft + widget.ScrollX;
int y = (int)e.GetY() - widget.TotalPaddingTop + widget.ScrollY;
var layout = widget.Layout;
int line = layout.GetLineForVertical(y);
int off = layout.GetOffsetForHorizontal(line,x);
var span = buffer.GetSpans(off,off,Java.Lang.Class.FromType(typeof(CommandableSpan))).OfType<CommandableSpan>().FirstOrDefault();
if(span != null) {
if(action == MotionEventActions.Up) {
span.OnClick(widget);
Selection.RemoveSelection(buffer);
} else if(action == MotionEventActions.Down) {
Selection.SetSelection(buffer,buffer.GetSpanStart(span),buffer.GetSpanEnd(span));
}
return true;
} else {
Selection.RemoveSelection(buffer);
}
}
return base.OnTouchEvent(widget,buffer,e);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Text;
using Android.Text.Method;
using Android.Views;
using Android.Widget;
namespace Plugin.CrossFormattedText {
public class ExtendedLinkMovementMethod : LinkMovementMethod {
private static ExtendedLinkMovementMethod _instance;
public static new ExtendedLinkMovementMethod Instance {
get {
if(_instance == null) {
_instance = new ExtendedLinkMovementMethod();
}
return _instance;
}
}
public override bool OnTouchEvent(TextView widget,ISpannable buffer,MotionEvent e) {
var action = e.Action;
if(action == MotionEventActions.Up || action == MotionEventActions.Down) {
int x = (int)e.XPrecision - widget.TotalPaddingLeft + widget.ScrollX;
int y = (int)e.YPrecision - widget.TotalPaddingTop + widget.ScrollY;
var layout = widget.Layout;
int line = layout.GetLineForVertical(y);
int off = layout.GetOffsetForHorizontal(line,x);
var span = buffer.GetSpans(off,off,Java.Lang.Class.FromType(typeof(CommandableSpan))).OfType<CommandableSpan>().FirstOrDefault();
if(span != null) {
if(action == MotionEventActions.Up) {
span.OnClick(widget);
Selection.RemoveSelection(buffer);
} else if(action == MotionEventActions.Down) {
Selection.SetSelection(buffer,buffer.GetSpanStart(span),buffer.GetSpanEnd(span));
}
return true;
} else {
Selection.RemoveSelection(buffer);
}
}
return base.OnTouchEvent(widget,buffer,e);
}
}
}
|
mit
|
C#
|
860f41b03c4d4a8053e2c25886d74d60a1873f83
|
Remove extra bracket
|
EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework
|
osu.Framework/Input/Events/JoystickEvent.cs
|
osu.Framework/Input/Events/JoystickEvent.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Input.States;
using osu.Framework.Utils;
namespace osu.Framework.Input.Events
{
public abstract class JoystickEvent : UIEvent
{
protected JoystickEvent([NotNull] InputState state)
: base(state)
{
}
/// <summary>
/// List of currently pressed joystick buttons.
/// </summary>
public IEnumerable<JoystickButton> PressedButtons => CurrentState.Joystick.Buttons;
/// <summary>
/// List of joystick axes. Axes which have zero value may be omitted.
/// </summary>
public IEnumerable<JoystickAxis> Axes =>
CurrentState.Joystick.GetAxes().Where(j => j.Value != 0);
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Input.States;
using osu.Framework.Utils;
namespace osu.Framework.Input.Events
{
public abstract class JoystickEvent : UIEvent
{
protected JoystickEvent([NotNull] InputState state)
: base(state)
{
}
/// <summary>
/// List of currently pressed joystick buttons.
/// </summary>
public IEnumerable<JoystickButton> PressedButtons => CurrentState.Joystick.Buttons;
/// <summary>
/// List of joystick axes. Axes which have zero value may be omitted.
/// </summary>
public IEnumerable<JoystickAxis> Axes =>
CurrentState.Joystick.GetAxes().Where(j => j.Value != 0));
}
}
|
mit
|
C#
|
2ba88923b624d012c69c99d40b834beab47e407e
|
Select user preferred ruleset on overlay ruleset selectors initially
|
smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu,smoogipoo/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu
|
osu.Game/Overlays/OverlayRulesetSelector.cs
|
osu.Game/Overlays/OverlayRulesetSelector.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Rulesets;
using osuTK;
namespace osu.Game.Overlays
{
public class OverlayRulesetSelector : RulesetSelector
{
public OverlayRulesetSelector()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(RulesetStore store, IAPIProvider api)
{
var preferredRuleset = store.GetRuleset(api.LocalUser.Value.PlayMode);
if (preferredRuleset != null)
Current.Value = preferredRuleset;
}
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new OverlayRulesetTabItem(value);
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(20, 0),
};
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Rulesets;
using osuTK;
namespace osu.Game.Overlays
{
public class OverlayRulesetSelector : RulesetSelector
{
public OverlayRulesetSelector()
{
AutoSizeAxes = Axes.Both;
}
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new OverlayRulesetTabItem(value);
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(20, 0),
};
}
}
|
mit
|
C#
|
3dfa8a139a23f635f08d2c4c90fcc020789e8ddd
|
add test for step contexts for teardowns
|
adamralph/xbehave.net,xbehave/xbehave.net
|
tests/Xbehave.Test/MetadataFeature.cs
|
tests/Xbehave.Test/MetadataFeature.cs
|
// <copyright file="MetadataFeature.cs" company="xBehave.net contributors">
// Copyright (c) xBehave.net contributors. All rights reserved.
// </copyright>
namespace Xbehave.Test
{
using FluentAssertions;
using Xbehave.Sdk;
using Xunit.Sdk;
public class MetadataFeature
{
[Scenario]
[Example("abc")]
public void UsingMetadata(
string text, IStepContext stepContext, IStep step, IScenario scenario, IXunitTestCase scenarioOutline)
{
"When I execute a step"
.x(c => stepContext = c)
.Teardown(c => c.Should().BeSameAs(stepContext));
"Then the step context contains metadata about the step"
.x(() => (step = stepContext.Step.Should().NotBeNull().And.Subject.As<IStep>())
.DisplayName.Should().Be("Xbehave.Test.MetadataFeature.UsingMetadata(text: \"abc\") [01] When I execute a step"));
"And the step contains metadata about the scenario"
.x(() => (scenario = step.Scenario.Should().NotBeNull().And.Subject.As<IScenario>())
.DisplayName.Should().Be("Xbehave.Test.MetadataFeature.UsingMetadata(text: \"abc\")"));
"And the step contains metadata about the scenario outline"
.x(() => scenario.ScenarioOutline.Should().NotBeNull().And.Subject.As<IXunitTestCase>()
.DisplayName.Should().Be("Xbehave.Test.MetadataFeature.UsingMetadata"));
}
}
}
|
// <copyright file="MetadataFeature.cs" company="xBehave.net contributors">
// Copyright (c) xBehave.net contributors. All rights reserved.
// </copyright>
namespace Xbehave.Test
{
using FluentAssertions;
using Xbehave.Sdk;
using Xunit.Sdk;
public class MetadataFeature
{
[Scenario]
[Example("abc")]
public void UsingMetadata(
string text, IStepContext stepContext, IStep step, IScenario scenario, IXunitTestCase scenarioOutline)
{
"When I execute a step"
.x(c => stepContext = c);
"Then the step context contains metadata about the step"
.x(() => (step = stepContext.Step.Should().NotBeNull().And.Subject.As<IStep>())
.DisplayName.Should().Be("Xbehave.Test.MetadataFeature.UsingMetadata(text: \"abc\") [01] When I execute a step"));
"And the step contains metadata about the scenario"
.x(() => (scenario = step.Scenario.Should().NotBeNull().And.Subject.As<IScenario>())
.DisplayName.Should().Be("Xbehave.Test.MetadataFeature.UsingMetadata(text: \"abc\")"));
"And the step contains metadata about the scenario outline"
.x(() => scenario.ScenarioOutline.Should().NotBeNull().And.Subject.As<IXunitTestCase>()
.DisplayName.Should().Be("Xbehave.Test.MetadataFeature.UsingMetadata"));
}
}
}
|
mit
|
C#
|
b82b91c8b24039514bf36a330a42726f1697211f
|
Enable cache support
|
michael-reichenauer/Dependinator
|
Dependinator/Modeling/Private/ModelingService.cs
|
Dependinator/Modeling/Private/ModelingService.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Dependinator.Modeling.Private.Analyzing;
using Dependinator.Modeling.Private.Serializing;
namespace Dependinator.Modeling.Private
{
internal class ModelingService : IModelingService
{
private readonly IReflectionService reflectionService;
private readonly IDataSerializer dataSerializer;
public ModelingService(
IReflectionService reflectionService,
IDataSerializer dataSerializer)
{
this.reflectionService = reflectionService;
this.dataSerializer = dataSerializer;
}
public Task AnalyzeAsync(string assemblyPath, ItemsCallback itemsCallback) =>
reflectionService.AnalyzeAsync(assemblyPath, itemsCallback);
public Task SerializeAsync(IReadOnlyList<DataItem> items, string dataFilePath) =>
dataSerializer.SerializeAsync(items, dataFilePath);
public void Serialize(IReadOnlyList<DataItem> items, string dataFilePath) =>
dataSerializer.Serialize(items, dataFilePath);
public async Task<bool> TryDeserialize(string dataFilePath, ItemsCallback itemsCallback)
{
if (!File.Exists(dataFilePath))
{
return false;
}
return await dataSerializer.TryDeserializeAsync(dataFilePath, itemsCallback);
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Dependinator.Modeling.Private.Analyzing;
using Dependinator.Modeling.Private.Serializing;
namespace Dependinator.Modeling.Private
{
internal class ModelingService : IModelingService
{
private readonly IReflectionService reflectionService;
private readonly IDataSerializer dataSerializer;
public ModelingService(
IReflectionService reflectionService,
IDataSerializer dataSerializer)
{
this.reflectionService = reflectionService;
this.dataSerializer = dataSerializer;
}
public Task AnalyzeAsync(string assemblyPath, ItemsCallback itemsCallback) =>
reflectionService.AnalyzeAsync(assemblyPath, itemsCallback);
public Task SerializeAsync(IReadOnlyList<DataItem> items, string dataFilePath) =>
dataSerializer.SerializeAsync(items, dataFilePath);
public void Serialize(IReadOnlyList<DataItem> items, string dataFilePath) =>
dataSerializer.Serialize(items, dataFilePath);
public async Task<bool> TryDeserialize(string dataFilePath, ItemsCallback itemsCallback)
{
if (File.Exists(dataFilePath))
{
return false;
}
return await dataSerializer.TryDeserializeAsync(dataFilePath, itemsCallback);
}
}
}
|
mit
|
C#
|
f5301b104bf2b3cbdb35bf82734432e3fb182512
|
fix UpdateNpmPackage
|
signumsoftware/framework,signumsoftware/framework
|
Signum.Upgrade/Upgrades/Upgrade_20201125_ReactBootstrap14.cs
|
Signum.Upgrade/Upgrades/Upgrade_20201125_ReactBootstrap14.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace Signum.Upgrade.Upgrades
{
class Upgrade_20201125_ReactBootstrap14 : CodeUpgradeBase
{
public override string Description => "update react and react-bootstrap to 1.5";
public override string SouthwindCommitHash => "2eeb91f342a5b5cbc37b875e652c4732066e691b";
public override void Execute(UpgradeContext uctx)
{
uctx.ChangeCodeFile("Southwind.React/package.json", file =>
{
file.InsertAfterFirstLine(a => a.Contains("\"homepage\""),
@"""resolutions"": {
""@types/react"": ""file:../Framework/Signum.React/node_modules/@types/react""
},");
file.UpdateNpmPackage("react", "16.14.0");
file.UpdateNpmPackage("react-bootstrap", "1.4.0");
file.UpdateNpmPackage("react-dom", "16.14.0");
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace Signum.Upgrade.Upgrades
{
class Upgrade_20201125_ReactBootstrap14 : CodeUpgradeBase
{
public override string Description => "update react and react-bootstrap to 1.5";
public override string SouthwindCommitHash => "2eeb91f342a5b5cbc37b875e652c4732066e691b";
public override void Execute(UpgradeContext uctx)
{
uctx.ChangeCodeFile("Southwind.React/package.json", file =>
{
file.InsertAfterFirstLine(a => a.Contains("\"homepage\""),
@"""resolutions"": {
""@types/react"": ""file:../Framework/Signum.React/node_modules/@types/react""
},");
file.UpdateNpmPackage("react", "16.14.0");
file.UpdateNpmPackage("react-bootstrap", "1.4.0");
file.UpdateNpmPackage("react", "16.14.0");
});
}
}
}
|
mit
|
C#
|
7df5de62a135b69135d6b4b0c83fdc2d133b2710
|
remove redundant using
|
adamralph/liteguard,adamralph/liteguard
|
targets/Program.cs
|
targets/Program.cs
|
using System.Threading.Tasks;
using SimpleExec;
using static Bullseye.Targets;
using static SimpleExec.Command;
internal class Program
{
public static Task Main(string[] args)
{
Target("build", () => RunAsync("dotnet", "build --configuration Release --nologo --verbosity quiet"));
Target(
"pack",
DependsOn("build"),
ForEach("LiteGuard.nuspec", "LiteGuard.Source.nuspec"),
async nuspec => await RunAsync(
"dotnet",
"pack LiteGuard --configuration Release --no-build --nologo",
configureEnvironment: env => env.Add("NUSPEC_FILE", nuspec)));
Target(
"test",
DependsOn("build"),
() => RunAsync("dotnet", "test --configuration Release --no-build --nologo"));
Target("default", DependsOn("pack", "test"));
return RunTargetsAndExitAsync(args, ex => ex is NonZeroExitCodeException);
}
}
|
using System;
using System.Threading.Tasks;
using SimpleExec;
using static Bullseye.Targets;
using static SimpleExec.Command;
internal class Program
{
public static Task Main(string[] args)
{
Target("build", () => RunAsync("dotnet", "build --configuration Release --nologo --verbosity quiet"));
Target(
"pack",
DependsOn("build"),
ForEach("LiteGuard.nuspec", "LiteGuard.Source.nuspec"),
async nuspec => await RunAsync(
"dotnet",
"pack LiteGuard --configuration Release --no-build --nologo",
configureEnvironment: env => env.Add("NUSPEC_FILE", nuspec)));
Target(
"test",
DependsOn("build"),
() => RunAsync("dotnet", "test --configuration Release --no-build --nologo"));
Target("default", DependsOn("pack", "test"));
return RunTargetsAndExitAsync(args, ex => ex is NonZeroExitCodeException);
}
}
|
mit
|
C#
|
a34b5b7d1e059ae4c1d72fdbf129c2311fbe8f59
|
bump version
|
mj1856/NodaTime.NetworkClock
|
NodaTime.NetworkClock/Properties/AssemblyInfo.cs
|
NodaTime.NetworkClock/Properties/AssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("Matt Johnson")]
[assembly: AssemblyProduct("NodaTime.NetworkClock")]
[assembly: AssemblyCopyright("Copyright © 2014, Matt Johnson. MIT Licensed.")]
[assembly: AssemblyTitle("NodaTime.NetworkClock")]
[assembly: AssemblyDescription("A NodaTime.IClock implementation that gets the current time from an NTP server instead of the computer's local clock.")]
[assembly: AssemblyVersion("1.0.1.*")]
[assembly: AssemblyInformationalVersion("1.0.1")]
|
using System.Reflection;
[assembly: AssemblyCompany("Matt Johnson")]
[assembly: AssemblyProduct("NodaTime.NetworkClock")]
[assembly: AssemblyCopyright("Copyright © 2014, Matt Johnson. MIT Licensed.")]
[assembly: AssemblyTitle("NodaTime.NetworkClock")]
[assembly: AssemblyDescription("A NodaTime.IClock implementation that gets the current time from an NTP server instead of the computer's local clock.")]
[assembly: AssemblyVersion("1.0.0.*")]
[assembly: AssemblyInformationalVersion("1.0.0")]
|
mit
|
C#
|
8475f9f43d4acb9425002569a13bda555fa9cea2
|
Fix bug when match end before Mvp announce
|
CSGO-Analysis/CSGO-Analyzer
|
DemoParser-Model/Services/ScoreBoardService.cs
|
DemoParser-Model/Services/ScoreBoardService.cs
|
using DemoParser_Model.Models;
namespace DemoParser_Model.Services
{
public class ScoreBoardService : IScoreBoardService
{
private IRatingService ratingService = new RatingService();
public ScoreBoard GetScoreBoard(Game game) // OrderType : Team, KDR, Rating, ...
{
ScoreBoard scoreBoard = new ScoreBoard();
foreach (Player player in game.Players)
{
if (player.Frags.Count == 0) //TODO change to IsSpectator
continue;
scoreBoard.AddLine(GetScoreBoardLine(game, player));
}
return scoreBoard;
}
public ScoreBoardLine GetScoreBoardLine(Game game, Player player)
{
ScoreBoardLine line = new ScoreBoardLine();
line.PlayerName = player.Name;
line.TeamName = (player.Team != null) ? player.Team.Name : string.Empty;
foreach (Round round in game.Rounds)
{
foreach (Frag frag in round.Frags)
{
if (frag.Killer.SteamId == player.SteamId)
{
line.Kills++;
if (frag.Headshot)
{
line.Headshot++;
}
}
if (frag.Assist != null && frag.Assist.SteamId == player.SteamId)
{
line.Assist++;
}
if (frag.Victim.SteamId == player.SteamId)
{
line.Deaths++;
}
}
if (round.Mvp != null && round.Mvp.SteamId == player.SteamId)
{
line.Mvp++;
}
}
PlayerRatingData data = ratingService.ComputeRatingData(game, player);
line._1K = data._1K;
line._2K = data._2K;
line._3K = data._3K;
line._4K = data._4K;
line._5K = data._5K;
line.Rating = ratingService.ComputeRating(game.Rounds.Count, data);
return line;
}
}
}
|
using DemoParser_Model.Models;
namespace DemoParser_Model.Services
{
public class ScoreBoardService : IScoreBoardService
{
private IRatingService ratingService = new RatingService();
public ScoreBoard GetScoreBoard(Game game) // OrderType : Team, KDR, Rating, ...
{
ScoreBoard scoreBoard = new ScoreBoard();
foreach (Player player in game.Players)
{
if (player.Frags.Count == 0) //TODO change to IsSpectator
continue;
scoreBoard.AddLine(GetScoreBoardLine(game, player));
}
return scoreBoard;
}
public ScoreBoardLine GetScoreBoardLine(Game game, Player player)
{
ScoreBoardLine line = new ScoreBoardLine();
line.PlayerName = player.Name;
line.TeamName = (player.Team != null) ? player.Team.Name : string.Empty;
foreach (Round round in game.Rounds)
{
foreach (Frag frag in round.Frags)
{
if (frag.Killer.SteamId == player.SteamId)
{
line.Kills++;
if (frag.Headshot)
{
line.Headshot++;
}
}
if (frag.Assist != null && frag.Assist.SteamId == player.SteamId)
{
line.Assist++;
}
if (frag.Victim.SteamId == player.SteamId)
{
line.Deaths++;
}
}
if (round.Mvp.SteamId == player.SteamId)
{
line.Mvp++;
}
}
PlayerRatingData data = ratingService.ComputeRatingData(game, player);
line._1K = data._1K;
line._2K = data._2K;
line._3K = data._3K;
line._4K = data._4K;
line._5K = data._5K;
line.Rating = ratingService.ComputeRating(game.Rounds.Count, data);
return line;
}
}
}
|
mit
|
C#
|
ce735eef51106ebf750c414eab2357409879ea19
|
Remove no longer necessary comment
|
ppy/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,peppy/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework
|
osu.Framework/Graphics/Shaders/UniformMapping.cs
|
osu.Framework/Graphics/Shaders/UniformMapping.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Collections.Generic;
namespace osu.Framework.Graphics.Shaders
{
/// <summary>
/// A mapping of a global uniform to many shaders which need to receive updates on a change.
/// </summary>
internal class UniformMapping<T> : IUniformMapping
where T : struct
{
public T Value;
public List<GlobalUniform<T>> LinkedUniforms = new List<GlobalUniform<T>>();
public string Name { get; }
public UniformMapping(string name)
{
Name = name;
}
public void LinkShaderUniform(IUniform uniform)
{
var typedUniform = (GlobalUniform<T>)uniform;
typedUniform.UpdateValue(this);
LinkedUniforms.Add(typedUniform);
}
public void UnlinkShaderUniform(IUniform uniform)
{
var typedUniform = (GlobalUniform<T>)uniform;
LinkedUniforms.Remove(typedUniform);
}
public void UpdateValue(ref T newValue)
{
Value = newValue;
for (int i = 0; i < LinkedUniforms.Count; i++)
LinkedUniforms[i].UpdateValue(this);
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Collections.Generic;
namespace osu.Framework.Graphics.Shaders
{
/// <summary>
/// A mapping of a global uniform to many shaders which need to receive updates on a change.
/// </summary>
internal class UniformMapping<T> : IUniformMapping
where T : struct
{
public T Value;
public List<GlobalUniform<T>> LinkedUniforms = new List<GlobalUniform<T>>();
public string Name { get; }
public UniformMapping(string name)
{
Name = name;
}
public void LinkShaderUniform(IUniform uniform)
{
var typedUniform = (GlobalUniform<T>)uniform;
typedUniform.UpdateValue(this);
LinkedUniforms.Add(typedUniform);
}
public void UnlinkShaderUniform(IUniform uniform)
{
var typedUniform = (GlobalUniform<T>)uniform;
LinkedUniforms.Remove(typedUniform);
}
public void UpdateValue(ref T newValue)
{
Value = newValue;
// Iterate by index to remove an enumerator allocation
// ReSharper disable once ForCanBeConvertedToForeach
for (int i = 0; i < LinkedUniforms.Count; i++)
LinkedUniforms[i].UpdateValue(this);
}
}
}
|
mit
|
C#
|
562054b71da7975a3d3a0d5308ec800ceafe05d7
|
Fix SDL so name
|
smoogipooo/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,Tom94/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,EVAST9919/osu-framework
|
osu.Framework/Platform/Linux/Sdl/SdlClipboard.cs
|
osu.Framework/Platform/Linux/Sdl/SdlClipboard.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Runtime.InteropServices;
namespace osu.Framework.Platform.Linux.Sdl
{
public class SdlClipboard : Clipboard
{
private const string lib = "libSDL2-2.0";
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetClipboardText", ExactSpelling = true)]
internal static extern string SDL_GetClipboardText();
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_SetClipboardText", ExactSpelling = true)]
internal static extern int SDL_SetClipboardText(string text);
public override string GetText()
{
return SDL_GetClipboardText();
}
public override void SetText(string selectedText)
{
SDL_SetClipboardText(selectedText);
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Runtime.InteropServices;
namespace osu.Framework.Platform.Linux.Sdl
{
public class SdlClipboard : Clipboard
{
private const string lib = "libSDL2-2.0.so.0";
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetClipboardText", ExactSpelling = true)]
internal static extern string SDL_GetClipboardText();
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_SetClipboardText", ExactSpelling = true)]
internal static extern int SDL_SetClipboardText(string text);
public override string GetText()
{
return SDL_GetClipboardText();
}
public override void SetText(string selectedText)
{
SDL_SetClipboardText(selectedText);
}
}
}
|
mit
|
C#
|
c71d2c9b4d57e22cde5707ef8701bfb66f79d2b7
|
upgrade version
|
gerryhigh/ServiceStack.Text,gerryhigh/ServiceStack.Text,mono/ServiceStack.Text,meebey/ServiceStack.Text,NServiceKit/NServiceKit.Text,NServiceKit/NServiceKit.Text,mono/ServiceStack.Text
|
src/ServiceStack.Text/Env.cs
|
src/ServiceStack.Text/Env.cs
|
using System;
namespace ServiceStack.Text
{
public static class Env
{
static Env()
{
var platform = (int)Environment.OSVersion.Platform;
IsUnix = (platform == 4) || (platform == 6) || (platform == 128);
IsMono = Type.GetType("Mono.Runtime") != null;
IsMonoTouch = Type.GetType("MonoTouch.Foundation.NSObject") != null;
SupportsExpressions = SupportsEmit = !IsMonoTouch;
ServerUserAgent = "ServiceStack/" +
ServiceStackVersion + " "
+ Environment.OSVersion.Platform
+ (IsMono ? "/Mono" : "/.NET")
+ (IsMonoTouch ? " MonoTouch" : "");
}
public static decimal ServiceStackVersion = 1.79m;
public static bool IsUnix { get; set; }
public static bool IsMono { get; set; }
public static bool IsMonoTouch { get; set; }
public static bool SupportsExpressions { get; set; }
public static bool SupportsEmit { get; set; }
public static string ServerUserAgent { get; set; }
}
}
|
using System;
namespace ServiceStack.Text
{
public static class Env
{
static Env()
{
var platform = (int)Environment.OSVersion.Platform;
IsUnix = (platform == 4) || (platform == 6) || (platform == 128);
IsMono = Type.GetType("Mono.Runtime") != null;
IsMonoTouch = Type.GetType("MonoTouch.Foundation.NSObject") != null;
SupportsExpressions = SupportsEmit = !IsMonoTouch;
ServerUserAgent = "ServiceStack/" +
ServiceStackVersion + " "
+ Environment.OSVersion.Platform
+ (IsMono ? "/Mono" : "/.NET")
+ (IsMonoTouch ? " MonoTouch" : "");
}
public static decimal ServiceStackVersion = 1.78m;
public static bool IsUnix { get; set; }
public static bool IsMono { get; set; }
public static bool IsMonoTouch { get; set; }
public static bool SupportsExpressions { get; set; }
public static bool SupportsEmit { get; set; }
public static string ServerUserAgent { get; set; }
}
}
|
bsd-3-clause
|
C#
|
314d7ba067fa088e5385c6348925e15fd35cd7e4
|
update for 2.0.6
|
IdentityServer/IdentityServer4.Quickstart.UI,IdentityServer/IdentityServer4.Quickstart.UI,IdentityServer/IdentityServer4.Quickstart.UI,IdentityServer/IdentityServer4.Quickstart.UI
|
Quickstart/Account/LoginViewModel.cs
|
Quickstart/Account/LoginViewModel.cs
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
namespace IdentityServer4.Quickstart.UI
{
public class LoginViewModel : LoginInputModel
{
public bool AllowRememberLogin { get; set; }
public bool EnableLocalLogin { get; set; }
public IEnumerable<ExternalProvider> ExternalProviders { get; set; }
public IEnumerable<ExternalProvider> VisibleExternalProviders => ExternalProviders.Where(x => !String.IsNullOrWhiteSpace(x.DisplayName));
public bool IsExternalLoginOnly => EnableLocalLogin == false && ExternalProviders?.Count() == 1;
public string ExternalLoginScheme => IsExternalLoginOnly ? ExternalProviders?.SingleOrDefault()?.AuthenticationScheme : null;
}
}
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
namespace IdentityServer4.Quickstart.UI
{
public class LoginViewModel : LoginInputModel
{
public bool AllowRememberLogin { get; set; }
public bool EnableLocalLogin { get; set; }
public IEnumerable<ExternalProvider> ExternalProviders { get; set; }
public IEnumerable<ExternalProvider> VisibleExternalProviders => ExternalProviders.Where(x => !String.IsNullOrWhiteSpace(x.DisplayName));
public bool IsExternalLoginOnly => EnableLocalLogin == false && ExternalProviders?.Count() == 1;
public string ExternalLoginScheme => ExternalProviders?.SingleOrDefault()?.AuthenticationScheme;
}
}
|
apache-2.0
|
C#
|
9d2104117b6a8d120c4f8d554e7b002dab0f83e4
|
clean up assemblyinfo
|
pandeysoni/sendgrid-csharp,kenlefeb/sendgrid-csharp,pandeysoni/sendgrid-csharp,sendgrid/sendgrid-csharp,sumeshthomas/sendgrid-csharp,brcaswell/sendgrid-csharp,FriskyLingo/sendgrid-csharp,sendgrid/sendgrid-csharp,brcaswell/sendgrid-csharp,FriskyLingo/sendgrid-csharp,dubrovkinmaxim/sendgrid-csharp,sumeshthomas/sendgrid-csharp,dubrovkinmaxim/sendgrid-csharp,sendgrid/sendgrid-csharp,kenlefeb/sendgrid-csharp
|
SendGrid/SendGridMail/Properties/AssemblyInfo.cs
|
SendGrid/SendGridMail/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("SendGridMail")]
[assembly: AssemblyDescription("A client library for interfacing with the SendGridMessage API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SendGridMessage")]
[assembly: AssemblyProduct("SendGridMail")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("193fa200-8430-4206-aacd-2d2bb2dfa6cf")]
#if (BUILD)
[assembly: InternalsVisibleTo("Tests")]
#elif (DEBUG)
[assembly: InternalsVisibleTo("Tests")]
#else
[assembly: InternalsVisibleTo("Tests," + "" +
"PublicKey=00240000048000009400000006020000002400005253413100040000010001004126bffd5a4461" +
"e915193b2695401cee8d67bb14b252a34e5230e6468582f108aafbe31d39f2059240461d622e86" +
"2a294169d5f2659efe0d68b30d7ceee310356c70b54ece3c8c69bbd9db86e07c34ff4fd5d7528b" +
"3ddf078d272025cb7a588030c78020f5eb91872b38dc2832f561fe184715bb8edb6f0b3b644de5" +
"2bc588ae")]
#endif
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0")]
[assembly: AssemblyFileVersion("4.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("SendGridMail")]
[assembly: AssemblyDescription("A client library for interfacing with the SendGridMessage API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SendGridMessage")]
[assembly: AssemblyProduct("SendGridMail")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("193fa200-8430-4206-aacd-2d2bb2dfa6cf")]
#if (BUILD)
[assembly: InternalsVisibleTo("Tests")]
#endif
#if (DEBUG)
[assembly: InternalsVisibleTo("Tests")]
#endif
#if (RELEASE)
[assembly: InternalsVisibleTo("Tests," + "" +
"PublicKey=00240000048000009400000006020000002400005253413100040000010001004126bffd5a4461" +
"e915193b2695401cee8d67bb14b252a34e5230e6468582f108aafbe31d39f2059240461d622e86" +
"2a294169d5f2659efe0d68b30d7ceee310356c70b54ece3c8c69bbd9db86e07c34ff4fd5d7528b" +
"3ddf078d272025cb7a588030c78020f5eb91872b38dc2832f561fe184715bb8edb6f0b3b644de5" +
"2bc588ae")]
#endif
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0")]
[assembly: AssemblyFileVersion("4.0.0")]
|
mit
|
C#
|
19aae9aebc64c681bd3ae140e82e76baa0701cd0
|
Document a promise to reintroduce the DocumentText get
|
darcywong00/libpalaso,gmartin7/libpalaso,ddaspit/libpalaso,andrew-polk/libpalaso,ermshiperete/libpalaso,chrisvire/libpalaso,darcywong00/libpalaso,glasseyes/libpalaso,mccarthyrb/libpalaso,ermshiperete/libpalaso,andrew-polk/libpalaso,JohnThomson/libpalaso,sillsdev/libpalaso,gmartin7/libpalaso,gtryus/libpalaso,gtryus/libpalaso,JohnThomson/libpalaso,darcywong00/libpalaso,tombogle/libpalaso,hatton/libpalaso,ddaspit/libpalaso,chrisvire/libpalaso,glasseyes/libpalaso,hatton/libpalaso,chrisvire/libpalaso,sillsdev/libpalaso,andrew-polk/libpalaso,gmartin7/libpalaso,gtryus/libpalaso,mccarthyrb/libpalaso,tombogle/libpalaso,gmartin7/libpalaso,sillsdev/libpalaso,ermshiperete/libpalaso,ddaspit/libpalaso,sillsdev/libpalaso,ddaspit/libpalaso,glasseyes/libpalaso,andrew-polk/libpalaso,tombogle/libpalaso,chrisvire/libpalaso,ermshiperete/libpalaso,hatton/libpalaso,mccarthyrb/libpalaso,JohnThomson/libpalaso,mccarthyrb/libpalaso,tombogle/libpalaso,hatton/libpalaso,JohnThomson/libpalaso,glasseyes/libpalaso,gtryus/libpalaso
|
PalasoUIWindowsForms/HtmlBrowser/IWebBrowser.cs
|
PalasoUIWindowsForms/HtmlBrowser/IWebBrowser.cs
|
// Copyright (c) 2014 SIL International
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System;
using System.Windows.Forms;
namespace Palaso.UI.WindowsForms.HtmlBrowser
{
public interface IWebBrowser
{
bool CanGoBack { get; }
bool CanGoForward { get; }
/// <summary>
/// Set of the DocumentText will load the given string content into the browser.
/// If a get for DocumentText proves necessary Jason promises to write the reflective
/// gecko implementation.
/// </summary>
string DocumentText { set; }
string DocumentTitle { get; }
bool Focused { get; }
bool IsBusy { get; }
bool IsWebBrowserContextMenuEnabled { get; set; }
string StatusText { get; }
Uri Url { get; set; }
bool GoBack();
bool GoForward();
void Navigate(string urlString);
void Navigate(Uri url);
void Refresh();
void Refresh(WebBrowserRefreshOption opt);
void Stop();
void ScrollLastElementIntoView();
object NativeBrowser { get; }
}
}
|
// Copyright (c) 2014 SIL International
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System;
using System.Windows.Forms;
namespace Palaso.UI.WindowsForms.HtmlBrowser
{
public interface IWebBrowser
{
bool CanGoBack { get; }
bool CanGoForward { get; }
string DocumentText { set; }
string DocumentTitle { get; }
bool Focused { get; }
bool IsBusy { get; }
bool IsWebBrowserContextMenuEnabled { get; set; }
string StatusText { get; }
Uri Url { get; set; }
bool GoBack();
bool GoForward();
void Navigate(string urlString);
void Navigate(Uri url);
void Refresh();
void Refresh(WebBrowserRefreshOption opt);
void Stop();
void ScrollLastElementIntoView();
object NativeBrowser { get; }
}
}
|
mit
|
C#
|
7f4a7a90218cacb42a6c12bf9da83727dc4c3702
|
Remove unused using statement.
|
fancidev/DosHelp
|
QuickHelp/Serialization/SerializationOptions.cs
|
QuickHelp/Serialization/SerializationOptions.cs
|
using System;
using System.Collections.Generic;
namespace QuickHelp.Serialization
{
/// <summary>
/// Contains options to control the serialization process.
/// </summary>
public class SerializationOptions
{
private readonly List<byte[]> m_keywords = new List<byte[]>();
/// <summary>
/// Gets or sets the serialized format.
/// </summary>
public SerializationFormat Format { get; set; }
/// <summary>
/// Gets or sets the compression level.
/// </summary>
/// <remarks>
/// On serialization, if Format is Automatic or Binary, this value
/// controls the compression level in the serialized .HLP file. If
/// Format is Markup, this value is ignored.
///
/// On deserialization, this value is ignored and updated to the
/// actual compression level used in the input.
/// </remarks>
public CompressionFlags Compression { get; set; }
/// <summary>
/// Gets a list of keywords used for keyword compression.
/// </summary>
/// <remarks>
/// On serialization, if keyword compression is enabled, the
/// serializer uses the dictionary specified by this property if it
/// is not <c>null</c>, or computes the dictionary on the fly and
/// updates this property if it is null.
///
/// On deserialization, the serializaer sets this property to the
/// actual dictionary used in the input.
/// </remarks>
public KeywordCollection Keywords { get; set; }
public HuffmanTree HuffmanTree { get; set; }
}
/// <summary>
/// Specifies the serialized format of a help database.
/// </summary>
public enum SerializationFormat
{
/// <summary>
/// On deserialization, automatically detect the input format. On
/// serialization, use Binary format.
/// </summary>
Automatic = 0,
/// <summary>
/// Specifies the binary format (with .HLP extension).
/// </summary>
Binary = 1,
/// <summary>
/// Specifies the markup format (with .SRC extension).
/// </summary>
Markup = 2,
}
[Flags]
public enum CompressionFlags
{
None = 0,
RunLength = 1,
Keyword = 2,
ExtendedKeyword = 4,
Huffman = 8,
All = RunLength | Keyword | ExtendedKeyword | Huffman
}
// no more than 1024 (or 23?) entries
public class KeywordCollection : List<byte[]>
{
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace QuickHelp.Serialization
{
/// <summary>
/// Contains options to control the serialization process.
/// </summary>
public class SerializationOptions
{
private readonly List<byte[]> m_keywords = new List<byte[]>();
/// <summary>
/// Gets or sets the serialized format.
/// </summary>
public SerializationFormat Format { get; set; }
/// <summary>
/// Gets or sets the compression level.
/// </summary>
/// <remarks>
/// On serialization, if Format is Automatic or Binary, this value
/// controls the compression level in the serialized .HLP file. If
/// Format is Markup, this value is ignored.
///
/// On deserialization, this value is ignored and updated to the
/// actual compression level used in the input.
/// </remarks>
public CompressionFlags Compression { get; set; }
/// <summary>
/// Gets a list of keywords used for keyword compression.
/// </summary>
/// <remarks>
/// On serialization, if keyword compression is enabled, the
/// serializer uses the dictionary specified by this property if it
/// is not <c>null</c>, or computes the dictionary on the fly and
/// updates this property if it is null.
///
/// On deserialization, the serializaer sets this property to the
/// actual dictionary used in the input.
/// </remarks>
public KeywordCollection Keywords { get; set; }
public HuffmanTree HuffmanTree { get; set; }
}
/// <summary>
/// Specifies the serialized format of a help database.
/// </summary>
public enum SerializationFormat
{
/// <summary>
/// On deserialization, automatically detect the input format. On
/// serialization, use Binary format.
/// </summary>
Automatic = 0,
/// <summary>
/// Specifies the binary format (with .HLP extension).
/// </summary>
Binary = 1,
/// <summary>
/// Specifies the markup format (with .SRC extension).
/// </summary>
Markup = 2,
}
[Flags]
public enum CompressionFlags
{
None = 0,
RunLength = 1,
Keyword = 2,
ExtendedKeyword = 4,
Huffman = 8,
All = RunLength | Keyword | ExtendedKeyword | Huffman
}
// no more than 1024 (or 23?) entries
public class KeywordCollection : List<byte[]>
{
}
}
|
apache-2.0
|
C#
|
6d943f400194e7091da322419ceb9b1a47a17ea3
|
simplify splat test
|
Fody/FodyAddinSamples,bcuff/FodyAddinSamples,Fody/FodyAddinSamples
|
AnotarSplatSample/SplatExceptionSample.cs
|
AnotarSplatSample/SplatExceptionSample.cs
|
using System;
using Anotar.Splat;
using NUnit.Framework;
[TestFixture]
public class SplatExceptionSample
{
[Test]
public void Run()
{
try
{
MyMethod();
}
catch
{
}
var lastMessage = LogCaptureBuilder.LastMessage.Replace(Environment.NewLine, "");
Assert.AreEqual(@"SplatExceptionSample: Exception occurred in 'Void MyMethod()'. : System.Exception: Foo at SplatExceptionSample.MyMethod()", lastMessage.Substring(0, lastMessage.LastIndexOf(" in ")));
}
[LogToDebugOnException]
static void MyMethod()
{
throw new Exception("Foo");
}
}
|
using System;
using Anotar.Splat;
using NUnit.Framework;
[TestFixture]
public class SplatExceptionSample
{
[Test]
public void Run()
{
try
{
MyMethod();
}
catch
{
}
var lastMessage = LogCaptureBuilder.LastMessage.Replace(Environment.NewLine, "");
Assert.AreEqual(@"SplatExceptionSample: Exception occurred in 'Void MyMethod()'. : System.Exception: Foo at SplatExceptionSample.MyMethod()", lastMessage.Substring(0, lastMessage.LastIndexOf(" in ")));
Assert.IsTrue(lastMessage.EndsWith(@"FodyAddinSamples\AnotarSplatSample\SplatExceptionSample.cs:line 27"));
}
[LogToDebugOnException]
static void MyMethod()
{
throw new Exception("Foo");
}
}
|
mit
|
C#
|
a85b8308001111dfd6e0c5bb5b225829072d948d
|
Update code comment
|
madsbangh/EasyButtons
|
Assets/EasyButtons/Editor/ButtonEditor.cs
|
Assets/EasyButtons/Editor/ButtonEditor.cs
|
using System.Linq;
using UnityEngine;
using UnityEditor;
/// <summary>
/// Editor that adds Easy Buttons to all MonoBehaviour derived classes.
/// </summary>
namespace EasyButtons
{
// Custom inspector for MonoBehaviour including derived classes
[CustomEditor(typeof(MonoBehaviour), true)]
public class ButtonEditor : Editor
{
public override void OnInspectorGUI()
{
// Loop through all methods with the Button attribute and no arguments
foreach (var method in target.GetType().GetMethods()
.Where(m => m.GetCustomAttributes(typeof(ButtonAttribute), true).Length > 0)
.Where(m => m.GetParameters().Length == 0))
{
// Draw a button which invokes the method
if (GUILayout.Button(method.Name))
{
method.Invoke(target, new object[0]);
}
}
// Draw the rest of the inspector as usual
DrawDefaultInspector();
}
}
}
|
using System.Linq;
using UnityEngine;
using UnityEditor;
/// <summary>
/// Editor that adds Easy Buttons to all MonoBehaviour derived classes.
/// </summary>
namespace EasyButtons
{
// Custom inspector for MonoBehaviour including derived classes
[CustomEditor(typeof(MonoBehaviour), true)]
public class ButtonEditor : Editor
{
public override void OnInspectorGUI()
{
// Loop through all methods with the Button attribute and no arguments
foreach (var method in target.GetType().GetMethods()
.Where(m => m.GetCustomAttributes(typeof(ButtonAttribute), true).Length > 0)
.Where(m => m.GetParameters().Length == 0))
{
// Draws a button which invokes the method
if (GUILayout.Button(method.Name))
{
method.Invoke(target, new object[0]);
}
}
// Draw the rest of the inspector as usual
DrawDefaultInspector();
}
}
}
|
mit
|
C#
|
93898efd37c64983097cdfc639360590b7d69523
|
remove unnecessary calls to disable client state
|
RealRui/SimpleScene,smoothdeveloper/SimpleScene,jeske/SimpleScene,Namone/SimpleScene
|
SimpleScene/Meshes/SSVertexBuffer.cs
|
SimpleScene/Meshes/SSVertexBuffer.cs
|
using System;
using OpenTK;
using OpenTK.Graphics.OpenGL;
namespace SimpleScene
{
public interface ISSVertexLayout {
int sizeOf();
void bindGLAttributes(SSShaderProgram shader);
}
// http://www.opentk.com/doc/graphics/geometry/vertex-buffer-objects
public class SSVertexBuffer<VB> where VB : struct, ISSVertexLayout {
VB[] vb;
int VBOid;
public unsafe SSVertexBuffer (VB[] vertexBufferArray) {
vb = vertexBufferArray;
VBOid = GL.GenBuffer ();
try {
GL.BindBuffer (BufferTarget.ArrayBuffer, VBOid);
GL.BufferData (BufferTarget.ArrayBuffer, (IntPtr) (vertexBufferArray.Length * vertexBufferArray[0].sizeOf()), vertexBufferArray, BufferUsageHint.StaticDraw);
} finally {
GL.BindBuffer (BufferTarget.ArrayBuffer, 0);
}
}
public void Delete() {
GL.DeleteBuffer (VBOid);
VBOid = 0;
}
public void bind(SSShaderProgram shaderPgm) {
if (shaderPgm != null) {
GL.UseProgram (shaderPgm.ProgramID);
} else {
GL.UseProgram (0);
}
GL.BindBuffer (BufferTarget.ArrayBuffer, VBOid);
vb [0].bindGLAttributes (shaderPgm);
}
public void unbind() {
GL.BindBuffer (BufferTarget.ArrayBuffer, 0);
//GL.DisableClientState (EnableCap.VertexArray);
//GL.DisableClientState (EnableCap.NormalArray);
//GL.DisableClientState (EnableCap.TextureCoordArray);
}
}
}
|
using System;
using OpenTK;
using OpenTK.Graphics.OpenGL;
namespace SimpleScene
{
public interface ISSVertexLayout {
int sizeOf();
void bindGLAttributes(SSShaderProgram shader);
}
// http://www.opentk.com/doc/graphics/geometry/vertex-buffer-objects
public class SSVertexBuffer<VB> where VB : struct, ISSVertexLayout {
VB[] vb;
int VBOid;
public unsafe SSVertexBuffer (VB[] vertexBufferArray) {
vb = vertexBufferArray;
VBOid = GL.GenBuffer ();
try {
GL.BindBuffer (BufferTarget.ArrayBuffer, VBOid);
GL.BufferData (BufferTarget.ArrayBuffer, (IntPtr) (vertexBufferArray.Length * vertexBufferArray[0].sizeOf()), vertexBufferArray, BufferUsageHint.StaticDraw);
} finally {
GL.BindBuffer (BufferTarget.ArrayBuffer, 0);
}
}
public void Delete() {
GL.DeleteBuffer (VBOid);
VBOid = 0;
}
public void bind(SSShaderProgram shaderPgm) {
if (shaderPgm != null) {
GL.UseProgram (shaderPgm.ProgramID);
} else {
GL.UseProgram (0);
}
GL.BindBuffer (BufferTarget.ArrayBuffer, VBOid);
vb [0].bindGLAttributes (shaderPgm);
}
public void unbind() {
GL.BindBuffer (BufferTarget.ArrayBuffer, 0);
GL.DisableClientState (EnableCap.VertexArray);
GL.DisableClientState (EnableCap.NormalArray);
GL.DisableClientState (EnableCap.TextureCoordArray);
}
}
}
|
apache-2.0
|
C#
|
70ef7a1fbcca2b883c42a97425d6de3a9ed74f19
|
Remove unused namespaces.
|
jrmitch120/OctgnImageDb
|
OctgnImageDb/Setup/Init.DependencyInjection.cs
|
OctgnImageDb/Setup/Init.DependencyInjection.cs
|
using Ninject;
using OctgnImageDb.Imaging;
using OctgnImageDb.Imaging.Doomtown;
using OctgnImageDb.Imaging.Netrunner;
using OctgnImageDb.Imaging.Starwars;
namespace OctgnImageDb.Setup
{
public partial class Init
{
public static IKernel Container()
{
var kernel = new StandardKernel();
kernel.Bind<IImageProvider>().To<NetrunnerDbImages>();
kernel.Bind<IImageProvider>().To<DoomtownDbImages>();
kernel.Bind<IImageProvider>().To<TopTierDbImages>();
return kernel;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ninject;
using OctgnImageDb.Imaging;
using OctgnImageDb.Imaging.Doomtown;
using OctgnImageDb.Imaging.Netrunner;
using OctgnImageDb.Imaging.Starwars;
namespace OctgnImageDb.Setup
{
public partial class Init
{
public static IKernel Container()
{
var kernel = new StandardKernel();
kernel.Bind<IImageProvider>().To<NetrunnerDbImages>();
kernel.Bind<IImageProvider>().To<DoomtownDbImages>();
kernel.Bind<IImageProvider>().To<TopTierDbImages>();
return kernel;
}
}
}
|
mit
|
C#
|
ecde633ab079e5de7328617cd6d28a5d25f60ef1
|
Bump version to 0.1.1
|
queueRAM/Texture64
|
Texture64/Properties/AssemblyInfo.cs
|
Texture64/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("Texture64")]
[assembly: AssemblyDescription("N64 Texture Ripper and Editor")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Texture64")]
[assembly: AssemblyCopyright("© queueRAM 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ccbc2161-5025-4e1e-b5f4-cc12e81c6439")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.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("Texture64")]
[assembly: AssemblyDescription("N64 Texture Ripper and Editor")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Texture64")]
[assembly: AssemblyCopyright("© queueRAM 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ccbc2161-5025-4e1e-b5f4-cc12e81c6439")]
// 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.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
mit
|
C#
|
55f0487bb8c6981c71392841d225c0ccb4701753
|
Update annotations for types implementing IDynamicTypeSymbol
|
CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,genlu/roslyn,aelij/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,eriawan/roslyn,dotnet/roslyn,AlekseyTs/roslyn,sharwell/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,jmarolf/roslyn,gafter/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,agocke/roslyn,ErikSchierboom/roslyn,KevinRansom/roslyn,tannergooding/roslyn,reaction1989/roslyn,panopticoncentral/roslyn,mgoertz-msft/roslyn,gafter/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,AmadeusW/roslyn,tannergooding/roslyn,gafter/roslyn,KevinRansom/roslyn,tmat/roslyn,AlekseyTs/roslyn,CyrusNajmabadi/roslyn,AmadeusW/roslyn,jmarolf/roslyn,mavasani/roslyn,agocke/roslyn,sharwell/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,KirillOsenkov/roslyn,diryboy/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,physhi/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,heejaechang/roslyn,davkean/roslyn,eriawan/roslyn,mgoertz-msft/roslyn,diryboy/roslyn,dotnet/roslyn,physhi/roslyn,weltkante/roslyn,stephentoub/roslyn,tmat/roslyn,stephentoub/roslyn,tannergooding/roslyn,bartdesmet/roslyn,heejaechang/roslyn,wvdd007/roslyn,abock/roslyn,brettfo/roslyn,dotnet/roslyn,reaction1989/roslyn,KirillOsenkov/roslyn,physhi/roslyn,panopticoncentral/roslyn,agocke/roslyn,brettfo/roslyn,mgoertz-msft/roslyn,aelij/roslyn,davkean/roslyn,tmat/roslyn,abock/roslyn,mavasani/roslyn,eriawan/roslyn,KirillOsenkov/roslyn,aelij/roslyn,stephentoub/roslyn,heejaechang/roslyn,jmarolf/roslyn,panopticoncentral/roslyn,ErikSchierboom/roslyn,abock/roslyn,davkean/roslyn,genlu/roslyn,reaction1989/roslyn,mavasani/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,brettfo/roslyn
|
src/Compilers/CSharp/Portable/Symbols/PublicModel/DynamicTypeSymbol.cs
|
src/Compilers/CSharp/Portable/Symbols/PublicModel/DynamicTypeSymbol.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.
#nullable enable
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel
{
internal sealed class DynamicTypeSymbol : TypeSymbol, IDynamicTypeSymbol
{
private readonly Symbols.DynamicTypeSymbol _underlying;
public DynamicTypeSymbol(Symbols.DynamicTypeSymbol underlying, CodeAnalysis.NullableAnnotation nullableAnnotation)
: base(nullableAnnotation)
{
Debug.Assert(underlying is object);
_underlying = underlying;
}
protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
{
Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation);
Debug.Assert(nullableAnnotation != this.NullableAnnotation);
return new DynamicTypeSymbol(_underlying, nullableAnnotation);
}
internal override CSharp.Symbol UnderlyingSymbol => _underlying;
internal override Symbols.TypeSymbol UnderlyingTypeSymbol => _underlying;
internal override Symbols.NamespaceOrTypeSymbol UnderlyingNamespaceOrTypeSymbol => _underlying;
#region ISymbol Members
protected override void Accept(SymbolVisitor visitor)
{
visitor.VisitDynamicType(this);
}
[return: MaybeNull]
protected override TResult Accept<TResult>(SymbolVisitor<TResult> visitor)
{
return visitor.VisitDynamicType(this);
}
#endregion
}
}
|
// 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.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel
{
internal sealed class DynamicTypeSymbol : TypeSymbol, IDynamicTypeSymbol
{
private readonly Symbols.DynamicTypeSymbol _underlying;
public DynamicTypeSymbol(Symbols.DynamicTypeSymbol underlying, CodeAnalysis.NullableAnnotation nullableAnnotation)
: base(nullableAnnotation)
{
Debug.Assert(underlying is object);
_underlying = underlying;
}
protected override ITypeSymbol WithNullableAnnotation(CodeAnalysis.NullableAnnotation nullableAnnotation)
{
Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation);
Debug.Assert(nullableAnnotation != this.NullableAnnotation);
return new DynamicTypeSymbol(_underlying, nullableAnnotation);
}
internal override CSharp.Symbol UnderlyingSymbol => _underlying;
internal override Symbols.TypeSymbol UnderlyingTypeSymbol => _underlying;
internal override Symbols.NamespaceOrTypeSymbol UnderlyingNamespaceOrTypeSymbol => _underlying;
#region ISymbol Members
protected override void Accept(SymbolVisitor visitor)
{
visitor.VisitDynamicType(this);
}
protected override TResult Accept<TResult>(SymbolVisitor<TResult> visitor)
{
return visitor.VisitDynamicType(this);
}
#endregion
}
}
|
mit
|
C#
|
e88d5d10fabf43cf61ba2f5c9e7d0df9b4e90fd8
|
Update VacancyLive.cshtml
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/VacancyLive.cshtml
|
src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/VacancyLive.cshtml
|
@model SFA.DAS.EmployerAccounts.Web.ViewModels.VacancyViewModel
@{
var applicationsTextSuffix = !Model.NoOfApplications.GetValueOrDefault().Equals(0) ? (Model.NoOfApplications.Value.Equals(1) ? "application" : "applications") : "";
var applicationsTextPrefix = !Model.NoOfApplications.GetValueOrDefault().Equals(0) ? "View " : "";
}
<section class="dashboard-section">
<h2 class="section-heading heading-large">
Your apprenticeship advert
</h2>
<p>You've created an advert for your apprenticeship.</p>
<table class="responsive">
<tr>
<th scope="row" class="tw-35">
Title
</th>
<td class="tw-65">
@(Model?.Title)
</td>
</tr>
<tr>
<th scope="row" class="tw-35">
Closing date
</th>
<td class="tw-65">
@(Model.ClosingDateText)
</td>
</tr>
<tr>
<th scope="row" class="tw-35">
Applications
</th>
<td class="tw-65">
<a href="@Model.ManageVacancyUrl" class="govuk-link">@applicationsTextPrefix @(!Model.NoOfApplications.GetValueOrDefault().Equals(0) ? $"{Model.NoOfApplications.Value}" : "No applications yet") @applicationsTextSuffix</a>
</td>
</tr>
<tr>
<th scope="row">
Status
</th>
<td>
<strong class="govuk-tag govuk-tag--active">LIVE</strong>
</td>
</tr>
</table>
<p>
<a href="@Url.EmployerCommitmentsV2Action("unapproved/inform")" role="button" draggable="false" class="button">
Add apprentice details
</a>
</p>
</section>
|
@model SFA.DAS.EmployerAccounts.Web.ViewModels.VacancyViewModel
@{
var applicationsTextSuffix = !Model.NoOfApplications.GetValueOrDefault().Equals(0) ? (Model.NoOfApplications.Value.Equals(1) ? "application" : "applications") : "";
var applicationsTextPrefix = !Model.NoOfApplications.GetValueOrDefault().Equals(0) ? "View " : "";
}
<section class="dashboard-section">
<h2 class="section-heading heading-large">
Your apprenticeship advert
</h2>
<p>You've created an advert for your apprenticeship.</p>
<table class="responsive">
<tr>
<th scope="row" class="tw-35">
Title
</th>
<td class="tw-65">
@(Model?.Title)
</td>
</tr>
<tr>
<th scope="row" class="tw-35">
Closing date
</th>
<td class="tw-65">
@(Model.ClosingDateText)
</td>
</tr>
<tr>
<th scope="row" class="tw-35">
Applications
</th>
<td class="tw-65">
<a href="@Model.ManageVacancyUrl" class="govuk-link">@applicationsTextPrefix @(!Model.NoOfApplications.GetValueOrDefault().Equals(0) ? $"{Model.NoOfApplications.Value}" : "No applications yet") @applicationsTextSuffix</a>
</td>
</tr>
<tr>
<th scope="row">
Status
</th>
<td>
<strong class="govuk-tag govuk-tag--active">LIVE</strong>
</td>
</tr>
</table>
<p>
<a href="@Url.EmployerCommitmentsAction("apprentices/inform")" role="button" draggable="false" class="button">
Add apprentice details
</a>
</p>
</section>
|
mit
|
C#
|
b21e25b39528b4369ede8725d65c91d17197bc52
|
Make DayTemplate.DayOfWeek read-only.
|
jakubfijalkowski/studentscalendar
|
StudentsCalendar.Core/Templates/DayTemplate.cs
|
StudentsCalendar.Core/Templates/DayTemplate.cs
|
using System.Collections.Generic;
using NodaTime;
namespace StudentsCalendar.Core.Templates
{
/// <summary>
/// Szablon dzienny.
/// </summary>
public sealed class DayTemplate
{
private readonly IsoDayOfWeek _DayOfWeek;
/// <summary>
/// Pobiera dzień tygodnia, który dany szablon opisuje.
/// </summary>
public IsoDayOfWeek DayOfWeek
{
get { return this._DayOfWeek; }
}
/// <summary>
/// Pobiera lub zmienia listę zajęć danego dnia.
/// </summary>
public IList<ClassesTemplate> Classes { get; set; }
/// <summary>
/// Pobiera lub zmienia notatki.
/// </summary>
public string Notes { get; set; }
/// <summary>
/// Inicjalizuje szablon dzienny na konkretny dzień tygodnia.
/// </summary>
/// <param name="dayOfWeek"></param>
public DayTemplate(IsoDayOfWeek dayOfWeek)
{
this._DayOfWeek = dayOfWeek;
}
}
}
|
using System.Collections.Generic;
using NodaTime;
namespace StudentsCalendar.Core.Templates
{
/// <summary>
/// Szablon dzienny.
/// </summary>
public sealed class DayTemplate
{
private IsoDayOfWeek _DayOfWeek;
/// <summary>
/// Pobiera dzień tygodnia, który dany szablon opisuje.
/// </summary>
public IsoDayOfWeek DayOfWeek
{
get { return this._DayOfWeek; }
set { this._DayOfWeek = value; }
}
/// <summary>
/// Pobiera lub zmienia listę zajęć danego dnia.
/// </summary>
public IList<ClassesTemplate> Classes { get; set; }
/// <summary>
/// Pobiera lub zmienia notatki.
/// </summary>
public string Notes { get; set; }
/// <summary>
/// Inicjalizuje szablon dzienny na konkretny dzień tygodnia.
/// </summary>
/// <param name="dayOfWeek"></param>
public DayTemplate(IsoDayOfWeek dayOfWeek)
{
this._DayOfWeek = dayOfWeek;
}
}
}
|
mit
|
C#
|
85b413c519267c75c130cecee2a5175a52bf0070
|
Test coverage for viewing a simple type member conversion in a mapping plan
|
agileobjects/AgileMapper
|
AgileMapper.UnitTests/WhenViewingMappingPlans.cs
|
AgileMapper.UnitTests/WhenViewingMappingPlans.cs
|
namespace AgileObjects.AgileMapper.UnitTests
{
using System;
using System.Collections.Generic;
using Shouldly;
using TestClasses;
using Xunit;
public class WhenViewingMappingPlans
{
[Fact]
public void ShouldIncludeASimpleTypeMemberMapping()
{
var plan = Mapper
.GetPlanFor<PublicField<string>>()
.ToANew<PublicProperty<string>>();
plan.ShouldContain("instance.Value = omc.Source.Value;");
}
[Fact]
public void ShouldIncludeAComplexTypeMemberMapping()
{
var plan = Mapper
.GetPlanFor<PersonViewModel>()
.ToANew<Person>();
plan.ShouldContain("instance.Name = omc.Source.Name;");
plan.ShouldContain("instance.Line1 = omc.Source.AddressLine1;");
}
[Fact]
public void ShouldIncludeASimpleTypeEnumerableMemberMapping()
{
var plan = Mapper
.GetPlanFor<PublicProperty<int[]>>()
.ToANew<PublicField<IEnumerable<int>>>();
plan.ShouldContain("omc.Source.ForEach");
plan.ShouldContain("instance.Add");
}
[Fact]
public void ShouldIncludeASimpleTypeMemberConversion()
{
var plan = Mapper
.GetPlanFor<PublicProperty<Guid>>()
.ToANew<PublicField<string>>();
plan.ShouldContain("omc.Source.Value.ToString(");
}
}
}
|
namespace AgileObjects.AgileMapper.UnitTests
{
using System.Collections.Generic;
using Shouldly;
using TestClasses;
using Xunit;
public class WhenViewingMappingPlans
{
[Fact]
public void ShouldIncludeASimpleTypeMemberMapping()
{
var plan = Mapper
.GetPlanFor<PublicField<string>>()
.ToANew<PublicProperty<string>>();
plan.ShouldContain("instance.Value = omc.Source.Value;");
}
[Fact]
public void ShouldIncludeAComplexTypeMemberMapping()
{
var plan = Mapper
.GetPlanFor<PersonViewModel>()
.ToANew<Person>();
plan.ShouldContain("instance.Name = omc.Source.Name;");
plan.ShouldContain("instance.Line1 = omc.Source.AddressLine1;");
}
[Fact]
public void ShouldIncludeASimpleTypeEnumerableMemberMapping()
{
var plan = Mapper
.GetPlanFor<PublicProperty<int[]>>()
.ToANew<PublicField<IEnumerable<int>>>();
plan.ShouldContain("omc.Source.ForEach");
plan.ShouldContain("instance.Add");
}
}
}
|
mit
|
C#
|
30967e9db7599e03feaa4c1740e390beab46891f
|
Add support for quote-enclosed values w/o spacing (POSIX)
|
LouisTakePILLz/ArgumentParser
|
ArgumentParser/Patterns/POSIXParameterPattern.cs
|
ArgumentParser/Patterns/POSIXParameterPattern.cs
|
//-----------------------------------------------------------------------
// <copyright file="POSIXParameterPattern.cs" company="LouisTakePILLz">
// Copyright © 2015 LouisTakePILLz
// <author>LouisTakePILLz</author>
// </copyright>
//-----------------------------------------------------------------------
/*
* 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;
namespace ArgumentParser
{
public static partial class Parser
{
#if DEBUG
private const String POSIX_PARAMETER_PATTERN = @"
(?<=^|\s)
(
(?<prefix>--)
(?<tag>(?!-)[\w\-]+(?<!\-))|
(?<prefix>-)
(?<tag>[\w-[\d]])+
)
(
\s*
(?<value>
(
("" (?> \\. | [^""])* "")|
(' (?> \\. | [^'])* ')
)+
)|
\s+
(?<value>
( \\.-? | [^\-] | (?<!\s) \-+ | \-+ (?=\d|[^\-\w]|$) )+
)
)?
(?=\s|$)";
#else
private const String POSIX_PARAMETER_PATTERN = @"(?<=^|\s)((?<prefix>--)(?<tag>(?!-)[\w\-]+(?<!\-))|(?<prefix>-)(?<tag>[\w-[\d]])+)(\s*(?<value>((""(?>\\.|[^""])*"")|('(?>\\.|[^'])*'))+)|\s+(?<value>(\\.-?|[^\-]|(?<!\s)\-+|\-+(?=\d|[^\-\w]|$))+))?(?=\s|$)";
#endif
}
}
|
//-----------------------------------------------------------------------
// <copyright file="POSIXParameterPattern.cs" company="LouisTakePILLz">
// Copyright © 2015 LouisTakePILLz
// <author>LouisTakePILLz</author>
// </copyright>
//-----------------------------------------------------------------------
/*
* 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;
namespace ArgumentParser
{
public static partial class Parser
{
#if DEBUG
private const String POSIX_PARAMETERS_PATTERN = @"
(?<=^|\s)
(
(?<prefix>--)
(?<tag>(?!-)\w+)|
(?<prefix>-)
(?<tag>[\w-[\d]])+
)
(
\s+
(?<value>
(
("" (?> \\. | [^""])* "")|
(' (?> \\. | [^'])* ')|
( \\.-?| [^\-""'] | (?<!\s) \-+ | \-+ (?=\d|[^\-\w\""]|$) )+
)+
)
)?
(?=\s|$)";
#else
private const String POSIX_PARAMETER_PATTERN = @"(?<=^|\s)((?<prefix>--)(?<tag>(?!-)\w+)|(?<prefix>-)(?<tag>[\w-[\d]])+)(\s+(?<value>((""(?>\\.|[^""])*"")|('(?>\\.|[^'])*')|(\\.-?|[^\-""']|(?<!\s)\-+|\-+(?=\d|[^\-\w\""]|$))+)+))?(?=\s|$)";
#endif
}
}
|
apache-2.0
|
C#
|
33cb99ac5da96a0c4bc1502812de95bbee05f85b
|
Remove unused using
|
jamesology/AzureVmFarmer,jamesology/AzureVmFarmer
|
AzureVmFarmer/AzureVmFarmer.Worker/WorkerRole.cs
|
AzureVmFarmer/AzureVmFarmer.Worker/WorkerRole.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using System.Threading;
using AzureVmFarmer.Core.Messengers;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using StructureMap;
namespace AzureVmFarmer.Worker
{
public class WorkerRole : RoleEntryPoint
{
// QueueClient is thread-safe. Recommended that you cache
// rather than recreating it on every request
private QueueClient _client;
private readonly ManualResetEvent _completedEvent = new ManualResetEvent(false);
private IMessageHandler _handler;
public override void Run()
{
ICollection<Exception> errorCollection = new List<Exception>();
Trace.WriteLine("Starting processing of messages");
// Initiates the message pump and callback is invoked for each message that is received, calling close on the client will stop the pump.
_client.OnMessage((receivedMessage) =>
{
try
{
_handler.HandleMessage(receivedMessage);
//TODO: make this all async and ack the message
}
catch(Exception ex)
{
errorCollection.Add(ex);
}
});
_completedEvent.WaitOne();
}
public override bool OnStart()
{
StructureMapConfig.Bootstrap();
_handler = ObjectFactory.GetInstance<IMessageHandler>();
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
// Create the queue if it does not exist already
var connectionString = CloudConfigurationManager.GetSetting("ServiceBus.ConnectionString");
var queueName = CloudConfigurationManager.GetSetting("QueueName");
var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
if (!namespaceManager.QueueExists(queueName))
{
namespaceManager.CreateQueue(queueName);
}
// Initialize the connection to Service Bus Queue
_client = QueueClient.CreateFromConnectionString(connectionString, queueName);
return base.OnStart();
}
public override void OnStop()
{
// Close the connection to Service Bus Queue
_client.Close();
_completedEvent.Set();
base.OnStop();
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using System.Threading;
using AzureVmFarmer.Core.Messengers;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using StructureMap;
using StructureMap.Diagnostics;
namespace AzureVmFarmer.Worker
{
public class WorkerRole : RoleEntryPoint
{
// QueueClient is thread-safe. Recommended that you cache
// rather than recreating it on every request
private QueueClient _client;
private readonly ManualResetEvent _completedEvent = new ManualResetEvent(false);
private IMessageHandler _handler;
public override void Run()
{
ICollection<Exception> errorCollection = new List<Exception>();
Trace.WriteLine("Starting processing of messages");
// Initiates the message pump and callback is invoked for each message that is received, calling close on the client will stop the pump.
_client.OnMessage((receivedMessage) =>
{
try
{
_handler.HandleMessage(receivedMessage);
//TODO: make this all async and ack the message
}
catch(Exception ex)
{
errorCollection.Add(ex);
}
});
_completedEvent.WaitOne();
}
public override bool OnStart()
{
StructureMapConfig.Bootstrap();
_handler = ObjectFactory.GetInstance<IMessageHandler>();
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
// Create the queue if it does not exist already
var connectionString = CloudConfigurationManager.GetSetting("ServiceBus.ConnectionString");
var queueName = CloudConfigurationManager.GetSetting("QueueName");
var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
if (!namespaceManager.QueueExists(queueName))
{
namespaceManager.CreateQueue(queueName);
}
// Initialize the connection to Service Bus Queue
_client = QueueClient.CreateFromConnectionString(connectionString, queueName);
return base.OnStart();
}
public override void OnStop()
{
// Close the connection to Service Bus Queue
_client.Close();
_completedEvent.Set();
base.OnStop();
}
}
}
|
mit
|
C#
|
0f07476962e4b643323d5884e2d8c8440203e83d
|
Load the selected supervisor
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
Battery-Commander.Web/Queries/GetSUTARequests.cs
|
Battery-Commander.Web/Queries/GetSUTARequests.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BatteryCommander.Web.Models;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace BatteryCommander.Web.Queries
{
public class GetSUTARequests : IRequest<IEnumerable<SUTA>>
{
[FromRoute]
public int Unit { get; set; }
// Search by Soldier, Status, Dates
private class Handler : IRequestHandler<GetSUTARequests, IEnumerable<SUTA>>
{
private readonly Database db;
public Handler(Database db)
{
this.db = db;
}
public async Task<IEnumerable<SUTA>> Handle(GetSUTARequests request, CancellationToken cancellationToken)
{
return
await AsQueryable(db)
.Where(suta => suta.Soldier.UnitId == request.Unit)
.ToListAsync(cancellationToken);
}
}
public static IQueryable<SUTA> AsQueryable(Database db)
{
return
db
.SUTAs
.Include(suta => suta.Soldier)
.ThenInclude(soldier => soldier.Unit)
.Include(suta => suta.Supervisor)
.Include(suta => suta.Events);
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BatteryCommander.Web.Models;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace BatteryCommander.Web.Queries
{
public class GetSUTARequests : IRequest<IEnumerable<SUTA>>
{
[FromRoute]
public int Unit { get; set; }
// Search by Soldier, Status, Dates
private class Handler : IRequestHandler<GetSUTARequests, IEnumerable<SUTA>>
{
private readonly Database db;
public Handler(Database db)
{
this.db = db;
}
public async Task<IEnumerable<SUTA>> Handle(GetSUTARequests request, CancellationToken cancellationToken)
{
return
await AsQueryable(db)
.Where(suta => suta.Soldier.UnitId == request.Unit)
.ToListAsync(cancellationToken);
}
}
public static IQueryable<SUTA> AsQueryable(Database db)
{
return
db
.SUTAs
.Include(suta => suta.Soldier)
.ThenInclude(soldier => soldier.Unit)
.Include(suta => suta.Soldier)
.ThenInclude(soldier => soldier.Supervisor)
.Include(suta => suta.Events);
}
}
}
|
mit
|
C#
|
edde7e95afa4369836a954f30b9fcaa9ee3b7d4a
|
Update AssemblyInfo.cs
|
stilldesign/AppTracking
|
AppTracking/Properties/AssemblyInfo.cs
|
AppTracking/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("AppTracking")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("AppTracking")]
[assembly: AssemblyCopyright("Copyright © StillDesign 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//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("0.1.*")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AppTracking")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("AppTracking")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
88aea3d6e55a4d3cd468c71e8522ac1d55f9fbee
|
Refactor to make steps of protocol clearer
|
0culus/ElectronicCash
|
BitCommitment/BitCommitmentProvider.cs
|
BitCommitment/BitCommitmentProvider.cs
|
using System;
namespace BitCommitment
{
/// <summary>
/// A class to perform bit commitment. It does not care what the input is; it's just a
/// facility for exchanging bit commitment messages. Based on Bruce Schneier's RandBytes1-way
/// function method for committing bits
/// </summary>
public class BitCommitmentProvider
{
public byte[] AliceRandBytes1 { get; set; }
public byte[] AliceRandBytes2 { get; set; }
public byte[] AliceBytesToCommitBytesToCommit { get; set; }
public BitCommitmentProvider(byte[] randBytes1,
byte[] randBytes2,
byte[] bytesToCommit)
{
AliceRandBytes1 = randBytes1;
AliceRandBytes2 = randBytes2;
AliceBytesToCommitBytesToCommit = bytesToCommit;
}
public byte[] BitCommitMessage()
{
throw new NotImplementedException();
}
}
}
|
using System;
namespace BitCommitment
{
/// <summary>
/// A class to perform bit commitment. It does not care what the input is; it's just a
/// facility for exchanging bit commitment messages. Based on Bruce Schneier's one-way
/// function method for committing bits
/// </summary>
public class BitCommitmentProvider
{
public byte[] AliceRandBytes1 { get; set; }
public byte[] AliceRandBytes2 { get; set; }
public byte[] AliceMessageBytesBytes { get; set; }
public BitCommitmentProvider(byte[] one, byte[] two, byte[] messageBytes)
{
AliceRandBytes1 = one;
AliceRandBytes2 = two;
AliceMessageBytesBytes = messageBytes;
}
public byte[] BitCommitMessage()
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
e8fb6859789491e76e2fd8abf0a1e0fde7d4ee66
|
Implement IParser on method syntax builder.
|
fffej/BobTheBuilder,alastairs/BobTheBuilder
|
BobTheBuilder/Syntax/DynamicBuilder.cs
|
BobTheBuilder/Syntax/DynamicBuilder.cs
|
using System.Dynamic;
using BobTheBuilder.ArgumentStore;
namespace BobTheBuilder.Syntax
{
public class DynamicBuilder<T> : DynamicBuilderBase<T>, IParser where T: class
{
public DynamicBuilder(IArgumentStore argumentStore) : base(argumentStore) { }
public override bool InvokeBuilderMethod(InvokeMemberBinder binder, object[] args, out object result)
{
Parse(binder, args);
result = this;
return true;
}
public bool Parse(InvokeMemberBinder binder, object[] args)
{
var memberName = binder.Name.Replace("With", "");
argumentStore.SetMemberNameAndValue(memberName, args[0]);
return true;
}
}
}
|
using System.Dynamic;
using BobTheBuilder.ArgumentStore;
namespace BobTheBuilder.Syntax
{
public class DynamicBuilder<T> : DynamicBuilderBase<T> where T: class
{
public DynamicBuilder(IArgumentStore argumentStore) : base(argumentStore) { }
public override bool InvokeBuilderMethod(InvokeMemberBinder binder, object[] args, out object result)
{
ParseMembersFromMethodName(binder, args);
result = this;
return true;
}
private void ParseMembersFromMethodName(InvokeMemberBinder binder, object[] args)
{
var memberName = binder.Name.Replace("With", "");
argumentStore.SetMemberNameAndValue(memberName, args[0]);
}
}
}
|
apache-2.0
|
C#
|
7b4503220619ba603ff56d57aeaeb927f6a108fd
|
Change application title displayed in browser title bar
|
stephengtuggy/AspNetMvcEF6ContactManager,stephengtuggy/AspNetMvcEF6ContactManager,stephengtuggy/AspNetMvcEF6ContactManager
|
AspNetMvcEF6ContactManager/Views/Shared/_Layout.cshtml
|
AspNetMvcEF6ContactManager/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - AspNetMvcEF6ContactManager</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("AspNetMvcEF6ContactManager", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
@*<li>@Html.ActionLink("Contact Developer", "Contact", "Home")</li>*@
<li>@Html.ActionLink("Your Contacts", "Index", "Contacts")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Stephen G Tuggy</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("AspNetMvcEF6ContactManager", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
@*<li>@Html.ActionLink("Contact Developer", "Contact", "Home")</li>*@
<li>@Html.ActionLink("Your Contacts", "Index", "Contacts")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Stephen G Tuggy</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
e25ba7f3208c3aa3e7f35a60b562c8a0ff33370e
|
Remove blank rows
|
tzachshabtay/MonoAGS
|
Source/Tests/Engine/Misc/Utils/MathUtilsTests.cs
|
Source/Tests/Engine/Misc/Utils/MathUtilsTests.cs
|
using NUnit.Framework;
using AGS.API;
namespace Tests
{
[TestFixture]
public class MathUtilsTests
{
[TestCase(1, Result= 1)]
[TestCase(2, Result= 2)]
[TestCase(3, Result= 4)]
[TestCase(4, Result= 4)]
[TestCase(13, Result= 16)]
[TestCase(33, Result= 64)]
[TestCase(1000, Result= 1024)]
[TestCase(1024, Result= 1024)]
public int NextPowerOf2Test(int num)
{
return MathUtils.GetNextPowerOf2(num);
}
[TestCase(1, Result= true)]
[TestCase(2, Result= true)]
[TestCase(3, Result= false)]
[TestCase(4, Result= true)]
[TestCase(13, Result= false)]
[TestCase(33, Result= false)]
[TestCase(1000, Result= false)]
[TestCase(1024, Result= true)]
public bool IsPowerOf2Test(int num)
{
return MathUtils.IsPowerOf2(num);
}
[TestCase(1f, 1f, true)]
[TestCase(1f, 0f, false)]
[TestCase(-1f, -1f, true)]
[TestCase(-1f, 1f, false)]
[TestCase(float.NaN, float.NaN, true)]
[TestCase(float.NaN, 0f, false)]
[TestCase(-1f, -1.000000001f, true)]
[TestCase(float.MinValue, float.MinValue, true)]
[TestCase(float.MaxValue, float.MaxValue, true)]
[TestCase(float.MaxValue, float.MinValue, false)]
public void FloatEqualsTest(float x, float y, bool shouldEqual)
{
Assert.AreEqual(shouldEqual, MathUtils.FloatEquals(x, y));
}
}
}
|
using NUnit.Framework;
using AGS.API;
namespace Tests
{
[TestFixture]
public class MathUtilsTests
{
[TestCase(1, Result= 1)]
[TestCase(2, Result= 2)]
[TestCase(3, Result= 4)]
[TestCase(4, Result= 4)]
[TestCase(13, Result= 16)]
[TestCase(33, Result= 64)]
[TestCase(1000, Result= 1024)]
[TestCase(1024, Result= 1024)]
public int NextPowerOf2Test(int num)
{
return MathUtils.GetNextPowerOf2(num);
}
[TestCase(1, Result= true)]
[TestCase(2, Result= true)]
[TestCase(3, Result= false)]
[TestCase(4, Result= true)]
[TestCase(13, Result= false)]
[TestCase(33, Result= false)]
[TestCase(1000, Result= false)]
[TestCase(1024, Result= true)]
public bool IsPowerOf2Test(int num)
{
return MathUtils.IsPowerOf2(num);
}
[TestCase(1f, 1f, true)]
[TestCase(1f, 0f, false)]
[TestCase(-1f, -1f, true)]
[TestCase(-1f, 1f, false)]
[TestCase(float.NaN, float.NaN, true)]
[TestCase(float.NaN, 0f, false)]
[TestCase(-1f, -1.000000001f, true)]
[TestCase(float.MinValue, float.MinValue, true)]
[TestCase(float.MaxValue, float.MaxValue, true)]
[TestCase(float.MaxValue, float.MinValue, false)]
public void FloatEqualsTest(float x, float y, bool shouldEqual)
{
Assert.AreEqual(shouldEqual, MathUtils.FloatEquals(x, y));
}
}
}
|
artistic-2.0
|
C#
|
9109b88c550a7fd7312a6b71a5d1ea312fdf3883
|
implement action method in web api for rules creation
|
yoliva/game-of-drones,yoliva/game-of-drones,yoliva/game-of-drones
|
Source/GameOfDrones.API/Controllers/RulesController.cs
|
Source/GameOfDrones.API/Controllers/RulesController.cs
|
using System.Linq;
using System.Web.Http;
using GameOfDrones.API.Models;
using GameOfDrones.Domain.Entities;
using GameOfDrones.Domain.Repositories;
namespace GameOfDrones.API.Controllers
{
[RoutePrefix("api/v1/rules")]
public class RulesController : ApiController
{
private readonly IGameOfDronesRepository _gameOfDronesRepository;
public RulesController(IGameOfDronesRepository gameOfDronesRepository)
{
_gameOfDronesRepository = gameOfDronesRepository;
}
[Route("GetAll")]
public IHttpActionResult GetAllRules()
{
return Ok(_gameOfDronesRepository.GetAllRules());
}
[Route("UpdateDefault/{ruleId}")]
public IHttpActionResult PutUpdateDefaultRule(int ruleId)
{
var rule = _gameOfDronesRepository.GetRuleById(ruleId);
if (rule == null)
return NotFound();
_gameOfDronesRepository.GetCurrentRule().IsCurrent = false;
rule.IsCurrent = true;
_gameOfDronesRepository.SaveChanges();
return Ok(rule);
}
[Route("GetCurrent")]
public IHttpActionResult GetCurrentRule()
{
return Ok(_gameOfDronesRepository.GetAllRules().FirstOrDefault(x => x.IsCurrent));
}
[Route("create")]
public IHttpActionResult PutCreateRule([FromBody]RuleViewModel data)
{
if (!ModelState.IsValid)
return BadRequest();
var rule = new Rule()
{
Name = data.Name,
RuleDefinition = data.RuleDefinition
};
_gameOfDronesRepository.AddRule(rule);
_gameOfDronesRepository.SaveChanges();
return Ok(rule);
}
}
}
|
using System.Linq;
using System.Web.Http;
using GameOfDrones.Domain.Repositories;
namespace GameOfDrones.API.Controllers
{
[RoutePrefix("api/v1/rules")]
public class RulesController : ApiController
{
private readonly IGameOfDronesRepository _gameOfDronesRepository;
public RulesController(IGameOfDronesRepository gameOfDronesRepository)
{
_gameOfDronesRepository = gameOfDronesRepository;
}
[Route("GetAll")]
public IHttpActionResult GetAllRules()
{
return Ok(_gameOfDronesRepository.GetAllRules());
}
[Route("UpdateDefault/{ruleId}")]
public IHttpActionResult PutUpdateDefaultRule(int ruleId)
{
var rule = _gameOfDronesRepository.GetRuleById(ruleId);
if (rule == null)
return NotFound();
_gameOfDronesRepository.GetCurrentRule().IsCurrent = false;
rule.IsCurrent = true;
_gameOfDronesRepository.SaveChanges();
return Ok(rule);
}
[Route("GetCurrent")]
public IHttpActionResult GetCurrentRule()
{
return Ok(_gameOfDronesRepository.GetAllRules().FirstOrDefault(x => x.IsCurrent));
}
}
}
|
mit
|
C#
|
f8245bc6347829be36b3b28bfe275d8ccad72ed4
|
Make send try policy more aggressive
|
Abc-Arbitrage/Zebus,biarne-a/Zebus
|
src/Abc.Zebus/Transport/ZmqSocketOptions.cs
|
src/Abc.Zebus/Transport/ZmqSocketOptions.cs
|
using System;
using Abc.Zebus.Util;
namespace Abc.Zebus.Transport
{
public class ZmqSocketOptions : IZmqSocketOptions
{
public ZmqSocketOptions()
{
ReadTimeout = 300.Milliseconds();
SendHighWaterMark = 20000;
SendTimeout = 100.Milliseconds();
SendRetriesBeforeSwitchingToClosedState = 2;
ClosedStateDuration = 15.Seconds();
ReceiveHighWaterMark = 20000;
}
public TimeSpan ReadTimeout { set; get; }
public int SendHighWaterMark { get; set; }
public TimeSpan SendTimeout { get; set; }
public int SendRetriesBeforeSwitchingToClosedState { get; set; }
public TimeSpan ClosedStateDuration { get; set; }
public int ReceiveHighWaterMark { get; set; }
}
}
|
using System;
using Abc.Zebus.Util;
namespace Abc.Zebus.Transport
{
public class ZmqSocketOptions : IZmqSocketOptions
{
public ZmqSocketOptions()
{
ReadTimeout = 300.Milliseconds();
SendHighWaterMark = 20000;
SendTimeout = 1000.Milliseconds();
SendRetriesBeforeSwitchingToClosedState = 5;
ClosedStateDuration = 15.Seconds();
ReceiveHighWaterMark = 20000;
}
public TimeSpan ReadTimeout { set; get; }
public int SendHighWaterMark { get; set; }
public TimeSpan SendTimeout { get; set; }
public int SendRetriesBeforeSwitchingToClosedState { get; set; }
public TimeSpan ClosedStateDuration { get; set; }
public int ReceiveHighWaterMark { get; set; }
}
}
|
mit
|
C#
|
2ac0da5c0e64769e03061a6a5d4d34e90f59b732
|
Read config configurationmanager
|
okaram/azure-website,okaram/azure-website
|
read-config.cshtml
|
read-config.cshtml
|
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Salutation: @Environment.GetEnvironmentVariable("APPSETTING_Salutation")</p>
<p>Salutation: @System.Configuration.ConfigurationManager.AppSettings["Salutation"]</p>
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Salutation: @Environment.GetEnvironmentVariable("APPSETTING_Salutation")</p>
<p>Salutation: </p>
</body>
</html>
|
unlicense
|
C#
|
a59af115ec1320eb5aaeb296e7d1336d631ea11e
|
Fix copyright comment
|
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
|
Assets/MixedRealityToolkit.Tests/PlayModeTests/PlayModeTestUtilities.cs
|
Assets/MixedRealityToolkit.Tests/PlayModeTests/PlayModeTestUtilities.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.Utilities;
using Microsoft.MixedReality.Toolkit.Input;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Tests
{
public class PlayModeTestUtilities
{
public static SimulatedHandData.HandJointDataGenerator GenerateHandPose(SimulatedHandPose.GestureId gesture, Handedness handedness, Vector3 screenPosition)
{
return (jointsOut) =>
{
SimulatedHandPose gesturePose = SimulatedHandPose.GetGesturePose(gesture);
Quaternion rotation = Quaternion.identity;
Vector3 position = CameraCache.Main.ScreenToWorldPoint(screenPosition);
gesturePose.ComputeJointPositions(handedness, rotation, position, jointsOut);
};
}
}
}
|
using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.Utilities;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Tests
{
public class PlayModeTestUtilities
{
public static SimulatedHandData.HandJointDataGenerator GenerateHandPose(SimulatedHandPose.GestureId gesture, Handedness handedness, Vector3 screenPosition)
{
return (jointsOut) =>
{
SimulatedHandPose gesturePose = SimulatedHandPose.GetGesturePose(gesture);
Quaternion rotation = Quaternion.identity;
Vector3 position = CameraCache.Main.ScreenToWorldPoint(screenPosition);
gesturePose.ComputeJointPositions(handedness, rotation, position, jointsOut);
};
}
}
}
|
mit
|
C#
|
9f9d86fc409c72b9031d0e3067db87915d628fce
|
Fix broken attribute.
|
jherby2k/AudioWorks
|
AudioWorks/AudioWorks.Extensions/AudioMetadataDecoderExportAttribute.cs
|
AudioWorks/AudioWorks.Extensions/AudioMetadataDecoderExportAttribute.cs
|
using JetBrains.Annotations;
using System;
using System.Composition;
using System.IO;
using System.Linq;
namespace AudioWorks.Extensions
{
[PublicAPI, MeansImplicitUse, BaseTypeRequired(typeof(IAudioMetadataDecoder))]
[MetadataAttribute, AttributeUsage(AttributeTargets.Class)]
public sealed class AudioMetadataDecoderExportAttribute : ExportAttribute
{
[NotNull]
public string Extension { get; }
public AudioMetadataDecoderExportAttribute([NotNull] string extension)
: base(typeof(IAudioMetadataDecoder))
{
if (extension == null) throw new ArgumentNullException(nameof(extension));
if (!extension.StartsWith(".", StringComparison.OrdinalIgnoreCase)
|| extension.Any(char.IsWhiteSpace)
|| extension.Any(character => Path.GetInvalidFileNameChars().Contains(character)))
throw new ArgumentException($"'{extension}' is not a valid file extension.", nameof(extension));
Extension = extension;
}
}
}
|
using JetBrains.Annotations;
using System;
using System.Composition;
using System.IO;
using System.Linq;
namespace AudioWorks.Extensions
{
[PublicAPI, MeansImplicitUse, BaseTypeRequired(typeof(IAudioMetadataDecoder))]
[MetadataAttribute, AttributeUsage(AttributeTargets.Class)]
public sealed class AudioMetadataDecoderExportAttribute : ExportAttribute
{
[NotNull]
public string Extension { get; }
public AudioMetadataDecoderExportAttribute([NotNull] string extension)
: base(typeof(IAudioInfoDecoder))
{
if (extension == null) throw new ArgumentNullException(nameof(extension));
if (!extension.StartsWith(".", StringComparison.OrdinalIgnoreCase)
|| extension.Any(char.IsWhiteSpace)
|| extension.Any(character => Path.GetInvalidFileNameChars().Contains(character)))
throw new ArgumentException($"'{extension}' is not a valid file extension.", nameof(extension));
Extension = extension;
}
}
}
|
agpl-3.0
|
C#
|
d8ef29b74e4e26e1f91ad749b5edae65808a3433
|
change name of the main activity in android project
|
fcartu/HelpDeskMobile
|
Droid/MainActivity.cs
|
Droid/MainActivity.cs
|
using System;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace HelpDeskMobile.Droid
{
[Activity (Label = "HelpDesk Mobile",
Icon = "@drawable/icon",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
Theme = "@android:style/Theme.Holo.Light")]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Initialize Azure Mobile Apps
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
// Initialize Xamarin Forms
global::Xamarin.Forms.Forms.Init (this, bundle);
// Load the main application
LoadApplication (new App ());
}
}
}
|
using System;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace HelpDeskMobile.Droid
{
[Activity (Label = "HelpDeskMobile.Droid",
Icon = "@drawable/icon",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
Theme = "@android:style/Theme.Holo.Light")]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Initialize Azure Mobile Apps
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
// Initialize Xamarin Forms
global::Xamarin.Forms.Forms.Init (this, bundle);
// Load the main application
LoadApplication (new App ());
}
}
}
|
mit
|
C#
|
0f28f4443966f4ca76a234e6a3e36cce5a75cf7d
|
Change navigation bar color to green
|
jsauvexamarin/app-crm,jsauvexamarin/app-crm,qipengwu/app-crm,xamarin-automation-service/app-crm,xamarin/app-crm,xamarin/app-crm,xamarin-automation-service/app-crm,xamarin/app-crm,qipengwu/app-crm,qipengwu/app-crm,jsauvexamarin/app-crm,xamarin-automation-service/app-crm,xamarin/app-crm,xamarin-automation-service/app-crm,qipengwu/app-crm
|
src/MobileApp/XamarinCRM.iOS/AppDelegate.cs
|
src/MobileApp/XamarinCRM.iOS/AppDelegate.cs
|
//
// Copyright 2015 Xamarin Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Foundation;
using Syncfusion.SfChart.XForms.iOS.Renderers;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using Xamarin;
using XamarinCRM.Statics;
namespace XamarinCRM.iOS
{
[Register("AppDelegate")]
public partial class AppDelegate : FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
new SfChartRenderer(); // This is necessary for initializing SyncFusion charts.
#if DEBUG
Xamarin.Calabash.Start();
#endif
// Azure Mobile Services initilization
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
// SQLite initialization
SQLitePCL.CurrentPlatform.Init();
// Xamarin.Forms initialization
Forms.Init();
// Xamarin.Forms.Maps initialization
FormsMaps.Init();
// Bootstrap the "core" Xamarin.Forms app
LoadApplication(new App());
// Apply OS-specific color theming
ConfigureApplicationTheming ();
return base.FinishedLaunching(app, options);
}
void ConfigureApplicationTheming ()
{
UINavigationBar.Appearance.TintColor = UIColor.White;
UINavigationBar.Appearance.BarTintColor = Palette._001.ToUIColor ();
UINavigationBar.Appearance.TitleTextAttributes = new UIStringAttributes { ForegroundColor = UIColor.White };
UIBarButtonItem.Appearance.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal);
UIProgressView.Appearance.ProgressTintColor = Palette._003.ToUIColor ();
}
}
}
|
//
// Copyright 2015 Xamarin Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Foundation;
using Syncfusion.SfChart.XForms.iOS.Renderers;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using Xamarin;
using XamarinCRM.Statics;
namespace XamarinCRM.iOS
{
[Register("AppDelegate")]
public partial class AppDelegate : FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
new SfChartRenderer(); // This is necessary for initializing SyncFusion charts.
#if DEBUG
Xamarin.Calabash.Start();
#endif
// Azure Mobile Services initilization
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
// SQLite initialization
SQLitePCL.CurrentPlatform.Init();
// Xamarin.Forms initialization
Forms.Init();
// Xamarin.Forms.Maps initialization
FormsMaps.Init();
// Bootstrap the "core" Xamarin.Forms app
LoadApplication(new App());
// Apply OS-specific color theming
ConfigureApplicationTheming ();
return base.FinishedLaunching(app, options);
}
void ConfigureApplicationTheming ()
{
UIProgressView.Appearance.ProgressTintColor = Palette._003.ToUIColor ();
}
}
}
|
mit
|
C#
|
474e3e50a2e4efc12bd087f89404aeb6027c595a
|
add missing model: DockerImage
|
lvermeulen/ProGet.Net
|
src/ProGet.Net/Native/Models/DockerImage.cs
|
src/ProGet.Net/Native/Models/DockerImage.cs
|
using System;
// ReSharper disable InconsistentNaming
namespace ProGet.Net.Native.Models
{
public class DockerImage
{
public int Feed_Id { get; set; }
public string Repository_Name { get; set; }
public string Image_Digest { get; set; }
public byte[] ManifestJson_Bytes { get; set; }
public int Download_Count { get; set; }
public DateTime Published_Date { get; set; }
}
}
|
namespace ProGet.Net.Native.Models
{
public class DockerImage
{
}
}
|
mit
|
C#
|
ac60b1ea966449b171cbdd8eaee72cc395ebbb38
|
Check uri starts with sitecore: when converting to sitecore item from uri
|
Adamsimsy/Sitecore.LinkedData
|
LinkedData/New/SitecoreTripleHelper.cs
|
LinkedData/New/SitecoreTripleHelper.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using LinkedData.Concepts;
using Sitecore.Data;
using Sitecore.Data.Items;
using Sitecore.Links;
using VDS.RDF;
using VDS.RDF.Parsing;
using VDS.RDF.Query;
namespace LinkedData.New
{
public static class SitecoreTripleHelper
{
public static Triple ToTriple(IConceptManager conceptManager, Item item, ItemLink itemLink)
{
var g = new Graph();
g.NamespaceMap.AddNamespace("sitecore", new Uri("sitecore:"));
IUriNode sub = g.CreateUriNode(ItemToUri(item));
ILiteralNode obj = g.CreateLiteralNode(ItemToUri(itemLink.GetTargetItem()));
IUriNode predicate = conceptManager.GetPredicate(sub, obj);
return new Triple(sub, Tools.CopyNode(predicate, g), obj);
}
public static string ItemToUri(Item item)
{
if (item != null && item.Uri != null)
{
return item.Uri.ToString();
}
return string.Empty;
}
public static Item UriToItem(string uri)
{
if (uri != null && !string.IsNullOrEmpty(uri) && uri.StartsWith("sitecore:"))
{
var itemUri = new ItemUri(uri.Replace("%7B", "{").Replace("%7D", "}"));
var database = Sitecore.Configuration.Factory.GetDatabase(itemUri.DatabaseName);
return database.GetItem(itemUri.ItemID, itemUri.Language, itemUri.Version);
}
return null;
}
public static SparqlQuery StringToSparqlQuery(string str)
{
var parser = new SparqlQueryParser();
return parser.ParseFromString("PREFIX sitecore: <sitecore:>" + str);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using LinkedData.Concepts;
using Sitecore.Data;
using Sitecore.Data.Items;
using Sitecore.Links;
using VDS.RDF;
using VDS.RDF.Parsing;
using VDS.RDF.Query;
namespace LinkedData.New
{
public static class SitecoreTripleHelper
{
public static Triple ToTriple(IConceptManager conceptManager, Item item, ItemLink itemLink)
{
var g = new Graph();
g.NamespaceMap.AddNamespace("sitecore", new Uri("sitecore:"));
IUriNode sub = g.CreateUriNode(ItemToUri(item));
ILiteralNode obj = g.CreateLiteralNode(ItemToUri(itemLink.GetTargetItem()));
IUriNode predicate = conceptManager.GetPredicate(sub, obj);
return new Triple(sub, Tools.CopyNode(predicate, g), obj);
}
public static string ItemToUri(Item item)
{
if (item != null && item.Uri != null)
{
return item.Uri.ToString();
}
return string.Empty;
}
public static Item UriToItem(string uri)
{
if (uri != null && !string.IsNullOrEmpty(uri))
{
var itemUri = new ItemUri(uri.Replace("%7B", "{").Replace("%7D", "}"));
var database = Sitecore.Configuration.Factory.GetDatabase(itemUri.DatabaseName);
return database.GetItem(itemUri.ItemID, itemUri.Language, itemUri.Version);
}
return null;
}
public static SparqlQuery StringToSparqlQuery(string str)
{
var parser = new SparqlQueryParser();
return parser.ParseFromString("PREFIX sitecore: <sitecore:>" + str);
}
}
}
|
mit
|
C#
|
3063ac03ef72292b0d4049e6e06d13a02d95bd26
|
load nodes from files
|
Zefrock/Massive
|
MassiveSolution/GraphLoader/Program.cs
|
MassiveSolution/GraphLoader/Program.cs
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GraphLoader
{
class Program
{
const string GraphFolderKeyName = "GraphFolder";
static Program()
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler);
TaskScheduler.UnobservedTaskException += new EventHandler<UnobservedTaskExceptionEventArgs>(UnobservedTaskExceptionHandler);
}
static void Main(string[] args)
{
if(args.Length > 0)
{
Console.WriteLine("GraphLoader is not expecting any arguments");
return;
}
var graphFolder = ConfigurationManager.AppSettings[GraphFolderKeyName];
if(string.IsNullOrWhiteSpace(graphFolder))
{
Console.WriteLine($"Could not find a valid configuration value for key '{GraphFolderKeyName}'");
return;
}
var folderLoader = new FolderLoader(graphFolder);
var files = folderLoader.GetNodeFiles();
Graph graph = new Graph();
graph.Load(files);
//Todo:
//use Automapper DTO to Model
//Clean DB and Save model to DB
}
private static void UnobservedTaskExceptionHandler(object sender, UnobservedTaskExceptionEventArgs e)
{
HandleException(e.Exception);
}
private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
{
HandleException(e.ExceptionObject as Exception);
}
private static void HandleException(Exception ex)
{
Console.WriteLine("An unhandled exception occurred");
switch(ex)
{
case AggregateException aex:
Console.WriteLine(aex.Flatten().ToString());
break;
default:
Console.WriteLine(ex.ToString());
break;
case null:
break;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GraphLoader
{
class Program
{
const string GraphFolderKeyName = "GraphFolder";
static Program()
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler);
TaskScheduler.UnobservedTaskException += new EventHandler<UnobservedTaskExceptionEventArgs>(UnobservedTaskExceptionHandler);
}
static void Main(string[] args)
{
if(args.Length > 0)
{
Console.WriteLine("GraphLoader is not expecting any arguments");
return;
}
var graphFolder = ConfigurationManager.AppSettings[GraphFolderKeyName];
if(string.IsNullOrWhiteSpace(graphFolder))
{
Console.WriteLine($"Could not find a valid configuration value for key '{GraphFolderKeyName}'");
return;
}
var graphLoader = new GraphLoader(graphFolder);
graphLoader.LoadGraphFromFolder();
graphLoader.SaveGraphToDB();
}
private static void UnobservedTaskExceptionHandler(object sender, UnobservedTaskExceptionEventArgs e)
{
HandleException(e.Exception);
}
private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
{
HandleException(e.ExceptionObject as Exception);
}
private static void HandleException(Exception ex)
{
Console.WriteLine("An unhandled exception occurred");
switch(ex)
{
case AggregateException aex:
Console.WriteLine(aex.Flatten().ToString());
break;
default:
Console.WriteLine(ex.ToString());
break;
case null:
break;
}
}
}
}
|
mit
|
C#
|
c47368231bc3af106aa3acabc14fd6544bb8b0fb
|
Add scrollable player list to round end menu with OOC Usernames.
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14
|
Content.Client/UserInterface/RoundEndSummaryWindow.cs
|
Content.Client/UserInterface/RoundEndSummaryWindow.cs
|
using Robust.Client.Graphics;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Content.Client.Utility;
using Robust.Client.Player;
using System.Linq;
using static Robust.Client.UserInterface.Controls.ItemList;
namespace Content.Client.UserInterface
{
public sealed class RoundEndSummaryWindow : SS14Window
{
#pragma warning disable 649
[Dependency] private IPlayerManager _playerManager;
#pragma warning restore 649
private readonly int _headerFontSize = 14;
private VBoxContainer VBox { get; }
private ItemList _playerList;
protected override Vector2? CustomSize => (520, 580);
public RoundEndSummaryWindow(string gm, uint duration)
{
Title = Loc.GetString("Round End Summary");
var cache = IoCManager.Resolve<IResourceCache>();
var inputManager = IoCManager.Resolve<IInputManager>();
Font headerFont = new VectorFont(cache.GetResource<FontResource>("/Nano/NotoSans/NotoSans-Regular.ttf"), _headerFontSize);
var scrollContainer = new ScrollContainer();
scrollContainer.AddChild(VBox = new VBoxContainer());
Contents.AddChild(scrollContainer);
//Gamemode Name
var gamemodeLabel = new RichTextLabel();
gamemodeLabel.SetMarkup(Loc.GetString("Round of [color=white]{0}[/color] has ended.", gm));
VBox.AddChild(gamemodeLabel);
//Duration
var roundDurationInfo = new RichTextLabel();
roundDurationInfo.SetMarkup(Loc.GetString("The round lasted for [color=yellow]{0}[/color] hours.", duration));
VBox.AddChild(roundDurationInfo);
//Populate list of players.
_playerManager = IoCManager.Resolve<IPlayerManager>();
_playerList = new ItemList()
{
SizeFlagsStretchRatio = 8,
SizeFlagsVertical = SizeFlags.FillExpand,
SelectMode = ItemList.ItemListSelectMode.Button
};
foreach (var session in _playerManager.Sessions.OrderBy(s => s.Name))
{
var playerOOCName = session.SessionId.Username;
//No Mind data so no ICName/Job/Role, etc.
_playerList.AddItem(playerOOCName);
}
VBox.AddChild(_playerList);
OpenCentered();
MoveToFront();
}
}
}
|
using Robust.Client.Graphics;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Content.Client.Utility;
namespace Content.Client.UserInterface
{
public sealed class RoundEndSummaryWindow : SS14Window
{
private readonly int _headerFontSize = 14;
private VBoxContainer VBox { get; }
protected override Vector2? CustomSize => (520, 580);
public RoundEndSummaryWindow(string gm, uint duration)
{
Title = Loc.GetString("Round End Summary");
var cache = IoCManager.Resolve<IResourceCache>();
var inputManager = IoCManager.Resolve<IInputManager>();
Font headerFont = new VectorFont(cache.GetResource<FontResource>("/Nano/NotoSans/NotoSans-Regular.ttf"), _headerFontSize);
var scrollContainer = new ScrollContainer();
scrollContainer.AddChild(VBox = new VBoxContainer());
Contents.AddChild(scrollContainer);
//Gamemode Name
var gamemodeLabel = new RichTextLabel();
gamemodeLabel.SetMarkup(Loc.GetString("Round of: [color=white]{0}[/color] has ended.", gm));
VBox.AddChild(gamemodeLabel);
//Duration
var roundDurationInfo = new RichTextLabel();
roundDurationInfo.SetMarkup(Loc.GetString("The round lasted for [color=yellow]{0}[/color] hours.", duration));
VBox.AddChild(roundDurationInfo);
OpenCentered();
MoveToFront();
}
}
}
|
mit
|
C#
|
96f3da1a967b89efd127e140ac324412689aea46
|
Update Program.cs
|
PavlinCPetkov/Tech-Module---Homework
|
BasicAndIntroLab/AddTwoNumbers/Program.cs
|
BasicAndIntroLab/AddTwoNumbers/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AddTwoNumbers
{
class AddTwoNumbers
{
static void Main(string[] args)
{
int firstNumber = int.Parse(Console.ReadLine());
int secondNumber = int.Parse(Console.ReadLine());
int result = firstNumber + secondNumber;
Console.WriteLine($"{firstNumber} + {secondNumber} = {result}");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AddTwoNumbers
{
class Program
{
static void Main(string[] args)
{
int firstNumber = int.Parse(Console.ReadLine());
int secondNumber = int.Parse(Console.ReadLine());
int result = firstNumber + secondNumber;
Console.WriteLine($"{firstNumber} + {secondNumber} = {result}");
}
}
}
|
mit
|
C#
|
6067a876b5c46fd6a9384a97b71d9276ec001a3f
|
Fix for last commit
|
OS2CPRbroker/cprbroker,magenta-aps/cprbroker,magenta-aps/cprbroker,OS2CPRbroker/cprbroker,magenta-aps/cprbroker
|
PART/Source/CprBroker/InstallerActions.Tests/CprBrokerCustomActions.WebPatches.Tests.cs
|
PART/Source/CprBroker/InstallerActions.Tests/CprBrokerCustomActions.WebPatches.Tests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CprBrokerWixInstallers;
using CprBroker.Installers;
using Microsoft.Deployment.WindowsInstaller;
using NUnit.Framework;
namespace CprBroker.Tests.InstallerActions
{
namespace CprBrokerCustomActionTests
{
[TestFixture]
public class PatchWebsite_2_2_7
{
[Test]
public void PatchWebsite_2_2_7_Passes()
{
var session = new SessionAdapterStub();
CprBrokerCustomActions.PatchWebsite_2_2_7(session);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CprBrokerWixInstallers;
using CprBroker.Installers;
using Microsoft.Deployment.WindowsInstaller;
using NUnit.Framework;
namespace CprBroker.Tests.InstallerActions
{
namespace CprBrokerCustomActionTests
{
public class PatchWebsite_2_2_7
{
[Test]
public void PatchWebsite_2_2_7_Passes()
{
var session = new SessionAdapterStub();
CprBrokerCustomActions.PatchWebsite_2_2_7(session);
}
}
}
}
|
mpl-2.0
|
C#
|
b3a55413dd1b4f213f4ecc9f300cbb2693bbbbd9
|
Bump version to 0.11.2
|
quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot
|
CactbotOverlay/Properties/AssemblyInfo.cs
|
CactbotOverlay/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.11.2.0")]
[assembly: AssemblyFileVersion("0.11.2.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.11.1.0")]
[assembly: AssemblyFileVersion("0.11.1.0")]
|
apache-2.0
|
C#
|
4227f08a8a1eb2403877a26646e0d19be1f1f5a8
|
Set FallBackFeeRate to MinimumFeeRate to make testnet and regtest work properly (It is temprorary: until we come to consensus on what the FallBackFeeRate should be)
|
DanGould/NTumbleBit,NTumbleBit/NTumbleBit
|
NTumbleBit.TumblerServer/Services/ExternalServices.cs
|
NTumbleBit.TumblerServer/Services/ExternalServices.cs
|
using NBitcoin.RPC;
#if !CLIENT
using NTumbleBit.TumblerServer.Services.RPCServices;
#else
using NTumbleBit.Client.Tumbler.Services.RPCServices;
#endif
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
#if !CLIENT
namespace NTumbleBit.TumblerServer.Services
#else
namespace NTumbleBit.Client.Tumbler.Services
#endif
{
public class ExternalServices
{
public static ExternalServices CreateFromRPCClient(RPCClient rpc, IRepository repository)
{
var info = rpc.SendCommand(RPCOperations.getinfo);
var minimumRate = new NBitcoin.FeeRate(NBitcoin.Money.Coins((decimal)(double)((Newtonsoft.Json.Linq.JValue)(info.Result["relayfee"])).Value), 1000);
ExternalServices service = new ExternalServices();
service.FeeService = new RPCFeeService(rpc) {
MinimumFeeRate = minimumRate,
FallBackFeeRate = minimumRate // for now
};
service.WalletService = new RPCWalletService(rpc);
service.BroadcastService = new RPCBroadcastService(rpc, repository);
service.BlockExplorerService = new RPCBlockExplorerService(rpc);
service.TrustedBroadcastService = new RPCTrustedBroadcastService(rpc, service.BroadcastService, service.BlockExplorerService, repository)
{
//BlockExplorer will already track the addresses, since they used a shared bitcoind, no need of tracking again (this would overwrite labels)
TrackPreviousScriptPubKey = false
};
return service;
}
public IFeeService FeeService
{
get; set;
}
public IWalletService WalletService
{
get; set;
}
public IBroadcastService BroadcastService
{
get; set;
}
public IBlockExplorerService BlockExplorerService
{
get; set;
}
public ITrustedBroadcastService TrustedBroadcastService
{
get; set;
}
}
}
|
using NBitcoin.RPC;
#if !CLIENT
using NTumbleBit.TumblerServer.Services.RPCServices;
#else
using NTumbleBit.Client.Tumbler.Services.RPCServices;
#endif
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
#if !CLIENT
namespace NTumbleBit.TumblerServer.Services
#else
namespace NTumbleBit.Client.Tumbler.Services
#endif
{
public class ExternalServices
{
public static ExternalServices CreateFromRPCClient(RPCClient rpc, IRepository repository)
{
var info = rpc.SendCommand(RPCOperations.getinfo);
var minimumRate = new NBitcoin.FeeRate(NBitcoin.Money.Coins((decimal)(double)((Newtonsoft.Json.Linq.JValue)(info.Result["relayfee"])).Value), 1000);
ExternalServices service = new ExternalServices();
service.FeeService = new RPCFeeService(rpc) { MinimumFeeRate = minimumRate };
service.WalletService = new RPCWalletService(rpc);
service.BroadcastService = new RPCBroadcastService(rpc, repository);
service.BlockExplorerService = new RPCBlockExplorerService(rpc);
service.TrustedBroadcastService = new RPCTrustedBroadcastService(rpc, service.BroadcastService, service.BlockExplorerService, repository)
{
//BlockExplorer will already track the addresses, since they used a shared bitcoind, no need of tracking again (this would overwrite labels)
TrackPreviousScriptPubKey = false
};
return service;
}
public IFeeService FeeService
{
get; set;
}
public IWalletService WalletService
{
get; set;
}
public IBroadcastService BroadcastService
{
get; set;
}
public IBlockExplorerService BlockExplorerService
{
get; set;
}
public ITrustedBroadcastService TrustedBroadcastService
{
get; set;
}
}
}
|
mit
|
C#
|
93847ae78d4cc3db315ed69bd22d4aa0de4def00
|
Remove TiltBrushExamples from the .unitypackage
|
googlevr/tilt-brush-toolkit,googlevr/tilt-brush-toolkit
|
UnitySDK/Assets/Editor/BuildPackage.cs
|
UnitySDK/Assets/Editor/BuildPackage.cs
|
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
static class BuildPackage {
static string kVersionNormalLocation = "Assets/Editor/DummyVERSION.txt";
static string kVersionBuildLocation = "Assets/TiltBrush/VERSION.txt";
[System.Serializable()]
public class BuildFailedException : System.Exception {
public BuildFailedException(string fmt, params object[] args)
: base(string.Format(fmt, args)) { }
}
/// Temporarily create a VERSION.txt build stamp so we can embed it
/// in the unitypackage. Cleans up afterwards.
/// Ensures that the VERSION.txt has a consistent GUID.
class TempBuildStamp : System.IDisposable {
byte[] m_previousContents;
public TempBuildStamp(string contents) {
string err = AssetDatabase.MoveAsset(
kVersionNormalLocation, kVersionBuildLocation);
if (err != "") {
throw new BuildFailedException(
"Couldn't move {0} to {1}: {2}",
kVersionNormalLocation, kVersionBuildLocation, err);
}
m_previousContents = File.ReadAllBytes(kVersionBuildLocation);
File.WriteAllText(kVersionBuildLocation, contents);
}
public void Dispose() {
string err = AssetDatabase.MoveAsset(kVersionBuildLocation, kVersionNormalLocation);
if (err == "" && m_previousContents != null) {
File.WriteAllBytes(kVersionNormalLocation, m_previousContents);
}
}
}
static string GetGitVersion() {
// Start the child process.
var p = new System.Diagnostics.Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "git.exe";
p.StartInfo.Arguments = "describe";
p.Start();
// Do not wait for the child process to exit before
// reading to the end of its redirected stream.
// p.WaitForExit();
// Read the output stream first and then wait.
var version = p.StandardOutput.ReadToEnd().Trim();
p.WaitForExit();
if (p.ExitCode != 0) {
throw new BuildFailedException("git describe exited with code {0}", p.ExitCode);
}
return version;
}
[MenuItem("Tilt Brush/Build Package")]
static void DoBuild() {
string version = GetGitVersion();
string name = string.Format("../../tilt-brush-toolkit-UnitySDK-{0}.unitypackage", version);
using (var tmp = new TempBuildStamp(version)) {
AssetDatabase.ExportPackage(
new string[] {
"Assets/ThirdParty",
"Assets/TiltBrush",
},
name,
ExportPackageOptions.Recurse);
Debug.LogFormat("Done building {0}", name);
}
}
}
|
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
static class BuildPackage {
static string kVersionNormalLocation = "Assets/Editor/DummyVERSION.txt";
static string kVersionBuildLocation = "Assets/TiltBrush/VERSION.txt";
[System.Serializable()]
public class BuildFailedException : System.Exception {
public BuildFailedException(string fmt, params object[] args)
: base(string.Format(fmt, args)) { }
}
/// Temporarily create a VERSION.txt build stamp so we can embed it
/// in the unitypackage. Cleans up afterwards.
/// Ensures that the VERSION.txt has a consistent GUID.
class TempBuildStamp : System.IDisposable {
byte[] m_previousContents;
public TempBuildStamp(string contents) {
string err = AssetDatabase.MoveAsset(
kVersionNormalLocation, kVersionBuildLocation);
if (err != "") {
throw new BuildFailedException(
"Couldn't move {0} to {1}: {2}",
kVersionNormalLocation, kVersionBuildLocation, err);
}
m_previousContents = File.ReadAllBytes(kVersionBuildLocation);
File.WriteAllText(kVersionBuildLocation, contents);
}
public void Dispose() {
string err = AssetDatabase.MoveAsset(kVersionBuildLocation, kVersionNormalLocation);
if (err == "" && m_previousContents != null) {
File.WriteAllBytes(kVersionNormalLocation, m_previousContents);
}
}
}
static string GetGitVersion() {
// Start the child process.
var p = new System.Diagnostics.Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "git.exe";
p.StartInfo.Arguments = "describe";
p.Start();
// Do not wait for the child process to exit before
// reading to the end of its redirected stream.
// p.WaitForExit();
// Read the output stream first and then wait.
var version = p.StandardOutput.ReadToEnd().Trim();
p.WaitForExit();
if (p.ExitCode != 0) {
throw new BuildFailedException("git describe exited with code {0}", p.ExitCode);
}
return version;
}
[MenuItem("Tilt Brush/Build Package")]
static void DoBuild() {
string version = GetGitVersion();
string name = string.Format("../../tiltbrushtoolkit-UnitySDK-{0}.unitypackage", version);
using (var tmp = new TempBuildStamp(version)) {
AssetDatabase.ExportPackage(
new string[] {
"Assets/ThirdParty",
"Assets/TiltBrush",
"Assets/TiltBrushExamples"
},
name,
ExportPackageOptions.Recurse);
Debug.LogFormat("Done building {0}", name);
}
}
}
|
apache-2.0
|
C#
|
ddcb36f36e5846ca8eef1451eb9635099ef9d10b
|
Remove unintended comments.
|
fixie/fixie
|
src/Fixie/Convention.cs
|
src/Fixie/Convention.cs
|
namespace Fixie
{
using System.Reflection;
using Conventions;
/// <summary>
/// Base class for all Fixie conventions. Subclass Convention to customize test discovery and execution.
/// </summary>
public class Convention
{
public Convention()
{
Config = new Configuration();
Classes = new ClassExpression(Config);
Methods = new MethodExpression(Config);
Parameters = new ParameterSourceExpression(Config);
CaseExecution = new CaseBehaviorExpression(Config);
ClassExecution = new ClassBehaviorExpression(Config);
}
/// <summary>
/// The current state describing the convention. This state can be manipulated through
/// the other properties on Convention.
/// </summary>
internal Configuration Config { get; }
/// <summary>
/// Gets the target MethodInfo identified by the test runner as the sole item
/// to be executed. Null under normal test execution.
/// </summary>
public MethodInfo TargetMethod => RunContext.TargetMethod;
/// <summary>
/// Defines the set of conditions that describe which classes are test classes.
/// </summary>
public ClassExpression Classes { get; }
/// <summary>
/// Defines the set of conditions that describe which test class methods are test methods,
/// and what order to run them in.
/// </summary>
public MethodExpression Methods { get; }
/// <summary>
/// Defines the set of parameter sources, which provide inputs to parameterized test methods.
/// </summary>
public ParameterSourceExpression Parameters { get; }
/// <summary>
/// Customizes the execution of each test case.
/// </summary>
public CaseBehaviorExpression CaseExecution { get; }
/// <summary>
/// Customizes the execution of each test class.
/// </summary>
public ClassBehaviorExpression ClassExecution { get; }
}
}
|
namespace Fixie
{
using System.Reflection;
using Conventions;
/// <summary>
/// Base class for all Fixie conventions. Subclass Convention to customize test discovery and execution.
/// </summary>
public class Convention
{
public Convention()
{
Config = new Configuration();
Classes = new ClassExpression(Config);
Methods = new MethodExpression(Config);
Parameters = new ParameterSourceExpression(Config);
CaseExecution = new CaseBehaviorExpression(Config);
ClassExecution = new ClassBehaviorExpression(Config);
}
/// <summary>
/// The current state describing the convention. This state can be manipulated through
/// the other properties on Convention.
/// </summary>
internal Configuration Config { get; }
/// <summary>
/// Gets the target MethodInfo identified by the test runner as the sole item
/// to be executed. Null under normal test execution.
/// </summary>
public MethodInfo TargetMethod => RunContext.TargetMethod;
/// <summary>
/// Defines the set of conditions that describe which classes are test classes.
/// </summary>
public ClassExpression Classes { get; }
/// <summary>
/// Defines the set of conditions that describe which test class methods are test methods,
/// and what order to run them in.
/// </summary>
public MethodExpression Methods { get; }
/// <summary>
/// Defines the set of parameter sources, which provide inputs to parameterized test methods.
/// </summary>
public ParameterSourceExpression Parameters { get; }
/// <summary>
/// Customizes the execution of each test case.
/// </summary>
public CaseBehaviorExpression CaseExecution { get; } //just skips now
/// <summary>
/// Customizes the execution of each test class.
/// </summary>
public ClassBehaviorExpression ClassExecution { get; } //lifecycle
}
}
|
mit
|
C#
|
0fed50116d700670737b4265ed9f23d97565449e
|
Fix UnitSequenceMatcher.AddBuildAction => remove meaningless legacy code
|
Ed-ward/Armature
|
src/Armature.Core/UnitSequenceMatcher/UnitSequenceMatcher.cs
|
src/Armature.Core/UnitSequenceMatcher/UnitSequenceMatcher.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Armature.Core.Common;
using JetBrains.Annotations;
namespace Armature.Core.UnitSequenceMatcher
{
/// <summary>
/// Base class implementing the logic of adding build actions
/// </summary>
public abstract class UnitSequenceMatcher : IUnitSequenceMatcher
{
private Dictionary<object, List<IBuildAction>> _buildActions;
protected UnitSequenceMatcher(int weight) => Weight = weight;
protected int Weight { get; }
private Dictionary<object, List<IBuildAction>> LazyBuildAction
{
[DebuggerStepThrough] get => _buildActions ?? (_buildActions = new Dictionary<object, List<IBuildAction>>());
}
public abstract ICollection<IUnitSequenceMatcher> Children { get; }
[CanBeNull]
public abstract MatchedBuildActions GetBuildActions(ArrayTail<UnitInfo> buildingUnitsSequence, int inputWeight);
[DebuggerStepThrough]
public IUnitSequenceMatcher AddBuildAction(object buildStage, IBuildAction buildAction)
{
LazyBuildAction
.GetOrCreateValue(buildStage, () => new List<IBuildAction>())
.Add(buildAction);
return this;
}
public abstract bool Equals(IUnitSequenceMatcher other);
[DebuggerStepThrough]
[CanBeNull]
protected MatchedBuildActions GetOwnActions(int inputWeight)
{
if (_buildActions == null) return null;
var matchingWeight = Weight + inputWeight;
var result = new MatchedBuildActions();
foreach (var pair in _buildActions)
result.Add(pair.Key, pair.Value.Select(_ => _.WithWeight(matchingWeight)).ToList());
return result;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Armature.Core.Common;
using JetBrains.Annotations;
namespace Armature.Core.UnitSequenceMatcher
{
/// <summary>
/// Base class implementing the logic of adding build actions
/// </summary>
public abstract class UnitSequenceMatcher : IUnitSequenceMatcher
{
private Dictionary<object, List<IBuildAction>> _buildActions;
protected UnitSequenceMatcher(int weight) => Weight = weight;
protected int Weight { get; }
private Dictionary<object, List<IBuildAction>> LazyBuildAction
{
[DebuggerStepThrough] get => _buildActions ?? (_buildActions = new Dictionary<object, List<IBuildAction>>());
}
public abstract ICollection<IUnitSequenceMatcher> Children { get; }
[CanBeNull]
public abstract MatchedBuildActions GetBuildActions(ArrayTail<UnitInfo> buildingUnitsSequence, int inputWeight);
[DebuggerStepThrough]
public IUnitSequenceMatcher AddBuildAction(object buildStage, IBuildAction buildAction)
{
if (LazyBuildAction.ContainsKey(buildAction))
throw new ArgumentException(string.Format($"Already contains build action for stage {buildStage}"));
LazyBuildAction
.GetOrCreateValue(buildStage, () => new List<IBuildAction>())
.Add(buildAction);
return this;
}
public abstract bool Equals(IUnitSequenceMatcher other);
[DebuggerStepThrough]
[CanBeNull]
protected MatchedBuildActions GetOwnActions(int inputWeight)
{
if (_buildActions == null) return null;
var matchingWeight = Weight + inputWeight;
var result = new MatchedBuildActions();
foreach (var pair in _buildActions)
result.Add(pair.Key, pair.Value.Select(_ => _.WithWeight(matchingWeight)).ToList());
return result;
}
}
}
|
apache-2.0
|
C#
|
d549322a0033d0f9f564a60787b4f67778f8b5be
|
Add documentation for the Query function.
|
stacybird/CS510CouchDB,stacybird/CS510CouchDB,stacybird/CS510CouchDB
|
CouchTrafficClient/QueryBase.cs
|
CouchTrafficClient/QueryBase.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using Newtonsoft.Json;
using System.Windows.Forms;
using System.Dynamic;
namespace CouchTrafficClient
{
class QueryException : Exception
{
}
class QueryBase
{
/// <summary>
/// Key used when the results from a Query had a row with a "null" key value.
/// </summary>
public const string QueryNullResult = "null";
public string Run()
{
return "Query Client Not Implemented";
}
private string Server { get { return "http://52.10.252.48:5984/traffic/"; } }
/// <summary>
/// Query a view from our CouchDB Server, returning a Dictionary of keys to values!
/// </summary>
/// <param name="designDocumentName">Name of the Design that the View lives within.</param>
/// <param name="viewName">Name of the View that you would like to query.</param>
/// <param name="keys">Optional list of keys to query the view for.</param>
/// <returns></returns>
public Dictionary<object, object> Query(string designDocumentName, string viewName, IList<object> keys = null)
{
dynamic queryResult = InternalQuery(designDocumentName, viewName, keys);
IList<object> a = queryResult.rows;
var result = new Dictionary<object, object>();
foreach (dynamic data in a)
{
result.Add(data.key ?? QueryNullResult, data.value);
}
return result;
}
private ExpandoObject InternalQuery(string designDocumentName, string viewName, IList<object> keys = null)
{
try
{
var keyString = "";
if (keys != null)
{
keyString = string.Format("?keys={0}", Uri.EscapeDataString(JsonConvert.SerializeObject(keys)));
}
var url = Server + "_design/" + designDocumentName + "/_view/" + viewName + keyString;
using (WebClient wc = new WebClient())
{
wc.Encoding = System.Text.Encoding.UTF8;
wc.Headers["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E)";
string str = wc.DownloadString(url);
return JsonConvert.DeserializeObject<ExpandoObject>(str);
}
}
catch (Exception e)
{
MessageBox.Show("Error in WebClient: " + e.ToString());
throw new QueryException();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using Newtonsoft.Json;
using System.Windows.Forms;
using System.Dynamic;
namespace CouchTrafficClient
{
class QueryException : Exception
{
}
class QueryBase
{
public const string QueryNullResult = "null";
public string Run()
{
return "Query Client Not Implemented";
}
public string Server { get { return "http://52.10.252.48:5984/traffic/"; } }
public Dictionary<object, object> Query(string designDocumentName, string viewName, IList<object> keys = null)
{
dynamic queryResult = InternalQuery(designDocumentName, viewName, keys);
IList<object> a = queryResult.rows;
var result = new Dictionary<object, object>();
foreach (dynamic data in a)
{
result.Add(data.key ?? QueryNullResult, data.value);
}
return result;
}
private ExpandoObject InternalQuery(string designDocumentName, string viewName, IList<object> keys = null)
{
try
{
var keyString = "";
if (keys != null)
{
keyString = string.Format("?keys={0}", Uri.EscapeDataString(JsonConvert.SerializeObject(keys)));
}
var url = Server + "_design/" + designDocumentName + "/_view/" + viewName + keyString;
using (WebClient wc = new WebClient())
{
wc.Encoding = System.Text.Encoding.UTF8;
wc.Headers["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E)";
string str = wc.DownloadString(url);
return JsonConvert.DeserializeObject<ExpandoObject>(str);
}
}
catch (Exception e)
{
MessageBox.Show("Error in WebClient: " + e.ToString());
throw new QueryException();
}
}
}
}
|
apache-2.0
|
C#
|
28a61e38d5407d222c2d6a41511a700058d8e05a
|
update overlay
|
Flugmango/GlobeVR
|
Assets/OverlayHandler.cs
|
Assets/OverlayHandler.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OverlayHandler : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
// adds Overlay to Globe
// @param type type of overlay, "none" for no overlay (removing the actual one)
public void addOverlay(string type)
{
//string url = "http://localhost:3000/overlay/" + type;
string url = "file:///C:/Users/sitcomlab/Desktop/GlobeVR/Assets/temp_reproj.png";
WWW www = new WWW(url);
Debug.Log(www);
StartCoroutine(loadImage(www));
}
IEnumerator loadImage(WWW www)
{
Texture2D tex;
tex = new Texture2D(128, 256, TextureFormat.DXT1, false);
yield return www;
www.LoadImageIntoTexture(tex);
//GetComponent<Renderer>().material.mainTexture = tex;
Debug.Log(tex);
GameObject globe = GameObject.FindGameObjectWithTag("Globe");
Renderer globeRenderer = globe.GetComponent<Renderer>();
Material globeMaterial = globeRenderer.material;
globeMaterial.EnableKeyword("_EMISSION");
// http://answers.unity3d.com/questions/914923/standard-shader-emission-control-via-script.html
globeMaterial.SetTexture("_DetailAlbedoMap", tex);
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OverlayHandler : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
// adds Overlay to Globe
// @param type type of overlay, "none" for no overlay (removing the actual one)
public void addOverlay(string type)
{
string url = "http://localhost:3000/overlay/" + type;
WWW www = new WWW(url);
StartCoroutine(loadImage(www));
}
IEnumerator loadImage(WWW www)
{
Texture2D tex;
tex = new Texture2D(128, 256, TextureFormat.DXT1, false);
yield return www;
www.LoadImageIntoTexture(tex);
//GetComponent<Renderer>().material.mainTexture = tex;
GameObject globe = GameObject.FindGameObjectWithTag("Globe");
Renderer globeRenderer = globe.GetComponent<Renderer>();
Material globeMaterial = globeRenderer.material;
globeMaterial.EnableKeyword("_EMISSION");
globeMaterial.SetTexture("_EMISSION", tex);
}
}
|
mit
|
C#
|
861906d70b4583cb82a45a5bcc14edb5b679c659
|
set UsActive to true by default
|
johnkors/Thinktecture.IdentityServer.v3,feanz/Thinktecture.IdentityServer.v3,tbitowner/IdentityServer3,bestwpw/IdentityServer3,delRyan/IdentityServer3,wondertrap/IdentityServer3,delloncba/IdentityServer3,SonOfSam/IdentityServer3,openbizgit/IdentityServer3,openbizgit/IdentityServer3,tonyeung/IdentityServer3,faithword/IdentityServer3,Agrando/IdentityServer3,uoko-J-Go/IdentityServer,Agrando/IdentityServer3,bestwpw/IdentityServer3,bodell/IdentityServer3,roflkins/IdentityServer3,tbitowner/IdentityServer3,roflkins/IdentityServer3,chicoribas/IdentityServer3,chicoribas/IdentityServer3,delRyan/IdentityServer3,mvalipour/IdentityServer3,tbitowner/IdentityServer3,olohmann/IdentityServer3,tonyeung/IdentityServer3,18098924759/IdentityServer3,openbizgit/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,wondertrap/IdentityServer3,tuyndv/IdentityServer3,ryanvgates/IdentityServer3,olohmann/IdentityServer3,18098924759/IdentityServer3,wondertrap/IdentityServer3,chicoribas/IdentityServer3,IdentityServer/IdentityServer3,charoco/IdentityServer3,kouweizhong/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,olohmann/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,huoxudong125/Thinktecture.IdentityServer.v3,EternalXw/IdentityServer3,bodell/IdentityServer3,tuyndv/IdentityServer3,ryanvgates/IdentityServer3,IdentityServer/IdentityServer3,jackswei/IdentityServer3,delloncba/IdentityServer3,EternalXw/IdentityServer3,mvalipour/IdentityServer3,delloncba/IdentityServer3,uoko-J-Go/IdentityServer,codeice/IdentityServer3,SonOfSam/IdentityServer3,SonOfSam/IdentityServer3,codeice/IdentityServer3,charoco/IdentityServer3,tuyndv/IdentityServer3,faithword/IdentityServer3,kouweizhong/IdentityServer3,delRyan/IdentityServer3,faithword/IdentityServer3,charoco/IdentityServer3,jackswei/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,uoko-J-Go/IdentityServer,kouweizhong/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,tonyeung/IdentityServer3,mvalipour/IdentityServer3,Agrando/IdentityServer3,bodell/IdentityServer3,IdentityServer/IdentityServer3,jackswei/IdentityServer3,ryanvgates/IdentityServer3,EternalXw/IdentityServer3,18098924759/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,roflkins/IdentityServer3,codeice/IdentityServer3,bestwpw/IdentityServer3
|
source/Core/Models/IsActiveContext.cs
|
source/Core/Models/IsActiveContext.cs
|
/*
* Copyright 2014, 2015 Dominick Baier, Brock Allen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Security.Claims;
namespace IdentityServer3.Core.Models
{
/// <summary>
/// Context describing the is-active check
/// </summary>
public class IsActiveContext
{
/// <summary>
/// Initializes a new instance of the <see cref="IsActiveContext"/> class.
/// </summary>
public IsActiveContext()
{
IsActive = true;
}
/// <summary>
/// Gets or sets the subject.
/// </summary>
/// <value>
/// The subject.
/// </value>
public ClaimsPrincipal Subject { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the subject is active and can recieve tokens.
/// </summary>
/// <value>
/// <c>true</c> if the subject is active; otherwise, <c>false</c>.
/// </value>
public bool IsActive { get; set; }
}
}
|
/*
* Copyright 2014, 2015 Dominick Baier, Brock Allen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Security.Claims;
namespace IdentityServer3.Core.Models
{
/// <summary>
/// Context describing the is-active check
/// </summary>
public class IsActiveContext
{
/// <summary>
/// Initializes a new instance of the <see cref="IsActiveContext"/> class.
/// </summary>
public IsActiveContext()
{
IsActive = false;
}
/// <summary>
/// Gets or sets the subject.
/// </summary>
/// <value>
/// The subject.
/// </value>
public ClaimsPrincipal Subject { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the subject is active and can recieve tokens.
/// </summary>
/// <value>
/// <c>true</c> if the subject is active; otherwise, <c>false</c>.
/// </value>
public bool IsActive { get; set; }
}
}
|
apache-2.0
|
C#
|
0ee74d3bc3e6ff63360656318f8803317c0598e4
|
Set copyright
|
bojanrajkovic/GifWin
|
src/GifWin/Properties/AssemblyInfo.cs
|
src/GifWin/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("GifWin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GifWin")]
[assembly: AssemblyCopyright("Copyright © Xamarin Inc. 2014-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GifWin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GifWin")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
8841c1d138bb68a55b0f76e1af77dee8a7a45989
|
Update RasterFormat.cs
|
LANDIS-II-Foundation/Landis-Spatial-Modeling-Library
|
src/api/RasterFormat.cs
|
src/api/RasterFormat.cs
|
// Contributors:
// James Domingo, Green Code LLC
namespace Landis.SpatialModeling
{
/// <summary>
/// Information about a particular raster format that a raster factory
/// supports.
/// </summary>
public class RasterFormat
{
/// <summary>
/// A short code identifier for the format.
/// </summary>
/// <remarks>
/// A GDAL format code. Format codes are listed in the "Code"
/// column in the table at http://gdal.org/formats_list.html.
/// GDAL codes are used even if the raster I/O is not implemented
/// with GDAL.
/// </remarks>
public string Code { get; private set; }
/// <summary>
/// The format's name.
/// </summary>
/// <remarks>
/// By convention, GDAL format names are used. These names are
/// shown in the "Long Format Name" column in the table at
/// http://gdal.org/formats_list.html. GDAL names are used even
/// if the raster I/O is not implemented with GDAL.
/// </remarks>
public string Name { get; private set; }
/// <summary>
/// Can the raster factory write output rasters in this format?
/// </summary>
public bool CanWrite { get; private set; }
/// <summary>
/// Construct a new instance with information about a raster format.
/// </summary>
/// <param name="code">The format's code identifier.</param>
/// <param name="name">The format's name.</param>
/// <param name="canWrite">Can the raster factory write output rasters
/// in this format?</param>
public RasterFormat(string code,
string name,
bool canWrite)
{
Code = code;
Name = name;
CanWrite = canWrite;
}
}
}
|
// Copyright 2012 Green Code LLC
// All rights reserved.
//
// The copyright holders license this file under the New (3-clause) BSD
// License (the "License"). You may not use this file except in
// compliance with the License. A copy of the License is available at
//
// http://www.opensource.org/licenses/BSD-3-Clause
//
// and is included in the NOTICE.txt file distributed with this work.
//
// Contributors:
// James Domingo, Green Code LLC
namespace Landis.SpatialModeling
{
/// <summary>
/// Information about a particular raster format that a raster factory
/// supports.
/// </summary>
public class RasterFormat
{
/// <summary>
/// A short code identifier for the format.
/// </summary>
/// <remarks>
/// A GDAL format code. Format codes are listed in the "Code"
/// column in the table at http://gdal.org/formats_list.html.
/// GDAL codes are used even if the raster I/O is not implemented
/// with GDAL.
/// </remarks>
public string Code { get; private set; }
/// <summary>
/// The format's name.
/// </summary>
/// <remarks>
/// By convention, GDAL format names are used. These names are
/// shown in the "Long Format Name" column in the table at
/// http://gdal.org/formats_list.html. GDAL names are used even
/// if the raster I/O is not implemented with GDAL.
/// </remarks>
public string Name { get; private set; }
/// <summary>
/// Can the raster factory write output rasters in this format?
/// </summary>
public bool CanWrite { get; private set; }
/// <summary>
/// Construct a new instance with information about a raster format.
/// </summary>
/// <param name="code">The format's code identifier.</param>
/// <param name="name">The format's name.</param>
/// <param name="canWrite">Can the raster factory write output rasters
/// in this format?</param>
public RasterFormat(string code,
string name,
bool canWrite)
{
Code = code;
Name = name;
CanWrite = canWrite;
}
}
}
|
apache-2.0
|
C#
|
e426f3737e0f5c49a831f1831bcaea7bba440f98
|
Remove unused using
|
Misza13/StarsReloaded
|
StarsReloaded.Shared.Tests/WorldGen/Services/PlanetGeneratorServiceTests.cs
|
StarsReloaded.Shared.Tests/WorldGen/Services/PlanetGeneratorServiceTests.cs
|
namespace StarsReloaded.Shared.Tests.WorldGen.Services
{
using NUnit.Framework;
using StarsReloaded.Shared.Model;
using StarsReloaded.Shared.Services;
using StarsReloaded.Shared.WorldGen.Services;
public class PlanetGeneratorServiceTests
{
////System Under Test
private PlanetGeneratorService planetGeneratorService;
[SetUp]
public void Setup()
{
this.planetGeneratorService = new PlanetGeneratorService(new RngService());
}
[Test]
public void PlanetStatsShouldFitConstraints()
{
////Arrange
var planet = new Planet(0, 0);
////Act
this.planetGeneratorService.PopulatePlanetStats(planet);
////Assert
Assert.That(planet.Name, Is.Not.Empty);
Assert.That(planet.Gravity.Clicks, Is.InRange(-50, 50));
Assert.That(planet.Temperature.Clicks, Is.InRange(-50, 50));
Assert.That(planet.Radiation.Clicks, Is.InRange(-50, 50));
////TODO: Original = Current
Assert.That(planet.OriginalGravity.Clicks, Is.InRange(-50, 50));
Assert.That(planet.OriginalTemperature.Clicks, Is.InRange(-50, 50));
Assert.That(planet.OriginalRadiation.Clicks, Is.InRange(-50, 50));
Assert.That(planet.IroniumConcentration.Concentration, Is.InRange(1, 120));
Assert.That(planet.BoraniumConcentration.Concentration, Is.InRange(1, 120));
Assert.That(planet.GermaniumConcentration.Concentration, Is.InRange(1, 120));
////TODO: Surface minerals = 0
}
}
}
|
namespace StarsReloaded.Shared.Tests.WorldGen.Services
{
using Moq;
using NUnit.Framework;
using StarsReloaded.Shared.Model;
using StarsReloaded.Shared.Services;
using StarsReloaded.Shared.WorldGen.Services;
public class PlanetGeneratorServiceTests
{
////System Under Test
private PlanetGeneratorService planetGeneratorService;
[SetUp]
public void Setup()
{
this.planetGeneratorService = new PlanetGeneratorService(new RngService());
}
[Test]
public void PlanetStatsShouldFitConstraints()
{
////Arrange
var planet = new Planet(0, 0);
////Act
this.planetGeneratorService.PopulatePlanetStats(planet);
////Assert
Assert.That(planet.Name, Is.Not.Empty);
Assert.That(planet.Gravity.Clicks, Is.InRange(-50, 50));
Assert.That(planet.Temperature.Clicks, Is.InRange(-50, 50));
Assert.That(planet.Radiation.Clicks, Is.InRange(-50, 50));
////TODO: Original = Current
Assert.That(planet.OriginalGravity.Clicks, Is.InRange(-50, 50));
Assert.That(planet.OriginalTemperature.Clicks, Is.InRange(-50, 50));
Assert.That(planet.OriginalRadiation.Clicks, Is.InRange(-50, 50));
Assert.That(planet.IroniumConcentration.Concentration, Is.InRange(1, 120));
Assert.That(planet.BoraniumConcentration.Concentration, Is.InRange(1, 120));
Assert.That(planet.GermaniumConcentration.Concentration, Is.InRange(1, 120));
////TODO: Surface minerals = 0
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.