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 |
|---|---|---|---|---|---|---|---|---|
180d33d2c54d959d619b97e9b0c648a6a407bcd0 | Make a graphics device available to the content manager. | izrik/ChamberLib,izrik/ChamberLib,izrik/ChamberLib | ChamberLib.MonoGame/ContentManager.cs | ChamberLib.MonoGame/ContentManager.cs | using System;
using XContentManager = Microsoft.Xna.Framework.Content.ContentManager;
using XTexture2D = Microsoft.Xna.Framework.Graphics.Texture2D;
using XModel = Microsoft.Xna.Framework.Graphics.Model;
using XDevice = Microsoft.Xna.Framework.Graphics.GraphicsDevice;
namespace ChamberLib
{
public class ContentManager : IContentManager
{
public ContentManager(XDevice device, XContentManager manager, string rootDirectory=null)
{
if (manager == null)
throw new ArgumentNullException("manager");
Device = device;
Manager = manager;
if (rootDirectory != null)
{
Manager.RootDirectory = rootDirectory;
}
}
public XDevice Device;
public XContentManager Manager;
public T Load<T>(string name)
{
if (typeof(T) == typeof(IModel))
{
return (T)LoadModel(name);
}
if (typeof(T) == typeof(ITexture2D))
{
return (T)LoadTexture2D(name);
}
return Manager.Load<T>(name);
}
public IModel LoadModel(string name)
{
return ModelAdapter.GetAdapter(Manager.Load<XModel>(name));
}
public ITexture2D LoadTexture2D(string name)
{
return Texture2DAdapter.GetAdapter(Manager.Load<XTexture2D>(name));
}
public IFont LoadFont(string name)
{
return SpriteFontAdapter.GetAdapter(Manager.Load<Microsoft.Xna.Framework.Graphics.SpriteFont>(name));
}
public ISong LoadSong(string name)
{
return SongAdapter.GetAdapter(Manager.Load<Microsoft.Xna.Framework.Media.Song>(name));
}
public ISoundEffect LoadSoundEffect(string name)
{
return SoundEffectAdapter.GetAdapter(Manager.Load<Microsoft.Xna.Framework.Audio.SoundEffect>(name));
}
}
}
| using System;
using XContentManager = Microsoft.Xna.Framework.Content.ContentManager;
using XTexture2D = Microsoft.Xna.Framework.Graphics.Texture2D;
using XModel = Microsoft.Xna.Framework.Graphics.Model;
namespace ChamberLib
{
public class ContentManager : IContentManager
{
public ContentManager(XContentManager manager, string rootDirectory=null)
{
if (manager == null)
throw new ArgumentNullException("manager");
Manager = manager;
if (rootDirectory != null)
{
Manager.RootDirectory = rootDirectory;
}
}
public XContentManager Manager;
public T Load<T>(string name)
{
if (typeof(T) == typeof(IModel))
{
return (T)LoadModel(name);
}
if (typeof(T) == typeof(ITexture2D))
{
return (T)LoadTexture2D(name);
}
return Manager.Load<T>(name);
}
public IModel LoadModel(string name)
{
return ModelAdapter.GetAdapter(Manager.Load<XModel>(name));
}
public ITexture2D LoadTexture2D(string name)
{
return Texture2DAdapter.GetAdapter(Manager.Load<XTexture2D>(name));
}
public IFont LoadFont(string name)
{
return SpriteFontAdapter.GetAdapter(Manager.Load<Microsoft.Xna.Framework.Graphics.SpriteFont>(name));
}
public ISong LoadSong(string name)
{
return SongAdapter.GetAdapter(Manager.Load<Microsoft.Xna.Framework.Media.Song>(name));
}
public ISoundEffect LoadSoundEffect(string name)
{
return SoundEffectAdapter.GetAdapter(Manager.Load<Microsoft.Xna.Framework.Audio.SoundEffect>(name));
}
}
}
| lgpl-2.1 | C# |
c9383fc467e94b4125e0b5e2ab76942e05e017cb | bump version | alecgorge/adzerk-dot-net | Adzerk.Api/Properties/AssemblyInfo.cs | Adzerk.Api/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("Adzerk.Api")]
[assembly: AssemblyDescription("Unofficial Adzerk API client.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Stack Exchange")]
[assembly: AssemblyProduct("Adzerk.Api")]
[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("d05e1e25-d95d-43d6-a74b-3cb38492fa7e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.6")]
[assembly: AssemblyFileVersion("0.0.0.6")]
| 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("Adzerk.Api")]
[assembly: AssemblyDescription("Unofficial Adzerk API client.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Stack Exchange")]
[assembly: AssemblyProduct("Adzerk.Api")]
[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("d05e1e25-d95d-43d6-a74b-3cb38492fa7e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.5")]
[assembly: AssemblyFileVersion("0.0.0.5")]
| mit | C# |
4f7bfbf4510ed3694383fd5d2b1e476e4b5b1f0a | fix typo | btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver | BTCPayServer/Views/Server/_Nav.cshtml | BTCPayServer/Views/Server/_Nav.cshtml | <div class="nav flex-column nav-pills">
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Users)" asp-action="Users">Users</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Rates)" asp-action="Rates">Rates</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Emails)" asp-action="Emails">Email server</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Policies)" asp-action="Policies">Policies</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Services)" asp-action="Services">Services</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Theme)" asp-action="Theme">Theme</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Maintenance)" asp-action="Maintenance">Maintenance</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Hangfire)" href="~/hangfire" target="_blank">Hangfire</a>
</div>
| <div class="nav flex-column nav-pills">
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Users)" asp-action="Users">Users</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Rates)" asp-action="Rates">Rates</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Emails)" asp-action="Emails">Email server</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Policies)" asp-action="Policies">Policies</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Services)" asp-action="Services">Services</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Theme)" asp-action="Theme">Theme</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Maintainance)" asp-action="Maintenance">Maintenance</a>
<a class="nav-link @ViewData.IsActivePage(ServerNavPages.Hangfire)" href="~/hangfire" target="_blank">Hangfire</a>
</div>
| mit | C# |
13a2eb2ae7b2bb6f7fed3c6b78331b2dc8362e3b | Update DefaultDocumentTextDifferencingService.cs | weltkante/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,weltkante/roslyn,KevinRansom/roslyn,diryboy/roslyn,dotnet/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,AmadeusW/roslyn,mavasani/roslyn,AmadeusW/roslyn,physhi/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,diryboy/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,AmadeusW/roslyn,wvdd007/roslyn,sharwell/roslyn,dotnet/roslyn,wvdd007/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,sharwell/roslyn,mavasani/roslyn,physhi/roslyn,bartdesmet/roslyn | src/Workspaces/Core/Portable/LinkedFileDiffMerging/DefaultDocumentTextDifferencingService.cs | src/Workspaces/Core/Portable/LinkedFileDiffMerging/DefaultDocumentTextDifferencingService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis
{
[ExportWorkspaceService(typeof(IDocumentTextDifferencingService), ServiceLayer.Default), Shared]
internal class DefaultDocumentTextDifferencingService : IDocumentTextDifferencingService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DefaultDocumentTextDifferencingService()
{
}
public Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken)
=> GetTextChangesAsync(oldDocument, newDocument, TextDifferenceTypes.Word, cancellationToken);
public async Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, TextDifferenceTypes preferredDifferenceType, CancellationToken cancellationToken)
{
var changes = await newDocument.GetTextChangesAsync(oldDocument, cancellationToken).ConfigureAwait(false);
return changes.ToImmutableArray();
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis
{
[ExportWorkspaceService(typeof(IDocumentTextDifferencingService), ServiceLayer.Default), Shared]
internal class DefaultDocumentTextDifferencingService : IDocumentTextDifferencingService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public DefaultDocumentTextDifferencingService()
{
}
public Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken)
=> GetTextChangesAsync(oldDocument, newDocument, TextDifferenceTypes.Word, cancellationToken);
public async Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, TextDifferenceTypes preferredDifferenceType, CancellationToken cancellationToken)
{
var changes = await newDocument.GetTextChangesAsync(oldDocument, cancellationToken).ConfigureAwait(false);
return changes.ToImmutableArray();
}
}
}
| mit | C# |
de5f2d627f3ba9c882af5f80e6a5b6e40cc85242 | Fix test | bartdesmet/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,dotnet/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,dotnet/roslyn,mavasani/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn | src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/DocumentationCommentTests.cs | src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/DocumentationCommentTests.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.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Roslyn.VisualStudio.IntegrationTests;
using Xunit;
namespace Roslyn.VisualStudio.NewIntegrationTests.CSharp
{
[Trait(Traits.Feature, Traits.Features.DocumentationComments)]
public class DocumentationCommentTests : AbstractEditorTest
{
public DocumentationCommentTests()
: base(nameof(DocumentationCommentTests))
{
}
protected override string LanguageName => LanguageNames.CSharp;
[IdeFact]
[WorkItem(54391, "https://github.com/dotnet/roslyn/issues/54391")]
public async Task TypingCharacter_MultiCaret()
{
var code =
@"
//{|selection:|}
class C1 { }
//{|selection:|}
class C2 { }
//{|selection:|}
class C3 { }
";
await SetUpEditorAsync(code, HangMitigatingCancellationToken);
await TestServices.Input.SendAsync('/');
var expected =
@"
/// <summary>
/// $$
/// </summary>
class C1 { }
/// <summary>
///
/// </summary>
class C2 { }
/// <summary>
///
/// </summary>
class C3 { }
";
MarkupTestFile.GetPosition(expected, out expected, out int caretPosition);
await TestServices.EditorVerifier.TextContainsAsync(expected, cancellationToken: HangMitigatingCancellationToken);
await TestServices.EditorVerifier.CaretPositionAsync(caretPosition, HangMitigatingCancellationToken);
}
}
}
| // 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.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Roslyn.VisualStudio.IntegrationTests;
using Xunit;
namespace Roslyn.VisualStudio.NewIntegrationTests.CSharp
{
[Trait(Traits.Feature, Traits.Features.DocumentationComments)]
public class DocumentationCommentTests : AbstractEditorTest
{
public DocumentationCommentTests()
: base(nameof(DocumentationCommentTests))
{
}
protected override string LanguageName => LanguageNames.CSharp;
[IdeFact]
[WorkItem(54391, "https://github.com/dotnet/roslyn/issues/54391")]
public async Task TypingCharacter_MultiCaret()
{
var code =
@"
//$$[||]
class C1 { }
//[||]
class C2 { }
//[||]
class C3 { }
";
await SetUpEditorAsync(code, HangMitigatingCancellationToken);
await TestServices.Input.SendAsync('/');
var expected =
@"
/// <summary>
/// $$
/// </summary>
class C1 { }
/// <summary>
///
/// </summary>
class C2 { }
/// <summary>
///
/// </summary>
class C3 { }
";
await TestServices.EditorVerifier.TextContainsAsync(expected, cancellationToken: HangMitigatingCancellationToken);
}
}
}
| mit | C# |
ffed349838fcd0a2574f973052c9729396511353 | Build unsigned by default | inthehand/charming | SharedAssemblyInfo.cs | SharedAssemblyInfo.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.
#if WINDOWS_PHONE
[assembly: AssemblyConfiguration("Windows Phone 8.0")]
#elif WINDOWS_PHONE_81
[assembly: AssemblyConfiguration("Windows Phone Silverlight 8.1")]
#elif WINDOWS_PHONE_APP
[assembly: AssemblyConfiguration("Windows Phone 8.1")]
#elif __IOS__
[assembly: AssemblyConfiguration("Apple iOS")]
#elif __ANDROID__
[assembly: AssemblyConfiguration("Android")]
#elif WINDOWS_APP
[assembly: AssemblyConfiguration("Windows 8.1")]
#elif WINDOWS_UWP
[assembly: AssemblyConfiguration("Windows Universal")]
#else
[assembly: AssemblyConfiguration("Portable")]
#endif
[assembly: AssemblyProduct("Charming Apps")]
[assembly: AssemblyCompany("In The Hand Ltd")]
[assembly: AssemblyCopyright("Copyright © In The Hand Ltd 2013-15. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: System.CLSCompliant(true)]
// 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("9.0.0.0")]
[assembly: AssemblyFileVersion("9.2015.11.17")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
#if SIGNED
[assembly: AssemblyKeyFile("C:\\InTheHand.snk")]
#endif | 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.
#if WINDOWS_PHONE
[assembly: AssemblyConfiguration("Windows Phone 8.0")]
#elif WINDOWS_PHONE_81
[assembly: AssemblyConfiguration("Windows Phone Silverlight 8.1")]
#elif WINDOWS_PHONE_APP
[assembly: AssemblyConfiguration("Windows Phone 8.1")]
#elif __IOS__
[assembly: AssemblyConfiguration("Apple iOS")]
#elif __ANDROID__
[assembly: AssemblyConfiguration("Android")]
#elif WINDOWS_APP
[assembly: AssemblyConfiguration("Windows 8.1")]
#elif WINDOWS_UWP
[assembly: AssemblyConfiguration("Windows Universal")]
#else
[assembly: AssemblyConfiguration("Portable")]
#endif
[assembly: AssemblyProduct("Charming Apps")]
[assembly: AssemblyCompany("In The Hand Ltd")]
[assembly: AssemblyCopyright("Copyright © In The Hand Ltd 2013-15. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: System.CLSCompliant(true)]
// 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("9.0.0.0")]
[assembly: AssemblyFileVersion("9.2015.11.17")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: AssemblyKeyFile("C:\\InTheHand.snk")] | mit | C# |
bda83335596c162a9f95c605fb8e7de7dc2676a0 | Make AddConfigCommand implement ICommand | appharbor/appharbor-cli | src/AppHarbor.Tests/Commands/AddConfigCommand.cs | src/AppHarbor.Tests/Commands/AddConfigCommand.cs | using System;
namespace AppHarbor.Tests.Commands
{
public class AddConfigCommand : ICommand
{
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| namespace AppHarbor.Tests.Commands
{
public class AddConfigCommand
{
}
}
| mit | C# |
f1e66cc420ce69e133f08068fdc2c1affd3e02cd | Adjust test namespace | ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,smoogipooo/osu,ppy/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,ppy/osu,peppy/osu,peppy/osu-new | osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs | osu.Game.Tests/Visual/Editing/TestSceneEditorClock.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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Screens.Edit.Components;
using osuTK;
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneEditorClock : EditorClockTestScene
{
public TestSceneEditorClock()
{
Add(new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new TimeInfoContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(200, 100)
},
new PlaybackControl
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(200, 100)
}
}
});
}
[Test]
public void TestStopAtTrackEnd()
{
AddStep("Reset clock", () => Clock.Seek(0));
AddStep("Start clock", Clock.Start);
AddAssert("Clock running", () => Clock.IsRunning);
AddStep("Seek near end", () => Clock.Seek(Clock.TrackLength - 250));
AddUntilStep("Clock stops", () => !Clock.IsRunning);
AddAssert("Clock stopped at end", () => Clock.CurrentTime == Clock.TrackLength);
AddStep("Start clock again", Clock.Start);
AddAssert("Clock looped to start", () => Clock.IsRunning && Clock.CurrentTime < 500);
}
}
}
| // 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Screens.Edit.Components;
using osuTK;
namespace osu.Game.Tests.Visual.Editor
{
[TestFixture]
public class TestSceneEditorClock : EditorClockTestScene
{
public TestSceneEditorClock()
{
Add(new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new TimeInfoContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(200, 100)
},
new PlaybackControl
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(200, 100)
}
}
});
}
[Test]
public void TestStopAtTrackEnd()
{
AddStep("Reset clock", () => Clock.Seek(0));
AddStep("Start clock", Clock.Start);
AddAssert("Clock running", () => Clock.IsRunning);
AddStep("Seek near end", () => Clock.Seek(Clock.TrackLength - 250));
AddUntilStep("Clock stops", () => !Clock.IsRunning);
AddAssert("Clock stopped at end", () => Clock.CurrentTime == Clock.TrackLength);
AddStep("Start clock again", Clock.Start);
AddAssert("Clock looped to start", () => Clock.IsRunning && Clock.CurrentTime < 500);
}
}
}
| mit | C# |
40d823bf693da2a1af210b7b0e5f3d3218f7b717 | Use localised string for guest participation beatmaps header | peppy/osu,NeoAdonis/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu | osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs | osu.Game/Overlays/Profile/Sections/BeatmapsSection.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.Localisation;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Profile.Sections.Beatmaps;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Profile.Sections
{
public class BeatmapsSection : ProfileSection
{
public override LocalisableString Title => UsersStrings.ShowExtraBeatmapsTitle;
public override string Identifier => @"beatmaps";
public BeatmapsSection()
{
Children = new[]
{
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, UsersStrings.ShowExtraBeatmapsFavouriteTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Ranked, User, UsersStrings.ShowExtraBeatmapsRankedTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, UsersStrings.ShowExtraBeatmapsLovedTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Pending, User, UsersStrings.ShowExtraBeatmapsPendingTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Guest, User, UsersStrings.ShowExtraBeatmapsGuestTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, UsersStrings.ShowExtraBeatmapsGraveyardTitle)
};
}
}
}
| // 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.Localisation;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Profile.Sections.Beatmaps;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Profile.Sections
{
public class BeatmapsSection : ProfileSection
{
public override LocalisableString Title => UsersStrings.ShowExtraBeatmapsTitle;
public override string Identifier => @"beatmaps";
public BeatmapsSection()
{
Children = new[]
{
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, UsersStrings.ShowExtraBeatmapsFavouriteTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Ranked, User, UsersStrings.ShowExtraBeatmapsRankedTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, UsersStrings.ShowExtraBeatmapsLovedTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Pending, User, UsersStrings.ShowExtraBeatmapsPendingTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Guest, User, "Guest Participation Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, UsersStrings.ShowExtraBeatmapsGraveyardTitle)
};
}
}
}
| mit | C# |
1852311be73bcae3fd8bfba8078bbcded4497b1c | comment out debug info for fade manager | Magneseus/3x-eh | Assets/Scripts/Global/LoadingSceneManager.cs | Assets/Scripts/Global/LoadingSceneManager.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LoadingSceneManager : MonoBehaviour {
public Image loadingPic;
public AudioSource audioPlayer;
private bool isInTrans = false;
private float transition;
private bool isShowing = false;
private float duration;
private Color colorRecorder;
// Use this for initialization
void Start () {
colorRecorder = loadingPic.color;
Fade(false, 3f);
audioPlayer.Play();
}
// Update is called once per frame
void Update () {
if (!isInTrans) return;
// transition += isShowing ? Time.deltaTime / duration : -Time.deltaTime / duration;
transition = Time.deltaTime/duration;
loadingPic.color = Color.Lerp(loadingPic.color, colorRecorder, transition);
audioPlayer.volume += isShowing ? -Time.deltaTime / duration : Time.deltaTime / duration;
}
public void Fade(bool isShowing, float duration)
{
//Debug.Log("Fade is called");
this.isShowing = isShowing;
this.duration = duration;
isInTrans = true;
transition = isShowing ? 0 : 1;
colorRecorder.a = isShowing ? 1f : 0;
}
public bool getIsInTrans()
{
return isInTrans;
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LoadingSceneManager : MonoBehaviour {
public Image loadingPic;
public AudioSource audioPlayer;
private bool isInTrans = false;
private float transition;
private bool isShowing = false;
private float duration;
private Color colorRecorder;
// Use this for initialization
void Start () {
colorRecorder = loadingPic.color;
Fade(false, 3f);
audioPlayer.Play();
}
// Update is called once per frame
void Update () {
if (!isInTrans) return;
// transition += isShowing ? Time.deltaTime / duration : -Time.deltaTime / duration;
transition = Time.deltaTime/duration;
loadingPic.color = Color.Lerp(loadingPic.color, colorRecorder, transition);
audioPlayer.volume += isShowing ? -Time.deltaTime / duration : Time.deltaTime / duration;
}
public void Fade(bool isShowing, float duration)
{
Debug.Log("Fade is called");
this.isShowing = isShowing;
this.duration = duration;
isInTrans = true;
transition = isShowing ? 0 : 1;
colorRecorder.a = isShowing ? 1f : 0;
}
public bool getIsInTrans()
{
return isInTrans;
}
}
| mit | C# |
957fa89a9b86df9ed1a503c3a35f79457512ae5c | Update assembly version. | bestmike007/Beanstalkd.Client | Beanstalkd.Client/Properties/AssemblyInfo.cs | Beanstalkd.Client/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("Beanstalkd.Client")]
[assembly: AssemblyDescription("Yet another beanstalkd protocol 1.3 C# client")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Beanstalkd.Client")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f13ea829-93ef-40bb-9981-749fd0e9694a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Beanstalkd.Client")]
[assembly: AssemblyDescription("Yet another beanstalkd protocol 1.3 C# client")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Beanstalkd.Client")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f13ea829-93ef-40bb-9981-749fd0e9694a")]
// 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# |
544402e13218991ae54810cd47a332334ec3c47b | Add a timer and log to sms sending | mattgwagner/CertiPay.Common | CertiPay.Common/Notifications/ISMSService.cs | CertiPay.Common/Notifications/ISMSService.cs | using CertiPay.Common.Logging;
using System;
using System.Threading.Tasks;
using Twilio;
namespace CertiPay.Common.Notifications
{
/// <summary>
/// Send an SMS message to the given recipient.
/// </summary>
/// <remarks>
/// Implementation may be sent into background processing.
/// </remarks>
public interface ISMSService : INotificationSender<SMSNotification>
{
// Task SendAsync(T notification);
}
public class SmsService : ISMSService
{
private static readonly ILog Log = LogManager.GetLogger<ISMSService>();
private readonly String _twilioAccountSId;
private readonly String _twilioAuthToken;
private readonly String _twilioSourceNumber;
public SmsService(String twilioAccountSid, String twilioAuthToken, String twilioSourceNumber)
{
this._twilioAccountSId = twilioAccountSid;
this._twilioAuthToken = twilioAuthToken;
this._twilioSourceNumber = twilioSourceNumber;
}
public Task SendAsync(SMSNotification notification)
{
using (Log.Timer("SMSNotification.SendAsync"))
{
Log.Info("Sending SMSNotification {@Notification}", notification);
// TODO Add error handling
var client = new TwilioRestClient(_twilioAccountSId, _twilioAuthToken);
foreach (var recipient in notification.Recipients)
{
client.SendSmsMessage(_twilioSourceNumber, recipient, notification.Content);
}
return Task.FromResult(0);
}
}
}
} | using CertiPay.Common.Logging;
using System;
using System.Threading.Tasks;
using Twilio;
namespace CertiPay.Common.Notifications
{
/// <summary>
/// Send an SMS message to the given recipient.
/// </summary>
/// <remarks>
/// Implementation may be sent into background processing.
/// </remarks>
public interface ISMSService : INotificationSender<SMSNotification>
{
// Task SendAsync(T notification);
}
public class SmsService : ISMSService
{
private static readonly ILog Log = LogManager.GetLogger<ISMSService>();
private readonly String _twilioAccountSId;
private readonly String _twilioAuthToken;
private readonly String _twilioSourceNumber;
public SmsService(String twilioAccountSid, String twilioAuthToken, String twilioSourceNumber)
{
this._twilioAccountSId = twilioAccountSid;
this._twilioAuthToken = twilioAuthToken;
this._twilioSourceNumber = twilioSourceNumber;
}
public Task SendAsync(SMSNotification notification)
{
// TODO Add logging
// TODO Add error handling
var client = new TwilioRestClient(_twilioAccountSId, _twilioAuthToken);
foreach (var recipient in notification.Recipients)
{
client.SendSmsMessage(_twilioSourceNumber, recipient, notification.Content);
}
return Task.FromResult(0);
}
}
} | mit | C# |
923f8d104c8cae108927a50e3e42a0165920bd90 | fix bug in ClipActionRecordStruct | Alexx999/SwfSharp | SwfSharp/Structs/ClipActionRecordStruct.cs | SwfSharp/Structs/ClipActionRecordStruct.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SwfSharp.Utils;
namespace SwfSharp.Structs
{
public class ClipActionRecordStruct
{
public ClipEventFlagsStruct EventFlags { get; set; }
public uint ActionRecordSize { get; set; }
public byte KeyCode { get; set; }
public IList<ActionRecordStruct> Actions { get; set; }
private void FromStream(BitReader reader, byte swfVersion)
{
EventFlags = ClipEventFlagsStruct.CreateFromStream(reader, swfVersion);
ActionRecordSize = reader.ReadUI32();
var startPos = reader.Position;
if (EventFlags.ClipEventKeyPress)
{
KeyCode = reader.ReadUI8();
}
Actions = new List<ActionRecordStruct>();
while (reader.Position < startPos + ActionRecordSize)
{
var record = ActionRecordStruct.CreateFromStream(reader);
Actions.Add(record);
}
}
internal static ClipActionRecordStruct CreateFromStream(BitReader reader, byte swfVersion)
{
var result = new ClipActionRecordStruct();
result.FromStream(reader, swfVersion);
return result;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SwfSharp.Utils;
namespace SwfSharp.Structs
{
public class ClipActionRecordStruct
{
public ClipEventFlagsStruct EventFlags { get; set; }
public uint ActionRecordSize { get; set; }
public byte KeyCode { get; set; }
public IList<ActionRecordStruct> Actions { get; set; }
private void FromStream(BitReader reader, byte swfVersion)
{
EventFlags = ClipEventFlagsStruct.CreateFromStream(reader, swfVersion);
ActionRecordSize = reader.ReadUI32();
if (EventFlags.ClipEventKeyPress)
{
KeyCode = reader.ReadUI8();
}
Actions = new List<ActionRecordStruct>();
while (!reader.AtTagEnd())
{
var record = ActionRecordStruct.CreateFromStream(reader);
Actions.Add(record);
}
}
internal static ClipActionRecordStruct CreateFromStream(BitReader reader, byte swfVersion)
{
var result = new ClipActionRecordStruct();
result.FromStream(reader, swfVersion);
return result;
}
}
}
| mit | C# |
3034b9cfdc9e7b6ec54f21de11d3b444bc8b396d | Fix support for input and fix some bugs | GMJS/gmjs_ocs_dpt | IPOCS_Programmer/ObjectTypes/GenericInput.cs | IPOCS_Programmer/ObjectTypes/GenericInput.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IPOCS_Programmer.ObjectTypes
{
public class GenericInput : BasicObject
{
public override byte objectTypeId { get { return 11; } }
public byte inputPin { get; set; }
public byte debounceTime { get; set; }
public byte releaseHoldTime { get; set; }
protected override void Serialize(List<byte> buffer)
{
buffer.Add(this.inputPin);
buffer.Add(this.debounceTime);
buffer.Add(this.releaseHoldTime);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IPOCS_Programmer.ObjectTypes
{
public class GenericInput : BasicObject
{
public override byte objectTypeId { get { return 11; } }
public byte inputPin { get; set; }
public byte debounceTime { get; set; }
protected override void Serialize(List<byte> buffer)
{
buffer.Add(this.inputPin);
buffer.Add(this.debounceTime);
}
}
}
| mit | C# |
c27b9b6185b548cdd38eb0f31bef8168710609ce | Handle case where smart indent provider is null for willow | mjbvz/nodejstools,AustinHull/nodejstools,kant2002/nodejstools,avitalb/nodejstools,mousetraps/nodejstools,avitalb/nodejstools,Microsoft/nodejstools,lukedgr/nodejstools,AustinHull/nodejstools,lukedgr/nodejstools,paulvanbrenk/nodejstools,mousetraps/nodejstools,mousetraps/nodejstools,AustinHull/nodejstools,kant2002/nodejstools,avitalb/nodejstools,paladique/nodejstools,Microsoft/nodejstools,kant2002/nodejstools,lukedgr/nodejstools,mjbvz/nodejstools,paladique/nodejstools,mousetraps/nodejstools,munyirik/nodejstools,mjbvz/nodejstools,lukedgr/nodejstools,paladique/nodejstools,lukedgr/nodejstools,kant2002/nodejstools,paulvanbrenk/nodejstools,avitalb/nodejstools,paladique/nodejstools,Microsoft/nodejstools,Microsoft/nodejstools,AustinHull/nodejstools,munyirik/nodejstools,paulvanbrenk/nodejstools,munyirik/nodejstools,munyirik/nodejstools,paladique/nodejstools,mjbvz/nodejstools,mjbvz/nodejstools,Microsoft/nodejstools,paulvanbrenk/nodejstools,avitalb/nodejstools,mousetraps/nodejstools,AustinHull/nodejstools,kant2002/nodejstools,munyirik/nodejstools,paulvanbrenk/nodejstools | Nodejs/Product/Nodejs/SmartIndentProvider.cs | Nodejs/Product/Nodejs/SmartIndentProvider.cs | //*********************************************************//
// Copyright (c) Microsoft. All rights reserved.
//
// Apache 2.0 License
//
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
//*********************************************************//
using System;
using System.ComponentModel.Composition;
using System.Linq;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.NodejsTools {
[Export(typeof(ISmartIndentProvider))]
[ContentType(NodejsConstants.Nodejs)]
[Name("NodejsSmartIndent")]
class SmartIndentProvider : ISmartIndentProvider {
private readonly IEditorOptionsFactoryService _editorOptionsFactory;
private readonly ITaggerProvider _taggerProvider;
[ImportingConstructor]
public SmartIndentProvider(IEditorOptionsFactoryService editorOptionsFactory,
[ImportMany(typeof(ITaggerProvider))]Lazy<ITaggerProvider, TaggerProviderMetadata>[] classifierProviders) {
_editorOptionsFactory = editorOptionsFactory;
// we use a tagger provider here instead of an IClassifierProvider because the
// JS language service doesn't actually implement IClassifierProvider and instead implemnets
// ITaggerProvider<ClassificationTag> instead. We can get those tags via IClassifierAggregatorService
// but that merges together adjacent tokens of the same type, so we go straight to the
// source here.
var foundProvider = classifierProviders.Where(
provider =>
provider.Metadata.ContentTypes.Contains(NodejsConstants.JavaScript) &&
provider.Metadata.TagTypes.Any(tagType => tagType.IsSubclassOf(typeof(ClassificationTag)))
).FirstOrDefault();
_taggerProvider = foundProvider == null ? null : foundProvider.Value;
}
#region ISmartIndentProvider Members
public ISmartIndent CreateSmartIndent(ITextView textView) {
if (_taggerProvider == null)
return null;
return new SmartIndent(
textView,
_editorOptionsFactory.GetOptions(textView),
_taggerProvider.CreateTagger<ClassificationTag>(textView.TextBuffer));
}
#endregion
}
}
| //*********************************************************//
// Copyright (c) Microsoft. All rights reserved.
//
// Apache 2.0 License
//
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
//*********************************************************//
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using Microsoft.NodejsTools.Repl;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Editor.OptionsExtensionMethods;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.NodejsTools {
[Export(typeof(ISmartIndentProvider))]
[ContentType(NodejsConstants.Nodejs)]
[Name("NodejsSmartIndent")]
class SmartIndentProvider : ISmartIndentProvider {
private readonly IEditorOptionsFactoryService _editorOptionsFactory;
private readonly ITaggerProvider _taggerProvider;
[ImportingConstructor]
public SmartIndentProvider(IEditorOptionsFactoryService editorOptionsFactory,
[ImportMany(typeof(ITaggerProvider))]Lazy<ITaggerProvider, TaggerProviderMetadata>[] classifierProviders) {
_editorOptionsFactory = editorOptionsFactory;
// we use a tagger provider here instead of an IClassifierProvider because the
// JS language service doesn't actually implement IClassifierProvider and instead implemnets
// ITaggerProvider<ClassificationTag> instead. We can get those tags via IClassifierAggregatorService
// but that merges together adjacent tokens of the same type, so we go straight to the
// source here.
_taggerProvider = classifierProviders.Where(
provider =>
provider.Metadata.ContentTypes.Contains(NodejsConstants.JavaScript) &&
provider.Metadata.TagTypes.Any(tagType => tagType.IsSubclassOf(typeof(ClassificationTag)))
).First().Value;
}
#region ISmartIndentProvider Members
public ISmartIndent CreateSmartIndent(ITextView textView) {
return new SmartIndent(
textView,
_editorOptionsFactory.GetOptions(textView),
_taggerProvider.CreateTagger<ClassificationTag>(textView.TextBuffer)
);
}
#endregion
}
}
| apache-2.0 | C# |
d97df64c171b2cd82a4da95bfa735f62df82474f | Comment out the sample tests | surrealist/ParkingSpace,surrealist/ParkingSpace,surrealist/ParkingSpace | ParkingSpace.Facts/Sample/SampleFileFacts.cs | ParkingSpace.Facts/Sample/SampleFileFacts.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using System.IO;
namespace ParkingSpace.Facts.Sample {
public class SampleFileFacts {
public static IEnumerable<object[]> getFilesFromCurrentFolder() {
var di = new DirectoryInfo(Environment.CurrentDirectory);
foreach(var file in di.EnumerateFiles()) {
yield return new object[] { file.Name };
}
}
//[Trait("Category", "Sample")]
//[Theory]
//[MemberData("getFilesFromCurrentFolder")]
////[InlineData("sample1.txt")]
////[InlineData("sample20.exe")]
//public void FileNameMustHasThreeCharactersExtension(string fileName) {
// var length = Path.GetExtension(fileName).Length;
// Assert.Equal(4, length); // include 'dot' in front of the extension (.dll, .exe)
//}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using System.IO;
namespace ParkingSpace.Facts.Sample {
public class SampleFileFacts {
public static IEnumerable<object[]> getFilesFromCurrentFolder() {
var di = new DirectoryInfo(Environment.CurrentDirectory);
foreach(var file in di.EnumerateFiles()) {
yield return new object[] { file.Name };
}
}
[Trait("Category", "Sample")]
[Theory]
[MemberData("getFilesFromCurrentFolder")]
//[InlineData("sample1.txt")]
//[InlineData("sample20.exe")]
public void FileNameMustHasThreeCharactersExtension(string fileName) {
var length = Path.GetExtension(fileName).Length;
Assert.Equal(4, length); // include 'dot' in front of the extension (.dll, .exe)
}
}
}
| mit | C# |
bd3bb6e47e8d7a8c61430a6aeeffa1489649ad60 | Check if BindingValue actually has a value | SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia | src/Avalonia.Base/Reactive/TypedBindingAdapter.cs | src/Avalonia.Base/Reactive/TypedBindingAdapter.cs | using System;
using Avalonia.Data;
using Avalonia.Logging;
namespace Avalonia.Reactive
{
internal class TypedBindingAdapter<T> : SingleSubscriberObservableBase<BindingValue<T>>,
IObserver<BindingValue<object?>>
{
private readonly IAvaloniaObject _target;
private readonly AvaloniaProperty<T> _property;
private readonly IObservable<BindingValue<object?>> _source;
private IDisposable? _subscription;
public TypedBindingAdapter(
IAvaloniaObject target,
AvaloniaProperty<T> property,
IObservable<BindingValue<object?>> source)
{
_target = target;
_property = property;
_source = source;
}
public void OnNext(BindingValue<object?> value)
{
try
{
PublishNext(value.Convert<T>());
}
catch (InvalidCastException e)
{
var unwrappedValue = value.HasValue ? value.Value : null;
Logger.TryGet(LogEventLevel.Error, LogArea.Binding)?.Log(
_target,
"Binding produced invalid value for {$Property} ({$PropertyType}): {$Value} ({$ValueType})",
_property.Name,
_property.PropertyType,
unwrappedValue,
unwrappedValue?.GetType());
PublishNext(BindingValue<T>.BindingError(e));
}
}
public void OnCompleted() => PublishCompleted();
public void OnError(Exception error) => PublishError(error);
public static IObservable<BindingValue<T>> Create(
IAvaloniaObject target,
AvaloniaProperty<T> property,
IObservable<BindingValue<object?>> source)
{
return source is IObservable<BindingValue<T>> result ?
result :
new TypedBindingAdapter<T>(target, property, source);
}
protected override void Subscribed() => _subscription = _source.Subscribe(this);
protected override void Unsubscribed() => _subscription?.Dispose();
}
}
| using System;
using Avalonia.Data;
using Avalonia.Logging;
namespace Avalonia.Reactive
{
internal class TypedBindingAdapter<T> : SingleSubscriberObservableBase<BindingValue<T>>,
IObserver<BindingValue<object?>>
{
private readonly IAvaloniaObject _target;
private readonly AvaloniaProperty<T> _property;
private readonly IObservable<BindingValue<object?>> _source;
private IDisposable? _subscription;
public TypedBindingAdapter(
IAvaloniaObject target,
AvaloniaProperty<T> property,
IObservable<BindingValue<object?>> source)
{
_target = target;
_property = property;
_source = source;
}
public void OnNext(BindingValue<object?> value)
{
try
{
PublishNext(value.Convert<T>());
}
catch (InvalidCastException e)
{
Logger.TryGet(LogEventLevel.Error, LogArea.Binding)?.Log(
_target,
"Binding produced invalid value for {$Property} ({$PropertyType}): {$Value} ({$ValueType})",
_property.Name,
_property.PropertyType,
value.Value,
value.Value?.GetType());
PublishNext(BindingValue<T>.BindingError(e));
}
}
public void OnCompleted() => PublishCompleted();
public void OnError(Exception error) => PublishError(error);
public static IObservable<BindingValue<T>> Create(
IAvaloniaObject target,
AvaloniaProperty<T> property,
IObservable<BindingValue<object?>> source)
{
return source is IObservable<BindingValue<T>> result ?
result :
new TypedBindingAdapter<T>(target, property, source);
}
protected override void Subscribed() => _subscription = _source.Subscribe(this);
protected override void Unsubscribed() => _subscription?.Dispose();
}
}
| mit | C# |
1811b4d7bf34ab9618717b0c62cb5ebeb06838b9 | fix Checkmate.cs | sonth3vn/DFTChess,sonth3vn/DFTChess,sonth3vn/DFTChess,sonth3vn/DFTChess | Assets/Scripts/Models/Checkmate.cs | Assets/Scripts/Models/Checkmate.cs | using UnityEngine;
using System.Collections;
public class Checkmate : MonoBehaviour {
public Point currentPos = new Point();
// void Start(){
// Rect rect = GetComponent<RectTransform> ().rect;
// rect = new Rect (rect.position.x, rect.position.y, 100, 100);
// }
public void Pressed(){
GameController gc = GameObject.FindObjectOfType<GameController> ();
gc.MoveToPath (currentPos);
}
}
| using UnityEngine;
using System.Collections;
public class Checkmate : MonoBehaviour {
public Point currentPos = new Point();
void Start(){
Rect rect = GetComponent<RectTransform> ().rect;
rect = new Rect (rect.position.x, rect.position.y, 100, 100);
}
public void Pressed(){
GameController gc = GameObject.FindObjectOfType<GameController> ();
gc.MoveToPath (currentPos);
}
}
| mit | C# |
e8e7157b0ad00c9cdb59421ccf0118199ba255fc | Save all the lines of code! | punker76/Espera,flagbug/Espera | Espera/Espera.Core/ReactiveHelpers.cs | Espera/Espera.Core/ReactiveHelpers.cs | using ReactiveMarrow;
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
namespace Espera.Core
{
internal static class ReactiveHelpers
{
/// <summary>
/// Takes the left observable and combines it with the latest value of the right observable.
/// This method is like <see cref="Observable.CombineLatest{TSource1,TSource2,TResult}"/>,
/// except it propagates only when the value of the left observable sequence changes.
/// </summary>
public static IObservable<TResult> Left<TLeft, TRight, TResult>(this IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, TRight, TResult> resultSelector)
{
TRight latest = default(TRight);
bool initialized = false;
var disp = new CompositeDisposable(2);
right.Subscribe(x =>
{
latest = x;
initialized = true;
}).DisposeWith(disp);
return Observable.Create<TResult>(o =>
{
left.Where(_ => initialized)
.Subscribe(x => o.OnNext(resultSelector(x, latest)),
o.OnError, o.OnCompleted)
.DisposeWith(disp);
return disp;
});
}
}
} | using ReactiveMarrow;
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
namespace Espera.Core
{
internal static class ReactiveHelpers
{
/// <summary>
/// Takes the left observable and combines it with the latest value of the right observable.
/// This method is like <see cref="Observable.CombineLatest{TSource1,TSource2,TResult}"/>,
/// except it propagates only when the value of the left observable sequence changes.
/// </summary>
public static IObservable<TResult> Left<TLeft, TRight, TResult>(this IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, TRight, TResult> resultSelector)
{
TRight latest = default(TRight);
bool initialized = false;
var disp = new CompositeDisposable(2);
right.Subscribe(x =>
{
latest = x;
initialized = true;
}).DisposeWith(disp);
return Observable.Create<TResult>(o =>
{
left.Subscribe(x =>
{
if (initialized)
{
o.OnNext(resultSelector(x, latest));
}
}, o.OnError, o.OnCompleted).DisposeWith(disp);
return disp;
});
}
}
} | mit | C# |
4d3435ee391e61d240e21c1bfc31c427b9703bd3 | Use the console role instaed | KodamaSakuno/Library | Sakuno.SystemInterop/VolumeManager.cs | Sakuno.SystemInterop/VolumeManager.cs | using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Sakuno.SystemInterop
{
public class VolumeManager : NativeInterfaces.IAudioSessionNotification
{
public static VolumeManager Instance { get; } = new VolumeManager();
NativeInterfaces.IAudioSessionManager2 r_SessionManager;
public event Action<VolumeSession> NewSession = delegate { };
VolumeManager()
{
var rDeviceEnumerator = (NativeInterfaces.IMMDeviceEnumerator)new NativeInterfaces.MMDeviceEnumerator();
NativeInterfaces.IMMDevice rDevice;
Marshal.ThrowExceptionForHR(rDeviceEnumerator.GetDefaultAudioEndpoint(NativeConstants.DataFlow.Render, NativeConstants.Role.Console, out rDevice));
var rAudioSessionManagerGuid = typeof(NativeInterfaces.IAudioSessionManager2).GUID;
object rObject;
Marshal.ThrowExceptionForHR(rDevice.Activate(ref rAudioSessionManagerGuid, 0, IntPtr.Zero, out rObject));
r_SessionManager = (NativeInterfaces.IAudioSessionManager2)rObject;
Marshal.ThrowExceptionForHR(r_SessionManager.RegisterSessionNotification(this));
Marshal.ReleaseComObject(rDevice);
Marshal.ReleaseComObject(rDeviceEnumerator);
}
public IEnumerable<VolumeSession> EnumerateSessions()
{
NativeInterfaces.IAudioSessionEnumerator rSessionEnumerator;
Marshal.ThrowExceptionForHR(r_SessionManager.GetSessionEnumerator(out rSessionEnumerator));
int rCount;
Marshal.ThrowExceptionForHR(rSessionEnumerator.GetCount(out rCount));
for (var i = 0; i < rCount; i++)
{
NativeInterfaces.IAudioSessionControl rSessionControl;
Marshal.ThrowExceptionForHR(rSessionEnumerator.GetSession(i, out rSessionControl));
yield return new VolumeSession((NativeInterfaces.IAudioSessionControl2)rSessionControl);
}
Marshal.ReleaseComObject(rSessionEnumerator);
}
int NativeInterfaces.IAudioSessionNotification.OnSessionCreated(NativeInterfaces.IAudioSessionControl rpNewSession)
{
NewSession(new VolumeSession((NativeInterfaces.IAudioSessionControl2)rpNewSession));
return 0;
}
}
}
| using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Sakuno.SystemInterop
{
public class VolumeManager : NativeInterfaces.IAudioSessionNotification
{
public static VolumeManager Instance { get; } = new VolumeManager();
NativeInterfaces.IAudioSessionManager2 r_SessionManager;
public event Action<VolumeSession> NewSession = delegate { };
VolumeManager()
{
var rDeviceEnumerator = (NativeInterfaces.IMMDeviceEnumerator)new NativeInterfaces.MMDeviceEnumerator();
NativeInterfaces.IMMDevice rDevice;
Marshal.ThrowExceptionForHR(rDeviceEnumerator.GetDefaultAudioEndpoint(NativeConstants.DataFlow.Render, NativeConstants.Role.Multimedia, out rDevice));
var rAudioSessionManagerGuid = typeof(NativeInterfaces.IAudioSessionManager2).GUID;
object rObject;
Marshal.ThrowExceptionForHR(rDevice.Activate(ref rAudioSessionManagerGuid, 0, IntPtr.Zero, out rObject));
r_SessionManager = (NativeInterfaces.IAudioSessionManager2)rObject;
Marshal.ThrowExceptionForHR(r_SessionManager.RegisterSessionNotification(this));
Marshal.ReleaseComObject(rDevice);
Marshal.ReleaseComObject(rDeviceEnumerator);
}
public IEnumerable<VolumeSession> EnumerateSessions()
{
NativeInterfaces.IAudioSessionEnumerator rSessionEnumerator;
Marshal.ThrowExceptionForHR(r_SessionManager.GetSessionEnumerator(out rSessionEnumerator));
int rCount;
Marshal.ThrowExceptionForHR(rSessionEnumerator.GetCount(out rCount));
for (var i = 0; i < rCount; i++)
{
NativeInterfaces.IAudioSessionControl rSessionControl;
Marshal.ThrowExceptionForHR(rSessionEnumerator.GetSession(i, out rSessionControl));
yield return new VolumeSession((NativeInterfaces.IAudioSessionControl2)rSessionControl);
}
Marshal.ReleaseComObject(rSessionEnumerator);
}
int NativeInterfaces.IAudioSessionNotification.OnSessionCreated(NativeInterfaces.IAudioSessionControl rpNewSession)
{
NewSession(new VolumeSession((NativeInterfaces.IAudioSessionControl2)rpNewSession));
return 0;
}
}
}
| mit | C# |
87db1ba48703d07371f12f822d4d2eb765c1adfb | Remove unused text transform helpers | ppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,ppy/osu,ppy/osu,EVAST9919/osu,peppy/osu-new,EVAST9919/osu,peppy/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu | osu.Game/Graphics/Sprites/OsuSpriteText.cs | osu.Game/Graphics/Sprites/OsuSpriteText.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;
namespace osu.Game.Graphics.Sprites
{
public class OsuSpriteText : SpriteText
{
public OsuSpriteText()
{
Shadow = true;
Font = OsuFont.Default;
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
namespace osu.Game.Graphics.Sprites
{
public class OsuSpriteText : SpriteText
{
public OsuSpriteText()
{
Shadow = true;
Font = OsuFont.Default;
}
}
public static class OsuSpriteTextTransformExtensions
{
/// <summary>
/// Sets <see cref="SpriteText.Text">Text</see> to a new value after a duration.
/// </summary>
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
public static TransformSequence<T> TransformTextTo<T>(this T spriteText, string newText, double duration = 0, Easing easing = Easing.None)
where T : OsuSpriteText
=> spriteText.TransformTo(nameof(OsuSpriteText.Text), newText, duration, easing);
/// <summary>
/// Sets <see cref="SpriteText.Text">Text</see> to a new value after a duration.
/// </summary>
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
public static TransformSequence<T> TransformTextTo<T>(this TransformSequence<T> t, string newText, double duration = 0, Easing easing = Easing.None)
where T : OsuSpriteText
=> t.Append(o => o.TransformTextTo(newText, duration, easing));
}
}
| mit | C# |
81131773bbdfef8f317fdc55015054760480d477 | add TODO | StefanoFiumara/Harry-Potter-Unity | Assets/Scripts/HarryPotterUnity/Cards/Transfiguration/Locations/DumbledoresOffice.cs | Assets/Scripts/HarryPotterUnity/Cards/Transfiguration/Locations/DumbledoresOffice.cs | using System.Linq;
using HarryPotterUnity.Cards.PlayRequirements;
using HarryPotterUnity.Enums;
using HarryPotterUnity.Game;
namespace HarryPotterUnity.Cards.Transfiguration.Locations
{
public class DumbledoresOffice : BaseLocation
{
//TODO: Test this
public override void OnEnterInPlayAction()
{
base.OnEnterInPlayAction();
var itemLessonRequirements =
GameManager.AllCards.Where(card => card.Type == Type.Item)
.Select(card => card.GetComponent<LessonRequirement>())
.ToList();
foreach (var requirement in itemLessonRequirements)
{
requirement.AmountRequired -= 3;
if (requirement.AmountRequired < 1)
{
requirement.AmountRequired = 1;
}
}
}
public override void OnExitInPlayAction()
{
base.OnExitInPlayAction();
var itemLessonRequirements =
GameManager.AllCards.Where(card => card.Type == Type.Item)
.Select(card => card.GetComponent<LessonRequirement>())
.ToList();
foreach (var req in itemLessonRequirements)
{
req.ResetRequirement();
}
}
}
} | using System.Linq;
using HarryPotterUnity.Cards.PlayRequirements;
using HarryPotterUnity.Enums;
using HarryPotterUnity.Game;
namespace HarryPotterUnity.Cards.Transfiguration.Locations
{
public class DumbledoresOffice : BaseLocation
{
public override void OnEnterInPlayAction()
{
base.OnEnterInPlayAction();
var itemLessonRequirements =
GameManager.AllCards.Where(card => card.Type == Type.Item)
.Select(card => card.GetComponent<LessonRequirement>())
.ToList();
foreach (var requirement in itemLessonRequirements)
{
requirement.AmountRequired -= 3;
if (requirement.AmountRequired < 1)
{
requirement.AmountRequired = 1;
}
}
}
public override void OnExitInPlayAction()
{
base.OnExitInPlayAction();
var itemLessonRequirements =
GameManager.AllCards.Where(card => card.Type == Type.Item)
.Select(card => card.GetComponent<LessonRequirement>())
.ToList();
foreach (var req in itemLessonRequirements)
{
req.ResetRequirement();
}
}
}
} | mit | C# |
207d37568893bc7fca12834344123ba3d187becc | Update 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 : IQuestionRespository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
{
singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
}
_dbContext.SaveChanges();
}
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
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 : IQuestionRespository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
{
singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
}
_dbContext.SaveChanges();
}
/// <summary>
/// Adding single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
_dbContext.SaveChanges();
}
}
}
| mit | C# |
21c89ed10ba8ba1869d95487bff39f741798bd3e | Add more test | aloisdg/PlaylistSharp | PlaylistSharpTest/Program.cs | PlaylistSharpTest/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PlaylistSharpLib;
namespace PlaylistSharpTest
{
class Program
{
static void Main(string[] args)
{
var playlist = new Playlist
{
Tracks = new List<PlaylistTrack>
{
new PlaylistTrack { Title = "title1", Location = "location1" },
new PlaylistTrack { Title = "title2", Location = "location2" },
new PlaylistTrack { Title = null, Location = "location2" },
new PlaylistTrack { Title = "title2", Location = null },
new PlaylistTrack { Title = "title3", Location = String.Empty },
new PlaylistTrack { Title = String.Empty, Location = "location4" }
},
//Type = PlaylistType.XPSF
Type = PlaylistType.M3U
};
try
{
string so = playlist.ToString(playlist.Type);
Console.WriteLine(so);
var i = new Playlist(playlist.Type, so);
Console.WriteLine(i.Tracks.ToList().Count);
}
catch (Exception exception)
{
Console.WriteLine(exception.Message);
}
Console.ReadLine();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PlaylistSharpLib;
namespace PlaylistSharpTest
{
class Program
{
static void Main(string[] args)
{
var playlist = new Playlist
{
Tracks = new List<PlaylistTrack>
{
new PlaylistTrack { Title = "title1", Location = "location1" },
new PlaylistTrack { Title = "title2", Location = "location2" },
new PlaylistTrack { Title = "title3", Location = "location3" },
new PlaylistTrack { Title = "title4", Location = "location4" }
},
//Type = PlaylistType.XPSF
Type = PlaylistType.M3U
};
try
{
string so = playlist.ToString(playlist.Type);
Console.WriteLine(so);
var i = new Playlist(playlist.Type, so);
Console.WriteLine(i.Tracks.ToList().Count);
}
catch (Exception exception)
{
Console.WriteLine(exception.Message);
}
Console.ReadLine();
}
}
}
| mit | C# |
c807bdbc64055d622625f8c9a9021aa3bd89296c | Fix build warning. | jthelin/ServerHost,jthelin/ServerHost | Tests/ServerTestHostTests.cs | Tests/ServerTestHostTests.cs | // Copyright (c) Jorgen Thelin. All rights reserved.
using System;
using FluentAssertions;
using log4net;
using log4net.Config;
using Xunit;
using Xunit.Abstractions;
using ServerHost;
namespace Tests
{
public class ServerTestHostTests : IClassFixture<ServerTestHostFixture>, IDisposable
{
//private static readonly ILog log = LogManager.GetLogger(typeof(ServerTestHostTests));
private readonly ITestOutputHelper output;
[Fact]
public void LoadServerInNewAppDomain()
{
string serverName = "LoadServerInNewAppDomain"; // TestContext.TestName;
ServerHostHandle<TestServer.Server> serverHostHandle = ServerTestHost
.LoadServerInNewAppDomain<TestServer.Server>(serverName);
serverHostHandle.Should().NotBeNull("Null ServerHostHandle returned.");
serverHostHandle.ServerName.Should().Be(serverName, "ServerHostHandle.ServerName");
serverHostHandle.AppDomain.Should().NotBeNull("Null ServerHostHandle.AppDomain returned.");
serverHostHandle.Server.Should().NotBeNull("Null ServerHostHandle.Server returned.");
serverHostHandle.Server.Should().BeOfType<TestServer.Server>("Server instance type.");
}
#region Test Initialization / Cleanup methods
// TestInitialize
public ServerTestHostTests(ITestOutputHelper output, ServerTestHostFixture fixture)
{
this.output = output;
output.WriteLine("TestInitialize");
output.WriteLine("Fixture = {0}", fixture);
output.WriteLine("Current directory = {0}", Environment.CurrentDirectory);
}
// TestCleanup
public void Dispose()
{
output.WriteLine("TestCleanup");
output.WriteLine("UnloadAllServers");
ServerTestHost.UnloadAllServers();
}
#endregion
}
public class ServerTestHostFixture : IDisposable
{
internal static readonly ILog log = LogManager.GetLogger(typeof(ServerTestHostFixture));
// ClassInitialize
public ServerTestHostFixture()
{
// Set up the log4net configuration.
BasicConfigurator.Configure();
log.Info("ServerTestHostFixture - Initialize");
}
// ClassCleanup
public void Dispose()
{
log.Info("ServerTestHostFixture - Dispose");
}
}
}
| // Copyright (c) Jorgen Thelin. All rights reserved.
using System;
using FluentAssertions;
using log4net;
using log4net.Config;
using Xunit;
using Xunit.Abstractions;
using ServerHost;
namespace Tests
{
public class ServerTestHostTests : IClassFixture<ServerTestHostFixture>, IDisposable
{
private static readonly ILog log = LogManager.GetLogger(typeof(ServerTestHostTests));
private readonly ITestOutputHelper output;
[Fact]
public void LoadServerInNewAppDomain()
{
string serverName = "LoadServerInNewAppDomain"; // TestContext.TestName;
ServerHostHandle<TestServer.Server> serverHostHandle = ServerTestHost
.LoadServerInNewAppDomain<TestServer.Server>(serverName);
serverHostHandle.Should().NotBeNull("Null ServerHostHandle returned.");
serverHostHandle.ServerName.Should().Be(serverName, "ServerHostHandle.ServerName");
serverHostHandle.AppDomain.Should().NotBeNull("Null ServerHostHandle.AppDomain returned.");
serverHostHandle.Server.Should().NotBeNull("Null ServerHostHandle.Server returned.");
serverHostHandle.Server.Should().BeOfType<TestServer.Server>("Server instance type.");
}
#region Test Initialization / Cleanup methods
// TestInitialize
public ServerTestHostTests(ITestOutputHelper output, ServerTestHostFixture fixture)
{
this.output = output;
output.WriteLine("TestInitialize");
output.WriteLine("Fixture = {0}", fixture);
output.WriteLine("Current directory = {0}", Environment.CurrentDirectory);
}
// TestCleanup
public void Dispose()
{
output.WriteLine("TestCleanup");
output.WriteLine("UnloadAllServers");
ServerTestHost.UnloadAllServers();
}
#endregion
}
public class ServerTestHostFixture : IDisposable
{
internal static readonly ILog log = LogManager.GetLogger(typeof(ServerTestHostFixture));
// ClassInitialize
public ServerTestHostFixture()
{
// Set up the log4net configuration.
BasicConfigurator.Configure();
log.Info("ServerTestHostFixture - Initialize");
}
// ClassCleanup
public void Dispose()
{
log.Info("ServerTestHostFixture - Dispose");
}
}
}
| apache-2.0 | C# |
6f786ea1ec4ccdc7cc764fcbdd205508d4327a7d | Update Program.cs | jeetendraprasad/building-blocks-demo | DemoConsoleApp/DemoConsoleApp/Program.cs | DemoConsoleApp/DemoConsoleApp/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DemoConsoleApp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World! - Changed on Server.");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DemoConsoleApp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}
| mit | C# |
0dfabe864ae22797523058c27ec500ee70603209 | Clean up usings | prescottadam/ConsoleWritePrettyOneDay | ConsoleWritePrettyOneDay.App/Program.cs | ConsoleWritePrettyOneDay.App/Program.cs | using System.Threading;
using System.Threading.Tasks;
using Console = System.Console;
namespace ConsoleWritePrettyOneDay.App
{
class Program
{
static void Main(string[] args)
{
Spinner.Wait(() => Thread.Sleep(5000), "waiting for sleep");
var task = Task.Run(() => Thread.Sleep(4000));
Spinner.Wait(task, "waiting for task");
Console.ReadLine();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ConsoleWritePrettyOneDay;
using Console = System.Console;
namespace ConsoleWritePrettyOneDay.App
{
class Program
{
static void Main(string[] args)
{
Spinner.Wait(() => Thread.Sleep(5000), "waiting for sleep");
var task = Task.Run(() => Thread.Sleep(4000));
Spinner.Wait(task, "waiting for task");
Console.ReadLine();
}
}
}
| mit | C# |
9e5ccbff70938a16c5f4c2558730b17607ea6aa3 | Update version # to 4.0.0 | Phrynohyas/eve-o-preview,Phrynohyas/eve-o-preview | Eve-O-Preview/Properties/AssemblyInfo.cs | Eve-O-Preview/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("EVE-O Preview")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EVE-O Preview")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
[assembly: AssemblyVersion("4.0.0.0")]
[assembly: AssemblyFileVersion("4.0.0.0")]
[assembly: CLSCompliant(true)] | using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("EVE-O Preview")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EVE-O Preview")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
[assembly: AssemblyVersion("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: CLSCompliant(true)] | mit | C# |
df9c57117a6b2de5ec1dee7926f929bc4d24693f | Fix error when launching missing files | danielchalmers/DesktopWidgets | DesktopWidgets/Helpers/ProcessHelper.cs | DesktopWidgets/Helpers/ProcessHelper.cs | #region
using System.Diagnostics;
using System.IO;
using DesktopWidgets.Classes;
#endregion
namespace DesktopWidgets.Helpers
{
internal static class ProcessHelper
{
public static void Launch(string path, string args = "", string startIn = "",
ProcessWindowStyle style = ProcessWindowStyle.Normal)
{
Launch(new ProcessFile {Path = path, Arguments = args, StartInFolder = startIn, WindowStyle = style});
}
public static void Launch(ProcessFile file)
{
if (string.IsNullOrWhiteSpace(file.Path) || !File.Exists(file.Path))
return;
Process.Start(new ProcessStartInfo
{
FileName = file.Path,
Arguments = file.Arguments,
WorkingDirectory = file.StartInFolder,
WindowStyle = file.WindowStyle
});
}
public static void OpenFolder(string path)
{
if (File.Exists(path) || Directory.Exists(path))
Launch("explorer.exe", "/select," + path);
}
}
} | #region
using System.Diagnostics;
using System.IO;
using DesktopWidgets.Classes;
#endregion
namespace DesktopWidgets.Helpers
{
internal static class ProcessHelper
{
public static void Launch(string path, string args = "", string startIn = "",
ProcessWindowStyle style = ProcessWindowStyle.Normal)
{
Launch(new ProcessFile {Path = path, Arguments = args, StartInFolder = startIn, WindowStyle = style});
}
public static void Launch(ProcessFile file)
{
Process.Start(new ProcessStartInfo
{
FileName = file.Path,
Arguments = file.Arguments,
WorkingDirectory = file.StartInFolder,
WindowStyle = file.WindowStyle
});
}
public static void OpenFolder(string path)
{
if (File.Exists(path) || Directory.Exists(path))
Launch("explorer.exe", "/select," + path);
}
}
} | apache-2.0 | C# |
3129c2cc75fd82e2a324aaf29d8e7f0d6cb771fe | Fix slider circle masks blocking input for now | ppy/osu,smoogipoo/osu,EVAST9919/osu,DrabWeb/osu,UselessToucan/osu,UselessToucan/osu,DrabWeb/osu,ZLima12/osu,2yangk23/osu,peppy/osu,EVAST9919/osu,smoogipooo/osu,UselessToucan/osu,naoey/osu,ppy/osu,DrabWeb/osu,ppy/osu,johnneijzen/osu,naoey/osu,smoogipoo/osu,2yangk23/osu,smoogipoo/osu,ZLima12/osu,johnneijzen/osu,Nabile-Rahmani/osu,naoey/osu,peppy/osu-new,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu | osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs | osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.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.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
{
public class SliderCircleMask : HitObjectMask
{
public SliderCircleMask(DrawableHitCircle sliderHead, DrawableSlider slider)
: this(sliderHead, Vector2.Zero, slider)
{
}
public SliderCircleMask(DrawableSliderTail sliderTail, DrawableSlider slider)
: this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider)
{
}
private readonly DrawableOsuHitObject hitObject;
private SliderCircleMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider)
: base(hitObject)
{
this.hitObject = hitObject;
Origin = Anchor.Centre;
Position = position;
Size = slider.HeadCircle.Size;
Scale = slider.HeadCircle.Scale;
AddInternal(new RingPiece());
State = Visibility.Visible;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = colours.Yellow;
}
protected override void Update()
{
base.Update();
RelativeAnchorPosition = hitObject.RelativeAnchorPosition;
}
// Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => false;
}
}
| // 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.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
{
public class SliderCircleMask : HitObjectMask
{
public SliderCircleMask(DrawableHitCircle sliderHead, DrawableSlider slider)
: this(sliderHead, Vector2.Zero, slider)
{
}
public SliderCircleMask(DrawableSliderTail sliderTail, DrawableSlider slider)
: this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider)
{
}
private readonly DrawableOsuHitObject hitObject;
private SliderCircleMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider)
: base(hitObject)
{
this.hitObject = hitObject;
Origin = Anchor.Centre;
Position = position;
Size = slider.HeadCircle.Size;
Scale = slider.HeadCircle.Scale;
AddInternal(new RingPiece());
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = colours.Yellow;
}
protected override void Update()
{
base.Update();
RelativeAnchorPosition = hitObject.RelativeAnchorPosition;
}
}
}
| mit | C# |
b6ed7f9550c420b9c28dc96782ac02860c063e8b | change according to http://skylines-modding-docs.readthedocs.org/en/latest/modding/Getting-Started/Setting-Up-Visual-Studio.html | ccpz/cities-skylines-Mod_Lang_CHT | Mod_Lang_CHT/Properties/AssemblyInfo.cs | Mod_Lang_CHT/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 組件的一般資訊是由下列的屬性集控制。
// 變更這些屬性的值即可修改組件的相關
// 資訊。
[assembly: AssemblyTitle("Mod_Lang_CHT")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod_Lang_CHT")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 將 ComVisible 設定為 false 會使得這個組件中的類型
// 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
[assembly: ComVisible(false)]
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("0031fabf-8526-4590-a3c8-801aeea75e45")]
// 組件的版本資訊是由下列四項值構成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂編號
//
// 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號
// 指定為預設值:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 組件的一般資訊是由下列的屬性集控制。
// 變更這些屬性的值即可修改組件的相關
// 資訊。
[assembly: AssemblyTitle("Mod_Lang_CHT")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod_Lang_CHT")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 將 ComVisible 設定為 false 會使得這個組件中的類型
// 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
[assembly: ComVisible(false)]
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("0031fabf-8526-4590-a3c8-801aeea75e45")]
// 組件的版本資訊是由下列四項值構成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂編號
//
// 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號
// 指定為預設值:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| apache-2.0 | C# |
ed94660acc095d9dea0c17f2335b209508f2232c | Remove unnecessary parameter in network message | jacobdufault/forge,jacobdufault/forge | Networking/Lobby/LobbyLaunchedHandler.cs | Networking/Lobby/LobbyLaunchedHandler.cs | // The MIT License (MIT)
//
// Copyright (c) 2013 Jacob Dufault
//
// 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 Neon.Networking.Core;
using Neon.Utilities;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace Neon.Networking.Lobby {
internal class LobbyLaunchedHandler : INetworkMessageHandler {
public Type[] HandledTypes {
get { return new[] { typeof(LobbyLaunchedNetworkMessage) }; }
}
public bool IsLaunched;
public void HandleNetworkMessage(NetworkPlayer sender, INetworkMessage message) {
Contract.Requires(message is LobbyLaunchedNetworkMessage);
IsLaunched = true;
}
}
/// <summary>
/// Network message sent when the lobby has been launched.
/// </summary>
[JsonObject(MemberSerialization.OptIn)]
internal class LobbyLaunchedNetworkMessage : INetworkMessage {
}
} | // The MIT License (MIT)
//
// Copyright (c) 2013 Jacob Dufault
//
// 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 Neon.Networking.Core;
using Neon.Utilities;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace Neon.Networking.Lobby {
internal class LobbyLaunchedHandler : INetworkMessageHandler {
public Type[] HandledTypes {
get { return new[] { typeof(LobbyLaunchedNetworkMessage) }; }
}
public bool IsLaunched;
public void HandleNetworkMessage(NetworkPlayer sender, INetworkMessage message) {
Contract.Requires(message is LobbyLaunchedNetworkMessage);
IsLaunched = true;
}
}
/// <summary>
/// Network message sent when the lobby has been launched.
/// </summary>
[JsonObject(MemberSerialization.OptIn)]
internal class LobbyLaunchedNetworkMessage : INetworkMessage {
/// <summary>
/// The players that are in the game.
/// </summary>
[JsonProperty("Players")]
public List<NetworkPlayer> Players;
}
} | mit | C# |
d3ca15cf4a3a8b2481970ade41598ceaadcc62f0 | bump version to 1.5.12 | martin2250/OpenCNCPilot | OpenCNCPilot/Properties/AssemblyInfo.cs | OpenCNCPilot/Properties/AssemblyInfo.cs | using System.Reflection;
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("OpenCNCPilot")]
[assembly: AssemblyDescription("GCode Sender and AutoLeveller")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("martin2250")]
[assembly: AssemblyProduct("OpenCNCPilot")]
[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.5.12.0")]
[assembly: AssemblyFileVersion("1.5.12.0")]
| using System.Reflection;
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("OpenCNCPilot")]
[assembly: AssemblyDescription("GCode Sender and AutoLeveller")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("martin2250")]
[assembly: AssemblyProduct("OpenCNCPilot")]
[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.5.11.0")]
[assembly: AssemblyFileVersion("1.5.11.0")]
| mit | C# |
be34d4a82ae6920bc8ecb1cf2c9a525009f6619e | fix issue causing packager to use wrong video access arguments | IUMDPI/IUMediaHelperApps | Packager/Utilities/VideoFFMPEGRunner.cs | Packager/Utilities/VideoFFMPEGRunner.cs | using Packager.Models;
using Packager.Observers;
using Packager.Providers;
namespace Packager.Utilities
{
public class VideoFFMPEGRunner : AbstractFFMPEGRunner
{
public VideoFFMPEGRunner(IProgramSettings programSettings, IProcessRunner processRunner, IObserverCollection observers, IFileProvider fileProvider, IHasher hasher)
: base(programSettings, processRunner, observers, fileProvider, hasher)
{
ProdOrMezzArguments = programSettings.FFMPEGVideoMezzanineArguments;
AccessArguments = programSettings.FFMPEGVideoAccessArguments;
}
protected override string NormalizingArguments => "-acodec copy -vcodec copy";
public override string ProdOrMezzArguments { get; }
public override string AccessArguments { get; }
}
} | using Packager.Models;
using Packager.Observers;
using Packager.Providers;
namespace Packager.Utilities
{
public class VideoFFMPEGRunner : AbstractFFMPEGRunner
{
public VideoFFMPEGRunner(IProgramSettings programSettings, IProcessRunner processRunner, IObserverCollection observers, IFileProvider fileProvider, IHasher hasher)
: base(programSettings, processRunner, observers, fileProvider, hasher)
{
ProdOrMezzArguments = programSettings.FFMPEGVideoMezzanineArguments;
AccessArguments = programSettings.FFMPEGAudioAccessArguments;
}
protected override string NormalizingArguments => "-acodec copy -vcodec copy";
public override string ProdOrMezzArguments { get; }
public override string AccessArguments { get; }
}
} | apache-2.0 | C# |
313c8783bcb306294c70fa478fc536e73f7f190b | Update version number. | Damnae/storybrew | editor/Properties/AssemblyInfo.cs | editor/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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.15.*")]
| 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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.14.*")]
| mit | C# |
2b4af457bf590cba4a2660a2f662d57d4a1e0a01 | Add RuntimeFeature.IsDynamicCodeSupported/IsDynamicCodeCompiled | ViktorHofer/corefx,ptoonen/corefx,ViktorHofer/corefx,ericstj/corefx,shimingsg/corefx,wtgodbe/corefx,ptoonen/corefx,ptoonen/corefx,ericstj/corefx,shimingsg/corefx,ViktorHofer/corefx,ericstj/corefx,shimingsg/corefx,ViktorHofer/corefx,BrennanConroy/corefx,ptoonen/corefx,shimingsg/corefx,wtgodbe/corefx,ptoonen/corefx,shimingsg/corefx,wtgodbe/corefx,wtgodbe/corefx,shimingsg/corefx,ViktorHofer/corefx,shimingsg/corefx,ViktorHofer/corefx,BrennanConroy/corefx,wtgodbe/corefx,ptoonen/corefx,wtgodbe/corefx,ericstj/corefx,ericstj/corefx,ericstj/corefx,BrennanConroy/corefx,ptoonen/corefx,ericstj/corefx,wtgodbe/corefx,ViktorHofer/corefx | src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeFeature.cs | src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeFeature.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Runtime.CompilerServices
{
public static partial class RuntimeFeature
{
/// <summary>
/// Name of the Portable PDB feature.
/// </summary>
public const string PortablePdb = nameof(PortablePdb);
#if FEATURE_DEFAULT_INTERFACES
/// <summary>
/// Indicates that this version of runtime supports default interface method implementations.
/// </summary>
public const string DefaultImplementationsOfInterfaces = nameof(DefaultImplementationsOfInterfaces);
#endif
/// <summary>
/// Checks whether a certain feature is supported by the Runtime.
/// </summary>
public static bool IsSupported(string feature)
{
switch (feature)
{
case PortablePdb:
#if FEATURE_DEFAULT_INTERFACES
case DefaultImplementationsOfInterfaces:
#endif
return true;
case nameof(IsDynamicCodeSupported):
return IsDynamicCodeSupported;
case nameof(IsDynamicCodeCompiled):
return IsDynamicCodeCompiled;
}
return false;
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Runtime.CompilerServices
{
public static class RuntimeFeature
{
/// <summary>
/// Name of the Portable PDB feature.
/// </summary>
public const string PortablePdb = nameof(PortablePdb);
#if FEATURE_DEFAULT_INTERFACES
/// <summary>
/// Indicates that this version of runtime supports default interface method implementations.
/// </summary>
public const string DefaultImplementationsOfInterfaces = nameof(DefaultImplementationsOfInterfaces);
#endif
/// <summary>
/// Checks whether a certain feature is supported by the Runtime.
/// </summary>
public static bool IsSupported(string feature)
{
switch (feature)
{
case PortablePdb:
#if FEATURE_DEFAULT_INTERFACES
case DefaultImplementationsOfInterfaces:
#endif
return true;
}
return false;
}
}
}
| mit | C# |
c183242ae219012102aaa23a8895a97b10efdb98 | Update ExampleCommand.cs | DarkIrata/WinCommandPalette | Plugins/ExamplePlugin/ExampleCommand.cs | Plugins/ExamplePlugin/ExampleCommand.cs | using System;
using System.Windows.Forms;
using WinCommandPalette.PluginSystem;
namespace ExamplePlugin
{
public class ExampleCommand : ICommand
{
public string Name { get; set; }
public string Description => "Anyone there?";
public bool RunInUIThread => false;
public string Text { get; set; }
public ExampleCommand()
{
this.Name = "[Example] Name isn't set";
}
public void Execute()
{
MessageBox.Show(this.Text);
}
}
}
| using System;
using System.Windows.Forms;
using WinCommandPalette.PluginSystem;
namespace ExamplePlugin
{
public class ExampleCommand : ICommand
{
public string Name { get; set; }
public string Description => "Anyone there?";
public bool RunInUIThread => false;
public string Text { get; set; }
public bool RunAsAdmin => false;
public ExampleCommand()
{
this.Name = "[Example] Name isn't set";
}
public void Execute()
{
MessageBox.Show(this.Text);
}
}
}
| mit | C# |
63923acbe67fbb81fd486731fca407baf0581638 | Fix Issue with Scenario Outline Data Containing Parenthesis | picklesdoc/pickles,picklesdoc/pickles,magicmonty/pickles,ludwigjossieaux/pickles,dirkrombauts/pickles,ludwigjossieaux/pickles,magicmonty/pickles,picklesdoc/pickles,dirkrombauts/pickles,ludwigjossieaux/pickles,dirkrombauts/pickles,magicmonty/pickles,magicmonty/pickles,dirkrombauts/pickles,picklesdoc/pickles | src/Pickles/Pickles.TestFrameworks/NUnit/NUnitExampleSignatureBuilder.cs | src/Pickles/Pickles.TestFrameworks/NUnit/NUnitExampleSignatureBuilder.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="NUnitExampleSignatureBuilder.cs" company="PicklesDoc">
// Copyright 2011 Jeffrey Cameron
// Copyright 2012-present PicklesDoc team and community contributors
//
//
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Text;
using System.Text.RegularExpressions;
using PicklesDoc.Pickles.ObjectModel;
namespace PicklesDoc.Pickles.TestFrameworks.NUnit
{
public class NUnitExampleSignatureBuilder
{
public Regex Build(ScenarioOutline scenarioOutline, string[] row)
{
var stringBuilder = new StringBuilder();
stringBuilder.Append(scenarioOutline.Name.ToLowerInvariant().Replace(" ", string.Empty) + "\\(");
foreach (string value in row)
{
stringBuilder.AppendFormat("\"{0}\",", value.ToLowerInvariant()
.Replace(@"\", string.Empty)
.Replace(@"$", @"\$")
.Replace(@"(", @"\(")
.Replace(@")", @"\)"));
}
stringBuilder.Remove(stringBuilder.Length - 1, 1);
return new Regex(stringBuilder.ToString());
}
}
}
| // --------------------------------------------------------------------------------------------------------------------
// <copyright file="NUnitExampleSignatureBuilder.cs" company="PicklesDoc">
// Copyright 2011 Jeffrey Cameron
// Copyright 2012-present PicklesDoc team and community contributors
//
//
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Text;
using System.Text.RegularExpressions;
using PicklesDoc.Pickles.ObjectModel;
namespace PicklesDoc.Pickles.TestFrameworks.NUnit
{
public class NUnitExampleSignatureBuilder
{
public Regex Build(ScenarioOutline scenarioOutline, string[] row)
{
var stringBuilder = new StringBuilder();
stringBuilder.Append(scenarioOutline.Name.ToLowerInvariant().Replace(" ", string.Empty) + "\\(");
foreach (string value in row)
{
stringBuilder.AppendFormat("\"{0}\",", value.ToLowerInvariant().Replace(@"\", string.Empty).Replace(@"$", @"\$"));
}
stringBuilder.Remove(stringBuilder.Length - 1, 1);
return new Regex(stringBuilder.ToString());
}
}
}
| apache-2.0 | C# |
49cab0696bbb2a1b8d8ebe252cacedd0d95c7dd4 | Update XmlExtension.cs | yuanrui/Examples,yuanrui/Examples,yuanrui/Examples,yuanrui/Examples,yuanrui/Examples | Simple.Common/Extensions/XmlExtension.cs | Simple.Common/Extensions/XmlExtension.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace Simple.Common.Extensions
{
public static class XmlExtension
{
public static string GetNodeText(this XmlNode node, string xpath)
{
var singleNode = node.SelectSingleNode(xpath);
if (singleNode == null)
{
return string.Empty;
}
return singleNode.InnerText;
}
public static string GetNodeText(this XmlNode node, string xpath, XmlNamespaceManager nsmgr)
{
var singleNode = node.SelectSingleNode(xpath, nsmgr);
if (singleNode == null)
{
return string.Empty;
}
return singleNode.InnerText;
}
public static List<XElement> AddElement(this List<XElement> list, string name, string value)
{
if (list == null)
{
return list;
}
if (string.IsNullOrEmpty(value))
{
return list;
}
list.Add(new XElement(name, value));
return list;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace Simple.Common.Extensions
{
public static class XmlExtension
{
public static string GetNodeText(this XmlNode node, string xpath)
{
var singleNode = node.SelectSingleNode(xpath);
if (singleNode == null)
{
return string.Empty;
}
return singleNode.InnerText;
}
public static string GetNodeText(this XmlNode node, string xpath, XmlNamespaceManager nsmgr)
{
var singleNode = node.SelectSingleNode(xpath, nsmgr);
if (singleNode == null)
{
return string.Empty;
}
return singleNode.InnerText;
}
}
}
| apache-2.0 | C# |
cbc6d82a85ee412a85088324287ce5da365814c7 | Add setter to Proxy property. | GetTabster/Tabster | Tabster.Core/Searching/ISearchService.cs | Tabster.Core/Searching/ISearchService.cs | #region
using System.Net;
using Tabster.Core.Data.Processing;
using Tabster.Core.Types;
#endregion
namespace Tabster.Core.Searching
{
/// <summary>
/// Tab service which enables searching.
/// </summary>
public interface ISearchService
{
/// <summary>
/// Service name.
/// </summary>
string Name { get; }
/// <summary>
/// Associated parser.
/// </summary>
ITablatureWebpageImporter Parser { get; }
/// <summary>
/// Service flags.
/// </summary>
SearchServiceFlags Flags { get; }
/// <summary>
/// Proxy settings.
/// </summary>
WebProxy Proxy { get; set; }
/// <summary>
/// Determines whether the service supports ratings.
/// </summary>
bool SupportsRatings { get; }
/// <summary>
/// Queries service and returns results based on search parameters.
/// </summary>
/// <param name="query"> Search query. </param>
SearchResult[] Search(SearchQuery query);
///<summary>
/// Determines whether a specific TabType is supported by the service.
///</summary>
///<param name="type"> The type to check. </param>
///<returns> True if the type is supported by the service; otherwise, False. </returns>
bool SupportsTabType(TabType type);
}
} | #region
using System.Net;
using Tabster.Core.Data.Processing;
using Tabster.Core.Types;
#endregion
namespace Tabster.Core.Searching
{
/// <summary>
/// Tab service which enables searching.
/// </summary>
public interface ISearchService
{
/// <summary>
/// Service name.
/// </summary>
string Name { get; }
/// <summary>
/// Associated parser.
/// </summary>
ITablatureWebpageImporter Parser { get; }
/// <summary>
/// Service flags.
/// </summary>
SearchServiceFlags Flags { get; }
/// <summary>
/// Proxy settings.
/// </summary>
WebProxy Proxy { get; }
/// <summary>
/// Determines whether the service supports ratings.
/// </summary>
bool SupportsRatings { get; }
/// <summary>
/// Queries service and returns results based on search parameters.
/// </summary>
/// <param name="query"> Search query. </param>
SearchResult[] Search(SearchQuery query);
///<summary>
/// Determines whether a specific TabType is supported by the service.
///</summary>
///<param name="type"> The type to check. </param>
///<returns> True if the type is supported by the service; otherwise, False. </returns>
bool SupportsTabType(TabType type);
}
} | apache-2.0 | C# |
58a11ff27a790bb834483128188d5bbea25b686c | test number 3 | llthelinkll/PowYingChub,llthelinkll/opencv_project_1,llthelinkll/opencv_project_1,llthelinkll/opencv_project_1,llthelinkll/PowYingChub,llthelinkll/PowYingChub,llthelinkll/opencv_project_1,llthelinkll/PowYingChub | Unity/PowYingChub/Assets/SocketClient.cs | Unity/PowYingChub/Assets/SocketClient.cs | using UnityEngine;
using System;
using System.Collections;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
public class SocketClient : MonoBehaviour {
// Use this for initialization
//private const int listenPort = 5005;
public GameObject hero;
private float xPos = 10.0f;
private int test;
public int test2;
public int test3;
Thread receiveThread;
UdpClient client;
public int port;
//info
public string lastReceivedUDPPacket = "";
public string allReceivedUDPPackets = "";
void Start () {
init();
}
void OnGUI(){
Rect rectObj=new Rect (40,10,200,400);
GUIStyle style = new GUIStyle ();
style .alignment = TextAnchor.UpperLeft;
GUI .Box (rectObj,"# UDPReceive\n127.0.0.1 "+port +" #\n"
//+ "shell> nc -u 127.0.0.1 : "+port +" \n"
+ "\nLast Packet: \n"+ lastReceivedUDPPacket
//+ "\n\nAll Messages: \n"+allReceivedUDPPackets
,style );
}
private void init(){
print ("UPDSend.init()");
port = 5005;
print ("Sending to 127.0.0.1 : " + port);
receiveThread = new Thread (new ThreadStart(ReceiveData));
receiveThread.IsBackground = true;
receiveThread.Start ();
}
private void ReceiveData(){
client = new UdpClient (port);
while (true) {
try{
IPEndPoint anyIP = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port);
byte[] data = client.Receive(ref anyIP);
string text = Encoding.UTF8.GetString(data);
print (">> " + text);
lastReceivedUDPPacket=text;
allReceivedUDPPackets=allReceivedUDPPackets+text;
xPos = float.Parse(text);
xPos *= 0.021818f;
}catch(Exception e){
print (e.ToString());
}
}
}
public string getLatestUDPPacket(){
allReceivedUDPPackets = "";
return lastReceivedUDPPacket;
}
// Update is called once per frame
void Update () {
hero.transform.position = new Vector3(xPos-6.0f,-3,0);
}
void OnApplicationQuit(){
if (receiveThread != null) {
receiveThread.Abort();
Debug.Log(receiveThread.IsAlive); //must be false
}
}
}
| using UnityEngine;
using System;
using System.Collections;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
public class SocketClient : MonoBehaviour {
// Use this for initialization
//private const int listenPort = 5005;
public GameObject hero;
private float xPos = 10.0f;
private int test;
public int test2;
Thread receiveThread;
UdpClient client;
public int port;
//info
public string lastReceivedUDPPacket = "";
public string allReceivedUDPPackets = "";
void Start () {
init();
}
void OnGUI(){
Rect rectObj=new Rect (40,10,200,400);
GUIStyle style = new GUIStyle ();
style .alignment = TextAnchor.UpperLeft;
GUI .Box (rectObj,"# UDPReceive\n127.0.0.1 "+port +" #\n"
//+ "shell> nc -u 127.0.0.1 : "+port +" \n"
+ "\nLast Packet: \n"+ lastReceivedUDPPacket
//+ "\n\nAll Messages: \n"+allReceivedUDPPackets
,style );
}
private void init(){
print ("UPDSend.init()");
port = 5005;
print ("Sending to 127.0.0.1 : " + port);
receiveThread = new Thread (new ThreadStart(ReceiveData));
receiveThread.IsBackground = true;
receiveThread.Start ();
}
private void ReceiveData(){
client = new UdpClient (port);
while (true) {
try{
IPEndPoint anyIP = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port);
byte[] data = client.Receive(ref anyIP);
string text = Encoding.UTF8.GetString(data);
print (">> " + text);
lastReceivedUDPPacket=text;
allReceivedUDPPackets=allReceivedUDPPackets+text;
xPos = float.Parse(text);
xPos *= 0.021818f;
}catch(Exception e){
print (e.ToString());
}
}
}
public string getLatestUDPPacket(){
allReceivedUDPPackets = "";
return lastReceivedUDPPacket;
}
// Update is called once per frame
void Update () {
hero.transform.position = new Vector3(xPos-6.0f,-3,0);
}
void OnApplicationQuit(){
if (receiveThread != null) {
receiveThread.Abort();
Debug.Log(receiveThread.IsAlive); //must be false
}
}
}
| mit | C# |
a9bf79e08b64e0eab5721a4422deddbfec146705 | bump version | poma/HotsStats | StatsDisplay/Properties/AssemblyInfo.cs | StatsDisplay/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("HotsStats")]
[assembly: AssemblyDescription("An app that shows player stats in Heroes of the Storm")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HotsStats")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.2")]
[assembly: AssemblyFileVersion("0.5.2")]
| 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("HotsStats")]
[assembly: AssemblyDescription("An app that shows player stats in Heroes of the Storm")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HotsStats")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.1")]
[assembly: AssemblyFileVersion("0.5.1")]
| mit | C# |
d559e9978db765162e37db0f296440e57577e9a8 | Update constant name. | Lombiq/Helpful-Extensions,Lombiq/Helpful-Extensions | Extensions/Widgets/Drivers/PortalMenuWidgetDisplayDriver.cs | Extensions/Widgets/Drivers/PortalMenuWidgetDisplayDriver.cs | using Lombiq.HelpfulExtensions.Extensions.Widgets.ViewModels;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Display.ContentDisplay;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.DisplayManagement.Views;
using OrchardCore.Navigation;
using System.Threading.Tasks;
using static Lombiq.HelpfulExtensions.Extensions.Widgets.WidgetTypes;
using static Lombiq.HelpfulLibraries.Libraries.Navigation.PortalNavigationProviderBase;
namespace Lombiq.HelpfulExtensions.Extensions.Widgets
{
public class PortalMenuWidgetDisplayDriver : ContentDisplayDriver
{
private readonly INavigationManager _navigationManager;
private readonly IActionContextAccessor _actionContextAccessor;
public PortalMenuWidgetDisplayDriver(
INavigationManager navigationManager,
IActionContextAccessor actionContextAccessor)
{
_navigationManager = navigationManager;
_actionContextAccessor = actionContextAccessor;
}
public override async Task<IDisplayResult> DisplayAsync(ContentItem model, BuildDisplayContext context)
{
if (model.ContentType != PortalMenuWidget) return null;
var menuItems = await _navigationManager.BuildMenuAsync(
PortalNavigationName,
_actionContextAccessor.ActionContext);
return Initialize<PortalMenuWidgetViewModel>(PortalMenuWidget, viewModel => viewModel.MenuItems = menuItems);
}
}
}
| using Lombiq.HelpfulExtensions.Extensions.Widgets.ViewModels;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Display.ContentDisplay;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.DisplayManagement.Views;
using OrchardCore.Navigation;
using System.Threading.Tasks;
using static Lombiq.HelpfulExtensions.Extensions.Widgets.WidgetTypes;
using static Lombiq.HelpfulLibraries.Libraries.Navigation.PortalNavigationProviderBase;
namespace Lombiq.HelpfulExtensions.Extensions.Widgets
{
public class PortalMenuWidgetDisplayDriver : ContentDisplayDriver
{
private readonly INavigationManager _navigationManager;
private readonly IActionContextAccessor _actionContextAccessor;
public PortalMenuWidgetDisplayDriver(
INavigationManager navigationManager,
IActionContextAccessor actionContextAccessor)
{
_navigationManager = navigationManager;
_actionContextAccessor = actionContextAccessor;
}
public override async Task<IDisplayResult> DisplayAsync(ContentItem model, BuildDisplayContext context)
{
if (model.ContentType != PortalMenuWidget) return null;
var menuItems = await _navigationManager.BuildMenuAsync(
NavigationName,
_actionContextAccessor.ActionContext);
return Initialize<PortalMenuWidgetViewModel>(PortalMenuWidget, viewModel => viewModel.MenuItems = menuItems);
}
}
}
| bsd-3-clause | C# |
f5946c0e07b7aa39dd7fb14e62a29c7cc77f3f71 | Fix wrong license header | peppy/osu,naoey/osu,2yangk23/osu,UselessToucan/osu,smoogipooo/osu,Drezi126/osu,ZLima12/osu,peppy/osu,2yangk23/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,naoey/osu,EVAST9919/osu,Nabile-Rahmani/osu,UselessToucan/osu,peppy/osu-new,ppy/osu,ZLima12/osu,naoey/osu,peppy/osu,DrabWeb/osu,Frontear/osuKyzer,smoogipoo/osu,johnneijzen/osu,NeoAdonis/osu,johnneijzen/osu,EVAST9919/osu,DrabWeb/osu,DrabWeb/osu | osu.Game/Overlays/Settings/SettingsButton.cs | osu.Game/Overlays/Settings/SettingsButton.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsButton : OsuButton
{
public SettingsButton()
{
RelativeSizeAxes = Axes.X;
Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS };
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsButton : OsuButton
{
public SettingsButton()
{
RelativeSizeAxes = Axes.X;
Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS };
}
}
}
| mit | C# |
bc89764a7235f80a24a28eb9064a100be33076a1 | Fix test assertion for hostname to ip resolver | rapidcore/rapidcore,rapidcore/rapidcore | test/unit/Network/HostnameToIpResolverTest.cs | test/unit/Network/HostnameToIpResolverTest.cs | using System.Net.Sockets;
using System.Threading.Tasks;
using RapidCore.Network;
using Xunit;
namespace RapidCore.UnitTests.Network
{
public class HostnameToIpResolverTest
{
[Fact]
public async Task HostnameToIpResolver_can_resolveAsync()
{
var resolver = new HostnameToIpResolver();
var ip = await resolver.ResolveToIpv4Async("localhost");
Assert.Equal("127.0.0.1", ip);
}
[Fact]
public async Task HostnameToIpResolve_can_fail()
{
var resolver = new HostnameToIpResolver();
var exception =
await Record.ExceptionAsync(async () => await resolver.ResolveToIpv4Async("this-host-is-invalid"));
Assert.NotNull(exception);
Assert.IsAssignableFrom<SocketException>(exception);
}
}
}
| using System.Net.Sockets;
using System.Threading.Tasks;
using RapidCore.Network;
using Xunit;
namespace RapidCore.UnitTests.Network
{
public class HostnameToIpResolverTest
{
[Fact]
public async Task HostnameToIpResolver_can_resolveAsync()
{
var resolver = new HostnameToIpResolver();
var ip = await resolver.ResolveToIpv4Async("localhost");
Assert.Equal("127.0.0.1", ip);
}
[Fact]
public async Task HostnameToIpResolve_can_fail()
{
var resolver = new HostnameToIpResolver();
await Assert.ThrowsAsync<SocketException>(async () => await resolver.ResolveToIpv4Async("this-host-is-invalid"));
}
}
}
| mit | C# |
3980f84a540a341924408d03b1fb9af40422882a | Add bundle optimization on release | laedit/Borderlands2-Golden-Keys,laedit/Borderlands2-Golden-Keys | Borderlands2GoldendKeys/Borderlands2GoldendKeys/App_Start/BundleConfig.cs | Borderlands2GoldendKeys/Borderlands2GoldendKeys/App_Start/BundleConfig.cs | using System.Web;
using System.Web.Optimization;
namespace Borderlands2GoldendKeys
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryunobt").Include(
"~/Scripts/jquery.unobtrusive-ajax.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new ScriptBundle("~/bundles/site").Include(
"~/Scripts/site.js"));
bundles.Add(new ScriptBundle("~/bundles/ga").Include(
"~/Scripts/ga.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootswatch.slate.min.css",
"~/Content/site.css"));
#if !DEBUG
BundleTable.EnableOptimizations = true;
#endif
}
}
}
| using System.Web;
using System.Web.Optimization;
namespace Borderlands2GoldendKeys
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryunobt").Include(
"~/Scripts/jquery.unobtrusive-ajax.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new ScriptBundle("~/bundles/site").Include(
"~/Scripts/site.js"));
bundles.Add(new ScriptBundle("~/bundles/ga").Include(
"~/Scripts/ga.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
//"~/Content/bootstrap.css",
"~/Content/bootswatch.slate.min.css",
"~/Content/site.css"));
}
}
}
| apache-2.0 | C# |
377a94a26be59be0ca73756a53b6b52bf7f25a27 | update contansts to include csomtimeout | 8v060htwyc/PnP,OneBitSoftware/PnP,PaoloPia/PnP,zrahui/PnP,yagoto/PnP,PaoloPia/PnP,OneBitSoftware/PnP,vman/PnP,IvanTheBearable/PnP,OzMakka/PnP,PaoloPia/PnP,brennaman/PnP,vman/PnP,jlsfernandez/PnP,russgove/PnP,OzMakka/PnP,russgove/PnP,zrahui/PnP,jlsfernandez/PnP,8v060htwyc/PnP,OzMakka/PnP,vman/PnP,IvanTheBearable/PnP,OfficeDev/PnP,jlsfernandez/PnP,OfficeDev/PnP,8v060htwyc/PnP,yagoto/PnP,OneBitSoftware/PnP,zrahui/PnP,OfficeDev/PnP,OneBitSoftware/PnP,russgove/PnP,yagoto/PnP,IvanTheBearable/PnP,PaoloPia/PnP,brennaman/PnP,8v060htwyc/PnP,OfficeDev/PnP,brennaman/PnP,yagoto/PnP | Solutions/Provisioning.UX.App/Provisioning.Common/Data/SPDataConstants.cs | Solutions/Provisioning.UX.App/Provisioning.Common/Data/SPDataConstants.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Provisioning.Common.Data
{
internal static class SPDataConstants
{
#region SharePoint Metadata Repository
public const string LIST_URL_SITECLASSIFICATION = "Lists/SiteClassifications";
public const string LIST_URL_DIVISIONS = "Lists/Divisions";
public const string LIST_URL_FUNCTIONS = "Lists/Functions";
public const string LIST_URL_LANGUAGES = "Lists/Languages";
public const string LIST_URL_REGIONS = "Lists/Regions";
public const string LIST_URL_TIMEZONES = "Lists/TimeZone";
public const string LIST_URL_APPSETTINGS = "Lists/AppSettings";
public const string LIST_TITLE_SITECLASSIFICATION = "Site Classifications";
public const string LIST_TITLE_DIVISIONS = "Divisions";
public const string LIST_TITLE_FUNCTIONS = "Functions";
public const string LIST_TITLE_LANGUAGES = "Languages";
public const string LIST_TITLE_REGIONS = "Regions";
public const string LIST_TITLE_TIMEZONES = "TimeZone";
public const string LIST_TITLE_APPSETTINGS = "AppSettings";
public const int CSOM_WAIT_TIME = -1;
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Provisioning.Common.Data
{
internal static class SPDataConstants
{
#region SharePoint Metadata Repository
public const string LIST_URL_SITECLASSIFICATION = "Lists/SiteClassifications";
public const string LIST_URL_DIVISIONS = "Lists/Divisions";
public const string LIST_URL_FUNCTIONS = "Lists/Functions";
public const string LIST_URL_LANGUAGES = "Lists/Languages";
public const string LIST_URL_REGIONS = "Lists/Regions";
public const string LIST_URL_TIMEZONES = "Lists/TimeZone";
public const string LIST_URL_APPSETTINGS = "Lists/AppSettings";
public const string LIST_TITLE_SITECLASSIFICATION = "Site Classifications";
public const string LIST_TITLE_DIVISIONS = "Divisions";
public const string LIST_TITLE_FUNCTIONS = "Functions";
public const string LIST_TITLE_LANGUAGES = "Languages";
public const string LIST_TITLE_REGIONS = "Regions";
public const string LIST_TITLE_TIMEZONES = "TimeZone";
public const string LIST_TITLE_APPSETTINGS = "AppSettings";
#endregion
}
}
| mit | C# |
6a9681b955e3b26ea7d2fc89b5b5de4105434df9 | Add CanManagePlots on project creation | leotsarev/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net | JoinRpg.DataModel/ProjectAcl.cs | JoinRpg.DataModel/ProjectAcl.cs | using System;
namespace JoinRpg.DataModel
{
// ReSharper disable once ClassWithVirtualMembersNeverInherited.Global (required by LINQ)
public class ProjectAcl
{
public int ProjectAclId { get; set; }
public int ProjectId { get; set; }
public virtual Project Project { get; set; }
public int UserId { get; set; }
public virtual User User { get; set; }
public Guid Token { get; set; } = new Guid();
public bool CanChangeFields { get; set; }
public bool CanChangeProjectProperties { get; set; }
public bool IsOwner { get; set; }
public bool CanGrantRights { get; set; }
public bool CanManageClaims { get; set; }
public bool CanEditRoles { get; set; }
public bool CanManageMoney { get; set; }
public bool CanSendMassMails { get; set; }
public bool CanManagePlots { get; set; }
public static ProjectAcl CreateRootAcl(int userId)
{
return new ProjectAcl
{
CanChangeFields = true,
CanChangeProjectProperties = true,
UserId = userId,
IsOwner = true,
CanGrantRights = true,
CanManageClaims = true,
CanEditRoles = true,
CanManageMoney = true,
CanSendMassMails = true,
CanManagePlots = true,
};
}
}
}
| using System;
namespace JoinRpg.DataModel
{
// ReSharper disable once ClassWithVirtualMembersNeverInherited.Global (required by LINQ)
public class ProjectAcl
{
public int ProjectAclId { get; set; }
public int ProjectId { get; set; }
public virtual Project Project { get; set; }
public int UserId { get; set; }
public virtual User User { get; set; }
public Guid Token { get; set; } = new Guid();
public bool CanChangeFields { get; set; }
public bool CanChangeProjectProperties { get; set; }
public bool IsOwner { get; set; }
public bool CanGrantRights { get; set; }
public bool CanManageClaims { get; set; }
public bool CanEditRoles { get; set; }
public bool CanManageMoney { get; set; }
public bool CanSendMassMails { get; set; }
public bool CanManagePlots { get; set; }
public static ProjectAcl CreateRootAcl(int userId)
{
return new ProjectAcl
{
CanChangeFields = true,
CanChangeProjectProperties = true,
UserId = userId,
IsOwner = true,
CanGrantRights = true,
CanManageClaims = true,
CanEditRoles = true,
CanManageMoney = true,
CanSendMassMails = true
};
}
}
}
| mit | C# |
8320cebd7ab98835cca855fb01789ed6696c6d43 | fix classical plugin failing to start when use=shell | stakira/OpenUtau,stakira/OpenUtau | OpenUtau.Core/Classic/Plugin.cs | OpenUtau.Core/Classic/Plugin.cs | using System.Diagnostics;
using System.IO;
namespace OpenUtau.Classic {
public class Plugin {
public string Name;
public string Executable;
public bool AllNotes;
public bool UseShell;
public void Run(string tempFile) {
if (!File.Exists(Executable)) {
throw new FileNotFoundException($"Executable {Executable} not found.");
}
var startInfo = new ProcessStartInfo() {
FileName = Executable,
Arguments = tempFile,
WorkingDirectory = Path.GetDirectoryName(Executable),
UseShellExecute = UseShell,
};
using (var process = Process.Start(startInfo)) {
process.WaitForExit();
}
}
public override string ToString() => Name;
}
}
| using System.Diagnostics;
using System.IO;
namespace OpenUtau.Classic {
public class Plugin {
public string Name;
public string Executable;
public bool AllNotes;
public bool UseShell;
public void Run(string tempFile) {
if (!File.Exists(Executable)) {
throw new FileNotFoundException($"Executable {Executable} not found.");
}
var startInfo = UseShell
? new ProcessStartInfo() {
FileName = "cmd.exe",
Arguments = $"/K \"{Executable}\" \"{tempFile}\"",
UseShellExecute = true,
}
: new ProcessStartInfo() {
FileName = Executable,
Arguments = tempFile,
WorkingDirectory = Path.GetDirectoryName(Executable),
};
using (var process = Process.Start(startInfo)) {
process.WaitForExit();
}
}
public override string ToString() => Name;
}
}
| mit | C# |
80783f66bc6c241e3206b358d7bfec81f20f075f | Change raycast provider tests to use PlaymodeTestUtilities instead of TestUtilities | killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity | Assets/MixedRealityToolkit.Tests/PlayModeTests/InputSystem/DefaultRaycastProviderTest.cs | Assets/MixedRealityToolkit.Tests/PlayModeTests/InputSystem/DefaultRaycastProviderTest.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#if !WINDOWS_UWP
using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.Physics;
using NUnit.Framework;
using System.Collections;
using UnityEngine;
using UnityEngine.TestTools;
namespace Microsoft.MixedReality.Toolkit.Tests.Input
{
class DefaultRaycastProviderTest
{
private DefaultRaycastProvider defaultRaycastProvider;
/// <summary>
/// Validates that when nothing is hit, the default raycast provider doesn't throw an
/// exception and that the MixedRealityRaycastHit is null.
/// </summary>
[UnityTest]
public IEnumerator TestNoHit()
{
// step and layerMasks are set arbitrarily (to something which will not generate a hit).
RayStep step = new RayStep(Vector3.zero, Vector3.up);
LayerMask[] layerMasks = new LayerMask[] { UnityEngine.Physics.DefaultRaycastLayers };
MixedRealityRaycastHit hitInfo;
Assert.IsFalse(defaultRaycastProvider.Raycast(step, layerMasks, out hitInfo));
Assert.IsFalse(hitInfo.raycastValid);
yield return null;
}
[SetUp]
public void SetUp()
{
PlayModeTestUtilities.Setup();
defaultRaycastProvider = new DefaultRaycastProvider(null, null, null);
}
[TearDown]
public void TearDown()
{
PlayModeTestUtilities.TearDown();
}
}
}
#endif | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#if !WINDOWS_UWP
using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.Physics;
using NUnit.Framework;
using System.Collections;
using UnityEngine;
using UnityEngine.TestTools;
namespace Microsoft.MixedReality.Toolkit.Tests.Input
{
class DefaultRaycastProviderTest
{
private DefaultRaycastProvider defaultRaycastProvider;
/// <summary>
/// Validates that when nothing is hit, the default raycast provider doesn't throw an
/// exception and that the MixedRealityRaycastHit is null.
/// </summary>
[UnityTest]
public IEnumerator TestNoHit()
{
// step and layerMasks are set arbitrarily (to something which will not generate a hit).
RayStep step = new RayStep(Vector3.zero, Vector3.up);
LayerMask[] layerMasks = new LayerMask[] { UnityEngine.Physics.DefaultRaycastLayers };
MixedRealityRaycastHit hitInfo;
Assert.IsFalse(defaultRaycastProvider.Raycast(step, layerMasks, out hitInfo));
Assert.IsFalse(hitInfo.raycastValid);
yield return null;
}
[SetUp]
public void SetUp()
{
TestUtilities.InitializeMixedRealityToolkitAndCreateScenes(true);
TestUtilities.InitializePlayspace();
defaultRaycastProvider = new DefaultRaycastProvider(null, null, null);
}
[TearDown]
public void TearDown()
{
TestUtilities.ShutdownMixedRealityToolkit();
}
}
}
#endif | mit | C# |
68cd02d07a4b882bfe2e781c68dda2e2e9fceb79 | Fix add cookie throwing because of the empty domain | restsharp/RestSharp | src/RestSharp/RestClientExtensions.Config.cs | src/RestSharp/RestClientExtensions.Config.cs | // Copyright © 2009-2020 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community
//
// 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.Net;
using System.Text;
using RestSharp.Authenticators;
using RestSharp.Extensions;
namespace RestSharp;
public static partial class RestClientExtensions {
[PublicAPI]
public static RestResponse<T> Deserialize<T>(this RestClient client, RestResponse response) => client.Deserialize<T>(response.Request!, response);
/// <summary>
/// Allows to use a custom way to encode URL parameters
/// </summary>
/// <param name="client"></param>
/// <param name="encoder">A delegate to encode URL parameters</param>
/// <example>client.UseUrlEncoder(s => HttpUtility.UrlEncode(s));</example>
/// <returns></returns>
public static RestClient UseUrlEncoder(this RestClient client, Func<string, string> encoder) => client.With(x => x.Encode = encoder);
/// <summary>
/// Allows to use a custom way to encode query parameters
/// </summary>
/// <param name="client"></param>
/// <param name="queryEncoder">A delegate to encode query parameters</param>
/// <example>client.UseUrlEncoder((s, encoding) => HttpUtility.UrlEncode(s, encoding));</example>
/// <returns></returns>
public static RestClient UseQueryEncoder(this RestClient client, Func<string, Encoding, string> queryEncoder)
=> client.With(x => x.EncodeQuery = queryEncoder);
/// <summary>
/// Adds cookie to the <seealso cref="HttpClient"/> cookie container.
/// </summary>
/// <param name="client"></param>
/// <param name="name">Cookie name</param>
/// <param name="value">Cookie value</param>
/// <param name="path">Cookie path</param>
/// <param name="domain">Cookie domain, must not be an empty string</param>
/// <returns></returns>
public static RestClient AddCookie(this RestClient client, string name, string value, string path, string domain) {
lock (client.CookieContainer) {
client.CookieContainer.Add(new Cookie(name, value, path, domain));
}
return client;
}
public static RestClient UseAuthenticator(this RestClient client, IAuthenticator authenticator)
=> client.With(x => x.Authenticator = authenticator);
} | // Copyright © 2009-2020 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community
//
// 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.Net;
using System.Text;
using RestSharp.Authenticators;
using RestSharp.Extensions;
namespace RestSharp;
public static partial class RestClientExtensions {
[PublicAPI]
public static RestResponse<T> Deserialize<T>(this RestClient client, RestResponse response) => client.Deserialize<T>(response.Request!, response);
/// <summary>
/// Allows to use a custom way to encode URL parameters
/// </summary>
/// <param name="client"></param>
/// <param name="encoder">A delegate to encode URL parameters</param>
/// <example>client.UseUrlEncoder(s => HttpUtility.UrlEncode(s));</example>
/// <returns></returns>
public static RestClient UseUrlEncoder(this RestClient client, Func<string, string> encoder) => client.With(x => x.Encode = encoder);
/// <summary>
/// Allows to use a custom way to encode query parameters
/// </summary>
/// <param name="client"></param>
/// <param name="queryEncoder">A delegate to encode query parameters</param>
/// <example>client.UseUrlEncoder((s, encoding) => HttpUtility.UrlEncode(s, encoding));</example>
/// <returns></returns>
public static RestClient UseQueryEncoder(this RestClient client, Func<string, Encoding, string> queryEncoder)
=> client.With(x => x.EncodeQuery = queryEncoder);
/// <summary>
/// Adds cookie to the <seealso cref="HttpClient"/> cookie container.
/// </summary>
/// <param name="client"></param>
/// <param name="name">Cookie name</param>
/// <param name="value">Cookie value</param>
/// <returns></returns>
public static RestClient AddCookie(this RestClient client, string name, string value) {
lock (client.CookieContainer) {
client.CookieContainer.Add(new Cookie(name, value));
}
return client;
}
public static RestClient UseAuthenticator(this RestClient client, IAuthenticator authenticator)
=> client.With(x => x.Authenticator = authenticator);
} | apache-2.0 | C# |
b669d6ed960a5077edd2ed3375cf6f5bcedd5b4f | Fix build error after merge | AMVSoftware/NSaga | src/Tests.Benchmarking/FastSagaRepository.cs | src/Tests.Benchmarking/FastSagaRepository.cs | using System;
using System.Collections.Generic;
using NSaga;
namespace Benchmarking
{
/// <summary>
/// Saga repository only for benchmarking.
/// Does not really store anything
/// </summary>
internal class FastSagaRepository : ISagaRepository
{
private readonly ISagaFactory sagaFactory;
public FastSagaRepository(ISagaFactory sagaFactory)
{
this.sagaFactory = sagaFactory;
}
public TSaga Find<TSaga>(Guid correlationId) where TSaga : class, IAccessibleSaga
{
if (correlationId == Program.FirstGuid)
{
return null;
}
var saga = sagaFactory.ResolveSaga<TSaga>();
Reflection.Set(saga, "CorrelationId", correlationId);
return saga;
}
public void Save<TSaga>(TSaga saga) where TSaga : class, IAccessibleSaga
{
// nothing
}
public void Complete<TSaga>(TSaga saga) where TSaga : class, IAccessibleSaga
{
// nothing
}
public void Complete(Guid correlationId)
{
// nothing
}
}
}
| using System;
using System.Collections.Generic;
using NSaga;
namespace Benchmarking
{
/// <summary>
/// Saga repository only for benchmarking.
/// Does not really store anything
/// </summary>
internal class FastSagaRepository : ISagaRepository
{
private readonly ISagaFactory sagaFactory;
public FastSagaRepository(ISagaFactory sagaFactory)
{
this.sagaFactory = sagaFactory;
}
public TSaga Find<TSaga>(Guid correlationId) where TSaga : class
{
if (correlationId == Program.FirstGuid)
{
return null;
}
var saga = sagaFactory.Resolve<TSaga>();
Reflection.Set(saga, "CorrelationId", correlationId);
return saga;
}
public void Save<TSaga>(TSaga saga) where TSaga : class
{
// nothing
}
public void Complete<TSaga>(TSaga saga) where TSaga : class
{
// nothing
}
public void Complete(Guid correlationId)
{
// nothing
}
}
}
| mit | C# |
9a36b21c307641d238327336b7970b3b60695aaf | Remove Leg option from PlayOptions | pragmatrix/NEventSocket,pragmatrix/NEventSocket,danbarua/NEventSocket,danbarua/NEventSocket | src/NEventSocket/FreeSwitch/PlayOptions.cs | src/NEventSocket/FreeSwitch/PlayOptions.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="PlayOptions.cs" company="Dan Barua">
// (C) Dan Barua and contributors. Licensed under the Mozilla Public License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace NEventSocket.FreeSwitch
{
/// <summary>
/// Options for customizing the behaviour of the Play dialplan application
/// </summary>
public class PlayOptions
{
private int loops = 1;
/// <summary>
/// Gets or sets the number of repetitions to play (default 1).
/// </summary>
public int Loops
{
get
{
return loops;
}
set
{
loops = value;
}
}
}
} | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="PlayOptions.cs" company="Dan Barua">
// (C) Dan Barua and contributors. Licensed under the Mozilla Public License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace NEventSocket.FreeSwitch
{
/// <summary>
/// Options for customizing the behaviour of the Play dialplan application
/// </summary>
public class PlayOptions
{
private int loops = 1;
/// <summary>
/// Gets or sets the number of repetitions to play (default 1).
/// </summary>
public int Loops
{
get
{
return loops;
}
set
{
loops = value;
}
}
/// <summary>
/// Gets or sets which <seealso cref="Leg"/> of a call to play on.
/// </summary>
public Leg Leg { get; set; }
}
} | mpl-2.0 | C# |
bf78f8512b16bae16f7c2f3a7363b7004be6678a | Fix warning | SaladLab/TrackableData,SaladLab/TrackableData,SaladbowlCreative/TrackableData,SaladbowlCreative/TrackableData | plugins/TrackableData.Redis.Tests/Redis.cs | plugins/TrackableData.Redis.Tests/Redis.cs | using System;
using System.Configuration;
using StackExchange.Redis;
namespace TrackableData.Redis.Tests
{
public sealed class Redis : IDisposable
{
public ConnectionMultiplexer Connection { get; private set; }
public IDatabase Db
{
get { return Connection.GetDatabase(0); }
}
public Redis()
{
var cstr = ConfigurationManager.ConnectionStrings["TestRedis"].ConnectionString;
Connection = ConnectionMultiplexer.ConnectAsync(cstr + ",allowAdmin=true").Result;
}
public void Dispose()
{
if (Connection != null)
{
Connection.Dispose();
Connection = null;
}
}
}
}
| using System;
using System.Configuration;
using StackExchange.Redis;
namespace TrackableData.Redis.Tests
{
public class Redis : IDisposable
{
public ConnectionMultiplexer Connection { get; private set; }
public IDatabase Db
{
get { return Connection.GetDatabase(0); }
}
public Redis()
{
var cstr = ConfigurationManager.ConnectionStrings["TestRedis"].ConnectionString;
Connection = ConnectionMultiplexer.ConnectAsync(cstr + ",allowAdmin=true").Result;
}
public void Dispose()
{
if (Connection != null)
{
Connection.Dispose();
Connection = null;
}
}
}
}
| mit | C# |
365e92a71d95d34619e6277aae7614edbc814916 | return data from request only when it is populated | AnthonySteele/TeamCityChangeNotifier | TeamCityChangeNotifier/Http/TeamCityAuth.cs | TeamCityChangeNotifier/Http/TeamCityAuth.cs | using System;
using System.Text;
using TeamCityChangeNotifier.Args;
using TeamCityChangeNotifier.Helpers;
using TeamCityChangeNotifier.XmlParsers;
namespace TeamCityChangeNotifier.Http
{
public class TeamCityAuth
{
private readonly ConfigSettings _settings = new ConfigSettings();
private readonly Request _request;
public TeamCityAuth(Request request)
{
_request = request;
}
public string AuthInfo()
{
var teamCityUser = ReadTeamCityUser();
if (string.IsNullOrEmpty(teamCityUser))
{
throw new ParseException("No teamcity user name found in config or commandline");
}
var teamCityPassword = ReadTeamCityPassword();
if (string.IsNullOrEmpty(teamCityPassword))
{
throw new ParseException("No teamcity password found in config or commandline");
}
string authInfo = teamCityUser + ":" + teamCityPassword;
var encodedAuthInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
return encodedAuthInfo;
}
private string ReadTeamCityUser()
{
if (_request != null && (! string.IsNullOrEmpty(_request.TeamCityUser)))
{
return _request.TeamCityUser;
}
if (!string.IsNullOrEmpty(_settings.TeamCityUser))
{
return _settings.TeamCityUser;
}
return null;
}
private string ReadTeamCityPassword()
{
if (_request != null && (!string.IsNullOrEmpty(_request.TeamCityPassword)))
{
return _request.TeamCityPassword;
}
if (!string.IsNullOrEmpty(_settings.TeamCityPassword))
{
return _settings.TeamCityPassword;
}
return null;
}
}
}
| using System;
using System.Text;
using TeamCityChangeNotifier.Args;
using TeamCityChangeNotifier.Helpers;
using TeamCityChangeNotifier.XmlParsers;
namespace TeamCityChangeNotifier.Http
{
public class TeamCityAuth
{
private readonly ConfigSettings _settings = new ConfigSettings();
private readonly Request _request;
public TeamCityAuth(Request request)
{
_request = request;
}
public string AuthInfo()
{
var teamCityUser = ReadTeamCityUser();
if (string.IsNullOrEmpty(teamCityUser))
{
throw new ParseException("No teamcity user name found in config or commandline");
}
var teamCityPassword = ReadTeamCityPassword();
if (string.IsNullOrEmpty(teamCityPassword))
{
throw new ParseException("No teamcity password found in config or commandline");
}
string authInfo = teamCityUser + ":" + teamCityPassword;
var encodedAuthInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
return encodedAuthInfo;
}
private string ReadTeamCityUser()
{
if (_request != null)
{
return _request.TeamCityUser;
}
if (!string.IsNullOrEmpty(_settings.TeamCityUser))
{
return _settings.TeamCityUser;
}
return null;
}
private string ReadTeamCityPassword()
{
if (_request != null)
{
return _request.TeamCityPassword;
}
if (!string.IsNullOrEmpty(_settings.TeamCityPassword))
{
return _settings.TeamCityPassword;
}
return null;
}
}
}
| mit | C# |
d6068dac670c8c772176418a1ea9a7934b0bf2b8 | Fix tests. | n-develop/tickettimer | TicketTimer.Core.Tests/StartCommandTests.cs | TicketTimer.Core.Tests/StartCommandTests.cs | using System;
using System.IO;
using TicketTimer.Core.Commands;
using TicketTimer.Core.Infrastructure;
using TicketTimer.Core.Services;
using TicketTimer.Core.Tests.Mocks;
using Xunit;
namespace TicketTimer.Core.Tests
{
public class StartCommandTests
{
[Fact(Skip = "This test is not usefull, yet...")]
public void NoParameters_PrintsHelpText()
{
using (StringWriter consoleOutput = new StringWriter())
{
var command = new StartCommand(new WorkItemServiceImpl(new JsonWorkItemStore(new MemoryFileStore()), new LocalDateProvider()));
Console.SetOut(consoleOutput);
command.Run(null);
Assert.Equal("You are '' on ticket ''\r\n", consoleOutput.ToString());
}
}
}
}
| using System;
using System.IO;
using TicketTimer.Core.Commands;
using Xunit;
namespace TicketTimer.Core.Tests
{
public class StartCommandTests
{
[Fact(Skip = "This test is not usefull, yet...")]
public void NoParameters_PrintsHelpText()
{
using (StringWriter consoleOutput = new StringWriter())
{
var command = new StartCommand();
Console.SetOut(consoleOutput);
command.Run(null);
Assert.Equal("You are '' on ticket ''\r\n", consoleOutput.ToString());
}
}
}
}
| mit | C# |
29d3ee0ba0694b4c97448cf9cb34dab43aada626 | Set defaults for ScriptInclude should prevent NullReference exceptions on trying to sort imported scripts Closes #2. | will-hart/AnvilEditor,will-hart/AnvilEditor | AnvilEditor/Models/ScriptInclude.cs | AnvilEditor/Models/ScriptInclude.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AnvilEditor.Models
{
/// <summary>
/// Contains information about a script that should be included in the mission
/// </summary>
public class ScriptInclude
{
public ScriptInclude()
{
this.FriendlyName = "ERROR Script Missing Friendly Name";
this.FolderName = "";
this.DescriptionExtFunctions = "";
this.DescriptionExtInit = "";
this.Init = "";
this.InitPlayerLocal = "";
this.Url = "http://www.anvilproject.com";
}
/// <summary>
/// Overrides base.ToString() and returns the friendly name when displaying this as a string
/// </summary>
/// <returns></returns>
public override string ToString()
{
return this.FriendlyName;
}
/// <summary>
/// Gets or sets a value containing the human-friendly name for this script
/// </summary>
public string FriendlyName { get; set; }
/// <summary>
/// Gets or sets a value indicating the name of the folder where this script is stored
/// </summary>
public string FolderName { get; set; }
/// <summary>
/// Gets or sets a value which is the lines included in the description.ext file in the init section
/// </summary>
public string DescriptionExtInit { get; set; }
/// <summary>
/// Gets or sets a value which is the lines included in the description.ext file in the cfgFunctions section
/// </summary>
public string DescriptionExtFunctions { get; set; }
/// <summary>
/// Gets or sets a string value containing the init code to be included in the mission's init.sqf
/// </summary>
public string Init { get; set; }
/// <summary>
/// Gets or sets a string value containing code that should be included in an initPlayerLocal.sqf file
/// </summary>
public string InitPlayerLocal { get; set; }
/// <summary>
/// Gets or sets a string representing the URL of this script, and where it can be found if
/// the script is not found locally
/// </summary>
public string Url { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AnvilEditor.Models
{
/// <summary>
/// Contains information about a script that should be included in the mission
/// </summary>
public class ScriptInclude
{
/// <summary>
/// Overrides base.ToString() and returns the friendly name when displaying this as a string
/// </summary>
/// <returns></returns>
public override string ToString()
{
return this.FriendlyName;
}
/// <summary>
/// Gets or sets a value containing the human-friendly name for this script
/// </summary>
public string FriendlyName { get; set; }
/// <summary>
/// Gets or sets a value indicating the name of the folder where this script is stored
/// </summary>
public string FolderName { get; set; }
/// <summary>
/// Gets or sets a value which is the lines included in the description.ext file in the init section
/// </summary>
public string DescriptionExtInit { get; set; }
/// <summary>
/// Gets or sets a value which is the lines included in the description.ext file in the cfgFunctions section
/// </summary>
public string DescriptionExtFunctions { get; set; }
/// <summary>
/// Gets or sets a string value containing the init code to be included in the mission's init.sqf
/// </summary>
public string Init { get; set; }
/// <summary>
/// Gets or sets a string value containing code that should be included in an initPlayerLocal.sqf file
/// </summary>
public string InitPlayerLocal { get; set; }
/// <summary>
/// Gets or sets a string representing the URL of this script, and where it can be found if
/// the script is not found locally
/// </summary>
public string Url { get; set; }
}
}
| mit | C# |
278947a43ee6ab4a63042e25d1bcf7bb5b4e05f7 | Introduce a variable to workaround an issue with the RAZR code generation which was generating an invalid lambda statement found while updating to MVC4. | mtian/SiteExtensionGallery,JetBrains/ReSharperGallery,ScottShingler/NuGetGallery,KuduApps/NuGetGallery,projectkudu/SiteExtensionGallery,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,ScottShingler/NuGetGallery,KuduApps/NuGetGallery,JetBrains/ReSharperGallery,grenade/NuGetGallery_download-count-patch,KuduApps/NuGetGallery,skbkontur/NuGetGallery,skbkontur/NuGetGallery,projectkudu/SiteExtensionGallery,skbkontur/NuGetGallery,grenade/NuGetGallery_download-count-patch,KuduApps/NuGetGallery,JetBrains/ReSharperGallery,KuduApps/NuGetGallery,mtian/SiteExtensionGallery,projectkudu/SiteExtensionGallery,mtian/SiteExtensionGallery | Website/Views/Packages/ContactOwners.cshtml | Website/Views/Packages/ContactOwners.cshtml | @model ContactOwnersViewModel
@{
ViewBag.Tab = "Packages";
var owners = Model.Owners.Flatten(@<text>@item.Username</text>);
}
<h1 class="page-heading">Contact the Owners of "@Model.PackageId"</h1>
@if (Model.Owners.Any())
{
<p class="message">
By submitting this form, you agree to <em>disclose your email address</em>
to the package owners listed below so they can reply to you.
</p>
using (Html.BeginForm())
{
<fieldset class="form">
<legend>Contact Owners</legend>
@Html.AntiForgeryToken()
<div class="form-field">
<label for="NotUsed">To</label>
<input name="NotUsed" type="text" value="@owners" disabled="disabled" />
</div>
<div class="form-field">
@Html.LabelFor(m => m.Message)
@Html.TextAreaFor(m => m.Message, 10, 50, null)
@Html.ValidationMessageFor(m => m.Message)
</div>
<input type="submit" value="Send" title="Send your message to the owners of '@Model.PackageId'" />
</fieldset>
}
}
else
{
<p class="error message">
Sorry, the owners of this package do not allow contacting them through this form.
Try visiting the project home page for "@Model.PackageId" in order to contact the package owner.
</p>
}
@section BottomScripts {
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
} | @model ContactOwnersViewModel
@{
ViewBag.Tab = "Packages";
}
<h1 class="page-heading">Contact the Owners of "@Model.PackageId"</h1>
@if (Model.Owners.Any())
{
<p class="message">
By submitting this form, you agree to <em>disclose your email address</em>
to the package owners listed below so they can reply to you.
</p>
using (Html.BeginForm())
{
<fieldset class="form">
<legend>Contact Owners</legend>
@Html.AntiForgeryToken()
<div class="form-field">
<label for="NotUsed">To</label>
<input name="NotUsed" type="text" value="@Model.Owners.Flatten(@<text>@item.Username</text>)" disabled="disabled" />
</div>
<div class="form-field">
@Html.LabelFor(m => m.Message)
@Html.TextAreaFor(m => m.Message, 10, 50, null)
@Html.ValidationMessageFor(m => m.Message)
</div>
<input type="submit" value="Send" title="Send your message to the owners of '@Model.PackageId'" />
</fieldset>
}
}
else
{
<p class="error message">
Sorry, the owners of this package do not allow contacting them through this form.
Try visiting the project home page for "@Model.PackageId" in order to contact the package owner.
</p>
}
@section BottomScripts {
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
} | apache-2.0 | C# |
75f78ac8dfbcfa76bf4bde82948761d0fd1372db | Add check for strStatus=null to TestBridgeClient | anupam128/reef,afchung/reef,anupam128/reef,apache/reef,apache/reef,markusweimer/reef,nachocano/incubator-reef,tcNickolas/incubator-reef,dongjoon-hyun/reef,tcNickolas/reef,markusweimer/incubator-reef,nachocano/incubator-reef,markusweimer/reef,tcNickolas/reef,markusweimer/incubator-reef,nachocano/incubator-reef,motus/reef,apache/incubator-reef,jwang98052/incubator-reef,afchung/incubator-reef,singlis/reef,dougmsft/reef,singlis/reef,apache/incubator-reef,motus/reef,tcNickolas/incubator-reef,jwang98052/reef,afchung/reef,dongjoon-hyun/reef,dougmsft/reef,afchung/reef,afchung/reef,apache/incubator-reef,apache/incubator-reef,tcNickolas/incubator-reef,markusweimer/incubator-reef,anupam128/reef,apache/incubator-reef,apache/reef,anupam128/reef,markusweimer/reef,tcNickolas/reef,singlis/reef,dongjoon-hyun/reef,nachocano/incubator-reef,markusweimer/incubator-reef,shravanmn/reef,jwang98052/reef,tcNickolas/incubator-reef,jwang98052/reef,nachocano/incubator-reef,markusweimer/incubator-reef,markusweimer/incubator-reef,markusweimer/reef,jwang98052/reef,jwang98052/incubator-reef,afchung/reef,apache/reef,dougmsft/reef,apache/incubator-reef,shravanmn/reef,afchung/incubator-reef,dongjoon-hyun/incubator-reef,tcNickolas/incubator-reef,tcNickolas/reef,tcNickolas/incubator-reef,afchung/incubator-reef,motus/reef,tcNickolas/reef,jwang98052/incubator-reef,motus/reef,tcNickolas/incubator-reef,dongjoon-hyun/reef,dongjoon-hyun/incubator-reef,afchung/incubator-reef,shravanmn/reef,dougmsft/reef,dongjoon-hyun/incubator-reef,jwang98052/reef,dongjoon-hyun/reef,jwang98052/incubator-reef,motus/reef,tcNickolas/reef,markusweimer/reef,markusweimer/incubator-reef,afchung/incubator-reef,dougmsft/reef,singlis/reef,dongjoon-hyun/incubator-reef,singlis/reef,singlis/reef,markusweimer/reef,afchung/incubator-reef,nachocano/incubator-reef,afchung/reef,jwang98052/incubator-reef,anupam128/reef,dongjoon-hyun/incubator-reef,singlis/reef,shravanmn/reef,afchung/incubator-reef,markusweimer/reef,motus/reef,afchung/reef,anupam128/reef,jwang98052/reef,motus/reef,jwang98052/reef,shravanmn/reef,dougmsft/reef,apache/incubator-reef,nachocano/incubator-reef,dougmsft/reef,apache/reef,apache/reef,shravanmn/reef,jwang98052/incubator-reef,apache/reef,dongjoon-hyun/incubator-reef,tcNickolas/reef,jwang98052/incubator-reef,shravanmn/reef,dongjoon-hyun/incubator-reef,anupam128/reef,dongjoon-hyun/reef,dongjoon-hyun/reef | lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs | lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
using System.Threading.Tasks;
using Org.Apache.REEF.Client.Common;
using Org.Apache.REEF.Examples.AllHandlers;
using Org.Apache.REEF.Utilities.Logging;
using Xunit;
namespace Org.Apache.REEF.Tests.Functional.Bridge
{
[Collection("FunctionalTests")]
public class TestBridgeClient : ReefFunctionalTest
{
private static readonly Logger LOGGER = Logger.GetLogger(typeof(TestBridgeClient));
[Fact(Skip = "Requires Yarn")]
[Trait("Priority", "1")]
[Trait("Category", "FunctionalGated")]
[Trait("Description", "Run CLR Bridge on Yarn")]
public async Task CanRunClrBridgeExampleOnYarn()
{
string testRuntimeFolder = DefaultRuntimeFolder + TestId;
await RunClrBridgeClient(true, testRuntimeFolder);
}
[Fact]
[Trait("Priority", "1")]
[Trait("Category", "FunctionalGated")]
[Trait("Description", "Run CLR Bridge on local runtime")]
//// TODO[JIRA REEF-1184]: add timeout 180 sec
public async Task CanRunClrBridgeExampleOnLocalRuntime()
{
string testRuntimeFolder = DefaultRuntimeFolder + TestId;
await RunClrBridgeClient(false, testRuntimeFolder);
}
private async Task RunClrBridgeClient(bool runOnYarn, string testRuntimeFolder)
{
string[] a = { runOnYarn ? "yarn" : "local", testRuntimeFolder };
IJobSubmissionResult driverHttpEndpoint = AllHandlers.Run(a);
var uri = driverHttpEndpoint.DriverUrl + "NRT/status?a=1&b=2";
var strStatus = driverHttpEndpoint.GetUrlResult(uri);
Assert.NotNull(strStatus);
Assert.True(strStatus.Equals("Byte array returned from HelloHttpHandler in CLR!!!\r\n"));
await((JobSubmissionResult)driverHttpEndpoint).TryUntilNoConnection(uri);
ValidateSuccessForLocalRuntime(2, testFolder: testRuntimeFolder);
CleanUp(testRuntimeFolder);
}
}
}
| // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
using System;
using System.Threading.Tasks;
using Org.Apache.REEF.Client.Common;
using Org.Apache.REEF.Examples.AllHandlers;
using Org.Apache.REEF.Utilities.Logging;
using Xunit;
namespace Org.Apache.REEF.Tests.Functional.Bridge
{
[Collection("FunctionalTests")]
public class TestBridgeClient : ReefFunctionalTest
{
private static readonly Logger LOGGER = Logger.GetLogger(typeof(TestBridgeClient));
[Fact(Skip = "Requires Yarn")]
[Trait("Priority", "1")]
[Trait("Category", "FunctionalGated")]
[Trait("Description", "Run CLR Bridge on Yarn")]
public async Task CanRunClrBridgeExampleOnYarn()
{
string testRuntimeFolder = DefaultRuntimeFolder + TestId;
await RunClrBridgeClient(true, testRuntimeFolder);
}
[Fact]
[Trait("Priority", "1")]
[Trait("Category", "FunctionalGated")]
[Trait("Description", "Run CLR Bridge on local runtime")]
//// TODO[JIRA REEF-1184]: add timeout 180 sec
public async Task CanRunClrBridgeExampleOnLocalRuntime()
{
string testRuntimeFolder = DefaultRuntimeFolder + TestId;
await RunClrBridgeClient(false, testRuntimeFolder);
}
private async Task RunClrBridgeClient(bool runOnYarn, string testRuntimeFolder)
{
string[] a = { runOnYarn ? "yarn" : "local", testRuntimeFolder };
IJobSubmissionResult driverHttpEndpoint = AllHandlers.Run(a);
var uri = driverHttpEndpoint.DriverUrl + "NRT/status?a=1&b=2";
var strStatus = driverHttpEndpoint.GetUrlResult(uri);
Assert.True(strStatus.Equals("Byte array returned from HelloHttpHandler in CLR!!!\r\n"));
await((JobSubmissionResult)driverHttpEndpoint).TryUntilNoConnection(uri);
ValidateSuccessForLocalRuntime(2, testFolder: testRuntimeFolder);
CleanUp(testRuntimeFolder);
}
}
}
| apache-2.0 | C# |
142935a73488b860ccd1527a684313cfe96f481d | Update WeeklyXamarin.cs | beraybentesen/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,stvansolano/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin | src/Firehose.Web/Authors/WeeklyXamarin.cs | src/Firehose.Web/Authors/WeeklyXamarin.cs | using Firehose.Web.Infrastructure;
using System;
using System.Collections.Generic;
namespace Firehose.Web.Authors
{
public class WeeklyXamarin : IAmACommunityMember
{
public string FirstName => "Weekly";
public string LastName => "Xamarin";
public string StateOrRegion => "Internet";
public string EmailAddress => "inbox@weeklyxamarin.com";
public string Title => "weekly newsletter that contains a hand-picked round-up of the best mobile development links and resources delivered to your mailbox. Curated by Geoffrey Huntley. Free.";
public Uri WebSite => new Uri("https://www.weeklyxamarin.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://weeklyxamarin.com/issues.rss"); }
}
public string TwitterHandle => "weeklyxamarin";
public string GravatarHash => "";
}
}
| using Firehose.Web.Infrastructure;
using System;
using System.Collections.Generic;
namespace Firehose.Web.Authors
{
public class WeeklyXamarin : IAmACommunityMember
{
public string FirstName => "Weekly";
public string LastName => "Xamarin";
public string StateOrRegion => "Internet";
public string EmailAddress => "inbox@weeklyxamarin.com";
public string Title => "newsletter that is a hand-picked weekly round-up of the best mobile development links and resources delivered to your mailbox. Curated by Geoffrey Huntley. Free.";
public Uri WebSite => new Uri("https://www.weeklyxamarin.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://weeklyxamarin.com/issues.rss"); }
}
public string TwitterHandle => "weeklyxamarin";
public string GravatarHash => "";
}
}
| mit | C# |
4cf52c7d6e81590f000904997404afa203de08b2 | Add action "Show Error" option | danielchalmers/DesktopWidgets | DesktopWidgets/Actions/ActionBase.cs | DesktopWidgets/Actions/ActionBase.cs | using System;
using System.ComponentModel;
using System.Windows;
using DesktopWidgets.Classes;
namespace DesktopWidgets.Actions
{
public abstract class ActionBase
{
[DisplayName("Delay")]
public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(0);
[DisplayName("Show Errors")]
public bool ShowErrors { get; set; } = false;
public void Execute()
{
DelayedAction.RunAction((int) Delay.TotalMilliseconds, () =>
{
try
{
ExecuteAction();
}
catch (Exception ex)
{
if (ShowErrors)
Popup.ShowAsync($"{GetType().Name} failed to execute.\n\n{ex.Message}",
image: MessageBoxImage.Error);
}
});
}
public virtual void ExecuteAction()
{
}
}
} | using System;
using System.ComponentModel;
using System.Windows;
using DesktopWidgets.Classes;
namespace DesktopWidgets.Actions
{
public abstract class ActionBase
{
[DisplayName("Delay")]
public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(0);
public void Execute()
{
DelayedAction.RunAction((int) Delay.TotalMilliseconds, () =>
{
try
{
ExecuteAction();
}
catch (Exception ex)
{
Popup.ShowAsync($"{GetType().Name} failed to execute.\n\n{ex.Message}", image: MessageBoxImage.Error);
}
});
}
public virtual void ExecuteAction()
{
}
}
} | apache-2.0 | C# |
48de9293544ef62a364f040672df3beb6df5c486 | Add TimeSpan methods | tjb042/Establishment | Establishment/TimeSpanEstablisher.cs | Establishment/TimeSpanEstablisher.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Establishment {
public class TimeSpanEstablisher : BaseStructEstablisher<TimeSpan> {
public bool IsZero(TimeSpan baseline) {
if (baseline.Ticks != TimeSpan.Zero.Ticks) {
return HandleFailure(new ArgumentException("TimeSpan must equal zero"));
}
return true;
}
public bool IsNotZero(TimeSpan baseline) {
if (baseline.Ticks == TimeSpan.Zero.Ticks) {
return HandleFailure(new ArgumentException("TimeSpan must not equal zero"));
}
return true;
}
public bool IsMaxSpan(TimeSpan baseline) {
if (baseline.Ticks != TimeSpan.MaxValue.Ticks) {
return HandleFailure(new ArgumentException("TimeSpan must equal TimeSpan.MaxValue"));
}
return true;
}
public bool IsNotMaxSpan(TimeSpan baseline) {
if (baseline.Ticks == TimeSpan.MaxValue.Ticks) {
return HandleFailure(new ArgumentException("TimeSpan must not equal TimeSpan.MaxValue"));
}
return true;
}
public bool IsMinSpan(TimeSpan baseline) {
if (baseline.Ticks != TimeSpan.MinValue.Ticks) {
return HandleFailure(new ArgumentException("TimeSpan must equal TimeSpan.MinValue"));
}
return true;
}
public bool IsNotMinSpan(TimeSpan baseline) {
if (baseline.Ticks == TimeSpan.MinValue.Ticks) {
return HandleFailure(new ArgumentException("TimeSpan must not equal TimeSpan.MinValue"));
}
return true;
}
public bool IsGreaterThan(TimeSpan baseline, TimeSpan threshold) {
if (baseline <= threshold) {
return HandleFailure(new ArgumentException("TimeSpan value must be greater than " + threshold.ToString()));
}
return true;
}
public bool IsGreaterThanOrEqualTo(TimeSpan baseline, TimeSpan threshold) {
if (baseline < threshold) {
return HandleFailure(new ArgumentException("TimeSpan value must be greater than or equal to " + threshold.ToString()));
}
return true;
}
public bool IsLessThan(TimeSpan baseline, TimeSpan threshold) {
if (baseline >= threshold) {
return HandleFailure(new ArgumentException("TimeSpan value must be less than " + threshold.ToString()));
}
return true;
}
public bool IsLessThanOrEqualTo(TimeSpan baseline, TimeSpan threshold) {
if (baseline > threshold) {
return HandleFailure(new ArgumentException("TimeSpan value must be less than or equal to " + threshold.ToString()));
}
return true;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Establishment {
public class TimeSpanEstablisher : BaseStructEstablisher<TimeSpan> {
}
}
| mit | C# |
3f9d3253740eca3863064f10f0cdc5a3ab72b018 | Add Employee Data Annotations. | TeamYAGNI/LibrarySystem | LibrarySystem/LibrarySystem.Models/Employee.cs | LibrarySystem/LibrarySystem.Models/Employee.cs | // <copyright file="Employee.cs" company="YAGNI">
// All rights reserved.
// </copyright>
// <summary>Holds implementation of Book model.</summary>
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using LibrarySystem.Models.Enumerations;
namespace LibrarySystem.Models
{
/// <summary>
/// Represent a <see cref="Employee"/> entity model.
/// </summary>
public class Employee
{
/// <summary>
/// Gets or sets the primary key of the <see cref="Employee"/> entity.
/// </summary>
/// <value>Primary key of the <see cref="Employee"/> entity.</value>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
/// <summary>
/// Gets or sets the first name of the <see cref="Employee"/> entity.
/// </summary>
/// <value>First name of the <see cref="Employee"/> entity.</value>
[Required]
[Column("First Name")]
[StringLength(20, ErrorMessage = "Employee FirstName Invalid Length", MinimumLength = 1)]
public string FirstName { get; set; }
/// <summary>
/// Gets or sets the last name of the <see cref="Employee"/> entity.
/// </summary>
/// <value>Last name of the <see cref="Employee"/> entity.</value>
[Required]
[Column("Last Name")]
[StringLength(20, ErrorMessage = "Employee LastName Invalid Length", MinimumLength = 1)]
public string LastName { get; set; }
/// <summary>
/// Gets or sets the full name of the <see cref="Employee"/> entity.
/// </summary>
/// <value>Full name of the <see cref="Employee"/> entity.</value>
[NotMapped]
public string FullName
{
get
{
return string.Format("{0} {1}", this.FirstName, this.LastName);
}
}
/// <summary>
/// Gets or sets the job title of the <see cref="Employee"/> entity.
/// </summary>
/// <value>Job title of the <see cref="Employee"/> entity.</value>
[Required]
public virtual JobTitle JobTitle { get; set; }
/// <summary>
/// Gets or sets foreign key of the address of the <see cref="Employee"/> entity.
/// </summary>
/// <value>Primary key of the address of the <see cref="Employee"/> entity.</value>
[Required]
public int AddressId { get; set; }
/// <summary>
/// Gets or sets the address of the <see cref="Employee"/> entity.
/// </summary>
/// <value>Address of the <see cref="Employee"/> entity.</value>
public virtual Address Address { get; set; }
/// <summary>
/// Gets or sets foreign key of the manager of the <see cref="Employee"/> entity.
/// </summary>
/// <value>Primary key of the manager of the <see cref="Employee"/> entity.</value>
public int? ReportsToId { get; set; }
/// <summary>
/// Gets or sets the manager of the <see cref="Employee"/> entity.
/// </summary>
/// <value>Manager of the <see cref="Employee"/> entity.</value>
public virtual Employee ReportsTo { get; set; }
}
} | using System.ComponentModel.DataAnnotations;
using LibrarySystem.Models.Enumerations;
namespace LibrarySystem.Models
{
public class Employee
{
public int Id { get; set; }
[Required]
[MaxLength(50)]
public string Name { get; set; }
public int JobTitleId { get; set; }
public virtual JobTitle JobTitle { get; set; }
public int AddressId { get; set; }
public virtual Address Address { get; set; }
public int ReportsToId { get; set; }
public virtual Employee ReportsTo { get; set; }
}
} | mit | C# |
322097700e855a6ae50ce4bc6841657d839a7d66 | Fix a trivial style bug in RoutePrefixAttribute prefix. | lijunle/Nancy.AttributeRouting,lijunle/Nancy.AttributeRouting | Nancy.AttributeRouting/RoutePrefixAttribute.cs | Nancy.AttributeRouting/RoutePrefixAttribute.cs | namespace Nancy.AttributeRouting
{
using System;
using System.Reflection;
/// <summary>
/// The RoutePrefix attribute. It decorates on class, indicates the path from route attribute on
/// the class and child class will be prefixed.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class RoutePrefixAttribute : Attribute
{
private readonly string prefix;
/// <summary>
/// Initializes a new instance of the <see cref="RoutePrefixAttribute"/> class.
/// </summary>
/// <param name="prefix">The prefix string for the route attribute path.</param>
public RoutePrefixAttribute(string prefix)
: this(null, prefix)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RoutePrefixAttribute"/> class.
/// </summary>
/// <param name="prefixType">The prefix of this type leveraged as prefix of prefix.</param>
/// <param name="prefix">The prefix string for the route attribute path.</param>
public RoutePrefixAttribute(Type prefixType, string prefix)
{
string typePrefix = GetPrefix(prefixType);
string trimPrefix = prefix.Trim('/');
this.prefix = string.Format("{0}/{1}", typePrefix, trimPrefix).Trim('/');
}
internal static string GetPrefix(Type type)
{
if (type == null || type == typeof(object))
{
return string.Empty;
}
var attr = type.GetCustomAttribute<RoutePrefixAttribute>(inherit: false);
string prefix = attr == null ? string.Empty : attr.prefix;
return prefix;
}
}
}
| namespace Nancy.AttributeRouting
{
using System;
using System.Reflection;
/// <summary>
/// The RoutePrefix attribute. It decorates on class, indicates the path from route attribute on
/// the class and child class will be prefixed.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class RoutePrefixAttribute : Attribute
{
private readonly string prefix;
/// <summary>
/// Initializes a new instance of the <see cref="RoutePrefixAttribute"/> class.
/// </summary>
/// <param name="prefix">The prefix string for the route attribute path.</param>
public RoutePrefixAttribute(string prefix)
: this(null, prefix)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RoutePrefixAttribute"/> class.
/// </summary>
/// <param name="prefixType">The prefix of this type leveraged as prefix of prefix.</param>
/// <param name="prefix">The prefix string for the route attribute path.</param>
public RoutePrefixAttribute(Type prefixType, string prefix)
{
string typePrefix = GetPrefix(prefixType);
this.prefix = string.Format("{0}/{1}", typePrefix, prefix).Trim('/');
}
internal static string GetPrefix(Type type)
{
if (type == null || type == typeof(object))
{
return string.Empty;
}
var attr = type.GetCustomAttribute<RoutePrefixAttribute>(inherit: false);
string prefix = attr == null ? string.Empty : attr.prefix;
return prefix;
}
}
}
| mit | C# |
b5f6285f34cd9deae2739c205c115e43767b2c86 | Save newly created csproj files without BOM | Zylann/godot,akien-mga/godot,pkowal1982/godot,Paulloz/godot,honix/godot,akien-mga/godot,sanikoyes/godot,Faless/godot,akien-mga/godot,godotengine/godot,DmitriySalnikov/godot,Paulloz/godot,MarianoGnu/godot,guilhermefelipecgs/godot,ZuBsPaCe/godot,Valentactive/godot,akien-mga/godot,Faless/godot,ZuBsPaCe/godot,josempans/godot,sanikoyes/godot,vkbsb/godot,guilhermefelipecgs/godot,godotengine/godot,josempans/godot,BastiaanOlij/godot,pkowal1982/godot,Valentactive/godot,Faless/godot,sanikoyes/godot,pkowal1982/godot,pkowal1982/godot,vkbsb/godot,Shockblast/godot,Zylann/godot,Valentactive/godot,ZuBsPaCe/godot,firefly2442/godot,DmitriySalnikov/godot,Shockblast/godot,vkbsb/godot,Paulloz/godot,Shockblast/godot,godotengine/godot,Paulloz/godot,MarianoGnu/godot,akien-mga/godot,Valentactive/godot,MarianoGnu/godot,vkbsb/godot,ZuBsPaCe/godot,godotengine/godot,vnen/godot,Zylann/godot,MarianoGnu/godot,josempans/godot,vkbsb/godot,vnen/godot,MarianoGnu/godot,MarianoGnu/godot,BastiaanOlij/godot,Shockblast/godot,guilhermefelipecgs/godot,vnen/godot,josempans/godot,akien-mga/godot,pkowal1982/godot,vkbsb/godot,pkowal1982/godot,firefly2442/godot,firefly2442/godot,DmitriySalnikov/godot,firefly2442/godot,BastiaanOlij/godot,Zylann/godot,honix/godot,MarianoGnu/godot,guilhermefelipecgs/godot,ZuBsPaCe/godot,honix/godot,DmitriySalnikov/godot,godotengine/godot,vnen/godot,firefly2442/godot,pkowal1982/godot,akien-mga/godot,Zylann/godot,Valentactive/godot,Valentactive/godot,sanikoyes/godot,guilhermefelipecgs/godot,Faless/godot,guilhermefelipecgs/godot,MarianoGnu/godot,ZuBsPaCe/godot,Faless/godot,Shockblast/godot,BastiaanOlij/godot,BastiaanOlij/godot,Shockblast/godot,firefly2442/godot,Paulloz/godot,godotengine/godot,BastiaanOlij/godot,honix/godot,Valentactive/godot,josempans/godot,honix/godot,firefly2442/godot,ZuBsPaCe/godot,Paulloz/godot,guilhermefelipecgs/godot,sanikoyes/godot,vnen/godot,godotengine/godot,Zylann/godot,sanikoyes/godot,ZuBsPaCe/godot,BastiaanOlij/godot,firefly2442/godot,sanikoyes/godot,DmitriySalnikov/godot,josempans/godot,godotengine/godot,vnen/godot,DmitriySalnikov/godot,DmitriySalnikov/godot,Zylann/godot,BastiaanOlij/godot,Shockblast/godot,Paulloz/godot,Faless/godot,Shockblast/godot,Faless/godot,josempans/godot,Zylann/godot,Faless/godot,vkbsb/godot,vkbsb/godot,akien-mga/godot,sanikoyes/godot,josempans/godot,pkowal1982/godot,Valentactive/godot,guilhermefelipecgs/godot,honix/godot,vnen/godot,vnen/godot | modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs | modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs | using System;
using System.IO;
using System.Text;
using Microsoft.Build.Construction;
using Microsoft.Build.Evaluation;
namespace GodotTools.ProjectEditor
{
public static class ProjectGenerator
{
public const string GodotSdkVersionToUse = "4.0.0-dev2";
public static string GodotSdkAttrValue => $"Godot.NET.Sdk/{GodotSdkVersionToUse}";
public static ProjectRootElement GenGameProject(string name)
{
if (name.Length == 0)
throw new ArgumentException("Project name is empty", nameof(name));
var root = ProjectRootElement.Create(NewProjectFileOptions.None);
root.Sdk = GodotSdkAttrValue;
var mainGroup = root.AddPropertyGroup();
mainGroup.AddProperty("TargetFramework", "netstandard2.1");
string sanitizedName = IdentifierUtils.SanitizeQualifiedIdentifier(name, allowEmptyIdentifiers: true);
// If the name is not a valid namespace, manually set RootNamespace to a sanitized one.
if (sanitizedName != name)
mainGroup.AddProperty("RootNamespace", sanitizedName);
return root;
}
public static string GenAndSaveGameProject(string dir, string name)
{
if (name.Length == 0)
throw new ArgumentException("Project name is empty", nameof(name));
string path = Path.Combine(dir, name + ".csproj");
var root = GenGameProject(name);
// Save (without BOM)
root.Save(path, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
return Guid.NewGuid().ToString().ToUpper();
}
}
}
| using System;
using System.IO;
using Microsoft.Build.Construction;
using Microsoft.Build.Evaluation;
namespace GodotTools.ProjectEditor
{
public static class ProjectGenerator
{
public const string GodotSdkVersionToUse = "4.0.0-dev2";
public static string GodotSdkAttrValue => $"Godot.NET.Sdk/{GodotSdkVersionToUse}";
public static ProjectRootElement GenGameProject(string name)
{
if (name.Length == 0)
throw new ArgumentException("Project name is empty", nameof(name));
var root = ProjectRootElement.Create(NewProjectFileOptions.None);
root.Sdk = GodotSdkAttrValue;
var mainGroup = root.AddPropertyGroup();
mainGroup.AddProperty("TargetFramework", "netstandard2.1");
string sanitizedName = IdentifierUtils.SanitizeQualifiedIdentifier(name, allowEmptyIdentifiers: true);
// If the name is not a valid namespace, manually set RootNamespace to a sanitized one.
if (sanitizedName != name)
mainGroup.AddProperty("RootNamespace", sanitizedName);
return root;
}
public static string GenAndSaveGameProject(string dir, string name)
{
if (name.Length == 0)
throw new ArgumentException("Project name is empty", nameof(name));
string path = Path.Combine(dir, name + ".csproj");
var root = GenGameProject(name);
root.Save(path);
return Guid.NewGuid().ToString().ToUpper();
}
}
}
| mit | C# |
8dd08cab3d5a407c0a6c52857d786845981a4754 | Hide command internal properties in inspector | RonanPearce/Fungus,kdoore/Fungus,tapiralec/Fungus,inarizushi/Fungus,snozbot/fungus,lealeelu/Fungus,Nilihum/fungus,FungusGames/Fungus | Assets/Fungus/FungusScript/Scripts/Command.cs | Assets/Fungus/FungusScript/Scripts/Command.cs | #if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
public class CommandInfoAttribute : Attribute
{
public CommandInfoAttribute(string category, string commandName, string helpText)
{
this.Category = category;
this.CommandName = commandName;
this.HelpText = helpText;
}
public string Category { get; set; }
public string CommandName { get; set; }
public string HelpText { get; set; }
}
[RequireComponent(typeof(Sequence))]
public class Command : MonoBehaviour
{
[HideInInspector]
public string errorMessage = "";
[HideInInspector]
public int indentLevel;
public Sequence GetSequence()
{
return gameObject.GetComponent<Sequence>();
}
public FungusScript GetFungusScript()
{
Sequence s = GetSequence();
if (s == null)
{
return null;
}
return s.GetFungusScript();
}
public bool IsExecuting()
{
Sequence sequence = GetSequence();
if (sequence == null)
{
return false;
}
return (sequence.activeCommand == this);
}
public virtual void Execute()
{
OnEnter();
}
public virtual void Continue()
{
Continue(this);
}
public virtual void Continue(Command currentCommand)
{
OnExit();
Sequence sequence = GetSequence();
if (sequence != null)
{
sequence.ExecuteNextCommand(currentCommand);
}
}
public virtual void Stop()
{
OnExit();
Sequence sequence = GetSequence();
if (sequence != null)
{
sequence.Stop();
}
}
public virtual void ExecuteSequence(Sequence s)
{
OnExit();
Sequence sequence = GetSequence();
if (sequence != null)
{
sequence.Stop();
FungusScript fungusScript = sequence.GetFungusScript();
if (fungusScript != null)
{
fungusScript.ExecuteSequence(s);
}
}
}
public virtual void OnEnter()
{}
public virtual void OnExit()
{}
public virtual void GetConnectedSequences(ref List<Sequence> connectedSequences)
{}
public virtual bool HasReference(Variable variable)
{
return false;
}
public virtual string GetSummary()
{
return "";
}
public virtual string GetHelpText()
{
return "";
}
/**
* Indent offset for this command.
*/
public virtual int GetPreIndent()
{
return 0;
}
/**
* Indent offset for subsequent commands.
*/
public virtual int GetPostIndent()
{
return 0;
}
public virtual Color GetButtonColor()
{
return Color.white;
}
}
} | #if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
public class CommandInfoAttribute : Attribute
{
public CommandInfoAttribute(string category, string commandName, string helpText)
{
this.Category = category;
this.CommandName = commandName;
this.HelpText = helpText;
}
public string Category { get; set; }
public string CommandName { get; set; }
public string HelpText { get; set; }
}
[RequireComponent(typeof(Sequence))]
public class Command : MonoBehaviour
{
public string errorMessage = "";
public int indentLevel;
public Sequence GetSequence()
{
return gameObject.GetComponent<Sequence>();
}
public FungusScript GetFungusScript()
{
Sequence s = GetSequence();
if (s == null)
{
return null;
}
return s.GetFungusScript();
}
public bool IsExecuting()
{
Sequence sequence = GetSequence();
if (sequence == null)
{
return false;
}
return (sequence.activeCommand == this);
}
public virtual void Execute()
{
OnEnter();
}
public virtual void Continue()
{
Continue(this);
}
public virtual void Continue(Command currentCommand)
{
OnExit();
Sequence sequence = GetSequence();
if (sequence != null)
{
sequence.ExecuteNextCommand(currentCommand);
}
}
public virtual void Stop()
{
OnExit();
Sequence sequence = GetSequence();
if (sequence != null)
{
sequence.Stop();
}
}
public virtual void ExecuteSequence(Sequence s)
{
OnExit();
Sequence sequence = GetSequence();
if (sequence != null)
{
sequence.Stop();
FungusScript fungusScript = sequence.GetFungusScript();
if (fungusScript != null)
{
fungusScript.ExecuteSequence(s);
}
}
}
public virtual void OnEnter()
{}
public virtual void OnExit()
{}
public virtual void GetConnectedSequences(ref List<Sequence> connectedSequences)
{}
public virtual bool HasReference(Variable variable)
{
return false;
}
public virtual string GetSummary()
{
return "";
}
public virtual string GetHelpText()
{
return "";
}
/**
* Indent offset for this command.
*/
public virtual int GetPreIndent()
{
return 0;
}
/**
* Indent offset for subsequent commands.
*/
public virtual int GetPostIndent()
{
return 0;
}
public virtual Color GetButtonColor()
{
return Color.white;
}
}
} | mit | C# |
37ef64db5f16c4d12d723e74423c5ccdb65cb03b | teste 2 no vs | marcelogomesrp/pim3 | AdmCondominio/AdmCondominio/model/Flavio.cs | AdmCondominio/AdmCondominio/model/Flavio.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AdmCondominio.model
{
public class Flavio
{
public string Nome { get; set; }
public string RA { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AdmCondominio.model
{
public class Flavio
{
public string Nome { get; set; }
//teste
//teste2
//teste3
}
}
| apache-2.0 | C# |
14f020c8ac946e36a3be2ecf3d4fc3215ee0cc30 | Clean up some use of Approval tests. | Minions/Fools.net,arlobelshee/Fools.net,JayBazuzi/Fools.net | src/Core/Gibberish.Tests/RecognizeBlockSyntax/InterpretWholeFile.cs | src/Core/Gibberish.Tests/RecognizeBlockSyntax/InterpretWholeFile.cs | using ApprovalTests.Reporters;
using Gibberish.AST._1_Bare;
using Gibberish.Parsing;
using Gibberish.Tests.ZzTestHelpers;
using NUnit.Framework;
namespace Gibberish.Tests.RecognizeBlockSyntax
{
[TestFixture]
public class InterpretWholeFile
{
[Test]
public void should_accept_multiple_language_constructs()
{
var subject = new RecognizeBlocks();
var input = @"
using language fasm
define.thunk some.name:
pass
define.thunk other.name:
pass
";
var result = subject.GetMatch(input, subject.WholeFile);
result.Should()
.BeRecognizedAs(
BasicAst.Statement("using language fasm"),
BasicAst.Block("define.thunk some.name")
.WithBody(b => b.AddStatement("pass")),
BasicAst.Block("define.thunk other.name")
.WithBody(b => b.AddStatement("pass")));
}
}
}
| using ApprovalTests.Reporters;
using Gibberish.AST._1_Bare;
using Gibberish.Parsing;
using Gibberish.Tests.ZzTestHelpers;
using NUnit.Framework;
namespace Gibberish.Tests.RecognizeBlockSyntax
{
[TestFixture]
public class InterpretWholeFile
{
[Test, UseReporter(typeof(QuietReporter))]
public void should_accept_multiple_language_constructs()
{
var subject = new RecognizeBlocks();
var input = @"
using language fasm
define.thunk some.name:
pass
define.thunk other.name:
pass
";
var result = subject.GetMatch(input, subject.WholeFile);
//ApprovalTests.Approvals.VerifyJson(result.PrettyPrint());
result.Should()
.BeRecognizedAs(
BasicAst.Statement("using language fasm"),
BasicAst.Block("define.thunk some.name")
.WithBody(b => b.AddStatement("pass")),
BasicAst.Block("define.thunk other.name")
.WithBody(b => b.AddStatement("pass")));
}
}
}
| bsd-3-clause | C# |
a9a1a90efb62f6871e04b7173e5efa2d2536b666 | add more case | autumn009/TanoCSharpSamples | Chap35/RangeAndIndex/RangeAndIndex/Program.cs | Chap35/RangeAndIndex/RangeAndIndex/Program.cs | using System;
class Program
{
private static char[] ar = { 'P', 'E', 'N', 'D', 'U', 'L', 'U', 'M' };
private static void sub(string label, Range range)
{
Console.Write($"{label}: ");
var r1 = ar[range];
foreach (var item in r1) Console.Write(item);
Console.WriteLine();
}
static void Main()
{
Index i1 = 1;
Index i2 = 3;
Index i3 = ^2;
Console.WriteLine($"インデックスがi1(1)の値: {ar[i1]}");
Console.WriteLine($"インデックスがi2(3)の値: {ar[i2]}");
Console.WriteLine($"インデックスがi3(^2)の値: {ar[i3]}");
sub("インデックスが1~3の範囲", 1..3);
sub("インデックスがi1(1)~i2(3)の範囲(i2は含まない)", i1..i2);
sub("インデックスがi1(1)~i3(^2)の範囲(i3は含まない)", i1..i3);
sub("インデックスが2~の範囲", 2..);
sub("インデックスが~3の範囲", ..3);
sub("インデックスが~^3の範囲", ..^3);
sub("インデックスが1~1の範囲", 1..1);
sub("インデックスが完全オープン(..)の範囲", ..);
}
}
| using System;
class Program
{
private static char[] ar = { 'P', 'E', 'N', 'D', 'U', 'L', 'U', 'M' };
private static void sub(string label, Range range)
{
Console.Write($"{label}: ");
var r1 = ar[range];
foreach (var item in r1) Console.Write(item);
Console.WriteLine();
}
static void Main()
{
Index i1 = 1;
Index i2 = 3;
Index i3 = ^2;
Console.WriteLine($"インデックスがi1(1)の値: {ar[i1]}");
Console.WriteLine($"インデックスがi2(3)の値: {ar[i2]}");
Console.WriteLine($"インデックスがi3(^2)の値: {ar[i3]}");
sub("インデックスが1~3の範囲", 1..3);
sub("インデックスがi1(1)~i2(3)の範囲(i2は含まない)", i1..i2);
sub("インデックスがi1(1)~i3(^2)の範囲(i3は含まない)", i1..i3);
sub("インデックスが2~の範囲", 2..);
sub("インデックスが~3の範囲", ..3);
sub("インデックスが~^3の範囲", ..^3);
sub("インデックスが完全オープン(..)の範囲", ..);
}
}
| mit | C# |
88997dae9ec79bb21b9c20f9356b7db5353d2e6f | Remove unused code from SwaggerApplicationConvention | domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Ahoy,domaindrivendev/Ahoy,c3-ls/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,oconics/Ahoy,oconics/Ahoy,c3-ls/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Ahoy | src/Swashbuckle.Swagger/Application/SwaggerApplicationConvention.cs | src/Swashbuckle.Swagger/Application/SwaggerApplicationConvention.cs | using Microsoft.AspNet.Mvc.ApplicationModels;
namespace Swashbuckle.Application
{
public class SwaggerApplicationConvention : IApplicationModelConvention
{
public void Apply(ApplicationModel application)
{
application.ApiExplorer.IsVisible = true;
foreach (var controller in application.Controllers)
{
controller.ApiExplorer.GroupName = controller.ControllerName;
}
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Mvc.ApplicationModels;
namespace Swashbuckle.Application
{
public class SwaggerApplicationConvention : IApplicationModelConvention
{
public void Apply(ApplicationModel application)
{
application.ApiExplorer.IsVisible = true;
foreach (var controller in application.Controllers)
{
controller.ApiExplorer.GroupName = controller.ControllerName;
foreach (var action in controller.Actions)
{
AddProperties(action, controller.Attributes);
}
}
}
private void AddProperties(ActionModel action, IEnumerable<object> controllerAttributes)
{
action.Properties.Add("ControllerAttributes", controllerAttributes.ToArray());
action.Properties.Add("ActionAttributes", action.Attributes.ToArray());
action.Properties.Add("IsObsolete", action.Attributes.OfType<ObsoleteAttribute>().Any());
}
}
} | mit | C# |
06f069e76d9aead8429e5cb99abffa3e43e00959 | Tweak to #2879 - remove compiler directives (#3081) | xkproject/Orchard2,petedavis/Orchard2,petedavis/Orchard2,petedavis/Orchard2,xkproject/Orchard2,xkproject/Orchard2,petedavis/Orchard2,OrchardCMS/Brochard,OrchardCMS/Brochard,stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2 | src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Startup.cs | src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Startup.cs | using System;
using GraphQL;
using GraphQL.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using OrchardCore.Apis.GraphQL.Services;
using OrchardCore.Modules;
using OrchardCore.Navigation;
using OrchardCore.Security.Permissions;
namespace OrchardCore.Apis.GraphQL
{
public class Startup : StartupBase
{
private readonly IConfiguration _configuration;
private readonly IHostingEnvironment _hostingEnvironment;
public Startup(IConfiguration configuration,
IHostingEnvironment hostingEnvironment)
{
_configuration = configuration;
_hostingEnvironment = hostingEnvironment;
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IDependencyResolver, RequestServicesDependencyResolver>();
services.AddSingleton<IDocumentExecuter, DocumentExecuter>();
services.AddSingleton<IDocumentWriter, DocumentWriter>();
services.AddScoped<ISchemaFactory, SchemaService>();
services.AddScoped<IPermissionProvider, Permissions>();
services.AddTransient<INavigationProvider, AdminMenu>();
}
public override void Configure(IApplicationBuilder app, IRouteBuilder routes, IServiceProvider serviceProvider)
{
var exposeExceptions = _configuration.GetValue(
$"Modules:OrchardCore.Apis.GraphQL:{nameof(GraphQLSettings.ExposeExceptions)}",
_hostingEnvironment.IsDevelopment());
app.UseMiddleware<GraphQLMiddleware>(new GraphQLSettings
{
BuildUserContext = ctx => new GraphQLContext
{
User = ctx.User,
ServiceProvider = ctx.RequestServices,
},
ExposeExceptions = exposeExceptions
});
}
}
}
| using System;
using GraphQL;
using GraphQL.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Apis.GraphQL.Services;
using OrchardCore.Modules;
using OrchardCore.Navigation;
using OrchardCore.Security.Permissions;
namespace OrchardCore.Apis.GraphQL
{
public class Startup : StartupBase
{
private IConfiguration _configuration;
public Startup(IConfiguration configuration)
{
_configuration = configuration;
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IDependencyResolver, RequestServicesDependencyResolver>();
services.AddSingleton<IDocumentExecuter, DocumentExecuter>();
services.AddSingleton<IDocumentWriter, DocumentWriter>();
services.AddScoped<ISchemaFactory, SchemaService>();
services.AddScoped<IPermissionProvider, Permissions>();
services.AddTransient<INavigationProvider, AdminMenu>();
}
public override void Configure(IApplicationBuilder app, IRouteBuilder routes, IServiceProvider serviceProvider)
{
#if DEBUG
var exposeExceptions = _configuration.GetValue<bool>($"Modules:OrchardCore.Apis.GraphQL:{nameof(GraphQLSettings.ExposeExceptions)}", true);
#else
var exposeExceptions = _configuration.GetValue<bool>($"Modules:OrchardCore.Apis.GraphQL:{nameof(GraphQLSettings.ExposeExceptions)}", false);
#endif
app.UseMiddleware<GraphQLMiddleware>(new GraphQLSettings
{
BuildUserContext = ctx => new GraphQLContext
{
User = ctx.User,
ServiceProvider = ctx.RequestServices,
},
ExposeExceptions = exposeExceptions
});
}
}
}
| bsd-3-clause | C# |
401429feeccbcb92818cfd31f5020ffdf3070abe | Revert changes to ScrenTestScene | 2yangk23/osu,ppy/osu,UselessToucan/osu,peppy/osu,2yangk23/osu,EVAST9919/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu,ppy/osu,UselessToucan/osu,peppy/osu-new | osu.Game/Tests/Visual/ScreenTestScene.cs | osu.Game/Tests/Visual/ScreenTestScene.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Screens;
namespace osu.Game.Tests.Visual
{
/// <summary>
/// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions).
/// </summary>
public abstract class ScreenTestScene : ManualInputManagerTestScene
{
protected readonly OsuScreenStack Stack;
private readonly Container content;
protected override Container<Drawable> Content => content;
protected ScreenTestScene()
{
base.Content.AddRange(new Drawable[]
{
Stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both },
content = new Container { RelativeSizeAxes = Axes.Both }
});
}
protected void LoadScreen(OsuScreen screen) => Stack.Push(screen);
[SetUpSteps]
public virtual void SetUpSteps() => addExitAllScreensStep();
[TearDownSteps]
public virtual void TearDownSteps() => addExitAllScreensStep();
private void addExitAllScreensStep()
{
AddUntilStep("exit all screens", () =>
{
if (Stack.CurrentScreen == null) return true;
Stack.Exit();
return false;
});
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Screens;
namespace osu.Game.Tests.Visual
{
/// <summary>
/// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions).
/// </summary>
public abstract class ScreenTestScene : ManualInputManagerTestScene
{
protected readonly OsuScreenStack Stack;
private readonly Container content;
protected override Container<Drawable> Content => content;
protected ScreenTestScene()
{
base.Content.AddRange(new Drawable[]
{
Stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both },
content = new Container { RelativeSizeAxes = Axes.Both }
});
}
protected void LoadScreen(OsuScreen screen) => Stack.Push(screen);
[SetUpSteps]
public virtual void SetUpSteps() => addExitAllScreensStep();
[TearDownSteps]
public virtual void TearDownSteps() => addExitAllScreensStep();
private void addExitAllScreensStep()
{
AddStep("exit all screens", () =>
{
if (Stack.CurrentScreen == null) return;
Stack.Exit();
});
}
}
}
| mit | C# |
858bce5c7900d5f6d0688d7ea762efb3629af386 | Enable fat test. | CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,trivalik/Cosmos,tgiphil/Cosmos,fanoI/Cosmos,trivalik/Cosmos,jp2masa/Cosmos,zarlo/Cosmos,tgiphil/Cosmos,fanoI/Cosmos,trivalik/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,fanoI/Cosmos,tgiphil/Cosmos,jp2masa/Cosmos,jp2masa/Cosmos,zarlo/Cosmos,zarlo/Cosmos | Tests/Cosmos.TestRunner.Core/TestKernelSets.cs | Tests/Cosmos.TestRunner.Core/TestKernelSets.cs | using System;
using System.Collections.Generic;
namespace Cosmos.TestRunner.Core
{
public static class TestKernelSets
{
public static IEnumerable<Type> GetStableKernelTypes()
{
yield return typeof(VGACompilerCrash.Kernel);
////yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.Bcl.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel);
//yield return typeof(SimpleStructsAndArraysTest.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.Exceptions.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.LinqTests.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.MethodTests.Kernel);
yield return typeof(Cosmos.Kernel.Tests.Fat.Kernel);
////yield return typeof(FrotzKernel.Kernel);
}
}
}
| using System;
using System.Collections.Generic;
namespace Cosmos.TestRunner.Core
{
public static class TestKernelSets
{
public static IEnumerable<Type> GetStableKernelTypes()
{
yield return typeof(VGACompilerCrash.Kernel);
////yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.Bcl.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel);
//yield return typeof(SimpleStructsAndArraysTest.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.Exceptions.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.LinqTests.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.MethodTests.Kernel);
//yield return typeof(Cosmos.Kernel.Tests.Fat.Kernel);
////yield return typeof(FrotzKernel.Kernel);
}
}
}
| bsd-3-clause | C# |
17efa80b054e3642d690f3b23beeb1680093343d | add supported algorithms to utils | Aimeast/FxSsh | FxSsh/KeyUtils.cs | FxSsh/KeyUtils.cs | using System;
using System.Diagnostics.Contracts;
using System.Security.Cryptography;
namespace FxSsh
{
public static class KeyUtils
{
public static string GetFingerprint(string sshkey)
{
Contract.Requires(sshkey != null);
using (var md5 = new MD5CryptoServiceProvider())
{
var bytes = Convert.FromBase64String(sshkey);
bytes = md5.ComputeHash(bytes);
return BitConverter.ToString(bytes).Replace('-', ':');
}
}
private static AsymmetricAlgorithm GetAsymmetricAlgorithm(string type)
{
Contract.Requires(type != null);
switch (type)
{
case "ssh-rsa":
return new RSACryptoServiceProvider();
case "ssh-dss":
return new DSACryptoServiceProvider();
default:
throw new ArgumentOutOfRangeException("type");
}
}
public static string GeneratePrivateKey(string type)
{
Contract.Requires(type != null);
var alg = GetAsymmetricAlgorithm(type);
return alg.ToXmlString(true);
}
public static string[] SupportedAlgorithms
{
get { return new string[] { "ssh-rsa", "ssh-dss" }; }
}
}
}
| using System;
using System.Diagnostics.Contracts;
using System.Security.Cryptography;
namespace FxSsh
{
public static class KeyUtils
{
public static string GetFingerprint(string sshkey)
{
Contract.Requires(sshkey != null);
using (var md5 = new MD5CryptoServiceProvider())
{
var bytes = Convert.FromBase64String(sshkey);
bytes = md5.ComputeHash(bytes);
return BitConverter.ToString(bytes).Replace('-', ':');
}
}
private static AsymmetricAlgorithm GetAsymmetricAlgorithm(string type)
{
Contract.Requires(type != null);
switch (type)
{
case "ssh-rsa":
return new RSACryptoServiceProvider();
case "ssh-dss":
return new DSACryptoServiceProvider();
default:
throw new ArgumentOutOfRangeException("type");
}
}
public static string GeneratePrivateKey(string type)
{
Contract.Requires(type != null);
var alg = GetAsymmetricAlgorithm(type);
return alg.ToXmlString(true);
}
}
}
| mit | C# |
947b3f4762237702f6f9092ec07c9efe9652d80f | Set the background of the results view controller to white to avoid any black patches. | xamarin/ModernHttpClient,kensykora/ModernHttpClient,paulcbetts/ModernHttpClient,pacificIT/ModernHttpClient,nachocove/ModernHttpClient-demo,djlewisxactware/ModernHttpClient,tomgilder/OkHttpClient,nachocove/ModernHttpClient,scoodah/ModernHttpClient,leonardors/ModernHttpClient,tomgilder/OkHttpClient,tpurtell/ModernHttpClient,mattleibow/ModernHttpClient,koltsov-ps/ModernHttpClient | samples/HttpClient.iOS/Main.cs | samples/HttpClient.iOS/Main.cs | //
// This sample shows how to use the two Http stacks in MonoTouch:
// The System.Net.WebRequest.
// The MonoTouch.Foundation.NSMutableUrlRequest
//
using System;
using System.IO;
using System.Linq;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Net.Http;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Linq;
using ModernHttpClient;
namespace HttpClient
{
public class Application
{
// URL where we fetch the wisdom from
public const string WisdomUrl = "http://httpbin.org/ip";
static void Main (string[] args)
{
UIApplication.Main (args);
}
public static void Busy ()
{
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
}
public static void Done ()
{
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
}
}
// The name AppDelegate is referenced in the MainWindow.xib file.
public partial class AppDelegate : UIApplicationDelegate
{
// This method is invoked when the application has loaded its UI and its ready to run
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window.AddSubview (navigationController.View);
button1.TouchDown += Button1TouchDown;
TableViewSelector.Configure (this.stack, new string [] {
"WebRequest",
"HttpClient/CFNetwork",
"HttpClient/AFNetworking"
});
window.MakeKeyAndVisible ();
return true;
}
async void Button1TouchDown (object sender, EventArgs e)
{
// Do not queue more than one request
if (UIApplication.SharedApplication.NetworkActivityIndicatorVisible)
return;
switch (stack.SelectedRow ()){
case 0:
new DotNet (this).HttpSample ();
break;
case 1:
await new NetHttp (this).HttpSample (new CFNetworkHandler ());
break;
case 2:
await new NetHttp (this).HttpSample (new AFNetworkHandler());
break;
}
}
public void RenderStream (Stream stream)
{
var reader = new System.IO.StreamReader (stream);
InvokeOnMainThread (delegate {
var view = new UIViewController ();
view.View.BackgroundColor = UIColor.White;
var label = new UILabel (new RectangleF (20, 60, 300, 80)){
Text = "The HTML returned by the server:"
};
var tv = new UITextView (new RectangleF (20, 140, 300, 400)){
Text = reader.ReadToEnd ()
};
view.Add (label);
view.Add (tv);
navigationController.PushViewController (view, true);
});
}
// This method is required in iPhoneOS 3.0
public override void OnActivated (UIApplication application)
{
}
}
}
| //
// This sample shows how to use the two Http stacks in MonoTouch:
// The System.Net.WebRequest.
// The MonoTouch.Foundation.NSMutableUrlRequest
//
using System;
using System.IO;
using System.Linq;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Net.Http;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Linq;
using ModernHttpClient;
namespace HttpClient
{
public class Application
{
// URL where we fetch the wisdom from
public const string WisdomUrl = "http://httpbin.org/ip";
static void Main (string[] args)
{
UIApplication.Main (args);
}
public static void Busy ()
{
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
}
public static void Done ()
{
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
}
}
// The name AppDelegate is referenced in the MainWindow.xib file.
public partial class AppDelegate : UIApplicationDelegate
{
// This method is invoked when the application has loaded its UI and its ready to run
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window.AddSubview (navigationController.View);
button1.TouchDown += Button1TouchDown;
TableViewSelector.Configure (this.stack, new string [] {
"WebRequest",
"HttpClient/CFNetwork",
"HttpClient/AFNetworking"
});
window.MakeKeyAndVisible ();
return true;
}
async void Button1TouchDown (object sender, EventArgs e)
{
// Do not queue more than one request
if (UIApplication.SharedApplication.NetworkActivityIndicatorVisible)
return;
switch (stack.SelectedRow ()){
case 0:
new DotNet (this).HttpSample ();
break;
case 1:
await new NetHttp (this).HttpSample (new CFNetworkHandler ());
break;
case 2:
await new NetHttp (this).HttpSample (new AFNetworkHandler());
break;
}
}
public void RenderStream (Stream stream)
{
var reader = new System.IO.StreamReader (stream);
InvokeOnMainThread (delegate {
var view = new UIViewController ();
var label = new UILabel (new RectangleF (20, 60, 300, 80)){
Text = "The HTML returned by the server:"
};
var tv = new UITextView (new RectangleF (20, 140, 300, 400)){
Text = reader.ReadToEnd ()
};
view.Add (label);
view.Add (tv);
navigationController.PushViewController (view, true);
});
}
// This method is required in iPhoneOS 3.0
public override void OnActivated (UIApplication application)
{
}
}
}
| mit | C# |
6f7458684af61379b617b29b09c34d4aaeab6414 | Update Index.cshtml | kappy/DynamicMvcApplication,kappy/DynamicMvcApplication | DynamicMvcApplication/Views/Home/Index.cshtml | DynamicMvcApplication/Views/Home/Index.cshtml | @{
ViewBag.Title = "Home Page";
}
<p>
This is my home
</p>
<a href="http://www.google.pt" id="tstButton">
| @{
ViewBag.Title = "Home Page";
}
<p>
This is my home
</p>
| apache-2.0 | C# |
e6743dbd364cf637bf696c7491c7277a8063e1d7 | Add partialView '_carousel' into home/index | fmassaretto/formacao-talentos,fmassaretto/formacao-talentos,fmassaretto/formacao-talentos | Fatec.Treinamento.Web/Views/Home/Index.cshtml | Fatec.Treinamento.Web/Views/Home/Index.cshtml | @{
ViewBag.Title = "Treinamentos AOXO";
}
<div id="banner-inicio" class="jumbotron full-width-div">
@*<div class="container">*@
<div class="carouse-div">
@Html.Partial("_Carousel")
@*<h1>Domine sua carreira</h1>
<p class="lead">
Bem vindo ao <b>AOXO</b>. A plataforma de tecnologia de aprendizado on-demand para você se manter capacitado
e garantir a progressão da sua carreira.
</p>*@
</div>
</div>
<div id="detalhes-inicio" class="row">
<div class="col-md-4">
<span class="glyphicon glyphicon-road" aria-hidden="true"></span>
<h3>Nossas Trilhas</h3>
<p>
No sistema Fatec de treinamentos, você pode escolher a trilha de estudo designada pelo seu gestor para alavancar seus conhecimentos e
aprimorar seu trabalho.
</p>
<p><a class="btn btn-default" href="@Url.Action("Trilhas","Help")">Saiba mais »</a></p>
</div>
<div class="col-md-4">
<span class="glyphicon glyphicon-education" aria-hidden="true"></span>
<h3>Autores</h3>
<p>Veja quem são os autores dos cursos, tire dúvidas, contribua e torne-se também um dos autores do sistema de treinamentos e ajude seus colegas.</p>
<p><a class="btn btn-default" href="@Url.Action("Autores","Help")">Saiba mais »</a></p>
</div>
<div class="col-md-4">
<span class="glyphicon glyphicon-signal" aria-hidden="true"></span>
<h3>Atinja suas metas</h3>
<p>
A cada treinamento realizado, você acumula pontos que contribuem para os programas de avaliação de desempenho e busca do conhecimento. <br />
Você poderá obter bônus exclusivos desses programas.
</p>
<p><a class="btn btn-default" href="@Url.Action("Pontos","Help")">Saiba mais »</a></p>
</div>
</div> | @{
ViewBag.Title = "Treinamentos AOXO";
}
<div id="banner-inicio" class="jumbotron full-width-div">
<div class="container">
<h1>Domine sua carreira</h1>
<p class="lead">
Bem vindo ao <b>AOXO</b>. A plataforma de tecnologia de aprendizado on-demand para você se manter capacitado
e garantir a progressão da sua carreira.
</p>
</div>
</div>
<div id="detalhes-inicio" class="row">
<div class="col-md-4">
<span class="glyphicon glyphicon-road" aria-hidden="true"></span>
<h3>Nossas Trilhas</h3>
<p>
No sistema Fatec de treinamentos, você pode escolher a trilha de estudo designada pelo seu gestor para alavancar seus conhecimentos e
aprimorar seu trabalho.
</p>
<p><a class="btn btn-default" href="@Url.Action("Trilhas","Help")">Saiba mais »</a></p>
</div>
<div class="col-md-4">
<span class="glyphicon glyphicon-education" aria-hidden="true"></span>
<h3>Autores</h3>
<p>Veja quem são os autores dos cursos, tire dúvidas, contribua e torne-se também um dos autores do sistema de treinamentos e ajude seus colegas.</p>
<p><a class="btn btn-default" href="@Url.Action("Autores","Help")">Saiba mais »</a></p>
</div>
<div class="col-md-4">
<span class="glyphicon glyphicon-signal" aria-hidden="true"></span>
<h3>Atinja suas metas</h3>
<p>
A cada treinamento realizado, você acumula pontos que contribuem para os programas de avaliação de desempenho e busca do conhecimento. <br />
Você poderá obter bônus exclusivos desses programas.
</p>
<p><a class="btn btn-default" href="@Url.Action("Pontos","Help")">Saiba mais »</a></p>
</div>
</div> | apache-2.0 | C# |
9d221376e1946e70b2ea6ab5a2c399e015aeb24c | Fix syntax error | jamesqo/roslyn,AnthonyDGreen/roslyn,drognanar/roslyn,MattWindsor91/roslyn,jcouv/roslyn,mattscheffer/roslyn,kelltrick/roslyn,eriawan/roslyn,jasonmalinowski/roslyn,panopticoncentral/roslyn,abock/roslyn,Hosch250/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,AnthonyDGreen/roslyn,srivatsn/roslyn,bkoelman/roslyn,brettfo/roslyn,xasx/roslyn,AmadeusW/roslyn,tannergooding/roslyn,akrisiun/roslyn,pdelvo/roslyn,TyOverby/roslyn,khyperia/roslyn,Giftednewt/roslyn,brettfo/roslyn,MattWindsor91/roslyn,diryboy/roslyn,amcasey/roslyn,paulvanbrenk/roslyn,jkotas/roslyn,OmarTawfik/roslyn,jasonmalinowski/roslyn,aelij/roslyn,bkoelman/roslyn,xasx/roslyn,swaroop-sridhar/roslyn,aelij/roslyn,Hosch250/roslyn,wvdd007/roslyn,Giftednewt/roslyn,mavasani/roslyn,bartdesmet/roslyn,davkean/roslyn,panopticoncentral/roslyn,physhi/roslyn,mattscheffer/roslyn,Hosch250/roslyn,swaroop-sridhar/roslyn,tmat/roslyn,bartdesmet/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tmat/roslyn,lorcanmooney/roslyn,jkotas/roslyn,jmarolf/roslyn,tvand7093/roslyn,swaroop-sridhar/roslyn,KirillOsenkov/roslyn,shyamnamboodiripad/roslyn,orthoxerox/roslyn,mavasani/roslyn,abock/roslyn,stephentoub/roslyn,nguerrera/roslyn,drognanar/roslyn,nguerrera/roslyn,yeaicc/roslyn,mgoertz-msft/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,heejaechang/roslyn,paulvanbrenk/roslyn,DustinCampbell/roslyn,TyOverby/roslyn,DustinCampbell/roslyn,cston/roslyn,genlu/roslyn,mattwar/roslyn,reaction1989/roslyn,dotnet/roslyn,MattWindsor91/roslyn,AmadeusW/roslyn,MichalStrehovsky/roslyn,brettfo/roslyn,MattWindsor91/roslyn,mattscheffer/roslyn,robinsedlaczek/roslyn,stephentoub/roslyn,jmarolf/roslyn,weltkante/roslyn,dpoeschl/roslyn,nguerrera/roslyn,KevinRansom/roslyn,khyperia/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,mattwar/roslyn,eriawan/roslyn,lorcanmooney/roslyn,davkean/roslyn,akrisiun/roslyn,xasx/roslyn,ErikSchierboom/roslyn,drognanar/roslyn,reaction1989/roslyn,tvand7093/roslyn,OmarTawfik/roslyn,cston/roslyn,ErikSchierboom/roslyn,VSadov/roslyn,DustinCampbell/roslyn,eriawan/roslyn,genlu/roslyn,weltkante/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,MichalStrehovsky/roslyn,tmat/roslyn,AlekseyTs/roslyn,lorcanmooney/roslyn,reaction1989/roslyn,dotnet/roslyn,AnthonyDGreen/roslyn,dotnet/roslyn,TyOverby/roslyn,Giftednewt/roslyn,physhi/roslyn,bartdesmet/roslyn,tannergooding/roslyn,dpoeschl/roslyn,agocke/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,jamesqo/roslyn,orthoxerox/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,VSadov/roslyn,tvand7093/roslyn,jmarolf/roslyn,cston/roslyn,davkean/roslyn,robinsedlaczek/roslyn,CyrusNajmabadi/roslyn,VSadov/roslyn,AmadeusW/roslyn,abock/roslyn,gafter/roslyn,amcasey/roslyn,KevinRansom/roslyn,yeaicc/roslyn,stephentoub/roslyn,srivatsn/roslyn,robinsedlaczek/roslyn,amcasey/roslyn,agocke/roslyn,dpoeschl/roslyn,mmitche/roslyn,genlu/roslyn,MichalStrehovsky/roslyn,CaptainHayashi/roslyn,jcouv/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,heejaechang/roslyn,ErikSchierboom/roslyn,bkoelman/roslyn,physhi/roslyn,wvdd007/roslyn,jkotas/roslyn,orthoxerox/roslyn,agocke/roslyn,AlekseyTs/roslyn,weltkante/roslyn,gafter/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,OmarTawfik/roslyn,sharwell/roslyn,sharwell/roslyn,wvdd007/roslyn,srivatsn/roslyn,diryboy/roslyn,aelij/roslyn,mmitche/roslyn,jamesqo/roslyn,mattwar/roslyn,kelltrick/roslyn,CaptainHayashi/roslyn,khyperia/roslyn,sharwell/roslyn,CaptainHayashi/roslyn,tmeschter/roslyn,kelltrick/roslyn,pdelvo/roslyn,KirillOsenkov/roslyn,jcouv/roslyn,tannergooding/roslyn,akrisiun/roslyn,pdelvo/roslyn,gafter/roslyn,panopticoncentral/roslyn,tmeschter/roslyn,yeaicc/roslyn,paulvanbrenk/roslyn,tmeschter/roslyn,mmitche/roslyn | src/VisualStudio/Core/SolutionExplorerShim/DiagnosticItem/LegacyDiagnosticItemProvider.cs | src/VisualStudio/Core/SolutionExplorerShim/DiagnosticItem/LegacyDiagnosticItemProvider.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;
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.Internal.VisualStudio.PlatformUI;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Utilities;
using Microsoft.VisualStudio.ComponentModelHost;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer
{
[Export(typeof(IAttachedCollectionSourceProvider))]
[Name(nameof(LegacyDiagnosticItemProvider))]
[Order]
internal sealed class LegacyDiagnosticItemProvider : AttachedCollectionSourceProvider<AnalyzerItem>
{
private readonly IAnalyzersCommandHandler _commandHandler;
private readonly IServiceProvider _serviceProvider;
private IDiagnosticAnalyzerService _diagnosticAnalyzerService;
[ImportingConstructor]
public LegacyDiagnosticItemProvider(
[Import(typeof(AnalyzersCommandHandler))]IAnalyzersCommandHandler commandHandler,
[Import(typeof(SVsServiceProvider))]IServiceProvider serviceProvider)
{
_commandHandler = commandHandler;
_serviceProvider = serviceProvider;
}
protected override IAttachedCollectionSource CreateCollectionSource(AnalyzerItem item, string relationshipName)
{
if (relationshipName == KnownRelationships.Contains)
{
IDiagnosticAnalyzerService analyzerService = GetAnalyzerService();
return new LegacyDiagnosticItemSource(item, _commandHandler, analyzerService);
}
return null;
}
private IDiagnosticAnalyzerService GetAnalyzerService()
{
if (_diagnosticAnalyzerService == null)
{
IComponentModel componentModel = (IComponentModel)_serviceProvider.GetService(typeof(SComponentModel));
_diagnosticAnalyzerService = componentModel.GetService<IDiagnosticAnalyzerService>();
}
return _diagnosticAnalyzerService;
}
}
}
| // 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;
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.Internal.VisualStudio.PlatformUI;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Utilities;
using Microsoft.VisualStudio.ComponentModelHost;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer
{
[Export(typeof(IAttachedCollectionSourceProvider))]
[Name(nameof(LegacyDiagnosticItemProvider)]
[Order]
internal sealed class LegacyDiagnosticItemProvider : AttachedCollectionSourceProvider<AnalyzerItem>
{
private readonly IAnalyzersCommandHandler _commandHandler;
private readonly IServiceProvider _serviceProvider;
private IDiagnosticAnalyzerService _diagnosticAnalyzerService;
[ImportingConstructor]
public LegacyDiagnosticItemProvider(
[Import(typeof(AnalyzersCommandHandler))]IAnalyzersCommandHandler commandHandler,
[Import(typeof(SVsServiceProvider))]IServiceProvider serviceProvider)
{
_commandHandler = commandHandler;
_serviceProvider = serviceProvider;
}
protected override IAttachedCollectionSource CreateCollectionSource(AnalyzerItem item, string relationshipName)
{
if (relationshipName == KnownRelationships.Contains)
{
IDiagnosticAnalyzerService analyzerService = GetAnalyzerService();
return new LegacyDiagnosticItemSource(item, _commandHandler, analyzerService);
}
return null;
}
private IDiagnosticAnalyzerService GetAnalyzerService()
{
if (_diagnosticAnalyzerService == null)
{
IComponentModel componentModel = (IComponentModel)_serviceProvider.GetService(typeof(SComponentModel));
_diagnosticAnalyzerService = componentModel.GetService<IDiagnosticAnalyzerService>();
}
return _diagnosticAnalyzerService;
}
}
}
| apache-2.0 | C# |
771349362bbd5b3e3a59bda8885cf02b80ab6d7f | Implement Alpha node. | modulexcite/dotless,rytmis/dotless,r2i-sitecore/dotless,r2i-sitecore/dotless,rytmis/dotless,r2i-sitecore/dotless,r2i-sitecore/dotless,modulexcite/dotless,dotless/dotless,NickCraver/dotless,r2i-sitecore/dotless,NickCraver/dotless,NickCraver/dotless,modulexcite/dotless,rytmis/dotless,rytmis/dotless,rytmis/dotless,r2i-sitecore/dotless,rytmis/dotless,dotless/dotless,modulexcite/dotless,rytmis/dotless,modulexcite/dotless,modulexcite/dotless,r2i-sitecore/dotless,NickCraver/dotless,modulexcite/dotless | dotlessjs.Core/Tree/Alpha.cs | dotlessjs.Core/Tree/Alpha.cs | using dotless.Infrastructure;
namespace dotless.Tree
{
public class Alpha : Node
{
public Node Value { get; set; }
public Alpha(Node value)
{
Value = value;
}
public override string ToCSS(Env env)
{
return string.Format("alpha(opacity={0})", Value.ToCSS(env));
}
}
} | using System;
using dotless.Infrastructure;
namespace dotless.Tree
{
public class Alpha : Node
{
public Alpha(Node value)
{
throw new NotImplementedException();
}
}
} | apache-2.0 | C# |
4e29bd2caf0edf3b440bbcfa27e34fb05407a75e | Update demo | sunkaixuan/SqlSugar | Src/Asp.Net/SqlServerTest/Config.cs | Src/Asp.Net/SqlServerTest/Config.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
/// <summary>
/// Setting up the database name does not require you to create the database
/// 设置好数据库名不需要你去手动建库
/// </summary>
public class Config
{
/// <summary>
/// Account have permission to create database
/// 用有建库权限的数据库账号
/// </summary>
public static string ConnectionString = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST";
/// <summary>
/// Account have permission to create database
/// 用有建库权限的数据库账号
/// </summary>
public static string ConnectionString2 = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST2";
/// <summary>
/// Account have permission to create database
/// 用有建库权限的数据库账号
/// </summary>
public static string ConnectionString3 = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST3";
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class Config
{
public static string ConnectionString = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST";
public static string ConnectionString2 = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST2";
public static string ConnectionString3 = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST3";
}
}
| apache-2.0 | C# |
daff8d07d3242cbd00ab7fe48b28500cbd800d40 | Update move method. | TammiLion/TacoTinder | TacoTinder/Assets/Scripts/Player.cs | TacoTinder/Assets/Scripts/Player.cs | using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public int playerID;
public float baseFireCooldown;
public float baseRotationSpeed;
public God god;
// public Weapon weapon;
public Vector2 direction; // Maybe this should be private?
public Vector2 targetDirection; // This too.
// Temporary
public GameObject tempProjectile;
private float cooldownTimeStamp;
// Use this for initialization
void Start () {
}
public void Move(float horizontal, float vertical) {
targetDirection = new Vector2 (horizontal, vertical);
}
public void Fire () {
// Don't fire when the cooldown is still active.
if (this.cooldownTimeStamp >= Time.time) {
return;
}
// Fire the weapon.
// TODO
Moveable arrowMoveable = Instantiate(tempProjectile).GetComponent<Moveable> ();
arrowMoveable.direction = this.direction;
// Set the cooldown.
this.cooldownTimeStamp = Time.time + this.baseFireCooldown;
}
// Update is called once per frame
void Update () {
float angle = Vector2.Angle (direction, targetDirection);
this.transform.rotation = Quaternion.AngleAxis (angle, Vector3.up);
// this.transform.Rotate (targetDirection.x, angle * baseRotationSpeed * Time.deltaTime);
this.direction = new Vector2 (this.transform.forward.normalized.x, this.transform.forward.normalized.y);
}
}
| using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public int playerID;
public float baseFireCooldown;
public float baseRotationSpeed;
public God god;
// public Weapon weapon;
public Vector2 direction; // Maybe this should be private?
public Vector2 targetDirection; // This too.
// Temporary
public GameObject tempProjectile;
private float cooldownTimeStamp;
// Use this for initialization
void Start () {
}
public void Move(float horizontal, float vertical) {
targetDirection = new Vector2 (horizontal, vertical);
}
public void Fire () {
// Don't fire when the cooldown is still active.
if (this.cooldownTimeStamp >= Time.time) {
return;
}
// Fire the weapon.
// TODO
Moveable arrowMoveable = Instantiate(tempProjectile).GetComponent<Moveable> ();
arrowMoveable.direction = this.direction;
// Set the cooldown.
this.cooldownTimeStamp = Time.time + this.baseFireCooldown;
}
// Update is called once per frame
void Update () {
float angle = Vector2.Angle (direction, targetDirection);
// this.transform.Rotate (targetDirection.x, angle * baseRotationSpeed * Time.deltaTime);
this.direction = new Vector2 (this.transform.TransformDirection.x , this.transform.TransformDirection.y);
}
}
| apache-2.0 | C# |
a5a92fee7c584843ef1561e74c300ee9ecd22af2 | 修复源集合处理键为空的异常。 :minidisc: | Zongsoft/Zongsoft.Data | src/Common/Expressions/SourceCollection.cs | src/Common/Expressions/SourceCollection.cs | /*
* _____ ______
* /_ / ____ ____ ____ _________ / __/ /_
* / / / __ \/ __ \/ __ \/ ___/ __ \/ /_/ __/
* / /__/ /_/ / / / / /_/ /\_ \/ /_/ / __/ /_
* /____/\____/_/ /_/\__ /____/\____/_/ \__/
* /____/
*
* Authors:
* 钟峰(Popeye Zhong) <zongsoft@qq.com>
*
* Copyright (C) 2015-2018 Zongsoft Corporation <http://www.zongsoft.com>
*
* This file is part of Zongsoft.Data.
*
* Zongsoft.Data is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Zongsoft.Data is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Zongsoft.Data; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using System.Collections.Generic;
namespace Zongsoft.Data.Common.Expressions
{
internal class SourceCollection : Zongsoft.Collections.NamedCollectionBase<ISource>
{
#region 构造函数
public SourceCollection(params ISource[] items)
{
if(items != null && items.Length > 0)
{
foreach(var item in items)
this.AddItem(item);
}
}
#endregion
#region 重写方法
protected override string GetKeyForItem(ISource item)
{
if(item is JoinClause join)
return join.Name;
else
return item.Alias ?? item.ToString();
}
#endregion
}
}
| /*
* _____ ______
* /_ / ____ ____ ____ _________ / __/ /_
* / / / __ \/ __ \/ __ \/ ___/ __ \/ /_/ __/
* / /__/ /_/ / / / / /_/ /\_ \/ /_/ / __/ /_
* /____/\____/_/ /_/\__ /____/\____/_/ \__/
* /____/
*
* Authors:
* 钟峰(Popeye Zhong) <zongsoft@qq.com>
*
* Copyright (C) 2015-2018 Zongsoft Corporation <http://www.zongsoft.com>
*
* This file is part of Zongsoft.Data.
*
* Zongsoft.Data is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Zongsoft.Data is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Zongsoft.Data; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using System.Collections.Generic;
namespace Zongsoft.Data.Common.Expressions
{
internal class SourceCollection : Zongsoft.Collections.NamedCollectionBase<ISource>
{
#region 构造函数
public SourceCollection(params ISource[] items)
{
if(items != null && items.Length > 0)
{
foreach(var item in items)
this.AddItem(item);
}
}
#endregion
#region 重写方法
protected override string GetKeyForItem(ISource item)
{
if(item is JoinClause join)
return join.Name;
else
return item.Alias;
}
/*
protected override ISource GetItem(string name)
{
if(this.TryGetItem(name, out var item))
return item;
throw new KeyNotFoundException();
}
protected override bool TryGetItem(string name, out ISource value)
{
if(base.TryGetItem(name, out value))
return true;
foreach(var entry in this.InnerDictionary)
{
if(entry.Value is JoinClause joining)
{
if(string.Equals(joining.Name, name, StringComparison.OrdinalIgnoreCase))
{
value = joining;
return true;
}
}
}
return false;
}
protected override bool ContainsName(string name)
{
if(base.ContainsName(name))
return true;
foreach(var entry in this.InnerDictionary)
{
if(entry.Value is JoinClause joining)
{
if(string.Equals(joining.Name, name, StringComparison.OrdinalIgnoreCase))
return true;
}
}
return false;
}
*/
#endregion
}
}
| lgpl-2.1 | C# |
a684470af53446e0547bac89b524825c66533abf | change value of one enumeration | fredatgithub/UsefulFunctions | FonctionsUtiles.Fred.Csharp/Enumerations.cs | FonctionsUtiles.Fred.Csharp/Enumerations.cs | namespace FonctionsUtiles.Fred.Csharp
{
public enum TimeSpanElement
{
Millisecond,
Second,
Minute,
Hour,
Day
}
public enum LetterCasingSequence
{
LowerUpperDigit,
UpperLowerDigit,
DigitLowerUpper,
DigitUpperLower,
LowerDigitUpper,
UpperDigitLower
}
public enum RandomCharacters
{
LowerCase = 1,
UpperCase = 2,
Digit = 3,
SpecialCharacter = 4,
UpperLower = 5, //LowerCase & UpperCase,
LowerDigit = 6, //LowerCase & Digit,
UpperDigit = 7, //UpperCase & Digit,
UpperLowerDigit = 8, //UpperLower & Digit,
LowerSpecialChar = 9, //LowerCase & SpecialCharacter,
UpperSpecialChar = 10, //UpperCase & SpecialCharacter,
DigitSpecialChar = 11, //Digit & SpecialCharacter
UpperLowerSpecial = 12,
UpperDigitSpecial = 13,
UpperLowerDigitSpecial = 14 // kept numbering because of a possible future change
}
public enum TranslationLanguage
{
NoTranslation = 0,
ToFrench = 1,
ToEnglish = 2,
ToBothFrenchAndEnglish = ToFrench & ToEnglish,
All = ToFrench & ToEnglish, // & any other language if you have any
//ToBothFrenchAndEnglish = ToFrench & ToEnglish
}
public enum DefaultCasing
{
defaultLowerCase,
defaultUpperCase,
defaultAsIs
}
public enum ImplicitUseKindFlags
{
Default = Access | Assign | InstantiatedWithFixedConstructorSignature,
Access = 1,
Assign = 2,
InstantiatedWithFixedConstructorSignature = 4,
InstantiatedNoFixedConstructorSignature = 8,
}
public enum ImplicitUseTargetFlags
{
Default = Itself,
Itself = 1,
Members = 2,
WithMembers = Itself | Members
}
public enum SearchedLanguage
{
NoLanguageChosen = 0,
French = 1,
English = 2,
FrenchAndEnglish = 3 //French & English // = 3
}
} | namespace FonctionsUtiles.Fred.Csharp
{
public enum TimeSpanElement
{
Millisecond,
Second,
Minute,
Hour,
Day
}
public enum LetterCasingSequence
{
LowerUpperDigit,
UpperLowerDigit,
DigitLowerUpper,
DigitUpperLower,
LowerDigitUpper,
UpperDigitLower
}
public enum RandomCharacters
{
LowerCase = 1,
UpperCase = 2,
Digit = 3,
SpecialCharacter = 4,
UpperLower = 5, //LowerCase & UpperCase,
LowerDigit = 6, //LowerCase & Digit,
UpperDigit = 7, //UpperCase & Digit,
UpperLowerDigit = 8, //UpperLower & Digit,
LowerSpecialChar = 9, //LowerCase & SpecialCharacter,
UpperSpecialChar = 10, //UpperCase & SpecialCharacter,
DigitSpecialChar = 11, //Digit & SpecialCharacter
UpperLowerSpecial = 12,
UpperDigitSpecial = 13,
UpperLowerDigitSpecial = 14 // kept numbering because of a possible future change
}
public enum TranslationLanguage
{
NoTranslation = 0,
ToFrench = 1,
ToEnglish = 2,
ToBothFrenchAndEnglish = ToFrench & ToEnglish,
All = ToFrench & ToEnglish, // & any other language if you have any
//ToBothFrenchAndEnglish = ToFrench & ToEnglish
}
public enum DefaultCasing
{
defaultLowerCase,
defaultUpperCase,
defaultAsIs
}
public enum ImplicitUseKindFlags
{
Default = Access | Assign | InstantiatedWithFixedConstructorSignature,
Access = 1,
Assign = 2,
InstantiatedWithFixedConstructorSignature = 4,
InstantiatedNoFixedConstructorSignature = 8,
}
public enum ImplicitUseTargetFlags
{
Default = Itself,
Itself = 1,
Members = 2,
WithMembers = Itself | Members
}
public enum SearchedLanguage
{
NoLanguageChosen = 0,
French = 1,
English = 2,
FrenchAndEnglish = French & English // = 3
}
} | mit | C# |
7d216fa9228ebd86e01a4ba7f3837592564a99ed | Fix #40 | lucasdavid/Gamedalf,lucasdavid/Gamedalf | Gamedalf/Controllers/Api/TermsController.cs | Gamedalf/Controllers/Api/TermsController.cs | using Gamedalf.Core.Models;
using Gamedalf.Services;
using Gamedalf.ViewModels;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Description;
namespace Gamedalf.Controllers.Api
{
public class TermsController : ApiController
{
private readonly TermsService _terms;
public TermsController(TermsService terms)
{
_terms = terms;
}
// GET: api/Terms/5
[ResponseType(typeof(TermsJsonViewModel))]
public async Task<IHttpActionResult> GetTerms(int id)
{
Terms terms = await _terms.Find(id);
if (terms == null)
{
return NotFound();
}
return Ok(new TermsJsonViewModel
{
Id = terms.Id,
Title = terms.Title,
Content = terms.Content,
DateCreated = terms.DateCreated
});
}
[ResponseType(typeof(TermsJsonViewModel))]
public async Task<IHttpActionResult> GetTerms(string title)
{
var terms = await _terms.Latest(title);
if (terms == null)
{
return NotFound();
}
return Ok(new TermsJsonViewModel {
Id = terms.Id,
Title = terms.Title,
Content = terms.Content,
DateCreated = terms.DateCreated
});
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
_terms.Dispose();
}
base.Dispose(disposing);
}
private async Task<bool> TermsExists(int id)
{
return await _terms.Exists(id);
}
}
} | using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Description;
using Gamedalf.Core.Data;
using Gamedalf.Core.Models;
using Gamedalf.Services;
namespace Gamedalf.Controllers.Api
{
public class TermsController : ApiController
{
private readonly TermsService _terms;
public TermsController(TermsService terms)
{
_terms = terms;
}
// GET: api/Terms
public async Task<ICollection<Terms>> GetTerms()
{
return await _terms.All();
}
// GET: api/Terms/5
[ResponseType(typeof(Terms))]
public async Task<IHttpActionResult> GetTerms(int id)
{
Terms terms = await _terms.Find(id);
if (terms == null)
{
return NotFound();
}
return Ok(terms);
}
[ResponseType(typeof(Terms))]
public async Task<IHttpActionResult> GetTerms(string title)
{
var terms = await _terms.Latest(title);
if (terms == null)
{
return NotFound();
}
return Ok(terms);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
_terms.Dispose();
}
base.Dispose(disposing);
}
private async Task<bool> TermsExists(int id)
{
return await _terms.Exists(id);
}
}
} | mit | C# |
af6f715366ea657ef0b63113f6a4283eea384e6f | Fix to Facebook Url | fujiy/FujiyBlog,fujiy/FujiyBlog,fujiy/FujiyBlog | src/FujiyBlog.Web/App_Code/Facebook.cshtml | src/FujiyBlog.Web/App_Code/Facebook.cshtml | @using System.Collections.Specialized
@helper Like(string url){
<iframe src="//www.facebook.com/plugins/like.php?href=@HttpUtility.UrlEncode(url)&send=false&layout=button_count&width=450&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>
@*<div class="fb-like" data-href="@url" data-send="false" data-layout="button_count" data-width="50" data-show-faces="false"></div>*@
} | @using System.Collections.Specialized
@helper Like(string url){
<iframe src="//www.facebook.com/plugins/like.php?href=@HttpUtility.UrlEncode(url)%2F&send=false&layout=button_count&width=450&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>
@*<div class="fb-like" data-href="@url" data-send="false" data-layout="button_count" data-width="50" data-show-faces="false"></div>*@
} | mit | C# |
b98d02743b778915251bd23314275c5691c4775d | remove unnecessary case | hecomi/UWO,hecomi/UWO | Assets/UWO/Example/Scripts/AnimationSync.cs | Assets/UWO/Example/Scripts/AnimationSync.cs | using UnityEngine;
using System.Collections;
using UWO;
public class AnimationSync : SynchronizedComponent
{
private Animator animator_;
public Animator animator
{
get { return animator_ ?? (animator_ = GetComponent<Animator>()); }
}
protected override void OnSend()
{
var data = new MultiValue();
foreach (var param in animator.parameters) {
data.Push(param.name);
switch (param.type) {
case AnimatorControllerParameterType.Bool:
data.Push(animator.GetBool(param.name));
break;
case AnimatorControllerParameterType.Int:
data.Push(animator.GetInteger(param.name));
break;
case AnimatorControllerParameterType.Float:
data.Push(animator.GetFloat(param.name));
break;
}
}
Send(data);
}
protected override void OnReceive(MultiValue data)
{
while (data.values.Count > 0) {
var name = data.Pop().value;
var param = data.Pop();
switch (param.type) {
case "bool":
animator.SetBool(name, param.value.AsBool());
break;
case "int":
animator.SetInteger(name, param.value.AsInt());
break;
case "float":
animator.SetFloat(name, param.value.AsFloat());
break;
}
}
}
}
| using UnityEngine;
using System.Collections;
using UWO;
public class AnimationSync : SynchronizedComponent
{
private Animator animator_;
public Animator animator
{
get { return animator_ ?? (animator_ = GetComponent<Animator>()); }
}
protected override void OnSend()
{
var data = new MultiValue();
foreach (var param in animator.parameters) {
data.Push(param.name);
switch (param.type) {
case AnimatorControllerParameterType.Bool:
data.Push(animator.GetBool(param.name));
break;
case AnimatorControllerParameterType.Int:
data.Push(animator.GetInteger(param.name));
break;
case AnimatorControllerParameterType.Float:
data.Push(animator.GetFloat(param.name));
break;
default:
Debug.LogWarning("No supported format: " + param.type);
break;
}
}
Send(data);
}
protected override void OnReceive(MultiValue data)
{
while (data.values.Count > 0) {
var name = data.Pop().value;
var param = data.Pop();
switch (param.type) {
case "bool":
animator.SetBool(name, param.value.AsBool());
break;
case "int":
animator.SetInteger(name, param.value.AsInt());
break;
case "float":
animator.SetFloat(name, param.value.AsFloat());
break;
}
}
}
}
| mit | C# |
ef88086fe07538792d7b172f7a7ef53c0998dc18 | Update MicrosoftInterstitialAdUnitBundleTests.cs | tiksn/TIKSN-Framework | TIKSN.UnitTests.Shared/Advertising/MicrosoftInterstitialAdUnitBundleTests.cs | TIKSN.UnitTests.Shared/Advertising/MicrosoftInterstitialAdUnitBundleTests.cs | using FluentAssertions;
using Xunit;
namespace TIKSN.Advertising.Tests
{
public class MicrosoftInterstitialAdUnitBundleTests
{
[Fact]
public void CreateMicrosoftInterstitialAdUnitBundle()
{
string applicationId = "b008491d-9b9b-4b78-9d5c-28e08b573268";
string adUnitId = "d34e3fdd-1840-455d-abab-f8698b5f3318";
var bundle = new MicrosoftInterstitialAdUnitBundle(applicationId, adUnitId);
bundle.Production.ApplicationId.Should().Be(applicationId);
bundle.Production.AdUnitId.Should().Be(adUnitId);
bundle.Production.IsTest.Should().BeFalse();
bundle.DesignTime.IsTest.Should().BeTrue();
}
}
} | using FluentAssertions;
using Xunit;
namespace TIKSN.Advertising.Tests
{
public class MicrosoftInterstitialAdUnitBundleTests
{
[Fact]
public void CreateMicrosoftInterstitialAdUnitBundle()
{
string tabletApplicationId = "b008491d-9b9b-4b78-9d5c-28e08b573268";
string tabletAdUnitId = "d34e3fdd-1840-455d-abab-f8698b5f3318";
string mobileApplicationId = "6d0d7c55-0f1a-4208-a7b9-a6943c84488a";
string mobileAdUnitId = "b7c073c3-5e40-47ae-b02b-eb2fa3f90036";
var bundle = new MicrosoftInterstitialAdUnitBundle(tabletApplicationId, tabletAdUnitId, mobileApplicationId, mobileAdUnitId);
bundle.Tablet.ApplicationId.Should().Be(tabletApplicationId);
bundle.Tablet.AdUnitId.Should().Be(tabletAdUnitId);
bundle.Tablet.IsTest.Should().BeFalse();
bundle.Mobile.ApplicationId.Should().Be(mobileApplicationId);
bundle.Mobile.AdUnitId.Should().Be(mobileAdUnitId);
bundle.Mobile.IsTest.Should().BeFalse();
bundle.DesignTime.IsTest.Should().BeTrue();
}
}
} | mit | C# |
e51d3833780498e01aabdd67c53ac1a595e53ea1 | add toolbar to the tool window | yysun/git-tools | VSIXProject2019/GitChangesWindow.cs | VSIXProject2019/GitChangesWindow.cs | namespace VSIXProject2019
{
using System;
using System.ComponentModel.Design;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Shell;
/// <summary>
/// This class implements the tool window exposed by this package and hosts a user control.
/// </summary>
/// <remarks>
/// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane,
/// usually implemented by the package implementer.
/// <para>
/// This class derives from the ToolWindowPane class provided from the MPF in order to use its
/// implementation of the IVsUIElementPane interface.
/// </para>
/// </remarks>
[Guid(WindowGuidString)]
public class GitChangesWindow : ToolWindowPane
{
public const string WindowGuidString = "e0487501-8bf2-4e94-8b35-ceb6f0010c44"; // Replace with new GUID in your own code
public const string Title = "Git Changes Window";
/// <summary>
/// Initializes a new instance of the <see cref="GitChangesWindow"/> class.
/// </summary>
public GitChangesWindow(GitChangesWindowState state) : base()
{
this.Caption = "Git Changes";
this.ToolBar = new CommandID(GuidList.guidVsGitToolsPackageCmdSet, PkgCmdIDList.imnuGitChangesToolWindowToolbarMenu);
// This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
// we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
// the object returned by the Content property.
this.Content = new GitChangesWindowControl();
}
}
public class GitChangesWindowState
{
public EnvDTE80.DTE2 DTE { get; set; }
}
}
| namespace VSIXProject2019
{
using System;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Shell;
/// <summary>
/// This class implements the tool window exposed by this package and hosts a user control.
/// </summary>
/// <remarks>
/// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane,
/// usually implemented by the package implementer.
/// <para>
/// This class derives from the ToolWindowPane class provided from the MPF in order to use its
/// implementation of the IVsUIElementPane interface.
/// </para>
/// </remarks>
[Guid(WindowGuidString)]
public class GitChangesWindow : ToolWindowPane
{
public const string WindowGuidString = "e0487501-8bf2-4e94-8b35-ceb6f0010c44"; // Replace with new GUID in your own code
public const string Title = "Git Changes Window";
/// <summary>
/// Initializes a new instance of the <see cref="GitChangesWindow"/> class.
/// </summary>
public GitChangesWindow(GitChangesWindowState state) : base()
{
this.Caption = "Git Changes";
// This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
// we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
// the object returned by the Content property.
this.Content = new GitChangesWindowControl();
}
}
public class GitChangesWindowState
{
public EnvDTE80.DTE2 DTE { get; set; }
}
}
| mit | C# |
2b3c3e65d97871eb134365d693afd7fa8b843093 | Package Update #CHANGE: Pushed AdamsLair.WinForms 1.1.9 | AdamsLair/winforms | WinForms/Properties/AssemblyInfo.cs | WinForms/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("AdamsLair.WinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdamsLair.WinForms")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("735ee5dc-8c18-4a06-8e64-2f172ddd01cc")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.9")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("AdamsLair.WinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdamsLair.WinForms")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("735ee5dc-8c18-4a06-8e64-2f172ddd01cc")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.8")]
| mit | C# |
e79b76bc7195a0fba5dee318339870ed9da3fc08 | Add examples to ZermeloAuthenticator | arthurrump/Zermelo.API | Zermelo.API/ZermeloAuthenticator.cs | Zermelo.API/ZermeloAuthenticator.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zermelo.API.Factories;
using Zermelo.API.Helpers;
using Zermelo.API.Services.Interfaces;
namespace Zermelo.API
{
/// <summary>
/// This class gives an object that can be used to generate an <see cref="Authentication"/> object using an authorization code.
/// The <see cref="Authentication"/> object can than be used to connect to the Zermelo API using an <see cref="ZermeloConnection"/> object.
/// </summary>
/// <remarks>
/// For more information on the authentication flow of the Zermelo API, visit the official documentation
/// <a href="https://zermelo.atlassian.net/wiki/display/DEV/Rest+Authentication#RestAuthentication-Obtainanauthorizationcodefromtheuser">
/// over here</a>.
/// </remarks>
/// <example><code>
/// ZermeloAuthenticator authenticator = new ZermeloAuthenticator();
/// Authentication auth = await authenticator.GetAuthenticationAsync("school", "123456789123");
/// </code></example>
/// <seealso cref="Authentication"/>
/// <seealso cref="ZermeloConnection"/>
public class ZermeloAuthenticator
{
IUrlBuilder _urlBuilder;
IHttpService _httpService;
IJsonService _jsonService;
internal ZermeloAuthenticator(IUrlBuilder urlBuilder, IHttpService httpService, IJsonService jsonService)
{
_urlBuilder = urlBuilder;
_httpService = httpService;
_jsonService = jsonService;
}
/// <summary>
/// Create a new <see cref="ZermeloAuthenticator"/> object.
/// </summary>
/// <example><code>
/// ZermeloAuthenticator authenticator = new ZermeloAuthenticator();
/// </code></example>
public ZermeloAuthenticator()
{
DependencyHelper.Initialize(out _urlBuilder, out _httpService, out _jsonService);
}
/// <summary>
/// Get an <see cref="Authentication"/> object using an authorization code.
/// </summary>
/// <param name="host">The host to connect to, usually the name of the school.
/// If the url to get to the Zermelo Portal is https://school.zportal.nl, then 'school' is the host.</param>
/// <param name="code">The authentication code. The user can find this code in the portal using the "Koppel App" screen.</param>
/// <returns>An <see cref="Authentication"/> object that can be used to connect
/// to the Zermelo API using a <see cref="ZermeloConnection"/> object.</returns>
/// <example><code>
/// Authentication auth = await authenticator.GetAuthenticationAsync("school", "123456789123");
/// </code></example>
public async Task<Authentication> GetAuthenticationAsync(string host, string code)
{
AuthenticationFactory authFactory = new AuthenticationFactory(_urlBuilder, _httpService, _jsonService);
return await authFactory.WithCode(host, code);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zermelo.API.Factories;
using Zermelo.API.Helpers;
using Zermelo.API.Services.Interfaces;
namespace Zermelo.API
{
/// <summary>
/// This class gives an object that can be used to generate an <see cref="Authentication"/> object using an authorization code.
/// The <see cref="Authentication"/> object can than be used to connect to the Zermelo API using an <see cref="ZermeloConnection"/> object.
/// </summary>
/// <remarks>
/// For more information on the authentication flow of the Zermelo API, visit the official documentation
/// <a href="https://zermelo.atlassian.net/wiki/display/DEV/Rest+Authentication#RestAuthentication-Obtainanauthorizationcodefromtheuser">
/// over here</a>.
/// </remarks>
/// <seealso cref="Authentication"/>
/// <seealso cref="ZermeloConnection"/>
public class ZermeloAuthenticator
{
IUrlBuilder _urlBuilder;
IHttpService _httpService;
IJsonService _jsonService;
internal ZermeloAuthenticator(IUrlBuilder urlBuilder, IHttpService httpService, IJsonService jsonService)
{
_urlBuilder = urlBuilder;
_httpService = httpService;
_jsonService = jsonService;
}
/// <summary>
/// Create a new <see cref="ZermeloAuthenticator"/> object.
/// </summary>
public ZermeloAuthenticator()
{
DependencyHelper.Initialize(out _urlBuilder, out _httpService, out _jsonService);
}
/// <summary>
/// Get an <see cref="Authentication"/> object using an authorization code.
/// </summary>
/// <param name="host">The host to connect to, usually the name of the school.
/// If the url to get to the Zermelo Portal is https://school.zportal.nl, then 'school' is the host.</param>
/// <param name="code">The authentication code. The user can find this code in the portal using the "Koppel App" screen.</param>
/// <returns>An <see cref="Authentication"/> object that can be used to connect
/// to the Zermelo API using a <see cref="ZermeloConnection"/> object.</returns>
public async Task<Authentication> GetAuthenticationAsync(string host, string code)
{
AuthenticationFactory authFactory = new AuthenticationFactory(_urlBuilder, _httpService, _jsonService);
return await authFactory.WithCode(host, code);
}
}
}
| mit | C# |
00e7d624c41b80cfb8be91afe74a52b74ecb5cf0 | Fix orientation's value type stored in metadata | jamesmontemagno/MediaPlugin,jamesmontemagno/MediaPlugin | src/Media.Plugin.iOS/PhotoLibraryAccess.cs | src/Media.Plugin.iOS/PhotoLibraryAccess.cs | using System;
using CoreImage;
using Foundation;
using Photos;
namespace Plugin.Media
{
/// <summary>
/// Accesst library
/// </summary>
public static class PhotoLibraryAccess
{
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static NSDictionary GetPhotoLibraryMetadata(NSUrl url)
{
NSDictionary meta = null;
var image = PHAsset.FetchAssets(new NSUrl[] { url }, new PHFetchOptions()).firstObject as PHAsset;
var imageManager = PHImageManager.DefaultManager;
var requestOptions = new PHImageRequestOptions
{
Synchronous = true,
NetworkAccessAllowed = true,
DeliveryMode = PHImageRequestOptionsDeliveryMode.HighQualityFormat,
};
imageManager.RequestImageData(image, requestOptions, (data, dataUti, orientation, info) =>
{
try
{
var fullimage = CIImage.FromData(data);
if (fullimage?.Properties != null)
{
meta = new NSMutableDictionary
{
[ImageIO.CGImageProperties.Orientation] = NSNumber.FromNInt ((int)(fullimage.Properties.Orientation ?? CIImageOrientation.TopLeft)),
[ImageIO.CGImageProperties.ExifDictionary] = fullimage.Properties.Exif?.Dictionary ?? new NSDictionary(),
[ImageIO.CGImageProperties.TIFFDictionary] = fullimage.Properties.Tiff?.Dictionary ?? new NSDictionary(),
[ImageIO.CGImageProperties.GPSDictionary] = fullimage.Properties.Gps?.Dictionary ?? new NSDictionary(),
[ImageIO.CGImageProperties.IPTCDictionary] = fullimage.Properties.Iptc?.Dictionary ?? new NSDictionary(),
[ImageIO.CGImageProperties.JFIFDictionary] = fullimage.Properties.Jfif?.Dictionary ?? new NSDictionary()
};
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
});
return meta;
}
}
}
| using System;
using CoreImage;
using Foundation;
using Photos;
namespace Plugin.Media
{
/// <summary>
/// Accesst library
/// </summary>
public static class PhotoLibraryAccess
{
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static NSDictionary GetPhotoLibraryMetadata(NSUrl url)
{
NSDictionary meta = null;
var image = PHAsset.FetchAssets(new NSUrl[] { url }, new PHFetchOptions()).firstObject as PHAsset;
var imageManager = PHImageManager.DefaultManager;
var requestOptions = new PHImageRequestOptions
{
Synchronous = true,
NetworkAccessAllowed = true,
DeliveryMode = PHImageRequestOptionsDeliveryMode.HighQualityFormat,
};
imageManager.RequestImageData(image, requestOptions, (data, dataUti, orientation, info) =>
{
try
{
var fullimage = CIImage.FromData(data);
if (fullimage?.Properties != null)
{
meta = new NSMutableDictionary
{
[ImageIO.CGImageProperties.Orientation] = new NSString(fullimage.Properties.Orientation.ToString()),
[ImageIO.CGImageProperties.ExifDictionary] = fullimage.Properties.Exif?.Dictionary ?? new NSDictionary(),
[ImageIO.CGImageProperties.TIFFDictionary] = fullimage.Properties.Tiff?.Dictionary ?? new NSDictionary(),
[ImageIO.CGImageProperties.GPSDictionary] = fullimage.Properties.Gps?.Dictionary ?? new NSDictionary(),
[ImageIO.CGImageProperties.IPTCDictionary] = fullimage.Properties.Iptc?.Dictionary ?? new NSDictionary(),
[ImageIO.CGImageProperties.JFIFDictionary] = fullimage.Properties.Jfif?.Dictionary ?? new NSDictionary()
};
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
});
return meta;
}
}
}
| mit | C# |
dbca758504410e8595b6e07f57717ecd4205b18a | allow for more in-depth customization | NaamloosDT/ModCore,NaamloosDT/ModCore | ModCore/Commands/Base/SimpleConfigModule.cs | ModCore/Commands/Base/SimpleConfigModule.cs | using System.Reflection;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using ModCore.Entities;
using ModCore.Logic;
namespace ModCore.Commands.Base
{
public abstract class SimpleConfigModule : BaseCommandModule
{
protected virtual string CurrentModuleName => GetType().GetCustomAttribute<GroupAttribute>().Name;
protected virtual string EnabledState => "Enabled";
protected virtual string DisabledState => "Disabled";
[GroupCommand, Description("Sets whether this module is enabled or not.")]
public async Task ExecuteGroupAsync(CommandContext ctx, [Description(
"Leave empty to toggle, set to one of `on`, `enable`, `enabled`, `1`, `true`, `yes` or `y` to enable, or " +
"set to one of `off`, `disable`, `disabled`, `0`, `false`, `no` or `n` to disable. "
)] bool? enableOrDisable = null)
{
// we can't access ref inside an async method, so make a copy
var resultingVariable = false;
await ctx.WithGuildSettings(cfg =>
{
ref var configVariable = ref GetSetting(cfg);
resultingVariable = configVariable = enableOrDisable ?? !configVariable;
});
if (resultingVariable)
await AfterEnable(ctx);
else
await AfterDisable(ctx);
// if toggling, tell the user what the new value is
if (!enableOrDisable.HasValue)
await ctx.ElevatedRespondAsync(
$"**{(resultingVariable ? EnabledState : DisabledState)}** the {CurrentModuleName} module.");
await ctx.Message.CreateReactionAsync(Config.CheckMark);
}
/// <summary>
/// Implementations of this method should return a reference to the field to be set.
/// </summary>
/// <param name="cfg">The <see cref="GuildSettings"/> object the setting is tied to</param>
/// <returns>A reference to a field to be set by <see cref="ExecuteGroupAsync"/></returns>
protected abstract ref bool GetSetting(GuildSettings cfg);
protected virtual Task AfterEnable(CommandContext ctx) => Task.CompletedTask;
protected virtual Task AfterDisable(CommandContext ctx) => Task.CompletedTask;
}
} | using System.Reflection;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using ModCore.Entities;
using ModCore.Logic;
namespace ModCore.Commands.Base
{
public abstract class SimpleConfigModule : BaseCommandModule
{
private string CurrentModuleName => GetType().GetCustomAttribute<GroupAttribute>().Name;
[GroupCommand, Description("Sets whether this module is enabled or not.")]
public async Task ExecuteGroupAsync(CommandContext ctx, [Description(
"Leave empty to toggle, set to one of `on`, `enable`, `enabled`, `1`, `true`, `yes` or `y` to enable, or " +
"set to one of `off`, `disable`, `disabled`, `0`, `false`, `no` or `n` to disable. "
)] bool? enableOrDisable = null)
{
// we can't access ref inside an async method, so make a copy
var resultingVariable = false;
await ctx.WithGuildSettings(cfg =>
{
ref var configVariable = ref GetSetting(cfg);
resultingVariable = configVariable = enableOrDisable ?? !configVariable;
});
if (resultingVariable)
await AfterEnable(ctx);
else
await AfterDisable(ctx);
// if toggling, tell the user what the new value is
if (!enableOrDisable.HasValue)
await ctx.ElevatedRespondAsync(
$"**{(resultingVariable ? "Enabled" : "Disabled")}** the {CurrentModuleName} module.");
await ctx.Message.CreateReactionAsync(Config.CheckMark);
}
/// <summary>
/// Implementations of this method should return a reference to the field to be set.
/// </summary>
/// <param name="cfg">The <see cref="GuildSettings"/> object the setting is tied to</param>
/// <returns>A reference to a field to be set by <see cref="ExecuteGroupAsync"/></returns>
protected abstract ref bool GetSetting(GuildSettings cfg);
protected virtual Task AfterEnable(CommandContext ctx) => Task.CompletedTask;
protected virtual Task AfterDisable(CommandContext ctx) => Task.CompletedTask;
}
} | mit | C# |
4ae50b36ded2520818f3e5127752ca5ad2281a1e | Validate assumption that twist axis is primary during import | virtuallynaked/virtually-naked,virtuallynaked/virtually-naked | Importer/src/dumping/SystemDumper.cs | Importer/src/dumping/SystemDumper.cs | using SharpDX;
using System;
using System.IO;
public class SystemDumper {
private Figure figure;
private bool[] channelsToInclude;
private DirectoryInfo targetDirectory;
public SystemDumper(Figure figure, bool[] channelsToInclude) {
this.figure = figure;
this.channelsToInclude = channelsToInclude;
this.targetDirectory = CommonPaths.WorkDir.Subdirectory("figures")
.Subdirectory(figure.Name);
}
private void Dump<T>(string filename, Func<T> factoryFunc) {
var fileInfo = targetDirectory.File(filename);
if (fileInfo.Exists) {
return;
}
T obj = factoryFunc();
targetDirectory.CreateWithParents();
Persistance.Save(fileInfo, obj);
}
private void ValidateBoneSystemAssumptions(Figure figure) {
var outputs = figure.ChannelSystem.DefaultOutputs;
foreach (var bone in figure.Bones) {
var centerPoint = bone.CenterPoint.GetValue(outputs);
var endPoint = bone.EndPoint.GetValue(outputs);
var orientationSpace = bone.GetOrientationSpace(outputs);
var boneDirection = Vector3.Transform(endPoint - centerPoint, orientationSpace.OrientationInverse);
int twistAxis = 0;
for (int i = 1; i < 3; ++i) {
if (Math.Abs(boneDirection[i]) > Math.Abs(boneDirection[twistAxis])) {
twistAxis = i;
}
}
if (twistAxis != bone.RotationOrder.primaryAxis) {
throw new Exception("twist axis is not primary axis");
}
}
}
public void DumpAll() {
var surfaceProperties = SurfacePropertiesJson.Load(figure);
targetDirectory.CreateWithParents();
Persistance.Save(targetDirectory.File("surface-properties.dat"), surfaceProperties);
Dump("shaper-parameters.dat", () => figure.MakeShaperParameters(channelsToInclude));
Dump("channel-system-recipe.dat", () => figure.MakeChannelSystemRecipe());
if (figure.Parent == null) {
ValidateBoneSystemAssumptions(figure);
Dump("bone-system-recipe.dat", () => figure.MakeBoneSystemRecipe());
Dump("inverter-parameters.dat", () => figure.MakeInverterParameters());
}
}
public static void DumpFigure(Figure figure, bool[] channelsToInclude) {
new SystemDumper(figure, channelsToInclude).DumpAll();
}
}
| using System;
using System.IO;
public class SystemDumper {
private Figure figure;
private bool[] channelsToInclude;
private DirectoryInfo targetDirectory;
public SystemDumper(Figure figure, bool[] channelsToInclude) {
this.figure = figure;
this.channelsToInclude = channelsToInclude;
this.targetDirectory = CommonPaths.WorkDir.Subdirectory("figures")
.Subdirectory(figure.Name);
}
private void Dump<T>(string filename, Func<T> factoryFunc) {
var fileInfo = targetDirectory.File(filename);
if (fileInfo.Exists) {
return;
}
T obj = factoryFunc();
targetDirectory.CreateWithParents();
Persistance.Save(fileInfo, obj);
}
public void DumpAll() {
var surfaceProperties = SurfacePropertiesJson.Load(figure);
targetDirectory.CreateWithParents();
Persistance.Save(targetDirectory.File("surface-properties.dat"), surfaceProperties);
Dump("shaper-parameters.dat", () => figure.MakeShaperParameters(channelsToInclude));
Dump("channel-system-recipe.dat", () => figure.MakeChannelSystemRecipe());
if (figure.Parent == null) {
Dump("bone-system-recipe.dat", () => figure.MakeBoneSystemRecipe());
Dump("inverter-parameters.dat", () => figure.MakeInverterParameters());
}
}
public static void DumpFigure(Figure figure, bool[] channelsToInclude) {
new SystemDumper(figure, channelsToInclude).DumpAll();
}
}
| mit | C# |
327604fb4c67c12f656c6a27cd4211931cb0ac83 | Add CommandDate so it is deserialized from the JSON response | nwoolls/MultiMiner,IWBWbiz/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner | MultiMiner.MobileMiner.Api/RemoteCommand.cs | MultiMiner.MobileMiner.Api/RemoteCommand.cs | using System;
namespace MultiMiner.MobileMiner.Api
{
public class RemoteCommand
{
public int Id { get; set; }
public string CommandText { get; set; }
public DateTime CommandDate { get; set; }
}
}
| namespace MultiMiner.MobileMiner.Api
{
public class RemoteCommand
{
public int Id { get; set; }
public string CommandText { get; set; }
}
}
| mit | C# |
eedf83ae2e1d4e0fe7d4b6befc02cebe9b11781c | update version | bijakatlykkex/NBitcoin.Indexer,MetacoSA/NBitcoin.Indexer,NicolasDorier/NBitcoin.Indexer | NBitcoin.Indexer/Properties/AssemblyInfo.cs | NBitcoin.Indexer/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("NBitcoin.Indexer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicolas Dorier")]
[assembly: AssemblyProduct("NBitcoin.Indexer")]
[assembly: AssemblyCopyright("Copyright © AO-IS 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:InternalsVisibleTo("NBitcoin.Indexer.Tests")]
// 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("c2103e2f-76fe-4cd4-a129-edd06fa97913")]
// 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: AssemblyInformationalVersion("2.0.6.5")]
[assembly: AssemblyVersion("2.0.6.5")]
[assembly: AssemblyFileVersion("2.0.6.5")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NBitcoin.Indexer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicolas Dorier")]
[assembly: AssemblyProduct("NBitcoin.Indexer")]
[assembly: AssemblyCopyright("Copyright © AO-IS 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:InternalsVisibleTo("NBitcoin.Indexer.Tests")]
// 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("c2103e2f-76fe-4cd4-a129-edd06fa97913")]
// 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: AssemblyInformationalVersion("2.0.6.4")]
[assembly: AssemblyVersion("2.0.6.4")]
[assembly: AssemblyFileVersion("2.0.6.4")]
| mit | C# |
49be0a09dd431963aee4f472fc17cf23c4c39c32 | Remove dupe check | erikvanbrakel/Cake.Terraform,erikvanbrakel/Cake.Terraform,mikhail-denisenko/Cake.Terraform | setup.cake | setup.cake | #load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Cake.Terraform",
repositoryOwner: "erikvanbrakel",
repositoryName: "Cake.Terraform",
appVeyorAccountName: "erikvanbrakel",
webHost: "erikvanbrakel.github.io",
webLinkRoot: "Cake.Terraform",
webBaseEditUrl: "https://github.com/erikvanbrakel/Cake.Terraform/tree/develop/docs/input"
);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
dupFinderExcludePattern: new string[] {
BuildParameters.RootDirectoryPath + "/src/Cake.Terraform.Tests/**/*.cs"
},
dupFinderThrowExceptionOnFindingDuplicates: false,
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* ",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.Run();
| #load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Cake.Terraform",
repositoryOwner: "erikvanbrakel",
repositoryName: "Cake.Terraform",
appVeyorAccountName: "erikvanbrakel",
webHost: "erikvanbrakel.github.io",
webLinkRoot: "Cake.Terraform",
webBaseEditUrl: "https://github.com/erikvanbrakel/Cake.Terraform/tree/develop/docs/input"
);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
dupFinderExcludePattern: new string[] {
BuildParameters.RootDirectoryPath + "/src/Cake.Terraform.Tests/**/*.cs"
},
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* ",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.Run();
| mit | C# |
c1330c8ee69d79fd3569face721c6f89e0dc7fb5 | Update /Home/Index.cshtml | aliencube/ReCaptcha.NET,aliencube/ReCaptcha.NET,aliencube/ReCaptcha.NET | SourceCodes/02_Apps/ReCaptcha.Wrapper.WebApp/Views/Home/Index.cshtml | SourceCodes/02_Apps/ReCaptcha.Wrapper.WebApp/Views/Home/Index.cshtml | @{
ViewBag.Title = "Index";
}
<div class="row" style="margin-top: 10px;">
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="jumbotron text-center">
<p>@Html.ActionLink("Basic", MVC.Home.ActionNames.Basic)</p>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="jumbotron text-center">
<p>@Html.ActionLink("Advanced", MVC.Home.ActionNames.Advanced)</p>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="jumbotron text-center">
<p>@Html.ActionLink("Callback", MVC.Home.ActionNames.Callback)</p>
</div>
</div>
</div>
| @{
ViewBag.Title = "Index";
}
<h2>@ViewBag.Title</h2>
<ul>
<li>@Html.ActionLink("Basic", MVC.Home.ActionNames.Basic)</li>
<li>@Html.ActionLink("Advanced", MVC.Home.ActionNames.Advanced)</li>
<li>@Html.ActionLink("Callback", MVC.Home.ActionNames.Callback)</li>
</ul>
| mit | C# |
4bdf86020dfeb6065e3bc46d2cfbbcce7d02a6ce | Fix build (#6193) | hyonholee/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,stankovski/azure-sdk-for-net,markcowl/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,hyonholee/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,hyonholee/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,hyonholee/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,stankovski/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,hyonholee/azure-sdk-for-net | sdk/core/Azure.Core/src/Pipeline/HttpHeader.cs | sdk/core/Azure.Core/src/Pipeline/HttpHeader.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Runtime.InteropServices;
namespace Azure.Core.Pipeline
{
public readonly struct HttpHeader : IEquatable<HttpHeader>
{
public HttpHeader(string name, string value)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentException(nameof(name));
}
Name = name;
Value = value;
}
public string Name { get; }
public string Value { get; }
public override int GetHashCode()
{
var hashCode = new HashCodeBuilder();
hashCode.Add(Name, StringComparer.InvariantCultureIgnoreCase);
hashCode.Add(Value);
return hashCode.ToHashCode();
}
public override bool Equals(object obj)
{
if (obj is HttpHeader header)
{
return Equals(header);
}
return false;
}
public override string ToString() => $"{Name}:{Value}";
public bool Equals(HttpHeader other)
{
return string.Equals(Name, other.Name, StringComparison.InvariantCultureIgnoreCase) && Value.Equals(other.Value);
}
public static class Names
{
public static string Date => "Date";
public static string ContentType => "Content-Type";
public static string XMsRequestId => "x-ms-request-id";
public static string UserAgent => "User-Agent";
public static string Accept => "Accept";
public static string Authorization => "Authorization";
}
public static class Common
{
static readonly string s_applicationJson = "application/json";
static readonly string s_applicationOctetStream = "application/octet-stream";
public static readonly HttpHeader JsonContentType = new HttpHeader(Names.ContentType, s_applicationJson);
public static readonly HttpHeader OctetStreamContentType = new HttpHeader(Names.ContentType, s_applicationOctetStream);
}
}
}
| // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Runtime.InteropServices;
namespace Azure.Core.Pipeline
{
public readonly struct HttpHeader : IEquatable<HttpHeader>
{
public HttpHeader(string name, string value)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentException(nameof(name));
}
Name = name;
Value = value;
}
public string Name { get; }
public string Value { get; }
public override int GetHashCode()
{
var hashCode = new HashCodeBuilder();
hashCode.Add(Name, StringComparer.InvariantCultureIgnoreCase);
hashCode.Add(Value);
return hashCode.ToHashCode();
}
public override bool Equals(object obj)
{
if (obj is HttpHeader header)
{
return Equals(header);
}
return false;
}
public override string ToString() => $"{Name}:{Value}";
public bool Equals(HttpHeader other)
{
return string.Equals(Name, other.Name, StringComparison.InvariantCultureIgnoreCase) && Value.Equals(other.Value);
}
public static class Names
{
public static string Date => "Date";
public static string ContentType => "Content-Type";
public static string XMsRequestId => "x-ms-request-id";
public static string UserAgent => "User-Agent";
public static string Authorization => "Authorization";
}
public static class Common
{
static readonly string s_applicationJson = "application/json";
static readonly string s_applicationOctetStream = "application/octet-stream";
public static readonly HttpHeader JsonContentType = new HttpHeader(Names.ContentType, s_applicationJson);
public static readonly HttpHeader OctetStreamContentType = new HttpHeader(Names.ContentType, s_applicationOctetStream);
}
}
}
| mit | C# |
dba86467ceb0fbe29763ac64403398b02f58eb05 | Test discovery skips over abstract base classes. | AArnott/pcltesting,dsplaisted/pcltesting | PCLTesting/Infrastructure/TestDiscoverer.cs | PCLTesting/Infrastructure/TestDiscoverer.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace PCLTesting.Infrastructure
{
public class TestDiscoverer
{
public IEnumerable<Test> DiscoverTests(Assembly assembly)
{
List<Test> ret = new List<Test>();
foreach (Type type in assembly.GetExportedTypes().Where(t => !t.IsAbstract))
{
ret.AddRange(DiscoverTests(type));
}
return ret;
}
public IEnumerable<Test> DiscoverTests(Type type)
{
List<Test> ret = new List<Test>();
foreach (MethodInfo method in type.GetMethods())
{
if (method.GetCustomAttributes(false).Any(
attr => attr.GetType().Name == "TestMethodAttribute"))
{
var test = new Test(method);
ret.Add(test);
}
}
return ret;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace PCLTesting.Infrastructure
{
public class TestDiscoverer
{
public IEnumerable<Test> DiscoverTests(Assembly assembly)
{
List<Test> ret = new List<Test>();
foreach (Type type in assembly.GetExportedTypes())
{
ret.AddRange(DiscoverTests(type));
}
return ret;
}
public IEnumerable<Test> DiscoverTests(Type type)
{
List<Test> ret = new List<Test>();
foreach (MethodInfo method in type.GetMethods())
{
if (method.GetCustomAttributes(false).Any(
attr => attr.GetType().Name == "TestMethodAttribute"))
{
var test = new Test(method);
ret.Add(test);
}
}
return ret;
}
}
}
| mit | C# |
8b8de12a339bf67a3deba7d80c5e566dec198552 | Update triangulator to accept point if at certain distance from reporters | RocketHax/Web,RocketHax/Web,RocketHax/Web | RocketGPSMath/GPSMath/RegionTriangulator.cs | RocketGPSMath/GPSMath/RegionTriangulator.cs | using RocketGPS.GPSMath;
using RocketGPS.Model;
using RocketGPSMath.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RocketGPSMath.GPSMath
{
public class RegionTriangulator
{
public List<GPSCoordinateBearing> reports;
public RegionTriangulator()
{
}
public RegionTriangulator(List<GPSCoordinateBearing> reports)
{
this.reports = reports;
}
//Should return number of coordinates where N > 1, Count = N(N-1)/2
//Returns bunch of GPS points to represent the region triangulated.
public List<GPSCoordinate> Triangulate()
{
if (reports == null || reports.Count < 2)
return null;
List<GPSCoordinate> resultingRegion = new List<GPSCoordinate>();
for (int i = 0; i < reports.Count; ++i)
{
var currReport = reports[i];
for(int j = i + 1; j < reports.Count; ++j)
{
var otherReport = reports[j];
var res = GPSMathProcessor.Get().CalculateIntersection(currReport, otherReport);
//Only add if the intersection point distance to both reporters are below 20KM distance
if(res.DistanceTo(currReport) < 20 && res.DistanceTo(otherReport) < 20)
resultingRegion.Add(res);
}
}
return resultingRegion;
}
}
}
| using RocketGPS.GPSMath;
using RocketGPS.Model;
using RocketGPSMath.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RocketGPSMath.GPSMath
{
public class RegionTriangulator
{
public List<GPSCoordinateBearing> reports;
public RegionTriangulator()
{
}
public RegionTriangulator(List<GPSCoordinateBearing> reports)
{
this.reports = reports;
}
//Should return number of coordinates where N > 1, Count = N(N-1)/2
//Returns bunch of GPS points to represent the region triangulated.
public List<GPSCoordinate> Triangulate()
{
if (reports == null || reports.Count < 2)
return null;
List<GPSCoordinate> resultingRegion = new List<GPSCoordinate>();
for (int i = 0; i < reports.Count; ++i)
{
var currReport = reports[i];
for(int j = i + 1; j < reports.Count; ++j)
{
var otherReport = reports[j];
var res = GPSMathProcessor.Get().CalculateIntersection(currReport, otherReport);
resultingRegion.Add(res);
}
}
return resultingRegion;
}
}
}
| apache-2.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.