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 |
|---|---|---|---|---|---|---|---|---|
4b8bb440ab68f692fcbfba6648b7d189f6bd0505
|
add "this" in constructor
|
ivayloivanof/C-Sharp-Chat-Programm,Marc2009/C-Sharp-Chat-Programm
|
Client/ChatClient/ChatClient/Client.cs
|
Client/ChatClient/ChatClient/Client.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatClient
{
public class Client
{
public Server connectedServer;
public string LoginName;
public string LoginPwd;
public string SrvPwd;
public List<ServerInfo> SrvInfoList;
public Client()
{
this.SrvInfoList = new List<ServerInfo>();
this.LoadSrvInfoList();
this.connectedServer = new Server();
this.connectedServer.Disconnected += new Server.ServerDisconnectedHandler(server_Disconnected);
}
private void LoadSrvInfoList()
{
}
public void setLoginData(string _LoginName, string _LoginPwd, string _SrvPwd="")
{
LoginName = _LoginName;
LoginPwd = _LoginPwd;
SrvPwd = _SrvPwd;
}
public void server_Disconnected(object handle)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatClient
{
public class Client
{
public Server connectedServer;
public string LoginName;
public string LoginPwd;
public string SrvPwd;
public List<ServerInfo> SrvInfoList;
public Client()
{
SrvInfoList = new List<ServerInfo>();
LoadSrvInfoList();
connectedServer = new Server();
connectedServer.Disconnected += new Server.ServerDisconnectedHandler(server_Disconnected);
}
private void LoadSrvInfoList()
{
}
public void setLoginData(string _LoginName, string _LoginPwd, string _SrvPwd="")
{
LoginName = _LoginName;
LoginPwd = _LoginPwd;
SrvPwd = _SrvPwd;
}
public void server_Disconnected(object handle)
{
}
}
}
|
unlicense
|
C#
|
b99834ccc61a464290021dee7da6f3b9e4618bb5
|
Update BoolConverters.cs
|
SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,akrisiun/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,grokys/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia
|
src/Avalonia.Base/Data/Converters/BoolConverters.cs
|
src/Avalonia.Base/Data/Converters/BoolConverters.cs
|
using System.Linq;
namespace Avalonia.Data.Converters
{
/// <summary>
/// Provides a set of useful <see cref="IValueConverter"/>s for working with bool values.
/// </summary>
public static class BoolConverters
{
/// <summary>
/// A multi-value converter that returns true if all inputs are true.
/// </summary>
public static readonly IMultiValueConverter And =
new FuncMultiValueConverter<bool, bool>(x => x.All(y => y));
}
}
|
using System.Linq;
namespace Avalonia.Data.Converters
{
/// <summary>
/// Provides a set of useful <see cref="IValueConverter"/>s for working with string values.
/// </summary>
public static class BoolConverters
{
/// <summary>
/// A multi-value converter that returns true if all inputs are true.
/// </summary>
public static readonly IMultiValueConverter And =
new FuncMultiValueConverter<bool, bool>(x => x.All(y => y));
}
}
|
mit
|
C#
|
f225445b69b515d0da07cd15dd313406f3d02990
|
Allow to run build even if git repo informations are not available
|
Abc-Arbitrage/Zebus,biarne-a/Zebus
|
build/scripts/utilities.cake
|
build/scripts/utilities.cake
|
#tool "nuget:?package=GitVersion.CommandLine"
#addin "Cake.Yaml"
public class ContextInfo
{
public string NugetVersion { get; set; }
public string AssemblyVersion { get; set; }
public GitVersion Git { get; set; }
public string BuildVersion
{
get { return NugetVersion + "-" + Git.Sha; }
}
}
ContextInfo _versionContext = null;
public ContextInfo VersionContext
{
get
{
if(_versionContext == null)
throw new Exception("The current context has not been read yet. Call ReadContext(FilePath) before accessing the property.");
return _versionContext;
}
}
public ContextInfo ReadContext(FilePath filepath)
{
_versionContext = DeserializeYamlFromFile<ContextInfo>(filepath);
try
{
_versionContext.Git = GitVersion();
}
catch
{
_versionContext.Git = new Cake.Common.Tools.GitVersion.GitVersion();
}
return _versionContext;
}
public void UpdateAppVeyorBuildVersionNumber()
{
var increment = 0;
while(increment < 10)
{
try
{
var version = VersionContext.BuildVersion;
if(increment > 0)
version += "-" + increment;
AppVeyor.UpdateBuildVersion(version);
break;
}
catch
{
increment++;
}
}
}
|
#tool "nuget:?package=GitVersion.CommandLine"
#addin "Cake.Yaml"
public class ContextInfo
{
public string NugetVersion { get; set; }
public string AssemblyVersion { get; set; }
public GitVersion Git { get; set; }
public string BuildVersion
{
get { return NugetVersion + "-" + Git.Sha; }
}
}
ContextInfo _versionContext = null;
public ContextInfo VersionContext
{
get
{
if(_versionContext == null)
throw new Exception("The current context has not been read yet. Call ReadContext(FilePath) before accessing the property.");
return _versionContext;
}
}
public ContextInfo ReadContext(FilePath filepath)
{
_versionContext = DeserializeYamlFromFile<ContextInfo>(filepath);
_versionContext.Git = GitVersion();
return _versionContext;
}
public void UpdateAppVeyorBuildVersionNumber()
{
var increment = 0;
while(increment < 10)
{
try
{
var version = VersionContext.BuildVersion;
if(increment > 0)
version += "-" + increment;
AppVeyor.UpdateBuildVersion(version);
break;
}
catch
{
increment++;
}
}
}
|
mit
|
C#
|
c0e139a152fcea95d3509edbe4fe258913e09c2f
|
Add null checks to BranchCollection
|
GitTools/GitVersion,asbjornu/GitVersion,asbjornu/GitVersion,gep13/GitVersion,GitTools/GitVersion,gep13/GitVersion
|
src/GitVersion.LibGit2Sharp/Git/BranchCollection.cs
|
src/GitVersion.LibGit2Sharp/Git/BranchCollection.cs
|
using GitVersion.Extensions;
using LibGit2Sharp;
namespace GitVersion;
internal sealed class BranchCollection : IBranchCollection
{
private readonly LibGit2Sharp.BranchCollection innerCollection;
internal BranchCollection(LibGit2Sharp.BranchCollection collection)
=> this.innerCollection = collection.NotNull();
public IEnumerator<IBranch> GetEnumerator()
=> this.innerCollection.Select(branch => new Branch(branch)).GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public IBranch? this[string name]
{
get
{
name = name.NotNull();
var branch = this.innerCollection[name];
return branch is null ? null : new Branch(branch);
}
}
public IEnumerable<IBranch> ExcludeBranches(IEnumerable<IBranch> branchesToExclude)
{
branchesToExclude = branchesToExclude.NotNull();
bool BranchIsNotExcluded(IBranch branch)
=> branchesToExclude.All(branchToExclude => !branch.Equals(branchToExclude));
return this.Where(BranchIsNotExcluded);
}
public void UpdateTrackedBranch(IBranch branch, string remoteTrackingReferenceName)
{
var branchToUpdate = (Branch)branch.NotNull();
void Updater(BranchUpdater branchUpdater) =>
branchUpdater.TrackedBranch = remoteTrackingReferenceName;
this.innerCollection.Update(branchToUpdate, Updater);
}
}
|
namespace GitVersion;
internal sealed class BranchCollection : IBranchCollection
{
private readonly LibGit2Sharp.BranchCollection innerCollection;
internal BranchCollection(LibGit2Sharp.BranchCollection collection) => this.innerCollection = collection;
public IEnumerator<IBranch> GetEnumerator() => this.innerCollection.Select(branch => new Branch(branch)).GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public IBranch? this[string name]
{
get
{
var branch = this.innerCollection[name];
return branch is null ? null : new Branch(branch);
}
}
public IEnumerable<IBranch> ExcludeBranches(IEnumerable<IBranch> branchesToExclude) =>
this.Where(b => branchesToExclude.All(bte => !b.Equals(bte)));
public void UpdateTrackedBranch(IBranch branch, string remoteTrackingReferenceName) =>
this.innerCollection.Update((Branch)branch, b => b.TrackedBranch = remoteTrackingReferenceName);
}
|
mit
|
C#
|
b0bf3e3d0652fdd330f11ec55d9057eb16d7b11c
|
Rename Initial Class
|
ajesusflores/IronMatrix
|
IronMatrix/IronMatrix.cs
|
IronMatrix/IronMatrix.cs
|
using System;
namespace IronMatrix
{
public class Vector
{
public int Size { get; set; }
}
}
|
using System;
namespace IronMatrix
{
public class Class1
{
}
}
|
mit
|
C#
|
baa55351b5ed826c5c17279432e2ee49fb4b167e
|
make sure that exception will not break app completely
|
strotz/pustota,strotz/pustota,strotz/pustota
|
src/Pustota.Maven/Validation/RepositoryValidator.cs
|
src/Pustota.Maven/Validation/RepositoryValidator.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Pustota.Maven.Validation
{
class RepositoryValidator
{
private readonly IProjectValidationFactory _factory;
internal RepositoryValidator(IProjectValidationFactory factory)
{
_factory = factory;
}
public IEnumerable<IProjectValidationProblem> Validate(IExecutionContext context)
{
var validators = _factory.BuildProjectValidationSequence().ToArray();
var problems = new List<IProjectValidationProblem>();
foreach (var project in context.AllProjects)
{
foreach (var validator in validators)
{
try
{
var result = validator.Validate(context, project).ToArray();
problems.AddRange(result);
if (result.Any(r => r.Severity == ProblemSeverity.ProjectFatal)) // does not make sense to continue with project
{
break;
}
}
catch (Exception ex)
{
var fatal = new ValidationProblem("fatal")
{
ProjectReference = project,
Severity = ProblemSeverity.ProjectFatal,
Description = string.Format("exception during validation {0}", ex)
};
problems.Add(fatal);
return problems;
}
}
}
return problems;
//ValidateModules();
//ValidateExternalModules();
}
}
}
|
using System.Collections.Generic;
using System.Linq;
namespace Pustota.Maven.Validation
{
class RepositoryValidator
{
private readonly IProjectValidationFactory _factory;
internal RepositoryValidator(IProjectValidationFactory factory)
{
_factory = factory;
}
public IEnumerable<IProjectValidationProblem> Validate(IExecutionContext context)
{
var validators = _factory.BuildProjectValidationSequence().ToArray();
var problems = new List<IProjectValidationProblem>();
foreach (var project in context.AllProjects)
{
foreach (var validator in validators)
{
var result = validator.Validate(context, project).ToArray();
problems.AddRange(result);
if (result.Any(r => r.Severity == ProblemSeverity.ProjectFatal)) // does not make sense to continue with project
{
break;
}
}
}
return problems;
//ValidateProjects();
//ValidateDependencies();
//ValidateModules();
//ValidateExternalModules();
}
}
}
|
mit
|
C#
|
c8d73a9a4560309e0dee20ccbc67618450f9f606
|
Add empty _clear method (#221)
|
IronLanguages/ironpython3,IronLanguages/ironpython3,IronLanguages/ironpython3,IronLanguages/ironpython3,IronLanguages/ironpython3,IronLanguages/ironpython3
|
Src/IronPython.Modules/atexit.cs
|
Src/IronPython.Modules/atexit.cs
|
using System;
using System.Collections.Generic;
using Microsoft.Scripting;
using IronPython.Runtime;
[assembly: PythonModule("atexit", typeof(IronPython.Modules.PythonAtExit))]
namespace IronPython.Modules
{
public static class PythonAtExit
{
public static void register(object func, [ParamDictionary]IDictionary<object, object> kwargs, params object[] args) {
// TODO: implement this
}
public static void unregister(object func) {
// TODO: implement this
}
public static void _clear() {
// TODO: implement this
}
}
}
|
using System;
using System.Collections.Generic;
using Microsoft.Scripting;
using IronPython.Runtime;
[assembly: PythonModule("atexit", typeof(IronPython.Modules.PythonAtExit))]
namespace IronPython.Modules
{
public static class PythonAtExit
{
public static void register(object func, [ParamDictionary]IDictionary<object, object> kwargs, params object[] args) {
// TODO: implement this
}
public static void unregister(object func) {
// TODO: implement this
}
}
}
|
apache-2.0
|
C#
|
217c5774a1c148c66489346fdda63de87665a7ce
|
Add some code to dump known colors
|
KirillOsenkov/ColorTools,KirillOsenkov/ColorTools,KirillOsenkov/ColorTools
|
src/ColorTools/Program.cs
|
src/ColorTools/Program.cs
|
using System;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
class Program
{
[STAThread]
static void Main(string[] args)
{
var app = new Application();
var window = new Window();
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
window.WindowState = WindowState.Maximized;
window.Title = "SystemColors";
var content = new ListBox();
var sb = new StringBuilder();
foreach (var prop in typeof(SystemColors).GetProperties().Where(p => p.PropertyType == typeof(SolidColorBrush)))
{
var brush = prop.GetValue(null) as SolidColorBrush;
var rect = new Rectangle() { Width = 100, Height = 20, Fill = brush };
var panel = new StackPanel() { Orientation = Orientation.Horizontal };
panel.Children.Add(new TextBlock() { Text = prop.Name, Width = 200 });
panel.Children.Add(rect);
panel.Children.Add(new TextBlock() { Text = brush.Color.ToString(), Margin = new Thickness(8, 0, 8, 0) });
content.Items.Add(panel);
}
foreach (var prop in typeof(Colors).GetProperties().Where(p => p.PropertyType == typeof(Color)))
{
var color = (Color)prop.GetValue(null);
sb.AppendLine($"{color.R / 255.0}, {color.G / 255.0}, {color.B / 255.0},");
//sb.AppendLine($"{color.ScR}, {color.ScG}, {color.ScB},");
}
// Clipboard.SetText(sb.ToString());
window.Content = content;
app.Run(window);
}
}
|
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
class Program
{
[STAThread]
static void Main(string[] args)
{
var app = new Application();
var window = new Window();
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
window.WindowState = WindowState.Maximized;
window.Title = "SystemColors";
var content = new ListBox();
foreach (var prop in typeof(SystemColors).GetProperties().Where(p => p.PropertyType == typeof(SolidColorBrush)))
{
var brush = prop.GetValue(null) as SolidColorBrush;
var rect = new Rectangle() { Width = 100, Height = 20, Fill = brush };
var panel = new StackPanel() { Orientation = Orientation.Horizontal };
panel.Children.Add(new TextBlock() { Text = prop.Name, Width = 200 });
panel.Children.Add(rect);
panel.Children.Add(new TextBlock() { Text = brush.Color.ToString(), Margin = new Thickness(8, 0, 8, 0) });
content.Items.Add(panel);
}
window.Content = content;
app.Run(window);
}
}
|
mit
|
C#
|
9898cc174f8e07347dc2d44c3a2cdf63cf823ccf
|
disable reboot upon exit (shutdown)
|
H4ssi/FixPeskyWindowsUpdateReboot
|
pwu/Program.cs
|
pwu/Program.cs
|
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace pwu
{
class Program
{
static void Main(string[] args)
{
HiddenForm f = new HiddenForm();
f.onStart += () =>
{
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
};
f.onExit += () =>
{
SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged;
disableRebootWakeTimer();
};
Application.Run(f);
}
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
{
if (e.Mode != PowerModes.Suspend)
{
return;
}
disableRebootWakeTimer();
}
private static void disableRebootWakeTimer()
{
TaskScheduler.TaskScheduler t = new TaskScheduler.TaskScheduler();
t.Connect();
t.GetFolder("\\Microsoft\\Windows\\UpdateOrchestrator").GetTask("Reboot").Enabled = false;
}
}
}
|
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace pwu
{
class Program
{
static void Main(string[] args)
{
HiddenForm f = new HiddenForm();
f.onStart += () => { SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; };
f.onExit += () => { SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged; };
Application.Run(f);
}
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
{
if (e.Mode != PowerModes.Suspend)
{
return;
}
TaskScheduler.TaskScheduler t = new TaskScheduler.TaskScheduler();
t.Connect();
t.GetFolder("\\Microsoft\\Windows\\UpdateOrchestrator").GetTask("Reboot").Enabled = false;
}
}
}
|
isc
|
C#
|
66af1776f1bbdbe3770634db9ee87adcdec55136
|
Format PermissionsCollection.cs and slightly improve code.
|
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
|
src/MitternachtBot/Modules/Permissions/Common/PermissionsCollection.cs
|
src/MitternachtBot/Modules/Permissions/Common/PermissionsCollection.cs
|
using System;
using System.Collections.Generic;
using Mitternacht.Common;
using Mitternacht.Common.Collections;
namespace Mitternacht.Modules.Permissions.Common {
public class PermissionsCollection<T> : IndexedCollection<T> where T : class, IIndexed {
private readonly object _localLocker = new object();
public PermissionsCollection(IEnumerable<T> source) : base(source) { }
public static implicit operator List<T>(PermissionsCollection<T> x)
=> x.Source;
public override void Clear() {
lock(_localLocker) {
var first = Source[0];
base.Clear();
Source[0] = first;
}
}
public override bool Remove(T item) {
lock(_localLocker) {
if(Source.IndexOf(item) != 0) {
return base.Remove(item);
} else{
throw new ArgumentException("Cannot remove the permission 'allow all'.");
}
}
}
public override void Insert(int index, T item) {
lock(_localLocker) {
if(index != 0) {
base.Insert(index, item);
} else {
throw new IndexOutOfRangeException("Cannot insert permission at index 0. The first permission is always 'allow all'.");
}
}
}
public override void RemoveAt(int index) {
lock(_localLocker) {
if(index != 0) {
base.RemoveAt(index);
} else {
throw new IndexOutOfRangeException("Cannot remove permission at index 0. It is always 'allow all'.");
}
}
}
public override T this[int index] {
get => Source[index];
set {
lock(_localLocker) {
if(index != 0){
base[index] = value;
} else{
throw new IndexOutOfRangeException("Cannot set permission at index 0. The first permission is always 'allow all'.");
}
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using Mitternacht.Common;
using Mitternacht.Common.Collections;
namespace Mitternacht.Modules.Permissions.Common {
public class PermissionsCollection<T> : IndexedCollection<T> where T : class, IIndexed {
private readonly object _localLocker = new object();
public PermissionsCollection(IEnumerable<T> source) : base(source) {
}
public static implicit operator List<T>(PermissionsCollection<T> x) =>
x.Source;
public override void Clear() {
lock(_localLocker) {
var first = Source[0];
base.Clear();
Source[0] = first;
}
}
public override bool Remove(T item) {
bool removed;
lock(_localLocker) {
if(Source.IndexOf(item) == 0)
throw new ArgumentException("You can't remove first permsission (allow all)");
removed = base.Remove(item);
}
return removed;
}
public override void Insert(int index, T item) {
lock(_localLocker) {
if(index == 0) // can't insert on first place. Last item is always allow all.
throw new IndexOutOfRangeException(nameof(index));
base.Insert(index, item);
}
}
public override void RemoveAt(int index) {
lock(_localLocker) {
if(index == 0) // you can't remove first permission (allow all)
throw new IndexOutOfRangeException(nameof(index));
base.RemoveAt(index);
}
}
public override T this[int index] {
get => Source[index];
set {
lock(_localLocker) {
if(index == 0) // can't set first element. It's always allow all
throw new IndexOutOfRangeException(nameof(index));
base[index] = value;
}
}
}
}
}
|
mit
|
C#
|
3f4fd0caeb00f6d1d52e0062273f72cde62fdd9c
|
Update AssemblyInfo
|
generik0/Smooth.IoC.Dapper.Repository.UnitOfWork,generik0/Smooth.IoC.Dapper.Repository.UnitOfWork
|
src/Smooth.IoC.Dapper.Repository.UnitOfWork/Properties/AssemblyInfo.cs
|
src/Smooth.IoC.Dapper.Repository.UnitOfWork/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCopyright("Copyright © Rik Svendsen Rose 2016")]
[assembly: AssemblyProduct("Smoother.IoC.Dapper.FastCRUD.Repository.UnitOfWork")]
[assembly: AssemblyTrademark("")]
// 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
#if NET_46_OR_GREATER
[assembly: Guid("e6550dc7-fc02-4b12-a7b5-ddb684a7760a")]
#else
[assembly: Guid("f9cc3500-59c4-4be2-ab64-7122dc36e4bf")]
#endif
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Smoother.IoC.Dapper.FastCRUD.Repository.UnitOfWork")]
[assembly: AssemblyTrademark("")]
// 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("e6550dc7-fc02-4b12-a7b5-ddb684a7760a")]
|
mit
|
C#
|
112330a50fb537ab831448b45ab34fcc1076117c
|
Add XML documentation
|
akamud/wilson-score-csharp
|
src/WilsonScore/Wilson.cs
|
src/WilsonScore/Wilson.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace WilsonScore
{
public static class Wilson
{
/// <summary>
/// Calculates the Wilson Score based on the total votes and upvotes
/// </summary>
/// <param name="up">Number of upvotes</param>
/// <param name="total">Total number of votes</param>
/// <param name="confidence">Confidence used in calculation, default 1.644853 (95%)</param>
public static double Score(double up, double total, double confidence = 1.644853)
{
/** Based on http://www.evanmiller.org/how-not-to-sort-by-average-rating.html **/
if (total <= 0 || total < up)
return 0;
double phat = up / total;
double z2 = confidence * confidence;
return (phat + z2 / (2 * total) - confidence * Math.Sqrt((phat * (1 - phat) + z2 / (4 * total)) / total)) / (1 + z2 / total);
}
/// <summary>
/// Calculates the Wilson Score based on the total votes and upvotes
/// </summary>
/// <param name="up">Number of upvotes</param>
/// <param name="total">Total number of votes</param>
/// <param name="confidence">Confidence used in calculation, default 1.644853 (95%)</param>
public static double Score(int up, int total, double confidence = 1.644853)
{
return Score((double) up, (double) total, confidence);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace WilsonScore
{
public static class Wilson
{
public static double Score(double up, double total, double confidence = 1.644853)
{
/** Based on http://www.evanmiller.org/how-not-to-sort-by-average-rating.html **/
if (total <= 0 || total < up)
return 0;
double phat = up / total;
double z2 = confidence * confidence;
return (phat + z2 / (2 * total) - confidence * Math.Sqrt((phat * (1 - phat) + z2 / (4 * total)) / total)) / (1 + z2 / total);
}
public static double Score(int up, int total, double confidence = 1.644853)
{
return Score((double) up, (double) total, confidence);
}
}
}
|
mit
|
C#
|
abaa85ffcf7a8425510365be9352530adb4d935d
|
Change username refactoring
|
noordwind/Coolector,noordwind/Coolector.Api,noordwind/Collectively.Api,noordwind/Collectively.Api,noordwind/Coolector.Api,noordwind/Coolector
|
Coolector.Api/Modules/AccountModule.cs
|
Coolector.Api/Modules/AccountModule.cs
|
using Coolector.Api.Commands;
using Coolector.Api.Queries;
using Coolector.Api.Storages;
using Coolector.Api.Validation;
using Coolector.Services.Users.Shared.Commands;
using Coolector.Services.Users.Shared.Dto;
namespace Coolector.Api.Modules
{
public class AccountModule : ModuleBase
{
public AccountModule(ICommandDispatcher commandDispatcher,
IValidatorResolver validatorResolver,
IUserStorage userStorage)
: base(commandDispatcher, validatorResolver)
{
Get("account", async args => await Fetch<GetAccount, UserDto>
(async x => await userStorage.GetAsync(x.UserId)).HandleAsync());
Get("account/names/{name}/available", async args => await Fetch<GetNameAvailability, AvailableResourceDto>
(async x => await userStorage.IsNameAvailableAsync(x.Name)).HandleAsync());
Put("account/name", async args => await For<ChangeUsername>()
.OnSuccessAccepted("account")
.DispatchAsync());
Put("account/avatar", async args => await For<ChangeAvatar>()
.OnSuccessAccepted("account")
.DispatchAsync());
Put("account/password", async args => await For<ChangePassword>()
.OnSuccessAccepted("account")
.DispatchAsync());
}
}
}
|
using Coolector.Api.Commands;
using Coolector.Api.Queries;
using Coolector.Api.Storages;
using Coolector.Api.Validation;
using Coolector.Services.Users.Shared.Commands;
using Coolector.Services.Users.Shared.Dto;
namespace Coolector.Api.Modules
{
public class AccountModule : ModuleBase
{
public AccountModule(ICommandDispatcher commandDispatcher,
IValidatorResolver validatorResolver,
IUserStorage userStorage)
: base(commandDispatcher, validatorResolver)
{
Get("account", async args => await Fetch<GetAccount, UserDto>
(async x => await userStorage.GetAsync(x.UserId)).HandleAsync());
Get("account/names/{name}/available", async args => await Fetch<GetNameAvailability, AvailableResourceDto>
(async x => await userStorage.IsNameAvailableAsync(x.Name)).HandleAsync());
Put("account/name", async args => await For<ChangeUserName>()
.OnSuccessAccepted("account")
.DispatchAsync());
Put("account/avatar", async args => await For<ChangeAvatar>()
.OnSuccessAccepted("account")
.DispatchAsync());
Put("account/password", async args => await For<ChangePassword>()
.OnSuccessAccepted("account")
.DispatchAsync());
}
}
}
|
mit
|
C#
|
c456ef9118356057e2e917420c92113535b5550d
|
Fix namespace
|
lances101/Wox,Wox-launcher/Wox,qianlifeng/Wox,qianlifeng/Wox,qianlifeng/Wox,Wox-launcher/Wox,lances101/Wox
|
Wox.Infrastructure/Logger/Log.cs
|
Wox.Infrastructure/Logger/Log.cs
|
using NLog;
using Wox.Infrastructure.Exception;
namespace Wox.Infrastructure.Logger
{
public class Log
{
private static NLog.Logger logger = LogManager.GetCurrentClassLogger();
public static void Error(System.Exception e)
{
#if DEBUG
throw e;
#else
logger.Error(e.Message + "\r\n" + e.StackTrace);
#endif
}
public static void Debug(string msg)
{
System.Diagnostics.Debug.WriteLine($"DEBUG: {msg}");
logger.Debug(msg);
}
public static void Info(string msg)
{
System.Diagnostics.Debug.WriteLine($"INFO: {msg}");
logger.Info(msg);
}
public static void Warn(string msg)
{
System.Diagnostics.Debug.WriteLine($"WARN: {msg}");
logger.Warn(msg);
}
public static void Fatal(System.Exception e)
{
#if DEBUG
throw e;
#else
logger.Fatal(ExceptionFormatter.FormatExcpetion(e));
#endif
}
}
}
|
using NLog;
namespace Wox.Infrastructure.Logger
{
public class Log
{
private static NLog.Logger logger = LogManager.GetCurrentClassLogger();
public static void Error(System.Exception e)
{
#if DEBUG
throw e;
#else
logger.Error(e.Message + "\r\n" + e.StackTrace);
#endif
}
public static void Debug(string msg)
{
System.Diagnostics.Debug.WriteLine($"DEBUG: {msg}");
logger.Debug(msg);
}
public static void Info(string msg)
{
System.Diagnostics.Debug.WriteLine($"INFO: {msg}");
logger.Info(msg);
}
public static void Warn(string msg)
{
System.Diagnostics.Debug.WriteLine($"WARN: {msg}");
logger.Warn(msg);
}
public static void Fatal(System.Exception e)
{
#if DEBUG
throw e;
#else
logger.Fatal(ExceptionFormatter.FormatExcpetion(e));
#endif
}
}
}
|
mit
|
C#
|
5542dc802e9a7b718093cad4faf8fab22ac48ebe
|
Make PoEItemList implement IReadOnlyList<string>
|
jcmoyer/Yeena
|
Yeena/PathOfExile/PoEItemList.cs
|
Yeena/PathOfExile/PoEItemList.cs
|
// Copyright 2013 J.C. Moyer
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Yeena.PathOfExile {
/// <summary>
/// An item list is a list of items with a name that classifies their type,
/// i.e. Claw has Nailed Fist, Sharktooth Claw, etc...
/// </summary>
[JsonObject]
class PoEItemList : IReadOnlyList<string> {
[JsonProperty("name")]
private readonly string _name;
[JsonProperty("items")]
private readonly List<string> _names;
[JsonConstructor]
private PoEItemList() {
}
public PoEItemList(string name, IEnumerable<string> itemNames) {
_name = name;
_names = new List<string>(itemNames);
}
public IReadOnlyCollection<string> Names {
get { return _names; }
}
public IEnumerator<string> GetEnumerator() {
return _names.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator() {
return GetEnumerator();
}
public int Count {
get { return _names.Count; }
}
public string this[int index] {
get { return _names[index]; }
}
public override string ToString() {
return _name;
}
}
}
|
// Copyright 2013 J.C. Moyer
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Yeena.PathOfExile {
/// <summary>
/// An item list is a list of items with a name that classifies their type,
/// i.e. Claw has Nailed Fist, Sharktooth Claw, etc...
/// </summary>
[JsonObject]
class PoEItemList : IEnumerable<string> {
[JsonProperty("name")]
private readonly string _name;
[JsonProperty("items")]
private readonly List<string> _names;
[JsonConstructor]
private PoEItemList() {
}
public PoEItemList(string name, IEnumerable<string> itemNames) {
_name = name;
_names = new List<string>(itemNames);
}
public IReadOnlyCollection<string> Names {
get { return _names; }
}
public IEnumerator<string> GetEnumerator() {
return _names.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator() {
return GetEnumerator();
}
public override string ToString() {
return _name;
}
}
}
|
apache-2.0
|
C#
|
bf1cd3aa0b484e997c888c43cf5481beac645f25
|
update testing for mesh error minimisation changes
|
ruarai/Trigrad,ruarai/Trigrad
|
TrigradTesting/Program.cs
|
TrigradTesting/Program.cs
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using Trigrad;
using Trigrad.ColorGraders;
using Trigrad.DataTypes;
using Trigrad.DataTypes.Compression;
namespace TrigradTesting
{
class Program
{
static void Main(string[] args)
{
PixelMap inputBitmap = new PixelMap(new Bitmap("tests\\input\\Lenna.png"));
FrequencyTable table = new FrequencyTable(inputBitmap,1, 0.05);
var results = TrigradCompressor.CompressBitmap(inputBitmap, new TrigradOptions { SampleCount = 10000, FrequencyTable = table, ScaleFactor = 1 });
//var results = fauxResults(inputBitmap);
results.DebugVisualisation().Save("tests\\points.png");
results.Save(new FileStream("tests\\out.tri", FileMode.Create));
Console.WriteLine(results.SampleTable.Count);
var returned = TrigradDecompressor.DecompressBitmap(results, inputBitmap);
returned.Output.Bitmap.Save("tests\\output.png");
returned.DebugOutput.Bitmap.Save("tests\\debug_output.png");
errorBitmap(inputBitmap,returned.Output).Bitmap.Save("tests\\error.png");
Console.Beep();
Console.ReadKey();
}
static PixelMap errorBitmap(PixelMap a, PixelMap b)
{
int error = 0;
PixelMap output = new PixelMap(a.Width, a.Height);
for (int x = 0; x < a.Width; x++)
{
for (int y = 0; y < a.Height; y++)
{
Color cA = a[x, y];
Color cB = b[x, y];
error += Math.Abs(cA.R - cB.R);
error += Math.Abs(cA.G - cB.G);
error += Math.Abs(cA.B - cB.B);
output[x,y]= Color.FromArgb(Math.Abs(cA.R - cB.R), Math.Abs(cA.G - cB.G), Math.Abs(cA.B - cB.B));
}
}
Console.WriteLine("{0} error",Math.Round((double)error/(a.Width*a.Height*3),2));
return output;
}
static TrigradCompressed fauxResults(PixelMap input)
{
var results = new TrigradCompressed();
results.Width = input.Width;
results.Height = input.Height;
List<Point> samplePoints = new List<Point>();
samplePoints.Add(new Point(0, 0));
samplePoints.Add(new Point(input.Width - 1, 0));
samplePoints.Add(new Point(0, input.Height - 1));
samplePoints.Add(new Point(input.Width - 1, input.Height - 1));
samplePoints.Add(new Point(128, 128));
samplePoints.Add(new Point(256, 256));
samplePoints.Add(new Point(256 + 128, 256 + 128));
foreach (var samplePoint in samplePoints)
{
results.SampleTable[samplePoint] = Color.Red;
}
return results;
}
}
}
|
using System;
using System.Drawing;
using Trigrad;
using Trigrad.ColorGraders;
using Trigrad.DataTypes;
namespace TrigradTesting
{
class Program
{
static void Main(string[] args)
{
Bitmap inputBitmap = new Bitmap("tests\\Tulips.jpg");
FrequencyTable table = new FrequencyTable(inputBitmap);
var results = TrigradCompressor.CompressBitmap(inputBitmap, new TrigradOptions { SampleCount = 150000, SampleRadius = 0, FrequencyTable = table });
results.DebugVisualisation().Save("tests\\points.png");
Console.WriteLine(results.SampleTable.Count);
var returned = TrigradDecompressor.DecompressBitmap(results);
returned.Output.Save("tests\\output.png");
returned.DebugOutput.Save("tests\\debug_output.png");
returned.MeshOutput.Save("tests\\mesh_output.png");
}
}
}
|
mit
|
C#
|
80c03aa7ffc6cfddaef97543c01fdfec8bd7d4de
|
Revert "Revert "auswertung von tags gebessert""
|
humsp/uebersetzerbauSWP
|
Twee2Z/Analyzer/TweeAnalyzer.cs
|
Twee2Z/Analyzer/TweeAnalyzer.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Antlr4.Runtime;
using Antlr4.Runtime.Misc;
using Antlr4.Runtime.Tree;
namespace Twee2Z.Analyzer
{
public static class TweeAnalyzer
{
public static ObjectTree.Tree Parse(StreamReader input)
{
return Parse2(Lex(input));
}
public static ObjectTree.Tree Parse2(CommonTokenStream input)
{
System.Console.WriteLine("Parse twee file ...");
Twee.StartContext startContext = new Twee(input).start();
TweeVisitor visit = new TweeVisitor();
visit.Visit(startContext);
System.Console.WriteLine("Convert parse tree into object tree ...");
return visit.Tree;
}
public static CommonTokenStream Lex(StreamReader input)
{
System.Console.WriteLine("Lex twee file ...");
AntlrInputStream antlrStream = new AntlrInputStream(input.ReadToEnd());
return new CommonTokenStream(new LEX(antlrStream));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Antlr4.Runtime;
using Antlr4.Runtime.Misc;
using Antlr4.Runtime.Tree;
namespace Twee2Z.Analyzer
{
public static class TweeAnalyzer
{
public static ObjectTree.Tree Parse(StreamReader input)
{
return Parse2(Lex(input));
}
public static ObjectTree.Tree Parse2(CommonTokenStream input)
{
System.Console.WriteLine("Parse twee file ...");
Twee.StartContext startContext = new Twee(input).start();
TweeVisitor visit = new TweeVisitor();
visit.Visit(startContext);
System.Console.WriteLine("Convert parse tree into object tree ...");
return visit.Tree;
}
public static CommonTokenStream Lex(StreamReader input)
{
System.Console.WriteLine("Lex twee file ...");
AntlrInputStream antlrStream = new AntlrInputStream(input.ReadToEnd());
return new CommonTokenStream(new LEX(antlrStream));
}
}
}
|
mit
|
C#
|
cb3a9345bdaed5f9dcc6c30665ee1fb273c061ee
|
Load from environment variables if not in config
|
Red-Folder/docs.functions
|
tests/DocFunctions.Integration/DocFunctionsSteps.cs
|
tests/DocFunctions.Integration/DocFunctionsSteps.cs
|
using DocFunctions.Integration.Helpers;
using System;
using System.Configuration;
using TechTalk.SpecFlow;
using Tests.Common.Helpers;
namespace DocFunctions.Integration
{
[Binding]
public class DocFunctionsSteps
{
[Given(@"I don't already have a blog with name of the current date and time")]
public void GivenIDonTAlreadyHaveABlogWithNameOfTheCurrentDateAndTime()
{
// Generate a new blog name based on the Current Date And Time
var username = ConfigurationManager.AppSettings["github-username"];
if (username == null) username = System.Environment.GetEnvironmentVariable("github-username");
var key = ConfigurationManager.AppSettings["github-key"];
if (key == null) key = System.Environment.GetEnvironmentVariable("github-key");
var repo = ConfigurationManager.AppSettings["github-repo"];
if (repo == null) repo = System.Environment.GetEnvironmentVariable("github-repo");
var github = new GitHub(username, key, repo);
github.CreateTestBog();
// Validate that the blog does not exist direct url - should be 404
// Validate that the blog does not exist on Cloudflared url - should be 404
// Note this will also ensure that the Cloudflare cache has to be cleared (I think)
ScenarioContext.Current.Pending();
}
[When(@"I publish a new blog to my Github repo")]
public void WhenIPublishANewBlogToMyGithubRepo()
{
// Create new blog (meta & md), with image
// Commit to Github repo
// Push Github repo (this should trigger the sequence)
ScenarioContext.Current.Pending();
}
[Then(@"I would expect the blog to be available on my website")]
public void ThenIWouldExpectTheBlogToBeAvailableOnMyWebsite()
{
// Need to allow the DocsFunctions time to run
// Maybe I need to have some way of monitoring the logs?
// Validate that teh blog does exist direct url
// Validate that the blog does exist on Cloudflare url
ScenarioContext.Current.Pending();
}
}
}
|
using DocFunctions.Integration.Helpers;
using System;
using System.Configuration;
using TechTalk.SpecFlow;
using Tests.Common.Helpers;
namespace DocFunctions.Integration
{
[Binding]
public class DocFunctionsSteps
{
[Given(@"I don't already have a blog with name of the current date and time")]
public void GivenIDonTAlreadyHaveABlogWithNameOfTheCurrentDateAndTime()
{
// Generate a new blog name based on the Current Date And Time
var username = ConfigurationManager.AppSettings["github-username"];
var key = ConfigurationManager.AppSettings["github-key"];
var repo = ConfigurationManager.AppSettings["github-repo"];
var github = new GitHub(username, key, repo);
github.CreateTestBog();
// Validate that the blog does not exist direct url - should be 404
// Validate that the blog does not exist on Cloudflared url - should be 404
// Note this will also ensure that the Cloudflare cache has to be cleared (I think)
ScenarioContext.Current.Pending();
}
[When(@"I publish a new blog to my Github repo")]
public void WhenIPublishANewBlogToMyGithubRepo()
{
// Create new blog (meta & md), with image
// Commit to Github repo
// Push Github repo (this should trigger the sequence)
ScenarioContext.Current.Pending();
}
[Then(@"I would expect the blog to be available on my website")]
public void ThenIWouldExpectTheBlogToBeAvailableOnMyWebsite()
{
// Need to allow the DocsFunctions time to run
// Maybe I need to have some way of monitoring the logs?
// Validate that teh blog does exist direct url
// Validate that the blog does exist on Cloudflare url
ScenarioContext.Current.Pending();
}
}
}
|
mit
|
C#
|
67ebb12837449b067fe95feb61d3d805449c8e68
|
Build fix
|
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
|
InfinniPlatform.Utils/ConfigManager.cs
|
InfinniPlatform.Utils/ConfigManager.cs
|
using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using InfinniPlatform.Api.Hosting;
using InfinniPlatform.MetadataDesigner.Views.Exchange;
using InfinniPlatform.MetadataDesigner.Views.Update;
using InfinniPlatform.Sdk.Api;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace InfinniPlatform.Utils
{
public class ConfigManager
{
public void Upload(string solutionDir, bool uploadMetadata)
{
Console.WriteLine("ServiceHost should be executed for this operation.");
Console.WriteLine("All metadata will be DESTROYED!!! Are you sure?");
if (uploadMetadata && Console.ReadKey().KeyChar != 'y')
{
Console.WriteLine("Cancel upload");
return;
}
ProcessSolution(solutionDir, solution =>
{
Console.WriteLine("Uploading solution '{0}' started", solution.Name);
ExchangeDirectorSolution exchangeDirector = CreateExchangeDirector(solution.Name.ToString(), solution.Version.ToString());
dynamic solutionData = null;
if (uploadMetadata)
{
exchangeDirector.UpdateSolutionMetadataFromDirectory(solutionDir);
}
exchangeDirector.UpdateConfigurationAppliedAssemblies(solution);
Console.WriteLine("Uploading solution '{0}' done", solution.Name);
});
}
public void Download(string solutionDir, string solution, string version, string newVersion)
{
Console.WriteLine("Downloading solution '{0}' started", solution);
var exchangeDirector = CreateExchangeDirector(solution, version);
exchangeDirector.ExportJsonSolutionToDirectory(solutionDir, version, newVersion);
Console.WriteLine("Downloading solution '{0}' done", solution);
}
private static void ProcessSolution(string solutionDir, Action<dynamic> action)
{
var solutionFile = Directory.GetFiles(solutionDir)
.FirstOrDefault(file => file.ToLowerInvariant().Contains("solution.json"));
if (solutionFile != null)
{
var jsonSolution = JObject.Parse(File.ReadAllText(solutionFile));
action(jsonSolution);
}
}
private static ExchangeDirectorSolution CreateExchangeDirector(string configName, string version)
{
var remoteHost = new ExchangeRemoteHost(new HostingConfig(), version);
return new ExchangeDirectorSolution(remoteHost, configName);
}
}
}
|
using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using InfinniPlatform.Api.Hosting;
using InfinniPlatform.MetadataDesigner.Views.Exchange;
using InfinniPlatform.MetadataDesigner.Views.Update;
using InfinniPlatform.Sdk.Api;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace InfinniPlatform.Utils
{
public class ConfigManager
{
public void Upload(string solutionDir, bool uploadMetadata)
{
Console.WriteLine("ServiceHost should be executed for this operation.");
Console.WriteLine("All metadata will be DESTROYED!!! Are you sure?");
if (uploadMetadata && Console.ReadKey().KeyChar != 'y')
{
Console.WriteLine("Cancel upload");
return;
}
ProcessConfigurations(config, configuration =>
{
Console.WriteLine("Uploading solution '{0}' started", solution.Name);
ExchangeDirectorSolution exchangeDirector = CreateExchangeDirector(solution.Name.ToString(), solution.Version.ToString());
dynamic solutionData = null;
if (uploadMetadata)
{
exchangeDirector.UpdateSolutionMetadataFromDirectory(solutionDir);
}
exchangeDirector.UpdateConfigurationAppliedAssemblies(solution);
Console.WriteLine("Uploading solution '{0}' done", solution.Name);
});
}
public void Download(string solutionDir, string solution, string version, string newVersion)
{
Console.WriteLine("Downloading solution '{0}' started", solution);
var exchangeDirector = CreateExchangeDirector(solution,version);
exchangeDirector.ExportJsonSolutionToDirectory(solutionDir, version, newVersion);
Console.WriteLine("Downloading solution '{0}' done", solution);
}
private static void ProcessSolution(string solutionDir, Action<dynamic> action)
{
var solutionFile = Directory.GetFiles(solutionDir)
.FirstOrDefault(file => file.ToLowerInvariant().Contains("solution.json"));
if (solutionFile != null)
{
var jsonSolution = JObject.Parse(File.ReadAllText(solutionFile));
action(jsonSolution);
}
}
private static ExchangeDirectorSolution CreateExchangeDirector(string configName, string version)
{
var remoteHost = new ExchangeRemoteHost(new HostingConfig(), version);
return new ExchangeDirectorSolution(remoteHost, configName);
}
}
}
|
agpl-3.0
|
C#
|
e089806577e0afc70eb2f234eee4ea264d44c04e
|
Fix to ensure Delta start time is reset when storage is re-created
|
Pinselohrkater/ef_app-backend-dotnet_core,Pinselohrkater/ef_app-backend-dotnet_core,eurofurence/ef-app_backend-dotnet-core,eurofurence/ef-app_backend-dotnet-core
|
src/Eurofurence.App.Server.Services/Storage/StorageService.cs
|
src/Eurofurence.App.Server.Services/Storage/StorageService.cs
|
using System;
using System.Threading.Tasks;
using Eurofurence.App.Domain.Model.Abstractions;
using Eurofurence.App.Domain.Model.Sync;
using Eurofurence.App.Server.Services.Abstractions;
namespace Eurofurence.App.Server.Services.Storage
{
public class StorageService<T> : IStorageService
{
private readonly IEntityStorageInfoRepository _entityStorageInfoRepository;
private readonly string _entityType;
public StorageService(IEntityStorageInfoRepository entityStorageInfoRepository, string entityType)
{
_entityStorageInfoRepository = entityStorageInfoRepository;
_entityType = entityType;
}
public async Task TouchAsync()
{
var record = await GetEntityStorageRecordAsync();
record.LastChangeDateTimeUtc = DateTime.UtcNow;
await _entityStorageInfoRepository.ReplaceOneAsync(record);
}
public async Task ResetDeltaStartAsync()
{
var record = await GetEntityStorageRecordAsync();
record.DeltaStartDateTimeUtc = DateTime.UtcNow;
await _entityStorageInfoRepository.ReplaceOneAsync(record);
}
public Task<EntityStorageInfoRecord> GetStorageInfoAsync()
{
return GetEntityStorageRecordAsync();
}
private async Task<EntityStorageInfoRecord> GetEntityStorageRecordAsync()
{
var record = await _entityStorageInfoRepository.FindOneAsync(_entityType);
if (record == null)
{
record = new EntityStorageInfoRecord
{
EntityType = _entityType,
DeltaStartDateTimeUtc = DateTime.UtcNow
};
record.NewId();
record.Touch();
await _entityStorageInfoRepository.InsertOneAsync(record);
}
return record;
}
}
}
|
using System;
using System.Threading.Tasks;
using Eurofurence.App.Domain.Model.Abstractions;
using Eurofurence.App.Domain.Model.Sync;
using Eurofurence.App.Server.Services.Abstractions;
namespace Eurofurence.App.Server.Services.Storage
{
public class StorageService<T> : IStorageService
{
private readonly IEntityStorageInfoRepository _entityStorageInfoRepository;
private readonly string _entityType;
public StorageService(IEntityStorageInfoRepository entityStorageInfoRepository, string entityType)
{
_entityStorageInfoRepository = entityStorageInfoRepository;
_entityType = entityType;
}
public async Task TouchAsync()
{
var record = await GetEntityStorageRecordAsync();
record.LastChangeDateTimeUtc = DateTime.UtcNow;
await _entityStorageInfoRepository.ReplaceOneAsync(record);
}
public async Task ResetDeltaStartAsync()
{
var record = await GetEntityStorageRecordAsync();
record.DeltaStartDateTimeUtc = DateTime.UtcNow;
await _entityStorageInfoRepository.ReplaceOneAsync(record);
}
public Task<EntityStorageInfoRecord> GetStorageInfoAsync()
{
return GetEntityStorageRecordAsync();
}
private async Task<EntityStorageInfoRecord> GetEntityStorageRecordAsync()
{
var record = await _entityStorageInfoRepository.FindOneAsync(_entityType);
if (record == null)
{
record = new EntityStorageInfoRecord {EntityType = _entityType};
record.NewId();
record.Touch();
await _entityStorageInfoRepository.InsertOneAsync(record);
}
return record;
}
}
}
|
mit
|
C#
|
bc4cb0ef3288ccd15211ef3ef5043cea7915285a
|
fix for #25 - removed reflection only assembly loading
|
uComponents/nuPickers,abjerner/nuPickers,abjerner/nuPickers,pgregorynz/nuPickers,iahdevelop/nuPickers,pgregorynz/nuPickers,iahdevelop/nuPickers,LottePitcher/nuPickers,pgregorynz/nuPickers,abjerner/nuPickers,pgregorynz/nuPickers,uComponents/nuPickers,JimBobSquarePants/nuPickers,JimBobSquarePants/nuPickers,iahdevelop/nuPickers,LottePitcher/nuPickers,uComponents/nuPickers,LottePitcher/nuPickers,JimBobSquarePants/nuPickers
|
source/nuPickers/Helper.cs
|
source/nuPickers/Helper.cs
|
namespace nuPickers
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Web.Hosting;
internal static class Helper
{
internal static IEnumerable<string> GetAssemblyNames()
{
List<string> assemblyNames = new List<string>();
// check if the App_Code directory exists and has any files
DirectoryInfo appCode = new DirectoryInfo(HostingEnvironment.MapPath("~/App_Code"));
if (appCode.Exists && appCode.GetFiles().Length > 0)
{
assemblyNames.Add(appCode.Name);
}
// add assemblies from the /bin directory
assemblyNames.AddRange(Directory.GetFiles(HostingEnvironment.MapPath("~/bin"), "*.dll").Select(x => x.Substring(x.LastIndexOf('\\') + 1)));
return assemblyNames;
}
internal static Assembly GetAssembly(string assemblyName)
{
if (string.Equals(assemblyName, "App_Code", StringComparison.InvariantCultureIgnoreCase))
{
return Assembly.Load(assemblyName);
}
string assemblyFilePath = HostingEnvironment.MapPath(string.Concat("~/bin/", assemblyName));
if (!string.IsNullOrEmpty(assemblyFilePath))
{
return Assembly.LoadFile(assemblyFilePath);
}
return null;
}
}
}
|
namespace nuPickers
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Hosting;
using umbraco;
internal static class Helper
{
/// <summary>
///
/// </summary>
/// <returns></returns>
internal static IEnumerable<string> GetAssemblyNames()
{
List<string> assemblyNames = new List<string>();
// check if the App_Code directory exists and has any files
DirectoryInfo appCode = new DirectoryInfo(HostingEnvironment.MapPath("~/App_Code"));
if (appCode.Exists && appCode.GetFiles().Length > 0)
{
assemblyNames.Add(appCode.Name);
}
// add assemblies from the /bin directory
assemblyNames.AddRange(Directory.GetFiles(HostingEnvironment.MapPath("~/bin"), "*.dll").Select(x => x.Substring(x.LastIndexOf('\\') + 1)));
return assemblyNames;
}
/// <summary>
/// Gets the <see cref="Assembly"/> with the specified name.
/// </summary>
/// <remarks>Works in Medium Trust.</remarks>
/// <param name="assemblyName">The <see cref="Assembly"/> name.</param>
/// <returns>The <see cref="Assembly"/>.</returns>
internal static Assembly GetAssembly(string assemblyName)
{
AspNetHostingPermissionLevel appTrustLevel = GlobalSettings.ApplicationTrustLevel;
if (appTrustLevel == AspNetHostingPermissionLevel.Unrestricted)
{
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += (sender, args) =>
{
return Assembly.ReflectionOnlyLoad(args.Name);
};
}
if (string.Equals(assemblyName, "App_Code", StringComparison.InvariantCultureIgnoreCase))
{
return Assembly.Load(assemblyName);
}
string assemblyFilePath = HostingEnvironment.MapPath(string.Concat("~/bin/", assemblyName));
if (!string.IsNullOrEmpty(assemblyFilePath))
{
if (appTrustLevel == AspNetHostingPermissionLevel.Unrestricted)
{
return Assembly.ReflectionOnlyLoadFrom(assemblyFilePath);
}
else
{
// Medium Trust support
return Assembly.LoadFile(assemblyFilePath);
}
}
return null;
}
}
}
|
mit
|
C#
|
d691151fb3dbcec37453109c958b17073ef5893a
|
Add empty list test to Serialization.cs
|
rschacherl/minecraft.client,bleroy/minecraft.client,Petermarcu/minecraft.client
|
Minecraft.Client.Test/Serialization.cs
|
Minecraft.Client.Test/Serialization.cs
|
using System.Collections;
using Xunit;
namespace Decent.Minecraft.Client.Test
{
public class Serialization
{
[Theory,
InlineData(new object[] { }, ""),
InlineData(new[] { 1, 2, 3 }, "1,2,3"),
InlineData("foo", "foo"),
InlineData(new object[] { 1, "foo", 2.3 }, "1,foo,2.3"),
InlineData(new object[] {
1, new[] { 2.1, 2.2, 2.3 }, new object[] {3.1, new[] { 3.21, 3.22 } }, 4},
"1,2.1,2.2,2.3,3.1,3.21,3.22,4")]
public void FlattenListGivesCorrectString(IEnumerable list, string expectedOutput)
{
Assert.Equal(expectedOutput, Util.FlattenToString(list));
}
}
}
|
using System.Collections;
using Xunit;
namespace Decent.Minecraft.Client.Test
{
public class Serialization
{
[Theory,
InlineData(new[] { 1, 2, 3 }, "1,2,3"),
InlineData("foo", "foo"),
InlineData(new object[] { 1, "foo", 2.3 }, "1,foo,2.3"),
InlineData(new object[] {
1, new[] { 2.1, 2.2, 2.3 }, new object[] {3.1, new[] { 3.21, 3.22 } }, 4},
"1,2.1,2.2,2.3,3.1,3.21,3.22,4")]
public void FlattenListGivesCorrectString(IEnumerable list, string expectedOutput)
{
Assert.Equal(expectedOutput, Util.FlattenToString(list));
}
}
}
|
mit
|
C#
|
6b5d50b690f845472a9d52771b3a2227c620e702
|
Update AssemblyInfo.cs
|
Worthy1/EBScript
|
Fiddlesticks/Fiddlesticks/Properties/AssemblyInfo.cs
|
Fiddlesticks/Fiddlesticks/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("Fiddlesticks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Fiddlesticks")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d03110fb-daf9-43d4-9d0a-d0d2204476e7")]
// 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("7.5.1.5")]
[assembly: AssemblyFileVersion("7.5.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("Fiddlesticks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Fiddlesticks")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d03110fb-daf9-43d4-9d0a-d0d2204476e7")]
// 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")]
|
apache-2.0
|
C#
|
953f7a999556611fa20fb2f57c3552271f4becd6
|
Revert "Added place to output products"
|
ckuhn203/VendingMachineKata
|
VendingMachine/VendingMachine.Core/VendingMachine.cs
|
VendingMachine/VendingMachine.Core/VendingMachine.cs
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Vending.Core
{
public class VendingMachine
{
private readonly List<Coin> _coins = new List<Coin>();
private readonly List<Coin> _returnTray = new List<Coin>();
public IEnumerable<Coin> ReturnTray => _returnTray;
public void Dispense(string soda)
{
}
public void Accept(Coin coin)
{
if (coin.Value() == 0)
{
_returnTray.Add(coin);
return;
}
_coins.Add(coin);
}
public string GetDisplayText()
{
if (!_coins.Any())
{
return "INSERT COIN";
}
return $"{CurrentTotal():C}";
}
private decimal CurrentTotal()
{
var counts = new Dictionary<Coin, int>()
{
{Coin.Nickel, 0},
{Coin.Dime, 0},
{Coin.Quarter, 0}
};
foreach (var coin in _coins)
{
counts[coin]++;
}
decimal total = 0;
foreach (var coinCount in counts)
{
total += (coinCount.Value * coinCount.Key.Value());
}
return ConvertCentsToDollars(total);
}
private static decimal ConvertCentsToDollars(decimal total)
{
return total / 100;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Vending.Core
{
public class VendingMachine
{
private readonly List<Coin> _coins = new List<Coin>();
private readonly List<Coin> _returnTray = new List<Coin>();
private readonly List<string> _output = new List<string>();
public IEnumerable<Coin> ReturnTray => _returnTray;
public IEnumerable<string> Output => _output;
public void Dispense(string sku)
{
_output.Add(sku);
}
public void Accept(Coin coin)
{
if (coin.Value() == 0)
{
_returnTray.Add(coin);
return;
}
_coins.Add(coin);
}
public string GetDisplayText()
{
if (!_coins.Any())
{
return "INSERT COIN";
}
return $"{CurrentTotal():C}";
}
private decimal CurrentTotal()
{
var counts = new Dictionary<Coin, int>()
{
{Coin.Nickel, 0},
{Coin.Dime, 0},
{Coin.Quarter, 0}
};
foreach (var coin in _coins)
{
counts[coin]++;
}
decimal total = 0;
foreach (var coinCount in counts)
{
total += (coinCount.Value * coinCount.Key.Value());
}
return ConvertCentsToDollars(total);
}
private static decimal ConvertCentsToDollars(decimal total)
{
return total / 100;
}
}
}
|
mit
|
C#
|
d9368c6570bb7102fbc21ba793461aed37f96a78
|
fix deserialization
|
ArsenShnurkov/BitSharp
|
BitSharp.Storage.Esent/BlockRollbackStorage.cs
|
BitSharp.Storage.Esent/BlockRollbackStorage.cs
|
using BitSharp.Common;
using BitSharp.Common.ExtensionMethods;
using BitSharp.Storage;
using BitSharp.Network;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitSharp.Data;
using System.Data.SqlClient;
using System.Collections.Immutable;
using System.IO;
namespace BitSharp.Storage.Esent
{
public class BlockRollbackStorage : EsentDataStorage<IImmutableList<KeyValuePair<UInt256, UInt256>>>, IBlockRollbackStorage
{
public BlockRollbackStorage(string baseDirectory)
: base(baseDirectory, "blockRollback",
keyPairs =>
{
var bytes = new byte[keyPairs.Count * 32 * 2];
for (var i = 0; i < keyPairs.Count; i++)
{
Buffer.BlockCopy(keyPairs[i].Key.ToByteArray(), 0, bytes, i * 64, 32);
Buffer.BlockCopy(keyPairs[i].Value.ToByteArray(), 0, bytes, i * 64 + 32, 32);
}
return bytes;
},
(blockHash, bytes) =>
{
var keyPairs = ImmutableList.CreateBuilder<KeyValuePair<UInt256, UInt256>>();
var txHashBytes = new byte[32];
var blockHashBytes = new byte[32];
for (var i = 0; i < bytes.Length; i += 64)
{
Buffer.BlockCopy(bytes, i, txHashBytes, 0, 32);
Buffer.BlockCopy(bytes, i + 32, blockHashBytes, 0, 32);
var keyPair = new KeyValuePair<UInt256, UInt256>(new UInt256(txHashBytes), new UInt256(blockHashBytes));
keyPairs.Add(keyPair);
}
return keyPairs.ToImmutable();
})
{ }
}
}
|
using BitSharp.Common;
using BitSharp.Common.ExtensionMethods;
using BitSharp.Storage;
using BitSharp.Network;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitSharp.Data;
using System.Data.SqlClient;
using System.Collections.Immutable;
using System.IO;
namespace BitSharp.Storage.Esent
{
public class BlockRollbackStorage : EsentDataStorage<IImmutableList<KeyValuePair<UInt256, UInt256>>>, IBlockRollbackStorage
{
public BlockRollbackStorage(string baseDirectory)
: base(baseDirectory, "blockRollback",
keyPairs =>
{
var bytes = new byte[keyPairs.Count * 32 * 2];
for (var i = 0; i < keyPairs.Count; i++)
{
Buffer.BlockCopy(keyPairs[i].Key.ToByteArray(), 0, bytes, i * 64, 32);
Buffer.BlockCopy(keyPairs[i].Value.ToByteArray(), 0, bytes, i * 64 + 32, 32);
}
return bytes;
},
(blockHash, bytes) =>
{
var keyPairs = ImmutableList.CreateBuilder<KeyValuePair<UInt256, UInt256>>();
var txHashBytes = new byte[32];
var blockHashBytes = new byte[32];
for (var i = 0; i < bytes.Length; i += 64)
{
Buffer.BlockCopy(bytes, i, txHashBytes, 0, 32);
Buffer.BlockCopy(bytes, i + 32, blockHashBytes, 0, 32);
var keyPair = new KeyValuePair<UInt256, UInt256>(new UInt256(txHashBytes), new UInt256(blockHashBytes));
}
return keyPairs.ToImmutable();
})
{ }
}
}
|
unlicense
|
C#
|
5329fc0d43a29c282dc1bfd1071e04e0d984577c
|
Update scene path in AutomationManager
|
virneo/unity3d-opencog-game,opencog/unity3d-opencog-game,opencog/unity3d-opencog-game,opencog/unity3d-opencog-game,virneo/unity3d-opencog-game,virneo/unity3d-opencog-game
|
Assets/Editor/AutomationManager/AutomationManager.cs
|
Assets/Editor/AutomationManager/AutomationManager.cs
|
using UnityEditor;
/// <summary>
/// Automation manager for player building and unit testing.
/// Example commandline usage:
/// "C:\Program Files (x86)\Unity\Editor\Unity.exe" -batchMode -quit -nographics -projectPath C:\project -executeMethod AutomationManager.BuildAll
/// </summary>
public class AutomationManager
{
[MenuItem ("Build/BuildAll")]
static void BuildAll()
{
BuildStandaloneLinuxPlayer();
BuildStandaloneLinux64Player();
BuildStandaloneWindowsPlayer();
BuildStandaloneWindows64Player();
}
[MenuItem ("Build/BuildStandaloneLinux64Player")]
static void BuildStandaloneLinux64Player()
{
string[] scenes = { "Assets/OpenCog Assets/Scenes/Game/Game.unity" };
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneLinux64);
BuildPipeline.BuildPlayer(scenes
, "Players/Unity3DGameWorldPlayer_Linux64"
, BuildTarget.StandaloneLinux64, BuildOptions.None );
}
[MenuItem ("Build/BuildStandaloneLinuxPlayer")]
static void BuildStandaloneLinuxPlayer()
{
string[] scenes = { "Assets/OpenCog Assets/Scenes/Game/Game.unity" };
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneLinux);
BuildPipeline.BuildPlayer(scenes
, "Players/Unity3DGameWorldPlayer_Linux"
, BuildTarget.StandaloneLinux, BuildOptions.None );
}
[MenuItem ("Build/BuildStandaloneWindowsPlayer")]
static void BuildStandaloneWindowsPlayer()
{
string[] scenes = { "Assets/OpenCog Assets/Scenes/Game/Game.unity" };
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows);
BuildPipeline.BuildPlayer(scenes
, "Players/Unity3DGameWorldPlayer_Windows.exe"
, BuildTarget.StandaloneWindows, BuildOptions.None );
}
[MenuItem ("Build/BuildStandaloneWindows64Player")]
static void BuildStandaloneWindows64Player()
{
string[] scenes = { "Assets/OpenCog Assets/Scenes/Game/Game.unity" };
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows64);
BuildPipeline.BuildPlayer(scenes
, "Players/Unity3DGameWorldPlayer_Windows64.exe"
, BuildTarget.StandaloneWindows64, BuildOptions.None );
}
}
|
using UnityEditor;
/// <summary>
/// Automation manager for player building and unit testing.
/// Example commandline usage:
/// "C:\Program Files (x86)\Unity\Editor\Unity.exe" -batchMode -quit -nographics -projectPath C:\project -executeMethod AutomationManager.BuildAll
/// </summary>
public class AutomationManager
{
[MenuItem ("Build/BuildAll")]
static void BuildAll()
{
BuildStandaloneLinuxPlayer();
BuildStandaloneLinux64Player();
BuildStandaloneWindowsPlayer();
BuildStandaloneWindows64Player();
}
[MenuItem ("Build/BuildStandaloneLinux64Player")]
static void BuildStandaloneLinux64Player()
{
string[] scenes = { "Assets/Scenes/GameScenes/MainGameScene.unity" };
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneLinux64);
BuildPipeline.BuildPlayer(scenes
, "Players/Unity3DGameWorldPlayer_Linux64"
, BuildTarget.StandaloneLinux64, BuildOptions.None );
}
[MenuItem ("Build/BuildStandaloneLinuxPlayer")]
static void BuildStandaloneLinuxPlayer()
{
string[] scenes = { "Assets/Scenes/GameScenes/MainGameScene.unity" };
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneLinux);
BuildPipeline.BuildPlayer(scenes
, "Players/Unity3DGameWorldPlayer_Linux"
, BuildTarget.StandaloneLinux, BuildOptions.None );
}
[MenuItem ("Build/BuildStandaloneWindowsPlayer")]
static void BuildStandaloneWindowsPlayer()
{
string[] scenes = { "Assets/Scenes/GameScenes/MainGameScene.unity" };
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows);
BuildPipeline.BuildPlayer(scenes
, "Players/Unity3DGameWorldPlayer_Windows.exe"
, BuildTarget.StandaloneWindows, BuildOptions.None );
}
[MenuItem ("Build/BuildStandaloneWindows64Player")]
static void BuildStandaloneWindows64Player()
{
string[] scenes = { "Assets/Scenes/GameScenes/MainGameScene.unity" };
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows64);
BuildPipeline.BuildPlayer(scenes
, "Players/Unity3DGameWorldPlayer_Windows64.exe"
, BuildTarget.StandaloneWindows64, BuildOptions.None );
}
}
|
agpl-3.0
|
C#
|
bdbc8eb326187ae9322125b48310b7a48591e7d1
|
Update version to 0.4.0
|
elcattivo/CloudFlareUtilities
|
CloudFlareUtilities/Properties/AssemblyInfo.cs
|
CloudFlareUtilities/Properties/AssemblyInfo.cs
|
using System;
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CloudFlare Utilities")]
[assembly: AssemblyDescription("A .NET PCL to bypass Cloudflare's Anti-DDoS measure (JavaScript challenge) using a DelegatingHandler.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("El Cattivo")]
[assembly: AssemblyProduct("CloudFlare Utilities")]
[assembly: AssemblyCopyright("Copyright © El Cattivo 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyFileVersion("0.4.0.0")]
[assembly: AssemblyInformationalVersion("0.4.0-alpha")]
[assembly:CLSCompliant(true)]
[assembly:ComVisible(false)]
[assembly: InternalsVisibleTo("CloudFlareUtilities.Tests")]
|
using System;
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CloudFlare Utilities")]
[assembly: AssemblyDescription("A .NET PCL to bypass Cloudflare's Anti-DDoS measure (JavaScript challenge) using a DelegatingHandler.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("El Cattivo")]
[assembly: AssemblyProduct("CloudFlare Utilities")]
[assembly: AssemblyCopyright("Copyright © El Cattivo 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.3.3.0")]
[assembly: AssemblyFileVersion("0.3.3.0")]
[assembly: AssemblyInformationalVersion("0.3.3-alpha")]
[assembly:CLSCompliant(true)]
[assembly:ComVisible(false)]
[assembly: InternalsVisibleTo("CloudFlareUtilities.Tests")]
|
mit
|
C#
|
1bf5903cd63cc03b8d5c804e3c908da76c185fdd
|
Add Create method to SpectrumCycling system effect
|
WolfspiritM/Colore,CoraleStudios/Colore
|
Corale.Colore/Razer/Effects/SpectrumCycling.cs
|
Corale.Colore/Razer/Effects/SpectrumCycling.cs
|
// <copyright file="SpectrumCycling.cs" company="Corale">
// Copyright © 2015-2016 by Adam Hellberg and Brandon Scott.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
namespace Corale.Colore.Razer.Effects
{
using System.Runtime.InteropServices;
using Corale.Colore.Annotations;
/// <summary>
/// Describes the spectrum cycling effect for system devices.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct SpectrumCycling
{
/// <summary>
/// The size of the struct.
/// </summary>
[PublicAPI]
public readonly int Size;
/// <summary>
/// Additional effect parameter.
/// </summary>
[PublicAPI]
public readonly int Parameter;
/// <summary>
/// Initializes a new instance of the <see cref="SpectrumCycling" /> struct.
/// </summary>
/// <param name="parameter">Additional effect parameter to set.</param>
public SpectrumCycling(int parameter)
{
Parameter = parameter;
Size = Marshal.SizeOf(typeof(None));
}
/// <summary>
/// Creates a new instance of the <see cref="SpectrumCycling" /> struct
/// with default values.
/// </summary>
/// <returns>A new instance of the <see cref="SpectrumCycling" /> struct.</returns>
public static SpectrumCycling Create()
{
return new SpectrumCycling(0);
}
}
}
|
// <copyright file="SpectrumCycling.cs" company="Corale">
// Copyright © 2015-2016 by Adam Hellberg and Brandon Scott.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
namespace Corale.Colore.Razer.Effects
{
using System.Runtime.InteropServices;
using Corale.Colore.Annotations;
/// <summary>
/// Describes the spectrum cycling effect for system devices.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct SpectrumCycling
{
/// <summary>
/// The size of the struct.
/// </summary>
[PublicAPI]
public readonly int Size;
/// <summary>
/// Additional effect parameter.
/// </summary>
[PublicAPI]
public readonly int Parameter;
/// <summary>
/// Initializes a new instance of the <see cref="SpectrumCycling" /> struct.
/// </summary>
/// <param name="parameter">Additional effect parameter to set.</param>
public SpectrumCycling(int parameter = 0)
{
Parameter = parameter;
Size = Marshal.SizeOf(typeof(None));
}
}
}
|
mit
|
C#
|
cd0dba1e89fa2aeb7e58456e855949f811e22125
|
Add [HttpPost]
|
fmassaretto/formacao-talentos,fmassaretto/formacao-talentos,fmassaretto/formacao-talentos
|
Fatec.Treinamento.Web/Controllers/CursoController.cs
|
Fatec.Treinamento.Web/Controllers/CursoController.cs
|
using Fatec.Treinamento.Data.Repositories;
using Fatec.Treinamento.Model.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Fatec.Treinamento.Web.Controllers
{
public class CursoController : Controller
{
// GET: Curso
[HttpPost]
public ActionResult Pesquisar(string txtPesquisaCurso)
{
IEnumerable<DetalhesCurso> lista = new List<DetalhesCurso>();
using (CursoRepository repo = new CursoRepository())
{
lista = repo.ListarCursosPorNome(txtPesquisaCurso);
}
return View(lista);
}
}
}
|
using Fatec.Treinamento.Data.Repositories;
using Fatec.Treinamento.Model.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Fatec.Treinamento.Web.Controllers
{
public class CursoController : Controller
{
// GET: Curso
public ActionResult Pesquisar(string txtPesquisaCurso)
{
IEnumerable<DetalhesCurso> lista = new List<DetalhesCurso>();
using (CursoRepository repo = new CursoRepository())
{
lista = repo.ListarCursosPorNome(txtPesquisaCurso);
}
return View(lista);
}
}
}
|
apache-2.0
|
C#
|
4daa29179aa6c07e5f32fb92ace14956a6d6fdf9
|
add Comments method to ImagesController
|
ramzzzay/GalleryMVC_With_Auth,ramzzzay/GalleryMVC_With_Auth,ramzzzay/GalleryMVC_With_Auth
|
GalleryMVC_With_Auth/Controllers/ImagesController.cs
|
GalleryMVC_With_Auth/Controllers/ImagesController.cs
|
using System.Data.Entity.Migrations;
using System.Linq;
using System.Web.Mvc;
using GalleryMVC_With_Auth.CustomFilters;
using GalleryMVC_With_Auth.Domain.Abstract;
using GalleryMVC_With_Auth.Domain.Entities;
using GalleryMVC_With_Auth.Models;
using GalleryMVC_With_Auth.Resources;
using Microsoft.AspNet.Identity;
namespace GalleryMVC_With_Auth.Controllers
{
public class ImagesController : Controller
{
private readonly IPicturesRepository _repository;
public ImagesController(IPicturesRepository repository)
{
_repository = repository;
}
public ActionResult Universal(int Id)
{
return View(_repository.Pictures.Where(p => p.AlbumId == Id).ToList());
}
[AuthLog(Roles = Defines.UserRole+","+ Defines.AdminRole)]
public ActionResult Comments(int Id)
{
return View(_repository.Comments.Where(c=>c.PictureID == Id).ToList());
}
[AuthLog(Roles = Defines.UserRole + "," + Defines.AdminRole)]
[HttpPost]
public ActionResult Comments(CommentModel comm,int Id)
{
if (!ModelState.IsValid) return View(_repository.Comments.Where(c => c.PictureID == Id).ToList());
_repository.Comments.Add(new Comment { PictureID = Id, UserId = User.Identity.GetUserId(), Text = comm.Text });
_repository.Save();
return View(_repository.Comments.Where(c => c.PictureID == Id).ToList());
}
}
}
|
using System.Linq;
using System.Web.Mvc;
using GalleryMVC_With_Auth.Domain.Abstract;
namespace GalleryMVC_With_Auth.Controllers
{
public class ImagesController : Controller
{
private readonly IPicturesRepository _repository;
public ImagesController(IPicturesRepository repository)
{
_repository = repository;
}
public ActionResult Universal(int Id)
{
return View(_repository.Pictures.Where(p => p.AlbumId == Id).ToList());
}
}
}
|
apache-2.0
|
C#
|
63c8a2ee1d183f10121d936b0f23f5e44ff276d6
|
Increase JetBrains.ReSharper.CommandLineTools version Fixes #145 - DupFinder and InspectCode tasks for not recognise V15.3 of Visual Studio and give warnings in log.
|
cake-contrib/Cake.Recipe,cake-contrib/Cake.Recipe
|
Cake.Recipe/Content/tools.cake
|
Cake.Recipe/Content/tools.cake
|
///////////////////////////////////////////////////////////////////////////////
// TOOLS
///////////////////////////////////////////////////////////////////////////////
private const string CodecovTool = "#tool nuget:?package=codecov&version=1.0.1";
private const string CoverallsTool = "#tool nuget:?package=coveralls.io&version=1.3.4";
private const string GitReleaseManagerTool = "#tool nuget:?package=gitreleasemanager&version=0.5.0";
private const string GitVersionTool = "#tool nuget:?package=GitVersion.CommandLine&version=3.6.2";
private const string ReSharperTools = "#tool nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2017.2.0";
private const string ReSharperReportsTool = "#tool nuget:?package=ReSharperReports&version=0.2.0";
private const string KuduSyncTool = "#tool nuget:?package=KuduSync.NET&version=1.3.1";
private const string WyamTool = "#tool nuget:?package=Wyam&version=0.17.7";
private const string GitLinkTool = "#tool nuget:?package=gitlink&version=2.4.0";
private const string MSBuildExtensionPackTool = "#tool nuget:?package=MSBuild.Extension.Pack&version=1.9.0";
private const string XUnitTool = "#tool nuget:?package=xunit.runner.console&version=2.1.0";
private const string NUnitTool = "#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.1";
private const string OpenCoverTool = "#tool nuget:?package=OpenCover&version=4.6.519";
private const string ReportGeneratorTool = "#tool nuget:?package=ReportGenerator&version=2.4.5";
private const string ReportUnitTool = "#tool nuget:?package=ReportUnit&version=1.2.1";
private const string FixieTool = "#tool nuget:?package=Fixie&version=1.0.2";
Action<string, Action> RequireTool = (tool, action) => {
var script = MakeAbsolute(File(string.Format("./{0}.cake", Guid.NewGuid())));
try
{
System.IO.File.WriteAllText(script.FullPath, tool);
CakeExecuteScript(script);
}
finally
{
if (FileExists(script))
{
DeleteFile(script);
}
}
action();
};
|
///////////////////////////////////////////////////////////////////////////////
// TOOLS
///////////////////////////////////////////////////////////////////////////////
private const string CodecovTool = "#tool nuget:?package=codecov&version=1.0.1";
private const string CoverallsTool = "#tool nuget:?package=coveralls.io&version=1.3.4";
private const string GitReleaseManagerTool = "#tool nuget:?package=gitreleasemanager&version=0.5.0";
private const string GitVersionTool = "#tool nuget:?package=GitVersion.CommandLine&version=3.6.2";
private const string ReSharperTools = "#tool nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2017.1.20170428.83814";
private const string ReSharperReportsTool = "#tool nuget:?package=ReSharperReports&version=0.2.0";
private const string KuduSyncTool = "#tool nuget:?package=KuduSync.NET&version=1.3.1";
private const string WyamTool = "#tool nuget:?package=Wyam&version=0.17.7";
private const string GitLinkTool = "#tool nuget:?package=gitlink&version=2.4.0";
private const string MSBuildExtensionPackTool = "#tool nuget:?package=MSBuild.Extension.Pack&version=1.9.0";
private const string XUnitTool = "#tool nuget:?package=xunit.runner.console&version=2.1.0";
private const string NUnitTool = "#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.1";
private const string OpenCoverTool = "#tool nuget:?package=OpenCover&version=4.6.519";
private const string ReportGeneratorTool = "#tool nuget:?package=ReportGenerator&version=2.4.5";
private const string ReportUnitTool = "#tool nuget:?package=ReportUnit&version=1.2.1";
private const string FixieTool = "#tool nuget:?package=Fixie&version=1.0.2";
Action<string, Action> RequireTool = (tool, action) => {
var script = MakeAbsolute(File(string.Format("./{0}.cake", Guid.NewGuid())));
try
{
System.IO.File.WriteAllText(script.FullPath, tool);
CakeExecuteScript(script);
}
finally
{
if (FileExists(script))
{
DeleteFile(script);
}
}
action();
};
|
mit
|
C#
|
c189b6de6c2505e190de16c191bb66feae33394a
|
Update src/Workspaces/Core/Portable/Diagnostics/DiagnosticMode.cs
|
dotnet/roslyn,sharwell/roslyn,AlekseyTs/roslyn,wvdd007/roslyn,panopticoncentral/roslyn,panopticoncentral/roslyn,tmat/roslyn,diryboy/roslyn,dotnet/roslyn,stephentoub/roslyn,physhi/roslyn,bartdesmet/roslyn,gafter/roslyn,panopticoncentral/roslyn,mavasani/roslyn,stephentoub/roslyn,KevinRansom/roslyn,weltkante/roslyn,tmat/roslyn,dotnet/roslyn,heejaechang/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,KirillOsenkov/roslyn,ErikSchierboom/roslyn,AmadeusW/roslyn,bartdesmet/roslyn,wvdd007/roslyn,weltkante/roslyn,tannergooding/roslyn,jasonmalinowski/roslyn,heejaechang/roslyn,jasonmalinowski/roslyn,gafter/roslyn,mgoertz-msft/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,physhi/roslyn,AmadeusW/roslyn,diryboy/roslyn,tannergooding/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,physhi/roslyn,ErikSchierboom/roslyn,tmat/roslyn,diryboy/roslyn,wvdd007/roslyn,bartdesmet/roslyn,gafter/roslyn,ErikSchierboom/roslyn,heejaechang/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,mgoertz-msft/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,weltkante/roslyn,eriawan/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn
|
src/Workspaces/Core/Portable/Diagnostics/DiagnosticMode.cs
|
src/Workspaces/Core/Portable/Diagnostics/DiagnosticMode.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CodeAnalysis.Diagnostics
{
internal enum DiagnosticMode
{
/// <summary>
/// Push diagnostics. Roslyn/LSP is responsible for aggregating internal diagnostic notifications and pushing
/// those out to either VS or the LSP push diagnostic system.
/// </summary>
Push,
/// <summary>
/// Pull diagnostics. Roslyn/LSP is responsible for aggregating internal diagnostic notifications and
/// responding to LSP pull requests for them.
/// </summary>
Pull,
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CodeAnalysis.Diagnostics
{
internal enum DiagnosticMode
{
/// <summary>
/// Push diagnostics. Roslyn/LSP is responsible for aggregating internal diagnostic notifications and pushing
/// those out to either VS or the LSP push diagnostic system.
/// </summary>
Push,
/// <summary>
/// Push diagnostics. Roslyn/LSP is responsible for aggregating internal diagnostic notifications and pushing
/// responding to LSP pull requests for them.
/// </summary>
Pull,
}
}
|
mit
|
C#
|
226e8490fdd5f7f494183eb943d924782a722326
|
Add NumberOfStickersSold
|
jdt/StickEmApp
|
Source/StickEmApp/StickEmApp/Entities/SalesResult.cs
|
Source/StickEmApp/StickEmApp/Entities/SalesResult.cs
|
namespace StickEmApp.Entities
{
public class SalesResult
{
public SalesResult()
{
Status = ResultType.Exact;
Difference = new Money(0);
}
public ResultType Status { get; set; }
public Money Difference { get; set; }
public int NumberOfStickersSold { get; set; }
}
}
|
namespace StickEmApp.Entities
{
public class SalesResult
{
public SalesResult()
{
Status = ResultType.Exact;
Difference = new Money(0);
}
public ResultType Status { get; set; }
public Money Difference { get; set; }
}
}
|
mit
|
C#
|
e0939926a09c2bea2618607b9b2cc4fd26570aa7
|
fix scope mode switching
|
corvusalba/my-little-lispy,corvusalba/my-little-lispy
|
src/CorvusAlba.MyLittleLispy.Runtime/Continuation.cs
|
src/CorvusAlba.MyLittleLispy.Runtime/Continuation.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace CorvusAlba.MyLittleLispy.Runtime
{
public class Continuation : Value
{
private IEnumerable<Scope> _scopes;
private bool _lexicalScopeMode;
public Node Body { get; private set; }
public Continuation(Context context, Node body, bool lexicalScopeMode = true)
{
_scopes = context.CurrentFrame.Export();
Body = body;
_lexicalScopeMode = lexicalScopeMode;
}
public override Node ToExpression()
{
return Body;
}
public Value Call(Context context)
{
if (!_lexicalScopeMode)
{
context.LexicalScopeMode = false;
}
context.BeginFrame();
context.CurrentFrame.Import(_scopes);
try
{
return Body.Eval(context);
}
finally
{
if (_scopes != null)
{
for (int i = 0; i < _scopes.Count(); i++)
{
context.CurrentFrame.EndScope();
}
}
context.EndFrame();
if (!_lexicalScopeMode)
{
context.LexicalScopeMode = true;
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace CorvusAlba.MyLittleLispy.Runtime
{
public class Continuation : Value
{
private IEnumerable<Scope> _scopes;
private bool _lexicalScopeMode;
public Node Body { get; private set; }
public Continuation(Context context, Node body, bool lexicalScopeMode = true)
{
_scopes = context.CurrentFrame.Export();
Body = body;
_lexicalScopeMode = lexicalScopeMode;
}
public override Node ToExpression()
{
return Body;
}
public Value Call(Context context)
{
context.LexicalScopeMode = _lexicalScopeMode;
context.BeginFrame();
context.CurrentFrame.Import(_scopes);
try
{
return Body.Eval(context);
}
finally
{
if (_scopes != null)
{
for (int i = 0; i < _scopes.Count(); i++)
{
context.CurrentFrame.EndScope();
}
}
context.EndFrame();
context.LexicalScopeMode = !_lexicalScopeMode;
}
}
}
}
|
mit
|
C#
|
73ee3101a0591312a5ea525877d99c66e09705d0
|
Rename test for consistency.
|
drewnoakes/dasher
|
Dasher.Tests/RoundTripTests.cs
|
Dasher.Tests/RoundTripTests.cs
|
using System.IO;
using Xunit;
namespace Dasher.Tests
{
public class RoundTripTests
{
[Fact]
public void Class()
{
var after = RoundTrip(new UserScore("Bob", 123));
Assert.Equal("Bob", after.Name);
Assert.Equal(123, after.Score);
}
[Fact]
public void Struct()
{
var after = RoundTrip(new UserScoreStruct("Bob", 123));
Assert.Equal("Bob", after.Name);
Assert.Equal(123, after.Score);
}
[Fact]
public void NestedClass()
{
var after = RoundTrip(new WeightedUserScore(1.0, new UserScore("Bob", 123)));
Assert.Equal(1.0, after.Weight);
Assert.Equal("Bob", after.UserScore.Name);
Assert.Equal(123, after.UserScore.Score);
}
[Fact]
public void NestedStruct()
{
var after = RoundTrip(new ValueWrapper<UserScoreStruct>(new UserScoreStruct("Foo", 123)));
Assert.Equal("Foo", after.Value.Name);
Assert.Equal(123, after.Value.Score);
}
[Fact]
public void ListOfList()
{
var after = RoundTrip(new ListOfList(new[] { new[] { 1, 2, 3 }, new[] { 4, 5, 6 } }));
Assert.Equal(2, after.Jagged.Count);
Assert.Equal(new[] { 1, 2, 3 }, after.Jagged[0]);
Assert.Equal(new[] { 4, 5, 6 }, after.Jagged[1]);
}
#region Helper
private static T RoundTrip<T>(T before)
{
var stream = new MemoryStream();
new Serialiser<T>().Serialise(stream, before);
stream.Position = 0;
return new Deserialiser<T>().Deserialise(stream.ToArray());
}
#endregion
}
}
|
using System.IO;
using Xunit;
namespace Dasher.Tests
{
public class RoundTripTests
{
[Fact]
public void Class()
{
var after = RoundTrip(new UserScore("Bob", 123));
Assert.Equal("Bob", after.Name);
Assert.Equal(123, after.Score);
}
[Fact]
public void Struct()
{
var after = RoundTrip(new UserScoreStruct("Bob", 123));
Assert.Equal("Bob", after.Name);
Assert.Equal(123, after.Score);
}
[Fact]
public void NestedClass()
{
var after = RoundTrip(new WeightedUserScore(1.0, new UserScore("Bob", 123)));
Assert.Equal(1.0, after.Weight);
Assert.Equal("Bob", after.UserScore.Name);
Assert.Equal(123, after.UserScore.Score);
}
[Fact]
public void NestedStruct()
{
var after = RoundTrip(new ValueWrapper<UserScoreStruct>(new UserScoreStruct("Foo", 123)));
Assert.Equal("Foo", after.Value.Name);
Assert.Equal(123, after.Value.Score);
}
[Fact]
public void HandlesListOfList()
{
var after = RoundTrip(new ListOfList(new[] { new[] { 1, 2, 3 }, new[] { 4, 5, 6 } }));
Assert.Equal(2, after.Jagged.Count);
Assert.Equal(new[] { 1, 2, 3 }, after.Jagged[0]);
Assert.Equal(new[] { 4, 5, 6 }, after.Jagged[1]);
}
#region Helper
private static T RoundTrip<T>(T before)
{
var stream = new MemoryStream();
new Serialiser<T>().Serialise(stream, before);
stream.Position = 0;
return new Deserialiser<T>().Deserialise(stream.ToArray());
}
#endregion
}
}
|
apache-2.0
|
C#
|
d092fa9bb0eda5d111f66f4635ae8befd53668a7
|
Update the links to our docs and API ref page (#10670)
|
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
|
Assets/MRTK/Core/Inspectors/MixedRealityToolkitHelpLinks.cs
|
Assets/MRTK/Core/Inspectors/MixedRealityToolkitHelpLinks.cs
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using UnityEditor;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Editor
{
/// <summary>
/// Creates menu items to show users how to get help
/// </summary>
public class MixedRealityToolkitHelpLinks : MonoBehaviour
{
internal const string MRTKIssuePageUrl = "https://github.com/microsoft/MixedRealityToolkit-Unity/issues";
internal const string MRTKDocsUrl = "https://aka.ms/mrtk2docs";
internal const string MRTKAPIRefUrl = "https://aka.ms/mrtk2api";
[MenuItem("Mixed Reality/Toolkit/Help/Show Documentation", false)]
private static void ShowDocumentation()
{
Application.OpenURL(MRTKDocsUrl);
}
[MenuItem("Mixed Reality/Toolkit/Help/Show API Reference", false)]
private static void ShowAPIReference()
{
Application.OpenURL(MRTKAPIRefUrl);
}
[MenuItem("Mixed Reality/Toolkit/Help/File a bug report", false)]
private static void FileBugReport()
{
Application.OpenURL(MRTKIssuePageUrl);
}
}
}
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using UnityEditor;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Editor
{
/// <summary>
/// Creates menu items to show users how to get help
/// </summary>
public class MixedRealityToolkitHelpLinks : MonoBehaviour
{
internal const string MRTKIssuePageUrl = "https://github.com/microsoft/MixedRealityToolkit-Unity/issues";
internal const string MRTKDocsUrl = "https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/";
internal const string MRTKAPIRefUrl = "https://docs.microsoft.com/dotnet/api/microsoft.mixedreality.toolkit";
[MenuItem("Mixed Reality/Toolkit/Help/Show Documentation", false)]
private static void ShowDocumentation()
{
Application.OpenURL(MRTKDocsUrl);
}
[MenuItem("Mixed Reality/Toolkit/Help/Show API Reference", false)]
private static void ShowAPIReference()
{
Application.OpenURL(MRTKAPIRefUrl);
}
[MenuItem("Mixed Reality/Toolkit/Help/File a bug report", false)]
private static void FileBugReport()
{
Application.OpenURL(MRTKIssuePageUrl);
}
}
}
|
mit
|
C#
|
6110f556302d7cded305e238db57cedaea99bf0d
|
Fix display of color code
|
ButchersBoy/MaterialDesignInXamlToolkit,ButchersBoy/MaterialDesignInXamlToolkit,ButchersBoy/MaterialDesignInXamlToolkit
|
MainDemo.Wpf/Converters/BrushToHexConverter.cs
|
MainDemo.Wpf/Converters/BrushToHexConverter.cs
|
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace MaterialDesignDemo.Converters
{
public class BrushToHexConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null) return null;
string lowerHexString(int i) => i.ToString("X2").ToLower();
var brush = (SolidColorBrush)value;
var hex = lowerHexString(brush.Color.R) +
lowerHexString(brush.Color.G) +
lowerHexString(brush.Color.B);
return "#" + hex;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace MaterialDesignDemo.Converters
{
public class BrushToHexConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null) return null;
string lowerHexString(int i) => i.ToString("X").ToLower();
var brush = (SolidColorBrush)value;
var hex = lowerHexString(brush.Color.R) +
lowerHexString(brush.Color.G) +
lowerHexString(brush.Color.B);
return "#" + hex;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
645c65037a5552afb8362aeddd1f983186ec2178
|
Fix buttons in Article
|
Team-Code-Ninjas/SpaceBlog,Team-Code-Ninjas/SpaceBlog,Team-Code-Ninjas/SpaceBlog
|
SpaceBlog/SpaceBlog/Views/Article/Index.cshtml
|
SpaceBlog/SpaceBlog/Views/Article/Index.cshtml
|
@model IEnumerable<SpaceBlog.Models.Article>
@using SpaceBlog.Utilities;
@{
ViewBag.Title = "Articles";
}
<div class="container">
<h2>@ViewBag.Title</h2>
@Html.ActionLink("Create New Article", "Create", new { area = "" }, new { @class = "btn btn-primary" })
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Title)
</th>
<th>
@Html.DisplayNameFor(model => model.Content)
</th>
<th>
@Html.DisplayNameFor(model => model.Date)
</th>
<th>
@Html.DisplayNameFor(model => model.Author)
</th>
<th>
Actions
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Utils.CutText(item.Content, 50)
</td>
<td>
@Html.DisplayFor(modelItem => item.Date)
</td>
<td>
@Html.DisplayFor(modelItem => item.Author.FullName)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.Id }, new { @class = "btn-sm btn-primary" })
@Html.ActionLink("Details", "Details", new { id = item.Id }, new { @class = "btn-sm btn-primary" })
@Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { @class = "btn-sm btn-danger" })
</td>
</tr>
}
</table>
</div>
|
@model IEnumerable<SpaceBlog.Models.Article>
@using SpaceBlog.Utilities;
@{
ViewBag.Title = "Articles";
}
<div class="container">
<h2>@ViewBag.Title</h2>
@Html.ActionLink("Create New Article", "Create", new { area = "" }, new { @class = "btn btn-primary" })
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Title)
</th>
<th>
@Html.DisplayNameFor(model => model.Content)
</th>
<th>
@Html.DisplayNameFor(model => model.Date)
</th>
<th>
@Html.DisplayNameFor(model => model.Author)
</th>
<th>
Actions
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Utils.CutText(item.Content, 100)
</td>
<td>
@Html.DisplayFor(modelItem => item.Date)
</td>
<td>
@Html.DisplayFor(modelItem => item.Author.FullName)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.Id }, new { @class = "btn-sm btn-primary" })
@Html.ActionLink("Details", "Details", new { id = item.Id }, new { @class = "btn-sm btn-primary" })
@Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { @class = "btn-sm btn-danger" })
</td>
</tr>
}
</table>
</div>
|
mit
|
C#
|
3c40dac5c4fcb5e9d81603df9b83cee231471682
|
Bump version to 3.2.4.0.
|
GoogleCloudPlatform/compute-image-windows,adjackura/compute-image-windows,adjackura/compute-image-windows,illfelder/compute-image-windows,ning-yang/compute-image-windows,illfelder/compute-image-windows,GoogleCloudPlatform/compute-image-windows,ning-yang/compute-image-windows
|
agent/Common/Properties/VersionInfo.cs
|
agent/Common/Properties/VersionInfo.cs
|
/*
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyCompany("Google Inc")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version: Large feature and functionality changes, or incompatible
// API changes.
// Minor Version: Add functionality without API changes.
// Build Number: Bug fixes.
// Revision: Minor changes or improvements such as style fixes.
//
// 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("3.2.4.0")]
[assembly: AssemblyFileVersion("3.2.4.0")]
|
/*
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyCompany("Google Inc")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version: Large feature and functionality changes, or incompatible
// API changes.
// Minor Version: Add functionality without API changes.
// Build Number: Bug fixes.
// Revision: Minor changes or improvements such as style fixes.
//
// 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("3.2.3.0")]
[assembly: AssemblyFileVersion("3.2.3.0")]
|
apache-2.0
|
C#
|
cd6955d4ede974436cfbe8ec8cd161411c006758
|
Fix comet spawning patch
|
gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,DaggerES/LunaMultiPlayer
|
LmpClient/Harmony/ScenarioDiscoverableObjects_SpawnComet.cs
|
LmpClient/Harmony/ScenarioDiscoverableObjects_SpawnComet.cs
|
using Harmony;
using LmpClient.Systems.AsteroidComet;
using LmpClient.Systems.Lock;
using LmpClient.Systems.SettingsSys;
using LmpCommon.Enums;
using System;
// ReSharper disable All
namespace LmpClient.Harmony
{
/// <summary>
/// This harmony patch is intended to skip the spawn of a comet if we don't have the lock or the server doesn't allow them
/// </summary>
[HarmonyPatch(typeof(ScenarioDiscoverableObjects))]
[HarmonyPatch("SpawnComet")]
[HarmonyPatch(new Type[0])]
public class ScenarioDiscoverableObjects_SpawnComet
{
[HarmonyPrefix]
private static bool PrefixSpawnComet()
{
if (MainSystem.NetworkState < ClientState.Connected) return true;
if (!LockSystem.LockQuery.AsteroidCometLockBelongsToPlayer(SettingsSystem.CurrentSettings.PlayerName))
return false;
var currentComets = AsteroidCometSystem.Singleton.GetCometCount();
if (currentComets >= SettingsSystem.ServerSettings.MaxNumberOfComets)
{
return false;
}
return true;
}
}
}
|
using Harmony;
using LmpClient.Systems.AsteroidComet;
using LmpClient.Systems.Lock;
using LmpClient.Systems.SettingsSys;
using LmpCommon.Enums;
// ReSharper disable All
namespace LmpClient.Harmony
{
/// <summary>
/// This harmony patch is intended to skip the spawn of a comet if we don't have the lock or the server doesn't allow them
/// </summary>
[HarmonyPatch(typeof(ScenarioDiscoverableObjects))]
[HarmonyPatch("SpawnComet")]
public class ScenarioDiscoverableObjects_SpawnComet
{
[HarmonyPrefix]
private static bool PrefixSpawnComet()
{
if (MainSystem.NetworkState < ClientState.Connected) return true;
if (!LockSystem.LockQuery.AsteroidCometLockBelongsToPlayer(SettingsSystem.CurrentSettings.PlayerName))
return false;
var currentComets = AsteroidCometSystem.Singleton.GetCometCount();
if (currentComets >= SettingsSystem.ServerSettings.MaxNumberOfComets)
{
return false;
}
return true;
}
}
}
|
mit
|
C#
|
a80cc044ebc8d1de62a83a4a1a482ec01c58237f
|
FIX typo in OWLOntologyModelLoader
|
mdesalvo/RDFSharp.Semantics
|
RDFSharp.Semantics/Ontology/Model/OWLOntologyModelLoader.cs
|
RDFSharp.Semantics/Ontology/Model/OWLOntologyModelLoader.cs
|
/*
Copyright 2012-2022 Marco De Salvo
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 RDFSharp.Model;
using System;
namespace RDFSharp.Semantics
{
/// <summary>
/// OWLOntologyModelLoader is responsible for loading ontology models from remote sources or alternative representations
/// </summary>
internal static class OWLOntologyModelLoader
{
#region Methods
/// <summary>
/// Gets an ontology model representation of the given graph
/// </summary>
internal static void LoadModel(this OWLOntology ontology, RDFGraph graph, Action<OWLOntology,RDFGraph> classModelExtensionPoint=null, Action<OWLOntology,RDFGraph> propertyModelExtensionPoint=null)
{
if (graph == null)
throw new OWLSemanticsException("Cannot get ontology model from RDFGraph because given \"graph\" parameter is null");
OWLSemanticsEvents.RaiseSemanticsInfo(string.Format("Graph '{0}' is going to be parsed as Model...", graph.Context));
ontology.LoadPropertyModel(graph, propertyModelExtensionPoint);
ontology.LoadClassModel(graph, classModelExtensionPoint);
OWLSemanticsEvents.RaiseSemanticsInfo(string.Format("Graph '{0}' has been parsed as Model", graph.Context));
}
#endregion
}
}
|
/*
Copyright 2012-2022 Marco De Salvo
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 RDFSharp.Model;
using System;
namespace RDFSharp.Semantics
{
/// <summary>
/// OWLOntologyModelLoader is responsible for loading ontology models from remote sources or alternative representations
/// </summary>
internal static class OWLOntologyModelLoader
{
#region Methods
/// <summary>
/// Gets an ontology model representation of the given graph
/// </summary>
internal static void LoadModel(this OWLOntology ontology, RDFGraph graph, Action<OWLOntology,RDFGraph> classModelExtensionPoint=null, Action<OWLOntology,RDFGraph> propertyModelExtensionPoint=null)
{
if (graph == null)
throw new OWLSemanticsException("Cannot get ontology model from RDFGraph because given \"graph\" parameter is null");
OWLSemanticsEvents.RaiseSemanticsInfo(string.Format("Graph '{0}' is going to be parsed as Model...", graph.Context));
ontology.LoadPropertyModel(graph, classModelExtensionPoint);
ontology.LoadClassModel(graph, propertyModelExtensionPoint);
OWLSemanticsEvents.RaiseSemanticsInfo(string.Format("Graph '{0}' has been parsed as Model", graph.Context));
}
#endregion
}
}
|
apache-2.0
|
C#
|
cf2fa24aaf8e211d2917fb1ee34288ac8e1f60ed
|
Use correct type to load config from subsystem
|
MarimerLLC/csla,JasonBock/csla,rockfordlhotka/csla,JasonBock/csla,rockfordlhotka/csla,rockfordlhotka/csla,MarimerLLC/csla,JasonBock/csla,MarimerLLC/csla
|
Source/Csla.Shared/Configuration/ConfigurationExtensions.cs
|
Source/Csla.Shared/Configuration/ConfigurationExtensions.cs
|
#if NETSTANDARD2_0
//-----------------------------------------------------------------------
// <copyright file="ConfigurationExtensions.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>Implement extension methods for .NET Core configuration</summary>
//-----------------------------------------------------------------------
using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Csla.Configuration
{
/// <summary>
/// Implement extension methods for .NET Core configuration
/// </summary>
public static class ConfigurationExtensions
{
/// <summary>
/// Add CSLA .NET services for use by the application.
/// </summary>
/// <param name="services">ServiceCollection object</param>
public static ICslaBuilder AddCsla(this IServiceCollection services)
{
ApplicationContext.SetServiceCollection(services);
services.AddTransient(typeof(IDataPortal<>), typeof(DataPortal<>));
return new CslaBuilder();
}
/// <summary>
/// Add CSLA .NET services for use by the application.
/// </summary>
/// <param name="services">ServiceCollection object</param>
/// <param name="config">Implement to configure CSLA .NET</param>
public static ICslaBuilder AddCsla(
this IServiceCollection services, Action<CslaConfiguration> config)
{
ApplicationContext.SetServiceCollection(services);
services.AddTransient(typeof(IDataPortal<>), typeof(DataPortal<>));
config?.Invoke(CslaConfiguration.Configure());
return new CslaBuilder();
}
/// <summary>
/// Configure CSLA .NET settings from .NET Core configuration
/// subsystem.
/// </summary>
/// <param name="config">Configuration object</param>
public static IConfiguration ConfigureCsla(this IConfiguration config)
{
config.Bind("csla", new CslaConfigurationOptions());
return config;
}
}
}
#endif
|
#if NETSTANDARD2_0
//-----------------------------------------------------------------------
// <copyright file="ConfigurationExtensions.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>Implement extension methods for .NET Core configuration</summary>
//-----------------------------------------------------------------------
using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Csla.Configuration
{
/// <summary>
/// Implement extension methods for .NET Core configuration
/// </summary>
public static class ConfigurationExtensions
{
/// <summary>
/// Add CSLA .NET services for use by the application.
/// </summary>
/// <param name="services">ServiceCollection object</param>
public static ICslaBuilder AddCsla(this IServiceCollection services)
{
ApplicationContext.SetServiceCollection(services);
services.AddTransient(typeof(IDataPortal<>), typeof(DataPortal<>));
return new CslaBuilder();
}
/// <summary>
/// Add CSLA .NET services for use by the application.
/// </summary>
/// <param name="services">ServiceCollection object</param>
/// <param name="config">Implement to configure CSLA .NET</param>
public static ICslaBuilder AddCsla(
this IServiceCollection services, Action<CslaConfiguration> config)
{
ApplicationContext.SetServiceCollection(services);
services.AddTransient(typeof(IDataPortal<>), typeof(DataPortal<>));
config?.Invoke(CslaConfiguration.Configure());
return new CslaBuilder();
}
/// <summary>
/// Configure CSLA .NET settings from .NET Core configuration
/// subsystem.
/// </summary>
/// <param name="config">Configuration object</param>
public static IConfiguration ConfigureCsla(this IConfiguration config)
{
config.Bind("csla", CslaConfiguration.Configure());
return config;
}
}
}
#endif
|
mit
|
C#
|
6b5437a128ba7896fcb5317e6bf849e09bced314
|
Remove unnecessary using statements.
|
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
|
src/CompetitionPlatform/Data/AzureRepositories/Settings/BaseSettings.cs
|
src/CompetitionPlatform/Data/AzureRepositories/Settings/BaseSettings.cs
|
namespace CompetitionPlatform.Data.AzureRepositories.Settings
{
public class BaseSettings
{
public AzureSettings Azure { get; set; }
public AuthenticationSettings Authentication { get; set; }
public NotificationsSettings Notifications { get; set; }
public RecaptchaSettings Recaptcha { get; set; }
}
public class AuthenticationSettings
{
public string ClientId { get; set; }
public string ClientSecret { get; set; }
public string PostLogoutRedirectUri { get; set; }
public string Authority { get; set; }
}
public class AzureSettings
{
public string StorageConnString { get; set; }
public string StorageLogConnString { get; set; }
}
public class NotificationsSettings
{
public string EmailsQueueConnString { get; set; }
public string SlackQueueConnString { get; set; }
}
public class RecaptchaSettings
{
public string SiteKey { get; set; }
public string SecretKey { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CompetitionPlatform.Data.AzureRepositories.Settings
{
public class BaseSettings
{
public AzureSettings Azure { get; set; }
public AuthenticationSettings Authentication { get; set; }
public NotificationsSettings Notifications { get; set; }
public RecaptchaSettings Recaptcha { get; set; }
}
public class AuthenticationSettings
{
public string ClientId { get; set; }
public string ClientSecret { get; set; }
public string PostLogoutRedirectUri { get; set; }
public string Authority { get; set; }
}
public class AzureSettings
{
public string StorageConnString { get; set; }
public string StorageLogConnString { get; set; }
}
public class NotificationsSettings
{
public string EmailsQueueConnString { get; set; }
public string SlackQueueConnString { get; set; }
}
public class RecaptchaSettings
{
public string SiteKey { get; set; }
public string SecretKey { get; set; }
}
}
|
mit
|
C#
|
c880a577e9a0205685095efdc028c51da1a7f55a
|
Add remark to doc comment
|
RockFramework/Rock.Messaging
|
RockLib.Messaging/IReceiver.cs
|
RockLib.Messaging/IReceiver.cs
|
using System;
namespace RockLib.Messaging
{
/// <summary>
/// Defines an interface for receiving messages. To start receiving messages,
/// set the value of the <see cref="MessageHandler"/> property.
/// </summary>
public interface IReceiver : IDisposable
{
/// <summary>
/// Gets the name of this instance of <see cref="IReceiver"/>.
/// </summary>
string Name { get; }
/// <summary>
/// Gets or sets the message handler for this receiver. When set, the receiver is started
/// and will invoke the value's <see cref="IMessageHandler.OnMessageReceived"/> method
/// when messages are received.
/// </summary>
/// <remarks>
/// Implementions of this interface should not allow this property to be set to null or
/// to be set more than once.
/// </remarks>
IMessageHandler MessageHandler { get; set; }
/// <summary>
/// Occurs when a connection is established.
/// </summary>
event EventHandler Connected;
/// <summary>
/// Occurs when a connection is lost.
/// </summary>
event EventHandler<DisconnectedEventArgs> Disconnected;
}
}
|
using System;
namespace RockLib.Messaging
{
/// <summary>
/// Defines an interface for receiving messages. To start receiving messages,
/// set the value of the <see cref="MessageHandler"/> property.
/// </summary>
public interface IReceiver : IDisposable
{
/// <summary>
/// Gets the name of this instance of <see cref="IReceiver"/>.
/// </summary>
string Name { get; }
/// <summary>
/// Gets or sets the message handler for this receiver. When set, the receiver is started
/// and will invoke the value's <see cref="IMessageHandler.OnMessageReceived"/> method
/// when messages are received.
/// </summary>
IMessageHandler MessageHandler { get; set; }
/// <summary>
/// Occurs when a connection is established.
/// </summary>
event EventHandler Connected;
/// <summary>
/// Occurs when a connection is lost.
/// </summary>
event EventHandler<DisconnectedEventArgs> Disconnected;
}
}
|
mit
|
C#
|
c453bb07c55b95d01d8c04a5fd0f45a8e0ab7aa2
|
Make pulling feel less crap (#4414)
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
|
Content.Client/Physics/Controllers/MoverController.cs
|
Content.Client/Physics/Controllers/MoverController.cs
|
using Content.Shared.Movement;
using Content.Shared.Movement.Components;
using Robust.Client.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.Physics.Controllers
{
public sealed class MoverController : SharedMoverController
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
public override void UpdateBeforeSolve(bool prediction, float frameTime)
{
base.UpdateBeforeSolve(prediction, frameTime);
var player = _playerManager.LocalPlayer?.ControlledEntity;
if (player == null ||
!player.TryGetComponent(out IMoverComponent? mover) ||
!player.TryGetComponent(out PhysicsComponent? body)) return;
body.Predict = true; // TODO: equal prediction instead of true?
foreach (var joint in body.Joints)
{
joint.BodyA.Predict = true;
joint.BodyB.Predict = true;
}
// Server-side should just be handled on its own so we'll just do this shizznit
if (player.TryGetComponent(out IMobMoverComponent? mobMover))
{
HandleMobMovement(mover, body, mobMover);
return;
}
HandleKinematicMovement(mover, body);
}
}
}
|
using Content.Shared.Movement;
using Content.Shared.Movement.Components;
using Robust.Client.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.Physics.Controllers
{
public sealed class MoverController : SharedMoverController
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
public override void UpdateBeforeSolve(bool prediction, float frameTime)
{
base.UpdateBeforeSolve(prediction, frameTime);
var player = _playerManager.LocalPlayer?.ControlledEntity;
if (player == null ||
!player.TryGetComponent(out IMoverComponent? mover) ||
!player.TryGetComponent(out PhysicsComponent? body)) return;
body.Predict = true; // TODO: equal prediction instead of true?
// Server-side should just be handled on its own so we'll just do this shizznit
if (player.TryGetComponent(out IMobMoverComponent? mobMover))
{
HandleMobMovement(mover, body, mobMover);
return;
}
HandleKinematicMovement(mover, body);
}
}
}
|
mit
|
C#
|
f164d0274ef487d24875cc14af3f68a6532b6ce1
|
Fix comment
|
DaveSenn/Extend
|
PortableExtensions/System.Int32/Int32.IsMultipleOf.cs
|
PortableExtensions/System.Int32/Int32.IsMultipleOf.cs
|
#region Usings
using System;
#endregion
namespace PortableExtensions
{
/// <summary>
/// Class containing some extension methods for <see cref="int" />.
/// </summary>
public static partial class Int32Ex
{
/// <summary>
/// Checks if the Int32 value is a multiple of the given factor.
/// </summary>
/// <param name="value">The Int32 to check.</param>
/// <param name="factor">The factor.</param>
/// <returns>Returns true if the Int32 value is a multiple of the given factor.</returns>
public static Boolean IsMultipleOf( this Int32 value, Int32 factor )
{
return value % factor == 0;
}
}
}
|
#region Usings
using System;
#endregion
namespace PortableExtensions
{
/// <summary>
/// Class containing some extension methods for <see cref="int" />.
/// </summary>
public static partial class Int32Ex
{
/// <summary>
/// Checks if the Int32 value is a multiple of the given factor.
/// </summary>
/// <param name="value">The Int32 to check.</param>
/// <param name="factor">The factor.</param>
/// <returns>>Returns true if the Int32 value is a multiple of the given factor.</returns>
public static Boolean IsMultipleOf( this Int32 value, Int32 factor )
{
return value % factor == 0;
}
}
}
|
mit
|
C#
|
2dc7b4c9fa2d00e6f7106c575babd31fcfa63680
|
update version number
|
gaochundong/Cowboy
|
SolutionVersion.cs
|
SolutionVersion.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyDescription("Cowboy is a library for building Sockets/HTTP based services.")]
[assembly: AssemblyCompany("Dennis Gao")]
[assembly: AssemblyProduct("Cowboy")]
[assembly: AssemblyCopyright("Copyright © 2015-2016 Dennis Gao.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: ComVisible(false)]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyDescription("Cowboy is a library for building Sockets/HTTP based services.")]
[assembly: AssemblyCompany("Dennis Gao")]
[assembly: AssemblyProduct("Cowboy")]
[assembly: AssemblyCopyright("Copyright © 2015-2016 Dennis Gao.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
|
mit
|
C#
|
6dc4dffd9c9fbf3f415ff2a6320fabb3aabe761a
|
add caching extension method
|
xyting/IdentityServer4.EntityFramework,IdentityServer/IdentityServer4.EntityFramework,xyting/IdentityServer4.EntityFramework,IdentityServer/IdentityServer4.EntityFramework,IdentityServer/IdentityServer4.EntityFramework,IdentityServer/IdentityServer4.EntityFramework
|
src/IdentityServer4.EntityFramework/Extensions/IdentityServerEntityFrameworkBuilderExtensions.cs
|
src/IdentityServer4.EntityFramework/Extensions/IdentityServerEntityFrameworkBuilderExtensions.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 IdentityServer4.EntityFramework.DbContexts;
using IdentityServer4.EntityFramework.Interfaces;
using IdentityServer4.EntityFramework.Services;
using IdentityServer4.EntityFramework.Stores;
using IdentityServer4.Services;
using IdentityServer4.Stores;
using Microsoft.EntityFrameworkCore;
using System;
namespace Microsoft.Extensions.DependencyInjection
{
public static class IdentityServerEntityFrameworkBuilderExtensions
{
public static IIdentityServerBuilder AddConfigurationStore(
this IIdentityServerBuilder builder, Action<DbContextOptionsBuilder> optionsAction = null)
{
builder.Services.AddDbContext<ConfigurationDbContext>(optionsAction);
builder.Services.AddScoped<IConfigurationDbContext, ConfigurationDbContext>();
builder.Services.AddTransient<IClientStore, ClientStore>();
builder.Services.AddTransient<IScopeStore, ScopeStore>();
builder.Services.AddTransient<ICorsPolicyService, CorsPolicyService>();
return builder;
}
public static IIdentityServerBuilder AddConfigurationStoreCache(
this IIdentityServerBuilder builder)
{
builder.Services.AddMemoryCache(); // TODO: remove once update idsvr since it does this
builder.AddInMemoryCaching();
// these need to be registered as concrete classes in DI for
// the caching decorators to work
builder.Services.AddTransient<ClientStore>();
builder.Services.AddTransient<ScopeStore>();
// add the caching decorators
builder.AddClientStoreCache<ClientStore>();
builder.AddScopeStoreCache<ScopeStore>();
return builder;
}
public static IIdentityServerBuilder AddOperationalStore(
this IIdentityServerBuilder builder,
Action<DbContextOptionsBuilder> optionsAction = null)
{
builder.Services.AddDbContext<PersistedGrantDbContext>(optionsAction);
builder.Services.AddScoped<IPersistedGrantDbContext, PersistedGrantDbContext>();
builder.Services.AddTransient<IPersistedGrantStore, PersistedGrantStore>();
return builder;
}
}
}
|
// 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 IdentityServer4.EntityFramework.DbContexts;
using IdentityServer4.EntityFramework.Interfaces;
using IdentityServer4.EntityFramework.Services;
using IdentityServer4.EntityFramework.Stores;
using IdentityServer4.Services;
using IdentityServer4.Stores;
using Microsoft.EntityFrameworkCore;
using System;
namespace Microsoft.Extensions.DependencyInjection
{
public static class IdentityServerEntityFrameworkBuilderExtensions
{
public static IIdentityServerBuilder AddConfigurationStore(
this IIdentityServerBuilder builder, Action<DbContextOptionsBuilder> optionsAction = null)
{
builder.Services.AddDbContext<ConfigurationDbContext>(optionsAction);
builder.Services.AddScoped<IConfigurationDbContext, ConfigurationDbContext>();
builder.Services.AddTransient<IClientStore, ClientStore>();
builder.Services.AddTransient<IScopeStore, ScopeStore>();
builder.Services.AddTransient<ICorsPolicyService, CorsPolicyService>();
return builder;
}
public static IIdentityServerBuilder AddOperationalStore(
this IIdentityServerBuilder builder,
Action<DbContextOptionsBuilder> optionsAction = null)
{
builder.Services.AddDbContext<PersistedGrantDbContext>(optionsAction);
builder.Services.AddScoped<IPersistedGrantDbContext, PersistedGrantDbContext>();
builder.Services.AddTransient<IPersistedGrantStore, PersistedGrantStore>();
return builder;
}
}
}
|
apache-2.0
|
C#
|
5d823d0728a1351a165b8d154fffe8ef59c1ca8b
|
Add IoC using built in container
|
andrewlock/blog-examples,andrewlock/blog-examples,andrewlock/blog-examples,andrewlock/blog-examples
|
configuring-structuremap/ConfiguringStructureMap/Startup.cs
|
configuring-structuremap/ConfiguringStructureMap/Startup.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace ConfiguringStructureMap
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
ConfigureIoC(services);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseMvc();
}
public void ConfigureIoC(IServiceCollection services)
{
services.AddTransient<IPurchasingService, PurchasingService>();
services.AddTransient<IGamingService, CrosswordService>();
services.AddTransient<IGamingService, SudokuService>();
services.AddTransient<ConcreteService, ConcreteService>();
services.AddScoped<IUnitOfWork, UnitOfWork>(provider => new UnitOfWork(priority: 3));
services.Add(ServiceDescriptor.Transient(typeof(ILeaderboard<>), typeof(Leaderboard<>)));
services.Add(ServiceDescriptor.Transient(typeof(IValidator<>), typeof(DefaultValidator<>)));
services.AddTransient<IValidator<UserModel>, UserModelValidator>();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace ConfiguringStructureMap
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseMvc();
}
public void ConfigureIoC(IServiceCollection services)
{
//TODO: Add IoC Config
}
}
}
|
mit
|
C#
|
a8a1dc55891ca63508f3c81114543e101d082f5a
|
change cache duration
|
Borayvor/ASP.NET-MVC-CourseProject-2017,Borayvor/ASP.NET-MVC-CourseProject-2017,Borayvor/ASP.NET-MVC-CourseProject-2017
|
PhotoArtSystem/Common/PhotoArtSystem.Common/Constants/GlobalConstants.cs
|
PhotoArtSystem/Common/PhotoArtSystem.Common/Constants/GlobalConstants.cs
|
namespace PhotoArtSystem.Common.Constants
{
public class GlobalConstants
{
public const string StringEmpty = "";
// TODO: Set Cache Duration !!!
// Cache duration
public const uint PhotoArtServicesPartialCacheDuration = 60 * 5; //// * 24; // sec * min * hours
public const uint PhotocoursePartialCacheDuration = 60 * 5; //// * 24; // sec * min * hours
public const uint PhotocoursesAllPartialCacheDuration = 60 * 5; //// * 24; // sec * min * hours
public const uint CarouselDataPartialCacheDuration = 60 * 5; //// * 24; // sec * min * hours
public const uint MainInfoAllPartialCacheDuration = 60 * 5; //// * 24; // sec * min * hours
// Cache item names
public const string PhotoArtServicesCacheName = "PhotoArtServices";
public const string PhotocoursesAllCacheName = "PhotocoursesAll";
public const string PhotocourseCacheName = "Photocourse_";
public const string CarouselDataCacheName = "CarouselData";
public const string MainInfoAllCacheName = "MainInfoAll";
// Validation messages
public const string EmailNotValidValidationMessages = "The Email field is not a valid e-mail address.";
// Common Exception messages
public const string DbContextRequiredExceptionMessage = "An instance of DbContext is required !";
public const string EfDbContextRequiredExceptionMessage = "An instance of EfDbContext is required !";
public const string AutoMapperServiceRequiredExceptionMessage = "An instance of AutoMapperService is required !";
public const string MapperRequiredExceptionMessage = "An instance of Mapper is required !";
public const string SourceObjectRequiredExceptionMessage = "An instance of Source object is required !";
// HttpCacheService Exception messages
public const string ItemNameRequiredExceptionMessage = "Item name is required !";
public const string DurationInSecondsMustExceptionMessage = "Duration in seconds must be positive integer !";
// ApplicationUserProfileService Exception messages
public const string EfDbRepositoryApplicationUserRequiredExceptionMessage = "An instance of EfDbRepository of ApplicationUser is required !";
public const string ApplicationUserTransitionalRequiredExceptionMessage = "An instance of ApplicationUserTransitional is required !";
// PhotocourseService Exception messages
public const string EfDbRepositoryPhotocourseRequiredExceptionMessage = "An instance of EfDbRepository of Photocourse is required !";
public const string PhotocourseTransitionalRequiredExceptionMessage = "An instance of PhotocourseTransitional is required !";
// StudentService Exception messages
public const string EfDbRepositoryStudentRequiredExceptionMessage = "An instance of EfDbRepository of Student is required !";
public const string StudentTransitionalRequiredExceptionMessage = "An instance of StudentTransitional is required !";
// MainInfoService Exception messages
public const string EfDbRepositoryMainInfoRequiredExceptionMessage = "An instance of EfDbRepository of MainInfo is required !";
public const string MainInfoTransitionalRequiredExceptionMessage = "An instance of MainInfoTransitional is required !";
}
}
|
namespace PhotoArtSystem.Common.Constants
{
public class GlobalConstants
{
public const string StringEmpty = "";
// TODO: Set Cache Duration !!!
// Cache duration
public const uint PhotoArtServicesPartialCacheDuration = 0; //// * 60 * 24; // sec * min * hours
public const uint PhotocoursePartialCacheDuration = 0; //// * 60 * 24; // sec * min * hours
public const uint PhotocoursesAllPartialCacheDuration = 0; //// * 60 * 24; // sec * min * hours
public const uint CarouselDataPartialCacheDuration = 0; //// * 60 * 24; // sec * min * hours
public const uint MainInfoAllPartialCacheDuration = 0; //// * 60 * 24; // sec * min * hours
// Cache item names
public const string PhotoArtServicesCacheName = "PhotoArtServices";
public const string PhotocoursesAllCacheName = "PhotocoursesAll";
public const string PhotocourseCacheName = "Photocourse_";
public const string CarouselDataCacheName = "CarouselData";
public const string MainInfoAllCacheName = "MainInfoAll";
// Validation messages
public const string EmailNotValidValidationMessages = "The Email field is not a valid e-mail address.";
// Common Exception messages
public const string DbContextRequiredExceptionMessage = "An instance of DbContext is required !";
public const string EfDbContextRequiredExceptionMessage = "An instance of EfDbContext is required !";
public const string AutoMapperServiceRequiredExceptionMessage = "An instance of AutoMapperService is required !";
public const string MapperRequiredExceptionMessage = "An instance of Mapper is required !";
public const string SourceObjectRequiredExceptionMessage = "An instance of Source object is required !";
// HttpCacheService Exception messages
public const string ItemNameRequiredExceptionMessage = "Item name is required !";
public const string DurationInSecondsMustExceptionMessage = "Duration in seconds must be positive integer !";
// ApplicationUserProfileService Exception messages
public const string EfDbRepositoryApplicationUserRequiredExceptionMessage = "An instance of EfDbRepository of ApplicationUser is required !";
public const string ApplicationUserTransitionalRequiredExceptionMessage = "An instance of ApplicationUserTransitional is required !";
// PhotocourseService Exception messages
public const string EfDbRepositoryPhotocourseRequiredExceptionMessage = "An instance of EfDbRepository of Photocourse is required !";
public const string PhotocourseTransitionalRequiredExceptionMessage = "An instance of PhotocourseTransitional is required !";
// StudentService Exception messages
public const string EfDbRepositoryStudentRequiredExceptionMessage = "An instance of EfDbRepository of Student is required !";
public const string StudentTransitionalRequiredExceptionMessage = "An instance of StudentTransitional is required !";
// MainInfoService Exception messages
public const string EfDbRepositoryMainInfoRequiredExceptionMessage = "An instance of EfDbRepository of MainInfo is required !";
public const string MainInfoTransitionalRequiredExceptionMessage = "An instance of MainInfoTransitional is required !";
}
}
|
mit
|
C#
|
6cd11ce084b4b645284c41582922c6d3b36aec42
|
Solve build error
|
Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist
|
Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs
|
Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs
|
using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRespository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
{
singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
}
_dbContext.SaveChanges();
}
}
}
|
using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRespository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
{
singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
}
_dbContext.SaveChanges();
}
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOption);
_dbContext.SaveChanges();
}
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOption);
_dbContext.SaveChanges();
}
}
}
|
mit
|
C#
|
285442c15f4767cca472d465c96949dd436eff4b
|
Add city power and water variables.
|
mitchfizz05/Citysim,pigant/Citysim
|
Citysim/City.cs
|
Citysim/City.cs
|
using Citysim.Map;
namespace Citysim
{
public class City
{
/// <summary>
/// Amount of cash available.
/// </summary>
public int cash = 10000; // $10,000 starting cash
/// <summary>
/// MW (mega watts) of electricity available to the city.
/// </summary>
public int power = 0;
/// <summary>
/// ML (mega litres) of water available to the city.
/// </summary>
public int water = 0;
/// <summary>
/// The world. Needs generation.
/// </summary>
public World world = new World();
}
}
|
using Citysim.Map;
namespace Citysim
{
public class City
{
/// <summary>
/// Amount of cash available.
/// </summary>
public int cash = 10000; // $10,000 starting cash
/// <summary>
/// The world. Needs generation.
/// </summary>
public World world = new World();
}
}
|
mit
|
C#
|
a72a73feeea559b44adf94166e0e3efcbedb6b53
|
Make mouse zoom work when playing back recording.
|
fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game
|
common/client/actionMap.recording.cs
|
common/client/actionMap.recording.cs
|
//------------------------------------------------------------------------------
// Revenge Of The Cats: Ethernet
// Copyright (C) 2008, mEthLab Interactive
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// binds when playing back a recording
//------------------------------------------------------------------------------
if(isObject(RecordingActionMap)) RecordingActionMap.delete();
new ActionMap(RecordingActionMap);
function recordingMoveleft(%val)
{
RecordingFreelookGui.camLeftAction = %val;
}
function recordingMoveRight(%val)
{
RecordingFreelookGui.camRightAction = %val;
}
function recordingMoveForward(%val)
{
RecordingFreelookGui.camForwardAction = %val;
}
function recordingMoveBackward(%val)
{
RecordingFreelookGui.camBackwardAction = %val;
}
function recordingGetMouseAdjustAmount(%val)
{
// based on a default camera fov of 110'
return(%val * ($cameraFov / 110) * 0.01);
}
function recordingYaw(%val)
{
RecordingFreelookGui.camYaw += recordingGetMouseAdjustAmount(%val);
}
function recordingPitch(%val)
{
RecordingFreelookGui.camPitch += recordingGetMouseAdjustAmount(%val);
}
RecordingActionMap.bindCmd(keyboard, "escape", "", "toggleShellDlg();");
RecordingActionMap.bind("keyboard", "h", "demoSetViewHud");
RecordingActionMap.bind("keyboard", "f", "demoSetViewFree");
RecordingActionMap.bind("keyboard", "c", "demoSetViewCmdr");
RecordingActionMap.bind("keyboard", "p", "demoTogglePerspective");
RecordingActionMap.bind("keyboard", "space", "demoTogglePause");
RecordingActionMap.bind("keyboard", "j", "demoJumpTo");
RecordingActionMap.bind("keyboard", "a", "recordingMoveLeft" );
RecordingActionMap.bind("keyboard", "d", "recordingMoveRight" );
RecordingActionMap.bind("keyboard", "w", "recordingMoveForward" );
RecordingActionMap.bind("keyboard", "s", "recordingMoveBackward" );
RecordingActionMap.bind("mouse0", "xaxis", "S", $pref::Input::MouseSensitivity, "recordingYaw");
RecordingActionMap.bind("mouse0", "yaxis", "S", $pref::Input::MouseSensitivity, "recordingPitch");
RecordingActionMap.bind("mouse0", "zaxis", mouseZoom);
RecordingActionMap.bindCmd("mouse", "button0", "demoChangePlaySpeed(1);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("mouse", "button1", "demoChangePlaySpeed(2);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("mouse", "button2", "demoChangePlaySpeed(3);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "1", "demoChangePlaySpeed(1);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "2", "demoChangePlaySpeed(2);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "3", "demoChangePlaySpeed(3);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "4", "demoChangePlaySpeed(4);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "5", "demoChangePlaySpeed(5);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "6", "demoChangePlaySpeed(6);", "demoResetPlaySpeed();");
|
//------------------------------------------------------------------------------
// Revenge Of The Cats: Ethernet
// Copyright (C) 2008, mEthLab Interactive
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// binds when playing back a recording
//------------------------------------------------------------------------------
if(isObject(RecordingActionMap)) RecordingActionMap.delete();
new ActionMap(RecordingActionMap);
function recordingMoveleft(%val)
{
RecordingFreelookGui.camLeftAction = %val;
}
function recordingMoveRight(%val)
{
RecordingFreelookGui.camRightAction = %val;
}
function recordingMoveForward(%val)
{
RecordingFreelookGui.camForwardAction = %val;
}
function recordingMoveBackward(%val)
{
RecordingFreelookGui.camBackwardAction = %val;
}
function recordingGetMouseAdjustAmount(%val)
{
// based on a default camera fov of 110'
return(%val * ($cameraFov / 110) * 0.01);
}
function recordingYaw(%val)
{
RecordingFreelookGui.camYaw += recordingGetMouseAdjustAmount(%val);
}
function recordingPitch(%val)
{
RecordingFreelookGui.camPitch += recordingGetMouseAdjustAmount(%val);
}
RecordingActionMap.bindCmd(keyboard, "escape", "", "toggleShellDlg();");
RecordingActionMap.bind("keyboard", "h", "demoSetViewHud");
RecordingActionMap.bind("keyboard", "f", "demoSetViewFree");
RecordingActionMap.bind("keyboard", "c", "demoSetViewCmdr");
RecordingActionMap.bind("keyboard", "p", "demoTogglePerspective");
RecordingActionMap.bind("keyboard", "space", "demoTogglePause");
RecordingActionMap.bind("keyboard", "j", "demoJumpTo");
RecordingActionMap.bind("keyboard", "a", "recordingMoveLeft" );
RecordingActionMap.bind("keyboard", "d", "recordingMoveRight" );
RecordingActionMap.bind("keyboard", "w", "recordingMoveForward" );
RecordingActionMap.bind("keyboard", "s", "recordingMoveBackward" );
RecordingActionMap.bind("mouse0", "xaxis", "S", $pref::Input::MouseSensitivity, "recordingYaw");
RecordingActionMap.bind("mouse0", "yaxis", "S", $pref::Input::MouseSensitivity, "recordingPitch");
RecordingActionMap.bindCmd("mouse", "button0", "demoChangePlaySpeed(1);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("mouse", "button1", "demoChangePlaySpeed(2);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("mouse", "button2", "demoChangePlaySpeed(3);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "1", "demoChangePlaySpeed(1);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "2", "demoChangePlaySpeed(2);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "3", "demoChangePlaySpeed(3);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "4", "demoChangePlaySpeed(4);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "5", "demoChangePlaySpeed(5);", "demoResetPlaySpeed();");
RecordingActionMap.bindCmd("keyboard", "6", "demoChangePlaySpeed(6);", "demoResetPlaySpeed();");
|
lgpl-2.1
|
C#
|
b3dc37cecff09d813a5b39fe6ef7c1b1668471ed
|
Set the Accept header.
|
threedaymonk/iplayer-dl.net
|
src/IPDL/Request.cs
|
src/IPDL/Request.cs
|
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
namespace IPDL {
abstract class AbstractRequest {
private string userAgent;
private string url;
private CookieContainer cookies;
public delegate void ResponseHandler(WebResponse response);
public delegate void ResponseStreamHandler(Stream stream);
public AbstractRequest(string url, CookieContainer cookies, string userAgent) {
this.url = url;
this.cookies = cookies;
this.userAgent = userAgent;
}
protected HttpWebRequest Request() {
HttpWebRequest r = (HttpWebRequest)WebRequest.Create(url);
r.Accept = "*/*";
if (userAgent != null) r.UserAgent = userAgent;
if (cookies != null) r.CookieContainer = cookies;
return r;
}
protected void WithResponseStream(HttpWebRequest request, ResponseStreamHandler streamHandler) {
using (var response = request.GetResponse()) {
using (var stream = response.GetResponseStream()) {
streamHandler(stream);
}
}
}
}
class GeneralRequest : AbstractRequest {
public GeneralRequest(string url)
: base(url, null, null) {}
public void GetResponseStream(ResponseStreamHandler streamHandler) {
WithResponseStream(Request(), streamHandler);
}
}
class IphoneRequest : AbstractRequest {
private static string UserAgent =
"Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) "+
"AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16";
public IphoneRequest(string url, CookieContainer cookies)
: base(url, cookies, IphoneRequest.UserAgent) {}
public void GetResponseStream(ResponseStreamHandler streamHandler) {
WithResponseStream(Request(), streamHandler);
}
}
class CoreMediaRequest : AbstractRequest {
private static string UserAgent =
"Apple iPhone v1.1.4 CoreMedia v1.0.0.4A102";
private int contentLength = -1;
public CoreMediaRequest(string url, CookieContainer cookies)
: base(url, cookies, CoreMediaRequest.UserAgent) {}
public int ContentLength {
get {
MakeInitialRangeRequestIfNecessary();
return contentLength;
}
}
private void MakeInitialRangeRequestIfNecessary() {
if (contentLength >= 0)
return;
var request = Request();
request.AddRange(0, 1);
using (var response = request.GetResponse()) {
this.contentLength = int.Parse(Regex.Match(response.Headers["Content-Range"], @"\d+$").Value);
}
}
public void GetResponseStreamFromOffset(int offset, ResponseStreamHandler streamHandler) {
var contentLength = ContentLength;
var request = Request();
request.AddRange(offset, contentLength);
WithResponseStream(request, streamHandler);
}
}
}
|
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
namespace IPDL {
abstract class AbstractRequest {
private string userAgent;
private string url;
private CookieContainer cookies;
public delegate void ResponseHandler(WebResponse response);
public delegate void ResponseStreamHandler(Stream stream);
public AbstractRequest(string url, CookieContainer cookies, string userAgent) {
this.url = url;
this.cookies = cookies;
this.userAgent = userAgent;
}
protected HttpWebRequest Request() {
HttpWebRequest r = (HttpWebRequest)WebRequest.Create(url);
if (userAgent != null) r.UserAgent = userAgent;
if (cookies != null) r.CookieContainer = cookies;
return r;
}
protected void WithResponseStream(HttpWebRequest request, ResponseStreamHandler streamHandler) {
using (var response = request.GetResponse()) {
using (var stream = response.GetResponseStream()) {
streamHandler(stream);
}
}
}
}
class GeneralRequest : AbstractRequest {
public GeneralRequest(string url)
: base(url, null, null) {}
public void GetResponseStream(ResponseStreamHandler streamHandler) {
WithResponseStream(Request(), streamHandler);
}
}
class IphoneRequest : AbstractRequest {
private static string UserAgent =
"Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) "+
"AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16";
public IphoneRequest(string url, CookieContainer cookies)
: base(url, cookies, IphoneRequest.UserAgent) {}
public void GetResponseStream(ResponseStreamHandler streamHandler) {
WithResponseStream(Request(), streamHandler);
}
}
class CoreMediaRequest : AbstractRequest {
private static string UserAgent =
"Apple iPhone v1.1.4 CoreMedia v1.0.0.4A102";
private int contentLength = -1;
public CoreMediaRequest(string url, CookieContainer cookies)
: base(url, cookies, CoreMediaRequest.UserAgent) {}
public int ContentLength {
get {
MakeInitialRangeRequestIfNecessary();
return contentLength;
}
}
private void MakeInitialRangeRequestIfNecessary() {
if (contentLength >= 0)
return;
var request = Request();
request.AddRange(0, 1);
using (var response = request.GetResponse()) {
this.contentLength = int.Parse(Regex.Match(response.Headers["Content-Range"], @"\d+$").Value);
}
}
public void GetResponseStreamFromOffset(int offset, ResponseStreamHandler streamHandler) {
var contentLength = ContentLength;
var request = Request();
request.AddRange(offset, contentLength);
WithResponseStream(request, streamHandler);
}
}
}
|
mit
|
C#
|
cfef767cc81b58278386affe8e500987c2f4a776
|
Remove whitespace in informational text
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Common/Utilities/AssemblyExtensions.cs
|
source/Nuke.Common/Utilities/AssemblyExtensions.cs
|
// Copyright 2018 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using System.Reflection;
namespace Nuke.Common.Utilities
{
public static class AssemblyExtensions
{
public static string GetInformationalText(this Assembly assembly)
{
return $"version {assembly.GetVersionText()} ({EnvironmentInfo.Platform},{EnvironmentInfo.Framework})";
}
public static string GetVersionText(this Assembly assembly)
{
var informationalVersion = assembly.GetAssemblyInformationalVersion();
var plusIndex = informationalVersion.IndexOf(value: '+');
return plusIndex == -1 ? "LOCAL" : informationalVersion.Substring(startIndex: 0, length: plusIndex);
}
private static string GetAssemblyInformationalVersion(this Assembly assembly)
{
return assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
}
}
}
|
// Copyright 2018 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using System.Reflection;
namespace Nuke.Common.Utilities
{
public static class AssemblyExtensions
{
public static string GetInformationalText(this Assembly assembly)
{
return $"version {assembly.GetVersionText()} ({EnvironmentInfo.Platform}, {EnvironmentInfo.Framework})";
}
public static string GetVersionText(this Assembly assembly)
{
var informationalVersion = assembly.GetAssemblyInformationalVersion();
var plusIndex = informationalVersion.IndexOf(value: '+');
return plusIndex == -1 ? "LOCAL" : informationalVersion.Substring(startIndex: 0, length: plusIndex);
}
private static string GetAssemblyInformationalVersion(this Assembly assembly)
{
return assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
}
}
}
|
mit
|
C#
|
ee0401405180eeecd129f5c9b3246f431df05850
|
Rename Tenant to Domain in the web api template
|
seancpeters/templating,rschiefer/templating,danroth27/templating,rschiefer/templating,seancpeters/templating,lambdakris/templating,danroth27/templating,mlorbetske/templating,rschiefer/templating,lambdakris/templating,mlorbetske/templating,seancpeters/templating,seancpeters/templating,danroth27/templating,lambdakris/templating
|
template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/WebApi-CSharp/AzureAdB2COptions.cs
|
template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/WebApi-CSharp/AzureAdB2COptions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Company.WebApplication1
{
public class AzureAdB2COptions
{
public string ClientId { get; set; }
public string AzureAdB2CInstance { get; set; }
public string Domain { get; set; }
public string SignUpSignInPolicyId { get; set; }
public string DefaultPolicy => SignUpSignInPolicyId;
public string Authority => $"{AzureAdB2CInstance}/{Domain}/{DefaultPolicy}/v2.0";
public string Audience => ClientId;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Company.WebApplication1
{
public class AzureAdB2COptions
{
public string ClientId { get; set; }
public string AzureAdB2CInstance { get; set; }
public string Tenant { get; set; }
public string SignUpSignInPolicyId { get; set; }
public string DefaultPolicy => SignUpSignInPolicyId;
public string Authority => $"{AzureAdB2CInstance}/{Tenant}/{DefaultPolicy}/v2.0";
public string Audience => ClientId;
}
}
|
mit
|
C#
|
41979ed9765599c1ccb325d4ecf3496df35ed4ec
|
fix RoundRobinAddressRouter
|
lvermeulen/Equalizer
|
src/Equalizer.Nanophone/RoundRobinAddressRouter.cs
|
src/Equalizer.Nanophone/RoundRobinAddressRouter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Equalizer.Core;
using Nanophone.Core;
namespace Equalizer.Nanophone
{
public class RoundRobinAddressRouter : BaseTenaciousRouter<RegistryInformation>
{
private readonly Func<RegistryInformation, RegistryInformation, bool> _discriminator;
public RoundRobinAddressRouter()
{
_discriminator = (x, y) => x?.Address == y?.Address;
}
public override RegistryInformation Choose(RegistryInformation previous, IList<RegistryInformation> instances)
{
int previousIndex = instances.IndexOf(previous);
var next = instances
.Skip(previousIndex < 0 ? 0 : previousIndex + 1)
.FirstOrDefault(x => _discriminator(x, previous) == false) ?? instances.FirstOrDefault();
Previous = next;
return next;
}
}
}
|
using System;
using System.Collections.Generic;
using Equalizer.Core;
using Equalizer.Routers;
using Nanophone.Core;
namespace Equalizer.Nanophone
{
public class RoundRobinAddressRouter : BaseDiscriminatingRouter<RegistryInformation>
{
private readonly RoundRobinRouter<RegistryInformation> _router;
public RoundRobinAddressRouter()
{
_router = new RoundRobinRouter<RegistryInformation>();
Discriminator = (x, y) => x?.Address == y?.Address;
}
public override Func<RegistryInformation, RegistryInformation, bool> Discriminator { get; }
public override RegistryInformation Choose(RegistryInformation previous, IList<RegistryInformation> instances)
{
var next = _router.Choose(instances);
Previous = next;
return next;
}
}
}
|
mit
|
C#
|
25a0562a17f85f5bbb7944514d2013bb5a2b0410
|
Fix classification test to use object type.
|
dotnet/roslyn,sharwell/roslyn,jmarolf/roslyn,ErikSchierboom/roslyn,sharwell/roslyn,AlekseyTs/roslyn,genlu/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,ErikSchierboom/roslyn,gafter/roslyn,eriawan/roslyn,heejaechang/roslyn,aelij/roslyn,AmadeusW/roslyn,genlu/roslyn,agocke/roslyn,panopticoncentral/roslyn,diryboy/roslyn,stephentoub/roslyn,brettfo/roslyn,abock/roslyn,KirillOsenkov/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,physhi/roslyn,AlekseyTs/roslyn,bartdesmet/roslyn,agocke/roslyn,wvdd007/roslyn,AmadeusW/roslyn,davkean/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,panopticoncentral/roslyn,nguerrera/roslyn,dotnet/roslyn,davkean/roslyn,mgoertz-msft/roslyn,mavasani/roslyn,jmarolf/roslyn,weltkante/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,physhi/roslyn,tmat/roslyn,abock/roslyn,wvdd007/roslyn,sharwell/roslyn,tmat/roslyn,tmat/roslyn,heejaechang/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,genlu/roslyn,mavasani/roslyn,weltkante/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,physhi/roslyn,stephentoub/roslyn,davkean/roslyn,brettfo/roslyn,bartdesmet/roslyn,agocke/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,reaction1989/roslyn,mavasani/roslyn,panopticoncentral/roslyn,abock/roslyn,brettfo/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,tannergooding/roslyn,gafter/roslyn,aelij/roslyn,aelij/roslyn,weltkante/roslyn,diryboy/roslyn,reaction1989/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,wvdd007/roslyn,nguerrera/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,eriawan/roslyn,gafter/roslyn,jasonmalinowski/roslyn,stephentoub/roslyn,KevinRansom/roslyn,nguerrera/roslyn
|
src/VisualStudio/LiveShare/Test/ClassificationsHandlerTests.cs
|
src/VisualStudio/LiveShare/Test/ClassificationsHandlerTests.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol;
using Xunit;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests
{
public class ClassificationsHandlerTests : AbstractLiveShareRequestHandlerTests
{
[Fact]
public async Task TestClassificationsAsync()
{
var markup =
@"class A
{
void M()
{
{|classify:var|} i = 1;
}
}";
var (solution, ranges) = CreateTestSolution(markup);
var classifyLocation = ranges["classify"].First();
var results = await TestHandleAsync<ClassificationParams, object[]>(solution, CreateClassificationParams(classifyLocation));
AssertCollectionsEqual(new ClassificationSpan[] { CreateClassificationSpan("keyword", classifyLocation.Range) }, results, AssertClassificationsEqual);
}
private static void AssertClassificationsEqual(ClassificationSpan expected, ClassificationSpan actual)
{
Assert.Equal(expected.Classification, actual.Classification);
Assert.Equal(expected.Range, actual.Range);
}
private static ClassificationSpan CreateClassificationSpan(string classification, Range range)
=> new ClassificationSpan()
{
Classification = classification,
Range = range
};
private static ClassificationParams CreateClassificationParams(Location location)
=> new ClassificationParams()
{
Range = location.Range,
TextDocument = CreateTextDocumentIdentifier(location.Uri)
};
}
}
|
// 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.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol;
using Xunit;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests
{
public class ClassificationsHandlerTests : AbstractLiveShareRequestHandlerTests
{
[Fact]
public async Task TestClassificationsAsync()
{
var markup =
@"class A
{
void M()
{
{|classify:var|} i = 1;
}
}";
var (solution, ranges) = CreateTestSolution(markup);
var classifyLocation = ranges["classify"].First();
var results = await TestHandleAsync<ClassificationParams, ClassificationSpan[]>(solution, CreateClassificationParams(classifyLocation));
AssertCollectionsEqual(new ClassificationSpan[] { CreateClassificationSpan("keyword", classifyLocation.Range) }, results, AssertClassificationsEqual);
}
private static void AssertClassificationsEqual(ClassificationSpan expected, ClassificationSpan actual)
{
Assert.Equal(expected.Classification, actual.Classification);
Assert.Equal(expected.Range, actual.Range);
}
private static ClassificationSpan CreateClassificationSpan(string classification, Range range)
=> new ClassificationSpan()
{
Classification = classification,
Range = range
};
private static ClassificationParams CreateClassificationParams(Location location)
=> new ClassificationParams()
{
Range = location.Range,
TextDocument = CreateTextDocumentIdentifier(location.Uri)
};
}
}
|
mit
|
C#
|
7c0f66d0f5ea4bb57eab6826003023248078eb6e
|
fix exit error with -nr
|
yyc12345/bili-live-dm-console
|
DanmakuRecord.cs
|
DanmakuRecord.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Net;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using bili_live_dm_console.BiliDMLib;
using bili_live_dm_console.BilibiliDM_PluginFramework;
namespace bili_live_dm_console
{
public class DanmakuRecord
{
public DanmakuRecord(bool isRecord)
{
this.isRecord = isRecord;
if (isRecord)
{
var path = new FilePathBuilder(Environment.CurrentDirectory, Environment.OSVersion.Platform);
var cache = DateTime.Now;
var file = path.Enter(cache.Year.ToString() + cache.Month.ToString() + cache.Day.ToString() + "_record.txt").Path;
if (System.IO.File.Exists(file)) sw = new StreamWriter(file, true, Encoding.UTF8);
else sw = new StreamWriter(file, false, Encoding.UTF8);
}
}
StreamWriter sw;
bool isRecord;
public void Record(string str)
{
if (isRecord)
sw.WriteLineAsync(str);
}
public void Close()
{
if (isRecord)
{
sw.Close();
sw.Dispose();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Net;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using bili_live_dm_console.BiliDMLib;
using bili_live_dm_console.BilibiliDM_PluginFramework;
namespace bili_live_dm_console
{
public class DanmakuRecord
{
public DanmakuRecord(bool isRecord)
{
this.isRecord = isRecord;
if (isRecord)
{
var path = new FilePathBuilder(Environment.CurrentDirectory, Environment.OSVersion.Platform);
var cache = DateTime.Now;
var file = path.Enter(cache.Year.ToString() + cache.Month.ToString() + cache.Day.ToString() + "_record.txt").Path;
if (System.IO.File.Exists(file)) sw = new StreamWriter(file, true, Encoding.UTF8);
else sw = new StreamWriter(file, false, Encoding.UTF8);
}
}
StreamWriter sw;
bool isRecord;
public void Record(string str)
{
if (isRecord)
sw.WriteLineAsync(str);
}
public void Close(){
sw.Close();
sw.Dispose();
}
}
}
|
mit
|
C#
|
eea95ec6b78b6a2d1c9496b1800cbfa1347f025f
|
Copy Paste TSL
|
ucdavis/CRP,ucdavis/CRP,ucdavis/CRP
|
CRP.Mvc/Global.asax.cs
|
CRP.Mvc/Global.asax.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace CRP.Mvc
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
LogConfig.ConfigureLogging();
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace CRP.Mvc
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
LogConfig.ConfigureLogging();
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
|
mit
|
C#
|
6f0b8d232568645e4d24f183b5efb5d8d39a69fa
|
Update AssemblyInfo.cs
|
hfurubotten/Heine.Mvc.ActionFilters
|
Heine.Mvc.ActionFilters/Properties/AssemblyInfo.cs
|
Heine.Mvc.ActionFilters/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Heine.Mvc.ActionFilters")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Heine.Mvc.ActionFilters")]
[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("2c0323c5-c5fd-4999-835f-401e84bf9398")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.13")]
[assembly: AssemblyFileVersion("2.0.0.13")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Heine.Mvc.ActionFilters")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Heine.Mvc.ActionFilters")]
[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("2c0323c5-c5fd-4999-835f-401e84bf9398")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.12")]
[assembly: AssemblyFileVersion("2.0.0.12")]
|
mit
|
C#
|
d03a70b8b189d4566377f2575965db944fe13cba
|
Add ActionList resource type
|
SteamDatabase/ValveResourceFormat
|
ValveResourceFormat/Resource/Enums/ResourceType.cs
|
ValveResourceFormat/Resource/Enums/ResourceType.cs
|
using System;
namespace ValveResourceFormat
{
[AttributeUsage(AttributeTargets.Field)]
public class ExtensionAttribute : Attribute
{
public string Extension { get; set; }
public ExtensionAttribute(string extension)
{
Extension = extension;
}
}
// Friendly names are used
public enum ResourceType
{
#pragma warning disable 1591
Unknown = 0,
[Extension("vanim")]
Animation,
[Extension("vagrp")]
AnimationGroup,
[Extension("valst")]
ActionList,
[Extension("vseq")]
Sequence,
[Extension("vpcf")]
Particle,
[Extension("vmat")]
Material,
[Extension("vmks")]
Sheet,
[Extension("vmesh")]
Mesh,
[Extension("vtex")]
Texture,
[Extension("vmdl")]
Model,
[Extension("vphys")]
PhysicsCollisionMesh,
[Extension("vsnd")]
Sound,
[Extension("vmorf")]
Morph,
[Extension("vrman")]
ResourceManifest,
[Extension("vwrld")]
World,
[Extension("vwnod")]
WorldNode,
[Extension("vvis")]
WorldVisibility,
[Extension("vents")]
EntityLump,
[Extension("vsurf")]
SurfaceProperties,
[Extension("vsndevts")]
SoundEventScript,
[Extension("vsndstck")]
SoundStackScript,
[Extension("vfont")]
BitmapFont,
[Extension("vrmap")]
ResourceRemapTable,
// All Panorama* are compiled just as CompilePanorama
Panorama,
[Extension("vcss")]
PanoramaStyle = Panorama,
[Extension("vxml")]
PanoramaLayout = Panorama,
[Extension("vpdi")]
PanoramaDynamicImages = Panorama,
[Extension("vjs")]
PanoramaScript = Panorama,
[Extension("vpsf")]
ParticleSnapshot,
[Extension("vmap")]
Map,
#pragma warning restore 1591
}
}
|
using System;
namespace ValveResourceFormat
{
[AttributeUsage(AttributeTargets.Field)]
public class ExtensionAttribute : Attribute
{
public string Extension { get; set; }
public ExtensionAttribute(string extension)
{
Extension = extension;
}
}
// Friendly names are used
public enum ResourceType
{
#pragma warning disable 1591
Unknown = 0,
[Extension("vanim")]
Animation,
[Extension("vagrp")]
AnimationGroup,
[Extension("vseq")]
Sequence,
[Extension("vpcf")]
Particle,
[Extension("vmat")]
Material,
[Extension("vmks")]
Sheet,
[Extension("vmesh")]
Mesh,
[Extension("vtex")]
Texture,
[Extension("vmdl")]
Model,
[Extension("vphys")]
PhysicsCollisionMesh,
[Extension("vsnd")]
Sound,
[Extension("vmorf")]
Morph,
[Extension("vrman")]
ResourceManifest,
[Extension("vwrld")]
World,
[Extension("vwnod")]
WorldNode,
[Extension("vvis")]
WorldVisibility,
[Extension("vents")]
EntityLump,
[Extension("vsurf")]
SurfaceProperties,
[Extension("vsndevts")]
SoundEventScript,
[Extension("vsndstck")]
SoundStackScript,
[Extension("vfont")]
BitmapFont,
[Extension("vrmap")]
ResourceRemapTable,
// All Panorama* are compiled just as CompilePanorama
Panorama,
[Extension("vcss")]
PanoramaStyle = Panorama,
[Extension("vxml")]
PanoramaLayout = Panorama,
[Extension("vpdi")]
PanoramaDynamicImages = Panorama,
[Extension("vjs")]
PanoramaScript = Panorama,
[Extension("vpsf")]
ParticleSnapshot,
[Extension("vmap")]
Map,
#pragma warning restore 1591
}
}
|
mit
|
C#
|
84ec3d8465c78fe7916a8905cedbb83e1c85f168
|
Add code to remove all old settings
|
MHeasell/Mappy,MHeasell/Mappy
|
Mappy/Program.cs
|
Mappy/Program.cs
|
namespace Mappy
{
using System;
using System.IO;
using System.Windows.Forms;
using UI.Forms;
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
RemoveOldVersionSettings();
Application.ThreadException += Program.OnGuiUnhandedException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
private static void HandleUnhandledException(object o)
{
Exception e = o as Exception;
if (e != null)
{
throw e;
}
}
private static void OnGuiUnhandedException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
HandleUnhandledException(e.Exception);
}
private static void RemoveOldVersionSettings()
{
string appDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string oldDir = Path.Combine(appDir, @"Armoured_Fish");
try
{
if (Directory.Exists(oldDir))
{
Directory.Delete(oldDir, true);
}
}
catch (IOException)
{
// we don't care if this fails
}
}
}
}
|
namespace Mappy
{
using System;
using System.Windows.Forms;
using UI.Forms;
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
Application.ThreadException += Program.OnGuiUnhandedException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
private static void HandleUnhandledException(object o)
{
Exception e = o as Exception;
if (e != null)
{
throw e;
}
}
private static void OnGuiUnhandedException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
HandleUnhandledException(e.Exception);
}
}
}
|
mit
|
C#
|
b36e534195deddf7ee8c4099499038814189d449
|
Set version to 1.2.1.0
|
ccellar/mite.net,ccellar/mite.net
|
trunk/CodeBase/mite.net/Properties/AssemblyInfo.cs
|
trunk/CodeBase/mite.net/Properties/AssemblyInfo.cs
|
//-----------------------------------------------------------------------
// <copyright>
// This software is licensed as Microsoft Public License (Ms-PL).
// </copyright>
//-----------------------------------------------------------------------
using System;
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("mite.net api")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("langalaxy.de - Christoph Keller")]
[assembly: AssemblyProduct("mite.net api")]
[assembly: AssemblyCopyright("Copyright © 2009-2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("38bae65a-c8f3-44d8-be2e-c18fa2fd24a5")]
// 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.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: InternalsVisibleTo("mite.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b3f0c2a3e38550ea1b998ff7787f727666886373a8e22ef1ff3ebef7dc79f9eb12b46f0e530194ee06e07bad385b0ec876c88618dee7dbd6c24c938625e83a636f693f283aead9b1615fffaa63ed0b08596a48efa17568b9a6f5712b81d3eb92e0669623e9e75f87e42d456aa33f9a7645d4a864bb961e267d06d95880524cc6")]
[assembly: CLSCompliant(true)]
|
//-----------------------------------------------------------------------
// <copyright>
// This software is licensed as Microsoft Public License (Ms-PL).
// </copyright>
//-----------------------------------------------------------------------
using System;
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("mite.net api")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("langalaxy.de - Christoph Keller")]
[assembly: AssemblyProduct("mite.net api")]
[assembly: AssemblyCopyright("Copyright © 2009-2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("38bae65a-c8f3-44d8-be2e-c18fa2fd24a5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: InternalsVisibleTo("mite.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b3f0c2a3e38550ea1b998ff7787f727666886373a8e22ef1ff3ebef7dc79f9eb12b46f0e530194ee06e07bad385b0ec876c88618dee7dbd6c24c938625e83a636f693f283aead9b1615fffaa63ed0b08596a48efa17568b9a6f5712b81d3eb92e0669623e9e75f87e42d456aa33f9a7645d4a864bb961e267d06d95880524cc6")]
[assembly: CLSCompliant(true)]
|
bsd-3-clause
|
C#
|
fecb4e7314a4ea473d6aab0b32af3112e61b14b8
|
Add default AppDeleteCommand initializer
|
appharbor/appharbor-cli
|
src/AppHarbor/Commands/AppDeleteCommand.cs
|
src/AppHarbor/Commands/AppDeleteCommand.cs
|
using System;
namespace AppHarbor.Commands
{
[CommandHelp("Delete application")]
public class AppDeleteCommand : ICommand
{
public AppDeleteCommand()
{
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
|
using System;
namespace AppHarbor.Commands
{
[CommandHelp("Delete application")]
public class AppDeleteCommand : ICommand
{
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
d30be3efa3f9f2af6250efda119d3c99827f403c
|
Update Trigger.cs
|
wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors
|
src/Avalonia.Xaml.Interactivity/Trigger.cs
|
src/Avalonia.Xaml.Interactivity/Trigger.cs
|
using Avalonia.Metadata;
namespace Avalonia.Xaml.Interactivity;
/// <summary>
/// A base class for behaviors, implementing the basic plumbing of <seealso cref="ITrigger"/>.
/// </summary>
public abstract class Trigger : Behavior, ITrigger
{
/// <summary>
/// Identifies the <seealso cref="Actions"/> avalonia property.
/// </summary>
public static readonly DirectProperty<Trigger, ActionCollection> ActionsProperty =
AvaloniaProperty.RegisterDirect<Trigger, ActionCollection>(nameof(Actions), t => t.Actions);
private ActionCollection? _actions;
/// <summary>
/// Gets the collection of actions associated with the behavior. This is a avalonia property.
/// </summary>
[Content]
public ActionCollection Actions => _actions ??= new ActionCollection();
}
|
using Avalonia.Metadata;
namespace Avalonia.Xaml.Interactivity;
/// <summary>
/// A base class for behaviors, implementing the basic plumbing of <seealso cref="ITrigger"/>.
/// </summary>
public abstract class Trigger : Behavior, ITrigger
{
/// <summary>
/// Identifies the <seealso cref="Actions"/> avalonia property.
/// </summary>
public static readonly DirectProperty<Trigger, ActionCollection?> ActionsProperty =
AvaloniaProperty.RegisterDirect<Trigger, ActionCollection?>(nameof(Actions), t => t.Actions);
private ActionCollection? _actions;
/// <summary>
/// Gets the collection of actions associated with the behavior. This is a avalonia property.
/// </summary>
[Content]
public ActionCollection? Actions => _actions ??= new ActionCollection();
}
|
mit
|
C#
|
e993f4be927a993c3d1abd21d58085625e953355
|
Fix flush unclaer data bugs.
|
ouraspnet/cap,dotnetcore/CAP,dotnetcore/CAP,dotnetcore/CAP
|
src/DotNetCore.CAP/ICapTransaction.Base.cs
|
src/DotNetCore.CAP/ICapTransaction.Base.cs
|
using System.Collections.Generic;
using DotNetCore.CAP.Models;
namespace DotNetCore.CAP
{
public abstract class CapTransactionBase : ICapTransaction
{
private readonly IDispatcher _dispatcher;
private readonly IList<CapPublishedMessage> _bufferList;
protected CapTransactionBase(IDispatcher dispatcher)
{
_dispatcher = dispatcher;
_bufferList = new List<CapPublishedMessage>(1);
}
public bool AutoCommit { get; set; }
public object DbTransaction { get; set; }
protected internal virtual void AddToSent(CapPublishedMessage msg)
{
_bufferList.Add(msg);
}
protected virtual void Flush()
{
foreach (var message in _bufferList)
{
_dispatcher.EnqueueToPublish(message);
}
_bufferList.Clear();
}
public abstract void Commit();
public abstract void Rollback();
public abstract void Dispose();
}
}
|
using System.Collections.Generic;
using DotNetCore.CAP.Models;
namespace DotNetCore.CAP
{
public abstract class CapTransactionBase : ICapTransaction
{
private readonly IDispatcher _dispatcher;
private readonly IList<CapPublishedMessage> _bufferList;
protected CapTransactionBase(IDispatcher dispatcher)
{
_dispatcher = dispatcher;
_bufferList = new List<CapPublishedMessage>(1);
}
public bool AutoCommit { get; set; }
public object DbTransaction { get; set; }
protected internal virtual void AddToSent(CapPublishedMessage msg)
{
_bufferList.Add(msg);
}
protected void Flush()
{
foreach (var message in _bufferList)
{
_dispatcher.EnqueueToPublish(message);
}
}
public abstract void Commit();
public abstract void Rollback();
public abstract void Dispose();
}
}
|
mit
|
C#
|
0697c78826e7fd14d001dbd9de2a6073635bb77b
|
Fix one remaining case of incorrect audio testing
|
ZLima12/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework
|
osu.Framework.Tests/Audio/DevicelessAudioTest.cs
|
osu.Framework.Tests/Audio/DevicelessAudioTest.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 NUnit.Framework;
namespace osu.Framework.Tests.Audio
{
[TestFixture]
public class DevicelessAudioTest : AudioThreadTest
{
public override void SetUp()
{
base.SetUp();
// lose all devices
Manager.SimulateDeviceLoss();
}
[Test]
public void TestPlayTrackWithoutDevices()
{
var track = Manager.Tracks.Get("Tracks.sample-track.mp3");
// start track
track.Restart();
Assert.IsTrue(track.IsRunning);
CheckTrackIsProgressing(track);
// stop track
track.Stop();
WaitForOrAssert(() => !track.IsRunning, "Track did not stop", 1000);
Assert.IsFalse(track.IsRunning);
// seek track
track.Seek(0);
Assert.IsFalse(track.IsRunning);
WaitForOrAssert(() => track.CurrentTime == 0, "Track did not seek correctly", 1000);
}
}
}
|
// 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 NUnit.Framework;
namespace osu.Framework.Tests.Audio
{
[TestFixture]
public class DevicelessAudioTest : AudioThreadTest
{
public override void SetUp()
{
base.SetUp();
// lose all devices
Manager.SimulateDeviceLoss();
}
[Test]
public void TestPlayTrackWithoutDevices()
{
var track = Manager.Tracks.Get("Tracks.sample-track.mp3");
// start track
track.Restart();
Assert.IsTrue(track.IsRunning);
CheckTrackIsProgressing(track);
// stop track
track.Stop();
WaitForOrAssert(() => !track.IsRunning, "Track did not stop", 1000);
Assert.IsFalse(track.IsRunning);
// seek track
track.Seek(0);
Assert.IsFalse(track.IsRunning);
Assert.AreEqual(track.CurrentTime, 0);
}
}
}
|
mit
|
C#
|
69da804f817dac304b7bc36587070d5f129b5eae
|
Add missing period
|
UselessToucan/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu-new,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu
|
osu.Game/Rulesets/Edit/Checks/CheckBackground.cs
|
osu.Game/Rulesets/Edit/Checks/CheckBackground.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit.Checks.Components;
namespace osu.Game.Rulesets.Edit.Checks
{
public class CheckBackground : ICheck
{
public CheckMetadata Metadata { get; } = new CheckMetadata(CheckCategory.Resources, "Missing background");
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
{
new IssueTemplateNoneSet(this),
new IssueTemplateDoesNotExist(this)
};
public IEnumerable<Issue> Run(IBeatmap beatmap)
{
if (beatmap.Metadata.BackgroundFile == null)
{
yield return new IssueTemplateNoneSet(this).Create();
yield break;
}
// If the background is set, also make sure it still exists.
var set = beatmap.BeatmapInfo.BeatmapSet;
var file = set.Files.FirstOrDefault(f => f.Filename == beatmap.Metadata.BackgroundFile);
if (file != null)
yield break;
yield return new IssueTemplateDoesNotExist(this).Create(beatmap.Metadata.BackgroundFile);
}
public class IssueTemplateNoneSet : IssueTemplate
{
public IssueTemplateNoneSet(ICheck check)
: base(check, IssueType.Problem, "No background has been set.")
{
}
public Issue Create() => new Issue(this);
}
public class IssueTemplateDoesNotExist : IssueTemplate
{
public IssueTemplateDoesNotExist(ICheck check)
: base(check, IssueType.Problem, "The background file \"{0}\" does not exist.")
{
}
public Issue Create(string filename) => new Issue(this, filename);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit.Checks.Components;
namespace osu.Game.Rulesets.Edit.Checks
{
public class CheckBackground : ICheck
{
public CheckMetadata Metadata { get; } = new CheckMetadata(CheckCategory.Resources, "Missing background");
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
{
new IssueTemplateNoneSet(this),
new IssueTemplateDoesNotExist(this)
};
public IEnumerable<Issue> Run(IBeatmap beatmap)
{
if (beatmap.Metadata.BackgroundFile == null)
{
yield return new IssueTemplateNoneSet(this).Create();
yield break;
}
// If the background is set, also make sure it still exists.
var set = beatmap.BeatmapInfo.BeatmapSet;
var file = set.Files.FirstOrDefault(f => f.Filename == beatmap.Metadata.BackgroundFile);
if (file != null)
yield break;
yield return new IssueTemplateDoesNotExist(this).Create(beatmap.Metadata.BackgroundFile);
}
public class IssueTemplateNoneSet : IssueTemplate
{
public IssueTemplateNoneSet(ICheck check)
: base(check, IssueType.Problem, "No background has been set")
{
}
public Issue Create() => new Issue(this);
}
public class IssueTemplateDoesNotExist : IssueTemplate
{
public IssueTemplateDoesNotExist(ICheck check)
: base(check, IssueType.Problem, "The background file \"{0}\" does not exist.")
{
}
public Issue Create(string filename) => new Issue(this, filename);
}
}
}
|
mit
|
C#
|
335d1f20419ca96d463080c86ffc0f0009737dbd
|
fix bug where multiple provider panel would never show
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
src/SFA.DAS.EmployerAccounts.Web/ViewModels/AccountDashboardViewModel.cs
|
src/SFA.DAS.EmployerAccounts.Web/ViewModels/AccountDashboardViewModel.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using SFA.DAS.Authorization;
using SFA.DAS.EAS.Portal.Client.Types;
using SFA.DAS.EmployerAccounts.Models.Account;
namespace SFA.DAS.EmployerAccounts.Web.ViewModels
{
public class AccountDashboardViewModel
{
public EmployerAccounts.Models.Account.Account Account { get; set; }
public string EmployerAccountType { get; set; }
public string HashedAccountId { get; set; }
public string HashedUserId { get; set; }
public int OrgainsationCount { get; set; }
public int PayeSchemeCount { get; set; }
public int RequiresAgreementSigning { get; set; }
public bool ShowAcademicYearBanner { get; set; }
public bool ShowWizard { get; set; }
public ICollection<AccountTask> Tasks { get; set; }
public int TeamMemberCount { get; set; }
public int TeamMembersInvited { get; set; }
public string UserFirstName { get; set; }
public Role UserRole { get; set; }
public bool AgreementsToSign { get; set; }
public int SignedAgreementCount { get; set; }
public List<PendingAgreementsViewModel> PendingAgreements { get; set; }
public bool ApprenticeshipAdded { get; set; }
public bool ShowSearchBar { get; set; }
public bool ShowMostActiveLinks { get; set; }
public EAS.Portal.Client.Types.Account AccountViewModel { get; set; }
public Guid? RecentlyAddedReservationId { get; set; }
public Reservation ReservedFundingToShow => AccountViewModel?.Organisations?.SelectMany(org => org.Reservations).FirstOrDefault(rf => rf.Id == RecentlyAddedReservationId) ?? AccountViewModel?.Organisations?.SelectMany(org => org.Reservations)?.LastOrDefault();
public string ReservedFundingOrgName => AccountViewModel?.Organisations?.Where(org => org.Reservations.Contains(ReservedFundingToShow)).Select(org => org.Name).FirstOrDefault();
public bool ShowReservations => AccountViewModel?.Organisations?.FirstOrDefault()?.Reservations?.Count > 0;
public bool HasSingleProvider => AccountViewModel?.Providers?.Count == 1;
public bool HasMultipleProviders => AccountViewModel?.Providers?.Count > 1;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using SFA.DAS.Authorization;
using SFA.DAS.EAS.Portal.Client.Types;
using SFA.DAS.EmployerAccounts.Models.Account;
namespace SFA.DAS.EmployerAccounts.Web.ViewModels
{
public class AccountDashboardViewModel
{
public EmployerAccounts.Models.Account.Account Account { get; set; }
public string EmployerAccountType { get; set; }
public string HashedAccountId { get; set; }
public string HashedUserId { get; set; }
public int OrgainsationCount { get; set; }
public int PayeSchemeCount { get; set; }
public int RequiresAgreementSigning { get; set; }
public bool ShowAcademicYearBanner { get; set; }
public bool ShowWizard { get; set; }
public ICollection<AccountTask> Tasks { get; set; }
public int TeamMemberCount { get; set; }
public int TeamMembersInvited { get; set; }
public string UserFirstName { get; set; }
public Role UserRole { get; set; }
public bool AgreementsToSign { get; set; }
public int SignedAgreementCount { get; set; }
public List<PendingAgreementsViewModel> PendingAgreements { get; set; }
public bool ApprenticeshipAdded { get; set; }
public bool ShowSearchBar { get; set; }
public bool ShowMostActiveLinks { get; set; }
public EAS.Portal.Client.Types.Account AccountViewModel { get; set; }
public Guid? RecentlyAddedReservationId { get; set; }
public Reservation ReservedFundingToShow => AccountViewModel?.Organisations?.SelectMany(org => org.Reservations).FirstOrDefault(rf => rf.Id == RecentlyAddedReservationId) ?? AccountViewModel?.Organisations?.SelectMany(org => org.Reservations)?.LastOrDefault();
public string ReservedFundingOrgName => AccountViewModel?.Organisations?.Where(org => org.Reservations.Contains(ReservedFundingToShow)).Select(org => org.Name).FirstOrDefault();
public bool ShowReservations => AccountViewModel?.Organisations?.FirstOrDefault()?.Reservations?.Count > 0;
public bool HasSingleProvider => AccountViewModel?.Providers?.Count == 1;
public bool HasMultipleProviders => AccountViewModel?.Organisations?.FirstOrDefault().Providers?.Count > 1;
}
}
|
mit
|
C#
|
3ddb82eac782cac1bec47365dd803cb95347ffe3
|
Remove Culture info
|
marshallward/Tesserae
|
src/AssemblyInfo.cs
|
src/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Tesserae")]
[assembly: AssemblyDescription("XNA-based TMX Map Renderer")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tesserae")]
[assembly: AssemblyCopyright("Copyright 2012 Marshall Ward")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Tesserae")]
[assembly: AssemblyDescription("XNA-based TMX Map Renderer")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tesserae")]
[assembly: AssemblyCopyright("Copyright 2012 Marshall Ward")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("en-AU")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
apache-2.0
|
C#
|
82e2a35036d0b8f590b8d51ce6e6424811c388a7
|
Add C# 6.0 string interpolation sample
|
viciousviper/CoverityTestbed
|
CoverityTestbed/Program.cs
|
CoverityTestbed/Program.cs
|
using System;
using System.Globalization;
namespace CoverityTestbed
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, Coverity!");
Console.WriteLine(string.Format(CultureInfo.CurrentCulture, "CLR version is {0}", Environment.Version));
Console.WriteLine($"This is a string interpolation on CLR version {Environment.Version}");
Console.ReadLine();
}
}
}
|
using System;
using System.Globalization;
namespace CoverityTestbed
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, Coverity!");
Console.WriteLine(string.Format(CultureInfo.CurrentCulture, "CLR version is {0}", Environment.Version));
Console.ReadLine();
}
}
}
|
mit
|
C#
|
956cf87bdf6aa868a864aedb8fd272024f67b1c0
|
Add try catch
|
zulhilmizainuddin/geoip,zulhilmizainuddin/geoip
|
src/GeoIP/Executers/IP2LocationQuery.cs
|
src/GeoIP/Executers/IP2LocationQuery.cs
|
using GeoIP.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
namespace GeoIP.Executers
{
public class IP2LocationQuery : IQuery
{
public async Task<string> Query(string ipAddress, string dataSource)
{
string url = $"{dataSource}?ipaddress={ipAddress}";
Object result;
try
{
using (var client = new HttpClient())
using (var response = await client.GetAsync(url))
using (var content = response.Content)
{
var queriedResult = await content.ReadAsStringAsync();
var json = JObject.Parse(queriedResult);
var errorMessage = (string)json["error_message"];
if (errorMessage == null)
{
result = new Geolocation()
{
IPAddress = (string)json["ipaddress"],
City = (string)json["city"],
Country = (string)json["country"],
Latitude = (double?)json["latitude"],
Longitude = (double?)json["longitude"]
};
}
else
{
result = new Error()
{
ErrorMessage = errorMessage
};
}
}
}
catch (Exception ex)
{
result = new Error()
{
ErrorMessage = ex.Message
};
}
return JsonConvert.SerializeObject(result);
}
}
}
|
using GeoIP.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
namespace GeoIP.Executers
{
public class IP2LocationQuery : IQuery
{
public async Task<string> Query(string ipAddress, string dataSource)
{
string url = $"{dataSource}?ipaddress={ipAddress}";
using (var client = new HttpClient())
using (var response = await client.GetAsync(url))
using (var content = response.Content)
{
var queriedResult = await content.ReadAsStringAsync();
var json = JObject.Parse(queriedResult);
Object result;
var errorMessage = (string)json["error_message"];
if (errorMessage == null)
{
result = new Geolocation()
{
IPAddress = (string)json["ipaddress"],
City = (string)json["city"],
Country = (string)json["country"],
Latitude = (double)json["latitude"],
Longitude = (double)json["longitude"]
};
}
else
{
result = new Error()
{
ErrorMessage = errorMessage
};
}
return JsonConvert.SerializeObject(result);
}
}
}
}
|
mit
|
C#
|
42716f4df8a02bf26132d81da9d623d7c2b2549f
|
Switch version to 1.2.9
|
Abc-Arbitrage/Zebus,AtwooTM/Zebus,biarne-a/Zebus,rbouallou/Zebus
|
src/SharedVersionInfo.cs
|
src/SharedVersionInfo.cs
|
using System.Reflection;
[assembly: AssemblyVersion("1.2.9")]
[assembly: AssemblyFileVersion("1.2.9")]
[assembly: AssemblyInformationalVersion("1.2.9")]
|
using System.Reflection;
[assembly: AssemblyVersion("1.2.8")]
[assembly: AssemblyFileVersion("1.2.8")]
[assembly: AssemblyInformationalVersion("1.2.8")]
|
mit
|
C#
|
25b48e38b0b81000096ef200b7ac11ba1e092cdd
|
Update test endpoint names
|
OmniSharp/omnisharp-roslyn,jtbm37/omnisharp-roslyn,nabychan/omnisharp-roslyn,nabychan/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,jtbm37/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn
|
src/OmniSharp.Abstractions/Endpoints.cs
|
src/OmniSharp.Abstractions/Endpoints.cs
|
using System.Threading.Tasks;
using OmniSharp.Mef;
namespace OmniSharp
{
public interface RequestHandler<TRequest, TResponse> : IRequestHandler
{
Task<TResponse> Handle(TRequest request);
}
public interface IAggregateResponse
{
IAggregateResponse Merge(IAggregateResponse response);
}
public interface IRequest { }
public static class OmnisharpEndpoints
{
public const string GotoDefinition = "/gotodefinition";
public const string FindSymbols = "/findsymbols";
public const string UpdateBuffer = "/updatebuffer";
public const string ChangeBuffer = "/changebuffer";
public const string CodeCheck = "/codecheck";
public const string FilesChanged = "/filesChanged";
public const string FormatAfterKeystroke = "/formatAfterKeystroke";
public const string FormatRange = "/formatRange";
public const string CodeFormat = "/codeformat";
public const string Highlight = "/highlight";
public const string AutoComplete = "/autocomplete";
public const string FindImplementations = "/findimplementations";
public const string FindUsages = "/findusages";
public const string GotoFile = "/gotofile";
public const string GotoRegion = "/gotoregion";
public const string NavigateUp = "/navigateup";
public const string NavigateDown = "/navigatedown";
public const string TypeLookup = "/typelookup";
public const string GetCodeAction = "/getcodeactions";
public const string RunCodeAction = "/runcodeaction";
public const string Rename = "/rename";
public const string SignatureHelp = "/signatureHelp";
public const string MembersTree = "/currentfilemembersastree";
public const string MembersFlat = "/currentfilemembersasflat";
public const string TestCommand = "/gettestcontext";
public const string Metadata = "/metadata";
public const string PackageSource = "/packagesource";
public const string PackageSearch = "/packagesearch";
public const string PackageVersion = "/packageversion";
public const string WorkspaceInformation = "/projects";
public const string ProjectInformation = "/project";
public const string FixUsings = "/fixusings";
public const string CheckAliveStatus = "/checkalivestatus";
public const string CheckReadyStatus = "/checkreadystatus";
public const string StopServer = "/stopserver";
public static class V2
{
public const string GetCodeActions = "/v2/getcodeactions";
public const string RunCodeAction = "/v2/runcodeaction";
}
public const string GetTestStartInfo = "/v2/getteststartinfo";
public const string RunDotNetTest = "/v2/rundotnettest";
}
}
|
using System.Threading.Tasks;
using OmniSharp.Mef;
namespace OmniSharp
{
public interface RequestHandler<TRequest, TResponse> : IRequestHandler
{
Task<TResponse> Handle(TRequest request);
}
public interface IAggregateResponse
{
IAggregateResponse Merge(IAggregateResponse response);
}
public interface IRequest { }
public static class OmnisharpEndpoints
{
public const string GotoDefinition = "/gotodefinition";
public const string FindSymbols = "/findsymbols";
public const string UpdateBuffer = "/updatebuffer";
public const string ChangeBuffer = "/changebuffer";
public const string CodeCheck = "/codecheck";
public const string FilesChanged = "/filesChanged";
public const string FormatAfterKeystroke = "/formatAfterKeystroke";
public const string FormatRange = "/formatRange";
public const string CodeFormat = "/codeformat";
public const string Highlight = "/highlight";
public const string AutoComplete = "/autocomplete";
public const string FindImplementations = "/findimplementations";
public const string FindUsages = "/findusages";
public const string GotoFile = "/gotofile";
public const string GotoRegion = "/gotoregion";
public const string NavigateUp = "/navigateup";
public const string NavigateDown = "/navigatedown";
public const string TypeLookup = "/typelookup";
public const string GetCodeAction = "/getcodeactions";
public const string RunCodeAction = "/runcodeaction";
public const string Rename = "/rename";
public const string SignatureHelp = "/signatureHelp";
public const string MembersTree = "/currentfilemembersastree";
public const string MembersFlat = "/currentfilemembersasflat";
public const string TestCommand = "/gettestcontext";
public const string Metadata = "/metadata";
public const string PackageSource = "/packagesource";
public const string PackageSearch = "/packagesearch";
public const string PackageVersion = "/packageversion";
public const string WorkspaceInformation = "/projects";
public const string ProjectInformation = "/project";
public const string FixUsings = "/fixusings";
public const string CheckAliveStatus = "/checkalivestatus";
public const string CheckReadyStatus = "/checkreadystatus";
public const string StopServer = "/stopserver";
public static class V2
{
public const string GetCodeActions = "/v2/getcodeactions";
public const string RunCodeAction = "/v2/runcodeaction";
}
public const string GetTestStartInfo = "/getteststartinfo";
public const string RunDotNetTest = "/rundotnettest";
}
}
|
mit
|
C#
|
9e8908348b23b58907f29837cacd11c5e7d72e4d
|
Update version to 1.9.52.
|
vancem/perfview,vancem/perfview,vancem/perfview,vancem/perfview,vancem/perfview
|
src/PerfView/Properties/AssemblyInfo.cs
|
src/PerfView/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("PerfView")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("PerfView")]
[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 nodeId in this assembly from
// COM, set the ComVisible attribute to true on that nodeId.
[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. SignalPropertyChange 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.9.52")]
[assembly: InternalsVisibleTo("PerfViewTests")]
|
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("PerfView")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("PerfView")]
[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 nodeId in this assembly from
// COM, set the ComVisible attribute to true on that nodeId.
[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. SignalPropertyChange 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.9.51")]
[assembly: InternalsVisibleTo("PerfViewTests")]
|
mit
|
C#
|
20a4e1539a956c628e83f5b3b515a6baa99f1ac5
|
Update Array HW
|
owolp/Telerik-Academy,owolp/Telerik-Academy,owolp/Telerik-Academy,owolp/Telerik-Academy
|
Modul-1/CSharp-Part-2/01-Arrays/15.PrimeNumbers/PrimeNumbers.cs
|
Modul-1/CSharp-Part-2/01-Arrays/15.PrimeNumbers/PrimeNumbers.cs
|
using System;
using System.Linq;
// 90/100 BGCODER
namespace PrimeNumbers
{
class PrimeNumbers
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = new int[n - 1];
// fill in the initial array with all numbers
for (int i = 0; i < numbers.Length; i++)
{
numbers[i] = i + 2;
}
// start remove the non prime numbers
var start = 0;
var plus = 2;
for (int j = 0; j < Math.Sqrt(numbers.Length); j++)
{
for (int i = start; i < numbers.Length; i += plus)
{
if (i != start && numbers[i] != 0)
{
numbers[i] = 0;
}
}
for (int i = start; i < numbers.Length; i++)
{
if (i != start && numbers[i] != 0)
{
start = numbers[i] - 2;
plus = i + 2;
break;
}
}
}
// get max value with System.Linq
Console.WriteLine(numbers.Max());
}
}
}
|
using System;
using System.Linq;
namespace PrimeNumbers
{
class PrimeNumbers
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = new int[n - 1];
// fill in the initial array with all numbers
for (int i = 0; i < numbers.Length; i++)
{
numbers[i] = i + 2;
}
// start remove the non prime numbers
var start = 0;
var plus = 2;
for (int j = 0; j < Math.Sqrt(numbers.Length); j++)
{
for (int i = start; i < numbers.Length; i += plus)
{
if (i != start && numbers[i] != 0)
{
numbers[i] = 0;
}
}
for (int i = start; i < numbers.Length; i++)
{
if (i != start && numbers[i] != 0)
{
start = numbers[i] - 2;
plus = i + 2;
break;
}
}
}
// get max value with System.Linq
Console.WriteLine(numbers.Max());
}
}
}
|
mit
|
C#
|
b4b54b327743f857d6bc068663be1fd03033a73f
|
Replace it
|
sta/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp
|
Example2/Chat.cs
|
Example2/Chat.cs
|
using System;
using System.Threading;
using WebSocketSharp;
using WebSocketSharp.Server;
namespace Example2
{
public class Chat : WebSocketBehavior
{
private string _name;
private static int _number = 0;
private string _prefix;
public Chat ()
{
_prefix = "anon#";
}
public string Prefix {
get {
return _prefix;
}
set {
_prefix = !value.IsNullOrEmpty () ? value : "anon#";
}
}
private string getName ()
{
var name = Context.QueryString["name"];
return !name.IsNullOrEmpty () ? name : _prefix + getNumber ();
}
private static int getNumber ()
{
return Interlocked.Increment (ref _number);
}
protected override void OnClose (CloseEventArgs e)
{
Sessions.Broadcast (String.Format ("{0} got logged off...", _name));
}
protected override void OnMessage (MessageEventArgs e)
{
Sessions.Broadcast (String.Format ("{0}: {1}", _name, e.Data));
}
protected override void OnOpen ()
{
_name = getName ();
}
}
}
|
using System;
using System.Threading;
using WebSocketSharp;
using WebSocketSharp.Server;
namespace Example2
{
public class Chat : WebSocketBehavior
{
private string _name;
private static int _number = 0;
private string _prefix;
public Chat ()
: this (null)
{
}
public Chat (string prefix)
{
_prefix = !prefix.IsNullOrEmpty () ? prefix : "anon#";
}
private string getName ()
{
var name = Context.QueryString["name"];
return !name.IsNullOrEmpty () ? name : _prefix + getNumber ();
}
private static int getNumber ()
{
return Interlocked.Increment (ref _number);
}
protected override void OnClose (CloseEventArgs e)
{
Sessions.Broadcast (String.Format ("{0} got logged off...", _name));
}
protected override void OnMessage (MessageEventArgs e)
{
Sessions.Broadcast (String.Format ("{0}: {1}", _name, e.Data));
}
protected override void OnOpen ()
{
_name = getName ();
}
}
}
|
mit
|
C#
|
a82eeb6daf15c2391a9c104ed2793c32958f20c7
|
tidy up sidebar test
|
smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,peppy/osu-new,NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu
|
osu.Game.Tests/Visual/Online/TestSceneWikiSidebar.cs
|
osu.Game.Tests/Visual/Online/TestSceneWikiSidebar.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 Markdig.Parsers;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Graphics.Containers.Markdown;
using osu.Game.Overlays;
using osu.Game.Overlays.Wiki;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneWikiSidebar : OsuTestScene
{
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Orange);
[Cached]
private readonly OverlayScrollContainer scrollContainer = new OverlayScrollContainer();
private WikiSidebar sidebar;
[SetUp]
public void SetUp() => Schedule(() => Child = sidebar = new WikiSidebar());
[Test]
public void TestNoContent()
{
AddStep("No Content", () => { });
}
[Test]
public void TestOnlyMainTitle()
{
AddStep("Add TOC", () =>
{
for (var i = 0; i < 10; i++)
addTitle($"This is a very long title {i + 1}");
});
}
[Test]
public void TestWithSubtitle()
{
AddStep("Add TOC", () =>
{
for (var i = 0; i < 10; i++)
addTitle($"This is a very long title {i + 1}", i % 4 != 0);
});
}
private void addTitle(string text, bool subtitle = false)
{
var headingBlock = new HeadingBlock(new HeadingBlockParser())
{
Inline = new ContainerInline().AppendChild(new LiteralInline(text)),
Level = subtitle ? 3 : 2,
};
var heading = new OsuMarkdownHeading(headingBlock);
sidebar.AddToc(headingBlock, heading);
}
}
}
|
// 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 Markdig.Parsers;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Game.Graphics.Containers.Markdown;
using osu.Game.Overlays;
using osu.Game.Overlays.Wiki;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneWikiSidebar : OsuTestScene
{
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Orange);
[Cached]
private readonly OverlayScrollContainer scrollContainer = new OverlayScrollContainer();
private WikiSidebar sidebar;
[SetUp]
public void SetUp() => Schedule(() => Child = sidebar = new WikiSidebar());
[Test]
public void TestNoContent()
{
AddStep("No Content", () => { });
}
[Test]
public void TestOnlyMainTitle()
{
AddStep("Add TOC", () =>
{
for (var i = 0; i < 10; i++)
addTitle($"This is a very long title {i + 1}");
});
}
[Test]
public void TestWithSubtitle()
{
AddStep("Add TOC", () =>
{
for (var i = 0; i < 10; i++)
addTitle($"This is a very long title {i + 1}", i % 4 != 0);
});
}
private void addTitle(string text, bool subtitle = false)
{
var headingBlock = createHeadingBlock(text, subtitle ? 3 : 2);
sidebar.AddToc(headingBlock, createHeading(headingBlock));
}
private HeadingBlock createHeadingBlock(string text, int level = 2) => new HeadingBlock(new HeadingBlockParser())
{
Inline = new ContainerInline().AppendChild(new LiteralInline(text)),
Level = level,
};
private MarkdownHeading createHeading(HeadingBlock headingBlock) => new OsuMarkdownHeading(headingBlock);
}
}
|
mit
|
C#
|
de6110070d063333d3e60a1d9874203d84713b54
|
Refactor This menu
|
gorohoroh/resharper-workshop,yskatsumata/resharper-workshop,gorohoroh/resharper-workshop,JetBrains/resharper-workshop,JetBrains/resharper-workshop,gorohoroh/resharper-workshop,yskatsumata/resharper-workshop,JetBrains/resharper-workshop,yskatsumata/resharper-workshop
|
04-Refactoring/Refactoring/01-Refactor_This_menu.cs
|
04-Refactoring/Refactoring/01-Refactor_This_menu.cs
|
using System;
namespace JetBrains.ReSharper.Koans.Refactoring
{
// Refactor This menu
//
// Display a contextual menu of refactorings available at the current location
//
// Ctrl+Shift+R
// 1. Refactor This on type definition, method, property, field, parameter, variable, etc.
// Note different options on each code element
// Various refactorings shown in more detail in rest of section
public class Class1 // <- Refactor This on class name
{
// Refactor This on field
public readonly int field;
// Refactor This on property
public string Property { get; set; }
// Refactor This on method, parameters
public void Method(string parameter1, int parameter2)
{
// Refactor This on variable
var variable = parameter1;
Console.WriteLine(variable);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Refactoring
{
public class Class1
{
}
}
|
apache-2.0
|
C#
|
b43fdb50d28840a7f8ae168011a8b4dc59b5e488
|
Make the jumbotron inside a container.
|
bigfont/sweet-water-revolver
|
mvcWebApp/Views/Home/_Jumbotron.cshtml
|
mvcWebApp/Views/Home/_Jumbotron.cshtml
|
<div class="container">
<div id="my-jumbotron" class="jumbotron">
<h1>Welcome!</h1>
<p>We are Sweet Water Revolver. This is our website. Please look around and check out our...</p>
<p><a class="btn btn-primary btn-lg" role="button">... showtimes.</a></p>
</div>
</div>
|
<div id="my-jumbotron" class="jumbotron">
<div class="container">
<h1>Welcome!</h1>
<p>We are Sweet Water Revolver. This is our website. Please look around and check out our...</p>
<p><a class="btn btn-primary btn-lg" role="button">... showtimes.</a></p>
</div>
</div>
|
mit
|
C#
|
d30030bfcb7c689ec83bd251adb7da6c09b06374
|
add support to set command to allow piping
|
ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell
|
src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/SetAzureExpressRouteCircuitCommand.cs
|
src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/SetAzureExpressRouteCircuitCommand.cs
|
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 AutoMapper;
using Microsoft.Azure.Commands.Network.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
using Microsoft.Azure.Management.Network;
using System;
using System.Management.Automation;
using MNM = Microsoft.Azure.Management.Network.Models;
namespace Microsoft.Azure.Commands.Network
{
[Cmdlet(VerbsCommon.Set, "AzureRmExpressRouteCircuit"), OutputType(typeof(PSExpressRouteCircuit))]
public class SetAzureExpressRouteCircuitCommand : ExpressRouteCircuitBaseCmdlet
{
[Parameter(
Mandatory = true,
ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The ExpressRouteCircuit")]
public PSExpressRouteCircuit ExpressRouteCircuit { get; set; }
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }
public override void Execute()
{
base.Execute();
if (!this.IsExpressRouteCircuitPresent(this.ExpressRouteCircuit.ResourceGroupName, this.ExpressRouteCircuit.Name))
{
throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.ResourceNotFound);
}
// Map to the sdk object
var circuitModel = NetworkResourceManagerProfile.Mapper.Map<MNM.ExpressRouteCircuit>(this.ExpressRouteCircuit);
circuitModel.Tags = TagsConversionHelper.CreateTagDictionary(this.ExpressRouteCircuit.Tag, validate: true);
// Execute the Create ExpressRouteCircuit call
this.ExpressRouteCircuitClient.CreateOrUpdate(this.ExpressRouteCircuit.ResourceGroupName, this.ExpressRouteCircuit.Name, circuitModel);
var getExpressRouteCircuit = this.GetExpressRouteCircuit(this.ExpressRouteCircuit.ResourceGroupName, this.ExpressRouteCircuit.Name);
WriteObject(getExpressRouteCircuit);
}
}
}
|
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 AutoMapper;
using Microsoft.Azure.Commands.Network.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
using Microsoft.Azure.Management.Network;
using System;
using System.Management.Automation;
using MNM = Microsoft.Azure.Management.Network.Models;
namespace Microsoft.Azure.Commands.Network
{
[Cmdlet(VerbsCommon.Set, "AzureRmExpressRouteCircuit"), OutputType(typeof(PSExpressRouteCircuit))]
public class SetAzureExpressRouteCircuitCommand : ExpressRouteCircuitBaseCmdlet
{
[Parameter(
Mandatory = true,
ValueFromPipeline = true,
HelpMessage = "The ExpressRouteCircuit")]
public PSExpressRouteCircuit ExpressRouteCircuit { get; set; }
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }
public override void Execute()
{
base.Execute();
if (!this.IsExpressRouteCircuitPresent(this.ExpressRouteCircuit.ResourceGroupName, this.ExpressRouteCircuit.Name))
{
throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.ResourceNotFound);
}
// Map to the sdk object
var circuitModel = NetworkResourceManagerProfile.Mapper.Map<MNM.ExpressRouteCircuit>(this.ExpressRouteCircuit);
circuitModel.Tags = TagsConversionHelper.CreateTagDictionary(this.ExpressRouteCircuit.Tag, validate: true);
// Execute the Create ExpressRouteCircuit call
this.ExpressRouteCircuitClient.CreateOrUpdate(this.ExpressRouteCircuit.ResourceGroupName, this.ExpressRouteCircuit.Name, circuitModel);
var getExpressRouteCircuit = this.GetExpressRouteCircuit(this.ExpressRouteCircuit.ResourceGroupName, this.ExpressRouteCircuit.Name);
WriteObject(getExpressRouteCircuit);
}
}
}
|
apache-2.0
|
C#
|
0ff054f887a4c471ede619dbac2a132cff288a96
|
Bump version.
|
peppy/osu-new,tacchinotacchi/osu,johnneijzen/osu,peppy/osu,Nabile-Rahmani/osu,naoey/osu,UselessToucan/osu,smoogipoo/osu,johnneijzen/osu,2yangk23/osu,smoogipoo/osu,naoey/osu,Damnae/osu,smoogipooo/osu,DrabWeb/osu,UselessToucan/osu,ppy/osu,peppy/osu,osu-RP/osu-RP,nyaamara/osu,DrabWeb/osu,ZLima12/osu,default0/osu,NotKyon/lolisu,EVAST9919/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,theguii/osu,NeoAdonis/osu,RedNesto/osu,2yangk23/osu,Frontear/osuKyzer,ppy/osu,Drezi126/osu,ZLima12/osu,naoey/osu,EVAST9919/osu,DrabWeb/osu
|
osu.Desktop/Properties/AssemblyInfo.cs
|
osu.Desktop/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("osu!lazer")]
[assembly: AssemblyDescription("click the circles. to the beat.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ppy Pty Ltd")]
[assembly: AssemblyProduct("osu!lazer")]
[assembly: AssemblyCopyright("ppy Pty Ltd 2007-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("55e28cb2-7b6c-4595-8dcc-9871d8aad7e9")]
[assembly: AssemblyVersion("0.0.5")]
[assembly: AssemblyFileVersion("0.0.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("osu!lazer")]
[assembly: AssemblyDescription("click the circles. to the beat.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ppy Pty Ltd")]
[assembly: AssemblyProduct("osu!lazer")]
[assembly: AssemblyCopyright("ppy Pty Ltd 2007-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("55e28cb2-7b6c-4595-8dcc-9871d8aad7e9")]
[assembly: AssemblyVersion("0.0.3")]
[assembly: AssemblyFileVersion("0.0.3")]
|
mit
|
C#
|
40f5e7b29be9ae504caf966495703b23089488c9
|
Update MyDataRepository.cs
|
CarmelSoftware/Data-Repository-with-Data-Caching-in-ASP.NET-MVC-4,kelong/Data-Repository-with-Data-Caching-in-ASP.NET-MVC-4
|
Models/MyDataRepository.cs
|
Models/MyDataRepository.cs
|
// TODO: fix this class : class name : "RepositoryCaching"
using system;
public class MyDataRepository
{
// TODO: check what happens when different users use Cache simultaneously
public ObjectCache Cache
{
get { return MemoryCache.Default; }
}
public bool IsInMemory(string Key)
{
return Cache.Contains(Key);
}
public void Add(string Key, object Value, int Expiration)
{
Cache.Add(Key, Value, new CacheItemPolicy().AbsoluteExpiration = DateTime.Now + TimeSpan.FromMinutes(Expiration));
}
public IQueryable<T> FetchData<T>(string Key) where T : class
{
return Cache[Key] as IQueryable<T>;
}
public void Remove(string Key)
{
Cache.Remove(Key);
}
}
}
|
using system;
public class MyDataRepository
{
// TODO: check what happens when different users use Cache simultaneously
public ObjectCache Cache
{
get { return MemoryCache.Default; }
}
public bool IsInMemory(string Key)
{
return Cache.Contains(Key);
}
public void Add(string Key, object Value, int Expiration)
{
Cache.Add(Key, Value, new CacheItemPolicy().AbsoluteExpiration = DateTime.Now + TimeSpan.FromMinutes(Expiration));
}
public IQueryable<T> FetchData<T>(string Key) where T : class
{
return Cache[Key] as IQueryable<T>;
}
public void Remove(string Key)
{
Cache.Remove(Key);
}
}
}
|
mit
|
C#
|
27c80d19f53e0d2f2c678a6748a1a26683f8d0c7
|
Fix some issues
|
asarium/FSOLauncher
|
Libraries/FSOManagement/Profiles/FlagInformation.cs
|
Libraries/FSOManagement/Profiles/FlagInformation.cs
|
using System;
using FSOManagement.Annotations;
namespace FSOManagement.Profiles
{
[Serializable]
internal struct FlagInformation : IComparable<FlagInformation>
{
private readonly string _name;
private readonly object _value;
public FlagInformation([NotNull] string name, [CanBeNull] object value = null)
{
_name = name;
_value = value;
}
[NotNull]
public string Name
{
get { return _name; }
}
[CanBeNull]
public object Value
{
get { return _value; }
}
#region IComparable<FlagInformation> Members
public int CompareTo(FlagInformation other)
{
return String.Compare(Name, other.Name, StringComparison.Ordinal);
}
#endregion
private bool Equals(FlagInformation other)
{
return string.Equals(Name, other.Name);
}
public override bool Equals([CanBeNull] object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
if (obj.GetType() != GetType())
{
return false;
}
return Equals((FlagInformation) obj);
}
public override int GetHashCode()
{
return Name.GetHashCode();
}
}
}
|
using System;
using FSOManagement.Annotations;
namespace FSOManagement.Profiles
{
[Serializable]
internal struct FlagInformation : IComparable<FlagInformation>
{
private readonly string _name;
private readonly object _value;
public FlagInformation([NotNull] string name, [CanBeNull] object value = null)
{
_name = name;
_value = value;
}
[NotNull]
public string Name
{
get { return _name; }
}
[CanBeNull]
public object Value
{
get { return _value; }
}
#region IComparable<FlagInformation> Members
public int CompareTo(FlagInformation other)
{
return String.Compare(Name, other.Name, StringComparison.Ordinal);
}
#endregion
private bool Equals(FlagInformation other)
{
return string.Equals(Name, other.Name);
}
public override bool Equals([CanBeNull] object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
if (ReferenceEquals(this, obj))
{
return true;
}
if (obj.GetType() != this.GetType())
{
return false;
}
return Equals((FlagInformation) obj);
}
public override int GetHashCode()
{
return Name.GetHashCode();
}
}
}
|
mit
|
C#
|
96691532adf691b7437553376105de4e4a900e2f
|
clean up
|
santiaago/grpc.demo,santiaago/grpc.demo
|
csharp.client/Program.cs
|
csharp.client/Program.cs
|
using System;
using Grpc.Core;
using Reverse;
namespace csharp.client
{
internal class Program
{
private static void Main()
{
var channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure);
var client = new ReverseService.ReverseServiceClient(channel);
var reply = client.ReverseString(new ReverseRequest
{
Data = "Hello, World"
});
Console.WriteLine("Got: " + reply.Reversed);
channel.ShutdownAsync().Wait();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Grpc.Core;
using Reverse;
namespace csharp.client
{
{
static void Main(string[] args)
{
var channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure);
var client = new ReverseService.ReverseServiceClient(channel);
var reply = client.ReverseString(new ReverseRequest
{
Data = "Hello, World"
});
Console.WriteLine("Got: " + reply.Reversed);
channel.ShutdownAsync().Wait();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
|
mit
|
C#
|
a57910ac24de00a21ce8bced19cae8ad09bb7990
|
Fix Error With Skill Test
|
DevelopersGuild/Castle-Bashers
|
Assets/skilltesting.cs
|
Assets/skilltesting.cs
|
using UnityEngine;
using System.Collections;
public class test : Skill
{
private float duration = 10f;
private float expiration;
bool active;
Player player;
private int bonusStrength;
protected override void Start()
{
base.Start();
base.SetBaseValues(15, 16000, 150, "Ignite", SkillLevel.Level1);
player = GetComponent<Player>();
}
protected override void Update()
{
base.Update();
if(active && Time.time >= expiration)
{
active = false;
player.transform.GetChild(0).GetComponent<DealDamage>().isMagic = false;
player.SetStrength(player.GetStrength() - bonusStrength);
}
}
public override void UseSkill(GameObject caller, GameObject target = null, object optionalParameters = null)
{
base.UseSkill(gameObject);
expiration = Time.time + duration;
active = true;
player.transform.GetChild(0).GetComponent<DealDamage>().isMagic = true;
bonusStrength = player.GetIntelligence() / 2;
player.SetStrength(player.GetStrength() + bonusStrength);
}
}
public class skilltesting : MonoBehaviour {
float castInterval;
private Skill testSkill;
// Use this for initialization
void Start () {
gameObject.AddComponent<FireballSkill>();
testSkill = GetComponent<Skill>();
}
// Update is called once per frame
void Update () {
if(testSkill.GetCoolDownTimer() <= 0)
{
testSkill.UseSkill(gameObject);
}
}
}
|
using UnityEngine;
using System.Collections;
public class test : Skill
{
private float duration = 10f;
private float expiration;
bool active;
Player player;
private int bonusStrength;
protected override void Start()
{
base.Start();
base.SetBaseValues(15, 16000, 150, "Ignite", SkillLevel.Level1);
player = GetComponent<Player>();
}
protected override void Update()
{
base.Update();
if(active && Time.time >= expiration)
{
active = false;
player.transform.GetChild(0).GetComponent<DealDamage>().isMagic = false;
player.SetStrength(player.GetStrength() - bonusStrength);
}
}
public override void UseSkill(GameObject caller, GameObject target = null, object optionalParameters = null)
{
base.UseSkill(gameObject);
expiration = Time.time + duration;
active = true;
player.transform.GetChild(0).GetComponent<DealDamage>().isMagic = true;
bonusStrength = player.GetIntelligence() / 2;
player.SetStrength(player.GetStrength() + bonusStrength);
}
}
public class skilltesting : MonoBehaviour {
float castInterval;
private Skill testSkill;
// Use this for initialization
void Start () {
gameObject.AddComponent<Fireball>();
testSkill = GetComponent<Skill>();
}
// Update is called once per frame
void Update () {
if(testSkill.GetCoolDownTimer() <= 0)
{
testSkill.UseSkill(gameObject);
}
}
}
|
mit
|
C#
|
af3bcb01f81819df42828fcae626e5418c748063
|
Update correct date span for copyright notification.
|
mcneel/RhinoCycles
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Rhino.PlugIns;
// Plug-In title and Guid are extracted from the following two attributes
[assembly: AssemblyTitle("RhinoCycles")]
[assembly: Guid("9BC28E9E-7A6C-4B8F-A0C6-3D05E02D1B97")]
// Plug-in Description Attributes - all of these are optional
[assembly: PlugInDescription(DescriptionType.Address, "-")]
[assembly: PlugInDescription(DescriptionType.Country, "Finland")]
[assembly: PlugInDescription(DescriptionType.Email, "nathan@mcneel.com")]
[assembly: PlugInDescription(DescriptionType.Phone, "-")]
[assembly: PlugInDescription(DescriptionType.Fax, "-")]
[assembly: PlugInDescription(DescriptionType.Organization, "McNeel")]
[assembly: PlugInDescription(DescriptionType.UpdateUrl, "http://www.rhino3d.com/download")]
[assembly: PlugInDescription(DescriptionType.WebSite, "http://www.rhino3d.com")]
// 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: AssemblyDescription("RhinoCycles")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RhinoCycles")]
[assembly: AssemblyCopyright("Copyright © 2014-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)]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Rhino.PlugIns;
// Plug-In title and Guid are extracted from the following two attributes
[assembly: AssemblyTitle("RhinoCycles")]
[assembly: Guid("9BC28E9E-7A6C-4B8F-A0C6-3D05E02D1B97")]
// Plug-in Description Attributes - all of these are optional
[assembly: PlugInDescription(DescriptionType.Address, "-")]
[assembly: PlugInDescription(DescriptionType.Country, "Finland")]
[assembly: PlugInDescription(DescriptionType.Email, "nathan@mcneel.com")]
[assembly: PlugInDescription(DescriptionType.Phone, "-")]
[assembly: PlugInDescription(DescriptionType.Fax, "-")]
[assembly: PlugInDescription(DescriptionType.Organization, "McNeel")]
[assembly: PlugInDescription(DescriptionType.UpdateUrl, "http://www.rhino3d.com/download")]
[assembly: PlugInDescription(DescriptionType.WebSite, "http://www.rhino3d.com")]
// 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: AssemblyDescription("RhinoCycles")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RhinoCycles")]
[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)]
|
apache-2.0
|
C#
|
6c7be5c8205bff134017be8223c86de681e2ecfe
|
Add edge case unit tests
|
PioneerCode/pioneer-pagination,PioneerCode/pioneer-pagination,PioneerCode/pioneer-pagination
|
test/Pioneer.Pagination.Tests/ClampTests.cs
|
test/Pioneer.Pagination.Tests/ClampTests.cs
|
using Xunit;
namespace Pioneer.Pagination.Tests
{
/// <summary>
/// Clamp Tests
/// </summary>
public class ClampTests
{
private readonly PaginatedMetaService _sut = new PaginatedMetaService();
[Fact]
public void NextPageIsLastPageInCollectionWhenRequestedPageIsGreatedThenCollection()
{
var result = _sut.GetMetaData(10, 11, 1);
Assert.True(result.NextPage.PageNumber == 10, "Expected: Last Page ");
}
[Fact]
public void PreviousPageIsLastPageMinusOneInCollectionWhenRequestedPageIsGreatedThenCollection()
{
var result = _sut.GetMetaData(10, 11, 1);
Assert.True(result.PreviousPage.PageNumber == 9, "Expected: Last Page ");
}
[Fact]
public void PreviousPageIsFirstPageInCollectionWhenRequestedPageIsZero()
{
var result = _sut.GetMetaData(10, 0, 1);
Assert.True(result.PreviousPage.PageNumber == 1, "Expected: First Page ");
}
[Fact]
public void NextPageIsSecondPageInCollectionWhenRequestedPageIsZero()
{
var result = _sut.GetMetaData(10, 0, 1);
Assert.True(result.NextPage.PageNumber == 2, "Expected: First Page ");
}
[Fact]
public void PreviousPageIsFirstPageInCollectionWhenRequestedPageIsNegative()
{
var result = _sut.GetMetaData(10, -1, 1);
Assert.True(result.PreviousPage.PageNumber == 1, "Expected: First Page ");
}
[Fact]
public void NextPageIsSecondPageInCollectionWhenRequestedPageIsNegative()
{
var result = _sut.GetMetaData(10, -1, 1);
Assert.True(result.NextPage.PageNumber == 2, "Expected: First Page ");
}
}
}
|
using Xunit;
namespace Pioneer.Pagination.Tests
{
/// <summary>
/// Clamp Tests
/// </summary>
public class ClampTests
{
private readonly PaginatedMetaService _sut = new PaginatedMetaService();
[Fact]
public void LastPageDisplayed()
{
var result = _sut.GetMetaData(10, 11, 1);
Assert.True(result.NextPage.PageNumber == 10, "Expected: Last Page ");
}
[Fact]
public void FirstPageDisplayed()
{
var result = _sut.GetMetaData(10, 0, 1);
Assert.True(result.NextPage.PageNumber == 1, "Expected: First Page ");
}
}
}
|
mit
|
C#
|
614ade23006022517e254409c46d9e74d84f9977
|
Fix effect matrix
|
wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D
|
src/Draw2D.ViewModels/Style/PathEffects/Path2DPathEffect.cs
|
src/Draw2D.ViewModels/Style/PathEffects/Path2DPathEffect.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System.Runtime.Serialization;
using Spatial;
namespace Draw2D.ViewModels.Style.PathEffects
{
[DataContract(IsReference = true)]
public class Path2DPathEffect : ViewModelBase, IPathEffect
{
private Matrix _matrix;
private string _path;
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Matrix Matrix
{
get => _matrix;
set => Update(ref _matrix, value);
}
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public string Path
{
get => _path;
set => Update(ref _path, value);
}
public Path2DPathEffect()
{
}
public Path2DPathEffect(Matrix matrix, string path)
{
this.Matrix = matrix;
this.Path = path;
}
public static IPathEffect MakeTile()
{
var matrix = Matrix.MakeFrom(Matrix2.Scale(30, 30));
var path = "M-15 -15L15 -15L15 15L-15 15L-15 -15Z";
return new Path2DPathEffect(matrix, path) { Title = "2DPathTile" };
}
public object Copy(Dictionary<object, object> shared)
{
return new Path2DPathEffect()
{
Title = this.Title,
Matrix = (Matrix)this.Matrix.Copy(shared),
Path = this.Path
};
}
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System.Runtime.Serialization;
using Spatial;
namespace Draw2D.ViewModels.Style.PathEffects
{
[DataContract(IsReference = true)]
public class Path2DPathEffect : ViewModelBase, IPathEffect
{
private Matrix _matrix;
private string _path;
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Matrix Matrix
{
get => _matrix;
set => Update(ref _matrix, value);
}
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public string Path
{
get => _path;
set => Update(ref _path, value);
}
public Path2DPathEffect()
{
}
public Path2DPathEffect(Matrix matrix, string path)
{
this.Matrix = matrix;
this.Path = path;
}
public static IPathEffect MakeTile()
{
var matrix = Matrix.MakeFrom(Matrix2.Scale(15, 15));
var path = "M-15 -15L15 -15L15 15L-15 15L-15 -15Z";
return new Path2DPathEffect(matrix, path) { Title = "2DPathTile" };
}
public object Copy(Dictionary<object, object> shared)
{
return new Path2DPathEffect()
{
Title = this.Title,
Matrix = (Matrix)this.Matrix.Copy(shared),
Path = this.Path
};
}
}
}
|
mit
|
C#
|
e6b38e5ca74c3cc6433c24d8964710e0abe4389b
|
Update version number
|
vnbaaij/ImageProcessor.Web.Episerver,vnbaaij/ImageProcessor.Web.Episerver,vnbaaij/ImageProcessor.Web.Episerver
|
src/ImageProcessor.Web.Episerver/Properties/AssemblyInfo.cs
|
src/ImageProcessor.Web.Episerver/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("ImageProcessor.Web.Episerver")]
[assembly: AssemblyDescription("Use ImageProcessor in Episerver. Fluent API to manipulate images and generate progressive lazy loading responsive images using picture element")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Vincent Baaij")]
[assembly: AssemblyProduct("ImageProcessor.Web.Episerver")]
[assembly: AssemblyCopyright("Copyright 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2edae29a-d622-4b01-8853-d26f4d1c0fd8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("5.6.4.*")]
[assembly: AssemblyFileVersion("5.6.4.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("ImageProcessor.Web.Episerver")]
[assembly: AssemblyDescription("Use ImageProcessor in Episerver. Fluent API to manipulate images and generate progressive lazy loading responsive images using picture element")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Vincent Baaij")]
[assembly: AssemblyProduct("ImageProcessor.Web.Episerver")]
[assembly: AssemblyCopyright("Copyright 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2edae29a-d622-4b01-8853-d26f4d1c0fd8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("5.6.3.*")]
[assembly: AssemblyFileVersion("5.6.3.0")]
|
mit
|
C#
|
d54d15f66d6d853a55d4854a294b675a39774042
|
Tidy up BrushConverter
|
grokys/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,DavidKarlas/Perspex,kekekeks/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,tshcherban/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,ncarrillo/Perspex,kekekeks/Perspex,susloparovdenis/Perspex,susloparovdenis/Avalonia,OronDF343/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,MrDaedra/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Perspex,SuperJMN/Avalonia,Perspex/Perspex,bbqchickenrobot/Perspex,jazzay/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,OronDF343/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,danwalmsley/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,susloparovdenis/Perspex,akrisiun/Perspex,wieslawsoltes/Perspex,punker76/Perspex,susloparovdenis/Avalonia,wieslawsoltes/Perspex,MrDaedra/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia
|
src/Markup/Perspex.Markup.Xaml/Converters/BrushConverter.cs
|
src/Markup/Perspex.Markup.Xaml/Converters/BrushConverter.cs
|
// -----------------------------------------------------------------------
// <copyright file="BrushConverter.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Markup.Xaml.Converters
{
using System;
using System.Globalization;
using Media;
using OmniXaml.TypeConversion;
public class BrushConverter : ITypeConverter
{
public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType)
{
return sourceType == typeof(string);
}
public bool CanConvertTo(IXamlTypeConverterContext context, Type destinationType)
{
return false;
}
public object ConvertFrom(IXamlTypeConverterContext context, CultureInfo culture, object value)
{
return Brush.Parse((string)value);
}
public object ConvertTo(IXamlTypeConverterContext context, CultureInfo culture, object value, Type destinationType)
{
throw new NotImplementedException();
}
}
}
|
// -----------------------------------------------------------------------
// <copyright file="BrushConverter.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Markup.Xaml.Converters
{
using System;
using System.Globalization;
using System.Reflection;
using System.Text;
using Media;
using Media.Imaging;
using OmniXaml.TypeConversion;
using Platform;
public class BrushConverter : ITypeConverter
{
public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType)
{
return true;
}
public bool CanConvertTo(IXamlTypeConverterContext context, Type destinationType)
{
return true;
}
public object ConvertFrom(IXamlTypeConverterContext context, CultureInfo culture, object value)
{
return Brush.Parse((string)value);
}
public object ConvertTo(IXamlTypeConverterContext context, CultureInfo culture, object value, Type destinationType)
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
8cc43affdcc2c496b24b93962f534f9a755faf4f
|
Update ObservableExtensions.cs
|
keith-hall/Extensions,keith-hall/Extensions
|
src/ObservableExtensions.cs
|
src/ObservableExtensions.cs
|
using System;
using System.Reactive.Linq;
namespace HallLibrary.Extensions
{
/// <summary>
/// Contains extension methods for working with observables.
/// </summary>
public static class ObservableExtensions
{
/// <summary>
/// Returns the current value of an observable with the previous value.
/// </summary>
/// <typeparam name="TSource">The source type.</typeparam>
/// <typeparam name="TOutput">The output type after the <paramref name="projection" /> has been applied.</typeparam>
/// <param name="source">The observable.</param>
/// <param name="projection">The projection to apply.</param>
/// <returns>The current observable value with the previous value.</returns>
public static IObservable<TOutput> WithPrevious<TSource, TOutput>(this IObservable<TSource> source, Func<TSource, TSource, TOutput> projection)
{ // http://www.zerobugbuild.com/?p=213
return source.Scan(Tuple.Create(default(TSource), default(TSource)),
(previous, current) => Tuple.Create(previous.Item2, current))
.Select(t => projection(t.Item1, t.Item2));
}
/// <summary>
/// Ensure that the subscription to the <paramref name="observable" /> is re-subscribed to on error.
/// </summary>
/// <typeparam name="T">The type of data the observable contains.</typeparam>
/// <param name="observable">The observable to re-subscribe to on error.</param>
/// <param name="onNext">Action to invoke for each element in the <paramref name="observable" /> sequence.</param>
/// <param name="onError">Action to invoke for each error that occurs in the <paramref name="observable" /> sequence.</param>
/// <param name="delayAfterError">The time to wait after an error before re-subscribing to the <paramref name="observable" /> sequence.</param>
/// <remarks>http://stackoverflow.com/questions/18978523/write-an-rx-retryafter-extension-method</remarks>
public static void ReSubscribeOnError<T> (this IObservable<T> observable, Action<T> onNext, Action<Exception> onError, TimeSpan delayAfterError)
{
Action sub = null;
sub = () => observable.Subscribe(onNext, ex => { onError(ex); observable = observable.DelaySubscription(delayAfterError); sub(); });
sub();
}
}
}
|
using System;
using System.Reactive.Linq;
namespace HallLibrary.Extensions
{
/// <summary>
/// Contains extension methods for working with observables.
/// </summary>
public static class ObservableExtensions
{
/// <summary>
/// Returns the current value of an observable with the previous value.
/// </summary>
/// <typeparam name="TSource">The source type.</typeparam>
/// <typeparam name="TOutput">The output type after the <paramref name="projection" /> has been applied.</typeparam>
/// <param name="source">The observable.</param>
/// <param name="projection">The projection to apply.</param>
/// <returns>The current observable value with the previous value.</returns>
public static IObservable<TOutput> WithPrevious<TSource, TOutput>(this IObservable<TSource> source, Func<TSource, TSource, TOutput> projection)
{ // http://www.zerobugbuild.com/?p=213
return source.Scan(Tuple.Create(default(TSource), default(TSource)),
(previous, current) => Tuple.Create(previous.Item2, current))
.Select(t => projection(t.Item1, t.Item2));
}
/// <summary>
/// Ensure that the subscription to the <paramref name="observable" /> is re-subscribed to on error.
/// </summary>
/// <typeparam name="T">The type of data the observable contains.</typeparam>
/// <param name="observable">The observable to re-subscribe to on error.</param>
/// <param name="onNext">Action to invoke for each element in the <paramref name="observable" /> sequence.</param>
/// <param name="onError">Action to invoke for each error that occurs in the <paramref name="observable" /> sequence.</param>
public static void ReSubscribeOnError<T> (this IObservable<T> observable, Action<T> onNext, Action<Exception> onError = null)
{
Action sub = null;
sub = () => observable.Subscribe(onNext, ex => { if (onError != null) onError(ex); sub(); });
sub();
}
}
}
|
apache-2.0
|
C#
|
7c2b9e171e63489ec3ce550bf71bcdb2a0128f46
|
fix response type
|
restdotnet/RestDotNet
|
src/RestDotNet/IResponse.cs
|
src/RestDotNet/IResponse.cs
|
using System.Threading;
using System.Threading.Tasks;
namespace RestDotNet
{
public interface IResponse
{
IRestHandler Handler { get; }
Task ExecuteAsync();
Task ExecuteAsync(CancellationToken cancellationToken);
}
public interface IResponse<TResponse>
{
IRestHandler Handler { get; }
Task<TResponse> ExecuteAsync();
Task<TResponse> ExecuteAsync(CancellationToken cancellationToken);
}
}
|
using System.Threading;
using System.Threading.Tasks;
namespace RestDotNet
{
public interface IResponse
{
IRestHandler Handler { get; }
Task ExecuteAsync();
Task ExecuteAsync(CancellationToken cancellationToken);
}
public interface IResponse<TResponse> : IResponse
{
new Task<TResponse> ExecuteAsync();
new Task<TResponse> ExecuteAsync(CancellationToken cancellationToken);
}
}
|
mit
|
C#
|
12f5cb74972d0d0305978ef23944be4de9f2802c
|
Correct alignment in display
|
LodewijkSioen/ExitStrategy,LodewijkSioen/ExitStrategy
|
src/TestWebsite/Views/Shared/DisplayTemplates/Object.cshtml
|
src/TestWebsite/Views/Shared/DisplayTemplates/Object.cshtml
|
@model Object
@if (ViewData.TemplateInfo.TemplateDepth > 1)
{
@ViewData.ModelMetadata.SimpleDisplayText
}
else
{
foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForDisplay && !ViewData.TemplateInfo.Visited(pm)))
{
<div class="form-group">
@Html.Label(prop.PropertyName, new { @class="col-sm-2 control-label" })
<div class="col-sm-10">
<p class="form-control-static">@Html.Display(prop.PropertyName)</p>
</div>
</div>
}
}
|
@model Object
@if (ViewData.TemplateInfo.TemplateDepth > 1)
{
@ViewData.ModelMetadata.SimpleDisplayText
}
else
{
foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForDisplay && !ViewData.TemplateInfo.Visited(pm)))
{
<div class="form-group">
@Html.Label(prop.PropertyName, new { @class="col-sm-2 control-label" })
<div class="col-sm-10">
@Html.Display(prop.PropertyName)
</div>
</div>
}
}
|
mit
|
C#
|
095c038edd4dc62116a2da58fa8b22da3639ee9e
|
apply message styles (#5820)
|
stevetayloruk/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2,petedavis/Orchard2,xkproject/Orchard2,xkproject/Orchard2,petedavis/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2
|
src/OrchardCore.Themes/TheAdmin/Views/Message.cshtml
|
src/OrchardCore.Themes/TheAdmin/Views/Message.cshtml
|
@{
string type = Model.Type.ToString().ToLowerInvariant();
}
<div class="alert alert-dismissible fade show message-@type" role="alert">
@Model.Message
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
|
<div class="alert alert-warning alert-dismissible fade show" role="alert">
@Model.Message
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
|
bsd-3-clause
|
C#
|
e128f4a5a4a826265f2224fa7d35a73ec124116a
|
Split up logic for GetValidPMixinFiles to make it easier to debug
|
ppittle/pMixins,ppittle/pMixins,ppittle/pMixins
|
pMixins.VisualStudio/Extensions/SolutionExtensions.cs
|
pMixins.VisualStudio/Extensions/SolutionExtensions.cs
|
//-----------------------------------------------------------------------
// <copyright file="SolutionExtensions.cs" company="Copacetic Software">
// Copyright (c) Copacetic Software.
// <author>Philip Pittle</author>
// <date>Tuesday, May 6, 2014 1:06:27 PM</date>
// Licensed under the Apache License, Version 2.0,
// you may not use this file except in compliance with this 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.
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using CopaceticSoftware.CodeGenerator.StarterKit.Extensions;
using CopaceticSoftware.CodeGenerator.StarterKit.Infrastructure.VisualStudioSolution;
using CopaceticSoftware.pMixins.Attributes;
namespace CopaceticSoftware.pMixins.VisualStudio.Extensions
{
public static class SolutionExtensions
{
public static IEnumerable<CSharpFile> GetValidPMixinFiles(this Solution s)
{
return s.AllFiles.Where(f => f.IsValidPMixinFile());
}
public static bool IsValidPMixinFile(this CSharpFile file)
{
//skip code behind files.
if (file.FileName.FullPath.EndsWith(Constants.PMixinFileExtension,
StringComparison.InvariantCultureIgnoreCase))
return false;
var partialClasses = file.SyntaxTree.GetPartialClasses();
var resolver = file.CreateResolver();
return partialClasses.Any(
c =>
{
var resolvedClass = resolver.Resolve(c);
if (resolvedClass.IsError)
return false;
return
resolvedClass.Type.GetAttributes()
.Any(x => x.AttributeType.Implements<IPMixinAttribute>());
});
}
}
}
|
//-----------------------------------------------------------------------
// <copyright file="SolutionExtensions.cs" company="Copacetic Software">
// Copyright (c) Copacetic Software.
// <author>Philip Pittle</author>
// <date>Tuesday, May 6, 2014 1:06:27 PM</date>
// Licensed under the Apache License, Version 2.0,
// you may not use this file except in compliance with this 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.
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using CopaceticSoftware.CodeGenerator.StarterKit.Extensions;
using CopaceticSoftware.CodeGenerator.StarterKit.Infrastructure.VisualStudioSolution;
using CopaceticSoftware.pMixins.Attributes;
namespace CopaceticSoftware.pMixins.VisualStudio.Extensions
{
public static class SolutionExtensions
{
public static IEnumerable<CSharpFile> GetValidPMixinFiles(this Solution s)
{
return s.AllFiles
.Where(f =>
!f.FileName.FullPath.EndsWith(Constants.PMixinFileExtension,
StringComparison.InvariantCultureIgnoreCase) &&
f.SyntaxTree.GetPartialClasses().Any(
c =>
{
var resolvedClass = f.CreateResolver().Resolve(c);
if (resolvedClass.IsError)
return false;
return
resolvedClass.Type.GetAttributes()
.Any(x => x.AttributeType.Implements<IPMixinAttribute>());
}));
}
}
}
|
apache-2.0
|
C#
|
630b90cf27ac2ac1badf8d808b848df3bd73186e
|
Enable https redirection and authorization for non-dev envs only
|
surlycoder/truck-router
|
TruckRouter/Program.cs
|
TruckRouter/Program.cs
|
using TruckRouter.Models;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddTransient<IMazeSolver, MazeSolverBFS>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.UseDeveloperExceptionPage();
}
else
{
app.UseHttpsRedirection();
app.UseAuthorization();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
|
using TruckRouter.Models;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddTransient<IMazeSolver, MazeSolverBFS>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
|
mit
|
C#
|
b1c34777aaf2c0937fc6b6e650528851b879e21b
|
Add test for authorization requirement in TraktUserCustomListUpdateRequest
|
henrikfroehling/TraktApiSharp
|
Source/Tests/TraktApiSharp.Tests/Experimental/Requests/Users/OAuth/TraktUserCustomListUpdateRequestTests.cs
|
Source/Tests/TraktApiSharp.Tests/Experimental/Requests/Users/OAuth/TraktUserCustomListUpdateRequestTests.cs
|
namespace TraktApiSharp.Tests.Experimental.Requests.Users.OAuth
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TraktApiSharp.Experimental.Requests.Base.Put;
using TraktApiSharp.Experimental.Requests.Users.OAuth;
using TraktApiSharp.Objects.Get.Users.Lists;
using TraktApiSharp.Objects.Post.Users;
using TraktApiSharp.Requests;
[TestClass]
public class TraktUserCustomListUpdateRequestTests
{
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListUpdateRequestIsNotAbstract()
{
typeof(TraktUserCustomListUpdateRequest).IsAbstract.Should().BeFalse();
}
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListUpdateRequestIsSealed()
{
typeof(TraktUserCustomListUpdateRequest).IsSealed.Should().BeTrue();
}
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListUpdateRequestIsSubclassOfATraktSingleItemPutByIdRequest()
{
typeof(TraktUserCustomListUpdateRequest).IsSubclassOf(typeof(ATraktSingleItemPutByIdRequest<TraktList, TraktUserCustomListPost>)).Should().BeTrue();
}
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListUpdateRequestHasAuthorizationRequired()
{
var request = new TraktUserCustomListUpdateRequest(null);
request.AuthorizationRequirement.Should().Be(TraktAuthorizationRequirement.Required);
}
}
}
|
namespace TraktApiSharp.Tests.Experimental.Requests.Users.OAuth
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TraktApiSharp.Experimental.Requests.Base.Put;
using TraktApiSharp.Experimental.Requests.Users.OAuth;
using TraktApiSharp.Objects.Get.Users.Lists;
using TraktApiSharp.Objects.Post.Users;
[TestClass]
public class TraktUserCustomListUpdateRequestTests
{
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListUpdateRequestIsNotAbstract()
{
typeof(TraktUserCustomListUpdateRequest).IsAbstract.Should().BeFalse();
}
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListUpdateRequestIsSealed()
{
typeof(TraktUserCustomListUpdateRequest).IsSealed.Should().BeTrue();
}
[TestMethod, TestCategory("Requests"), TestCategory("Users")]
public void TestTraktUserCustomListUpdateRequestIsSubclassOfATraktSingleItemPutByIdRequest()
{
typeof(TraktUserCustomListUpdateRequest).IsSubclassOf(typeof(ATraktSingleItemPutByIdRequest<TraktList, TraktUserCustomListPost>)).Should().BeTrue();
}
}
}
|
mit
|
C#
|
71bac467bf355735c4b56e5c0b8e1d70b41c0f00
|
Fix CodeFactor
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Fluent/ViewModels/AddWallet/ConnectHardwareWalletViewModel.cs
|
WalletWasabi.Fluent/ViewModels/AddWallet/ConnectHardwareWalletViewModel.cs
|
using NBitcoin;
using ReactiveUI;
using System.Linq;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
public class ConnectHardwareWalletViewModel : RoutableViewModel
{
private readonly bool _trySkipPage;
private readonly HardwareDetectionState _detectionState;
public ConnectHardwareWalletViewModel(NavigationStateViewModel navigationState, string walletName, Network network, WalletManager walletManager, bool trySkipPage = true)
: base(navigationState)
{
_detectionState = new HardwareDetectionState(walletName, walletManager, network);
_trySkipPage = trySkipPage;
if (trySkipPage)
{
IsBusy = true;
}
NextCommand = ReactiveCommand.Create(() =>
{
NavigateTo(new DetectHardwareWalletViewModel(navigationState, _detectionState));
});
}
public ReactiveCommand<string, Unit> OpenBrowserCommand { get; }
protected override void OnNavigatedTo(bool inStack, CompositeDisposable disposable)
{
base.OnNavigatedTo(inStack, disposable);
if (!inStack && _trySkipPage)
{
RxApp.MainThreadScheduler.Schedule(async () =>
{
await _detectionState.EnumerateHardwareWalletsAsync(CancellationToken.None);
var deviceCount = _detectionState.Devices.Count();
if (deviceCount == 0)
{
// navigate to detecting page.
NavigateTo(new DetectHardwareWalletViewModel(NavigationState, _detectionState));
}
else if (deviceCount == 1)
{
// navigate to detected hw wallet page.
_detectionState.SelectedDevice = _detectionState.Devices.First();
NavigateTo(new DetectedHardwareWalletViewModel(NavigationState, _detectionState));
}
else
{
// Do nothing... stay on this page.
}
IsBusy = false;
});
}
}
}
}
|
using NBitcoin;
using ReactiveUI;
using System.Linq;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
public class ConnectHardwareWalletViewModel : RoutableViewModel
{
private readonly bool _trySkipPage;
private readonly HardwareDetectionState _detectionState;
public ConnectHardwareWalletViewModel(NavigationStateViewModel navigationState, string walletName, Network network, WalletManager walletManager, bool trySkipPage = true)
: base(navigationState)
{
_detectionState = new HardwareDetectionState(walletName, walletManager, network);
_trySkipPage = trySkipPage;
if (trySkipPage)
{
IsBusy = true;
}
NextCommand = ReactiveCommand.Create(() =>
{
NavigateTo(new DetectHardwareWalletViewModel(navigationState, _detectionState));
});
}
protected override void OnNavigatedTo(bool inStack, CompositeDisposable disposable)
{
base.OnNavigatedTo(inStack, disposable);
if (!inStack && _trySkipPage)
{
RxApp.MainThreadScheduler.Schedule(async () =>
{
await _detectionState.EnumerateHardwareWalletsAsync(CancellationToken.None);
var deviceCount = _detectionState.Devices.Count();
if (deviceCount == 0)
{
// navigate to detecting page.
NavigateTo(new DetectHardwareWalletViewModel(NavigationState, _detectionState));
}
else if (deviceCount == 1)
{
// navigate to detected hw wallet page.
_detectionState.SelectedDevice = _detectionState.Devices.First();
NavigateTo(new DetectedHardwareWalletViewModel(NavigationState, _detectionState));
}
else
{
// Do nothing... stay on this page.
}
IsBusy = false;
});
}
}
public ReactiveCommand<string, Unit> OpenBrowserCommand { get; }
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.