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
97322f998efaa6c3f66d928a95b8c3496bcad71f
Update MockDataReaderService.cs
GHPReporter/Ghpr.Core,GHPReporter/Ghpr.Core,GHPReporter/Ghpr.Core
Ghpr.Tests.Tests/Core/MockDataReaderService.cs
Ghpr.Tests.Tests/Core/MockDataReaderService.cs
using System; using System.Collections.Generic; using Ghpr.Core.Common; using Ghpr.Core.Interfaces; using Ghpr.Core.Settings; namespace Ghpr.Core.Tests.Core { public class MockDataReaderService : IDataReaderService { public IDataReaderService GetDataReader() { return this; } public void InitializeDataReader(ProjectSettings settings, ILogger logger) { } public ReportSettingsDto GetReportSettings() { return new ReportSettingsDto(3, 5, "report", "project", false); } public TestRunDto GetLatestTestRun(Guid testGuid) { return new TestRunDto(Guid.NewGuid(), "Test name", "Full test name"); } public TestRunDto GetTestRun(ItemInfoDto testInfo) { return new TestRunDto(Guid.NewGuid(), "Test name", "Full test name"); } public List<ItemInfoDto> GetTestInfos(Guid testGuid) { return new List<ItemInfoDto>(); } public List<TestScreenshotDto> GetTestScreenshots(TestRunDto testRunDto) { return new List<TestScreenshotDto>(); } public TestOutputDto GetTestOutput(TestRunDto testRunDto) { return new TestOutputDto { Output = "output", SuiteOutput = "suite output", TestOutputInfo = new SimpleItemInfoDto {Date = DateTime.Now, ItemName = "item"} }; } public RunDto GetRun(Guid runGuid) { return new RunDto(); } public List<ItemInfoDto> GetRunInfos() { return new List<ItemInfoDto>(); } public List<TestRunDto> GetTestRunsFromRun(RunDto runDto) { return new List<TestRunDto>(); } } }
using System; using System.Collections.Generic; using Ghpr.Core.Common; using Ghpr.Core.Interfaces; using Ghpr.Core.Settings; namespace Ghpr.Core.Tests.Core { public class MockDataReaderService : IDataReaderService { public IDataReaderService GetDataReader() { return this; } public void InitializeDataReader(ProjectSettings settings, ILogger logger) { } public ReportSettingsDto GetReportSettings() { return new ReportSettingsDto(3, 5, "report", "project"); } public TestRunDto GetLatestTestRun(Guid testGuid) { return new TestRunDto(Guid.NewGuid(), "Test name", "Full test name"); } public TestRunDto GetTestRun(ItemInfoDto testInfo) { return new TestRunDto(Guid.NewGuid(), "Test name", "Full test name"); } public List<ItemInfoDto> GetTestInfos(Guid testGuid) { return new List<ItemInfoDto>(); } public List<TestScreenshotDto> GetTestScreenshots(TestRunDto testRunDto) { return new List<TestScreenshotDto>(); } public TestOutputDto GetTestOutput(TestRunDto testRunDto) { return new TestOutputDto { Output = "output", SuiteOutput = "suite output", TestOutputInfo = new SimpleItemInfoDto {Date = DateTime.Now, ItemName = "item"} }; } public RunDto GetRun(Guid runGuid) { return new RunDto(); } public List<ItemInfoDto> GetRunInfos() { return new List<ItemInfoDto>(); } public List<TestRunDto> GetTestRunsFromRun(RunDto runDto) { return new List<TestRunDto>(); } } }
mit
C#
6539c204aa30b79c8eecd11c1c069847c7a23e9e
Add helpers for finding attributes
mrahhal/Konsola
src/Konsola/Metadata/ObjectMetadata.cs
src/Konsola/Metadata/ObjectMetadata.cs
using System; using System.Linq; using System.Collections.Generic; namespace Konsola.Metadata { public class ObjectMetadata { public ObjectMetadata( Type type, IEnumerable<PropertyMetadata> properties, IEnumerable<AttributeMetadata> attributes) { Type = type; Properties = properties; Attributes = attributes; } public Type Type { get; private set; } public virtual IEnumerable<PropertyMetadata> Properties { get; private set; } public virtual IEnumerable<AttributeMetadata> Attributes { get; private set; } public IEnumerable<T> AttributesOfType<T>() { return Attributes .Select(a => a.Attribute) .OfType<T>(); } public T AttributeOfType<T>() { return AttributesOfType<T>() .FirstOrDefault(); } } }
using System; using System.Collections.Generic; namespace Konsola.Metadata { public class ObjectMetadata { public ObjectMetadata( Type type, IEnumerable<PropertyMetadata> properties, IEnumerable<AttributeMetadata> attributes) { Type = type; Properties = properties; Attributes = attributes; } public Type Type { get; private set; } public virtual IEnumerable<PropertyMetadata> Properties { get; private set; } public virtual IEnumerable<AttributeMetadata> Attributes { get; private set; } } }
mit
C#
fd58e4cf8f13084351a47dd9f9841c5b07e03740
Document Handle properties
bjornicus/confluent-kafka-dotnet,MaximGurschi/rdkafka-dotnet,ah-/rdkafka-dotnet,MrGlenThomas/confluent-kafka-dotnet,treziac/confluent-kafka-dotnet,MrGlenThomas/confluent-kafka-dotnet,bjornicus/confluent-kafka-dotnet,treziac/confluent-kafka-dotnet
src/RdKafka/Handle.cs
src/RdKafka/Handle.cs
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Linq; using RdKafka.Internal; namespace RdKafka { public class Handle { internal SafeKafkaHandle handle; /// <summary> /// The name of the handle /// </summary> public string Name => handle.GetName(); /// <summary> /// The client's broker-assigned group member id /// /// Last assigned member id, or empty string if not currently /// a group member. /// </summary> public string MemberId => handle.MemberId(); /// <summary> /// The current out queue length /// /// The out queue contains messages and requests waiting to be sent to, /// or acknowledged by, the broker. /// </summary> public long OutQueueLength => handle.GetOutQueueLength(); /// <summary> /// Request Metadata from broker. /// /// Parameters: /// allTopics - if true: request info about all topics in cluster, /// if false: only request info about locally known topics. /// onlyForTopic - only request info about this topic /// includeInternal - include internal topics prefixed with __ /// timeout - maximum response time before failing. /// </summary> public Metadata Metadata (bool allTopics=true, Topic onlyForTopic=null, bool includeInternal=false, TimeSpan timeout=default(TimeSpan)) { return handle.Metadata(allTopics, onlyForTopic?.handle, includeInternal, timeout); } } }
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Linq; using RdKafka.Internal; namespace RdKafka { public class Handle { internal SafeKafkaHandle handle; public string Name => handle.GetName(); public string MemberId => handle.MemberId(); public long OutQueueLength => handle.GetOutQueueLength(); /// <summary> /// Request Metadata from broker. /// /// Parameters: /// allTopics - if true: request info about all topics in cluster, /// if false: only request info about locally known topics. /// onlyForTopic - only request info about this topic /// includeInternal - include internal topics prefixed with __ /// timeout - maximum response time before failing. /// </summary> public Metadata Metadata (bool allTopics=true, Topic onlyForTopic=null, bool includeInternal=false, TimeSpan timeout=default(TimeSpan)) { return handle.Metadata(allTopics, onlyForTopic?.handle, includeInternal, timeout); } } }
apache-2.0
C#
c4b7fed9d94c9358834e666772b975cddebbc186
Append Content-Type
SnowflakePowered/snowflake,RonnChyran/snowflake,faint32/snowflake-1,SnowflakePowered/snowflake,faint32/snowflake-1,RonnChyran/snowflake,faint32/snowflake-1,RonnChyran/snowflake,SnowflakePowered/snowflake
Snowflake/Extensions/HttpListenerContextExts.cs
Snowflake/Extensions/HttpListenerContextExts.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Mono.Net; namespace Snowflake.Extensions { public static class HttpListenerContextExts { public static void AddAccessControlHeaders(this HttpListenerContext context) { context.Response.AppendHeader("Access-Control-Allow-Credentials", "true"); context.Response.AppendHeader("Access-Control-Allow-Origin", "*"); context.Response.AppendHeader("Access-Control-Origin", "*"); context.Response.AppendHeader("Access-Control-Allow-Headers", "X-Requested-With, Content-Type"); context.Response.AppendHeader("Content-Type", "application/json"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Mono.Net; namespace Snowflake.Extensions { public static class HttpListenerContextExts { public static void AddAccessControlHeaders(this HttpListenerContext context) { context.Response.AppendHeader("Access-Control-Allow-Credentials", "true"); context.Response.AppendHeader("Access-Control-Allow-Origin", "*"); context.Response.AppendHeader("Access-Control-Origin", "*"); context.Response.AppendHeader("Access-Control-Allow-Headers", "X-Requested-With, Content-Type"); } } }
mpl-2.0
C#
32f7f2b7699f29f66deb74d1ff97249ab7c87c18
remove namespace
icarus-consulting/Yaapii.Atoms
src/Yaapii.Atoms/Bytes/BytesAsInput.cs
src/Yaapii.Atoms/Bytes/BytesAsInput.cs
// MIT License // // Copyright(c) 2017 ICARUS Consulting GmbH // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. using System; using System.IO; using Yaapii.Atoms.IO; namespace Yaapii.Atoms.Bytes { /// <summary> /// Bytes as input. /// </summary> public sealed class BytesAsInput : IInput { /// <summary> /// the source /// </summary> private readonly IBytes source; /// <summary> /// Bytes as input. /// </summary> /// <param name="text">a text</param> public BytesAsInput(IText text) : this(new BytesOf(text)) { } /// <summary> /// Bytes as input. /// </summary> /// <param name="text">a string</param> public BytesAsInput(String text) : this(new BytesOf(text)) { } /// <summary> /// Bytes as input. /// </summary> /// <param name="bytes">byte array</param> public BytesAsInput(byte[] bytes) : this(new BytesOf(bytes)) { } /// <summary> /// Bytes as input. /// </summary> /// <param name="bytes">bytes</param> public BytesAsInput(IBytes bytes) { this.source = bytes; } /// <summary> /// Get the stream. /// </summary> /// <returns>the stream</returns> public Stream Stream() { return new MemoryStream(this.source.AsBytes()); } } }
// MIT License // // Copyright(c) 2017 ICARUS Consulting GmbH // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. using System; using System.IO; namespace Yaapii.Atoms.Bytes { /// <summary> /// Bytes as input. /// </summary> public sealed class BytesAsInput : IInput { /// <summary> /// the source /// </summary> private readonly IBytes source; /// <summary> /// Bytes as input. /// </summary> /// <param name="text">a text</param> public BytesAsInput(IText text) : this(new BytesOf(text)) { } /// <summary> /// Bytes as input. /// </summary> /// <param name="text">a string</param> public BytesAsInput(String text) : this(new BytesOf(text)) { } /// <summary> /// Bytes as input. /// </summary> /// <param name="bytes">byte array</param> public BytesAsInput(byte[] bytes) : this(new BytesOf(bytes)) { } /// <summary> /// Bytes as input. /// </summary> /// <param name="bytes">bytes</param> public BytesAsInput(IBytes bytes) { this.source = bytes; } /// <summary> /// Get the stream. /// </summary> /// <returns>the stream</returns> public Stream Stream() { return new MemoryStream(this.source.AsBytes()); } } }
mit
C#
972c414dd0d0d3b9cb962e022c179ef7981245f6
Apply exclusion of analytics in draft pages.
Talagozis/Talagozis.Website,Talagozis/Talagozis.Website,Talagozis/Talagozis.Website
Talagozis.Website/Views/Layout/Global/Js.cshtml
Talagozis.Website/Views/Layout/Global/Js.cshtml
<environment include="Staging,Production"> <script> if ('serviceWorker' in navigator) { if (navigator.serviceWorker.controller) console.debug('[PWA Builder] active service worker found, no need to register'); window.addEventListener('load', function () { navigator.serviceWorker.register("/service-worker.js") .then(() => console.log('[PWA Builder] service worker installed')) .catch(err => console.error('[PWA Builder] Error: ', err)); }); } </script> </environment> <environment include="Production"> @if (Context.Request.Headers["X-Logger-Tracking"] != "28E245EC432A4049BB62942920CA1DBB" && !Context.Request.Query.Any(a => string.Equals(a.Key, "draft", StringComparison.OrdinalIgnoreCase) && string.Equals(a.Value, "true", StringComparison.OrdinalIgnoreCase)) ) { <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-48776471-2"></script> <script> window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', 'UA-48776471-2'); </script> <script> var ci = '1DiMxeW9WFob2g5ZQNNXrrx2kRyGd7ELDV47A9rRpSr4doyzaB7UC6TIfqBOPq6Y'; var d = document; var i = d.createElement('script'); i.src = '//logger.talagozis.com/Content/Script/request.js?cache=' + new Date().getFullYear() + new Date().getMonth() + new Date().getDate(); d.head.appendChild(i); </script> } </environment>
<environment include="Staging,Production"> <script> if ('serviceWorker' in navigator) { if (navigator.serviceWorker.controller) console.debug('[PWA Builder] active service worker found, no need to register'); window.addEventListener('load', function () { navigator.serviceWorker.register("/service-worker.js") .then(() => console.log('[PWA Builder] service worker installed')) .catch(err => console.error('[PWA Builder] Error: ', err)); }); } </script> </environment> <environment include="Production"> @if (Context.Request.Headers["X-Logger-Tracking"] != "28E245EC432A4049BB62942920CA1DBB") { <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-48776471-2"></script> <script> window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', 'UA-48776471-2'); </script> <script> var ci = '1DiMxeW9WFob2g5ZQNNXrrx2kRyGd7ELDV47A9rRpSr4doyzaB7UC6TIfqBOPq6Y'; var d = document; var i = d.createElement('script'); i.src = '//logger.talagozis.com/Content/Script/request.js?cache=' + new Date().getFullYear() + new Date().getMonth() + new Date().getDate(); d.head.appendChild(i); </script> } </environment>
mit
C#
8541a994600580ecf9eb498c95d8bfacdde84d61
Use bigquerydatatransfer instead of bigquery_data_transfer in region tags
jsimonweb/csharp-docs-samples,jsimonweb/csharp-docs-samples,jsimonweb/csharp-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,jsimonweb/csharp-docs-samples
bigquery/data-transfer/api/QuickStart/QuickStart.cs
bigquery/data-transfer/api/QuickStart/QuickStart.cs
/* * Copyright (c) 2018 Google LLC * * 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. */ // [START bigquerydatatransfer_quickstart] using System; using Google.Api.Gax; using Google.Cloud.BigQuery.DataTransfer.V1; namespace GoogleCloudSamples { public class QuickStart { public static void Main(string[] args) { // Instantiates a client DataTransferServiceClient client = DataTransferServiceClient.Create(); // Your Google Cloud Platform project ID string projectId = "YOUR-PROJECT-ID"; ProjectName project = new ProjectName(projectId); var sources = client.ListDataSources(ParentNameOneof.From(project)); Console.WriteLine("Supported Data Sources:"); foreach (DataSource source in sources) { Console.WriteLine( $"{source.DataSourceId}: " + $"{source.DisplayName} ({source.Description})"); } } } } // [END bigquerydatatransfer_quickstart]
/* * Copyright (c) 2018 Google LLC * * 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. */ // [START bigquery_data_transfer_quickstart] using System; using Google.Api.Gax; using Google.Cloud.BigQuery.DataTransfer.V1; namespace GoogleCloudSamples { public class QuickStart { public static void Main(string[] args) { // Instantiates a client DataTransferServiceClient client = DataTransferServiceClient.Create(); // Your Google Cloud Platform project ID string projectId = "YOUR-PROJECT-ID"; ProjectName project = new ProjectName(projectId); var sources = client.ListDataSources(ParentNameOneof.From(project)); Console.WriteLine("Supported Data Sources:"); foreach (DataSource source in sources) { Console.WriteLine( $"{source.DataSourceId}: " + $"{source.DisplayName} ({source.Description})"); } } } } // [END bigquery_data_transfer_quickstart]
apache-2.0
C#
fe778f576de801ad1a69879393ae82c99610d733
Raise exceptions on non-404 error codes
kevbite/CompaniesHouse.NET,LiberisLabs/CompaniesHouse.NET
src/LiberisLabs.CompaniesHouse/CompaniesHouseCompanyProfileClient.cs
src/LiberisLabs.CompaniesHouse/CompaniesHouseCompanyProfileClient.cs
using System.Net.Http; using System.Threading; using System.Threading.Tasks; using LiberisLabs.CompaniesHouse.Response.CompanyProfile; using LiberisLabs.CompaniesHouse.UriBuilders; namespace LiberisLabs.CompaniesHouse { public class CompaniesHouseCompanyProfileClient : ICompaniesHouseCompanyProfileClient { private readonly IHttpClientFactory _httpClientFactory; private readonly ICompanyProfileUriBuilder _companyProfileUriBuilder; public CompaniesHouseCompanyProfileClient(IHttpClientFactory httpClientFactory, ICompanyProfileUriBuilder companyProfileUriBuilder) { _httpClientFactory = httpClientFactory; _companyProfileUriBuilder = companyProfileUriBuilder; } public async Task<CompaniesHouseClientResponse<CompanyProfile>> GetCompanyProfileAsync(string companyNumber, CancellationToken cancellationToken = default(CancellationToken)) { using (var httpClient = _httpClientFactory.CreateHttpClient()) { var requestUri = _companyProfileUriBuilder.Build(companyNumber); var response = await httpClient.GetAsync(requestUri, cancellationToken).ConfigureAwait(false); // Return a null profile on 404s, but raise exception for all other error codes if (response.StatusCode != System.Net.HttpStatusCode.NotFound) response.EnsureSuccessStatusCode(); CompanyProfile result = response.IsSuccessStatusCode ? await response.Content.ReadAsAsync<CompanyProfile>(cancellationToken).ConfigureAwait(false) : null; return new CompaniesHouseClientResponse<CompanyProfile>(result); } } } }
using System.Net.Http; using System.Threading; using System.Threading.Tasks; using LiberisLabs.CompaniesHouse.Response.CompanyProfile; using LiberisLabs.CompaniesHouse.UriBuilders; namespace LiberisLabs.CompaniesHouse { public class CompaniesHouseCompanyProfileClient : ICompaniesHouseCompanyProfileClient { private readonly IHttpClientFactory _httpClientFactory; private readonly ICompanyProfileUriBuilder _companyProfileUriBuilder; public CompaniesHouseCompanyProfileClient(IHttpClientFactory httpClientFactory, ICompanyProfileUriBuilder companyProfileUriBuilder) { _httpClientFactory = httpClientFactory; _companyProfileUriBuilder = companyProfileUriBuilder; } public async Task<CompaniesHouseClientResponse<CompanyProfile>> GetCompanyProfileAsync(string companyNumber, CancellationToken cancellationToken = default(CancellationToken)) { using (var httpClient = _httpClientFactory.CreateHttpClient()) { var requestUri = _companyProfileUriBuilder.Build(companyNumber); var response = await httpClient.GetAsync(requestUri, cancellationToken).ConfigureAwait(false); CompanyProfile result = response.IsSuccessStatusCode ? await response.Content.ReadAsAsync<CompanyProfile>(cancellationToken).ConfigureAwait(false) : null; return new CompaniesHouseClientResponse<CompanyProfile>(result); } } } }
mit
C#
7da80436ffcebe031593dfc9e354613ceba02f5e
Fix the netcore test runs
richlander/corefx,MaggieTsang/corefx,wtgodbe/corefx,stone-li/corefx,MaggieTsang/corefx,krk/corefx,Jiayili1/corefx,Jiayili1/corefx,Jiayili1/corefx,yizhang82/corefx,tijoytom/corefx,seanshpark/corefx,gkhanna79/corefx,DnlHarvey/corefx,richlander/corefx,seanshpark/corefx,shimingsg/corefx,nbarbettini/corefx,parjong/corefx,cydhaselton/corefx,ptoonen/corefx,rubo/corefx,alexperovich/corefx,seanshpark/corefx,jlin177/corefx,billwert/corefx,ViktorHofer/corefx,twsouthwick/corefx,ViktorHofer/corefx,tijoytom/corefx,wtgodbe/corefx,Jiayili1/corefx,ravimeda/corefx,cydhaselton/corefx,krytarowski/corefx,zhenlan/corefx,ericstj/corefx,jlin177/corefx,seanshpark/corefx,gkhanna79/corefx,mmitche/corefx,alexperovich/corefx,Jiayili1/corefx,MaggieTsang/corefx,ptoonen/corefx,MaggieTsang/corefx,DnlHarvey/corefx,Ermiar/corefx,krk/corefx,wtgodbe/corefx,shimingsg/corefx,ViktorHofer/corefx,tijoytom/corefx,ptoonen/corefx,mazong1123/corefx,krk/corefx,mazong1123/corefx,rubo/corefx,JosephTremoulet/corefx,ravimeda/corefx,parjong/corefx,mmitche/corefx,nchikanov/corefx,JosephTremoulet/corefx,DnlHarvey/corefx,twsouthwick/corefx,richlander/corefx,DnlHarvey/corefx,nbarbettini/corefx,ravimeda/corefx,mazong1123/corefx,ericstj/corefx,JosephTremoulet/corefx,ericstj/corefx,mazong1123/corefx,the-dwyer/corefx,zhenlan/corefx,ericstj/corefx,DnlHarvey/corefx,nchikanov/corefx,gkhanna79/corefx,krk/corefx,ravimeda/corefx,billwert/corefx,twsouthwick/corefx,axelheer/corefx,Jiayili1/corefx,wtgodbe/corefx,krytarowski/corefx,MaggieTsang/corefx,parjong/corefx,krytarowski/corefx,ViktorHofer/corefx,stone-li/corefx,mmitche/corefx,mmitche/corefx,parjong/corefx,JosephTremoulet/corefx,cydhaselton/corefx,ViktorHofer/corefx,the-dwyer/corefx,the-dwyer/corefx,JosephTremoulet/corefx,parjong/corefx,JosephTremoulet/corefx,twsouthwick/corefx,nbarbettini/corefx,billwert/corefx,ptoonen/corefx,MaggieTsang/corefx,Ermiar/corefx,seanshpark/corefx,ptoonen/corefx,tijoytom/corefx,zhenlan/corefx,wtgodbe/corefx,krytarowski/corefx,shimingsg/corefx,ViktorHofer/corefx,axelheer/corefx,axelheer/corefx,mazong1123/corefx,richlander/corefx,alexperovich/corefx,shimingsg/corefx,Ermiar/corefx,shimingsg/corefx,mmitche/corefx,billwert/corefx,seanshpark/corefx,fgreinacher/corefx,stone-li/corefx,nchikanov/corefx,Ermiar/corefx,cydhaselton/corefx,krytarowski/corefx,rubo/corefx,ptoonen/corefx,zhenlan/corefx,nchikanov/corefx,krk/corefx,richlander/corefx,nchikanov/corefx,jlin177/corefx,seanshpark/corefx,cydhaselton/corefx,gkhanna79/corefx,nchikanov/corefx,BrennanConroy/corefx,stone-li/corefx,jlin177/corefx,axelheer/corefx,BrennanConroy/corefx,stone-li/corefx,ravimeda/corefx,yizhang82/corefx,JosephTremoulet/corefx,the-dwyer/corefx,twsouthwick/corefx,shimingsg/corefx,ptoonen/corefx,yizhang82/corefx,jlin177/corefx,parjong/corefx,Jiayili1/corefx,ericstj/corefx,nbarbettini/corefx,nchikanov/corefx,nbarbettini/corefx,ericstj/corefx,gkhanna79/corefx,alexperovich/corefx,alexperovich/corefx,DnlHarvey/corefx,ravimeda/corefx,twsouthwick/corefx,alexperovich/corefx,mmitche/corefx,billwert/corefx,richlander/corefx,jlin177/corefx,stone-li/corefx,tijoytom/corefx,richlander/corefx,alexperovich/corefx,nbarbettini/corefx,wtgodbe/corefx,BrennanConroy/corefx,yizhang82/corefx,jlin177/corefx,Ermiar/corefx,zhenlan/corefx,krk/corefx,cydhaselton/corefx,ericstj/corefx,Ermiar/corefx,fgreinacher/corefx,zhenlan/corefx,the-dwyer/corefx,billwert/corefx,nbarbettini/corefx,axelheer/corefx,krytarowski/corefx,rubo/corefx,stone-li/corefx,rubo/corefx,wtgodbe/corefx,krytarowski/corefx,Ermiar/corefx,DnlHarvey/corefx,twsouthwick/corefx,mazong1123/corefx,fgreinacher/corefx,tijoytom/corefx,yizhang82/corefx,mmitche/corefx,zhenlan/corefx,gkhanna79/corefx,cydhaselton/corefx,parjong/corefx,the-dwyer/corefx,billwert/corefx,ViktorHofer/corefx,ravimeda/corefx,shimingsg/corefx,yizhang82/corefx,gkhanna79/corefx,fgreinacher/corefx,the-dwyer/corefx,MaggieTsang/corefx,krk/corefx,yizhang82/corefx,mazong1123/corefx,axelheer/corefx,tijoytom/corefx
src/System.Configuration.ConfigurationManager/tests/Mono/TestUtil.cs
src/System.Configuration.ConfigurationManager/tests/Mono/TestUtil.cs
// Licensed to the .NET Foundation under one or more agreements. // See the LICENSE file in the project root for more information. // // TestUtil.cs // // Author: // Martin Baulig <martin.baulig@xamarin.com> // // Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.IO; using System.Reflection; namespace MonoTests.System.Configuration.Util { public static class TestUtil { public static void RunWithTempFile(Action<string> action) { using (var temp = new TempDirectory()) { action(temp.GenerateRandomFilePath()); } } // Action<T1,T2> doesn't exist in .NET 2.0 public delegate void MyAction<T1, T2>(T1 t1, T2 t2); public static void RunWithTempFiles(MyAction<string, string> action) { using (var temp = new TempDirectory()) { action(temp.GenerateRandomFilePath(), temp.GenerateRandomFilePath()); } } public static string ThisApplicationPath { get { return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Assembly.GetEntryAssembly().ManifestModule.Name); } } public static string ThisConfigFileName { get { return Assembly.GetEntryAssembly().ManifestModule.Name + ".config"; } } } }
// Licensed to the .NET Foundation under one or more agreements. // See the LICENSE file in the project root for more information. // // TestUtil.cs // // Author: // Martin Baulig <martin.baulig@xamarin.com> // // Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.IO; using System.Reflection; namespace MonoTests.System.Configuration.Util { public static class TestUtil { public static void RunWithTempFile(Action<string> action) { using (var temp = new TempDirectory()) { action(temp.GenerateRandomFilePath()); } } // Action<T1,T2> doesn't exist in .NET 2.0 public delegate void MyAction<T1, T2>(T1 t1, T2 t2); public static void RunWithTempFiles(MyAction<string, string> action) { using (var temp = new TempDirectory()) { action(temp.GenerateRandomFilePath(), temp.GenerateRandomFilePath()); } } public static string ThisApplicationPath { get { var asm = Assembly.GetEntryAssembly(); return asm.Location; } } public static string ThisConfigFileName { get { return Assembly.GetEntryAssembly().GetName().Name + ".config"; } } } }
mit
C#
5ef23eb5df528ace7085bd73af78be66a462adae
Add "PID" alias for Get-Process -Id.
ForNeVeR/Pash,sillvan/Pash,ForNeVeR/Pash,WimObiwan/Pash,sburnicki/Pash,Jaykul/Pash,ForNeVeR/Pash,WimObiwan/Pash,sillvan/Pash,sburnicki/Pash,Jaykul/Pash,WimObiwan/Pash,sburnicki/Pash,mrward/Pash,sillvan/Pash,sillvan/Pash,Jaykul/Pash,mrward/Pash,sburnicki/Pash,WimObiwan/Pash,mrward/Pash,ForNeVeR/Pash,mrward/Pash,Jaykul/Pash
Source/Microsoft.PowerShell.Commands.Management/GetProcessCommand.cs
Source/Microsoft.PowerShell.Commands.Management/GetProcessCommand.cs
// Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/ using System; using System.Management.Automation; using System.Diagnostics; namespace Microsoft.PowerShell.Commands { /// <summary> /// NAME /// Get-Process /// /// DESCRIPTION /// Displays processes running on the system. /// /// RELATED PASH COMMANDS /// Stop-Process /// /// RELATED POSIX COMMANDS /// ps /// </summary> [Cmdlet(VerbsCommon.Get, "Process", DefaultParameterSetName = "Name")] public sealed class GetProcessCommand : Cmdlet { protected override void ProcessRecord() { if (Name != null) foreach (String _name in Name) WriteObject(Process.GetProcessesByName(_name), true); else if (Id != null) foreach (int _id in Id) WriteObject(Process.GetProcessById(_id)); else if (InputObject != null) WriteObject(InputObject, true); else WriteObject(Process.GetProcesses(), true); } /// <summary> /// Return a process that has the given ID. /// </summary> [Alias(new string[] { "PID" }), Parameter( ParameterSetName = "Id", Mandatory = true, ValueFromPipelineByPropertyName = true)] public int[] Id { get; set; } /// <summary> /// Return all process(es) which have the given name. /// </summary> [Alias(new string[] { "ProcessName" }), Parameter( ValueFromPipelineByPropertyName = true, Position = 0, ParameterSetName = "Name"), ValidateNotNullOrEmpty] public String[] Name { get; set; } /// <summary> /// Return processes which match the given object. /// </summary> [Parameter( Mandatory = true, ValueFromPipeline = true, ParameterSetName = "InputObject")] public Process[] InputObject { get; set; } } }
// Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/ using System; using System.Management.Automation; using System.Diagnostics; namespace Microsoft.PowerShell.Commands { /// <summary> /// NAME /// Get-Process /// /// DESCRIPTION /// Displays processes running on the system. /// /// RELATED PASH COMMANDS /// Stop-Process /// /// RELATED POSIX COMMANDS /// ps /// </summary> [Cmdlet(VerbsCommon.Get, "Process", DefaultParameterSetName = "Name")] public sealed class GetProcessCommand : Cmdlet { protected override void ProcessRecord() { if (Name != null) foreach (String _name in Name) WriteObject(Process.GetProcessesByName(_name), true); else if (Id != null) foreach (int _id in Id) WriteObject(Process.GetProcessById(_id)); else if (InputObject != null) WriteObject(InputObject, true); else WriteObject(Process.GetProcesses(), true); } /// <summary> /// Return a process that has the given ID. /// </summary> [Parameter( ParameterSetName = "Id", Mandatory = true, ValueFromPipelineByPropertyName = true)] public int[] Id { get; set; } /// <summary> /// Return all process(es) which have the given name. /// </summary> [Alias(new string[] { "ProcessName" }), Parameter( ValueFromPipelineByPropertyName = true, Position = 0, ParameterSetName = "Name"), ValidateNotNullOrEmpty] public String[] Name { get; set; } /// <summary> /// Return processes which match the given object. /// </summary> [Parameter( Mandatory = true, ValueFromPipeline = true, ParameterSetName = "InputObject")] public Process[] InputObject { get; set; } } }
bsd-3-clause
C#
f49420fa8febb831eeacc36da915a7b2c9868e02
Enable the database creation
coridrew/crisischeckin,RyanBetker/crisischeckin,pottereric/crisischeckin,MobileRez/crisischeckin,MobileRez/crisischeckin,djjlewis/crisischeckin,lloydfaulkner/crisischeckin,andrewhart098/crisischeckin,pottereric/crisischeckin,jplwood/crisischeckin,RyanBetker/crisischeckin,lloydfaulkner/crisischeckin,brunck/crisischeckin,brunck/crisischeckin,mjmilan/crisischeckin,andrewhart098/crisischeckin,pooran/crisischeckin,djjlewis/crisischeckin,mjmilan/crisischeckin,mjmilan/crisischeckin,RyanBetker/crisischeckinUpdates,jsucupira/crisischeckin,mheggeseth/crisischeckin,HTBox/crisischeckin,coridrew/crisischeckin,brunck/crisischeckin,pooran/crisischeckin,HTBox/crisischeckin,mheggeseth/crisischeckin,andrewhart098/crisischeckin,HTBox/crisischeckin,jplwood/crisischeckin,RyanBetker/crisischeckinUpdates,jsucupira/crisischeckin
crisischeckin/crisicheckinweb/App_Start/DbConfig.cs
crisischeckin/crisicheckinweb/App_Start/DbConfig.cs
using System.Data.Entity; using Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace crisicheckinweb { public class DbConfig { public static void Initialize() { Database.SetInitializer<CrisisCheckin>( new MigrateDatabaseToLatestVersion<CrisisCheckin, Models.Migrations.Configuration>()); } } }
using System.Data.Entity; using Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace crisicheckinweb { public class DbConfig { public static void Initialize() { // Database.SetInitializer<CrisisCheckin>( // new MigrateDatabaseToLatestVersion<CrisisCheckin, Models.Migrations.Configuration>()); } } }
apache-2.0
C#
be2665edc87852a7582961a6bb55e8849c41afdf
set default base salary requirement in employee constructor
RandomFractals/payroll,RandomFractals/payroll,RandomFractals/payroll
src/payroll/Models/Employee.cs
src/payroll/Models/Employee.cs
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace payroll.Models { public class Employee : Person { public int EmployeeID { get; set; } [Display(Name = "Salary")] [DisplayFormat(DataFormatString = "{0:C}")] [Required] [Range(10000, 1000000000)] public decimal Salary { get; set; } [Display(Name = "Dependents")] public ICollection<Dependent> Dependents { get; set; } public Employee() { // default salary to: 2000/check * 26 checks/year Salary = 2000 * 26; } } }
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace payroll.Models { public class Employee : Person { public int EmployeeID { get; set; } [Display(Name = "Salary")] [DisplayFormat(DataFormatString = "{0:C}")] [Required] [Range(10000, 1000000000)] public decimal Salary { get; set; } [Display(Name = "Dependents")] public ICollection<Dependent> Dependents { get; set; } } }
mit
C#
229b517f2c7187891aee17e94a3491934e495716
remove claims endpoint
bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core
src/Api/Controllers/MiscController.cs
src/Api/Controllers/MiscController.cs
using System; using Microsoft.AspNetCore.Mvc; using Bit.Core.Models.Api; namespace Bit.Api.Controllers { public class MiscController : Controller { [HttpGet("~/alive")] [HttpGet("~/now")] public DateTime Get() { return DateTime.UtcNow; } [HttpGet("~/version")] public VersionResponseModel Version() { return new VersionResponseModel(); } } }
using System; using Microsoft.AspNetCore.Mvc; using System.Linq; using Bit.Core.Models.Api; namespace Bit.Api.Controllers { public class MiscController : Controller { [HttpGet("~/alive")] [HttpGet("~/now")] public DateTime Get() { return DateTime.UtcNow; } [HttpGet("~/claims")] public IActionResult Claims() { return new JsonResult(User?.Claims?.Select(c => new { c.Type, c.Value })); } [HttpGet("~/version")] public VersionResponseModel Version() { return new VersionResponseModel(); } } }
agpl-3.0
C#
1fdae32e5aa68eadd09274e7195ac05d36ac8d8d
Stop loop early
martincostello/project-euler
src/ProjectEuler/Puzzles/Puzzle047.cs
src/ProjectEuler/Puzzles/Puzzle047.cs
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.ProjectEuler.Puzzles { using System; using System.Linq; /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=47</c>. This class cannot be inherited. /// </summary> public sealed class Puzzle047 : Puzzle { /// <inheritdoc /> public override string Question => "Find the first N consecutive integers to have N distinct prime factors. What is the first of these numbers?"; /// <inheritdoc /> protected override int MinimumArguments => 1; /// <inheritdoc /> protected override int SolveCore(string[] args) { if (!TryParseInt32(args[0], out int factors) || factors < 2) { Console.WriteLine("The specified number of factors is invalid."); return -1; } for (int i = 1; ; i++) { if (Enumerable.Range(i, factors).All((p) => HasPrimeFactors(p, factors))) { Answer = i; break; } } return 0; } /// <summary> /// Returns whether the specified value has the specified /// number of factors that are prime numbers. /// </summary> /// <param name="value">The value to test.</param> /// <param name="count">The number of prime factors to test for.</param> /// <returns> /// <see langword="true"/> if <paramref name="value"/> has exactly /// <paramref name="count"/> prime factors; otherwise <see langword="false"/>. /// </returns> private static bool HasPrimeFactors(int value, int count) { using var enumerator = Maths.GetFactorsUnordered(value).GetEnumerator(); int primes = 0; while (enumerator.MoveNext() && primes < count) { if (Maths.IsPrime(enumerator.Current)) { primes++; } } return primes == count; } } }
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.ProjectEuler.Puzzles { using System; using System.Linq; /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=47</c>. This class cannot be inherited. /// </summary> public sealed class Puzzle047 : Puzzle { /// <inheritdoc /> public override string Question => "Find the first N consecutive integers to have N distinct prime factors. What is the first of these numbers?"; /// <inheritdoc /> protected override int MinimumArguments => 1; /// <inheritdoc /> protected override int SolveCore(string[] args) { if (!TryParseInt32(args[0], out int factors) || factors < 2) { Console.WriteLine("The specified number of factors is invalid."); return -1; } for (int i = 1; ; i++) { if (Enumerable.Range(i, factors).All((p) => HasPrimeFactors(p, factors))) { Answer = i; break; } } return 0; } /// <summary> /// Returns whether the specified value has the specified /// number of factors that are prime numbers. /// </summary> /// <param name="value">The value to test.</param> /// <param name="count">The number of prime factors to test for.</param> /// <returns> /// <see langword="true"/> if <paramref name="value"/> has exactly /// <paramref name="count"/> prime factors; otherwise <see langword="false"/>. /// </returns> private static bool HasPrimeFactors(int value, int count) { return Maths.GetFactorsUnordered(value) .Where(Maths.IsPrime) .Count() == count; } } }
apache-2.0
C#
2a423a2690a1fd09ee180cd6a49fb2afaba5468b
Fix path of load file
GGProductions/LetterStorm,GGProductions/LetterStorm,GGProductions/LetterStorm
Assets/Classes/GGProductions/LetterStorm/Utilities/GameStateUtilities.cs
Assets/Classes/GGProductions/LetterStorm/Utilities/GameStateUtilities.cs
using System.IO; using System.Runtime.Serialization.Formatters.Binary; using GGProductions.LetterStorm.Data; using UnityEngine; namespace GGProductions.LetterStorm.Utilities { public static class GameStateUtilities { #region Load State ---------------------------------------------------- /// <summary> /// Load all player data from persistent storage /// </summary> public static PlayerData Load() { PlayerData loadedData = null; // If the save file exists... //if (File.Exists("C:/Users/David/AppData/LocalLow/Unity" + "/playerInfo.dat")) if (File.Exists(Application.persistentDataPath + "/playerInfo.dat")) { // Open up the save file for reading //FileStream file = File.Open("C:/Users/David/AppData/LocalLow/Unity" + "/playerInfo.dat", FileMode.Open); FileStream file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open); // Create a binary formatter and use it to deserialize the PlayerData from the save file BinaryFormatter bf = new BinaryFormatter(); loadedData = (PlayerData)bf.Deserialize(file); // Close stream to the release lock on file file.Close(); } return loadedData; } #endregion Load State ------------------------------------------------- #region Save State ---------------------------------------------------- /// <summary> /// Save all player data to persistent storage for future access /// </summary> public static void Save(PlayerData dataToSave) { // Open up the save file for writing, creating it if it does not already exist FileStream file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open); //FileStream file = File.Create("C:/Users/David/AppData/LocalLow/Unity" + "/playerInfo.dat"); // Create a binary formatter and use it to serialize the PlayerData to the save file BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(file, dataToSave); // Close stream to the save file file.Close(); } #endregion Save State ------------------------------------------------- } }
using System.IO; using System.Runtime.Serialization.Formatters.Binary; using GGProductions.LetterStorm.Data; using UnityEngine; namespace GGProductions.LetterStorm.Utilities { public static class GameStateUtilities { #region Load State ---------------------------------------------------- /// <summary> /// Load all player data from persistent storage /// </summary> public static PlayerData Load() { PlayerData loadedData = null; //if (File.Exists("C:/Users/David/AppData/LocalLow/Unity" + "/playerInfo.dat")) if (File.Exists(Application.persistentDataPath + "/playerInfo.dat")) { FileStream file = File.Open("C:/Users/David/AppData/LocalLow/Unity" + "/playerInfo.dat", FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); loadedData = (PlayerData)bf.Deserialize(file); file.Close(); } return loadedData; } #endregion Load State ------------------------------------------------- #region Save State ---------------------------------------------------- /// <summary> /// Save all player data to persistent storage for future access /// </summary> public static void Save(PlayerData dataToSave) { // Open up the save file for writing, creating it if it does not already exist FileStream file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open); //FileStream file = File.Create("C:/Users/David/AppData/LocalLow/Unity" + "/playerInfo.dat"); // Create a binary formatter and use it to serialize this object to the save file BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(file, dataToSave); // Close stream to the save file file.Close(); } #endregion Save State ------------------------------------------------- } }
mit
C#
4d93214a4c8bdccc8867cd6942dcc73065494934
Improve the md5 verifier test a bist
asarium/FSOLauncher
Tests/ModInstallation.Tests/Implementations/Mods/MD5FileVerifierTests.cs
Tests/ModInstallation.Tests/Implementations/Mods/MD5FileVerifierTests.cs
#region Usings using System; using System.IO; using System.Reflection; using System.Threading; using System.Threading.Tasks; using ModInstallation.Annotations; using ModInstallation.Implementations.Mods; using NUnit.Framework; #endregion namespace ModInstallation.Tests.Implementations.Mods { [TestFixture] public class MD5FileVerifierTests { #region Setup/Teardown [SetUp] public void ExtractTestFile() { var assembly = Assembly.GetExecutingAssembly(); var dirPath = Path.GetDirectoryName(_outPath); if (dirPath != null) { if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } } using (var stream = assembly.GetManifestResourceStream("ModInstallation.Tests.TestData.random.txt")) { if (stream == null) { throw new InvalidOperationException("Couldn't find test resource in assembly!"); } using (var outStream = File.Open(_outPath, FileMode.Create, FileAccess.Write)) { stream.CopyTo(outStream); } } } [TearDown] public void CleanUp() { if (File.Exists(_outPath)) { File.Delete(_outPath); } } #endregion private readonly string _outPath = Path.Combine(TestContext.CurrentContext.WorkDirectory, TestContext.CurrentContext.Test.Name, "random.txt"); [NotNull, Test] public async Task TestVerifyFilePathAsync() { var md5Verifier = new Md5FileVerifier("F887CEE5C513F2C93D76BF47F7AD71C9"); Assert.IsTrue(await md5Verifier.VerifyFilePathAsync(_outPath, CancellationToken.None, null)); Assert.IsFalse(await md5Verifier.VerifyFilePathAsync(Assembly.GetExecutingAssembly().Location, CancellationToken.None, null)); } } }
#region Usings using System; using System.IO; using System.Reflection; using System.Threading; using System.Threading.Tasks; using ModInstallation.Annotations; using ModInstallation.Implementations.Mods; using NUnit.Framework; #endregion namespace ModInstallation.Tests.Implementations.Mods { [TestFixture] public class MD5FileVerifierTests { #region Setup/Teardown [SetUp] public void ExtractTestFile() { var assembly = Assembly.GetExecutingAssembly(); using (var stream = assembly.GetManifestResourceStream("ModInstallation.Tests.TestData.random.txt")) { if (stream == null) { throw new InvalidOperationException("Couldn't find test resource in assembly!"); } using (var outStream = File.Open(_outPath, FileMode.Create, FileAccess.Write)) { stream.CopyTo(outStream); } } } [TearDown] public void CleanUp() { if (File.Exists(_outPath)) { File.Delete(_outPath); } } #endregion private readonly string _outPath = Path.Combine(Path.GetTempPath(), "random.txt"); [NotNull, Test] public async Task TestVerifyFilePathAsync() { var md5Verifier = new Md5FileVerifier("F887CEE5C513F2C93D76BF47F7AD71C9"); Assert.IsTrue(await md5Verifier.VerifyFilePathAsync(_outPath, CancellationToken.None, null)); Assert.IsFalse(await md5Verifier.VerifyFilePathAsync(Assembly.GetExecutingAssembly().Location, CancellationToken.None, null)); } } }
mit
C#
8d40eb6ba0daf0edfbe767527619247c77420c89
clean up code
Weingartner/Migrations.Json.Net
Weingartner.Json.Migration.Roslyn_/Constants.cs
Weingartner.Json.Migration.Roslyn_/Constants.cs
namespace Weingartner.Json.Migration.Roslyn { public static class Constants { public const string MigratableAttributeMetadataName = "Weingartner.Json.Migration.MigratableAttribute"; public const string DataContractAttributeMetadataName = "System.Runtime.Serialization.DataContractAttribute"; public const string DataMemberAttributeMetadataName = "System.Runtime.Serialization.DataMemberAttribute"; } }
namespace Weingartner.Json.Migration.Roslyn { public static class Constants { public const string MigratableAttributeMetadataName = "Weingartner.Json.Migration.MigratableAttribute"; public const string DataContractAttributeMetadataName = "System.Runtime.Serialization.DataContractAttribute"; public const string DataMemberAttributeMetadataName = "System.Runtime.Serialization.DataMemberAttribute"; } }
mit
C#
708a72a5c34e2e62fdc7d4e1a8af414c895cad7d
Remove sideload manifest during clean
Thealexbarney/VGAudio,Thealexbarney/VGAudio,Thealexbarney/LibDspAdpcm,Thealexbarney/LibDspAdpcm
build/Tasks/Clean.cs
build/Tasks/Clean.cs
using Cake.Common.IO; using Cake.Core.IO; using Cake.Frosting; using static Build.Utilities.Runners; namespace Build.Tasks { public sealed class CleanBuild : FrostingTask<Context> { public override void Run(Context context) { DirectoryPathCollection directories = context.GetDirectories($"{context.SourceDir}/**/obj"); directories += context.GetDirectories($"{context.SourceDir}/**/bin"); directories += context.UwpDir.Combine("AppPackages"); directories += context.UwpDir.Combine("BundleArtifacts"); foreach (DirectoryPath path in directories) { DeleteDirectory(context, path, true); } FilePathCollection files = context.GetFiles($"{context.UwpDir}/_scale-*.appx"); files += context.GetFiles($"{context.UwpDir}/*.nuget.props"); files += context.GetFiles($"{context.UwpDir}/*.nuget.targets"); files += context.GetFiles($"{context.UwpDir}/*.csproj.user"); files += context.UwpDir.CombineWithFilePath("_pkginfo.txt"); files += context.UwpDir.CombineWithFilePath("project.lock.json"); files += context.UwpSideloadManifest; foreach (FilePath file in files) { DeleteFile(context, file, true); } } } public sealed class CleanBin : FrostingTask<Context> { public override void Run(Context context) => DeleteDirectory(context, context.BinDir, true); } public sealed class CleanTopBin : FrostingTask<Context> { public override void Run(Context context) => DeleteDirectory(context, context.TopBinDir, true); } public sealed class CleanPackage : FrostingTask<Context> { public override void Run(Context context) => DeleteDirectory(context, context.PackageDir, true); } }
using Cake.Common.IO; using Cake.Core.IO; using Cake.Frosting; using static Build.Utilities.Runners; namespace Build.Tasks { public sealed class CleanBuild : FrostingTask<Context> { public override void Run(Context context) { DirectoryPathCollection directories = context.GetDirectories($"{context.SourceDir}/**/obj"); directories += context.GetDirectories($"{context.SourceDir}/**/bin"); directories += context.UwpDir.Combine("AppPackages"); directories += context.UwpDir.Combine("BundleArtifacts"); foreach (DirectoryPath path in directories) { DeleteDirectory(context, path, true); } FilePathCollection files = context.GetFiles($"{context.UwpDir}/_scale-*.appx"); files += context.GetFiles($"{context.UwpDir}/*.nuget.props"); files += context.GetFiles($"{context.UwpDir}/*.nuget.targets"); files += context.GetFiles($"{context.UwpDir}/*.csproj.user"); files += context.UwpDir.CombineWithFilePath("_pkginfo.txt"); files += context.UwpDir.CombineWithFilePath("project.lock.json"); foreach (FilePath file in files) { DeleteFile(context, file, true); } } } public sealed class CleanBin : FrostingTask<Context> { public override void Run(Context context) => DeleteDirectory(context, context.BinDir, true); } public sealed class CleanTopBin : FrostingTask<Context> { public override void Run(Context context) => DeleteDirectory(context, context.TopBinDir, true); } public sealed class CleanPackage : FrostingTask<Context> { public override void Run(Context context) => DeleteDirectory(context, context.PackageDir, true); } }
mit
C#
c2af068e42a2d215cfdfce71acc4deff7d347727
Apply Parser
occar421/OpenTKAnalyzer
src/OpenTKAnalyzer/OpenTKAnalyzer/OpenTK_/Graphics_/OpenGL_/RotationValueOpenGLAnalyzer.cs
src/OpenTKAnalyzer/OpenTKAnalyzer/OpenTK_/Graphics_/OpenGL_/RotationValueOpenGLAnalyzer.cs
using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using OpenTK.Graphics.OpenGL; using OpenTKAnalyzer.Utility; namespace OpenTKAnalyzer.OpenTK_.Graphics_.OpenGL_ { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class RotationValueOpenGLAnalyzer : DiagnosticAnalyzer { public const string DiagnosticId = "RotatinoValueOpenGL"; private const string Title = "Rotation value(OpenGL)"; private const string MessageFormat = nameof(GL) + "." + nameof(GL.Rotate) + " accepts degree value."; private const string Description = "Warm on literal in argument seems invalid style(radian or degree)."; private const string Category = nameof(OpenTKAnalyzer) + ":" + nameof(OpenTK.Graphics.OpenGL); internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor( id: DiagnosticId, title: Title, messageFormat: MessageFormat, category: Category, defaultSeverity: DiagnosticSeverity.Info, isEnabledByDefault: true, description: Description); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule); public override void Initialize(AnalysisContext context) { context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.InvocationExpression); } private static void Analyze(SyntaxNodeAnalysisContext context) { var invocation = context.Node as InvocationExpressionSyntax; // no arguments method filter if (!invocation.ArgumentList.Arguments.Any()) { return; } if (invocation.GetFirstToken().ValueText == nameof(GL)) { if (invocation.Expression.GetLastToken().ValueText == nameof(GL.Rotate)) { DegreeValueAnalyze(context, invocation); } } } private static void DegreeValueAnalyze(SyntaxNodeAnalysisContext context, InvocationExpressionSyntax invocation) { double result; var argumentExpression = invocation.ArgumentList.Arguments.FirstOrDefault()?.Expression; if (NumericValueParser.TryParseFromExpression(argumentExpression, out result)) { // perhaps degree value under 2PI is incorrect if (Math.Abs(result) <= 2 * Math.PI) { context.ReportDiagnostic(Diagnostic.Create( descriptor: Rule, location: argumentExpression.GetLocation())); } } } } }
using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using OpenTK.Graphics.OpenGL; namespace OpenTKAnalyzer.OpenTK_.Graphics_.OpenGL_ { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class RotationValueOpenGLAnalyzer : DiagnosticAnalyzer { public const string DiagnosticId = "RotatinoValueOpenGL"; private const string Title = "Rotation value(OpenGL)"; private const string MessageFormat = nameof(GL) + "." + nameof(GL.Rotate) + " accepts degree value."; private const string Description = "Warm on literal in argument seems invalid style(radian or degree)."; private const string Category = nameof(OpenTKAnalyzer) + ":" + nameof(OpenTK.Graphics.OpenGL); internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor( id: DiagnosticId, title: Title, messageFormat: MessageFormat, category: Category, defaultSeverity: DiagnosticSeverity.Info, isEnabledByDefault: true, description: Description); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule); public override void Initialize(AnalysisContext context) { context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.InvocationExpression); } private static void Analyze(SyntaxNodeAnalysisContext context) { var invotation = context.Node as InvocationExpressionSyntax; // no arguments method filter if (!invotation.ArgumentList.Arguments.Any()) { return; } if (invotation.GetFirstToken().ValueText == nameof(GL)) { if (invotation.Expression.GetLastToken().ValueText == nameof(GL.Rotate)) { var literal = invotation.ArgumentList.Arguments.First().Expression as LiteralExpressionSyntax; double result; if (double.TryParse(literal?.Token.ValueText, out result)) { // perhaps degree value under 2PI is incorrect if (Math.Abs(result) <= 2 * Math.PI) { context.ReportDiagnostic(Diagnostic.Create( descriptor: Rule, location: literal.GetLocation())); } } } } } } }
mit
C#
1fbb98dd9f6da67f9373f3693ae2c2dbf7f73e83
fix key not being stored
ArsenShnurkov/BitSharp
BitSharp.Storage/MissingDataException.cs
BitSharp.Storage/MissingDataException.cs
using BitSharp.Common; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BitSharp.Storage { public enum DataType { Block, BlockHeader, ChainedBlock, Transaction } public class MissingDataException : Exception { private readonly object key; public MissingDataException(object key) { this.key = key; } public object Key { get { return this.key; } } } }
using BitSharp.Common; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BitSharp.Storage { public enum DataType { Block, BlockHeader, ChainedBlock, Transaction } public class MissingDataException : Exception { private readonly object key; public MissingDataException(object key) { } public object Key { get { return this.key; } } } }
unlicense
C#
f1c4529fc7df3b983a692c147c65cbb6b3b586c9
Change TeamArea heal and damage quantity
bunashibu/kikan
Assets/Scripts/TeamArea.cs
Assets/Scripts/TeamArea.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Assertions; namespace Bunashibu.Kikan { public class TeamArea : Photon.MonoBehaviour, IAttacker, IPhotonBehaviour { void Awake() { _synchronizer = GetComponent<SkillSynchronizer>(); } void OnTriggerStay2D(Collider2D collider) { var targetObj = collider.gameObject; if (targetObj.tag != "Player") return; var target = targetObj.GetComponent<Player>(); if (!target.PhotonView.isMine) return; if (target.PlayerInfo.Team == _team) { if (target.Hp.Cur.Value == target.Hp.Max.Value) return; if (Time.time - _healTimestamp > _healInterval) { _synchronizer.SyncHeal(target.PhotonView.viewID, (int)(target.Hp.Max.Value / 3.0f)); _healTimestamp = Time.time; } } else { if (target.State.Invincible) return; target.State.Invincible = true; MonoUtility.Instance.DelaySec(_damageInterval, () => { target.State.Invincible = false; } ); _synchronizer.SyncAttack(photonView.viewID, target.PhotonView.viewID, (int)(target.Hp.Max.Value / 3.0f), false, HitEffectType.None); } } public PhotonView PhotonView => photonView; public int Power => 0; public int Critical => 0; [SerializeField] private int _team; private SkillSynchronizer _synchronizer; private float _healInterval = 1.0f; private float _damageInterval = 1.0f; private float _healTimestamp; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Assertions; namespace Bunashibu.Kikan { public class TeamArea : Photon.MonoBehaviour, IAttacker, IPhotonBehaviour { void Awake() { _synchronizer = GetComponent<SkillSynchronizer>(); } void OnTriggerStay2D(Collider2D collider) { var targetObj = collider.gameObject; if (targetObj.tag != "Player") return; var target = targetObj.GetComponent<Player>(); if (!target.PhotonView.isMine) return; if (target.PlayerInfo.Team == _team) { if (target.Hp.Cur.Value == target.Hp.Max.Value) return; if (Time.time - _healTimestamp > _healInterval) { _synchronizer.SyncHeal(target.PhotonView.viewID, _quantity); _healTimestamp = Time.time; } } else { if (target.State.Invincible) return; target.State.Invincible = true; MonoUtility.Instance.DelaySec(_damageInterval, () => { target.State.Invincible = false; } ); _synchronizer.SyncAttack(photonView.viewID, target.PhotonView.viewID, _quantity, false, HitEffectType.None); } } public PhotonView PhotonView => photonView; public int Power => _quantity; public int Critical => 0; [SerializeField] private int _team; [SerializeField] private int _quantity; private SkillSynchronizer _synchronizer; private float _healInterval = 1.0f; private float _damageInterval = 1.0f; private float _healTimestamp; } }
mit
C#
a1b92810641ad47859919cd521e7922061639112
Fix tabs/spaces in test site startup
msarchet/Bundler,msarchet/Bundler
BundlerTestSite/Startup.cs
BundlerTestSite/Startup.cs
using System; using System.Threading.Tasks; using Microsoft.Owin; using Owin; using BundlerMiddleware; [assembly: OwinStartup(typeof(BundlerTestSite.Startup))] namespace BundlerTestSite { public class Startup { public static BundlerRouteTable MarkdownRoutes = new BundlerRouteTable(); public static BundlerRouteTable MarkdownRoutesWithTemplate = new BundlerRouteTable(); public void Configuration(IAppBuilder app) { app.UseBundlerMiddlewareForIIS(); app.UseBundlerMarkdown(MarkdownRoutes); app.UseBundlerMarkdownWithTempalte("~/markdown/markdowntemplate.html", MarkdownRoutesWithTemplate); } } }
using System; using System.Threading.Tasks; using Microsoft.Owin; using Owin; using BundlerMiddleware; [assembly: OwinStartup(typeof(BundlerTestSite.Startup))] namespace BundlerTestSite { public class Startup { public static BundlerRouteTable MarkdownRoutes = new BundlerRouteTable(); public static BundlerRouteTable MarkdownRoutesWithTemplate = new BundlerRouteTable(); public void Configuration(IAppBuilder app) { app.UseBundlerMiddlewareForIIS(); app.UseBundlerMarkdown(MarkdownRoutes); app.UseBundlerMarkdownWithTempalte("~/markdown/markdowntemplate.html", MarkdownRoutesWithTemplate); } } }
mit
C#
d951d131c1e88f278bc85a413c4c322adb7a3e42
Fix naming convention.
adz21c/miles
Miles.MassTransit/Courier/QueueNameGenerateExtensions.cs
Miles.MassTransit/Courier/QueueNameGenerateExtensions.cs
using Miles.Messaging; using System; using System.Reflection; namespace Miles.MassTransit.Courier { public static class QueueNameGenerateExtensions { private const string Arguments = "Arguments"; private const string Log = "Log"; private const string Compensate = "Compensate"; public static string GenerateExecutionQueueName(this Type type) { return GenerateQueueName(type, Arguments); } public static string GenerateCompensationQueueName(this Type type) { return GenerateQueueName(type, Log, Compensate); } private static string GenerateQueueName(Type type, string remove, string append = "") { string baseQueueName; var queueNameAttrib = type.GetCustomAttribute<QueueNameAttribute>(); if (queueNameAttrib == null) baseQueueName = (type.Name.EndsWith(remove) ? type.Name.Substring(0, type.Name.Length - remove.Length) : type.Name) + append; else baseQueueName = queueNameAttrib.Name; return type.GetQueuePrefix() + baseQueueName + type.GetQueueSuffix(); } } }
using Miles.Messaging; using System; using System.Reflection; namespace Miles.MassTransit.Courier { public static class QueueNameGenerateExtensions { private const string Arguments = "Arguments"; private const string Logs = "Logs"; private const string Compensate = "Compensate"; public static string GenerateExecutionQueueName(this Type type) { return GenerateQueueName(type, Arguments); } public static string GenerateCompensationQueueName(this Type type) { return GenerateQueueName(type, Logs, Compensate); } private static string GenerateQueueName(Type type, string remove, string append = "") { string baseQueueName; var queueNameAttrib = type.GetCustomAttribute<QueueNameAttribute>(); if (queueNameAttrib == null) baseQueueName = (type.Name.EndsWith(remove) ? type.Name.Substring(0, type.Name.Length - remove.Length) : type.Name) + append; else baseQueueName = queueNameAttrib.Name; return type.GetQueuePrefix() + baseQueueName + type.GetQueueSuffix(); } } }
apache-2.0
C#
13d6a501ff247dfa84d67de912468c3585084794
Test commit of new line endings
rob-somerville/riak-dotnet-client,basho/riak-dotnet-client,basho/riak-dotnet-client,rob-somerville/riak-dotnet-client
CorrugatedIron.Tests.Live/RiakDtTests.cs
CorrugatedIron.Tests.Live/RiakDtTests.cs
// Copyright (c) 2011 - OJ Reeves & Jeremiah Peschka // // This file is provided to you under the Apache License, // Version 2.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain // a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. using CorrugatedIron.Tests.Live.LiveRiakConnectionTests; using NUnit.Framework; namespace CorrugatedIron.Tests.Live { [TestFixture] public class RiakDtTests : LiveRiakConnectionTestBase { private const string Bucket = "riak_dt_bucket"; /// <summary> /// The tearing of the down, it is done here. /// </summary> [TearDown] public void TearDown() { Client.DeleteBucket(Bucket); } } }
// Copyright (c) 2011 - OJ Reeves & Jeremiah Peschka // // This file is provided to you under the Apache License, // Version 2.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain // a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. using CorrugatedIron.Tests.Live.LiveRiakConnectionTests; using NUnit.Framework; namespace CorrugatedIron.Tests.Live { [TestFixture] public class RiakDtTests : LiveRiakConnectionTestBase { private const string Bucket = "riak_dt_bucket"; [TearDown] public void TearDown() { Client.DeleteBucket(Bucket); } } }
apache-2.0
C#
c93003917043154780ae94243795a0b1f3dae7b0
Fix nullreference when numberOfOccurrences isn't defined but the process has been activated
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
src/Arkivverket.Arkade/Core/Addml/Processes/ControlNumberOfRecords.cs
src/Arkivverket.Arkade/Core/Addml/Processes/ControlNumberOfRecords.cs
using Arkivverket.Arkade.Tests; namespace Arkivverket.Arkade.Core.Addml.Processes { public class ControlNumberOfRecords : IAddmlProcess { private const string Name = "Control_NumberOfRecords"; private readonly TestRun _testRun; private FlatFile _currentFlatFile; private int _numberOfOcurrencesForCurrentFile; public ControlNumberOfRecords() { _testRun = new TestRun(GetType().FullName, TestType.Content); } public string GetName() { return Name; } public void Run(FlatFile flatFile) { _numberOfOcurrencesForCurrentFile = 0; _currentFlatFile = flatFile; } public TestRun GetTestRun() { return _testRun; } public void Run(Field field) { } public void EndOfFile() { if (!_currentFlatFile.Definition.NumberOfRecords.HasValue) { _testRun.Add(new TestResult(ResultType.Error, new Location(_currentFlatFile.Definition.FileName), "Expected number of records not specified. Unable to control number of records.")); return; } int expectedNumberOfRecords = _currentFlatFile.Definition.NumberOfRecords.Value; if (expectedNumberOfRecords > 0) { if (expectedNumberOfRecords == _numberOfOcurrencesForCurrentFile) { _testRun.Add(new TestResult(ResultType.Success, new Location(_currentFlatFile.Definition.FileName), $"Number of records ({expectedNumberOfRecords}) matched for file {_currentFlatFile.Definition.FileName}.")); } else { _testRun.Add(new TestResult(ResultType.Error, new Location(_currentFlatFile.Definition.FileName), $"Number of records did not match for file {_currentFlatFile.Definition.FileName}. Expected {expectedNumberOfRecords}, found {_numberOfOcurrencesForCurrentFile}. ")); } } } public void Run(Record record) { _numberOfOcurrencesForCurrentFile++; } } }
using Arkivverket.Arkade.Tests; namespace Arkivverket.Arkade.Core.Addml.Processes { public class ControlNumberOfRecords : IAddmlProcess { private const string Name = "Control_NumberOfRecords"; private readonly TestRun _testRun; private FlatFile _currentFlatFile; private int _numberOfOcurrencesForCurrentFile; public ControlNumberOfRecords() { _testRun = new TestRun(GetType().FullName, TestType.Content); } public string GetName() { return Name; } public void Run(FlatFile flatFile) { _numberOfOcurrencesForCurrentFile = 0; _currentFlatFile = flatFile; } public TestRun GetTestRun() { return _testRun; } public void Run(Field field) { } public void EndOfFile() { int expectedNumberOfRecords = _currentFlatFile.Definition.NumberOfRecords.Value; if (expectedNumberOfRecords > 0) { if (expectedNumberOfRecords == _numberOfOcurrencesForCurrentFile) { _testRun.Add(new TestResult(ResultType.Success, new Location(_currentFlatFile.Definition.FileName), $"Number of records ({expectedNumberOfRecords}) matched for file {_currentFlatFile.Definition.FileName}.")); } else { _testRun.Add(new TestResult(ResultType.Error, new Location(_currentFlatFile.Definition.FileName), $"Number of records did not match for file {_currentFlatFile.Definition.FileName}. Expected {expectedNumberOfRecords}, found {_numberOfOcurrencesForCurrentFile}. ")); } } } public void Run(Record record) { _numberOfOcurrencesForCurrentFile++; } } }
agpl-3.0
C#
db53f78f0a9b489ee31d270b6c07dc108166d723
Update UserManager.cs
aspnetboilerplate/module-zero-template,aspnetboilerplate/module-zero-template,aspnetboilerplate/module-zero-template
src/AbpCompanyName.AbpProjectName.Core/Authorization/Users/UserManager.cs
src/AbpCompanyName.AbpProjectName.Core/Authorization/Users/UserManager.cs
using Abp.Authorization; using Abp.Authorization.Users; using Abp.Configuration; using Abp.Domain.Repositories; using Abp.Domain.Uow; using Abp.IdentityFramework; using Abp.Localization; using Abp.Organizations; using Abp.Runtime.Caching; using AbpCompanyName.AbpProjectName.Authorization.Roles; namespace AbpCompanyName.AbpProjectName.Authorization.Users { public class UserManager : AbpUserManager<Role, User> { public UserManager( UserStore userStore, RoleManager roleManager, IPermissionManager permissionManager, IUnitOfWorkManager unitOfWorkManager, ICacheManager cacheManager, IRepository<OrganizationUnit, long> organizationUnitRepository, IRepository<UserOrganizationUnit, long> userOrganizationUnitRepository, IOrganizationUnitSettings organizationUnitSettings, ILocalizationManager localizationManager, ISettingManager settingManager, IdentityEmailMessageService emailService, IUserTokenProviderAccessor userTokenProviderAccessor, IRepository<UserLogin,long> userLogin) : base( userStore, roleManager, permissionManager, unitOfWorkManager, cacheManager, organizationUnitRepository, userOrganizationUnitRepository, organizationUnitSettings, localizationManager, emailService, settingManager, userTokenProviderAccessor, userLogin) { } } }
using Abp.Authorization; using Abp.Authorization.Users; using Abp.Configuration; using Abp.Domain.Repositories; using Abp.Domain.Uow; using Abp.IdentityFramework; using Abp.Localization; using Abp.Organizations; using Abp.Runtime.Caching; using AbpCompanyName.AbpProjectName.Authorization.Roles; namespace AbpCompanyName.AbpProjectName.Authorization.Users { public class UserManager : AbpUserManager<Role, User> { public UserManager( UserStore userStore, RoleManager roleManager, IPermissionManager permissionManager, IUnitOfWorkManager unitOfWorkManager, ICacheManager cacheManager, IRepository<OrganizationUnit, long> organizationUnitRepository, IRepository<UserOrganizationUnit, long> userOrganizationUnitRepository, IOrganizationUnitSettings organizationUnitSettings, ILocalizationManager localizationManager, ISettingManager settingManager, IdentityEmailMessageService emailService, IUserTokenProviderAccessor userTokenProviderAccessor) : base( userStore, roleManager, permissionManager, unitOfWorkManager, cacheManager, organizationUnitRepository, userOrganizationUnitRepository, organizationUnitSettings, localizationManager, emailService, settingManager, userTokenProviderAccessor) { } } }
mit
C#
a459f10eea1f72c6d17b750eda87bee6831cc3a5
Check that Data dictionary accepts string keys.
tdiehl/raygun4net,nelsonsar/raygun4net,ddunkin/raygun4net,MindscapeHQ/raygun4net,articulate/raygun4net,articulate/raygun4net,tdiehl/raygun4net,ddunkin/raygun4net,MindscapeHQ/raygun4net,nelsonsar/raygun4net,MindscapeHQ/raygun4net
Mindscape.Raygun4Net/RaygunClientBase.cs
Mindscape.Raygun4Net/RaygunClientBase.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Mindscape.Raygun4Net { public class RaygunClientBase { protected internal const string SentKey = "AlreadySentByRaygun"; protected bool CanSend(Exception exception) { return exception == null || exception.Data == null || !exception.Data.Contains(SentKey) || false.Equals(exception.Data[SentKey]); } protected void FlagAsSent(Exception exception) { if (exception != null && exception.Data != null) { try { Type[] genericTypes = exception.Data.GetType().GetGenericArguments(); if (genericTypes.Length > 0 && genericTypes[0].IsAssignableFrom(typeof(string))) { exception.Data[SentKey] = true; } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(String.Format("Failed to flag exception as sent: {0}", ex.Message)); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Mindscape.Raygun4Net { public class RaygunClientBase { protected internal const string SentKey = "AlreadySentByRaygun"; protected bool CanSend(Exception exception) { return exception == null || !exception.Data.Contains(SentKey) || false.Equals(exception.Data[SentKey]); } protected void FlagAsSent(Exception exception) { if (exception != null) { exception.Data[SentKey] = true; } } } }
mit
C#
2b948660c4c8d12d487b3da07520a232f3409a47
Remove SecurityTransparent from Server
RichiCoder1/nuget-chocolatey,anurse/NuGet,rikoe/nuget,pratikkagda/nuget,indsoft/NuGet2,pratikkagda/nuget,mrward/nuget,antiufo/NuGet2,xoofx/NuGet,OneGet/nuget,pratikkagda/nuget,ctaggart/nuget,antiufo/NuGet2,GearedToWar/NuGet2,jholovacs/NuGet,indsoft/NuGet2,kumavis/NuGet,GearedToWar/NuGet2,kumavis/NuGet,zskullz/nuget,rikoe/nuget,RichiCoder1/nuget-chocolatey,antiufo/NuGet2,antiufo/NuGet2,xoofx/NuGet,mono/nuget,mono/nuget,pratikkagda/nuget,oliver-feng/nuget,chester89/nugetApi,themotleyfool/NuGet,xoofx/NuGet,pratikkagda/nuget,xoofx/NuGet,mrward/nuget,jmezach/NuGet2,themotleyfool/NuGet,indsoft/NuGet2,zskullz/nuget,antiufo/NuGet2,mrward/NuGet.V2,alluran/node.net,xoofx/NuGet,jmezach/NuGet2,jholovacs/NuGet,jmezach/NuGet2,indsoft/NuGet2,mrward/NuGet.V2,RichiCoder1/nuget-chocolatey,RichiCoder1/nuget-chocolatey,ctaggart/nuget,indsoft/NuGet2,zskullz/nuget,antiufo/NuGet2,alluran/node.net,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,chocolatey/nuget-chocolatey,mrward/NuGet.V2,dolkensp/node.net,oliver-feng/nuget,mrward/nuget,OneGet/nuget,GearedToWar/NuGet2,xoofx/NuGet,chocolatey/nuget-chocolatey,xero-github/Nuget,indsoft/NuGet2,ctaggart/nuget,pratikkagda/nuget,OneGet/nuget,jmezach/NuGet2,GearedToWar/NuGet2,atheken/nuget,GearedToWar/NuGet2,akrisiun/NuGet,dolkensp/node.net,oliver-feng/nuget,themotleyfool/NuGet,anurse/NuGet,oliver-feng/nuget,jholovacs/NuGet,mrward/NuGet.V2,mono/nuget,jholovacs/NuGet,chocolatey/nuget-chocolatey,chocolatey/nuget-chocolatey,rikoe/nuget,OneGet/nuget,mono/nuget,GearedToWar/NuGet2,jholovacs/NuGet,zskullz/nuget,atheken/nuget,jholovacs/NuGet,mrward/nuget,dolkensp/node.net,mrward/nuget,chester89/nugetApi,jmezach/NuGet2,akrisiun/NuGet,rikoe/nuget,ctaggart/nuget,jmezach/NuGet2,alluran/node.net,dolkensp/node.net,mrward/nuget,alluran/node.net,chocolatey/nuget-chocolatey,oliver-feng/nuget,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,oliver-feng/nuget,chocolatey/nuget-chocolatey
NuPack.Server/Properties/AssemblyInfo.cs
NuPack.Server/Properties/AssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("NuGet.Server")] [assembly: AssemblyDescription("Sample Web Application used to host a read-only NuGet feed")]
using System.Reflection; using System.Security; [assembly: AssemblyTitle("NuGet.Server")] [assembly: AssemblyDescription("Sample Web Application used to host a read-only NuGet feed")] [assembly: SecurityTransparent]
apache-2.0
C#
d0c6023d26199c10b33f35b1a24a5459f8c497b9
Add docs
mavasani/roslyn,dotnet/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn
src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/VSTypeScriptWellKnownSymbolTypes.cs
src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/VSTypeScriptWellKnownSymbolTypes.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api { internal static class VSTypeScriptWellKnownSymbolTypes { /// <summary> /// Exists for binary compat. Not actually used for any purpose. /// </summary> public const string Definition = nameof(Definition); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api { internal static class VSTypeScriptWellKnownSymbolTypes { public const string Definition = nameof(Definition); } }
mit
C#
5f768ac41acca35a32f0501fe9014c14252d6ab9
Fix path
chrarnoldus/VulkanRenderer,chrarnoldus/VulkanRenderer,chrarnoldus/VulkanRenderer
VulkanRendererApprovals/ApprovalTests.cs
VulkanRendererApprovals/ApprovalTests.cs
using ImageMagick; using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using Xunit; namespace VulkanRendererApprovals { public class ApprovalTests { static void RenderModel(string modelPath, [CallerMemberName] string callerMemberName = null, [CallerFilePath] string callerFilePath = null) { var directoryName = Path.GetDirectoryName(callerFilePath); var process = Process.Start(new ProcessStartInfo { FileName = Path.Combine(directoryName, "..\\VulkanRenderer\\out\\build\\x64-Release\\VulkanRenderer.exe"), WorkingDirectory = directoryName, Arguments = $"--model \"{modelPath}\" --image \"Images\\{callerMemberName}.received.png\"" }); process.WaitForExit(); Assert.Equal(0, process.ExitCode); } static void VerifyImage([CallerMemberName] string callerMemberName = null, [CallerFilePath] string callerFilePath = null) { var directoryName = Path.GetDirectoryName(callerFilePath); using (var approved = new MagickImage(Path.Combine(directoryName, $"Images\\{callerMemberName}.approved.png"))) using (var received = new MagickImage(Path.Combine(directoryName, $"Images\\{callerMemberName}.received.png"))) { Assert.Equal(0, approved.Compare(received, ErrorMetric.Absolute)); } } [Fact] public void Bunny() { RenderModel("Models\\bun_zipper.ply"); VerifyImage(); } } }
using ImageMagick; using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using Xunit; namespace VulkanRendererApprovals { public class ApprovalTests { static void RenderModel(string modelPath, [CallerMemberName] string callerMemberName = null, [CallerFilePath] string callerFilePath = null) { var directoryName = Path.GetDirectoryName(callerFilePath); var process = Process.Start(new ProcessStartInfo { FileName = Path.Combine(directoryName, "../x64/Release/VulkanRenderer.exe"), WorkingDirectory = directoryName, Arguments = $"--model \"{modelPath}\" --image \"Images\\{callerMemberName}.received.png\"" }); process.WaitForExit(); Assert.Equal(0, process.ExitCode); } static void VerifyImage([CallerMemberName] string callerMemberName = null, [CallerFilePath] string callerFilePath = null) { var directoryName = Path.GetDirectoryName(callerFilePath); using (var approved = new MagickImage(Path.Combine(directoryName, $"Images\\{callerMemberName}.approved.png"))) using (var received = new MagickImage(Path.Combine(directoryName, $"Images\\{callerMemberName}.received.png"))) { Assert.Equal(0, approved.Compare(received, ErrorMetric.Absolute)); } } [Fact] public void Bunny() { RenderModel("Models\\bun_zipper.ply"); VerifyImage(); } } }
unlicense
C#
ee181bd40b586afef4453d3fbf0c301d149f0e37
Remove redundant type specification
ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework
osu.Framework.Tests/Visual/Sprites/TestSceneScreenshot.cs
osu.Framework.Tests/Visual/Sprites/TestSceneScreenshot.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Platform; using osuTK; using osuTK.Graphics; namespace osu.Framework.Tests.Visual.Sprites { public class TestSceneScreenshot : FrameworkTestScene { [Resolved] private GameHost host { get; set; } private Drawable background; private Sprite display; [BackgroundDependencyLoader] private void load() { Child = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Size = new Vector2(0.5f), Masking = true, BorderColour = Color4.Green, BorderThickness = 2, Children = new[] { background = new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Red, Alpha = 0 }, display = new Sprite { RelativeSizeAxes = Axes.Both } } }; AddStep("take screenshot", takeScreenshot); } private void takeScreenshot() { if (host.Window == null) return; host.TakeScreenshotAsync().ContinueWith(t => Schedule(() => { var image = t.Result; var tex = new Texture(image.Width, image.Height); tex.SetData(new TextureUpload(image)); display.Texture = tex; background.Show(); })); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Platform; using osuTK; using osuTK.Graphics; namespace osu.Framework.Tests.Visual.Sprites { public class TestSceneScreenshot : FrameworkTestScene { [Resolved] private GameHost host { get; set; } private Drawable background; private Sprite display; [BackgroundDependencyLoader] private void load() { Child = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Size = new Vector2(0.5f), Masking = true, BorderColour = Color4.Green, BorderThickness = 2, Children = new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Red, Alpha = 0 }, display = new Sprite { RelativeSizeAxes = Axes.Both } } }; AddStep("take screenshot", takeScreenshot); } private void takeScreenshot() { if (host.Window == null) return; host.TakeScreenshotAsync().ContinueWith(t => Schedule(() => { var image = t.Result; var tex = new Texture(image.Width, image.Height); tex.SetData(new TextureUpload(image)); display.Texture = tex; background.Show(); })); } } }
mit
C#
32f2cff2ae56c8bda9547844c2dca20ef231abb4
Change SqlServerCeGenerator to inherit SqlServer2000Generator, fix table rename.
istaheev/fluentmigrator,itn3000/fluentmigrator,drmohundro/fluentmigrator,igitur/fluentmigrator,alphamc/fluentmigrator,bluefalcon/fluentmigrator,alphamc/fluentmigrator,daniellee/fluentmigrator,lahma/fluentmigrator,lahma/fluentmigrator,dealproc/fluentmigrator,lahma/fluentmigrator,stsrki/fluentmigrator,mstancombe/fluentmigrator,DefiSolutions/fluentmigrator,MetSystem/fluentmigrator,daniellee/fluentmigrator,drmohundro/fluentmigrator,istaheev/fluentmigrator,amroel/fluentmigrator,mstancombe/fluentmig,tohagan/fluentmigrator,jogibear9988/fluentmigrator,DefiSolutions/fluentmigrator,tohagan/fluentmigrator,jogibear9988/fluentmigrator,tommarien/fluentmigrator,schambers/fluentmigrator,eloekset/fluentmigrator,eloekset/fluentmigrator,akema-fr/fluentmigrator,barser/fluentmigrator,spaccabit/fluentmigrator,lcharlebois/fluentmigrator,amroel/fluentmigrator,IRlyDontKnow/fluentmigrator,mstancombe/fluentmig,MetSystem/fluentmigrator,barser/fluentmigrator,swalters/fluentmigrator,FabioNascimento/fluentmigrator,KaraokeStu/fluentmigrator,wolfascu/fluentmigrator,daniellee/fluentmigrator,fluentmigrator/fluentmigrator,akema-fr/fluentmigrator,IRlyDontKnow/fluentmigrator,bluefalcon/fluentmigrator,lcharlebois/fluentmigrator,tohagan/fluentmigrator,swalters/fluentmigrator,KaraokeStu/fluentmigrator,mstancombe/fluentmigrator,schambers/fluentmigrator,DefiSolutions/fluentmigrator,istaheev/fluentmigrator,vgrigoriu/fluentmigrator,stsrki/fluentmigrator,mstancombe/fluentmig,igitur/fluentmigrator,fluentmigrator/fluentmigrator,modulexcite/fluentmigrator,tommarien/fluentmigrator,vgrigoriu/fluentmigrator,wolfascu/fluentmigrator,FabioNascimento/fluentmigrator,modulexcite/fluentmigrator,dealproc/fluentmigrator,spaccabit/fluentmigrator,itn3000/fluentmigrator
src/FluentMigrator.Runner/Generators/SqlServer/SqlServerCeGenerator.cs
src/FluentMigrator.Runner/Generators/SqlServer/SqlServerCeGenerator.cs
#region License // // Copyright (c) 2007-2009, Sean Chambers <schambers80@gmail.com> // Copyright (c) 2010, Nathan Brown // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.Linq; using FluentMigrator.Expressions; namespace FluentMigrator.Runner.Generators.SqlServer { public class SqlServerCeGenerator : SqlServer2000Generator { public SqlServerCeGenerator() : base(new SqlServerColumn(new SqlServerCeTypeMap())) { } public override string GetClusterTypeString(CreateIndexExpression column) { return string.Empty; } protected string GetConstraintClusteringString(CreateConstraintExpression constraint) { return string.Empty; } public override string Generate(RenameTableExpression expression) { return String.Format("sp_rename '{0}', '{1}'", expression.OldName, expression.NewName); } //All Schema method throw by default as only Sql server 2005 and up supports them. public override string Generate(CreateSchemaExpression expression) { throw new DatabaseOperationNotSupportedException(); } public override string Generate(DeleteSchemaExpression expression) { throw new DatabaseOperationNotSupportedException(); } public override string Generate(AlterSchemaExpression expression) { throw new DatabaseOperationNotSupportedException(); } public override string Generate(DeleteColumnExpression expression) { // Limited functionality in CE, for now will just drop the column.. no DECLARE support! const string sql = @"ALTER TABLE {0} DROP COLUMN {1};"; return String.Format(sql, Quoter.QuoteTableName(expression.TableName), Quoter.QuoteColumnName(expression.ColumnNames.ElementAt(0))); } public override string Generate(DeleteIndexExpression expression) { return String.Format("DROP INDEX {0}.{1}", Quoter.QuoteTableName(expression.Index.TableName), Quoter.QuoteIndexName(expression.Index.Name)); } public override string Generate(AlterDefaultConstraintExpression expression) { throw new DatabaseOperationNotSupportedException(); } public override string Generate(DeleteDefaultConstraintExpression expression) { throw new DatabaseOperationNotSupportedException(); } } }
#region License // // Copyright (c) 2007-2009, Sean Chambers <schambers80@gmail.com> // Copyright (c) 2010, Nathan Brown // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.Linq; using FluentMigrator.Expressions; namespace FluentMigrator.Runner.Generators.SqlServer { public class SqlServerCeGenerator : SqlServer2005Generator { public SqlServerCeGenerator() : base(new SqlServerColumn(new SqlServerCeTypeMap())) { } //I think that this would be better inheriting form the SqlServer 2000 Generator. It seems to match it better public override string Generate(RenameTableExpression expression) { return String.Format("sp_rename '{0}', '{1}'", Quoter.QuoteTableName(expression.OldName), Quoter.QuoteTableName(expression.NewName)); } //All Schema method throw by default as only Sql server 2005 and up supports them. public override string Generate(CreateSchemaExpression expression) { throw new DatabaseOperationNotSupportedException(); } public override string Generate(DeleteSchemaExpression expression) { throw new DatabaseOperationNotSupportedException(); } public override string Generate(AlterSchemaExpression expression) { throw new DatabaseOperationNotSupportedException(); } public override string Generate(DeleteColumnExpression expression) { // Limited functionality in CE, for now will just drop the column.. no DECLARE support! const string sql = @"ALTER TABLE {0} DROP COLUMN {1};"; return String.Format(sql, Quoter.QuoteTableName(expression.TableName), Quoter.QuoteColumnName(expression.ColumnNames.ElementAt(0))); } public override string Generate(DeleteIndexExpression expression) { return String.Format("DROP INDEX {0}.{1}", Quoter.QuoteTableName(expression.Index.TableName), Quoter.QuoteIndexName(expression.Index.Name)); } } }
apache-2.0
C#
bdfeb55dec5614b535737fb22df80c59627973a4
Fix room status test scene not working
UselessToucan/osu,ppy/osu,smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu
osu.Game.Tests/Visual/Multiplayer/TestSceneRoomStatus.cs
osu.Game.Tests/Visual/Multiplayer/TestSceneRoomStatus.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.RoomStatuses; using osu.Game.Screens.Multi.Lounge.Components; namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneRoomStatus : OsuTestScene { public TestSceneRoomStatus() { Child = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Width = 0.5f, Children = new Drawable[] { new DrawableRoom(new Room { Name = { Value = "Room 1" }, Status = { Value = new RoomStatusOpen() }, EndDate = { Value = DateTimeOffset.Now.AddDays(1) } }) { MatchingFilter = true }, new DrawableRoom(new Room { Name = { Value = "Room 2" }, Status = { Value = new RoomStatusPlaying() }, EndDate = { Value = DateTimeOffset.Now.AddDays(1) } }) { MatchingFilter = true }, new DrawableRoom(new Room { Name = { Value = "Room 3" }, Status = { Value = new RoomStatusEnded() }, EndDate = { Value = DateTimeOffset.Now } }) { MatchingFilter = true }, } }; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.RoomStatuses; using osu.Game.Screens.Multi.Lounge.Components; namespace osu.Game.Tests.Visual.Multiplayer { public class TestSceneRoomStatus : OsuTestScene { public TestSceneRoomStatus() { Child = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Width = 0.5f, Children = new Drawable[] { new DrawableRoom(new Room { Name = { Value = "Room 1" }, Status = { Value = new RoomStatusOpen() } }), new DrawableRoom(new Room { Name = { Value = "Room 2" }, Status = { Value = new RoomStatusPlaying() } }), new DrawableRoom(new Room { Name = { Value = "Room 3" }, Status = { Value = new RoomStatusEnded() } }), } }; } } }
mit
C#
3b238beb95f8ddab4db7515faa7bca7ef53ad041
Update version.
digibaraka/BotBuilder,msft-shahins/BotBuilder,navaei/BotBuilder,dr-em/BotBuilder,mmatkow/BotBuilder,dr-em/BotBuilder,stevengum97/BotBuilder,stevengum97/BotBuilder,navaei/BotBuilder,yakumo/BotBuilder,stevengum97/BotBuilder,digibaraka/BotBuilder,xiangyan99/BotBuilder,mmatkow/BotBuilder,jockorob/BotBuilder,yakumo/BotBuilder,jockorob/BotBuilder,xiangyan99/BotBuilder,xiangyan99/BotBuilder,Clairety/ConnectMe,msft-shahins/BotBuilder,jockorob/BotBuilder,navaei/BotBuilder,Clairety/ConnectMe,mmatkow/BotBuilder,dr-em/BotBuilder,mmatkow/BotBuilder,navaei/BotBuilder,msft-shahins/BotBuilder,dr-em/BotBuilder,msft-shahins/BotBuilder,yakumo/BotBuilder,xiangyan99/BotBuilder,yakumo/BotBuilder,Clairety/ConnectMe,Clairety/ConnectMe,jockorob/BotBuilder,digibaraka/BotBuilder,stevengum97/BotBuilder,digibaraka/BotBuilder
CSharp/Library/Properties/AssemblyInfo.cs
CSharp/Library/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("Microsoft.Bot.Builder")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Bot Builder")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.9.0.30")] [assembly: AssemblyFileVersion("0.9.0.30")] [assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Microsoft.Bot.Builder")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Bot Builder")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.9.0.29")] [assembly: AssemblyFileVersion("0.9.0.29")] [assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
mit
C#
4c5467085de403650d17dd160f005756ccb767d2
add outcomes
Appleseed/base,Appleseed/base
Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/SolrResponseItem.cs
Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/SolrResponseItem.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Appleseed.Base.Alerts.Model { class SolrResponseItem { public string id { get; set; } public string item_type { get; set; } public string address_1 { get; set; } public string city { get; set; } public string state { get; set; } public string classification { get; set; } public string country { get; set; } public string postal_code { get; set; } public string product_description { get; set; } public string product_quantity { get; set; } public string product_type { get; set; } public string code_info { get; set; } public string reason_for_recall { get; set; } public DateTime recall_initiation_date { get; set; } public string recall_number { get; set; } public string recalling_firm { get; set; } public string voluntary_mandated { get; set; } public DateTime report_date { get; set; } public string status { get; set; } public DateTime date_last_indexed { get; set; } //IRefusal public string fei_number { get; set; } public string product_code { get; set; } public string product_code_description { get; set; } public DateTime refusal_date { get; set; } public string entry_number { get; set; } public string rfrnc_doc_id { get; set; } public string line_number { get; set; } public string line_sfx_id { get; set; } public string fda_sample_analysis { get; set; } public string private_lab_analysis { get; set; } public string refusal_charges { get; set; } //ICitations public string act_cfr { get; set; } public string program_area { get; set; } public string description_short { get; set; } public string description_long { get; set; } public DateTime end_date { get; set; } //IClassification public string district_decision { get; set; } public string district { get; set; } public DateTime inspection_end_date { get; set; } public string center { get; set; } public string project_area { get; set; } public string legal_name { get; set; } //IAdvertise public string[] reactions { get; set; } public string report_number { get; set; } public string[] outcomes { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Appleseed.Base.Alerts.Model { class SolrResponseItem { public string id { get; set; } public string item_type { get; set; } public string address_1 { get; set; } public string city { get; set; } public string state { get; set; } public string classification { get; set; } public string country { get; set; } public string postal_code { get; set; } public string product_description { get; set; } public string product_quantity { get; set; } public string product_type { get; set; } public string code_info { get; set; } public string reason_for_recall { get; set; } public DateTime recall_initiation_date { get; set; } public string recall_number { get; set; } public string recalling_firm { get; set; } public string voluntary_mandated { get; set; } public DateTime report_date { get; set; } public string status { get; set; } public DateTime date_last_indexed { get; set; } //IRefusal public string fei_number { get; set; } public string product_code { get; set; } public string product_code_description { get; set; } public DateTime refusal_date { get; set; } public string entry_number { get; set; } public string rfrnc_doc_id { get; set; } public string line_number { get; set; } public string line_sfx_id { get; set; } public string fda_sample_analysis { get; set; } public string private_lab_analysis { get; set; } public string refusal_charges { get; set; } //ICitations public string act_cfr { get; set; } public string program_area { get; set; } public string description_short { get; set; } public string description_long { get; set; } public DateTime end_date { get; set; } //IClassification public string district_decision { get; set; } public string district { get; set; } public DateTime inspection_end_date { get; set; } public string center { get; set; } public string project_area { get; set; } public string legal_name { get; set; } //IAdvertise public string[] reactions { get; set; } public string report_number { get; set; } } }
apache-2.0
C#
65d71b94424ab46a3fa307784a8637334d75f172
Fix beatmap lookups failing for beatmaps with no local path
UselessToucan/osu,2yangk23/osu,smoogipoo/osu,peppy/osu,johnneijzen/osu,NeoAdonis/osu,EVAST9919/osu,UselessToucan/osu,EVAST9919/osu,ppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,2yangk23/osu,peppy/osu-new,johnneijzen/osu,ppy/osu,smoogipooo/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu
osu.Game/Online/API/Requests/GetBeatmapRequest.cs
osu.Game/Online/API/Requests/GetBeatmapRequest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests { public class GetBeatmapRequest : APIRequest<APIBeatmap> { private readonly BeatmapInfo beatmap; public GetBeatmapRequest(BeatmapInfo beatmap) { this.beatmap = beatmap; } protected override string Target => $@"beatmaps/lookup?id={beatmap.OnlineBeatmapID}&checksum={beatmap.MD5Hash}&filename={System.Uri.EscapeUriString(beatmap.Path ?? string.Empty)}"; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests { public class GetBeatmapRequest : APIRequest<APIBeatmap> { private readonly BeatmapInfo beatmap; public GetBeatmapRequest(BeatmapInfo beatmap) { this.beatmap = beatmap; } protected override string Target => $@"beatmaps/lookup?id={beatmap.OnlineBeatmapID}&checksum={beatmap.MD5Hash}&filename={System.Uri.EscapeUriString(beatmap.Path)}"; } }
mit
C#
8854e6ba35c33bd095e6ef8e765ea831882312c4
Fix error when displaying project config with empty section(s)
chromium/vs-chromium,chromium/vs-chromium,chromium/vs-chromium,chromium/vs-chromium
src/Server/Ipc/TypedMessageHandlers/GetProjectDetailsRequestHandler.cs
src/Server/Ipc/TypedMessageHandlers/GetProjectDetailsRequestHandler.cs
using System; using System.ComponentModel.Composition; using System.Linq; using VsChromium.Core.Configuration; using VsChromium.Core.Files; using VsChromium.Core.Ipc; using VsChromium.Core.Ipc.TypedMessages; using VsChromium.Server.FileSystem; using VsChromium.Server.FileSystemDatabase; using VsChromium.Server.Search; namespace VsChromium.Server.Ipc.TypedMessageHandlers { [Export(typeof(ITypedMessageRequestHandler))] public class GetProjectDetailsRequestHandler : TypedMessageRequestHandler { private readonly IFileSystemSnapshotManager _snapshotManager; private readonly ISearchEngine _searchEngine; [ImportingConstructor] public GetProjectDetailsRequestHandler(IFileSystemSnapshotManager snapshotManager, ISearchEngine searchEngine) { _snapshotManager = snapshotManager; _searchEngine = searchEngine; } public override TypedResponse Process(TypedRequest typedRequest) { var request = (GetProjectDetailsRequest) typedRequest; request.MaxFilesByExtensionDetailsCount = Math.Min(request.MaxFilesByExtensionDetailsCount, int.MaxValue); request.MaxLargeFilesDetailsCount = Math.Min(request.MaxLargeFilesDetailsCount, int.MaxValue); var projectPath = new FullPath(request.ProjectPath); var fileSystemSnapshot = _snapshotManager.CurrentSnapshot; var projectSnapshot = fileSystemSnapshot.ProjectRoots.FirstOrDefault(x => x.Project.RootPath.Equals(projectPath)); if (projectSnapshot == null) { throw new RecoverableErrorException($"Project \"{request.ProjectPath}\" not found"); } var database = _searchEngine.CurrentFileDatabaseSnapshot; return new GetProjectDetailsResponse { ProjectDetails = CreateProjectDetails(database, projectSnapshot, request.MaxFilesByExtensionDetailsCount, request.MaxLargeFilesDetailsCount) }; } public static ProjectDetails CreateProjectDetails(IFileDatabaseSnapshot database, ProjectRootSnapshot project, int maxFilesByExtensionDetailsCount, int maxLargeFilesDetailsCount) { return new ProjectDetails { RootPath = project.Project.RootPath.Value, DirectoryDetails = GetDirectoryDetailsRequestHandler.CreateDirectoryDetails(database, project, project.Directory, maxFilesByExtensionDetailsCount, maxLargeFilesDetailsCount), ConfigurationDetails = CreateProjectConfigurationDetails(project) }; } public static ProjectConfigurationDetails CreateProjectConfigurationDetails(ProjectRootSnapshot project) { return new ProjectConfigurationDetails { IgnorePathsSection = CreateSectionDetails(project.Project.IgnorePathsConfiguration), IgnoreSearchableFilesSection = CreateSectionDetails(project.Project.IgnoreSearchableFilesConfiguration), IncludeSearchableFilesSection = CreateSectionDetails(project.Project.IncludeSearchableFilesConfiguration) }; } private static ProjectConfigurationSectionDetails CreateSectionDetails(IConfigurationSectionContents section) { return new ProjectConfigurationSectionDetails { ContainingFilePath = section.ContainingFilePath.Value, Name = section.Name, Contents = section.Contents.Aggregate("", (acc, s1) => acc + "\r\n" + s1) }; } } }
using System; using System.ComponentModel.Composition; using System.Linq; using VsChromium.Core.Configuration; using VsChromium.Core.Files; using VsChromium.Core.Ipc; using VsChromium.Core.Ipc.TypedMessages; using VsChromium.Server.FileSystem; using VsChromium.Server.FileSystemDatabase; using VsChromium.Server.Search; namespace VsChromium.Server.Ipc.TypedMessageHandlers { [Export(typeof(ITypedMessageRequestHandler))] public class GetProjectDetailsRequestHandler : TypedMessageRequestHandler { private readonly IFileSystemSnapshotManager _snapshotManager; private readonly ISearchEngine _searchEngine; [ImportingConstructor] public GetProjectDetailsRequestHandler(IFileSystemSnapshotManager snapshotManager, ISearchEngine searchEngine) { _snapshotManager = snapshotManager; _searchEngine = searchEngine; } public override TypedResponse Process(TypedRequest typedRequest) { var request = (GetProjectDetailsRequest) typedRequest; request.MaxFilesByExtensionDetailsCount = Math.Min(request.MaxFilesByExtensionDetailsCount, int.MaxValue); request.MaxLargeFilesDetailsCount = Math.Min(request.MaxLargeFilesDetailsCount, int.MaxValue); var projectPath = new FullPath(request.ProjectPath); var fileSystemSnapshot = _snapshotManager.CurrentSnapshot; var projectSnapshot = fileSystemSnapshot.ProjectRoots.FirstOrDefault(x => x.Project.RootPath.Equals(projectPath)); if (projectSnapshot == null) { throw new RecoverableErrorException($"Project \"{request.ProjectPath}\" not found"); } var database = _searchEngine.CurrentFileDatabaseSnapshot; return new GetProjectDetailsResponse { ProjectDetails = CreateProjectDetails(database, projectSnapshot, request.MaxFilesByExtensionDetailsCount, request.MaxLargeFilesDetailsCount) }; } public static ProjectDetails CreateProjectDetails(IFileDatabaseSnapshot database, ProjectRootSnapshot project, int maxFilesByExtensionDetailsCount, int maxLargeFilesDetailsCount) { return new ProjectDetails { RootPath = project.Project.RootPath.Value, DirectoryDetails = GetDirectoryDetailsRequestHandler.CreateDirectoryDetails(database, project, project.Directory, maxFilesByExtensionDetailsCount, maxLargeFilesDetailsCount), ConfigurationDetails = CreateProjectConfigurationDetails(project) }; } public static ProjectConfigurationDetails CreateProjectConfigurationDetails(ProjectRootSnapshot project) { return new ProjectConfigurationDetails { IgnorePathsSection = CreateSectionDetails(project.Project.IgnorePathsConfiguration), IgnoreSearchableFilesSection = CreateSectionDetails(project.Project.IgnoreSearchableFilesConfiguration), IncludeSearchableFilesSection = CreateSectionDetails(project.Project.IncludeSearchableFilesConfiguration) }; } private static ProjectConfigurationSectionDetails CreateSectionDetails(IConfigurationSectionContents section) { return new ProjectConfigurationSectionDetails { ContainingFilePath = section.ContainingFilePath.Value, Name = section.Name, Contents = section.Contents.Aggregate((acc, s1) => acc + "\r\n" + s1) }; } } }
bsd-3-clause
C#
ecaf3328bf13f66f4e77e85023da7a73020be924
Add back combo colours for osu!classic (#6165)
EVAST9919/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,johnneijzen/osu,smoogipoo/osu,peppy/osu,peppy/osu,ZLima12/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,johnneijzen/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,peppy/osu-new,2yangk23/osu,EVAST9919/osu,ZLima12/osu,smoogipoo/osu,peppy/osu,2yangk23/osu,NeoAdonis/osu
osu.Game/Skinning/DefaultLegacySkin.cs
osu.Game/Skinning/DefaultLegacySkin.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Audio; using osu.Framework.IO.Stores; using osuTK.Graphics; namespace osu.Game.Skinning { public class DefaultLegacySkin : LegacySkin { public DefaultLegacySkin(IResourceStore<byte[]> storage, AudioManager audioManager) : base(Info, storage, audioManager, string.Empty) { Configuration.CustomColours["SliderBall"] = new Color4(2, 170, 255, 255); Configuration.ComboColours.AddRange(new[] { new Color4(255, 192, 0, 255), new Color4(0, 202, 0, 255), new Color4(18, 124, 255, 255), new Color4(242, 24, 57, 255), }); } public static SkinInfo Info { get; } = new SkinInfo { ID = -1, // this is temporary until database storage is decided upon. Name = "osu!classic", Creator = "team osu!" }; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Audio; using osu.Framework.IO.Stores; using osuTK.Graphics; namespace osu.Game.Skinning { public class DefaultLegacySkin : LegacySkin { public DefaultLegacySkin(IResourceStore<byte[]> storage, AudioManager audioManager) : base(Info, storage, audioManager, string.Empty) { Configuration.CustomColours["SliderBall"] = new Color4(2, 170, 255, 255); } public static SkinInfo Info { get; } = new SkinInfo { ID = -1, // this is temporary until database storage is decided upon. Name = "osu!classic", Creator = "team osu!" }; } }
mit
C#
48523b5a59d92d9ad8094c0a3f9310f2dae69e2c
Reorder usings
ektrah/nsec
tests/Examples/ExportImport.cs
tests/Examples/ExportImport.cs
using System; using System.Collections.Generic; using NSec.Cryptography; using Xunit; namespace NSec.Tests.Examples { public static class ExportImport { [Fact] public static void ExportImportNSecPrivateKey() { // mock System.IO.File var File = new Dictionary<string, byte[]>(); { #region ExportImport: Export var algorithm = SignatureAlgorithm.Ed25519; var creationParameters = new KeyCreationParameters { ExportPolicy = KeyExportPolicies.AllowPlaintextArchiving }; // create a new key using var key = new Key(algorithm, creationParameters); // export it var blob = key.Export(KeyBlobFormat.NSecPrivateKey); File.WriteAllBytes("myprivatekey.nsec", blob); #endregion } { #region ExportImport: Import var algorithm = SignatureAlgorithm.Ed25519; var blob = File.ReadAllBytes("myprivatekey.nsec"); // re-import it using var key = Key.Import(algorithm, blob, KeyBlobFormat.NSecPrivateKey); var signature = algorithm.Sign(key, /*{*/Array.Empty<byte>()/*}*/); #endregion } } private static void WriteAllBytes(this Dictionary<string, byte[]> dictionary, string key, byte[] value) { dictionary[key] = value; } private static byte[] ReadAllBytes(this Dictionary<string, byte[]> dictionary, string key) { return dictionary[key]; } } }
using System; using NSec.Cryptography; using System.Collections.Generic; using Xunit; namespace NSec.Tests.Examples { public static class ExportImport { [Fact] public static void ExportImportNSecPrivateKey() { // mock System.IO.File var File = new Dictionary<string, byte[]>(); { #region ExportImport: Export var algorithm = SignatureAlgorithm.Ed25519; var creationParameters = new KeyCreationParameters { ExportPolicy = KeyExportPolicies.AllowPlaintextArchiving }; // create a new key using var key = new Key(algorithm, creationParameters); // export it var blob = key.Export(KeyBlobFormat.NSecPrivateKey); File.WriteAllBytes("myprivatekey.nsec", blob); #endregion } { #region ExportImport: Import var algorithm = SignatureAlgorithm.Ed25519; var blob = File.ReadAllBytes("myprivatekey.nsec"); // re-import it using var key = Key.Import(algorithm, blob, KeyBlobFormat.NSecPrivateKey); var signature = algorithm.Sign(key, /*{*/Array.Empty<byte>()/*}*/); #endregion } } private static void WriteAllBytes(this Dictionary<string, byte[]> dictionary, string key, byte[] value) { dictionary[key] = value; } private static byte[] ReadAllBytes(this Dictionary<string, byte[]> dictionary, string key) { return dictionary[key]; } } }
mit
C#
5c873e970e31d9e9658f3271e95637e3ce87e331
Add "Open in Git Bash" to the context menu
awaescher/RepoZ,awaescher/RepoZ
RepoZ.Api.Win/IO/WindowsPathActionProvider.cs
RepoZ.Api.Win/IO/WindowsPathActionProvider.cs
using System; using System.IO; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using RepoZ.Api.IO; namespace RepoZ.Api.Win.IO { public class WindowsPathActionProvider : IPathActionProvider { public IEnumerable<PathAction> GetFor(string path) { yield return createPathAction("Open in Windows File Explorer", path); yield return createPathAction("Open in Windows Command Prompt (cmd.exe)", "cmd.exe", $"/K \"cd /d {path}\""); yield return createPathAction("Open in Windows PowerShell", "powershell.exe ", $"-noexit -command \"cd '{path}'\""); string bashSubpath = @"Git\git-bash.exe"; string folder = Environment.ExpandEnvironmentVariables("%ProgramW6432%"); string gitbash = Path.Combine(folder, bashSubpath); if (!File.Exists(gitbash)) { folder = Environment.ExpandEnvironmentVariables("%ProgramFiles(x86)%"); gitbash = Path.Combine(folder, bashSubpath); } if (File.Exists(gitbash)) { if (path.EndsWith("\\", StringComparison.OrdinalIgnoreCase)) path = path.Substring(0, path.Length - 1); yield return createPathAction("Open in Git Bash", gitbash, $"\"--cd={path}\""); } } private PathAction createPathAction(string name, string process, string arguments = "") { return new PathAction() { Name = name, Action = startProcess(process, arguments) }; } private Action startProcess(string process, string arguments) { return () => Process.Start(process, arguments); } } }
using System; using System.IO; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using RepoZ.Api.IO; namespace RepoZ.Api.Win.IO { public class WindowsPathActionProvider : IPathActionProvider { public IEnumerable<PathAction> GetFor(string path) { yield return createPathAction("Open in Windows File Explorer", path); yield return createPathAction("Open in Windows Command Prompt (cmd.exe)", "cmd.exe", $"/K \"cd /d {path}\""); yield return createPathAction("Open in Windows PowerShell", "powershell.exe ", $"-noexit -command \"cd '{path}'\""); // TODO string folder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); folder = @"C:\Program Files"; string exec = Path.Combine(folder, @"Git\bin\sh.exe"); if (File.Exists(exec)) yield return createPathAction("Open in Git Bash", "cmd.exe", $"/c (start /b /i *C:\\* *{exec}*) && exit".Replace("*", "\"")); else { folder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); exec = Path.Combine(folder, @"Git\bin\sh.exe"); if (File.Exists(exec)) yield return createPathAction("Open in Git Bash", "cmd.exe", $"/c (start /b /i *%cd%* *{exec}*) && exit".Replace("*", "\"")); } } private PathAction createPathAction(string name, string process, string arguments = "") { return new PathAction() { Name = name, Action = startProcess(process, arguments) }; } private Action startProcess(string process, string arguments) { return () => Process.Start(process, arguments); } } }
mit
C#
ecda307710af085e4a3496b9a4fddc2f8637c2a4
Add StdResponse.ShortHtml
sharper-library/Sharper.C.HttpValues
Sharper.C.HttpValues/Data/Http/StdResponse.cs
Sharper.C.HttpValues/Data/Http/StdResponse.cs
using System.Collections.Immutable; using static System.Text.Encoding; namespace Sharper.C.Data.Http { public static class StdResponse { public static HttpResponse StatusCode(int code) => HttpResponse.MkReplace(statusCode: code); public static HttpResponse Redirect(int code, string uri) => HttpResponse.MkReplace ( statusCode: code , headers: MultiMap .Empty<InvString, string>() .Add ( And.Mk(InvString.Mk("Location"), new[] { uri }) ) ); public static HttpResponse Five00(string message) => HttpResponse.MkReplace ( statusCode: 500 , contentType: "text/plain" , body: new[] { UTF8.GetBytes(message).ToImmutableArray() } ); public static HttpResponse ShortText(string s) => HttpResponse.MkReplace ( statusCode: 200 , contentType: "text/plain" , body: new[] { UTF8.GetBytes(s).ToImmutableArray() } ); public static HttpResponse ShortHtml(string html) => HttpResponse.MkReplace ( statusCode: 200 , contentType: "text/html" , body: new[] { UTF8.GetBytes(html).ToImmutableArray() } ); } }
using System.Collections.Immutable; using static System.Text.Encoding; namespace Sharper.C.Data.Http { public static class StdResponse { public static HttpResponse StatusCode(int code) => HttpResponse.MkReplace(statusCode: code); public static HttpResponse Redirect(int code, string uri) => HttpResponse.MkReplace ( statusCode: code , headers: MultiMap .Empty<InvString, string>() .Add ( And.Mk(InvString.Mk("Location"), new[] { uri }) ) ); public static HttpResponse Five00(string message) => HttpResponse.MkReplace ( statusCode: 500 , contentType: "text/plain" , body: new[] { UTF8.GetBytes(message).ToImmutableArray() } ); public static HttpResponse ShortText(string s) => HttpResponse.MkReplace ( statusCode: 200 , contentType: "text/plain" , body: new[] { UTF8.GetBytes(s).ToImmutableArray() } ); } }
mit
C#
d4051d7d89e5fef4de5117d4708e39e4515377e1
Add temp dummy impl of IContext.WithDeleted and WithFunction
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
Test/AdventureWorksFunctionalModel/Helpers.cs
Test/AdventureWorksFunctionalModel/Helpers.cs
using System; using System.Linq; using NakedFunctions; namespace AW { public static class Helpers { /// <summary> /// Returns a random instance from the set of all instance of type T /// </summary> public static T Random<T>(IContext context) where T : class { //The OrderBy(...) doesn't change the ordering, but is a necessary precursor to using .Skip //which in turn is needed because LINQ to Entities doesn't support .ElementAt(x) var instances = context.Instances<T>().OrderBy(n => ""); return instances.Skip(context.RandomSeed().ValueInRange(instances.Count())).FirstOrDefault(); } //TODO: Temporary DUMMY extension method, pending native new method on IContext. public static IContext WithFunction(this IContext context, Func<IContext, IContext> func) => context.WithInformUser($"Registered function {func.ToString()} NOT called."); //TODO: Temporary DUMMY extension method, pending native new method on IContext. public static IContext WithDeleted(this IContext context, object toDelete) => context.WithInformUser($"object {toDelete} scheduled for deletion."); } }
using System.Linq; using NakedFunctions; namespace AW { public static class Helpers { /// <summary> /// Returns a random instance from the set of all instance of type T /// </summary> public static T Random<T>(IContext context) where T : class { //The OrderBy(...) doesn't change the ordering, but is a necessary precursor to using .Skip //which in turn is needed because LINQ to Entities doesn't support .ElementAt(x) var instances = context.Instances<T>().OrderBy(n => ""); return instances.Skip(context.RandomSeed().ValueInRange(instances.Count())).FirstOrDefault(); } } }
apache-2.0
C#
b06294083f4e62a5eb0d4a91b2d4867e2840aa38
Make sure ProcessAreaLocationSetting is set on first start-up
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
src/Arkivverket.Arkade.GUI/Util/ArkadeProcessingAreaLocationSetting.cs
src/Arkivverket.Arkade.GUI/Util/ArkadeProcessingAreaLocationSetting.cs
using System.IO; using Arkivverket.Arkade.Core.Base; using Arkivverket.Arkade.GUI.Properties; namespace Arkivverket.Arkade.GUI.Util { public static class ArkadeProcessingAreaLocationSetting { public static string Get() { Settings.Default.Reload(); return Settings.Default.ArkadeProcessingAreaLocation; } public static void Set(string locationSetting) { Settings.Default.ArkadeProcessingAreaLocation = locationSetting; Settings.Default.Save(); } public static bool IsValid() { try { string definedLocation = Get(); return DirectoryIsWritable(definedLocation); } catch { return false; // Invalid path string in settings } } public static bool IsApplied() { string appliedLocation = ArkadeProcessingArea.Location?.FullName ?? string.Empty; string definedLocation = Get(); return appliedLocation.Equals(definedLocation); } private static bool DirectoryIsWritable(string directory) { if (string.IsNullOrWhiteSpace(directory)) return false; string tmpFile = Path.Combine(directory, Path.GetRandomFileName()); try { using (File.Create(tmpFile, 1, FileOptions.DeleteOnClose)) { // Attempt to write temporary file to the directory } return true; } catch { return false; } } } }
using System.IO; using Arkivverket.Arkade.Core.Base; using Arkivverket.Arkade.GUI.Properties; namespace Arkivverket.Arkade.GUI.Util { public static class ArkadeProcessingAreaLocationSetting { public static string Get() { Settings.Default.Reload(); return Settings.Default.ArkadeProcessingAreaLocation; } public static void Set(string locationSetting) { Settings.Default.ArkadeProcessingAreaLocation = locationSetting; Settings.Default.Save(); } public static bool IsValid() { try { string definedLocation = Get(); return DirectoryIsWritable(definedLocation); } catch { return false; // Invalid path string in settings } } public static bool IsApplied() { string appliedLocation = ArkadeProcessingArea.Location?.FullName ?? string.Empty; string definedLocation = Get(); return appliedLocation.Equals(definedLocation); } private static bool DirectoryIsWritable(string directory) { string tmpFile = Path.Combine(directory, Path.GetRandomFileName()); try { using (File.Create(tmpFile, 1, FileOptions.DeleteOnClose)) { // Attempt to write temporary file to the directory } return true; } catch { return false; } } } }
agpl-3.0
C#
0f36039b449be81c6fc28d118319ea5db56892af
fix the sample for API change
sillsdev/gtk-sharp,openmedicus/gtk-sharp,orion75/gtk-sharp,antoniusriha/gtk-sharp,sillsdev/gtk-sharp,Gankov/gtk-sharp,Gankov/gtk-sharp,sillsdev/gtk-sharp,openmedicus/gtk-sharp,orion75/gtk-sharp,Gankov/gtk-sharp,akrisiun/gtk-sharp,orion75/gtk-sharp,sillsdev/gtk-sharp,antoniusriha/gtk-sharp,openmedicus/gtk-sharp,openmedicus/gtk-sharp,openmedicus/gtk-sharp,antoniusriha/gtk-sharp,akrisiun/gtk-sharp,akrisiun/gtk-sharp,Gankov/gtk-sharp,akrisiun/gtk-sharp,Gankov/gtk-sharp,sillsdev/gtk-sharp,antoniusriha/gtk-sharp,openmedicus/gtk-sharp,antoniusriha/gtk-sharp,akrisiun/gtk-sharp,openmedicus/gtk-sharp,Gankov/gtk-sharp,orion75/gtk-sharp,orion75/gtk-sharp
sample/gio/AppInfo.cs
sample/gio/AppInfo.cs
using GLib; using System; namespace TestGio { public class TestAppInfo { static void Main (string[] args) { if (args.Length != 1) { Console.WriteLine ("Usage: TestAppInfo mimetype"); return; } GLib.GType.Init (); // Gtk.Application.Init (); Console.WriteLine ("Default Handler for {0}: {1}", args[0], AppInfoAdapter.GetDefaultForType (args[0], false).Name); Console.WriteLine(); Console.WriteLine("List of all {0} handlers", args[0]); foreach (AppInfo appinfo in AppInfoAdapter.GetAllForType (args[0])) Console.WriteLine ("\t{0}: {1} {2}", appinfo.Name, appinfo.Executable, appinfo.Description); AppInfo app_info = AppInfoAdapter.GetDefaultForType ("image/jpeg", false); Console.WriteLine ("{0}:\t{1}", app_info.Name, app_info.Description); Console.WriteLine ("All installed AppInfos:"); foreach (AppInfo appinfo in AppInfoAdapter.GetAll ()) Console.WriteLine ("\t{0}: {1} ", appinfo.Name, appinfo.Executable); } } }
using GLib; using System; namespace TestGio { public class TestAppInfo { static void Main (string[] args) { if (args.Length != 1) { Console.WriteLine ("Usage: TestAppInfo mimetype"); return; } GLib.GType.Init (); // Gtk.Application.Init (); Console.WriteLine ("Default Handler for {0}: {1}", args[0], AppInfoAdapter.GetDefaultForType (args[0], false).Name); Console.WriteLine(); Console.WriteLine("List of all {0} handlers", args[0]); foreach (AppInfo appinfo in AppInfoAdapter.GetAllForType (args[0])) Console.WriteLine ("\t{0}: {1} {2}", appinfo.Name, appinfo.Executable, appinfo.Description); AppInfo app_info = AppInfoAdapter.GetDefaultForType ("image/jpeg", false); Console.WriteLine ("{0}:\t{1}", app_info.Name, app_info.Description); Console.WriteLine ("All installed AppInfos:"); foreach (AppInfo appinfo in AppInfoAdapter.All) Console.WriteLine ("\t{0}: {1} ", appinfo.Name, appinfo.Executable); } } }
lgpl-2.1
C#
e9d8f271a2b5f468498853747e954464a668fe92
Fix collections not triggering save
JustArchi/ArchiSteamFarm,KlappPc/ArchiSteamFarm,i3at/ArchiSteamFarm,blackpanther989/ArchiSteamFarm,JustArchi/ArchiSteamFarm,blackpanther989/ArchiSteamFarm,JustArchi/ArchiSteamFarm,JustArchi/ArchiSteamFarm,KlappPc/ArchiSteamFarm,i3at/ArchiSteamFarm,KlappPc/ArchiSteamFarm
ConfigGenerator/EnhancedPropertyGrid.cs
ConfigGenerator/EnhancedPropertyGrid.cs
/* _ _ _ ____ _ _____ / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| Copyright 2015-2016 Łukasz "JustArchi" Domeradzki Contact: JustArchi@JustArchi.net Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.Windows.Forms; namespace ConfigGenerator { internal sealed class EnhancedPropertyGrid : PropertyGrid { private readonly ASFConfig ASFConfig; internal EnhancedPropertyGrid(ASFConfig config) { if (config == null) { return; } ASFConfig = config; SelectedObject = config; Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; Dock = DockStyle.Fill; HelpVisible = false; ToolbarVisible = false; } protected override void OnPropertyValueChanged(PropertyValueChangedEventArgs e) { if (e == null) { return; } base.OnPropertyValueChanged(e); ASFConfig.Save(); BotConfig botConfig = ASFConfig as BotConfig; if (botConfig != null) { if (botConfig.Enabled) { Tutorial.OnAction(Tutorial.EPhase.BotEnabled); if (!string.IsNullOrEmpty(botConfig.SteamLogin) && !string.IsNullOrEmpty(botConfig.SteamPassword)) { Tutorial.OnAction(Tutorial.EPhase.BotReady); } } return; } GlobalConfig globalConfig = ASFConfig as GlobalConfig; if (globalConfig != null) { if (globalConfig.SteamOwnerID != 0) { Tutorial.OnAction(Tutorial.EPhase.GlobalConfigReady); } } } protected override void OnGotFocus(EventArgs e) { if (e == null) { return; } base.OnGotFocus(e); ASFConfig.Save(); } } }
/* _ _ _ ____ _ _____ / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| Copyright 2015-2016 Łukasz "JustArchi" Domeradzki Contact: JustArchi@JustArchi.net 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.Windows.Forms; namespace ConfigGenerator { internal sealed class EnhancedPropertyGrid : PropertyGrid { private readonly ASFConfig ASFConfig; internal EnhancedPropertyGrid(ASFConfig config) { if (config == null) { return; } ASFConfig = config; SelectedObject = config; Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; Dock = DockStyle.Fill; HelpVisible = false; ToolbarVisible = false; } protected override void OnPropertyValueChanged(PropertyValueChangedEventArgs e) { if (e == null) { return; } base.OnPropertyValueChanged(e); ASFConfig.Save(); BotConfig botConfig = ASFConfig as BotConfig; if (botConfig != null) { if (botConfig.Enabled) { Tutorial.OnAction(Tutorial.EPhase.BotEnabled); if (!string.IsNullOrEmpty(botConfig.SteamLogin) && !string.IsNullOrEmpty(botConfig.SteamPassword)) { Tutorial.OnAction(Tutorial.EPhase.BotReady); } } return; } GlobalConfig globalConfig = ASFConfig as GlobalConfig; if (globalConfig != null) { if (globalConfig.SteamOwnerID != 0) { Tutorial.OnAction(Tutorial.EPhase.GlobalConfigReady); } } } } }
apache-2.0
C#
00591f43c2fb588edbc7b60faa16dad234b175db
Fix placement of using statement
CoraleStudios/Colore,WolfspiritM/Colore
Corale.Colore.Tester/MainWindow.xaml.cs
Corale.Colore.Tester/MainWindow.xaml.cs
// --------------------------------------------------------------------------------------- // <copyright file="MainWindow.xaml.cs" company="Corale"> // Copyright © 2015 by Adam Hellberg and Brandon Scott. // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // "Razer" is a trademark of Razer USA Ltd. // </copyright> // --------------------------------------------------------------------------------------- namespace Corale.Colore.Tester { using System.Text.RegularExpressions; using System.Windows.Input; using Corale.Colore.Core; /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow { public MainWindow() { InitializeComponent(); // Update the window title to include SDK version Title = $"{Title} | SDK v{Chroma.Instance.SdkVersion}"; } private void TextValidation(object sender, TextCompositionEventArgs e) { e.Handled = !IsTextAllowed(e.Text); } private bool IsTextAllowed(string text) { var regex = new Regex("[^0-9.-]+"); return !regex.IsMatch(text); } } }
// --------------------------------------------------------------------------------------- // <copyright file="MainWindow.xaml.cs" company="Corale"> // Copyright © 2015 by Adam Hellberg and Brandon Scott. // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // "Razer" is a trademark of Razer USA Ltd. // </copyright> // --------------------------------------------------------------------------------------- using Corale.Colore.Core; namespace Corale.Colore.Tester { using System.Text.RegularExpressions; using System.Windows.Input; /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow { public MainWindow() { InitializeComponent(); // Update the window title to include SDK version Title = $"{Title} | SDK v{Chroma.Instance.SdkVersion}"; } private void TextValidation(object sender, TextCompositionEventArgs e) { e.Handled = !IsTextAllowed(e.Text); } private bool IsTextAllowed(string text) { var regex = new Regex("[^0-9.-]+"); return !regex.IsMatch(text); } } }
mit
C#
4802ea174d4b049f1ce08129795724cf9d8c2616
move animation sample to just use the navigator
charlenni/Mapsui,pauldendulk/Mapsui,charlenni/Mapsui
Samples/Mapsui.Samples.Forms/Mapsui.Samples.Forms.Shared/AnimationSample.cs
Samples/Mapsui.Samples.Forms/Mapsui.Samples.Forms.Shared/AnimationSample.cs
using System; using Mapsui.Samples.Common.Maps; using Mapsui.UI; using Mapsui.UI.Forms; namespace Mapsui.Samples.Forms { public class AnimationSample : IFormsSample { public string Name => "Animation Sample"; public string Category => "Forms"; Random random = new Random(); public bool OnClick(object sender, EventArgs args) { var mapView = sender as MapView; var e = args as MapClickedEventArgs; var navigator = mapView.Navigator; var newRot = random.NextDouble() * 360.0; navigator.RotateTo(newRot, 500); //navigator.FlyTo(e.Point.ToMapsui(), mapView.Viewport.Resolution * 2); return true; } public void Setup(IMapControl mapControl) { var mapView = mapControl as MapView; mapControl.Map = OsmSample.CreateMap(); } } }
using System; using Mapsui.Samples.Common.Maps; using Mapsui.UI; using Mapsui.UI.Forms; namespace Mapsui.Samples.Forms { public class AnimationSample : IFormsSample { public string Name => "Animation Sample"; public string Category => "Forms"; Random random = new Random(); public bool OnClick(object sender, EventArgs args) { var mapView = sender as MapView; var e = args as MapClickedEventArgs; var navigator = (AnimatedNavigator)mapView.Navigator; var newRot = random.NextDouble() * 360.0; navigator.RotateTo(newRot, 500); //navigator.FlyTo(e.Point.ToMapsui(), mapView.Viewport.Resolution * 2); return true; } public void Setup(IMapControl mapControl) { var mapView = mapControl as MapView; mapControl.Map = OsmSample.CreateMap(); mapView.Navigator = new AnimatedNavigator(mapView.Map, (IViewport)mapView.Viewport); } } }
mit
C#
111cc9e863d788598c867f7116cb45c4aed3bd22
Enhance SecurityRequirementOperationFilter
domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Ahoy,domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore
test/WebSites/OAuth2Integration/ResourceServer/Swagger/SecurityRequirementsOperationFilter.cs
test/WebSites/OAuth2Integration/ResourceServer/Swagger/SecurityRequirementsOperationFilter.cs
using System.Linq; using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization.Infrastructure; using Microsoft.Extensions.Options; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; namespace OAuth2Integration.ResourceServer.Swagger { public class SecurityRequirementsOperationFilter : IOperationFilter { private readonly AuthorizationOptions _authorizationOptions; public SecurityRequirementsOperationFilter(IOptions<AuthorizationOptions> authorizationOptions) { // Beware: This might only part of the truth. If someone exchanges the IAuthorizationPolicyProvider and that loads // policies and requirements from another source than the configured options, we might not get all requirements // from here. But then we would have to make asynchronous calls from this synchronous interface. _authorizationOptions = authorizationOptions?.Value ?? throw new ArgumentNullException(nameof(authorizationOptions)); } public void Apply(OpenApiOperation operation, OperationFilterContext context) { var requiredPolicies = context.MethodInfo .GetCustomAttributes(true) .Concat(context.MethodInfo.DeclaringType.GetCustomAttributes(true)) .OfType<AuthorizeAttribute>() .Select(attr => attr.Policy) .Distinct(); var requiredScopes = requiredPolicies.Select(p => _authorizationOptions.GetPolicy(p)) .SelectMany(r => r.Requirements.OfType<ClaimsAuthorizationRequirement>()) .Where(cr => cr.ClaimType == "scope") .SelectMany(r => r.AllowedValues) .Distinct() .ToList(); if (requiredScopes.Any()) { operation.Responses.Add("401", new OpenApiResponse { Description = "Unauthorized" }); operation.Responses.Add("403", new OpenApiResponse { Description = "Forbidden" }); var oAuthScheme = new OpenApiSecurityScheme { Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "oauth2" } }; operation.Security = new List<OpenApiSecurityRequirement> { new OpenApiSecurityRequirement { [ oAuthScheme ] = requiredScopes } }; } } } }
using System.Linq; using System.Collections.Generic; using Microsoft.AspNetCore.Authorization; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; namespace OAuth2Integration.ResourceServer.Swagger { public class SecurityRequirementsOperationFilter : IOperationFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { // Policy names map to scopes var requiredScopes = context.MethodInfo .GetCustomAttributes(true) .OfType<AuthorizeAttribute>() .Select(attr => attr.Policy) .Distinct(); if (requiredScopes.Any()) { operation.Responses.Add("401", new OpenApiResponse { Description = "Unauthorized" }); operation.Responses.Add("403", new OpenApiResponse { Description = "Forbidden" }); var oAuthScheme = new OpenApiSecurityScheme { Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "oauth2" } }; operation.Security = new List<OpenApiSecurityRequirement> { new OpenApiSecurityRequirement { [ oAuthScheme ] = requiredScopes.ToList() } }; } } } }
mit
C#
931b5e6ca35cd93ff5eca7f83ce1d84ca2eedd50
Format file for easier readability
huguesv/PTVS,int19h/PTVS,Microsoft/PTVS,zooba/PTVS,zooba/PTVS,int19h/PTVS,Microsoft/PTVS,int19h/PTVS,Microsoft/PTVS,int19h/PTVS,huguesv/PTVS,Microsoft/PTVS,huguesv/PTVS,zooba/PTVS,huguesv/PTVS,Microsoft/PTVS,huguesv/PTVS,int19h/PTVS,zooba/PTVS,Microsoft/PTVS,int19h/PTVS,zooba/PTVS,huguesv/PTVS,zooba/PTVS
Python/Product/Debugger/Debugger/IPythonDebugOptionsService.cs
Python/Product/Debugger/Debugger/IPythonDebugOptionsService.cs
// Python Tools for Visual Studio // Copyright(c) Microsoft Corporation // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the License); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS // OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY // IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, // MERCHANTABILITY OR NON-INFRINGEMENT. // // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. namespace Microsoft.PythonTools.Debugger { public interface IPythonDebugOptionsService { /// <summary> /// True to ask the user whether to run when their code contains errors. /// Default is false. /// </summary> bool PromptBeforeRunningWithBuildError { get; } /// <summary> /// True to copy standard output from a Python process into the Output /// window. Default is true. /// </summary> bool TeeStandardOutput { get; } /// <summary> /// True to pause at the end of execution when an error occurs. Default. /// is true. /// </summary> bool WaitOnAbnormalExit { get; } /// <summary> /// True to pause at the end of execution when completing successfully. /// Default is true. /// </summary> bool WaitOnNormalExit { get; } /// <summary> /// True to break on a SystemExit exception even when its exit code is /// zero. This applies only when the debugger would normally break on /// a SystemExit exception. Default is false. /// </summary> /// <remarks>New in 1.1</remarks> bool BreakOnSystemExitZero { get; } /// <summary> /// True if the standard launcher should allow debugging of the standard /// library. Default is false. /// </summary> /// <remarks>New in 1.1</remarks> bool DebugStdLib { get; } /// <summary> /// Show the function return value in locals window. /// Default is true. /// </summary> bool ShowFunctionReturnValue { get; } /// <summary> /// True to use the legacy debugger. Default is false. /// </summary> bool UseLegacyDebugger { get; } } }
// Python Tools for Visual Studio // Copyright(c) Microsoft Corporation // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the License); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS // OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY // IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, // MERCHANTABILITY OR NON-INFRINGEMENT. // // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. namespace Microsoft.PythonTools.Debugger { public interface IPythonDebugOptionsService { /// <summary> /// True to ask the user whether to run when their code contains errors. /// Default is false. /// </summary> bool PromptBeforeRunningWithBuildError { get; } /// <summary> /// True to copy standard output from a Python process into the Output /// window. Default is true. /// </summary> bool TeeStandardOutput { get; } /// <summary> /// True to pause at the end of execution when an error occurs. Default. /// is true. /// </summary> bool WaitOnAbnormalExit { get; } /// <summary> /// True to pause at the end of execution when completing successfully. /// Default is true. /// </summary> bool WaitOnNormalExit { get; } /// <summary> /// True to break on a SystemExit exception even when its exit code is /// zero. This applies only when the debugger would normally break on /// a SystemExit exception. Default is false. /// </summary> /// <remarks>New in 1.1</remarks> bool BreakOnSystemExitZero { get; } /// <summary> /// True if the standard launcher should allow debugging of the standard /// library. Default is false. /// </summary> /// <remarks>New in 1.1</remarks> bool DebugStdLib { get; } /// <summary> /// Show the function return value in locals window. /// Default is true. /// </summary> bool ShowFunctionReturnValue { get; } /// <summary> /// True to use the legacy debugger. Default is false. /// </summary> bool UseLegacyDebugger { get; } } }
apache-2.0
C#
0b465bd017a0ad8ecb94e0c9791a3358c9d182cb
add a duck-for fun :)
umineneneko/mvc5-emptypoint,umineneneko/mvc5-emptypoint,umineneneko/mvc5-emptypoint
web/web/Views/HelloWorld/Index.cshtml
web/web/Views/HelloWorld/Index.cshtml
 @{ ViewBag.Title = "Index"; Layout = "~/Views/_LayoutPage.cshtml"; } <h3>A Duck</h3> <img class="img-rounded" alt=" photo close-up of a duck" src="//images.nationalgeographic.com/wpf/media-live/photos/000/125/cache/funny-duck_12551_600x450.jpg" /> <p>I caught this mandarin drake as I was sitting next to a pond at the San Diego Zoo. After setting up shots all over the zoo, I just focused and snapped the photo. It turned out to be the best photo of the day! </p>
 @{ ViewBag.Title = "Index"; Layout = "~/Views/_LayoutPage.cshtml"; } <h2>Index</h2>
mit
C#
fde42e52ab4d6b6b0912747032d1a53646598b93
remove some initial assignments
alanedwardes/Estranged.Lfs
src/Estranged.Lfs.Adapter.Azure.Blob/AzureBlobAdapterConfig.cs
src/Estranged.Lfs.Adapter.Azure.Blob/AzureBlobAdapterConfig.cs
using System; namespace Estranged.Lfs.Adapter.Azure.Blob { public class AzureBlobAdapterConfig : IAzureBlobAdapterConfig { public string ConnectionString { get; set; } public string ContainerName { get; set; } public string KeyPrefix { get; set; } public TimeSpan Expiry { get; set; } = TimeSpan.FromHours(1); } }
using System; namespace Estranged.Lfs.Adapter.Azure.Blob { public class AzureBlobAdapterConfig : IAzureBlobAdapterConfig { public string ConnectionString { get; set; } public string ContainerName { get; set; } = "gitlfs"; public string KeyPrefix { get; set; } = string.Empty; public TimeSpan Expiry { get; set; } = TimeSpan.FromHours(1); } }
mit
C#
968e7f426c196297e389c4af031eca1f773a2455
Update DocumentView.cs
Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
src/Core2D/UI/Avalonia/Dock/Views/DocumentView.cs
src/Core2D/UI/Avalonia/Dock/Views/DocumentView.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using DM = Dock.Model; namespace Core2D.UI.Avalonia.Dock.Views { /// <summary> /// Document view. /// </summary> public class DocumentView : DM.DockBase { public override DM.IDockable Clone() { var documentView = new DocumentView(); DM.CloneHelper.CloneDockProperties(this, documentView); return documentView; } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using DM=Dock.Model; namespace Core2D.UI.Avalonia.Dock.Views { /// <summary> /// Document view. /// </summary> public class DocumentView : DM.DockBase { public override DM.IDockable Clone() { var documentView = new DocumentView(); DM.CloneHelper.CloneDockProperties(this, documentView); return documentView; } } }
mit
C#
92b2b2f7a27670858c00ecadc0ebb2897aeb4bb7
Refactor dependency injection
wangkanai/Detection
src/DependencyInjection/BuilderExtensions/Core.cs
src/DependencyInjection/BuilderExtensions/Core.cs
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved. // The Apache v2. See License.txt in the project root for license information. using System; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; using Wangkanai.Detection.DependencyInjection.Options; using Wangkanai.Detection.Services; namespace Microsoft.Extensions.DependencyInjection { /// <summary> /// Contains extension method to <see cref="IServiceCollection"/> for configuring client services. /// </summary> public static class CoreBuilderExtensions { public static IDetectionBuilder AddRequiredPlatformServices(this IDetectionBuilder builder) { // Hosting doesn't add IHttpContextAccessor by default builder.Services.AddHttpContextAccessor(); // Add Detection Options builder.Services.AddOptions(); builder.Services.TryAddSingleton( provider => provider.GetRequiredService<IOptions<DetectionOptions>>().Value); return builder; } public static IDetectionBuilder AddCoreServices(this IDetectionBuilder builder) { // Add Basic core to services builder.Services.TryAddTransient<IUserAgentService, UserAgentService>(); builder.Services.TryAddTransient<IDeviceService, DeviceService>(); builder.Services.TryAddTransient<IEngineService, EngineService>(); builder.Services.TryAddTransient<IPlatformService, PlatformService>(); builder.Services.TryAddTransient<IBrowserService, BrowserService>(); builder.Services.TryAddTransient<ICrawlerService, CrawlerService>(); builder.Services.TryAddTransient<IDetectionService, DetectionService>(); return builder; } public static IDetectionBuilder AddMarkerService(this IDetectionBuilder builder) { builder.Services.TryAddSingleton<MarkerService, MarkerService>(); return builder; } } }
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved. // The Apache v2. See License.txt in the project root for license information. using System; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; using Wangkanai.Detection.DependencyInjection.Options; using Wangkanai.Detection.Services; namespace Microsoft.Extensions.DependencyInjection { /// <summary> /// Contains extension method to <see cref="IServiceCollection"/> for configuring client services. /// </summary> public static class CoreBuilderExtensions { public static IDetectionBuilder AddRequiredPlatformServices(this IDetectionBuilder builder) { // Hosting doesn't add IHttpContextAccessor by default builder.Services.AddHttpContextAccessor(); // Add Detection Options builder.Services.AddOptions(); builder.Services.TryAddSingleton(provider => provider.GetDetectionOptions()); return builder; } private static DetectionOptions GetDetectionOptions(this IServiceProvider provider) => provider.GetRequiredService<IOptions<DetectionOptions>>().Value; public static IDetectionBuilder AddCoreServices(this IDetectionBuilder builder) { // Add Basic core to services builder.Services.TryAddTransient<IUserAgentService, UserAgentService>(); builder.Services.TryAddTransient<IDeviceService, DeviceService>(); builder.Services.TryAddTransient<IEngineService, EngineService>(); builder.Services.TryAddTransient<IPlatformService, PlatformService>(); builder.Services.TryAddTransient<IBrowserService, BrowserService>(); builder.Services.TryAddTransient<ICrawlerService, CrawlerService>(); builder.Services.TryAddTransient<IDetectionService, DetectionService>(); return builder; } public static IDetectionBuilder AddMarkerService(this IDetectionBuilder builder) { builder.Services.TryAddSingleton<MarkerService, MarkerService>(); return builder; } } }
apache-2.0
C#
e065d3e1c2c43d4f6465e0500186aac24a2e038c
Update Program.cs
Mattgyver317/GitTest1,Mattgyver317/GitTest1
ConsoleApp1/ConsoleApp1/Program.cs
ConsoleApp1/ConsoleApp1/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { // This code has been edited in GitHub } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { /* This code has been edited */ } } }
mit
C#
7f3e584a986ad03c5f6e8159c6ce09c0b594a508
document bug when reparsing
KirillShlenskiy/Kirkin,KirillShlenskiy/Kirkin,KirillShlenskiy/Kirkin
src/Kirkin.Tests/CommandLine/CommandLineTests.cs
src/Kirkin.Tests/CommandLine/CommandLineTests.cs
using System; using Kirkin.CommandLine; using NUnit.Framework; namespace Kirkin.Tests.CommandLine { public class CommandLineTests { [Test] public void BasicCommandLineParsing() { CommandLineParser parser = new CommandLineParser(); Func<string, bool> ParseBoolean = value => string.IsNullOrEmpty(value) || Convert.ToBoolean(value); string subscription = null; bool validate = false; parser.DefineCommand("sync", sync => { Func<string> subscriptionOption = sync.DefineOption("subscription", null); Func<bool> validateOption = sync.DefineOption("validate", "v", ParseBoolean); return () => { subscription = subscriptionOption(); validate = validateOption(); }; }); ICommand command = parser.Parse("sync --subscription main /VALIDATE TRUE".Split(' ')); Assert.Null(subscription); Assert.False(validate); command.Execute(); Assert.AreEqual("main", subscription); Assert.True(validate); command = parser.Parse("sync --subscription extra".Split(' ')); Assert.AreEqual("main", subscription); Assert.True(validate); validate = false; // Reset. command.Execute(); Assert.AreEqual("extra", subscription); Assert.False(validate); // Bug. //Command sync = new Command("sync"); //bool verify = false; //sync.DefineOption("v", "verify", ref verify); //sync.DefineParameter() //sync.Invoked += () => //{ // if (verify) // { // } // else // { // } //}; } } }
using System; using Kirkin.CommandLine; using NUnit.Framework; namespace Kirkin.Tests.CommandLine { public class CommandLineTests { [Test] public void BasicCommandLineParsing() { CommandLineParser parser = new CommandLineParser(); Func<string, bool> ParseBoolean = value => string.IsNullOrEmpty(value) || Convert.ToBoolean(value); string subscription = null; bool validate = false; parser.DefineCommand("sync", sync => { Func<string> subscriptionOption = sync.DefineOption("subscription", null); Func<bool> validateOption = sync.DefineOption("validate", "v", ParseBoolean); return () => { subscription = subscriptionOption(); validate = validateOption(); }; }); ICommand command = parser.Parse("sync --subscription main /VALIDATE TRUE".Split(' ')); command.Execute(); Assert.AreEqual("main", subscription); Assert.True(validate); //Command sync = new Command("sync"); //bool verify = false; //sync.DefineOption("v", "verify", ref verify); //sync.DefineParameter() //sync.Invoked += () => //{ // if (verify) // { // } // else // { // } //}; } } }
mit
C#
eaba8a94723c3e6cd203bacde3163712fb40e6e8
Update assembly version
brjohnstmsft/azure-sdk-for-net,cwickham3/azure-sdk-for-net,dasha91/azure-sdk-for-net,rohmano/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,bgold09/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,pattipaka/azure-sdk-for-net,namratab/azure-sdk-for-net,relmer/azure-sdk-for-net,xindzhan/azure-sdk-for-net,ogail/azure-sdk-for-net,jtlibing/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,tpeplow/azure-sdk-for-net,marcoippel/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,dasha91/azure-sdk-for-net,nathannfan/azure-sdk-for-net,bgold09/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,amarzavery/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,AzCiS/azure-sdk-for-net,samtoubia/azure-sdk-for-net,rohmano/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,robertla/azure-sdk-for-net,jamestao/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,begoldsm/azure-sdk-for-net,jtlibing/azure-sdk-for-net,pankajsn/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,shipram/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,r22016/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,cwickham3/azure-sdk-for-net,jamestao/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,shuagarw/azure-sdk-for-net,guiling/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,smithab/azure-sdk-for-net,shuagarw/azure-sdk-for-net,smithab/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,guiling/azure-sdk-for-net,pilor/azure-sdk-for-net,herveyw/azure-sdk-for-net,smithab/azure-sdk-for-net,hyonholee/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,Nilambari/azure-sdk-for-net,mabsimms/azure-sdk-for-net,samtoubia/azure-sdk-for-net,vladca/azure-sdk-for-net,btasdoven/azure-sdk-for-net,xindzhan/azure-sdk-for-net,pattipaka/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,mihymel/azure-sdk-for-net,pinwang81/azure-sdk-for-net,scottrille/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,naveedaz/azure-sdk-for-net,hyonholee/azure-sdk-for-net,markcowl/azure-sdk-for-net,enavro/azure-sdk-for-net,oburlacu/azure-sdk-for-net,jamestao/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,shutchings/azure-sdk-for-net,namratab/azure-sdk-for-net,stankovski/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,r22016/azure-sdk-for-net,nathannfan/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,naveedaz/azure-sdk-for-net,akromm/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,yoreddy/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,begoldsm/azure-sdk-for-net,djyou/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,nacaspi/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,amarzavery/azure-sdk-for-net,AzCiS/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,atpham256/azure-sdk-for-net,peshen/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,alextolp/azure-sdk-for-net,oaastest/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,atpham256/azure-sdk-for-net,yoreddy/azure-sdk-for-net,oburlacu/azure-sdk-for-net,ailn/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,tpeplow/azure-sdk-for-net,pomortaz/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,shutchings/azure-sdk-for-net,namratab/azure-sdk-for-net,nemanja88/azure-sdk-for-net,hovsepm/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,marcoippel/azure-sdk-for-net,alextolp/azure-sdk-for-net,pinwang81/azure-sdk-for-net,ogail/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,oburlacu/azure-sdk-for-net,zaevans/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,gubookgu/azure-sdk-for-net,kagamsft/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,vladca/azure-sdk-for-net,ailn/azure-sdk-for-net,vladca/azure-sdk-for-net,naveedaz/azure-sdk-for-net,relmer/azure-sdk-for-net,jamestao/azure-sdk-for-net,tpeplow/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,akromm/azure-sdk-for-net,Nilambari/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,kagamsft/azure-sdk-for-net,juvchan/azure-sdk-for-net,mabsimms/azure-sdk-for-net,oaastest/azure-sdk-for-net,AuxMon/azure-sdk-for-net,dominiqa/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,kagamsft/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,dominiqa/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,abhing/azure-sdk-for-net,pankajsn/azure-sdk-for-net,makhdumi/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,yoreddy/azure-sdk-for-net,hyonholee/azure-sdk-for-net,ailn/azure-sdk-for-net,abhing/azure-sdk-for-net,alextolp/azure-sdk-for-net,pattipaka/azure-sdk-for-net,hovsepm/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,guiling/azure-sdk-for-net,ogail/azure-sdk-for-net,nathannfan/azure-sdk-for-net,hyonholee/azure-sdk-for-net,AuxMon/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,djyou/azure-sdk-for-net,pankajsn/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,pinwang81/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,xindzhan/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,enavro/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,dominiqa/azure-sdk-for-net,olydis/azure-sdk-for-net,lygasch/azure-sdk-for-net,amarzavery/azure-sdk-for-net,Nilambari/azure-sdk-for-net,nacaspi/azure-sdk-for-net,robertla/azure-sdk-for-net,gubookgu/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,mabsimms/azure-sdk-for-net,enavro/azure-sdk-for-net,pilor/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,gubookgu/azure-sdk-for-net,atpham256/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,dasha91/azure-sdk-for-net,oaastest/azure-sdk-for-net,r22016/azure-sdk-for-net,begoldsm/azure-sdk-for-net,btasdoven/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,relmer/azure-sdk-for-net,djyou/azure-sdk-for-net,makhdumi/azure-sdk-for-net,lygasch/azure-sdk-for-net,samtoubia/azure-sdk-for-net,herveyw/azure-sdk-for-net,olydis/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,hovsepm/azure-sdk-for-net,herveyw/azure-sdk-for-net,peshen/azure-sdk-for-net,zaevans/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,hyonholee/azure-sdk-for-net,robertla/azure-sdk-for-net,marcoippel/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,abhing/azure-sdk-for-net,juvchan/azure-sdk-for-net,AzCiS/azure-sdk-for-net,rohmano/azure-sdk-for-net,samtoubia/azure-sdk-for-net,olydis/azure-sdk-for-net,scottrille/azure-sdk-for-net,stankovski/azure-sdk-for-net,shipram/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,pomortaz/azure-sdk-for-net,cwickham3/azure-sdk-for-net,bgold09/azure-sdk-for-net,nemanja88/azure-sdk-for-net,shutchings/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,btasdoven/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,makhdumi/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,shipram/azure-sdk-for-net,pilor/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,peshen/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,juvchan/azure-sdk-for-net,jtlibing/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,nemanja88/azure-sdk-for-net,zaevans/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,mihymel/azure-sdk-for-net,scottrille/azure-sdk-for-net,pomortaz/azure-sdk-for-net,AuxMon/azure-sdk-for-net,lygasch/azure-sdk-for-net,shuagarw/azure-sdk-for-net,mihymel/azure-sdk-for-net,akromm/azure-sdk-for-net
src/NetworkManagement/Properties/AssemblyInfo.cs
src/NetworkManagement/Properties/AssemblyInfo.cs
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System.Reflection; using System.Resources; [assembly: AssemblyTitle("Microsoft Azure Network Management Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Network.")] [assembly: AssemblyVersion("4.0.0.0")] [assembly: AssemblyFileVersion("4.2.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System.Reflection; using System.Resources; [assembly: AssemblyTitle("Microsoft Azure Network Management Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Network.")] [assembly: AssemblyVersion("4.0.0.0")] [assembly: AssemblyFileVersion("4.1.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
apache-2.0
C#
5310388b0c3813ce214583980b77187fdd6a4b70
Implement random walk for 2D
sakapon/Samples-2016,sakapon/Samples-2016
MathSample/RandomWalkConsole/Program.cs
MathSample/RandomWalkConsole/Program.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace RandomWalkConsole { class Program { static void Main(string[] args) { var unfinished = Enumerable.Range(0, 1000) .Select(_ => Walk2()) .Aggregate(0, (u, t) => u + (t.HasValue ? 0 : 1)); Console.WriteLine(unfinished); } static readonly Random random = new Random(); static readonly Int32Vector3[] Directions2 = new[] { Int32Vector3.XBasis, Int32Vector3.YBasis, -Int32Vector3.XBasis, -Int32Vector3.YBasis }; static int? Walk2() { var current = Int32Vector3.Zero; for (var i = 1; i <= 1000000; i++) { current += Directions2[random.Next(0, Directions2.Length)]; if (current == Int32Vector3.Zero) return i; } Console.WriteLine(current); return null; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RandomWalkConsole { class Program { static void Main(string[] args) { } } }
mit
C#
32fcb95d67710f9130a9fa1f43d3b1d5d50a6893
Switch to lower case URLs
jaredpar/jenkins,jaredpar/jenkins,jaredpar/jenkins
Dashboard/App_Start/RouteConfig.cs
Dashboard/App_Start/RouteConfig.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace Dashboard { public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.LowercaseUrls = true; routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace Dashboard { public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } }
apache-2.0
C#
289dbd6102732e0a0870cb57954f2040ee8c16d8
change nullable syntax
kylegregory/EmmaSharp,MikeSmithDev/EmmaSharp
EmmaSharp/Models/Members/Import.cs
EmmaSharp/Models/Members/Import.cs
using EmmaSharp.Extensions; using EmmaSharp.Models.Fields; using EmmaSharp.Models.Groups; using Newtonsoft.Json; using System; using System.Collections.Generic; namespace EmmaSharp.Models.Members { public class Import { [JsonProperty("import_id")] public int? ImportId { get; set; } [JsonProperty("status")] public ImportStatus? Status { get; set; } [JsonProperty("style")] public string Style { get; set; } [JsonConverter(typeof(EmmaDateConverter))] [JsonProperty("import_started")] public DateTime? ImportStarted { get; set; } [JsonProperty("account_id")] public int? AccountId { get; set; } [JsonProperty("error_message")] public string ErrorMessage { get; set; } [JsonProperty("num_members_updated")] public int? NumMembersUpdated { get; set; } [JsonProperty("source_filename")] public string SourceFilename { get; set; } [JsonProperty("fields_updated")] public List<Field> FieldsUpdated { get; set; } [JsonProperty("num_fields_added")] public int? NumFieldsAdded { get; set; } [JsonConverter(typeof(EmmaDateConverter))] [JsonProperty("import_finished")] public DateTime? ImportFinished { get; set; } [JsonProperty("groups_updated")] public List<Group> GroupsUpdated { get; set; } [JsonProperty("num_skipped")] public int? NumSkipped { get; set; } [JsonProperty("num_duplicates")] public int? NumDuplicates { get; set; } } }
using EmmaSharp.Extensions; using EmmaSharp.Models.Fields; using EmmaSharp.Models.Groups; using Newtonsoft.Json; using System; using System.Collections.Generic; namespace EmmaSharp.Models.Members { public class Import { [JsonProperty("import_id")] public int? ImportId { get; set; } [JsonProperty("status")] public Nullable<ImportStatus> Status { get; set; } [JsonProperty("style")] public string Style { get; set; } [JsonConverter(typeof(EmmaDateConverter))] [JsonProperty("import_started")] public DateTime? ImportStarted { get; set; } [JsonProperty("account_id")] public int? AccountId { get; set; } [JsonProperty("error_message")] public string ErrorMessage { get; set; } [JsonProperty("num_members_updated")] public int? NumMembersUpdated { get; set; } [JsonProperty("source_filename")] public string SourceFilename { get; set; } [JsonProperty("fields_updated")] public List<Field> FieldsUpdated { get; set; } [JsonProperty("num_fields_added")] public int? NumFieldsAdded { get; set; } [JsonConverter(typeof(EmmaDateConverter))] [JsonProperty("import_finished")] public DateTime? ImportFinished { get; set; } [JsonProperty("groups_updated")] public List<Group> GroupsUpdated { get; set; } [JsonProperty("num_skipped")] public int? NumSkipped { get; set; } [JsonProperty("num_duplicates")] public int? NumDuplicates { get; set; } } }
mit
C#
ce15646fcab8f87d7a20036851967d6220d30e01
Remove unused GenerateGamepadDefaults
SnowflakePowered/snowflake,RonnChyran/snowflake,faint32/snowflake-1,RonnChyran/snowflake,faint32/snowflake-1,SnowflakePowered/snowflake,SnowflakePowered/snowflake,faint32/snowflake-1,RonnChyran/snowflake
Snowflake/Controller/ControllerProfile.cs
Snowflake/Controller/ControllerProfile.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Snowflake.Emulator.Input; using Snowflake.Extensions; namespace Snowflake.Controller { public class ControllerProfile : IControllerProfile { public IReadOnlyDictionary<string, string> InputConfiguration { get { return this.inputConfiguration.AsReadOnly(); } } private IDictionary<string, string> inputConfiguration; public string ControllerID { get; private set; } public ControllerProfileType ProfileType { get; private set; } public ControllerProfile(string controllerId, ControllerProfileType profileType, IDictionary<string, string> inputConfiguration) { this.ControllerID = controllerId; this.ProfileType = profileType; this.inputConfiguration = inputConfiguration; } public static ControllerProfile FromJsonProtoTemplate(IDictionary<string, dynamic> protoTemplate){ string controllerId = protoTemplate["ControllerID"]; ControllerProfileType profileType = Enum.Parse(typeof(ControllerProfileType), protoTemplate["ProfileType"]); Dictionary<string, string> inputConfiguration = ((IDictionary<object, object>)protoTemplate["InputConfiguration"].ToObject<IDictionary<object, object>>()).ToDictionary(i => (string)i.Key, i =>(string)i.Value); return new ControllerProfile(controllerId, profileType, inputConfiguration); } public IDictionary<string, dynamic> ToSerializable() { var serializable = new Dictionary<string, dynamic>(); serializable["ControllerID"] = this.ControllerID; serializable["InputConfiguration"] = this.inputConfiguration; serializable["ProfileType"] = Enum.GetName(typeof(ControllerProfileType), this.ProfileType); return serializable; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Snowflake.Emulator.Input; using Snowflake.Extensions; namespace Snowflake.Controller { public class ControllerProfile : IControllerProfile { public IReadOnlyDictionary<string, string> InputConfiguration { get { return this.inputConfiguration.AsReadOnly(); } } private IDictionary<string, string> inputConfiguration; public string ControllerID { get; private set; } public ControllerProfileType ProfileType { get; private set; } public ControllerProfile(string controllerId, ControllerProfileType profileType, IDictionary<string, string> inputConfiguration) { this.ControllerID = controllerId; this.ProfileType = profileType; this.inputConfiguration = inputConfiguration; } public static ControllerProfile GenerateGamepadDefault(ControllerDefinition controllerDefinition, string platformId){ var controllerId = controllerDefinition.ControllerID; var inputConfiguration = new Dictionary<string, string>(); foreach (var input in controllerDefinition.ControllerInputs) { inputConfiguration.Add(input.Value.InputName, input.Value.GamepadDefault); } return new ControllerProfile(controllerId, ControllerProfileType.GAMEPAD_PROFILE, inputConfiguration); } public static ControllerProfile FromJsonProtoTemplate(IDictionary<string, dynamic> protoTemplate){ string controllerId = protoTemplate["ControllerID"]; ControllerProfileType profileType = Enum.Parse(typeof(ControllerProfileType), protoTemplate["ProfileType"]); Dictionary<string, string> inputConfiguration = ((IDictionary<object, object>)protoTemplate["InputConfiguration"].ToObject<IDictionary<object, object>>()).ToDictionary(i => (string)i.Key, i =>(string)i.Value); return new ControllerProfile(controllerId, profileType, inputConfiguration); } public IDictionary<string, dynamic> ToSerializable() { var serializable = new Dictionary<string, dynamic>(); serializable["ControllerID"] = this.ControllerID; serializable["InputConfiguration"] = this.inputConfiguration; serializable["ProfileType"] = Enum.GetName(typeof(ControllerProfileType), this.ProfileType); return serializable; } } }
mpl-2.0
C#
ba2db61a70a20fb1ca283423b57b8508a60046da
Remove Debug.Log message
jacobdufault/fullserializer,Ksubaka/fullserializer,lazlo-bonin/fullserializer,shadowmint/fullserializer,jagt/fullserializer,shadowmint/fullserializer,karlgluck/fullserializer,zodsoft/fullserializer,nuverian/fullserializer,darress/fullserializer,jagt/fullserializer,Ksubaka/fullserializer,jacobdufault/fullserializer,jagt/fullserializer,caiguihou/myprj_02,shadowmint/fullserializer,Ksubaka/fullserializer,jacobdufault/fullserializer
Source/Converters/fsReflectedConverter.cs
Source/Converters/fsReflectedConverter.cs
using System; using System.Collections; namespace FullSerializer.Internal { public class fsReflectedConverter : fsConverter { public override bool CanProcess(Type type) { if (type.IsArray || typeof(ICollection).IsAssignableFrom(type)) { return false; } return true; } public override fsFailure TrySerialize(object instance, out fsData serialized, Type storageType) { serialized = fsData.CreateDictionary(); fsMetaType metaType = fsMetaType.Get(instance.GetType()); for (int i = 0; i < metaType.Properties.Length; ++i) { fsMetaProperty property = metaType.Properties[i]; fsData serializedData; var failed = Serializer.TrySerialize(property.StorageType, property.Read(instance), out serializedData); if (failed.Failed) return failed; serialized.AsDictionary[property.Name] = serializedData; } return fsFailure.Success; } public override fsFailure TryDeserialize(fsData data, ref object instance, Type storageType) { if (data.IsDictionary == false) { return fsFailure.Fail("Reflected converter requires a dictionary for data"); } fsMetaType metaType = fsMetaType.Get(storageType); for (int i = 0; i < metaType.Properties.Length; ++i) { fsMetaProperty property = metaType.Properties[i]; fsData propertyData; if (data.AsDictionary.TryGetValue(property.Name, out propertyData)) { object deserializedValue = null; var failed = Serializer.TryDeserialize(propertyData, property.StorageType, ref deserializedValue); if (failed.Failed) return failed; property.Write(instance, deserializedValue); } } return fsFailure.Success; } public override object CreateInstance(fsData data, Type storageType) { fsMetaType metaType = fsMetaType.Get(storageType); return metaType.CreateInstance(); } } }
using System; using System.Collections; using UnityEngine; namespace FullSerializer.Internal { public class fsReflectedConverter : fsConverter { public override bool CanProcess(Type type) { if (type.IsArray || typeof(ICollection).IsAssignableFrom(type)) { return false; } return true; } public override fsFailure TrySerialize(object instance, out fsData serialized, Type storageType) { serialized = fsData.CreateDictionary(); fsMetaType metaType = fsMetaType.Get(instance.GetType()); for (int i = 0; i < metaType.Properties.Length; ++i) { fsMetaProperty property = metaType.Properties[i]; fsData serializedData; var failed = Serializer.TrySerialize(property.StorageType, property.Read(instance), out serializedData); if (failed.Failed) return failed; serialized.AsDictionary[property.Name] = serializedData; } return fsFailure.Success; } public override fsFailure TryDeserialize(fsData data, ref object instance, Type storageType) { if (data.IsDictionary == false) { return fsFailure.Fail("Reflected converter requires a dictionary for data"); } fsMetaType metaType = fsMetaType.Get(storageType); for (int i = 0; i < metaType.Properties.Length; ++i) { fsMetaProperty property = metaType.Properties[i]; fsData propertyData; if (data.AsDictionary.TryGetValue(property.Name, out propertyData)) { object deserializedValue = null; var failed = Serializer.TryDeserialize(propertyData, property.StorageType, ref deserializedValue); if (failed.Failed) return failed; property.Write(instance, deserializedValue); } else { Debug.LogWarning("No data for " + property.Name + " in " + fsJsonPrinter.PrettyJson(data)); } } return fsFailure.Success; } public override object CreateInstance(fsData data, Type storageType) { fsMetaType metaType = fsMetaType.Get(storageType); return metaType.CreateInstance(); } } }
mit
C#
c48a804d17f6439ee185dc6c9b75a707f656c555
Add title to product
insthync/suriyun-unity-iap
SuriyunUnityIAP/Scripts/BaseIAPProduct.cs
SuriyunUnityIAP/Scripts/BaseIAPProduct.cs
using UnityEngine; namespace Suriyun.UnityIAP { public class BaseIAPProduct : ScriptableObject { public string id; public string title; public InAppProductID[] storeIDs; } }
using UnityEngine; namespace Suriyun.UnityIAP { public class BaseIAPProduct : ScriptableObject { public string id; public InAppProductID[] storeIDs; } }
mit
C#
2d780303b69f833f30e981ac8c5affac4ab07c07
update comment
ssg/SimpleBase32,ssg/SimpleBase,ssg/SimpleBase
src/Base85Alphabet.cs
src/Base85Alphabet.cs
// <copyright file="Base85Alphabet.cs" company="Sedat Kapanoglu"> // Copyright (c) 2014-2019 Sedat Kapanoglu // Licensed under Apache-2.0 License (see LICENSE.txt file for details) // </copyright> namespace SimpleBase { /// <summary> /// Base85 Alphabet /// </summary> public sealed class Base85Alphabet : EncodingAlphabet { /// <summary> /// Initializes a new instance of the <see cref="Base85Alphabet"/> class /// using custom settings. /// </summary> /// <param name="alphabet">Alphabet to use</param> /// <param name="allZeroShortcut">Character to substitute for all zeros</param> /// <param name="allSpaceShortcut">Character to substitute for all spaces</param> public Base85Alphabet( string alphabet, char? allZeroShortcut = null, char? allSpaceShortcut = null) : base(85, alphabet) { this.AllZeroShortcut = allZeroShortcut; this.AllSpaceShortcut = allSpaceShortcut; } /// <summary> /// Gets ZeroMQ Z85 Alphabet /// </summary> public static Base85Alphabet Z85 { get; } = new Base85Alphabet("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#"); /// <summary> /// Gets Adobe Ascii85 Alphabet (each character is directly produced by raw value + 33), /// also known as "btoa" encoding /// </summary> public static Base85Alphabet Ascii85 { get; } = new Base85Alphabet( "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstu", allZeroShortcut: 'z', allSpaceShortcut: 'y'); /// <summary> /// Gets the character to be used for "all zeros" /// </summary> public char? AllZeroShortcut { get; } /// <summary> /// Gets the character to be used for "all spaces" /// </summary> public char? AllSpaceShortcut { get; } /// <summary> /// Gets a value indicating whether the alphabet uses one of shortcut characters for all spaces /// or all zeros. /// </summary> public bool HasShortcut => AllSpaceShortcut.HasValue || AllZeroShortcut.HasValue; } }
// <copyright file="Base85Alphabet.cs" company="Sedat Kapanoglu"> // Copyright (c) 2014-2019 Sedat Kapanoglu // Licensed under Apache-2.0 License (see LICENSE.txt file for details) // </copyright> namespace SimpleBase { /// <summary> /// Base85 Alphabet /// </summary> public sealed class Base85Alphabet : EncodingAlphabet { /// <summary> /// Initializes a new instance of the <see cref="Base85Alphabet"/> class /// using custom settings. /// </summary> /// <param name="alphabet">Alphabet to use</param> /// <param name="allZeroShortcut">Character to substitute for all zeros</param> /// <param name="allSpaceShortcut">Character to substitute for all spaces</param> public Base85Alphabet( string alphabet, char? allZeroShortcut = null, char? allSpaceShortcut = null) : base(85, alphabet) { this.AllZeroShortcut = allZeroShortcut; this.AllSpaceShortcut = allSpaceShortcut; } /// <summary> /// Gets ZeroMQ Z85 Alphabet /// </summary> public static Base85Alphabet Z85 { get; } = new Base85Alphabet("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#"); /// <summary> /// Gets Adobe Ascii85 Alphabet (each character is directly produced by raw value + 33) /// </summary> public static Base85Alphabet Ascii85 { get; } = new Base85Alphabet( "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstu", allZeroShortcut: 'z', allSpaceShortcut: 'y'); /// <summary> /// Gets the character to be used for "all zeros" /// </summary> public char? AllZeroShortcut { get; } /// <summary> /// Gets the character to be used for "all spaces" /// </summary> public char? AllSpaceShortcut { get; } /// <summary> /// Gets a value indicating whether the alphabet uses one of shortcut characters for all spaces /// or all zeros. /// </summary> public bool HasShortcut => AllSpaceShortcut.HasValue || AllZeroShortcut.HasValue; } }
apache-2.0
C#
6ef5fd045fe54e179f9974e3ea5a5d65c273c92d
Update MsCoreReferenceFinder.cs
Fody/Caseless
Caseless.Fody/MsCoreReferenceFinder.cs
Caseless.Fody/MsCoreReferenceFinder.cs
using Mono.Cecil; public partial class ModuleWeaver { public TypeDefinition StringDefinition; public TypeDefinition StringComparisonDefinition; public void FindCoreReferences() { StringDefinition = FindTypeDefinition("System.String"); StringComparisonDefinition = FindTypeDefinition("System.StringComparison"); } }
using Mono.Cecil; public partial class ModuleWeaver { public TypeDefinition StringDefinition; public TypeDefinition StringComparisonDefinition; public void FindCoreReferences() { StringDefinition = FindType("System.String"); StringComparisonDefinition = FindType("System.StringComparison"); } }
mit
C#
3a24b5bc2dc1f149ff30e8b8c1690e1dca2b3e6c
Change signatures
sakapon/Samples-2014,sakapon/Samples-2014,sakapon/Samples-2014
RxSample/MouseRx2Wpf/MainWindow.xaml.cs
RxSample/MouseRx2Wpf/MainWindow.xaml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace MouseRx2Wpf { /// <summary> /// MainWindow.xaml の相互作用ロジック /// </summary> public partial class MainWindow : Window { public static readonly DependencyProperty DeltaProperty = DependencyProperty.Register(nameof(Delta), typeof(Vector?), typeof(MainWindow), new PropertyMetadata(null, (d, e) => DeltaChanged((MainWindow)d))); public Vector? Delta { get { return (Vector?)GetValue(DeltaProperty); } set { SetValue(DeltaProperty, value); } } public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(nameof(Orientation), typeof(string), typeof(MainWindow), new PropertyMetadata(null)); public string Orientation { get { return (string)GetValue(OrientationProperty); } private set { SetValue(OrientationProperty, value); } } public MainWindow() { InitializeComponent(); var events = new EventsExtension(this); events.MouseDrag.Subscribe(d => d.Subscribe(v => Delta = v, () => Delta = null)); } const double π = Math.PI; static readonly string[] orientationSymbols = new[] { "→", "↘", "↓", "↙", "←", "↖", "↑", "↗" }; static readonly double zoneAngleRange = 2 * π / orientationSymbols.Length; static string ToOrientation(Vector v) { var angle = 2 * π + Math.Atan2(v.Y, v.X); var zone = (int)Math.Round(angle / zoneAngleRange) % orientationSymbols.Length; return orientationSymbols[zone]; } static void DeltaChanged(MainWindow window) { window.Orientation = window.Delta == null ? null : ToOrientation(window.Delta.Value); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace MouseRx2Wpf { /// <summary> /// MainWindow.xaml の相互作用ロジック /// </summary> public partial class MainWindow : Window { public static readonly DependencyProperty DeltaProperty = DependencyProperty.Register(nameof(Delta), typeof(Vector?), typeof(MainWindow), new PropertyMetadata(null, (d, e) => DeltaChanged((MainWindow)d, (Vector?)e.NewValue))); public Vector? Delta { get { return (Vector?)GetValue(DeltaProperty); } set { SetValue(DeltaProperty, value); } } public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(nameof(Orientation), typeof(string), typeof(MainWindow), new PropertyMetadata(null)); public string Orientation { get { return (string)GetValue(OrientationProperty); } private set { SetValue(OrientationProperty, value); } } public MainWindow() { InitializeComponent(); var events = new EventsExtension(this); events.MouseDrag.Subscribe(d => d.Subscribe(v => Delta = v, () => Delta = null)); } const double π = Math.PI; static readonly string[] orientationSymbols = new[] { "→", "↘", "↓", "↙", "←", "↖", "↑", "↗" }; static readonly double zoneAngleRange = 2 * π / orientationSymbols.Length; static string ToOrientation(Vector v) { var angle = 2 * π + Math.Atan2(v.Y, v.X); var zone = (int)Math.Round(angle / zoneAngleRange) % orientationSymbols.Length; return orientationSymbols[zone]; } static void DeltaChanged(MainWindow window, Vector? delta) { window.Orientation = delta == null ? null : ToOrientation(delta.Value); } } }
mit
C#
411fb66e03c9be355ee23ef18c166e7f90a2a8ee
Change assembly metadata
ShippingEasy/shipping_easy-dotnet,ShippingEasy/shipping_easy-dotnet
ShippingEasy/Properties/AssemblyInfo.cs
ShippingEasy/Properties/AssemblyInfo.cs
using System; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; // ReSharper disable CheckNamespace [assembly: AssemblyTitle("ShippingEasyDotNet")] [assembly: AssemblyDescription("ShippingEasy API Client")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ShippingEasy")] [assembly: AssemblyProduct("ShippingEasy")] [assembly: AssemblyCopyright("Copyright ©ShippingEasy 2015")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("ea7b2ec4-35c4-4c63-b7cf-ab2a5591cc54")] // AssemblyVersion should be manually updated for an official release [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] internal static class AssemblyInfo { private static readonly Assembly _assembly; static AssemblyInfo() { _assembly = Assembly.GetExecutingAssembly(); } public static string GetAssemblyName() { return _assembly.GetName().Name; } public static string GetAssemblyVersion() { return _assembly.GetName().Version.ToString(); } public static string GetFileVersion() { return GetAssemblyAttributeValue<AssemblyFileVersionAttribute>(a => a.Version); } public static string GetCommitIdentifier() { return GetAssemblyAttributeValue<AssemblyTrademarkAttribute>(a => a.Trademark); } private static string GetAssemblyAttributeValue<T>(Func<T, string> property) { var attr = _assembly.GetCustomAttributes(typeof(T), false) .Cast<T>() .FirstOrDefault(); return attr != null ? property(attr) : null; } }
using System; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; // ReSharper disable CheckNamespace [assembly: AssemblyTitle("ShippingEasy Client")] [assembly: AssemblyDescription("http://shippingeasy.com")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ShippingEasy")] [assembly: AssemblyProduct("ShippingEasy")] [assembly: AssemblyCopyright("Copyright ©ShippingEasy 2015")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("ea7b2ec4-35c4-4c63-b7cf-ab2a5591cc54")] // AssemblyVersion should be manually updated for an official release [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] internal static class AssemblyInfo { private static readonly Assembly _assembly; static AssemblyInfo() { _assembly = Assembly.GetExecutingAssembly(); } public static string GetAssemblyName() { return _assembly.GetName().Name; } public static string GetAssemblyVersion() { return _assembly.GetName().Version.ToString(); } public static string GetFileVersion() { return GetAssemblyAttributeValue<AssemblyFileVersionAttribute>(a => a.Version); } public static string GetCommitIdentifier() { return GetAssemblyAttributeValue<AssemblyTrademarkAttribute>(a => a.Trademark); } private static string GetAssemblyAttributeValue<T>(Func<T, string> property) { var attr = _assembly.GetCustomAttributes(typeof(T), false) .Cast<T>() .FirstOrDefault(); return attr != null ? property(attr) : null; } }
mit
C#
0e5c08584b878b3be15ba9ac59a7edfa25356f08
Update AssemblyInfo
tonytang-microsoft-com/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,nacaspi/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,pankajsn/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,atpham256/azure-sdk-for-net,btasdoven/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,oburlacu/azure-sdk-for-net,Nilambari/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,smithab/azure-sdk-for-net,amarzavery/azure-sdk-for-net,xindzhan/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,robertla/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,Nilambari/azure-sdk-for-net,AuxMon/azure-sdk-for-net,dominiqa/azure-sdk-for-net,AuxMon/azure-sdk-for-net,r22016/azure-sdk-for-net,hovsepm/azure-sdk-for-net,oaastest/azure-sdk-for-net,gubookgu/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,kagamsft/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,makhdumi/azure-sdk-for-net,nemanja88/azure-sdk-for-net,ailn/azure-sdk-for-net,pankajsn/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,begoldsm/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,marcoippel/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,lygasch/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,vladca/azure-sdk-for-net,stankovski/azure-sdk-for-net,lygasch/azure-sdk-for-net,cwickham3/azure-sdk-for-net,olydis/azure-sdk-for-net,ailn/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,mihymel/azure-sdk-for-net,mihymel/azure-sdk-for-net,shutchings/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,abhing/azure-sdk-for-net,r22016/azure-sdk-for-net,pomortaz/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,samtoubia/azure-sdk-for-net,hyonholee/azure-sdk-for-net,dominiqa/azure-sdk-for-net,jamestao/azure-sdk-for-net,scottrille/azure-sdk-for-net,vladca/azure-sdk-for-net,naveedaz/azure-sdk-for-net,juvchan/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,gubookgu/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,nemanja88/azure-sdk-for-net,herveyw/azure-sdk-for-net,scottrille/azure-sdk-for-net,atpham256/azure-sdk-for-net,mabsimms/azure-sdk-for-net,juvchan/azure-sdk-for-net,pomortaz/azure-sdk-for-net,rohmano/azure-sdk-for-net,herveyw/azure-sdk-for-net,mabsimms/azure-sdk-for-net,akromm/azure-sdk-for-net,shuagarw/azure-sdk-for-net,jamestao/azure-sdk-for-net,pattipaka/azure-sdk-for-net,peshen/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,markcowl/azure-sdk-for-net,akromm/azure-sdk-for-net,AuxMon/azure-sdk-for-net,hyonholee/azure-sdk-for-net,btasdoven/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,Nilambari/azure-sdk-for-net,djyou/azure-sdk-for-net,pomortaz/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,hyonholee/azure-sdk-for-net,samtoubia/azure-sdk-for-net,makhdumi/azure-sdk-for-net,robertla/azure-sdk-for-net,shutchings/azure-sdk-for-net,dasha91/azure-sdk-for-net,bgold09/azure-sdk-for-net,robertla/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,begoldsm/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,samtoubia/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,zaevans/azure-sdk-for-net,samtoubia/azure-sdk-for-net,amarzavery/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,yoreddy/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,lygasch/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,smithab/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,hovsepm/azure-sdk-for-net,djyou/azure-sdk-for-net,zaevans/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,hovsepm/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,alextolp/azure-sdk-for-net,hyonholee/azure-sdk-for-net,cwickham3/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,rohmano/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,yoreddy/azure-sdk-for-net,naveedaz/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,xindzhan/azure-sdk-for-net,marcoippel/azure-sdk-for-net,gubookgu/azure-sdk-for-net,shuagarw/azure-sdk-for-net,oaastest/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,shipram/azure-sdk-for-net,r22016/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,alextolp/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,guiling/azure-sdk-for-net,peshen/azure-sdk-for-net,dasha91/azure-sdk-for-net,nathannfan/azure-sdk-for-net,oaastest/azure-sdk-for-net,nacaspi/azure-sdk-for-net,kagamsft/azure-sdk-for-net,oburlacu/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,vladca/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,atpham256/azure-sdk-for-net,rohmano/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,makhdumi/azure-sdk-for-net,dominiqa/azure-sdk-for-net,olydis/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,naveedaz/azure-sdk-for-net,oburlacu/azure-sdk-for-net,mihymel/azure-sdk-for-net,jtlibing/azure-sdk-for-net,AzCiS/azure-sdk-for-net,marcoippel/azure-sdk-for-net,tpeplow/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,tpeplow/azure-sdk-for-net,stankovski/azure-sdk-for-net,shipram/azure-sdk-for-net,guiling/azure-sdk-for-net,shuagarw/azure-sdk-for-net,cwickham3/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,juvchan/azure-sdk-for-net,nemanja88/azure-sdk-for-net,mabsimms/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,AzCiS/azure-sdk-for-net,yoreddy/azure-sdk-for-net,dasha91/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,pattipaka/azure-sdk-for-net,nathannfan/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,pilor/azure-sdk-for-net,shutchings/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,herveyw/azure-sdk-for-net,jtlibing/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,jamestao/azure-sdk-for-net,nathannfan/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,pankajsn/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,djyou/azure-sdk-for-net,begoldsm/azure-sdk-for-net,guiling/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,alextolp/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,pilor/azure-sdk-for-net,olydis/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jamestao/azure-sdk-for-net,btasdoven/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,jtlibing/azure-sdk-for-net,ailn/azure-sdk-for-net,akromm/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,peshen/azure-sdk-for-net,AzCiS/azure-sdk-for-net,tpeplow/azure-sdk-for-net,zaevans/azure-sdk-for-net,hyonholee/azure-sdk-for-net,pilor/azure-sdk-for-net,bgold09/azure-sdk-for-net,xindzhan/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,bgold09/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,amarzavery/azure-sdk-for-net,shipram/azure-sdk-for-net,scottrille/azure-sdk-for-net,smithab/azure-sdk-for-net,abhing/azure-sdk-for-net,pattipaka/azure-sdk-for-net,kagamsft/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,abhing/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net
src/ResourceManagement/Compute/ComputeManagement/Properties/AssemblyInfo.cs
src/ResourceManagement/Compute/ComputeManagement/Properties/AssemblyInfo.cs
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Microsoft Azure Compute Management Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Compute Resources.")] [assembly: AssemblyVersion("8.0.0.0")] [assembly: AssemblyFileVersion("8.1.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Microsoft Azure Compute Management Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Compute Resources.")] [assembly: AssemblyVersion("8.0.0.0")] [assembly: AssemblyFileVersion("8.0.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
mit
C#
b4b37f75bd3da2e83dbfd056fa282c5548738e07
extend hash map constructors to support equality comparer.
yanggujun/commonsfornet,yanggujun/commonsfornet
src/Commons.Collections/Map/HashMap.cs
src/Commons.Collections/Map/HashMap.cs
// Copyright CommonsForNET. // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using Commons.Utils; namespace Commons.Collections.Map { [CLSCompliant(true)] public class HashMap<K, V> : AbstractHashMap<K, V>, IDictionary<K, V> { private const int DefaultCapacity = 16; public HashMap() : this(DefaultCapacity) { } public HashMap(IEqualityComparer<K> comparer) : this(comparer.Equals) { } public HashMap(Equator<K> equator) : this(DefaultCapacity, equator) { } public HashMap(int capacity) : this(capacity, (x1, x2) => x1 == null ? x2 == null : x1.Equals(x2)) { } public HashMap(int capacity, IEqualityComparer<K> comparer) : this(capacity, comparer.Equals) { } public HashMap(int capacity, Equator<K> equator) : base(capacity, equator) { } public HashMap(IEnumerable<KeyValuePair<K, V>> items, int capacity, Equator<K> equator) : base(capacity, equator) { if (null != items) { foreach (var item in items) { Add(item); } } } protected override long HashIndex(K key) { var hash = key.GetHashCode(); return hash & (Capacity - 1); } } }
// Copyright CommonsForNET. // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using Commons.Utils; namespace Commons.Collections.Map { [CLSCompliant(true)] public class HashMap<K, V> : AbstractHashMap<K, V>, IDictionary<K, V> { private const int DefaultCapacity = 16; public HashMap() : this(DefaultCapacity) { } public HashMap(Equator<K> equator) : this(DefaultCapacity, equator) { } public HashMap(int capacity) : this(capacity, (x1, x2) => x1 == null ? x2 == null : x1.Equals(x2)) { } public HashMap(int capacity, Equator<K> equator) : base(capacity, equator) { } public HashMap(IEnumerable<KeyValuePair<K, V>> items, int capacity, Equator<K> equator) : base(capacity, equator) { if (null != items) { foreach (var item in items) { Add(item); } } } protected override long HashIndex(K key) { var hash = key.GetHashCode(); return hash & (Capacity - 1); } } }
apache-2.0
C#
4540e61f1ee75e12180a31c94e3b4b7661f53606
Add summary comments to SubtitleItem "times"
AlexPoint/SubtitlesParser
SubtitlesParser/Classes/SubtitleItem.cs
SubtitlesParser/Classes/SubtitleItem.cs
using System; using System.Collections.Generic; namespace SubtitlesParser.Classes { public class SubtitleItem { //Properties------------------------------------------------------------------ /// <summary> /// Start time in milliseconds. /// </summary> public int StartTime { get; set; } /// <summary> /// End time in milliseconds. /// </summary> public int EndTime { get; set; } public List<string> Lines { get; set; } //Constructors----------------------------------------------------------------- /// <summary> /// The empty constructor /// </summary> public SubtitleItem() { this.Lines = new List<string>(); } // Methods -------------------------------------------------------------------------- public override string ToString() { var startTs = new TimeSpan(0, 0, 0, 0, StartTime); var endTs = new TimeSpan(0, 0, 0, 0, EndTime); var res = string.Format("{0} --> {1}: {2}", startTs.ToString("G"), endTs.ToString("G"), string.Join(Environment.NewLine, Lines)); return res; } } }
using System; using System.Collections.Generic; namespace SubtitlesParser.Classes { public class SubtitleItem { //Properties------------------------------------------------------------------ //StartTime and EndTime times are in milliseconds public int StartTime { get; set; } public int EndTime { get; set; } public List<string> Lines { get; set; } //Constructors----------------------------------------------------------------- /// <summary> /// The empty constructor /// </summary> public SubtitleItem() { this.Lines = new List<string>(); } // Methods -------------------------------------------------------------------------- public override string ToString() { var startTs = new TimeSpan(0, 0, 0, 0, StartTime); var endTs = new TimeSpan(0, 0, 0, 0, EndTime); var res = string.Format("{0} --> {1}: {2}", startTs.ToString("G"), endTs.ToString("G"), string.Join(Environment.NewLine, Lines)); return res; } } }
mit
C#
bf9e42ef90550974d4440700fb2b843a0cf2e58d
Allow handler injection from client code
mdsol/mauth-client-dotnet
src/Medidata.MAuth.Core/Options/MAuthOptionsBase.cs
src/Medidata.MAuth.Core/Options/MAuthOptionsBase.cs
using System; using System.Net.Http; namespace Medidata.MAuth.Core { /// <summary> /// Contains the options used by the <see cref="MAuthAuthenticator"/>. /// </summary> public abstract class MAuthOptionsBase { /// <summary> /// Determines the RSA private key for the authentication requests. The value of this property can be set as a /// valid path to a readable key file as well. /// </summary> public string PrivateKey { get; set; } /// <summary>Determines the endpoint of the MAuth authentication service.</summary> public Uri MAuthServiceUrl { get; set; } /// <summary>Determines the unique identifier used for the MAuth service authentication requests.</summary> public Guid ApplicationUuid { get; set; } /// <summary> /// Determines the timeout in seconds for the MAuth authentication request - the MAuth component will try to /// reach the MAuth server for this duration before throws an exception. If not specified, the default /// value will be 3 seconds. /// </summary> public int AuthenticateRequestTimeoutSeconds { get; set; } = 3; /// <summary> /// Determines the number of request retry attempts when communicating with the MAuth authentication service, /// and the result is not success. If not specified, the default value will be /// <see cref="MAuthServiceRetryPolicy.RetryOnce"/> (1 more attempt additionally for the original request). /// </summary> public MAuthServiceRetryPolicy MAuthServiceRetryPolicy { get; set; } = MAuthServiceRetryPolicy.RetryOnce; /// <summary> /// Determines the message handler for the requests to the MAuth server. /// </summary> public HttpMessageHandler MAuthServerHandler { get; set; } } }
using System; using System.Net.Http; namespace Medidata.MAuth.Core { /// <summary> /// Contains the options used by the <see cref="MAuthAuthenticator"/>. /// </summary> public abstract class MAuthOptionsBase { /// <summary> /// Determines the RSA private key for the authentication requests. The value of this property can be set as a /// valid path to a readable key file as well. /// </summary> public string PrivateKey { get; set; } /// <summary>Determines the endpoint of the MAuth authentication service.</summary> public Uri MAuthServiceUrl { get; set; } /// <summary>Determines the unique identifier used for the MAuth service authentication requests.</summary> public Guid ApplicationUuid { get; set; } /// <summary> /// Determines the timeout in seconds for the MAuth authentication request - the MAuth component will try to /// reach the MAuth server for this duration before throws an exception. If not specified, the default /// value will be 3 seconds. /// </summary> public int AuthenticateRequestTimeoutSeconds { get; set; } = 3; /// <summary> /// Determines the number of request retry attempts when communicating with the MAuth authentication service, /// and the result is not success. If not specified, the default value will be /// <see cref="MAuthServiceRetryPolicy.RetryOnce"/> (1 more attempt additionally for the original request). /// </summary> public MAuthServiceRetryPolicy MAuthServiceRetryPolicy { get; set; } = MAuthServiceRetryPolicy.RetryOnce; /// <summary> /// Determines the message handler for the requests to the MAuth server. /// This property is for testing purposes only. /// </summary> internal HttpMessageHandler MAuthServerHandler { get; set; } } }
mit
C#
6e39562cc27b6428224c10ce7e86a7961a831928
Fix NuGet name typo
mdavid/nuget,mdavid/nuget
src/VisualStudio.Interop/Properties/AssemblyInfo.cs
src/VisualStudio.Interop/Properties/AssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("NuGet.VisualStudio.Interop")] [assembly: AssemblyDescription("NuGet/Visual Studio interop assembly")] // The version of this assembly should never be changed. [assembly: AssemblyVersion("1.0.0.0")]
using System.Reflection; [assembly: AssemblyTitle("NuGet.VisualStudio.Interop")] [assembly: AssemblyDescription("Nuget/Visual Studio interop assembly")] // The version of this assembly should never be changed. [assembly: AssemblyVersion("1.0.0.0")]
apache-2.0
C#
8c5093bd498701f8ac47947fa8c9d4407c7d45a4
update cdn url
AerisG222/mikeandwan.us,AerisG222/mikeandwan.us,AerisG222/mikeandwan.us,AerisG222/mikeandwan.us,AerisG222/mikeandwan.us
src/mikeandwan.us/Views/Shared/_js_Threejs.cshtml
src/mikeandwan.us/Views/Shared/_js_Threejs.cshtml
<environment names="Staging,Production"> <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/84/three.min.js"></script> </environment> <environment names="Development"> <script src="/js/libs/three/r84/three.min.js"></script> </environment>
<environment names="Staging,Production"> <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r84/three.min.js"></script> </environment> <environment names="Development"> <script src="/js/libs/three/r84/three.min.js"></script> </environment>
mit
C#
ab58c4a43977290c2469cc1242ae1c3a77ddf9b1
Debug hashed password
joelverhagen/TorSharp,JSkimming/TorSharp
TorSharp/Tools/Tor/TorPasswordHasher.cs
TorSharp/Tools/Tor/TorPasswordHasher.cs
using System; using System.Diagnostics; using System.Linq; using System.Text; namespace Knapcode.TorSharp.Tools.Tor { public class TorPasswordHasher { public string HashPassword(Tool tor, string password) { var process = new Process { StartInfo = { FileName = tor.ExecutablePath, Arguments = $"--hash-password {password}", RedirectStandardOutput = true, UseShellExecute = false } }; var sb = new StringBuilder(); process.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data); process.Start(); process.BeginOutputReadLine(); process.WaitForExit(); Console.WriteLine(sb.ToString()); return sb .ToString() .Split('\n') .Select(l => l.Trim()) .Last(l => l.Length > 0); } } }
using System.Diagnostics; using System.Linq; using System.Text; namespace Knapcode.TorSharp.Tools.Tor { public class TorPasswordHasher { public string HashPassword(Tool tor, string password) { var process = new Process { StartInfo = { FileName = tor.ExecutablePath, Arguments = $"--hash-password {password}", RedirectStandardOutput = true, UseShellExecute = false } }; var sb = new StringBuilder(); process.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data); process.Start(); process.BeginOutputReadLine(); process.WaitForExit(); return sb .ToString() .Split('\n') .Select(l => l.Trim()) .Last(l => l.Length > 0); } } }
mit
C#
2b556f27e56ef2a7f0a45c8b400072e3a83009a5
Handle updatechecker nullness
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Tabs/AboutViewModel.cs
WalletWasabi.Gui/Tabs/AboutViewModel.cs
using Avalonia.Diagnostics.ViewModels; using System; using System.Runtime.InteropServices; using System.Diagnostics; using System.Collections.Generic; using System.Text; using WalletWasabi.Gui.ViewModels; using System.IO; using ReactiveUI; using System.Reactive; using WalletWasabi.Helpers; using WalletWasabi.Logging; using System.Reactive.Linq; using WalletWasabi.WebClients.Wasabi; using System.Reactive.Disposables; using Splat; using WalletWasabi.Models; using WalletWasabi.Services; namespace WalletWasabi.Gui.Tabs { internal class AboutViewModel : WasabiDocumentTabViewModel { private string _currentBackendMajorVersion; public AboutViewModel() : base("About") { var global = Locator.Current.GetService<Global>(); var hostedServices = global.HostedServices; UpdateChecker = hostedServices.FirstOrDefault<UpdateChecker>(); CurrentBackendMajorVersion = UpdateChecker?.UpdateStatus?.CurrentBackendApiVersion ?? ""; OpenBrowserCommand = ReactiveCommand.CreateFromTask<string>(IoHelpers.OpenBrowserAsync); OpenBrowserCommand.ThrownExceptions .ObserveOn(RxApp.TaskpoolScheduler) .Subscribe(ex => Logger.LogError(ex)); } public ReactiveCommand<string, Unit> OpenBrowserCommand { get; } private UpdateChecker UpdateChecker { get; } public Version ClientVersion => Constants.ClientVersion; public string BackendCompatibleVersions => Constants.ClientSupportBackendVersionText; public string CurrentBackendMajorVersion { get => _currentBackendMajorVersion; set => this.RaiseAndSetIfChanged(ref _currentBackendMajorVersion, value); } public Version BitcoinCoreVersion => Constants.BitcoinCoreVersion; public Version HwiVersion => Constants.HwiVersion; public string ClearnetLink => "https://wasabiwallet.io/"; public string TorLink => "http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion"; public string SourceCodeLink => "https://github.com/zkSNACKs/WalletWasabi/"; public string StatusPageLink => "https://stats.uptimerobot.com/YQqGyUL8A7"; public string CustomerSupportLink => "https://www.reddit.com/r/WasabiWallet/"; public string BugReportLink => "https://github.com/zkSNACKs/WalletWasabi/issues/"; public string FAQLink => "https://docs.wasabiwallet.io/FAQ/"; public string DocsLink => "https://docs.wasabiwallet.io/"; public override void OnOpen(CompositeDisposable disposables) { base.OnOpen(disposables); var updateChecker = UpdateChecker; if (updateChecker is { }) { Observable.FromEventPattern<UpdateStatus>(updateChecker, nameof(updateChecker.UpdateStatusChanged)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(e => CurrentBackendMajorVersion = e.EventArgs.CurrentBackendApiVersion) .DisposeWith(disposables); } } } }
using Avalonia.Diagnostics.ViewModels; using System; using System.Runtime.InteropServices; using System.Diagnostics; using System.Collections.Generic; using System.Text; using WalletWasabi.Gui.ViewModels; using System.IO; using ReactiveUI; using System.Reactive; using WalletWasabi.Helpers; using WalletWasabi.Logging; using System.Reactive.Linq; using WalletWasabi.WebClients.Wasabi; using System.Reactive.Disposables; using Splat; using WalletWasabi.Models; using WalletWasabi.Services; namespace WalletWasabi.Gui.Tabs { internal class AboutViewModel : WasabiDocumentTabViewModel { private string _currentBackendMajorVersion; public AboutViewModel() : base("About") { var global = Locator.Current.GetService<Global>(); var hostedServices = global.HostedServices; UpdateChecker = hostedServices.FirstOrDefault<UpdateChecker>(); CurrentBackendMajorVersion = UpdateChecker.UpdateStatus?.CurrentBackendApiVersion ?? ""; OpenBrowserCommand = ReactiveCommand.CreateFromTask<string>(IoHelpers.OpenBrowserAsync); OpenBrowserCommand.ThrownExceptions .ObserveOn(RxApp.TaskpoolScheduler) .Subscribe(ex => Logger.LogError(ex)); } public ReactiveCommand<string, Unit> OpenBrowserCommand { get; } private UpdateChecker UpdateChecker { get; } public Version ClientVersion => Constants.ClientVersion; public string BackendCompatibleVersions => Constants.ClientSupportBackendVersionText; public string CurrentBackendMajorVersion { get => _currentBackendMajorVersion; set => this.RaiseAndSetIfChanged(ref _currentBackendMajorVersion, value); } public Version BitcoinCoreVersion => Constants.BitcoinCoreVersion; public Version HwiVersion => Constants.HwiVersion; public string ClearnetLink => "https://wasabiwallet.io/"; public string TorLink => "http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion"; public string SourceCodeLink => "https://github.com/zkSNACKs/WalletWasabi/"; public string StatusPageLink => "https://stats.uptimerobot.com/YQqGyUL8A7"; public string CustomerSupportLink => "https://www.reddit.com/r/WasabiWallet/"; public string BugReportLink => "https://github.com/zkSNACKs/WalletWasabi/issues/"; public string FAQLink => "https://docs.wasabiwallet.io/FAQ/"; public string DocsLink => "https://docs.wasabiwallet.io/"; public override void OnOpen(CompositeDisposable disposables) { base.OnOpen(disposables); Observable.FromEventPattern<UpdateStatus>(UpdateChecker, nameof(UpdateChecker.UpdateStatusChanged)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(e => CurrentBackendMajorVersion = e.EventArgs.CurrentBackendApiVersion) .DisposeWith(disposables); } } }
mit
C#
4d2f17c2220c4db0ddccddf266948b293933aaf2
Make public a method which was accidentally committed as private.
dneelyep/MonoGameUtils
MonoGameUtils/Drawing/Utilities.cs
MonoGameUtils/Drawing/Utilities.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace MonoGameUtils.Drawing { /// <summary> /// Various useful utility methods that don't obviously go elsewhere. /// </summary> public static class Utilities { /// <summary> /// Draw the provided model in the world, given the provided matrices. /// </summary> /// <param name="model">The model to draw.</param> /// <param name="world">The world matrix that the model should be drawn in.</param> /// <param name="view">The view matrix that the model should be drawn in.</param> /// <param name="projection">The projection matrix that the model should be drawn in.</param> public static void DrawModel(Model model, Matrix world, Matrix view, Matrix projection) { foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = world; effect.View = view; effect.Projection = projection; } mesh.Draw(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace MonoGameUtils.Drawing { /// <summary> /// Various useful utility methods that don't obviously go elsewhere. /// </summary> public static class Utilities { /// <summary> /// Draw the provided model in the world, given the provided matrices. /// </summary> /// <param name="model">The model to draw.</param> /// <param name="world">The world matrix that the model should be drawn in.</param> /// <param name="view">The view matrix that the model should be drawn in.</param> /// <param name="projection">The projection matrix that the model should be drawn in.</param> private static void DrawModel(Model model, Matrix world, Matrix view, Matrix projection) { foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = world; effect.View = view; effect.Projection = projection; } mesh.Draw(); } } } }
mit
C#
28c969b2874167fb39400316aedce27f4ff7620a
Update Lux.cs
metaphorce/leaguesharp
MetaSmite/Champions/Lux.cs
MetaSmite/Champions/Lux.cs
using System; using LeagueSharp; using LeagueSharp.Common; using SharpDX; namespace MetaSmite.Champions { public static class Lux { internal static Spell champSpell; private static Menu Config = MetaSmite.Config; private static double totalDamage; private static double spellDamage; public static void Load() { //Load spells champSpell = new Spell(SpellSlot.R, 3340f); //Spell usage. Config.AddItem(new MenuItem("Enabled-" + MetaSmite.Player.ChampionName, MetaSmite.Player.ChampionName + "-" + champSpell.Slot)).SetValue(true); //Events Game.OnUpdate += OnGameUpdate; } private static void OnGameUpdate(EventArgs args) { if (Config.Item("Enabled").GetValue<KeyBind>().Active || Config.Item("EnabledH").GetValue<KeyBind>().Active) { if (SmiteManager.mob != null && Config.Item(SmiteManager.mob.BaseSkinName).GetValue<bool>() && Vector3.Distance(MetaSmite.Player.ServerPosition, SmiteManager.mob.ServerPosition) <= champSpell.Range) { spellDamage = MetaSmite.Player.GetSpellDamage(SmiteManager.mob, champSpell.Slot); totalDamage = spellDamage + SmiteManager.damage; if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && SmiteManager.smite.IsReady() && champSpell.IsReady() && totalDamage >= SmiteManager.mob.Health) { champSpell.Cast(SmiteManager.mob.ServerPosition); } if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && champSpell.IsReady() && spellDamage >= SmiteManager.mob.Health) { champSpell.Cast(SmiteManager.mob.ServerPosition); } } } } } }
using System; using LeagueSharp; using LeagueSharp.Common; using SharpDX; namespace MetaSmite.Champions { public static class Lux { internal static Spell champSpell; private static Menu Config = MetaSmite.Config; private static double totalDamage; private static double spellDamage; public static void Load() { //Load spells champSpell = new Spell(SpellSlot.R, 3340f); //Spell usage. Config.AddItem(new MenuItem("Enabled-" + MetaSmite.Player.ChampionName, MetaSmite.Player.ChampionName + "-" + champSpell.Slot)).SetValue(true); //Events Game.OnGameUpdate += OnGameUpdate; } private static void OnGameUpdate(EventArgs args) { if (Config.Item("Enabled").GetValue<KeyBind>().Active || Config.Item("EnabledH").GetValue<KeyBind>().Active) { if (SmiteManager.mob != null && Config.Item(SmiteManager.mob.BaseSkinName).GetValue<bool>() && Vector3.Distance(MetaSmite.Player.ServerPosition, SmiteManager.mob.ServerPosition) <= champSpell.Range) { spellDamage = MetaSmite.Player.GetSpellDamage(SmiteManager.mob, champSpell.Slot); totalDamage = spellDamage + SmiteManager.damage; if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && SmiteManager.smite.IsReady() && champSpell.IsReady() && totalDamage >= SmiteManager.mob.Health) { champSpell.Cast(SmiteManager.mob.ServerPosition); } if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && champSpell.IsReady() && spellDamage >= SmiteManager.mob.Health) { champSpell.Cast(SmiteManager.mob.ServerPosition); } } } } } }
mit
C#
ecb8dd500a53f9014844532bab71350afba2de9e
Fix debuff duplication
bunashibu/kikan
Assets/Scripts/Debuff/Debuff.cs
Assets/Scripts/Debuff/Debuff.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UniRx; namespace Bunashibu.Kikan { public class Debuff { public Debuff(Transform parent) { _id = parent.gameObject.GetInstanceID(); _state = new ReactiveState<DebuffType>(); _effect = new DebuffEffect(parent); } public void Register(DebuffType type, GameObject effect) { _state.Register(type); _effect.Register(type, effect); } public void DurationEnable(DebuffType type, float duration) { if (_state.State[type] == false) _state.Enable(type); MonoUtility.Instance.OverwritableDelaySec(duration, "Debuff" + type + _id.ToString(), () => { _state.Disable(type); }); } public void Instantiate(DebuffType type) { _effect.Instantiate(type); } public void Destroy(DebuffType type) { _effect.Destroy(type); } public IReadOnlyReactiveDictionary<DebuffType, bool> State => _state.State; private int _id; private ReactiveState<DebuffType> _state; private DebuffEffect _effect; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UniRx; namespace Bunashibu.Kikan { public class Debuff { public Debuff(Transform parent) { _state = new ReactiveState<DebuffType>(); _effect = new DebuffEffect(parent); } public void Register(DebuffType type, GameObject effect) { _state.Register(type); _effect.Register(type, effect); } public void DurationEnable(DebuffType type, float duration) { _state.Enable(type); MonoUtility.Instance.DelaySec(duration, () => { _state.Disable(type); }); } public void Instantiate(DebuffType type) { _effect.Instantiate(type); } public void Destroy(DebuffType type) { _effect.Destroy(type); } public IReadOnlyReactiveDictionary<DebuffType, bool> State => _state.State; private ReactiveState<DebuffType> _state; private DebuffEffect _effect; } }
mit
C#
b31faabff41bb98c8d208d01f2010657edf73e3b
Remove unnecessary reference to IScheduledEvent
MarinAtanasov/AppBrix,MarinAtanasov/AppBrix.NetCore
Modules/AppBrix.Events.Schedule/Impl/PriorityQueueItem.cs
Modules/AppBrix.Events.Schedule/Impl/PriorityQueueItem.cs
// Copyright (c) MarinAtanasov. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the project root for license information. // using System; using System.Linq; namespace AppBrix.Events.Schedule.Impl { internal abstract class PriorityQueueItem { #region Properties public abstract object ScheduledEvent { get; } public DateTime Occurrence { get; protected set; } #endregion #region Public and overriden methods public abstract void Execute(); public abstract void MoveToNextOccurrence(DateTime now); #endregion } internal sealed class PriorityQueueItem<T> : PriorityQueueItem where T : IEvent { #region Construction public PriorityQueueItem(IApp app, IScheduledEvent<T> scheduledEvent) { this.app = app; this.scheduledEvent = scheduledEvent; } #endregion #region Properties public override object ScheduledEvent => this.scheduledEvent; #endregion #region Public and overriden methods public override void Execute() { try { this.app.GetEventHub().Raise(this.scheduledEvent.Event); } catch (Exception) { } } public override void MoveToNextOccurrence(DateTime now) { this.Occurrence = this.scheduledEvent.GetNextOccurrence(now); } #endregion #region Private fields and constants private readonly IApp app; private readonly IScheduledEvent<T> scheduledEvent; #endregion } }
// Copyright (c) MarinAtanasov. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the project root for license information. // using System; using System.Linq; namespace AppBrix.Events.Schedule.Impl { internal abstract class PriorityQueueItem { #region Construction public PriorityQueueItem(object scheduledEvent) { this.ScheduledEvent = scheduledEvent; } #endregion #region Properties public object ScheduledEvent { get; } public DateTime Occurrence { get; protected set; } #endregion #region Public and overriden methods public abstract void Execute(); public abstract void MoveToNextOccurrence(DateTime now); #endregion } internal sealed class PriorityQueueItem<T> : PriorityQueueItem where T : IEvent { #region Construction public PriorityQueueItem(IApp app, IScheduledEvent<T> scheduledEvent) : base(scheduledEvent) { this.app = app; this.scheduledEvent = scheduledEvent; } #endregion #region Public and overriden methods public override void Execute() { try { this.app.GetEventHub().Raise(this.scheduledEvent.Event); } catch (Exception) { } } public override void MoveToNextOccurrence(DateTime now) { this.Occurrence = ((IScheduledEvent<T>)this.ScheduledEvent).GetNextOccurrence(now); } #endregion #region Private fields and constants private readonly IApp app; private readonly IScheduledEvent<T> scheduledEvent; #endregion } }
mit
C#
6908fb27ba3521937837bc0bf32769561f018d8e
Kill auto user insertion in non-debug
RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast
RightpointLabs.Pourcast.Web/Controllers/HomeController.cs
RightpointLabs.Pourcast.Web/Controllers/HomeController.cs
using System.Web.Mvc; namespace RightpointLabs.Pourcast.Web.Controllers { using RightpointLabs.Pourcast.Application.Orchestrators.Abstract; public class HomeController : Controller { private readonly ITapOrchestrator _tapOrchestrator; private readonly IIdentityOrchestrator _identityOrchestrator; public HomeController(ITapOrchestrator tapOrchestrator, IIdentityOrchestrator identityOrchestrator) { _tapOrchestrator = tapOrchestrator; _identityOrchestrator = identityOrchestrator; } // // GET: /Home/ public ActionResult Index() { // Replace this with a Mock so it doesn't blow up the app //_tapOrchestrator.PourBeerFromTap("534a14b1aed2bf2a00045509", .01); #if DEBUG // TODO : remove this so users aren't added to admin automatically! var roleName = "Administrators"; var username = Request.LogonUserIdentity.Name; if (!_identityOrchestrator.UserExists(username)) { _identityOrchestrator.CreateUser(username); } if (!_identityOrchestrator.RoleExists(roleName)) { _identityOrchestrator.CreateRole(roleName); } if (!_identityOrchestrator.IsUserInRole(username, roleName)) { _identityOrchestrator.AddUserToRole(username, roleName); } #endif return View(); } } }
using System.Web.Mvc; namespace RightpointLabs.Pourcast.Web.Controllers { using RightpointLabs.Pourcast.Application.Orchestrators.Abstract; public class HomeController : Controller { private readonly ITapOrchestrator _tapOrchestrator; private readonly IIdentityOrchestrator _identityOrchestrator; public HomeController(ITapOrchestrator tapOrchestrator, IIdentityOrchestrator identityOrchestrator) { _tapOrchestrator = tapOrchestrator; _identityOrchestrator = identityOrchestrator; } // // GET: /Home/ public ActionResult Index() { // Replace this with a Mock so it doesn't blow up the app //_tapOrchestrator.PourBeerFromTap("534a14b1aed2bf2a00045509", .01); // TODO : remove this so users aren't added to admin automatically! var roleName = "Administrators"; var username = Request.LogonUserIdentity.Name; if (!_identityOrchestrator.UserExists(username)) { _identityOrchestrator.CreateUser(username); } if (!_identityOrchestrator.RoleExists(roleName)) { _identityOrchestrator.CreateRole(roleName); } if (!_identityOrchestrator.IsUserInRole(username, roleName)) { _identityOrchestrator.AddUserToRole(username, roleName); } return View(); } } }
mit
C#
9504bb8784a6ecceae85573951922967247ed234
Include padding in desired size of a dock container
l8s/Eto,l8s/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,bbqchickenrobot/Eto-1
Source/Eto.Platform.Windows/Forms/WindowsDockContainer.cs
Source/Eto.Platform.Windows/Forms/WindowsDockContainer.cs
using System; using sd = System.Drawing; using swf = System.Windows.Forms; using Eto.Forms; using Eto.Drawing; namespace Eto.Platform.Windows { public abstract class WindowsDockContainer<T, W> : WindowsContainer<T, W>, IDockContainer where T : swf.Control where W : DockContainer { Control content; protected virtual bool UseContentScale { get { return true; } } protected virtual bool UseContentDesiredSize { get { return true; } } public WindowsDockContainer() { } protected override void Initialize() { base.Initialize(); Padding = DockContainer.DefaultPadding; } public virtual swf.Control ContainerContentControl { get { return Control; } } public override Size ParentMinimumSize { get { return base.ParentMinimumSize; } set { var control = content.GetWindowsHandler(); if (control != null) { control.ParentMinimumSize = value; } base.ParentMinimumSize = value; } } public override Size DesiredSize { get { var desiredSize = base.DesiredSize; var handler = content.GetWindowsHandler(); if (handler != null) { var desiredContentSize = handler.DesiredSize; if (!handler.XScale) { if (desiredSize.Width > 0) desiredSize.Width = Math.Max(desiredSize.Width, desiredContentSize.Width); else desiredSize.Width = desiredContentSize.Width; } if (!handler.YScale) { if (desiredSize.Height > 0) desiredSize.Height = Math.Max(desiredSize.Height, desiredContentSize.Height); else desiredSize.Height = desiredContentSize.Height; } } return desiredSize + Padding.Size; } } public override void SetScale(bool xscale, bool yscale) { base.SetScale(xscale, yscale); if (UseContentScale && content != null) content.SetScale(xscale, yscale); } public Padding Padding { get { return ContainerContentControl.Padding.ToEto(); } set { ContainerContentControl.Padding = value.ToSWF(); } } public Control Content { get { return content; } set { Control.SuspendLayout(); if (content != null) { if (UseContentScale) content.SetScale(false, false); var childControl = this.content.GetContainerControl(); ContainerContentControl.Controls.Remove(childControl); } content = value; if (content != null) { if (UseContentScale) content.SetScale(XScale, YScale); var contentControl = content.GetContainerControl(); contentControl.Dock = swf.DockStyle.Fill; ContainerContentControl.Controls.Add(contentControl); } Control.ResumeLayout(); } } } }
using System; using sd = System.Drawing; using swf = System.Windows.Forms; using Eto.Forms; using Eto.Drawing; namespace Eto.Platform.Windows { public abstract class WindowsDockContainer<T, W> : WindowsContainer<T, W>, IDockContainer where T : swf.Control where W : DockContainer { Control content; protected virtual bool UseContentScale { get { return true; } } protected virtual bool UseContentDesiredSize { get { return true; } } public WindowsDockContainer() { } protected override void Initialize() { base.Initialize(); Padding = DockContainer.DefaultPadding; } public virtual swf.Control ContainerContentControl { get { return Control; } } public override Size ParentMinimumSize { get { return base.ParentMinimumSize; } set { var control = content.GetWindowsHandler(); if (control != null) { control.ParentMinimumSize = value; } base.ParentMinimumSize = value; } } public override Size DesiredSize { get { if (UseContentDesiredSize) { var handler = content.GetWindowsHandler(); if (handler != null) { return Size.Max(base.DesiredSize, handler.DesiredSize); } } return base.DesiredSize; } } public override void SetScale(bool xscale, bool yscale) { base.SetScale(xscale, yscale); if (UseContentScale && content != null) content.SetScale(xscale, yscale); } public Padding Padding { get { return ContainerContentControl.Padding.ToEto(); } set { ContainerContentControl.Padding = value.ToSWF(); } } public Control Content { get { return content; } set { Control.SuspendLayout(); if (content != null) { if (UseContentScale) content.SetScale(false, false); var childControl = this.content.GetContainerControl(); ContainerContentControl.Controls.Remove(childControl); } content = value; if (content != null) { if (UseContentScale) content.SetScale(XScale, YScale); var contentControl = content.GetContainerControl(); contentControl.Dock = swf.DockStyle.Fill; ContainerContentControl.Controls.Add(contentControl); } Control.ResumeLayout(); } } } }
bsd-3-clause
C#
9593155cb6eeed049c96d1eb633695bfd727d336
Update HttpContextAccessor.cs
IDeliverable/Orchard,yersans/Orchard,Serlead/Orchard,li0803/Orchard,ehe888/Orchard,Serlead/Orchard,jagraz/Orchard,Fogolan/OrchardForWork,Dolphinsimon/Orchard,jersiovic/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,jersiovic/Orchard,JRKelso/Orchard,brownjordaninternational/OrchardCMS,jtkech/Orchard,rtpHarry/Orchard,rtpHarry/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,grapto/Orchard.CloudBust,hannan-azam/Orchard,Dolphinsimon/Orchard,TalaveraTechnologySolutions/Orchard,johnnyqian/Orchard,sfmskywalker/Orchard,TalaveraTechnologySolutions/Orchard,geertdoornbos/Orchard,tobydodds/folklife,Praggie/Orchard,omidnasri/Orchard,AdvantageCS/Orchard,bedegaming-aleksej/Orchard,Serlead/Orchard,AdvantageCS/Orchard,mvarblow/Orchard,neTp9c/Orchard,TalaveraTechnologySolutions/Orchard,li0803/Orchard,aaronamm/Orchard,SzymonSel/Orchard,li0803/Orchard,Codinlab/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,yersans/Orchard,vairam-svs/Orchard,jchenga/Orchard,jersiovic/Orchard,abhishekluv/Orchard,jimasp/Orchard,omidnasri/Orchard,jagraz/Orchard,armanforghani/Orchard,fassetar/Orchard,fassetar/Orchard,gcsuk/Orchard,omidnasri/Orchard,jimasp/Orchard,SzymonSel/Orchard,aaronamm/Orchard,Dolphinsimon/Orchard,bedegaming-aleksej/Orchard,aaronamm/Orchard,LaserSrl/Orchard,Fogolan/OrchardForWork,JRKelso/Orchard,OrchardCMS/Orchard,phillipsj/Orchard,hbulzy/Orchard,tobydodds/folklife,Fogolan/OrchardForWork,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,hannan-azam/Orchard,hannan-azam/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,rtpHarry/Orchard,armanforghani/Orchard,neTp9c/Orchard,Codinlab/Orchard,sfmskywalker/Orchard,AdvantageCS/Orchard,johnnyqian/Orchard,ehe888/Orchard,sfmskywalker/Orchard,JRKelso/Orchard,Praggie/Orchard,Codinlab/Orchard,omidnasri/Orchard,IDeliverable/Orchard,Codinlab/Orchard,bedegaming-aleksej/Orchard,jersiovic/Orchard,Fogolan/OrchardForWork,omidnasri/Orchard,SouleDesigns/SouleDesigns.Orchard,gcsuk/Orchard,jimasp/Orchard,sfmskywalker/Orchard,yersans/Orchard,abhishekluv/Orchard,TalaveraTechnologySolutions/Orchard,armanforghani/Orchard,Lombiq/Orchard,SzymonSel/Orchard,SouleDesigns/SouleDesigns.Orchard,SouleDesigns/SouleDesigns.Orchard,neTp9c/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,li0803/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,phillipsj/Orchard,IDeliverable/Orchard,ehe888/Orchard,phillipsj/Orchard,sfmskywalker/Orchard,Dolphinsimon/Orchard,geertdoornbos/Orchard,Praggie/Orchard,jagraz/Orchard,gcsuk/Orchard,yersans/Orchard,neTp9c/Orchard,mvarblow/Orchard,AdvantageCS/Orchard,aaronamm/Orchard,hbulzy/Orchard,xkproject/Orchard,gcsuk/Orchard,hannan-azam/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,armanforghani/Orchard,Lombiq/Orchard,phillipsj/Orchard,LaserSrl/Orchard,bedegaming-aleksej/Orchard,IDeliverable/Orchard,OrchardCMS/Orchard,jchenga/Orchard,johnnyqian/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard,xkproject/Orchard,brownjordaninternational/OrchardCMS,jtkech/Orchard,tobydodds/folklife,tobydodds/folklife,jtkech/Orchard,Dolphinsimon/Orchard,yersans/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Praggie/Orchard,TalaveraTechnologySolutions/Orchard,jchenga/Orchard,xkproject/Orchard,jagraz/Orchard,IDeliverable/Orchard,TalaveraTechnologySolutions/Orchard,johnnyqian/Orchard,Codinlab/Orchard,Praggie/Orchard,li0803/Orchard,grapto/Orchard.CloudBust,LaserSrl/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,jersiovic/Orchard,neTp9c/Orchard,OrchardCMS/Orchard,JRKelso/Orchard,Fogolan/OrchardForWork,bedegaming-aleksej/Orchard,vairam-svs/Orchard,SzymonSel/Orchard,LaserSrl/Orchard,armanforghani/Orchard,jimasp/Orchard,brownjordaninternational/OrchardCMS,JRKelso/Orchard,omidnasri/Orchard,OrchardCMS/Orchard,fassetar/Orchard,xkproject/Orchard,phillipsj/Orchard,mvarblow/Orchard,Lombiq/Orchard,vairam-svs/Orchard,SzymonSel/Orchard,jchenga/Orchard,grapto/Orchard.CloudBust,fassetar/Orchard,OrchardCMS/Orchard,mvarblow/Orchard,gcsuk/Orchard,jagraz/Orchard,hannan-azam/Orchard,Lombiq/Orchard,geertdoornbos/Orchard,abhishekluv/Orchard,grapto/Orchard.CloudBust,sfmskywalker/Orchard,johnnyqian/Orchard,ehe888/Orchard,omidnasri/Orchard,omidnasri/Orchard,grapto/Orchard.CloudBust,brownjordaninternational/OrchardCMS,AdvantageCS/Orchard,hbulzy/Orchard,geertdoornbos/Orchard,xkproject/Orchard,omidnasri/Orchard,rtpHarry/Orchard,Serlead/Orchard,SouleDesigns/SouleDesigns.Orchard,abhishekluv/Orchard,jchenga/Orchard,Lombiq/Orchard,brownjordaninternational/OrchardCMS,geertdoornbos/Orchard,tobydodds/folklife,jimasp/Orchard,grapto/Orchard.CloudBust,vairam-svs/Orchard,jtkech/Orchard,TalaveraTechnologySolutions/Orchard,sfmskywalker/Orchard,LaserSrl/Orchard,Serlead/Orchard,fassetar/Orchard,vairam-svs/Orchard,mvarblow/Orchard,ehe888/Orchard,aaronamm/Orchard,hbulzy/Orchard,rtpHarry/Orchard,abhishekluv/Orchard,abhishekluv/Orchard,tobydodds/folklife,TalaveraTechnologySolutions/Orchard,jtkech/Orchard,hbulzy/Orchard
src/Orchard/Mvc/HttpContextAccessor.cs
src/Orchard/Mvc/HttpContextAccessor.cs
using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Messaging; using System.Web; namespace Orchard.Mvc { public class HttpContextAccessor : IHttpContextAccessor { private HttpContextBase _httpContext; public HttpContextBase Current() { var httpContext = GetStaticProperty(); if (!IsBackgroundHttpContext(httpContext)) return new HttpContextWrapper(httpContext); if (_httpContext != null) return _httpContext; var context = CallContext.LogicalGetData("HttpContext") as ObjectHandle; return context != null ? context.Unwrap() as HttpContextBase : null; } public void Set(HttpContextBase httpContext) { _httpContext = httpContext; } private static bool IsBackgroundHttpContext(HttpContext httpContext) { return httpContext == null || httpContext.Items.Contains(MvcModule.IsBackgroundHttpContextKey); } private static HttpContext GetStaticProperty() { var httpContext = HttpContext.Current; if (httpContext == null) { return null; } try { // The "Request" property throws at application startup on IIS integrated pipeline mode. if (httpContext.Request == null) { return null; } } catch (Exception) { return null; } return httpContext; } } }
using System; using System.Runtime.Remoting.Messaging; using System.Web; namespace Orchard.Mvc { public class HttpContextAccessor : IHttpContextAccessor { private HttpContextBase _httpContext; public HttpContextBase Current() { var httpContext = GetStaticProperty(); return !IsBackgroundHttpContext(httpContext) ? new HttpContextWrapper(httpContext) : _httpContext ?? CallContext.LogicalGetData("HttpContext") as HttpContextBase; } public void Set(HttpContextBase httpContext) { _httpContext = httpContext; } private static bool IsBackgroundHttpContext(HttpContext httpContext) { return httpContext == null || httpContext.Items.Contains(MvcModule.IsBackgroundHttpContextKey); } private static HttpContext GetStaticProperty() { var httpContext = HttpContext.Current; if (httpContext == null) { return null; } try { // The "Request" property throws at application startup on IIS integrated pipeline mode. if (httpContext.Request == null) { return null; } } catch (Exception) { return null; } return httpContext; } } }
bsd-3-clause
C#
08b8d8f5398ed205d36840fbe781b8a8c17c2e04
Add Linktype to Field
contentful/contentful.net
Contentful.Core/Models/Field.cs
Contentful.Core/Models/Field.cs
using Contentful.Core.Models.Management; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Contentful.Core.Models { /// <summary> /// Represents a field in a <seealso cref="ContentType"/>. Note that this is not the representation of a field with /// actual value in an <seealso cref="Entry{T}"/> or <seealso cref="Asset"/>, but merely a representation of the fields data structure. /// </summary> public class Field { /// <summary> /// The ID of the field. It must be unique among all fields of the <seealso cref="ContentType"/>. /// </summary> public string Id { get; set; } /// <summary> /// The name of the field. This will be the label of the field in the Contentful web app. /// </summary> public string Name { get; set; } /// <summary> /// The type of field. Determines what type of data can be stored in the field. /// </summary> public string Type { get; set; } /// <summary> /// Whether this field is mandatory or not. /// </summary> public bool Required { get; set; } /// <summary> /// Whether this field supports different values for different locales. /// </summary> public bool Localized { get; set; } /// <summary> /// The type of link, if any. Normally Asset or Entry. /// </summary> public string LinkType { get; set; } /// <summary> /// Whether this field is disabled. Disabled fields are not visible in the Contentful web app. /// </summary> public bool Disabled { get; set; } /// <summary> /// Whether this field is omitted in the response from the Content Delivery and Preview APIs. /// </summary> public bool Omitted { get; set; } /// <summary> /// Defines a schema for the elements of an array field. Will be null for other types. /// </summary> public Schema Items { get; set; } /// <summary> /// The validations that should be applied to the field. /// </summary> public List<IFieldValidator> Validations { get; set; } } }
using Contentful.Core.Models.Management; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Contentful.Core.Models { /// <summary> /// Represents a field in a <seealso cref="ContentType"/>. Note that this is not the representation of a field with /// actual value in an <seealso cref="Entry{T}"/> or <seealso cref="Asset"/>, but merely a representation of the fields data structure. /// </summary> public class Field { /// <summary> /// The ID of the field. It must be unique among all fields of the <seealso cref="ContentType"/>. /// </summary> public string Id { get; set; } /// <summary> /// The name of the field. This will be the label of the field in the Contentful web app. /// </summary> public string Name { get; set; } /// <summary> /// The type of field. Determines what type of data can be stored in the field. /// </summary> public string Type { get; set; } /// <summary> /// Whether this field is mandatory or not. /// </summary> public bool Required { get; set; } /// <summary> /// Whether this field supports different values for different locales. /// </summary> public bool Localized { get; set; } /// <summary> /// Whether this field is disabled. Disabled fields are not visible in the Contentful web app. /// </summary> public bool Disabled { get; set; } /// <summary> /// Whether this field is omitted in the response from the Content Delivery and Preview APIs. /// </summary> public bool Omitted { get; set; } /// <summary> /// Defines a schema for the elements of an array field. Will be null for other types. /// </summary> public Schema Items { get; set; } /// <summary> /// The validations that should be applied to the field. /// </summary> public List<IFieldValidator> Validations { get; set; } } }
mit
C#
7083d08effa07f765cd8f2e3cef1f4c60b5ac0db
Simplify date/time parsing in console app
atifaziz/NCrontab,atifaziz/NCrontab
NCrontabConsole/Program.cs
NCrontabConsole/Program.cs
#region License and Terms // // NCrontab - Crontab for .NET // Copyright (c) 2008 Atif Aziz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.Collections.Generic; using System.Globalization; using NCrontab; var verbose = false; try { var argList = new List<string>(args); var verboseIndex = argList.IndexOf("--verbose"); // ReSharper disable once AssignmentInConditionalExpression if (verbose = verboseIndex >= 0) argList.RemoveAt(verboseIndex); if (argList.Count < 3) throw new ApplicationException("Missing required arguments. You must at least supply CRONTAB-EXPRESSION START-DATE END-DATE."); var expression = argList[0].Trim(); var options = new CrontabSchedule.ParseOptions { IncludingSeconds = expression.Split(' ').Length > 5, }; var start = ParseDateArgument(argList[1], "start"); var end = ParseDateArgument(argList[2], "end"); var format = argList.Count > 3 ? argList[3] : options.IncludingSeconds ? "ddd, dd MMM yyyy HH:mm:ss" : "ddd, dd MMM yyyy HH:mm"; var schedule = CrontabSchedule.Parse(expression, options); foreach (var occurrence in schedule.GetNextOccurrences(start, end)) Console.Out.WriteLine(occurrence.ToString(format)); return 0; } catch (Exception e) { var error = verbose ? e.ToString() : e is ApplicationException ? e.Message : e.GetBaseException().Message; Console.Error.WriteLine(error); return 1; } static DateTime ParseDateArgument(string arg, string hint) => DateTime.TryParse(arg, null, DateTimeStyles.AssumeLocal, out var v) ? v : throw new ApplicationException("Invalid " + hint + " date or date format argument."); sealed class ApplicationException : Exception { public ApplicationException() {} public ApplicationException(string message) : base(message) {} }
#region License and Terms // // NCrontab - Crontab for .NET // Copyright (c) 2008 Atif Aziz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.Collections.Generic; using System.Globalization; using NCrontab; var verbose = false; try { var argList = new List<string>(args); var verboseIndex = argList.IndexOf("--verbose"); // ReSharper disable once AssignmentInConditionalExpression if (verbose = verboseIndex >= 0) argList.RemoveAt(verboseIndex); if (argList.Count < 3) throw new ApplicationException("Missing required arguments. You must at least supply CRONTAB-EXPRESSION START-DATE END-DATE."); var expression = argList[0].Trim(); var options = new CrontabSchedule.ParseOptions { IncludingSeconds = expression.Split(' ').Length > 5, }; var start = ParseDateArgument(argList[1], "start"); var end = ParseDateArgument(argList[2], "end"); var format = argList.Count > 3 ? argList[3] : options.IncludingSeconds ? "ddd, dd MMM yyyy HH:mm:ss" : "ddd, dd MMM yyyy HH:mm"; var schedule = CrontabSchedule.Parse(expression, options); foreach (var occurrence in schedule.GetNextOccurrences(start, end)) Console.Out.WriteLine(occurrence.ToString(format)); return 0; } catch (Exception e) { var error = verbose ? e.ToString() : e is ApplicationException ? e.Message : e.GetBaseException().Message; Console.Error.WriteLine(error); return 1; } static DateTime ParseDateArgument(string arg, string hint) { try { return DateTime.Parse(arg, null, DateTimeStyles.AssumeLocal); } catch (FormatException e) { throw new ApplicationException("Invalid " + hint + " date or date format argument.", e); } } sealed class ApplicationException : Exception { public ApplicationException() {} public ApplicationException(string message) : base(message) {} public ApplicationException(string message, Exception inner) : base(message, inner) {} }
apache-2.0
C#
9ccaad59818bae57aa264732ae35746949c723a2
Fix bug in VersionComparer class
Ruhrpottpatriot/SemanticVersion
src/SemanticVersion/VersionComparer.cs
src/SemanticVersion/VersionComparer.cs
namespace SemVersion { using System.Collections.Generic; public sealed class VersionComparer : IEqualityComparer<SemanticVersion>, IComparer<SemanticVersion> { /// <inheritdoc/> public bool Equals(SemanticVersion left, SemanticVersion right) { return this.Compare(left, right) == 0; } /// <inheritdoc/> public int Compare(SemanticVersion left, SemanticVersion right) { if (ReferenceEquals(left, null)) { return ReferenceEquals(right, null) ? 0 : -1; } if (ReferenceEquals(right, null)) { return 1; } int majorComp = left.Major.CompareToBoxed(right.Major); if (majorComp != 0) { return majorComp; } int minorComp = left.Minor.CompareToBoxed(right.Minor); if (minorComp != 0) { return minorComp; } int patchComp = left.Patch.CompareToBoxed(right.Patch); if (patchComp != 0) { return patchComp; } return left.Prerelease.CompareComponent(right.Prerelease); } /// <inheritdoc/> public int GetHashCode(SemanticVersion obj) { return obj.GetHashCode(); } } }
namespace SemVersion { using System.Collections.Generic; public sealed class VersionComparer : IEqualityComparer<SemanticVersion>, IComparer<SemanticVersion> { /// <inheritdoc/> public bool Equals(SemanticVersion left, SemanticVersion right) { return left.Compare(left, right) == 0; } /// <inheritdoc/> public int Compare(SemanticVersion left, SemanticVersion right) { if (ReferenceEquals(left, null)) { return ReferenceEquals(right, null) ? 0 : -1; } if (ReferenceEquals(right, null)) { return 1; } int majorComp = left.Major.CompareToBoxed(right.Major); if (majorComp != 0) { return majorComp; } int minorComp = left.Minor.CompareToBoxed(right.Minor); if (minorComp != 0) { return minorComp; } int patchComp = left.Patch.CompareToBoxed(right.Patch); if (patchComp != 0) { return patchComp; } return left.Prerelease.CompareComponent(right.Prerelease); } /// <inheritdoc/> public int GetHashCode(SemanticVersion obj) { return obj.GetHashCode(); } } }
mit
C#
481d3edace494573a867e640d4f18a29db7e338e
Fix displayed count
appharbor/appharbor-cli
src/AppHarbor/CompressionExtensions.cs
src/AppHarbor/CompressionExtensions.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using ICSharpCode.SharpZipLib.Tar; namespace AppHarbor { public static class CompressionExtensions { public static void ToTar(this DirectoryInfo sourceDirectory, Stream output, string[] excludedDirectoryNames) { var archive = TarArchive.CreateOutputTarArchive(output); archive.RootPath = sourceDirectory.FullName.Replace(Path.DirectorySeparatorChar, '/').TrimEnd('/'); var entries = GetFiles(sourceDirectory, excludedDirectoryNames) .Select(x => TarEntry.CreateEntryFromFile(x.FullName)) .ToList(); var entriesCount = entries.Count(); for (var i = 0; i < entriesCount; i++) { archive.WriteEntry(entries[i], true); ConsoleProgressBar.Render(i * 100 / (double)entriesCount, ConsoleColor.Green, string.Format("Packing files ({0} of {1})", i + 1, entriesCount)); } Console.CursorTop++; Console.WriteLine(); archive.Close(); } private static IEnumerable<FileInfo> GetFiles(DirectoryInfo directory, string[] excludedDirectories) { return directory.GetFiles("*", SearchOption.TopDirectoryOnly) .Concat(directory.GetDirectories() .Where(x => !excludedDirectories.Contains(x.Name)) .SelectMany(x => GetFiles(x, excludedDirectories))); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using ICSharpCode.SharpZipLib.Tar; namespace AppHarbor { public static class CompressionExtensions { public static void ToTar(this DirectoryInfo sourceDirectory, Stream output, string[] excludedDirectoryNames) { var archive = TarArchive.CreateOutputTarArchive(output); archive.RootPath = sourceDirectory.FullName.Replace(Path.DirectorySeparatorChar, '/').TrimEnd('/'); var entries = GetFiles(sourceDirectory, excludedDirectoryNames) .Select(x => TarEntry.CreateEntryFromFile(x.FullName)) .ToList(); var entriesCount = entries.Count(); for (var i = 0; i < entriesCount; i++) { archive.WriteEntry(entries[i], true); ConsoleProgressBar.Render(i * 100 / (double)entriesCount, ConsoleColor.Green, string.Format("Packing files ({0} of {1})", i, entriesCount)); } Console.CursorTop++; Console.WriteLine(); archive.Close(); } private static IEnumerable<FileInfo> GetFiles(DirectoryInfo directory, string[] excludedDirectories) { return directory.GetFiles("*", SearchOption.TopDirectoryOnly) .Concat(directory.GetDirectories() .Where(x => !excludedDirectories.Contains(x.Name)) .SelectMany(x => GetFiles(x, excludedDirectories))); } } }
mit
C#
d1c8875d36dcad93dc26aeb1b7d689768492b166
Update GenericXRSDKCameraSettings.cs
DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
Assets/MixedRealityToolkit.Providers/XRSDK/GenericXRSDKCameraSettings.cs
Assets/MixedRealityToolkit.Providers/XRSDK/GenericXRSDKCameraSettings.cs
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.CameraSystem; using Microsoft.MixedReality.Toolkit.Utilities; namespace Microsoft.MixedReality.Toolkit.XRSDK { /// <summary> /// Camera settings provider for use with XR SDK. /// </summary> [MixedRealityDataProvider( typeof(IMixedRealityCameraSystem), (SupportedPlatforms)(-1), "XR SDK Camera Settings")] public class GenericXRSDKCameraSettings : BaseCameraSettingsProvider { /// <summary> /// Constructor. /// </summary> /// <param name="cameraSystem">The instance of the camera system which is managing this provider.</param> /// <param name="name">Friendly name of the provider.</param> /// <param name="priority">Provider priority. Used to determine order of instantiation.</param> /// <param name="profile">The provider's configuration profile.</param> public GenericXRSDKCameraSettings( IMixedRealityCameraSystem cameraSystem, string name = null, uint priority = DefaultPriority, BaseCameraSettingsProfile profile = null) : base(cameraSystem, name, priority, profile) { } #region IMixedRealityCameraSettings /// <inheritdoc/> public override bool IsOpaque => XRSDKSubsystemHelpers.DisplaySubsystem?.displayOpaque ?? true; #endregion IMixedRealityCameraSettings } }
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.CameraSystem; using Microsoft.MixedReality.Toolkit.Utilities; namespace Microsoft.MixedReality.Toolkit.XRSDK { /// <summary> /// Camera settings provider for use with Windows Mixed Reality and XR SDK. /// </summary> [MixedRealityDataProvider( typeof(IMixedRealityCameraSystem), (SupportedPlatforms)(-1), "XR SDK Camera Settings")] public class GenericXRSDKCameraSettings : BaseCameraSettingsProvider { /// <summary> /// Constructor. /// </summary> /// <param name="cameraSystem">The instance of the camera system which is managing this provider.</param> /// <param name="name">Friendly name of the provider.</param> /// <param name="priority">Provider priority. Used to determine order of instantiation.</param> /// <param name="profile">The provider's configuration profile.</param> public GenericXRSDKCameraSettings( IMixedRealityCameraSystem cameraSystem, string name = null, uint priority = DefaultPriority, BaseCameraSettingsProfile profile = null) : base(cameraSystem, name, priority, profile) { } #region IMixedRealityCameraSettings /// <inheritdoc/> public override bool IsOpaque => XRSDKSubsystemHelpers.DisplaySubsystem?.displayOpaque ?? true; #endregion IMixedRealityCameraSettings } }
mit
C#
5ec1fafae3df966d0166ad1a6e025026712a78bd
Update to version 1.5.0
anonymousthing/ListenMoeClient
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Listen.moe Client")] [assembly: AssemblyProduct("Listen.moe Client")] [assembly: AssemblyDescription("")] [assembly: AssemblyCopyright("Copyright 2017 Listen.moe. All rights reserved.")] // 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("88b02799-425e-4622-a849-202adb19601b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.0.0")] [assembly: AssemblyFileVersion("1.5.0.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Listen.moe Client")] [assembly: AssemblyProduct("Listen.moe Client")] [assembly: AssemblyDescription("")] [assembly: AssemblyCopyright("Copyright 2017 Listen.moe. All rights reserved.")] // 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("88b02799-425e-4622-a849-202adb19601b")] // 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.4.1.0")] [assembly: AssemblyFileVersion("1.4.1.0")]
mit
C#
b28a315533dae7f3405d447fcd9a5aad5dd8c152
Test checks for returned credential string. For some reason, the test fails and passes depending on what the server returns.
dance2die/MyAnimeListSharp
Project.MyAnimeList/Project.MyAnimeList.Test/Tests/AccountMethodsTest.cs
Project.MyAnimeList/Project.MyAnimeList.Test/Tests/AccountMethodsTest.cs
using System.Net; using MyAnimeListSharp.Auth; using MyAnimeListSharp.Facade; using Project.MyAnimeList.Test.Fixture; using Xunit; using Xunit.Abstractions; namespace Project.MyAnimeList.Test.Tests { public class AccountMethodsTest : CredentialCollectionTest { private readonly ITestOutputHelper _output; public AccountMethodsTest(CredentialContextFixture credentialContextFixture, ITestOutputHelper output) : base(credentialContextFixture) { _output = output; } [Fact] public void TestCredentialContextNotEmpty() { var sut = CredentialContextFixture.CredentialContext; Assert.False(string.IsNullOrEmpty(sut.UserName)); Assert.False(string.IsNullOrEmpty(sut.Password)); } [Fact] public void TestVerifiyCredentialsNotEmpty() { var sut = new AccountMethods(CredentialContextFixture.CredentialContext); var credentials = sut.VerifyCredentials(); _output.WriteLine(credentials); Assert.False(string.IsNullOrEmpty(credentials)); Assert.Contains("id", credentials); Assert.Contains("username", credentials); } [Theory] [InlineData("badUserName", "badPassword")] [InlineData("aaaaaaaaaa", "bbbbbbbbbb")] public void ThrowsExceptionWhenInvalidCredentialIsPassed(string userName, string password) { ICredentialContext credentialContext = new CredentialContext { UserName = userName, Password = password }; var sut = new AccountMethods(credentialContext); Assert.Throws<WebException>(() => { var response = sut.VerifyCredentials(); _output.WriteLine(response); }); } } }
using System.Net; using MyAnimeListSharp.Auth; using MyAnimeListSharp.Facade; using Project.MyAnimeList.Test.Fixture; using Xunit; using Xunit.Abstractions; namespace Project.MyAnimeList.Test.Tests { public class AccountMethodsTest : CredentialCollectionTest { private readonly ITestOutputHelper _output; public AccountMethodsTest(CredentialContextFixture credentialContextFixture, ITestOutputHelper output) : base(credentialContextFixture) { _output = output; } [Fact] public void TestCredentialContextNotEmpty() { var sut = CredentialContextFixture.CredentialContext; Assert.False(string.IsNullOrEmpty(sut.UserName)); Assert.False(string.IsNullOrEmpty(sut.Password)); } [Fact] public void TestVerifiyCredentialsNotEmpty() { var sut = new AccountMethods(CredentialContextFixture.CredentialContext); var credentials = sut.VerifyCredentials(); _output.WriteLine(credentials); Assert.False(string.IsNullOrEmpty(credentials)); Assert.Contains("id", credentials); Assert.Contains("username", credentials); } [Theory] [InlineData("badUserName", "badPassword")] [InlineData("aaaaaaaaaa", "bbbbbbbbbb")] public void ThrowsExceptionWhenInvalidCredentialIsPassed(string userName, string password) { ICredentialContext credentialContext = new CredentialContext { UserName = userName, Password = password }; var sut = new AccountMethods(credentialContext); Assert.Throws<WebException>(() => sut.VerifyCredentials()); } } }
mit
C#
082a84ec05c3d0d0a26b8487c196ecfdf185b746
Add our installer actions
sickboy/Squirrel.Windows,jochenvangasse/Squirrel.Windows,airtimemedia/Squirrel.Windows,markwal/Squirrel.Windows,hammerandchisel/Squirrel.Windows,yovannyr/Squirrel.Windows,BloomBooks/Squirrel.Windows,bowencode/Squirrel.Windows,kenbailey/Squirrel.Windows,jochenvangasse/Squirrel.Windows,Suninus/Squirrel.Windows,flagbug/Squirrel.Windows,yovannyr/Squirrel.Windows,EdZava/Squirrel.Windows,aneeff/Squirrel.Windows,ChaseFlorell/Squirrel.Windows,yovannyr/Squirrel.Windows,vaginessa/Squirrel.Windows,Squirrel/Squirrel.Windows,josenbo/Squirrel.Windows,allanrsmith/Squirrel.Windows,Squirrel/Squirrel.Windows,willdean/Squirrel.Windows,kenbailey/Squirrel.Windows,JonMartinTx/AS400Report,ruisebastiao/Squirrel.Windows,Katieleeb84/Squirrel.Windows,awseward/Squirrel.Windows,EdZava/Squirrel.Windows,punker76/Squirrel.Windows,1gurucoder/Squirrel.Windows,bowencode/Squirrel.Windows,punker76/Squirrel.Windows,BarryThePenguin/Squirrel.Windows,kenbailey/Squirrel.Windows,punker76/Squirrel.Windows,aneeff/Squirrel.Windows,BarryThePenguin/Squirrel.Windows,NeilSorensen/Squirrel.Windows,markuscarlen/Squirrel.Windows,hammerandchisel/Squirrel.Windows,cguedel/Squirrel.Windows,Suninus/Squirrel.Windows,markwal/Squirrel.Windows,aneeff/Squirrel.Windows,Squirrel/Squirrel.Windows,vaginessa/Squirrel.Windows,GeertvanHorrik/Squirrel.Windows,allanrsmith/Squirrel.Windows,josenbo/Squirrel.Windows,JonMartinTx/AS400Report,sickboy/Squirrel.Windows,cguedel/Squirrel.Windows,hammerandchisel/Squirrel.Windows,NeilSorensen/Squirrel.Windows,markwal/Squirrel.Windows,willdean/Squirrel.Windows,jbeshir/Squirrel.Windows,Katieleeb84/Squirrel.Windows,JonMartinTx/AS400Report,1gurucoder/Squirrel.Windows,awseward/Squirrel.Windows,allanrsmith/Squirrel.Windows,jbeshir/Squirrel.Windows,flagbug/Squirrel.Windows,ChaseFlorell/Squirrel.Windows,GeertvanHorrik/Squirrel.Windows,josenbo/Squirrel.Windows,BloomBooks/Squirrel.Windows,ruisebastiao/Squirrel.Windows,Suninus/Squirrel.Windows,1gurucoder/Squirrel.Windows,GeertvanHorrik/Squirrel.Windows,flagbug/Squirrel.Windows,airtimemedia/Squirrel.Windows,BloomBooks/Squirrel.Windows,NeilSorensen/Squirrel.Windows,willdean/Squirrel.Windows,markuscarlen/Squirrel.Windows,awseward/Squirrel.Windows,cguedel/Squirrel.Windows,markuscarlen/Squirrel.Windows,EdZava/Squirrel.Windows,Katieleeb84/Squirrel.Windows,ChaseFlorell/Squirrel.Windows,sickboy/Squirrel.Windows,jochenvangasse/Squirrel.Windows,airtimemedia/Squirrel.Windows,akrisiun/Squirrel.Windows,ruisebastiao/Squirrel.Windows,bowencode/Squirrel.Windows,BarryThePenguin/Squirrel.Windows,vaginessa/Squirrel.Windows,jbeshir/Squirrel.Windows
src/Update/Program.cs
src/Update/Program.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Mono.Options; namespace Update { enum UpdateAction { Unset = 0, Install, Uninstall, Download, Update, } class Program { static OptionSet opts; static int Main(string[] args) { if (args.Any(x => x.StartsWith("/squirrel", StringComparison.OrdinalIgnoreCase))) { // NB: We're marked as Squirrel-aware, but we don't want to do // anything in response to these events return 0; } bool silentInstall = false; var updateAction = default(UpdateAction); string target = default(string); opts = new OptionSet() { "Usage: Update.exe command [OPTS]", "Manages Squirrel packages", "", "Commands", { "install=", "Install the app specified by the RELEASES file", v => { updateAction = UpdateAction.Install; target = v; } }, { "uninstall", "Uninstall the app the same dir as Update.exe", v => updateAction = UpdateAction.Uninstall}, { "download=", "Download the releases specified by the URL and write new results to stdout as JSON", v => { updateAction = UpdateAction.Download; target = v; } }, { "update", "Update the application to the latest remote version", v => updateAction = UpdateAction.Update }, "", "Options:", { "h|?|help", "Display Help and exit", _ => ShowHelp() }, { "s|silent", "Silent install", _ => silentInstall = true}, }; opts.Parse(args); if (updateAction == UpdateAction.Unset) { ShowHelp(); } return 0; } static void ShowHelp() { opts.WriteOptionDescriptions(Console.Out); Environment.Exit(0); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Mono.Options; namespace Update { class Program { static OptionSet opts; static int Main(string[] args) { if (args.Any(x => x.StartsWith("/squirrel", StringComparison.OrdinalIgnoreCase))) { // NB: We're marked as Squirrel-aware, but we don't want to do // anything in response to these events return 0; } opts = new OptionSet() { "Usage: Update.exe command [OPTS]", "Manages Squirrel packages", "", "Options:", { "h|?|help", "Display Help and exit", v => ShowHelp() } }; opts.Parse(args); return 0; } static void ShowHelp() { opts.WriteOptionDescriptions(Console.Out); Environment.Exit(0); } } }
mit
C#
8aa80b9f193480d8ea395991719b62c7b9bac841
Fix typo
fedoaa/SimpleTwitchBot
SimpleTwitchBot.Lib/TwitchIrcClient.cs
SimpleTwitchBot.Lib/TwitchIrcClient.cs
using SimpleTwitchBot.Lib.Events; using SimpleTwitchBot.Lib.Models; using System; namespace SimpleTwitchBot.Lib { public class TwitchIrcClient : IrcClient { public event EventHandler<OnChatMessageReceivedArgs> OnChatMessageReceived; public event EventHandler<OnWhisperMessageReceivedArgs> OnWhisperMessageReceived; public TwitchIrcClient(string ip, int port) : base(ip, port) { OnPing += Client_OnPing; OnConnect += TwitchIrcClient_OnConnect; OnIrcMessageReceived += Client_OnIrcMessageReceived; } private void TwitchIrcClient_OnConnect(object sender, EventArgs e) { EnableMessageTags(); } private void EnableMessageTags() { SendIrcMessage("CAP REQ :twitch.tv/tags"); SendIrcMessage("CAP REQ :twitch.tv/commands"); } private void Client_OnPing(object sender, OnPingArgs e) { SendIrcMessage($"PONG {e.ServerAddress}"); } private void Client_OnIrcMessageReceived(object sender, OnIrcMessageReceivedArgs e) { switch(e.Message.Command) { case "PRIVMSG": var chatMessage = new TwitchChatMessage(e.Message); CallOnChatMessageReceived(chatMessage); break; case "WHISPER": var whisperMessage = new TwitchWhisperMessage(e.Message); CallOnWhisperMessageReceived(whisperMessage); break; } } private void CallOnChatMessageReceived(TwitchChatMessage message) { OnChatMessageReceived?.Invoke(this, new OnChatMessageReceivedArgs { Message = message }); } private void CallOnWhisperMessageReceived(TwitchWhisperMessage message) { OnWhisperMessageReceived?.Invoke(this, new OnWhisperMessageReceivedArgs { Message = message }); } public void SendChatMessage(string channel, string message) { SendIrcMessage($":{Username}!{Username}@{Username}.tmi.twitch.tv PRIVMSG {channel} :{message}"); } } }
using SimpleTwitchBot.Lib.Events; using SimpleTwitchBot.Lib.Models; using System; namespace SimpleTwitchBot.Lib { public class TwitchIrcClient : IrcClient { public event EventHandler<OnChatMessageReceivedArgs> OnChatMessageReceived; public event EventHandler<OnWhisperMessageReceivedArgs> OnWhisperMessageReceived; public TwitchIrcClient(string ip, int port) : base(ip, port) { OnPing += Client_OnPing; OnConnect += TwitchIrcClient_OnConnect; OnIrcMessageReceived += Client_OnIrcMessageReceived; } private void TwitchIrcClient_OnConnect(object sender, EventArgs e) { EnableMessageTags(); } private void EnableMessageTags() { SendIrcMessage("CAP REQ :twitch.tv/tags"); SendIrcMessage("CAP REQ :twitch.tv/commands"); } private void Client_OnPing(object sender, OnPingArgs e) { SendIrcMessage($"PONG {e.ServerAddress}"); } private void Client_OnIrcMessageReceived(object sender, OnIrcMessageReceivedArgs e) { switch(e.Message.Command) { case "PRIVMGS": var chatMessage = new TwitchChatMessage(e.Message); CallOnChatMessageReceived(chatMessage); break; case "WHISPER": var whisperMessage = new TwitchWhisperMessage(e.Message); CallOnWhisperMessageReceived(whisperMessage); break; } } private void CallOnChatMessageReceived(TwitchChatMessage message) { OnChatMessageReceived?.Invoke(this, new OnChatMessageReceivedArgs { Message = message }); } private void CallOnWhisperMessageReceived(TwitchWhisperMessage message) { OnWhisperMessageReceived?.Invoke(this, new OnWhisperMessageReceivedArgs { Message = message }); } public void SendChatMessage(string channel, string message) { SendIrcMessage($":{Username}!{Username}@{Username}.tmi.twitch.tv PRIVMSG {channel} :{message}"); } } }
mit
C#
95f70d93b5173bbf00e8ae2b95f0f9e2f4f7d58d
Fix Not implemented exception from DoNotHideBaseClassMethods.Fixer
mavasani/roslyn-analyzers,dotnet/roslyn-analyzers,mavasani/roslyn-analyzers,dotnet/roslyn-analyzers,pakdev/roslyn-analyzers,pakdev/roslyn-analyzers
src/Microsoft.CodeQuality.Analyzers/Core/ApiDesignGuidelines/DoNotHideBaseClassMethods.Fixer.cs
src/Microsoft.CodeQuality.Analyzers/Core/ApiDesignGuidelines/DoNotHideBaseClassMethods.Fixer.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Immutable; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; namespace Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines { /// <summary> /// CA1061: Do not hide base class methods /// </summary> public abstract class DoNotHideBaseClassMethodsFixer : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(DoNotHideBaseClassMethodsAnalyzer.RuleId); public sealed override FixAllProvider GetFixAllProvider() { // See https://github.com/dotnet/roslyn/blob/master/docs/analyzers/FixAllProvider.md for more information on Fix All Providers return WellKnownFixAllProviders.BatchFixer; } public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { // Fixer not yet implemented. return Task.CompletedTask; } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Immutable; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; namespace Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines { /// <summary> /// CA1061: Do not hide base class methods /// </summary> public abstract class DoNotHideBaseClassMethodsFixer : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(DoNotHideBaseClassMethodsAnalyzer.RuleId); public sealed override FixAllProvider GetFixAllProvider() { // See https://github.com/dotnet/roslyn/blob/master/docs/analyzers/FixAllProvider.md for more information on Fix All Providers return WellKnownFixAllProviders.BatchFixer; } public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) { // This is to get rid of warning CS1998, please remove when implementing this analyzer await Task.Run(() => { }).ConfigureAwait(false); throw new NotImplementedException(); } } }
mit
C#
64e4965016ebbfabf4bbe738cb0b44ea321e9f47
Rename misnamed field
jcmoyer/Yeena
Yeena/PathOfExile/PoEItemSocket.cs
Yeena/PathOfExile/PoEItemSocket.cs
// Copyright 2013 J.C. Moyer // // 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 Newtonsoft.Json; namespace Yeena.PathOfExile { [JsonObject] class PoEItemSocket { [JsonProperty("group")] private readonly int _group; [JsonProperty("attr")] private readonly string _attr; public PoESocketColor Color { get { switch (_attr) { case "S": return PoESocketColor.Red; case "D": return PoESocketColor.Green; case "I": return PoESocketColor.Blue; default: return PoESocketColor.Unknown; } } } } }
// Copyright 2013 J.C. Moyer // // 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 Newtonsoft.Json; namespace Yeena.PathOfExile { [JsonObject] class PoEItemSocket { [JsonProperty("group")] private readonly int _number; [JsonProperty("attr")] private readonly string _attr; public PoESocketColor Color { get { switch (_attr) { case "S": return PoESocketColor.Red; case "D": return PoESocketColor.Green; case "I": return PoESocketColor.Blue; default: return PoESocketColor.Unknown; } } } } }
apache-2.0
C#
ab84a734e672c2e3400b815b3284b0bef067fe30
Update comments & variable name
justinjstark/Verdeler,justinjstark/Delivered
Verdeler/MultipleConcurrencyLimiter.cs
Verdeler/MultipleConcurrencyLimiter.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Verdeler { internal class MultipleConcurrencyLimiter<TSubject> { private readonly List<ConcurrencyLimiter<TSubject>> _concurrencyLimiters = new List<ConcurrencyLimiter<TSubject>>(); public void AddConcurrencyLimiter(Func<TSubject, object> reductionMap, int number) { _concurrencyLimiters.Add(new ConcurrencyLimiter<TSubject>(reductionMap, number)); } public async Task Do(Func<Task> asyncFunc, TSubject subject) { //We must obtain locks in order to prevent cycles from forming. foreach (var concurrencyLimiter in _concurrencyLimiters) { await concurrencyLimiter.WaitFor(subject).ConfigureAwait(false); } try { await asyncFunc().ConfigureAwait(false); } finally { //Release in reverse order _concurrencyLimiters .AsEnumerable().Reverse().ToList() .ForEach(l => l.Release(subject)); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Verdeler { internal class MultipleConcurrencyLimiter<TSubject> { private readonly List<ConcurrencyLimiter<TSubject>> _concurrencyLimiters = new List<ConcurrencyLimiter<TSubject>>(); public void AddConcurrencyLimiter(Func<TSubject, object> reductionMap, int number) { _concurrencyLimiters.Add(new ConcurrencyLimiter<TSubject>(reductionMap, number)); } public async Task Do(Func<Task> asyncFunc, TSubject subject) { //NOTE: This cannot be replaced with a Linq .ForEach foreach (var cl in _concurrencyLimiters) { await cl.WaitFor(subject).ConfigureAwait(false); } try { await asyncFunc().ConfigureAwait(false); } finally { //Release in the reverse order to prevent deadlocks _concurrencyLimiters .AsEnumerable().Reverse().ToList() .ForEach(l => l.Release(subject)); } } } }
mit
C#
077d87ffbbbaa90f9f71f2d6e24ba057dc8ac3a1
Support port 0 in remoting
raskolnikoov/protoactor-dotnet,Bee-Htcpcp/protoactor-dotnet,AsynkronIT/protoactor-dotnet,tomliversidge/protoactor-dotnet,tomliversidge/protoactor-dotnet,masteryee/protoactor-dotnet,cpx86/protoactor-dotnet,Bee-Htcpcp/protoactor-dotnet,raskolnikoov/protoactor-dotnet,masteryee/protoactor-dotnet,cpx86/protoactor-dotnet
src/Proto.Remote/RemotingSystem.cs
src/Proto.Remote/RemotingSystem.cs
// ----------------------------------------------------------------------- // <copyright file="RemotingSystem.cs" company="Asynkron HB"> // Copyright (C) 2015-2017 Asynkron HB All rights reserved // </copyright> // ----------------------------------------------------------------------- using System; using System.Linq; using Grpc.Core; namespace Proto.Remote { public static class RemotingSystem { private static Server _server; public static PID EndpointManagerPid { get; private set; } public static void Start(string host, int port) { ProcessRegistry.Instance.RegisterHostResolver(pid => new RemoteProcess(pid)); _server = new Server { Services = {Remoting.BindService(new EndpointReader())}, Ports = {new ServerPort(host, port, ServerCredentials.Insecure)} }; _server.Start(); var boundPort = _server.Ports.Single().BoundPort; var addr = host + ":" + boundPort; ProcessRegistry.Instance.Address = addr; var props = Actor.FromProducer(() => new EndpointManager()); EndpointManagerPid = Actor.Spawn(props); Console.WriteLine($"[REMOTING] Starting Proto.Actor server on {addr}"); } } }
// ----------------------------------------------------------------------- // <copyright file="RemotingSystem.cs" company="Asynkron HB"> // Copyright (C) 2015-2017 Asynkron HB All rights reserved // </copyright> // ----------------------------------------------------------------------- using System; using Grpc.Core; namespace Proto.Remote { public static class RemotingSystem { private static Server _server; public static PID EndpointManagerPid { get; private set; } public static void Start(string host, int port) { var addr = host + ":" + port; ProcessRegistry.Instance.Address = addr; ProcessRegistry.Instance.RegisterHostResolver(pid => new RemoteProcess(pid)); _server = new Server { Services = {Remoting.BindService(new EndpointReader())}, Ports = {new ServerPort(host, port, ServerCredentials.Insecure)} }; _server.Start(); var emProps = Actor.FromProducer(() => new EndpointManager()); EndpointManagerPid = Actor.Spawn(emProps); Console.WriteLine($"[REMOTING] Starting Proto.Actor server on {addr}"); } } }
apache-2.0
C#
b33df41e4aec3842f92f22239209fd51c301c7da
Fix redirectionUri
davidsh/NetworkingTestServer,davidsh/NetworkingTestServer,davidsh/NetworkingTestServer
WebServer/Redirect.ashx.cs
WebServer/Redirect.ashx.cs
using System; using System.Web; namespace WebServer { /// <summary> /// Summary description for Redirect /// </summary> public class Redirect : IHttpHandler { public void ProcessRequest(HttpContext context) { string redirectUri = context.Request.QueryString["uri"]; string hopsString = context.Request.QueryString["hops"]; int hops = 1; try { if (string.IsNullOrEmpty(redirectUri)) { context.Response.StatusCode = 500; context.Response.StatusDescription = "Missing redirection uri"; return; } if (!string.IsNullOrEmpty(hopsString)) { hops = int.Parse(hopsString); } if (hops <= 1) { context.Response.Headers.Add("Location", redirectUri); } else { context.Response.Headers.Add( "Location", string.Format("/Redirect.ashx?uri={0}&hops={1}", redirectUri, hops - 1)); } context.Response.StatusCode = 302; } catch (Exception) { context.Response.StatusCode = 500; context.Response.StatusDescription = "Error parsing hops: " + hopsString; } } public bool IsReusable { get { return true; } } } }
using System; using System.Web; namespace WebServer { /// <summary> /// Summary description for Redirect /// </summary> public class Redirect : IHttpHandler { public void ProcessRequest(HttpContext context) { string redirectUri = context.Request.QueryString["uri"]; string hopsString = context.Request.QueryString["hops"]; int hops = 1; try { if (string.IsNullOrEmpty(redirectUri)) { context.Response.StatusCode = 500; context.Response.StatusDescription = "Missing redirection uri"; return; } if (!string.IsNullOrEmpty(hopsString)) { hops = int.Parse(hopsString); } if (hops <= 1) { context.Response.Headers.Add("Location", redirectUri); } else { context.Response.Headers.Add( "Location", string.Format("/Redirect.ashx?uri={1}&hops={0}", redirectUri, hops - 1)); } context.Response.StatusCode = 302; } catch (Exception) { context.Response.StatusCode = 500; context.Response.StatusDescription = "Error parsing hops: " + hopsString; } } public bool IsReusable { get { return true; } } } }
mit
C#
bbe8fec75851de2c9d086418a6f4f08540a3c1c9
Repair ScriptPath
peachpiecompiler/peachpie,peachpiecompiler/peachpie,iolevel/peachpie,iolevel/peachpie-concept,iolevel/peachpie-concept,iolevel/peachpie,iolevel/peachpie-concept,iolevel/peachpie,peachpiecompiler/peachpie
src/Tests/Peachpie.Test/Program.cs
src/Tests/Peachpie.Test/Program.cs
using System; using System.IO; using Pchp.Core; namespace Peachpie.Test { class Program { const string ScriptPath = "index.php"; static void Main(string[] args) { // bootstrapper that compiles, loads and runs our script file var fullpath = Path.Combine(Directory.GetCurrentDirectory(), ScriptPath); using (var ctx = Context.CreateConsole(string.Empty, args)) { // var script = Context.DefaultScriptingProvider.CreateScript(new Context.ScriptOptions() { Context = ctx, Location = new Location(fullpath, 0, 0), EmitDebugInformation = true, IsSubmission = false, AdditionalReferences = new string[] { typeof(Library.Graphics.PhpImage).Assembly.Location, typeof(Library.MySql.MySql).Assembly.Location, typeof(Library.Network.CURLFunctions).Assembly.Location, }, }, File.ReadAllText(fullpath)); // script.Evaluate(ctx, ctx.Globals, null); } } } }
using System; using System.IO; using Pchp.Core; namespace Peachpie.Test { class Program { const string ScriptPath = "password_hash_004.php"; static void Main(string[] args) { // bootstrapper that compiles, loads and runs our script file var fullpath = Path.Combine(Directory.GetCurrentDirectory(), ScriptPath); using (var ctx = Context.CreateConsole(string.Empty, args)) { // var script = Context.DefaultScriptingProvider.CreateScript(new Context.ScriptOptions() { Context = ctx, Location = new Location(fullpath, 0, 0), EmitDebugInformation = true, IsSubmission = false, AdditionalReferences = new string[] { typeof(Library.Graphics.PhpImage).Assembly.Location, typeof(Library.MySql.MySql).Assembly.Location, typeof(Library.Network.CURLFunctions).Assembly.Location, }, }, File.ReadAllText(fullpath)); // script.Evaluate(ctx, ctx.Globals, null); } } } }
apache-2.0
C#
9b5bafb4b569cd9246da948605760a010672ab81
Update TestServer.cs
robotdotnet/NetworkTablesCore
NetworkTablesCore.Test/TestServer.cs
NetworkTablesCore.Test/TestServer.cs
using System; using System.Threading; using NetworkTables; using NetworkTables.Native; using NUnit.Framework; namespace NetworkTablesCore.Test { [TestFixture] public class TestServer { [Test] public void Test() { Console.WriteLine("BeforeShuttingDown"); NetworkTable.Shutdown(); Console.WriteLine("Shutting Down"); CoreMethods.SetLogger(((level, file, line, message) => { //Console.Error.WriteLine(message); }), 0); NetworkTable.SetIPAddress("127.0.0.1"); Console.WriteLine("IP"); NetworkTable.SetPort(10000); Console.WriteLine("Port"); NetworkTable.SetServerMode(); Console.WriteLine("Server"); NetworkTable nt = NetworkTable.GetTable(""); Console.WriteLine("GetTable"); Thread.Sleep(1000); Console.WriteLine("FirstSleep"); nt.PutNumber("foo", 0.5); Console.WriteLine("foo .5"); nt.SetFlags("foo", EntryFlags.Persistent); Console.WriteLine("Persistent"); nt.PutNumber("foo2", 0.5); Console.WriteLine("Foo 2 .5"); nt.PutNumber("foo2", 0.7); Console.WriteLine("Foo 2 .7"); nt.PutNumber("foo2", 0.6); Console.WriteLine("Foo 2 .6"); nt.PutNumber("foo2", 0.5); Console.WriteLine("Foo 2 .5 2"); Thread.Sleep(1000); Console.WriteLine("2ndSleep"); } } }
using System; using System.Threading; using NetworkTables; using NetworkTables.Native; using NUnit.Framework; namespace NetworkTablesCore.Test { [TestFixture] public class TestServer { [Test] public void Test() { NetworkTable.Shutdown(); Console.WriteLine("Shutting Down"); CoreMethods.SetLogger(((level, file, line, message) => { //Console.Error.WriteLine(message); }), 0); NetworkTable.SetIPAddress("127.0.0.1"); Console.WriteLine("IP"); NetworkTable.SetPort(10000); Console.WriteLine("Port"); NetworkTable.SetServerMode(); Console.WriteLine("Server"); NetworkTable nt = NetworkTable.GetTable(""); Console.WriteLine("GetTable"); Thread.Sleep(1000); Console.WriteLine("FirstSleep"); nt.PutNumber("foo", 0.5); Console.WriteLine("foo .5"); nt.SetFlags("foo", EntryFlags.Persistent); Console.WriteLine("Persistent"); nt.PutNumber("foo2", 0.5); Console.WriteLine("Foo 2 .5"); nt.PutNumber("foo2", 0.7); Console.WriteLine("Foo 2 .7"); nt.PutNumber("foo2", 0.6); Console.WriteLine("Foo 2 .6"); nt.PutNumber("foo2", 0.5); Console.WriteLine("Foo 2 .5 2"); Thread.Sleep(1000); Console.WriteLine("2ndSleep"); } } }
bsd-3-clause
C#
3ff1f7fa2ef5428e59677201c46c1028f0426320
Fix report reference
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Jobs/SensitiveItemsReport.cs
Battery-Commander.Web/Jobs/SensitiveItemsReport.cs
using BatteryCommander.Web.Models; using BatteryCommander.Web.Services; using FluentEmail.Core; using FluentEmail.Core.Models; using FluentScheduler; using Serilog; using System.Collections.Generic; using System.IO; namespace BatteryCommander.Web.Jobs { public class SensitiveItemsReport : IJob { private static readonly ILogger Log = Serilog.Log.ForContext<SensitiveItemsReport>(); private static IList<Address> Recipients => new List<Address>(new Address[] { FROM, //new Address { Name = "C-2-116 FA", EmailAddress = "ng.fl.flarng.list.2-116-fa-bn-c-btry@mail.mil" }, //new Address { Name = "2-116 FA BN TOC", EmailAddress = "ng.fl.flarng.list.ngfl-2-116-fa-bn-toc@mail.mil" } }); internal static Address FROM => new Address { Name = "C-2-116 FA", EmailAddress = "BatteryCommander@redleg.app" }; private readonly Database db; private readonly IFluentEmail emailSvc; public SensitiveItemsReport(Database db, IFluentEmail emailSvc) { this.db = db; this.emailSvc = emailSvc; } public virtual void Execute() { foreach (var unit in UnitService.List(db).GetAwaiter().GetResult()) { // HACK - Configure the recipients and units that this is going to be wired up for Log.Information("Building Green 3 report for {@unit} to {@recipients}", new { unit.Id, unit.Name }, Recipients); emailSvc .To(Recipients) .SetFrom(FROM.EmailAddress, FROM.Name) .Subject($"{unit.Name} | GREEN 3 Report | { unit.SensitiveItems.Status}") .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Views/Reports/Green3_SensitiveItems.cshtml", unit) .Send(); } } } }
using BatteryCommander.Web.Models; using BatteryCommander.Web.Services; using FluentEmail.Core; using FluentEmail.Core.Models; using FluentScheduler; using Serilog; using System.Collections.Generic; using System.IO; namespace BatteryCommander.Web.Jobs { public class SensitiveItemsReport : IJob { private static readonly ILogger Log = Serilog.Log.ForContext<SensitiveItemsReport>(); private static IList<Address> Recipients => new List<Address>(new Address[] { FROM, //new Address { Name = "C-2-116 FA", EmailAddress = "ng.fl.flarng.list.2-116-fa-bn-c-btry@mail.mil" }, //new Address { Name = "2-116 FA BN TOC", EmailAddress = "ng.fl.flarng.list.ngfl-2-116-fa-bn-toc@mail.mil" } }); internal static Address FROM => new Address { Name = "C-2-116 FA", EmailAddress = "BatteryCommander@redleg.app" }; private readonly Database db; private readonly IFluentEmail emailSvc; public SensitiveItemsReport(Database db, IFluentEmail emailSvc) { this.db = db; this.emailSvc = emailSvc; } public virtual void Execute() { foreach (var unit in UnitService.List(db).GetAwaiter().GetResult()) { // HACK - Configure the recipients and units that this is going to be wired up for Log.Information("Building Green 3 report for {@unit} to {@recipients}", new { unit.Id, unit.Name }, Recipients); emailSvc .To(Recipients) .SetFrom(FROM.EmailAddress, FROM.Name) .Subject($"{unit.Name} | GREEN 3 1 Sensitive Items | { unit.SensitiveItems.Status}") .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Views/Reports/Red1_Perstat.cshtml", unit) .Send(); } } } }
mit
C#
7e28871e959a61ec134bb8d57e9612384b3455e0
Create method PrintLogo()
stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity
C#Development/BashSoft/BashSoft/IO/OutputWriter.cs
C#Development/BashSoft/BashSoft/IO/OutputWriter.cs
namespace BashSoft.IO { using System; using System.Collections.Generic; /// <summary> /// Flexible interface for output to the user. /// </summary> public static class OutputWriter { /// <summary> /// Print logo in console. /// </summary> public static void PrintLogo() { var newLine = Environment.NewLine; var logo = new[] { @" ____ _ _____ __ _ ", @"| _ \ | | / ____| / _| |", @"| |_) | ____ ___| |__ | (___ ___ | |_| |_", @"| _ < / _` / __| '_ \ \___ \ / _ \| _| __|", @"| |_) | (_| \__ \ | | |____) | (_) | | | |", @"|____/ \__,_|___/_| |_|_____/ \___/|_| \__|" }; Console.WindowWidth = 100; foreach (var line in logo) { Console.WriteLine(line); } Console.WriteLine(newLine, newLine); } /// <summary> /// Print message on line. /// </summary> /// <param name="message">Message to be printed.</param> public static void WriteMessage(string message) => Console.Write(message); /// <summary> /// Print message on new line. /// </summary> /// <param name="message">Message to be printed.</param> public static void WriteMessageOnNewLine(string message) => Console.WriteLine(message); /// <summary> /// Print an empty line. /// </summary> public static void WriteEmptyLine() => Console.WriteLine(); /// <summary> /// Color the text in a dark red color. /// </summary> /// <param name="message">Message to be colored.</param> public static void DisplayException(string message) { var currentColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine(message); Console.ForegroundColor = currentColor; } /// <summary> /// Displaying a student entry. /// </summary> /// <param name="student">Student to be printed.</param> public static void PrintStudent(KeyValuePair<string, List<int>> student) { OutputWriter.WriteMessageOnNewLine($"{student.Key} - {string.Join(", ", student.Value)}"); } } }
namespace BashSoft.IO { using System; using System.Collections.Generic; /// <summary> /// Flexible interface for output to the user. /// </summary> public static class OutputWriter { /// <summary> /// Print message on line. /// </summary> /// <param name="message">Message to be printed.</param> public static void WriteMessage(string message) => Console.Write(message); /// <summary> /// Print message on new line. /// </summary> /// <param name="message">Message to be printed.</param> public static void WriteMessageOnNewLine(string message) => Console.WriteLine(message); /// <summary> /// Print an empty line. /// </summary> public static void WriteEmptyLine() => Console.WriteLine(); /// <summary> /// Color the text in a dark red color. /// </summary> /// <param name="message">Message to be colored.</param> public static void DisplayException(string message) { var currentColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine(message); Console.ForegroundColor = currentColor; } /// <summary> /// Displaying a student entry. /// </summary> /// <param name="student">Student to be printed.</param> public static void PrintStudent(KeyValuePair<string, List<int>> student) { OutputWriter.WriteMessageOnNewLine($"{student.Key} - {string.Join(", ", student.Value)}"); } } }
mit
C#
d89ad7f1acaaf2a12243ffefd8b523ea4c4163f3
Update the Load & Save Methods with new.
HaruTzuki/Greek-Nakama-Upload-System,HaruTzuki/Greek-Nakama-Upload-System
GreekNakamaTorrentUpload/WinClass/Helper/Helper.cs
GreekNakamaTorrentUpload/WinClass/Helper/Helper.cs
using Newtonsoft.Json; using System; using System.IO; using System.Windows.Forms; namespace GreekNakamaTorrentUpload.WinClass.Helper { static class Helper { static public Exception LoadedError = new Exception("Error while load the file. Error code: 0x01."); static public void BrowseFiles(TextBox txt_torrent, Label lbl_file) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "Torrent files|*.torrent"; ofd.Multiselect = false; ofd.Title = "Browse the torrent file..."; DialogResult DL = ofd.ShowDialog(); if (DL == DialogResult.OK) { txt_torrent.Text = ofd.FileName; lbl_file.Text = ofd.SafeFileName; } } } static public void SaveToJson(string content) { string contentForSave = JsonConvert.SerializeObject(content, Formatting.Indented); File.WriteAllText("settings.json", contentForSave); } static public void SaveToJson(Credentials credentials) { string contentForSave = JsonConvert.SerializeObject(credentials, Formatting.Indented); File.WriteAllText("settings.json", contentForSave); } static public Credentials LoadFromJson() { Credentials loadedContents; loadedContents = JsonConvert.DeserializeObject<Credentials>(System.IO.File.ReadAllText("settings.json")); return loadedContents; } } }
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace GreekNakamaTorrentUpload.WinClass.Helper { static class Helper { static public void BrowseFiles(TextBox txt_torrent, Label lbl_file) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "Torrent files|*.torrent"; ofd.Multiselect = false; ofd.Title = "Browse the torrent file..."; DialogResult DL = ofd.ShowDialog(); if (DL == DialogResult.OK) { txt_torrent.Text = ofd.FileName; lbl_file.Text = "File Name : " + ofd.SafeFileName; } } } static public void SaveToJson(string content) { string contentForSave = JsonConvert.SerializeObject(content, Formatting.Indented); File.WriteAllText("settings.json", contentForSave); } static public void SaveToJson(string[] contents) { string contentForSave = JsonConvert.SerializeObject(contents.ToArray(), Formatting.Indented); File.WriteAllText("settings.json", contentForSave); } static public string LoadFromJson() { string loadedContents; try { loadedContents = JsonConvert.DeserializeObject<string>(System.IO.File.ReadAllText("settings.json")); } catch (Exception) { return "0x01"; } return loadedContents; } } }
mit
C#