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 |
|---|---|---|---|---|---|---|---|---|
baaaf67c681f78a9a08f99d549100c8ced66b8b1
|
Load system web assembly before running do not use system web assembly analyzer tests
|
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
|
BitTools/BitCodeAnalyzer.Test/SystemAnalyzers/WebAnalyzers/DoNotUseSystemWebAssemblyAnalyzerTests.cs
|
BitTools/BitCodeAnalyzer.Test/SystemAnalyzers/WebAnalyzers/DoNotUseSystemWebAssemblyAnalyzerTests.cs
|
using System;
using System.Reflection;
using BitCodeAnalyzer.SystemAnalyzers.WebAnalyzers;
using BitCodeAnalyzer.Test.Helpers;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
namespace BitCodeAnalyzer.Test.SystemAnalyzers.WebAnalyzers
{
[TestClass]
public class DoNotUseSystemWebAssemblyAnalyzerTests : CodeFixVerifier
{
[TestMethod]
[TestCategory("Analyzer")]
public async Task FindSystemWebUsages()
{
Assembly.Load("System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
const string sourceCodeWithSystemWebUsage = @"
using System;
namespace MyNamespace
{
class MyClass
{
public MyClass()
{
bool isHosted = System.Web.Hosting.HostingEnvironment.IsHosted;
}
}
}";
DiagnosticResult firstSystemWebUsage = new DiagnosticResult
{
Id = nameof(DoNotUseSystemWebAssemblyAnalyzer),
Message = DoNotUseSystemWebAssemblyAnalyzer.Message,
Severity = DiagnosticSeverity.Error,
Locations = new[] { new DiagnosticResultLocation(10, 52) }
};
await VerifyCSharpDiagnostic(sourceCodeWithSystemWebUsage, firstSystemWebUsage);
}
protected override CodeFixProvider GetCSharpCodeFixProvider()
{
throw new NotImplementedException();
}
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new DoNotUseSystemWebAssemblyAnalyzer();
}
}
}
|
using System;
using System.Reflection;
using System.Web.Hosting;
using BitCodeAnalyzer.SystemAnalyzers.WebAnalyzers;
using BitCodeAnalyzer.Test.Helpers;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
namespace BitCodeAnalyzer.Test.SystemAnalyzers.WebAnalyzers
{
[TestClass]
public class DoNotUseSystemWebAssemblyAnalyzerTests : CodeFixVerifier
{
[TestMethod]
[TestCategory("Analyzer")]
public async Task FindSystemWebUsages()
{
typeof(HostingEnvironment).GetTypeInfo();
const string sourceCodeWithSystemWebUsage = @"
using System;
namespace MyNamespace
{
class MyClass
{
public MyClass()
{
bool isHosted = System.Web.Hosting.HostingEnvironment.IsHosted;
}
}
}";
DiagnosticResult firstSystemWebUsage = new DiagnosticResult
{
Id = nameof(DoNotUseSystemWebAssemblyAnalyzer),
Message = DoNotUseSystemWebAssemblyAnalyzer.Message,
Severity = DiagnosticSeverity.Error,
Locations = new[] { new DiagnosticResultLocation(10, 52) }
};
await VerifyCSharpDiagnostic(sourceCodeWithSystemWebUsage, firstSystemWebUsage);
}
protected override CodeFixProvider GetCSharpCodeFixProvider()
{
throw new NotImplementedException();
}
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new DoNotUseSystemWebAssemblyAnalyzer();
}
}
}
|
mit
|
C#
|
c41b746ff5dae5aa9e30e00ec213c5d32fad8c4b
|
refactor MediaContentHomeViewModel
|
Borayvor/ASP.NET-MVC-CourseProject,Borayvor/ASP.NET-MVC-CourseProject,Borayvor/ASP.NET-MVC-CourseProject
|
EntertainmentSystem/Web/EntertainmentSystem.Web/ViewModels/MediaContent/MediaContentHomeViewModel.cs
|
EntertainmentSystem/Web/EntertainmentSystem.Web/ViewModels/MediaContent/MediaContentHomeViewModel.cs
|
namespace EntertainmentSystem.Web.ViewModels.MediaContent
{
using Data.Models.Media;
using Infrastructure.Mapping;
public class MediaContentHomeViewModel : IMapFrom<MediaContent>
{
public string Title { get; set; }
public string Description { get; set; }
public string ContentUrl { get; set; }
public ContentType ContentType { get; set; }
}
}
|
namespace EntertainmentSystem.Web.ViewModels.MediaContent
{
using Data.Models.Media;
using Infrastructure.Mapping;
public class MediaContentHomeViewModel : IMapFrom<MediaContent>
{
public string ContentUrl { get; set; }
public ContentType ContentType { get; set; }
}
}
|
mit
|
C#
|
fee67c8214c997fbbcb92828689524478a7bfbd3
|
Update GenericPersister.cs
|
guilherme-otran/projeto-integrado-2-sem
|
projeto-integrado-2-sem/Interactors/GenericPersister.cs
|
projeto-integrado-2-sem/Interactors/GenericPersister.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using projeto_integrado_2_sem.Repositories;
using projeto_integrado_2_sem.Validators;
namespace projeto_integrado_2_sem.Interactors
{
class GenericPersister<T> where T : IStorable
{
private BaseRepository<T> repository;
private Validator<T>[] validators;
public GenericPersister(BaseRepository<T> repo, Validator<T>[] validators)
{
this.repository = repo;
this.validators = validators;
}
public bool persist(T record)
{
var results = validators.Select(v => v.Validate(record));
if (results.All(r => r.Valid()))
{
repository.persist(record);
}
return false;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using projeto_integrado_2_sem.Repositories;
using projeto_integrado_2_sem.Validators;
namespace projeto_integrado_2_sem.Interactors
{
class GenericPersister<T>
{
private BaseRepository<T> repository;
private Validator<T>[] validators;
public GenericPersister(BaseRepository<T> repo, Validator<T>[] validators)
{
this.repository = repo;
this.validators = validators;
}
public bool persist(T record)
{
var results = validators.Select(v => v.Validate(record));
if (results.All(r => r.Valid()))
{
repository.persist(record);
}
return false;
}
}
}
|
mit
|
C#
|
7d0c091559535e9ff37b61915297bd4c4b4cf8ba
|
Include method in cache key
|
selvasingh/azure-sdk-for-java,selvasingh/azure-sdk-for-java,Azure/azure-sdk-for-java,Azure/azure-sdk-for-java,selvasingh/azure-sdk-for-java,Azure/azure-sdk-for-java,Azure/azure-sdk-for-java,Azure/azure-sdk-for-java
|
HttpMock/RequestCacheKey.cs
|
HttpMock/RequestCacheKey.cs
|
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
namespace HttpMock
{
public class RequestCacheKey
{
public string Method { get; private set; }
public string Scheme { get; private set; }
public string Host { get; private set; }
public int? Port { get; private set; }
public string Path { get; private set; }
public string Query { get; private set; }
public KeyValuePair<string, StringValues>[] Headers { get; private set; }
public RequestCacheKey(HttpRequest request, IEnumerable<string> headers)
{
Method = request.Method;
Scheme = request.Scheme;
Host = request.Host.Host;
Port = request.Host.Port;
Path = request.Path.Value;
Query = request.QueryString.Value;
Headers = request.Headers.Where(h => headers.Contains(h.Key)).ToArray();
}
public override int GetHashCode()
{
var hash = new HashCode();
hash.Add(Method);
hash.Add(Scheme);
hash.Add(Host);
hash.Add(Port);
hash.Add(Path);
hash.Add(Query);
foreach (var h in Headers)
{
hash.Add(h.Key);
hash.Add(h.Value);
}
return hash.ToHashCode();
}
public override bool Equals(object obj)
{
return obj is RequestCacheKey other &&
Method == other.Method &&
Scheme == other.Scheme &&
Host == other.Host &&
Port == other.Port &&
Path == other.Path &&
Query == other.Query &&
Headers.SequenceEqual(other.Headers);
}
}
}
|
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
namespace HttpMock
{
public class RequestCacheKey
{
public string Scheme { get; private set; }
public string Host { get; private set; }
public int? Port { get; private set; }
public string Path { get; private set; }
public string Query { get; private set; }
public KeyValuePair<string, StringValues>[] Headers { get; private set; }
public RequestCacheKey(HttpRequest request, IEnumerable<string> headers)
{
Scheme = request.Scheme;
Host = request.Host.Host;
Port = request.Host.Port;
Path = request.Path.Value;
Query = request.QueryString.Value;
Headers = request.Headers.Where(h => headers.Contains(h.Key)).ToArray();
}
public override int GetHashCode()
{
var hash = new HashCode();
hash.Add(Scheme);
hash.Add(Host);
hash.Add(Port);
hash.Add(Path);
hash.Add(Query);
foreach (var h in Headers)
{
hash.Add(h.Key);
hash.Add(h.Value);
}
return hash.ToHashCode();
}
public override bool Equals(object obj)
{
return obj is RequestCacheKey other &&
Scheme == other.Scheme &&
Host == other.Host &&
Port == other.Port &&
Path == other.Path &&
Query == other.Query &&
Headers.SequenceEqual(other.Headers);
}
}
}
|
mit
|
C#
|
d7dee57886e98696247ceddf2a030bed46fe4e03
|
set can not be null in BeatmapSetCover.cs
|
naoey/osu,DrabWeb/osu,johnneijzen/osu,DrabWeb/osu,smoogipooo/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,naoey/osu,johnneijzen/osu,NeoAdonis/osu,ZLima12/osu,ppy/osu,2yangk23/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,EVAST9919/osu,naoey/osu,ppy/osu,Frontear/osuKyzer,2yangk23/osu,ZLima12/osu,UselessToucan/osu,peppy/osu,peppy/osu,Drezi126/osu,peppy/osu-new,Nabile-Rahmani/osu,smoogipoo/osu,DrabWeb/osu,smoogipoo/osu
|
osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs
|
osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Beatmaps.Drawables
{
public class BeatmapSetCover : Sprite
{
private readonly BeatmapSetInfo set;
public BeatmapSetCover(BeatmapSetInfo set)
{
if (set == null)
throw new ArgumentNullException(nameof(set));
this.set = set;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
string resource = set.OnlineInfo.Covers.Cover;
if (resource != null)
Texture = textures.Get(resource);
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Beatmaps.Drawables
{
public class BeatmapSetCover : Sprite
{
private readonly BeatmapSetInfo set;
public BeatmapSetCover(BeatmapSetInfo set)
{
this.set = set;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
string resource = set.OnlineInfo.Covers.Cover;
if (resource != null)
Texture = textures.Get(resource);
}
}
}
|
mit
|
C#
|
8104b15874c5b358c22f7d3f8d6fb9ac42b09b94
|
remove braces
|
NeoAdonis/osu,peppy/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu
|
osu.Game/Online/API/Requests/GetUserRequest.cs
|
osu.Game/Online/API/Requests/GetUserRequest.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Users;
using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests
{
public class GetUserRequest : APIRequest<User>
{
private readonly string userIdentifier;
public readonly RulesetInfo Ruleset;
public GetUserRequest()
{
}
public GetUserRequest(long? userId = null, RulesetInfo ruleset = null)
{
this.userIdentifier = userId.ToString();
Ruleset = ruleset;
}
public GetUserRequest(string username = null, RulesetInfo ruleset = null)
{
this.userIdentifier = username;
Ruleset = ruleset;
}
protected override string Target => userIdentifier != null ? $@"users/{userIdentifier}/{Ruleset?.ShortName}" : $@"me/{Ruleset?.ShortName}";
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Users;
using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests
{
public class GetUserRequest : APIRequest<User>
{
private readonly string userIdentifier;
public readonly RulesetInfo Ruleset;
public GetUserRequest()
{
}
public GetUserRequest(long? userId = null, RulesetInfo ruleset = null)
{
this.userIdentifier = userId.ToString();
Ruleset = ruleset;
}
public GetUserRequest(string username = null, RulesetInfo ruleset = null)
{
this.userIdentifier = username;
Ruleset = ruleset;
}
protected override string Target => (userIdentifier != null) ? $@"users/{userIdentifier}/{Ruleset?.ShortName}" : $@"me/{Ruleset?.ShortName}";
}
}
|
mit
|
C#
|
a17dfba83422f2283d261cb17ff118ca9f77c2c3
|
Add UnitTest for EditExpense#Date.
|
ProjectBlueMonkey/BlueMonkey,ProjectBlueMonkey/BlueMonkey
|
client/BlueMonkey/BlueMonkey.Model.Tests/EditExpenseTest.cs
|
client/BlueMonkey/BlueMonkey.Model.Tests/EditExpenseTest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BlueMonkey.ExpenseServices;
using BlueMonkey.MediaServices;
using BlueMonkey.TimeService;
using Moq;
using Xunit;
namespace BlueMonkey.Model.Tests
{
public class EditExpenseTest
{
[Fact]
public void NameProperty()
{
var expenseService = new Mock<IExpenseService>();
var fileUploadService = new Mock<IFileUploadService>();
var dateTimeService = new Mock<IDateTimeService>();
var mediaService = new Mock<IMediaService>();
var actual = new EditExpense(expenseService.Object, fileUploadService.Object, dateTimeService.Object, mediaService.Object);
Assert.Null(actual.Name);
Assert.PropertyChanged(actual, "Name", () => actual.Name = "update");
Assert.Equal("update", actual.Name);
}
[Fact]
public void AmountProperty()
{
var expenseService = new Mock<IExpenseService>();
var fileUploadService = new Mock<IFileUploadService>();
var dateTimeService = new Mock<IDateTimeService>();
var mediaService = new Mock<IMediaService>();
var actual = new EditExpense(expenseService.Object, fileUploadService.Object, dateTimeService.Object, mediaService.Object);
Assert.Equal(0, actual.Amount);
Assert.PropertyChanged(actual, "Amount", () => actual.Amount = 1);
Assert.Equal(1, actual.Amount);
}
[Fact]
public void DateProperty()
{
var expenseService = new Mock<IExpenseService>();
var fileUploadService = new Mock<IFileUploadService>();
var dateTimeService = new Mock<IDateTimeService>();
var mediaService = new Mock<IMediaService>();
var actual = new EditExpense(expenseService.Object, fileUploadService.Object, dateTimeService.Object, mediaService.Object);
Assert.Equal(default(DateTime), actual.Date);
Assert.PropertyChanged(actual, "Date", () => actual.Date = DateTime.MaxValue);
Assert.Equal(DateTime.MaxValue, actual.Date);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BlueMonkey.ExpenseServices;
using BlueMonkey.MediaServices;
using BlueMonkey.TimeService;
using Moq;
using Xunit;
namespace BlueMonkey.Model.Tests
{
public class EditExpenseTest
{
[Fact]
public void NameProperty()
{
var expenseService = new Mock<IExpenseService>();
var fileUploadService = new Mock<IFileUploadService>();
var dateTimeService = new Mock<IDateTimeService>();
var mediaService = new Mock<IMediaService>();
var actual = new EditExpense(expenseService.Object, fileUploadService.Object, dateTimeService.Object, mediaService.Object);
Assert.Null(actual.Name);
Assert.PropertyChanged(actual, "Name", () => actual.Name = "update");
Assert.Equal("update", actual.Name);
}
[Fact]
public void AmountProperty()
{
var expenseService = new Mock<IExpenseService>();
var fileUploadService = new Mock<IFileUploadService>();
var dateTimeService = new Mock<IDateTimeService>();
var mediaService = new Mock<IMediaService>();
var actual = new EditExpense(expenseService.Object, fileUploadService.Object, dateTimeService.Object, mediaService.Object);
Assert.Equal(0, actual.Amount);
Assert.PropertyChanged(actual, "Amount", () => actual.Amount = 1);
Assert.Equal(1, actual.Amount);
}
}
}
|
mit
|
C#
|
eea96125da4a9ca45149d42181ad416cfd40904d
|
fix bug about required password length doesnt match
|
joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net
|
src/JoinRpg.WebPortal.Models/ManageViewModels.cs
|
src/JoinRpg.WebPortal.Models/ManageViewModels.cs
|
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace JoinRpg.Web.Models
{
public class IndexViewModel
{
public bool HasPassword { get; set; }
public int LoginsCount { get; set; }
public string Email { get; set; }
}
public class FactorViewModel
{
public string Purpose { get; set; }
}
public class SetPasswordViewModel
{
[Required]
[StringLength(100, ErrorMessage = "{0} должен быть не короче {2} символов.", MinimumLength = 8)]
[DataType(DataType.Password)]
[Display(Name = "Новый пароль")]
public string NewPassword { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Еще раз")]
[Compare(nameof(NewPassword), ErrorMessage = "Пароли не совпадают")]
public string ConfirmPassword { get; set; }
}
public class ChangePasswordViewModel : SetPasswordViewModel
{
[Required]
[DataType(DataType.Password)]
[Display(Name = "Старый пароль")]
public string OldPassword { get; set; }
}
}
|
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace JoinRpg.Web.Models
{
public class IndexViewModel
{
public bool HasPassword { get; set; }
public int LoginsCount { get; set; }
public string Email { get; set; }
}
public class FactorViewModel
{
public string Purpose { get; set; }
}
public class SetPasswordViewModel
{
[Required]
[StringLength(100, ErrorMessage = "{0} должен быть не короче {2} символов.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Новый пароль")]
public string NewPassword { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Еще раз")]
[Compare(nameof(NewPassword), ErrorMessage = "Пароли не совпадают")]
public string ConfirmPassword { get; set; }
}
public class ChangePasswordViewModel : SetPasswordViewModel
{
[Required]
[DataType(DataType.Password)]
[Display(Name = "Старый пароль")]
public string OldPassword { get; set; }
}
}
|
mit
|
C#
|
a73c26da10e110f38a1499177215233c08359cef
|
drop the database if it exists at test setup
|
KaraokeStu/fluentmigrator,modulexcite/fluentmigrator,spaccabit/fluentmigrator,schambers/fluentmigrator,IRlyDontKnow/fluentmigrator,wolfascu/fluentmigrator,itn3000/fluentmigrator,bluefalcon/fluentmigrator,wolfascu/fluentmigrator,jogibear9988/fluentmigrator,fluentmigrator/fluentmigrator,igitur/fluentmigrator,tommarien/fluentmigrator,schambers/fluentmigrator,spaccabit/fluentmigrator,itn3000/fluentmigrator,amroel/fluentmigrator,vgrigoriu/fluentmigrator,lcharlebois/fluentmigrator,istaheev/fluentmigrator,MetSystem/fluentmigrator,alphamc/fluentmigrator,vgrigoriu/fluentmigrator,FabioNascimento/fluentmigrator,igitur/fluentmigrator,MetSystem/fluentmigrator,amroel/fluentmigrator,stsrki/fluentmigrator,drmohundro/fluentmigrator,FabioNascimento/fluentmigrator,alphamc/fluentmigrator,istaheev/fluentmigrator,jogibear9988/fluentmigrator,mstancombe/fluentmigrator,dealproc/fluentmigrator,barser/fluentmigrator,mstancombe/fluentmigrator,stsrki/fluentmigrator,akema-fr/fluentmigrator,IRlyDontKnow/fluentmigrator,modulexcite/fluentmigrator,drmohundro/fluentmigrator,lcharlebois/fluentmigrator,istaheev/fluentmigrator,akema-fr/fluentmigrator,dealproc/fluentmigrator,KaraokeStu/fluentmigrator,tommarien/fluentmigrator,fluentmigrator/fluentmigrator,bluefalcon/fluentmigrator,barser/fluentmigrator,eloekset/fluentmigrator,eloekset/fluentmigrator
|
src/FluentMigrator.Tests/Integration/Processors/Firebird/TestDisposing.cs
|
src/FluentMigrator.Tests/Integration/Processors/Firebird/TestDisposing.cs
|
using System.Data;
using FirebirdSql.Data.FirebirdClient;
using FluentMigrator.Expressions;
using FluentMigrator.Runner.Announcers;
using FluentMigrator.Runner.Generators.Firebird;
using FluentMigrator.Runner.Processors;
using FluentMigrator.Runner.Processors.Firebird;
using NUnit.Framework;
using NUnit.Should;
namespace FluentMigrator.Tests.Integration.Processors.Firebird
{
[TestFixture]
[Category("Integration")]
public class TestDisposing
{
private FbConnection _connection;
private FirebirdProcessor _processor;
[SetUp]
public void SetUp()
{
if (System.IO.File.Exists("fbtest.fdb"))
FbConnection.DropDatabase(IntegrationTestOptions.Firebird.ConnectionString);
FbConnection.CreateDatabase(IntegrationTestOptions.Firebird.ConnectionString);
_connection = new FbConnection(IntegrationTestOptions.Firebird.ConnectionString);
_processor = MakeProcessor();
_connection.Open();
_processor.BeginTransaction();
}
[TearDown]
public void TearDown()
{
if (!_processor.WasCommitted)
_processor.CommitTransaction();
_connection.Close();
FbConnection.ClearPool(_connection);
FbConnection.DropDatabase(IntegrationTestOptions.Firebird.ConnectionString);
}
[Test]
public void Dispose_WasCommited_ShouldNotRollback()
{
var createTable = new CreateTableExpression { TableName = "silly" };
createTable.Columns.Add(new Model.ColumnDefinition { Name = "one", Type = DbType.Int32 });
_processor.Process(createTable);
// this will close the connection
_processor.CommitTransaction();
// and this will reopen it again causing Dispose->RollbackTransaction not to throw
var tableExists = _processor.TableExists("", createTable.TableName);
tableExists.ShouldBeTrue();
// Now dispose (->RollbackTransaction)
_processor.Dispose();
_processor = MakeProcessor();
// Check that the table still exists after dispose
_processor.TableExists("", createTable.TableName).ShouldBeTrue();
}
private FirebirdProcessor MakeProcessor()
{
var options = FirebirdOptions.AutoCommitBehaviour();
return new FirebirdProcessor(_connection, new FirebirdGenerator(options), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions(), new FirebirdDbFactory(), options);
}
}
}
|
using System.Data;
using FirebirdSql.Data.FirebirdClient;
using FluentMigrator.Expressions;
using FluentMigrator.Runner.Announcers;
using FluentMigrator.Runner.Generators.Firebird;
using FluentMigrator.Runner.Processors;
using FluentMigrator.Runner.Processors.Firebird;
using NUnit.Framework;
using NUnit.Should;
namespace FluentMigrator.Tests.Integration.Processors.Firebird
{
[TestFixture]
[Category("Integration")]
public class TestDisposing
{
private FbConnection _connection;
private FirebirdProcessor _processor;
[SetUp]
public void SetUp()
{
FbConnection.CreateDatabase(IntegrationTestOptions.Firebird.ConnectionString);
_connection = new FbConnection(IntegrationTestOptions.Firebird.ConnectionString);
_processor = MakeProcessor();
_connection.Open();
_processor.BeginTransaction();
}
[TearDown]
public void TearDown()
{
if (!_processor.WasCommitted)
_processor.CommitTransaction();
_connection.Close();
FbConnection.ClearPool(_connection);
FbConnection.DropDatabase(IntegrationTestOptions.Firebird.ConnectionString);
}
[Test]
public void Dispose_WasCommited_ShouldNotRollback()
{
var createTable = new CreateTableExpression { TableName = "silly" };
createTable.Columns.Add(new Model.ColumnDefinition { Name = "one", Type = DbType.Int32 });
_processor.Process(createTable);
// this will close the connection
_processor.CommitTransaction();
// and this will reopen it again causing Dispose->RollbackTransaction not to throw
var tableExists = _processor.TableExists("", createTable.TableName);
tableExists.ShouldBeTrue();
// Now dispose (->RollbackTransaction)
_processor.Dispose();
_processor = MakeProcessor();
// Check that the table still exists after dispose
_processor.TableExists("", createTable.TableName).ShouldBeTrue();
}
private FirebirdProcessor MakeProcessor()
{
var options = FirebirdOptions.AutoCommitBehaviour();
return new FirebirdProcessor(_connection, new FirebirdGenerator(options), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions(), new FirebirdDbFactory(), options);
}
}
}
|
apache-2.0
|
C#
|
5e02a68886f55a82b5823e00e7a544fcc80aabfe
|
Increase assembly version to 1.1.
|
safakgur/Dawn.SocketAwaitable
|
src/Dawn.SocketAwaitable/Properties/AssemblyInfo.cs
|
src/Dawn.SocketAwaitable/Properties/AssemblyInfo.cs
|
// Copyright
// ----------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="https://github.com/safakgur/Dawn.SocketAwaitable">
// MIT
// </copyright>
// <license>
// This source code is subject to terms and conditions of The MIT License (MIT).
// A copy of the license can be found in the License.txt file at the root of this distribution.
// </license>
// <summary>
// Contains the attributes that provide information about the assembly.
// </summary>
// ----------------------------------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Dawn.SocketAwaitable")]
[assembly: AssemblyCompany("https://github.com/safakgur/Dawn.SocketAwaitable")]
[assembly: AssemblyDescription("Provides utilities for asynchronous socket operations.")]
[assembly: AssemblyProduct("Dawn Framework")]
[assembly: AssemblyCopyright("MIT")]
[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
|
// Copyright
// ----------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="https://github.com/safakgur/Dawn.SocketAwaitable">
// MIT
// </copyright>
// <license>
// This source code is subject to terms and conditions of The MIT License (MIT).
// A copy of the license can be found in the License.txt file at the root of this distribution.
// </license>
// <summary>
// Contains the attributes that provide information about the assembly.
// </summary>
// ----------------------------------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Dawn.SocketAwaitable")]
[assembly: AssemblyCompany("https://github.com/safakgur/Dawn.SocketAwaitable")]
[assembly: AssemblyDescription("Provides utilities for asynchronous socket operations.")]
[assembly: AssemblyProduct("Dawn Framework")]
[assembly: AssemblyCopyright("MIT")]
[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
|
mit
|
C#
|
bf4d5dd41d2602409b8798770486c6bff668cdfc
|
Add back error to trigger diagnostic
|
anjdreas/roslyn-analyzers
|
SampleConsoleApp/Program.cs
|
SampleConsoleApp/Program.cs
|
namespace SampleConsoleApp
{
internal static class Program
{
private static void Main(string[] args)
{
// ObjectInitializer_AssignAll enable
Foo foo = new Foo
{
//PropInt = 1,
// ObjectInitializer_AssignAll disable
Bar = new Bar
{
//PropInt = 2
}
};
}
private class Foo
{
public int PropInt { get; set; }
public Bar Bar { get; internal set; }
}
private class Bar
{
public int PropInt { get; set; }
}
}
}
|
namespace SampleConsoleApp
{
internal static class Program
{
private static void Main(string[] args)
{
// ObjectInitializer_AssignAll enable
Foo foo = new Foo
{
PropInt = 1,
// ObjectInitializer_AssignAll disable
Bar = new Bar
{
//PropInt = 2
}
};
}
private class Foo
{
public int PropInt { get; set; }
public Bar Bar { get; internal set; }
}
private class Bar
{
public int PropInt { get; set; }
}
}
}
|
mit
|
C#
|
51d0295fb9267fdef95139d558e2c23ffa1615df
|
Add xmldoc to mem layout attributes.
|
Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver
|
src/AsmResolver.DotNet/Memory/MemoryLayoutAttributes.cs
|
src/AsmResolver.DotNet/Memory/MemoryLayoutAttributes.cs
|
using System;
namespace AsmResolver.DotNet.Memory
{
/// <summary>
/// Defines members for all possible attributes that can be assigned to a <see cref="TypeMemoryLayout"/> instance.
/// </summary>
[Flags]
public enum MemoryLayoutAttributes
{
/// <summary>
/// Indicates the layout was determined assuming a 32-bit environment.
/// </summary>
Is32Bit = 0b0,
/// <summary>
/// Indicates the layout was determined assuming a 32-bit environment.
/// </summary>
Is64Bit = 0b1,
/// <summary>
/// Used to mask out the bitness of the type layout.
/// </summary>
BitnessMask = 0b1,
/// <summary>
/// Indicates the type layout depends on the bitness of the environment.
/// </summary>
IsPlatformDependent = 0b10,
}
}
|
using System;
namespace AsmResolver.DotNet.Memory
{
[Flags]
public enum MemoryLayoutAttributes
{
Is32Bit = 0b0,
Is64Bit = 0b1,
BitnessMask = 0b1,
IsPlatformDependent = 0b10,
}
}
|
mit
|
C#
|
b8d17eda255f2738a46b8929836bba66e524f5a1
|
Fix typo in ILogger.
|
CamTechConsultants/CvsntGitImporter
|
ILogger.cs
|
ILogger.cs
|
/*
* John Hall <john.hall@camtechconsultants.com>
* Copyright (c) Cambridge Technology Consultants Ltd. All rights reserved.
*/
using System;
namespace CvsGitConverter
{
/// <summary>
/// Application logging.
/// </summary>
interface ILogger
{
/// <summary>
/// Increase the indent for any following entries. When the returned object is disposed, the indent
/// is removed.
/// </summary>
IDisposable Indent();
/// <summary>
/// Draw a double line in the log file
/// </summary>
void DoubleRuleOff();
/// <summary>
/// Draw a single line in the log file
/// </summary>
void RuleOff();
/// <summary>
/// Write a blank line.
/// </summary>
void WriteLine();
/// <summary>
/// Write a line of text.
/// </summary>
void WriteLine(string line);
/// <summary>
/// Write a line of text.
/// </summary>
void WriteLine(string format, params object[] args);
}
}
|
/*
* John Hall <john.hall@camtechconsultants.com>
* Copyright (c) Cambridge Technology Consultants Ltd. All rights reserved.
*/
using System;
namespace CvsGitConverter
{
/// <summary>
/// Applicatio logging.
/// </summary>
interface ILogger
{
/// <summary>
/// Increase the indent for any following entries. When the returned object is disposed, the indent
/// is removed.
/// </summary>
IDisposable Indent();
/// <summary>
/// Draw a double line in the log file
/// </summary>
void DoubleRuleOff();
/// <summary>
/// Draw a single line in the log file
/// </summary>
void RuleOff();
/// <summary>
/// Write a blank line.
/// </summary>
void WriteLine();
/// <summary>
/// Write a line of text.
/// </summary>
void WriteLine(string line);
/// <summary>
/// Write a line of text.
/// </summary>
void WriteLine(string format, params object[] args);
}
}
|
mit
|
C#
|
20b7dff57a7ac6225fc89366bb2758bb2f8f3ecc
|
Implement GetTabular
|
TentacleGuitar/Server,TentacleGuitar/Server
|
src/TentacleGuitar.Server/Controllers/HomeController.cs
|
src/TentacleGuitar.Server/Controllers/HomeController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using TentacleGuitar.Server.Models;
namespace TentacleGuitar.Server.Controllers
{
public class HomeController : BaseController
{
[HttpPost("/SignIn")]
public IActionResult SignIn(string Username, string Password)
{
var user = DB.Users.SingleOrDefault(x => x.UserName == Username && x.Password == Password);
if (user.Expire <= DateTime.Now)
{
user.Token = Guid.NewGuid().ToString();
user.Expire = DateTime.Now.AddDays(15);
DB.SaveChanges();
}
return Content(user?.Token ?? "Access Denied");
}
[HttpPost("/GetMusics")]
public IActionResult GetMusics()
{
return Json(DB.Musics.OrderBy(x => x.Level).ToList());
}
[HttpPost("/SubmitScore")]
public IActionResult SubmitScore(Guid Id, string Token, int Score)
{
var user = DB.Users.Single(x => x.Token == Token);
DB.Histories.Add(new History { MusicId = Id, Point = Score, Time =DateTime.Now, UserId = user.Id });
DB.SaveChanges();
return Content("OK");
}
[HttpPost("/GetInstrument")]
public IActionResult GetInstrument(Guid Id)
{
var music = DB.Musics.SingleOrDefault(x => x.Id == Id);
if (music == null)
{
Response.StatusCode = 404;
return Content("Not Found");
}
return File(music.Instrument, "application/octet-stream");
}
[HttpPost("/GetTabular")]
public IActionResult GetTabular(Guid Id)
{
var music = DB.Musics.SingleOrDefault(x => x.Id == Id);
if (music == null)
{
Response.StatusCode = 404;
return Content("Not Found");
}
return Content(music.Tabular);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using TentacleGuitar.Server.Models;
namespace TentacleGuitar.Server.Controllers
{
public class HomeController : BaseController
{
[HttpPost("/SignIn")]
public IActionResult SignIn(string Username, string Password)
{
var user = DB.Users.SingleOrDefault(x => x.UserName == Username && x.Password == Password);
if (user.Expire <= DateTime.Now)
{
user.Token = Guid.NewGuid().ToString();
user.Expire = DateTime.Now.AddDays(15);
DB.SaveChanges();
}
return Content(user?.Token ?? "Access Denied");
}
[HttpPost("/GetMusics")]
public IActionResult GetMusics()
{
return Json(DB.Musics.OrderBy(x => x.Level).ToList());
}
[HttpPost("/SubmitScore")]
public IActionResult SubmitScore(Guid Id, string Token, int Score)
{
var user = DB.Users.Single(x => x.Token == Token);
DB.Histories.Add(new History { MusicId = Id, Point = Score, Time =DateTime.Now, UserId = user.Id });
DB.SaveChanges();
return Content("OK");
}
[HttpPost("/GetInstrument")]
public IActionResult GetInstrument(Guid Id)
{
var music = DB.Musics.SingleOrDefault(x => x.Id == Id);
if (music == null)
{
Response.StatusCode = 404;
return Content("Not Found");
}
return File(music.Instrument, "application/octet-stream");
}
}
}
|
mit
|
C#
|
6f4b672dd4fb90cbeb76b24915c69392b897375c
|
Test Server-side function called in transaction fails
|
jazd/Business,jazd/Business,jazd/Business
|
CSharp/Core.Test/TestDBFunctions.cs
|
CSharp/Core.Test/TestDBFunctions.cs
|
using System;
using NUnit.Framework;
namespace Business.Core.Test
{
[TestFixture]
public class TestDBFunctions
{
[Test]
public void Book() {
var profile = new Profile.Profile();
var database = new Fake.Database(profile);
database.Connect();
var bookName = "Sales";
float bookAmount = 111.11F;
int? entryId = 1;
database.SetValue(entryId);
Assert.IsFalse(database.Connection.TransactionStarted);
var entry = database.Book(bookName, bookAmount);
Assert.IsTrue(database.Connection.TransactionStarted);
Assert.IsFalse(database.Connection.TransactionRollback);
Assert.IsTrue(database.Connection.TransactionCommited);
Assert.IsNotNull(entry);
Assert.Greater(entry, 0);
Assert.AreEqual(entryId, entry);
}
}
}
|
using System;
using NUnit.Framework;
namespace Business.Core.Test
{
[TestFixture]
public class TestDBFunctions
{
[Test]
public void Book() {
var profile = new Profile.Profile();
var database = new Fake.Database(profile);
database.Connect();
var bookName = "Sales";
float bookAmount = 111.11F;
int? entryId = 1;
database.SetValue(entryId);
var entry = database.Book(bookName, bookAmount);
Assert.IsNotNull(entry);
Assert.Greater(entry, 0);
Assert.AreEqual(entryId, entry);
}
}
}
|
mit
|
C#
|
864b94ebd995c51e09bc7fc40d98f94a185c295c
|
Update Weather.cs
|
stephanecodo/WeatherNet
|
WeatherNet/Model/Weather.cs
|
WeatherNet/Model/Weather.cs
|
#region
using System;
#endregion
namespace WeatherNet.Model
{
/// <summary>
/// General weather result type
/// </summary>
public abstract class Weather
{
/// <summary>
/// Time of data receiving in GMT.
/// </summary>
public DateTime Date { get; set; }
/// <summary>
/// City name.
/// </summary>
public String City { get; set; }
/// <summary>
/// Country name.
/// </summary>
public String Country { get; set; }
/// <summary>
/// City identifier.
/// </summary>
public int CityId { get; set; }
/// <summary>
/// Weather title.
/// </summary>
public String Title { get; set; }
/// <summary>
/// Weather description.
/// </summary>
public String Description { get; set; }
/// <summary>
/// Temperature in Kelvin.
/// </summary>
public Double Temp { get; set; }
/// <summary>
/// Humidity in %
/// </summary>
public Double Humidity { get; set; }
/// <summary>
/// Maximum temperature in Kelvin.
/// </summary>
public Double TempMax { get; set; }
/// <summary>
/// Minimum temperature in Kelvin.
/// </summary>
public Double TempMin { get; set; }
/// <summary>
/// Wind speed in mps.
/// </summary>
public Double WindSpeed { get; set; }
/// <summary>
/// Icon name.
/// </summary>
public String Icon { get; set; }
}
}
|
#region
using System;
#endregion
namespace WeatherNet.Model
{
/// <summary>
/// General weather result type
/// </summary>
public abstract class Weather
{
/// <summary>
/// Time of data receiving in GMT.
/// </summary>
public DateTime Date { get; set; }
/// <summary>
/// City name.
/// </summary>
public String City { get; set; }
/// <summary>
/// Country name.
/// </summary>
public String Country { get; set; }
/// <summary>
/// City identifier.
/// </summary>
public int CityId { get; set; }
/// <summary>
/// Weather title.
/// </summary>
public String Title { get; set; }
/// <summary>
/// Weather description.
/// </summary>
public String Description { get; set; }
/// <summary>
/// Temperature in Kelvin.
/// </summary>
public Double Temp { get; set; }
/// <summary>
/// Humidity in %
/// </summary>
public Double Humidity { get; set; }
/// <summary>
/// Maximum temperature in Kelvin.
/// </summary>
public Double TempMax { get; set; }
/// <summary>
/// Minimum temperature in Kelvin.
/// </summary>
public Double TempMin { get; set; }
/// <summary>
/// Wind speed in mps.
/// </summary>
public Double WindSpeed { get; set; }
}
}
|
mit
|
C#
|
ca303ca3725026d89cd2438121a34e7b488ee856
|
Comment out game logic and replace table code
|
12joan/hangman
|
hangman.cs
|
hangman.cs
|
using System;
namespace Hangman {
public class Hangman {
public static void Main(string[] args) {
// char key = Console.ReadKey(true).KeyChar;
// var game = new Game("HANG THE MAN");
// bool wasCorrect = game.GuessLetter(key);
// Console.WriteLine(wasCorrect.ToString());
// var output = game.ShownWord();
// Console.WriteLine(output);
Table table = new Table(2, 3);
string output = table.Draw();
Console.WriteLine(output);
}
}
}
|
using System;
namespace Hangman {
public class Hangman {
public static void Main(string[] args) {
char key = Console.ReadKey(true).KeyChar;
var game = new Game("HANG THE MAN");
bool wasCorrect = game.GuessLetter(key);
Console.WriteLine(wasCorrect.ToString());
var output = game.ShownWord();
Console.WriteLine(output);
// Table table = new Table(2, 3);
// string output = table.Draw();
// Console.WriteLine(output);
}
}
}
|
unlicense
|
C#
|
80c2f75e8eaf87cb4239dcd181b23443a9c476a4
|
fix AgentView choose randomly among last 5
|
accu-rate/SumoVizUnity,accu-rate/SumoVizUnity
|
Assets/Scripts/CameraModes/AgentView.cs
|
Assets/Scripts/CameraModes/AgentView.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
// initial implementation from Christos Tsiliakis
public class AgentView : MonoBehaviour {
private GameObject currentPed = null;
private GameObject mainCameraParent;
void Start() {
mainCameraParent = GameObject.Find ("MainCameraParent");
Camera.main.nearClipPlane = 0.05f;
}
public GameObject getCurrentPed() {
return currentPed;
}
void LateUpdate (){
if (currentPed != null)
followPedestrian (currentPed);
else
getOneOfLastPeds (); //TODO add choice into GUI
if (Input.GetMouseButtonDown (0))
getOneOfLastPeds ();
}
private void followPedestrian (GameObject pedestrian) {
Vector3 pedPos = pedestrian.transform.position;
Vector3 newPos = new Vector3 (pedPos.x, pedPos.y + 1.66f, pedPos.z);
mainCameraParent.transform.position = newPos;
}
private void getOneOfLastPeds () {
List<Pedestrian> peds = GameObject.Find ("PedestrianLoader").GetComponent<PedestrianLoader> ().getPedestrians ();
currentPed = peds[Random.Range(peds.Count - 6, peds.Count - 1)].gameObject;
}
/*
private void findRandomPedestrian () {
List<Pedestrian> peds = GameObject.Find ("PedestrianLoader").GetComponent<PedestrianLoader> ().pedestrians;
if (peds.Count > 0) {
int randIndex = -1;
bool isPedActive = false;
int i = 0;
bool cancelled = false;
while (!isPedActive && !cancelled) {
randIndex = Random.Range (peds.Count - 3, peds.Count);
isPedActive = peds[randIndex].GetComponentInChildren<Renderer> ().enabled;
if (i ++ > peds.Count)
cancelled = true;
}
if (!cancelled)
currentPed = peds [randIndex].gameObject;
}
}
private void findPedestrianFurthestFromDestination() {
List<Pedestrian> peds = GameObject.Find ("PedestrianLoader").GetComponent<PedestrianLoader> ().pedestrians;
float maxDist = 0;
Vector3 destination = new Vector3 (16f, 1.5f, 5.3f);
foreach (Pedestrian ped in peds) {
float dist = ped.getDistTo (destination);
if (dist > maxDist) {
maxDist = dist;
currentPed = ped.gameObject;
}
}
}*/
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
// initial implementation from Christos Tsiliakis
public class AgentView : MonoBehaviour {
private GameObject currentPed = null;
private GameObject mainCameraParent;
void Start() {
mainCameraParent = GameObject.Find ("MainCameraParent");
Camera.main.nearClipPlane = 0.05f;
}
public GameObject getCurrentPed() {
return currentPed;
}
void LateUpdate (){
if (currentPed != null)
followPedestrian (currentPed);
else
getOneOfLastPeds (); //TODO add choice into GUI
if (Input.GetMouseButtonDown (0))
getOneOfLastPeds ();
}
private void followPedestrian (GameObject pedestrian) {
Vector3 pedPos = pedestrian.transform.position;
Vector3 newPos = new Vector3 (pedPos.x, pedPos.y + 1.66f, pedPos.z);
mainCameraParent.transform.position = newPos;
}
private void getOneOfLastPeds () {
List<int> indizes = new List<int> ();
indizes.Add (3);
indizes.Add (11);
indizes.Add (16);
indizes.Add (17);
indizes.Add (10);
List<Pedestrian> peds = GameObject.Find ("PedestrianLoader").GetComponent<PedestrianLoader> ().getPedestrians ();
currentPed = peds[indizes [Random.Range(0, indizes.Count - 1)]].gameObject;
}
/*
private void findRandomPedestrian () {
List<Pedestrian> peds = GameObject.Find ("PedestrianLoader").GetComponent<PedestrianLoader> ().pedestrians;
if (peds.Count > 0) {
int randIndex = -1;
bool isPedActive = false;
int i = 0;
bool cancelled = false;
while (!isPedActive && !cancelled) {
randIndex = Random.Range (peds.Count - 3, peds.Count);
isPedActive = peds[randIndex].GetComponentInChildren<Renderer> ().enabled;
if (i ++ > peds.Count)
cancelled = true;
}
if (!cancelled)
currentPed = peds [randIndex].gameObject;
}
}
private void findPedestrianFurthestFromDestination() {
List<Pedestrian> peds = GameObject.Find ("PedestrianLoader").GetComponent<PedestrianLoader> ().pedestrians;
float maxDist = 0;
Vector3 destination = new Vector3 (16f, 1.5f, 5.3f);
foreach (Pedestrian ped in peds) {
float dist = ped.getDistTo (destination);
if (dist > maxDist) {
maxDist = dist;
currentPed = ped.gameObject;
}
}
}*/
}
|
mit
|
C#
|
4168ab5ce64de9d23fd7978c9ea401f2daaa8b3c
|
Set start position of MetallKefer to the first Waypoint
|
emazzotta/unity-tower-defense
|
Assets/Scripts/MetallKeferController.cs
|
Assets/Scripts/MetallKeferController.cs
|
using UnityEngine;
using System.Collections;
public class MetallKeferController : MonoBehaviour {
private GameController gameController;
private GameObject[] baseBuildable;
private GameObject nextWaypiont;
private int currentWaypointIndex = 0;
private int movementSpeed = 2;
void Start () {
this.gameController = GameObject.FindObjectOfType<GameController>();
this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex];
this.setInitialWaypoint ();
}
void Update() {
this.moveToNextWaypoint ();
}
void SetNextWaypoint() {
if (this.currentWaypointIndex < this.gameController.getWaypoints ().Length - 1) {
this.currentWaypointIndex += 1;
this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex];
this.nextWaypiont.GetComponent<Renderer> ().material.color = this.getRandomColor();
}
}
private Color getRandomColor() {
Color newColor = new Color( Random.value, Random.value, Random.value, 1.0f );
return newColor;
}
private void setInitialWaypoint() {
this.transform.position = this.nextWaypiont.transform.position;
}
private void moveToNextWaypoint() {
float step = movementSpeed * Time.deltaTime;
this.transform.LookAt (this.nextWaypiont.transform);
this.transform.position = Vector3.MoveTowards(transform.position, this.nextWaypiont.transform.position, step);
this.SetNextWaypoint ();
}
}
|
using UnityEngine;
using System.Collections;
public class MetallKeferController : MonoBehaviour {
private GameController gameController;
private GameObject[] baseBuildable;
private GameObject nextWaypiont;
private int currentWaypointIndex = 0;
private int movementSpeed = 2;
void Start () {
this.gameController = GameObject.FindObjectOfType<GameController>();
this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex];
}
void Update() {
this.moveToNextWaypoint ();
}
void SetNextWaypoint() {
if (this.currentWaypointIndex < this.gameController.getWaypoints ().Length - 1) {
this.currentWaypointIndex += 1;
this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex];
this.nextWaypiont.GetComponent<Renderer> ().material.color = this.getRandomColor();
}
}
private Color getRandomColor() {
Color newColor = new Color( Random.value, Random.value, Random.value, 1.0f );
return newColor;
}
private void moveToNextWaypoint() {
float step = movementSpeed * Time.deltaTime;
this.transform.LookAt (this.nextWaypiont.transform);
this.transform.position = Vector3.MoveTowards(transform.position, this.nextWaypiont.transform.position, step);
this.SetNextWaypoint ();
}
}
|
mit
|
C#
|
6d8100180ddde2afe5370b097a53814f0dfe083a
|
Add script and audio whitelist to PauseManager
|
uulltt/NitoriWare,NitorInc/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare,plrusek/NitoriWare,Barleytree/NitoriWare
|
Assets/Scripts/Scenario/PauseManager.cs
|
Assets/Scripts/Scenario/PauseManager.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseManager : MonoBehaviour
{
//Whitelisted items won't be affected by pause
public AudioSource[] audioSourceWhitelist;
public MonoBehaviour[] scriptWhitelist;
private bool paused;
private float timeScale;
private List<AudioSource> pausedAudioSources;
private List<MonoBehaviour> disabledScripts;
void Start ()
{
paused = false;
}
void Update ()
{
if (Input.GetKeyDown(KeyCode.Escape))
if (!paused)
pause();
else
unPause();
}
void pause()
{
timeScale = Time.timeScale;
Time.timeScale = 0f;
AudioSource[] audioSources = FindObjectsOfType(typeof(AudioSource)) as AudioSource[];
pausedAudioSources = new List<AudioSource>();
List<AudioSource> whitelistedAudioSources = new List<AudioSource>(audioSourceWhitelist);
foreach (AudioSource source in audioSources)
{
if (!whitelistedAudioSources.Remove(source) && source.isPlaying)
{
source.Pause();
pausedAudioSources.Add(source);
}
}
MonoBehaviour[] scripts = FindObjectsOfType(typeof(MonoBehaviour)) as MonoBehaviour[];
disabledScripts = new List<MonoBehaviour>();
List<MonoBehaviour> whitelistedScripts = new List<MonoBehaviour>(scriptWhitelist);
foreach( MonoBehaviour script in scripts)
{
if (!whitelistedScripts.Remove(script) && script.enabled && script != this)
{
script.enabled = false;
disabledScripts.Add(script);
}
}
if (MicrogameController.instance != null)
MicrogameController.instance.onPause.Invoke();
paused = true;
}
void unPause()
{
Time.timeScale = timeScale;
foreach (AudioSource source in pausedAudioSources)
{
source.UnPause();
}
foreach (MonoBehaviour script in disabledScripts)
{
script.enabled = true;
}
if (MicrogameController.instance != null)
MicrogameController.instance.onUnPause.Invoke();
paused = false;
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseManager : MonoBehaviour
{
private bool paused;
private float timeScale;
private List<AudioSource> pausedAudioSources;
private List<MonoBehaviour> disabledScripts;
void Start ()
{
paused = false;
}
void Update ()
{
if (Input.GetKeyDown(KeyCode.Escape))
if (!paused)
pause();
else
unPause();
}
void pause()
{
timeScale = Time.timeScale;
Time.timeScale = 0f;
AudioSource[] audioSources = FindObjectsOfType(typeof(AudioSource)) as AudioSource[];
pausedAudioSources = new List<AudioSource>();
foreach (AudioSource source in audioSources)
{
if (source.isPlaying)
{
source.Pause();
pausedAudioSources.Add(source);
}
}
MonoBehaviour[] scripts = FindObjectsOfType(typeof(MonoBehaviour)) as MonoBehaviour[];
disabledScripts = new List<MonoBehaviour>();
foreach( MonoBehaviour script in scripts)
{
if (script.enabled && script != this)
{
script.enabled = false;
disabledScripts.Add(script);
}
}
if (MicrogameController.instance != null)
MicrogameController.instance.onPause.Invoke();
paused = true;
}
void unPause()
{
Time.timeScale = timeScale;
foreach (AudioSource source in pausedAudioSources)
{
source.UnPause();
}
foreach (MonoBehaviour script in disabledScripts)
{
script.enabled = true;
}
if (MicrogameController.instance != null)
MicrogameController.instance.onUnPause.Invoke();
paused = false;
}
}
|
mit
|
C#
|
cc4cfc7e852a27e7c45ce46f65b55d4c3333e380
|
fix ownership
|
jeske/StepsDB-alpha,jeske/StepsDB-alpha,jeske/StepsDB-alpha
|
Bend/Properties/AssemblyInfo.cs
|
Bend/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("Bend")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("DWJ CO")]
[assembly: AssemblyProduct("Bend")]
[assembly: AssemblyCopyright("Copyright © David Jeske 2010")]
[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("5830d921-cd34-45af-82b8-b3a26c57f2f9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ConsoleApplication1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ConsoleApplication1")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
[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("5830d921-cd34-45af-82b8-b3a26c57f2f9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
9b1dba3a0e58834356b195d3e6f17679958c328b
|
Exclude files that can not be accessed
|
sakapon/Tools-2016
|
FileReplacer/FileReplacer/FileHelper.cs
|
FileReplacer/FileReplacer/FileHelper.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace FileReplacer
{
public static class FileHelper
{
public static readonly Encoding UTF8N = new UTF8Encoding();
public static void ReplaceContent(FileInfo file, string oldValue, string newValue)
{
if (file.Attributes.HasFlag(FileAttributes.ReadOnly) || file.Attributes.HasFlag(FileAttributes.Hidden)) return;
string oldContent;
Encoding encoding;
using (var reader = new StreamReader(file.FullName, UTF8N, true))
{
oldContent = reader.ReadToEnd();
encoding = reader.CurrentEncoding;
}
if (!oldContent.Contains(oldValue)) return;
var newContent = oldContent.Replace(oldValue, newValue);
File.WriteAllText(file.FullName, newContent, encoding);
Console.WriteLine($"Replaced content: {file.FullName}");
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace FileReplacer
{
public static class FileHelper
{
public static readonly Encoding UTF8N = new UTF8Encoding();
public static void ReplaceContent(FileInfo file, string oldValue, string newValue)
{
string oldContent;
Encoding encoding;
using (var reader = new StreamReader(file.FullName, UTF8N, true))
{
oldContent = reader.ReadToEnd();
encoding = reader.CurrentEncoding;
}
if (!oldContent.Contains(oldValue)) return;
var newContent = oldContent.Replace(oldValue, newValue);
File.WriteAllText(file.FullName, newContent, encoding);
Console.WriteLine($"Replaced content: {file.FullName}");
}
}
}
|
mit
|
C#
|
628bc07b992d049450a5c17429ff29caffc4d4cf
|
Fix build script
|
SharpeRAD/Cake.WebDeploy,SharpeRAD/Cake.WebDeploy,SharpeRAD/Cake.WebDeploy
|
build.cake
|
build.cake
|
//////////////////////////////////////////////////////////////////////
// IMPORTS
//////////////////////////////////////////////////////////////////////
#addin "Cake.Slack"
#addin "Cake.ReSharperReports"
#addin "Cake.AWS.S3"
#addin "Cake.FileHelpers"
#tool "ReportUnit"
#tool "JetBrains.ReSharper.CommandLineTools"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// SOLUTION
//////////////////////////////////////////////////////////////////////
// Name
var appName = "Cake.WebDeploy";
// Projects
var projectNames = new List<string>()
{
"Cake.WebDeploy"
};
///////////////////////////////////////////////////////////////////////////////
// LOAD
///////////////////////////////////////////////////////////////////////////////
#load "./build/scripts/load.cake"
|
//////////////////////////////////////////////////////////////////////
// IMPORTS
//////////////////////////////////////////////////////////////////////
#addin "Cake.Slack"
#addin "Cake.ReSharperReports"
#addin "Cake.AWS.S3"
#addin "Cake.FileHelpers"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// SOLUTION
//////////////////////////////////////////////////////////////////////
// Name
var appName = "Cake.WebDeploy";
// Projects
var projectNames = new List<string>()
{
"Cake.WebDeploy"
};
///////////////////////////////////////////////////////////////////////////////
// LOAD
///////////////////////////////////////////////////////////////////////////////
#load "./build/scripts/load.cake"
|
mit
|
C#
|
64859547c97e08e162e8c59bd4d4f7e814e2ed58
|
Create assembly info on build
|
justinjstark/Verdeler,justinjstark/Delivered
|
build.cake
|
build.cake
|
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var version = Argument("version", "0.0.0");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var buildDir = Directory("./src/Delivered/bin") + Directory(configuration);
var solution = "./src/Delivered.sln";
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore(solution);
});
Task("Patch-Assembly-Info")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
CreateAssemblyInfo("./src/Delivered/Properties/AssemblyInfo.cs",
new AssemblyInfoSettings {
Product = "Delivered",
Version = version,
FileVersion = version,
InformationalVersion = version,
Copyright = "Copyright (c) Justin J Stark 2016",
Description = "A .NET distribution framework supporting custom distributables and endpoints."
});
});
Task("Build")
.IsDependentOn("Patch-Assembly-Info")
.Does(() =>
{
MSBuild(solution, settings =>
settings.SetConfiguration(configuration));
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
NUnit3("./src/**/bin/" + configuration + "/*.Tests.dll",
new NUnit3Settings {
NoResults = true
});
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Run-Unit-Tests");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
|
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var buildDir = Directory("./src/Delivered/bin") + Directory(configuration);
var solution = "./src/Delivered.sln";
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore(solution);
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
// Use MSBuild
MSBuild(solution, settings =>
settings.SetConfiguration(configuration));
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
NUnit3("./src/**/bin/" + configuration + "/*.Tests.dll",
new NUnit3Settings {
NoResults = true
});
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Run-Unit-Tests");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
|
mit
|
C#
|
812518f0e17835cba5711affc7b36f81be23c9d4
|
remove coveralls.
|
rafd75/boleto2net,BoletoNet/boleto2net
|
build.cake
|
build.cake
|
#addin Cake.Coveralls
#tool "nuget:?package=NUnit.ConsoleRunner"
#tool "nuget:?package=OpenCover"
///#tool coveralls.net
using System.Xml.Linq;
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
Task("RunNugetPack").WithCriteria(string.IsNullOrWhiteSpace(EnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER"))).Does(() =>
{
DeleteFiles("*.nupkg");
var buildNumber = EnvironmentVariable("appveyor_build_version");
var nuGetPackSettings = new NuGetPackSettings {
Version = $"{buildNumber}",
OutputDirectory = "./"
};
var nuspecFilePath = File("./Boleto2.Net/Boleto2.Net.nuspec");
NuGetPack(nuspecFilePath, nuGetPackSettings);
var nupkg = GetFiles("*.nupkg").First();
});
///Task("RunCoverage").IsDependentOn("Build").Does(() =>
///{
/// OpenCover(tool => tool.NUnit3("./**/bin/Release/*.Testes.dll"),
/// new FilePath("./coverage.xml"),
/// new OpenCoverSettings().WithFilter("+[*]Boleto2Net.*").WithFilter("-[*]Boleto2Net.Testes.*")
/// );
/// CoverallsNet("coverage.xml", CoverallsNetReportType.OpenCover);
///});
Task("RunTests").IsDependentOn("Build").Does(() =>
{
var testAssemblies = GetFiles("./**/bin/Release/*.Testes.dll");
NUnit3(testAssemblies, new NUnit3Settings { TeamCity = true });
});
Task("RestorePackages").Does(() =>
{
NuGetRestore(File("Boleto2.Net.sln"), new NuGetRestoreSettings { NoCache = true });
});
Task("Build").IsDependentOn("RestorePackages").Does(() =>
{
MSBuild("Boleto2.Net.sln", config => config.SetVerbosity(Verbosity.Minimal).SetConfiguration(configuration));
});
Task("Default").IsDependentOn("Build").Does(() => {});
Task("CiBuild").IsDependentOn("RunCoverage").IsDependentOn("RunNugetPack").Does(() => {});
RunTarget(target);
|
#addin Cake.Coveralls
#tool "nuget:?package=NUnit.ConsoleRunner"
#tool "nuget:?package=OpenCover"
#tool coveralls.net
using System.Xml.Linq;
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
Task("RunNugetPack").WithCriteria(string.IsNullOrWhiteSpace(EnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER"))).Does(() =>
{
DeleteFiles("*.nupkg");
var buildNumber = EnvironmentVariable("appveyor_build_version");
var nuGetPackSettings = new NuGetPackSettings {
Version = $"{buildNumber}",
OutputDirectory = "./"
};
var nuspecFilePath = File("./Boleto2.Net/Boleto2.Net.nuspec");
NuGetPack(nuspecFilePath, nuGetPackSettings);
var nupkg = GetFiles("*.nupkg").First();
});
Task("RunCoverage").IsDependentOn("Build").Does(() =>
{
OpenCover(tool => tool.NUnit3("./**/bin/Release/*.Testes.dll"),
new FilePath("./coverage.xml"),
new OpenCoverSettings().WithFilter("+[*]Boleto2Net.*").WithFilter("-[*]Boleto2Net.Testes.*")
);
CoverallsNet("coverage.xml", CoverallsNetReportType.OpenCover);
});
Task("RunTests").IsDependentOn("Build").Does(() =>
{
var testAssemblies = GetFiles("./**/bin/Release/*.Testes.dll");
NUnit3(testAssemblies, new NUnit3Settings { TeamCity = true });
});
Task("RestorePackages").Does(() =>
{
NuGetRestore(File("Boleto2.Net.sln"), new NuGetRestoreSettings { NoCache = true });
});
Task("Build").IsDependentOn("RestorePackages").Does(() =>
{
MSBuild("Boleto2.Net.sln", config => config.SetVerbosity(Verbosity.Minimal).SetConfiguration(configuration));
});
Task("Default").IsDependentOn("Build").Does(() => {});
Task("CiBuild").IsDependentOn("RunCoverage").IsDependentOn("RunNugetPack").Does(() => {});
RunTarget(target);
|
apache-2.0
|
C#
|
6d996f3a8a14d5cc63fe96520170f03692c6b92c
|
Add caching option when downloading package.
|
chocolatey/nuget-chocolatey,jmezach/NuGet2,themotleyfool/NuGet,mono/nuget,indsoft/NuGet2,indsoft/NuGet2,mrward/NuGet.V2,GearedToWar/NuGet2,xoofx/NuGet,ctaggart/nuget,mrward/NuGet.V2,pratikkagda/nuget,xoofx/NuGet,anurse/NuGet,ctaggart/nuget,xoofx/NuGet,jholovacs/NuGet,indsoft/NuGet2,antiufo/NuGet2,dolkensp/node.net,pratikkagda/nuget,mrward/nuget,jholovacs/NuGet,mono/nuget,alluran/node.net,oliver-feng/nuget,dolkensp/node.net,GearedToWar/NuGet2,oliver-feng/nuget,zskullz/nuget,jmezach/NuGet2,RichiCoder1/nuget-chocolatey,themotleyfool/NuGet,zskullz/nuget,rikoe/nuget,jmezach/NuGet2,themotleyfool/NuGet,mrward/nuget,OneGet/nuget,chocolatey/nuget-chocolatey,oliver-feng/nuget,antiufo/NuGet2,antiufo/NuGet2,zskullz/nuget,indsoft/NuGet2,RichiCoder1/nuget-chocolatey,jmezach/NuGet2,mrward/NuGet.V2,jholovacs/NuGet,GearedToWar/NuGet2,jholovacs/NuGet,RichiCoder1/nuget-chocolatey,xoofx/NuGet,kumavis/NuGet,anurse/NuGet,dolkensp/node.net,OneGet/nuget,mrward/NuGet.V2,mrward/nuget,OneGet/nuget,oliver-feng/nuget,OneGet/nuget,mrward/NuGet.V2,mrward/NuGet.V2,xero-github/Nuget,jholovacs/NuGet,akrisiun/NuGet,GearedToWar/NuGet2,chester89/nugetApi,chocolatey/nuget-chocolatey,rikoe/nuget,indsoft/NuGet2,jmezach/NuGet2,RichiCoder1/nuget-chocolatey,oliver-feng/nuget,GearedToWar/NuGet2,mono/nuget,chocolatey/nuget-chocolatey,atheken/nuget,chocolatey/nuget-chocolatey,dolkensp/node.net,pratikkagda/nuget,mrward/nuget,indsoft/NuGet2,mono/nuget,jmezach/NuGet2,antiufo/NuGet2,mrward/nuget,mrward/nuget,pratikkagda/nuget,xoofx/NuGet,ctaggart/nuget,chocolatey/nuget-chocolatey,ctaggart/nuget,rikoe/nuget,kumavis/NuGet,alluran/node.net,pratikkagda/nuget,pratikkagda/nuget,zskullz/nuget,jholovacs/NuGet,chester89/nugetApi,antiufo/NuGet2,antiufo/NuGet2,GearedToWar/NuGet2,RichiCoder1/nuget-chocolatey,alluran/node.net,atheken/nuget,akrisiun/NuGet,oliver-feng/nuget,alluran/node.net,xoofx/NuGet,RichiCoder1/nuget-chocolatey,rikoe/nuget
|
NuPack.Core/Utility/HttpWebRequestor.cs
|
NuPack.Core/Utility/HttpWebRequestor.cs
|
namespace NuPack {
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Net;
using System.Net.Cache;
// REVIEW: This class isn't super clean. Maybe this object should be passed around instead
// of being static
public static class HttpWebRequestor {
public static ZipPackage DownloadPackage(Uri uri) {
return DownloadPackage(uri, useCache: true);
}
[SuppressMessage(
"Microsoft.Reliability",
"CA2000:Dispose objects before losing scope",
Justification = "We can't dispose an object if we want to return it.")]
public static ZipPackage DownloadPackage(Uri uri, bool useCache) {
byte[] cachedBytes = null;
return new ZipPackage(() => {
if (useCache && cachedBytes != null) {
return new MemoryStream(cachedBytes);
}
using (Stream responseStream = GetResponseStream(uri)) {
// ZipPackages require a seekable stream
var memoryStream = new MemoryStream();
// Copy the stream
responseStream.CopyTo(memoryStream);
// Move it back to the beginning
memoryStream.Seek(0, SeekOrigin.Begin);
if (useCache) {
// Cache the bytes for this package
cachedBytes = memoryStream.ToArray();
}
return memoryStream;
}
});
}
public static Stream GetResponseStream(Uri uri) {
WebRequest request = WebRequest.Create(uri);
InitializeRequest(request);
WebResponse response = request.GetResponse();
return response.GetResponseStream();
}
internal static void InitializeRequest(WebRequest request) {
request.CachePolicy = new HttpRequestCachePolicy();
request.UseDefaultCredentials = true;
if (request.Proxy != null) {
// If we are going through a proxy then just set the default credentials
request.Proxy.Credentials = CredentialCache.DefaultCredentials;
}
}
}
}
|
namespace NuPack {
using System;
using System.IO;
using System.Net;
using System.Net.Cache;
// REVIEW: This class isn't super clean. Maybe this object should be passed around instead
// of being static
public static class HttpWebRequestor {
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Reliability",
"CA2000:Dispose objects before losing scope",
Justification="We can't dispose an object if we want to return it.")]
public static ZipPackage DownloadPackage(Uri uri) {
return new ZipPackage(() => {
using (Stream responseStream = GetResponseStream(uri)) {
// ZipPackages require a seekable stream
var memoryStream = new MemoryStream();
// Copy the stream
responseStream.CopyTo(memoryStream);
// Move it back to the beginning
memoryStream.Seek(0, SeekOrigin.Begin);
return memoryStream;
}
});
}
public static Stream GetResponseStream(Uri uri) {
WebRequest request = WebRequest.Create(uri);
InitializeRequest(request);
WebResponse response = request.GetResponse();
return response.GetResponseStream();
}
internal static void InitializeRequest(WebRequest request) {
request.CachePolicy = new HttpRequestCachePolicy();
request.UseDefaultCredentials = true;
if (request.Proxy != null) {
// If we are going through a proxy then just set the default credentials
request.Proxy.Credentials = CredentialCache.DefaultCredentials;
}
}
}
}
|
apache-2.0
|
C#
|
88891d9b66cddc49bef44ac8af1eca45f8392fa2
|
use relative url for getting json metrics
|
etishor/Metrics.NET,cvent/Metrics.NET,mnadel/Metrics.NET,ntent-ad/Metrics.NET,MetaG8/Metrics.NET,MetaG8/Metrics.NET,huoxudong125/Metrics.NET,huoxudong125/Metrics.NET,Liwoj/Metrics.NET,alhardy/Metrics.NET,Recognos/Metrics.NET,ntent-ad/Metrics.NET,MetaG8/Metrics.NET,etishor/Metrics.NET,DeonHeyns/Metrics.NET,mnadel/Metrics.NET,Liwoj/Metrics.NET,cvent/Metrics.NET,Recognos/Metrics.NET,alhardy/Metrics.NET,DeonHeyns/Metrics.NET
|
Src/Metrics/Visualization/FlotWebApp.cs
|
Src/Metrics/Visualization/FlotWebApp.cs
|
using System;
using System.IO;
using System.IO.Compression;
using System.Reflection;
namespace Metrics.Visualization
{
public static class FlotWebApp
{
private static string ReadFromEmbededResource()
{
using (var stream = Assembly.GetAssembly(typeof(FlotWebApp)).GetManifestResourceStream("Metrics.Visualization.index.full.html.gz"))
using (var gzip = new GZipStream(stream, CompressionMode.Decompress))
using (var reader = new StreamReader(gzip))
{
return reader.ReadToEnd();
}
}
private static Lazy<string> htmlContent = new Lazy<string>(() => ReadFromEmbededResource());
public static string GetFlotApp(Uri metricsJsonEndpoint)
{
var relativeEndpoint = metricsJsonEndpoint.ToString();
if (relativeEndpoint.StartsWith("/"))
{
relativeEndpoint = relativeEndpoint.Substring(1);
}
return htmlContent.Value.Replace("http://localhost:1234/metrics/json", relativeEndpoint);
}
}
}
|
using System;
using System.IO;
using System.IO.Compression;
using System.Reflection;
namespace Metrics.Visualization
{
public static class FlotWebApp
{
private static string ReadFromEmbededResource()
{
using (var stream = Assembly.GetAssembly(typeof(FlotWebApp)).GetManifestResourceStream("Metrics.Visualization.index.full.html.gz"))
using (var gzip = new GZipStream(stream, CompressionMode.Decompress))
using (var reader = new StreamReader(gzip))
{
return reader.ReadToEnd();
}
}
private static Lazy<string> htmlContent = new Lazy<string>(() => ReadFromEmbededResource());
public static string GetFlotApp(Uri metricsJsonEndpoint)
{
return htmlContent.Value.Replace("http://localhost:1234/metrics/json", metricsJsonEndpoint.ToString());
}
}
}
|
apache-2.0
|
C#
|
b0d6b8f8f230e316fbbdeea79292e5533382ef6a
|
Update BulkConfig.cs
|
borisdj/EFCore.BulkExtensions
|
EFCore.BulkExtensions/BulkConfig.cs
|
EFCore.BulkExtensions/BulkConfig.cs
|
namespace EFCore.BulkExtensions
{
public class BulkConfig
{
public bool PreserveInsertOrder { get; set; }
public bool SetOutputIdentity { get; set; }
public int BatchSize { get; set; } = 2000;
public int? NotifyAfter { get; set; }
public int? BulkCopyTimeout { get; set; }
public bool EnableStreaming { get; set; }
public bool UseTempDB { get; set; }
}
}
|
namespace EFCore.BulkExtensions
{
public class BulkConfig
{
public bool PreserveInsertOrder { get; set; }
public bool SetOutputIdentity { get; set; }
public int BatchSize { get; set; } = 2000;
public int? NotifyAfter { get; set; }
public int? BulkCopyTimeout { get; set; }
public bool EnableStreaming { get; set; }
}
}
|
mit
|
C#
|
da9ea14d478b83940a68f79df0c97dfc32515b75
|
comment out test tmp folder creation since it isn't used
|
robertwahler/jammer,robertwahler/EventManager,robertwahler/EventManager,robertwahler/jammer
|
Assets/Examples/Colors/Test/Unit/Editor/TestSetup.cs
|
Assets/Examples/Colors/Test/Unit/Editor/TestSetup.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace Examples.Test {
[SetUpFixture]
public class TestSetup {
private static TestSetup instance = null;
/// <summary>
/// This path is used to stub the Settings folder. Used for all tests.
/// </summary>
public string TestPath { get; set; }
/// <summary>
/// This path holds test fixtures
/// </summary>
public string FixturesPath { get; set; }
public TestSetup() {
instance = this;
Initialize();
}
protected virtual void Initialize() {
Debug.Log(string.Format("TestSetup.Initialize()"));
var paths = new string[] {System.IO.Directory.GetCurrentDirectory(), "tmp", "test"};
TestPath = paths.Aggregate(System.IO.Path.Combine);
paths = new string[] {System.IO.Directory.GetCurrentDirectory(), "Assets", "Test", "Unit", "Editor", "Fixtures"};
FixturesPath = paths.Aggregate(System.IO.Path.Combine);
}
/// <summary>
/// This is run before all the tests in this namespace (SDD.Test)
/// </summary>
[SetUp]
public void BeforeAll() {
Debug.Log(string.Format("TestSetup.BeforeAll()"));
StubSettingsPath();
//
// Start singletons here
//
}
/// <summary>
/// This is run after all the tests in this namespace (SDD.Test)
/// </summary>
[TearDown]
public void AfterAll() {
Debug.Log(string.Format("TestSetup.AfterAll()"));
//
// Destroy singletons here
//
// allow to garbage collect
instance = null;
Resources.UnloadUnusedAssets();
}
/// <summary>
/// Gets the singleton instance
/// </summary>
public static TestSetup Instance {
get {
if (instance == null) {
instance = new TestSetup();
}
return instance;
}
}
/// <summary>
/// Clear the settings for a fresh start
/// </summary>
public void ClearSettings() {
Debug.Log(string.Format("TestSetup.ClearSettingsFolder()"));
//if (System.IO.Directory.Exists(TestPath)) {
//System.IO.Directory.Delete(path: TestPath, recursive: true);
//}
//if (!System.IO.Directory.Exists(TestPath)) {
//System.IO.Directory.CreateDirectory(TestPath);
//}
}
private void StubSettingsPath() {
Debug.Log(string.Format("TestSetup.StubSettingsPath()"));
// stub out production serialization folder
//SDD.Settings.DataPath = TestPath;
ClearSettings();
}
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace Examples.Test {
[SetUpFixture]
public class TestSetup {
private static TestSetup instance = null;
/// <summary>
/// This path is used to stub the Settings folder. Used for all tests.
/// </summary>
public string TestPath { get; set; }
/// <summary>
/// This path holds test fixtures
/// </summary>
public string FixturesPath { get; set; }
public TestSetup() {
instance = this;
Initialize();
}
protected virtual void Initialize() {
Debug.Log(string.Format("TestSetup.Initialize()"));
var paths = new string[] {System.IO.Directory.GetCurrentDirectory(), "tmp", "test"};
TestPath = paths.Aggregate(System.IO.Path.Combine);
paths = new string[] {System.IO.Directory.GetCurrentDirectory(), "Assets", "Test", "Unit", "Editor", "Fixtures"};
FixturesPath = paths.Aggregate(System.IO.Path.Combine);
}
/// <summary>
/// This is run before all the tests in this namespace (SDD.Test)
/// </summary>
[SetUp]
public void BeforeAll() {
Debug.Log(string.Format("TestSetup.BeforeAll()"));
StubSettingsPath();
//
// Start singletons here
//
}
/// <summary>
/// This is run after all the tests in this namespace (SDD.Test)
/// </summary>
[TearDown]
public void AfterAll() {
Debug.Log(string.Format("TestSetup.AfterAll()"));
//
// Destroy singletons here
//
// allow to garbage collect
instance = null;
Resources.UnloadUnusedAssets();
}
/// <summary>
/// Gets the singleton instance
/// </summary>
public static TestSetup Instance {
get {
if (instance == null) {
instance = new TestSetup();
}
return instance;
}
}
/// <summary>
/// Clear the settings for a fresh start
/// </summary>
public void ClearSettings() {
Debug.Log(string.Format("TestSetup.ClearSettingsFolder()"));
if (System.IO.Directory.Exists(TestPath)) {
// clear out test folder
System.IO.Directory.Delete(path: TestPath, recursive: true);
}
if (!System.IO.Directory.Exists(TestPath)) {
System.IO.Directory.CreateDirectory(TestPath);
}
// Clear custom serialization files
//SDD.Settings.Clear();
}
private void StubSettingsPath() {
Debug.Log(string.Format("TestSetup.StubSettingsPath()"));
// stub out production serialization folder
//SDD.Settings.DataPath = TestPath;
ClearSettings();
}
}
}
|
mit
|
C#
|
5cfb6636054316676c34af3173f8351adf45a6cd
|
Correct error message in thread test
|
fairtradex/MaxMind-DB-Reader-dotnet
|
MaxMind.MaxMindDb.Test/ThreadingTest.cs
|
MaxMind.MaxMindDb.Test/ThreadingTest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using NUnit.Framework;
namespace MaxMind.MaxMindDb.Test
{
[TestFixture]
public class ThreadingTest
{
[Test]
public void TestParallelFor()
{
var reader = new MaxMindDbReader("..\\..\\TestData\\GeoLite2-City.mmdb", FileAccessMode.MemoryMapped);
var count = 0;
var ipsAndResults = new Dictionary<IPAddress, string>();
var rand = new Random();
while(count < 10000)
{
var ip = new IPAddress(rand.Next(int.MaxValue));
var resp = reader.Find(ip);
if (resp != null)
{
ipsAndResults.Add(ip, resp.ToString());
count++;
}
}
var ips = ipsAndResults.Keys.ToArray();
Parallel.For(0, ips.Length, (i) =>
{
var ipAddress = ips[i];
var result = reader.Find(ipAddress);
var resultString = result.ToString();
var expectedString = ipsAndResults[ipAddress];
if(resultString != expectedString)
throw new Exception(string.Format("Non-matching result. Expected {0}, found {1}", expectedString, resultString));
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using NUnit.Framework;
namespace MaxMind.MaxMindDb.Test
{
[TestFixture]
public class ThreadingTest
{
[Test]
public void TestParallelFor()
{
var reader = new MaxMindDbReader("..\\..\\TestData\\GeoLite2-City.mmdb", FileAccessMode.MemoryMapped);
var count = 0;
var ipsAndResults = new Dictionary<IPAddress, string>();
var rand = new Random();
while(count < 10000)
{
var ip = new IPAddress(rand.Next(int.MaxValue));
var resp = reader.Find(ip);
if (resp != null)
{
ipsAndResults.Add(ip, resp.ToString());
count++;
}
}
var ips = ipsAndResults.Keys.ToArray();
Parallel.For(0, ips.Length, (i) =>
{
var ipAddress = ips[i];
var result = reader.Find(ipAddress);
var resultString = result.ToString();
var expectedString = ipsAndResults[ipAddress];
if(resultString != expectedString)
throw new Exception(string.Format("Non-matching zip. Expected {0}, found {1}", expectedString, resultString));
});
}
}
}
|
apache-2.0
|
C#
|
8f72c279fdad8608b923edcbc6bce3d507641136
|
Fix broken unit test for AutoMapperTab.
|
ajedwards/Glimpse.AutoMapper
|
Glimpse.AutoMapper/AutoMapperTab.cs
|
Glimpse.AutoMapper/AutoMapperTab.cs
|
using System;
using System.Diagnostics;
using System.Linq;
using AutoMapper;
using Glimpse.Core.Extensibility;
using Glimpse.Core.Tab.Assist;
namespace Glimpse.AutoMapper
{
public class AutoMapperTab : TabBase
{
private static readonly string[] Headers = { "Profile", "Type Map" };
private readonly IConfigurationProvider _configuration;
public AutoMapperTab()
: this(Mapper.Engine.ConfigurationProvider)
{
}
public AutoMapperTab(IConfigurationProvider configuration)
{
if (configuration == null)
{
throw new ArgumentNullException("configuration");
}
this._configuration = configuration;
}
public override string Name
{
get
{
return "AutoMapper";
}
}
public override object GetData(ITabContext context)
{
var plugin = Plugin.Create(Headers);
TypeMap[] typeMaps = this._configuration.GetAllTypeMaps();
foreach (var profileName in typeMaps.Select(map => map.Profile).Distinct())
{
var typeMapSection = new TypeMapTabSection(this._configuration, profileName);
plugin.AddRow().Column(profileName).Column(typeMapSection);
}
return plugin;
}
}
}
|
using System;
using System.Linq;
using AutoMapper;
using Glimpse.Core.Extensibility;
using Glimpse.Core.Tab.Assist;
namespace Glimpse.AutoMapper
{
public class AutoMapperTab : TabBase
{
private static readonly string[] Headers = { "Profile", "Type Map" };
private readonly IConfigurationProvider _configuration;
public AutoMapperTab()
: this(Mapper.Engine.ConfigurationProvider)
{
}
public AutoMapperTab(IConfigurationProvider configuration)
{
if (configuration == null)
{
throw new ArgumentNullException("configuration");
}
this._configuration = configuration;
}
public override string Name
{
get
{
return "AutoMapper";
}
}
public override object GetData(ITabContext context)
{
var plugin = Plugin.Create(Headers);
if (context != null)
{
TypeMap[] typeMaps = this._configuration.GetAllTypeMaps();
foreach (var profileName in typeMaps.Select(map => map.Profile).Distinct())
{
var typeMapSection = new TypeMapTabSection(this._configuration, profileName);
plugin.AddRow().Column(profileName).Column(typeMapSection);
}
}
return plugin;
}
}
}
|
apache-2.0
|
C#
|
52ca52c39c824e043d5d20ebf472bacaf305143a
|
Increment version to v1.3
|
phdesign/NppToolBucket
|
phdesign.NppToolBucket/Properties/AssemblyInfo.cs
|
phdesign.NppToolBucket/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("NppToolBucket")]
[assembly: AssemblyDescription("Plugin of assorted tools for Notepad++")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("phdesign")]
[assembly: AssemblyProduct("phdesign.NppToolBucket")]
[assembly: AssemblyCopyright("Copyright © phdesign 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("31492674-6fe0-485c-91f0-2e17244588ff")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NppToolBucket")]
[assembly: AssemblyDescription("Plugin of assorted tools for Notepad++")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("phdesign")]
[assembly: AssemblyProduct("phdesign.NppToolBucket")]
[assembly: AssemblyCopyright("Copyright © phdesign 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("31492674-6fe0-485c-91f0-2e17244588ff")]
// 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.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
5ebe14b76513c68172e819ef5697a94ec86d6313
|
Update DirectCalculationFormula.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/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,maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/CSharp/Formulas/DirectCalculationFormula.cs
|
Examples/CSharp/Formulas/DirectCalculationFormula.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Formulas
{
public class DirectCalculationFormula
{
public static void Main(string[] args)
{
//ExStart:1
// 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);
//Create a workbook
Workbook workbook = new Workbook();
//Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Put 20 in cell A1
Cell cellA1 = worksheet.Cells["A1"];
cellA1.PutValue(20);
//Put 30 in cell A2
Cell cellA2 = worksheet.Cells["A2"];
cellA2.PutValue(30);
//Calculate the Sum of A1 and A2
var results = worksheet.CalculateFormula("=Sum(A1:A2)");
//Print the output
System.Console.WriteLine("Value of A1: " + cellA1.StringValue);
System.Console.WriteLine("Value of A2: " + cellA2.StringValue);
System.Console.WriteLine("Result of Sum(A1:A2): " + results.ToString());
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Formulas
{
public class DirectCalculationFormula
{
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);
//Create a workbook
Workbook workbook = new Workbook();
//Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Put 20 in cell A1
Cell cellA1 = worksheet.Cells["A1"];
cellA1.PutValue(20);
//Put 30 in cell A2
Cell cellA2 = worksheet.Cells["A2"];
cellA2.PutValue(30);
//Calculate the Sum of A1 and A2
var results = worksheet.CalculateFormula("=Sum(A1:A2)");
//Print the output
System.Console.WriteLine("Value of A1: " + cellA1.StringValue);
System.Console.WriteLine("Value of A2: " + cellA2.StringValue);
System.Console.WriteLine("Result of Sum(A1:A2): " + results.ToString());
}
}
}
|
mit
|
C#
|
04110043cd143e7331d67e8b9739be146252c3b9
|
Fix - Se ad un utente vengono cancellati tutti i ruoli, viene cancellato l'utente dalla basae dati SO115
|
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
|
src/backend/SO115App.Persistence.MongoDB/GestioneUtenti/GestioneRuoli/DeleteRuolo.cs
|
src/backend/SO115App.Persistence.MongoDB/GestioneUtenti/GestioneRuoli/DeleteRuolo.cs
|
//-----------------------------------------------------------------------
// <copyright file="DeleteRuolo.cs" company="CNVVF">
// Copyright (C) 2017 - CNVVF
//
// This file is part of SOVVF.
// SOVVF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// SOVVF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
//-----------------------------------------------------------------------
using MongoDB.Driver;
using Persistence.MongoDB;
using SO115App.API.Models.Classi.Autenticazione;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti.GestioneRuolo;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti.GetUtenti;
namespace SO115App.Persistence.MongoDB.GestioneUtenti.GestioneRuoli
{
public class DeleteRuolo : IDeleteRuolo
{
private readonly DbContext _dbcontext;
private readonly IGetUtenteByCF _getUtenteByCF;
public DeleteRuolo(DbContext dbcontext, IGetUtenteByCF getUtenteByCF)
{
_dbcontext = dbcontext;
_getUtenteByCF = getUtenteByCF;
}
public void Delete(string codiceFiscale, Role ruolo)
{
var utente = _getUtenteByCF.Get(codiceFiscale);
///Se un utente ha solamente un ruolo associato, cancello direttamente l'utente dalla base dati
if (utente.Ruoli.Count > 1)
{
var filter = Builders<Utente>.Filter.Eq(x => x.CodiceFiscale, codiceFiscale);
_dbcontext.UtenteCollection.UpdateOne(filter, Builders<Utente>.Update.Pull(x => x.Ruoli, ruolo));
}
else
{
_dbcontext.UtenteCollection.DeleteOne(x => x.CodiceFiscale.Equals(codiceFiscale));
}
}
}
}
|
//-----------------------------------------------------------------------
// <copyright file="DeleteRuolo.cs" company="CNVVF">
// Copyright (C) 2017 - CNVVF
//
// This file is part of SOVVF.
// SOVVF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// SOVVF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
//-----------------------------------------------------------------------
using MongoDB.Driver;
using Persistence.MongoDB;
using SO115App.API.Models.Classi.Autenticazione;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti.GestioneRuolo;
namespace SO115App.Persistence.MongoDB.GestioneUtenti.GestioneRuoli
{
public class DeleteRuolo : IDeleteRuolo
{
private readonly DbContext _dbcontext;
public DeleteRuolo(DbContext dbcontext)
{
_dbcontext = dbcontext;
}
public void Delete(string codiceFiscale, Role ruolo)
{
var filter = Builders<Utente>.Filter.Eq(x => x.CodiceFiscale, codiceFiscale);
_dbcontext.UtenteCollection.UpdateOne(filter, Builders<Utente>.Update.Pull(x => x.Ruoli, ruolo));
}
}
}
|
agpl-3.0
|
C#
|
e95eea248a420a69c5354a01488f19961fe64e18
|
change int test address back to localhost
|
AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud
|
src/server/Adaptive.ReactiveTrader.Server.IntegrationTests/IntegrationTestAddress.cs
|
src/server/Adaptive.ReactiveTrader.Server.IntegrationTests/IntegrationTestAddress.cs
|
namespace Adaptive.ReactiveTrader.Server.IntegrationTests
{
public static class IntegrationTestAddress
{
public const string Url = "localhost";
}
}
|
namespace Adaptive.ReactiveTrader.Server.IntegrationTests
{
public static class IntegrationTestAddress
{
public const string Url = "192.168.99.100";
}
}
|
apache-2.0
|
C#
|
38ff4bd9d74a339ccea3ee2ab5ba44d03dd7c866
|
Fix bug with moving claim to character
|
joinrpg/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net
|
Joinrpg/Views/Shared/AvailClaimTargetsPartial.cshtml
|
Joinrpg/Views/Shared/AvailClaimTargetsPartial.cshtml
|
@using JoinRpg.Web.Models
@model CharacterGroupListViewModel
@functions {
private static string GetName(CharacterGroupListItemViewModel gr)
{
return gr.Name + (gr.AvaiableDirectSlots > 0 ? (" " + DisplayCount.OfX(gr.AvaiableDirectSlots, "вакансия", "вакансии", "вакансий")) : "");
}
}
@helper CreateValue(string prefix, int id, string label)
{
var value = prefix + id;
<option value="@value">@label</option>
}
<div class="form-horizontal">
<div class="form-group">
@Html.Label("", "Переместить заявку", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<select name="claimTarget" id="claimTarget" class="form-control col-md-10">
@foreach (var element in Model.ActiveGroups.Where(g => g.FirstCopy && !g.IsSpecial))
{
if (element.AvaiableDirectSlots != 0 && ViewBag.ShowGroupsInAvailClaim == true)
{
@CreateValue("group^", element.CharacterGroupId, "Группа " + GetName(element))
}
foreach (var character in element.Characters.Where(ch => ch.IsAvailable))
{
@CreateValue("character^", character.CharacterId, string.Join("→", element.Path.Skip(1).Union(new[] { element }).Select(p => p.Name)) + "→" + character.CharacterName)
}
}
</select>
</div>
</div>
</div>
|
@using JoinRpg.Web.Models
@model CharacterGroupListViewModel
@functions {
private static string GetName(CharacterGroupListItemViewModel gr)
{
return gr.Name + (gr.AvaiableDirectSlots > 0 ? (" " + DisplayCount.OfX(gr.AvaiableDirectSlots, "вакансия", "вакансии", "вакансий")) : "");
}
}
@helper CreateValue(string prefix, int id, string label)
{
var value = prefix + id;
<option value="@value">@label</option>
}
<div class="form-horizontal">
<div class="form-group">
@Html.Label("", "Переместить заявку", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<select name="claimTarget" id="claimTarget" class="form-control col-md-10">
@foreach (var element in Model.ActiveGroups.Where(g => g.FirstCopy && !g.IsSpecial))
{
if (element.AvaiableDirectSlots != 0 && ViewBag.ShowGroupsInAvailClaim == true)
{
@CreateValue("group^", element.CharacterGroupId, "Группа " + GetName(element))
}
foreach (var character in element.Characters.Where(ch => ch.IsAvailable))
{
@CreateValue("char^", character.CharacterId, string.Join("→", element.Path.Skip(1).Union(new[] { element }).Select(p => p.Name)) + "→" + character.CharacterName)
}
}
</select>
</div>
</div>
</div>
|
mit
|
C#
|
78f7b46fed076eb9cddcb73016d065ceccf01191
|
Active line highlighting width fix
|
segrived/Msiler
|
Msiler/Lib/HighlightCurrentLineBackgroundRenderer.cs
|
Msiler/Lib/HighlightCurrentLineBackgroundRenderer.cs
|
using System.Windows;
using System.Windows.Media;
using ICSharpCode.AvalonEdit;
using ICSharpCode.AvalonEdit.Rendering;
using Microsoft.VisualStudio.PlatformUI;
using Msiler.Helpers;
namespace Msiler.Lib
{
public class HighlightCurrentLineBackgroundRenderer : IBackgroundRenderer
{
public bool Enabled { get; set; } = true;
private readonly TextEditor editor;
private SolidColorBrush brush;
public HighlightCurrentLineBackgroundRenderer(TextEditor editor)
{
this.editor = editor;
this.UpdateBrush();
VSColorTheme.ThemeChanged += e => this.UpdateBrush();
}
public KnownLayer Layer => KnownLayer.Caret;
public void Draw(TextView textView, DrawingContext drawingContext)
{
if (!this.Enabled || this.editor.Document == null)
return;
textView.EnsureVisualLines();
var currentLine = this.editor.Document.GetLineByOffset(this.editor.CaretOffset);
foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, currentLine))
{
double width = textView.ActualWidth;
if (width < 0)
return;
var drawRect = new Rect(rect.Location, new Size(width, rect.Height));
drawingContext.DrawRectangle(this.brush, null, drawRect);
}
}
#region Utils
private void UpdateBrush()
{
var backColor = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey);
var higtlightColor = VsThemeHelpers.GetHightlightColor(backColor, 0x80);
this.brush = new SolidColorBrush(higtlightColor);
}
#endregion
}
}
|
using System.Windows;
using System.Windows.Media;
using ICSharpCode.AvalonEdit;
using ICSharpCode.AvalonEdit.Rendering;
using Microsoft.VisualStudio.PlatformUI;
using Msiler.Helpers;
namespace Msiler.Lib
{
public class HighlightCurrentLineBackgroundRenderer : IBackgroundRenderer
{
public bool Enabled { get; set; } = true;
private readonly TextEditor editor;
private SolidColorBrush brush;
public HighlightCurrentLineBackgroundRenderer(TextEditor editor)
{
this.editor = editor;
this.UpdateBrush();
VSColorTheme.ThemeChanged += e => this.UpdateBrush();
}
public KnownLayer Layer => KnownLayer.Caret;
public void Draw(TextView textView, DrawingContext drawingContext)
{
if (!this.Enabled || this.editor.Document == null)
return;
textView.EnsureVisualLines();
var currentLine = this.editor.Document.GetLineByOffset(this.editor.CaretOffset);
foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, currentLine))
{
double width = textView.ActualWidth - 32;
if (width < 0)
return;
var drawRect = new Rect(rect.Location, new Size(textView.ActualWidth - 32, rect.Height));
drawingContext.DrawRectangle(this.brush, null, drawRect);
}
}
#region Utils
private void UpdateBrush()
{
var backColor = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey);
var higtlightColor = VsThemeHelpers.GetHightlightColor(backColor, 0x80);
this.brush = new SolidColorBrush(higtlightColor);
}
#endregion
}
}
|
mit
|
C#
|
f0e59fe165d1bc982c5c40c8dbe093cfe142961d
|
Hide common methods from Object class in Convention class.
|
bondarenkod/Dapper-FluentMap,henkmollema/Dapper-FluentMap,henkmollema/Dapper-FluentMap,arumata/Dapper-FluentMap,thomasbargetz/Dapper-FluentMap
|
src/Dapper.FluentMap/Conventions/Convention.cs
|
src/Dapper.FluentMap/Conventions/Convention.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Dapper.FluentMap.Mapping;
namespace Dapper.FluentMap.Conventions
{
/// <summary>
/// Represents a convention for mapping entity properties to column names.
/// </summary>
public abstract class Convention
{
/// <summary>
/// Initializes a new instance of the <see cref="T:Dapper.FluentMap.Conventions.Convention"/> class.
/// </summary>
protected Convention()
{
ConventionConfigurations = new List<PropertyConventionConfiguration>();
PropertyMaps = new List<PropertyMap>();
}
internal IList<PropertyConventionConfiguration> ConventionConfigurations { get; private set; }
internal IList<PropertyMap> PropertyMaps { get; private set; }
/// <summary>
/// Configures a convention that applies on all properties of the entity.
/// </summary>
/// <returns>A configuration object for the convention.</returns>
protected PropertyConventionConfiguration Properties()
{
var config = new PropertyConventionConfiguration();
ConventionConfigurations.Add(config);
return config;
}
/// <summary>
/// Configures a convention that applies on all the properties of a specified type of the entity.
/// </summary>
/// <typeparam name="T">The type of the properties that the convention will apply to.</typeparam>
/// <returns>A configuration object for the convention.</returns>
protected PropertyConventionConfiguration Properties<T>()
{
// Get the underlying type for a nullale type. (int? -> int)
Type underlyingType = Nullable.GetUnderlyingType(typeof (T)) ?? typeof (T);
var config = new PropertyConventionConfiguration().Where(p => p.PropertyType == underlyingType);
ConventionConfigurations.Add(config);
return config;
}
#region EditorBrowsableStates
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
public override string ToString()
{
return base.ToString();
}
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
{
return base.Equals(obj);
}
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode()
{
return base.GetHashCode();
}
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
public new Type GetType()
{
return base.GetType();
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using Dapper.FluentMap.Mapping;
namespace Dapper.FluentMap.Conventions
{
/// <summary>
/// Represents a convention for mapping entity properties to column names.
/// </summary>
public abstract class Convention
{
/// <summary>
/// Initializes a new instance of the <see cref="T:Dapper.FluentMap.Conventions.Convention"/> class.
/// </summary>
protected Convention()
{
ConventionConfigurations = new List<PropertyConventionConfiguration>();
PropertyMaps = new List<PropertyMap>();
}
internal IList<PropertyConventionConfiguration> ConventionConfigurations { get; private set; }
internal IList<PropertyMap> PropertyMaps { get; private set; }
/// <summary>
/// Configures a convention that applies on all properties of the entity.
/// </summary>
/// <returns>A configuration object for the convention.</returns>
protected PropertyConventionConfiguration Properties()
{
var config = new PropertyConventionConfiguration();
ConventionConfigurations.Add(config);
return config;
}
/// <summary>
/// Configures a convention that applies on all the properties of a specified type of the entity.
/// </summary>
/// <typeparam name="T">The type of the properties that the convention will apply to.</typeparam>
/// <returns>A configuration object for the convention.</returns>
protected PropertyConventionConfiguration Properties<T>()
{
// Get the underlying type for a nullale type. (int? -> int)
Type underlyingType = Nullable.GetUnderlyingType(typeof (T)) ?? typeof (T);
var config = new PropertyConventionConfiguration().Where(p => p.PropertyType == underlyingType);
ConventionConfigurations.Add(config);
return config;
}
}
}
|
mit
|
C#
|
7f7788baf1a7fb14a070731203dd84794b7e3d2e
|
update SearchCriteria
|
lianzhao/WikiaWP,lianzhao/WikiaWP,lianzhao/WikiaWP
|
src/ZhAsoiafWiki.Plus/Models/SearchCriteria.cs
|
src/ZhAsoiafWiki.Plus/Models/SearchCriteria.cs
|
namespace ZhAsoiafWiki.Plus.Models
{
public class SearchCriteria
{
public string Query { get; set; }
public int Page { get; set; }
public int? PageSize { get; set; }
public int? AbstractLength { get; set; }
public int? ThumbnailWidth { get; set; }
public int? ThumbnailHeight { get; set; }
public bool IsValidRequest()
{
return !string.IsNullOrEmpty(Query) && Page >= 0;
}
public bool IsExactSearch()
{
return Page == 0;
}
}
}
|
namespace ZhAsoiafWiki.Plus.Models
{
public class SearchCriteria
{
public string Query { get; set; }
public int Page { get; set; }
public int? PageSize { get; set; }
public bool IsValidRequest()
{
return !string.IsNullOrEmpty(Query) && Page >= 0;
}
public bool IsExactSearch()
{
return Page == 0;
}
}
}
|
mit
|
C#
|
866bf0340a2db0ad4dba0e9303e360a09a596095
|
Rename unit test function to be more explicit on its purpose.
|
jbogard/MediatR
|
test/MediatR.Tests/NotificationHandlerTests.cs
|
test/MediatR.Tests/NotificationHandlerTests.cs
|
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace MediatR.Tests
{
public class NotificationHandlerTests
{
public class Ping : INotification
{
public string Message { get; set; }
}
public class PongChildHandler : NotificationHandler<Ping>
{
private readonly TextWriter _writer;
public PongChildHandler(TextWriter writer)
{
_writer = writer;
}
protected override void Handle(Ping notification)
{
_writer.WriteLine(notification.Message + " Pong");
}
}
[Fact]
public async Task Should_call_abstract_handle_method()
{
var builder = new StringBuilder();
var writer = new StringWriter(builder);
INotificationHandler<Ping> handler = new PongChildHandler(writer);
await handler.Handle(
new Ping() { Message = "Ping" },
default
);
var result = builder.ToString();
result.ShouldContain("Ping Pong");
}
}
}
|
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace MediatR.Tests
{
public class NotificationHandlerTests
{
public class Ping : INotification
{
public string Message { get; set; }
}
public class PongChildHandler : NotificationHandler<Ping>
{
private readonly TextWriter _writer;
public PongChildHandler(TextWriter writer)
{
_writer = writer;
}
protected override void Handle(Ping notification)
{
_writer.WriteLine(notification.Message + " Pong");
}
}
[Fact]
public async Task Should_call_abstract_handler()
{
var builder = new StringBuilder();
var writer = new StringWriter(builder);
INotificationHandler<Ping> handler = new PongChildHandler(writer);
await handler.Handle(
new Ping() { Message = "Ping" },
default
);
var result = builder.ToString();
result.ShouldContain("Ping Pong");
}
}
}
|
apache-2.0
|
C#
|
44177eea1a0c43d070041ea31fc95d165e073f2d
|
fix case.
|
thinkingmedia/Prometheus
|
Prometheus/Nodes/Types/UndefinedType.cs
|
Prometheus/Nodes/Types/UndefinedType.cs
|
using System;
using System.Diagnostics;
using Prometheus.Nodes.Types.Attributes;
using Prometheus.Nodes.Types.Bases;
namespace Prometheus.Nodes.Types
{
/// <summary>
/// Represents an undefined value.
/// </summary>
[DebuggerDisplay("Undefined")]
[DataTypeInfo("Undefined")]
public class UndefinedType : DataType
{
/// <summary>
/// Represents an undefined data type.
/// </summary>
public static readonly UndefinedType Undefined = new UndefinedType();
/// <summary>
/// Debug message
/// </summary>
public override string ToString()
{
return "undefined";
}
}
}
|
using System.Diagnostics;
using Prometheus.Nodes.Types.Attributes;
using Prometheus.Nodes.Types.Bases;
namespace Prometheus.Nodes.Types
{
/// <summary>
/// Represents an undefined value.
/// </summary>
[DebuggerDisplay("Undefined")]
[DataTypeInfo("Undefined")]
public class UndefinedType : DataType
{
/// <summary>
/// Represents an undefined data type.
/// </summary>
public static readonly UndefinedType Undefined = new UndefinedType();
/// <summary>
/// Debug message
/// </summary>
public override string ToString()
{
return "undefined";
}
}
}
|
mit
|
C#
|
dd229b40c0b80ea024dd1f9ee6b87d7b54e5f3d2
|
Remove unused code
|
claudiospizzi/DSCPullServerWeb
|
Sources/DSCPullServerWeb/Helpers/FileActionResult.cs
|
Sources/DSCPullServerWeb/Helpers/FileActionResult.cs
|
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;
namespace DSCPullServerWeb.Helpers
{
public class FileActionResult : IHttpActionResult
{
private FileInfo _file;
public FileActionResult(FileInfo file)
{
_file = file;
}
public Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
{
HttpResponseMessage response = new HttpResponseMessage();
response.Content = new StreamContent(File.OpenRead(_file.FullName));
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
return Task.FromResult(response);
}
}
}
|
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;
namespace DSCPullServerWeb.Helpers
{
public class FileActionResult : IHttpActionResult
{
private FileInfo _file;
public FileActionResult(FileInfo file)
{
_file = file;
}
public Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
{
HttpResponseMessage response = new HttpResponseMessage();
response.Content = new StreamContent(File.OpenRead(_file.FullName));
//response.Content = new StreamContent(File.OpenRead(_file.FullName + ".checksum"));
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
// NOTE: Here I am just setting the result on the Task and not really doing any async stuff.
// But let's say you do stuff like contacting a File hosting service to get the file, then you would do 'async' stuff here.
return Task.FromResult(response);
}
}
}
|
mit
|
C#
|
83b9bbe13bd6d4364ad68bc822fc9cce83fe4a6c
|
Fix for windows: custom font was disposed PrivateFontCollection was not kept in memory, causing the loaded font to be disposed, causing a later crash.
|
tzachshabtay/MonoAGS
|
Engine/UI/Text/AGSFontLoader.cs
|
Engine/UI/Text/AGSFontLoader.cs
|
using System;
using AGS.API;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Drawing.Text;
using System.Collections.Generic;
namespace AGS.Engine
{
public class AGSFontLoader
{
private IResourceLoader _resources;
private PrivateFontCollection _fontCollection;
private Dictionary<string, FontFamily> _families;
public AGSFontLoader(IResourceLoader resources)
{
_resources = resources;
_fontCollection = new PrivateFontCollection();
_families = new Dictionary<string, FontFamily>();
}
public FontFamily LoadFontFamily(string path)
{
return _families.GetOrAdd(path, () => loadFontFamily(path));
}
private FontFamily loadFontFamily(string path)
{
IResource resource = _resources.LoadResource(path);
var buffer = new byte[resource.Stream.Length];
resource.Stream.Read(buffer, 0, buffer.Length);
IntPtr fontPtr = Marshal.AllocCoTaskMem(buffer.Length);
Marshal.Copy(buffer, 0, fontPtr, buffer.Length);
//todo: this only works on windows: http://stackoverflow.com/questions/32406859/privatefontcollection-in-mono-3-2-8-on-linux-ubuntu-14-04-1
_fontCollection.AddMemoryFont(fontPtr, buffer.Length);
Marshal.FreeCoTaskMem(fontPtr);
return _fontCollection.Families[_fontCollection.Families.Length - 1];
/*var handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
/*try
{
var ptr = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0);
PrivateFontCollection fontCollection = new PrivateFontCollection();
fontCollection.AddMemoryFont(ptr, buffer.Length);
return fontCollection.Families[0];
}
finally
{
// don't forget to unpin the array!
handle.Free();
}*/
}
}
}
|
using System;
using AGS.API;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Drawing.Text;
namespace AGS.Engine
{
public class AGSFontLoader
{
private IResourceLoader _resources;
public AGSFontLoader(IResourceLoader resources)
{
_resources = resources;
}
public FontFamily LoadFontFamily(string path)
{
IResource resource = _resources.LoadResource(path);
var buffer = new byte[resource.Stream.Length];
resource.Stream.Read(buffer, 0, buffer.Length);
IntPtr fontPtr = Marshal.AllocCoTaskMem(buffer.Length);
Marshal.Copy(buffer, 0, fontPtr, buffer.Length);
//todo: this only works on windows: http://stackoverflow.com/questions/32406859/privatefontcollection-in-mono-3-2-8-on-linux-ubuntu-14-04-1
PrivateFontCollection fontCollection = new PrivateFontCollection();
fontCollection.AddMemoryFont(fontPtr, buffer.Length);
Marshal.FreeCoTaskMem(fontPtr);
return fontCollection.Families[0];
/*var handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
/*try
{
var ptr = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0);
PrivateFontCollection fontCollection = new PrivateFontCollection();
fontCollection.AddMemoryFont(ptr, buffer.Length);
return fontCollection.Families[0];
}
finally
{
// don't forget to unpin the array!
handle.Free();
}*/
}
}
}
|
artistic-2.0
|
C#
|
45c59c7296eb7fece73bd9dada3f9d67d8c6db04
|
Revert "View インスタンスが何度も作られないよう修正"
|
veigr/EventMapHpViewer,liaoleon/EventMapHpViewer,FreyYa/EventMapHpViewer,Grabacr07/EventMapHpViewer
|
EventMapHpViewer/MapHpViewer.cs
|
EventMapHpViewer/MapHpViewer.cs
|
using System.ComponentModel.Composition;
using EventMapHpViewer.Models;
using EventMapHpViewer.ViewModels;
using Grabacr07.KanColleViewer.Composition;
namespace EventMapHpViewer
{
[Export(typeof(IPlugin))]
[Export(typeof(ITool))]
[ExportMetadata("Guid", "101436F4-9308-4892-A88A-19EFBDF2ED5F")]
[ExportMetadata("Title", "MapHPViewer")]
[ExportMetadata("Description", "Map HPを表示します。")]
[ExportMetadata("Version", "2.3")]
[ExportMetadata("Author", "@veigr")]
public class MapHpViewer : IPlugin, ITool
{
private readonly ToolViewModel _vm = new ToolViewModel(new MapInfoProxy());
public void Initialize() {}
public string Name => "MapHP";
public object View => new ToolView { DataContext = this._vm };
}
}
|
using System.ComponentModel.Composition;
using EventMapHpViewer.Models;
using EventMapHpViewer.ViewModels;
using Grabacr07.KanColleViewer.Composition;
namespace EventMapHpViewer
{
[Export(typeof(IPlugin))]
[Export(typeof(ITool))]
[ExportMetadata("Guid", "101436F4-9308-4892-A88A-19EFBDF2ED5F")]
[ExportMetadata("Title", "MapHPViewer")]
[ExportMetadata("Description", "Map HPを表示します。")]
[ExportMetadata("Version", "2.3.0")]
[ExportMetadata("Author", "@veigr")]
public class MapHpViewer : IPlugin, ITool
{
private readonly ToolView v = new ToolView { DataContext = new ToolViewModel(new MapInfoProxy()) };
public void Initialize() {}
public string Name => "MapHP";
public object View => this.v;
}
}
|
mit
|
C#
|
e26f650764d5fa3e9754d9ac37f6cd96cca5e7e4
|
Comment out debug message (no longer required) [ci skip]
|
Voxelgon/Voxelgon,Voxelgon/Voxelgon
|
Assets/Plugins/Voxelgon/Spacecraft/ShipManager.cs
|
Assets/Plugins/Voxelgon/Spacecraft/ShipManager.cs
|
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using Voxelgon;
[RequireComponent (typeof (Rigidbody))]
public class ShipManager : MonoBehaviour {
public float portTransCutoff = 5;
//Setup Variables for gathering Ports
public enum Direction{
YawLeft,
YawRight,
TransLeft,
TransRight,
TransForw,
TransBack
}
//dictionary of ports
public Dictionary<Direction, List<GameObject> > portGroups = new Dictionary<Direction, List<GameObject> > ();
public void SetupPorts(){
portGroups.Add( Direction.YawLeft, new List<GameObject>() );
portGroups.Add( Direction.YawRight, new List<GameObject>() );
portGroups.Add( Direction.TransLeft, new List<GameObject>() );
portGroups.Add( Direction.TransRight, new List<GameObject>() );
portGroups.Add( Direction.TransForw, new List<GameObject>() );
portGroups.Add( Direction.TransBack, new List<GameObject>() );
Vector3 origin = transform.rigidbody.centerOfMass;
//Debug.Log(origin);
Component[] PortScripts = gameObject.GetComponentsInChildren(typeof(RCSport));
foreach(Component i in PortScripts) {
float angle = Voxelgon.Math.RelativeAngle(origin, i.transform);
//Debug.Log(angle);
if(angle > portTransCutoff){
portGroups[Direction.YawLeft].Add(i.gameObject);
//Debug.Log("This port is for turning Left!");
} else if(angle < (-1 * portTransCutoff)){
portGroups[Direction.YawRight].Add(i.gameObject);
//Debug.Log("This port is for turning right!");
}
}
}
//Startup Script
public void Start() {
SetupPorts();
}
}
|
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using Voxelgon;
[RequireComponent (typeof (Rigidbody))]
public class ShipManager : MonoBehaviour {
public float portTransCutoff = 5;
//Setup Variables for gathering Ports
public enum Direction{
YawLeft,
YawRight,
TransLeft,
TransRight,
TransForw,
TransBack
}
//dictionary of ports
public Dictionary<Direction, List<GameObject> > portGroups = new Dictionary<Direction, List<GameObject> > ();
public void SetupPorts(){
portGroups.Add( Direction.YawLeft, new List<GameObject>() );
portGroups.Add( Direction.YawRight, new List<GameObject>() );
portGroups.Add( Direction.TransLeft, new List<GameObject>() );
portGroups.Add( Direction.TransRight, new List<GameObject>() );
portGroups.Add( Direction.TransForw, new List<GameObject>() );
portGroups.Add( Direction.TransBack, new List<GameObject>() );
Vector3 origin = transform.rigidbody.centerOfMass;
Debug.Log(origin);
Component[] PortScripts = gameObject.GetComponentsInChildren(typeof(RCSport));
foreach(Component i in PortScripts) {
float angle = Voxelgon.Math.RelativeAngle(origin, i.transform);
//Debug.Log(angle);
if(angle > portTransCutoff){
portGroups[Direction.YawLeft].Add(i.gameObject);
//Debug.Log("This port is for turning Left!");
} else if(angle < (-1 * portTransCutoff)){
portGroups[Direction.YawRight].Add(i.gameObject);
//Debug.Log("This port is for turning right!");
}
}
}
//Startup Script
public void Start() {
SetupPorts();
}
}
|
apache-2.0
|
C#
|
a0a33ea3b9387d660fdbe129abd1014becd67d04
|
Enable TLS Usage
|
iquirino/NetStash
|
NetStash/Properties/AssemblyInfo.cs
|
NetStash/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("NetStash")]
[assembly: AssemblyDescription("Logstash sender for .NET - Send events to logstash instance via TCP/TLS")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Igor Quirino @ WareBoss LTDA - ME")]
[assembly: AssemblyProduct("NetStash")]
[assembly: AssemblyCopyright("Copyright © WareBoss 2019")]
[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("0269533a-f063-4572-8c54-9b3b34e6eab9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
|
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("NetStash")]
[assembly: AssemblyDescription("Logstash sender for .NET - Send events to logstash instance via TCP")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Igor Quirino @ Vox Tecnologia LTDA - ME")]
[assembly: AssemblyProduct("NetStash")]
[assembly: AssemblyCopyright("Copyright © Vox Tecnologia 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0269533a-f063-4572-8c54-9b3b34e6eab9")]
// 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.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
|
apache-2.0
|
C#
|
423e3cc9b6c8291a4d6b4f71148d1f47c3bc36da
|
Use ObservableCollection for ComboBox item source so that the ComboBox updates when the list changes.
|
ushadow/handinput,ushadow/handinput,ushadow/handinput
|
GesturesViewer/ModelSelector.cs
|
GesturesViewer/ModelSelector.cs
|
using System;
using System.IO;
using System.ComponentModel;
using System.Text.RegularExpressions;
using System.Collections.ObjectModel;
using Common.Logging;
namespace GesturesViewer {
class ModelSelector : INotifyPropertyChanged {
static readonly ILog Log = LogManager.GetCurrentClassLogger();
static readonly String ModelFilePattern = "*.mat";
// File names that ends with time stamp.
static readonly String TimeRegex = @"^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}";
public event PropertyChangedEventHandler PropertyChanged;
public ObservableCollection<String> ModelFiles { get; private set; }
public String SelectedModel {
get {
return selectedModel;
}
set {
selectedModel = value;
OnPropteryChanged("SelectedModel");
}
}
String selectedModel, dir;
public ModelSelector(String dir) {
this.dir = dir;
ModelFiles = new ObservableCollection<String>();
Refresh();
}
public void Refresh() {
Log.Debug("Refresh models.");
var files = Directory.GetFiles(dir, ModelFilePattern);
ModelFiles.Clear();
foreach (var f in files) {
ModelFiles.Add(f);
var fileName = Path.GetFileName(f);
if (SelectedModel == null || Regex.IsMatch(fileName, TimeRegex))
SelectedModel = f;
}
}
void OnPropteryChanged(String prop) {
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(prop));
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Text.RegularExpressions;
using Common.Logging;
namespace GesturesViewer {
class ModelSelector : INotifyPropertyChanged {
static readonly ILog Log = LogManager.GetCurrentClassLogger();
static readonly String ModelFilePattern = "*.mat";
// File names that ends with time stamp.
static readonly String TimeRegex = @"^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}";
public event PropertyChangedEventHandler PropertyChanged;
public List<String> ModelFiles { get; private set; }
public String SelectedModel {
get {
return selectedModel;
}
set {
selectedModel = value;
OnPropteryChanged("SelectedModel");
}
}
String selectedModel, dir;
public ModelSelector(String dir) {
this.dir = dir;
ModelFiles = new List<String>();
Refresh();
}
public void Refresh() {
Log.Debug("Refresh models.");
var files = Directory.GetFiles(dir, ModelFilePattern);
ModelFiles.Clear();
foreach (var f in files) {
ModelFiles.Add(f);
var fileName = Path.GetFileName(f);
if (SelectedModel == null || Regex.IsMatch(fileName, TimeRegex))
SelectedModel = f;
}
}
void OnPropteryChanged(String prop) {
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(prop));
}
}
}
|
mit
|
C#
|
bbae930a81d0305a0a710b645c9ea6a750c1775d
|
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.1")]
[assembly: AssemblyInformationalVersion("0.8.1")]
/*
* Version 0.8.1
*
* Rename naive to default:
* - NaiveTheoremAttribute -> DefaultTheoremAttribute
* - NaiveFirstClassTheoremAttribute - NaiveFirstClassTheoremAttribute
*
* This renaming is breaking change but as the current major version is
* zero(unstable), the change is acceptable according to Semantic Versioning.
*
* Issue
* - https://github.com/jwChung/Experimentalism/issues/24
*
* Pull requests
* - https://github.com/jwChung/Experimentalism/pull/25
*/
|
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.0")]
[assembly: AssemblyInformationalVersion("0.8.0")]
/*
* Version 0.8.0
*
* - Implemented the feature of First class tests, which is
* varataion of parameterized tests.
*
* Closes https://github.com/jwChung/Experimentalism/pull/19
*
* Related to pull requests:
* https://github.com/jwChung/Experimentalism/pull/20
* https://github.com/jwChung/Experimentalism/pull/21
* https://github.com/jwChung/Experimentalism/pull/22
*/
|
mit
|
C#
|
abd9ddc7fbef7d85e4f03ae1a878f454d32b8494
|
test of line ending stuff
|
utunga/Tradeify,utunga/Tradeify
|
Offr.Tests/MockMessageParser.cs
|
Offr.Tests/MockMessageParser.cs
|
using System;
using Offr.Message;
using Offr.Text;
namespace Offr.Tests
{
public class MockMessageParser : IMessageParser
{
//hi mum
public IMessage Parse(IRawMessage source)
{
if (!(source is MockRawMessage))
{
throw new ApplicationException("MockSourceText only knows how to deal with MockSourceText");
}
// mockRawMessage saves you the trouble of parsing because - hey! its already parsed!
MockRawMessage mockRaw = (MockRawMessage) source;
OfferMessage msg = new OfferMessage();
msg.CreatedBy = mockRaw.CreatedBy;
msg.Location = mockRaw.Location;
msg.MoreInfoURL = mockRaw.MoreInfoURL;
msg.CreatedBy = mockRaw.CreatedBy;
msg.OfferText = mockRaw.OfferText;
if (mockRaw.EndBy.HasValue)
{
msg.SetEndBy(mockRaw.EndByText, mockRaw.EndBy.Value);
}
else
{
msg.ClearEndBy();
}
msg.Source = mockRaw;
foreach (ITag tag in mockRaw.Tags)
{
msg.Tags.Add(tag);
}
msg.IsValid = true;
return msg;
}
}
}
|
using System;
using Offr.Message;
using Offr.Text;
namespace Offr.Tests
{
public class MockMessageParser : IMessageParser
{
public IMessage Parse(IRawMessage source)
{
if (!(source is MockRawMessage))
{
throw new ApplicationException("MockSourceText only knows how to deal with MockSourceText");
}
// mockRawMessage saves you the trouble of parsing because - hey! its already parsed!
MockRawMessage mockRaw = (MockRawMessage) source;
OfferMessage msg = new OfferMessage();
msg.CreatedBy = mockRaw.CreatedBy;
msg.Location = mockRaw.Location;
msg.MoreInfoURL = mockRaw.MoreInfoURL;
msg.CreatedBy = mockRaw.CreatedBy;
msg.OfferText = mockRaw.OfferText;
if (mockRaw.EndBy.HasValue)
{
msg.SetEndBy(mockRaw.EndByText, mockRaw.EndBy.Value);
}
else
{
msg.ClearEndBy();
}
msg.Source = mockRaw;
foreach (ITag tag in mockRaw.Tags)
{
msg.Tags.Add(tag);
}
msg.IsValid = true;
return msg;
}
}
}
|
agpl-3.0
|
C#
|
70535c262763e4a4f7ea99677c51a8461de29340
|
Fix performance logger format
|
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
|
InfinniPlatform.Core/Logging/PerformanceLogger.cs
|
InfinniPlatform.Core/Logging/PerformanceLogger.cs
|
using System;
using Microsoft.Extensions.Logging;
namespace InfinniPlatform.Logging
{
public class PerformanceLogger<TComponent> : IPerformanceLogger<TComponent>
{
public PerformanceLogger(ILogger<IPerformanceLogger<TComponent>> logger)
{
_logger = logger;
}
private readonly ILogger _logger;
public void Log(string method, TimeSpan duration, Exception exception = null)
{
LogInternal(method, duration.TotalMilliseconds, exception);
}
public void Log(string method, DateTime start, Exception exception = null)
{
LogInternal(method, (DateTime.Now - start).TotalMilliseconds, exception);
}
private void LogInternal(string method, double duration, Exception exception)
{
string MessageFormatter(object m, Exception e) => m.ToString();
_logger.Log(LogLevel.Information, 0, new PerformanceLoggerEvent(method, duration), exception, MessageFormatter);
}
private class PerformanceLoggerEvent
{
public PerformanceLoggerEvent(string method, double duration)
{
_method = method;
_duration = duration;
}
private readonly string _method;
private readonly double _duration;
public override string ToString()
{
return string.Format("{{ \"m\":\"{0}\", \"d\": {1:N0} }}", _method, _duration);
}
}
}
}
|
using System;
using Microsoft.Extensions.Logging;
namespace InfinniPlatform.Logging
{
public class PerformanceLogger<TComponent> : IPerformanceLogger<TComponent>
{
public PerformanceLogger(ILogger<IPerformanceLogger<TComponent>> logger)
{
_logger = logger;
}
private readonly ILogger _logger;
public void Log(string method, TimeSpan duration, Exception exception = null)
{
LogInternal(method, duration.TotalMilliseconds, exception);
}
public void Log(string method, DateTime start, Exception exception = null)
{
LogInternal(method, (DateTime.Now - start).TotalMilliseconds, exception);
}
private void LogInternal(string method, double duration, Exception exception)
{
string MessageFormatter(object m, Exception e) => m.ToString();
_logger.Log(LogLevel.Information, 0, new PerformanceLoggerEvent(method, duration), exception, MessageFormatter);
}
private class PerformanceLoggerEvent
{
public PerformanceLoggerEvent(string method, double duration)
{
_method = method;
_duration = duration;
}
private readonly string _method;
private readonly double _duration;
public override string ToString()
{
return string.Format("{{ \"d\":\"{0}\", \"d\": {1:N0} }}", _method, _duration);
}
}
}
}
|
agpl-3.0
|
C#
|
44a29efe00917f78640722a231ed9948c897278c
|
Fix #15
|
arthurrump/Zermelo.App.UWP
|
Zermelo.App.UWP/Login/LoginViewModel.cs
|
Zermelo.App.UWP/Login/LoginViewModel.cs
|
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.Azure.Mobile.Analytics;
using Template10.Mvvm;
using Windows.UI.Xaml.Navigation;
using Zermelo.App.UWP.Services;
namespace Zermelo.App.UWP.Login
{
public class LoginViewModel : ViewModelBase
{
Stopwatch _stopwatch;
ISettingsService _settings;
IZermeloAuthenticationService _authService;
public LoginViewModel(ISettingsService settings, IZermeloAuthenticationService authService)
{
_stopwatch = new Stopwatch();
_settings = settings;
_authService = authService;
LogIn = new DelegateCommand(async () =>
{
var auth = await _authService.GetAuthentication(School, Code);
_settings.Token = auth.Token;
_stopwatch.Stop();
Analytics.TrackEvent("LogIn", new Dictionary<string, string>
{
{ "TimeElapsed (ms)", _stopwatch.ElapsedMilliseconds.ToString() }
});
(App.Current as App).StartAuthenticated();
});
_stopwatch.Start();
}
public DelegateCommand LogIn { get; }
public string School
{
get => _settings.School;
set
{
_settings.School = value;
RaisePropertyChanged();
}
}
string code;
public string Code
{
get => code;
set
{
code = value;
RaisePropertyChanged();
}
}
}
}
|
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.Azure.Mobile.Analytics;
using Template10.Mvvm;
using Windows.UI.Xaml.Navigation;
using Zermelo.App.UWP.Services;
namespace Zermelo.App.UWP.Login
{
public class LoginViewModel : ViewModelBase
{
Stopwatch _stopwatch;
ISettingsService _settings;
IZermeloAuthenticationService _authService;
public LoginViewModel(ISettingsService settings, IZermeloAuthenticationService authService)
{
_stopwatch = new Stopwatch();
_settings = settings;
_authService = authService;
LogIn = new DelegateCommand(async () =>
{
var auth = await _authService.GetAuthentication(School, Code);
_settings.Token = auth.Token;
_stopwatch.Stop();
Analytics.TrackEvent("LogIn", new Dictionary<string, string>
{
{ "TimeElapsed (ms)", _stopwatch.ElapsedMilliseconds.ToString() }
});
(App.Current as App).StartAuthenticated();
});
}
public DelegateCommand LogIn { get; }
public string School
{
get => _settings.School;
set
{
_settings.School = value;
RaisePropertyChanged();
}
}
string code;
public string Code
{
get => code;
set
{
code = value;
RaisePropertyChanged();
}
}
public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state)
{
_stopwatch.Start();
return Task.CompletedTask;
}
}
}
|
mit
|
C#
|
c26f276f8d2c4e5dd162e91de972a49619116319
|
Update ElasticIndexServices.cs
|
siuccwd/IOER,siuccwd/IOER,siuccwd/IOER
|
Services/Isle.BizServices/ElasticIndexServices.cs
|
Services/Isle.BizServices/ElasticIndexServices.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LRWarehouse.Business;
using LRWarehouse.DAL;
using LRWarehouse.Business.ResourceV2;
using System.Runtime.Caching;
using System.Collections.Concurrent;
using System.Threading;
namespace Isle.BizServices
{
public class ElasticIndexServices
{
/// <summary>
/// Remove a resource version document
/// </summary>
/// <param name="resourceVersionId"></param>
/// <param name="response"></param>
public static void RemoveResourceVersion( int resourceVersionId, ref string response )
{
response = "";
//new ElasticSearchManager().DeleteByVersionID( resourceVersionId, ref response );
new ElasticSearchManager().DeleteResource( new ResourceVersionManager().Get( resourceVersionId ).ResourceIntId );
}
//
/// <summary>
/// Remove a resource version document
/// </summary>
/// <param name="resourceId"></param>
/// <param name="response"></param>
public static void RemoveResource( int resourceId, ref string response )
{
response = "";
//new ElasticSearchManager().DeleteByIntID( resourceId, ref response );
new ElasticSearchManager().DeleteResource( resourceId );
}
//
/// <summary>
/// This is obsolete now, as is the same as RemoveResource( int resourceId, ref string response )
/// </summary>
/// <param name="resourceId"></param>
/// <param name="response"></param>
[Obsolete]
public static void RemoveResource_NewCollection( int resourceId, ref string response )
{
response = "";
//new ElasticSearchManager().NewCollection_DeleteByID( resourceId, ref response );
new ElasticSearchManager().DeleteResource( resourceId );
}
//
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LRWarehouse.Business;
using LRWarehouse.DAL;
namespace Isle.BizServices
{
public class ElasticIndexServices
{
/// <summary>
/// Remove a resource version document
/// </summary>
/// <param name="resourceVersionId"></param>
/// <param name="response"></param>
public static void RemoveResourceVersion( int resourceVersionId, ref string response )
{
response = "";
//new ElasticSearchManager().DeleteByVersionID( resourceVersionId, ref response );
new ElasticSearchManager().DeleteResource( new ResourceVersionManager().Get( resourceVersionId ).ResourceIntId );
}
/// <summary>
/// Remove a resource version document
/// </summary>
/// <param name="resourceId"></param>
/// <param name="response"></param>
public static void RemoveResource( int resourceId, ref string response )
{
response = "";
//new ElasticSearchManager().DeleteByIntID( resourceId, ref response );
new ElasticSearchManager().DeleteResource( resourceId );
}
public static void RemoveResource_NewCollection( int resourceId, ref string response )
{
response = "";
//new ElasticSearchManager().NewCollection_DeleteByID( resourceId, ref response );
new ElasticSearchManager().DeleteResource( resourceId );
}
}
}
|
apache-2.0
|
C#
|
b9781a2e07befab8369915c97084af3d13a371a6
|
Fix PATH for non-Windows hosts (#36)
|
rosolko/WebDriverManager.Net
|
WebDriverManager/Services/Impl/VariableService.cs
|
WebDriverManager/Services/Impl/VariableService.cs
|
using System;
using System.IO;
namespace WebDriverManager.Services.Impl
{
public class VariableService : IVariableService
{
public void SetupVariable(string path)
{
UpdatePath(path);
}
protected void UpdatePath(string path)
{
const string name = "PATH";
var pathVariable = Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process);
if (pathVariable == null) throw new ArgumentNullException($"Can't get {name} variable");
path = Path.GetDirectoryName(path);
var newPathVariable = $"{path}{Path.PathSeparator}{pathVariable}";
if (path != null && !pathVariable.Contains(path))
Environment.SetEnvironmentVariable(name, newPathVariable, EnvironmentVariableTarget.Process);
}
}
}
|
using System;
using System.IO;
namespace WebDriverManager.Services.Impl
{
public class VariableService : IVariableService
{
public void SetupVariable(string path)
{
UpdatePath(path);
}
protected void UpdatePath(string path)
{
const string name = "PATH";
var pathVariable = Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process);
if (pathVariable == null) throw new ArgumentNullException($"Can't get {name} variable");
path = Path.GetDirectoryName(path);
var newPathVariable = $"{path};{pathVariable}";
if (path != null && !pathVariable.Contains(path))
Environment.SetEnvironmentVariable(name, newPathVariable, EnvironmentVariableTarget.Process);
}
}
}
|
mit
|
C#
|
906b5ef4b4cf1fea35c2e537967d45e4a9525cf1
|
refactor for readability
|
gregoryjscott/please,ResourceDataInc/please,jtroe/please,jtroe/please,jtroe/please,ResourceDataInc/please,ResourceDataInc/please,gregoryjscott/please,gregoryjscott/please
|
app/Library/Migrate/Tasks/RunMissingMigrations.cs
|
app/Library/Migrate/Tasks/RunMissingMigrations.cs
|
using System.Linq;
using Library.Migrate.Model;
using Simpler;
namespace Library.Migrate.Tasks
{
public class RunMissingMigrations : InTask<RunMissingMigrations.Input>
{
public class Input
{
public string ConnectionName { get; set; }
public Version[] InstalledVersions { get; set; }
public Migration[] Migrations { get; set; }
}
public RunMigration RunMigration { get; set; }
public override void Execute()
{
var allVersionIds = In.Migrations
.OrderBy(m => m.VersionId)
.Select(m => m.VersionId).Distinct();
foreach (var versionId in allVersionIds)
{
if (In.InstalledVersions.All(installed => installed.Id != versionId))
{
var missingVersionId = versionId;
var migrationsForMissingVersion = In.Migrations
.Where(m => m.VersionId == missingVersionId)
.OrderBy(m => m.FileName);
foreach (var migration in migrationsForMissingVersion)
{
RunMigration.In.ConnectionName = In.ConnectionName;
RunMigration.In.Migration = migration;
RunMigration.Execute();
}
}
}
}
}
}
|
using System.Linq;
using Library.Migrate.Model;
using Simpler;
namespace Library.Migrate.Tasks
{
public class RunMissingMigrations : InTask<RunMissingMigrations.Input>
{
public class Input
{
public string ConnectionName { get; set; }
public Version[] InstalledVersions { get; set; }
public Migration[] Migrations { get; set; }
}
public RunMigration RunMigration { get; set; }
public override void Execute()
{
foreach (var versionId in In.Migrations
.OrderBy(m => m.VersionId)
.Select(m => m.VersionId).Distinct())
{
if (In.InstalledVersions.All(installed => installed.Id != versionId))
{
foreach (var migration in In.Migrations
.Where(m => m.VersionId == versionId)
.OrderBy(m => m.FileName))
{
RunMigration.In.ConnectionName = In.ConnectionName;
RunMigration.In.Migration = migration;
RunMigration.Execute();
}
}
}
}
}
}
|
mit
|
C#
|
d36227084ed2b169b1e82b1c473882a17ea72e52
|
Fix - In "aggiungi nuovo utente" la ricerca filtra sia per nome che per cognome
|
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
|
src/backend/SO115App.FakePersistance.ExternalAPI/Servizi/Personale/GetPersonaleVVF.cs
|
src/backend/SO115App.FakePersistance.ExternalAPI/Servizi/Personale/GetPersonaleVVF.cs
|
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using SO115App.ExternalAPI.Fake.Classi.PersonaleUtentiComuni;
using SO115App.ExternalAPI.Fake.Classi.Utility;
using SO115App.Models.Classi.Utenti.Autenticazione;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Personale;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
namespace SO115App.ExternalAPI.Fake.Servizi.Personale
{
/// <summary>
/// classe che implementa il servizio per il recupero del personale da Utente Comuni
/// </summary>
public class GetPersonaleVVF : IGetPersonaleVVF
{
private readonly HttpClient _client;
private readonly IConfiguration _configuration;
/// <summary>
/// costruttore della classe
/// </summary>
/// <param name="client"></param>
/// <param name="configuration"></param>
public GetPersonaleVVF(HttpClient client, IConfiguration configuration)
{
_client = client;
_configuration = configuration;
}
/// <summary>
/// il metodo get della classe
/// </summary>
/// <param name="text">la stringa per la ricerca sul nome o il cognome</param>
/// <param name="codSede">l'eventuale codice sede</param>
/// <returns>una lista di Personale</returns>
public async Task<List<PersonaleVVF>> Get(string text, string codSede = null)
{
_client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("test");
string[] lstSegmenti = new string[6];
if (text != null)
lstSegmenti = text.Split(" ", StringSplitOptions.RemoveEmptyEntries);
List<PersonaleUC> personaleUC = new List<PersonaleUC>();
Parallel.ForEach(lstSegmenti, segmento =>
{
var response = _client.GetStringAsync($"{_configuration.GetSection("UrlExternalApi").GetSection("PersonaleApiUtenteComuni").Value}?searchKey={segmento}")
.ConfigureAwait(true).GetAwaiter().GetResult();
lock (personaleUC) { personaleUC.AddRange(JsonConvert.DeserializeObject<List<PersonaleUC>>(response)); };
});
return MapPersonaleVVFsuPersonaleUC.Map(personaleUC.Distinct().ToList());
}
}
}
|
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using SO115App.ExternalAPI.Fake.Classi.PersonaleUtentiComuni;
using SO115App.ExternalAPI.Fake.Classi.Utility;
using SO115App.Models.Classi.Utenti.Autenticazione;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Personale;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
namespace SO115App.ExternalAPI.Fake.Servizi.Personale
{
/// <summary>
/// classe che implementa il servizio per il recupero del personale da Utente Comuni
/// </summary>
public class GetPersonaleVVF : IGetPersonaleVVF
{
private readonly HttpClient _client;
private readonly IConfiguration _configuration;
/// <summary>
/// costruttore della classe
/// </summary>
/// <param name="client"></param>
/// <param name="configuration"></param>
public GetPersonaleVVF(HttpClient client, IConfiguration configuration)
{
_client = client;
_configuration = configuration;
}
/// <summary>
/// il metodo get della classe
/// </summary>
/// <param name="text">la stringa per la ricerca sul nome o il cognome</param>
/// <param name="codSede">l'eventuale codice sede</param>
/// <returns>una lista di Personale</returns>
public async Task<List<PersonaleVVF>> Get(string text, string codSede = null)
{
_client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("test");
var response = await _client.GetAsync($"{_configuration.GetSection("UrlExternalApi").GetSection("PersonaleApiUtenteComuni").Value}?searchKey={text}").ConfigureAwait(false);
response.EnsureSuccessStatusCode();
using HttpContent content = response.Content;
string data = await content.ReadAsStringAsync().ConfigureAwait(false);
var personaleUC = JsonConvert.DeserializeObject<List<PersonaleUC>>(data);
return MapPersonaleVVFsuPersonaleUC.Map(personaleUC);
}
}
}
|
agpl-3.0
|
C#
|
6fc010e874e0bca8bc67527060f9deff900952ec
|
update nlog reports with new reporting structure
|
alhardy/Metrics.NET,ntent-ad/Metrics.NET,MetaG8/Metrics.NET,cvent/Metrics.NET,mnadel/Metrics.NET,DeonHeyns/Metrics.NET,huoxudong125/Metrics.NET,Recognos/Metrics.NET,Liwoj/Metrics.NET,alhardy/Metrics.NET,Liwoj/Metrics.NET,huoxudong125/Metrics.NET,DeonHeyns/Metrics.NET,etishor/Metrics.NET,ntent-ad/Metrics.NET,etishor/Metrics.NET,Recognos/Metrics.NET,MetaG8/Metrics.NET,cvent/Metrics.NET,MetaG8/Metrics.NET,mnadel/Metrics.NET
|
Src/Adapters/Metrics.NLog/NLogReportsConfigExtensions.cs
|
Src/Adapters/Metrics.NLog/NLogReportsConfigExtensions.cs
|
using System;
using Metrics.NLog;
using Metrics.Reporters;
using Metrics.Reports;
namespace Metrics
{
public static class NLogReportsConfigExtensions
{
/// <summary>
/// Write CSV Metrics Reports using NLog.
/// </summary>
/// <param name="reports">Instance to configure</param>
/// <param name="interval">Interval at which to report values</param>
/// <param name="delimiter">Delimiter to use for CSV</param>
/// <returns>Same Reports instance for chaining</returns>
public static MetricsReports WithNLogCSVReports(this MetricsReports reports, TimeSpan interval, string delimiter = CSVAppender.CommaDelimiter)
{
global::NLog.Config.ConfigurationItemFactory.Default.Layouts.RegisterDefinition("CsvGaugeLayout", typeof(CsvGaugeLayout));
global::NLog.Config.ConfigurationItemFactory.Default.Layouts.RegisterDefinition("CsvCounterLayout", typeof(CsvCounterLayout));
global::NLog.Config.ConfigurationItemFactory.Default.Layouts.RegisterDefinition("CsvMeterLayout", typeof(CsvMeterLayout));
global::NLog.Config.ConfigurationItemFactory.Default.Layouts.RegisterDefinition("CsvHistogramLayout", typeof(CsvHistogramLayout));
global::NLog.Config.ConfigurationItemFactory.Default.Layouts.RegisterDefinition("CsvTimerLayout", typeof(CsvTimerLayout));
reports.WithReport(new CSVReport(new NLogCSVAppender(delimiter)), interval);
return reports;
}
/// <summary>
/// Write human readable text using NLog
/// </summary>
/// <param name="reports">Instance to configure</param>
/// <param name="interval">Interval at which to report values</param>
/// <returns>Same Reports instance for chaining</returns>
public static MetricsReports WithNLogTextReports(this MetricsReports reports, TimeSpan interval)
{
reports.WithReport(new NLogTextReporter(), interval);
return reports;
}
}
}
|
using System;
using Metrics.NLog;
using Metrics.Reporters;
using Metrics.Reports;
namespace Metrics
{
public static class NLogReportsConfigExtensions
{
/// <summary>
/// Write CSV Metrics Reports using NLog.
/// </summary>
/// <param name="reports">Instance to configure</param>
/// <param name="interval">Interval at which to report values</param>
/// <param name="delimiter">Delimiter to use for CSV</param>
/// <returns>Same Reports instance for chaining</returns>
public static MetricsReports WithNLogCSVReports(this MetricsReports reports, TimeSpan interval, string delimiter = CSVAppender.CommaDelimiter)
{
global::NLog.Config.ConfigurationItemFactory.Default.Layouts.RegisterDefinition("CsvGaugeLayout", typeof(CsvGaugeLayout));
global::NLog.Config.ConfigurationItemFactory.Default.Layouts.RegisterDefinition("CsvCounterLayout", typeof(CsvCounterLayout));
global::NLog.Config.ConfigurationItemFactory.Default.Layouts.RegisterDefinition("CsvMeterLayout", typeof(CsvMeterLayout));
global::NLog.Config.ConfigurationItemFactory.Default.Layouts.RegisterDefinition("CsvHistogramLayout", typeof(CsvHistogramLayout));
global::NLog.Config.ConfigurationItemFactory.Default.Layouts.RegisterDefinition("CsvTimerLayout", typeof(CsvTimerLayout));
reports.WithReporter(() => new CSVReport(new NLogCSVAppender(delimiter)), interval);
return reports;
}
/// <summary>
/// Write human readable text using NLog
/// </summary>
/// <param name="reports">Instance to configure</param>
/// <param name="interval">Interval at which to report values</param>
/// <returns>Same Reports instance for chaining</returns>
public static MetricsReports WithNLogTextReports(this MetricsReports reports, TimeSpan interval)
{
reports.WithReporter(() => new NLogTextReporter(), interval);
return reports;
}
}
}
|
apache-2.0
|
C#
|
b20fbbace2673d3d3fe239be47be2a5f05322882
|
Remove unused usings.
|
FloodProject/flood,FloodProject/flood,FloodProject/flood
|
src/EngineManaged/PropertyNotifier.cs
|
src/EngineManaged/PropertyNotifier.cs
|
using System;
namespace Flood
{
public class PropertyAttribute : Attribute
{
}
public delegate bool PropertyChanged(object obj, string propertyName, object oldValue, object newValue);
public interface IPropertyNotifier
{
event PropertyChanged PropertyChanged;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Flood
{
public class PropertyAttribute : Attribute
{
}
public delegate bool PropertyChanged(object obj, string propertyName, object oldValue, object newValue);
public interface IPropertyNotifier
{
event PropertyChanged PropertyChanged;
}
}
|
bsd-2-clause
|
C#
|
4662ec6b443d9df2bf350a9704635b4976ef615d
|
Bump patch version
|
inputfalken/Sharpy
|
src/Sharpy/Properties/AssemblyInfo.cs
|
src/Sharpy/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("Sharpy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sharpy")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//Makes my internal items visibile to the test project
[assembly: InternalsVisibleTo("Tests")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e4c60589-e7ce-471c-82e3-28c356cd1191")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("3.5.6.0")]
[assembly: AssemblyInformationalVersion("3.5.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("Sharpy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sharpy")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//Makes my internal items visibile to the test project
[assembly: InternalsVisibleTo("Tests")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e4c60589-e7ce-471c-82e3-28c356cd1191")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("3.5.5.0")]
[assembly: AssemblyInformationalVersion("3.5.5")]
|
mit
|
C#
|
24632dbbbd791906225a080b7179231fc3acc083
|
Remove tap repo stuff
|
RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast
|
RightpointLabs.Pourcast.Application/Orchestrators/Concrete/TapOrchestrator.cs
|
RightpointLabs.Pourcast.Application/Orchestrators/Concrete/TapOrchestrator.cs
|
namespace RightpointLabs.Pourcast.Application.Orchestrators.Concrete
{
using System;
using RightpointLabs.Pourcast.Application.Orchestrators.Abstract;
using RightpointLabs.Pourcast.Domain.Models;
using RightpointLabs.Pourcast.Domain.Repositories;
using RightpointLabs.Pourcast.Domain.Services;
public class TapOrchestrator : ITapOrchestrator
{
private readonly IKegRepository _kegRepository;
private readonly IDateTimeProvider _dateTimeProvider;
public TapOrchestrator(IKegRepository kegRepository, IDateTimeProvider dateTimeProvider)
{
if (kegRepository == null) throw new ArgumentNullException("kegRepository");
if (dateTimeProvider == null) throw new ArgumentNullException("dateTimeProvider");
_kegRepository = kegRepository;
_dateTimeProvider = dateTimeProvider;
}
public void PourBeerFromTap(int tapId, double volume)
{
var newPour = new Pour(_dateTimeProvider.GetCurrentDateTime(), volume);
var keg = _kegRepository.OnTap(tapId);
keg.Pours.Add(newPour);
// TODO : save it?
}
}
}
|
namespace RightpointLabs.Pourcast.Application.Orchestrators.Concrete
{
using System;
using RightpointLabs.Pourcast.Application.Orchestrators.Abstract;
using RightpointLabs.Pourcast.Domain.Models;
using RightpointLabs.Pourcast.Domain.Repositories;
using RightpointLabs.Pourcast.Domain.Services;
public class TapOrchestrator : ITapOrchestrator
{
private readonly IKegRepository _kegRepository;
private readonly IDateTimeProvider _dateTimeProvider;
public TapOrchestrator(IKegRepository kegRepository, IDateTimeProvider dateTimeProvider)
{
if (kegRepository == null) throw new ArgumentNullException("kegRepository");
if (dateTimeProvider == null) throw new ArgumentNullException("dateTimeProvider");
_kegRepository = kegRepository;
_dateTimeProvider = dateTimeProvider;
}
public void PourBeerFromTap(int tapId, double volume)
{
var newPour = new Pour(_dateTimeProvider.GetCurrentDateTime(), volume);
var keg = _kegRepository.OnTap(tapId);
keg.Pours.Add(newPour);
// TODO : save it?
}
}
public interface ITapRepository
{
Tap GetById(int id);
}
}
|
mit
|
C#
|
a6765744a2e47967a6c2003262274a8e280f6a57
|
introduce proxy class for sitenav
|
mruhul/workshop-carsales-web-mvc,mruhul/workshop-carsales-web-mvc
|
Src/Carsales.Web/Features/Shared/SiteNav/LoadSiteNavOnPageLoadEventHandler.cs
|
Src/Carsales.Web/Features/Shared/SiteNav/LoadSiteNavOnPageLoadEventHandler.cs
|
using System.Threading.Tasks;
using System.Web.Mvc;
using Bolt.Cache;
using Bolt.Cache.Extensions;
using Bolt.RequestBus;
using Carsales.Web.Infrastructure.Cache;
using Carsales.Web.Infrastructure.StartupTasks;
using Carsales.Web.Infrastructure.UserContext;
namespace Carsales.Web.Features.Shared.SiteNav
{
public class LoadSiteNavOnPageLoadEventHandler<TEvent> : IAsyncEventHandler<TEvent> where TEvent : IEvent
{
private readonly ISiteNavApiProxy proxy;
private readonly ISiteNavViewModelProvider provider;
private readonly ICacheStore cache;
private readonly IUserContext userContext;
private const string Key = "SiteNav";
public LoadSiteNavOnPageLoadEventHandler(ISiteNavApiProxy proxy,
ISiteNavViewModelProvider provider,
ICacheStore cache,
IUserContext userContext)
{
this.proxy = proxy;
this.provider = provider;
this.cache = cache;
this.userContext = userContext;
}
public async Task HandleAsync(TEvent eEvent)
{
if(!(eEvent is IRequireSiteNav)) return;
var vm = await cache.Profile(CacheLife.Aggressive)
.FetchAsync(LoadFromApi)
.CacheIf(x => x.TopNavHtml != MvcHtmlString.Empty)
.GetAsync(Key);
provider.Set(vm);
}
private async Task<SiteNavViewModel> LoadFromApi()
{
var siteNavData = await proxy.GetAsync(userContext.CurrentUserId);
return BuildViewModel(siteNavData);
}
private SiteNavViewModel BuildViewModel(SiteNavData data)
{
return data == null
? new SiteNavViewModel()
: new SiteNavViewModel
{
StyleTag = MvcHtmlString.Create(data.Style),
ScriptTag = MvcHtmlString.Create(data.Script),
FooterHtml = MvcHtmlString.Create(data.Footer),
TopNavHtml = MvcHtmlString.Create(data.TopNav)
};
}
}
}
|
using System;
using System.Threading.Tasks;
using System.Web.Mvc;
using Bolt.Cache;
using Bolt.Cache.Extensions;
using Bolt.RequestBus;
using Bolt.RestClient;
using Bolt.RestClient.Builders;
using Bolt.RestClient.Extensions;
using Carsales.Web.Infrastructure.Cache;
using Carsales.Web.Infrastructure.Configs;
using Carsales.Web.Infrastructure.UserContext;
namespace Carsales.Web.Features.Shared.SiteNav
{
public class LoadSiteNavOnPageLoadEventHandler<TEvent> : IAsyncEventHandler<TEvent> where TEvent : IEvent
{
private readonly IRestClient restClient;
private readonly ISiteNavApiProxy proxy;
private readonly ISiteNavViewModelProvider provider;
private readonly ICacheStore cache;
private readonly IUserContext userContext;
private readonly ISettings<SiteNavSettings> settings;
private const string Key = "SiteNav";
public LoadSiteNavOnPageLoadEventHandler(ISiteNavApiProxy proxy,
ISiteNavViewModelProvider provider,
ICacheStore cache,
IUserContext userContext)
{
this.proxy = proxy;
this.provider = provider;
this.cache = cache;
this.userContext = userContext;
}
public async Task HandleAsync(TEvent eEvent)
{
if(!(eEvent is IRequireSiteNav)) return;
var vm = await cache.Profile(CacheLife.Aggressive)
.FetchAsync(LoadFromApi)
.CacheIf(x => x.TopNavHtml != MvcHtmlString.Empty)
.GetAsync(Key);
provider.Set(vm);
}
private async Task<SiteNavViewModel> LoadFromApi()
{
var siteNavData = await proxy.GetAsync(userContext.CurrentUserId);
return siteNavData == null
? new SiteNavViewModel()
: new SiteNavViewModel
{
StyleTag = MvcHtmlString.Create(siteNavData.Style),
ScriptTag = MvcHtmlString.Create(siteNavData.Script),
FooterHtml = MvcHtmlString.Create(siteNavData.Footer),
TopNavHtml = MvcHtmlString.Create(siteNavData.TopNav)
};
}
}
}
|
mit
|
C#
|
ead9b657622cde7df77c5169fe5b22c48a2205ca
|
Make EnvironmentVariableConfiguration methods virtual
|
appharbor/appharbor-cli
|
src/AppHarbor/EnvironmentVariableConfiguration.cs
|
src/AppHarbor/EnvironmentVariableConfiguration.cs
|
using System;
namespace AppHarbor
{
public class EnvironmentVariableConfiguration
{
public virtual string Get(string variable, EnvironmentVariableTarget environmentVariableTarget)
{
return Environment.GetEnvironmentVariable(variable, environmentVariableTarget);
}
public virtual void Set(string variable, string value, EnvironmentVariableTarget environmentVariableTarget)
{
Environment.SetEnvironmentVariable(variable, value, environmentVariableTarget);
}
}
}
|
using System;
namespace AppHarbor
{
public class EnvironmentVariableConfiguration
{
public string Get(string variable, EnvironmentVariableTarget environmentVariableTarget)
{
return Environment.GetEnvironmentVariable(variable, environmentVariableTarget);
}
public void Set(string variable, string value, EnvironmentVariableTarget environmentVariableTarget)
{
Environment.SetEnvironmentVariable(variable, value, environmentVariableTarget);
}
}
}
|
mit
|
C#
|
09baa63f7472e8089fc5885ca6220ffbfde26925
|
add StatusCode and Content for RpcClientInvalidStatusCodeException (#62)
|
Gekctek/JsonRpc.Router,edjCase/JsonRpc,edjCase/JsonRpc
|
src/EdjCase.JsonRpc.Client/RpcClientExceptions.cs
|
src/EdjCase.JsonRpc.Client/RpcClientExceptions.cs
|
using System;
using EdjCase.JsonRpc.Core;
namespace EdjCase.JsonRpc.Client
{
/// <summary>
/// Base exception that is thrown from an error that was caused by the client
/// for the rpc request (not caused by rpc server)
/// </summary>
public abstract class RpcClientException : Exception
{
/// <param name="message">Error message</param>
protected RpcClientException(string message) : base(message)
{
}
/// <param name="message">Error message</param>
/// <param name="innerException">Inner exception</param>
protected RpcClientException(string message, Exception innerException) : base(message, innerException)
{
}
}
/// <summary>
/// Exception for all unknown exceptions that were thrown by the client
/// </summary>
public class RpcClientUnknownException : RpcClientException
{
/// <param name="message">Error message</param>
public RpcClientUnknownException(string message) : base(message)
{
}
/// <param name="message">Error message</param>
/// <param name="innerException">Inner exception</param>
public RpcClientUnknownException(string message, Exception innerException) : base(message, innerException)
{
}
}
/// <summary>
/// Exception for all parsing exceptions that were thrown by the client
/// </summary>
public class RpcClientParseException : RpcClientException
{
/// <param name="message">Error message</param>
public RpcClientParseException(string message) : base(message)
{
}
/// <param name="message">Error message</param>
/// <param name="innerException">Inner exception</param>
public RpcClientParseException(string message, Exception innerException) : base(message, innerException)
{
}
}
/// <summary>
/// Exception for all bad http status codes that were thrown by the client
/// </summary>
public class RpcClientInvalidStatusCodeException : RpcClientException
{
public System.Net.HttpStatusCode StatusCode { get; }
public string Content { get; }
/// <param name="statusCode">Http Status Code</param>
/// <param name="innerException">Inner exception</param>
public RpcClientInvalidStatusCodeException(System.Net.HttpStatusCode statusCode, string content)
: base($"The server returned an invalid status code of '{statusCode}'. Response content: {content}.")
{
this.StatusCode = statusCode;
this.Content = content;
}
}
}
|
using System;
using EdjCase.JsonRpc.Core;
namespace EdjCase.JsonRpc.Client
{
/// <summary>
/// Base exception that is thrown from an error that was caused by the client
/// for the rpc request (not caused by rpc server)
/// </summary>
public abstract class RpcClientException : Exception
{
/// <param name="message">Error message</param>
protected RpcClientException(string message) : base(message)
{
}
/// <param name="message">Error message</param>
/// <param name="innerException">Inner exception</param>
protected RpcClientException(string message, Exception innerException) : base(message, innerException)
{
}
}
/// <summary>
/// Exception for all unknown exceptions that were thrown by the client
/// </summary>
public class RpcClientUnknownException : RpcClientException
{
/// <param name="message">Error message</param>
public RpcClientUnknownException(string message) : base(message)
{
}
/// <param name="message">Error message</param>
/// <param name="innerException">Inner exception</param>
public RpcClientUnknownException(string message, Exception innerException) : base(message, innerException)
{
}
}
/// <summary>
/// Exception for all parsing exceptions that were thrown by the client
/// </summary>
public class RpcClientParseException : RpcClientException
{
/// <param name="message">Error message</param>
public RpcClientParseException(string message) : base(message)
{
}
/// <param name="message">Error message</param>
/// <param name="innerException">Inner exception</param>
public RpcClientParseException(string message, Exception innerException) : base(message, innerException)
{
}
}
/// <summary>
/// Exception for all bad http status codes that were thrown by the client
/// </summary>
public class RpcClientInvalidStatusCodeException : RpcClientException
{
/// <param name="statusCode">Http Status Code</param>
/// <param name="innerException">Inner exception</param>
public RpcClientInvalidStatusCodeException(System.Net.HttpStatusCode statusCode, string content)
: base($"The server returned an invalid status code of '{statusCode}'. Response content: {content}.")
{
}
}
}
|
mit
|
C#
|
855587249579a987e188d70b2d0141ce4808ef15
|
remove comments fix things up
|
EhrgoHealth/CS6440,EhrgoHealth/CS6440
|
src/EhrgoHealth.Web/App_Start/AutoMapperConfig.cs
|
src/EhrgoHealth.Web/App_Start/AutoMapperConfig.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutoMapper;
using EhrgoHealth.Data;
using Fitbit;
namespace EhrgoHealth.Web.App_Start
{
public class AutoMapperConfig
{
public static void ConfigureMap()
{
Mapper.Initialize(a =>
{
a.CreateMap<NutritionalValues, Fitbit.Models.NutritionalValues>();
a.CreateMap<Fitbit.Models.NutritionalValues, NutritionalValues>();
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutoMapper;
using EhrgoHealth.Data;
using Fitbit;
namespace EhrgoHealth.Web.App_Start
{
public class AutoMapperConfig
{
public static void ConfigureMap()
{
Mapper.Initialize(a =>
{
a.CreateMap<NutritionalValues, Fitbit.Models.NutritionalValues>()
// .ForSourceMember(ba => ba.FoodLogId, ba => ba.Ignore())
;
a.CreateMap<Fitbit.Models.NutritionalValues, NutritionalValues>()
// .ForMember(ba => ba.FoodLogId, ba => ba.Ignore())
;
});
//Mapper.CreateMap<NutritionalValues, Fitbit.Models.NutritionalValues>();
}
}
}
|
mit
|
C#
|
b120d9f64b8f58d53f4ad0f50bbf78b5824b3204
|
remove GS name in assembly info
|
mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient
|
minuet/symphony/GlobalAssemblyInfo.cs
|
minuet/symphony/GlobalAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Symphony OSF")]
[assembly: AssemblyProduct("Paragon")]
[assembly: AssemblyCopyright("Symphony OSF")]
[assembly: ComVisible(false)]
#if DEBUG
[assembly: AssemblyConfiguration("DEBUG")]
#else
[assembly: AssemblyConfiguration("RELEASE")]
#endif
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Goldman Sachs & Co.")]
[assembly: AssemblyProduct("Paragon")]
[assembly: AssemblyCopyright("Copyright © Goldman Sachs & Co. 2015")]
[assembly: ComVisible(false)]
#if DEBUG
[assembly: AssemblyConfiguration("DEBUG")]
#else
[assembly: AssemblyConfiguration("RELEASE")]
#endif
|
apache-2.0
|
C#
|
37c5c2c3af0835619b9b05cdcb25c003eeb8c2eb
|
Fix focus on login page
|
rfavillejr/Thinktecture.IdentityServer.v2,kjnilsson/Thinktecture.IdentityServer.v2,IdentityServer/IdentityServer2,kjnilsson/Thinktecture.IdentityServer.v2,kjnilsson/Thinktecture.IdentityServer.v2,rfavillejr/Thinktecture.IdentityServer.v2,rfavillejr/Thinktecture.IdentityServer.v2,IdentityServer/IdentityServer2,IdentityServer/IdentityServer2
|
src/OnPremise/WebSite/Views/Account/SignIn.cshtml
|
src/OnPremise/WebSite/Views/Account/SignIn.cshtml
|
@model Thinktecture.IdentityServer.Web.ViewModels.SignInModel
@{
ViewBag.Title = "Username / Password Sign In";
ViewBag.Meta = "<meta name=\"viewport\" content=\"width=320\" />";
}
<h2>Username / Password Sign In</h2>
@Html.ValidationSummary(true, "Sign In was unsuccessful. Please correct the errors and try again.")
@using (Html.BeginForm())
{
<div>
<fieldset>
<legend>Account Information</legend>
<div class="editor-label">
@Html.LabelFor(m => m.UserName)
</div>
<div class="editor-field-slim">
@Html.TextBoxFor(m => m.UserName)
@Html.ValidationMessageFor(m => m.UserName)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.Password)
</div>
<div class="editor-field-slim">
@Html.PasswordFor(m => m.Password)
@Html.ValidationMessageFor(m => m.Password)
</div>
<div class="editor-label">
@Html.CheckBoxFor(m => m.EnableSSO)
@Html.LabelFor(m => m.EnableSSO)
</div>
<p>
<input type="submit" value="Sign In" />
</p>
</fieldset>
<br />
@if ((ViewBag.ShowClientCertificateLink != null) && (ViewBag.ShowClientCertificateLink))
{
@Html.ActionLink("Use client certificate", "CertificateSignIn", new { returnUrl = ViewBag.ReturnUrl })
}
</div>
}
@section scripts
{
@if (false)
{
<script src="../../Scripts/jquery-1.6.4.js" type="text/javascript" />
}
<script type="text/javascript">
$(function () {
$("#UserName").focus();
});
</script>
}
|
@model Thinktecture.IdentityServer.Web.ViewModels.SignInModel
@{
ViewBag.Title = "Username / Password Sign In";
ViewBag.Meta = "<meta name=\"viewport\" content=\"width=320\" />";
}
<h2>Username / Password Sign In</h2>
@Html.ValidationSummary(true, "Sign In was unsuccessful. Please correct the errors and try again.")
@using (Html.BeginForm())
{
<div>
<fieldset>
<legend>Account Information</legend>
<div class="editor-label">
@Html.LabelFor(m => m.UserName)
</div>
<div class="editor-field-slim">
@Html.TextBoxFor(m => m.UserName)
@Html.ValidationMessageFor(m => m.UserName)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.Password)
</div>
<div class="editor-field-slim">
@Html.PasswordFor(m => m.Password)
@Html.ValidationMessageFor(m => m.Password)
</div>
<div class="editor-label">
@Html.CheckBoxFor(m => m.EnableSSO)
@Html.LabelFor(m => m.EnableSSO)
</div>
<p>
<input type="submit" value="Sign In" />
</p>
</fieldset>
<br />
@if ((ViewBag.ShowClientCertificateLink != null) && (ViewBag.ShowClientCertificateLink))
{
@Html.ActionLink("Use client certificate", "CertificateSignIn", new { returnUrl = ViewBag.ReturnUrl })
}
</div>
}
@if (false)
{
<script src="../../Scripts/jquery-1.6.4.js" type="text/javascript" />
}
<script type="text/javascript">
$(function () {
$("#UserName").focus();
});
</script>
|
bsd-3-clause
|
C#
|
b7dce55898d11232377128f979176e97de1c1db7
|
add admin filter for /Auth/Grant
|
feilang864/task.zyfei.net,feilang864/task.zyfei.net
|
UI/PC/Controllers/AuthController.cs
|
UI/PC/Controllers/AuthController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FFLTask.UI.PC.Filter;
using FFLTask.SRV.ServiceInterface;
using FFLTask.SRV.ViewModel.Auth;
namespace FFLTask.UI.PC.Controllers
{
public class AuthController : BaseController
{
#region AuthController
private IAuthroizationService _authService;
public AuthController(IAuthroizationService authService)
{
_authService = authService;
}
#endregion
#region /Auth/Grant
[NeedAuthorized(Privilege.Admin)]
public ActionResult Grant()
{
IList<ProjectAuthorizationModel> model = _authService.GetAdmined(userHelper.CurrentUserId.Value);
return View(model);
}
[HttpPost]
[NeedAuthorized(Privilege.Admin)]
public ActionResult Grant(IList<ProjectAuthorizationModel> model)
{
foreach (var group in model)
{
foreach (var auth in group.Authorizations)
{
if (auth.IsEdit)
{
_authService.Update(auth);
}
}
}
return RedirectToAction("Grant");
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FFLTask.UI.PC.Filter;
using FFLTask.SRV.ServiceInterface;
using FFLTask.SRV.ViewModel.Auth;
namespace FFLTask.UI.PC.Controllers
{
public class AuthController : BaseController
{
#region AuthController
private IAuthroizationService _authService;
public AuthController(IAuthroizationService authService)
{
_authService = authService;
}
#endregion
#region /Auth/Grant
//[NeedAuthorized(Privilege.Admin)]
public ActionResult Grant()
{
IList<ProjectAuthorizationModel> model = _authService.GetAdmined(userHelper.CurrentUserId.Value);
return View(model);
}
[HttpPost]
public ActionResult Grant(IList<ProjectAuthorizationModel> model)
{
foreach (var group in model)
{
foreach (var auth in group.Authorizations)
{
if (auth.IsEdit)
{
_authService.Update(auth);
}
}
}
return RedirectToAction("Grant");
}
#endregion
}
}
|
mit
|
C#
|
4f1066a19151b9cc2fc1ac2994002a7d546e45b6
|
Remove `compiled` option in C#
|
mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark
|
csharp/Benchmark.cs
|
csharp/Benchmark.cs
|
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;
class Benchmark
{
static void Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("Usage: benchmark <filename>");
Environment.Exit(1);
}
StreamReader reader = new System.IO.StreamReader(args[0]);
string data = reader.ReadToEnd();
// Email
Benchmark.Measure(data, @"[\w\.+-]+@[\w\.-]+\.[\w\.-]+");
// URI
Benchmark.Measure(data, @"[\w]+://[^/\s?#]+[^\s?#]+(?:\?[^\s#]*)?(?:#[^\s]*)?");
// IP
Benchmark.Measure(data, @"(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9])");
}
static void Measure(string data, string pattern)
{
Stopwatch stopwatch = Stopwatch.StartNew();
MatchCollection matches = Regex.Matches(data, pattern);
int count = matches.Count;
stopwatch.Stop();
Console.WriteLine(stopwatch.Elapsed.TotalMilliseconds.ToString("G", System.Globalization.CultureInfo.InvariantCulture) + " - " + count);
}
}
|
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;
class Benchmark
{
static void Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("Usage: benchmark <filename>");
Environment.Exit(1);
}
StreamReader reader = new System.IO.StreamReader(args[0]);
string data = reader.ReadToEnd();
// Email
Benchmark.Measure(data, @"[\w\.+-]+@[\w\.-]+\.[\w\.-]+");
// URI
Benchmark.Measure(data, @"[\w]+://[^/\s?#]+[^\s?#]+(?:\?[^\s#]*)?(?:#[^\s]*)?");
// IP
Benchmark.Measure(data, @"(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9])");
}
static void Measure(string data, string pattern)
{
Stopwatch stopwatch = Stopwatch.StartNew();
MatchCollection matches = Regex.Matches(data, pattern, RegexOptions.Compiled);
int count = matches.Count;
stopwatch.Stop();
Console.WriteLine(stopwatch.Elapsed.TotalMilliseconds.ToString("G", System.Globalization.CultureInfo.InvariantCulture) + " - " + count);
}
}
|
mit
|
C#
|
cb69e2552a8b8e7b5433c4027153f32b86a4a057
|
Update copyright header to match LCA guidelines
|
twsouthwick/codeformatter,dotnet/codeformatter,michaelcfanning/codeformatter,shiftkey/Octokit.CodeFormatter,BertTank/codeformatter,kharaone/codeformatter,srivatsn/codeformatter,mmitche/codeformatter,cbjugstad/codeformatter,hickford/codeformatter,Maxwe11/codeformatter,jaredpar/codeformatter,twsouthwick/codeformatter,jeremyabbott/codeformatter,rainersigwald/codeformatter,david-mitchell/codeformatter,dotnet/codeformatter,shiftkey/codeformatter,BradBarnich/codeformatter,weltkante/codeformatter,mmitche/codeformatter,rollie42/codeformatter
|
src/Microsoft.DotNet.CodeFormatting/Rules/HasCopyrightHeaderFormattingRule.cs
|
src/Microsoft.DotNet.CodeFormatting/Rules/HasCopyrightHeaderFormattingRule.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under MIT. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
namespace Microsoft.DotNet.CodeFormatting.Rules
{
[Export(typeof(IFormattingRule))]
internal sealed class HasCopyrightHeaderFormattingRule : IFormattingRule
{
static readonly string[] CopyrightHeader =
{
"// Copyright (c) Microsoft. All rights reserved.",
"// This code is licensed under the MIT License.",
"// 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."
};
public async Task<Document> ProcessAsync(Document document, CancellationToken cancellationToken)
{
var syntaxNode = await document.GetSyntaxRootAsync(cancellationToken) as CSharpSyntaxNode;
if (syntaxNode == null)
return document;
if (HasCopyrightHeader(syntaxNode))
return document;
var newNode = AddCopyrightHeader(syntaxNode);
return document.WithSyntaxRoot(newNode);
}
private static bool HasCopyrightHeader(SyntaxNode syntaxNode)
{
var leadingComments = syntaxNode.GetLeadingTrivia().Where(t => t.CSharpKind() == SyntaxKind.SingleLineCommentTrivia).ToArray();
if (leadingComments.Length < CopyrightHeader.Length)
return false;
return leadingComments.Take(CopyrightHeader.Length)
.Select(t => t.ToFullString())
.SequenceEqual(CopyrightHeader);
}
private static SyntaxNode AddCopyrightHeader(CSharpSyntaxNode syntaxNode)
{
var newTrivia = GetCopyrightHeader().Concat(syntaxNode.GetLeadingTrivia());
return syntaxNode.WithLeadingTrivia(newTrivia);
}
private static IEnumerable<SyntaxTrivia> GetCopyrightHeader()
{
foreach (var headerLine in CopyrightHeader)
{
yield return SyntaxFactory.Comment(headerLine);
yield return SyntaxFactory.CarriageReturnLineFeed;
}
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under MIT. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
namespace Microsoft.DotNet.CodeFormatting.Rules
{
[Export(typeof(IFormattingRule))]
internal sealed class HasCopyrightHeaderFormattingRule : IFormattingRule
{
static readonly string[] CopyrightHeader =
{
"// Copyright (c) Microsoft Corporation. All rights reserved.",
"// Licensed under MIT. See LICENSE in the project root for license information."
};
public async Task<Document> ProcessAsync(Document document, CancellationToken cancellationToken)
{
var syntaxNode = await document.GetSyntaxRootAsync(cancellationToken) as CSharpSyntaxNode;
if (syntaxNode == null)
return document;
if (HasCopyrightHeader(syntaxNode))
return document;
var newNode = AddCopyrightHeader(syntaxNode);
return document.WithSyntaxRoot(newNode);
}
private static bool HasCopyrightHeader(SyntaxNode syntaxNode)
{
var leadingComments = syntaxNode.GetLeadingTrivia().Where(t => t.CSharpKind() == SyntaxKind.SingleLineCommentTrivia).ToArray();
if (leadingComments.Length < CopyrightHeader.Length)
return false;
return leadingComments.Take(CopyrightHeader.Length)
.Select(t => t.ToFullString())
.SequenceEqual(CopyrightHeader);
}
private static SyntaxNode AddCopyrightHeader(CSharpSyntaxNode syntaxNode)
{
var newTrivia = GetCopyrightHeader().Concat(syntaxNode.GetLeadingTrivia());
return syntaxNode.WithLeadingTrivia(newTrivia);
}
private static IEnumerable<SyntaxTrivia> GetCopyrightHeader()
{
foreach (var headerLine in CopyrightHeader)
{
yield return SyntaxFactory.Comment(headerLine);
yield return SyntaxFactory.CarriageReturnLineFeed;
}
}
}
}
|
mit
|
C#
|
aece83be7884730235317bf40d78dbacb5935120
|
升级版本到2.1.2
|
tangxuehua/ecommon,Aaron-Liu/ecommon
|
src/ECommon/Properties/AssemblyInfo.cs
|
src/ECommon/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ECommon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ECommon")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b3edf459-8725-465e-a484-410b9a68df1f")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.2")]
[assembly: AssemblyFileVersion("2.1.2")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ECommon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ECommon")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b3edf459-8725-465e-a484-410b9a68df1f")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.1")]
[assembly: AssemblyFileVersion("2.1.1")]
|
mit
|
C#
|
14456732aa114a6dd47fe089dbb9d5d8d4e180c4
|
Fix typo.
|
ExRam/ExRam.Gremlinq
|
src/ExRam.Gremlinq.Core/Queries/Key.cs
|
src/ExRam.Gremlinq.Core/Queries/Key.cs
|
using System;
using Gremlin.Net.Process.Traversal;
namespace ExRam.Gremlinq.Core
{
public readonly struct Key
{
private readonly object? _key;
public Key(T t)
{
_key = t;
}
public Key(string name)
{
_key = name;
}
public bool Equals(Key other)
{
return Equals(_key, other._key);
}
public override bool Equals(object? obj)
{
return obj is Key other && Equals(other);
}
public override int GetHashCode()
{
return _key != null ? _key.GetHashCode() : 0;
}
public static bool operator == (Key key1, Key key2)
{
return key1.RawKey == key2.RawKey;
}
public static bool operator !=(Key key1, Key key2)
{
return !(key1 == key2);
}
public static implicit operator Key(T t)
{
return new(t);
}
public static implicit operator Key(string name)
{
return new(name);
}
public object RawKey
{
get
{
if (_key == null)
throw new InvalidOperationException($"Cannot access the {nameof(RawKey)} property on an uninitialized {nameof(Key)}.");
return _key;
}
}
}
}
|
using System;
using Gremlin.Net.Process.Traversal;
namespace ExRam.Gremlinq.Core
{
public readonly struct Key
{
private readonly object? _key;
public Key(T t)
{
_key = t;
}
public Key(string name)
{
_key = name;
}
public bool Equals(Key other)
{
return Equals(_key, other._key);
}
public override bool Equals(object? obj)
{
return obj is Key other && Equals(other);
}
public override int GetHashCode()
{
return _key != null ? _key.GetHashCode() : 0;
}
public static bool operator == (Key key1, Key key2)
{
return key1.RawKey == key2.RawKey;
}
public static bool operator !=(Key key1, Key key2)
{
return !(key1 == key2);
}
public static implicit operator Key(T t)
{
return new(t);
}
public static implicit operator Key(string name)
{
return new(name);
}
public object RawKey
{
get
{
if (_key == null)
throw new InvalidOperationException($"Cannot access the {nameof(RawKey)} property on an unititalized {nameof(Key)}.");
return _key;
}
}
}
}
|
mit
|
C#
|
5672d3aa3e646829280dae641f5e4152b4711437
|
Update Https for Jon-Douglas.com (#356)
|
planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin
|
src/Firehose.Web/Authors/JonDouglas.cs
|
src/Firehose.Web/Authors/JonDouglas.cs
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class JonDouglas : IWorkAtXamarinOrMicrosoft
{
public string FirstName => "Jon";
public string LastName => "Douglas";
public string ShortBioOrTagLine => string.Empty;
public string StateOrRegion => "Utah";
public string EmailAddress => "";
public string TwitterHandle => "_jondouglas";
public Uri WebSite => new Uri("https://www.jon-douglas.com/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://www.jon-douglas.com/atom.xml"); }
}
public string GravatarHash => "83d67df0b9e002d1c55a2786aeeb0c1b";
public string GitHubHandle => "JonDouglas";
public GeoPosition Position => new GeoPosition(39.3209800, -111.0937310);
}
}
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class JonDouglas : IWorkAtXamarinOrMicrosoft
{
public string FirstName => "Jon";
public string LastName => "Douglas";
public string ShortBioOrTagLine => string.Empty;
public string StateOrRegion => "Utah";
public string EmailAddress => "";
public string TwitterHandle => "_jondouglas";
public Uri WebSite => new Uri("http://www.jon-douglas.com/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.jon-douglas.com/atom.xml"); }
}
public string GravatarHash => "83d67df0b9e002d1c55a2786aeeb0c1b";
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(39.3209800, -111.0937310);
}
}
|
mit
|
C#
|
8ff3e5fe66a76fd06d398038829b8456f569352c
|
Build and publish Rock.Core.Newtonsoft nuget package
|
bfriesen/Rock.Core,RockFramework/Rock.Core,peteraritchie/Rock.Core
|
Rock.Core.Newtonsoft/Properties/AssemblyInfo.cs
|
Rock.Core.Newtonsoft/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.Newtonsoft")]
[assembly: AssemblyDescription("Core classes that use the JSON.NET (Newtonsoft) serialization library.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Core.Newtonsoft")]
[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("ee2d8406-d8b5-436c-8d5f-88c6278301a8")]
// 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.2")]
[assembly: AssemblyInformationalVersion("0.9.2")]
|
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.Newtonsoft")]
[assembly: AssemblyDescription("Core classes that use the JSON.NET (Newtonsoft) serialization library.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Core.Newtonsoft")]
[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("ee2d8406-d8b5-436c-8d5f-88c6278301a8")]
// 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.1")]
[assembly: AssemblyInformationalVersion("0.9.1")]
|
mit
|
C#
|
e144049ba2fbe3a538ec26e0601d244782a7ad46
|
Fix comment
|
karolz-ms/diagnostics-eventflow
|
src/Microsoft.Diagnostics.EventFlow.Core/Implementations/PayloadDictionaryUtilities.cs
|
src/Microsoft.Diagnostics.EventFlow.Core/Implementations/PayloadDictionaryUtilities.cs
|
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
using System;
using System.Collections.Generic;
using Validation;
namespace Microsoft.Diagnostics.EventFlow
{
public static class PayloadDictionaryUtilities
{
private static Lazy<Random> random = new Lazy<Random>();
public static void AddPayloadProperty(IDictionary<string, object> payload, string key, object value, IHealthReporter healthReporter, string context)
{
Requires.NotNull(payload, nameof(payload));
Requires.NotNull(key, nameof(key));
Requires.NotNull(healthReporter, nameof(healthReporter));
if (!payload.ContainsKey(key))
{
payload.Add(key, value);
return;
}
string newKey = key + "_";
//update property key till there is no such key in dict
do
{
newKey += PayloadDictionaryUtilities.random.Value.Next(0, 10);
}
while (payload.ContainsKey(newKey));
payload.Add(newKey, value);
healthReporter.ReportWarning($"The property with the key '{key}' already exist in the event payload. Value was added under key '{newKey}'", context);
}
}
}
|
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
using System;
using System.Collections.Generic;
using Validation;
namespace Microsoft.Diagnostics.EventFlow
{
public static class PayloadDictionaryUtilities
{
private static Lazy<Random> random = new Lazy<Random>();
public static void AddPayloadProperty(IDictionary<string, object> payload, string key, object value, IHealthReporter healthReporter, string context)
{
Requires.NotNull(payload, nameof(payload));
Requires.NotNull(key, nameof(key));
Requires.NotNull(healthReporter, nameof(healthReporter));
if (!payload.ContainsKey(key))
{
payload.Add(key, value);
return;
}
string newKey = key + "_";
//update property key till there are no such key in dict
do
{
newKey += PayloadDictionaryUtilities.random.Value.Next(0, 10);
}
while (payload.ContainsKey(newKey));
payload.Add(newKey, value);
healthReporter.ReportWarning($"The property with the key '{key}' already exist in the event payload. Value was added under key '{newKey}'", context);
}
}
}
|
mit
|
C#
|
ee5ae3cdecbd733cccc61c285daf29b905aba425
|
Update the bootstrap nodes used for testing
|
Impyy/SharpTox
|
SharpTox.Tests/Globals.cs
|
SharpTox.Tests/Globals.cs
|
using SharpTox.Core;
namespace SharpTox.Test
{
static class Globals
{
public static ToxNode[] Nodes = new ToxNode[]
{
new ToxNode("node.tox.biribiri.org", 33445, new ToxKey(ToxKeyType.Public, "F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67")),
new ToxNode("163.172.136.118", 33445, new ToxKey(ToxKeyType.Public, "2C289F9F37C20D09DA83565588BF496FAB3764853FA38141817A72E3F18ACA0B"))
};
public static ToxNode[] TcpRelays = new ToxNode[]
{
new ToxNode("node.tox.biribiri.org", 33445, new ToxKey(ToxKeyType.Public, "F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67")),
new ToxNode("163.172.136.118", 33445, new ToxKey(ToxKeyType.Public, "2C289F9F37C20D09DA83565588BF496FAB3764853FA38141817A72E3F18ACA0B"))
};
}
}
|
using SharpTox.Core;
namespace SharpTox.Test
{
static class Globals
{
public static ToxNode[] Nodes = new ToxNode[]
{
new ToxNode("178.62.250.138", 33445, new ToxKey(ToxKeyType.Public, "788236D34978D1D5BD822F0A5BEBD2C53C64CC31CD3149350EE27D4D9A2F9B6B")),
new ToxNode("192.210.149.121", 33445, new ToxKey(ToxKeyType.Public, "F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67")),
new ToxNode("178.62.125.224", 33445, new ToxKey(ToxKeyType.Public, "10B20C49ACBD968D7C80F2E8438F92EA51F189F4E70CFBBB2C2C8C799E97F03E")),
new ToxNode("76.191.23.96", 33445, new ToxKey(ToxKeyType.Public, "93574A3FAB7D612FEA29FD8D67D3DD10DFD07A075A5D62E8AF3DD9F5D0932E11")),
};
public static ToxNode[] TcpRelays = new ToxNode[]
{
new ToxNode("178.62.250.138", 443, new ToxKey(ToxKeyType.Public, "788236D34978D1D5BD822F0A5BEBD2C53C64CC31CD3149350EE27D4D9A2F9B6B")),
new ToxNode("104.219.184.206", 443, new ToxKey(ToxKeyType.Public, "8CD087E31C67568103E8C2A28653337E90E6B8EDA0D765D57C6B5172B4F1F04C")),
new ToxNode("194.249.212.109", 443, new ToxKey(ToxKeyType.Public, "3CEE1F054081E7A011234883BC4FC39F661A55B73637A5AC293DDF1251D9432B"))
};
}
}
|
mit
|
C#
|
77186bbb3c171d07b070a20a3db8f4f97c77308a
|
Split up DerAsnTypeTag in primitive and constructed
|
huysentruitw/pem-utils
|
src/DerConverter/Asn/DerAsnTypeTag.cs
|
src/DerConverter/Asn/DerAsnTypeTag.cs
|
namespace DerConverter.Asn
{
public enum DerAsnTypeTag : byte
{
// Primitive (bit 5: 0)
Boolean = 0x01,
Integer = 0x02,
BitString = 0x03,
OctetString = 0x04,
Null = 0x05,
ObjectIdentifier = 0x06,
Utf8String = 0x0C,
PrintableString = 0x13,
Ia5tring = 0x16,
UnicodeString = 0x1E,
// Constructed (bit 5: 1)
Sequence = 0x30,
Set = 0x31
}
}
|
namespace DerConverter.Asn
{
public enum DerAsnTypeTag : byte
{
Boolean = 0x01,
Integer = 0x02,
BitString = 0x03,
OctetString = 0x04,
Null = 0x05,
ObjectIdentifier = 0x06,
Utf8String = 0x0C,
PrintableString = 0x13,
Ia5tring = 0x16,
UnicodeString = 0x1E,
Sequence = 0x30,
Set = 0x31
}
}
|
apache-2.0
|
C#
|
e42b20ae4fafc1487ba950203c5a89bb13f47697
|
Fix regression in puzzle 10
|
martincostello/project-euler
|
src/ProjectEuler/Puzzles/Puzzle010.cs
|
src/ProjectEuler/Puzzles/Puzzle010.cs
|
// Copyright (c) Martin Costello, 2015. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.ProjectEuler.Puzzles
{
using System;
/// <summary>
/// A class representing the solution to <c>https://projecteuler.net/problem=10</c>. This class cannot be inherited.
/// </summary>
internal sealed class Puzzle010 : Puzzle
{
/// <inheritdoc />
public override string Question => "Find the sum of all the primes below the specified value.";
/// <inheritdoc />
protected override int MinimumArguments => 1;
/// <inheritdoc />
protected override int SolveCore(string[] args)
{
int max;
if (!TryParseInt32(args[0], out max) || max < 2)
{
Console.Error.WriteLine("The specified number is invalid.");
return -1;
}
long sum = 0;
for (int n = 2; n < max; n++)
{
if (Maths.IsPrime(n))
{
sum += n;
}
}
Answer = sum;
return 0;
}
}
}
|
// Copyright (c) Martin Costello, 2015. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.ProjectEuler.Puzzles
{
using System;
/// <summary>
/// A class representing the solution to <c>https://projecteuler.net/problem=10</c>. This class cannot be inherited.
/// </summary>
internal sealed class Puzzle010 : Puzzle
{
/// <inheritdoc />
public override string Question => "Find the sum of all the primes below the specified value.";
/// <inheritdoc />
protected override int MinimumArguments => 1;
/// <inheritdoc />
protected override int SolveCore(string[] args)
{
int max;
if (!TryParseInt32(args[0], out max) || max < 2)
{
Console.Error.WriteLine("The specified number is invalid.");
return -1;
}
long sum = 0;
for (int n = 2; n < max - 2; n++)
{
if (Maths.IsPrime(n))
{
sum += n;
}
}
Answer = sum;
return 0;
}
}
}
|
apache-2.0
|
C#
|
065d2a4887347b7cb4f9fb4ad1e0286c0c51850b
|
Add licence header
|
2yangk23/osu,peppy/osu-new,naoey/osu,peppy/osu,UselessToucan/osu,ZLima12/osu,NeoAdonis/osu,NeoAdonis/osu,Nabile-Rahmani/osu,ppy/osu,EVAST9919/osu,peppy/osu,2yangk23/osu,DrabWeb/osu,smoogipoo/osu,UselessToucan/osu,naoey/osu,DrabWeb/osu,NeoAdonis/osu,smoogipooo/osu,johnneijzen/osu,EVAST9919/osu,Frontear/osuKyzer,peppy/osu,DrabWeb/osu,ppy/osu,naoey/osu,ppy/osu,UselessToucan/osu,johnneijzen/osu,smoogipoo/osu,ZLima12/osu,smoogipoo/osu
|
osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs
|
osu.Game.Rulesets.Osu/Objects/Drawables/ITrackSnaking.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
/// <summary>
/// A component which tracks the current end snaking position of a slider.
/// </summary>
public interface ITrackSnaking
{
void UpdateSnakingPosition(Vector2 start, Vector2 end);
}
}
|
using OpenTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
/// <summary>
/// A component which tracks the current end snaking position of a slider.
/// </summary>
public interface ITrackSnaking
{
void UpdateSnakingPosition(Vector2 start, Vector2 end);
}
}
|
mit
|
C#
|
a7548f4ee096e86efe2655c79353b8177014f98b
|
Update assembly information.
|
oliverzick/ImmutableUndoRedo
|
src/Sample/Properties/AssemblyInfo.cs
|
src/Sample/Properties/AssemblyInfo.cs
|
#region Copyright and license
// <copyright file="AssemblyInfo.cs" company="Oliver Zick">
// Copyright (c) 2015 Oliver Zick. All rights reserved.
// </copyright>
// <author>Oliver Zick</author>
// <license>
// 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>
#endregion
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("ImmutableUndoRedo sample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ImmutableUndoRedo")]
[assembly: AssemblyCopyright("Copyright © 2015 Oliver Zick. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("202b34d2-5246-4a1e-ac7c-01ff7137fd2d")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("Sample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sample")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("202b34d2-5246-4a1e-ac7c-01ff7137fd2d")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
9f0b313ceab33bde800842330beade8c31abe8d9
|
bump version to 1.0.5
|
moyasar/moyasar-dotnet
|
moyasar/Properties/AssemblyInfo.cs
|
moyasar/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("moyasar")]
[assembly: AssemblyDescription("Moyasar e-Payment API wrapper for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Moyasar LTD")]
[assembly: AssemblyProduct("moyasar")]
[assembly: AssemblyCopyright("Copyright © Moyasar 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9ec79375-df6a-4e74-a90c-731751711e0d")]
// 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.5.0")]
[assembly: AssemblyFileVersion("1.0.5.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("moyasar")]
[assembly: AssemblyDescription("Moyasar e-Payment API wrapper for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Moyasar LTD")]
[assembly: AssemblyProduct("moyasar")]
[assembly: AssemblyCopyright("Copyright © Moyasar 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9ec79375-df6a-4e74-a90c-731751711e0d")]
// 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.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]
|
mit
|
C#
|
0a55f9ca1430943d44a6c4ab443972d9ab83429f
|
Remove problematic overloaded extension method
|
jugglingnutcase/Nancy.EmbeddedContent,jugglingnutcase/Nancy.EmbeddedContent
|
Nancy.EmbeddedContent/Conventions/EmbeddedStaticContentConventionsExtensions.cs
|
Nancy.EmbeddedContent/Conventions/EmbeddedStaticContentConventionsExtensions.cs
|
namespace Nancy.EmbeddedContent.Conventions
{
using System;
using System.Collections.Generic;
using System.Reflection;
/// <summary>
/// Extension methods to aid adding embedded static content into conventions
/// </summary>
public static class StaticContentsConventionsExtensions
{
/// <summary>
/// Adds a directory-based convention for embedded static resources
/// </summary>
/// <param name="conventions">Conventions in which static content will be added</param>
/// <param name="requestedPath">The path that should be matched with the request</param>
/// <param name="assembly">The assembly that contains the embedded static content</param>
/// <param name="contentPath">The path to where the content is stored in your application, relative to the root. If this is <see langword="null" /> then it will be the same as <paramref name="requestedPath"/>.</param>
/// <param name="allowedExtensions">A list of extensions that is valid for the conventions. If not supplied, all extensions are valid.</param>
public static void AddEmbeddedDirectory(this IList<Func<NancyContext, string, Response>> conventions, string requestedPath, Assembly assembly, string contentPath = null, params string[] allowedExtensions)
{
conventions.Add(EmbeddedStaticContentConventionBuilder.AddDirectory(requestedPath, assembly, contentPath, allowedExtensions));
}
}
}
|
namespace Nancy.EmbeddedContent.Conventions
{
using System;
using System.Collections.Generic;
using System.Reflection;
/// <summary>
/// Extension methods to aid adding embedded static content into conventions
/// </summary>
public static class StaticContentsConventionsExtensions
{
/// <summary>
/// Adds a directory-based convention for embedded static resources
/// </summary>
/// <param name="conventions">Conventions in which static content will be added</param>
/// <param name="requestedPath">The path that should be matched with the request</param>
/// <param name="contentPath">The path to where the content is stored in your application, relative to the root. If this is <see langword="null" /> then it will be the same as <paramref name="requestedPath"/>.</param>
/// <param name="allowedExtensions">A list of extensions that is valid for the conventions. If not supplied, all extensions are valid.</param>
public static void AddEmbeddedDirectory(this IList<Func<NancyContext, string, Response>> conventions, string requestedPath, string contentPath = null, params string[] allowedExtensions)
{
AddEmbeddedDirectory(conventions, requestedPath, Assembly.GetCallingAssembly(), contentPath, allowedExtensions);
}
/// <summary>
/// Adds a directory-based convention for embedded static resources
/// </summary>
/// <param name="conventions">Conventions in which static content will be added</param>
/// <param name="requestedPath">The path that should be matched with the request</param>
/// <param name="assembly">The assembly that contains the embedded static content</param>
/// <param name="contentPath">The path to where the content is stored in your application, relative to the root. If this is <see langword="null" /> then it will be the same as <paramref name="requestedPath"/>.</param>
/// <param name="allowedExtensions">A list of extensions that is valid for the conventions. If not supplied, all extensions are valid.</param>
public static void AddEmbeddedDirectory(this IList<Func<NancyContext, string, Response>> conventions, string requestedPath, Assembly assembly, string contentPath = null, params string[] allowedExtensions)
{
conventions.Add(EmbeddedStaticContentConventionBuilder.AddDirectory(requestedPath, assembly, contentPath, allowedExtensions));
}
}
}
|
mit
|
C#
|
02160a04d9c69a4394d342105fac38953d1e3f1b
|
Make ViewComponentTagHelperMetadata static.
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ViewComponentTagHelperMetadata.cs
|
src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ViewComponentTagHelperMetadata.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.
namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
{
public static class ViewComponentTagHelperMetadata
{
/// <summary>
/// The key in a <see cref="Microsoft.AspNetCore.Razor.Language.TagHelperDescriptor.Metadata"/> containing
/// the short name of a view component.
/// </summary>
public static readonly string Name = "MVC.ViewComponent.Name";
}
}
|
// 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.
namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
{
public class ViewComponentTagHelperMetadata
{
/// <summary>
/// The key in a <see cref="Microsoft.AspNetCore.Razor.Language.TagHelperDescriptor.Metadata"/> containing
/// the short name of a view component.
/// </summary>
public static readonly string Name = "MVC.ViewComponent.Name";
}
}
|
apache-2.0
|
C#
|
3eae38b7ab32fe01353f9794731812722c80cc2a
|
Make ThrowHelpers public
|
sandreenko/corert,tijoytom/corert,sandreenko/corert,gregkalapos/corert,yizhang82/corert,krytarowski/corert,botaberg/corert,shrah/corert,botaberg/corert,kyulee1/corert,kyulee1/corert,kyulee1/corert,krytarowski/corert,shrah/corert,kyulee1/corert,tijoytom/corert,gregkalapos/corert,yizhang82/corert,shrah/corert,gregkalapos/corert,krytarowski/corert,yizhang82/corert,tijoytom/corert,yizhang82/corert,tijoytom/corert,krytarowski/corert,shrah/corert,sandreenko/corert,botaberg/corert,gregkalapos/corert,sandreenko/corert,botaberg/corert
|
src/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ThrowHelpers.cs
|
src/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ThrowHelpers.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;
namespace Internal.Runtime.CompilerHelpers
{
/// <summary>
/// These methods are used to throw exceptions from generated code.
/// </summary>
[System.Runtime.CompilerServices.DependencyReductionRoot] /* keep rooted as code gen may add references to these */
public static class ThrowHelpers
{
public static void ThrowOverflowException()
{
throw new OverflowException();
}
public static void ThrowIndexOutOfRangeException()
{
throw new IndexOutOfRangeException();
}
public static void ThrowNullReferenceException()
{
throw new NullReferenceException();
}
public static void ThrowDivideByZeroException()
{
throw new DivideByZeroException();
}
public static void ThrowArrayTypeMismatchException()
{
throw new ArrayTypeMismatchException();
}
public static void ThrowPlatformNotSupportedException()
{
throw new PlatformNotSupportedException();
}
public static void ThrowTypeLoadException()
{
throw new TypeLoadException();
}
public static void ThrowArgumentException()
{
throw new ArgumentException();
}
public static void ThrowArgumentOutOfRangeException()
{
throw new ArgumentOutOfRangeException();
}
}
}
|
// 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;
namespace Internal.Runtime.CompilerHelpers
{
/// <summary>
/// These methods are used to throw exceptions from generated code.
/// </summary>
[System.Runtime.CompilerServices.DependencyReductionRoot] /* keep rooted as code gen may add references to these */
internal static class ThrowHelpers
{
private static void ThrowOverflowException()
{
throw new OverflowException();
}
private static void ThrowIndexOutOfRangeException()
{
throw new IndexOutOfRangeException();
}
private static void ThrowNullReferenceException()
{
throw new NullReferenceException();
}
private static void ThrowDivideByZeroException()
{
throw new DivideByZeroException();
}
private static void ThrowArrayTypeMismatchException()
{
throw new ArrayTypeMismatchException();
}
private static void ThrowPlatformNotSupportedException()
{
throw new PlatformNotSupportedException();
}
private static void ThrowTypeLoadException()
{
throw new TypeLoadException();
}
private static void ThrowArgumentException()
{
throw new ArgumentException();
}
private static void ThrowArgumentOutOfRangeException()
{
throw new ArgumentOutOfRangeException();
}
}
}
|
mit
|
C#
|
27e3c9e778f64367f3c4a6d584728d52fb440843
|
Remove usings.
|
DrabWeb/osu,johnneijzen/osu,Nabile-Rahmani/osu,naoey/osu,smoogipoo/osu,ZLima12/osu,Frontear/osuKyzer,2yangk23/osu,UselessToucan/osu,2yangk23/osu,johnneijzen/osu,DrabWeb/osu,smoogipoo/osu,ZLima12/osu,EVAST9919/osu,peppy/osu-new,smoogipoo/osu,peppy/osu,UselessToucan/osu,Drezi126/osu,NeoAdonis/osu,EVAST9919/osu,DrabWeb/osu,ppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu,ppy/osu,ppy/osu,UselessToucan/osu,naoey/osu,smoogipooo/osu,NeoAdonis/osu,naoey/osu
|
osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs
|
osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Taiko.Objects
{
public abstract class TaikoHitObject : HitObject
{
/// <summary>
/// Default size of a drawable taiko hit object.
/// </summary>
public const float DEFAULT_SIZE = 0.45f;
/// <summary>
/// Scale multiplier for a strong drawable taiko hit object.
/// </summary>
public const float STRONG_SCALE = 1.4f;
/// <summary>
/// Default size of a strong drawable taiko hit object.
/// </summary>
public const float DEFAULT_STRONG_SIZE = DEFAULT_SIZE * STRONG_SCALE;
/// <summary>
/// Whether this HitObject is a "strong" type.
/// Strong hit objects give more points for hitting the hit object with both keys.
/// </summary>
public bool IsStrong;
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Taiko.Objects
{
public abstract class TaikoHitObject : HitObject
{
/// <summary>
/// Default size of a drawable taiko hit object.
/// </summary>
public const float DEFAULT_SIZE = 0.45f;
/// <summary>
/// Scale multiplier for a strong drawable taiko hit object.
/// </summary>
public const float STRONG_SCALE = 1.4f;
/// <summary>
/// Default size of a strong drawable taiko hit object.
/// </summary>
public const float DEFAULT_STRONG_SIZE = DEFAULT_SIZE * STRONG_SCALE;
/// <summary>
/// Whether this HitObject is a "strong" type.
/// Strong hit objects give more points for hitting the hit object with both keys.
/// </summary>
public bool IsStrong;
}
}
|
mit
|
C#
|
679366b325a263ba9f4c2a4039bb435e71289c8b
|
update version
|
SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,RachelTucker/ds3_net_sdk,shabtaisharon/ds3_net_sdk,SpectraLogic/ds3_net_sdk
|
VersionInfo.cs
|
VersionInfo.cs
|
/*
* ******************************************************************************
* Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
using System.Reflection;
// 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("4.0.2.0")]
[assembly: AssemblyFileVersion("4.0.2.0")]
|
/*
* ******************************************************************************
* Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
using System.Reflection;
// 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("4.0.1.0")]
[assembly: AssemblyFileVersion("4.0.1.0")]
|
apache-2.0
|
C#
|
1e70fde95d10650e0cddd2fcd42ac1510e1c1d86
|
Bump WebApi version to 5.10.2
|
MindscapeHQ/raygun4net,MindscapeHQ/raygun4net,MindscapeHQ/raygun4net
|
Mindscape.Raygun4Net.WebApi/Properties/AssemblyVersionInfo.cs
|
Mindscape.Raygun4Net.WebApi/Properties/AssemblyVersionInfo.cs
|
using System.Reflection;
// 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("5.10.2.0")]
[assembly: AssemblyFileVersion("5.10.2.0")]
|
using System.Reflection;
// 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("5.10.1.0")]
[assembly: AssemblyFileVersion("5.10.1.0")]
|
mit
|
C#
|
78f8baab3b043f99599f792ac2885ecb3b80fdab
|
Add PreviousFireTime to trigger profile dto
|
Paymentsense/Dapper.SimpleSave
|
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/SchedulerManagement/TriggerProfileDto.cs
|
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/SchedulerManagement/TriggerProfileDto.cs
|
using PS.Mothership.Core.Common.Template.Gen;
using Quartz;
using System;
using System.Collections.Generic;
namespace PS.Mothership.Core.Common.Dto.SchedulerManagement
{
public class TriggerProfileDto
{
public string Name { get; set; }
public TriggerState State { get; set; }
public DateTimeOffset? NextFireTime { get; set; }
public DateTimeOffset? PreviousFireTime { get; set; }
public string Schedule { get; set; }
public DateTimeOffset StartTime { get; set; }
public IntervalUnit Occurrence { get; set; }
public int TriggerInterval { get; set; }
public IEnumerable<DayOfWeek> SelectedDaysOfWeek { get; set; }
public GenSchedulerJobGroupEnum JobGroup { get; set; }
}
}
|
using PS.Mothership.Core.Common.Template.Gen;
using Quartz;
using System;
using System.Collections.Generic;
namespace PS.Mothership.Core.Common.Dto.SchedulerManagement
{
public class TriggerProfileDto
{
public string Name { get; set; }
public TriggerState State { get; set; }
public DateTimeOffset? NextFireTime { get; set; }
public string Schedule { get; set; }
public DateTimeOffset StartTime { get; set; }
public IntervalUnit Occurrence { get; set; }
public int TriggerInterval { get; set; }
public IEnumerable<DayOfWeek> SelectedDaysOfWeek { get; set; }
public GenSchedulerJobGroupEnum JobGroup { get; set; }
}
}
|
mit
|
C#
|
fac1a98dc8a70b8260caa0c8117955ae0965630f
|
remove extraneous HibernateTemplate from test fixture injection
|
spring-projects/spring-net,likesea/spring-net,zi1jing/spring-net,yonglehou/spring-net,dreamofei/spring-net,djechelon/spring-net,kvr000/spring-net,yonglehou/spring-net,kvr000/spring-net,zi1jing/spring-net,dreamofei/spring-net,spring-projects/spring-net,yonglehou/spring-net,likesea/spring-net,spring-projects/spring-net,kvr000/spring-net,djechelon/spring-net,likesea/spring-net
|
test/Spring/Spring.Data.NHibernate.TxPromotion.Integration.Tests/TestUsingHibernateTxScopeTransactionManager.cs
|
test/Spring/Spring.Data.NHibernate.TxPromotion.Integration.Tests/TestUsingHibernateTxScopeTransactionManager.cs
|
using NUnit.Framework;
using Spring.Testing.NUnit;
namespace Spring.Data.NHibernate.TxPromotion.Integration.Tests
{
[TestFixture]
public class TestUsingHibernateTxScopeTransactionManager : AbstractTransactionalSpringContextTests
{
#region DI
public IService1 Service1 { get; set; }
public IService2 Service2 { get; set; }
#endregion
protected override string[] ConfigLocations
{
get
{
return new[]
{
"config://spring/objects",
"assembly://Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.Configuration.xml",
"assembly://Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.NHibernate.xml",
"assembly://Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.HibernateTxScopeTransactionManager.xml"
};
}
}
[Test(Description = "This is failing test case in my unit test with original NH TX Scope Manager, but not Custom TX Scope Manager, Not Supported -> Not Supported")]
public void TestSuspendTransactionOnNotSupported()
{
Service1.ServiceMethodWithNotSupported1();
}
[Test(Description = "This is also failing with NH TX Scope manager, but not with Custom TX Scope Manager, Not Supported -> Requires New")]
public void TestSuspendTransactionOnNotSupportedWithNestedRequiresNew()
{
Service2.ServiceMethodWithNotSupported();
}
[Test(Description = "This is failing test case in my unit test with Custom TX Scope Manager (this is the original bug reported), Not Supported -> Not Supported -> Required")]
public void TestSuspendTransactionOnNotSupportedWithNestedRequired()
{
Service1.ServiceMethodWithNotSupported3();
}
}
}
|
using NUnit.Framework;
using Spring.Data.NHibernate.Generic;
using Spring.Testing.NUnit;
namespace Spring.Data.NHibernate.TxPromotion.Integration.Tests
{
[TestFixture]
public class TestUsingHibernateTxScopeTransactionManager : AbstractTransactionalSpringContextTests
{
#region DI
public Generic.HibernateTemplate HibernateTemplate { get; set; }
public IService1 Service1 { get; set; }
public IService2 Service2 { get; set; }
#endregion
protected override string[] ConfigLocations
{
get
{
return new[]
{
"config://spring/objects",
"assembly://Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.Configuration.xml",
"assembly://Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.NHibernate.xml",
"assembly://Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.Data.NHibernate.TxPromotion.Integration.Tests/Spring.HibernateTxScopeTransactionManager.xml"
};
}
}
[Test(Description = "This is failing test case in my unit test with original NH TX Scope Manager, but not Custom TX Scope Manager, Not Supported -> Not Supported")]
public void TestSuspendTransactionOnNotSupported()
{
Service1.ServiceMethodWithNotSupported1();
}
[Test(Description = "This is also failing with NH TX Scope manager, but not with Custom TX Scope Manager, Not Supported -> Requires New")]
public void TestSuspendTransactionOnNotSupportedWithNestedRequiresNew()
{
Service2.ServiceMethodWithNotSupported();
}
[Test(Description = "This is failing test case in my unit test with Custom TX Scope Manager (this is the original bug reported), Not Supported -> Not Supported -> Required")]
public void TestSuspendTransactionOnNotSupportedWithNestedRequired()
{
Service1.ServiceMethodWithNotSupported3();
}
}
}
|
apache-2.0
|
C#
|
edb2f63d3ed2415766a110eb9de54f145b8bc3bb
|
update bio (#602)
|
planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin
|
src/Firehose.Web/Authors/DanSiegel.cs
|
src/Firehose.Web/Authors/DanSiegel.cs
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class DanSiegel : IAmAMicrosoftMVP
{
public string FirstName => "Dan";
public string LastName => "Siegel";
public string StateOrRegion => "San Diego, CA";
public string EmailAddress => "dsiegel@avantipoint.com";
public string ShortBioOrTagLine => "is a Mobile App Consultant and Founder of AvantiPoint. He is an author of several OSS libraries, a maintainer of the Prism Library and a DevOps champion.";
public Uri WebSite => new Uri("https://dansiegel.net");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://dansiegel.net/syndication.axd"); }
}
public string TwitterHandle => "DanJSiegel";
public string GravatarHash => "b65a519785f69fbe7236dd0fd6396094";
public string GitHubHandle => "dansiegel";
public GeoPosition Position => new GeoPosition(32.726308, -117.177746);
public string FeedLanguageCode => "en";
}
}
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class DanSiegel : IAmAMicrosoftMVP
{
public string FirstName => "Dan";
public string LastName => "Siegel";
public string StateOrRegion => "San Diego, CA";
public string EmailAddress => "dsiegel@avantipoint.com";
public string ShortBioOrTagLine => "is a Microsoft MVP, speaker, member of the Prism Team, and a Cross Platform, Mobile & Cloud Solutions Consultant.";
public Uri WebSite => new Uri("https://dansiegel.net");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://dansiegel.net/syndication.axd"); }
}
public string TwitterHandle => "DanJSiegel";
public string GravatarHash => "b65a519785f69fbe7236dd0fd6396094";
public string GitHubHandle => "dansiegel";
public GeoPosition Position => new GeoPosition(32.726308, -117.177746);
public string FeedLanguageCode => "en";
}
}
|
mit
|
C#
|
6295fd1b2e651de9dc7eac76fa1f4cc6459d7dc7
|
add to string for .net
|
plivo/plivo-dotnet,plivo/plivo-dotnet
|
src/Plivo/Resource/Call/QueuedCall.cs
|
src/Plivo/Resource/Call/QueuedCall.cs
|
namespace Plivo.Resource.Call
{
/// <summary>
/// Queued call.
/// </summary>
public class QueuedCall : Resource
{
public string Direction { get; set; }
public string From { get; set; }
public string CallStatus { get; set; }
public string To { get; set; }
public string CallerName { get; set; }
public string CallUuid { get; set; }
public string APIId { get; set; }
}
public override string ToString()
{
return base.ToString() +
"Direction: " + Direction + "\n" +
"From: " + From + "\n" +
"CallStatus: " + CallStatus + "\n" +
"To: " + To + "\n" +
"CallerName: " + CallerName + "\n" +
"CallUuid: " + CallUuid + "\n" +
"ApiId: " + APIId + "\n";
}
}
|
namespace Plivo.Resource.Call
{
/// <summary>
/// Queued call.
/// </summary>
public class QueuedCall : Resource
{
public string Direction { get; set; }
public string From { get; set; }
public string CallStatus { get; set; }
public string To { get; set; }
public string CallerName { get; set; }
public string CallUuid { get; set; }
public string APIId { get; set; }
}
}
|
mit
|
C#
|
43eca1918a71602efe1865b4787476caa9c0f241
|
Remove obsolete code / comments
|
mdissel/serilog-sinks-marten
|
src/Tests/TestDefaultConfiguration.cs
|
src/Tests/TestDefaultConfiguration.cs
|
using System;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Serilog;
using Serilog.Sinks;
using Serilog.Sinks.Marten;
using m = Marten;
namespace Tests
{
public class TestDefaultConfiguration : IDisposable
{
m.IDocumentStore documentStore;
public TestDefaultConfiguration()
{
documentStore = m.DocumentStore.For(_ =>
{
_.Connection(ConnectionSource.ConnectionString);
_.MappingForSerilog();
_.AutoCreateSchemaObjects = m.AutoCreate.CreateOrUpdate;
});
documentStore.Advanced.Clean.DeleteDocumentsFor(typeof(LogMessage));
Log.Logger = new LoggerConfiguration().WriteTo.Marten(
documentStore,
false,
period: TimeSpan.FromSeconds(1)
)
.CreateLogger();
}
public void Dispose()
{
documentStore.Dispose();
}
[Fact]
private void SimpleMessage()
{
Log.Information("Test {count} and {2}", 1, 2);
Log.CloseAndFlush();
using (m.IQuerySession session = documentStore.QuerySession())
{
LogMessage logMessage = session.Query<LogMessage>().FirstOrDefault();
Assert.Equal("Test {count} and {2}", logMessage.MessageTemplate);
Assert.Equal(Serilog.Events.LogEventLevel.Information, logMessage.Level);
Assert.Equal(DateTime.Today, logMessage.Timestamp.Date);
Assert.Equal(2, logMessage.Properties.Count);
Assert.Equal("Test 1 and 2", logMessage.Message);
}
}
}
}
|
using System;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Serilog;
using Serilog.Sinks;
using Serilog.Sinks.Marten;
using m = Marten;
namespace Tests
{
public class TestDefaultConfiguration : IDisposable
{
m.IDocumentStore documentStore;
public TestDefaultConfiguration()
{
documentStore = m.DocumentStore.For(_ =>
{
_.Connection(ConnectionSource.ConnectionString);
_.MappingForSerilog();
_.AutoCreateSchemaObjects = m.AutoCreate.CreateOrUpdate;
});
documentStore.Advanced.Clean.DeleteDocumentsFor(typeof(LogMessage));
Log.Logger = new LoggerConfiguration().WriteTo.Marten(
documentStore, false,
period: TimeSpan.FromSeconds(1)
)
.CreateLogger();
//Log.Logger = new LoggerConfiguration()
// .WriteTo.Console(new Serilog.Formatting.Json.JsonFormatter())
// .CreateLogger();
}
public void Dispose()
{
documentStore.Dispose();
}
[Fact]
private void SimpleMessage()
{
Log.Information("Test {count} and {2}", 1, 2);
Serilog.Formatting.Json.JsonFormatter format = new Serilog.Formatting.Json.JsonFormatter();
Thread.Sleep(TimeSpan.FromSeconds(1));
using (m.IQuerySession session = documentStore.QuerySession())
{
LogMessage logMessage = session.Query<LogMessage>().FirstOrDefault();
Assert.Equal("Test {count}", logMessage.MessageTemplate);
Assert.Equal(Serilog.Events.LogEventLevel.Information, logMessage.Level);
Assert.Equal(DateTime.Today, logMessage.Timestamp.Date);
Assert.Equal(1, logMessage.Properties.Count);
Assert.Equal("Test 1", logMessage.Message);
}
}
}
}
|
mit
|
C#
|
a9711f83e847179899b43812eec6fa0d6e1bc596
|
Implement IAsyncDisposable for NullDisposable
|
WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common
|
src/WeihanLi.Common/NullDisposable.cs
|
src/WeihanLi.Common/NullDisposable.cs
|
using System.Threading.Tasks;
using System.Security.Cryptography.X509Certificates;
namespace WeihanLi.Common;
/// <summary>
/// A singleton disposable that does nothing when disposed.
/// </summary>
public sealed class NullDisposable : IDisposable
#if NET6_0_OR_GREATER
, IAsyncDisposable
#endif
{
private NullDisposable()
{
}
public void Dispose()
{
}
#if NET6_0_OR_GREATER
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
#endif
/// <summary>
/// Gets the instance of <see cref="NullDisposable"/>.
/// </summary>
public static NullDisposable Instance { get; } = new();
}
public sealed class DisposableAction : IDisposable
{
public static readonly DisposableAction Empty = new(null);
private Action? _disposeAction;
public DisposableAction(Action? disposeAction)
{
_disposeAction = disposeAction;
}
public void Dispose()
{
Interlocked.Exchange(ref _disposeAction, null)?.Invoke();
}
}
|
namespace WeihanLi.Common;
/// <summary>
/// A singleton disposable that does nothing when disposed.
/// </summary>
public sealed class NullDisposable : IDisposable
{
private NullDisposable()
{
}
public void Dispose()
{
}
/// <summary>
/// Gets the instance of <see cref="NullDisposable"/>.
/// </summary>
public static NullDisposable Instance { get; } = new();
}
public sealed class DisposableAction : IDisposable
{
public static readonly DisposableAction Empty = new(null);
private Action? _disposeAction;
public DisposableAction(Action? disposeAction)
{
_disposeAction = disposeAction;
}
public void Dispose()
{
Interlocked.Exchange(ref _disposeAction, null)?.Invoke();
}
}
|
mit
|
C#
|
df40f77832c03eccb8a1dcc38259406ad035478b
|
Add channel tag
|
DriesPeeters/PushbulletSharp,adamyeager/PushbulletSharp
|
PushbulletSharp/Models/Requests/PushRequestBase.cs
|
PushbulletSharp/Models/Requests/PushRequestBase.cs
|
using System.Runtime.Serialization;
namespace PushbulletSharp.Models.Requests
{
[DataContract]
public abstract class PushRequestBase
{
/// <summary>
/// Gets or sets the device iden.
/// </summary>
/// <value>
/// The device iden.
/// </value>
[DataMember(Name = "device_iden")]
public string DeviceIden { get; set; }
/// <summary>
/// Gets or sets the email.
/// </summary>
/// <value>
/// The email.
/// </value>
[DataMember(Name = "email")]
public string Email { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>
/// The type.
/// </value>
[DataMember(Name = "type")]
public string Type { get; protected set; }
/// <summary>
/// Gets or sets the source_device_iden.
/// </summary>
/// <value>
/// The source_device_iden.
/// </value>
[DataMember(Name = "source_device_iden")]
public string SourceDeviceIden { get; set; }
/// <summary>
/// Gets or sets the channel tag
/// </summary>
/// <value>
/// The channel_tag.
/// </value>
[DataMember(Name = "channel_tag")]
public string ChannelTag { get; set; }
}
}
|
using System.Runtime.Serialization;
namespace PushbulletSharp.Models.Requests
{
[DataContract]
public abstract class PushRequestBase
{
/// <summary>
/// Gets or sets the device iden.
/// </summary>
/// <value>
/// The device iden.
/// </value>
[DataMember(Name = "device_iden")]
public string DeviceIden { get; set; }
/// <summary>
/// Gets or sets the email.
/// </summary>
/// <value>
/// The email.
/// </value>
[DataMember(Name = "email")]
public string Email { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>
/// The type.
/// </value>
[DataMember(Name = "type")]
public string Type { get; protected set; }
/// <summary>
/// Gets or sets the source_device_iden.
/// </summary>
/// <value>
/// The source_device_iden.
/// </value>
[DataMember(Name = "source_device_iden")]
public string SourceDeviceIden { get; set; }
}
}
|
mit
|
C#
|
b39d38e74de9bb391a4f78428be4f67738dede10
|
Fix category of revision log RSS feeds.
|
dokipen/trac,dafrito/trac-mirror,dokipen/trac,moreati/trac-gitsvn,moreati/trac-gitsvn,exocad/exotrac,dafrito/trac-mirror,dafrito/trac-mirror,exocad/exotrac,exocad/exotrac,moreati/trac-gitsvn,moreati/trac-gitsvn,dokipen/trac,dafrito/trac-mirror,exocad/exotrac
|
templates/log_rss.cs
|
templates/log_rss.cs
|
<?xml version="1.0"?>
<!-- RSS generated by Trac v<?cs var:trac.version ?> on <?cs var:trac.time ?> -->
<rss version="2.0">
<channel><?cs
if:project.name_encoded ?>
<title><?cs var:project.name_encoded ?>: Revisions of <?cs var:log.path ?></title><?cs
else ?>
<title>Revisions of <?cs var:log.path ?></title><?cs
/if ?>
<link><?cs var:base_host ?><?cs var:log.log_href ?></link>
<description>Trac Log - Revisions of <?cs var:log.path ?></description>
<language>en-us</language>
<generator>Trac v<?cs var:trac.version ?></generator><?cs
each:item = log.items ?><?cs
with:change = log.changes[item.rev] ?>
<item>
<author><?cs var:change.author ?></author>
<pubDate><?cs var:change.date ?></pubDate>
<title>Revision <?cs var:item.rev ?>: <?cs var:change.shortlog ?></title>
<link><?cs var:base_host ?><?cs var:item.changeset_href ?></link>
<description><?cs var:change.message ?></description>
<category>Log</category>
</item><?cs
/with ?><?cs
/each ?>
</channel>
</rss>
|
<?xml version="1.0"?>
<!-- RSS generated by Trac v<?cs var:trac.version ?> on <?cs var:trac.time ?> -->
<rss version="2.0">
<channel><?cs
if:project.name_encoded ?>
<title><?cs var:project.name_encoded ?>: Revisions of <?cs var:log.path ?></title><?cs
else ?>
<title>Revisions of <?cs var:log.path ?></title><?cs
/if ?>
<link><?cs var:base_host ?><?cs var:log.log_href ?></link>
<description>Trac Log - Revisions of <?cs var:log.path ?></description>
<language>en-us</language>
<generator>Trac v<?cs var:trac.version ?></generator><?cs
each:item = log.items ?><?cs
with:change = log.changes[item.rev] ?>
<item>
<author><?cs var:change.author ?></author>
<pubDate><?cs var:change.date ?></pubDate>
<title>Revision <?cs var:item.rev ?>: <?cs var:change.shortlog ?></title>
<link><?cs var:base_host ?><?cs var:item.changeset_href ?></link>
<description><?cs var:change.message ?></description>
<category>Report</category>
</item><?cs
/with ?><?cs
/each ?>
</channel>
</rss>
|
bsd-3-clause
|
C#
|
ded2384aea7e7d52b71594794123fe1cceaff303
|
remove unused ctor
|
labdogg1003/monotouch-samples,kingyond/monotouch-samples,markradacz/monotouch-samples,haithemaraissia/monotouch-samples,markradacz/monotouch-samples,W3SS/monotouch-samples,albertoms/monotouch-samples,albertoms/monotouch-samples,kingyond/monotouch-samples,nelzomal/monotouch-samples,peteryule/monotouch-samples,hongnguyenpro/monotouch-samples,xamarin/monotouch-samples,robinlaide/monotouch-samples,xamarin/monotouch-samples,nelzomal/monotouch-samples,YOTOV-LIMITED/monotouch-samples,andypaul/monotouch-samples,andypaul/monotouch-samples,nervevau2/monotouch-samples,albertoms/monotouch-samples,robinlaide/monotouch-samples,nelzomal/monotouch-samples,peteryule/monotouch-samples,andypaul/monotouch-samples,davidrynn/monotouch-samples,labdogg1003/monotouch-samples,a9upam/monotouch-samples,davidrynn/monotouch-samples,YOTOV-LIMITED/monotouch-samples,labdogg1003/monotouch-samples,haithemaraissia/monotouch-samples,W3SS/monotouch-samples,a9upam/monotouch-samples,nervevau2/monotouch-samples,labdogg1003/monotouch-samples,iFreedive/monotouch-samples,robinlaide/monotouch-samples,kingyond/monotouch-samples,peteryule/monotouch-samples,davidrynn/monotouch-samples,davidrynn/monotouch-samples,sakthivelnagarajan/monotouch-samples,andypaul/monotouch-samples,sakthivelnagarajan/monotouch-samples,hongnguyenpro/monotouch-samples,YOTOV-LIMITED/monotouch-samples,haithemaraissia/monotouch-samples,YOTOV-LIMITED/monotouch-samples,a9upam/monotouch-samples,iFreedive/monotouch-samples,nervevau2/monotouch-samples,W3SS/monotouch-samples,xamarin/monotouch-samples,a9upam/monotouch-samples,hongnguyenpro/monotouch-samples,nelzomal/monotouch-samples,peteryule/monotouch-samples,sakthivelnagarajan/monotouch-samples,markradacz/monotouch-samples,iFreedive/monotouch-samples,sakthivelnagarajan/monotouch-samples,hongnguyenpro/monotouch-samples,haithemaraissia/monotouch-samples,robinlaide/monotouch-samples,nervevau2/monotouch-samples
|
AQTapDemo/AQTapDemoViewController.cs
|
AQTapDemo/AQTapDemoViewController.cs
|
//
// AQTapDemoViewController.cs:
//
// Authors:
// Chris Adamson (cadamson@subfurther.com)
// Marek Safar (marek.safar@gmail.com)
//
// Copyright 2012 Xamarin Inc
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using CoreGraphics;
using Foundation;
using UIKit;
namespace AQTapDemo
{
public partial class AQTapDemoViewController : UIViewController
{
CCFWebRadioPlayer player;
public AQTapDemoViewController ()
{
}
public override void ViewDidAppear (bool animated)
{
base.ViewDidAppear (animated);
const string STATION_URL_STRING = "http://1661.live.streamtheworld.com:80/CBC_R3_WEB_SC";
player = new CCFWebRadioPlayer (new NSUrl (STATION_URL_STRING));
stationURLLabel.Text = player.StationURL.AbsoluteString;
player.Start ();
}
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
// Return true for supported orientations
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
}
partial void HandlePitchSliderValueChanged (NSObject sender)
{
ResetPitch ();
}
partial void HandleResetToDefault (NSObject sender)
{
pitchSlider.Value = 1.0f;
ResetPitch ();
}
void ResetPitch ()
{
player.SetPitch (pitchSlider.Value);
pitchLabel.Text = pitchSlider.Value.ToString ("0.000");
}
}
}
|
//
// AQTapDemoViewController.cs:
//
// Authors:
// Chris Adamson (cadamson@subfurther.com)
// Marek Safar (marek.safar@gmail.com)
//
// Copyright 2012 Xamarin Inc
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using CoreGraphics;
using Foundation;
using UIKit;
namespace AQTapDemo
{
public partial class AQTapDemoViewController : UIViewController
{
CCFWebRadioPlayer player;
// TODO: add storyboard and remove default ctor
public AQTapDemoViewController ()
{
}
public AQTapDemoViewController (IntPtr handle)
: base(handle)
{
}
public override void ViewDidAppear (bool animated)
{
base.ViewDidAppear (animated);
const string STATION_URL_STRING = "http://1661.live.streamtheworld.com:80/CBC_R3_WEB_SC";
player = new CCFWebRadioPlayer (new NSUrl (STATION_URL_STRING));
stationURLLabel.Text = player.StationURL.AbsoluteString;
player.Start ();
}
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
// Return true for supported orientations
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
}
partial void HandlePitchSliderValueChanged (NSObject sender)
{
ResetPitch ();
}
partial void HandleResetToDefault (NSObject sender)
{
pitchSlider.Value = 1.0f;
ResetPitch ();
}
void ResetPitch ()
{
player.SetPitch (pitchSlider.Value);
pitchLabel.Text = pitchSlider.Value.ToString ("0.000");
}
}
}
|
mit
|
C#
|
58de88a9c001f5482f5be03e139316f094d265b9
|
remove httpResponseMessage from Body params
|
zhangyuan/UFO-API,zhangyuan/UFO-API,zhangyuan/UFO-API
|
test/ProductFacts.cs
|
test/ProductFacts.cs
|
using System.Linq;
using System.Net;
using System.Net.Http;
using Newtonsoft.Json;
using Xunit;
namespace test
{
public class ProductFacts : TestBase
{
private HttpResponseMessage httpResponseMessage;
[Fact]
public void ShouldReturnOk()
{
var httpResponseMessage = Server.CreateRequest("api/products").GetAsync().Result;
Assert.Equal(HttpStatusCode.OK, httpResponseMessage.StatusCode);
}
[Fact]
public void ShouldReturnAllProducts()
{
httpResponseMessage = Get("api/products");
var products = Body(new []
{
new
{
Name = default(string)
}
});
Assert.Equal(1, products.Count());
Assert.Equal("Subway", products[0].Name);
}
private HttpResponseMessage Get(string path)
{
var httpResponseMessage = Server.CreateRequest(path).GetAsync().Result;
return httpResponseMessage;
}
public T Body<T>(T anonymousTypeObject)
{
return JsonConvert.DeserializeAnonymousType(httpResponseMessage.Content.ReadAsStringAsync().Result, anonymousTypeObject);
}
}
}
|
using System.Linq;
using System.Net;
using System.Net.Http;
using Newtonsoft.Json;
using Xunit;
namespace test
{
public class ProductFacts : TestBase
{
private HttpResponseMessage httpResponseMessage;
[Fact]
public void ShouldReturnOk()
{
var httpResponseMessage = Server.CreateRequest("api/products").GetAsync().Result;
Assert.Equal(HttpStatusCode.OK, httpResponseMessage.StatusCode);
}
[Fact]
public void ShouldReturnAllProducts()
{
httpResponseMessage = Get("api/products");
var products = Body(httpResponseMessage, new []
{
new
{
Name = default(string)
}
});
Assert.Equal(1, products.Count());
Assert.Equal("Subway", products[0].Name);
}
private HttpResponseMessage Get(string path)
{
var httpResponseMessage = Server.CreateRequest(path).GetAsync().Result;
return httpResponseMessage;
}
public T Body<T>(HttpResponseMessage httpResponseMessage, T anonymousTypeObject)
{
return JsonConvert.DeserializeAnonymousType(httpResponseMessage.Content.ReadAsStringAsync().Result, anonymousTypeObject);
}
}
}
|
mit
|
C#
|
c79f8f9a5a17aa21adb6cf65d0991453a346de27
|
Add MillisecondEpochConverter
|
Baggykiin/Curse.NET
|
Curse.NET/MicrosecondEpochConverter.cs
|
Curse.NET/MicrosecondEpochConverter.cs
|
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Curse.NET
{
internal class MicrosecondEpochConverter : DateTimeConverterBase
{
private static readonly DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteRawValue(((int)(((DateTime)value - epoch).TotalMilliseconds * 1000)).ToString());
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.Value == null) { return null; }
return epoch.AddMilliseconds((long)reader.Value / 1000d);
}
}
internal class MillisecondEpochConverter : DateTimeConverterBase
{
private static readonly DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteRawValue(((int)(((DateTime)value - epoch).TotalMilliseconds)).ToString());
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.Value == null) { return null; }
return epoch.AddMilliseconds((long)reader.Value);
}
}
}
|
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Curse.NET
{
internal class MicrosecondEpochConverter : DateTimeConverterBase
{
private static readonly DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteRawValue(((DateTime)value - epoch).TotalMilliseconds + "000");
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.Value == null) { return null; }
return epoch.AddMilliseconds((long)reader.Value / 1000d);
}
}
}
|
mit
|
C#
|
76f4dbaa807e277fdcfcf562e6dd5a12de9a4e35
|
Remove now unused local variable.
|
PenguinF/sandra-three
|
Eutherion/Win/Storage/SettingReader.cs
|
Eutherion/Win/Storage/SettingReader.cs
|
#region License
/*********************************************************************************
* SettingReader.cs
*
* Copyright (c) 2004-2019 Henk Nicolai
*
* 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 Eutherion.Text.Json;
using Eutherion.Utils;
using System.Collections.Generic;
namespace Eutherion.Win.Storage
{
/// <summary>
/// Temporary class which parses a list of <see cref="JsonSymbol"/>s directly into a <see cref="PValue"/> result.
/// </summary>
public static class SettingReader
{
public static bool TryParse(
string json,
SettingSchema schema,
out SettingObject settingObject,
out ReadOnlyList<JsonSymbol> tokens,
out List<JsonErrorInfo> errors)
{
tokens = ReadOnlyList<JsonSymbol>.Create(JsonTokenizer.TokenizeAll(json));
JsonParser parser = new JsonParser(tokens, json);
bool hasRootValue = parser.TryParse(out JsonSyntaxNode rootNode, out errors);
if (hasRootValue)
{
if (schema.TryCreateValue(
json,
rootNode,
out settingObject,
errors).IsOption1(out ITypeErrorBuilder typeError))
{
errors.Add(ValueTypeError.Create(typeError, rootNode, json));
return false;
}
return true;
}
settingObject = default;
return false;
}
}
}
|
#region License
/*********************************************************************************
* SettingReader.cs
*
* Copyright (c) 2004-2019 Henk Nicolai
*
* 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 Eutherion.Text;
using Eutherion.Text.Json;
using Eutherion.Utils;
using System.Collections.Generic;
namespace Eutherion.Win.Storage
{
/// <summary>
/// Temporary class which parses a list of <see cref="JsonSymbol"/>s directly into a <see cref="PValue"/> result.
/// </summary>
public static class SettingReader
{
public static bool TryParse(
string json,
SettingSchema schema,
out SettingObject settingObject,
out ReadOnlyList<JsonSymbol> tokens,
out List<JsonErrorInfo> errors)
{
tokens = ReadOnlyList<JsonSymbol>.Create(JsonTokenizer.TokenizeAll(json));
var textElementBuilder = new List<TextElement<JsonSymbol>>();
int totalLength = 0;
foreach (var token in tokens)
{
textElementBuilder.Add(new TextElement<JsonSymbol>(token, totalLength, token.Length));
totalLength += token.Length;
}
JsonParser parser = new JsonParser(tokens, json);
bool hasRootValue = parser.TryParse(out JsonSyntaxNode rootNode, out errors);
if (hasRootValue)
{
if (schema.TryCreateValue(
json,
rootNode,
out settingObject,
errors).IsOption1(out ITypeErrorBuilder typeError))
{
errors.Add(ValueTypeError.Create(typeError, rootNode, json));
return false;
}
return true;
}
settingObject = default;
return false;
}
}
}
|
apache-2.0
|
C#
|
59fff3698ff18568613a794dd239ac6142dc182c
|
Bump to version 1.4.
|
mono/sdb,mono/sdb
|
src/AssemblyInfo.cs
|
src/AssemblyInfo.cs
|
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Alex Rønne Petersen
//
// 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.Reflection;
[assembly: AssemblyTitle("Mono.Debugger.Client")]
[assembly: AssemblyProduct("Mono")]
[assembly: AssemblyCopyright("Copyright 2014 Alex Rønne Petersen")]
[assembly: AssemblyVersion("1.4.*")]
|
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Alex Rønne Petersen
//
// 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.Reflection;
[assembly: AssemblyTitle("Mono.Debugger.Client")]
[assembly: AssemblyProduct("Mono")]
[assembly: AssemblyCopyright("Copyright 2014 Alex Rønne Petersen")]
[assembly: AssemblyVersion("1.3.*")]
|
mit
|
C#
|
0a3dbd5f4f79fe5a7845d8e27af5427abc444dfd
|
Implement the apply method for selections on SelectionAccess to flatten the selection
|
Domysee/Pather.CSharp
|
src/Pather.CSharp/PathElements/SelectionAccess.cs
|
src/Pather.CSharp/PathElements/SelectionAccess.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace Pather.CSharp.PathElements
{
public class SelectionAccess : IPathElement
{
public SelectionAccess()
{
}
public object Apply(object target)
{
var enumerable = target as IEnumerable;
var result = new Selection(enumerable);
return result;
}
public Selection Apply(Selection target)
{
var results = new List<object>();
foreach(var entry in target.Entries)
{
var enumerable = entry as IEnumerable;
if (enumerable == null)
results.Add(entry);
else
{
foreach (var element in enumerable)
results.Add(element);
}
}
var result = new Selection(results);
return result;
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace Pather.CSharp.PathElements
{
public class SelectionAccess : IPathElement
{
public SelectionAccess()
{
}
public object Apply(object target)
{
var enumerable = target as IEnumerable;
var result = new Selection(enumerable);
return result;
}
}
}
|
mit
|
C#
|
1a7d86176b0d1942006e9a55d7729c7f5197d409
|
Enumerate via self instead of directly
|
bojanrajkovic/pingu
|
src/Pingu/PngFile.cs
|
src/Pingu/PngFile.cs
|
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Pingu.Chunks;
namespace Pingu
{
public class PngFile : IEnumerable<Chunk>
{
List<Chunk> chunksToWrite = new List<Chunk>();
static readonly byte[] magic = new byte[] { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a };
public void Add(Chunk chunk) => chunksToWrite.Add(chunk);
IEnumerator<Chunk> IEnumerable<Chunk>.GetEnumerator() => chunksToWrite.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => chunksToWrite.GetEnumerator();
public int ChunkCount => chunksToWrite.Count;
public async Task WriteFileAsync(Stream target)
{
await target.WriteAsync(magic, 0, magic.Length);
foreach (var chunk in this)
await chunk.WriteSelfToStreamAsync(target);
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Pingu.Chunks;
namespace Pingu
{
public class PngFile : IEnumerable<Chunk>
{
List<Chunk> chunksToWrite = new List<Chunk>();
static readonly byte[] magic = new byte[] { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a };
public void Add(Chunk chunk) => chunksToWrite.Add(chunk);
IEnumerator<Chunk> IEnumerable<Chunk>.GetEnumerator() => chunksToWrite.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => chunksToWrite.GetEnumerator();
public int ChunkCount => chunksToWrite.Count;
public async Task WriteFileAsync(Stream target)
{
await target.WriteAsync(magic, 0, magic.Length);
foreach (var chunk in chunksToWrite)
await chunk.WriteSelfToStreamAsync(target);
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.