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 |
|---|---|---|---|---|---|---|---|---|
3f4e5d1dca41270d547ccbc3c328bcafba490315
|
Improve JS Snippet unit test
|
Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnet5,gzepeda/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnet5,gzepeda/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnetcore,gzepeda/ApplicationInsights-aspnetcore
|
test/Microsoft.ApplicationInsights.AspNetCore.Tests/JavaScript/ApplicationInsightsJavaScriptTest.cs
|
test/Microsoft.ApplicationInsights.AspNetCore.Tests/JavaScript/ApplicationInsightsJavaScriptTest.cs
|
namespace Microsoft.Framework.DependencyInjection.Test
{
using Microsoft.ApplicationInsights.AspNetCore;
using Microsoft.ApplicationInsights.Extensibility;
using Xunit;
public static class ApplicationInsightsJavaScriptTest
{
[Fact]
public static void SnippetWillBeEmptyWhenInstrumentationKeyIsNotDefined()
{
var telemetryConfigurationWithNullKey = new TelemetryConfiguration();
var snippet = new JavaScriptSnippet(telemetryConfigurationWithNullKey);
Assert.Equal(string.Empty, snippet.FullScript.ToString());
}
[Fact]
public static void SnippetWillBeEmptyWhenInstrumentationKeyIsEmpty()
{
var telemetryConfigurationWithEmptyKey = new TelemetryConfiguration { InstrumentationKey = string.Empty };
var snippet = new JavaScriptSnippet(telemetryConfigurationWithEmptyKey);
Assert.Equal(string.Empty, snippet.FullScript.ToString());
}
[Fact]
public static void SnippetWillIncludeInstrumentationKeyAsSubstring()
{
string unittestkey = "unittestkey";
var telemetryConfiguration = new TelemetryConfiguration { InstrumentationKey = unittestkey };
var snippet = new JavaScriptSnippet(telemetryConfiguration);
Assert.Contains("instrumentationKey: '" + unittestkey + "'", snippet.FullScript.ToString());
}
}
}
|
namespace Microsoft.Framework.DependencyInjection.Test
{
using Microsoft.ApplicationInsights.AspNetCore;
using Microsoft.ApplicationInsights.Extensibility;
using Xunit;
public static class ApplicationInsightsJavaScriptTest
{
[Fact]
public static void SnippetWillBeEmptyWhenInstrumentationKeyIsNotDefined()
{
var telemetryConfigurationWithNullKey = new TelemetryConfiguration();
var snippet = new JavaScriptSnippet(telemetryConfigurationWithNullKey);
Assert.Equal(string.Empty, snippet.FullScript.ToString());
}
[Fact]
public static void SnippetWillBeEmptyWhenInstrumentationKeyIsEmpty()
{
var telemetryConfigurationWithEmptyKey = new TelemetryConfiguration { InstrumentationKey = string.Empty };
var snippet = new JavaScriptSnippet(telemetryConfigurationWithEmptyKey);
Assert.Equal(string.Empty, snippet.FullScript.ToString());
}
[Fact]
public static void SnippetWillIncludeInstrumentationKeyAsSubstring()
{
string unittestkey = "unittestkey";
var telemetryConfiguration = new TelemetryConfiguration { InstrumentationKey = unittestkey };
var snippet = new JavaScriptSnippet(telemetryConfiguration);
Assert.Contains("'" + unittestkey + "'", snippet.FullScript.ToString());
}
}
}
|
mit
|
C#
|
c561b3f8894f1a4536a4af9a9f63fe8e19db3e00
|
test db creation
|
olebg/Movie-Theater-Project
|
MovieTheater/MovieTheater.CLI/StartUp.cs
|
MovieTheater/MovieTheater.CLI/StartUp.cs
|
using MovieTheater.Data;
using MovieTheater.Data.Migrations;
using MovieTheater.Models;
using System.Data.Entity;
namespace MovieTheater.CLI
{
public class StartUp
{
public static void Main()
{
Database.SetInitializer(new MigrateDatabaseToLatestVersion<MovieTheaterDbContext, Configuration>());
var data = new MovieTheaterDbContext();
var theater = new Theater() { Name = "test"};
data.Theaters.Add(theater);
data.SaveChanges();
}
}
}
|
using MovieTheater.Data;
using MovieTheater.Data.Migrations;
using MovieTheater.Models;
using System.Data.Entity;
namespace MovieTheater.CLI
{
public class StartUp
{
public static void Main()
{
Database.SetInitializer(new MigrateDatabaseToLatestVersion<MovieTheaterDbContext, Configuration>());
var data = new MovieTheaterDbContext();
//var theater = new Theater() { Seats = 10};
//data.Theaters.Add(theater);
//data.SaveChanges();
}
}
}
|
mit
|
C#
|
1db53d2e60aed1ebcc09bee5892838155676acaa
|
Fix migration by truncating rooms table
|
johanhelsing/vaskelista,johanhelsing/vaskelista
|
Vaskelista/Migrations/201409021138021_RoomHouseholdRelation.cs
|
Vaskelista/Migrations/201409021138021_RoomHouseholdRelation.cs
|
namespace Vaskelista.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class RoomHouseholdRelation : DbMigration
{
public override void Up()
{
Sql("TRUNCATE TABLE dbo.Rooms");
AddColumn("dbo.Rooms", "HouseHold_HouseholdId", c => c.Int(nullable: false));
CreateIndex("dbo.Rooms", "HouseHold_HouseholdId");
AddForeignKey("dbo.Rooms", "HouseHold_HouseholdId", "dbo.Households", "HouseholdId", cascadeDelete: true);
}
public override void Down()
{
DropForeignKey("dbo.Rooms", "HouseHold_HouseholdId", "dbo.Households");
DropIndex("dbo.Rooms", new[] { "HouseHold_HouseholdId" });
DropColumn("dbo.Rooms", "HouseHold_HouseholdId");
}
}
}
|
namespace Vaskelista.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class RoomHouseholdRelation : DbMigration
{
public override void Up()
{
AddColumn("dbo.Rooms", "HouseHold_HouseholdId", c => c.Int(nullable: false));
CreateIndex("dbo.Rooms", "HouseHold_HouseholdId");
AddForeignKey("dbo.Rooms", "HouseHold_HouseholdId", "dbo.Households", "HouseholdId", cascadeDelete: true);
}
public override void Down()
{
DropForeignKey("dbo.Rooms", "HouseHold_HouseholdId", "dbo.Households");
DropIndex("dbo.Rooms", new[] { "HouseHold_HouseholdId" });
DropColumn("dbo.Rooms", "HouseHold_HouseholdId");
}
}
}
|
mit
|
C#
|
da8d1a473232457261f15a21ef5308888b8d6aec
|
Update assembly information, changed version to 0.1.
|
Gohla/renegadex-launcher
|
RXL.WPFClient/Properties/AssemblyInfo.cs
|
RXL.WPFClient/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Alternative RenegadeX Launcher")]
[assembly: AssemblyDescription("Alternative RenegadeX Launcher")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RXL")]
[assembly: AssemblyCopyright("Copyright © Gabriël Konat, Hans Harts 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RXL.WPFClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RXL.WPFClient")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
0909144c85f5134aa112cad70f4b9303a4b0c913
|
add `therad_ts` for NewMessage
|
Inumedia/SlackAPI
|
SlackAPI/WebSocketMessages/NewMessage.cs
|
SlackAPI/WebSocketMessages/NewMessage.cs
|
using System;
namespace SlackAPI.WebSocketMessages
{
[SlackSocketRouting("message")]
[SlackSocketRouting("message", "bot_message")]
public class NewMessage : SlackSocketMessage
{
public string user;
public string channel;
public string text;
public string team;
public DateTime ts;
public DateTime thread_ts;
public NewMessage()
{
type = "message";
}
}
}
|
using System;
namespace SlackAPI.WebSocketMessages
{
[SlackSocketRouting("message")]
[SlackSocketRouting("message", "bot_message")]
public class NewMessage : SlackSocketMessage
{
public string user;
public string channel;
public string text;
public string team;
public DateTime ts;
public NewMessage()
{
type = "message";
}
}
}
|
mit
|
C#
|
1134d6250733c9d66abc2cb3662b74c3785c4c83
|
Fix DocumentIndex: IEquatable<DocumentIndex>
|
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
|
InfinniPlatform.Sdk/Metadata/Documents/DocumentIndex.cs
|
InfinniPlatform.Sdk/Metadata/Documents/DocumentIndex.cs
|
using System;
using System.Collections.Generic;
namespace InfinniPlatform.Sdk.Metadata.Documents
{
/// <summary>
/// Индекс документа.
/// </summary>
public sealed class DocumentIndex : IEquatable<DocumentIndex>
{
/// <summary>
/// Имя индекса.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Уникальный индекс.
/// </summary>
public bool Unique { get; set; }
/// <summary>
/// Ключ индекса документа.
/// </summary>
public IDictionary<string, DocumentIndexKeyType> Key { get; set; }
public bool Equals(DocumentIndex other)
{
if (ReferenceEquals(this, other))
{
return true;
}
if (other != null && Unique == other.Unique)
{
if (ReferenceEquals(Key, other.Key) || ((Key == null || Key.Count == 0) && (other.Key == null || other.Key.Count == 0)))
{
return true;
}
if (Key != null && other.Key != null && Key.Count == other.Key.Count)
{
var keysAreEqual = true;
foreach (var item in Key)
{
DocumentIndexKeyType otherKeyType;
if (!other.Key.TryGetValue(item.Key, out otherKeyType) || item.Value != otherKeyType)
{
keysAreEqual = false;
break;
}
}
return keysAreEqual;
}
}
return false;
}
public override int GetHashCode()
{
return 0;
}
}
}
|
using System;
using System.Collections.Generic;
namespace InfinniPlatform.Sdk.Metadata.Documents
{
/// <summary>
/// Индекс документа.
/// </summary>
public sealed class DocumentIndex : IEquatable<DocumentIndex>
{
/// <summary>
/// Имя индекса.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Уникальный индекс.
/// </summary>
public bool Unique { get; set; }
/// <summary>
/// Ключ индекса документа.
/// </summary>
public IDictionary<string, DocumentIndexKeyType> Key { get; set; }
public bool Equals(DocumentIndex other)
{
if (ReferenceEquals(this, other))
{
return true;
}
if (other != null && Unique == other.Unique)
{
if (ReferenceEquals(Key, other.Key) || ((Key == null || Key.Count == 0) && (other.Key == null || other.Key.Count == 0)))
{
return true;
}
if (Key != null && other.Key != null && Key.Count == other.Key.Count)
{
var keysAreEqual = true;
foreach (var item in Key)
{
DocumentIndexKeyType otherKeyType;
if (!other.Key.TryGetValue(item.Key, out otherKeyType) || item.Value != otherKeyType)
{
keysAreEqual = false;
break;
}
}
return keysAreEqual;
}
}
return false;
}
}
}
|
agpl-3.0
|
C#
|
d565d6522b9a261e964be7cd0d627f5870a6b534
|
Bump version to 2.0
|
cergis-robert/SagePayMvc,IntegratedArts/SagePayMvc,AdtecSoftware/Adtec.SagePayMvc,JeremySkinner/SagePayMvc,AdtecSoftware/SagePayMvc
|
src/SagePayMvc/Properties/AssemblyInfo.cs
|
src/SagePayMvc/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("SagePayMvc")]
[assembly: AssemblyDescription("SagePay integration for ASP.NET MVC")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Sixth Form College Farnborough")]
[assembly: AssemblyProduct("SagePayMvc")]
[assembly: AssemblyCopyright("Copyright © The Sixth Form College Farnborough")]
[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("e4ae6ce2-795a-4018-a081-44cdf4aba537")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.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("SagePayMvc")]
[assembly: AssemblyDescription("SagePay integration for ASP.NET MVC")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Sixth Form College Farnborough")]
[assembly: AssemblyProduct("SagePayMvc")]
[assembly: AssemblyCopyright("Copyright © The Sixth Form College Farnborough")]
[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("e4ae6ce2-795a-4018-a081-44cdf4aba537")]
// 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#
|
9aa4773acbfadbcf95aaf0063510f8be8ddcbd86
|
remove the NotFound event, as it is not used anymore
|
heftig/avahi-1,gloryleague/avahi,Distrotech/avahi,lathiat/avahi,heftig/avahi,Kisensum/xmDNS-avahi,heftig/avahi,everbase/catta,lathiat/avahi,Kisensum/xmDNS-avahi,lathiat/avahi,gloryleague/avahi,Distrotech/avahi,sunilghai/avahi-clone,heftig/avahi-1,heftig/avahi,sunilghai/avahi-clone,lathiat/avahi,Kisensum/xmDNS-avahi,gloryleague/avahi,Distrotech/avahi,heftig/avahi-1,Kisensum/xmDNS-avahi,Kisensum/xmDNS-avahi,Distrotech/avahi,sunilghai/avahi-clone,heftig/avahi,catta-x/catta,heftig/avahi-1,gloryleague/avahi,gloryleague/avahi,catta-x/catta,Kisensum/xmDNS-avahi,heftig/avahi-1,everbase/catta,heftig/avahi-1,lathiat/avahi,Distrotech/avahi,everbase/catta,sunilghai/avahi-clone,sunilghai/avahi-clone,Distrotech/avahi,lathiat/avahi,sunilghai/avahi-clone,heftig/avahi,catta-x/catta,heftig/avahi,gloryleague/avahi
|
avahi-sharp/BrowserBase.cs
|
avahi-sharp/BrowserBase.cs
|
/* $Id$ */
/***
This file is part of avahi.
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
using System;
namespace Avahi
{
public abstract class BrowserBase
{
public event EventHandler CacheExhausted;
public event EventHandler AllForNow;
public event EventHandler Failed;
internal void EmitBrowserEvent (BrowserEvent bevent)
{
switch (bevent) {
case BrowserEvent.CacheExhausted:
if (CacheExhausted != null)
CacheExhausted (this, new EventArgs ());
break;
case BrowserEvent.AllForNow:
if (AllForNow != null)
AllForNow (this, new EventArgs ());
break;
case BrowserEvent.Failure:
if (Failed != null)
Failed (this, new EventArgs ());
break;
default:
break;
}
}
}
}
|
/* $Id$ */
/***
This file is part of avahi.
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
using System;
namespace Avahi
{
public abstract class BrowserBase
{
public event EventHandler CacheExhausted;
public event EventHandler AllForNow;
public event EventHandler NotFound;
public event EventHandler Failed;
internal void EmitBrowserEvent (BrowserEvent bevent)
{
switch (bevent) {
case BrowserEvent.CacheExhausted:
if (CacheExhausted != null)
CacheExhausted (this, new EventArgs ());
break;
case BrowserEvent.AllForNow:
if (AllForNow != null)
AllForNow (this, new EventArgs ());
break;
case BrowserEvent.Failure:
if (Failed != null)
Failed (this, new EventArgs ());
break;
default:
break;
}
}
}
}
|
lgpl-2.1
|
C#
|
4b74cc8bbc01dcb3673669fe52270d78652fdf99
|
Fix Error in Median Calculation
|
iwillspeak/IronRure,iwillspeak/IronRure
|
bench/Alice/BenchResult.cs
|
bench/Alice/BenchResult.cs
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace Alice
{
public class BenchResult
{
public BenchResult(string name, List<long> ticks)
{
Name = name;
_ticks = ticks;
_ticks.Sort();
Mean = _ticks.Sum() / _ticks.Count;
var idx = (_ticks.Count / 2);
Median = _ticks.Count % 2 == 0 ? (_ticks[idx] + _ticks[idx - 1]) / 2 : _ticks[idx];
Variance = Math.Sqrt(_ticks.Select(t => Math.Pow(t - Mean, 2)).Sum() / _ticks.Count);
}
public string Name { get; }
public long Mean { get; }
public long Median { get; }
public double Variance { get; }
private List<long> _ticks;
public IEnumerable<long> Ticks => _ticks;
public override string ToString()
{
var ticks = string.Join(",", _ticks.Select(t => string.Format("{0,10}", t)));
return $"{Name,15}: {ticks} (mean: {Mean,10}, median: {Median,10}, r: {Variance:0.00})";
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace Alice
{
public class BenchResult
{
public BenchResult(string name, List<long> ticks)
{
Name = name;
_ticks = ticks;
Mean = _ticks.Sum() / _ticks.Count;
Median = _ticks[_ticks.Count / 2];
Variance = Math.Sqrt(_ticks.Select(t => Math.Pow(t - Mean, 2)).Sum() / _ticks.Count);
}
public string Name { get; }
public long Mean { get; }
public long Median { get; }
public double Variance { get; }
private List<long> _ticks;
public IEnumerable<long> Ticks => _ticks;
public override string ToString() =>
$"{Name}: {string.Join(",\t", _ticks)} (mean: {Mean}, median: {Median}, r: {Variance:0.00})";
}
}
|
mit
|
C#
|
4cba595998248e10b6e3a3762437c4093de04fea
|
Use 'dotnet xunit' instead of dotnet test.
|
SQLStreamStore/SQLStreamStore,damianh/SqlStreamStore,SQLStreamStore/SQLStreamStore,damianh/Cedar.EventStore
|
build.cake
|
build.cake
|
#tool "nuget:?package=xunit.runner.console&version=2.1.0"
#tool "nuget:?package=ILRepack&Version=2.0.12"
#addin "Cake.FileHelpers"
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var artifactsDir = Directory("./artifacts");
var solution = "./src/SqlStreamStore.sln";
var buildNumber = string.IsNullOrWhiteSpace(EnvironmentVariable("BUILD_NUMBER")) ? "0" : EnvironmentVariable("BUILD_NUMBER");
Task("Clean")
.Does(() =>
{
CleanDirectory(artifactsDir);
});
Task("RestorePackages")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetCoreRestore(solution);
NuGetRestore(solution);
});
Task("Build")
.IsDependentOn("RestorePackages")
.Does(() =>
{
var settings = new DotNetCoreBuildSettings
{
Configuration = configuration
};
DotNetCoreBuild(solution, settings);
});
Task("RunTests")
.IsDependentOn("Build")
.Does(() =>
{
var testProjects = new string[] { "SqlStreamStore.Tests", "SqlStreamStore.MsSql.Tests" };
foreach(var testProject in testProjects)
{
var projectDir = "./src/"+ testProject + "/";
var settings = new ProcessSettings
{
Arguments = "xunit",
WorkingDirectory = projectDir
};
StartProcess("dotnet", settings);
}
});
Task("NuGetPack")
.IsDependentOn("Build")
.Does(() =>
{
var versionSuffix = "build" + buildNumber.ToString().PadLeft(5, '0');
var dotNetCorePackSettings = new DotNetCorePackSettings
{
ArgumentCustomization = args => args.Append("/p:Version=1.0.0-" + versionSuffix),
OutputDirectory = artifactsDir,
NoBuild = true,
Configuration = configuration,
VersionSuffix = versionSuffix
};
DotNetCorePack("./src/SqlStreamStore", dotNetCorePackSettings);
DotNetCorePack("./src/SqlStreamStore.MsSql", dotNetCorePackSettings);
});
Task("Default")
.IsDependentOn("RunTests")
.IsDependentOn("NuGetPack");
RunTarget(target);
|
#tool "nuget:?package=xunit.runner.console&version=2.1.0"
#tool "nuget:?package=ILRepack&Version=2.0.12"
#addin "Cake.FileHelpers"
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var artifactsDir = Directory("./artifacts");
var solution = "./src/SqlStreamStore.sln";
var buildNumber = string.IsNullOrWhiteSpace(EnvironmentVariable("BUILD_NUMBER")) ? "0" : EnvironmentVariable("BUILD_NUMBER");
Task("Clean")
.Does(() =>
{
CleanDirectory(artifactsDir);
});
Task("RestorePackages")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetCoreRestore(solution);
NuGetRestore(solution);
});
Task("Build")
.IsDependentOn("RestorePackages")
.Does(() =>
{
var settings = new DotNetCoreBuildSettings
{
Configuration = configuration
};
DotNetCoreBuild(solution, settings);
});
Task("RunTests")
.IsDependentOn("Build")
.Does(() =>
{
var testSettings = new DotNetCoreTestSettings
{
NoBuild = true,
Configuration = configuration
};
var testProjects = new string[] { "SqlStreamStore.Tests", "SqlStreamStore.MsSql.Tests" };
foreach(var testProject in testProjects)
{
var projectDir = "./src/"+ testProject + "/" + testProject + ".csproj";
DotNetCoreTest(projectDir, testSettings);
}
});
Task("NuGetPack")
.IsDependentOn("Build")
.Does(() =>
{
var versionSuffix = "build" + buildNumber.ToString().PadLeft(5, '0');
var dotNetCorePackSettings = new DotNetCorePackSettings
{
ArgumentCustomization = args => args.Append("/p:Version=1.0.0-" + versionSuffix),
OutputDirectory = artifactsDir,
NoBuild = true,
Configuration = configuration,
VersionSuffix = versionSuffix
};
DotNetCorePack("./src/SqlStreamStore", dotNetCorePackSettings);
DotNetCorePack("./src/SqlStreamStore.MsSql", dotNetCorePackSettings);
});
Task("Default")
.IsDependentOn("RunTests")
.IsDependentOn("NuGetPack");
RunTarget(target);
|
mit
|
C#
|
27c9139d0dfd8925e864537c3e6faf7a71f9db52
|
Remove unnecessary cycle check from SynchroniseWithSystemClock
|
eightlittlebits/elbgb
|
elbgb_core/ClockedComponent.cs
|
elbgb_core/ClockedComponent.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace elbgb_core
{
public abstract class ClockedComponent
{
protected GameBoy _gb;
private SystemClock _clock;
protected ulong _lastUpdate;
public ClockedComponent(GameBoy gameBoy)
{
_gb = gameBoy;
_clock = gameBoy.Clock;
}
public void SynchroniseWithSystemClock()
{
ulong timestamp = _clock.Timestamp;
uint cyclesToUpdate = (uint)(timestamp - _lastUpdate);
_lastUpdate = timestamp;
Update(cyclesToUpdate);
}
// Run this component for the required number of cycles
public abstract void Update(uint cycleCount);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace elbgb_core
{
public abstract class ClockedComponent
{
protected GameBoy _gb;
protected ulong _lastUpdate;
public ClockedComponent(GameBoy gameBoy)
{
_gb = gameBoy;
}
public void SynchroniseWithSystemClock()
{
// if we're up to date with the current timestamp there
// is nothing for us to do
if (_lastUpdate == _gb.Clock.Timestamp)
{
return;
}
ulong timestamp = _gb.Clock.Timestamp;
uint cyclesToUpdate = (uint)(timestamp - _lastUpdate);
_lastUpdate = timestamp;
Update(cyclesToUpdate);
}
// Run this component for the required number of cycles
public abstract void Update(uint cycleCount);
}
}
|
mit
|
C#
|
e4b427dc3ceaefd2dc933dfae12716c90a8b5a6d
|
Add comment
|
sharwell/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,dotnet/roslyn,eriawan/roslyn,weltkante/roslyn,KevinRansom/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,eriawan/roslyn,physhi/roslyn,KevinRansom/roslyn,wvdd007/roslyn,AmadeusW/roslyn,weltkante/roslyn,AmadeusW/roslyn,diryboy/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,sharwell/roslyn,wvdd007/roslyn,bartdesmet/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,eriawan/roslyn,physhi/roslyn,dotnet/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,diryboy/roslyn,wvdd007/roslyn,physhi/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn
|
src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/IPersistentStorage.cs
|
src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/IPersistentStorage.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.CodeAnalysis.Host
{
/// <remarks>
/// Instances of <see cref="IPersistentStorage"/> support both synchronous and asynchronous disposal. Asynchronous
/// disposal should always be preferred as the implementation of synchronous disposal may end up blocking the caller
/// on async work.
/// </remarks>
public interface IPersistentStorage : IDisposable, IAsyncDisposable
{
Task<Stream?> ReadStreamAsync(string name, CancellationToken cancellationToken = default);
Task<Stream?> ReadStreamAsync(Project project, string name, CancellationToken cancellationToken = default);
Task<Stream?> ReadStreamAsync(Document document, string name, CancellationToken cancellationToken = default);
Task<bool> WriteStreamAsync(string name, Stream stream, CancellationToken cancellationToken = default);
Task<bool> WriteStreamAsync(Project project, string name, Stream stream, CancellationToken cancellationToken = default);
Task<bool> WriteStreamAsync(Document document, string name, Stream stream, CancellationToken cancellationToken = default);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.CodeAnalysis.Host
{
public interface IPersistentStorage : IDisposable, IAsyncDisposable
{
Task<Stream?> ReadStreamAsync(string name, CancellationToken cancellationToken = default);
Task<Stream?> ReadStreamAsync(Project project, string name, CancellationToken cancellationToken = default);
Task<Stream?> ReadStreamAsync(Document document, string name, CancellationToken cancellationToken = default);
Task<bool> WriteStreamAsync(string name, Stream stream, CancellationToken cancellationToken = default);
Task<bool> WriteStreamAsync(Project project, string name, Stream stream, CancellationToken cancellationToken = default);
Task<bool> WriteStreamAsync(Document document, string name, Stream stream, CancellationToken cancellationToken = default);
}
}
|
mit
|
C#
|
bbcfc715fef35ab74d2cbcbf01d313cb360fa752
|
Fix version number in assembly
|
GoodSoil/cqrs-starter-kit,GoodSoil/cqrs-starter-kit
|
starter-kit/Edument.CQRS.EntityFramework/Properties/AssemblyInfo.cs
|
starter-kit/Edument.CQRS.EntityFramework/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("Edument.CQRS.EntityFramework")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Dynamic Generation Inc.")]
[assembly: AssemblyProduct("Edument.CQRS.EntityFramework")]
[assembly: AssemblyCopyright("Copyright © Dynamic Generation Inc. 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("285a28c4-4564-4bb9-8cc2-afce371074a0")]
// 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.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.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("Edument.CQRS.EntityFramework")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Dynamic Generation Inc.")]
[assembly: AssemblyProduct("Edument.CQRS.EntityFramework")]
[assembly: AssemblyCopyright("Copyright © Dynamic Generation Inc. 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("285a28c4-4564-4bb9-8cc2-afce371074a0")]
// 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")]
|
bsd-3-clause
|
C#
|
a0014c3e1aa8afe9ba4673bb1755165451c378c3
|
Update PingController.cs
|
miladinoviczeljko/GitTest1
|
SimpleWebApi/SimpleWebApi/Controllers/PingController.cs
|
SimpleWebApi/SimpleWebApi/Controllers/PingController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace SimpleWebApi.Controllers
{
public class PingController : Controller
{
[HttpGet]
[Route("ping")]
public IActionResult Ping()
{
return Ok("pongChanged");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace SimpleWebApi.Controllers
{
public class PingController : Controller
{
[HttpGet]
[Route("ping")]
public IActionResult Ping()
{
return Ok("pong");
}
}
}
|
mit
|
C#
|
a9097751598bd0f1ceba0ae0dc4ae99fb407761d
|
make sure lag is positive
|
chrkon/helix-toolkit,JeremyAnsel/helix-toolkit,helix-toolkit/helix-toolkit,holance/helix-toolkit,smischke/helix-toolkit,Iluvatar82/helix-toolkit
|
Source/HelixToolkit.Wpf.SharpDX/Helpers/EventSkipper.cs
|
Source/HelixToolkit.Wpf.SharpDX/Helpers/EventSkipper.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelixToolkit.Wpf.SharpDX.Helpers
{
/// <summary>
/// Use to skip event if event frequency is too high.
/// </summary>
public sealed class EventSkipper
{
/// <summary>
/// Stopwatch
/// </summary>
private static readonly Stopwatch watch = new Stopwatch();
private long lag = 0;
/// <summary>
///
/// </summary>
static EventSkipper()
{
watch.Start();
}
/// <summary>
/// The threshold used to skip if previous event happened less than the threshold.
/// </summary>
public long Threshold = 15;
/// <summary>
/// Previous event happened.
/// </summary>
private long previous = 0;
/// <summary>
/// Determine if this event should be skipped.
/// </summary>
/// <returns>If skip, return true. Otherwise, return false.</returns>
public bool IsSkip()
{
var curr = watch.ElapsedMilliseconds;
var elpased = curr - previous;
previous = curr;
lag += elpased;
if (lag < Threshold)
{
return true;
}
else
{
lag -= Threshold;
lag = Math.Max(0, lag);
return false;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelixToolkit.Wpf.SharpDX.Helpers
{
/// <summary>
/// Use to skip event if event frequency is too high.
/// </summary>
public sealed class EventSkipper
{
/// <summary>
/// Stopwatch
/// </summary>
private static readonly Stopwatch watch = new Stopwatch();
private long lag = 0;
/// <summary>
///
/// </summary>
static EventSkipper()
{
watch.Start();
}
/// <summary>
/// The threshold used to skip if previous event happened less than the threshold.
/// </summary>
public long Threshold = 15;
/// <summary>
/// Previous event happened.
/// </summary>
private long previous = 0;
/// <summary>
/// Determine if this event should be skipped.
/// </summary>
/// <returns>If skip, return true. Otherwise, return false.</returns>
public bool IsSkip()
{
var curr = watch.ElapsedMilliseconds;
var elpased = curr - previous;
previous = curr;
lag += elpased;
if (lag < Threshold)
{
return true;
}
else
{
lag -= Threshold;
return false;
}
}
}
}
|
mit
|
C#
|
dde5577337feeaa5ff8a2a70a54fd0da272cb5cf
|
Use static HttpClient
|
awseward/Bugsnag.NET,awseward/Bugsnag.NET
|
lib/Bugsnag.Common/BugsnagClient.cs
|
lib/Bugsnag.Common/BugsnagClient.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Bugsnag.Common
{
public class BugsnagClient : IClient
{
static Uri _uri = new Uri("http://notify.bugsnag.com");
static Uri _sslUri = new Uri("https://notify.bugsnag.com");
static JsonSerializerSettings _settings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
};
static HttpClient _HttpClient { get; } = new HttpClient();
public void Send(INotice notice) => Send(notice, true);
public void Send(INotice notice, bool useSSL)
{
var _ = SendAsync(notice, useSSL).Result;
}
public Task<HttpResponseMessage> SendAsync(INotice notice) => SendAsync(notice, true);
public Task<HttpResponseMessage> SendAsync(INotice notice, bool useSSL)
{
var uri = useSSL ? _sslUri : _uri;
var json = JsonConvert.SerializeObject(notice, _settings);
var content = new StringContent(json, Encoding.UTF8, "application/json");
return _HttpClient.PostAsync(uri, content);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Bugsnag.Common
{
public class BugsnagClient : IClient
{
static Uri _uri = new Uri("http://notify.bugsnag.com");
static Uri _sslUri = new Uri("https://notify.bugsnag.com");
static JsonSerializerSettings _settings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
};
public void Send(INotice notice) => Send(notice, true);
public void Send(INotice notice, bool useSSL)
{
var _ = SendAsync(notice, useSSL).Result;
}
public Task<HttpResponseMessage> SendAsync(INotice notice) => SendAsync(notice, true);
public Task<HttpResponseMessage> SendAsync(INotice notice, bool useSSL)
{
var uri = useSSL ? _sslUri : _uri;
var json = JsonConvert.SerializeObject(notice, _settings);
var content = new StringContent(json, Encoding.UTF8, "application/json");
return new HttpClient().PostAsync(uri, content);
}
}
}
|
mit
|
C#
|
a8e0a749630e337c638021ccdf15c1e3616fca44
|
Fix the issue of workflow-recipe (#3290)
|
stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2,petedavis/Orchard2,petedavis/Orchard2,xkproject/Orchard2,xkproject/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,xkproject/Orchard2
|
src/OrchardCore.Modules/OrchardCore.Workflows/Recipes/WorkflowTypeStep.cs
|
src/OrchardCore.Modules/OrchardCore.Workflows/Recipes/WorkflowTypeStep.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using OrchardCore.Recipes.Models;
using OrchardCore.Recipes.Services;
using OrchardCore.Workflows.Models;
using OrchardCore.Workflows.Services;
using YesSql;
namespace OrchardCore.Workflows.Recipes
{
public class WorkflowTypeStep : IRecipeStepHandler
{
private readonly ISession _session;
private readonly IWorkflowTypeStore _workflowTypeStore;
public WorkflowTypeStep(IWorkflowTypeStore workflowTypeStore, ISession session)
{
_workflowTypeStore = workflowTypeStore;
_session = session;
}
public async Task ExecuteAsync(RecipeExecutionContext context)
{
if (!String.Equals(context.Name, "WorkflowType", StringComparison.OrdinalIgnoreCase))
{
return;
}
var model = context.Step.ToObject<WorkflowStepModel>();
foreach (JObject token in model.Data)
{
var workflow = token.ToObject<WorkflowType>();
var existing = await _workflowTypeStore.GetAsync(workflow.WorkflowTypeId);
if (existing == null)
{
workflow.Id = 0;
}
else
{
await _workflowTypeStore.DeleteAsync(existing);
}
await _workflowTypeStore.SaveAsync(workflow);
}
}
}
public class WorkflowStepModel
{
public JArray Data { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using OrchardCore.Recipes.Models;
using OrchardCore.Recipes.Services;
using OrchardCore.Workflows.Models;
using OrchardCore.Workflows.Services;
using YesSql;
namespace OrchardCore.Workflows.Recipes
{
public class WorkflowTypeStep : IRecipeStepHandler
{
private readonly ISession _session;
private readonly IWorkflowTypeStore _workflowTypeStore;
public WorkflowTypeStep(IWorkflowTypeStore workflowTypeStore, ISession session)
{
_workflowTypeStore = workflowTypeStore;
_session = session;
}
public async Task ExecuteAsync(RecipeExecutionContext context)
{
if (!String.Equals(context.Name, "WorkflowType", StringComparison.OrdinalIgnoreCase))
{
return;
}
var model = context.Step.ToObject<WorkflowStepModel>();
foreach (JObject token in model.Data)
{
var workflow = token.ToObject<WorkflowType>();
var existing = await _workflowTypeStore.GetAsync(workflow.WorkflowTypeId);
if (existing == null)
{
workflow.Id = 0;
}
else
{
await _workflowTypeStore.DeleteAsync(workflow);
}
await _workflowTypeStore.SaveAsync(workflow);
}
}
}
public class WorkflowStepModel
{
public JArray Data { get; set; }
}
}
|
bsd-3-clause
|
C#
|
f8b430f993cb2ad9308e83b9de07d55ac5cb888d
|
Change the error message
|
jamesqo/Sirloin
|
src/Sirloin/Internal/Binding.cs
|
src/Sirloin/Internal/Binding.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Typed.Xaml;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Sirloin.Internal
{
public sealed class Binding
{
private Binding()
{
throw new InvalidOperationException("This class shouldn't be instantiated.");
}
// Content
public static DependencyProperty ContentProperty { get; } =
Dependency.RegisterAttached<string, ContentControl, Binding>("Content", OnContentChanged);
public static string GetContent(DependencyObject o) =>
o.Get<string>(ContentProperty);
public static void SetContent(DependencyObject o, string value) =>
o.Set(ContentProperty, value);
private static void OnContentChanged(ContentControl o, IPropertyChangedArgs<string> args) =>
o.BindTo(ContentControl.ContentProperty, args.NewValue);
// Height
public static DependencyProperty HeightProperty { get; } =
Dependency.RegisterAttached<string, FrameworkElement, Binding>("Height", OnHeightChanged);
public static string GetHeight(DependencyObject o) =>
o.Get<string>(HeightProperty);
public static void SetHeight(DependencyObject o, string value) =>
o.Set(HeightProperty, value);
private static void OnHeightChanged(FrameworkElement o, IPropertyChangedArgs<string> args) =>
o.BindTo(FrameworkElement.HeightProperty, args.NewValue);
// Width
public static DependencyProperty WidthProperty { get; } =
Dependency.RegisterAttached<string, FrameworkElement, Binding>("Width", OnWidthChanged);
public static string GetWidth(DependencyObject o) =>
o.Get<string>(WidthProperty);
public static void SetWidth(DependencyObject o, string value) =>
o.Set(WidthProperty, value);
private static void OnWidthChanged(FrameworkElement o, IPropertyChangedArgs<string> args) =>
o.BindTo(FrameworkElement.WidthProperty, args.NewValue);
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Typed.Xaml;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Sirloin.Internal
{
public sealed class Binding
{
private Binding()
{
Debug.Fail(@"This class shouldn't be instantiated.
Perhaps you were looking for Windows.UI.Xaml.Data.Binding?");
}
// Content
public static DependencyProperty ContentProperty { get; } =
Dependency.RegisterAttached<string, ContentControl, Binding>("Content", OnContentChanged);
public static string GetContent(DependencyObject o) =>
o.Get<string>(ContentProperty);
public static void SetContent(DependencyObject o, string value) =>
o.Set(ContentProperty, value);
private static void OnContentChanged(ContentControl o, IPropertyChangedArgs<string> args) =>
o.BindTo(ContentControl.ContentProperty, args.NewValue);
// Height
public static DependencyProperty HeightProperty { get; } =
Dependency.RegisterAttached<string, FrameworkElement, Binding>("Height", OnHeightChanged);
public static string GetHeight(DependencyObject o) =>
o.Get<string>(HeightProperty);
public static void SetHeight(DependencyObject o, string value) =>
o.Set(HeightProperty, value);
private static void OnHeightChanged(FrameworkElement o, IPropertyChangedArgs<string> args) =>
o.BindTo(FrameworkElement.HeightProperty, args.NewValue);
// Width
public static DependencyProperty WidthProperty { get; } =
Dependency.RegisterAttached<string, FrameworkElement, Binding>("Width", OnWidthChanged);
public static string GetWidth(DependencyObject o) =>
o.Get<string>(WidthProperty);
public static void SetWidth(DependencyObject o, string value) =>
o.Set(WidthProperty, value);
private static void OnWidthChanged(FrameworkElement o, IPropertyChangedArgs<string> args) =>
o.BindTo(FrameworkElement.WidthProperty, args.NewValue);
}
}
|
bsd-2-clause
|
C#
|
0ab77d0c6649de7df8c1eacc9448f3da6cb38290
|
Add single argument description
|
CrOrc/Cr.ArgParse
|
src/Cr.ArgParse/Argument.cs
|
src/Cr.ArgParse/Argument.cs
|
using System.Collections.Generic;
namespace Cr.ArgParse
{
/// <summary>
/// Single argument description
/// </summary>
public class Argument
{
/// <summary>
/// strings to identify argument. Empty for positional arguments
/// </summary>
public IList<string> OptionStrings { get; set; }
/// <summary>
/// Name for storing parsing results
/// </summary>
public string Destination { get; set; }
/// <summary>
/// Description of argument
/// </summary>
public string HelpText { get; set; }
}
}
|
namespace Cr.ArgParse
{
public class Argument
{
}
}
|
mit
|
C#
|
a5228016f5a2cc57a934f296c13e2f736281bfe4
|
test for sourcelink
|
MindMatrix/Kamen
|
src/FileSystem/Directory.cs
|
src/FileSystem/Directory.cs
|
using System.Collections.Generic;
namespace Kamen.FileSystem
{
public static class Directory
{
public static string Test(string test)
{
return test;
}
public static string FindWithParents(string basePath, string directory)
{
foreach (var path in Parents(basePath, true))
{
var parentDirectory = System.IO.Path.Combine(path, directory);
if (System.IO.Directory.Exists(parentDirectory))
return parentDirectory;
}
return null;
}
public static IEnumerable<string> Parents(string basePath, bool includeBase = false)
{
if (includeBase)
yield return basePath;
while (((basePath = System.IO.Path.GetDirectoryName(basePath)) != null))
yield return basePath;
}
}
}
|
using System.Collections.Generic;
namespace Kamen.FileSystem
{
public static class Directory
{
public static string FindWithParents(string basePath, string directory)
{
foreach (var path in Parents(basePath, true))
{
var parentDirectory = System.IO.Path.Combine(path, directory);
if (System.IO.Directory.Exists(parentDirectory))
return parentDirectory;
}
return null;
}
public static IEnumerable<string> Parents(string basePath, bool includeBase = false)
{
if (includeBase)
yield return basePath;
while (((basePath = System.IO.Path.GetDirectoryName(basePath)) != null))
yield return basePath;
}
}
}
|
mit
|
C#
|
d2e050841af5ee42039e40dda4254f227a96920b
|
Use "is" operator
|
sakapon/Samples-2017
|
ProxySample/CrossCuttingConsole/CrossCuttingProxy.cs
|
ProxySample/CrossCuttingConsole/CrossCuttingProxy.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
namespace CrossCuttingConsole
{
public class CrossCuttingProxy : RealProxy
{
public static T CreateProxy<T>() where T : MarshalByRefObject, new()
{
return (T)new CrossCuttingProxy(new T()).GetTransparentProxy();
}
public MarshalByRefObject Target { get; private set; }
// For non-ContextBoundObject.
internal CrossCuttingProxy(MarshalByRefObject target) : base(target.GetType())
{
Target = target;
}
// For ContextBoundObject.
internal CrossCuttingProxy(Type classToProxy) : base(classToProxy)
{
}
public override IMessage Invoke(IMessage msg)
{
if (msg is IMethodCallMessage methodCall)
return InvokeMethod(methodCall);
if (msg is IConstructionCallMessage constructionCall)
return InvokeConstructor(constructionCall);
throw new InvalidOperationException();
}
IMethodReturnMessage InvokeMethod(IMethodCallMessage methodCall)
{
Func<IMethodReturnMessage> baseInvoke = () => RemotingServices.ExecuteMessage(Target, methodCall);
var newInvoke = methodCall.MethodBase.GetCustomAttributes<AspectAttribute>(true)
.Reverse()
.Aggregate(baseInvoke, (f, a) => () => a.Invoke(f, Target, methodCall));
return newInvoke();
}
IConstructionReturnMessage InvokeConstructor(IConstructionCallMessage constructionCall)
{
var constructionReturn = InitializeServerObject(constructionCall);
Target = GetUnwrappedServer();
SetStubData(this, Target);
return constructionReturn;
}
}
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public abstract class AspectAttribute : Attribute
{
public abstract IMethodReturnMessage Invoke(Func<IMethodReturnMessage> baseInvoke, MarshalByRefObject target, IMethodCallMessage methodCall);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
namespace CrossCuttingConsole
{
public class CrossCuttingProxy : RealProxy
{
public static T CreateProxy<T>() where T : MarshalByRefObject, new()
{
return (T)new CrossCuttingProxy(new T()).GetTransparentProxy();
}
public MarshalByRefObject Target { get; private set; }
// For non-ContextBoundObject.
internal CrossCuttingProxy(MarshalByRefObject target) : base(target.GetType())
{
Target = target;
}
// For ContextBoundObject.
internal CrossCuttingProxy(Type classToProxy) : base(classToProxy)
{
}
public override IMessage Invoke(IMessage msg)
{
var methodCall = msg as IMethodCallMessage;
if (methodCall != null)
return InvokeMethod(methodCall);
var constructionCall = msg as IConstructionCallMessage;
if (constructionCall != null)
return InvokeConstructor(constructionCall);
throw new InvalidOperationException();
}
IMethodReturnMessage InvokeMethod(IMethodCallMessage methodCall)
{
Func<IMethodReturnMessage> baseInvoke = () => RemotingServices.ExecuteMessage(Target, methodCall);
var newInvoke = methodCall.MethodBase.GetCustomAttributes<AspectAttribute>(true)
.Reverse()
.Aggregate(baseInvoke, (f, a) => () => a.Invoke(f, Target, methodCall));
return newInvoke();
}
IConstructionReturnMessage InvokeConstructor(IConstructionCallMessage constructionCall)
{
var constructionReturn = InitializeServerObject(constructionCall);
Target = GetUnwrappedServer();
SetStubData(this, Target);
return constructionReturn;
}
}
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public abstract class AspectAttribute : Attribute
{
public abstract IMethodReturnMessage Invoke(Func<IMethodReturnMessage> baseInvoke, MarshalByRefObject target, IMethodCallMessage methodCall);
}
}
|
mit
|
C#
|
4d528c4e6703da6e93418e59f3d11db2b13e8031
|
fix VisualTests and Samples still playing
|
ppy/osu,NeoAdonis/osu,smoogipooo/osu,johnneijzen/osu,naoey/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,naoey/osu,johnneijzen/osu,DrabWeb/osu,peppy/osu,EVAST9919/osu,naoey/osu,peppy/osu,smoogipoo/osu,DrabWeb/osu,ppy/osu,EVAST9919/osu,DrabWeb/osu,ZLima12/osu,2yangk23/osu,2yangk23/osu,ZLima12/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu-new
|
osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs
|
osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using OpenTK;
using osu.Framework.Configuration;
namespace osu.Game.Graphics.Containers
{
public class OsuFocusedOverlayContainer : FocusedOverlayContainer
{
private SampleChannel samplePopIn;
private SampleChannel samplePopOut;
protected BindableBool ShowOverlays = new BindableBool(true);
[BackgroundDependencyLoader(true)]
private void load(OsuGame osuGame, AudioManager audio)
{
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
StateChanged += onStateChanged;
if (osuGame != null)
ShowOverlays.BindTo(osuGame.ShowOverlays);
}
/// <summary>
/// Whether mouse input should be blocked screen-wide while this overlay is visible.
/// Performing mouse actions outside of the valid extents will hide the overlay but pass the events through.
/// </summary>
public virtual bool BlockScreenWideMouse => BlockPassThroughMouse;
// receive input outside our bounds so we can trigger a close event on ourselves.
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceiveMouseInputAt(screenSpacePos);
protected override bool OnClick(InputState state)
{
if (!base.ReceiveMouseInputAt(state.Mouse.NativeState.Position))
{
State = Visibility.Hidden;
return true;
}
return base.OnClick(state);
}
private void onStateChanged(Visibility visibility)
{
if (!ShowOverlays)
{
State = Visibility.Hidden;
return;
}
switch (visibility)
{
case Visibility.Visible:
samplePopIn?.Play();
break;
case Visibility.Hidden:
samplePopOut?.Play();
break;
}
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using OpenTK;
using osu.Framework.Configuration;
namespace osu.Game.Graphics.Containers
{
public class OsuFocusedOverlayContainer : FocusedOverlayContainer
{
private SampleChannel samplePopIn;
private SampleChannel samplePopOut;
protected BindableBool ShowOverlays = new BindableBool();
[BackgroundDependencyLoader]
private void load(OsuGame osuGame, AudioManager audio)
{
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
StateChanged += onStateChanged;
ShowOverlays.BindTo(osuGame.ShowOverlays);
}
/// <summary>
/// Whether mouse input should be blocked screen-wide while this overlay is visible.
/// Performing mouse actions outside of the valid extents will hide the overlay but pass the events through.
/// </summary>
public virtual bool BlockScreenWideMouse => BlockPassThroughMouse;
// receive input outside our bounds so we can trigger a close event on ourselves.
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceiveMouseInputAt(screenSpacePos);
protected override bool OnClick(InputState state)
{
if (!base.ReceiveMouseInputAt(state.Mouse.NativeState.Position))
{
State = Visibility.Hidden;
return true;
}
return base.OnClick(state);
}
private void onStateChanged(Visibility visibility)
{
if (!ShowOverlays)
State = Visibility.Hidden;
switch (visibility)
{
case Visibility.Visible:
samplePopIn?.Play();
break;
case Visibility.Hidden:
samplePopOut?.Play();
break;
}
}
}
}
|
mit
|
C#
|
ef29987f362bc51c39b43af4f4d6d4ca7f721652
|
Remove FinalNotification
|
ppy/osu,ppy/osu,peppy/osu,peppy/osu,peppy/osu,ppy/osu
|
osu.Game/Online/Multiplayer/ServerShuttingDownCountdown.cs
|
osu.Game/Online/Multiplayer/ServerShuttingDownCountdown.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 MessagePack;
namespace osu.Game.Online.Multiplayer
{
/// <summary>
/// A countdown that indicates the current multiplayer server is shutting down.
/// </summary>
[MessagePackObject]
public class ServerShuttingDownCountdown : MultiplayerCountdown
{
}
}
|
// 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 MessagePack;
namespace osu.Game.Online.Multiplayer
{
/// <summary>
/// A countdown that indicates the current multiplayer server is shutting down.
/// </summary>
[MessagePackObject]
public class ServerShuttingDownCountdown : MultiplayerCountdown
{
/// <summary>
/// If this is the final notification, no more <see cref="ServerShuttingDownCountdown"/> events will be sent after this.
/// </summary>
[Key(2)]
public bool FinalNotification { get; set; }
}
}
|
mit
|
C#
|
f8278822dfd8ff88534ffe2c1fac763ccbcf0250
|
Fix category name not updated in preferences
|
mrward/monodevelop-template-creator-addin,mrward/monodevelop-template-creator-addin
|
src/MonoDevelop.TemplateCreator/MonoDevelop.Templating.Gui/TemplateCategoryWidget.cs
|
src/MonoDevelop.TemplateCreator/MonoDevelop.Templating.Gui/TemplateCategoryWidget.cs
|
//
// TemplateCategoryWidget.cs
//
// Author:
// Matt Ward <matt.ward@xamarin.com>
//
// Copyright (c) 2017 Xamarin Inc. (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Xwt;
namespace MonoDevelop.Templating.Gui
{
partial class TemplateCategoryWidget
{
TemplateCategoryViewModel category;
bool ignoreChanges;
public TemplateCategoryWidget ()
{
Build ();
idTextEntry.Changed += IdTextEntryChanged;
nameTextEntry.Changed += NameTextEntryChanged;
}
public TextEntry IdTextEntry {
get { return idTextEntry; }
}
TextEntry NameTextEntry {
get { return nameTextEntry; }
}
public TemplateCategoryViewModel Category {
get { return category; }
}
public void ClearCategory ()
{
category = null;
IdTextEntry.Text = string.Empty;
UpdateNameWithRaisingChangedEvent (string.Empty);
Sensitive = false;
}
public void DisplayCategory (TemplateCategoryViewModel category)
{
this.category = category;
IdTextEntry.Text = category.Id;
UpdateNameWithRaisingChangedEvent (category.Name);
Sensitive = true;
}
public void SetFocusToIdTextEntry ()
{
idTextEntry.SetFocus ();
}
void IdTextEntryChanged (object sender, EventArgs e)
{
if (category == null)
return;
category.Id = idTextEntry.Text;
}
void NameTextEntryChanged (object sender, EventArgs e)
{
if (category == null)
return;
category.Name = nameTextEntry.Text;
if (!ignoreChanges) {
OnNameChanged ();
}
}
public event EventHandler NameChanged;
void OnNameChanged ()
{
NameChanged?.Invoke (this, new EventArgs ());
}
void UpdateNameWithRaisingChangedEvent (string name)
{
try {
ignoreChanges = true;
NameTextEntry.Text = name;
} finally {
ignoreChanges = false;
}
}
}
}
|
//
// TemplateCategoryWidget.cs
//
// Author:
// Matt Ward <matt.ward@xamarin.com>
//
// Copyright (c) 2017 Xamarin Inc. (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Xwt;
namespace MonoDevelop.Templating.Gui
{
partial class TemplateCategoryWidget
{
TemplateCategoryViewModel category;
bool ignoreChanges;
public TemplateCategoryWidget ()
{
Build ();
idTextEntry.Changed += IdTextEntryChanged;
nameTextEntry.Changed += NameTextEntryChanged;
}
public TextEntry IdTextEntry {
get { return idTextEntry; }
}
TextEntry NameTextEntry {
get { return nameTextEntry; }
}
public TemplateCategoryViewModel Category {
get { return category; }
}
public void ClearCategory ()
{
category = null;
IdTextEntry.Text = string.Empty;
UpdateNameWithRaisingChangedEvent (string.Empty);
Sensitive = false;
}
public void DisplayCategory (TemplateCategoryViewModel category)
{
this.category = category;
IdTextEntry.Text = category.Category.Id;
UpdateNameWithRaisingChangedEvent (category.Category.Name);
Sensitive = true;
}
public void SetFocusToIdTextEntry ()
{
idTextEntry.SetFocus ();
}
void IdTextEntryChanged (object sender, EventArgs e)
{
if (category == null)
return;
category.Id = idTextEntry.Text;
}
void NameTextEntryChanged (object sender, EventArgs e)
{
if (category == null)
return;
category.Name = nameTextEntry.Text;
if (!ignoreChanges) {
OnNameChanged ();
}
}
public event EventHandler NameChanged;
void OnNameChanged ()
{
NameChanged?.Invoke (this, new EventArgs ());
}
void UpdateNameWithRaisingChangedEvent (string name)
{
try {
ignoreChanges = true;
NameTextEntry.Text = name;
} finally {
ignoreChanges = false;
}
}
}
}
|
mit
|
C#
|
5a1848df167a2f8d407da6dcffd4f6e26eb3c094
|
Implement IFeedSource abstraction layer
|
gahcep/App.Refoveo
|
App.Refoveo/Abstractions/IFeedSource.cs
|
App.Refoveo/Abstractions/IFeedSource.cs
|
using System.IO;
using App.Refoveo.Shared;
namespace App.Refoveo.Abstractions
{
public interface IFeedSource
{
/* Returns its FeedSource type */
FeedSourceType IdentifyItself();
/* Returns appcast.xml contents */
string AppcastAsString();
MemoryStream AppcastAsStream();
/* Returns appversion.xml */
string AppversionAsString();
MemoryStream AppversionAsStream();
/* Sets whether compression is used or not */
void CompressionUsed(bool forAppcast, bool forAppversion);
}
}
|
namespace App.Refoveo.Abstractions
{
public interface IFeedSource
{
}
}
|
mit
|
C#
|
2dca80223b69914018f89ab64ec44d1328e74314
|
Add more cardinal directions
|
martincostello/adventofcode,martincostello/adventofcode,martincostello/adventofcode,martincostello/adventofcode
|
src/AdventOfCode/CardinalDirection.cs
|
src/AdventOfCode/CardinalDirection.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.AdventOfCode
{
/// <summary>
/// An enumeration of cardinal directions.
/// </summary>
public enum CardinalDirection
{
/// <summary>
/// North.
/// </summary>
North,
/// <summary>
/// North East.
/// </summary>
NorthEast,
/// <summary>
/// North West.
/// </summary>
NorthWest,
/// <summary>
/// South.
/// </summary>
South,
/// <summary>
/// South East.
/// </summary>
SouthEast,
/// <summary>
/// South West.
/// </summary>
SouthWest,
/// <summary>
/// East.
/// </summary>
East,
/// <summary>
/// West.
/// </summary>
West,
}
}
|
// 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.AdventOfCode
{
/// <summary>
/// An enumeration of cardinal directions.
/// </summary>
public enum CardinalDirection
{
/// <summary>
/// North.
/// </summary>
North,
/// <summary>
/// South.
/// </summary>
South,
/// <summary>
/// East.
/// </summary>
East,
/// <summary>
/// West.
/// </summary>
West,
}
}
|
apache-2.0
|
C#
|
aa83fbbe215ac3c0d1c27f974db7d331e2d04d83
|
Fix Matt in name space
|
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
|
src/Firehose.Web/Authors/MattBobke.cs
|
src/Firehose.Web/Authors/MattBobke.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MattBobke : IAmACommunityMember, IFilterMyBlogPosts
{
public string FirstName => "Matt";
public string LastName => "Bobke";
public string ShortBioOrTagLine => "Desktop Support Specialist with admninistrative tendencies excited about PowerShell and automation.";
public string StateOrRegion => "California, United States";
public string GravatarHash => "6f38a96cd055f95eacd1d3d102e309fa";
public string EmailAddress => "matt@mattbobke.com";
public string TwitterHandle => "MattBobke";
public string GitHubHandle => "mcbobke";
public GeoPosition Position => new GeoPosition(33.5676842, -117.7256083);
public Uri WebSite => new Uri("https://mattbobke.com");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://mattbobke.com/feed"); } }
public bool Filter(SyndicationItem item)
{
// This filters out only the posts that have the "PowerShell" category
return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell"));
}
public string FeedLanguageCode => "en";
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
public class MattBobke : IAmACommunityMember, IFilterMyBlogPosts
{
public string FirstName => "Matt";
public string LastName => "Bobke";
public string ShortBioOrTagLine => "Desktop Support Specialist with admninistrative tendencies excited about PowerShell and automation.";
public string StateOrRegion => "California, United States";
public string GravatarHash => "6f38a96cd055f95eacd1d3d102e309fa";
public string EmailAddress => "matt@mattbobke.com";
public string TwitterHandle => "MattBobke";
public string GitHubHandle => "mcbobke";
public GeoPosition Position => new GeoPosition(33.5676842, -117.7256083);
public Uri WebSite => new Uri("https://mattbobke.com");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://mattbobke.com/feed"); } }
public bool Filter(SyndicationItem item)
{
// This filters out only the posts that have the "PowerShell" category
return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell"));
}
public string FeedLanguageCode => "en";
}
|
mit
|
C#
|
a8103eed024d191833711d3955ef65f32a2b6f9a
|
Change static method to private
|
kendaleiv/silverpop-dotnet-api,kendaleiv/silverpop-dotnet-api,billboga/silverpop-dotnet-api,ritterim/silverpop-dotnet-api
|
src/Silverpop.Core/TransactMessage.cs
|
src/Silverpop.Core/TransactMessage.cs
|
using Silverpop.Core.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Silverpop.Core
{
public class TransactMessage
{
public TransactMessage()
{
SaveColumns = new List<string>();
Recipients = new List<TransactMessageRecipient>();
}
public string CampaignId { get; set; }
public string TransactionId { get; set; }
public bool ShowAllSendDetail { get; set; }
public bool SendAsBatch { get; set; }
public bool NoRetryOnFailure { get; set; }
public ICollection<string> SaveColumns { get; set; }
public ICollection<TransactMessageRecipient> Recipients { get; set; }
public IEnumerable<TransactMessage> GetRecipientBatchedMessages(int maxRecipientsPerMessage)
{
if (maxRecipientsPerMessage <= 0)
throw new ArgumentOutOfRangeException("maxRecipientsPerMessage");
var messages = new List<TransactMessage>();
foreach (var recipientsBatch in this.Recipients.Batch(maxRecipientsPerMessage))
{
var batchMessage = CloneWithoutRecipients(this);
batchMessage.Recipients = recipientsBatch.ToList();
messages.Add(batchMessage);
}
return messages;
}
/// <remarks>
/// I'm not a huge fan of this manual cloning.
/// However, I'm choosing this over taking a dependency on a mapper
/// or performing a deep clone that includes the Recipients collection unnecessarily.
/// </remarks>
private static TransactMessage CloneWithoutRecipients(TransactMessage message)
{
return new TransactMessage()
{
CampaignId = message.CampaignId,
TransactionId = message.TransactionId,
ShowAllSendDetail = message.ShowAllSendDetail,
SendAsBatch = message.SendAsBatch,
NoRetryOnFailure = message.NoRetryOnFailure,
SaveColumns = message.SaveColumns,
};
}
}
}
|
using Silverpop.Core.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Silverpop.Core
{
public class TransactMessage
{
public TransactMessage()
{
SaveColumns = new List<string>();
Recipients = new List<TransactMessageRecipient>();
}
public string CampaignId { get; set; }
public string TransactionId { get; set; }
public bool ShowAllSendDetail { get; set; }
public bool SendAsBatch { get; set; }
public bool NoRetryOnFailure { get; set; }
public ICollection<string> SaveColumns { get; set; }
public ICollection<TransactMessageRecipient> Recipients { get; set; }
public IEnumerable<TransactMessage> GetRecipientBatchedMessages(int maxRecipientsPerMessage)
{
if (maxRecipientsPerMessage <= 0)
throw new ArgumentOutOfRangeException("maxRecipientsPerMessage");
var messages = new List<TransactMessage>();
foreach (var recipientsBatch in this.Recipients.Batch(maxRecipientsPerMessage))
{
var batchMessage = CloneWithoutRecipients(this);
batchMessage.Recipients = recipientsBatch.ToList();
messages.Add(batchMessage);
}
return messages;
}
/// <remarks>
/// I'm not a huge fan of this manual cloning.
/// However, I'm choosing this over taking a dependency on a mapper
/// or performing a deep clone that includes the Recipients collection unnecessarily.
/// </remarks>
public static TransactMessage CloneWithoutRecipients(TransactMessage message)
{
return new TransactMessage()
{
CampaignId = message.CampaignId,
TransactionId = message.TransactionId,
ShowAllSendDetail = message.ShowAllSendDetail,
SendAsBatch = message.SendAsBatch,
NoRetryOnFailure = message.NoRetryOnFailure,
SaveColumns = message.SaveColumns,
};
}
}
}
|
mit
|
C#
|
590c370ac4b03ef412f8369f9571e50a33bb44a0
|
remove unessesary using and comments
|
ivayloivanof/C-Sharp-Chat-Programm
|
Client/ChatClient/ChatClient/Program.cs
|
Client/ChatClient/ChatClient/Program.cs
|
namespace ChatClient
{
using System;
using System.Windows.Forms;
public static class Program
{
[STAThread]
public static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMainWindow());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ChatClient
{
static class Program
{
/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMainWindow());
}
}
}
|
unlicense
|
C#
|
32fb3d41783fc8302d98b2e1fc577531cdc4151b
|
Rename DetectedStartCommand -> StartCommand for clarity
|
stefanschneider/windows_app_lifecycle,cloudfoundry/windows_app_lifecycle,cloudfoundry-incubator/windows_app_lifecycle
|
Launcher/Program.cs
|
Launcher/Program.cs
|
using System;
using System.Diagnostics;
using Newtonsoft.Json;
namespace Launcher
{
public class ExecutionMetadata
{
[JsonProperty("start_command")]
public string StartCommand { get; set; }
[JsonProperty("start_command_args")]
public string[] StartCommandArgs { get; set; }
}
internal class Program
{
private static int Main(string[] args)
{
if (Environment.GetEnvironmentVariable("ARGJSON") != null && Environment.GetEnvironmentVariable("ARGJSON").Length >= 2)
args = JsonConvert.DeserializeObject<string[]>(Environment.GetEnvironmentVariable("ARGJSON"));
if (args.Length < 3)
{
Console.Error.WriteLine("Launcher was run with insufficient arguments. The arguments were: {0}",
String.Join(" ", args));
return 1;
}
ExecutionMetadata executionMetadata = null;
try
{
executionMetadata = JsonConvert.DeserializeObject<ExecutionMetadata>(args[2]);
}
catch (Exception)
{
Console.Error.WriteLine(
"Launcher was run with invalid JSON for the metadata argument. The JSON was: {0}", args[2]);
return 1;
}
Console.Out.WriteLine("Run {0} :: {1}", executionMetadata.StartCommand,
ArgumentEscaper.Escape(executionMetadata.StartCommandArgs));
var startInfo = new ProcessStartInfo
{
UseShellExecute = false,
FileName = executionMetadata.StartCommand,
Arguments = ArgumentEscaper.Escape(executionMetadata.StartCommandArgs)
};
Console.Out.WriteLine("Run {0} :with: {1}", startInfo.FileName, startInfo.Arguments);
var process = Process.Start(startInfo);
process.WaitForExit();
return process.ExitCode;
}
}
}
|
using System;
using System.Diagnostics;
using Newtonsoft.Json;
namespace Launcher
{
public class ExecutionMetadata
{
[JsonProperty("start_command")]
public string DetectedStartCommand { get; set; }
[JsonProperty("start_command_args")]
public string[] StartCommandArgs { get; set; }
}
internal class Program
{
private static int Main(string[] args)
{
if (Environment.GetEnvironmentVariable("ARGJSON") != null && Environment.GetEnvironmentVariable("ARGJSON").Length >= 2)
args = JsonConvert.DeserializeObject<string[]>(Environment.GetEnvironmentVariable("ARGJSON"));
if (args.Length < 3)
{
Console.Error.WriteLine("Launcher was run with insufficient arguments. The arguments were: {0}",
String.Join(" ", args));
return 1;
}
ExecutionMetadata executionMetadata = null;
try
{
executionMetadata = JsonConvert.DeserializeObject<ExecutionMetadata>(args[2]);
}
catch (Exception)
{
Console.Error.WriteLine(
"Launcher was run with invalid JSON for the metadata argument. The JSON was: {0}", args[2]);
return 1;
}
Console.Out.WriteLine("Run {0} :: {1}", executionMetadata.DetectedStartCommand,
ArgumentEscaper.Escape(executionMetadata.StartCommandArgs));
var startInfo = new ProcessStartInfo
{
UseShellExecute = false,
FileName = executionMetadata.DetectedStartCommand,
Arguments = ArgumentEscaper.Escape(executionMetadata.StartCommandArgs)
};
Console.Out.WriteLine("Run {0} :with: {1}", startInfo.FileName, startInfo.Arguments);
var process = Process.Start(startInfo);
process.WaitForExit();
return process.ExitCode;
}
}
}
|
apache-2.0
|
C#
|
9ed76fef033d459abf46e1bc23da3b0521fb2ded
|
Initialize ConsoleProgressBar with a writer
|
appharbor/appharbor-cli
|
src/AppHarbor/ConsoleProgressBar.cs
|
src/AppHarbor/ConsoleProgressBar.cs
|
using System.IO;
namespace AppHarbor
{
public class ConsoleProgressBar
{
private readonly TextWriter _writer;
public ConsoleProgressBar(TextWriter writer)
{
_writer = writer;
}
}
}
|
namespace AppHarbor
{
public class ConsoleProgressBar
{
}
}
|
mit
|
C#
|
b43afc13f588f41dfb9e30182605a9fbbc75bbe2
|
Fix type name in Generate doc example
|
morelinq/MoreLINQ,ddpruitt/morelinq,morelinq/MoreLINQ,fsateler/MoreLINQ,ddpruitt/morelinq,fsateler/MoreLINQ
|
MoreLinq/Generate.cs
|
MoreLinq/Generate.cs
|
#region License and Terms
// MoreLINQ - Extensions to LINQ to Objects
// Copyright (c) 2009 Chris Ammerman. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
namespace MoreLinq
{
using System;
using System.Collections.Generic;
static partial class MoreEnumerable
{
/// <summary>
/// Returns a sequence of values consecutively generated by a generator function.
/// </summary>
/// <typeparam name="TResult">Type of elements to generate.</typeparam>
/// <param name="initial">Value of first element in sequence</param>
/// <param name="generator">
/// Generator function which takes the previous series element and uses it to generate the next element.
/// </param>
/// <returns>A sequence containing the generated values.</returns>
/// <remarks>
/// This function defers element generation until needed and streams the results.
/// </remarks>
/// <example>
/// <code>
/// IEnumerable<int> result = MoreEnumerable.Generate(2, n => n * n).Take(5);
/// </code>
/// The <c>result</c> variable, when iterated over, will yield 2, 4, 16, 256, and 65536, in turn.
/// </example>
public static IEnumerable<TResult> Generate<TResult>(TResult initial, Func<TResult, TResult> generator)
{
if (generator == null) throw new ArgumentNullException(nameof(generator));
return _(); IEnumerable<TResult> _()
{
var current = initial;
while (true)
{
yield return current;
current = generator(current);
}
}
}
}
}
|
#region License and Terms
// MoreLINQ - Extensions to LINQ to Objects
// Copyright (c) 2009 Chris Ammerman. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
namespace MoreLinq
{
using System;
using System.Collections.Generic;
static partial class MoreEnumerable
{
/// <summary>
/// Returns a sequence of values consecutively generated by a generator function.
/// </summary>
/// <typeparam name="TResult">Type of elements to generate.</typeparam>
/// <param name="initial">Value of first element in sequence</param>
/// <param name="generator">
/// Generator function which takes the previous series element and uses it to generate the next element.
/// </param>
/// <returns>A sequence containing the generated values.</returns>
/// <remarks>
/// This function defers element generation until needed and streams the results.
/// </remarks>
/// <example>
/// <code>
/// IEnumerable<int> result = Sequence.Generate(2, n => n * n).Take(5);
/// </code>
/// The <c>result</c> variable, when iterated over, will yield 2, 4, 16, 256, and 65536, in turn.
/// </example>
public static IEnumerable<TResult> Generate<TResult>(TResult initial, Func<TResult, TResult> generator)
{
if (generator == null) throw new ArgumentNullException(nameof(generator));
return _(); IEnumerable<TResult> _()
{
var current = initial;
while (true)
{
yield return current;
current = generator(current);
}
}
}
}
}
|
apache-2.0
|
C#
|
3e8b9d89ae62e117a7dd312bce0dcaaf2874c971
|
remove space
|
lderache/LeTruck,lderache/LeTruck,lderache/LeTruck
|
src/mvc5/TheTruck.Web/Views/Home/Index.cshtml
|
src/mvc5/TheTruck.Web/Views/Home/Index.cshtml
|
@{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<img src="/images/letruck_logo.png" width="250" style="float:right" />
<h1>LE TRUCK</h1>
<p class="lead">Le Truck is a new delivery service that gives you access to all the products you love back home!</p>
<p><a href="/ProductListing" class="btn btn-primary btn-lg">See our products »</a></p>
</div>
|
@{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<img src="/images/letruck_logo.png" width="250px" style="float:right" />
<h1>LE TRUCK</h1>
<br />
<br />
<p class="lead">Le Truck is a new delivery service that gives you access to all the products you love back home!</p>
<p><a href="/ProductListing" class="btn btn-primary btn-lg">See our products »</a></p>
</div>
|
mit
|
C#
|
ad2f6ceb7f67e1a5305758e37f256ebdb7869338
|
Indent code and remove HMAC string
|
ZixiangBoy/dnlib,picrap/dnlib,ilkerhalil/dnlib,modulexcite/dnlib,kiootic/dnlib,Arthur2e5/dnlib,yck1509/dnlib,jorik041/dnlib,0xd4d/dnlib
|
src/DotNet/AssemblyHashAlgorithm.cs
|
src/DotNet/AssemblyHashAlgorithm.cs
|
namespace dot10.DotNet {
/// <summary>
/// Any ALG_CLASS_HASH type in WinCrypt.h can be used by Microsoft's CLI implementation
/// </summary>
public enum AssemblyHashAlgorithm : uint {
/// <summary/>
None = 0,
/// <summary/>
MD2 = 0x8001,
/// <summary/>
MD4 = 0x8002,
/// <summary>This is a reserved value in the CLI</summary>
MD5 = 0x8003,
/// <summary>The only algorithm supported by the CLI</summary>
SHA1 = 0x8004,
/// <summary/>
MAC = 0x8005,
/// <summary/>
SSL3_SHAMD5 = 0x8008,
/// <summary/>
HMAC = 0x8009,
/// <summary/>
TLS1PRF = 0x800A,
/// <summary/>
HASH_REPLACE_OWF = 0x800B,
/// <summary/>
SHA_256 = 0x800C,
/// <summary/>
SHA_384 = 0x800D,
/// <summary/>
SHA_512 = 0x800E,
}
static partial class Extensions {
internal static string GetName(this AssemblyHashAlgorithm hashAlg) {
switch (hashAlg) {
case AssemblyHashAlgorithm.MD2: return null;
case AssemblyHashAlgorithm.MD4: return null;
case AssemblyHashAlgorithm.MD5: return "MD5";
case AssemblyHashAlgorithm.SHA1: return "SHA1";
case AssemblyHashAlgorithm.MAC: return null;
case AssemblyHashAlgorithm.SSL3_SHAMD5: return null;
case AssemblyHashAlgorithm.HMAC: return null;
case AssemblyHashAlgorithm.TLS1PRF: return null;
case AssemblyHashAlgorithm.HASH_REPLACE_OWF: return null;
case AssemblyHashAlgorithm.SHA_256: return "SHA256";
case AssemblyHashAlgorithm.SHA_384: return "SHA384";
case AssemblyHashAlgorithm.SHA_512: return "SHA512";
default: return null;
}
}
}
}
|
namespace dot10.DotNet {
/// <summary>
/// Any ALG_CLASS_HASH type in WinCrypt.h can be used by Microsoft's CLI implementation
/// </summary>
public enum AssemblyHashAlgorithm : uint {
/// <summary/>
None = 0,
/// <summary/>
MD2 = 0x8001,
/// <summary/>
MD4 = 0x8002,
/// <summary>This is a reserved value in the CLI</summary>
MD5 = 0x8003,
/// <summary>The only algorithm supported by the CLI</summary>
SHA1 = 0x8004,
/// <summary/>
MAC = 0x8005,
/// <summary/>
SSL3_SHAMD5 = 0x8008,
/// <summary/>
HMAC = 0x8009,
/// <summary/>
TLS1PRF = 0x800A,
/// <summary/>
HASH_REPLACE_OWF = 0x800B,
/// <summary/>
SHA_256 = 0x800C,
/// <summary/>
SHA_384 = 0x800D,
/// <summary/>
SHA_512 = 0x800E,
}
static partial class Extensions {
internal static string GetName(this AssemblyHashAlgorithm hashAlg) {
switch (hashAlg) {
case AssemblyHashAlgorithm.MD2: return null;
case AssemblyHashAlgorithm.MD4: return null;
case AssemblyHashAlgorithm.MD5: return "MD5";
case AssemblyHashAlgorithm.SHA1: return "SHA1";
case AssemblyHashAlgorithm.MAC: return null;
case AssemblyHashAlgorithm.SSL3_SHAMD5: return null;
case AssemblyHashAlgorithm.HMAC: return "HMAC";
case AssemblyHashAlgorithm.TLS1PRF: return null;
case AssemblyHashAlgorithm.HASH_REPLACE_OWF: return null;
case AssemblyHashAlgorithm.SHA_256: return "SHA256";
case AssemblyHashAlgorithm.SHA_384: return "SHA384";
case AssemblyHashAlgorithm.SHA_512: return "SHA512";
default: return null;
}
}
}
}
|
mit
|
C#
|
d3e8e279c11e7804cb2f1004bbc22f936953135b
|
Fix typo
|
halcwb/FSharp.Formatting,mktange/FSharp.Formatting,modulexcite/FSharp.Formatting,halcwb/FSharp.Formatting,modulexcite/FSharp.Formatting,halcwb/FSharp.Formatting,Rickasaurus/FSharp.Formatting,modulexcite/FSharp.Formatting,theprash/FSharp.Formatting,tpetricek/FSharp.Formatting,halcwb/FSharp.Formatting,tpetricek/FSharp.Formatting,halcwb/FSharp.Formatting,theprash/FSharp.Formatting,modulexcite/FSharp.Formatting,tpetricek/FSharp.Formatting,halcwb/FSharp.Formatting,tpetricek/FSharp.Formatting,ademar/FSharp.Formatting,mktange/FSharp.Formatting,tpetricek/FSharp.Formatting,mktange/FSharp.Formatting,ademar/FSharp.Formatting,Rickasaurus/FSharp.Formatting,theprash/FSharp.Formatting,Rickasaurus/FSharp.Formatting,Rickasaurus/FSharp.Formatting,mktange/FSharp.Formatting,Rickasaurus/FSharp.Formatting,Rickasaurus/FSharp.Formatting,mktange/FSharp.Formatting,modulexcite/FSharp.Formatting,ademar/FSharp.Formatting,modulexcite/FSharp.Formatting,theprash/FSharp.Formatting,ademar/FSharp.Formatting,mktange/FSharp.Formatting,theprash/FSharp.Formatting,ademar/FSharp.Formatting,theprash/FSharp.Formatting,tpetricek/FSharp.Formatting,ademar/FSharp.Formatting
|
misc/templates/reference/type.cshtml
|
misc/templates/reference/type.cshtml
|
@using FSharp.MetadataFormat
@{
Layout = "template";
Title = Model.Type.Name + " - " + Properties["project-name"];
}
@{
var members = (IEnumerable<Member>)Model.Type.AllMembers;
var comment = (Comment)Model.Type.Comment;
var byCategory =
members.GroupBy(m => m.Category).OrderBy(g => String.IsNullOrEmpty(g.Key) ? "ZZZ" : g.Key)
.Select((g, n) => new { Index = n, GroupKey = g.Key, Members = g.OrderBy(m => m.Name), Name = String.IsNullOrEmpty(g.Key) ? "Other type members" : g.Key });
}
<h1>@Model.Type.Name</h1>
<div class="xmldoc">
@foreach (var sec in comment.Sections) {
if (!byCategory.Any(g => g.GroupKey == sec.Key)) {
if (sec.Key != "<default>") {
<h2>@sec.Key</h2>
}
@sec.Value
}
}
</div>
@if (byCategory.Count() > 1)
{
<h2>Table of contents</h2>
<ul>
@foreach (var g in byCategory)
{
<li><a href="@("#section" + g.Index.ToString())">@g.Name</a></li>
}
</ul>
}
@foreach (var g in byCategory) {
if (byCategory.Count() > 1) {
<h2>@g.Name<a name="@("section" + g.Index.ToString())"> </a></h2>
var info = comment.Sections.FirstOrDefault(kvp => kvp.Key == g.GroupKey);
if (info.Key != null) {
<div class="xmldoc">
@info.Value
</div>
}
}
@RenderPart("members", new {
Header = "Union Cases",
TableHeader = "Union Case",
Members = Model.Type.UnionCases
})
@RenderPart("members", new {
Header = "Record Fields",
TableHeader = "Record Field",
Members = Model.Type.RecordFields
})
@RenderPart("members", new {
Header = "Constructors",
TableHeader = "Constructor",
Members = g.Members.Where(m => m.Kind == MemberKind.Constructor)
})
@RenderPart("members", new {
Header = "Instance members",
TableHeader = "Instance member",
Members = g.Members.Where(m => m.Kind == MemberKind.InstanceMember)
})
@RenderPart("members", new {
Header = "Static members",
TableHeader = "Static member",
Members = g.Members.Where(m => m.Kind == MemberKind.StaticMember)
})
}
|
@using FSharp.MetadataFormat
@{
Layout = "template";
Title = Model.Type.Name + " - " + Properties["project-name"];
}
@{
var members = (IEnumerable<Member>)Model.Type.AllMembers;
var comment = (Comment)Model.Type.Comment;
var byCategory =
members.GroupBy(m => m.Category).OrderBy(g => String.IsNullOrEmpty(g.Key) ? "ZZZ" : g.Key)
.Select((g, n) => new { Index = n, GroupKey = g.Key, Members = g.OrderBy(m => m.Name), Name = String.IsNullOrEmpty(g.Key) ? "Other type members" : g.Key });
}
<h1>@Model.Type.Name</h1>
<div class="xmldoc">
@foreach (var sec in comment.Sections) {
if (!byCategory.Any(g => g.GroupKey == sec.Key)) {
if (sec.Key != "<default>") {
<h2>@sec.Key</h2>
}
@sec.Value
}
}
</div>
@if (byCategory.Count() > 1)
{
<h2>Table of contents</h2>
<ul>
@foreach (var g in byCategory)
{
<li><a href="@("#section" + g.Index.ToString())">@g.Name</a></li>
}
</ul>
}
@foreach (var g in byCategory) {
if (byCategory.Count() > 1) {
<h2>@g.Name<a name="@("section" + g.Index.ToString())"> </a></h2>
var info = comment.Sections.FirstOrDefault(kvp => kvp.Key == g.GroupKey);
if (info.Key != null) {
<div class="xmldoc">
@info.Value
</div>
}
}
@RenderPart("members", new {
Header = "Union Cases",
TableHeader = "Union Case",
Members = Model.Type.UnionCases
})
@RenderPart("members", new {
Header = "Record Fields",
TableHeader = "Record Fieldr",
Members = Model.Type.RecordFields
})
@RenderPart("members", new {
Header = "Constructors",
TableHeader = "Constructor",
Members = g.Members.Where(m => m.Kind == MemberKind.Constructor)
})
@RenderPart("members", new {
Header = "Instance members",
TableHeader = "Instance member",
Members = g.Members.Where(m => m.Kind == MemberKind.InstanceMember)
})
@RenderPart("members", new {
Header = "Static members",
TableHeader = "Static member",
Members = g.Members.Where(m => m.Kind == MemberKind.StaticMember)
})
}
|
apache-2.0
|
C#
|
d79f1fb27149e4c8ed9488431e2fd3d05c2e63fa
|
Add VNDB as possible search site
|
IvionSauce/MeidoBot
|
WebSearches/Site.cs
|
WebSearches/Site.cs
|
using System;
using IvionWebSoft;
public class Site
{
public readonly Uri SiteUrl;
public readonly int DisplayMax;
public string GoogleSiteDeclaration
{
get { return "site:" + SiteUrl.Host; }
}
public static readonly Site None;
public static readonly Site YouTube;
public static readonly Site MyAnimeList;
public static readonly Site AniDb;
public static readonly Site MangaUpdates;
public static readonly Site VnDb;
static Site()
{
None = new Site();
YouTube = new Site("https://www.youtube.com/", 3);
MyAnimeList = new Site("http://myanimelist.net/", 2);
AniDb = new Site("https://anidb.net/", 2);
MangaUpdates = new Site("https://www.mangaupdates.com/", 2);
VnDb = new Site("https://vndb.org/", 2);
}
Site(string url, int displayMax) : this(new Uri(url), displayMax) {}
public Site(Uri url, int displayMax)
{
SiteUrl = url;
DisplayMax = displayMax;
}
public Site()
{
SiteUrl = null;
DisplayMax = 3;
}
public SearchResults Search(string searchQuery)
{
string finalQuery;
if (SiteUrl == null)
finalQuery = searchQuery;
else
finalQuery = GoogleSiteDeclaration + " " + searchQuery;
return GoogleTools.Search(finalQuery);
}
}
|
using System;
using IvionWebSoft;
public class Site
{
public readonly Uri SiteUrl;
public readonly int DisplayMax;
public string GoogleSiteDeclaration
{
get { return "site:" + SiteUrl.Host; }
}
public static readonly Site None;
public static readonly Site YouTube;
public static readonly Site MyAnimeList;
public static readonly Site AniDb;
public static readonly Site MangaUpdates;
static Site()
{
None = new Site();
YouTube = new Site("https://www.youtube.com/", 3);
MyAnimeList = new Site("http://myanimelist.net/", 2);
AniDb = new Site("https://anidb.net/", 2);
MangaUpdates = new Site("https://www.mangaupdates.com/", 2);
}
Site(string url, int displayMax) : this(new Uri(url), displayMax) {}
public Site(Uri url, int displayMax)
{
SiteUrl = url;
DisplayMax = displayMax;
}
public Site()
{
SiteUrl = null;
DisplayMax = 3;
}
public SearchResults Search(string searchQuery)
{
string finalQuery;
if (SiteUrl == null)
finalQuery = searchQuery;
else
finalQuery = GoogleSiteDeclaration + " " + searchQuery;
return GoogleTools.Search(finalQuery);
}
}
|
bsd-2-clause
|
C#
|
90a238cd9b8d5899ef75e077330e431f76534ffa
|
Add MethodCall match rule last to avoid feedback loop
|
openmedicus/dbus-sharp,arfbtwn/dbus-sharp,mono/dbus-sharp,mono/dbus-sharp,arfbtwn/dbus-sharp,openmedicus/dbus-sharp,Tragetaschen/dbus-sharp,Tragetaschen/dbus-sharp
|
tools/Monitor.cs
|
tools/Monitor.cs
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.Collections.Generic;
using NDesk.DBus;
using org.freedesktop.DBus;
public class Monitor
{
public static void Main (string[] args)
{
Connection bus;
if (args.Length >= 1) {
string arg = args[0];
switch (arg)
{
case "--system":
bus = Bus.System;
break;
case "--session":
bus = Bus.Session;
break;
default:
Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]");
Console.Error.WriteLine (" If no watch expressions are provided, defaults will be used.");
return;
}
} else {
bus = Bus.Session;
}
if (args.Length > 1) {
//install custom match rules only
for (int i = 1 ; i != args.Length ; i++)
bus.AddMatch (args[i]);
} else {
//no custom match rules, install the defaults
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall));
}
while (true) {
Message msg = bus.ReadMessage ();
PrintMessage (msg);
Console.WriteLine ();
}
}
public static void PrintMessage (Message msg)
{
Console.WriteLine ("Message:");
//Console.WriteLine ("\t" + "Endianness: " + msg.Header.Endianness);
Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType);
Console.WriteLine ("\t" + "Flags: " + msg.Header.Flags);
//Console.WriteLine ("\t" + "MajorVersion: " + msg.Header.MajorVersion);
Console.WriteLine ("\t" + "Serial: " + msg.Header.Serial);
//foreach (HeaderField hf in msg.HeaderFields)
// Console.WriteLine ("\t" + hf.Code + ": " + hf.Value);
Console.WriteLine ("\tHeader Fields:");
foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields)
Console.WriteLine ("\t\t" + field.Key + ": " + field.Value);
if (msg.Body != null) {
Console.WriteLine ("\tBody:");
MessageReader reader = new MessageReader (msg);
//TODO: this needs to be done more intelligently
try {
foreach (DType dtype in msg.Signature.GetBuffer ()) {
if (dtype == DType.Invalid)
continue;
object arg;
reader.GetValue (dtype, out arg);
Console.WriteLine ("\t\t" + dtype + ": " + arg);
}
} catch {
Console.WriteLine ("\t\tmonitor is too dumb to decode message body");
}
}
}
}
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.Collections.Generic;
using NDesk.DBus;
using org.freedesktop.DBus;
public class Monitor
{
public static void Main (string[] args)
{
Connection bus;
if (args.Length >= 1) {
string arg = args[0];
switch (arg)
{
case "--system":
bus = Bus.System;
break;
case "--session":
bus = Bus.Session;
break;
default:
Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]");
Console.Error.WriteLine (" If no watch expressions are provided, defaults will be used.");
return;
}
} else {
bus = Bus.Session;
}
if (args.Length > 1) {
//install custom match rules only
for (int i = 1 ; i != args.Length ; i++)
bus.AddMatch (args[i]);
} else {
//no custom match rules, install the defaults
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error));
}
while (true) {
Message msg = bus.ReadMessage ();
PrintMessage (msg);
Console.WriteLine ();
}
}
public static void PrintMessage (Message msg)
{
Console.WriteLine ("Message:");
//Console.WriteLine ("\t" + "Endianness: " + msg.Header.Endianness);
Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType);
Console.WriteLine ("\t" + "Flags: " + msg.Header.Flags);
//Console.WriteLine ("\t" + "MajorVersion: " + msg.Header.MajorVersion);
Console.WriteLine ("\t" + "Serial: " + msg.Header.Serial);
//foreach (HeaderField hf in msg.HeaderFields)
// Console.WriteLine ("\t" + hf.Code + ": " + hf.Value);
Console.WriteLine ("\tHeader Fields:");
foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields)
Console.WriteLine ("\t\t" + field.Key + ": " + field.Value);
if (msg.Body != null) {
Console.WriteLine ("\tBody:");
MessageReader reader = new MessageReader (msg);
//TODO: this needs to be done more intelligently
try {
foreach (DType dtype in msg.Signature.GetBuffer ()) {
if (dtype == DType.Invalid)
continue;
object arg;
reader.GetValue (dtype, out arg);
Console.WriteLine ("\t\t" + dtype + ": " + arg);
}
} catch {
Console.WriteLine ("\t\tmonitor is too dumb to decode message body");
}
}
}
}
|
mit
|
C#
|
cd6fdcf0290a108e24a3bcb792095b6990a3c25a
|
Rename spinnerRotationRatio -> baseHitMultiplier.
|
2yangk23/osu,UselessToucan/osu,UselessToucan/osu,naoey/osu,DrabWeb/osu,DrabWeb/osu,Frontear/osuKyzer,johnneijzen/osu,UselessToucan/osu,tacchinotacchi/osu,naoey/osu,peppy/osu,smoogipoo/osu,ZLima12/osu,peppy/osu-new,Nabile-Rahmani/osu,NeoAdonis/osu,osu-RP/osu-RP,peppy/osu,ppy/osu,smoogipoo/osu,naoey/osu,Damnae/osu,nyaamara/osu,RedNesto/osu,ppy/osu,smoogipooo/osu,2yangk23/osu,ZLima12/osu,smoogipoo/osu,Drezi126/osu,DrabWeb/osu,EVAST9919/osu,ppy/osu,johnneijzen/osu,NeoAdonis/osu,EVAST9919/osu,peppy/osu,NeoAdonis/osu
|
osu.Game.Modes.Taiko/Objects/Swell.cs
|
osu.Game.Modes.Taiko/Objects/Swell.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.Game.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Modes.Objects.Types;
namespace osu.Game.Modes.Taiko.Objects
{
public class Swell : TaikoHitObject, IHasEndTime
{
public double EndTime { get; set; }
public double Duration => EndTime - StartTime;
/// <summary>
/// The multiplier for cases in which the number of required hits by a Swell is not
/// dependent on solely the overall difficulty and the duration of the swell.
/// </summary>
public double HitMultiplier { get; set; } = 1;
/// <summary>
/// The number of hits required to complete the swell successfully.
/// </summary>
public int RequiredHits { get; protected set; } = 10;
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(timing, difficulty);
double baseHitMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5);
RequiredHits = (int)Math.Max(1, Duration / 1000f * baseHitMultiplier * HitMultiplier);
}
}
}
|
// 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.Game.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Modes.Objects.Types;
namespace osu.Game.Modes.Taiko.Objects
{
public class Swell : TaikoHitObject, IHasEndTime
{
public double EndTime { get; set; }
public double Duration => EndTime - StartTime;
/// <summary>
/// The multiplier for cases in which the number of required hits by a Swell is not
/// dependent on solely the overall difficulty and the duration of the swell.
/// </summary>
public double HitMultiplier { get; set; } = 1;
/// <summary>
/// The number of hits required to complete the swell successfully.
/// </summary>
public int RequiredHits { get; protected set; } = 10;
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(timing, difficulty);
double spinnerRotationRatio = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5);
RequiredHits = (int)Math.Max(1, Duration / 1000f * spinnerRotationRatio * HitMultiplier);
}
}
}
|
mit
|
C#
|
e94d96f25093a2b32511554548e1a1314db6ce45
|
Add local popover container to editor screens
|
ppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,peppy/osu,peppy/osu,smoogipoo/osu,peppy/osu-new
|
osu.Game/Screens/Edit/EditorScreen.cs
|
osu.Game/Screens/Edit/EditorScreen.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
namespace osu.Game.Screens.Edit
{
/// <summary>
/// TODO: eventually make this inherit Screen and add a local screen stack inside the Editor.
/// </summary>
public abstract class EditorScreen : VisibilityContainer
{
[Resolved]
protected EditorBeatmap EditorBeatmap { get; private set; }
protected override Container<Drawable> Content => content;
private readonly Container content;
public readonly EditorScreenMode Type;
protected EditorScreen(EditorScreenMode type)
{
Type = type;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
InternalChild = content = new PopoverContainer { RelativeSizeAxes = Axes.Both };
}
protected override void PopIn()
{
this.ScaleTo(1f, 200, Easing.OutQuint)
.FadeIn(200, Easing.OutQuint);
}
protected override void PopOut()
{
this.ScaleTo(0.98f, 200, Easing.OutQuint)
.FadeOut(200, Easing.OutQuint);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Screens.Edit
{
/// <summary>
/// TODO: eventually make this inherit Screen and add a local screen stack inside the Editor.
/// </summary>
public abstract class EditorScreen : VisibilityContainer
{
[Resolved]
protected EditorBeatmap EditorBeatmap { get; private set; }
protected override Container<Drawable> Content => content;
private readonly Container content;
public readonly EditorScreenMode Type;
protected EditorScreen(EditorScreenMode type)
{
Type = type;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
InternalChild = content = new Container { RelativeSizeAxes = Axes.Both };
}
protected override void PopIn()
{
this.ScaleTo(1f, 200, Easing.OutQuint)
.FadeIn(200, Easing.OutQuint);
}
protected override void PopOut()
{
this.ScaleTo(0.98f, 200, Easing.OutQuint)
.FadeOut(200, Easing.OutQuint);
}
}
}
|
mit
|
C#
|
cdddb91eef03f13bedbc1878564bdde1eec6bc9d
|
Refactor FileHelpers in order to ensure all objects are properly disposed
|
aixasz/ImageShareTemplate
|
ImageShareTemplate/FileHelpers.cs
|
ImageShareTemplate/FileHelpers.cs
|
using System.IO;
using System.Net;
namespace ImageShareTemplate
{
public static class FileHelpers
{
public static byte[] LoadImageFormPath(string src)
{
return File.ReadAllBytes(src);
}
public static byte[] LoadImageFromUrl(string url)
{
try
{
var request = (HttpWebRequest)WebRequest.Create(url);
using (var response = (HttpWebResponse) request.GetResponse())
{
using (var stream = response.GetResponseStream())
{
using (var binaryReader = new BinaryReader(stream))
{
var contentLenght = (int)response.ContentLength;
return binaryReader.ReadBytes(contentLenght);
}
}
}
}
catch
{
return null;
}
}
}
}
|
using System;
using System.IO;
using System.Net;
namespace ImageShareTemplate
{
public static class FileHelpers
{
public static byte[] LoadImageFormPath(string src)
{
return File.ReadAllBytes(src);
}
public static byte[] LoadImageFromUrl(string url)
{
Stream stream = null;
byte[] result;
try
{
var webProxy = new WebProxy();
var request = (HttpWebRequest)WebRequest.Create(url);
var response = (HttpWebResponse)request.GetResponse();
stream = response.GetResponseStream();
using (var binaryReader = new BinaryReader(stream))
{
var contentLenght = (int)(response.ContentLength);
result = binaryReader.ReadBytes(contentLenght);
}
stream.Close();
response.Close();
}
catch (Exception ex)
{
result = null;
}
return result;
}
}
}
|
mit
|
C#
|
140e905219d25d213f9942478b963743ad8dc271
|
Allow no given option
|
KernowCode/UBADDAS
|
KernowCode.KTest.Ubaddas/IBase.cs
|
KernowCode.KTest.Ubaddas/IBase.cs
|
using System;
namespace KernowCode.KTest.Ubaddas
{
/// <summary>
/// BDD initiator
/// </summary>
public interface IBase : IAs
{
/// <summary>
/// <para>Specifies the start of the 'Given' section of BDD</para>
/// <para>This can be followed by 'And' and 'When'</para>
/// <para>Must be preceeded with the 'As' statement</para>
/// <para>Example</para>
/// <para> .Given(customer.Login)</para>
/// <para> .Given() //nothing</para>
/// </summary>
/// <param name="domainEntityCommand">The entitiy interface command method (without executing parenthesis)</param>
/// <returns>Interface providing fluent methods 'And' and 'When'</returns>
IGiven Given(Action domainEntityCommand = null);
/// <summary>
/// <para>Specifies the start of the 'Given' section of BDD</para>
/// <para>This can be followed by 'And' and 'When'</para>
/// <para>Must be preceeded with the 'As' statement</para>
/// <para>Example</para>
/// <para> .GivenWe(x => RegisterCustomer(x, customer))</para>
/// </summary>
/// <param name="actionDelegate">A delegate containing a call to a method that will execute another set of behaviours. Specify 'ISet behaviour' as the first parameter of your method and use behaviour to perform another Given,When,Then</param>
/// <returns>Interface providing fluent methods 'And' and 'When'</returns>
IGiven GivenWe(Action<ISet> actionDelegate);
}
}
|
using System;
namespace KernowCode.KTest.Ubaddas
{
/// <summary>
/// BDD initiator
/// </summary>
public interface IBase : IAs
{
/// <summary>
/// <para>Specifies the start of the 'Given' section of BDD</para>
/// <para>This can be followed by 'And' and 'When'</para>
/// <para>Must be preceeded with the 'As' statement</para>
/// <para>Example</para>
/// <para> .Given(customer.Login)</para>
/// </summary>
/// <param name="domainEntityCommand">The entitiy interface command method (without executing parenthesis)</param>
/// <returns>Interface providing fluent methods 'And' and 'When'</returns>
IGiven Given(Action domainEntityCommand);
/// <summary>
/// <para>Specifies the start of the 'Given' section of BDD</para>
/// <para>This can be followed by 'And' and 'When'</para>
/// <para>Must be preceeded with the 'As' statement</para>
/// <para>Example</para>
/// <para> .GivenWe(x => RegisterCustomer(x, customer))</para>
/// </summary>
/// <param name="actionDelegate">A delegate containing a call to a method that will execute another set of behaviours. Specify 'ISet behaviour' as the first parameter of your method and use behaviour to perform another Given,When,Then</param>
/// <returns>Interface providing fluent methods 'And' and 'When'</returns>
IGiven GivenWe(Action<ISet> actionDelegate);
}
}
|
mit
|
C#
|
567c7541e5303ff8cd5f15bbcda9702fcfb1cc53
|
Add test data to mock view-model
|
lpatalas/ExpressRunner
|
ExpressRunner/DesignerMocks/TestExplorerViewModel.cs
|
ExpressRunner/DesignerMocks/TestExplorerViewModel.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExpressRunner.DesignerMocks
{
public class TestExplorerViewModel
{
private readonly TestGroup selectedTestGroup;
public TestGroup SelectedTestGroup
{
get { return selectedTestGroup; }
}
private readonly IEnumerable<TestGroup> testGroups;
public IEnumerable<TestGroup> TestGroups
{
get { return testGroups; }
}
public TestExplorerViewModel()
{
selectedTestGroup = new TestGroup("Tests");
selectedTestGroup.Tests.Add(new TestItem(new Api.Test("First test", "tests", "1")));
selectedTestGroup.Tests.Add(new TestItem(new Api.Test("Second test", "tests", "2")));
selectedTestGroup.Tests.Add(new TestItem(new Api.Test("Third test", "tests", "3")));
var rootGroup = new TestGroup("Root");
rootGroup.SubGroups.Add(new TestGroup("First"));
rootGroup.SubGroups.Add(new TestGroup("Second"));
rootGroup.SubGroups.Add(new TestGroup("Third"));
testGroups = Enumerable.Repeat(rootGroup, 1);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExpressRunner.DesignerMocks
{
public class TestExplorerViewModel
{
private readonly TestGroup selectedTestGroup;
public TestGroup SelectedTestGroup
{
get { return selectedTestGroup; }
}
public TestExplorerViewModel()
{
selectedTestGroup = new TestGroup("Tests");
selectedTestGroup.Tests.Add(new TestItem(new Api.Test("First test", "tests", "1")));
selectedTestGroup.Tests.Add(new TestItem(new Api.Test("Second test", "tests", "2")));
selectedTestGroup.Tests.Add(new TestItem(new Api.Test("Third test", "tests", "3")));
}
}
}
|
mit
|
C#
|
59fcac77d069f014d92788c3ec66c80d4f7d8cc9
|
Update index.cshtml
|
Aleksandrovskaya/apmathclouddif
|
site/index.cshtml
|
site/index.cshtml
|
@{
double t_0 = 0;
double t_end = 150;
double step = 0.1;
int N = Convert.ToInt32((t_end-t_0)/step) + 1;
String data = "";
bool show_chart = false;
if (IsPost){
show_chart = true;
var number = Request["text1"];
double xd = number.AsInt();
double t = 0;
double x1 = 0;
double x2 = 0;
double x3 = 0;
double currentx1 = 0;
double currentx2 = 0;
double currentx3 = 0;
for (int i=0; i < N; ++i){
t = t_0 + step * i;
currentx1 = x1 + step* (-0.1252*x1 + -0.004637*(x2-xd)+-0.002198*x3);
currentx2 = x2 + step*x1 ;
currentx3= x3 + step*(10*x1 + -0.2*x3 +1*(x2-xd));
x1 = currentx1;
x2 = currentx2;
x3 = currentx3;
data += "[" +t+"," + x2+"]";
if( i < N - 1){
data += ",";
}
}
}
}
<html>
<head>
<meta charset="utf-8">
<title>MathBox</title>
<script type="text/javascript"
src="https://www.google.com/jsapi?autoload={
'modules':[{
'name':'visualization',
'version':'1',
'packages':['corechart']
}]
}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Time', 'pitch'],
@data
]);
var options = {
title: 'pitch',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<form action="" method="post">
<p><label for="text1">Input Angle</label><br>
<input type="text" name="text1" /></p>
<p><input type="submit" value=" Show " /></p>
</form>
@if (show_chart)
{
<div id="curve_chart" style="width: 900px; height: 500px"></div>
}
else
{
<p></p>
}
</body>
</html>
|
@{
double t_0 = 0;
double t_end = 150;
double step = 0.1;
int N = Convert.ToInt32((t_end-t_0)/step) + 1;
String data = "";
bool show_chart = false;
if (IsPost){
show_chart = true;
var number = Request["text1"];
double xd = number.AsInt();
double t = 0;
double x1 = 0;
double x2 = 0;
double x3 = 0;
double currentx1 = 0;
double currentx2 = 0;
double currentx3 = 0;
for (int i=0; i < N; ++i){
t = t_0 + step * i;
currentx1 = x1 + step* (-0.1252*x1 + -0.004637*x2+-0.002198*x3);
currentx2 = x2 + step*x1 ;
currentx3= x3 + step*(10*x1 + -0.2*x3 +1*(x2-xd));
x1 = currentx1;
x2 = currentx2;
x3 = currentx3;
data += "[" +t+"," + x2+"]";
if( i < N - 1){
data += ",";
}
}
}
}
<html>
<head>
<meta charset="utf-8">
<title>MathBox</title>
<script type="text/javascript"
src="https://www.google.com/jsapi?autoload={
'modules':[{
'name':'visualization',
'version':'1',
'packages':['corechart']
}]
}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Time', 'pitch'],
@data
]);
var options = {
title: 'pitch',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<form action="" method="post">
<p><label for="text1">Input Angle</label><br>
<input type="text" name="text1" /></p>
<p><input type="submit" value=" Show " /></p>
</form>
@if (show_chart)
{
<div id="curve_chart" style="width: 900px; height: 500px"></div>
}
else
{
<p></p>
}
</body>
</html>
|
mit
|
C#
|
c86c07ea42cde6ae99a765fb9b0fa58cf1d66fdf
|
Order the throughput data by newest to oldest.
|
christopher-bimson/VstsMetrics
|
VstsMetrics/Commands/Throughput/ThroughputCommand.cs
|
VstsMetrics/Commands/Throughput/ThroughputCommand.cs
|
using System;
using System.Linq;
using System.Threading.Tasks;
using CommandLine;
using VstsMetrics.Abstractions;
using VstsMetrics.Extensions;
using VstsMetrics.Renderers;
namespace VstsMetrics.Commands.Throughput
{
public class ThroughputCommand : Command
{
[Option('d', "doneState", DefaultValue = "Done", HelpText = "The work item state you project is using to indicate a work item is 'Done'.")]
public string DoneState { get; set; }
[Option('s', "since", Required = false, DefaultValue = null, HelpText = "Only calculate throuput for work items that entered the done state on or after this date.")]
public DateTime? Since { get; set; }
public override async Task Execute()
{
var workItemClient = WorkItemClientFactory.Create(ProjectCollectionUrl, PatToken);
var workItemReferences = await workItemClient.QueryWorkItemsAsync(ProjectName, Query);
var calculator = new WorkItemDoneDateAggregator(workItemClient, DoneState);
var workItemDoneDates = await calculator.AggregateAsync(workItemReferences);
var weeklyThroughput =
workItemDoneDates
.GroupBy(t => t.DoneDate.StartOfWeek(DayOfWeek.Monday))
.OrderByDescending(t => t.Key)
.Select(g => new {WeekBeginning = g.Key, Throughput = g.Count()});
OutputRendererFactory.Create(OutputFormat).Render(weeklyThroughput);
}
public ThroughputCommand(IWorkItemClientFactory workItemClientFactory, IOutputRendererFactory outputRendererFactory)
: base(workItemClientFactory, outputRendererFactory)
{
}
}
}
|
using System;
using System.Linq;
using System.Threading.Tasks;
using CommandLine;
using VstsMetrics.Abstractions;
using VstsMetrics.Extensions;
using VstsMetrics.Renderers;
namespace VstsMetrics.Commands.Throughput
{
public class ThroughputCommand : Command
{
[Option('d', "doneState", DefaultValue = "Done", HelpText = "The work item state you project is using to indicate a work item is 'Done'.")]
public string DoneState { get; set; }
[Option('s', "since", Required = false, DefaultValue = null, HelpText = "Only calculate throuput for work items that entered the done state on or after this date.")]
public DateTime? Since { get; set; }
public override async Task Execute()
{
var workItemClient = WorkItemClientFactory.Create(ProjectCollectionUrl, PatToken);
var workItemReferences = await workItemClient.QueryWorkItemsAsync(ProjectName, Query);
var calculator = new WorkItemDoneDateAggregator(workItemClient, DoneState);
var workItemDoneDates = await calculator.AggregateAsync(workItemReferences);
var weeklyThroughput =
workItemDoneDates
.GroupBy(t => t.DoneDate.StartOfWeek(DayOfWeek.Monday))
.OrderBy(t => t.Key)
.Select(g => new {WeekBeginning = g.Key, Throughput = g.Count()});
OutputRendererFactory.Create(OutputFormat).Render(weeklyThroughput);
}
public ThroughputCommand(IWorkItemClientFactory workItemClientFactory, IOutputRendererFactory outputRendererFactory)
: base(workItemClientFactory, outputRendererFactory)
{
}
}
}
|
agpl-3.0
|
C#
|
0c84ec58bed5ce3ab0ec76e9e58fda7613d58953
|
Remove cache for fields order
|
joinrpg/joinrpg-net,joinrpg/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net
|
JoinRpg.Domain/OrderingExtensions.cs
|
JoinRpg.Domain/OrderingExtensions.cs
|
using System.Collections.Generic;
using JoinRpg.DataModel;
using JoinRpg.Helpers;
namespace JoinRpg.Domain
{
public static class OrderingExtensions
{
public static IReadOnlyList<Character> GetOrderedCharacters(this CharacterGroup characterGroup) => characterGroup.GetCharactersContainer().OrderedItems;
public static VirtualOrderContainer<Character> GetCharactersContainer(this CharacterGroup characterGroup)
=> VirtualOrderContainerFacade.Create(characterGroup.Characters, characterGroup.ChildCharactersOrdering);
public static IReadOnlyList<CharacterGroup> GetOrderedChildGroups(this CharacterGroup characterGroup)
=> characterGroup.GetCharacterGroupsContainer().OrderedItems;
public static VirtualOrderContainer<CharacterGroup> GetCharacterGroupsContainer(this CharacterGroup characterGroup)
=> VirtualOrderContainerFacade.Create(characterGroup.ChildGroups, characterGroup.ChildGroupsOrdering);
public static IReadOnlyList<PlotElement> GetOrderedPlots(this Character character, IReadOnlyCollection<PlotElement> elements)
=> character.GetCharacterPlotContainer(elements).OrderedItems;
public static VirtualOrderContainer<PlotElement> GetCharacterPlotContainer(this Character character,
IReadOnlyCollection<PlotElement> plots) => VirtualOrderContainerFacade.Create(plots, character.PlotElementOrderData);
public static IReadOnlyList<ProjectFieldDropdownValue> GetOrderedValues(this ProjectField field)
=> field.GetFieldValuesContainer().OrderedItems;
public static VirtualOrderContainer<ProjectFieldDropdownValue> GetFieldValuesContainer(
this ProjectField field)
=> VirtualOrderContainerFacade.Create(field.DropdownValues, field.ValuesOrdering);
public static IReadOnlyList<ProjectField> GetOrderedFields(this Project field)
=> field.GetFieldsContainer().OrderedItems;
public static VirtualOrderContainer<ProjectField> GetFieldsContainer(
this Project field)
=> VirtualOrderContainerFacade.Create(field.ProjectFields, field.ProjectFieldsOrdering);
}
}
|
using System.Collections.Concurrent;
using System.Collections.Generic;
using JoinRpg.DataModel;
using JoinRpg.Helpers;
namespace JoinRpg.Domain
{
public static class OrderingExtensions
{
public static IReadOnlyList<Character> GetOrderedCharacters(this CharacterGroup characterGroup) => characterGroup.GetCharactersContainer().OrderedItems;
public static VirtualOrderContainer<Character> GetCharactersContainer(this CharacterGroup characterGroup)
=> VirtualOrderContainerFacade.Create(characterGroup.Characters, characterGroup.ChildCharactersOrdering);
public static IReadOnlyList<CharacterGroup> GetOrderedChildGroups(this CharacterGroup characterGroup)
=> characterGroup.GetCharacterGroupsContainer().OrderedItems;
public static VirtualOrderContainer<CharacterGroup> GetCharacterGroupsContainer(this CharacterGroup characterGroup)
=> VirtualOrderContainerFacade.Create(characterGroup.ChildGroups, characterGroup.ChildGroupsOrdering);
public static IReadOnlyList<PlotElement> GetOrderedPlots(this Character character, IReadOnlyCollection<PlotElement> elements)
=> character.GetCharacterPlotContainer(elements).OrderedItems;
public static VirtualOrderContainer<PlotElement> GetCharacterPlotContainer(this Character character,
IReadOnlyCollection<PlotElement> plots) => VirtualOrderContainerFacade.Create(plots, character.PlotElementOrderData);
private static readonly ConcurrentDictionary<int, IReadOnlyList<ProjectFieldDropdownValue>> PfdvCache =
new ConcurrentDictionary<int, IReadOnlyList<ProjectFieldDropdownValue>>();
public static IReadOnlyList<ProjectFieldDropdownValue> GetOrderedValues(this ProjectField field)
=> PfdvCache.GetOrAdd(field.ProjectFieldId, id => field.GetFieldValuesContainer().OrderedItems);
public static VirtualOrderContainer<ProjectFieldDropdownValue> GetFieldValuesContainer(
this ProjectField field)
=> VirtualOrderContainerFacade.Create(field.DropdownValues, field.ValuesOrdering);
public static IReadOnlyList<ProjectField> GetOrderedFields(this Project field)
=> field.GetFieldsContainer().OrderedItems;
public static VirtualOrderContainer<ProjectField> GetFieldsContainer(
this Project field)
=> VirtualOrderContainerFacade.Create(field.ProjectFields, field.ProjectFieldsOrdering);
}
}
|
mit
|
C#
|
302e4fe407426d2216521fedb76ea19f8168e5d4
|
Fix note on is_postal_in_city
|
maxmind/minfraud-api-dotnet
|
MaxMind.MinFraud/Response/Address.cs
|
MaxMind.MinFraud/Response/Address.cs
|
using Newtonsoft.Json;
namespace MaxMind.MinFraud.Response
{
/// <summary>
/// General address response data.
/// </summary>
public abstract class Address
{
/// <summary>
/// This property is <c>true</c> if the address is in the
/// IP country.The property is <c>false</c> when the address is not in the IP
/// country. If the address could not be parsed or was not provided or if the
/// IP address could not be geolocated, the property will be <c>null</c>.
/// </summary>
[JsonProperty("is_in_ip_country")]
public bool? IsInIPCountry { get; internal set; }
/// <summary>
/// This property is <c>true</c> if the postal code
/// provided with the address is in the city for the address.The property is
/// <c>false</c> when the postal code is not in the city. If the address was
/// not provided, could not be parsed, or was not in USA, the property will
/// be <c>null</c>.
/// </summary>
[JsonProperty("is_postal_in_city")]
public bool? IsPostalInCity { get; internal set; }
/// <summary>
/// The latitude associated with the address.
/// </summary>
[JsonProperty("latitude")]
public double? Latitude { get; internal set; }
/// <summary>
/// The longitude associated with the address.
/// </summary>
[JsonProperty("longitude")]
public double? Longitude { get; internal set; }
/// <summary>
/// The distance in kilometers from the address to the IP location.
/// </summary>
[JsonProperty("distance_to_ip_location")]
public int? DistanceToIPLocation { get; internal set; }
/// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <returns>A string that represents the current object.</returns>
public override string ToString()
{
return
$"IsInIPCountry: {IsInIPCountry}, IsPostalInCity: {IsPostalInCity}, Latitude: {Latitude}, Longitude: {Longitude}, DistanceToIPLocation: {DistanceToIPLocation}";
}
}
}
|
using Newtonsoft.Json;
namespace MaxMind.MinFraud.Response
{
/// <summary>
/// General address response data.
/// </summary>
public abstract class Address
{
/// <summary>
/// This property is <c>true</c> if the address is in the
/// IP country.The property is <c>false</c> when the address is not in the IP
/// country. If the address could not be parsed or was not provided or if the
/// IP address could not be geolocated, the property will be <c>null</c>.
/// </summary>
[JsonProperty("is_in_ip_country")]
public bool? IsInIPCountry { get; internal set; }
/// <summary>
/// This property is <c>true</c> if the postal code
/// provided with the address is in the city for the address.The property is
/// <c>false</c> when the postal code is not in the city. If the address could
/// not be parsed or was not provided, the property will be <c>null</c>. This
/// property will only be present for USA addresses.
/// </summary>
[JsonProperty("is_postal_in_city")]
public bool? IsPostalInCity { get; internal set; }
/// <summary>
/// The latitude associated with the address.
/// </summary>
[JsonProperty("latitude")]
public double? Latitude { get; internal set; }
/// <summary>
/// The longitude associated with the address.
/// </summary>
[JsonProperty("longitude")]
public double? Longitude { get; internal set; }
/// <summary>
/// The distance in kilometers from the address to the IP location.
/// </summary>
[JsonProperty("distance_to_ip_location")]
public int? DistanceToIPLocation { get; internal set; }
/// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <returns>A string that represents the current object.</returns>
public override string ToString()
{
return
$"IsInIPCountry: {IsInIPCountry}, IsPostalInCity: {IsPostalInCity}, Latitude: {Latitude}, Longitude: {Longitude}, DistanceToIPLocation: {DistanceToIPLocation}";
}
}
}
|
apache-2.0
|
C#
|
882c3ca35c2d8745d4e7b8326008421f6b8c8709
|
Fix Y coordinate for Obj spawn
|
Xeeynamo/KingdomHearts
|
OpenKh.Game/Entities/ObjectEntity.cs
|
OpenKh.Game/Entities/ObjectEntity.cs
|
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using OpenKh.Game.Debugging;
using OpenKh.Game.Infrastructure;
using OpenKh.Game.Models;
using OpenKh.Kh2;
using OpenKh.Kh2.Ard;
using OpenKh.Kh2.Extensions;
using System;
using System.Linq;
namespace OpenKh.Game.Entities
{
public class ObjectEntity : IEntity
{
public ObjectEntity(Kernel kernel, int objectId)
{
Kernel = kernel;
ObjectId = objectId;
Scaling = new Vector3(1, 1, 1);
}
public Kernel Kernel { get; }
public int ObjectId { get; }
public string ObjectName => Kernel.ObjEntries.Items
.FirstOrDefault(x => x.ObjectId == ObjectId)?.ModelName;
public MeshGroup Mesh { get; private set; }
public Vector3 Position { get; set; }
public Vector3 Rotation { get; set; }
public Vector3 Scaling { get; set; }
public void LoadMesh(GraphicsDevice graphics)
{
var objEntry = Kernel.ObjEntries.Items.FirstOrDefault(x => x.ObjectId == ObjectId);
if (objEntry == null)
{
Log.Warn($"Object ID {ObjectId} not found.");
return;
}
var fileName = $"obj/{objEntry.ModelName}.mdlx";
using var stream = Kernel.DataContent.FileOpen(fileName);
var entries = Bar.Read(stream);
var model = entries.ForEntry(x => x.Type == Bar.EntryType.Model, Mdlx.Read);
var texture = entries.ForEntry("tim_", Bar.EntryType.ModelTexture, ModelTexture.Read);
Mesh = MeshLoader.FromKH2(graphics, model, texture);
}
public static ObjectEntity FromSpawnPoint(Kernel kernel, SpawnPoint.Entity spawnPoint) =>
new ObjectEntity(kernel, spawnPoint.ObjectId)
{
Position = new Vector3(spawnPoint.PositionX, -spawnPoint.PositionY, -spawnPoint.PositionZ),
Rotation = new Vector3(spawnPoint.RotationX, spawnPoint.RotationY, spawnPoint.RotationZ),
};
}
}
|
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using OpenKh.Game.Debugging;
using OpenKh.Game.Infrastructure;
using OpenKh.Game.Models;
using OpenKh.Kh2;
using OpenKh.Kh2.Ard;
using OpenKh.Kh2.Extensions;
using System;
using System.Linq;
namespace OpenKh.Game.Entities
{
public class ObjectEntity : IEntity
{
public ObjectEntity(Kernel kernel, int objectId)
{
Kernel = kernel;
ObjectId = objectId;
Scaling = new Vector3(1, 1, 1);
}
public Kernel Kernel { get; }
public int ObjectId { get; }
public string ObjectName => Kernel.ObjEntries.Items
.FirstOrDefault(x => x.ObjectId == ObjectId)?.ModelName;
public MeshGroup Mesh { get; private set; }
public Vector3 Position { get; set; }
public Vector3 Rotation { get; set; }
public Vector3 Scaling { get; set; }
public void LoadMesh(GraphicsDevice graphics)
{
var objEntry = Kernel.ObjEntries.Items.FirstOrDefault(x => x.ObjectId == ObjectId);
if (objEntry == null)
{
Log.Warn($"Object ID {ObjectId} not found.");
return;
}
var fileName = $"obj/{objEntry.ModelName}.mdlx";
using var stream = Kernel.DataContent.FileOpen(fileName);
var entries = Bar.Read(stream);
var model = entries.ForEntry(x => x.Type == Bar.EntryType.Model, Mdlx.Read);
var texture = entries.ForEntry("tim_", Bar.EntryType.ModelTexture, ModelTexture.Read);
Mesh = MeshLoader.FromKH2(graphics, model, texture);
}
public static ObjectEntity FromSpawnPoint(Kernel kernel, SpawnPoint.Entity spawnPoint) =>
new ObjectEntity(kernel, spawnPoint.ObjectId)
{
Position = new Vector3(spawnPoint.PositionX, spawnPoint.PositionY, -spawnPoint.PositionZ),
Rotation = new Vector3(spawnPoint.RotationX, spawnPoint.RotationY, spawnPoint.RotationZ),
};
}
}
|
mit
|
C#
|
97814294bc7b8dda9039c25b0e96d860f03726ba
|
Correct CreateStateObject
|
sharpdx/SharpDX,sharpdx/SharpDX,sharpdx/SharpDX
|
Source/SharpDX.Direct3D12/Device5.cs
|
Source/SharpDX.Direct3D12/Device5.cs
|
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// 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 SharpDX.Direct3D;
using SharpDX.DXGI;
namespace SharpDX.Direct3D12
{
public partial class Device5
{
public StateObject CreateStateObject(StateObjectDescription description)
{
return CreateStateObject(description, Utilities.GetGuidFromType(typeof(StateObject)));
}
}
}
|
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// 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 SharpDX.Direct3D;
using SharpDX.DXGI;
namespace SharpDX.Direct3D12
{
public partial class Device5
{
public StateObject CreateStateObject(StateObjectDescription description)
{
var nativePointer = CreateStateObject(description, Utilities.GetGuidFromType(typeof(StateObject)));
return new StateObject(nativePointer);
}
}
}
|
mit
|
C#
|
d46f21e7cd209fe72aa740a5b024236e94c4cda1
|
Clear Main
|
STzvetkov/Rambutan,petyakostova/Rambutan
|
Rambutan/Program.cs
|
Rambutan/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Rambutan
{
class Program
{
static void Main()
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Rambutan
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
mit
|
C#
|
b336f41481903fc85a9f5da06983dea07f49a591
|
Make Lines private
|
12joan/hangman
|
row.cs
|
row.cs
|
using System;
namespace Hangman {
public class Row {
public Cell[] Cells;
public Row(Cell[] cells) {
Cells = cells;
}
public string Draw(int width) {
// return new String(' ', width - Text.Length) + Text;
return String.Join("\n", Lines());
}
private string[] Lines() {
return new string[] {
"Line 1",
"Line 2"
};
}
}
}
|
using System;
namespace Hangman {
public class Row {
public Cell[] Cells;
public Row(Cell[] cells) {
Cells = cells;
}
public string Draw(int width) {
// return new String(' ', width - Text.Length) + Text;
return String.Join("\n", Lines());
}
public string[] Lines() {
return new string[] {
"Line 1",
"Line 2"
};
}
}
}
|
unlicense
|
C#
|
28bd3bdf6dd7e39393ed588ef973f3e5f4dff865
|
fix to 47841461e8bb7930083ae3c1d88b6df96f8ffb5d
|
yar229/WebDavMailRuCloud
|
MailRuCloud/MailRuCloudApi/Base/Credentials.cs
|
MailRuCloud/MailRuCloudApi/Base/Credentials.cs
|
using System;
using System.Linq;
using System.Security.Authentication;
namespace YaR.MailRuCloud.Api.Base
{
public class Credentials : IBasicCredentials
{
private static readonly string[] AnonymousLogins = { "anonymous", "anon", "anonym", string.Empty };
public Credentials(string login, string password)
{
if (string.IsNullOrWhiteSpace(login))
login = string.Empty; // throw new InvalidCredentialException("Login is null or empty.");
if (AnonymousLogins.Contains(login))
{
IsAnonymous = true;
Login = login;
Password = string.Empty;
return;
}
if (string.IsNullOrEmpty(password))
throw new ArgumentException("Password is null or empty.");
int slashpos = login.IndexOf(@"#", StringComparison.InvariantCulture);
if (slashpos == login.Length - 1)
throw new InvalidCredentialException("Invalid credential format.");
if (slashpos < 0)
{
Login = login;
Password = password;
PasswordCrypt = string.Empty;
return;
}
Login = login.Substring(0, slashpos);
string separator = login.Substring(slashpos + 1);
int seppos = password.IndexOf(separator, StringComparison.InvariantCulture);
if (seppos < 0)
throw new InvalidCredentialException("Invalid credential format.");
Password = password.Substring(0, seppos);
if (seppos + separator.Length >= password.Length)
throw new InvalidCredentialException("Invalid credential format.");
PasswordCrypt = password.Substring(seppos + separator.Length);
}
public bool IsAnonymous { get; set; }
public string Login { get; }
public string Password { get; }
public string PasswordCrypt { get; set; }
public bool CanCrypt => !string.IsNullOrEmpty(PasswordCrypt);
}
}
|
using System;
using System.Linq;
using System.Security.Authentication;
namespace YaR.MailRuCloud.Api.Base
{
public class Credentials : IBasicCredentials
{
private static readonly string[] AnonymousLogins = { "anonymous", "anon", "anonym", string.Empty };
public Credentials(string login, string password)
{
if (string.IsNullOrWhiteSpace(login))
login = string.Empty; // throw new InvalidCredentialException("Login is null or empty.");
if (AnonymousLogins.Contains(login))
{
IsAnonymous = true;
Login = login;
Password = string.Empty;
return;
}
if (string.IsNullOrEmpty(password))
throw new ArgumentException("Password is null or empty.");
int slashpos = login.IndexOf(@"#", StringComparison.InvariantCulture);
if (slashpos == login.Length - 1)
throw new InvalidCredentialException("Invalid credential format.");
if (slashpos < 0)
{
Login = login;
Password = password;
PasswordCrypt = string.Empty;
return;
}
Login = login.Substring(0, slashpos);
string separator = login.Substring(slashpos + 1);
int seppos = password.IndexOf(separator, StringComparison.InvariantCulture);
if (seppos < 0)
throw new InvalidCredentialException("Invalid credential format.");
Password = password.Substring(0, seppos);
if (seppos + separator.Length >= password.Length)
throw new InvalidCredentialException("Invalid credential format.");
PasswordCrypt = password.Substring(seppos + separator.Length);
}
public bool IsAnonymous { get; set; }
public string Login { get; }
public string Password { get; }
public string PasswordCrypt { get; }
public bool CanCrypt => !string.IsNullOrEmpty(PasswordCrypt);
}
}
|
mit
|
C#
|
643aa894203b8ae0fd39230cba6145a566cd1cc3
|
add comment for DOS part execution
|
MichelleLunoza/DOS-exec-CSharp
|
VRemover/Program.cs
|
VRemover/Program.cs
|
/*
* Created by SharpDevelop.
* User: MichelleLunoza
* Date: 12/12/2016
* Time: 8:12 PM
*
*/
using System;
using System.Diagnostics;
namespace VRemover
{
class Program
{
public static void Main(string[] args)
{
Process cmd = new Process();
cmd.StartInfo.FileName = "cmd.exe";
cmd.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
cmd.Start();
//This is the Part to exwecute DOS commands . . . . :)
cmd.StandardInput.WriteLine("start notepad");
cmd.StandardInput.WriteLine("start calc");
cmd.StandardInput.WriteLine("start chrome");
//cmd.StandardInput.Flush();
//cmd.StandardInput.Close();
//cmd.WaitForExit();
//Console.WriteLine(cmd.StandardOutput.ReadToEnd());
//Console.Write("Press any key to continue . . . ");
//Console.ReadKey(true);
}
}
}
|
/*
* Created by SharpDevelop.
* User: MichelleLunoza
* Date: 12/12/2016
* Time: 8:12 PM
*
*/
using System;
using System.Diagnostics;
namespace VRemover
{
class Program
{
public static void Main(string[] args)
{
Process cmd = new Process();
cmd.StartInfo.FileName = "cmd.exe";
cmd.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
cmd.Start();
cmd.StandardInput.WriteLine("start notepad");
cmd.StandardInput.WriteLine("start calc");
cmd.StandardInput.WriteLine("start chrome");
//cmd.StandardInput.Flush();
//cmd.StandardInput.Close();
//cmd.WaitForExit();
//Console.WriteLine(cmd.StandardOutput.ReadToEnd());
//Console.Write("Press any key to continue . . . ");
//Console.ReadKey(true);
}
}
}
|
apache-2.0
|
C#
|
69c216a2fe3f08422aba9a7397df650f0c0f3068
|
Update GoogleAnalyticsPlatform.cs
|
KSemenenko/GoogleAnalyticsForXamarinForms,KSemenenko/Google-Analytics-for-Xamarin-Forms
|
Plugin.GoogleAnalytics/Plugin.GoogleAnalytics.WindowsPhone8/GoogleAnalyticsPlatform.cs
|
Plugin.GoogleAnalytics/Plugin.GoogleAnalytics.WindowsPhone8/GoogleAnalyticsPlatform.cs
|
using System;
using System.Threading;
namespace Plugin.GoogleAnalytics
{
public partial class GoogleAnalytics
{
static GoogleAnalytics()
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (!Current.Config.ReportUncaughtExceptions)
return;
Current.Tracker.SendException(e.ExceptionObject as Exception, true);
Thread.Sleep(1000); //delay
}
}
}
|
using System;
using System.Threading;
namespace Plugin.GoogleAnalytics
{
public partial class GoogleAnalytics
{
static GoogleAnalytics()
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Current.Tracker.SendException(e.ExceptionObject as Exception, true);
Thread.Sleep(1000); //delay
}
}
}
|
mit
|
C#
|
feff6920821a8857e76fb38d5455cd45a98742ff
|
correct `HTMLTableCellElement`'s `ColSpan` and `RowSpan` properties
|
AndreyZM/Bridge,bridgedotnet/Bridge,AndreyZM/Bridge,AndreyZM/Bridge,bridgedotnet/Bridge,AndreyZM/Bridge,bridgedotnet/Bridge,bridgedotnet/Bridge
|
Html5/Elements/HTMLTableCellElement.cs
|
Html5/Elements/HTMLTableCellElement.cs
|
namespace Bridge.Html5
{
/// <summary>
/// The HTMLTableCellElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header or data cells, in an HTML document.
/// The HTML elements implementing this interface: <th> and <td>.
/// </summary>
/// <typeparam name="TCurrentTarget">The CurrentTarget type of all TableCellElement's events</typeparam>
[External]
[Name("HTMLTableCellElement")]
public abstract class HTMLTableCellElement<TCurrentTarget> : HTMLElement<TCurrentTarget> where TCurrentTarget : HTMLElement<TCurrentTarget>
{
/// <summary>
/// Is an unsigned long that represents the number of columns this cell must span. It reflects the colspan attribute.
/// </summary>
public uint ColSpan;
/// <summary>
/// Is an unsigned long that represents the number of rows this cell must span. It reflects the rowspan attribute.
/// </summary>
public uint RowSpan;
/// <summary>
/// Is a DOMSettableTokenList describing a list of id of <th> elements that represents headers associated with the cell. It reflects the headers attribute.
/// </summary>
public readonly DOMSettableTokenList Headers;
/// <summary>
/// Is a long representing the cell position in the cells collection of the <tr> it belongs to. If the cell doesn't belong to a <tr>, it returns -1.
/// </summary>
public int CellIndex;
}
/// <summary>
/// The non-generic TableCellElement class. Events' CurrentTarget has the TableCellElement type.
/// </summary>
[External]
[Name("HTMLTableCellElement")]
public abstract class TableCellElement : HTMLElement<TableCellElement>
{
}
}
|
namespace Bridge.Html5
{
/// <summary>
/// The HTMLTableCellElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header or data cells, in an HTML document.
/// The HTML elements implementing this interface: <th> and <td>.
/// </summary>
/// <typeparam name="TCurrentTarget">The CurrentTarget type of all TableCellElement's events</typeparam>
[External]
[Name("HTMLTableCellElement")]
public abstract class HTMLTableCellElement<TCurrentTarget> : HTMLElement<TCurrentTarget> where TCurrentTarget : HTMLElement<TCurrentTarget>
{
/// <summary>
/// Is an unsigned long that represents the number of columns this cell must span. It reflects the colspan attribute.
/// </summary>
[Name("colspan")]
public int ColSpan;
/// <summary>
/// Is an unsigned long that represents the number of rows this cell must span. It reflects the rowspan attribute.
/// </summary>
[Name("rowspan")]
public int RowSpan;
/// <summary>
/// Is a DOMSettableTokenList describing a list of id of <th> elements that represents headers associated with the cell. It reflects the headers attribute.
/// </summary>
public readonly DOMSettableTokenList Headers;
/// <summary>
/// Is a long representing the cell position in the cells collection of the <tr> it belongs to. If the cell doesn't belong to a <tr>, it returns -1.
/// </summary>
public int CellIndex;
}
/// <summary>
/// The non-generic TableCellElement class. Events' CurrentTarget has the TableCellElement type.
/// </summary>
[External]
[Name("HTMLTableCellElement")]
public abstract class TableCellElement : HTMLElement<TableCellElement>
{
}
}
|
apache-2.0
|
C#
|
420eedfd4a9096f0187a0cf7ce28091dc2b0f6fe
|
Add BitCount
|
mgefvert/DotNetCommons
|
src/DotNetCommons/StructExtensions.cs
|
src/DotNetCommons/StructExtensions.cs
|
using System;
// ReSharper disable UnusedMember.Global
namespace DotNetCommons
{
public static class StructExtensions
{
public static T Limit<T>(this T value, T min, T max) where T : struct, IComparable<T>
{
if (value.CompareTo(min) < 0)
return min;
if (value.CompareTo(max) > 0)
return max;
return value;
}
public static int BitCount(this uint value)
{
value -= (value >> 1) & 0x55555555;
value = (value & 0x33333333) + ((value >> 2) & 0x33333333);
return (int)(((value + (value >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
}
}
|
using System;
// ReSharper disable UnusedMember.Global
namespace DotNetCommons
{
public static class StructExtensions
{
public static T Limit<T>(this T value, T min, T max) where T : struct, IComparable<T>
{
if (value.CompareTo(min) < 0)
return min;
if (value.CompareTo(max) > 0)
return max;
return value;
}
}
}
|
mit
|
C#
|
5cf2dd3926c3392f2d3bcfa8c1d5e015b329b520
|
Add author to assembly copyright field
|
jancowol/Shovel,modulexcite/Shovel,jancowol/Shovel
|
src/Shovel/Properties/AssemblyInfo.cs
|
src/Shovel/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("Shovel ScriptCs Script Pack")]
[assembly: AssemblyDescription("A scriptcs script pack enabling the creation of scriptcs (.csx) build scripts.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Janco Wolmarans")]
[assembly: AssemblyProduct("Shovel")]
[assembly: AssemblyCopyright("Copyright © 2013 Janco Wolmarans")]
[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("2d8b4853-42c8-4da0-93de-b0af1a2ca15c")]
[assembly: AssemblyVersion("0.1.0")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: InternalsVisibleTo("Shovel.Tests")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Shovel ScriptCs Script Pack")]
[assembly: AssemblyDescription("A scriptcs script pack enabling the creation of scriptcs (.csx) build scripts.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Janco Wolmarans")]
[assembly: AssemblyProduct("Shovel")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2d8b4853-42c8-4da0-93de-b0af1a2ca15c")]
[assembly: AssemblyVersion("0.1.0")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: InternalsVisibleTo("Shovel.Tests")]
|
mit
|
C#
|
b82396a7be765acd80f33bfa4d640a8f7d9d6c93
|
Bump version to 0.13.1
|
quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot
|
CactbotOverlay/Properties/AssemblyInfo.cs
|
CactbotOverlay/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.13.1.0")]
[assembly: AssemblyFileVersion("0.13.1.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.13.0.0")]
[assembly: AssemblyFileVersion("0.13.0.0")]
|
apache-2.0
|
C#
|
ce54923111ada0a9b186fa5c9dd589190d9d2ec2
|
Set the same delivery time for Reprints Desk as for Subito
|
ChalmersLibrary/Chillin,ChalmersLibrary/Chillin,ChalmersLibrary/Chillin,ChalmersLibrary/Chillin
|
Chalmers.ILL/Providers/ProviderService.cs
|
Chalmers.ILL/Providers/ProviderService.cs
|
using Chalmers.ILL.Models;
using Examine;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Chalmers.ILL.Extensions;
using Chalmers.ILL.OrderItems;
namespace Chalmers.ILL.Providers
{
public class ProviderService : IProviderService
{
IOrderItemSearcher _orderItemsSearcher;
public ProviderService(IOrderItemSearcher orderItemsSearcher)
{
_orderItemsSearcher = orderItemsSearcher;
}
public IEnumerable<String> FetchAndCreateListOfUsedProviders()
{
return _orderItemsSearcher.AggregatedProviders();
}
public int GetSuggestedDeliveryTimeInHoursForProvider(string providerName)
{
int res = 168;
if (!String.IsNullOrWhiteSpace(providerName) && (providerName.ToLower().Contains("subito") || providerName.ToLower().Contains("reprints desk")))
{
res = 24;
}
return res;
}
}
}
|
using Chalmers.ILL.Models;
using Examine;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Chalmers.ILL.Extensions;
using Chalmers.ILL.OrderItems;
namespace Chalmers.ILL.Providers
{
public class ProviderService : IProviderService
{
IOrderItemSearcher _orderItemsSearcher;
public ProviderService(IOrderItemSearcher orderItemsSearcher)
{
_orderItemsSearcher = orderItemsSearcher;
}
public IEnumerable<String> FetchAndCreateListOfUsedProviders()
{
return _orderItemsSearcher.AggregatedProviders();
}
public int GetSuggestedDeliveryTimeInHoursForProvider(string providerName)
{
int res = 168;
if (!String.IsNullOrWhiteSpace(providerName) && providerName.ToLower().Contains("subito"))
{
res = 24;
}
return res;
}
}
}
|
mit
|
C#
|
e453bf9a07cefdabf904e7324e83ad83407208b0
|
Fix failing test
|
uoinfusion/Infusion
|
Infusion/Commands/CommandAutocompleter.cs
|
Infusion/Commands/CommandAutocompleter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Infusion.Commands
{
public class CommandAutocompleter
{
private readonly Func<IEnumerable<string>> commandNameSource;
public CommandAutocompleter(Func<IEnumerable<string>> commandNameSource)
{
this.commandNameSource = commandNameSource;
}
private string GetSharedStart(string[] words)
{
return new string(
words.First().Substring(0, words.Min(s => s.Length))
.TakeWhile((c, i) => words.All(s => s[i] == c)).ToArray());
}
public CommandAutocompletion Autocomplete(string commandLine)
{
if (string.IsNullOrWhiteSpace(commandLine))
return CommandAutocompletion.Empty;
var syntax = CommandParser.Parse(commandLine);
if (syntax.HasParameters)
return CommandAutocompletion.Empty;
var exactMatch = commandNameSource().FirstOrDefault(x => x == syntax.PrefixAndName);
if (!string.IsNullOrEmpty(exactMatch))
return new CommandAutocompletion(new[] {exactMatch}, exactMatch + " ");
var startingWith = commandNameSource().Where(x => x.StartsWith(syntax.PrefixAndName)).OrderBy(x => x).ToArray();
if (startingWith.Length == 1)
return new CommandAutocompletion(startingWith, startingWith[0] + " ");
if (startingWith.Length > 1)
return new CommandAutocompletion(startingWith,
startingWith.Length > 0 ? GetSharedStart(startingWith) : null);
return new CommandAutocompletion(commandNameSource().OrderBy(x => x).ToArray(), null);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Infusion.Commands
{
public class CommandAutocompleter
{
private readonly Func<IEnumerable<string>> commandNameSource;
public CommandAutocompleter(Func<IEnumerable<string>> commandNameSource)
{
this.commandNameSource = commandNameSource;
}
private string GetSharedStart(string[] words)
{
return new string(
words.First().Substring(0, words.Min(s => s.Length))
.TakeWhile((c, i) => words.All(s => s[i] == c)).ToArray());
}
public CommandAutocompletion Autocomplete(string commandLine)
{
if (string.IsNullOrWhiteSpace(commandLine))
return CommandAutocompletion.Empty;
var syntax = CommandParser.Parse(commandLine);
if (syntax.HasParameters)
return CommandAutocompletion.Empty;
var exactMatch = commandNameSource().FirstOrDefault(x => x == syntax.PrefixAndName);
if (!string.IsNullOrEmpty(exactMatch))
return new CommandAutocompletion(new[] {exactMatch}, syntax.Prefix + exactMatch + " ");
var startingWith = commandNameSource().Where(x => x.StartsWith(syntax.PrefixAndName)).OrderBy(x => x).ToArray();
if (startingWith.Length == 1)
return new CommandAutocompletion(startingWith, startingWith[0] + " ");
if (startingWith.Length > 1)
return new CommandAutocompletion(startingWith,
startingWith.Length > 0 ? GetSharedStart(startingWith) : null);
return new CommandAutocompletion(commandNameSource().OrderBy(x => x).ToArray(), null);
}
}
}
|
mit
|
C#
|
5788894e38994f95856e7a2380b8aee6c41aa1aa
|
Update version
|
takuya-takeuchi/RedArmory
|
source/RedArmory/AssemblyProperty.cs
|
source/RedArmory/AssemblyProperty.cs
|
namespace Ouranos.RedArmory
{
internal static class AssemblyProperty
{
/// <summary>
/// アセンブリ マニフェストに含める、製品名に関するカスタム属性を定義します。
/// </summary>
public const string Product = "Red Armory";
/// <summary>
/// RedArmory.exe の説明を指定します。
/// </summary>
public const string Title = "Red Armory";
/// <summary>
/// アセンブリ マニフェストに含める、会社名に関するカスタム属性を定義します。
/// </summary>
public const string Company = "";
/// <summary>
/// アセンブリ マニフェストに含める、著作権に関するカスタム属性を表します。
/// </summary>
public const string Copyright = "Copyright © Takuya Takeuchi All Rights Reserved.";
/// <summary>
/// アセンブリ マニフェストに含める、ファイル バージョンを定義します。
/// </summary>
public const string FileVersion = "1.6.0.0";
/// <summary>
/// アセンブリ マニフェストに含める、アセンブリ バージョンを定義します。
/// </summary>
public const string Version = "1.6.0.0";
}
}
|
namespace Ouranos.RedArmory
{
internal static class AssemblyProperty
{
/// <summary>
/// アセンブリ マニフェストに含める、製品名に関するカスタム属性を定義します。
/// </summary>
public const string Product = "Red Armory";
/// <summary>
/// RedArmory.exe の説明を指定します。
/// </summary>
public const string Title = "Red Armory";
/// <summary>
/// アセンブリ マニフェストに含める、会社名に関するカスタム属性を定義します。
/// </summary>
public const string Company = "";
/// <summary>
/// アセンブリ マニフェストに含める、著作権に関するカスタム属性を表します。
/// </summary>
public const string Copyright = "Copyright © Takuya Takeuchi All Rights Reserved.";
/// <summary>
/// アセンブリ マニフェストに含める、ファイル バージョンを定義します。
/// </summary>
public const string FileVersion = "1.5.0.0";
/// <summary>
/// アセンブリ マニフェストに含める、アセンブリ バージョンを定義します。
/// </summary>
public const string Version = "1.5.0.0";
}
}
|
mit
|
C#
|
6cc3518cd6f5e48e7498685b1eb14dfafa2946a5
|
Fix localization of Blocks
|
roman-yagodin/R7.Epsilon,roman-yagodin/R7.Epsilon,roman-yagodin/R7.Epsilon
|
R7.Epsilon/Components/ControlLocalizer.cs
|
R7.Epsilon/Components/ControlLocalizer.cs
|
//
// ControlLocalizer.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2015-2016 Roman M. Yagodin
//
// This program 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.
//
// This program 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/>.
using System.IO;
using System.Web.UI;
using DotNetNuke.Services.Localization;
using DotNetNuke.UI.Skins;
namespace R7.Epsilon.Components
{
public class ControlLocalizer
{
#region Properties
public string LocalResourceFile { get; protected set; }
#endregion
public ControlLocalizer (TemplateControl control)
{
LocalResourceFile = Localization.GetResourceFile (control, Path.GetFileName (control.AppRelativeVirtualPath));
// skinobjects must use resources from parent (skins) directory
if (control is SkinObjectBase) {
LocalResourceFile = LocalResourceFile.Replace ("/SkinObjects", string.Empty).Replace ("/Blocks", string.Empty);
}
}
#region Public methods
public string GetString (string key)
{
return Localization.GetString (key, LocalResourceFile);
}
// TODO: Remove as unused?
public string GetString (string key, string defaultKey)
{
var localizedValue = GetString (key);
return !string.IsNullOrWhiteSpace (localizedValue) ? localizedValue : GetString(defaultKey);
}
public string SafeGetString (string key, string defaultValue)
{
var localizedValue = GetString (key);
return !string.IsNullOrWhiteSpace (localizedValue) ? localizedValue : defaultValue;
}
#endregion
}
}
|
//
// ControlLocalizer.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2015-2016 Roman M. Yagodin
//
// This program 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.
//
// This program 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/>.
using System.IO;
using System.Web.UI;
using DotNetNuke.Services.Localization;
using DotNetNuke.UI.Skins;
namespace R7.Epsilon.Components
{
public class ControlLocalizer
{
#region Properties
public string LocalResourceFile { get; protected set; }
#endregion
public ControlLocalizer (TemplateControl control)
{
LocalResourceFile = Localization.GetResourceFile (control, Path.GetFileName (control.AppRelativeVirtualPath));
// skinobjects must use resources from parent (skins) directory
if (control is SkinObjectBase) {
LocalResourceFile = LocalResourceFile.Replace ("/SkinObjects", string.Empty);
}
}
#region Public methods
public string GetString (string key)
{
return Localization.GetString (key, LocalResourceFile);
}
// TODO: Remove as unused?
public string GetString (string key, string defaultKey)
{
var localizedValue = GetString (key);
return !string.IsNullOrWhiteSpace (localizedValue) ? localizedValue : GetString(defaultKey);
}
public string SafeGetString (string key, string defaultValue)
{
var localizedValue = GetString (key);
return !string.IsNullOrWhiteSpace (localizedValue) ? localizedValue : defaultValue;
}
#endregion
}
}
|
agpl-3.0
|
C#
|
7b1e854e97c6d136764dce9add7bd6a59b58db93
|
Load team address instead of default sign-in page
|
rfgamaral/SlackUI
|
SlackUI/Handlers/BrowserRequestHandler.cs
|
SlackUI/Handlers/BrowserRequestHandler.cs
|
#region Copyright © 2014 Ricardo Amaral
/*
* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.
*/
#endregion
using CefSharp;
namespace SlackUI {
internal class BrowserRequestHandler : IRequestHandler {
#region Private Fields
private const string SignInUrl = "https://slack.com/signin";
#endregion
#region Public Methods
public bool GetAuthCredentials(IWebBrowser browser, bool isProxy, string host, int port, string realm,
string scheme, ref string username, ref string password) {
// Let the Chromium web browser handle the event
return false;
}
public ResourceHandler GetResourceHandler(IWebBrowser browser, IRequest request) {
// Let the Chromium web browser handle the event
return null;
}
public bool OnBeforeBrowse(IWebBrowser browser, IRequest request, bool isRedirect) {
// Disable browser forward/back navigation with keyboard keys
if((request.TransitionType & TransitionType.ForwardBack) != 0) {
return true;
}
// Load the active team address instead of the default sign-in page
if(request.Url.Equals(SignInUrl)) {
browser.Load(Program.ActiveTeamAddress);
return true;
}
// Let the Chromium web browser handle the event
return false;
}
public bool OnBeforePluginLoad(IWebBrowser browser, string url, string policyUrl, IWebPluginInfo info) {
// Let the Chromium web browser handle the event
return false;
}
public bool OnBeforeResourceLoad(IWebBrowser browser, IRequest request, IResponse response) {
// Let the Chromium web browser handle the event
return false;
}
public void OnPluginCrashed(IWebBrowser browser, string pluginPath) {
// No implementation required
}
public void OnRenderProcessTerminated(IWebBrowser browser, CefTerminationStatus status) {
// No implementation required
}
#endregion
}
}
|
#region Copyright © 2014 Ricardo Amaral
/*
* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.
*/
#endregion
using CefSharp;
namespace SlackUI {
internal class BrowserRequestHandler : IRequestHandler {
#region Public Methods
public bool GetAuthCredentials(IWebBrowser browser, bool isProxy, string host, int port, string realm,
string scheme, ref string username, ref string password) {
// Let the Chromium web browser handle the event
return false;
}
public ResourceHandler GetResourceHandler(IWebBrowser browser, IRequest request) {
// Let the Chromium web browser handle the event
return null;
}
public bool OnBeforeBrowse(IWebBrowser browser, IRequest request, bool isRedirect) {
// Disable browser forward/back navigation with keyboard keys
if((request.TransitionType & TransitionType.ForwardBack) != 0) {
return true;
}
// Let the Chromium web browser handle the event
return false;
}
public bool OnBeforePluginLoad(IWebBrowser browser, string url, string policyUrl, IWebPluginInfo info) {
// Let the Chromium web browser handle the event
return false;
}
public bool OnBeforeResourceLoad(IWebBrowser browser, IRequest request, IResponse response) {
// Let the Chromium web browser handle the event
return false;
}
public void OnPluginCrashed(IWebBrowser browser, string pluginPath) {
// No implementation required
}
public void OnRenderProcessTerminated(IWebBrowser browser, CefTerminationStatus status) {
// No implementation required
}
#endregion
}
}
|
mit
|
C#
|
36f1610a2124bf15d0d2157061c71082faca030e
|
Update PowerShellModule.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/PowerShell/PowerShellModule.cs
|
TIKSN.Core/PowerShell/PowerShellModule.cs
|
using Autofac;
namespace TIKSN.PowerShell
{
public class PowerShellModule : Module
{
protected override void Load(ContainerBuilder builder)
{
base.Load(builder);
builder.RegisterType<CurrentCommandContext>().As<ICurrentCommandStore>().As<ICurrentCommandProvider>()
.InstancePerLifetimeScope();
}
}
}
|
using Autofac;
namespace TIKSN.PowerShell
{
public class PowerShellModule : Module
{
protected override void Load(ContainerBuilder builder)
{
base.Load(builder);
builder.RegisterType<CurrentCommandContext>().As<ICurrentCommandStore>().As<ICurrentCommandProvider>().InstancePerLifetimeScope();
}
}
}
|
mit
|
C#
|
6ffeebc161083a9d0dbe5b2f168c98cc98288f73
|
Use more c# 6 in Utils namespace
|
henrikfroehling/TraktApiSharp
|
Source/Lib/TraktApiSharp/Utils/Json.cs
|
Source/Lib/TraktApiSharp/Utils/Json.cs
|
namespace TraktApiSharp.Utils
{
using Newtonsoft.Json;
internal static class Json
{
internal static readonly JsonSerializerSettings DEFAULT_JSON_SETTINGS
= new JsonSerializerSettings
{
Formatting = Formatting.None,
NullValueHandling = NullValueHandling.Ignore
};
internal static string Serialize(object value)
=> JsonConvert.SerializeObject(value, DEFAULT_JSON_SETTINGS);
internal static TResult Deserialize<TResult>(string value)
=> JsonConvert.DeserializeObject<TResult>(value, DEFAULT_JSON_SETTINGS);
}
}
|
namespace TraktApiSharp.Utils
{
using Newtonsoft.Json;
internal static class Json
{
internal static readonly JsonSerializerSettings DEFAULT_JSON_SETTINGS
= new JsonSerializerSettings
{
Formatting = Formatting.None,
NullValueHandling = NullValueHandling.Ignore
};
internal static string Serialize(object value)
{
return JsonConvert.SerializeObject(value, DEFAULT_JSON_SETTINGS);
}
internal static TResult Deserialize<TResult>(string value)
{
return JsonConvert.DeserializeObject<TResult>(value, DEFAULT_JSON_SETTINGS);
}
}
}
|
mit
|
C#
|
7d80492a1268ec021bd66a012e67d62738378025
|
Add Fullscreen to WindowState enum.
|
jkoritzinsky/Avalonia,Perspex/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Perspex,grokys/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,grokys/Perspex,SuperJMN/Avalonia,Perspex/Perspex,akrisiun/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia
|
src/Avalonia.Controls/WindowState.cs
|
src/Avalonia.Controls/WindowState.cs
|
namespace Avalonia.Controls
{
/// <summary>
/// Defines the minimized/maximized state of a <see cref="Window"/>.
/// </summary>
public enum WindowState
{
/// <summary>
/// The window is neither minimized or maximized.
/// </summary>
Normal,
/// <summary>
/// The window is minimized.
/// </summary>
Minimized,
/// <summary>
/// The window is maximized.
/// </summary>
Maximized,
/// <summary>
/// The window is fullscreen.
/// </summary>
FullScreen,
}
}
|
namespace Avalonia.Controls
{
/// <summary>
/// Defines the minimized/maximized state of a <see cref="Window"/>.
/// </summary>
public enum WindowState
{
/// <summary>
/// The window is neither minimized or maximized.
/// </summary>
Normal,
/// <summary>
/// The window is minimized.
/// </summary>
Minimized,
/// <summary>
/// The window is maximized.
/// </summary>
Maximized,
}
}
|
mit
|
C#
|
c971bfbb16cf6422033ac75eba25930145fe0676
|
Revert "Add cancellationToken"
|
CatPhat/Fabrik.SimpleBus
|
src/Fabrik.SimpleBus.Demo/Program.cs
|
src/Fabrik.SimpleBus.Demo/Program.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Fabrik.SimpleBus.Demo
{
class Program
{
static void Main(string[] args)
{
new Program().Run();
}
private void Run()
{
var bus = new InProcessBus();
// Delegate Handler
bus.Subscribe<string>(message => Console.WriteLine("Delegate Handler Received: {0}", message));
bus.Subscribe<string>(async (message, token) => await WriteMessageAsync(message, token));
// Strongly typed handler
bus.Subscribe<Message>(() => new MessageHandler());
// Strongly typed async handler
bus.Subscribe<Message>(() => new AsyncMessageHandler()); // will automatically be passed a cancellation token
Console.WriteLine("Enter a message\n");
string input;
while ((input = Console.ReadLine()) != "q")
{
var t2 = bus.SendAsync(input);
var t1 = bus.SendAsync(new Message { Body = input });
Task.WaitAll(t1, t2);
Console.WriteLine("\nEnter another message\n");
}
}
private Task WriteMessageAsync(string message, CancellationToken cancellationToken)
{
return Task.Delay(2000).ContinueWith(task => Console.WriteLine("Delegate Async Handler Received: {0}", message));
}
}
public class Message
{
public string Body { get; set; }
}
public class MessageHandler : IHandle<Message>
{
public void Handle(Message message)
{
Console.WriteLine("{0} Received message type: {1}", this.GetType().Name, typeof(Message).Name);
}
}
public class AsyncMessageHandler : IHandleAsync<Message>
{
public async Task HandleAsync(Message message, CancellationToken cancellationToken)
{
await Task.Delay(1000);
Console.WriteLine("{0} Received message type: {1}", this.GetType().Name, typeof(Message).Name);
}
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Fabrik.SimpleBus.Demo
{
class Program
{
static void Main(string[] args)
{
new Program().Run();
}
private void Run()
{
var bus = new InProcessBus();
// Delegate Handler
bus.Subscribe<string>(message => Console.WriteLine("Delegate Handler Received: {0}", message));
bus.Subscribe<string>(async (message, token) => await WriteMessageAsync(message, token));
// Strongly typed handler
bus.Subscribe<Message>(() => new MessageHandler());
// Strongly typed async handler
bus.Subscribe<Message>(() => new AsyncMessageHandler()); // will automatically be passed a cancellation token
Console.WriteLine("Enter a message\n");
string input;
while ((input = Console.ReadLine()) != "q")
{
var t2 = bus.SendAsync(input);
var t1 = bus.SendAsync(new Message { Body = input });
Task.WaitAll(t1, t2);
Console.WriteLine("\nEnter another message\n");
}
}
private Task WriteMessageAsync(string message, CancellationToken cancellationToken)
{
return Task.Delay(2000).ContinueWith(task => Console.WriteLine("Delegate Async Handler Received: {0}", message), cancellationToken);
}
}
public class Message
{
public string Body { get; set; }
}
public class MessageHandler : IHandle<Message>
{
public void Handle(Message message)
{
Console.WriteLine("{0} Received message type: {1}", this.GetType().Name, typeof(Message).Name);
}
}
public class AsyncMessageHandler : IHandleAsync<Message>
{
public async Task HandleAsync(Message message, CancellationToken cancellationToken)
{
await Task.Delay(1000);
Console.WriteLine("{0} Received message type: {1}", this.GetType().Name, typeof(Message).Name);
}
}
}
|
mit
|
C#
|
f9fed2672e04f41ec20fd236d6fae791bb6bbcbe
|
Tidy up class xmldoc and naming
|
peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework
|
osu.Framework/Graphics/Video/VideoTextureUpload.cs
|
osu.Framework/Graphics/Video/VideoTextureUpload.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics.Textures;
using osuTK.Graphics.ES30;
using FFmpeg.AutoGen;
using osu.Framework.Graphics.Primitives;
using SixLabors.ImageSharp.PixelFormats;
namespace osu.Framework.Graphics.Video
{
public unsafe class VideoTextureUpload : ITextureUpload
{
public readonly AVFrame* Frame;
private readonly FFmpegFuncs.AvFrameFreeDelegate freeFrameDelegate;
public ReadOnlySpan<Rgba32> Data => ReadOnlySpan<Rgba32>.Empty;
public int Level => 0;
public RectangleI Bounds { get; set; }
public PixelFormat Format => PixelFormat.Red;
/// <summary>
/// Sets the frame containing the data to be uploaded.
/// </summary>
/// <param name="frame">The frame to upload.</param>
/// <param name="freeFrameDelegate">A function to free the frame on disposal.</param>
public VideoTextureUpload(AVFrame* frame, FFmpegFuncs.AvFrameFreeDelegate freeFrameDelegate)
{
Frame = frame;
this.freeFrameDelegate = freeFrameDelegate;
}
#region IDisposable Support
public void Dispose()
{
fixed (AVFrame** ptr = &Frame)
freeFrameDelegate(ptr);
}
#endregion
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics.Textures;
using osuTK.Graphics.ES30;
using FFmpeg.AutoGen;
using osu.Framework.Graphics.Primitives;
using SixLabors.ImageSharp.PixelFormats;
namespace osu.Framework.Graphics.Video
{
public unsafe class VideoTextureUpload : ITextureUpload
{
public AVFrame* Frame;
private readonly FFmpegFuncs.AvFrameFreeDelegate freeFrame;
public ReadOnlySpan<Rgba32> Data => ReadOnlySpan<Rgba32>.Empty;
public int Level => 0;
public RectangleI Bounds { get; set; }
public PixelFormat Format => PixelFormat.Red;
/// <summary>
/// Sets the frame cotaining the data to be uploaded
/// </summary>
/// <param name="frame">The libav frame to upload.</param>
/// <param name="free">A function to free the frame on disposal.</param>
public VideoTextureUpload(AVFrame* frame, FFmpegFuncs.AvFrameFreeDelegate free)
{
Frame = frame;
freeFrame = free;
}
#region IDisposable Support
public void Dispose()
{
fixed (AVFrame** ptr = &Frame)
freeFrame(ptr);
}
#endregion
}
}
|
mit
|
C#
|
7a22041bc78598e90f5fb3cdb4dd6acde0c6be61
|
Add collections to ValueObject tests.
|
xavierjohn/Railway-oriented-programming
|
test/DomainDrivenDesignTests/ValueObject{T}Spec.cs
|
test/DomainDrivenDesignTests/ValueObject{T}Spec.cs
|
using CWiz.DomainDrivenDesign;
using System.Collections.Generic;
using Xunit;
namespace DomainDrivenDesignTests
{
public class Person : ValueObject<Person>
{
public Person(string firstName, string lastName, int age, List<string> phoneNumbers)
{
FirstName = firstName;
LastName = lastName;
Age = age;
PhoneNumbers = phoneNumbers;
}
public string FirstName { get; }
public string LastName { get; }
public int Age { get; }
public List<string> PhoneNumbers { get; }
}
public class ValueObject_T_Spec
{
[Fact]
public void Two_different_instances_of_a_value_object_with_same_values_should_be_equal()
{
var fname = "Xavier";
var lname = "John";
var age = 99;
var phoneNumbers = new List<string>() { "123-456-7890", "234-567-8901" };
var instance1 = new Person(fname, lname, age, phoneNumbers);
var instance2 = new Person(fname, lname, age, phoneNumbers);
Assert.Equal(instance1, instance2);
}
[Fact]
public void Two_value_object_with_different_values_should_be_different()
{
var phoneNumbers = new List<string>() { "123-456-7890", "234-567-8901" };
var instance1 = new Person("Xavier", "John", 99, phoneNumbers);
var instance2 = new Person("Space", "Ghost", 99, phoneNumbers);
Assert.NotEqual(instance1, instance2);
}
[Fact]
public void Two_value_objects_with_different_only_in_the_collection_should_be_different()
{
var fname = "Xavier";
var lname = "John";
var age = 99;
var phoneNumbers1 = new List<string>() { "123-456-7890", "234-567-8901" };
var phoneNumbers2 = new List<string>() { "123-456-7890" };
var instance1 = new Person(fname, lname, age, phoneNumbers1);
var instance2 = new Person(fname, lname, age, phoneNumbers2);
Assert.NotEqual(instance1, instance2);
}
}
}
|
using CWiz.DomainDrivenDesign;
using Xunit;
namespace DomainDrivenDesignTests
{
public class Person : ValueObject<Person>
{
public Person(string firstName, string lastName, int age)
{
FirstName = firstName;
LastName = lastName;
Age = age;
}
public string FirstName { get; }
public string LastName { get; }
public int Age { get; }
}
public class ValueObject_T_Spec
{
[Fact]
public void Two_different_instances_of_a_value_object_with_same_values_should_be_equal()
{
var fname = "Xavier";
var lname = "John";
var age = 99;
var instance1 = new Person(fname, lname, age);
var instance2 = new Person(fname, lname, age);
Assert.Equal(instance1, instance2);
}
[Fact]
public void Two_different_instances_of_a_value_object_with_different_values_should_be_different()
{
var instance1 = new Person("Xavier", "John", 99);
var instance2 = new Person("Space", "Ghost", 99);
Assert.NotEqual(instance1, instance2);
}
}
}
|
mit
|
C#
|
3e5d5ef46d42fdd14f2bf613a1893617bc77ebf4
|
Fix Spain test
|
petergaal/Holiday,martinjw/Holiday
|
tests/PublicHolidayTests/TestSpainPublicHoliday.cs
|
tests/PublicHolidayTests/TestSpainPublicHoliday.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PublicHoliday;
namespace PublicHolidayTests
{
[TestClass]
public class TestSpainPublicHoliday
{
[TestMethod]
public void TestGoodFriday()
{
var goodFriday = SpainPublicHoliday.GoodFriday(2006);
Assert.AreEqual(new DateTime(2006, 4, 14), goodFriday);
}
[TestMethod]
public void TestNextWorkingDay()
{
var result = new SpainPublicHoliday().NextWorkingDay(new DateTime(2006, 07, 15));
Assert.AreEqual(new DateTime(2006, 07, 17), result); //Monday 17th
}
[TestMethod]
public void TestPublicHolidays()
{
var assumption = new DateTime(2006, 8, 15);
var result = new SpainPublicHoliday().PublicHolidayNames(2006);
Assert.AreEqual(10, result.Count);
Assert.IsTrue(result.ContainsKey(assumption));
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PublicHoliday;
namespace PublicHolidayTests
{
[TestClass]
public class TestSpainPublicHoliday
{
[TestMethod]
public void TestGoodFriday()
{
var ascension = SpainPublicHoliday.GoodFriday(2006);
Assert.AreEqual(new DateTime(2006, 4, 14), ascension);
}
[TestMethod]
public void TestNextWorkingDay()
{
var result = new SpainPublicHoliday().NextWorkingDay(new DateTime(2006, 07, 15));
Assert.AreEqual(new DateTime(2006, 07, 17), result); //Monday 17th
}
[TestMethod]
public void TestPublicHolidays()
{
var assumption = new DateTime(2006, 7, 15);
var result = new SpainPublicHoliday().PublicHolidayNames(2006);
Assert.AreEqual(10, result.Count);
Assert.IsTrue(result.ContainsKey(assumption));
}
}
}
|
mit
|
C#
|
11f0b4c6fab0d825102fe1fa08618d19a6fb46c9
|
Improve error messages for invalid Guids in ItemData
|
dsolovay/AutoSitecore
|
src/AutoSitecore/ItemDataAttribute.cs
|
src/AutoSitecore/ItemDataAttribute.cs
|
using System;
using Sitecore.Data;
namespace AutoSitecore
{
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public class ItemDataAttribute : Attribute
{
public static readonly ItemDataAttribute Null = new ItemDataAttribute();
public ItemDataAttribute(string name=null, string itemId = null, string templateId= null)
{
Name = name;
ItemId = ID.Parse(itemId, ID.Undefined);
TemplateId = ID.Parse(templateId, ID.Undefined);
}
public string Name { get; }
public ID TemplateId { get; }
public ID ItemId { get; }
}
}
|
using System;
using Sitecore.Data;
namespace AutoSitecore
{
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public class ItemDataAttribute : Attribute
{
public static readonly ItemDataAttribute Null = new ItemDataAttribute();
public ItemDataAttribute(string name=null, string id = null, string templateId= null)
{
this.Name = name;
ID result;
if (ID.TryParse(templateId, out result))
{
TemplateId = result;
}
else
{
TemplateId = ID.Null;
}
ID result2;
if (ID.TryParse(id, out result2))
{
ItemId = result2;
}
else
{
ItemId = ID.Undefined;
}
}
public string Name { get; }
public ID TemplateId { get; }
public ID ItemId { get; }
}
}
|
mit
|
C#
|
0807b03ffcabdc9b28bc0582b1aa4de4af370c61
|
Upgrade version to 1.3.1
|
geffzhang/equeue,tangxuehua/equeue,tangxuehua/equeue,tangxuehua/equeue,geffzhang/equeue,Aaron-Liu/equeue,Aaron-Liu/equeue
|
src/EQueue/Properties/AssemblyInfo.cs
|
src/EQueue/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.1")]
[assembly: AssemblyFileVersion("1.3.1")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0")]
[assembly: AssemblyFileVersion("1.3.0")]
|
mit
|
C#
|
755cfe17b9e11b7e7928825f18a4ca95151087ff
|
fix crash
|
nerai/CMenu
|
src/ExampleMenu/Procedures/MI_Call.cs
|
src/ExampleMenu/Procedures/MI_Call.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using ConsoleMenu;
namespace ExampleMenu
{
public class MI_Call : CMenuItem
{
private readonly CMenu _Menu;
private readonly ProcManager _Mgr;
public MI_Call (CMenu menu, ProcManager mgr)
: base ("call")
{
_Menu = menu;
_Mgr = mgr;
}
public override MenuResult Execute (string arg)
{
List<string> lines;
if (!_Mgr.Procs.TryGetValue (arg, out lines)) {
Console.WriteLine ("Unknown procedure: " + arg);
}
IO.AddInput (CreateInput (lines));
return MenuResult.Normal;
}
private IEnumerable<string> CreateInput (List<string> lines)
{
foreach (var line in lines) {
yield return line;
if (_Mgr.ShouldReturn) {
_Mgr.ShouldReturn = false;
break;
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using ConsoleMenu;
namespace ExampleMenu
{
public class MI_Call : CMenuItem
{
private readonly CMenu _Menu;
private readonly ProcManager _Mgr;
public MI_Call (CMenu menu, ProcManager mgr)
: base ("call")
{
_Menu = menu;
_Mgr = mgr;
}
public override MenuResult Execute (string arg)
{
// todo error checks
var lines = _Mgr.Procs[arg];
IO.AddInput (CreateInput (lines));
return MenuResult.Normal;
}
private IEnumerable<string> CreateInput (List<string> lines)
{
foreach (var line in lines) {
yield return line;
if (_Mgr.ShouldReturn) {
_Mgr.ShouldReturn = false;
break;
}
}
}
}
}
|
mit
|
C#
|
2bddaeb4a4fb04975588c94482eff23097c4c5c4
|
Reorder lines within Advance to no longer interleve two distinct operations in play: advancing the input span by `length` items, and then analyzing the items advanced over to update the Position. This is a step towards extracting a method for each of the two distinct operations.
|
plioi/parsley
|
src/Parsley/ReadOnlySpanExtensions.cs
|
src/Parsley/ReadOnlySpanExtensions.cs
|
namespace Parsley;
public static class ReadOnlySpanExtensions
{
public static ReadOnlySpan<char> Peek(this ref ReadOnlySpan<char> input, int length)
=> length >= input.Length
? input.Slice(0)
: input.Slice(0, length);
public static void Advance(this ref ReadOnlySpan<char> input, ref Position position, int length)
{
var peek = input.Peek(length);
input = input.Slice(peek.Length);
int lineDelta = 0;
int columnDelta = 0;
foreach (var ch in peek)
{
if (ch == '\n')
{
lineDelta++;
columnDelta = 0 - position.Column;
}
columnDelta++;
}
position = new Position(position.Line + lineDelta, position.Column + columnDelta);
}
public static ReadOnlySpan<char> TakeWhile(this ref ReadOnlySpan<char> input, Predicate<char> test)
{
int i = 0;
while (i < input.Length && test(input[i]))
i++;
return input.Peek(i);
}
}
|
namespace Parsley;
public static class ReadOnlySpanExtensions
{
public static ReadOnlySpan<char> Peek(this ref ReadOnlySpan<char> input, int length)
=> length >= input.Length
? input.Slice(0)
: input.Slice(0, length);
public static void Advance(this ref ReadOnlySpan<char> input, ref Position position, int length)
{
int lineDelta = 0;
int columnDelta = 0;
var peek = input.Peek(length);
foreach (var ch in peek)
{
if (ch == '\n')
{
lineDelta++;
columnDelta = 0 - position.Column;
}
columnDelta++;
}
input = input.Slice(peek.Length);
position = new Position(position.Line + lineDelta, position.Column + columnDelta);
}
public static ReadOnlySpan<char> TakeWhile(this ref ReadOnlySpan<char> input, Predicate<char> test)
{
int i = 0;
while (i < input.Length && test(input[i]))
i++;
return input.Peek(i);
}
}
|
mit
|
C#
|
d79c60f26239cf4be08ef61a6e059851bd2fb3c3
|
correct api id
|
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 string RequestUuid { 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" +
"RequestUuid: " + RequestUuid + "\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; }
public string RequestUuid { 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" +
"RequestUuid: " + RequestUuid + "\n";
}
}
}
|
mit
|
C#
|
96bfb0d997d5e54a15850d85e53a33d1a7c53ad4
|
Remove PasswordMode and PasswordChar from interface definition
|
tsolarin/readline,tsolarin/readline
|
src/ReadLine/Abstractions/IConsole.cs
|
src/ReadLine/Abstractions/IConsole.cs
|
namespace Internal.ReadLine.Abstractions
{
internal interface IConsole
{
int CursorLeft { get; }
int CursorTop { get; }
int BufferWidth { get; }
int BufferHeight { get; }
void SetCursorPosition(int left, int top);
void SetBufferSize(int width, int height);
void Write(string value);
void WriteLine(string value);
}
}
|
namespace Internal.ReadLine.Abstractions
{
internal interface IConsole
{
int CursorLeft { get; }
int CursorTop { get; }
int BufferWidth { get; }
int BufferHeight { get; }
bool PasswordMode { get; set; }
char PasswordChar { get; set; }
void SetCursorPosition(int left, int top);
void SetBufferSize(int width, int height);
void Write(string value);
void WriteLine(string value);
}
}
|
mit
|
C#
|
0fe1ace51da92c9c6b13b344055fb010cb0da580
|
Bump the versino (#340)
|
RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,RachelTucker/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/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("5.0.5.0")]
[assembly: AssemblyFileVersion("5.0.5.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("5.0.4.0")]
[assembly: AssemblyFileVersion("5.0.4.0")]
|
apache-2.0
|
C#
|
fb0be11930a8e37e971e6e26e48c16ba71cf7c3e
|
Add dbus-sharp-glib to friend assemblies
|
arfbtwn/dbus-sharp,openmedicus/dbus-sharp,mono/dbus-sharp,Tragetaschen/dbus-sharp,Tragetaschen/dbus-sharp,mono/dbus-sharp,openmedicus/dbus-sharp,arfbtwn/dbus-sharp
|
src/AssemblyInfo.cs
|
src/AssemblyInfo.cs
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System.Reflection;
using System.Runtime.CompilerServices;
//[assembly: AssemblyVersion("0.0.0.*")]
[assembly: AssemblyTitle ("NDesk.DBus")]
[assembly: AssemblyDescription ("D-Bus IPC protocol library and CLR binding")]
[assembly: AssemblyCopyright ("Copyright (C) Alp Toker")]
[assembly: AssemblyCompany ("NDesk")]
[assembly: InternalsVisibleTo ("dbus-sharp-glib")]
[assembly: InternalsVisibleTo ("dbus-monitor")]
[assembly: InternalsVisibleTo ("dbus-daemon")]
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System.Reflection;
using System.Runtime.CompilerServices;
//[assembly: AssemblyVersion("0.0.0.*")]
[assembly: AssemblyTitle ("NDesk.DBus")]
[assembly: AssemblyDescription ("D-Bus IPC protocol library and CLR binding")]
[assembly: AssemblyCopyright ("Copyright (C) Alp Toker")]
[assembly: AssemblyCompany ("NDesk")]
[assembly: InternalsVisibleTo ("dbus-monitor")]
[assembly: InternalsVisibleTo ("dbus-daemon")]
|
mit
|
C#
|
3b66843ab6fbe1918eeeb7f1cacca46cef4249f6
|
Fix home link
|
Azure/fieldengineer,lindydonna/fieldengineer,benlam62/app-service-mobile-dotnet-fieldengineer,Azure-Samples/app-service-mobile-dotnet-fieldengineer,Azure-Samples/app-service-mobile-donet-fieldengineer
|
server/FieldEngineer/Views/Shared/_Layout.cshtml
|
server/FieldEngineer/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Field Engineer", "Index", "Admin", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Fabrikam</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Field Engineer", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Fabrikam</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
8404d4cf90b45de6fcaab773f2e4e4b0fdfea4eb
|
Update JsonConfigMapper
|
atata-framework/atata-configuration-json
|
src/Atata.Configuration.Json/JsonConfigMapper.cs
|
src/Atata.Configuration.Json/JsonConfigMapper.cs
|
using System;
namespace Atata
{
public static class JsonConfigMapper
{
public static AtataContextBuilder Map<TConfig>(TConfig config, AtataContextBuilder builder)
where TConfig : JsonConfig<TConfig>
{
if (config.BaseUrl != null)
builder.UseBaseUrl(config.BaseUrl);
if (config.RetryTimeout != null)
builder.UseRetryTimeout(TimeSpan.FromSeconds(config.RetryTimeout.Value));
if (config.RetryInterval != null)
builder.UseRetryInterval(TimeSpan.FromSeconds(config.RetryInterval.Value));
if (config.AssertionExceptionTypeName != null)
builder.UseAssertionExceptionType(Type.GetType(config.AssertionExceptionTypeName, true));
if (config.UseNUnitTestName)
builder.UseNUnitTestName();
if (config.LogNUnitError)
builder.LogNUnitError();
if (config.TakeScreenshotOnNUnitError)
{
if (config.TakeScreenshotOnNUnitErrorTitle != null)
builder.TakeScreenshotOnNUnitError(config.TakeScreenshotOnNUnitErrorTitle);
else
builder.TakeScreenshotOnNUnitError();
}
if (config.LogConsumers != null)
{
foreach (var item in config.LogConsumers)
MapLogConsumer(item, builder);
}
return builder;
}
private static void MapLogConsumer(LogConsumerJsonSection logConsumerSection, AtataContextBuilder builder)
{
Type type = ResolveLogConsumerType(logConsumerSection.TypeName);
ILogConsumer logConsumer = (ILogConsumer)Activator.CreateInstance(type);
if (logConsumerSection.MinLevel != null)
;
if (logConsumerSection.SectionFinish == false)
;
}
private static Type ResolveLogConsumerType(string typeName)
{
//// Check log consumer aliases.
return Type.GetType(typeName);
}
}
}
|
using System;
namespace Atata
{
public static class JsonConfigMapper
{
public static AtataContextBuilder Map<TConfig>(TConfig config, AtataContextBuilder builder)
where TConfig : JsonConfig<TConfig>
{
if (config.BaseUrl != null)
builder.UseBaseUrl(config.BaseUrl);
if (config.RetryTimeout != null)
builder.UseRetryTimeout(TimeSpan.FromSeconds(config.RetryTimeout.Value));
if (config.RetryInterval != null)
builder.UseRetryInterval(TimeSpan.FromSeconds(config.RetryInterval.Value));
if (config.AssertionExceptionTypeName != null)
builder.UseAssertionExceptionType(Type.GetType(config.AssertionExceptionTypeName));
if (config.UseNUnitTestName)
builder.UseNUnitTestName();
if (config.LogNUnitError)
builder.LogNUnitError();
if (config.TakeScreenshotOnNUnitError)
{
if (config.TakeScreenshotOnNUnitErrorTitle != null)
builder.TakeScreenshotOnNUnitError(config.TakeScreenshotOnNUnitErrorTitle);
else
builder.TakeScreenshotOnNUnitError();
}
if (config.LogConsumers != null)
{
foreach (var item in config.LogConsumers)
MapLogConsumer(item, builder);
}
return builder;
}
private static void MapLogConsumer(LogConsumerJsonSection logConsumerSection, AtataContextBuilder builder)
{
Type type = ResolveLogConsumerType(logConsumerSection.TypeName);
ILogConsumer logConsumer = (ILogConsumer)Activator.CreateInstance(type);
if (logConsumerSection.MinLevel != null)
;
if (logConsumerSection.SectionFinish == false)
;
}
private static Type ResolveLogConsumerType(string typeName)
{
//// Check log consumer aliases.
return Type.GetType(typeName);
}
}
}
|
apache-2.0
|
C#
|
468f81eaae4dcf81eb416d77cc88634d0d5a4f98
|
Add CompetitionPlatformUser to Identity models.
|
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
|
src/CompetitionPlatform/Models/IdentityModels.cs
|
src/CompetitionPlatform/Models/IdentityModels.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CompetitionPlatform.Models
{
public class AuthenticateModel
{
public string FullName { get; set; }
public string Password { get; set; }
}
public class CompetitionPlatformUser
{
public string Email { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string GetFullName()
{
return FirstName + " " + LastName;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CompetitionPlatform.Models
{
public class AuthenticateModel
{
public string FullName { get; set; }
public string Password { get; set; }
}
}
|
mit
|
C#
|
abc443775635a8e5d3244c71bd1f00959dc7d398
|
fix sln usage in msbuild
|
NServiceBusSqlPersistence/NServiceBus.SqlPersistence
|
src/Integration/Shared/SqlPersistenceSettings.cs
|
src/Integration/Shared/SqlPersistenceSettings.cs
|
using NServiceBus.Persistence.Sql;
[assembly: SqlPersistenceSettings(
MsSqlServerScripts = true,
MySqlScripts = true,
OracleScripts = true,
PostgreSqlScripts = true,
ScriptPromotionPath = @"$(SolutionDir)Integration\PromotedSqlScripts")]
|
using NServiceBus.Persistence.Sql;
[assembly: SqlPersistenceSettings(
MsSqlServerScripts = true,
MySqlScripts = true,
OracleScripts = true,
ScriptPromotionPath = @"$(SolutionDir)Integration\PromotedSqlScripts")]
|
mit
|
C#
|
8b97f3f847b993ac4c15586dc7414b10589ee463
|
Add PATCH to http verbs enumeration
|
nikhilk/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp
|
src/Libraries/Node/Node.Core/Network/HttpVerb.cs
|
src/Libraries/Node/Node.Core/Network/HttpVerb.cs
|
// IPAddressType.cs
// Script#/Libraries/Node/Core
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//
using System;
using System.Runtime.CompilerServices;
namespace NodeApi.Network {
[ScriptImport]
[ScriptIgnoreNamespace]
[ScriptConstants(UseNames = true)]
public enum HttpVerb {
GET,
PUT,
POST,
DELETE,
HEAD,
OPTIONS,
PATCH
}
}
|
// IPAddressType.cs
// Script#/Libraries/Node/Core
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//
using System;
using System.Runtime.CompilerServices;
namespace NodeApi.Network {
[ScriptImport]
[ScriptIgnoreNamespace]
[ScriptConstants(UseNames = true)]
public enum HttpVerb {
GET,
PUT,
POST,
DELETE,
HEAD,
OPTIONS
}
}
|
apache-2.0
|
C#
|
ff5897fac1f6e2c9d94fdb5dc958b0ff32a1dbcd
|
disable caching of ajax call in sample project
|
romansp/MiniProfiler.Elasticsearch
|
src/Sample.Elasticsearch/Views/Home/Index.cshtml
|
src/Sample.Elasticsearch/Views/Home/Index.cshtml
|
@{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a>
</p>
<p><a href="#" id="ajax" class="btn btn-success btn-lg">Do ES Ajax call</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a>
</p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a>
</p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a>
</p>
</div>
</div>
@section scripts{
<script>
$('#ajax').click(function() {
$.ajax('@Url.Action("Ajax")', {
cache: false,
data: {
message: "Hello ajax!"
}
});
});
</script>
}
|
@{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a>
</p>
<p><a href="#" id="ajax" class="btn btn-success btn-lg">Do ES Ajax call</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a>
</p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a>
</p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a>
</p>
</div>
</div>
@section scripts{
<script>
$('#ajax').click(function() {
$.ajax('@Url.Action("Ajax")', {
data: {
message: "Hello ajax!"
}
});
});
</script>
}
|
mit
|
C#
|
656d79dc0864a6d21fbe9a04c0b1e67d06e64b85
|
Add null check
|
k2workflow/Clay
|
src/SourceCode.Clay.Correlation/CorrelationId.cs
|
src/SourceCode.Clay.Correlation/CorrelationId.cs
|
using System;
using System.Diagnostics;
using System.Globalization;
using SourceCode.Clay.Correlation.Internal;
namespace SourceCode.Clay.Correlation
{
/// <summary>
/// Factory methods for creating a <see cref="ICorrelationIdAccessor"/> instance.
/// </summary>
public static class CorrelationId
{
/// <summary>
/// Creates a <see cref="ICorrelationIdAccessor"/> instance using a constant <see cref="string"/> value.
/// </summary>
/// <param name="correlationId">The constant <see cref="string"/> value to use as the correlation identifier.</param>
[DebuggerStepThrough]
public static ICorrelationIdAccessor From(string correlationId)
=> new ConstantAccessor(correlationId);
/// <summary>
/// Creates a <see cref="ICorrelationIdAccessor"/> instance using a constant <see cref="Guid"/> value.
/// The value will be converted to a string using the "D" format specifier ("00000000-0000-0000-0000-000000000000").
/// </summary>
/// <param name="correlationId">The constant <see cref="Guid"/> value to use as the correlation identifier.</param>
[DebuggerStepThrough]
public static ICorrelationIdAccessor From(Guid correlationId)
=> new ConstantAccessor(correlationId.ToString("D", CultureInfo.InvariantCulture));
/// <summary>
/// Creates a <see cref="ICorrelationIdAccessor"/> instance using an expression that is
/// re-evaluated each time it is called.
/// </summary>
/// <param name="getter">The function that returns the correlationId.</param>
[DebuggerStepThrough]
public static ICorrelationIdAccessor From(Func<string> getter)
{
if (getter == null) throw new ArgumentNullException(nameof(getter));
return new LambdaAccessor(getter);
}
}
}
|
using System;
using System.Diagnostics;
using System.Globalization;
using SourceCode.Clay.Correlation.Internal;
namespace SourceCode.Clay.Correlation
{
/// <summary>
/// Factory methods for creating a <see cref="ICorrelationIdAccessor"/> instance.
/// </summary>
public static class CorrelationId
{
/// <summary>
/// Creates a <see cref="ICorrelationIdAccessor"/> instance using a constant value.
/// </summary>
/// <param name="correlationId">The constant <see cref="string"/> value to use as the correlation identifier.</param>
[DebuggerStepThrough]
public static ICorrelationIdAccessor From(string correlationId)
=> new ConstantAccessor(correlationId);
/// <summary>
/// Creates a <see cref="ICorrelationIdAccessor"/> instance using a constant value.
/// </summary>
/// <param name="correlationId">The constant <see cref="Guid"/> value to use as the correlation identifier.</param>
[DebuggerStepThrough]
public static ICorrelationIdAccessor From(Guid correlationId)
=> new ConstantAccessor(correlationId.ToString("D", CultureInfo.InvariantCulture));
/// <summary>
/// Creates a <see cref="ICorrelationIdAccessor"/> instance using an expression that is evaluated every time it is called.
/// </summary>
/// <param name="getter">The function that returns the correlationId.</param>
[DebuggerStepThrough]
public static ICorrelationIdAccessor From(Func<string> getter)
=> new LambdaAccessor(getter);
}
}
|
mit
|
C#
|
ba03a63a9892714a58f938fbcfe2d9e239cc68cb
|
add request uuid
|
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 string RequestUuid { 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" +
"RequestUuid: " + RequestUuid + "\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; }
}
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";
}
}
|
mit
|
C#
|
ba4c964455d2696a5c8a14d4c037a09670f676f4
|
Update login page
|
arvaris/HRI-Umbraco,Door3Dev/HRI-Umbraco,Door3Dev/HRI-Umbraco,Door3Dev/HRI-Umbraco,arvaris/HRI-Umbraco,arvaris/HRI-Umbraco,arvaris/HRI-Umbraco,Door3Dev/HRI-Umbraco,Door3Dev/HRI-Umbraco
|
src/Umbraco.Web.UI/Views/Login.cshtml
|
src/Umbraco.Web.UI/Views/Login.cshtml
|
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "MasterPage.cshtml";
}
@model Umbraco.Web.UI.Models.LoginViewModel
<div id="hri-content" class="hri-login">
<div class="row-fluid">
<div class="span4 offset4 well">
<h3 class="dark-purple">Member Login</h3>
<form id="login_form" method="POST" action="" data-validate="parsley">
<label>
Username<br>
<input data-trigger="focusout" id="id_username" maxlength="254" name="username" type="text">
</label>
<label>
Password<br>
<input data-trigger="focusout" id="id_password" name="password" type="password">
</label>
<input id="login_submit" type="submit" class="btn hri-btn" value="Submit">
</form>
Enrolled in a Health Republic Plan? <a href="/user/register">Register for an account.</a>
<br><br>
Forgot <a href="/user/forgot/username">Username?</a> <span>|</span>
Forgot <a href="/user/forgot/password">Password?</a><br>
Resend <a href="/user/re-send-email-verification-link">Email Verification Link</a>
<br><br>
If you are having trouble logging in or registering, call us at <b>888.990.5702</b>.
</div>
</div>
</div>
|
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "MasterPage.cshtml";
}
@model Umbraco.Web.UI.Models.LoginViewModel
some code stuffs
|
mit
|
C#
|
256c6a0071bfa6fefbfec871af326b05ee3e2c5e
|
Clean RewardGetter
|
bunashibu/kikan
|
Assets/Scripts/Skill/RewardGetter.cs
|
Assets/Scripts/Skill/RewardGetter.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RewardGetter : MonoBehaviour {
public void SetRewardReceiver(GameObject receiver, int team) {
_receiver = receiver;
_receiveTeam = team;
}
public void GetRewardFrom(GameObject target) {
var teammateList = GetTeammateList();
int teamSize = teammateList.Count;
double ratio = 1;
if (teamSize == 1)
ratio = 0.7;
if (teamSize == 2)
ratio = 0.6;
var killExp = target.GetComponent<KillReward>().Exp;
var killGold = target.GetComponent<KillReward>().Gold;
int receiverExp = (int)(killExp * ratio);
int receiverGold = (int)(killGold * ratio);
GiveExpToReceiver(receiverExp);
GiveGoldToReceiver(receiverGold);
if (teamSize > 0) {
int teammateExp = (int)((killExp - receiverExp) / teamSize);
int teammateGold = (int)((killGold - receiverGold) / teamSize);
GiveExpToTeammate(teammateExp, teammateList);
GiveGoldToTeammate(teammateGold, teammateList);
}
}
private List<GameObject> GetTeammateList() {
var teammateList = new List<GameObject>();
foreach (var player in PhotonNetwork.playerList) {
var team = (int)player.CustomProperties["Team"];
if (team == _receiveTeam) {
var viewID = (int)player.CustomProperties["ViewID"];
var teammate = PhotonView.Find(viewID).gameObject;
if (teammate != _receiver)
teammateList.Add(teammate);
}
}
return teammateList;
}
private void GiveExpToReceiver(int exp) {
var nextExp = _receiver.GetComponent<PlayerNextExp>();
nextExp.Plus(exp);
nextExp.UpdateView();
}
private void GiveGoldToReceiver(int gold) {
var playerGold = _receiver.GetComponent<PlayerGold>();
playerGold.Plus(gold);
playerGold.UpdateView();
}
private void GiveExpToTeammate(int exp, List<GameObject> teammateList) {
foreach (var teammate in teammateList) {
var nextExp = teammate.GetComponent<PlayerNextExp>();
nextExp.Plus(exp);
nextExp.UpdateView();
}
}
private void GiveGoldToTeammate(int gold, List<GameObject> teammateList) {
foreach (var teammate in teammateList) {
var playerGold = teammate.GetComponent<PlayerGold>();
playerGold.Plus(gold);
playerGold.UpdateView();
}
}
private GameObject _receiver;
private int _receiveTeam;
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RewardGetter : MonoBehaviour {
public void SetRewardReceiver(GameObject receiver, int team) {
_receiver = receiver;
_receiveTeam = team;
}
public void GetRewardFrom(GameObject target) {
var teammateList = GetTeammateList();
var killExp = target.GetComponent<KillReward>().Exp;
var killGold = target.GetComponent<KillReward>().Gold;
int size = teammateList.Count;
double ratio = 1;
if (size == 1)
ratio = 0.7;
if (size == 2)
ratio = 0.6;
int receiverExp = (int)(killExp * ratio);
int receiverGold = (int)(killGold * ratio);
GiveExpToReceiver(receiverExp);
GiveGoldToReceiver(receiverGold);
if (size > 0) {
int teammateExp = (int)((killExp - receiverExp) / size);
int teammateGold = (int)((killGold - receiverGold) / size);
GiveExpToTeammate(teammateExp, teammateList);
GiveGoldToTeammate(teammateGold, teammateList);
}
}
private List<GameObject> GetTeammateList() {
var teammateList = new List<GameObject>();
foreach (var player in PhotonNetwork.playerList) {
var team = (int)player.CustomProperties["Team"];
if (team == _receiveTeam) {
var viewID = (int)player.CustomProperties["ViewID"];
var teammate = PhotonView.Find(viewID).gameObject;
if (teammate != _receiver)
teammateList.Add(teammate);
}
}
return teammateList;
}
private void GiveExpToReceiver(int exp) {
var nextExp = _receiver.GetComponent<PlayerNextExp>();
nextExp.Plus(exp);
nextExp.UpdateView();
}
private void GiveGoldToReceiver(int gold) {
var playerGold = _receiver.GetComponent<PlayerGold>();
playerGold.Plus(gold);
playerGold.UpdateView();
}
private void GiveExpToTeammate(int exp, List<GameObject> teammateList) {
foreach (var teammate in teammateList) {
var nextExp = teammate.GetComponent<PlayerNextExp>();
nextExp.Plus(exp);
nextExp.UpdateView();
}
}
private void GiveGoldToTeammate(int gold, List<GameObject> teammateList) {
foreach (var teammate in teammateList) {
var playerGold = teammate.GetComponent<PlayerGold>();
playerGold.Plus(gold);
playerGold.UpdateView();
}
}
private GameObject _receiver;
private int _receiveTeam;
}
|
mit
|
C#
|
49a0b07583a070922e33fe4c3dfd25c4048c4908
|
Exit program.
|
hfoffani/hypolambda
|
LLconsole/Program.cs
|
LLconsole/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LLconsole {
class Program {
static void run(string program) {
try {
var exp = new LambdaLang.Expression();
exp.SetExpression(program);
var res = exp.Solve();
Console.WriteLine(">>> " + res.ToString());
if (exp.LastError != "") {
Console.WriteLine(exp.LastError);
}
} catch (Exception e) {
Console.WriteLine();
Console.WriteLine(e.Message);
}
}
static void loop() {
string l;
Console.WriteLine("... Enter a LambdaLang expression or program.");
Console.WriteLine("... ENTER to execute. ^Z ENTER to exit.");
do {
Console.WriteLine("");
var pg = "";
do {
l = Console.ReadLine();
if (l != null)
pg += l;
} while (l != null && l != "");
if (string.IsNullOrEmpty(pg))
return;
run(pg);
} while (l != null);
}
static void Main(string[] args) {
// var p = "f = lambda (v): ( (v*f(v-1)) if v > 1 else 1 ); f(4)";
// run(p);
loop();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LLconsole {
class Program {
static void run(string program) {
try {
var exp = new LambdaLang.Expression();
exp.SetExpression(program);
var res = exp.Solve();
Console.WriteLine();
Console.WriteLine(res.ToString());
if (exp.LastError != "") {
Console.WriteLine(exp.LastError);
}
} catch (Exception e) {
Console.WriteLine();
Console.WriteLine(e.Message);
}
}
static void loop() {
string l;
do {
Console.WriteLine("... Enter a LambdaLang expression or program.");
Console.WriteLine("... ENTER ENTER to run. ^Z ENTER to exit.");
var pg = "";
do {
l = Console.ReadLine();
if (l != null)
pg += l;
} while (l != null && l != "");
if (!string.IsNullOrEmpty(pg))
run(pg);
} while (l != null);
}
static void Main(string[] args) {
// var p = "f = lambda (v): ( (v*f(v-1)) if v > 1 else 1 ); f(4)";
// run(p);
loop();
}
}
}
|
apache-2.0
|
C#
|
64c2cedabfb0e6cb61ee07c0c8c156a06a19c0f1
|
Add back typescript gotodef on the client.
|
tannergooding/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,diryboy/roslyn,eriawan/roslyn,reaction1989/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,abock/roslyn,panopticoncentral/roslyn,heejaechang/roslyn,reaction1989/roslyn,tannergooding/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,agocke/roslyn,physhi/roslyn,jmarolf/roslyn,jmarolf/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,genlu/roslyn,physhi/roslyn,CyrusNajmabadi/roslyn,aelij/roslyn,gafter/roslyn,jasonmalinowski/roslyn,eriawan/roslyn,nguerrera/roslyn,genlu/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,panopticoncentral/roslyn,AmadeusW/roslyn,dotnet/roslyn,abock/roslyn,wvdd007/roslyn,brettfo/roslyn,eriawan/roslyn,nguerrera/roslyn,bartdesmet/roslyn,nguerrera/roslyn,tannergooding/roslyn,AmadeusW/roslyn,abock/roslyn,davkean/roslyn,davkean/roslyn,ErikSchierboom/roslyn,gafter/roslyn,brettfo/roslyn,davkean/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,brettfo/roslyn,jmarolf/roslyn,KirillOsenkov/roslyn,wvdd007/roslyn,AmadeusW/roslyn,sharwell/roslyn,tmat/roslyn,reaction1989/roslyn,stephentoub/roslyn,shyamnamboodiripad/roslyn,agocke/roslyn,tmat/roslyn,stephentoub/roslyn,mavasani/roslyn,sharwell/roslyn,aelij/roslyn,bartdesmet/roslyn,mgoertz-msft/roslyn,diryboy/roslyn,diryboy/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn,aelij/roslyn,agocke/roslyn,ErikSchierboom/roslyn,panopticoncentral/roslyn,wvdd007/roslyn,weltkante/roslyn,KirillOsenkov/roslyn,weltkante/roslyn,KevinRansom/roslyn,dotnet/roslyn,heejaechang/roslyn,genlu/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,dotnet/roslyn,ErikSchierboom/roslyn,tmat/roslyn,gafter/roslyn,mavasani/roslyn,mgoertz-msft/roslyn
|
src/Tools/ExternalAccess/LiveShare/GotoDefinition/RoslynGotoDefinitionService.Exports.cs
|
src/Tools/ExternalAccess/LiveShare/GotoDefinition/RoslynGotoDefinitionService.Exports.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Composition;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.GotoDefinition
{
[ExportLanguageService(typeof(IGoToDefinitionService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspGotoDefinitionService : RoslynGotoDefinitionService
{
[ImportingConstructor]
public CSharpLspGotoDefinitionService(IStreamingFindUsagesPresenter streamingPresenter, CSharpLspClientServiceFactory csharpLspClientServiceFactory,
RemoteLanguageServiceWorkspace remoteWorkspace, IThreadingContext threadingContext)
: base(streamingPresenter, csharpLspClientServiceFactory, remoteWorkspace, threadingContext) { }
}
[ExportLanguageService(typeof(IGoToDefinitionService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspGotoDefinitionService : RoslynGotoDefinitionService
{
[ImportingConstructor]
public VBLspGotoDefinitionService(IStreamingFindUsagesPresenter streamingPresenter, VisualBasicLspClientServiceFactory vbLspClientServiceFactory,
RemoteLanguageServiceWorkspace remoteWorkspace, IThreadingContext threadingContext)
: base(streamingPresenter, vbLspClientServiceFactory, remoteWorkspace, threadingContext) { }
}
[ExportLanguageService(typeof(IGoToDefinitionService), StringConstants.TypeScriptLanguageName, WorkspaceKind.AnyCodeRoslynWorkspace), Shared]
internal class TypeScriptLspGotoDefinitionService : RoslynGotoDefinitionService
{
[ImportingConstructor]
public TypeScriptLspGotoDefinitionService(IStreamingFindUsagesPresenter streamingPresenter, TypeScriptLspClientServiceFactory typeScriptLspClientServiceFactory,
RemoteLanguageServiceWorkspace remoteWorkspace, IThreadingContext threadingContext)
: base(streamingPresenter, typeScriptLspClientServiceFactory, remoteWorkspace, threadingContext)
{
}
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Composition;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.GotoDefinition
{
[ExportLanguageService(typeof(IGoToDefinitionService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspGotoDefinitionService : RoslynGotoDefinitionService
{
[ImportingConstructor]
public CSharpLspGotoDefinitionService(IStreamingFindUsagesPresenter streamingPresenter, CSharpLspClientServiceFactory csharpLspClientServiceFactory,
RemoteLanguageServiceWorkspace remoteWorkspace, IThreadingContext threadingContext)
: base(streamingPresenter, csharpLspClientServiceFactory, remoteWorkspace, threadingContext) { }
}
[ExportLanguageService(typeof(IGoToDefinitionService), StringConstants.VBLspLanguageName), Shared]
internal class VBLspGotoDefinitionService : RoslynGotoDefinitionService
{
[ImportingConstructor]
public VBLspGotoDefinitionService(IStreamingFindUsagesPresenter streamingPresenter, VisualBasicLspClientServiceFactory vbLspClientServiceFactory,
RemoteLanguageServiceWorkspace remoteWorkspace, IThreadingContext threadingContext)
: base(streamingPresenter, vbLspClientServiceFactory, remoteWorkspace, threadingContext) { }
}
}
|
mit
|
C#
|
ef0de5803501841530ae5f9e92442fbf27defb9c
|
update ConfigCore.cs
|
aliyun/aliyun-oss-csharp-sdk
|
test/Util/ConfigCore.cs
|
test/Util/ConfigCore.cs
|
using System.Configuration;
using System;
using System.IO;
namespace Aliyun.OSS.Test.Util
{
// Please update the values of the following variables before running the test cases;
public static class Config
{
public static readonly string Endpoint = ""; // your endpoint
public static readonly string AccessKeyId = ""; // your access key id
public static readonly string AccessKeySecret = ""; // your access key secret
public static readonly string ProxyHost = ""; // proxy host
public static readonly string ProxyPort = "3128";
public static readonly string ProxyUser = "";
public static readonly string ProxyPassword = "";
public static readonly string CallbackServer = ""; // callback server
public static readonly string DisabledAccessKeyId = "";
public static readonly string DisabledAccessKeySecret = "";
public static readonly string SecondEndpoint = "";
public static readonly string UploadTestFile = ""; // path to upload test file
public static readonly string MultiUploadTestFile = ""; // path to multi upload test file--it should be 1MB or bigger
public static readonly string ImageTestFile = ""; // path to upload test image file
public static readonly string DownloadFolder = ""; // path to download folder
}
}
|
using System.Configuration;
using System;
using System.IO;
namespace Aliyun.OSS.Test.Util
{
// Please update the values of the following variables before running the test cases;
public static class Config
{
public static readonly string Endpoint = "10.101.200.203:8086";
public static readonly string AccessKeyId = "LTAIJPXxMLocA0fD";
public static readonly string AccessKeySecret = "l8SjZPosYFR8cHn7jR05SOUFd2u0T7";
public static readonly string ProxyHost = "";
public static readonly string ProxyPort = "";
public static readonly string ProxyUser = "";
public static readonly string ProxyPassword = "";
public static readonly string CallbackServer = "";
public static readonly string DisabledAccessKeyId = "";
public static readonly string DisabledAccessKeySecret = "";
public static readonly string SecondEndpoint = "";
public static readonly string UploadTestFile = "/Users/qi.xu/Downloads/wikiticker-index.s3.json";
public static readonly string MultiUploadTestFile = "/Users/qi.xu/Documents/存储产品-日志服务-v1.pptx";
public static readonly string ImageTestFile = "/Users/qi.xu/Downloads/self.jpg";
public static readonly string DownloadFolder = "/Users/qi.xu/Downloads/CSharp";
}
}
|
mit
|
C#
|
ac29317ce3e87cf9a17cc5fd2502506f4d978435
|
fix LambdaHelper
|
shinji-yoshida/gotanda
|
gotanda/LambdaHelper.cs
|
gotanda/LambdaHelper.cs
|
using UnityEngine;
using System.Collections;
using System;
namespace gotanda{
public class LambdaHelper {
public static Action NullAction(){
int saveFromAOT = 0;
return () => saveFromAOT.GetHashCode();
}
public static Action<T> NullAction<T>(){
int saveFromAOT = 0;
return _ => saveFromAOT.GetHashCode();
}
}
}
|
using UnityEngine;
using System.Collections;
using System;
namespace gotanda{
public class LambdaHelper {
public static Action NullAction(){
return ()=>{};
}
public static Action<T> NullAction<T>(){
return (t)=>{};
}
}
}
|
mit
|
C#
|
bc1128729ac69b15aed6d14bf6edd4ff5242fd9d
|
Bump version to 0.10.0
|
ar3cka/Journalist
|
src/SolutionInfo.cs
|
src/SolutionInfo.cs
|
// <auto-generated/>
using System.Reflection;
[assembly: AssemblyProductAttribute("Journalist")]
[assembly: AssemblyVersionAttribute("0.10.0")]
[assembly: AssemblyInformationalVersionAttribute("0.10.0")]
[assembly: AssemblyFileVersionAttribute("0.10.0")]
[assembly: AssemblyCompanyAttribute("Anton Mednonogov")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.10.0";
}
}
|
// <auto-generated/>
using System.Reflection;
[assembly: AssemblyProductAttribute("Journalist")]
[assembly: AssemblyVersionAttribute("0.9.7")]
[assembly: AssemblyInformationalVersionAttribute("0.9.7")]
[assembly: AssemblyFileVersionAttribute("0.9.7")]
[assembly: AssemblyCompanyAttribute("Anton Mednonogov")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.9.7";
}
}
|
apache-2.0
|
C#
|
a5b8f8262a228944290b5d7e887a3442791e81cc
|
Update IScienceDataContainer.cs
|
Anatid/XML-Documentation-for-the-KSP-API
|
src/IScienceDataContainer.cs
|
src/IScienceDataContainer.cs
|
using System;
/// <summary>
/// Interface used by ModuleScienceExperiment and ModuleScienceContainer. Used for storing, transfering and transmitting Science Data.
/// </summary>
public interface IScienceDataContainer
{
/// <summary>
/// Removes science data from the part, called after transmission or EVA data collection.
/// </summary>
/// <param name="data"></param>
void DumpData(ScienceData data);
/// <summary>
/// Returns an array of all Science Data stored in the module.
/// </summary>
/// <returns></returns>
ScienceData[] GetData();
/// <summary>
/// Returns a count of Science Data reports stored in the module.
/// </summary>
/// <returns></returns>
int GetScienceCount();
/// <summary>
/// Can the experiment be run more than once?
/// </summary>
/// <returns></returns>
bool IsRerunnable();
/// <summary>
/// Opens the experimental results dialog page, displays stored Science Data.
/// </summary>
void ReviewData();
/// <summary>
/// Opens the experimental results dialog page, displays stored Science Data.
/// </summary>
/// <param name="data"></param>
void ReviewDataItem(ScienceData data);
}
|
#region Assembly Assembly-CSharp.dll, v2.0.50727
// C:\Users\David\Documents\Visual Studio 2010\Projects\KSP Science\KSP DEV\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp.dll
#endregion
using System;
/// <summary>
/// Interface used by ModuleScienceExperiment and ModuleScienceContainer. Used for storing, transfering and transmitting Science Data.
/// </summary>
public interface IScienceDataContainer
{
/// <summary>
/// Removes science data from the part, called after transmission or EVA data collection.
/// </summary>
/// <param name="data"></param>
void DumpData(ScienceData data);
/// <summary>
/// Returns an array of all Science Data stored in the module.
/// </summary>
/// <returns></returns>
ScienceData[] GetData();
/// <summary>
/// Returns a count of Science Data reports stored in the module.
/// </summary>
/// <returns></returns>
int GetScienceCount();
/// <summary>
/// Can the experiment be run more than once?
/// </summary>
/// <returns></returns>
bool IsRerunnable();
/// <summary>
/// Opens the experimental results dialog page, displays stored Science Data.
/// </summary>
void ReviewData();
/// <summary>
/// Opens the experimental results dialog page, displays stored Science Data.
/// </summary>
/// <param name="data"></param>
void ReviewDataItem(ScienceData data);
}
|
unlicense
|
C#
|
417e81baeac00b61110eb166c9faa1e5d34f4594
|
Disable AntiAliasing to make the tiles align perfectly.
|
mjeanrichard/UniversalMapControl,mjeanrichard/WinRtMap
|
UniversalMapControl/Tiles/TileLayer.cs
|
UniversalMapControl/Tiles/TileLayer.cs
|
using Windows.UI;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.UI;
using Microsoft.Graphics.Canvas.UI.Xaml;
using UniversalMapControl.Interfaces;
using UniversalMapControl.Tiles.Default;
namespace UniversalMapControl.Tiles
{
public class TileLayer : CanvasMapLayer
{
public TileLayer()
{
LayerConfiguration = new DefaultWebLayerConfig();
ShowLoadingOverlay = false;
LoadingOverlayColor = Color.FromArgb(100, 150, 150, 150);
}
public ILayerConfiguration LayerConfiguration { get; set; }
public bool ShowLoadingOverlay { get; set; }
public Color LoadingOverlayColor { get; set; }
protected override void OnCreateResource(CanvasControl sender, CanvasCreateResourcesEventArgs args)
{
// Clear all Tiles and Reload (Display Device might have changed...)
LayerConfiguration.TileProvider.ResetTiles(ParentMap, sender);
}
protected override void DrawInternal(CanvasDrawingSession drawingSession, Map parentMap)
{
drawingSession.Antialiasing = CanvasAntialiasing.Aliased;
LayerConfiguration.TileProvider.RefreshTiles(ParentMap);
double zoomFactor = parentMap.ViewPortProjection.GetZoomFactor(parentMap.ZoomLevel);
foreach (ICanvasBitmapTile tile in LayerConfiguration.TileProvider.GetTiles(zoomFactor))
{
if (tile.State == TileState.TileDoesNotExist)
{
DrawInexistentTile(drawingSession, tile, parentMap);
continue;
}
CanvasBitmap canvasBitmap = tile.GetCanvasBitmap();
if (canvasBitmap != null)
{
drawingSession.DrawImage(canvasBitmap, tile.Bounds);
}
else if (ShowLoadingOverlay)
{
DrawLoadingTile(drawingSession, tile, parentMap);
}
}
}
protected virtual void DrawInexistentTile(CanvasDrawingSession drawingSession, ICanvasBitmapTile tile, Map parentMap)
{}
protected virtual void DrawLoadingTile(CanvasDrawingSession drawingSession, ICanvasBitmapTile tile, Map parentMap)
{
drawingSession.FillRectangle(tile.Bounds, LoadingOverlayColor);
}
}
}
|
using Windows.UI;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.UI;
using Microsoft.Graphics.Canvas.UI.Xaml;
using UniversalMapControl.Interfaces;
using UniversalMapControl.Tiles.Default;
namespace UniversalMapControl.Tiles
{
public class TileLayer : CanvasMapLayer
{
public TileLayer()
{
LayerConfiguration = new DefaultWebLayerConfig();
ShowLoadingOverlay = false;
LoadingOverlayColor = Color.FromArgb(100, 150, 150, 150);
}
public ILayerConfiguration LayerConfiguration { get; set; }
public bool ShowLoadingOverlay { get; set; }
public Color LoadingOverlayColor { get; set; }
protected override void OnCreateResource(CanvasControl sender, CanvasCreateResourcesEventArgs args)
{
// Clear all Tiles and Reload (Display Device might have changed...)
LayerConfiguration.TileProvider.ResetTiles(ParentMap, sender);
}
protected override void DrawInternal(CanvasDrawingSession drawingSession, Map parentMap)
{
LayerConfiguration.TileProvider.RefreshTiles(ParentMap);
double zoomFactor = parentMap.ViewPortProjection.GetZoomFactor(parentMap.ZoomLevel);
foreach (ICanvasBitmapTile tile in LayerConfiguration.TileProvider.GetTiles(zoomFactor))
{
if (tile.State == TileState.TileDoesNotExist)
{
DrawInexistentTile(drawingSession, tile, parentMap);
continue;
}
CanvasBitmap canvasBitmap = tile.GetCanvasBitmap();
if (canvasBitmap != null)
{
drawingSession.DrawImage(canvasBitmap, tile.Bounds);
}
else if (ShowLoadingOverlay)
{
DrawLoadingTile(drawingSession, tile, parentMap);
}
}
}
protected virtual void DrawInexistentTile(CanvasDrawingSession drawingSession, ICanvasBitmapTile tile, Map parentMap)
{}
protected virtual void DrawLoadingTile(CanvasDrawingSession drawingSession, ICanvasBitmapTile tile, Map parentMap)
{
drawingSession.FillRectangle(tile.Bounds, LoadingOverlayColor);
}
}
}
|
apache-2.0
|
C#
|
a56d5df42cef6691bcac2ab04d824a8a40b8006c
|
削除を実装。
|
SunriseDigital/cs-sdx-web,SunriseDigital/sdxweb,SunriseDigital/sdxweb,SunriseDigital/sdxweb,SunriseDigital/cs-sdx-web
|
_private/control/scaffold/list.ascx.cs
|
_private/control/scaffold/list.ascx.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Sdx.WebLib.Control.Scaffold
{
public partial class List : System.Web.UI.UserControl
{
protected Sdx.Scaffold.Manager scaffold;
protected dynamic recordSet;
protected Sdx.Html.Select groupSelector;
protected Sdx.Db.Connection conn;
protected void Page_Load(object sender, EventArgs e)
{
scaffold = Sdx.Scaffold.Manager.CurrentInstance(this.Name);
conn = scaffold.Db.CreateConnection();
try
{
conn.Open();
scaffold.ListPageUrl = new Web.Url(Request.Url.PathAndQuery);
if (scaffold.EditPageUrl == null)
{
scaffold.EditPageUrl = new Web.Url(Request.Url.PathAndQuery);
}
if (scaffold.Group != null)
{
scaffold.Group.Init();
groupSelector = scaffold.Group.BuildSelector(conn);
}
var deleteQuery = Request.QueryString["delete"];
if (deleteQuery != null)
{
var pkeyValues = Sdx.Util.Json.Decode(Request.QueryString["delete"]);
if (pkeyValues != null)
{
conn.BeginTransaction();
try
{
scaffold.DeleteRecord(pkeyValues, conn);
conn.Commit();
}
catch (Exception)
{
conn.Rollback();
throw;
}
if (!Sdx.Context.Current.IsDebugMode)
{
Response.Redirect(scaffold.ListPageUrl.Build(new String[]{"delete"}));
}
}
}
this.recordSet = scaffold.FetchRecordSet(conn);
}
catch (Exception)
{
conn.Dispose();
throw;
}
}
protected override void OnUnload(EventArgs e)
{
this.conn.Dispose();
base.OnUnload(e);
}
public string Name { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Sdx.WebLib.Control.Scaffold
{
public partial class List : System.Web.UI.UserControl
{
protected Sdx.Scaffold.Manager scaffold;
protected dynamic recordSet;
protected Sdx.Html.Select groupSelector;
protected Sdx.Db.Connection conn;
protected void Page_Load(object sender, EventArgs e)
{
scaffold = Sdx.Scaffold.Manager.CurrentInstance(this.Name);
conn = scaffold.Db.CreateConnection();
try
{
conn.Open();
scaffold.ListPageUrl = new Web.Url(Request.Url.PathAndQuery);
if (scaffold.EditPageUrl == null)
{
scaffold.EditPageUrl = new Web.Url(Request.Url.PathAndQuery);
}
if (scaffold.Group != null)
{
scaffold.Group.Init();
groupSelector = scaffold.Group.BuildSelector(conn);
}
this.recordSet = scaffold.FetchRecordSet(conn);
}
catch (Exception)
{
conn.Dispose();
throw;
}
}
protected override void OnUnload(EventArgs e)
{
this.conn.Dispose();
base.OnUnload(e);
}
public string Name { get; set; }
}
}
|
mit
|
C#
|
d4857b0483cbf0536cd9f803c471eb0e1120057f
|
Remove unneccesary build bits copied from steamvr.
|
OSVR/OSVR-Unreal,OSVR/OSVR-Unreal,OSVR/OSVR-Unreal,OSVR/OSVR-Unreal
|
OSVRUnreal/Plugins/OSVR/Source/OSVR/OSVR.Build.cs
|
OSVRUnreal/Plugins/OSVR/Source/OSVR/OSVR.Build.cs
|
using UnrealBuildTool;
public class OSVR : ModuleRules
{
public OSVR(TargetInfo Target)
{
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
"OSVR/Private",
"../../../../../Source/Runtime/Renderer/Private",
// ... add other private include paths required here ...
}
);
// These are UE modules
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject", // Provides Actors and Structs
"Engine", // Used by Actor
"Slate", // Used by InputDevice to fire bespoke FKey events
"InputCore", // Provides LOCTEXT and other Input features
"InputDevice", // Provides IInputInterface
"RHI",
"RenderCore",
"Renderer",
"ShaderCore",
"HeadMountedDisplay",
"Json"
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"OSVRClientKit",
"Core",
"CoreUObject", // Provides Actors and Structs
"Engine", // Used by Actor
"Slate", // Used by InputDevice to fire bespoke FKey events
"InputCore", // Provides LOCTEXT and other Input features
"InputDevice", // Provides IInputInterface
"RHI",
"RenderCore",
"Renderer",
"ShaderCore",
"HeadMountedDisplay",
"Json"
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
|
using UnrealBuildTool;
public class OSVR : ModuleRules
{
public OSVR(TargetInfo Target)
{
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
"OSVR/Private",
"../../../../../Source/Runtime/Renderer/Private",
// ... add other private include paths required here ...
}
);
// These are UE modules
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject", // Provides Actors and Structs
"Engine", // Used by Actor
"Slate", // Used by InputDevice to fire bespoke FKey events
"InputCore", // Provides LOCTEXT and other Input features
"InputDevice", // Provides IInputInterface
"RHI",
"RenderCore",
"Renderer",
"ShaderCore",
"HeadMountedDisplay",
"Json"
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"OSVRClientKit",
"Core",
"CoreUObject", // Provides Actors and Structs
"Engine", // Used by Actor
"Slate", // Used by InputDevice to fire bespoke FKey events
"InputCore", // Provides LOCTEXT and other Input features
"InputDevice", // Provides IInputInterface
"RHI",
"RenderCore",
"Renderer",
"ShaderCore",
"HeadMountedDisplay",
"Json"
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64)
{
AddThirdPartyPrivateStaticDependencies(Target, "OpenVR");
PrivateDependencyModuleNames.AddRange(new string[] { "D3D11RHI" }); //@todo steamvr: multiplatform
}
}
}
|
apache-2.0
|
C#
|
9622dfd74e407ac5aec8d2d4d5a92258fe5b03cc
|
Reduce scope to Report function
|
jlewin/MatterControl,mmoening/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl
|
PartPreviewWindow/View3D/SliceProgressReporter.cs
|
PartPreviewWindow/View3D/SliceProgressReporter.cs
|
/*
Copyright (c) 2017, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Diagnostics;
using MatterHackers.GCodeVisualizer;
using MatterHackers.Agg;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class SliceProgressReporter : IProgress<ProgressStatus>
{
private IProgress<ProgressStatus> reporter;
private PrinterConfig printer;
public SliceProgressReporter(IProgress<ProgressStatus> reporter, PrinterConfig printer)
{
this.reporter = reporter;
this.printer = printer;
}
public void Report(ProgressStatus progressStatus)
{
double currentValue = 0;
double destValue = 10;
string statusText = progressStatus.Status;
if (GCodeFile.GetFirstNumberAfter("", statusText, ref currentValue)
&& GCodeFile.GetFirstNumberAfter("/", statusText, ref destValue))
{
if (destValue == 0)
{
destValue = 1;
}
progressStatus.Status = progressStatus.Status.TrimEnd('.');
progressStatus.Progress0To1 = currentValue / destValue;
}
else
{
printer.Connection.TerminalLog.WriteLine(statusText);
}
reporter.Report(progressStatus);
}
}
}
|
/*
Copyright (c) 2017, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Diagnostics;
using MatterHackers.GCodeVisualizer;
using MatterHackers.Agg;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class SliceProgressReporter : IProgress<ProgressStatus>
{
private double currentValue = 0;
private double destValue = 10;
private IProgress<ProgressStatus> reporter;
private PrinterConfig printer;
public SliceProgressReporter(IProgress<ProgressStatus> reporter, PrinterConfig printer)
{
this.reporter = reporter;
this.printer = printer;
}
public void Report(ProgressStatus progressStatus)
{
string statusText = progressStatus.Status;
if (GCodeFile.GetFirstNumberAfter("", statusText, ref currentValue)
&& GCodeFile.GetFirstNumberAfter("/", statusText, ref destValue))
{
if (destValue == 0)
{
destValue = 1;
}
progressStatus.Status = progressStatus.Status.TrimEnd('.');
progressStatus.Progress0To1 = currentValue / destValue;
}
else
{
printer.Connection.TerminalLog.WriteLine(statusText);
}
reporter.Report(progressStatus);
}
}
}
|
bsd-2-clause
|
C#
|
e62cb6423190925515106ea9963e720cad1ff28a
|
Use OnInit override instead of Page_Init
|
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
|
R7.University.Launchpad/SettingsLaunchpad.ascx.cs
|
R7.University.Launchpad/SettingsLaunchpad.ascx.cs
|
using System;
using System.Web.UI.WebControls;
using System.Linq;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.UI.UserControls;
using R7.University;
namespace R7.University.Launchpad
{
public partial class SettingsLaunchpad : LaunchpadModuleSettingsBase
{
#region Properties
protected LaunchpadTables LaunchpadTables = new LaunchpadTables ();
#endregion
public override void OnInit (EventArgs e)
{
base.OnInit (e);
// fill PageSize combobox
comboPageSize.AddItem ("10", "10");
comboPageSize.AddItem ("25", "25");
comboPageSize.AddItem ("50", "50");
comboPageSize.AddItem ("100", "100");
// fill tables list
foreach (var table in LaunchpadTables.Tables)
listTables.Items.Add (new Telerik.Web.UI.RadListBoxItem (
LocalizeString (table.ResourceKey), table.Name));
}
/// <summary>
/// Handles the loading of the module setting for this control
/// </summary>
public override void LoadSettings ()
{
try
{
if (!IsPostBack)
{
// TODO: Allow select nearest pagesize value
comboPageSize.Select (LaunchpadSettings.PageSize.ToString (), false);
// check table list items
foreach (var table in LaunchpadSettings.Tables)
{
var item = listTables.FindItemByValue (table);
if (item != null) item.Checked = true;
}
}
}
catch (Exception ex)
{
Exceptions.ProcessModuleLoadException (this, ex);
}
}
/// <summary>
/// handles updating the module settings for this control
/// </summary>
public override void UpdateSettings ()
{
try
{
LaunchpadSettings.PageSize = int.Parse (comboPageSize.SelectedValue);
LaunchpadSettings.Tables = listTables.CheckedItems.Select (i => i.Value).ToList ();
// remove session variable for active view,
// since view set may be changed
Session.Remove ("Launchpad_ActiveView_" + TabModuleId);
Utils.SynchronizeModule (this);
}
catch (Exception ex)
{
Exceptions.ProcessModuleLoadException (this, ex);
}
}
}
}
|
using System;
using System.Web.UI.WebControls;
using System.Linq;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.UI.UserControls;
using R7.University;
namespace R7.University.Launchpad
{
public partial class SettingsLaunchpad : LaunchpadModuleSettingsBase
{
#region Properties
protected LaunchpadTables LaunchpadTables = new LaunchpadTables ();
#endregion
public void Page_Init ()
{
// fill PageSize combobox
comboPageSize.AddItem ("10", "10");
comboPageSize.AddItem ("25", "25");
comboPageSize.AddItem ("50", "50");
comboPageSize.AddItem ("100", "100");
// fill tables list
foreach (var table in LaunchpadTables.Tables)
listTables.Items.Add (new Telerik.Web.UI.RadListBoxItem (
LocalizeString (table.ResourceKey), table.Name));
}
/// <summary>
/// Handles the loading of the module setting for this control
/// </summary>
public override void LoadSettings ()
{
try
{
if (!IsPostBack)
{
// TODO: Allow select nearest pagesize value
comboPageSize.Select (LaunchpadSettings.PageSize.ToString (), false);
// check table list items
foreach (var table in LaunchpadSettings.Tables)
{
var item = listTables.FindItemByValue (table);
if (item != null) item.Checked = true;
}
}
}
catch (Exception ex)
{
Exceptions.ProcessModuleLoadException (this, ex);
}
}
/// <summary>
/// handles updating the module settings for this control
/// </summary>
public override void UpdateSettings ()
{
try
{
LaunchpadSettings.PageSize = int.Parse (comboPageSize.SelectedValue);
LaunchpadSettings.Tables = listTables.CheckedItems.Select (i => i.Value).ToList ();
// remove session variable for active view,
// since view set may be changed
Session.Remove ("Launchpad_ActiveView_" + TabModuleId);
Utils.SynchronizeModule (this);
}
catch (Exception ex)
{
Exceptions.ProcessModuleLoadException (this, ex);
}
}
}
}
|
agpl-3.0
|
C#
|
e613a539f01bdd2398d005b68ef91af5d3745e85
|
Bump version to 3.3.0.0
|
ning-yang/compute-image-windows,illfelder/compute-image-windows,GoogleCloudPlatform/compute-image-windows,GoogleCloudPlatform/compute-image-windows,adjackura/compute-image-windows,ning-yang/compute-image-windows,illfelder/compute-image-windows,adjackura/compute-image-windows
|
agent/Common/Properties/VersionInfo.cs
|
agent/Common/Properties/VersionInfo.cs
|
/*
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Reflection;
using System.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: AssemblyCompany("Google Inc")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version: Large feature and functionality changes, or incompatible
// API changes.
// Minor Version: Add functionality without API changes.
// Build Number: Bug fixes.
// Revision: Minor changes or improvements such as style fixes.
//
// 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("3.3.0.0")]
[assembly: AssemblyFileVersion("3.3.0.0")]
|
/*
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Reflection;
using System.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: AssemblyCompany("Google Inc")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version: Large feature and functionality changes, or incompatible
// API changes.
// Minor Version: Add functionality without API changes.
// Build Number: Bug fixes.
// Revision: Minor changes or improvements such as style fixes.
//
// 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("3.2.4.0")]
[assembly: AssemblyFileVersion("3.2.4.0")]
|
apache-2.0
|
C#
|
a68c407c7757ad55bd06104d01fd8eba789b8e6f
|
use StringComparison.InvariantCulture
|
tetrodoxin/NLog,tmusico/NLog,vladikk/NLog,bjornbouetsmith/NLog,nazim9214/NLog,kevindaub/NLog,thomkinson/NLog,thomkinson/NLog,breyed/NLog,vbfox/NLog,tohosnet/NLog,littlesmilelove/NLog,pwelter34/NLog,fringebits/NLog,matteobruni/NLog,nazim9214/NLog,luigiberrettini/NLog,bryjamus/NLog,zbrad/NLog,RRUZ/NLog,czema/NLog,sean-gilliam/NLog,thomkinson/NLog,tetrodoxin/NLog,thomkinson/NLog,MartinTherriault/NLog,ajayanandgit/NLog,UgurAldanmaz/NLog,michaeljbaird/NLog,Niklas-Peter/NLog,FeodorFitsner/NLog,MartinTherriault/NLog,BrandonLegault/NLog,tohosnet/NLog,MoaidHathot/NLog,BrutalCode/NLog,bryjamus/NLog,MoaidHathot/NLog,breyed/NLog,ajayanandgit/NLog,BrandonLegault/NLog,vladikk/NLog,ArsenShnurkov/NLog,304NotModified/NLog,vladikk/NLog,RichiCoder1/NLog,czema/NLog,campbeb/NLog,babymechanic/NLog,rajeshgande/NLog,bhaeussermann/NLog,hubo0831/NLog,NLog/NLog,UgurAldanmaz/NLog,czema/NLog,AndreGleichner/NLog,ie-zero/NLog,BrandonLegault/NLog,kevindaub/NLog,ArsenShnurkov/NLog,AndreGleichner/NLog,fringebits/NLog,czema/NLog,tmusico/NLog,ilya-g/NLog,RRUZ/NLog,ilya-g/NLog,rajeshgande/NLog,zbrad/NLog,RichiCoder1/NLog,fringebits/NLog,snakefoot/NLog,hubo0831/NLog,FeodorFitsner/NLog,fringebits/NLog,babymechanic/NLog,vbfox/NLog,bhaeussermann/NLog,BrandonLegault/NLog,BrutalCode/NLog,vladikk/NLog,pwelter34/NLog,ie-zero/NLog,littlesmilelove/NLog,luigiberrettini/NLog,michaeljbaird/NLog,matteobruni/NLog,campbeb/NLog,Niklas-Peter/NLog,bjornbouetsmith/NLog
|
src/NLog/Internal/EncodingHelpers.cs
|
src/NLog/Internal/EncodingHelpers.cs
|
//
// Copyright (c) 2004-2011 Jaroslaw Kowalski <jaak@jkowalski.net>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of Jaroslaw Kowalski nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JetBrains.Annotations;
namespace NLog.Internal
{
internal static class EncodingHelpers
{
/// <summary>
/// Fix encoding so it has/hasn't a BOM (Byte-order-mark)
/// </summary>
/// <param name="encoding">encoding to be converted</param>
/// <param name="includeBOM">should we include the BOM (Byte-order-mark) for UTF? <c>true</c> for BOM, <c>false</c> for no BOM</param>
/// <returns>new or current encoding</returns>
/// <remarks>.net has default a BOM included with UTF-8</remarks>
public static Encoding ConvertEncodingBOM([NotNull] this Encoding encoding, bool includeBOM)
{
if (encoding == null) throw new ArgumentNullException("encoding");
if (!includeBOM)
{
//default .net uses BOM, so we have to create a new instance to exlucde this.
if (encoding.EncodingName.Equals(Encoding.UTF8.EncodingName, StringComparison.InvariantCulture))
{
return new UTF8Encoding(false);
}
}
return encoding;
}
}
}
|
//
// Copyright (c) 2004-2011 Jaroslaw Kowalski <jaak@jkowalski.net>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of Jaroslaw Kowalski nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JetBrains.Annotations;
namespace NLog.Internal
{
internal static class EncodingHelpers
{
/// <summary>
/// Fix encoding so it has/hasn't a BOM (Byte-order-mark)
/// </summary>
/// <param name="encoding">encoding to be converted</param>
/// <param name="includeBOM">should we include the BOM (Byte-order-mark) for UTF? <c>true</c> for BOM, <c>false</c> for no BOM</param>
/// <returns>new or current encoding</returns>
/// <remarks>.net has default a BOM included with UTF-8</remarks>
public static Encoding ConvertEncodingBOM([NotNull] this Encoding encoding, bool includeBOM)
{
if (encoding == null) throw new ArgumentNullException("encoding");
if (!includeBOM)
{
//default .net uses BOM, so we have to create a new instance to exlucde this.
if (encoding.EncodingName == Encoding.UTF8.EncodingName)
{
return new UTF8Encoding(false);
}
}
return encoding;
}
}
}
|
bsd-3-clause
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.