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 |
---|---|---|---|---|---|---|---|---|
1ce48322bf272c187825219d0aea9b91965feae3
|
Store payments
|
open-pay/openpay-dotnet,EzyWebwerkstaden/openpay-dotnet
|
Openpay/Entities/PaymentMethod.cs
|
Openpay/Entities/PaymentMethod.cs
|
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Openpay.Entities
{
public class PaymentMethod
{
[JsonProperty(PropertyName = "type")]
public String Type { get; set; }
[JsonProperty(PropertyName = "bank")]
public String BankName { get; set; }
[JsonProperty(PropertyName = "clabe")]
public String CLABE { get; set; }
[JsonProperty(PropertyName = "name")]
public String Name { get; set; }
[JsonProperty(PropertyName = "reference")]
public String Reference { get; set; }
[JsonProperty(PropertyName = "barcode_url")]
public String BarcodeURL { get; set; }
}
}
|
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Openpay.Entities
{
public class PaymentMethod
{
[JsonProperty(PropertyName = "type")]
public String Type { get; set; }
[JsonProperty(PropertyName = "bank")]
public String BankName { get; set; }
[JsonProperty(PropertyName = "clabe")]
public String CLABE { get; set; }
[JsonProperty(PropertyName = "name")]
public String Name { get; set; }
}
}
|
apache-2.0
|
C#
|
359e12d65ac3d3f060a7ccb9955407056a3e4343
|
Remove Snapshot stats fields (#3886)
|
elastic/elasticsearch-net,elastic/elasticsearch-net
|
src/Nest/Modules/SnapshotAndRestore/Snapshot/SnapshotStatus/SnapshotStatusResponse.cs
|
src/Nest/Modules/SnapshotAndRestore/Snapshot/SnapshotStatus/SnapshotStatusResponse.cs
|
using System.Collections.Generic;
using System.Runtime.Serialization;
using Elasticsearch.Net;
namespace Nest
{
[DataContract]
public class SnapshotStatusResponse : ResponseBase
{
[DataMember(Name ="snapshots")]
public IReadOnlyCollection<SnapshotStatus> Snapshots { get; internal set; } = EmptyReadOnly<SnapshotStatus>.Collection;
}
public class SnapshotStatus
{
[DataMember(Name ="include_global_state")]
public bool? IncludeGlobalState { get; internal set; }
[DataMember(Name ="indices")]
public IReadOnlyDictionary<string, SnapshotIndexStats> Indices { get; internal set; } = EmptyReadOnly<string, SnapshotIndexStats>.Dictionary;
[DataMember(Name ="repository")]
public string Repository { get; internal set; }
[DataMember(Name ="shards_stats")]
public SnapshotShardsStats ShardsStats { get; internal set; }
[DataMember(Name ="snapshot")]
public string Snapshot { get; internal set; }
[DataMember(Name ="state")]
public string State { get; internal set; }
[DataMember(Name ="stats")]
public SnapshotStats Stats { get; internal set; }
[DataMember(Name ="uuid")]
public string UUID { get; internal set; }
}
public class SnapshotIndexStats
{
[DataMember(Name ="shards")]
public IReadOnlyDictionary<string, SnapshotShardsStats> Shards { get; internal set; } = EmptyReadOnly<string, SnapshotShardsStats>.Dictionary;
[DataMember(Name ="shards_stats")]
public SnapshotShardsStats ShardsStats { get; internal set; }
[DataMember(Name ="stats")]
public SnapshotStats Stats { get; internal set; }
}
public class SnapshotIndexShardStats
{
[DataMember(Name ="node")]
public string Node { get; internal set; }
[DataMember(Name ="stage")]
public string Stage { get; internal set; }
[DataMember(Name ="stats")]
public SnapshotStats Stats { get; internal set; }
}
public class SnapshotShardsStats
{
[DataMember(Name ="done")]
public long Done { get; internal set; }
[DataMember(Name ="failed")]
public long Failed { get; internal set; }
[DataMember(Name ="finalizing")]
public long Finalizing { get; internal set; }
[DataMember(Name ="initializing")]
public long Initializing { get; internal set; }
[DataMember(Name ="started")]
public long Started { get; internal set; }
[DataMember(Name ="total")]
public long Total { get; internal set; }
}
public class SnapshotStats
{
[DataMember(Name ="start_time_in_millis")]
public long StartTimeInMilliseconds { get; internal set; }
[DataMember(Name ="time_in_millis")]
public long TimeInMilliseconds { get; internal set; }
}
}
|
using System.Collections.Generic;
using System.Runtime.Serialization;
using Elasticsearch.Net;
namespace Nest
{
[DataContract]
public class SnapshotStatusResponse : ResponseBase
{
[DataMember(Name ="snapshots")]
public IReadOnlyCollection<SnapshotStatus> Snapshots { get; internal set; } = EmptyReadOnly<SnapshotStatus>.Collection;
}
public class SnapshotStatus
{
[DataMember(Name ="include_global_state")]
public bool? IncludeGlobalState { get; internal set; }
[DataMember(Name ="indices")]
public IReadOnlyDictionary<string, SnapshotIndexStats> Indices { get; internal set; } = EmptyReadOnly<string, SnapshotIndexStats>.Dictionary;
[DataMember(Name ="repository")]
public string Repository { get; internal set; }
[DataMember(Name ="shards_stats")]
public SnapshotShardsStats ShardsStats { get; internal set; }
[DataMember(Name ="snapshot")]
public string Snapshot { get; internal set; }
[DataMember(Name ="state")]
public string State { get; internal set; }
[DataMember(Name ="stats")]
public SnapshotStats Stats { get; internal set; }
[DataMember(Name ="uuid")]
public string UUID { get; internal set; }
}
public class SnapshotIndexStats
{
[DataMember(Name ="shards")]
public IReadOnlyDictionary<string, SnapshotShardsStats> Shards { get; internal set; } = EmptyReadOnly<string, SnapshotShardsStats>.Dictionary;
[DataMember(Name ="shards_stats")]
public SnapshotShardsStats ShardsStats { get; internal set; }
[DataMember(Name ="stats")]
public SnapshotStats Stats { get; internal set; }
}
public class SnapshotIndexShardStats
{
[DataMember(Name ="node")]
public string Node { get; internal set; }
[DataMember(Name ="stage")]
public string Stage { get; internal set; }
[DataMember(Name ="stats")]
public SnapshotStats Stats { get; internal set; }
}
public class SnapshotShardsStats
{
[DataMember(Name ="done")]
public long Done { get; internal set; }
[DataMember(Name ="failed")]
public long Failed { get; internal set; }
[DataMember(Name ="finalizing")]
public long Finalizing { get; internal set; }
[DataMember(Name ="initializing")]
public long Initializing { get; internal set; }
[DataMember(Name ="started")]
public long Started { get; internal set; }
[DataMember(Name ="total")]
public long Total { get; internal set; }
}
public class SnapshotStats
{
[DataMember(Name ="number_of_files")]
public long NumberOfFiles { get; internal set; }
[DataMember(Name ="processed_files")]
public long ProcessedFiles { get; internal set; }
[DataMember(Name ="processed_size_in_bytes")]
public long ProcessedSizeInBytes { get; internal set; }
[DataMember(Name ="start_time_in_millis")]
public long StartTimeInMilliseconds { get; internal set; }
[DataMember(Name ="time_in_millis")]
public long TimeInMilliseconds { get; internal set; }
[DataMember(Name ="total_size_in_bytes")]
public long TotalSizeInBytes { get; internal set; }
}
}
|
apache-2.0
|
C#
|
46ab0741ad07901ac79da10f8e535a5aa61519e7
|
Add Close() method.
|
Schoonology/cs-resp
|
Resp/RespClient.cs
|
Resp/RespClient.cs
|
using System;
using System.Net;
using System.Net.Sockets;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Resp
{
public class RespClient
{
private TcpClient client;
private Stream stream;
private RespReader reader;
private RespSerializer serializer;
public RespClient()
{
this.serializer = new RespSerializer();
}
public void Connect(string host, int port)
{
TcpClient client = new TcpClient(host, port);
this.stream = client.GetStream();
this.reader = new RespReader(this.stream);
}
public async Task ConnectAsync(string host, int port)
{
TcpClient client = new TcpClient();
await client.ConnectAsync(host, port);
this.stream = client.GetStream();
this.reader = new RespReader(this.stream);
}
public void Close()
{
this.stream.Close();
this.client.Close();
}
public void Write(object value)
{
byte[] message = Encoding.UTF8.GetBytes(this.serializer.Serialize(value));
this.stream.Write(message, 0, message.Length);
}
public async Task WriteAsync(object value)
{
byte[] message = Encoding.UTF8.GetBytes(this.serializer.Serialize(value));
await this.stream.WriteAsync(message, 0, message.Length);
}
public object Read()
{
return this.reader.Read();
}
public async Task<object> ReadAsync()
{
return await this.reader.ReadAsync();
}
public object Request(object value)
{
this.Write(value);
return this.Read();
}
public async Task<object> RequestAsync(object value)
{
await this.WriteAsync(value);
return await this.ReadAsync();
}
}
}
|
using System;
using System.Net;
using System.Net.Sockets;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Resp
{
public class RespClient
{
private Stream _stream;
public Stream stream
{
get { return this._stream; }
set
{
this._stream = value;
this.reader = new RespReader(this._stream);
}
}
private RespReader reader;
private RespSerializer serializer;
public RespClient()
{
this.serializer = new RespSerializer();
}
public void Connect(string host, int port)
{
TcpClient client = new TcpClient(host, port);
this.stream = client.GetStream();
}
public async Task ConnectAsync(string host, int port)
{
TcpClient client = new TcpClient();
await client.ConnectAsync(host, port);
this.stream = client.GetStream();
}
public void Write(object value)
{
byte[] message = Encoding.UTF8.GetBytes(this.serializer.Serialize(value));
this.stream.Write(message, 0, message.Length);
}
public async Task WriteAsync(object value)
{
byte[] message = Encoding.UTF8.GetBytes(this.serializer.Serialize(value));
await this.stream.WriteAsync(message, 0, message.Length);
}
public object Read()
{
return this.reader.Read();
}
public async Task<object> ReadAsync()
{
return await this.reader.ReadAsync();
}
public object Request(object value)
{
this.Write(value);
return this.Read();
}
public async Task<object> RequestAsync(object value)
{
await this.WriteAsync(value);
return await this.ReadAsync();
}
}
}
|
mit
|
C#
|
896814a4276302c5ed7cd43daf7faf24e64d435d
|
Add GPG Keys API preview header
|
shiftkey-tester-org-blah-blah/octokit.net,shiftkey/octokit.net,shana/octokit.net,dampir/octokit.net,octokit/octokit.net,rlugojr/octokit.net,shiftkey-tester/octokit.net,TattsGroup/octokit.net,alfhenrik/octokit.net,ivandrofly/octokit.net,ivandrofly/octokit.net,thedillonb/octokit.net,Sarmad93/octokit.net,devkhan/octokit.net,shana/octokit.net,octokit/octokit.net,shiftkey/octokit.net,SmithAndr/octokit.net,Sarmad93/octokit.net,SmithAndr/octokit.net,eriawan/octokit.net,thedillonb/octokit.net,khellang/octokit.net,TattsGroup/octokit.net,dampir/octokit.net,devkhan/octokit.net,editor-tools/octokit.net,alfhenrik/octokit.net,M-Zuber/octokit.net,shiftkey-tester/octokit.net,eriawan/octokit.net,M-Zuber/octokit.net,adamralph/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,rlugojr/octokit.net,gdziadkiewicz/octokit.net,khellang/octokit.net,editor-tools/octokit.net,gdziadkiewicz/octokit.net
|
Octokit/Helpers/AcceptHeaders.cs
|
Octokit/Helpers/AcceptHeaders.cs
|
using System.Diagnostics.CodeAnalysis;
namespace Octokit
{
public static class AcceptHeaders
{
public const string StableVersion = "application/vnd.github.v3";
public const string StableVersionHtml = "application/vnd.github.html";
public const string RedirectsPreviewThenStableVersionJson = "application/vnd.github.quicksilver-preview+json; charset=utf-8, application/vnd.github.v3+json; charset=utf-8";
public const string LicensesApiPreview = "application/vnd.github.drax-preview+json";
public const string ProtectedBranchesApiPreview = "application/vnd.github.loki-preview+json";
public const string StarCreationTimestamps = "application/vnd.github.v3.star+json";
public const string IssueLockingUnlockingApiPreview = "application/vnd.github.the-key-preview+json";
public const string CommitReferenceSha1Preview = "application/vnd.github.chitauri-preview+sha";
public const string SquashCommitPreview = "application/vnd.github.polaris-preview+json";
public const string MigrationsApiPreview = " application/vnd.github.wyandotte-preview+json";
public const string OrganizationPermissionsPreview = "application/vnd.github.ironman-preview+json";
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpg")]
public const string GpgKeysPreview = "application/vnd.github.cryptographer-preview+sha";
}
}
|
namespace Octokit
{
public static class AcceptHeaders
{
public const string StableVersion = "application/vnd.github.v3";
public const string StableVersionHtml = "application/vnd.github.html";
public const string RedirectsPreviewThenStableVersionJson = "application/vnd.github.quicksilver-preview+json; charset=utf-8, application/vnd.github.v3+json; charset=utf-8";
public const string LicensesApiPreview = "application/vnd.github.drax-preview+json";
public const string ProtectedBranchesApiPreview = "application/vnd.github.loki-preview+json";
public const string StarCreationTimestamps = "application/vnd.github.v3.star+json";
public const string IssueLockingUnlockingApiPreview = "application/vnd.github.the-key-preview+json";
public const string CommitReferenceSha1Preview = "application/vnd.github.chitauri-preview+sha";
public const string SquashCommitPreview = "application/vnd.github.polaris-preview+json";
public const string MigrationsApiPreview = " application/vnd.github.wyandotte-preview+json";
public const string OrganizationPermissionsPreview = "application/vnd.github.ironman-preview+json";
}
}
|
mit
|
C#
|
fc099da0e7abbdc501171c65057a73043b0f6b0d
|
Add one more unit test to ImportControllerTests
|
mgmccarthy/allReady,bcbeatty/allReady,anobleperson/allReady,VishalMadhvani/allReady,chinwobble/allReady,bcbeatty/allReady,mipre100/allReady,mipre100/allReady,dpaquette/allReady,binaryjanitor/allReady,pranap/allReady,bcbeatty/allReady,arst/allReady,c0g1t8/allReady,dpaquette/allReady,bcbeatty/allReady,HTBox/allReady,BillWagner/allReady,enderdickerson/allReady,GProulx/allReady,MisterJames/allReady,dpaquette/allReady,colhountech/allReady,binaryjanitor/allReady,anobleperson/allReady,gitChuckD/allReady,JowenMei/allReady,mipre100/allReady,mgmccarthy/allReady,gitChuckD/allReady,arst/allReady,chinwobble/allReady,JowenMei/allReady,GProulx/allReady,BillWagner/allReady,enderdickerson/allReady,mgmccarthy/allReady,binaryjanitor/allReady,jonatwabash/allReady,forestcheng/allReady,pranap/allReady,HamidMosalla/allReady,anobleperson/allReady,arst/allReady,BillWagner/allReady,HTBox/allReady,jonatwabash/allReady,stevejgordon/allReady,forestcheng/allReady,c0g1t8/allReady,HamidMosalla/allReady,shanecharles/allReady,shanecharles/allReady,HTBox/allReady,JowenMei/allReady,pranap/allReady,dpaquette/allReady,pranap/allReady,GProulx/allReady,stevejgordon/allReady,forestcheng/allReady,shanecharles/allReady,colhountech/allReady,HamidMosalla/allReady,MisterJames/allReady,gitChuckD/allReady,arst/allReady,anobleperson/allReady,gitChuckD/allReady,enderdickerson/allReady,mgmccarthy/allReady,BillWagner/allReady,HamidMosalla/allReady,binaryjanitor/allReady,forestcheng/allReady,jonatwabash/allReady,HTBox/allReady,colhountech/allReady,stevejgordon/allReady,colhountech/allReady,JowenMei/allReady,VishalMadhvani/allReady,stevejgordon/allReady,jonatwabash/allReady,chinwobble/allReady,mipre100/allReady,MisterJames/allReady,enderdickerson/allReady,GProulx/allReady,VishalMadhvani/allReady,MisterJames/allReady,shanecharles/allReady,chinwobble/allReady,c0g1t8/allReady,c0g1t8/allReady,VishalMadhvani/allReady
|
AllReadyApp/Web-App/AllReady.UnitTest/Areas/Admin/Controllers/ImportControllerTests.cs
|
AllReadyApp/Web-App/AllReady.UnitTest/Areas/Admin/Controllers/ImportControllerTests.cs
|
using System;
using AllReady.Areas.Admin.Controllers;
using AllReady.Areas.Admin.Features.Requests;
using AllReady.UnitTest.Extensions;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Moq;
using Xunit;
namespace AllReady.UnitTest.Areas.Admin.Controllers
{
public class ImportControllerTests
{
[Fact]
public void IndexGetReturnsCorrectView()
{
var sut = new ImportController(null, null);
var result = sut.Index() as ViewResult;
Assert.Null(result.ViewName);
}
[Fact]
public void IndexPostInvokesLogInformation_WhenFileIsNull()
{
const string userName = "UserName";
var logger = new Mock<ILogger<ImportController>>();
var sut = new ImportController(null, logger.Object);
sut.SetFakeUserName(userName);
sut.Index(null);
var message = $"User {userName} attempted a file upload without specifying a file.";
logger.Verify(
x =>
x.Log(LogLevel.Information, It.IsAny<EventId>(),
It.Is<Microsoft.Extensions.Logging.Internal.FormattedLogValues>(
y => (string) y[0].Value == message),
It.IsAny<Exception>(), It.IsAny<Func<object, Exception, string>>()), Times.Once);
}
[Fact]
public void IndexPostRedirectsToCorrectAction_WhenFileIsNull()
{
var sut = new ImportController(null, Mock.Of<ILogger<ImportController>>());
sut.SetFakeUser("1");
var result = sut.Index(null) as RedirectToActionResult;
Assert.Equal(result.ActionName, nameof(ImportController.Index));
}
[Fact]
public void IndexPostDoesNotSendImportRequestsCommand_WhenFileIsNull()
{
var mediator = new Mock<IMediator>();
var sut = new ImportController(mediator.Object, Mock.Of<ILogger<ImportController>>());
sut.SetFakeUser("1");
sut.Index(null);
mediator.Verify(x => x.Send(It.IsAny<ImportRequestsCommand>()), Times.Never);
}
}
}
|
using System;
using AllReady.Areas.Admin.Controllers;
using AllReady.UnitTest.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Moq;
using Xunit;
namespace AllReady.UnitTest.Areas.Admin.Controllers
{
public class ImportControllerTests
{
[Fact]
public void IndexGetReturnsCorrectView()
{
var sut = new ImportController(null, null);
var result = sut.Index() as ViewResult;
Assert.Null(result.ViewName);
}
[Fact]
public void IndexPostInvokesLogInformation_WhenFileIsNull()
{
const string userName = "UserName";
var logger = new Mock<ILogger<ImportController>>();
var sut = new ImportController(null, logger.Object);
sut.SetFakeUserName(userName);
sut.Index(null);
var message = $"User {userName} attempted a file upload without specifying a file.";
logger.Verify(x => x.Log(LogLevel.Information, It.IsAny<EventId>(), It.Is<Microsoft.Extensions.Logging.Internal.FormattedLogValues>(y => (string) y[0].Value == message),
It.IsAny<Exception>(), It.IsAny<Func<object, Exception, string>>()), Times.Once);
}
[Fact]
public void IndexPostRedirectsToCorrectAction_WhenFileIsNull()
{
var sut = new ImportController(null, Mock.Of<ILogger<ImportController>>());
sut.SetFakeUser("1");
var result = sut.Index(null) as RedirectToActionResult;
Assert.Equal(result.ActionName, nameof(ImportController.Index));
}
}
}
|
mit
|
C#
|
5c9810970e320cdd02dfb43b63ff3497ba26907b
|
Update AssemblyInfo.cs
|
aravol/Jacinth
|
Jacinth/Properties/AssemblyInfo.cs
|
Jacinth/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("Jacinth")]
[assembly: AssemblyDescription("Jacinth Entity System")]
[assembly: AssemblyCompany("Aravol")]
[assembly: AssemblyProduct("Jacinth")]
[assembly: AssemblyCopyright("Eclipse Public License - v 1.0")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: Guid("3d574737-a912-44d8-8e9b-da9b2a61f981")]
[assembly: ComVisible(false)]
|
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("Jacinth")]
[assembly: AssemblyDescription("Jacinth Entity System")]
[assembly: AssemblyCompany("Aravol")]
[assembly: AssemblyProduct("Jacinth")]
[assembly: AssemblyCopyright("Eclipse Public License - v 1.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: Guid("3d574737-a912-44d8-8e9b-da9b2a61f981")]
[assembly: ComVisible(false)]
|
epl-1.0
|
C#
|
4f4488de5222a3478b6f233f981ee38091f0bc1d
|
clean up example program
|
BaconSoap/autofac-programming-language
|
TestConsoleApp/IsAndrewProgram.cs
|
TestConsoleApp/IsAndrewProgram.cs
|
using AutofacProgrammingLanguage.Commands;
using AutofacProgrammingLanguage.Conditions;
using AutofacProgrammingLanguage.ValueProviders;
namespace TestConsoleApp
{
public class IsAndrewProgram
{
public IsAndrewProgram(
PrintValue<NameQuestionProvider> a,
PrintValue<NewlineValueProvider> b,
ReadLine c,
PushValue<AndrewProvider> d,
If<StackEquals, PrintValue<SuccessValue>, PrintValue<FailureValue>> e)
{
}
public class NameQuestionProvider : IValueProvider
{
public string Provide()
{
return "What's your name?";
}
}
public class AndrewProvider : IValueProvider
{
public string Provide()
{
return "Andrew";
}
}
public class FailureValue : IValueProvider
{
public string Provide()
{
return "You are not Andrew :( !";
}
}
public class SuccessValue : IValueProvider
{
public string Provide()
{
return "You are Andrew!";
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutofacProgrammingLanguage.Commands;
using AutofacProgrammingLanguage.Conditions;
using AutofacProgrammingLanguage.ValueProviders;
namespace TestConsoleApp
{
public class IsAndrewProgram
{
public IsAndrewProgram(
PrintValue<NameQuestionProvider> a,
PrintValue<NewlineValueProvider> b,
ReadLine c,
PushValue<AndrewProvider> d,
If<StackEquals, PrintValue<SuccessValue>, PrintValue<FailureValue>> e)
{
}
public class NameQuestionProvider : IValueProvider
{
public string Provide()
{
return "What's your name?";
}
}
public class WorldValueProvider : IValueProvider
{
public string Provide()
{
return " World!";
}
}
}
public class AndrewProvider: IValueProvider
{
public string Provide()
{
return "Andrew";
}
}
public class FailureValue : IValueProvider
{
public string Provide()
{
return "You are not Andrew :( !";
}
}
public class SuccessValue : IValueProvider
{
public string Provide()
{
return "You are Andrew!";
}
}
}
|
mit
|
C#
|
2b2d6c5aeaf33d79f299d4526efdedf02bbfbb3d
|
Update MaximalSequence.cs
|
PetarTilevRusev/Arrays-Homework
|
MaximalSequence/MaximalSequence.cs
|
MaximalSequence/MaximalSequence.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
/*Problem 4. Maximal sequence
Write a program that finds the maximal sequence of equal elements in an array.
Example:
input result
2, 1, 1, 2, 3, 3, 2, 2, 2, 1 2, 2, 2
*/
class MaximalSequence
{
static void Main()
{
int arrayLength = int.Parse(Console.ReadLine());
int[] array = new int[arrayLength];
Random randomGenerator = new Random(); //Generating random numbers, for filling our array elements
for (int i = 0; i < arrayLength; i++) //For loop to fill every array element with random generated value
{
array[i] = randomGenerator.Next(1, 5);
}
int bestLength = 0, bestElement = 0;
int currLength = 1, currElement = array[0];
if (array.Length == 1)
{
bestElement = currElement;
bestLength = 1;
return;
}
for (int i = 1; i < array.Length; i++)
{
if (array[i] == currElement)
{
currLength++;
}
else
{
currElement = array[i];
currLength = 1;
}
if (currLength >= bestLength)
{
bestLength = currLength;
bestElement = currElement;
}
}
Console.Write("Array elements: " + "{" + string.Join(", ", array) + "}\n");
Console.Write("The maximal sequence of equal elements in the array is: {");
for (int i = 0; i < bestLength; i++)
{
Console.Write(i != bestLength - 1 ? bestElement + ", " : bestElement + "}\n");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
/*Problem 4. Maximal sequence
Write a program that finds the maximal sequence of equal elements in an array.
Example:
input result
2, 1, 1, 2, 3, 3, 2, 2, 2, 1 2, 2, 2
*/
class MaximalSequence
{
static void Main()
{
int arrayLength = int.Parse(Console.ReadLine());
int[] array = new int[arrayLength]; //I know this is a bad name for an array, but I can't figure out a better one!
Random randomGenerator = new Random(); //Generating random numbers, for filling our array elements
for (int i = 0; i < arrayLength; i++) //For loop to fill every array element with random generated value
{
array[i] = randomGenerator.Next(1, 5);
}
int bestLength = 0, bestElement = 0;
int currLength = 1, currElement = array[0];
if (array.Length == 1)
{
bestElement = currElement;
bestLength = 1;
return;
}
for (int i = 1; i < array.Length; i++)
{
if (array[i] == currElement)
{
currLength++;
}
else
{
currElement = array[i];
currLength = 1;
}
if (currLength >= bestLength)
{
bestLength = currLength;
bestElement = currElement;
}
}
Console.Write("Array elements: " + "{" + string.Join(", ", array) + "}\n");
Console.Write("The maximal sequence of equal elements in the array is: {");
for (int i = 0; i < bestLength; i++)
{
Console.Write(i != bestLength - 1 ? bestElement + ", " : bestElement + "}\n");
}
}
}
|
mit
|
C#
|
20cfa5d83fbe783e3f0520c216c871ccc27d17c8
|
Add button to access latency comparer from game
|
peppy/osu,ppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu
|
osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.cs
|
osu.Game/Overlays/Settings/Sections/DebugSettings/GeneralSettings.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.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Framework.Screens;
using osu.Game.Localisation;
using osu.Game.Screens;
using osu.Game.Screens.Import;
namespace osu.Game.Overlays.Settings.Sections.DebugSettings
{
public class GeneralSettings : SettingsSubsection
{
protected override LocalisableString Header => DebugSettingsStrings.GeneralHeader;
[BackgroundDependencyLoader(true)]
private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig, IPerformFromScreenRunner performer)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = DebugSettingsStrings.ShowLogOverlay,
Current = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
},
new SettingsCheckbox
{
LabelText = DebugSettingsStrings.BypassFrontToBackPass,
Current = config.GetBindable<bool>(DebugSetting.BypassFrontToBackPass)
},
new SettingsButton
{
Text = DebugSettingsStrings.ImportFiles,
Action = () => performer?.PerformFromScreen(menu => menu.Push(new FileImportScreen()))
},
new SettingsButton
{
Text = @"Run latency comparer",
Action = () => performer?.PerformFromScreen(menu => menu.Push(new LatencyComparerScreen()))
}
};
}
}
}
|
// 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.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Framework.Screens;
using osu.Game.Localisation;
using osu.Game.Screens;
using osu.Game.Screens.Import;
namespace osu.Game.Overlays.Settings.Sections.DebugSettings
{
public class GeneralSettings : SettingsSubsection
{
protected override LocalisableString Header => DebugSettingsStrings.GeneralHeader;
[BackgroundDependencyLoader(true)]
private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig, IPerformFromScreenRunner performer)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = DebugSettingsStrings.ShowLogOverlay,
Current = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
},
new SettingsCheckbox
{
LabelText = DebugSettingsStrings.BypassFrontToBackPass,
Current = config.GetBindable<bool>(DebugSetting.BypassFrontToBackPass)
}
};
Add(new SettingsButton
{
Text = DebugSettingsStrings.ImportFiles,
Action = () => performer?.PerformFromScreen(menu => menu.Push(new FileImportScreen()))
});
}
}
}
|
mit
|
C#
|
aacefa745044967265258dc69bb1ec24f6e46a12
|
Add DllCharacteristics xmldoc.
|
Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver
|
src/AsmResolver.PE.File/Headers/DllCharacteristics.cs
|
src/AsmResolver.PE.File/Headers/DllCharacteristics.cs
|
using System;
namespace AsmResolver.PE.File.Headers
{
/// <summary>
/// Provides members describing all possible flags that can be set in the <see cref="OptionalHeader.DllCharacteristics"/>
/// field.
/// </summary>
[Flags]
public enum DllCharacteristics
{
/// <summary>
/// Indicates the image can handle a high entropy 64-bit virtual address space.
/// </summary>
HighEntropyVA = 0x0020,
/// <summary>
/// Indicates the DLL can be relocated at load time.
/// </summary>
DynamicBase = 0x0040,
/// <summary>
/// Indicates Code Integrity checks are enforced.
/// </summary>
ForceIntegrity = 0x0080,
/// <summary>
/// Indicates the image is NX compatible.
/// </summary>
NxCompat = 0x0100,
/// <summary>
/// Indicates the image is isolation aware, but do not isolate the image.
/// </summary>
NoIsolation = 0x0200,
/// <summary>
/// Indicates the image does not use structured exception (SE) handling.
/// No SE handler may be called in this image.
/// </summary>
NoSeh = 0x0400,
/// <summary>
/// Indicates the image must not be bound.
/// </summary>
NoBind = 0x0800,
/// <summary>
/// Indicates the image must execute in an AppContainer.
/// </summary>
AppContainer = 0x1000,
/// <summary>
/// Indicates the image is a WDM driver.
/// </summary>
WdmDriver = 0x2000,
/// <summary>
/// Indicates the image supports Control Flow Guard.
/// </summary>
ControlFLowGuard = 0x4000,
/// <summary>
/// Indicates the image is Terminal Server aware.
/// </summary>
TerminalServerAware = 0x8000,
}
}
|
using System;
namespace AsmResolver.PE.File.Headers
{
[Flags]
public enum DllCharacteristics
{
HighEntropyVA = 0x0020,
DynamicBase = 0x0040,
ForceIntegrity = 0x0080,
NxCompat = 0x0100,
NoIsolation = 0x0200,
NoSeh = 0x0400,
NoBind = 0x0800,
WdmDriver = 0x2000,
TerminalServerAware = 0x8000,
}
}
|
mit
|
C#
|
c835597717679d6bd1f2035b1a1e7c1d493d9d8a
|
Update InterfaceUrl.cs
|
rongcloud/server-sdk-dotnet
|
RongCloudServerSDK/InterfaceUrl.cs
|
RongCloudServerSDK/InterfaceUrl.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace io.rong
{
class InterfaceUrl
{
public static String server_addr = "http://api.cn.ronghub.com";
public static String getTokenUrl = server_addr+"/user/getToken.json";
public static String joinGroupUrl = server_addr + "/group/join.json";
public static String quitGroupUrl = server_addr + "/group/quit.json";
public static String dismissUrl = server_addr + "/group/dismiss.json";
public static String syncGroupUrl = server_addr + "/group/sync.json";
public static String sendMsgUrl = server_addr + "/message/publish.json";
public static String sendSysMsgUrl = server_addr + "/message/system/publish.json";
public static String broadcastUrl = server_addr + "/message/broadcast.json";
public static String createChatroomUrl = server_addr + "/chatroom/create.json";
public static String destroyChatroomUrl = server_addr + "/chatroom/destroy.json";
public static String queryChatroomUrl = server_addr + "/chatroom/query.json";
//public static String getTokenUrl = server_addr + "/user/getToken.xml";
//public static String joinGroupUrl = server_addr + "/group/join.xml";
//public static String quitGroupUrl = server_addr + "/group/quit.xml";
//public static String dismissUrl = server_addr + "/group/dismiss.xml";
//public static String syncGroupUrl = server_addr + "/group/sync.xml";
//public static String SendMsgUrl = server_addr + "/message/publish.xml";
//public static String sendSysMsgUrl = server_addr + "/message/system/publish.xml";
//public static String broadcastUrl = server_addr + "/message/broadcast.xml";
//public static String createChatroomUrl = server_addr + "/chatroom/create.xml";
//public static String destroyChatroomUrl = server_addr + "/chatroom/destroy.xml";
//public static String queryChatroomUrl = server_addr + "/chatroom/query.xml";
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace io.rong
{
class InterfaceUrl
{
public static String server_addr = "http://api.cn.ronghub.com";
public static String getTokenUrl = server_addr+"/user/getToken.json";
public static String joinGroupUrl = server_addr + "/group/join.json";
public static String quitGroupUrl = server_addr + "/group/quit.json";
public static String dismissUrl = server_addr + "/group/dismiss.json";
public static String syncGroupUrl = server_addr + "/group/sync.json";
public static String sendMsgUrl = server_addr + "/message/publish.json";
public static String broadcastUrl = server_addr + "/message/broadcast.json";
public static String createChatroomUrl = server_addr + "/chatroom/create.json";
public static String destroyChatroomUrl = server_addr + "/chatroom/destroy.json";
public static String queryChatroomUrl = server_addr + "/chatroom/query.json";
//public static String getTokenUrl = server_addr + "/user/getToken.xml";
//public static String joinGroupUrl = server_addr + "/group/join.xml";
//public static String quitGroupUrl = server_addr + "/group/quit.xml";
//public static String dismissUrl = server_addr + "/group/dismiss.xml";
//public static String syncGroupUrl = server_addr + "/group/sync.xml";
//public static String SendMsgUrl = server_addr + "/message/publish.xml";
//public static String broadcastUrl = server_addr + "/message/broadcast.xml";
//public static String createChatroomUrl = server_addr + "/chatroom/create.xml";
//public static String destroyChatroomUrl = server_addr + "/chatroom/destroy.xml";
//public static String queryChatroomUrl = server_addr + "/chatroom/query.xml";
}
}
|
mit
|
C#
|
7ebd87a6b2904be19d382b00ac25b13ae5f8a844
|
Add doc comments for FormOptions.
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Microsoft.AspNetCore.Http/Features/FormOptions.cs
|
src/Microsoft.AspNetCore.Http/Features/FormOptions.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using Microsoft.AspNetCore.WebUtilities;
namespace Microsoft.AspNetCore.Http.Features
{
public class FormOptions
{
public const int DefaultMemoryBufferThreshold = 1024 * 64;
public const int DefaultBufferBodyLengthLimit = 1024 * 1024 * 128;
public const int DefaultMultipartBoundaryLengthLimit = 128;
public const long DefaultMultipartBodyLengthLimit = 1024 * 1024 * 128;
/// <summary>
/// Enables full request body buffering. Use this if multiple components need to read the raw stream.
/// The default value is false.
/// </summary>
public bool BufferBody { get; set; } = false;
/// <summary>
/// If <see cref="BufferBody"/> is enabled, this many bytes of the body will be buffered in memory.
/// If this threshold is exceeded then the buffer will be moved to a temp file on disk instead.
/// This also applies when buffering individual multipart section bodies.
/// </summary>
public int MemoryBufferThreshold { get; set; } = DefaultMemoryBufferThreshold;
/// <summary>
/// If <see cref="BufferBody"/> is enabled, this is the limit for the total number of bytes that will
/// be buffered. Forms that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public long BufferBodyLengthLimit { get; set; } = DefaultBufferBodyLengthLimit;
/// <summary>
/// A limit for the number of form entries to allow. Entries with the same key will be combined.
/// Forms that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int KeyCountLimit { get; set; } = FormReader.DefaultKeyCountLimit;
/// <summary>
/// A limit on the length of individual keys. Forms containing keys that exceed this limit will
/// throw an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int KeyLengthLimit { get; set; } = FormReader.DefaultKeyLengthLimit;
/// <summary>
/// A limit on the length of individual form values. Forms containing values that exceed this
/// limit will throw an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int ValueLengthLimit { get; set; } = FormReader.DefaultValueLengthLimit;
/// <summary>
/// A limit for the length of the boundary identifier. Forms with boundaries that exceed this
/// limit will throw an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int MultipartBoundaryLengthLimit { get; set; } = DefaultMultipartBoundaryLengthLimit;
/// <summary>
/// A limit for the number of headers to allow in each multipart section. Headers with the same name will
/// be combined. Form sections that exceed this limit will throw an <see cref="InvalidDataException"/>
/// when parsed.
/// </summary>
public int MultipartHeadersCountLimit { get; set; } = MultipartReader.DefaultHeadersCountLimit;
/// <summary>
/// A limit for the total length of the header keys and values in each multipart section.
/// Form sections that exceed this limit will throw an <see cref="InvalidDataException"/> when parsed.
/// </summary>
public int MultipartHeadersLengthLimit { get; set; } = MultipartReader.DefaultHeadersLengthLimit;
/// <summary>
/// A limit for the length of each multipart body. Forms sections that exceed this limit will throw an
/// <see cref="InvalidDataException"/> when parsed.
/// </summary>
public long MultipartBodyLengthLimit { get; set; } = DefaultMultipartBodyLengthLimit;
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.WebUtilities;
namespace Microsoft.AspNetCore.Http.Features
{
public class FormOptions
{
public const int DefaultMemoryBufferThreshold = 1024 * 64;
public const int DefaultBufferBodyLengthLimit = 1024 * 1024 * 128;
public const int DefaultMultipartBoundaryLengthLimit = 128;
public const long DefaultMultipartBodyLengthLimit = 1024 * 1024 * 128;
public bool BufferBody { get; set; } = false;
public int MemoryBufferThreshold { get; set; } = DefaultMemoryBufferThreshold;
public long BufferBodyLengthLimit { get; set; } = DefaultBufferBodyLengthLimit;
public int KeyCountLimit { get; set; } = FormReader.DefaultKeyCountLimit;
public int KeyLengthLimit { get; set; } = FormReader.DefaultKeyLengthLimit;
public int ValueLengthLimit { get; set; } = FormReader.DefaultValueLengthLimit;
public int MultipartBoundaryLengthLimit { get; set; } = DefaultMultipartBoundaryLengthLimit;
public int MultipartHeadersCountLimit { get; set; } = MultipartReader.DefaultHeadersCountLimit;
public int MultipartHeadersLengthLimit { get; set; } = MultipartReader.DefaultHeadersLengthLimit;
public long MultipartBodyLengthLimit { get; set; } = DefaultMultipartBodyLengthLimit;
}
}
|
apache-2.0
|
C#
|
3ce30673473fd124c536d786fb31bee70f96c9f1
|
Make sure to also customize Mock<TextWriter> and use same instance
|
appharbor/appharbor-cli
|
src/AppHarbor.Tests/TextWriterCustomization.cs
|
src/AppHarbor.Tests/TextWriterCustomization.cs
|
using System.IO;
using Moq;
using Ploeh.AutoFixture;
namespace AppHarbor.Tests
{
public class TextWriterCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
var textWriterMock = new Mock<TextWriter>();
fixture.Customize<TextWriter>(x => x.FromFactory(() => { return textWriterMock.Object; }));
fixture.Customize<Mock<TextWriter>>(x => x.FromFactory(() => { return textWriterMock; }));
}
}
}
|
using System;
using System.IO;
using Ploeh.AutoFixture;
namespace AppHarbor.Tests
{
public class TextWriterCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
fixture.Customize<TextWriter>(x => x.FromFactory(() => { return Console.Out; }));
}
}
}
|
mit
|
C#
|
b353aa3b3ff1447216372287ba09259b782b276b
|
Put in the public shared secret as an example
|
RoyalVeterinaryCollege/VetCompassClient
|
clr/ConsoleExample.net45/Program.cs
|
clr/ConsoleExample.net45/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using VetCompass.Client;
namespace ConsoleExample
{
class Program
{
static void Main(string[] args)
{
//var key = CreateServiceClientKey();
//var id = Guid.NewGuid();
var client = new CodingSessionFactory(Guid.Parse("6219abd9-b229-458c-baa0-2fc80763193e"), "ai5VdBnKx8GD1HT7fo6WTkHTKqGsBbhfcXX0cOHnuj93mjDrtKbgDjbqLNDfZoJeRVRD3pIspg3Scydm2Gx3CQ==", new Uri("https://vetcompass.herokuapp.com/api/1.0/session/"));
var session = client.StartCodingSession(new CodingSubject { CaseNumber = "noel's testing case" });
var results = session.QuerySynch(new VeNomQuery("rta"));
Console.ReadKey();
}
private static void SelectionTesting()
{
var client = new CodingSessionFactory(Guid.NewGuid(), "not very secret", new Uri("http://192.168.1.199:5000/api/1.0/session/"));
var session = client.StartCodingSession(new CodingSubject { CaseNumber = "noel's testing case" });
var results = session.QuerySynch(new VeNomQuery("rta"));
var post = session.RegisterSelection(new VetCompassCodeSelection("rta",results.Results.First().VeNomId));
Console.ReadKey();
}
void ThroughPutTest()
{
var client = new CodingSessionFactory(Guid.NewGuid(), "not very secret", new Uri("https://vetcompass.herokuapp.com/api/1.0/session/"));
var session = client.StartCodingSession(new CodingSubject { CaseNumber = "noel's testing case" });
var start = DateTime.Now;
var results = new List<Task<VeNomQueryResponse>>();
for (int i = 0; i < 10; i++)
{
results.Add(session.QueryAsync(new VeNomQuery("rta")));
}
var array = results.ToArray();
Task.WaitAll(array);
Console.WriteLine(DateTime.Now - start);
Console.ReadKey();
}
public static string CreateServiceClientKey()
{
var hmac = new HMACSHA256();
return Convert.ToBase64String(hmac.Key);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using VetCompass.Client;
namespace ConsoleExample
{
class Program
{
static void Main(string[] args)
{
var client = new CodingSessionFactory(Guid.NewGuid(), "TI4hiVg2bTTR7+d/mqFo/7gMUiVZGOsC0JSMSVUI99VQO8cT+ImSfnPqPBPru1zdb12GbXB7C4W4Y300SUeR+w==", new Uri("https://vetcompass.herokuapp.com/api/1.0/session/"));
var session = client.StartCodingSession(new CodingSubject { CaseNumber = "noel's testing case" });
var results = session.QuerySynch(new VeNomQuery("rta"));
Console.ReadKey();
}
private static void SelectionTesting()
{
var client = new CodingSessionFactory(Guid.NewGuid(), "not very secret", new Uri("http://192.168.1.199:5000/api/1.0/session/"));
var session = client.StartCodingSession(new CodingSubject { CaseNumber = "noel's testing case" });
var results = session.QuerySynch(new VeNomQuery("rta"));
var post = session.RegisterSelection(new VetCompassCodeSelection("rta",results.Results.First().VeNomId));
Console.ReadKey();
}
void ThroughPutTest()
{
var client = new CodingSessionFactory(Guid.NewGuid(), "not very secret", new Uri("https://vetcompass.herokuapp.com/api/1.0/session/"));
var session = client.StartCodingSession(new CodingSubject { CaseNumber = "noel's testing case" });
var start = DateTime.Now;
var results = new List<Task<VeNomQueryResponse>>();
for (int i = 0; i < 10; i++)
{
results.Add(session.QueryAsync(new VeNomQuery("rta")));
}
var array = results.ToArray();
Task.WaitAll(array);
Console.WriteLine(DateTime.Now - start);
Console.ReadKey();
}
public static string CreateServiceClientKey()
{
var hmac = new HMACSHA256();
return Convert.ToBase64String(hmac.Key);
}
}
}
|
mit
|
C#
|
38c3365e4e720488d545d72513858843acfba2a0
|
Update Problem16.cs
|
neilopet/projecteuler_cs
|
Problem16.cs
|
Problem16.cs
|
/*
* Problem 16
2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^1000?
*/
using System;
using System.Numerics;
public class Problem16
{
public static void Main()
{
BigInteger n = new BigInteger(1);
/* Left bit shifting is the same as raising to power of 2 */
n <<= 1000;
String s = n.ToString();
int sum = 0;
for(int i = 0, j = s.Length; i < j; sum += Int32.Parse(s.Substring(i, 1)), i++)
;
Console.WriteLine(sum);
}
}
|
/*
* Problem 16
2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^1000?
*/
using System;
using System.Numerics;
public class Problem16
{
public static void Main()
{
/* Left bit shifting is the same as raising to power of 2 */
BigInteger n = new BigInteger(1);
n<<=1000;
String s = n.ToString();
int sum = 0;
for(int i = 0, j = s.Length; i < j; sum += Int32.Parse(s.Substring(i, 1)), i++)
;
Console.WriteLine(sum);
}
}
|
mit
|
C#
|
6c44cdce349bae8537b717b1d45d1789fbaa8d7e
|
Add TODOs
|
OvidiuCaba/StatisticsRomania,OvidiuCaba/StatisticsRomania,OvidiuCaba/StatisticsRomania,OvidiuCaba/StatisticsRomania
|
src/StatisticsRomania/StatisticsRomania/App.cs
|
src/StatisticsRomania/StatisticsRomania/App.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StatisticsRomania.Views;
using Xamarin.Forms;
using SQLite.Net.Async;
namespace StatisticsRomania
{
// TODO: new functionalities:
// - export data
// - fix issues on rotating
// - forecast: https://azure.microsoft.com/en-us/documentation/articles/machine-learning-what-is-machine-learning/
// - add 3 pixels padding at the edge of the screen
// - add data from 2014 - maybe display only last 24 months [or less? maybe configurable?]
// - maybe group indicators by category
// - adaugă un "help" unde să ai explicații pentru toți termenii sau abrevierile folosite (eventual poți avea un buton de info "i" în colțul dreapta-sus al termenilor respectivi).
// - adaugă search la lsita județelor, e destul de greu să scoll-ezi în 41 de județe.
// - zoom-in și zoom-out la grafice. O difentă între 155.000 și 158.000 pare imensă când axa Y pleacă de la 150.000 și se termină la 160.000.
public class App : Application
{
public static string SqliteFilename = "database.db3";
public static SQLiteAsyncConnection AsyncDb;
// Note: change the values when new data is added [in the future we might automatically get the data from API, so no rush to optimize here]
public static int LastYearAvailableData = 2016;
public static int LastMonthAvailableData = 1;
public App()
{
// The root page of your application
MainPage = new RootPage();
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StatisticsRomania.Views;
using Xamarin.Forms;
using SQLite.Net.Async;
namespace StatisticsRomania
{
// TODO: new functionalities:
// - export data
// - fix issues on rotating
// - forecast: https://azure.microsoft.com/en-us/documentation/articles/machine-learning-what-is-machine-learning/
// - add 3 pixels padding at the edge of the screen
// - add data from 2014 - maybe display only last 24 months [or less? maybe configurable?]
// - maybe group indicators by category
public class App : Application
{
public static string SqliteFilename = "database.db3";
public static SQLiteAsyncConnection AsyncDb;
// Note: change the values when new data is added [in the future we might automatically get the data from API, so no rush to optimize here]
public static int LastYearAvailableData = 2016;
public static int LastMonthAvailableData = 1;
public App()
{
// The root page of your application
MainPage = new RootPage();
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}
|
mit
|
C#
|
04c7bcb638909dbe83c1c0dfca36055a4ee464d9
|
Add "plan" to StripSubscriptionUpdateOptions so we can change plans.
|
haithemaraissia/stripe.net,DemocracyVenturesInc/stripe.net,weizensnake/stripe.net,duckwaffle/stripe.net,AvengingSyndrome/stripe.net,DemocracyVenturesInc/stripe.net,sidshetye/stripe.net,craigmckeachie/stripe.net,AvengingSyndrome/stripe.net,hattonpoint/stripe.net,Raganhar/stripe.net,agrogan/stripe.net,matthewcorven/stripe.net,matthewcorven/stripe.net,richardlawley/stripe.net,haithemaraissia/stripe.net,brentdavid2008/stripe.net,shirley-truong-volusion/stripe.net,weizensnake/stripe.net,sidshetye/stripe.net,chickenham/stripe.net,Raganhar/stripe.net,craigmckeachie/stripe.net,agrogan/stripe.net,chickenham/stripe.net,hattonpoint/stripe.net,shirley-truong-volusion/stripe.net,mathieukempe/stripe.net,mathieukempe/stripe.net,stripe/stripe-dotnet
|
src/Stripe/Services/Subscriptions/StripeSubscriptionUpdateOptions.cs
|
src/Stripe/Services/Subscriptions/StripeSubscriptionUpdateOptions.cs
|
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Stripe
{
public class StripeSubscriptionUpdateOptions : StripeSubscriptionCreateOptions
{
[JsonProperty("prorate")]
public bool? Prorate { get; set; }
[JsonProperty("plan")]
public string PlanId { get; set; }
}
}
|
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Stripe
{
public class StripeSubscriptionUpdateOptions : StripeSubscriptionCreateOptions
{
[JsonProperty("prorate")]
public bool? Prorate { get; set; }
}
}
|
apache-2.0
|
C#
|
86367a088932a733e407ee2b738c285454408df3
|
Add Move.ToString()
|
ProgramFOX/Chess.NET
|
ChessDotNet/Move.cs
|
ChessDotNet/Move.cs
|
namespace ChessDotNet
{
public class Move
{
public Position OriginalPosition
{
get;
private set;
}
public Position NewPosition
{
get;
private set;
}
public Players Player
{
get;
private set;
}
public Move(Position originalPos, Position newPos, Players player)
{
OriginalPosition = originalPos;
NewPosition = newPos;
Player = player;
}
public Move(string originalPos, string newPos, Players player)
{
OriginalPosition = new Position(originalPos);
NewPosition = new Position(newPos);
Player = player;
}
public override bool Equals(object obj)
{
Move m1 = this;
Move m2 = (Move)obj;
return m1.OriginalPosition.Equals(m2.OriginalPosition)
&& m1.NewPosition.Equals(m2.NewPosition)
&& m1.Player == m2.Player;
}
public override int GetHashCode()
{
return new { OriginalPosition, NewPosition, Player }.GetHashCode();
}
public static bool operator ==(Move m1, Move m2)
{
return m1.Equals(m2);
}
public static bool operator !=(Move m1, Move m2)
{
return !m1.Equals(m2);
}
public override string ToString()
{
return OriginalPosition.ToString() + "-" + NewPosition.ToString();
}
}
}
|
namespace ChessDotNet
{
public class Move
{
public Position OriginalPosition
{
get;
private set;
}
public Position NewPosition
{
get;
private set;
}
public Players Player
{
get;
private set;
}
public Move(Position originalPos, Position newPos, Players player)
{
OriginalPosition = originalPos;
NewPosition = newPos;
Player = player;
}
public Move(string originalPos, string newPos, Players player)
{
OriginalPosition = new Position(originalPos);
NewPosition = new Position(newPos);
Player = player;
}
public override bool Equals(object obj)
{
Move m1 = this;
Move m2 = (Move)obj;
return m1.OriginalPosition.Equals(m2.OriginalPosition)
&& m1.NewPosition.Equals(m2.NewPosition)
&& m1.Player == m2.Player;
}
public override int GetHashCode()
{
return new { OriginalPosition, NewPosition, Player }.GetHashCode();
}
public static bool operator ==(Move m1, Move m2)
{
return m1.Equals(m2);
}
public static bool operator !=(Move m1, Move m2)
{
return !m1.Equals(m2);
}
}
}
|
mit
|
C#
|
c8f7f041375263e121ad08d004ac5ab4a27a2fff
|
Fix naming and Documentation
|
tom-englert/TomsToolbox
|
TomsToolbox.Composition/IExport.cs
|
TomsToolbox.Composition/IExport.cs
|
namespace TomsToolbox.Composition
{
using JetBrains.Annotations;
/// <summary>
/// Encapsulation of an DI exported object with metadata.
/// </summary>
/// <typeparam name="T">The type of the object.</typeparam>
/// <typeparam name="TMetadata">The type of the metadata.</typeparam>
public interface IExport<out T, out TMetadata>
{
/// <summary>
/// Gets the value.
/// </summary>
[CanBeNull]
T Value { get; }
/// <summary>
/// Gets the metadata.
/// </summary>
[CanBeNull]
TMetadata Metadata { get; }
}
/// <summary>
/// Encapsulation of an DI exported object with generic metadata.
/// </summary>
/// <typeparam name="T">The type of the object.</typeparam>
public interface IExport<out T> : IExport<T, IMetadata>
{
}
}
|
namespace TomsToolbox.Composition
{
using JetBrains.Annotations;
/// <summary>
/// Encapsulation of an DI exported object with metadata.
/// </summary>
/// <typeparam name="T">The type of the object.</typeparam>
/// <typeparam name="TMetadata">The type of the metadata.</typeparam>
public interface IExport<out T, out TMetadata>
{
/// <summary>
/// Gets the value.
/// </summary>
[CanBeNull]
T Value { get; }
/// <summary>
/// Gets the metadata.
/// </summary>
[CanBeNull]
TMetadata Metadata { get; }
}
/// <summary>
/// Encapsulation of an IOC exported object with generic metadata.
/// </summary>
/// <typeparam name="T">The type of the object.</typeparam>
public interface IExport<out T> : IExport<T, IMetadata>
{
}
}
|
mit
|
C#
|
2a1696b85d0307fa26d769623576d7ea3e42fedc
|
Remove debugging line. Sorry RockyTV!
|
81ninja/DarkMultiPlayer,Dan-Shields/DarkMultiPlayer,godarklight/DarkMultiPlayer,81ninja/DarkMultiPlayer,rewdmister4/rewd-mod-packs,RockyTV/DarkMultiPlayer,Sanmilie/DarkMultiPlayer,RockyTV/DarkMultiPlayer,dsonbill/DarkMultiPlayer,Kerbas-ad-astra/DarkMultiPlayer,godarklight/DarkMultiPlayer
|
Server/LogExpire.cs
|
Server/LogExpire.cs
|
using System;
using System.IO;
namespace DarkMultiPlayerServer
{
public class LogExpire
{
private static string logDirectory
{
get
{
return Path.Combine(Server.universeDirectory, DarkLog.LogFolder);
}
}
public static void ExpireLogs()
{
if (!Directory.Exists(logDirectory))
{
//Screenshot directory is missing so there will be no screenshots to delete.
return;
}
string[] logFiles = Directory.GetFiles(logDirectory);
foreach (string logFile in logFiles)
{
//Check if the expireScreenshots setting is enabled
if (Settings.settingsStore.expireLogs > 0)
{
//If the file is older than a day, delete it
if (File.GetCreationTime(logFile).AddDays(Settings.settingsStore.expireLogs) < DateTime.Now)
{
DarkLog.Debug("Deleting saved log '" + logFile + "', reason: Expired!");
try
{
File.Delete(logFile);
}
catch (Exception e)
{
DarkLog.Error("Exception while trying to delete '" + logFile + "'!, Exception: " + e.Message);
}
}
}
}
}
}
}
|
using System;
using System.IO;
namespace DarkMultiPlayerServer
{
public class LogExpire
{
private static string logDirectory
{
get
{
return Path.Combine(Server.universeDirectory, DarkLog.LogFolder);
}
}
public static void ExpireLogs()
{
if (!Directory.Exists(logDirectory))
{
//Screenshot directory is missing so there will be no screenshots to delete.
return;
}
string[] logFiles = Directory.GetFiles(logDirectory);
foreach (string logFile in logFiles)
{
Console.WriteLine("LogFile: " + logFile);
//Check if the expireScreenshots setting is enabled
if (Settings.settingsStore.expireLogs > 0)
{
//If the file is older than a day, delete it
if (File.GetCreationTime(logFile).AddDays(Settings.settingsStore.expireLogs) < DateTime.Now)
{
DarkLog.Debug("Deleting saved log '" + logFile + "', reason: Expired!");
try
{
File.Delete(logFile);
}
catch (Exception e)
{
DarkLog.Error("Exception while trying to delete '" + logFile + "'!, Exception: " + e.Message);
}
}
}
}
}
}
}
|
mit
|
C#
|
2f2aeded2b22e6c443f09147933a772fe0469dd7
|
Add GitRepositoryConfigurer#Configure
|
appharbor/appharbor-cli
|
src/AppHarbor/GitRepositoryConfigurer.cs
|
src/AppHarbor/GitRepositoryConfigurer.cs
|
using System;
using AppHarbor.Model;
namespace AppHarbor
{
public class GitRepositoryConfigurer
{
private readonly IGitExecutor _executor;
public GitRepositoryConfigurer(IGitExecutor executor)
{
_executor = executor;
}
public void Configure(string id, User user)
{
throw new NotImplementedException();
}
}
}
|
namespace AppHarbor
{
public class GitRepositoryConfigurer
{
private readonly IGitExecutor _executor;
public GitRepositoryConfigurer(IGitExecutor executor)
{
_executor = executor;
}
}
}
|
mit
|
C#
|
d573e18ad8a79b17af0ba50f96845aa4a5f56c9e
|
bump version
|
InEngine-NET/InEngine.NET,InEngine-NET/InEngine.NET,InEngine-NET/InEngine.NET
|
configuration/SharedAssemblyInfo.cs
|
configuration/SharedAssemblyInfo.cs
|
using System.Reflection;
// Assembly Info that is shared across the product
[assembly: AssemblyProduct("InEngine.NET")]
[assembly: AssemblyVersion("2.0.1.*")]
[assembly: AssemblyInformationalVersion("2.0.1")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ethan Hann")]
[assembly: AssemblyCopyright("Copyright © Ethan Hann 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyDescription("")]
|
using System.Reflection;
// Assembly Info that is shared across the product
[assembly: AssemblyProduct("InEngine.NET")]
[assembly: AssemblyVersion("2.0.0.*")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ethan Hann")]
[assembly: AssemblyCopyright("Copyright © Ethan Hann 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyDescription("")]
|
mit
|
C#
|
eb8a521e4b3ab9fc9acef475f047c21fbc25354b
|
change version
|
HenriqueCaires/ZabbixApi,dominicx/ZabbixApi,binking338/ZabbixApi,HenriqueCaires/ZabbixApi
|
src/ZabbixApi/Properties/AssemblyInfo.cs
|
src/ZabbixApi/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("Zabbix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Zabbix")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b243e0ac-089f-4a9c-b63d-5bb24f8f5608")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.3.*")]
[assembly: AssemblyFileVersion("1.0.3")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Zabbix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Zabbix")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b243e0ac-089f-4a9c-b63d-5bb24f8f5608")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.*")]
[assembly: AssemblyFileVersion("1.0.2")]
|
mit
|
C#
|
2be545a801488dbe7e634eb83013780594b57dc3
|
Disable NVOptimusEnabler for uwp
|
JeremyAnsel/helix-toolkit,chrkon/helix-toolkit,Iluvatar82/helix-toolkit,helix-toolkit/helix-toolkit,holance/helix-toolkit
|
Source/HelixToolkit.SharpDX.Shared/Utilities/NVOptimusEnabler.cs
|
Source/HelixToolkit.SharpDX.Shared/Utilities/NVOptimusEnabler.cs
|
using System;
#if !NETFX_CORE
namespace HelixToolkit.Wpf.SharpDX.Utilities
#else
namespace HelixToolkit.UWP.Utilities
#endif
{
#if !NETFX_CORE
/// <summary>
/// Enable dedicated graphics card for rendering. https://stackoverflow.com/questions/17270429/forcing-hardware-accelerated-rendering
/// </summary>
public sealed class NVOptimusEnabler
{
[System.Runtime.InteropServices.DllImport("nvapi64.dll", EntryPoint = "fake")]
static extern int LoadNvApi64();
[System.Runtime.InteropServices.DllImport("nvapi.dll", EntryPoint = "fake")]
static extern int LoadNvApi32();
static NVOptimusEnabler()
{
try
{
if (Environment.Is64BitProcess)
LoadNvApi64();
else
LoadNvApi32();
}
catch { } // will always fail since 'fake' entry point doesn't exists
}
};
#endif
}
|
using System;
#if !NETFX_CORE
namespace HelixToolkit.Wpf.SharpDX.Utilities
#else
namespace HelixToolkit.UWP.Utilities
#endif
{
/// <summary>
/// Enable dedicated graphics card for rendering. https://stackoverflow.com/questions/17270429/forcing-hardware-accelerated-rendering
/// </summary>
public sealed class NVOptimusEnabler
{
[System.Runtime.InteropServices.DllImport("nvapi64.dll", EntryPoint = "fake")]
static extern int LoadNvApi64();
[System.Runtime.InteropServices.DllImport("nvapi.dll", EntryPoint = "fake")]
static extern int LoadNvApi32();
static NVOptimusEnabler()
{
try
{
if (Environment.Is64BitProcess)
LoadNvApi64();
else
LoadNvApi32();
}
catch { } // will always fail since 'fake' entry point doesn't exists
}
};
}
|
mit
|
C#
|
7105acee7565dd3ed7814f4b44d5799cfbd0cd5c
|
Fix GUID in AssemblyInfo
|
GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA
|
Source/Libraries/openXDA.APIAuthentication/Properties/AssemblyInfo.cs
|
Source/Libraries/openXDA.APIAuthentication/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("openXDA.APIAuthentication")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GPA")]
[assembly: AssemblyProduct("openXDA.APIAuthentication")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[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("93FF1E73-CD8B-4F01-89BC-A4A242FA06A6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("3.0.3.225")]
[assembly: AssemblyVersion("3.0.3.225")]
[assembly: AssemblyFileVersion("3.0.3.225")]
|
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("openXDA.APIAuthentication")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GPA")]
[assembly: AssemblyProduct("openXDA.APIAuthentication")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[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("c93FF1E73-CD8B-4F01-89BC-A4A242FA06A6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("3.0.3.225")]
[assembly: AssemblyVersion("3.0.3.225")]
[assembly: AssemblyFileVersion("3.0.3.225")]
|
mit
|
C#
|
fe99bbd846a428da44f0a92ba6d4430a7f7811ff
|
Move command file to appdata
|
adamsteinert/VoiceBuild
|
Vocal/Core/JsonCommandLoader.cs
|
Vocal/Core/JsonCommandLoader.cs
|
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using Vocal.Model;
namespace Vocal.Core
{
public class JsonCommandLoader
{
const string AppDataFolder = "VocalBuildEngine";
const string DefaultConfigFile = "commandsTemplate.json";
const string WriteableCommandFile = "commands.json";
public static IEnumerable<IVoiceCommand> LoadCommandsFromConfiguration()
{
var commandFile = GetDefaultPath(WriteableCommandFile);
if (!File.Exists(commandFile))
{
var file = new FileInfo(commandFile);
if (!Directory.Exists(file.Directory.FullName))
Directory.CreateDirectory(file.Directory.FullName);
CreateWriteableConfigFile(DefaultConfigFile, commandFile);
}
if (!File.Exists(commandFile))
throw new Exception($"There was an error creating the command configuration file {commandFile}. You may need to create this file manually.");
return JsonConvert.DeserializeObject<VoiceCommand[]>(File.ReadAllText(commandFile));
}
public static void CreateWriteableConfigFile(string source, string destination)
{
if (!File.Exists(source))
throw new Exception($"The source configuration file {source} does not exist. A writeable configuration cannot be created. See the documentation for more details.");
File.Copy(source, destination);
}
public static string GetDefaultPath(string fileName)
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), AppDataFolder, fileName);
}
}
}
|
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Vocal.Model;
namespace Vocal.Core
{
public class JsonCommandLoader
{
const string DefaultConfigFile = "commandsTemplate.json";
const string WriteableConfigFile = "commands.json";
public static IEnumerable<IVoiceCommand> LoadCommandsFromConfiguration()
{
if(!File.Exists(WriteableConfigFile))
{
CreateWriteableConfigFile(DefaultConfigFile, WriteableConfigFile);
}
if (!File.Exists(WriteableConfigFile))
throw new Exception($"There was an error creating the command configuration file {WriteableConfigFile}. You may need to create this file manually.");
return JsonConvert.DeserializeObject<VoiceCommand[]>(File.ReadAllText(WriteableConfigFile));
}
public static void CreateWriteableConfigFile(string source, string destination)
{
if (!File.Exists(source))
throw new Exception($"The source configuration file {source} does not exist. A writeable configuration cannot be created. See the documentation for more details.");
File.Copy(source, destination);
}
}
}
|
mit
|
C#
|
d9283b50d19a97a7b00886077467525f5ce618c3
|
Hide file input if readonly
|
mcintyre321/FormFactory,mcintyre321/FormFactory,mcintyre321/FormFactory
|
FormFactory.Templates/Views/Shared/FormFactory/Property.FormFactory.ValueTypes.UploadedFile.cshtml
|
FormFactory.Templates/Views/Shared/FormFactory/Property.FormFactory.ValueTypes.UploadedFile.cshtml
|
@using FormFactory
@model PropertyVm
@if(!Model.Readonly)
{
<input type="hidden" name="@Model.Name" /> @*here to trick model binding into working :( *@
<input type="file" name="@Model.Name" @Model.Readonly() @Model.Disabled() />
}
|
@using FormFactory
@model PropertyVm
<input type="hidden" name="@Model.Name" id="MyFileSubmitPlaceHolder" />@*here to trick model binding into working :( *@
<input type="file" name="@Model.Name" @Model.Readonly() @Model.Disabled() />
|
mit
|
C#
|
f230e3db0f3045702387f377706b553ef75b0dda
|
Add DisconnectReuseSocket
|
KodamaSakuno/Sakuno.Base
|
src/Sakuno.Base/Net/SocketAsyncOperationContext.cs
|
src/Sakuno.Base/Net/SocketAsyncOperationContext.cs
|
using System.Net;
using System.Net.Sockets;
namespace Sakuno.Net
{
public sealed class SocketAsyncOperationContext : DisposableObject
{
SocketAsyncEventArgs _argument;
internal SocketAsyncEventArgs Argument => _argument;
SocketAsyncOperationAwaiter _awaiter;
public Socket AcceptSocket
{
get => _argument.AcceptSocket;
set => _argument.AcceptSocket = value;
}
public EndPoint RemoteEndPoint
{
get => _argument.RemoteEndPoint;
set => _argument.RemoteEndPoint = value;
}
public Socket ConnectSocket => _argument.ConnectSocket;
public byte[] Buffer => _argument.Buffer;
public int BytesTransferred => _argument.BytesTransferred;
public bool DisconnectReuseSocket
{
get => _argument.DisconnectReuseSocket;
set => _argument.DisconnectReuseSocket = value;
}
public SocketError LastError => _argument.SocketError;
public SocketAsyncOperationContext()
{
_argument = new SocketAsyncEventArgs();
_awaiter = new SocketAsyncOperationAwaiter(_argument);
}
public SocketAsyncOperationAwaiter GetAwaiter() => _awaiter;
public void SetBuffer(int offset, int count) =>
_argument.SetBuffer(offset, count);
public void SetBuffer(byte[] buffer) => SetBuffer(buffer, 0, buffer != null ? buffer.Length : 0);
public void SetBuffer(byte[] buffer, int offset, int count)
{
if (buffer == null)
{
_argument.SetBuffer(null, 0, 0);
return;
}
_argument.SetBuffer(buffer, offset, count);
}
protected override void DisposeManagedResources() => _awaiter.Dispose();
}
}
|
using System.Net;
using System.Net.Sockets;
namespace Sakuno.Net
{
public sealed class SocketAsyncOperationContext : DisposableObject
{
SocketAsyncEventArgs _argument;
internal SocketAsyncEventArgs Argument => _argument;
SocketAsyncOperationAwaiter _awaiter;
public Socket AcceptSocket
{
get => _argument.AcceptSocket;
set => _argument.AcceptSocket = value;
}
public EndPoint RemoteEndPoint
{
get => _argument.RemoteEndPoint;
set => _argument.RemoteEndPoint = value;
}
public Socket ConnectSocket => _argument.ConnectSocket;
public byte[] Buffer => _argument.Buffer;
public int BytesTransferred => _argument.BytesTransferred;
public SocketError LastError => _argument.SocketError;
public SocketAsyncOperationContext()
{
_argument = new SocketAsyncEventArgs();
_awaiter = new SocketAsyncOperationAwaiter(_argument);
}
public SocketAsyncOperationAwaiter GetAwaiter() => _awaiter;
public void SetBuffer(int offset, int count) =>
_argument.SetBuffer(offset, count);
public void SetBuffer(byte[] buffer) => SetBuffer(buffer, 0, buffer != null ? buffer.Length : 0);
public void SetBuffer(byte[] buffer, int offset, int count)
{
if (buffer == null)
{
_argument.SetBuffer(null, 0, 0);
return;
}
_argument.SetBuffer(buffer, offset, count);
}
protected override void DisposeManagedResources() => _awaiter.Dispose();
}
}
|
mit
|
C#
|
36ea8138bb4e7439945aecdcfb6e2e383de0c285
|
Switch to using LocalApplicationData folder
|
mavasani/roslyn,diryboy/roslyn,reaction1989/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,KirillOsenkov/roslyn,jasonmalinowski/roslyn,tmat/roslyn,ErikSchierboom/roslyn,stephentoub/roslyn,aelij/roslyn,sharwell/roslyn,diryboy/roslyn,jmarolf/roslyn,heejaechang/roslyn,AmadeusW/roslyn,agocke/roslyn,brettfo/roslyn,genlu/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,mavasani/roslyn,wvdd007/roslyn,genlu/roslyn,panopticoncentral/roslyn,wvdd007/roslyn,tmat/roslyn,bartdesmet/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,physhi/roslyn,stephentoub/roslyn,KevinRansom/roslyn,KirillOsenkov/roslyn,eriawan/roslyn,wvdd007/roslyn,gafter/roslyn,gafter/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,brettfo/roslyn,jasonmalinowski/roslyn,ErikSchierboom/roslyn,panopticoncentral/roslyn,aelij/roslyn,bartdesmet/roslyn,tannergooding/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,abock/roslyn,bartdesmet/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,AmadeusW/roslyn,shyamnamboodiripad/roslyn,heejaechang/roslyn,davkean/roslyn,KevinRansom/roslyn,physhi/roslyn,abock/roslyn,reaction1989/roslyn,brettfo/roslyn,aelij/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,jasonmalinowski/roslyn,tannergooding/roslyn,mgoertz-msft/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,AlekseyTs/roslyn,reaction1989/roslyn,eriawan/roslyn,weltkante/roslyn,dotnet/roslyn,AmadeusW/roslyn,abock/roslyn,gafter/roslyn,jmarolf/roslyn,dotnet/roslyn,stephentoub/roslyn,agocke/roslyn,agocke/roslyn,weltkante/roslyn,physhi/roslyn,eriawan/roslyn,davkean/roslyn,KirillOsenkov/roslyn,KevinRansom/roslyn,davkean/roslyn,tmat/roslyn,genlu/roslyn,weltkante/roslyn
|
src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/IPersistentStorageLocationService.cs
|
src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/IPersistentStorageLocationService.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.Composition;
using System.IO;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Serialization;
namespace Microsoft.CodeAnalysis.Host
{
interface IPersistentStorageLocationService : IWorkspaceService
{
string TryGetStorageLocation(Solution solution);
}
[ExportWorkspaceService(typeof(IPersistentStorageLocationService)), Shared]
internal class DefaultPersistentStorageLocationService : IPersistentStorageLocationService
{
[ImportingConstructor]
public DefaultPersistentStorageLocationService()
{
}
public string TryGetStorageLocation(Solution solution)
{
if (string.IsNullOrWhiteSpace(solution.FilePath))
return null;
// Ensure that each unique workspace kind for any given solution has a unique
// folder to store their data in.
var checksums = new[] { Checksum.Create(solution.FilePath), Checksum.Create(solution.Workspace.Kind) };
var hashedName = Checksum.Create(WellKnownSynchronizationKind.Null, checksums).ToString();
var appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.Create);
var workingFolder = Path.Combine(appDataFolder, "Roslyn", hashedName);
return workingFolder;
}
}
}
|
// 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.Composition;
using System.IO;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Serialization;
namespace Microsoft.CodeAnalysis.Host
{
interface IPersistentStorageLocationService : IWorkspaceService
{
string TryGetStorageLocation(Solution solution);
}
[ExportWorkspaceService(typeof(IPersistentStorageLocationService)), Shared]
internal class DefaultPersistentStorageLocationService : IPersistentStorageLocationService
{
[ImportingConstructor]
public DefaultPersistentStorageLocationService()
{
}
public string TryGetStorageLocation(Solution solution)
{
if (string.IsNullOrWhiteSpace(solution.FilePath))
return null;
// Ensure that each unique workspace kind for any given solution has a unique
// folder to store their data in.
var checksums = new[] { Checksum.Create(solution.FilePath), Checksum.Create(solution.Workspace.Kind) };
var hashedName = Checksum.Create(WellKnownSynchronizationKind.Null, checksums).ToString();
var workingFolder = Path.Combine(Path.GetTempPath(), hashedName);
return workingFolder;
}
}
}
|
mit
|
C#
|
b0f9f02381d68c5cd8c320149476b6d77d5f08ca
|
Add Google Analytics
|
codingoutloud/azuremap-aspnet,codingoutloud/azuremap-aspnet
|
AzureMap/Views/Shared/_Layout.cshtml
|
AzureMap/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - AzureMap.azurewebsites.net</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Azure Map", "Index", "Home", null, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>••• © @DateTime.Now.Year •••</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-11783879-2', 'azurewebsites.net');
ga('send', 'pageview');
</script>
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - AzureMap.azurewebsites.net</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Azure Map", "Index", "Home", null, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>••• © @DateTime.Now.Year •••</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
apache-2.0
|
C#
|
b914fc33f4c2e4156199eb20a7dbeb6dafc78b97
|
correct publickey
|
ekonbenefits/dotnetdbf,hermanho/dotnetdbf,hermanho/dotnetdbf,ekonbenefits/dotnetdbf
|
DotNetDBF/Properties/AssemblyInfo.cs
|
DotNetDBF/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("DotNetDBF")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("Ekon Benefits")]
[assembly : AssemblyProduct("DotNetDBF")]
[assembly : AssemblyCopyright("Copyright © 2009-2011")]
[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("950dfc0d-63ac-43fc-8e58-77a7d9cca63a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: InternalsVisibleTo("DotNetDBF.Enumerable,PublicKey=00240000048000009400000006020000002400005253413100040000010001008713EA5197F8878AF1E1CDEF220E2D0A898944AD1643B851775EB8624697A183FBCD2ED8C1A58CE185B657D6381419AFF8B0DE8F8934F2B7E5DC7C19C11DE8D146B113F6794BF604BD2A11334DCF1022A485DD7A6E6BED8873D26363E9692136598B7750AD633747922657FF215347614DE2FDFA7866843F2924C9E5DB2545E1")]
[assembly : AssemblyVersion("3.0.6.*")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("DotNetDBF")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("Ekon Benefits")]
[assembly : AssemblyProduct("DotNetDBF")]
[assembly : AssemblyCopyright("Copyright © 2009-2011")]
[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("950dfc0d-63ac-43fc-8e58-77a7d9cca63a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: InternalsVisibleTo("DotNetDBF.Enumerable,PublicKey=859f68cd621a0776")]
[assembly : AssemblyVersion("3.0.6.*")]
|
lgpl-2.1
|
C#
|
9d9e2653c5029d886083cb91fdb5e28b1b46c916
|
Add 'About' item to menu.
|
joeyespo/google-apps-client
|
GoogleAppsClient/MainForm.cs
|
GoogleAppsClient/MainForm.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace GoogleAppsClient
{
public partial class MainForm : Form
{
const string ABOUT_URL = "https://github.com/joeyespo/google-apps-client";
const string BASE_URL = "https://mail.google.com/";
const string DOMAIN_SEPARATOR = "a/";
bool exiting = false;
public MainForm()
{
InitializeComponent();
}
#region Event Handlers
protected override void OnClosing(CancelEventArgs e)
{
if (!exiting)
{
Hide();
e.Cancel = true;
}
base.OnClosing(e);
}
protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.Escape)
Close();
return base.ProcessDialogKey(keyData);
}
void closeButton_Click(object sender, EventArgs e)
{
Close();
}
void fileOpenGmailToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenGmail();
}
void fileExitToolStripMenuItem_Click(object sender, EventArgs e)
{
Exit();
}
void helpAboutGoogleAppsClientToolStripMenuItem_Click(object sender, EventArgs e)
{
ShowAbout();
}
void notifyIcon_DoubleClick(object sender, EventArgs e)
{
OpenGmail();
}
void openGmailToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenGmail();
}
void settingsToolStripMenuItem_Click(object sender, EventArgs e)
{
ShowSettings();
}
void aboutGoogleAppsClientToolStripMenuItem_Click(object sender, EventArgs e)
{
ShowAbout();
}
void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Exit();
}
#endregion
#region Actions
void Exit()
{
exiting = true;
Close();
}
void OpenGmail()
{
var url = BASE_URL;
if (!string.IsNullOrWhiteSpace(domainTextBox.Text))
url += DOMAIN_SEPARATOR + domainTextBox.Text;
Process.Start(url);
}
void ShowSettings()
{
Show();
}
void ShowAbout()
{
Process.Start(ABOUT_URL);
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace GoogleAppsClient
{
public partial class MainForm : Form
{
const string BASE_URL = "https://mail.google.com/";
const string DOMAIN_SEPARATOR = "a/";
bool exiting = false;
public MainForm()
{
InitializeComponent();
}
#region Event Handlers
protected override void OnClosing(CancelEventArgs e)
{
if (!exiting)
{
Hide();
e.Cancel = true;
}
base.OnClosing(e);
}
protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.Escape)
Close();
return base.ProcessDialogKey(keyData);
}
void closeButton_Click(object sender, EventArgs e)
{
Close();
}
void fileOpenGmailToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenGmail();
}
void fileExitToolStripMenuItem_Click(object sender, EventArgs e)
{
Exit();
}
void notifyIcon_DoubleClick(object sender, EventArgs e)
{
OpenGmail();
}
void openGmailToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenGmail();
}
void settingsToolStripMenuItem_Click(object sender, EventArgs e)
{
ShowSettings();
}
void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Exit();
}
#endregion
#region Actions
void Exit()
{
exiting = true;
Close();
}
void OpenGmail()
{
var url = BASE_URL;
if (!string.IsNullOrWhiteSpace(domainTextBox.Text))
url += DOMAIN_SEPARATOR + domainTextBox.Text;
Process.Start(url);
}
void ShowSettings()
{
Show();
}
#endregion
}
}
|
mit
|
C#
|
a1e50dc8af1762f1d15a1857fec02e5a5d539e46
|
undo tekk code
|
devlights/MyHelloWorld
|
MyHelloWorld/HelloWorld.Core/HelloWorldMessageManager.cs
|
MyHelloWorld/HelloWorld.Core/HelloWorldMessageManager.cs
|
namespace HelloWorld.Core
{
using System;
using System.Collections.Generic;
using System.Linq;
public class HelloWorldMessageManager : IMessageManager
{
public string GetMessage(string value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (string.IsNullOrEmpty(value))
{
return string.Empty;
}
return string.Format("Hello World {0}!", value);
}
}
}
|
namespace HelloWorld.Core
{
using System;
using System.Collections.Generic;
using System.Linq;
public class HelloWorldMessageManager : IMessageManager
{
public string GetMessage(string value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (string.IsNullOrEmpty(value))
{
return string.Empty;
}
return string.Format("Hello Tekk World {0}!", value);
}
}
}
|
mit
|
C#
|
aa3d384f47ad8f9251b67b14abb45b87d947d8fe
|
Add status message partial (#3030)
|
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
|
BTCPayServer/Views/AppsPublic/PointOfSale/Light.cshtml
|
BTCPayServer/Views/AppsPublic/PointOfSale/Light.cshtml
|
@model BTCPayServer.Models.AppViewModels.ViewPointOfSaleViewModel
@{
Layout = "_LayoutPos";
}
<partial name="_StatusMessage" />
@if (Context.Request.Query.ContainsKey("simple"))
{
<partial name="/Views/AppsPublic/PointOfSale/MinimalLight.cshtml" model="Model" />
}
else
{
<noscript>
<partial name="/Views/AppsPublic/PointOfSale/MinimalLight.cshtml" model="Model" />
</noscript>
<partial name="/Views/AppsPublic/PointOfSale/VueLight.cshtml" model="Model" />
}
|
@model BTCPayServer.Models.AppViewModels.ViewPointOfSaleViewModel
@{
Layout = "_LayoutPos";
}
@if (Context.Request.Query.ContainsKey("simple"))
{
<partial name="/Views/AppsPublic/PointOfSale/MinimalLight.cshtml" model="Model" />
}
else
{
<noscript>
<partial name="/Views/AppsPublic/PointOfSale/MinimalLight.cshtml" model="Model" />
</noscript>
<partial name="/Views/AppsPublic/PointOfSale/VueLight.cshtml" model="Model" />
}
|
mit
|
C#
|
5f051fb9d1109bd74d5efa17d476586245ab43a4
|
change tag position of post detail page
|
Jeffiy/ZBlog-Net,Jeffiy/ZBlog-Net,Jeffiy/ZBlog-Net
|
src/ZBlog/Views/Post/Detail.cshtml
|
src/ZBlog/Views/Post/Detail.cshtml
|
@model Post
@using CommonMark
@{
ViewData["Title"] = Model.Title;
}
<article class="blog-main">
<h3 class="am-article-title blog-title">
<a asp-controller="Post" asp-action="Detail" asp-route-url="@Model.Url">@Model.Title</a>
@if (Html.IsAdmin())
{
<a asp-controller="Post" asp-action="Edit" asp-route-id="@Model.Id" title="Edit"><i class="am-icon-btn am-success am-icon-edit"></i></a>
}
</h3>
<h4 class="am-article-meta blog-meta">
<span class="article-date"><i class="am-icon-calendar"></i> @Model.CreateTime.ToString("yyyy-MM-dd HH:mm")</span>
<span class="article-user"><i class="am-icon-user"></i> <a asp-controller="Home" asp-action="Users" asp-route-name="@Model.User.NickName">@Model.User?.NickName</a></span>
<span class="article-catalog"><i class="am-icon-folder-open-o"></i> <a asp-controller="Home" asp-action="Catalog" asp-route-title="@Model.Catalog?.Title">@Model.Catalog?.Title</a></span>
</h4>
<div class="am-g blog-content">
<div class="am-u-sm-12">
@Html.Raw(CommonMarkConverter.Convert(Model.Content))
</div>
</div>
<h4 class="am-article-meta blog-meta">
<span class="article-tag">
<i class="am-icon-tags"></i>
@foreach (var tag in Model.PostTags)
{
<span class="am-badge am-badge-success">
<a asp-controller="Home" asp-action="Tag" asp-route-name="@tag.Tag?.Name">@tag.Tag?.Name</a>
</span>
}
</span>
</h4>
</article>
<hr class="am-article-divider blog-hr">
<ul class="am-pagination blog-pagination">
<li class="am-pagination-prev"><a id="page-prev" href="javascript:">« 上一页</a></li>
<li class="am-pagination-next"><a id="page-next" href="javascript:">下一页 »</a></li>
</ul>
|
@model Post
@using CommonMark
@{
ViewData["Title"] = Model.Title;
}
<article class="blog-main">
<h3 class="am-article-title blog-title">
<a asp-controller="Post" asp-action="Detail" asp-route-url="@Model.Url">@Model.Title</a>
@if (Html.IsAdmin())
{
<a asp-controller="Post" asp-action="Edit" asp-route-id="@Model.Id" title="Edit"><i class="am-icon-btn am-success am-icon-edit"></i></a>
}
</h3>
<h4 class="am-article-meta blog-meta">
<span class="article-date"><i class="am-icon-calendar"></i> @Model.CreateTime.ToString("yyyy-MM-dd HH:mm")</span>
<span class="article-user"><i class="am-icon-user"></i> <a asp-controller="Home" asp-action="Users" asp-route-name="@Model.User.NickName">@Model.User?.NickName</a></span>
<span class="article-catalog"><i class="am-icon-folder-open-o"></i> <a asp-controller="Home" asp-action="Catalog" asp-route-title="@Model.Catalog?.Title">@Model.Catalog?.Title</a></span>
<span class="article-tag">
<i class="am-icon-tags"></i>
@foreach (var tag in Model.PostTags)
{
<span class="am-badge am-badge-success">
<a asp-controller="Home" asp-action="Tag" asp-route-name="@tag.Tag?.Name">@tag.Tag?.Name</a>
</span>
}
</span>
</h4>
<div class="am-g blog-content">
<div class="am-u-sm-12">
@Html.Raw(CommonMarkConverter.Convert(Model.Content))
</div>
</div>
</article>
<hr class="am-article-divider blog-hr">
<ul class="am-pagination blog-pagination">
<li class="am-pagination-prev"><a id="page-prev" href="javascript:">« 上一页</a></li>
<li class="am-pagination-next"><a id="page-next" href="javascript:">下一页 »</a></li>
</ul>
|
mit
|
C#
|
454a8089b05c0a1d88fa0fade1dd063b048a33d6
|
Make event public
|
DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer
|
Client/Events/RevertEvent.cs
|
Client/Events/RevertEvent.cs
|
// ReSharper disable All
#pragma warning disable IDE1006
namespace LunaClient.Events
{
public class RevertEvent
{
public static EventVoid onRevertToLaunch = new EventVoid("onRevertToLaunch");
public static EventData<EditorFacility> onRevertToPrelaunch = new EventData<EditorFacility>("onRevertToPrelaunch");
public static EventData<EditorFacility> onReturnToEditor = new EventData<EditorFacility>("onReturnToEditor");
}
}
|
// ReSharper disable All
#pragma warning disable IDE1006
namespace LunaClient.Events
{
internal class RevertEvent
{
public static EventVoid onRevertToLaunch = new EventVoid("onRevertToLaunch");
public static EventData<EditorFacility> onRevertToPrelaunch = new EventData<EditorFacility>("onRevertToPrelaunch");
public static EventData<EditorFacility> onReturnToEditor = new EventData<EditorFacility>("onReturnToEditor");
}
}
|
mit
|
C#
|
c4c360f0331de13506bda9571bc59144a5b6f0d8
|
Allow call to action banner to be optional
|
smbc-digital/iag-contentapi
|
src/StockportContentApi/ContentfulFactories/CommsContentfulFactory.cs
|
src/StockportContentApi/ContentfulFactories/CommsContentfulFactory.cs
|
using System.Collections.Generic;
using StockportContentApi.ContentfulModels;
using StockportContentApi.Model;
namespace StockportContentApi.ContentfulFactories
{
public class CommsContentfulFactory : IContentfulFactory<ContentfulCommsHomepage, CommsHomepage>
{
private readonly IContentfulFactory<ContentfulCallToActionBanner, CallToActionBanner> _callToActionFactory;
private readonly IContentfulFactory<ContentfulEvent, Event> _eventFactory;
private readonly IContentfulFactory<IEnumerable<ContentfulBasicLink>, IEnumerable<BasicLink>> _basicLinkFactory;
public CommsContentfulFactory(
IContentfulFactory<ContentfulCallToActionBanner, CallToActionBanner> callToActionFactory,
IContentfulFactory<ContentfulEvent, Event> eventFactory,
IContentfulFactory<IEnumerable<ContentfulBasicLink>, IEnumerable<BasicLink>> basicLinkFactory)
{
_callToActionFactory = callToActionFactory;
_eventFactory = eventFactory;
_basicLinkFactory = basicLinkFactory;
}
public CommsHomepage ToModel(ContentfulCommsHomepage model)
{
var callToActionBanner = model.CallToActionBanner != null
? _callToActionFactory.ToModel(model.CallToActionBanner)
: null;
var displayEvent = _eventFactory.ToModel(model.WhatsOnInStockportEvent);
var basicLinks = _basicLinkFactory.ToModel(model.UsefullLinks);
return new CommsHomepage(
model.Title,
model.LatestNewsHeader,
model.TwitterFeedHeader,
model.InstagramFeedTitle,
model.InstagramLink,
model.FacebookFeedTitle,
basicLinks,
displayEvent,
callToActionBanner
);
}
}
}
|
using System.Collections.Generic;
using StockportContentApi.ContentfulModels;
using StockportContentApi.Model;
namespace StockportContentApi.ContentfulFactories
{
public class CommsContentfulFactory : IContentfulFactory<ContentfulCommsHomepage, CommsHomepage>
{
private readonly IContentfulFactory<ContentfulCallToActionBanner, CallToActionBanner> _callToActionFactory;
private readonly IContentfulFactory<ContentfulEvent, Event> _eventFactory;
private readonly IContentfulFactory<IEnumerable<ContentfulBasicLink>, IEnumerable<BasicLink>> _basicLinkFactory;
public CommsContentfulFactory(
IContentfulFactory<ContentfulCallToActionBanner, CallToActionBanner> callToActionFactory,
IContentfulFactory<ContentfulEvent, Event> eventFactory,
IContentfulFactory<IEnumerable<ContentfulBasicLink>, IEnumerable<BasicLink>> basicLinkFactory)
{
_callToActionFactory = callToActionFactory;
_eventFactory = eventFactory;
_basicLinkFactory = basicLinkFactory;
}
public CommsHomepage ToModel(ContentfulCommsHomepage model)
{
var callToActionBanner = _callToActionFactory.ToModel(model.CallToActionBanner);
var displayEvent = _eventFactory.ToModel(model.WhatsOnInStockportEvent);
var basicLinks = _basicLinkFactory.ToModel(model.UsefullLinks);
return new CommsHomepage(
model.Title,
model.LatestNewsHeader,
model.TwitterFeedHeader,
model.InstagramFeedTitle,
model.InstagramLink,
model.FacebookFeedTitle,
basicLinks,
displayEvent,
callToActionBanner
);
}
}
}
|
mit
|
C#
|
71b00c967becfe1af1ccc13ee46ea8c697a75964
|
remove return from Splice
|
jhgbrt/google-diff-match-patch-csharp
|
DiffMatchPatch/Extensions.cs
|
DiffMatchPatch/Extensions.cs
|
/*
* Copyright 2008 Google Inc. All Rights Reserved.
* Author: fraser@google.com (Neil Fraser)
* Author: anteru@developer.shelter13.net (Matthaeus G. Chajdas)
*
* 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.
*
* Diff Match and Patch
* http://code.google.com/p/google-diff-match-patch/
*/
using System.Collections.Generic;
namespace DiffMatchPatch
{
internal static class Extensions
{
internal static void Splice<T>(this List<T> input, int start, int count, params T[] objects)
=> input.Splice(start, count, (IEnumerable<T>) objects);
/// <summary>
/// replaces [count] entries starting at index [start] with the given [objects]
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="input"></param>
/// <param name="start"></param>
/// <param name="count"></param>
/// <param name="objects"></param>
internal static void Splice<T>(this List<T> input, int start, int count, IEnumerable<T> objects)
{
input.RemoveRange(start, count);
input.InsertRange(start, objects);
}
}
}
|
/*
* Copyright 2008 Google Inc. All Rights Reserved.
* Author: fraser@google.com (Neil Fraser)
* Author: anteru@developer.shelter13.net (Matthaeus G. Chajdas)
*
* 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.
*
* Diff Match and Patch
* http://code.google.com/p/google-diff-match-patch/
*/
using System.Collections.Generic;
namespace DiffMatchPatch
{
internal static class Extensions
{
internal static List<T> Splice<T>(this List<T> input, int start, int count, params T[] objects) => input.Splice(start, count, (IEnumerable<T>) objects);
/// <summary>
/// replaces [count] entries starting at index [start] with the given [objects]
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="input"></param>
/// <param name="start"></param>
/// <param name="count"></param>
/// <param name="objects"></param>
/// <returns>the deleted objects</returns>
internal static List<T> Splice<T>(this List<T> input, int start, int count, IEnumerable<T> objects)
{
var deletedRange = input.GetRange(start, count);
input.RemoveRange(start, count);
input.InsertRange(start, objects);
return deletedRange;
}
}
}
|
apache-2.0
|
C#
|
5c40c94fbd0a035e2f1a22a9bc2896b15728e569
|
Build and publish nuget package
|
peteraritchie/Rock.Core,bfriesen/Rock.Core,RockFramework/Rock.Core
|
Rock.Core/Properties/AssemblyInfo.cs
|
Rock.Core/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.Core")]
[assembly: AssemblyDescription("Core classes and interfaces for Rock Framework.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Core")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6fb79d22-8ea3-4cb0-a704-8608d679cb95")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.5")]
[assembly: AssemblyInformationalVersion("0.9.5")]
[assembly: InternalsVisibleTo("Rock.Core.UnitTests")]
|
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("Rock.Core")]
[assembly: AssemblyDescription("Core classes and interfaces for Rock Framework.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Core")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6fb79d22-8ea3-4cb0-a704-8608d679cb95")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.4")]
[assembly: AssemblyInformationalVersion("0.9.4")]
[assembly: InternalsVisibleTo("Rock.Core.UnitTests")]
|
mit
|
C#
|
64382808233a4e6929252a0b3684f8af03f6d4ce
|
increment patch version,
|
jwChung/Experimentalism,jwChung/Experimentalism
|
build/CommonAssemblyInfo.cs
|
build/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.8.5")]
[assembly: AssemblyInformationalVersion("0.8.5")]
/*
* Version 0.8.5
*
* Introduce ITestFixtureFactory instead of Func<ITestFixture>.
*
* BREAKING CHNAGE
* DefaultTheoremAttribute
* - delete:
* DefaultTheoremAttribute(Func<ITestFixture>)
*
* - before:
* DefaultTheoremAttribute(Func<MethodInfo, ITestFixture>)
* after:
* DefaultTheoremAttribute(ITestFixtureFactory)
*
* - before:
* Func<MethodInfo, ITestFixture> FixtureFactory
* after:
* ITestFixtureFactory FixtureFactory
*
* - before:
* object FixtureType
* after:
* Type FixtureType
*
* ITestCase and TestCase
* - before:
* ITestCommand ConvertToTestCommand(IMethodInfo, Func<MethodInfo, ITestFixture>);
* after:
* ITestCommand ConvertToTestCommand(IMethodInfo, ITestFixtureFactory);
*
* DefaultFirstClassTheoremAttribute
* - delete:
* DefaultTheoremAttribute(Func<ITestFixture>)
*
* - before:
* DefaultTheoremAttribute(Func<MethodInfo, ITestFixture>)
* after:
* DefaultTheoremAttribute(ITestFixtureFactory)
*
* - before:
* Func<MethodInfo, ITestFixture> FixtureFactory
* after:
* ITestFixtureFactory FixtureFactory
*
* Issue
* - https://github.com/jwChung/Experimentalism/issues/30
*
* Pull request
* - https://github.com/jwChung/Experimentalism/pull/31
*/
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.8.4")]
[assembly: AssemblyInformationalVersion("0.8.4")]
/*
* Version 0.8.5
*
* BREAKING CHNAGE
* DefaultTheoremAttribute
* - delete:
* DefaultTheoremAttribute(Func<ITestFixture>)
*
* - before:
* DefaultTheoremAttribute(Func<MethodInfo, ITestFixture>)
* after:
* DefaultTheoremAttribute(ITestFixtureFactory)
*
* - before:
* Func<MethodInfo, ITestFixture> FixtureFactory
* after:
* ITestFixtureFactory FixtureFactory
*
* - before:
* object FixtureType
* after:
* Type FixtureType
*
* ITestCase and TestCase
* - before:
* ITestCommand ConvertToTestCommand(IMethodInfo, Func<MethodInfo, ITestFixture>);
* after:
* ITestCommand ConvertToTestCommand(IMethodInfo, ITestFixtureFactory);
*
* DefaultFirstClassTheoremAttribute
* - delete:
* DefaultTheoremAttribute(Func<ITestFixture>)
*
* - before:
* DefaultTheoremAttribute(Func<MethodInfo, ITestFixture>)
* after:
* DefaultTheoremAttribute(ITestFixtureFactory)
*
* - before:
* Func<MethodInfo, ITestFixture> FixtureFactory
* after:
* ITestFixtureFactory FixtureFactory
*/
|
mit
|
C#
|
b832a94bc245fcc4e206df8b2005766bbd314e35
|
change RepositoryManifest to have a private constructor
|
pburls/dewey
|
Dewey/Manifest/Repository/RepositoryManifest.cs
|
Dewey/Manifest/Repository/RepositoryManifest.cs
|
using Dewey.Manifest.Repositories;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Dewey.Manifest.Repository
{
public class RepositoryManifest
{
public IEnumerable<ComponentItem> ComponentItems { get; private set; }
public const string DEFAULT_REPOSITORY_FILE_NAME = "repository.xml";
private RepositoryManifest () { }
public static LoadRepositoryItemResult LoadRepositoryItem(RepositoryItem repositoryItem, string rootLocation)
{
var repositoryDirectory = new DirectoryInfo(Path.Combine(rootLocation, repositoryItem.RelativeLocation));
if (!repositoryDirectory.Exists) return LoadRepositoryItemResult.CreateDirectoryNotFoundResult(repositoryDirectory);
var repositoryManifestFile = new FileInfo(Path.Combine(repositoryDirectory.FullName, DEFAULT_REPOSITORY_FILE_NAME));
if (!repositoryManifestFile.Exists) return LoadRepositoryItemResult.CreateFileNotFoundResult(repositoryDirectory, repositoryManifestFile);
var repository = XElement.Load(repositoryManifestFile.FullName);
var componentsElement = repository.Elements().FirstOrDefault(x => x.Name.LocalName == "components");
var componentItemResults = new List<LoadComponentElementResult>();
if (componentsElement != null)
{
var componentElements = componentsElement.Elements().Where(x => x.Name.LocalName == "component");
foreach (var componentElement in componentElements)
{
componentItemResults.Add(ComponentItem.LoadComponentElement(componentElement));
}
}
var repositoryManifest = new RepositoryManifest();
repositoryManifest.ComponentItems = componentItemResults.Select(x => x.ComponentItem);
return LoadRepositoryItemResult.CreateSuccessfulResult(repositoryDirectory, repositoryManifestFile, repositoryManifest, componentItemResults);
}
}
}
|
using Dewey.Manifest.Repositories;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Dewey.Manifest.Repository
{
public class RepositoryManifest
{
public IEnumerable<ComponentItem> ComponentItems { get; private set; }
public const string DEFAULT_REPOSITORY_FILE_NAME = "repository.xml";
public static LoadRepositoryItemResult LoadRepositoryItem(RepositoryItem repositoryItem, string rootLocation)
{
var repositoryDirectory = new DirectoryInfo(Path.Combine(rootLocation, repositoryItem.RelativeLocation));
if (!repositoryDirectory.Exists) return LoadRepositoryItemResult.CreateDirectoryNotFoundResult(repositoryDirectory);
var repositoryManifestFile = new FileInfo(Path.Combine(repositoryDirectory.FullName, DEFAULT_REPOSITORY_FILE_NAME));
if (!repositoryManifestFile.Exists) return LoadRepositoryItemResult.CreateFileNotFoundResult(repositoryDirectory, repositoryManifestFile);
var repository = XElement.Load(repositoryManifestFile.FullName);
var componentsElement = repository.Elements().FirstOrDefault(x => x.Name.LocalName == "components");
var componentItemResults = new List<LoadComponentElementResult>();
if (componentsElement != null)
{
var componentElements = componentsElement.Elements().Where(x => x.Name.LocalName == "component");
foreach (var componentElement in componentElements)
{
componentItemResults.Add(ComponentItem.LoadComponentElement(componentElement));
}
}
var repositoryManifest = new RepositoryManifest();
repositoryManifest.ComponentItems = componentItemResults.Select(x => x.ComponentItem);
return LoadRepositoryItemResult.CreateSuccessfulResult(repositoryDirectory, repositoryManifestFile, repositoryManifest, componentItemResults);
}
}
}
|
mit
|
C#
|
f25fa97a8940f6fdb037e8fe2a69fe1a08d51221
|
Update InsertLinkedPicture.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET
|
Examples/CSharp/Articles/InsertLinkedPicture.cs
|
Examples/CSharp/Articles/InsertLinkedPicture.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles
{
public class InsertLinkedPicture
{
public static void Main()
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiate a new Workbook.
Workbook workbook = new Workbook();
//Insert a linked picture (from Web Address) to B2 Cell.
Aspose.Cells.Drawing.Picture pic = workbook.Worksheets[0].Shapes.AddLinkedPicture(1, 1, 100, 100, "http://www.aspose.com/Images/aspose-logo.jpg");
//Set the height and width of the inserted image.
pic.HeightInch = 1.04;
pic.WidthInch = 2.6;
//Save the Excel file.
workbook.Save(dataDir+ "outLinkedPicture.out.xlsx");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles
{
public class InsertLinkedPicture
{
public static void Main()
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiate a new Workbook.
Workbook workbook = new Workbook();
//Insert a linked picture (from Web Address) to B2 Cell.
Aspose.Cells.Drawing.Picture pic = workbook.Worksheets[0].Shapes.AddLinkedPicture(1, 1, 100, 100, "http://www.aspose.com/Images/aspose-logo.jpg");
//Set the height and width of the inserted image.
pic.HeightInch = 1.04;
pic.WidthInch = 2.6;
//Save the Excel file.
workbook.Save(dataDir+ "outLinkedPicture.out.xlsx");
}
}
}
|
mit
|
C#
|
973eed76bc969927c83d7bbd3a5534d185c5de76
|
Fix name in help
|
stsrki/fluentmigrator,fluentmigrator/fluentmigrator,stsrki/fluentmigrator,fluentmigrator/fluentmigrator
|
src/FluentMigrator.DotNet.Cli/Commands/Root.cs
|
src/FluentMigrator.DotNet.Cli/Commands/Root.cs
|
#region License
// Copyright (c) 2007-2018, Sean Chambers and the FluentMigrator Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using McMaster.Extensions.CommandLineUtils;
namespace FluentMigrator.DotNet.Cli.Commands
{
[HelpOption(Description = "Execute FluentMigrator actions")]
[Command("dotnet-fm", Description = "The external FluentMigrator runner that integrates into the .NET Core CLI tooling")]
[Subcommand("migrate", typeof(Migrate))]
[Subcommand("rollback", typeof(Rollback))]
[Subcommand("validate", typeof(Validate))]
[Subcommand("list", typeof(ListCommand))]
public class Root
{
protected int OnExecute(CommandLineApplication app, IConsole console)
{
console.Error.WriteLine("You must specify a subcommand.");
app.ShowHelp();
return 1;
}
}
}
|
#region License
// Copyright (c) 2007-2018, Sean Chambers and the FluentMigrator Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using McMaster.Extensions.CommandLineUtils;
namespace FluentMigrator.DotNet.Cli.Commands
{
[HelpOption(Description = "Execute FluentMigrator actions")]
[Command("dotnet-fm", Description = "The external FluentMigrator runner that integrates into the .NET Core CLI tooling")]
[Subcommand(typeof(Migrate), typeof(Rollback), typeof(Validate), typeof(ListCommand))]
public class Root
{
protected int OnExecute(CommandLineApplication app, IConsole console)
{
console.Error.WriteLine("You must specify a subcommand.");
app.ShowHelp();
return 1;
}
}
}
|
apache-2.0
|
C#
|
54ed85de0d9ae1bf13f07fd6891b2ad87c46fad9
|
Add Range test cases.
|
PowerOfCode/Eto,PowerOfCode/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,l8s/Eto,bbqchickenrobot/Eto-1,l8s/Eto,bbqchickenrobot/Eto-1,l8s/Eto
|
Source/Eto.Test/Eto.Test/UnitTests/Forms/RangeTests.cs
|
Source/Eto.Test/Eto.Test/UnitTests/Forms/RangeTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto.Forms;
using NUnit.Framework;
namespace Eto.Test.UnitTests.Forms
{
[TestFixture]
public class RangeTests
{
[TestCase(100, 200, 100, 101)]
[TestCase(100, 100, 100, 1)]
[TestCase(100, 99, 100, 0)]
public void Range_FromStartEnd(int s, int e, int start, int length)
{
var a = Range.FromStartEnd(s, e);
var b = new Range(start, length);
Assert.AreEqual(a, b);
}
[TestCase(100, 200, 300, 400, 0, -1)] // nonintersecting
[TestCase(100, 200, 150, 300, 150, 200)]
[TestCase(150, 300, 100, 200, 150, 200)] // opposite order
public void Range_Intersect_Intersects(int s1, int e1, int s2, int e2, int s, int e)
{
var r1 = Range.FromStartEnd(s1, e1);
var r2 = Range.FromStartEnd(s2, e2);
var r = Range.FromStartEnd(s, e);
Assert.AreEqual(r, r1.Intersect(r2));
Assert.AreEqual(r, r2.Intersect(r1));
}
[TestCase(100, 200, 4, false)]
[TestCase(100, 200, 99, false)]
[TestCase(100, 200, 100, true)]
[TestCase(100, 200, 200, true)]
[TestCase(100, 200, 201, false)]
[TestCase(100, 200, 500, false)]
public void Range_Contains_Contains(int s, int e, int value, bool contains)
{
var r = Range.FromStartEnd(s, e);
Assert.AreEqual(contains, r.Contains(value));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eto.Forms;
using NUnit.Framework;
namespace Eto.Test.UnitTests.Forms
{
[TestFixture]
public class RangeTests
{
[TestCase(100, 200, 100, 101)]
[TestCase(100, 100, 100, 1)]
[TestCase(100, 99, 100, 0)]
public void Range_FromStartEnd(int s, int e, int start, int length)
{
var a = Range.FromStartEnd(s, e);
var b = new Range(start, length);
Assert.AreEqual(a, b);
}
[TestCase(100, 200, 300, 400, 0, -1)] // nonintersecting
[TestCase(100, 200, 150, 300, 150, 200)]
[TestCase(150, 300, 100, 200, 150, 200)] // opposite order
public void Range_Intersect_Intersects(int s1, int e1, int s2, int e2, int s, int e)
{
var r1 = Range.FromStartEnd(s1, e1);
var r2 = Range.FromStartEnd(s2, e2);
var r = Range.FromStartEnd(s, e);
Assert.AreEqual(r, r1.Intersect(r2));
Assert.AreEqual(r, r2.Intersect(r1));
}
}
}
|
bsd-3-clause
|
C#
|
3976aa32b47ee083f1014a5426ceea3a356f5ec5
|
refactor to sensible.
|
fffej/codekatas,fffej/codekatas,fffej/codekatas
|
MineField/MineSweeperTest.cs
|
MineField/MineSweeperTest.cs
|
using NUnit.Framework;
using FluentAssertions;
namespace Fatvat.Katas.MineSweeper
{
[TestFixture]
public class MineSweeperTest
{
[Test]
public void EmptyMineField()
{
var mineField = new MineField(".");
Assert.That(mineField.Show(), Is.EqualTo("0"));
}
[Test]
public void OneMine()
{
var mineField = new MineField("*");
Assert.That(mineField.Show(), Is.EqualTo("*"));
}
}
public class MineField
{
private readonly string m_MineField;
public MineField(string mineField)
{
m_MineField = mineField;
}
public string Show()
{
return m_MineField[0] == '*' ? "*" : "0";
}
}
}
|
using NUnit.Framework;
using FluentAssertions;
namespace Fatvat.Katas.MineSweeper
{
[TestFixture]
public class MineSweeperTest
{
[Test]
public void TestSimplestMineField()
{
var mineField = new MineField(".");
Assert.That(mineField.Show(), Is.EqualTo("0"));
}
[Test]
public void OneMine()
{
var mineField = new MineField("*");
Assert.That(mineField.Show(), Is.EqualTo("*"));
}
}
public class MineField
{
private readonly string m_MineField;
public MineField(string mineField)
{
m_MineField = mineField;
}
public string Show()
{
return m_MineField[0] == '*' ? "*" : "0";
}
}
}
|
mit
|
C#
|
840b9cc7faf36899789a42530f3aa9e2eb220e88
|
Fix deploy.cake
|
JoeMighty/shouldly,ankurMalhotra/shouldly
|
deploy.cake
|
deploy.cake
|
#addin "Cake.Json"
using System.Net;
using System.Linq;
var target = Argument("target", "Default");
string Get(string url)
{
var assetsRequest = WebRequest.CreateHttp(url);
assetsRequest.Method = "GET";
assetsRequest.Accept = "application/vnd.github.v3+json";
assetsRequest.UserAgent = "BuildScript";
using (var assetsResponse = assetsRequest.GetResponse())
{
var assetsStream = assetsResponse.GetResponseStream();
var assetsReader = new StreamReader(assetsStream);
var assetsBody = assetsReader.ReadToEnd();
return assetsBody;
}
}
Task("EnsureRequirements")
.Does(() =>
{
if (!AppVeyor.IsRunningOnAppVeyor)
throw new Exception("Deployment should happen via appveyor");
var isTag =
AppVeyor.Environment.Repository.Tag.IsTag &&
!string.IsNullOrWhiteSpace(AppVeyor.Environment.Repository.Tag.Name);
if (!isTag)
throw new Exception("Deployment should happen from a published GitHub release");
});
var tag = "";
Task("UpdateVersionInfo")
.IsDependentOn("EnsureRequirements")
.Does(() =>
{
tag = AppVeyor.Environment.Repository.Tag.Name;
AppVeyor.UpdateBuildVersion(tag);
});
Task("DownloadGitHubReleaseArtifacts")
.IsDependentOn("UpdateVersionInfo")
.Does(() =>
{
var assets_url = ParseJson(Get("https://api.github.com/repos/shouldly/shouldly/releases/tags/" + tag))
.GetValue("assets_url").Value<string>();
EnsureDirectoryExists("./releaseArtifacts");
foreach(var asset in DeserializeJson<JArray>(Get(assets_url)))
{
DownloadFile(asset.Value<string>("browser_download_url"), "./releaseArtifacts/" + asset.Value<string>("name"));
}
});
Task("DeployNuget")
.IsDependentOn("DownloadGitHubReleaseArtifacts")
.Does(() =>
{
// Turns .artifacts file into a lookup
var fileLookup = System.IO.File
.ReadAllLines("./releaseArtifacts/artifacts")
.Select(l => l.Split(':'))
.ToDictionary(v => v[0], v => v[1]);
NuGetPush("./releaseArtifacts/" + fileLookup["nuget"], new NuGetPushSettings {
ApiKey = EnvironmentVariable("NuGetApiKey")
});
});
Task("Deploy");
Task("Default")
.IsDependentOn("Deploy");
Task("Verify")
.Does(() => {
// Nothing, used to make sure the script compiles
});
RunTarget(target);
|
#addin "Cake.Json"
using System.Net;
using System.Linq;
var target = Argument("target", "Default");
string Get(string url)
{
var assetsRequest = WebRequest.CreateHttp(url);
assetsRequest.Method = "GET";
assetsRequest.Accept = "application/vnd.github.v3+json";
assetsRequest.UserAgent = "BuildScript";
using (var assetsResponse = assetsRequest.GetResponse())
{
var assetsStream = assetsResponse.GetResponseStream();
var assetsReader = new StreamReader(assetsStream);
var assetsBody = assetsReader.ReadToEnd();
return assetsBody;
}
}
Task("EnsureRequirements")
.Does(() =>
{
if (!AppVeyor.IsRunningOnAppVeyor)
throw new Exception("Deployment should happen via appveyor");
var isTag =
buildSystem.AppVeyor.Environment.Repository.Tag.IsTag &&
!string.IsNullOrWhiteSpace(buildSystem.AppVeyor.Environment.Repository.Tag.Name);
if (!isTag)
throw new Exception("Deployment should happen from a published GitHub release");
});
var tag = "";
Task("UpdateVersionInfo")
.IsDependentOn("EnsureRequirements")
.Does(() =>
{
tag = buildSystem.AppVeyor.Environment.Repository.Tag.Name;
AppVeyor.UpdateBuildVersion(tag);
});
Task("DownloadGitHubReleaseArtifacts")
.IsDependentOn("UpdateVersionInfo")
.Does(() =>
{
var assets_url = ParseJson(Get("https://api.github.com/repos/shouldly/shouldly/releases/tags/" + tag))
.GetValue("assets_url").Value<string>();
EnsureDirectoryExists("./releaseArtifacts");
foreach(var asset in DeserializeJson<JArray>(Get(assets_url)))
{
DownloadFile(asset.Value<string>("browser_download_url"), "./releaseArtifacts/" + asset.Value<string>("name"));
}
});
Task("DeployNuget")
.IsDependentOn("DownloadGitHubReleaseArtifacts")
.Does(() =>
{
// Turns .artifacts file into a lookup
var fileLookup = System.IO.File
.ReadAllLines("./releaseArtifacts/artifacts")
.Select(l => l.Split(':'))
.ToDictionary(v => v[0], v => v[1]);
NuGetPush("./releaseArtifacts/" + fileLookup["nuget"], new NuGetPushSettings {
ApiKey = GetEnvironmentString("NuGetApiKey")
});
});
Task("Deploy");
Task("Default")
.IsDependentOn("Deploy");
RunTarget(target);
|
bsd-3-clause
|
C#
|
e3931db9e5c539f8da664e5bec41c38182f60666
|
Extend the control-flow test with an unconditional 'for'
|
jonathanvdc/ecsc
|
tests/cs/flow/Flow.cs
|
tests/cs/flow/Flow.cs
|
using System;
public static class Program
{
public static int Select(bool C, int X, int Y)
{
return C ? X : Y;
}
public static int IfElse(bool C, int X, int Y)
{
if (C)
return X;
else
return Y;
}
public static int If(bool C, int X, int Y)
{
if (C)
return X;
return Y;
}
public static int Count(int N)
{
int i = 0;
while (i < N)
i++;
return i;
}
public static int CountBreakContinue(int N)
{
int i = 0;
while (true)
{
if (i >= N)
break;
i++;
continue;
}
return i;
}
public static int DoCountBreakContinue(int N)
{
int i = 0;
do
{
if (i >= N)
break;
i++;
continue;
} while (i < N);
return i;
}
public static int Sum(int N)
{
int j = 0;
for (int i = 0; i < N; i++)
j += i;
return j;
}
public static int SumEmptyFor(int N)
{
int j = 0;
int i = 0;
for (;;)
{
if (i >= N)
break;
j += i;
i++;
}
return j;
}
public static void Main(string[] Args)
{
Console.WriteLine(Select(true, 3, 4));
Console.WriteLine(IfElse(false, 3, 4));
Console.WriteLine(If(true, 3, 4));
Console.WriteLine(Count(17));
Console.WriteLine(CountBreakContinue(17));
Console.WriteLine(DoCountBreakContinue(17));
Console.WriteLine(Sum(17));
Console.WriteLine(SumEmptyFor(17));
}
}
|
using System;
public static class Program
{
public static int Select(bool C, int X, int Y)
{
return C ? X : Y;
}
public static int IfElse(bool C, int X, int Y)
{
if (C)
return X;
else
return Y;
}
public static int If(bool C, int X, int Y)
{
if (C)
return X;
return Y;
}
public static int Count(int N)
{
int i = 0;
while (i < N)
i++;
return i;
}
public static int CountBreakContinue(int N)
{
int i = 0;
while (true)
{
if (i >= N)
break;
i++;
continue;
}
return i;
}
public static int DoCountBreakContinue(int N)
{
int i = 0;
do
{
if (i >= N)
break;
i++;
continue;
} while (i < N);
return i;
}
public static int Sum(int N)
{
int j = 0;
for (int i = 0; i < N; i++)
j += i;
return j;
}
public static void Main(string[] Args)
{
Console.WriteLine(Select(true, 3, 4));
Console.WriteLine(IfElse(false, 3, 4));
Console.WriteLine(If(true, 3, 4));
Console.WriteLine(Count(17));
Console.WriteLine(CountBreakContinue(17));
Console.WriteLine(DoCountBreakContinue(17));
Console.WriteLine(Sum(17));
}
}
|
mit
|
C#
|
8174ca6ac6956ad446c6173e5aba2f7be50dd9c9
|
fix net40
|
cartermp/dnx-apps
|
libs/lib/src/Lib/Lib.cs
|
libs/lib/src/Lib/Lib.cs
|
using System;
#if NET40
using System.Net;
#else
using System.Net.Http;
using System.Threading.Tasks;
#endif
using System.Text.RegularExpressions;
namespace Lib
{
public class Library
{
#if NET40
private readonly WebClient _client = new WebClient();
private readonly object _locker = new object();
#else
private readonly HttpClient _client = new HttpClient();
#endif
#if NET40
public string GetDotNetCount()
{
string url = "http://www.dotnetfoundation.org/";
var uri = new Uri(url);
string result = "";
lock(_locker)
{
result = _client.DownloadString(uri);
}
int dotNetCount = Regex.Matches(result, ".NET").Count;
return $"Dotnet Foundation mentions .NET {dotNetCount} times!";
}
#else
public async Task<string> GetDotNetCountAsync()
{
string url = "http://www.dotnetfoundation.org/";
var result = await _client.GetStringAsync(url);
int dotNetCount = Regex.Matches(result, ".NET").Count;
return $"dotnetfoundation.orgmentions .NET {dotNetCount} times in its HTML!";
}
#endif
}
}
|
using System;
#if NET40
using System.Net;
#else
using System.Net.Http;
using System.Threading.Tasks;
#endif
using System.Text.RegularExpressions;
namespace Lib
{
public class Library
{
#if NET40
private readonly WebClient _client = new WebClient();
private readonly object _locker = new object();
#else
private readonly HttpClient _client = new HttpClient();
#endif
#if NET40
public string GetDotNetCount()
{
string url = "http://www.dotnetfoundation.org/";
var uri = new Uri(url);
lock(_locker)
{
var result = _client.DownloadString(uri);
}
int dotNetCount = Regex.Matches(result, ".NET").Count;
return $"Dotnet Foundation mentions .NET {dotNetCount} times!";
}
#else
public async Task<string> GetDotNetCountAsync()
{
string url = "http://www.dotnetfoundation.org/";
var result = await _client.GetStringAsync(url);
int dotNetCount = Regex.Matches(result, ".NET").Count;
return $"dotnetfoundation.orgmentions .NET {dotNetCount} times in its HTML!";
}
#endif
}
}
|
mit
|
C#
|
a6381503661431715c2392ba65351de5cedafc1e
|
Update assembly version to 2.0.0
|
jasonmcboyd/Treenumerable
|
Source/Treenumerable/Properties/AssemblyInfo.cs
|
Source/Treenumerable/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
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("Treenumerable")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jason Boyd")]
[assembly: AssemblyProduct("Treenumerable")]
[assembly: AssemblyCopyright("Copyright © Jason Boyd 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: InternalsVisibleTo("Treenumerable.Tests")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
|
using System.Reflection;
using System.Resources;
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("Treenumerable")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jason Boyd")]
[assembly: AssemblyProduct("Treenumerable")]
[assembly: AssemblyCopyright("Copyright © Jason Boyd 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: InternalsVisibleTo("Treenumerable.Tests")]
// 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.2.0")]
[assembly: AssemblyFileVersion("1.2.0")]
|
mit
|
C#
|
9d42c2cf467c753f9029051e617a7a78ced48827
|
Update Hello.cs
|
dsakam/Hello
|
Project/Hello/Hello/Hello.cs
|
Project/Hello/Hello/Hello.cs
|
using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
namespace Hello
{
class Hello
{
public static void Main(/*string[] args*/)
{
Console.WriteLine("Hello, world.");
}
}
}
|
using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
namespace Hello
{
class Hello
{
public static void Main(string[] args)
{
Console.WriteLine("Hello, world.");
}
}
}
|
bsd-3-clause
|
C#
|
707a42b3f3f1cfb94d47abeef0db557003cd2e67
|
Fix ambiguous reference
|
asizikov/AsyncSuffix
|
src/AsyncSuffix/Analyzer/ConsiderUsingAsyncSuffixHighlighting.cs
|
src/AsyncSuffix/Analyzer/ConsiderUsingAsyncSuffixHighlighting.cs
|
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using Sizikov.AsyncSuffix.Analyzer;
[assembly: RegisterConfigurableSeverity(ConsiderUsingAsyncSuffixHighlighting.SeverityId,
null,
HighlightingGroupIds.BestPractice,
"Consider adding Async suffix",
"According to Microsoft guidelines a method which is Task-returning and is asynchronous in nature should have an 'Async' suffix. ",
Severity.SUGGESTION)]
namespace Sizikov.AsyncSuffix.Analyzer
{
[ConfigurableSeverityHighlighting(SeverityId, CSharpLanguage.Name, OverlapResolve = OverlapResolveKind.WARNING)]
public sealed class ConsiderUsingAsyncSuffixHighlighting : IHighlighting
{
public IMethodDeclaration MethodDeclaration { get; private set; }
public const string SeverityId = "ConsiderUsingAsyncSuffix";
public ConsiderUsingAsyncSuffixHighlighting(IMethodDeclaration methodDeclaration)
{
MethodDeclaration = methodDeclaration;
}
public DocumentRange CalculateRange() => MethodDeclaration.NameIdentifier.GetDocumentRange();
public string ToolTip => "Async method name does not have 'Async' suffix";
public string ErrorStripeToolTip => ToolTip;
public int NavigationOffsetPatch => 0;
public bool IsValid() => MethodDeclaration == null || MethodDeclaration.IsValid();
}
}
|
using ICSharpCode.NRefactory.Refactoring;
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using Sizikov.AsyncSuffix.Analyzer;
[assembly: RegisterConfigurableSeverity(ConsiderUsingAsyncSuffixHighlighting.SeverityId,
null,
HighlightingGroupIds.BestPractice,
"Consider adding Async suffix",
"According to Microsoft guidelines a method which is Task-returning and is asynchronous in nature should have an 'Async' suffix. ",
Severity.SUGGESTION)]
namespace Sizikov.AsyncSuffix.Analyzer
{
[ConfigurableSeverityHighlighting(SeverityId, CSharpLanguage.Name, OverlapResolve = OverlapResolveKind.WARNING)]
public sealed class ConsiderUsingAsyncSuffixHighlighting : IHighlighting
{
public IMethodDeclaration MethodDeclaration { get; private set; }
public const string SeverityId = "ConsiderUsingAsyncSuffix";
public ConsiderUsingAsyncSuffixHighlighting(IMethodDeclaration methodDeclaration)
{
MethodDeclaration = methodDeclaration;
}
public DocumentRange CalculateRange() => MethodDeclaration.NameIdentifier.GetDocumentRange();
public string ToolTip => "Async method name does not have 'Async' suffix";
public string ErrorStripeToolTip => ToolTip;
public int NavigationOffsetPatch => 0;
public bool IsValid() => MethodDeclaration == null || MethodDeclaration.IsValid();
}
}
|
mit
|
C#
|
49a3d78cff372a2d0c6460173b78fbd76a38bd5a
|
Add more attributes to Notification object
|
ucdavis/Badges,ucdavis/Badges
|
Badges.Core/Domain/Notification.cs
|
Badges.Core/Domain/Notification.cs
|
using System;
using FluentNHibernate.Mapping;
namespace Badges.Core.Domain
{
public class Notification : DomainObjectGuid
{
public virtual User To { get; set; }
public virtual User From { get; set; }
public virtual bool Pending { get; set; }
public virtual DateTime Created { get; set; }
public virtual string Message { get; set; }
public virtual string Title { get; set; }
public virtual string ActionURL { get; set; }
}
public class NotificationMap : ClassMap<Notification>
{
public NotificationMap()
{
Id(x => x.Id).GeneratedBy.GuidComb();
Map(x => x.Pending).Not.Nullable();
Map(x => x.Created).Not.Nullable();
Map(x => x.Message).StringMaxLength();
Map(x => x.Title).StringMaxLength();
References(x => x.To).Not.Nullable();
References(x => x.From).Not.Nullable();
Map(x => x.ActionURL).Nullable();
}
}
}
|
using System;
using FluentNHibernate.Mapping;
namespace Badges.Core.Domain
{
public class Notification : DomainObjectGuid
{
public virtual User To { get; set; }
public virtual bool Pending { get; set; }
public virtual DateTime Created { get; set; }
public virtual string Message { get; set; }
public virtual string Title { get; set; }
}
public class NotificationMap : ClassMap<Notification>
{
public NotificationMap()
{
Id(x => x.Id).GeneratedBy.GuidComb();
Map(x => x.Pending).Not.Nullable();
Map(x => x.Created).Not.Nullable();
Map(x => x.Message).StringMaxLength();
Map(x => x.Title).StringMaxLength();
References(x => x.To).Not.Nullable();
}
}
}
|
mpl-2.0
|
C#
|
d460acd2e2a8c8e3ae354ae119b3b0a9481fe1d6
|
Clean up.
|
affecto/dotnet-Patterns.Domain
|
Source/Domain/DomainEvent.cs
|
Source/Domain/DomainEvent.cs
|
using System;
namespace Affecto.Patterns.Domain
{
/// <summary>
/// Base class for implementing domain events that represent changes in a domain entity.
/// </summary>
public abstract class DomainEvent : IDomainEvent
{
/// <summary>
/// Gets the entity id.
/// </summary>
public Guid EntityId { get; }
/// <summary>
/// Gets the entity version.
/// </summary>
public long EntityVersion { get; internal set; }
/// <summary>
/// Initializes a new instance of the <see cref="DomainEvent"/> class.
/// </summary>
/// <param name="entityId">Entity instance id.</param>
/// <param name="entityVersion">Entity instance version.</param>
protected DomainEvent(Guid entityId, long entityVersion)
{
if (entityId == default)
{
throw new ArgumentException("Entity id must be defined.", nameof(entityId));
}
EntityId = entityId;
EntityVersion = entityVersion;
}
/// <summary>
/// Initializes a new instance of the <see cref="DomainEvent"/> class.
/// </summary>
/// <param name="entityId">Entity instance id.</param>
protected DomainEvent(Guid entityId)
: this(entityId, 0)
{
}
}
}
|
using System;
namespace Affecto.Patterns.Domain
{
/// <summary>
/// Base class for implementing domain events that represent changes in a domain entity.
/// </summary>
public abstract class DomainEvent : IDomainEvent
{
/// <summary>
/// Gets the entity id.
/// </summary>
public Guid EntityId { get; }
/// <summary>
/// Gets the entity version.
/// </summary>
public long EntityVersion { get; internal set; }
/// <summary>
/// Initializes a new instance of the <see cref="DomainEvent"/> class.
/// </summary>
/// <param name="entityId">Entity instance id.</param>
/// <param name="entityVersion">Entity instance version.</param>
protected DomainEvent(Guid entityId, long entityVersion)
{
if (entityId.Equals(Guid.Empty))
{
throw new ArgumentException("Entity id must be defined.", nameof(entityId));
}
EntityId = entityId;
EntityVersion = entityVersion;
}
/// <summary>
/// Initializes a new instance of the <see cref="DomainEvent"/> class.
/// </summary>
/// <param name="entityId">Entity instance id.</param>
protected DomainEvent(Guid entityId)
: this(entityId, 0)
{
}
}
}
|
mit
|
C#
|
ee09b25590d623bc0f7de3d98caa2a44e8440531
|
Update GTFSRequiredFileMissingException.cs
|
itinero/GTFS,OsmSharp/GTFS,rsaat/GTFS
|
GTFS/Exceptions/GTFSRequiredFileMissingException.cs
|
GTFS/Exceptions/GTFSRequiredFileMissingException.cs
|
// The MIT License (MIT)
// Copyright (c) 2014 Ben Abelshausen
// 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;
namespace GTFS.Exceptions
{
/// <summary>
/// Exception thrown when a required file was not found.
/// </summary>
public class GTFSRequiredFileMissingException : Exception
{
/// <summary>
/// Creates a missing file exception.
/// </summary>
/// <param name="name"></param>
public GTFSRequiredFileMissingException(string name)
: base(string.Format("Could not find required file {0}.", name))
{
this.Name = name;
}
/// <summary>
/// Returns the name of the file.
/// </summary>
public string Name { get; private set; }
}
}
|
// The MIT License (MIT)
// Copyright (c) 2014 Ben Abelshausen
// 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;
namespace GTFS.Exceptions
{
/// <summary>
/// Exception thrown when a required file was not found.
/// </summary>
public class GTFSRequiredFileMissingException : Exception
{
/// <summary>
/// Creates a parsing exception.
/// </summary>
/// <param name="name"></param>
public GTFSRequiredFileMissingException(string name)
: base(string.Format("Could not find required file {0}.", name))
{
this.Name = name;
}
/// <summary>
/// Returns the name of the file.
/// </summary>
public string Name { get; private set; }
}
}
|
mit
|
C#
|
c08c1d8c6d8f5f0a2819b6b80c6e0d6bee537076
|
fix compilation issues (#1290)
|
robkeim/xcsharp,robkeim/xcsharp,exercism/xcsharp,exercism/xcsharp
|
exercises/two-fer/TwoFer.cs
|
exercises/two-fer/TwoFer.cs
|
using System;
public static class TwoFer
{
// In order to get the tests running, first you need to make sure the Speak method
// can be called both without any arguments and also by passing one string argument.
public static string Speak()
{
throw new NotImplementedException("You need to implement this function.");
}
}
|
public static class TwoFer
{
public static string Speak()
{
throw new NotImplementedException("You need to implement this function.");
}
}
|
mit
|
C#
|
e8346691791de683e4aa21dfe9873cee6f742538
|
test unit change
|
ravjotsingh9/StockTradingApplication
|
ClientServer/Stock.UnitTest/UsersTest1.cs
|
ClientServer/Stock.UnitTest/UsersTest1.cs
|
using System;
using Server;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTest
{
[TestClass]
public class UsersTest1
{
[TestMethod]
public void AddTestMethod()
{
Users test = new Users();
test.addUser("hello");
Console.WriteLine("User:hello's balance: {0}", test.UserDictionary["hello"]);
test.modifyCash("hello", 100, true);
Console.WriteLine("User:hello's balance: {0}", test.UserDictionary["hello"]);
}
}
}
|
using System;
using Server;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTest
{
[TestClass]
public class UsersTest1
{
[TestMethod]
public void AddTestMethod()
{
Users test = new Users();
test.addUser("hello");
Console.WriteLine("User:hello's balance: {0}", test.UserDictionary["hello"].cashBalance);
test.modifyCash("hello", 100, true);
Console.WriteLine("User:hello's balance: {0}", test.UserDictionary["hello"].cashBalance);
}
}
}
|
apache-2.0
|
C#
|
9f0296126adda6d31fef4351cd5dd3da1064eb7b
|
Update RyanYates.cs
|
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
|
src/Firehose.Web/Authors/RyanYates.cs
|
src/Firehose.Web/Authors/RyanYates.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class RyanYatesMVP :IAmAMicrosoftMVP
{
public string FirstName => "Ryan";
public string LastName => "Yates";
public string ShortBioOrTagLine => "is a Microsoft MVP, Consultant at Black Marble, Lead Coordinator for UK PowerShell User Groups.";
public string StateOrRegion => "England, UK";
public string EmailAddress => "ryan.yates@kilasuit.org";
public string TwitterHandle => "ryanyates1990";
public string GravatarHash => "3dfa95e0c1d6efa49d57dfd89010d0a7";
public GeoPosition Position => new GeoPosition(53.690760, -1.629070);
public Uri WebSite => new Uri("https://blog.kilasuit.org/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://blog.kilasuit.org/index.xml"); }
}
public string GitHubHandle => "kilasuit";
public string FeedLanguageCode => "en";
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class RyanYatesMVP : IFilterMyBlogPosts, IAmAMicrosoftMVP
{
public string FirstName => "Ryan";
public string LastName => "Yates";
public string ShortBioOrTagLine => "is a Microsoft MVP, Consultant at Black Marble, Lead Coordinator for UK PowerShell User Groups.";
public string StateOrRegion => "England, UK";
public string EmailAddress => "ryan.yates@kilasuit.org";
public string TwitterHandle => "ryanyates1990";
public string GravatarHash => "3dfa95e0c1d6efa49d57dfd89010d0a7";
public GeoPosition Position => new GeoPosition(53.690760, -1.629070);
public Uri WebSite => new Uri("https://blog.kilasuit.org/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://blog.kilasuit.org/index.xml"); }
}
public string GitHubHandle => "kilasuit";
public string FeedLanguageCode => "en";
}
}
|
mit
|
C#
|
cfb68ff100f263b7951ae03f5bf498f0702d373a
|
Throw exception when the page count could not be determined.
|
dlemstra/Magick.NET,dlemstra/Magick.NET
|
src/Magick.NET/Formats/Pdf/PdfInfo.cs
|
src/Magick.NET/Formats/Pdf/PdfInfo.cs
|
// Copyright 2013-2021 Dirk Lemstra <https://github.com/dlemstra/Magick.NET/>
//
// Licensed under the ImageMagick License (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
//
// https://www.imagemagick.org/script/license.php
//
// 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.IO;
namespace ImageMagick.Formats.Pdf
{
/// <summary>
/// The info of a <see cref="MagickFormat.Pdf"/> file.
/// </summary>
public sealed partial class PdfInfo
{
private PdfInfo(int pageCount)
{
PageCount = pageCount;
}
/// <summary>
/// Gets the page count of the file.
/// </summary>
public int PageCount { get; }
/// <summary>
/// Creates info from a <see cref="MagickFormat.Pdf"/> file.
/// </summary>
/// <param name="file">The pdf file to create the info from.</param>
/// <returns>The info of a <see cref="MagickFormat.Pdf"/> file.</returns>
public static PdfInfo Create(FileInfo file)
{
Throw.IfNull(nameof(file), file);
return Create(file.FullName);
}
/// <summary>
/// Creates info from a <see cref="MagickFormat.Pdf"/> file.
/// </summary>
/// <param name="fileName">The pdf file to create the info from.</param>
/// <returns>The info of a <see cref="MagickFormat.Pdf"/> file.</returns>
public static PdfInfo Create(string fileName)
{
var filePath = FileHelper.CheckForBaseDirectory(fileName);
Throw.IfNullOrEmpty(nameof(fileName), filePath);
filePath = filePath.Replace('\\', '/');
var nativePdfInfo = new NativePdfInfo();
var pageCount = nativePdfInfo.PageCount(filePath);
if (pageCount == 0)
throw new MagickErrorException("Unable to determine the page count.");
return new PdfInfo(pageCount);
}
}
}
|
// Copyright 2013-2021 Dirk Lemstra <https://github.com/dlemstra/Magick.NET/>
//
// Licensed under the ImageMagick License (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
//
// https://www.imagemagick.org/script/license.php
//
// 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.IO;
namespace ImageMagick.Formats.Pdf
{
/// <summary>
/// The info of a <see cref="MagickFormat.Pdf"/> file.
/// </summary>
public sealed partial class PdfInfo
{
private PdfInfo(int pageCount)
{
PageCount = pageCount;
}
/// <summary>
/// Gets the page count of the file.
/// </summary>
public int PageCount { get; }
/// <summary>
/// Creates info from a <see cref="MagickFormat.Pdf"/> file.
/// </summary>
/// <param name="file">The pdf file to create the info from.</param>
/// <returns>The info of a <see cref="MagickFormat.Pdf"/> file.</returns>
public static PdfInfo Create(FileInfo file)
{
Throw.IfNull(nameof(file), file);
return Create(file.FullName);
}
/// <summary>
/// Creates info from a <see cref="MagickFormat.Pdf"/> file.
/// </summary>
/// <param name="fileName">The pdf file to create the info from.</param>
/// <returns>The info of a <see cref="MagickFormat.Pdf"/> file.</returns>
public static PdfInfo Create(string fileName)
{
var filePath = FileHelper.CheckForBaseDirectory(fileName);
Throw.IfNullOrEmpty(nameof(fileName), filePath);
filePath = filePath.Replace('\\', '/');
var nativePdfInfo = new NativePdfInfo();
var pageCount = nativePdfInfo.PageCount(filePath);
return new PdfInfo(pageCount);
}
}
}
|
apache-2.0
|
C#
|
ad85cd64624756bf02bd9bc582b4a5adfee5cce9
|
Use correct path to MSBuild Roslyn folder on Mono
|
OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn
|
src/OmniSharp.Host/MSBuild/Discovery/Providers/MonoInstanceProvider.cs
|
src/OmniSharp.Host/MSBuild/Discovery/Providers/MonoInstanceProvider.cs
|
using System;
using System.Collections.Immutable;
using System.IO;
using Microsoft.Extensions.Logging;
using OmniSharp.Utilities;
namespace OmniSharp.MSBuild.Discovery.Providers
{
internal class MonoInstanceProvider : MSBuildInstanceProvider
{
public MonoInstanceProvider(ILoggerFactory loggerFactory)
: base(loggerFactory)
{
}
public override ImmutableArray<MSBuildInstance> GetInstances()
{
if (!PlatformHelper.IsMono)
{
return ImmutableArray<MSBuildInstance>.Empty;
}
var path = PlatformHelper.GetMonoMSBuildDirPath();
if (path == null)
{
return ImmutableArray<MSBuildInstance>.Empty;
}
var toolsPath = Path.Combine(path, "15.0", "bin");
if (!Directory.Exists(toolsPath))
{
return ImmutableArray<MSBuildInstance>.Empty;
}
var propertyOverrides = ImmutableDictionary.CreateBuilder<string, string>(StringComparer.OrdinalIgnoreCase);
var localMSBuildPath = FindLocalMSBuildDirectory();
if (localMSBuildPath != null)
{
var localRoslynPath = Path.Combine(localMSBuildPath, "15.0", "Bin", "Roslyn");
propertyOverrides.Add("CscToolPath", localRoslynPath);
propertyOverrides.Add("CscToolExe", "csc.exe");
}
return ImmutableArray.Create(
new MSBuildInstance(
"Mono",
toolsPath,
new Version(15, 0),
DiscoveryType.Mono,
propertyOverrides.ToImmutable()));
}
}
}
|
using System;
using System.Collections.Immutable;
using System.IO;
using Microsoft.Extensions.Logging;
using OmniSharp.Utilities;
namespace OmniSharp.MSBuild.Discovery.Providers
{
internal class MonoInstanceProvider : MSBuildInstanceProvider
{
public MonoInstanceProvider(ILoggerFactory loggerFactory)
: base(loggerFactory)
{
}
public override ImmutableArray<MSBuildInstance> GetInstances()
{
if (!PlatformHelper.IsMono)
{
return ImmutableArray<MSBuildInstance>.Empty;
}
var path = PlatformHelper.GetMonoMSBuildDirPath();
if (path == null)
{
return ImmutableArray<MSBuildInstance>.Empty;
}
var toolsPath = Path.Combine(path, "15.0", "bin");
if (!Directory.Exists(toolsPath))
{
return ImmutableArray<MSBuildInstance>.Empty;
}
var propertyOverrides = ImmutableDictionary.CreateBuilder<string, string>(StringComparer.OrdinalIgnoreCase);
var localMSBuildPath = FindLocalMSBuildDirectory();
if (localMSBuildPath != null)
{
var localRoslynPath = Path.Combine(localMSBuildPath, "Roslyn");
propertyOverrides.Add("CscToolPath", localRoslynPath);
propertyOverrides.Add("CscToolExe", "csc.exe");
}
return ImmutableArray.Create(
new MSBuildInstance(
"Mono",
toolsPath,
new Version(15, 0),
DiscoveryType.Mono,
propertyOverrides.ToImmutable()));
}
}
}
|
mit
|
C#
|
7c43bfb1027bc3c79e75cd47a15eba7ab5fe2ce9
|
fix #690 - Exception when there are no trending topics for a place
|
linvi/tweetinvi,linvi/tweetinvi,linvi/tweetinvi,linvi/tweetinvi
|
Tweetinvi.Controllers/Trends/TrendsQueryExecutor.cs
|
Tweetinvi.Controllers/Trends/TrendsQueryExecutor.cs
|
using System.Collections.Generic;
using Tweetinvi.Core.Web;
using Tweetinvi.Models;
namespace Tweetinvi.Controllers.Trends
{
public interface ITrendsQueryExecutor
{
IPlaceTrends GetPlaceTrendsAt(long woeid);
IPlaceTrends GetPlaceTrendsAt(IWoeIdLocation woeIdLocation);
IEnumerable<ITrendLocation> GetAvailableTrendLocations();
IEnumerable<ITrendLocation> GetClosestTrendLocations(ICoordinates coordinates);
}
public class TrendsQueryExecutor : ITrendsQueryExecutor
{
private readonly ITrendsQueryGenerator _trendsQueryGenerator;
private readonly ITwitterAccessor _twitterAccessor;
public TrendsQueryExecutor(
ITrendsQueryGenerator trendsQueryGenerator,
ITwitterAccessor twitterAccessor)
{
_trendsQueryGenerator = trendsQueryGenerator;
_twitterAccessor = twitterAccessor;
}
public IPlaceTrends GetPlaceTrendsAt(long woeid)
{
string query = _trendsQueryGenerator.GetPlaceTrendsAtQuery(woeid);
return _twitterAccessor.ExecuteGETQuery<IPlaceTrends[]>(query)?[0];
}
public IPlaceTrends GetPlaceTrendsAt(IWoeIdLocation woeIdLocation)
{
string query = _trendsQueryGenerator.GetPlaceTrendsAtQuery(woeIdLocation);
return _twitterAccessor.ExecuteGETQuery<IPlaceTrends[]>(query)?[0];
}
public IEnumerable<ITrendLocation> GetAvailableTrendLocations()
{
var query = _trendsQueryGenerator.GetAvailableTrendLocationsQuery();
return _twitterAccessor.ExecuteGETQuery<ITrendLocation[]>(query);
}
public IEnumerable<ITrendLocation> GetClosestTrendLocations(ICoordinates coordinates)
{
var query = _trendsQueryGenerator.GetClosestTrendLocationsQuery(coordinates);
return _twitterAccessor.ExecuteGETQuery<ITrendLocation[]>(query);
}
}
}
|
using System.Collections.Generic;
using Tweetinvi.Core.Web;
using Tweetinvi.Models;
namespace Tweetinvi.Controllers.Trends
{
public interface ITrendsQueryExecutor
{
IPlaceTrends GetPlaceTrendsAt(long woeid);
IPlaceTrends GetPlaceTrendsAt(IWoeIdLocation woeIdLocation);
IEnumerable<ITrendLocation> GetAvailableTrendLocations();
IEnumerable<ITrendLocation> GetClosestTrendLocations(ICoordinates coordinates);
}
public class TrendsQueryExecutor : ITrendsQueryExecutor
{
private readonly ITrendsQueryGenerator _trendsQueryGenerator;
private readonly ITwitterAccessor _twitterAccessor;
public TrendsQueryExecutor(
ITrendsQueryGenerator trendsQueryGenerator,
ITwitterAccessor twitterAccessor)
{
_trendsQueryGenerator = trendsQueryGenerator;
_twitterAccessor = twitterAccessor;
}
public IPlaceTrends GetPlaceTrendsAt(long woeid)
{
string query = _trendsQueryGenerator.GetPlaceTrendsAtQuery(woeid);
return _twitterAccessor.ExecuteGETQuery<IPlaceTrends[]>(query)[0];
}
public IPlaceTrends GetPlaceTrendsAt(IWoeIdLocation woeIdLocation)
{
string query = _trendsQueryGenerator.GetPlaceTrendsAtQuery(woeIdLocation);
return _twitterAccessor.ExecuteGETQuery<IPlaceTrends[]>(query)[0];
}
public IEnumerable<ITrendLocation> GetAvailableTrendLocations()
{
var query = _trendsQueryGenerator.GetAvailableTrendLocationsQuery();
return _twitterAccessor.ExecuteGETQuery<ITrendLocation[]>(query);
}
public IEnumerable<ITrendLocation> GetClosestTrendLocations(ICoordinates coordinates)
{
var query = _trendsQueryGenerator.GetClosestTrendLocationsQuery(coordinates);
return _twitterAccessor.ExecuteGETQuery<ITrendLocation[]>(query);
}
}
}
|
mit
|
C#
|
74f6974b12593afa862b3d69733db93562c81e59
|
Move properties
|
jcouv/roslyn,dotnet/roslyn,ErikSchierboom/roslyn,shyamnamboodiripad/roslyn,abock/roslyn,genlu/roslyn,jcouv/roslyn,physhi/roslyn,dpoeschl/roslyn,jmarolf/roslyn,reaction1989/roslyn,mgoertz-msft/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,gafter/roslyn,AmadeusW/roslyn,physhi/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,genlu/roslyn,dotnet/roslyn,sharwell/roslyn,tannergooding/roslyn,ErikSchierboom/roslyn,jcouv/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,sharwell/roslyn,xasx/roslyn,wvdd007/roslyn,mgoertz-msft/roslyn,CyrusNajmabadi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,jmarolf/roslyn,agocke/roslyn,KevinRansom/roslyn,diryboy/roslyn,gafter/roslyn,mavasani/roslyn,ErikSchierboom/roslyn,swaroop-sridhar/roslyn,aelij/roslyn,davkean/roslyn,KirillOsenkov/roslyn,gafter/roslyn,dpoeschl/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,KevinRansom/roslyn,stephentoub/roslyn,eriawan/roslyn,weltkante/roslyn,sharwell/roslyn,AlekseyTs/roslyn,diryboy/roslyn,agocke/roslyn,shyamnamboodiripad/roslyn,stephentoub/roslyn,brettfo/roslyn,weltkante/roslyn,nguerrera/roslyn,davkean/roslyn,KevinRansom/roslyn,abock/roslyn,tannergooding/roslyn,mavasani/roslyn,reaction1989/roslyn,davkean/roslyn,MichalStrehovsky/roslyn,abock/roslyn,VSadov/roslyn,wvdd007/roslyn,reaction1989/roslyn,agocke/roslyn,CyrusNajmabadi/roslyn,MichalStrehovsky/roslyn,bartdesmet/roslyn,physhi/roslyn,jasonmalinowski/roslyn,eriawan/roslyn,weltkante/roslyn,xasx/roslyn,wvdd007/roslyn,KirillOsenkov/roslyn,AmadeusW/roslyn,MichalStrehovsky/roslyn,DustinCampbell/roslyn,aelij/roslyn,swaroop-sridhar/roslyn,tannergooding/roslyn,jasonmalinowski/roslyn,DustinCampbell/roslyn,mavasani/roslyn,VSadov/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,nguerrera/roslyn,dotnet/roslyn,tmat/roslyn,tmat/roslyn,AlekseyTs/roslyn,genlu/roslyn,AlekseyTs/roslyn,dpoeschl/roslyn,brettfo/roslyn,swaroop-sridhar/roslyn,aelij/roslyn,VSadov/roslyn,brettfo/roslyn,bartdesmet/roslyn,heejaechang/roslyn,nguerrera/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,heejaechang/roslyn,heejaechang/roslyn,xasx/roslyn,diryboy/roslyn,eriawan/roslyn,DustinCampbell/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,tmat/roslyn
|
src/Workspaces/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexEmbeddedLanguage.cs
|
src/Workspaces/Core/Portable/EmbeddedLanguages/RegularExpressions/LanguageServices/RegexEmbeddedLanguage.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 Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices;
using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars;
using Microsoft.CodeAnalysis.LanguageServices;
namespace Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions.LanguageServices
{
internal sealed class RegexEmbeddedLanguage : IEmbeddedLanguage
{
public int StringLiteralKind { get; }
public ISyntaxFactsService SyntaxFacts { get; }
public ISemanticFactsService SemanticFacts { get; }
public IVirtualCharService VirtualCharService { get; }
public IEmbeddedBraceMatcher BraceMatcher { get; }
public IEmbeddedClassifier Classifier { get; }
public IEmbeddedHighlighter Highlighter { get; }
public IEmbeddedDiagnosticAnalyzer DiagnosticAnalyzer { get; }
public IEmbeddedCodeFixProvider CodeFixProvider { get; }
public RegexEmbeddedLanguage(
int stringLiteralKind,
ISyntaxFactsService syntaxFacts,
ISemanticFactsService semanticFacts,
IVirtualCharService virtualCharService)
{
StringLiteralKind = stringLiteralKind;
SyntaxFacts = syntaxFacts;
SemanticFacts = semanticFacts;
VirtualCharService = virtualCharService;
BraceMatcher = new RegexEmbeddedBraceMatcher(this);
Classifier = new RegexEmbeddedClassifier(this);
Highlighter = new RegexEmbeddedHighlighter(this);
DiagnosticAnalyzer = new RegexDiagnosticAnalyzer(this);
}
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices;
using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars;
using Microsoft.CodeAnalysis.LanguageServices;
namespace Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions.LanguageServices
{
internal sealed class RegexEmbeddedLanguage : IEmbeddedLanguage
{
public int StringLiteralKind { get; }
public ISyntaxFactsService SyntaxFacts { get; }
public ISemanticFactsService SemanticFacts { get; }
public IVirtualCharService VirtualCharService { get; }
public RegexEmbeddedLanguage(
int stringLiteralKind,
ISyntaxFactsService syntaxFacts,
ISemanticFactsService semanticFacts,
IVirtualCharService virtualCharService)
{
StringLiteralKind = stringLiteralKind;
SyntaxFacts = syntaxFacts;
SemanticFacts = semanticFacts;
VirtualCharService = virtualCharService;
BraceMatcher = new RegexEmbeddedBraceMatcher(this);
Classifier = new RegexEmbeddedClassifier(this);
Highlighter = new RegexEmbeddedHighlighter(this);
DiagnosticAnalyzer = new RegexDiagnosticAnalyzer(this);
}
public IEmbeddedBraceMatcher BraceMatcher { get; }
public IEmbeddedClassifier Classifier { get; }
public IEmbeddedHighlighter Highlighter { get; }
public IEmbeddedDiagnosticAnalyzer DiagnosticAnalyzer { get; }
public IEmbeddedCodeFixProvider CodeFixProvider { get; }
}
}
|
mit
|
C#
|
f6c2ee9b649b125c68ac8250119176fcbe18e2d8
|
remove unused directive
|
StefanoFiumara/Harry-Potter-Unity
|
Assets/Scripts/HarryPotterUnity/Cards/Spells/DirectDamageSpell.cs
|
Assets/Scripts/HarryPotterUnity/Cards/Spells/DirectDamageSpell.cs
|
using JetBrains.Annotations;
using UnityEngine;
namespace HarryPotterUnity.Cards.Spells
{
public class DirectDamageSpell : GenericSpell {
[UsedImplicitly, SerializeField]
private int _damageAmount;
protected override void OnPlayAction()
{
Player.OppositePlayer.TakeDamage(_damageAmount);
}
}
}
|
using System.Collections.Generic;
using JetBrains.Annotations;
using UnityEngine;
namespace HarryPotterUnity.Cards.Spells
{
public class DirectDamageSpell : GenericSpell {
[UsedImplicitly, SerializeField]
private int _damageAmount;
protected override void OnPlayAction()
{
Player.OppositePlayer.TakeDamage(_damageAmount);
}
}
}
|
mit
|
C#
|
6faa4e256be27e85f0824e1fe8be73b65870255a
|
Fix consistency check in RigidBoneSystemPerformanceDemo
|
virtuallynaked/virtually-naked,virtuallynaked/virtually-naked
|
Demos/src/demos/figure/skeleton/RigidBoneSystemPerformanceDemo.cs
|
Demos/src/demos/figure/skeleton/RigidBoneSystemPerformanceDemo.cs
|
using SharpDX;
using System;
using System.Collections.Generic;
using System.Diagnostics;
public class RigidBoneSystemPerformanceDemo : IDemoApp {
private ChannelSystem channelSystem;
private BoneSystem boneSystem;
private RigidBoneSystem rigidBoneSystem;
private ChannelInputs channelInputs;
public RigidBoneSystemPerformanceDemo() {
var figureDir = UnpackedArchiveDirectory.Make(new System.IO.DirectoryInfo("work/figures/genesis-3-female"));
var channelSystemRecipe = Persistance.Load<ChannelSystemRecipe>(figureDir.File("channel-system-recipe.dat"));
channelSystem = channelSystemRecipe.Bake(null);
var boneSystemRecipe = Persistance.Load<BoneSystemRecipe>(figureDir.File("bone-system-recipe.dat"));
boneSystem = boneSystemRecipe.Bake(channelSystem.ChannelsByName);
var pose = Persistance.Load<List<Pose>>(figureDir.File("animations/idle.dat"))[0];
channelInputs = channelSystem.MakeDefaultChannelInputs();
new Poser(channelSystem, boneSystem).Apply(channelInputs, pose, DualQuaternion.Identity);
rigidBoneSystem = new RigidBoneSystem(boneSystem);
}
private void CheckConsistency(ChannelOutputs channelOutputs) {
var inputs = rigidBoneSystem.ReadInputs(channelOutputs);
var boneTransformsA = boneSystem.GetBoneTransforms(channelOutputs);
var boneTransformsB = rigidBoneSystem.GetBoneTransforms(inputs);
for (int i = 0; i < boneSystem.Bones.Count; ++i) {
var boneTransformA = boneTransformsA[i];
var boneTransformB = boneTransformsB[i];
var unposedCenterA = boneSystem.Bones[i].CenterPoint.GetValue(channelOutputs);
var unposedCenterB = rigidBoneSystem.Bones[i].CenterPoint;
foreach (var testVector in new Vector3[] { Vector3.Zero, Vector3.Right, Vector3.Up, Vector3.BackwardRH }) {
var transformedVectorA = boneTransformA.Transform(unposedCenterA + testVector);
var transformedVectorB = boneTransformB.Transform(
unposedCenterB + boneTransformA.ScalingStage.Transform(testVector));
float distance = Vector3.Distance(transformedVectorA, transformedVectorB);
if (distance > 1e-3) {
throw new Exception("rigid and non-rigid bone transforms are inconsistent");
}
}
}
}
public void Run() {
var channelOutputs = channelSystem.Evaluate(null, channelInputs);
rigidBoneSystem.Synchronize(channelOutputs);
var inputs = rigidBoneSystem.ReadInputs(channelOutputs);
CheckConsistency(channelOutputs);
var stopwatch = Stopwatch.StartNew();
int trialCount = 0;
while (true) {
rigidBoneSystem.GetBoneTransforms(inputs);
trialCount += 1;
if (trialCount == 1000) {
Console.WriteLine(stopwatch.Elapsed.TotalMilliseconds / trialCount);
trialCount = 0;
stopwatch.Restart();
}
}
}
}
|
using SharpDX;
using System;
using System.Collections.Generic;
using System.Diagnostics;
public class RigidBoneSystemPerformanceDemo : IDemoApp {
private ChannelSystem channelSystem;
private BoneSystem boneSystem;
private RigidBoneSystem rigidBoneSystem;
private ChannelInputs channelInputs;
public RigidBoneSystemPerformanceDemo() {
var figureDir = UnpackedArchiveDirectory.Make(new System.IO.DirectoryInfo("work/figures/genesis-3-female"));
var channelSystemRecipe = Persistance.Load<ChannelSystemRecipe>(figureDir.File("channel-system-recipe.dat"));
channelSystem = channelSystemRecipe.Bake(null);
var boneSystemRecipe = Persistance.Load<BoneSystemRecipe>(figureDir.File("bone-system-recipe.dat"));
boneSystem = boneSystemRecipe.Bake(channelSystem.ChannelsByName);
var pose = Persistance.Load<List<Pose>>(figureDir.File("animations/idle.dat"))[0];
channelInputs = channelSystem.MakeDefaultChannelInputs();
new Poser(channelSystem, boneSystem).Apply(channelInputs, pose, DualQuaternion.Identity);
rigidBoneSystem = new RigidBoneSystem(boneSystem);
}
private void CheckConsistency(ChannelOutputs channelOutputs) {
var inputs = rigidBoneSystem.ReadInputs(channelOutputs);
var boneTransformsA = boneSystem.GetBoneTransforms(channelOutputs);
var boneTransformsB = rigidBoneSystem.GetBoneTransforms(inputs);
for (int i = 0; i < boneSystem.Bones.Count; ++i) {
var boneTransformA = boneTransformsA[i];
var boneTransformB = boneTransformsB[i];
foreach (var testVector in new Vector3[] { Vector3.Zero, Vector3.Right, Vector3.Up, Vector3.BackwardRH }) {
var transformedVectorA = boneTransformA.Transform(testVector);
var transformedVectorB = boneTransformB.Transform(testVector);
float distance = Vector3.Distance(transformedVectorA, transformedVectorB);
if (distance > 1e-5) {
throw new Exception("rigid and non-rigid bone transforms are inconsistent");
}
}
}
}
public void Run() {
var channelOutputs = channelSystem.Evaluate(null, channelInputs);
rigidBoneSystem.Synchronize(channelOutputs);
var inputs = rigidBoneSystem.ReadInputs(channelOutputs);
CheckConsistency(channelOutputs);
var stopwatch = Stopwatch.StartNew();
int trialCount = 0;
while (true) {
rigidBoneSystem.GetBoneTransforms(inputs);
trialCount += 1;
if (trialCount == 1000) {
Console.WriteLine(stopwatch.Elapsed.TotalMilliseconds / trialCount);
trialCount = 0;
stopwatch.Restart();
}
}
}
}
|
mit
|
C#
|
1c7dde06474edb028de8def5b2905a9ccc02d85d
|
Add missing Async name to GetTopGames
|
Aux/NTwitch,Aux/NTwitch
|
src/NTwitch.Core/ITwitchClient.cs
|
src/NTwitch.Core/ITwitchClient.cs
|
using System.Collections.Generic;
using System.Threading.Tasks;
namespace NTwitch
{
public interface ITwitchClient
{
ConnectionState ConnectionState { get; }
Task<IChannel> GetChannelAsync(ulong id);
Task<IEnumerable<ITopGame>> GetTopGamesAsync(TwitchPageOptions options = null);
Task<IEnumerable<IIngest>> GetIngestsAsync();
Task<IEnumerable<IChannel>> FindChannelsAsync(string query, TwitchPageOptions options = null);
Task<IEnumerable<IGame>> FindGamesAsync(string query, bool islive = true);
Task<IStream> GetStreamAsync(ulong id, StreamType type = StreamType.All);
Task<IEnumerable<IStream>> FindStreamsAsync(string query, bool hls = true, TwitchPageOptions options = null);
Task<IEnumerable<IStream>> GetStreamsAsync(string game = null, ulong[] channelids = null, string language = null, StreamType type = StreamType.All, TwitchPageOptions options = null);
Task<IEnumerable<IFeaturedStream>> GetFeaturedStreamsAsync(TwitchPageOptions options = null);
Task<IEnumerable<IStreamSummary>> GetStreamSummaryAsync(string game);
Task<IEnumerable<ITeamInfo>> GetTeamsAsync(TwitchPageOptions options = null);
Task<IEnumerable<ITeam>> GetTeamAsync(string name);
Task<IUser> GetUserAsync(ulong id);
}
}
|
using System.Collections.Generic;
using System.Threading.Tasks;
namespace NTwitch
{
public interface ITwitchClient
{
ConnectionState ConnectionState { get; }
Task<IChannel> GetChannelAsync(ulong id);
Task<IEnumerable<ITopGame>> GetTopGames(TwitchPageOptions options = null);
Task<IEnumerable<IIngest>> GetIngestsAsync();
Task<IEnumerable<IChannel>> FindChannelsAsync(string query, TwitchPageOptions options = null);
Task<IEnumerable<IGame>> FindGamesAsync(string query, bool islive = true);
Task<IStream> GetStreamAsync(ulong id, StreamType type = StreamType.All);
Task<IEnumerable<IStream>> FindStreamsAsync(string query, bool hls = true, TwitchPageOptions options = null);
Task<IEnumerable<IStream>> GetStreamsAsync(string game = null, ulong[] channelids = null, string language = null, StreamType type = StreamType.All, TwitchPageOptions options = null);
Task<IEnumerable<IFeaturedStream>> GetFeaturedStreamsAsync(TwitchPageOptions options = null);
Task<IEnumerable<IStreamSummary>> GetStreamSummaryAsync(string game);
Task<IEnumerable<ITeamInfo>> GetTeamsAsync(TwitchPageOptions options = null);
Task<IEnumerable<ITeam>> GetTeamAsync(string name);
Task<IUser> GetUserAsync(ulong id);
}
}
|
mit
|
C#
|
ae42de56c32df4ce8f5f790d1559e0ba459d171e
|
Update SearchInclusion.cs
|
smartsheet-platform/smartsheet-csharp-sdk,smartsheet-platform/smartsheet-csharp-sdk
|
main/Smartsheet/Api/Models/Inclusions/SearchInclusion.cs
|
main/Smartsheet/Api/Models/Inclusions/SearchInclusion.cs
|
// #[license]
// SmartsheetClient SDK for C#
// %%
// Copyright (C) 2014 SmartsheetClient
// %%
// 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.
// %[license]
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;
namespace Smartsheet.Api.Models.Inclusions
{
public enum SearchInclusion
{
[EnumMember(Value = "favoriteFlag")]
FAVORITE_FLAG
}
}
|
// #[license]
// SmartsheetClient SDK for C#
// %%
// Copyright (C) 2014 SmartsheetClient
// %%
// 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.
// %[license]
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;
namespace Smartsheet.Api.Models.Inclusions
{
public enum SearchInclusion
{
[EnumMember(Value = "favoriteFlag")]
FAVORITE_FLAG
}
}
|
apache-2.0
|
C#
|
aca208104d2013e4c3c7fd56c8f169080fbb4ea1
|
Delete unnecessary internal forwarders (#24939)
|
zhenlan/corefx,shimingsg/corefx,shimingsg/corefx,mmitche/corefx,mmitche/corefx,mmitche/corefx,ericstj/corefx,zhenlan/corefx,ViktorHofer/corefx,Jiayili1/corefx,ptoonen/corefx,ptoonen/corefx,ptoonen/corefx,ericstj/corefx,axelheer/corefx,Jiayili1/corefx,ericstj/corefx,wtgodbe/corefx,ericstj/corefx,ravimeda/corefx,wtgodbe/corefx,zhenlan/corefx,wtgodbe/corefx,ravimeda/corefx,ravimeda/corefx,ViktorHofer/corefx,ravimeda/corefx,mmitche/corefx,ViktorHofer/corefx,mmitche/corefx,zhenlan/corefx,ViktorHofer/corefx,ericstj/corefx,Ermiar/corefx,fgreinacher/corefx,axelheer/corefx,axelheer/corefx,shimingsg/corefx,wtgodbe/corefx,ericstj/corefx,Jiayili1/corefx,shimingsg/corefx,ravimeda/corefx,fgreinacher/corefx,fgreinacher/corefx,shimingsg/corefx,Ermiar/corefx,ViktorHofer/corefx,axelheer/corefx,shimingsg/corefx,BrennanConroy/corefx,ptoonen/corefx,wtgodbe/corefx,ptoonen/corefx,Jiayili1/corefx,shimingsg/corefx,axelheer/corefx,BrennanConroy/corefx,ViktorHofer/corefx,Ermiar/corefx,fgreinacher/corefx,ericstj/corefx,Ermiar/corefx,mmitche/corefx,wtgodbe/corefx,zhenlan/corefx,zhenlan/corefx,Ermiar/corefx,zhenlan/corefx,Ermiar/corefx,ViktorHofer/corefx,axelheer/corefx,ptoonen/corefx,ptoonen/corefx,Ermiar/corefx,mmitche/corefx,Jiayili1/corefx,ravimeda/corefx,Jiayili1/corefx,wtgodbe/corefx,ravimeda/corefx,Jiayili1/corefx,BrennanConroy/corefx
|
src/shims/manual/mscorlib.forwards.cs
|
src/shims/manual/mscorlib.forwards.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.
// Add any internal types that we need to forward from mscorlib.
// These types are required for Desktop to Core serialization as they are not covered by GenAPI because they are marked as internal.
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.GenericComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.NullableComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ObjectComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.GenericEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.NullableEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ObjectEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.NonRandomizedStringEqualityComparer))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ByteEqualityComparer))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.EnumEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.ListDictionaryInternal))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.CultureAwareComparer))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.OrdinalComparer))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.UnitySerializationHolder))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.Contracts.ContractException))]
// This is temporary as we are building the mscorlib shim against netfx461 which doesn't contain ValueTuples.
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,,,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,,,,>))]
|
// 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.
// Add any internal types that we need to forward from mscorlib.
// These types are required for Desktop to Core serialization as they are not covered by GenAPI because they are marked as internal.
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.GenericComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.NullableComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ObjectComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.GenericEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.NullableEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ObjectEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.NonRandomizedStringEqualityComparer))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ByteEqualityComparer))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.EnumEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.SByteEnumEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ShortEnumEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.LongEnumEqualityComparer<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.ListDictionaryInternal))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.CultureAwareComparer))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.OrdinalComparer))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.UnitySerializationHolder))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.Contracts.ContractException))]
// This is temporary as we are building the mscorlib shim against netfx461 which doesn't contain ValueTuples.
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,,,>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,,,,>))]
|
mit
|
C#
|
39df4991d2239dede45cb4c2967e34f64bf52886
|
fix tests
|
DevExpress/AjaxControlToolkit,DevExpress/AjaxControlToolkit,DevExpress/AjaxControlToolkit
|
AjaxControlToolkit.Tests/AjaxFileUploadTests.cs
|
AjaxControlToolkit.Tests/AjaxFileUploadTests.cs
|
using NUnit.Framework;
using System;
using System.IO;
using System.Web;
using System.Web.Hosting;
namespace AjaxControlToolkit.Tests {
[TestFixture]
public class AjaxFileUploadTests {
[Test]
public void NotAllowedFileExtensionIsBlocked() {
var request = new WorkerRequest("", "fileName=aaa.exe", "");
var context = new HttpContext(request);
Assert.Throws<Exception>(() => AjaxFileUploadHelper.Process(context));
}
[Test]
public void AllowedFileExtensionIsAccepted() {
var request = new WorkerRequest("------WebKitFormBoundaryCqenIHPHe1ZTCr0d\r\nContent-Disposition: form-data; name=\"act-file-data\"; filename=\"zero.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundaryCqenIHPHe1ZTCr0d--\r\n", "filename=aaa.jpg&fileId=testtemp", "multipart/form-data; boundary=----WebKitFormBoundaryCqenIHPHe1ZTCr0d");
var context = new HttpContext(request);
AjaxFileUploadHelper.Process(context);
}
var context = new HttpContext(request);
AjaxFileUploadHelper.Process(context);
}
}
}
|
using NUnit.Framework;
using System;
using System.IO;
using System.Web;
using System.Web.Hosting;
namespace AjaxControlToolkit.Tests {
[TestFixture]
public class AjaxFileUploadTests {
[Test]
public void NotAllowedFileExtensionIsBlocked() {
var request = new SimpleWorkerRequest("", "", "", "fileName=aaa.exe", new StringWriter());
var context = new HttpContext(request);
Assert.Throws<Exception>(() => AjaxFileUploadHelper.Process(context));
}
[Test]
public void AllowedFileExtensionIsAccepted() {
var request = new WorkerRequest("------WebKitFormBoundaryCqenIHPHe1ZTCr0dContent - Disposition: form - data; name = \"act-file-data\"; filename = \"zero.jpg\"Content - Type: image / jpeg------WebKitFormBoundaryCqenIHPHe1ZTCr0d--\r\n", "filename=aaa.jpg", "multipart/form-data; boundary=----WebKitFormBoundaryCqenIHPHe1ZTCr0d");
var context = new HttpContext(request);
AjaxFileUploadHelper.Process(context);
}
}
}
|
bsd-3-clause
|
C#
|
048dae685db3dfe0fa6f47d3008080066577a2d0
|
Handle uppercase extension
|
aloisdg/CountPages,aloisdg/Doccou,saidmarouf/Doccou
|
Doccou.Pcl/Document.cs
|
Doccou.Pcl/Document.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Doccou.Pcl.Documents;
using Doccou.Pcl.Documents.Archives;
namespace Doccou.Pcl
{
/// <summary>
/// Document is the class wrapping every other class in this library.
/// If you are an user, everything you need come from here.
/// </summary>
public class Document
{
public DocumentType ExtensionType { get; private set; }
public string Extension { get; private set; }
public string FullName { get; private set; }
public string Name { get; private set; }
public string NameWithoutExtension { get; private set; }
public uint? Count { get; private set; }
private readonly Dictionary<string, DocumentType> _extensionsSupported
= new Dictionary<string, DocumentType>
{
{ ".pdf", DocumentType.Pdf },
{ ".docx", DocumentType.Docx },
{ ".odt", DocumentType.Odt },
{ ".bmp", DocumentType.Bmp },
{ ".jpg", DocumentType.Jpeg },
{ ".jpeg", DocumentType.Jpeg },
{ ".gif", DocumentType.Gif },
{ ".tiff", DocumentType.Tiff },
{ ".png", DocumentType.Png },
};
/// <remarks>
/// We can't open stream ourself.
/// </remarks>
private Document(string fullName)
{
FullName = fullName;
Name = Path.GetFileName(fullName);
NameWithoutExtension = Path.GetFileNameWithoutExtension(fullName);
Extension = Path.GetExtension(fullName).ToLowerInvariant();
ExtensionType = IsSupported(Extension)
? _extensionsSupported[Extension]
: DocumentType.Unknow;
}
public Document(string fullName, Stream stream)
: this(fullName)
{
Count = !ExtensionType.Equals(DocumentType.Unknow)
? BuildDocument(stream).Count
: 0;
}
public bool IsSupported(string extension)
{
return _extensionsSupported.ContainsKey(extension);
}
// replace with a static dictionary ?
private IDocument BuildDocument(Stream stream)
{
switch (ExtensionType)
{
case DocumentType.Pdf: return new Pdf(stream);
case DocumentType.Docx: return new Docx(stream);
case DocumentType.Odt: return new Odt(stream);
case DocumentType.Bmp:
case DocumentType.Jpeg:
case DocumentType.Gif:
case DocumentType.Tiff:
case DocumentType.Png: return new Img(stream);
default: throw new NotImplementedException();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Doccou.Pcl.Documents;
using Doccou.Pcl.Documents.Archives;
namespace Doccou.Pcl
{
/// <summary>
/// Document is the class wrapping every other class in this library.
/// If you are an user, everything you need come from here.
/// </summary>
public class Document
{
public DocumentType ExtensionType { get; private set; }
public string Extension { get; private set; }
public string FullName { get; private set; }
public string Name { get; private set; }
public string NameWithoutExtension { get; private set; }
public uint? Count { get; private set; }
private readonly Dictionary<string, DocumentType> _extensionsSupported
= new Dictionary<string, DocumentType>
{
{ ".pdf", DocumentType.Pdf },
{ ".docx", DocumentType.Docx },
{ ".odt", DocumentType.Odt },
{ ".bmp", DocumentType.Bmp },
{ ".jpg", DocumentType.Jpeg },
{ ".jpeg", DocumentType.Jpeg },
{ ".gif", DocumentType.Gif },
{ ".tiff", DocumentType.Tiff },
{ ".png", DocumentType.Png },
};
/// <remarks>
/// We can't open stream ourself.
/// </remarks>
private Document(string fullName)
{
FullName = fullName;
Name = Path.GetFileName(fullName);
NameWithoutExtension = Path.GetFileNameWithoutExtension(fullName);
Extension = Path.GetExtension(fullName);
ExtensionType = IsSupported(Extension)
? _extensionsSupported[Extension]
: DocumentType.Unknow;
}
public Document(string fullName, Stream stream)
: this(fullName)
{
Count = !ExtensionType.Equals(DocumentType.Unknow)
? BuildDocument(stream).Count
: 0;
}
public bool IsSupported(string extension)
{
return _extensionsSupported.ContainsKey(extension);
}
// replace with a static dictionary ?
private IDocument BuildDocument(Stream stream)
{
switch (ExtensionType)
{
case DocumentType.Pdf: return new Pdf(stream);
case DocumentType.Docx: return new Docx(stream);
case DocumentType.Odt: return new Odt(stream);
case DocumentType.Bmp:
case DocumentType.Jpeg:
case DocumentType.Gif:
case DocumentType.Tiff:
case DocumentType.Png: return new Img(stream);
default: throw new NotImplementedException();
}
}
}
}
|
mit
|
C#
|
150e6e5368a410d46927286cc1bf7daa6e8af957
|
fix using statements in global.asax
|
SoftUni-NoSharpers/Project-X,SoftUni-NoSharpers/Project-X
|
Eventis/Global.asax.cs
|
Eventis/Global.asax.cs
|
using Eventis.Migrations;
using Eventis.Models.Identity;
using System.Data.Entity;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace Eventis
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
Database
.SetInitializer(
new MigrateDatabaseToLatestVersion
<ApplicationDbContext,
Configuration>());
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
|
using System.Linq;
using System.Web;using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace Eventis
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
Database
.SetInitializer(
new MigrateDatabaseToLatestVersion
<ApplicationDbContext,
Configuration>());
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
|
mit
|
C#
|
22b58e6d07c5ae7f6b3c84393c936a8c1ffbca99
|
Add missing `new` statement
|
jkereako/PillBlasta
|
Assets/Scripts/Map.cs
|
Assets/Scripts/Map.cs
|
using UnityEngine;
using System.Collections.Generic;
using System.Net;
[System.Serializable]
public class Map {
public Coordinate size;
public Vector2 maxSize;
public int seed;
public float tileSeparatorWidth;
public float tileSize;
public Obstacle obstacleData;
[Range(0, 1)]
public float obstaclePercent;
public Coordinate center {
get {
return new Coordinate(size.x / 2, size.y / 2);
}
}
// This is an implementation of the Flood-fill 4 algorithm.
public bool IsMapCompletelyAccessible(bool[,] obstacleMap, int obstacleCount) {
bool[,] mapFlags = new bool[obstacleMap.GetLength(0), obstacleMap.GetLength(1)];
Queue<Coordinate> queue = new Queue<Coordinate>();
queue.Enqueue(center);
mapFlags[center.x, center.y] = true;
int accessibleTileCount = 0;
while (queue.Count > 0) {
Coordinate tile = queue.Dequeue();
for (int x = -1; x < 2; x++) {
for (int y = -1; y < 2; y++) {
// This condition makes this a Flood-fill 4 algorithm. That is, we ignore the diagonal
// neighbors.
if (x != 0 && y != 0) {
continue;
}
Coordinate neighbor = new Coordinate(tile.x + x, tile.y + y);
if (neighbor.x >= 0 && neighbor.x < obstacleMap.GetLength(0) &&
neighbor.y >= 0 && neighbor.y < obstacleMap.GetLength(1)) {
if (!mapFlags[neighbor.x, neighbor.y] && !obstacleMap[neighbor.x, neighbor.y]) {
mapFlags[neighbor.x, neighbor.y] = true;
queue.Enqueue(neighbor);
accessibleTileCount += 1;
}
}
}
}
}
int expectedAccessibleTileCount = (int)(size.x * size.y - obstacleCount);
return expectedAccessibleTileCount == accessibleTileCount;
}
public Vector3 CoordinateToPosition(Coordinate coordinate) {
return new Vector3(-size.x / 2.0f + 0.5f + coordinate.x, 0, -size.y / 2.0f + 0.5f + coordinate.y) * tileSize;
}
}
|
using UnityEngine;
using System.Collections.Generic;
using System.Net;
[System.Serializable]
public class Map {
public Coordinate size;
public Vector2 maxSize;
public int seed;
public float tileSeparatorWidth;
public float tileSize;
public Obstacle obstacleData;
[Range(0, 1)]
public float obstaclePercent;
public Coordinate center {
get {
return new Coordinate(size.x / 2, size.y / 2);
}
}
// This is an implementation of the Flood-fill 4 algorithm.
public bool IsMapCompletelyAccessible(bool[,] obstacleMap, int obstacleCount) {
bool[,] mapFlags = new bool[obstacleMap.GetLength(0), obstacleMap.GetLength(1)];
Queue<Coordinate> queue = new Queue<Coordinate>();
queue.Enqueue(center);
mapFlags[center.x, center.y] = true;
int accessibleTileCount = 0;
while (queue.Count > 0) {
Coordinate tile = queue.Dequeue();
for (int x = -1; x < 2; x++) {
for (int y = -1; y < 2; y++) {
// This line is what makes this a Flood-fill 4. That is, we ignore the diagonal neighbors.
if (x != 0 && y != 0) {
continue;
}
Coordinate neighbor = Coordinate(tile.x + x, tile.y + y);
if (neighbor.x >= 0 && neighbor.x < obstacleMap.GetLength(0) &&
neighbor.y >= 0 && neighbor.y < obstacleMap.GetLength(1)) {
if (!mapFlags[neighbor.x, neighbor.y] && !obstacleMap[neighbor.x, neighbor.y]) {
mapFlags[neighbor.x, neighbor.y] = true;
queue.Enqueue(neighbor);
accessibleTileCount += 1;
}
}
}
}
}
int expectedAccessibleTileCount = (int)(size.x * size.y - obstacleCount);
return expectedAccessibleTileCount == accessibleTileCount;
}
public Vector3 CoordinateToPosition(Coordinate coordinate) {
return new Vector3(-size.x / 2.0f + 0.5f + coordinate.x, 0, -size.y / 2.0f + 0.5f + coordinate.y) * tileSize;
}
}
|
mit
|
C#
|
805212df096204f14942e59cbf8d42c5ae2221e7
|
Clean up options dialog and text a bit.
|
jquintus/VsOpenIn
|
VsOpenIn/VsOpenIn/Options/OptionDialog.cs
|
VsOpenIn/VsOpenIn/Options/OptionDialog.cs
|
using Microsoft.VisualStudio.Shell;
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Runtime.InteropServices;
using System.Windows.Forms.Design;
namespace MasterDevs.VsOpenIn.Options
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[CLSCompliant(false), ComVisible(true)]
public class OptionDialog : DialogPage
{
#region Constants
public const string DEFAULT_PATH = @"C:\Program Files (x86)\vim\vim74\gvim.exe";
/// <summary>
/// explanation of arguments http://vim.wikia.com/wiki/Integrate_gvim_with_Visual_Studio
/// </summary>
public const string DEFAULT_ARGUMENTS = "--servername VimStudio --remote-silent \"+call cursor({CurrentLine}, {CurrentCol})\" \"{FullName}\"";
public const string DEFAULT_DIRECTORY = "{DirectoryName}";
public const string DESCRIPTION_ARGUMENTS = "Default:\n " + DEFAULT_ARGUMENTS + DESCRIPTION_VARIABLES;
public const string DESCRIPTION_DIRECTORY = @"The working directory for the external editor" + DESCRIPTION_VARIABLES;
public const string DESCRIPTION_VARIABLES = "\n\n" + @"Variables
{CurrentLine} is Current Line Number
{CurrentCol} is Current Column Number
{FullName} is Full File Path
{DirectoryName} is File Directory
{FileName} is File Name";
#endregion
public OptionDialog()
{
EditorPath = DEFAULT_PATH;
Arguments = DEFAULT_ARGUMENTS;
InitialDirectory = DEFAULT_DIRECTORY;
}
[Category("VS Open In")]
[DisplayName("Editor Path")]
[Description("The full path to the external editor")]
[DefaultValue(DEFAULT_PATH)]
[Editor(typeof(FileNameEditor), typeof(UITypeEditor))]
public string EditorPath { get; set; }
[Category("VS Open In")]
[DisplayName("Editor Arguments")]
[DefaultValue(DEFAULT_ARGUMENTS)]
[Description(DESCRIPTION_ARGUMENTS)]
public string Arguments { get; set; }
[Category("VS Open In")]
[DisplayName("Initial Directory")]
[Description(DESCRIPTION_DIRECTORY)]
[DefaultValue(DEFAULT_DIRECTORY)]
public string InitialDirectory { get; set; }
}
}
|
using Microsoft.VisualStudio.Shell;
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Runtime.InteropServices;
using System.Windows.Forms.Design;
namespace MasterDevs.VsOpenIn.Options
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[CLSCompliant(false), ComVisible(true)]
public class OptionDialog : DialogPage
{
public const string DEFAULT_PATH = @"C:\Program Files (x86)\vim\vim74\gvim.exe";
/// <summary>
/// explanation of arguments http://vim.wikia.com/wiki/Integrate_gvim_with_Visual_Studio
/// </summary>
public const string DEFAULT_ARGUMENTS = "--servername VimStudio --remote-silent \"+call cursor({CurrentLine}, {CurrentCol})\" \"{FullName}\"";
public const string ARGUMENTS_DESCRIPTION = @"Default:
--servername VimStudio --remote-silent ""+call cursor({0}, {1})"" ""{2}""" + VARIABLES;
public const string DIRECTORY_DESCRIPTION = @"The working directory for the external editor" + VARIABLES;
public const string VARIABLES = @"
Variables
{CurrentLine} is Current Line Number
{CurrentCol} is Current Column Number
{FullName} is Full File Path
{DirectoryName} is File Directory
{FileName} is File Name";
[Category("VS Open In")]
[DisplayName("Path to external editor")]
[Description("The full path to the external editor")]
[DefaultValue(DEFAULT_PATH)]
[Editor(typeof(FileNameEditor), typeof(UITypeEditor))]
public string OpenPath { get; set; }
[Category("VS Open In")]
[DisplayName("Arguments to pass to the external editor")]
[Description(ARGUMENTS_DESCRIPTION)]
public string Arguments { get; set; }
[Category("VS Open In")]
[DisplayName("Initial Directory")]
[Description(DIRECTORY_DESCRIPTION)]
[DefaultValue("{DirectoryName}")]
public string InitialDirectory { get; set; }
}
}
|
mit
|
C#
|
4427b440fddef5e81d9a753b5f4aa4694e95e88d
|
bump bugfix version to 1.20.1
|
Fody/Virtuosity
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyTitle("Virtuosity")]
[assembly: AssemblyProduct("Virtuosity")]
[assembly: AssemblyVersion("1.20.1")]
[assembly: AssemblyFileVersion("1.20.1")]
|
using System.Reflection;
[assembly: AssemblyTitle("Virtuosity")]
[assembly: AssemblyProduct("Virtuosity")]
[assembly: AssemblyVersion("1.20.0")]
[assembly: AssemblyFileVersion("1.20.0")]
|
mit
|
C#
|
b86def3325c228f62c28c4a337f0839e51ba1259
|
Update the systemclock to use UtcNow. This is because some of code use Month, Year properties of DateTimeOffset
|
askheaves/Its.Cqrs,commonsensesoftware/Its.Cqrs,commonsensesoftware/Its.Cqrs,askheaves/Its.Cqrs,commonsensesoftware/Its.Cqrs,askheaves/Its.Cqrs
|
Domain/SystemClock.cs
|
Domain/SystemClock.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Diagnostics;
namespace Microsoft.Its.Domain
{
/// <summary>
/// Provides access to system time.
/// </summary>
[DebuggerStepThrough]
public class SystemClock : IClock
{
public static readonly SystemClock Instance = new SystemClock();
private SystemClock()
{
}
/// <summary>
/// Gets the current time via <see cref="DateTimeOffset.Now" />.
/// </summary>
public DateTimeOffset Now()
{
return DateTimeOffset.UtcNow;
}
public override string ToString()
{
return GetType() + ": " + Now().ToString("O");
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Diagnostics;
namespace Microsoft.Its.Domain
{
/// <summary>
/// Provides access to system time.
/// </summary>
[DebuggerStepThrough]
public class SystemClock : IClock
{
public static readonly SystemClock Instance = new SystemClock();
private SystemClock()
{
}
/// <summary>
/// Gets the current time via <see cref="DateTimeOffset.Now" />.
/// </summary>
public DateTimeOffset Now()
{
return DateTimeOffset.Now;
}
public override string ToString()
{
return GetType() + ": " + Now().ToString("O");
}
}
}
|
mit
|
C#
|
1275e73cc52426555cdf33504622e8985e4f0202
|
Fix test
|
Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnetcore
|
test/Microsoft.ApplicationInsights.AspNetCore.Tests/TelemetryInitializers/AspNetCoreEnvironmentTelemetryInitializerTests.cs
|
test/Microsoft.ApplicationInsights.AspNetCore.Tests/TelemetryInitializers/AspNetCoreEnvironmentTelemetryInitializerTests.cs
|
namespace Microsoft.ApplicationInsights.AspNetCore.Tests.TelemetryInitializers
{
using Microsoft.ApplicationInsights.AspNetCore.TelemetryInitializers;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.AspNetCore.Hosting.Internal;
using Xunit;
public class AspNetCoreEnvironmentTelemetryInitializerTests
{
[Fact]
public void InitializeDoesNotThrowIfHostingEnvironmentIsNull()
{
var initializer = new AspNetCoreEnvironmentTelemetryInitializer(null);
initializer.Initialize(new RequestTelemetry());
}
[Fact]
public void InitializeDoesNotOverrideExistingProperty()
{
var initializer = new AspNetCoreEnvironmentTelemetryInitializer(new HostingEnvironment() { EnvironmentName = "Production"});
var telemetry = new RequestTelemetry();
telemetry.Context.GlobalProperties.Add("AspNetCoreEnvironment", "Development");
initializer.Initialize(telemetry);
Assert.Equal("Development", telemetry.Context.GlobalProperties["AspNetCoreEnvironment"]);
}
[Fact]
public void InitializeSetsCurrentEnvironmentNameToProperty()
{
var initializer = new AspNetCoreEnvironmentTelemetryInitializer(new HostingEnvironment() { EnvironmentName = "Production"});
var telemetry = new RequestTelemetry();
initializer.Initialize(telemetry);
Assert.Equal("Production", telemetry.Context.GlobalProperties["AspNetCoreEnvironment"]);
}
}
}
|
namespace Microsoft.ApplicationInsights.AspNetCore.Tests.TelemetryInitializers
{
using Microsoft.ApplicationInsights.AspNetCore.TelemetryInitializers;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.AspNetCore.Hosting.Internal;
using Xunit;
public class AspNetCoreEnvironmentTelemetryInitializerTests
{
[Fact]
public void InitializeDoesNotThrowIfHostingEnvironmentIsNull()
{
var initializer = new AspNetCoreEnvironmentTelemetryInitializer(null);
initializer.Initialize(new RequestTelemetry());
}
[Fact]
public void InitializeDoesNotOverrideExistingProperty()
{
var initializer = new AspNetCoreEnvironmentTelemetryInitializer(new HostingEnvironment() { EnvironmentName = "Production"});
var telemetry = new RequestTelemetry();
telemetry.Context.Properties.Add("AspNetCoreEnvironment", "Development");
initializer.Initialize(telemetry);
Assert.Equal("Development", telemetry.Context.GlobalProperties["AspNetCoreEnvironment"]);
}
[Fact]
public void InitializeSetsCurrentEnvironmentNameToProperty()
{
var initializer = new AspNetCoreEnvironmentTelemetryInitializer(new HostingEnvironment() { EnvironmentName = "Production"});
var telemetry = new RequestTelemetry();
initializer.Initialize(telemetry);
Assert.Equal("Production", telemetry.Context.GlobalProperties["AspNetCoreEnvironment"]);
}
}
}
|
mit
|
C#
|
ac2a5002042999bc715b7cb143f240cb49597e11
|
Revert "Gary changed wording per content request"
|
smbc-digital/iag-webapp,smbc-digital/iag-webapp,smbc-digital/iag-webapp
|
src/StockportWebapp/Views/stockportgov/ContactUs/ThankYouMessage.cshtml
|
src/StockportWebapp/Views/stockportgov/ContactUs/ThankYouMessage.cshtml
|
@model string
@{
ViewData["Title"] = "Thank you";
ViewData["og:title"] = "Thank you";
Layout = "../Shared/_Layout.cshtml";
}
<div class="grid-container-full-width">
<div class="grid-container grid-100">
<div class="l-body-section-filled l-short-content mobile-grid-100 tablet-grid-100 grid-100">
<section aria-label="Thank you message" class="grid-100 mobile-grid-100">
<div class="l-content-container l-article-container">
<h1>Thank you for contacting us</h1>
<p>We will endeavour to respond to your enquiry within 10 working days.</p>
<stock-button href="@Model">Return To Previous Page</stock-button>
</div>
</section>
</div>
</div>
</div>
|
@model string
@{
ViewData["Title"] = "Thank you";
ViewData["og:title"] = "Thank you";
Layout = "../Shared/_Layout.cshtml";
}
<div class="grid-container-full-width">
<div class="grid-container grid-100">
<div class="l-body-section-filled l-short-content mobile-grid-100 tablet-grid-100 grid-100">
<section aria-label="Thank you message" class="grid-100 mobile-grid-100">
<div class="l-content-container l-article-container">
<h1>Thank you for contacting us</h1>
<p>We will aim to respond to your enquiry within 10 working days.</p>
<stock-button href="@Model">Return to previous page</stock-button>
</div>
</section>
</div>
</div>
</div>
|
mit
|
C#
|
0677dad63b57bff48ea82a93b1871fde306e0ac7
|
Remove IDE0051 suppression
|
shyamnamboodiripad/roslyn,weltkante/roslyn,sharwell/roslyn,dotnet/roslyn,mavasani/roslyn,dotnet/roslyn,sharwell/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,dotnet/roslyn,weltkante/roslyn,diryboy/roslyn,KevinRansom/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,diryboy/roslyn,sharwell/roslyn,mavasani/roslyn,bartdesmet/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn
|
src/VisualStudio/CSharp/Impl/ProjectSystemShim/HACK_VariantStructure.cs
|
src/VisualStudio/CSharp/Impl/ProjectSystemShim/HACK_VariantStructure.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
{
/// <summary>
/// This is a terrible, terrible hack around the C# project system in
/// CCscMSBuildHostObject::SetDelaySign. To indicate a value of "unset"
/// for boolean options, they create variant of type VT_BOOL with the boolean
/// field being a value of "4". The CLR, if it marshals this variant, marshals
/// it as a "true" which is indistinguishable from a real VARIANT_TRUE. So
/// instead we define this structure of the same layout, and marshal the variant
/// as this structure. We can then pick out this broken pattern, and convert
/// it to null instead of true.
/// </summary>
[StructLayout]
internal struct HACK_VariantStructure
{
private readonly short _type;
private readonly short _padding1;
private readonly short _padding2;
private readonly short _padding3;
private readonly short _booleanValue;
private readonly IntPtr _padding4; // this will be aligned to the IntPtr-sized address
public unsafe object ConvertToObject()
{
if (_type == (short)VarEnum.VT_BOOL && _booleanValue == 4)
{
return null;
}
// Can't take an address of this since it might move, so....
var localCopy = this;
return Marshal.GetObjectForNativeVariant((IntPtr)(&localCopy));
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
{
/// <summary>
/// This is a terrible, terrible hack around the C# project system in
/// CCscMSBuildHostObject::SetDelaySign. To indicate a value of "unset"
/// for boolean options, they create variant of type VT_BOOL with the boolean
/// field being a value of "4". The CLR, if it marshals this variant, marshals
/// it as a "true" which is indistinguishable from a real VARIANT_TRUE. So
/// instead we define this structure of the same layout, and marshal the variant
/// as this structure. We can then pick out this broken pattern, and convert
/// it to null instead of true.
/// </summary>
internal struct HACK_VariantStructure
{
private readonly short _type;
#pragma warning disable IDE0051 // Remove unused private members - padding bytes
private readonly short _padding1;
private readonly short _padding2;
private readonly short _padding3;
private readonly short _booleanValue;
private readonly IntPtr _padding4; // this will be aligned to the IntPtr-sized address
#pragma warning restore IDE0051 // Remove unused private members
public unsafe object ConvertToObject()
{
if (_type == (short)VarEnum.VT_BOOL && _booleanValue == 4)
{
return null;
}
// Can't take an address of this since it might move, so....
var localCopy = this;
return Marshal.GetObjectForNativeVariant((IntPtr)(&localCopy));
}
}
}
|
mit
|
C#
|
4d0ccc57991b723620695cf5ae7f3640dd6fd588
|
Change Sensor level to 100
|
rehrbar/ChallP2TapBox,rehrbar/ChallP2TapBox,rehrbar/ChallP2TapBox,rehrbar/ChallP2TapBox,rehrbar/ChallP2TapBox
|
TapBoxWebApplication/TapBoxWebjob/MailSender.cs
|
TapBoxWebApplication/TapBoxWebjob/MailSender.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Net;
using System.Net.Mail;
using SendGrid;
using TapBoxCommon.Models;
using Microsoft.Azure;
namespace TapBoxWebjob
{
class MailSender
{
public static void SendMailToOwner(Device NotifierDevice, int SensorValue)
{
SendGridMessage myMessage = new SendGridMessage();
myMessage.AddTo(NotifierDevice.OwnerMailAddress);
myMessage.From = new MailAddress("sjost@hsr.ch", "Samuel Jost");
myMessage.Subject = "Notification from your Tapbox";
Console.WriteLine($"Device: {NotifierDevice.DeviceName} - Sensor Value: {SensorValue}");
if (SensorValue < 100)
{
Console.WriteLine("Your Mailbox is Empty");
return;
}
else if (SensorValue < 300)
{
Console.WriteLine("You have some Mail");
myMessage.Text = "You have some Mail in your device "+NotifierDevice.DeviceName;
}
else if (SensorValue > 300)
{
Console.WriteLine("You have A Lot of Mail");
myMessage.Text = "You have a lot of Mail in your device " + NotifierDevice.DeviceName;
}
var apiKey = CloudConfigurationManager.GetSetting("SendGrid.API_Key");
var transportWeb = new Web(apiKey);
// Send the email, which returns an awaitable task.
transportWeb.DeliverAsync(myMessage);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Net;
using System.Net.Mail;
using SendGrid;
using TapBoxCommon.Models;
using Microsoft.Azure;
namespace TapBoxWebjob
{
class MailSender
{
public static void SendMailToOwner(Device NotifierDevice, int SensorValue)
{
SendGridMessage myMessage = new SendGridMessage();
myMessage.AddTo(NotifierDevice.OwnerMailAddress);
myMessage.From = new MailAddress("sjost@hsr.ch", "Samuel Jost");
myMessage.Subject = "Notification from your Tapbox";
Console.WriteLine($"Device: {NotifierDevice.DeviceName} - Sensor Value: {SensorValue}");
if (SensorValue < 20)
{
Console.WriteLine("Your Mailbox is Empty");
return;
}
else if (SensorValue < 300)
{
Console.WriteLine("You have some Mail");
myMessage.Text = "You have some Mail in your device "+NotifierDevice.DeviceName;
}
else if (SensorValue > 300)
{
Console.WriteLine("You have A Lot of Mail");
myMessage.Text = "You have a lot of Mail in your device " + NotifierDevice.DeviceName;
}
var apiKey = CloudConfigurationManager.GetSetting("SendGrid.API_Key");
var transportWeb = new Web(apiKey);
// Send the email, which returns an awaitable task.
transportWeb.DeliverAsync(myMessage);
}
}
}
|
mit
|
C#
|
6515a6377e48ccec843ca6605fb89a6c2f37f2fa
|
Add missing comment block. bugid: 812
|
ronnymgm/csla-light,rockfordlhotka/csla,BrettJaner/csla,rockfordlhotka/csla,jonnybee/csla,BrettJaner/csla,MarimerLLC/csla,ronnymgm/csla-light,JasonBock/csla,jonnybee/csla,BrettJaner/csla,jonnybee/csla,JasonBock/csla,ronnymgm/csla-light,MarimerLLC/csla,MarimerLLC/csla,rockfordlhotka/csla,JasonBock/csla
|
Source/Csla.Wp/PortedAttributes.cs
|
Source/Csla.Wp/PortedAttributes.cs
|
//-----------------------------------------------------------------------
// <copyright file="PortedAttributes.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: http://www.lhotka.net/cslanet/
// </copyright>
// <summary>Dummy implementations of .NET attributes missing in WP7.</summary>
//-----------------------------------------------------------------------
using System;
namespace Csla
{
internal class BrowsableAttribute : Attribute
{
public BrowsableAttribute(bool flag)
{ }
}
internal class DisplayAttribute : Attribute
{
public string Name { get; set; }
public bool AutoGenerateField { get; set; }
public DisplayAttribute(bool AutoGenerateField = false, string Name = "")
{
this.AutoGenerateField = AutoGenerateField;
this.Name = Name;
}
}
}
|
using System;
namespace Csla
{
internal class BrowsableAttribute : Attribute
{
public BrowsableAttribute(bool flag)
{ }
}
internal class DisplayAttribute : Attribute
{
public string Name { get; set; }
public bool AutoGenerateField { get; set; }
public DisplayAttribute(bool AutoGenerateField = false, string Name = "")
{
this.AutoGenerateField = AutoGenerateField;
this.Name = Name;
}
}
}
|
mit
|
C#
|
7a6da4301812d52bdbebf3da4315f6fcacf82565
|
Increase version to 2.0.2-rc1
|
bungeemonkee/Configgy
|
Configgy/Properties/AssemblyInfo.cs
|
Configgy/Properties/AssemblyInfo.cs
|
using System.Resources;
using System.Reflection;
// 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("Configgy")]
[assembly: AssemblyDescription("Configgy: Configuration library for .NET")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("David Love")]
[assembly: AssemblyProduct("Configgy")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values.
// We will increase these values in the following way:
// Major Version : Increased when there is a release that breaks a public api
// Minor Version : Increased for each non-api-breaking release
// Build Number : 0 for alpha versions, 1 for beta versions, 2 for release candidates, 3 for releases
// Revision : Always 0 for release versions, always 1+ for alpha, beta, rc versions to indicate the alpha/beta/rc number
[assembly: AssemblyVersion("2.0.2.1")]
[assembly: AssemblyFileVersion("2.0.2.1")]
// This version number will roughly follow semantic versioning : http://semver.org
// The first three numbers will always match the first the numbers of the version above.
[assembly: AssemblyInformationalVersion("2.0.2-rc1")]
|
using System.Resources;
using System.Reflection;
// 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("Configgy")]
[assembly: AssemblyDescription("Configgy: Configuration library for .NET")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("David Love")]
[assembly: AssemblyProduct("Configgy")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values.
// We will increase these values in the following way:
// Major Version : Increased when there is a release that breaks a public api
// Minor Version : Increased for each non-api-breaking release
// Build Number : 0 for alpha versions, 1 for beta versions, 2 for release candidates, 3 for releases
// Revision : Always 0 for release versions, always 1+ for alpha, beta, rc versions to indicate the alpha/beta/rc number
[assembly: AssemblyVersion("2.0.1.2")]
[assembly: AssemblyFileVersion("2.0.1.2")]
// This version number will roughly follow semantic versioning : http://semver.org
// The first three numbers will always match the first the numbers of the version above.
[assembly: AssemblyInformationalVersion("2.0.1-beta2")]
|
mit
|
C#
|
336006b43cc7aed6b415a082a7f6646a2530d853
|
Use the same `singlewordlowercase` parameter name mapping convention as used in `apikey`
|
datalust/clef-tool
|
src/Datalust.ClefTool/Cli/Features/SeqOutputFeature.cs
|
src/Datalust.ClefTool/Cli/Features/SeqOutputFeature.cs
|
// Copyright 2016-2017 Datalust Pty Ltd
//
// 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.
namespace Datalust.ClefTool.Cli.Features
{
class SeqOutputFeature : CommandFeature
{
public const int DefaultBatchPostingLimit = 100;
public const long DefaultEventBodyLimitBytes = 256 * 1000;
public string SeqUrl { get; private set; }
public string SeqApiKey { get; private set; }
public int BatchPostingLimit { get; private set; }
public long? EventBodyLimitBytes { get; private set; }
public override void Enable(OptionSet options)
{
options.Add("out-seq=",
"Send output to Seq at the specified URL",
v => SeqUrl = string.IsNullOrWhiteSpace(v) ? null : v.Trim());
options.Add("out-seq-apikey=",
"Specify the API key to use when writing to Seq, if required",
v => SeqApiKey = string.IsNullOrWhiteSpace(v) ? null : v.Trim());
options.Add("out-seq-batchpostinglimit=",
"The maximum number of events to post in a single batch",
v => BatchPostingLimit = string.IsNullOrWhiteSpace(v) ? DefaultBatchPostingLimit : (int.TryParse(v.Trim(), out var postingLimit) ? postingLimit : DefaultBatchPostingLimit));
options.Add("out-seq-eventbodylimitbytes=",
"The maximum size, in bytes, that the JSON representation of an event may take before it is dropped rather than being sent to the Seq server",
v => EventBodyLimitBytes = string.IsNullOrWhiteSpace(v) ? DefaultEventBodyLimitBytes : (long.TryParse(v.Trim(), out var bodyLimit) ? bodyLimit : DefaultEventBodyLimitBytes));
}
}
}
|
// Copyright 2016-2017 Datalust Pty Ltd
//
// 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.
namespace Datalust.ClefTool.Cli.Features
{
class SeqOutputFeature : CommandFeature
{
public const int DefaultBatchPostingLimit = 100;
public const long DefaultEventBodyLimitBytes = 256 * 1000;
public string SeqUrl { get; private set; }
public string SeqApiKey { get; private set; }
public int BatchPostingLimit { get; private set; }
public long? EventBodyLimitBytes { get; private set; }
public override void Enable(OptionSet options)
{
options.Add("out-seq=",
"Send output to Seq at the specified URL",
v => SeqUrl = string.IsNullOrWhiteSpace(v) ? null : v.Trim());
options.Add("out-seq-apikey=",
"Specify the API key to use when writing to Seq, if required",
v => SeqApiKey = string.IsNullOrWhiteSpace(v) ? null : v.Trim());
options.Add("out-seq-batchPostingLimit=",
"The maximum number of events to post in a single batch",
v => BatchPostingLimit = string.IsNullOrWhiteSpace(v) ? DefaultBatchPostingLimit : (int.TryParse(v.Trim(), out var postingLimit) ? postingLimit : DefaultBatchPostingLimit));
options.Add("out-seq-eventBodyLimitBytes=",
"The maximum size, in bytes, that the JSON representation of an event may take before it is dropped rather than being sent to the Seq server",
v => EventBodyLimitBytes = string.IsNullOrWhiteSpace(v) ? DefaultEventBodyLimitBytes : (long.TryParse(v.Trim(), out var bodyLimit) ? bodyLimit : DefaultEventBodyLimitBytes));
}
}
}
|
apache-2.0
|
C#
|
9901a01f0bf883a5689dc0f531facf042d9b8feb
|
Fix bug: Ensure CacheTimeout is actually set when extending cache.
|
queueit/FeatureSwitcher.AwsConfiguration
|
src/FeatureSwitcher.AwsConfiguration/Models/BehaviourCacheItem.cs
|
src/FeatureSwitcher.AwsConfiguration/Models/BehaviourCacheItem.cs
|
using System;
using FeatureSwitcher.AwsConfiguration.Behaviours;
namespace FeatureSwitcher.AwsConfiguration.Models
{
internal class BehaviourCacheItem
{
public IBehaviour Behaviour { get; }
public DateTime CacheTimeout { get; private set; }
public bool IsExpired => this.CacheTimeout < DateTime.UtcNow;
public BehaviourCacheItem(IBehaviour behaviour, TimeSpan cacheTime)
{
Behaviour = behaviour;
CacheTimeout = DateTime.UtcNow.Add(cacheTime);
}
public void ExtendCache()
{
CacheTimeout = CacheTimeout.Add(TimeSpan.FromMinutes(1));
}
}
}
|
using System;
using FeatureSwitcher.AwsConfiguration.Behaviours;
namespace FeatureSwitcher.AwsConfiguration.Models
{
internal class BehaviourCacheItem
{
public IBehaviour Behaviour { get; }
public DateTime CacheTimeout { get; }
public bool IsExpired => this.CacheTimeout < DateTime.UtcNow;
public BehaviourCacheItem(IBehaviour behaviour, TimeSpan cacheTime)
{
Behaviour = behaviour;
CacheTimeout = DateTime.UtcNow.Add(cacheTime);
}
public void ExtendCache()
{
CacheTimeout.Add(TimeSpan.FromMinutes(1));
}
}
}
|
apache-2.0
|
C#
|
d50031542fe5f1bd0926767b1bb4ef876db212a6
|
update AssemblyInfo.cs
|
Aaron-Liu/enode,tangxuehua/enode
|
src/Extensions/ENode.EQueue/Properties/AssemblyInfo.cs
|
src/Extensions/ENode.EQueue/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("ENode.EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ENode.EQueue")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e534ee24-4ea0-410e-847a-227e53faed7c")]
// 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.2.0")]
[assembly: AssemblyFileVersion("1.2.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ENode.EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ENode.EQueue")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e534ee24-4ea0-410e-847a-227e53faed7c")]
// 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.1.9")]
[assembly: AssemblyFileVersion("1.1.9")]
|
mit
|
C#
|
5af7e8db71eb0133aad4d46f0571db1168952522
|
Remove code that unconditionally enable https redirects and authorization
|
surlycoder/truck-router
|
TruckRouter/Program.cs
|
TruckRouter/Program.cs
|
using TruckRouter.Models;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddTransient<IMazeSolver, MazeSolverBFS>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.UseDeveloperExceptionPage();
}
else
{
app.UseHttpsRedirection();
app.UseAuthorization();
}
app.MapControllers();
app.Run();
|
using TruckRouter.Models;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddTransient<IMazeSolver, MazeSolverBFS>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.UseDeveloperExceptionPage();
}
else
{
app.UseHttpsRedirection();
app.UseAuthorization();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
|
mit
|
C#
|
4c822bbdd11c58e1d2fb959240643d51d6ba893d
|
Add logging in case of null response from Syncthing
|
canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor
|
src/SyncTrayzor/Syncthing/ApiClient/SyncthingHttpClientHandler.cs
|
src/SyncTrayzor/Syncthing/ApiClient/SyncthingHttpClientHandler.cs
|
using NLog;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace SyncTrayzor.Syncthing.ApiClient
{
public class SyncthingHttpClientHandler : WebRequestHandler
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public SyncthingHttpClientHandler()
{
// We expect Syncthing to return invalid certs
this.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var response = await base.SendAsync(request, cancellationToken);
// We're getting null bodies from somewhere: try and figure out where
var responseString = await response.Content.ReadAsStringAsync();
if (responseString == null)
logger.Warn($"Null response received from {request.RequestUri}. {response}. Content (again): {response.Content.ReadAsStringAsync()}");
if (response.IsSuccessStatusCode)
logger.Trace(() => response.Content.ReadAsStringAsync().Result.Trim());
else
logger.Warn("Non-successful status code. {0} {1}", response, (await response.Content.ReadAsStringAsync()).Trim());
return response;
}
}
}
|
using NLog;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace SyncTrayzor.Syncthing.ApiClient
{
public class SyncthingHttpClientHandler : WebRequestHandler
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public SyncthingHttpClientHandler()
{
// We expect Syncthing to return invalid certs
this.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var response = await base.SendAsync(request, cancellationToken);
if (response.IsSuccessStatusCode)
logger.Trace(() => response.Content.ReadAsStringAsync().Result.Trim());
else
logger.Warn("Non-successful status code. {0} {1}", response, (await response.Content.ReadAsStringAsync()).Trim());
return response;
}
}
}
|
mit
|
C#
|
71cd91a9d07508d2170cbf50759e703c97ae9b5e
|
Allow debug mode to connect to any version of remote.
|
MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS
|
src/Host/Client/Impl/Extensions/AboutHostExtensions.cs
|
src/Host/Client/Impl/Extensions/AboutHostExtensions.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Reflection;
using Microsoft.Common.Core;
using Microsoft.R.Host.Protocol;
namespace Microsoft.R.Host.Client {
public static class AboutHostExtensions {
private static Version _localVersion;
static AboutHostExtensions() {
_localVersion = typeof(AboutHost).GetTypeInfo().Assembly.GetName().Version;
}
public static string IsHostVersionCompatible(this AboutHost aboutHost) {
#if !DEBUG
if (_localVersion.Major != 0 || _localVersion.Minor != 0) { // Filter out debug builds
var serverVersion = new Version(aboutHost.Version.Major, aboutHost.Version.Minor);
var clientVersion = new Version(_localVersion.Major, _localVersion.Minor);
if (serverVersion > clientVersion) {
return Resources.Error_RemoteVersionHigher.FormatInvariant(aboutHost.Version, _localVersion);
}
if (serverVersion < clientVersion) {
return Resources.Error_RemoteVersionLower.FormatInvariant(aboutHost.Version, _localVersion);
}
}
#endif
return null;
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Reflection;
using Microsoft.Common.Core;
using Microsoft.R.Host.Protocol;
namespace Microsoft.R.Host.Client {
public static class AboutHostExtensions {
private static Version _localVersion;
static AboutHostExtensions() {
_localVersion = typeof(AboutHost).GetTypeInfo().Assembly.GetName().Version;
}
public static string IsHostVersionCompatible(this AboutHost aboutHost) {
if (_localVersion.Major != 0 || _localVersion.Minor != 0) { // Filter out debug builds
var serverVersion = new Version(aboutHost.Version.Major, aboutHost.Version.Minor);
var clientVersion = new Version(_localVersion.Major, _localVersion.Minor);
if (serverVersion > clientVersion) {
return Resources.Error_RemoteVersionHigher.FormatInvariant(aboutHost.Version, _localVersion);
}
if (serverVersion < clientVersion) {
return Resources.Error_RemoteVersionLower.FormatInvariant(aboutHost.Version, _localVersion);
}
}
return null;
}
}
}
|
mit
|
C#
|
1d15bcadd2fd27c7912983b431b13bb1f737a19d
|
Remove duplicates in search. Closes #35
|
sixteencolors/Pablo.Gallery,sixteencolors/Pablo.Gallery,sixteencolors/Pablo.Gallery,sixteencolors/Pablo.Gallery
|
src/Pablo.Gallery/Api/V0/Controllers/FileController.cs
|
src/Pablo.Gallery/Api/V0/Controllers/FileController.cs
|
using Microsoft.Ajax.Utilities;
using Pablo.Gallery.Api.ApiModels;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using Pablo.Gallery.Logic.Interceptors;
using Pablo.Gallery.Models;
namespace Pablo.Gallery.Api.V0.Controllers
{
public class FileController : ApiController
{
readonly Models.GalleryContext db = new Models.GalleryContext();
[HttpGet]
public IEnumerable<FileSummary> Index(string format = null, string type = null, string query = null, int page = 0, int pageSize = Global.DefaultPageSize, string keyword = null)
{
var files = db.QueryFiles(format, type, query);
if (!string.IsNullOrEmpty(keyword)) {
var s = FullTextSearchInterceptor.Search(keyword);
files = files.Where(f => f.Content.Text.Contains(s));
}
var result = (from f in files.DistinctBy(f => f.Id).Skip(page * pageSize).Take(pageSize).AsEnumerable()
select new FileSummary(f)).ToArray();
return result;
}
protected override void Dispose(bool disposing)
{
if (disposing)
db.Dispose();
base.Dispose(disposing);
}
}
}
|
using Microsoft.Ajax.Utilities;
using Pablo.Gallery.Api.ApiModels;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using Pablo.Gallery.Logic.Interceptors;
using Pablo.Gallery.Models;
namespace Pablo.Gallery.Api.V0.Controllers
{
public class FileController : ApiController
{
readonly Models.GalleryContext db = new Models.GalleryContext();
[HttpGet]
public IEnumerable<FileSummary> Index(string format = null, string type = null, string query = null, int page = 0, int pageSize = Global.DefaultPageSize, string keyword = null)
{
var files = db.QueryFiles(format, type, query);
if (!string.IsNullOrEmpty(keyword)) {
var s = FullTextSearchInterceptor.Search(keyword);
files = files.Where(f => f.Content.Text.Contains(s));
}
var result = (from f in files.Skip(page * pageSize).Take(pageSize).AsEnumerable()
select new FileSummary(f)).ToArray();
return result;
}
protected override void Dispose(bool disposing)
{
if (disposing)
db.Dispose();
base.Dispose(disposing);
}
}
}
|
mit
|
C#
|
d5c2889ff4cd3fc84183efd2c1ee079ba54be319
|
Fix typo
|
WillemRB/serilog-sinks-webrequest
|
test/WebRequestSinkTests.cs
|
test/WebRequestSinkTests.cs
|
using System;
using System.Collections.Specialized;
using System.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Serilog.Sinks.WebRequest.Tests
{
[TestClass]
public class WebRequestSinkTests
{
private string Url = ConfigurationManager.AppSettings["testUrl"];
private string glipWebhook = ConfigurationManager.AppSettings["glipWebHook"];
[TestMethod]
public void LoggerTest()
{
var logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.WebRequest(new Uri(Url))
.CreateLogger();
logger.Information("Hello World");
}
[TestMethod]
public void AdditionalHeadersTest()
{
var headers = new NameValueCollection();
headers.Add("X-Test-Header", "Test Header Value");
var logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.WebRequest(new Uri(glipWebhook), contentType: "application/json", headers: headers)
.CreateLogger();
var message = new GlipMessage();
logger.Information("{{ \"icon\": {icon}, \"activity\": {activity}, \"title\": {title}, \"body\": {body} }}",
message.Icon, message.Activity, message.Title, message.Body);
}
}
}
|
using System;
using System.Collections.Specialized;
using System.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Serilog.Sinks.WebRequest.Tests
{
[TestClass]
public class WebRequestSinkTests
{
private string Url = ConfigurationManager.AppSettings["testUrl"];
private string glipWebhook = ConfigurationManager.AppSettings["glipWebHook"];
[TestMethod]
public void LoggerTest()
{
var logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.WebRequest(new Uri(Url))
.CreateLogger();
logger.Information("Hello World");
}
[TestMethod]
public void AdditionalHeadersTest()
{
var headers = new NameValueCollection();
headers.Add("X-Test-Header", "Test Header Value");
var logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.WebRequest(new Uri(glipWebhook), contentType: "application/json", headers: headers)
.CreateLogger();
var message = new GlipMessage();
logger.Information("{{ \"icon\": {icon}, \"activity\": {activity}, \"title\": {titile}, \"body\": {body} }}",
message.Icon, message.Activity, message.Title, message.Body);
}
}
}
|
mit
|
C#
|
83fdedd0856c4e85f99bdc6ff2225504a247e552
|
Document why null is ok here
|
red-gate/RedGate.AppHost,nycdotnet/RedGate.AppHost
|
RedGate.AppHost.Remoting/ClientChannelSinkProviderForParticularServer.cs
|
RedGate.AppHost.Remoting/ClientChannelSinkProviderForParticularServer.cs
|
using System;
using System.Runtime.Remoting.Channels;
namespace RedGate.AppHost.Remoting
{
internal class ClientChannelSinkProviderForParticularServer : IClientChannelSinkProvider
{
private readonly IClientChannelSinkProvider m_Upstream;
private readonly string m_Url;
internal ClientChannelSinkProviderForParticularServer(IClientChannelSinkProvider upstream, string id)
{
if (upstream == null)
throw new ArgumentNullException("upstream");
if (String.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
m_Upstream = upstream;
m_Url = string.Format("ipc://{0}", id);
}
public IClientChannelSinkProvider Next
{
get { return m_Upstream.Next; }
set { m_Upstream.Next = value; }
}
public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
{
//Returning null indicates that the sink cannot be created as per Microsoft documentation
return url == m_Url ? m_Upstream.CreateSink(channel, url, remoteChannelData) : null;
}
}
}
|
using System.Runtime.Remoting.Channels;
namespace RedGate.AppHost.Remoting
{
internal class ClientChannelSinkProviderForParticularServer : IClientChannelSinkProvider
{
private readonly IClientChannelSinkProvider m_Upstream;
private readonly string m_Url;
internal ClientChannelSinkProviderForParticularServer(IClientChannelSinkProvider upstream, string id)
{
if (upstream == null)
throw new ArgumentNullException("upstream");
if (String.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
m_Upstream = upstream;
m_Url = string.Format("ipc://{0}", id);
}
public IClientChannelSinkProvider Next
{
get { return m_Upstream.Next; }
set { m_Upstream.Next = value; }
}
public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
{
return url == m_Url ? m_Upstream.CreateSink(channel, url, remoteChannelData) : null;
}
}
}
|
apache-2.0
|
C#
|
6aa786b4cd0871f94458cb4189c772596bdca468
|
Update packages
|
BioID-GmbH/BWS-GUI
|
samples/aspnetcore/uuisample/Views/Shared/_Layout.cshtml
|
samples/aspnetcore/uuisample/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"]</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css"
integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx"
crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN"
crossorigin="anonymous" />
</head>
<body>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p class="small">© @DateTime.Now.Year - <a href="https://www.bioid.com" title="BioID" target="_blank">BioID GmbH</a></p>
</footer>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/@@popperjs/core@2.11.5/dist/umd/popper.min.js"
integrity="sha384-Xe+8cL9oJa6tN/veChSP7q+mnSPaj5Bcu9mPX5F5xIGE0DVittaqT5lorf0EI7Vk"
crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.min.js"
integrity="sha384-ODmDIVzN+pFdexxHEHFBQH3/9/vQ9uori45z4JjnFsRydbmQbmL5t1tQ0culUzyK"
crossorigin="anonymous">
</script>
@RenderSection("Scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"]</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN"
crossorigin="anonymous" />
</head>
<body>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p class="small">© @DateTime.Now.Year - <a href="https://www.bioid.com" title="BioID" target="_blank">BioID GmbH</a></p>
</footer>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/@@popperjs/core@2.10.2/dist/umd/popper.min.js"
integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB"
crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js"
integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13"
crossorigin="anonymous">
</script>
@RenderSection("Scripts", required: false)
</body>
</html>
|
mit
|
C#
|
91de92b8d3ea3098ce620b246868339b8696a301
|
upgrade imocks
|
Ky7m/DemoCode,Ky7m/DemoCode,Ky7m/DemoCode,Ky7m/DemoCode
|
PulumiDemo/PulumiDemoTests/Mocks.cs
|
PulumiDemo/PulumiDemoTests/Mocks.cs
|
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Testing;
namespace PulumiDemoTests
{
internal class Mocks : IMocks
{
public Task<(string? id, object state)> NewResourceAsync(MockResourceArgs args)
{
var outputs = ImmutableDictionary.CreateBuilder<string, object>();
// Forward all input parameters as resource outputs, so that we could test them.
outputs.AddRange(args.Inputs);
if (args.Type == "azure:storage/blob:Blob")
{
// Assets can't directly go through the engine.
// We don't need them in the test, so blank out the property for now.
outputs.Remove("source");
}
// For a Storage Account...
if (args.Type == "azure:storage/account:Account")
{
// ... set its web endpoint property.
// Normally this would be calculated by Azure, so we have to mock it.
outputs.Add("primaryWebEndpoint", $"https://{args.Name}.web.core.windows.net");
}
// Default the resource ID to `{name}_id`.
// We could also format it as `/subscription/abc/resourceGroups/xyz/...` if that was important for tests.
args.Id ??= $"{args.Name}_id";
return Task.FromResult((args.Id, (object)outputs));
}
public Task<object> CallAsync(MockCallArgs args)
{
// We don't use this method in this particular test suite.
// Default to returning whatever we got as input.
return Task.FromResult((object)args);
}
}
}
|
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Testing;
namespace PulumiDemoTests
{
internal class Mocks : IMocks
{
public Task<(string id, object state)> NewResourceAsync(string type, string name, ImmutableDictionary<string, object> inputs, string provider, string id)
{
var outputs = ImmutableDictionary.CreateBuilder<string, object>();
// Forward all input parameters as resource outputs, so that we could test them.
outputs.AddRange(inputs);
// Set the name to resource name if it's not set explicitly in inputs.
if (!inputs.ContainsKey("name"))
outputs.Add("name", name);
if (type == "azure:storage/blob:Blob")
{
// Assets can't directly go through the engine.
// We don't need them in the test, so blank out the property for now.
outputs.Remove("source");
}
// For a Storage Account...
if (type == "azure:storage/account:Account")
{
// ... set its web endpoint property.
// Normally this would be calculated by Azure, so we have to mock it.
outputs.Add("primaryWebEndpoint", $"https://{name}.web.core.windows.net");
}
// Default the resource ID to `{name}_id`.
// We could also format it as `/subscription/abc/resourceGroups/xyz/...` if that was important for tests.
id ??= $"{name}_id";
return Task.FromResult((id, (object)outputs));
}
public Task<object> CallAsync(string token, ImmutableDictionary<string, object> inputs, string provider)
{
// We don't use this method in this particular test suite.
// Default to returning whatever we got as input.
return Task.FromResult((object)inputs);
}
}
}
|
mit
|
C#
|
5786b067634f874a87e9b905db0b7777c91fb419
|
Fix little bug.
|
EusthEnoptEron/Sketchball
|
Sketchball/Controls/WPFContainer.cs
|
Sketchball/Controls/WPFContainer.cs
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using SizeChangedEventArgs = System.Windows.SizeChangedEventArgs;
namespace Sketchball.Controls
{
public class WPFContainer : ElementHost
{
private ManagedWPFControl Control;
private bool updating = false;
public WPFContainer(ManagedWPFControl control)
{
// Polyfill #1: When setting child <- control, the control will lose its dimensions.
double width = control.Width;
double height = control.Height;
Child = Control = control;
control.Width = width;
control.Height = height;
// --------------------------
// Polyfill #2: In order to get key events, we _explicitly_ need to focus the child control.
control.Focusable = true;
control.PreviewMouseDown += delegate
{
if (!control.IsFocused)
{
control.Focus();
}
};
AutoSize = true;
SetAutoSizeMode(AutoSizeMode.GrowAndShrink);
Disposed += (s,e) => {
Control.Exit();
};
}
protected override void OnResize(EventArgs e)
{
if (this.Dock == DockStyle.Fill)
{
Control.Width = Width;
Control.Height = Height;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using SizeChangedEventArgs = System.Windows.SizeChangedEventArgs;
namespace Sketchball.Controls
{
public class WPFContainer : ElementHost
{
private ManagedWPFControl Control;
private bool updating = false;
public WPFContainer(ManagedWPFControl control)
{
// Polyfill #1: When setting child <- control, the control will lose its dimensions.
double width = control.Width;
double height = control.Height;
Child = Control = control;
control.Width = width;
control.Height = height;
// --------------------------
// Polyfill #2: In order to get key events, we _explicitly_ need to focus the child control.
control.Focusable = true;
control.PreviewMouseDown += delegate
{
if (!control.IsFocused)
{
control.Focus();
}
};
AutoSize = true;
SetAutoSizeMode(AutoSizeMode.GrowAndShrink);
Disposed += (s,e) => {
Control.Exit();
};
}
}
}
|
mit
|
C#
|
c4130e4c193083a6bed5e1ed9a0c99f416c286df
|
Revert "Add SecurityZone stub" (#11053)
|
krytarowski/coreclr,James-Ko/coreclr,cmckinsey/coreclr,qiudesong/coreclr,mskvortsov/coreclr,ragmani/coreclr,mskvortsov/coreclr,cydhaselton/coreclr,mskvortsov/coreclr,krk/coreclr,JonHanna/coreclr,yizhang82/coreclr,hseok-oh/coreclr,alexperovich/coreclr,parjong/coreclr,wateret/coreclr,mmitche/coreclr,krytarowski/coreclr,krk/coreclr,cmckinsey/coreclr,gkhanna79/coreclr,cshung/coreclr,kyulee1/coreclr,russellhadley/coreclr,tijoytom/coreclr,cshung/coreclr,russellhadley/coreclr,rartemev/coreclr,mmitche/coreclr,gkhanna79/coreclr,jamesqo/coreclr,dpodder/coreclr,jamesqo/coreclr,qiudesong/coreclr,tijoytom/coreclr,cmckinsey/coreclr,gkhanna79/coreclr,russellhadley/coreclr,botaberg/coreclr,wtgodbe/coreclr,YongseopKim/coreclr,poizan42/coreclr,YongseopKim/coreclr,AlexGhiondea/coreclr,russellhadley/coreclr,pgavlin/coreclr,alexperovich/coreclr,wtgodbe/coreclr,botaberg/coreclr,yeaicc/coreclr,JonHanna/coreclr,ruben-ayrapetyan/coreclr,dpodder/coreclr,botaberg/coreclr,yeaicc/coreclr,ruben-ayrapetyan/coreclr,alexperovich/coreclr,russellhadley/coreclr,cshung/coreclr,pgavlin/coreclr,tijoytom/coreclr,krk/coreclr,mmitche/coreclr,krk/coreclr,JonHanna/coreclr,yeaicc/coreclr,wateret/coreclr,yizhang82/coreclr,sagood/coreclr,qiudesong/coreclr,mskvortsov/coreclr,yizhang82/coreclr,botaberg/coreclr,jamesqo/coreclr,yizhang82/coreclr,dpodder/coreclr,krytarowski/coreclr,russellhadley/coreclr,wtgodbe/coreclr,pgavlin/coreclr,ruben-ayrapetyan/coreclr,YongseopKim/coreclr,hseok-oh/coreclr,James-Ko/coreclr,cydhaselton/coreclr,kyulee1/coreclr,jamesqo/coreclr,James-Ko/coreclr,alexperovich/coreclr,dpodder/coreclr,tijoytom/coreclr,ragmani/coreclr,cshung/coreclr,gkhanna79/coreclr,poizan42/coreclr,krk/coreclr,rartemev/coreclr,parjong/coreclr,JosephTremoulet/coreclr,cmckinsey/coreclr,AlexGhiondea/coreclr,kyulee1/coreclr,ragmani/coreclr,pgavlin/coreclr,wtgodbe/coreclr,rartemev/coreclr,kyulee1/coreclr,rartemev/coreclr,kyulee1/coreclr,JosephTremoulet/coreclr,parjong/coreclr,kyulee1/coreclr,jamesqo/coreclr,AlexGhiondea/coreclr,mskvortsov/coreclr,mskvortsov/coreclr,hseok-oh/coreclr,wtgodbe/coreclr,cydhaselton/coreclr,wtgodbe/coreclr,ruben-ayrapetyan/coreclr,qiudesong/coreclr,AlexGhiondea/coreclr,poizan42/coreclr,AlexGhiondea/coreclr,krk/coreclr,rartemev/coreclr,JonHanna/coreclr,wateret/coreclr,hseok-oh/coreclr,cmckinsey/coreclr,JosephTremoulet/coreclr,pgavlin/coreclr,ragmani/coreclr,JosephTremoulet/coreclr,ruben-ayrapetyan/coreclr,parjong/coreclr,poizan42/coreclr,alexperovich/coreclr,yeaicc/coreclr,pgavlin/coreclr,sagood/coreclr,YongseopKim/coreclr,ruben-ayrapetyan/coreclr,hseok-oh/coreclr,parjong/coreclr,JonHanna/coreclr,parjong/coreclr,AlexGhiondea/coreclr,wateret/coreclr,cmckinsey/coreclr,jamesqo/coreclr,YongseopKim/coreclr,krytarowski/coreclr,tijoytom/coreclr,yizhang82/coreclr,ragmani/coreclr,yizhang82/coreclr,gkhanna79/coreclr,yeaicc/coreclr,krytarowski/coreclr,poizan42/coreclr,JosephTremoulet/coreclr,poizan42/coreclr,JonHanna/coreclr,dpodder/coreclr,James-Ko/coreclr,alexperovich/coreclr,dpodder/coreclr,qiudesong/coreclr,tijoytom/coreclr,krytarowski/coreclr,botaberg/coreclr,James-Ko/coreclr,mmitche/coreclr,cshung/coreclr,cydhaselton/coreclr,sagood/coreclr,JosephTremoulet/coreclr,hseok-oh/coreclr,qiudesong/coreclr,cshung/coreclr,cmckinsey/coreclr,sagood/coreclr,James-Ko/coreclr,cydhaselton/coreclr,YongseopKim/coreclr,cydhaselton/coreclr,sagood/coreclr,gkhanna79/coreclr,ragmani/coreclr,sagood/coreclr,mmitche/coreclr,wateret/coreclr,mmitche/coreclr,botaberg/coreclr,rartemev/coreclr,yeaicc/coreclr,yeaicc/coreclr,wateret/coreclr
|
src/mscorlib/shared/System/Security/SecurityException.cs
|
src/mscorlib/shared/System/Security/SecurityException.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Reflection;
using System.Runtime.Serialization;
namespace System.Security
{
[Serializable]
public class SecurityException : SystemException
{
public SecurityException()
: base(SR.Arg_SecurityException)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message, Exception inner)
: base(message, inner)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message, Type type)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
PermissionType = type;
}
public SecurityException(string message, Type type, string state)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
PermissionType = type;
PermissionState = state;
}
protected SecurityException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
public override string ToString() => base.ToString();
public override void GetObjectData(SerializationInfo info, StreamingContext context) => base.GetObjectData(info, context);
public object Demanded { get; set; }
public object DenySetInstance { get; set; }
public AssemblyName FailedAssemblyInfo { get; set; }
public string GrantedSet { get; set; }
public MethodInfo Method { get; set; }
public string PermissionState { get; set; }
public Type PermissionType { get; set; }
public object PermitOnlySetInstance { get; set; }
public string RefusedSet { get; set; }
public string Url { get; set; }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Reflection;
using System.Runtime.Serialization;
namespace System.Security
{
[Serializable]
public class SecurityException : SystemException
{
public SecurityException()
: base(SR.Arg_SecurityException)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message, Exception inner)
: base(message, inner)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message, Type type)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
PermissionType = type;
}
public SecurityException(string message, Type type, string state)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
PermissionType = type;
PermissionState = state;
}
protected SecurityException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
public override string ToString() => base.ToString();
public override void GetObjectData(SerializationInfo info, StreamingContext context) => base.GetObjectData(info, context);
public object Demanded { get; set; }
public object DenySetInstance { get; set; }
public AssemblyName FailedAssemblyInfo { get; set; }
public string GrantedSet { get; set; }
public MethodInfo Method { get; set; }
public string PermissionState { get; set; }
public Type PermissionType { get; set; }
public object PermitOnlySetInstance { get; set; }
public string RefusedSet { get; set; }
public string Url { get; set; }
public SecurityZone Zone { get; set; }
}
public enum SecurityZone
{
MyComputer = 0,
Intranet = 1,
Trusted = 2,
Internet = 3,
Untrusted = 4,
NoZone = -1
}
}
|
mit
|
C#
|
c33d4a25771ad2c0e9e06416bfe3309ebb950b17
|
change unix timestamp handling
|
iolevel/peachpie,iolevel/peachpie,iolevel/peachpie,peachpiecompiler/peachpie,iolevel/peachpie-concept,peachpiecompiler/peachpie,peachpiecompiler/peachpie,iolevel/peachpie-concept,iolevel/peachpie-concept
|
src/Peachpie.Runtime/Utilities/DateTimeUtils.cs
|
src/Peachpie.Runtime/Utilities/DateTimeUtils.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Pchp.Core.Utilities
{
public static class DateTimeUtils
{
/// <summary>
/// Time 0 in terms of Unix TimeStamp.
/// </summary>
public static readonly DateTime/*!*/UtcStartOfUnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
/// <summary>
/// Converts <see cref="DateTime"/> representing UTC time to UNIX timestamp.
/// </summary>
/// <param name="dt">Time.</param>
/// <returns>Unix timestamp.</returns>
public static long UtcToUnixTimeStamp(DateTime dt)
{
double seconds = UtcToUnixTimeStampFloat(dt);
if (seconds < long.MinValue)
return long.MinValue;
if (seconds > long.MaxValue)
return long.MaxValue;
return (long)seconds;
}
public static double UtcToUnixTimeStampFloat(DateTime dt)
{
return (dt - UtcStartOfUnixEpoch).TotalSeconds;
}
/// <summary>
/// Converts UNIX timestamp to <see cref="DateTime"/> representing UTC time.
/// </summary>
/// <param name="ts">Unix timestamp.</param>
/// <returns>Time.</returns>
public static DateTime UnixTimeStampToUtc(long ts)
{
return DateTimeOffset.FromUnixTimeSeconds(ts).UtcDateTime;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Pchp.Core.Utilities
{
public static class DateTimeUtils
{
/// <summary>
/// Time 0 in terms of Unix TimeStamp.
/// </summary>
public static readonly DateTime/*!*/UtcStartOfUnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
/// <summary>
/// Converts <see cref="DateTime"/> representing UTC time to UNIX timestamp.
/// </summary>
/// <param name="dt">Time.</param>
/// <returns>Unix timestamp.</returns>
public static long UtcToUnixTimeStamp(DateTime dt)
{
double seconds = UtcToUnixTimeStampFloat(dt);
if (seconds < long.MinValue)
return long.MinValue;
if (seconds > long.MaxValue)
return long.MaxValue;
return (long)seconds;
}
public static double UtcToUnixTimeStampFloat(DateTime dt)
{
return (dt - UtcStartOfUnixEpoch).TotalSeconds;
}
/// <summary>
/// Converts UNIX timestamp to <see cref="DateTime"/> representing UTC time.
/// </summary>
/// <param name="ts">Unix timestamp.</param>
/// <returns>Time.</returns>
public static DateTime UnixTimeStampToUtc(long ts)
{
return ts == 0 ? DateTime.MinValue : DateTimeOffset.FromUnixTimeSeconds(ts).UtcDateTime;
}
}
}
|
apache-2.0
|
C#
|
e122c4c4f06a522ed093675bc4f4786b8654d06e
|
Rename xy to ab.
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi/Crypto/GroupElement.cs
|
WalletWasabi/Crypto/GroupElement.cs
|
using NBitcoin.Secp256k1;
using System;
using System.Collections.Generic;
using System.Text;
using WalletWasabi.Helpers;
namespace WalletWasabi.Crypto
{
public class GroupElement : IEquatable<GroupElement>
{
public GroupElement(GE groupElement)
{
if (groupElement.IsInfinity)
{
Ge = GE.Infinity;
}
else
{
Guard.True($"{nameof(groupElement)}.{nameof(groupElement.IsValidVariable)}", groupElement.IsValidVariable);
Ge = groupElement;
}
}
public GroupElement(GEJ groupElement)
: this(groupElement.ToGroupElement())
{
}
public static GroupElement Infinity { get; } = new GroupElement(GE.Infinity);
private GE Ge { get; }
public bool IsInfinity => Ge.IsInfinity;
public override bool Equals(object obj) => Equals(obj as GroupElement);
public bool Equals(GroupElement other) => this == other;
public override int GetHashCode() => Ge.GetHashCode();
public static bool operator ==(GroupElement a, GroupElement b)
{
if (a is null && b is null)
{
return true;
}
else if (a is null || b is null)
{
return false;
}
else if (a.IsInfinity && b.IsInfinity)
{
return true;
}
else
{
return a.IsInfinity == b.IsInfinity && a.Ge.x == b.Ge.x && a.Ge.y == b.Ge.y;
}
}
public static bool operator !=(GroupElement a, GroupElement b) => !(a == b);
}
}
|
using NBitcoin.Secp256k1;
using System;
using System.Collections.Generic;
using System.Text;
using WalletWasabi.Helpers;
namespace WalletWasabi.Crypto
{
public class GroupElement : IEquatable<GroupElement>
{
public GroupElement(GE groupElement)
{
if (groupElement.IsInfinity)
{
Ge = GE.Infinity;
}
else
{
Guard.True($"{nameof(groupElement)}.{nameof(groupElement.IsValidVariable)}", groupElement.IsValidVariable);
Ge = groupElement;
}
}
public GroupElement(GEJ groupElement)
: this(groupElement.ToGroupElement())
{
}
public static GroupElement Infinity { get; } = new GroupElement(GE.Infinity);
private GE Ge { get; }
public bool IsInfinity => Ge.IsInfinity;
public override bool Equals(object obj) => Equals(obj as GroupElement);
public bool Equals(GroupElement other) => this == other;
public override int GetHashCode() => Ge.GetHashCode();
public static bool operator ==(GroupElement x, GroupElement y)
{
if (x is null && y is null)
{
return true;
}
else if (x is null || y is null)
{
return false;
}
else if (x.IsInfinity && y.IsInfinity)
{
return true;
}
else
{
return x.IsInfinity == y.IsInfinity && x.Ge.x == y.Ge.x && x.Ge.y == y.Ge.y;
}
}
public static bool operator !=(GroupElement x, GroupElement y) => !(x == y);
}
}
|
mit
|
C#
|
26802cac4deaa6267968b54ee043ecac7b5f3904
|
fix appveyor test-run
|
MaceWindu/linq2db,linq2db/linq2db,LinqToDB4iSeries/linq2db,LinqToDB4iSeries/linq2db,linq2db/linq2db,ronnyek/linq2db,MaceWindu/linq2db
|
Tests/Linq/UserTests/Issue1363Tests.cs
|
Tests/Linq/UserTests/Issue1363Tests.cs
|
using LinqToDB;
using LinqToDB.Mapping;
using NUnit.Framework;
using System;
using System.Linq;
namespace Tests.UserTests
{
/// <summary>
/// Test fixes to Issue #1305.
/// Before fix fields in derived tables were added first in the column order by <see cref="DataExtensions.CreateTable{T}(IDataContext, string, string, string, string, string, LinqToDB.SqlQuery.DefaultNullable)"/>.
/// </summary>
[TestFixture]
public class Issue1363Tests : TestBase
{
[Table("Issue1363")]
public sealed class Issue1363Record
{
[Column("required_field")]
public Guid Required { get; set; }
[Column("optional_field")]
public Guid? Optional { get; set; }
}
// TODO: sqlce,mysql - need to add default db type for create table for Guid
[Test]
public void TestInsert([DataSources(ProviderName.Access, ProviderName.SqlCe, ProviderName.MySql, TestProvName.MariaDB, TestProvName.MySql57)] string context)
{
using (var db = GetDataContext(context))
using (var tbl = db.CreateLocalTable<Issue1363Record>())
{
var id1 = Guid.NewGuid();
var id2 = Guid.NewGuid();
insert(id1, null);
insert(id2, id1);
var record = tbl.Where(_ => _.Required == id2).Single();
Assert.AreEqual(id1, record.Optional);
void insert(Guid id, Guid? testId)
{
tbl.Insert(() => new Issue1363Record()
{
Required = id,
Optional = tbl.Where(_ => _.Required == testId).Select(_ => (Guid?)_.Required).SingleOrDefault()
});
}
}
}
}
}
|
using LinqToDB;
using LinqToDB.Mapping;
using NUnit.Framework;
using System;
using System.Linq;
namespace Tests.UserTests
{
/// <summary>
/// Test fixes to Issue #1305.
/// Before fix fields in derived tables were added first in the column order by <see cref="DataExtensions.CreateTable{T}(IDataContext, string, string, string, string, string, LinqToDB.SqlQuery.DefaultNullable)"/>.
/// </summary>
[TestFixture]
public class Issue1363Tests : TestBase
{
[Table("Issue1363")]
public sealed class Issue1363Record
{
[Column("required_field")]
public Guid Required { get; set; }
[Column("optional_field")]
public Guid? Optional { get; set; }
}
// TODO: mysql - need to add default db type for create table for Guid
[Test]
public void TestInsert([DataSources(ProviderName.Access, ProviderName.MySql, TestProvName.MariaDB, TestProvName.MySql57)] string context)
{
using (var db = GetDataContext(context))
using (var tbl = db.CreateLocalTable<Issue1363Record>())
{
var id1 = Guid.NewGuid();
var id2 = Guid.NewGuid();
insert(id1, null);
insert(id2, id1);
var record = tbl.Where(_ => _.Required == id2).Single();
Assert.AreEqual(id1, record.Optional);
void insert(Guid id, Guid? testId)
{
tbl.Insert(() => new Issue1363Record()
{
Required = id,
Optional = tbl.Where(_ => _.Required == testId).Select(_ => (Guid?)_.Required).SingleOrDefault()
});
}
}
}
}
}
|
mit
|
C#
|
de149d6078cf15286a5628c9b79576a78a4916b6
|
Support for device orientation changing at runtime
|
cybergen/bri-lib
|
BriLib/Scripts/UI/UIManager.cs
|
BriLib/Scripts/UI/UIManager.cs
|
using System;
using UnityEngine;
namespace BriLib
{
/// <summary>
/// Primary entry point for all UI. Used to show and hide panels placed at different
/// onscreen regions.
/// </summary>
public class UIManager : Singleton<UIManager>
{
public static Region Header { get { return Instance._header; } }
public static Region Footer { get { return Instance._footer; } }
public static Region Body { get { return Instance._body; } }
public static Region Overlay { get { return Instance._overlay; } }
[SerializeField] private Region _header;
[SerializeField] private Region _footer;
[SerializeField] private Region _body;
[SerializeField] private Region _overlay;
[SerializeField] private RectTransform _regionContainer;
[SerializeField] private GameObject _interactionBlocker;
private Vector2 _currentScreenSize;
private Rect _safeArea;
/// <summary>
/// Controls an interaction blocker that will intercept touch events
/// </summary>
/// <param name="interactable"></param>
public static void SetInteractable(bool interactable)
{
Instance._interactionBlocker.SetActive(!interactable);
}
/// <summary>
/// Tell all regions to hide their current screens
/// </summary>
public static void HideAll()
{
Header.HidePanel();
Footer.HidePanel();
Body.HidePanel();
Overlay.HidePanel();
}
/// <summary>
/// On initialization, UIManager will update positions/sizes of main canvas based on safeArea for notched devices
/// target device
/// </summary>
public override void Begin()
{
base.Begin();
_currentScreenSize = new Vector2(Screen.width, Screen.height);
_safeArea = Screen.safeArea;
SetSafeArea();
}
private void SetSafeArea()
{
//https://forum.unity.com/threads/canvashelper-resizes-a-recttransform-to-iphone-xs-safe-area.521107/
var safeArea = Screen.safeArea;
var screenSize = new Vector2(Screen.width, Screen.height);
var anchorMin = safeArea.position;
var anchorMax = safeArea.position + safeArea.size;
anchorMin.x /= screenSize.x;
anchorMin.y /= screenSize.y;
anchorMax.x /= screenSize.x;
anchorMax.y /= screenSize.y;
LogManager.Info("SAFE AREA: " + safeArea);
LogManager.Info("ORIGINAL SCREEN SIZE: " + screenSize);
_regionContainer.anchorMin = anchorMin;
_regionContainer.anchorMax = anchorMax;
}
private void Update()
{
var newSize = new Vector2(Screen.width, Screen.height);
if (_currentScreenSize != newSize)
{
LogManager.Info("DEVICE ORIENTATION CHANGED, RECALCULATING SCREEN SIZE");
_currentScreenSize = newSize;
_safeArea = Screen.safeArea;
SetSafeArea();
}
}
}
}
|
using UnityEngine;
namespace BriLib
{
/// <summary>
/// Primary entry point for all UI. Used to show and hide panels placed at different
/// onscreen regions.
/// </summary>
public class UIManager : Singleton<UIManager>
{
public static Region Header { get { return Instance._header; } }
public static Region Footer { get { return Instance._footer; } }
public static Region Body { get { return Instance._body; } }
public static Region Overlay { get { return Instance._overlay; } }
[SerializeField] private Region _header;
[SerializeField] private Region _footer;
[SerializeField] private Region _body;
[SerializeField] private Region _overlay;
[SerializeField] private RectTransform _regionContainer;
[SerializeField] private GameObject _interactionBlocker;
/// <summary>
/// Controls an interaction blocker that will intercept touch events
/// </summary>
/// <param name="interactable"></param>
public static void SetInteractable(bool interactable)
{
Instance._interactionBlocker.SetActive(!interactable);
}
/// <summary>
/// Tell all regions to hide their current screens
/// </summary>
public static void HideAll()
{
Header.HidePanel();
Footer.HidePanel();
Body.HidePanel();
Overlay.HidePanel();
}
/// <summary>
/// On initialization, UIManager will update positions/sizes of main canvas based on safeArea for notched devices
/// target device
/// </summary>
public override void Begin()
{
base.Begin();
//https://github.com/Goropocha/UniSafeAreaAdjuster/blob/master/UniSafeAreaAdjuster/Assets/UniSafeAreaAdjuster/SafeAreaAdjuster.cs
var safeArea = Screen.safeArea;
var screenSize = new Vector2(Screen.width, Screen.height);
var anchorMin = safeArea.position;
var anchorMax = safeArea.position + safeArea.size;
anchorMin.x /= screenSize.x;
anchorMin.y /= screenSize.y;
anchorMax.x /= screenSize.x;
anchorMax.y /= screenSize.y;
_regionContainer.anchorMin = anchorMin;
_regionContainer.anchorMax = anchorMax;
}
}
}
|
mit
|
C#
|
7d1d765487d3a718b2d0027c986f1c73e18d6bcb
|
Update AddingAnonymousCustomObject.cs
|
asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/CSharp/Articles/AddingAnonymousCustomObject.cs
|
Examples/CSharp/Articles/AddingAnonymousCustomObject.cs
|
using System.IO;
using Aspose.Cells;
using System;
using System.Collections;
namespace Aspose.Cells.Examples.Articles
{
//ExStart:1
public class AddingAnonymousCustomObject
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Open a designer workbook
WorkbookDesigner designer = new WorkbookDesigner();
//get worksheet Cells collection
Cells cells = designer.Workbook.Worksheets[0].Cells;
//Set Cell Values
cells["A1"].PutValue("Name");
cells["B1"].PutValue("Age");
//Set markers
cells["A2"].PutValue("&=Person.Name");
cells["B2"].PutValue("&=Person.Age");
//Create Array list
ArrayList list = new ArrayList();
//add custom objects to the list
list.Add(new Person("Simon", 30));
list.Add(new Person("Johnson", 33));
//add designer's datasource
designer.SetDataSource("Person", list);
//process designer
designer.Process(false);
//save the resultant file
designer.Workbook.Save(dataDir+ "result.out.xls");
}
}
}
public class Person
{
public String Name;
public int Age;
internal Person(string name,int age)
{
this.Name = name;
this.Age = age;
}
}
//ExEnd:1
|
using System.IO;
using Aspose.Cells;
using System;
using System.Collections;
namespace Aspose.Cells.Examples.Articles
{
public class AddingAnonymousCustomObject
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Open a designer workbook
WorkbookDesigner designer = new WorkbookDesigner();
//get worksheet Cells collection
Cells cells = designer.Workbook.Worksheets[0].Cells;
//Set Cell Values
cells["A1"].PutValue("Name");
cells["B1"].PutValue("Age");
//Set markers
cells["A2"].PutValue("&=Person.Name");
cells["B2"].PutValue("&=Person.Age");
//Create Array list
ArrayList list = new ArrayList();
//add custom objects to the list
list.Add(new Person("Simon", 30));
list.Add(new Person("Johnson", 33));
//add designer's datasource
designer.SetDataSource("Person", list);
//process designer
designer.Process(false);
//save the resultant file
designer.Workbook.Save(dataDir+ "result.out.xls");
}
}
}
public class Person
{
public String Name;
public int Age;
internal Person(string name,int age)
{
this.Name = name;
this.Age = age;
}
}
|
mit
|
C#
|
9b76fa95aa7be2b4a46adbde751cad18ee78a171
|
Fix EmptyContainer graph action for items
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
|
Content.Server/Construction/Completions/EmptyContainer.cs
|
Content.Server/Construction/Completions/EmptyContainer.cs
|
#nullable enable
using System.Threading.Tasks;
using Content.Shared.Construction;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
public class EmptyContainer : IGraphAction
{
public string Container { get; private set; } = string.Empty;
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.Container, "container", string.Empty);
}
public async Task PerformAction(IEntity entity, IEntity? user)
{
if (entity.Deleted) return;
if (!entity.TryGetComponent(out ContainerManagerComponent? containerManager) ||
!containerManager.TryGetContainer(Container, out var container)) return;
container.EmptyContainer(true, entity.Transform.Coordinates);
entity.Transform.AttachToGridOrMap();
}
}
}
|
#nullable enable
using System.Threading.Tasks;
using Content.Shared.Construction;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
public class EmptyContainer : IGraphAction
{
public string Container { get; private set; } = string.Empty;
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.Container, "container", string.Empty);
}
public async Task PerformAction(IEntity entity, IEntity? user)
{
if (entity.Deleted) return;
if (!entity.TryGetComponent(out ContainerManagerComponent? containerManager) ||
!containerManager.TryGetContainer(Container, out var container)) return;
container.EmptyContainer(true, entity.Transform.Coordinates);
}
}
}
|
mit
|
C#
|
7ee81fa181ad509b6f904dad227b006a92f4d140
|
Tweak FastActivator
|
cnblogs/EnyimMemcachedCore,cnblogs/EnyimMemcachedCore
|
Enyim.Caching/FastActivator.cs
|
Enyim.Caching/FastActivator.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
using System.Threading;
using System.Linq.Expressions;
namespace Enyim.Reflection
{
/// <summary>
/// <para>Implements a very fast object factory for dynamic object creation. Dynamically generates a factory class which will use the new() constructor of the requested type.</para>
/// <para>Much faster than using Activator at the price of the first invocation being significantly slower than subsequent calls.</para>
/// </summary>
public static class FastActivator
{
private static Dictionary<Type, Func<object>> factoryCache = new Dictionary<Type, Func<object>>();
/// <summary>
/// Creates an instance of the specified type using a generated factory to avoid using Reflection.
/// </summary>
/// <typeparam name="T">The type to be created.</typeparam>
/// <returns>The newly created instance.</returns>
public static T Create<T>()
{
return TypeFactory<T>.Create();
}
/// <summary>
/// Creates an instance of the specified type using a generated factory to avoid using Reflection.
/// </summary>
/// <param name="type">The type to be created.</param>
/// <returns>The newly created instance.</returns>
public static object Create(Type type)
{
Func<object> f;
if (!factoryCache.TryGetValue(type, out f))
{
lock (factoryCache)
if (!factoryCache.TryGetValue(type, out f))
{
f = Expression.Lambda<Func<object>>(Expression.New(type)).Compile();
if (f != null)
{
factoryCache[type] = f;
}
}
}
return f();
}
private static class TypeFactory<T>
{
public static readonly Func<T> Create = Expression.Lambda<Func<T>>(Expression.New(typeof(T))).Compile();
}
}
}
#region [ License information ]
/* ************************************************************
*
* Copyright (c) 2010 Attila Kisk? enyim.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ************************************************************/
#endregion
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
using System.Threading;
using System.Linq.Expressions;
namespace Enyim.Reflection
{
/// <summary>
/// <para>Implements a very fast object factory for dynamic object creation. Dynamically generates a factory class which will use the new() constructor of the requested type.</para>
/// <para>Much faster than using Activator at the price of the first invocation being significantly slower than subsequent calls.</para>
/// </summary>
public static class FastActivator
{
private static Dictionary<Type, Func<object>> factoryCache = new Dictionary<Type, Func<object>>();
/// <summary>
/// Creates an instance of the specified type using a generated factory to avoid using Reflection.
/// </summary>
/// <typeparam name="T">The type to be created.</typeparam>
/// <returns>The newly created instance.</returns>
public static T Create<T>()
{
return TypeFactory<T>.Create();
}
/// <summary>
/// Creates an instance of the specified type using a generated factory to avoid using Reflection.
/// </summary>
/// <param name="type">The type to be created.</param>
/// <returns>The newly created instance.</returns>
public static object Create(Type type)
{
Func<object> f;
if (!factoryCache.TryGetValue(type, out f))
lock (factoryCache)
if (!factoryCache.TryGetValue(type, out f))
{
factoryCache[type] = f = Expression.Lambda<Func<object>>(Expression.New(type)).Compile();
}
return f();
}
private static class TypeFactory<T>
{
public static readonly Func<T> Create = Expression.Lambda<Func<T>>(Expression.New(typeof(T))).Compile();
}
}
}
#region [ License information ]
/* ************************************************************
*
* Copyright (c) 2010 Attila Kisk? enyim.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ************************************************************/
#endregion
|
apache-2.0
|
C#
|
7d0cadc69638b0f90a612593ad57cb614934802a
|
update version
|
prodot/ReCommended-Extension
|
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
|
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
|
using System.Reflection;
using ReCommendedExtension;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2022 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.7.5.0")]
[assembly: AssemblyFileVersion("5.7.5")]
|
using System.Reflection;
using ReCommendedExtension;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2022 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.7.4.0")]
[assembly: AssemblyFileVersion("5.7.4")]
|
apache-2.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.