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 |
---|---|---|---|---|---|---|---|---|
162010bc5e05ae4f1c3fbe93b196ee49635d64fb
|
Add a couple of apparently missing events
|
canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor
|
src/SyncTrayzor/Syncthing/ApiClient/EventType.cs
|
src/SyncTrayzor/Syncthing/ApiClient/EventType.cs
|
using Newtonsoft.Json;
namespace SyncTrayzor.Syncthing.ApiClient
{
[JsonConverter(typeof(DefaultingStringEnumConverter))]
public enum EventType
{
Unknown,
Starting,
StartupComplete,
Ping,
DeviceDiscovered,
DeviceConnected,
DeviceDisconnected,
RemoteIndexUpdated,
LocalIndexUpdated,
ItemStarted,
ItemFinished,
// Not quite sure which it's going to be, so play it safe...
MetadataChanged,
ItemMetadataChanged,
StateChanged,
FolderRejected,
DeviceRejected,
ConfigSaved,
DownloadProgress,
FolderSummary,
FolderCompletion,
FolderErrors,
FolderScanProgress,
DevicePaused,
DeviceResumed,
LoginAttempt,
ListenAddressChanged,
RelayStateChanged,
ExternalPortMappingChanged,
}
}
|
using Newtonsoft.Json;
namespace SyncTrayzor.Syncthing.ApiClient
{
[JsonConverter(typeof(DefaultingStringEnumConverter))]
public enum EventType
{
Unknown,
Starting,
StartupComplete,
Ping,
DeviceDiscovered,
DeviceConnected,
DeviceDisconnected,
RemoteIndexUpdated,
LocalIndexUpdated,
ItemStarted,
ItemFinished,
// Not quite sure which it's going to be, so play it safe...
MetadataChanged,
ItemMetadataChanged,
StateChanged,
FolderRejected,
DeviceRejected,
ConfigSaved,
DownloadProgress,
FolderSummary,
FolderCompletion,
FolderErrors,
FolderScanProgress,
DevicePaused,
DeviceResumed,
LoginAttempt,
ListenAddressChanged,
}
}
|
mit
|
C#
|
eccb0e2f35629d04b751a621b0d00fdcc88e4096
|
Fix the tests build
|
flagbug/Espera,punker76/Espera
|
Espera.Core.Tests/YoutubeSongFinderTest.cs
|
Espera.Core.Tests/YoutubeSongFinderTest.cs
|
using System;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Akavache;
using Xunit;
namespace Espera.Core.Tests
{
public class YoutubeSongFinderTest
{
public class TheGetSongsAsyncMethod
{
[Fact]
public async Task NullSearchTermDefaultsToEmptyString()
{
var songs = new[] { new YoutubeSong("http://blabla", TimeSpan.Zero) };
var cache = new InMemoryBlobCache();
cache.InsertObject(BlobCacheKeys.GetKeyForYoutubeCache(string.Empty), songs);
var finder = new YoutubeSongFinder(cache);
var result = await finder.GetSongsAsync();
Assert.Equal(1, result.Count);
}
[Fact]
public async Task UsesCachedSongsIfAvailable()
{
const string searchTerm = "Foo";
var songs = new[] { new YoutubeSong("http://blabla", TimeSpan.Zero) };
var cache = new InMemoryBlobCache();
cache.InsertObject(BlobCacheKeys.GetKeyForYoutubeCache(searchTerm), songs);
var finder = new YoutubeSongFinder(cache);
var result = await finder.GetSongsAsync(searchTerm);
Assert.Equal(1, result.Count);
}
}
}
}
|
using System;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Akavache;
using Xunit;
namespace Espera.Core.Tests
{
public class YoutubeSongFinderTest
{
public class TheGetSongsAsyncMethod
{
[Fact]
public async Task NullSearchTermDefaultsToEmptyString()
{
var songs = new[] { new YoutubeSong("http://blabla", TimeSpan.Zero) };
BlobCache.LocalMachine.InsertObject(BlobCacheKeys.GetKeyForYoutubeCache(string.Empty), songs);
var finder = new YoutubeSongFinder();
var result = await finder.GetSongsAsync();
Assert.Equal(1, result.Count);
}
[Fact]
public async Task UsesCachedSongsIfAvailable()
{
const string searchTerm = "Foo";
var songs = new[] { new YoutubeSong("http://blabla", TimeSpan.Zero) };
BlobCache.LocalMachine.InsertObject(BlobCacheKeys.GetKeyForYoutubeCache(searchTerm), songs);
var finder = new YoutubeSongFinder();
var result = await finder.GetSongsAsync(searchTerm);
Assert.Equal(1, result.Count);
}
}
}
}
|
mit
|
C#
|
fd23a6d2e2d24eeef1c7f8ec731da556772215c9
|
Update XMLTests.cs
|
keith-hall/Extensions,keith-hall/Extensions
|
tests/XMLTests.cs
|
tests/XMLTests.cs
|
using System;
using System.Xml.Linq;
using HallLibrary.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Tests
{
[TestClass]
public class XMLTests
{
[TestMethod]
public void TestToDataTable()
{
var xe = XElement.Parse(@"<root><row><id example='test'>7</id><name><last>Bloggs</last><first>Fred</first></name></row><anotherRow><id>6</id><name><first>Joe</first><last>Bloggs</last></name></anotherRow></root>");
var dt = XML.ToDataTable(xe, "/", true, true);
Assert.IsTrue(dt.Columns.OfType<DataColumn>().Select(c => c.ColumnName).SequenceEqual(new [] { "id/@example", "id", "name/first", "name/last" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(0).SequenceEqual(new object[] { "test", DBNull.Value }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(1).SequenceEqual(new [] { "7", "6" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(2).SequenceEqual(new [] { "Fred", "Joe" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(3).SequenceEqual(new [] { "Bloggs", "Bloggs" }));
Assert.AreEqual(dt.TableName, "root");
xe = XElement.Parse(@"<root><row><id example='test'>7</id><name><last>Bloggs</last><first>Fred</first></name></row><row><id>6</id><name><first>Joe</first><last>Bloggs</last></name></row></root>");
dt = XML.ToDataTable(xe, ".", false, false);
Assert.IsTrue(dt.Columns.OfType<DataColumn>().Select(c => c.ColumnName).SequenceEqual(new [] { "id", "first.name", "last.name" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(0).SequenceEqual(new [] { "7", "6" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(1).SequenceEqual(new [] { "Fred", "Joe" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(2).SequenceEqual(new [] { "Bloggs", "Bloggs" }));
Assert.AreEqual(dt.TableName, "row");
dt = XML.ToDataTable(xe, null, false, false);
Assert.IsTrue(dt.Columns.OfType<DataColumn>().Select(c => c.ColumnName).SequenceEqual(new [] { "id", "first", "last" }));
}
}
}
|
using System;
using System.Xml.Linq;
using HallLibrary.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Tests
{
[TestClass]
public class XMLTests
{
[TestMethod]
public void TestToDataTable()
{
var xe = XElement.Parse(@"<root><row><id example='test'>7</id><name><last>Bloggs</last><first>Fred</first></name></row><anotherRow><id>6</id><name><first>Joe</first><last>Bloggs</last></name></anotherRow></root>");
var dt = XML.ToDataTable(xe, "/", true, true);
Assert.IsTrue(dt.Columns.OfType<DataColumn>().Select(c => c.ColumnName).SequenceEqual(new [] { "id/@example", "id", "name/first", "name/last" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(0).SequenceEqual(new object[] { "test", DBNull.Value }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(1).SequenceEqual(new [] { "7", "6" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(2).SequenceEqual(new [] { "Fred", "Joe" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(3).SequenceEqual(new [] { "Bloggs", "Bloggs" }));
Assert.AreEqual(dt.TableName, "root");
xe = XElement.Parse(@"<root><row><id example='test'>7</id><name><last>Bloggs</last><first>Fred</first></name></row><row><id>6</id><name><first>Joe</first><last>Bloggs</last></name></row></root>");
dt = XML.ToDataTable(xe, ".", false, false)
Assert.IsTrue(dt.Columns.OfType<DataColumn>().Select(c => c.ColumnName).SequenceEqual(new [] { "id", "first.name", "last.name" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(0).SequenceEqual(new [] { "7", "6" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(1).SequenceEqual(new [] { "Fred", "Joe" }));
Assert.IsTrue(dt.Rows.GetValuesInColumn(2).SequenceEqual(new [] { "Bloggs", "Bloggs" }));
Assert.AreEqual(dt.TableName, "row");
}
}
}
|
apache-2.0
|
C#
|
347ddd4a046871bdaf382f91c804bac217a6937a
|
Update version number
|
dylanplecki/KeycloakOwinAuthentication,dylanplecki/BasicOidcAuthentication,joelnet/KeycloakOwinAuthentication
|
src/Owin.Security.Keycloak/Properties/AssemblyInfo.cs
|
src/Owin.Security.Keycloak/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("Keycloak OWIN Authentication")]
[assembly: AssemblyDescription("Keycloak Authentication Middleware for ASP.NET OWIN")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OWIN")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fcac3105-3e81-49c4-9d8e-0fc9e608e87c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.1.1")]
[assembly: AssemblyFileVersion("1.0.1.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("Keycloak OWIN Authentication")]
[assembly: AssemblyDescription("Keycloak Authentication Middleware for ASP.NET OWIN")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OWIN")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fcac3105-3e81-49c4-9d8e-0fc9e608e87c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]
|
mit
|
C#
|
56c4702824288c74923e7f874b1009be9bd45070
|
Update to gov gateway inform content
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
src/SFA.DAS.EAS.Web/Views/Shared/GatewayInform.cshtml
|
src/SFA.DAS.EAS.Web/Views/Shared/GatewayInform.cshtml
|
@model SFA.DAS.EAS.Web.OrchestratorResponse<SFA.DAS.EAS.Web.Models.GatewayInformViewModel>
@{ViewBag.PageID = "page-onboard-gov-gateway-inform"; }
@{ViewBag.Title = "Check details"; }
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Allowing your tax details to be used</h1>
<p>When you enter your Government Gateway details you'll be asked to 'grant authority' to allow your tax details to be used.</p>
<p>This means you allow HMRC to send the SFA details of the levy that you've paid - no other payroll information will be shared.</p>
<h2 class="heading-medium">By continuing you agree to the following:</h2>
<div class="panel">
<p>I have authority to add PAYE schemes to this account.</p>
<p>I understand that all account users will be able to see levy funds from any PAYE schemes I add.</p>
<p>All PAYE schemes I add are owned and operated by an organisation that'll use this account, or owned and operated by a <a href="https://www.gov.uk/government/publications/employment-allowance-more-detailed-guidance" rel="external">connected organisation</a>.</p>
</div>
<p><a href="@Model.Data.ConfirmUrl" class="button">Agree and continue</a></p>
</div>
</div>
@section breadcrumb {
<div class="breadcrumbs">
<ol>
<li><a href="@Model.Data.BreadcrumbUrl" class="back-link">@Model.Data.BreadcrumbDescription</a></li>
</ol>
</div>
}
|
@model SFA.DAS.EAS.Web.OrchestratorResponse<SFA.DAS.EAS.Web.Models.GatewayInformViewModel>
@{ViewBag.PageID = "page-onboard-gov-gateway-inform"; }
@{ViewBag.Title = "Check details"; }
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-xlarge">Connecting to HMRC</h1>
<p>To access levy funds you need to connect your account to HMRC.</p>
<p>When you continue you'll be asked to:</p>
<ol class="list list-number">
<li>Enter the Government Gateway login details for one of your PAYE schemes. </li>
<li>'Grant authority' to allow HMRC to access your Government Gateway account.</li>
</ol>
<h2 class="heading-medium">By continuing you agree to the following:</h2>
<div class="panel">
<p>I have authority to add PAYE schemes to this account.</p>
<p>I understand that all account users will be able to see levy funds from any PAYE schemes I add.</p>
<p>All PAYE schemes I add are owned and operated by an organisation that'll use this account, or owned and operated by a <a href="https://www.gov.uk/government/publications/employment-allowance-more-detailed-guidance" rel="external">connected organisation</a>.</p>
</div>
<p><a href="@Model.Data.ConfirmUrl" class="button">Continue</a></p>
</div>
</div>
@section breadcrumb {
<div class="breadcrumbs">
<ol>
<li><a href="@Model.Data.BreadcrumbUrl" class="back-link">@Model.Data.BreadcrumbDescription</a></li>
</ol>
</div>
}
|
mit
|
C#
|
0e1b4c4114f64be5efe506199a579c8c07934b3a
|
Fix Articles Controller Tests
|
Kentico/Mvc,Kentico/Mvc,Kentico/Mvc
|
test/DancingGoat.Tests/Unit/ArticleControllerTests.cs
|
test/DancingGoat.Tests/Unit/ArticleControllerTests.cs
|
using System.Net;
using CMS.DataEngine;
using CMS.DocumentEngine;
using CMS.DocumentEngine.Tests;
using CMS.DocumentEngine.Types;
using CMS.Tests;
using DancingGoat.Controllers;
using DancingGoat.Infrastructure;
using DancingGoat.Models.Articles;
using DancingGoat.Repositories;
using DancingGoat.Tests.Extensions;
using NSubstitute;
using NUnit.Framework;
using TestStack.FluentMVCTesting;
namespace DancingGoat.Tests.Unit
{
[TestFixture]
public class ArticlesControllerTests : UnitTests
{
private ArticlesController mController;
private Article mArticle;
private IOutputCacheDependencies mDependencies;
private const string ARTICLE_TITLE = "Article1";
[SetUp]
public void SetUp()
{
Fake().DocumentType<Article>(Article.CLASS_NAME);
mArticle = TreeNode.New<Article>().With(a => a.Fields.Title = ARTICLE_TITLE);
mDependencies = Substitute.For<IOutputCacheDependencies>();
var repository = Substitute.For<IArticleRepository>();
repository.GetArticle(1).Returns(mArticle);
mController = new ArticlesController(repository, mDependencies);
}
[Test]
public void Index_RendersDefaultView()
{
mController.WithCallTo(c => c.Index())
.ShouldRenderDefaultView();
}
[Test]
public void Show_WithExistingArticle_RendersDefaultViewWithCorrectModel()
{
mController.WithCallTo(c => c.Show(1, null))
.ShouldRenderDefaultView()
.WithModelMatchingCondition<ArticleViewModel>(x => x.Title == ARTICLE_TITLE);
}
[Test]
public void Show_WithoutExistingArticle_ReturnsHttpNotFoundStatusCode()
{
mController.WithCallTo(c => c.Show(2, null))
.ShouldGiveHttpStatus(HttpStatusCode.NotFound);
}
}
}
|
using System.Net;
using CMS.DataEngine;
using CMS.DocumentEngine;
using CMS.DocumentEngine.Tests;
using CMS.DocumentEngine.Types;
using CMS.Tests;
using DancingGoat.Controllers;
using DancingGoat.Infrastructure;
using DancingGoat.Repositories;
using DancingGoat.Tests.Extensions;
using NSubstitute;
using NUnit.Framework;
using TestStack.FluentMVCTesting;
namespace DancingGoat.Tests.Unit
{
[TestFixture]
public class ArticlesControllerTests : UnitTests
{
private ArticlesController mController;
private Article mArticle;
private IOutputCacheDependencies mDependencies;
private string mDocumentName = "Article1";
[SetUp]
public void SetUp()
{
Fake().DocumentType<Article>(Article.CLASS_NAME);
mArticle = TreeNode.New<Article>().With(a => a.DocumentName = mDocumentName);
mDependencies = Substitute.For<IOutputCacheDependencies>();
var repository = Substitute.For<IArticleRepository>();
repository.GetArticle(1).Returns(mArticle);
mController = new ArticlesController(repository, mDependencies);
}
[Test]
public void Index_RendersDefaultView()
{
mController.WithCallTo(c => c.Index())
.ShouldRenderDefaultView();
}
[Test]
public void Show_WithExistingArticle_RendersDefaultViewWithCorrectModel()
{
mController.WithCallTo(c => c.Show(1, null))
.ShouldRenderDefaultView()
.WithModelMatchingCondition<Article>(x => x.DocumentName == mDocumentName);
}
[Test]
public void Show_WithoutExistingArticle_ReturnsHttpNotFoundStatusCode()
{
mController.WithCallTo(c => c.Show(2, null))
.ShouldGiveHttpStatus(HttpStatusCode.NotFound);
}
}
}
|
mit
|
C#
|
9f28631b3be6b6d6953560ac119952280368daff
|
Update Personalization region (#790)
|
algolia/algoliasearch-client-csharp
|
src/Algolia.Search.Test/BaseTest.cs
|
src/Algolia.Search.Test/BaseTest.cs
|
/*
* Copyright (c) 2018-2021 Algolia
* http://www.algolia.com/
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using Algolia.Search.Clients;
using Algolia.Search.Models.Enums;
using Algolia.Search.Test;
using NUnit.Framework;
[SetUpFixture]
public class BaseTest
{
internal static SearchClient SearchClient;
internal static SearchClient SearchClient2;
internal static SearchClient McmClient;
internal static AnalyticsClient AnalyticsClient;
internal static PersonalizationClient PersonalizationClient;
internal static DictionaryClient DictionaryClient;
[OneTimeSetUp]
public void Setup()
{
TestHelper.CheckEnvironmentVariable();
SearchClient = new SearchClient(TestHelper.ApplicationId1, TestHelper.AdminKey1);
SearchConfig configClient2 = new SearchConfig(TestHelper.ApplicationId2, TestHelper.AdminKey2)
{
Compression = CompressionType.NONE
};
SearchClient2 = new SearchClient(configClient2);
McmClient = new SearchClient(TestHelper.McmApplicationId, TestHelper.McmAdminKey);
AnalyticsClient = new AnalyticsClient(TestHelper.ApplicationId1, TestHelper.AdminKey1);
PersonalizationClient = new PersonalizationClient(TestHelper.ApplicationId1, TestHelper.AdminKey1, "us");
DictionaryClient = new DictionaryClient(TestHelper.ApplicationId1, TestHelper.AdminKey1);
}
}
|
/*
* Copyright (c) 2018-2021 Algolia
* http://www.algolia.com/
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using Algolia.Search.Clients;
using Algolia.Search.Models.Enums;
using Algolia.Search.Test;
using NUnit.Framework;
[SetUpFixture]
public class BaseTest
{
internal static SearchClient SearchClient;
internal static SearchClient SearchClient2;
internal static SearchClient McmClient;
internal static AnalyticsClient AnalyticsClient;
internal static PersonalizationClient PersonalizationClient;
internal static DictionaryClient DictionaryClient;
[OneTimeSetUp]
public void Setup()
{
TestHelper.CheckEnvironmentVariable();
SearchClient = new SearchClient(TestHelper.ApplicationId1, TestHelper.AdminKey1);
SearchConfig configClient2 = new SearchConfig(TestHelper.ApplicationId2, TestHelper.AdminKey2)
{
Compression = CompressionType.NONE
};
SearchClient2 = new SearchClient(configClient2);
McmClient = new SearchClient(TestHelper.McmApplicationId, TestHelper.McmAdminKey);
AnalyticsClient = new AnalyticsClient(TestHelper.ApplicationId1, TestHelper.AdminKey1);
PersonalizationClient = new PersonalizationClient(TestHelper.ApplicationId1, TestHelper.AdminKey1, "eu");
DictionaryClient = new DictionaryClient(TestHelper.ApplicationId1, TestHelper.AdminKey1);
}
}
|
mit
|
C#
|
7153aafbb4225cd0d3e1d5900b5753be0059ff6a
|
Handle AddressNotFoundException
|
zulhilmizainuddin/geoip,zulhilmizainuddin/geoip
|
src/GeoIP/Executers/MaxMindQuery.cs
|
src/GeoIP/Executers/MaxMindQuery.cs
|
using GeoIP.Models;
using MaxMind.GeoIP2;
using MaxMind.GeoIP2.Exceptions;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace GeoIP.Executers
{
public class MaxMindQuery : IQuery
{
public async Task<string> Query(string ipAddress, string dataSource)
{
Object result;
try
{
using (var reader = new DatabaseReader(dataSource))
{
var city = reader.City(ipAddress);
if (city != null)
{
result = new Geolocation()
{
IPAddress = ipAddress,
City = city.City.Name,
Country = city.Country.Name,
Latitude = city.Location.Latitude,
Longitude = city.Location.Longitude
};
}
else
{
result = new Error()
{
ErrorMessage = "Geolocation not found"
};
}
}
}
catch (AddressNotFoundException ex)
{
result = new Error()
{
ErrorMessage = ex.Message
};
}
return JsonConvert.SerializeObject(result);
}
}
}
|
using GeoIP.Models;
using MaxMind.GeoIP2;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace GeoIP.Executers
{
public class MaxMindQuery : IQuery
{
public async Task<string> Query(string ipAddress, string dataSource)
{
using (var reader = new DatabaseReader(dataSource))
{
Object result;
var city = reader.City(ipAddress);
if (city != null)
{
result = new Geolocation()
{
IPAddress = ipAddress,
City = city.City.Name,
Country = city.Country.Name,
Latitude = city.Location.Latitude,
Longitude = city.Location.Longitude
};
}
else
{
result = new Error()
{
ErrorMessage = "Geolocation not found"
};
}
return JsonConvert.SerializeObject(result);
}
}
}
}
|
mit
|
C#
|
99bf5c0ba43a64b0695e985bc193c54d2055a9a8
|
disable v3 compression tests temporarily
|
elastacloud/parquet-dotnet
|
src/Parquet.Test/CompressionTest.cs
|
src/Parquet.Test/CompressionTest.cs
|
using Parquet.Data;
using System.IO;
using Xunit;
namespace Parquet.Test
{
public class CompressionTest : TestBase
{
[Theory]
[InlineData(CompressionMethod.None)]
[InlineData(CompressionMethod.Gzip)]
[InlineData(CompressionMethod.Snappy)]
public void All_compression_methods_supported(CompressionMethod compressionMethod)
{
//v2
var ms = new MemoryStream();
DataSet ds1 = new DataSet(new DataField<int>("id"));
DataSet ds2;
ds1.Add(5);
//write
using (var writer = new ParquetWriter(ms))
{
writer.Write(ds1, CompressionMethod.Gzip);
}
//read back
using (var reader = new ParquetReader(ms))
{
ms.Position = 0;
ds2 = reader.Read();
}
Assert.Equal(5, ds2[0].GetInt(0));
//v3
//const int value = 5;
//object actual = WriteReadSingle(new DataField<int>("id"), value, compressionMethod);
//Assert.Equal(5, (int)actual);
}
}
}
|
using Parquet.Data;
using System.IO;
using Xunit;
namespace Parquet.Test
{
public class CompressionTest : TestBase
{
[Theory]
[InlineData(CompressionMethod.None)]
[InlineData(CompressionMethod.Gzip)]
[InlineData(CompressionMethod.Snappy)]
public void All_compression_methods_supported(CompressionMethod compressionMethod)
{
//v2
var ms = new MemoryStream();
DataSet ds1 = new DataSet(new DataField<int>("id"));
DataSet ds2;
ds1.Add(5);
//write
using (var writer = new ParquetWriter(ms))
{
writer.Write(ds1, CompressionMethod.Gzip);
}
//read back
using (var reader = new ParquetReader(ms))
{
ms.Position = 0;
ds2 = reader.Read();
}
Assert.Equal(5, ds2[0].GetInt(0));
//v3
const int value = 5;
object actual = WriteReadSingle(new DataField<int>("id"), value, compressionMethod);
Assert.Equal(5, (int)actual);
}
}
}
|
mit
|
C#
|
d69a2a0fab11a47be572bde0775afa1189ae3fa0
|
Throw more meaningful exception when trying to access failed volumes.
|
drebrez/DiscUtils,quamotion/discutils,breezechen/DiscUtils,breezechen/DiscUtils
|
src/LogicalDiskManager/DynamicVolume.cs
|
src/LogicalDiskManager/DynamicVolume.cs
|
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
namespace DiscUtils.LogicalDiskManager
{
using System;
using System.IO;
internal class DynamicVolume
{
private DynamicDiskGroup _group;
private Guid _volumeId;
internal DynamicVolume(DynamicDiskGroup group, Guid volumeId)
{
_group = group;
_volumeId = volumeId;
}
public byte BiosType
{
get { return Record.BiosType; }
}
public Guid Identity
{
get { return _volumeId; }
}
public long Length
{
get { return Record.Size * Sizes.Sector; }
}
public LogicalVolumeStatus Status
{
get { return _group.GetVolumeStatus(Record.Id); }
}
private VolumeRecord Record
{
get { return _group.GetVolume(_volumeId); }
}
public SparseStream Open()
{
if (Status == LogicalVolumeStatus.Failed)
{
throw new IOException("Attempt to open 'failed' volume");
}
else
{
return _group.OpenVolume(Record.Id);
}
}
}
}
|
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
namespace DiscUtils.LogicalDiskManager
{
using System;
internal class DynamicVolume
{
private DynamicDiskGroup _group;
private Guid _volumeId;
internal DynamicVolume(DynamicDiskGroup group, Guid volumeId)
{
_group = group;
_volumeId = volumeId;
}
public byte BiosType
{
get { return Record.BiosType; }
}
public Guid Identity
{
get { return _volumeId; }
}
public long Length
{
get { return Record.Size * Sizes.Sector; }
}
public LogicalVolumeStatus Status
{
get { return _group.GetVolumeStatus(Record.Id); }
}
private VolumeRecord Record
{
get { return _group.GetVolume(_volumeId); }
}
public SparseStream Open()
{
return _group.OpenVolume(Record.Id);
}
}
}
|
mit
|
C#
|
b85375575a0090d3a4c4e60807fa46e6fc3c5cd3
|
Update comment
|
martincostello/alexa-london-travel
|
src/LondonTravel.Skill/AlexaFunction.cs
|
src/LondonTravel.Skill/AlexaFunction.cs
|
// Copyright (c) Martin Costello, 2017. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
using System;
using System.Threading.Tasks;
using Alexa.NET.Request;
using Alexa.NET.Response;
using Amazon.Lambda.Core;
namespace MartinCostello.LondonTravel.Skill
{
/// <summary>
/// A class representing the AWS Lambda function for the London Travel Amazon Alexa skill.
/// </summary>
public class AlexaFunction
{
/// <summary>
/// Initializes a new instance of the <see cref="AlexaFunction"/> class.
/// </summary>
public AlexaFunction()
: this(Environment.GetEnvironmentVariable("SKILL_API_HOSTNAME"))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AlexaFunction"/> class with the specified configuration.
/// </summary>
/// <param name="skillApiHostName">The URL of the skill's API.</param>
internal AlexaFunction(string skillApiHostName)
{
SkillApiUrl = skillApiHostName ?? "https://londontravel.martincostello.com/";
}
/// <summary>
/// Gets the URL of the skill's API.
/// </summary>
private string SkillApiUrl { get; }
/// <summary>
/// Handles a request to the skill as an asynchronous operation.
/// </summary>
/// <param name="input">The skill request.</param>
/// <param name="context">The AWS Lambda execution context.</param>
/// <returns>
/// A <see cref="Task{TResult}"/> representing the asynchronous operation to get the skill's response.
/// </returns>
public async Task<SkillResponse> HandlerAsync(SkillRequest input, ILambdaContext context)
{
context.Logger.LogLine($"Invoking skill request of type {input.GetType().Name}.");
context.Logger.LogLine($"Skill API URL: {SkillApiUrl}");
var response = new SkillResponse()
{
Response = new ResponseBody(),
Version = "1.0",
};
return await Task.FromResult(response);
}
}
}
|
// Copyright (c) Martin Costello, 2017. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
using System;
using System.Threading.Tasks;
using Alexa.NET.Request;
using Alexa.NET.Response;
using Amazon.Lambda.Core;
namespace MartinCostello.LondonTravel.Skill
{
/// <summary>
/// A class representing the AWS Lambda handler for the London Travel Amazon Alexa skill.
/// </summary>
public class AlexaFunction
{
/// <summary>
/// Initializes a new instance of the <see cref="AlexaFunction"/> class.
/// </summary>
public AlexaFunction()
: this(Environment.GetEnvironmentVariable("SKILL_API_HOSTNAME"))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AlexaFunction"/> class with the specified configuration.
/// </summary>
/// <param name="skillApiHostName">The URL of the skill's API.</param>
internal AlexaFunction(string skillApiHostName)
{
SkillApiUrl = skillApiHostName ?? "https://londontravel.martincostello.com/";
}
/// <summary>
/// Gets the URL of the skill's API.
/// </summary>
private string SkillApiUrl { get; }
/// <summary>
/// Handles a request to the skill as an asynchronous operation.
/// </summary>
/// <param name="input">The skill request.</param>
/// <param name="context">The AWS Lambda execution context.</param>
/// <returns>
/// A <see cref="Task{TResult}"/> representing the asynchronous operation to get the skill's response.
/// </returns>
public async Task<SkillResponse> HandlerAsync(SkillRequest input, ILambdaContext context)
{
context.Logger.LogLine($"Invoking skill request of type {input.GetType().Name}.");
context.Logger.LogLine($"Skill API URL: {SkillApiUrl}");
var response = new SkillResponse()
{
Response = new ResponseBody(),
Version = "1.0",
};
return await Task.FromResult(response);
}
}
}
|
apache-2.0
|
C#
|
2f5de263a1c824c89a78e0ead926c9ae9d6b0772
|
Add MI debugger working directory to PATH
|
yazeng/MIEngine,wesrupert/MIEngine,rajkumar42/MIEngine,xincun/MIEngine,chuckries/MIEngine,caslan/MIEngine,enginekit/MIEngine,devilman3d/MIEngine,pieandcakes/MIEngine,wesrupert/MIEngine,caslan/MIEngine,csiusers/MIEngine,devilman3d/MIEngine,yacoder/MIEngine,Microsoft/MIEngine,edumunoz/MIEngine,edumunoz/MIEngine,pieandcakes/MIEngine,orbitcowboy/MIEngine,jacdavis/MIEngine,chuckries/MIEngine,chuckries/MIEngine,enginekit/MIEngine,Microsoft/MIEngine,orbitcowboy/MIEngine,enginekit/MIEngine,phofman/MIEngine,yacoder/MIEngine,gregg-miskelly/MIEngine,conniey/MIEngine,yazeng/MIEngine,wiktork/MIEngine,gregg-miskelly/MIEngine,faxue-msft/MIEngine,xincun/MIEngine,Microsoft/MIEngine,rajkumar42/MIEngine,faxue-msft/MIEngine,devilman3d/MIEngine,xingshenglu/MIEngine,xingshenglu/MIEngine,rajkumar42/MIEngine,yacoder/MIEngine,PistonDevelopers/MIEngine,conniey/MIEngine,rajkumar42/MIEngine,caslan/MIEngine,xincun/MIEngine,jacdavis/MIEngine,orbitcowboy/MIEngine,xingshenglu/MIEngine,wesrupert/MIEngine,chuckries/MIEngine,jacdavis/MIEngine,devilman3d/MIEngine,yazeng/MIEngine,csiusers/MIEngine,csiusers/MIEngine,edumunoz/MIEngine,conniey/MIEngine,wiktork/MIEngine,wesrupert/MIEngine,faxue-msft/MIEngine,upsoft/MIEngine,upsoft/MIEngine,edumunoz/MIEngine,faxue-msft/MIEngine,pieandcakes/MIEngine,wiktork/MIEngine,vosen/MIEngine,orbitcowboy/MIEngine,upsoft/MIEngine,gregg-miskelly/MIEngine,pieandcakes/MIEngine,csiusers/MIEngine,caslan/MIEngine,Microsoft/MIEngine,phofman/MIEngine,phofman/MIEngine
|
src/MICore/Transports/LocalTransport.cs
|
src/MICore/Transports/LocalTransport.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Diagnostics;
using System.IO;
using System.Collections.Specialized;
using System.Collections;
namespace MICore
{
public class LocalTransport : PipeTransport
{
public LocalTransport()
{
}
public override void InitStreams(LaunchOptions options, out StreamReader reader, out StreamWriter writer)
{
LocalLaunchOptions localOptions = (LocalLaunchOptions)options;
string miDebuggerDir = System.IO.Path.GetDirectoryName(localOptions.MIDebuggerPath);
Process proc = new Process();
proc.StartInfo.FileName = localOptions.MIDebuggerPath;
proc.StartInfo.Arguments = "--interpreter=mi";
proc.StartInfo.WorkingDirectory = miDebuggerDir;
//GDB locally requires that the directory be on the PATH, being the working directory isn't good enough
if (proc.StartInfo.EnvironmentVariables.ContainsKey("PATH"))
{
proc.StartInfo.EnvironmentVariables["PATH"] = proc.StartInfo.EnvironmentVariables["PATH"] + ";" + miDebuggerDir;
}
InitProcess(proc, out reader, out writer);
}
protected override string GetThreadName()
{
return "MI.LocalTransport";
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Diagnostics;
using System.IO;
using System.Collections.Specialized;
using System.Collections;
namespace MICore
{
public class LocalTransport : PipeTransport
{
public LocalTransport()
{
}
public override void InitStreams(LaunchOptions options, out StreamReader reader, out StreamWriter writer)
{
LocalLaunchOptions localOptions = (LocalLaunchOptions)options;
Process proc = new Process();
proc.StartInfo.FileName = localOptions.MIDebuggerPath;
proc.StartInfo.Arguments = "--interpreter=mi";
proc.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(localOptions.MIDebuggerPath);
InitProcess(proc, out reader, out writer);
}
protected override string GetThreadName()
{
return "MI.LocalTransport";
}
}
}
|
mit
|
C#
|
6ba3d0154d21bfa546204265e8d709314c7afb7d
|
Update AssemblyInfo.cs
|
NConsole/NConsole
|
src/NConsole/Properties/AssemblyInfo.cs
|
src/NConsole/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("NConsole")]
[assembly: AssemblyDescription("NConsole is a .NET library to parse command line arguments and execute commands.")]
[assembly: AssemblyCompany("Rico Suter")]
[assembly: AssemblyProduct("NConsole")]
[assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")]
[assembly: AssemblyVersion("1.1.*")]
[assembly: InternalsVisibleTo("NConsole.Tests")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("NConsole")]
[assembly: AssemblyDescription("NConsole is a .NET library to parse command line arguments and execute commands.")]
[assembly: AssemblyCompany("Rico Suter")]
[assembly: AssemblyProduct("NConsole")]
[assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: InternalsVisibleTo("NConsole.Tests")]
|
mit
|
C#
|
f4e21d24932bce181b8ea204a3aa3f609b9fa7b9
|
Rename SELECT * test cases to match naming convention
|
terrajobst/nquery-vnext
|
src/NQuery.UnitTests/SelectStarTests.cs
|
src/NQuery.UnitTests/SelectStarTests.cs
|
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace NQuery.UnitTests
{
[TestClass]
public class SelectStarTests
{
[TestMethod]
public void SelectStar_Disallowed_WhenNoTablesSpecified()
{
var syntaxTree = SyntaxTree.ParseQuery("SELECT *");
var compilation = Compilation.Empty.WithSyntaxTree(syntaxTree).WithIdNameTable();
var semanticModel = compilation.GetSemanticModel();
var diagnostics = semanticModel.GetDiagnostics().ToArray();
Assert.AreEqual(1, diagnostics.Length);
Assert.AreEqual(DiagnosticId.MustSpecifyTableToSelectFrom, diagnostics[0].DiagnosticId);
}
[TestMethod]
public void SelectStar_Disallowed_WhenNoTablesSpecified_UnlessInExists()
{
var syntaxTree = SyntaxTree.ParseQuery("SELECT 'Test' WHERE EXISTS (SELECT *)");
var compilation = Compilation.Empty.WithSyntaxTree(syntaxTree).WithIdNameTable();
var semanticModel = compilation.GetSemanticModel();
var diagnostics = semanticModel.GetDiagnostics().ToArray();
Assert.AreEqual(0, diagnostics.Length);
}
}
}
|
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace NQuery.UnitTests
{
[TestClass]
public class SelectStarTests
{
[TestMethod]
public void Binder_DisallowsSelectStarWithoutTables()
{
var syntaxTree = SyntaxTree.ParseQuery("SELECT *");
var compilation = Compilation.Empty.WithSyntaxTree(syntaxTree).WithIdNameTable();
var semanticModel = compilation.GetSemanticModel();
var diagnostics = semanticModel.GetDiagnostics().ToArray();
Assert.AreEqual(1, diagnostics.Length);
Assert.AreEqual(DiagnosticId.MustSpecifyTableToSelectFrom, diagnostics[0].DiagnosticId);
}
[TestMethod]
public void Binder_DisallowsSelectStarWithoutTables_UnlessInExists()
{
var syntaxTree = SyntaxTree.ParseQuery("SELECT 'Test' WHERE EXISTS (SELECT *)");
var compilation = Compilation.Empty.WithSyntaxTree(syntaxTree).WithIdNameTable();
var semanticModel = compilation.GetSemanticModel();
var diagnostics = semanticModel.GetDiagnostics().ToArray();
Assert.AreEqual(0, diagnostics.Length);
}
}
}
|
mit
|
C#
|
afdb0f9d0fd3ff9e3fa651492a64976e2096a988
|
Implement endpoint for remove instance
|
mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard
|
src/Okanshi.Dashboard/SettingsModule.cs
|
src/Okanshi.Dashboard/SettingsModule.cs
|
using System;
using System.Linq;
using Nancy;
namespace Okanshi.Dashboard
{
public class SettingsModule : NancyModule
{
public SettingsModule(IConfiguration configuration)
{
Get["/settings"] = p =>
{
var servers = configuration.GetAll().ToArray();
return View["settings.html", servers];
};
Post["/settings"] = p =>
{
var name = Request.Form.Name;
var url = Request.Form.url;
var refreshRate = Convert.ToInt64(Request.Form.refreshRate.Value);
var server = new OkanshiServer(name, url, refreshRate);
configuration.Add(server);
return Response.AsRedirect("/settings");
};
Post["/settings/delete"] = p =>
{
var name = (string)Request.Form.InstanceName;
configuration.Remove(name);
return Response.AsRedirect("/settings");
};
}
}
}
|
using System;
using System.Linq;
using Nancy;
namespace Okanshi.Dashboard
{
public class SettingsModule : NancyModule
{
public SettingsModule(IConfiguration configuration)
{
Get["/settings"] = p =>
{
var servers = configuration.GetAll().ToArray();
return View["settings.html", servers];
};
Post["/settings"] = p =>
{
var name = Request.Form.Name;
var url = Request.Form.url;
var refreshRate = Convert.ToInt64(Request.Form.refreshRate.Value);
var server = new OkanshiServer(name, url, refreshRate);
configuration.Add(server);
return Response.AsRedirect("/settings");
};
}
}
}
|
mit
|
C#
|
f25673ede303c1ea6e610d8a48ec514fddf3a0aa
|
Remove Console.WriteLine from time_to_main.
|
brianrob/coretests,brianrob/coretests
|
managed/time_to_main/src/Program.cs
|
managed/time_to_main/src/Program.cs
|
using System;
using System.Runtime.InteropServices;
namespace TimeToMain
{
public static class Program
{
[DllImport("libnative.so")]
private static extern void write_marker(string name);
public static void Main(string[] args)
{
write_marker("/function/main");
}
}
}
|
using System;
using System.Runtime.InteropServices;
namespace TimeToMain
{
public static class Program
{
[DllImport("libnative.so")]
private static extern void write_marker(string name);
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
write_marker("/function/main");
}
}
}
|
mit
|
C#
|
9f9deef438a557254142acb2cb38ec1a96d503c6
|
Reword slightly
|
peppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,ppy/osu
|
osu.Game/Overlays/Chat/ExternalLinkDialog.cs
|
osu.Game/Overlays/Chat/ExternalLinkDialog.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Overlays.Chat
{
public class ExternalLinkDialog : PopupDialog
{
public ExternalLinkDialog(string url, Action openExternalLinkAction, Action copyExternalLinkAction)
{
HeaderText = "Just checking...";
BodyText = $"You are about to leave osu! and open the following link in a web browser:\n\n{url}";
Icon = FontAwesome.Solid.ExclamationTriangle;
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes. Go for it.",
Action = openExternalLinkAction
},
new PopupDialogCancelButton
{
Text = @"Copy URL to the clipboard instead.",
Action = copyExternalLinkAction
},
new PopupDialogCancelButton
{
Text = @"No! Abort mission!"
},
};
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Overlays.Chat
{
public class ExternalLinkDialog : PopupDialog
{
public ExternalLinkDialog(string url, Action openExternalLinkAction, Action copyExternalLinkAction)
{
HeaderText = "Just checking...";
BodyText = $"You are about to leave osu! and open the following link in a web browser:\n\n{url}";
Icon = FontAwesome.Solid.ExclamationTriangle;
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes. Go for it.",
Action = openExternalLinkAction
},
new PopupDialogCancelButton
{
Text = @"No! Copy the URL instead!",
Action = copyExternalLinkAction
},
new PopupDialogCancelButton
{
Text = @"No! Abort mission!"
},
};
}
}
}
|
mit
|
C#
|
b2ef5c2b66951f009749934eadda1b10da60d3e3
|
Update AssemblyVersion to 1.0.3
|
Shaddix/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet
|
RealmAssemblyInfo.cs
|
RealmAssemblyInfo.cs
|
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
using System.Reflection;
[assembly: AssemblyDescription("Realm is a mobile database: a replacement for SQLite")]
[assembly: AssemblyCopyright("Copyright © 2017 Realm")]
[assembly: AssemblyCompany("Realm Inc.")]
[assembly: AssemblyProduct("Realm C#")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
|
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
using System.Reflection;
[assembly: AssemblyDescription("Realm is a mobile database: a replacement for SQLite")]
[assembly: AssemblyCopyright("Copyright © 2017 Realm")]
[assembly: AssemblyCompany("Realm Inc.")]
[assembly: AssemblyProduct("Realm C#")]
[assembly: AssemblyVersion("0.83.0.0")]
[assembly: AssemblyFileVersion("0.83.0.0")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
|
apache-2.0
|
C#
|
1aba4d54e1444b9447757a5e9712157e61a3dc14
|
Remove hard coded USD dollar symbol and use currency string formatting instead.
|
bleroy/Nwazet.Commerce,bleroy/Nwazet.Commerce
|
Views/Price.cshtml
|
Views/Price.cshtml
|
@if (Model.DiscountedPrice != Model.Price)
{
<b class="inactive-price" style="text-decoration:line-through" title="@T("Was {0}", Model.Price.ToString("c"))">@Model.Price.ToString("c")</b>
<b class="discounted-price" title="@T("Now {0}", Model.DiscountedPrice.ToString("c"))">@Model.DiscountedPrice.ToString("c")</b>
<span class="discount-comment">@Model.DiscountComment</span>
}
else
{
<b>@Model.Price.ToString("c")</b>
}
|
@if (Model.DiscountedPrice != Model.Price) {
<b class="inactive-price" style="text-decoration:line-through" title="@T("Was ${0}", Model.Price)">$@Model.Price</b>
<b class="discounted-price" title="@T("Now ${0}", Model.DiscountedPrice)">$@Model.DiscountedPrice</b>
<span class="discount-comment">@Model.DiscountComment</span>
}
else {
<b>$@Model.Price</b>
}
|
bsd-3-clause
|
C#
|
5de12e6fd1ad1a72ca3c0dd4984cfef2902c8e68
|
fix the aim dir
|
dmanning23/BulletCircus
|
Source/BulletBoid.cs
|
Source/BulletBoid.cs
|
using FlockBuddy;
using Microsoft.Xna.Framework;
namespace BulletFlockBuddy
{
/// <summary>
/// This class wraps up BulletMLLib.Bullet with the FlockBuddy.Boid and CollisionBuddy.Circle
/// </summary>
public class BulletBoid : SimpleBullet
{
#region Members
/// <summary>
/// The flocking object this dude will use
/// </summary>
public Boid MyBoid { get; private set; }
private BulletBoidManager BulletBoidManager { get; set; }
#endregion //Members
#region Methods
/// <summary>
/// Initializes a new instance of the <see cref="BulletBoid"/> class.
/// </summary>
/// <param name="myBulletManager">My bullet manager.</param>
public BulletBoid(BulletBoidManager myBulletManager) : base(myBulletManager)
{
//store the bulelt boid manager
BulletBoidManager = myBulletManager;
}
public void Init(Vector2 pos,
float radius,
Vector2 dir,
float speed,
float bulletmlScale)
{
base.Init(pos, radius, dir, speed, bulletmlScale);
//create the boid
MyBoid = new Boid(BulletBoidManager, pos, radius, dir, speed, 1.0f, 500.0f, 1.0f, 100.0f);
}
public override void Update()
{
//the boid is updated in the mananger update. that will give a target heading.
//Next the bullet is updated. If it uses an "aim" action, it will use the heading from the boid.
base.Update();
//Next the position of the boid is set to the updated position of the bullet.
MyBoid.Position = _position;
MyBoid.Speed = Speed * 60.0f;
//Last, the position of the circle is updated.
Physics.Pos = _position;
}
/// <summary>
/// Get the direction the boid in us wants to go!
/// </summary>
/// <returns></returns>
public override float GetAimDir()
{
return MyBoid.Rotation;
}
#endregion //Methods
}
}
|
using FlockBuddy;
using Microsoft.Xna.Framework;
namespace BulletFlockBuddy
{
/// <summary>
/// This class wraps up BulletMLLib.Bullet with the FlockBuddy.Boid and CollisionBuddy.Circle
/// </summary>
public class BulletBoid : SimpleBullet
{
#region Members
/// <summary>
/// The flocking object this dude will use
/// </summary>
public Boid MyBoid { get; private set; }
private BulletBoidManager BulletBoidManager { get; set; }
#endregion //Members
#region Methods
/// <summary>
/// Initializes a new instance of the <see cref="BulletBoid"/> class.
/// </summary>
/// <param name="myBulletManager">My bullet manager.</param>
public BulletBoid(BulletBoidManager myBulletManager) : base(myBulletManager)
{
//store the bulelt boid manager
BulletBoidManager = myBulletManager;
}
public void Init(Vector2 pos,
float radius,
Vector2 dir,
float speed,
float bulletmlScale)
{
base.Init(pos, radius, dir, speed, bulletmlScale);
//create the boid
MyBoid = new Boid(BulletBoidManager, pos, radius, dir, speed, 1.0f, 500.0f, 1.0f, 100.0f);
}
public override void Update()
{
//the boid is updated in the mananger update. that will give a target heading.
//Next the bullet is updated. If it uses an "aim" action, it will use the heading from the boid.
base.Update();
//Next the position of the boid is set to the updated position of the bullet.
MyBoid.Position = _position;
//Last, the position of the circle is updated.
Physics.Pos = _position;
}
/// <summary>
/// Get the direction the boid in us wants to go!
/// </summary>
/// <returns></returns>
public override float GetAimDir()
{
return MyBoid.Rotation;
}
#endregion //Methods
}
}
|
mit
|
C#
|
5569edccfd1e6bdb2ed410605801a95df3d5ccbe
|
Update version to 1.0.1.
|
KirillOsenkov/MSBuildStructuredLog,KirillOsenkov/MSBuildStructuredLog
|
AssemblyVersion.cs
|
AssemblyVersion.cs
|
using System.Reflection;
[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1")]
|
using System.Reflection;
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
|
mit
|
C#
|
9097c10782843db55ab00d0000ac253910ee0210
|
Put passwords in startup args
|
Hitcents/S22.Xmpp
|
Console/Program.cs
|
Console/Program.cs
|
using S22.Xmpp.Client;
using S22.Xmpp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using S22.Xmpp.Im;
namespace XmppConsole
{
class Program
{
static void Main(string[] args)
{
try
{
using (var client = new XmppClient(args[0], args[1], args[2]))
{
client.Connect();
client.SetStatus(Availability.Online);
client.Message += OnMessage;
Console.WriteLine("Connected as " + client.Jid);
string line;
while ((line = Console.ReadLine()) != null)
{
Jid to = new Jid("something.com", "someone");
client.SendMessage(to, line, type: MessageType.Chat);
}
client.SetStatus(Availability.Offline);
}
}
catch (Exception exc)
{
Console.WriteLine(exc.ToString());
}
Console.WriteLine("Press any key to quit...");
Console.ReadLine();
}
private static void OnMessage(object sender, MessageEventArgs e)
{
Console.WriteLine(e.Jid.Node + ": " + e.Message.Body);
}
}
}
|
using S22.Xmpp.Client;
using S22.Xmpp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using S22.Xmpp.Im;
namespace XmppConsole
{
class Program
{
static void Main(string[] args)
{
try
{
using (var client = new XmppClient("something.com", "someone", "password"))
{
client.Connect();
client.Message += OnMessage;
Console.WriteLine("Connected as " + client.Jid);
string line;
while ((line = Console.ReadLine()) != null)
{
Jid to = new Jid("something.com", "someone");
client.SendMessage(to, line, type: MessageType.Chat);
}
}
}
catch (Exception exc)
{
Console.WriteLine(exc.ToString());
}
Console.WriteLine("Press any key to quit...");
Console.ReadLine();
}
private static void OnMessage(object sender, MessageEventArgs e)
{
Console.WriteLine(e.Jid.Node + ": " + e.Message.Body);
}
}
}
|
mit
|
C#
|
5bcc11b4b784d6e88cf542ba31e4aaf304f1d58c
|
modify WXEnum.cs
|
cuittzq/JCWX,linyujie/JCWX,sitexa/JCWX,lepon/JCWX,crushway/JCWX,JamesYing/JCWX
|
Business/Model/WXEnum.cs
|
Business/Model/WXEnum.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WX.Model
{
public enum MsgType
{
Text,
Image,
Voice,
Video,
Location,
Link,
Event,
News,
Music
}
public enum Event
{
Subscribe,
Unsubscribe,
Scan,
Location,
Click,
MASSSENDJOBFINISH,
View
}
public enum MediaType
{
Image,
Voice,
Video,
Thumb
}
public enum OAuthScope
{
Base,
UserInfo
}
public enum Language
{
CN,
TW,
EN
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WX.Model
{
public enum MsgType
{
Text,
Image,
Voice,
Video,
Location,
Link,
Event,
News,
Music
}
public enum Event
{
Subscribe,
Unsubscribe,
Scan,
Location,
Click,
MASSSENDJOBFINISH
}
public enum MediaType
{
Image,
Voice,
Video,
Thumb
}
public enum OAuthScope
{
Base,
UserInfo
}
public enum Language
{
CN,
TW,
EN
}
}
|
mit
|
C#
|
1bcae8536f1346be2bbce6cb51204faf8ea5e13f
|
apply global gather multiplier
|
Notulp/Pluton,Notulp/Pluton
|
Pluton/Events/GatherEvent.cs
|
Pluton/Events/GatherEvent.cs
|
using System;
namespace Pluton.Events
{
public class GatherEvent : CountedInstance
{
public ResourceDispenser resourceDispenser;
public Player Gatherer;
public Entity Resource;
public ItemAmount ItemAmount;
public int Amount;
public readonly int origAmount;
public GatherEvent(ResourceDispenser dispenser, BaseEntity from, BaseEntity to, ItemAmount itemAmt, int amount)
{
if (to is BasePlayer) {
Gatherer = Server.GetPlayer(to as BasePlayer);
Resource = new Entity(from);
resourceDispenser = dispenser;
ItemAmount = itemAmt;
Amount = (int)(amount * World.GetWorld().ResourceGatherMultiplier);
}
}
}
}
|
using System;
namespace Pluton.Events
{
public class GatherEvent : CountedInstance
{
public ResourceDispenser resourceDispenser;
public Player Gatherer;
public Entity Resource;
public ItemAmount ItemAmount;
public int Amount;
public readonly int origAmount;
public GatherEvent(ResourceDispenser dispenser, BaseEntity from, BaseEntity to, ItemAmount itemAmt, int amount)
{
if (to is BasePlayer) {
Gatherer = Server.GetPlayer(to as BasePlayer);
Resource = new Entity(from);
resourceDispenser = dispenser;
ItemAmount = itemAmt;
Amount = amount;
}
}
}
}
|
mit
|
C#
|
cecb7009a79120037b135ba9b730d24a95fd610e
|
Remove the container class from the header, because it was redundant with its containing div.
|
bigfont/sweet-water-revolver
|
mvcWebApp/Views/Home/_Header.cshtml
|
mvcWebApp/Views/Home/_Header.cshtml
|
<div class="container">
<header>
<h1>Sweet Water Revolver</h1>
</header>
</div>
|
<div class="container">
<header class="container">
<h1>Sweet Water Revolver</h1>
</header>
</div>
|
mit
|
C#
|
04882f5ecf15c325f34b74813a0f6e98d4789b67
|
build 0.0.4
|
rachmann/qboAccess,rachmann/qboAccess,rachmann/qboAccess
|
src/Global/GlobalAssemblyInfo.cs
|
src/Global/GlobalAssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[ assembly : ComVisible( false ) ]
[ assembly : AssemblyProduct( "QuickBooksOnlineAccess" ) ]
[ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ]
[ assembly : AssemblyCopyright( "Copyright (C) 2014 Agile Harbor, LLC" ) ]
[ assembly : AssemblyDescription( "QuickBooksOnline webservices API wrapper." ) ]
[ assembly : AssemblyTrademark( "" ) ]
[ assembly : AssemblyCulture( "" ) ]
[ assembly : CLSCompliant( false ) ]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
// Keep in track with CA API version
[ assembly : AssemblyVersion( "0.0.4.0" ) ]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[ assembly : ComVisible( false ) ]
[ assembly : AssemblyProduct( "QuickBooksOnlineAccess" ) ]
[ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ]
[ assembly : AssemblyCopyright( "Copyright (C) 2014 Agile Harbor, LLC" ) ]
[ assembly : AssemblyDescription( "QuickBooksOnline webservices API wrapper." ) ]
[ assembly : AssemblyTrademark( "" ) ]
[ assembly : AssemblyCulture( "" ) ]
[ assembly : CLSCompliant( false ) ]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
// Keep in track with CA API version
[ assembly : AssemblyVersion( "0.0.3.0" ) ]
|
bsd-3-clause
|
C#
|
7bec8226cc515339e4cb1a98a27e62d6bca3c5a4
|
Enable migrations on app start
|
chrisofspades/PickemApp,chrisofspades/PickemApp,chrisofspades/PickemApp
|
PickemApp/Global.asax.cs
|
PickemApp/Global.asax.cs
|
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using PickemApp.Models;
using PickemApp.Migrations;
namespace PickemApp
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
Database.SetInitializer(new MigrateDatabaseToLatestVersion<PickemDBContext, Configuration>());
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace PickemApp
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
}
}
}
|
isc
|
C#
|
9fdd5f6a760ce3519f9ba7402c364629b663a5cc
|
Enable CF migrations on restart
|
dev-academy-phase4/cs-portfolio,dev-academy-phase4/cs-portfolio
|
Portfolio/Global.asax.cs
|
Portfolio/Global.asax.cs
|
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace Portfolio
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
// Runs Code First database update on each restart...
// handy for deploy via GitHub.
#if !DEBUG
var migrator = new DbMigrator(new Configuration());
migrator.Update();
#endif
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace Portfolio
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
|
isc
|
C#
|
8c8f6edaa48a3802d0ea6db53fd4861cc80f6e9f
|
add documentation for font base class.
|
CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos
|
source/Cosmos.System2/Graphics/Fonts/Font.cs
|
source/Cosmos.System2/Graphics/Fonts/Font.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Cosmos.System.Graphics.Fonts
{
/// <summary>
/// Base class for fonts.
/// </summary>
public abstract class Font
{
/// <summary>
/// Get font pure data.
/// </summary>
public abstract byte[] Data { get; }
/// <summary>
/// Get font height.
/// </summary>
public abstract byte Height { get; }
/// <summary>
/// Get font Width.
/// </summary>
public abstract byte Width { get; }
/// <summary>
/// Set font file.
/// </summary>
/// <param name="aFileData">Font file.</param>
public abstract void SetFont(byte[] aFileData);
/// <summary>
/// Used to draw font.
/// </summary>
/// <param name="byteToConvert">byteToConvert</param>
/// <param name="bitToReturn">bitToReturn</param>
public bool ConvertByteToBitAddres(byte byteToConvert, int bitToReturn)
{
int mask = 1 << (bitToReturn - 1);
return (byteToConvert & mask) != 0;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Cosmos.System.Graphics.Fonts
{
public abstract class Font
{
public abstract byte[] Data { get; }
public abstract byte Height { get; }
public abstract byte Width { get; }
public abstract void SetFont(byte[] aFileData);
public bool ConvertByteToBitAddres(byte byteToConvert, int bitToReturn)
{
int mask = 1 << (bitToReturn - 1);
return (byteToConvert & mask) != 0;
}
}
}
|
bsd-3-clause
|
C#
|
7b1ec4101425fd8c50c7114e7fde756025247812
|
Improve PortHelper to be faster by giving a larger range
|
mattolenik/HttpMock,zhdusurfin/HttpMock,hibri/HttpMock,oschwald/HttpMock
|
src/HttpMock.Integration.Tests/PortHelper.cs
|
src/HttpMock.Integration.Tests/PortHelper.cs
|
using System;
using System.Linq;
using System.Net.NetworkInformation;
namespace HttpMock.Integration.Tests
{
internal static class PortHelper
{
internal static int FindLocalAvailablePortForTesting ()
{
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
var activeTcpConnections = properties.GetActiveTcpConnections();
const int minPort = 1024;
var random = new Random();
var maxPort = 64000;
var randomPort = random.Next(minPort, maxPort);
while (activeTcpConnections.Any(a => a.LocalEndPoint.Port == randomPort))
{
randomPort = random.Next(minPort, maxPort);
}
return randomPort;
}
}
}
|
using System;
using System.Linq;
using System.Net.NetworkInformation;
using System.Security;
namespace HttpMock.Integration.Tests
{
internal static class PortHelper
{
internal static int FindLocalAvailablePortForTesting ()
{
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
var activeTcpConnections = properties.GetActiveTcpConnections();
var minPort = activeTcpConnections.Select(a => a.LocalEndPoint.Port).Max();
var random = new Random();
var randomPort = random.Next(minPort, 65000);
while (activeTcpConnections.Any(a => a.LocalEndPoint.Port == randomPort))
{
randomPort = random.Next(minPort, 65000);
}
return randomPort;
}
}
}
|
mit
|
C#
|
d8163902b02db6e4b6cc23e619055c0f44baaf6a
|
Bump version to 17.0.0.44222
|
HearthSim/HearthDb
|
HearthDb/Properties/AssemblyInfo.cs
|
HearthDb/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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2020")]
[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("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("17.0.0.44222")]
[assembly: AssemblyFileVersion("17.0.0.44222")]
|
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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2020")]
[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("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("16.6.0.43246")]
[assembly: AssemblyFileVersion("16.6.0.43246")]
|
mit
|
C#
|
7162e03f64c1759e2b8f5a2b6f016c012a0c9e2e
|
Throw exceptions if calling AsXml or Save on the OrphanProject
|
corngood/omnisharp-server,x335/omnisharp-server,svermeulen/omnisharp-server,syl20bnr/omnisharp-server,corngood/omnisharp-server,OmniSharp/omnisharp-server,mispencer/OmniSharpServer,syl20bnr/omnisharp-server,x335/omnisharp-server
|
OmniSharp/Solution/OrphanProject.cs
|
OmniSharp/Solution/OrphanProject.cs
|
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.TypeSystem;
namespace OmniSharp.Solution
{
/// <summary>
/// Placeholder that can be used for files that don't belong to a project.
/// </summary>
public class OrphanProject : IProject
{
public string Title { get; private set; }
public List<CSharpFile> Files { get; private set; }
public List<IAssemblyReference> References { get; set; }
public IProjectContent ProjectContent { get; set; }
public string FileName { get; private set; }
private CSharpFile _file;
public OrphanProject(ISolution solution)
{
Title = "Orphan Project";
_file = new CSharpFile(this, "dummy_file", "");
Files = new List<CSharpFile>();
Files.Add(_file);
string mscorlib = CSharpProject.FindAssembly(CSharpProject.AssemblySearchPaths, "mscorlib");
ProjectContent = new CSharpProjectContent()
.SetAssemblyName("OrphanProject")
.AddAssemblyReferences(CSharpProject.LoadAssembly(mscorlib));
}
public CSharpFile GetFile(string fileName)
{
return _file;
}
public CSharpParser CreateParser()
{
return new CSharpParser();
}
public XDocument AsXml()
{
throw new NotImplementedException();
}
public void Save(XDocument project)
{
throw new NotImplementedException();
}
}
}
|
using System.Collections.Generic;
using System.Xml.Linq;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.TypeSystem;
namespace OmniSharp.Solution
{
/// <summary>
/// Placeholder that can be used for files that don't belong to a project.
/// </summary>
public class OrphanProject : IProject
{
public string Title { get; private set; }
public List<CSharpFile> Files { get; private set; }
public List<IAssemblyReference> References { get; set; }
public IProjectContent ProjectContent { get; set; }
public string FileName { get; private set; }
private CSharpFile _file;
public OrphanProject(ISolution solution)
{
Title = "Orphan Project";
_file = new CSharpFile(this, "dummy_file", "");
Files = new List<CSharpFile>();
Files.Add(_file);
string mscorlib = CSharpProject.FindAssembly(CSharpProject.AssemblySearchPaths, "mscorlib");
ProjectContent = new CSharpProjectContent()
.SetAssemblyName("OrphanProject")
.AddAssemblyReferences(CSharpProject.LoadAssembly(mscorlib));
}
public CSharpFile GetFile(string fileName)
{
return _file;
}
public CSharpParser CreateParser()
{
return new CSharpParser();
}
public XDocument AsXml()
{
return XDocument.Load(FileName);
}
public void Save(XDocument project)
{
project.Save(FileName);
}
}
}
|
mit
|
C#
|
55358f68a328fd168e30fd509904196e52a44dcc
|
convert callback to terser method group
|
Babblesort/GameOfLife
|
UI/GameForm.cs
|
UI/GameForm.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Engine;
using System.Threading;
namespace UI
{
public partial class GameForm : Form
{
TaskScheduler _scheduler;
private Grid _grid;
public GameForm()
{
InitializeComponent();
}
private void btnExit_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
private void GameForm_Load(object sender, EventArgs e)
{
_scheduler = TaskScheduler.FromCurrentSynchronizationContext();
_grid = new Grid(35, 35);
gamePanel.Grid = _grid;
}
private void btnRun_Click(object sender, EventArgs e)
{
var gaea = new Gaea(_grid, new Rules());
gaea.Run(UpdateGameVisualization);
}
private void UpdateGameVisualization(int generationNumber, Generation cells)
{
Task.Factory.StartNew(() => UpdateVisualization(generationNumber, cells),
CancellationToken.None,
TaskCreationOptions.None,
_scheduler);
}
private void UpdateVisualization(int generation, Generation cells)
{
lblGeneration.Text = generation.ToString();
gamePanel.Cells = cells;
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Engine;
using System.Threading;
namespace UI
{
public partial class GameForm : Form
{
TaskScheduler _scheduler;
private Grid _grid;
public GameForm()
{
InitializeComponent();
}
private void btnExit_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
private void GameForm_Load(object sender, EventArgs e)
{
_scheduler = TaskScheduler.FromCurrentSynchronizationContext();
_grid = new Grid(35, 35);
gamePanel.Grid = _grid;
}
private void btnRun_Click(object sender, EventArgs e)
{
var gaea = new Gaea(_grid, new Rules());
gaea.Run((generationNumber, cells) => UpdateGameVisualization(generationNumber, cells));
}
private void UpdateGameVisualization(int generationNumber, Generation cells)
{
Task.Factory.StartNew(() => UpdateVisualization(generationNumber, cells),
CancellationToken.None,
TaskCreationOptions.None,
_scheduler);
}
private void UpdateVisualization(int generation, Generation cells)
{
lblGeneration.Text = generation.ToString();
gamePanel.Cells = cells;
}
}
}
|
mit
|
C#
|
97e78fa0cbf12ccddb7eab26f97d6676eea4bf58
|
Clear some unused code.
|
DragonEyes7/ConcoursUBI17,DragonEyes7/ConcoursUBI17
|
Proto/Assets/Scripts/UI/ServerUI.cs
|
Proto/Assets/Scripts/UI/ServerUI.cs
|
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Collections;
public class ServerUI : MonoBehaviour
{
[SerializeField]InputField m_ServerNameField;
[SerializeField]RectTransform m_ServerList;
void Start ()
{
PhotonNetwork.ConnectUsingSettings("Proto v0.1");
StartCoroutine(WaitForConnection());
}
public void CreateServer()
{
//PhotonNetwork.ConnectUsingSettings(m_ServerNameField.text);
PhotonNetwork.CreateRoom(m_ServerNameField.text, null, null);
SceneManager.LoadScene("Level1");
}
public void GetServerList()
{
foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList())
{
GameObject serverbutton = (GameObject)Instantiate(Resources.Load("ServerJoinButton"), m_ServerList);
serverbutton.GetComponentInChildren<Text>().text = roomInfo.Name + " " + roomInfo.PlayerCount + "/" + roomInfo.MaxPlayers;
serverbutton.GetComponent<Button>().onClick.AddListener(() => JoinServer(roomInfo.Name));
//PhotonNetwork.JoinRoom(roomInfo.Name);
}
}
void JoinServer(string serverName)
{
PhotonNetwork.JoinRoom(serverName);
SceneManager.LoadScene("Level1");
}
IEnumerator WaitForConnection()
{
yield return new WaitUntil(() => PhotonNetwork.connectionStateDetailed == ClientState.JoinedLobby);
LoadingCompleted();
}
void LoadingCompleted()
{
LoadingManager LM = FindObjectOfType<LoadingManager>();
if (LM)
{
LM.ConnectionCompleted();
}
}
}
|
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Collections;
public class ServerUI : MonoBehaviour
{
[SerializeField]InputField m_ServerNameField;
[SerializeField]RectTransform m_ServerList;
void Start ()
{
PhotonNetwork.ConnectUsingSettings("Proto v0.1");
StartCoroutine(WaitForConnection());
}
void Update ()
{
}
void OnGUI()
{
GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString());
}
public void CreateServer()
{
//PhotonNetwork.ConnectUsingSettings(m_ServerNameField.text);
PhotonNetwork.CreateRoom(m_ServerNameField.text, null, null);
SceneManager.LoadScene("Level1");
}
public void GetServerList()
{
foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList())
{
GameObject serverbutton = (GameObject)Instantiate(Resources.Load("ServerJoinButton"), m_ServerList);
serverbutton.GetComponentInChildren<Text>().text = roomInfo.Name + " " + roomInfo.PlayerCount + "/" + roomInfo.MaxPlayers;
serverbutton.GetComponent<Button>().onClick.AddListener(() => JoinServer(roomInfo.Name));
//PhotonNetwork.JoinRoom(roomInfo.Name);
}
}
void JoinServer(string serverName)
{
PhotonNetwork.JoinRoom(serverName);
SceneManager.LoadScene("Level1");
}
IEnumerator WaitForConnection()
{
yield return new WaitUntil(() => PhotonNetwork.connectionStateDetailed == ClientState.JoinedLobby);
LoadingCompleted();
}
void LoadingCompleted()
{
LoadingManager LM = FindObjectOfType<LoadingManager>();
if (LM)
{
LM.ConnectionCompleted();
}
}
}
|
mit
|
C#
|
e7732daf154108375fc9a034ef91bee547ad07a9
|
Extend license
|
mrklintscher/libfintx
|
libfintx/Properties/AssemblyInfo.cs
|
libfintx/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 einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("libfintx")]
[assembly: AssemblyDescription("HBCI API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Torsten Klinger")]
[assembly: AssemblyProduct("libfintx")]
[assembly: AssemblyCopyright("Copyright © 2016 - 2017 Torsten Klinger")]
[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 aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("7f69841c-b99e-4236-ae26-5b6ad0538ae6")]
// 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("0.1.*")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
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 einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("libfintx")]
[assembly: AssemblyDescription("HBCI API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Torsten Klinger")]
[assembly: AssemblyProduct("libfintx")]
[assembly: AssemblyCopyright("Copyright © 2016 Torsten Klinger")]
[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 aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("7f69841c-b99e-4236-ae26-5b6ad0538ae6")]
// 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("0.1.*")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
lgpl-2.1
|
C#
|
31c2e57dbb93a5095a0da4af5fe6590bf0aed01f
|
add SafeAdd()
|
TakeAsh/cs-WpfUtility
|
WpfUtility/UIElementCollectionExtensionMethods.cs
|
WpfUtility/UIElementCollectionExtensionMethods.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
namespace WpfUtility {
public static class UIElementCollectionExtensionMethods {
public static void Add(this UIElementCollection items, IEnumerable<UIElement> list) {
if (items == null || list == null) {
return;
}
list.Where(item => item != null)
.ToList()
.ForEach(item => items.Add(item));
}
public static void SafeAdd(this UIElementCollection items, UIElement element) {
if (items == null || element == null) {
return;
}
items.Add(element);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
namespace WpfUtility {
public static class UIElementCollectionExtensionMethods {
public static void Add(this UIElementCollection items, IEnumerable<UIElement> list) {
if (items == null || list == null) {
return;
}
list.Where(item => item != null)
.ToList()
.ForEach(item => items.Add(item));
}
}
}
|
mit
|
C#
|
3673f3581ceeb325362b189312cd4e9876c4757a
|
Add missing time types
|
getconnect/connect-net,getconnect/connect-net-sdk
|
src/ConnectSdk/Querying/TimeType.cs
|
src/ConnectSdk/Querying/TimeType.cs
|
namespace ConnectSdk.Querying
{
public enum TimeType
{
Minutes,
Hours,
Days,
Weeks,
Months,
Quarters,
Years,
}
}
|
namespace ConnectSdk.Querying
{
public enum TimeType
{
Minutes,
Hours,
Days,
Weeks,
Years,
}
}
|
mit
|
C#
|
e6487d7c1e26f3430c395bef6cfa538518602ef6
|
bump Core to v1.3.1 for release
|
aranasoft/cobweb
|
src/Core/Properties/AssemblyInfo.cs
|
src/Core/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("Cobweb")]
[assembly: AssemblyDescription("Cobweb is a base-class utility library for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Arana Software")]
[assembly: AssemblyProduct("Aranasoft's Cobweb")]
[assembly: AssemblyCopyright("Copyright © 2013-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6f1e057-b177-4bce-bcfc-90345aceb0a0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Cobweb")]
[assembly: AssemblyDescription("Cobweb is a base-class utility library for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Arana Software")]
[assembly: AssemblyProduct("Aranasoft's Cobweb")]
[assembly: AssemblyCopyright("Copyright © 2013-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6f1e057-b177-4bce-bcfc-90345aceb0a0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
|
bsd-3-clause
|
C#
|
a62770b39df18615939fa7366ff868b0feef2c18
|
Fix demo by uncommenting line accidentally left commented
|
justinjstark/Verdeler,justinjstark/Delivered
|
src/Demo/DemoDistributor/Program.cs
|
src/Demo/DemoDistributor/Program.cs
|
using System;
using DemoDistributor.Endpoints.FileSystem;
using DemoDistributor.Endpoints.Sharepoint;
using Delivered;
namespace DemoDistributor
{
internal class Program
{
private static void Main(string[] args)
{
//Configure the distributor
var distributor = new Distributor<File, Vendor>();
distributor.RegisterEndpointRepository(new FileSystemEndpointRepository());
distributor.RegisterEndpointRepository(new SharepointEndpointRepository());
distributor.RegisterEndpointDeliveryService(new FileSystemDeliveryService());
distributor.RegisterEndpointDeliveryService(new SharepointDeliveryService());
distributor.MaximumConcurrentDeliveries(3);
//Distribute a file to a vendor
try
{
var task = distributor.DistributeAsync(FakeFile, FakeVendor);
task.Wait();
Console.WriteLine("\nDistribution succeeded.");
}
catch(AggregateException aggregateException)
{
Console.WriteLine("\nDistribution failed.");
foreach (var exception in aggregateException.Flatten().InnerExceptions)
{
Console.WriteLine($"* {exception.Message}");
}
}
Console.WriteLine("\nPress enter to exit.");
Console.ReadLine();
}
private static File FakeFile => new File
{
Name = @"test.pdf",
Contents = new byte[1024]
};
private static Vendor FakeVendor => new Vendor
{
Name = @"Mark's Pool Supplies"
};
private static Vendor FakeVendor2 => new Vendor
{
Name = @"Kevin's Art Supplies"
};
}
}
|
using System;
using DemoDistributor.Endpoints.FileSystem;
using DemoDistributor.Endpoints.Sharepoint;
using Delivered;
namespace DemoDistributor
{
internal class Program
{
private static void Main(string[] args)
{
//Configure the distributor
var distributor = new Distributor<File, Vendor>();
//distributor.RegisterEndpointRepository(new FileSystemEndpointRepository());
distributor.RegisterEndpointRepository(new SharepointEndpointRepository());
distributor.RegisterEndpointDeliveryService(new FileSystemDeliveryService());
distributor.RegisterEndpointDeliveryService(new SharepointDeliveryService());
distributor.MaximumConcurrentDeliveries(3);
//Distribute a file to a vendor
try
{
var task = distributor.DistributeAsync(FakeFile, FakeVendor);
task.Wait();
Console.WriteLine("\nDistribution succeeded.");
}
catch(AggregateException aggregateException)
{
Console.WriteLine("\nDistribution failed.");
foreach (var exception in aggregateException.Flatten().InnerExceptions)
{
Console.WriteLine($"* {exception.Message}");
}
}
Console.WriteLine("\nPress enter to exit.");
Console.ReadLine();
}
private static File FakeFile => new File
{
Name = @"test.pdf",
Contents = new byte[1024]
};
private static Vendor FakeVendor => new Vendor
{
Name = @"Mark's Pool Supplies"
};
private static Vendor FakeVendor2 => new Vendor
{
Name = @"Kevin's Art Supplies"
};
}
}
|
mit
|
C#
|
0b16d77b2d7de12fd5075ca73bf3dd86b8fdcf9a
|
build version: 3.9.71.7
|
wiesel78/Canwell.OrmLite.MSAccess2003
|
Source/GlobalAssemblyInfo.cs
|
Source/GlobalAssemblyInfo.cs
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Cake.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Reflection;
[assembly: AssemblyCompany("canwell - IT Solutions")]
[assembly: AssemblyVersion("3.9.71.7")]
[assembly: AssemblyFileVersion("3.9.71.7")]
[assembly: AssemblyInformationalVersion("3.9.71.7")]
[assembly: AssemblyCopyright("Copyright © 2016")]
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Cake.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Reflection;
[assembly: AssemblyCompany("canwell - IT Solutions")]
[assembly: AssemblyVersion("3.9.71.6")]
[assembly: AssemblyFileVersion("3.9.71.6")]
[assembly: AssemblyInformationalVersion("3.9.71.6")]
[assembly: AssemblyCopyright("Copyright © 2016")]
|
bsd-3-clause
|
C#
|
bdbfac99aa0cbdba0ae2fd0c6ef7b76aee75c26f
|
Add FATDS to position
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
BatteryCommander.Common/Models/Position.cs
|
BatteryCommander.Common/Models/Position.cs
|
using System.ComponentModel.DataAnnotations;
namespace BatteryCommander.Common.Models
{
//public class Position
//{
// [Key]
// [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
// public int Id { get; set; }
// [Required, StringLength(30)]
// public String Name { get; set; }
// [Required, StringLength(5)]
// public String Abbreviation { get; set; }
//}
public enum Position
{
Unassigned,
[Display(Name = "Signal NCO", ShortName = "SIG SGT")]
Signal_NCO,
[Display(Name = "Supply Specialist", ShortName = "SUP SPC")]
Supply_Specialist,
[Display(Name = "Supply NCO", ShortName = "SUP NCO")]
Supply_NCO,
[Display(Name = "Ammo Handler", ShortName = "AH")]
Ammo_Section_Member,
[Display(Name = "Ammo Section Sergeant", ShortName = "AMMO SGT")]
Ammo_Section_Sergeant,
[Display(Name = "Ammo Team Chief", ShortName = "ATC")]
Ammo_Team_Chief,
[Display(Name = "Cannoneer", ShortName = "CN")]
Cannoneer,
[Display(Name = "Driver", ShortName = "DRV")]
Driver,
[Display(Name = "Asst. Gunner", ShortName = "AG")]
Assistant_Gunner,
[Display(Name = "Gunner", ShortName = "G")]
Gunner,
[Display(Name = "Field Artillery Tactical Data Specialist", ShortName = "FATDS")]
FATDS,
[Display(Name = "Section Chief", ShortName = "CHF")]
Gun_Section_Chief,
[Display(Name = "Gunnery Sergeant", ShortName = "GSG")]
Gunnery_Sergeant,
[Display(Name = "Platoon Sergeant", ShortName = "PSG")]
Platoon_Sergeant,
[Display(Name = "Fire Direction Officer", ShortName = "FDO")]
Fire_Direction_Officer,
[Display(Name = "Platoon Leader", ShortName = "PL")]
Platoon_Leader,
[Display(Name = "First Sergeant", ShortName = "1SG")]
First_Sergeant,
[Display(Name = "Commander", ShortName = "CMDR")]
Commander
}
}
|
using System.ComponentModel.DataAnnotations;
namespace BatteryCommander.Common.Models
{
//public class Position
//{
// [Key]
// [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
// public int Id { get; set; }
// [Required, StringLength(30)]
// public String Name { get; set; }
// [Required, StringLength(5)]
// public String Abbreviation { get; set; }
//}
public enum Position
{
Unassigned,
[Display(Name = "Signal NCO", ShortName = "SIG SGT")]
Signal_NCO,
[Display(Name = "Supply Specialist", ShortName = "SUP SPC")]
Supply_Specialist,
[Display(Name = "Supply NCO", ShortName = "SUP NCO")]
Supply_NCO,
[Display(Name = "Ammo Handler", ShortName = "AH")]
Ammo_Section_Member,
[Display(Name = "Ammo Section Sergeant", ShortName = "AMMO SGT")]
Ammo_Section_Sergeant,
[Display(Name = "Ammo Section Chief", ShortName = "AMMO CHF")]
Ammo_Section_Chief,
[Display(Name = "Ammo Team Chief", ShortName = "ATC")]
Ammo_Team_Chief,
[Display(Name = "Cannoneer", ShortName = "CN")]
Cannoneer,
[Display(Name = "Driver", ShortName = "DRV")]
Driver,
[Display(Name = "Asst. Gunner", ShortName = "AG")]
Assistant_Gunner,
[Display(Name = "Gunner", ShortName = "G")]
Gunner,
[Display(Name = "Section Chief", ShortName = "CHF")]
Gun_Section_Chief,
[Display(Name = "Gunnery Sergeant", ShortName = "GSG")]
Gunnery_Sergeant,
[Display(Name = "Platoon Sergeant", ShortName = "PSG")]
Platoon_Sergeant,
[Display(Name = "Fire Direction Officer", ShortName = "FDO")]
Fire_Direction_Officer,
[Display(Name = "Platoon Leader", ShortName = "PL")]
Platoon_Leader,
[Display(Name = "First Sergeant", ShortName = "1SG")]
First_Sergeant,
[Display(Name = "Commander", ShortName = "CMDR")]
Commander
}
}
|
mit
|
C#
|
008c65627331c77b0e76a6929a1b0d41c791dfa0
|
Fix stylecop issue within Trace
|
rho24/Glimpse,gabrielweyer/Glimpse,gabrielweyer/Glimpse,dudzon/Glimpse,paynecrl97/Glimpse,Glimpse/Glimpse,dudzon/Glimpse,SusanaL/Glimpse,paynecrl97/Glimpse,elkingtonmcb/Glimpse,SusanaL/Glimpse,paynecrl97/Glimpse,codevlabs/Glimpse,flcdrg/Glimpse,SusanaL/Glimpse,elkingtonmcb/Glimpse,Glimpse/Glimpse,rho24/Glimpse,sorenhl/Glimpse,codevlabs/Glimpse,sorenhl/Glimpse,elkingtonmcb/Glimpse,rho24/Glimpse,Glimpse/Glimpse,paynecrl97/Glimpse,flcdrg/Glimpse,rho24/Glimpse,dudzon/Glimpse,gabrielweyer/Glimpse,flcdrg/Glimpse,codevlabs/Glimpse,sorenhl/Glimpse
|
source/Glimpse.AspNet/Tab/Trace.cs
|
source/Glimpse.AspNet/Tab/Trace.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Glimpse.AspNet.Model;
using Glimpse.AspNet.PipelineInspector;
using Glimpse.Core.Extensibility;
namespace Glimpse.AspNet.Tab
{
public class Trace : ITab, ITabSetup, IDocumentation
{
public const string TraceMessageStoreKey = "Glimpse.Trace.Messages";
public const string FirstWatchStoreKey = "Glimpse.Trace.FirstWatch";
public const string LastWatchStoreKey = "Glimpse.Trace.LastWatch";
public string Name
{
get { return "Trace"; }
}
public string DocumentationUri
{
// TODO: Update to proper Uri
get { return "http://localhost/someUrl"; }
}
public RuntimeEvent ExecuteOn
{
get { return RuntimeEvent.EndRequest; }
}
public Type RequestContextType
{
get { return null; }
}
public object GetData(ITabContext context)
{
var data = context.TabStore.Get<IList<TraceModel>>(TraceMessageStoreKey);
return data;
}
public void Setup(ITabSetupContext context)
{
var traceListeners = System.Diagnostics.Trace.Listeners;
if (!traceListeners.OfType<TraceInspector>().Any())
{
traceListeners.Add(new TraceInspector(context));
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Glimpse.AspNet.Model;
using Glimpse.AspNet.PipelineInspector;
using Glimpse.Core.Extensibility;
namespace Glimpse.AspNet.Tab
{
public class Trace : ITab, ITabSetup, IDocumentation
{
public const string TraceMessageStoreKey = "Glimpse.Trace.Messages";
public const string FirstWatchStoreKey = "Glimpse.Trace.FirstWatch";
public const string LastWatchStoreKey = "Glimpse.Trace.LastWatch";
public string Name
{
get { return "Trace"; }
}
public string DocumentationUri
{
// TODO: Update to proper Uri
get { return "http://localhost/someUrl"; }
}
public RuntimeEvent ExecuteOn
{
get { return RuntimeEvent.EndRequest; }
}
public Type RequestContextType
{
get { return null; }
}
public object GetData(ITabContext context)
{
var data = context.TabStore.Get<IList<TraceModel>>(TraceMessageStoreKey);
return data;
}
public void Setup(ITabSetupContext context)
{
var traceListeners = System.Diagnostics.Trace.Listeners;
if (!traceListeners.OfType<TraceInspector>().Any())
traceListeners.Add(new TraceInspector(context));
}
}
}
|
apache-2.0
|
C#
|
0b7bf5811d894e69b9b392034f8972854b25bed2
|
complete XML doc for Elements
|
OlegKleyman/Omego.Extensions
|
core/Omego.Extensions/Elements.cs
|
core/Omego.Extensions/Elements.cs
|
namespace Omego.Extensions
{
/// <summary>
/// Represents a quantity category of elements.
/// </summary>
public enum Elements
{
/// <summary>
/// Represents no elements.
/// </summary>
None,
/// <summary>
/// Represents one element.
/// </summary>
One,
/// <summary>
/// Represents multiple elements.
/// </summary>
Multiple
}
}
|
namespace Omego.Extensions
{
public enum Elements
{
None,
One,
Multiple
}
}
|
unlicense
|
C#
|
81f62b5602058379ae5abf0928617b163abc0d66
|
Add null check
|
mattolenik/winston,mattolenik/winston,mattolenik/winston
|
Winston/Serialization/Yml.cs
|
Winston/Serialization/Yml.cs
|
using System;
using System.IO;
using YamlDotNet.Serialization;
namespace Winston.Serialization
{
public class Yml
{
public static T Load<T>(string path)
{
var deserializer = new Deserializer();
deserializer.RegisterTypeConverter(new YmlUriConverter());
using (var reader = new StreamReader(path))
{
return deserializer.Deserialize<T>(reader);
}
}
public static bool TryLoad<T>(string path, out T result)
{
try
{
result = Load<T>(path);
}
catch(Exception ex)
{
Console.Error.WriteLine(ex);
result = default(T);
return false;
}
return true;
}
public static bool TryLoad<T>(string path, out T result, Func<T> defaultVal)
{
var success = TryLoad(path, out result);
if (success) { return true; }
if (defaultVal != null)
{
result = defaultVal();
}
throw new ArgumentNullException(nameof(defaultVal));
}
public static void Save(object obj, string path)
{
var serializer = new Serializer();
serializer.RegisterTypeConverter(new YmlUriConverter());
using (var writer = new StreamWriter(path))
{
serializer.Serialize(writer, obj);
}
}
public static void Serialize(TextWriter writer, object obj)
{
var serializer = new Serializer();
serializer.RegisterTypeConverter(new YmlUriConverter());
serializer.Serialize(writer, obj);
}
public static string Serialize(object obj)
{
using (var sw = new StringWriter())
{
Serialize(sw, obj);
return sw.ToString();
}
}
}
}
|
using System;
using System.IO;
using YamlDotNet.Serialization;
namespace Winston.Serialization
{
public class Yml
{
public static T Load<T>(string path)
{
var deserializer = new Deserializer();
deserializer.RegisterTypeConverter(new YmlUriConverter());
using (var reader = new StreamReader(path))
{
return deserializer.Deserialize<T>(reader);
}
}
public static bool TryLoad<T>(string path, out T result)
{
try
{
result = Load<T>(path);
}
catch(Exception ex)
{
Console.Error.WriteLine(ex);
result = default(T);
return false;
}
return true;
}
public static bool TryLoad<T>(string path, out T result, Func<T> defaultVal)
{
var success = TryLoad(path, out result);
if (!success)
{
result = defaultVal();
}
return success;
}
public static void Save(object obj, string path)
{
var serializer = new Serializer();
serializer.RegisterTypeConverter(new YmlUriConverter());
using (var writer = new StreamWriter(path))
{
serializer.Serialize(writer, obj);
}
}
public static void Serialize(TextWriter writer, object obj)
{
var serializer = new Serializer();
serializer.RegisterTypeConverter(new YmlUriConverter());
serializer.Serialize(writer, obj);
}
public static string Serialize(object obj)
{
using (var sw = new StringWriter())
{
Serialize(sw, obj);
return sw.ToString();
}
}
}
}
|
mit
|
C#
|
ae97eea7c1b6a90112bf964679378b7840901c7f
|
Return OBJECTID field
|
agrc/deq-enviro,agrc/deq-enviro,agrc/deq-enviro,agrc/deq-enviro
|
api/Deq.Search.Soe/Configuration/DebugConfiguration.cs
|
api/Deq.Search.Soe/Configuration/DebugConfiguration.cs
|
using Deq.Search.Soe.Infastructure;
using Deq.Search.Soe.Models.Configuration;
using ESRI.ArcGIS.esriSystem;
namespace Deq.Search.Soe.Configuration {
#region License
//
// Copyright (C) 2012 AGRC
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial
// portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
/// <summary>
/// Debug configration. Preconfigured for debug environment
/// </summary>
public class DebugConfiguration : IConfigurable {
public ApplicationFieldSettings GetFields(IPropertySet props) {
var settings = new ApplicationFieldSettings {
ReturnFields = new[] {
"ID", "NAME", "ADDRESS", "CITY", "TYPE", "OBJECTID"
},
ProgramId = "ID",
SiteName = "NAME"
};
return settings;
}
}
}
|
using Deq.Search.Soe.Infastructure;
using Deq.Search.Soe.Models.Configuration;
using ESRI.ArcGIS.esriSystem;
namespace Deq.Search.Soe.Configuration {
#region License
//
// Copyright (C) 2012 AGRC
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial
// portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
/// <summary>
/// Debug configration. Preconfigured for debug environment
/// </summary>
public class DebugConfiguration : IConfigurable {
public ApplicationFieldSettings GetFields(IPropertySet props) {
var settings = new ApplicationFieldSettings {
ReturnFields = new[] {
"ID", "NAME", "ADDRESS", "CITY", "TYPE"
},
ProgramId = "ID",
SiteName = "NAME"
};
return settings;
}
}
}
|
mit
|
C#
|
372aec0519399efb6e02c3dcefb0f1864020f12a
|
Update CharacterController.cs
|
felladrin/unity3d-mvc
|
Scripts/Controllers/CharacterController.cs
|
Scripts/Controllers/CharacterController.cs
|
public class CharacterController : MvcBehaviour
{
// Implment here all other actions a character
// can pertorm or react. For example:
// ApplyStatsBonus, TakeHit, PlayEmote.
// From the controller you can access
// the CharacterModel through 'App.Model.Character'
// and CharacterView through 'App.View.Character'
}
|
public class CharacterController : MvcBehaviour
{
CharacterModel model;
CharacterView view;
void Start ()
{
model = App.Model.Character;
view = App.View.Character;
}
// Implment here all other actions a character
// can execute or receive, for example:
// ApplyStatsBonus. TakeHit, PlayEmote...
// From here (the controller) you can access
// the CharacterModel through 'model' variable
// and CharacterView through 'view' variable
}
|
mit
|
C#
|
e4717cc92d13870f13037aa318c6b236c61e1483
|
Fix test
|
corstijank/blog-dotnet-jenkins,corstijank/blog-dotnet-jenkins
|
TodoApi.Test/Models/TodoRepositoryTests.cs
|
TodoApi.Test/Models/TodoRepositoryTests.cs
|
using Xunit;
namespace TodoApi.Models
{
public class TodoRepositoryTests
{
private ITodoRepository _repository;
public TodoRepositoryTests()
{
_repository = new TodoRepository();
}
[Fact]
public void CanFindANewlyAddedTodoItem()
{
//Given
_repository.Add(new TodoItem {Key="abc", Name = "Some Random Todo", IsComplete = false });
//When
TodoItem foundItem = _repository.Find("abc");
//Then
Assert.NotNull(foundItem);
}
}
}
|
using Xunit;
namespace TodoApi.Models
{
public class TodoRepositoryTests
{
private ITodoRepository _repository;
public TodoRepositoryTests()
{
_repository = new TodoRepository();
}
[Fact]
public void CanFindANewlyAddedTodoItem()
{
//Given
_repository.Add(new TodoItem {Key="abc", Name = "Some Random Todo", IsComplete = false });
//When
TodoItem foundItem = _repository.Find("abcd");
//Then
Assert.NotNull(foundItem);
}
}
}
|
apache-2.0
|
C#
|
187b33ab13610189e50740ad61a6da0dd46d98f6
|
Fix StyleCop issue.
|
breezechen/DiscUtils,drebrez/DiscUtils,quamotion/discutils,breezechen/DiscUtils
|
src/Fat/FatFileSystemOptions.cs
|
src/Fat/FatFileSystemOptions.cs
|
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
namespace DiscUtils.Fat
{
using System;
using System.Text;
/// <summary>
/// FAT file system options.
/// </summary>
public sealed class FatFileSystemOptions : DiscFileSystemOptions
{
private Encoding _encoding;
internal FatFileSystemOptions()
{
FileNameEncoding = Encoding.GetEncoding(437);
}
internal FatFileSystemOptions(FileSystemParameters parameters)
{
if (parameters != null)
{
FileNameEncoding = parameters.FileNameEncoding ?? Encoding.GetEncoding(437);
}
}
/// <summary>
/// Gets or sets the character encoding used for file names.
/// </summary>
public Encoding FileNameEncoding
{
get
{
return _encoding;
}
set
{
if (!value.IsSingleByte)
{
throw new ArgumentException(value.EncodingName + " is not a single byte encoding");
}
_encoding = value;
}
}
}
}
|
//
// Copyright (c) 2008-2011, Kenneth Bell
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
namespace DiscUtils.Fat
{
using System;
using System.Text;
/// <summary>
/// FAT file system options.
/// </summary>
public sealed class FatFileSystemOptions : DiscFileSystemOptions
{
private Encoding _encoding;
internal FatFileSystemOptions()
{
FileNameEncoding = Encoding.GetEncoding(437);
}
internal FatFileSystemOptions(FileSystemParameters parameters)
{
if (parameters != null)
{
FileNameEncoding = parameters.FileNameEncoding ?? Encoding.GetEncoding(437);
}
}
/// <summary>
/// Gets or sets the character encoding used for file names.
/// </summary>
public Encoding FileNameEncoding {
get
{
return _encoding;
}
set
{
if (!value.IsSingleByte)
{
throw new ArgumentException(value.EncodingName + " is not a single byte encoding");
}
_encoding = value;
}
}
}
}
|
mit
|
C#
|
9e17c2e50c655d60a0d09d26806c70111e903124
|
Allow mac for EncryptedString
|
bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core
|
src/Api/Utilities/EncryptedValueAttribute.cs
|
src/Api/Utilities/EncryptedValueAttribute.cs
|
using System;
using System.ComponentModel.DataAnnotations;
namespace Bit.Api.Utilities
{
/// <summary>
/// Validates a string that is in encrypted form: "b64iv=|b64ct="
/// </summary>
public class EncryptedStringAttribute : ValidationAttribute
{
public EncryptedStringAttribute()
: base("{0} is not a valid encrypted string.")
{ }
public override bool IsValid(object value)
{
if(value == null)
{
return true;
}
try
{
var encString = value?.ToString();
if(string.IsNullOrWhiteSpace(encString))
{
return false;
}
var encStringPieces = encString.Split('|');
if(encStringPieces.Length != 2 && encStringPieces.Length != 3)
{
return false;
}
var iv = Convert.FromBase64String(encStringPieces[0]);
var ct = Convert.FromBase64String(encStringPieces[1]);
if(iv.Length < 1 || ct.Length < 1)
{
return false;
}
if(encStringPieces.Length == 3)
{
var mac = Convert.FromBase64String(encStringPieces[2]);
if(mac.Length < 1)
{
return false;
}
}
}
catch
{
return false;
}
return true;
}
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
namespace Bit.Api.Utilities
{
/// <summary>
/// Validates a string that is in encrypted form: "b64iv=|b64ct="
/// </summary>
public class EncryptedStringAttribute : ValidationAttribute
{
public EncryptedStringAttribute()
: base("{0} is not a valid encrypted string.")
{ }
public override bool IsValid(object value)
{
if(value == null)
{
return true;
}
try
{
var encString = value?.ToString();
if(string.IsNullOrWhiteSpace(encString))
{
return false;
}
var encStringPieces = encString.Split('|');
if(encStringPieces.Length != 2)
{
return false;
}
var iv = Convert.FromBase64String(encStringPieces[0]);
var ct = Convert.FromBase64String(encStringPieces[1]);
if(iv.Length < 1 || ct.Length < 1)
{
return false;
}
}
catch
{
return false;
}
return true;
}
}
}
|
agpl-3.0
|
C#
|
e2ed13b39248d10f52ffae58f4e51ed594a8951e
|
Trim whitespace
|
UselessToucan/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,ppy/osu,2yangk23/osu,peppy/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,EVAST9919/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu-new,peppy/osu,ppy/osu,2yangk23/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu
|
osu.Game/Overlays/Changelog/ChangelogUpdateStreamItem.cs
|
osu.Game/Overlays/Changelog/ChangelogUpdateStreamItem.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 Humanizer;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osuTK.Graphics;
namespace osu.Game.Overlays.Changelog
{
public class ChangelogUpdateStreamItem : OverlayUpdateStreamItem<APIUpdateStream>
{
public ChangelogUpdateStreamItem(APIUpdateStream stream)
: base(stream)
{
if (stream.IsFeatured)
Width *= 2;
}
protected override string GetMainText => Value.DisplayName;
protected override string GetAdditionalText => Value.LatestBuild.DisplayVersion;
protected override string GetInfoText => Value.LatestBuild.Users > 0 ? $"{"user".ToQuantity(Value.LatestBuild.Users, "N0")} online" : null;
protected override Color4 GetBarColour(OsuColour colours) => Value.Colour;
}
}
|
// 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 Humanizer;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osuTK.Graphics;
namespace osu.Game.Overlays.Changelog
{
public class ChangelogUpdateStreamItem : OverlayUpdateStreamItem<APIUpdateStream>
{
public ChangelogUpdateStreamItem(APIUpdateStream stream)
: base(stream)
{
if (stream.IsFeatured)
Width *= 2;
}
protected override string GetMainText => Value.DisplayName;
protected override string GetAdditionalText => Value.LatestBuild.DisplayVersion;
protected override string GetInfoText => Value.LatestBuild.Users > 0 ? $"{"user".ToQuantity(Value.LatestBuild.Users, "N0")} online" : null;
protected override Color4 GetBarColour(OsuColour colours) => Value.Colour;
}
}
|
mit
|
C#
|
03b29d1e5f712a6f19089762577990314c72cd66
|
Add null checks to Reference
|
gep13/GitVersion,asbjornu/GitVersion,gep13/GitVersion,asbjornu/GitVersion,GitTools/GitVersion,GitTools/GitVersion
|
src/GitVersion.LibGit2Sharp/Git/Reference.cs
|
src/GitVersion.LibGit2Sharp/Git/Reference.cs
|
using GitVersion.Extensions;
using GitVersion.Helpers;
using LibGit2Sharp;
namespace GitVersion
{
internal sealed class Reference : IReference
{
private static readonly LambdaEqualityHelper<IReference> equalityHelper = new(x => x.Name.Canonical);
private static readonly LambdaKeyComparer<IReference, string> comparerHelper = new(x => x.Name.Canonical);
internal readonly LibGit2Sharp.Reference innerReference;
internal Reference(LibGit2Sharp.Reference reference)
{
this.innerReference = reference.NotNull();
Name = new ReferenceName(reference.CanonicalName);
if (reference is DirectReference)
ReferenceTargetId = new ObjectId(reference.TargetIdentifier);
}
public ReferenceName Name { get; }
public IObjectId? ReferenceTargetId { get; }
public int CompareTo(IReference other) => comparerHelper.Compare(this, other);
public override bool Equals(object obj) => Equals(obj as IReference);
public bool Equals(IReference? other) => equalityHelper.Equals(this, other);
public override int GetHashCode() => equalityHelper.GetHashCode(this);
public override string ToString() => Name.ToString();
public string TargetIdentifier => this.innerReference.TargetIdentifier;
public static implicit operator LibGit2Sharp.Reference(Reference d)
=> d.NotNull().innerReference;
}
}
|
using GitVersion.Helpers;
using LibGit2Sharp;
namespace GitVersion
{
internal sealed class Reference : IReference
{
private static readonly LambdaEqualityHelper<IReference> equalityHelper = new(x => x.Name.Canonical);
private static readonly LambdaKeyComparer<IReference, string> comparerHelper = new(x => x.Name.Canonical);
internal readonly LibGit2Sharp.Reference innerReference;
internal Reference(LibGit2Sharp.Reference reference)
{
this.innerReference = reference;
Name = new ReferenceName(reference.CanonicalName);
if (reference is DirectReference)
ReferenceTargetId = new ObjectId(reference.TargetIdentifier);
}
public ReferenceName Name { get; }
public IObjectId? ReferenceTargetId { get; }
public int CompareTo(IReference other) => comparerHelper.Compare(this, other);
public override bool Equals(object obj) => Equals((obj as IReference));
public bool Equals(IReference? other) => equalityHelper.Equals(this, other);
public override int GetHashCode() => equalityHelper.GetHashCode(this);
public override string ToString() => Name.ToString();
public string TargetIdentifier => this.innerReference.TargetIdentifier;
public static implicit operator LibGit2Sharp.Reference(Reference d) => d.innerReference;
}
}
|
mit
|
C#
|
a3da0bd6210e497f9ec1211ce350bfe6e024aa74
|
Add new IsSupported flag
|
jamesmontemagno/InAppBillingPlugin
|
src/Plugin.InAppBilling/CrossInAppBilling.cs
|
src/Plugin.InAppBilling/CrossInAppBilling.cs
|
using Plugin.InAppBilling.Abstractions;
using System;
namespace Plugin.InAppBilling
{
/// <summary>
/// Cross platform InAppBilling implemenations
/// </summary>
public class CrossInAppBilling
{
static Lazy<IInAppBilling> implementation = new Lazy<IInAppBilling>(() => CreateInAppBilling(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
/// <summary>
/// Gets if the plugin is supported on the current platform.
/// </summary>
public static bool IsSupported => implementation.Value == null ? false : true;
/// <summary>
/// Current plugin implementation to use
/// </summary>
public static IInAppBilling Current
{
get
{
var ret = implementation.Value;
if (ret == null)
{
throw NotImplementedInReferenceAssembly();
}
return ret;
}
}
static IInAppBilling CreateInAppBilling()
{
#if NETSTANDARD1_0
return null;
#else
#pragma warning disable IDE0022 // Use expression body for methods
return new InAppBillingImplementation();
#pragma warning restore IDE0022 // Use expression body for methods
#endif
}
internal static Exception NotImplementedInReferenceAssembly() =>
new NotImplementedException("This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.");
/// <summary>
/// Dispose of everything
/// </summary>
public static void Dispose()
{
if (implementation != null && implementation.IsValueCreated)
{
implementation.Value.Dispose();
implementation = new Lazy<IInAppBilling>(() => CreateInAppBilling(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
}
}
}
}
|
using Plugin.InAppBilling.Abstractions;
using System;
namespace Plugin.InAppBilling
{
/// <summary>
/// Cross platform InAppBilling implemenations
/// </summary>
public class CrossInAppBilling
{
static Lazy<IInAppBilling> Implementation = new Lazy<IInAppBilling>(() => CreateInAppBilling(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
/// <summary>
/// Current settings to use
/// </summary>
public static IInAppBilling Current
{
get
{
var ret = Implementation.Value;
if (ret == null)
{
throw NotImplementedInReferenceAssembly();
}
return ret;
}
}
static IInAppBilling CreateInAppBilling()
{
#if NETSTANDARD1_0
return null;
#else
return new InAppBillingImplementation();
#endif
}
internal static Exception NotImplementedInReferenceAssembly()
{
return new NotImplementedException("This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.");
}
/// <summary>
/// Dispose of everything
/// </summary>
public static void Dispose()
{
if (Implementation != null && Implementation.IsValueCreated)
{
Implementation.Value.Dispose();
Implementation = new Lazy<IInAppBilling>(() => CreateInAppBilling(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
}
}
}
}
|
mit
|
C#
|
d6765899f4dea2bbb922d8b5f3c781ac144e0415
|
Fix null players in player list.
|
Mikuz/Battlezeppelins,Mikuz/Battlezeppelins
|
Battlezeppelins/Controllers/BaseController.cs
|
Battlezeppelins/Controllers/BaseController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Battlezeppelins.Models;
namespace Battlezeppelins.Controllers
{
public abstract class BaseController : Controller
{
private static List<Player> playerList = new List<Player>();
public Player GetPlayer()
{
if (Request.Cookies["userInfo"] != null)
{
string idStr = Server.HtmlEncode(Request.Cookies["userInfo"]["id"]);
int id = Int32.Parse(idStr);
Player player = SearchPlayer(id);
if (player != null) return player;
lock (playerList)
{
player = SearchPlayer(id);
if (player != null) return player;
Player newPlayer = Player.GetInstance(id);
if (newPlayer != null) playerList.Add(newPlayer);
return newPlayer;
}
}
return null;
}
private Player SearchPlayer(int id)
{
if (!playerList.Any()) return null;
foreach (Player listPlayer in playerList) {
if (listPlayer.id == id) {
return listPlayer;
}
}
return null;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Battlezeppelins.Models;
namespace Battlezeppelins.Controllers
{
public abstract class BaseController : Controller
{
private static List<Player> playerList = new List<Player>();
public Player GetPlayer()
{
if (Request.Cookies["userInfo"] != null)
{
string idStr = Server.HtmlEncode(Request.Cookies["userInfo"]["id"]);
int id = Int32.Parse(idStr);
Player player = SearchPlayer(id);
if (player != null) return player;
lock (playerList)
{
player = SearchPlayer(id);
if (player != null) return player;
Player newPlayer = Player.GetInstance(id);
playerList.Add(newPlayer);
return newPlayer;
}
}
return null;
}
private Player SearchPlayer(int id)
{
if (!playerList.Any()) return null;
foreach (Player listPlayer in playerList) {
if (listPlayer.id == id) {
return listPlayer;
}
}
return null;
}
}
}
|
apache-2.0
|
C#
|
8d7d13affaa26067862355d495f8def8666a5176
|
Fix #125
|
tfsaggregator/tfsaggregator-core
|
Extensions/InvalidValueFieldValueValidator.cs
|
Extensions/InvalidValueFieldValueValidator.cs
|
using System.Collections;
using Aggregator.Core.Context;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
namespace Aggregator.Core.Extensions
{
internal class InvalidValueFieldValueValidator : BaseFieldValueValidator
{
internal InvalidValueFieldValueValidator(IRuntimeContext context)
: base(context)
{
}
public override bool ValidateFieldValue(Field field, object value)
{
if (value != null && field.IsLimitedToAllowedValues)
{
bool valid = true;
bool hasAllowedvalues = field.HasAllowedValuesList;
#if TFS2015 || TFS2015u1
bool isIdentity = field.FieldDefinition.IsIdentity;
#else
bool isIdentity = false;
#endif
if (hasAllowedvalues && !isIdentity)
{
valid &= ((IList)field.FieldDefinition.AllowedValues).Contains(value);
}
#if TFS2015 || TFS2015u1
else if (hasAllowedvalues && isIdentity)
{
valid &= ((IList)field.FieldDefinition.IdentityFieldAllowedValues).Contains(value);
}
#endif
if (!valid)
{
this.Logger.FieldValidationFailedValueNotAllowed(
field.WorkItem.Id,
field.ReferenceName,
value);
return false;
}
}
return true;
}
}
}
|
using System.Collections;
using Aggregator.Core.Context;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
namespace Aggregator.Core.Extensions
{
internal class InvalidValueFieldValueValidator : BaseFieldValueValidator
{
internal InvalidValueFieldValueValidator(IRuntimeContext context)
: base(context)
{
}
public override bool ValidateFieldValue(Field field, object value)
{
if (value != null && field.IsLimitedToAllowedValues)
{
bool valid = true;
bool hasAllowedvalues = field.HasAllowedValuesList;
#if TFS2015 || TFS2015u1
bool isIdentity = field.FieldDefinition.IsIdentity;
#else
bool isIdentity = false;
#endif
if (hasAllowedvalues && !isIdentity)
{
valid &= ((IList)field.FieldDefinition.AllowedValues).Contains(value);
}
#if TFS2015 || TFS2015u1
else if (hasAllowedvalues && isIdentity)
{
valid &= ((IList)field.FieldDefinition.IdentityFieldAllowedValues).Contains(value);
}
#endif
if (valid)
{
this.Logger.FieldValidationFailedValueNotAllowed(
field.WorkItem.Id,
field.ReferenceName,
value);
return false;
}
}
return true;
}
}
}
|
apache-2.0
|
C#
|
eeff91de895f68c8217b3ceaad05f2f8ec66c062
|
Add return type support for SyncCtxSwitcher.NoContext.
|
StephenCleary/AsyncEx
|
src/Nito.AsyncEx.Tasks/SynchronizationContextSwitcher.cs
|
src/Nito.AsyncEx.Tasks/SynchronizationContextSwitcher.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Nito.AsyncEx
{
/// <summary>
/// Utility class for temporarily switching <see cref="SynchronizationContext"/> implementations.
/// </summary>
public sealed class SynchronizationContextSwitcher : Disposables.SingleDisposable<object>
{
/// <summary>
/// The previous <see cref="SynchronizationContext"/>.
/// </summary>
private readonly SynchronizationContext _oldContext;
/// <summary>
/// Initializes a new instance of the <see cref="SynchronizationContextSwitcher"/> class, installing the new <see cref="SynchronizationContext"/>.
/// </summary>
/// <param name="newContext">The new <see cref="SynchronizationContext"/>. This can be <c>null</c> to remove an existing <see cref="SynchronizationContext"/>.</param>
public SynchronizationContextSwitcher(SynchronizationContext newContext)
: base(new object())
{
_oldContext = SynchronizationContext.Current;
SynchronizationContext.SetSynchronizationContext(newContext);
}
/// <summary>
/// Restores the old <see cref="SynchronizationContext"/>.
/// </summary>
protected override void Dispose(object context)
{
SynchronizationContext.SetSynchronizationContext(_oldContext);
}
/// <summary>
/// Executes a synchronous delegate without the current <see cref="SynchronizationContext"/>. The current context is restored when this function returns.
/// </summary>
/// <param name="action">The delegate to execute.</param>
public static void NoContext(Action action)
{
using (new SynchronizationContextSwitcher(null))
action();
}
/// <summary>
/// Executes a synchronous or asynchronous delegate without the current <see cref="SynchronizationContext"/>. The current context is restored when this function synchronously returns.
/// </summary>
/// <param name="action">The delegate to execute.</param>
public static T NoContext<T>(Func<T> action)
{
using (new SynchronizationContextSwitcher(null))
return action();
}
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Nito.AsyncEx
{
/// <summary>
/// Utility class for temporarily switching <see cref="SynchronizationContext"/> implementations.
/// </summary>
public sealed class SynchronizationContextSwitcher : Disposables.SingleDisposable<object>
{
/// <summary>
/// The previous <see cref="SynchronizationContext"/>.
/// </summary>
private readonly SynchronizationContext _oldContext;
/// <summary>
/// Initializes a new instance of the <see cref="SynchronizationContextSwitcher"/> class, installing the new <see cref="SynchronizationContext"/>.
/// </summary>
/// <param name="newContext">The new <see cref="SynchronizationContext"/>. This can be <c>null</c> to remove an existing <see cref="SynchronizationContext"/>.</param>
public SynchronizationContextSwitcher(SynchronizationContext newContext)
: base(new object())
{
_oldContext = SynchronizationContext.Current;
SynchronizationContext.SetSynchronizationContext(newContext);
}
/// <summary>
/// Restores the old <see cref="SynchronizationContext"/>.
/// </summary>
protected override void Dispose(object context)
{
SynchronizationContext.SetSynchronizationContext(_oldContext);
}
/// <summary>
/// Executes a synchronous delegate without the current <see cref="SynchronizationContext"/>. The current context is restored when this function returns.
/// </summary>
/// <param name="action">The delegate to execute.</param>
public static void NoContext(Action action)
{
using (new SynchronizationContextSwitcher(null))
action();
}
/// <summary>
/// Executes an asynchronous delegate without the current <see cref="SynchronizationContext"/>. The current context is restored when this function returns its task.
/// </summary>
/// <param name="action">The delegate to execute.</param>
public static Task NoContextAsync(Func<Task> action)
{
using (new SynchronizationContextSwitcher(null))
return action();
}
}
}
|
mit
|
C#
|
d8c7d3cbf26286d08f152910c191a636cc451374
|
Fix web.config [ci skip]
|
giacomelli/DevAchievements,giacomelli/DevAchievements,giacomelli/DevAchievements,giacomelli/DevAchievements,giacomelli/DevAchievements
|
src/DevAchievements.WebApp.FunctionalTests/WebConfigTest.cs
|
src/DevAchievements.WebApp.FunctionalTests/WebConfigTest.cs
|
using NUnit.Framework;
using System;
using TestSharp;
using System.Linq;
using System.Web.Configuration;
namespace DevAchievements.WebApp.FunctionalTests
{
#if DEBUG
[TestFixture ()]
public class WebConfigTest
{
[Test ()]
public void Compilaton_Assemlies_HasAllAssemblies ()
{
var config = ConfigHelper.ReadConfig ("DevAchievements.WebApp");
var compilation = (CompilationSection) config.GetSection ("system.web/compilation");
Assert.IsTrue (compilation.Assemblies.Count >= 13);
}
}
#endif
}
|
using NUnit.Framework;
using System;
using TestSharp;
using System.Linq;
using System.Web.Configuration;
namespace DevAchievements.WebApp.FunctionalTests
{
[TestFixture ()]
public class WebConfigTest
{
[Test ()]
public void Compilaton_Assemlies_HasAllAssemblies ()
{
var config = ConfigHelper.ReadConfig ("DevAchievements.WebApp");
var compilation = (CompilationSection) config.GetSection ("system.web/compilation");
Assert.IsTrue (compilation.Assemblies.Count >= 13);
}
}
}
|
mit
|
C#
|
04831cf309736120d2854167e08930dd71332add
|
Save Cache
|
jacksoncougar/Moonfxsh
|
main.cs
|
main.cs
|
using Moonfish.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Moonfish.Compiler;
using System.ComponentModel;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Fasterflect;
using Moonfish.Cache;
using Moonfish.Guerilla;
using Moonfish.Guerilla.CodeDom;
using Moonfish.Guerilla.Tags;
using Moonfish.Tags;
namespace Moonfish
{
internal static class main
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main()
{
CacheStream map = new CacheStream(Path.Combine(Local.MapsDirectory, @"output1.map"));
map.Save();
//Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new Gizmo());
}
private static void Save(this CacheStream map)
{
var filename = Path.Combine(Local.MapsDirectory, @"temp.map");
FileStream copyStream = new FileStream(filename, FileMode.Create,
FileAccess.Write, FileShare.ReadWrite, 4 * 1024, FileOptions.SequentialScan);
using(copyStream)
using (map)
{
map.SaveTo(copyStream);
}
File.Delete(map.Name);
File.Move(filename, map.Name);
map = new CacheStream(map.Name);
}
}
}
|
using Moonfish.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Moonfish.Compiler;
using System.ComponentModel;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Fasterflect;
using Moonfish.Cache;
using Moonfish.Guerilla;
using Moonfish.Guerilla.CodeDom;
using Moonfish.Guerilla.Tags;
using Moonfish.Tags;
namespace Moonfish
{
internal static class main
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main()
{
using (var map = new Moonfish.Cache.CacheStream(Path.Combine(Local.MapsDirectory, @"output.map")))
using (var output = new FileStream(Path.Combine(Local.MapsDirectory, @"output1.map"), FileMode.Create,
FileAccess.Write, FileShare.ReadWrite, 4 * 1024, FileOptions.SequentialScan))
{
map.SaveTo(output);
}
return;
{
var test = new Moonfish.Cache.CacheStream(Path.Combine(Local.MapsDirectory, @"output.map"));
test.Seek(test.Index.GlobalsIdent);
var position = test.GetFilePosition();
var buggery = test.GetOwner(187923790);
//test.Deserialize(buggery.Identifier);
var localOffset = 187923790 - test.VirtualAddressToFileOffset(buggery.VirtualAddress);
foreach (var data in test.Index)
{
test.Deserialize(data.Identifier);
}
}
//Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new Gizmo());
}
}
}
|
mit
|
C#
|
49782ff24e2b187e9f88d16da3470b5fe88873cb
|
add JsonConverSettings
|
smbc-digital/iag-webapp,smbc-digital/iag-webapp,smbc-digital/iag-webapp
|
src/StockportWebapp/Controllers/HealthcheckController.cs
|
src/StockportWebapp/Controllers/HealthcheckController.cs
|
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using StockportWebapp.Services;
namespace StockportWebapp.Controllers
{
public class HealthcheckController : Controller
{
private readonly IHealthcheckService _healthCheckService;
public HealthcheckController(IHealthcheckService healthCheckService)
{
_healthCheckService = healthCheckService;
}
[ResponseCacheAttribute(NoStore = true)]
[Route("/_healthcheck")]
public async Task<IActionResult> Index()
{
var healthcheck = await _healthCheckService.Get();
var contractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy()
};
return Ok(JsonConvert.SerializeObject(healthcheck, new JsonSerializerSettings
{
ContractResolver = contractResolver
}));
}
}
}
|
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using StockportWebapp.Services;
namespace StockportWebapp.Controllers
{
public class HealthcheckController : Controller
{
private readonly IHealthcheckService _healthCheckService;
public HealthcheckController(IHealthcheckService healthCheckService)
{
_healthCheckService = healthCheckService;
}
[ResponseCacheAttribute(NoStore = true)]
[Route("/_healthcheck")]
public async Task<IActionResult> Index()
{
var healthcheck = await _healthCheckService.Get();
return Ok(JsonConvert.SerializeObject(healthcheck));
}
}
}
|
mit
|
C#
|
c90f99b45398786805e404f87a54de85fed1e253
|
Remove Obsolete attribute from undocumented members
|
tmds/Tmds.DBus
|
DBus.cs
|
DBus.cs
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using NDesk.DBus;
//namespace org.freedesktop.DBus
namespace org.freedesktop.DBus
{
/*
//what's this for?
public class DBusException : ApplicationException
{
}
*/
#if UNDOCUMENTED_IN_SPEC
//TODO: maybe this should be mapped to its CLR counterpart directly?
//not yet used
[Interface ("org.freedesktop.DBus.Error.InvalidArgs")]
public class InvalidArgsException : ApplicationException
{
}
#endif
[Flags]
public enum NameFlag : uint
{
None = 0,
AllowReplacement = 0x1,
ReplaceExisting = 0x2,
DoNotQueue = 0x4,
}
public enum RequestNameReply : uint
{
PrimaryOwner = 1,
InQueue,
Exists,
AlreadyOwner,
}
public enum ReleaseNameReply : uint
{
Released = 1,
NonExistent,
NotOwner,
}
public enum StartReply : uint
{
//The service was successfully started.
Success = 1,
//A connection already owns the given name.
AlreadyRunning,
}
public delegate void NameOwnerChangedHandler (string name, string old_owner, string new_owner);
public delegate void NameAcquiredHandler (string name);
public delegate void NameLostHandler (string name);
[Interface ("org.freedesktop.DBus.Peer")]
public interface Peer
{
void Ping ();
[return: Argument ("machine_uuid")]
string GetMachineId ();
}
[Interface ("org.freedesktop.DBus.Introspectable")]
public interface Introspectable
{
[return: Argument ("data")]
string Introspect ();
}
[Interface ("org.freedesktop.DBus.Properties")]
public interface Properties
{
//TODO: some kind of indexer mapping?
//object this [string propname] {get; set;}
[return: Argument ("value")]
object Get (string @interface, string propname);
//void Get (string @interface, string propname, out object value);
void Set (string @interface, string propname, object value);
}
[Interface ("org.freedesktop.DBus")]
public interface IBus : Introspectable
{
RequestNameReply RequestName (string name, NameFlag flags);
ReleaseNameReply ReleaseName (string name);
string Hello ();
string[] ListNames ();
string[] ListActivatableNames ();
bool NameHasOwner (string name);
event NameOwnerChangedHandler NameOwnerChanged;
event NameLostHandler NameLost;
event NameAcquiredHandler NameAcquired;
StartReply StartServiceByName (string name, uint flags);
string GetNameOwner (string name);
uint GetConnectionUnixUser (string connection_name);
void AddMatch (string rule);
void RemoveMatch (string rule);
//undocumented in spec
string[] ListQueuedOwners (string name);
uint GetConnectionUnixProcessID (string connection_name);
byte[] GetConnectionSELinuxSecurityContext (string connection_name);
void ReloadConfig ();
}
}
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using NDesk.DBus;
//namespace org.freedesktop.DBus
namespace org.freedesktop.DBus
{
/*
//what's this for?
public class DBusException : ApplicationException
{
}
*/
#if UNDOCUMENTED_IN_SPEC
//TODO: maybe this should be mapped to its CLR counterpart directly?
//not yet used
[Interface ("org.freedesktop.DBus.Error.InvalidArgs")]
public class InvalidArgsException : ApplicationException
{
}
#endif
[Flags]
public enum NameFlag : uint
{
None = 0,
AllowReplacement = 0x1,
ReplaceExisting = 0x2,
DoNotQueue = 0x4,
}
public enum RequestNameReply : uint
{
PrimaryOwner = 1,
InQueue,
Exists,
AlreadyOwner,
}
public enum ReleaseNameReply : uint
{
Released = 1,
NonExistent,
NotOwner,
}
public enum StartReply : uint
{
//The service was successfully started.
Success = 1,
//A connection already owns the given name.
AlreadyRunning,
}
public delegate void NameOwnerChangedHandler (string name, string old_owner, string new_owner);
public delegate void NameAcquiredHandler (string name);
public delegate void NameLostHandler (string name);
[Interface ("org.freedesktop.DBus.Peer")]
public interface Peer
{
void Ping ();
[return: Argument ("machine_uuid")]
string GetMachineId ();
}
[Interface ("org.freedesktop.DBus.Introspectable")]
public interface Introspectable
{
[return: Argument ("data")]
string Introspect ();
}
[Interface ("org.freedesktop.DBus.Properties")]
public interface Properties
{
//TODO: some kind of indexer mapping?
//object this [string propname] {get; set;}
[return: Argument ("value")]
object Get (string @interface, string propname);
//void Get (string @interface, string propname, out object value);
void Set (string @interface, string propname, object value);
}
[Interface ("org.freedesktop.DBus")]
public interface IBus : Introspectable
{
RequestNameReply RequestName (string name, NameFlag flags);
ReleaseNameReply ReleaseName (string name);
string Hello ();
string[] ListNames ();
string[] ListActivatableNames ();
bool NameHasOwner (string name);
event NameOwnerChangedHandler NameOwnerChanged;
event NameLostHandler NameLost;
event NameAcquiredHandler NameAcquired;
StartReply StartServiceByName (string name, uint flags);
string GetNameOwner (string name);
uint GetConnectionUnixUser (string connection_name);
void AddMatch (string rule);
void RemoveMatch (string rule);
//undocumented in spec
[Obsolete ("Undocumented in spec")]
string[] ListQueuedOwners (string name);
[Obsolete ("Undocumented in spec")]
uint GetConnectionUnixProcessID (string connection_name);
[Obsolete ("Undocumented in spec")]
byte[] GetConnectionSELinuxSecurityContext (string connection_name);
[Obsolete ("Undocumented in spec")]
void ReloadConfig ();
}
}
|
mit
|
C#
|
43475b8bc04240d51f38446416127f6e299ba699
|
Add new ListActivatableNames() to org.freedesktop.DBus
|
tmds/Tmds.DBus
|
DBus.cs
|
DBus.cs
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using NDesk.DBus;
//namespace org.freedesktop.DBus
namespace org.freedesktop.DBus
{
/*
//what's this for?
public class DBusException : ApplicationException
{
}
*/
#if UNDOCUMENTED_IN_SPEC
//TODO: maybe this should be mapped to its CLR counterpart directly?
//not yet used
[Interface ("org.freedesktop.DBus.Error.InvalidArgs")]
public class InvalidArgsException : ApplicationException
{
}
#endif
[Flags]
public enum NameFlag : uint
{
None = 0,
AllowReplacement = 0x1,
ReplaceExisting = 0x2,
DoNotQueue = 0x4,
}
public enum NameReply : uint
{
PrimaryOwner = 1,
InQueue,
Exists,
AlreadyOwner,
}
public enum ReleaseNameReply : uint
{
Released = 1,
NonExistent,
NotOwner,
}
public enum StartReply : uint
{
//The service was successfully started.
Success = 1,
//A connection already owns the given name.
AlreadyRunning,
}
public delegate void NameOwnerChangedHandler (string name, string old_owner, string new_owner);
public delegate void NameAcquiredHandler (string name);
public delegate void NameLostHandler (string name);
[Interface ("org.freedesktop.DBus.Peer")]
public interface Peer
{
void Ping ();
[return: Argument ("machine_uuid")]
string GetMachineId ();
}
[Interface ("org.freedesktop.DBus.Introspectable")]
public interface Introspectable
{
[return: Argument ("data")]
string Introspect ();
}
[Interface ("org.freedesktop.DBus.Properties")]
public interface Properties
{
//TODO: some kind of indexer mapping?
//object this [string propname] {get; set;}
[return: Argument ("value")]
object Get (string @interface, string propname);
//void Get (string @interface, string propname, out object value);
void Set (string @interface, string propname, object value);
}
[Interface ("org.freedesktop.DBus")]
public interface IBus : Introspectable
{
NameReply RequestName (string name, NameFlag flags);
ReleaseNameReply ReleaseName (string name);
string Hello ();
string[] ListNames ();
string[] ListActivatableNames ();
bool NameHasOwner (string name);
event NameOwnerChangedHandler NameOwnerChanged;
event NameLostHandler NameLost;
event NameAcquiredHandler NameAcquired;
StartReply StartServiceByName (string name, uint flags);
string GetNameOwner (string name);
uint GetConnectionUnixUser (string connection_name);
void AddMatch (string rule);
void RemoveMatch (string rule);
#if UNDOCUMENTED_IN_SPEC
//undocumented in spec
//there are more of these
void ReloadConfig ();
#endif
}
}
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using NDesk.DBus;
//namespace org.freedesktop.DBus
namespace org.freedesktop.DBus
{
/*
//what's this for?
public class DBusException : ApplicationException
{
}
*/
#if UNDOCUMENTED_IN_SPEC
//TODO: maybe this should be mapped to its CLR counterpart directly?
//not yet used
[Interface ("org.freedesktop.DBus.Error.InvalidArgs")]
public class InvalidArgsException : ApplicationException
{
}
#endif
[Flags]
public enum NameFlag : uint
{
None = 0,
AllowReplacement = 0x1,
ReplaceExisting = 0x2,
DoNotQueue = 0x4,
}
public enum NameReply : uint
{
PrimaryOwner = 1,
InQueue,
Exists,
AlreadyOwner,
}
public enum ReleaseNameReply : uint
{
Released = 1,
NonExistent,
NotOwner,
}
public enum StartReply : uint
{
//The service was successfully started.
Success = 1,
//A connection already owns the given name.
AlreadyRunning,
}
public delegate void NameOwnerChangedHandler (string name, string old_owner, string new_owner);
public delegate void NameAcquiredHandler (string name);
public delegate void NameLostHandler (string name);
[Interface ("org.freedesktop.DBus.Peer")]
public interface Peer
{
void Ping ();
[return: Argument ("machine_uuid")]
string GetMachineId ();
}
[Interface ("org.freedesktop.DBus.Introspectable")]
public interface Introspectable
{
[return: Argument ("data")]
string Introspect ();
}
[Interface ("org.freedesktop.DBus.Properties")]
public interface Properties
{
//TODO: some kind of indexer mapping?
//object this [string propname] {get; set;}
[return: Argument ("value")]
object Get (string @interface, string propname);
//void Get (string @interface, string propname, out object value);
void Set (string @interface, string propname, object value);
}
[Interface ("org.freedesktop.DBus")]
public interface IBus : Introspectable
{
NameReply RequestName (string name, NameFlag flags);
ReleaseNameReply ReleaseName (string name);
string Hello ();
string[] ListNames ();
bool NameHasOwner (string name);
event NameOwnerChangedHandler NameOwnerChanged;
event NameLostHandler NameLost;
event NameAcquiredHandler NameAcquired;
StartReply StartServiceByName (string name, uint flags);
string GetNameOwner (string name);
uint GetConnectionUnixUser (string connection_name);
void AddMatch (string rule);
void RemoveMatch (string rule);
#if UNDOCUMENTED_IN_SPEC
//undocumented in spec
//there are more of these
void ReloadConfig ();
#endif
}
}
|
mit
|
C#
|
08250621e450c571b848d7e5ca311f14faa55d0b
|
Add flag serialization marker to CollisionGroup for engine bitmasks
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14
|
Content.Shared/Physics/CollisionGroup.cs
|
Content.Shared/Physics/CollisionGroup.cs
|
using System;
using JetBrains.Annotations;
using Robust.Shared.Map;
using RobustPhysics = Robust.Shared.Physics;
using Robust.Shared.Serialization;
namespace Content.Shared.Physics
{
/// <summary>
/// Defined collision groups for the physics system.
/// </summary>
[Flags, PublicAPI]
[FlagsFor(typeof(RobustPhysics.CollisionLayer)), FlagsFor(typeof(RobustPhysics.CollisionMask))]
public enum CollisionGroup
{
None = 0,
Opaque = 1 << 0, // 1 Blocks light, for lasers
Impassable = 1 << 1, // 2 Walls, objects impassable by any means
MobImpassable = 1 << 2, // 4 Mobs, players, crabs, etc
VaultImpassable = 1 << 3, // 8 Things that cannot be jumped over, not half walls or tables
SmallImpassable = 1 << 4, // 16 Things a smaller object - a cat, a crab - can't go through - a wall, but not a computer terminal or a table
Clickable = 1 << 5, // 32 Temporary "dummy" layer to ensure that objects can still be clicked even if they don't collide with anything (you can't interact with objects that have no layer, including items)
MapGrid = MapGridHelpers.CollisionGroup, // Map grids, like shuttles. This is the actual grid itself, not the walls or other entities connected to the grid.
// 32 possible groups
MobMask = Impassable | MobImpassable | VaultImpassable | SmallImpassable,
AllMask = -1,
}
}
|
using System;
using JetBrains.Annotations;
using Robust.Shared.Map;
namespace Content.Shared.Physics
{
/// <summary>
/// Defined collision groups for the physics system.
/// </summary>
[Flags, PublicAPI]
public enum CollisionGroup
{
None = 0,
Opaque = 1 << 0, // 1 Blocks light, for lasers
Impassable = 1 << 1, // 2 Walls, objects impassable by any means
MobImpassable = 1 << 2, // 4 Mobs, players, crabs, etc
VaultImpassable = 1 << 3, // 8 Things that cannot be jumped over, not half walls or tables
SmallImpassable = 1 << 4, // 16 Things a smaller object - a cat, a crab - can't go through - a wall, but not a computer terminal or a table
Clickable = 1 << 5, // 32 Temporary "dummy" layer to ensure that objects can still be clicked even if they don't collide with anything (you can't interact with objects that have no layer, including items)
MapGrid = MapGridHelpers.CollisionGroup, // Map grids, like shuttles. This is the actual grid itself, not the walls or other entities connected to the grid.
// 32 possible groups
MobMask = Impassable | MobImpassable | VaultImpassable | SmallImpassable,
AllMask = -1,
}
}
|
mit
|
C#
|
934d41fc92e122ecdfc2bb22e254aca1620809d3
|
Maintain focus on the text editor after saving.
|
mthamil/PlantUMLStudio,mthamil/PlantUMLStudio
|
PlantUmlEditor/View/DiagramEditorView.xaml.cs
|
PlantUmlEditor/View/DiagramEditorView.xaml.cs
|
using System;
using System.Windows.Controls;
namespace PlantUmlEditor.View
{
public partial class DiagramEditorView : UserControl
{
public DiagramEditorView()
{
InitializeComponent();
ContentEditor.IsEnabledChanged += ContentEditor_IsEnabledChanged;
}
void ContentEditor_IsEnabledChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
{
// Maintain focus on the text editor.
if ((bool)e.NewValue)
Dispatcher.BeginInvoke(new Action(() => ContentEditor.Focus()));
}
}
}
|
using System.Windows.Controls;
namespace PlantUmlEditor.View
{
public partial class DiagramEditorView : UserControl
{
public DiagramEditorView()
{
InitializeComponent();
}
}
}
|
apache-2.0
|
C#
|
606e53c6309a14c14543730d537002c47e4ace31
|
Remove unused properties
|
sebastieno/sebastienollivier.fr,sebastieno/sebastienollivier.fr
|
Blog.Domain/Queries/GetDraftQuery.cs
|
Blog.Domain/Queries/GetDraftQuery.cs
|
using Blog.Data;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace Blog.Domain.Queries
{
public class GetDraftQuery
{
private IBlogContext context;
public GetDraftQuery(IBlogContext context)
{
this.context = context;
}
public async Task<Post> ExecuteAsync(int id, string postUrl)
{
return await context.Posts.Include(p => p.Category)
.Where(p => !p.PublicationDate.HasValue)
.FirstOrDefaultAsync(p => p.Id == p.Id && p.Url.ToLower() == postUrl.ToLower());
}
}
}
|
using Blog.Data;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace Blog.Domain.Queries
{
public class GetDraftQuery
{
private IBlogContext context;
private readonly int id;
private readonly string postUrl;
public GetDraftQuery(IBlogContext context)
{
this.context = context;
}
public async Task<Post> ExecuteAsync(int id, string postUrl)
{
return await context.Posts.Include(p => p.Category)
.Where(p => !p.PublicationDate.HasValue)
.FirstOrDefaultAsync(p => p.Id == p.Id && p.Url.ToLower() == postUrl.ToLower());
}
}
}
|
mit
|
C#
|
8b762e05b247ffe8294b0752a9bbfb89ef63fb23
|
Update version
|
Fody/Equals
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyTitle("Fody.Equals")]
[assembly: AssemblyProduct("Fody.Equals")]
[assembly: AssemblyVersion("1.4.10")]
[assembly: AssemblyFileVersion("1.4.10")]
|
using System.Reflection;
[assembly: AssemblyTitle("Fody.Equals")]
[assembly: AssemblyProduct("Fody.Equals")]
[assembly: AssemblyVersion("1.4.9")]
[assembly: AssemblyFileVersion("1.4.9")]
|
mit
|
C#
|
5bbcf3a0979fe91ce759c062f5415e6cb21d3d8e
|
add option to pause on exploitable exceptions
|
carterjones/nouzuru,carterjones/nouzuru
|
Nouzuru/DebuggerSettings.cs
|
Nouzuru/DebuggerSettings.cs
|
namespace Nouzuru
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class DebuggerSettings
{
#region Properties
public bool PauseOnSingleStep { get; set; }
public bool PauseOnAccessViolation { get; set; }
public bool PauseOnArrayBoundsExceeded { get; set; }
public bool PauseOnBreakpoint { get; set; }
public bool PauseOnDatatypeMisalignment { get; set; }
public bool PauseOnFltDenormalOperand { get; set; }
public bool PauseOnFltDivideByZero { get; set; }
public bool PauseOnFltInexactResult { get; set; }
public bool PauseOnFltInvalidOperation { get; set; }
public bool PauseOnFltOverflow { get; set; }
public bool PauseOnFltStackCheck { get; set; }
public bool PauseOnFltUnderflow { get; set; }
public bool PauseOnGuardPage { get; set; }
public bool PauseOnIllegalInstruction { get; set; }
public bool PauseOnInPageError { get; set; }
public bool PauseOnIntDivideByZero { get; set; }
public bool PauseOnIntOVerflow { get; set; }
public bool PauseOnInvalidDisposition { get; set; }
public bool PauseOnNoncontinuableException { get; set; }
public bool PauseOnPrivInstruction { get; set; }
public bool PauseOnStackOverflow { get; set; }
public bool PauseOnUnhandledDebugException { get; set; }
/// <summary>
/// Gets or sets other flags that determine whether or not the debugger will pause on
/// exploitable exceptions.
/// </summary>
public bool PauseOnExploitableException
{
get
{
return
this.PauseOnGuardPage &&
this.PauseOnAccessViolation &&
this.PauseOnIntOVerflow &&
this.PauseOnStackOverflow;
}
set
{
this.PauseOnGuardPage = true;
this.PauseOnAccessViolation = true;
this.PauseOnIntOVerflow = true;
this.PauseOnStackOverflow = true;
}
}
#endregion
}
}
|
namespace Nouzuru
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class DebuggerSettings
{
#region Properties
public bool PauseOnSingleStep { get; set; }
public bool PauseOnAccessViolation { get; set; }
public bool PauseOnArrayBoundsExceeded { get; set; }
public bool PauseOnBreakpoint { get; set; }
public bool PauseOnDatatypeMisalignment { get; set; }
public bool PauseOnFltDenormalOperand { get; set; }
public bool PauseOnFltDivideByZero { get; set; }
public bool PauseOnFltInexactResult { get; set; }
public bool PauseOnFltInvalidOperation { get; set; }
public bool PauseOnFltOverflow { get; set; }
public bool PauseOnFltStackCheck { get; set; }
public bool PauseOnFltUnderflow { get; set; }
public bool PauseOnGuardPage { get; set; }
public bool PauseOnIllegalInstruction { get; set; }
public bool PauseOnInPageError { get; set; }
public bool PauseOnIntDivideByZero { get; set; }
public bool PauseOnIntOVerflow { get; set; }
public bool PauseOnInvalidDisposition { get; set; }
public bool PauseOnNoncontinuableException { get; set; }
public bool PauseOnPrivInstruction { get; set; }
public bool PauseOnStackOverflow { get; set; }
public bool PauseOnUnhandledDebugException { get; set; }
#endregion
}
}
|
bsd-2-clause
|
C#
|
74f59987e63577a70d10456ad8a753fb46d895fa
|
Fix comment
|
Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
src/Core2D.UI/Behaviors/DocumentTextBindingBehavior.cs
|
src/Core2D.UI/Behaviors/DocumentTextBindingBehavior.cs
|
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Xaml.Interactivity;
using AvaloniaEdit;
namespace Core2D.UI.Behaviors
{
/// <summary>
/// Binds to a document text.
/// </summary>
public class DocumentTextBindingBehavior : Behavior<TextEditor>
{
private TextEditor _textEditor = null;
/// <summary>
/// Define <see cref="Text"/> property.
/// </summary>
public static readonly StyledProperty<string> TextProperty =
AvaloniaProperty.Register<DocumentTextBindingBehavior, string>(nameof(Text));
/// <summary>
/// Gets or sets text editor text.
/// </summary>
public string Text
{
get => GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
/// <inheritdoc/>
protected override void OnAttached()
{
base.OnAttached();
if (AssociatedObject is TextEditor textEditor)
{
_textEditor = textEditor;
_textEditor.TextChanged += TextChanged;
this.GetObservable(TextProperty).Subscribe(TextPropertyChanged);
}
}
/// <inheritdoc/>
protected override void OnDetaching()
{
base.OnDetaching();
if (_textEditor != null)
{
_textEditor.TextChanged -= TextChanged;
}
}
private void TextChanged(object sender, EventArgs eventArgs)
{
if (_textEditor != null && _textEditor.Document != null)
{
Text = _textEditor.Document.Text;
}
}
private void TextPropertyChanged(string text)
{
if (_textEditor != null && _textEditor.Document != null && text != null)
{
var caretOffset = _textEditor.CaretOffset;
_textEditor.Document.Text = text;
_textEditor.CaretOffset = caretOffset;
}
}
}
}
|
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Xaml.Interactivity;
using AvaloniaEdit;
namespace Core2D.UI.Behaviors
{
/// <summary>
/// Binds to a document text.
/// </summary>
public class DocumentTextBindingBehavior : Behavior<TextEditor>
{
private TextEditor _textEditor = null;
/// <summary>
/// Define <see cref="Context"/> property.
/// </summary>
public static readonly StyledProperty<string> TextProperty =
AvaloniaProperty.Register<DocumentTextBindingBehavior, string>(nameof(Text));
/// <summary>
/// Gets or sets text editor text.
/// </summary>
public string Text
{
get => GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
/// <inheritdoc/>
protected override void OnAttached()
{
base.OnAttached();
if (AssociatedObject is TextEditor textEditor)
{
_textEditor = textEditor;
_textEditor.TextChanged += TextChanged;
this.GetObservable(TextProperty).Subscribe(TextPropertyChanged);
}
}
/// <inheritdoc/>
protected override void OnDetaching()
{
base.OnDetaching();
if (_textEditor != null)
{
_textEditor.TextChanged -= TextChanged;
}
}
private void TextChanged(object sender, EventArgs eventArgs)
{
if (_textEditor != null && _textEditor.Document != null)
{
Text = _textEditor.Document.Text;
}
}
private void TextPropertyChanged(string text)
{
if (_textEditor != null && _textEditor.Document != null && text != null)
{
var caretOffset = _textEditor.CaretOffset;
_textEditor.Document.Text = text;
_textEditor.CaretOffset = caretOffset;
}
}
}
}
|
mit
|
C#
|
803648b1d631523ec1464f27633d342f0a837ee2
|
fix mvc template
|
thepirat000/Audit.NET,thepirat000/Audit.NET,thepirat000/Audit.NET
|
templates/MVC/content/Audit.Mvc.Template/AuditStartup.cs
|
templates/MVC/content/Audit.Mvc.Template/AuditStartup.cs
|
using Audit.Core;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Audit.Mvc;
namespace Audit.Mvc.Template
{
public static class AuditStartup
{
private const string CorrelationIdField = "CorrelationId";
/// <summary>
/// Add the global audit filter to the MVC pipeline
/// </summary>
public static MvcOptions AddAudit(this MvcOptions mvcOptions)
{
mvcOptions.Filters.Add(new AuditAttribute()
{
EventTypeName = "MVC:{verb}:{controller}:{action}",
IncludeHeaders = true,
IncludeModel = true,
IncludeRequestBody = true,
IncludeResponseBody = true
});
return mvcOptions;
}
/// <summary>
/// Global Audit configuration
/// </summary>
public static IServiceCollection ConfigureAudit(this IServiceCollection serviceCollection)
{
// TODO: Configure the audit data provider and options. For more info see https://github.com/thepirat000/Audit.NET#data-providers.
Audit.Core.Configuration.Setup()
.UseFileLogProvider(_ => _
.Directory(@"C:\Temp")
.FilenameBuilder(ev =>
$"{ev.StartDate:yyyyMMddHHmmssffff}_{ev.CustomFields[CorrelationIdField]?.ToString().Replace(':', '_')}.json"))
.WithCreationPolicy(EventCreationPolicy.InsertOnEnd);
return serviceCollection;
}
/// <summary>
/// Add a RequestId so the audit events can be grouped per request
/// </summary>
public static void UseAuditCorrelationId(this IApplicationBuilder app, IHttpContextAccessor ctxAccesor)
{
Configuration.AddCustomAction(ActionType.OnScopeCreated, scope =>
{
var httpContext = ctxAccesor.HttpContext;
scope.Event.CustomFields[CorrelationIdField] = httpContext.TraceIdentifier;
});
}
}
}
|
using Audit.Core;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
namespace Audit.Mvc.Template
{
public static class AuditStartup
{
private const string CorrelationIdField = "CorrelationId";
/// <summary>
/// Add the global audit filter to the MVC pipeline
/// </summary>
public static MvcOptions AddAudit(this MvcOptions mvcOptions)
{
mvcOptions.Filters.Add(new AuditAttribute()
{
EventTypeName = "MVC:{verb}:{controller}:{action}",
IncludeHeaders = true,
IncludeModel = true,
IncludeRequestBody = true,
IncludeResponseBody = true
});
return mvcOptions;
}
/// <summary>
/// Global Audit configuration
/// </summary>
public static IServiceCollection ConfigureAudit(this IServiceCollection serviceCollection)
{
// TODO: Configure the audit data provider and options. For more info see https://github.com/thepirat000/Audit.NET#data-providers.
Audit.Core.Configuration.Setup()
.UseFileLogProvider(_ => _
.Directory(@"C:\Temp")
.FilenameBuilder(ev =>
$"{ev.StartDate:yyyyMMddHHmmssffff}_{ev.CustomFields[CorrelationIdField]?.ToString().Replace(':', '_')}.json"))
.WithCreationPolicy(EventCreationPolicy.InsertOnEnd);
return serviceCollection;
}
/// <summary>
/// Add a RequestId so the audit events can be grouped per request
/// </summary>
public static void UseAuditCorrelationId(this IApplicationBuilder app, IHttpContextAccessor ctxAccesor)
{
Configuration.AddCustomAction(ActionType.OnScopeCreated, scope =>
{
var httpContext = ctxAccesor.HttpContext;
scope.Event.CustomFields[CorrelationIdField] = httpContext.TraceIdentifier;
});
}
}
}
|
mit
|
C#
|
620f55106399ad96f62517659d35a68fa27f8203
|
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 © Damnae 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.58.*")]
|
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 © Damnae 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.57.*")]
|
mit
|
C#
|
a457b3d8484f3bbcceef453e29c89beb861eec44
|
Fix bug: "Copy" button don't show in TextView during saving
|
AceSkiffer/SharpGraphEditor
|
src/SharpGraphEditor/ViewModels/TextViewerViewModel.cs
|
src/SharpGraphEditor/ViewModels/TextViewerViewModel.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Caliburn.Micro;
namespace SharpGraphEditor.ViewModels
{
public class TextViewerViewModel : PropertyChangedBase
{
private string _text;
private bool _canCopy;
private bool _canCancel;
private bool _isReadOnly;
public TextViewerViewModel(string text, bool canCopy, bool canCancel, bool isReadOnly)
{
Text = text;
CanCopy = canCopy;
CanCancel = canCancel;
IsReadOnly = isReadOnly;
}
public void Ok(IClose closableWindow)
{
closableWindow.TryClose(true);
}
public void Cancel(IClose closableWindow)
{
closableWindow.TryClose(false);
}
public void CopyText()
{
Clipboard.SetText(Text);
}
public string Text
{
get { return _text; }
set
{
_text = value;
NotifyOfPropertyChange(() => Text);
}
}
public bool CanCopy
{
get { return _canCopy; }
set
{
_canCopy = value;
NotifyOfPropertyChange(() => CanCopy);
}
}
public bool CanCancel
{
get { return _canCancel; }
set
{
_canCancel = value;
NotifyOfPropertyChange(() => CanCancel);
}
}
public bool IsReadOnly
{
get { return _isReadOnly; }
set
{
_isReadOnly = value;
NotifyOfPropertyChange(() => IsReadOnly);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Caliburn.Micro;
namespace SharpGraphEditor.ViewModels
{
public class TextViewerViewModel : PropertyChangedBase
{
private string _text;
private bool _canCopy;
private bool _canCancel;
private bool _isReadOnly;
public TextViewerViewModel(string text, bool canCopy, bool canCancel, bool isReadOnly)
{
Text = text;
CanCopy = CanCopy;
CanCancel = canCancel;
IsReadOnly = isReadOnly;
}
public void Ok(IClose closableWindow)
{
closableWindow.TryClose(true);
}
public void Cancel(IClose closableWindow)
{
closableWindow.TryClose(false);
}
public void CopyText()
{
Clipboard.SetText(Text);
}
public string Text
{
get { return _text; }
set
{
_text = value;
NotifyOfPropertyChange(() => Text);
}
}
public bool CanCopy
{
get { return _canCopy; }
set
{
_canCopy = value;
NotifyOfPropertyChange(() => CanCopy);
}
}
public bool CanCancel
{
get { return _canCancel; }
set
{
_canCancel = value;
NotifyOfPropertyChange(() => CanCancel);
}
}
public bool IsReadOnly
{
get { return _isReadOnly; }
set
{
_isReadOnly = value;
NotifyOfPropertyChange(() => IsReadOnly);
}
}
}
}
|
apache-2.0
|
C#
|
ff24a93335a9bd297a9b1b41221d7d83a54cd3f0
|
修改超时时间 捕捉超时异常
|
IndieSociety/primer
|
Sample/SimpleClient/Main.cs
|
Sample/SimpleClient/Main.cs
|
using System;
namespace Primer
{
public class SimpleClient
{
static Session s;
public static void Load()
{
Console.WriteLine("load");
var task = Session<UTF8StringRequest>.Connect(new Session.Settings("localhost", 12306), 3000);
try
{
task.Wait();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
s = task.Result;
UTF8StringRequest request = new UTF8StringRequest();
Console.OnInput += (text) =>
{
request.Data = text;
request.Send(s);
s.Flush();
};
}
public static void Unload()
{
Console.WriteLine("unload");
s.Close();
}
}
}
|
using System;
namespace Primer
{
public class SimpleClient
{
static Session s;
public static void Load()
{
Console.WriteLine("load");
var task = Session<UTF8StringRequest>.Connect(new Session.Settings("localhost", 12306), 0);
task.Wait();
s = task.Result;
UTF8StringRequest request = new UTF8StringRequest();
Console.OnInput += (text) =>
{
request.Data = text;
request.Send(s);
s.Flush();
};
}
public static void Unload()
{
Console.WriteLine("unload");
s.Close();
}
}
}
|
mit
|
C#
|
9d583a809a16b31cb1041e6a41ec4911e3114512
|
change port to 3002
|
MCeddy/IoT-core
|
IoT-Core/Program.cs
|
IoT-Core/Program.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
namespace IoT_Core
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls("http://localhost:3002/")
.UseApplicationInsights()
.Build();
host.Run();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
namespace IoT_Core
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();
host.Run();
}
}
}
|
mit
|
C#
|
22dfb8166b285feb5c808a7e3a2346e67dd96e0c
|
indent away
|
tugberkugurlu/BonVoyage,tugberkugurlu/BonVoyage
|
samples/Playground/Program.cs
|
samples/Playground/Program.cs
|
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using BonVoyage;
using BonVoyage.Models;
namespace Playground
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("ClientId:");
var clientId = Console.ReadLine();
Console.WriteLine("ClientSecret:");
var clientSecret = Console.ReadLine();
using (var bonVoyageContext = new BonVoyageContext())
using (var foursquareContext = bonVoyageContext.CreateUserlessFoursquareContext(new UserlessAccessSettings(clientId, clientSecret)))
{
var categories = foursquareContext.Categories.Get().Result;
PrintCategory(categories, 0);
}
}
private static void PrintCategory(IReadOnlyCollection<VenueCategory> categories, int indentCount)
{
if (categories.Any())
{
foreach (var venueCategory in categories)
{
for (int i = 0; i < indentCount; i++)
{
Console.Write("\t");
}
Console.Write("{0}: {1}", venueCategory.Id, venueCategory.Name);
Console.Write(Environment.NewLine);
PrintCategory(new ReadOnlyCollection<VenueCategory>(venueCategory.Categories.ToList()), indentCount + 1);
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using BonVoyage;
using BonVoyage.Models;
namespace Playground
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("ClientId:");
var clientId = Console.ReadLine();
Console.WriteLine("ClientSecret:");
var clientSecret = Console.ReadLine();
using (var bonVoyageContext = new BonVoyageContext())
using (var foursquareContext = bonVoyageContext.CreateUserlessFoursquareContext(new UserlessAccessSettings(clientId, clientSecret)))
{
var categories = foursquareContext.Categories.Get().Result;
PrintCategory(categories);
}
}
private static void PrintCategory(IReadOnlyCollection<VenueCategory> categories)
{
if (categories.Any())
{
foreach (var venueCategory in categories)
{
Console.WriteLine("{0}: {1}", venueCategory.Id, venueCategory.Name);
PrintCategory(new ReadOnlyCollection<VenueCategory>(venueCategory.Categories.ToList()));
}
}
}
}
}
|
mit
|
C#
|
647e2c297cb91288df121bf4577a792537ce4012
|
Fix iOS app entry for raw keyboard input
|
EVAST9919/osu,ZLima12/osu,UselessToucan/osu,2yangk23/osu,ppy/osu,johnneijzen/osu,smoogipoo/osu,ppy/osu,ppy/osu,peppy/osu,2yangk23/osu,peppy/osu-new,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ZLima12/osu,smoogipooo/osu,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu
|
osu.iOS/Application.cs
|
osu.iOS/Application.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 UIKit;
namespace osu.iOS
{
public class Application
{
public static void Main(string[] args)
{
UIApplication.Main(args, "GameUIApplication", "AppDelegate");
}
}
}
|
// 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 UIKit;
namespace osu.iOS
{
public class Application
{
public static void Main(string[] args)
{
UIApplication.Main(args, null, "AppDelegate");
}
}
}
|
mit
|
C#
|
b6a0db1c7180a3e176e7bff8faf44c1be645affb
|
Update SetTrueTypeFontsFolder.cs
|
asposewords/Aspose_Words_NET,asposewords/Aspose_Words_NET,aspose-words/Aspose.Words-for-.NET,asposewords/Aspose_Words_NET,aspose-words/Aspose.Words-for-.NET,aspose-words/Aspose.Words-for-.NET,asposewords/Aspose_Words_NET,aspose-words/Aspose.Words-for-.NET
|
Examples/CSharp/Rendering-Printing/SetTrueTypeFontsFolder.cs
|
Examples/CSharp/Rendering-Printing/SetTrueTypeFontsFolder.cs
|
using System;
using System.IO;
using System.Reflection;
using Aspose.Words.Fonts;
using Aspose.Words;
using Aspose.Words.Saving;
namespace Aspose.Words.Examples.CSharp.Rendering_and_Printing
{
class SetTrueTypeFontsFolder
{
public static void Run()
{
// ExStart:SetTrueTypeFontsFolder
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_RenderingAndPrinting();
Document doc = new Document(dataDir + "Rendering.doc");
FontSettings FontSettings = new FontSettings();
// Note that this setting will override any default font sources that are being searched by default. Now only these folders will be searched for
// Fonts when rendering or embedding fonts. To add an extra font source while keeping system font sources then use both FontSettings.GetFontSources and
// FontSettings.SetFontSources instead.
FontSettings.SetFontsFolder(@"C:\MyFonts\", false);
// Set font settings
doc.FontSettings = FontSettings;
dataDir = dataDir + "Rendering.SetFontsFolder_out.pdf";
doc.Save(dataDir);
// ExEnd:SetTrueTypeFontsFolder
Console.WriteLine("\nTrue type fonts folder setup successfully.\nFile saved at " + dataDir);
}
}
}
|
using System;
using System.IO;
using System.Reflection;
using Aspose.Words.Fonts;
using Aspose.Words;
using Aspose.Words.Saving;
namespace Aspose.Words.Examples.CSharp.Rendering_and_Printing
{
class SetTrueTypeFontsFolder
{
public static void Run()
{
// ExStart:SetTrueTypeFontsFolder
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_RenderingAndPrinting();
Document doc = new Document(dataDir + "Rendering.doc");
FontSettings FontSettings = new FontSettings();
// Note that this setting will override any default font sources that are being searched by default. Now only these folders will be searched for
// Fonts when rendering or embedding fonts. To add an extra font source while keeping system font sources then use both FontSettings.GetFontSources and
// FontSettings.SetFontSources instead.
FontSettings.SetFontsFolder(@"C:MyFonts\", false);
// Set font settings
doc.FontSettings = FontSettings;
dataDir = dataDir + "Rendering.SetFontsFolder_out.pdf";
doc.Save(dataDir);
// ExEnd:SetTrueTypeFontsFolder
Console.WriteLine("\nTrue type fonts folder setup successfully.\nFile saved at " + dataDir);
}
}
}
|
mit
|
C#
|
c30f91aed75f56b7ea3bc4e6b2667fd0129b06c9
|
add enum test
|
dimaaan/NOpt
|
NOpt.Test/EnumTest.cs
|
NOpt.Test/EnumTest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace NOpt.Test
{
// TODO test with flags and integers
public class EnumTest
{
public class ValueEnumTest
{
public class Options
{
public enum Actions
{
READ, WRITE
}
[Value(0)]
public readonly Actions actions;
}
[Fact]
public void check()
{
Options opt = NOpt.Parse<Options>(new string[] { "WRITE" });
Assert.Equal(Options.Actions.WRITE, opt.actions);
Assert.Throws<FormatException>(() => NOpt.Parse<Options>(new string[] { "QQQ" }));
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace NOpt.Test
{
// TODO test with flags and integers
public class EnumTest
{
public class ValueEnumTest
{
public class Options
{
public enum Actions
{
READ, WRITE
}
[Value(0)]
public readonly Actions actions;
}
[Fact]
public void check()
{
Options opt = NOpt.Parse<Options>(new string[] { "WRITE" });
Assert.Equal(Options.Actions.WRITE, opt.actions);
}
}
}
}
|
mit
|
C#
|
cc550faef91c77c668cd619a5b475c94002c7b63
|
Clarify HelpCommand description
|
appharbor/appharbor-cli
|
src/AppHarbor/Commands/HelpCommand.cs
|
src/AppHarbor/Commands/HelpCommand.cs
|
using System;
using System.Collections.Generic;
namespace AppHarbor.Commands
{
[CommandHelp("Display help summary")]
public class HelpCommand : ICommand
{
private readonly IEnumerable<Type> _commandTypes;
public HelpCommand(IEnumerable<Type> commandTypes)
{
_commandTypes = commandTypes;
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
|
using System;
using System.Collections.Generic;
namespace AppHarbor.Commands
{
[CommandHelp("Display help summary or help for a specific command", "[COMMAND]")]
public class HelpCommand : ICommand
{
private readonly IEnumerable<Type> _commandTypes;
public HelpCommand(IEnumerable<Type> commandTypes)
{
_commandTypes = commandTypes;
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
6edf630dd62f5ed879e6f8e6cb695c82b618d755
|
Update comment
|
Kentico/delivery-sdk-net,Kentico/Deliver-.NET-SDK
|
Kentico.Kontent.Delivery.Abstractions/IDeliveryHttpClient.cs
|
Kentico.Kontent.Delivery.Abstractions/IDeliveryHttpClient.cs
|
using System.Net.Http;
using System.Threading.Tasks;
namespace Kentico.Kontent.Delivery.Abstractions
{
/// <summary>
/// Represents a requests operations against Kentico Kontent Delivery API.
/// </summary>
public interface IDeliveryHttpClient
{
/// <summary>
/// Returns a response message from Kentico Kontent Delivery API.
/// </summary>
/// <param name="message">HttpRequestMessage instance represents the request message</param>
/// <returns></returns>
Task<HttpResponseMessage> SendHttpMessageAsync(HttpRequestMessage message);
}
}
|
using System.Net.Http;
using System.Threading.Tasks;
namespace Kentico.Kontent.Delivery.Abstractions
{
/// <summary>
/// Represents a requests operations against Kentico Kontent Delivery API.
/// </summary>
public interface IDeliveryHttpClient
{
/// <summary>
/// Returns a response message from Kentico Kontent Delivery API.
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
Task<HttpResponseMessage> SendHttpMessageAsync(HttpRequestMessage message);
}
}
|
mit
|
C#
|
df09518da5c4cf402cdf66cdf3c9e5aa7e3aa727
|
Bump dev version to 0.9
|
hifi/monodevelop-justenoughvi,fadookie/monodevelop-justenoughvi
|
JustEnoughVi/Properties/AddinInfo.cs
|
JustEnoughVi/Properties/AddinInfo.cs
|
using Mono.Addins;
using Mono.Addins.Description;
[assembly: Addin(
"JustEnoughVi",
Namespace = "JustEnoughVi",
Version = "0.9"
)]
[assembly: AddinName("Just Enough Vi")]
[assembly: AddinCategory("IDE extensions")]
[assembly: AddinDescription("Simplified Vi/Vim mode for MonoDevelop/Xamarin Studio.")]
[assembly: AddinAuthor("Toni Spets")]
|
using Mono.Addins;
using Mono.Addins.Description;
[assembly: Addin(
"JustEnoughVi",
Namespace = "JustEnoughVi",
Version = "0.8"
)]
[assembly: AddinName("Just Enough Vi")]
[assembly: AddinCategory("IDE extensions")]
[assembly: AddinDescription("Simplified Vi/Vim mode for MonoDevelop/Xamarin Studio.")]
[assembly: AddinAuthor("Toni Spets")]
|
mit
|
C#
|
154104b5695c1fc975600aefcc2325e6e5f0958e
|
Use dash as separator
|
dlidstrom/Snittlistan,dlidstrom/Snittlistan,dlidstrom/Snittlistan
|
SnittListan/Installers/RavenInstaller.cs
|
SnittListan/Installers/RavenInstaller.cs
|
using System;
using Castle.MicroKernel;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Raven.Client;
using Raven.Client.Embedded;
namespace SnittListan.Installers
{
public class RavenInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Component.For<IDocumentStore>().Instance(CreateDocumentStore()).LifeStyle.Singleton,
Component.For<IDocumentSession>().UsingFactoryMethod(GetDocumentSession).LifeStyle.PerWebRequest);
}
private static IDocumentSession GetDocumentSession(IKernel kernel)
{
var store = kernel.Resolve<IDocumentStore>();
return store.OpenSession();
}
private IDocumentStore CreateDocumentStore()
{
var store = new EmbeddableDocumentStore
{
DataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory").ToString()
}.Initialize();
store.Conventions.IdentityPartsSeparator = "-";
return store;
}
}
}
|
using System;
using Castle.MicroKernel;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Raven.Client;
using Raven.Client.Embedded;
namespace SnittListan.Installers
{
public class RavenInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Component.For<IDocumentStore>().Instance(CreateDocumentStore()).LifeStyle.Singleton,
Component.For<IDocumentSession>().UsingFactoryMethod(GetDocumentSession).LifeStyle.PerWebRequest);
}
private static IDocumentSession GetDocumentSession(IKernel kernel)
{
var store = kernel.Resolve<IDocumentStore>();
return store.OpenSession();
}
private IDocumentStore CreateDocumentStore()
{
var store = new EmbeddableDocumentStore
{
DataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory").ToString()
}.Initialize();
return store;
}
}
}
|
mit
|
C#
|
73ff772344e5e99ca5b7d5ebd6fffdcbbe06025a
|
Add follow link
|
bjornhol/furry-bear,bjornhol/furry-bear,bjornhol/furry-bear
|
Views/Shared/_Layout.cshtml
|
Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET MVC Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<header>
</header>
<div id="body">
@RenderBody()
</div>
<footer>
<a href="https://github.com/bjornhol/furry-bear">Follow on GitHub</a>
</footer>
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET MVC Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<header>
</header>
<div id="body">
@RenderBody()
</div>
<footer>
</footer>
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
6dc1a89cbd9704cd3f56801ded61dbcb3802f7aa
|
upgrade version to 1.4.3
|
Aaron-Liu/equeue,geffzhang/equeue,tangxuehua/equeue,tangxuehua/equeue,tangxuehua/equeue,Aaron-Liu/equeue,geffzhang/equeue
|
src/EQueue/Properties/AssemblyInfo.cs
|
src/EQueue/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.3")]
[assembly: AssemblyFileVersion("1.4.3")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.2")]
[assembly: AssemblyFileVersion("1.4.2")]
|
mit
|
C#
|
2736a78c2fecb12a1606b584f34cfb0fdf4fb6e4
|
Comment for LoadHandlers
|
benjanderson/WooCode.Slack,WooCode/WooCode.Slack
|
WooCode.Slack.WooBot/Bot.cs
|
WooCode.Slack.WooBot/Bot.cs
|
using System;
using System.Linq;
using Nancy;
using Nancy.TinyIoc;
using WooCode.Slack.WebHooks;
using WooCode.Slack.WooBot.Handlers;
namespace WooCode.Slack.WooBot
{
public class Bot : NancyModule
{
/// <summary>
/// You have to call this when you start your server to load all handlers.
/// </summary>
public static void LoadHandlers()
{
var type = typeof(IHookHandler);
var types = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(x => type.IsAssignableFrom(x) && x.IsClass).ToList();
types.ForEach(t =>
{
var target = (IHookHandler)Activator.CreateInstance(t);
var name = target.GetType().Name.ToLower();
if (name.EndsWith("handler"))
name = name.Substring(0, name.Length - 7);
TinyIoCContainer.Current.Register(type, target, name);
});
}
public Bot()
{
Post["/hook"] = HandleSlashCommand;
}
private object HandleSlashCommand(dynamic args)
{
IncomingMessage message = IncomingMessage.From(Request.Form);
var values = message.Text.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
var handlerName = values[message.Command == null ? 1 : 0].ToLower();
message.Text = string.Join(" ", values.Skip(message.Command == null ? 2 : 1));
var handler = TinyIoCContainer.Current.Resolve<IHookHandler>(handlerName);
if(handler != null)
handler.Handle(message);
return 200;
}
}
}
|
using System;
using System.Linq;
using Nancy;
using Nancy.TinyIoc;
using WooCode.Slack.WebHooks;
using WooCode.Slack.WooBot.Handlers;
namespace WooCode.Slack.WooBot
{
public class Bot : NancyModule
{
public static void LoadHandlers()
{
var type = typeof(IHookHandler);
var types = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(x => type.IsAssignableFrom(x) && x.IsClass).ToList();
types.ForEach(t =>
{
var target = (IHookHandler)Activator.CreateInstance(t);
var name = target.GetType().Name.ToLower();
if (name.EndsWith("handler"))
name = name.Substring(0, name.Length - 7);
TinyIoCContainer.Current.Register(type, target, name);
});
}
public Bot()
{
Post["/hook"] = HandleSlashCommand;
}
private object HandleSlashCommand(dynamic args)
{
IncomingMessage message = IncomingMessage.From(Request.Form);
var values = message.Text.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
var handlerName = values[message.Command == null ? 1 : 0].ToLower();
message.Text = string.Join(" ", values.Skip(message.Command == null ? 2 : 1));
var handler = TinyIoCContainer.Current.Resolve<IHookHandler>(handlerName);
if(handler != null)
handler.Handle(message);
return 200;
}
}
}
|
mit
|
C#
|
eeb2f7eb2e927ed6e19d0de66eba0c9c795f334c
|
move scripts
|
ucdavis/Namster,ucdavis/Namster,ucdavis/Namster
|
src/Namster/Views/Search/Index.cshtml
|
src/Namster/Views/Search/Index.cshtml
|
@{
ViewData["Title"] = "React Test Page";
}
<div id="search"></div>
@section scripts
{
<environment names="Development">
<script src="https://fb.me/react-0.14.3.js"></script>
<script src="https://fb.me/react-dom-0.14.3.js"></script>
</environment>
<environment names="Staging,Production">
<script src="https://fb.me/react-0.14.3.min.js"></script>
<script src="https://fb.me/react-dom-0.14.3.min.js"></script>
</environment>
<script type="text/javascript" src="~/js/dist/search.js"></script>
}
|
@{
ViewData["Title"] = "React Test Page";
}
<div id="search"></div>
<environment names="Development">
<script src="https://fb.me/react-0.14.3.js"></script>
<script src="https://fb.me/react-dom-0.14.3.js"></script>
</environment>
<environment names="Staging,Production">
<script src="https://fb.me/react-0.14.3.min.js"></script>
<script src="https://fb.me/react-dom-0.14.3.min.js"></script>
</environment>
<script type="text/javascript" src="~/js/dist/search.js"></script>
|
mit
|
C#
|
4cb01d50dc83d7ea1b391c6eaa4d732a7f342159
|
add array type kind
|
Kukkimonsuta/Odachi
|
src/Odachi.CodeModel/TypeReference.cs
|
src/Odachi.CodeModel/TypeReference.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Odachi.CodeModel.Mapping;
using System.Reflection;
namespace Odachi.CodeModel
{
public enum TypeKind
{
Array,
Enum,
Primitive,
Interface,
Struct,
Class,
}
public static class TypeKindExtensions
{
public static TypeKind GetTypeKind(this Type type)
{
return type.GetTypeInfo().GetTypeKind();
}
public static TypeKind GetTypeKind(this TypeInfo info)
{
if (info.IsArray)
return TypeKind.Array;
if (info.IsEnum)
return TypeKind.Enum;
if (info.IsPrimitive)
return TypeKind.Primitive;
if (info.IsInterface)
return TypeKind.Interface;
if (info.IsValueType)
return TypeKind.Struct;
return TypeKind.Class;
}
}
public class TypeReference
{
public TypeReference(string module, string name, TypeKind kind, bool isNullable, params TypeReference[] genericArguments)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
if (genericArguments == null)
throw new ArgumentNullException(nameof(genericArguments));
Module = module;
Name = name;
Kind = kind;
IsNullable = isNullable;
GenericArguments = genericArguments;
}
public string Module { get; }
public string Name { get; }
public TypeKind Kind { get; }
public bool IsNullable { get; set; }
public TypeReference[] GenericArguments { get; }
public override string ToString()
{
return $"{Name}{(GenericArguments.Length > 0 ? $"<{string.Join(", ", GenericArguments.Select(a => a.ToString()))}>" : "")}{(IsNullable ? "?" : "")}";
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Odachi.CodeModel.Mapping;
using System.Reflection;
namespace Odachi.CodeModel
{
public enum TypeKind
{
Primitive,
Interface,
Enum,
Struct,
Class,
}
public static class TypeKindExtensions
{
public static TypeKind GetTypeKind(this Type type)
{
return type.GetTypeInfo().GetTypeKind();
}
public static TypeKind GetTypeKind(this TypeInfo info)
{
if (info.IsPrimitive)
return TypeKind.Primitive;
if (info.IsInterface)
return TypeKind.Interface;
if (info.IsEnum)
return TypeKind.Enum;
if (info.IsValueType)
return TypeKind.Struct;
return TypeKind.Class;
}
}
public class TypeReference
{
public TypeReference(string module, string name, TypeKind kind, bool isNullable, params TypeReference[] genericArguments)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
if (genericArguments == null)
throw new ArgumentNullException(nameof(genericArguments));
Module = module;
Name = name;
Kind = kind;
IsNullable = isNullable;
GenericArguments = genericArguments;
}
public string Module { get; }
public string Name { get; }
public TypeKind Kind { get; }
public bool IsNullable { get; set; }
public TypeReference[] GenericArguments { get; }
public override string ToString()
{
return $"{Name}{(GenericArguments.Length > 0 ? $"<{string.Join(", ", GenericArguments.Select(a => a.ToString()))}>" : "")}{(IsNullable ? "?" : "")}";
}
}
}
|
apache-2.0
|
C#
|
b7ef424485baa9467289770434219c4fbd2324da
|
bump version
|
Fody/Validar
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Validar")]
[assembly: AssemblyProduct("Validar")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.6.0.0")]
[assembly: AssemblyFileVersion("0.6.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Validar")]
[assembly: AssemblyProduct("Validar")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
|
mit
|
C#
|
de1e11a71660eae39a531b6b30811e67a42a7fca
|
use native logging in singleton-initializations
|
Notulp/Pluton,Notulp/Pluton
|
Pluton/Singleton.cs
|
Pluton/Singleton.cs
|
using System;
namespace Pluton
{
public abstract class Singleton<T> : CountedInstance where T : ISingleton
{
protected static T Instance;
public static T GetInstance()
{
return Singleton<T>.Instance;
}
static Singleton()
{
Singleton<T>.Instance = Activator.CreateInstance<T>();
if (Singleton<T>.Instance.CheckDependencies())
Singleton<T>.Instance.Initialize();
else
UnityEngine.Debug.LogWarning(String.Format("Couldn't initialite Singleton<{0}>, is one of it's dependencies missing?", Instance.GetType()));
}
}
}
|
using System;
namespace Pluton
{
public abstract class Singleton<T> : CountedInstance where T : ISingleton
{
protected static T Instance;
public static T GetInstance()
{
return Singleton<T>.Instance;
}
static Singleton()
{
Singleton<T>.Instance = Activator.CreateInstance<T>();
if (Singleton<T>.Instance.CheckDependencies())
Singleton<T>.Instance.Initialize();
else
Logger.LogWarning(String.Format("Couldn't initialite Singleton<{0}>, is one of it's dependencies missing?", Instance.GetType()));
}
}
}
|
mit
|
C#
|
a5ad2acb39f9593b32eb078baf19ae923b6398ec
|
Fix broken group analysis.
|
jherby2k/AudioWorks
|
AudioWorks/AudioWorks.Commands/MeasureAudioFileCommand.cs
|
AudioWorks/AudioWorks.Commands/MeasureAudioFileCommand.cs
|
using AudioWorks.Common;
using JetBrains.Annotations;
using System.Collections.Generic;
using System.Management.Automation;
using System.Threading;
using System.Threading.Tasks;
namespace AudioWorks.Commands
{
/// <summary>
/// <para type="synopsis">Analyzes an audio file.</para>
/// <para type="description">The Measure-AudioFile cmdlet performs analysis on an audio file, then stores these
/// measurements as metadata.</para>
/// </summary>
[PublicAPI]
[Cmdlet(VerbsDiagnostic.Measure, "AudioFile"), OutputType(typeof(IAnalyzableAudioFile))]
public sealed class MeasureAudioFileCommand : Cmdlet
{
readonly List<IAnalyzableAudioFile> _audioFiles = new List<IAnalyzableAudioFile>();
/// <summary>
/// <para type="description">Specifies the audio file.</para>
/// </summary>
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)]
public IAnalyzableAudioFile AudioFile { get; set; }
/// <summary>
/// <para type="description">Specifies the audio file.</para>
/// </summary>
[Parameter(Mandatory = true, Position = 1, ValueFromPipeline = true)]
public string Analyzer { get; set; }
/// <summary>
/// <para type="description">Returns an object representing the item with which you are working. By default,
/// this cmdlet does not generate any output.</para>
/// </summary>
[Parameter]
public SwitchParameter PassThru { get; set; }
/// <inheritdoc/>
protected override void ProcessRecord()
{
_audioFiles.Add(AudioFile);
}
/// <inheritdoc/>
protected override void EndProcessing()
{
using (var groupToken = new GroupToken(_audioFiles.Count))
AnalyzeParallel(groupToken);
if (PassThru)
WriteObject(AudioFile);
}
void AnalyzeParallel([NotNull] GroupToken groupToken)
{
Parallel.ForEach(_audioFiles, audioFile =>
audioFile.Analyze(Analyzer, groupToken, CancellationToken.None));
}
}
}
|
using AudioWorks.Common;
using JetBrains.Annotations;
using System.Collections.Generic;
using System.Management.Automation;
using System.Threading;
namespace AudioWorks.Commands
{
/// <summary>
/// <para type="synopsis">Analyzes an audio file.</para>
/// <para type="description">The Measure-AudioFile cmdlet performs analysis on an audio file, then stores these
/// measurements as metadata.</para>
/// </summary>
[PublicAPI]
[Cmdlet(VerbsDiagnostic.Measure, "AudioFile"), OutputType(typeof(IAnalyzableAudioFile))]
public sealed class MeasureAudioFileCommand : Cmdlet
{
readonly List<IAnalyzableAudioFile> _audioFiles = new List<IAnalyzableAudioFile>();
/// <summary>
/// <para type="description">Specifies the audio file.</para>
/// </summary>
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)]
public IAnalyzableAudioFile AudioFile { get; set; }
/// <summary>
/// <para type="description">Specifies the audio file.</para>
/// </summary>
[Parameter(Mandatory = true, Position = 1, ValueFromPipeline = true)]
public string Analyzer { get; set; }
/// <summary>
/// <para type="description">Returns an object representing the item with which you are working. By default,
/// this cmdlet does not generate any output.</para>
/// </summary>
[Parameter]
public SwitchParameter PassThru { get; set; }
/// <inheritdoc/>
protected override void ProcessRecord()
{
_audioFiles.Add(AudioFile);
}
/// <inheritdoc/>
protected override void EndProcessing()
{
using (var groupToken = new GroupToken(_audioFiles.Count))
AudioFile.Analyze(Analyzer, groupToken, CancellationToken.None);
if (PassThru)
WriteObject(AudioFile);
}
}
}
|
agpl-3.0
|
C#
|
f269623214f9acacced05f82118e31251ad14bf9
|
build fix
|
vecta/HackManchester,vecta/HackManchester
|
Kitbag.HackManchester/Kitbag.Database/PersonRepository.cs
|
Kitbag.HackManchester/Kitbag.Database/PersonRepository.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Kitbag.Domain;
namespace Kitbag.Database
{
public class PersonRepository : Repository<Person>
{
public PersonRepository(CwonData dbContext) : base(dbContext) { }
//public IEnumerable<Person> GetByGroup(int groupId) { return _dbContext.People.Where(x => x == groupId).ToList(); }
public Person GetByEmail(string email)
{
return _dbContext.People.SingleOrDefault(person => string.Compare(person.Email, email, StringComparison.InvariantCultureIgnoreCase) == 0);
}
public IList<Person> GetByGroup(int groupId)
{
var people = base._dbContext.Groups.Include("People1").FirstOrDefault(x => x.Id == groupId).People1.ToList();
return people;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Kitbag.Domain;
namespace Kitbag.Database
{
public class PersonRepository : Repository<Person>
{
public PersonRepository(CwonData dbContext) : base(dbContext) { }
public IEnumerable<Person> GetByGroup(int groupId) { return _dbContext.People.Where(x => x.Id == groupId).ToList(); }
public Person GetByEmail(string email)
{
return _dbContext.People.SingleOrDefault(person => string.Compare(person.Email, email, StringComparison.InvariantCultureIgnoreCase) == 0);
}
public IList<Person> GetByGroup(int groupId)
{
var people = base._dbContext.Groups.FirstOrDefault(x => x.Id == groupId).People1.ToList();
return people;
}
}
}
|
apache-2.0
|
C#
|
e05f392d75ff9e7c76ed67b8b8fd07c0fc422f2d
|
Normalize line endings
|
rafd123/PowerBridge
|
src/PowerBridge/Internal/IPowerShellHostOutput.cs
|
src/PowerBridge/Internal/IPowerShellHostOutput.cs
|
using System.Management.Automation;
using Microsoft.Build.Framework;
namespace PowerBridge.Internal
{
internal interface IPowerShellHostOutput
{
void WriteDebugLine(string message);
void WriteVerboseLine(string message);
void Write(string message);
void WriteLine(string value);
void WriteWarningLine(string value);
void WriteErrorLine(string value);
void WriteError(ErrorRecord errorRecord);
}
internal sealed class PowerShellHostOutput : IPowerShellHostOutput
{
private readonly IBuildTaskLog _log;
public PowerShellHostOutput(IBuildTaskLog log)
{
_log = log;
}
public void WriteDebugLine(string message)
{
_log.LogMessage(MessageImportance.Low, message);
}
public void WriteVerboseLine(string message)
{
_log.LogMessage(MessageImportance.Low, message);
}
public void Write(string message)
{
_log.LogMessage(MessageImportance.High, message);
}
public void WriteLine(string value)
{
Write(value);
}
public void WriteWarningLine(string value)
{
_log.LogWarning(value);
}
public void WriteErrorLine(string value)
{
_log.LogError(value);
}
public void WriteError(ErrorRecord errorRecord)
{
var info = errorRecord.GetErrorInfo();
_log.LogError(
subcategory: null,
errorCode: null,
helpKeyword: null,
file: info.File,
lineNumber: info.LineNumber,
columnNumber: info.ColumnNumber,
endLineNumber: 0,
endColumnNumber: 0,
message: info.Message);
}
}
}
|
using System.Management.Automation;
using Microsoft.Build.Framework;
namespace PowerBridge.Internal
{
internal interface IPowerShellHostOutput
{
void WriteDebugLine(string message);
void WriteVerboseLine(string message);
void Write(string message);
void WriteLine(string value);
void WriteWarningLine(string value);
void WriteErrorLine(string value);
void WriteError(ErrorRecord errorRecord);
}
internal sealed class PowerShellHostOutput : IPowerShellHostOutput
{
private readonly IBuildTaskLog _log;
public PowerShellHostOutput(IBuildTaskLog log)
{
_log = log;
}
public void WriteDebugLine(string message)
{
_log.LogMessage(MessageImportance.Low, message);
}
public void WriteVerboseLine(string message)
{
_log.LogMessage(MessageImportance.Low, message);
}
public void Write(string message)
{
_log.LogMessage(MessageImportance.High, message);
}
public void WriteLine(string value)
{
Write(value);
}
public void WriteWarningLine(string value)
{
_log.LogWarning(value);
}
public void WriteErrorLine(string value)
{
_log.LogError(value);
}
public void WriteError(ErrorRecord errorRecord)
{
var info = errorRecord.GetErrorInfo();
_log.LogError(
subcategory: null,
errorCode: null,
helpKeyword: null,
file: info.File,
lineNumber: info.LineNumber,
columnNumber: info.ColumnNumber,
endLineNumber: 0,
endColumnNumber: 0,
message: info.Message);
}
}
}
|
mit
|
C#
|
3e3b4d8af5fd1302a77add38f262c3c74fb303f7
|
Return empty list if HttpContext.Current is null
|
MindscapeHQ/raygun4net,MindscapeHQ/raygun4net,MindscapeHQ/raygun4net
|
Mindscape.Raygun4Net/Breadcrumbs/HttpBreadcrumbStorage.cs
|
Mindscape.Raygun4Net/Breadcrumbs/HttpBreadcrumbStorage.cs
|
using System.Collections;
using System.Collections.Generic;
using System.Web;
namespace Mindscape.Raygun4Net.Breadcrumbs
{
internal class HttpBreadcrumbStorage : IRaygunBreadcrumbStorage
{
private const string ItemsKey = "Raygun.Breadcrumbs.Storage";
public IEnumerator<RaygunBreadcrumb> GetEnumerator()
{
return GetList().GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Store(RaygunBreadcrumb breadcrumb)
{
GetList().Add(breadcrumb);
}
public void Clear()
{
GetList().Clear();
}
private List<RaygunBreadcrumb> GetList()
{
if (HttpContext.Current == null)
{
return new List<RaygunBreadcrumb>();
}
SetupStorage();
return (List<RaygunBreadcrumb>) HttpContext.Current.Items[ItemsKey];
}
private void SetupStorage()
{
if (HttpContext.Current != null && !HttpContext.Current.Items.Contains(ItemsKey))
{
HttpContext.Current.Items[ItemsKey] = new List<RaygunBreadcrumb>();
}
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using System.Web;
namespace Mindscape.Raygun4Net.Breadcrumbs
{
internal class HttpBreadcrumbStorage : IRaygunBreadcrumbStorage
{
private const string ItemsKey = "Raygun.Breadcrumbs.Storage";
public IEnumerator<RaygunBreadcrumb> GetEnumerator()
{
return GetList().GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Store(RaygunBreadcrumb breadcrumb)
{
GetList().Add(breadcrumb);
}
public void Clear()
{
GetList().Clear();
}
private List<RaygunBreadcrumb> GetList()
{
SetupStorage();
return (List<RaygunBreadcrumb>) HttpContext.Current.Items[ItemsKey];
}
private void SetupStorage()
{
if (HttpContext.Current != null && !HttpContext.Current.Items.Contains(ItemsKey))
{
HttpContext.Current.Items[ItemsKey] = new List<RaygunBreadcrumb>();
}
}
}
}
|
mit
|
C#
|
a4d11ef8279f8f45f589e6cd05ad238ed0a26c95
|
test commit
|
alb3ric/NugetReferencesExplorer
|
NugetReferencesExplorer/ViewModel/ApplicationViewModel.cs
|
NugetReferencesExplorer/ViewModel/ApplicationViewModel.cs
|
using GalaSoft.MvvmLight;
using NugetReferencesExplorer.Model.Domain;
using NugetReferencesExplorer.Model.Repository;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NugetReferencesExplorer.ViewModel
{
public class ApplicationViewModel : ViewModelBase
{
private bool _isBusy = false;
public bool IsBusy
{
get => _isBusy;
set
{
if (_isBusy != value)
{
_isBusy = value;
this.RaisePropertyChanged(nameof(IsBusy));
}
}
}
private async void LoadPackageItemsAsync()
{
IsBusy = true;
try
{
this.PackageItems = await Task.Run(() => LocalPackageRepositoryFactory.Create().GetPackages(Properties.Settings.Default.sourcePath).Where(p => p.HasDifferentVersion).ToList());//.ForEach(x => x.LoadPackageInfos()));
}
finally
{
IsBusy = false;
}
}
private IEnumerable<Package> _packageItems;
public IEnumerable<Package> PackageItems
{
get
{
if (_packageItems == null)
{
this.LoadPackageItemsAsync();
}
return _packageItems;
}
set
{
_packageItems = value;
this.RaisePropertyChanged(nameof(PackageItems));
}
}
public Package SelectedPackage { get; set; }
}
}
|
using GalaSoft.MvvmLight;
using NugetReferencesExplorer.Model.Domain;
using NugetReferencesExplorer.Model.Repository;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NugetReferencesExplorer.ViewModel
{
public class ApplicationViewModel : ViewModelBase
{
private bool _isBusy = false;
public bool IsBusy
{
get => _isBusy;
set
{
if (_isBusy != value)
{
_isBusy = value;
this.RaisePropertyChanged(nameof(IsBusy));
}
}
}
private async void LoadPackageItemsAsync()
{
IsBusy = true;
this.PackageItems = await Task.Run(() => LocalPackageRepositoryFactory.Create().GetPackages(Properties.Settings.Default.sourcePath).Where(p => p.HasDifferentVersion).ToList());//.ForEach(x => x.LoadPackageInfos()));
IsBusy = false;
}
private IEnumerable<Package> _packageItems;
public IEnumerable<Package> PackageItems
{
get
{
if (_packageItems == null)
{
this.LoadPackageItemsAsync();
}
return _packageItems;
}
set
{
_packageItems = value;
this.RaisePropertyChanged(nameof(PackageItems));
}
}
public Package SelectedPackage { get; set; }
}
}
|
mit
|
C#
|
c27c1baa2e9842879fc2edd647e00ee3162c8228
|
Make header consistent across samples
|
reactjs/React.NET,reactjs/React.NET,reactjs/React.NET,reactjs/React.NET,reactjs/React.NET,reactjs/React.NET
|
src/React.Sample.Mvc4/Views/Home/Index.cshtml
|
src/React.Sample.Mvc4/Views/Home/Index.cshtml
|
@using System.Web.Optimization
@model React.Sample.Mvc4.ViewModels.IndexViewModel
<!DOCTYPE html>
<html>
<head>
<title>ReactJS.NET Sample</title>
<link rel="stylesheet" href="~/Content/Sample.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" />
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1 class="display-4">ASP.NET MVC Sample</h1>
<hr className="my-4" />
<p class="lead">
This is an example of ReactJS.NET's server-side rendering. The initial state of this
comments box is rendered server-side, and additional data is loaded via AJAX and rendered
client-side.
</p>
<!-- Render the component server-side, passing initial props -->
@Html.React("CommentsBox", new { initialComments = Model.Comments, page = Model.Page })
<!-- Load all required scripts (React + the site's scripts) -->
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.1/umd/react.development.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.1/umd/react-dom.development.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.6.0/prop-types.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/reactstrap/7.1.0/reactstrap.min.js"></script>
@Scripts.Render("~/bundles/main")
<!-- Render the code to initialise the component -->
@Html.ReactInitJavaScript()
</div>
</div>
</body>
</html>
|
@using System.Web.Optimization
@model React.Sample.Mvc4.ViewModels.IndexViewModel
<!DOCTYPE html>
<html>
<head>
<title>ReactJS.NET Sample</title>
<link rel="stylesheet" href="~/Content/Sample.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" />
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1 class="display-4">Hello, ReactJS.NET!</h1>
<p class="lead">
This is an example of ReactJS.NET's server-side rendering. The initial state of this
comments box is rendered server-side, and additional data is loaded via AJAX and rendered
client-side.
</p>
<hr class="my-4">
<!-- Render the component server-side, passing initial props -->
@Html.React("CommentsBox", new { initialComments = Model.Comments, page = Model.Page })
<!-- Load all required scripts (React + the site's scripts) -->
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.1/umd/react.development.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.1/umd/react-dom.development.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.6.0/prop-types.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/reactstrap/7.1.0/reactstrap.min.js"></script>
@Scripts.Render("~/bundles/main")
<!-- Render the code to initialise the component -->
@Html.ReactInitJavaScript()
</div>
</div>
</body>
</html>
|
mit
|
C#
|
47d5efac3017a7dccdeee646ab168a2f75958242
|
Prepare release 4.5.1 - increase CslaGenFork version. Work Item #1907
|
CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork
|
trunk/Solutions/CslaGenFork/Properties/AssemblyInfo.cs
|
trunk/Solutions/CslaGenFork/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("Csla Generator Fork")]
[assembly: AssemblyDescription("CSLA.NET Business Objects and Data Access Layer code generation tool.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CslaGenFork Project")]
[assembly: AssemblyProduct("Csla Generator Fork")]
[assembly: AssemblyCopyright("Copyright CslaGen Project 2007, 2009\r\nCopyright Tiago Freitas Leal 2009, 2014")]
[assembly: AssemblyTrademark("All Rights Reserved.")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(false)]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.5.1.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: AssemblyFileVersionAttribute("4.5.1")]
[assembly: GuidAttribute("5c019c4f-d2ab-40dd-9860-70bd603b6017")]
[assembly: ComVisibleAttribute(false)]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("Csla Generator Fork")]
[assembly: AssemblyDescription("CSLA.NET Business Objects and Data Access Layer code generation tool.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CslaGenFork Project")]
[assembly: AssemblyProduct("Csla Generator Fork")]
[assembly: AssemblyCopyright("Copyright CslaGen Project 2007, 2009\r\nCopyright Tiago Freitas Leal 2009, 2014")]
[assembly: AssemblyTrademark("All Rights Reserved.")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(false)]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.5.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: AssemblyFileVersionAttribute("4.5.0")]
[assembly: GuidAttribute("5c019c4f-d2ab-40dd-9860-70bd603b6017")]
[assembly: ComVisibleAttribute(false)]
|
mit
|
C#
|
e444c823d0e3df30743db5ac112a1e755b61d8b8
|
Test of package 2
|
hravnx/CliHelpers,hravnx/CliHelpers
|
build.cake
|
build.cake
|
#tool "nuget:?package=GitVersion.CommandLine"
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var nuget_push_key = EnvironmentVariable("NUGET_API_KEY");
var packageVersion = EnvironmentVariable("APPVEYOR_BUILD_VERSION");
var outputDir = "./artifacts/";
var solutionPath = "./CliHelpers.sln";
var releaseMsBuildSettings = new MSBuildSettings
{
Verbosity = Verbosity.Quiet,
ToolVersion = MSBuildToolVersion.VS2015,
Configuration = "Release"
};
var debugMsBuildSettings = new MSBuildSettings
{
Verbosity = Verbosity.Normal,
ToolVersion = MSBuildToolVersion.VS2015,
Configuration = "Debug"
};
var activeMsBuildConfig = configuration == "Debug" ? debugMsBuildSettings : releaseMsBuildSettings;
Task("Publish")
//.IsDependentOn("Package")
.Does(() => {
if (string.IsNullOrEmpty(nuget_push_key))
{
throw new InvalidOperationException("NUGET_API_KEY not found");
}
Information("API KEY {0}", nuget_push_key);
Information("Build version {0}", packageVersion);
// using(var process = StartAndReturnProcess("./tools/nuget.exe", new ProcessSettings{ Arguments = string.Format("./artifacts/CliHelpers.{0}.nupkg", packageVersion) }))
// {
// process.WaitForExit();
// // This should output 0 as valid arguments supplied
// Information("Exit code: {0}", process.GetExitCode());
// }
});
Task("Package")
.IsDependentOn("Test")
.Does(() => {
EnsureDirectoryExists(outputDir);
var packSettings = new DotNetCorePackSettings {
Configuration = configuration,
OutputDirectory = outputDir,
NoBuild = true
};
DotNetCorePack("./src/CliHelpers", packSettings);
});
Task("Test")
.IsDependentOn("Build")
.Does(() => {
DotNetCoreTest("./test/CliHelpers.Tests");
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() => {
MSBuild(solutionPath, activeMsBuildConfig);
});
Task("Restore")
.Does(() => {
DotNetCoreRestore(".");
});
Task("Clean")
.Does(() => {
if (DirectoryExists(outputDir))
{
DeleteDirectory(outputDir, recursive:true);
}
var directories = GetDirectories("./**/bin").Concat(GetDirectories("./**/obj"));
CleanDirectories(directories);
});
Task("Default")
.IsDependentOn("Publish");
RunTarget(target);
|
#tool "nuget:?package=GitVersion.CommandLine"
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var nuget_push_key = EnvironmentVariable("NUGET_API_KEY");
var packageVersion = EnvironmentVariable("APPVEYOR_BUILD_VERSION");
var outputDir = "./artifacts/";
var solutionPath = "./CliHelpers.sln";
var releaseMsBuildSettings = new MSBuildSettings
{
Verbosity = Verbosity.Quiet,
ToolVersion = MSBuildToolVersion.VS2015,
Configuration = "Release"
};
var debugMsBuildSettings = new MSBuildSettings
{
Verbosity = Verbosity.Normal,
ToolVersion = MSBuildToolVersion.VS2015,
Configuration = "Debug"
};
var activeMsBuildConfig = configuration == "Debug" ? debugMsBuildSettings : releaseMsBuildSettings;
Task("Publish")
//.IsDependentOn("Package")
.Does(() => {
if (string.IsNullOrEmpty(nuget_push_key))
{
throw new InvalidOperationException("NUGET_API_KEY not found");
}
Information("API KEY {0}", nuget_push_key);
Information("Build version {0}", packageVersion);
// using(var process = StartAndReturnProcess("./tools/nuget.exe", new ProcessSettings{ Arguments = string.Format("./artifacts/CliHelpers.{0}.nupkg", packageVersion) }))
// {
// process.WaitForExit();
// // This should output 0 as valid arguments supplied
// Information("Exit code: {0}", process.GetExitCode());
// }
});
Task("Package")
.IsDependentOn("Test")
.Does(() => {
EnsureDirectoryExists(outputDir);
var packSettings = new DotNetCorePackSettings {
Configuration = configuration,
OutputDirectory = outputDir,
NoBuild = true
};
DotNetCorePack("./src/CliHelpers", packSettings);
});
Task("Test")
.IsDependentOn("Build")
.Does(() => {
DotNetCoreTest("./test/CliHelpers.Tests");
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() => {
MSBuild(solutionPath, activeMsBuildConfig);
});
Task("Restore")
.Does(() => {
DotNetCoreRestore(".");
});
Task("Clean")
.Does(() => {
if (DirectoryExists(outputDir))
{
DeleteDirectory(outputDir, recursive:true);
}
var directories = GetDirectories("./**/bin").Concat(GetDirectories("./**/obj"));
CleanDirectories(directories);
});
Task("Default")
.IsDependentOn("Package");
RunTarget(target);
|
mit
|
C#
|
ead2e388823dc8afb8272a972e21e2b1b478030c
|
Build the projects before testing
|
peppy/osu,smoogipooo/osu,ppy/osu,EVAST9919/osu,peppy/osu-new,ppy/osu,NeoAdonis/osu,UselessToucan/osu,ZLima12/osu,DrabWeb/osu,DrabWeb/osu,smoogipoo/osu,naoey/osu,DrabWeb/osu,NeoAdonis/osu,EVAST9919/osu,naoey/osu,UselessToucan/osu,naoey/osu,peppy/osu,johnneijzen/osu,NeoAdonis/osu,smoogipoo/osu,johnneijzen/osu,smoogipoo/osu,ZLima12/osu,peppy/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,2yangk23/osu
|
build.cake
|
build.cake
|
#addin "nuget:?package=CodeFileSanity&version=0.0.21"
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.2.2"
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Build");
var framework = Argument("framework", "netcoreapp2.1");
var configuration = Argument("configuration", "Release");
var osuSolution = new FilePath("./osu.sln");
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Compile")
.Does(() => {
DotNetCoreBuild(osuSolution.FullPath, new DotNetCoreBuildSettings {
Framework = framework,
Configuration = configuration
});
});
Task("Test")
.IsDependentOn("Compile")
.Does(() => {
var testAssemblies = GetFiles("**/*.Tests/bin/**/*.Tests.dll");
DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings {
Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx",
Parallel = true,
ToolTimeout = TimeSpan.FromMinutes(10),
});
});
// windows only because both inspectcore and nvika depend on net45
Task("InspectCode")
.WithCriteria(IsRunningOnWindows())
.IsDependentOn("Compile")
.Does(() => {
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
DotNetCoreRestore(osuSolution.FullPath, new DotNetCoreRestoreSettings {
Verbosity = DotNetCoreVerbosity.Quiet
});
InspectCode(osuSolution, new InspectCodeSettings {
CachesHome = "inspectcode",
OutputFile = "inspectcodereport.xml",
});
StartProcess(nVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
});
Task("CodeFileSanity")
.Does(() => {
ValidateCodeSanity(new ValidateCodeSanitySettings {
RootDirectory = ".",
IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor
});
});
Task("Build")
.IsDependentOn("CodeFileSanity")
.IsDependentOn("InspectCode")
.IsDependentOn("Test");
RunTarget(target);
|
#addin "nuget:?package=CodeFileSanity&version=0.0.21"
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.2.2"
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Build");
var framework = Argument("framework", "netcoreapp2.1");
var configuration = Argument("configuration", "Release");
var osuDesktop = new FilePath("./osu.Desktop/osu.Desktop.csproj");
var osuSolution = new FilePath("./osu.sln");
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Compile")
.Does(() => {
DotNetCoreBuild(osuDesktop.FullPath, new DotNetCoreBuildSettings {
Framework = framework,
Configuration = configuration
});
});
Task("Test")
.Does(() => {
var testAssemblies = GetFiles("**/*.Tests/bin/**/*.Tests.dll");
DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings {
Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx",
Parallel = true,
ToolTimeout = TimeSpan.FromMinutes(10),
});
});
// windows only because both inspectcore and nvika depend on net45
Task("InspectCode")
.WithCriteria(IsRunningOnWindows())
.IsDependentOn("Compile")
.Does(() => {
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
DotNetCoreRestore(osuSolution.FullPath, new DotNetCoreRestoreSettings {
Verbosity = DotNetCoreVerbosity.Quiet
});
InspectCode(osuSolution, new InspectCodeSettings {
CachesHome = "inspectcode",
OutputFile = "inspectcodereport.xml",
});
StartProcess(nVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
});
Task("CodeFileSanity")
.Does(() => {
ValidateCodeSanity(new ValidateCodeSanitySettings {
RootDirectory = ".",
IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor
});
});
Task("Build")
.IsDependentOn("CodeFileSanity")
.IsDependentOn("InspectCode")
.IsDependentOn("Test");
RunTarget(target);
|
mit
|
C#
|
3418b04cf481ae5ec032f875800e44abcbb1debc
|
update comments
|
arnovb-github/CmcLibNet
|
CmcLibNet.Services/UI/IFilePicker.cs
|
CmcLibNet.Services/UI/IFilePicker.cs
|
using System.Runtime.InteropServices;
namespace Vovin.CmcLibNet.Services.UI
{
/// <summary>
/// Interface for FilePicker
/// </summary>
[ComVisible(true)]
[Guid("EB19C890-5EED-4388-80E1-2F0DDA490902")]
public interface IFilePicker
{
/// <summary>
/// Gets or sets the initial directory displayed by the file dialog box.
/// </summary>
string InitialDirectory { get; set; }
/// <summary>
/// Gets or sets the index of the filter currently selected in the file dialog box.
/// The default value is 1.
/// </summary>
int FilterIndex { get; set; }
/// <summary>
/// Gets or sets the current file name filter string, which determines the choices
/// that appear in the "Save as file type" or "Files of type" box in the dialog box.
/// </summary>
string Filter { get; set; }
/// <summary>
/// Gets or sets the file dialog box title.
/// </summary>
string Title { get; set; }
/// <summary>
/// Gets or sets the default file name extension.
/// </summary>
string DefaultExt { get; set; }
/// <summary>
/// Returns an OpenFileDialog instance.
/// </summary>
/// <returns>Dialog window.</returns>
string ShowDialog();
}
}
|
using System.Runtime.InteropServices;
namespace Vovin.CmcLibNet.Services.UI
{
/// <summary>
/// Interface for FilePicker
/// </summary>
[ComVisible(true)]
[Guid("EB19C890-5EED-4388-80E1-2F0DDA490902")]
public interface IFilePicker
{
/// <summary>
/// Gets or sets the initial directory displayed by the file dialog box.
/// </summary>
string InitialDirectory { get; set; }
/// <summary>
/// Gets or sets the index of the filter currently selected in the file dialog box.
/// The default value is 1.
/// </summary>
int FilterIndex { get; set; }
/// <summary>
/// Gets or sets the current file name filter string, which determines the choices
/// that appear in the "Save as file type" or "Files of type" box in the dialog box.
/// </summary>
string Filter { get; set; }
/// <summary>
/// Gets or sets the file dialog box title.
/// </summary>
string Title { get; set; }
/// <summary>
/// Gets or sets the default file name extension.
/// </summary>
string DefaultExt { get; set; }
/// <summary>
/// Returns an OpenFileDialog instance
/// </summary>
string ShowDialog();
}
}
|
mit
|
C#
|
5287c833ef93526356df8d55ec83081b253ee879
|
Update Program.cs
|
relianz/s2i-aspnet-example,relianz/s2i-aspnet-example,relianz/s2i-aspnet-example
|
app/Program.cs
|
app/Program.cs
|
// using System;
// using System.Collections.Generic;
// using System.Linq;
// using System.Threading.Tasks;
using System.IO; // Directory.
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace WebApplication
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddEnvironmentVariables("")
.Build();
var url = config["ASPNETCORE_URLS"] ?? "http://*:8080";
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls(url)
.Build();
host.Run();
}
}
}
|
// using System;
// using System.Collections.Generic;
// using System.IO;
// using System.Linq;
// using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace WebApplication
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddEnvironmentVariables("")
.Build();
var url = config["ASPNETCORE_URLS"] ?? "http://*:8080";
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls(url)
.Build();
host.Run();
}
}
}
|
apache-2.0
|
C#
|
64f32a7e8fa05ed88f83f74eaa03afd5e1f63ca0
|
set the alternate email provider if no thunderbird or xdg-email
|
tombogle/libpalaso,mccarthyrb/libpalaso,andrew-polk/libpalaso,darcywong00/libpalaso,ddaspit/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso,marksvc/libpalaso,JohnThomson/libpalaso,hatton/libpalaso,JohnThomson/libpalaso,mccarthyrb/libpalaso,tombogle/libpalaso,darcywong00/libpalaso,chrisvire/libpalaso,gmartin7/libpalaso,gmartin7/libpalaso,andrew-polk/libpalaso,ermshiperete/libpalaso,ddaspit/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,ddaspit/libpalaso,JohnThomson/libpalaso,gtryus/libpalaso,hatton/libpalaso,ermshiperete/libpalaso,marksvc/libpalaso,chrisvire/libpalaso,sillsdev/libpalaso,chrisvire/libpalaso,gmartin7/libpalaso,ddaspit/libpalaso,sillsdev/libpalaso,sillsdev/libpalaso,andrew-polk/libpalaso,tombogle/libpalaso,hatton/libpalaso,gtryus/libpalaso,chrisvire/libpalaso,darcywong00/libpalaso,mccarthyrb/libpalaso,gmartin7/libpalaso,hatton/libpalaso,glasseyes/libpalaso,marksvc/libpalaso,JohnThomson/libpalaso,mccarthyrb/libpalaso,ermshiperete/libpalaso,gtryus/libpalaso,gtryus/libpalaso,andrew-polk/libpalaso,ermshiperete/libpalaso
|
Palaso/Email/EmailProviderFactory.cs
|
Palaso/Email/EmailProviderFactory.cs
|
using System;
using System.IO;
using System.Xml;
using System.Xml.XPath;
namespace Palaso.Email
{
public class EmailProviderFactory
{
public static IEmailProvider PreferredEmailProvider()
{
if (Environment.OSVersion.Platform == PlatformID.Unix)
{
if (ThunderbirdIsDefault())
{
Console.WriteLine("Using Thunderbird provider");
return new ThunderbirdEmailProvider();
}
if (File.Exists("/usr/bin/xdg-email"))
{
Console.WriteLine("Using xdg-email provider");
return new LinuxEmailProvider();
}
return new MailToEmailProvider();
}
return new MapiEmailProvider();
}
public static IEmailProvider AlternateEmailProvider()
{
if (Environment.OSVersion.Platform == PlatformID.Unix && !ThunderbirdIsDefault() && !File.Exists("/usr/bin/xdg-email"))
{
return null;
}
return new MailToEmailProvider();
}
public static bool ThunderbirdIsDefault() {
bool result = false;
if (!result)
result |= ThunderbirdIsDefaultOnX();
if (!result)
result |= ThunderbirdIsDefaultOnGnome();
return result;
}
public static bool ThunderbirdIsDefaultOnGnome()
{
bool result = false;
string home = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string preferredAppFile = String.Format(
"{0}/.gconf/desktop/gnome/url-handlers/mailto/%gconf.xml",
home
);
if (File.Exists(preferredAppFile))
{
XPathDocument doc = new XPathDocument(new XmlTextReader(preferredAppFile));
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator it = nav.Select("/gconf/entry/stringvalue");
if (it.MoveNext())
{
result = it.Current.Value.Contains("thunderbird");
}
}
Console.WriteLine("Thunderbird on Gnome? Result {0}", result);
return result;
}
public static bool ThunderbirdIsDefaultOnX()
{
bool result = false;
string home = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string preferredAppFile = String.Format(
"{0}/.config/xfce4/helpers.rc",
home
);
if (File.Exists(preferredAppFile))
{
using (var reader = File.OpenText(preferredAppFile))
{
while (!reader.EndOfStream)
{
var line = reader.ReadLine().Trim();
string[] keyValue = line.Split('=');
if (keyValue.Length == 2) {
result = (keyValue[0] == "MailReader" && keyValue[1] == "thunderbird");
break;
}
}
}
}
Console.WriteLine("Thunderbird on X? Result {0}", result);
return result;
}
}
}
|
using System;
using System.IO;
using System.Xml;
using System.Xml.XPath;
namespace Palaso.Email
{
public class EmailProviderFactory
{
public static IEmailProvider PreferredEmailProvider()
{
if (Environment.OSVersion.Platform == PlatformID.Unix)
{
if (ThunderbirdIsDefault())
{
Console.WriteLine("Using Thunderbird provider");
return new ThunderbirdEmailProvider();
}
if (File.Exists("/usr/bin/xdg-email"))
{
Console.WriteLine("Using xdg-email provider");
return new LinuxEmailProvider();
}
return new MailToEmailProvider();
}
return new MapiEmailProvider();
}
public static IEmailProvider AlternateEmailProvider()
{
if (Environment.OSVersion.Platform == PlatformID.Unix)
{
return null;
}
return new MailToEmailProvider();
}
public static bool ThunderbirdIsDefault() {
bool result = false;
if (!result)
result |= ThunderbirdIsDefaultOnX();
if (!result)
result |= ThunderbirdIsDefaultOnGnome();
return result;
}
public static bool ThunderbirdIsDefaultOnGnome()
{
bool result = false;
string home = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string preferredAppFile = String.Format(
"{0}/.gconf/desktop/gnome/url-handlers/mailto/%gconf.xml",
home
);
if (File.Exists(preferredAppFile))
{
XPathDocument doc = new XPathDocument(new XmlTextReader(preferredAppFile));
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator it = nav.Select("/gconf/entry/stringvalue");
if (it.MoveNext())
{
result = it.Current.Value.Contains("thunderbird");
}
}
Console.WriteLine("Thunderbird on Gnome? Result {0}", result);
return result;
}
public static bool ThunderbirdIsDefaultOnX()
{
bool result = false;
string home = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string preferredAppFile = String.Format(
"{0}/.config/xfce4/helpers.rc",
home
);
if (File.Exists(preferredAppFile))
{
using (var reader = File.OpenText(preferredAppFile))
{
while (!reader.EndOfStream)
{
var line = reader.ReadLine().Trim();
string[] keyValue = line.Split('=');
if (keyValue.Length == 2) {
result = (keyValue[0] == "MailReader" && keyValue[1] == "thunderbird");
break;
}
}
}
}
Console.WriteLine("Thunderbird on X? Result {0}", result);
return result;
}
}
}
|
mit
|
C#
|
7effcd611fb7395243f174b0b99598476555c8ca
|
Update IConfigurableRasterFactory.cs
|
LANDIS-II-Foundation/Landis-Spatial-Modeling-Library
|
src/api/IConfigurableRasterFactory.cs
|
src/api/IConfigurableRasterFactory.cs
|
// Contributors:
// James Domingo, Green Code LLC
namespace Landis.SpatialModeling
{
/// <summary>
/// A raster factory whose configuration can be changed.
/// </summary>
public interface IConfigurableRasterFactory : IRasterFactory
{
/// <summary>
/// Get information about a raster format.
/// </summary>
/// <param name="code">The format's code.</param>
/// <remarks>
/// If the raster factory does not recognize or support the format,
/// then null is returned.
/// </remarks>
RasterFormat GetFormat(string code);
/// <summary>
/// Bind a file extension with a raster format.
/// </summary>
/// <param name="fileExtension">
/// Must start with a period.
/// </param>
/// <param name="format">
/// A raster format supported by the raster factory.
/// </param>
void BindExtensionToFormat(string fileExtension,
RasterFormat format);
}
}
|
// Copyright 2011-2012 Green Code LLC
// All rights reserved.
//
// The copyright holders license this file under the New (3-clause) BSD
// License (the "License"). You may not use this file except in
// compliance with the License. A copy of the License is available at
//
// http://www.opensource.org/licenses/BSD-3-Clause
//
// and is included in the NOTICE.txt file distributed with this work.
//
// Contributors:
// James Domingo, Green Code LLC
namespace Landis.SpatialModeling
{
/// <summary>
/// A raster factory whose configuration can be changed.
/// </summary>
public interface IConfigurableRasterFactory : IRasterFactory
{
/// <summary>
/// Get information about a raster format.
/// </summary>
/// <param name="code">The format's code.</param>
/// <remarks>
/// If the raster factory does not recognize or support the format,
/// then null is returned.
/// </remarks>
RasterFormat GetFormat(string code);
/// <summary>
/// Bind a file extension with a raster format.
/// </summary>
/// <param name="fileExtension">
/// Must start with a period.
/// </param>
/// <param name="format">
/// A raster format supported by the raster factory.
/// </param>
void BindExtensionToFormat(string fileExtension,
RasterFormat format);
}
}
|
apache-2.0
|
C#
|
9a9e54ddb04624570e5bc175c10148d88e81e4b0
|
update import
|
shinji-yoshida/SharpPhase
|
src/ObservablePhasedObject.cs
|
src/ObservablePhasedObject.cs
|
using System;
using UniRx;
namespace SharpPhase {
public abstract class ObservablePhasedObject<TSelf, TPhase> : PhasedObject<TSelf, TPhase>
where TSelf : IPhasedObject
where TPhase : Phase<TSelf>
{
Subject<PhaseEvent<TPhase>> phaseEventSubject = new Subject<PhaseEvent<TPhase>>();
public ObservablePhasedObject (TPhase initialPhase) : base (initialPhase) {
}
public ObservablePhasedObject () : base() {
}
public IObservable<PhaseEvent<TPhase>> OnPhaseEventAsObservable() {
return phaseEventSubject;
}
protected override void MakeEnterPhase (TPhase phase) {
base.MakeEnterPhase (phase);
phaseEventSubject.OnNext(new PhaseEvent<TPhase>(PhaseEventEnum.Enter, phase));
}
protected override void MakeLeavePhase (TPhase phase) {
base.MakeLeavePhase (phase);
phaseEventSubject.OnNext(new PhaseEvent<TPhase>(PhaseEventEnum.Leave, phase));
}
protected override void MakeTerminatePhase (TPhase phase) {
base.MakeTerminatePhase (phase);
phaseEventSubject.OnNext(new PhaseEvent<TPhase>(PhaseEventEnum.Terminate, phase));
}
}
}
|
using UniRx;
namespace SharpPhase {
public abstract class ObservablePhasedObject<TSelf, TPhase> : PhasedObject<TSelf, TPhase>
where TSelf : IPhasedObject
where TPhase : Phase<TSelf>
{
Subject<PhaseEvent<TPhase>> phaseEventSubject = new Subject<PhaseEvent<TPhase>>();
public ObservablePhasedObject (TPhase initialPhase) : base (initialPhase) {
}
public ObservablePhasedObject () : base() {
}
public IObservable<PhaseEvent<TPhase>> OnPhaseEventAsObservable() {
return phaseEventSubject;
}
protected override void MakeEnterPhase (TPhase phase) {
base.MakeEnterPhase (phase);
phaseEventSubject.OnNext(new PhaseEvent<TPhase>(PhaseEventEnum.Enter, phase));
}
protected override void MakeLeavePhase (TPhase phase) {
base.MakeLeavePhase (phase);
phaseEventSubject.OnNext(new PhaseEvent<TPhase>(PhaseEventEnum.Leave, phase));
}
protected override void MakeTerminatePhase (TPhase phase) {
base.MakeTerminatePhase (phase);
phaseEventSubject.OnNext(new PhaseEvent<TPhase>(PhaseEventEnum.Terminate, phase));
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.