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 |
---|---|---|---|---|---|---|---|---|
2e3450b3f58e4290289194c0fd58ecf28fe3931c
|
Make Mods readonly
|
smoogipoo/osu,peppy/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu,peppy/osu-new
|
osu.Game/Screens/Play/GameplayState.cs
|
osu.Game/Screens/Play/GameplayState.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods;
#nullable enable
namespace osu.Game.Screens.Play
{
/// <summary>
/// The state of an active gameplay session, generally constructed and exposed by <see cref="Player"/>.
/// </summary>
public class GameplayState
{
/// <summary>
/// The final post-convert post-mod-application beatmap.
/// </summary>
public readonly IBeatmap Beatmap;
/// <summary>
/// The ruleset used in gameplay.
/// </summary>
public readonly Ruleset Ruleset;
/// <summary>
/// The mods applied to the gameplay.
/// </summary>
public readonly IReadOnlyList<Mod> Mods;
/// <summary>
/// A bindable tracking the last judgement result applied to any hit object.
/// </summary>
public IBindable<JudgementResult> LastJudgementResult => lastJudgementResult;
private readonly Bindable<JudgementResult> lastJudgementResult = new Bindable<JudgementResult>();
public GameplayState(IBeatmap beatmap, Ruleset ruleset, IReadOnlyList<Mod> mods)
{
Beatmap = beatmap;
Ruleset = ruleset;
Mods = mods;
}
/// <summary>
/// Applies the score change of a <see cref="JudgementResult"/> to this <see cref="GameplayState"/>.
/// </summary>
/// <param name="result">The <see cref="JudgementResult"/> to apply.</param>
public void ApplyResult(JudgementResult result) => lastJudgementResult.Value = result;
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods;
#nullable enable
namespace osu.Game.Screens.Play
{
/// <summary>
/// The state of an active gameplay session, generally constructed and exposed by <see cref="Player"/>.
/// </summary>
public class GameplayState
{
/// <summary>
/// The final post-convert post-mod-application beatmap.
/// </summary>
public readonly IBeatmap Beatmap;
/// <summary>
/// The ruleset used in gameplay.
/// </summary>
public readonly Ruleset Ruleset;
/// <summary>
/// The mods applied to the gameplay.
/// </summary>
public IReadOnlyList<Mod> Mods;
/// <summary>
/// A bindable tracking the last judgement result applied to any hit object.
/// </summary>
public IBindable<JudgementResult> LastJudgementResult => lastJudgementResult;
private readonly Bindable<JudgementResult> lastJudgementResult = new Bindable<JudgementResult>();
public GameplayState(IBeatmap beatmap, Ruleset ruleset, IReadOnlyList<Mod> mods)
{
Beatmap = beatmap;
Ruleset = ruleset;
Mods = mods;
}
/// <summary>
/// Applies the score change of a <see cref="JudgementResult"/> to this <see cref="GameplayState"/>.
/// </summary>
/// <param name="result">The <see cref="JudgementResult"/> to apply.</param>
public void ApplyResult(JudgementResult result) => lastJudgementResult.Value = result;
}
}
|
mit
|
C#
|
41441771ae2d4cb0bc95ecceef32b3a8d2b19593
|
Remove unnecessary cast
|
peppy/osu,UselessToucan/osu,EVAST9919/osu,naoey/osu,peppy/osu-new,ppy/osu,DrabWeb/osu,ZLima12/osu,ppy/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,naoey/osu,smoogipoo/osu,ppy/osu,ZLima12/osu,DrabWeb/osu,smoogipoo/osu,smoogipoo/osu,EVAST9919/osu,2yangk23/osu,smoogipooo/osu,DrabWeb/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu,johnneijzen/osu,johnneijzen/osu,NeoAdonis/osu,UselessToucan/osu,naoey/osu
|
osu.Game/Tests/Platform/TestStorage.cs
|
osu.Game/Tests/Platform/TestStorage.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Platform;
namespace osu.Game.Tests.Platform
{
public class TestStorage : DesktopStorage
{
public TestStorage(string baseName)
: base(baseName, null)
{
}
public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{name}.db", true);
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Platform;
namespace osu.Game.Tests.Platform
{
public class TestStorage : DesktopStorage
{
public TestStorage(string baseName)
: base(baseName, null)
{
}
public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{(object)name}.db", true);
}
}
|
mit
|
C#
|
7226ccc229019b84de268fc71bd517eae24bc1a2
|
Kill off another host watchdog test
|
tgstation/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server-tools
|
tests/Tgstation.Server.Host.Watchdog.Tests/TestWatchdog.cs
|
tests/Tgstation.Server.Host.Watchdog.Tests/TestWatchdog.cs
|
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Host.Startup;
namespace Tgstation.Server.Host.Watchdog.Tests
{
[TestClass]
public sealed class TestWatchdog
{
[TestMethod]
public void TestConstruction()
{
Assert.ThrowsException<ArgumentNullException>(() => new Watchdog(null, null, null));
var mockActiveAssemblyDeleter = new Mock<IActiveLibraryDeleter>();
Assert.ThrowsException<ArgumentNullException>(() => new Watchdog(mockActiveAssemblyDeleter.Object, null, null));
var mockIsolatedServerContextFactory = new Mock<IIsolatedAssemblyContextFactory>();
Assert.ThrowsException<ArgumentNullException>(() => new Watchdog(mockActiveAssemblyDeleter.Object, mockIsolatedServerContextFactory.Object, null));
var mockLogger = new LoggerFactory().CreateLogger<Watchdog>();
var wd = new Watchdog(mockActiveAssemblyDeleter.Object, mockIsolatedServerContextFactory.Object, mockLogger);
}
}
}
|
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Host.Startup;
namespace Tgstation.Server.Host.Watchdog.Tests
{
[TestClass]
public sealed class TestWatchdog
{
[TestMethod]
public void TestConstruction()
{
Assert.ThrowsException<ArgumentNullException>(() => new Watchdog(null, null, null));
var mockActiveAssemblyDeleter = new Mock<IActiveLibraryDeleter>();
Assert.ThrowsException<ArgumentNullException>(() => new Watchdog(mockActiveAssemblyDeleter.Object, null, null));
var mockIsolatedServerContextFactory = new Mock<IIsolatedAssemblyContextFactory>();
Assert.ThrowsException<ArgumentNullException>(() => new Watchdog(mockActiveAssemblyDeleter.Object, mockIsolatedServerContextFactory.Object, null));
var mockLogger = new LoggerFactory().CreateLogger<Watchdog>();
var wd = new Watchdog(mockActiveAssemblyDeleter.Object, mockIsolatedServerContextFactory.Object, mockLogger);
}
class MockServerFactory : IServerFactory
{
readonly IServer server;
public MockServerFactory(IServer server) => this.server = server;
public IServer CreateServer(string[] args, string updatePath) => server;
}
[TestMethod]
public async Task TestRunAsyncWithoutUpdate()
{
var mockServer = new Mock<IServer>();
var mockServerFactory = new MockServerFactory(mockServer.Object);
var mockActiveAssemblyDeleter = new Mock<IActiveLibraryDeleter>();
var mockIsolatedServerContextFactory = new Mock<IIsolatedAssemblyContextFactory>();
var mockLogger = new LoggerFactory().CreateLogger<Watchdog>();
var wd = new Watchdog(mockActiveAssemblyDeleter.Object, mockIsolatedServerContextFactory.Object, mockLogger);
using (var cts = new CancellationTokenSource())
{
mockServer.Setup(x => x.RunAsync(cts.Token)).Returns(Task.CompletedTask).Verifiable();
await wd.RunAsync(Array.Empty<string>(), cts.Token).ConfigureAwait(false);
mockServer.VerifyAll();
}
}
}
}
|
agpl-3.0
|
C#
|
da255ff9db89ae98dbaae23d54a264bb50df2817
|
Make `TestProject.GetProjectDirectory` more thorough when finding project directory.
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestProject.cs
|
test/Microsoft.AspNetCore.Razor.Test.Common/Language/TestProject.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using Microsoft.AspNetCore.Testing;
namespace Microsoft.AspNetCore.Razor.Language
{
public static class TestProject
{
public static string GetProjectDirectory(Type type)
{
var solutionDir = TestPathUtilities.GetSolutionRootDirectory("Razor");
var assemblyName = type.Assembly.GetName().Name;
var projectDirectory = Path.Combine(solutionDir, "test", assemblyName);
if (!Directory.Exists(projectDirectory))
{
throw new InvalidOperationException(
$@"Could not locate project directory for type {type.FullName}.
Directory probe path: {projectDirectory}.");
}
return projectDirectory;
}
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Reflection;
namespace Microsoft.AspNetCore.Razor.Language
{
public static class TestProject
{
public static string GetProjectDirectory(Type type)
{
var currentDirectory = new DirectoryInfo(AppContext.BaseDirectory);
var name = type.GetTypeInfo().Assembly.GetName().Name;
while (currentDirectory != null &&
!string.Equals(currentDirectory.Name, name, StringComparison.Ordinal))
{
currentDirectory = currentDirectory.Parent;
}
return currentDirectory.FullName;
}
}
}
|
apache-2.0
|
C#
|
74440dcfdcc35fa847ecafe1d577f618a7d2b34b
|
Make the cursors click every so often
|
johnneijzen/osu,2yangk23/osu,ZLima12/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,EVAST9919/osu,johnneijzen/osu,2yangk23/osu,smoogipoo/osu,EVAST9919/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,ZLima12/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,peppy/osu
|
osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs
|
osu.Game.Rulesets.Osu.Tests/TestSceneGameplayCursor.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing.Input;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class TestSceneGameplayCursor : SkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(CursorTrail) };
[BackgroundDependencyLoader]
private void load()
{
SetContents(() => new MovingCursorInputManager
{
Child = new ClickingCursorContainer
{
RelativeSizeAxes = Axes.Both,
Masking = true,
}
});
}
private class ClickingCursorContainer : OsuCursorContainer
{
protected override void Update()
{
base.Update();
double currentTime = Time.Current;
if (((int)(currentTime / 1000)) % 2 == 0)
OnPressed(OsuAction.LeftButton);
else
OnReleased(OsuAction.LeftButton);
}
}
private class MovingCursorInputManager : ManualInputManager
{
public MovingCursorInputManager()
{
UseParentInput = false;
}
protected override void Update()
{
base.Update();
const double spin_duration = 5000;
double currentTime = Time.Current;
double angle = (currentTime % spin_duration) / spin_duration * 2 * Math.PI;
Vector2 rPos = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));
MoveMouseTo(ToScreenSpace(DrawSize / 2 + DrawSize / 3 * rPos));
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing.Input;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class TestSceneGameplayCursor : SkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(CursorTrail) };
[BackgroundDependencyLoader]
private void load()
{
SetContents(() => new MovingCursorInputManager
{
Child = new OsuCursorContainer
{
RelativeSizeAxes = Axes.Both,
Masking = true,
}
});
}
private class MovingCursorInputManager : ManualInputManager
{
public MovingCursorInputManager()
{
UseParentInput = false;
}
protected override void Update()
{
base.Update();
const double spin_duration = 5000;
double currentTime = Time.Current;
double angle = (currentTime % spin_duration) / spin_duration * 2 * Math.PI;
Vector2 rPos = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));
MoveMouseTo(ToScreenSpace(DrawSize / 2 + DrawSize / 3 * rPos));
}
}
}
}
|
mit
|
C#
|
76080368e900f2b866f46235eebff0f7bda19a6d
|
Mark test as headless
|
NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu-new,smoogipoo/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu
|
osu.Game.Rulesets.Taiko.Tests/TestSceneSampleOutput.cs
|
osu.Game.Rulesets.Taiko.Tests/TestSceneSampleOutput.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.Linq;
using osu.Framework.Testing;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Taiko.Tests
{
/// <summary>
/// Taiko has some interesting rules for legacy mappings.
/// </summary>
[HeadlessTest]
public class TestSceneSampleOutput : PlayerTestScene
{
public TestSceneSampleOutput()
: base(new TaikoRuleset())
{
}
public override void SetUpSteps()
{
base.SetUpSteps();
AddAssert("has correct samples", () =>
{
var names = Player.DrawableRuleset.Playfield.AllHitObjects.OfType<DrawableHit>().Select(h => string.Join(',', h.GetSamples().Select(s => s.Name)));
var expected = new[]
{
string.Empty,
string.Empty,
string.Empty,
string.Empty,
HitSampleInfo.HIT_FINISH,
HitSampleInfo.HIT_WHISTLE,
HitSampleInfo.HIT_WHISTLE,
HitSampleInfo.HIT_WHISTLE,
};
return names.SequenceEqual(expected);
});
}
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TaikoBeatmapConversionTest().GetBeatmap("sample-to-type-conversions");
}
}
|
// 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.Linq;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Taiko.Tests
{
/// <summary>
/// Taiko has some interesting rules for legacy mappings.
/// </summary>
public class TestSceneSampleOutput : PlayerTestScene
{
public TestSceneSampleOutput()
: base(new TaikoRuleset())
{
}
public override void SetUpSteps()
{
base.SetUpSteps();
AddAssert("has correct samples", () =>
{
var names = Player.DrawableRuleset.Playfield.AllHitObjects.OfType<DrawableHit>().Select(h => string.Join(',', h.GetSamples().Select(s => s.Name)));
var expected = new[]
{
string.Empty,
string.Empty,
string.Empty,
string.Empty,
HitSampleInfo.HIT_FINISH,
HitSampleInfo.HIT_WHISTLE,
HitSampleInfo.HIT_WHISTLE,
HitSampleInfo.HIT_WHISTLE,
};
return names.SequenceEqual(expected);
});
}
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TaikoBeatmapConversionTest().GetBeatmap("sample-to-type-conversions");
}
}
|
mit
|
C#
|
345352be6757ab9225df004307e07a48de2523dd
|
Mark PerformUpdate as an instant handle method (doesn't really help with anything)
|
smoogipoo/osu,NeoAdonis/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,peppy/osu-new,UselessToucan/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu
|
osu.Game/Online/RealtimeMultiplayer/MultiplayerRoom.cs
|
osu.Game/Online/RealtimeMultiplayer/MultiplayerRoom.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.
#nullable enable
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
namespace osu.Game.Online.RealtimeMultiplayer
{
/// <summary>
/// A multiplayer room.
/// </summary>
[Serializable]
public class MultiplayerRoom
{
/// <summary>
/// The ID of the room, used for database persistence.
/// </summary>
public readonly long RoomID;
/// <summary>
/// The current state of the room (ie. whether it is in progress or otherwise).
/// </summary>
public MultiplayerRoomState State { get; set; }
/// <summary>
/// All currently enforced game settings for this room.
/// </summary>
public MultiplayerRoomSettings Settings { get; set; } = MultiplayerRoomSettings.Empty();
/// <summary>
/// All users currently in this room.
/// </summary>
public List<MultiplayerRoomUser> Users { get; set; } = new List<MultiplayerRoomUser>();
/// <summary>
/// The host of this room, in control of changing room settings.
/// </summary>
public MultiplayerRoomUser? Host { get; set; }
private object writeLock = new object();
public MultiplayerRoom(in long roomId)
{
RoomID = roomId;
}
/// <summary>
/// Perform an update on this room in a thread-safe manner.
/// </summary>
/// <param name="action">The action to perform.</param>
public void PerformUpdate([InstantHandle] Action<MultiplayerRoom> action)
{
lock (writeLock) action(this);
}
}
}
|
// 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.
#nullable enable
using System;
using System.Collections.Generic;
namespace osu.Game.Online.RealtimeMultiplayer
{
/// <summary>
/// A multiplayer room.
/// </summary>
[Serializable]
public class MultiplayerRoom
{
/// <summary>
/// The ID of the room, used for database persistence.
/// </summary>
public readonly long RoomID;
/// <summary>
/// The current state of the room (ie. whether it is in progress or otherwise).
/// </summary>
public MultiplayerRoomState State { get; set; }
/// <summary>
/// All currently enforced game settings for this room.
/// </summary>
public MultiplayerRoomSettings Settings { get; set; } = MultiplayerRoomSettings.Empty();
/// <summary>
/// All users currently in this room.
/// </summary>
public List<MultiplayerRoomUser> Users { get; set; } = new List<MultiplayerRoomUser>();
/// <summary>
/// The host of this room, in control of changing room settings.
/// </summary>
public MultiplayerRoomUser? Host { get; set; }
private object writeLock = new object();
public MultiplayerRoom(in long roomId)
{
RoomID = roomId;
}
/// <summary>
/// Perform an update on this room in a thread-safe manner.
/// </summary>
/// <param name="action">The action to perform.</param>
public void PerformUpdate(Action<MultiplayerRoom> action)
{
lock (writeLock) action(this);
}
}
}
|
mit
|
C#
|
c44370c75e14fc38600dd9488494b06c0be907ca
|
Add services to DI
|
ronaldme/Watcher,ronaldme/Watcher,ronaldme/Watcher
|
Watcher.Service/Program.cs
|
Watcher.Service/Program.cs
|
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Watcher.Common;
using Watcher.DAL;
using Watcher.Service.API;
using Watcher.Service.Services;
using Watcher.Service.Services.Notifiers;
namespace Watcher.Service
{
class Program
{
static void Main(string[] args)
{
CreateHostBuilder(args)
.UseWindowsService()
.Build()
.Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<WatcherService>();
services.AddDbContext<WatcherDbContext>();
services.AddSingleton<INotifyScheduler, NotifyScheduler>();
services.AddSingleton<ITheMovieDb, TheMovieDb>();
services.AddTransient< IUpdateService, UpdateService>();
var config = hostContext.Configuration;
services.Configure<AppSettings>(config.GetSection("AppSettings"));
services.Configure<ConnectionString>(config.GetSection("ConnectionStrings"));
})
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
logging.SetMinimumLevel(LogLevel.Debug);
});
}
}
|
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Watcher.Common;
using Watcher.DAL;
using Watcher.Service.Services;
using Watcher.Service.Services.Notifiers;
namespace Watcher.Service
{
class Program
{
static void Main(string[] args)
{
CreateHostBuilder(args)
.UseWindowsService()
.Build()
.Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<WatcherService>();
services.AddDbContext<WatcherDbContext>();
services.AddSingleton<INotifyScheduler, NotifyScheduler>();
var config = hostContext.Configuration;
services.Configure<AppSettings>(config.GetSection("AppSettings"));
services.Configure<ConnectionString>(config.GetSection("ConnectionStrings"));
})
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
logging.SetMinimumLevel(LogLevel.Debug);
});
}
}
|
mit
|
C#
|
c54a4ea61b7724974a541d5ab28721e99e46b153
|
Fix for several handlers for one message in projection group
|
linkelf/GridDomain,andreyleskov/GridDomain
|
GridDomain.CQRS.Messaging/MessageRouting/ProjectionGroup.cs
|
GridDomain.CQRS.Messaging/MessageRouting/ProjectionGroup.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace GridDomain.CQRS.Messaging.MessageRouting
{
public class ProjectionGroup: IProjectionGroup
{
private readonly IServiceLocator _locator;
readonly Dictionary<Type, List<Action<object>>> _handlers = new Dictionary<Type, List<Action<object>>>();
public ProjectionGroup(IServiceLocator locator)
{
_locator = locator;
}
public void Add<TMessage, THandler>(string correlationPropertyName ) where THandler : IHandler<TMessage>
{
var handler = _locator.Resolve<THandler>();
List<Action<object>> builderList;
if (!_handlers.TryGetValue(typeof (TMessage), out builderList))
{
builderList = new List<Action<object>>();
_handlers[typeof (TMessage)] = builderList;
}
builderList.Add(o => handler.Handle((TMessage) o));
if(_acceptMessages.All(m => m.MessageType != typeof (TMessage)))
_acceptMessages.Add(new MessageRoute(typeof(TMessage), correlationPropertyName));
}
public void Project(object message)
{
var msgType = message.GetType();
foreach(var handler in _handlers[msgType])
handler(message);
}
private readonly List<MessageRoute> _acceptMessages = new List<MessageRoute>();
public IReadOnlyCollection<MessageRoute> AcceptMessages => _acceptMessages;
}
}
|
using System;
using System.Collections.Generic;
namespace GridDomain.CQRS.Messaging.MessageRouting
{
public class ProjectionGroup: IProjectionGroup
{
private readonly IServiceLocator _locator;
readonly Dictionary<Type, List<Action<object>>> _handlers = new Dictionary<Type, List<Action<object>>>();
public ProjectionGroup(IServiceLocator locator)
{
_locator = locator;
}
public void Add<TMessage, THandler>(string correlationPropertyName ) where THandler : IHandler<TMessage>
{
var handler = _locator.Resolve<THandler>();
List<Action<object>> builderList;
if (!_handlers.TryGetValue(typeof (TMessage), out builderList))
{
builderList = new List<Action<object>>();
_handlers[typeof (TMessage)] = builderList;
}
builderList.Add(o => handler.Handle((TMessage) o));
_acceptMessages.Add(new MessageRoute(typeof(TMessage), correlationPropertyName));
}
public void Project(object message)
{
var msgType = message.GetType();
foreach(var handler in _handlers[msgType])
handler(message);
}
private readonly List<MessageRoute> _acceptMessages = new List<MessageRoute>();
public IReadOnlyCollection<MessageRoute> AcceptMessages => _acceptMessages;
}
}
|
apache-2.0
|
C#
|
24e546d1b52ac0bbcc4d2a9d5f7f10d432f1fdd2
|
Revert accidental change
|
pharring/xunit-performance,Microsoft/xunit-performance,mmitche/xunit-performance,visia/xunit-performance,ianhays/xunit-performance,Microsoft/xunit-performance,ericeil/xunit-performance
|
src/common/GlobalAssemblyInfo.cs
|
src/common/GlobalAssemblyInfo.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Reflection;
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("xUnit Performance Testing Framework")]
[assembly: AssemblyCopyright("Copyright \u00A9 Microsoft Corporation 2015")]
[assembly: AssemblyVersion("99.99.99.0")]
[assembly: AssemblyInformationalVersion("99.99.99-dev")]
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Reflection;
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("xUnit Performance Testing Framework")]
[assembly: AssemblyCopyright("Copyright \u00A9 Microsoft Corporation 2015")]
[assembly: AssemblyVersion("1.0.0.14")]
[assembly: AssemblyInformationalVersion("1.0.0-alpha-build0014")]
|
mit
|
C#
|
09538d70f007e497e45fca5ef0f2ccc683ccc37b
|
test fixed
|
Softlr/Selenium.WebDriver.Extensions
|
test/Selenium.WebDriver.Extensions.Tests/ByTests.cs
|
test/Selenium.WebDriver.Extensions.Tests/ByTests.cs
|
namespace Selenium.WebDriver.Extensions.Tests
{
using System.Diagnostics.CodeAnalysis;
using AutoFixture;
using FluentAssertions;
using Xunit;
using static By;
using static Shared.Trait;
using SeleniumBy = OpenQA.Selenium.By;
[Trait(CATEGORY, UNIT)]
[ExcludeFromCodeCoverage]
public class ByTests
{
private static readonly IFixture _fixture = new Fixture();
public static TheoryData<SeleniumBy> CoreSelectors
{
get
{
return new TheoryData<SeleniumBy>
{
ClassName($"{nameof(ClassName)}{_fixture.Create<string>()}"),
CssSelector(_fixture.Create<string>()),
Id(_fixture.Create<string>()),
LinkText(_fixture.Create<string>()),
Name(_fixture.Create<string>()),
PartialLinkText(_fixture.Create<string>()),
TagName(_fixture.Create<string>()),
XPath(_fixture.Create<string>())
};
}
}
[Theory]
[MemberData(nameof(CoreSelectors))]
public void Selector_creation_works(SeleniumBy sut) => sut.Should().NotBeNull();
}
}
|
namespace Selenium.WebDriver.Extensions.Tests
{
using System.Diagnostics.CodeAnalysis;
using AutoFixture;
using FluentAssertions;
using Xunit;
using static By;
using static Shared.Trait;
using SeleniumBy = OpenQA.Selenium.By;
[Trait(CATEGORY, UNIT)]
[ExcludeFromCodeCoverage]
public class ByTests
{
private static readonly IFixture _fixture = new Fixture();
public static TheoryData<SeleniumBy> CoreSelectors
{
get
{
return new TheoryData<SeleniumBy>
{
ClassName(_fixture.Create<string>()),
CssSelector(_fixture.Create<string>()),
Id(_fixture.Create<string>()),
LinkText(_fixture.Create<string>()),
Name(_fixture.Create<string>()),
PartialLinkText(_fixture.Create<string>()),
TagName(_fixture.Create<string>()),
XPath(_fixture.Create<string>())
};
}
}
[Theory]
[MemberData(nameof(CoreSelectors))]
public void Selector_creation_works(SeleniumBy sut) => sut.Should().NotBeNull();
}
}
|
apache-2.0
|
C#
|
7cebd84f531ddcc95e17f3b44a649f68ac3686d6
|
Rename CapDatabaseStorageMarkerService to CapStorageMarkerService
|
ouraspnet/cap,dotnetcore/CAP,dotnetcore/CAP,dotnetcore/CAP
|
src/DotNetCore.CAP.InMemoryStorage/CAP.InMemoryCapOptionsExtension.cs
|
src/DotNetCore.CAP.InMemoryStorage/CAP.InMemoryCapOptionsExtension.cs
|
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using DotNetCore.CAP.InMemoryStorage;
using DotNetCore.CAP.Processor;
using Microsoft.Extensions.DependencyInjection;
// ReSharper disable once CheckNamespace
namespace DotNetCore.CAP
{
internal class InMemoryCapOptionsExtension : ICapOptionsExtension
{
public void AddServices(IServiceCollection services)
{
services.AddSingleton<CapStorageMarkerService>();
services.AddSingleton<IStorage, InMemoryStorage.InMemoryStorage>();
services.AddSingleton<IStorageConnection, InMemoryStorageConnection>();
services.AddSingleton<ICapPublisher, InMemoryPublisher>();
services.AddSingleton<ICallbackPublisher, InMemoryPublisher>();
services.AddTransient<ICollectProcessor, InMemoryCollectProcessor>();
services.AddTransient<CapTransactionBase, InMemoryCapTransaction>();
}
}
}
|
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using DotNetCore.CAP.InMemoryStorage;
using DotNetCore.CAP.Processor;
using Microsoft.Extensions.DependencyInjection;
// ReSharper disable once CheckNamespace
namespace DotNetCore.CAP
{
internal class InMemoryCapOptionsExtension : ICapOptionsExtension
{
public void AddServices(IServiceCollection services)
{
services.AddSingleton<CapDatabaseStorageMarkerService>();
services.AddSingleton<IStorage, InMemoryStorage.InMemoryStorage>();
services.AddSingleton<IStorageConnection, InMemoryStorageConnection>();
services.AddSingleton<ICapPublisher, InMemoryPublisher>();
services.AddSingleton<ICallbackPublisher, InMemoryPublisher>();
services.AddTransient<ICollectProcessor, InMemoryCollectProcessor>();
services.AddTransient<CapTransactionBase, InMemoryCapTransaction>();
}
}
}
|
mit
|
C#
|
817701d2596d07bc51e0e96438905233b8b3bbe0
|
Add docs
|
jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,mavasani/roslyn,weltkante/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,dotnet/roslyn,mavasani/roslyn,mavasani/roslyn
|
src/Features/Core/Portable/InheritanceMargin/InheritanceMarginItem.cs
|
src/Features/Core/Portable/InheritanceMargin/InheritanceMarginItem.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.CodeAnalysis.InheritanceMargin
{
internal readonly struct InheritanceMarginItem
{
/// <summary>
/// Line number used to show the margin for the member.
/// </summary>
public readonly int LineNumber;
/// <summary>
/// Special display text to show when showing the 'hover' tip for a margin item. Used to override the default
/// text we show that says "'X' is inherited". Used currently for showing information about top-level-imports.
/// </summary>
public readonly string? TopLevelDisplayText;
/// <summary>
/// Display texts for this member.
/// </summary>
public readonly ImmutableArray<TaggedText> DisplayTexts;
/// <summary>
/// Member's glyph.
/// </summary>
public readonly Glyph Glyph;
/// <summary>
/// Whether or not TargetItems is already ordered.
/// </summary>
public readonly bool IsOrdered;
/// <summary>
/// An array of the implementing/implemented/overriding/overridden targets for this member.
/// </summary>
public readonly ImmutableArray<InheritanceTargetItem> TargetItems;
public InheritanceMarginItem(
int lineNumber,
string? topLevelDisplayText,
ImmutableArray<TaggedText> displayTexts,
Glyph glyph,
bool isOrdered,
ImmutableArray<InheritanceTargetItem> targetItems)
{
LineNumber = lineNumber;
TopLevelDisplayText = topLevelDisplayText;
DisplayTexts = displayTexts;
Glyph = glyph;
IsOrdered = isOrdered;
TargetItems = isOrdered ? targetItems : targetItems.OrderBy(item => item.DisplayName).ToImmutableArray();
}
public static async ValueTask<InheritanceMarginItem> ConvertAsync(
Solution solution,
SerializableInheritanceMarginItem serializableItem,
CancellationToken cancellationToken)
{
var targetItems = await serializableItem.TargetItems.SelectAsArrayAsync(
(item, _) => InheritanceTargetItem.ConvertAsync(solution, item, cancellationToken), cancellationToken).ConfigureAwait(false);
return new InheritanceMarginItem(
serializableItem.LineNumber, serializableItem.TopLevelDisplayText, serializableItem.DisplayTexts, serializableItem.Glyph, serializableItem.IsOrdered, targetItems);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.CodeAnalysis.InheritanceMargin
{
internal readonly struct InheritanceMarginItem
{
/// <summary>
/// Line number used to show the margin for the member.
/// </summary>
public readonly int LineNumber;
public readonly string? TopLevelDisplayText;
/// <summary>
/// Display texts for this member.
/// </summary>
public readonly ImmutableArray<TaggedText> DisplayTexts;
/// <summary>
/// Member's glyph.
/// </summary>
public readonly Glyph Glyph;
/// <summary>
/// An array of the implementing/implemented/overriding/overridden targets for this member.
/// </summary>
public readonly ImmutableArray<InheritanceTargetItem> TargetItems;
public InheritanceMarginItem(
int lineNumber,
string? topLevelDisplayText,
ImmutableArray<TaggedText> displayTexts,
Glyph glyph,
bool isOrdered,
ImmutableArray<InheritanceTargetItem> targetItems)
{
LineNumber = lineNumber;
TopLevelDisplayText = topLevelDisplayText;
DisplayTexts = displayTexts;
Glyph = glyph;
TargetItems = isOrdered ? targetItems : targetItems.OrderBy(item => item.DisplayName).ToImmutableArray();
}
public static async ValueTask<InheritanceMarginItem> ConvertAsync(
Solution solution,
SerializableInheritanceMarginItem serializableItem,
CancellationToken cancellationToken)
{
var targetItems = await serializableItem.TargetItems.SelectAsArrayAsync(
(item, _) => InheritanceTargetItem.ConvertAsync(solution, item, cancellationToken), cancellationToken).ConfigureAwait(false);
return new InheritanceMarginItem(
serializableItem.LineNumber, serializableItem.TopLevelDisplayText, serializableItem.DisplayTexts, serializableItem.Glyph, serializableItem.IsOrdered, targetItems);
}
}
}
|
mit
|
C#
|
610a1c7b8fddceb0dcee2f395a15d1a904a76f51
|
Use await um command tests
|
takenet/messaginghub-client-csharp
|
src/Takenet.MessagingHub.Client.Test/MessagingHubClientTests_SendCommand.cs
|
src/Takenet.MessagingHub.Client.Test/MessagingHubClientTests_SendCommand.cs
|
using Lime.Protocol;
using NSubstitute;
using NUnit.Framework;
using Shouldly;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Takenet.MessagingHub.Client.Test
{
[TestFixture]
internal class MessagingHubClientTests_SendCommand : MessagingHubClientTestBase
{
[SetUp]
protected override void Setup()
{
base.Setup();
}
[TearDown]
protected override void TearDown()
{
base.TearDown();
}
[Test]
public async Task Send_Command_And_Receive_Response_With_Success()
{
//Arrange
var commandId = Guid.NewGuid();
var commandResponse = new Command
{
Id = commandId,
Status = CommandStatus.Success,
};
ClientChannel.ProcessCommandAsync(null, CancellationToken.None).ReturnsForAnyArgs(commandResponse);
await MessagingHubClient.StartAsync();
//Act
var result = await MessagingHubClient.SendCommandAsync(new Command { Id = commandId });
await Task.Delay(TIME_OUT);
//Assert
ClientChannel.ReceivedWithAnyArgs().ReceiveCommandAsync(CancellationToken.None);
result.ShouldNotBeNull();
result.Status.ShouldBe(CommandStatus.Success);
result.Id.ShouldBe(commandId);
}
[Test]
public void Send_Command_Without_Start_Should_Throw_Exception()
{
//Act / Assert
Should.ThrowAsync<InvalidOperationException>(async () => await MessagingHubClient.SendCommandAsync(Arg.Any<Command>()).ConfigureAwait(false)).Wait();
}
}
}
|
using Lime.Protocol;
using NSubstitute;
using NUnit.Framework;
using Shouldly;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Takenet.MessagingHub.Client.Test
{
[TestFixture]
internal class MessagingHubClientTests_SendCommand : MessagingHubClientTestBase
{
[SetUp]
protected override void Setup()
{
base.Setup();
}
[TearDown]
protected override void TearDown()
{
base.TearDown();
}
[Test]
public async Task Send_Command_And_Receive_Response_With_Success()
{
//Arrange
var commandId = Guid.NewGuid();
var commandResponse = new Command
{
Id = commandId,
Status = CommandStatus.Success,
};
ClientChannel.ProcessCommandAsync(null, CancellationToken.None).ReturnsForAnyArgs(commandResponse);
await MessagingHubClient.StartAsync();
//Act
var result = MessagingHubClient.SendCommandAsync(new Command { Id = commandId }).Result;
//Assert
ClientChannel.ReceivedWithAnyArgs().ReceiveCommandAsync(CancellationToken.None);
result.ShouldNotBeNull();
result.Status.ShouldBe(CommandStatus.Success);
result.Id.ShouldBe(commandId);
}
[Test]
public void Send_Command_Without_Start_Should_Throw_Exception()
{
//Act / Assert
Should.ThrowAsync<InvalidOperationException>(async () => await MessagingHubClient.SendCommandAsync(Arg.Any<Command>()).ConfigureAwait(false)).Wait();
}
}
}
|
apache-2.0
|
C#
|
6596d12a4226ad246f0cade5024f630219ca9a85
|
add public key
|
gubookgu/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,gubookgu/azure-sdk-for-net,hovsepm/azure-sdk-for-net,gubookgu/azure-sdk-for-net,herveyw/azure-sdk-for-net,vladca/azure-sdk-for-net,ailn/azure-sdk-for-net,nacaspi/azure-sdk-for-net,pomortaz/azure-sdk-for-net,hovsepm/azure-sdk-for-net,Nilambari/azure-sdk-for-net,juvchan/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,oburlacu/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,bgold09/azure-sdk-for-net,nemanja88/azure-sdk-for-net,rohmano/azure-sdk-for-net,nemanja88/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,ailn/azure-sdk-for-net,bgold09/azure-sdk-for-net,pomortaz/azure-sdk-for-net,ailn/azure-sdk-for-net,nacaspi/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,rohmano/azure-sdk-for-net,dasha91/azure-sdk-for-net,rohmano/azure-sdk-for-net,abhing/azure-sdk-for-net,vladca/azure-sdk-for-net,nemanja88/azure-sdk-for-net,bgold09/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,pattipaka/azure-sdk-for-net,pattipaka/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,jtlibing/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,Nilambari/azure-sdk-for-net,shuagarw/azure-sdk-for-net,oburlacu/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,abhing/azure-sdk-for-net,abhing/azure-sdk-for-net,AuxMon/azure-sdk-for-net,shuagarw/azure-sdk-for-net,AuxMon/azure-sdk-for-net,juvchan/azure-sdk-for-net,herveyw/azure-sdk-for-net,shuagarw/azure-sdk-for-net,pattipaka/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,naveedaz/azure-sdk-for-net,jtlibing/azure-sdk-for-net,juvchan/azure-sdk-for-net,oburlacu/azure-sdk-for-net,dasha91/azure-sdk-for-net,vladca/azure-sdk-for-net,herveyw/azure-sdk-for-net,Nilambari/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,hovsepm/azure-sdk-for-net,pomortaz/azure-sdk-for-net,naveedaz/azure-sdk-for-net,AuxMon/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,dasha91/azure-sdk-for-net,jtlibing/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,naveedaz/azure-sdk-for-net,ahosnyms/azure-sdk-for-net
|
src/ResourceManagement/HDInsight/HDInsight/Properties/AssemblyInfo.cs
|
src/ResourceManagement/HDInsight/HDInsight/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("HDInsightManagement")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HDInsightManagement")]
[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)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("70992224-9aea-45b6-ae7b-133392a07fd9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.9.0")]
[assembly:InternalsVisibleTo("HDInsight.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
|
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("HDInsightManagement")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HDInsightManagement")]
[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)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("70992224-9aea-45b6-ae7b-133392a07fd9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.9.0")]
[assembly:InternalsVisibleTo("HDInsight.Tests")]
|
apache-2.0
|
C#
|
ea393d368450994faae24243953cc0f0a4aba5e5
|
Make FillScreen ExecuteInEditMode
|
momo-the-monster/workshop-trails
|
Assets/MMM/Trails/Scripts/FillScreen.cs
|
Assets/MMM/Trails/Scripts/FillScreen.cs
|
using UnityEngine;
/*
* Scale a Quad to fill an Orthographic Camera's Field of View
* */
namespace mmm
{
[ExecuteInEditMode]
public class FillScreen : MonoBehaviour
{
// Change for non-square textures
public float aspectRatio = 1f;
// This class could be expanded to work for Perspective & Ortho cameras
void Update()
{
OrthoUpdate();
}
void OrthoUpdate()
{
Camera cam = Camera.main;
// Use the Viewport bounds as the target scale by converting it to World Space
Vector3 worldMin = cam.ViewportToWorldPoint(new Vector3(0, 0, 0));
Vector3 worldMax = cam.ViewportToWorldPoint(new Vector3(1, 1, 0));
float width = worldMax.x - worldMin.x;
float height = worldMax.y - worldMin.y;
Vector3 scale = new Vector3(width, height, 0f);
// Find smaller dimension and scale it down proportionally to larger one
if (width >= height)
scale.y = width / aspectRatio;
else
scale.x = height * aspectRatio;
// Apply new scale
transform.localScale = scale;
}
}
}
|
using UnityEngine;
/*
* Scale a Quad to fill an Orthographic Camera's Field of View
* */
namespace mmm
{
public class FillScreen : MonoBehaviour
{
// Change for non-square textures
public float aspectRatio = 1f;
// This class could be expanded to work for Perspective & Ortho cameras
void Update()
{
OrthoUpdate();
}
void OrthoUpdate()
{
Camera cam = Camera.main;
// Use the Viewport bounds as the target scale by converting it to World Space
Vector3 worldMin = cam.ViewportToWorldPoint(new Vector3(0, 0, 0));
Vector3 worldMax = cam.ViewportToWorldPoint(new Vector3(1, 1, 0));
float width = worldMax.x - worldMin.x;
float height = worldMax.y - worldMin.y;
Vector3 scale = new Vector3(width, height, 0f);
// Find smaller dimension and scale it down proportionally to larger one
if (width >= height)
scale.y = width / aspectRatio;
else
scale.x = height * aspectRatio;
// Apply new scale
transform.localScale = scale;
}
}
}
|
mit
|
C#
|
903eb1a535f21cb1ba62ef88eaea3fc4d7e62b6b
|
Adjust display property on a-driver
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
Battery-Commander.Web/Models/Vehicle.cs
|
Battery-Commander.Web/Models/Vehicle.cs
|
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BatteryCommander.Web.Models
{
public class Vehicle
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public int UnitId { get; set; }
public virtual Unit Unit { get; set; }
[Required]
public VehicleStatus Status { get; set; } = VehicleStatus.FMC;
[Required]
public VehicleType Type { get; set; } = VehicleType.HMMWV;
// Bumper, Registration, and Serial should be UNIQUE -- configured in Database.OnModelCreating
[Required, StringLength(10)]
public String Bumper { get; set; }
[StringLength(10)]
public String Registration { get; set; }
[StringLength(50)]
public String Serial { get; set; }
[StringLength(20)]
public String Nomenclature { get; set; }
[StringLength(10)]
public String LIN { get; set; }
[Required]
public int Seats { get; set; } = 2;
// TroopCapacity?
// Chalk Order?
//public Boolean HasFuelCard { get; set; }
//public Boolean HasTowBar { get; set; }
//public Boolean HasWaterBuffalo { get; set; }
// Fuel Level?
// Has JBC-P?
// Location?
public Soldier Driver { get; set; }
[Display(Name = "A-Driver")]
public Soldier A_Driver { get; set; }
// Passengers
public String Notes { get; set; }
public enum VehicleType : byte
{
HMMWV = 0,
MTV = 1
}
public enum VehicleStatus : byte
{
Unknown = 0,
FMC = 1,
NMC = byte.MaxValue
}
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BatteryCommander.Web.Models
{
public class Vehicle
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public int UnitId { get; set; }
public virtual Unit Unit { get; set; }
[Required]
public VehicleStatus Status { get; set; } = VehicleStatus.FMC;
[Required]
public VehicleType Type { get; set; } = VehicleType.HMMWV;
// Bumper, Registration, and Serial should be UNIQUE -- configured in Database.OnModelCreating
[Required, StringLength(10)]
public String Bumper { get; set; }
[StringLength(10)]
public String Registration { get; set; }
[StringLength(50)]
public String Serial { get; set; }
[StringLength(20)]
public String Nomenclature { get; set; }
[StringLength(10)]
public String LIN { get; set; }
[Required]
public int Seats { get; set; } = 2;
// TroopCapacity?
// Chalk Order?
//public Boolean HasFuelCard { get; set; }
//public Boolean HasTowBar { get; set; }
//public Boolean HasWaterBuffalo { get; set; }
// Fuel Level?
// Has JBC-P?
// Location?
public Soldier Driver { get; set; }
public Soldier A_Driver { get; set; }
// Passengers
public String Notes { get; set; }
public enum VehicleType : byte
{
HMMWV = 0,
MTV = 1
}
public enum VehicleStatus : byte
{
Unknown = 0,
FMC = 1,
NMC = byte.MaxValue
}
}
}
|
mit
|
C#
|
10934771ed4763bff1a18c1d187cef0a1b9f4ea2
|
Simplify default constructor
|
SICU-Stress-Measurement-System/frontend-cs
|
StressMeasurementSystem/ViewModels/AbstractPlotViewModel.cs
|
StressMeasurementSystem/ViewModels/AbstractPlotViewModel.cs
|
using System.Collections.Generic;
using OxyPlot;
using OxyPlot.Wpf;
namespace StressMeasurementSystem.ViewModels
{
public abstract class AbstractPlotViewModel
{
protected PlotModel PlotModel { get; set; }
protected List<DataPointSeries> SeriesList { get; set; }
protected AbstractPlotViewModel()
{
PlotModel = new PlotModel();
SeriesList = new List<DataPointSeries>();
}
}
}
|
using System.Collections.Generic;
using OxyPlot;
using OxyPlot.Wpf;
namespace StressMeasurementSystem.ViewModels
{
public abstract class AbstractPlotViewModel
{
protected PlotModel PlotModel { get; set; }
protected List<DataPointSeries> SeriesList { get; set; }
protected AbstractPlotViewModel()
{
PlotModel = new PlotModel
{
PlotAreaBackground = OxyColor.FromArgb(0, 0, 0, 0),
Title = "AbstractPlotView"
};
}
}
}
|
apache-2.0
|
C#
|
7d04baeb7bcec6eb8afea6d3625b8b8ba6b9307b
|
Fix multiple enumerating in MessageHandlerService
|
HelloKitty/GladNet2,HelloKitty/GladNet2.0,HelloKitty/GladNet2,HelloKitty/GladNet2.0
|
src/GladNet3.Handler.API/Services/MessageHandlerService.cs
|
src/GladNet3.Handler.API/Services/MessageHandlerService.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GladNet
{
/// <summary>
/// Message handling service that aggregates handlers
/// and manages the try dispatching of them and accepts a default
/// handler to fall back to if it fails.
/// </summary>
/// <typeparam name="TIncomingPayloadType"></typeparam>
/// <typeparam name="TOutgoingPayloadType"></typeparam>
public sealed class MessageHandlerService<TIncomingPayloadType, TOutgoingPayloadType> : IPeerMessageHandler<TIncomingPayloadType, TOutgoingPayloadType>
where TIncomingPayloadType : class
where TOutgoingPayloadType : class
{
/// <summary>
/// The handlers this service will try to dispatch to.
/// </summary>
private IPeerMessageHandler<TIncomingPayloadType, TOutgoingPayloadType>[] ManagedHandlers { get; }
/// <summary>
/// The optional default message handler to fall back on
/// if no handler accepts the incoming message.
/// </summary>
private IPeerPayloadSpecificMessageHandler<TIncomingPayloadType, TOutgoingPayloadType> DefaultMessageHandler { get; }
/// <inheritdoc />
public MessageHandlerService(IEnumerable<IPeerMessageHandler<TIncomingPayloadType, TOutgoingPayloadType>> managedHandlers, IPeerPayloadSpecificMessageHandler<TIncomingPayloadType, TOutgoingPayloadType> defaultMessageHandler)
{
if(managedHandlers == null) throw new ArgumentNullException(nameof(managedHandlers));
ManagedHandlers = managedHandlers.ToArray();
//Default handler can be null.
DefaultMessageHandler = defaultMessageHandler;
}
/// <inheritdoc />
public bool CanHandle(NetworkIncomingMessage<TIncomingPayloadType> message)
{
//We can always handle messages
return true;
}
/// <inheritdoc />
public async Task<bool> TryHandleMessage(IPeerMessageContext<TOutgoingPayloadType> context, NetworkIncomingMessage<TIncomingPayloadType> message)
{
//TODO: What should we do about exceptions?
//When a message comes in we need to try to dispatch it to all handlers
foreach(IPeerMessageHandler<TIncomingPayloadType, TOutgoingPayloadType> handler in ManagedHandlers)
{
//If we found a handler that handled it we should stop trying to handle it and return true
if(handler.CanHandle(message))
return await handler.TryHandleMessage(context, message);
}
DefaultMessageHandler?.HandleMessage(context, message.Payload)?
.ConfigureAwait(true);
return false;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GladNet
{
/// <summary>
/// Message handling service that aggregates handlers
/// and manages the try dispatching of them and accepts a default
/// handler to fall back to if it fails.
/// </summary>
/// <typeparam name="TIncomingPayloadType"></typeparam>
/// <typeparam name="TOutgoingPayloadType"></typeparam>
public sealed class MessageHandlerService<TIncomingPayloadType, TOutgoingPayloadType> : IPeerMessageHandler<TIncomingPayloadType, TOutgoingPayloadType>
where TIncomingPayloadType : class
where TOutgoingPayloadType : class
{
/// <summary>
/// The handlers this service will try to dispatch to.
/// </summary>
private IEnumerable<IPeerMessageHandler<TIncomingPayloadType, TOutgoingPayloadType>> ManagedHandlers { get; }
/// <summary>
/// The optional default message handler to fall back on
/// if no handler accepts the incoming message.
/// </summary>
private IPeerPayloadSpecificMessageHandler<TIncomingPayloadType, TOutgoingPayloadType> DefaultMessageHandler { get; }
/// <inheritdoc />
public MessageHandlerService(IEnumerable<IPeerMessageHandler<TIncomingPayloadType, TOutgoingPayloadType>> managedHandlers, IPeerPayloadSpecificMessageHandler<TIncomingPayloadType, TOutgoingPayloadType> defaultMessageHandler)
{
if(managedHandlers == null) throw new ArgumentNullException(nameof(managedHandlers));
ManagedHandlers = managedHandlers;
//Default handler can be null.
DefaultMessageHandler = defaultMessageHandler;
}
/// <inheritdoc />
public bool CanHandle(NetworkIncomingMessage<TIncomingPayloadType> message)
{
//We can always handle messages
return true;
}
/// <inheritdoc />
public async Task<bool> TryHandleMessage(IPeerMessageContext<TOutgoingPayloadType> context, NetworkIncomingMessage<TIncomingPayloadType> message)
{
//TODO: What should we do about exceptions?
//When a message comes in we need to try to dispatch it to all handlers
foreach(IPeerMessageHandler<TIncomingPayloadType, TOutgoingPayloadType> handler in ManagedHandlers)
{
//If we found a handler that handled it we should stop trying to handle it and return true
if(handler.CanHandle(message))
return await handler.TryHandleMessage(context, message);
}
DefaultMessageHandler?.HandleMessage(context, message.Payload)?
.ConfigureAwait(true);
return false;
}
}
}
|
bsd-3-clause
|
C#
|
47db7499c83adaa40e3c7a9cc144fd2a7605a8fd
|
bump to 1.3.3
|
Terradue/DotNetTep,Terradue/DotNetTep
|
Terradue.Tep/Properties/AssemblyInfo.cs
|
Terradue.Tep/Properties/AssemblyInfo.cs
|
/*!
\namespace Terradue.Tep
@{
Terradue.Tep Software Package provides with all the functionalities specific to the TEP.
\xrefitem sw_version "Versions" "Software Package Version" 1.3.3
\xrefitem sw_link "Links" "Software Package List" [Terradue.Tep](https://git.terradue.com/sugar/Terradue.Tep)
\xrefitem sw_license "License" "Software License" [AGPL](https://git.terradue.com/sugar/Terradue.Tep/LICENSE)
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch
\xrefitem sw_req "Require" "Software Dependencies" \ref ServiceStack
\xrefitem sw_req "Require" "Software Dependencies" \ref log4net
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Portal
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Authentication.Umsso
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Cloud
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Github
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Metadata.EarthObservation
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.News
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenNebula
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.GeoJson
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.RdfEO
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Tumblr
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Twitter
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Ogc.OwsContext
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.WebService.Model
\ingroup Tep
@}
*/
/*!
\defgroup Tep Tep Modules
@{
This is a super component that encloses all Thematic Exploitation Platform related functional components.
Their main functionnalities are targeted to enhance the basic \ref Core functionalities for the thematic usage of the plaform.
@}
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using NuGet4Mono.Extensions;
[assembly: AssemblyTitle("Terradue.Tep")]
[assembly: AssemblyDescription("Terradue Tep .Net library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Terradue")]
[assembly: AssemblyProduct("Terradue.Tep")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyAuthors("Enguerran Boissier")]
[assembly: AssemblyProjectUrl("https://git.terradue.com/sugar/Terradue.Tep")]
[assembly: AssemblyLicenseUrl("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.3.3")]
[assembly: AssemblyInformationalVersion("1.3.3")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
|
/*!
\namespace Terradue.Tep
@{
Terradue.Tep Software Package provides with all the functionalities specific to the TEP.
\xrefitem sw_version "Versions" "Software Package Version" 1.3.2
\xrefitem sw_link "Links" "Software Package List" [Terradue.Tep](https://git.terradue.com/sugar/Terradue.Tep)
\xrefitem sw_license "License" "Software License" [AGPL](https://git.terradue.com/sugar/Terradue.Tep/LICENSE)
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch
\xrefitem sw_req "Require" "Software Dependencies" \ref ServiceStack
\xrefitem sw_req "Require" "Software Dependencies" \ref log4net
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Portal
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Authentication.Umsso
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Cloud
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Github
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Metadata.EarthObservation
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.News
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenNebula
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.GeoJson
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.RdfEO
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Tumblr
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Twitter
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Ogc.OwsContext
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.WebService.Model
\ingroup Tep
@}
*/
/*!
\defgroup Tep Tep Modules
@{
This is a super component that encloses all Thematic Exploitation Platform related functional components.
Their main functionnalities are targeted to enhance the basic \ref Core functionalities for the thematic usage of the plaform.
@}
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using NuGet4Mono.Extensions;
[assembly: AssemblyTitle("Terradue.Tep")]
[assembly: AssemblyDescription("Terradue Tep .Net library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Terradue")]
[assembly: AssemblyProduct("Terradue.Tep")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyAuthors("Enguerran Boissier")]
[assembly: AssemblyProjectUrl("https://git.terradue.com/sugar/Terradue.Tep")]
[assembly: AssemblyLicenseUrl("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.3.2")]
[assembly: AssemblyInformationalVersion("1.3.2")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
|
agpl-3.0
|
C#
|
909d1cf7b732607b0afac0db2947d72a4cd040b1
|
comment changes.
|
bostelk/delta
|
Delta.Core/DeltaGame.cs
|
Delta.Core/DeltaGame.cs
|
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
namespace Delta
{
public class DeltaGame : Game //just a name holder
{
bool _isInitialized = false;
ResourceContentManager _embedded = null;
public DeltaGame(Rectangle screenArea)
: base()
{
#if DEBUG
IsMouseVisible = true;
#endif
_embedded = new ResourceContentManager(Services, EmbeddedContent.ResourceManager);
base.Content.RootDirectory = "Content";
G.Setup(this, screenArea);
}
public DeltaGame()
: this(new Rectangle(0, 0, 1280, 720))
{
}
protected override void LoadContent()
{
G.LoadContent(this, _embedded);
base.LoadContent();
GC.Collect(); // force a collection after content is loaded.
ResetElapsedTime(); // avoid the update loop trying to play catch-up
}
void InternalInitialize()
{
_isInitialized = true;
LateInitialize();
}
protected virtual void LateInitialize()
{
}
protected override void Update(GameTime gameTime)
{
// HANLDE WITH CARE. LaterInitializes need a preprare audio engine!!
G.SimpleEffect.Time = (float)gameTime.TotalGameTime.TotalMilliseconds;
G.Input.Update(gameTime);
G.Audio.Update(gameTime);
if (!_isInitialized)
InternalInitialize();
G.World.InternalUpdate(gameTime);
G.UI.InternalUpdate(gameTime);
G.Physics.Simulate((float)gameTime.ElapsedGameTime.TotalSeconds); // simulate after the world update! otherwise simulating a previous frame's worldstate.
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
G.World.InternalDraw(gameTime, G.SpriteBatch);
G.UI.InternalDraw(gameTime, G.SpriteBatch);
}
}
}
|
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
namespace Delta
{
public class DeltaGame : Game //just a name holder
{
bool _isInitialized = false;
ResourceContentManager _embedded = null;
public DeltaGame(Rectangle screenArea)
: base()
{
#if DEBUG
IsMouseVisible = true;
#endif
_embedded = new ResourceContentManager(Services, EmbeddedContent.ResourceManager);
base.Content.RootDirectory = "Content";
G.Setup(this, screenArea);
}
public DeltaGame()
: this(new Rectangle(0, 0, 1280, 720))
{
}
protected override void LoadContent()
{
G.LoadContent(this, _embedded);
base.LoadContent();
GC.Collect(); // force a collection after content is loaded.
ResetElapsedTime(); // avoid the update loop trying to play catch-up
}
void InternalInitialize()
{
_isInitialized = true;
LateInitialize();
}
protected virtual void LateInitialize()
{
}
protected override void Update(GameTime gameTime)
{
// HANLDE WITH CARE. LaterInitializes need a preprare audio engine!!
G.SimpleEffect.Time = (float)gameTime.TotalGameTime.TotalMilliseconds;
G.Input.Update(gameTime);
G.Audio.Update(gameTime);
if (!_isInitialized)
InternalInitialize();
G.World.InternalUpdate(gameTime);
G.UI.InternalUpdate(gameTime);
G.Physics.Simulate((float)gameTime.ElapsedGameTime.TotalSeconds); // must preceed the world update!
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
G.World.InternalDraw(gameTime, G.SpriteBatch);
G.UI.InternalDraw(gameTime, G.SpriteBatch);
}
}
}
|
mit
|
C#
|
3c9ade5ccec840939575aa1d8c9c37c2dcdb51b6
|
Update AssemblyInfo.cs
|
tb2johm/MMVVM
|
UsageExample/Properties/AssemblyInfo.cs
|
UsageExample/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("UsageExample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UsageExample")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UsageExample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Volvo Car Corporation")]
[assembly: AssemblyProduct("UsageExample")]
[assembly: AssemblyCopyright("Copyright © Volvo Car Corporation 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
1dd354120b1013759d210e49902e08393c6d18b9
|
Fix beatmap potentially changing in test scene
|
smoogipoo/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,smoogipooo/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu-new,ppy/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,ppy/osu,ppy/osu,NeoAdonis/osu
|
osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs
|
osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Timing;
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneTimingScreen : EditorClockTestScene
{
[Cached(typeof(EditorBeatmap))]
[Cached(typeof(IBeatSnapProvider))]
private readonly EditorBeatmap editorBeatmap;
public TestSceneTimingScreen()
{
editorBeatmap = new EditorBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo));
}
[BackgroundDependencyLoader]
private void load()
{
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
Beatmap.Disabled = true;
Child = new TimingScreen();
}
protected override void Dispose(bool isDisposing)
{
Beatmap.Disabled = false;
base.Dispose(isDisposing);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Timing;
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneTimingScreen : EditorClockTestScene
{
[Cached(typeof(EditorBeatmap))]
[Cached(typeof(IBeatSnapProvider))]
private readonly EditorBeatmap editorBeatmap;
public TestSceneTimingScreen()
{
editorBeatmap = new EditorBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo));
}
[BackgroundDependencyLoader]
private void load()
{
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
Child = new TimingScreen();
}
}
}
|
mit
|
C#
|
28ac016b1e0e111880b0de5e7a23ae7d0f6801c4
|
Add DiscordGame.Url
|
BundledSticksInkorperated/Discore
|
src/Discore/DiscordGame.cs
|
src/Discore/DiscordGame.cs
|
namespace Discore
{
/// <summary>
/// Representation of the game a user is currently playing.
/// </summary>
public sealed class DiscordGame
{
/// <summary>
/// Gets the name of the game.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the type of the game.
/// </summary>
public DiscordGameType Type { get; }
/// <summary>
/// Gets the URL of the stream when the type is set to "Streaming" and the URL is valid.
/// Otherwise, returns null.
/// </summary>
public string Url { get; }
internal DiscordGame(DiscordApiData data)
{
Name = data.GetString("name");
Type = (DiscordGameType)(data.GetInteger("type") ?? 0);
Url = data.GetString("url");
}
public override string ToString()
{
return Name;
}
}
}
|
namespace Discore
{
/// <summary>
/// Representation of the game a user is currently playing.
/// </summary>
public sealed class DiscordGame
{
/// <summary>
/// Gets the name of the game.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the type of the game.
/// </summary>
public DiscordGameType Type { get; }
internal DiscordGame(DiscordApiData data)
{
Name = data.GetString("name");
Type = (DiscordGameType)(data.GetInteger("type") ?? 0);
}
public override string ToString()
{
return $"Game: {Name}, Type: {Type}";
}
}
}
|
mit
|
C#
|
ed9304571989a98315bbfa287d17b409b84c08be
|
Add overloads for the AppBuilderExtensions to allow passing in of the HttpConfiguration
|
dd4t/DD4T.RestService.WebApi
|
source/DD4T.RestService.WebApi/AppBuilderExtensions.cs
|
source/DD4T.RestService.WebApi/AppBuilderExtensions.cs
|
using Autofac;
using Autofac.Integration.WebApi;
using DD4T.ContentModel.Contracts.Configuration;
using DD4T.ContentModel.Contracts.Logging;
using DD4T.ContentModel.Contracts.Providers;
using DD4T.ContentModel.Contracts.Resolvers;
using DD4T.DI.Autofac;
using DD4T.Utils;
using DD4T.Utils.Logging;
using DD4T.Utils.Resolver;
using Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
namespace DD4T.RestService.WebApi
{
public static class AppBuilderExtensions
{
public static void UseDD4TWebApi(this IAppBuilder appBuilder)
{
var builder = new ContainerBuilder();
appBuilder.UseDD4TWebApi(builder);
}
public static void UseDD4TWebApi(this IAppBuilder appBuilder, HttpConfiguration config)
{
var builder = new ContainerBuilder();
appBuilder.UseDD4TWebApi(builder, config);
}
public static void UseDD4TWebApi(this IAppBuilder appBuilder, ContainerBuilder builder)
{
var config = new HttpConfiguration();
appBuilder.UseDD4TWebApi(builder, config);
}
public static void UseDD4TWebApi(this IAppBuilder appBuilder, ContainerBuilder builder, HttpConfiguration config)
{
builder.RegisterApiControllers(typeof(AppBuilderExtensions).Assembly);
builder.UseDD4T();
var container = builder.Build();
config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
config.MapHttpAttributeRoutes();
appBuilder.UseAutofacMiddleware(container);
appBuilder.UseAutofacWebApi(config);
appBuilder.UseWebApi(config);
}
}
}
|
using Autofac;
using Autofac.Integration.WebApi;
using DD4T.ContentModel.Contracts.Configuration;
using DD4T.ContentModel.Contracts.Logging;
using DD4T.ContentModel.Contracts.Providers;
using DD4T.ContentModel.Contracts.Resolvers;
using DD4T.DI.Autofac;
using DD4T.Utils;
using DD4T.Utils.Logging;
using DD4T.Utils.Resolver;
using Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
namespace DD4T.RestService.WebApi
{
public static class AppBuilderExtensions
{
public static void UseDD4TWebApi(this IAppBuilder appBuilder)
{
var builder = new ContainerBuilder();
appBuilder.UseDD4TWebApi(builder);
}
public static void UseDD4TWebApi(this IAppBuilder appBuilder, ContainerBuilder builder)
{
var config = new HttpConfiguration();
builder.RegisterApiControllers(typeof(AppBuilderExtensions).Assembly);
builder.UseDD4T();
var container = builder.Build();
config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
config.MapHttpAttributeRoutes();
appBuilder.UseAutofacMiddleware(container);
appBuilder.UseAutofacWebApi(config);
appBuilder.UseWebApi(config);
}
}
}
|
apache-2.0
|
C#
|
410b6b06182ebee2793c6e54e9a22a8257e180fd
|
Rename GetNoOp to Identity
|
awseward/restivus
|
src/Restivus/Extensions.cs
|
src/Restivus/Extensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace Restivus
{
public static class Extensions
{
public static StringContent AsJsonContent(this string json)
{
var safeJson = string.IsNullOrWhiteSpace(json)
? string.Empty
: json;
return new StringContent(safeJson, Encoding.UTF8, "application/json");
}
public static Func<T, T> Identity<T>() => x => x;
public static Func<T, T> AsNoOpIfNull<T>(this Func<T, T> function)
{
return function ?? Identity<T>();
}
public static Func<T, T> AsFluent<T>(this Action<T> action)
{
return (action == null)
? Identity<T>()
: x => { action(x); return x; };
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace Restivus
{
public static class Extensions
{
public static StringContent AsJsonContent(this string json)
{
var safeJson = string.IsNullOrWhiteSpace(json)
? string.Empty
: json;
return new StringContent(safeJson, Encoding.UTF8, "application/json");
}
public static Func<T, T> GetNoOp<T>() => x => x;
public static Func<T, T> AsNoOpIfNull<T>(this Func<T, T> function)
{
return function ?? GetNoOp<T>();
}
public static Func<T, T> AsFluent<T>(this Action<T> action)
{
return (action == null)
? GetNoOp<T>()
: x => { action(x); return x; };
}
}
}
|
mit
|
C#
|
9bda6425b4264edf8794dbe74210e525564db7d5
|
update version
|
prodot/ReCommended-Extension
|
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
|
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
|
using System.Reflection;
using ReCommendedExtension;
// 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(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2022 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.7.0.0")]
[assembly: AssemblyFileVersion("5.7.0")]
|
using System.Reflection;
using ReCommendedExtension;
// 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(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2022 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.6.5.0")]
[assembly: AssemblyFileVersion("5.6.5")]
|
apache-2.0
|
C#
|
dd5514f246597be15e29ac1d31aebadbb20f87d3
|
combine implementation of MouseCursors
|
Unity-Technologies/CodeEditor,Unity-Technologies/CodeEditor
|
src/CodeEditor.Text.UI.Unity.Editor/Implementation/UnityEditorMouseCursorRegions.cs
|
src/CodeEditor.Text.UI.Unity.Editor/Implementation/UnityEditorMouseCursorRegions.cs
|
using CodeEditor.Composition;
using CodeEditor.Text.UI.Unity.Engine;
using UnityEngine;
namespace CodeEditor.Text.UI.Unity.Editor.Implementation
{
[Export(typeof(IMouseCursorRegions))]
[Export(typeof(IMouseCursors))]
class UnityEditorMouseCursors: IMouseCursorRegions, IMouseCursors
{
public IMouseCursor Text { get; private set; }
public IMouseCursor Finger { get; private set; }
public UnityEditorMouseCursors()
{
Text = new UnityEditorMouseCursor(UnityEditor.MouseCursor.Text);
Finger = new UnityEditorMouseCursor(UnityEditor.MouseCursor.Orbit);// UnityEditor api lacks a finger mouse cursor
}
public void AddMouseCursorRegion(Rect region, IMouseCursor cursor)
{
UnityEditor.EditorGUIUtility.AddCursorRect(region, MouseCursorFor(cursor));
}
UnityEditor.MouseCursor MouseCursorFor(IMouseCursor cursor)
{
return ((UnityEditorMouseCursor)cursor).MouseCursor;
}
class UnityEditorMouseCursor : IMouseCursor
{
UnityEditor.MouseCursor _unityMouseCursor;
public UnityEditor.MouseCursor MouseCursor
{
get { return _unityMouseCursor; }
}
public UnityEditorMouseCursor(UnityEditor.MouseCursor cursor)
{
_unityMouseCursor = cursor;
}
}
}
}
|
using CodeEditor.Composition;
using CodeEditor.Text.UI.Unity.Engine;
using UnityEngine;
namespace CodeEditor.Text.UI.Unity.Editor.Implementation
{
[Export(typeof(IMouseCursorRegions))]
class UnityEditorMouseCursorRegions : IMouseCursorRegions
{
public void AddMouseCursorRegion(Rect region, IMouseCursor cursor)
{
UnityEditor.EditorGUIUtility.AddCursorRect(region, MouseCursorFor(cursor));
}
UnityEditor.MouseCursor MouseCursorFor(IMouseCursor cursor)
{
return ((UnityEditorMouseCursor)cursor).MouseCursor;
}
}
[Export(typeof(IMouseCursors))]
class UnityEditorMouseCursors : IMouseCursors
{
public IMouseCursor Text { get; private set; }
public IMouseCursor Finger { get; private set; }
public UnityEditorMouseCursors()
{
Text = new UnityEditorMouseCursor(UnityEditor.MouseCursor.Text);
Finger = new UnityEditorMouseCursor(UnityEditor.MouseCursor.Orbit);// UnityEditor api lacks a finger mouse cursor
}
}
class UnityEditorMouseCursor : IMouseCursor
{
UnityEditor.MouseCursor _unityMouseCursor;
public UnityEditor.MouseCursor MouseCursor
{
get { return _unityMouseCursor; }
}
public UnityEditorMouseCursor(UnityEditor.MouseCursor cursor)
{
_unityMouseCursor = cursor;
}
}
}
|
mit
|
C#
|
eed8fa00687424544f11377b4b1d205d9e48ddb3
|
Update version to 2.0
|
citizenmatt/resharper-template-compiler
|
src/resharper-template-compiler/Properties/AssemblyInfo.cs
|
src/resharper-template-compiler/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("resharper-template-compiler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("resharper-template-compiler")]
[assembly: AssemblyCopyright("Copyright © Matt Ellis 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("83129900-553e-41d7-81de-3486b3ee8116")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
|
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("resharper-template-compiler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("resharper-template-compiler")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("83129900-553e-41d7-81de-3486b3ee8116")]
// 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.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
|
apache-2.0
|
C#
|
a7f764c696fce229f2b3d50c2fad45aa032d7c19
|
Refactor ITermDataProviderExtensions.GetActualValues method
|
atata-framework/atata,YevgeniyShunevych/Atata,YevgeniyShunevych/Atata,atata-framework/atata
|
src/Atata/Extensions/ITermDataProviderExtensions.cs
|
src/Atata/Extensions/ITermDataProviderExtensions.cs
|
using System;
using System.Linq;
namespace Atata
{
public static class ITermDataProviderExtensions
{
public static string[] GetActualValues(this ITermDataProvider provider, string fallbackValue)
{
string[] rawValues = provider.Values != null && provider.Values.Any()
? provider.Values
: new[] { provider.Case.ApplyTo(fallbackValue ?? throw new ArgumentNullException(nameof(fallbackValue))) };
return !string.IsNullOrEmpty(provider.Format)
? rawValues.Select(x => string.Format(provider.Format, x)).ToArray()
: rawValues;
}
}
}
|
using System.Linq;
namespace Atata
{
public static class ITermDataProviderExtensions
{
public static string[] GetActualValues(this ITermDataProvider provider, string fallbackValue)
{
string[] rawValues = (provider.Values != null && provider.Values.Any()) ? provider.Values : new[] { provider.Case.ApplyTo(fallbackValue) };
return !string.IsNullOrEmpty(provider.Format) ? rawValues.Select(x => string.Format(provider.Format, x)).ToArray() : rawValues;
}
}
}
|
apache-2.0
|
C#
|
3575525c2eb4596a1e249339b2a0dccfb034e33d
|
Update src/Avalonia.Controls/Notifications/Notification.cs
|
wieslawsoltes/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,akrisiun/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia
|
src/Avalonia.Controls/Notifications/Notification.cs
|
src/Avalonia.Controls/Notifications/Notification.cs
|
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
namespace Avalonia.Controls.Notifications
{
/// <summary>
/// A notification that can be shown in a window or by the host operating system.
/// Can be displayed by both <see cref="INotificationManager"/> and <see cref="IManagedNotificationManager"/>
/// </summary>
/// <remarks>
/// This class represents a notification that can be displayed either in a window using
/// <see cref="WindowNotificationManager"/> or by the host operating system (to be implemented).
/// </remarks>
public class Notification : INotification
{
/// <summary>
/// Initializes a new instance of the <see cref="Notification"/> class.
/// </summary>
/// <param name="title">The title of the notification.</param>
/// <param name="message">The message to be displayed in the notification.</param>
/// <param name="type">The <see cref="NotificationType"/> of the notification.</param>
/// <param name="expiration">The expiry time at which the notification will close.
/// Use <see cref="TimeSpan.Zero"/> for notifications that will remain open.</param>
/// <param name="onClick">The Action to call when the notification is clicked.</param>
/// <param name="onClose">The Action to call when the notification is closed.</param>
public Notification(string title,
string message,
NotificationType type = NotificationType.Information,
TimeSpan? expiration = null,
Action onClick = null,
Action onClose = null)
{
Title = title;
Message = message;
Type = type;
Expiration = expiration.HasValue ? expiration.Value : TimeSpan.FromSeconds(5);
OnClick = onClick;
OnClose = onClose;
}
/// <inheritdoc/>
public string Title { get; private set; }
/// <inheritdoc/>
public string Message { get; private set; }
/// <inheritdoc/>
public NotificationType Type { get; private set; }
/// <inheritdoc/>
public TimeSpan Expiration { get; private set; }
/// <inheritdoc/>
public Action OnClick { get; private set; }
/// <inheritdoc/>
public Action OnClose { get; private set; }
}
}
|
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
namespace Avalonia.Controls.Notifications
{
/// <summary>
/// Implements the INotification interfaces.
/// Can be displayed by both <see cref="INotificationManager"/> and <see cref="IManagedNotificationManager"/>
/// </summary>
/// <remarks>
/// This class represents a notification that can be displayed either in a window using
/// <see cref="WindowNotificationManager"/> or by the host operating system (to be implemented).
/// </remarks>
public class Notification : INotification
{
/// <summary>
/// Initializes a new instance of the <see cref="Notification"/> class.
/// </summary>
/// <param name="title">The title of the notification.</param>
/// <param name="message">The message to be displayed in the notification.</param>
/// <param name="type">The <see cref="NotificationType"/> of the notification.</param>
/// <param name="expiration">The expiry time at which the notification will close.
/// Use <see cref="TimeSpan.Zero"/> for notifications that will remain open.</param>
/// <param name="onClick">The Action to call when the notification is clicked.</param>
/// <param name="onClose">The Action to call when the notification is closed.</param>
public Notification(string title,
string message,
NotificationType type = NotificationType.Information,
TimeSpan? expiration = null,
Action onClick = null,
Action onClose = null)
{
Title = title;
Message = message;
Type = type;
Expiration = expiration.HasValue ? expiration.Value : TimeSpan.FromSeconds(5);
OnClick = onClick;
OnClose = onClose;
}
/// <inheritdoc/>
public string Title { get; private set; }
/// <inheritdoc/>
public string Message { get; private set; }
/// <inheritdoc/>
public NotificationType Type { get; private set; }
/// <inheritdoc/>
public TimeSpan Expiration { get; private set; }
/// <inheritdoc/>
public Action OnClick { get; private set; }
/// <inheritdoc/>
public Action OnClose { get; private set; }
}
}
|
mit
|
C#
|
5522f8d9e47e6ecfb5e74496042cefc959138af8
|
Add some documentation.
|
MrJoy/UnityGUIExtensions.Examples,MrJoy/UnityGUIExtensions.Examples
|
Assets/UnityGUIExtensions.Examples/AutoSelectExample.cs
|
Assets/UnityGUIExtensions.Examples/AutoSelectExample.cs
|
using UnityEngine;
using System;
using System.Collections;
public class AutoSelectExample : MonoBehaviour {
private string a = "", b = "", c = "";
public void OnGUI() {
GUILayout.BeginArea(new Rect(0, 0, 400, 200));
GUILayout.BeginHorizontal();
GUILayout.Label("Auto-selecting text field:", GUILayout.Width(140));
a = GUILayoutExt.AutoSelectTextArea("fieldA", a);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Auto-selecting text field:", GUILayout.Width(140));
b = GUILayoutExt.AutoSelectTextArea("fieldB", b);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Plain text field:", GUILayout.Width(140));
c = GUILayout.TextArea(c);
GUILayout.EndHorizontal();
GUILayout.Label("The auto-selecting text fields above will automatically select their contents when they gain focus, so by default the user will be able to replace the contents without having to erase them explicitly.");
GUILayout.EndArea();
}
}
|
using UnityEngine;
using System;
using System.Collections;
public class AutoSelectExample : MonoBehaviour {
private string a = "", b = "", c = "";
public void OnGUI() {
GUILayout.BeginArea(new Rect(0, 0, 400, 200));
a = GUILayoutExt.AutoSelectTextArea("fieldA", a);
b = GUILayoutExt.AutoSelectTextArea("fieldB", b);
c = GUILayout.TextArea(c);
GUILayout.EndArea();
}
}
|
mit
|
C#
|
5bcb20245c4b801d5e59ec7b5d3d89829bd30fe3
|
Use the actual db data
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
Battery-Commander.Web/Models/NavigationViewComponent.cs
|
Battery-Commander.Web/Models/NavigationViewComponent.cs
|
using BatteryCommander.Web.Controllers;
using BatteryCommander.Web.Services;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Models
{
public class NavigationViewComponent : ViewComponent
{
private readonly Database db;
public Soldier Soldier { get; private set; }
public Boolean ShowNavigation => !String.Equals(nameof(HomeController.PrivacyAct), RouteData.Values["action"]);
public IEnumerable<Embed> NavItems
{
get
{
// TODO Only for nav items
// TODO Only for the logged in uni
return
db
.Embeds
.ToList();
}
}
public NavigationViewComponent(Database db)
{
this.db = db;
}
public async Task<IViewComponentResult> InvokeAsync()
{
Soldier = await UserService.FindAsync(db, UserClaimsPrincipal);
return View(this);
}
}
}
|
using BatteryCommander.Web.Controllers;
using BatteryCommander.Web.Services;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Models
{
public class NavigationViewComponent : ViewComponent
{
private readonly Database db;
public Soldier Soldier { get; private set; }
public Boolean ShowNavigation => !String.Equals(nameof(HomeController.PrivacyAct), RouteData.Values["action"]);
public IEnumerable<Embed> NavItems
{
get
{
// TODO Only for nav items
// TODO Only for the logged in unit
yield return new Embed { Name = "PO Tracker" };
yield return new Embed { Name = "SUTA" };
//return
// db
// .Embeds
// .ToList();
}
}
public NavigationViewComponent(Database db)
{
this.db = db;
}
public async Task<IViewComponentResult> InvokeAsync()
{
Soldier = await UserService.FindAsync(db, UserClaimsPrincipal);
return View(this);
}
}
}
|
mit
|
C#
|
bb18e65b1c8f80ab1349252a1dad61573621f87d
|
Update DocumentTextBindingBehavior.cs
|
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
src/Core2D/Behaviors/DocumentTextBindingBehavior.cs
|
src/Core2D/Behaviors/DocumentTextBindingBehavior.cs
|
#nullable enable
using System;
using Avalonia;
using Avalonia.Xaml.Interactivity;
using AvaloniaEdit;
namespace Core2D.Behaviors;
public class DocumentTextBindingBehavior : Behavior<TextEditor>
{
private TextEditor _textEditor;
public static readonly StyledProperty<string> TextProperty =
AvaloniaProperty.Register<DocumentTextBindingBehavior, string>(nameof(Text));
public string Text
{
get => GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
protected override void OnAttached()
{
base.OnAttached();
if (AssociatedObject is TextEditor textEditor)
{
_textEditor = textEditor;
_textEditor.TextChanged += TextChanged;
this.GetObservable(TextProperty).Subscribe(TextPropertyChanged);
}
}
protected override void OnDetaching()
{
base.OnDetaching();
if (_textEditor is { })
{
_textEditor.TextChanged -= TextChanged;
}
}
private void TextChanged(object? sender, EventArgs eventArgs)
{
if (_textEditor?.Document is { })
{
Text = _textEditor.Document.Text;
}
}
private void TextPropertyChanged(string text)
{
if (_textEditor?.Document is { } && text is { })
{
var caretOffset = _textEditor.CaretOffset;
_textEditor.Document.Text = text;
_textEditor.CaretOffset = caretOffset;
}
}
}
|
#if false
#nullable enable
using System;
using Avalonia;
using Avalonia.Xaml.Interactivity;
using AvaloniaEdit;
namespace Core2D.Behaviors;
public class DocumentTextBindingBehavior : Behavior<TextEditor>
{
private TextEditor _textEditor;
public static readonly StyledProperty<string> TextProperty =
AvaloniaProperty.Register<DocumentTextBindingBehavior, string>(nameof(Text));
public string Text
{
get => GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
protected override void OnAttached()
{
base.OnAttached();
if (AssociatedObject is TextEditor textEditor)
{
_textEditor = textEditor;
_textEditor.TextChanged += TextChanged;
this.GetObservable(TextProperty).Subscribe(TextPropertyChanged);
}
}
protected override void OnDetaching()
{
base.OnDetaching();
if (_textEditor is { })
{
_textEditor.TextChanged -= TextChanged;
}
}
private void TextChanged(object? sender, EventArgs eventArgs)
{
if (_textEditor?.Document is { })
{
Text = _textEditor.Document.Text;
}
}
private void TextPropertyChanged(string text)
{
if (_textEditor?.Document is { } && text is { })
{
var caretOffset = _textEditor.CaretOffset;
_textEditor.Document.Text = text;
_textEditor.CaretOffset = caretOffset;
}
}
}
#endif
|
mit
|
C#
|
acbbf01a2360861a4dc0a7324b0280809d2071ca
|
Delete unused Converters property on AppInternalInfo
|
NFig/NFig
|
NFig/AppInternalInfo.cs
|
NFig/AppInternalInfo.cs
|
using System;
using JetBrains.Annotations;
using NFig.Encryption;
namespace NFig
{
class AppInternalInfo
{
internal string AppName { get; }
[CanBeNull]
internal Type SettingsType { get; set; }
[CanBeNull]
internal ISettingEncryptor Encryptor { get; set; } // todo: eventually make this private
internal object AppClient { get; set; }
internal object AdminClient { get; set; }
internal bool CanEncrypt => Encryptor != null;
internal bool CanDecrypt => Encryptor?.CanDecrypt ?? false;
internal AppInternalInfo(string appName, Type settingsType)
{
AppName = appName;
SettingsType = settingsType;
}
internal string Encrypt(string plainText)
{
var encryptor = Encryptor;
if (encryptor == null)
throw new NFigException($"Cannot encrypt value. App \"{AppName}\" does not have an encryptor set.");
if (plainText == null)
return null;
return encryptor.Encrypt(plainText);
}
internal string Decrypt(string encrypted)
{
var encryptor = Encryptor;
if (encryptor == null)
throw new NFigException($"Cannot decrypt value. App \"{AppName}\" does not have an encryptor set.");
if (!encryptor.CanDecrypt)
throw new NFigException($"Cannot decrypt value. App \"{AppName}\" has an encrypt-only encryptor.");
if (encrypted == null)
return null;
return encryptor.Decrypt(encrypted);
}
}
}
|
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using NFig.Converters;
using NFig.Encryption;
namespace NFig
{
class AppInternalInfo
{
internal string AppName { get; }
[CanBeNull]
internal Type SettingsType { get; set; }
[CanBeNull]
internal Dictionary<Type, ISettingConverter> Converters { get; set; }
[CanBeNull]
internal ISettingEncryptor Encryptor { get; set; } // todo: eventually make this private
internal object AppClient { get; set; }
internal object AdminClient { get; set; }
internal bool CanEncrypt => Encryptor != null;
internal bool CanDecrypt => Encryptor?.CanDecrypt ?? false;
internal AppInternalInfo(string appName, Type settingsType)
{
AppName = appName;
SettingsType = settingsType;
}
internal string Encrypt(string plainText)
{
var encryptor = Encryptor;
if (encryptor == null)
throw new NFigException($"Cannot encrypt value. App \"{AppName}\" does not have an encryptor set.");
if (plainText == null)
return null;
return encryptor.Encrypt(plainText);
}
internal string Decrypt(string encrypted)
{
var encryptor = Encryptor;
if (encryptor == null)
throw new NFigException($"Cannot decrypt value. App \"{AppName}\" does not have an encryptor set.");
if (!encryptor.CanDecrypt)
throw new NFigException($"Cannot decrypt value. App \"{AppName}\" has an encrypt-only encryptor.");
if (encrypted == null)
return null;
return encryptor.Decrypt(encrypted);
}
}
}
|
mit
|
C#
|
3d4c7bc35c0bf1ffd1137655184acc4da1d0aa30
|
Make sure Jasper MessageId goes across the wire
|
JasperFx/jasper,JasperFx/jasper,JasperFx/jasper
|
src/Jasper.ConfluentKafka/KafkaTransportProtocol.cs
|
src/Jasper.ConfluentKafka/KafkaTransportProtocol.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Confluent.Kafka;
using Jasper.Transports;
namespace Jasper.ConfluentKafka
{
public class KafkaTransportProtocol<TKey, TVal> : ITransportProtocol<Message<TKey, TVal>>
{
private const string JasperMessageIdHeader = "Jasper_MessageId";
public Message<TKey, TVal> WriteFromEnvelope(Envelope envelope)
{
var message = new Message<TKey, TVal>
{
Headers = new Headers(),
Value = (TVal) envelope.Message
};
foreach (KeyValuePair<string, string> h in envelope.Headers)
{
Header header = new Header(h.Key, Encoding.UTF8.GetBytes(h.Value));
message.Headers.Add(header);
}
message.Headers.Add(JasperMessageIdHeader, Encoding.UTF8.GetBytes(envelope.Id.ToString()));
return message;
}
public Envelope ReadEnvelope(Message<TKey, TVal> message)
{
var env = new Envelope();
foreach (var header in message.Headers.Where(h => !h.Key.StartsWith("Jasper")))
{
env.Headers.Add(header.Key, Encoding.UTF8.GetString(header.GetValueBytes()));
}
var messageIdHeader = message.Headers.Single(h => h.Key.Equals(JasperMessageIdHeader));
env.Id = Guid.Parse(Encoding.UTF8.GetString(messageIdHeader.GetValueBytes()));
env.Message = message.Value;
return env;
}
}
}
|
using System.Text;
using Confluent.Kafka;
using Jasper.Transports;
namespace Jasper.ConfluentKafka
{
public class KafkaTransportProtocol<TKey, TVal> : ITransportProtocol<Message<TKey, TVal>>
{
public Message<TKey, TVal> WriteFromEnvelope(Envelope envelope) =>
new Message<TKey, TVal>
{
Headers = new Headers(),
Value = (TVal) envelope.Message
};
public Envelope ReadEnvelope(Message<TKey, TVal> message)
{
var env = new Envelope();
foreach (var header in message.Headers)
{
env.Headers.Add(header.Key, Encoding.UTF8.GetString(header.GetValueBytes()));
}
env.Message = message.Value;
return env;
}
}
}
|
mit
|
C#
|
f4e20cebb3c4f317f5350031e1b167cc5b1f6ced
|
Address CodeFactor.
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Controls/LockScreen/SlideLockScreen.xaml.cs
|
WalletWasabi.Gui/Controls/LockScreen/SlideLockScreen.xaml.cs
|
using System;
using System.Collections.Generic;
using Avalonia.Media;
using Avalonia.Input;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Controls.Primitives;
using ReactiveUI;
using Avalonia;
using System.Reactive.Linq;
using System.Reactive.Disposables;
namespace WalletWasabi.Gui.Controls.LockScreen
{
public class SlideLockScreen : UserControl
{
public static readonly DirectProperty<SlideLockScreen, bool> IsLockedProperty =
AvaloniaProperty.RegisterDirect<SlideLockScreen, bool>(nameof(IsLocked),
o => o.IsLocked,
(o, v) => o.IsLocked = v);
private bool _isLocked;
public bool IsLocked
{
get => _isLocked;
set => SetAndRaise(IsLockedProperty, ref _isLocked, value);
}
private TranslateTransform TargetTransform { get; } = new TranslateTransform();
private Thumb DragThumb { get; }
public void OnDataContextChanged()
{
var vm = this.DataContext as SlideLockScreenViewModel;
vm.WhenAnyValue(x => x.Offset)
.Subscribe(x => TargetTransform.Y = x)
.DisposeWith(vm.Disposables);
vm.WhenAnyValue(x => x.IsLocked)
.Where(x => x)
.Subscribe(x => vm.Offset = 0)
.DisposeWith(vm.Disposables);
this.WhenAnyValue(x => x.Bounds)
.Select(x => x.Height)
.Subscribe(x => vm.Threshold = x * vm.ThresholdPercent)
.DisposeWith(vm.Disposables);
Observable.FromEventPattern(DragThumb, nameof(DragThumb.DragCompleted))
.Subscribe(e => vm.IsUserDragging = false)
.DisposeWith(vm.Disposables);
Observable.FromEventPattern(DragThumb, nameof(DragThumb.DragStarted))
.Subscribe(e => vm.IsUserDragging = true)
.DisposeWith(vm.Disposables);
Observable.FromEventPattern<VectorEventArgs>(DragThumb, nameof(DragThumb.DragDelta))
.Where(e => e.EventArgs.Vector.Y < 0)
.Select(e => e.EventArgs.Vector.Y)
.Subscribe(x => vm.Offset = x)
.DisposeWith(vm.Disposables);
Clock.Where(x => vm.IsLocked)
.Subscribe(vm.OnClockTick)
.DisposeWith(vm.Disposables);
}
public SlideLockScreen() : base()
{
InitializeComponent();
DragThumb = this.FindControl<Thumb>("PART_DragThumb");
this.FindControl<Grid>("Shade").RenderTransform = TargetTransform;
this.DataContextChanged += delegate
{
if (this.DataContext is SlideLockScreenViewModel)
OnDataContextChanged();
};
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|
using System;
using System.Collections.Generic;
using Avalonia.Media;
using Avalonia.Input;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Controls.Primitives;
using ReactiveUI;
using Avalonia;
using System.Reactive.Linq;
using System.Reactive.Disposables;
namespace WalletWasabi.Gui.Controls.LockScreen
{
public class SlideLockScreen : UserControl
{
public static readonly DirectProperty<SlideLockScreen, bool> IsLockedProperty =
AvaloniaProperty.RegisterDirect<SlideLockScreen, bool>(nameof(IsLocked),
o => o.IsLocked,
(o, v) => o.IsLocked = v);
private bool _isLocked;
public bool IsLocked
{
get => _isLocked;
set => SetAndRaise(IsLockedProperty, ref _isLocked, value);
}
private TranslateTransform TargetTransform { get; } = new TranslateTransform();
private Thumb DragThumb { get; }
public void OnDataContextChanged()
{
var vm = this.DataContext as SlideLockScreenViewModel;
vm.WhenAnyValue(x => x.Offset)
.Subscribe(x => TargetTransform.Y = x)
.DisposeWith(vm.Disposables);
vm.WhenAnyValue(x => x.IsLocked)
.Where(x => x)
.Subscribe(x => vm.Offset = 0)
.DisposeWith(vm.Disposables);
this.WhenAnyValue(x => x.Bounds)
.ObserveOn(RxApp.MainThreadScheduler)
.Select(x => x.Height)
.Subscribe(x => vm.Threshold = x * vm.ThresholdPercent)
.DisposeWith(vm.Disposables);
Observable.FromEventPattern(DragThumb, nameof(DragThumb.DragCompleted))
.Subscribe(e => vm.IsUserDragging = false)
.DisposeWith(vm.Disposables);
Observable.FromEventPattern(DragThumb, nameof(DragThumb.DragStarted))
.Subscribe(e => vm.IsUserDragging = true)
.DisposeWith(vm.Disposables);
Observable.FromEventPattern<VectorEventArgs>(DragThumb, nameof(DragThumb.DragDelta))
.Where(e => e.EventArgs.Vector.Y < 0)
.Select(e => e.EventArgs.Vector.Y)
.Subscribe(x => vm.Offset = x)
.DisposeWith(vm.Disposables);
Clock.Where(x => vm.IsLocked)
.Subscribe(vm.OnClockTick)
.DisposeWith(vm.Disposables);
}
public SlideLockScreen() : base()
{
InitializeComponent();
DragThumb = this.FindControl<Thumb>("PART_DragThumb");
this.FindControl<Grid>("Shade").RenderTransform = TargetTransform;
this.DataContextChanged += delegate
{
if (this.DataContext is SlideLockScreenViewModel)
OnDataContextChanged();
};
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|
mit
|
C#
|
ceb76b10958ee4de347df36b6f6fea85550a6429
|
Remove unused using statements.
|
wangkanai/Detection
|
test/Wangkanai.Detection.Test/DetectionServiceTests.cs
|
test/Wangkanai.Detection.Test/DetectionServiceTests.cs
|
using Microsoft.AspNetCore.Http;
using System;
using Xunit;
namespace Wangkanai.Detection.Test
{
public class DetectionServiceTests
{
[Fact]
public void Ctor_IServiceProvider_Success()
{
string userAgent = "Agent";
var context = new DefaultHttpContext();
context.Request.Headers["User-Agent"] = userAgent;
var serviceProvider = new ServiceProvider()
{
HttpContextAccessor = new HttpContextAccessor()
{
HttpContext = context
}
};
var detectionService = new DetectionService(serviceProvider);
Assert.NotNull(detectionService.Context);
Assert.NotNull(detectionService.UserAgent);
Assert.Equal(userAgent.ToLowerInvariant(), detectionService.UserAgent.ToString());
}
[Fact]
public void Ctor_Null_ThrowsArgumentNullException()
{
Assert.Throws<ArgumentNullException>(() => new DetectionService(null));
}
[Fact]
public void Ctor_HttpContextAccessorNotResolved_ThrowsInvalidOperationException()
{
Assert.Throws<InvalidOperationException>(() => new DetectionService(new ServiceProvider()));
}
[Fact]
public void Ctor_HttpContextNull_ThrowsArgumentNullException()
{
var serviceProvider = new ServiceProvider()
{
HttpContextAccessor = new HttpContextAccessor()
};
Assert.Null(serviceProvider.HttpContextAccessor.HttpContext);
Assert.Throws<ArgumentNullException>(() => new DetectionService(serviceProvider));
}
private class ServiceProvider : IServiceProvider
{
public IHttpContextAccessor HttpContextAccessor { get; set; }
public object GetService(Type serviceType)
{
return this.HttpContextAccessor;
}
}
}
}
|
using Microsoft.AspNetCore.Http;
using System;
using System.IO;
using Xunit;
namespace Wangkanai.Detection.Test
{
public class DetectionServiceTests
{
[Fact]
public void Ctor_IServiceProvider_Success()
{
string userAgent = "Agent";
var context = new DefaultHttpContext();
context.Request.Headers["User-Agent"] = userAgent;
var serviceProvider = new ServiceProvider()
{
HttpContextAccessor = new HttpContextAccessor()
{
HttpContext = context
}
};
var detectionService = new DetectionService(serviceProvider);
Assert.NotNull(detectionService.Context);
Assert.NotNull(detectionService.UserAgent);
Assert.Equal(userAgent.ToLowerInvariant(), detectionService.UserAgent.ToString());
}
[Fact]
public void Ctor_Null_ThrowsArgumentNullException()
{
Assert.Throws<ArgumentNullException>(() => new DetectionService(null));
}
[Fact]
public void Ctor_HttpContextAccessorNotResolved_ThrowsInvalidOperationException()
{
Assert.Throws<InvalidOperationException>(() => new DetectionService(new ServiceProvider()));
}
[Fact]
public void Ctor_HttpContextNull_ThrowsArgumentNullException()
{
var serviceProvider = new ServiceProvider()
{
HttpContextAccessor = new HttpContextAccessor()
};
Assert.Null(serviceProvider.HttpContextAccessor.HttpContext);
Assert.Throws<ArgumentNullException>(() => new DetectionService(serviceProvider));
}
private class ServiceProvider : IServiceProvider
{
public IHttpContextAccessor HttpContextAccessor { get; set; }
public object GetService(Type serviceType)
{
return this.HttpContextAccessor;
}
}
}
}
|
apache-2.0
|
C#
|
6bd8269066d8e2472d9a8fedb9b7d1f0c53b489b
|
Update to RC@
|
Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnet5,AzureADSamples/WebApp-OpenIdConnect-AspNet5,Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnet5,Azure-Samples/active-directory-dotnet-webapp-openidconnect-aspnet5,AzureADSamples/WebApp-OpenIdConnect-AspNet5,AzureADSamples/WebApp-OpenIdConnect-AspNet5
|
WebApp-OpenIdConnect-DotNet/Controllers/AccountController.cs
|
WebApp-OpenIdConnect-DotNet/Controllers/AccountController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Mvc;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace WebApp_OpenIDConnect_DotNet.Controllers
{
public class AccountController : Controller
{
// GET: /Account/Login
[HttpGet]
public async Task Login()
{
if (HttpContext.User == null || !HttpContext.User.Identity.IsAuthenticated)
await HttpContext.Authentication.ChallengeAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties { RedirectUri = "/" });
}
// GET: /Account/LogOff
[HttpGet]
public async Task LogOff()
{
if (HttpContext.User.Identity.IsAuthenticated)
{
await HttpContext.Authentication.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme);
await HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Mvc;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace WebApp_OpenIDConnect_DotNet.Controllers
{
public class AccountController : Controller
{
// GET: /Account/Login
[HttpGet]
public async void Login()
{
try
{
if (HttpContext.User == null || !HttpContext.User.Identity.IsAuthenticated)
await HttpContext.Authentication.ChallengeAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties { RedirectUri = "/" });
}
catch (Exception ex)
{
}
}
// GET: /Account/LogOff
[HttpGet]
public async void LogOff()
{
if (HttpContext.User.Identity.IsAuthenticated)
{
await HttpContext.Authentication.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme);
await HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
}
}
}
}
|
unknown
|
C#
|
9a2425f316903a8725da40f6d0374afa91aebe8c
|
Remove unused field for now to appease inspectcode
|
peppy/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu,ppy/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu
|
osu.Game/Beatmaps/Drawables/Cards/Buttons/DownloadButton.cs
|
osu.Game/Beatmaps/Drawables/Cards/Buttons/DownloadButton.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.Sprites;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
{
public class DownloadButton : BeatmapCardIconButton
{
public DownloadButton(APIBeatmapSet beatmapSet)
{
Icon.Icon = FontAwesome.Solid.FileDownload;
}
// TODO: implement behaviour
}
}
|
// 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.Sprites;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
{
public class DownloadButton : BeatmapCardIconButton
{
private readonly APIBeatmapSet beatmapSet;
public DownloadButton(APIBeatmapSet beatmapSet)
{
this.beatmapSet = beatmapSet;
Icon.Icon = FontAwesome.Solid.FileDownload;
}
// TODO: implement behaviour
}
}
|
mit
|
C#
|
f79097ecb8419b24b49bde64a8fe13387901b143
|
Format AwsCredential
|
carbon/Amazon
|
src/Amazon.Core/Security/AwsCredential.cs
|
src/Amazon.Core/Security/AwsCredential.cs
|
using System;
using System.Threading.Tasks;
namespace Amazon
{
public sealed class AwsCredential : IAwsCredential
{
public AwsCredential(string accessKeyId, string secretAccessKey)
{
AccessKeyId = accessKeyId ?? throw new ArgumentNullException(nameof(accessKeyId));
SecretAccessKey = secretAccessKey ?? throw new ArgumentNullException(nameof(secretAccessKey));
}
// 16 - 32 characters
public string AccessKeyId { get; }
public string SecretAccessKey { get; }
public string? SecurityToken => null;
// {id}:{secret}
public static AwsCredential Parse(string text)
{
if (text is null)
throw new ArgumentNullException(nameof(text));
int colonIndex = text.IndexOf(':');
if (colonIndex == -1)
{
throw new Exception("accessKeyId & secretAccessKey must be seperated by ':'");
}
return new AwsCredential(
accessKeyId : text.Substring(0, colonIndex),
secretAccessKey : text.Substring(colonIndex + 1)
);
}
public bool ShouldRenew => false;
public Task<bool> RenewAsync() => Task.FromResult(false);
}
}
|
using System;
using System.Threading.Tasks;
namespace Amazon
{
public sealed class AwsCredential : IAwsCredential
{
public AwsCredential(string accessKeyId, string secretAccessKey)
{
AccessKeyId = accessKeyId ?? throw new ArgumentNullException(nameof(accessKeyId));
SecretAccessKey = secretAccessKey ?? throw new ArgumentNullException(nameof(secretAccessKey));
}
// 16 - 32 characters
public string AccessKeyId { get; }
public string SecretAccessKey { get; }
public string? SecurityToken => null;
// {id}:{secret}
public static AwsCredential Parse(string text)
{
if (text is null)
throw new ArgumentNullException(nameof(text));
var colonIndex = text.IndexOf(':');
if (colonIndex == -1)
{
throw new Exception("accessKeyId & secretAccessKey must be seperated by ':'");
}
return new AwsCredential(
accessKeyId : text.Substring(0, colonIndex),
secretAccessKey : text.Substring(colonIndex + 1)
);
}
#region Renewable
public bool ShouldRenew => false;
public Task<bool> RenewAsync() => throw new NotImplementedException("AwsCredential is not renewable");
#endregion
}
}
|
mit
|
C#
|
0623b2eb1fc440e8011d54ec140b6ac8297888c6
|
Clean up EndOfRequestHandler
|
stormleoxia/xsp,stormleoxia/xsp,arthot/xsp,murador/xsp,murador/xsp,murador/xsp,arthot/xsp,stormleoxia/xsp,arthot/xsp,murador/xsp,arthot/xsp,stormleoxia/xsp
|
src/Mono.WebServer/EndOfRequestHandler.cs
|
src/Mono.WebServer/EndOfRequestHandler.cs
|
//
// Mono.WebServer.EndOfRequestHandler
//
// Authors:
// Daniel Lopez Ridruejo
// Gonzalo Paniagua Javier
//
// Documentation:
// Brian Nickel
//
// Copyright (c) 2002 Daniel Lopez Ridruejo.
// (c) 2002,2003 Ximian, Inc.
// All rights reserved.
// (C) Copyright 2004-2010 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace Mono.WebServer
{
public delegate void EndOfRequestHandler (MonoWorkerRequest request);
}
|
//
// Mono.WebServer.EndOfRequestHandler
//
// Authors:
// Daniel Lopez Ridruejo
// Gonzalo Paniagua Javier
//
// Documentation:
// Brian Nickel
//
// Copyright (c) 2002 Daniel Lopez Ridruejo.
// (c) 2002,2003 Ximian, Inc.
// All rights reserved.
// (C) Copyright 2004-2010 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Web;
using System.Web.Hosting;
namespace Mono.WebServer
{
public delegate void EndOfRequestHandler (MonoWorkerRequest request);
}
|
mit
|
C#
|
f097e26796a76aa92c2b224c7d4933fd9cd97d57
|
add Teaser to aria-label and title for accessibility
|
smbc-digital/iag-webapp,smbc-digital/iag-webapp,smbc-digital/iag-webapp
|
src/StockportWebapp/Views/Shared/CampaignBanner.cshtml
|
src/StockportWebapp/Views/Shared/CampaignBanner.cshtml
|
@model StockportWebapp.Models.CarouselContent
<div>
<a href="@Model.URL" aria-label="@Model.Title @Model.Teaser" title="@Model.Title @Model.Teaser">
<div class="l-background-hs-image">
<div class="stockport-carousel-text">
<h1>@Model.Title</h1>
<p>
@Model.Teaser
</p>
</div>
<div class="stockport-carousel-gradient"></div>
</div>
</a>
</div>
|
@model StockportWebapp.Models.CarouselContent
<div>
<a href="@Model.URL" aria-label="@Model.Title" title="@Model.Title">
<div class="l-background-hs-image">
<div class="stockport-carousel-text">
<h1>@Model.Title</h1>
<p>
@Model.Teaser
</p>
</div>
<div class="stockport-carousel-gradient"></div>
</div>
</a>
</div>
|
mit
|
C#
|
391882a3dd3e1c86f0ea116b7ad71f3f9ed3b761
|
Fix tests
|
merbla/serilog,serilog/serilog,skomis-mm/serilog,serilog/serilog,CaioProiete/serilog,nblumhardt/serilog,merbla/serilog,skomis-mm/serilog,nblumhardt/serilog
|
src/Serilog/Formatting/Display/Padding.cs
|
src/Serilog/Formatting/Display/Padding.cs
|
using System.IO;
using Serilog.Parsing;
namespace Serilog.Formatting.Display
{
static class Padding
{
static readonly char[] PaddingChars = new string(' ', 80).ToCharArray();
/// <summary>
/// Writes the provided value to the output, applying direction-based padding when <paramref name="alignment"/> is provided.
/// </summary>
public static void Apply(TextWriter output, string value, Alignment? alignment)
{
if (!alignment.HasValue || value.Length >= alignment.Value.Width)
{
output.Write(value);
return;
}
var pad = alignment.Value.Width - value.Length;
if (alignment.Value.Direction == AlignmentDirection.Left)
output.Write(value);
if (pad <= PaddingChars.Length)
{
output.Write(PaddingChars, 0, pad);
}
else
{
output.Write(new string(' ', pad));
}
if (alignment.Value.Direction == AlignmentDirection.Right)
output.Write(value);
}
}
}
|
using System.IO;
using Serilog.Parsing;
namespace Serilog.Formatting.Display
{
static class Padding
{
static readonly char[] PaddingChars = new string(' ', 80).ToCharArray();
/// <summary>
/// Writes the provided value to the output, applying direction-based padding when <paramref name="alignment"/> is provided.
/// </summary>
public static void Apply(TextWriter output, string value, Alignment? alignment)
{
if (!alignment.HasValue || value.Length <= alignment.Value.Width)
{
output.Write(value);
return;
}
var pad = alignment.Value.Width - value.Length;
if (alignment.Value.Direction == AlignmentDirection.Left)
output.Write(value);
if (pad <= PaddingChars.Length)
{
output.Write(PaddingChars, 0, pad);
}
else
{
output.Write(new string(' ', pad));
}
if (alignment.Value.Direction == AlignmentDirection.Right)
output.Write(value);
}
}
}
|
apache-2.0
|
C#
|
8ea4c10ce7ad7f1559c9177378a78757464537e1
|
Fix GetCurrentRequestIpAddress when there is no request
|
hfloyd/Umbraco-CMS,leekelleher/Umbraco-CMS,WebCentrum/Umbraco-CMS,rasmuseeg/Umbraco-CMS,abryukhov/Umbraco-CMS,lars-erik/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,NikRimington/Umbraco-CMS,madsoulswe/Umbraco-CMS,lars-erik/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,madsoulswe/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,NikRimington/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,bjarnef/Umbraco-CMS,umbraco/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,tcmorris/Umbraco-CMS,lars-erik/Umbraco-CMS,tcmorris/Umbraco-CMS,rasmuseeg/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,WebCentrum/Umbraco-CMS,bjarnef/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,lars-erik/Umbraco-CMS,madsoulswe/Umbraco-CMS,WebCentrum/Umbraco-CMS,leekelleher/Umbraco-CMS,abjerner/Umbraco-CMS,tompipe/Umbraco-CMS,hfloyd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,tompipe/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,rasmuseeg/Umbraco-CMS,robertjf/Umbraco-CMS,leekelleher/Umbraco-CMS,NikRimington/Umbraco-CMS,arknu/Umbraco-CMS,bjarnef/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,lars-erik/Umbraco-CMS,marcemarc/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS
|
src/Umbraco.Core/HttpContextExtensions.cs
|
src/Umbraco.Core/HttpContextExtensions.cs
|
using System.Web;
namespace Umbraco.Core
{
public static class HttpContextExtensions
{
public static T GetContextItem<T>(this HttpContextBase httpContext, string key)
{
if (httpContext == null) return default(T);
if (httpContext.Items[key] == null) return default(T);
var val = httpContext.Items[key].TryConvertTo<T>();
if (val) return val.Result;
return default(T);
}
public static T GetContextItem<T>(this HttpContext httpContext, string key)
{
return new HttpContextWrapper(httpContext).GetContextItem<T>(key);
}
public static string GetCurrentRequestIpAddress(this HttpContextBase httpContext)
{
if (httpContext == null)
{
return "Unknown, httpContext is null";
}
HttpRequestBase request;
try
{
// is not null - throws
request = httpContext.Request;
}
catch
{
return "Unknown, httpContext.Request is null";
}
if (request.ServerVariables == null)
{
return "Unknown, httpContext.Request.ServerVariables is null";
}
// From: http://stackoverflow.com/a/740431/5018
try
{
var ipAddress = request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (string.IsNullOrEmpty(ipAddress))
return request.UserHostAddress;
var addresses = ipAddress.Split(',');
if (addresses.Length != 0)
return addresses[0];
return request.UserHostAddress;
}
catch (System.Exception ex)
{
//This try catch is to just always ensure that no matter what we're not getting any exceptions caused since
// that would cause people to not be able to login
return string.Format("Unknown, exception occurred trying to resolve IP {0}", ex);
}
}
}
}
|
using System.Web;
namespace Umbraco.Core
{
public static class HttpContextExtensions
{
public static T GetContextItem<T>(this HttpContextBase httpContext, string key)
{
if (httpContext == null) return default(T);
if (httpContext.Items[key] == null) return default(T);
var val = httpContext.Items[key].TryConvertTo<T>();
if (val) return val.Result;
return default(T);
}
public static T GetContextItem<T>(this HttpContext httpContext, string key)
{
return new HttpContextWrapper(httpContext).GetContextItem<T>(key);
}
public static string GetCurrentRequestIpAddress(this HttpContextBase httpContext)
{
if (httpContext == null)
{
return "Unknown, httpContext is null";
}
if (httpContext.Request == null)
{
return "Unknown, httpContext.Request is null";
}
if (httpContext.Request.ServerVariables == null)
{
return "Unknown, httpContext.Request.ServerVariables is null";
}
// From: http://stackoverflow.com/a/740431/5018
try
{
var ipAddress = httpContext.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (string.IsNullOrEmpty(ipAddress))
return httpContext.Request.UserHostAddress;
var addresses = ipAddress.Split(',');
if (addresses.Length != 0)
return addresses[0];
return httpContext.Request.UserHostAddress;
}
catch (System.Exception ex)
{
//This try catch is to just always ensure that no matter what we're not getting any exceptions caused since
// that would cause people to not be able to login
return string.Format("Unknown, exception occurred trying to resolve IP {0}", ex);
}
}
}
}
|
mit
|
C#
|
a510bd363f78f0a72d0ff109fde1ef5fe9f23cc0
|
Enable lowercase-urls by default
|
hanssens/recipes-for-kendo
|
source/RecipesForKendo.Web/App_Start/RouteConfig.cs
|
source/RecipesForKendo.Web/App_Start/RouteConfig.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace RecipesForKendo.Web
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.LowercaseUrls = true;
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace RecipesForKendo.Web
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
|
mit
|
C#
|
cc97b1fb84195a792cef2b33ebc07a91da2f65ee
|
Replace LocalCache on MemoryDistributedCache
|
OrchardCMS/Brochard,OrchardCMS/Brochard,petedavis/Orchard2,xkproject/Orchard2,yiji/Orchard2,jtkech/Orchard2,alexbocharov/Orchard2,yiji/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,lukaskabrt/Orchard2,stevetayloruk/Orchard2,webrot/Orchard2,petedavis/Orchard2,petedavis/Orchard2,lukaskabrt/Orchard2,webrot/Orchard2,stevetayloruk/Orchard2,GVX111/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,alexbocharov/Orchard2,xkproject/Orchard2,alexbocharov/Orchard2,GVX111/Orchard2,jtkech/Orchard2,lukaskabrt/Orchard2,jtkech/Orchard2,lukaskabrt/Orchard2,xkproject/Orchard2,xkproject/Orchard2,webrot/Orchard2,jtkech/Orchard2,GVX111/Orchard2,yiji/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2
|
src/Orchard.Environment.Cache/DefaultMemoryCache.cs
|
src/Orchard.Environment.Cache/DefaultMemoryCache.cs
|
using Orchard.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Orchard.Environment.Cache
{
public class DefaultMemoryCache : IModule
{
public void Configure(IServiceCollection serviceCollection)
{
// MVC is already registering IMemoryCache as host singleton. We are registering it again
// in this module so that there is one instance for each tenant.
serviceCollection.Add(ServiceDescriptor.Singleton<IMemoryCache, MemoryCache>());
// LocalCache is registered as transient as its implementation resolves IMemoryCache, thus
// there is no state to keep in its instance.
serviceCollection.Add(ServiceDescriptor.Transient<IDistributedCache, MemoryDistributedCache>());
}
}
}
|
using Orchard.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Orchard.Environment.Cache
{
public class DefaultMemoryCache : IModule
{
public void Configure(IServiceCollection serviceCollection)
{
// MVC is already registering IMemoryCache as host singleton. We are registering it again
// in this module so that there is one instance for each tenant.
serviceCollection.Add(ServiceDescriptor.Singleton<IMemoryCache, MemoryCache>());
// LocalCache is registered as transient as its implementation resolves IMemoryCache, thus
// there is no state to keep in its instance.
serviceCollection.Add(ServiceDescriptor.Transient<IDistributedCache, LocalCache>());
}
}
}
|
bsd-3-clause
|
C#
|
95ef9f70b2ab7efa13e4f6f7938838c806bedba1
|
Fix MemberCloneResult constructor
|
Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver
|
src/AsmResolver.DotNet/Cloning/MemberCloneResult.cs
|
src/AsmResolver.DotNet/Cloning/MemberCloneResult.cs
|
using System;
using System.Collections.Generic;
namespace AsmResolver.DotNet.Cloning
{
/// <summary>
/// Provides information about the result of a metadata cloning procedure.
/// </summary>
public class MemberCloneResult
{
private readonly IDictionary<IMemberDescriptor, IMemberDescriptor> clonedMembers;
/// <summary>
/// Creates a new instance of the <see cref="MemberCloneResult"/> class.
/// </summary>
/// <param name="clonedMembers">The cloned members.</param>
public MemberCloneResult(IDictionary<IMemberDescriptor, IMemberDescriptor> clonedMembers)
{
this.clonedMembers = clonedMembers;
ClonedMembers = new List<IMemberDescriptor>(clonedMembers.Values);
OriginalMembers = new List<IMemberDescriptor>(clonedMembers.Keys);
}
/// <summary>
/// Gets a collection of all cloned members.
/// </summary>
public ICollection<IMemberDescriptor> ClonedMembers
{
get;
}
/// <summary>
/// Gets a collection of all original members.
/// </summary>
public ICollection<IMemberDescriptor> OriginalMembers
{
get;
}
/// <summary>
/// Gets the cloned <see cref="IMemberDescriptor"/> by its original <see cref="IMemberDescriptor"/>.
/// </summary>
/// <param name="originalMember">Original <see cref="IMemberDescriptor"/></param>
/// <exception cref="ArgumentOutOfRangeException">Occurs when <paramref name="originalMember"/> is not a member of <see cref="OriginalMembers"/></exception>
/// <returns>Cloned <see cref="IMemberDescriptor"/></returns>
public IMemberDescriptor GetClonedMember(IMemberDescriptor originalMember)
{
if (clonedMembers.ContainsKey(originalMember))
throw new ArgumentOutOfRangeException(nameof(originalMember));
return clonedMembers[originalMember];
}
}
}
|
using System;
using System.Collections.Generic;
namespace AsmResolver.DotNet.Cloning
{
/// <summary>
/// Provides information about the result of a metadata cloning procedure.
/// </summary>
public class MemberCloneResult
{
private readonly IDictionary<IMemberDescriptor, IMemberDescriptor> clonedMembers;
/// <summary>
/// Creates a new instance of the <see cref="MemberCloneResult"/> class.
/// </summary>
/// <param name="clonedMembers">The cloned members.</param>
public MemberCloneResult(IDictionary<IMemberDescriptor, IMemberDescriptor> clonedMembers)
{
ClonedMembers = new List<IMemberDescriptor>(this.clonedMembers.Values);
OriginalMembers = new List<IMemberDescriptor>(this.clonedMembers.Keys);
this.clonedMembers = clonedMembers;
}
/// <summary>
/// Gets a collection of all cloned members.
/// </summary>
public ICollection<IMemberDescriptor> ClonedMembers
{
get;
}
/// <summary>
/// Gets a collection of all original members.
/// </summary>
public ICollection<IMemberDescriptor> OriginalMembers
{
get;
}
/// <summary>
/// Gets the cloned <see cref="IMemberDescriptor"/> by its original <see cref="IMemberDescriptor"/>.
/// </summary>
/// <param name="originalMember">Original <see cref="IMemberDescriptor"/></param>
/// <exception cref="ArgumentOutOfRangeException">Occurs when <paramref name="originalMember"/> is not a member of <see cref="OriginalMembers"/></exception>
/// <returns>Cloned <see cref="IMemberDescriptor"/></returns>
public IMemberDescriptor GetClonedMember(IMemberDescriptor originalMember)
{
if (clonedMembers.ContainsKey(originalMember))
throw new ArgumentOutOfRangeException(nameof(originalMember));
return clonedMembers[originalMember];
}
}
}
|
mit
|
C#
|
2f1ffbd81e6d573a6d5dfa6b06647a0d071d3903
|
Make ThreadSafeObjectPool actually thread safe (#8106)
|
AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,grokys/Perspex,grokys/Perspex,SuperJMN/Avalonia
|
src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs
|
src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs
|
using System.Collections.Generic;
namespace Avalonia.Threading
{
public class ThreadSafeObjectPool<T> where T : class, new()
{
private Stack<T> _stack = new Stack<T>();
public static ThreadSafeObjectPool<T> Default { get; } = new ThreadSafeObjectPool<T>();
public T Get()
{
lock (_stack)
{
if(_stack.Count == 0)
return new T();
return _stack.Pop();
}
}
public void Return(T obj)
{
lock (_stack)
{
_stack.Push(obj);
}
}
}
}
|
using System.Collections.Generic;
namespace Avalonia.Threading
{
public class ThreadSafeObjectPool<T> where T : class, new()
{
private Stack<T> _stack = new Stack<T>();
private object _lock = new object();
public static ThreadSafeObjectPool<T> Default { get; } = new ThreadSafeObjectPool<T>();
public T Get()
{
lock (_lock)
{
if(_stack.Count == 0)
return new T();
return _stack.Pop();
}
}
public void Return(T obj)
{
lock (_stack)
{
_stack.Push(obj);
}
}
}
}
|
mit
|
C#
|
af268c1e8fc62382a06009516e27195848cef23a
|
add panel control to test app
|
northwoodspd/UIA.Extensions,northwoodspd/UIA.Extensions
|
src/UIA.Fluent.TestApplication/MainForm.Designer.cs
|
src/UIA.Fluent.TestApplication/MainForm.Designer.cs
|
namespace UIA.Fluent.TestApplication
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.basicPanel = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// basicPanel
//
this.basicPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.basicPanel.Location = new System.Drawing.Point(12, 12);
this.basicPanel.Name = "basicPanel";
this.basicPanel.Size = new System.Drawing.Size(589, 288);
this.basicPanel.TabIndex = 0;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(613, 312);
this.Controls.Add(this.basicPanel);
this.Name = "MainForm";
this.Text = "UIA.Fluent Test Application";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel basicPanel;
}
}
|
namespace UIA.Fluent.TestApplication
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(613, 312);
this.Name = "MainForm";
this.Text = "UIA.Fluent Test Application";
this.ResumeLayout(false);
}
#endregion
}
}
|
mit
|
C#
|
436a6df917da0b3bea796da3c0471b12889db148
|
Fix up log viewer - if viewing all log items & filterExpression is null or emtpy string return all log items
|
abjerner/Umbraco-CMS,rasmuseeg/Umbraco-CMS,leekelleher/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,madsoulswe/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,bjarnef/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,rasmuseeg/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tcmorris/Umbraco-CMS,rasmuseeg/Umbraco-CMS,bjarnef/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,NikRimington/Umbraco-CMS,bjarnef/Umbraco-CMS,NikRimington/Umbraco-CMS,dawoe/Umbraco-CMS,NikRimington/Umbraco-CMS,leekelleher/Umbraco-CMS,mattbrailsford/Umbraco-CMS,hfloyd/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,arknu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS,hfloyd/Umbraco-CMS,marcemarc/Umbraco-CMS,madsoulswe/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,leekelleher/Umbraco-CMS,mattbrailsford/Umbraco-CMS,KevinJump/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,tcmorris/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,leekelleher/Umbraco-CMS
|
src/Umbraco.Core/Logging/Viewer/ExpressionFilter.cs
|
src/Umbraco.Core/Logging/Viewer/ExpressionFilter.cs
|
using System;
using System.Linq;
using Serilog.Events;
using Serilog.Filters.Expressions;
namespace Umbraco.Core.Logging.Viewer
{
//Log Expression Filters (pass in filter exp string)
public class ExpressionFilter : ILogFilter
{
private Func<LogEvent, bool> _filter;
private readonly string expressionOperators = "()+=*<>%-";
public ExpressionFilter(string filterExpression)
{
Func<LogEvent, bool> filter = null;
if (string.IsNullOrEmpty(filterExpression) == false)
{
// If the expression is one word and doesn't contain a serilog operator then we can perform a like search
if (!filterExpression.Contains(" ") && !filterExpression.ContainsAny(expressionOperators.Select(c => c)))
{
filter = PerformMessageLikeFilter(filterExpression);
}
else // check if it's a valid expression
{
// If the expression evaluates then make it into a filter
if (FilterLanguage.TryCreateFilter(filterExpression, out Func<LogEvent, object> eval, out string error))
{
filter = evt => true.Equals(eval(evt));
}
else
{
//Assume the expression was a search string and make a Like filter from that
filter = PerformMessageLikeFilter(filterExpression);
}
}
_filter = filter;
}
}
public bool TakeLogEvent(LogEvent e)
{
if(_filter == null)
{
//If no filter has been setup - take all log items
return true;
}
return _filter(e);
}
private Func<LogEvent, bool> PerformMessageLikeFilter(string filterExpression)
{
var filterSearch = $"@Message like '%{FilterLanguage.EscapeLikeExpressionContent(filterExpression)}%'";
if (FilterLanguage.TryCreateFilter(filterSearch, out var eval, out var error))
{
return evt => true.Equals(eval(evt));
}
return null;
}
}
}
|
using System;
using System.Linq;
using Serilog.Events;
using Serilog.Filters.Expressions;
namespace Umbraco.Core.Logging.Viewer
{
//Log Expression Filters (pass in filter exp string)
public class ExpressionFilter : ILogFilter
{
private Func<LogEvent, bool> _filter;
private readonly string expressionOperators = "()+=*<>%-";
public ExpressionFilter(string filterExpression)
{
Func<LogEvent, bool> filter = null;
// If the expression is one word and doesn't contain a serilog operator then we can perform a like search
if (!filterExpression.Contains(" ") && !filterExpression.ContainsAny(expressionOperators.Select(c => c)))
{
filter = PerformMessageLikeFilter(filterExpression);
}
else // check if it's a valid expression
{
// If the expression evaluates then make it into a filter
if (FilterLanguage.TryCreateFilter(filterExpression, out Func<LogEvent, object> eval, out string error))
{
filter = evt => true.Equals(eval(evt));
}
else
{
//Assume the expression was a search string and make a Like filter from that
filter = PerformMessageLikeFilter(filterExpression);
}
}
_filter = filter;
}
public bool TakeLogEvent(LogEvent e)
{
return _filter(e);
}
private Func<LogEvent, bool> PerformMessageLikeFilter(string filterExpression)
{
var filterSearch = $"@Message like '%{FilterLanguage.EscapeLikeExpressionContent(filterExpression)}%'";
if (FilterLanguage.TryCreateFilter(filterSearch, out var eval, out var error))
{
return evt => true.Equals(eval(evt));
}
return null;
}
}
}
|
mit
|
C#
|
e963a9f40fb688c665062b703b86d5ae1b42ec11
|
rename to IPackageReadRepository
|
tugberkugurlu/zippy
|
src/Zippy.Server.Abstractions/IPackageRepository.cs
|
src/Zippy.Server.Abstractions/IPackageRepository.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace Zippy.Server.Abstractions
{
public class PaginatedResult<TItem>
{
public PaginatedResult(long skipped, byte taken, long totalCount, IReadOnlyList<TItem> items)
{
if(items == null)
{
throw new ArgumentNullException(nameof(items));
}
Skipped = skipped;
Taken = taken;
TotalCount = totalCount;
Items = items;
}
public long Skipped { get; }
public byte Taken { get; }
public long TotalCount { get; }
public IReadOnlyList<TItem> Items { get; }
}
public interface IPackageReadRepository
{
Task<IPackage> Get(PackageName name, SemanticVersion version);
Task<IPackage> Exists(PackageName name, SemanticVersion version);
Task<IPackage> Exists(PackageName name);
Task<PaginatedResult<IPackage>> Get(long skip, byte take);
Task<Stream> GetStream(PackageName name, SemanticVersion version);
}
public interface IPackageSearchManager
{
Task<PaginatedResult<IPackage>> Search(string lookupTerm, long skip, byte take);
}
public static class PackageExtensions
{
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace Zippy.Server.Abstractions
{
public class PaginatedResult<TItem>
{
public PaginatedResult(long skipped, byte taken, long totalCount, IReadOnlyList<TItem> items)
{
if(items == null)
{
throw new ArgumentNullException(nameof(items));
}
Skipped = skipped;
Taken = taken;
TotalCount = totalCount;
Items = items;
}
public long Skipped { get; }
public byte Taken { get; }
public long TotalCount { get; }
public IReadOnlyList<TItem> Items { get; }
}
public interface IPackageRepository
{
Task<IPackage> Get(PackageName name, SemanticVersion version);
Task<IPackage> Exists(PackageName name, SemanticVersion version);
Task<IPackage> Exists(PackageName name);
Task<PaginatedResult<IPackage>> Get(long skip, byte take);
Task<Stream> GetStream(PackageName name, SemanticVersion version);
}
public interface IPackageSearchManager
{
Task<PaginatedResult<IPackage>> Search(string lookupTerm, long skip, byte take);
}
public static class PackageExtensions
{
}
}
|
agpl-3.0
|
C#
|
312213501f43aee90121e092f9a6f798def7736c
|
update sample image url
|
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
|
iOS/SDWebImage/samples/SDWebImageSimpleSample/SDWebImageSimpleSample/ViewController.cs
|
iOS/SDWebImage/samples/SDWebImageSimpleSample/SDWebImageSimpleSample/ViewController.cs
|
using System;
using Foundation;
using UIKit;
using SDWebImage;
namespace SDWebImageSimpleSample
{
public partial class ViewController : UIViewController
{
protected ViewController(IntPtr handle)
: base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
btnDownload.TouchUpInside += delegate
{
// start the download
imageView.SetImage(
new NSUrl("https://blog.xamarin.com/wp-content/uploads/2013/11/MicrosoftXamarin2.png"),
null,
SDWebImageOptions.ProgressiveDownload,
ProgressHandler,
CompletedHandler);
};
}
private void ProgressHandler(nint receivedSize, nint expectedSize, NSUrl url)
{
if (expectedSize > 0)
{
// update the UI with progress
InvokeOnMainThread(() =>
{
float progress = (float)receivedSize / (float)expectedSize;
progressBar.SetProgress(progress, true);
lblPercent.Text = $"downloading: {(progress):0.0%}";
});
}
}
private void CompletedHandler(UIImage image, NSError error, SDImageCacheType cacheType, NSUrl url)
{
InvokeOnMainThread(() =>
{
// update the UI with complete
if (error != null)
lblPercent.Text = "there was a problem";
else
lblPercent.Text = "download completed";
});
}
}
}
|
using System;
using Foundation;
using UIKit;
using SDWebImage;
namespace SDWebImageSimpleSample
{
public partial class ViewController : UIViewController
{
protected ViewController(IntPtr handle)
: base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
btnDownload.TouchUpInside += delegate
{
// start the download
imageView.SetImage(
new NSUrl("http://goo.gl/1g7jP"),
null,
SDWebImageOptions.ProgressiveDownload,
ProgressHandler,
CompletedHandler);
};
}
private void ProgressHandler(nint receivedSize, nint expectedSize, NSUrl url)
{
if (expectedSize > 0)
{
// update the UI with progress
InvokeOnMainThread(() =>
{
float progress = (float)receivedSize / (float)expectedSize;
progressBar.SetProgress(progress, true);
lblPercent.Text = $"downloading: {(progress):0.0%}";
});
}
}
private void CompletedHandler(UIImage image, NSError error, SDImageCacheType cacheType, NSUrl url)
{
InvokeOnMainThread(() =>
{
// update the UI with complete
if (error != null)
lblPercent.Text = "there was a problem";
else
lblPercent.Text = "download completed";
});
}
}
}
|
mit
|
C#
|
37640d1c0820ba9cf1ab8cddbdaacf38d7aa6af4
|
Update Lists migrations for Autoroute
|
qt1/orchard4ibn,Anton-Am/Orchard,escofieldnaxos/Orchard,TalaveraTechnologySolutions/Orchard,LaserSrl/Orchard,salarvand/Portal,Praggie/Orchard,jchenga/Orchard,Anton-Am/Orchard,escofieldnaxos/Orchard,SouleDesigns/SouleDesigns.Orchard,emretiryaki/Orchard,dcinzona/Orchard-Harvest-Website,spraiin/Orchard,neTp9c/Orchard,armanforghani/Orchard,vard0/orchard.tan,harmony7/Orchard,fassetar/Orchard,aaronamm/Orchard,ehe888/Orchard,ericschultz/outercurve-orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,planetClaire/Orchard-LETS,qt1/Orchard,caoxk/orchard,li0803/Orchard,hhland/Orchard,TalaveraTechnologySolutions/Orchard,jtkech/Orchard,luchaoshuai/Orchard,bigfont/orchard-cms-modules-and-themes,Praggie/Orchard,phillipsj/Orchard,brownjordaninternational/OrchardCMS,SeyDutch/Airbrush,tobydodds/folklife,armanforghani/Orchard,hbulzy/Orchard,bigfont/orchard-cms-modules-and-themes,kgacova/Orchard,armanforghani/Orchard,IDeliverable/Orchard,smartnet-developers/Orchard,dcinzona/Orchard-Harvest-Website,yersans/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,tobydodds/folklife,jagraz/Orchard,hhland/Orchard,marcoaoteixeira/Orchard,yersans/Orchard,cooclsee/Orchard,sfmskywalker/Orchard,stormleoxia/Orchard,alejandroaldana/Orchard,jaraco/orchard,oxwanawxo/Orchard,sfmskywalker/Orchard,vard0/orchard.tan,emretiryaki/Orchard,andyshao/Orchard,cryogen/orchard,angelapper/Orchard,Fogolan/OrchardForWork,asabbott/chicagodevnet-website,smartnet-developers/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,vard0/orchard.tan,Serlead/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,andyshao/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,xiaobudian/Orchard,RoyalVeterinaryCollege/Orchard,angelapper/Orchard,omidnasri/Orchard,Lombiq/Orchard,AdvantageCS/Orchard,infofromca/Orchard,bedegaming-aleksej/Orchard,planetClaire/Orchard-LETS,MetSystem/Orchard,bigfont/orchard-continuous-integration-demo,AndreVolksdorf/Orchard,NIKASoftwareDevs/Orchard,hbulzy/Orchard,Serlead/Orchard,jerryshi2007/Orchard,harmony7/Orchard,asabbott/chicagodevnet-website,arminkarimi/Orchard,Morgma/valleyviewknolls,stormleoxia/Orchard,infofromca/Orchard,geertdoornbos/Orchard,qt1/orchard4ibn,mvarblow/Orchard,oxwanawxo/Orchard,rtpHarry/Orchard,jerryshi2007/Orchard,dcinzona/Orchard-Harvest-Website,Codinlab/Orchard,jaraco/orchard,bedegaming-aleksej/Orchard,Cphusion/Orchard,vairam-svs/Orchard,jtkech/Orchard,xiaobudian/Orchard,angelapper/Orchard,bedegaming-aleksej/Orchard,abhishekluv/Orchard,Sylapse/Orchard.HttpAuthSample,escofieldnaxos/Orchard,dcinzona/Orchard,neTp9c/Orchard,mgrowan/Orchard,AdvantageCS/Orchard,huoxudong125/Orchard,mgrowan/Orchard,li0803/Orchard,caoxk/orchard,Ermesx/Orchard,tobydodds/folklife,cooclsee/Orchard,geertdoornbos/Orchard,arminkarimi/Orchard,OrchardCMS/Orchard,neTp9c/Orchard,IDeliverable/Orchard,rtpHarry/Orchard,DonnotRain/Orchard,bigfont/orchard-cms-modules-and-themes,hbulzy/Orchard,marcoaoteixeira/Orchard,jchenga/Orchard,TaiAivaras/Orchard,TaiAivaras/Orchard,Anton-Am/Orchard,marcoaoteixeira/Orchard,dozoft/Orchard,omidnasri/Orchard,SzymonSel/Orchard,abhishekluv/Orchard,sebastienros/msc,dcinzona/Orchard-Harvest-Website,Dolphinsimon/Orchard,AdvantageCS/Orchard,Ermesx/Orchard,jersiovic/Orchard,enspiral-dev-academy/Orchard,austinsc/Orchard,fortunearterial/Orchard,grapto/Orchard.CloudBust,vairam-svs/Orchard,omidnasri/Orchard,alejandroaldana/Orchard,patricmutwiri/Orchard,andyshao/Orchard,emretiryaki/Orchard,stormleoxia/Orchard,li0803/Orchard,austinsc/Orchard,Sylapse/Orchard.HttpAuthSample,mgrowan/Orchard,openbizgit/Orchard,planetClaire/Orchard-LETS,harmony7/Orchard,arminkarimi/Orchard,rtpHarry/Orchard,jimasp/Orchard,SeyDutch/Airbrush,TalaveraTechnologySolutions/Orchard,geertdoornbos/Orchard,jagraz/Orchard,SouleDesigns/SouleDesigns.Orchard,johnnyqian/Orchard,jchenga/Orchard,Sylapse/Orchard.HttpAuthSample,dmitry-urenev/extended-orchard-cms-v10.1,MetSystem/Orchard,mgrowan/Orchard,Lombiq/Orchard,geertdoornbos/Orchard,hannan-azam/Orchard,yonglehou/Orchard,asabbott/chicagodevnet-website,omidnasri/Orchard,MetSystem/Orchard,bedegaming-aleksej/Orchard,AndreVolksdorf/Orchard,johnnyqian/Orchard,ericschultz/outercurve-orchard,gcsuk/Orchard,sebastienros/msc,huoxudong125/Orchard,fassetar/Orchard,planetClaire/Orchard-LETS,Fogolan/OrchardForWork,neTp9c/Orchard,jtkech/Orchard,jaraco/orchard,jersiovic/Orchard,enspiral-dev-academy/Orchard,dozoft/Orchard,grapto/Orchard.CloudBust,RoyalVeterinaryCollege/Orchard,fortunearterial/Orchard,arminkarimi/Orchard,alejandroaldana/Orchard,OrchardCMS/Orchard-Harvest-Website,dburriss/Orchard,spraiin/Orchard,TalaveraTechnologySolutions/Orchard,angelapper/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,hannan-azam/Orchard,Inner89/Orchard,dcinzona/Orchard-Harvest-Website,Serlead/Orchard,hbulzy/Orchard,mvarblow/Orchard,AndreVolksdorf/Orchard,alejandroaldana/Orchard,smartnet-developers/Orchard,dozoft/Orchard,bigfont/orchard-continuous-integration-demo,tobydodds/folklife,sfmskywalker/Orchard,Cphusion/Orchard,tobydodds/folklife,mvarblow/Orchard,abhishekluv/Orchard,grapto/Orchard.CloudBust,kouweizhong/Orchard,yonglehou/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,OrchardCMS/Orchard-Harvest-Website,dcinzona/Orchard-Harvest-Website,Ermesx/Orchard,emretiryaki/Orchard,jagraz/Orchard,spraiin/Orchard,IDeliverable/Orchard,DonnotRain/Orchard,omidnasri/Orchard,MpDzik/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,infofromca/Orchard,sfmskywalker/Orchard,salarvand/Portal,abhishekluv/Orchard,yersans/Orchard,Dolphinsimon/Orchard,fassetar/Orchard,Codinlab/Orchard,andyshao/Orchard,bigfont/orchard-continuous-integration-demo,luchaoshuai/Orchard,smartnet-developers/Orchard,salarvand/Portal,patricmutwiri/Orchard,OrchardCMS/Orchard-Harvest-Website,SzymonSel/Orchard,Codinlab/Orchard,Codinlab/Orchard,bigfont/orchard-continuous-integration-demo,Ermesx/Orchard,AdvantageCS/Orchard,KeithRaven/Orchard,openbizgit/Orchard,SzymonSel/Orchard,SouleDesigns/SouleDesigns.Orchard,kgacova/Orchard,brownjordaninternational/OrchardCMS,hhland/Orchard,abhishekluv/Orchard,Cphusion/Orchard,KeithRaven/Orchard,jersiovic/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,LaserSrl/Orchard,abhishekluv/Orchard,harmony7/Orchard,xiaobudian/Orchard,qt1/Orchard,RoyalVeterinaryCollege/Orchard,dcinzona/Orchard,phillipsj/Orchard,sfmskywalker/Orchard,Morgma/valleyviewknolls,xkproject/Orchard,enspiral-dev-academy/Orchard,xiaobudian/Orchard,AEdmunds/beautiful-springtime,NIKASoftwareDevs/Orchard,huoxudong125/Orchard,xkproject/Orchard,Dolphinsimon/Orchard,fortunearterial/Orchard,kouweizhong/Orchard,salarvand/Portal,kgacova/Orchard,harmony7/Orchard,infofromca/Orchard,Praggie/Orchard,RoyalVeterinaryCollege/Orchard,planetClaire/Orchard-LETS,li0803/Orchard,AdvantageCS/Orchard,OrchardCMS/Orchard,rtpHarry/Orchard,angelapper/Orchard,openbizgit/Orchard,ehe888/Orchard,Anton-Am/Orchard,jimasp/Orchard,jtkech/Orchard,cooclsee/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,m2cms/Orchard,NIKASoftwareDevs/Orchard,salarvand/orchard,oxwanawxo/Orchard,OrchardCMS/Orchard,Ermesx/Orchard,sebastienros/msc,RoyalVeterinaryCollege/Orchard,JRKelso/Orchard,vairam-svs/Orchard,cooclsee/Orchard,fortunearterial/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Sylapse/Orchard.HttpAuthSample,fassetar/Orchard,patricmutwiri/Orchard,aaronamm/Orchard,patricmutwiri/Orchard,caoxk/orchard,omidnasri/Orchard,SeyDutch/Airbrush,MpDzik/Orchard,ehe888/Orchard,Lombiq/Orchard,Anton-Am/Orchard,JRKelso/Orchard,Morgma/valleyviewknolls,rtpHarry/Orchard,brownjordaninternational/OrchardCMS,jersiovic/Orchard,jagraz/Orchard,AndreVolksdorf/Orchard,grapto/Orchard.CloudBust,salarvand/orchard,kouweizhong/Orchard,SzymonSel/Orchard,austinsc/Orchard,kouweizhong/Orchard,smartnet-developers/Orchard,escofieldnaxos/Orchard,phillipsj/Orchard,bedegaming-aleksej/Orchard,mvarblow/Orchard,Fogolan/OrchardForWork,phillipsj/Orchard,TalaveraTechnologySolutions/Orchard,patricmutwiri/Orchard,dburriss/Orchard,TaiAivaras/Orchard,hhland/Orchard,omidnasri/Orchard,MetSystem/Orchard,LaserSrl/Orchard,m2cms/Orchard,cooclsee/Orchard,DonnotRain/Orchard,dozoft/Orchard,stormleoxia/Orchard,gcsuk/Orchard,TalaveraTechnologySolutions/Orchard,ericschultz/outercurve-orchard,JRKelso/Orchard,MpDzik/Orchard,brownjordaninternational/OrchardCMS,TaiAivaras/Orchard,openbizgit/Orchard,gcsuk/Orchard,Dolphinsimon/Orchard,huoxudong125/Orchard,Lombiq/Orchard,salarvand/Portal,kgacova/Orchard,oxwanawxo/Orchard,m2cms/Orchard,dcinzona/Orchard,jersiovic/Orchard,Lombiq/Orchard,Cphusion/Orchard,yonglehou/Orchard,qt1/orchard4ibn,Fogolan/OrchardForWork,huoxudong125/Orchard,yonglehou/Orchard,jerryshi2007/Orchard,salarvand/orchard,TaiAivaras/Orchard,SouleDesigns/SouleDesigns.Orchard,salarvand/orchard,yersans/Orchard,caoxk/orchard,qt1/orchard4ibn,yonglehou/Orchard,spraiin/Orchard,cryogen/orchard,xkproject/Orchard,jchenga/Orchard,KeithRaven/Orchard,SeyDutch/Airbrush,austinsc/Orchard,sfmskywalker/Orchard,phillipsj/Orchard,armanforghani/Orchard,johnnyqian/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,dozoft/Orchard,johnnyqian/Orchard,gcsuk/Orchard,jaraco/orchard,AEdmunds/beautiful-springtime,AndreVolksdorf/Orchard,ehe888/Orchard,grapto/Orchard.CloudBust,jimasp/Orchard,jtkech/Orchard,DonnotRain/Orchard,SzymonSel/Orchard,ericschultz/outercurve-orchard,bigfont/orchard-cms-modules-and-themes,aaronamm/Orchard,MpDzik/Orchard,Inner89/Orchard,spraiin/Orchard,grapto/Orchard.CloudBust,Serlead/Orchard,Codinlab/Orchard,dburriss/Orchard,enspiral-dev-academy/Orchard,Fogolan/OrchardForWork,yersans/Orchard,luchaoshuai/Orchard,DonnotRain/Orchard,dcinzona/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,mgrowan/Orchard,hbulzy/Orchard,xkproject/Orchard,OrchardCMS/Orchard,marcoaoteixeira/Orchard,vard0/orchard.tan,LaserSrl/Orchard,MetSystem/Orchard,Praggie/Orchard,TalaveraTechnologySolutions/Orchard,LaserSrl/Orchard,kouweizhong/Orchard,m2cms/Orchard,Cphusion/Orchard,SouleDesigns/SouleDesigns.Orchard,Praggie/Orchard,infofromca/Orchard,vairam-svs/Orchard,hannan-azam/Orchard,Serlead/Orchard,sfmskywalker/Orchard,salarvand/orchard,TalaveraTechnologySolutions/Orchard,arminkarimi/Orchard,OrchardCMS/Orchard-Harvest-Website,KeithRaven/Orchard,stormleoxia/Orchard,sebastienros/msc,johnnyqian/Orchard,enspiral-dev-academy/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,sebastienros/msc,KeithRaven/Orchard,jimasp/Orchard,jerryshi2007/Orchard,m2cms/Orchard,jagraz/Orchard,aaronamm/Orchard,SeyDutch/Airbrush,Inner89/Orchard,OrchardCMS/Orchard-Harvest-Website,AEdmunds/beautiful-springtime,jerryshi2007/Orchard,NIKASoftwareDevs/Orchard,MpDzik/Orchard,hhland/Orchard,oxwanawxo/Orchard,Morgma/valleyviewknolls,omidnasri/Orchard,luchaoshuai/Orchard,cryogen/orchard,neTp9c/Orchard,emretiryaki/Orchard,gcsuk/Orchard,vard0/orchard.tan,geertdoornbos/Orchard,cryogen/orchard,qt1/Orchard,MpDzik/Orchard,austinsc/Orchard,xkproject/Orchard,armanforghani/Orchard,IDeliverable/Orchard,sfmskywalker/Orchard,Sylapse/Orchard.HttpAuthSample,ehe888/Orchard,Morgma/valleyviewknolls,omidnasri/Orchard,li0803/Orchard,qt1/orchard4ibn,qt1/Orchard,fortunearterial/Orchard,JRKelso/Orchard,marcoaoteixeira/Orchard,andyshao/Orchard,dburriss/Orchard,escofieldnaxos/Orchard,dburriss/Orchard,vairam-svs/Orchard,qt1/Orchard,qt1/orchard4ibn,openbizgit/Orchard,AEdmunds/beautiful-springtime,bigfont/orchard-cms-modules-and-themes,xiaobudian/Orchard,OrchardCMS/Orchard-Harvest-Website,hannan-azam/Orchard,Dolphinsimon/Orchard,Inner89/Orchard,luchaoshuai/Orchard,NIKASoftwareDevs/Orchard,mvarblow/Orchard,brownjordaninternational/OrchardCMS,kgacova/Orchard,JRKelso/Orchard,tobydodds/folklife,Inner89/Orchard,IDeliverable/Orchard,fassetar/Orchard,aaronamm/Orchard,jimasp/Orchard,jchenga/Orchard,vard0/orchard.tan,hannan-azam/Orchard,alejandroaldana/Orchard,asabbott/chicagodevnet-website,OrchardCMS/Orchard,dcinzona/Orchard
|
src/Orchard.Web/Modules/Orchard.Lists/Migrations.cs
|
src/Orchard.Web/Modules/Orchard.Lists/Migrations.cs
|
using Orchard.ContentManagement.MetaData;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
namespace Orchard.Lists {
public class Migrations : DataMigrationImpl {
public int Create() {
ContentDefinitionManager.AlterTypeDefinition("List",
cfg=>cfg
.WithPart("CommonPart")
.WithPart("TitlePart")
.WithPart("AutoroutePart")
.WithPart("ContainerPart")
.WithPart("MenuPart")
.WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "2"))
.Creatable());
return 4;
}
public int UpdateFrom1() {
ContentDefinitionManager.AlterTypeDefinition("List", cfg => cfg.WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "2")));
return 3;
}
public int UpdateFrom2() {
ContentDefinitionManager.AlterTypeDefinition("List", cfg => cfg.WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "2")));
return 3;
}
public int UpdateFrom3() {
// TODO: (PH:Autoroute) Copy paths, routes, etc.
ContentDefinitionManager.AlterTypeDefinition("List",
cfg => cfg
.RemovePart("RoutePart")
.WithPart("TitlePart")
.WithPart("AutoroutePart"));
return 4;
}
}
}
|
using Orchard.ContentManagement.MetaData;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
namespace Orchard.Lists {
public class Migrations : DataMigrationImpl {
public int Create() {
ContentDefinitionManager.AlterTypeDefinition("List",
cfg=>cfg
.WithPart("CommonPart")
.WithPart("RoutePart")
.WithPart("ContainerPart")
.WithPart("MenuPart")
.WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "2"))
.Creatable());
return 3;
}
public int UpdateFrom1() {
ContentDefinitionManager.AlterTypeDefinition("List", cfg => cfg.WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "2")));
return 3;
}
public int UpdateFrom2() {
ContentDefinitionManager.AlterTypeDefinition("List", cfg => cfg.WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "2")));
return 3;
}
}
}
|
bsd-3-clause
|
C#
|
e9bb1702b01a4ece2d19fbf8edd0b21c9ae89eca
|
reduce sleep from 100 to 30
|
sdcb/sdmap
|
sdmap/test/sdmap.ext.test/SmokeTest.cs
|
sdmap/test/sdmap.ext.test/SmokeTest.cs
|
using sdmap.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
namespace sdmap.ext.test
{
public class SmokeTest
{
[Fact]
public void WatchSmoke()
{
Directory.CreateDirectory("sqls");
var tempFile = @"sqls\test.sdmap";
File.WriteAllText(tempFile, "sql Hello{Hello}");
SdmapExtensions.SetSqlDirectoryAndWatch(@".\sqls");
try
{
File.WriteAllText(tempFile, "sql Hello{Hello2}");
Thread.Sleep(30);
var text = SdmapExtensions.EmitSql("Hello", null);
Assert.Equal("Hello2", text);
}
finally
{
File.Delete(tempFile);
Directory.Delete("sqls");
}
}
}
}
|
using sdmap.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
namespace sdmap.ext.test
{
public class SmokeTest
{
[Fact]
public void WatchSmoke()
{
Directory.CreateDirectory("sqls");
var tempFile = @"sqls\test.sdmap";
File.WriteAllText(tempFile, "sql Hello{Hello}");
SdmapExtensions.SetSqlDirectoryAndWatch(@".\sqls");
try
{
File.WriteAllText(tempFile, "sql Hello{Hello2}");
Thread.Sleep(100);
var text = SdmapExtensions.EmitSql("Hello", null);
Assert.Equal("Hello2", text);
}
finally
{
File.Delete(tempFile);
Directory.Delete("sqls");
}
}
}
}
|
mit
|
C#
|
4808d5935dd45e66b9a74d1fd5d16c9982e1e7ee
|
set "Errored" flag for CustomTIming
|
romansp/MiniProfiler.Elasticsearch
|
src/MiniProfiler.Elasticsearch/MiniProfilerElasticsearch.cs
|
src/MiniProfiler.Elasticsearch/MiniProfilerElasticsearch.cs
|
namespace StackExchange.Profiling.Elasticsearch;
using System;
using System.Linq;
using global::Elasticsearch.Net;
using Profiling;
/// <summary>
/// <see cref="IApiCallDetails"/> handler class.
/// </summary>
internal static class MiniProfilerElasticsearch {
/// <summary>
/// Handles <see cref="IApiCallDetails"/> and pushes <see cref="CustomTiming"/> to current <see cref="MiniProfiler"/> session.
/// </summary>
/// <param name="apiCallDetails"><see cref="IApiCallDetails"/> to be handled.</param>
internal static void HandleResponse(IApiCallDetails? apiCallDetails) {
_ = apiCallDetails ?? throw new ArgumentNullException(nameof(apiCallDetails));
var profiler = MiniProfiler.Current;
if (profiler is null || profiler.Head is null || apiCallDetails.DebugInformation is null) {
return;
}
profiler.Head.AddCustomTiming("elasticsearch", new CustomTiming(profiler, apiCallDetails.DebugInformation) {
DurationMilliseconds = (decimal?)apiCallDetails.AuditTrail?.Sum(c => (c.Ended - c.Started).TotalMilliseconds),
ExecuteType = apiCallDetails.HttpMethod.ToString(),
Errored = !apiCallDetails.Success
});
}
}
|
namespace StackExchange.Profiling.Elasticsearch;
using System;
using System.Linq;
using global::Elasticsearch.Net;
using Profiling;
/// <summary>
/// <see cref="IApiCallDetails"/> handler class.
/// </summary>
internal static class MiniProfilerElasticsearch {
/// <summary>
/// Handles <see cref="IApiCallDetails"/> and pushes <see cref="CustomTiming"/> to current <see cref="MiniProfiler"/> session.
/// </summary>
/// <param name="apiCallDetails"><see cref="IApiCallDetails"/> to be handled.</param>
internal static void HandleResponse(IApiCallDetails? apiCallDetails) {
if (apiCallDetails is null) {
throw new ArgumentNullException(nameof(apiCallDetails));
}
var profiler = MiniProfiler.Current;
if (profiler == null || profiler.Head == null || apiCallDetails.DebugInformation == null) {
return;
}
profiler.Head.AddCustomTiming("elasticsearch", new CustomTiming(profiler, apiCallDetails.DebugInformation) {
DurationMilliseconds = (decimal?)apiCallDetails.AuditTrail?.Sum(c => (c.Ended - c.Started).TotalMilliseconds),
ExecuteType = apiCallDetails.HttpMethod.GetStringValue(),
});
}
}
|
mit
|
C#
|
6842357661b40c7f79f27358acf48af318b4878d
|
set scrollbar width function
|
brookshi/123,brookshi/DuDuRiBao
|
DuDuRiBao/Utils/ResUtil.cs
|
DuDuRiBao/Utils/ResUtil.cs
|
#region License
// Copyright 2015 Brook Shi
//
// 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 DuDuRiBao.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Media;
namespace Brook.DuDuRiBao.Utils
{
public class ResUtil
{
public static Brush GetAppThemeBrush(string key)
{
return Application.Current.Resources[key] as Brush;
}
const double _scrollBarWidth = 8;
public static void SetScrollBarWidth(DependencyObject target)
{
SetScrollBarWidth(target, _scrollBarWidth);
}
public static void SetScrollBarWidth(DependencyObject target, double width)
{
var thumb = VisualHelper.FindVisualChild<ScrollBar>(target, "VerticalScrollBar");
if (thumb != null)
{
thumb.MaxWidth = thumb.MinWidth = width;
}
}
}
}
|
#region License
// Copyright 2015 Brook Shi
//
// 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 System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
namespace Brook.DuDuRiBao.Utils
{
public class ResUtil
{
public static Brush GetAppThemeBrush(string key)
{
return Application.Current.Resources[key] as Brush;
}
}
}
|
agpl-3.0
|
C#
|
4af422fb2ff5a796f8568f2b35004a60edd0bfce
|
Fix build.
|
MaartenX/ConnectQl
|
src/ConnectQl.Sample.Net461/Program.cs
|
src/ConnectQl.Sample.Net461/Program.cs
|
// MIT License
//
// Copyright (c) 2017 Maarten van Sambeek.
//
// 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.
namespace ConnectQl.Sample.Net461
{
using System.IO;
using System.Threading.Tasks;
using ConnectQl.Intellisense;
using ConnectQl.Platform;
/// <summary>
/// Sample program that executes a query using .NET Core.
/// </summary>
public class Program
{
/// <summary>
/// The asynchronous entry point.
/// </summary>
/// <param name="args">The command line arguments.</param>
/// <returns>
/// The task.
/// </returns>
public static async Task MainAsync(string[] args)
{
using (var context = new ConnectQlContext(new PluginResolver()))
{
using (var c = context.CreateIntellisenseSession())
{
c.DocumentUpdated += (o, e) => { };
//c.UpdateDocument("Script3.cql", File.ReadAllText("Script3.cql"), 1);
await Task.Delay(1000000);
}
}
/*
var result = await context.ExecuteFileAsync("Example.cql");
}*/
}
/// <summary>
/// The entry point.
/// </summary>
/// <param name="args">The command line arguments.</param>
public static void Main(string[] args) => MainAsync(args).GetAwaiter().GetResult();
}
}
|
// MIT License
//
// Copyright (c) 2017 Maarten van Sambeek.
//
// 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.
namespace ConnectQl.Sample.Net461
{
using System.IO;
using System.Threading.Tasks;
using ConnectQl.Intellisense;
using ConnectQl.Platform;
/// <summary>
/// Sample program that executes a query using .NET Core.
/// </summary>
public class Program
{
/// <summary>
/// The asynchronous entry point.
/// </summary>
/// <param name="args">The command line arguments.</param>
/// <returns>
/// The task.
/// </returns>
public static async Task MainAsync(string[] args)
{
using (var context = new ConnectQlContext(new PluginResolver()))
{
using (var c = context.CreateIntellisenseSession())
{
c.DocumentUpdated += (o, e) => { };
c.UpdateDocument("Script3.cql", File.ReadAllText("Script3.cql"), 1);
await Task.Delay(1000000);
}
}
/*
var result = await context.ExecuteFileAsync("Example.cql");
}*/
}
/// <summary>
/// The entry point.
/// </summary>
/// <param name="args">The command line arguments.</param>
public static void Main(string[] args) => MainAsync(args).GetAwaiter().GetResult();
}
}
|
mit
|
C#
|
48cf40b195efe0aaa453a158313538a338a9f6ba
|
Add missing resource base class
|
viagogo/gogokit.net
|
src/GogoKit/Models/Response/Carrier.cs
|
src/GogoKit/Models/Response/Carrier.cs
|
using HalKit.Json;
using HalKit.Models.Response;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace GogoKit.Models.Response
{
/// <summary>
/// A carrier (e.g. UPS) that will collect tickets that are to be delivered.
/// </summary>
/// <remarks>See http://developer.viagogo.net/#carrier</remarks>
[DataContract(Name = "carrier")]
public class Carrier : Resource
{
/// <summary>
/// The carrier identifier.
/// </summary>
[DataMember(Name = "id")]
public int? Id { get; set; }
/// <summary>
/// The name of the carrier.
/// </summary>
[DataMember(Name = "name")]
public string Name { get; set; }
/// <summary>
/// The windows available for ticket collection.
/// </summary>
[DataMember(Name = "pickup_windows")]
public IList<PickupWindow> PickupWindows { get; set; }
/// <summary>
/// Creates a new pickup for the ticket(s).
/// </summary>
/// <remarks>See http://developer.viagogo.net/#carriercreatepickup</remarks>
[Rel("carrier:createpickup")]
public Link CreatePickupLink { get; set; }
}
}
|
using HalKit.Json;
using HalKit.Models.Response;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace GogoKit.Models.Response
{
/// <summary>
/// A carrier (e.g. UPS) that will collect tickets that are to be delivered.
/// </summary>
/// <remarks>See http://developer.viagogo.net/#carrier</remarks>
[DataContract(Name = "carrier")]
public class Carrier
{
/// <summary>
/// The carrier identifier.
/// </summary>
[DataMember(Name = "id")]
public int? Id { get; set; }
/// <summary>
/// The name of the carrier.
/// </summary>
[DataMember(Name = "name")]
public string Name { get; set; }
/// <summary>
/// The windows available for ticket collection.
/// </summary>
[DataMember(Name = "pickup_windows")]
public IList<PickupWindow> PickupWindows { get; set; }
/// <summary>
/// Creates a new pickup for the ticket(s).
/// </summary>
/// <remarks>See http://developer.viagogo.net/#carriercreatepickup</remarks>
[Rel("carrier:createpickup")]
public Link CreatePickupLink { get; set; }
}
}
|
mit
|
C#
|
fe5b5b4baba834b64f20ae627c1d659df1c514bc
|
Fix bug in DecodeCommands - spatial scaling was always forced
|
imazen/imageflow-dotnet
|
src/Imageflow/Fluent/DecodeCommands.cs
|
src/Imageflow/Fluent/DecodeCommands.cs
|
using System;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
namespace Imageflow.Fluent
{
public enum DecderDownscalingMode
{
/// <summary>
/// Use the Imageflow default (usually highest quality)
/// </summary>
Unspecified = 0,
/// <summary>
/// Use the fastest method
/// </summary>
Fastest = 1,
/// <summary>
/// A slower (but more accurate) scaling method is employed; the DCT blocks are fully decoded, then a true resampling kernel is applied.
/// </summary>
SpatialLumaScaling = 2,
/// <summary>
/// Like SpatialLumaScaling, but gamma correction is applied before the resampling kernel, then removed afterwards.
/// Has the effect of linear-light scaling
/// </summary>
GammaCorrectSpatialLumaScaling = 6,
Best = 6,
}
public class DecodeCommands
{
public Size? DownscaleHint { get; set; } = Size.Empty;
public DecderDownscalingMode DownscalingMode { get; set; } = DecderDownscalingMode.Unspecified;
public bool DiscardColorProfile { get; set; }
public object[] ToImageflowDynamic()
{
object downscale = DownscaleHint.HasValue ? new {
jpeg_downscale_hints = new {
width = DownscaleHint.Value.Width,
height = DownscaleHint.Value.Height,
scale_luma_spatially = DownscalingMode == DecderDownscalingMode.SpatialLumaScaling || DownscalingMode == DecderDownscalingMode.GammaCorrectSpatialLumaScaling,
gamma_correct_for_srgb_during_spatial_luma_scaling = DownscalingMode == DecderDownscalingMode.GammaCorrectSpatialLumaScaling
}
}: null;
object ignore = DiscardColorProfile ? new {discard_color_profile = (string) null} : null;
return new object[] {downscale, ignore}.Where(obj => obj != null).ToArray();
}
}
}
|
using System;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
namespace Imageflow.Fluent
{
[Flags]
public enum DecderDownscalingMode
{
/// <summary>
/// Use the Imageflow default (usually highest quality)
/// </summary>
Unspecified = 0,
/// <summary>
/// Use the fastest method
/// </summary>
Fastest = 1,
/// <summary>
/// A slower (but more accurate) scaling method is employed; the DCT blocks are fully decoded, then a true resampling kernel is applied.
/// </summary>
SpatialLumaScaling = 2,
/// <summary>
/// Like SpatialLumaScaling, but gamma correction is applied before the resampling kernel, then removed afterwards.
/// Has the effect of linear-light scaling
/// </summary>
GammaCorrectSpatialLumaScaling = 6,
Best = 6,
}
public class DecodeCommands
{
public Size? DownscaleHint { get; set; } = Size.Empty;
public DecderDownscalingMode DownscalingMode { get; set; } = DecderDownscalingMode.Unspecified;
public bool DiscardColorProfile { get; set; } = false;
public object[] ToImageflowDynamic()
{
object downscale = DownscaleHint.HasValue ? new {
jpeg_downscale_hints = new {
width = DownscaleHint.Value.Width,
height = DownscaleHint.Value.Height,
scale_luma_spatially = (DownscalingMode | DecderDownscalingMode.SpatialLumaScaling) > 0,
gamma_correct_for_srgb_during_spatial_luma_scaling = DownscalingMode == DecderDownscalingMode.GammaCorrectSpatialLumaScaling
}
}: null;
object ignore = DiscardColorProfile ? new {discard_color_profile = (string) null} : null;
return new object[] {downscale, ignore}.Where(obj => obj != null).ToArray();
}
}
}
|
agpl-3.0
|
C#
|
08f263e3f45da7910623d1e052f21cebf8ffe8d9
|
Add new unit tests
|
viniciuschiele/Scrypt
|
src/Scrypt.Tests/ScryptEncoderTests.cs
|
src/Scrypt.Tests/ScryptEncoderTests.cs
|
using Scrypt;
using System;
using Xunit;
namespace Scrypt.Tests
{
public class ScryptEncoderTests
{
[Fact]
public void TestEncode()
{
int iterationCount = 2;
for (int i = 0; i < 15; i++)
{
var encoder = new ScryptEncoder(iterationCount, 8, 1);
var hashedPassword = encoder.Encode("MyPassword");
Assert.True(encoder.Compare("MyPassword", hashedPassword));
iterationCount *= 2;
}
}
[Fact]
public void TestCompare()
{
var encoder = new ScryptEncoder();
var hashedPassword = encoder.Encode("MyPassword");
Assert.True(encoder.Compare("MyPassword", hashedPassword));
Assert.False(encoder.Compare("WrongPassword", hashedPassword));
}
[Fact]
public void TestIsValid()
{
var encoder = new ScryptEncoder();
Assert.False(encoder.IsValid("$e1$adasdasd$asdasdsd"));
Assert.True(encoder.IsValid(encoder.Encode("MyPassword")));
}
[Fact]
public void TestIterationCountNonPowerOfTwo()
{
var encoder = new ScryptEncoder(1000, 8, 1);
Assert.Throws<ArgumentException>(() => encoder.Encode("MyPassword"));
}
[Fact]
public void TestBackwardCompatibility()
{
var encoder = new ScryptEncoder();
var hashedPassword = "$s0$40000801$eM1F+ITBb6SVFQ5QxD2jWXY8s4RGsIU+Yh4JosOewoY=$1h22/MY2cpm9Vz7//NRiXwCjffVXQWOKJ7n27vNVfP4=";
Assert.True(encoder.Compare("MyPassword", hashedPassword));
hashedPassword = "$s1$40000801$5ScyYcGbFmSF5P+A64cThg+c6rFtsfyxDHkWWCt97xI=$U+7EMhBXHjNHudmn/sgvX4VZ6ddoSKLkL0nDOSKYLaQ=";
Assert.True(encoder.Compare("MyPassword", hashedPassword));
}
}
}
|
using Scrypt;
using Xunit;
namespace Scrypt.Tests
{
public class ScryptEncoderTests
{
[Fact]
public void TestEncode()
{
var encoder = new ScryptEncoder();
var hashedPassword = encoder.Encode("MyPassword");
Assert.True(encoder.Compare("MyPassword", hashedPassword));
Assert.False(encoder.Compare("WrongPassword", hashedPassword));
}
}
}
|
apache-2.0
|
C#
|
1ffb74df7f14f6b4d7614f6a9b5199d9bf6717f8
|
Update AssemblyInfo.cs
|
AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell
|
src/StackAdmin/Storage.Management/Commands.Management.Storage/Properties/AssemblyInfo.cs
|
src/StackAdmin/Storage.Management/Commands.Management.Storage/Properties/AssemblyInfo.cs
|
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using 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("Commands.Management.Storage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Commands.Management.Storage")]
[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)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("15fc0119-dd3b-4167-b458-7202c89d397d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.1.0.1")]
[assembly: AssemblyFileVersion("1.1.0.1")]
|
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using 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("Commands.Management.Storage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Commands.Management.Storage")]
[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)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("15fc0119-dd3b-4167-b458-7202c89d397d")]
// 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("3.3.3")]
[assembly: AssemblyFileVersion("3.3.3")]
|
apache-2.0
|
C#
|
83b03d9a89baf41cceaf1b9368ff954f6a3a7e23
|
remove stateful from OnlineShopDbContext
|
StoikoNeykov/OnlineShop,StoikoNeykov/OnlineShop
|
OnlineShop/Libs/OnlineShop.Libs.Data/OnlineShopDbContext.cs
|
OnlineShop/Libs/OnlineShop.Libs.Data/OnlineShopDbContext.cs
|
using OnlineShop.Libs.Data.Contracts;
using System.Data.Entity;
using System;
using OnlineShop.Libs.Data.Factories;
using OnlineShop.Libs.Models;
namespace OnlineShop.Libs.Data
{
public class OnlineShopDbContext : DbContext, IOnlineShopDbContext
{
// needed for add-migration
private static string localConnectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=OnlineShop;Integrated Security=True;MultipleActiveResultSets=False";
public OnlineShopDbContext()
: base(localConnectionString)
{
}
public OnlineShopDbContext(string connectionString)
: base(connectionString)
{
}
public virtual IDbSet<Category> Categories { get; set; }
public virtual IDbSet<Product> Products { get; set; }
public virtual IDbSet<PhotoItem> PhotoItems { get; set; }
IDbSet<TEntity> IOnlineShopDbContext.Set<TEntity>()
{
return base.Set<TEntity>();
}
}
}
|
using OnlineShop.Libs.Data.Contracts;
using System.Data.Entity;
using System;
using OnlineShop.Libs.Data.Factories;
using OnlineShop.Libs.Models;
namespace OnlineShop.Libs.Data
{
public class OnlineShopDbContext : DbContext, IOnlineShopDbContext
{
private readonly IStatefulFactory statefulFactory;
// // needed for add-migration
private static string localConnectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=OnlineShop;Integrated Security=True;MultipleActiveResultSets=False";
public OnlineShopDbContext()
: base(localConnectionString)
{
}
public OnlineShopDbContext(string connectionString, IStatefulFactory statefulFactory)
: base(connectionString)
{
if (statefulFactory == null)
{
throw new ArgumentNullException("StatefulFactory");
}
this.statefulFactory = statefulFactory;
}
public virtual IDbSet<Category> Categories { get; set; }
public virtual IDbSet<Product> Products { get; set; }
public virtual IDbSet<PhotoItem> PhotoItems { get; set; }
IDbSet<TEntity> IOnlineShopDbContext.Set<TEntity>()
{
return base.Set<TEntity>();
}
public IStateful<TEntity> GetStateful<TEntity>(TEntity entity) where TEntity : class
{
return this.statefulFactory.GetStateful(this.Entry(entity));
}
}
}
|
mit
|
C#
|
0740a0d211a05ead186d8bbb4fc897d4edc7eb46
|
Update Test CollectionPageInstance to use JsonObject
|
ginach/msgraph-sdk-dotnet
|
tests/Microsoft.Graph.Core.Test/TestModels/CollectionPageInstance.cs
|
tests/Microsoft.Graph.Core.Test/TestModels/CollectionPageInstance.cs
|
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
namespace Microsoft.Graph.Core.Test.TestModels
{
using Newtonsoft.Json;
using System.Runtime.Serialization;
/// <summary>
/// Test class for testing serialization of an IEnumerable of Date.
/// </summary>
[JsonObject]
public class CollectionPageInstance : CollectionPage<DerivedTypeClass>, ICollectionPageInstance
{
}
}
|
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
namespace Microsoft.Graph.Core.Test.TestModels
{
using System.Runtime.Serialization;
/// <summary>
/// Test class for testing serialization of an IEnumerable of Date.
/// </summary>
[DataContract]
public class CollectionPageInstance : CollectionPage<DerivedTypeClass>, ICollectionPageInstance
{
}
}
|
mit
|
C#
|
ae919ac9b64aef481ab434c03ac95d6063e0fcd2
|
Fix example client
|
inter8ection/Obvs
|
Examples/Client/Program.cs
|
Examples/Client/Program.cs
|
using System;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using Obvs.Types;
using Obvs.ActiveMQ.Configuration;
using Obvs.Configuration;
using Obvs.Example.Messages;
using Obvs.Serialization.Json.Configuration;
namespace Obvs.Example.Client
{
internal static class Program
{
private static void Main(string[] args)
{
var brokerUri = Environment.GetEnvironmentVariable("ACTIVEMQ_BROKER_URI") ?? "tcp://localhost:61616";
var serviceName = Environment.GetEnvironmentVariable("OBVS_SERVICE_NAME") ?? "Obvs.Service1";
Console.WriteLine($"Starting {serviceName}, connecting to broker {brokerUri}");
var serviceBus = ServiceBus.Configure()
.WithActiveMQEndpoints<IServiceMessage1>()
.Named(serviceName)
.UsingQueueFor<ICommand>()
.ConnectToBroker(brokerUri)
.WithCredentials("admin", "admin")
.SerializedAsJson()
.AsClient()
.CreateClient();
serviceBus.Events.Subscribe(ev => Console.WriteLine("Received event: " + ev));
Console.WriteLine("Type some text and hit <Enter> to send as command.");
while (true)
{
string data = Console.ReadLine();
serviceBus.SendAsync(new Command1 { Data = data });
}
}
}
}
|
using System;
using Obvs.Types;
using Obvs.ActiveMQ.Configuration;
using Obvs.Configuration;
using Obvs.Example.Messages;
using Obvs.Serialization.Json.Configuration;
namespace Obvs.Example.Client
{
internal static class Program
{
private static void Main(string[] args)
{
var brokerUri = Environment.GetEnvironmentVariable("ACTIVEMQ_BROKER_URI") ?? "tcp://localhost:61616";
var serviceName = Environment.GetEnvironmentVariable("OBVS_SERVICE_NAME") ?? "Service1";
Console.WriteLine($"Starting {serviceName}, connecting to broker {brokerUri}");
var serviceBus = ServiceBus.Configure()
.WithActiveMQEndpoints<IServiceMessage1>()
.Named(serviceName)
.UsingQueueFor<ICommand>()
.ConnectToBroker(brokerUri)
.WithCredentials("TESTUSER", "testpassword1")
.SerializedAsJson()
.AsClient()
.CreateClient();
serviceBus.Events.Subscribe(c => Console.WriteLine("Received an event!"));
Console.WriteLine("Hit <Enter> to send a command.");
while (true)
{
string data = Console.ReadLine();
serviceBus.SendAsync(new Command1 { Data = data });
}
}
}
}
|
mit
|
C#
|
20f5b31f339d6e6991cead705d3cd20266e44ef1
|
Update IAzureTableStorageRepositoryInitializer.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/AzureStorage/IAzureTableStorageRepositoryInitializer.cs
|
TIKSN.Core/Data/AzureStorage/IAzureTableStorageRepositoryInitializer.cs
|
using Microsoft.Azure.Cosmos.Table;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.AzureStorage
{
public interface IAzureTableStorageRepositoryInitializer<T> where T : ITableEntity
{
Task InitializeAsync(CancellationToken cancellationToken);
}
}
|
using Microsoft.WindowsAzure.Storage.Table;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.AzureStorage
{
public interface IAzureTableStorageRepositoryInitializer<T> where T : ITableEntity
{
Task InitializeAsync(CancellationToken cancellationToken);
}
}
|
mit
|
C#
|
fc45f6c4be0d1dde3f27d3dbfcfbd7821645ff17
|
add legacy links to homepage for testing purposes
|
robpaveza/Hawk,robpaveza/Hawk,devhawk/Hawk,devhawk/Hawk
|
Views/Home/Index.cshtml
|
Views/Home/Index.cshtml
|
@using Microsoft.AspNet.Mvc.Rendering
@using System.Text;
@functions
{
HtmlString TestLink(string url)
{
var tw = new StringCollectionTextWriter(Encoding.UTF8);
tw.WriteLine($"<li><a href=\"{url}\">{url}</a></li>");
return new HtmlString(tw);
}
}
<h1>Temporary home page stand in</h1>
<ul>
@TestLink("default.aspx")
@TestLink("archives.aspx")
@TestLink("rss.aspx")
@TestLink("atom.aspx")
@TestLink("monthview.aspx?year=2009")
@TestLink("default,month,2011-02.aspx")
@TestLink("monthview.aspx?month=2011-03")
@TestLink("default,date,2003-01-14.aspx")
@TestLink("default.aspx?date=2004-07-27")
@TestLink("CategoryView,category,sports.aspx ")
@TestLink("CategoryView.aspx?category=sports")
@TestLink("2005/10/5/code+is+model.aspx")
@TestLink("code+is+model.aspx")
@TestLink("CommentView,guid,f5bd9a40-08ae-4411-9a2a-f7bec0a0c348.aspx")
@TestLink("CommentView.aspx?guid=283ef85e-e61c-46f0-b0a2-87ec14c8bc06")
@TestLink("PermaLink.aspx?guid=010e1394-9b1f-4baf-b87c-b9ac7c0cff06")
@TestLink("PermaLink,guid,010e1394-9b1f-4baf-b87c-b9ac7c0cff06.aspx")
</ul>
|
<h1>Temporary home page stand in</h1>
|
mit
|
C#
|
696879df884c9b37c85cd83f25f125e053ce06dc
|
add trace level logging for tile sync on join
|
Necromunger/unitystation,Necromunger/unitystation,Necromunger/unitystation,krille90/unitystation,krille90/unitystation,krille90/unitystation,Necromunger/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation
|
UnityProject/Assets/Scripts/Messages/Server/TileChangesNewClientSync.cs
|
UnityProject/Assets/Scripts/Messages/Server/TileChangesNewClientSync.cs
|
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Mirror;
//long name I know. This is for syncing new clients when they join to all of the tile changes
public class TileChangesNewClientSync : ServerMessage
{
//just a best guess, try increasing it until the message exceeds mirror's limit
private static readonly int MAX_CHANGES_PER_MESSAGE = 20;
public static short MessageType = (short)MessageTypes.TileChangesNewClientSync;
public string data;
public uint ManagerSubject;
public override IEnumerator Process()
{
yield return WaitFor(ManagerSubject);
TileChangeManager tm = NetworkObject.GetComponent<TileChangeManager>();
tm.InitServerSync(data);
}
public static void Send(GameObject managerSubject, GameObject recipient, TileChangeList changeList)
{
if (changeList == null || changeList.List.Count == 0) return;
foreach (var changeChunk in changeList.List.ToArray().Chunk(MAX_CHANGES_PER_MESSAGE).Select(TileChangeList.FromList))
{
foreach (var entry in changeChunk.List)
{
Logger.LogTraceFormat("Sending update for {0} layer {1}", Category.TileMaps, entry.Position,
entry.LayerType);
}
string jsondata = JsonUtility.ToJson (changeChunk);
TileChangesNewClientSync msg =
new TileChangesNewClientSync
{ManagerSubject = managerSubject.GetComponent<NetworkIdentity>().netId,
data = jsondata
};
msg.SendTo(recipient);
}
}
public override string ToString()
{
return string.Format("[Sync Tile ChangeData]");
}
}
|
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Mirror;
//long name I know. This is for syncing new clients when they join to all of the tile changes
public class TileChangesNewClientSync : ServerMessage
{
//just a best guess, try increasing it until the message exceeds mirror's limit
private static readonly int MAX_CHANGES_PER_MESSAGE = 20;
public static short MessageType = (short)MessageTypes.TileChangesNewClientSync;
public string data;
public uint ManagerSubject;
public override IEnumerator Process()
{
Logger.LogError("Received!!");
yield return WaitFor(ManagerSubject);
TileChangeManager tm = NetworkObject.GetComponent<TileChangeManager>();
tm.InitServerSync(data);
}
public static void Send(GameObject managerSubject, GameObject recipient, TileChangeList changeList)
{
if (changeList == null || changeList.List.Count == 0) return;
foreach (var changeChunk in changeList.List.ToArray().Chunk(MAX_CHANGES_PER_MESSAGE).Select(TileChangeList.FromList))
{
string jsondata = JsonUtility.ToJson(changeChunk);
Logger.LogError("Sending!!");
TileChangesNewClientSync.InternalSend(jsondata, managerSubject.GetComponent<NetworkIdentity>().netId, recipient);
//TileChangesNewClientSync msg =
// new TileChangesNewClientSync
// {
// ManagerSubject = managerSubject.GetComponent<NetworkIdentity>().netId,
// data = jsondata
// };
//msg.SendTo(recipient);
}
}
public static void InternalSend(string _data, uint _ManagerSubject, GameObject recipient)
{
TileChangesNewClientSync msg =
new TileChangesNewClientSync
{
ManagerSubject = _ManagerSubject,
data = _data
};
msg.SendTo(recipient);
}
public override string ToString()
{
return string.Format("[Sync Tile ChangeData]");
}
}
|
agpl-3.0
|
C#
|
a03f0f69acd602aa0c762dc84400f332c3c334a4
|
remove absolute database path
|
MattsGitCode/DevDotMail,MattsGitCode/DevDotMail
|
DevDotMail/Bootstrapper.cs
|
DevDotMail/Bootstrapper.cs
|
using Nancy;
using SQLite;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Web;
namespace DevDotMail
{
public class Bootstrapper : DefaultNancyBootstrapper
{
public static MailParser mailParser;
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
}
protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
{
base.ConfigureApplicationContainer(container);
string databaseDir = Path.Combine(RootPathProvider.GetRootPath(), "App_Data");
string databaseFile = Path.Combine(databaseDir, "devdotmail.db");
if (!Directory.Exists(databaseDir))
Directory.CreateDirectory(databaseDir);
var db = new SQLiteConnection(databaseFile, SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite);
container.Register(db);
db.CreateTable<Email>();
var folderToName = ConfigurationManager.AppSettings.Keys
.Cast<string>()
.Where(x => x.StartsWith("mailFolder:"))
.ToDictionary(
key => ConfigurationManager.AppSettings[key],
key => key.Substring(12));
if (mailParser == null)
{
mailParser = new MailParser(folderToName, db);
}
container.Register(mailParser);
}
}
}
|
using Nancy;
using SQLite;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
namespace DevDotMail
{
public class Bootstrapper : DefaultNancyBootstrapper
{
public static MailParser mailParser;
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
}
protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
{
base.ConfigureApplicationContainer(container);
var db = new SQLiteConnection(@"C:\Users\Matt\Documents\visual studio 2013\Projects\DevDotMail\DevDotMail\bin\devdotmail.db", SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite);
container.Register(db);
db.CreateTable<Email>();
var folderToName = ConfigurationManager.AppSettings.Keys
.Cast<string>()
.Where(x => x.StartsWith("mailFolder:"))
.ToDictionary(
key => ConfigurationManager.AppSettings[key],
key => key.Substring(12));
if (mailParser == null)
{
mailParser = new MailParser(folderToName, db);
}
container.Register(mailParser);
}
}
}
|
mit
|
C#
|
e488f93b177a6b3920a2e95b42daac67bd4a91c3
|
Add explanation for the annoying windows popup
|
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
|
BTCPayServer/Views/Wallets/WalletSendLedger.cshtml
|
BTCPayServer/Views/Wallets/WalletSendLedger.cshtml
|
@model WalletSendLedgerModel
@{
Layout = "../Shared/_NavLayout.cshtml";
ViewData["Title"] = "Manage wallet";
ViewData.SetActivePageAndTitle(WalletsNavPages.Send);
}
<h4>Sign the transaction with Ledger</h4>
<div id="walletAlert" class="alert alert-danger alert-dismissible" style="display:none;" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<span id="alertMessage"></span>
</div>
<div class="row">
<div class="col-md-10">
<input type="hidden" asp-for="PSBT" />
<input type="hidden" asp-for="HintChange" />
<input type="hidden" asp-for="SuccessPath" />
<input type="hidden" asp-for="WebsocketPath" />
<p>
You can send money received by this store to an address with the help of your Ledger Wallet. <br />
If you don't have a Ledger Wallet, use Electrum with your favorite hardware wallet to transfer crypto. <br />
If your Ledger wallet is not detected:
</p>
<ul>
<li>Make sure you are running the Ledger app with version superior or equal to <b>1.3.9</b></li>
<li>Use Google Chrome browser and open the coin app on your Ledger</li>
</ul>
<p>If you are on Windows and seeing an annoying popup opening and closing, while it is signing, ignore it. The bigger the transaction, the more this popup will show up.</p>
<p id="hw-loading"><span class="fa fa-question-circle" style="color:orange"></span> <span>Detecting hardware wallet...</span></p>
<p id="hw-error" style="display:none;"><span class="fa fa-times-circle" style="color:red;"></span> <span class="hw-label">An error happened</span></p>
<p id="hw-success" style="display:none;"><span class="fa fa-check-circle" style="color:green;"></span> <span class="hw-label">Detecting hardware wallet...</span></p>
</div>
</div>
@section Scripts
{
<script src="~/js/ledgerwebsocket.js" type="text/javascript" defer="defer"></script>
<script src="~/js/WalletSendLedger.js" type="text/javascript" defer="defer"></script>
}
|
@model WalletSendLedgerModel
@{
Layout = "../Shared/_NavLayout.cshtml";
ViewData["Title"] = "Manage wallet";
ViewData.SetActivePageAndTitle(WalletsNavPages.Send);
}
<h4>Sign the transaction with Ledger</h4>
<div id="walletAlert" class="alert alert-danger alert-dismissible" style="display:none;" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<span id="alertMessage"></span>
</div>
<div class="row">
<div class="col-md-10">
<input type="hidden" asp-for="PSBT" />
<input type="hidden" asp-for="HintChange" />
<input type="hidden" asp-for="SuccessPath" />
<input type="hidden" asp-for="WebsocketPath" />
<p>
You can send money received by this store to an address with the help of your Ledger Wallet. <br />
If you don't have a Ledger Wallet, use Electrum with your favorite hardware wallet to transfer crypto. <br />
If your Ledger wallet is not detected:
</p>
<ul>
<li>Make sure you are running the Ledger app with version superior or equal to <b>1.3.9</b></li>
<li>Use Google Chrome browser and open the coin app on your Ledger</li>
</ul>
<p id="hw-loading"><span class="fa fa-question-circle" style="color:orange"></span> <span>Detecting hardware wallet...</span></p>
<p id="hw-error" style="display:none;"><span class="fa fa-times-circle" style="color:red;"></span> <span class="hw-label">An error happened</span></p>
<p id="hw-success" style="display:none;"><span class="fa fa-check-circle" style="color:green;"></span> <span class="hw-label">Detecting hardware wallet...</span></p>
</div>
</div>
@section Scripts
{
<script src="~/js/ledgerwebsocket.js" type="text/javascript" defer="defer"></script>
<script src="~/js/WalletSendLedger.js" type="text/javascript" defer="defer"></script>
}
|
mit
|
C#
|
0de1038032bb48e0825c5e090b227e1296b9b14f
|
Update Program.cs
|
medhajoshi27/GitTest1
|
ConsoleApplication1/ConsoleApplication1/Program.cs
|
ConsoleApplication1/ConsoleApplication1/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//hello
Console.Writeline("World");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//hello
}
}
}
|
mit
|
C#
|
f80d72b9cb681befe28d86232424f17d0599318f
|
increase packets per second max.
|
zhennTil/LiteNetLib,RevenantX/LiteNetLib
|
LiteNetLib/NetConstants.cs
|
LiteNetLib/NetConstants.cs
|
namespace LiteNetLib
{
public enum SendOptions
{
Unreliable,
ReliableUnordered,
Sequenced,
ReliableOrdered
}
public static class NetConstants
{
public const int HeaderSize = 1;
public const int SequencedHeaderSize = 3;
public const int FragmentHeaderSize = 6;
public const int DefaultWindowSize = 64;
public const ushort MaxSequence = 32768;
public const ushort HalfMaxSequence = MaxSequence / 2;
//socket
public const string MulticastGroupIPv4 = "224.0.0.1";
public const string MulticastGroupIPv6 = "FF02:0:0:0:0:0:0:1";
public const int SocketBufferSize = 1024*1024*2; //2mb
public const int SocketTTL = 255;
//protocol
public const int MaxUdpHeaderSize = 68;
public const int PacketSizeLimit = ushort.MaxValue - MaxUdpHeaderSize;
public const int MinPacketSize = 576 - MaxUdpHeaderSize;
public const int MinPacketDataSize = MinPacketSize - HeaderSize;
public const int MinSequencedPacketDataSize = MinPacketSize - SequencedHeaderSize;
public static readonly int[] PossibleMtu =
{
576 - MaxUdpHeaderSize, //Internet Path MTU for X.25 (RFC 879)
1492 - MaxUdpHeaderSize, //Ethernet with LLC and SNAP, PPPoE (RFC 1042)
1500 - MaxUdpHeaderSize, //Ethernet II (RFC 1191)
4352 - MaxUdpHeaderSize, //FDDI
4464 - MaxUdpHeaderSize, //Token ring
7981 - MaxUdpHeaderSize //WLAN
};
//peer specific
public const int FlowUpdateTime = 1000;
public const int FlowIncreaseThreshold = 4;
public const int PacketsPerSecondMax = 4000000; //from the ceiling
public const int DefaultPingInterval = 1000;
}
}
|
namespace LiteNetLib
{
public enum SendOptions
{
Unreliable,
ReliableUnordered,
Sequenced,
ReliableOrdered
}
public static class NetConstants
{
public const int HeaderSize = 1;
public const int SequencedHeaderSize = 3;
public const int FragmentHeaderSize = 6;
public const int DefaultWindowSize = 64;
public const ushort MaxSequence = 32768;
public const ushort HalfMaxSequence = MaxSequence / 2;
//socket
public const string MulticastGroupIPv4 = "224.0.0.1";
public const string MulticastGroupIPv6 = "FF02:0:0:0:0:0:0:1";
public const int SocketBufferSize = 1024*1024*2; //2mb
public const int SocketTTL = 255;
//protocol
public const int MaxUdpHeaderSize = 68;
public const int PacketSizeLimit = ushort.MaxValue - MaxUdpHeaderSize;
public const int MinPacketSize = 576 - MaxUdpHeaderSize;
public const int MinPacketDataSize = MinPacketSize - HeaderSize;
public const int MinSequencedPacketDataSize = MinPacketSize - SequencedHeaderSize;
public static readonly int[] PossibleMtu =
{
576 - MaxUdpHeaderSize, //Internet Path MTU for X.25 (RFC 879)
1492 - MaxUdpHeaderSize, //Ethernet with LLC and SNAP, PPPoE (RFC 1042)
1500 - MaxUdpHeaderSize, //Ethernet II (RFC 1191)
4352 - MaxUdpHeaderSize, //FDDI
4464 - MaxUdpHeaderSize, //Token ring
7981 - MaxUdpHeaderSize //WLAN
};
//peer specific
public const int FlowUpdateTime = 1000;
public const int FlowIncreaseThreshold = 4;
public const int PacketsPerSecondMax = 65535;
public const int DefaultPingInterval = 1000;
}
}
|
mit
|
C#
|
f4949cb539f1d3d59e5b1063712b866567e9ccb4
|
Update copyright
|
msorens/SqlDiffFramework
|
SqlDiffFramework/SqlDiffFramework/Properties/AssemblyInfo.cs
|
SqlDiffFramework/SqlDiffFramework/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SqlDiffFramework")]
[assembly: AssemblyDescription("A cross-database difference framework.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CleanCode")]
[assembly: AssemblyProduct("SqlDiffFramework")]
[assembly: AssemblyCopyright("Copyright © 2009-2017 Michael Sorens")]
[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("c4a99931-2c56-4c2b-88af-40c2083b9aad")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SqlDiffFramework")]
[assembly: AssemblyDescription("A cross-database difference framework.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CleanCode")]
[assembly: AssemblyProduct("SqlDiffFramework")]
[assembly: AssemblyCopyright("Copyright © 2009-2013 Michael Sorens")]
[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("c4a99931-2c56-4c2b-88af-40c2083b9aad")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]
|
mit
|
C#
|
faae547502731f4a95f5eab6ef2a54e3e45265db
|
Update ErrorResponse.cs
|
bugfi5h/Alexa-Smart-Home
|
RKon.Alexa.NET/Response/ErrorResponses/ErrorResponse.cs
|
RKon.Alexa.NET/Response/ErrorResponses/ErrorResponse.cs
|
using System;
using RKon.Alexa.NET.Request;
using Newtonsoft.Json;
using RKon.Alexa.NET.Types;
namespace RKon.Alexa.NET.Response.ErrorResponses
{
/// <summary>
/// Exception, if this error response is for a DiscoverApplianceRequest
/// </summary>
public class UnvalidDiscoveryResponseException : Exception
{
/// <summary>
/// Constructor
/// </summary>
public UnvalidDiscoveryResponseException() : base("Discovery requests can not be answered by error responses") { }
}
/// <summary>
/// Abstract base class for error responses of SmartHomeRequests.
/// </summary>
public abstract class ErrorResponse : ISmartHomeResponse
{
/// <summary>
/// Header
/// </summary>
[JsonRequired]
[JsonProperty("header")]
public ResponseHeader Header
{
get; set;
}
/// <summary>
/// Payload
/// </summary>
[JsonRequired]
[JsonProperty("payload")]
public ResponsePayload Payload
{
get; set;
}
/// <summary>
/// returns the Type of a Payloads
/// </summary>
/// <returns>System.Type of the Payloads</returns>
public System.Type GetResponsePayloadType()
{
return Payload?.GetType();
}
/// <summary>
/// Sets the Header with the request header and the errorname.
/// </summary>
/// <param name="reqHeader">RequestHeader</param>
/// <param name="errorName">Name of the error</param>
/// <returns></returns>
protected ResponseHeader setHeader(RequestHeader reqHeader, string errorName)
{
ResponseHeader header = new ResponseHeader(reqHeader);
header.Name = errorName;
return header;
}
/// <summary>
/// Throws a UnvalidDiscoveryResponseException, if a Errorresponse is used as a response for DiscoverApplianceRequests.
/// </summary>
/// <param name="reqHeaderName"></param>
protected void throwExceptionOnDiscoveryRequest(string reqHeaderName)
{
if (reqHeaderName == HeaderNames.DISCOVERY_REQUEST)
{
throw new UnvalidDiscoveryResponseException();
}
}
}
}
|
using System;
using RKon.Alexa.NET.Request;
using Newtonsoft.Json;
using RKon.Alexa.NET.Types;
namespace RKon.Alexa.NET.Response.ErrorResponses
{
/// <summary>
/// Exception, if this error response is for a DiscoverApplianceRequest
/// </summary>
public class UnvalidDiscoveryResponseException : Exception
{
/// <summary>
/// Constructor
/// </summary>
public UnvalidDiscoveryResponseException() : base("Discovery requests can not be answered by error responses") { }
}
/// <summary>
/// Abstract base class for error responses of SmartHomeRequests.
/// </summary>
public abstract class ErrorResponse : ISmartHomeResponse
{
/// <summary>
/// Header
/// </summary>
[JsonRequired]
[JsonProperty("header")]
public ResponseHeader Header
{
get; set;
}
/// <summary>
/// Payload
/// </summary>
[JsonRequired]
[JsonProperty("payload")]
public ResponsePayload Payload
{
get; set;
}
/// <summary>
/// returns the Type of a Payloads
/// </summary>
/// <returns>System.Type of the Payloads</returns>
public System.Type GetResponsePayloadType()
{
return Payload?.GetType();
}
/// <summary>
/// Sets the Header with the request header and the errorname.
/// </summary>
/// <param name="reqHeader">RequestHeader</param>
/// <param name="errorName">Name of the error</param>
/// <returns></returns>
protected ResponseHeader setHeader(RequestHeader reqHeader, string errorName)
{
ResponseHeader header = new ResponseHeader(reqHeader);
header.Name = errorName;
return header;
}
/// <summary>
/// Schmeißt eine UnvalidDiscoveryResponseException, wenn versucht wird eine ErrorResponse für ein DiscoverApplianceRequest zu verwenden.
/// </summary>
/// <param name="reqHeaderName"></param>
protected void throwExceptionOnDiscoveryRequest(string reqHeaderName)
{
if (reqHeaderName == HeaderNames.DISCOVERY_REQUEST)
{
throw new UnvalidDiscoveryResponseException();
}
}
}
}
|
mit
|
C#
|
49112ca379d3e3df80406eca519244496d9fd50b
|
Add timer class
|
rockyx/dntdiag
|
DNT/Diag/Timer.cs
|
DNT/Diag/Timer.cs
|
using System;
using System.Diagnostics;
namespace DNT.Diag
{
public class Timer
{
private const double NANO = 1 * 1000 * 1000 * 1000;
private const double MICRO = 1 * 1000 * 1000;
private const double MILLI = 1 * 1000;
static readonly double TICKS_PER_NANO = Stopwatch.Frequency / NANO;
static readonly double TICKS_PER_MICRO = Stopwatch.Frequency / MICRO;
static readonly double TICKS_PER_MILLI = Stopwatch.Frequency / MILLI;
static readonly double NANO_PER_TICKS = NANO / Stopwatch.Frequency;
static readonly double MICRO_PER_TICKS = MICRO / Stopwatch.Frequency;
static readonly double MILLI_PER_TICKS = MILLI / Stopwatch.Frequency;
private long ticks;
public Timer ()
{
ticks = 0;
}
public Timer (long ticks)
{
this.ticks = ticks;
}
public TimeSpan ToTimeSpan ()
{
return TimeSpan.FromTicks (ticks);
}
public long Nanoseconds {
get { return (long)(ticks * NANO_PER_TICKS); }
set { ticks = (long)(value * TICKS_PER_NANO); }
}
public long Microseconds {
get { return (long)(ticks * MICRO_PER_TICKS); }
set { ticks = (long)(value * TICKS_PER_MICRO); }
}
public long Milliseconds {
get { return (long)(ticks * MILLI_PER_TICKS); }
set { ticks = (long)(value * TICKS_PER_MILLI); }
}
public long Seconds {
get { return (long)(ticks / Stopwatch.Frequency); }
set { ticks = (long)(value * Stopwatch.Frequency); }
}
public long Ticks {
get { return ticks; }
set { ticks = value; }
}
public static Timer FromMicroseconds (long time)
{
return new Timer (time * TICKS_PER_MICRO);
}
public static Timer FromMilliseconds (long time)
{
return new Timer (time * TICKS_PER_MILLI);
}
public static Timer FromSeconds (long time)
{
return new Timer (time * Stopwatch.Frequency);
}
}
}
|
using System;
namespace DNT.Diag.Android
{
public class Timer
{
public Timer ()
{
}
}
}
|
apache-2.0
|
C#
|
9475ccd0d8b94542cd5dc2c7179036bab3c470fc
|
revert accidential change
|
chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet
|
Source/MQTTnet.AspnetCore/MqttWebSocketServerAdapter.cs
|
Source/MQTTnet.AspnetCore/MqttWebSocketServerAdapter.cs
|
using System;
using System.Net.WebSockets;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using MQTTnet.Adapter;
using MQTTnet.Diagnostics;
using MQTTnet.Formatter;
using MQTTnet.Implementations;
using MQTTnet.Server;
namespace MQTTnet.AspNetCore
{
public class MqttWebSocketServerAdapter : IMqttServerAdapter
{
private readonly IMqttNetChildLogger _logger;
public MqttWebSocketServerAdapter(IMqttNetChildLogger logger)
{
if (logger == null) throw new ArgumentNullException(nameof(logger));
_logger = logger.CreateChildLogger(nameof(MqttTcpServerAdapter));
}
public Action<MqttServerAdapterClientAcceptedEventArgs> ClientAcceptedHandler { get; set; }
public Task StartAsync(IMqttServerOptions options)
{
return Task.CompletedTask;
}
public Task StopAsync()
{
return Task.CompletedTask;
}
public async Task RunWebSocketConnectionAsync(WebSocket webSocket, HttpContext httpContext)
{
if (webSocket == null) throw new ArgumentNullException(nameof(webSocket));
var endpoint = $"{httpContext.Connection.RemoteIpAddress}:{httpContext.Connection.RemotePort}";
var clientCertificate = await httpContext.Connection.GetClientCertificateAsync().ConfigureAwait(false);
var isSecureConnection = clientCertificate != null;
clientCertificate?.Dispose();
var writer = new SpanBasedMqttPacketWriter();
var formatter = new MqttPacketFormatterAdapter(writer);
var channel = new MqttWebSocketChannel(webSocket, endpoint, isSecureConnection);
var channelAdapter = new MqttChannelAdapter(channel, formatter, _logger.CreateChildLogger(nameof(MqttWebSocketServerAdapter)));
var eventArgs = new MqttServerAdapterClientAcceptedEventArgs(channelAdapter);
ClientAcceptedHandler?.Invoke(eventArgs);
if (eventArgs.SessionTask != null)
{
await eventArgs.SessionTask.ConfigureAwait(false);
}
}
public void Dispose()
{
}
}
}
|
using System;
using System.Net.WebSockets;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using MQTTnet.Adapter;
using MQTTnet.Diagnostics;
using MQTTnet.Formatter;
using MQTTnet.Implementations;
using MQTTnet.Server;
namespace MQTTnet.AspNetCore
{
public class MqttWebSocketServerAdapter : IMqttServerAdapter
{
private readonly IMqttNetChildLogger _logger;
public MqttWebSocketServerAdapter(IMqttNetChildLogger logger)
{
if (logger == null) throw new ArgumentNullException(nameof(logger));
_logger = logger.CreateChildLogger(nameof(MqttTcpServerAdapter));
}
public Action<MqttServerAdapterClientAcceptedEventArgs> ClientAcceptedHandler { get; set; }
public Task StartAsync(IMqttServerOptions options)
{
return Task.CompletedTask;
}
public Task StopAsync()
{
return Task.CompletedTask;
}
public async Task RunWebSocketConnectionAsync(WebSocket webSocket, HttpContext httpContext)
{
if (webSocket == null) throw new ArgumentNullException(nameof(webSocket));
var endpoint = $"{httpContext.Connection.RemoteIpAddress}:{httpContext.Connection.RemotePort}";
var clientCertificate = await httpContext.Connection.GetClientCertificateAsync().ConfigureAwait(false);
var isSecureConnection = clientCertificate != null;
clientCertificate?.Dispose();
var writer = new SpanBasedMqttPacketWriter();
var formatter = new MqttPacketFormatterAdapter(writer);
var channel = new MqttWebSocketChannel(webSocket, endpoint, isSecureConnection);
var channelAdapter = new MqttChannelAdapter(channel, formatter, new MqttNetLogger().CreateChildLogger(nameof(MqttWebSocketServerAdapter)));
var eventArgs = new MqttServerAdapterClientAcceptedEventArgs(channelAdapter);
ClientAcceptedHandler?.Invoke(eventArgs);
if (eventArgs.SessionTask != null)
{
await eventArgs.SessionTask.ConfigureAwait(false);
}
}
public void Dispose()
{
}
}
}
|
mit
|
C#
|
4457083f00896c289000adc321c5a41043af4fc3
|
Remove the testing key
|
mattleibow/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,JonDouglas/XamarinComponents,topgenorth/XamarinComponents,xamarin/XamarinComponents,JonDouglas/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,topgenorth/XamarinComponents,JonDouglas/XamarinComponents,JonDouglas/XamarinComponents,topgenorth/XamarinComponents,topgenorth/XamarinComponents,mattleibow/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,mattleibow/XamarinComponents,mattleibow/XamarinComponents,xamarin/XamarinComponents
|
XPlat/Mapbox/iOS/samples/MapboxSampleiOS/AppDelegate.cs
|
XPlat/Mapbox/iOS/samples/MapboxSampleiOS/AppDelegate.cs
|
using Foundation;
using UIKit;
using Mapbox;
namespace MapBoxSampleiOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
// class-level declarations
public override UIWindow Window {
get;
set;
}
const string MAPBOX_ACCESS_TOKEN = "YOUR-ACCESS-TOKEN";
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
if (MAPBOX_ACCESS_TOKEN == "YOUR-ACCESS-TOKEN") {
new UIAlertView ("Change Access Token", "You need to change the MAPBOX_ACCESS_TOKEN to your own token from MapBox!", null, "OK")
.Show ();
}
// Set your own Access Token
AccountManager.AccessToken = MAPBOX_ACCESS_TOKEN;
return true;
}
}
}
|
using Foundation;
using UIKit;
using Mapbox;
namespace MapBoxSampleiOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
// class-level declarations
public override UIWindow Window {
get;
set;
}
const string MAPBOX_ACCESS_TOKEN = "pk.eyJ1IjoiYmlsbGhvbG1lczU0IiwiYSI6ImNpdHB0bDU2bDAyaTMydG1vZHo0ZmVkbWYifQ.8Sn8CpcyPTnZ2vP48KpE_w";
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
if (MAPBOX_ACCESS_TOKEN == "YOUR-ACCESS-TOKEN") {
new UIAlertView ("Change Access Token", "You need to change the MAPBOX_ACCESS_TOKEN to your own token from MapBox!", null, "OK")
.Show ();
}
// Set your own Access Token
AccountManager.AccessToken = MAPBOX_ACCESS_TOKEN;
return true;
}
}
}
|
mit
|
C#
|
921561e3af44204b984d6ea8d193a73e95a253c3
|
Bump version
|
gonzalocasas/NetMetrixSDK
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NetMetrixSDK")]
[assembly: AssemblyDescription("Net-Metrix SDK for Windows Phone applications")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Gonzalo Casas")]
[assembly: AssemblyProduct("NetMetrix SDK")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d26acda3-5465-4207-8fd0-a1bbedd41bbc")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NetMetrixSDK")]
[assembly: AssemblyDescription("Net-Metrix SDK for Windows Phone applications")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Gonzalo Casas")]
[assembly: AssemblyProduct("NetMetrix SDK")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d26acda3-5465-4207-8fd0-a1bbedd41bbc")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
|
mit
|
C#
|
a3ee5ebb99d82c0a7d8d3b6b9bf769337d52cbd5
|
Update version to 0.9.1
|
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using TweetDick;
// 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(Program.BrandName)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct(Program.BrandName)]
[assembly: AssemblyCopyright("")]
[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("7f09373d-8beb-416f-a48d-45d8aaeb8caf")]
// 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.9.1.0")]
[assembly: AssemblyFileVersion("0.9.1.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using TweetDick;
// 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(Program.BrandName)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct(Program.BrandName)]
[assembly: AssemblyCopyright("")]
[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("7f09373d-8beb-416f-a48d-45d8aaeb8caf")]
// 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.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
|
mit
|
C#
|
f2fc1b844cdcd11d93db4d9e34ce196e5b0dfa1f
|
Remove unused namespace
|
another-guy/Murmansk.ComponentModel
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Murmansk.ComponentModel")]
[assembly: AssemblyDescription("Provides custom model validation attributes.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Murmansk")]
[assembly: AssemblyProduct("Murmansk.ComponentModel")]
[assembly: AssemblyCopyright("Copyright © Murmansk 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21ecf1dd-a3d9-49aa-b3c9-50cbdd212bc9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.3.0")]
[assembly: AssemblyFileVersion("0.0.3.0")]
// Used with NuGet
[assembly: AssemblyInformationalVersion("0.0.3")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Murmansk.ComponentModel")]
[assembly: AssemblyDescription("Provides custom model validation attributes.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Murmansk")]
[assembly: AssemblyProduct("Murmansk.ComponentModel")]
[assembly: AssemblyCopyright("Copyright © Murmansk 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21ecf1dd-a3d9-49aa-b3c9-50cbdd212bc9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.3.0")]
[assembly: AssemblyFileVersion("0.0.3.0")]
// Used with NuGet
[assembly: AssemblyInformationalVersion("0.0.3")]
|
mit
|
C#
|
1e891483b83a503bc4715ff28d9998d2d4b7d488
|
Update assembly infos
|
protyposis/AudioAlign
|
Properties/AssemblyInfo.cs
|
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("AudioAlign")]
[assembly: AssemblyDescription("AudioAlign Audio Synchronization and Analysis Library")]
[assembly: AssemblyCopyright("Copyright © 2010-2015 Mario Guggenberger")]
// 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("AudioAlign")]
[assembly: AssemblyDescription("")]
// 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)
)]
|
agpl-3.0
|
C#
|
4d17e3e74e615f77193110f4d76ae02d15359409
|
Fix dummy fix
|
michael-reichenauer/GitMind
|
GitMind/GitModel/Branch.cs
|
GitMind/GitModel/Branch.cs
|
using System.Collections.Generic;
using System.Linq;
namespace GitMind.GitModel
{
// Some extra Branch
internal class Branch
{
private readonly Repository repository;
private readonly string tipCommitId;
private readonly string firstCommitId;
private readonly string parentCommitId;
private readonly IReadOnlyList<string> commitIds;
private readonly string parentBranchId;
public Branch(
Repository repository,
string id,
string name,
string tipCommitId,
string firstCommitId,
string parentCommitId,
IReadOnlyList<string> commitIds,
string parentBranchId,
IReadOnlyList<string> childBranchNames,
bool isActive,
bool isMultiBranch,
int localAheadCount,
int remoteAheadCount)
{
this.repository = repository;
this.tipCommitId = tipCommitId;
this.firstCommitId = firstCommitId;
this.parentCommitId = parentCommitId;
this.commitIds = commitIds;
this.parentBranchId = parentBranchId;
Id = id;
Name = name;
ChildBranchNames = childBranchNames;
IsActive = isActive;
IsMultiBranch = isMultiBranch;
LocalAheadCount = localAheadCount;
RemoteAheadCount = remoteAheadCount;
}
public string Id { get; }
public string Name { get; }
public IReadOnlyList<string> ChildBranchNames { get; }
public bool IsActive { get; }
public bool IsMultiBranch { get; }
public int LocalAheadCount { get; }
public int RemoteAheadCount { get; }
public Commit TipCommit => repository.Commits[tipCommitId];
public Commit FirstCommit => repository.Commits[firstCommitId];
public Commit ParentCommit => repository.Commits[parentCommitId];
public IEnumerable<Commit> Commits => commitIds.Select(id => repository.Commits[id]);
public bool HasParentBranch => parentBranchId != null;
public Branch ParentBranch => repository.Branches[parentBranchId];
public bool IsCurrentBranch => repository.CurrentBranch == this;
public bool IsMergeable =>
IsCurrentBranch
&& repository.Status.ConflictCount == 0
&& repository.Status.StatusCount == 0;
public IEnumerable<Branch> GetChildBranches()
{
foreach (Branch branch in repository.Branches
.Where(b => b.HasParentBranch && b.ParentBranch == this)
.Distinct()
.OrderByDescending(b => b.ParentCommit.CommitDate))
{
yield return branch;
}
}
public IEnumerable<Branch> Parents()
{
Branch current = this;
while (current.HasParentBranch)
{
current = current.ParentBranch;
yield return current;
}
}
public override string ToString() => Name;
}
}
|
using System.Collections.Generic;
using System.Linq;
namespace GitMind.GitModel
{
// Some extra Branch and some
internal class Branch
{
private readonly Repository repository;
private readonly string tipCommitId;
private readonly string firstCommitId;
private readonly string parentCommitId;
private readonly IReadOnlyList<string> commitIds;
private readonly string parentBranchId;
public Branch(
Repository repository,
string id,
string name,
string tipCommitId,
string firstCommitId,
string parentCommitId,
IReadOnlyList<string> commitIds,
string parentBranchId,
IReadOnlyList<string> childBranchNames,
bool isActive,
bool isMultiBranch,
int localAheadCount,
int remoteAheadCount)
{
this.repository = repository;
this.tipCommitId = tipCommitId;
this.firstCommitId = firstCommitId;
this.parentCommitId = parentCommitId;
this.commitIds = commitIds;
this.parentBranchId = parentBranchId;
Id = id;
Name = name;
ChildBranchNames = childBranchNames;
IsActive = isActive;
IsMultiBranch = isMultiBranch;
LocalAheadCount = localAheadCount;
RemoteAheadCount = remoteAheadCount;
}
public string Id { get; }
public string Name { get; }
public IReadOnlyList<string> ChildBranchNames { get; }
public bool IsActive { get; }
public bool IsMultiBranch { get; }
public int LocalAheadCount { get; }
public int RemoteAheadCount { get; }
public Commit TipCommit => repository.Commits[tipCommitId];
public Commit FirstCommit => repository.Commits[firstCommitId];
public Commit ParentCommit => repository.Commits[parentCommitId];
public IEnumerable<Commit> Commits => commitIds.Select(id => repository.Commits[id]);
public bool HasParentBranch => parentBranchId != null;
public Branch ParentBranch => repository.Branches[parentBranchId];
public bool IsCurrentBranch => repository.CurrentBranch == this;
public bool IsMergeable =>
IsCurrentBranch
&& repository.Status.ConflictCount == 0
&& repository.Status.StatusCount == 0;
public IEnumerable<Branch> GetChildBranches()
{
foreach (Branch branch in repository.Branches
.Where(b => b.HasParentBranch && b.ParentBranch == this)
.Distinct()
.OrderByDescending(b => b.ParentCommit.CommitDate))
{
yield return branch;
}
}
public IEnumerable<Branch> Parents()
{
Branch current = this;
while (current.HasParentBranch)
{
current = current.ParentBranch;
yield return current;
}
}
public override string ToString() => Name;
}
}
|
mit
|
C#
|
4ac4b2848b8c2ad814274150e7030d91485d3582
|
Clean up
|
asibahi/RoomArrangement
|
RoomArrangement/Program.cs
|
RoomArrangement/Program.cs
|
using static System.Console;
namespace RoomArrangement
{
class Program
{
static void Main(string[] args)
{
var input = new Input();
input.RequestInput();
var bldgProgram = new BldgProgram(input);
var house = new House(input, bldgProgram);
house.RunThrowAndStick();
house.RunPushPull();
foreach(Room r in house)
WriteLine(r.ToString());
//house.Draw();
ReadKey();
}
}
}
|
using System;
namespace RoomArrangement
{
class Program
{
static void Main(string[] args)
{
var input = new Input();
input.RequestInput();
var bldgProgram = new BldgProgram(input);
var house = new House(input, bldgProgram);
house.RunThrowAndStick();
house.RunPushPull();
foreach(Room r in house)
Console.WriteLine(r.ToString());
//house.Draw();
Console.ReadKey();
}
}
}
|
mit
|
C#
|
b17aa35e7394f90cd823f3c9c646a72e3dd5e1f1
|
Add tests to AccessTest.cs
|
GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples
|
iam/api/AccessTest/AccessTest.cs
|
iam/api/AccessTest/AccessTest.cs
|
// Copyright 2019 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using Xunit;
namespace GoogleCloudSamples
{
public class AccessTest
{
private readonly string _project;
private readonly string _role1;
private readonly string _role2;
private readonly string _member1;
private readonly string _member2;
private readonly string _member3;
public AccessTest(){
_project = Environment.GetEnvironmentVariable("GOOGLE_PROJECT_ID");
_role1 = "roles/viewer";
_role2 = "roles/editor";
_member1 = "user:user1@example.com";
_member2 = "user:user2@example.com";
_member3 = "user:user3@example.com";
}
[Fact]
public void TestAccess()
{
// Test GetPolicy
var policy = AccessManager.GetPolicy(_project);
// Test AddBinding
policy = AccessManager.AddBinding(policy, _role1, _member1);
// Test AddMember
policy = AccessManager.AddMember(policy, _role1, _member2);
// Test RemoveMember where role binding doesn't exist
policy = AccessManager.RemoveMember(policy, _role2, _member1);
// Test RemoveMember where member doesn't exist
policy = AccessManager.RemoveMember(policy, _role1, _member3);
// Test RemoveMember
policy = AccessManager.RemoveMember(policy, _role1, _member1);
// Test RemoveMember when removing last member from binding
policy = AccessManager.RemoveMember(policy, _role1, _member2);
// Test SetPolicy
policy = AccessManager.SetPolicy(_project, policy);
}
}
}
|
// Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using Xunit;
namespace GoogleCloudSamples
{
public class AccessTest
{
[Fact]
public void TestAccess()
{
string project = Environment.GetEnvironmentVariable("GOOGLE_PROJECT_ID");
var policy = AccessManager.GetPolicy(project);
policy = AccessManager.SetPolicy(project, policy);
}
}
}
|
apache-2.0
|
C#
|
c83c3e92fcebfe9793633ed1b55fa330ab4028a0
|
apply a private setter in a protected property
|
ppy/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,UselessToucan/osu,UselessToucan/osu
|
osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs
|
osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.UI.Scrolling
{
/// <summary>
/// A type of <see cref="Playfield"/> specialized towards scrolling <see cref="DrawableHitObject"/>s.
/// </summary>
public abstract class ScrollingPlayfield : Playfield
{
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
[Resolved]
protected IScrollingInfo ScrollingInfo { get; private set; }
protected ISkinSource CurrentSkin { get; private set; }
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
Direction.BindTo(ScrollingInfo.Direction);
CurrentSkin = skin;
skin.SourceChanged += OnSkinChanged;
OnSkinChanged();
}
protected virtual void OnSkinChanged()
{
}
/// <summary>
/// Given a position in screen space, return the time within this column.
/// </summary>
public virtual double TimeAtScreenSpacePosition(Vector2 screenSpacePosition) =>
((ScrollingHitObjectContainer)HitObjectContainer).TimeAtScreenSpacePosition(screenSpacePosition);
/// <summary>
/// Given a time, return the screen space position within this column.
/// </summary>
public virtual Vector2 ScreenSpacePositionAtTime(double time)
=> ((ScrollingHitObjectContainer)HitObjectContainer).ScreenSpacePositionAtTime(time);
protected sealed override HitObjectContainer CreateHitObjectContainer() => new ScrollingHitObjectContainer();
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.UI.Scrolling
{
/// <summary>
/// A type of <see cref="Playfield"/> specialized towards scrolling <see cref="DrawableHitObject"/>s.
/// </summary>
public abstract class ScrollingPlayfield : Playfield
{
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
[Resolved]
protected IScrollingInfo ScrollingInfo { get; private set; }
protected ISkinSource CurrentSkin;
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
Direction.BindTo(ScrollingInfo.Direction);
CurrentSkin = skin;
skin.SourceChanged += OnSkinChanged;
OnSkinChanged();
}
protected virtual void OnSkinChanged()
{
}
/// <summary>
/// Given a position in screen space, return the time within this column.
/// </summary>
public virtual double TimeAtScreenSpacePosition(Vector2 screenSpacePosition) =>
((ScrollingHitObjectContainer)HitObjectContainer).TimeAtScreenSpacePosition(screenSpacePosition);
/// <summary>
/// Given a time, return the screen space position within this column.
/// </summary>
public virtual Vector2 ScreenSpacePositionAtTime(double time)
=> ((ScrollingHitObjectContainer)HitObjectContainer).ScreenSpacePositionAtTime(time);
protected sealed override HitObjectContainer CreateHitObjectContainer() => new ScrollingHitObjectContainer();
}
}
|
mit
|
C#
|
30a9593e20ec1d37fd5149ba28f3e1007e78d1ec
|
Sort usings.
|
KirillOsenkov/roslyn,a-ctor/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,gafter/roslyn,dpoeschl/roslyn,reaction1989/roslyn,tmat/roslyn,MattWindsor91/roslyn,mattwar/roslyn,bartdesmet/roslyn,jamesqo/roslyn,tvand7093/roslyn,ErikSchierboom/roslyn,davkean/roslyn,mgoertz-msft/roslyn,VSadov/roslyn,jkotas/roslyn,AnthonyDGreen/roslyn,VSadov/roslyn,tmat/roslyn,OmarTawfik/roslyn,AArnott/roslyn,orthoxerox/roslyn,gafter/roslyn,jamesqo/roslyn,xasx/roslyn,wvdd007/roslyn,dpoeschl/roslyn,zooba/roslyn,OmarTawfik/roslyn,vslsnap/roslyn,MattWindsor91/roslyn,paulvanbrenk/roslyn,akrisiun/roslyn,Giftednewt/roslyn,cston/roslyn,bbarry/roslyn,Pvlerick/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,srivatsn/roslyn,reaction1989/roslyn,tmeschter/roslyn,akrisiun/roslyn,jeffanders/roslyn,mattscheffer/roslyn,physhi/roslyn,KevinRansom/roslyn,AnthonyDGreen/roslyn,AlekseyTs/roslyn,MichalStrehovsky/roslyn,lorcanmooney/roslyn,panopticoncentral/roslyn,eriawan/roslyn,lorcanmooney/roslyn,jcouv/roslyn,bbarry/roslyn,TyOverby/roslyn,amcasey/roslyn,mmitche/roslyn,robinsedlaczek/roslyn,swaroop-sridhar/roslyn,jasonmalinowski/roslyn,pdelvo/roslyn,KevinH-MS/roslyn,CaptainHayashi/roslyn,CaptainHayashi/roslyn,DustinCampbell/roslyn,CaptainHayashi/roslyn,AArnott/roslyn,aelij/roslyn,shyamnamboodiripad/roslyn,drognanar/roslyn,bkoelman/roslyn,mattwar/roslyn,orthoxerox/roslyn,jmarolf/roslyn,brettfo/roslyn,kelltrick/roslyn,Pvlerick/roslyn,stephentoub/roslyn,stephentoub/roslyn,drognanar/roslyn,mattscheffer/roslyn,bkoelman/roslyn,weltkante/roslyn,davkean/roslyn,agocke/roslyn,heejaechang/roslyn,aelij/roslyn,mattscheffer/roslyn,jeffanders/roslyn,OmarTawfik/roslyn,srivatsn/roslyn,davkean/roslyn,xoofx/roslyn,stephentoub/roslyn,bartdesmet/roslyn,pdelvo/roslyn,lorcanmooney/roslyn,heejaechang/roslyn,mmitche/roslyn,kelltrick/roslyn,Giftednewt/roslyn,jkotas/roslyn,tmat/roslyn,abock/roslyn,jcouv/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,wvdd007/roslyn,AArnott/roslyn,sharwell/roslyn,tmeschter/roslyn,jamesqo/roslyn,Giftednewt/roslyn,KevinH-MS/roslyn,dotnet/roslyn,physhi/roslyn,physhi/roslyn,akrisiun/roslyn,mattwar/roslyn,KirillOsenkov/roslyn,zooba/roslyn,KevinRansom/roslyn,mgoertz-msft/roslyn,xoofx/roslyn,shyamnamboodiripad/roslyn,cston/roslyn,nguerrera/roslyn,KevinH-MS/roslyn,dotnet/roslyn,swaroop-sridhar/roslyn,xasx/roslyn,ErikSchierboom/roslyn,robinsedlaczek/roslyn,xoofx/roslyn,tannergooding/roslyn,MattWindsor91/roslyn,bkoelman/roslyn,dotnet/roslyn,MichalStrehovsky/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,Hosch250/roslyn,Pvlerick/roslyn,tvand7093/roslyn,srivatsn/roslyn,nguerrera/roslyn,bartdesmet/roslyn,TyOverby/roslyn,TyOverby/roslyn,drognanar/roslyn,aelij/roslyn,KevinRansom/roslyn,MattWindsor91/roslyn,mmitche/roslyn,diryboy/roslyn,eriawan/roslyn,genlu/roslyn,mavasani/roslyn,a-ctor/roslyn,yeaicc/roslyn,vslsnap/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mgoertz-msft/roslyn,gafter/roslyn,AmadeusW/roslyn,sharwell/roslyn,panopticoncentral/roslyn,jasonmalinowski/roslyn,Hosch250/roslyn,wvdd007/roslyn,a-ctor/roslyn,DustinCampbell/roslyn,AlekseyTs/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,ErikSchierboom/roslyn,jcouv/roslyn,khyperia/roslyn,agocke/roslyn,tannergooding/roslyn,DustinCampbell/roslyn,VSadov/roslyn,khyperia/roslyn,cston/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,jmarolf/roslyn,tmeschter/roslyn,abock/roslyn,xasx/roslyn,swaroop-sridhar/roslyn,yeaicc/roslyn,nguerrera/roslyn,dpoeschl/roslyn,heejaechang/roslyn,MichalStrehovsky/roslyn,AnthonyDGreen/roslyn,mavasani/roslyn,brettfo/roslyn,eriawan/roslyn,yeaicc/roslyn,agocke/roslyn,orthoxerox/roslyn,robinsedlaczek/roslyn,CyrusNajmabadi/roslyn,amcasey/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,vslsnap/roslyn,diryboy/roslyn,jkotas/roslyn,AlekseyTs/roslyn,AmadeusW/roslyn,bbarry/roslyn,zooba/roslyn,tannergooding/roslyn,mavasani/roslyn,paulvanbrenk/roslyn,AmadeusW/roslyn,amcasey/roslyn,reaction1989/roslyn,brettfo/roslyn,jeffanders/roslyn,paulvanbrenk/roslyn,Hosch250/roslyn,pdelvo/roslyn,kelltrick/roslyn,genlu/roslyn,tvand7093/roslyn,weltkante/roslyn,abock/roslyn,khyperia/roslyn,genlu/roslyn
|
src/VisualStudio/Core/Next/FindReferences/TaggedTextAndHighlightSpan.cs
|
src/VisualStudio/Core/Next/FindReferences/TaggedTextAndHighlightSpan.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.Collections.Immutable;
using Microsoft.CodeAnalysis.Classification;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.VisualStudio.LanguageServices.FindReferences
{
internal struct ClassifiedSpansAndHighlightSpan
{
public readonly ImmutableArray<ClassifiedSpan> ClassifiedSpans;
public readonly TextSpan HighlightSpan;
public ClassifiedSpansAndHighlightSpan(
ImmutableArray<ClassifiedSpan> classifiedSpans,
TextSpan highlightSpan)
{
ClassifiedSpans = classifiedSpans;
HighlightSpan = highlightSpan;
}
}
}
|
// 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 Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Classification;
namespace Microsoft.VisualStudio.LanguageServices.FindReferences
{
internal struct ClassifiedSpansAndHighlightSpan
{
public readonly ImmutableArray<ClassifiedSpan> ClassifiedSpans;
public readonly TextSpan HighlightSpan;
public ClassifiedSpansAndHighlightSpan(
ImmutableArray<ClassifiedSpan> classifiedSpans,
TextSpan highlightSpan)
{
ClassifiedSpans = classifiedSpans;
HighlightSpan = highlightSpan;
}
}
}
|
mit
|
C#
|
6e4fcab867152c13c1ff9bd6aa7e3f4d60b26c42
|
restructure abstract class PackageResolver
|
tsolarin/dotnet-globals,tsolarin/dotnet-globals
|
src/DotNet.Executor.Core/PackageResolvers/PackageResolver.cs
|
src/DotNet.Executor.Core/PackageResolvers/PackageResolver.cs
|
namespace DotNet.Executor.Core.PackageResolvers
{
using System;
using System.IO;
internal abstract class PackageResolver
{
protected DirectoryInfo PackagesFolder { get; set; }
protected DirectoryInfo PackageFolder { get; set; }
protected string Source { get; set; }
abstract protected void Acquire();
protected PackageResolver(DirectoryInfo packagesFolder, string source)
{
this.PackagesFolder = packagesFolder;
this.Source = source;
}
public Package Resolve()
{
this.Acquire();
if (this.PackageFolder == null)
throw new Exception("PackageFolder property not set");
if (this.PackagesFolder.FullName != this.PackageFolder.Parent.FullName)
throw new Exception("Package folder not in specified packages folder");
return new Package() { Directory = this.PackageFolder, EntryAssemblyFileName = this.PackageFolder.Name + ".dll" };
}
}
}
|
namespace DotNet.Executor.Core.PackageResolvers
{
using System;
using System.IO;
abstract class PackageResolver
{
protected DirectoryInfo PackagesFolder { get; set; }
protected DirectoryInfo PackageFolder { get; set; }
protected string Source { get; set; }
abstract protected void Acquire();
protected PackageResolver(DirectoryInfo packagesFolder, string source)
{
this.PackagesFolder = packagesFolder;
this.Source = source;
}
public Package Resolve()
{
this.Acquire();
if (this.PackageFolder == null)
throw new Exception("PackageFolder property not set");
if (this.PackagesFolder.FullName != this.PackageFolder.Parent.FullName)
throw new Exception("Package folder not in specified packages folder");
return new Package() { Directory = this.PackageFolder, EntryAssemblyFileName = this.PackageFolder.Name + ".dll" };
}
}
}
|
mit
|
C#
|
0858ab13597adf20c2c49f6110ae63e912523744
|
Fix comment typo.
|
peterlanoie/aspnet-mvc-slack
|
src/Pelasoft.AspNet.Mvc.Slack/WebHookErrorReportAttribute.cs
|
src/Pelasoft.AspNet.Mvc.Slack/WebHookErrorReportAttribute.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using WebHooks = Slack.Webhooks;
namespace Pelasoft.AspNet.Mvc.Slack
{
/// <summary>
/// Defines an action filter that logs thrown exceptions to a Slack channel.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class WebHookErrorReportAttribute : FilterAttribute, IWebHookErrorReporter, IExceptionFilter
{
private readonly WebHookErrorReportFilter _innerFilter;
/// <summary>
/// The slack web hook URL.
/// </summary>
public string WebhookUrl
{
get { return _innerFilter.WebhookUrl; }
set { _innerFilter.WebhookUrl = value; }
}
/// <summary>
/// The slack channel name to which exception reports are posted.
/// Optional; the web hook default channel will be used if not specified.
/// </summary>
public string ChannelName
{
get { return _innerFilter.ChannelName; }
set { _innerFilter.ChannelName = value; }
}
/// <summary>
/// The username the error messages will post as.
/// Optional; the web hook default username will be used if not specified.
/// </summary>
public string UserName
{
get { return _innerFilter.UserName; }
set { _innerFilter.UserName = value; }
}
public bool IgnoreHandled
{
get { return _innerFilter.IgnoreHandled; }
set { _innerFilter.IgnoreHandled = value; }
}
/// <summary>
/// The types of the exceptions to ignore. Use this to cut down on unecessary channel chatter.
/// This list will be ignored if <see cref="ExceptionType"/> is specified.
/// </summary>
public Type[] ExcludeExceptionTypes
{
get { return _innerFilter.ExcludeExceptionTypes; }
set { _innerFilter.ExcludeExceptionTypes = value; }
}
/// <summary>
/// Creates a new instance of the exception filter for the specified <paramref name="webHookUrl"/>.
/// </summary>
/// <param name="exceptionType">The exception type to handle.</param>
public WebHookErrorReportAttribute(string webHookUrl)
{
_innerFilter = new WebHookErrorReportFilter(webHookUrl);
}
public void OnException(ExceptionContext filterContext)
{
_innerFilter.OnException(filterContext);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using WebHooks = Slack.Webhooks;
namespace Pelasoft.AspNet.Mvc.Slack
{
/// <summary>
/// Defines an action filter that logs thrown exceptions to a Slack channel.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class WebHookErrorReportAttribute : FilterAttribute, IWebHookErrorReporter, IExceptionFilter
{
private readonly WebHookErrorReportFilter _innerFilter;
/// <summary>
/// The slack web hook URL.
/// </summary>
public string WebhookUrl
{
get { return _innerFilter.WebhookUrl; }
set { _innerFilter.WebhookUrl = value; }
}
/// <summary>
/// The slack channel name to which exception reports are posted.
/// Optional; the web hook default channel will be used if not specified.
/// </summary>
public string ChannelName
{
get { return _innerFilter.ChannelName; }
set { _innerFilter.ChannelName = value; }
}
/// <summary>
/// The username the error messages will post ask.
/// Optional; the web hook default username will be used if not specified.
/// </summary>
public string UserName
{
get { return _innerFilter.UserName; }
set { _innerFilter.UserName = value; }
}
public bool IgnoreHandled
{
get { return _innerFilter.IgnoreHandled; }
set { _innerFilter.IgnoreHandled = value; }
}
/// <summary>
/// The types of the exceptions to ignore. Use this to cut down on unecessary channel chatter.
/// This list will be ignored if <see cref="ExceptionType"/> is specified.
/// </summary>
public Type[] ExcludeExceptionTypes
{
get { return _innerFilter.ExcludeExceptionTypes; }
set { _innerFilter.ExcludeExceptionTypes = value; }
}
/// <summary>
/// Creates a new instance of the exception filter for the specified <paramref name="webHookUrl"/>.
/// </summary>
/// <param name="exceptionType">The exception type to handle.</param>
public WebHookErrorReportAttribute(string webHookUrl)
{
_innerFilter = new WebHookErrorReportFilter(webHookUrl);
}
public void OnException(ExceptionContext filterContext)
{
_innerFilter.OnException(filterContext);
}
}
}
|
mit
|
C#
|
356c83c3835217a8815f0b8c6cc812677f1ebb99
|
add registration for validators
|
jarocki76/SimpleCQS.Autofac
|
src/SimpleCQS.Autofac/ContainerBuilderSimpleCQSExtensions.cs
|
src/SimpleCQS.Autofac/ContainerBuilderSimpleCQSExtensions.cs
|
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Autofac;
using FluentValidation;
using SimpleCQS.Command;
using SimpleCQS.Command.Validation;
using SimpleCQS.Query;
namespace SimpleCQS.Autofac
{
[ExcludeFromCodeCoverage]
public static class ContainerBuilderSimpleCQSExtensions
{
public static void RegisterSimpleCQS(this ContainerBuilder builder, Assembly[] assemblies)
{
builder.RegisterComponentContextResolveAsFunc();
builder.RegisterType<ValidationProcessor>().As<IValidationProcessor>().SingleInstance();
const string name = "Dispatcher";
builder.RegisterType<CommandDispatcher>().Named<ICommandDispatcher>(name).SingleInstance();
builder.RegisterDecorator<ICommandDispatcher>(
(c, inner) => new ValidatedCommandDispatcher(inner, c.Resolve<IValidationProcessor>()), name).SingleInstance();
builder.RegisterType<CommandExecutor>().As<ICommandExecutor>().SingleInstance();
builder.RegisterType<QueryExecutor>().As<IQueryExecutor>().SingleInstance();
builder.RegisterAssemblyTypes(assemblies).AsClosedTypesOf(typeof(ICommandHandler<>));
builder.RegisterAssemblyTypes(assemblies).As(typeof(IValidator)).SingleInstance();
}
}
}
|
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Autofac;
using SimpleCQS.Command;
using SimpleCQS.Command.Validation;
using SimpleCQS.Query;
namespace SimpleCQS.Autofac
{
[ExcludeFromCodeCoverage]
public static class ContainerBuilderSimpleCQSExtensions
{
public static void RegisterSimpleCQS(this ContainerBuilder builder, Assembly[] assemblies)
{
builder.RegisterComponentContextResolveAsFunc();
builder.RegisterType<ValidationProcessor>().As<IValidationProcessor>().SingleInstance();
const string name = "Dispatcher";
builder.RegisterType<CommandDispatcher>().Named<ICommandDispatcher>(name).SingleInstance();
builder.RegisterDecorator<ICommandDispatcher>(
(c, inner) => new ValidatedCommandDispatcher(inner, c.Resolve<IValidationProcessor>()), name).SingleInstance();
builder.RegisterType<CommandExecutor>().As<ICommandExecutor>().SingleInstance();
builder.RegisterType<QueryExecutor>().As<IQueryExecutor>().SingleInstance();
builder.RegisterAssemblyTypes(assemblies).AsClosedTypesOf(typeof(ICommandHandler<>));
}
}
}
|
apache-2.0
|
C#
|
c9d504e4fcf36e42cf90b19528e4b1cedaee441e
|
Fix BDL failure during headless runs
|
ZLima12/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework
|
osu.Framework/Testing/DrawFrameRecordingContainer.cs
|
osu.Framework/Testing/DrawFrameRecordingContainer.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Testing
{
internal class DrawFrameRecordingContainer : Container
{
private readonly Bindable<TestBrowser.PlaybackState> playback = new Bindable<TestBrowser.PlaybackState>();
private readonly BindableInt currentFrame = new BindableInt();
private readonly List<DrawNode> recordedFrames = new List<DrawNode>();
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] TestBrowser.PlaybackBindable playback, [CanBeNull] TestBrowser.FrameBindable currentFrame)
{
if (playback != null)
this.playback.BindTo(playback);
if (currentFrame != null)
this.currentFrame.BindTo(currentFrame);
}
protected override bool CanBeFlattened => false;
internal override DrawNode GenerateDrawNodeSubtree(ulong frame, int treeIndex, bool forceNewDrawNode)
{
switch (playback.Value)
{
default:
case TestBrowser.PlaybackState.Normal:
recordedFrames.Clear();
currentFrame.Value = currentFrame.MaxValue = 0;
return base.GenerateDrawNodeSubtree(frame, treeIndex, forceNewDrawNode);
case TestBrowser.PlaybackState.Recording:
var node = base.GenerateDrawNodeSubtree(frame, treeIndex, true);
recordedFrames.Add(node);
currentFrame.Value = currentFrame.MaxValue = recordedFrames.Count - 1;
return node;
case TestBrowser.PlaybackState.Stopped:
return recordedFrames[currentFrame.Value];
}
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Testing
{
internal class DrawFrameRecordingContainer : Container
{
private readonly Bindable<TestBrowser.PlaybackState> playback = new Bindable<TestBrowser.PlaybackState>();
private readonly BindableInt currentFrame = new BindableInt();
private readonly List<DrawNode> recordedFrames = new List<DrawNode>();
[BackgroundDependencyLoader]
private void load(TestBrowser.PlaybackBindable playback, TestBrowser.FrameBindable currentFrame)
{
this.playback.BindTo(playback);
this.currentFrame.BindTo(currentFrame);
}
protected override bool CanBeFlattened => false;
internal override DrawNode GenerateDrawNodeSubtree(ulong frame, int treeIndex, bool forceNewDrawNode)
{
switch (playback.Value)
{
default:
case TestBrowser.PlaybackState.Normal:
recordedFrames.Clear();
currentFrame.Value = currentFrame.MaxValue = 0;
return base.GenerateDrawNodeSubtree(frame, treeIndex, forceNewDrawNode);
case TestBrowser.PlaybackState.Recording:
var node = base.GenerateDrawNodeSubtree(frame, treeIndex, true);
recordedFrames.Add(node);
currentFrame.Value = currentFrame.MaxValue = recordedFrames.Count - 1;
return node;
case TestBrowser.PlaybackState.Stopped:
return recordedFrames[currentFrame.Value];
}
}
}
}
|
mit
|
C#
|
80dcfb8b8c90a6de6efbd3640955163b5726e88a
|
Remove some locking
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi/Models/ObservableConcurrentHashSet.cs
|
WalletWasabi/Models/ObservableConcurrentHashSet.cs
|
using ConcurrentCollections;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
namespace WalletWasabi.Models
{
public class ObservableConcurrentHashSet<T> : IReadOnlyCollection<T> // DO NOT IMPLEMENT INotifyCollectionChanged!!! That'll break and crash the software: https://github.com/AvaloniaUI/Avalonia/issues/1988#issuecomment-431691863
{
private ConcurrentHashSet<T> Set { get; }
private object Lock { get; }
public event EventHandler HashSetChanged; // Keep it as is! Unless with the modification this bug won't come out: https://github.com/AvaloniaUI/Avalonia/issues/1988#issuecomment-431691863
public ObservableConcurrentHashSet()
{
Set = new ConcurrentHashSet<T>();
Lock = new object();
}
// Don't lock here, it results deadlock at wallet loading when filters arent synced.
public int Count => Set.Count;
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
// Don't lock here, it results deadlock at wallet loading when filters arent synced.
public IEnumerator<T> GetEnumerator() => Set.GetEnumerator();
public bool TryAdd(T item)
{
lock (Lock)
{
if (Set.Add(item))
{
HashSetChanged?.Invoke(this, EventArgs.Empty);
return true;
}
return false;
}
}
public bool TryRemove(T item)
{
lock (Lock)
{
if (Set.TryRemove(item))
{
HashSetChanged?.Invoke(this, EventArgs.Empty);
return true;
}
return false;
}
}
public void Clear()
{
lock (Lock)
{
if (Set.Count > 0)
{
Set.Clear();
HashSetChanged?.Invoke(this, EventArgs.Empty);
}
}
}
// Don't lock here, it results deadlock at wallet loading when filters arent synced.
public bool Contains(T item) => Set.Contains(item);
}
}
|
using ConcurrentCollections;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
namespace WalletWasabi.Models
{
public class ObservableConcurrentHashSet<T> : IReadOnlyCollection<T> // DO NOT IMPLEMENT INotifyCollectionChanged!!! That'll break and crash the software: https://github.com/AvaloniaUI/Avalonia/issues/1988#issuecomment-431691863
{
private ConcurrentHashSet<T> Set { get; }
private object Lock { get; }
public event EventHandler HashSetChanged; // Keep it as is! Unless with the modification this bug won't come out: https://github.com/AvaloniaUI/Avalonia/issues/1988#issuecomment-431691863
public ObservableConcurrentHashSet()
{
Set = new ConcurrentHashSet<T>();
Lock = new object();
}
public int Count
{
get
{
lock (Lock)
{
return Set.Count;
}
}
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public IEnumerator<T> GetEnumerator()
{
lock (Lock)
{
return Set.GetEnumerator();
}
}
public bool TryAdd(T item)
{
lock (Lock)
{
if (Set.Add(item))
{
HashSetChanged?.Invoke(this, EventArgs.Empty);
return true;
}
return false;
}
}
public bool TryRemove(T item)
{
lock (Lock)
{
if (Set.TryRemove(item))
{
HashSetChanged?.Invoke(this, EventArgs.Empty);
return true;
}
return false;
}
}
public void Clear()
{
lock (Lock)
{
if (Set.Count > 0)
{
Set.Clear();
HashSetChanged?.Invoke(this, EventArgs.Empty);
}
}
}
public bool Contains(T item)
{
lock (Lock)
{
return Set.Contains(item);
}
}
}
}
|
mit
|
C#
|
8c5b61d3e1599514d36601d7c5f79a6657377ea5
|
Remove unused constructor.
|
izrik/ChamberLib,izrik/ChamberLib,izrik/ChamberLib
|
ChamberLib.OpenTK/Song.cs
|
ChamberLib.OpenTK/Song.cs
|
using System;
using System.IO;
namespace ChamberLib
{
public class Song : ISong
{
public Song(SoundEffect soundEffect)
{
if (soundEffect == null) throw new ArgumentNullException("soundEffect");
this.soundEffect = soundEffect;
}
readonly SoundEffect soundEffect;
public string Name { get { return soundEffect.Name; } }
public void Play()
{
if (soundEffect != null)
{
soundEffect.Play();
}
}
public void Play(int source)
{
if (soundEffect != null)
{
soundEffect.Play(source);
}
}
}
}
|
using System;
using System.IO;
namespace ChamberLib
{
public class Song : ISong
{
public Song(string name, Stream stream, SoundEffect.FileFormat format)
: this(SoundEffect.Create(name, stream, format))
{
}
public Song(SoundEffect soundEffect)
{
if (soundEffect == null) throw new ArgumentNullException("soundEffect");
this.soundEffect = soundEffect;
}
readonly SoundEffect soundEffect;
public string Name { get { return soundEffect.Name; } }
public void Play()
{
if (soundEffect != null)
{
soundEffect.Play();
}
}
public void Play(int source)
{
if (soundEffect != null)
{
soundEffect.Play(source);
}
}
}
}
|
lgpl-2.1
|
C#
|
6f31c31aee5401d087863c60ae81efcdb578b084
|
Set forced_root_block property to false in _EditorSetup partial view.
|
Talagozis/Talagozis.Website,Talagozis/Talagozis.Website,Talagozis/Talagozis.Website
|
Talagozis.Website/Areas/Manager/Views/Shared/Partial/_EditorSetup.cshtml
|
Talagozis.Website/Areas/Manager/Views/Shared/Partial/_EditorSetup.cshtml
|
<script type="text/javascript">
function addFormEditor(selector) {
tinymce.init({
selector: selector,
menubar: false,
branding: false,
convert_urls: false,
forced_root_block: false,
plugins: [
"autoresize autolink code hr paste lists piranhaimage piranhalink"
],
width: "100%",
height: "300",
autoresize_min_height: 340,
content_css: ["//fonts.googleapis.com/css?family=Gentium+Book+Basic:700", "//fonts.googleapis.com/css?family=Open+Sans:300,400,600", "@Url.Content("~/manager/assets/css/editor.min.css")"],
toolbar: "bold italic | bullist numlist hr | alignleft aligncenter alignright | formatselect | piranhalink piranhaimage | code",
block_formats: 'Paragraph=p;Header 1=h1;Header 2=h2;Header 3=h3;Header 4=h4;Code=pre;Quote=blockquote',
setup: function (editor) {
editor.on('change', function () {
editor.save();
});
}
});
}
function addInlineEditor(selector) {
tinymce.init({
selector: selector,
menubar: false,
branding: false,
statusbar: false,
inline: true,
convert_urls: false,
forced_root_block: false,
plugins: [
"autoresize autolink code hr paste lists piranhaimage piranhalink"
],
width: "100%",
autoresize_min_height: 0,
toolbar: "bold italic | bullist numlist hr | alignleft aligncenter alignright | formatselect | piranhalink piranhaimage | code",
block_formats: 'Paragraph=p;Header 1=h1;Header 2=h2;Header 3=h3;Header 4=h4;Code=pre;Quote=blockquote',
code_dialog_width: 1200
});
}
addFormEditor('textarea.editor');
addInlineEditor('div.block-editor');
</script>
|
<script type="text/javascript">
function addFormEditor(selector) {
tinymce.init({
selector: selector,
menubar: false,
branding: false,
convert_urls: false,
plugins: [
"autoresize autolink code hr paste lists piranhaimage piranhalink"
],
width: "100%",
height: "300",
autoresize_min_height: 340,
content_css: ["//fonts.googleapis.com/css?family=Gentium+Book+Basic:700", "//fonts.googleapis.com/css?family=Open+Sans:300,400,600", "@Url.Content("~/manager/assets/css/editor.min.css")"],
toolbar: "bold italic | bullist numlist hr | alignleft aligncenter alignright | formatselect | piranhalink piranhaimage | code",
block_formats: 'Paragraph=p;Header 1=h1;Header 2=h2;Header 3=h3;Header 4=h4;Code=pre;Quote=blockquote',
setup: function (editor) {
editor.on('change', function () {
editor.save();
});
}
});
}
function addInlineEditor(selector) {
tinymce.init({
selector: selector,
menubar: false,
branding: false,
statusbar: false,
inline: true,
convert_urls: false,
plugins: [
"autoresize autolink code hr paste lists piranhaimage piranhalink"
],
width: "100%",
autoresize_min_height: 0,
toolbar: "bold italic | bullist numlist hr | alignleft aligncenter alignright | formatselect | piranhalink piranhaimage | code",
block_formats: 'Paragraph=p;Header 1=h1;Header 2=h2;Header 3=h3;Header 4=h4;Code=pre;Quote=blockquote',
code_dialog_width: 1200
});
}
addFormEditor('textarea.editor');
addInlineEditor('div.block-editor');
</script>
|
mit
|
C#
|
6182ddfedbc5383ae3bf950acb2f25507a49d906
|
Update WorkOrder_MenuFunctions.cs
|
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
|
Test/AdventureWorksFunctionalModel/Production/WorkOrder_MenuFunctions.cs
|
Test/AdventureWorksFunctionalModel/Production/WorkOrder_MenuFunctions.cs
|
// Copyright Naked Objects Group Ltd, 45 Station Road, Henley on Thames, UK, RG9 1AT
// 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.Linq;
using NakedFunctions;
using AW.Types;
using static AW.Helpers;
using System;
namespace AW.Functions
{
[Named("Work Orders")]
public static class WorkOrder_MenuFunctions
{
public static WorkOrder RandomWorkOrder(IContext context) =>
Random<WorkOrder>(context);
[CreateNew]
public static (WorkOrder, IContext context) CreateNewWorkOrder(
[DescribedAs("product partial name")] Product product,
int orderQty,
DateTime startDate,
IContext context)
{
var wo = new WorkOrder()
{
ProductID = product.ProductID,
OrderQty = orderQty,
ScrappedQty = 0,
StartDate = startDate,
DueDate = startDate.AddDays(7),
ModifiedDate = context.Now()
};
return (wo, context.WithNew(wo));
}
[PageSize(20)]
public static IQueryable<Product> AutoComplete0CreateNewWorkOrder(
[MinLength(2)] string name, IContext context) =>
Product_MenuFunctions.FindProductByName(name, context);
public static IQueryable<Location> AllLocations(IContext context) => context.Instances<Location>();
#region ListWorkOrders
[TableView(true, "Product", "OrderQty", "StartDate")]
public static IQueryable<WorkOrder> ListWorkOrders(
Product product, [DefaultValue(true)] bool currentOrdersOnly, IContext context) =>
context.Instances<WorkOrder>().Where(x => x.Product.ProductID == product.ProductID &&
(currentOrdersOnly == false || x.EndDate == null));
[PageSize(20)]
public static IQueryable<Product> AutoComplete0ListWorkOrders(
[MinLength(2)] string name, IContext context) =>
Product_MenuFunctions.FindProductByName(name, context);
#endregion
}
}
|
// Copyright Naked Objects Group Ltd, 45 Station Road, Henley on Thames, UK, RG9 1AT
// 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.Linq;
using NakedFunctions;
using AW.Types;
using static AW.Helpers;
using System;
namespace AW.Functions
{
[Named("Work Orders")]
public static class WorkOrder_MenuFunctions
{
public static WorkOrder RandomWorkOrder(IContext context) =>
Random<WorkOrder>(context);
public static (WorkOrder, IContext context) CreateNewWorkOrder(
[DescribedAs("product partial name")] Product product,
int orderQty,
DateTime startDate,
IContext context)
{
var wo = new WorkOrder()
{
ProductID = product.ProductID,
OrderQty = orderQty,
ScrappedQty = 0,
StartDate = startDate,
DueDate = startDate.AddDays(7),
ModifiedDate = context.Now()
};
return (wo, context.WithNew(wo));
}
[PageSize(20)]
public static IQueryable<Product> AutoComplete0CreateNewWorkOrder(
[MinLength(2)] string name, IContext context) =>
Product_MenuFunctions.FindProductByName(name, context);
public static IQueryable<Location> AllLocations(IContext context) => context.Instances<Location>();
#region ListWorkOrders
[TableView(true, "Product", "OrderQty", "StartDate")]
public static IQueryable<WorkOrder> ListWorkOrders(
Product product, [DefaultValue(true)] bool currentOrdersOnly, IContext context) =>
context.Instances<WorkOrder>().Where(x => x.Product.ProductID == product.ProductID &&
(currentOrdersOnly == false || x.EndDate == null));
[PageSize(20)]
public static IQueryable<Product> AutoComplete0ListWorkOrders(
[MinLength(2)] string name, IContext context) =>
Product_MenuFunctions.FindProductByName(name, context);
#endregion
}
}
|
apache-2.0
|
C#
|
b63f09fbfd7790924171b086175150cfa564e674
|
Tweak format on qual list
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
BatteryCommander.Web/Views/Qualification/List.cshtml
|
BatteryCommander.Web/Views/Qualification/List.cshtml
|
@model IEnumerable<BatteryCommander.Common.Models.Qualification>
@using BatteryCommander.Common.Models;
@{
ViewBag.Title = "Qualifications";
}
<h2>@ViewBag.Title @Html.ActionLink("Add New", "New", null, new { @class = "btn btn-primary" })</h2>
<table class="table table-bordered">
<tr>
<th> @Html.DisplayNameFor(model => model.Name)</th>
<th> @Html.DisplayNameFor(model => model.Description)</th>
<th>GO</th>
<th>NOGO</th>
<th>UNKNOWN</th>
<th>Tasks</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.Name)</td>
<td>@Html.DisplayFor(modelItem => item.Description)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Pass)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Fail)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Unknown)</td>
<td>
@foreach (var task in item.Tasks)
{
<li>@Html.DisplayFor(t => task)</li>
}
</td>
<td>
@Html.ActionLink("View", "View", new { qualificationId = item.Id }, new { @class = "btn btn-default" })
<a href="~/Qualification/@item.Id/Update" class="btn btn-warning">Bulk Update Soldiers</a>
</td>
</tr>
}
</table>
|
@model IEnumerable<BatteryCommander.Common.Models.Qualification>
@using BatteryCommander.Common.Models;
@{
ViewBag.Title = "Qualifications";
}
<h2>@ViewBag.Title</h2>
<p>
@Html.ActionLink("Add New", "New", null, new { @class = "btn btn-primary" })
</p>
<table class="table table-bordered">
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>GO</th>
<th>NOGO</th>
<th>UNKNOWN</th>
<th>Tasks</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.Name)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Pass)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Fail)</td>
<td>@item.SoldierQualifications.Count(q => q.Status == QualificationStatus.Unknown)</td>
<td>
@foreach (var task in item.Tasks)
{
<li>@Html.DisplayFor(t => task)</li>
}
</td>
<td>
@Html.ActionLink("View", "View", new { qualificationId = item.Id }, new { @class = "btn btn-default" })
<a href="~/Qualification/@item.Id/Update" class="btn btn-warning">Bulk Update Soldiers</a>
</td>
</tr>
}
</table>
|
mit
|
C#
|
3aaf2c6255945841c443c07bb0c80cce5604a59a
|
Create server side API for single multiple answer question
|
Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist
|
Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs
|
Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs
|
using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRepository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SaveChanges();
}
/// <summary>
/// Add option of single multiple answer question into SingleMultipleAnswerQuestionOption model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
public void AddSingleMultipleAnswerQuestionOption(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOption);
_dbContext.SaveChanges();
}
}
}
|
using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRepository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var questions = _dbContext.SingleMultipleAnswerQuestion.ToList();
return questions;
}
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SaveChanges();
}
/// <summary>
/// Add option of single multiple answer question into SingleMultipleAnswerQuestionOption model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
public void AddSingleMultipleAnswerQuestionOption(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOption);
_dbContext.SaveChanges();
}
}
}
|
mit
|
C#
|
8ff6fd987e00bc44f654c718e3754010e662da11
|
Fix copyright
|
nunit/nunit3-vs-adapter
|
src/NUnit3TestAdapterInstall/Properties/AssemblyInfo.cs
|
src/NUnit3TestAdapterInstall/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("NUnit3TestAdapterInstall")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NUnit3TestAdapterInstall")]
[assembly: AssemblyCopyright("Copyright © 2011-2016, Charlie Poole")]
[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")]
|
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("NUnit3TestAdapterInstall")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NUnit3TestAdapterInstall")]
[assembly: AssemblyCopyright("Copyright © 2011-2016, NUnit Software")]
[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")]
|
mit
|
C#
|
cf3a0f1b9d5352dbeb4fa745545b615df89293c6
|
Sort using directives
|
nabychan/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,jtbm37/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,nabychan/omnisharp-roslyn,jtbm37/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,hal-ler/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,hal-ler/omnisharp-roslyn
|
src/OmniSharp.DotNet/Models/DotNetProjectInformation.cs
|
src/OmniSharp.DotNet/Models/DotNetProjectInformation.cs
|
using System.Collections.Generic;
using Microsoft.DotNet.ProjectModel;
namespace OmniSharp.DotNet.Models
{
internal class DotNetProjectInformation
{
public DotNetProjectInformation(ProjectContext projectContext, string configuration, bool includeSourceFiles = false)
{
this.Path = projectContext.RootProject.Path;
this.Name = projectContext.ProjectFile.Name;
var outputPaths = projectContext.GetOutputPaths(configuration);
this.CompilationOutputPath = outputPaths.CompilationOutputPath;
this.CompilationOutputAssemblyFile = outputPaths.CompilationFiles.Assembly;
this.CompilationOutputPdbFile = outputPaths.CompilationFiles.PdbPath;
var sourceFiles = new List<string>();
if (includeSourceFiles)
{
sourceFiles.AddRange(projectContext.ProjectFile.Files.SourceFiles);
}
this.SourceFiles = sourceFiles;
}
public string Path { get; }
public string Name { get; }
public string CompilationOutputPath { get; }
public string CompilationOutputAssemblyFile { get; }
public string CompilationOutputPdbFile { get; }
public IReadOnlyList<string> SourceFiles { get; }
//public DotNetProjectInformation(string projectPath, ProjectInformation info)
//{
// Path = projectPath;
// Name = info.Name;
// Commands = info.Commands;
// Configurations = info.Configurations;
// ProjectSearchPaths = info.ProjectSearchPaths;
// Frameworks = info.Frameworks.Select(framework => new DotNetFramework(framework));
// GlobalJsonPath = info.GlobalJsonPath;
//}
//public IDictionary<string, string> Commands { get; }
//public IEnumerable<string> Configurations { get; }
//public IEnumerable<string> ProjectSearchPaths { get; }
//public IEnumerable<DotNetFramework> Frameworks { get; }
//public string GlobalJsonPath { get; }
}
}
|
using Microsoft.DotNet.ProjectModel;
using System.Collections.Generic;
namespace OmniSharp.DotNet.Models
{
internal class DotNetProjectInformation
{
public DotNetProjectInformation(ProjectContext projectContext, string configuration, bool includeSourceFiles = false)
{
this.Path = projectContext.RootProject.Path;
this.Name = projectContext.ProjectFile.Name;
this.CompilationOutputPath = projectContext.GetOutputPaths(configuration).CompilationOutputPath;
var sourceFiles = new List<string>();
if (includeSourceFiles)
{
sourceFiles.AddRange(projectContext.ProjectFile.Files.SourceFiles);
}
this.SourceFiles = sourceFiles;
}
public string Path { get; }
public string Name { get; }
public string CompilationOutputPath { get; }
public IReadOnlyList<string> SourceFiles { get; }
//public DotNetProjectInformation(string projectPath, ProjectInformation info)
//{
// Path = projectPath;
// Name = info.Name;
// Commands = info.Commands;
// Configurations = info.Configurations;
// ProjectSearchPaths = info.ProjectSearchPaths;
// Frameworks = info.Frameworks.Select(framework => new DotNetFramework(framework));
// GlobalJsonPath = info.GlobalJsonPath;
//}
//public IDictionary<string, string> Commands { get; }
//public IEnumerable<string> Configurations { get; }
//public IEnumerable<string> ProjectSearchPaths { get; }
//public IEnumerable<DotNetFramework> Frameworks { get; }
//public string GlobalJsonPath { get; }
}
}
|
mit
|
C#
|
6915fe85ef7676da171bfad173cffc4aded426af
|
Fix Areas property is not deserialized, In the return value of the GetRichMenuListAsync method.
|
pierre3/LineMessagingApi,pierre3/LineMessagingApi
|
Line.Messaging/Messages/RichMenu/ResponseRichMenu.cs
|
Line.Messaging/Messages/RichMenu/ResponseRichMenu.cs
|
namespace Line.Messaging
{
/// <summary>
/// Rich menu response object.
/// https://developers.line.me/en/docs/messaging-api/reference/#rich-menu-response-object
/// </summary>
public class ResponseRichMenu : RichMenu
{
/// <summary>
/// Rich menu ID
/// </summary>
public string RichMenuId { get; set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="richMenuId">
/// Rich menu ID
/// </param>
/// <param name="source">
/// Rich menu object
/// </param>
public ResponseRichMenu(string richMenuId, RichMenu source)
{
RichMenuId = richMenuId;
Size = source.Size;
Selected = source.Selected;
Name = source.Name;
ChatBarText = source.ChatBarText;
Areas = source.Areas;
}
internal static ResponseRichMenu CreateFrom(dynamic dynamicObject)
{
var menu = new RichMenu()
{
Name = (string)dynamicObject?.name,
Size = new ImagemapSize((int)(dynamicObject?.size?.width ?? 0), (int)(dynamicObject?.size?.height ?? 0)),
Selected = (bool)(dynamicObject?.selected ?? false),
ChatBarText = (string)dynamicObject?.chatBarText,
Areas = ActionArea.CreateFrom(dynamicObject?.areas)
};
return new ResponseRichMenu((string)dynamicObject?.richMenuId, menu);
}
}
}
|
namespace Line.Messaging
{
/// <summary>
/// Rich menu response object.
/// https://developers.line.me/en/docs/messaging-api/reference/#rich-menu-response-object
/// </summary>
public class ResponseRichMenu : RichMenu
{
/// <summary>
/// Rich menu ID
/// </summary>
public string RichMenuId { get; set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="richMenuId">
/// Rich menu ID
/// </param>
/// <param name="source">
/// Rich menu object
/// </param>
public ResponseRichMenu(string richMenuId, RichMenu source)
{
RichMenuId = richMenuId;
Size = source.Size;
Selected = source.Selected;
Name = source.Name;
ChatBarText = source.ChatBarText;
Areas = source.Areas;
}
internal static ResponseRichMenu CreateFrom(dynamic dynamicObject)
{
var menu = new RichMenu()
{
Name = (string)dynamicObject?.name,
Size = new ImagemapSize((int)(dynamicObject?.size?.width ?? 0), (int)(dynamicObject?.size?.height ?? 0)),
Selected = (bool)(dynamicObject?.selected ?? false),
ChatBarText = (string)dynamicObject?.chatBarText
};
return new ResponseRichMenu((string)dynamicObject?.richMenuId, menu);
}
}
}
|
mit
|
C#
|
a86ebccf5c478c5d76d3e4e3385e0f68f22f4903
|
Patch out the Tracescope for as far as possible when applicable.
|
bartwe/StaxelTraceViewer
|
Staxel.Trace/TraceScope.cs
|
Staxel.Trace/TraceScope.cs
|
using System;
using System.Diagnostics;
using System.Runtime;
using System.Runtime.CompilerServices;
namespace Staxel.Trace {
public struct TraceScope : IDisposable {
public TraceKey Key;
[TargetedPatchingOptOut("")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public TraceScope(TraceKey key) {
Key = key;
TraceRecorder.Enter(Key);
}
[Conditional("TRACE")]
[TargetedPatchingOptOut("")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Dispose() {
TraceRecorder.Leave(Key);
}
}
}
|
using System;
namespace Staxel.Trace {
public struct TraceScope : IDisposable {
public TraceKey Key;
public TraceScope(TraceKey key) {
Key = key;
TraceRecorder.Enter(Key);
}
public void Dispose() {
TraceRecorder.Leave(Key);
}
}
}
|
unlicense
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.