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 |
|---|---|---|---|---|---|---|---|---|
bb0a68949d327f35208934a1ee7eed2983226150
|
Increment assembly version
|
Blue0500/JoshuaKearney.FileSystem
|
JoshuaKearney.FileSystem/Properties/AssemblyInfo.cs
|
JoshuaKearney.FileSystem/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
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("JoshuaKearney.FileSystem")]
[assembly: AssemblyDescription("A simple library to improve file IO, such as path normalization and and much easier ways to create directory trees")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Josh Kearney")]
[assembly: AssemblyProduct("JoshuaKearney.FileSystem")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
|
using System.Reflection;
using System.Resources;
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("JoshuaKearney.FileSystem")]
[assembly: AssemblyDescription("A simple library to improve file IO, such as path normalization and and much easier ways to create directory trees")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Josh Kearney")]
[assembly: AssemblyProduct("JoshuaKearney.FileSystem")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
|
mit
|
C#
|
a0f6c41ed32ef64327c684388560f9dd233b50d4
|
Update CloseSessionAction.cs
|
StevenThuriot/Nova,StevenThuriot/Nova
|
Nova.Shell/Actions/MainWindow/CloseSessionAction.cs
|
Nova.Shell/Actions/MainWindow/CloseSessionAction.cs
|
#region License
//
// Copyright 2013 Steven Thuriot
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
using Nova.Library;
namespace Nova.Shell.Actions.MainWindow
{
/// <summary>
/// Action to close a session.
/// </summary>
public class CloseSessionAction : Actionflow<MainView, MainViewModel>
{
private SessionView _session;
public override bool Execute()
{
var canComplete = ActionContext.TryGetValue(out _session) && _session != null;
if (!canComplete)
return false;
var canLeave = _session.ViewModel.Leave().Result;
return canLeave;
}
public override void ExecuteCompleted()
{
ViewModel.Sessions.Remove(_session);
}
}
}
|
#region License
//
// Copyright 2013 Steven Thuriot
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
using Nova.Library;
namespace Nova.Shell.Actions.MainWindow
{
/// <summary>
/// Action to close a session.
/// </summary>
public class CloseSessionAction : Actionflow<MainView, MainViewModel>
{
private SessionView _session;
public override bool Execute()
{
var canComplete = ActionContext.TryGetValue(out _session) && _session != null;
if (!canComplete)
return false;
var canLeave = _session.ViewModel.Leave().Result;
return canLeave;
}
public override void ExecuteCompleted()
{
//TODO: Check if leave was successful.
ViewModel.Sessions.Remove(_session);
}
}
}
|
mit
|
C#
|
046cd3533b85425631bf3e3be43da8fb77e5d8b3
|
add license
|
jboeuf/grpc,ctiller/grpc,grpc/grpc,grpc/grpc,grpc/grpc,donnadionne/grpc,sreecha/grpc,grpc/grpc,grpc/grpc,donnadionne/grpc,firebase/grpc,firebase/grpc,donnadionne/grpc,muxi/grpc,donnadionne/grpc,stanley-cheung/grpc,donnadionne/grpc,pszemus/grpc,jboeuf/grpc,ejona86/grpc,vjpai/grpc,jboeuf/grpc,stanley-cheung/grpc,jtattermusch/grpc,grpc/grpc,ctiller/grpc,muxi/grpc,ctiller/grpc,sreecha/grpc,nicolasnoble/grpc,grpc/grpc,firebase/grpc,firebase/grpc,stanley-cheung/grpc,muxi/grpc,jboeuf/grpc,sreecha/grpc,jboeuf/grpc,muxi/grpc,ctiller/grpc,muxi/grpc,stanley-cheung/grpc,ejona86/grpc,jtattermusch/grpc,firebase/grpc,jboeuf/grpc,vjpai/grpc,grpc/grpc,nicolasnoble/grpc,jboeuf/grpc,nicolasnoble/grpc,stanley-cheung/grpc,jtattermusch/grpc,pszemus/grpc,donnadionne/grpc,sreecha/grpc,vjpai/grpc,sreecha/grpc,jboeuf/grpc,vjpai/grpc,jboeuf/grpc,ctiller/grpc,jboeuf/grpc,donnadionne/grpc,pszemus/grpc,nicolasnoble/grpc,stanley-cheung/grpc,donnadionne/grpc,ctiller/grpc,stanley-cheung/grpc,pszemus/grpc,sreecha/grpc,ejona86/grpc,ejona86/grpc,vjpai/grpc,vjpai/grpc,muxi/grpc,vjpai/grpc,pszemus/grpc,firebase/grpc,firebase/grpc,jtattermusch/grpc,firebase/grpc,pszemus/grpc,nicolasnoble/grpc,donnadionne/grpc,sreecha/grpc,nicolasnoble/grpc,jboeuf/grpc,sreecha/grpc,jtattermusch/grpc,stanley-cheung/grpc,ejona86/grpc,vjpai/grpc,stanley-cheung/grpc,ejona86/grpc,jtattermusch/grpc,ctiller/grpc,grpc/grpc,muxi/grpc,sreecha/grpc,sreecha/grpc,muxi/grpc,pszemus/grpc,jtattermusch/grpc,nicolasnoble/grpc,jtattermusch/grpc,pszemus/grpc,muxi/grpc,muxi/grpc,jtattermusch/grpc,ctiller/grpc,grpc/grpc,jtattermusch/grpc,ctiller/grpc,ctiller/grpc,muxi/grpc,sreecha/grpc,firebase/grpc,jtattermusch/grpc,stanley-cheung/grpc,pszemus/grpc,ctiller/grpc,ejona86/grpc,stanley-cheung/grpc,jtattermusch/grpc,grpc/grpc,ejona86/grpc,donnadionne/grpc,nicolasnoble/grpc,pszemus/grpc,stanley-cheung/grpc,pszemus/grpc,jboeuf/grpc,ejona86/grpc,sreecha/grpc,nicolasnoble/grpc,firebase/grpc,firebase/grpc,vjpai/grpc,ctiller/grpc,vjpai/grpc,nicolasnoble/grpc,ejona86/grpc,ejona86/grpc,vjpai/grpc,muxi/grpc,grpc/grpc,pszemus/grpc,donnadionne/grpc,vjpai/grpc,nicolasnoble/grpc,nicolasnoble/grpc,ejona86/grpc,firebase/grpc,donnadionne/grpc
|
src/csharp/Grpc.Core/VerifyPeerContext.cs
|
src/csharp/Grpc.Core/VerifyPeerContext.cs
|
#region Copyright notice and license
// Copyright 2019 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
namespace Grpc.Core
{
/// <summary>
/// Verification context for VerifyPeerCallback.
/// Note: experimental API that can change or be removed without any prior notice.
/// </summary>
public class VerifyPeerContext
{
/// <summary>
/// Initializes a new instance of the <see cref="T:Grpc.Core.VerifyPeerContext"/> class.
/// </summary>
/// <param name="targetHost">string containing the host name of the peer.</param>
/// <param name="targetPem">string containing PEM encoded certificate of the peer.</param>
internal VerifyPeerContext(string targetHost, string targetPem)
{
this.TargetHost = targetHost;
this.TargetPem = targetPem;
}
/// <summary>
/// String containing the host name of the peer.
/// </summary>
public string TargetHost { get; }
/// <summary>
/// string containing PEM encoded certificate of the peer.
/// </summary>
public string TargetPem { get; }
}
}
|
namespace Grpc.Core
{
/// <summary>
/// Verification context for VerifyPeerCallback.
/// Note: experimental API that can change or be removed without any prior notice.
/// </summary>
public class VerifyPeerContext
{
/// <summary>
/// Initializes a new instance of the <see cref="T:Grpc.Core.VerifyPeerContext"/> class.
/// </summary>
/// <param name="targetHost">string containing the host name of the peer.</param>
/// <param name="targetPem">string containing PEM encoded certificate of the peer.</param>
internal VerifyPeerContext(string targetHost, string targetPem)
{
this.TargetHost = targetHost;
this.TargetPem = targetPem;
}
/// <summary>
/// String containing the host name of the peer.
/// </summary>
public string TargetHost { get; }
/// <summary>
/// string containing PEM encoded certificate of the peer.
/// </summary>
public string TargetPem { get; }
}
}
|
apache-2.0
|
C#
|
e380ff9d2b100c7696aaa4d982e7783f24285ed5
|
Update AssemblyInfo.cs
|
WSDOT-GIS/GTFS-JS,WSDOT-GIS/GTFS-JS,WSDOT-GIS/GTFS-JS
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GtfsJs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WSDOT")]
[assembly: AssemblyProduct("GtfsJs")]
[assembly: AssemblyCopyright("Copyright © WSDOT 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d0e8a41f-3a30-474f-a85a-030776592336")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GtfsJs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("GtfsJs")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d0e8a41f-3a30-474f-a85a-030776592336")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
unlicense
|
C#
|
f954c1977ccf93b8325b2eaa087fe859d5d0ed67
|
Bump version to 0.2.2
|
FatturaElettronicaPA/FatturaElettronicaPA
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FatturaElettronicaPA")]
[assembly: AssemblyDescription("Fattura Elettronica per la Pubblica Amministrazione")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronicaPA")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.2.0")]
[assembly: AssemblyFileVersion("0.2.2.0")]
|
using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FatturaElettronicaPA")]
[assembly: AssemblyDescription("Fattura Elettronica per la Pubblica Amministrazione")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronicaPA")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.1.0")]
[assembly: AssemblyFileVersion("0.2.1.0")]
|
bsd-3-clause
|
C#
|
ae4a63587bd5c38e0ae1230541a476fde8b41f9f
|
Update AssemblyInfo.cs
|
Hellsing/MasterMind
|
Properties/AssemblyInfo.cs
|
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("MasterMind")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MasterMind")]
[assembly: AssemblyCopyright("Copyright © Hellsing 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("c31d4e2b-2b7b-4a4d-b572-de052cbc956a")]
// 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.1.*")]
[assembly: AssemblyVersion("7.2.1")]
[assembly: AssemblyFileVersion("7.2.1")]
|
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("MasterMind")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MasterMind")]
[assembly: AssemblyCopyright("Copyright © Hellsing 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("c31d4e2b-2b7b-4a4d-b572-de052cbc956a")]
// 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.1.*")]
[assembly: AssemblyVersion("6.19.1")]
[assembly: AssemblyFileVersion("6.19.1")]
|
apache-2.0
|
C#
|
519f3e0ce053a555b76310065b3e660253ee3c0e
|
update version
|
ashrafeme/Karasoft.Mvc
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Karasoft.Mvc")]
[assembly: AssemblyDescription("a package For Ashraf Ezzat Work Hijri Data ")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Karasoft Ashraf Ezzat")]
[assembly: AssemblyProduct("Karasoft.Mvc")]
[assembly: AssemblyCopyright("Karasoft © 2015")]
[assembly: AssemblyTrademark("Karasoft")]
[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("e524fc72-8b87-4427-abda-2e320d6e5f9e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.8")]
[assembly: AssemblyFileVersion("1.1.8")]
|
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("Karasoft.Mvc")]
[assembly: AssemblyDescription("a package For Ashraf Ezzat Work Hijri Data ")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Karasoft Ashraf Ezzat")]
[assembly: AssemblyProduct("Karasoft.Mvc")]
[assembly: AssemblyCopyright("Karasoft © 2015")]
[assembly: AssemblyTrademark("Karasoft")]
[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("e524fc72-8b87-4427-abda-2e320d6e5f9e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.7")]
[assembly: AssemblyFileVersion("1.1.7")]
|
mit
|
C#
|
d42f8f075ddcce77297bfe165b2759137a2627f2
|
Update SolutionInfo.cs
|
Telligent/Telligent-Community-Samples,Telligent/Samples,Telligent/Samples,Telligent/Telligent-Community-Samples,Telligent/Samples,Telligent/Telligent-Community-Samples
|
plugins/TableOfContents/SolutionInfo.cs
|
plugins/TableOfContents/SolutionInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("7.0.*")]
[assembly: AssemblyCompany("Telligent")]
[assembly: AssemblyCopyright("Copyright © Telligent 2015")]
[assembly: AssemblyProduct("Zimbra.Community.Extensions.TableOfContents")]
[assembly: ComVisible(false)]
[assembly:CLSCompliant(false)]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("7.0.*")]
[assembly: AssemblyCompany("Telligent")]
[assembly: AssemblyCopyright("Copyright Telligent 2010")]
[assembly: AssemblyProduct("Zimbra.Community.Extensions.TableOfContents")]
[assembly: ComVisible(false)]
[assembly:CLSCompliant(false)]
|
mit
|
C#
|
7ed431b6a28a56ba826f723506f9fc73a388e779
|
Make constructor protected
|
khellang/Scrutor
|
src/Scrutor/ImplementationTypeSelector.cs
|
src/Scrutor/ImplementationTypeSelector.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
namespace Scrutor
{
internal class ImplementationTypeSelector : TypeSourceSelector, IImplementationTypeSelector, ISelector
{
protected ImplementationTypeSelector(IEnumerable<Type> types)
{
Types = types;
}
protected IEnumerable<Type> Types { get; }
public IServiceTypeSelector AddClasses()
{
return AddClasses(publicOnly: false);
}
public IServiceTypeSelector AddClasses(bool publicOnly)
{
var classes = GetNonAbstractClasses(publicOnly);
return AddSelector(classes);
}
public IServiceTypeSelector AddClasses(Action<IImplementationTypeFilter> action)
{
return AddClasses(action, publicOnly: false);
}
public IServiceTypeSelector AddClasses(Action<IImplementationTypeFilter> action, bool publicOnly)
{
Preconditions.NotNull(action, nameof(action));
var classes = GetNonAbstractClasses(publicOnly);
var filter = new ImplementationTypeFilter(classes);
action(filter);
return AddSelector(filter.Types);
}
void ISelector.Populate(IServiceCollection services, RegistrationStrategy registrationStrategy)
{
if (Selectors.Count == 0)
{
AddClasses();
}
foreach (var selector in Selectors)
{
selector.Populate(services, registrationStrategy);
}
}
private IServiceTypeSelector AddSelector(IEnumerable<Type> types)
{
var selector = new ServiceTypeSelector(types);
Selectors.Add(selector);
return selector;
}
private IEnumerable<Type> GetNonAbstractClasses(bool publicOnly)
{
return Types.Where(t => t.IsNonAbstractClass(publicOnly));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
namespace Scrutor
{
internal class ImplementationTypeSelector : TypeSourceSelector, IImplementationTypeSelector, ISelector
{
public ImplementationTypeSelector(IEnumerable<Type> types)
{
Types = types;
}
protected IEnumerable<Type> Types { get; }
public IServiceTypeSelector AddClasses()
{
return AddClasses(publicOnly: false);
}
public IServiceTypeSelector AddClasses(bool publicOnly)
{
var classes = GetNonAbstractClasses(publicOnly);
return AddSelector(classes);
}
public IServiceTypeSelector AddClasses(Action<IImplementationTypeFilter> action)
{
return AddClasses(action, publicOnly: false);
}
public IServiceTypeSelector AddClasses(Action<IImplementationTypeFilter> action, bool publicOnly)
{
Preconditions.NotNull(action, nameof(action));
var classes = GetNonAbstractClasses(publicOnly);
var filter = new ImplementationTypeFilter(classes);
action(filter);
return AddSelector(filter.Types);
}
void ISelector.Populate(IServiceCollection services, RegistrationStrategy registrationStrategy)
{
if (Selectors.Count == 0)
{
AddClasses();
}
foreach (var selector in Selectors)
{
selector.Populate(services, registrationStrategy);
}
}
private IServiceTypeSelector AddSelector(IEnumerable<Type> types)
{
var selector = new ServiceTypeSelector(types);
Selectors.Add(selector);
return selector;
}
private IEnumerable<Type> GetNonAbstractClasses(bool publicOnly)
{
return Types.Where(t => t.IsNonAbstractClass(publicOnly));
}
}
}
|
mit
|
C#
|
bb3b974b98cda70f859207a23243404cb98c788b
|
Update src/NUnitFramework/framework/Internal/Extensions/TypeExtensions.cs
|
mjedrzejek/nunit,nunit/nunit,nunit/nunit,mjedrzejek/nunit
|
src/NUnitFramework/framework/Internal/Extensions/TypeExtensions.cs
|
src/NUnitFramework/framework/Internal/Extensions/TypeExtensions.cs
|
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt
using System;
namespace NUnit.Framework.Internal.Extensions
{
internal static class TypeExtensions
{
public static bool ImplementsIComparable(this Type type) =>
type?.GetInterface("System.IComparable") != null;
public static bool IsSortable(this Type type)
{
if (!type.ImplementsIComparable())
return false;
if (TypeHelper.IsTuple(type) || TypeHelper.IsValueTuple(type))
{
foreach (var typeArg in type.GetGenericArguments())
{
if (!typeArg.IsSortable())
return false;
}
}
return true;
}
}
}
|
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt
using System;
namespace NUnit.Framework.Internal.Extensions
{
internal static class TypeExtensions
{
public static bool ImplementsIComparable(this Type type) =>
type?.GetInterface("System.IComparable") != null;
public static bool IsSortable(this Type type)
{
if (!type.ImplementsIComparable())
return false;
if (TypeHelper.IsTuple(type) || TypeHelper.IsValueTuple(type))
{
foreach (var typeArg in type.GetGenericArguments())
if (!typeArg.IsSortable())
return false;
}
return true;
}
}
}
|
mit
|
C#
|
fdb68aa78cdc427129cbff2fafbe9308fb370579
|
Update Startup.cs
|
Sobieck00/BOH-Bulldog-Scholarship-Application-Management,Sobieck00/BOH-Bulldog-Scholarship-Application-Management,Sobieck00/BOH-Bulldog-Scholarship-Application-Management,Sobieck00/BOH-Bulldog-Scholarship-Application-Management
|
BohFoundation.WebApi/Startup.cs
|
BohFoundation.WebApi/Startup.cs
|
using System;
using BohFoundation.WebApi.Providers;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.OAuth;
using Owin;
namespace BohFoundation.WebApi
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
var oAuthServerConfig = new OAuthAuthorizationServerOptions
{
Provider = new CustomOAuthProvider(),
AccessTokenExpireTimeSpan = TimeSpan.FromHours(6),
TokenEndpointPath = new PathString("/token")
};
var oAuthBearerConfig = new OAuthBearerAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
AuthenticationType = "Bearer"
};
app.UseOAuthAuthorizationServer(oAuthServerConfig);
app.UseOAuthBearerAuthentication(oAuthBearerConfig);
}
}
}
|
using System;
using BohFoundation.WebApi.Providers;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.OAuth;
using Owin;
namespace BohFoundation.WebApi
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
var oAuthServerConfig = new OAuthAuthorizationServerOptions
{
Provider = new CustomOAuthProvider(),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(4),
TokenEndpointPath = new PathString("/token")
};
var oAuthBearerConfig = new OAuthBearerAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
AuthenticationType = "Bearer"
};
app.UseOAuthAuthorizationServer(oAuthServerConfig);
app.UseOAuthBearerAuthentication(oAuthBearerConfig);
}
}
}
|
mit
|
C#
|
6d1eea50b752a3f185bb2c60e4927d1d1e02acfd
|
Update IdentifyCellsinNamedRange.cs
|
aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/CSharp/Data/AddOn/NamedRanges/IdentifyCellsinNamedRange.cs
|
Examples/CSharp/Data/AddOn/NamedRanges/IdentifyCellsinNamedRange.cs
|
using System;
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.AddOn.NamedRanges
{
public class IdentifyCellsinNamedRange
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiate a new Workbook.
Workbook workbook = new Workbook(dataDir + "book1.xls");
//Getting the specified named range
Range range = workbook.Worksheets.GetRangeByName("TestRange");
//Identify range cells.
Console.WriteLine( "First Row : " + range.FirstRow);
Console.WriteLine( "First Column : " + range.FirstColumn);
Console.WriteLine( "Row Count : " + range.RowCount);
Console.WriteLine( "Column Count : " + range.ColumnCount);
//ExEnd:1
}
}
}
|
using System;
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.AddOn.NamedRanges
{
public class IdentifyCellsinNamedRange
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiate a new Workbook.
Workbook workbook = new Workbook(dataDir + "book1.xls");
//Getting the specified named range
Range range = workbook.Worksheets.GetRangeByName("TestRange");
//Identify range cells.
Console.WriteLine( "First Row : " + range.FirstRow);
Console.WriteLine( "First Column : " + range.FirstColumn);
Console.WriteLine( "Row Count : " + range.RowCount);
Console.WriteLine( "Column Count : " + range.ColumnCount);
}
}
}
|
mit
|
C#
|
10e8c01af7a453fa8434332c9f4c73a528058045
|
Correct Namespace
|
sjrawlins/JobSearchScorecard
|
iOS/Main.cs
|
iOS/Main.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace JobSearchScorecard.iOS
{
public class Application
{
// This is the main entry point of the application.
static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace JobScorecard.iOS
{
public class Application
{
// This is the main entry point of the application.
static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
}
}
}
|
bsd-3-clause
|
C#
|
cb0270a78ddd001e84d6f605cc8a0f87a32858cc
|
Increase project version number to 0.9.0
|
YevgeniyShunevych/Atata,atata-framework/atata,YevgeniyShunevych/Atata,atata-framework/atata
|
src/CommonAssemblyInfo.cs
|
src/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Yevgeniy Shunevych")]
[assembly: AssemblyProduct("Atata")]
[assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2016")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Yevgeniy Shunevych")]
[assembly: AssemblyProduct("Atata")]
[assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2016")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.8.0.0")]
[assembly: AssemblyFileVersion("0.8.0.0")]
|
apache-2.0
|
C#
|
9ed2f768be18167eaa1a866d66d7feb2c420e1a3
|
fix warnings
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Fluent/ViewModels/AddWallet/ConnectHardwareWalletViewModel.cs
|
WalletWasabi.Fluent/ViewModels/AddWallet/ConnectHardwareWalletViewModel.cs
|
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using DynamicData;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Hwi;
using WalletWasabi.Wallets;
using HardwareWalletViewModel = WalletWasabi.Gui.Tabs.WalletManager.HardwareWallets.HardwareWalletViewModel;
namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
public class ConnectHardwareWalletViewModel : RoutableViewModel
{
private readonly string _walletName;
private readonly Network _network;
private readonly List<Wallet> _currentWallets;
private CancellationTokenSource _searchHardwareWalletCts;
private HardwareWalletViewModel? _selectedHardwareWallet;
public ConnectHardwareWalletViewModel(NavigationStateViewModel navigationState, string walletName, Network network,
WalletManager walletManager, NavigationTarget navigationTarget) : base(navigationState, navigationTarget)
{
_walletName = walletName;
_network = network;
_currentWallets = walletManager.GetWallets().ToList();
_searchHardwareWalletCts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
HardwareWallets = new ObservableCollection<HardwareWalletViewModel>();
Task.Run(StartHardwareWalletDetection);
CancelCommand = ReactiveCommand.Create(ClearNavigation);
var connectCommandIsExecute = this.WhenAnyValue(x => x.SelectedHardwareWallet).Select(selectedHardwareWallet => selectedHardwareWallet?.HardwareWalletInfo.Fingerprint is { });
NextCommand = ReactiveCommand.Create(() => { },connectCommandIsExecute);
}
public HardwareWalletViewModel? SelectedHardwareWallet
{
get => _selectedHardwareWallet;
set => this.RaiseAndSetIfChanged(ref _selectedHardwareWallet, value);
}
public ObservableCollection<HardwareWalletViewModel> HardwareWallets { get; }
public ICommand NextCommand { get; }
protected async Task StartHardwareWalletDetection()
{
while (!_searchHardwareWalletCts.IsCancellationRequested)
{
try
{
// Reset token
_searchHardwareWalletCts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
var client = new HwiClient(_network);
var detectedHardwareWallets = (await client.EnumerateAsync(_searchHardwareWalletCts.Token)).Select(x => new HardwareWalletViewModel(x)).ToList();
// Remove wallets that are already added to software
var walletsToRemove = detectedHardwareWallets.Where(wallet => _currentWallets.Any(x => x.KeyManager.MasterFingerprint == wallet.HardwareWalletInfo.Fingerprint));
detectedHardwareWallets.RemoveMany(walletsToRemove);
// Remove disconnected hardware wallets from the list
HardwareWallets.RemoveMany(HardwareWallets.Except(detectedHardwareWallets));
// Remove detected wallets that are already in the list.
detectedHardwareWallets.RemoveMany(HardwareWallets);
// All remained detected hardware wallet is new so add.
HardwareWallets.AddRange(detectedHardwareWallets);
}
catch (Exception ex)
{
// TODO: log
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using DynamicData;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Extensions;
using WalletWasabi.Gui;
using WalletWasabi.Gui.Controls.WalletExplorer;
using WalletWasabi.Gui.Helpers;
using WalletWasabi.Gui.Models.StatusBarStatuses;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Hwi;
using WalletWasabi.Hwi.Models;
using WalletWasabi.Logging;
using WalletWasabi.Wallets;
using HardwareWalletViewModel = WalletWasabi.Gui.Tabs.WalletManager.HardwareWallets.HardwareWalletViewModel;
namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
public class ConnectHardwareWalletViewModel : RoutableViewModel
{
private readonly string _walletName;
private readonly Network _network;
private readonly List<Wallet> _currentWallets;
private CancellationTokenSource _searchHardwareWalletCts;
private HardwareWalletViewModel _selectedHardwareWallet;
public ConnectHardwareWalletViewModel(NavigationStateViewModel navigationState, string walletName, Network network,
WalletManager walletManager, NavigationTarget navigationTarget) : base(navigationState, navigationTarget)
{
_walletName = walletName;
_network = network;
_currentWallets = walletManager.GetWallets().ToList();
_searchHardwareWalletCts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
HardwareWallets = new ObservableCollection<HardwareWalletViewModel>();
Task.Run(StartHardwareWalletDetection);
CancelCommand = ReactiveCommand.Create(ClearNavigation);
var connectCommandIsExecute = this.WhenAnyValue(x => x.SelectedHardwareWallet).Select(selectedHardwareWallet => selectedHardwareWallet?.HardwareWalletInfo?.Fingerprint is { });
NextCommand = ReactiveCommand.Create(() => { },connectCommandIsExecute);
}
public HardwareWalletViewModel SelectedHardwareWallet
{
get => _selectedHardwareWallet;
set => this.RaiseAndSetIfChanged(ref _selectedHardwareWallet, value);
}
public ObservableCollection<HardwareWalletViewModel> HardwareWallets { get; }
public ICommand NextCommand { get; }
protected async Task StartHardwareWalletDetection()
{
while (!_searchHardwareWalletCts.IsCancellationRequested)
{
try
{
// Reset token
_searchHardwareWalletCts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
var client = new HwiClient(_network);
var detectedHardwareWallets = (await client.EnumerateAsync(_searchHardwareWalletCts.Token)).Select(x => new HardwareWalletViewModel(x)).ToList();
// Remove wallets that are already added to software
var walletsToRemove = detectedHardwareWallets.Where(wallet => _currentWallets.Any(x => x.KeyManager.MasterFingerprint == wallet.HardwareWalletInfo.Fingerprint));
detectedHardwareWallets.RemoveMany(walletsToRemove);
// Remove disconnected hardware wallets from the list
HardwareWallets.RemoveMany(HardwareWallets.Except(detectedHardwareWallets));
// Remove detected wallets that are already in the list.
detectedHardwareWallets.RemoveMany(HardwareWallets);
// All remained detected hardware wallet is new so add.
HardwareWallets.AddRange(detectedHardwareWallets);
}
catch (Exception ex)
{
// TODO: log
}
}
}
}
}
|
mit
|
C#
|
1b3619f3aa73f5dfd16c3f46fa407b2c711e66a2
|
Correct namespace
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Tests/UnitTests/JsonConvertersTest/UnblindedSignatureTests.cs
|
WalletWasabi.Tests/UnitTests/JsonConvertersTest/UnblindedSignatureTests.cs
|
using NBitcoin;
using Newtonsoft.Json;
using System;
using System.IO;
using System.Linq;
using System.Text;
using WalletWasabi.Crypto;
using WalletWasabi.JsonConverters;
using Xunit;
namespace WalletWasabi.Tests.UnitTests.JsonConvertersTest
{
public class UnblindedSignatureTests
{
private static Random Random = new Random(123456);
[Fact]
public void ConvertBackAndForth()
{
var converter = new UnblindedSignatureJsonConverter();
var r = new Key();
var key = new Key();
var signer = new SchnorrBlinding.Signer(key, r);
foreach (var i in Enumerable.Range(0, 100))
{
var requester = new SchnorrBlinding.Requester();
var message = new byte[256];
Random.NextBytes(message);
var blindedMessage = requester.BlindMessage(message, r.PubKey, key.PubKey);
var blindSignature = signer.Sign(blindedMessage);
var unblindedSignature = requester.UnblindSignature(blindSignature);
var sb = new StringBuilder();
using var writer = new JsonTextWriter(new StringWriter(sb));
converter.WriteJson(writer, unblindedSignature, null);
using var reader = new JsonTextReader(new StringReader(sb.ToString()));
var convertedUnblindedSignature = (UnblindedSignature)converter.ReadJson(reader, null, null, null);
Assert.Equal(unblindedSignature.C, convertedUnblindedSignature.C);
Assert.Equal(unblindedSignature.S, convertedUnblindedSignature.S);
}
}
[Fact]
public void DetectInvalidSerializedMessage()
{
var json = "[ '999999999999999999999999999999999999999999999999999999999999999999999999999999'," + // 33 bytes (INVALID)
" '999999999999999999999999999']";
using var reader = new JsonTextReader(new StringReader(json));
var converter = new UnblindedSignatureJsonConverter();
var ex = Assert.Throws<FormatException>(() => converter.ReadJson(reader, null, null, null));
Assert.Contains("longer than 32 bytes", ex.Message);
}
}
}
|
using NBitcoin;
using Newtonsoft.Json;
using System;
using System.IO;
using System.Linq;
using System.Text;
using WalletWasabi.Crypto;
using WalletWasabi.JsonConverters;
using Xunit;
namespace WalletWasabi.Tests.UnitTests.JsonConverters
{
public class UnblindedSignatureTests
{
private static Random Random = new Random(123456);
[Fact]
public void ConvertBackAndForth()
{
var converter = new UnblindedSignatureJsonConverter();
var r = new Key();
var key = new Key();
var signer = new SchnorrBlinding.Signer(key, r);
foreach (var i in Enumerable.Range(0, 100))
{
var requester = new SchnorrBlinding.Requester();
var message = new byte[256];
Random.NextBytes(message);
var blindedMessage = requester.BlindMessage(message, r.PubKey, key.PubKey);
var blindSignature = signer.Sign(blindedMessage);
var unblindedSignature = requester.UnblindSignature(blindSignature);
var sb = new StringBuilder();
using var writer = new JsonTextWriter(new StringWriter(sb));
converter.WriteJson(writer, unblindedSignature, null);
using var reader = new JsonTextReader(new StringReader(sb.ToString()));
var convertedUnblindedSignature = (UnblindedSignature)converter.ReadJson(reader, null, null, null);
Assert.Equal(unblindedSignature.C, convertedUnblindedSignature.C);
Assert.Equal(unblindedSignature.S, convertedUnblindedSignature.S);
}
}
[Fact]
public void DetectInvalidSerializedMessage()
{
var json = "[ '999999999999999999999999999999999999999999999999999999999999999999999999999999'," + // 33 bytes (INVALID)
" '999999999999999999999999999']";
using var reader = new JsonTextReader(new StringReader(json));
var converter = new UnblindedSignatureJsonConverter();
var ex = Assert.Throws<FormatException>(() => converter.ReadJson(reader, null, null, null));
Assert.Contains("longer than 32 bytes", ex.Message);
}
}
}
|
mit
|
C#
|
e3f9ea26a9ccb8aa430846c823622f8fe0b76d10
|
fix NullReference
|
AspectCore/AspectCore-Framework,AspectCore/AspectCore-Framework,AspectCore/Abstractions,AspectCore/Lite
|
core/src/AspectCore.Core/DynamicProxy/AspectBuilder.cs
|
core/src/AspectCore.Core/DynamicProxy/AspectBuilder.cs
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace AspectCore.DynamicProxy
{
[NonAspect]
public sealed class AspectBuilder : IAspectBuilder
{
private readonly IList<Func<AspectDelegate, AspectDelegate>> _delegates;
private readonly AspectDelegate _complete;
private AspectDelegate _aspectDelegate;
public AspectBuilder(AspectDelegate complete, IList<Func<AspectDelegate, AspectDelegate>> delegates)
{
_complete = complete ?? throw new ArgumentNullException(nameof(complete));
_delegates = delegates ?? new List<Func<AspectDelegate, AspectDelegate>>();
}
public IEnumerable<Func<AspectDelegate, AspectDelegate>> Delegates => _delegates;
public void AddAspectDelegate(Func<AspectContext, AspectDelegate, Task> interceptorInvoke)
{
if (interceptorInvoke == null)
{
throw new ArgumentNullException(nameof(interceptorInvoke));
}
_delegates.Add(next => context => interceptorInvoke(context, next));
}
public AspectDelegate Build()
{
if (_aspectDelegate != null)
{
return _aspectDelegate;
}
AspectDelegate invoke = _complete;
var count = _delegates.Count;
for (var i = count - 1; i > -1; i--)
{
invoke = _delegates[i](invoke);
}
return (_aspectDelegate = invoke);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace AspectCore.DynamicProxy
{
[NonAspect]
public sealed class AspectBuilder : IAspectBuilder
{
private readonly IList<Func<AspectDelegate, AspectDelegate>> _delegates;
private readonly AspectDelegate _complete;
private AspectDelegate _aspectDelegate;
public AspectBuilder(AspectDelegate complete, IList<Func<AspectDelegate, AspectDelegate>> delegates)
{
if (complete == null)
{
throw new ArgumentNullException(nameof(complete));
}
_delegates = delegates ?? new List<Func<AspectDelegate, AspectDelegate>>();
}
public IEnumerable<Func<AspectDelegate, AspectDelegate>> Delegates => _delegates;
public void AddAspectDelegate(Func<AspectContext, AspectDelegate, Task> interceptorInvoke)
{
if (interceptorInvoke == null)
{
throw new ArgumentNullException(nameof(interceptorInvoke));
}
_delegates.Add(next => context => interceptorInvoke(context, next));
}
public AspectDelegate Build()
{
if (_aspectDelegate != null)
{
return _aspectDelegate;
}
AspectDelegate invoke = _complete;
var count = _delegates.Count;
for (var i = count - 1; i > -1; i--)
{
invoke = _delegates[i](invoke);
}
return (_aspectDelegate = invoke);
}
}
}
|
mit
|
C#
|
17602874ab88e59564e9d269266fc9098fc73d04
|
Update RemoteBuilder.cs
|
NMSLanX/Natasha
|
Natasha/Remote/RemoteBuilder.cs
|
Natasha/Remote/RemoteBuilder.cs
|
using System;
namespace Natasha.Remote
{
public class RemoteBuilder
{
public static string Script
{
set
{
Type type = ClassBuilder.GetType(value);
RemoteWritter.ComplieToRemote(type);
}
}
}
}
|
using System;
namespace Natasha.Remote
{
public class RemoteBuilder
{
public string Script
{
set
{
Type type = ClassBuilder.GetType(value);
RemoteWritter.ComplieToRemote(type);
}
}
}
}
|
mpl-2.0
|
C#
|
0c89d422d63b440adb29b1595768f8e8b5f396fe
|
Fix #50
|
ProgTrade/nUpdate,ProgTrade/nUpdate
|
nUpdate.Internal/Core/Architecture.cs
|
nUpdate.Internal/Core/Architecture.cs
|
// Copyright © Dominic Beger 2017
namespace nUpdate.Internal.Core
{
public enum Architecture
{
X86,
X64,
Independent
}
}
|
// Copyright © Dominic Beger 2017
namespace nUpdate.Internal.Core
{
public enum Architecture
{
Independent,
X86,
X64
}
}
|
mit
|
C#
|
68fcc884f7eff58b7f8ae502d18e0c646fffc177
|
Remove useless file
|
brendan-rius/raytracer-epitech
|
raytracer/raytracer/core/KdTreeAccel.cs
|
raytracer/raytracer/core/KdTreeAccel.cs
|
namespace raytracer.core
{
internal class KdTreeAccel
{
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace raytracer.core
{
class KdTreeAccel
{
public KdTreeAccel()
{
}
}
}
|
mit
|
C#
|
0d98214f18b280bb5dad6890c383197767ae7fce
|
improve wording
|
ppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework
|
osu.Framework.Tests/Audio/AudioCollectionManagerTest.cs
|
osu.Framework.Tests/Audio/AudioCollectionManagerTest.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 System.Threading;
using NUnit.Framework;
using osu.Framework.Audio;
namespace osu.Framework.Tests.Audio
{
[TestFixture]
public class AudioCollectionManagerTest
{
private class TestingAdjustableAudioComponent : AdjustableAudioComponent {}
[Test]
public void TestDisposalWhileItemsAreAddedDoesNotThrowInvalidOperationException()
{
var manager = new AudioCollectionManager<AdjustableAudioComponent>();
// add a huge amount of items to the queue
for (int i = 0; i < 10000; i++) manager.AddItem(new TestingAdjustableAudioComponent());
// in a seperate thread start processing the queue
new Thread(() => manager.Update()).Start();
// wait a little for beginning of the update to start
Thread.Sleep(4);
Assert.DoesNotThrow(() => manager.Dispose());
}
}
}
|
// 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 System.Threading;
using NUnit.Framework;
using osu.Framework.Audio;
namespace osu.Framework.Tests.Audio
{
[TestFixture]
public class AudioCollectionManagerTest
{
private class TestingAdjustableAudioComponent : AdjustableAudioComponent {}
[Test]
public void TestDisposalWhileItemsAreAddedDoesNotThrowInvalidOperationException()
{
var manager = new AudioCollectionManager<AdjustableAudioComponent>();
// add a huge amount of items to be added in the queue
for (int i = 0; i < 10000; i++) manager.AddItem(new TestingAdjustableAudioComponent());
// in a seperate thread start processing the queue
new Thread(() => manager.Update()).Start();
// wait a little for beginning of the update to start
Thread.Sleep(4);
Assert.DoesNotThrow(() => manager.Dispose());
}
}
}
|
mit
|
C#
|
279ccb46e87e43a908c91a7c7cb9e2d111afa81e
|
Use Entry assembly
|
ZLima12/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,ppy/osu-framework
|
osu.Framework/Development/DebugUtils.cs
|
osu.Framework/Development/DebugUtils.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
namespace osu.Framework.Development
{
public static class DebugUtils
{
public static bool IsDebugBuild => is_debug_build.Value;
private static readonly Lazy<bool> is_debug_build = new Lazy<bool>(() =>
// https://stackoverflow.com/a/2186634
Assembly.GetEntryAssembly().GetCustomAttributes(false).OfType<DebuggableAttribute>().Any(da => da.IsJITTrackingEnabled)
);
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
namespace osu.Framework.Development
{
public static class DebugUtils
{
public static bool IsDebugBuild => is_debug_build.Value;
private static readonly Lazy<bool> is_debug_build = new Lazy<bool>(() =>
// https://stackoverflow.com/a/2186634
Assembly.GetExecutingAssembly().GetCustomAttributes(false).OfType<DebuggableAttribute>().Any(da => da.IsJITTrackingEnabled)
);
}
}
|
mit
|
C#
|
b6449aec1489013bc0a3ed50a397efc73358974c
|
Remove ISenderCallback stub
|
JasperFx/jasper,JasperFx/jasper,JasperFx/jasper
|
src/Jasper.Testing/Transports/Sending/NulloSenderTester.cs
|
src/Jasper.Testing/Transports/Sending/NulloSenderTester.cs
|
using System.Threading;
using System.Threading.Tasks;
using Jasper.Testing.Messaging;
using Jasper.Transports.Sending;
using Jasper.Util;
using Xunit;
namespace Jasper.Testing.Transports.Sending
{
public class NulloSenderTester
{
[Fact]
public async Task enqueue_automatically_marks_envelope_as_successful()
{
var sender = new NulloSender("tcp://localhost:3333".ToUri());
var env = ObjectMother.Envelope();
await sender.Send(env);
}
}
}
|
using System.Threading.Tasks;
using Jasper.Testing.Messaging;
using Jasper.Transports.Sending;
using Jasper.Util;
using NSubstitute;
using Xunit;
namespace Jasper.Testing.Transports.Sending
{
public class NulloSenderTester
{
[Fact]
public async Task enqueue_automatically_marks_envelope_as_successful()
{
var sender = new NulloSender("tcp://localhost:3333".ToUri());
var callback = Substitute.For<ISenderCallback>();
sender.Start(callback);
var env = ObjectMother.Envelope();
await sender.Send(env);
callback.Received().Successful(env);
}
}
}
|
mit
|
C#
|
0bbb08a1b262cc31596e5525476ed50f19a86ec5
|
Fix typo
|
petedavis/Orchard2,petedavis/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,xkproject/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2
|
src/OrchardCore/OrchardCore.Infrastructure/Cache/ScopedDistributedCache.cs
|
src/OrchardCore/OrchardCore.Infrastructure/Cache/ScopedDistributedCache.cs
|
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using MessagePack;
using Microsoft.Extensions.Caching.Distributed;
using Newtonsoft.Json;
namespace OrchardCore.Infrastructure.Cache
{
public class ScopedDistributedCache : IScopedDistributedCache
{
private readonly IDistributedCache _distributedCache;
private readonly Dictionary<string, object> _scopedCache = new Dictionary<string, object>();
public ScopedDistributedCache(IDistributedCache distributedCache)
{
_distributedCache = distributedCache;
}
public async Task<T> GetAsync<T>(string key)
{
if (!_scopedCache.TryGetValue(key, out var value))
{
var data = await _distributedCache.GetAsync(key);
if (data == null)
{
return default(T);
}
value = Deserialize<T>(data);
_scopedCache[key] = value;
}
return (T)value;
}
public async Task SetAsync<T>(string key, T value)
{
var data = Serialize(value);
await _distributedCache.SetAsync(key, data);
_scopedCache[key] = value;
}
private byte[] Serialize(object value)
{
return Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value, Formatting.None));
// TODO: serialize as binary
// return MessagePackSerializer.Typeless.Serialize(value, MessagePack.Resolvers.ContractlessStandardResolver.Options);
}
private T Deserialize<T>(byte[] data)
{
return JsonConvert.DeserializeObject<T>(Encoding.UTF8.GetString(data));
// TODO: serialize as binary
// return (T) MessagePackSerializer.Typeless.Deserialize(data, MessagePack.Resolvers.ContractlessStandardResolver.Options);
}
}
}
|
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using MessagePack;
using Microsoft.Extensions.Caching.Distributed;
using Newtonsoft.Json;
namespace OrchardCore.Infrastructure.Cache
{
public class ScopedDistributedCache : IScopedDistributedCache
{
private readonly IDistributedCache _ditributedCache;
private readonly Dictionary<string, object> _scopedCache = new Dictionary<string, object>();
public ScopedDistributedCache(IDistributedCache ditributedCache)
{
_ditributedCache = ditributedCache;
}
public async Task<T> GetAsync<T>(string key)
{
if (!_scopedCache.TryGetValue(key, out var value))
{
var data = await _ditributedCache.GetAsync(key);
if (data == null)
{
return default(T);
}
value = Deserialize<T>(data);
_scopedCache[key] = value;
}
return (T)value;
}
public async Task SetAsync<T>(string key, T value)
{
var data = Serialize(value);
await _ditributedCache.SetAsync(key, data);
_scopedCache[key] = value;
}
private byte[] Serialize(object value)
{
return Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value, Formatting.None));
// TODO: serialize as binary
// return MessagePackSerializer.Typeless.Serialize(value, MessagePack.Resolvers.ContractlessStandardResolver.Options);
}
private T Deserialize<T>(byte[] data)
{
return JsonConvert.DeserializeObject<T>(Encoding.UTF8.GetString(data));
// TODO: serialize as binary
// return (T) MessagePackSerializer.Typeless.Deserialize(data, MessagePack.Resolvers.ContractlessStandardResolver.Options);
}
}
}
|
bsd-3-clause
|
C#
|
c4f685d84a8ea31c380e1ff92f69f3d593f09bcd
|
Update KnownEvents to be public
|
tim-cools/EventStore-Examples,tim-cools/EventStore-Examples,tim-cools/EventStore-Examples
|
src/Soloco.EventStore.MeasurementProjections/Infrastructure/KnownEvents.cs
|
src/Soloco.EventStore.MeasurementProjections/Infrastructure/KnownEvents.cs
|
using System;
using EventStore.ClientAPI;
using Soloco.EventStore.Core.Infrastructure;
using Soloco.EventStore.MeasurementProjections.Events;
namespace Soloco.EventStore.MeasurementProjections.Infrastructure
{
public class KnownEvents : IKnownEventsProvider
{
public KnownEvent Get(RecordedEvent recordedEvent)
{
if (recordedEvent.EventType == "MeasurementRead")
{
return new KnownEvent<MeasurementRead>(ConsoleColor.Green, recordedEvent);
}
if (recordedEvent.EventType == "MeasurementAverageDay")
{
return new KnownEvent<MeasurementAverageDay>(ConsoleColor.Magenta, recordedEvent);
}
return new KnownEvent(ConsoleColor.Yellow);
}
}
}
|
using System;
using EventStore.ClientAPI;
using Soloco.EventStore.Core.Infrastructure;
using Soloco.EventStore.MeasurementProjections.Events;
namespace Soloco.EventStore.MeasurementProjections.Infrastructure
{
internal class KnownEvents : IKnownEventsProvider
{
public KnownEvent Get(RecordedEvent recordedEvent)
{
if (recordedEvent.EventType == "MeasurementRead")
{
return new KnownEvent<MeasurementRead>(ConsoleColor.Green, recordedEvent);
}
if (recordedEvent.EventType == "MeasurementAverageDay")
{
return new KnownEvent<MeasurementAverageDay>(ConsoleColor.Magenta, recordedEvent);
}
return new KnownEvent(ConsoleColor.Yellow);
}
}
}
|
mit
|
C#
|
86d93ffe3c59a3b1fa57d4a8855298ac3ecc39b9
|
Fix tooltip not working due to not handling input
|
peppy/osu-new,EVAST9919/osu,peppy/osu,johnneijzen/osu,DrabWeb/osu,ZLima12/osu,ppy/osu,ZLima12/osu,smoogipoo/osu,naoey/osu,johnneijzen/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,EVAST9919/osu,DrabWeb/osu,DrabWeb/osu,Nabile-Rahmani/osu,peppy/osu,NeoAdonis/osu,2yangk23/osu,UselessToucan/osu,UselessToucan/osu,Frontear/osuKyzer,NeoAdonis/osu,smoogipoo/osu,2yangk23/osu,naoey/osu,NeoAdonis/osu,ppy/osu,peppy/osu,smoogipooo/osu,naoey/osu
|
osu.Game/Graphics/DrawableDate.cs
|
osu.Game/Graphics/DrawableDate.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Threading;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics
{
public class DrawableDate : OsuSpriteText, IHasTooltip
{
private readonly DateTimeOffset date;
private ScheduledDelegate updateTask;
public DrawableDate(DateTimeOffset date)
{
AutoSizeAxes = Axes.Both;
Font = "Exo2.0-RegularItalic";
this.date = date.ToLocalTime();
}
[BackgroundDependencyLoader]
private void load()
{
updateTime();
}
protected override void LoadComplete()
{
base.LoadComplete();
Scheduler.Add(updateTimeWithReschedule);
}
private void updateTimeWithReschedule()
{
updateTime();
var diffToNow = DateTimeOffset.Now.Subtract(date);
double timeUntilNextUpdate = 1000;
if (diffToNow.TotalSeconds > 60)
{
timeUntilNextUpdate *= 60;
if (diffToNow.TotalMinutes > 60)
{
timeUntilNextUpdate *= 60;
if (diffToNow.TotalHours > 24)
timeUntilNextUpdate *= 24;
}
}
Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate);
}
public override bool HandleMouseInput => true;
private void updateTime() => Text = date.Humanize();
public string TooltipText => date.ToString();
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Threading;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics
{
public class DrawableDate : OsuSpriteText, IHasTooltip
{
private readonly DateTimeOffset date;
private ScheduledDelegate updateTask;
public DrawableDate(DateTimeOffset date)
{
AutoSizeAxes = Axes.Both;
Font = "Exo2.0-RegularItalic";
this.date = date.ToLocalTime();
}
[BackgroundDependencyLoader]
private void load()
{
updateTime();
}
protected override void LoadComplete()
{
base.LoadComplete();
Scheduler.Add(updateTimeWithReschedule);
}
private void updateTimeWithReschedule()
{
updateTime();
var diffToNow = DateTimeOffset.Now.Subtract(date);
double timeUntilNextUpdate = 1000;
if (diffToNow.TotalSeconds > 60)
{
timeUntilNextUpdate *= 60;
if (diffToNow.TotalMinutes > 60)
{
timeUntilNextUpdate *= 60;
if (diffToNow.TotalHours > 24)
timeUntilNextUpdate *= 24;
}
}
Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate);
}
private void updateTime() => Text = date.Humanize();
public string TooltipText => date.ToString();
}
}
|
mit
|
C#
|
64bb1f381bdbc2647c1883fb386686fe7b0943cd
|
Add more languages to settings dropdown
|
UselessToucan/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,ppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu
|
osu.Game/Localisation/Language.cs
|
osu.Game/Localisation/Language.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.ComponentModel;
namespace osu.Game.Localisation
{
public enum Language
{
[Description(@"English")]
en,
// TODO: Requires Arabic glyphs to be added to resources (and possibly also RTL support).
// [Description(@"اَلْعَرَبِيَّةُ")]
// ar,
// TODO: Some accented glyphs are missing. Revisit when adding Inter.
// [Description(@"Беларуская мова")]
// be,
[Description(@"Български")]
bg,
[Description(@"Česky")]
cs,
[Description(@"Dansk")]
da,
[Description(@"Deutsch")]
de,
// TODO: Some accented glyphs are missing. Revisit when adding Inter.
// [Description(@"Ελληνικά")]
// el,
[Description(@"español")]
es,
[Description(@"Suomi")]
fi,
[Description(@"français")]
fr,
[Description(@"Magyar")]
hu,
[Description(@"Bahasa Indonesia")]
id,
[Description(@"Italiano")]
it,
[Description(@"日本語")]
ja,
[Description(@"한국어")]
ko,
[Description(@"Nederlands")]
nl,
[Description(@"Norsk")]
no,
[Description(@"polski")]
pl,
[Description(@"Português")]
pt,
[Description(@"Português (Brasil)")]
pt_br,
[Description(@"Română")]
ro,
[Description(@"Русский")]
ru,
[Description(@"Slovenčina")]
sk,
[Description(@"Svenska")]
se,
[Description(@"ไทย")]
th,
[Description(@"Tagalog")]
tl,
[Description(@"Türkçe")]
tr,
// TODO: Some accented glyphs are missing. Revisit when adding Inter.
// [Description(@"Українська мова")]
// uk,
[Description(@"Tiếng Việt")]
vn,
[Description(@"简体中文")]
zh,
[Description(@"繁體中文(香港)")]
zh_hk,
[Description(@"繁體中文(台灣)")]
zh_tw
}
}
|
// 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.ComponentModel;
namespace osu.Game.Localisation
{
public enum Language
{
[Description(@"English")]
en,
[Description(@"日本語")]
ja
}
}
|
mit
|
C#
|
eaab578ae639112f59da14f140956c6193c66b5e
|
Prepare 0.3.0 release
|
LouisTakePILLz/ArgumentParser
|
ArgumentParser/Properties/AssemblyInfo.cs
|
ArgumentParser/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ArgumentParser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LouisTakePILLz")]
[assembly: AssemblyProduct("ArgumentParser")]
[assembly: AssemblyCopyright("Copyright © LouisTakePILLz 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a67b27e2-8841-4951-a6f0-a00d93f59560")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.0.0")]
[assembly: AssemblyFileVersion("0.3.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ArgumentParser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LouisTakePILLz")]
[assembly: AssemblyProduct("ArgumentParser")]
[assembly: AssemblyCopyright("Copyright © LouisTakePILLz 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a67b27e2-8841-4951-a6f0-a00d93f59560")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.1.0")]
[assembly: AssemblyFileVersion("0.2.1.0")]
|
apache-2.0
|
C#
|
19174569e9fab1c4a865e523d583508c84117bd5
|
Remove unnecessary statements
|
mysticfall/Alensia
|
Assets/Alensia/Core/Control/Controller.cs
|
Assets/Alensia/Core/Control/Controller.cs
|
using System.Collections.Generic;
using System.Linq;
using Alensia.Core.Common;
using Alensia.Core.UI;
using Alensia.Core.UI.Cursor;
using UniRx;
using UnityEngine;
using Zenject;
namespace Alensia.Core.Control
{
public class Controller : ActivatableMonoBehavior, IController
{
[Inject]
public IRuntimeUIContext UIContext { get; }
public CursorState DefaultCursorState => UIContext.CursorState;
public IEnumerable<IControl> Controls => _controls.ToList();
[Inject] private IList<IControl> _controls;
protected override void OnInitialized()
{
base.OnInitialized();
Activate();
Controls
.Select(c => c.OnActiveStateChange)
.Merge()
.Subscribe(_ => CheckInputStatus(), Debug.LogError)
.AddTo(this);
}
protected override void OnDisposed()
{
Deactivate();
base.OnDisposed();
}
private void CheckInputStatus()
{
var control = Controls.FirstOrDefault(c => c.Active && c.CursorState != null);
var state = control?.CursorState ?? DefaultCursorState;
state.Apply();
}
public T FindControl<T>() where T : IControl => FindControls<T>().FirstOrDefault();
public IReadOnlyList<T> FindControls<T>() where T : IControl => Controls.OfType<T>().ToList();
public void EnableControls<T>() where T : IControl
{
foreach (var control in FindControls<T>())
{
control.Activate();
}
}
public void DisableControls<T>() where T : IControl
{
foreach (var control in FindControls<T>())
{
control.Deactivate();
}
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Alensia.Core.Common;
using Alensia.Core.UI;
using Alensia.Core.UI.Cursor;
using UniRx;
using UnityEngine;
using Zenject;
namespace Alensia.Core.Control
{
public class Controller : ActivatableMonoBehavior, IController
{
[Inject]
public IRuntimeUIContext UIContext { get; }
public CursorState DefaultCursorState => UIContext.CursorState;
public IEnumerable<IControl> Controls => _controls.ToList();
[Inject] private IList<IControl> _controls;
protected override void OnInitialized()
{
DefaultCursorState.Apply();
base.OnInitialized();
Activate();
Controls
.Select(c => c.OnActiveStateChange)
.Merge()
.Subscribe(_ => CheckInputStatus(), Debug.LogError)
.AddTo(this);
CheckInputStatus();
}
protected override void OnDisposed()
{
Deactivate();
base.OnDisposed();
}
private void CheckInputStatus()
{
var control = Controls.FirstOrDefault(c => c.Active && c.CursorState != null);
var state = control?.CursorState ?? DefaultCursorState;
state.Apply();
}
public T FindControl<T>() where T : IControl => FindControls<T>().FirstOrDefault();
public IReadOnlyList<T> FindControls<T>() where T : IControl => Controls.OfType<T>().ToList();
public void EnableControls<T>() where T : IControl
{
foreach (var control in FindControls<T>())
{
control.Activate();
}
}
public void DisableControls<T>() where T : IControl
{
foreach (var control in FindControls<T>())
{
control.Deactivate();
}
}
}
}
|
apache-2.0
|
C#
|
8dfe3c179baa63593fffe0914dc36c3283964fe2
|
fix policies page title
|
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
|
BTCPayServer/Views/Server/Policies.cshtml
|
BTCPayServer/Views/Server/Policies.cshtml
|
@model BTCPayServer.Services.PoliciesSettings
@{
ViewData["Title"] = ServerNavPages.Policies;
ViewData.AddActivePage(ServerNavPages.Policies);
}
<h4>@ViewData["Title"]</h4>
@Html.Partial("_StatusMessage", TempData["StatusMessage"])
<div class="row">
<div class="col-md-6">
<div asp-validation-summary="All" class="text-danger"></div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<form method="post">
<div class="form-group">
<label asp-for="RequiresConfirmedEmail"></label>
<input asp-for="RequiresConfirmedEmail" type="checkbox" class="form-check-inline" />
</div>
<button type="submit" class="btn btn-success" name="command" value="Save">Save</button>
</form>
</div>
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
|
@model BTCPayServer.Services.PoliciesSettings
@{
ViewData["Title"] = ServerNavPages.Emails;
ViewData.AddActivePage(ServerNavPages.Emails);
}
<h4>@ViewData["Title"]</h4>
@Html.Partial("_StatusMessage", TempData["StatusMessage"])
<div class="row">
<div class="col-md-6">
<div asp-validation-summary="All" class="text-danger"></div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<form method="post">
<div class="form-group">
<label asp-for="RequiresConfirmedEmail"></label>
<input asp-for="RequiresConfirmedEmail" type="checkbox" class="form-check-inline" />
</div>
<button type="submit" class="btn btn-success" name="command" value="Save">Save</button>
</form>
</div>
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
|
mit
|
C#
|
5bc35d1a2d012ea3d72ff6c7d478d7404633c700
|
Fix options nullable error
|
ASP-NET-MVC-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates
|
Source/GraphQLTemplate/Source/GraphQLTemplate/Options/ApplicationOptions.cs
|
Source/GraphQLTemplate/Source/GraphQLTemplate/Options/ApplicationOptions.cs
|
namespace GraphQLTemplate.Options
{
using System.ComponentModel.DataAnnotations;
#if ForwardedHeaders
using Microsoft.AspNetCore.Builder;
#elif HostFiltering
using Microsoft.AspNetCore.HostFiltering;
#endif
using Microsoft.AspNetCore.Server.Kestrel.Core;
/// <summary>
/// All options for the application.
/// </summary>
public class ApplicationOptions
{
public ApplicationOptions() => this.CacheProfiles = new CacheProfileOptions();
[Required]
public CacheProfileOptions CacheProfiles { get; }
#if ResponseCompression
public CompressionOptions Compression { get; set; } = default!;
#endif
#if ForwardedHeaders
[Required]
public ForwardedHeadersOptions ForwardedHeaders { get; set; } = default!;
#elif HostFiltering
[Required]
public HostFilteringOptions HostFiltering { get; set; } = default!;
#endif
[Required]
public GraphQLOptions GraphQL { get; set; } = default!;
public KestrelServerOptions Kestrel { get; set; } = default!;
#if (PersistedQueries || Subscriptions)
[Required]
public RedisOptions Redis { get; set; } = default!;
#endif
}
}
|
namespace GraphQLTemplate.Options
{
using System.ComponentModel.DataAnnotations;
#if ForwardedHeaders
using Microsoft.AspNetCore.Builder;
#elif HostFiltering
using Microsoft.AspNetCore.HostFiltering;
#endif
using Microsoft.AspNetCore.Server.Kestrel.Core;
/// <summary>
/// All options for the application.
/// </summary>
public class ApplicationOptions
{
public ApplicationOptions() => this.CacheProfiles = new CacheProfileOptions();
[Required]
public CacheProfileOptions CacheProfiles { get; }
#if ResponseCompression
public CompressionOptions? Compression { get; set; }
#endif
#if ForwardedHeaders
[Required]
public ForwardedHeadersOptions? ForwardedHeaders { get; set; }
#elif HostFiltering
[Required]
public HostFilteringOptions HostFiltering { get; set; }
#endif
[Required]
public GraphQLOptions GraphQL { get; set; } = default!;
public KestrelServerOptions? Kestrel { get; set; }
#if (PersistedQueries || Subscriptions)
[Required]
public RedisOptions? Redis { get; set; }
#endif
}
}
|
mit
|
C#
|
b5d3ee45f5489079cffaf46cdccafec9f515938c
|
Add CalculateProfit to Week Model
|
morarj/ACStalkMarket,morarj/ACStalkMarket,morarj/ACStalkMarket
|
ACStalkMarket/ACStalkMarket/Models/Week.cs
|
ACStalkMarket/ACStalkMarket/Models/Week.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace ACStalkMarket.Models
{
public class Week
{
public int Id { get; set; }
public People People { get; set; }
[Required]
public int PeopleId { get; set; }
public Town Town { get; set; }
public int? TownId { get; set; }
public WeekValues WeekValues { get; set; }
[Required]
public int WeekValuesId { get; set; }
public WeekPattern WeekPattern { get; set; }
[Required]
[Display(Name = "Patrón")]
public byte WeekPatternId { get; set; }
[Required]
[DataType(DataType.Date)]
[Display(Name = "Fecha de Inicio")]
// Must be monday
public DateTime StartingDate { get; set; }
[Required]
[Range(0, byte.MaxValue)]
[Display(Name = "Precio Inicial de los Turnips")]
public byte TurnipStartingPrice { get; set; }
[Required]
[Range(0, int.MaxValue)]
[Display(Name = "Inversión")]
public int BellsInvestment { get; set; }
[Required]
[Display(Name = "Estado")]
public bool WeekActive { get; set; }
[Required]
[Range(int.MinValue, int.MaxValue)]
[Display(Name = "Ganancias")]
public int Profit { get; set; }
public void Map(Week week)
{
Id = week.Id;
BellsInvestment = week.BellsInvestment;
PeopleId = week.PeopleId;
Profit = week.Profit;
StartingDate = week.StartingDate;
TownId = week.TownId;
TurnipStartingPrice = week.TurnipStartingPrice;
WeekActive = week.WeekActive;
WeekPatternId = week.WeekPatternId;
WeekValuesId = week.WeekValuesId;
}
public int CalculateProfit(int turnipSellingPrice)
{
return ((BellsInvestment / TurnipStartingPrice) * turnipSellingPrice) - BellsInvestment;
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace ACStalkMarket.Models
{
public class Week
{
public int Id { get; set; }
public People People { get; set; }
[Required]
public int PeopleId { get; set; }
public Town Town { get; set; }
public int? TownId { get; set; }
public WeekValues WeekValues { get; set; }
[Required]
public int WeekValuesId { get; set; }
public WeekPattern WeekPattern { get; set; }
[Required]
[Display(Name = "Patrón")]
public byte WeekPatternId { get; set; }
[Required]
[DataType(DataType.Date)]
[Display(Name = "Fecha de Inicio")]
// Must be monday
public DateTime StartingDate { get; set; }
[Required]
[Range(0, byte.MaxValue)]
[Display(Name = "Precio Inicial de los Turnips")]
public byte TurnipStartingPrice { get; set; }
[Required]
[Range(0, int.MaxValue)]
[Display(Name = "Inversión")]
public int BellsInvestment { get; set; }
[Required]
[Display(Name = "Estado")]
public bool WeekActive { get; set; }
[Required]
[Range(int.MinValue, int.MaxValue)]
[Display(Name = "Ganancias")]
public int Profit { get; set; }
public void Map(Week week)
{
Id = week.Id;
BellsInvestment = week.BellsInvestment;
PeopleId = week.PeopleId;
Profit = week.Profit;
StartingDate = week.StartingDate;
TownId = week.TownId;
TurnipStartingPrice = week.TurnipStartingPrice;
WeekActive = week.WeekActive;
WeekPatternId = week.WeekPatternId;
WeekValuesId = week.WeekValuesId;
}
}
}
|
mit
|
C#
|
d95c8074a4c4ebd1a3d16169eab1bfd50e2f7092
|
Bump version to 2.1 for the FFXIV4.1 changes
|
sqt/cactbot,sqt/cactbot,quisquous/cactbot,quisquous/cactbot,sqt/cactbot,sqt/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot
|
CactbotOverlay/Properties/AssemblyInfo.cs
|
CactbotOverlay/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.2.1.0")]
[assembly: AssemblyFileVersion("0.2.1.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
|
apache-2.0
|
C#
|
493b726ddeab0c9fc079089a4d62bdc3b7bed26d
|
Remove licence header
|
laedit/vika
|
src/NVika/BuildServers/GitHub.cs
|
src/NVika/BuildServers/GitHub.cs
|
using System;
using System.ComponentModel.Composition;
using System.Text;
using NVika.Abstractions;
using NVika.Parsers;
namespace NVika.BuildServers
{
internal sealed class GitHub : BuildServerBase
{
private readonly IEnvironment _environment;
[ImportingConstructor]
internal GitHub(IEnvironment environment)
{
_environment = environment;
}
public override string Name => nameof(GitHub);
public override bool CanApplyToCurrentContext() => !string.IsNullOrEmpty(_environment.GetEnvironmentVariable("GITHUB_ACTIONS"));
public override void WriteMessage(Issue issue)
{
var outputString = new StringBuilder();
switch (issue.Severity)
{
case IssueSeverity.Error:
outputString.Append("::error ");
break;
case IssueSeverity.Warning:
outputString.Append("::warning");
break;
}
if (issue.FilePath != null)
{
var file = issue.FilePath.Replace('\\', '/');
outputString.Append($"file={file},");
}
if (issue.Offset != null)
outputString.Append($"col={issue.Offset.Start},");
outputString.Append($"line={issue.Line}::{issue.Message}");
Console.WriteLine(outputString.ToString());
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.ComponentModel.Composition;
using System.Text;
using NVika.Abstractions;
using NVika.Parsers;
namespace NVika.BuildServers
{
internal sealed class GitHub : BuildServerBase
{
private readonly IEnvironment _environment;
[ImportingConstructor]
internal GitHub(IEnvironment environment)
{
_environment = environment;
}
public override string Name => nameof(GitHub);
public override bool CanApplyToCurrentContext() => !string.IsNullOrEmpty(_environment.GetEnvironmentVariable("GITHUB_ACTIONS"));
public override void WriteMessage(Issue issue)
{
var outputString = new StringBuilder();
switch (issue.Severity)
{
case IssueSeverity.Error:
outputString.Append("::error ");
break;
case IssueSeverity.Warning:
outputString.Append("::warning");
break;
}
if (issue.FilePath != null)
{
var file = issue.FilePath.Replace('\\', '/');
outputString.Append($"file={file},");
}
if (issue.Offset != null)
outputString.Append($"col={issue.Offset.Start},");
outputString.Append($"line={issue.Line}::{issue.Message}");
Console.WriteLine(outputString.ToString());
}
}
}
|
apache-2.0
|
C#
|
6b3993f4aa9feb20e46d7926fdbd1dc4065a0f20
|
Improve Unsupported SecurityType Message
|
StefanoRaggi/Lean,QuantConnect/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,AlexCatarino/Lean,jameschch/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,JKarathiya/Lean,StefanoRaggi/Lean,AlexCatarino/Lean,JKarathiya/Lean,QuantConnect/Lean,jameschch/Lean,jameschch/Lean,jameschch/Lean,JKarathiya/Lean,QuantConnect/Lean,jameschch/Lean,QuantConnect/Lean,StefanoRaggi/Lean,JKarathiya/Lean
|
Common/Orders/Fees/AlphaStreamsFeeModel.cs
|
Common/Orders/Fees/AlphaStreamsFeeModel.cs
|
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 QuantConnect.Securities;
using System;
using System.Collections.Generic;
namespace QuantConnect.Orders.Fees
{
/// <summary>
/// Provides an implementation of <see cref="FeeModel"/> that models order fees that alpha stream clients pay/receive
/// </summary>
public class AlphaStreamsFeeModel : FeeModel
{
private readonly IDictionary<SecurityType, decimal> _feeRates = new Dictionary<SecurityType, decimal>
{
{SecurityType.Equity, 0.004m},
{SecurityType.Forex, 0.000002m},
// Commission plus clearing fee
{SecurityType.Future, 0.4m + 0.1m},
{SecurityType.Option, 0.4m + 0.1m}
};
/// <summary>
/// Gets the order fee associated with the specified order. This returns the cost
/// of the transaction in the account currency
/// </summary>
/// <param name="parameters">A <see cref="OrderFeeParameters"/> object
/// containing the security and order</param>
/// <returns>The cost of the order in units of the account currency</returns>
public override OrderFee GetOrderFee(OrderFeeParameters parameters)
{
var order = parameters.Order;
var security = parameters.Security;
// Option exercise is free of charge
if (order.Type == OrderType.OptionExercise)
{
return OrderFee.Zero;
}
decimal feeRate;
if (!_feeRates.TryGetValue(security.Type, out feeRate))
{
throw new ArgumentException(
$"Unsupported security type: {security.Type}. For direct-to-exchange assets such as Crypto, use the fee model specified by the exchange."
);
}
var value = security.Type == SecurityType.Equity || security.Type == SecurityType.Forex
? Math.Abs(order.GetValue(security))
: order.AbsoluteQuantity;
return new OrderFee(new CashAmount(feeRate * value, Currencies.USD));
}
}
}
|
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 QuantConnect.Securities;
using System;
using System.Collections.Generic;
namespace QuantConnect.Orders.Fees
{
/// <summary>
/// Provides an implementation of <see cref="FeeModel"/> that models order fees that alpha stream clients pay/receive
/// </summary>
public class AlphaStreamsFeeModel : FeeModel
{
private readonly IDictionary<SecurityType, decimal> _feeRates = new Dictionary<SecurityType, decimal>
{
{SecurityType.Equity, 0.004m},
{SecurityType.Forex, 0.000002m},
// Commission plus clearing fee
{SecurityType.Future, 0.4m + 0.1m},
{SecurityType.Option, 0.4m + 0.1m}
};
/// <summary>
/// Gets the order fee associated with the specified order. This returns the cost
/// of the transaction in the account currency
/// </summary>
/// <param name="parameters">A <see cref="OrderFeeParameters"/> object
/// containing the security and order</param>
/// <returns>The cost of the order in units of the account currency</returns>
public override OrderFee GetOrderFee(OrderFeeParameters parameters)
{
var order = parameters.Order;
var security = parameters.Security;
// Option exercise is free of charge
if (order.Type == OrderType.OptionExercise)
{
return OrderFee.Zero;
}
decimal feeRate;
if (!_feeRates.TryGetValue(security.Type, out feeRate))
{
throw new ArgumentException($"Unsupported security type: {security.Type}");
}
var value = security.Type == SecurityType.Equity || security.Type == SecurityType.Forex
? Math.Abs(order.GetValue(security))
: order.AbsoluteQuantity;
return new OrderFee(new CashAmount(feeRate * value, Currencies.USD));
}
}
}
|
apache-2.0
|
C#
|
87aa79737a79a0af601d52e4ecfa877bf87fb25d
|
Remove unused internal delegate.
|
chtoucas/Narvalo.NET,chtoucas/Narvalo.NET
|
src/Narvalo.Fx/Applicative/Recursion.cs
|
src/Narvalo.Fx/Applicative/Recursion.cs
|
// Copyright (c) Narvalo.Org. All rights reserved. See LICENSE.txt in the project root for license information.
namespace Narvalo.Applicative
{
using System;
public static class Recursion
{
// Y Combinator.
public static Func<TSource, TResult> Fix<TSource, TResult>(
Func<Func<TSource, TResult>, Func<TSource, TResult>> generator)
{
Require.NotNull(generator, nameof(generator));
// Initialize.
Func<TSource, TResult> g = null;
// Define.
g = generator(arg => g(arg));
return g;
}
}
}
|
// Copyright (c) Narvalo.Org. All rights reserved. See LICENSE.txt in the project root for license information.
namespace Narvalo.Applicative
{
using System;
internal delegate Func<TSource, TResult> Recursive<TSource, TResult>(Recursive<TSource, TResult> rec);
public static class Recursion
{
// Y Combinator.
public static Func<TSource, TResult> Fix<TSource, TResult>(
Func<Func<TSource, TResult>, Func<TSource, TResult>> generator)
{
Require.NotNull(generator, nameof(generator));
// Initialize.
Func<TSource, TResult> g = null;
// Define.
g = generator(arg => g(arg));
return g;
}
}
}
|
bsd-2-clause
|
C#
|
7dfa6d78d6e441614c39ea33dee2e4d5c1411f0b
|
Undo last commit as this is handled by appending reg- to the title of the page in this instance
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
src/SFA.DAS.EmployerAccounts.Web/Views/Home/ServiceStartPage.cshtml
|
src/SFA.DAS.EmployerAccounts.Web/Views/Home/ServiceStartPage.cshtml
|
@using SFA.DAS.EmployerAccounts.Web.Helpers
@{ViewBag.PageID = "page-service-start"; }
@{ViewBag.Title = "Create an account to manage apprenticeships"; }
@{ViewBag.MetaDesc = "Manage your funding for apprenticeships in England"; }
@{ViewBag.HideNav = true; }
@{
ViewBag.GaData.Vpv = "/page-service-start";
}
@{Layout = "~/Views/Shared/_Layout_CDN.cshtml"; }
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl">
@ViewBag.Title
</h1>
<p class="govuk-body">
You need to create or <a href="@Url.Action("SignIn", "Home")" class="govuk-link">sign in</a> to an apprenticeship account, then you'll be able to get funding to pay for apprenticeship training and assessment costs.
</p>
<p class="govuk-body">
You’ll use your account to:
</p>
<ul class="govuk-list govuk-list--bullet">
<li>get apprenticeship funding</li>
<li>find and save apprenticeships</li>
<li>find, save and manage training providers</li>
<li>recruit apprentices</li>
<li>add and manage apprenticeships</li>
</ul>
<a href="@Url.Action(ControllerConstants.RegisterUserActionName)" id="service-start" role="button" draggable="false" class="govuk-button govuk-button--start" data-module="govuk-button">
Create account
<svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" role="presentation" focusable="false">
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
</svg>
</a>
</div>
</div>
|
@using SFA.DAS.EmployerAccounts.Web.Helpers
@{ViewBag.PageID = "page-service-start"; }
@{ViewBag.Title = "Create an account to manage apprenticeships"; }
@{ViewBag.MetaDesc = "Manage your funding for apprenticeships in England"; }
@{ViewBag.HideNav = true; }
@{
ViewBag.GaData.Vpv = "/page-service-start";
ViewBag.ZenDeskLabel = "reg-Create an account to manage apprenticeships";
}
@{Layout = "~/Views/Shared/_Layout_CDN.cshtml"; }
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl">
@ViewBag.Title
</h1>
<p class="govuk-body">
You need to create or <a href="@Url.Action("SignIn", "Home")" class="govuk-link">sign in</a> to an apprenticeship account, then you'll be able to get funding to pay for apprenticeship training and assessment costs.
</p>
<p class="govuk-body">
You’ll use your account to:
</p>
<ul class="govuk-list govuk-list--bullet">
<li>get apprenticeship funding</li>
<li>find and save apprenticeships</li>
<li>find, save and manage training providers</li>
<li>recruit apprentices</li>
<li>add and manage apprenticeships</li>
</ul>
<a href="@Url.Action(ControllerConstants.RegisterUserActionName)" id="service-start" role="button" draggable="false" class="govuk-button govuk-button--start" data-module="govuk-button">
Create account
<svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" role="presentation" focusable="false">
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
</svg>
</a>
</div>
</div>
|
mit
|
C#
|
b0c5135fa361598b9338dc4976c3b311b0d779ff
|
Use custom guid type again.
|
Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex
|
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AllTypes.cs
|
src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AllTypes.cs
|
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using GraphQL.Types;
using Squidex.Domain.Apps.Core.Contents;
using Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Utils;
namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
public static class AllTypes
{
public static readonly Type None = typeof(NoopGraphType);
public static readonly IGraphType Int = new IntGraphType();
public static readonly IGraphType Guid = new GuidGraphType2();
public static readonly IGraphType Date = new DateTimeGraphType();
public static readonly IGraphType Json = new JsonGraphType();
public static readonly IGraphType Tags = new ListGraphType<NonNullGraphType<StringGraphType>>();
public static readonly IGraphType Float = new FloatGraphType();
public static readonly IGraphType Status = new EnumerationGraphType<Status>();
public static readonly IGraphType String = new StringGraphType();
public static readonly IGraphType Boolean = new BooleanGraphType();
public static readonly IGraphType References = new ListGraphType<NonNullGraphType<GuidGraphType2>>();
public static readonly IGraphType NonNullInt = new NonNullGraphType(Int);
public static readonly IGraphType NonNullGuid = new NonNullGraphType(Guid);
public static readonly IGraphType NonNullDate = new NonNullGraphType(Date);
public static readonly IGraphType NonNullFloat = new NonNullGraphType(Float);
public static readonly IGraphType NonNullString = new NonNullGraphType(String);
public static readonly IGraphType NonNullBoolean = new NonNullGraphType(Boolean);
public static readonly IGraphType NonNullStatusType = new NonNullGraphType(Status);
public static readonly IGraphType NoopDate = new NoopGraphType(Date);
public static readonly IGraphType NoopJson = new NoopGraphType(Json);
public static readonly IGraphType NoopFloat = new NoopGraphType(Float);
public static readonly IGraphType NoopString = new NoopGraphType(String);
public static readonly IGraphType NoopBoolean = new NoopGraphType(Boolean);
public static readonly IGraphType NoopTags = new NoopGraphType("Tags");
public static readonly IGraphType NoopGeolocation = new NoopGraphType("Geolocation");
}
}
|
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using GraphQL.Types;
using Squidex.Domain.Apps.Core.Contents;
using Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Utils;
namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
public static class AllTypes
{
public static readonly Type None = typeof(NoopGraphType);
public static readonly IGraphType Int = new IntGraphType();
public static readonly IGraphType Guid = new GuidGraphType();
public static readonly IGraphType Date = new DateTimeGraphType();
public static readonly IGraphType Json = new JsonGraphType();
public static readonly IGraphType Tags = new ListGraphType<NonNullGraphType<StringGraphType>>();
public static readonly IGraphType Float = new FloatGraphType();
public static readonly IGraphType Status = new EnumerationGraphType<Status>();
public static readonly IGraphType String = new StringGraphType();
public static readonly IGraphType Boolean = new BooleanGraphType();
public static readonly IGraphType References = new ListGraphType<NonNullGraphType<GuidGraphType>>();
public static readonly IGraphType NonNullInt = new NonNullGraphType(Int);
public static readonly IGraphType NonNullGuid = new NonNullGraphType(Guid);
public static readonly IGraphType NonNullDate = new NonNullGraphType(Date);
public static readonly IGraphType NonNullFloat = new NonNullGraphType(Float);
public static readonly IGraphType NonNullString = new NonNullGraphType(String);
public static readonly IGraphType NonNullBoolean = new NonNullGraphType(Boolean);
public static readonly IGraphType NonNullStatusType = new NonNullGraphType(Status);
public static readonly IGraphType NoopDate = new NoopGraphType(Date);
public static readonly IGraphType NoopJson = new NoopGraphType(Json);
public static readonly IGraphType NoopFloat = new NoopGraphType(Float);
public static readonly IGraphType NoopString = new NoopGraphType(String);
public static readonly IGraphType NoopBoolean = new NoopGraphType(Boolean);
public static readonly IGraphType NoopTags = new NoopGraphType("Tags");
public static readonly IGraphType NoopGeolocation = new NoopGraphType("Geolocation");
}
}
|
mit
|
C#
|
020a16fb75d22b02ea9c27155a0c56c1907e201f
|
Fix broken link
|
martincostello/website,martincostello/website,martincostello/website,martincostello/website
|
src/Website/Pages/Shared/_Navbar.cshtml
|
src/Website/Pages/Shared/_Navbar.cshtml
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a id="link-home" href="~/" class="navbar-brand">@Options.Value?.Metadata?.Domain</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#site-navbar" aria-controls="site-navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="site-navbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a id="link-projects" href="~/projects" class="nav-link" title="My personal projects">Projects</a>
</li>
<li class="nav-item">
<a id="link-blog" href="~/home/blog" class="nav-link" rel="noopener" target="_blank" title="My blog">Blog</a>
</li>
<li class="nav-item">
<a id="link-tools" href="~/tools" class="nav-link" title="Development tools">Tools</a>
</li>
<li class="nav-item">
<a id="link-about" href="~/home/about" class="nav-link" title="About me">About</a>
</li>
</ul>
</div>
</nav>
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a id="link-home" asp-controller="Home" asp-action="Index" class="navbar-brand">@Options.Value?.Metadata?.Domain</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#site-navbar" aria-controls="site-navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="site-navbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a id="link-projects" href="~/projects" class="nav-link" title="My personal projects">Projects</a>
</li>
<li class="nav-item">
<a id="link-blog" href="~/home/blog" class="nav-link" rel="noopener" target="_blank" title="My blog">Blog</a>
</li>
<li class="nav-item">
<a id="link-tools" href="~/tools" class="nav-link" title="Development tools">Tools</a>
</li>
<li class="nav-item">
<a id="link-about" href="~/home/about" class="nav-link" title="About me">About</a>
</li>
</ul>
</div>
</nav>
|
apache-2.0
|
C#
|
7b82c50872460b21efe80a2df10c6178949ac685
|
Remove unused namespace import.
|
TheGeneGenieProject/GeneGenie.Gedcom
|
GeneGenie.Gedcom.Tests/GedcomCustomTest.cs
|
GeneGenie.Gedcom.Tests/GedcomCustomTest.cs
|
// <copyright file="GedcomCustomTest.cs" company="GeneGenie.com">
// Copyright (c) GeneGenie.com. All Rights Reserved.
// Licensed under the GNU Affero General Public License v3.0. See LICENSE in the project root for license information.
// </copyright>
// <author> Copyright (C) 2020 Ryan O'Neill https://github.com/RyanONeill1970 </author>
namespace GeneGenie.Gedcom.Tests
{
using GeneGenie.Gedcom.Parser;
using System.Linq;
using Xunit;
/// <summary>
/// Tests for ensuring the custom.ged file can be parsed and custom fields found
/// </summary>
public class GedcomCustomTest
{
private GedcomRecordReader GetReader(string file)
{
var reader = new GedcomRecordReader();
reader.ReadGedcom(file);
return reader;
}
[Fact]
private void Custom_marriage_name_tag_can_be_read()
{
var reader = GetReader(".\\Data\\custom.ged");
var mother = reader.Database.Individuals.SingleOrDefault(x => x.GetName().Name == "/Mother/");
Assert.Contains(mother.Custom, c => c.Tag == "_MARNM");
}
[Fact]
private void Custom_marriage_name_value_can_be_read()
{
var reader = GetReader(".\\Data\\custom.ged");
var mother = reader.Database.Individuals.SingleOrDefault(x => x.GetName().Name == "/Mother/");
Assert.Contains(mother.Custom, c => c.Classification == "/Married name/");
}
}
}
|
// <copyright file="GedcomCustomTest.cs" company="GeneGenie.com">
// Copyright (c) GeneGenie.com. All Rights Reserved.
// Licensed under the GNU Affero General Public License v3.0. See LICENSE in the project root for license information.
// </copyright>
// <author> Copyright (C) 2020 Ryan O'Neill https://github.com/RyanONeill1970 </author>
namespace GeneGenie.Gedcom.Tests
{
using System;
using System.Linq;
using GeneGenie.Gedcom.Parser;
using Xunit;
/// <summary>
/// Tests for ensuring the custom.ged file can be parsed and custom fields found
/// </summary>
public class GedcomCustomTest
{
private GedcomRecordReader GetReader(string file)
{
var reader = new GedcomRecordReader();
reader.ReadGedcom(file);
return reader;
}
[Fact]
private void Custom_marriage_name_tag_can_be_read()
{
var reader = GetReader(".\\Data\\custom.ged");
var mother = reader.Database.Individuals.SingleOrDefault(x => x.GetName().Name == "/Mother/");
Assert.Contains(mother.Custom, c => c.Tag == "_MARNM");
}
[Fact]
private void Custom_marriage_name_value_can_be_read()
{
var reader = GetReader(".\\Data\\custom.ged");
var mother = reader.Database.Individuals.SingleOrDefault(x => x.GetName().Name == "/Mother/");
Assert.Contains(mother.Custom, c => c.Classification == "/Married name/");
}
}
}
|
agpl-3.0
|
C#
|
02ff533829c315d71116bb9c0e74e92e111d7bec
|
Fix SSL/TLS exception during application startup
|
GambitKZ/MangaRipper,NguyenDanPhuong/MangaRipper
|
MangaRipper/Helpers/UpdateNotification.cs
|
MangaRipper/Helpers/UpdateNotification.cs
|
using System;
using System.Threading.Tasks;
using Octokit;
using System.Net;
namespace MangaRipper.Helpers
{
public class UpdateNotification
{
public static async Task<string> GetLatestVersion()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var client = new GitHubClient(new ProductHeaderValue("MyAmazingApp"));
var release = await client.Repository.Release.GetLatest("NguyenDanPhuong", "MangaRipper");
return release.TagName;
}
public static long GetLatestBuildNumber(string version)
{
return Convert.ToInt64(version.Remove(0, version.LastIndexOf(".", StringComparison.Ordinal) + 1));
}
}
}
|
using System;
using System.Threading.Tasks;
using Octokit;
namespace MangaRipper.Helpers
{
public class UpdateNotification
{
public static async Task<string> GetLatestVersion()
{
var client = new GitHubClient(new ProductHeaderValue("MyAmazingApp"));
var release = await client.Repository.Release.GetLatest("NguyenDanPhuong", "MangaRipper");
return release.TagName;
}
public static long GetLatestBuildNumber(string version)
{
return Convert.ToInt64(version.Remove(0, version.LastIndexOf(".", StringComparison.Ordinal) + 1));
}
}
}
|
mit
|
C#
|
40e9a573495384ce3c4f18a0fa2d2bf16421f8ab
|
增强 JumonyViewHandler ,提供各种 Find 和 For 方法
|
wukaixian/Jumony,yonglehou/Jumony,zpzgone/Jumony,wukaixian/Jumony,yonglehou/Jumony,zpzgone/Jumony
|
Ivony.Html.Web.Mvc/JumonyViewHandler.cs
|
Ivony.Html.Web.Mvc/JumonyViewHandler.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Ivony.Fluent;
using Ivony.Html.ExpandedAPI;
namespace Ivony.Html.Web.Mvc
{
public class JumonyViewHandler : JumonyView, IHttpHandler
{
#region IHttpHandler 成员
bool IHttpHandler.IsReusable
{
get { return false; }
}
void IHttpHandler.ProcessRequest( HttpContext context )
{
throw new HttpException( 404, "不能直接访问视图处理程序" );
}
#endregion
/// <summary>
/// 在处理范畴内查找符合选择器的元素
/// </summary>
/// <param name="expression">CSS 选择器表达式</param>
/// <returns>符合选择器的元素</returns>
protected IEnumerable<IHtmlElement> Find( string expression )
{
return Scope.Find( expression );
}
/// <summary>
/// 在处理范畴内查找符合选择器的唯一元素
/// </summary>
/// <param name="expression">CSS 选择器表达式</param>
/// <returns>符合选择器的唯一元素</returns>
protected IHtmlElement FindSingle( string expression )
{
return Scope.FindSingle( expression );
}
/// <summary>
/// 在处理范畴内查找符合选择器的首个元素
/// </summary>
/// <param name="expression">CSS 选择器表达式</param>
/// <returns>符合选择器的首个元素</returns>
protected IHtmlElement FindFirst( string expression )
{
return Scope.FindFirst( expression );
}
/// <summary>
/// 对处理范畴内查找符合选择器的首个元素进行处理
/// </summary>
/// <param name="expression">CSS 选择器表达式</param>
/// <param name="action">要进行的处理</param>
protected void ForFirst( string expression, Action<IHtmlElement> action )
{
Scope.Find( expression ).ForFirst( action );
}
/// <summary>
/// 对处理范畴内查找符合选择器的唯一元素进行处理
/// </summary>
/// <param name="expression">CSS 选择器表达式</param>
/// <param name="action">要进行的处理</param>
protected void ForSingle( string expression, Action<IHtmlElement> action )
{
Scope.Find( expression ).ForSingle( action );
}
/// <summary>
/// 对处理范畴内查找符合选择器的所有元素进行处理
/// </summary>
/// <param name="expression">CSS 选择器表达式</param>
/// <param name="action">要进行的处理</param>
protected void ForAll( string expression, Action<IHtmlElement> action )
{
Scope.Find( expression ).ForAll( action );
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
namespace Ivony.Html.Web.Mvc
{
public class JumonyViewHandler : JumonyView, IHttpHandler
{
#region IHttpHandler 成员
bool IHttpHandler.IsReusable
{
get { return false; }
}
void IHttpHandler.ProcessRequest( HttpContext context )
{
throw new HttpException( 404, "不能直接访问视图处理程序" );
}
#endregion
}
}
|
apache-2.0
|
C#
|
34af5a5c00025f3e8faaa3e40ed39a6185ace595
|
Fix naming.
|
ExRam/ExRam.Gremlinq
|
test/ExRam.Gremlinq.Core.Tests/Extensions/GremlinQueryExtensions.cs
|
test/ExRam.Gremlinq.Core.Tests/Extensions/GremlinQueryExtensions.cs
|
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace ExRam.Gremlinq.Core.Tests
{
public static class GremlinQueryExtensions
{
public static async Task Verify<TElement>(this IGremlinQueryBase<TElement> query)
{
var testBase = GremlinqTestBase.Current;
if (testBase is QuerySerializationTest && typeof(TElement) != typeof(object))
{
await query.Cast<object>().Verify();
}
else if (testBase is QueryIntegrationTest && typeof(TElement) != typeof(JToken))
{
await query.Cast<JToken>().Verify();
}
else
{
var serialized = JsonConvert.SerializeObject(
await query
.ToArrayAsync(),
Formatting.Indented);
var scrubbed = testBase
.Scrubbers()
.Aggregate(serialized, (s, func) => func(s));
await testBase.Verify(scrubbed);
}
}
}
}
|
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace ExRam.Gremlinq.Core.Tests
{
public static class GremlinQueryExtensions
{
public static async Task Verify<TElement>(this IGremlinQueryBase<TElement> query)
{
var testBase = GremlinqTestBase.Current;
if (testBase is QuerySerializationTest && typeof(TElement) != typeof(object))
{
await query.Cast<object>().Verify();
}
else if (testBase is QueryIntegrationTest && typeof(TElement) != typeof(JToken))
{
await query.Cast<JToken>().Verify();
}
else
{
var data = JsonConvert.SerializeObject(
await query
.ToArrayAsync(),
Formatting.Indented);
var serialized = testBase
.Scrubbers()
.Aggregate(data, (s, func) => func(s));
await testBase.Verify(serialized);
}
}
}
}
|
mit
|
C#
|
37da0b3d19818ca9d1173af30f0c2b5083c7d3bb
|
fix wave not checking what it collided with
|
danbolt/ggj-jan-2017
|
Pumpkin/Assets/Scripts/WaveHitDetection.cs
|
Pumpkin/Assets/Scripts/WaveHitDetection.cs
|
using UnityEngine;
public class WaveHitDetection : MonoBehaviour
{
public GameObject Player;
private void OnTriggerEnter(Collider other)
{
if (Player)
{
if (other.gameObject == Player)
{
Player.SendMessage("OnHitByWave", null, SendMessageOptions.RequireReceiver);
}
}
else
{
Debug.Log("wave prefab has no player set");
}
}
}
|
using UnityEngine;
public class WaveHitDetection : MonoBehaviour
{
public GameObject Player;
private void OnTriggerEnter()
{
if (Player)
{
Player.SendMessage("OnHitByWave", null, SendMessageOptions.RequireReceiver);
}
else
{
Debug.Log("wave prefab has no player set");
}
}
}
|
mit
|
C#
|
61c3daf50bb47bb8ae7ab50409d795aa180350fd
|
Test position in ShootBulletIntoSpace Test (#5)
|
ForNeVeR/TankDriver
|
TankDriver.Tests/Logic/BulletSpaceTests.cs
|
TankDriver.Tests/Logic/BulletSpaceTests.cs
|
using TankDriver.Logic;
using Microsoft.Xna.Framework;
using Xunit;
namespace TankDriver.Tests.Logic
{
public class BulletSpaceTests
{
private readonly Rectangle BulletSpaceBounds = new Rectangle(0, 0, 100, 100);
[Fact]
public void BulletOutOfBound()
{
BulletSpace bulletSpace = new BulletSpace(BulletSpaceBounds);
bulletSpace.AddBullet(50.0, 50.0, 0.0);
bulletSpace.AddBullet(200.0, 200.0, 0.0);
Assert.Equal(2, bulletSpace.Bullets.Count);
bulletSpace.Update(System.TimeSpan.FromMilliseconds(10.0));
Assert.Equal(1, bulletSpace.Bullets.Count);
}
[Fact]
public void ShootBulletIntoSpace()
{
BulletSpace bulletSpace = new BulletSpace(BulletSpaceBounds);
Tank tank = new Tank(20.0, 20.0, 0.0);
tank.ShootInto(bulletSpace);
Assert.Equal(1, bulletSpace.Bullets.Count);
Assert.Equal(tank.TurretHeading, bulletSpace.Bullets[0].Heading, Configuration.GeometryPrecision);
Assert.Equal(tank.Position.X, bulletSpace.Bullets[0].Position.X, Configuration.GeometryPrecision);
Assert.Equal(tank.Position.Y, bulletSpace.Bullets[0].Position.Y, Configuration.GeometryPrecision);
}
}
}
|
using TankDriver.Logic;
using Microsoft.Xna.Framework;
using Xunit;
namespace TankDriver.Tests.Logic
{
public class BulletSpaceTests
{
private readonly Rectangle BulletSpaceBounds = new Rectangle(0, 0, 100, 100);
[Fact]
public void BulletOutOfBound()
{
BulletSpace bulletSpace = new BulletSpace(BulletSpaceBounds);
bulletSpace.AddBullet(50.0, 50.0, 0.0);
bulletSpace.AddBullet(200.0, 200.0, 0.0);
Assert.Equal(2, bulletSpace.Bullets.Count);
bulletSpace.Update(System.TimeSpan.FromMilliseconds(10.0));
Assert.Equal(1, bulletSpace.Bullets.Count);
}
[Fact]
public void ShootBulletIntoSpace()
{
BulletSpace bulletSpace = new BulletSpace(BulletSpaceBounds);
Tank tank = new Tank(20.0, 20.0, 0.0);
tank.ShootInto(bulletSpace);
Assert.Equal(1, bulletSpace.Bullets.Count);
Assert.Equal(tank.TurretHeading, bulletSpace.Bullets[0].Heading, Configuration.GeometryPrecision);
}
}
}
|
mit
|
C#
|
42a91cbd1a45b0c15dcf1bfd8b306af1f8fcb65f
|
Update AddExample.cs
|
vincentml/basex,vincentml/basex,BaseXdb/basex,BaseXdb/basex,BaseXdb/basex,vincentml/basex,BaseXdb/basex,joansmith/basex,vincentml/basex,JensErat/basex,deshmnnit04/basex,deshmnnit04/basex,ksclarke/basex,JensErat/basex,ksclarke/basex,drmacro/basex,dimitarp/basex,joansmith/basex,vincentml/basex,vincentml/basex,deshmnnit04/basex,deshmnnit04/basex,JensErat/basex,BaseXdb/basex,ksclarke/basex,dimitarp/basex,joansmith/basex,vincentml/basex,dimitarp/basex,ksclarke/basex,ksclarke/basex,JensErat/basex,JensErat/basex,drmacro/basex,dimitarp/basex,joansmith/basex,dimitarp/basex,drmacro/basex,JensErat/basex,JensErat/basex,joansmith/basex,ksclarke/basex,drmacro/basex,drmacro/basex,deshmnnit04/basex,joansmith/basex,ksclarke/basex,BaseXdb/basex,vincentml/basex,joansmith/basex,JensErat/basex,deshmnnit04/basex,BaseXdb/basex,drmacro/basex,dimitarp/basex,drmacro/basex,BaseXdb/basex,joansmith/basex,joansmith/basex,deshmnnit04/basex,vincentml/basex,BaseXdb/basex,drmacro/basex,JensErat/basex,dimitarp/basex,joansmith/basex,ksclarke/basex,ksclarke/basex,vincentml/basex,ksclarke/basex,drmacro/basex,dimitarp/basex,vincentml/basex,joansmith/basex,joansmith/basex,dimitarp/basex,ksclarke/basex,deshmnnit04/basex,JensErat/basex,ksclarke/basex,drmacro/basex,drmacro/basex,BaseXdb/basex,dimitarp/basex,vincentml/basex,drmacro/basex,dimitarp/basex,deshmnnit04/basex,dimitarp/basex,BaseXdb/basex,deshmnnit04/basex,BaseXdb/basex,JensErat/basex,JensErat/basex,deshmnnit04/basex,deshmnnit04/basex
|
src/main/c#/AddExample.cs
|
src/main/c#/AddExample.cs
|
/*
* This example shows how new documents can be added.
*
* Documentation: http://docs.basex.org/wiki/Clients
*
* (C) BaseX Team 2005-12, BSD License
*/
using System;
using System.Diagnostics;
using System.IO;
namespace BaseXClient
{
public class AddExample
{
public static void Main(string[] args)
{
try
{
// create session
Session session = new Session("localhost", 1984, "admin", "admin");
// create empty database
session.Execute("create db database");
Console.WriteLine(session.Info);
// define InputStream
MemoryStream ms = new MemoryStream(
System.Text.Encoding.UTF8.GetBytes("<xml>Hello World!</xml>"));
// add document
session.Add("world/world.xml", ms);
Console.WriteLine(session.Info);
// define InputStream
ms = new MemoryStream(
System.Text.Encoding.UTF8.GetBytes("<xml>Hello Universe!</xml>"));
// add document
session.Add("Universe.xml", ms);
Console.WriteLine(session.Info);
// run query on database
Console.WriteLine(session.Execute("xquery /"));
// drop database
session.Execute("drop db database");
// close session
session.Close();
}
catch (IOException e)
{
// print exception
Console.WriteLine(e.Message);
}
}
}
}
|
/*
* This example shows how new documents can be added.
*
* Documentation: http://docs.basex.org/wiki/Clients
*
* (C) BaseX Team 2005-12, BSD License
*/
using System;
using System.Diagnostics;
using System.IO;
namespace BaseXClient
{
public class AddExample
{
public static void Main(string[] args)
{
try
{
// create session
Session session = new Session("localhost", 1984, "admin", "admin");
// create empty database
session.Execute("create db database");
Console.WriteLine(session.Info);
// define InputStream
MemoryStream ms = new MemoryStream(
System.Text.Encoding.UTF8.GetBytes("<xml>Hello World!</xml>"));
// add document
session.Add("world/world.xml", ms);
Console.WriteLine(session.Info);
// define InputStream
MemoryStream ms = new MemoryStream(
System.Text.Encoding.UTF8.GetBytes("<xml>Hello Universe!</xml>"));
// add document
session.Add("Universe.xml", ms);
Console.WriteLine(session.Info);
// run query on database
Console.WriteLine(session.Execute("xquery /"));
// drop database
session.Execute("drop db database");
// close session
session.Close();
}
catch (IOException e)
{
// print exception
Console.WriteLine(e.Message);
}
}
}
}
|
bsd-3-clause
|
C#
|
884bfbdda81a4ccc3448f735d4d6c4adc402fe77
|
Update the Settings Seed to Add a New SendGrid API Key and Remove Old UserName and Password Keys
|
tommcclean/PortalCMS,tommcclean/PortalCMS,tommcclean/PortalCMS
|
Portal.CMS.Entities/Seed/SettingSeed.cs
|
Portal.CMS.Entities/Seed/SettingSeed.cs
|
using Portal.CMS.Entities.Entities;
using System.Collections.Generic;
using System.Linq;
namespace Portal.CMS.Entities.Seed
{
public static class SettingSeed
{
public static void Seed(PortalEntityModel context)
{
var settingList = context.Settings.ToList();
var newSettings = new List<Setting>();
if (!settingList.Any(x => x.SettingName == "Website Name"))
newSettings.Add(new Setting { SettingName = "Website Name", SettingValue = "Portal CMS" });
if (!settingList.Any(x => x.SettingName == "Description Meta Tag"))
newSettings.Add(new Setting { SettingName = "Description Meta Tag", SettingValue = "Portal CMS is a fully featured content management system with a powerful integrated page builder." });
if (!settingList.Any(x => x.SettingName == "Google Analytics Tracking ID"))
newSettings.Add(new Setting { SettingName = "Google Analytics Tracking ID", SettingValue = "" });
if (!settingList.Any(x => x.SettingName == "Email From Address"))
newSettings.Add(new Setting { SettingName = "Email From Address", SettingValue = "" });
if (!settingList.Any(x => x.SettingName == "SendGrid ApiKey"))
newSettings.Add(new Setting { SettingName = "SendGrid ApiKey", SettingValue = "" });
if (!settingList.Any(x => x.SettingName == "CDN Address"))
newSettings.Add(new Setting { SettingName = "CDN Address", SettingValue = "" });
if (newSettings.Any())
context.Settings.AddRange(newSettings);
var obseleteSettings = context.Settings
.Where(x =>
"SendGrid UserName".Equals(x.SettingName, System.StringComparison.OrdinalIgnoreCase)
|| "SendGrid Password".Equals(x.SettingName, System.StringComparison.OrdinalIgnoreCase))
.ToList();
if (obseleteSettings.Any())
{
context.Settings.RemoveRange(obseleteSettings);
}
}
}
}
|
using Portal.CMS.Entities.Entities;
using System.Collections.Generic;
using System.Linq;
namespace Portal.CMS.Entities.Seed
{
public static class SettingSeed
{
public static void Seed(PortalEntityModel context)
{
var settingList = context.Settings.ToList();
var newSettings = new List<Setting>();
if (!settingList.Any(x => x.SettingName == "Website Name"))
newSettings.Add(new Setting { SettingName = "Website Name", SettingValue = "Portal CMS" });
if (!settingList.Any(x => x.SettingName == "Description Meta Tag"))
newSettings.Add(new Setting { SettingName = "Description Meta Tag", SettingValue = "Portal CMS is a fully featured content management system with a powerful integrated page builder." });
if (!settingList.Any(x => x.SettingName == "Google Analytics Tracking ID"))
newSettings.Add(new Setting { SettingName = "Google Analytics Tracking ID", SettingValue = "" });
if (!settingList.Any(x => x.SettingName == "Email From Address"))
newSettings.Add(new Setting { SettingName = "Email From Address", SettingValue = "" });
if (!settingList.Any(x => x.SettingName == "SendGrid UserName"))
newSettings.Add(new Setting { SettingName = "SendGrid UserName", SettingValue = "" });
if (!settingList.Any(x => x.SettingName == "SendGrid Password"))
newSettings.Add(new Setting { SettingName = "SendGrid Password", SettingValue = "" });
if (!settingList.Any(x => x.SettingName == "CDN Address"))
newSettings.Add(new Setting { SettingName = "CDN Address", SettingValue = "" });
if (newSettings.Any())
context.Settings.AddRange(newSettings);
}
}
}
|
mit
|
C#
|
e1100d9adfd29a12400b41d9200728cbcac54587
|
Use LINQ to sort results.
|
BrettJaner/csla,ronnymgm/csla-light,rockfordlhotka/csla,BrettJaner/csla,rockfordlhotka/csla,BrettJaner/csla,MarimerLLC/csla,rockfordlhotka/csla,MarimerLLC/csla,jonnybee/csla,ronnymgm/csla-light,MarimerLLC/csla,JasonBock/csla,JasonBock/csla,jonnybee/csla,jonnybee/csla,JasonBock/csla,ronnymgm/csla-light
|
ProjectTrackercs/PTWin/ProjectSelect.cs
|
ProjectTrackercs/PTWin/ProjectSelect.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ProjectTracker.Library;
using System.Linq;
namespace PTWin
{
public partial class ProjectSelect : Form
{
private Guid _projectId;
public Guid ProjectId
{
get { return _projectId; }
}
public ProjectSelect()
{
InitializeComponent();
}
private void OK_Button_Click(object sender, EventArgs e)
{
_projectId = (Guid)this.ProjectListListBox.SelectedValue;
this.Close();
}
private void Cancel_Button_Click(object sender, EventArgs e)
{
this.Close();
}
private void ProjectSelect_Load(object sender, EventArgs e)
{
DisplayList(ProjectList.GetProjectList());
}
private void DisplayList(ProjectList list)
{
var sortedList = from p in list orderby p.Name select p;
this.projectListBindingSource.DataSource = sortedList;
}
private void GetListButton_Click(
object sender, EventArgs e)
{
DisplayList(ProjectList.GetProjectList(NameTextBox.Text));
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ProjectTracker.Library;
namespace PTWin
{
public partial class ProjectSelect : Form
{
private Guid _projectId;
public Guid ProjectId
{
get { return _projectId; }
}
public ProjectSelect()
{
InitializeComponent();
}
private void OK_Button_Click(object sender, EventArgs e)
{
_projectId = (Guid)this.ProjectListListBox.SelectedValue;
this.Close();
}
private void Cancel_Button_Click(object sender, EventArgs e)
{
this.Close();
}
private void ProjectSelect_Load(object sender, EventArgs e)
{
DisplayList(ProjectList.GetProjectList());
}
private void DisplayList(ProjectList list)
{
Csla.SortedBindingList<ProjectInfo> sortedList =
new Csla.SortedBindingList<ProjectInfo>(list);
sortedList.ApplySort("Name", ListSortDirection.Ascending);
this.projectListBindingSource.DataSource = sortedList;
}
private void GetListButton_Click(
object sender, EventArgs e)
{
DisplayList(ProjectList.GetProjectList(NameTextBox.Text));
}
}
}
|
mit
|
C#
|
8b9b9e3150a15c036fd94a54ba87ab74f5539281
|
Add test
|
sakapon/Samples-2017
|
ProxySample/ProxyableConsole/Program.cs
|
ProxySample/ProxyableConsole/Program.cs
|
using System;
namespace ProxyableConsole
{
class Program
{
static void Main(string[] args)
{
var result = Proxyable.Body(() =>
{
Console.WriteLine("Body");
return 123;
})
.Aspect(f =>
{
Console.WriteLine("Before");
var r = f();
Console.WriteLine("After");
return r;
})
.Aspect(f =>
{
Console.WriteLine("Begin");
var r = f();
Console.WriteLine("End");
return r;
})
.Execute();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxyableConsole
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
mit
|
C#
|
3071ea5e6eef830f82bf9011a248048397757636
|
fix mysql last_insert_id
|
sqlkata/querybuilder
|
QueryBuilder/Compilers/MySqlCompiler.cs
|
QueryBuilder/Compilers/MySqlCompiler.cs
|
using System;
using SqlKata.Compilers.Bindings;
namespace SqlKata.Compilers
{
public class MySqlCompiler : Compiler
{
public MySqlCompiler() : base(
new SqlResultBinder()
)
{
OpeningIdentifier = ClosingIdentifier = "`";
LastId = "SELECT last_insert_id() as Id";
}
public override string EngineCode { get; } = "mysql";
public override string CompileLimit(SqlResult ctx)
{
var limit = ctx.Query.GetLimit(EngineCode);
var offset = ctx.Query.GetOffset(EngineCode);
if (offset == 0 && limit == 0)
{
return null;
}
if (offset == 0)
{
ctx.Bindings.Add(limit);
return "LIMIT ?";
}
if (limit == 0)
{
// MySql will not accept offset without limit, so we will put a large number
// to avoid this error.
ctx.Bindings.Add(offset);
return "LIMIT 18446744073709551615 OFFSET ?";
}
// We have both values
ctx.Bindings.Add(limit);
ctx.Bindings.Add(offset);
return "LIMIT ? OFFSET ?";
}
}
public static class MySqlCompilerExtensions
{
public static string ENGINE_CODE = "mysql";
public static Query ForMySql(this Query src, Func<Query, Query> fn)
{
return src.For(MySqlCompilerExtensions.ENGINE_CODE, fn);
}
}
}
|
using System;
using SqlKata.Compilers.Bindings;
namespace SqlKata.Compilers
{
public class MySqlCompiler : Compiler
{
public MySqlCompiler() : base(
new SqlResultBinder()
)
{
OpeningIdentifier = ClosingIdentifier = "`";
LastId = "SELECT last_insert_id as Id";
}
public override string EngineCode { get; } = "mysql";
public override string CompileLimit(SqlResult ctx)
{
var limit = ctx.Query.GetLimit(EngineCode);
var offset = ctx.Query.GetOffset(EngineCode);
if (offset == 0 && limit == 0)
{
return null;
}
if (offset == 0)
{
ctx.Bindings.Add(limit);
return "LIMIT ?";
}
if (limit == 0)
{
// MySql will not accept offset without limit, so we will put a large number
// to avoid this error.
ctx.Bindings.Add(offset);
return "LIMIT 18446744073709551615 OFFSET ?";
}
// We have both values
ctx.Bindings.Add(limit);
ctx.Bindings.Add(offset);
return "LIMIT ? OFFSET ?";
}
}
public static class MySqlCompilerExtensions
{
public static string ENGINE_CODE = "mysql";
public static Query ForMySql(this Query src, Func<Query, Query> fn)
{
return src.For(MySqlCompilerExtensions.ENGINE_CODE, fn);
}
}
}
|
mit
|
C#
|
d08dd60499d91d1b6964e81e177ebaa6506fa176
|
Disable look on victory
|
Barleytree/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare
|
Assets/Resources/Microgames/NitoriLook/Scripts/NitoriLookMovement.cs
|
Assets/Resources/Microgames/NitoriLook/Scripts/NitoriLookMovement.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NitoriLookMovement : MonoBehaviour
{
#pragma warning disable 0649 //Serialized Fields
[SerializeField]
private Vector2 mouseRotateVelocity;
#pragma warning restore 0649
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
if (MicrogameController.instance.getVictoryDetermined())
{
enabled = false;
return;
}
Vector3 eulerRotation = transform.rotation.eulerAngles;
float x = eulerRotation.x;
while (x > 90f)
{
x -= 360f;
}
x -= Input.GetAxis("Mouse Y") * mouseRotateVelocity.y;
x = Mathf.Clamp(x, -80f, 15f);
float y = eulerRotation.y;
y += Input.GetAxis("Mouse X") * mouseRotateVelocity.x;
transform.rotation = Quaternion.Euler(new Vector3(x, y, 0f));
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NitoriLookMovement : MonoBehaviour
{
#pragma warning disable 0649 //Serialized Fields
[SerializeField]
private Vector2 mouseRotateVelocity;
#pragma warning restore 0649
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
Vector3 eulerRotation = transform.rotation.eulerAngles;
float x = eulerRotation.x;
while (x > 90f)
{
x -= 360f;
}
x -= Input.GetAxis("Mouse Y") * mouseRotateVelocity.y;
x = Mathf.Clamp(x, -80f, 15f);
float y = eulerRotation.y;
y += Input.GetAxis("Mouse X") * mouseRotateVelocity.x;
transform.rotation = Quaternion.Euler(new Vector3(x, y, 0f));
}
}
|
mit
|
C#
|
c4b6b6d28a066ae3c951f6cbfb1acdc848c40edb
|
Add implementation for authorization serialization example.
|
henrikfroehling/TraktApiSharp
|
Examples/Serialization/TraktSerializeAuthorizationExample/Program.cs
|
Examples/Serialization/TraktSerializeAuthorizationExample/Program.cs
|
namespace TraktSerializeAuthorizationExample
{
using System;
using TraktApiSharp;
using TraktApiSharp.Authentication;
using TraktApiSharp.Enums;
using TraktApiSharp.Services;
class Program
{
private const string CLIENT_ID = "FAKE_CLIENT_ID";
private const string CLIENT_SECRET = "FAKE_CLIENT_SECRET";
static void Main(string[] args)
{
TraktClient client = new TraktClient(CLIENT_ID, CLIENT_SECRET);
TraktAuthorization fakeAuthorization = new TraktAuthorization
{
AccessToken = "FakeAccessToken",
RefreshToken = "FakeRefreshToken",
ExpiresIn = 90 * 24 * 3600,
AccessScope = TraktAccessScope.Public,
TokenType = TraktAccessTokenType.Bearer
};
Console.WriteLine("Fake Authorization:");
Console.WriteLine($"Created (UTC): {fakeAuthorization.Created}");
Console.WriteLine($"Access Scope: {fakeAuthorization.AccessScope.DisplayName}");
Console.WriteLine($"Refresh Possible: {fakeAuthorization.IsRefreshPossible}");
Console.WriteLine($"Valid: {fakeAuthorization.IsValid}");
Console.WriteLine($"Token Type: {fakeAuthorization.TokenType.DisplayName}");
Console.WriteLine($"Access Token: {fakeAuthorization.AccessToken}");
Console.WriteLine($"Refresh Token: {fakeAuthorization.RefreshToken}");
Console.WriteLine($"Token Expired: {fakeAuthorization.IsExpired}");
Console.WriteLine($"Expires in {fakeAuthorization.ExpiresIn / 3600 / 24} days");
Console.WriteLine("-------------------------------------------------------------");
//string fakeAuthorizationJson = TraktSerializationService.Serialize(client.Authorization);
string fakeAuthorizationJson = TraktSerializationService.Serialize(fakeAuthorization);
if (!string.IsNullOrEmpty(fakeAuthorizationJson))
{
Console.WriteLine("Serialized Fake Authorization:");
Console.WriteLine(fakeAuthorizationJson);
Console.WriteLine("-------------------------------------------------------------");
TraktAuthorization deserializedFakeAuthorization = TraktSerializationService.DeserializeAuthorization(fakeAuthorizationJson);
if (deserializedFakeAuthorization != null)
{
client.Authorization = deserializedFakeAuthorization;
Console.WriteLine("Deserialized Fake Authorization:");
Console.WriteLine($"Created (UTC): {deserializedFakeAuthorization.Created}");
Console.WriteLine($"Access Scope: {deserializedFakeAuthorization.AccessScope.DisplayName}");
Console.WriteLine($"Refresh Possible: {deserializedFakeAuthorization.IsRefreshPossible}");
Console.WriteLine($"Valid: {deserializedFakeAuthorization.IsValid}");
Console.WriteLine($"Token Type: {deserializedFakeAuthorization.TokenType.DisplayName}");
Console.WriteLine($"Access Token: {deserializedFakeAuthorization.AccessToken}");
Console.WriteLine($"Refresh Token: {deserializedFakeAuthorization.RefreshToken}");
Console.WriteLine($"Token Expired: {deserializedFakeAuthorization.IsExpired}");
Console.WriteLine($"Expires in {deserializedFakeAuthorization.ExpiresIn / 3600 / 24} days");
}
}
Console.ReadLine();
}
}
}
|
namespace TraktSerializeAuthorizationExample
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
mit
|
C#
|
fb9db73de962581f623b39a216ea24667dc91158
|
Fix Code Issues.
|
nuitsjp/KAMISHIBAI
|
Source/Kamishibai.Wpf.Demo.ViewModel/MainWindowViewModel.cs
|
Source/Kamishibai.Wpf.Demo.ViewModel/MainWindowViewModel.cs
|
using System.Diagnostics;
using Kamishibai.Wpf.ViewModel;
namespace Kamishibai.Wpf.Demo.ViewModel;
public class MainWindowViewModel :
INavigatingAsyncAware,
INavigatingAware,
INavigatedAsyncAware
{
private readonly INavigationService _navigationService;
public MainWindowViewModel(INavigationService navigationService)
{
_navigationService = navigationService;
}
public string SecondFrameName => "SecondFrame";
public async Task OnNavigatedAsync()
{
await _navigationService.NavigateToSafeContentPage(1);
await _navigationService.NavigateToSafeContentPage(1, SecondFrameName);
}
public Task OnNavigatingAsync()
{
Debug.WriteLine("MainWindowViewModel#OnNavigatingAsync");
return Task.CompletedTask;
}
public void OnNavigating()
{
Debug.WriteLine("MainWindowViewModel#OnNavigating");
}
}
|
using System.Diagnostics;
using Kamishibai.Wpf.ViewModel;
namespace Kamishibai.Wpf.Demo.ViewModel;
public class MainWindowViewModel :
INavigatingAsyncAware,
INavigatingAware,
INavigatedAsyncAware
{
private readonly INavigationService _navigationService;
public MainWindowViewModel(INavigationService navigationService)
{
_navigationService = navigationService;
}
public static string SecondFrameName => "SecondFrame";
public async Task OnNavigatedAsync()
{
await _navigationService.NavigateToSafeContentPage(1);
await _navigationService.NavigateToSafeContentPage(1, SecondFrameName);
}
public Task OnNavigatingAsync()
{
Debug.WriteLine("MainWindowViewModel#OnNavigatingAsync");
return Task.CompletedTask;
}
public void OnNavigating()
{
Debug.WriteLine("MainWindowViewModel#OnNavigating");
}
}
|
mit
|
C#
|
ce51fa5b38abe610486a4511e32294f595512d8c
|
Add missing NUnit category
|
AntoineGa/EventFlow,rasmus/EventFlow
|
Source/EventFlow.Tests/UnitTests/Sagas/SagaDefinitionServiceTests.cs
|
Source/EventFlow.Tests/UnitTests/Sagas/SagaDefinitionServiceTests.cs
|
// The MIT License (MIT)
//
// Copyright (c) 2015-2016 Rasmus Mikkelsen
// Copyright (c) 2015-2016 eBay Software Foundation
// https://github.com/rasmus/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Linq;
using EventFlow.Sagas;
using EventFlow.TestHelpers;
using FluentAssertions;
using NUnit.Framework;
namespace EventFlow.Tests.UnitTests.Sagas
{
[Category(Categories.Unit)]
public class SagaDefinitionServiceTests : TestsFor<SagaDefinitionService>
{
[TestCase(typeof(SagaTestClasses.SagaTestEventA))]
[TestCase(typeof(SagaTestClasses.SagaTestEventB))]
[TestCase(typeof(SagaTestClasses.SagaTestEventC))]
public void GetSagaTypeDetails(Type aggregateEventType)
{
// Arrange
Sut.LoadSagas(typeof(SagaTestClasses.TestSaga));
// Act
var sagaTypeDetails = Sut.GetSagaTypeDetails(aggregateEventType);
// Assert
sagaTypeDetails.Should().HaveCount(1);
sagaTypeDetails.Single().SagaType.Should().Be(typeof (SagaTestClasses.TestSaga));
}
}
}
|
// The MIT License (MIT)
//
// Copyright (c) 2015-2016 Rasmus Mikkelsen
// Copyright (c) 2015-2016 eBay Software Foundation
// https://github.com/rasmus/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Linq;
using EventFlow.Sagas;
using EventFlow.TestHelpers;
using FluentAssertions;
using NUnit.Framework;
namespace EventFlow.Tests.UnitTests.Sagas
{
public class SagaDefinitionServiceTests : TestsFor<SagaDefinitionService>
{
[TestCase(typeof(SagaTestClasses.SagaTestEventA))]
[TestCase(typeof(SagaTestClasses.SagaTestEventB))]
[TestCase(typeof(SagaTestClasses.SagaTestEventC))]
public void GetSagaTypeDetails(Type aggregateEventType)
{
// Arrange
Sut.LoadSagas(typeof(SagaTestClasses.TestSaga));
// Act
var sagaTypeDetails = Sut.GetSagaTypeDetails(aggregateEventType);
// Assert
sagaTypeDetails.Should().HaveCount(1);
sagaTypeDetails.Single().SagaType.Should().Be(typeof (SagaTestClasses.TestSaga));
}
}
}
|
mit
|
C#
|
a98bb331edd9e4c0477ef2b8745ac78adefb1578
|
Remove multiple checks
|
Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist
|
Trappist/src/Promact.Trappist.Core/Controllers/QuestionController.cs
|
Trappist/src/Promact.Trappist.Core/Controllers/QuestionController.cs
|
using Microsoft.AspNetCore.Mvc;
using Promact.Trappist.DomainModel.ApplicationClasses.Question;
using Promact.Trappist.DomainModel.Enum;
using Promact.Trappist.Repository.Questions;
using System.Threading.Tasks;
namespace Promact.Trappist.Core.Controllers
{
[Route("api/question")]
public class QuestionController : Controller
{
private readonly IQuestionRespository _questionsRepository;
public QuestionController(IQuestionRespository questionsRepository)
{
_questionsRepository = questionsRepository;
}
#region Question API
/// <summary>
/// Adds question to the database
/// </summary>
/// <param name="questionAC">QuestionAC object</param>
/// <returns>
/// Returns status 200(Ok) with QuestionAC object passed if question is added successfully
/// Returns Status 400(BadRequest) if model state is invalid or null
/// </returns>
[HttpPost]
public async Task<IActionResult> AddQuestion([FromBody]QuestionAC questionAC)
{
if(questionAC == null)
{
return BadRequest();
}
if (!ModelState.IsValid)
{
return BadRequest();
}
if(questionAC.SingleMultipleAnswerQuestionAC.SingleMultipleAnswerQuestion.Question.QuestionType == QuestionType.Programming)
{
//To-Do Modify parameter accordingly _questionsRepository.AddCodeSnippetQuestion(questionAC);
return Ok(questionAC);
}
else
{
await _questionsRepository.AddSingleMultipleAnswerQuestionAsync(questionAC);
return Ok(questionAC);
}
}
/// <summary>
/// Returns The List Of Questions
/// </summary>
/// <returns></returns>
[HttpGet("question")]
public IActionResult GetAllQuestions()
{
var questionsList = _questionsRepository.GetAllQuestions();
return Ok(questionsList);
}
#endregion
}
}
|
using Microsoft.AspNetCore.Mvc;
using Promact.Trappist.DomainModel.ApplicationClasses.Question;
using Promact.Trappist.DomainModel.Enum;
using Promact.Trappist.Repository.Questions;
using System.Threading.Tasks;
namespace Promact.Trappist.Core.Controllers
{
[Route("api/question")]
public class QuestionController : Controller
{
private readonly IQuestionRespository _questionsRepository;
public QuestionController(IQuestionRespository questionsRepository)
{
_questionsRepository = questionsRepository;
}
#region Question API
/// <summary>
/// Adds question to the database
/// </summary>
/// <param name="questionAC">QuestionAC object</param>
/// <returns>
/// Returns status 200(Ok) with QuestionAC object passed if question is added successfully
/// Returns Status 400(BadRequest) if model state is invalid or null
/// </returns>
[HttpPost]
public async Task<IActionResult> AddQuestion([FromBody]QuestionAC questionAC)
{
if(questionAC == null || !ModelState.IsValid)
{
return BadRequest();
}
if(questionAC.SingleMultipleAnswerQuestionAC.SingleMultipleAnswerQuestion.Question.QuestionType == QuestionType.Single || questionAC.SingleMultipleAnswerQuestionAC.SingleMultipleAnswerQuestion.Question.QuestionType == QuestionType.Multiple)
{
await _questionsRepository.AddSingleMultipleAnswerQuestionAsync(questionAC);
return Ok(questionAC);
}
else
{
//To-Do Modify parameter accordingly _questionsRepository.AddCodeSnippetQuestion(questionAC);
return Ok(questionAC);
}
}
/// <summary>
/// Returns The List Of Questions
/// </summary>
/// <returns></returns>
[HttpGet("question")]
public IActionResult GetAllQuestions()
{
var questionsList = _questionsRepository.GetAllQuestions();
return Ok(questionsList);
}
#endregion
}
}
|
mit
|
C#
|
2e18600030ab121d8c9155a8e52d686d4ce0330b
|
Fix issues
|
ndrmc/cats,ndrmc/cats,ndrmc/cats
|
Web/Controllers/SMSGatewayController.cs
|
Web/Controllers/SMSGatewayController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Cats.Models;
using Cats.Services.EarlyWarning;
using Cats.Models.ViewModels;
namespace Cats.Controllers
{
public class SMSGatewayController : Controller
{
//
// GET: /CatsSmsGateway/
private readonly IFDPService _fdpService;
public SMSGatewayController(IFDPService fdpService)
{
_fdpService = fdpService;
}
public JsonResult Index()
{
var messages = new List<SmsOutgoingMessage>();
var messageOne = new SmsOutgoingMessage()
{
Id = new Guid(),
Message = "Hello this is the first ever message from the original CATS",
Priority = 5,
To = "0911663223",
Type = "OutGoing"
};
messages.Add(messageOne);
return Json(messages, JsonRequestBehavior.AllowGet);
}
public JsonResult Send()
{
var fdps = _fdpService.GetAllFDP().Take(2);
var hh = (from fdp in fdps
select new
{
fdp.Name,
fdp.NameAM
}
);
return Json(hh, JsonRequestBehavior.AllowGet);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Cats.Models;
using Cats.Services.EarlyWarning;
using Cats.Models.ViewModels;
namespace Cats.Controllers
{
public class SMSGatewayController : Controller
{
//
// GET: /CatsSmsGateway/
private readonly IFDPService _FDPService;
public SMSGatewayController(IFDPService fdpService)
{
_FDPService = fdpService;
}
public JsonResult Index()
{
var messages = new List<SmsOutgoingMessage>();
var messageOne = new SmsOutgoingMessage()
{
Id = new Guid(),
Message = "Hello this is the first ever message from the original CATS",
Priority = 5,
To = "0911663223",
Type = "OutGoing"
};
messages.Add(messageOne);
return Json(messages, JsonRequestBehavior.AllowGet);
}
public JsonResult Send()
{
var fdps = _FDPService.GetAllFDP().Take(2);
var hh = (from fdp in fdps
select new
{
fdp.Name,
fdp.NameAM
}
);
return Json(hh, JsonRequestBehavior.AllowGet);
}
}
}
|
apache-2.0
|
C#
|
915f35b0c08152a4e48c23eda5b7a815922c3f1c
|
Update assembly version to 1.2 to match the version set in Microsoft.Web.Xdt package.
|
alluran/xdt,azurelogic/XdtExtended,dolkensp/xdt
|
XmlTransform/Properties/AssemblyInfo.cs
|
XmlTransform/Properties/AssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
|
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
e126e84c04cc79b8cd61e4363ce4b0d034a899bd
|
Update UserAgentExtensions.cs
|
wangkanai/Detection
|
src/Extensions/UserAgentExtensions.cs
|
src/Extensions/UserAgentExtensions.cs
|
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Wangkanai.Detection.Models;
namespace Wangkanai.Detection.Extensions
{
internal static class UserAgentExtensions
{
public static UserAgent UserAgentFromHeader(this HttpContext context)
=> new UserAgent(context.Request.Headers["User-Agent"].FirstOrDefault());
public static bool IsNullOrEmpty(this UserAgent agent)
=> agent == null
|| string.IsNullOrEmpty(agent.ToLower());
public static string ToLower(this UserAgent agent)
=> agent.ToString().ToLower();
public static int Length(this UserAgent agent)
=> agent.ToString().Length;
public static bool Contains(this UserAgent agent, string word)
=> !word.IsNullOrEmpty()
&& !agent.IsNullOrEmpty()
&& agent.ToLower().Contains(word.ToLower());
public static bool Contains(this UserAgent agent, string[] array)
=> !agent.IsNullOrEmpty()
&& array.Length > 0
&& array.Any(agent.Contains);
public static bool Contains<T>(this UserAgent agent, T t) where T : Enum
=> agent.Contains(t.ToString().ToLower());
public static bool Contains(this UserAgent agent, IEnumerable<string> list)
=> list != null
&& list.Count() > 0
&& list.Any(agent.Contains);
public static bool StartsWith(this UserAgent agent, string word)
=> !agent.IsNullOrEmpty()
&& agent.ToLower().StartsWith(word.ToLower());
public static bool StartsWith(this UserAgent agent, string[] array)
=> array.Any(agent.StartsWith);
public static bool StartsWith(this UserAgent agent, string[] array, int minimum)
=> agent.Length() >= minimum
&& agent.StartsWith(array);
}
}
|
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Wangkanai.Detection.Models;
namespace Wangkanai.Detection.Extensions
{
internal static class UserAgentExtensions
{
public static UserAgent UserAgentFromHeader(this HttpContext context)
=> new UserAgent(context.Request.Headers["User-Agent"].FirstOrDefault());
public static bool IsNullOrEmpty(this UserAgent agent)
=> agent == null
|| string.IsNullOrEmpty(agent.ToLower());
public static string ToLower(this UserAgent agent)
=> agent.ToString().ToLower();
public static int Length(this UserAgent agent)
=> agent.ToString().Length;
public static bool Contains(this UserAgent agent, string word)
=> !word.IsNullOrEmpty()
&& !agent.IsNullOrEmpty()
&& agent.ToLower().Contains(word.ToLower());
public static bool Contains(this UserAgent agent, string[] array)
=> !agent.IsNullOrEmpty()
&& array.Length > 0
&& array.Any(agent.Contains);
public static bool Contains<T>(this UserAgent agent, T t) where T : Enum
=> agent.Contains(t.ToString().ToLower());
public static bool Contains(this UserAgent agent, IEnumerable<string> list)
=> list != null
&& list.Any(agent.Contains);
public static bool StartsWith(this UserAgent agent, string word)
=> !agent.IsNullOrEmpty()
&& agent.ToLower().StartsWith(word.ToLower());
public static bool StartsWith(this UserAgent agent, string[] array)
=> array.Any(agent.StartsWith);
public static bool StartsWith(this UserAgent agent, string[] array, int minimum)
=> agent.Length() >= minimum
&& agent.StartsWith(array);
}
}
|
apache-2.0
|
C#
|
811670fc677aac14833a6fe4105cd52b480ff6cc
|
Use the new API for creating loop specific async watchers.
|
jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,jacksonh/manos,mdavid/manos-spdy,jacksonh/manos,jacksonh/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,jmptrader/manos,jmptrader/manos
|
src/Manos/Manos.Threading/Boundary.cs
|
src/Manos/Manos.Threading/Boundary.cs
|
//
// Copyright (C) 2011 Robin Duerden (rduerden@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
//
using System;
using Manos.IO;
using Libev;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Concurrent;
namespace Manos.Threading
{
public class Boundary : IBoundary
{
public static readonly Boundary Instance = new Boundary (IOLoop.Instance);
private readonly IAsyncWatcher asyncWatcher;
private readonly ConcurrentQueue<Action> workQueue;
private int maxWorkPerLoop;
public Boundary( IOLoop loop ) : this( loop, 18 ) {}
public Boundary( IOLoop loop, int maxWorkPerLoop )
{
asyncWatcher = loop.NewAsyncWatcher (ProcessWork);
asyncWatcher.Start ();
workQueue = new ConcurrentQueue<Action> ();
this.maxWorkPerLoop = maxWorkPerLoop;
}
public void ExecuteOnTargetLoop (Action action)
{
workQueue.Enqueue (action);
asyncWatcher.Send ();
}
private void ProcessWork (Loop loop, IAsyncWatcher watcher, EventTypes revents)
{
int remaining = maxWorkPerLoop + 1;
while( --remaining > 0 ) {
Action action;
if( workQueue.TryDequeue (out action)) {
try {
action();
}
catch (Exception ex) {
Console.WriteLine ("Error in processing synchronized action");
Console.WriteLine (ex);
}
}
else break;
}
if (remaining == 0) asyncWatcher.Send ();
}
}
}
|
//
// Copyright (C) 2011 Robin Duerden (rduerden@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
//
using System;
using Manos.IO;
using Libev;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Concurrent;
namespace Manos.Threading
{
public class Boundary : IBoundary
{
public static readonly Boundary Instance = new Boundary (IOLoop.Instance);
private readonly AsyncWatcher asyncWatcher;
private readonly ConcurrentQueue<Action> workQueue;
private int maxWorkPerLoop;
public Boundary( IOLoop loop ) : this( loop, 18 ) {}
public Boundary( IOLoop loop, int maxWorkPerLoop )
{
asyncWatcher = new AsyncWatcher ((LibEvLoop)loop.EventLoop, ( l, w, et ) => ProcessWork());
asyncWatcher.Start ();
workQueue = new ConcurrentQueue<Action> ();
this.maxWorkPerLoop = maxWorkPerLoop;
}
public void ExecuteOnTargetLoop (Action action)
{
workQueue.Enqueue (action);
asyncWatcher.Send ();
}
private void ProcessWork ()
{
int remaining = maxWorkPerLoop + 1;
while( --remaining > 0 ) {
Action action;
if( workQueue.TryDequeue (out action)) {
try {
action();
}
catch (Exception ex) {
Console.WriteLine ("Error in processing synchronized action");
Console.WriteLine (ex);
}
}
else break;
}
if (remaining == 0) asyncWatcher.Send ();
}
}
}
|
mit
|
C#
|
b59de8e023f96503afaa0869ad724626765ba202
|
refactor namings
|
sagivo/Unity2d-Game
|
Assets/Resources/Scripts/GameController.cs
|
Assets/Resources/Scripts/GameController.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GameController : Singleton<GameController> {
public int level;
public Player player;
public int score;
public List<Resource> resources = new List<Resource>();
public List<Cell> Cells = new List<Cell>();
public List<Enemy> Enemies = new List<Enemy>(); //populate this list each time you create an enemy.
public List<Building> Buildings = new List<Building>(); //populate this list each time you create a building.
public List<Canon> Canons = new List<Canon>(); //populate this list each time you create a building.
public List<Defence> Defences = new List<Defence>(); //populate this list each time you create a building.
public GameObject spawnerLayer;
Sprite Sprite;
void Start(){
spawnerLayer = new GameObject("Spawns");
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GameController : Singleton<GameController> {
public int Level;
public Player Player;
public int Score;
public List<Resource> Resources = new List<Resource>();
public List<Cell> Cells = new List<Cell>();
public List<Enemy> Enemies = new List<Enemy>(); //populate this list each time you create an enemy.
public List<Building> Buildings = new List<Building>(); //populate this list each time you create a building.
public List<Canon> Canons = new List<Canon>(); //populate this list each time you create a building.
public List<Defence> Defences = new List<Defence>(); //populate this list each time you create a building.
public GameObject spawnerLayer;
Sprite Sprite;
void Start(){
spawnerLayer = new GameObject("Spawns");
}
}
|
apache-2.0
|
C#
|
ad3214669c678fc53f6eecc95e9142b7cfc4b0ce
|
Optimize CollectionFileRootSerializer
|
markmeeus/MarcelloDB
|
MarcelloDB/Serialization/CollectionFileRootSerializer.cs
|
MarcelloDB/Serialization/CollectionFileRootSerializer.cs
|
using System;
using System.Text;
namespace MarcelloDB.Serialization
{
internal class CollectionFileRootSerializer : IObjectSerializer<CollectionFileRoot>
{
const int SERIALIZATION_VERSION = 1;
public CollectionFileRootSerializer()
{
}
#region IObjectSerializer implementation
public byte[] Serialize(CollectionFileRoot root)
{
var expectedSize = sizeof(byte)
+ sizeof(Int32)
+ sizeof(Int64)
+ sizeof(Int64);
var writer = new BufferWriter(new byte[expectedSize]);
writer.WriteByte(SERIALIZATION_VERSION);
writer.WriteInt32(root.FormatVersion);
writer.WriteInt64(root.Head);
writer.WriteInt64(root.NamedRecordIndexAddress);
return writer.GetTrimmedBuffer();
}
public CollectionFileRoot Deserialize(byte[] bytes)
{
var reader = new BufferReader(bytes);
var root = new CollectionFileRoot();
reader.ReadByte(); //read SERIALIZATION_VERSION
root.FormatVersion = reader.ReadInt32();
root.Head = reader.ReadInt64();
root.NamedRecordIndexAddress = reader.ReadInt64();
root.Clean();
return root;
}
#endregion
}
}
|
using System;
using System.Text;
namespace MarcelloDB.Serialization
{
internal class CollectionFileRootSerializer : IObjectSerializer<CollectionFileRoot>
{
const int SERIALIZATION_VERSION = 1;
public CollectionFileRootSerializer()
{
}
#region IObjectSerializer implementation
public byte[] Serialize(CollectionFileRoot root)
{
var writer = new BufferWriter(new byte[0]);
writer.WriteByte(SERIALIZATION_VERSION);
writer.WriteInt32(root.FormatVersion);
writer.WriteInt64(root.Head);
writer.WriteInt64(root.NamedRecordIndexAddress);
return writer.GetTrimmedBuffer();
}
public CollectionFileRoot Deserialize(byte[] bytes)
{
var reader = new BufferReader(bytes);
var root = new CollectionFileRoot();
reader.ReadByte(); //read SERIALIZATION_VERSION
root.FormatVersion = reader.ReadInt32();
root.Head = reader.ReadInt64();
root.NamedRecordIndexAddress = reader.ReadInt64();
root.Clean();
return root;
}
#endregion
}
}
|
mit
|
C#
|
d3bfa4c192153423d2d24f059da64e78416fafe1
|
Add Delete method for PartsListTableAdapter
|
BartoszBaczek/WorkshopRequestsManager
|
Project/WorkshopManager/WorkshopManager/SqlDatabase/PartsListTableAdapter.cs
|
Project/WorkshopManager/WorkshopManager/SqlDatabase/PartsListTableAdapter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkshopManager.SqlDatabase
{
using PartsListTableAdapterExtensions;
class PartsListTableAdapter
{
public Get Get;
public Add Add;
public Update Update;
public Delete Delete;
public PartsListTableAdapter()
{
Get = new Get();
Add = new Add();
Update = new Update();
Delete = new Delete();
}
}
}
namespace PartsListTableAdapterExtensions
{
using WorkshopManager.SqlDatabase.MySql;
class Get
{
}
class Add
{
private const string _listTable = "PartsList";
private const string _allColumns = "Parts_id, Orders_id";
public void Single(int idOrder, int idPart)
{
DBConnector.Insert(
_listTable,
_allColumns,
string.Format("{0},{1}", idPart, idOrder));
}
public void Multiple(int idOrder, List<int> idParts)
{
List<string> records = new List<string>();
foreach (var item in idParts)
{
records.Add(
string.Format(
"{0},{1}", item, idOrder));
}
DBConnector.Insert(
_listTable,
_allColumns,
records);
}
}
class Update
{
}
class Delete
{
private const string _listTable = "PartsList";
public void List(int idOrder)
{
DBConnector.Delete(
_listTable,
string.Format(
"Orders_id=\'{0}\'", idOrder));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkshopManager.SqlDatabase
{
using PartsListTableAdapterExtensions;
class PartsListTableAdapter
{
public Get Get;
public Add Add;
public Update Update;
public Delete Delete;
public PartsListTableAdapter()
{
Get = new Get();
Add = new Add();
Update = new Update();
Delete = new Delete();
}
}
}
namespace PartsListTableAdapterExtensions
{
using WorkshopManager.SqlDatabase.MySql;
class Get
{
}
class Add
{
private const string _listTable = "PartsList";
private const string _allColumns = "Parts_id, Orders_id";
public void Single(int idOrder, int idPart)
{
DBConnector.Insert(
_listTable,
_allColumns,
string.Format("{0},{1}", idPart, idOrder));
}
public void Multiple(int idOrder, List<int> idParts)
{
List<string> records = new List<string>();
foreach (var item in idParts)
{
records.Add(
string.Format(
"{0},{1}", item, idOrder));
}
DBConnector.Insert(
_listTable,
_allColumns,
records);
}
}
class Update
{
}
class Delete
{
}
}
|
mit
|
C#
|
d024b974f583e26159a10ef1aca26ab9e267ce3b
|
Add support on fetching Uri with local filepath like "file:///C:/website/style.css"
|
milkshakesoftware/PreMailer.Net
|
PreMailer.Net/PreMailer.Net/Downloaders/WebDownloader.cs
|
PreMailer.Net/PreMailer.Net/Downloaders/WebDownloader.cs
|
using System;
using System.IO;
using System.Net;
using System.Text;
namespace PreMailer.Net.Downloaders
{
public class WebDownloader : IWebDownloader
{
private static IWebDownloader _sharedDownloader;
public static IWebDownloader SharedDownloader
{
get
{
if (_sharedDownloader == null)
{
_sharedDownloader = new WebDownloader();
}
return _sharedDownloader;
}
set
{
_sharedDownloader = value;
}
}
public string DownloadString(Uri uri)
{
var request = WebRequest.Create(uri);
using (var response = request.GetResponse())
{
switch (response)
{
case HttpWebResponse httpWebResponse:
{
var charset = httpWebResponse.CharacterSet;
var encoding = Encoding.GetEncoding(charset);
using (var stream = httpWebResponse.GetResponseStream())
using (var reader = new StreamReader(stream, encoding))
{
return reader.ReadToEnd();
}
}
case FileWebResponse fileWebResponse:
{
using (var stream = fileWebResponse.GetResponseStream())
using (var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
default:
throw new NotSupportedException($"The Uri type is giving a response in unsupported type '{response.GetType()}'.");
}
}
}
}
}
|
using System;
using System.IO;
using System.Net;
using System.Text;
namespace PreMailer.Net.Downloaders
{
public class WebDownloader : IWebDownloader
{
private static IWebDownloader _sharedDownloader;
public static IWebDownloader SharedDownloader
{
get
{
if (_sharedDownloader == null)
{
_sharedDownloader = new WebDownloader();
}
return _sharedDownloader;
}
set
{
_sharedDownloader = value;
}
}
public string DownloadString(Uri uri)
{
var request = WebRequest.Create(uri);
using (var response = (HttpWebResponse)request.GetResponse())
{
var charset = response.CharacterSet;
var encoding = Encoding.GetEncoding(charset);
using (var stream = response.GetResponseStream())
using (var reader = new StreamReader(stream, encoding))
{
return reader.ReadToEnd();
}
}
}
}
}
|
mit
|
C#
|
443c5f99178ae21dee6b45f7cb36f59896b26b95
|
Fix exception in UserNotificationHub
|
xpressive-websolutions/Xpressive.Home,xpressive-websolutions/Xpressive.Home.ProofOfConcept,xpressive-websolutions/Xpressive.Home.ProofOfConcept,xpressive-websolutions/Xpressive.Home.ProofOfConcept,xpressive-websolutions/Xpressive.Home,xpressive-websolutions/Xpressive.Home
|
Xpressive.Home.WebApi/Controllers/UserNotificationHub.cs
|
Xpressive.Home.WebApi/Controllers/UserNotificationHub.cs
|
using System;
using System.Collections.Generic;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
using Xpressive.Home.Contracts.Messaging;
namespace Xpressive.Home.WebApi.Controllers
{
[HubName("notificationHub")]
public class UserNotificationHub : Hub, IMessageQueueListener<NotifyUserMessage>
{
private static readonly List<UserNotificationDto> _notifications = new List<UserNotificationDto>();
private static readonly object _lock = new object();
public void Notify(NotifyUserMessage message)
{
lock (_lock)
{
var dto = new UserNotificationDto
{
Timestamp = DateTime.UtcNow,
Message = message.Notification
};
_notifications.RemoveAll(n => n.Message.Equals(message.Notification, StringComparison.Ordinal));
_notifications.Add(dto);
var context = GlobalHost.ConnectionManager.GetHubContext<UserNotificationHub>();
context.Clients?.All?.onNotification(dto);
}
}
public void Register(string userId)
{
lock (_lock)
{
foreach (var notification in _notifications)
{
Clients.Client(Context.ConnectionId).onNotification(notification);
}
}
}
public class UserNotificationDto
{
public string Message { get; set; }
public DateTime Timestamp { get; set; }
}
}
}
|
using System;
using System.Collections.Generic;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
using Xpressive.Home.Contracts.Messaging;
namespace Xpressive.Home.WebApi.Controllers
{
[HubName("notificationHub")]
public class UserNotificationHub : Hub, IMessageQueueListener<NotifyUserMessage>
{
private static readonly List<UserNotificationDto> _notifications = new List<UserNotificationDto>();
private static readonly object _lock = new object();
public void Notify(NotifyUserMessage message)
{
lock (_lock)
{
var dto = new UserNotificationDto
{
Timestamp = DateTime.UtcNow,
Message = message.Notification
};
_notifications.RemoveAll(n => n.Message.Equals(message.Notification, StringComparison.Ordinal));
_notifications.Add(dto);
Clients?.All?.onNotification(dto);
}
}
public void Register(string userId)
{
lock (_lock)
{
foreach (var notification in _notifications)
{
Clients.Client(Context.ConnectionId).onNotification(notification);
}
}
}
public class UserNotificationDto
{
public string Message { get; set; }
public DateTime Timestamp { get; set; }
}
}
}
|
mit
|
C#
|
54569776cba4f8a26d6b08e9e7e2f96205150449
|
Exclude static methods, use Marshal.SizeOf
|
pardeike/Harmony
|
Harmony/Internal/NativeThisPointerCheck.cs
|
Harmony/Internal/NativeThisPointerCheck.cs
|
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Harmony
{
// A test for https://github.com/dotnet/coreclr/blob/master/Documentation/botr/clr-abi.md
//
internal class NativeThisPointer
{
internal static bool NeedsNativeThisPointerFix(MethodBase method)
{
if (method.IsStatic) return false;
var returnType = AccessTools.GetReturnedType(method);
if (AccessTools.IsStruct(returnType) == false) return false;
var size = Marshal.SizeOf(returnType);
if (size != 3 && size != 5 && size != 6 && size != 7 && size < 9) return false;
return HasNativeThis();
}
static bool hasTestResult, hasNativeThis;
static bool HasNativeThis()
{
if (hasTestResult == false)
{
hasNativeThis = false;
var self = new NativeThisPointer();
var original = AccessTools.DeclaredMethod(typeof(NativeThisPointer), "GetStruct");
var replacement = AccessTools.DeclaredMethod(typeof(NativeThisPointer), "GetStructReplacement");
Memory.DetourMethod(original, replacement);
new NativeThisPointer().GetStruct((IntPtr)0xdeadbeef, (IntPtr)0xdeadbeef);
hasTestResult = true;
}
return hasNativeThis;
}
struct SomeStruct
{
#pragma warning disable CS0169
readonly byte b1;
readonly byte b2;
readonly byte b3;
#pragma warning restore CS0169
}
[MethodImpl(MethodImplOptions.NoInlining)]
SomeStruct GetStruct(IntPtr x, IntPtr y)
{
throw new Exception("This method should've been detoured!");
}
static unsafe void GetStructReplacement(NativeThisPointer self, IntPtr ptr, IntPtr a, IntPtr b)
{
// Normal argument order:
// this, a, b
// If we have a native return buffer pointer, the order is:
// this, ptr, a, b
hasNativeThis = (a == (IntPtr)0xdeadbeef) && (b == (IntPtr)0xdeadbeef);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
namespace Harmony
{
// A test for https://github.com/dotnet/coreclr/blob/master/Documentation/botr/clr-abi.md
//
internal class NativeThisPointer
{
internal static bool NeedsNativeThisPointerFix(MethodBase method)
{
var returnType = AccessTools.GetReturnedType(method);
if (AccessTools.IsStruct(returnType) == false) return false;
var size = GetManagedSize(returnType);
if (size != 3 && size != 5 && size != 6 && size != 7 && size < 9) return false;
return HasNativeThis();
}
static bool hasTestResult, hasNativeThis;
static bool HasNativeThis()
{
if (hasTestResult == false)
{
hasNativeThis = false;
var self = new NativeThisPointer();
var original = AccessTools.DeclaredMethod(typeof(NativeThisPointer), "GetStruct");
var replacement = AccessTools.DeclaredMethod(typeof(NativeThisPointer), "GetStructReplacement");
Memory.DetourMethod(original, replacement);
new NativeThisPointer().GetStruct((IntPtr)0xdeadbeef, (IntPtr)0xdeadbeef);
hasTestResult = true;
}
return hasNativeThis;
}
struct SomeStruct
{
#pragma warning disable CS0169
readonly byte b1;
readonly byte b2;
readonly byte b3;
#pragma warning restore CS0169
}
[MethodImpl(MethodImplOptions.NoInlining)]
SomeStruct GetStruct(IntPtr x, IntPtr y)
{
throw new Exception("This method should've been detoured!");
}
static unsafe void GetStructReplacement(NativeThisPointer self, IntPtr ptr, IntPtr a, IntPtr b)
{
// Normal argument order:
// this, a, b
// If we have a native return buffer pointer, the order is:
// this, ptr, a, b
hasNativeThis = (a == (IntPtr)0xdeadbeef) && (b == (IntPtr)0xdeadbeef);
}
static readonly Dictionary<Type, int> _getManagedSizeCache = new Dictionary<Type, int>() { { typeof(void), 0 } };
static int GetManagedSize(Type t)
{
if (_getManagedSizeCache.TryGetValue(t, out var size))
return size;
// sizeof is more accurate for the "managed size" than Marshal.SizeOf (marshalled size)
// It also returns a value for types of which the size cannot be determined otherwise.
var method = new DynamicMethod("GetSize:" + t.FullName, typeof(int), Type.EmptyTypes, true);
var il = method.GetILGenerator();
il.Emit(OpCodes.Sizeof, t);
il.Emit(OpCodes.Ret);
lock (_getManagedSizeCache)
{
var d_GetSize = method.CreateDelegate(typeof(Func<int>)) as Func<int>;
return _getManagedSizeCache[t] = d_GetSize();
}
}
}
}
|
mit
|
C#
|
d1da5879b63e22c1133e5d11395a6295736b0cb6
|
Implement file export in data viewer
|
feliwir/openSage,feliwir/openSage
|
src/OpenSage.DataViewer/UI/FilesList.cs
|
src/OpenSage.DataViewer/UI/FilesList.cs
|
using System;
using System.IO;
using System.Linq;
using Eto.Forms;
using OpenSage.Data;
using OpenSage.DataViewer.Framework;
namespace OpenSage.DataViewer.UI
{
public sealed class FilesList : TableLayout
{
public event EventHandler<FileSystemEntryEventArgs> SelectedFileChanged;
private readonly SearchBox _searchBox;
private readonly ListBox _listBox;
private FileSystem _fileSystem;
public FilesList(MainForm mainForm)
{
_searchBox = new SearchBox();
_searchBox.PlaceholderText = "Search";
_searchBox.TextChanged += (sender, e) => RefreshItems();
Rows.Add(_searchBox);
_listBox = new ListBox();
_listBox.ItemTextBinding = Binding.Property((FileSystemEntry e) => e.FilePath);
_listBox.SelectedValueChanged += OnSelectedValueChanged;
_listBox.ContextMenu = new ContextMenu(new ButtonMenuItem(ExportSelectedItem)
{
Text = "Export..."
});
Rows.Add(_listBox);
mainForm.InstallationChanged += (sender, e) =>
{
_fileSystem = e.FileSystem;
RefreshItems();
};
}
private void ExportSelectedItem(object sender, EventArgs args)
{
var entry = (FileSystemEntry) _listBox.SelectedValue;
var saveDialog = new SaveFileDialog();
saveDialog.FileName = Path.GetFileName(entry.FilePath);
var extension = Path.GetExtension(entry.FilePath);
saveDialog.Filters.Add(new FileDialogFilter($"{extension} Files", extension));
saveDialog.Filters.Add(new FileDialogFilter("All Files", "*.*"));
var result = saveDialog.ShowDialog(this);
if (result != DialogResult.Ok)
{
return;
}
using (var entryStream = entry.Open())
{
using (var fileStream = File.OpenWrite(saveDialog.FileName))
{
entryStream.CopyTo(fileStream);
}
}
}
private void RefreshItems()
{
_listBox.DataStore = _fileSystem.Files
.Where(x => string.IsNullOrEmpty(_searchBox.Text) || x.FilePath.IndexOf(_searchBox.Text, StringComparison.OrdinalIgnoreCase) >= 0)
.OrderBy(x => x.FilePath)
.ToList();
}
private void OnSelectedValueChanged(object sender, EventArgs e)
{
SelectedFileChanged?.Invoke(this, new FileSystemEntryEventArgs((FileSystemEntry) _listBox.SelectedValue));
}
}
}
|
using System;
using System.Linq;
using Eto.Forms;
using OpenSage.Data;
using OpenSage.DataViewer.Framework;
namespace OpenSage.DataViewer.UI
{
public sealed class FilesList : TableLayout
{
public event EventHandler<FileSystemEntryEventArgs> SelectedFileChanged;
private readonly SearchBox _searchBox;
private readonly ListBox _listBox;
private FileSystem _fileSystem;
public FilesList(MainForm mainForm)
{
_searchBox = new SearchBox();
_searchBox.PlaceholderText = "Search";
_searchBox.TextChanged += (sender, e) => RefreshItems();
Rows.Add(_searchBox);
_listBox = new ListBox();
_listBox.ItemTextBinding = Binding.Property((FileSystemEntry e) => e.FilePath);
_listBox.SelectedValueChanged += OnSelectedValueChanged;
Rows.Add(_listBox);
mainForm.InstallationChanged += (sender, e) =>
{
_fileSystem = e.FileSystem;
RefreshItems();
};
}
private void RefreshItems()
{
_listBox.DataStore = _fileSystem.Files
.Where(x => string.IsNullOrEmpty(_searchBox.Text) || x.FilePath.IndexOf(_searchBox.Text, StringComparison.OrdinalIgnoreCase) >= 0)
.OrderBy(x => x.FilePath)
.ToList();
}
private void OnSelectedValueChanged(object sender, EventArgs e)
{
SelectedFileChanged?.Invoke(this, new FileSystemEntryEventArgs((FileSystemEntry) _listBox.SelectedValue));
}
}
}
|
mit
|
C#
|
1235bc8729b938911c0e78bbdf963fae6f39d85d
|
Clarify static initialization.
|
zaccharles/nodatime,malcolmr/nodatime,BenJenkinson/nodatime,zaccharles/nodatime,zaccharles/nodatime,malcolmr/nodatime,zaccharles/nodatime,jskeet/nodatime,zaccharles/nodatime,BenJenkinson/nodatime,nodatime/nodatime,jskeet/nodatime,malcolmr/nodatime,nodatime/nodatime,malcolmr/nodatime,zaccharles/nodatime
|
src/NodaTime/DateTimeZoneProviders.cs
|
src/NodaTime/DateTimeZoneProviders.cs
|
// Copyright 2012 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
using NodaTime.TimeZones;
namespace NodaTime
{
/// <summary>
/// Static access to date/time zone providers built into Noda Time. These are all thread-safe and caching.
/// </summary>
public static class DateTimeZoneProviders
{
/// <summary>
/// Gets a time zone provider which uses a <see cref="TzdbDateTimeZoneSource"/>.
/// The underlying source is <see cref="TzdbDateTimeZoneSource.Default"/>, which is initialized from
/// resources within the NodaTime assembly.
/// </summary>
public static IDateTimeZoneProvider Tzdb { get { return TzdbHolder.TzdbImpl; } }
// This class exists to force TZDB initialization to be lazy. We don't want using
// DateTimeZoneProviders.Bcl to force a read/parse.
private static class TzdbHolder
{
// See http://csharpindepth.com/Articles/General/BeforeFieldInit.aspx
static TzdbHolder() {}
internal static readonly DateTimeZoneCache TzdbImpl = new DateTimeZoneCache(TzdbDateTimeZoneSource.Default);
}
#if !PCL
/// <summary>
/// Gets the TZDB time zone provider.
/// This always returns the same value as the <see cref="Tzdb"/> property.
/// </summary>
/// <remarks>This method is not available in the PCL version, as it was made obsolete in Noda Time 1.1.</remarks>
/// <seealso cref="Tzdb"/>
[Obsolete("Use DateTimeZoneProviders.Tzdb instead")]
public static IDateTimeZoneProvider Default { get { return Tzdb; } }
private static readonly DateTimeZoneCache bclFactory = new DateTimeZoneCache(new BclDateTimeZoneSource());
/// <summary>
/// Gets a time zone provider which uses a <see cref="BclDateTimeZoneSource"/>.
/// This property is not available on the PCL build of Noda Time.
/// </summary>
public static IDateTimeZoneProvider Bcl { get { return bclFactory; } }
#endif
}
}
|
// Copyright 2012 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
using NodaTime.TimeZones;
namespace NodaTime
{
/// <summary>
/// Static access to date/time zone providers built into Noda Time. These are all thread-safe and caching.
/// </summary>
public static class DateTimeZoneProviders
{
/// <summary>
/// Gets a time zone provider which uses a <see cref="TzdbDateTimeZoneSource"/>.
/// The underlying source is <see cref="TzdbDateTimeZoneSource.Default"/>, which is initialized from
/// resources within the NodaTime assembly.
/// </summary>
public static IDateTimeZoneProvider Tzdb { get { return TzdbHolder.TzdbImpl; } }
// This class exists to force TZDB initialization to be lazy. We don't want using
// DateTimeZoneProviders.Bcl to
internal static class TzdbHolder
{
static TzdbHolder() {}
internal static readonly DateTimeZoneCache TzdbImpl = new DateTimeZoneCache(TzdbDateTimeZoneSource.Default);
}
#if !PCL
/// <summary>
/// Gets the TZDB time zone provider.
/// This always returns the same value as the <see cref="Tzdb"/> property.
/// </summary>
/// <remarks>This method is not available in the PCL version, as it was made obsolete in Noda Time 1.1.</remarks>
/// <seealso cref="Tzdb"/>
[Obsolete("Use DateTimeZoneProviders.Tzdb instead")]
public static IDateTimeZoneProvider Default { get { return Tzdb; } }
private static readonly DateTimeZoneCache bclFactory = new DateTimeZoneCache(new BclDateTimeZoneSource());
/// <summary>
/// Gets a time zone provider which uses a <see cref="BclDateTimeZoneSource"/>.
/// This property is not available on the PCL build of Noda Time.
/// </summary>
public static IDateTimeZoneProvider Bcl { get { return bclFactory; } }
#endif
}
}
|
apache-2.0
|
C#
|
d455029b61aaa9bae768e4cbbba38632b97fc8b4
|
Improve test / code coverage of System.ComponentModel
|
marksmeltzer/corefx,josguil/corefx,billwert/corefx,huanjie/corefx,mazong1123/corefx,BrennanConroy/corefx,rubo/corefx,andyhebear/corefx,jlin177/corefx,akivafr123/corefx,Jiayili1/corefx,jlin177/corefx,the-dwyer/corefx,alexandrnikitin/corefx,kkurni/corefx,Priya91/corefx-1,ptoonen/corefx,cartermp/corefx,chaitrakeshav/corefx,Petermarcu/corefx,claudelee/corefx,krytarowski/corefx,Chrisboh/corefx,gkhanna79/corefx,Chrisboh/corefx,dotnet-bot/corefx,Priya91/corefx-1,Yanjing123/corefx,nchikanov/corefx,janhenke/corefx,Ermiar/corefx,ravimeda/corefx,pallavit/corefx,fgreinacher/corefx,seanshpark/corefx,krytarowski/corefx,Priya91/corefx-1,weltkante/corefx,rjxby/corefx,stephenmichaelf/corefx,heXelium/corefx,s0ne0me/corefx,dtrebbien/corefx,n1ghtmare/corefx,dotnet-bot/corefx,billwert/corefx,khdang/corefx,stephenmichaelf/corefx,cydhaselton/corefx,JosephTremoulet/corefx,destinyclown/corefx,stephenmichaelf/corefx,manu-silicon/corefx,josguil/corefx,jhendrixMSFT/corefx,manu-silicon/corefx,krytarowski/corefx,krk/corefx,claudelee/corefx,SGuyGe/corefx,gabrielPeart/corefx,tijoytom/corefx,wtgodbe/corefx,Jiayili1/corefx,ravimeda/corefx,elijah6/corefx,benpye/corefx,andyhebear/corefx,zhangwenquan/corefx,gabrielPeart/corefx,mafiya69/corefx,PatrickMcDonald/corefx,dhoehna/corefx,vs-team/corefx,YoupHulsebos/corefx,janhenke/corefx,ellismg/corefx,kkurni/corefx,mmitche/corefx,matthubin/corefx,pallavit/corefx,jcme/corefx,nelsonsar/corefx,krk/corefx,dsplaisted/corefx,nbarbettini/corefx,ravimeda/corefx,gabrielPeart/corefx,adamralph/corefx,JosephTremoulet/corefx,kyulee1/corefx,jcme/corefx,adamralph/corefx,SGuyGe/corefx,benpye/corefx,mokchhya/corefx,destinyclown/corefx,ericstj/corefx,cydhaselton/corefx,Yanjing123/corefx,chenxizhang/corefx,pgavlin/corefx,Petermarcu/corefx,marksmeltzer/corefx,axelheer/corefx,mazong1123/corefx,akivafr123/corefx,billwert/corefx,dotnet-bot/corefx,shmao/corefx,kyulee1/corefx,jhendrixMSFT/corefx,viniciustaveira/corefx,shmao/corefx,mellinoe/corefx,jeremymeng/corefx,iamjasonp/corefx,nchikanov/corefx,lggomez/corefx,zhenlan/corefx,twsouthwick/corefx,alexperovich/corefx,mafiya69/corefx,JosephTremoulet/corefx,Ermiar/corefx,Alcaro/corefx,SGuyGe/corefx,manu-silicon/corefx,zhenlan/corefx,shrutigarg/corefx,richlander/corefx,huanjie/corefx,gkhanna79/corefx,alexandrnikitin/corefx,fernando-rodriguez/corefx,alphonsekurian/corefx,bitcrazed/corefx,CherryCxldn/corefx,parjong/corefx,rahku/corefx,alexperovich/corefx,fgreinacher/corefx,elijah6/corefx,nbarbettini/corefx,mmitche/corefx,zhenlan/corefx,iamjasonp/corefx,popolan1986/corefx,tstringer/corefx,alphonsekurian/corefx,Alcaro/corefx,Alcaro/corefx,twsouthwick/corefx,kkurni/corefx,zhangwenquan/corefx,misterzik/corefx,weltkante/corefx,shmao/corefx,Frank125/corefx,ellismg/corefx,CloudLens/corefx,wtgodbe/corefx,mellinoe/corefx,s0ne0me/corefx,the-dwyer/corefx,nbarbettini/corefx,fernando-rodriguez/corefx,vrassouli/corefx,andyhebear/corefx,Chrisboh/corefx,claudelee/corefx,dtrebbien/corefx,misterzik/corefx,billwert/corefx,vs-team/corefx,lggomez/corefx,shana/corefx,fgreinacher/corefx,twsouthwick/corefx,dkorolev/corefx,ViktorHofer/corefx,fgreinacher/corefx,ViktorHofer/corefx,benpye/corefx,weltkante/corefx,matthubin/corefx,mellinoe/corefx,nbarbettini/corefx,Winsto/corefx,vijaykota/corefx,scott156/corefx,axelheer/corefx,xuweixuwei/corefx,DnlHarvey/corefx,SGuyGe/corefx,weltkante/corefx,shahid-pk/corefx,shana/corefx,zhenlan/corefx,thiagodin/corefx,larsbj1988/corefx,elijah6/corefx,elijah6/corefx,Yanjing123/corefx,DnlHarvey/corefx,Priya91/corefx-1,stone-li/corefx,parjong/corefx,PatrickMcDonald/corefx,YoupHulsebos/corefx,manu-silicon/corefx,krk/corefx,mafiya69/corefx,benjamin-bader/corefx,parjong/corefx,zhangwenquan/corefx,oceanho/corefx,mmitche/corefx,DnlHarvey/corefx,Petermarcu/corefx,ellismg/corefx,heXelium/corefx,tijoytom/corefx,iamjasonp/corefx,mmitche/corefx,comdiv/corefx,Alcaro/corefx,mokchhya/corefx,oceanho/corefx,nchikanov/corefx,parjong/corefx,richlander/corefx,manu-silicon/corefx,scott156/corefx,rjxby/corefx,dtrebbien/corefx,shrutigarg/corefx,wtgodbe/corefx,lggomez/corefx,axelheer/corefx,popolan1986/corefx,ViktorHofer/corefx,ravimeda/corefx,ericstj/corefx,khdang/corefx,vidhya-bv/corefx-sorting,cartermp/corefx,comdiv/corefx,stone-li/corefx,krk/corefx,rjxby/corefx,elijah6/corefx,erpframework/corefx,dkorolev/corefx,pallavit/corefx,alexandrnikitin/corefx,benjamin-bader/corefx,cartermp/corefx,kkurni/corefx,Winsto/corefx,shimingsg/corefx,yizhang82/corefx,yizhang82/corefx,pgavlin/corefx,MaggieTsang/corefx,Jiayili1/corefx,shmao/corefx,ptoonen/corefx,Priya91/corefx-1,pgavlin/corefx,YoupHulsebos/corefx,ravimeda/corefx,rubo/corefx,shrutigarg/corefx,parjong/corefx,Winsto/corefx,lggomez/corefx,alphonsekurian/corefx,lydonchandra/corefx,cartermp/corefx,the-dwyer/corefx,iamjasonp/corefx,alphonsekurian/corefx,Ermiar/corefx,DnlHarvey/corefx,andyhebear/corefx,akivafr123/corefx,shimingsg/corefx,twsouthwick/corefx,shana/corefx,mazong1123/corefx,comdiv/corefx,VPashkov/corefx,n1ghtmare/corefx,jeremymeng/corefx,benjamin-bader/corefx,shiftkey-tester/corefx,josguil/corefx,spoiledsport/corefx,richlander/corefx,weltkante/corefx,gregg-miskelly/corefx,uhaciogullari/corefx,stone-li/corefx,iamjasonp/corefx,janhenke/corefx,seanshpark/corefx,krk/corefx,nelsonsar/corefx,stone-li/corefx,uhaciogullari/corefx,ellismg/corefx,spoiledsport/corefx,mmitche/corefx,lydonchandra/corefx,billwert/corefx,matthubin/corefx,MaggieTsang/corefx,bpschoch/corefx,690486439/corefx,EverlessDrop41/corefx,adamralph/corefx,Ermiar/corefx,zmaruo/corefx,destinyclown/corefx,dsplaisted/corefx,mafiya69/corefx,mafiya69/corefx,gkhanna79/corefx,nchikanov/corefx,mellinoe/corefx,shrutigarg/corefx,cartermp/corefx,dhoehna/corefx,zmaruo/corefx,ptoonen/corefx,shimingsg/corefx,690486439/corefx,alphonsekurian/corefx,parjong/corefx,rjxby/corefx,yizhang82/corefx,oceanho/corefx,ericstj/corefx,alphonsekurian/corefx,690486439/corefx,krytarowski/corefx,spoiledsport/corefx,dhoehna/corefx,scott156/corefx,ericstj/corefx,marksmeltzer/corefx,Jiayili1/corefx,KrisLee/corefx,billwert/corefx,axelheer/corefx,rahku/corefx,ptoonen/corefx,arronei/corefx,dotnet-bot/corefx,iamjasonp/corefx,mellinoe/corefx,marksmeltzer/corefx,vidhya-bv/corefx-sorting,cydhaselton/corefx,bitcrazed/corefx,claudelee/corefx,ViktorHofer/corefx,shimingsg/corefx,rajansingh10/corefx,oceanho/corefx,jhendrixMSFT/corefx,krk/corefx,viniciustaveira/corefx,ellismg/corefx,mokchhya/corefx,richlander/corefx,gkhanna79/corefx,khdang/corefx,bitcrazed/corefx,shana/corefx,krk/corefx,erpframework/corefx,the-dwyer/corefx,stormleoxia/corefx,Frank125/corefx,chenxizhang/corefx,cydhaselton/corefx,Yanjing123/corefx,YoupHulsebos/corefx,fffej/corefx,dotnet-bot/corefx,rjxby/corefx,ViktorHofer/corefx,kkurni/corefx,elijah6/corefx,MaggieTsang/corefx,benjamin-bader/corefx,jlin177/corefx,stone-li/corefx,gregg-miskelly/corefx,nelsonsar/corefx,chenkennt/corefx,larsbj1988/corefx,janhenke/corefx,690486439/corefx,CherryCxldn/corefx,wtgodbe/corefx,dsplaisted/corefx,MaggieTsang/corefx,690486439/corefx,benpye/corefx,alexperovich/corefx,chaitrakeshav/corefx,zmaruo/corefx,iamjasonp/corefx,heXelium/corefx,vs-team/corefx,CherryCxldn/corefx,ravimeda/corefx,marksmeltzer/corefx,brett25/corefx,vs-team/corefx,gabrielPeart/corefx,tijoytom/corefx,Petermarcu/corefx,lggomez/corefx,shmao/corefx,shiftkey-tester/corefx,chaitrakeshav/corefx,Chrisboh/corefx,dkorolev/corefx,chenkennt/corefx,the-dwyer/corefx,seanshpark/corefx,mokchhya/corefx,stephenmichaelf/corefx,nchikanov/corefx,zhenlan/corefx,huanjie/corefx,manu-silicon/corefx,jeremymeng/corefx,pgavlin/corefx,anjumrizwi/corefx,cydhaselton/corefx,matthubin/corefx,stone-li/corefx,krytarowski/corefx,wtgodbe/corefx,rajansingh10/corefx,mazong1123/corefx,shimingsg/corefx,mazong1123/corefx,jhendrixMSFT/corefx,mokchhya/corefx,vrassouli/corefx,alphonsekurian/corefx,richlander/corefx,seanshpark/corefx,vrassouli/corefx,cnbin/corefx,SGuyGe/corefx,seanshpark/corefx,Jiayili1/corefx,n1ghtmare/corefx,n1ghtmare/corefx,gregg-miskelly/corefx,cydhaselton/corefx,ravimeda/corefx,bpschoch/corefx,yizhang82/corefx,wtgodbe/corefx,Petermarcu/corefx,khdang/corefx,CloudLens/corefx,YoupHulsebos/corefx,ellismg/corefx,pallavit/corefx,s0ne0me/corefx,twsouthwick/corefx,Frank125/corefx,kyulee1/corefx,gkhanna79/corefx,JosephTremoulet/corefx,EverlessDrop41/corefx,lggomez/corefx,twsouthwick/corefx,vijaykota/corefx,MaggieTsang/corefx,tijoytom/corefx,rahku/corefx,brett25/corefx,stephenmichaelf/corefx,EverlessDrop41/corefx,VPashkov/corefx,CloudLens/corefx,jmhardison/corefx,Ermiar/corefx,MaggieTsang/corefx,mmitche/corefx,larsbj1988/corefx,rahku/corefx,Jiayili1/corefx,KrisLee/corefx,CherryCxldn/corefx,chenkennt/corefx,benjamin-bader/corefx,Chrisboh/corefx,huanjie/corefx,stephenmichaelf/corefx,anjumrizwi/corefx,stephenmichaelf/corefx,seanshpark/corefx,nbarbettini/corefx,vijaykota/corefx,shmao/corefx,KrisLee/corefx,janhenke/corefx,jcme/corefx,jlin177/corefx,alexperovich/corefx,tstringer/corefx,VPashkov/corefx,dhoehna/corefx,benjamin-bader/corefx,stormleoxia/corefx,fffej/corefx,stone-li/corefx,PatrickMcDonald/corefx,mmitche/corefx,tstringer/corefx,larsbj1988/corefx,jhendrixMSFT/corefx,misterzik/corefx,wtgodbe/corefx,josguil/corefx,rahku/corefx,shiftkey-tester/corefx,pallavit/corefx,alexperovich/corefx,Ermiar/corefx,nelsonsar/corefx,YoupHulsebos/corefx,tijoytom/corefx,JosephTremoulet/corefx,scott156/corefx,fernando-rodriguez/corefx,ptoonen/corefx,krytarowski/corefx,akivafr123/corefx,vidhya-bv/corefx-sorting,cartermp/corefx,rjxby/corefx,JosephTremoulet/corefx,PatrickMcDonald/corefx,tijoytom/corefx,jlin177/corefx,krytarowski/corefx,Frank125/corefx,jmhardison/corefx,rajansingh10/corefx,popolan1986/corefx,marksmeltzer/corefx,Yanjing123/corefx,dhoehna/corefx,weltkante/corefx,jhendrixMSFT/corefx,janhenke/corefx,jmhardison/corefx,gkhanna79/corefx,shimingsg/corefx,rubo/corefx,thiagodin/corefx,alexandrnikitin/corefx,arronei/corefx,xuweixuwei/corefx,Petermarcu/corefx,shahid-pk/corefx,josguil/corefx,khdang/corefx,mellinoe/corefx,akivafr123/corefx,YoupHulsebos/corefx,lydonchandra/corefx,Petermarcu/corefx,rajansingh10/corefx,BrennanConroy/corefx,Jiayili1/corefx,bpschoch/corefx,seanshpark/corefx,shiftkey-tester/corefx,jlin177/corefx,chaitrakeshav/corefx,cnbin/corefx,zhenlan/corefx,gkhanna79/corefx,richlander/corefx,CloudLens/corefx,cnbin/corefx,lydonchandra/corefx,MaggieTsang/corefx,Chrisboh/corefx,bitcrazed/corefx,jeremymeng/corefx,dhoehna/corefx,elijah6/corefx,tijoytom/corefx,yizhang82/corefx,vidhya-bv/corefx-sorting,jmhardison/corefx,zhenlan/corefx,uhaciogullari/corefx,the-dwyer/corefx,erpframework/corefx,lggomez/corefx,gregg-miskelly/corefx,SGuyGe/corefx,rahku/corefx,dotnet-bot/corefx,shahid-pk/corefx,josguil/corefx,ericstj/corefx,comdiv/corefx,yizhang82/corefx,ericstj/corefx,mokchhya/corefx,yizhang82/corefx,n1ghtmare/corefx,fffej/corefx,twsouthwick/corefx,shahid-pk/corefx,nchikanov/corefx,rahku/corefx,DnlHarvey/corefx,parjong/corefx,the-dwyer/corefx,shahid-pk/corefx,kyulee1/corefx,chenxizhang/corefx,jeremymeng/corefx,marksmeltzer/corefx,thiagodin/corefx,thiagodin/corefx,dtrebbien/corefx,uhaciogullari/corefx,alexandrnikitin/corefx,jcme/corefx,stormleoxia/corefx,stormleoxia/corefx,jlin177/corefx,shmao/corefx,tstringer/corefx,rjxby/corefx,dhoehna/corefx,bpschoch/corefx,cnbin/corefx,s0ne0me/corefx,zmaruo/corefx,jcme/corefx,nbarbettini/corefx,alexperovich/corefx,mazong1123/corefx,rubo/corefx,cydhaselton/corefx,tstringer/corefx,ptoonen/corefx,benpye/corefx,vidhya-bv/corefx-sorting,dkorolev/corefx,arronei/corefx,fffej/corefx,VPashkov/corefx,kkurni/corefx,BrennanConroy/corefx,mafiya69/corefx,billwert/corefx,weltkante/corefx,dotnet-bot/corefx,jhendrixMSFT/corefx,shahid-pk/corefx,PatrickMcDonald/corefx,xuweixuwei/corefx,viniciustaveira/corefx,anjumrizwi/corefx,nchikanov/corefx,axelheer/corefx,tstringer/corefx,anjumrizwi/corefx,DnlHarvey/corefx,ViktorHofer/corefx,viniciustaveira/corefx,rubo/corefx,Priya91/corefx-1,manu-silicon/corefx,pallavit/corefx,richlander/corefx,heXelium/corefx,vrassouli/corefx,zhangwenquan/corefx,JosephTremoulet/corefx,jcme/corefx,axelheer/corefx,benpye/corefx,mazong1123/corefx,DnlHarvey/corefx,nbarbettini/corefx,ericstj/corefx,ptoonen/corefx,bitcrazed/corefx,erpframework/corefx,brett25/corefx,brett25/corefx,khdang/corefx,alexperovich/corefx,ViktorHofer/corefx,KrisLee/corefx,shimingsg/corefx,Ermiar/corefx
|
src/System.ComponentModel/tests/ComponentModelBasicTests.cs
|
src/System.ComponentModel/tests/ComponentModelBasicTests.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.ComponentModel;
using Xunit;
namespace Test
{
public class ComponentModelTests
{
[Fact]
public static void TestComponentModelBasic()
{
// dummy tests to make sure the System.ComponentModel library loaded successfully
#pragma warning disable 0219
IRevertibleChangeTracking iRevertibleChangeTracking = null;
IChangeTracking iChangeTracking = iRevertibleChangeTracking;
Assert.Null(iChangeTracking);
IEditableObject iEditableObject = null;
CancelEventArgs cancelEventArgs = new CancelEventArgs();
Assert.NotNull(cancelEventArgs);
IServiceProvider iServiceProvider = null;
Assert.Null(iServiceProvider);
#pragma warning restore 0219
}
[Fact]
public static void TestCancelEventArgs()
{
// Verify the ctor parameter is passed through to Cancel
Assert.False(new CancelEventArgs().Cancel);
Assert.False(new CancelEventArgs(false).Cancel);
Assert.True(new CancelEventArgs(true).Cancel);
// Verify updates to Cancel stick
var ce = new CancelEventArgs();
for (int i = 0; i < 2; i++)
{
ce.Cancel = false;
Assert.False(ce.Cancel);
ce.Cancel = true;
Assert.True(ce.Cancel);
}
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.ComponentModel;
using Xunit;
namespace Test
{
public class ComponentModelTests
{
[Fact]
public static void TestComponentModelBasic()
{
// dummy tests to make sure the System.ComponentModel library loaded successfully
#pragma warning disable 0219
IRevertibleChangeTracking iRevertibleChangeTracking = null;
IChangeTracking iChangeTracking = iRevertibleChangeTracking;
Assert.Null(iChangeTracking);
IEditableObject iEditableObject = null;
CancelEventArgs cancelEventArgs = new CancelEventArgs();
Assert.NotNull(cancelEventArgs);
IServiceProvider iServiceProvider = null;
Assert.Null(iServiceProvider);
#pragma warning restore 0219
}
}
}
|
mit
|
C#
|
b056af4bc5fc16c7f8a39e8d17ef78a5866fd22a
|
bump version
|
distantcam/Anotar,Fody/Anotar,mstyura/Anotar,modulexcite/Anotar
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyTitle("Anotar")]
[assembly: AssemblyProduct("Anotar")]
[assembly: AssemblyVersion("2.5.0")]
[assembly: AssemblyFileVersion("2.5.0")]
|
using System.Reflection;
[assembly: AssemblyTitle("Anotar")]
[assembly: AssemblyProduct("Anotar")]
[assembly: AssemblyVersion("2.4.0")]
[assembly: AssemblyFileVersion("2.4.0")]
|
mit
|
C#
|
ec07bf589f653432f9b0b2e0387464f5bb14e9c8
|
Move namespace Microsoft.AspNetCore.Routing -> Microsoft.AspNetCore.Builder
|
neuecc/MagicOnion
|
src/MagicOnion.Server/Extensions/MagicOnionEndpointRouteBuilderExtensions.cs
|
src/MagicOnion.Server/Extensions/MagicOnionEndpointRouteBuilderExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using MagicOnion.Server.Glue;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Builder
{
public static class MagicOnionEndpointRouteBuilderExtensions
{
public static GrpcServiceEndpointConventionBuilder MapMagicOnionService(this IEndpointRouteBuilder builder)
{
var descriptor = builder.ServiceProvider.GetRequiredService<MagicOnionServiceDefinitionGlueDescriptor>();
// builder.MapGrpcService<GlueServiceType>();
var mapGrpcServiceMethod = typeof(GrpcEndpointRouteBuilderExtensions)
.GetMethod(nameof(GrpcEndpointRouteBuilderExtensions.MapGrpcService), BindingFlags.Static | BindingFlags.Public)!
.MakeGenericMethod(descriptor.GlueServiceType);
return (GrpcServiceEndpointConventionBuilder)mapGrpcServiceMethod.Invoke(null, new[] { builder })!;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using MagicOnion.Server.Glue;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Routing
{
public static class MagicOnionEndpointRouteBuilderExtensions
{
public static GrpcServiceEndpointConventionBuilder MapMagicOnionService(this IEndpointRouteBuilder builder)
{
var descriptor = builder.ServiceProvider.GetRequiredService<MagicOnionServiceDefinitionGlueDescriptor>();
// builder.MapGrpcService<GlueServiceType>();
var mapGrpcServiceMethod = typeof(GrpcEndpointRouteBuilderExtensions)
.GetMethod(nameof(GrpcEndpointRouteBuilderExtensions.MapGrpcService), BindingFlags.Static | BindingFlags.Public)!
.MakeGenericMethod(descriptor.GlueServiceType);
return (GrpcServiceEndpointConventionBuilder)mapGrpcServiceMethod.Invoke(null, new[] { builder })!;
}
}
}
|
mit
|
C#
|
c28bbb69d2c70ac4a070596ccaa3b9009b6f8532
|
allow BANSHEE_DISABLE_GRID on AlbumListView
|
stsundermann/banshee,Carbenium/banshee,ixfalia/banshee,arfbtwn/banshee,lamalex/Banshee,mono-soc-2011/banshee,directhex/banshee-hacks,Carbenium/banshee,dufoli/banshee,dufoli/banshee,stsundermann/banshee,lamalex/Banshee,GNOME/banshee,Dynalon/banshee-osx,petejohanson/banshee,Dynalon/banshee-osx,mono-soc-2011/banshee,babycaseny/banshee,petejohanson/banshee,Carbenium/banshee,petejohanson/banshee,babycaseny/banshee,stsundermann/banshee,allquixotic/banshee-gst-sharp-work,Dynalon/banshee-osx,stsundermann/banshee,allquixotic/banshee-gst-sharp-work,allquixotic/banshee-gst-sharp-work,GNOME/banshee,GNOME/banshee,babycaseny/banshee,babycaseny/banshee,Dynalon/banshee-osx,ixfalia/banshee,babycaseny/banshee,petejohanson/banshee,Dynalon/banshee-osx,mono-soc-2011/banshee,ixfalia/banshee,directhex/banshee-hacks,GNOME/banshee,arfbtwn/banshee,mono-soc-2011/banshee,arfbtwn/banshee,arfbtwn/banshee,GNOME/banshee,dufoli/banshee,dufoli/banshee,dufoli/banshee,stsundermann/banshee,lamalex/Banshee,stsundermann/banshee,directhex/banshee-hacks,directhex/banshee-hacks,mono-soc-2011/banshee,petejohanson/banshee,allquixotic/banshee-gst-sharp-work,GNOME/banshee,ixfalia/banshee,ixfalia/banshee,lamalex/Banshee,petejohanson/banshee,arfbtwn/banshee,ixfalia/banshee,stsundermann/banshee,mono-soc-2011/banshee,Dynalon/banshee-osx,lamalex/Banshee,Carbenium/banshee,directhex/banshee-hacks,lamalex/Banshee,arfbtwn/banshee,GNOME/banshee,GNOME/banshee,babycaseny/banshee,dufoli/banshee,ixfalia/banshee,ixfalia/banshee,Carbenium/banshee,Dynalon/banshee-osx,allquixotic/banshee-gst-sharp-work,directhex/banshee-hacks,Dynalon/banshee-osx,arfbtwn/banshee,Carbenium/banshee,arfbtwn/banshee,mono-soc-2011/banshee,stsundermann/banshee,dufoli/banshee,babycaseny/banshee,dufoli/banshee,babycaseny/banshee,allquixotic/banshee-gst-sharp-work
|
src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs
|
src/Core/Banshee.ThickClient/Banshee.Collection.Gui/AlbumListView.cs
|
//
// AlbumListView.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright (C) 2007 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Hyena.Data;
using Hyena.Data.Gui;
using Banshee.Collection;
using Banshee.ServiceStack;
using Banshee.MediaEngine;
using Banshee.Gui;
namespace Banshee.Collection.Gui
{
public class AlbumListView : TrackFilterListView<AlbumInfo>
{
private ColumnCellAlbum renderer;
public AlbumListView () : base ()
{
if (!String.IsNullOrEmpty (Environment.GetEnvironmentVariable ("BANSHEE_DISABLE_GRID"))) {
column_controller.Add (new Column ("Album", renderer = new ColumnCellAlbum (), 1.0));
ColumnController = column_controller;
} else {
ViewLayout = new DataViewLayoutGrid () {
ChildAllocator = () => new DataViewChildAlbum (),
View = this
};
}
ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.TrackInfoUpdated);
}
protected override Gdk.Size OnMeasureChild ()
{
return ViewLayout != null
? base.OnMeasureChild ()
: new Gdk.Size (0, renderer.ComputeRowHeight (this));
}
private void OnPlayerEvent (PlayerEventArgs args)
{
// TODO: a) Figure out if the track that changed is actually in view
// b) xfade the artwork if it is, that'd be slick
QueueDraw ();
}
}
}
|
//
// AlbumListView.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright (C) 2007 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Hyena.Data;
using Hyena.Data.Gui;
using Banshee.Collection;
using Banshee.ServiceStack;
using Banshee.MediaEngine;
using Banshee.Gui;
namespace Banshee.Collection.Gui
{
public class AlbumListView : TrackFilterListView<AlbumInfo>
{
public AlbumListView () : base ()
{
ViewLayout = new DataViewLayoutGrid () {
ChildAllocator = () => new DataViewChildAlbum (),
View = this
};
ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.TrackInfoUpdated);
}
private void OnPlayerEvent (PlayerEventArgs args)
{
// TODO: a) Figure out if the track that changed is actually in view
// b) xfade the artwork if it is, that'd be slick
QueueDraw ();
}
}
}
|
mit
|
C#
|
73415e5c9b12dd80879f0d19be18d218d153f126
|
add bool HasOption(string expected) to IAmSelectionInput
|
mvbalaw/FluentBrowserAutomation
|
src/FluentBrowserAutomation/Controls/Properties/IAmSelectionInput.cs
|
src/FluentBrowserAutomation/Controls/Properties/IAmSelectionInput.cs
|
// ReSharper disable once CheckNamespace
namespace FluentBrowserAutomation
{
public interface IAmSelectionInput
{
bool HasOption(string expected);
void Select(string text);
}
}
|
//// ReSharper disable CheckNamespace
// ReSharper disable CheckNamespace
namespace FluentBrowserAutomation
// ReSharper restore CheckNamespace
//// ReSharper restore CheckNamespace
{
public interface IAmSelectionInput
{
void Select(string text);
}
}
|
mit
|
C#
|
6e46ad3ece02cfcf548e3c9f2612c0452cc32f9c
|
update instructions instructions
|
greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d
|
Assets/HappyFunTimes/Scripts/Editor/HFTInstructionsEditor.cs
|
Assets/HappyFunTimes/Scripts/Editor/HFTInstructionsEditor.cs
|
using UnityEditor;
using UnityEngine;
using System.Collections;
[CustomEditor(typeof(HappyFunTimes.HFTInstructions))]
[CanEditMultipleObjects]
public class HFTInstructionsEditor : Editor {
public override void OnInspectorGUI() {
string help =
@"You can set these from the command line with
--instructions=""your instructions""
and
--bottom
Leave 'show' unchecked except for testing.
(WIFI) will be automatically changed to the local Wifi name";
EditorGUILayout.HelpBox(help, MessageType.Info);
GUILayout.Space(5);
DrawDefaultInspector();
}
}
|
using UnityEditor;
using UnityEngine;
using System.Collections;
[CustomEditor(typeof(HappyFunTimes.HFTInstructions))]
[CanEditMultipleObjects]
public class HFTInstructionsEditor : Editor {
public override void OnInspectorGUI() {
string help =
@"You can set these from the command line with
--instructions=""your instructions""
and
--bottom
Leave 'show' unchecked except for testing.";
EditorGUILayout.HelpBox(help, MessageType.Info);
GUILayout.Space(5);
DrawDefaultInspector();
}
}
|
bsd-3-clause
|
C#
|
d2e5dbc97bcf53ddc08be6c4ce1495077f4baa3f
|
fix to missing stream extension
|
hungweng/MarkerMetro.Unity.WinLegacy,MarkerMetro/MarkerMetro.Unity.WinLegacy
|
MarkerMetro.Unity.WinLegacyUnity/System/MissingExtensions.cs
|
MarkerMetro.Unity.WinLegacyUnity/System/MissingExtensions.cs
|
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Reflection;
using System;
using System.Runtime.InteropServices;
namespace MarkerMetro.Unity.WinLegacy
{
/**
* Helpers for missing functions of classes, turned into extensions instead...
*/
public static class MissingExtensions
{
/**
* Helping Metro convert from System.Format(string,Object) to Windows App Store's System.Format(string,Object[]).
*/
public static string Format(string format, global::System.Object oneParam)
{
return global::System.String.Format(format, new global::System.Object[] { oneParam });
}
/**
* StringBuilder.AppendFormat(arg0,arg1,arg2) isn't implemented on WP8, so use this instead.
*/
public static StringBuilder AppendFormatEx(this StringBuilder sb, string format, global::System.Object arg0, global::System.Object arg1 = null, global::System.Object arg2 = null)
{
return sb.AppendFormat(format, new object[] { arg0, arg1, arg2 });
}
/**
* List<T>.ForEach(Action<T>) isn't implemented on WSA, so use this instead.
*/
public static void ForEach<T>(this List<T> list, Action<T> action)
{
if (action == null)
throw new ArgumentNullException();
foreach (T obj in list)
action(obj);
}
public static string ToShortDateString(this DateTime dateTime)
{
return dateTime.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern);
}
public static string ToLongDateString(this DateTime dateTime)
{
return dateTime.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.LongDatePattern);
}
public static void Close(this System.IO.Stream stream)
{
#if (NETFX_CORE || WINDOWS_PHONE)
stream.Dispose();
#else
throw new PlatformNotSupportedException("stream.Close()");
#endif
}
}
}
|
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Reflection;
using System;
using System.Runtime.InteropServices;
namespace MarkerMetro.Unity.WinLegacy
{
/**
* Helpers for missing functions of classes, turned into extensions instead...
*/
public static class MissingExtensions
{
/**
* Helping Metro convert from System.Format(string,Object) to Windows App Store's System.Format(string,Object[]).
*/
public static string Format(string format, global::System.Object oneParam)
{
return global::System.String.Format(format, new global::System.Object[] { oneParam });
}
/**
* StringBuilder.AppendFormat(arg0,arg1,arg2) isn't implemented on WP8, so use this instead.
*/
public static StringBuilder AppendFormatEx(this StringBuilder sb, string format, global::System.Object arg0, global::System.Object arg1 = null, global::System.Object arg2 = null)
{
return sb.AppendFormat(format, new object[] { arg0, arg1, arg2 });
}
/**
* List<T>.ForEach(Action<T>) isn't implemented on WSA, so use this instead.
*/
public static void ForEach<T>(this List<T> list, Action<T> action)
{
if (action == null)
throw new ArgumentNullException();
foreach (T obj in list)
action(obj);
}
public static string ToShortDateString(this DateTime dateTime)
{
return dateTime.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern);
}
public static string ToLongDateString(this DateTime dateTime)
{
return dateTime.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.LongDatePattern);
}
#if (NETFX_CORE || WINDOWS_PHONE)
public static void Close(this System.IO.Stream stream)
{
stream.Dispose();
}
#endif
}
}
|
mit
|
C#
|
d9d1f3e68438d60444bdf030292e1e10a1d0f937
|
Update DistributedCacheDecoratorOptions.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/Cache/Distributed/DistributedCacheDecoratorOptions.cs
|
TIKSN.Core/Data/Cache/Distributed/DistributedCacheDecoratorOptions.cs
|
using System;
namespace TIKSN.Data.Cache.Distributed
{
public class DistributedCacheDecoratorOptions
{
public DateTimeOffset? AbsoluteExpiration { get; set; }
public TimeSpan? AbsoluteExpirationRelativeToNow { get; set; }
public TimeSpan? SlidingExpiration { get; set; }
}
public class DistributedCacheDecoratorOptions<T> : DistributedCacheDecoratorOptions
{
}
}
|
using System;
namespace TIKSN.Data.Cache.Distributed
{
public class DistributedCacheDecoratorOptions
{
public DateTimeOffset? AbsoluteExpiration { get; set; }
public TimeSpan? AbsoluteExpirationRelativeToNow { get; set; }
public TimeSpan? SlidingExpiration { get; set; }
}
public class DistributedCacheDecoratorOptions<T> : DistributedCacheDecoratorOptions
{
}
}
|
mit
|
C#
|
068657d2a6dfeab26085c063233ba98f639cb2d9
|
Make StorageKey.CreateSearchPrefix public (#1824)
|
AntShares/AntShares
|
src/neo/Ledger/StorageKey.cs
|
src/neo/Ledger/StorageKey.cs
|
using Neo.Cryptography;
using Neo.IO;
using System;
using System.Buffers.Binary;
using System.IO;
namespace Neo.Ledger
{
public class StorageKey : IEquatable<StorageKey>, ISerializable
{
public int Id;
public byte[] Key;
int ISerializable.Size => sizeof(int) + Key.Length;
public static byte[] CreateSearchPrefix(int id, ReadOnlySpan<byte> prefix)
{
byte[] buffer = new byte[sizeof(int) + prefix.Length];
BinaryPrimitives.WriteInt32LittleEndian(buffer, id);
prefix.CopyTo(buffer.AsSpan(sizeof(int)));
return buffer;
}
//If the base stream of the reader doesn't support seeking, a NotSupportedException is thrown.
//But StorageKey never works with NetworkStream, so it doesn't matter.
void ISerializable.Deserialize(BinaryReader reader)
{
Id = reader.ReadInt32();
Key = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position));
}
public bool Equals(StorageKey other)
{
if (other is null)
return false;
if (ReferenceEquals(this, other))
return true;
return Id == other.Id && MemoryExtensions.SequenceEqual<byte>(Key, other.Key);
}
public override bool Equals(object obj)
{
if (!(obj is StorageKey other)) return false;
return Equals(other);
}
public override int GetHashCode()
{
return Id.GetHashCode() + (int)Key.Murmur32(0);
}
void ISerializable.Serialize(BinaryWriter writer)
{
writer.Write(Id);
writer.Write(Key);
}
}
}
|
using Neo.Cryptography;
using Neo.IO;
using System;
using System.Buffers.Binary;
using System.IO;
namespace Neo.Ledger
{
public class StorageKey : IEquatable<StorageKey>, ISerializable
{
public int Id;
public byte[] Key;
int ISerializable.Size => sizeof(int) + Key.Length;
internal static byte[] CreateSearchPrefix(int id, ReadOnlySpan<byte> prefix)
{
byte[] buffer = new byte[sizeof(int) + prefix.Length];
BinaryPrimitives.WriteInt32LittleEndian(buffer, id);
prefix.CopyTo(buffer.AsSpan(sizeof(int)));
return buffer;
}
//If the base stream of the reader doesn't support seeking, a NotSupportedException is thrown.
//But StorageKey never works with NetworkStream, so it doesn't matter.
void ISerializable.Deserialize(BinaryReader reader)
{
Id = reader.ReadInt32();
Key = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position));
}
public bool Equals(StorageKey other)
{
if (other is null)
return false;
if (ReferenceEquals(this, other))
return true;
return Id == other.Id && MemoryExtensions.SequenceEqual<byte>(Key, other.Key);
}
public override bool Equals(object obj)
{
if (!(obj is StorageKey other)) return false;
return Equals(other);
}
public override int GetHashCode()
{
return Id.GetHashCode() + (int)Key.Murmur32(0);
}
void ISerializable.Serialize(BinaryWriter writer)
{
writer.Write(Id);
writer.Write(Key);
}
}
}
|
mit
|
C#
|
062d755d8ab92064cf22daea6cd5ef487c447d42
|
Fix iOS nullref on orientation change
|
EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework
|
osu.Framework.iOS/GameViewController.cs
|
osu.Framework.iOS/GameViewController.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using CoreGraphics;
using osu.Framework.Platform;
using UIKit;
namespace osu.Framework.iOS
{
internal class GameViewController : UIViewController
{
private readonly IOSGameView gameView;
private readonly GameHost gameHost;
public override bool PrefersStatusBarHidden() => true;
public override UIRectEdge PreferredScreenEdgesDeferringSystemGestures => UIRectEdge.All;
public GameViewController(IOSGameView view, GameHost host)
{
View = view;
gameView = view;
gameHost = host;
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
gameHost.Collect();
}
public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
{
coordinator.AnimateAlongsideTransition(_ => { }, _ => UIView.AnimationsEnabled = true);
UIView.AnimationsEnabled = false;
base.ViewWillTransitionToSize(toSize, coordinator);
gameView.RequestResizeFrameBuffer();
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using CoreGraphics;
using osu.Framework.Platform;
using UIKit;
namespace osu.Framework.iOS
{
internal class GameViewController : UIViewController
{
private readonly IOSGameView view;
private readonly GameHost host;
public override bool PrefersStatusBarHidden() => true;
public override UIRectEdge PreferredScreenEdgesDeferringSystemGestures => UIRectEdge.All;
public GameViewController(IOSGameView view, GameHost host)
{
View = view;
this.host = host;
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
host.Collect();
}
public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
{
coordinator.AnimateAlongsideTransition(_ => { }, _ => UIView.AnimationsEnabled = true);
UIView.AnimationsEnabled = false;
base.ViewWillTransitionToSize(toSize, coordinator);
view.RequestResizeFrameBuffer();
}
}
}
|
mit
|
C#
|
2b353ca2c56dd586ad2a0fcf1c1a9aa22fe3c9e9
|
Remove unused Interface ICCProjection. Developers can use Custom Event for Projection Changed to create their custom projections.
|
haithemaraissia/CocosSharp,netonjm/CocosSharp,hig-ag/CocosSharp,zmaruo/CocosSharp,TukekeSoft/CocosSharp,hig-ag/CocosSharp,mono/CocosSharp,TukekeSoft/CocosSharp,MSylvia/CocosSharp,mono/CocosSharp,netonjm/CocosSharp,haithemaraissia/CocosSharp,MSylvia/CocosSharp,zmaruo/CocosSharp
|
src/predefine/CCProtocols.cs
|
src/predefine/CCProtocols.cs
|
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
using System;
namespace CocosSharp
{
/// <summary>
/// You can specify the blending fuction.
/// @since v0.99.0
/// </summary>
public interface ICCBlendable
{
/// <summary>
/// gets or sets the source blending function for the texture
/// </summary>
CCBlendFunc BlendFunc { get; set; }
}
/// <summary>
/// CCNode objects that uses a Texture2D to render the images.
/// </summary>
/// <remarks>
/// The texture can have a blending function.
/// If the texture has alpha premultiplied the default blending function is:
/// src=GL_ONE dst= GL_ONE_MINUS_SRC_ALPHA
/// else
/// src=GL_SRC_ALPHA dst= GL_ONE_MINUS_SRC_ALPHA
/// But you can change the blending funtion at any time.
/// @since v0.8.0
/// </remarks>
public interface ICCTexture : ICCBlendable
{
/// <summary>
/// gets or sets a new texture. it will be retained
/// </summary>
CCTexture2D Texture { get; set; }
}
/// <summary>
/// gets or sets a new Label string.
/// </summary>
public interface ICCTextContainer
{
string Text { get; set; }
}
}
|
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
using System;
namespace CocosSharp
{
/// <summary>
/// You can specify the blending fuction.
/// @since v0.99.0
/// </summary>
public interface ICCBlendable
{
/// <summary>
/// gets or sets the source blending function for the texture
/// </summary>
CCBlendFunc BlendFunc { get; set; }
}
/// <summary>
/// CCNode objects that uses a Texture2D to render the images.
/// </summary>
/// <remarks>
/// The texture can have a blending function.
/// If the texture has alpha premultiplied the default blending function is:
/// src=GL_ONE dst= GL_ONE_MINUS_SRC_ALPHA
/// else
/// src=GL_SRC_ALPHA dst= GL_ONE_MINUS_SRC_ALPHA
/// But you can change the blending funtion at any time.
/// @since v0.8.0
/// </remarks>
public interface ICCTexture : ICCBlendable
{
/// <summary>
/// gets or sets a new texture. it will be retained
/// </summary>
CCTexture2D Texture { get; set; }
}
/// <summary>
/// gets or sets a new Label string.
/// </summary>
public interface ICCTextContainer
{
string Text { get; set; }
}
/// <summary>
/// OpenGL projection protocol
/// </summary>
public interface ICCProjection
{
/// <summary>
/// Called by CCDirector when the porjection is updated, and "custom" projection is used
/// @since v0.99.5
/// </summary>
void UpdateProjection();
}
}
|
mit
|
C#
|
e6f5a314d8afe76ca435a5073d2cccd55f59d636
|
Add null pointer handling to GetState in case _centralManager is null (#411)
|
xabre/xamarin-bluetooth-le,fozzzgate/xamarin-bluetooth-le
|
Source/Plugin.BLE.iOS/BleImplementation.cs
|
Source/Plugin.BLE.iOS/BleImplementation.cs
|
using CoreBluetooth;
using CoreFoundation;
using Plugin.BLE.Abstractions;
using Plugin.BLE.Abstractions.Contracts;
using Plugin.BLE.Extensions;
using Plugin.BLE.iOS;
namespace Plugin.BLE
{
public class BleImplementation : BleImplementationBase
{
private static string _restorationIdentifier;
private static bool _showPowerAlert = true;
private CBCentralManager _centralManager;
private IBleCentralManagerDelegate _bleCentralManagerDelegate;
public static void UseRestorationIdentifier(string restorationIdentifier)
{
_restorationIdentifier = restorationIdentifier;
}
public static void ShowPowerAlert(bool showPowerAlert)
{
_showPowerAlert = showPowerAlert;
}
protected override void InitializeNative()
{
var cmDelegate = new BleCentralManagerDelegate();
_bleCentralManagerDelegate = cmDelegate;
var options = CreateInitOptions();
_centralManager = new CBCentralManager(cmDelegate, DispatchQueue.CurrentQueue, options);
_bleCentralManagerDelegate.UpdatedState += (s, e) => State = GetState();
}
protected override BluetoothState GetInitialStateNative()
{
return GetState();
}
protected override IAdapter CreateNativeAdapter()
{
return new Adapter(_centralManager, _bleCentralManagerDelegate);
}
private BluetoothState GetState()
{
return _centralManager?.State.ToBluetoothState() ?? BluetoothState.Unavailable;
}
private CBCentralInitOptions CreateInitOptions()
{
return new CBCentralInitOptions
{
#if __IOS__
RestoreIdentifier = _restorationIdentifier,
#endif
ShowPowerAlert = _showPowerAlert
};
}
}
}
|
using CoreBluetooth;
using CoreFoundation;
using Plugin.BLE.Abstractions;
using Plugin.BLE.Abstractions.Contracts;
using Plugin.BLE.Extensions;
using Plugin.BLE.iOS;
namespace Plugin.BLE
{
public class BleImplementation : BleImplementationBase
{
private static string _restorationIdentifier;
private static bool _showPowerAlert = true;
private CBCentralManager _centralManager;
private IBleCentralManagerDelegate _bleCentralManagerDelegate;
public static void UseRestorationIdentifier(string restorationIdentifier)
{
_restorationIdentifier = restorationIdentifier;
}
public static void ShowPowerAlert(bool showPowerAlert)
{
_showPowerAlert = showPowerAlert;
}
protected override void InitializeNative()
{
var cmDelegate = new BleCentralManagerDelegate();
_bleCentralManagerDelegate = cmDelegate;
var options = CreateInitOptions();
_centralManager = new CBCentralManager(cmDelegate, DispatchQueue.CurrentQueue, options);
_bleCentralManagerDelegate.UpdatedState += (s, e) => State = GetState();
}
protected override BluetoothState GetInitialStateNative()
{
return GetState();
}
protected override IAdapter CreateNativeAdapter()
{
return new Adapter(_centralManager, _bleCentralManagerDelegate);
}
private BluetoothState GetState()
{
return _centralManager.State.ToBluetoothState();
}
private CBCentralInitOptions CreateInitOptions()
{
return new CBCentralInitOptions
{
#if __IOS__
RestoreIdentifier = _restorationIdentifier,
#endif
ShowPowerAlert = _showPowerAlert
};
}
}
}
|
apache-2.0
|
C#
|
f218d007d97b49d7df8206c988f6c974f09795b0
|
Use type param 'U' for innner class to avoid conflict with 'T'
|
whampson/cascara,whampson/bft-spec
|
Src/WHampson.Cascara/Types/ArrayPointer.cs
|
Src/WHampson.Cascara/Types/ArrayPointer.cs
|
#region License
/* Copyright (c) 2017 Wes Hampson
*
* 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.
*/
#endregion
using System;
using System.Collections;
namespace WHampson.Cascara.Types
{
public class ArrayPointer<T> : Pointer<T>, IEnumerable
where T : struct, ICascaraType
{
public ArrayPointer(IntPtr addr, int count)
: base(addr)
{
Count = count;
}
private int Count
{
get;
}
public IEnumerator GetEnumerator()
{
return new ArrayPointerEnumerator<T>(this);
}
private class ArrayPointerEnumerator<U> : IEnumerator
where U : struct, ICascaraType
{
private ArrayPointer<U> arr;
private int position;
public ArrayPointerEnumerator(ArrayPointer<U> arr)
{
this.arr = arr;
Reset();
}
public object Current
{
get { return arr[position]; }
}
public bool MoveNext()
{
position++;
return position < arr.Count;
}
public void Reset()
{
position = -1;
}
}
}
}
|
#region License
/* Copyright (c) 2017 Wes Hampson
*
* 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.
*/
#endregion
using System;
using System.Collections;
namespace WHampson.Cascara.Types
{
public class ArrayPointer<T> : Pointer<T>, IEnumerable
where T : struct, ICascaraType
{
public ArrayPointer(IntPtr addr, int count)
: base(addr)
{
Count = count;
}
private int Count
{
get;
}
public IEnumerator GetEnumerator()
{
return new ArrayPointerEnumerator<T>(this);
}
private class ArrayPointerEnumerator<T> : IEnumerator
where T : struct, ICascaraType
{
private ArrayPointer<T> arr;
private int position;
public ArrayPointerEnumerator(ArrayPointer<T> arr)
{
this.arr = arr;
Reset();
}
public object Current
{
get { return arr[position]; }
}
public bool MoveNext()
{
position++;
return position < arr.Count;
}
public void Reset()
{
position = -1;
}
}
}
}
|
mit
|
C#
|
acb6f20d43e9ab3b3c91cb360b8202fd199e4193
|
Make mono/wasm run on Windows (#1744)
|
Ky7m/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,Ky7m/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,Ky7m/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,Ky7m/BenchmarkDotNet
|
src/BenchmarkDotNet/Toolchains/MonoWasm/WasmToolChain.cs
|
src/BenchmarkDotNet/Toolchains/MonoWasm/WasmToolChain.cs
|
using BenchmarkDotNet.Toolchains.DotNetCli;
using JetBrains.Annotations;
using BenchmarkDotNet.Characteristics;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Portability;
namespace BenchmarkDotNet.Toolchains.MonoWasm
{
[PublicAPI]
public class WasmToolChain : Toolchain
{
private string CustomDotNetCliPath { get; }
private WasmToolChain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath)
: base(name, generator, builder, executor)
{
CustomDotNetCliPath = customDotNetCliPath;
}
public override bool IsSupported(BenchmarkCase benchmarkCase, ILogger logger, IResolver resolver)
{
if (!base.IsSupported(benchmarkCase, logger, resolver))
return false;
if (InvalidCliPath(CustomDotNetCliPath, benchmarkCase, logger))
return false;
if (RuntimeInformation.IsWindows())
logger.WriteLineInfo($"{nameof(WasmToolChain)} is supported only on Unix, benchmark '{benchmarkCase.DisplayInfo}' might not work correctly");
return true;
}
[PublicAPI]
public static IToolchain From(NetCoreAppSettings netCoreAppSettings)
=> new WasmToolChain(netCoreAppSettings.Name,
new WasmGenerator(netCoreAppSettings.TargetFrameworkMoniker,
netCoreAppSettings.CustomDotNetCliPath,
netCoreAppSettings.PackagesPath,
netCoreAppSettings.CustomRuntimePack,
netCoreAppSettings.AOTCompilerMode == MonoAotLLVM.MonoAotCompilerMode.wasm),
new WasmBuilder(netCoreAppSettings.TargetFrameworkMoniker,
netCoreAppSettings.CustomDotNetCliPath,
netCoreAppSettings.Timeout),
new Executor(),
netCoreAppSettings.CustomDotNetCliPath);
}
}
|
using BenchmarkDotNet.Toolchains.DotNetCli;
using JetBrains.Annotations;
using BenchmarkDotNet.Characteristics;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Portability;
namespace BenchmarkDotNet.Toolchains.MonoWasm
{
[PublicAPI]
public class WasmToolChain : Toolchain
{
private string CustomDotNetCliPath { get; }
private WasmToolChain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath)
: base(name, generator, builder, executor)
{
CustomDotNetCliPath = customDotNetCliPath;
}
public override bool IsSupported(BenchmarkCase benchmarkCase, ILogger logger, IResolver resolver)
{
if (!base.IsSupported(benchmarkCase, logger, resolver))
return false;
if (InvalidCliPath(CustomDotNetCliPath, benchmarkCase, logger))
return false;
if (RuntimeInformation.IsWindows())
{
logger.WriteLineError($"{nameof(WasmToolChain)} is supported only on Unix, benchmark '{benchmarkCase.DisplayInfo}' will not be executed");
return false;
}
return true;
}
[PublicAPI]
public static IToolchain From(NetCoreAppSettings netCoreAppSettings)
=> new WasmToolChain(netCoreAppSettings.Name,
new WasmGenerator(netCoreAppSettings.TargetFrameworkMoniker,
netCoreAppSettings.CustomDotNetCliPath,
netCoreAppSettings.PackagesPath,
netCoreAppSettings.CustomRuntimePack,
netCoreAppSettings.AOTCompilerMode == MonoAotLLVM.MonoAotCompilerMode.wasm),
new WasmBuilder(netCoreAppSettings.TargetFrameworkMoniker,
netCoreAppSettings.CustomDotNetCliPath,
netCoreAppSettings.Timeout),
new Executor(),
netCoreAppSettings.CustomDotNetCliPath);
}
}
|
mit
|
C#
|
5e204d37f988368f1d4680d39d16faf37bfc62f1
|
Remove unused method extension
|
wangkanai/Detection
|
src/DependencyInjection/DetectionCollectionExtensions.cs
|
src/DependencyInjection/DetectionCollectionExtensions.cs
|
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using System;
using Wangkanai.Detection.DependencyInjection.Options;
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Contains extension method to <see cref="IServiceCollection" /> for configuring client services.
/// </summary>
public static class DetectionCollectionExtensions
{
public static IDetectionBuilder AddDetectionBuilder(this IServiceCollection services)
=> new DetectionBuilder(services);
/// <summary>
/// Add Detection Service to the services container.
/// </summary>
/// <param name="services">The services available in the application.</param>
/// <param name="setAction">An <see cref="Action{DetectionOptions}"/> to configure the provided <see cref="DetectionOptions"/>.</param>
/// <returns>An <see cref="IServiceCollection" /> so that additional calls can be chained.</returns>
public static IDetectionBuilder AddDetection(this IServiceCollection services, Action<DetectionOptions> setAction)
{
services.Configure(setAction);
return services.AddDetection();
}
/// <summary>
/// Add Detection Service to the services container.
/// </summary>
/// <param name="services">The services available in the application.</param>
/// <returns>An <see cref="IServiceCollection" /> so that additional calls can be chained.</returns>
public static IDetectionBuilder AddDetection(this IServiceCollection services)
{
var builder = services.AddDetectionBuilder();
builder.AddRequiredPlatformServices();
builder.AddCoreServices();
builder.AddResponsiveService();
builder.AddMarkerService();
return builder;
}
}
}
|
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using System;
using Microsoft.Extensions.Configuration;
using Wangkanai.Detection.DependencyInjection.Options;
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Contains extension method to <see cref="IServiceCollection" /> for configuring client services.
/// </summary>
public static class DetectionCollectionExtensions
{
public static IDetectionBuilder AddDetectionBuilder(this IServiceCollection services)
=> new DetectionBuilder(services);
/// <summary>
/// Add Detection Service to the services container.
/// </summary>
/// <param name="services">The services available in the application.</param>
/// <param name="setAction">An <see cref="Action{DetectionOptions}"/> to configure the provided <see cref="DetectionOptions"/>.</param>
/// <returns>An <see cref="IServiceCollection" /> so that additional calls can be chained.</returns>
public static IDetectionBuilder AddDetection(this IServiceCollection services, Action<DetectionOptions> setAction)
{
services.Configure(setAction);
return services.AddDetection();
}
/// <summary>
/// Add Detection Service to the services container.
/// </summary>
/// <param name="services">The services available in the application.</param>
/// <param name="configuration">Configuration</param>
/// <returns>An <see cref="IServiceCollection" /> so that additional calls can be chained.</returns>
public static IDetectionBuilder AddDetection(this IServiceCollection services, IConfiguration configuration)
{
services.Configure<DetectionOptions>(configuration);
return services.AddDetection();
}
/// <summary>
/// Add Detection Service to the services container.
/// </summary>
/// <param name="services">The services available in the application.</param>
/// <returns>An <see cref="IServiceCollection" /> so that additional calls can be chained.</returns>
public static IDetectionBuilder AddDetection(this IServiceCollection services)
{
var builder = services.AddDetectionBuilder();
builder.AddRequiredPlatformServices();
builder.AddCoreServices();
builder.AddResponsiveService();
builder.AddMarkerService();
return builder;
}
}
}
|
apache-2.0
|
C#
|
246dd4b163dfdc979ee44ff72e4989c910e07a69
|
Set MasterReqRuntime to discover types
|
pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype
|
src/Glimpse.Web.Common/Framework/MasterRequestRuntime.cs
|
src/Glimpse.Web.Common/Framework/MasterRequestRuntime.cs
|
using System;
using System.Collections.Generic;
using Microsoft.Framework.DependencyInjection;
namespace Glimpse.Web
{
public class MasterRequestRuntime
{
private readonly IDiscoverableCollection<IRequestRuntime> _requestRuntimes;
public MasterRequestRuntime(IServiceProvider serviceProvider)
{
_requestRuntimes = serviceProvider.GetService<IDiscoverableCollection<IRequestRuntime>>();
_requestRuntimes.Discover();
}
public void Begin(IContext newContext)
{
}
public void End(IContext newContext)
{
}
}
}
|
using System;
using System.Collections.Generic;
using Microsoft.Framework.DependencyInjection;
namespace Glimpse.Web
{
public class MasterRequestRuntime
{
private readonly IEnumerable<IRequestRuntime> _requestRuntimes;
public MasterRequestRuntime(IServiceProvider serviceProvider)
{
_requestRuntimes = serviceProvider.GetService<IDiscoverableCollection<IRequestRuntime>>();
}
public void Begin(IContext newContext)
{
}
public void End(IContext newContext)
{
}
}
}
|
mit
|
C#
|
9fad7a14bedd421f1f739204cc7e0183572f8e73
|
Update JsonSerializer.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Serialization/JsonSerializer.cs
|
TIKSN.Core/Serialization/JsonSerializer.cs
|
using Newtonsoft.Json;
namespace TIKSN.Serialization
{
public class JsonSerializer : SerializerBase<string>
{
protected override string SerializeInternal<T>(T obj)
{
return JsonConvert.SerializeObject(obj);
}
}
}
|
using Newtonsoft.Json;
namespace TIKSN.Serialization
{
public class JsonSerializer : SerializerBase<string>
{
protected override string SerializeInternal(object obj)
{
return JsonConvert.SerializeObject(obj);
}
}
}
|
mit
|
C#
|
0582df5a818d6aacf52903a6203db040e42d28a6
|
Fix 1 - passing 2 / 8 continuation test
|
theraot/Theraot
|
Core/System/Threading/Tasks/ContinuationTaskFromTask.cs
|
Core/System/Threading/Tasks/ContinuationTaskFromTask.cs
|
#if NET20 || NET30 || NET35
using System.Diagnostics.Contracts;
namespace System.Threading.Tasks
{
internal sealed class ContinuationTaskFromTask : Task
{
private Task _antecedent;
public ContinuationTaskFromTask(Task antecedent, Delegate action, object state, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions)
: base(action, state, InternalCurrentIfAttached(creationOptions), default(CancellationToken), creationOptions, internalOptions, antecedent.Scheduler)
{
Contract.Requires(action is Action<Task> || action is Action<Task, object>, "Invalid delegate type in ContinuationTaskFromTask");
_antecedent = antecedent;
CapturedContext = ExecutionContext.Capture();
}
/// <summary>
/// Evaluates the value selector of the Task which is passed in as an object and stores the result.
/// </summary>
internal override void InnerInvoke()
{
// Get and null out the antecedent. This is crucial to avoid a memory
// leak with long chains of continuations.
var antecedent = _antecedent;
Contract.Assert(antecedent != null, "No antecedent was set for the ContinuationTaskFromTask.");
_antecedent = null;
// Invoke the delegate
Contract.Assert(Action != null);
var action = Action as Action<Task>;
if (action != null)
{
action(antecedent);
return;
}
var actionWithState = Action as Action<Task, object>;
if (actionWithState != null)
{
actionWithState(antecedent, State);
return;
}
Contract.Assert(false, "Invalid Action in ContinuationTaskFromTask");
}
}
}
#endif
|
#if NET20 || NET30 || NET35
using System.Diagnostics.Contracts;
namespace System.Threading.Tasks
{
internal sealed class ContinuationTaskFromTask : Task
{
private Task _antecedent;
public ContinuationTaskFromTask(Task antecedent, Delegate action, object state, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions)
: base(action, state, InternalCurrentIfAttached(creationOptions), default(CancellationToken), creationOptions, internalOptions, null)
{
Contract.Requires(action is Action<Task> || action is Action<Task, object>, "Invalid delegate type in ContinuationTaskFromTask");
_antecedent = antecedent;
CapturedContext = ExecutionContext.Capture();
}
/// <summary>
/// Evaluates the value selector of the Task which is passed in as an object and stores the result.
/// </summary>
internal override void InnerInvoke()
{
// Get and null out the antecedent. This is crucial to avoid a memory
// leak with long chains of continuations.
var antecedent = _antecedent;
Contract.Assert(antecedent != null, "No antecedent was set for the ContinuationTaskFromTask.");
_antecedent = null;
// Invoke the delegate
Contract.Assert(Action != null);
var action = Action as Action<Task>;
if (action != null)
{
action(antecedent);
return;
}
var actionWithState = Action as Action<Task, object>;
if (actionWithState != null)
{
actionWithState(antecedent, State);
return;
}
Contract.Assert(false, "Invalid Action in ContinuationTaskFromTask");
}
}
}
#endif
|
mit
|
C#
|
c0ffb43b95e5439d36069f736a728015dc3086c2
|
Fix small bug
|
Yonom/CupCake
|
CupCake.DefaultCommands/Commands/Edit/GodmodeCommand.cs
|
CupCake.DefaultCommands/Commands/Edit/GodmodeCommand.cs
|
using System;
using CupCake.Command;
using CupCake.Command.Source;
using CupCake.Permissions;
namespace CupCake.DefaultCommands.Commands.Edit
{
public sealed class GodModeCommand : EditCommandBase
{
[MinGroup(Group.Moderator)]
[Label("godmode")]
[CorrectUsage("[enabled]")]
protected override void Run(IInvokeSource source, ParsedCommand message)
{
this.RequireEdit();
bool enabled;
if (message.Count >= 1)
{
try
{
enabled = Boolean.Parse(message.Args[0]);
}
catch (Exception ex)
{
throw new CommandException("Unable to parse parameter: enabled", ex);
}
}
else
{
enabled = !this.PlayerService.OwnPlayer.IsGod;
}
this.ActionService.GodMode(enabled);
source.Reply("God mode was set to {0}.", enabled);
}
}
}
|
using System;
using CupCake.Command;
using CupCake.Command.Source;
using CupCake.Permissions;
namespace CupCake.DefaultCommands.Commands.Edit
{
public sealed class GodModeCommand : EditCommandBase
{
[MinGroup(Group.Moderator)]
[Label("godmode")]
[CorrectUsage("[enabled]")]
protected override void Run(IInvokeSource source, ParsedCommand message)
{
this.RequireEdit();
bool enabled;
if (message.Count >= 1)
{
try
{
enabled = Boolean.Parse(message.Args[0]);
}
catch (Exception ex)
{
throw new CommandException("Unable to parse parameter: enabled", ex);
}
}
else
{
enabled = this.PlayerService.OwnPlayer.IsGod;
}
this.ActionService.GodMode(enabled);
source.Reply("God mode was set to {0}.", enabled);
}
}
}
|
mit
|
C#
|
6f5c0ef0d92cde39f938e93c9e56a87cc6478421
|
Handle non-valid JSON
|
Erikvl87/KNKVPlugin
|
KNKVPlugin/Request.cs
|
KNKVPlugin/Request.cs
|
using System;
using System.Collections.Specialized;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
using KNKVPlugin.DataTypes;
using Newtonsoft.Json;
namespace KNKVPlugin
{
public class Request
{
private readonly WebRequest _request;
public Request(string code)
{
var serviceUrl = String.Format("http://www.knkv.nl/kcp/{0}/json/", code);
_request = WebRequest.Create(serviceUrl);
_request.ContentType = "application/x-www-form-urlencoded";
_request.Method = WebRequestMethods.Http.Post;
}
public Teams GetTeams()
{
var queryString = HttpUtility.ParseQueryString(String.Empty);
queryString["file"] = "json";
queryString["f"] = "get_data";
queryString["t"] = "teams";
queryString["t_id"] = "";
queryString["p"] = "0";
queryString["full"] = "0";
var response = Execute(queryString);
try
{
var jObject = JsonConvert.DeserializeObject<Teams>(response);
return jObject;
}
catch (JsonReaderException e)
{
// No valid JSON was recieved. Throw the ugly html error that the service is returning.
throw new ApplicationException(response);
}
}
private string Execute(NameValueCollection postCollection)
{
var postData = postCollection.ToString();
var byteArray = new ASCIIEncoding().GetBytes(postData);
_request.ContentLength = byteArray.Length;
Stream stream = null;
StreamReader streamReader = null;
WebResponse response = null;
try
{
// POST
stream = _request.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
// GET RESPONSE
response = _request.GetResponse();
stream = response.GetResponseStream();
// READ RESPONSE
streamReader = new StreamReader(stream);
var responseFromServer = streamReader.ReadToEnd();
return responseFromServer;
}
finally
{
if (streamReader != null)
streamReader.Close();
if (stream != null)
stream.Close();
if (response != null)
response.Close();
}
}
}
}
|
using System;
using System.Collections.Specialized;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
using KNKVPlugin.DataTypes;
using Newtonsoft.Json;
namespace KNKVPlugin
{
public class Request
{
private readonly WebRequest _request;
public Request(string code)
{
var serviceUrl = String.Format("http://www.knkv.nl/kcp/{0}/json/", code);
_request = WebRequest.Create(serviceUrl);
_request.ContentType = "application/x-www-form-urlencoded";
_request.Method = WebRequestMethods.Http.Post;
}
public Teams GetTeams()
{
var queryString = HttpUtility.ParseQueryString(String.Empty);
queryString["file"] = "json";
queryString["f"] = "get_data";
queryString["t"] = "teams";
queryString["t_id"] = "";
queryString["p"] = "0";
queryString["full"] = "0";
return JsonConvert.DeserializeObject<Teams>(Execute(queryString));
}
private string Execute(NameValueCollection postCollection)
{
var postData = postCollection.ToString();
var byteArray = new ASCIIEncoding().GetBytes(postData);
_request.ContentLength = byteArray.Length;
Stream stream = null;
StreamReader streamReader = null;
WebResponse response = null;
try
{
// POST
stream = _request.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
// GET RESPONSE
response = _request.GetResponse();
stream = response.GetResponseStream();
// READ RESPONSE
streamReader = new StreamReader(stream);
var responseFromServer = streamReader.ReadToEnd();
return responseFromServer;
}
finally
{
if (streamReader != null)
streamReader.Close();
if (stream != null)
stream.Close();
if (response != null)
response.Close();
}
}
}
}
|
mit
|
C#
|
72c5698f127bd1351de94471b8f531839e6df004
|
Fix AmbiguousMatchException in multiple indexers, make getters and setters invocation consistent
|
sanyaade-iot/jint,reidyd/jint,npenin/jint,Nogrod/jint,sanyaade-iot/jint,ayende/jint,chaquotay/jint,ImagineLearning/Jint,sebastienros/jint,mgentile/jint,chaquotay/jint,npenin/jint,fvaneijk/jint,mgentile/jint,flts/jint,santiagoaguiar/jint,fvaneijk/jint,santiagoaguiar/jint,djMax/jint,flts/jint,tylerjwatson/jint,sebastienros/jint,hnafar/jint,djMax/jint,ayende/jint,reidyd/jint,ImagineLearning/Jint,honestegg/jint,hnafar/jint,honestegg/jint,Nogrod/jint
|
Jint/Runtime/Descriptors/Specialized/IndexDescriptor.cs
|
Jint/Runtime/Descriptors/Specialized/IndexDescriptor.cs
|
using System;
using System.Globalization;
using System.Linq;
using System.Reflection;
using Jint.Native;
namespace Jint.Runtime.Descriptors.Specialized
{
public sealed class IndexDescriptor : PropertyDescriptor
{
private readonly Engine _engine;
private readonly object _key;
private readonly object _item;
private readonly PropertyInfo _indexer;
public IndexDescriptor(Engine engine, string key, object item)
{
_engine = engine;
_item = item;
// get all instance indexers with exactly 1 argument
var indexers = item
.GetType()
.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
.Where(x => x.GetIndexParameters().Length == 1);
// try to find first indexer having either public getter or setter with matching argument type
foreach (var indexer in indexers)
{
if (indexer.GetGetMethod() != null || indexer.GetSetMethod() != null)
{
var paramType = indexer.GetIndexParameters()[0].ParameterType;
try
{
_key = _engine.Options.GetTypeConverter().Convert(key, paramType, CultureInfo.InvariantCulture);
_indexer = indexer;
break;
}
catch { }
}
}
// throw if no indexer found
if(_indexer == null)
throw new InvalidOperationException("No matching indexer found.");
Writable = true;
}
public override JsValue? Value
{
get
{
var getter = _indexer.GetGetMethod();
if(getter == null)
throw new InvalidOperationException("Indexer has no public getter.");
object[] parameters = { _key };
return JsValue.FromObject(_engine, getter.Invoke(_item, parameters));
}
set
{
var setter = _indexer.GetSetMethod();
if (setter == null)
throw new InvalidOperationException("Indexer has no public setter.");
object[] parameters = { _key, value.HasValue ? value.Value.ToObject() : null };
setter.Invoke(_item, parameters);
}
}
}
}
|
using System.Globalization;
using System.Reflection;
using Jint.Native;
namespace Jint.Runtime.Descriptors.Specialized
{
public sealed class IndexDescriptor : PropertyDescriptor
{
private readonly Engine _engine;
private readonly object _key;
private readonly object _item;
private readonly MethodInfo _getter;
private readonly MethodInfo _setter;
public IndexDescriptor(Engine engine, string key, object item)
{
_engine = engine;
_item = item;
_getter = item.GetType().GetMethod("get_Item", BindingFlags.Instance | BindingFlags.Public);
_setter = item.GetType().GetMethod("set_Item", BindingFlags.Instance | BindingFlags.Public);
_key = _engine.Options.GetTypeConverter().Convert(key, _getter.GetParameters()[0].ParameterType, CultureInfo.InvariantCulture);
Writable = true;
}
public override JsValue? Value
{
get
{
object[] parameters = { _key };
return JsValue.FromObject(_engine, _getter.Invoke(_item, parameters));
}
set
{
var defaultValue = _item.GetType().IsValueType ? System.Activator.CreateInstance(_item.GetType()) : null;
object[] parameters = { _key, value.HasValue ? value.Value.ToObject() : null };
_setter.Invoke(_item, parameters);
}
}
}
}
|
bsd-2-clause
|
C#
|
00b92e5eb98aac5f0265c74cfca00830f95c302b
|
Remove stale registrations of WiniumElement
|
NetlifeBackupSolutions/Winium.StoreApps,NetlifeBackupSolutions/Winium.StoreApps
|
Winium/Winium.StoreApps.InnerServer/ElementsRegistry.cs
|
Winium/Winium.StoreApps.InnerServer/ElementsRegistry.cs
|
namespace Winium.StoreApps.InnerServer
{
#region
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using Winium.StoreApps.Common;
using Winium.StoreApps.Common.Exceptions;
using Winium.StoreApps.InnerServer.Element;
#endregion
internal class ElementsRegistry
{
#region Static Fields
private static int safeInstanceCount;
#endregion
#region Fields
private readonly Dictionary<string, WiniumElement> registredElements;
#endregion
#region Constructors and Destructors
public ElementsRegistry()
{
this.registredElements = new Dictionary<string, WiniumElement>();
}
#endregion
#region Public Methods and Operators
public WiniumElement GetRegisteredElement(string registredKey)
{
WiniumElement item;
if (this.registredElements.TryGetValue(registredKey, out item))
{
if (!item.IsStale)
{
return item;
}
this.registredElements.Remove(registredKey);
}
throw new AutomationException("Stale element reference", ResponseStatus.StaleElementReference);
}
public string RegisterElement(WiniumElement element)
{
var registeredKey = this.registredElements.FirstOrDefault(x => x.Value.Equals(element)).Key;
if (registeredKey == null)
{
registeredKey = GenerateGuid(element);
this.registredElements.Add(registeredKey, element);
}
var staleElements = registredElements.Where(x => x.Value.IsStale).ToList();
foreach (var staleElement in staleElements) {
this.registredElements.Remove(staleElement.Key);
}
return registeredKey;
}
#endregion
#region Methods
private static string GenerateGuid(WiniumElement element)
{
Interlocked.Increment(ref safeInstanceCount);
return element.GetHashCode() + "-" + safeInstanceCount.ToString(string.Empty, CultureInfo.InvariantCulture);
}
#endregion
}
}
|
namespace Winium.StoreApps.InnerServer
{
#region
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using Winium.StoreApps.Common;
using Winium.StoreApps.Common.Exceptions;
using Winium.StoreApps.InnerServer.Element;
#endregion
internal class ElementsRegistry
{
#region Static Fields
private static int safeInstanceCount;
#endregion
#region Fields
private readonly Dictionary<string, WiniumElement> registredElements;
#endregion
#region Constructors and Destructors
public ElementsRegistry()
{
this.registredElements = new Dictionary<string, WiniumElement>();
}
#endregion
#region Public Methods and Operators
public WiniumElement GetRegisteredElement(string registredKey)
{
WiniumElement item;
if (this.registredElements.TryGetValue(registredKey, out item))
{
if (!item.IsStale)
{
return item;
}
this.registredElements.Remove(registredKey);
}
throw new AutomationException("Stale element reference", ResponseStatus.StaleElementReference);
}
public string RegisterElement(WiniumElement element)
{
var registeredKey = this.registredElements.FirstOrDefault(x => x.Value.Equals(element)).Key;
if (registeredKey == null)
{
registeredKey = GenerateGuid(element);
this.registredElements.Add(registeredKey, element);
}
return registeredKey;
}
#endregion
#region Methods
private static string GenerateGuid(WiniumElement element)
{
Interlocked.Increment(ref safeInstanceCount);
return element.GetHashCode() + "-" + safeInstanceCount.ToString(string.Empty, CultureInfo.InvariantCulture);
}
#endregion
}
}
|
mpl-2.0
|
C#
|
fb777bd5642f268bbffd0dec388925733e4d376e
|
Set an encoding on source text (#49436)
|
ErikSchierboom/roslyn,heejaechang/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,tannergooding/roslyn,mgoertz-msft/roslyn,AmadeusW/roslyn,tannergooding/roslyn,weltkante/roslyn,sharwell/roslyn,ErikSchierboom/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,sharwell/roslyn,tmat/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,KevinRansom/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,weltkante/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,eriawan/roslyn,tmat/roslyn,heejaechang/roslyn,eriawan/roslyn,diryboy/roslyn,physhi/roslyn,ErikSchierboom/roslyn,sharwell/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,diryboy/roslyn,physhi/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,dotnet/roslyn,tmat/roslyn,mavasani/roslyn,AlekseyTs/roslyn,physhi/roslyn,jasonmalinowski/roslyn,KirillOsenkov/roslyn,mavasani/roslyn,mavasani/roslyn,diryboy/roslyn,wvdd007/roslyn,panopticoncentral/roslyn,wvdd007/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn
|
src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidOpenHandler.cs
|
src/Features/LanguageServer/Protocol/Handler/DocumentChanges/DidOpenHandler.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges
{
[Shared]
[ExportLspMethod(LSP.Methods.TextDocumentDidOpenName, mutatesSolutionState: true)]
internal class DidOpenHandler : IRequestHandler<LSP.DidOpenTextDocumentParams, object?>
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DidOpenHandler()
{
}
public LSP.TextDocumentIdentifier? GetTextDocumentIdentifier(LSP.DidOpenTextDocumentParams request) => null;
public Task<object?> HandleRequestAsync(LSP.DidOpenTextDocumentParams request, RequestContext context, CancellationToken cancellationToken)
{
// Add the document and ensure the text we have matches whats on the client
var sourceText = SourceText.From(request.TextDocument.Text, System.Text.Encoding.UTF8);
context.StartTracking(request.TextDocument.Uri, sourceText);
return SpecializedTasks.Default<object>();
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges
{
[Shared]
[ExportLspMethod(LSP.Methods.TextDocumentDidOpenName, mutatesSolutionState: true)]
internal class DidOpenHandler : IRequestHandler<LSP.DidOpenTextDocumentParams, object?>
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DidOpenHandler()
{
}
public LSP.TextDocumentIdentifier? GetTextDocumentIdentifier(LSP.DidOpenTextDocumentParams request) => null;
public Task<object?> HandleRequestAsync(LSP.DidOpenTextDocumentParams request, RequestContext context, CancellationToken cancellationToken)
{
// Add the document and ensure the text we have matches whats on the client
var sourceText = SourceText.From(request.TextDocument.Text);
context.StartTracking(request.TextDocument.Uri, sourceText);
return SpecializedTasks.Default<object>();
}
}
}
|
mit
|
C#
|
8bceeb0125623e60bde34eeaeacedfca30d44ff7
|
Fix - Notifica cancellazione utente
|
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
|
src/backend/SO115App.SignalR/Sender/GestioneUtenti/NotificationDeleteUtente.cs
|
src/backend/SO115App.SignalR/Sender/GestioneUtenti/NotificationDeleteUtente.cs
|
using Microsoft.AspNetCore.SignalR;
using SO115App.Models.Servizi.CQRS.Commands.GestioneUtenti.CancellazioneUtente;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti.GetUtenti;
using SO115App.Models.Servizi.Infrastruttura.Notification.GestioneUtenti;
using System;
using System.Threading.Tasks;
namespace SO115App.SignalR.Sender.GestioneUtenti
{
public class NotificationDeleteUtente : INotifyDeleteUtente
{
private readonly IHubContext<NotificationHub> _notificationHubContext;
private readonly IGetUtenteByCF _getUtenteByCF;
public NotificationDeleteUtente(IHubContext<NotificationHub> notificationHubContext, IGetUtenteByCF getUtenteByCF)
{
_notificationHubContext = notificationHubContext;
_getUtenteByCF = getUtenteByCF;
}
public async Task Notify(DeleteUtenteCommand command)
{
var utente = _getUtenteByCF.Get(command.CodFiscale);
await _notificationHubContext.Clients.Group(utente.Sede.Codice).SendAsync("NotifyRefreshUtenti", true);
await _notificationHubContext.Clients.Group(command.UtenteRimosso.Sede.Codice).SendAsync("NotifyRefreshUtenti", true);
await _notificationHubContext.Clients.All.SendAsync("NotifyDeleteUtente", command.UtenteRimosso.Id);
}
}
}
|
using Microsoft.AspNetCore.SignalR;
using SO115App.Models.Servizi.CQRS.Commands.GestioneUtenti.CancellazioneUtente;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti.GetUtenti;
using SO115App.Models.Servizi.Infrastruttura.Notification.GestioneUtenti;
using System;
using System.Threading.Tasks;
namespace SO115App.SignalR.Sender.GestioneUtenti
{
public class NotificationDeleteUtente : INotifyDeleteUtente
{
private readonly IHubContext<NotificationHub> _notificationHubContext;
private readonly IGetUtenteByCF _getUtenteByCF;
public NotificationDeleteUtente(IHubContext<NotificationHub> notificationHubContext, IGetUtenteByCF getUtenteByCF)
{
_notificationHubContext = notificationHubContext;
_getUtenteByCF = getUtenteByCF;
}
public async Task Notify(DeleteUtenteCommand command)
{
await _notificationHubContext.Clients.Group(command.CodiceSede).SendAsync("NotifyRefreshUtenti", true);
await _notificationHubContext.Clients.Group(command.UtenteRimosso.Sede.Codice).SendAsync("NotifyRefreshUtenti", true);
await _notificationHubContext.Clients.All.SendAsync("NotifyDeleteUtente", command.UtenteRimosso.Id);
}
}
}
|
agpl-3.0
|
C#
|
9d9aa9ccbff506cef5a323769c81881ea8f476ff
|
Add exception for usage of `.Result` within `.ContinueWith` continuations
|
ppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework
|
osu.Framework/Extensions/TaskExtensions.cs
|
osu.Framework/Extensions/TaskExtensions.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Threading;
using System.Threading.Tasks;
namespace osu.Framework.Extensions
{
public static class TaskExtensions
{
/// <summary>
/// Safe alternative to Task.Wait which ensures the calling thread is not a thread pool thread.
/// </summary>
public static void WaitSafely(this Task task)
{
if (Thread.CurrentThread.IsThreadPoolThread)
throw new InvalidOperationException($"Can't use {nameof(WaitSafely)} from inside an async operation.");
#pragma warning disable RS0030
task.Wait();
#pragma warning restore RS0030
}
/// <summary>
/// Safe alternative to Task.Result which ensures the calling thread is not a thread pool thread.
/// </summary>
public static T WaitSafelyForResult<T>(this Task<T> task)
{
// We commonly access `.Result` from within `ContinueWith`, which is a safe usage (the task is guaranteed to be completed).
// Unfortunately, the only way to allow these usages is to check whether the task is completed or not here.
// This does mean that there could be edge cases where this safety is skipped (ie. if the majority of executions complete
// immediately).
if (Thread.CurrentThread.IsThreadPoolThread && !task.IsCompleted)
throw new InvalidOperationException($"Can't use {nameof(WaitSafelyForResult)} from inside an async operation.");
#pragma warning disable RS0030
return task.Result;
#pragma warning restore RS0030
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Threading;
using System.Threading.Tasks;
namespace osu.Framework.Extensions
{
public static class TaskExtensions
{
/// <summary>
/// Safe alternative to Task.Wait which ensures the calling thread is not a thread pool thread.
/// </summary>
public static void WaitSafely(this Task task)
{
if (Thread.CurrentThread.IsThreadPoolThread)
throw new InvalidOperationException($"Can't use {nameof(WaitSafely)} from inside an async operation.");
#pragma warning disable RS0030
task.Wait();
#pragma warning restore RS0030
}
/// <summary>
/// Safe alternative to Task.Result which ensures the calling thread is not a thread pool thread.
/// </summary>
public static T WaitSafelyForResult<T>(this Task<T> task)
{
if (Thread.CurrentThread.IsThreadPoolThread)
throw new InvalidOperationException($"Can't use {nameof(WaitSafelyForResult)} from inside an async operation.");
#pragma warning disable RS0030
return task.Result;
#pragma warning restore RS0030
}
}
}
|
mit
|
C#
|
1bc8e6c9347a06fff3b6a5a188f5d8523b929c6d
|
test abc
|
Thiago-Caramelo/patchsearch
|
Program.cs
|
Program.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace PatchSearch
{
// teste teste
class Program
{
static void Main(string[] args)
{
if (args == null || args.Length == 0)
{
return;
}
// obter todos os arquivos da pasta
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory());
foreach (var item in files) //teste
{
using (StreamReader reader = new StreamReader(item)) // teste f
{
string fileContent = reader.ReadToEnd(); // teste 456
int qt = 0;//teste 7
foreach (var term in args)
{
if (fileContent.Contains(term))
{
qt++;
}
}
if (qt == args.Length)
{
Console.WriteLine(Path.GetFileName(item));
}
}
}
}
}
}
//teste c
//teste d
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace PatchSearch
{
// teste teste
class Program
{
static void Main(string[] args)
{
if (args == null || args.Length == 0)
{
return;
}
// obter todos os arquivos da pasta
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory());
foreach (var item in files) //teste
{
using (StreamReader reader = new StreamReader(item)) // teste f
{
string fileContent = reader.ReadToEnd();
int qt = 0;//teste 7
foreach (var term in args)
{
if (fileContent.Contains(term))
{
qt++;
}
}
if (qt == args.Length)
{
Console.WriteLine(Path.GetFileName(item));
}
}
}
}
}
}
//teste c
//teste d
|
mit
|
C#
|
ef269996982e161ecf70a2a30463bfbf64499318
|
Refactor `DynamicObjectSource`
|
atata-framework/atata,atata-framework/atata
|
src/Atata/DataProvision/ObjectSources/DynamicObjectSource.cs
|
src/Atata/DataProvision/ObjectSources/DynamicObjectSource.cs
|
using System;
namespace Atata
{
/// <summary>
/// Provides a set of methods for <see cref="DynamicObjectSource{TObject}"/> creation.
/// </summary>
public static class DynamicObjectSource
{
/// <summary>
/// Creates a <see cref="DynamicObjectSource{TObject}"/> for the specified <paramref name="objectGetFunction"/>.
/// </summary>
/// <typeparam name="TObject">The type of the object.</typeparam>
/// <param name="objectGetFunction">The object get function.</param>
/// <returns>An instance of <see cref="DynamicObjectSource{TValue}"/>.</returns>
public static DynamicObjectSource<TObject> Create<TObject>(Func<TObject> objectGetFunction) =>
new DynamicObjectSource<TObject>(objectGetFunction);
}
}
|
using System;
namespace Atata
{
/// <summary>
/// Provides a set of methods for <see cref="DynamicObjectSource{TValue}"/> creation.
/// </summary>
public static class DynamicObjectSource
{
/// <summary>
/// Creates a <see cref="DynamicObjectSource{TValue}"/> for the specified <paramref name="valueGetFunction"/>.
/// </summary>
/// <typeparam name="TValue">The type of the value.</typeparam>
/// <param name="valueGetFunction">The value get function.</param>
/// <returns>An instance of <see cref="DynamicObjectSource{TValue}"/>.</returns>
public static DynamicObjectSource<TValue> Create<TValue>(Func<TValue> valueGetFunction) =>
new DynamicObjectSource<TValue>(valueGetFunction);
}
}
|
apache-2.0
|
C#
|
e13b16076fad3eb67ce1882051079e3762a5e45b
|
fix test
|
Liwoj/Metrics.NET,huoxudong125/Metrics.NET,Recognos/Metrics.NET,alhardy/Metrics.NET,mnadel/Metrics.NET,etishor/Metrics.NET,DeonHeyns/Metrics.NET,cvent/Metrics.NET,ntent-ad/Metrics.NET,Liwoj/Metrics.NET,Recognos/Metrics.NET,DeonHeyns/Metrics.NET,alhardy/Metrics.NET,etishor/Metrics.NET,MetaG8/Metrics.NET,MetaG8/Metrics.NET,MetaG8/Metrics.NET,ntent-ad/Metrics.NET,mnadel/Metrics.NET,cvent/Metrics.NET,huoxudong125/Metrics.NET
|
Src/Metrics.Tests/Visualization/FlotVisualizationTests.cs
|
Src/Metrics.Tests/Visualization/FlotVisualizationTests.cs
|
using System;
using FluentAssertions;
using Metrics.Visualization;
using Xunit;
namespace Metrics.Tests.Visualization
{
public class FlotVisualizationTests
{
[Fact]
public void CanReadAppFromResource()
{
FlotWebApp.GetFlotApp(new Uri("http://localhost/")).Should().NotBeEmpty();
FlotWebApp.GetFlotApp(new Uri("http://xxx/")).Should().Contain("http://xxx");
}
}
}
|
using System;
using FluentAssertions;
using Metrics.Visualization;
using Xunit;
namespace Metrics.Tests.Visualization
{
public class FlotVisualizationTests
{
[Fact]
public void CanReadAppFromResource()
{
FlotWebApp.GetFlotApp(new Uri("http://localhost/")).Should().NotBeEmpty();
FlotWebApp.GetFlotApp(new Uri("http://xxx/")).Should().Contain("http://xxx/");
}
}
}
|
apache-2.0
|
C#
|
4f5bcbf71721480b9a50a2b3bb06eb22d21b6a9f
|
Add InGameServerIP and InGameInfo to SteamCommunityProfile XML model.
|
babelshift/Steam.Models
|
Steam.Models/SteamCommunity/SteamCommunityProfileModel.cs
|
Steam.Models/SteamCommunity/SteamCommunityProfileModel.cs
|
using System;
using System.Collections.Generic;
namespace Steam.Models.SteamCommunity
{
public class SteamCommunityProfileModel
{
public long SteamID { get; set; }
public string Nickname { get; set; }
public string State { get; set; }
public string StateMessage { get; set; }
public int VisibilityState { get; set; } // what is this?
public Uri Avatar { get; set; }
public Uri AvatarMedium { get; set; }
public Uri AvatarFull { get; set; }
public bool IsVacBanned { get; set; }
public string TradeBanState { get; set; }
public bool IsLimitedAccount { get; set; }
public string CustomURL { get; set; }
public string MemberSince { get; set; }
public double SteamRating { get; set; }
public double HoursPlayedLastTwoWeeks { get; set; }
public string Headline { get; set; }
public string Location { get; set; }
public string RealName { get; set; }
public string Summary { get; set; }
public IReadOnlyCollection<SteamCommunityProfileMostPlayedGameModel> MostPlayedGames { get; set; }
public string InGameServerIP { get; set; }
public InGameInfo InGameInfo { get; set; }
}
public class SteamCommunityProfileMostPlayedGameModel
{
public string Name { get; set; }
public Uri Link { get; set; }
public Uri Icon { get; set; }
public Uri Logo { get; set; }
public Uri LogoSmall { get; set; }
public double HoursPlayed { get; set; }
public double HoursOnRecord { get; set; }
public string StatsName { get; set; }
}
public class InGameInfo
{
public string GameName { get; set; }
public string GameLink { get; set; }
public string GameIcon { get; set; }
public string GameLogo { get; set; }
public string GameLogoSmall { get; set; }
}
}
|
using System;
using System.Collections.Generic;
namespace Steam.Models.SteamCommunity
{
public class SteamCommunityProfileModel
{
public long SteamID { get; set; }
public string Nickname { get; set; }
public string State { get; set; }
public string StateMessage { get; set; }
public int VisibilityState { get; set; } // what is this?
public Uri Avatar { get; set; }
public Uri AvatarMedium { get; set; }
public Uri AvatarFull { get; set; }
public bool IsVacBanned { get; set; }
public string TradeBanState { get; set; }
public bool IsLimitedAccount { get; set; }
public string CustomURL { get; set; }
public string MemberSince { get; set; }
public double SteamRating { get; set; }
public double HoursPlayedLastTwoWeeks { get; set; }
public string Headline { get; set; }
public string Location { get; set; }
public string RealName { get; set; }
public string Summary { get; set; }
public IReadOnlyCollection<SteamCommunityProfileMostPlayedGameModel> MostPlayedGames { get; set; }
}
public class SteamCommunityProfileMostPlayedGameModel
{
public string Name { get; set; }
public Uri Link { get; set; }
public Uri Icon { get; set; }
public Uri Logo { get; set; }
public Uri LogoSmall { get; set; }
public double HoursPlayed { get; set; }
public double HoursOnRecord { get; set; }
public string StatsName { get; set; }
}
}
|
mit
|
C#
|
2ba7a595d32cbd2a1f9aaef468a6a47589eb2aa8
|
Fix sample
|
NRules/NRules,prashanthr/NRules
|
samples/SimpleRules/SimpleRules/Rules/PreferredCustomerDiscountRule.cs
|
samples/SimpleRules/SimpleRules/Rules/PreferredCustomerDiscountRule.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using NRules.Fluent.Dsl;
using NRules.Samples.SimpleRules.Domain;
namespace NRules.Samples.SimpleRules.Rules
{
[Name("Preferred customer discount")]
public class PreferredCustomerDiscountRule : Rule
{
public override void Define()
{
Customer customer = null;
IEnumerable<Order> orders = null;
When()
.Match<Customer>(() => customer, c => c.IsPreferred)
.Collect<Order>(() => orders,
o => o.Customer == customer,
o => o.IsOpen,
o => !o.IsDiscounted)
.Where(x => x.Any());
Then()
.Do(ctx => ApplyDiscount(orders, 10.0))
.Do(ctx => LogOrders(orders))
.Do(ctx => orders.ToList().ForEach(ctx.Update));
}
private static void ApplyDiscount(IEnumerable<Order> orders, double discount)
{
foreach (var order in orders)
{
order.ApplyDiscount(discount);
}
}
private static void LogOrders(IEnumerable<Order> orders)
{
Console.WriteLine("Discount applied to orders {0}",
string.Join(",", orders.Select(o => o.Id)));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using NRules.Fluent.Dsl;
using NRules.Samples.SimpleRules.Domain;
namespace NRules.Samples.SimpleRules.Rules
{
[Name("Preferred customer discount")]
public class PreferredCustomerDiscountRule : Rule
{
public override void Define()
{
Customer customer = null;
IEnumerable<Order> orders = null;
When()
.Match<Customer>(() => customer, c => c.IsPreferred)
.Collect<Order>(() => orders,
o => o.Customer == customer,
o => o.IsOpen,
o => !o.IsDiscounted);
Then()
.Do(ctx => ApplyDiscount(orders, 10.0))
.Do(ctx => LogOrders(orders))
.Do(ctx => orders.ToList().ForEach(ctx.Update));
}
private static void ApplyDiscount(IEnumerable<Order> orders, double discount)
{
foreach (var order in orders)
{
order.ApplyDiscount(discount);
}
}
private static void LogOrders(IEnumerable<Order> orders)
{
Console.WriteLine("Discount applied to orders {0}",
string.Join(",", orders.Select(o => o.Id)));
}
}
}
|
mit
|
C#
|
eee4d9bbb0751c7581c037f06d56d2cf10d708a4
|
Add copyright 2020
|
fredatgithub/UsefulFunctions
|
FluentAssertionsUnitTests/Properties/AssemblyInfo.cs
|
FluentAssertionsUnitTests/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("FluentAssertionsUnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Freddy Juhel")]
[assembly: AssemblyProduct("FluentAssertionsUnitTests")]
[assembly: AssemblyCopyright("Copyright © Freddy Juhel MIT 2015-2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("cfd4fa8a-cbe2-4f08-b6ce-ed51b93b2dba")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("FluentAssertionsUnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Freddy Juhel")]
[assembly: AssemblyProduct("FluentAssertionsUnitTests")]
[assembly: AssemblyCopyright("Copyright © Freddy Juhel MIT 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("cfd4fa8a-cbe2-4f08-b6ce-ed51b93b2dba")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
bd92a434e5b7069e4284972b35c57fa7cb37d10c
|
add attribute to populate related items
|
tinohager/Nager.AmazonProductAdvertising,tinohager/Nager.AmazonProductAdvertising
|
Nager.AmazonProductAdvertising/Model/RelatedItems.cs
|
Nager.AmazonProductAdvertising/Model/RelatedItems.cs
|
using System.Xml.Serialization;
namespace Nager.AmazonProductAdvertising.Model
{
public class RelatedItems
{
public string Relationship { get; set; }
public string RelationshipType { get; set; }
public byte RelatedItemCount { get; set; }
public byte RelatedItemPageCount { get; set; }
public byte RelatedItemPage { get; set; }
[XmlElement("RelatedItem")]
public RelatedItemsRelatedItem[] RelatedItem { get; set; }
}
public class RelatedItemsRelatedItem
{
public RelatedItemsRelatedItemItem Item { get; set; }
}
public class RelatedItemsRelatedItemItem
{
public string ASIN { get; set; }
}
}
|
namespace Nager.AmazonProductAdvertising.Model
{
public class RelatedItems
{
public string Relationship { get; set; }
public string RelationshipType { get; set; }
public byte RelatedItemCount { get; set; }
public byte RelatedItemPageCount { get; set; }
public byte RelatedItemPage { get; set; }
public RelatedItemsRelatedItem[] RelatedItem { get; set; }
}
public class RelatedItemsRelatedItem
{
public RelatedItemsRelatedItemItem Item { get; set; }
}
public class RelatedItemsRelatedItemItem
{
public string ASIN { get; set; }
}
}
|
mit
|
C#
|
e5b12cba292d239091286648b5599c1edfb37a06
|
Fix nuget starter example code file
|
Thraka/SadConsole
|
nuget/content-files/program-example.cs
|
nuget/content-files/program-example.cs
|
using System;
using SadConsole;
using Console = SadConsole.Console;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace MyProject
{
class Program
{
public const int Width = 80;
public const int Height = 25;
static void Main(string[] args)
{
// Setup the engine and create the main window.
SadConsole.Game.Create("IBM.font", Width, Height);
// Hook the start event so we can add consoles to the system.
SadConsole.Game.OnInitialize = Init;
// Start the game.
SadConsole.Game.Instance.Run();
//
// Code here will not run until the game window closes.
//
SadConsole.Game.Instance.Dispose();
}
private static void Init()
{
// Any startup code for your game. We will use an example console for now
Console startingConsole = new Console(Width, Height);
startingConsole.FillWithRandomGarbage();
startingConsole.Fill(new Rectangle(3, 3, 27, 5), null, Color.Black, 0, SpriteEffects.None);
startingConsole.Print(6, 5, "Hello from SadConsole", ColorAnsi.CyanBright);
// Set our new console as the main object SadConsole processes
SadConsole.Global.CurrentScreen = startingConsole;
}
}
}
|
using System;
using SadConsole;
using Console = SadConsole.Console;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace MyProject
{
class Program
{
public const int Width = 80;
public const int Height = 25;
static void Main(string[] args)
{
// Setup the engine and creat the main window.
SadConsole.Game.Create("IBM.font", Width, Height);
// Hook the start event so we can add consoles to the system.
SadConsole.Game.OnInitialize = Init;
// Hook the update event that happens each frame so we can trap keys and respond.
SadConsole.Game.OnUpdate = Update;
// Start the game.
SadConsole.Game.Instance.Run();
//
// Code here will not run until the game window closes.
//
SadConsole.Game.Instance.Dispose();
}
private static void Update(GameTime time)
{
// Called each logic update.
// As an example, we'll use the F5 key to make the game full screen
if (SadConsole.Global.KeyboardState.IsKeyReleased(Microsoft.Xna.Framework.Input.Keys.F5))
{
SadConsole.Settings.ToggleFullScreen();
}
}
private static void Init()
{
// Any custom loading and prep. We will use a sample console for now
Console startingConsole = new Console(Width, Height);
startingConsole.FillWithRandomGarbage();
startingConsole.Fill(new Rectangle(3, 3, 27, 5), null, Color.Black, 0, SpriteEffects.None);
startingConsole.Print(6, 5, "Hello from SadConsole", ColorAnsi.CyanBright);
// Set our new console as the thing to render and process
SadConsole.Global.CurrentScreen = startingConsole;
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.