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 |
---|---|---|---|---|---|---|---|---|
1fce999d3a6d8092442173ae6de978cb901ae788 | Remove Pop Start/Finish debug timing text... | roflkins/IdentityModel.OidcClient2,roflkins/IdentityModel.OidcClient2 | src/IdentityModel.OidcClient/PopTokenExtensions.cs | src/IdentityModel.OidcClient/PopTokenExtensions.cs | using System;
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Cryptography;
using System.Threading.Tasks;
namespace IdentityModel.OidcClient
{
public static class PopTokenExtensions
{
/// <summary>
/// Outputs a signed B64 string for the token specified, using the key attached to the token.
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
public static string ToSignedB64String(this JwtSecurityToken token)
{
var handler = new JwtSecurityTokenHandler();
handler.OutboundClaimTypeMap.Clear();
return handler.WriteToken(token);
}
/// <summary>
/// Returns a new provider and JWK for signing pop tokens. Can be pre-called and passed to the login flow to diminish the visible time this is generating a key to users.
/// </summary>
/// <returns>The provider for pop token async.</returns>
public static Task<RsaSecurityKey> CreateProviderForPopTokenAsync()
{
return Task.Run(() =>
{
var rsa = RSA.Create();
if (rsa.KeySize < 2048)
{
rsa.Dispose();
rsa = new RSACryptoServiceProvider(2048);
}
RsaSecurityKey key = null;
if (rsa is RSACryptoServiceProvider)
{
key = new RsaSecurityKey(rsa);
}
else
{
key = new RsaSecurityKey(rsa);
}
key.Rsa.ExportParameters(false);
key.KeyId = CryptoRandom.CreateUniqueId();
return key;
});
}
public static Jwk.JsonWebKey ToJwk(this RsaSecurityKey key)
{
var param = key.Rsa.ExportParameters(false);
var exponent = Base64Url.Encode(param.Exponent);
var modulus = Base64Url.Encode(param.Modulus);
var webKey = new Jwk.JsonWebKey
{
Kty = "RSA",
Alg = "RS256",
Kid = key.KeyId,
E = exponent,
N = modulus,
};
return webKey;
}
}
}
| using System;
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Cryptography;
using System.Threading.Tasks;
namespace IdentityModel.OidcClient
{
public static class PopTokenExtensions
{
/// <summary>
/// Outputs a signed B64 string for the token specified, using the key attached to the token.
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
public static string ToSignedB64String(this JwtSecurityToken token)
{
var handler = new JwtSecurityTokenHandler();
handler.OutboundClaimTypeMap.Clear();
return handler.WriteToken(token);
}
/// <summary>
/// Returns a new provider and JWK for signing pop tokens. Can be pre-called and passed to the login flow to diminish the visible time this is generating a key to users.
/// </summary>
/// <returns>The provider for pop token async.</returns>
public static Task<RsaSecurityKey> CreateProviderForPopTokenAsync()
{
return Task.Run(() =>
{
System.Console.WriteLine("START");
var rsa = RSA.Create();
if (rsa.KeySize < 2048)
{
rsa.Dispose();
rsa = new RSACryptoServiceProvider(2048);
}
RsaSecurityKey key = null;
if (rsa is RSACryptoServiceProvider)
{
key = new RsaSecurityKey(rsa);
}
else
{
key = new RsaSecurityKey(rsa);
}
key.Rsa.ExportParameters(false);
key.KeyId = CryptoRandom.CreateUniqueId();
System.Console.WriteLine("FINISH");
return key;
});
}
public static Jwk.JsonWebKey ToJwk(this RsaSecurityKey key)
{
var param = key.Rsa.ExportParameters(false);
var exponent = Base64Url.Encode(param.Exponent);
var modulus = Base64Url.Encode(param.Modulus);
var webKey = new Jwk.JsonWebKey
{
Kty = "RSA",
Alg = "RS256",
Kid = key.KeyId,
E = exponent,
N = modulus,
};
return webKey;
}
}
}
| apache-2.0 | C# |
3a47243df6e4ffcc0c42f3a4621e47faf7969dc9 | Add Scale property | sakapon/KLibrary-Labs | UILab/UI/UI/Converters/ScaleConverter.cs | UILab/UI/UI/Converters/ScaleConverter.cs | using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace KLibrary.Labs.UI.Converters
{
[ValueConversion(typeof(double), typeof(double))]
public class ScaleConverter : DependencyObject, IValueConverter
{
public static readonly DependencyProperty ScaleProperty =
DependencyProperty.Register("Scale", typeof(double), typeof(ScaleConverter), new PropertyMetadata(1.0));
public double Scale
{
get { return (double)GetValue(ScaleProperty); }
set { SetValue(ScaleProperty, value); }
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var valueD = ToValue(value);
return valueD.HasValue
? valueD * Scale
: DependencyProperty.UnsetValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
var valueD = ToValue(value);
return valueD.HasValue
? valueD / Scale
: DependencyProperty.UnsetValue;
}
static double? ToValue(object o)
{
try
{
return System.Convert.ToDouble(o);
}
catch (Exception)
{
return null;
}
}
}
}
| using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace KLibrary.Labs.UI.Converters
{
// TODO: Add Scale property.
[ValueConversion(typeof(double), typeof(double))]
public class ScaleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var valueD = ToValue(value);
var scale = ToScale(parameter);
return valueD.HasValue ? valueD * scale : DependencyProperty.UnsetValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
var valueD = ToValue(value);
var scale = ToScale(parameter);
return valueD.HasValue && scale != 0.0 ? valueD / scale : DependencyProperty.UnsetValue;
}
static double? ToValue(object o)
{
try
{
return System.Convert.ToDouble(o);
}
catch (Exception)
{
return null;
}
}
static double ToScale(object o)
{
try
{
return o == null ? 1.0 : System.Convert.ToDouble(o);
}
catch (Exception)
{
return 1.0;
}
}
}
}
| mit | C# |
1829ece4bc8de79d0526590f7d9b0777dfdc7316 | Add copyright | moljac/Xamarin.Mobile,orand/Xamarin.Mobile,xamarin/Xamarin.Mobile,haithemaraissia/Xamarin.Mobile,nexussays/Xamarin.Mobile,xamarin/Xamarin.Mobile | WindowsRT/Xamarin.Mobile/Properties/AssemblyInfo.cs | WindowsRT/Xamarin.Mobile/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("Xamarin.Mobile")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Xamarin Inc.")]
[assembly: AssemblyProduct("Xamarin.Mobile")]
[assembly: AssemblyCopyright("Copyright © Xamarin Inc. 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)] | 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("Xamarin.Mobile")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Xamarin.Mobile")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)] | apache-2.0 | C# |
e767c405b46e3b8121864d193799466f912b303c | Fix bug: wrong test for cancellation | chromium/vs-chromium,chromium/vs-chromium,chromium/vs-chromium,chromium/vs-chromium | src/VsChromium/ServerProxy/FileSystemTreeSource.cs | src/VsChromium/ServerProxy/FileSystemTreeSource.cs | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
using System;
using System.ComponentModel.Composition;
using VsChromium.Core.Ipc;
using VsChromium.Core.Ipc.TypedMessages;
using VsChromium.Threads;
namespace VsChromium.ServerProxy {
[Export(typeof(IFileSystemTreeSource))]
public class FileSystemTreeSource : IFileSystemTreeSource {
private readonly ITypedRequestProcessProxy _proxy;
private readonly IDelayedOperationProcessor _delayedOperationProcessor;
[ImportingConstructor]
public FileSystemTreeSource(ITypedRequestProcessProxy proxy, IDelayedOperationProcessor delayedOperationProcessor) {
_proxy = proxy;
_delayedOperationProcessor = delayedOperationProcessor;
_proxy.EventReceived += ProxyOnEventReceived;
}
public void Fetch() {
FetchFileSystemTree();
}
public event Action<FileSystemTree> TreeReceived;
public event Action<ErrorResponse> ErrorReceived;
private void ProxyOnEventReceived(TypedEvent typedEvent) {
var evt = typedEvent as FileSystemScanFinished;
if (evt != null) {
// Don't fetch new tree if the operation was cancelled
if (evt.Error == null || !evt.Error.IsOperationCanceled()) {
_delayedOperationProcessor.Post(new DelayedOperation {
Id = "FetchFileSystemTree",
Delay = TimeSpan.FromSeconds(0.1),
Action = FetchFileSystemTree
});
}
}
}
private void FetchFileSystemTree() {
_proxy.RunAsync(
new GetFileSystemRequest(),
typedResponse => {
var response = (GetFileSystemResponse)typedResponse;
OnTreeReceived(response.Tree);
},
OnErrorReceived);
}
protected virtual void OnErrorReceived(ErrorResponse obj) {
var handler = ErrorReceived;
if (handler != null) handler(obj);
}
protected virtual void OnTreeReceived(FileSystemTree obj) {
var handler = TreeReceived;
if (handler != null) handler(obj);
}
}
} | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
using System;
using System.ComponentModel.Composition;
using VsChromium.Core.Ipc;
using VsChromium.Core.Ipc.TypedMessages;
using VsChromium.Threads;
namespace VsChromium.ServerProxy {
[Export(typeof(IFileSystemTreeSource))]
public class FileSystemTreeSource : IFileSystemTreeSource {
private readonly ITypedRequestProcessProxy _proxy;
private readonly IDelayedOperationProcessor _delayedOperationProcessor;
[ImportingConstructor]
public FileSystemTreeSource(ITypedRequestProcessProxy proxy, IDelayedOperationProcessor delayedOperationProcessor) {
_proxy = proxy;
_delayedOperationProcessor = delayedOperationProcessor;
_proxy.EventReceived += ProxyOnEventReceived;
}
public void Fetch() {
FetchFileSystemTree();
}
public event Action<FileSystemTree> TreeReceived;
public event Action<ErrorResponse> ErrorReceived;
private void ProxyOnEventReceived(TypedEvent typedEvent) {
var evt = typedEvent as FileSystemScanFinished;
if (evt != null) {
// Don't fetch new tree if the operation was cancelled
if (evt.Error != null && !evt.Error.IsOperationCanceled()) {
_delayedOperationProcessor.Post(new DelayedOperation {
Id = "FetchFileSystemTree",
Delay = TimeSpan.FromSeconds(0.1),
Action = FetchFileSystemTree
});
}
}
}
private void FetchFileSystemTree() {
_proxy.RunAsync(
new GetFileSystemRequest(),
typedResponse => {
var response = (GetFileSystemResponse)typedResponse;
OnTreeReceived(response.Tree);
},
OnErrorReceived);
}
protected virtual void OnErrorReceived(ErrorResponse obj) {
var handler = ErrorReceived;
if (handler != null) handler(obj);
}
protected virtual void OnTreeReceived(FileSystemTree obj) {
var handler = TreeReceived;
if (handler != null) handler(obj);
}
}
} | bsd-3-clause | C# |
4932948a4d17dbecf9c57f5f317c92d29c1b4fca | fix indent | sdcb/sdmap | sdmap/src/sdmap.vstool/Tagger/Antlr/SdmapLexer.cs | sdmap/src/sdmap.vstool/Tagger/Antlr/SdmapLexer.cs | using Antlr4.Runtime;
using Microsoft.VisualStudio.Text;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace sdmap.Vstool.Tagger.Antlr
{
[Export(typeof(ISdmapLexerHelper))]
class SdmapLexerHelper : ISdmapLexerHelper
{
public IEnumerable<SpannedToken> GetTokens(IEnumerable<string> segments, int offset)
{
var lexer = new Parser.G4.SdmapLexer(new UnbufferedCharStream(new TextSegmentsCharStream(segments)));
while (true)
{
IToken current = null;
try
{
current = lexer.NextToken();
if (current.Type == Parser.G4.SdmapLexer.Eof)
break;
}
catch (InvalidOperationException e)
when (e.HResult == -2146233079) // stack empty
{
}
if (current != null)
{
yield return new SpannedToken(
current.Type,
new Span(current.StartIndex + offset, current.StopIndex - current.StartIndex + 1));
}
}
}
}
}
| using Antlr4.Runtime;
using Microsoft.VisualStudio.Text;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace sdmap.Vstool.Tagger.Antlr
{
[Export(typeof(ISdmapLexerHelper))]
class SdmapLexerHelper : ISdmapLexerHelper
{
public IEnumerable<SpannedToken> GetTokens(IEnumerable<string> segments, int offset)
{
var lexer = new Parser.G4.SdmapLexer(new UnbufferedCharStream(new TextSegmentsCharStream(segments)));
while (true)
{
IToken current = null;
try
{
current = lexer.NextToken();
if (current.Type == Parser.G4.SdmapLexer.Eof)
break;
}
catch (InvalidOperationException e)
when (e.HResult == -2146233079) // stack empty
{
}
if (current != null)
{
yield return new SpannedToken(
current.Type,
new Span(current.StartIndex + offset, current.StopIndex - current.StartIndex + 1));
}
}
}
}
}
| mit | C# |
de399738ede64823bb8503a802d9108376c1fbe6 | fix update sdk version number | NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity | ncmb_unity/Assets/NCMB/Script/CommonConstant.cs | ncmb_unity/Assets/NCMB/Script/CommonConstant.cs | /*******
Copyright 2017 FUJITSU CLOUD TECHNOLOGIES LIMITED All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**********/
using System.Collections;
namespace NCMB.Internal
{
//通信種別
internal enum ConnectType
{
//GET通信
GET,
//POST通信
POST,
//PUT通信
PUT,
//DELETE通信
DELETE
}
/// <summary>
/// 定数を定義する共通用のクラスです
/// </summary>
internal static class CommonConstant
{
//service
public static readonly string DOMAIN = "mb.api.cloud.nifty.com";//ドメイン
public static readonly string DOMAIN_URL = "https://mb.api.cloud.nifty.com";//ドメインのURL
public static readonly string API_VERSION = "2013-09-01";//APIバージョン
public static readonly string SDK_VERSION = "3.2.2"; //SDKバージョン
//DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください
}
}
| /*******
Copyright 2017 FUJITSU CLOUD TECHNOLOGIES LIMITED All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**********/
using System.Collections;
namespace NCMB.Internal
{
//通信種別
internal enum ConnectType
{
//GET通信
GET,
//POST通信
POST,
//PUT通信
PUT,
//DELETE通信
DELETE
}
/// <summary>
/// 定数を定義する共通用のクラスです
/// </summary>
internal static class CommonConstant
{
//service
public static readonly string DOMAIN = "mb.api.cloud.nifty.com";//ドメイン
public static readonly string DOMAIN_URL = "https://mb.api.cloud.nifty.com";//ドメインのURL
public static readonly string API_VERSION = "2013-09-01";//APIバージョン
public static readonly string SDK_VERSION = "3.2.1"; //SDKバージョン
//DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください
}
}
| apache-2.0 | C# |
9963a8519f49453323769960d6bd2d99597010cc | Set version to 1.2 | ccellar/mite.net,ccellar/mite.net | trunk/CodeBase/mite.net/Properties/AssemblyInfo.cs | trunk/CodeBase/mite.net/Properties/AssemblyInfo.cs | //-----------------------------------------------------------------------
// <copyright>
// This software is licensed as Microsoft Public License (Ms-PL).
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("mite.net api")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("langalaxy.de - Christoph Keller")]
[assembly: AssemblyProduct("mite.net api")]
[assembly: AssemblyCopyright("Copyright © 2009-2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("38bae65a-c8f3-44d8-be2e-c18fa2fd24a5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: InternalsVisibleTo("mite.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b3f0c2a3e38550ea1b998ff7787f727666886373a8e22ef1ff3ebef7dc79f9eb12b46f0e530194ee06e07bad385b0ec876c88618dee7dbd6c24c938625e83a636f693f283aead9b1615fffaa63ed0b08596a48efa17568b9a6f5712b81d3eb92e0669623e9e75f87e42d456aa33f9a7645d4a864bb961e267d06d95880524cc6")]
[assembly: CLSCompliant(true)]
| //-----------------------------------------------------------------------
// <copyright>
// This software is licensed as Microsoft Public License (Ms-PL).
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("mite .net api")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("langalaxy.de - Christoph Keller")]
[assembly: AssemblyProduct("mite .net api")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("38bae65a-c8f3-44d8-be2e-c18fa2fd24a5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: InternalsVisibleTo("mite.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b3f0c2a3e38550ea1b998ff7787f727666886373a8e22ef1ff3ebef7dc79f9eb12b46f0e530194ee06e07bad385b0ec876c88618dee7dbd6c24c938625e83a636f693f283aead9b1615fffaa63ed0b08596a48efa17568b9a6f5712b81d3eb92e0669623e9e75f87e42d456aa33f9a7645d4a864bb961e267d06d95880524cc6")]
[assembly: CLSCompliant(true)]
| bsd-3-clause | C# |
9b8184c7d90defef736e087a758b70be7fd65f52 | Fix assertion, need to check if it's not null first. | gael-ltd/NEventStore | src/NEventStore.Tests/DefaultSerializationWireupTests.cs | src/NEventStore.Tests/DefaultSerializationWireupTests.cs | namespace NEventStore
{
using FluentAssertions;
using NEventStore.Persistence.AcceptanceTests;
using NEventStore.Persistence.AcceptanceTests.BDD;
using System;
using Xunit;
public class DefaultSerializationWireupTests
{
public class when_building_an_event_store_without_an_explicit_serializer : SpecificationBase
{
private Wireup _wireup;
private Exception _exception;
private IStoreEvents _eventStore;
protected override void Context()
{
_wireup = Wireup.Init()
.UsingSqlPersistence("fakeConnectionString")
.WithDialect(new Persistence.Sql.SqlDialects.MsSqlDialect());
}
protected override void Because()
{
_exception = Catch.Exception(() => { _eventStore = _wireup.Build(); });
}
protected override void Cleanup()
{
_eventStore.Dispose();
}
[Fact]
public void should_not_throw_an_argument_null_exception()
{
if (_exception != null)
{
_exception.GetType().Should().NotBe<ArgumentNullException>();
}
}
}
}
}
| namespace NEventStore
{
using FluentAssertions;
using NEventStore.Persistence.AcceptanceTests;
using NEventStore.Persistence.AcceptanceTests.BDD;
using System;
using Xunit;
public class DefaultSerializationWireupTests
{
public class when_building_an_event_store_without_an_explicit_serializer : SpecificationBase
{
private Wireup _wireup;
private Exception _exception;
private IStoreEvents _eventStore;
protected override void Context()
{
_wireup = Wireup.Init()
.UsingSqlPersistence("fakeConnectionString")
.WithDialect(new Persistence.Sql.SqlDialects.MsSqlDialect());
}
protected override void Because()
{
_exception = Catch.Exception(() => { _eventStore = _wireup.Build(); });
}
protected override void Cleanup()
{
_eventStore.Dispose();
}
[Fact]
public void should_not_throw_an_argument_null_exception()
{
_exception.GetType().Should().NotBe(typeof(ArgumentNullException));
}
}
}
}
| mit | C# |
a0265b82a84105f1ed51fb04912f97392edaf1cd | Fix for bug #6: The SimpleBatch.TableAttribute should not have a public name setter | Azure/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,Azure/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk | src/Microsoft.WindowsAzure.Jobs/TableAttribute.cs | src/Microsoft.WindowsAzure.Jobs/TableAttribute.cs | using System;
using System.Globalization;
namespace Microsoft.WindowsAzure.Jobs
{
/// <summary>
/// Represents an attribute that is used to provide details about how a Windows Azure Table is
/// bound as a method parameter for input and output.
/// The method parameter type by default can be either an IDictionary<Tuple<string,string>, object> or
/// an IDictionary<Tuple<string,string>, UserDefinedType>.
/// The two properties of the Tuple key represent the partition key and row key, respectively.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public class TableAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the TableAttribute class.
/// </summary>
public TableAttribute()
{
}
/// <summary>
/// Initializes a new instance of the TableAttribute class.
/// </summary>
/// <param name="tableName">If empty, the name of the method parameter is used
/// as the table name.</param>
public TableAttribute(string tableName)
{
TableName = tableName;
}
// Beware of table name restrictions.
/// <summary>
/// Gets the name of the table to bind to. If empty, the name of the method parameter is used
/// as the table name.
/// </summary>
public string TableName { get; private set; }
/// <inheritdoc />
public override string ToString()
{
return String.Format(CultureInfo.InvariantCulture, "[Table{0})]", TableName);
}
}
}
| using System;
using System.Globalization;
namespace Microsoft.WindowsAzure.Jobs
{
/// <summary>
/// Represents an attribute that is used to provide details about how a Windows Azure Table is
/// bound as a method parameter for input and output.
/// The method parameter type by default can be either an IDictionary<Tuple<string,string>, object> or
/// an IDictionary<Tuple<string,string>, UserDefinedType>.
/// The two properties of the Tuple key represent the partition key and row key, respectively.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public class TableAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the TableAttribute class.
/// </summary>
/// <param name="tableName">If empty, the name of the method parameter is used
/// as the table name.</param>
public TableAttribute(string tableName)
{
TableName = tableName;
}
// Beware of table name restrictions.
/// <summary>
/// Gets or sets the name of the table to bind to. If empty, the name of the method parameter is used
/// as the table name.
/// </summary>
public string TableName { get; set; }
/// <inheritdoc />
public override string ToString()
{
return String.Format(CultureInfo.InvariantCulture, "[Table{0})]", TableName);
}
}
}
| mit | C# |
c6863cfbbb1ade642aca6962a94c795d15f14ede | Add back operator== and operator!= | peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework | osu.Framework/Localisation/LocalisableString.cs | osu.Framework/Localisation/LocalisableString.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;
#nullable enable
namespace osu.Framework.Localisation
{
/// <summary>
/// A descriptor representing text that can be localised and formatted.
/// </summary>
public readonly struct LocalisableString : IEquatable<LocalisableString>
{
/// <summary>
/// The underlying data, can be <see cref="string"/>, <see cref="TranslatableString"/>, or <see cref="RomanisableString"/>.
/// </summary>
internal readonly object? Data;
private LocalisableString(object data) => Data = data;
// it's somehow common to call default(LocalisableString), and we should return empty string then.
public override string ToString() => Data?.ToString() ?? string.Empty;
public bool Equals(LocalisableString other) => LocalisableStringEqualityComparer.Default.Equals(this, other);
public override bool Equals(object? obj) => obj is LocalisableString other && Equals(other);
public override int GetHashCode() => LocalisableStringEqualityComparer.Default.GetHashCode(this);
public static implicit operator LocalisableString(string text) => new LocalisableString(text);
public static implicit operator LocalisableString(TranslatableString translatable) => new LocalisableString(translatable);
public static implicit operator LocalisableString(RomanisableString romanisable) => new LocalisableString(romanisable);
public static bool operator ==(LocalisableString left, LocalisableString right) => left.Equals(right);
public static bool operator !=(LocalisableString left, LocalisableString right) => !left.Equals(right);
}
}
| // 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;
#nullable enable
namespace osu.Framework.Localisation
{
/// <summary>
/// A descriptor representing text that can be localised and formatted.
/// </summary>
public readonly struct LocalisableString : IEquatable<LocalisableString>
{
/// <summary>
/// The underlying data, can be <see cref="string"/>, <see cref="TranslatableString"/>, or <see cref="RomanisableString"/>.
/// </summary>
internal readonly object? Data;
private LocalisableString(object data) => Data = data;
// it's somehow common to call default(LocalisableString), and we should return empty string then.
public override string ToString() => Data?.ToString() ?? string.Empty;
public bool Equals(LocalisableString other) => LocalisableStringEqualityComparer.Default.Equals(this, other);
public override bool Equals(object? obj) => obj is LocalisableString other && Equals(other);
public override int GetHashCode() => LocalisableStringEqualityComparer.Default.GetHashCode(this);
public static implicit operator LocalisableString(string text) => new LocalisableString(text);
public static implicit operator LocalisableString(TranslatableString translatable) => new LocalisableString(translatable);
public static implicit operator LocalisableString(RomanisableString romanisable) => new LocalisableString(romanisable);
}
}
| mit | C# |
9ce5d77a0d19787f1431eea0a66096ab597fd54b | fix in List view | sdl/dxa-web-application-dotnet,sdl/dxa-web-application-dotnet | Site/Views/List/Core/List.cshtml | Site/Views/List/Core/List.cshtml | @model Sdl.Web.Mvc.Models.ContentList<Teaser>
<div @Markup.Entity(Model)>
@if (Model.Headline!=null)
{
<h3 @Markup.Property(Model,"Headline")>@Model.Headline</h3>
}
<ul>
@foreach (var item in Model.ItemListElements)
{
<li>
@if (item.Link != null && item.Link.Url != null)
{
<a href="@item.Link.Url">
@item.Headline
</a>
}
else
{
@item.Headline
}
@if (item.Date != null)
{
<time class="meta small">[@Html.DateDiff(item.Date)]</time>
}
</li>
}
</ul>
</div>
| @model Sdl.Web.Mvc.Models.ContentList<Teaser>
<div @Markup.Entity(Model)>
@if (Model.Headline!=null)
{
<h3 @Markup.Property(Model,"Headline")>@Model.Headline</h3>
}
<ul>
@foreach (var item in Model.ItemListElements)
{
<li>
@if (item.Link.Url!=null)
{
<a href="@item.Link.Url">
@item.Headline
</a>
}
else
{
@item.Headline
}
@if (item.Date != null)
{
<time class="meta small">[@Html.DateDiff(item.Date)]</time>
}
</li>
}
</ul>
</div>
| apache-2.0 | C# |
1fbc47f75857140072163b960ce0392d3f0e1910 | Change library command line option | MHeasell/SnappyMap,MHeasell/SnappyMap | SnappyMap/CommandLine/Options.cs | SnappyMap/CommandLine/Options.cs | namespace SnappyMap.CommandLine
{
using System.Collections.Generic;
using global::CommandLine;
using global::CommandLine.Text;
public class Options
{
[Option('s', "size", DefaultValue = "8x8", HelpText = "Set the size of the output map.")]
public string Size { get; set; }
[Option('t', "tileset-dir", DefaultValue = "tilesets", HelpText = "Set the directory to search for tilesets in.")]
public string LibraryPath { get; set; }
[Option('c', "config", DefaultValue = "config.xml", HelpText = "Set the path to the section config file.")]
public string ConfigFile { get; set; }
[ValueList(typeof(List<string>), MaximumElements = 2)]
public IList<string> Items { get; set; }
[HelpOption]
public string GetUsage()
{
var help = new HelpText
{
Heading = new HeadingInfo("Snappy Map", "alpha"),
Copyright = new CopyrightInfo("Armoured Fish", 2014),
AddDashesToOption = true,
AdditionalNewLineAfterOption = true,
};
help.AddPreOptionsLine(string.Format("Usage: {0} [-s NxM] [-l <library_path>] [-c <config_file>] <input_file> [output_file]", "SnappyMap"));
help.AddOptions(this);
return help;
}
}
}
| namespace SnappyMap.CommandLine
{
using System.Collections.Generic;
using global::CommandLine;
using global::CommandLine.Text;
public class Options
{
[Option('s', "size", DefaultValue = "8x8", HelpText = "Set the size of the output map.")]
public string Size { get; set; }
[Option('l', "library", DefaultValue = "library", HelpText = "Set the directory to search for tilesets in.")]
public string LibraryPath { get; set; }
[Option('c', "config", DefaultValue = "config.xml", HelpText = "Set the path to the section config file.")]
public string ConfigFile { get; set; }
[ValueList(typeof(List<string>), MaximumElements = 2)]
public IList<string> Items { get; set; }
[HelpOption]
public string GetUsage()
{
var help = new HelpText
{
Heading = new HeadingInfo("Snappy Map", "alpha"),
Copyright = new CopyrightInfo("Armoured Fish", 2014),
AddDashesToOption = true,
AdditionalNewLineAfterOption = true,
};
help.AddPreOptionsLine(string.Format("Usage: {0} [-s NxM] [-l <library_path>] [-c <config_file>] <input_file> [output_file]", "SnappyMap"));
help.AddOptions(this);
return help;
}
}
}
| mit | C# |
e8f9dccd2b7cd975a9b1dcb371a8bce860cb0732 | Add the RequiresSta property. | averrunci/Carna | Source/Carna/FixtureAttribute.cs | Source/Carna/FixtureAttribute.cs | // Copyright (C) 2017-2020 Fievus
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
using System;
namespace Carna
{
/// <summary>
/// A base attribute that is applied to a fixture used by Carna.
/// </summary>
public abstract class FixtureAttribute : Attribute
{
/// <summary>
/// Gets or sets a value that indicates whether a fixture specified by this attribute
/// is a root fixture.
/// </summary>
public bool IsRootFixture { get; set; }
/// <summary>
/// Gets a value that indicates whether a fixture specified by this attribute
/// is a container fixture.
/// </summary>
public abstract bool IsContainerFixture { get; }
/// <summary>
/// Gets a value that indicates whether fixtures in a fixture specified by this attribute
/// can be run in parallel.
/// </summary>
public bool CanRunParallel { get; set; }
/// <summary>
/// Gets a description of a fixture specified by this attribute.
/// </summary>
public string Description { get; }
/// <summary>
/// Gets a tag about a fixture specified by this attribute.
/// </summary>
public string Tag { get; set; }
/// <summary>
/// Gets a benefit about a fixture specified by this attribute.
/// </summary>
public string Benefit { get; set; }
/// <summary>
/// Gets a role about a fixture specified by this attribute.
/// </summary>
public string Role { get; set; }
/// <summary>
/// Gets a feature about a fixture specified by this attribute.
/// </summary>
public string Feature { get; set; }
/// <summary>
/// Gets a value that indicates whether to run a fixture in a single thread apartment.
/// </summary>
public bool RequiresSta { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="FixtureAttribute"/> class.
/// </summary>
protected FixtureAttribute()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FixtureAttribute"/> class
/// with the specified description of a fixture specified by this attribute.
/// </summary>
/// <param name="description">
/// The description of a fixture specified by this attribute.
/// </param>
protected FixtureAttribute(string description)
{
Description = description;
}
}
}
| // Copyright (C) 2017 Fievus
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
using System;
namespace Carna
{
/// <summary>
/// A base attribute that is applied to a fixture used by Carna.
/// </summary>
public abstract class FixtureAttribute : Attribute
{
/// <summary>
/// Gets or sets a value that indicates whether a fixture specified by this attribute
/// is a root fixture.
/// </summary>
public bool IsRootFixture { get; set; }
/// <summary>
/// Gets a value that indicates whether a fixture specified by this attribute
/// is a container fixture.
/// </summary>
public abstract bool IsContainerFixture { get; }
/// <summary>
/// Gets a value that indicates whether fixtures in a fixture specified by this attribute
/// can be run in parallel.
/// </summary>
public bool CanRunParallel { get; set; }
/// <summary>
/// Gets a description of a fixture specified by this attribute.
/// </summary>
public string Description { get; }
/// <summary>
/// Gets a tag about a fixture specified by this attribute.
/// </summary>
public string Tag { get; set; }
/// <summary>
/// Gets a benefit about a fixture specified by this attribute.
/// </summary>
public string Benefit { get; set; }
/// <summary>
/// Gets a role about a fixture specified by this attribute.
/// </summary>
public string Role { get; set; }
/// <summary>
/// Gets a feature about a fixture specified by this attribute.
/// </summary>
public string Feature { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="FixtureAttribute"/> class.
/// </summary>
protected FixtureAttribute()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FixtureAttribute"/> class
/// with the specified description of a fixture specified by this attribute.
/// </summary>
/// <param name="description">
/// The description of a fixture specified by this attribute.
/// </param>
protected FixtureAttribute(string description)
{
Description = description;
}
}
}
| mit | C# |
def804300c4c961698b3f25cf2335b4d4a80b9b6 | Update assembly to version 0. | SeanKilleen/Sieve.NET | src/app/Sieve.NET.Core/Properties/AssemblyInfo.cs | src/app/Sieve.NET.Core/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("Sieve.NET.Core")]
[assembly: AssemblyDescription("An expression-based filtering library for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sieve.NET.Core")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fe4a2ebf-8685-4948-87f4-56fe7d986c5a")]
// 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.0.0.0")]
[assembly: AssemblyFileVersion("0.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("Sieve.NET.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sieve.NET.Core")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fe4a2ebf-8685-4948-87f4-56fe7d986c5a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
cfa0657b491a3f8a68bccd5c432736465d456418 | Update index.cshtml (#411) | reactiveui/website,reactiveui/website,reactiveui/website,reactiveui/website | input/slack/index.cshtml | input/slack/index.cshtml | <meta http-equiv="refresh" content="1;url=https://join.slack.com/t/reactivex/shared_invite/enQtMzM2NzIxNTg0MTYxLTdiMzRhZGI3MDA4NWVkMzZiZTA3MGNhODQ4MDFjZGM2M2JiNmNkZTM2NzMyNDE3ZTIyZGJlMmU0OTVkOWJmYzU" />
Join by visiting <a href="https://join.slack.com/t/reactivex/shared_invite/enQtMzM2NzIxNTg0MTYxLTdiMzRhZGI3MDA4NWVkMzZiZTA3MGNhODQ4MDFjZGM2M2JiNmNkZTM2NzMyNDE3ZTIyZGJlMmU0OTVkOWJmYzU">Slack</a>
| <meta http-equiv="refresh" content="1;url=mailto:hello@reactiveui.net?subject%3D%22Howdy%2C%20can%20you%20send%20me%20an%20invite%20to%20Slack%3F%22" />
Send an email to <a href="mailto:hello@reactiveui.net?subject%3D%22Howdy%2C%20can%20you%20send%20me%20an%20invite%20to%20Slack%3F%22">hello@reactiveui.net</a> to obtain an invitation to our Slack organization. Sit tight, it's worth it.
| mit | C# |
4b551b20e6952537f290273e06ff1f547a866ed5 | Load cadence constraint file to PCB-Investigator | sts-CAD-Software/PCB-Investigator-Scripts | Cadence/LoadCadenceNetGroups.cs | Cadence/LoadCadenceNetGroups.cs | //Synchronous template
//-----------------------------------------------------------------------------------
// PCB-Investigator Automation Script
// Created on 29.06.2016
// Autor Guenther
//
// Empty template to fill for synchronous script.
//-----------------------------------------------------------------------------------
// GUID newScript_636028110537710508
using System;
using System.Collections.Generic;
using System.Text;
using PCBI.Plugin;
using PCBI.Plugin.Interfaces;
using System.Windows.Forms;
using System.Drawing;
using PCBI.Automation;
using System.IO;
using System.Drawing.Drawing2D;
using PCBI.MathUtils;
using System.Diagnostics;
namespace PCBIScript
{
public class PScript : IPCBIScript
{
public PScript()
{
}
public void Execute(IPCBIWindow parent)
{
//your code here
ProcessStartInfo psi = new ProcessStartInfo();
string realPCBI = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + System.IO.Path.DirectorySeparatorChar + "EasyLogix" + System.IO.Path.DirectorySeparatorChar + "PCB-Investigator" + Path.DirectorySeparatorChar + "Scripts" + Path.DirectorySeparatorChar;
psi.FileName = realPCBI + @"\CadenceNetGroup2PCBI.exe";
psi.Arguments = parent.GetODBJobDirectory() + " -step " + parent.GetCurrentStep().Name;
Process.Start(psi);
parent.UpdateView();
}
}
} | //Synchronous template
//-----------------------------------------------------------------------------------
// PCB-Investigator Automation Script
// Created on 29.06.2016
// Autor Guenther
//
// Empty template to fill for synchronous script.
//-----------------------------------------------------------------------------------
// GUID newScript_636028110537710508
using System;
using System.Collections.Generic;
using System.Text;
using PCBI.Plugin;
using PCBI.Plugin.Interfaces;
using System.Windows.Forms;
using System.Drawing;
using PCBI.Automation;
using System.IO;
using System.Drawing.Drawing2D;
using PCBI.MathUtils;
using System.Diagnostics;
namespace PCBIScript
{
public class PScript : IPCBIScript
{
public PScript()
{
}
public void Execute(IPCBIWindow parent)
{
//your code here
ProcessStartInfo psi = new ProcessStartInfo();
string realPCBI = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + System.IO.Path.DirectorySeparatorChar + "EasyLogix" + System.IO.Path.DirectorySeparatorChar + "PCB-Investigator" + Path.DirectorySeparatorChar + "Scripts" + Path.DirectorySeparatorChar;
psi.FileName = realPCBI + @"\CadanceNetGroup2PCBI.exe";
psi.Arguments = parent.GetODBJobDirectory() + " -step " + parent.GetCurrentStep().Name;
Process.Start(psi);
parent.UpdateView();
}
}
} | bsd-3-clause | C# |
2ac90c2e9fc351b39691b6d1f96e4f7ccf9cf9b5 | Remove unused code. Improvements | sdglhm/C-Location-Fetching-from-google | tt/Program.cs | tt/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web;
using System.Net;
using System.IO;
using RestSharp;
using tt;
namespace tt
{
class Program
{
static void Main(string[] args)
{
String lat = "6.908321";
String lang = "79.917448";
getLocationAddr(lat, lang);
}
public static String getLocationAddr(String lat,String lang)
{
String url = "http://maps.googleapis.com";
String urlParams = "/maps/api/geocode/json?latlng=" + lat + "," + lang;
var clientRest = new RestClient(new Uri(url));
var clientRequst = new RestRequest(new Uri(url+urlParams));
clientRequst.Method = Method.GET;
clientRequst.RequestFormat = DataFormat.Json;
RestResponse<RootObject> response = (RestResponse<RootObject>)clientRest.Execute<RootObject>(clientRequst);
RootObject x = (RootObject)response.Data;
Console.WriteLine(x.results[0].formatted_address);
return null;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web;
using System.Net;
using System.IO;
using RestSharp;
using tt;
namespace tt
{
class Program
{
static void Main(string[] args)
{
String lat = "6.908321";
String lang = "79.917448";
//String url = "http://maps.googleapis.com/maps/api/geocode/json";
String urlParams = "?latlang=" + lat + "," + lang;
getLocationAddr(lat, lang);
}
public static String getLocationAddr(String lat,String lang)
{
String url = "http://maps.googleapis.com";
String urlParams = "/maps/api/geocode/json?latlng=" + lat + "," + lang;
var clientRest = new RestClient(new Uri(url));
// clientRest.BaseUrl = new Uri(url);
var clientRequst = new RestRequest(new Uri(url+urlParams));
//clientRequst.Resource = new Uri(urlParams);
clientRequst.Method = Method.GET;
clientRequst.RequestFormat = DataFormat.Json;
RestResponse<RootObject> response = (RestResponse<RootObject>)clientRest.Execute<RootObject>(clientRequst);
RootObject x = (RootObject)response.Data;
Console.WriteLine(x.results[0].formatted_address);
// IRestResponse<RootObject> clientResponse = clientRest.Execute<RootObject>(clientRequst);
// System.IO.File.WriteAllText(@"C:\Users\Lahiru\Desktop\WriteText.txt", clientResponse.ToString());
//Console.WriteLine(clientResponse.ToString());
return "";
}
}
}
| apache-2.0 | C# |
120dffda5fb4ccc635a7ff0cb53e038f145a8bcb | Change parsing to only trigger on changed lines. | jcheng31/todoPad | TodoPad/Views/MainWindow.xaml.cs | TodoPad/Views/MainWindow.xaml.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using TodoPad.Models;
using TodoPad.Task_Parser;
namespace TodoPad.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void DocumentBoxTextChanged(object sender, TextChangedEventArgs e)
{
RichTextBox textBox = (RichTextBox)sender;
// Remove this handler so we don't trigger it when formatting.
textBox.TextChanged -= DocumentBoxTextChanged;
// Get the line that was changed.
foreach (TextChange currentChange in e.Changes)
{
TextPointer offSet = textBox.Document.ContentStart.GetPositionAtOffset(currentChange.Offset, LogicalDirection.Forward);
if (offSet != null)
{
Paragraph currentParagraph = offSet.Paragraph;
if (offSet.Parent == textBox.Document)
{
// Format the entire document.
currentParagraph = textBox.Document.Blocks.FirstBlock as Paragraph;
while (currentParagraph != null)
{
FormatParagraph(currentParagraph);
currentParagraph = currentParagraph.NextBlock as Paragraph;
}
}
else if (currentParagraph != null)
{
FormatParagraph(currentParagraph);
}
}
}
// Restore this handler.
textBox.TextChanged += DocumentBoxTextChanged;
}
private static void FormatParagraph(Paragraph currentParagraph)
{
// Get the text on this row.
TextPointer start = currentParagraph.ContentStart;
TextPointer end = currentParagraph.ContentEnd;
TextRange currentTextRange = new TextRange(start, end);
// Parse the row.
Row currentRow = new Row(currentTextRange.Text);
// Format the displayed text.
TaskParser.FormatTextRange(currentTextRange, currentRow);
}
}
}
| using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using TodoPad.Models;
using TodoPad.Task_Parser;
namespace TodoPad.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void DocumentBoxTextChanged(object sender, TextChangedEventArgs e)
{
RichTextBox textBox = (RichTextBox)sender;
// Remove this handler so we don't trigger it when formatting.
textBox.TextChanged -= DocumentBoxTextChanged;
Paragraph currentParagraph = textBox.Document.Blocks.FirstBlock as Paragraph;
while (currentParagraph != null)
{
// Get the text on this row.
TextPointer start = currentParagraph.ContentStart;
TextPointer end = currentParagraph.ContentEnd;
TextRange currentTextRange = new TextRange(start, end);
// Parse the row.
Row currentRow = new Row(currentTextRange.Text);
// Format the displayed text.
TaskParser.FormatTextRange(currentTextRange, currentRow);
currentParagraph = currentParagraph.NextBlock as Paragraph;
}
// Restore this handler.
textBox.TextChanged += DocumentBoxTextChanged;
}
}
}
| mit | C# |
5fcc561f1c2abe024600bfc296d95fa4253157d7 | add code to log succeed of Caching.CleanCache() at CachingCleanCache() | NDark/ndinfrastructure,NDark/ndinfrastructure | Unity/EditorTools/EditorTools.cs | Unity/EditorTools/EditorTools.cs | /**
MIT License
Copyright (c) 2017 NDark
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.
*/
/**
@file EditorTools.cs
@author NDark
@date 20170509 . file started.
*/
using UnityEngine;
public static partial class EditorTools
{
public static void CachingCleanCache()
{
if( Caching.CleanCache () )
{
Debug.Log("EditorTools::CachingCleanCache() succeed.");
}
else
{
Debug.LogWarning("EditorTools::CachingCleanCache() failed.");
}
}
public static void PlayerPrefsDeleteAll()
{
Debug.LogWarning("EditorTools::PlayerPrefsDeleteAll() remember this just remove PlayerPrefs of editor platform.");
PlayerPrefs.DeleteAll() ;
}
}
| /**
MIT License
Copyright (c) 2017 NDark
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.
*/
/**
@file EditorTools.cs
@author NDark
@date 20170509 . file started.
*/
using UnityEngine;
public static partial class EditorTools
{
public static void CachingCleanCache()
{
Debug.LogWarning("EditorTools::CachingCleanCache");
Caching.CleanCache() ;
}
public static void PlayerPrefsDeleteAll()
{
Debug.LogWarning("EditorTools::PlayerPrefsDeleteAll() remember this just remove PlayerPrefs of editor platform.");
PlayerPrefs.DeleteAll() ;
}
}
| mit | C# |
7f55524da579a496e0e8dda1284730d8f849dd24 | add directory search for ref assemblies | tziemek/WeeklyCurriculum | WeeklyCurriculum.Wpf/App.xaml.cs | WeeklyCurriculum.Wpf/App.xaml.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.Composition.Convention;
using System.Composition.Hosting;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
using log4net;
using WeeklyCurriculum.Components;
using WeeklyCurriculum.Contracts;
namespace WeeklyCurriculum.Wpf
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private ILog logger = LogManager.GetLogger(typeof(App));
private CompositionHost container;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
Application.Current.DispatcherUnhandledException += this.OnCurrentDispatcherUnhandledException;
var dlls = Directory
.GetFiles(Path.GetDirectoryName(typeof(App).Assembly.Location), "Weekly*.dll", SearchOption.TopDirectoryOnly);
var refAssemblies = dlls
.Select(Assembly.LoadFrom)
.ToList();
var configuration = new ContainerConfiguration()
.WithAssembly(typeof(App).GetTypeInfo().Assembly)
.WithAssemblies(refAssemblies)
;
this.container = configuration.CreateContainer();
var vm = this.container.GetExport<MainViewModel>();
var win = new MainWindow();
win.DataContext = vm;
win.Show();
}
private void OnCurrentDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
logger.Fatal(e);
}
}
}
| using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.Composition.Convention;
using System.Composition.Hosting;
using System.Linq;
using System.Reflection;
using System.Windows;
using log4net;
using WeeklyCurriculum.Components;
using WeeklyCurriculum.Contracts;
namespace WeeklyCurriculum.Wpf
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private ILog logger = LogManager.GetLogger(typeof(App));
private CompositionHost container;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
Application.Current.DispatcherUnhandledException += this.OnCurrentDispatcherUnhandledException;
var refAssemblies = new List<Assembly>();
refAssemblies.Add(typeof(Holiday).GetTypeInfo().Assembly);
refAssemblies.Add(typeof(WeekProvider).GetTypeInfo().Assembly);
var configuration = new ContainerConfiguration()
.WithAssembly(typeof(App).GetTypeInfo().Assembly)
.WithAssemblies(refAssemblies)
;
this.container = configuration.CreateContainer();
//var assCat = new AssemblyCatalog(typeof(App).Assembly);
//var cont = new CompositionContainer(assCat);
//var vm = new MainViewModel();
//var vm = cont.GetExportedValue<MainViewModel>();
var vm = this.container.GetExport<MainViewModel>();
var win = new MainWindow();
win.DataContext = vm;
win.Show();
}
private void OnCurrentDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
logger.Fatal(e);
}
}
}
| mit | C# |
55018579c3565e0c4abf8fce19e5a30c8577da29 | Add category to test run | mallibone/MvvmLightSamples | MvvmLightBindings/MvvmLightBindings.UITest/Tests.cs | MvvmLightBindings/MvvmLightBindings.UITest/Tests.cs | using System.Linq;
using NUnit.Framework;
using Xamarin.UITest;
namespace MvvmLightBindings.UITest
{
[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
public class Tests
{
IApp app;
Platform platform;
public Tests(Platform platform)
{
this.platform = platform;
}
[SetUp]
public void BeforeEachTest()
{
app = AppInitializer.StartApp(platform);
}
[Test]
[Ignore]
public void AppLaunches()
{
app.Repl();
}
[Test]
[Category("all")]
public void EnterAndSubmitText_ItAppearsInTheSubmittedTextLabel()
{
app.EnterText(q => q.Marked("InputMessageEntry"), "Hello from Xamarin Test Cloud");
app.Screenshot("Has entered text");
app.Tap(q => q.Marked("SubmitMessageButton"));
app.Screenshot("Has taped the submit button.");
Assert.IsFalse(string.IsNullOrEmpty(app.Query(q => q.Marked("SubmittedMessageLabel")).First().Text));
}
}
}
| using System.Linq;
using NUnit.Framework;
using Xamarin.UITest;
namespace MvvmLightBindings.UITest
{
[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
public class Tests
{
IApp app;
Platform platform;
public Tests(Platform platform)
{
this.platform = platform;
}
[SetUp]
public void BeforeEachTest()
{
app = AppInitializer.StartApp(platform);
}
[Test]
public void AppLaunches()
{
app.Repl();
}
[Test]
public void EnterAndSubmitText_ItAppearsInTheSubmittedTextLabel()
{
app.EnterText(q => q.Marked("InputMessageEntry"), "Hello from Xamarin Test Cloud");
app.Screenshot("Has entered text");
app.Tap(q => q.Marked("SubmitMessageButton"));
app.Screenshot("Has taped the submit button.");
Assert.IsFalse(string.IsNullOrEmpty(app.Query(q => q.Marked("SubmittedMessageLabel")).First().Text));
}
}
}
| apache-2.0 | C# |
39649747aaad9092a32d2d97e1897ecaecded170 | Simplify and synchronise multiplayer screen transitions | NeoAdonis/osu,UselessToucan/osu,johnneijzen/osu,johnneijzen/osu,DrabWeb/osu,DrabWeb/osu,DrabWeb/osu,peppy/osu,peppy/osu,naoey/osu,NeoAdonis/osu,UselessToucan/osu,EVAST9919/osu,smoogipoo/osu,naoey/osu,EVAST9919/osu,ppy/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,ZLima12/osu,ZLima12/osu,ppy/osu,2yangk23/osu,NeoAdonis/osu,naoey/osu,smoogipoo/osu,2yangk23/osu,peppy/osu | osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs | osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Game.Graphics.Containers;
namespace osu.Game.Screens.Multi.Screens
{
public abstract class MultiplayerScreen : OsuScreen
{
protected virtual Container<Drawable> TransitionContent => Content;
/// <summary>
/// The type to display in the title of the <see cref="Header"/>.
/// </summary>
public virtual string Type => Title;
protected override void OnEntering(Screen last)
{
base.OnEntering(last);
Content.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
TransitionContent.FadeInFromZero(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
TransitionContent.MoveToX(200).MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
}
protected override bool OnExiting(Screen next)
{
Content.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
TransitionContent.MoveToX(200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
return base.OnExiting(next);
}
protected override void OnResuming(Screen last)
{
base.OnResuming(last);
Content.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
TransitionContent.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
}
protected override void OnSuspending(Screen next)
{
base.OnSuspending(next);
Content.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
TransitionContent.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, Easing.OutQuint);
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Game.Graphics.Containers;
namespace osu.Game.Screens.Multi.Screens
{
public abstract class MultiplayerScreen : OsuScreen
{
private const Easing in_easing = Easing.OutQuint;
private const Easing out_easing = Easing.InSine;
protected virtual Container<Drawable> TransitionContent => Content;
/// <summary>
/// The type to display in the title of the <see cref="Header"/>.
/// </summary>
public virtual string Type => Title;
protected override void OnEntering(Screen last)
{
base.OnEntering(last);
TransitionContent.MoveToX(200);
Content.FadeInFromZero(WaveContainer.APPEAR_DURATION, in_easing);
TransitionContent.FadeInFromZero(WaveContainer.APPEAR_DURATION, in_easing);
TransitionContent.MoveToX(0, WaveContainer.APPEAR_DURATION, in_easing);
}
protected override bool OnExiting(Screen next)
{
Content.FadeOut(WaveContainer.DISAPPEAR_DURATION, out_easing);
TransitionContent.MoveToX(200, WaveContainer.DISAPPEAR_DURATION, out_easing);
return base.OnExiting(next);
}
protected override void OnResuming(Screen last)
{
base.OnResuming(last);
Content.FadeIn(WaveContainer.APPEAR_DURATION, in_easing);
TransitionContent.MoveToX(0, WaveContainer.APPEAR_DURATION, in_easing);
}
protected override void OnSuspending(Screen next)
{
base.OnSuspending(next);
Content.FadeOut(WaveContainer.DISAPPEAR_DURATION, out_easing);
TransitionContent.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, out_easing);
}
}
}
| mit | C# |
027a110c614f08501ec1abf1e64ed259757bfe13 | Update Utils.cs | Facepunch/Facepunch.Steamworks,Facepunch/Facepunch.Steamworks,Facepunch/Facepunch.Steamworks | Facepunch.Steamworks/Redux/Utils.cs | Facepunch.Steamworks/Redux/Utils.cs | using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using SteamNative;
namespace Steamworks
{
/// <summary>
/// Interface which provides access to a range of miscellaneous utility functions
/// </summary>
public static class Utils
{
static Internal.ISteamUtils _steamutils;
internal static Internal.ISteamUtils steamutils
{
get
{
if ( _steamutils == null )
_steamutils = new Internal.ISteamUtils();
return _steamutils;
}
}
public static uint SecondsSinceAppActive => _steamutils.GetSecondsSinceAppActive();
public static uint SecondsSinceComputerActive => _steamutils.GetSecondsSinceComputerActive();
// the universe this client is connecting to
public static Universe ConnectedUniverse => _steamutils.GetConnectedUniverse();
/// <summary>
/// Steam server time. Number of seconds since January 1, 1970, GMT (i.e unix time)
/// </summary>
public static DateTime SteamServerTime => Facepunch.Steamworks.Utility.Epoch.ToDateTime( _steamutils.GetServerRealTime() );
/// <summary>
/// returns the 2 digit ISO 3166-1-alpha-2 format country code this client is running in (as looked up via an IP-to-location database)
/// e.g "US" or "UK".
/// </summary>
public static string IpCountry => _steamutils.GetIPCountry();
/// <summary>
/// returns true if the image exists, and the buffer was successfully filled out
/// results are returned in RGBA format
/// the destination buffer size should be 4 * height * width * sizeof(char)
/// </summary>
public static bool GetImageSize( int image, out uint width, out uint height )
{
width = 0;
height = 0;
return _steamutils.GetImageSize( image, ref width, ref height );
}
internal static bool IsCallComplete( SteamAPICall_t call, out bool failed )
{
failed = false;
return steamutils.IsAPICallCompleted( call, ref failed );
}
internal static T? GetResult<T>( SteamAPICall_t call ) where T : struct, ISteamCallback
{
var t = new T();
var size = t.GetStructSize();
var ptr = Marshal.AllocHGlobal( size );
try
{
bool failed = false;
if ( !steamutils.GetAPICallResult( call, ptr, size, t.GetCallbackId(), ref failed ) )
return null;
if ( failed )
return null;
t = (T)t.Fill( ptr );
return t;
}
finally
{
Marshal.FreeHGlobal( ptr );
}
}
}
} | using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using SteamNative;
namespace Steamworks
{
/// <summary>
/// Interface which provides access to a range of miscellaneous utility functions
/// </summary>
public static class Utils
{
static Internal.ISteamUtils _steamutils;
internal static Internal.ISteamUtils steamutils
{
get
{
if ( _steamutils == null )
_steamutils = new Internal.ISteamUtils();
return _steamutils;
}
}
internal static bool IsCallComplete( SteamAPICall_t call, out bool failed )
{
failed = false;
return steamutils.IsAPICallCompleted( call, ref failed );
}
internal static T? GetResult<T>( SteamAPICall_t call ) where T : struct, ISteamCallback
{
var t = new T();
var size = t.GetStructSize();
var ptr = Marshal.AllocHGlobal( size );
try
{
bool failed = false;
if ( !steamutils.GetAPICallResult( call, ptr, size, t.GetCallbackId(), ref failed ) )
return null;
if ( failed )
return null;
t = (T)t.Fill( ptr );
return t;
}
finally
{
Marshal.FreeHGlobal( ptr );
}
}
}
} | mit | C# |
fb69d085f6e2c437bdbacb71283ce9ad8e71926a | Add support for fixed structures | c0nnex/SPAD.neXt,c0nnex/SPAD.neXt | SPAD.Interfaces/SimConnect/DataItemAttributeBase.cs | SPAD.Interfaces/SimConnect/DataItemAttributeBase.cs | using System;
namespace SPAD.neXt.Interfaces.SimConnect
{
public interface IDataItemAttributeBase
{
int ItemIndex
{
get;
set;
}
int ItemSize
{
get;
set;
}
float ItemEpsilon
{
get;
set;
}
int ItemOffset { get; set; }
bool IsFixedSize { get; set; }
}
public interface IDataItemBoundBase
{
string DatumName { get; }
string UnitsName { get; }
string ID { get; }
}
}
| using System;
namespace SPAD.neXt.Interfaces.SimConnect
{
public interface IDataItemAttributeBase
{
int ItemIndex
{
get;
set;
}
int ItemSize
{
get;
set;
}
float ItemEpsilon
{
get;
set;
}
int ItemOffset { get; set; }
}
public interface IDataItemBoundBase
{
string DatumName { get; }
string UnitsName { get; }
string ID { get; }
}
}
| mit | C# |
8b4807cfc4b37b82932ea85a986307b4d7a3c82f | Add descriptor to IgnoreCase for parsing of enum | digipost/digipost-api-client-dotnet | Digipost.Api.Client.Domain/Identify/IdentificationById.cs | Digipost.Api.Client.Domain/Identify/IdentificationById.cs | using System;
using Digipost.Api.Client.Domain.Enums;
namespace Digipost.Api.Client.Domain.Identify
{
public class IdentificationById : IIdentification
{
public IdentificationById(IdentificationType identificationType, string value)
{
IdentificationType = identificationType;
Value = value;
}
public IdentificationType IdentificationType { get; private set; }
public object Data
{
get { return IdentificationType; }
}
[Obsolete("Use IdentificationType instead. Will be removed in future versions" )]
public IdentificationChoiceType IdentificationChoiceType {
get
{
return ParseIdentificationChoiceToIdentificationChoiceType();
}
}
internal IdentificationChoiceType ParseIdentificationChoiceToIdentificationChoiceType()
{
if (IdentificationType == IdentificationType.OrganizationNumber)
{
return IdentificationChoiceType.OrganisationNumber;
}
return (IdentificationChoiceType)
Enum.Parse(typeof (IdentificationChoiceType), IdentificationType.ToString(), ignoreCase: true);
}
public string Value { get; set; }
}
}
| using System;
using Digipost.Api.Client.Domain.Enums;
namespace Digipost.Api.Client.Domain.Identify
{
public class IdentificationById : IIdentification
{
public IdentificationById(IdentificationType identificationType, string value)
{
IdentificationType = identificationType;
Value = value;
}
public IdentificationType IdentificationType { get; private set; }
public object Data
{
get { return IdentificationType; }
}
[Obsolete("Use IdentificationType instead. Will be removed in future versions" )]
public IdentificationChoiceType IdentificationChoiceType {
get
{
return ParseIdentificationChoiceToIdentificationChoiceType();
}
}
internal IdentificationChoiceType ParseIdentificationChoiceToIdentificationChoiceType()
{
if (IdentificationType == IdentificationType.OrganizationNumber)
{
return IdentificationChoiceType.OrganisationNumber;
}
return (IdentificationChoiceType)
Enum.Parse(typeof (IdentificationChoiceType), IdentificationType.ToString(), true);
}
public string Value { get; set; }
}
}
| apache-2.0 | C# |
eec30d4e1f52b139ec62f6af0b1baca23de20728 | Revert the title | rprouse/IdeaWeb,rprouse/IdeaWeb | IdeaWeb/Views/Home/Index.cshtml | IdeaWeb/Views/Home/Index.cshtml | @model IEnumerable<IdeaWeb.Models.Idea>
@{
ViewData["Title"] = "Home";
}
<h2>My Ideas</h2>
<ul class="idea">
@foreach (var item in Model)
{
<li>
<a asp-action="Details" asp-controller="Ideas" asp-route-id="@item.Id">
<span class="rating btn btn-default btn-sm">@item.Rating</span>
<span class="name">@item.Name</span>
</a>
</li>
}
</ul>
| @model IEnumerable<IdeaWeb.Models.Idea>
@{
ViewData["Title"] = "Home";
}
<h2>My Many Ideas</h2>
<ul class="idea">
@foreach (var item in Model)
{
<li>
<a asp-action="Details" asp-controller="Ideas" asp-route-id="@item.Id">
<span class="rating btn btn-default btn-sm">@item.Rating</span>
<span class="name">@item.Name</span>
</a>
</li>
}
</ul>
| mit | C# |
a59aee1bddaf78e232aba7a37867ef7efb20320b | Bump to version 2.5.2.0 | Silv3rPRO/proshine | PROShine/Properties/AssemblyInfo.cs | PROShine/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PROShine")]
[assembly: AssemblyDescription("A free, open-source and advanced bot for Pokemon Revolution Online.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Silv3r")]
[assembly: AssemblyProduct("PROShine")]
[assembly: AssemblyCopyright("Copyright © Silv3r, 2016-2032")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.2.0")]
[assembly: AssemblyFileVersion("2.5.2.0")]
[assembly: NeutralResourcesLanguage("en")]
| using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PROShine")]
[assembly: AssemblyDescription("A free, open-source and advanced bot for Pokemon Revolution Online.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Silv3r")]
[assembly: AssemblyProduct("PROShine")]
[assembly: AssemblyCopyright("Copyright © Silv3r, 2016-2032")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.1.0")]
[assembly: AssemblyFileVersion("2.5.1.0")]
[assembly: NeutralResourcesLanguage("en")]
| mit | C# |
3c33f0cfa2c65748fc1e1f34251056c8fe7e8a5c | update version | IUMDPI/IUMediaHelperApps | Recorder/Properties/AssemblyInfo.cs | Recorder/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Recorder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Recorder")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.0.0")]
[assembly: AssemblyFileVersion("1.7.0.0")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Recorder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Recorder")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]
| apache-2.0 | C# |
9326a1879031a7355dba37806ae62ebe84bb2ccd | use WinRT.Interop | tibel/Caliburn.Light | samples/Demo.HelloSpecialValues/DialogHelper.cs | samples/Demo.HelloSpecialValues/DialogHelper.cs | using Microsoft.UI.Xaml;
using Windows.Foundation;
using Windows.UI.Popups;
namespace Demo.HelloSpecialValues
{
//WORKAROUND https://github.com/microsoft/microsoft-ui-xaml/issues/4167
internal static class DialogHelper
{
public static IAsyncOperation<IUICommand> ShowAsyncEx(this MessageDialog dialog, Window parent = null)
{
if (parent is null)
parent = Window.Current;
var handle = WinRT.Interop.WindowNative.GetWindowHandle(parent);
WinRT.Interop.InitializeWithWindow.Initialize(dialog, handle);
return dialog.ShowAsync();
}
}
}
| using Microsoft.UI.Xaml;
using System;
using System.Runtime.InteropServices;
using Windows.Foundation;
using Windows.UI.Popups;
using WinRT;
namespace Demo.HelloSpecialValues
{
//WORKAROUND https://github.com/microsoft/microsoft-ui-xaml/issues/4167
internal static class DialogHelper
{
public static IAsyncOperation<IUICommand> ShowAsyncEx(this MessageDialog dialog, Window parent = null)
{
var handle = parent is null
? GetActiveWindow()
: parent.As<IWindowNative>().WindowHandle;
if (handle == IntPtr.Zero)
throw new InvalidOperationException();
dialog.As<IInitializeWithWindow>().Initialize(handle);
return dialog.ShowAsync();
}
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("EECDBF0E-BAE9-4CB6-A68E-9598E1CB57BB")]
private interface IWindowNative
{
IntPtr WindowHandle { get; }
}
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("3E68D4BD-7135-4D10-8018-9FB6D9F33FA1")]
private interface IInitializeWithWindow
{
void Initialize(IntPtr hwnd);
}
[DllImport("user32.dll")]
private static extern IntPtr GetActiveWindow();
}
}
| mit | C# |
0f1473b49abcb349239f946b82952c7ae1d96738 | Implement FontsHandler.FontFamilyAvailable (missed this one) | bbqchickenrobot/Eto-1,l8s/Eto,PowerOfCode/Eto,PowerOfCode/Eto,l8s/Eto,l8s/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,PowerOfCode/Eto | Source/Eto.Platform.Windows/Drawing/FontsHandler.cs | Source/Eto.Platform.Windows/Drawing/FontsHandler.cs | using Eto.Drawing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using sd = System.Drawing;
namespace Eto.Platform.Windows.Drawing
{
public class FontsHandler : WidgetHandler<Widget>, IFonts
{
HashSet<string> availableFontFamilies;
public IEnumerable<FontFamily> AvailableFontFamilies
{
get {
return sd.FontFamily.Families.Select (r => new FontFamily(Generator, new FontFamilyHandler(r)));
}
}
public bool FontFamilyAvailable (string fontFamily)
{
if (availableFontFamilies == null) {
availableFontFamilies = new HashSet<string> (StringComparer.InvariantCultureIgnoreCase);
foreach (var family in sd.FontFamily.Families) {
availableFontFamilies.Add (family.Name);
}
}
return availableFontFamilies.Contains (fontFamily);
}
}
}
| using Eto.Drawing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using sd = System.Drawing;
namespace Eto.Platform.Windows.Drawing
{
public class FontsHandler : WidgetHandler<Widget>, IFonts
{
public IEnumerable<FontFamily> AvailableFontFamilies
{
get {
return sd.FontFamily.Families.Select (r => new FontFamily(Generator, new FontFamilyHandler(r)));
}
}
}
}
| bsd-3-clause | C# |
a9fbabebb6f4347312c23a10dd866b9060292fcb | Correct action for send log in link form | bradwestness/SecretSanta,bradwestness/SecretSanta | SecretSanta/Views/Home/Index.cshtml | SecretSanta/Views/Home/Index.cshtml | @model SendLogInLinkModel
@{
ViewBag.Title = "Send Log In Link";
}
<div class="jumbotron">
<div class="row">
<div class="col-lg-6">
<h1>Welcome to Secret Santa!</h1>
@using (Html.BeginForm("SendLogInLink", "Account", FormMethod.Post, new { role = "form", @class = "form-horizontal" }))
{
<fieldset>
<legend>@ViewBag.Title</legend>
<p>
If you misplaced your log-in email, you can use this form to have another
log-in link sent to you.
</p>
<div class="form-group">
<small>@Html.LabelFor(m => m.Email, new { @class = "control-label col-sm-4" })</small>
<div class="col-sm-6">
@Html.EditorFor(m => m.Email)
<small>@Html.ValidationMessageFor(m => m.Email)</small>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Send Log-In Link</button>
</div>
</div>
</fieldset>
}
</div>
<div class="col-lg-6">
<img class="img-responsive" src="@Url.Content("~/Content/Images/santa.png")" alt="Santa" />
</div>
</div>
</div> | @model SendLogInLinkModel
@{
ViewBag.Title = "Send Log In Link";
}
<div class="jumbotron">
<div class="row">
<div class="col-lg-6">
<h1>Welcome to Secret Santa!</h1>
@using (Html.BeginForm("LogIn", "Account", FormMethod.Post, new { role = "form", @class = "form-horizontal" }))
{
<fieldset>
<legend>@ViewBag.Title</legend>
<p>
If you misplaced your log-in email, you can use this form to have another
log-in link sent to you.
</p>
<div class="form-group">
<small>@Html.LabelFor(m => m.Email, new { @class = "control-label col-sm-4" })</small>
<div class="col-sm-6">
@Html.EditorFor(m => m.Email)
<small>@Html.ValidationMessageFor(m => m.Email)</small>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Send Log-In Link</button>
</div>
</div>
</fieldset>
}
</div>
<div class="col-lg-6">
<img class="img-responsive" src="@Url.Content("~/Content/Images/santa.png")" alt="Santa" />
</div>
</div>
</div> | apache-2.0 | C# |
eea1e415e3c989078130ce1134758359ed8d0569 | test fix | chrismckelt/WebMinder,chrismckelt/WebMinder,chrismckelt/WebMinder | Core.Tests/RuleSetRunnerFixture.cs | Core.Tests/RuleSetRunnerFixture.cs | using System;
using System.Linq;
using WebMinder.Core.Handlers;
using WebMinder.Core.Rules.IpBlocker;
using Xunit;
namespace WebMinder.Core.Tests
{
public class RuleSetRunnerFixture
{
private AggregateRuleSetHandler<TestObject> _ruleSetHandler;
private const string RuleSet = "RuleSetRunnerFixture Test Rule";
const string ErrorDescription = "RuleSetRunnerFixture Error exception for logging";
public RuleSetRunnerFixture()
{
_ruleSetHandler = new AggregateRuleSetHandler<TestObject>();
}
[Fact]
public void ShouldGetRulesFromRuleSets()
{
RuleSetRunner.Instance.AddRule<IpAddressRequest>(new IpAddressBlockerRule(){UpdateRuleCollectionOnSuccess = false});
var rules = RuleSetRunner.Instance.GetRules<IpAddressRequest>();
Assert.Equal(1, rules.Count());
}
[Fact]
public void ShouldGetRulesCountFromRuleSets()
{
var rule = new IpAddressBlockerRule();
rule.UseCacheStorage(Guid.NewGuid().ToString());
RuleSetRunner.Instance.AddRule<IpAddressRequest>(rule);
RuleSetRunner.Instance.VerifyRule(new IpAddressRequest(){IpAddress = "127.0.01", CreatedUtcDateTime = DateTime.UtcNow});
RuleSetRunner.Instance.VerifyRule(new IpAddressRequest() { IpAddress = "127.0.01", CreatedUtcDateTime = DateTime.UtcNow });
RuleSetRunner.Instance.VerifyRule(new IpAddressRequest() { IpAddress = "127.0.01", CreatedUtcDateTime = DateTime.UtcNow });
var rules = RuleSetRunner.Instance.GetRules<IpAddressRequest>();
Assert.Equal(3, rules.Sum(x=>x.Items.Count()));
}
}
}
| using System;
using System.Linq;
using WebMinder.Core.Handlers;
using WebMinder.Core.Rules.IpBlocker;
using Xunit;
namespace WebMinder.Core.Tests
{
public class RuleSetRunnerFixture
{
private AggregateRuleSetHandler<TestObject> _ruleSetHandler;
private const string RuleSet = "RuleSetRunnerFixture Test Rule";
const string ErrorDescription = "RuleSetRunnerFixture Error exception for logging";
public RuleSetRunnerFixture()
{
_ruleSetHandler = new AggregateRuleSetHandler<TestObject>();
}
[Fact]
public void ShouldGetRulesFromRuleSets()
{
RuleSetRunner.Instance.AddRule<IpAddressRequest>(new IpAddressBlockerRule(){UpdateRuleCollectionOnSuccess = false});
var rules = RuleSetRunner.Instance.GetRules<IpAddressRequest>();
Assert.Equal(1, rules.Count());
}
[Fact]
public void ShouldGetRulesCountFromRuleSets()
{
RuleSetRunner.Instance.AddRule<IpAddressRequest>(new IpAddressBlockerRule());
RuleSetRunner.Instance.VerifyRule(new IpAddressRequest(){IpAddress = "127.0.01", CreatedUtcDateTime = DateTime.UtcNow});
RuleSetRunner.Instance.VerifyRule(new IpAddressRequest() { IpAddress = "127.0.01", CreatedUtcDateTime = DateTime.UtcNow });
RuleSetRunner.Instance.VerifyRule(new IpAddressRequest() { IpAddress = "127.0.01", CreatedUtcDateTime = DateTime.UtcNow });
var rules = RuleSetRunner.Instance.GetRules<IpAddressRequest>();
Assert.Equal(3, rules.Sum(x=>x.Items.Count()));
}
}
}
| apache-2.0 | C# |
1da6ae4b5d44cbd3be2ac505eecb1cebfb3f9789 | add to confirmation | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/Lab/Confirmation.cshtml | Anlab.Mvc/Views/Lab/Confirmation.cshtml | @using Humanizer
@model AnlabMvc.Models.Order.OrderReviewModel
@{
ViewData["Title"] = "Confirmation";
}
<h3>This info is outdated and will be updated from the request number</h3>
@Html.Partial("_OrderDetails")
<form asp-controller="Lab" asp-action="Confirmation" asp-route-id="@Model.Order.Id" method="post">
@Html.Hidden("confirm", true)
<div class="form-group">
<span>Request Number:</span>
<span><input type="text" class="form-control" name="requestNum" required /></span>
<span>Add Lab Comments</span>
<textarea class="form-control" name="LabComments"></textarea>
<span>Adjust Final Total:</span>
<input type="hidden" class="form-control" id="prevTotal" value="@Model.OrderDetails.Total" />
<input type="text" class="form-control" id="GrandTotal" value="@Model.OrderDetails.Total" autocomplete="off" />
<div>Current Total: $@Model.OrderDetails.Total</div>
<div>Adjustment Amount: $<span id="adjustAmt">@Model.OrderDetails.AdjustmentAmount</span></div>
<input type="hidden" class="form-control" id="adjustmentAmount" name="AdjustmentAmount" value="0" />
</div>
<button type="submit" class="btn btn-primary"><i class="fa fa-check" aria-hidden="true">Confirm Received</i></button>
</form>
@section AdditionalStyles
{
@{ await Html.RenderPartialAsync("_DataTableStylePartial"); }
}
@section Scripts
{
@{ await Html.RenderPartialAsync("_DataTableScriptsPartial"); }
<script type="text/javascript">
$(function() {
$("#table").dataTable();
});
</script>
<script type="text/javascript">
$('#GrandTotal').on('keyup', function () {
var prevTotal = $('#prevTotal').val();
var grandTotal = $(this).val();
if (grandTotal)
var adjustAmt = parseFloat(grandTotal) - parseFloat(prevTotal);
else
var adjustAmt = 0;
$('#adjustmentAmount').val(adjustAmt);
$('#adjustAmt').html(adjustAmt);
});
</script>
@{ await Html.RenderPartialAsync("_ShowdownScriptsPartial"); }
}
| @using Humanizer
@model AnlabMvc.Models.Order.OrderReviewModel
@{
ViewData["Title"] = "Confirmation";
}
<h3>This info is outdated and will be updated from the request number</h3>
@Html.Partial("_OrderDetails")
<form asp-controller="Lab" asp-action="Confirmation" asp-route-id="@Model.Order.Id" method="post">
@Html.Hidden("confirm", true)
<div class="form-group">
<strong>Request Number:</strong>
<span><input type="text" class="form-control" name="requestNum" required /></span>
</div>
<button type="submit" class="btn btn-primary"><i class="fa fa-check" aria-hidden="true">Confirm Received</i></button>
</form>
@section AdditionalStyles
{
@{ await Html.RenderPartialAsync("_DataTableStylePartial"); }
}
@section Scripts
{
@{ await Html.RenderPartialAsync("_DataTableScriptsPartial"); }
<script type="text/javascript">
$(function() {
$("#table").dataTable();
});
</script>
@{ await Html.RenderPartialAsync("_ShowdownScriptsPartial"); }
}
| mit | C# |
e746ff27fa423cdfb90dc869d56fcbcb425e894d | Revert "Don't force resolution aspect in WebGL" | NitorInc/NitoriWare,Barleytree/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare | Assets/Scripts/Global/GameController.cs | Assets/Scripts/Global/GameController.cs | using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Events;
using System.Collections;
public class GameController : MonoBehaviour
{
public static GameController instance;
#pragma warning disable 0649
[SerializeField]
private bool disableCursor;
[SerializeField]
private MicrogameCollection _microgameCollection;
[SerializeField]
private SceneShifter _sceneShifter;
[SerializeField]
private Sprite[] controlSprites;
[SerializeField]
private UnityEvent onSceneLoad;
#pragma warning restore 0649
private string startScene;
public MicrogameCollection microgameCollection
{
get { return _microgameCollection; }
}
public SceneShifter sceneShifter
{
get { return _sceneShifter; }
}
void Awake()
{
if (instance != null)
{
Destroy(gameObject);
return;
}
startScene = gameObject.scene.name;
DontDestroyOnLoad(transform.gameObject);
instance = this;
Cursor.visible = !disableCursor;
Cursor.lockState = CursorLockMode.Confined;
Application.targetFrameRate = 60;
forceResolutionAspect();
AudioListener.pause = false;
SceneManager.sceneLoaded += onSceneLoaded;
}
void forceResolutionAspect()
{
int height = Screen.currentResolution.height;
if (!MathHelper.Approximately((float)height, (float) Screen.currentResolution.width * 3f / 4f, .01f))
Screen.SetResolution((int)((float)Screen.currentResolution.width * 3f / 4f), height, Screen.fullScreen);
}
private void Update()
{
//Debug features
if (Debug.isDebugBuild)
{
//Shift+R to reset all prefs
if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.R))
PlayerPrefs.DeleteAll();
}
}
void onSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (PauseManager.exitedWhilePaused)
{
AudioListener.pause = false;
Time.timeScale = 1f;
PauseManager.exitedWhilePaused = false;
Cursor.visible = true;
}
onSceneLoad.Invoke();
}
public Sprite getControlSprite(MicrogameTraits.ControlScheme controlScheme)
{
return controlSprites[(int)controlScheme];
}
public string getStartScene()
{
return startScene;
}
}
| using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Events;
using System.Collections;
public class GameController : MonoBehaviour
{
public static GameController instance;
#pragma warning disable 0649
[SerializeField]
private bool disableCursor;
[SerializeField]
private MicrogameCollection _microgameCollection;
[SerializeField]
private SceneShifter _sceneShifter;
[SerializeField]
private Sprite[] controlSprites;
[SerializeField]
private UnityEvent onSceneLoad;
#pragma warning restore 0649
private string startScene;
public MicrogameCollection microgameCollection
{
get { return _microgameCollection; }
}
public SceneShifter sceneShifter
{
get { return _sceneShifter; }
}
void Awake()
{
if (instance != null)
{
Destroy(gameObject);
return;
}
startScene = gameObject.scene.name;
DontDestroyOnLoad(transform.gameObject);
instance = this;
Cursor.visible = !disableCursor;
Cursor.lockState = CursorLockMode.Confined;
Application.targetFrameRate = 60;
if (Application.platform != RuntimePlatform.WebGLPlayer)
forceResolutionAspect();
AudioListener.pause = false;
SceneManager.sceneLoaded += onSceneLoaded;
}
void forceResolutionAspect()
{
int height = Screen.currentResolution.height;
if (!MathHelper.Approximately((float)height, (float) Screen.currentResolution.width * 3f / 4f, .01f))
Screen.SetResolution((int)((float)Screen.currentResolution.width * 3f / 4f), height, Screen.fullScreen);
}
private void Update()
{
//Debug features
if (Debug.isDebugBuild)
{
//Shift+R to reset all prefs
if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.R))
PlayerPrefs.DeleteAll();
}
}
void onSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (PauseManager.exitedWhilePaused)
{
AudioListener.pause = false;
Time.timeScale = 1f;
PauseManager.exitedWhilePaused = false;
Cursor.visible = true;
}
onSceneLoad.Invoke();
}
public Sprite getControlSprite(MicrogameTraits.ControlScheme controlScheme)
{
return controlSprites[(int)controlScheme];
}
public string getStartScene()
{
return startScene;
}
}
| mit | C# |
f44c89fb3cb8cca060b788467a61501fb2d77be3 | format script to adhere to coding conventions | mattboy64/SteamVR_Unity_Toolkit,adamjweaver/VRTK,Innoactive/IA-unity-VR-toolkit-VRTK,nmccarty/htvr,thestonefox/VRTK,Fulby/VRTK,red-horizon/VRTK,virror/VRTK,pargee/SteamVR_Unity_Toolkit,gpvigano/VRTK,gomez-addams/SteamVR_Unity_Toolkit,TMaloteaux/SteamVR_Unity_Toolkit,thestonefox/SteamVR_Unity_Toolkit,gpvigano/SteamVR_Unity_Toolkit | Assets/VRTK/Scripts/VRTK_HipTracking.cs | Assets/VRTK/Scripts/VRTK_HipTracking.cs | // Hip Tracking|Scripts|0135
namespace VRTK
{
using UnityEngine;
/// <summary>
/// Hip Tracking attempts to reasonably track hip position in the absence of a hip position sensor.
/// </summary>
/// <remarks>
/// The Hip Tracking script is placed on an empty GameObject which will be positioned at the estimated hip position.
/// </remarks>
public class VRTK_HipTracking : MonoBehaviour
{
[Tooltip("Distance underneath Player Head for hips to reside.")]
public float HeadOffset = -0.35f;
[Header("Optional")]
[Tooltip("Optional Transform to use as the Head Object for calculating hip position. If none is given one will try to be found in the scene.")]
public Transform headOverride;
[Tooltip("Optional Transform to use for calculating which way is 'Up' relative to the player for hip positioning.")]
public Transform ReferenceUp;
private Transform playerHead;
private void Awake()
{
if (headOverride != null)
{
playerHead = headOverride;
}
else
{
playerHead = VRTK_DeviceFinder.HeadsetTransform();
}
}
private void Update()
{
if (playerHead == null)
{
return;
}
Vector3 up = Vector3.up;
if (ReferenceUp != null)
{
up = ReferenceUp.up;
}
transform.position = playerHead.position + (HeadOffset * up);
Vector3 forward = playerHead.forward;
Vector3 forwardLeveld1 = forward;
forwardLeveld1.y = 0;
forwardLeveld1.Normalize();
Vector3 mixedInLocalForward = playerHead.up;
if (forward.y > 0)
{
mixedInLocalForward = -playerHead.up;
}
mixedInLocalForward.y = 0;
mixedInLocalForward.Normalize();
float dot = Mathf.Clamp(Vector3.Dot(forwardLeveld1, forward), 0f, 1f);
Vector3 finalForward = Vector3.Lerp(mixedInLocalForward, forwardLeveld1, dot * dot);
transform.rotation = Quaternion.LookRotation(finalForward, up);
}
}
} | // Hip Tracking|Scripts|0135
namespace VRTK
{
using UnityEngine;
using System.Collections;
/// <summary>
/// Hip Tracking attempts to reasonably track hip position in the absence of a hip position sensor.
/// </summary>
/// <remarks>
/// The Hip Tracking script is placed on an empty GameObject which will be positioned at the estimated hip position.
/// </remarks>
public class VRTK_HipTracking : MonoBehaviour
{
[Tooltip("Distance underneath Player Head for hips to reside.")]
public float HeadOffset = -0.35f;
[Header ("Optional")]
[Tooltip("Optional Transform to use as the Head Object for calculating hip position. If none is given one will try to be found in the scene.")]
public Transform headOverride;
[Tooltip("Optional Transform to use for calculating which way is 'Up' relative to the player for hip positioning.")]
public Transform ReferenceUp;
private Transform playerHead;
private void Awake ()
{
if (headOverride != null) {
playerHead = headOverride;
} else {
playerHead = VRTK_DeviceFinder.HeadsetTransform ();
}
}
private void Update ()
{
if (playerHead == null) {
return;
}
Vector3 up = Vector3.up;
if (ReferenceUp != null) {
up = ReferenceUp.up;
}
transform.position = playerHead.position + (HeadOffset * up);
Vector3 forward = playerHead.forward;
Vector3 forwardLeveld1 = forward;
forwardLeveld1.y = 0;
forwardLeveld1.Normalize ();
Vector3 mixedInLocalForward = playerHead.up;
if (forward.y > 0) {
mixedInLocalForward = -playerHead.up;
}
mixedInLocalForward.y = 0;
mixedInLocalForward.Normalize ();
float dot = Mathf.Clamp (Vector3.Dot (forwardLeveld1, forward), 0f, 1f);
Vector3 finalForward = Vector3.Lerp (mixedInLocalForward, forwardLeveld1, dot * dot);
transform.rotation = Quaternion.LookRotation (finalForward, up);
}
}
}
| mit | C# |
1f3235fb4fb5d472b601cc6908eb3761e326391b | Add two-way binding | sakapon/Samples-2016,sakapon/Samples-2016 | BindingSample/BindingConsole/Program.cs | BindingSample/BindingConsole/Program.cs | using System;
using System.Windows.Controls;
using System.Windows.Data;
namespace BindingConsole
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Bind_OneWay();
Bind_TwoWay();
}
static void Bind_OneWay()
{
// Binding Source (Any object).
var person = new Person1 { Id = 123, Name = "Taro" };
// Binding Target must be FrameworkElement.
var textBlock = new TextBlock { Text = "Default" };
Console.WriteLine(textBlock.Text);
// Binds target to source.
var binding = new Binding(nameof(person.Name)) { Source = person };
textBlock.SetBinding(TextBlock.TextProperty, binding);
Console.WriteLine(textBlock.Text);
// Changes source value.
person.Name = "Jiro";
Console.WriteLine(textBlock.Text);
}
static void Bind_TwoWay()
{
// Binding Source (Any object).
var person = new Person1 { Id = 123, Name = "Taro" };
// Binding Target must be FrameworkElement.
var textBox = new TextBox { Text = "Default" };
Console.WriteLine(textBox.Text);
// Binds target to source.
var binding = new Binding(nameof(person.Name)) { Source = person, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged };
textBox.SetBinding(TextBox.TextProperty, binding);
Console.WriteLine(textBox.Text);
// Changes source value.
person.Name = "Jiro";
Console.WriteLine(textBox.Text);
// Changes target value.
textBox.Text = "Saburo";
Console.WriteLine(person.Name);
}
}
}
| using System;
using System.Windows.Controls;
using System.Windows.Data;
namespace BindingConsole
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Bind_OneWay();
}
static void Bind_OneWay()
{
// Binding Source (Any object).
var person = new Person1 { Id = 123, Name = "Taro" };
// Binding Target must be FrameworkElement.
var textBlock = new TextBlock { Text = "Default" };
Console.WriteLine(textBlock.Text);
// Binds target to source.
var binding = new Binding(nameof(person.Name)) { Source = person };
textBlock.SetBinding(TextBlock.TextProperty, binding);
Console.WriteLine(textBlock.Text);
// Changes source value.
person.Name = "Jiro";
Console.WriteLine(textBlock.Text);
}
}
}
| mit | C# |
7caafb00d85281b36f7f9a7d05894f6ce569bc87 | Set version v2.2.0.1 | devalkeralia/Lean,mabeale/Lean,squideyes/Lean,andrewhart098/Lean,tomhunter-gh/Lean,devalkeralia/Lean,JKarathiya/Lean,Jay-Jay-D/LeanSTP,Phoenix1271/Lean,AnshulYADAV007/Lean,tomhunter-gh/Lean,devalkeralia/Lean,mabeale/Lean,tomhunter-gh/Lean,kaffeebrauer/Lean,Jay-Jay-D/LeanSTP,kaffeebrauer/Lean,AnshulYADAV007/Lean,Phoenix1271/Lean,StefanoRaggi/Lean,young-zhang/Lean,StefanoRaggi/Lean,FrancisGauthier/Lean,jameschch/Lean,jameschch/Lean,jameschch/Lean,Obawoba/Lean,QuantConnect/Lean,Mendelone/forex_trading,AnObfuscator/Lean,young-zhang/Lean,devalkeralia/Lean,jameschch/Lean,tomhunter-gh/Lean,StefanoRaggi/Lean,andrewhart098/Lean,andrewhart098/Lean,AnshulYADAV007/Lean,Obawoba/Lean,squideyes/Lean,Mendelone/forex_trading,redmeros/Lean,mabeale/Lean,kaffeebrauer/Lean,bizcad/Lean,kaffeebrauer/Lean,squideyes/Lean,Mendelone/forex_trading,Jay-Jay-D/LeanSTP,AlexCatarino/Lean,AlexCatarino/Lean,Obawoba/Lean,bizcad/Lean,Jay-Jay-D/LeanSTP,FrancisGauthier/Lean,AlexCatarino/Lean,young-zhang/Lean,young-zhang/Lean,JKarathiya/Lean,Phoenix1271/Lean,bizcad/Lean,QuantConnect/Lean,QuantConnect/Lean,Obawoba/Lean,jameschch/Lean,Jay-Jay-D/LeanSTP,AnshulYADAV007/Lean,redmeros/Lean,kaffeebrauer/Lean,redmeros/Lean,squideyes/Lean,AnshulYADAV007/Lean,AnObfuscator/Lean,StefanoRaggi/Lean,JKarathiya/Lean,andrewhart098/Lean,bizcad/Lean,AnObfuscator/Lean,AnObfuscator/Lean,AlexCatarino/Lean,FrancisGauthier/Lean,Phoenix1271/Lean,JKarathiya/Lean,StefanoRaggi/Lean,redmeros/Lean,mabeale/Lean,QuantConnect/Lean,FrancisGauthier/Lean,Mendelone/forex_trading | Common/Properties/SharedAssemblyInfo.cs | Common/Properties/SharedAssemblyInfo.cs | using System.Reflection;
// common assembly attributes
[assembly: AssemblyDescription("Lean Algorithmic Trading Engine - QuantConnect.com")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyCompany("QuantConnect")]
[assembly: AssemblyTrademark("QuantConnect")]
[assembly: AssemblyVersion("2.2.0.1")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif | using System.Reflection;
// common assembly attributes
[assembly: AssemblyDescription("Lean Algorithmic Trading Engine - QuantConnect.com")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyCompany("QuantConnect")]
[assembly: AssemblyTrademark("QuantConnect")]
[assembly: AssemblyVersion("2.2.0.0")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif | apache-2.0 | C# |
aa9e6d62717e59a6ddc3d9b6747ba4c241e3c89a | Update KeyUsage.cs | KingpinBen/Public-Stuff | KeyUsage.cs | KeyUsage.cs | using System.Collections.Generic;
/// <summary>
/// A basic comparer to avoid Dictionary allocation during indexing.
///
/// Mono doesn't like having enum's as the key in a dictionary and allocates
/// memory that then needs to be cleared by the GC (damned DefaultComparer)
/// </summary>
public sealed class KeyUsageComparer : IEqualityComparer<KeyUsage>
{
public bool Equals(KeyUsage a, KeyUsage b)
{
return a == b;
}
public int GetHashCode(KeyUsage obj)
{
return (int)obj;
}
}
public enum KeyUsage
{
Ability1,
Ability2,
Ability3,
Ability4,
Recall,
Inventory1,
Inventory2,
Inventory3,
Inventory4,
Inventory5,
Inventory6,
Inventory7,
Stop,
}
| public enum KeyUsage
{
Ability1,
Ability2,
Ability3,
Ability4,
Recall,
Inventory1,
Inventory2,
Inventory3,
Inventory4,
Inventory5,
Inventory6,
Inventory7,
Stop,
}
| mit | C# |
07f455f270fd117badda9dea2cb257bf6c4574b5 | sort like putty | dietsche/infinite-putty-tunnel | Infinite-PuTTY-Tunnel/SessionManager.cs | Infinite-PuTTY-Tunnel/SessionManager.cs | /**
* Copyright (c) 2016, Gregory L. Dietsche
*
* 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.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using Infinite.PuTTY.Tunnel.Properties;
using Infinite.PuTTY.Tunnel.Putty;
namespace Infinite.PuTTY.Tunnel
{
internal class SessionManager
{
private IList<PlinkSession> _sessions = new List<PlinkSession>();
internal IEnumerable<PlinkSession> Sessions
{
get
{
//We keep the active session objects and merge that list with the list of all available sessions.
//This way we don't loose our active sessions and we are able to show the user the most up-to-date
//list of sessions available in putty.
var enabled = _sessions.Where(s => s.IsEnabled).ToList();
var inactive = Putty.Putty.AvaiableSessions.Where(avail => enabled.All(a => a.Name != avail.Name));
_sessions = enabled.Union(inactive).OrderBy(s=>s.Name).ToList();
return _sessions;
}
}
internal void SaveEnabledTunnels()
{
Settings.Default.ActiveTunnels = new StringCollection();
foreach (var curTunnel in Sessions.Where(s => s.IsEnabled).Select(s => s.Name).ToList())
{
Settings.Default.ActiveTunnels.Add(curTunnel);
}
Settings.Default.Save();
}
}
} | /**
* Copyright (c) 2016, Gregory L. Dietsche
*
* 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.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using Infinite.PuTTY.Tunnel.Properties;
using Infinite.PuTTY.Tunnel.Putty;
namespace Infinite.PuTTY.Tunnel
{
internal class SessionManager
{
private IList<PlinkSession> _sessions = new List<PlinkSession>();
internal IEnumerable<PlinkSession> Sessions
{
get
{
//We keep the active session objects and merge that list with the list of all available sessions.
//This way we don't loose our active sessions and we are able to show the user the most up-to-date
//list of sessions available in putty.
var enabled = _sessions.Where(s => s.IsEnabled).ToList();
var inactive = Putty.Putty.AvaiableSessions.Where(avail => enabled.All(a => a.Name != avail.Name));
_sessions = enabled.Union(inactive).ToList();
return _sessions;
}
}
internal void SaveEnabledTunnels()
{
Settings.Default.ActiveTunnels = new StringCollection();
foreach (var curTunnel in Sessions.Where(s => s.IsEnabled).Select(s => s.Name).ToList())
{
Settings.Default.ActiveTunnels.Add(curTunnel);
}
Settings.Default.Save();
}
}
} | mit | C# |
89f3d72796563b5d905aaace69010e2b558b80d4 | Make build less complex | nikeee/HolzShots | src/HolzShots.Core.Tests/Properties/AssemblyInfo.cs | src/HolzShots.Core.Tests/Properties/AssemblyInfo.cs | using HolzShots.Common;
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("HolzShots.Core.Tests")]
[assembly: AssemblyProduct("HolzShots.Core.Tests")]
[assembly: AssemblyDescription("HolzShots Core Component Tests")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyConfiguration("")]
[assembly: Guid("56abb0f5-9c8b-4bc9-9d16-bc9598657b5d")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion(LibraryInformation.FullVersionString)]
[assembly: InternalsVisibleTo("HolzShots.Core.Tests")]
| using HolzShots.Common;
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("HolzShots.Core.Tests")]
[assembly: AssemblyProduct("HolzShots.Core.Tests")]
[assembly: AssemblyDescription("HolzShots Core Component Tests")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyConfiguration("")]
[assembly: Guid("56abb0f5-9c8b-4bc9-9d16-bc9598657b5d")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: AssemblyCompany(LibraryInformation.PublisherName)]
[assembly: AssemblyCopyright(LibraryInformation.Copyright)]
#if RELEASE && CI_BUILD
[assembly: AssemblyVersion(LibraryInformation.VersionFormal)]
[assembly: AssemblyFileVersion(LibraryInformation.VersionFormal)]
#else
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0")]
#endif
[assembly: AssemblyInformationalVersion(LibraryInformation.FullVersionString)]
[assembly: InternalsVisibleTo("HolzShots.Core.Tests")]
| agpl-3.0 | C# |
ed388731e429f526bfa37188505a2886eda01202 | Test not likely to pass most of the time | SanSYS/MassTransit,MassTransit/MassTransit,SanSYS/MassTransit,phatboyg/MassTransit,MassTransit/MassTransit,jacobpovar/MassTransit,jacobpovar/MassTransit,phatboyg/MassTransit | src/MassTransit.Tests/Transports/Multicast_Specs.cs | src/MassTransit.Tests/Transports/Multicast_Specs.cs | // Copyright 2007-2008 The Apache Software Foundation.
//
// 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.
namespace MassTransit.Tests.Transports
{
using System;
using Messages;
using NUnit.Framework;
using TestConsumers;
using TextFixtures;
[TestFixture]
public class When_publishing_a_message_via_multicast :
MulticastUdpTestFixture
{
private readonly TimeSpan _timeout = TimeSpan.FromSeconds(2);
[Test, Ignore]
public void It_should_be_received()
{
PingMessage message = new PingMessage();
var consumer = new TestCorrelatedConsumer<PingMessage, Guid>(message.CorrelationId);
RemoteBus.Subscribe(consumer);
LocalBus.Publish(message);
LocalBus.Publish(message);
consumer.ShouldHaveReceivedMessage(message, _timeout);
}
[Test, Explicit]
public void It_should_be_received_by_both_receivers()
{
PingMessage message = new PingMessage();
var remoteConsumer = new TestCorrelatedConsumer<PingMessage, Guid>(message.CorrelationId);
RemoteBus.Subscribe(remoteConsumer);
var localConsumer = new TestCorrelatedConsumer<PingMessage, Guid>(message.CorrelationId);
LocalBus.Subscribe(localConsumer);
// okay so a shared endpoint results in only one service bus in the process getting the message
LocalBus.Publish(message);
LocalBus.Publish(message);
remoteConsumer.ShouldHaveReceivedMessage(message, _timeout);
localConsumer.ShouldHaveReceivedMessage(message, _timeout);
}
}
} | // Copyright 2007-2008 The Apache Software Foundation.
//
// 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.
namespace MassTransit.Tests.Transports
{
using System;
using Messages;
using NUnit.Framework;
using TestConsumers;
using TextFixtures;
[TestFixture]
public class When_publishing_a_message_via_multicast :
MulticastUdpTestFixture
{
private readonly TimeSpan _timeout = TimeSpan.FromSeconds(2);
[Test, Ignore]
public void It_should_be_received()
{
PingMessage message = new PingMessage();
var consumer = new TestCorrelatedConsumer<PingMessage, Guid>(message.CorrelationId);
RemoteBus.Subscribe(consumer);
LocalBus.Publish(message);
LocalBus.Publish(message);
consumer.ShouldHaveReceivedMessage(message, _timeout);
}
[Test]
public void It_should_be_received_by_both_receivers()
{
PingMessage message = new PingMessage();
var remoteConsumer = new TestCorrelatedConsumer<PingMessage, Guid>(message.CorrelationId);
RemoteBus.Subscribe(remoteConsumer);
var localConsumer = new TestCorrelatedConsumer<PingMessage, Guid>(message.CorrelationId);
LocalBus.Subscribe(localConsumer);
// okay so a shared endpoint results in only one service bus in the process getting the message
LocalBus.Publish(message);
LocalBus.Publish(message);
remoteConsumer.ShouldHaveReceivedMessage(message, _timeout);
localConsumer.ShouldHaveReceivedMessage(message, _timeout);
}
}
} | apache-2.0 | C# |
db02267cef4978b88af83f0f2e51733c89a64426 | bump the version number | ristogod/INotify | INotify/Properties/AssemblyInfo.cs | INotify/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("INotify")]
[assembly: AssemblyDescription("Inheritable classes that implement notifying interfaces for use with WPF.")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("Nathan.Risto")]
[assembly: AssemblyProduct("INotify")]
[assembly: AssemblyCopyright("Copyright © Nathan.Risto 2015")]
[assembly: AssemblyTrademark("Nathan.Risto®")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("5e58d9df-e314-400f-9643-adb4303d1de0")]
[assembly: AssemblyVersion("18.4.15.922")]
[assembly: AssemblyFileVersion("18.4.15.922")]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("INotify")]
[assembly: AssemblyDescription("Inheritable classes that implement notifying interfaces for use with WPF.")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("Nathan.Risto")]
[assembly: AssemblyProduct("INotify")]
[assembly: AssemblyCopyright("Copyright © Nathan.Risto 2015")]
[assembly: AssemblyTrademark("Nathan.Risto®")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("5e58d9df-e314-400f-9643-adb4303d1de0")]
[assembly: AssemblyVersion("18.3.15.922")]
[assembly: AssemblyFileVersion("18.3.15.922")]
| mit | C# |
cb79c950d722c9785f46e3d58153f316cb44546f | add Left/Right properties | kato-im/MMDrawerController-Sharp | ApiDefinition.cs | ApiDefinition.cs | using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace MMDrawerControllerSharp
{
[BaseType (typeof(UIViewController))]
public interface MMDrawerController
{
[Export("initWithCenterViewController:leftDrawerViewController:rightDrawerViewController:")]
IntPtr Constructor(UIViewController centerViewController,
[NullAllowed] UIViewController leftDrawerViewController,
[NullAllowed] UIViewController rightDrawerViewController);
[Export("leftDrawerViewController")]
UIViewController LeftDrawerViewController { get; set; }
[Export("rightDrawerViewController")]
UIViewController RightDrawerViewController { get; set; }
[Export("toggleDrawerSide:animated:completion:")]
void ToggleDrawerSide(MMDrawerSide drawerSide, bool animated, IntPtr completion);
}
}
| using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace MMDrawerControllerSharp
{
[BaseType (typeof(UIViewController))]
public interface MMDrawerController
{
[Export("initWithCenterViewController:leftDrawerViewController:")]
IntPtr Constructor(UIViewController centerViewController, UIViewController leftDrawerViewController);
[Export("toggleDrawerSide:animated:completion:")]
void ToggleDrawerSide(MMDrawerSide drawerSide, bool animated, IntPtr completion);
}
}
| mit | C# |
f31605d3218ce88b7368806892ec9d20a02d8440 | Update Program.cs | alokpro/GitTest1 | ConsoleApplication1/ConsoleApplication1/Program.cs | ConsoleApplication1/ConsoleApplication1/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//Code just added in GitHub
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
}
}
}
| mit | C# |
7afed7da64f921ecc5b929441592215f72b6608b | print the absolute uri of the request | cloudfoundry/wats,cloudfoundry-incubator/wats,cloudfoundry-incubator/wats,cloudfoundry/wats,cloudfoundry-incubator/wats,cloudfoundry-incubator/wats,cloudfoundry/wats,cloudfoundry-incubator/wats,cloudfoundry/wats,cloudfoundry/wats | Nora/Controllers/InstancesController.cs | Nora/Controllers/InstancesController.cs | using System;
using System.Web.Http;
namespace nora.Controllers
{
public class InstancesController : ApiController
{
[Route("~/")]
[HttpGet]
public IHttpActionResult Root()
{
return Ok(String.Format("hello i am nora running on {0}", Request.RequestUri.AbsoluteUri));
}
[Route("~/id")]
[HttpGet]
public IHttpActionResult Id()
{
const string uuid = "A123F285-26B4-45F1-8C31-816DC5F53ECF";
return Ok(uuid);
}
[Route("~/env")]
[HttpGet]
public IHttpActionResult Env()
{
return Ok(Environment.GetEnvironmentVariables());
}
[Route("~/env/:name")]
[HttpGet]
public IHttpActionResult EnvName(string name)
{
return Ok(Environment.GetEnvironmentVariable(name));
}
}
} | using System;
using System.Web.Http;
namespace nora.Controllers
{
public class InstancesController : ApiController
{
[Route("~/")]
[HttpGet]
public IHttpActionResult Root()
{
return Ok("hello i am nora");
}
[Route("~/id")]
[HttpGet]
public IHttpActionResult Id()
{
const string uuid = "A123F285-26B4-45F1-8C31-816DC5F53ECF";
return Ok(uuid);
}
[Route("~/env")]
[HttpGet]
public IHttpActionResult Env()
{
return Ok(Environment.GetEnvironmentVariables());
}
[Route("~/env/:name")]
[HttpGet]
public IHttpActionResult EnvName(string name)
{
return Ok(Environment.GetEnvironmentVariable(name));
}
}
} | apache-2.0 | C# |
622d4e078f47f8fc488163df059ec853967c3127 | handle language in 1.x and 2.x plugins | quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot | CactbotOverlay/FFXIVPlugin.cs | CactbotOverlay/FFXIVPlugin.cs | using Advanced_Combat_Tracker;
using System;
using System.Reflection;
namespace Cactbot {
public class FFXIVPlugin {
private ILogger logger_;
public FFXIVPlugin(ILogger logger) {
logger_ = logger;
}
public string GetLocaleString() {
switch (GetLanguageId()) {
case 1:
return "en";
case 2:
return "fr";
case 3:
return "de";
case 4:
return "ja";
default:
return null;
}
}
public int GetLanguageId() {
IActPluginV1 ffxiv_plugin = null;
foreach (var plugin in ActGlobals.oFormActMain.ActPlugins) {
var file = plugin.pluginFile.Name;
if (file == "FFXIV_ACT_Plugin.dll") {
if (ffxiv_plugin != null) {
logger_.LogWarning("Multiple FFXIV_ACT_Plugin.dll plugins loaded");
}
ffxiv_plugin = plugin.pluginObj;
}
}
if (ffxiv_plugin == null) {
logger_.LogError("No FFXIV_ACT_Plugin.dll found? Can't set language automatically.");
return 0;
}
// Cannot "just" cast to FFXIV_ACT_Plugin.FFXIV_ACT_Plugin here, because
// ACT uses LoadFrom which places the assembly into its own loading
// context. Use dynamic here to make this choice at runtime.
// ffxiv plugin 1.x path
try {
dynamic plugin_derived = ffxiv_plugin;
return (int)plugin_derived.Settings.GetParseSettings().LanguageID;
} catch (Exception) {
}
// ffxiv plugin 2.x path
try {
// Cannot "just" cast to FFXIV_ACT_Plugin.FFXIV_ACT_Plugin here, because
// ACT uses LoadFrom which places the assembly into its own loading
// context. Use dynamic here to make this choice at runtime.
dynamic plugin_derived = ffxiv_plugin;
return (int)plugin_derived.DataRepository.GetSelectedLanguageID();
} catch (Exception e) {
logger_.LogError("Error while determining language: {0}", e.ToString());
return 0;
}
}
}
} | using Advanced_Combat_Tracker;
using System;
using System.Reflection;
namespace Cactbot {
public class FFXIVPlugin {
private ILogger logger_;
public FFXIVPlugin(ILogger logger) {
logger_ = logger;
}
public string GetLocaleString() {
switch (GetLanguageId()) {
case 1:
return "en";
case 2:
return "fr";
case 3:
return "de";
case 4:
return "ja";
default:
return null;
}
}
public int GetLanguageId() {
IActPluginV1 ffxiv_plugin = null;
foreach (var plugin in ActGlobals.oFormActMain.ActPlugins) {
var file = plugin.pluginFile.Name;
if (file == "FFXIV_ACT_Plugin.dll") {
if (ffxiv_plugin != null) {
logger_.LogWarning("Multiple FFXIV_ACT_Plugin.dll plugins loaded");
}
ffxiv_plugin = plugin.pluginObj;
}
}
if (ffxiv_plugin == null) {
logger_.LogError("No FFXIV_ACT_Plugin.dll found? Can't set language automatically.");
return 0;
}
try {
return GetLanguageInternal(ffxiv_plugin);
} catch (Exception e) {
logger_.LogError("Error while determining language: {0}", e.ToString());
return 0;
}
}
private int GetLanguageInternal(IActPluginV1 plugin) {
// Cannot "just" cast to FFXIV_ACT_Plugin.FFXIV_ACT_Plugin here, because
// ACT uses LoadFrom which places the assembly into its own loading
// context. This means you can't ever cast to these types, because types
// in the normal DLL assembly loaded via path is a different type than
// the one in the other context. So, time for reflection. And sadness.
// This is brittle, but hopefully ravahn never changes these signatures.
// The other alternative is to find and load the XML settings.
// See also:
// http://www.hanselman.com/blog/FusionLoaderContextsUnableToCastObjectOfTypeWhateverToTypeWhatever.aspx
// https://blogs.msdn.microsoft.com/aszego/2009/10/16/avoid-using-assembly-loadfrom/
FieldInfo fi = plugin.GetType().GetField("Settings", BindingFlags.GetField | BindingFlags.Public | BindingFlags.Instance);
var settings = fi.GetValue(plugin);
MethodInfo mi = settings.GetType().GetMethod("GetParseSettings", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance);
var parse_settings = mi.Invoke(settings, new object[] { });
fi = parse_settings.GetType().GetField("LanguageID", BindingFlags.GetField | BindingFlags.Public | BindingFlags.Instance);
return (int)fi.GetValue(parse_settings);
}
}
} | apache-2.0 | C# |
1037bf1f5e03ec44b3aaa4ab1c83c467b701e801 | Update version to 1.0.0-prerelease02 | affecto/dotnet-Middleware.Monitoring.Owin | Sources/Monitoring.Owin/Properties/AssemblyInfo.cs | Sources/Monitoring.Owin/Properties/AssemblyInfo.cs | using System.Reflection;
// 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("Affecto.Middleware.Monitoring.Owin")]
[assembly: AssemblyDescription("Monitoring middleware implementation based on OWIN interface defined in Microsoft.Owin NuGet.")]
[assembly: AssemblyProduct("Affecto.Middleware.Monitoring")]
[assembly: AssemblyCompany("Affecto")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// This version is used by NuGet:
[assembly: AssemblyInformationalVersion("1.0.0-prerelease02")]
| using System.Reflection;
// 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("Affecto.Middleware.Monitoring.Owin")]
[assembly: AssemblyDescription("Monitoring middleware implementation based on OWIN interface defined in Microsoft.Owin NuGet.")]
[assembly: AssemblyProduct("Affecto.Middleware.Monitoring")]
[assembly: AssemblyCompany("Affecto")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// This version is used by NuGet:
[assembly: AssemblyInformationalVersion("1.0.0-prerelease01")]
| mit | C# |
bd08ba56136963dab5283deabf67cfe3876bb8ac | Change ProductHeaderValue to be more sane | dampir/octokit.net,mminns/octokit.net,gabrielweyer/octokit.net,TattsGroup/octokit.net,alfhenrik/octokit.net,Sarmad93/octokit.net,gdziadkiewicz/octokit.net,SmithAndr/octokit.net,octokit-net-test-org/octokit.net,khellang/octokit.net,ivandrofly/octokit.net,michaKFromParis/octokit.net,forki/octokit.net,cH40z-Lord/octokit.net,octokit-net-test/octokit.net,SLdragon1989/octokit.net,shana/octokit.net,shiftkey/octokit.net,takumikub/octokit.net,mminns/octokit.net,brramos/octokit.net,shana/octokit.net,shiftkey-tester/octokit.net,devkhan/octokit.net,eriawan/octokit.net,gabrielweyer/octokit.net,ChrisMissal/octokit.net,thedillonb/octokit.net,geek0r/octokit.net,hitesh97/octokit.net,editor-tools/octokit.net,gdziadkiewicz/octokit.net,shiftkey-tester/octokit.net,dlsteuer/octokit.net,magoswiat/octokit.net,fake-organization/octokit.net,shiftkey/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,ivandrofly/octokit.net,khellang/octokit.net,eriawan/octokit.net,SmithAndr/octokit.net,daukantas/octokit.net,Red-Folder/octokit.net,naveensrinivasan/octokit.net,rlugojr/octokit.net,octokit-net-test-org/octokit.net,octokit/octokit.net,thedillonb/octokit.net,fffej/octokit.net,editor-tools/octokit.net,alfhenrik/octokit.net,hahmed/octokit.net,nsnnnnrn/octokit.net,devkhan/octokit.net,M-Zuber/octokit.net,SamTheDev/octokit.net,Sarmad93/octokit.net,TattsGroup/octokit.net,hahmed/octokit.net,adamralph/octokit.net,M-Zuber/octokit.net,nsrnnnnn/octokit.net,kolbasov/octokit.net,darrelmiller/octokit.net,kdolan/octokit.net,octokit/octokit.net,chunkychode/octokit.net,SamTheDev/octokit.net,chunkychode/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,rlugojr/octokit.net,bslliw/octokit.net,dampir/octokit.net | Octokit/Http/ProductHeaderValue.cs | Octokit/Http/ProductHeaderValue.cs | namespace Octokit
{
public class ProductHeaderValue
{
readonly System.Net.Http.Headers.ProductHeaderValue _productHeaderValue;
public ProductHeaderValue(string name)
: this(new System.Net.Http.Headers.ProductHeaderValue(name))
{
}
public ProductHeaderValue(string name, string value)
: this(new System.Net.Http.Headers.ProductHeaderValue(name, value))
{
}
ProductHeaderValue(System.Net.Http.Headers.ProductHeaderValue productHeader)
{
_productHeaderValue = productHeader;
}
public string Name
{
get { return _productHeaderValue.Name; }
}
public string Version
{
get { return _productHeaderValue.Version; }
}
public override bool Equals(object obj)
{
return _productHeaderValue.Equals(obj);
}
public override int GetHashCode()
{
return _productHeaderValue.GetHashCode();
}
public override string ToString()
{
return _productHeaderValue.ToString();
}
public static ProductHeaderValue Parse(string input)
{
return new ProductHeaderValue(System.Net.Http.Headers.ProductHeaderValue.Parse(input));
}
public static bool TryParse(string input,
out ProductHeaderValue parsedValue)
{
System.Net.Http.Headers.ProductHeaderValue value;
var result = System.Net.Http.Headers.ProductHeaderValue.TryParse(input, out value);
parsedValue = result ? Parse(input) : null;
return result;
}
}
} | namespace Octokit
{
public class ProductHeaderValue
{
ProductHeaderValue() { }
public ProductHeaderValue(string name)
{
_productHeaderValue = new System.Net.Http.Headers.ProductHeaderValue(name);
}
public ProductHeaderValue(string name, string value)
{
_productHeaderValue = new System.Net.Http.Headers.ProductHeaderValue(name, value);
}
System.Net.Http.Headers.ProductHeaderValue _productHeaderValue;
public string Name
{
get { return _productHeaderValue.Name; }
}
public string Version
{
get { return _productHeaderValue.Version; }
}
public override bool Equals(object obj)
{
return _productHeaderValue.Equals(obj);
}
public override int GetHashCode()
{
return _productHeaderValue.GetHashCode();
}
public override string ToString()
{
return _productHeaderValue.ToString();
}
public static ProductHeaderValue Parse(string input)
{
return new ProductHeaderValue { _productHeaderValue = System.Net.Http.Headers.ProductHeaderValue.Parse(input) };
}
public static bool TryParse(string input,
out ProductHeaderValue parsedValue)
{
System.Net.Http.Headers.ProductHeaderValue value;
var result = System.Net.Http.Headers.ProductHeaderValue.TryParse(input, out value);
parsedValue = result ? Parse(input) : null;
return result;
}
}
} | mit | C# |
b69d29e09df75169fe0f39942ca83101d9c98e3d | Fix smart string equals bug (not used anywhere) | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | MagicalCryptoWallet/Extensions/StringExtensions.cs | MagicalCryptoWallet/Extensions/StringExtensions.cs | namespace System
{
public static class StringExtensions
{
public static bool Equals(this string source, string value, StringComparison comparisonType, bool trimmed)
{
if(comparisonType == StringComparison.Ordinal)
{
if(trimmed)
{
return string.CompareOrdinal(source.Trim(), value.Trim()) == 0;
}
else
{
return string.CompareOrdinal(source, value) == 0;
}
}
else
{
if(trimmed)
{
return source.Trim().Equals(value.Trim(), comparisonType);
}
else
{
return source.Equals(value, comparisonType);
}
}
}
public static bool Contains(this string source, string toCheck, StringComparison comp)
{
return source.IndexOf(toCheck, comp) >= 0;
}
public static string[] Split(this string me, string separator, StringSplitOptions options = StringSplitOptions.None)
{
return me.Split(separator.ToCharArray(), options);
}
/// <summary>
/// Removes one leading and trailing occurence of the specified string
/// </summary>
public static string Trim(this string me, string trimString, StringComparison comparisonType)
{
return me.TrimStart(trimString, comparisonType).TrimEnd(trimString, comparisonType);
}
/// <summary>
/// Removes one leading occurence of the specified string
/// </summary>
public static string TrimStart(this string me, string trimString, StringComparison comparisonType)
{
if (me.StartsWith(trimString, comparisonType))
{
return me.Substring(trimString.Length);
}
return me;
}
/// <summary>
/// Removes one trailing occurence of the specified string
/// </summary>
public static string TrimEnd(this string me, string trimString, StringComparison comparisonType)
{
if (me.EndsWith(trimString, comparisonType))
{
return me.Substring(0, me.Length - trimString.Length);
}
return me;
}
}
}
| namespace System
{
public static class StringExtensions
{
public static bool Equals(this string source, string value, StringComparison comparisonType, bool trimmed)
{
return source.Trim().Equals(value.Trim(), comparisonType);
}
public static bool Contains(this string source, string toCheck, StringComparison comp)
{
return source.IndexOf(toCheck, comp) >= 0;
}
public static string[] Split(this string me, string separator, StringSplitOptions options = StringSplitOptions.None)
{
return me.Split(separator.ToCharArray(), options);
}
/// <summary>
/// Removes one leading and trailing occurence of the specified string
/// </summary>
public static string Trim(this string me, string trimString, StringComparison comparisonType)
{
return me.TrimStart(trimString, comparisonType).TrimEnd(trimString, comparisonType);
}
/// <summary>
/// Removes one leading occurence of the specified string
/// </summary>
public static string TrimStart(this string me, string trimString, StringComparison comparisonType)
{
if (me.StartsWith(trimString, comparisonType))
{
return me.Substring(trimString.Length);
}
return me;
}
/// <summary>
/// Removes one trailing occurence of the specified string
/// </summary>
public static string TrimEnd(this string me, string trimString, StringComparison comparisonType)
{
if (me.EndsWith(trimString, comparisonType))
{
return me.Substring(0, me.Length - trimString.Length);
}
return me;
}
}
}
| mit | C# |
4a385dee81def307d340f14f5bb0a0249e509c77 | Add AIShip constructor | iridinite/shiftdrive | Client/AIShip.cs | Client/AIShip.cs | /*
** Project ShiftDrive
** (C) Mika Molenkamp, 2016.
*/
using Microsoft.Xna.Framework;
namespace ShiftDrive {
/// <summary>
/// Represents an AI-controlled ship.
/// </summary>
internal sealed class AIShip : Ship {
public AIShip() {
type = ObjectType.AIShip;
iconfile = "player";
iconcolor = Color.Blue;
bounding = 10f;
}
public override void Update(GameState world, float deltaTime) {
base.Update(world, deltaTime);
}
}
}
| /*
** Project ShiftDrive
** (C) Mika Molenkamp, 2016.
*/
namespace ShiftDrive {
/// <summary>
/// Represents an AI-controlled ship.
/// </summary>
internal sealed class AIShip : Ship {
public override void Update(GameState world, float deltaTime) {
base.Update(world, deltaTime);
}
}
}
| bsd-3-clause | C# |
7fe17391635b16f56b9a3b9660696eb994aa8411 | Rewrite Locale to use SettingsFile as backend | iridinite/shiftdrive | Client/Locale.cs | Client/Locale.cs | /*
** Project ShiftDrive
** (C) Mika Molenkamp, 2016-2017.
*/
using System.IO;
namespace ShiftDrive {
/// <summary>
/// A language string table system. Wraps around <seealso cref="SettingsFile"/>.
/// </summary>
internal static class Locale {
private static SettingsFile table;
/// <summary>
/// Loads a string table from a file.
/// </summary>
/// <param name="filePath">The path to the file that should be loaded.</param>
public static void LoadStrings(string filePath) {
try {
table = new SettingsFile(filePath);
} catch (IOException ex) {
Logger.LogError($"Failed to read string table '{filePath}': {ex.Message}");
}
}
/// <summary>
/// Looks up the specified key in the loaded string table. If the key is not found,
/// the <paramref name="key"/> is returned unchanged.
/// </summary>
/// <param name="key">The key to use. Not case-sensitive.</param>
public static string Get(string key) {
return table.GetString(key, key);
}
}
}
| /*
** Project ShiftDrive
** (C) Mika Molenkamp, 2016-2017.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace ShiftDrive {
/// <summary>
/// A look-up system for key/value pairs with swappable value tables, allowing for
/// easy translation and localization of strings.
/// </summary>
/// <remarks>
/// Language files must follow the following format:
/// - Files should be in UTF-8 plain text format,
/// - One line may contain only one key/value pair,
/// - An equals-sign (=) seperates key from value, in that order,
/// - Leading and trailing whitespace is ignored/trimmed,
/// - Keys are case-insensitive,
/// - Comments are introduced by a number sign (#),
/// - Empty lines or otherwise invalid lines are ignored.
/// </remarks>
internal static class Locale {
private static readonly Dictionary<string, string> stringTable = new Dictionary<string, string>();
/// <summary>
/// Loads a string table from a file.
/// </summary>
/// <remarks>
/// Any previously loaded string table will be preserved.
/// If an exception is thrown, loading will be canceled. Entries that have already
/// been loaded before the exception occurred will be preserved.
/// Language files must follow the file format as specified in the class remarks.
/// </remarks>
/// <param name="filePath">The path to the file that should be loaded.</param>
public static void LoadStrings(string filePath) {
try {
using (StreamReader reader = new StreamReader(filePath, Encoding.UTF8)) {
while (!reader.EndOfStream) {
string line = reader.ReadLine();
// ReSharper disable once PossibleNullReferenceException
if (line.StartsWith("#", StringComparison.InvariantCultureIgnoreCase)) continue;
if (line.Trim().Length < 1) continue;
string[] parts = line.Split(new[] { '=' }, 2);
if (parts.Length != 2) continue;
stringTable.Add(parts[0].Trim().ToUpperInvariant(), parts[1].Trim());
}
}
} catch (IOException ex) {
Logger.LogError($"Failed to read string table '{filePath}': {ex.Message}");
}
}
/// <summary>
/// Looks up the specified key in the loaded string table(s).
/// </summary>
/// <param name="key">The key to use. Not case-sensitive.</param>
/// <returns>The string value associated with the specified key. If the key does not exist,
/// the key is returned converted to uppercase.</returns>
public static string Get(string key) {
if (String.IsNullOrEmpty(key))
throw new ArgumentNullException(nameof(key));
key = key.ToUpperInvariant();
return stringTable.ContainsKey(key) ? stringTable[key] : key;
}
}
}
| bsd-3-clause | C# |
8cc2db3904299402c2eaa6e410b83a7e0d577892 | address SutReferencesOnlySpecifiedAssemblies. | jwChung/Experimentalism,jwChung/Experimentalism | test/Experiment.IdiomsUnitTest/AssemblyLevelTest.cs | test/Experiment.IdiomsUnitTest/AssemblyLevelTest.cs | using System.Linq;
using System.Reflection;
using Xunit;
namespace Jwc.Experiment.Idioms
{
public class AssemblyLevelTest
{
[Fact]
public void SutReferencesOnlySpecifiedAssemblies()
{
var sut = typeof(IdiomaticTestCase).Assembly;
var specifiedAssemblies = new []
{
// GAC
"mscorlib",
"System.Core",
// Direct references
"Jwc.Experiment",
"Ploeh.Albedo",
"xunit",
"Ploeh.AutoFixture.Idioms"
// Indirect references
};
var actual = sut.GetActualReferencedAssemblies();
Assert.Equal(specifiedAssemblies.OrderBy(x => x), actual.OrderBy(x => x));
}
////[Theory]
////[InlineData("Ploeh.AutoFixture.Idioms")]
public void SutDoesNotExposeAnyTypesOfSpecifiedReference(string name)
{
// Fixture setup
var sut = typeof(IdiomaticTestCase).Assembly;
var assemblyName = sut.GetActualReferencedAssemblies().Single(n => n == name);
var types = Assembly.Load(assemblyName).GetExportedTypes();
// Exercise system and Verify outcome
sut.VerifyDoesNotExpose(types);
}
}
} | using System.Linq;
using System.Reflection;
using Xunit;
namespace Jwc.Experiment.Idioms
{
public class AssemblyLevelTest
{
[Fact]
public void SutReferencesOnlySpecifiedAssemblies()
{
var sut = typeof(IdiomaticTestCase).Assembly;
var specifiedAssemblies = new []
{
// GAC
"mscorlib",
"System.Core",
// Direct references
"Jwc.Experiment",
"Ploeh.Albedo",
"xunit"
// Indirect references
};
var actual = sut.GetActualReferencedAssemblies();
Assert.Equal(specifiedAssemblies.OrderBy(x => x), actual.OrderBy(x => x));
}
//[Theory]
//[InlineData("Jwc.Experiment")]
public void SutDoesNotExposeAnyTypesOfSpecifiedReference(string name)
{
// Fixture setup
var sut = typeof(IdiomaticTestCase).Assembly;
var assemblyName = sut.GetActualReferencedAssemblies().Single(n => n == name);
var types = Assembly.Load(assemblyName).GetExportedTypes();
// Exercise system and Verify outcome
sut.VerifyDoesNotExpose(types);
}
}
} | mit | C# |
2d4f858cc95e098912cc37548c4a8176cbcc6cca | Add Tests For DateTime Extensions | atbyrd/Withings.NET,atbyrd/Withings.NET | Withings.Specifications/DateTimeExtensionsTests.cs | Withings.Specifications/DateTimeExtensionsTests.cs | using System;
using FluentAssertions;
using NUnit.Framework;
using Withings.NET.Client;
namespace Withings.Specifications
{
[TestFixture]
public class DateTimeExtensionsTests
{
[Test]
public void DoubleFromUnixTimeTest()
{
((double)1491934309).FromUnixTime().Date.Should().Equals(DateTime.Parse("04/11/2017"));
}
[Test]
public void LongFromUnixTimeTest()
{
((long)1491934309).FromUnixTime().Date.Should().Equals(DateTime.Parse("04/11/2017"));
}
[Test]
public void IntFromUnixTimeTest()
{
1491934309.FromUnixTime().Date.Should().Equals(DateTime.Parse("04/11/2017"));
}
[Test]
public void DateTimeToUnixTimeTest()
{
DateTime.Parse("04/11/2017").ToUnixTime().Should().Equals(1491934309);
}
}
} | using System;
using FluentAssertions;
using NUnit.Framework;
using Withings.NET.Client;
namespace Withings.Specifications
{
[TestFixture]
public class DateTimeExtensionsTests
{
[Test]
public void DoubleFromUnixTimeTest()
{
((double)1491934309).FromUnixTime().Date.Should().Equals(DateTime.Parse("04/11/2017"));
}
[Test]
public void LongFromUnixTimeTest()
{
((long)1491934309).FromUnixTime().Date.Should().Equals(DateTime.Parse("04/11/2017"));
}
[Test]
public void IntFromUnixTimeTest()
{
1491934309.FromUnixTime().Date.Should().Equals(DateTime.Parse("04/11/2017"));
}
[Test]
public void DateTimeToUnixTimeTest()
{
DateTime.Parse("04/11/2017").Should().Equals(1491934309);
}
}
} | mit | C# |
a386ccce3f8b6683557850a9d5efc4a6aaf21691 | Revert sizing change for docked content. Caused performance and layout issues with TableLayout. | bbqchickenrobot/Eto-1,l8s/Eto,l8s/Eto,l8s/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,PowerOfCode/Eto,PowerOfCode/Eto,PowerOfCode/Eto | Source/Eto.WinForms/Forms/Controls/PanelHandler.cs | Source/Eto.WinForms/Forms/Controls/PanelHandler.cs | using swf = System.Windows.Forms;
using sd = System.Drawing;
using Eto.Forms;
using System;
namespace Eto.WinForms.Forms.Controls
{
public class PanelHandler : WindowsPanel<PanelHandler.EtoPanel, Panel, Panel.ICallback>, Panel.IHandler
{
public class EtoPanel : swf.Panel
{
// CWEN: Comment out for now, this causes issues with TableLayout (see UnitTestSection, the search box is obscured),
// and actually dramatically decreases performance in some circumstances.
/*
public override sd.Size GetPreferredSize(sd.Size proposedSize)
{
// WinForms have problems with autosizing vs. docking
// this will solve some of its problems and speed things up.
// Not perfect, would be better to write it all new,
// especially if all inner controls are docked,
// but this is common scenairo when panels are emitted
// from Eto layout engine.
if (Controls.Count == 1 && Controls[0].Dock == swf.DockStyle.Fill)
return Controls[0].GetPreferredSize(new sd.Size(
Math.Max(0, proposedSize.Width - Padding.Horizontal),
Math.Max(0, proposedSize.Height - Padding.Vertical)))
+ Padding.Size;
// fallback to default engine
return base.GetPreferredSize(proposedSize);
}*/
// Need to override IsInputKey to capture
// the arrow keys.
protected override bool IsInputKey (swf.Keys keyData)
{
switch (keyData & swf.Keys.KeyCode) {
case swf.Keys.Up:
case swf.Keys.Down:
case swf.Keys.Left:
case swf.Keys.Right:
case swf.Keys.Back:
return true;
default:
return base.IsInputKey (keyData);
}
}
}
public PanelHandler ()
{
Control = new EtoPanel
{
Size = sd.Size.Empty,
MinimumSize = sd.Size.Empty,
AutoSize = true,
AutoSizeMode = swf.AutoSizeMode.GrowAndShrink
};
}
}
}
| using swf = System.Windows.Forms;
using sd = System.Drawing;
using Eto.Forms;
using System;
namespace Eto.WinForms.Forms.Controls
{
public class PanelHandler : WindowsPanel<PanelHandler.EtoPanel, Panel, Panel.ICallback>, Panel.IHandler
{
public class EtoPanel : swf.Panel
{
public override sd.Size GetPreferredSize(sd.Size proposedSize)
{
// WinForms have problems with autosizing vs. docking
// this will solve some of its problems and speed things up.
// Not perfect, would be better to write it all new,
// especially if all inner controls are docked,
// but this is common scenairo when panels are emitted
// from Eto layout engine.
if (Controls.Count == 1 && Controls[0].Dock == swf.DockStyle.Fill)
return Controls[0].GetPreferredSize(new sd.Size(
Math.Max(0, proposedSize.Width - Padding.Horizontal),
Math.Max(0, proposedSize.Height - Padding.Vertical)))
+ Padding.Size;
// fallback to default engine
return base.GetPreferredSize(proposedSize);
}
// Need to override IsInputKey to capture
// the arrow keys.
protected override bool IsInputKey (swf.Keys keyData)
{
switch (keyData & swf.Keys.KeyCode) {
case swf.Keys.Up:
case swf.Keys.Down:
case swf.Keys.Left:
case swf.Keys.Right:
case swf.Keys.Back:
return true;
default:
return base.IsInputKey (keyData);
}
}
}
public PanelHandler ()
{
Control = new EtoPanel
{
Size = sd.Size.Empty,
MinimumSize = sd.Size.Empty,
AutoSize = true,
AutoSizeMode = swf.AutoSizeMode.GrowAndShrink
};
}
}
}
| bsd-3-clause | C# |
afd389fa69777b5cdd0d88000501bd079b824f86 | Fix usage of deprecated Action.BeginInvoke() | smoogipooo/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,Tom94/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework | osu.Framework.Tests/Platform/HeadlessGameHostTest.cs | osu.Framework.Tests/Platform/HeadlessGameHostTest.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.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.Platform;
namespace osu.Framework.Tests.Platform
{
[TestFixture]
public class HeadlessGameHostTest
{
private class Foobar
{
public string Bar;
}
[Test]
public void TestIpc()
{
using (var server = new HeadlessGameHost(@"server", true))
using (var client = new HeadlessGameHost(@"client", true))
{
Assert.IsTrue(server.IsPrimaryInstance, @"Server wasn't able to bind");
Assert.IsFalse(client.IsPrimaryInstance, @"Client was able to bind when it shouldn't have been able to");
var serverChannel = new IpcChannel<Foobar>(server);
var clientChannel = new IpcChannel<Foobar>(client);
Action waitAction = () =>
{
bool received = false;
serverChannel.MessageReceived += message =>
{
Assert.AreEqual("example", message.Bar);
received = true;
};
clientChannel.SendMessageAsync(new Foobar { Bar = "example" }).Wait();
while (!received)
Thread.Sleep(1);
};
Assert.IsTrue(Task.Run(waitAction).Wait(10000), @"Message was not received in a timely fashion");
}
}
}
}
| // 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.Threading;
using NUnit.Framework;
using osu.Framework.Platform;
namespace osu.Framework.Tests.Platform
{
[TestFixture]
public class HeadlessGameHostTest
{
private class Foobar
{
public string Bar;
}
[Test]
public void TestIpc()
{
using (var server = new HeadlessGameHost(@"server", true))
using (var client = new HeadlessGameHost(@"client", true))
{
Assert.IsTrue(server.IsPrimaryInstance, @"Server wasn't able to bind");
Assert.IsFalse(client.IsPrimaryInstance, @"Client was able to bind when it shouldn't have been able to");
var serverChannel = new IpcChannel<Foobar>(server);
var clientChannel = new IpcChannel<Foobar>(client);
Action waitAction = () =>
{
bool received = false;
serverChannel.MessageReceived += message =>
{
Assert.AreEqual("example", message.Bar);
received = true;
};
clientChannel.SendMessageAsync(new Foobar { Bar = "example" }).Wait();
while (!received)
Thread.Sleep(1);
};
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(10000),
@"Message was not received in a timely fashion");
}
}
}
}
| mit | C# |
4e839e4f1fb595740caa29f901f7072fc2858f23 | Fix "welcome" intro test failure due to no wait logic | peppy/osu,smoogipoo/osu,ppy/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,smoogipooo/osu | osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs | osu.Game.Tests/Visual/Menus/TestSceneIntroWelcome.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Audio.Track;
using osu.Framework.Screens;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.Menus
{
[TestFixture]
public class TestSceneIntroWelcome : IntroTestScene
{
protected override IScreen CreateScreen() => new IntroWelcome();
public TestSceneIntroWelcome()
{
AddUntilStep("wait for load", () => getTrack() != null);
AddAssert("check if menu music loops", () => getTrack().Looping);
}
private Track getTrack() => (IntroStack?.CurrentScreen as MainMenu)?.Track;
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Screens;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.Menus
{
[TestFixture]
public class TestSceneIntroWelcome : IntroTestScene
{
protected override IScreen CreateScreen() => new IntroWelcome();
public TestSceneIntroWelcome()
{
AddAssert("check if menu music loops", () =>
{
var menu = IntroStack?.CurrentScreen as MainMenu;
if (menu == null)
return false;
return menu.Track.Looping;
});
}
}
}
| mit | C# |
be500070ad1620f5fc21b77ea94fb802b0c9b22c | Revert last commit since it is currently not possible. | samus/mongodb-csharp,mongodb-csharp/mongodb-csharp,zh-huan/mongodb | MongoDBDriver/AssemblyInfo.cs | MongoDBDriver/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("MongoDBDriver")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: CLSCompliantAttribute(true)]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Bson")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Bson")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)]
| using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("MongoDBDriver")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: CLSCompliantAttribute(true)]
[assembly: InternalsVisibleTo("MongoDB.Driver.Tests")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Bson")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Bson")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)]
| apache-2.0 | C# |
0bd9f68cbd6758faa79fbb8a3feac064edb2bdda | Refactor update stream colour mapping code | NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,peppy/osu,peppy/osu-new,ppy/osu,UselessToucan/osu,peppy/osu,ppy/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu | osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs | osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using osu.Framework.Graphics.Colour;
using osuTK.Graphics;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIUpdateStream : IEquatable<APIUpdateStream>
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("is_featured")]
public bool IsFeatured { get; set; }
[JsonProperty("display_name")]
public string DisplayName { get; set; }
[JsonProperty("latest_build")]
public APIChangelogBuild LatestBuild { get; set; }
public bool Equals(APIUpdateStream other) => Id == other?.Id;
internal static readonly Dictionary<string, Color4> KNOWN_STREAMS = new Dictionary<string, Color4>
{
["stable40"] = new Color4(102, 204, 255, 255),
["stable"] = new Color4(34, 153, 187, 255),
["beta40"] = new Color4(255, 221, 85, 255),
["cuttingedge"] = new Color4(238, 170, 0, 255),
[OsuGameBase.CLIENT_STREAM_NAME] = new Color4(237, 18, 33, 255),
["web"] = new Color4(136, 102, 238, 255)
};
public ColourInfo Colour => KNOWN_STREAMS.TryGetValue(Name, out var colour) ? colour : new Color4(0, 0, 0, 255);
}
}
| // 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 Newtonsoft.Json;
using osu.Framework.Graphics.Colour;
using osuTK.Graphics;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIUpdateStream : IEquatable<APIUpdateStream>
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("is_featured")]
public bool IsFeatured { get; set; }
[JsonProperty("display_name")]
public string DisplayName { get; set; }
[JsonProperty("latest_build")]
public APIChangelogBuild LatestBuild { get; set; }
public bool Equals(APIUpdateStream other) => Id == other?.Id;
public ColourInfo Colour
{
get
{
switch (Name)
{
case "stable40":
return new Color4(102, 204, 255, 255);
case "stable":
return new Color4(34, 153, 187, 255);
case "beta40":
return new Color4(255, 221, 85, 255);
case "cuttingedge":
return new Color4(238, 170, 0, 255);
case OsuGameBase.CLIENT_STREAM_NAME:
return new Color4(237, 18, 33, 255);
case "web":
return new Color4(136, 102, 238, 255);
default:
return new Color4(0, 0, 0, 255);
}
}
}
}
}
| mit | C# |
b76464da01b82ffaf4358494cb9e639db657682b | fix exif test params | fengyhack/csharp-sdk,qiniu/csharp-sdk | Qiniu.Test/FileOp/ExifTest.cs | Qiniu.Test/FileOp/ExifTest.cs | using Qiniu.FileOp;
using Qiniu.RS;
using NUnit.Framework;
using System;
namespace Qiniu.Test.FileOp
{
/// <summary>
///这是 ExifTest 的测试类,旨在
///包含所有 ExifTest 单元测试
///</summary>
[TestFixture]
public class ExifTest:QiniuTestBase
{
/// <summary>
///MakeRequest 的测试
///</summary>
[Test]
public void MakeRequestTest()
{
string url = GetPolicy.MakeBaseUrl("qiniuphotos.qiniudn.com", "gogopher.jpg"); // TODO: 初始化为适当的值
string actual = Exif.MakeRequest(url);
ExifRet ret = Exif.Call(actual);
Assert.IsTrue(ret.OK, "MakeRequestTest Failure");
}
}
}
| using Qiniu.FileOp;
using Qiniu.RS;
using NUnit.Framework;
using System;
namespace Qiniu.Test.FileOp
{
/// <summary>
///这是 ExifTest 的测试类,旨在
///包含所有 ExifTest 单元测试
///</summary>
[TestFixture]
public class ExifTest:QiniuTestBase
{
/// <summary>
///MakeRequest 的测试
///</summary>
[Test]
public void MakeRequestTest()
{
string url = GetPolicy.MakeBaseUrl(DOMAIN, LocalKey); // TODO: 初始化为适当的值
string actual = Exif.MakeRequest(url);
ExifRet ret = Exif.Call(actual);
Assert.IsTrue(ret.OK, "MakeRequestTest Failure");
}
}
}
| mit | C# |
595f2abaaaaa02e67df94c0be9f05b45f48817ed | Add method to parse ints and throw exception on failure. | jcheng31/SGEnviro | SGEnviro/Utilities/Parsing.cs | SGEnviro/Utilities/Parsing.cs | using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace SGEnviro.Utilities
{
public class NumberParseException : Exception
{
public NumberParseException(string message) { }
}
public class Parsing
{
public static void ParseFloatOrThrowException(string value, out float destination, string message)
{
if (!float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out destination))
{
throw new NumberParseException(message);
}
}
public static void ParseIntOrThrowException(string value, out int destination, string message)
{
if (!int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out destination))
{
throw new NumberParseException(message);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace SGEnviro.Utilities
{
public class NumberParseException : Exception
{
public NumberParseException(string message) { }
}
public class Parsing
{
public static void ParseFloatOrThrowException(string value, out float destination, string message)
{
if (!float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out destination))
{
throw new Exception(message);
}
}
}
}
| mit | C# |
bd9f575f6a5d65011b68c61ea6b3ab8b7dbf451e | Allow SectionLoader to read from streams | MHeasell/SnappyMap,MHeasell/SnappyMap | SnappyMap/IO/SectionLoader.cs | SnappyMap/IO/SectionLoader.cs | namespace SnappyMap.IO
{
using System.IO;
using System.Linq;
using TAUtil.Sct;
public class SectionLoader
{
private readonly ITileDatabase tileDatabase;
public SectionLoader(ITileDatabase tileDatabase)
{
this.tileDatabase = tileDatabase;
}
public Section ReadSection(string filename)
{
using (SctReader reader = new SctReader(filename))
{
return this.ReadSection(reader);
}
}
public Section ReadSection(Stream source)
{
using (SctReader reader = new SctReader(source))
{
return this.ReadSection(reader);
}
}
public Section ReadSection(ISctSource source)
{
int[] tileIds = source.EnumerateTiles().Select(x => this.tileDatabase.AddTile(x)).ToArray();
Section sct = new Section(source.DataWidth, source.DataHeight);
var dataEnum = source.EnumerateData().GetEnumerator();
for (int i = 0; i < source.DataWidth * source.DataHeight; i++)
{
dataEnum.MoveNext();
sct.TileData[i] = this.tileDatabase.GetTileById(tileIds[dataEnum.Current]);
}
var attrEnum = source.EnumerateAttrs().GetEnumerator();
for (int i = 0; i < source.DataWidth * source.DataHeight * 4; i++)
{
attrEnum.MoveNext();
sct.HeightData[i] = attrEnum.Current.Height;
}
return sct;
}
}
}
| namespace SnappyMap.IO
{
using System.Linq;
using TAUtil.Sct;
public class SectionLoader
{
private readonly ITileDatabase tileDatabase;
public SectionLoader(ITileDatabase tileDatabase)
{
this.tileDatabase = tileDatabase;
}
public Section ReadSection(string filename)
{
using (SctReader reader = new SctReader(filename))
{
return this.ReadSection(reader);
}
}
public Section ReadSection(ISctSource source)
{
int[] tileIds = source.EnumerateTiles().Select(x => this.tileDatabase.AddTile(x)).ToArray();
Section sct = new Section(source.DataWidth, source.DataHeight);
var dataEnum = source.EnumerateData().GetEnumerator();
for (int i = 0; i < source.DataWidth * source.DataHeight; i++)
{
dataEnum.MoveNext();
sct.TileData[i] = this.tileDatabase.GetTileById(tileIds[dataEnum.Current]);
}
var attrEnum = source.EnumerateAttrs().GetEnumerator();
for (int i = 0; i < source.DataWidth * source.DataHeight * 4; i++)
{
attrEnum.MoveNext();
sct.HeightData[i] = attrEnum.Current.Height;
}
return sct;
}
}
}
| mit | C# |
2f83d973a279b6c998176a61fa391654b10451bb | Change HipChatNotifier to use configuration provider | timclipsham/tfs-hipchat | TfsHipChat/HipChatNotifier.cs | TfsHipChat/HipChatNotifier.cs | using HipChat;
using TfsHipChat.Configuration;
using TfsHipChat.Tfs.Events;
namespace TfsHipChat
{
public class HipChatNotifier : INotifier
{
private readonly IConfigurationProvider _configurationProvider;
private readonly HipChatClient _hipChatClient;
public HipChatNotifier() : this(new ConfigurationProvider())
{
}
public HipChatNotifier(IConfigurationProvider configurationProvider)
{
_configurationProvider = configurationProvider;
_hipChatClient = new HipChatClient
{
Token = _configurationProvider.Config.HipChatToken,
From = _configurationProvider.Config.HipChatFrom
};
}
public void SendCheckinNotification(CheckinEvent checkinEvent, int roomId)
{
var message = string.Format("{0} checked in changeset <a href=\"{1}\">{2}</a> ({4})<br>{3}",
checkinEvent.CommitterDisplay, checkinEvent.GetChangesetUrl(), checkinEvent.Number,
checkinEvent.Comment, checkinEvent.TeamProject);
_hipChatClient.RoomId = roomId;
_hipChatClient.SendMessage(message, HipChatClient.BackgroundColor.yellow);
}
public void SendBuildCompletionFailedNotification(BuildCompletionEvent buildEvent, int roomId)
{
var message = string.Format("{0} build <a href=\"{1}\">{2}</a> {3} (requested by {4})",
buildEvent.TeamProject, buildEvent.Url, buildEvent.Id, buildEvent.CompletionStatus,
buildEvent.RequestedBy);
_hipChatClient.RoomId = roomId;
_hipChatClient.SendMessage(message, HipChatClient.BackgroundColor.red);
}
public void SendBuildCompletionSuccessNotification(BuildCompletionEvent buildEvent, int roomId)
{
var message = string.Format("{0} build <a href=\"{1}\">{2}</a> {3} (requested by {4})",
buildEvent.TeamProject, buildEvent.Url, buildEvent.Id, buildEvent.CompletionStatus,
buildEvent.RequestedBy);
_hipChatClient.RoomId = roomId;
_hipChatClient.SendMessage(message, HipChatClient.BackgroundColor.green);
}
}
}
| using HipChat;
using TfsHipChat.Tfs.Events;
namespace TfsHipChat
{
public class HipChatNotifier : INotifier
{
private readonly HipChatClient _hipChatClient;
public HipChatNotifier()
{
_hipChatClient = new HipChatClient
{
Token = Properties.Settings.Default.HipChat_Token,
From = Properties.Settings.Default.HipChat_From
};
}
public void SendCheckinNotification(CheckinEvent checkinEvent, int roomId)
{
var message = string.Format("{0} checked in changeset <a href=\"{1}\">{2}</a> ({4})<br>{3}",
checkinEvent.CommitterDisplay, checkinEvent.GetChangesetUrl(), checkinEvent.Number,
checkinEvent.Comment, checkinEvent.TeamProject);
_hipChatClient.RoomId = roomId;
_hipChatClient.SendMessage(message, HipChatClient.BackgroundColor.yellow);
}
public void SendBuildCompletionFailedNotification(BuildCompletionEvent buildEvent, int roomId)
{
var message = string.Format("{0} build <a href=\"{1}\">{2}</a> {3} (requested by {4})",
buildEvent.TeamProject, buildEvent.Url, buildEvent.Id, buildEvent.CompletionStatus,
buildEvent.RequestedBy);
_hipChatClient.RoomId = roomId;
_hipChatClient.SendMessage(message, HipChatClient.BackgroundColor.red);
}
public void SendBuildCompletionSuccessNotification(BuildCompletionEvent buildEvent, int roomId)
{
var message = string.Format("{0} build <a href=\"{1}\">{2}</a> {3} (requested by {4})",
buildEvent.TeamProject, buildEvent.Url, buildEvent.Id, buildEvent.CompletionStatus,
buildEvent.RequestedBy);
_hipChatClient.RoomId = roomId;
_hipChatClient.SendMessage(message, HipChatClient.BackgroundColor.green);
}
}
}
| mit | C# |
b91e34b00cfa25b60dd9434b24ab855022de212a | Update the Licensed of consumer file | StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals,StyleTang/incubator-rocketmq-externals | rocketmq-client-donet/example/consumer.cs | rocketmq-client-donet/example/consumer.cs | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Runtime.InteropServices;
using System.Threading;
using RocketMQ.Interop;
namespace rocketmq_push_consumer_test
{
class Program
{
private static readonly PushConsumerWrap.MessageCallBack callback = new PushConsumerWrap.MessageCallBack(HandleMessageCallBack);
static void Main(string[] args)
{
//Task.Run(() => {
Console.WriteLine("start push consumer...");
var consumer = PushConsumerWrap.CreatePushConsumer("xxx");
Console.WriteLine($"consumer: {consumer}");
var r0 = PushConsumerWrap.SetPushConsumerLogLevel(consumer, CLogLevel.E_LOG_LEVEL_TRACE);
var groupId = PushConsumerWrap.GetPushConsumerGroupID(consumer);
Console.WriteLine($"groupId: {groupId}");
var r1 = PushConsumerWrap.SetPushConsumerNameServerAddress(consumer, "47.101.55.250:9876");
var r2 = PushConsumerWrap.Subscribe(consumer, "test", "*");
var r3 = PushConsumerWrap.RegisterMessageCallback(consumer, callback);
var r10 = PushConsumerWrap.StartPushConsumer(consumer);
Console.WriteLine($"start push consumer ptr: {r10}");
while (true)
{
Thread.Sleep(500);
}
//});
Console.ReadKey(true);
//PushConsumerBinder.DestroyPushConsumer(consumer);
}
public static int HandleMessageCallBack(IntPtr consumer, IntPtr message)
{
Console.WriteLine($"consumer: {consumer}; messagePtr: {message}");
var body = MessageWrap.GetMessageBody(message);
var messageId = MessageWrap.GetMessageId(message);
Console.WriteLine($"body: {body}");
return 0;
}
}
}
| using System;
using System.Runtime.InteropServices;
using System.Threading;
using RocketMQ.Interop;
namespace rocketmq_push_consumer_test
{
class Program
{
private static readonly PushConsumerWrap.MessageCallBack callback = new PushConsumerWrap.MessageCallBack(HandleMessageCallBack);
static void Main(string[] args)
{
//Task.Run(() => {
Console.WriteLine("start push consumer...");
var consumer = PushConsumerWrap.CreatePushConsumer("xxx");
Console.WriteLine($"consumer: {consumer}");
var r0 = PushConsumerWrap.SetPushConsumerLogLevel(consumer, CLogLevel.E_LOG_LEVEL_TRACE);
var groupId = PushConsumerWrap.GetPushConsumerGroupID(consumer);
Console.WriteLine($"groupId: {groupId}");
var r1 = PushConsumerWrap.SetPushConsumerNameServerAddress(consumer, "47.101.55.250:9876");
var r2 = PushConsumerWrap.Subscribe(consumer, "test", "*");
var r3 = PushConsumerWrap.RegisterMessageCallback(consumer, callback);
var r10 = PushConsumerWrap.StartPushConsumer(consumer);
Console.WriteLine($"start push consumer ptr: {r10}");
while (true)
{
Thread.Sleep(500);
}
//});
Console.ReadKey(true);
//PushConsumerBinder.DestroyPushConsumer(consumer);
}
public static int HandleMessageCallBack(IntPtr consumer, IntPtr message)
{
Console.WriteLine($"consumer: {consumer}; messagePtr: {message}");
var body = MessageWrap.GetMessageBody(message);
var messageId = MessageWrap.GetMessageId(message);
Console.WriteLine($"body: {body}");
return 0;
}
}
}
| apache-2.0 | C# |
18b7cc81213b00362fcedbea2f8a181dac0dfe18 | Bump version | roend83/FluentValidation,olcayseker/FluentValidation,robv8r/FluentValidation,pacificIT/FluentValidation,deluxetiky/FluentValidation,mgmoody42/FluentValidation,GDoronin/FluentValidation,glorylee/FluentValidation,ruisebastiao/FluentValidation,IRlyDontKnow/FluentValidation,roend83/FluentValidation,regisbsb/FluentValidation,cecilphillip/FluentValidation | src/CommonAssemblyInfo.cs | src/CommonAssemblyInfo.cs | #region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
[assembly : AssemblyTitle("FluentValidation")]
[assembly : AssemblyDescription("FluentValidation")]
[assembly : AssemblyProduct("FluentValidation")]
[assembly : AssemblyCopyright("Copyright (c) Jeremy Skinner 2008-2011")]
[assembly : ComVisible(false)]
[assembly : AssemblyVersion("3.3.1.0")]
[assembly : AssemblyFileVersion("3.3.1.0")]
[assembly: CLSCompliant(true)]
#if !SILVERLIGHT
[assembly: AllowPartiallyTrustedCallers]
#endif | #region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
[assembly : AssemblyTitle("FluentValidation")]
[assembly : AssemblyDescription("FluentValidation")]
[assembly : AssemblyProduct("FluentValidation")]
[assembly : AssemblyCopyright("Copyright (c) Jeremy Skinner 2008-2011")]
[assembly : ComVisible(false)]
[assembly : AssemblyVersion("3.3.0.0")]
[assembly : AssemblyFileVersion("3.3.0.0")]
[assembly: CLSCompliant(true)]
#if !SILVERLIGHT
[assembly: AllowPartiallyTrustedCallers]
#endif | apache-2.0 | C# |
304f78bc090fb9e9408eb90eaadd8abd65b41fa2 | Update copyright | mgmoody42/FluentValidation,glorylee/FluentValidation,regisbsb/FluentValidation,ruisebastiao/FluentValidation,IRlyDontKnow/FluentValidation,roend83/FluentValidation,roend83/FluentValidation,deluxetiky/FluentValidation,GDoronin/FluentValidation,cecilphillip/FluentValidation,robv8r/FluentValidation,olcayseker/FluentValidation | src/CommonAssemblyInfo.cs | src/CommonAssemblyInfo.cs | #region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
[assembly : AssemblyTitle("FluentValidation")]
[assembly : AssemblyDescription("FluentValidation")]
[assembly : AssemblyProduct("FluentValidation")]
[assembly : AssemblyCopyright("Copyright (c) Jeremy Skinner 2008-2014")]
#if !PORTABLE
[assembly : ComVisible(false)]
#endif
[assembly : AssemblyVersion("5.0.0.1")]
[assembly : AssemblyFileVersion("5.0.0.1")]
[assembly: CLSCompliant(true)]
[assembly: System.Resources.NeutralResourcesLanguage("en")] | #region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
[assembly : AssemblyTitle("FluentValidation")]
[assembly : AssemblyDescription("FluentValidation")]
[assembly : AssemblyProduct("FluentValidation")]
[assembly : AssemblyCopyright("Copyright (c) Jeremy Skinner 2008-2013")]
#if !PORTABLE
[assembly : ComVisible(false)]
#endif
[assembly : AssemblyVersion("5.0.0.1")]
[assembly : AssemblyFileVersion("5.0.0.1")]
[assembly: CLSCompliant(true)]
[assembly: System.Resources.NeutralResourcesLanguage("en")] | apache-2.0 | C# |
51fe9bca9f22b986c17ff10321c1997527c3e410 | Update version for next release | lmagyar/Orleans.Activities,OrleansContrib/Orleans.Activities | src/GlobalAssemblyInfo.cs | src/GlobalAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyCompany("OrleansContrib")]
[assembly: AssemblyProduct("Orleans.Activities - https://github.com/OrleansContrib/Orleans.Activities")]
[assembly: AssemblyCopyright("Copyright OrleansContrib 2016")]
[assembly: AssemblyVersion("0.3.0")]
[assembly: AssemblyFileVersion("0.3.0")]
[assembly: AssemblyInformationalVersion("0.3.0")]
| using System.Reflection;
[assembly: AssemblyCompany("OrleansContrib")]
[assembly: AssemblyProduct("Orleans.Activities - https://github.com/OrleansContrib/Orleans.Activities")]
[assembly: AssemblyCopyright("Copyright OrleansContrib 2016")]
[assembly: AssemblyVersion("0.2.0")]
[assembly: AssemblyFileVersion("0.2.0")]
[assembly: AssemblyInformationalVersion("0.2.0")]
| apache-2.0 | C# |
e3872a17b14c2b4c59b2bd01304aa2cc68cf2ef6 | fix #260 non generic ProjectToType | eswann/Mapster | src/Mapster/Extensions.cs | src/Mapster/Extensions.cs | using System;
using System.Linq;
using System.Linq.Expressions;
using Mapster.Models;
namespace Mapster
{
public static class Extensions
{
public static IQueryable<TDestination> ProjectToType<TDestination>(this IQueryable source, TypeAdapterConfig? config = null)
{
config ??= TypeAdapterConfig.GlobalSettings;
var mockCall = config.GetProjectionCallExpression(source.ElementType, typeof(TDestination));
var sourceCall = Expression.Call(mockCall.Method, source.Expression, mockCall.Arguments[1]);
return source.Provider.CreateQuery<TDestination>(sourceCall);
}
public static IQueryable ProjectToType(this IQueryable source, Type destinationType, TypeAdapterConfig? config = null)
{
config ??= TypeAdapterConfig.GlobalSettings;
var mockCall = config.GetProjectionCallExpression(source.ElementType, destinationType);
var sourceCall = Expression.Call(mockCall.Method, source.Expression, mockCall.Arguments[1]);
return source.Provider.CreateQuery(sourceCall);
}
public static bool HasCustomAttribute(this IMemberModel member, Type type)
{
return member.GetCustomAttributes(true).Any(attr => attr.GetType() == type);
}
public static T GetCustomAttribute<T>(this IMemberModel member)
{
return (T) member.GetCustomAttributes(true).FirstOrDefault(attr => attr is T);
}
}
}
| using System;
using System.Linq;
using System.Linq.Expressions;
using Mapster.Models;
namespace Mapster
{
public static class Extensions
{
public static IQueryable<TDestination> ProjectToType<TDestination>(this IQueryable source, TypeAdapterConfig? config = null)
{
config ??= TypeAdapterConfig.GlobalSettings;
var mockCall = config.GetProjectionCallExpression(source.ElementType, typeof(TDestination));
var sourceCall = Expression.Call(mockCall.Method, source.Expression, mockCall.Arguments[1]);
return source.Provider.CreateQuery<TDestination>(sourceCall);
}
public static bool HasCustomAttribute(this IMemberModel member, Type type)
{
return member.GetCustomAttributes(true).Any(attr => attr.GetType() == type);
}
public static T GetCustomAttribute<T>(this IMemberModel member)
{
return (T) member.GetCustomAttributes(true).FirstOrDefault(attr => attr is T);
}
}
}
| mit | C# |
7276059d806ac5998686a61f8cc9e220c17aef9d | Add max length to parrot | xPaw/WendySharp | WendySharp/Commands/Parrot.cs | WendySharp/Commands/Parrot.cs | using System;
using System.Collections.Generic;
namespace WendySharp
{
class Parrot : Command
{
public Parrot()
{
Match = new List<string>
{
"parrot"
};
Usage = "<text>";
ArgumentMatch = "(?<text>.+)$";
HelpText = "Echo a message back to the channel.";
}
public override void OnCommand(CommandArguments command)
{
var text = command.Arguments.Groups["text"].Value;
if (text.Length > 140)
{
command.Reply("That message is too long to be parroted.");
return;
}
Log.WriteInfo("Parrot", "'{0}' said to '{1}': {2}", command.Event.Sender, command.Event.Recipient, text);
Bootstrap.Client.Client.Message(command.Event.Recipient, string.Format("\u200B{0}", text));
}
}
}
| using System;
using System.Collections.Generic;
namespace WendySharp
{
class Parrot : Command
{
public Parrot()
{
Match = new List<string>
{
"parrot"
};
Usage = "<text>";
ArgumentMatch = "(?<text>.+)$";
HelpText = "Echo a message back to the channel.";
}
public override void OnCommand(CommandArguments command)
{
var text = command.Arguments.Groups["text"].Value;
Log.WriteInfo("Parrot", "'{0}' said to '{1}': {2}", command.Event.Sender, command.Event.Recipient, text);
Bootstrap.Client.Client.Message(command.Event.Recipient, string.Format("\u200B{0}", text));
}
}
}
| mit | C# |
014afa5be74935e97d111efe16e4598eb007f6ff | Remove unused | skwasjer/SilentHunter | src/SilentHunter.Core/Controllers/StateMachineController.cs | src/SilentHunter.Core/Controllers/StateMachineController.cs | using System.Collections.Generic;
using System.ComponentModel;
namespace SilentHunter.Controllers
{
public class StateMachineController : Controller
{
// NOTE: some unknown fields, but they always seem to be the same. So mark them advanced, so they don't show up in simple editor views.
[EditorBrowsable(EditorBrowsableState.Advanced)]
public int Unknown0 = 0x423B410F;
/// <summary>
/// The name that this StateMachineClass controller can be referenced by.
/// </summary>
public string GraphName;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public int Unknown1 = 0x73A2500A;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public int Unknown2 = 0x24CE7F70;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public int Unknown3 = 0;
/// <summary>
/// A list of state entries that make up the state (behavior) of a character or object.
/// </summary>
public List<StateMachineEntry> StateEntries;
}
} | using System.Collections.Generic;
using System.ComponentModel;
namespace SilentHunter.Controllers
{
public class StateMachineController : Controller
{
private static class Magics
{
public const int Entry = 0x6cf46e74;
public const int Condition = 0x596344fb;
public const int Action = 0x7e03767b;
}
// NOTE: some unknown fields, but they always seem to be the same. So mark them advanced, so they don't show up in simple editor views.
[EditorBrowsable(EditorBrowsableState.Advanced)]
public int Unknown0 = 0x423B410F;
/// <summary>
/// The name that this StateMachineClass controller can be referenced by.
/// </summary>
public string GraphName;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public int Unknown1 = 0x73A2500A;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public int Unknown2 = 0x24CE7F70;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public int Unknown3;
/// <summary>
/// A list of state entries that make up the state (behavior) of a character or object.
/// </summary>
public List<StateMachineEntry> StateEntries;
}
} | apache-2.0 | C# |
a67de3de47a199b633668dd43428db09b94f7686 | Fix bad conditional | tgstation/tgstation-server,tgstation/tgstation-server-tools,tgstation/tgstation-server | src/Tgstation.Server.Host/Database/SqliteDatabaseContext.cs | src/Tgstation.Server.Host/Database/SqliteDatabaseContext.cs | using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using System;
using System.Linq;
using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Database
{
/// <summary>
/// <see cref="DatabaseContext"/> for SQLite.
/// </summary>
sealed class SqliteDatabaseContext : DatabaseContext
{
/// <summary>
/// Static property to receive the configured value of <see cref="DatabaseConfiguration.DesignTime"/>.
/// </summary>
public static bool DesignTime { get; set; }
/// <summary>
/// Construct a <see cref="MySqlDatabaseContext"/>
/// </summary>
/// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext"/></param>
public SqliteDatabaseContext(DbContextOptions<SqliteDatabaseContext> dbContextOptions) : base(dbContextOptions)
{ }
/// <summary>
/// Configure the <see cref="SqliteDatabaseContext"/>.
/// </summary>
/// <param name="options">The <see cref="DbContextOptionsBuilder"/> to configure.</param>
/// <param name="databaseConfiguration">The <see cref="DatabaseConfiguration"/>.</param>
public static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfiguration databaseConfiguration)
{
if (options == null)
throw new ArgumentNullException(nameof(options));
if (databaseConfiguration == null)
throw new ArgumentNullException(nameof(databaseConfiguration));
if (databaseConfiguration.DatabaseType != DatabaseType.Sqlite)
throw new InvalidOperationException($"Invalid DatabaseType for {nameof(SqliteDatabaseContext)}!");
DesignTime = databaseConfiguration.DesignTime;
options.UseSqlite(databaseConfiguration.ConnectionString);
}
/// <inheritdoc />
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// Shamelessly stolen from https://blog.dangl.me/archive/handling-datetimeoffset-in-sqlite-with-entity-framework-core/
// SQLite does not have proper support for DateTimeOffset via Entity Framework Core, see the limitations
// here: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/limitations#query-limitations
// To work around this, when the Sqlite database provider is used, all model properties of type DateTimeOffset
// use the DateTimeOffsetToBinaryConverter
// Based on: https://github.com/aspnet/EntityFrameworkCore/issues/10784#issuecomment-415769754
// This only supports millisecond precision, but should be sufficient for most use cases.
if (!DesignTime)
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
var properties = entityType
.ClrType
.GetProperties()
.Where(p => p.PropertyType == typeof(DateTimeOffset) || p.PropertyType == typeof(DateTimeOffset?));
foreach (var property in properties)
modelBuilder
.Entity(entityType.Name)
.Property(property.Name)
.HasConversion(new DateTimeOffsetToBinaryConverter());
}
}
}
}
| using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using System;
using System.Linq;
using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Database
{
/// <summary>
/// <see cref="DatabaseContext"/> for SQLite.
/// </summary>
sealed class SqliteDatabaseContext : DatabaseContext
{
/// <summary>
/// Static property to receive the configured value of <see cref="DatabaseConfiguration.DesignTime"/>.
/// </summary>
public static bool DesignTime { get; set; }
/// <summary>
/// Construct a <see cref="MySqlDatabaseContext"/>
/// </summary>
/// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext"/></param>
public SqliteDatabaseContext(DbContextOptions<SqliteDatabaseContext> dbContextOptions) : base(dbContextOptions)
{ }
/// <summary>
/// Configure the <see cref="SqliteDatabaseContext"/>.
/// </summary>
/// <param name="options">The <see cref="DbContextOptionsBuilder"/> to configure.</param>
/// <param name="databaseConfiguration">The <see cref="DatabaseConfiguration"/>.</param>
public static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfiguration databaseConfiguration)
{
if (options == null)
throw new ArgumentNullException(nameof(options));
if (databaseConfiguration == null)
throw new ArgumentNullException(nameof(databaseConfiguration));
if (databaseConfiguration.DatabaseType != DatabaseType.Sqlite)
throw new InvalidOperationException($"Invalid DatabaseType for {nameof(SqliteDatabaseContext)}!");
DesignTime = databaseConfiguration.DesignTime;
options.UseSqlite(databaseConfiguration.ConnectionString);
}
/// <inheritdoc />
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// Shamelessly stolen from https://blog.dangl.me/archive/handling-datetimeoffset-in-sqlite-with-entity-framework-core/
// SQLite does not have proper support for DateTimeOffset via Entity Framework Core, see the limitations
// here: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/limitations#query-limitations
// To work around this, when the Sqlite database provider is used, all model properties of type DateTimeOffset
// use the DateTimeOffsetToBinaryConverter
// Based on: https://github.com/aspnet/EntityFrameworkCore/issues/10784#issuecomment-415769754
// This only supports millisecond precision, but should be sufficient for most use cases.
if (DesignTime)
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
var properties = entityType
.ClrType
.GetProperties()
.Where(p => p.PropertyType == typeof(DateTimeOffset) || p.PropertyType == typeof(DateTimeOffset?));
foreach (var property in properties)
modelBuilder
.Entity(entityType.Name)
.Property(property.Name)
.HasConversion(new DateTimeOffsetToBinaryConverter());
}
}
}
}
| agpl-3.0 | C# |
2898e6e6572f2dc3d33fd9c6ec836f6985438cb3 | Increment version to 1.1.0.14 | jcvandan/XeroAPI.Net,XeroAPI/XeroAPI.Net,MatthewSteeples/XeroAPI.Net,TDaphneB/XeroAPI.Net | source/XeroApi/Properties/AssemblyInfo.cs | source/XeroApi/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("XeroApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Xero")]
[assembly: AssemblyProduct("XeroApi")]
[assembly: AssemblyCopyright("Copyright © Xero 2011")]
[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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.14")]
[assembly: AssemblyFileVersion("1.1.0.14")]
| 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("XeroApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Xero")]
[assembly: AssemblyProduct("XeroApi")]
[assembly: AssemblyCopyright("Copyright © Xero 2011")]
[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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.13")]
[assembly: AssemblyFileVersion("1.1.0.13")]
| mit | C# |
f685d0772da67bf5289b83f94be497d4c3c41baf | Disable Raven's Embedded HTTP server | alastairs/cgowebsite,alastairs/cgowebsite | src/CGO.Web/NinjectModules/RavenModule.cs | src/CGO.Web/NinjectModules/RavenModule.cs | using Ninject;
using Ninject.Modules;
using Ninject.Web.Common;
using Raven.Client;
using Raven.Client.Embedded;
namespace CGO.Web.NinjectModules
{
public class RavenModule : NinjectModule
{
public override void Load()
{
Kernel.Bind<IDocumentStore>().ToMethod(_ => InitialiseDocumentStore()).InSingletonScope();
Kernel.Bind<IDocumentSession>().ToMethod(_ => Kernel.Get<IDocumentStore>().OpenSession()).InRequestScope();
}
private static IDocumentStore InitialiseDocumentStore()
{
var documentStore = new EmbeddableDocumentStore
{
DataDirectory = "CGO.raven",
Configuration = { Port = 28645 }
};
documentStore.Initialize();
documentStore.InitializeProfiling();
return documentStore;
}
}
} | using Ninject;
using Ninject.Modules;
using Ninject.Web.Common;
using Raven.Client;
using Raven.Client.Embedded;
namespace CGO.Web.NinjectModules
{
public class RavenModule : NinjectModule
{
public override void Load()
{
Kernel.Bind<IDocumentStore>().ToMethod(_ => InitialiseDocumentStore()).InSingletonScope();
Kernel.Bind<IDocumentSession>().ToMethod(_ => Kernel.Get<IDocumentStore>().OpenSession()).InRequestScope();
}
private static IDocumentStore InitialiseDocumentStore()
{
var documentStore = new EmbeddableDocumentStore
{
DataDirectory = "CGO.raven",
UseEmbeddedHttpServer = true,
Configuration = { Port = 28645 }
};
documentStore.Initialize();
documentStore.InitializeProfiling();
return documentStore;
}
}
} | mit | C# |
5caf31afcce4f93050f7c661c0c6b7c6c781794d | Add docs | imazen/imageflow-dotnet | src/Imageflow/Fluent/ConstraintGravity.cs | src/Imageflow/Fluent/ConstraintGravity.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace Imageflow.Fluent
{
public class ConstraintGravity
{
/// <summary>
/// Centers the gravity (the default)
/// </summary>
public ConstraintGravity()
{
XPercent = 50;
YPercent = 50;
}
/// <summary>
/// Aligns the watermark so xPercent of free space is on the left and yPercent of free space is on the top
/// </summary>
/// <param name="xPercent"></param>
/// <param name="yPercent"></param>
public ConstraintGravity(float xPercent, float yPercent)
{
XPercent = xPercent;
YPercent = yPercent;
}
public float XPercent { get; }
public float YPercent { get; }
public object ToImageflowDynamic()
{
return new
{
percentage = new {
XPercent,
YPercent
}
};
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace Imageflow.Fluent
{
public class ConstraintGravity
{
/// <summary>
/// Centers the gravity (the default)
/// </summary>
public ConstraintGravity()
{
XPercent = 50;
YPercent = 50;
}
public ConstraintGravity(float xPercent, float yPercent)
{
XPercent = xPercent;
YPercent = yPercent;
}
public float XPercent { get; }
public float YPercent { get; }
public object ToImageflowDynamic()
{
return new
{
percentage = new {
XPercent,
YPercent
}
};
}
}
}
| agpl-3.0 | C# |
d94773da2affd9bffe11bfb4d03a196d6cd7e5b4 | Rename methods | Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum,Nethereum/Nethereum | src/Nethereum.KeyStore/KeyStoreService.cs | src/Nethereum.KeyStore/KeyStoreService.cs | using System;
using Newtonsoft.Json.Linq;
namespace Nethereum.KeyStore
{
public class KeyStoreService
{
private readonly KeyStoreKdfChecker _keyStoreKdfChecker;
private readonly KeyStoreScryptService _keyStoreScryptService;
private readonly KeyStorePbkdf2Service _keyStorePbkdf2Service;
public KeyStoreService()
{
_keyStoreKdfChecker = new KeyStoreKdfChecker();
_keyStorePbkdf2Service = new KeyStorePbkdf2Service();
_keyStoreScryptService = new KeyStoreScryptService();
}
public KeyStoreService(KeyStoreKdfChecker keyStoreKdfChecker, KeyStoreScryptService keyStoreScryptService, KeyStorePbkdf2Service keyStorePbkdf2Service)
{
_keyStoreKdfChecker = keyStoreKdfChecker;
_keyStoreScryptService = keyStoreScryptService;
_keyStorePbkdf2Service = keyStorePbkdf2Service;
}
public string GetAddressFromKeyStore(string json)
{
var keyStoreDocument = JObject.Parse(json);
return keyStoreDocument["address"].Value<string>();
}
public byte[] DecryptKeyStoreFromJson(string password, string json)
{
var type = _keyStoreKdfChecker.GetKeyStoreKdfType(json);
if (type == KeyStoreKdfChecker.KdfType.pbkdf2)
{
return _keyStorePbkdf2Service.DecryptKeyStoreFromJson(password, json);
}
if (type == KeyStoreKdfChecker.KdfType.scrypt)
{
return _keyStoreScryptService.DecryptKeyStoreFromJson(password, json);
}
//shold not reach here, already handled by the checker
throw new Exception("Invalid kdf type");
}
public string EncryptAndGenerateDefaultKeyStoreAsJson(string password, byte[] key, string address)
{
return _keyStoreScryptService.EncryptAndGenerateKeyStoreAsJson(password, key, address);
}
}
} | using System;
using Newtonsoft.Json.Linq;
namespace Nethereum.KeyStore
{
public class KeyStoreService
{
private readonly KeyStoreKdfChecker _keyStoreKdfChecker;
private readonly KeyStoreScryptService _keyStoreScryptService;
private readonly KeyStorePbkdf2Service _keyStorePbkdf2Service;
public KeyStoreService()
{
_keyStoreKdfChecker = new KeyStoreKdfChecker();
_keyStorePbkdf2Service = new KeyStorePbkdf2Service();
_keyStoreScryptService = new KeyStoreScryptService();
}
public KeyStoreService(KeyStoreKdfChecker keyStoreKdfChecker, KeyStoreScryptService keyStoreScryptService, KeyStorePbkdf2Service keyStorePbkdf2Service)
{
_keyStoreKdfChecker = keyStoreKdfChecker;
_keyStoreScryptService = keyStoreScryptService;
_keyStorePbkdf2Service = keyStorePbkdf2Service;
}
public string GetAddressFromKeyStore(string json)
{
var keyStoreDocument = JObject.Parse(json);
return keyStoreDocument["address"].Value<string>();
}
public byte[] DecryptKeyStore(string password, string json)
{
var type = _keyStoreKdfChecker.GetKeyStoreKdfType(json);
if (type == KeyStoreKdfChecker.KdfType.pbkdf2)
{
return _keyStorePbkdf2Service.DecryptKeyStoreFromJson(password, json);
}
if (type == KeyStoreKdfChecker.KdfType.scrypt)
{
return _keyStoreScryptService.DecryptKeyStoreFromJson(password, json);
}
//shold not reach here, already handled by the checker
throw new Exception("Invalid kdf type");
}
public string EncryptAndGenerateDefaultKeyStore(string password, byte[] key, string address)
{
return _keyStoreScryptService.EncryptAndGenerateKeyStoreAsJson(password, key, address);
}
}
} | mit | C# |
ca9f8fe76a78dfd7c2d1cb3b2d8b01c04b745207 | test warnings | elastacloud/parquet-dotnet | src/Parquet.Test/Xunit/RepeatAttribute.cs | src/Parquet.Test/Xunit/RepeatAttribute.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Xunit.Sdk;
namespace Parquet.Test.Xunit
{
public class RepeatAttribute : DataAttribute
{
private readonly int _count;
public RepeatAttribute(int count)
{
if (count < 1)
{
throw new ArgumentOutOfRangeException(nameof(count),
"Repeat count must be greater than 0.");
}
_count = count;
}
public override IEnumerable<object[]> GetData(MethodInfo testMethod)
{
return Enumerable.Range(0, _count).Select(i => new object[i]);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Xunit.Sdk;
namespace Parquet.Test.Xunit
{
public class RepeatAttribute : DataAttribute
{
private readonly int _count;
public RepeatAttribute(int count)
{
if (count < 1)
{
throw new ArgumentOutOfRangeException(nameof(count),
"Repeat count must be greater than 0.");
}
_count = count;
}
public override IEnumerable<object[]> GetData(MethodInfo testMethod)
{
return Enumerable.Repeat(new object[0], _count);
}
}
}
| mit | C# |
734379af4722a831111375a490f6fff6309d57b2 | Use for loop to avoid nested unregister case | peppy/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework | osu.Framework/Threading/AudioThread.cs | osu.Framework/Threading/AudioThread.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Statistics;
using System;
using System.Collections.Generic;
using osu.Framework.Audio;
namespace osu.Framework.Threading
{
public class AudioThread : GameThread
{
public AudioThread()
: base(name: "Audio")
{
OnNewFrame = onNewFrame;
}
internal override IEnumerable<StatisticsCounterType> StatisticsCounters => new[]
{
StatisticsCounterType.TasksRun,
StatisticsCounterType.Tracks,
StatisticsCounterType.Samples,
StatisticsCounterType.SChannels,
StatisticsCounterType.Components,
};
private readonly List<AudioManager> managers = new List<AudioManager>();
private void onNewFrame()
{
lock (managers)
{
for (var i = 0; i < managers.Count; i++)
{
var m = managers[i];
m.Update();
}
}
}
public void RegisterManager(AudioManager manager)
{
lock (managers)
{
if (managers.Contains(manager))
throw new InvalidOperationException($"{manager} was already registered");
managers.Add(manager);
}
}
public void UnregisterManager(AudioManager manager)
{
lock (managers)
managers.Remove(manager);
}
protected override void PerformExit()
{
base.PerformExit();
ManagedBass.Bass.Free();
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Statistics;
using System;
using System.Collections.Generic;
using osu.Framework.Audio;
namespace osu.Framework.Threading
{
public class AudioThread : GameThread
{
public AudioThread()
: base(name: "Audio")
{
OnNewFrame = onNewFrame;
}
internal override IEnumerable<StatisticsCounterType> StatisticsCounters => new[]
{
StatisticsCounterType.TasksRun,
StatisticsCounterType.Tracks,
StatisticsCounterType.Samples,
StatisticsCounterType.SChannels,
StatisticsCounterType.Components,
};
private readonly List<AudioManager> managers = new List<AudioManager>();
private void onNewFrame()
{
lock (managers)
foreach (var m in managers)
m.Update();
}
public void RegisterManager(AudioManager manager)
{
lock (managers)
{
if (managers.Contains(manager))
throw new InvalidOperationException($"{manager} was already registered");
managers.Add(manager);
}
}
public void UnregisterManager(AudioManager manager)
{
lock (managers)
managers.Remove(manager);
}
protected override void PerformExit()
{
base.PerformExit();
ManagedBass.Bass.Free();
}
}
}
| mit | C# |
4aa8022afa59eb762fd07e4213837b7bb8c1d1c4 | update formatting | designsbyjuan/UnityLib | MusicManager.cs | MusicManager.cs | using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class MusicManager : MonoBehaviour {
private AudioSource audioSource;
public AudioClip[] levelMusicArray;
void Awake()
{
DontDestroyOnLoad(gameObject);
}
// Use this for initialization
void Start () {
audioSource = GetComponent<AudioSource>();
audioSource.clip = levelMusicArray[0];
audioSource.Play();
}
public void PlayAudioClip(int audioTrack)
{
AudioClip audioClip = levelMusicArray[audioTrack];
if (audioClip)
{
audioSource.Stop();
audioSource.clip = audioClip;
audioSource.Play();
}
}
}
| using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class MusicManager : MonoBehaviour {
private AudioSource audioSource;
public AudioClip[] levelMusicArray;
void Awake()
{
DontDestroyOnLoad(gameObject);
}
// Use this for initialization
void Start () {
audioSource = GetComponent<AudioSource>();
audioSource.clip = levelMusicArray[0];
audioSource.Play();
}
public void PlayAudioClip(int audioTrack)
{
AudioClip audioClip = levelMusicArray[audioTrack];
if (audioClip)
{
audioSource.Stop();
audioSource.clip = audioClip;
audioSource.Play();
}
}
}
| mit | C# |
d61586c6a1b10583dd66e457a0484974963acfd0 | Use Jit recongised, standard loop construct | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNet.Hosting/Startup/ConfigureDelegate.cs | src/Microsoft.AspNet.Hosting/Startup/ConfigureDelegate.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Reflection;
using Microsoft.AspNet.Builder;
using Microsoft.Framework.DependencyInjection;
namespace Microsoft.AspNet.Hosting.Startup
{
// TODO: replace all Action<IApplicationBuilder> eventually with this
public delegate void ConfigureDelegate(IApplicationBuilder builder);
public class ConfigureBuilder
{
public ConfigureBuilder(MethodInfo configure)
{
MethodInfo = configure;
}
public MethodInfo MethodInfo { get; }
public Action<IApplicationBuilder> Build(object instance) => builder => Invoke(instance, builder);
private void Invoke(object instance, IApplicationBuilder builder)
{
var serviceProvider = builder.ApplicationServices;
var parameterInfos = MethodInfo.GetParameters();
var parameters = new object[parameterInfos.Length];
for (var index = 0; index < parameterInfos.Length; index++)
{
var parameterInfo = parameterInfos[index];
if (parameterInfo.ParameterType == typeof(IApplicationBuilder))
{
parameters[index] = builder;
}
else
{
try
{
parameters[index] = serviceProvider.GetRequiredService(parameterInfo.ParameterType);
}
catch (Exception)
{
throw new Exception(string.Format(
"Could not resolve a service of type '{0}' for the parameter '{1}' of method '{2}' on type '{3}'.",
parameterInfo.ParameterType.FullName,
parameterInfo.Name,
MethodInfo.Name,
MethodInfo.DeclaringType.FullName));
}
}
}
MethodInfo.Invoke(instance, parameters);
}
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Reflection;
using Microsoft.AspNet.Builder;
using Microsoft.Framework.DependencyInjection;
namespace Microsoft.AspNet.Hosting.Startup
{
// TODO: replace all Action<IApplicationBuilder> eventually with this
public delegate void ConfigureDelegate(IApplicationBuilder builder);
public class ConfigureBuilder
{
public ConfigureBuilder(MethodInfo configure)
{
MethodInfo = configure;
}
public MethodInfo MethodInfo { get; }
public Action<IApplicationBuilder> Build(object instance) => builder => Invoke(instance, builder);
private void Invoke(object instance, IApplicationBuilder builder)
{
var serviceProvider = builder.ApplicationServices;
var parameterInfos = MethodInfo.GetParameters();
var parameters = new object[parameterInfos.Length];
for (var index = 0; index != parameterInfos.Length; ++index)
{
var parameterInfo = parameterInfos[index];
if (parameterInfo.ParameterType == typeof(IApplicationBuilder))
{
parameters[index] = builder;
}
else
{
try
{
parameters[index] = serviceProvider.GetRequiredService(parameterInfo.ParameterType);
}
catch (Exception)
{
throw new Exception(string.Format(
"Could not resolve a service of type '{0}' for the parameter '{1}' of method '{2}' on type '{3}'.",
parameterInfo.ParameterType.FullName,
parameterInfo.Name,
MethodInfo.Name,
MethodInfo.DeclaringType.FullName));
}
}
}
MethodInfo.Invoke(instance, parameters);
}
}
} | apache-2.0 | C# |
0fec24c844b9b0fed31569b03ee12fe89e3629e0 | Add BGP and BMP message lengths to JSON | mstrother/BmpListener | src/BmpListener/Serialization/Models/UpdateModel.cs | src/BmpListener/Serialization/Models/UpdateModel.cs | using System.Collections.Generic;
namespace BmpListener.Serialization.Models
{
public class UpdateModel
{
public int BmpMsgLength { get; set; }
public int BgpMsgLength { get; set; }
public PeerHeaderModel Peer { get; set; }
public string Origin { get; set; }
public IList<int> AsPath { get; set; }
public IList<AnnounceModel> Announce { get; set; }
public IList<WithdrawModel> Withdraw { get; set; }
}
}
| using System.Collections.Generic;
namespace BmpListener.Serialization.Models
{
public class UpdateModel
{
public PeerHeaderModel Peer { get; set; }
public string Origin { get; set; }
public IList<int> AsPath { get; set; }
public IList<AnnounceModel> Announce { get; set; }
public IList<WithdrawModel> Withdraw { get; set; }
}
}
| mit | C# |
23dc3fad4b7da540b1756ba0e53d0962aeac8f3d | Fix issues with build for UWP | jamesmontemagno/InAppBillingPlugin | src/Plugin.InAppBilling.UWP/InAppBillingImplementation.cs | src/Plugin.InAppBilling.UWP/InAppBillingImplementation.cs | using Plugin.InAppBilling.Abstractions;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Plugin.InAppBilling
{
/// <summary>
/// Implementation for Feature
/// </summary>
public class InAppBillingImplementation : IInAppBilling
{
/// <summary>
/// Connect to billing service
/// </summary>
/// <returns>If Success</returns>
public Task<bool> ConnectAsync()
{
throw new NotImplementedException();
}
/// <summary>
/// Disconnect from the billing service
/// </summary>
/// <returns>Task to disconnect</returns>
public Task DisconnectAsync()
{
throw new NotImplementedException();
}
/// <summary>
/// Get product information of a specific product
/// </summary>
/// <param name="productIds">Sku or Id of the product(s)</param>
/// <param name="itemType">Type of product offering</param>
/// <returns></returns>
public Task<IEnumerable<InAppBillingProduct>> GetProductInfoAsync(ItemType itemType, params string[] productIds)
{
throw new NotImplementedException();
}
/// <summary>
/// Get all current purhcase for a specifiy product type.
/// </summary>
/// <param name="itemType">Type of product</param>
/// <param name="verifyPurchase">Interface to verify purchase</param>
/// <returns>The current purchases</returns>
public Task<IEnumerable<InAppBillingPurchase>> GetPurchasesAsync(ItemType itemType, IInAppBillingVerifyPurchase verifyPurchase = null)
{
throw new NotImplementedException();
}
/// <summary>
/// Purchase a specific product or subscription
/// </summary>
/// <param name="productId">Sku or ID of product</param>
/// <param name="itemType">Type of product being requested</param>
/// <param name="payload">Developer specific payload</param>
/// <param name="verifyPurchase">Interface to verify purchase</param>
/// <returns></returns>
public Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string payload, IInAppBillingVerifyPurchase verifyPurchase = null)
{
throw new NotImplementedException();
}
}
} | using Plugin.InAppBilling.Abstractions;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Plugin.InAppBilling
{
/// <summary>
/// Implementation for Feature
/// </summary>
public class InAppBillingImplementation : IInAppBilling
{
/// <summary>
/// Connect to billing service
/// </summary>
/// <returns>If Success</returns>
public Task<bool> ConnectAsync()
{
throw new NotImplementedException();
}
/// <summary>
/// Disconnect from the billing service
/// </summary>
/// <returns>Task to disconnect</returns>
public Task DisconnectAsync()
{
throw new NotImplementedException();
}
/// <summary>
/// Get product information of a specific product
/// </summary>
/// <param name="productId">Sku or Id of the product(s)</param>
/// <param name="itemType">Type of product offering</param>
/// <returns></returns>
public Task<InAppBillingProduct> GetProductInfoAsync(ItemType itemType, params string[] productIds)
{
throw new NotImplementedException();
}
/// <summary>
/// Get all current purhcase for a specifiy product type.
/// </summary>
/// <param name="itemType">Type of product</param>
/// <param name="verifyPurchase">Interface to verify purchase</param>
/// <returns>The current purchases</returns>
public Task<IEnumerable<InAppBillingPurchase>> GetPurchasesAsync(ItemType itemType, IInAppBillingVerifyPurchase verifyPurchase = null)
{
throw new NotImplementedException();
}
/// <summary>
/// Purchase a specific product or subscription
/// </summary>
/// <param name="productId">Sku or ID of product</param>
/// <param name="itemType">Type of product being requested</param>
/// <param name="payload">Developer specific payload</param>
/// <param name="verifyPurchase">Interface to verify purchase</param>
/// <returns></returns>
public Task<InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string payload, IInAppBillingVerifyPurchase verifyPurchase = null)
{
throw new NotImplementedException();
}
}
} | mit | C# |
4cfe064b63d300cd23ff4a409079a3da6a1bb6fa | Fix "double question mark" bug in UriBuilder | ravendb/ravendb.contrib | src/Raven.Contrib.AspNet.Demo/Extensions/UriExtensions.cs | src/Raven.Contrib.AspNet.Demo/Extensions/UriExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Raven.Contrib.AspNet.Demo.Extensions
{
public static class UriExtensions
{
public static Uri AddQueryParameter(this Uri uri, KeyValuePair<string, string> pair)
{
return uri.AddQueryParameter(pair.Key, pair.Value);
}
public static Uri AddQueryParameter(this Uri uri, string key, string value)
{
var builder = new UriBuilder(uri);
string encodedKey = Uri.EscapeDataString(key);
string encodedValue = Uri.EscapeDataString(value);
string queryString = String.Format("{0}={1}", encodedKey, encodedValue);
builder.Query = String.IsNullOrEmpty(builder.Query) ? queryString : builder.Query.Substring(1) + "&" + queryString;
return builder.Uri;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Raven.Contrib.AspNet.Demo.Extensions
{
public static class UriExtensions
{
public static Uri AddQueryParameter(this Uri uri, KeyValuePair<string, string> pair)
{
return uri.AddQueryParameter(pair.Key, pair.Value);
}
public static Uri AddQueryParameter(this Uri uri, string key, string value)
{
var builder = new UriBuilder(uri);
string encodedKey = Uri.EscapeDataString(key);
string encodedValue = Uri.EscapeDataString(value);
string queryString = String.Format("{0}={1}", encodedKey, encodedValue);
builder.Query += String.IsNullOrEmpty(builder.Query) ? queryString : "&" + queryString;
return builder.Uri;
}
}
} | mit | C# |
42443b303c6e86b78a183f2b9044fa2cd0acbec8 | Increase length of benchmark algorithm | JKarathiya/Lean,FrancisGauthier/Lean,FrancisGauthier/Lean,mabeale/Lean,JKarathiya/Lean,Jay-Jay-D/LeanSTP,JKarathiya/Lean,squideyes/Lean,mabeale/Lean,AlexCatarino/Lean,kaffeebrauer/Lean,bdilber/Lean,AnshulYADAV007/Lean,QuantConnect/Lean,Obawoba/Lean,andrewhart098/Lean,devalkeralia/Lean,squideyes/Lean,mabeale/Lean,bizcad/Lean,Jay-Jay-D/LeanSTP,Mendelone/forex_trading,redmeros/Lean,bizcad/Lean,jameschch/Lean,andrewhart098/Lean,young-zhang/Lean,Obawoba/Lean,bizcad/LeanJJN,Obawoba/Lean,jameschch/Lean,StefanoRaggi/Lean,bizcad/LeanJJN,jameschch/Lean,kaffeebrauer/Lean,dpavlenkov/Lean,devalkeralia/Lean,QuantConnect/Lean,jameschch/Lean,andrewhart098/Lean,dpavlenkov/Lean,Obawoba/Lean,StefanoRaggi/Lean,QuantConnect/Lean,AnObfuscator/Lean,AnObfuscator/Lean,Jay-Jay-D/LeanSTP,tomhunter-gh/Lean,Mendelone/forex_trading,AnshulYADAV007/Lean,bdilber/Lean,AnshulYADAV007/Lean,devalkeralia/Lean,bizcad/Lean,devalkeralia/Lean,dpavlenkov/Lean,bizcad/LeanJJN,FrancisGauthier/Lean,Phoenix1271/Lean,dpavlenkov/Lean,tomhunter-gh/Lean,kaffeebrauer/Lean,young-zhang/Lean,bdilber/Lean,AnshulYADAV007/Lean,bdilber/Lean,QuantConnect/Lean,redmeros/Lean,Phoenix1271/Lean,redmeros/Lean,kaffeebrauer/Lean,squideyes/Lean,FrancisGauthier/Lean,redmeros/Lean,AnshulYADAV007/Lean,AlexCatarino/Lean,Jay-Jay-D/LeanSTP,Phoenix1271/Lean,Mendelone/forex_trading,JKarathiya/Lean,tomhunter-gh/Lean,AnObfuscator/Lean,AnObfuscator/Lean,squideyes/Lean,young-zhang/Lean,andrewhart098/Lean,bizcad/Lean,mabeale/Lean,AlexCatarino/Lean,AlexCatarino/Lean,jameschch/Lean,tomhunter-gh/Lean,Jay-Jay-D/LeanSTP,Phoenix1271/Lean,kaffeebrauer/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,Mendelone/forex_trading,bizcad/LeanJJN,young-zhang/Lean | Algorithm.CSharp/Benchmarks/EmptyMinute400EquityAlgorithm.cs | Algorithm.CSharp/Benchmarks/EmptyMinute400EquityAlgorithm.cs | using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
namespace QuantConnect.Algorithm.CSharp.Benchmarks
{
public class EmptyMinute400EquityAlgorithm : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2015, 09, 28);
SetEndDate(2015, 11, 13);
foreach (var symbol in Symbols.Equity.All.Take(400))
{
AddSecurity(SecurityType.Equity, symbol);
}
}
public override void OnData(Slice slice)
{
}
}
} | using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
namespace QuantConnect.Algorithm.CSharp.Benchmarks
{
public class EmptyMinute400EquityAlgorithm : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2015, 09, 28);
SetEndDate(2015, 10, 28);
foreach (var symbol in Symbols.Equity.All.Take(400))
{
AddSecurity(SecurityType.Equity, symbol);
}
}
public override void OnData(Slice slice)
{
}
}
} | apache-2.0 | C# |
24c9cb1f950d3f3360d6b4ecd30e4afa90d520b0 | Change menu high score text with language | NitorInc/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare,plrusek/NitoriWare,Barleytree/NitoriWare | Assets/Scripts/Menu/MenuGameMode.cs | Assets/Scripts/Menu/MenuGameMode.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MenuGameMode : MonoBehaviour
{
private const string KeyPrefix = "menu.gamemode.";
#pragma warning disable 0649 //Serialized Fields
[SerializeField]
private MenuButton menuButton;
[SerializeField]
private MenuDescriptionText descriptionText;
[SerializeField]
private Text highScoreText;
[SerializeField]
private GameplayMenu gameplayMenu;
[SerializeField]
private string modeName;
[SerializeField]
private bool triggerDescription;
[SerializeField]
[Multiline]
private string defaultDescription;
#pragma warning restore 0649
private string initialString, formattedLanguage;
private List<MenuGameMode> neighbors;
void Awake()
{
neighbors = new List<MenuGameMode>();
for (int i = 0; i < transform.parent.childCount; i++)
{
MenuGameMode neighbor = transform.parent.GetChild(i).GetComponent<MenuGameMode>();
if (neighbor != null)
neighbors.Add(neighbor);
}
}
private void Start()
{
initialString = highScoreText.text;
formatText();
}
void formatText()
{
highScoreText.text = string.Format(TextHelper.getLocalizedText("stage.gameover.highscore", highScoreText.text),
PrefsHelper.getHighScore(modeName).ToString("D3"));
formattedLanguage = TextHelper.getLoadedLanguage();
}
void Update()
{
if (TextHelper.getLoadedLanguage() != formattedLanguage)
{
highScoreText.text = initialString;
formatText();
}
if (triggerDescription)
{
bool highlighted = menuButton.isMouseOver();
if (highlighted && !descriptionText.isActivated())
descriptionText.activate(TextHelper.getLocalizedText(KeyPrefix + modeName + ".description", defaultDescription));
else if (descriptionText.isActivated() && (GameMenu.shifting || !areAnyNeighborsHighlighted(true)))
descriptionText.deActivate();
}
}
public MenuButton getMenuButton()
{
return menuButton;
}
bool areAnyNeighborsHighlighted(bool includeSelf)
{
foreach (MenuGameMode neighbor in neighbors)
{
if (neighbor.getMenuButton().isMouseOver() && (includeSelf || neighbor != this))
return true;
}
return false;
}
public void startGameplay()
{
gameplayMenu.startGameplay(modeName);
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MenuGameMode : MonoBehaviour
{
private const string KeyPrefix = "menu.gamemode.";
#pragma warning disable 0649 //Serialized Fields
[SerializeField]
private MenuButton menuButton;
[SerializeField]
private MenuDescriptionText descriptionText;
[SerializeField]
private Text highScoreText;
[SerializeField]
private GameplayMenu gameplayMenu;
[SerializeField]
private string modeName;
[SerializeField]
private bool triggerDescription;
[SerializeField]
[Multiline]
private string defaultDescription;
#pragma warning restore 0649
private List<MenuGameMode> neighbors;
void Awake()
{
neighbors = new List<MenuGameMode>();
for (int i = 0; i < transform.parent.childCount; i++)
{
MenuGameMode neighbor = transform.parent.GetChild(i).GetComponent<MenuGameMode>();
if (neighbor != null)
neighbors.Add(neighbor);
}
}
private void Start()
{
highScoreText.text = string.Format(TextHelper.getLocalizedText("stage.gameover.highscore", highScoreText.text),
PrefsHelper.getHighScore(modeName).ToString("D3"));
//highScoreText.text = highScoreText.text
}
void Update()
{
if (triggerDescription)
{
bool highlighted = menuButton.isMouseOver();
if (highlighted && !descriptionText.isActivated())
descriptionText.activate(TextHelper.getLocalizedText(KeyPrefix + modeName + ".description", defaultDescription));
else if (descriptionText.isActivated() && (GameMenu.shifting || !areAnyNeighborsHighlighted(true)))
descriptionText.deActivate();
}
}
public MenuButton getMenuButton()
{
return menuButton;
}
bool areAnyNeighborsHighlighted(bool includeSelf)
{
foreach (MenuGameMode neighbor in neighbors)
{
if (neighbor.getMenuButton().isMouseOver() && (includeSelf || neighbor != this))
return true;
}
return false;
}
public void startGameplay()
{
gameplayMenu.startGameplay(modeName);
}
}
| mit | C# |
b49e8c82e0962e032b1b2175b230ead1f13a5551 | reset y on update | subdigital/blades-edge | Assets/Scripts/Unit.cs | Assets/Scripts/Unit.cs | using System;
using UnityEngine;
public class Unit : WorldObject {
public float moveSpeed = 10;
public float rotationSpeed = 180;
public GameObject pathVisualPrefab;
bool moving;
Vector3 targetPosition;
Quaternion targetRotation;
GameObject pathVisual;
GameObject targetVisual;
void Update () {
if (moving) {
Move ();
Rotate ();
if (Selected) {
UpdatePathVisual ();
}
}
}
public override void SetSelected(bool selected) {
base.SetSelected (selected);
if (selected) {
if (moving) {
AddPathVisual ();
}
} else {
RemovePathVisual ();
}
}
void Move () {
transform.position = Vector3.MoveTowards (transform.position, targetPosition, moveSpeed * Time.deltaTime);
if (transform.position == targetPosition) {
moving = false;
RemovePathVisual ();
}
}
void Rotate () {
transform.rotation = Quaternion.RotateTowards (transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);
}
public override void HandleRightClick (Vector3 position, WorldObject hitObject) {
Debug.Log ("RIGHT CLICK");
var navMeshAgent = GetComponent<NavMeshAgent> ();
if (navMeshAgent) {
navMeshAgent.destination = targetPosition;
} else {
moving = true;
targetPosition = position;
targetRotation = Quaternion.LookRotation (targetPosition - transform.position);
AddPathVisual ();
}
}
void AddPathVisual() {
if (pathVisual) {
RemovePathVisual ();
}
targetVisual = GameObject.CreatePrimitive (PrimitiveType.Sphere);
targetVisual.GetComponent<MeshRenderer> ().material.color = Color.blue;
targetVisual.transform.position = targetPosition;
targetVisual.transform.localScale = Vector3.one * 4;
targetVisual.GetComponent<Collider> ().enabled = false;
//pathVisual = (GameObject)Instantiate (pathVisualPrefab);
pathVisual = GameObject.CreatePrimitive(PrimitiveType.Cube);
pathVisual.GetComponent<MeshRenderer> ().sharedMaterial.color = Color.red;
pathVisual.GetComponent<Collider> ().enabled = false;
pathVisual.transform.SetParent (transform);
Vector3 pos = transform.position;
pos.y = 0.1f;
pathVisual.transform.position = pos;
}
void UpdatePathVisual() {
pathVisual.transform.rotation = transform.rotation * Quaternion.Euler(0, 90f, 0);
Vector3 direction = targetPosition - transform.position;
float distance = direction.magnitude;
Vector3 pos = transform.position + (targetPosition-transform.position)/2f;
pos.y = 0.1f;
pathVisual.transform.position = pos;
pathVisual.transform.localScale = new Vector3 (distance / 6, 1, 1);
}
void RemovePathVisual() {
if (pathVisual) {
Destroy (pathVisual);
pathVisual = null;
}
if (targetVisual) {
Destroy (targetVisual);
targetVisual = null;
}
}
}
| using System;
using UnityEngine;
public class Unit : WorldObject {
public float moveSpeed = 10;
public float rotationSpeed = 180;
public GameObject pathVisualPrefab;
bool moving;
Vector3 targetPosition;
Quaternion targetRotation;
GameObject pathVisual;
GameObject targetVisual;
void Update () {
if (moving) {
Move ();
Rotate ();
if (Selected) {
UpdatePathVisual ();
}
}
}
public override void SetSelected(bool selected) {
base.SetSelected (selected);
if (selected) {
if (moving) {
AddPathVisual ();
}
} else {
RemovePathVisual ();
}
}
void Move () {
transform.position = Vector3.MoveTowards (transform.position, targetPosition, moveSpeed * Time.deltaTime);
if (transform.position == targetPosition) {
moving = false;
RemovePathVisual ();
}
}
void Rotate () {
transform.rotation = Quaternion.RotateTowards (transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);
}
public override void HandleRightClick (Vector3 position, WorldObject hitObject) {
Debug.Log ("RIGHT CLICK");
var navMeshAgent = GetComponent<NavMeshAgent> ();
if (navMeshAgent) {
navMeshAgent.destination = targetPosition;
} else {
moving = true;
targetPosition = position;
targetRotation = Quaternion.LookRotation (targetPosition - transform.position);
AddPathVisual ();
}
}
void AddPathVisual() {
if (pathVisual) {
RemovePathVisual ();
}
targetVisual = GameObject.CreatePrimitive (PrimitiveType.Sphere);
targetVisual.GetComponent<MeshRenderer> ().material.color = Color.blue;
targetVisual.transform.position = targetPosition;
targetVisual.transform.localScale = Vector3.one * 4;
targetVisual.GetComponent<Collider> ().enabled = false;
//pathVisual = (GameObject)Instantiate (pathVisualPrefab);
pathVisual = GameObject.CreatePrimitive(PrimitiveType.Cube);
pathVisual.GetComponent<MeshRenderer> ().sharedMaterial.color = Color.red;
pathVisual.transform.SetParent (transform);
Vector3 pos = transform.position;
pos.y = 0.1f;
pathVisual.transform.position = pos;
pathVisual.transform.rotation = transform.rotation * Quaternion.Euler(0, 90f, 0);
}
void UpdatePathVisual() {
pathVisual.transform.rotation = transform.rotation * Quaternion.Euler(0, 90f, 0);
Vector3 direction = targetPosition - transform.position;
float distance = direction.magnitude;
pathVisual.transform.position = transform.position + (targetPosition-transform.position)/2f;
pathVisual.transform.localScale = new Vector3 (distance / 6, 1, 1);
}
void RemovePathVisual() {
if (pathVisual) {
Destroy (pathVisual);
pathVisual = null;
}
if (targetVisual) {
Destroy (targetVisual);
targetVisual = null;
}
}
}
| mit | C# |
eb878805719a5d1f4c9d6416a23819a4877e63a2 | Update copyright & bump version | tabrath/libsodium-core | libsodium-net/Properties/AssemblyInfo.cs | libsodium-net/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("libsodium-net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Adam Caudill")]
[assembly: AssemblyProduct("libsodium-net")]
[assembly: AssemblyCopyright("Copyright © Adam Caudill 2013 - 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("bac54bf6-5a39-4ab5-90f1-746a9d6b06f4")]
// 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.11.0.0")]
[assembly: AssemblyFileVersion("0.11.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("libsodium-net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Adam Caudill")]
[assembly: AssemblyProduct("libsodium-net")]
[assembly: AssemblyCopyright("Copyright © Adam Caudill 2013 - 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("bac54bf6-5a39-4ab5-90f1-746a9d6b06f4")]
// 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.10.0.0")]
[assembly: AssemblyFileVersion("0.10.0.0")]
| mit | C# |
bf198ebacf9b78f229cd5748e77ac1948702525e | Update AssemblyInfo | Vtek/Bartender | Cheers.ServiceLocator/Properties/AssemblyInfo.cs | Cheers.ServiceLocator/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Cheers.Locator")]
[assembly: AssemblyDescription("Cheers Locator contracts")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cheers")]
[assembly: AssemblyProduct("Cheers")]
[assembly: AssemblyCopyright("© 2016 Cheers")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Cheers.Locator")]
[assembly: AssemblyDescription("Cheers Locator contracts")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CheersTeam")]
[assembly: AssemblyProduct("Cheers")]
[assembly: AssemblyCopyright("© 2016 CheersTeam")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| mit | C# |
54945415c01db172ce8dc4afe03ac43035487cc7 | Remove unnecessary usings. | johnneijzen/osu,EVAST9919/osu,NeoAdonis/osu,ppy/osu,RedNesto/osu,2yangk23/osu,Nabile-Rahmani/osu,NeoAdonis/osu,naoey/osu,ZLima12/osu,NeoAdonis/osu,ppy/osu,osu-RP/osu-RP,DrabWeb/osu,peppy/osu,smoogipoo/osu,EVAST9919/osu,naoey/osu,smoogipooo/osu,smoogipoo/osu,smoogipoo/osu,johnneijzen/osu,Drezi126/osu,UselessToucan/osu,tacchinotacchi/osu,Frontear/osuKyzer,peppy/osu,peppy/osu-new,ZLima12/osu,peppy/osu,naoey/osu,Damnae/osu,DrabWeb/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,nyaamara/osu,2yangk23/osu,DrabWeb/osu | osu.Desktop.VisualTests/Tests/TestCaseReplay.cs | osu.Desktop.VisualTests/Tests/TestCaseReplay.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Input.Handlers;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Modes;
using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseReplay : TestCasePlayer
{
private WorkingBeatmap beatmap;
private InputHandler replay;
private Func<Stream> getReplayStream;
private ScoreDatabase scoreDatabase;
public override string Description => @"Testing replay playback.";
[BackgroundDependencyLoader]
private void load(Storage storage)
{
scoreDatabase = new ScoreDatabase(storage);
}
protected override Player CreatePlayer(WorkingBeatmap beatmap)
{
var player = base.CreatePlayer(beatmap);
player.ReplayInputHandler = Ruleset.GetRuleset(beatmap.PlayMode).CreateAutoplayReplay(beatmap.Beatmap)?.Replay?.GetInputHandler();
return player;
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using osu.Framework.Allocation;
using osu.Framework.Screens.Testing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using OpenTK;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Framework.Input.Handlers;
using osu.Framework.MathUtils;
using osu.Framework.Platform;
using osu.Game.Beatmaps.IO;
using osu.Game.Database;
using osu.Game.Input.Handlers;
using osu.Game.IO.Legacy;
using osu.Game.Modes;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Screens.Play;
using OpenTK.Graphics;
using OpenTK.Input;
using SharpCompress.Archives.SevenZip;
using SharpCompress.Compressors.LZMA;
using SharpCompress.Readers;
using KeyboardState = osu.Framework.Input.KeyboardState;
using MouseState = osu.Framework.Input.MouseState;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseReplay : TestCasePlayer
{
private WorkingBeatmap beatmap;
private InputHandler replay;
private Func<Stream> getReplayStream;
private ScoreDatabase scoreDatabase;
public override string Description => @"Testing replay playback.";
[BackgroundDependencyLoader]
private void load(Storage storage)
{
scoreDatabase = new ScoreDatabase(storage);
}
protected override Player CreatePlayer(WorkingBeatmap beatmap)
{
var player = base.CreatePlayer(beatmap);
player.ReplayInputHandler = Ruleset.GetRuleset(beatmap.PlayMode).CreateAutoplayReplay(beatmap.Beatmap)?.Replay?.GetInputHandler();
return player;
}
}
}
| mit | C# |
b4ef596b9db754158c0cb14883caac33e5224045 | Add some more commenting to the data-binder. | Amarcolina/LeapMotionCoreAssets,ryanwang/LeapMotionCoreAssets | Assets/LeapMotion/Widgets/Scripts/Interfaces/DataBinder.cs | Assets/LeapMotion/Widgets/Scripts/Interfaces/DataBinder.cs | using UnityEngine;
using System;
using System.Collections.Generic;
namespace LMWidgets {
// Interface to define an object that can be a data provider to a widget.
public abstract class DataBinder<WidgetType, PayloadType> : MonoBehaviour where WidgetType : IDataBoundWidget<WidgetType, PayloadType> {
[SerializeField]
private List<WidgetType> m_widgets;
private PayloadType m_lastDataValue;
// Fires when the data is updated with the most recent data as the payload
public event EventHandler<EventArg<PayloadType>> DataChangedHandler;
// Returns the current system value of the data.
// In the default implementation of the data-binder this is called every frame (in Update) so it's best to keep
// this implementation light weight.
abstract public PayloadType GetCurrentData();
// Set the current system value of the data.
abstract protected void setDataModel(PayloadType value);
// Directly set the current value of the data-model and send out the relevant updates.
public void SetCurrentData(PayloadType value) {
setDataModel (value);
updateLinkedWidgets ();
fireDataChangedEvent (GetCurrentData ());
m_lastDataValue = GetCurrentData ();
}
// Itterate through the linked widgets and update their values.
private void updateLinkedWidgets() {
foreach(WidgetType widget in m_widgets) {
widget.SetWidgetValue(GetCurrentData());
}
}
// Register all assigned widgets with the data-binder.
virtual protected void Awake() {
foreach (WidgetType widget in m_widgets) {
widget.RegisterDataBinder(this);
}
}
// Grab the inital value for GetCurrentData
virtual protected void Start() {
m_lastDataValue = GetCurrentData();
}
// Checks for change in data.
// We need this in addition to SetCurrentData as the data we're linked to
// could be modified by an external source.
void Update() {
PayloadType currentData = GetCurrentData();
if (!compare (m_lastDataValue, currentData)) {
updateLinkedWidgets ();
fireDataChangedEvent (currentData);
}
m_lastDataValue = currentData;
}
// Fire the data changed event.
// Wrapping this in a function allows child classes to call it and fire the event.
protected void fireDataChangedEvent(PayloadType currentData) {
EventHandler<EventArg<PayloadType>> handler = DataChangedHandler;
if ( handler != null ) { handler(this, new EventArg<PayloadType>(currentData)); }
}
// Handles proper comparison of generic types.
private bool compare(PayloadType x, PayloadType y)
{
return EqualityComparer<PayloadType>.Default.Equals(x, y);
}
}
public abstract class DataBinderSlider : DataBinder<SliderBase, float> {};
public abstract class DataBinderToggle : DataBinder<ButtonToggleBase, bool> {};
public abstract class DataBinderDial : DataBinder<DialGraphics, string> {};
} | using UnityEngine;
using System;
using System.Collections.Generic;
namespace LMWidgets {
// Interface to define an object that can be a data provider to a widget.
public abstract class DataBinder<WidgetType, PayloadType> : MonoBehaviour where WidgetType : IDataBoundWidget<WidgetType, PayloadType> {
[SerializeField]
private List<WidgetType> m_widgets;
private PayloadType m_lastDataValue;
// Fires when the data is updated with the most recent data as the payload
public event EventHandler<EventArg<PayloadType>> DataChangedHandler;
// Returns the current system value of the data.
// In the default implementation of the data-binder this is called every frame (in Update) so it's best to keep
// this implementation light weight.
abstract public PayloadType GetCurrentData();
// Set the current system value of the data.
abstract protected void setDataModel(PayloadType value);
public void SetCurrentData(PayloadType value) {
setDataModel (value);
updateLinkedWidgets ();
fireDataChangedEvent (GetCurrentData ());
m_lastDataValue = GetCurrentData ();
}
private void updateLinkedWidgets() {
foreach(WidgetType widget in m_widgets) {
widget.SetWidgetValue(GetCurrentData());
}
}
virtual protected void Awake() {
foreach (WidgetType widget in m_widgets) {
widget.RegisterDataBinder(this);
}
}
// Grab the inital value of GetCurrentData
virtual protected void Start() {
m_lastDataValue = GetCurrentData();
}
// Checks for change in data.
void Update() {
PayloadType currentData = GetCurrentData();
if (!compare (m_lastDataValue, currentData)) {
updateLinkedWidgets ();
fireDataChangedEvent (currentData);
}
m_lastDataValue = currentData;
}
protected void fireDataChangedEvent(PayloadType currentData) {
EventHandler<EventArg<PayloadType>> handler = DataChangedHandler;
if ( handler != null ) { handler(this, new EventArg<PayloadType>(currentData)); }
}
// Handles proper comparison of generic types.
private bool compare(PayloadType x, PayloadType y)
{
return EqualityComparer<PayloadType>.Default.Equals(x, y);
}
}
public abstract class DataBinderSlider : DataBinder<SliderBase, float> {};
public abstract class DataBinderToggle : DataBinder<ButtonToggleBase, bool> {};
public abstract class DataBinderDial : DataBinder<DialGraphics, string> {};
} | apache-2.0 | C# |
f9363f078fc406315242b29a57e23e0f948a00f0 | Change access modifier for Not class | MhmmdAb/OBehave,MhmmdAb/OBehave | OBehave/Not.cs | OBehave/Not.cs | using System;
namespace OBehave
{
public class Not<TContext>
: Leaf<TContext>
{
private Node<TContext> node;
public Not(Node<TContext> node)
{
if (node == null)
throw new ArgumentNullException();
this.node = node;
}
protected override bool UpdateImplementation(TContext context)
{
return !node.Update(context);
}
}
}
| using System;
namespace OBehave
{
class Not<TContext>
: Leaf<TContext>
{
private Node<TContext> node;
public Not(Node<TContext> node)
{
if (node == null)
throw new ArgumentNullException();
this.node = node;
}
protected override bool UpdateImplementation(TContext context)
{
return !node.Update(context);
}
}
}
| bsd-2-clause | C# |
4762b7da836b2161db81dcf5c00880bced00ba47 | Refresh playlist when any song property changes | GeorgeHahn/SOVND | SOVND.Lib/Handlers/ObservablePlaylistProvider.cs | SOVND.Lib/Handlers/ObservablePlaylistProvider.cs | using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using Anotar.NLog;
using SOVND.Lib.Models;
namespace SOVND.Lib.Handlers
{
public class ObservablePlaylistProvider : PlaylistProviderBase, IObservablePlaylistProvider
{
private readonly SyncHolder _sync;
private readonly ObservableCollection<Song> _songs;
public ObservableCollection<Song> Songs
{
get { return _songs; }
}
internal override void AddSong(Song song)
{
if (_sync.sync != null)
_sync.sync.Send((x) => _songs.Add(song), null); // TODO Bad bad bad bad
else
_songs.Add(song);
song.PropertyChanged += Song_PropertyChanged;
RaisePropertyChanged("Songs");
}
private void Song_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
RaisePropertyChanged("Songs");
}
internal override void ClearSongVotes(string id)
{
var songs = _songs.Where(x => x.SongID == id);
if(songs.Count() > 1)
LogTo.Error("Songs in list should be unique");
foreach (var song in songs)
{
// TODO Maybe Song should know where and how to publish itself / or hook into a service that can handle publishing changes
song.Votes = 0;
song.Voters = "";
}
}
public ObservablePlaylistProvider(IMQTTSettings settings, SyncHolder sync)
: base(settings)
{
_sync = sync;
_songs = new ObservableCollection<Song>();
}
public event PropertyChangedEventHandler PropertyChanged;
private void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
} | using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using Anotar.NLog;
using SOVND.Lib.Models;
namespace SOVND.Lib.Handlers
{
public class ObservablePlaylistProvider : PlaylistProviderBase, IObservablePlaylistProvider
{
private readonly SyncHolder _sync;
private readonly ObservableCollection<Song> _songs;
public ObservableCollection<Song> Songs
{
get { return _songs; }
}
internal override void AddSong(Song song)
{
if (_sync.sync != null)
_sync.sync.Send((x) => _songs.Add(song), null); // TODO Bad bad bad bad
else
_songs.Add(song);
RaisePropertyChanged("Songs");
}
internal override void ClearSongVotes(string id)
{
var songs = _songs.Where(x => x.SongID == id);
if(songs.Count() > 1)
LogTo.Error("Songs in list should be unique");
foreach (var song in songs)
{
// TODO Maybe Song should know where and how to publish itself / or hook into a service that can handle publishing changes
song.Votes = 0;
song.Voters = "";
}
}
public ObservablePlaylistProvider(IMQTTSettings settings, SyncHolder sync)
: base(settings)
{
_sync = sync;
_songs = new ObservableCollection<Song>();
}
public event PropertyChangedEventHandler PropertyChanged;
private void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
} | epl-1.0 | C# |
bf39b949d1b4c114e64ee423f88af8a8a28afe9c | Fix enum numbering for starlight type | WolfspiritM/Colore,CoraleStudios/Colore | Corale.Colore/Razer/Keyboard/Effects/StarlightType.cs | Corale.Colore/Razer/Keyboard/Effects/StarlightType.cs | // <copyright file="StarlightType.cs" company="Corale">
// Copyright © 2015 by Adam Hellberg and Brandon Scott.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
namespace Corale.Colore.Razer.Keyboard.Effects
{
using Corale.Colore.Annotations;
/// <summary>
/// Supported starlight effect types for the keyboard.
/// </summary>
public enum StarlightType
{
/// <summary>
/// Two colors.
/// </summary>
[PublicAPI]
Two = 1,
/// <summary>
/// Random colors.
/// </summary>
[PublicAPI]
Random
}
}
| // <copyright file="StarlightType.cs" company="Corale">
// Copyright © 2015 by Adam Hellberg and Brandon Scott.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
namespace Corale.Colore.Razer.Keyboard.Effects
{
using Corale.Colore.Annotations;
/// <summary>
/// Supported starlight effect types for the keyboard.
/// </summary>
public enum StarlightType
{
/// <summary>
/// Two colors.
/// </summary>
[PublicAPI]
Two,
/// <summary>
/// Random colors.
/// </summary>
[PublicAPI]
Random
}
}
| mit | C# |
bd70a51a97e13f8ff88907fc025470f4ab20677b | Add properties | Zalodu/Schedutalk,Zalodu/Schedutalk | Schedutalk/Schedutalk/Schedutalk/Model/MEvent.cs | Schedutalk/Schedutalk/Schedutalk/Model/MEvent.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Schedutalk.Model
{
public class MEvent : ViewModel.VMBase
{
public MDate StartDate
{
get;
set;
}
public MDate EndDate
{
get;
set;
}
string _title;
public string Title
{
get
{
return _title;
}
set
{
_title = value;
OnPropertyChanged("Title");
}
}
string _information;
public string Information
{
get
{
return _information;
}
set
{
_information = value;
OnPropertyChanged("Information");
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Schedutalk.Model
{
class MEvent : ViewModel.VMBase
{
}
}
| mit | C# |
7a01a3d78960d36e55d07d63d8c5812447d71320 | fix key | volkanceylan/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity | Serenity.Web/Texts/Texts.Controls.ImageUpload.cs | Serenity.Web/Texts/Texts.Controls.ImageUpload.cs |
namespace Serenity.Web
{
internal static partial class Texts
{
public static partial class Controls
{
public static class ImageUpload
{
public static LocalText AddFileButton = "Select File";
public static LocalText DeleteButtonHint = "Remove";
public static LocalText NotAnImageFile = "Uploaded file is not an image!";
public static LocalText UploadFileTooSmall = "Uploaded file must be at least {0}!";
public static LocalText UploadFileTooBig = "Uploaded file must be smallar than {0}!";
public static LocalText MaxWidth = "Uploaded image should be under {0} pixels in width!";
public static LocalText MinWidth = "Uploaded image should be at least {0} pixels in width!";
public static LocalText MaxHeight = "Uploaded image should be under {0} pixels in height!";
public static LocalText MinHeight = "Uploaded image should be at least {0} pixels in height!";
public static LocalText ColorboxCurrent = "image {current} / {total}";
public static LocalText ColorboxPrior = "prior";
public static LocalText ColorboxNext = "next";
public static LocalText ColorboxClose = "next";
}
}
}
} |
namespace Serenity.Web
{
internal static partial class Texts
{
public static partial class Controls
{
public static class ImageUpload
{
public static LocalText AddFileButton = "Select File";
public static LocalText DeleteButtonHint = "Remove";
public static LocalText NotAnImageFile = "Uploaded file is not an image!";
public static LocalText UploadFileTooSmall = "Uploaded file must be at least {0}!";
public static LocalText UploadFileTooBig = "Uploaded file must be smallar than {0}!";
public static LocalText MaxWidth = "Uploaded image should be under {0} pixels in width!";
public static LocalText MinWidth = "Uploaded image should be at least {0} pixels in width!";
public static LocalText MaxHeight = "Uploaded image should be under {0} pixels in height!";
public static LocalText MinHieght = "Uploaded image should be at least {0} pixels in height!";
public static LocalText ColorboxCurrent = "image {current} / {total}";
public static LocalText ColorboxPrior = "prior";
public static LocalText ColorboxNext = "next";
public static LocalText ColorboxClose = "next";
}
}
}
} | mit | C# |
69f11b64831a6a74e326a22176afadf30ac5bf68 | Add operator overloads | EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework | osu.Framework/Graphics/Colour/Colour4.cs | osu.Framework/Graphics/Colour/Colour4.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.
namespace osu.Framework.Graphics.Colour
{
public readonly struct Colour4
{
/// <summary>
/// Represents the red component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float R;
/// <summary>
/// Represents the green component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float G;
/// <summary>
/// Represents the blue component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float B;
/// <summary>
/// Represents the alpha component of the RGBA colour in the 0-1 range.
/// </summary>
public readonly float A;
#region Constructors
public Colour4(float r, float g, float b, float a)
{
R = r;
G = g;
B = b;
A = a;
}
public Colour4(byte r, byte g, byte b, byte a)
{
R = r / (float)byte.MaxValue;
G = g / (float)byte.MaxValue;
B = b / (float)byte.MaxValue;
A = a / (float)byte.MaxValue;
}
#endregion
#region Operator Overloads
public static Colour4 operator *(Colour4 first, Colour4 second) =>
new Colour4(first.R * second.R, first.G * second.G, first.B * second.B, first.A * second.A);
public static Colour4 operator +(Colour4 first, Colour4 second) =>
new Colour4(first.R + second.R, first.G + second.G, first.B + second.B, first.A + second.A);
public static Colour4 operator *(Colour4 first, float second) =>
new Colour4(first.R * second, first.G * second, first.B * second, first.A * second);
public static Colour4 operator /(Colour4 first, float second) => first * (1 / second);
#endregion
}
}
| // 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.
namespace osu.Framework.Graphics.Colour
{
public readonly struct Colour4
{
/// <summary>
/// Represents the red component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float R;
/// <summary>
/// Represents the green component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float G;
/// <summary>
/// Represents the blue component of the linear RGBA colour in the 0-1 range.
/// </summary>
public readonly float B;
/// <summary>
/// Represents the alpha component of the RGBA colour in the 0-1 range.
/// </summary>
public readonly float A;
#region Constructors
public Colour4(float r, float g, float b, float a)
{
R = r;
G = g;
B = b;
A = a;
}
public Colour4(byte r, byte g, byte b, byte a)
{
R = r / (float)byte.MaxValue;
G = g / (float)byte.MaxValue;
B = b / (float)byte.MaxValue;
A = a / (float)byte.MaxValue;
}
#endregion
}
}
| mit | C# |
30e12f55d311f169b541ca3ad720c6e37c4ccd0b | Revert previous commit | mdesalvo/RDFSharp | RDFSharp/Properties/AssemblyInfo.cs | RDFSharp/Properties/AssemblyInfo.cs | /*
Copyright 2012-2019 Marco De Salvo
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
[assembly: ComVisible(false)]
[assembly: Guid("1EF76FD3-C935-4965-9621-6CA0CBC275BF")]
//Internals
[assembly: InternalsVisibleTo("RDFSharp.Semantics")]
[assembly: InternalsVisibleTo("RDFSharp.RDFFirebirdStore")]
[assembly: InternalsVisibleTo("RDFSharp.RDFSQLiteStore")]
[assembly: InternalsVisibleTo("RDFSharp.RDFMySQLStore")]
[assembly: InternalsVisibleTo("RDFSharp.RDFPostgreSQLStore")]
[assembly: InternalsVisibleTo("RDFSharp.RDFOracleStore")]
| /*
Copyright 2012-2019 Marco De Salvo
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
[assembly: ComVisible(false)]
[assembly: Guid("1EF76FD3-C935-4965-9621-6CA0CBC275BF")]
//Internals
[assembly: InternalsVisibleTo("RDFSharp.Semantics")]
[assembly: InternalsVisibleTo("RDFSharp.RDFFirebirdStore")]
[assembly: InternalsVisibleTo("RDFSharp.RDFSQLiteStore")]
[assembly: InternalsVisibleTo("RDFSharp.RDFMySQLStore")]
[assembly: InternalsVisibleTo("RDFSharp.RDFPostgreSQLStore")]
[assembly: InternalsVisibleTo("RDFSharp.RDFOracleStore")]
[assembly: InternalsVisibleTo("RDFSharp.RDFSPARQLStore")] | apache-2.0 | C# |
86ca74d1b47acbf1eacc92d833bbc9c203deb1da | Use new author var for posts too | bapt/cblog,bapt/cblog | samples/templates/atom.cs | samples/templates/atom.cs | <?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text"><?cs var:title ?></title>
<subtitle type="text"><?cs var:title ?></subtitle>
<id><?cs var:url ?>/</id>
<link rel="self" href="<?cs var:url ?><?cs var:CGI.RequestURI ?>" />
<link rel="alternate" type="text/html" href="<?cs var:url ?>" />
<updated><?cs var:gendate ?></updated>
<author><name><?cs var:author ?></name></author>
<generator uri="<?cs var:CBlog.url ?>" version="<?cs var:CBlog.version ?>"><?cs var:CBlog.version ?></generator>
<?cs each:post = Posts ?>
<entry>
<title type="text"><?cs var:post.title ?></title>
<author><name><?cs var:author ?></name></author>
<content type="html"><?cs var:html_escape(post.html) ?></content>
<?cs each:tag = post.tags ?><category term="<?cs var:tag.name ?>" /><?cs /each ?>
<id><?cs var:url ?>post/<?cs var:post.filename ?></id>
<link rel="alternate" href="<?cs var:url ?>/post/<?cs var:post.filename ?>" />
<updated><?cs var:post.date ?></updated>
<published><?cs var:post.date ?></published>
</entry>
<?cs /each ?>
</feed>
| <?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text"><?cs var:title ?></title>
<subtitle type="text"><?cs var:title ?></subtitle>
<id><?cs var:url ?>/</id>
<link rel="self" href="<?cs var:url ?><?cs var:CGI.RequestURI ?>" />
<link rel="alternate" type="text/html" href="<?cs var:url ?>" />
<updated><?cs var:gendate ?></updated>
<author><name><?cs var:author ?></name></author>
<generator uri="<?cs var:CBlog.url ?>" version="<?cs var:CBlog.version ?>"><?cs var:CBlog.version ?></generator>
<?cs each:post = Posts ?>
<entry>
<title type="text"><?cs var:post.title ?></title>
<author><name>Bapt</name></author>
<content type="html"><?cs var:html_escape(post.html) ?></content>
<?cs each:tag = post.tags ?><category term="<?cs var:tag.name ?>" /><?cs /each ?>
<id><?cs var:url ?>post/<?cs var:post.filename ?></id>
<link rel="alternate" href="<?cs var:url ?>/post/<?cs var:post.filename ?>" />
<updated><?cs var:post.date ?></updated>
<published><?cs var:post.date ?></published>
</entry>
<?cs /each ?>
</feed>
| bsd-2-clause | C# |
05bea9c01836948456d60692a679fe7660a11c18 | Switch back to using a List to hold Colorings | jamesqo/Repository,jamesqo/Repository,jamesqo/Repository | Repository/EditorServices/Highlighting/TextColorer.cs | Repository/EditorServices/Highlighting/TextColorer.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using Android.Graphics;
using Repository.Common;
using Coloring = System.Int64;
namespace Repository.EditorServices.Highlighting
{
public class TextColorer : ITextColorer<ColoredText>
{
private readonly string _text;
private readonly IColorTheme _theme;
private readonly List<Coloring> _colorings;
private TextColorer(string text, IColorTheme theme)
{
Verify.NotNull(text, nameof(text));
Verify.NotNull(theme, nameof(theme));
_text = text;
_theme = theme;
_colorings = new List<Coloring>();
}
public static TextColorer Create(string text, IColorTheme theme) => new TextColorer(text, theme);
public ColoredText Result => new ColoredText(_text, _colorings.ToArray());
public void Color(SyntaxKind kind, int count)
{
Debug.Assert(count > 0);
var color = _theme.GetForegroundColor(kind);
_colorings.Add(MakeColoring(color, count));
}
private static Coloring MakeColoring(Color color, int count)
{
return ((long)color.ToArgb() << 32) | (uint)count;
}
}
} | using System;
using System.Collections.Generic;
using System.Diagnostics;
using Android.Graphics;
using Repository.Common;
using Repository.Internal;
using Coloring = System.Int64;
namespace Repository.EditorServices.Highlighting
{
public class TextColorer : ITextColorer<ColoredText>
{
private readonly string _text;
private readonly IColorTheme _theme;
private readonly ArrayBuilder<Coloring> _colorings;
private TextColorer(string text, IColorTheme theme)
{
Verify.NotNull(text, nameof(text));
Verify.NotNull(theme, nameof(theme));
_text = text;
_theme = theme;
_colorings = new ArrayBuilder<Coloring>();
}
public static TextColorer Create(string text, IColorTheme theme) => new TextColorer(text, theme);
public ColoredText Result => new ColoredText(_text, _colorings.Array, _colorings.Count);
public void Color(SyntaxKind kind, int count)
{
Debug.Assert(count > 0);
var color = _theme.GetForegroundColor(kind);
_colorings.Add(MakeColoring(color, count));
}
private static Coloring MakeColoring(Color color, int count)
{
return ((long)color.ToArgb() << 32) | (uint)count;
}
}
} | mit | C# |
b2acd51b9d172d87749b38b0f2dc55e30405de7c | Change to show alert if Secrets.cs is not edited | ProjectBlueMonkey/BlueMonkey,ProjectBlueMonkey/BlueMonkey | client/BlueMonkey/BlueMonkey/ViewModels/MainPageViewModel.cs | client/BlueMonkey/BlueMonkey/ViewModels/MainPageViewModel.cs | using System;
using Prism.Mvvm;
using Prism.Navigation;
using Prism.Services;
using Reactive.Bindings;
namespace BlueMonkey.ViewModels
{
/// <summary>
/// ViewModel for MainPage.
/// </summary>
public class MainPageViewModel : BindableBase
{
/// <summary>
/// NavigationService
/// </summary>
private readonly INavigationService _navigationService;
/// <summary>
/// The page dialog service.
/// </summary>
private readonly IPageDialogService _pageDialogService;
/// <summary>
/// Command of navigate next pages.
/// </summary>
public ReactiveCommand<string> NavigateCommand { get; }
/// <summary>
/// Initialize instance.
/// </summary>
/// <param name="navigationService"></param>
/// <param name="pageDialogService"></param>
public MainPageViewModel(INavigationService navigationService, IPageDialogService pageDialogService)
{
_navigationService = navigationService;
_pageDialogService = pageDialogService;
NavigateCommand = new ReactiveCommand<string>();
NavigateCommand.Subscribe(Navigate);
}
/// <summary>
/// Navigate next page.
/// </summary>
/// <param name="uri"></param>
private async void Navigate(string uri)
{
if (Secrets.ServerUri.Contains("your"))
{
await _pageDialogService.DisplayAlertAsync(
"Invalid Server Uri",
"You should write actual ServerUri and ConnectionString to Secrets.cs",
"Close");
return;
}
await _navigationService.NavigateAsync(uri);
}
}
}
| using System;
using Prism.Mvvm;
using Prism.Navigation;
using Reactive.Bindings;
namespace BlueMonkey.ViewModels
{
/// <summary>
/// ViewModel for MainPage.
/// </summary>
public class MainPageViewModel : BindableBase
{
/// <summary>
/// NavigationService
/// </summary>
private readonly INavigationService _navigationService;
/// <summary>
/// Command of navigate next pages.
/// </summary>
public ReactiveCommand<string> NavigateCommand { get; }
/// <summary>
/// Initialize instance.
/// </summary>
/// <param name="navigationService"></param>
public MainPageViewModel(INavigationService navigationService)
{
_navigationService = navigationService;
NavigateCommand = new ReactiveCommand<string>();
NavigateCommand.Subscribe(Navigate);
}
/// <summary>
/// Navigate next page.
/// </summary>
/// <param name="uri"></param>
private void Navigate(string uri)
{
_navigationService.NavigateAsync(uri);
}
}
}
| mit | C# |
9f361cc394434f5fc5924ea30321161fcf694461 | create base dir if doesn't exist | YetAnotherPomodoroApp/YAPA-2 | YAPA/WPF/Specifics/WpfEnviroment.cs | YAPA/WPF/Specifics/WpfEnviroment.cs | using System;
using System.IO;
using YAPA.Shared.Contracts;
namespace YAPA.WPF
{
public class WpfEnviroment : IEnviroment
{
static readonly string BaseDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"YAPA2");
readonly string _settingsFileLocation = Path.Combine(BaseDir, @"settings.json");
readonly string _themeLocation = Path.Combine(BaseDir, @"settings.json");
public WpfEnviroment()
{
if (!Directory.Exists(BaseDir))
{
Directory.CreateDirectory(BaseDir);
}
}
public string GetSettings()
{
if (!File.Exists(_settingsFileLocation))
{
return null;
}
using (var file = new StreamReader(_settingsFileLocation))
{
return file.ReadToEnd();
}
}
public void SaveSettings(string settings)
{
var settingDir = Path.GetDirectoryName(_settingsFileLocation);
if (!Directory.Exists(settingDir))
{
Directory.CreateDirectory(settingDir);
}
using (var file = new StreamWriter(_settingsFileLocation))
{
file.Write(settings);
}
}
public string GetPluginDirectory()
{
return Path.Combine(BaseDir, @"Plugins");
}
public string GetThemeDirectory()
{
return Path.Combine(BaseDir, @"Themes");
}
}
}
| using System;
using System.IO;
using YAPA.Shared.Contracts;
namespace YAPA.WPF
{
public class WpfEnviroment : IEnviroment
{
static readonly string BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
readonly string _settingsFileLocation = Path.Combine(BaseDir, @"YAPA2", @"settings.json");
readonly string _themeLocation = Path.Combine(BaseDir, @"YAPA2", @"settings.json");
public string GetSettings()
{
if (!File.Exists(_settingsFileLocation))
{
return null;
}
using (var file = new StreamReader(_settingsFileLocation))
{
return file.ReadToEnd();
}
}
public void SaveSettings(string settings)
{
var settingDir = Path.GetDirectoryName(_settingsFileLocation);
if (!Directory.Exists(settingDir))
{
Directory.CreateDirectory(settingDir);
}
using (var file = new StreamWriter(_settingsFileLocation))
{
file.Write(settings);
}
}
public string GetPluginDirectory()
{
return Path.Combine(BaseDir, @"YAPA2", @"Plugins");
}
public string GetThemeDirectory()
{
return Path.Combine(BaseDir, @"YAPA2", @"Themes");
}
}
}
| mit | C# |
651546978a694d1b8f563fbd277da70d24ab0cec | Add namespace declaration | Archie-Yang/PcscDotNet | src/PcscDotNet/IPcscProvider.cs | src/PcscDotNet/IPcscProvider.cs | namespace PcscDotNet
{
public interface IPcscProvider
{
}
} | public interface IPcscProvider
{
} | mit | C# |