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 |
|---|---|---|---|---|---|---|---|---|
c33524b61bed9a230168668c1314ba4b00476232
|
微调代码。 :wedding:
|
Zongsoft/Zongsoft.Data
|
tests/Common/Expressions/InsertStatementBuilderTest.cs
|
tests/Common/Expressions/InsertStatementBuilderTest.cs
|
using System;
using System.Linq;
using System.Collections.Generic;
using Zongsoft.Data.Common;
using Zongsoft.Data.Common.Expressions;
using Zongsoft.Data.Tests.Models;
using Xunit;
namespace Zongsoft.Data.Tests
{
public class InsertStatementBuilderTest
{
#region 常量定义
private const string APPLICATION_NAME = "Community";
#endregion
#region 成员变量
private readonly IDataProvider _provider;
#endregion
#region 构造函数
public InsertStatementBuilderTest()
{
_provider = Utility.GetProvider(APPLICATION_NAME);
}
#endregion
#region 测试方法
[Fact]
public void Test()
{
const string NAME = "UserProfile";
var accessor = new DataAccess(APPLICATION_NAME);
var schema = accessor.Schema.Parse(NAME, "*, User{*}", typeof(UserProfile));
var context = new DataInsertContext(accessor,
NAME, //name
false, //isMultiple
GetUserProfile(), //data
schema, //schema
null //state
);
var statements = context.Build();
Assert.NotNull(statements);
Assert.NotEmpty(statements);
var command = context.Build(statements.First());
Assert.NotNull(command);
Assert.NotNull(command.CommandText);
Assert.True(command.CommandText.Length > 0);
Assert.True(command.Parameters.Count > 0);
System.Diagnostics.Debug.WriteLine(command.CommandText);
}
#endregion
#region 私有方法
private UserProfile GetUserProfile(uint userId = 1, string name = null, string fullName = null)
{
return new UserProfile
{
SiteId = 1,
UserId = userId,
Gender = Gender.Male,
CreatedTime = DateTime.Now,
PhotoPath = "zfs.local:/data/temp/test.jpg",
MostRecentPostId = 200,
MostRecentPostTime = new DateTime(2010, 1, 2),
MostRecentThreadId = 100,
MostRecentThreadSubject = "This is a subject of the thread.",
MostRecentThreadTime = new DateTime(2010, 1, 1),
User = new Security.Membership.User
{
UserId = userId,
Name = name ?? "Popeye",
FullName = fullName ?? "Popeye Zhong",
Email = "zongsoft@qq.com",
Namespace = "Zongsoft",
Status = Security.Membership.UserStatus.Active,
}
};
}
private IEnumerable<UserProfile> GetUserProfiles()
{
yield return GetUserProfile(10, "Popey", "Popeye Zhong");
yield return GetUserProfile(11, "Sophia", "Sophia Zhong");
}
#endregion
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using Zongsoft.Data.Common;
using Zongsoft.Data.Common.Expressions;
using Zongsoft.Data.Tests.Models;
using Xunit;
namespace Zongsoft.Data.Tests
{
public class InsertStatementBuilderTest
{
#region 常量定义
private const string APPLICATION_NAME = "Community";
#endregion
#region 成员变量
private readonly IDataProvider _provider;
#endregion
#region 构造函数
public InsertStatementBuilderTest()
{
_provider = Utility.GetProvider(APPLICATION_NAME);
}
#endregion
#region 测试方法
[Fact]
public void Test()
{
const string NAME = "UserProfile";
var accessor = new DataAccess(APPLICATION_NAME);
var schema = accessor.Schema.Parse(NAME, "*, User{*}", typeof(UserProfile));
var context = new DataInsertContext(accessor,
NAME, //name
false, //isMultiple
GetUserProfile(), //data
schema, //schema
null //state
);
var statements = context.Build();
Assert.NotNull(statements);
Assert.NotEmpty(statements);
var command = context.Build(statements.First());
Assert.NotNull(command);
Assert.NotNull(command.CommandText);
Assert.True(command.CommandText.Length > 0);
Assert.True(command.Parameters.Count > 0);
System.Diagnostics.Debug.WriteLine(command.CommandText);
}
#endregion
#region 私有方法
private UserProfile GetUserProfile(uint userId = 1, string name = null, string fullName = null)
{
return new UserProfile
{
SiteId = 1,
UserId = userId,
Gender = Gender.Male,
CreatedTime = DateTime.Now,
PhotoPath = "zfs.local:/data/temp/test.jpg",
MostRecentPostId = 200,
MostRecentPostTime = new DateTime(2010, 1, 2),
MostRecentThreadId = 100,
MostRecentThreadSubject = "This is a subject of the thread.",
MostRecentThreadTime = new DateTime(2010, 1, 1),
User = new Security.Membership.User
{
UserId = userId,
Name = name ?? "Popeye",
FullName = fullName ?? "Popeye Zhong",
Avatar = ":smile:",
Email = "zongsoft@qq.com",
Namespace = "Zongsoft",
Status = Security.Membership.UserStatus.Active,
}
};
}
private IEnumerable<UserProfile> GetUserProfiles()
{
yield return GetUserProfile(10, "Popey", "Popeye Zhong");
yield return GetUserProfile(11, "Sophia", "Sophia Zhong");
}
#endregion
}
}
|
lgpl-2.1
|
C#
|
aea0e7d5f61a5fa662586a0e51209a4fc54a3c09
|
Add an option to enable handling of help on empty invocations
|
mrahhal/Konsola
|
src/Konsola/Parser/ContextOptionsAttribute.cs
|
src/Konsola/Parser/ContextOptionsAttribute.cs
|
using System;
namespace Konsola.Parser
{
/// <summary>
/// Configures the options when parsing args and binding them to a context.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public class ContextOptionsAttribute : Attribute
{
/// <summary>
/// Gets or sets the program's description.
/// </summary>
public string Description { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to handle empty program invocations as help.
/// </summary>
public bool HandleEmptyInvocationAsHelp { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to invoke the special methods after parsing.
/// </summary>
public bool InvokeMethods { get; set; }
}
}
|
using System;
namespace Konsola.Parser
{
/// <summary>
/// Configures the options when parsing args and binding them to a context.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public class ContextOptionsAttribute : Attribute
{
/// <summary>
/// Gets or sets the program's description.
/// </summary>
public string Description { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to invoke the special methods after parsing.
/// </summary>
public bool InvokeMethods { get; set; }
}
}
|
mit
|
C#
|
936a656723b678626010bd034ff192d31d424153
|
Remove Lazy
|
shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,dotnet/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,bartdesmet/roslyn
|
src/Workspaces/Core/Portable/Log/EtwLogger.cs
|
src/Workspaces/Core/Portable/Log/EtwLogger.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Diagnostics.Tracing;
using System.Threading;
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.Internal.Log
{
/// <summary>
/// A logger that publishes events to ETW using an EventSource.
/// </summary>
internal sealed class EtwLogger : ILogger
{
private readonly Func<FunctionId, bool> _isEnabledPredicate;
// Due to ETW specifics, RoslynEventSource.Instance needs to be initialized during EtwLogger construction
// so that we can enable the listeners synchronously before any events are logged.
private readonly RoslynEventSource _source = RoslynEventSource.Instance;
public EtwLogger(Func<FunctionId, bool> isEnabledPredicate)
=> _isEnabledPredicate = isEnabledPredicate;
public bool IsEnabled(FunctionId functionId)
=> _source.IsEnabled() && _isEnabledPredicate(functionId);
public void Log(FunctionId functionId, LogMessage logMessage)
=> _source.Log(GetMessage(logMessage), functionId);
public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken)
=> _source.BlockStart(GetMessage(logMessage), functionId, uniquePairId);
public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
_source.BlockCanceled(functionId, delta, uniquePairId);
}
else
{
_source.BlockStop(functionId, delta, uniquePairId);
}
}
private bool IsVerbose()
{
// "-1" makes this to work with any keyword
return _source.IsEnabled(EventLevel.Verbose, (EventKeywords)(-1));
}
private string GetMessage(LogMessage logMessage)
=> IsVerbose() ? logMessage.GetMessage() : string.Empty;
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Diagnostics.Tracing;
using System.Threading;
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.Internal.Log
{
/// <summary>
/// A logger that publishes events to ETW using an EventSource.
/// </summary>
internal sealed class EtwLogger : ILogger
{
private readonly Lazy<Func<FunctionId, bool>> _isEnabledPredicate;
// Due to ETW specifics, RoslynEventSource.Instance needs to be initialized during EtwLogger construction
// so that we can enable the listeners synchronously before any events are logged.
private readonly RoslynEventSource _source = RoslynEventSource.Instance;
public EtwLogger(Func<FunctionId, bool> isEnabledPredicate)
=> _isEnabledPredicate = new Lazy<Func<FunctionId, bool>>(() => isEnabledPredicate);
public bool IsEnabled(FunctionId functionId)
=> _source.IsEnabled() && _isEnabledPredicate.Value(functionId);
public void Log(FunctionId functionId, LogMessage logMessage)
=> _source.Log(GetMessage(logMessage), functionId);
public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken)
=> _source.BlockStart(GetMessage(logMessage), functionId, uniquePairId);
public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
_source.BlockCanceled(functionId, delta, uniquePairId);
}
else
{
_source.BlockStop(functionId, delta, uniquePairId);
}
}
private bool IsVerbose()
{
// "-1" makes this to work with any keyword
return _source.IsEnabled(EventLevel.Verbose, (EventKeywords)(-1));
}
private string GetMessage(LogMessage logMessage)
=> IsVerbose() ? logMessage.GetMessage() : string.Empty;
}
}
|
mit
|
C#
|
2c6156a149bb7ef0e6f9ea6c68ead7b0c8145340
|
Add missing test
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
test/Microsoft.Blazor.E2ETest/Tests/MonoSanityTest.cs
|
test/Microsoft.Blazor.E2ETest/Tests/MonoSanityTest.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 Microsoft.Blazor.E2ETest.Infrastructure;
using OpenQA.Selenium;
using Xunit;
namespace Microsoft.Blazor.E2ETest.Tests
{
public class MonoSanityTest : AspNetSiteTestBase<MonoSanity.Startup>
{
public MonoSanityTest(BrowserFixture browserFixture, AspNetServerFixture serverFixture)
: base(browserFixture, serverFixture)
{
}
[Fact]
public void HasTitle()
{
Navigate("/", noReload: true);
Assert.Equal("Mono sanity check", Browser.Title);
}
[Fact]
public void CanAddNumbers()
{
Navigate("/", noReload: true);
SetValue(Browser, "addNumberA", "1001");
SetValue(Browser, "addNumberB", "2002");
Browser.FindElement(By.CssSelector("#addNumbers button")).Click();
Assert.Equal("3003", GetValue(Browser, "addNumbersResult"));
}
[Fact]
public void CanRepeatString()
{
Navigate("/", noReload: true);
SetValue(Browser, "repeatStringStr", "Test");
SetValue(Browser, "repeatStringCount", "5");
Browser.FindElement(By.CssSelector("#repeatString button")).Click();
Assert.Equal("TestTestTestTestTest", GetValue(Browser, "repeatStringResult"));
}
[Fact]
public void CanTriggerException()
{
Navigate("/", noReload: true);
SetValue(Browser, "triggerExceptionMessage", "Hello from test");
Browser.FindElement(By.CssSelector("#triggerException button")).Click();
Assert.Contains("Hello from test", GetValue(Browser, "triggerExceptionMessageStackTrace"));
}
private static string GetValue(IWebDriver webDriver, string elementId)
{
var element = webDriver.FindElement(By.Id(elementId));
return element.GetAttribute("value");
}
private static void SetValue(IWebDriver webDriver, string elementId, string value)
{
var element = webDriver.FindElement(By.Id(elementId));
element.Clear();
element.SendKeys(value);
}
}
}
|
// 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 Microsoft.Blazor.E2ETest.Infrastructure;
using OpenQA.Selenium;
using Xunit;
namespace Microsoft.Blazor.E2ETest.Tests
{
public class MonoSanityTest : AspNetSiteTestBase<MonoSanity.Startup>
{
public MonoSanityTest(BrowserFixture browserFixture, AspNetServerFixture serverFixture)
: base(browserFixture, serverFixture)
{
}
[Fact]
public void HasTitle()
{
Navigate("/", noReload: true);
Assert.Equal("Mono sanity check", Browser.Title);
}
[Fact]
public void CanAddNumbers()
{
Navigate("/", noReload: true);
SetValue(Browser, "addNumberA", "1001");
SetValue(Browser, "addNumberB", "2002");
Browser.FindElement(By.CssSelector("#addNumbers button")).Click();
Assert.Equal("3003", GetValue(Browser, "addNumbersResult"));
}
[Fact]
public void CanRepeatString()
{
Navigate("/", noReload: true);
SetValue(Browser, "repeatStringStr", "Test");
SetValue(Browser, "repeatStringCount", "5");
Browser.FindElement(By.CssSelector("#repeatString button")).Click();
Assert.Equal("TestTestTestTestTest", GetValue(Browser, "repeatStringResult"));
}
private static string GetValue(IWebDriver webDriver, string elementId)
{
var element = webDriver.FindElement(By.Id(elementId));
return element.GetAttribute("value");
}
private static void SetValue(IWebDriver webDriver, string elementId, string value)
{
var element = webDriver.FindElement(By.Id(elementId));
element.Clear();
element.SendKeys(value);
}
}
}
|
apache-2.0
|
C#
|
1d27825897814d195fd13bfaf6ae57c58605486e
|
remove reference to `IResolver`
|
wangkanai/Detection
|
src/Detection.Device/src/Abstractions/IDeviceResolver.cs
|
src/Detection.Device/src/Abstractions/IDeviceResolver.cs
|
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
namespace Wangkanai.Detection
{
/// <summary>
/// Get device resolver to generate the device result
/// </summary>
public interface IDeviceResolver// : IResolver
{
IDeviceFactory Device { get; }
UserAgent UserAgent { get; }
}
}
|
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
namespace Wangkanai.Detection
{
/// <summary>
/// Get device resolver to generate the device result
/// </summary>
public interface IDeviceResolver : IResolver
{
IDeviceFactory Device { get; }
}
}
|
apache-2.0
|
C#
|
5be5ab90180abb1f01418dc96f7b7021fc3ef030
|
Add a safety check for when Authors is null, which shouldn't happen in the first place. Work items: 1727, 1728
|
OneGet/nuget,jmezach/NuGet2,jholovacs/NuGet,chocolatey/nuget-chocolatey,rikoe/nuget,xoofx/NuGet,indsoft/NuGet2,chocolatey/nuget-chocolatey,alluran/node.net,xoofx/NuGet,kumavis/NuGet,rikoe/nuget,xoofx/NuGet,chester89/nugetApi,zskullz/nuget,pratikkagda/nuget,akrisiun/NuGet,pratikkagda/nuget,alluran/node.net,jmezach/NuGet2,anurse/NuGet,chocolatey/nuget-chocolatey,jmezach/NuGet2,antiufo/NuGet2,xoofx/NuGet,antiufo/NuGet2,chester89/nugetApi,zskullz/nuget,dolkensp/node.net,themotleyfool/NuGet,mrward/NuGet.V2,mrward/nuget,OneGet/nuget,RichiCoder1/nuget-chocolatey,rikoe/nuget,dolkensp/node.net,mono/nuget,rikoe/nuget,ctaggart/nuget,jholovacs/NuGet,ctaggart/nuget,pratikkagda/nuget,chocolatey/nuget-chocolatey,GearedToWar/NuGet2,oliver-feng/nuget,antiufo/NuGet2,mrward/NuGet.V2,GearedToWar/NuGet2,chocolatey/nuget-chocolatey,mono/nuget,alluran/node.net,antiufo/NuGet2,indsoft/NuGet2,mrward/nuget,atheken/nuget,oliver-feng/nuget,jholovacs/NuGet,antiufo/NuGet2,jholovacs/NuGet,alluran/node.net,chocolatey/nuget-chocolatey,anurse/NuGet,GearedToWar/NuGet2,mono/nuget,jmezach/NuGet2,xoofx/NuGet,zskullz/nuget,GearedToWar/NuGet2,RichiCoder1/nuget-chocolatey,jholovacs/NuGet,zskullz/nuget,ctaggart/nuget,themotleyfool/NuGet,mrward/nuget,indsoft/NuGet2,oliver-feng/nuget,oliver-feng/nuget,mrward/nuget,RichiCoder1/nuget-chocolatey,pratikkagda/nuget,mrward/NuGet.V2,mrward/nuget,RichiCoder1/nuget-chocolatey,atheken/nuget,antiufo/NuGet2,dolkensp/node.net,OneGet/nuget,indsoft/NuGet2,oliver-feng/nuget,kumavis/NuGet,mrward/NuGet.V2,jmezach/NuGet2,xoofx/NuGet,mrward/NuGet.V2,jmezach/NuGet2,mrward/NuGet.V2,GearedToWar/NuGet2,ctaggart/nuget,pratikkagda/nuget,indsoft/NuGet2,RichiCoder1/nuget-chocolatey,pratikkagda/nuget,jholovacs/NuGet,xero-github/Nuget,akrisiun/NuGet,RichiCoder1/nuget-chocolatey,themotleyfool/NuGet,GearedToWar/NuGet2,mrward/nuget,indsoft/NuGet2,oliver-feng/nuget,mono/nuget,dolkensp/node.net,OneGet/nuget
|
src/DialogServices/PackageManagerUI/Converters/StringCollectionsToStringConverter.cs
|
src/DialogServices/PackageManagerUI/Converters/StringCollectionsToStringConverter.cs
|
using System;
using System.Collections.Generic;
using System.Windows.Data;
namespace NuGet.Dialog.PackageManagerUI
{
public class StringCollectionsToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (targetType == typeof(string))
{
string stringValue = value as string;
if (stringValue != null)
{
return stringValue;
}
else if (value == null)
{
return String.Empty;
}
{
IEnumerable<string> parts = (IEnumerable<string>)value;
return String.Join(", ", parts);
}
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Windows.Data;
namespace NuGet.Dialog.PackageManagerUI
{
public class StringCollectionsToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (targetType == typeof(string))
{
string stringValue = value as string;
if (stringValue != null)
{
return stringValue;
}
else
{
IEnumerable<string> parts = (IEnumerable<string>)value;
return String.Join(", ", parts);
}
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
apache-2.0
|
C#
|
8805bed3b010fcc14cbd5daf76808e10cd416067
|
Update BoundsQuadraticBezier.cs
|
Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
src/Core2D/Editor/Bounds/Shapes/BoundsQuadraticBezier.cs
|
src/Core2D/Editor/Bounds/Shapes/BoundsQuadraticBezier.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using Core2D.Shapes;
using Spatial;
namespace Core2D.Editor.Bounds.Shapes
{
public class BoundsQuadraticBezier : IBounds
{
public Type TargetType => typeof(IQuadraticBezierShape);
public IPointShape TryToGetPoint(IBaseShape shape, Point2 target, double radius, IDictionary<Type, IBounds> registered)
{
if (!(shape is IQuadraticBezierShape quadratic))
{
throw new ArgumentNullException(nameof(shape));
}
var pointHitTest = registered[typeof(IPointShape)];
if (pointHitTest.TryToGetPoint(quadratic.Point1, target, radius, registered) != null)
{
return quadratic.Point1;
}
if (pointHitTest.TryToGetPoint(quadratic.Point2, target, radius, registered) != null)
{
return quadratic.Point2;
}
if (pointHitTest.TryToGetPoint(quadratic.Point3, target, radius, registered) != null)
{
return quadratic.Point3;
}
return null;
}
public bool Contains(IBaseShape shape, Point2 target, double radius, IDictionary<Type, IBounds> registered)
{
if (!(shape is IQuadraticBezierShape quadratic))
{
throw new ArgumentNullException(nameof(shape));
}
return HitTestHelper.Contains(quadratic.GetPoints(), target);
}
public bool Overlaps(IBaseShape shape, Rect2 target, double radius, IDictionary<Type, IBounds> registered)
{
if (!(shape is IQuadraticBezierShape quadratic))
{
throw new ArgumentNullException(nameof(shape));
}
return HitTestHelper.Overlap(quadratic.GetPoints(), target);
}
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using Core2D.Shapes;
using Spatial;
namespace Core2D.Editor.Bounds.Shapes
{
public class BoundsQuadraticBezier : IBounds
{
public Type TargetType => typeof(IQuadraticBezierShape);
public IPointShape TryToGetPoint(IBaseShape shape, Point2 target, double radius, IDictionary<Type, IBounds> registered)
{
if (!(shape is IQuadraticBezierShape quadratic))
throw new ArgumentNullException(nameof(shape));
var pointHitTest = registered[typeof(IPointShape)];
if (pointHitTest.TryToGetPoint(quadratic.Point1, target, radius, registered) != null)
{
return quadratic.Point1;
}
if (pointHitTest.TryToGetPoint(quadratic.Point2, target, radius, registered) != null)
{
return quadratic.Point2;
}
if (pointHitTest.TryToGetPoint(quadratic.Point3, target, radius, registered) != null)
{
return quadratic.Point3;
}
return null;
}
public bool Contains(IBaseShape shape, Point2 target, double radius, IDictionary<Type, IBounds> registered)
{
if (!(shape is IQuadraticBezierShape quadratic))
throw new ArgumentNullException(nameof(shape));
return HitTestHelper.Contains(quadratic.GetPoints(), target);
}
public bool Overlaps(IBaseShape shape, Rect2 target, double radius, IDictionary<Type, IBounds> registered)
{
if (!(shape is IQuadraticBezierShape quadratic))
throw new ArgumentNullException(nameof(shape));
return HitTestHelper.Overlap(quadratic.GetPoints(), target);
}
}
}
|
mit
|
C#
|
f3c073929aa23cd85a258cbff8634923f84156f7
|
set individual destination or source multiplicity
|
GeertBellekens/Enterprise-Architect-Toolpack,GeertBellekens/Enterprise-Architect-Toolpack,GeertBellekens/Enterprise-Architect-Toolpack
|
MagicdrawMigrator/Correctors/FixAssociations.cs
|
MagicdrawMigrator/Correctors/FixAssociations.cs
|
using System.Collections.Generic;
using System.Linq;
using System;
using EAAddinFramework.Utilities;
using TSF_EA =TSF.UmlToolingFramework.Wrappers.EA;
using UML = TSF.UmlToolingFramework.UML;
using System.Diagnostics;
using System.Xml;
namespace MagicdrawMigrator
{
/// <summary>
/// Fix the (Unspecified)..(Unspecified) multiplicities on associations by setting the cardinality field to NULL in the database.
/// </summary>
public class FixAssociations:MagicDrawCorrector
{
public FixAssociations(MagicDrawReader magicDrawReader, TSF_EA.Model model, TSF_EA.Package mdPackage):base(magicDrawReader,model,mdPackage)
{
}
public override void correct()
{
EAOutputLogger.log(this.model,this.outputName
,string.Format("{0} Starting fix associations"
,DateTime.Now.ToLongTimeString())
,0
,LogTypeEnum.log);
this.model.executeSQL(@"update t_connector
set [DestCard] = NULL
where [DestCard] = '(Unspecified)..(Unspecified)'");
this.model.executeSQL(@"update t_connector
set [SourceCard] = NULL
where [SourceCard] = '(Unspecified)..(Unspecified)'");
//Log finished
EAOutputLogger.log(this.model,this.outputName
,string.Format("{0} Finished fix associations"
,DateTime.Now.ToLongTimeString())
,0
,LogTypeEnum.log);
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System;
using EAAddinFramework.Utilities;
using TSF_EA =TSF.UmlToolingFramework.Wrappers.EA;
using UML = TSF.UmlToolingFramework.UML;
using System.Diagnostics;
using System.Xml;
namespace MagicdrawMigrator
{
/// <summary>
/// Check if association between actor and use case are correctly displayed and if the stereotype
/// 'participates' is correctly applied onto the association
/// </summary>
public class FixAssociations:MagicDrawCorrector
{
public FixAssociations(MagicDrawReader magicDrawReader, TSF_EA.Model model, TSF_EA.Package mdPackage):base(magicDrawReader,model,mdPackage)
{
}
public override void correct()
{
EAOutputLogger.log(this.model,this.outputName
,string.Format("{0} Starting fix associations'"
,DateTime.Now.ToLongTimeString())
,0
,LogTypeEnum.log);
this.model.executeSQL(@"update t_connector
set [SourceCard] = NULL,
[DestCard] = NULL
where [SourceCard] = '(Unspecified)..(Unspecified)'
or [DestCard] = '(Unspecified)..(Unspecified)'");
//Log finished
EAOutputLogger.log(this.model,this.outputName
,string.Format("{0} Finished fix associations"
,DateTime.Now.ToLongTimeString())
,0
,LogTypeEnum.log);
}
}
}
|
bsd-2-clause
|
C#
|
3777618702d867690db36cd3c10a2b8e74668407
|
Update PlatformerPlayer.cs
|
jhocking/uia-2e,jhocking/uia-2e,jhocking/uia-2e,jhocking/uia-2e
|
ch06/Assets/Scripts/PlatformerPlayer.cs
|
ch06/Assets/Scripts/PlatformerPlayer.cs
|
using UnityEngine;
using System.Collections;
public class PlatformerPlayer : MonoBehaviour {
public float speed = 4.5f;
public float jumpForce = 12.0f;
private BoxCollider2D _box;
private Rigidbody2D _body;
private Animator _anim;
// Use this for initialization
void Start() {
_box = GetComponent<BoxCollider2D>();
_body = GetComponent<Rigidbody2D>();
_anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update() {
float deltaX = Input.GetAxis("Horizontal") * speed;
Vector2 movement = new Vector2(deltaX, _body.velocity.y);
_body.velocity = movement;
Vector3 max = _box.bounds.max;
Vector3 min = _box.bounds.min;
Vector2 corner1 = new Vector2(max.x, min.y - .1f);
Vector2 corner2 = new Vector2(min.x, min.y - .2f);
Collider2D hit = Physics2D.OverlapArea(corner1, corner2);
bool grounded = false;
if (hit != null) {
grounded = true;
}
_body.gravityScale = (grounded && Mathf.Approximately(deltaX, 0)) ? 0 : 1;
if (grounded && Input.GetKeyDown(KeyCode.Space)) {
_body.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
}
MovingPlatform platform = null;
if (hit != null) {
platform = hit.GetComponent<MovingPlatform>();
}
if (platform != null) {
transform.parent = platform.transform;
} else {
transform.parent = null;
}
_anim.SetFloat("speed", Mathf.Abs(deltaX));
Vector3 pScale = Vector3.one;
if (platform != null) {
pScale = platform.transform.localScale;
}
if (!Mathf.Approximately(deltaX, 0)) {
transform.localScale = new Vector3(Mathf.Sign(deltaX) / pScale.x, 1/pScale.y, 1);
}
}
}
|
using UnityEngine;
using System.Collections;
public class PlatformerPlayer : MonoBehaviour {
public float speed = 250.0f;
public float jumpForce = 12.0f;
private BoxCollider2D _box;
private Rigidbody2D _body;
private Animator _anim;
// Use this for initialization
void Start() {
_box = GetComponent<BoxCollider2D>();
_body = GetComponent<Rigidbody2D>();
_anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update() {
float deltaX = Input.GetAxis("Horizontal") * speed * Time.deltaTime;
Vector2 movement = new Vector2(deltaX, _body.velocity.y);
_body.velocity = movement;
Vector3 max = _box.bounds.max;
Vector3 min = _box.bounds.min;
Vector2 corner1 = new Vector2(max.x, min.y - .1f);
Vector2 corner2 = new Vector2(min.x, min.y - .2f);
Collider2D hit = Physics2D.OverlapArea(corner1, corner2);
bool grounded = false;
if (hit != null) {
grounded = true;
}
_body.gravityScale = grounded && deltaX == 0 ? 0 : 1;
if (grounded && Input.GetKeyDown(KeyCode.Space)) {
_body.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
}
MovingPlatform platform = null;
if (hit != null) {
platform = hit.GetComponent<MovingPlatform>();
}
if (platform != null) {
transform.parent = platform.transform;
} else {
transform.parent = null;
}
_anim.SetFloat("speed", Mathf.Abs(deltaX));
Vector3 pScale = Vector3.one;
if (platform != null) {
pScale = platform.transform.localScale;
}
if (!Mathf.Approximately(deltaX, 0)) {
transform.localScale = new Vector3(Mathf.Sign(deltaX) / pScale.x, 1/pScale.y, 1);
}
}
}
|
mit
|
C#
|
4f2b161be78f6e58cd2a9a489fd66a402577f418
|
change version
|
gaochundong/Cowboy
|
SolutionVersion.cs
|
SolutionVersion.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyDescription("Cowboy is a library for building Sockets/HTTP based services.")]
[assembly: AssemblyCompany("Dennis Gao")]
[assembly: AssemblyProduct("Cowboy")]
[assembly: AssemblyCopyright("Copyright © 2015-2016 Dennis Gao.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: ComVisible(false)]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyDescription("Cowboy is a library for building Sockets/HTTP based services.")]
[assembly: AssemblyCompany("Dennis Gao")]
[assembly: AssemblyProduct("Cowboy")]
[assembly: AssemblyCopyright("Copyright © 2015-2016 Dennis Gao.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: ComVisible(false)]
|
mit
|
C#
|
4d3caeb663c66095a249efd9a8fed428b7e0f2ab
|
Change ModelBuilder to use old EntityFrameworkCore RC1 naming conventions
|
GeorgDangl/WebDocu,GeorgDangl/WebDocu,GeorgDangl/WebDocu
|
src/Dangl.WebDocumentation/Models/ApplicationDbContext.cs
|
src/Dangl.WebDocumentation/Models/ApplicationDbContext.cs
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
namespace Dangl.WebDocumentation.Models
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions options) : base(options) { }
public DbSet<DocumentationProject> DocumentationProjects { get; set; }
public DbSet<UserProjectAccess> UserProjects { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
foreach (var entity in builder.Model.GetEntityTypes())
{
entity.Relational().TableName = entity.DisplayName();
}
base.OnModelCreating(builder);
// Make the Name unique so it can be used as a single identifier for a project ( -> Urls may contain the project name instead of the Guid)
builder.Entity<DocumentationProject>()
.HasIndex(Entity => Entity.Name)
.IsUnique();
// Make the ApiKey unique so it can be used as a single identifier for a project
builder.Entity<DocumentationProject>()
.HasIndex(Entity => Entity.ApiKey)
.IsUnique();
// Composite key for UserProject Access
builder.Entity<UserProjectAccess>()
.HasKey(Entity => new {Entity.ProjectId, Entity.UserId});
builder.Entity<UserProjectAccess>()
.HasOne(Entity => Entity.Project)
.WithMany(Project => Project.UserAccess)
.OnDelete(DeleteBehavior.Cascade);
}
}
}
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
namespace Dangl.WebDocumentation.Models
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions options) : base(options) { }
public DbSet<DocumentationProject> DocumentationProjects { get; set; }
public DbSet<UserProjectAccess> UserProjects { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
// Make the Name unique so it can be used as a single identifier for a project ( -> Urls may contain the project name instead of the Guid)
builder.Entity<DocumentationProject>()
.HasIndex(Entity => Entity.Name)
.IsUnique();
// Make the ApiKey unique so it can be used as a single identifier for a project
builder.Entity<DocumentationProject>()
.HasIndex(Entity => Entity.ApiKey)
.IsUnique();
// Composite key for UserProject Access
builder.Entity<UserProjectAccess>()
.HasKey(Entity => new {Entity.ProjectId, Entity.UserId});
builder.Entity<UserProjectAccess>()
.HasOne(Entity => Entity.Project)
.WithMany(Project => Project.UserAccess)
.OnDelete(DeleteBehavior.Cascade);
}
}
}
|
mit
|
C#
|
674efe1cb2507f1692244f238fb196acab7eaa9d
|
Handle null values
|
amroel/fluentmigrator,igitur/fluentmigrator,fluentmigrator/fluentmigrator,stsrki/fluentmigrator,amroel/fluentmigrator,schambers/fluentmigrator,schambers/fluentmigrator,stsrki/fluentmigrator,eloekset/fluentmigrator,spaccabit/fluentmigrator,spaccabit/fluentmigrator,igitur/fluentmigrator,fluentmigrator/fluentmigrator,eloekset/fluentmigrator
|
src/FluentMigrator.Runner.Db2/Generators/Db2/Db2Quoter.cs
|
src/FluentMigrator.Runner.Db2/Generators/Db2/Db2Quoter.cs
|
#region License
// Copyright (c) 2018, Fluent Migrator Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using FluentMigrator.Runner.Generators.Generic;
namespace FluentMigrator.Runner.Generators.DB2
{
public class Db2Quoter : GenericQuoter
{
public readonly char[] SpecialChars = "\"%'()*+|,{}-./:;<=>?^[]".ToCharArray();
public override string FormatDateTime(DateTime value)
{
return ValueQuote + value.ToString("yyyy-MM-dd-HH.mm.ss") + ValueQuote;
}
protected override bool ShouldQuote(string name)
{
if (string.IsNullOrEmpty(name))
return false;
// Quotes are only included if the name contains a special character, in order to preserve case insensitivity where possible.
return name.IndexOfAny(SpecialChars) != -1;
}
public override string QuoteIndexName(string indexName, string schemaName)
{
return CreateSchemaPrefixedQuotedIdentifier(
QuoteSchemaName(schemaName),
IsQuoted(indexName) ? indexName : Quote(indexName));
}
public override string FormatSystemMethods(SystemMethods value)
{
switch (value)
{
case SystemMethods.CurrentUTCDateTime:
return "(CURRENT_TIMESTAMP - CURRENT_TIMEZONE)";
case SystemMethods.CurrentDateTime:
return "CURRENT_TIMESTAMP";
case SystemMethods.CurrentUser:
return "USER";
}
return base.FormatSystemMethods(value);
}
}
}
|
#region License
// Copyright (c) 2018, Fluent Migrator Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using FluentMigrator.Runner.Generators.Generic;
namespace FluentMigrator.Runner.Generators.DB2
{
public class Db2Quoter : GenericQuoter
{
public readonly char[] SpecialChars = "\"%'()*+|,{}-./:;<=>?^[]".ToCharArray();
public override string FormatDateTime(DateTime value)
{
return ValueQuote + value.ToString("yyyy-MM-dd-HH.mm.ss") + ValueQuote;
}
protected override bool ShouldQuote(string name)
{
// Quotes are only included if the name contains a special character, in order to preserve case insensitivity where possible.
return name.IndexOfAny(SpecialChars) != -1;
}
public override string QuoteIndexName(string indexName, string schemaName)
{
return CreateSchemaPrefixedQuotedIdentifier(
QuoteSchemaName(schemaName),
IsQuoted(indexName) ? indexName : Quote(indexName));
}
public override string FormatSystemMethods(SystemMethods value)
{
switch (value)
{
case SystemMethods.CurrentUTCDateTime:
return "(CURRENT_TIMESTAMP - CURRENT_TIMEZONE)";
case SystemMethods.CurrentDateTime:
return "CURRENT_TIMESTAMP";
case SystemMethods.CurrentUser:
return "USER";
}
return base.FormatSystemMethods(value);
}
}
}
|
apache-2.0
|
C#
|
bfc2caf2e0b1ccd8e9d510a2956963f1f6c859c2
|
Add test for generic name collision on frontend
|
greymind/WebApiToTypeScript,greymind/WebApiToTypeScript,greymind/WebApiToTypeScript
|
src/WebApiTestApplication/Controllers/ThingyController.cs
|
src/WebApiTestApplication/Controllers/ThingyController.cs
|
using System.Web.Http;
using Newtonsoft.Json;
namespace WebApiTestApplication.Controllers
{
public class MegaClass : AnotherClass
{
public int Something { get; set; }
}
public class Chain1<T>
{
public T Value { get; set; }
}
public class Chain1<T1, T2>
{
public T1 Value11 { get; set; }
public T2 Value12 { get; set; }
}
public class Chain2<TValue> : Chain1<TValue, int>
{
public TValue Value2 { get; set; }
}
public class Chain3 : Chain2<MegaClass>
{
public object Value3 { get; set; }
}
[RoutePrefix("api/thingy")]
public class ThingyController : ApiController
{
[HttpGet]
[Route("")]
public string GetAll()
{
return $"values";
}
[HttpGet]
[Route("{id}")]
public string Get(int? id, string x, [FromUri]MegaClass c)
{
var valueJson = JsonConvert.SerializeObject(c);
return $"value {id} {x} {valueJson}";
}
[HttpGet]
[Route("")]
public string Getty(string x, int y)
{
return $"value {x} {y}";
}
[HttpPost]
[Route("")]
public string Post(MegaClass value)
{
var valueJson = JsonConvert.SerializeObject(value);
return $"thanks for the {valueJson} in the ace!";
}
}
}
|
using System.Web.Http;
using Newtonsoft.Json;
namespace WebApiTestApplication.Controllers
{
public class MegaClass : AnotherClass
{
public int Something { get; set; }
}
public class Chain1<T1, T2>
{
public T1 Value11 { get; set; }
public T2 Value12 { get; set; }
}
public class Chain2<TValue> : Chain1<TValue, int>
{
public TValue Value2 { get; set; }
}
public class Chain3 : Chain2<MegaClass>
{
public object Value3 { get; set; }
}
[RoutePrefix("api/thingy")]
public class ThingyController : ApiController
{
[HttpGet]
[Route("")]
public string GetAll()
{
return $"values";
}
[HttpGet]
[Route("{id}")]
public string Get(int? id, string x, [FromUri]MegaClass c)
{
var valueJson = JsonConvert.SerializeObject(c);
return $"value {id} {x} {valueJson}";
}
[HttpGet]
[Route("")]
public string Getty(string x, int y)
{
return $"value {x} {y}";
}
[HttpPost]
[Route("")]
public string Post(MegaClass value)
{
var valueJson = JsonConvert.SerializeObject(value);
return $"thanks for the {valueJson} in the ace!";
}
}
}
|
mit
|
C#
|
3b20501f63fd79d083a705990a023a21e574026a
|
fix test
|
IdentityModel/IdentityModel,IdentityModel/IdentityModelv2,IdentityModel/IdentityModel2,IdentityModel/IdentityModel,IdentityModel/IdentityModelv2,IdentityModel/IdentityModel2
|
test/UnitTests/DiscoveryResponseTests.cs
|
test/UnitTests/DiscoveryResponseTests.cs
|
using System.IO;
using Microsoft.Extensions.PlatformAbstractions;
using Xunit;
using IdentityModel.Client;
using FluentAssertions;
namespace IdentityModel.UnitTests
{
public class DiscoveryResponseTests
{
string _document;
public DiscoveryResponseTests()
{
var fileName = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "documents", "identityserver3.json");
_document = File.ReadAllText(fileName);
}
[Fact]
public void ReadValues()
{
var disco = new DiscoveryResponse(_document);
disco.TryGetValue(OidcConstants.Discovery.AuthorizationEndpoint).Should().NotBeNull();
disco.TryGetValue("unknown").Should().BeNull();
disco.TryGetString(OidcConstants.Discovery.AuthorizationEndpoint).Should().Be("https://demo.identityserver.io/connect/authorize");
disco.TryGetString("unknown").Should().BeNull();
}
[Fact]
public void ReadStrings()
{
var disco = new DiscoveryResponse(_document);
disco.TokenEndpoint.Should().Be("https://demo.identityserver.io/connect/token");
disco.AuthorizeEndpoint.Should().Be("https://demo.identityserver.io/connect/authorize");
disco.UserInfoEndpoint.Should().Be("https://demo.identityserver.io/connect/userinfo");
}
[Fact]
public void ReadBooleans()
{
var disco = new DiscoveryResponse(_document);
disco.FrontChannelLogoutSupported.Should().Be(true);
disco.FrontChannelLogoutSessionSupported.Should().Be(true);
}
[Fact]
public void ReadStringsArrays()
{
var disco = new DiscoveryResponse(_document);
var responseModes = disco.ResponseModesSupported;
responseModes.Should().Contain("form_post");
responseModes.Should().Contain("query");
responseModes.Should().Contain("fragment");
}
}
}
|
using System.IO;
using Microsoft.Extensions.PlatformAbstractions;
using Xunit;
using IdentityModel.Client;
using FluentAssertions;
namespace IdentityModel.UnitTests
{
public class DiscoveryResponseTests
{
string _document;
public DiscoveryResponseTests()
{
var fileName = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "documents", "identityserver3.json");
_document = File.ReadAllText(fileName);
}
[Fact]
public void ReadValues()
{
var disco = new DiscoveryResponse(_document);
disco.TryGetValue(OidcConstants.Discovery.AuthorizationEndpoint).Should().NotBeNull();
disco.TryGetValue("unknown").Should().BeNull();
disco.TryGetString(OidcConstants.Discovery.AuthorizationEndpoint).Should().Be("https://demo.identityserver.io/connect/authorize");
disco.TryGetString("unknown").Should().BeNull();
}
[Fact]
public void ReadStrings()
{
var disco = new DiscoveryResponse(_document);
disco.TokenEndpoint.Should().Be("https://demo.identityserver.io/connect/token");
disco.AuthorizationEndpoint.Should().Be("https://demo.identityserver.io/connect/authorize");
disco.UserInfoEndpoint.Should().Be("https://demo.identityserver.io/connect/userinfo");
}
[Fact]
public void ReadBooleans()
{
var disco = new DiscoveryResponse(_document);
disco.FrontChannelLogoutSupported.Should().Be(true);
disco.FrontChannelLogoutSessionSupported.Should().Be(true);
}
[Fact]
public void ReadStringsArrays()
{
var disco = new DiscoveryResponse(_document);
var responseModes = disco.ResponseModesSupported;
responseModes.Should().Contain("form_post");
responseModes.Should().Contain("query");
responseModes.Should().Contain("fragment");
}
}
}
|
apache-2.0
|
C#
|
620798a3ed959386c1375249fc84457374e1d43c
|
update to newer style
|
haoyk/IdentityServer4.Samples,IdentityServer/IdentityServer4.Samples,haoyk/IdentityServer4.Samples,IdentityServer/IdentityServer4.Samples,IdentityServer/IdentityServer4.Samples,haoyk/IdentityServer4.Samples,haoyk/IdentityServer4.Samples
|
Quickstarts/6_AspNetIdentity/src/Api/Startup.cs
|
Quickstarts/6_AspNetIdentity/src/Api/Startup.cs
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Api
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
builder.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddMvcCore()
.AddAuthorization()
.AddJsonFormatters();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = "http://localhost:5000",
RequireHttpsMetadata = false,
ApiName = "api1"
});
app.UseMvc();
}
}
}
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Api
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
builder.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddMvcCore()
.AddAuthorization()
.AddJsonFormatters();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = "http://localhost:5000",
AllowedScopes = { "api1" },
RequireHttpsMetadata = false
});
app.UseMvc();
}
}
}
|
apache-2.0
|
C#
|
b0f4405519571f76dc4670dae5d566d01d398917
|
add slot routing explicitly
|
davidebbo/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS,fashaikh/SimpleWAWS,fashaikh/SimpleWAWS,projectkudu/SimpleWAWS,fashaikh/SimpleWAWS,projectkudu/SimpleWAWS,projectkudu/TryAppService,davidebbo/SimpleWAWS,projectkudu/TryAppService,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS,fashaikh/SimpleWAWS,projectkudu/TryAppService,projectkudu/TryAppService
|
SimpleWAWS/Authentication/GoogleAuthProvider.cs
|
SimpleWAWS/Authentication/GoogleAuthProvider.cs
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
namespace SimpleWAWS.Authentication
{
public class GoogleAuthProvider : BaseOpenIdConnectAuthProvider
{
public override string GetLoginUrl(HttpContextBase context)
{
var culture = CultureInfo.CurrentCulture.Name.ToLowerInvariant();
var builder = new StringBuilder();
builder.Append("https://accounts.google.com/o/oauth2/auth");
builder.Append("?response_type=id_token");
builder.AppendFormat("&redirect_uri={0}", WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "https://{0}/Login", context.Request.Headers["HOST"])));
builder.AppendFormat("&client_id={0}", AuthSettings.GoogleAppId);
builder.AppendFormat("&scope={0}", "email");
if (context.IsFunctionsPortalRequest())
{
var slot = String.Empty;
if (context.Request.QueryString["x-ms-routing-name"] != null)
slot = $"?x-ms-routing-name={context.Request.QueryString["x-ms-routing-name"]}";
builder.AppendFormat($"{slot}&state={0}",
WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "{0}{1}",
context.Request.Headers["Referer"], context.Request.Url.Query) ));
}
else
builder.AppendFormat("&state={0}", WebUtility.UrlEncode(context.IsAjaxRequest()? string.Format(CultureInfo.InvariantCulture, "/{0}{1}", culture, context.Request.Url.Query) : context.Request.Url.PathAndQuery));
return builder.ToString();
}
protected override string GetValidAudiance()
{
return AuthSettings.GoogleAppId;
}
public override string GetIssuerName(string altSecId)
{
return "Google";
}
}
}
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
namespace SimpleWAWS.Authentication
{
public class GoogleAuthProvider : BaseOpenIdConnectAuthProvider
{
public override string GetLoginUrl(HttpContextBase context)
{
var culture = CultureInfo.CurrentCulture.Name.ToLowerInvariant();
var builder = new StringBuilder();
builder.Append("https://accounts.google.com/o/oauth2/auth");
builder.Append("?response_type=id_token");
builder.AppendFormat("&redirect_uri={0}", WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "https://{0}/Login", context.Request.Headers["HOST"])));
builder.AppendFormat("&client_id={0}", AuthSettings.GoogleAppId);
builder.AppendFormat("&scope={0}", "email");
if (context.IsFunctionsPortalRequest())
{
builder.AppendFormat("&state={0}", WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "{0}{1}", context.Request.Headers["Referer"], context.Request.Url.Query) ));
}
else
builder.AppendFormat("&state={0}", WebUtility.UrlEncode(context.IsAjaxRequest()? string.Format(CultureInfo.InvariantCulture, "/{0}{1}", culture, context.Request.Url.Query) : context.Request.Url.PathAndQuery));
return builder.ToString();
}
protected override string GetValidAudiance()
{
return AuthSettings.GoogleAppId;
}
public override string GetIssuerName(string altSecId)
{
return "Google";
}
}
}
|
apache-2.0
|
C#
|
71742f1eeb1c78f8d2ae312ffa085a9bb2eff4fa
|
update Bundles
|
csyntax/BlogSystem
|
Source/BlogSystem.Web/App_Start/BundleConfig.cs
|
Source/BlogSystem.Web/App_Start/BundleConfig.cs
|
namespace BlogSystem.Web
{
using System.Web.Optimization;
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
RegisterScripts(bundles);
RegisterStyles(bundles);
}
private static void RegisterStyles(BundleCollection bundles)
{
bundles
.Add(new StyleBundle("~/Content/css")
.Include(
"~/Content/bootstrap.css",
"~/Content/font-awesome.css",
"~/Content/blog.css"
));
}
private static void RegisterScripts(BundleCollection bundles)
{
bundles
.Add(new ScriptBundle("~/bundles/jquery")
.Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery.unobtrusive-ajax.js",
"~/Scripts/blog.js"
));
bundles
.Add(new ScriptBundle("~/bundles/jqueryval")
.Include("~/Scripts/jquery.validate*"));
bundles
.Add(new ScriptBundle("~/bundles/bootstrap")
.Include("~/Scripts/bootstrap.js"));
bundles
.Add(new ScriptBundle("~/bundles/notify")
.Include("~/Scripts/notify.js"));
}
}
}
|
namespace BlogSystem.Web
{
using System.Web.Optimization;
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
RegisterScripts(bundles);
RegisterStyles(bundles);
BundleTable.EnableOptimizations = true;
}
private static void RegisterStyles(BundleCollection bundles)
{
bundles
.Add(new StyleBundle("~/Content/css")
.Include(
"~/Content/bootstrap.css",
"~/Content/font-awesome.css",
"~/Content/blog.css"
));
}
private static void RegisterScripts(BundleCollection bundles)
{
bundles
.Add(new ScriptBundle("~/bundles/jquery")
.Include("~/Scripts/jquery-{version}.js", "~/Scripts/jquery.unobtrusive-ajax.js"));
bundles
.Add(new ScriptBundle("~/bundles/jqueryval")
.Include("~/Scripts/jquery.validate*"));
bundles
.Add(new ScriptBundle("~/bundles/bootstrap")
.Include("~/Scripts/bootstrap.js"));
bundles
.Add(new ScriptBundle("~/bundles/notify")
.Include("~/Scripts/notify.js"));
}
}
}
|
mit
|
C#
|
d637175bc3a62ec8e71ac8b5834ec939e155d614
|
move default target definition to the correct place
|
adamralph/xbehave.net
|
targets/Program.cs
|
targets/Program.cs
|
using System;
using System.Threading.Tasks;
using SimpleExec;
using static Bullseye.Targets;
using static SimpleExec.Command;
internal class Program
{
public static Task Main(string[] args)
{
Target("build", () => RunAsync("dotnet", $"build --configuration Release --nologo --verbosity quiet"));
Target(
"pack",
DependsOn("build"),
ForEach("Xbehave.Core.nuspec", "Xbehave.nuspec"),
async nuspec =>
{
await RunAsync("dotnet", $"pack src/Xbehave.Core --configuration Release --no-build --nologo", configureEnvironment: env => env.Add("NUSPEC_FILE", nuspec));
});
Target(
"test-core",
DependsOn("build"),
() => RunAsync("dotnet", $"test --configuration Release --no-build --framework netcoreapp3.1 --nologo"));
Target(
"test-net",
DependsOn("build"),
() => RunAsync("dotnet", $"test --configuration Release --no-build --framework net48 --nologo"));
Target("test", DependsOn("test-core", "test-net"));
Target("default", DependsOn("pack", "test"));
return RunTargetsAndExitAsync(args, ex => ex is NonZeroExitCodeException);
}
}
|
using System;
using System.Threading.Tasks;
using SimpleExec;
using static Bullseye.Targets;
using static SimpleExec.Command;
internal class Program
{
public static Task Main(string[] args)
{
Target("default", DependsOn("pack", "test"));
Target("build", () => RunAsync("dotnet", $"build --configuration Release --nologo --verbosity quiet"));
Target(
"pack",
DependsOn("build"),
ForEach("Xbehave.Core.nuspec", "Xbehave.nuspec"),
async nuspec =>
{
await RunAsync("dotnet", $"pack src/Xbehave.Core --configuration Release --no-build --nologo", configureEnvironment: env => env.Add("NUSPEC_FILE", nuspec));
});
Target(
"test-core",
DependsOn("build"),
() => RunAsync("dotnet", $"test --configuration Release --no-build --framework netcoreapp3.1 --nologo"));
Target(
"test-net",
DependsOn("build"),
() => RunAsync("dotnet", $"test --configuration Release --no-build --framework net48 --nologo"));
Target("test", DependsOn("test-core", "test-net"));
return RunTargetsAndExitAsync(args, ex => ex is NonZeroExitCodeException);
}
}
|
mit
|
C#
|
ab9f92aed04fd95e236f192d6dcd0f8697594a19
|
revert test
|
tparnell8/UntappedWidget,tparnell8/UntappedWidget
|
src/UntappedWidgetGenerator.Web/Views/Index/index.cshtml
|
src/UntappedWidgetGenerator.Web/Views/Index/index.cshtml
|
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<string>
@{
Layout = "Views/Shared/_Layout.cshtml";
}
<div id="target"></div>
@section styles{
<link rel="stylesheet" href="~/Content/jquery.UntappedWidget.min.css" />
}
@section scripts{
<script src="~/Scripts/jquery.UntappedWidget.js"></script>
<script> $(document).ready(function() {
$("#target").untappd("@Model");
});</script>
}
|
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<string>
@{
Layout = "Views/Shared/_Layout.cshtml";
}
<div id="target">test commit</div>
@section styles{
<link rel="stylesheet" href="~/Content/jquery.UntappedWidget.min.css" />
}
@section scripts{
<script src="~/Scripts/jquery.UntappedWidget.js"></script>
<script> $(document).ready(function() {
$("#target").untappd("@Model");
});</script>
}
|
mit
|
C#
|
0ba41af57388f7acf5a8908624a3defb64d4d37b
|
Update MongoUnitOfWorkFactory.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/Mongo/MongoUnitOfWorkFactory.cs
|
TIKSN.Core/Data/Mongo/MongoUnitOfWorkFactory.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
namespace TIKSN.Data.Mongo
{
public class MongoUnitOfWorkFactory : IMongoUnitOfWorkFactory
{
private readonly IMongoClientProvider _mongoClientProvider;
private readonly IServiceProvider _serviceProvider;
public MongoUnitOfWorkFactory(IMongoClientProvider mongoClientProvider, IServiceProvider serviceProvider)
{
this._mongoClientProvider =
mongoClientProvider ?? throw new ArgumentNullException(nameof(mongoClientProvider));
this._serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
}
public async Task<IMongoUnitOfWork> CreateAsync(CancellationToken cancellationToken)
{
var mongoClient = this._mongoClientProvider.GetMongoClient();
var clientSessionHandle = await mongoClient.StartSessionAsync(null, cancellationToken).ConfigureAwait(false);
var serviceScope = this._serviceProvider.CreateScope();
var mongoClientSessionStore = serviceScope.ServiceProvider.GetRequiredService<IMongoClientSessionStore>();
mongoClientSessionStore.SetClientSessionHandle(clientSessionHandle);
clientSessionHandle.StartTransaction();
return new MongoUnitOfWork(clientSessionHandle, serviceScope);
}
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
namespace TIKSN.Data.Mongo
{
public class MongoUnitOfWorkFactory : IMongoUnitOfWorkFactory
{
private readonly IMongoClientProvider _mongoClientProvider;
private readonly IServiceProvider _serviceProvider;
public MongoUnitOfWorkFactory(IMongoClientProvider mongoClientProvider, IServiceProvider serviceProvider)
{
this._mongoClientProvider =
mongoClientProvider ?? throw new ArgumentNullException(nameof(mongoClientProvider));
this._serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
}
public async Task<IMongoUnitOfWork> CreateAsync(CancellationToken cancellationToken)
{
var mongoClient = this._mongoClientProvider.GetMongoClient();
var clientSessionHandle = await mongoClient.StartSessionAsync(null, cancellationToken);
var serviceScope = this._serviceProvider.CreateScope();
var mongoClientSessionStore = serviceScope.ServiceProvider.GetRequiredService<IMongoClientSessionStore>();
mongoClientSessionStore.SetClientSessionHandle(clientSessionHandle);
clientSessionHandle.StartTransaction();
return new MongoUnitOfWork(clientSessionHandle, serviceScope);
}
}
}
|
mit
|
C#
|
8f37ceefee23f9bb8c3ea2556b2f741234f66a0e
|
Add overloads to common.cake
|
fwinkelbauer/Bumpy
|
Source/common.cake
|
Source/common.cake
|
#tool vswhere
private const string ArtifactsDirectory = "../Artifacts";
void CleanArtifacts()
{
CleanDirectory(ArtifactsDirectory);
}
void StoreChocolatey(string nuspecPattern)
{
StoreChocolatey(GetFiles(nuspecPattern));
}
void StoreChocolatey(IEnumerable<FilePath> nuspecPaths)
{
var dir = $"{ArtifactsDirectory}/Chocolatey";
EnsureDirectoryExists(dir);
Information("Creating Chocolatey package(s) in directory {0}", dir);
foreach (var nuspec in nuspecPaths)
{
ChocolateyPack(nuspec, new ChocolateyPackSettings { OutputDirectory = dir });
}
}
void StoreNuGet(string nuspecPattern)
{
StoreNuGet(GetFiles(nuspecPattern));
}
void StoreNuGet(IEnumerable<FilePath> nuspecPaths)
{
var dir = $"{ArtifactsDirectory}/NuGet";
EnsureDirectoryExists(dir);
Information("Creating NuGet package(s) in directory {0}", dir);
foreach (var nuspec in nuspecPaths)
{
NuGetPack(nuspec, new NuGetPackSettings { OutputDirectory = dir });
}
}
void StoreArtifacts(string projectName, string filePattern)
{
StoreArtifacts(projectName, GetFiles(filePattern));
}
void StoreArtifacts(string projectName, IEnumerable<FilePath> filePaths)
{
var dir = $"{ArtifactsDirectory}/{projectName}";
EnsureDirectoryExists(dir);
Information("Copying artifacts to {0}", dir);
CopyFiles(filePaths, dir);
DeleteFiles($"{dir}/*.pdb");
DeleteFiles($"{dir}/*.lastcodeanalysissucceeded");
DeleteFiles($"{dir}/*.CodeAnalysisLog.xml");
}
void MSTest2_VS2017(string assemblyPattern)
{
MSTest2_VS2017(GetFiles(assemblyPattern));
}
void MSTest2_VS2017(IEnumerable<FilePath> assemblyPaths)
{
VSTest(assemblyPaths, FixToolPath(new VSTestSettings { Logger = "trx", TestAdapterPath = "." }));
}
// https://github.com/cake-build/cake/issues/1522
VSTestSettings FixToolPath(VSTestSettings settings)
{
settings.ToolPath =
VSWhereLatest(new VSWhereLatestSettings { Requires = "Microsoft.VisualStudio.PackageGroup.TestTools.Core" })
.CombineWithFilePath(File(@"Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"));
return settings;
}
|
#tool vswhere
private const string ArtifactsDirectory = "../Artifacts";
void CleanArtifacts()
{
CleanDirectory(ArtifactsDirectory);
}
void StoreChocolatey(FilePath nuspec)
{
var dir = $"{ArtifactsDirectory}/Chocolatey";
EnsureDirectoryExists(dir);
Information("Creating Chocolatey package in directory {0}", dir);
ChocolateyPack(nuspec, new ChocolateyPackSettings { OutputDirectory = dir });
}
void StoreNuGet(FilePath nuspec)
{
var dir = $"{ArtifactsDirectory}/NuGet";
EnsureDirectoryExists(dir);
Information("Creating NuGet package in directory {0}", dir);
NuGetPack(nuspec, new NuGetPackSettings { OutputDirectory = dir });
}
void StoreArtifacts(string projectName, string includePattern)
{
StoreArtifacts(projectName, GetFiles(includePattern));
}
void StoreArtifacts(string projectName, IEnumerable<FilePath> files)
{
var dir = $"{ArtifactsDirectory}/{projectName}";
EnsureDirectoryExists(dir);
Information("Copying artifacts to {0}", dir);
CopyFiles(files, dir);
DeleteFiles($"{dir}/*.pdb");
DeleteFiles($"{dir}/*.lastcodeanalysissucceeded");
DeleteFiles($"{dir}/*.CodeAnalysisLog.xml");
}
void MSTest2_VS2017(string pattern)
{
MSTest2_VS2017(GetFiles(pattern));
}
void MSTest2_VS2017(IEnumerable<FilePath> assemblyPaths)
{
VSTest(assemblyPaths, FixToolPath(new VSTestSettings { Logger = "trx", TestAdapterPath = "." }));
}
// https://github.com/cake-build/cake/issues/1522
VSTestSettings FixToolPath(VSTestSettings settings)
{
settings.ToolPath =
VSWhereLatest(new VSWhereLatestSettings { Requires = "Microsoft.VisualStudio.PackageGroup.TestTools.Core" })
.CombineWithFilePath(File(@"Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"));
return settings;
}
|
mit
|
C#
|
744e64ca8a11364e236f5f9f2bc1694c4810cc36
|
increment pre-release version,
|
jwChung/Experimentalism,jwChung/Experimentalism
|
build/CommonAssemblyInfo.cs
|
build/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.8.17")]
[assembly: AssemblyInformationalVersion("0.8.17-pre01")]
/*
* Version 0.8.17-pre01
*
* To test publishing
*/
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.8.16")]
[assembly: AssemblyInformationalVersion("0.8.16")]
/*
* Version 0.8.16
*
* Change TestCase to accept delegate for instance method rather than
* delegate for only static method.
*
* BREAKING CHANGE
* TestCase
* before:
* TestCase.New(...);
* after:
* new TestCase(...);
*
* before:
* TestCase.New("anonymous", x => { x.ToString() });
* after: disable specifying explicit arguments.
* var value = "anonymous";
* new TestCase(() => { value.ToString() });
*
* FirstClassCommand
* before:
* FirstClassCommand(IMethodInfo, MethodInfo, object[])
* after:
* FirstClassCommand(IMethodInfo, Delegate, object[])
*
* before:
* DeclaredMethod
* after:
* Method
*
* before:
* TestMethod
* after:
* Delegate
*/
|
mit
|
C#
|
f5d89a8db5e4794955d6a94980532e7c93ebbaaa
|
Fix potential reference after dispose.
|
wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,OronDF343/Avalonia,SuperJMN/Avalonia,kekekeks/Perspex,jazzay/Perspex,AvaloniaUI/Avalonia,kekekeks/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,danwalmsley/Perspex,OronDF343/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,sagamors/Perspex,ncarrillo/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,punker76/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,MrDaedra/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,tshcherban/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,MrDaedra/Avalonia,susloparovdenis/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Perspex,susloparovdenis/Perspex,DavidKarlas/Perspex,akrisiun/Perspex,wieslawsoltes/Perspex,susloparovdenis/Avalonia,grokys/Perspex,grokys/Perspex,bbqchickenrobot/Perspex,SuperJMN/Avalonia,susloparovdenis/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,AvaloniaUI/Avalonia
|
Windows/Perspex.Direct2D1/Media/GeometryImpl.cs
|
Windows/Perspex.Direct2D1/Media/GeometryImpl.cs
|
// -----------------------------------------------------------------------
// <copyright file="GeometryImpl.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Direct2D1.Media
{
using Perspex.Platform;
using SharpDX.Direct2D1;
using Splat;
public abstract class GeometryImpl : IGeometryImpl
{
private TransformedGeometry transformed;
public abstract Rect Bounds
{
get;
}
public abstract Geometry DefiningGeometry
{
get;
}
public Geometry Geometry
{
get { return this.transformed ?? this.DefiningGeometry; }
}
public Matrix Transform
{
get
{
return this.transformed != null ?
this.transformed.Transform.ToPerspex() :
Matrix.Identity;
}
set
{
if (value != this.Transform)
{
if (this.transformed != null)
{
this.transformed.Dispose();
this.transformed = null;
}
if (!value.IsIdentity)
{
Factory factory = Locator.Current.GetService<Factory>();
this.transformed = new TransformedGeometry(
factory,
this.DefiningGeometry,
value.ToDirect2D());
}
}
}
}
public abstract Rect GetRenderBounds(double strokeThickness);
}
}
|
// -----------------------------------------------------------------------
// <copyright file="GeometryImpl.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Direct2D1.Media
{
using Perspex.Platform;
using SharpDX.Direct2D1;
using Splat;
public abstract class GeometryImpl : IGeometryImpl
{
private TransformedGeometry transformed;
public abstract Rect Bounds
{
get;
}
public abstract Geometry DefiningGeometry
{
get;
}
public Geometry Geometry
{
get { return this.transformed ?? this.DefiningGeometry; }
}
public Matrix Transform
{
get
{
return this.transformed != null ?
this.transformed.Transform.ToPerspex() :
Matrix.Identity;
}
set
{
if (value != this.Transform)
{
if (this.transformed != null)
{
this.transformed.Dispose();
}
if (!value.IsIdentity)
{
Factory factory = Locator.Current.GetService<Factory>();
this.transformed = new TransformedGeometry(
factory,
this.DefiningGeometry,
value.ToDirect2D());
}
}
}
}
public abstract Rect GetRenderBounds(double strokeThickness);
}
}
|
mit
|
C#
|
7947c6c6ff2a29760d944dfc10e19b43a3459dc6
|
Fix supported enum check in type extentions.
|
dtretyakov/WindowsAzure,dtretyakov/WindowsAzure
|
WindowsAzure/Table/Extensions/TypeExtentions.cs
|
WindowsAzure/Table/Extensions/TypeExtentions.cs
|
using System;
using System.Collections.Generic;
using System.Reflection;
namespace WindowsAzure.Table.Extensions
{
internal static class TypeExtentions
{
private static readonly HashSet<Type> _supportedEntityPropertyTypes = new HashSet<Type>
{
typeof(long),
typeof(int),
typeof(Guid),
typeof(double),
typeof(string),
typeof(bool),
typeof(DateTime),
typeof(DateTimeOffset),
typeof(byte[]),
};
public static bool IsSupportedEntityPropertyType(this Type type)
{
if (type.GetTypeInfo().IsEnum)
{
return _supportedEntityPropertyTypes.Contains(Enum.GetUnderlyingType(type));
}
return _supportedEntityPropertyTypes.Contains(type)
|| _supportedEntityPropertyTypes.Contains(Nullable.GetUnderlyingType(type));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Reflection;
namespace WindowsAzure.Table.Extensions
{
internal static class TypeExtentions
{
private static readonly HashSet<Type> _supportedEntityPropertyTypes = new HashSet<Type>
{
typeof(long),
typeof(int),
typeof(Guid),
typeof(double),
typeof(string),
typeof(bool),
typeof(DateTime),
typeof(DateTimeOffset),
typeof(byte[]),
};
public static bool IsSupportedEntityPropertyType(this Type type)
{
if (type.GetTypeInfo().IsEnum)
{
return _supportedEntityPropertyTypes.Contains(type);
}
return _supportedEntityPropertyTypes.Contains(type)
|| _supportedEntityPropertyTypes.Contains(Nullable.GetUnderlyingType(type));
}
}
}
|
mit
|
C#
|
49fe92f745544e4f03cc12f5da4a47bb1fccddc4
|
increment patch version,
|
jwChung/Experimentalism,jwChung/Experimentalism
|
build/CommonAssemblyInfo.cs
|
build/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.23.2")]
[assembly: AssemblyInformationalVersion("0.23.2")]
/*
* Version 0.23.2
*
* - [FIX] introduced TestFixtureFactoryConfigurationAttribute.
*/
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.23.1")]
[assembly: AssemblyInformationalVersion("0.23.1")]
/*
* Version 0.23.2
*
* - [FIX] introduced TestFixtureFactoryConfigurationAttribute.
*/
|
mit
|
C#
|
8b63c1c9da48719393e888457cb6d5dbf17997b9
|
Fix load state.
|
Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x
|
unity/Runtime/IronSource/Internal/IronSourceRewardedAd.cs
|
unity/Runtime/IronSource/Internal/IronSourceRewardedAd.cs
|
using System.Threading.Tasks;
using UnityEngine.Assertions;
namespace EE.Internal {
internal class IronSourceRewardedAd
: ObserverManager<IRewardedAdObserver>, IRewardedAd {
private readonly IAsyncHelper<IRewardedAdResult> _displayer;
private readonly IronSource _plugin;
private readonly string _adId;
public IronSourceRewardedAd(
IAsyncHelper<IRewardedAdResult> displayer, IronSource plugin, string adId) {
_displayer = displayer;
_plugin = plugin;
_adId = adId;
}
public void Destroy() {
_plugin.DestroyRewardedAd(_adId);
}
public bool IsLoaded => _plugin.HasRewardedAd();
public Task<bool> Load() {
return Task.FromResult(IsLoaded);
}
public Task<IRewardedAdResult> Show() {
return _displayer.Process(
() => _plugin.ShowRewardedAd(_adId),
result => {
// OK.
});
}
internal void OnLoaded() {
DispatchEvent(observer => observer.OnLoaded?.Invoke());
}
internal void OnFailedToShow(string message) {
if (_displayer.IsProcessing) {
_displayer.Resolve(IRewardedAdResult.Failed);
} else {
Assert.IsTrue(false);
}
}
internal void OnClicked() {
DispatchEvent(observer => observer.OnClicked?.Invoke());
}
internal void OnClosed(bool rewarded) {
if (_displayer.IsProcessing) {
_displayer.Resolve(rewarded
? IRewardedAdResult.Completed
: IRewardedAdResult.Canceled);
} else {
Assert.IsTrue(false);
}
}
}
}
|
using System.Threading.Tasks;
using UnityEngine.Assertions;
namespace EE.Internal {
internal class IronSourceRewardedAd
: ObserverManager<IRewardedAdObserver>, IRewardedAd {
private readonly IAsyncHelper<IRewardedAdResult> _displayer;
private readonly IronSource _plugin;
private readonly string _adId;
public IronSourceRewardedAd(
IAsyncHelper<IRewardedAdResult> displayer, IronSource plugin, string adId) {
_displayer = displayer;
_plugin = plugin;
_adId = adId;
}
public void Destroy() {
_plugin.DestroyRewardedAd(_adId);
}
public bool IsLoaded => _plugin.HasRewardedAd();
public Task<bool> Load() {
// No op.
return Task.FromResult(false);
}
public Task<IRewardedAdResult> Show() {
return _displayer.Process(
() => _plugin.ShowRewardedAd(_adId),
result => {
// OK.
});
}
internal void OnLoaded() {
DispatchEvent(observer => observer.OnLoaded?.Invoke());
}
internal void OnFailedToShow(string message) {
if (_displayer.IsProcessing) {
_displayer.Resolve(IRewardedAdResult.Failed);
} else {
Assert.IsTrue(false);
}
}
internal void OnClicked() {
DispatchEvent(observer => observer.OnClicked?.Invoke());
}
internal void OnClosed(bool rewarded) {
if (_displayer.IsProcessing) {
_displayer.Resolve(rewarded
? IRewardedAdResult.Completed
: IRewardedAdResult.Canceled);
} else {
Assert.IsTrue(false);
}
}
}
}
|
mit
|
C#
|
88e0178f01f3180b6ad5142dab51c8574c8a073e
|
Fix annotations loader for tests
|
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
|
resharper/resharper-unity/test/src/AnnotationsLoader.cs
|
resharper/resharper-unity/test/src/AnnotationsLoader.cs
|
using System;
using System.Collections.Generic;
using JetBrains.Application;
using JetBrains.Metadata.Utils;
using JetBrains.ReSharper.Psi.ExtensionsAPI.ExternalAnnotations;
using JetBrains.TestFramework.Utils;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity.Tests
{
[ShellComponent]
public class AnnotationsLoader : IExternalAnnotationsFileProvider
{
private readonly OneToSetMap<string, FileSystemPath> myAnnotations;
public AnnotationsLoader()
{
myAnnotations = new OneToSetMap<string, FileSystemPath>(StringComparer.OrdinalIgnoreCase);
var testDataPathBase = TestUtil.GetTestDataPathBase(GetType().Assembly);
var annotationsPath = testDataPathBase.Parent.Parent / "src" / "annotations";
Assertion.Assert(annotationsPath.ExistsDirectory, $"Cannot find annotations: {annotationsPath}");
var annotationFiles = annotationsPath.GetChildFiles();
foreach (var annotationFile in annotationFiles)
{
myAnnotations.Add(annotationFile.NameWithoutExtension, annotationFile);
}
}
public IEnumerable<FileSystemPath> GetAnnotationsFiles(AssemblyNameInfo assemblyName = null, FileSystemPath assemblyLocation = null)
{
if (assemblyName == null)
return myAnnotations.Values;
return myAnnotations[assemblyName.Name];
}
}
}
|
using System;
using System.Collections.Generic;
using JetBrains.Application;
using JetBrains.Metadata.Utils;
using JetBrains.ReSharper.Psi.ExtensionsAPI.ExternalAnnotations;
using JetBrains.TestFramework.Utils;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity.Tests
{
[ShellComponent]
public class AnnotationsLoader : IExternalAnnotationsFileProvider
{
private readonly OneToSetMap<string, FileSystemPath> myAnnotations;
public AnnotationsLoader()
{
myAnnotations = new OneToSetMap<string, FileSystemPath>(StringComparer.OrdinalIgnoreCase);
var testDataPathBase = TestUtil.GetTestDataPathBase(GetType().Assembly);
var annotationsPath = testDataPathBase.Parent.Parent / "src" / "resharper-unity" / "annotations";
Assertion.Assert(annotationsPath.ExistsDirectory, $"Cannot find annotations: {annotationsPath}");
var annotationFiles = annotationsPath.GetChildFiles();
foreach (var annotationFile in annotationFiles)
{
myAnnotations.Add(annotationFile.NameWithoutExtension, annotationFile);
}
}
public IEnumerable<FileSystemPath> GetAnnotationsFiles(AssemblyNameInfo assemblyName = null, FileSystemPath assemblyLocation = null)
{
if (assemblyName == null)
return myAnnotations.Values;
return myAnnotations[assemblyName.Name];
}
}
}
|
apache-2.0
|
C#
|
cf4dba46b2b91ac70df3334fd633c8d3c782ef6d
|
Improve the documentation
|
ZLima12/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework
|
osu.Framework.Android/AndroidGameActivity.cs
|
osu.Framework.Android/AndroidGameActivity.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 Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
namespace osu.Framework.Android
{
public abstract class AndroidGameActivity : Activity
{
protected abstract Game CreateGame();
private AndroidGameView gameView;
public override void OnTrimMemory([GeneratedEnum] TrimMemory level)
{
base.OnTrimMemory(level);
gameView.Host?.Collect();
}
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(gameView = new AndroidGameView(this, CreateGame()));
}
protected override void OnPause() {
base.OnPause();
// Because Android is not playing nice with Background - we just kill it
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
public override void OnBackPressed()
{
/// Avoid the default implementation that does close the app.
/// This only happens when the back button could not be captured from OnKeyDown.
}
// On some devices and keyboard combinations the OnKeyDown event does not propagate the key event to the view.
// Here it is done manually to ensure that the keys actually land in the view.
public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
{
return gameView.OnKeyDown(keyCode, e);
}
public override bool OnKeyUp([GeneratedEnum] Keycode keyCode, KeyEvent e)
{
return gameView.OnKeyUp(keyCode, e);
}
public override bool OnKeyLongPress([GeneratedEnum] Keycode keyCode, KeyEvent e)
{
return gameView.OnKeyLongPress(keyCode, e);
}
}
}
|
// 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 Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
namespace osu.Framework.Android
{
public abstract class AndroidGameActivity : Activity
{
protected abstract Game CreateGame();
private AndroidGameView gameView;
public override void OnTrimMemory([GeneratedEnum] TrimMemory level)
{
base.OnTrimMemory(level);
gameView.Host?.Collect();
}
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(gameView = new AndroidGameView(this, CreateGame()));
}
protected override void OnPause() {
base.OnPause();
// Because Android is not playing nice with Background - we just kill it
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
/// <summary>
/// Avoid the default implementation that does close the app.
/// </summary>
public override void OnBackPressed()
{
}
/// <summary>
/// There is the rare situation that the view does not get the events. So the view just gets triggered directly.
/// </summary>
public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
{
return gameView.OnKeyDown(keyCode, e);
}
/// <summary>
/// There is the rare situation that the view does not get the events. So the view just gets triggered directly.
/// </summary>
public override bool OnKeyUp([GeneratedEnum] Keycode keyCode, KeyEvent e)
{
return gameView.OnKeyUp(keyCode, e);
}
/// <summary>
/// There is the rare situation that the view does not get the events. So the view just gets triggered directly.
/// </summary>
public override bool OnKeyLongPress([GeneratedEnum] Keycode keyCode, KeyEvent e)
{
return gameView.OnKeyLongPress(keyCode, e);
}
}
}
|
mit
|
C#
|
2ba6a33184d22dee752ac63df5ef24c42d50e4aa
|
Update FindCellsWithSpecificStyle.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET
|
Examples/CSharp/Articles/FindCellsWithSpecificStyle.cs
|
Examples/CSharp/Articles/FindCellsWithSpecificStyle.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles
{
public class FindCellsWithSpecificStyle
{
public static void Main()
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
string filePath = dataDir+ "TestBook.xlsx";
Workbook workbook = new Workbook(filePath);
Worksheet worksheet = workbook.Worksheets[0];
//Access the style of cell A1
Style style = worksheet.Cells["A1"].GetStyle();
//Specify the style for searching
FindOptions options = new FindOptions();
options.Style = style;
Cell nextCell = null;
do
{
//Find the cell that has a style of cell A1
nextCell = worksheet.Cells.Find(null, nextCell, options);
if (nextCell == null)
break;
//Change the text of the cell
nextCell.PutValue("Found");
} while (true);
workbook.Save(dataDir+ "output.out.xlsx");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles
{
public class FindCellsWithSpecificStyle
{
public static void Main()
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
string filePath = dataDir+ "TestBook.xlsx";
Workbook workbook = new Workbook(filePath);
Worksheet worksheet = workbook.Worksheets[0];
//Access the style of cell A1
Style style = worksheet.Cells["A1"].GetStyle();
//Specify the style for searching
FindOptions options = new FindOptions();
options.Style = style;
Cell nextCell = null;
do
{
//Find the cell that has a style of cell A1
nextCell = worksheet.Cells.Find(null, nextCell, options);
if (nextCell == null)
break;
//Change the text of the cell
nextCell.PutValue("Found");
} while (true);
workbook.Save(dataDir+ "output.out.xlsx");
}
}
}
|
mit
|
C#
|
366e1c10cd434dde191b46d80ef02976da2eb904
|
Add parameterless constructor
|
Gibe/Gibe.DittoProcessors
|
Gibe.DittoProcessors/Processors/LinkPickerAttribute.cs
|
Gibe.DittoProcessors/Processors/LinkPickerAttribute.cs
|
using System.Web.Mvc;
using Gibe.DittoProcessors.Processors.Models;
using Gibe.UmbracoWrappers;
using Newtonsoft.Json;
using Our.Umbraco.Ditto;
namespace Gibe.DittoProcessors.Processors
{
public class LinkPickerAttribute : DittoProcessorAttribute
{
private readonly IUmbracoWrapper _umbracoWrapper;
public LinkPickerAttribute()
{
_umbracoWrapper = DependencyResolver.Current.GetService<IUmbracoWrapper>();
}
public LinkPickerAttribute(IUmbracoWrapper umbracoWrapper)
{
_umbracoWrapper = umbracoWrapper;
}
public override object ProcessValue()
{
if (string.IsNullOrEmpty(Value?.ToString()))
{
return null;
}
var link = JsonConvert.DeserializeObject<LinkPickerModel>(Value.ToString());
if (link.Id != default(int))
{
var content = _umbracoWrapper.TypedContent(link.Id);
if (content != null)
{
link.Url = content.Url;
}
}
return link;
}
}
}
|
using Gibe.DittoProcessors.Processors.Models;
using Gibe.UmbracoWrappers;
using Newtonsoft.Json;
using Our.Umbraco.Ditto;
namespace Gibe.DittoProcessors.Processors
{
public class LinkPickerAttribute : DittoProcessorAttribute
{
private readonly IUmbracoWrapper _umbracoWrapper;
public LinkPickerAttribute(IUmbracoWrapper umbracoWrapper)
{
_umbracoWrapper = umbracoWrapper;
}
public override object ProcessValue()
{
if (string.IsNullOrEmpty(Value?.ToString()))
{
return null;
}
var link = JsonConvert.DeserializeObject<LinkPickerModel>(Value.ToString());
if (link.Id != default(int))
{
var content = _umbracoWrapper.TypedContent(link.Id);
if (content != null)
{
link.Url = content.Url;
}
}
return link;
}
}
}
|
mit
|
C#
|
a8cd86bdf7648f0ab9c73f3dd249ae77d1090f48
|
fix schedule access (again)
|
joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net
|
Joinrpg/Controllers/Schedule/ShowScheduleController.cs
|
Joinrpg/Controllers/Schedule/ShowScheduleController.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
using JoinRpg.Data.Interfaces;
using JoinRpg.Helpers;
using JoinRpg.Services.Interfaces;
using JoinRpg.Web.Models;
using JoinRpg.Web.Models.Schedules;
using JoinRpg.WebPortal.Managers.Schedule;
namespace JoinRpg.Web.Controllers.Schedule
{
[AllowAnonymous] // Access to schedule checked by scheduleManager
public class ShowScheduleController : Common.ControllerGameBase
{
public ShowScheduleController(
IProjectRepository projectRepository,
IProjectService projectService,
IUserRepository userRepository, SchedulePageManager manager)
: base(projectRepository, projectService, userRepository)
{
Manager = manager;
}
public SchedulePageManager Manager { get; }
private ActionResult Error(int projectId, IEnumerable<ScheduleConfigProblemsViewModel> errors)
{
return View("..\\Payments\\Error", new ErrorViewModel
{
Message = "Ошибка открытия расписания",
Description = string.Join(", ", errors.Select(e => e.GetDisplayName())),
ReturnLink = Url.Action("Details", "Game", new { projectId }),
ReturnText = "Страница проекта",
});
}
public async Task<ActionResult> Index(int projectId)
{
var errors = await Manager.CheckScheduleConfiguration();
if (errors.Any())
{
return Error(projectId, errors);
}
var schedule = await Manager.GetSchedule();
return View(schedule);
}
public async Task<ActionResult> FullScreen(int projectId)
{
var errors = await Manager.CheckScheduleConfiguration();
if (errors.Any())
{
return Error(projectId, errors);
}
var schedule = await Manager.GetSchedule();
return View("FullScreen", schedule);
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
using JoinRpg.Data.Interfaces;
using JoinRpg.Helpers;
using JoinRpg.Services.Interfaces;
using JoinRpg.Web.Models;
using JoinRpg.Web.Models.Schedules;
using JoinRpg.WebPortal.Managers.Schedule;
namespace JoinRpg.Web.Controllers.Schedule
{
public class ShowScheduleController : Common.ControllerGameBase
{
public ShowScheduleController(
IProjectRepository projectRepository,
IProjectService projectService,
IUserRepository userRepository, SchedulePageManager manager)
: base(projectRepository, projectService, userRepository)
{
Manager = manager;
}
public SchedulePageManager Manager { get; }
private ActionResult Error(int projectId, IEnumerable<ScheduleConfigProblemsViewModel> errors)
{
return View("..\\Payments\\Error", new ErrorViewModel
{
Message = "Ошибка открытия расписания",
Description = string.Join(", ", errors.Select(e => e.GetDisplayName())),
ReturnLink = Url.Action("Details", "Game", new { projectId }),
ReturnText = "Страница проекта",
});
}
[Authorize]
public async Task<ActionResult> Index(int projectId)
{
var errors = await Manager.CheckScheduleConfiguration();
if (errors.Any())
{
return Error(projectId, errors);
}
var schedule = await Manager.GetSchedule();
return View(schedule);
}
[Authorize]
public async Task<ActionResult> FullScreen(int projectId)
{
var errors = await Manager.CheckScheduleConfiguration();
if (errors.Any())
{
return Error(projectId, errors);
}
var schedule = await Manager.GetSchedule();
return View("FullScreen", schedule);
}
}
}
|
mit
|
C#
|
fbbec1db8eb65afc89d1bb662a0ab15ecb1c070c
|
Fix to close returned XmlReader of ReadSubtree.
|
furesoft/NBug,Stef569/NBug,soygul/NBug,JuliusSweetland/NBug
|
NBug/Core/Util/Serialization/SerializableDictionary.cs
|
NBug/Core/Util/Serialization/SerializableDictionary.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SerializableDictionary.cs" company="NBusy Project">
// Copyright (c) 2010 - 2011 Teoman Soygul. Licensed under LGPLv3 (http://www.gnu.org/licenses/lgpl.html).
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace NBug.Core.Util.Serialization
{
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.Serialization;
[Serializable]
[XmlRoot("dictionary")]
public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, IXmlSerializable
{
/// <summary>
/// Initializes a new instance of the <see cref="SerializableDictionary{TKey,TValue}"/> class.
/// This is the default constructor provided for XML serializer.
/// </summary>
public SerializableDictionary()
{
}
public SerializableDictionary(IDictionary<TKey, TValue> dictionary)
{
if (dictionary == null)
{
throw new ArgumentNullException();
}
foreach (var pair in dictionary)
{
this.Add(pair.Key, pair.Value);
}
}
public XmlSchema GetSchema()
{
return null;
}
public void ReadXml(XmlReader reader)
{
/*if (reader.IsEmptyElement)
{
return;
}*/
var inner = reader.ReadSubtree();
var xElement = XElement.Load(inner);
if (xElement.HasElements)
{
foreach (var element in xElement.Elements())
{
this.Add((TKey)Convert.ChangeType(element.Name.ToString(), typeof(TKey)), (TValue)Convert.ChangeType(element.Value, typeof(TValue)));
}
}
inner.Close();
reader.ReadEndElement();
}
public void WriteXml(XmlWriter writer)
{
foreach (var key in this.Keys)
{
writer.WriteStartElement(key.ToString());
writer.WriteValue(this[key]);
writer.WriteEndElement();
}
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SerializableDictionary.cs" company="NBusy Project">
// Copyright (c) 2010 - 2011 Teoman Soygul. Licensed under LGPLv3 (http://www.gnu.org/licenses/lgpl.html).
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace NBug.Core.Util.Serialization
{
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.Serialization;
[Serializable]
[XmlRoot("dictionary")]
public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, IXmlSerializable
{
/// <summary>
/// Initializes a new instance of the <see cref="SerializableDictionary{TKey,TValue}"/> class.
/// This is the default constructor provided for XML serializer.
/// </summary>
public SerializableDictionary()
{
}
public SerializableDictionary(IDictionary<TKey, TValue> dictionary)
{
if (dictionary == null)
{
throw new ArgumentNullException();
}
foreach (var pair in dictionary)
{
this.Add(pair.Key, pair.Value);
}
}
public XmlSchema GetSchema()
{
return null;
}
public void ReadXml(XmlReader reader)
{
/*if (reader.IsEmptyElement)
{
return;
}*/
var xElement = XElement.Load(reader.ReadSubtree());
if (xElement.HasElements)
{
foreach (var element in xElement.Elements())
{
this.Add((TKey)Convert.ChangeType(element.Name.ToString(), typeof(TKey)), (TValue)Convert.ChangeType(element.Value, typeof(TValue)));
}
}
reader.ReadEndElement();
}
public void WriteXml(XmlWriter writer)
{
foreach (var key in this.Keys)
{
writer.WriteStartElement(key.ToString());
writer.WriteValue(this[key]);
writer.WriteEndElement();
}
}
}
}
|
mit
|
C#
|
b6afea737362c3e2b756f9f56134193f87981ba3
|
Update agreement view to render partial and have signed info at top
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
src/SFA.DAS.EAS.Web/Views/EmployerAgreement/View.cshtml
|
src/SFA.DAS.EAS.Web/Views/EmployerAgreement/View.cshtml
|
@using SFA.DAS.EAS.Domain
@using SFA.DAS.EAS.Domain.Models.EmployerAgreement
@using SFA.DAS.EAS.Web;
@using SFA.DAS.EAS.Web.Extensions
@model OrchestratorResponse<SFA.DAS.EAS.Web.ViewModels.EmployerAgreementViewModel>
@{ViewBag.Title = "Employer agreement";}
<div class="grid-row">
<div class="column-two-thirds">
<h2 class="heading-large">@Model.Data.EmployerAgreement.LegalEntityName</h2>
<h1 class="heading-xlarge">Your SFA agreement</h1>
</div>
</div>
<div class="grid-row">
<div class="column-two-thirds">
<table>
<tr>
<th>Accepted by:</th>
<td>@Model.Data.EmployerAgreement.SignedByName</td>
</tr>
<tr>
<th>On behalf of:</th>
<td>@Model.Data.EmployerAgreement.LegalEntityName</td>
</tr>
<tr>
<th>Address:</th>
<td>@Model.Data.EmployerAgreement.LegalEntityAddress</td>
</tr>
<tr>
<th>Accepted on:</th>
<td>@Model.Data.EmployerAgreement.SignedDate.Value.ToLongDateString()</td>
</tr>
</table>
</div>
</div>
<div class="grid-row">
<div>
@Html.Partial(Model.Data.EmployerAgreement.TemplatePartialViewName)
</div>
</div>
@section breadcrumb {
<div class="breadcrumbs">
<ol role="navigation">
<li><a href="@Url.Action("Index", "EmployerTeam")">Home</a></li>
<li><a href="@Url.Action("Index", "EmployerAgreement")">Your organisations and agreements</a></li>
<li>Employer agreement</li>
</ol>
</div>
}
|
@using SFA.DAS.EAS.Domain
@using SFA.DAS.EAS.Domain.Models.EmployerAgreement
@using SFA.DAS.EAS.Web;
@using SFA.DAS.EAS.Web.Extensions
@model OrchestratorResponse<SFA.DAS.EAS.Web.ViewModels.EmployerAgreementViewModel>
@{ViewBag.Title = "Employer agreement";}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Employer agreement</h1>
<h2 class="heading-large">@Model.Data.EmployerAgreement.LegalEntityName</h2>
<h3>@Model.Data.EmployerAgreement.LegalEntityAddress</h3>
<p>@Html.Raw(Model.Data.EmployerAgreement.TemplatePartialViewName)</p>
</div>
</div>
@section breadcrumb {
<div class="breadcrumbs">
<ol role="navigation">
<li><a href="@Url.Action("Index", "EmployerTeam")">Home</a></li>
<li><a href="@Url.Action("Index", "EmployerAgreement")">Your organisations and agreements</a></li>
<li>Employer agreement</li>
</ol>
</div>
}
|
mit
|
C#
|
9af1fc5703b3d8ddacb068b1f1ca8822db5a96b8
|
Update properties on WebAppSettings to be virtual for testing/mocking
|
justinyoo/Scissorhands.NET,GetScissorhands/Scissorhands.NET,GetScissorhands/Scissorhands.NET,aliencube/Scissorhands.NET,ujuc/Scissorhands.NET,GetScissorhands/Scissorhands.NET,aliencube/Scissorhands.NET,justinyoo/Scissorhands.NET,ujuc/Scissorhands.NET,aliencube/Scissorhands.NET,ujuc/Scissorhands.NET,justinyoo/Scissorhands.NET
|
src/Scissorhands.Core/Models/Settings/WebAppSettings.cs
|
src/Scissorhands.Core/Models/Settings/WebAppSettings.cs
|
using System.Collections.Generic;
namespace Scissorhands.Models.Settings
{
/// <summary>
/// This represents the entity for web app settings.
/// </summary>
public class WebAppSettings
{
/// <summary>
/// Gets or sets the server.
/// </summary>
public virtual ServerType Server { get; set; }
/// <summary>
/// Gets or sets the base URL of the website. eg) http://getscissorhands.net
/// </summary>
public virtual string BaseUrl { get; set; }
/// <summary>
/// Gets or sets the base path of the website. Trailing slash is optional. eg) /blog or /blog/
/// </summary>
public virtual string BasePath { get; set; }
/// <summary>
/// Gets or sets the list of <see cref="Author"/> objects.
/// </summary>
public virtual List<Author> Authors { get; set; }
/// <summary>
/// Gets or sets the list of <see cref="FeedType"/> values.
/// </summary>
public virtual List<FeedType> FeedTypes { get; set; }
/// <summary>
/// Gets or sets the theme.
/// </summary>
public virtual string Theme { get; set; }
/// <summary>
/// Gets or sets the directory path where Markdown files are stored.
/// </summary>
public virtual string MarkdownPath { get; set; }
/// <summary>
/// Gets or sets the directory path where HTML posts are stored.
/// </summary>
public virtual string HtmlPath { get; set; }
}
}
|
using System.Collections.Generic;
namespace Scissorhands.Models.Settings
{
/// <summary>
/// This represents the entity for web app settings.
/// </summary>
public class WebAppSettings
{
/// <summary>
/// Gets or sets the server.
/// </summary>
public virtual ServerType Server { get; set; }
/// <summary>
/// Gets or sets the base URL of the website. eg) http://getscissorhands.net
/// </summary>
public string BaseUrl { get; set; }
/// <summary>
/// Gets or sets the base path of the website. Trailing slash is optional. eg) /blog or /blog/
/// </summary>
public string BasePath { get; set; }
/// <summary>
/// Gets or sets the list of <see cref="Author"/> objects.
/// </summary>
public List<Author> Authors { get; set; }
/// <summary>
/// Gets or sets the list of <see cref="FeedType"/> values.
/// </summary>
public List<FeedType> FeedTypes { get; set; }
/// <summary>
/// Gets or sets the theme.
/// </summary>
public virtual string Theme { get; set; }
/// <summary>
/// Gets or sets the directory path where Markdown files are stored.
/// </summary>
public virtual string MarkdownPath { get; set; }
/// <summary>
/// Gets or sets the directory path where HTML posts are stored.
/// </summary>
public virtual string HtmlPath { get; set; }
}
}
|
mit
|
C#
|
0852d9adc7264575667f97cf3d58f3d61e0d5a0f
|
Revert "Use dot instead of dash to separate build metadata"
|
ParticularLabs/GitVersion,gep13/GitVersion,dazinator/GitVersion,gep13/GitVersion,GitTools/GitVersion,dazinator/GitVersion,ParticularLabs/GitVersion,ermshiperete/GitVersion,ermshiperete/GitVersion,ermshiperete/GitVersion,asbjornu/GitVersion,GitTools/GitVersion,asbjornu/GitVersion,ermshiperete/GitVersion
|
build/version.cake
|
build/version.cake
|
public class BuildVersion
{
public GitVersion GitVersion { get; private set; }
public string Version { get; private set; }
public string Milestone { get; private set; }
public string SemVersion { get; private set; }
public string GemVersion { get; private set; }
public string VsixVersion { get; private set; }
public static BuildVersion Calculate(ICakeContext context, BuildParameters parameters, GitVersion gitVersion)
{
var version = gitVersion.MajorMinorPatch;
var semVersion = gitVersion.LegacySemVer;
var vsixVersion = gitVersion.MajorMinorPatch;
if (!string.IsNullOrWhiteSpace(gitVersion.BuildMetaData)) {
semVersion += "-" + gitVersion.BuildMetaData;
vsixVersion += "." + DateTime.UtcNow.ToString("yyMMddHH");
}
return new BuildVersion
{
GitVersion = gitVersion,
Milestone = version,
Version = version,
SemVersion = semVersion,
GemVersion = semVersion.Replace("-", "."),
VsixVersion = vsixVersion,
};
}
}
|
public class BuildVersion
{
public GitVersion GitVersion { get; private set; }
public string Version { get; private set; }
public string Milestone { get; private set; }
public string SemVersion { get; private set; }
public string GemVersion { get; private set; }
public string VsixVersion { get; private set; }
public static BuildVersion Calculate(ICakeContext context, BuildParameters parameters, GitVersion gitVersion)
{
var version = gitVersion.MajorMinorPatch;
var semVersion = gitVersion.LegacySemVer;
var vsixVersion = gitVersion.MajorMinorPatch;
if (!string.IsNullOrWhiteSpace(gitVersion.BuildMetaData)) {
semVersion += "." + gitVersion.BuildMetaData;
vsixVersion += "." + DateTime.UtcNow.ToString("yyMMddHH");
}
return new BuildVersion
{
GitVersion = gitVersion,
Milestone = version,
Version = version,
SemVersion = semVersion,
GemVersion = semVersion.Replace("-", "."),
VsixVersion = vsixVersion,
};
}
}
|
mit
|
C#
|
aee34910134e19c1f5862b69ccb5590c5af9ce39
|
Update the assembly info
|
grantcolley/dipstate
|
DevelopmentInProgress.DipState/Properties/AssemblyInfo.cs
|
DevelopmentInProgress.DipState/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("DipState")]
[assembly: AssemblyDescription("A simple mechanism to maintain state for an activity based workflow")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Development In Progress Ltd")]
[assembly: AssemblyProduct("DipState")]
[assembly: AssemblyCopyright("Copyright © Development In Progress Ltd 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("509fbe83-7ed5-4906-8694-7f5e99824968")]
// 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.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]
|
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("DipState")]
[assembly: AssemblyDescription("A simple mechanism to maintain state for an activity based workflow")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Development In Progress Ltd")]
[assembly: AssemblyProduct("DipState")]
[assembly: AssemblyCopyright("Copyright © Development In Progress Ltd 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("509fbe83-7ed5-4906-8694-7f5e99824968")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
185cb4885b1e350106c5b643c8e01fcfece9bf5d
|
Fix UserValidator
|
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
|
InfinniPlatform.Authentication/Properties/AssemblyInfo.cs
|
InfinniPlatform.Authentication/Properties/AssemblyInfo.cs
|
// 1
// 0
// 0
// 7
// d9127c89-8481-426a-b93b-287557004c14
// 604E64920F7133DF518B7841DB78E790
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("InfinniPlatform.Authentication")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Infinnity Solutions")]
[assembly: AssemblyProduct("InfinniPlatform")]
[assembly: AssemblyCopyright("Copyright © Infinnity Solutions 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("d9127c89-8481-426a-b93b-287557004c14")]
[assembly: AssemblyVersion("1.0.0.7")]
[assembly: AssemblyFileVersion("1.0.0.7")]
[assembly: InternalsVisibleTo("InfinniPlatform.Authentication.Tests")]
[assembly: AssemblyDescription("InfinniPlatform.Authentication")]
|
// 1
// 0
// 0
// 6
// d9127c89-8481-426a-b93b-287557004c14
// 2D5A820ADF191FB5F5C8552C4EDFC3FA
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("InfinniPlatform.Authentication")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Infinnity Solutions")]
[assembly: AssemblyProduct("InfinniPlatform")]
[assembly: AssemblyCopyright("Copyright © Infinnity Solutions 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("d9127c89-8481-426a-b93b-287557004c14")]
[assembly: AssemblyVersion("1.0.0.6")]
[assembly: AssemblyFileVersion("1.0.0.6")]
[assembly: InternalsVisibleTo("InfinniPlatform.Authentication.Tests")]
[assembly: AssemblyDescription("InfinniPlatform.Authentication")]
|
agpl-3.0
|
C#
|
f26f219e562a7e19c22ca5d20794b5915a106386
|
Add test that aggregate exception is last
|
bugsnag/bugsnag-dotnet,bugsnag/bugsnag-dotnet
|
tests/Bugsnag.Tests/Payload/ExceptionTests.cs
|
tests/Bugsnag.Tests/Payload/ExceptionTests.cs
|
using System.Linq;
using System.Threading.Tasks;
using Bugsnag.Payload;
using Xunit;
namespace Bugsnag.Tests.Payload
{
public class ExceptionTests
{
[Fact]
public void CorrectNumberOfExceptions()
{
var exception = new System.Exception("oh noes!");
var exceptions = new Exceptions(exception, 5);
Assert.Single(exceptions);
}
[Fact]
public void IncludeInnerExceptions()
{
var innerException = new System.Exception();
var exception = new System.Exception("oh noes!", innerException);
var exceptions = new Exceptions(exception, 5);
Assert.Equal(2, exceptions.Count());
}
public class AggregateExceptions
{
Exception[] exceptions;
public AggregateExceptions()
{
Exceptions exceptions = null;
var exceptionsToThrow = new[] { new System.Exception(), new System.DllNotFoundException() };
var tasks = exceptionsToThrow.Select(e => Task.Run(() => { throw e; })).ToArray();
try
{
Task.WaitAll(tasks);
}
catch (System.Exception exception)
{
exceptions = new Exceptions(exception, 0);
}
this.exceptions = exceptions.ToArray();
}
[Fact]
public void ContainsDllNotFoundException()
{
Assert.Contains(exceptions, exception => exception.ErrorClass == "System.DllNotFoundException");
}
[Fact]
public void ContainsException()
{
Assert.Contains(exceptions, exception => exception.ErrorClass == "System.Exception");
}
[Fact]
public void AggregateExceptionIsLast()
{
var lastException = exceptions.Last();
Assert.Equal("System.AggregateException", lastException.ErrorClass);
}
}
}
}
|
using System.Linq;
using System.Threading.Tasks;
using Bugsnag.Payload;
using Xunit;
namespace Bugsnag.Tests.Payload
{
public class ExceptionTests
{
[Fact]
public void CorrectNumberOfExceptions()
{
var exception = new System.Exception("oh noes!");
var exceptions = new Exceptions(exception, 5);
Assert.Single(exceptions);
}
[Fact]
public void IncludeInnerExceptions()
{
var innerException = new System.Exception();
var exception = new System.Exception("oh noes!", innerException);
var exceptions = new Exceptions(exception, 5);
Assert.Equal(2, exceptions.Count());
}
[Fact]
public void HandleAggregateExceptions()
{
Exceptions exceptions = null;
var exceptionsToThrow = new[] { new System.Exception(), new System.DllNotFoundException() };
var tasks = exceptionsToThrow.Select(e => Task.Run(() => { throw e; })).ToArray();
try
{
Task.WaitAll(tasks);
}
catch (System.Exception exception)
{
exceptions = new Exceptions(exception, 0);
}
var results = exceptions.ToArray();
Assert.Contains(results, exception => exception.ErrorClass == "System.DllNotFoundException");
Assert.Contains(results, exception => exception.ErrorClass == "System.Exception");
Assert.Contains(results, exception => exception.ErrorClass == "System.AggregateException");
}
}
}
|
mit
|
C#
|
80e73275403b94ff74defe4f6431421613aa21dd
|
Add ENVIROAPPSYMBOL field
|
agrc/deq-enviro,agrc/deq-enviro,agrc/deq-enviro,agrc/deq-enviro
|
api/Deq.Search.Soe/Configuration/DebugConfiguration.cs
|
api/Deq.Search.Soe/Configuration/DebugConfiguration.cs
|
using Deq.Search.Soe.Infastructure;
using Deq.Search.Soe.Models.Configuration;
using ESRI.ArcGIS.esriSystem;
namespace Deq.Search.Soe.Configuration {
#region License
//
// Copyright (C) 2012 AGRC
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial
// portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
/// <summary>
/// Debug configration. Preconfigured for debug environment
/// </summary>
public class DebugConfiguration : IConfigurable {
public ApplicationSettings GetSettings(IPropertySet props) {
var settings = new ApplicationSettings {
ReturnFields = new[] {
"ID", "NAME", "ADDRESS", "CITY", "TYPE", "OBJECTID", "ENVIROAPPLABEL", "ENVIROAPPSYMBOL"
},
ProgramId = "ID",
SiteName = "NAME",
FacilityUst = "FACILITYUST"
};
return settings;
}
}
}
|
using Deq.Search.Soe.Infastructure;
using Deq.Search.Soe.Models.Configuration;
using ESRI.ArcGIS.esriSystem;
namespace Deq.Search.Soe.Configuration {
#region License
//
// Copyright (C) 2012 AGRC
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial
// portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
/// <summary>
/// Debug configration. Preconfigured for debug environment
/// </summary>
public class DebugConfiguration : IConfigurable {
public ApplicationSettings GetSettings(IPropertySet props) {
var settings = new ApplicationSettings {
ReturnFields = new[] {
"ID", "NAME", "ADDRESS", "CITY", "TYPE", "OBJECTID", "ENVIROAPPLABEL"
},
ProgramId = "ID",
SiteName = "NAME",
FacilityUst = "FACILITYUST"
};
return settings;
}
}
}
|
mit
|
C#
|
7ec5398770948d246f72150659932651b385fea3
|
Add namespace
|
EightBitBoy/EcoRealms
|
Assets/Scripts/Map/MapHighlightManager.cs
|
Assets/Scripts/Map/MapHighlightManager.cs
|
using UnityEngine;
using System.Collections;
namespace ecorealms.map {
public class MapHighlightManager : MonoBehaviour {
void Setup () {
}
}
}
|
using UnityEngine;
using System.Collections;
public class MapHighlightManager : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
|
apache-2.0
|
C#
|
f2abb8f102649596275057e1f9fcd508c8a1927b
|
Fix a few tests
|
Seddryck/NBi,Seddryck/NBi
|
NBi.Testing/Unit/Core/Variable/TestVariableFactoryTest.cs
|
NBi.Testing/Unit/Core/Variable/TestVariableFactoryTest.cs
|
using Moq;
using NBi.Core.Query.Resolver;
using NBi.Core.Scalar.Resolver;
using NBi.Core.Transformation;
using NBi.Core.Variable;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NBi.Testing.Unit.Core.Variable
{
public class TestVariableFactoryTest
{
[Test]
public void Instantiate_CSharp_TestVariable()
{
var factory = new TestVariableFactory();
var resolver = new CSharpScalarResolver<object>(new CSharpScalarResolverArgs("DateTime.Now.Year"));
var variable = factory.Instantiate(resolver);
Assert.That(variable, Is.AssignableTo<ITestVariable>());
Assert.That(variable, Is.TypeOf<TestVariable>());
}
[Test]
public void Instantiate_QueryScalar_TestVariable()
{
var factory = new TestVariableFactory();
var queryResolverArgsMock = new Mock<QueryResolverArgs>(null, null, null, null);
var resolver = new QueryScalarResolver<object>(new QueryScalarResolverArgs(queryResolverArgsMock.Object));
var variable = factory.Instantiate(resolver);
Assert.That(variable, Is.AssignableTo<ITestVariable>());
Assert.That(variable, Is.TypeOf<TestVariable>());
}
[Test]
public void Instantiate_CSharp_IsNotEvaluated()
{
var factory = new TestVariableFactory();
var resolver = new CSharpScalarResolver<object>(new CSharpScalarResolverArgs("DateTime.Now.Year"));
var variable = factory.Instantiate(resolver);
Assert.That(variable.IsEvaluated, Is.False);
}
}
}
|
using Moq;
using NBi.Core.Query.Resolver;
using NBi.Core.Scalar.Resolver;
using NBi.Core.Transformation;
using NBi.Core.Variable;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NBi.Testing.Unit.Core.Variable
{
public class TestVariableFactoryTest
{
[Test]
public void Instantiate_CSharp_TestVariable()
{
var factory = new TestVariableFactory();
var resolver = new CSharpScalarResolver<object>(new CSharpScalarResolverArgs("DateTime.Now.Year"));
var variable = factory.Instantiate(resolver);
Assert.That(variable, Is.TypeOf<ITestVariable>());
}
[Test]
public void Instantiate_QueryScalar_TestVariable()
{
var factory = new TestVariableFactory();
var queryResolverArgsMock = Mock.Of<QueryResolverArgs>();
var resolver = new QueryScalarResolver<object>(new QueryScalarResolverArgs(queryResolverArgsMock));
var variable = factory.Instantiate(resolver);
Assert.That(variable, Is.TypeOf<ITestVariable>());
}
[Test]
public void Instantiate_CSharp_IsNotEvaluated()
{
var factory = new TestVariableFactory();
var resolver = new CSharpScalarResolver<object>(new CSharpScalarResolverArgs("DateTime.Now.Year"));
var variable = factory.Instantiate(resolver);
Assert.That(variable.IsEvaluated, Is.False);
}
}
}
|
apache-2.0
|
C#
|
c9e3c484e714dd2eb1f8f6c792fc1c7e8fb715fe
|
Remove closing bracket from arguments
|
zedr0n/AngleSharp.Local,zedr0n/AngleSharp.Local,FlorianRappl/AngleSharp,Livven/AngleSharp,FlorianRappl/AngleSharp,AngleSharp/AngleSharp,zedr0n/AngleSharp.Local,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,Livven/AngleSharp,AngleSharp/AngleSharp,Livven/AngleSharp,FlorianRappl/AngleSharp,FlorianRappl/AngleSharp
|
AngleSharp/Css/ValueConverters/FunctionValueConverter.cs
|
AngleSharp/Css/ValueConverters/FunctionValueConverter.cs
|
namespace AngleSharp.Css.ValueConverters
{
using System;
using System.Collections.Generic;
using System.Linq;
using AngleSharp.Dom.Css;
using AngleSharp.Parser.Css;
sealed class FunctionValueConverter<T> : IValueConverter<T>
{
readonly String _name;
readonly IValueConverter<T> _arguments;
public FunctionValueConverter(String name, IValueConverter<T> arguments)
{
_name = name;
_arguments = arguments;
}
public Boolean TryConvert(IEnumerable<CssToken> value, Action<T> setResult)
{
var args = ExtractArguments(value);
return args != null && _arguments.TryConvert(args, setResult);
}
public Boolean Validate(IEnumerable<CssToken> value)
{
var args = ExtractArguments(value);
return args != null && _arguments.Validate(args);
}
List<CssToken> ExtractArguments(IEnumerable<CssToken> value)
{
var iter = value.GetEnumerator();
if (iter.MoveNext() && IsFunction(iter.Current))
{
var tokens = new List<CssToken>();
while (iter.MoveNext())
{
tokens.Add(iter.Current);
}
if (tokens.Count > 0 && tokens[tokens.Count - 1].Type == CssTokenType.RoundBracketClose)
{
tokens.RemoveAt(tokens.Count - 1);
return tokens;
}
}
return null;
}
Boolean IsFunction(CssToken value)
{
return value.Type == CssTokenType.Function && value.Data.Equals(_name, StringComparison.OrdinalIgnoreCase);
}
}
}
|
namespace AngleSharp.Css.ValueConverters
{
using System;
using System.Collections.Generic;
using System.Linq;
using AngleSharp.Dom.Css;
using AngleSharp.Parser.Css;
sealed class FunctionValueConverter<T> : IValueConverter<T>
{
readonly String _name;
readonly IValueConverter<T> _arguments;
public FunctionValueConverter(String name, IValueConverter<T> arguments)
{
_name = name;
_arguments = arguments;
}
public Boolean TryConvert(IEnumerable<CssToken> value, Action<T> setResult)
{
var args = ExtractArguments(value);
return args != null && _arguments.TryConvert(args, setResult);
}
public Boolean Validate(IEnumerable<CssToken> value)
{
var args = ExtractArguments(value);
return args != null && _arguments.Validate(args);
}
List<CssToken> ExtractArguments(IEnumerable<CssToken> value)
{
var iter = value.GetEnumerator();
if (iter.MoveNext() && IsFunction(iter.Current))
{
var tokens = new List<CssToken>();
while (iter.MoveNext())
{
tokens.Add(iter.Current);
}
if (tokens.Count > 0 && tokens[tokens.Count - 1].Type == CssTokenType.RoundBracketClose)
{
return tokens;
}
}
return null;
}
Boolean IsFunction(CssToken value)
{
return value.Type == CssTokenType.Function && value.Data.Equals(_name, StringComparison.OrdinalIgnoreCase);
}
}
}
|
mit
|
C#
|
a66d9488f1147be02319e789b44b986ad2bc3c28
|
Change DLX OpCodes to use UpperCase
|
ilovepi/Compiler,ilovepi/Compiler
|
compiler/backend/OpCodes.cs
|
compiler/backend/OpCodes.cs
|
namespace compiler.backend
{
public enum OpCodes
{
ADD = 0,
SUB = 1,
MUL = 2,
DIV = 3,
MOD = 4,
CMP = 5,
OR = 8,
AND = 9,
BIC = 10,
XOR = 11,
LSH = 12,
ASH = 13,
CHK = 14,
ADDI = 16,
SUBI = 17,
MULI = 18,
DIVI = 19,
MODI = 20,
CMPI = 21,
ORI = 24,
ANDI = 25,
BICI = 26,
XORI = 27,
LSHI = 28,
ASHI = 29,
CHKI = 30,
LDW = 32,
LDX = 33,
POP = 34,
STW = 36,
STX = 37,
PSH = 38,
BEQ = 40,
BNE = 41,
BLT = 42,
BGE = 43,
BLE = 44,
BGT = 45,
BSR = 46,
JSR = 48,
RET = 49,
RDD = 50,
WRD = 51,
WRH = 52,
WRL = 53
}
}
|
namespace compiler.backend
{
public enum OpCodes
{
Add = 0,
Sub = 1,
Mul = 2,
Div = 3,
Mod = 4,
Cmp = 5,
Or = 8,
And = 9,
Bic = 10,
Xor = 11,
Lsh = 12,
Ash = 13,
Chk = 14,
Addi = 16,
Subi = 17,
Muli = 18,
Divi = 19,
Modi = 20,
Cmpi = 21,
Ori = 24,
Andi = 25,
Bici = 26,
Xori = 27,
Lshi = 28,
Ashi = 29,
Chki = 30,
Ldw = 32,
Ldx = 33,
Pop = 34,
Stw = 36,
Stx = 37,
Psh = 38,
Beq = 40,
Bne = 41,
Blt = 42,
Bge = 43,
Ble = 44,
Bgt = 45,
Bsr = 46,
Jsr = 48,
Ret = 49,
Rdd = 50,
Wrd = 51,
Wrh = 52,
Wrl = 53
}
}
|
mit
|
C#
|
daf9602962facd35094a63be9633fe1f7b70da24
|
Increase Major Version
|
darbio/cap-net,TeamnetGroup/cap-net
|
src/CAPNet/Properties/AssemblyInfo.cs
|
src/CAPNet/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("cap-net")]
[assembly: AssemblyDescription("A Common Alerting Protocol serialization library for the .NET framework.")]
[assembly: AssemblyProduct("cap-net")]
[assembly: AssemblyCopyright("Copyright © 2013 Matt Chandler and contributors")]
// 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)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0-alpha")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("cap-net")]
[assembly: AssemblyDescription("A Common Alerting Protocol serialization library for the .NET framework.")]
[assembly: AssemblyProduct("cap-net")]
[assembly: AssemblyCopyright("Copyright © 2013 Matt Chandler and contributors")]
// 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)]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0-alpha")]
|
mit
|
C#
|
6559137b1ed07c724ff084a348f4fa291d3dac10
|
Update DirectInputPadPlugin.Build.cs
|
katze7514/UEDirectInputPadPlugin,katze7514/UEDirectInputPadPlugin
|
Source/DirectInputPadPlugin/DirectInputPadPlugin.Build.cs
|
Source/DirectInputPadPlugin/DirectInputPadPlugin.Build.cs
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
namespace UnrealBuildTool.Rules
{
public class DirectInputPadPlugin : ModuleRules
{
public DirectInputPadPlugin(ReadOnlyTargetRules Target):base(Target)
{
PublicIncludePaths.AddRange(
new string[] {
"DirectInputPadPlugin/Public",
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
"DirectInputPadPlugin/Private",
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"ApplicationCore",
"Engine",
"InputDevice",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Slate",
"SlateCore",
"InputCore",
// ... add private dependencies that you statically link with here ...
}
);
if (Target.bBuildEditor)
{
PrivateDependencyModuleNames.AddRange(new string[]{ "MainFrame", });
}
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
}
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
namespace UnrealBuildTool.Rules
{
public class DirectInputPadPlugin : ModuleRules
{
public DirectInputPadPlugin(ReadOnlyTargetRules Target):base(Target)
{
PublicIncludePaths.AddRange(
new string[] {
"DirectInputPadPlugin/Public",
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
"DirectInputPadPlugin/Private",
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"ApplicationCore",
"Engine",
"InputDevice",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Slate",
"SlateCore",
"InputCore",
// ... add private dependencies that you statically link with here ...
}
);
if (UEBuildConfiguration.bBuildEditor)
{
PrivateDependencyModuleNames.AddRange(new string[]{ "MainFrame", });
}
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
}
|
mit
|
C#
|
775f114d7438799617c1faf57646eb569f82fe47
|
add ulong IsEven() and IsOdd() extensions
|
martinlindhe/Punku
|
punku/Extensions/ULongExtensions.cs
|
punku/Extensions/ULongExtensions.cs
|
using System;
using System.Text;
public static class ULongExtensions
{
/**
* @return the number of digits in n
*/
public static uint CountDigits (this ulong n, uint numberBase = 10)
{
uint cnt = 1;
while (n >= numberBase) {
cnt++;
n /= numberBase;
}
return cnt;
}
/**
* @return byte array of the separate digits in n (base 10)
*/
public static byte[] Digits (this ulong n, uint numberBase = 10)
{
// TODO this method should be in NaturalNumber class
int count = (int)n.CountDigits (numberBase);
byte[] digits = new byte[count];
for (int i = count - 1; i >= 0; i--) {
digits [i] = (byte)(n % numberBase);
n /= numberBase;
}
return digits;
}
/**
* @return string representation of n written in base digitBase
*/
public static string ToBase (this ulong n, uint numberBase)
{
string AlphaCodes = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
if (numberBase < 2 || numberBase > AlphaCodes.Length)
throw new ArgumentException ("digitBase");
var sb = new StringBuilder ();
while (n > 0) {
sb.Insert (0, AlphaCodes [(int)(n % numberBase)]);
n /= numberBase;
}
return sb.ToString ();
}
/**
* @return true if n is a repeating digit (eg 4444, 999999)
* http://en.wikipedia.org/wiki/Repdigit
*/
public static bool IsRepdigit (this ulong n, uint numberBase = 10)
{
var digits = n.Digits (numberBase);
if (digits.Length < 2)
return false;
byte last = 0;
foreach (var x in digits) {
if (last != 0 && x != last)
return false;
last = x;
}
return true;
}
/**
* A pandigital number is an integer that in a given base has among
* its significant digits each digit used in the base at least once.
* For example, 1223334444555567890 is a pandigital number in base 10.
*/
public static bool IsPandigitalNumber (this ulong n, uint numberBase = 10)
{
var digits = n.Digits (numberBase);
var found = new byte[numberBase];
foreach (var digit in digits)
found [digit] = 1;
foreach (var x in found) {
if (x == 0)
return false;
}
return true;
}
/**
* @return true if n is a prime
*/
public static bool IsPrime (this ulong n)
{
for (ulong j = 2; j < n; j++)
if (n % j == 0)
return false;
return true;
}
/**
* @return true if n is a even number
*/
public static bool IsEven (this ulong n)
{
if (n % 2 == 0)
return true;
return false;
}
/**
* @return true if n is a odd number
*/
public static bool IsOdd (this ulong n)
{
return !n.IsEven ();
}
}
|
using System;
using System.Text;
public static class ULongExtensions
{
/**
* @return the number of digits in n
*/
public static uint CountDigits (this ulong n, uint numberBase = 10)
{
uint cnt = 1;
while (n >= numberBase) {
cnt++;
n /= numberBase;
}
return cnt;
}
/**
* @return byte array of the separate digits in n (base 10)
*/
public static byte[] Digits (this ulong n, uint numberBase = 10)
{
int count = (int)n.CountDigits (numberBase);
byte[] digits = new byte[count];
for (int i = count - 1; i >= 0; i--) {
digits [i] = (byte)(n % numberBase);
n /= numberBase;
}
return digits;
}
/**
* @return string representation of n written in base digitBase
*/
public static string ToBase (this ulong n, uint numberBase)
{
string AlphaCodes = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
if (numberBase < 2 || numberBase > AlphaCodes.Length)
throw new ArgumentException ("digitBase");
var sb = new StringBuilder ();
while (n > 0) {
sb.Insert (0, AlphaCodes [(int)(n % numberBase)]);
n /= numberBase;
}
return sb.ToString ();
}
/**
* @return true if n is a repeating digit (eg 4444, 999999)
* http://en.wikipedia.org/wiki/Repdigit
*/
public static bool IsRepdigit (this ulong n, uint numberBase = 10)
{
var digits = n.Digits (numberBase);
if (digits.Length < 2)
return false;
byte last = 0;
foreach (var x in digits) {
if (last != 0 && x != last)
return false;
last = x;
}
return true;
}
/**
* A pandigital number is an integer that in a given base has among
* its significant digits each digit used in the base at least once.
* For example, 1223334444555567890 is a pandigital number in base 10.
*/
public static bool IsPandigitalNumber (this ulong n, uint numberBase = 10)
{
var digits = n.Digits (numberBase);
var found = new byte[numberBase];
foreach (var digit in digits)
found [digit] = 1;
foreach (var x in found) {
if (x == 0)
return false;
}
return true;
}
public static bool IsPrime (this ulong n)
{
for (ulong j = 2; j < n; j++)
if (n % j == 0)
return false;
return true;
}
}
|
mit
|
C#
|
97cafeb38f18c253c9cefd927d63991e06bf2153
|
Adjust version number to match DokanNet
|
viciousviper/dokan-dotnet,dokan-dev/dokan-dotnet,magol/dokan-dotnet,viciousviper/dokan-dotnet,dokan-dev/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,dokan-dev/dokan-dotnet,magol/dokan-dotnet,viciousviper/dokan-dotnet,magol/dokan-dotnet,TrabacchinLuigi/dokan-dotnet
|
DokanNet.Tests/Properties/AssemblyInfo.cs
|
DokanNet.Tests/Properties/AssemblyInfo.cs
|
using System;
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("DokanNet.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DokanNet.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// 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.8.0.0")]
[assembly: AssemblyFileVersion("0.8.0.0")]
[assembly: CLSCompliant(true)]
|
using System;
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("DokanNet.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DokanNet.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// 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: CLSCompliant(true)]
|
mit
|
C#
|
4f8d0b0e873bc71b5494b5e594c3553c1849b198
|
disable testdata
|
vip32/eventfeedback,vip32/eventfeedback,vip32/eventfeedback,vip32/eventfeedback
|
Domain/Migrations/Configuration.cs
|
Domain/Migrations/Configuration.cs
|
namespace EventFeedback.Domain.Migrations
{
using System.Data.Entity.Migrations;
internal sealed class Configuration : DbMigrationsConfiguration<DataContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(EventFeedback.Domain.DataContext context)
{
// TestData.Seed(context);
}
}
}
|
namespace EventFeedback.Domain.Migrations
{
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<EventFeedback.Domain.DataContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(EventFeedback.Domain.DataContext context)
{
// TestData.Seed(context);
// This method will be called after migrating to the latest version.
// You can use the DbSet<T>.AddOrUpdate() helper extension method
// to avoid creating duplicate seed data. E.g.
//
// context.People.AddOrUpdate(
// p => p.FullName,
// new Person { FullName = "Andrew Peters" },
// new Person { FullName = "Brice Lambson" },
// new Person { FullName = "Rowan Miller" }
// );
//
}
}
}
|
mit
|
C#
|
a398af5500d2ca05d2bef64385880cc4feceee89
|
test commit 2
|
Krzyrok/FsxWithGoogleMaps,Krzyrok/FsxWebApi
|
FsxWebApi/FsxWebApi/Program.cs
|
FsxWebApi/FsxWebApi/Program.cs
|
namespace FsxWebApi
{
using System.Web.Http.SelfHost;
class Program
{
static void Main(string[] args)
{
var configuration = new HttpSelfHostConfiguration("http://localhost:8080");
WebApiConfig.Register(configuration);
WebApiStarter.StartServer(configuration);
}
}
}
|
namespace FsxWebApi
{
using System.Web.Http.SelfHost;
class Program
{
static void Main(string[] args)
{
var configuration = new HttpSelfHostConfiguration("http://localhost:8080");
WebApiConfig.Register(configuration);
WebApiStarter.StartServer(configuration);
// git tests
}
}
}
|
mit
|
C#
|
0856933e27d4eccdca393f8b019b02b311fbc692
|
Add docs 2
|
yishn/GTPWrapper
|
GTPWrapper/Sgf/GoExtensions.cs
|
GTPWrapper/Sgf/GoExtensions.cs
|
using GTPWrapper.DataTypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GTPWrapper.Sgf {
/// <summary>
/// Provides SGF extension methods for the game of Go.
/// </summary>
public static class GoExtensions {
/// <summary>
/// Converts given vertex on given board into SGF coordinates.
/// </summary>
/// <param name="board">The board.</param>
/// <param name="vertex">The vertex.</param>
public static string VertexToSgf(this Board board, Vertex vertex) {
if (vertex == Vertex.Pass || !board.HasVertex(vertex)) return "";
return (Vertex.Letters[vertex.X - 1].ToString() + Vertex.Letters[board.Size - vertex.Y - 1].ToString()).ToLower();
}
/// <summary>
/// Converts given SGF coordinates on given board into a vertex.
/// </summary>
/// <param name="board">The board.</param>
/// <param name="sgfVertex">The SGF coordinates.</param>
public static Vertex SgfToVertex(this Board board, string sgfVertex) {
if (sgfVertex == "" || board.Size <= 19 && sgfVertex == "tt") return Vertex.Pass;
return new Vertex(
Vertex.Letters.IndexOf(sgfVertex[0].ToString().ToUpper()) + 1,
board.Size - Vertex.Letters.IndexOf(sgfVertex[1].ToString().ToUpper())
);
}
}
}
|
using GTPWrapper.DataTypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GTPWrapper.Sgf {
public static class GoExtensions {
/// <summary>
/// Converts given vertex on given board into SGF coordinates.
/// </summary>
/// <param name="board">The board.</param>
/// <param name="vertex">The vertex.</param>
public static string VertexToSgf(this Board board, Vertex vertex) {
if (vertex == Vertex.Pass || !board.HasVertex(vertex)) return "";
return (Vertex.Letters[vertex.X - 1].ToString() + Vertex.Letters[board.Size - vertex.Y - 1].ToString()).ToLower();
}
/// <summary>
/// Converts given SGF coordinates on given board into a vertex.
/// </summary>
/// <param name="board">The board.</param>
/// <param name="sgfVertex">The SGF coordinates.</param>
public static Vertex SgfToVertex(this Board board, string sgfVertex) {
if (sgfVertex == "" || board.Size <= 19 && sgfVertex == "tt") return Vertex.Pass;
return new Vertex(
Vertex.Letters.IndexOf(sgfVertex[0].ToString().ToUpper()) + 1,
board.Size - Vertex.Letters.IndexOf(sgfVertex[1].ToString().ToUpper())
);
}
}
}
|
mit
|
C#
|
02a1f503bc9bacb86f84e75956e1cd2b6ec4dcae
|
Increment version to 1.10.
|
mjvh80/jefferson
|
Jefferson.Core/Properties/AssemblyInfo.cs
|
Jefferson.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("Jefferson")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jefferson")]
[assembly: AssemblyCopyright("Copyright Marcus van Houdt © 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("75992e07-f7c6-4b16-9d62-b878632ab693")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.10.0")]
[assembly: AssemblyFileVersion("0.1.10.0")]
[assembly: InternalsVisibleTo("Jefferson.Tests")]
|
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("Jefferson")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jefferson")]
[assembly: AssemblyCopyright("Copyright Marcus van Houdt © 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("75992e07-f7c6-4b16-9d62-b878632ab693")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.9.0")]
[assembly: AssemblyFileVersion("0.1.9.0")]
[assembly: InternalsVisibleTo("Jefferson.Tests")]
|
apache-2.0
|
C#
|
5d9add07f289e7b6991e55fcb33b0a8b52a9f8bd
|
create checkers in ctor. Fixes #1
|
Olorin71/RetreatCode,Olorin71/RetreatCode
|
c#/TexasHoldEmSolution/TexasHoldEm/HandInvestigator.cs
|
c#/TexasHoldEmSolution/TexasHoldEm/HandInvestigator.cs
|
using System;
using System.Collections.Generic;
using TexasHoldEm.Interfaces;
namespace TexasHoldEm
{
internal class HandInvestigator : IHandInvestigator
{
private IList<CheckerBase> checkers = new List<CheckerBase>();
public HandInvestigator()
{
CreateCheckers();
}
public IBestPossibleHand LocateBestHand(IEnumerable<ICard> theHoleCards, IEnumerable<ICard> theCommunityCards)
{
IList<ICard> cards = CreateCardsList(theHoleCards, theCommunityCards);
CheckerData data = new CheckerData(cards);
IBestPossibleHand hand = null;
foreach (CheckerBase checker in checkers)
{
hand = checker.Check(data);
if (hand != null)
{
break; ;
}
}
return hand;
}
private void CreateCheckers()
{
// The checkers are added sorted by hand value, most valuable first.
checkers.Add(new RoyalAndStraightFlushChecker());
checkers.Add(new FourOfAKindChecker());
checkers.Add(new FullHouseChecker());
checkers.Add(new FlushChecker());
checkers.Add(new StraightChecker());
checkers.Add(new ThreeOfAKindChecker());
checkers.Add(new TwoPairsChecker());
checkers.Add(new PairChecker());
checkers.Add(new HighCardChecker());
}
private static IList<ICard> CreateCardsList(IEnumerable<ICard> theHoleCards, IEnumerable<ICard> theCommunityCards)
{
IList<ICard> cards = new List<ICard>();
foreach (ICard card in theHoleCards)
{
cards.Add(card);
}
foreach (ICard card in theCommunityCards)
{
cards.Add(card);
}
return cards;
}
}
}
|
using System;
using System.Collections.Generic;
using TexasHoldEm.Interfaces;
namespace TexasHoldEm
{
internal class HandInvestigator : IHandInvestigator
{
private IList<CheckerBase> checkers = new List<CheckerBase>();
public IBestPossibleHand LocateBestHand(IEnumerable<ICard> theHoleCards, IEnumerable<ICard> theCommunityCards)
{
IList<ICard> cards = CreateCardsList(theHoleCards, theCommunityCards);
CheckerData data = new CheckerData(cards);
CreateCheckers();
IBestPossibleHand hand = null;
foreach (CheckerBase checker in checkers)
{
hand = checker.Check(data);
if (hand != null)
{
break; ;
}
}
return hand;
}
private void CreateCheckers()
{
// The checkers are added sorted by hand value, most valuable first.
checkers.Add(new RoyalAndStraightFlushChecker());
checkers.Add(new FourOfAKindChecker());
checkers.Add(new FullHouseChecker());
checkers.Add(new FlushChecker());
checkers.Add(new StraightChecker());
checkers.Add(new ThreeOfAKindChecker());
checkers.Add(new TwoPairsChecker());
checkers.Add(new PairChecker());
checkers.Add(new HighCardChecker());
}
private static IList<ICard> CreateCardsList(IEnumerable<ICard> theHoleCards, IEnumerable<ICard> theCommunityCards)
{
IList<ICard> cards = new List<ICard>();
foreach (ICard card in theHoleCards)
{
cards.Add(card);
}
foreach (ICard card in theCommunityCards)
{
cards.Add(card);
}
return cards;
}
}
}
|
mit
|
C#
|
24c828176dd02d5bce88cbcfcc464a98c3642de1
|
Update Recipients.cs (#355)
|
brandonseydel/MailChimp.Net
|
MailChimp.Net/Models/Recipients.cs
|
MailChimp.Net/Models/Recipients.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Recipients.cs" company="Brandon Seydel">
// N/A
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using Newtonsoft.Json;
namespace MailChimp.Net.Models
{
/// <summary>
/// The recipient.
/// </summary>
public class Recipient
{
/// <summary>
/// Gets or sets the list id.
/// </summary>
[JsonProperty("list_id")]
public string ListId { get; set; }
/// <summary>
/// Gets or sets the segment text.
/// </summary>
[JsonProperty("segment_text")]
public string SegmentText { get; set; }
/// <summary>
/// Gets or sets the segment options.
/// </summary>
[JsonProperty("segment_opts")]
public SegmentOptions SegmentOptions { get; set; }
/// <summary>
/// Gets or sets the list name.
/// </summary>
[JsonProperty("list_name")]
public string ListName { get; set; }
/// <summary>
/// Gets or sets the list is active flag.
/// </summary>
[JsonProperty("list_is_active")]
public bool ListIsActive { get; set; }
/// <summary>
/// Gets or sets the recipient count.
/// </summary>
[JsonProperty("recipient_count")]
public int RecipientCount { get; set; }
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Recipients.cs" company="Brandon Seydel">
// N/A
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using Newtonsoft.Json;
namespace MailChimp.Net.Models
{
/// <summary>
/// The recipient.
/// </summary>
public class Recipient
{
/// <summary>
/// Gets or sets the list id.
/// </summary>
[JsonProperty("list_id")]
public string ListId { get; set; }
/// <summary>
/// Gets or sets the segment text.
/// </summary>
[JsonProperty("segment_text")]
public string SegmentText { get; set; }
/// <summary>
/// Gets or sets the segment options.
/// </summary>
[JsonProperty("segment_opts")]
public SegmentOptions SegmentOptions { get; set; }
}
}
|
mit
|
C#
|
5640385f480c6bdbca0ba1bbb0fc030c1a552c60
|
Update the length once during construction
|
smoogipoo/osu,NeoAdonis/osu,ppy/osu,DrabWeb/osu,naoey/osu,NeoAdonis/osu,johnneijzen/osu,EVAST9919/osu,smoogipoo/osu,naoey/osu,naoey/osu,ppy/osu,peppy/osu,ppy/osu,ZLima12/osu,2yangk23/osu,DrabWeb/osu,UselessToucan/osu,EVAST9919/osu,peppy/osu,smoogipoo/osu,smoogipooo/osu,ZLima12/osu,UselessToucan/osu,johnneijzen/osu,NeoAdonis/osu,2yangk23/osu,peppy/osu-new,UselessToucan/osu,peppy/osu,DrabWeb/osu
|
osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs
|
osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Audio.Track;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Beatmaps
{
public partial class WorkingBeatmap
{
/// <summary>
/// A type of <see cref="TrackVirtual"/> which provides a valid length based on the <see cref="HitObject"/>s of an <see cref="IBeatmap"/>.
/// </summary>
private class VirtualBeatmapTrack : TrackVirtual
{
private readonly IBeatmap beatmap;
public VirtualBeatmapTrack(IBeatmap beatmap)
{
this.beatmap = beatmap;
updateVirtualLength();
}
protected override void UpdateState()
{
updateVirtualLength();
base.UpdateState();
}
private void updateVirtualLength()
{
var lastObject = beatmap.HitObjects.LastOrDefault();
switch (lastObject)
{
case null:
Length = 1000;
break;
case IHasEndTime endTime:
Length = endTime.EndTime + 1000;
break;
default:
Length = lastObject.StartTime + 1000;
break;
}
}
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Audio.Track;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Beatmaps
{
public partial class WorkingBeatmap
{
private class VirtualBeatmapTrack : TrackVirtual
{
private readonly IBeatmap beatmap;
public VirtualBeatmapTrack(IBeatmap beatmap)
{
this.beatmap = beatmap;
}
protected override void UpdateState()
{
updateVirtualLength();
base.UpdateState();
}
private void updateVirtualLength()
{
var lastObject = beatmap.HitObjects.LastOrDefault();
switch (lastObject)
{
case null:
Length = 1000;
break;
case IHasEndTime endTime:
Length = endTime.EndTime + 1000;
break;
default:
Length = lastObject.StartTime + 1000;
break;
}
}
}
}
}
|
mit
|
C#
|
3f60d2da5da5e351ee17dc129c34c0dc1036ae04
|
Revert CrytoConfiguration to using Credential implementation
|
RockFramework/Rock.Encryption
|
Rock.Encryption/Symmetric/CryptoConfiguration.cs
|
Rock.Encryption/Symmetric/CryptoConfiguration.cs
|
using System.Collections.Generic;
namespace RockLib.Encryption.Symmetric
{
/// <summary>
/// Defines an xml-serializable object that contains the information needed to configure an
/// instance of <see cref="SymmetricCrypto"/>.
/// </summary>
public class CryptoConfiguration
{
/// <summary>
/// Gets the collection of credentials that will be available for encryption or
/// decryption operations.
/// </summary>
public List<Credential> Credentials { get; set; } = new List<Credential>();
}
}
|
using System.Collections.Generic;
namespace RockLib.Encryption.Symmetric
{
/// <summary>
/// Defines an xml-serializable object that contains the information needed to configure an
/// instance of <see cref="SymmetricCrypto"/>.
/// </summary>
public class CryptoConfiguration
{
/// <summary>
/// Gets the collection of credentials that will be available for encryption or
/// decryption operations.
/// </summary>
public List<ICredential> Credentials { get; set; } = new List<ICredential>();
}
}
|
mit
|
C#
|
ddc983e1018ddf3b5e83ca259aadb59dc3955832
|
Fix model key frame in raw project
|
paralleltree/Scallion
|
Scallion/Raw/Components/Project/ModelKeyFrame.cs
|
Scallion/Raw/Components/Project/ModelKeyFrame.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Scallion.Core;
using Scallion.Internal;
namespace Scallion.Raw.Components.Project
{
internal class ModelKeyFrame : LinkableKeyFrame<ModelState>
{
public int IKBonesCount { get; set; }
public int ExternalParentBonesCount { get; set; }
internal override void SerializeKeyFrameValue(MoSerializer archive)
{
archive.Serialize(Value);
}
internal override void DeserializeKeyFrameValue(MoDeserializer archive)
{
Value = archive.Deserialize(new ModelState()
{
IKBonesCount = IKBonesCount,
ExternalParentBonesCount = ExternalParentBonesCount
});
}
}
internal class ModelState : MMDObject
{
public int IKBonesCount { get; set; }
public int ExternalParentBonesCount { get; set; }
public List<bool> IKEnabled { get; set; }
public List<BoneReference> ExternalParentBoneStatuses { get; set; }
public bool IsVisible { get; set; }
public override void Serialize(MoSerializer archive)
{
archive.WriteByte((byte)(IsVisible ? 1 : 0));
foreach (bool status in IKEnabled)
archive.WriteByte((byte)(status ? 1 : 0));
foreach (var item in ExternalParentBoneStatuses)
new BoneReferenceWrapper(item).Serialize(archive);
}
public override void Deserialize(MoDeserializer archive)
{
IsVisible = archive.ReadByte() == 1;
IKEnabled = archive.DeserializeList(IKBonesCount, () => archive.ReadByte() == 1);
ExternalParentBoneStatuses = archive.DeserializeList(ExternalParentBonesCount, () => new BoneReference(archive.ReadInt32(), archive.ReadInt32()));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Scallion.Core;
using Scallion.Internal;
namespace Scallion.Raw.Components.Project
{
internal class ModelKeyFrame : LinkableKeyFrame<ModelState>
{
public int IKBonesCount { get; set; }
public int ExternalParentBonesCount { get; set; }
public bool IsVisible { get; set; }
internal override void SerializeKeyFrameValue(MoSerializer archive)
{
archive.WriteByte((byte)(IsVisible ? 1 : 0));
archive.Serialize(Value);
}
internal override void DeserializeKeyFrameValue(MoDeserializer archive)
{
IsVisible = archive.ReadByte() == 1;
Value = archive.Deserialize(new ModelState()
{
IKBonesCount = IKBonesCount,
ExternalParentBonesCount = ExternalParentBonesCount
});
}
}
internal class ModelState : MMDObject
{
public int IKBonesCount { get; set; }
public int ExternalParentBonesCount { get; set; }
public List<bool> IKEnabled { get; set; }
public List<BoneReference> ExternalParentBoneStatuses { get; set; }
public override void Serialize(MoSerializer archive)
{
foreach (bool status in IKEnabled)
archive.WriteByte((byte)(status ? 1 : 0));
foreach (var item in ExternalParentBoneStatuses)
new BoneReferenceWrapper(item).Serialize(archive);
}
public override void Deserialize(MoDeserializer archive)
{
IKEnabled = archive.DeserializeList(IKBonesCount, () => archive.ReadByte() == 1);
ExternalParentBoneStatuses = archive.DeserializeList(ExternalParentBonesCount, () => new BoneReference(archive.ReadInt32(), archive.ReadInt32()));
}
}
}
|
mit
|
C#
|
99307423e0f1ae7a51d63b340c7253a0bfe939f2
|
fix line endings ind status
|
coolya/logv.http
|
SimpleHttpServerExtensions/ResponseExtensions.cs
|
SimpleHttpServerExtensions/ResponseExtensions.cs
|
/*
Copyright 2012 Kolja Dummann <k.dummann@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SimpleHttpServer;
namespace SimpleHttpServer
{
public static class ResponseExtensions
{
public static ServerResponse WriteAsJson(this ServerResponse res, object obj)
{
res.Write(HtmlHelper.GetJson(obj));
return res;
}
public static ServerResponse Do503(this ServerResponse res, Exception ex)
{
res.StatusCode = 503;
res.StatusDescription = ex.Message.Length < 513 ? ex.Message.Replace("\r\n", "") : string.Empty;
return res;
}
public static ServerResponse Do503(this ServerResponse res)
{
res.StatusCode = 503;
return res;
}
}
}
|
/*
Copyright 2012 Kolja Dummann <k.dummann@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SimpleHttpServer;
namespace SimpleHttpServer
{
public static class ResponseExtensions
{
public static ServerResponse WriteAsJson(this ServerResponse res, object obj)
{
res.Write(HtmlHelper.GetJson(obj));
return res;
}
public static ServerResponse Do503(this ServerResponse res, Exception ex)
{
res.StatusCode = 503;
res.StatusDescription = ex.Message.Length < 513 ? ex.Message : string.Empty;
return res;
}
public static ServerResponse Do503(this ServerResponse res)
{
res.StatusCode = 503;
return res;
}
}
}
|
apache-2.0
|
C#
|
9ded2b1d01705d87ae805b90a520ac18c9fa742f
|
Add frame counter to give DrawVis a bit more activity.
|
ZLima12/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,naoey/osu-framework,peppy/osu-framework,default0/osu-framework,paparony03/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,paparony03/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,NeoAdonis/osu-framework,default0/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,RedNesto/osu-framework,NeoAdonis/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework,RedNesto/osu-framework,naoey/osu-framework
|
osu.Framework.VisualTests/VisualTestGame.cs
|
osu.Framework.VisualTests/VisualTestGame.cs
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Framework.VisualTests
{
class VisualTestGame : Game
{
public override void Load()
{
base.Load();
Host.Size = new Vector2(1366, 768);
SampleGame test = new SampleGame();
DrawVisualiser drawVis;
Add(test);
Add(drawVis = new DrawVisualiser(test));
Add(new CursorContainer());
}
class SampleGame : LargeContainer
{
SpriteText text;
int num = 0;
public override void Load()
{
base.Load();
Box box;
Add(box = new Box()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(150, 150),
Colour = Color4.Tomato
});
Add(text = new SpriteText()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
box.RotateTo(360 * 10, 60000);
}
protected override void Update()
{
base.Update();
text.Text = $@"frame count: {num++}";
}
}
}
}
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Framework.VisualTests
{
class VisualTestGame : Game
{
public override void Load()
{
base.Load();
Host.Size = new Vector2(1366, 768);
SampleGame test = new SampleGame();
DrawVisualiser drawVis;
Add(test);
Add(drawVis = new DrawVisualiser(test));
Add(new CursorContainer());
}
class SampleGame : LargeContainer
{
SpriteText text;
int num = 0;
public override void Load()
{
base.Load();
Box box;
Add(box = new Box()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(150, 150),
Colour = Color4.Tomato
});
Add(text = new SpriteText());
box.RotateTo(360 * 10, 60000);
}
protected override void Update()
{
text.Text = (num++).ToString();
base.Update();
}
}
}
}
|
mit
|
C#
|
da8565c0fa653c7b8dee30ec71d8a51d0cdf97f1
|
Add 10K mod to incompatibility list
|
smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu
|
osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs
|
osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.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.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Mania.Mods
{
public abstract class ManiaKeyMod : Mod, IApplicableToBeatmapConverter
{
public override string Acronym => Name;
public abstract int KeyCount { get; }
public override ModType Type => ModType.Conversion;
public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier
public override bool Ranked => true;
public void ApplyToBeatmapConverter(IBeatmapConverter beatmapConverter)
{
var mbc = (ManiaBeatmapConverter)beatmapConverter;
// Although this can work, for now let's not allow keymods for mania-specific beatmaps
if (mbc.IsForCurrentRuleset)
return;
mbc.TargetColumns = KeyCount;
}
public override Type[] IncompatibleMods => new[]
{
typeof(ManiaModKey1),
typeof(ManiaModKey2),
typeof(ManiaModKey3),
typeof(ManiaModKey4),
typeof(ManiaModKey5),
typeof(ManiaModKey6),
typeof(ManiaModKey7),
typeof(ManiaModKey8),
typeof(ManiaModKey9),
typeof(ManiaModKey10),
}.Except(new[] { GetType() }).ToArray();
}
}
|
// 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.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Mania.Mods
{
public abstract class ManiaKeyMod : Mod, IApplicableToBeatmapConverter
{
public override string Acronym => Name;
public abstract int KeyCount { get; }
public override ModType Type => ModType.Conversion;
public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier
public override bool Ranked => true;
public void ApplyToBeatmapConverter(IBeatmapConverter beatmapConverter)
{
var mbc = (ManiaBeatmapConverter)beatmapConverter;
// Although this can work, for now let's not allow keymods for mania-specific beatmaps
if (mbc.IsForCurrentRuleset)
return;
mbc.TargetColumns = KeyCount;
}
public override Type[] IncompatibleMods => new[]
{
typeof(ManiaModKey1),
typeof(ManiaModKey2),
typeof(ManiaModKey3),
typeof(ManiaModKey4),
typeof(ManiaModKey5),
typeof(ManiaModKey6),
typeof(ManiaModKey7),
typeof(ManiaModKey8),
typeof(ManiaModKey9),
}.Except(new[] { GetType() }).ToArray();
}
}
|
mit
|
C#
|
3b84ce7c9f4317cf4a3f3d4e8011385579d6ec1f
|
Remove redundant test step
|
UselessToucan/osu,ppy/osu,smoogipoo/osu,johnneijzen/osu,ZLima12/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,EVAST9919/osu,smoogipoo/osu,ZLima12/osu,naoey/osu,NeoAdonis/osu,peppy/osu,EVAST9919/osu,DrabWeb/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,peppy/osu,DrabWeb/osu,johnneijzen/osu,2yangk23/osu,peppy/osu-new,naoey/osu,2yangk23/osu,smoogipooo/osu,naoey/osu,DrabWeb/osu
|
osu.Game.Tests/Visual/TestCaseHoldToQuit.cs
|
osu.Game.Tests/Visual/TestCaseHoldToQuit.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Play.HUD;
namespace osu.Game.Tests.Visual
{
[Description("'Hold to Quit' UI element")]
public class TestCaseHoldToQuit : OsuTestCase
{
private bool exitAction;
public TestCaseHoldToQuit()
{
HoldToQuit holdToQuit;
Add(holdToQuit = new HoldToQuit
{
Origin = Anchor.BottomRight,
Anchor = Anchor.BottomRight,
});
holdToQuit.Button.ExitAction = () => exitAction = true;
var text = holdToQuit.Children.OfType<SpriteText>().Single();
AddStep("Trigger text fade in/out", () =>
{
exitAction = false;
holdToQuit.Button.TriggerOnMouseDown();
holdToQuit.Button.TriggerOnMouseUp();
});
AddUntilStep(() => text.IsPresent && !exitAction, "Text visible");
AddUntilStep(() => !text.IsPresent && !exitAction, "Text is not visible");
AddStep("Trigger exit action", () =>
{
exitAction = false;
holdToQuit.Button.TriggerOnMouseDown();
});
AddUntilStep(() => exitAction, $"{nameof(holdToQuit.Button.ExitAction)} was triggered");
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Play.HUD;
namespace osu.Game.Tests.Visual
{
[Description("'Hold to Quit' UI element")]
public class TestCaseHoldToQuit : OsuTestCase
{
private bool exitAction;
public TestCaseHoldToQuit()
{
HoldToQuit holdToQuit;
Add(holdToQuit = new HoldToQuit
{
Origin = Anchor.BottomRight,
Anchor = Anchor.BottomRight,
});
holdToQuit.Button.ExitAction = () => exitAction = true;
var text = holdToQuit.Children.OfType<SpriteText>().Single();
AddStep("Text fade in", () =>
{
exitAction = false;
holdToQuit.Button.TriggerOnMouseDown();
holdToQuit.Button.TriggerOnMouseUp();
});
AddUntilStep(() => text.IsPresent && !exitAction, "Text visible");
AddStep("Text fade out", () =>
{
exitAction = false;
holdToQuit.Button.TriggerOnMouseDown();
holdToQuit.Button.TriggerOnMouseUp();
});
AddUntilStep(() => !text.IsPresent && !exitAction, "Text is not visible");
AddStep("Trigger exit action", () =>
{
exitAction = false;
holdToQuit.Button.TriggerOnMouseDown();
});
AddUntilStep(() => exitAction, $"{nameof(holdToQuit.Button.ExitAction)} was triggered");
}
}
}
|
mit
|
C#
|
15ee1db58584e2fd67541b51082a20f325f7b1c2
|
Test commit
|
RapidScada/scada,RapidScada/scada,RapidScada/scada,RapidScada/scada
|
ScadaScheme/ScadaSchemeEditor/FrmAbout.cs
|
ScadaScheme/ScadaSchemeEditor/FrmAbout.cs
|
/*
* Copyright 2014 Mikhail Shiryaev
*
* 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.
*
*
* Product : Rapid SCADA
* Module : SCADA-Scheme Editor
* Summary : About form
*
* Author : Mikhail Shiryaev
* Created : 2013
* Modified : 2014_
*/
using System;
using System.Windows.Forms;
namespace Scada.Scheme.Editor
{
/// <summary>
/// About form
/// <para>Форма о программе</para>
/// </summary>
public partial class FrmAbout : Form
{
public FrmAbout()
{
InitializeComponent();
}
private void FrmAbout_Load(object sender, EventArgs e)
{
pictureBox.Visible = Localization.UseRussian;
pictureBoxEn.Visible = !Localization.UseRussian;
}
private void FrmAbout_Click(object sender, EventArgs e)
{
Close();
}
private void FrmAbout_KeyPress(object sender, KeyPressEventArgs e)
{
Close();
}
}
}
|
/*
* Copyright 2014 Mikhail Shiryaev
*
* 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.
*
*
* Product : Rapid SCADA
* Module : SCADA-Scheme Editor
* Summary : About form
*
* Author : Mikhail Shiryaev
* Created : 2013
* Modified : 2014
*/
using System;
using System.Windows.Forms;
namespace Scada.Scheme.Editor
{
/// <summary>
/// About form
/// <para>Форма о программе</para>
/// </summary>
public partial class FrmAbout : Form
{
public FrmAbout()
{
InitializeComponent();
}
private void FrmAbout_Load(object sender, EventArgs e)
{
pictureBox.Visible = Localization.UseRussian;
pictureBoxEn.Visible = !Localization.UseRussian;
}
private void FrmAbout_Click(object sender, EventArgs e)
{
Close();
}
private void FrmAbout_KeyPress(object sender, KeyPressEventArgs e)
{
Close();
}
}
}
|
apache-2.0
|
C#
|
94971f92cd5e3bf2dbc7cc2e7a0f24438ef214fe
|
Prepare 0.4.0
|
bitbeans/SimpleDnsCrypt,robin98/SimpleDnsCrypt,jerryhou85/SimpleDnsCrypt
|
SimpleDnsCrypt/Properties/AssemblyInfo.cs
|
SimpleDnsCrypt/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Simple DnsCrypt")]
[assembly: AssemblyDescription("Simple management tool for dnscrypt-proxy")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Simple DNSCrypt")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2017 Christian Hermann")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: AssemblyVersion("0.4.0")]
[assembly: AssemblyFileVersion("0.4.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Simple DnsCrypt")]
[assembly: AssemblyDescription("Simple management tool for dnscrypt-proxy")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Simple DNSCrypt")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2017 Christian Hermann")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: AssemblyVersion("0.3.9")]
[assembly: AssemblyFileVersion("0.3.9")]
|
mit
|
C#
|
1d22952cd83a098f05d0b611941ad506cd7ea3d8
|
Prepare 0.2.9
|
jerryhou85/SimpleDnsCrypt,bitbeans/SimpleDnsCrypt,robin98/SimpleDnsCrypt
|
SimpleDnsCrypt/Properties/AssemblyInfo.cs
|
SimpleDnsCrypt/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Simple DnsCrypt")]
[assembly: AssemblyDescription("Simple management tool for dnscrypt-proxy")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Simple DNSCrypt")]
[assembly: AssemblyCopyright("Copyright © 2015 Christian Hermann")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: AssemblyVersion("0.2.9")]
[assembly: AssemblyFileVersion("0.2.9")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Simple DnsCrypt")]
[assembly: AssemblyDescription("Simple management tool for dnscrypt-proxy")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Simple DNSCrypt")]
[assembly: AssemblyCopyright("Copyright © 2015 Christian Hermann")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: AssemblyVersion("0.2.8")]
[assembly: AssemblyFileVersion("0.2.8")]
|
mit
|
C#
|
5169c82bd982d776e5aa7b4ac63b8fd1bb27f1cd
|
Implement OxideApi.Authenticate
|
Skippeh/Oxide.Ext.ServerManager
|
Oxide.PluginWebApi/Net/OxideApi.cs
|
Oxide.PluginWebApi/Net/OxideApi.cs
|
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using HtmlAgilityPack;
namespace Oxide.PluginWebApi.Net
{
public class OxideApi : IDisposable
{
private static readonly CookieContainer cookieContainer = new CookieContainer();
private readonly CookieWebClient webClient;
public static bool Authenticate(string username, string password)
{
using (var webClient = new CookieWebClient(cookieContainer))
{
byte[] responseBytes = webClient.UploadValues("http://oxidemod.org/login/login", "POST", new NameValueCollection
{
{ "login", username },
{ "password", password }
});
string response = Encoding.UTF8.GetString(responseBytes);
var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(response);
var rootNode = htmlDoc.DocumentNode;
var content = rootNode.SelectSingleNode("//*[@id=\"content\"]");
if (content.GetAttributeValue("class", "").Contains("error_with_login"))
{
return false;
}
return true;
}
}
public OxideApi()
{
webClient = new CookieWebClient(cookieContainer);
}
public void Dispose()
{
webClient.Dispose();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace Oxide.PluginWebApi.Net
{
public class OxideApi : IDisposable
{
private static readonly CookieContainer cookieContainer = new CookieContainer();
private readonly CookieWebClient webClient;
public static bool Authenticate(string username, string password)
{
return false;
}
public OxideApi()
{
webClient = new CookieWebClient(cookieContainer);
}
public void Dispose()
{
webClient.Dispose();
}
}
}
|
mit
|
C#
|
3d9c3e7a26ee13b8464f5d6871de134d67939ac6
|
Revert "Fix issue with API header binding when running under a subdirectory"
|
projectkudu/SiteExtensionGallery,skbkontur/NuGetGallery,grenade/NuGetGallery_download-count-patch,mtian/SiteExtensionGallery,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,KuduApps/NuGetGallery,KuduApps/NuGetGallery,ScottShingler/NuGetGallery,mtian/SiteExtensionGallery,projectkudu/SiteExtensionGallery,KuduApps/NuGetGallery,ScottShingler/NuGetGallery,KuduApps/NuGetGallery,grenade/NuGetGallery_download-count-patch,JetBrains/ReSharperGallery,KuduApps/NuGetGallery,skbkontur/NuGetGallery,mtian/SiteExtensionGallery,projectkudu/SiteExtensionGallery,skbkontur/NuGetGallery,JetBrains/ReSharperGallery,JetBrains/ReSharperGallery
|
Website/Infrastructure/HttpHeaderValueProviderFactory.cs
|
Website/Infrastructure/HttpHeaderValueProviderFactory.cs
|
using System;
using System.Web.Mvc;
namespace NuGetGallery
{
public class HttpHeaderValueProviderFactory : ValueProviderFactory
{
public override IValueProvider GetValueProvider(ControllerContext controllerContext)
{
var request = controllerContext.RequestContext.HttpContext.Request;
// Use this value provider only if a route is located under "API"
if (request.Path.TrimStart('/').StartsWith("api", StringComparison.OrdinalIgnoreCase))
return new HttpHeaderValueProvider(request, "ApiKey");
return null;
}
}
}
|
using System;
using System.Web.Mvc;
namespace NuGetGallery
{
public class HttpHeaderValueProviderFactory : ValueProviderFactory
{
public override IValueProvider GetValueProvider(ControllerContext controllerContext)
{
var request = controllerContext.RequestContext.HttpContext.Request;
// Use this value provider only if a route is located under "API"
if (request.Path.Contains("/api/"))
return new HttpHeaderValueProvider(request, "ApiKey");
return null;
}
}
}
|
apache-2.0
|
C#
|
42c68744bc1562783ae471ddb905327eff30c074
|
Allow the vibration only on Mobile
|
FabienLavocat/kodi-remote
|
src/KodiRemote.Uwp/Core/Helpers.cs
|
src/KodiRemote.Uwp/Core/Helpers.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Phone.Devices.Notification;
using Windows.System.Profile;
using Windows.UI.Xaml.Media;
namespace KodiRemote.Uwp.Core
{
internal static class Helpers
{
//public static async Task<ImageBrush> LoadBackground(string url)
//{
// if (string.IsNullOrWhiteSpace(url)) return null;
// var imageUrl = await LoadImageUrl(url);
// return new ImageBrush
// {
// ImageSource = (ImageSource)new ImageSourceConverter().ConvertFromString(imageUrl),
// Opacity = .7
// };
//}
public static async Task<string> LoadImageUrl(string image)
{
if (App.Context.Connection.Kodi.IsMocked)
return image;
try
{
var download = await App.Context.Connection.Kodi.Files.PrepareDownloadAsync(image);
return App.Context.Connection.Kodi.GetFileUrl(download.Details.Path);
}
catch
{
return "";
}
}
public static string Combine(string[] values)
{
if (values == null || !values.Any()) return string.Empty;
var result = values.Aggregate("", (current, v) => string.Concat(current, v, " / "));
return result.Substring(0, result.Length - 3);
}
public static void Vibrate()
{
if (!App.Context.AllowVibrate) return;
if ("Windows.Mobile".Equals(AnalyticsInfo.VersionInfo.DeviceFamily, StringComparison.OrdinalIgnoreCase))
{
VibrationDevice v = VibrationDevice.GetDefault();
v.Vibrate(TimeSpan.FromMilliseconds(50));
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Phone.Devices.Notification;
using Windows.UI.Xaml.Media;
namespace KodiRemote.Uwp.Core
{
internal static class Helpers
{
//public static async Task<ImageBrush> LoadBackground(string url)
//{
// if (string.IsNullOrWhiteSpace(url)) return null;
// var imageUrl = await LoadImageUrl(url);
// return new ImageBrush
// {
// ImageSource = (ImageSource)new ImageSourceConverter().ConvertFromString(imageUrl),
// Opacity = .7
// };
//}
public static async Task<string> LoadImageUrl(string image)
{
if (App.Context.Connection.Kodi.IsMocked)
return image;
try
{
var download = await App.Context.Connection.Kodi.Files.PrepareDownloadAsync(image);
return App.Context.Connection.Kodi.GetFileUrl(download.Details.Path);
}
catch
{
return "";
}
}
public static string Combine(string[] values)
{
if (values == null || !values.Any()) return string.Empty;
var result = values.Aggregate("", (current, v) => string.Concat(current, v, " / "));
return result.Substring(0, result.Length - 3);
}
public static void Vibrate()
{
if (!App.Context.AllowVibrate) return;
VibrationDevice v = VibrationDevice.GetDefault();
v.Vibrate(TimeSpan.FromMilliseconds(50));
}
}
}
|
mit
|
C#
|
76d32b1b731041e5322bfe84545077d3d763bdca
|
Fix whitespace
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Fluent/ViewModels/AboutViewModel.cs
|
WalletWasabi.Fluent/ViewModels/AboutViewModel.cs
|
using System;
using System.IO;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Windows.Input;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
namespace WalletWasabi.Fluent.ViewModels
{
[NavigationMetaData(
Searchable = true,
Title = "About Wasabi",
Caption = "Displays all the current info about the app",
IconName = "info_regular",
Order = 4,
Category = "General",
Keywords = new [] { "About", "Software","Version", "Source", "Code", "Github", "Status", "Stats", "Tor", "Onion", "Bug", "Report", "FAQ", "Questions,", "Docs", "Documentation", "Link", "Links", "Help" },
NavBarPosition = NavBarPosition.None)]
public partial class AboutViewModel : RoutableViewModel
{
public AboutViewModel()
{
OpenBrowserCommand = ReactiveCommand.CreateFromTask<string>(IoHelpers.OpenBrowserAsync);
var interaction = new Interaction<Unit, Unit>();
interaction.RegisterHandler(
async x =>
x.SetOutput(await new AboutAdvancedInfoViewModel().ShowDialogAsync()));
AboutAdvancedInfoDialogCommand = ReactiveCommand.CreateFromTask(
execute: async () => await interaction.Handle(Unit.Default).ToTask());
OpenBrowserCommand.ThrownExceptions
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(ex => Logger.LogError(ex));
}
public override NavigationTarget DefaultTarget => NavigationTarget.DialogScreen;
public ICommand AboutAdvancedInfoDialogCommand { get; }
public ReactiveCommand<string, Unit> OpenBrowserCommand { get; }
public Version ClientVersion => Constants.ClientVersion;
public string ClearnetLink => "https://wasabiwallet.io/";
public string TorLink => "http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion";
public string SourceCodeLink => "https://github.com/zkSNACKs/WalletWasabi/";
public string StatusPageLink => "https://stats.uptimerobot.com/YQqGyUL8A7";
public string UserSupportLink => "https://www.reddit.com/r/WasabiWallet/";
public string BugReportLink => "https://github.com/zkSNACKs/WalletWasabi/issues/";
public string FAQLink => "https://docs.wasabiwallet.io/FAQ/";
public string DocsLink => "https://docs.wasabiwallet.io/";
public string License => "https://github.com/zkSNACKs/WalletWasabi/blob/master/LICENSE.md";
}
}
|
using System;
using System.IO;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Windows.Input;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
namespace WalletWasabi.Fluent.ViewModels
{
[NavigationMetaData(
Searchable = true,
Title = "About Wasabi",
Caption = "Displays all the current info about the app",
IconName = "info_regular",
Order = 4,
Category = "General",
Keywords = new [] { "About", "Software","Version", "Source", "Code", "Github", "Status", "Stats", "Tor", "Onion", "Bug", "Report", "FAQ","Questions,", "Docs","Documentation", "Link", "Links"," Help" },
NavBarPosition = NavBarPosition.None)]
public partial class AboutViewModel : RoutableViewModel
{
public AboutViewModel()
{
OpenBrowserCommand = ReactiveCommand.CreateFromTask<string>(IoHelpers.OpenBrowserAsync);
var interaction = new Interaction<Unit, Unit>();
interaction.RegisterHandler(
async x =>
x.SetOutput(await new AboutAdvancedInfoViewModel().ShowDialogAsync()));
AboutAdvancedInfoDialogCommand = ReactiveCommand.CreateFromTask(
execute: async () => await interaction.Handle(Unit.Default).ToTask());
OpenBrowserCommand.ThrownExceptions
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(ex => Logger.LogError(ex));
}
public override NavigationTarget DefaultTarget => NavigationTarget.DialogScreen;
public ICommand AboutAdvancedInfoDialogCommand { get; }
public ReactiveCommand<string, Unit> OpenBrowserCommand { get; }
public Version ClientVersion => Constants.ClientVersion;
public string ClearnetLink => "https://wasabiwallet.io/";
public string TorLink => "http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion";
public string SourceCodeLink => "https://github.com/zkSNACKs/WalletWasabi/";
public string StatusPageLink => "https://stats.uptimerobot.com/YQqGyUL8A7";
public string UserSupportLink => "https://www.reddit.com/r/WasabiWallet/";
public string BugReportLink => "https://github.com/zkSNACKs/WalletWasabi/issues/";
public string FAQLink => "https://docs.wasabiwallet.io/FAQ/";
public string DocsLink => "https://docs.wasabiwallet.io/";
public string License => "https://github.com/zkSNACKs/WalletWasabi/blob/master/LICENSE.md";
}
}
|
mit
|
C#
|
f5b46505cf9dabc136210b21051721419d88a209
|
Update version.
|
DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS
|
DanTup.DartAnalysis/Properties/AssemblyInfo.cs
|
DanTup.DartAnalysis/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("DartAnalysis.NET: A .NET wrapper around Google's Analysis Server for Dart.")]
[assembly: AssemblyProduct("DartAnalysis.NET: A .NET wrapper around Google's Analysis Server for Dart.")]
[assembly: AssemblyCompany("Danny Tuppeny")]
[assembly: AssemblyCopyright("Copyright Danny Tuppeny © 2014")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyInformationalVersion("0.1.7-alpha")]
[assembly: InternalsVisibleTo("DanTup.DartAnalysis.Tests")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("DartAnalysis.NET: A .NET wrapper around Google's Analysis Server for Dart.")]
[assembly: AssemblyProduct("DartAnalysis.NET: A .NET wrapper around Google's Analysis Server for Dart.")]
[assembly: AssemblyCompany("Danny Tuppeny")]
[assembly: AssemblyCopyright("Copyright Danny Tuppeny © 2014")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyInformationalVersion("0.1.6-alpha")]
[assembly: InternalsVisibleTo("DanTup.DartAnalysis.Tests")]
|
mit
|
C#
|
2351a0d1ca86e8a4b7cb7df78dacd2cf248fb3e4
|
Fix crash in ChatModeCalculatorService and refactor
|
ethanmoffat/EndlessClient
|
EOLib/Domain/Chat/ChatModeCalculatorService.cs
|
EOLib/Domain/Chat/ChatModeCalculatorService.cs
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using System;
namespace EOLib.Domain.Chat
{
public class ChatModeCalculatorService : IChatModeCalculatorService
{
public ChatMode CalculateChatType(string fullTextString, bool playerIsAdmin, bool playerIsInGuild)
{
if(fullTextString == null)
throw new ArgumentException("Input string is null!", "fullTextString");
if (fullTextString.Length == 0)
return ChatMode.NoText;
if (((fullTextString[0] == '@' || fullTextString[0] == '+') && !playerIsAdmin) ||
(fullTextString[0] == '&' && !playerIsInGuild))
return ChatMode.Public;
switch (fullTextString[0])
{
case '!': return ChatMode.Private;
case '@':
case '~': return ChatMode.Global;
case '+': return ChatMode.Admin;
case '\'': return ChatMode.Group;
case '&': return ChatMode.Guild;
default: return ChatMode.Public;
}
}
}
}
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using System;
namespace EOLib.Domain.Chat
{
public class ChatModeCalculatorService : IChatModeCalculatorService
{
public ChatMode CalculateChatType(string fullTextString, bool playerIsAdmin, bool playerIsInGuild)
{
if(string.IsNullOrEmpty(fullTextString))
throw new ArgumentException("Input string is null or empty!", "fullTextString");
if ((fullTextString[0] == '@' || fullTextString[0] == '+') && !playerIsAdmin)
return ChatMode.Public;
if (fullTextString[0] == '&' && !playerIsInGuild)
return ChatMode.Public;
switch (fullTextString[0])
{
case '!': return ChatMode.Private;
case '@': return ChatMode.Global;
case '~': return ChatMode.Global;
case '+': return ChatMode.Admin;
case '\'': return ChatMode.Group;
case '&': return ChatMode.Guild;
default: return ChatMode.Public;
}
}
}
}
|
mit
|
C#
|
ff82b2a76ac878c58b2d377c20b2c2cc5281052e
|
fix selection rendering issue when anchor was above caret and anchor column larger than caret column
|
Unity-Technologies/CodeEditor,Unity-Technologies/CodeEditor
|
src/CodeEditor.Text.UI/Selection.cs
|
src/CodeEditor.Text.UI/Selection.cs
|
using System;
namespace CodeEditor.Text.UI
{
public class Selection
{
public Position Anchor {get; set;}
readonly ICaret _caret;
public Selection (ICaret caret)
{
_caret = caret;
Clear ();
}
public Position BeginDrawPos
{
get
{
int column;
if (Anchor.Row == Caret.Row)
column = Math.Min(Anchor.Column, Caret.Column);
else if (Anchor.Row < Caret.Row)
column = Anchor.Column;
else
column = Caret.Column;
return new Position (
Anchor.Row < Caret.Row ? Anchor.Row : Caret.Row,
column
);
}
}
public Position EndDrawPos
{
get
{
int column;
if (Anchor.Row == Caret.Row)
column = Math.Max(Anchor.Column, Caret.Column);
else if (Anchor.Row < Caret.Row)
column = Caret.Column;
else
column = Anchor.Column;
return new Position(
Caret.Row > Anchor.Row ? Caret.Row : Anchor.Row,
column
);
}
}
private ICaret Caret
{
get { return _caret; }
}
public void Clear ()
{
Anchor = new Position(-1,-1);
}
public bool HasSelection ()
{
return Anchor.Row >= 0 && !(Anchor.Row == Caret.Row && Anchor.Column == Caret.Column);
}
public override string ToString ()
{
return string.Format ("{0} -> {1}, Anchor: {2}, Caret {3},{4}", BeginDrawPos, EndDrawPos, Anchor, Caret.Row, Caret.Column);
}
}
}
|
using System;
namespace CodeEditor.Text.UI
{
public class Selection
{
public Position Anchor {get; set;}
readonly ICaret _caret;
public Selection (ICaret caret)
{
_caret = caret;
Clear ();
}
public Position BeginDrawPos
{
get
{
return new Position (
Anchor.Row < Caret.Row ? Anchor.Row : Caret.Row,
(Anchor.Row < Caret.Row || Anchor.Column < Caret.Column) ? Anchor.Column : Caret.Column
);
}
}
public Position EndDrawPos
{
get
{
return new Position(
Caret.Row > Anchor.Row ? Caret.Row : Anchor.Row,
(Caret.Row > Anchor.Row || Anchor.Column < Caret.Column) ? Caret.Column : Anchor.Column
);
}
}
private ICaret Caret
{
get { return _caret; }
}
public void Clear ()
{
Anchor = new Position(-1,-1);
}
public bool HasSelection ()
{
return Anchor.Row >= 0 && !(Anchor.Row == Caret.Row && Anchor.Column == Caret.Column);
}
public override string ToString ()
{
return string.Format ("{0} -> {1}", BeginDrawPos, EndDrawPos);
}
}
}
|
mit
|
C#
|
dc6eb0953ae66bbff581908940d4433dac13309b
|
add tests for assemblyhelper
|
peopleware/net-ppwcode-util-oddsandends
|
src/Test.II/AssemblyHelperTests.cs
|
src/Test.II/AssemblyHelperTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using PPWCode.Util.OddsAndEnds.II.AssemblyHelpers;
namespace PPWCode.Util.OddsAndEnds.Test.II
{
[TestFixture]
public class AssemblyHelperTests
{
[Test]
public void LoadAssemblyNotNullTest()
{
var assembly = AssemblyHelper.LoadAssembly("PPWCode.Util.OddsAndEnds.II.dll");
Assert.IsNotNull(assembly);
}
[Test]
public void CreateInstanceOfSequenceGeneratorIsNotNull()
{
var assembly = AssemblyHelper.LoadAssembly("PPWCode.Util.OddsAndEnds.II.dll");
var adSearch = AssemblyHelper.CreateInstanceOf(assembly, "PPWCode.Util.OddsAndEnds.II.UnitTestHelpers.SequenceGenerator");// "AdSearch");
Assert.IsNotNull(adSearch);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace PPWCode.Util.OddsAndEnds.Test.II
{
[TestFixture]
public class AssemblyHelperTests
{
}
}
|
apache-2.0
|
C#
|
e8c39b9c373fde667de33389a1e4425cb1c9ed44
|
Fix test screen loading
|
peppy/osu,smoogipoo/osu,NeoAdonis/osu,naoey/osu,ppy/osu,peppy/osu,UselessToucan/osu,ppy/osu,naoey/osu,UselessToucan/osu,NeoAdonis/osu,ZLima12/osu,EVAST9919/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu,DrabWeb/osu,ZLima12/osu,johnneijzen/osu,peppy/osu,DrabWeb/osu,EVAST9919/osu,smoogipoo/osu,DrabWeb/osu,UselessToucan/osu,2yangk23/osu,peppy/osu-new,johnneijzen/osu,2yangk23/osu,naoey/osu,smoogipoo/osu
|
osu.Game/Tests/Visual/ScreenTestCase.cs
|
osu.Game/Tests/Visual/ScreenTestCase.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.Graphics;
using osu.Framework.Screens;
using osu.Game.Screens;
namespace osu.Game.Tests.Visual
{
/// <summary>
/// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions).
/// </summary>
public abstract class ScreenTestCase : OsuTestCase
{
private readonly ScreenStack stack;
protected ScreenTestCase()
{
Add(stack = new ScreenStack
{
RelativeSizeAxes = Axes.Both,
});
}
protected void LoadScreen(OsuScreen screen)
{
if (stack.CurrentScreen != null)
stack.Exit();
stack.Push(screen);
}
}
}
|
// 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.Screens;
using osu.Game.Screens;
namespace osu.Game.Tests.Visual
{
/// <summary>
/// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions).
/// </summary>
public abstract class ScreenTestCase : OsuTestCase
{
private readonly TestOsuScreen baseScreen;
protected ScreenTestCase()
{
Add(baseScreen = new TestOsuScreen());
}
protected void LoadScreen(OsuScreen screen) => baseScreen.LoadScreen(screen);
public class TestOsuScreen : OsuScreen
{
private OsuScreen nextScreen;
public void LoadScreen(OsuScreen screen) => Schedule(() =>
{
nextScreen = screen;
if (this.IsCurrentScreen())
{
this.Push(screen);
nextScreen = null;
}
else
this.MakeCurrent();
});
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
if (nextScreen != null)
LoadScreen(nextScreen);
}
}
}
}
|
mit
|
C#
|
bb2e44394b5f5b30d8e2fc6c486245eca7e2d7e4
|
Make UserControl a name scope.
|
wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,MrDaedra/Avalonia,MrDaedra/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,susloparovdenis/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,susloparovdenis/Perspex,SuperJMN/Avalonia,punker76/Perspex,akrisiun/Perspex,jkoritzinsky/Avalonia,OronDF343/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,grokys/Perspex,SuperJMN/Avalonia,susloparovdenis/Perspex,jkoritzinsky/Avalonia,Perspex/Perspex,OronDF343/Avalonia,wieslawsoltes/Perspex,Perspex/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jazzay/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,susloparovdenis/Avalonia
|
src/Perspex.Controls/UserControl.cs
|
src/Perspex.Controls/UserControl.cs
|
// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using Perspex.Styling;
namespace Perspex.Controls
{
public class UserControl : ContentControl, IStyleable, INameScope
{
private NameScope _nameScope = new NameScope();
/// <inheritdoc/>
event EventHandler<NameScopeEventArgs> INameScope.Registered
{
add { _nameScope.Registered += value; }
remove { _nameScope.Registered -= value; }
}
/// <inheritdoc/>
event EventHandler<NameScopeEventArgs> INameScope.Unregistered
{
add { _nameScope.Unregistered += value; }
remove { _nameScope.Unregistered -= value; }
}
Type IStyleable.StyleKey => typeof(ContentControl);
/// <inheritdoc/>
void INameScope.Register(string name, object element)
{
_nameScope.Register(name, element);
}
/// <inheritdoc/>
object INameScope.Find(string name)
{
return _nameScope.Find(name);
}
/// <inheritdoc/>
void INameScope.Unregister(string name)
{
_nameScope.Unregister(name);
}
}
}
|
// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using Perspex.Styling;
namespace Perspex.Controls
{
public class UserControl : ContentControl, IStyleable
{
Type IStyleable.StyleKey => typeof(ContentControl);
}
}
|
mit
|
C#
|
f13c1b2fe29edfd124d1037ea361bf4086ef972e
|
add OwinEnvironmentService to show it works
|
IdentityServer/IdentityServer3.Samples,IdentityServer/IdentityServer3.Samples,geffzhang/Thinktecture.IdentityServer.v3.Samples,codehedgehog/IdentityServer3.Samples,geffzhang/Thinktecture.IdentityServer.v3.Samples,codehedgehog/IdentityServer3.Samples,IdentityServer/IdentityServer3.Samples,codehedgehog/IdentityServer3.Samples,geffzhang/Thinktecture.IdentityServer.v3.Samples
|
source/DependencyInjection/SelfHost/MyCustomServices.cs
|
source/DependencyInjection/SelfHost/MyCustomServices.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security.Claims;
using System.Text;
using IdentityServer3.Core;
using IdentityServer3.Core.Services;
using IdentityServer3.Core.Services.Default;
using IdentityServer3.Core.Services.InMemory;
namespace SelfHost
{
public interface ICustomLogger
{
void Log(string message);
}
public class MyCustomDebugLogger : ICustomLogger
{
public void Log(string message)
{
Debug.WriteLine(message);
}
}
public class MyCustomClaimsProvider : DefaultClaimsProvider
{
ICustomLogger logger;
public MyCustomClaimsProvider(ICustomLogger logger, IUserService userSvc, OwinEnvironmentService owin)
: base(userSvc)
{
this.logger = logger;
this.logger.Log("yay, custom type was injected");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security.Claims;
using System.Text;
using IdentityServer3.Core;
using IdentityServer3.Core.Services;
using IdentityServer3.Core.Services.Default;
using IdentityServer3.Core.Services.InMemory;
namespace SelfHost
{
public interface ICustomLogger
{
void Log(string message);
}
public class MyCustomDebugLogger : ICustomLogger
{
public void Log(string message)
{
Debug.WriteLine(message);
}
}
public class MyCustomClaimsProvider : DefaultClaimsProvider
{
ICustomLogger logger;
public MyCustomClaimsProvider(ICustomLogger logger, IUserService userSvc)
: base(userSvc)
{
this.logger = logger;
this.logger.Log("yay, custom type was injected");
}
}
}
|
apache-2.0
|
C#
|
c6adb794d1294a7ba4c29515c8e6e5d9fca90657
|
Fix typo
|
volak/Aggregates.NET,volak/Aggregates.NET
|
src/Aggregates.NET.Domain/Internal/CommandUnitOfWork.cs
|
src/Aggregates.NET.Domain/Internal/CommandUnitOfWork.cs
|
using NServiceBus.Pipeline;
using NServiceBus.Pipeline.Contexts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aggregates.Internal
{
internal class CommandUnitOfWork : IBehavior<IncomingContext>
{
public void Invoke(IncomingContext context, Action next)
{
var unitOfWorks = context.Builder.BuildAll<ICommandUnitOfWork>();
foreach (var uow in unitOfWorks)
{
uow.Builder = context.Builder;
uow.Begin();
}
try
{
next();
}
catch (Exception e)
{
foreach (var uow in unitOfWorks)
{
uow.End(e);
}
throw;
}
foreach (var uow in unitOfWorks)
{
uow.End();
}
}
}
internal class CommandUnitOfWorkRegistration : RegisterStep
{
public CommandUnitOfWorkRegistration()
: base("CommandUnitOfWork", typeof(CommandUnitOfWork), "Begins and Ends command unit of work")
{
InsertAfter(WellKnownStep.ExecuteUnitOfWork);
}
}
}
|
using NServiceBus.Pipeline;
using NServiceBus.Pipeline.Contexts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aggregates.Internal
{
internal class CommandUnitOfWork : IBehavior<IncomingContext>
{
public void Invoke(IncomingContext context, Action next)
{
var unitOfWorks = context.Builder.BuildAll<ICommandUnitOfWork>();
foreach (var uow in unitOfWorks)
{
uow.Builder = context.Builder;
uow.Begin();
}
try
{
next();
}
catch (Exception e)
{
foreach (var uow in unitOfWorks)
{
uow.End(e);
}
throw;
}
foreach (var uow in unitOfWorks)
{
uow.End();
}
}
}
internal class CommandUnitOfWorkRegistration : RegisterStep
{
public CommandUnitOfWorkRegistration()
: base("CommandUnitOfWork", typeof(CommandUnitOfWorkRegistration), "Begins and Ends command unit of work")
{
InsertAfter(WellKnownStep.ExecuteUnitOfWork);
}
}
}
|
mit
|
C#
|
4d908a64eed76aa50720b8ff7b241cf254659c4d
|
Fix a typo
|
riganti/dotvvm,riganti/dotvvm,riganti/dotvvm,riganti/dotvvm
|
src/DotVVM.Samples.Tests/Complex/NestedComboBoxTests.cs
|
src/DotVVM.Samples.Tests/Complex/NestedComboBoxTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotVVM.Samples.Tests.Base;
using DotVVM.Testing.Abstractions;
using Riganti.Selenium.Core;
using Riganti.Selenium.DotVVM;
using Xunit;
using Xunit.Abstractions;
namespace DotVVM.Samples.Tests.Complex
{
public class NestedComboBoxTests : AppSeleniumTest
{
public NestedComboBoxTests(ITestOutputHelper output) : base(output)
{
}
[Fact]
public void Complex_NestedComboBox_HeavilyNested()
{
RunInAllBrowsers(browser => {
browser.NavigateToUrl(SamplesRouteUrls.ComplexSamples_NestedComboBox_HeavilyNested);
browser.WaitUntilDotvvmInited();
var selectedValue = browser.Single("selected-value", SelectByDataUi);
AssertUI.TextEquals(selectedValue, "");
var combobox = browser.Single("combobox", SelectByDataUi);
combobox.Select(1);
browser.WaitFor(() => AssertUI.TextEquals(selectedValue, "2"), 1000);
combobox.Select(0);
browser.WaitFor(() => AssertUI.TextEquals(selectedValue, ""), 1000);
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotVVM.Samples.Tests.Base;
using DotVVM.Testing.Abstractions;
using Riganti.Selenium.Core;
using Riganti.Selenium.DotVVM;
using Xunit;
using Xunit.Abstractions;
namespace DotVVM.Samples.Tests.Complex
{
public class NestedComboBoxTests : AppSeleniumTest
{
public NestedComboBoxTests(ITestOutputHelper output) : base(output)
{
}
[Fact]
public void Comples_NestedComboBox_HeavilyNested()
{
RunInAllBrowsers(browser => {
browser.NavigateToUrl(SamplesRouteUrls.ComplexSamples_NestedComboBox_HeavilyNested);
browser.WaitUntilDotvvmInited();
var selectedValue = browser.Single("selected-value", SelectByDataUi);
AssertUI.TextEquals(selectedValue, "");
var combobox = browser.Single("combobox", SelectByDataUi);
combobox.Select(1);
browser.WaitFor(() => AssertUI.TextEquals(selectedValue, "2"), 1000);
combobox.Select(0);
browser.WaitFor(() => AssertUI.TextEquals(selectedValue, ""), 1000);
});
}
}
}
|
apache-2.0
|
C#
|
cdfde35629c46a7dbd5137a3bf90753ec7ad1a86
|
Update AssemblyInfo.cs
|
csuffyy/Orc.FilterBuilder
|
src/FilterBuilder/Properties/AssemblyInfo.cs
|
src/FilterBuilder/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("Orc.FilterBuilder.NET45")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Orc.FilterBuilder.NET45")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//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)
)]
|
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("Orc.FilterBuilder.NET45")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Orc.FilterBuilder.NET45")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly:ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
b32251510cb534f38c5cd80e06205e662777b189
|
Add Metadata dictionary to IStore Extensions declarations
|
geeklearningio/gl-dotnet-storage
|
src/GeekLearning.Storage/IStoreExtensions.cs
|
src/GeekLearning.Storage/IStoreExtensions.cs
|
namespace GeekLearning.Storage
{
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
public static class IStoreExtensions
{
public static ValueTask<IFileReference[]> ListAsync(this IStore store, string path, bool recursive = false, bool withMetadata = false)
=> store.ListAsync(path, recursive: recursive, withMetadata: withMetadata);
public static ValueTask<IFileReference[]> ListAsync(this IStore store, string path, string searchPattern, bool recursive = false, bool withMetadata = false)
=> store.ListAsync(path, searchPattern, recursive: recursive, withMetadata: withMetadata);
public static Task DeleteAsync(this IStore store, string path)
=> store.DeleteAsync(new Internal.PrivateFileReference(path));
public static ValueTask<IFileReference> GetAsync(this IStore store, string path, bool withMetadata = false)
=> store.GetAsync(new Internal.PrivateFileReference(path), withMetadata: withMetadata);
public static ValueTask<Stream> ReadAsync(this IStore store, string path)
=> store.ReadAsync(new Internal.PrivateFileReference(path));
public static ValueTask<byte[]> ReadAllBytesAsync(this IStore store, string path)
=> store.ReadAllBytesAsync(new Internal.PrivateFileReference(path));
public static ValueTask<string> ReadAllTextAsync(this IStore store, string path)
=> store.ReadAllTextAsync(new Internal.PrivateFileReference(path));
public static ValueTask<IFileReference> SaveAsync(this IStore store, byte[] data, string path, string contentType, OverwritePolicy overwritePolicy = OverwritePolicy.Always, IDictionary<string,string> metadata = null)
=> store.SaveAsync(data, new Internal.PrivateFileReference(path), contentType, overwritePolicy, metadata);
public static ValueTask<IFileReference> SaveAsync(this IStore store, Stream data, string path, string contentType, OverwritePolicy overwritePolicy = OverwritePolicy.Always, IDictionary<string,string> metadata = null)
=> store.SaveAsync(data, new Internal.PrivateFileReference(path), contentType, overwritePolicy, metadata);
}
}
|
namespace GeekLearning.Storage
{
using System.IO;
using System.Threading.Tasks;
public static class IStoreExtensions
{
public static ValueTask<IFileReference[]> ListAsync(this IStore store, string path, bool recursive = false, bool withMetadata = false)
=> store.ListAsync(path, recursive: recursive, withMetadata: withMetadata);
public static ValueTask<IFileReference[]> ListAsync(this IStore store, string path, string searchPattern, bool recursive = false, bool withMetadata = false)
=> store.ListAsync(path, searchPattern, recursive: recursive, withMetadata: withMetadata);
public static Task DeleteAsync(this IStore store, string path)
=> store.DeleteAsync(new Internal.PrivateFileReference(path));
public static ValueTask<IFileReference> GetAsync(this IStore store, string path, bool withMetadata = false)
=> store.GetAsync(new Internal.PrivateFileReference(path), withMetadata: withMetadata);
public static ValueTask<Stream> ReadAsync(this IStore store, string path)
=> store.ReadAsync(new Internal.PrivateFileReference(path));
public static ValueTask<byte[]> ReadAllBytesAsync(this IStore store, string path)
=> store.ReadAllBytesAsync(new Internal.PrivateFileReference(path));
public static ValueTask<string> ReadAllTextAsync(this IStore store, string path)
=> store.ReadAllTextAsync(new Internal.PrivateFileReference(path));
public static ValueTask<IFileReference> SaveAsync(this IStore store, byte[] data, string path, string contentType, OverwritePolicy overwritePolicy = OverwritePolicy.Always)
=> store.SaveAsync(data, new Internal.PrivateFileReference(path), contentType, overwritePolicy);
public static ValueTask<IFileReference> SaveAsync(this IStore store, Stream data, string path, string contentType, OverwritePolicy overwritePolicy = OverwritePolicy.Always)
=> store.SaveAsync(data, new Internal.PrivateFileReference(path), contentType, overwritePolicy);
}
}
|
mit
|
C#
|
7f002d8f4ff154db51225d8b78587ef489ccf989
|
remove general tab in tenant -edit-view #31
|
dfch/biz.dfch.CS.Appclusive.UI,dfensgmbh/biz.dfch.CS.Appclusive.UI,dfensgmbh/biz.dfch.CS.Appclusive.UI,dfch/biz.dfch.CS.Appclusive.UI,dfch/biz.dfch.CS.Appclusive.UI
|
src/biz.dfch.CS.Appclusive.UI/Views/Tenants/Edit.cshtml
|
src/biz.dfch.CS.Appclusive.UI/Views/Tenants/Edit.cshtml
|
@model biz.dfch.CS.Appclusive.UI.Models.Core.Tenant
@using biz.dfch.CS.Appclusive.UI.App_LocalResources
@{
ViewBag.Title = @Model.GetType().Name + " edit";
}
@section Title{
<h2>@Html.DisplayFor(model => model.Id)</h2>
<h4>@GeneralResources.ResourceManager.GetString(@Model.GetType().Name)</h4>
}
<div>
<hr />
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#details">@GeneralResources.Details</a></li>
<li><a data-toggle="tab" href="#tenants">@GeneralResources.Children</a></li>
</ul>
<div class="tab-content">
<div id="details" class="tab-pane fade in active">
@Html.Partial("FormPartial", Model)
</div>
<div id="tenants" class="tab-pane fade">
@Html.Partial("TenantList", Model.Children)
</div>
</div>
</div>
<p>
<hr />
@if (null != Model.Id)
{
<a class="btn btn-default btn-sm" href="@Url.Action("Details", new { id = Model.Id.ToString() })"><i class="fa fa-pencil "></i> @GeneralResources.CancelLink</a>
}
<a class="btn btn-info btn-sm" href="@Url.Action("Index")"><i class="fa fa-arrow-left "></i> @GeneralResources.Back2list</a>
</p>
|
@model biz.dfch.CS.Appclusive.UI.Models.Core.Tenant
@using biz.dfch.CS.Appclusive.UI.App_LocalResources
@{
ViewBag.Title = @Model.GetType().Name + " edit";
}
@section Title{
<h2>@Html.DisplayFor(model => model.Id)</h2>
<h4>@GeneralResources.ResourceManager.GetString(@Model.GetType().Name)</h4>
}
<div>
<hr />
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#details">@GeneralResources.Details</a></li>
<li><a data-toggle="tab" href="#tenants">@GeneralResources.Children</a></li>
<li><a data-toggle="tab" href="#general">@GeneralResources.General</a></li>
</ul>
<div class="tab-content">
<div id="details" class="tab-pane fade in active">
@Html.Partial("FormPartial", Model)
</div>
<div id="tenants" class="tab-pane fade">
@Html.Partial("TenantList", Model.Children)
</div>
</div>
</div>
<p>
<hr />
@if (null != Model.Id)
{
<a class="btn btn-default btn-sm" href="@Url.Action("Details", new { id = Model.Id.ToString() })"><i class="fa fa-pencil "></i> @GeneralResources.CancelLink</a>
}
<a class="btn btn-info btn-sm" href="@Url.Action("Index")"><i class="fa fa-arrow-left "></i> @GeneralResources.Back2list</a>
</p>
|
apache-2.0
|
C#
|
f8cf33ad5b09082dc0cb84e2ffbd6e6a9a6abe0a
|
Add fix-all test.
|
DustinCampbell/roslyn,agocke/roslyn,nguerrera/roslyn,gafter/roslyn,AmadeusW/roslyn,mavasani/roslyn,dotnet/roslyn,tmat/roslyn,gafter/roslyn,sharwell/roslyn,genlu/roslyn,AlekseyTs/roslyn,weltkante/roslyn,KevinRansom/roslyn,brettfo/roslyn,mgoertz-msft/roslyn,genlu/roslyn,dotnet/roslyn,tannergooding/roslyn,eriawan/roslyn,AlekseyTs/roslyn,wvdd007/roslyn,ErikSchierboom/roslyn,KevinRansom/roslyn,physhi/roslyn,mavasani/roslyn,jmarolf/roslyn,xasx/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,wvdd007/roslyn,VSadov/roslyn,MichalStrehovsky/roslyn,swaroop-sridhar/roslyn,heejaechang/roslyn,stephentoub/roslyn,abock/roslyn,panopticoncentral/roslyn,diryboy/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,reaction1989/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,stephentoub/roslyn,aelij/roslyn,reaction1989/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,KevinRansom/roslyn,xasx/roslyn,CyrusNajmabadi/roslyn,brettfo/roslyn,mgoertz-msft/roslyn,agocke/roslyn,KirillOsenkov/roslyn,VSadov/roslyn,mavasani/roslyn,bartdesmet/roslyn,ErikSchierboom/roslyn,swaroop-sridhar/roslyn,jcouv/roslyn,dpoeschl/roslyn,wvdd007/roslyn,sharwell/roslyn,tannergooding/roslyn,gafter/roslyn,tmat/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,MichalStrehovsky/roslyn,weltkante/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,physhi/roslyn,davkean/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,swaroop-sridhar/roslyn,shyamnamboodiripad/roslyn,panopticoncentral/roslyn,DustinCampbell/roslyn,xasx/roslyn,dotnet/roslyn,physhi/roslyn,DustinCampbell/roslyn,AlekseyTs/roslyn,AmadeusW/roslyn,abock/roslyn,dpoeschl/roslyn,tmat/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,aelij/roslyn,diryboy/roslyn,VSadov/roslyn,genlu/roslyn,davkean/roslyn,aelij/roslyn,eriawan/roslyn,AmadeusW/roslyn,agocke/roslyn,eriawan/roslyn,nguerrera/roslyn,jasonmalinowski/roslyn,MichalStrehovsky/roslyn,dpoeschl/roslyn,jmarolf/roslyn,brettfo/roslyn,shyamnamboodiripad/roslyn,tannergooding/roslyn,heejaechang/roslyn,bartdesmet/roslyn,panopticoncentral/roslyn,nguerrera/roslyn,davkean/roslyn,sharwell/roslyn,jcouv/roslyn,stephentoub/roslyn,ErikSchierboom/roslyn,jcouv/roslyn,abock/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn
|
src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests_FixAllTests.cs
|
src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests_FixAllTests.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UsePatternMatching
{
public partial class CSharpAsAndNullCheckTests
{
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)]
public async Task FixAllInDocument1()
{
await TestInRegularAndScriptAsync(
@"class C
{
int M()
{
string a;
{|FixAllInDocument:var|} x = o as string;
if (x != null)
{
}
var y = o as string;
if (y != null)
{
}
if ((a = o as string) == null)
{
}
var c = o as string;
var d = c != null ? 1 : 0;
var e = o as string;
return e != null ? 1 : 0;
}
}",
@"class C
{
int M()
{
if (o is string x)
{
}
if (o is string y)
{
}
if (!(o is string a))
{
}
var d = o is string c ? 1 : 0;
return o is string e ? 1 : 0;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)]
public async Task FixAllInDocument2()
{
await TestInRegularAndScriptAsync(
@"class Symbol
{
public ContainingSymbol { get; }
void M(object o, bool b0, bool b1)
{
{|FixAllInDocument:var|} symbol = o as Symbol;
if (symbol != null)
{
while ((object)symbol != null && b1)
{
symbol = symbol.ContainingSymbol as Symbol;
}
if ((object)symbol == null || b2)
{
throw null;
}
var use = symbol;
}
}
}",
@"class Symbol
{
public ContainingSymbol { get; }
void M(object o, bool b0, bool b1)
{
if (o is Symbol symbol)
{
while ((object)symbol != null && b1)
{
symbol = symbol.ContainingSymbol as Symbol;
}
if ((object)symbol == null || b2)
{
throw null;
}
var use = symbol;
}
}
}");
}
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UsePatternMatching
{
public partial class CSharpAsAndNullCheckTests
{
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)]
public async Task FixAllInDocument1()
{
await TestInRegularAndScriptAsync(
@"class C
{
int M()
{
string a;
{|FixAllInDocument:var|} x = o as string;
if (x != null)
{
}
var y = o as string;
if (y != null)
{
}
if ((a = o as string) == null)
{
}
var c = o as string;
var d = c != null ? 1 : 0;
var e = o as string;
return e != null ? 1 : 0;
}
}",
@"class C
{
int M()
{
if (o is string x)
{
}
if (o is string y)
{
}
if (!(o is string a))
{
}
var d = o is string c ? 1 : 0;
return o is string e ? 1 : 0;
}
}");
}
}
}
|
mit
|
C#
|
18f314229b06a2c06fcfc2a78309c6f5cb907de6
|
Update ApplyConditionalFormattingFormula.cs
|
asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/CSharp/Articles/ApplyConditionalFormatting/ApplyConditionalFormattingFormula.cs
|
Examples/CSharp/Articles/ApplyConditionalFormatting/ApplyConditionalFormattingFormula.cs
|
using System.IO;
using Aspose.Cells;
using System.Drawing;
namespace Aspose.Cells.Examples.Articles.ApplyConditionalFormatting
{
public class ApplyConditionalFormattingFormula
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiating a Workbook object
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
//Adds an empty conditional formatting
int index = sheet.ConditionalFormattings.Add();
FormatConditionCollection fcs = sheet.ConditionalFormattings[index];
//Sets the conditional format range.
CellArea ca = new CellArea();
ca = new CellArea();
ca.StartRow = 2;
ca.EndRow = 2;
ca.StartColumn = 1;
ca.EndColumn = 1;
fcs.AddArea(ca);
//Adds condition.
int conditionIndex = fcs.AddCondition(FormatConditionType.Expression);
//Sets the background color.
FormatCondition fc = fcs[conditionIndex];
fc.Formula1 = "=IF(SUM(B1:B2)>100,TRUE,FALSE)";
fc.Style.BackgroundColor = Color.Red;
sheet.Cells["B3"].Formula = "=SUM(B1:B2)";
sheet.Cells["C4"].PutValue("If Sum of B1:B2 is greater than 100, B3 will have RED background");
//Saving the Excel file
workbook.Save(dataDir+ "output.out.xls", SaveFormat.Auto);
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
using System.Drawing;
namespace Aspose.Cells.Examples.Articles.ApplyConditionalFormatting
{
public class ApplyConditionalFormattingFormula
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiating a Workbook object
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
//Adds an empty conditional formatting
int index = sheet.ConditionalFormattings.Add();
FormatConditionCollection fcs = sheet.ConditionalFormattings[index];
//Sets the conditional format range.
CellArea ca = new CellArea();
ca = new CellArea();
ca.StartRow = 2;
ca.EndRow = 2;
ca.StartColumn = 1;
ca.EndColumn = 1;
fcs.AddArea(ca);
//Adds condition.
int conditionIndex = fcs.AddCondition(FormatConditionType.Expression);
//Sets the background color.
FormatCondition fc = fcs[conditionIndex];
fc.Formula1 = "=IF(SUM(B1:B2)>100,TRUE,FALSE)";
fc.Style.BackgroundColor = Color.Red;
sheet.Cells["B3"].Formula = "=SUM(B1:B2)";
sheet.Cells["C4"].PutValue("If Sum of B1:B2 is greater than 100, B3 will have RED background");
//Saving the Excel file
workbook.Save(dataDir+ "output.out.xls", SaveFormat.Auto);
}
}
}
|
mit
|
C#
|
fb94b12be5aae3ab2f7cd2df4bff0aae1060b90d
|
add of report num
|
Appleseed/base,Appleseed/base
|
Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/SolrResponseItem.cs
|
Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/SolrResponseItem.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
class SolrResponseItem
{
public string id { get; set; }
public string item_type { get; set; }
public string address_1 { get; set; }
public string city { get; set; }
public string state { get; set; }
public string classification { get; set; }
public string country { get; set; }
public string postal_code { get; set; }
public string product_description { get; set; }
public string product_quantity { get; set; }
public string product_type { get; set; }
public string code_info { get; set; }
public string reason_for_recall { get; set; }
public DateTime recall_initiation_date { get; set; }
public string recall_number { get; set; }
public string recalling_firm { get; set; }
public string voluntary_mandated { get; set; }
public DateTime report_date { get; set; }
public string status { get; set; }
public DateTime date_last_indexed { get; set; }
//IRefusal
public string fei_number { get; set; }
public string product_code { get; set; }
public string product_code_description { get; set; }
public DateTime refusal_date { get; set; }
public string entry_number { get; set; }
public string rfrnc_doc_id { get; set; }
public string line_number { get; set; }
public string line_sfx_id { get; set; }
public string fda_sample_analysis { get; set; }
public string private_lab_analysis { get; set; }
public string refusal_charges { get; set; }
//ICitations
public string act_cfr { get; set; }
public string program_area { get; set; }
public string description_short { get; set; }
public string description_long { get; set; }
public DateTime end_date { get; set; }
//IClassification
public string district_decision { get; set; }
public string district { get; set; }
public DateTime inspection_end_date { get; set; }
public string center { get; set; }
public string project_area { get; set; }
public string legal_name { get; set; }
//IAdvertise
public string[] reactions { get; set; }
public string report_number { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
class SolrResponseItem
{
public string id { get; set; }
public string item_type { get; set; }
public string address_1 { get; set; }
public string city { get; set; }
public string state { get; set; }
public string classification { get; set; }
public string country { get; set; }
public string postal_code { get; set; }
public string product_description { get; set; }
public string product_quantity { get; set; }
public string product_type { get; set; }
public string code_info { get; set; }
public string reason_for_recall { get; set; }
public DateTime recall_initiation_date { get; set; }
public string recall_number { get; set; }
public string recalling_firm { get; set; }
public string voluntary_mandated { get; set; }
public DateTime report_date { get; set; }
public string status { get; set; }
public DateTime date_last_indexed { get; set; }
//IRefusal
public string fei_number { get; set; }
public string product_code { get; set; }
public string product_code_description { get; set; }
public DateTime refusal_date { get; set; }
public string entry_number { get; set; }
public string rfrnc_doc_id { get; set; }
public string line_number { get; set; }
public string line_sfx_id { get; set; }
public string fda_sample_analysis { get; set; }
public string private_lab_analysis { get; set; }
public string refusal_charges { get; set; }
//ICitations
public string act_cfr { get; set; }
public string program_area { get; set; }
public string description_short { get; set; }
public string description_long { get; set; }
public DateTime end_date { get; set; }
//IClassification
public string district_decision { get; set; }
public string district { get; set; }
public DateTime inspection_end_date { get; set; }
public string center { get; set; }
public string project_area { get; set; }
public string legal_name { get; set; }
//IAdvertise
public string[] reactions { get; set; }
}
}
|
apache-2.0
|
C#
|
0ffe3be1a035a40baeac8e7a512bffa59c5ab505
|
Add disk check
|
yappy/DollsKit,yappy/DollsKit,yappy/DollsKit,yappy/DollsKit,yappy/DollsKit
|
Shanghai/HealthCheck.cs
|
Shanghai/HealthCheck.cs
|
using System.IO;
using System.Text;
namespace Shanghai
{
class HealthCheck
{
public HealthCheck()
{ }
public void Proc(TaskServer server, string taskName)
{
var msg = new StringBuilder("[Health Check]\n");
msg.AppendFormat("CPU Temp: {0:F3}\n", GetCpuTemp());
double free, total;
GetDiskInfoG(out free, out total);
msg.AppendFormat("Disk: {0:F3}G/{1:F3}G Free ({2}%)",
free, total, (int)(free * 100.0 / total));
TwitterManager.Update(msg.ToString());
}
private static double GetCpuTemp()
{
const string DevFilePath = "/sys/class/thermal/thermal_zone0/temp";
string src;
using (var reader = new StreamReader(DevFilePath))
{
src = reader.ReadLine();
}
return int.Parse(src) / 1000.0;
}
private static void GetDiskInfoG(out double free, out double total)
{
const double Unit = 1024.0 * 1024.0 * 1024.0;
var info = new DriveInfo("/");
free = info.TotalFreeSpace / Unit;
total = info.TotalSize / Unit;
}
}
}
|
using System.IO;
using System.Text;
namespace Shanghai
{
class HealthCheck
{
public HealthCheck()
{ }
public void Proc(TaskServer server, string taskName)
{
var msg = new StringBuilder();
msg.Append("[Health Check]\n");
msg.AppendFormat("CPU Temp: {0:F3}\n", GetCpuTemp());
TwitterManager.Update(msg.ToString());
}
private static double GetCpuTemp()
{
const string DevFilePath = "/sys/class/thermal/thermal_zone0/temp";
string src;
using (var reader = new StreamReader(DevFilePath))
{
src = reader.ReadLine();
}
return int.Parse(src) / 1000.0;
}
}
}
|
mit
|
C#
|
cb6ff9f4470dea772e708deb0f7b2419d2074ff1
|
make addAttribute chainable
|
Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen
|
Dashen/AssetInfo.cs
|
Dashen/AssetInfo.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Dashen
{
public class AssetInfo
{
private const string SelfClosingFormat = "<{0} {1} />";
private const string NonClosingFormat = "<{0} {1}></{0}>";
public string Tag { get; protected set; }
public bool SelfClosing { get; protected set; }
public AssetLocations Location { get; set; }
private readonly Dictionary<string, string> _attributes;
private readonly Lazy<string> _tag;
public AssetInfo()
{
_attributes = new Dictionary<string, string>();
_tag = new Lazy<string>(BuildTag);
}
public AssetInfo AddAttribute(string name, string value)
{
_attributes[name] = value;
return this;
}
private string BuildTag()
{
var format = SelfClosing ? SelfClosingFormat : NonClosingFormat;
return string.Format(
format,
Tag,
BuildAttributes());
}
private string BuildAttributes()
{
var format = "{0}=\"{1}\"";
return _attributes
.Select(pair => string.Format(format, pair.Key, pair.Value))
.Aggregate((a, c) => a + " " + c);
}
public override string ToString()
{
return _tag.Value;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Dashen
{
public class AssetInfo
{
private const string SelfClosingFormat = "<{0} {1} />";
private const string NonClosingFormat = "<{0} {1}></{0}>";
public string Tag { get; protected set; }
public bool SelfClosing { get; protected set; }
public AssetLocations Location { get; set; }
private readonly Dictionary<string, string> _attributes;
private readonly Lazy<string> _tag;
public AssetInfo()
{
_attributes = new Dictionary<string, string>();
_tag = new Lazy<string>(BuildTag);
}
public void AddAttribute(string name, string value)
{
_attributes[name] = value;
}
private string BuildTag()
{
var format = SelfClosing ? SelfClosingFormat : NonClosingFormat;
return string.Format(
format,
Tag,
BuildAttributes());
}
private string BuildAttributes()
{
var format = "{0}=\"{1}\"";
return _attributes
.Select(pair => string.Format(format, pair.Key, pair.Value))
.Aggregate((a, c) => a + " " + c);
}
public override string ToString()
{
return _tag.Value;
}
}
}
|
lgpl-2.1
|
C#
|
129686837dd77519b7dca46c1a43bf72f9604c59
|
Edit program cs
|
eklnc/TwitterStream
|
TwitterStream/Program.cs
|
TwitterStream/Program.cs
|
using System;
using System.Net;
using TwitterStream.Tables;
namespace TwitterStream
{
class Program
{
static void Main(string[] args)
{
using (var context = new TwitterStreamContext())
{
TwitterStream stream = new TwitterStream(context);
try
{
stream.Start();
}
catch (WebException ex)
{
Console.WriteLine("***HATA ALINDI ***: " + ex.Message + "\n\n");
stream.InsertError(ex);
}
}
}
}
}
|
using System;
using System.Net;
using TwitterStream.Tables;
namespace TwitterStream
{
class Program
{
static void Main(string[] args)
{
//using (var context = new TwitterStreamContext())
//{
// TwitterStream stream = new TwitterStream(context);
// try
// {
// stream.Start();
// }
// catch (WebException ex)
// {
// Console.WriteLine("***HATA ALINDI ***: " + ex.Message + "\n\n");
// stream.InsertError(ex);
// }
//}
}
}
}
|
mit
|
C#
|
94b7f4677ac105e322bf90dcba058524eb9886fc
|
Convert tabs to spaces
|
mminer/unity-extensions
|
Vector3IntExtensions.cs
|
Vector3IntExtensions.cs
|
using System;
using UnityEngine;
namespace UnityExtensions
{
/// <summary>
/// Extension methods for UnityEngine.Vector3Int.
/// </summary>
public static class Vector3IntExtensions
{
/// <summary>
/// Converts a Vector3Int struct to a Vector3.
/// </summary>
/// <param name="vector">Vector.</param>
/// <returns>Vector3 struct.</returns>
public static Vector3 ToVector3(this Vector3Int vector)
{
return new Vector3(
Convert.ToSingle(vector.x),
Convert.ToSingle(vector.y),
Convert.ToSingle(vector.z)
);
}
}
}
|
using System;
using UnityEngine;
namespace UnityExtensions
{
/// <summary>
/// Extension methods for UnityEngine.Vector3Int.
/// </summary>
public static class Vector3IntExtensions
{
/// <summary>
/// Converts a Vector3Int struct to a Vector3.
/// </summary>
/// <param name="vector">Vector.</param>
/// <returns>Vector3 struct.</returns>
public static Vector3 ToVector3(this Vector3Int vector)
{
return new Vector3(
Convert.ToSingle(vector.x),
Convert.ToSingle(vector.y),
Convert.ToSingle(vector.z)
);
}
}
}
|
mit
|
C#
|
b6489e14635b630b8b39d3cd65a267cae7ccc8a6
|
Check if eventargs is null
|
pharring/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet,Microsoft/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet
|
src/Core/Managed/Shared/Extensibility/Implementation/Tracing/DiagnosticsEventListener.cs
|
src/Core/Managed/Shared/Extensibility/Implementation/Tracing/DiagnosticsEventListener.cs
|
namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing
{
using System;
#if !NET40
using System.Diagnostics.Tracing;
#endif
using System.Linq;
#if NET40
using Microsoft.Diagnostics.Tracing;
#endif
internal class DiagnosticsEventListener : EventListener
{
private const long AllKeyword = -1;
private readonly EventLevel logLevel;
private readonly DiagnosticsListener listener;
public DiagnosticsEventListener(DiagnosticsListener listener, EventLevel logLevel)
{
this.listener = listener;
this.logLevel = logLevel;
}
protected override void OnEventWritten(EventWrittenEventArgs eventSourceEvent)
{
if (eventSourceEvent == null)
{
return;
}
var metadata = new EventMetaData
{
Keywords = (long)eventSourceEvent.Keywords,
MessageFormat = eventSourceEvent.Message,
EventId = eventSourceEvent.EventId,
Level = eventSourceEvent.Level
};
var traceEvent = new TraceEvent
{
MetaData = metadata,
Payload = eventSourceEvent.Payload != null ? eventSourceEvent.Payload.ToArray() : null
};
this.listener.WriteEvent(traceEvent);
}
protected override void OnEventSourceCreated(EventSource eventSource)
{
if (eventSource.Name.StartsWith("Microsoft-ApplicationInsights-", StringComparison.Ordinal))
{
this.EnableEvents(eventSource, this.logLevel, (EventKeywords)AllKeyword);
}
base.OnEventSourceCreated(eventSource);
}
}
}
|
namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing
{
using System;
#if !NET40
using System.Diagnostics.Tracing;
#endif
using System.Linq;
#if NET40
using Microsoft.Diagnostics.Tracing;
#endif
internal class DiagnosticsEventListener : EventListener
{
private const long AllKeyword = -1;
private readonly EventLevel logLevel;
private readonly DiagnosticsListener listener;
public DiagnosticsEventListener(DiagnosticsListener listener, EventLevel logLevel)
{
this.listener = listener;
this.logLevel = logLevel;
}
protected override void OnEventWritten(EventWrittenEventArgs eventSourceEvent)
{
var metadata = new EventMetaData
{
Keywords = (long)eventSourceEvent.Keywords,
MessageFormat = eventSourceEvent.Message,
EventId = eventSourceEvent.EventId,
Level = eventSourceEvent.Level
};
var traceEvent = new TraceEvent
{
MetaData = metadata,
Payload = eventSourceEvent.Payload != null ? eventSourceEvent.Payload.ToArray() : null
};
this.listener.WriteEvent(traceEvent);
}
protected override void OnEventSourceCreated(EventSource eventSource)
{
if (eventSource.Name.StartsWith("Microsoft-ApplicationInsights-", StringComparison.Ordinal))
{
this.EnableEvents(eventSource, this.logLevel, (EventKeywords)AllKeyword);
}
base.OnEventSourceCreated(eventSource);
}
}
}
|
mit
|
C#
|
3dc170200f5914a10dd333cefb3a5f3248cd316e
|
Remove unused private field `index`. Update file `Points.cs`
|
lifebeyondfife/Group.Net
|
Group.Net/Points.cs
|
Group.Net/Points.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Group.Net
{
public class Points : IComparable<Points>, IEnumerable<int>
{
private readonly IList<int> points;
public int Count
{
get { return points.Count; }
}
public int this[int idx]
{
get { return points[idx]; }
set { points[idx] = value; }
}
public Points(IEnumerable<int> points)
{
this.points = points.ToList();
}
public Points(params int[] points)
{
this.points = points.ToList();
}
public Points(Points other)
: this(other.points)
{
}
public static implicit operator Points(int point)
{
return new Points(new[] { point });
}
public IEnumerator<int> GetEnumerator()
{
return points.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return points.GetEnumerator();
}
public override int GetHashCode()
{
return points.Aggregate(13, (current, point) => (current * 7) + point.GetHashCode());
}
public int CompareTo(Points other)
{
return points.Zip(other.points, (f, s) => f.CompareTo(s)).SkipWhile(n => n == 0).FirstOrDefault();
}
public override bool Equals(object obj)
{
return CompareTo((Points) obj) == 0;
}
public override string ToString()
{
return string.Join(" ", points.Select(point => point.ToString(CultureInfo.CurrentCulture)));
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Group.Net
{
public class Points : IComparable<Points>, IEnumerable<int>
{
private readonly IList<int> points;
private readonly IList<int> index;
public int Count
{
get { return points.Count; }
}
public int this[int idx]
{
get { return points[idx]; }
set { points[idx] = value; }
}
public Points(IEnumerable<int> points)
{
this.points = points.ToList();
}
public Points(params int[] points)
{
this.points = points.ToList();
}
public Points(Points other)
: this(other.points)
{
}
public static implicit operator Points(int point)
{
return new Points(new[] { point });
}
public IEnumerator<int> GetEnumerator()
{
return points.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return points.GetEnumerator();
}
public override int GetHashCode()
{
return points.Aggregate(13, (current, point) => (current * 7) + point.GetHashCode());
}
public int CompareTo(Points other)
{
return points.Zip(other.points, (f, s) => f.CompareTo(s)).SkipWhile(n => n == 0).FirstOrDefault();
}
public override bool Equals(object obj)
{
return CompareTo((Points) obj) == 0;
}
public override string ToString()
{
return string.Join(" ", points.Select(point => point.ToString(CultureInfo.CurrentCulture)));
}
}
}
|
mit
|
C#
|
902fbe4c3a0832aeaeebc5f4d7c3b17a902a9b54
|
Update ThreadImpl.cs
|
CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos
|
source/Cosmos.System2_Plugs/System/Threading/ThreadImpl.cs
|
source/Cosmos.System2_Plugs/System/Threading/ThreadImpl.cs
|
using System;
using Cosmos.HAL;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Threading
{
[Plug(Target = typeof(global::System.Threading.Thread))]
public static class ThreadImpl
{
public static void Sleep(TimeSpan timeout)
{
Global.PIT.Wait((uint)timeout.TotalMilliseconds);
}
public static void Sleep(int millisecondsTimeout)
{
Global.PIT.Wait((uint)millisecondsTimeout);
}
public static bool Yield()
{
throw new NotImplementedException("Thread.Yield()");
}
public static void SpinWaitInternal(object iterations)
{
throw new NotImplementedException("Thread.SpinWaitInternal()");
}
}
}
|
using System;
using Cosmos.HAL;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System.Threading
{
[Plug("System.Threading.Thread, System.Private.CoreLib")]
public static class ThreadImpl
{
public static void Sleep(TimeSpan timeout)
{
Global.PIT.Wait((uint)timeout.TotalMilliseconds);
}
public static void Sleep(int millisecondsTimeout)
{
Global.PIT.Wait((uint)millisecondsTimeout);
}
public static bool Yield()
{
throw new NotImplementedException("Thread.Yield()");
}
public static void SpinWaitInternal(object iterations)
{
throw new NotImplementedException("Thread.SpinWaitInternal()");
}
}
}
|
bsd-3-clause
|
C#
|
eb33df31c962e55502610d568067c49172a5831e
|
Declare FormattedSize class as static
|
igece/SoxSharp
|
src/FormattedSize.cs
|
src/FormattedSize.cs
|
using System;
using System.Globalization;
namespace SoxSharp
{
/// <summary>
/// Utility class that converts a a SoX file size string (an integer or double value, optionally followed by a k, M or G character) to a numeric value.
/// </summary>
public static class FormattedSize
{
/// <summary>
/// Converts a SoX file size string to a <see cref="System.UInt64"/> value.
/// </summary>
/// <param name="formattedSize">Size string.</param>
/// <returns>Numeric value.</returns>
public static UInt64 ToUInt64(string formattedSize)
{
UInt64 multiplier = 1;
if (formattedSize.EndsWith("k", StringComparison.InvariantCulture))
{
multiplier = 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
else if (formattedSize.EndsWith("M", StringComparison.InvariantCulture))
{
multiplier = 1024 * 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
else if (formattedSize.EndsWith("G", StringComparison.InvariantCulture))
{
multiplier = 1024 * 1024 * 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
return Convert.ToUInt64(double.Parse(formattedSize, CultureInfo.InvariantCulture)) * multiplier;
}
/// <summary>
/// Converts a SoX file size string to a <see cref="System.UInt32"/> value.
/// </summary>
/// <param name="formattedSize">Size string.</param>
/// <returns>Numeric value.</returns>
public static UInt32 ToUInt32(string formattedSize)
{
UInt32 multiplier = 1;
if (formattedSize.EndsWith("k", StringComparison.InvariantCulture))
{
multiplier = 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
else if (formattedSize.EndsWith("M", StringComparison.InvariantCulture))
{
multiplier = 1024 * 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
else if (formattedSize.EndsWith("G", StringComparison.InvariantCulture))
{
multiplier = 1024 * 1024 * 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
return Convert.ToUInt32(double.Parse(formattedSize, CultureInfo.InvariantCulture)) * multiplier;
}
}
}
|
using System;
using System.Globalization;
namespace SoxSharp
{
/// <summary>
/// Utility class that converts a a SoX file size string (an integer or double value, optionally followed by a k, M or G character) to a numeric value.
/// </summary>
public class FormattedSize
{
/// <summary>
/// Converts a SoX file size string to a <see cref="System.UInt64"/> value.
/// </summary>
/// <param name="formattedSize">Size string.</param>
/// <returns>Numeric value.</returns>
public static UInt64 ToUInt64(string formattedSize)
{
UInt64 multiplier = 1;
if (formattedSize.EndsWith("k", StringComparison.InvariantCulture))
{
multiplier = 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
else if (formattedSize.EndsWith("M", StringComparison.InvariantCulture))
{
multiplier = 1024 * 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
else if (formattedSize.EndsWith("G", StringComparison.InvariantCulture))
{
multiplier = 1024 * 1024 * 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
return Convert.ToUInt64(double.Parse(formattedSize, CultureInfo.InvariantCulture)) * multiplier;
}
/// <summary>
/// Converts a SoX file size string to a <see cref="System.UInt32"/> value.
/// </summary>
/// <param name="formattedSize">Size string.</param>
/// <returns>Numeric value.</returns>
public static UInt32 ToUInt32(string formattedSize)
{
UInt32 multiplier = 1;
if (formattedSize.EndsWith("k", StringComparison.InvariantCulture))
{
multiplier = 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
else if (formattedSize.EndsWith("M", StringComparison.InvariantCulture))
{
multiplier = 1024 * 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
else if (formattedSize.EndsWith("G", StringComparison.InvariantCulture))
{
multiplier = 1024 * 1024 * 1024;
formattedSize = formattedSize.Substring(0, formattedSize.Length - 1);
}
return Convert.ToUInt32(double.Parse(formattedSize, CultureInfo.InvariantCulture)) * multiplier;
}
}
}
|
apache-2.0
|
C#
|
0406e137204713cadb47c795c500ad77f647541c
|
rename CreateQueueCallback
|
calebdoise/flowbasis,calebdoise/flowbasis
|
src/FlowBasis/FlowBasis.SimpleQueues/SimpleQueueManager.cs
|
src/FlowBasis/FlowBasis.SimpleQueues/SimpleQueueManager.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FlowBasis.SimpleQueues
{
public class SimpleQueueManager : ISimpleQueueManager
{
private SimpleQueueManagerOptions options;
private Dictionary<string, RegisteredQueue> queueNameToEntryMap = new Dictionary<string, RegisteredQueue>();
public SimpleQueueManager(SimpleQueueManagerOptions options)
{
if (options == null)
throw new ArgumentNullException(nameof(options));
this.options = options;
}
public ISimpleQueue GetQueue(string queueName)
{
RegisteredQueue registeredQueue;
if (this.queueNameToEntryMap.TryGetValue(queueName, out registeredQueue))
{
return registeredQueue.Queue;
}
else
{
throw new Exception($"Queue is not registered: {queueName}");
}
}
public ISimpleQueue RegisterQueue(string queueName, SimpleQueueMode queueMode)
{
lock (this)
{
if (this.queueNameToEntryMap.ContainsKey(queueName))
{
throw new Exception($"Queue is already registered: {queueName}");
}
ISimpleQueue queue = this.options.CreateQueueHandler(queueName, queueMode);
var registeredQueue = new RegisteredQueue
{
Name = queueName,
Queue = queue
};
this.queueNameToEntryMap[queueName] = registeredQueue;
return queue;
}
}
private class RegisteredQueue
{
public string Name { get; set; }
public ISimpleQueue Queue { get; set; }
}
}
public class SimpleQueueManagerOptions
{
public CreateQueueHandler CreateQueueHandler { get; set; }
}
public delegate ISimpleQueue CreateQueueHandler(string queueName, SimpleQueueMode queueMode);
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FlowBasis.SimpleQueues
{
public class SimpleQueueManager : ISimpleQueueManager
{
private SimpleQueueManagerOptions options;
private Dictionary<string, RegisteredQueue> queueNameToEntryMap = new Dictionary<string, RegisteredQueue>();
public SimpleQueueManager(SimpleQueueManagerOptions options)
{
if (options == null)
throw new ArgumentNullException(nameof(options));
this.options = options;
}
public ISimpleQueue GetQueue(string queueName)
{
RegisteredQueue registeredQueue;
if (this.queueNameToEntryMap.TryGetValue(queueName, out registeredQueue))
{
return registeredQueue.Queue;
}
else
{
throw new Exception($"Queue is not registered: {queueName}");
}
}
public ISimpleQueue RegisterQueue(string queueName, SimpleQueueMode queueMode)
{
lock (this)
{
if (this.queueNameToEntryMap.ContainsKey(queueName))
{
throw new Exception($"Queue is already registered: {queueName}");
}
ISimpleQueue queue = this.options.CreateQueueCallback(queueName, queueMode);
var registeredQueue = new RegisteredQueue
{
Name = queueName,
Queue = queue
};
this.queueNameToEntryMap[queueName] = registeredQueue;
return queue;
}
}
private class RegisteredQueue
{
public string Name { get; set; }
public ISimpleQueue Queue { get; set; }
}
}
public class SimpleQueueManagerOptions
{
public CreateQueueCallback CreateQueueCallback { get; set; }
}
public delegate ISimpleQueue CreateQueueCallback(string queueName, SimpleQueueMode queueMode);
}
|
mit
|
C#
|
ba84bb90ff486472157e87e70621c004ce65c808
|
Disable debugger due to Mono crash.
|
mrward/monodevelop-dnx-addin
|
src/MonoDevelop.Dnx/MonoDevelop.Dnx/DnxExecutionHandler.cs
|
src/MonoDevelop.Dnx/MonoDevelop.Dnx/DnxExecutionHandler.cs
|
//
// DnxExecutionHandler.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (c) 2015 Matthew Ward
//
// 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 MonoDevelop.Core.Execution;
using MonoDevelop.Core;
using System.Collections.Generic;
namespace MonoDevelop.Dnx
{
public class DnxExecutionHandler : IExecutionHandler
{
public bool CanExecute (ExecutionCommand command)
{
return command is DnxProjectExecutionCommand;
}
public static DotNetExecutionCommand ConvertCommand (DnxProjectExecutionCommand dnxCommand)
{
return new DotNetExecutionCommand (
dnxCommand.GetDnxRuntimePath ().Combine ("bin", "Microsoft.Dnx.Host.Mono.dll"),
dnxCommand.GetArguments (),
dnxCommand.WorkingDirectory,
new Dictionary<string, string> {
{ "DNX_BUILD_PORTABLE_PDB", "0" }
}
) {
UserAssemblyPaths = new List<string> ()
};
}
ProcessAsyncOperation IExecutionHandler.Execute (ExecutionCommand command, OperationConsole console)
{
var dotNetCommand = ConvertCommand ((DnxProjectExecutionCommand)command);
return Runtime.SystemAssemblyService.DefaultRuntime.GetExecutionHandler ().Execute (dotNetCommand, console);
}
}
}
|
//
// DnxExecutionHandler.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (c) 2015 Matthew Ward
//
// 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 MonoDevelop.Core.Execution;
using MonoDevelop.Core;
using System.Collections.Generic;
namespace MonoDevelop.Dnx
{
public class DnxExecutionHandler : IExecutionHandler
{
public bool CanExecute (ExecutionCommand command)
{
return command is DnxProjectExecutionCommand;
}
public static DotNetExecutionCommand ConvertCommand (DnxProjectExecutionCommand dnxCommand)
{
return new DotNetExecutionCommand (
dnxCommand.GetDnxRuntimePath ().Combine ("bin", "Microsoft.Dnx.Host.Mono.dll"),
dnxCommand.GetArguments (),
dnxCommand.WorkingDirectory,
new Dictionary<string, string> {
{ "DNX_BUILD_PORTABLE_PDB","1" }
}) {
UserAssemblyPaths = new List<string> ()
};
}
ProcessAsyncOperation IExecutionHandler.Execute (ExecutionCommand command, OperationConsole console)
{
var dotNetCommand = ConvertCommand ((DnxProjectExecutionCommand)command);
return Runtime.SystemAssemblyService.DefaultRuntime.GetExecutionHandler ().Execute (dotNetCommand, console);
}
}
}
|
mit
|
C#
|
eca5c9f30d7875671ac30c4ea7f21d720793d8f4
|
update unittest
|
yanghongjie/DotNetDev
|
tests/Test.Dev/Tests/ServiceContainerTest.cs
|
tests/Test.Dev/Tests/ServiceContainerTest.cs
|
using System.Linq;
using Dev.ServiceContainer;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Test.Dev.Components;
using Test.Dev.Config;
namespace Test.Dev.Tests
{
[TestClass]
public class ServiceContainerTest
{
[TestInitialize]
public void TestInit()
{
//ContainerConfig.UnityConfig();
ContainerConfig.AutoFacConfig();
//ContainerConfig.NinjectConfig();
}
[TestMethod]
public void GetInstance()
{
var instance = ServiceLocator.Get(typeof(ILogger));
Assert.IsInstanceOfType(instance, typeof(ILogger));
}
[TestMethod]
public void GetAllInstance()
{
var instances = ServiceLocator.GetAll(typeof(ILogger));
Assert.IsTrue(instances.Count() == 1);
}
}
}
|
using System.Linq;
using Dev.ServiceContainer;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Test.Dev.Components;
using Test.Dev.Config;
namespace Test.Dev.Tests
{
[TestClass]
public class ServiceContainerTest
{
[TestInitialize]
public void TestInit()
{
//ContainerConfig.UnityConfig();
ContainerConfig.AutoFacConfig();
//ContainerConfig.NinjectConfig();
}
[TestMethod]
public void GetInstance()
{
var instance = ServiceLocator.Current.GetInstance(typeof(ILogger));
Assert.IsInstanceOfType(instance, typeof(ILogger));
}
[TestMethod]
public void GetAllInstance()
{
var instances = ServiceLocator.Current.GetAllInstances(typeof(ILogger));
Assert.IsTrue(instances.Count() == 1);
}
}
}
|
apache-2.0
|
C#
|
f722befc5c5be2972e01dfb397dfb13b7e34e54c
|
Update blueprints
|
dimmpixeye/Unity3dTools
|
Assets/[0]Framework/LibBlueprints/Blueprint.cs
|
Assets/[0]Framework/LibBlueprints/Blueprint.cs
|
/*===============================================================
Product: Cryoshock
Developer: Dimitry Pixeye - pixeye@hbrew.store
Company: Homebrew - http://hbrew.store
Date: 2/27/2018 10:12 PM
================================================================*/
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Homebrew
{
[Serializable]
public abstract class Blueprint : ScriptableObject, IComponent
{
protected Dictionary<int, object> components = new Dictionary<int, object>();
//public bool initialized;
public void Add<T>(T component)
{
var awakeComponent = component as IAwake;
if (awakeComponent != null)
awakeComponent.OnAwake();
components.Add(component.GetType().GetHashCode(), component);
}
public object Get(Type t)
{
object obj;
components.TryGetValue(t.GetHashCode(), out obj);
return obj;
}
public T Get<T>() where T : class
{
object obj;
if (components.TryGetValue(typeof(T).GetHashCode(), out obj))
{
return (T) obj;
}
return null;
}
public virtual void Setup()
{
}
public void Dispose()
{
// initialized = false;
components.Clear();
}
}
}
|
/*===============================================================
Product: Cryoshock
Developer: Dimitry Pixeye - pixeye@hbrew.store
Company: Homebrew - http://hbrew.store
Date: 2/27/2018 10:12 PM
================================================================*/
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Homebrew
{
[Serializable]
public abstract class Blueprint : ScriptableObject, IComponent
{
protected Dictionary<int, object> components = new Dictionary<int, object>();
//public bool initialized;
public void Add<T>(T component)
{
components.Add(component.GetType().GetHashCode(), component);
}
public object Get(Type t)
{
object obj;
components.TryGetValue(t.GetHashCode(), out obj);
return obj;
}
public T Get<T>() where T : class
{
object obj;
if (components.TryGetValue(typeof(T).GetHashCode(), out obj))
{
return (T) obj;
}
return null;
}
public virtual void Setup()
{
}
public void Dispose()
{
// initialized = false;
components.Clear();
}
}
}
|
mit
|
C#
|
399292fee89882b83df16255dd832f3261419f1e
|
return ServiceStackHost from UseAutofac extension method to ensure fluent configuration of the host
|
alexeyzimarev/Autofac.Extras.ServiceStack
|
src/Autofac.Extras.ServiceStack/AutofacLifecycleFilter.cs
|
src/Autofac.Extras.ServiceStack/AutofacLifecycleFilter.cs
|
using System;
using Autofac.Core.Lifetime;
using ServiceStack;
namespace Autofac.Extras.ServiceStack
{
public static class ServiceStackAutofac
{
public static ServiceStackHost UseAutofac(this ServiceStackHost appHost, IContainer container)
{
appHost.Container.Adapter = new AutofacIocAdapter(container);
appHost.GlobalRequestFilters.Add((req, resp, dto) => CreateScope(container));
appHost.GlobalResponseFilters.Add((req, resp, dto) => DisposeScope());
appHost.GlobalMessageRequestFilters.Add((req, resp, dto) => CreateScope(container));
appHost.GlobalMessageRequestFilters.Add((req, resp, dto) => DisposeScope());
return appHost;
}
private static void CreateScope(IContainer container)
{
var scope = container.BeginLifetimeScope(MatchingScopeLifetimeTags.RequestLifetimeScopeTag);
HostContext.RequestContext.Items["AutofacScope"] = scope;
}
private static void DisposeScope()
{
var scope = HostContext.RequestContext.Items["AutofacScope"] as IDisposable;
scope?.Dispose();
}
}
}
|
using System;
using Autofac.Core.Lifetime;
using ServiceStack;
namespace Autofac.Extras.ServiceStack
{
public static class ServiceStackAutofac
{
public static void UseAutofac(this ServiceStackHost appHost, IContainer container)
{
appHost.Container.Adapter = new AutofacIocAdapter(container);
appHost.GlobalRequestFilters.Add((req, resp, dto) => CreateScope(container));
appHost.GlobalResponseFilters.Add((req, resp, dto) => DisposeScope());
appHost.GlobalMessageRequestFilters.Add((req, resp, dto) => CreateScope(container));
appHost.GlobalMessageRequestFilters.Add((req, resp, dto) => DisposeScope());
}
private static void CreateScope(IContainer container)
{
var scope = container.BeginLifetimeScope(MatchingScopeLifetimeTags.RequestLifetimeScopeTag);
HostContext.RequestContext.Items["AutofacScope"] = scope;
}
private static void DisposeScope()
{
var scope = HostContext.RequestContext.Items["AutofacScope"] as IDisposable;
scope?.Dispose();
}
}
}
|
apache-2.0
|
C#
|
40d120cd2d85e23430dc9f15058957e65ad337e9
|
refresh page
|
tiagosilva1702/PreventCataclysmSystems,tiagosilva1702/PreventCataclysmSystems,tiagosilva1702/PreventCataclysmSystems,tiagosilva1702/PreventCataclysmSystems
|
web/PreventCataclysmSystems/Views/Shared/_Layout.cshtml
|
web/PreventCataclysmSystems/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Sistema de prevensão de catalcismos.">
<meta property="og:title" content="Prevent Cataclysm Systems" />
<meta property="og:url" content="https://homologacao.imap.org.br/prevent/" />
<meta property="og:description" content="Sistema de prevensão de catalcismos.">
<meta property="og:image" content="~/favicon.ico">
<meta property="og:type" content="website" />
<meta property="og:locale" content="pt_BR" />
<meta http-equiv="refresh" content="5">
<title>@ViewBag.Title - Prevent Cataclysm Systems</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Prevent Cataclysm Systems", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("Equipe", "About", "Home")</li>
<li>@Html.ActionLink("Contato", "Contact", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer class="text-muted text-center">
<p>© @DateTime.Now.Year - Prevent Cataclysm Systems</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Sistema de prevensão de catalcismos.">
<meta property="og:title" content="Prevent Cataclysm Systems" />
<meta property="og:url" content="https://homologacao.imap.org.br/prevent/" />
<meta property="og:description" content="Sistema de prevensão de catalcismos.">
<meta property="og:image" content="~/favicon.ico">
<meta property="og:type" content="website" />
<meta property="og:locale" content="pt_BR" />
<title>@ViewBag.Title - Prevent Cataclysm Systems</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Prevent Cataclysm Systems", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("Equipe", "About", "Home")</li>
<li>@Html.ActionLink("Contato", "Contact", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer class="text-muted text-center">
<p>© @DateTime.Now.Year - Prevent Cataclysm Systems</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
63056bd4fb1474077444e855edd43f2e2b45db05
|
disable fake server
|
tym32167/arma3beclient
|
src/Arma3BE.Server/ServerFactory/BattlEyeServerFactory.cs
|
src/Arma3BE.Server/ServerFactory/BattlEyeServerFactory.cs
|
using Arma3BE.Server.Abstract;
using Arma3BE.Server.Mocks;
using Arma3BE.Server.ServerDecorators;
using Arma3BEClient.Common.Logging;
using BattleNET;
namespace Arma3BE.Server.ServerFactory
{
public class BattlEyeServerFactory : IBattlEyeServerFactory
{
private readonly ILog _log;
public BattlEyeServerFactory(ILog log)
{
_log = log;
}
public IBattlEyeServer Create(BattlEyeLoginCredentials credentials)
{
return new ThreadSafeBattleEyeServer(new BattlEyeServerProxy(new BattlEyeClient(credentials)
{
ReconnectOnPacketLoss = true
}), _log);
//return new BattlEyeServerLogProxy(new MockBattleEyeServer(), _log);
}
}
}
|
using Arma3BE.Server.Abstract;
using Arma3BE.Server.Mocks;
using Arma3BEClient.Common.Logging;
using BattleNET;
namespace Arma3BE.Server.ServerFactory
{
public class BattlEyeServerFactory : IBattlEyeServerFactory
{
private readonly ILog _log;
public BattlEyeServerFactory(ILog log)
{
_log = log;
}
public IBattlEyeServer Create(BattlEyeLoginCredentials credentials)
{
//return new ThreadSafeBattleEyeServer(new BattlEyeServerProxy(new BattlEyeClient(credentials)
//{
// ReconnectOnPacketLoss = true
//}), _log);
return new BattlEyeServerLogProxy(new MockBattleEyeServer(), _log);
}
}
}
|
apache-2.0
|
C#
|
783588935826aeb142d35c0870e18da595478999
|
remove test data
|
akaSybe/Disqus.NET
|
src/Disqus.NET/Disqus.NET.Tests/DisqusTestsInitializer.cs
|
src/Disqus.NET/Disqus.NET.Tests/DisqusTestsInitializer.cs
|
using System;
using NUnit.Framework;
namespace Disqus.NET.Tests
{
public class DisqusTestsInitializer
{
private const string DisqusKey = "X06iuWTeIlPzxRByY43SXFQO3oBnFoYtJ8MHQQG6J8MOEoBiHIHJogK7A69whLs7";
protected static class TestData
{
public const string AccessToken = "";
public const string Forum = "";
public const int UserId = 0;
public const string UserName = "";
}
protected IDisqusApi Disqus;
[OneTimeSetUp]
public void OneTimeSetUp()
{
if (string.IsNullOrWhiteSpace(DisqusKey))
{
throw new ArgumentNullException(DisqusKey, "You should explicit specify Disqus Secret Key!");
}
if (string.IsNullOrWhiteSpace(TestData.AccessToken))
{
throw new ArgumentNullException(TestData.AccessToken, "You should explicit specify Disqus Access Token!");
}
Disqus = new DisqusApi(new DisqusRequestProcessor(new DisqusRestClient()), DisqusAuthMethod.SecretKey, DisqusKey);
}
}
}
|
using System;
using NUnit.Framework;
namespace Disqus.NET.Tests
{
public class DisqusTestsInitializer
{
private const string DisqusKey = "X06iuWTeIlPzxRByY43SXFQO3oBnFoYtJ8MHQQG6J8MOEoBiHIHJogK7A69whLs7";
protected static class TestData
{
public const string AccessToken = "e916bcc3ad64431aad05322db192328f";
public const string Forum = "sandbox-akasybe";
public const int UserId = 211190711;
public const string UserName = "disqus_uXBpgUxFhN";
}
protected IDisqusApi Disqus;
[OneTimeSetUp]
public void OneTimeSetUp()
{
if (string.IsNullOrWhiteSpace(DisqusKey))
{
throw new ArgumentNullException(DisqusKey, "You should explicit specify Disqus Secret Key!");
}
if (string.IsNullOrWhiteSpace(TestData.AccessToken))
{
throw new ArgumentNullException(TestData.AccessToken, "You should explicit specify Disqus Access Token!");
}
Disqus = new DisqusApi(new DisqusRequestProcessor(new DisqusRestClient()), DisqusAuthMethod.SecretKey, DisqusKey);
}
}
}
|
mit
|
C#
|
5708d5aa3d049f3b8d7ad0375bec5105dde28772
|
Add method to get current power source.
|
duplicati/duplicati,duplicati/duplicati,sitofabi/duplicati,duplicati/duplicati,duplicati/duplicati,sitofabi/duplicati,duplicati/duplicati,sitofabi/duplicati,mnaiman/duplicati,mnaiman/duplicati,mnaiman/duplicati,mnaiman/duplicati,sitofabi/duplicati,mnaiman/duplicati,sitofabi/duplicati
|
Duplicati/Library/Utility/Power/PowerSupply.cs
|
Duplicati/Library/Utility/Power/PowerSupply.cs
|
// Copyright (C) 2017, The Duplicati Team
// http://www.duplicati.com, info@duplicati.com
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
namespace Duplicati.Library.Utility.Power
{
public static class PowerSupply
{
public enum Source
{
AC,
Battery,
Unknown
}
public static Source GetSource()
{
IPowerSupplyState state;
// Since IsClientLinux returns true when on Mac OS X, we need to check IsClientOSX first.
if (Utility.IsClientOSX)
{
state = new DefaultPowerSupplyState();
}
else if (Utility.IsClientLinux)
{
state = new LinuxPowerSupplyState();
}
else
{
state = new DefaultPowerSupplyState();
}
return state.GetSource();
}
}
}
|
// Copyright (C) 2017, The Duplicati Team
// http://www.duplicati.com, info@duplicati.com
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
namespace Duplicati.Library.Utility.Power
{
public static class PowerSupply
{
public enum Source
{
AC,
Battery,
Unknown
}
}
}
|
lgpl-2.1
|
C#
|
ed0b7417d86c7d3931dd86be85cb1e5b612fb5ec
|
fix issue871 where child steps in the failed Saga container do not get retried when the suspended workflow is resumed
|
danielgerlag/workflow-core
|
src/WorkflowCore/Services/ErrorHandlers/SuspendHandler.cs
|
src/WorkflowCore/Services/ErrorHandlers/SuspendHandler.cs
|
using System;
using System.Collections.Generic;
using WorkflowCore.Interface;
using WorkflowCore.Models;
using WorkflowCore.Models.LifeCycleEvents;
namespace WorkflowCore.Services.ErrorHandlers
{
public class SuspendHandler : IWorkflowErrorHandler
{
private readonly ILifeCycleEventPublisher _eventPublisher;
private readonly IDateTimeProvider _datetimeProvider;
public WorkflowErrorHandling Type => WorkflowErrorHandling.Suspend;
public SuspendHandler(ILifeCycleEventPublisher eventPublisher, IDateTimeProvider datetimeProvider)
{
_eventPublisher = eventPublisher;
_datetimeProvider = datetimeProvider;
}
public void Handle(WorkflowInstance workflow, WorkflowDefinition def, ExecutionPointer pointer, WorkflowStep step, Exception exception, Queue<ExecutionPointer> bubbleUpQueue)
{
workflow.Status = WorkflowStatus.Suspended;
_eventPublisher.PublishNotification(new WorkflowSuspended
{
EventTimeUtc = _datetimeProvider.UtcNow,
Reference = workflow.Reference,
WorkflowInstanceId = workflow.Id,
WorkflowDefinitionId = workflow.WorkflowDefinitionId,
Version = workflow.Version
});
step.PrimeForRetry(pointer);
}
}
}
|
using System;
using System.Collections.Generic;
using WorkflowCore.Interface;
using WorkflowCore.Models;
using WorkflowCore.Models.LifeCycleEvents;
namespace WorkflowCore.Services.ErrorHandlers
{
public class SuspendHandler : IWorkflowErrorHandler
{
private readonly ILifeCycleEventPublisher _eventPublisher;
private readonly IDateTimeProvider _datetimeProvider;
public WorkflowErrorHandling Type => WorkflowErrorHandling.Suspend;
public SuspendHandler(ILifeCycleEventPublisher eventPublisher, IDateTimeProvider datetimeProvider)
{
_eventPublisher = eventPublisher;
_datetimeProvider = datetimeProvider;
}
public void Handle(WorkflowInstance workflow, WorkflowDefinition def, ExecutionPointer pointer, WorkflowStep step, Exception exception, Queue<ExecutionPointer> bubbleUpQueue)
{
workflow.Status = WorkflowStatus.Suspended;
_eventPublisher.PublishNotification(new WorkflowSuspended
{
EventTimeUtc = _datetimeProvider.UtcNow,
Reference = workflow.Reference,
WorkflowInstanceId = workflow.Id,
WorkflowDefinitionId = workflow.WorkflowDefinitionId,
Version = workflow.Version
});
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.