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 |
|---|---|---|---|---|---|---|---|---|
814d401eb008a081d05cad7ebd392747fd86d6fa | Make ChannelSelectorTabItem not switchable | DrabWeb/osu,EVAST9919/osu,peppy/osu,ppy/osu,peppy/osu,2yangk23/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,naoey/osu,peppy/osu-new,DrabWeb/osu,NeoAdonis/osu,UselessToucan/osu,naoey/osu,NeoAdonis/osu,ZLima12/osu,smoogipoo/osu,EVAST9919/osu,johnneijzen/osu,ppy/osu,naoey/osu,ppy/osu,UselessToucan/osu,peppy/osu,ZLima12/osu,johnneijzen/osu,DrabWeb/osu,smoogipoo/osu,2yangk23/osu,smoogipooo/osu | osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs | osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.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.Game.Graphics;
using osu.Game.Online.Chat;
namespace osu.Game.Overlays.Chat.Tabs
{
public class ChannelSelectorTabItem : ChannelTabItem
{
public override bool IsRemovable => false;
public override bool IsSwitchable => false;
public ChannelSelectorTabItem(Channel value) : base(value)
{
Depth = float.MaxValue;
Width = 45;
Icon.Alpha = 0;
Text.TextSize = 45;
TextBold.TextSize = 45;
}
[BackgroundDependencyLoader]
private new void load(OsuColour colour)
{
BackgroundInactive = colour.Gray2;
BackgroundActive = colour.Gray3;
}
}
}
| // 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.Game.Graphics;
using osu.Game.Online.Chat;
namespace osu.Game.Overlays.Chat.Tabs
{
public class ChannelSelectorTabItem : ChannelTabItem
{
public override bool IsRemovable => false;
public ChannelSelectorTabItem(Channel value) : base(value)
{
Depth = float.MaxValue;
Width = 45;
Icon.Alpha = 0;
Text.TextSize = 45;
TextBold.TextSize = 45;
}
[BackgroundDependencyLoader]
private new void load(OsuColour colour)
{
BackgroundInactive = colour.Gray2;
BackgroundActive = colour.Gray3;
}
}
}
| mit | C# |
0d2d3e785496235ce77fe7081ded639698b1b041 | Bump version | UniqProject/BDInfo | BDInfo/Properties/AssemblyInfo.cs | BDInfo/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("BDInfo")]
[assembly: AssemblyDescription("Blu-ray Video and Audio Specifications Collection Tool")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cinema Squid & UniqProject")]
[assembly: AssemblyProduct("BDInfo")]
[assembly: AssemblyCopyright("Copyright © Cinema Squid 2011 & UniqProject 2017-2018")]
[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("6a516a5c-6c0d-4ab0-bb8d-f113d544355e")]
// 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.7.5.0")]
[assembly: AssemblyFileVersion("0.7.5.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BDInfo")]
[assembly: AssemblyDescription("Blu-ray Video and Audio Specifications Collection Tool")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cinema Squid & UniqProject")]
[assembly: AssemblyProduct("BDInfo")]
[assembly: AssemblyCopyright("Copyright © Cinema Squid 2011 & UniqProject 2017-2018")]
[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("6a516a5c-6c0d-4ab0-bb8d-f113d544355e")]
// 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.7.4.0")]
[assembly: AssemblyFileVersion("0.7.4.0")]
| lgpl-2.1 | C# |
b4d4f5456c762f7867ef5a3db4e814a125348f38 | Fix broken fail judgement test | NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu,ppy/osu,UselessToucan/osu,ppy/osu,peppy/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu | osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs | osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.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 System.Linq;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual.Gameplay
{
public class TestSceneFailJudgement : TestSceneAllRulesetPlayers
{
protected override Player CreatePlayer(Ruleset ruleset)
{
SelectedMods.Value = Array.Empty<Mod>();
return new FailPlayer();
}
protected override void AddCheckSteps()
{
AddUntilStep("wait for fail", () => Player.HasFailed);
AddUntilStep("wait for multiple judgements", () => ((FailPlayer)Player).ScoreProcessor.JudgedHits > 1);
AddAssert("total number of results == 1", () =>
{
var score = new ScoreInfo();
((FailPlayer)Player).ScoreProcessor.PopulateScore(score);
return score.Statistics.Values.Sum() == 1;
});
}
private class FailPlayer : TestPlayer
{
public new HealthProcessor HealthProcessor => base.HealthProcessor;
public FailPlayer()
: base(false, false)
{
}
protected override void LoadComplete()
{
base.LoadComplete();
HealthProcessor.FailConditions += (_, __) => true;
}
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual.Gameplay
{
public class TestSceneFailJudgement : TestSceneAllRulesetPlayers
{
protected override Player CreatePlayer(Ruleset ruleset)
{
SelectedMods.Value = Array.Empty<Mod>();
return new FailPlayer();
}
protected override void AddCheckSteps()
{
AddUntilStep("wait for fail", () => Player.HasFailed);
AddUntilStep("wait for multiple judged objects", () => ((FailPlayer)Player).DrawableRuleset.Playfield.AllHitObjects.Count(h => h.AllJudged) > 1);
AddAssert("total judgements == 1", () => ((FailPlayer)Player).HealthProcessor.JudgedHits >= 1);
}
private class FailPlayer : TestPlayer
{
public new HealthProcessor HealthProcessor => base.HealthProcessor;
public FailPlayer()
: base(false, false)
{
}
protected override void LoadComplete()
{
base.LoadComplete();
HealthProcessor.FailConditions += (_, __) => true;
}
}
}
}
| mit | C# |
396296cc760f62ce1ededc1b93388143c005e19a | Bump version | BrianLima/UWPHook | UWPHook/Properties/AssemblyInfo.cs | UWPHook/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
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("UWPHook")]
[assembly: AssemblyDescription("Add your UWP games and apps to Steam!")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Briano")]
[assembly: AssemblyProduct("UWPHook")]
[assembly: AssemblyCopyright("Copyright Brian Lima © 2020")]
[assembly: AssemblyTrademark("Briano")]
[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("2.9.1.0")]
[assembly: AssemblyFileVersion("2.9.1.0")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
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("UWPHook")]
[assembly: AssemblyDescription("Add your UWP games and apps to Steam!")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Briano")]
[assembly: AssemblyProduct("UWPHook")]
[assembly: AssemblyCopyright("Copyright Brian Lima © 2020")]
[assembly: AssemblyTrademark("Briano")]
[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("2.9.0.0")]
[assembly: AssemblyFileVersion("2.9.0.0")]
| mit | C# |
777d2fff6ef3219beea6faa347dc7060e94620f4 | Check if button "Jump" is pressed down, not simply if it down. | Warhead-Entertainment/OpenWorld | Assets/Scripts/Player.cs | Assets/Scripts/Player.cs | using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
private CharacterController controller;
private Transform firstPersonCamera;
private Vector3 moveDirection;
private float movementSpeed = 3.0F;
private const float regularSpeed = 3.0F;
private const float sprintSpeed = 4.0F;
private const float jumpSpeed = 4.0F;
private const float crouchSpeed = 1.0F;
private bool crouchToggle = false;
private const float gravity = 9.81F;
private const float mouseSensitivity = 1.0F;
private float verticalRotation = 0.0F;
void Start() {
controller = GetComponent<CharacterController>();
firstPersonCamera = transform.Find("FirstPersonCamera");
}
void Update() {
// Movement
if (controller.isGrounded) {
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")) * movementSpeed;
moveDirection = transform.rotation * moveDirection;
if (Input.GetButtonDown("Jump")) {
moveDirection.y = jumpSpeed;
}
// Control sprinting
if (Input.GetKeyDown(KeyCode.LeftShift)) {
movementSpeed = sprintSpeed;
} else if (Input.GetKeyUp(KeyCode.LeftShift)) {
movementSpeed = regularSpeed;
}
// Control crouching
if (Input.GetKeyDown(KeyCode.LeftControl) && crouchToggle == false) {
movementSpeed = crouchSpeed;
firstPersonCamera.transform.Translate(0, -0.3F, 0);
} else if (Input.GetKeyUp(KeyCode.LeftControl) && crouchToggle == false) {
movementSpeed = regularSpeed;
firstPersonCamera.transform.Translate(0, 0.3F, 0);
} else if (Input.GetKeyDown(KeyCode.C)) {
if (crouchToggle == true) {
movementSpeed = regularSpeed;
firstPersonCamera.transform.Translate(0, 0.3F, 0);
} else {
movementSpeed = crouchSpeed;
firstPersonCamera.transform.Translate(0, -0.3F, 0);
}
crouchToggle = !crouchToggle;
}
}
// Rotation
transform.Rotate(0, Input.GetAxis("Mouse X") * mouseSensitivity, 0);
verticalRotation -= Input.GetAxis("Mouse Y") * mouseSensitivity;
verticalRotation = Mathf.Clamp(verticalRotation, -60.0F, 60.0F);
firstPersonCamera.localRotation = Quaternion.Euler(verticalRotation, 0, 0);
moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);
}
void OnControllerColliderHit(ControllerColliderHit hit) {
Rigidbody body = hit.collider.attachedRigidbody;
if (body == null || body.isKinematic) {
return;
}
if (hit.moveDirection.y < -0.3F) {
return;
}
Vector3 pushDir = new Vector3(hit.moveDirection.x, 0, hit.moveDirection.z);
body.velocity = pushDir * 2.0F;
}
}
| using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
private CharacterController controller;
private Transform firstPersonCamera;
private Vector3 moveDirection;
private float movementSpeed = 3.0F;
private const float regularSpeed = 3.0F;
private const float sprintSpeed = 4.0F;
private const float jumpSpeed = 4.0F;
private const float crouchSpeed = 1.0F;
private bool crouchToggle = false;
private const float gravity = 9.81F;
private const float mouseSensitivity = 1.0F;
private float verticalRotation = 0.0F;
void Start() {
controller = GetComponent<CharacterController>();
firstPersonCamera = transform.Find("FirstPersonCamera");
}
void Update() {
// Movement
if (controller.isGrounded) {
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")) * movementSpeed;
moveDirection = transform.rotation * moveDirection;
if (Input.GetButton("Jump")) {
moveDirection.y = jumpSpeed;
}
// Control sprinting
if (Input.GetKeyDown(KeyCode.LeftShift)) {
movementSpeed = sprintSpeed;
} else if (Input.GetKeyUp(KeyCode.LeftShift)) {
movementSpeed = regularSpeed;
}
// Control crouching
if (Input.GetKeyDown(KeyCode.LeftControl) && crouchToggle == false) {
movementSpeed = crouchSpeed;
firstPersonCamera.transform.Translate(0, -0.3F, 0);
} else if (Input.GetKeyUp(KeyCode.LeftControl) && crouchToggle == false) {
movementSpeed = regularSpeed;
firstPersonCamera.transform.Translate(0, 0.3F, 0);
} else if (Input.GetKeyDown(KeyCode.C)) {
if (crouchToggle == true) {
movementSpeed = regularSpeed;
firstPersonCamera.transform.Translate(0, 0.3F, 0);
} else {
movementSpeed = crouchSpeed;
firstPersonCamera.transform.Translate(0, -0.3F, 0);
}
crouchToggle = !crouchToggle;
}
}
// Rotation
transform.Rotate(0, Input.GetAxis("Mouse X") * mouseSensitivity, 0);
verticalRotation -= Input.GetAxis("Mouse Y") * mouseSensitivity;
verticalRotation = Mathf.Clamp(verticalRotation, -60.0F, 60.0F);
firstPersonCamera.localRotation = Quaternion.Euler(verticalRotation, 0, 0);
moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);
}
void OnControllerColliderHit(ControllerColliderHit hit) {
Rigidbody body = hit.collider.attachedRigidbody;
if (body == null || body.isKinematic) {
return;
}
if (hit.moveDirection.y < -0.3F) {
return;
}
Vector3 pushDir = new Vector3(hit.moveDirection.x, 0, hit.moveDirection.z);
body.velocity = pushDir * 2.0F;
}
}
| mit | C# |
5bd600e626a59f92fbeaa2246022fa79fdc645e1 | Make sure you run the log after qemu starts... But it works. | kant2002/Cosmos-1,MyvarHD/Cosmos,jp2masa/Cosmos,zhangwenquan/Cosmos,CosmosOS/Cosmos,Cyber4/Cosmos,Cyber4/Cosmos,MetSystem/Cosmos,MyvarHD/Cosmos,MetSystem/Cosmos,MetSystem/Cosmos,zarlo/Cosmos,tgiphil/Cosmos,trivalik/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,kant2002/Cosmos-1,zhangwenquan/Cosmos,zdimension/Cosmos,CosmosOS/Cosmos,sgetaz/Cosmos,MyvarHD/Cosmos,sgetaz/Cosmos,trivalik/Cosmos,zdimension/Cosmos,sgetaz/Cosmos,fanoI/Cosmos,jp2masa/Cosmos,MetSystem/Cosmos,zdimension/Cosmos,fanoI/Cosmos,tgiphil/Cosmos,kant2002/Cosmos-1,zdimension/Cosmos,MyvarHD/Cosmos,MetSystem/Cosmos,trivalik/Cosmos,Cyber4/Cosmos,zhangwenquan/Cosmos,Cyber4/Cosmos,fanoI/Cosmos,Cyber4/Cosmos,kant2002/Cosmos-1,sgetaz/Cosmos,tgiphil/Cosmos,sgetaz/Cosmos,zarlo/Cosmos,zhangwenquan/Cosmos,zarlo/Cosmos,zhangwenquan/Cosmos,zdimension/Cosmos,MyvarHD/Cosmos,CosmosOS/Cosmos,jp2masa/Cosmos | source/Cosmos.Kernel.LogTail/ErrorStrippingFileStream.cs | source/Cosmos.Kernel.LogTail/ErrorStrippingFileStream.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Cosmos.Kernel.LogTail
{
public class ErrorStrippingFileStream : FileStream
{
public ErrorStrippingFileStream(string file)
: base(file, FileMode.Open, FileAccess.Read, FileShare.Delete | FileShare.ReadWrite)
{
}
public override int ReadByte()
{
int result;
while ((result = base.ReadByte()) == 0) ;
return result;
}
public override int Read(byte[] array, int offset, int count)
{
int i;
for (i = 0; i < count; i++)
{
int b = ReadByte();
if (b == -1)
return i;
array[offset + i] = (byte) b;
}
return i;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Cosmos.Kernel.LogTail
{
public class ErrorStrippingFileStream : FileStream
{
public ErrorStrippingFileStream(string file)
: base(file, FileMode.Open, FileAccess.ReadWrite, FileShare.Delete | FileShare.ReadWrite)
{
}
public override int ReadByte()
{
int result;
while ((result = base.ReadByte()) == 0) ;
return result;
}
public override int Read(byte[] array, int offset, int count)
{
int i;
for (i = 0; i < count; i++)
{
int b = ReadByte();
if (b == -1)
return i;
array[offset + i] = (byte) b;
}
return i;
}
}
}
| bsd-3-clause | C# |
ac34994811136bc342c9d98a521ad885daf50885 | Add xmlns definition. | Grabacr07/MetroTrilithon | source/MetroTrilithon.Desktop/Properties/AssemblyInfo.cs | source/MetroTrilithon.Desktop/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("MetroTrilithon.Desktop")]
[assembly: AssemblyDescription("Utilities for Windows Desktop apps")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("grabacr.net")]
[assembly: AssemblyProduct("MetroTrilithon")]
[assembly: AssemblyCopyright("Copyright © 2015 Grabacr07")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
[assembly: Guid("4e2eb2e0-e5fe-4feb-a3e5-5f2f05cd1a67")]
[assembly: ThemeInfo(
// テーマ固有のリソース ディクショナリが置かれている場所
// (リソースがページ、またはアプリケーション リソース ディクショナリに見つからない場合に使用されます)
ResourceDictionaryLocation.None,
// 汎用リソース ディクショナリが置かれている場所
// (リソースがページ、アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます)
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2015/personal/controls", "MetroTrilithon.Controls")]
[assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2015/personal/converters", "MetroTrilithon.Converters")]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("MetroTrilithon.Desktop")]
[assembly: AssemblyDescription("Utilities for Windows Desktop apps")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("grabacr.net")]
[assembly: AssemblyProduct("MetroTrilithon")]
[assembly: AssemblyCopyright("Copyright © 2015 Grabacr07")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
[assembly: Guid("4e2eb2e0-e5fe-4feb-a3e5-5f2f05cd1a67")]
[assembly: ThemeInfo(
// テーマ固有のリソース ディクショナリが置かれている場所
// (リソースがページ、またはアプリケーション リソース ディクショナリに見つからない場合に使用されます)
ResourceDictionaryLocation.None,
// 汎用リソース ディクショナリが置かれている場所
// (リソースがページ、アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます)
ResourceDictionaryLocation.SourceAssembly
)]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
| mit | C# |
34dd9472bacf75703e2695371f661d2cbe5048a8 | Comment typo (#5557) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | test/WebSites/ApplicationModelWebSite/Controllers/ParameterModelController.cs | test/WebSites/ApplicationModelWebSite/Controllers/ParameterModelController.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace ApplicationModelWebSite
{
// This controller uses a reflected model attribute to change a parameter's binder metadata.
//
// This could be accomplished by simply making an attribute that implements IBinderMetadata, but
// this is part of a test for IParameterModelConvention.
public class ParameterModelController : Controller
{
public string GetParameterMetadata([Cool] int? id)
{
return ControllerContext.ActionDescriptor.Parameters[0].BindingInfo.BinderModelName;
}
private class CoolAttribute : Attribute, IParameterModelConvention
{
public void Apply(ParameterModel model)
{
model.BindingInfo = model.BindingInfo ?? new BindingInfo();
model.BindingInfo.BindingSource = BindingSource.Custom;
model.BindingInfo.BinderModelName = "CoolMetadata";
}
}
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace ApplicationModelWebSite
{
// This controller uses an reflected model attribute to change a parameter's binder metadata.
//
// This could be accomplished by simply making an attribute that implements IBinderMetadata, but
// this is part of a test for IParameterModelConvention.
public class ParameterModelController : Controller
{
public string GetParameterMetadata([Cool] int? id)
{
return ControllerContext.ActionDescriptor.Parameters[0].BindingInfo.BinderModelName;
}
private class CoolAttribute : Attribute, IParameterModelConvention
{
public void Apply(ParameterModel model)
{
model.BindingInfo = model.BindingInfo ?? new BindingInfo();
model.BindingInfo.BindingSource = BindingSource.Custom;
model.BindingInfo.BinderModelName = "CoolMetadata";
}
}
}
} | apache-2.0 | C# |
490882ce61c8338147685f66ef85dcf4e82c86a2 | Change the baseUri | FlorianRappl/AngleSharp,AngleSharp/AngleSharp,zedr0n/AngleSharp.Local,zedr0n/AngleSharp.Local,AngleSharp/AngleSharp,FlorianRappl/AngleSharp,Livven/AngleSharp,FlorianRappl/AngleSharp,Livven/AngleSharp,Livven/AngleSharp,FlorianRappl/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,zedr0n/AngleSharp.Local | AngleSharp/DOM/Html/Head/HTMLBaseElement.cs | AngleSharp/DOM/Html/Head/HTMLBaseElement.cs | namespace AngleSharp.DOM.Html
{
using AngleSharp.Html;
using System;
/// <summary>
/// Represents the HTML base element.
/// </summary>
sealed class HTMLBaseElement : HTMLElement, IHtmlBaseElement
{
#region ctor
/// <summary>
/// Creates a HTML base element.
/// </summary>
internal HTMLBaseElement()
: base(Tags.Base, NodeFlags.Special | NodeFlags.SelfClosing)
{
}
#endregion
#region Properties
/// <summary>
/// Gets or sets the base URI.
/// </summary>
public String Href
{
get { return GetAttribute(AttributeNames.Href); }
set { SetAttribute(AttributeNames.Href, value); }
}
/// <summary>
/// Gets or sets the default target frame.
/// </summary>
public String Target
{
get { return GetAttribute(AttributeNames.Target); }
set { SetAttribute(AttributeNames.Target, value); }
}
#endregion
#region Methods
internal override void Close()
{
base.Close();
RegisterAttributeHandler(AttributeNames.Href, value => UpdateUrl(value));
UpdateUrl(GetAttribute(AttributeNames.Href));
}
void UpdateUrl(String url)
{
Owner.BaseUri = url;
}
#endregion
}
}
| namespace AngleSharp.DOM.Html
{
using AngleSharp.Html;
using System;
/// <summary>
/// Represents the HTML base element.
/// </summary>
sealed class HTMLBaseElement : HTMLElement, IHtmlBaseElement
{
#region ctor
/// <summary>
/// Creates a HTML base element.
/// </summary>
internal HTMLBaseElement()
: base(Tags.Base, NodeFlags.Special | NodeFlags.SelfClosing)
{
}
#endregion
#region Properties
/// <summary>
/// Gets or sets the base URI.
/// </summary>
public String Href
{
get { return GetAttribute(AttributeNames.Href); }
set { SetAttribute(AttributeNames.Href, value); }
}
/// <summary>
/// Gets or sets the default target frame.
/// </summary>
public String Target
{
get { return GetAttribute(AttributeNames.Target); }
set { SetAttribute(AttributeNames.Target, value); }
}
#endregion
}
}
| mit | C# |
f9603eefe5fed7e02c040a0e12a4b27541e4aa60 | Revert "Switch Guid implementation temporarily to avoid compile time error" | smoogipooo/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu-new,ppy/osu,peppy/osu | osu.Game/Input/Bindings/RealmKeyBinding.cs | osu.Game/Input/Bindings/RealmKeyBinding.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.Input.Bindings;
using osu.Game.Database;
using Realms;
namespace osu.Game.Input.Bindings
{
[MapTo(nameof(KeyBinding))]
public class RealmKeyBinding : RealmObject, IHasGuidPrimaryKey, IKeyBinding
{
[PrimaryKey]
public Guid ID { get; set; }
public int? RulesetID { get; set; }
public int? Variant { get; set; }
public KeyCombination KeyCombination
{
get => KeyCombinationString;
set => KeyCombinationString = value.ToString();
}
public object Action
{
get => ActionInt;
set => ActionInt = (int)value;
}
[MapTo(nameof(Action))]
public int ActionInt { get; set; }
[MapTo(nameof(KeyCombination))]
public string KeyCombinationString { get; set; }
}
}
| // 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.Input.Bindings;
using osu.Game.Database;
using Realms;
namespace osu.Game.Input.Bindings
{
[MapTo(nameof(KeyBinding))]
public class RealmKeyBinding : RealmObject, IHasGuidPrimaryKey, IKeyBinding
{
[PrimaryKey]
public string StringGuid { get; set; }
[Ignored]
public Guid ID
{
get => Guid.Parse(StringGuid);
set => StringGuid = value.ToString();
}
public int? RulesetID { get; set; }
public int? Variant { get; set; }
public KeyCombination KeyCombination
{
get => KeyCombinationString;
set => KeyCombinationString = value.ToString();
}
public object Action
{
get => ActionInt;
set => ActionInt = (int)value;
}
[MapTo(nameof(Action))]
public int ActionInt { get; set; }
[MapTo(nameof(KeyCombination))]
public string KeyCombinationString { get; set; }
}
}
| mit | C# |
5548fa82869f22747fc52ef766ca70d5d35797f5 | Update Vector2 | JosephAMumford/ProGenTracer | ProGenTracer/Utilities/Vector2.cs | ProGenTracer/Utilities/Vector2.cs | //Created by Joseph Mumford 10/22/2017
//This file is part of ProGen Tracer which is released under MIT License. See license.txt for full details.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProGenTracer.Utilities
{
class Vector2
{
//Public Variables
public double x;
public double y;
public double magnitude;
public Vector2 normalized;
//Static Variables
public static Vector2 up = new Vector2(0, 1);
public static Vector2 down = new Vector2(0, -1);
public static Vector2 one = new Vector2(1, 1);
public static Vector2 zero = new Vector2(0, 0);
public static Vector2 right = new Vector2(1, 0);
public static Vector2 left = new Vector2(-1, 0);
public Vector2()
{
}
public Vector2(double x, double y)
{
this.x = x;
this.y = y;
}
public Vector2(Vector2 a)
{
this.x = a.x;
this.y = a.y;
this.magnitude = a.magnitude;
}
/// <summary>
/// Add Vector a to Vector b
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static Vector2 operator +(Vector2 a, Vector2 b)
{
return new Vector2(a.x + b.x, a.y + b.y);
}
/// <summary>
/// Subtract Vector b from vector a
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static Vector2 operator -(Vector2 a, Vector2 b)
{
return new Vector2(a.x - b.x, a.y - b.y);
}
/// <summary>
/// Negate Vector a
/// </summary>
/// <param name="a"></param>
/// <returns></returns>
public static Vector2 operator -(Vector2 a)
{
return new Vector2(-a.x, -a.y);
}
public static Vector2 operator *(Vector2 a, double n)
{
return new Vector2(a.x * n , a.y * n);
}
}
}
| //Created by Joseph Mumford 10/22/2017
//This file is part of ProGen Tracer which is released under MIT License. See license.txt for full details.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProGenTracer.Utilities
{
class Vector2
{
//Public Variables
public double x;
public double y;
public double magnitude;
public Vector2 normalized;
//Static Variables
public static Vector2 up = new Vector2(0, 1);
public static Vector2 down = new Vector2(0, -1);
public static Vector2 one = new Vector2(1, 1);
public static Vector2 zero = new Vector2(0, 0);
public static Vector2 right = new Vector2(1, 0);
public static Vector2 left = new Vector2(-1, 0);
public Vector2()
{
}
public Vector2(double x, double y)
{
this.x = x;
this.y = y;
}
public Vector2(Vector2 a)
{
this.x = a.x;
this.y = a.y;
this.magnitude = a.magnitude;
}
public static Vector2 operator +(Vector2 a, Vector2 b)
{
return new Vector2(a.x + b.x, a.y + b.y);
}
public static Vector2 operator -(Vector2 a, Vector2 b)
{
return new Vector2(a.x - b.x, a.y - b.y);
}
public static Vector2 operator -(Vector2 a)
{
return new Vector2(-a.x, -a.y);
}
public static Vector2 operator *(Vector2 a, double n)
{
return new Vector2(a.x * n , a.y * n);
}
}
}
| mit | C# |
f9135c4cb0248b11ca0f6668ba01be8fe2801457 | Add ReactiveUI.Routing.iOS Assembly Description | KallynGowdy/ReactiveUI.Routing | src/ReactiveUI.Routing.iOS/Properties/AssemblyInfo.cs | src/ReactiveUI.Routing.iOS/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("ReactiveUI.Routing.iOS")]
[assembly: AssemblyDescription("iOS-specific helpers for ReactiveUI.Routing")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReactiveUI.Routing.iOS")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("674e52fa-1774-444e-90a9-136bfdd4ac67")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ReactiveUI.Routing.iOS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReactiveUI.Routing.iOS")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("674e52fa-1774-444e-90a9-136bfdd4ac67")]
// 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# |
22f10efe41c2cb4a8eaaaeec76e39b3e984a36f2 | Update OneTimePaymentModel.cs | JudoPay/DotNetSDK | JudoPayDotNet/Models/OneTimePaymentModel.cs | JudoPayDotNet/Models/OneTimePaymentModel.cs | using System.Runtime.Serialization;
namespace JudoPayDotNet.Models
{
/// <summary>
/// A payment made by a one use token
/// </summary>
// ReSharper disable UnusedAutoPropertyAccessor.Global
[DataContract]
public class OneTimePaymentModel : PaymentModel
{
/// <summary>
/// Gets or sets the one use token.
/// </summary>
/// <value>
/// The card number.
/// </value>
[DataMember(IsRequired = true)]
public string OneUseToken { get; set; }
/// <summary>
/// Gets or sets the card address.
/// </summary>
/// <value>
/// The card address.
/// </value>
[DataMember(EmitDefaultValue = false)]
public CardAddressModel CardAddress { get; set; }
}
// ReSharper restore UnusedAutoPropertyAccessor.Global
}
| using System.Runtime.Serialization;
namespace JudoPayDotNet.Models
{
/// <summary>
/// A payment made by a one use token
/// </summary>
// ReSharper disable UnusedAutoPropertyAccessor.Global
[DataContract]
public class OneTimePaymentModel : PaymentModel
{
/// <summary>
/// Gets or sets the card number.
/// </summary>
/// <value>
/// The card number.
/// </value>
[DataMember(IsRequired = true)]
public string OneUseToken { get; set; }
/// <summary>
/// Gets or sets the card address.
/// </summary>
/// <value>
/// The card address.
/// </value>
[DataMember(EmitDefaultValue = false)]
public CardAddressModel CardAddress { get; set; }
}
// ReSharper restore UnusedAutoPropertyAccessor.Global
} | mit | C# |
1dbe0cee3e63625d0b65f6cd1659eec447129292 | return the key, not the value when requested... | Pondidum/Stronk,Pondidum/Stronk | src/Stronk.Source.Consul/ConsulConfigurationSource.cs | src/Stronk.Source.Consul/ConsulConfigurationSource.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Consul;
using Stronk.ConfigurationSources;
namespace Stronk.Source.Consul
{
public class ConsulConfigurationSource : IConfigurationSource
{
private readonly Func<IConsulClient> _clientFactory;
public ConsulConfigurationSource(Func<IConsulClient> clientFactory)
{
_clientFactory = clientFactory;
}
public string GetValue(string key)
{
using (var client = _clientFactory())
{
var response = client.KV.Get(key).Result.Response;
return AsString(response.Value);
}
}
public IEnumerable<string> GetAvailableKeys()
{
using (var client = _clientFactory())
{
var response = client.KV.List("").Result.Response;
return response.Select(r => r.Key).ToArray();
}
}
private static string AsString(byte[] bytes) => Encoding.UTF8.GetString(bytes, 0, bytes.Length);
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Consul;
using Stronk.ConfigurationSources;
namespace Stronk.Source.Consul
{
public class ConsulConfigurationSource : IConfigurationSource
{
private readonly Func<IConsulClient> _clientFactory;
public ConsulConfigurationSource(Func<IConsulClient> clientFactory)
{
_clientFactory = clientFactory;
}
public string GetValue(string key)
{
using (var client = _clientFactory())
{
var response = client.KV.Get(key).Result.Response;
return AsString(response.Value);
}
}
public IEnumerable<string> GetAvailableKeys()
{
using (var client = _clientFactory())
{
var response = client.KV.List("").Result.Response;
return response.Select(r => r.Value).Select(AsString).ToArray();
}
}
private static string AsString(byte[] bytes) => Encoding.UTF8.GetString(bytes, 0, bytes.Length);
}
}
| lgpl-2.1 | C# |
78c99218d752a6fa3eee348fdfbb4386cf6c2364 | Update APIServiceTest.Designer.cs | danesparza/OWIN-WebAPI-Service | OWINTest.Service/APIServiceTest.Designer.cs | OWINTest.Service/APIServiceTest.Designer.cs | namespace OWINTest.Service
{
partial class APIServiceTest
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing)
{
if (_server != null)
{
_server.Dispose();
}
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "Service1";
}
#endregion
}
}
| namespace OWINTest.Service
{
partial class APIServiceTest
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "Service1";
}
#endregion
}
}
| mit | C# |
b3356266070d32e626861d086c5dff66ae4b8ad3 | Use camel case serializer | davidebbo-test/SettingsAPISampleSiteExtension,davidebbo-test/SettingsAPISampleSiteExtension | SettingsAPISample/App_Start/WebApiConfig.cs | SettingsAPISample/App_Start/WebApiConfig.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web.Http;
using Microsoft.Owin.Security.OAuth;
using Newtonsoft.Json.Serialization;
namespace SettingsAPISample
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Configure Web API to use only bearer token authentication.
config.SuppressDefaultHostAuthentication();
config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));
config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{name}",
defaults: new { name = RouteParameter.Optional }
);
var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web.Http;
using Microsoft.Owin.Security.OAuth;
using Newtonsoft.Json.Serialization;
namespace SettingsAPISample
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Configure Web API to use only bearer token authentication.
config.SuppressDefaultHostAuthentication();
config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));
config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{name}",
defaults: new { name = RouteParameter.Optional }
);
}
}
}
| apache-2.0 | C# |
9ce77c0b4468893718e60c49708ac124dac9557f | Refactor Servicelevel class out of the rate class | goshippo/shippo-csharp-client | Shippo/Rate.cs | Shippo/Rate.cs | using System;
using Newtonsoft.Json;
namespace Shippo {
[JsonObject(MemberSerialization.OptIn)]
public class Rate : ShippoId {
[JsonProperty(PropertyName = "object_created")]
public object ObjectCreated { get; set; }
[JsonProperty(PropertyName = "object_owner")]
public object ObjectOwner { get; set; }
[JsonProperty(PropertyName = "attributes")]
public object Attributes { get; set; }
[JsonProperty(PropertyName = "amount_local")]
public object AmountLocal { get; set; }
[JsonProperty(PropertyName = "currency_local")]
public object CurrencyLocal { get; set; }
[JsonProperty(PropertyName = "amount")]
public object Amount { get; set; }
[JsonProperty(PropertyName = "currency")]
public object Currency { get; set; }
[JsonProperty(PropertyName = "provider")]
public object Provider { get; set; }
[JsonProperty(PropertyName = "provider_image_75")]
public object ProviderImage75 { get; set; }
[JsonProperty(PropertyName = "provider_image_200")]
public object ProviderImage200 { get; set; }
[JsonProperty(PropertyName = "servicelevel")]
public ServiceLevel Servicelevel { get; set; }
[JsonProperty(PropertyName = "estimated_days")]
public object EstimatedDays { get; set; }
[JsonProperty(PropertyName = "duration_terms")]
public object DurationTerms { get; set; }
[JsonProperty(PropertyName = "messages")]
public object Messages { get; set; }
[JsonProperty(PropertyName = "zone")]
public object Zone { get; set; }
}
public class ServiceLevel
{
[JsonProperty(PropertyName = "name")]
public object Name { get; set; }
[JsonProperty(PropertyName = "token")]
public object Token { get; set; }
[JsonProperty(PropertyName = "terms")]
public object Terms { get; set; }
}
}
| using System;
using Newtonsoft.Json;
namespace Shippo {
[JsonObject(MemberSerialization.OptIn)]
public class Rate : ShippoId {
[JsonProperty(PropertyName = "object_created")]
public object ObjectCreated { get; set; }
[JsonProperty(PropertyName = "object_owner")]
public object ObjectOwner { get; set; }
[JsonProperty(PropertyName = "attributes")]
public object Attributes { get; set; }
[JsonProperty(PropertyName = "amount_local")]
public object AmountLocal { get; set; }
[JsonProperty(PropertyName = "currency_local")]
public object CurrencyLocal { get; set; }
[JsonProperty(PropertyName = "amount")]
public object Amount { get; set; }
[JsonProperty(PropertyName = "currency")]
public object Currency { get; set; }
[JsonProperty(PropertyName = "provider")]
public object Provider { get; set; }
[JsonProperty(PropertyName = "provider_image_75")]
public object ProviderImage75 { get; set; }
[JsonProperty(PropertyName = "provider_image_200")]
public object ProviderImage200 { get; set; }
[JsonProperty(PropertyName = "servicelevel")]
public ServiceLevel Servicelevel { get; set; }
[JsonProperty(PropertyName = "estimated_days")]
public object EstimatedDays { get; set; }
[JsonProperty(PropertyName = "duration_terms")]
public object DurationTerms { get; set; }
[JsonProperty(PropertyName = "messages")]
public object Messages { get; set; }
[JsonProperty(PropertyName = "zone")]
public object Zone { get; set; }
public class ServiceLevel {
[JsonProperty (PropertyName = "name")]
public object Name { get; set; }
[JsonProperty (PropertyName = "token")]
public object Token { get; set; }
[JsonProperty (PropertyName = "terms")]
public object Terms { get; set; }
}
}
}
| apache-2.0 | C# |
d5eacff289c7ecfcd88ba1f9e166e86470edb767 | fix virtual | ucdavis/CRP,ucdavis/CRP,ucdavis/CRP | CRP.Core/Domain/FinancialAccount.cs | CRP.Core/Domain/FinancialAccount.cs | using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using UCDArch.Core.DomainModel;
namespace CRP.Core.Domain
{
public class FinancialAccount : DomainObject
{
public FinancialAccount()
{
}
[StringLength(128)]
[Required]
public virtual string Name { get; set; }
public virtual string Description { get; set; }
/// <summary>
/// Chart Code.
/// </summary>
[StringLength(1)]
[Required]
public virtual string Chart { get; set; }
/// <summary>
/// Account used in the general ledger.
/// Accounts are specific to a Chart Code.
/// </summary>
[StringLength(7)]
[RegularExpression("[A-Z0-9]*")]
[Required]
public virtual string Account { get; set; }
/// <summary>
/// Sub-Account is an optional accounting unit attribute.
/// Chart Code and Account are part of Sub-Account key.
/// </summary>
[StringLength(5)]
[DisplayFormat(NullDisplayText = "-----")]
public virtual string SubAccount { get; set; }
[StringLength(9)]
[DisplayFormat(NullDisplayText = "---------")]
public virtual string Project { get; set; }
public virtual Unit Unit { get; set; }
public virtual string GetAccountString()
{
if (string.IsNullOrWhiteSpace(SubAccount))
{
return $"{Chart}-{Account}";
}
return $"{Chart}-{Account}-{SubAccount}";
}
}
}
| using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using UCDArch.Core.DomainModel;
namespace CRP.Core.Domain
{
public class FinancialAccount : DomainObject
{
public FinancialAccount()
{
}
[StringLength(128)]
[Required]
public virtual string Name { get; set; }
public virtual string Description { get; set; }
/// <summary>
/// Chart Code.
/// </summary>
[StringLength(1)]
[Required]
public virtual string Chart { get; set; }
/// <summary>
/// Account used in the general ledger.
/// Accounts are specific to a Chart Code.
/// </summary>
[StringLength(7)]
[RegularExpression("[A-Z0-9]*")]
[Required]
public virtual string Account { get; set; }
/// <summary>
/// Sub-Account is an optional accounting unit attribute.
/// Chart Code and Account are part of Sub-Account key.
/// </summary>
[StringLength(5)]
[DisplayFormat(NullDisplayText = "-----")]
public virtual string SubAccount { get; set; }
[StringLength(9)]
[DisplayFormat(NullDisplayText = "---------")]
public virtual string Project { get; set; }
public virtual Unit Unit { get; set; }
public string GetAccountString()
{
if (string.IsNullOrWhiteSpace(SubAccount))
{
return $"{Chart}-{Account}";
}
return $"{Chart}-{Account}-{SubAccount}";
}
}
}
| mit | C# |
ee82455506a09e554268af1039dd014291a3314b | Fix non-generic dictionary serializer does not pack key value pair correctly. | undeadlabs/msgpack-cli,scopely/msgpack-cli,modulexcite/msgpack-cli,msgpack/msgpack-cli,modulexcite/msgpack-cli,msgpack/msgpack-cli,scopely/msgpack-cli,undeadlabs/msgpack-cli | src/MsgPack/Serialization/DefaultSerializers/NonGenericDictionarySerializer.cs | src/MsgPack/Serialization/DefaultSerializers/NonGenericDictionarySerializer.cs | using System;
using System.Collections;
using System.Runtime.Serialization;
namespace MsgPack.Serialization.DefaultSerializers
{
/// <summary>
/// Dictionary interface serializer.
/// </summary>
internal sealed class NonGenericDictionarySerializer : MessagePackSerializer<IDictionary>
{
private readonly IMessagePackSerializer _collectionDeserializer;
public NonGenericDictionarySerializer( SerializationContext ownerContext, Type targetType )
: base( ownerContext )
{
this._collectionDeserializer = ownerContext.GetSerializer( targetType );
}
protected internal override void PackToCore( Packer packer, IDictionary objectTree )
{
packer.PackMapHeader( objectTree.Count );
foreach ( DictionaryEntry item in objectTree )
{
if ( !( item.Key is MessagePackObject ) )
{
throw new SerializationException("Non generic dictionary may contain only MessagePackObject typed key.");
}
( item.Key as IPackable ).PackToMessage( packer, null );
if ( !( item.Value is MessagePackObject ) )
{
throw new SerializationException("Non generic dictionary may contain only MessagePackObject typed value.");
}
( item.Value as IPackable ).PackToMessage( packer, null ); }
}
protected internal override IDictionary UnpackFromCore( Unpacker unpacker )
{
return this._collectionDeserializer.UnpackFrom( unpacker ) as IDictionary;
}
}
} | using System;
using System.Collections;
namespace MsgPack.Serialization.DefaultSerializers
{
/// <summary>
/// Dictionary interface serializer.
/// </summary>
internal sealed class NonGenericDictionarySerializer : MessagePackSerializer<IDictionary>
{
private readonly System_Collections_DictionaryEntryMessagePackSerializer _entrySerializer;
private readonly IMessagePackSerializer _collectionDeserializer;
public NonGenericDictionarySerializer( SerializationContext ownerContext, Type targetType )
: base( ownerContext )
{
this._entrySerializer = new System_Collections_DictionaryEntryMessagePackSerializer( ownerContext );
this._collectionDeserializer = ownerContext.GetSerializer( targetType );
}
protected internal override void PackToCore( Packer packer, IDictionary objectTree )
{
packer.PackMapHeader( objectTree.Count );
foreach ( DictionaryEntry item in objectTree )
{
this._entrySerializer.PackToCore( packer, item );
}
}
protected internal override IDictionary UnpackFromCore( Unpacker unpacker )
{
return this._collectionDeserializer.UnpackFrom( unpacker ) as IDictionary;
}
}
} | apache-2.0 | C# |
10ef565455b8474874b9a6bbe0746f280e66418d | Fix typo | ptoonen/corefx,zhenlan/corefx,Ermiar/corefx,wtgodbe/corefx,Jiayili1/corefx,Jiayili1/corefx,Ermiar/corefx,ericstj/corefx,BrennanConroy/corefx,wtgodbe/corefx,wtgodbe/corefx,mmitche/corefx,ptoonen/corefx,Ermiar/corefx,axelheer/corefx,ericstj/corefx,wtgodbe/corefx,mmitche/corefx,ravimeda/corefx,Ermiar/corefx,ViktorHofer/corefx,mmitche/corefx,mmitche/corefx,ViktorHofer/corefx,Jiayili1/corefx,ravimeda/corefx,Jiayili1/corefx,ravimeda/corefx,axelheer/corefx,Ermiar/corefx,Jiayili1/corefx,wtgodbe/corefx,zhenlan/corefx,mmitche/corefx,ericstj/corefx,zhenlan/corefx,ptoonen/corefx,ViktorHofer/corefx,ravimeda/corefx,shimingsg/corefx,shimingsg/corefx,ravimeda/corefx,ViktorHofer/corefx,shimingsg/corefx,ravimeda/corefx,ericstj/corefx,mmitche/corefx,Ermiar/corefx,axelheer/corefx,ericstj/corefx,Jiayili1/corefx,Ermiar/corefx,ViktorHofer/corefx,wtgodbe/corefx,ericstj/corefx,mmitche/corefx,ericstj/corefx,ViktorHofer/corefx,shimingsg/corefx,wtgodbe/corefx,shimingsg/corefx,shimingsg/corefx,ptoonen/corefx,ptoonen/corefx,ptoonen/corefx,ViktorHofer/corefx,BrennanConroy/corefx,zhenlan/corefx,BrennanConroy/corefx,Jiayili1/corefx,ptoonen/corefx,axelheer/corefx,ravimeda/corefx,axelheer/corefx,axelheer/corefx,zhenlan/corefx,zhenlan/corefx,zhenlan/corefx,shimingsg/corefx | src/System.Runtime/tests/System/Reflection/ReflectionTypeLoadExceptionTests.cs | src/System.Runtime/tests/System/Reflection/ReflectionTypeLoadExceptionTests.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 Xunit;
namespace System.Reflection.Tests
{
public static class ReflectionTypeLoadExceptionTests
{
[Fact]
public static void NullExceptionsNoNullPointerException()
{
try
{
Type[] typo = new Type[1];
Exception[] excepto = new Exception[1];
throw new ReflectionTypeLoadException(typo, excepto, "Null elements in Exceptions array");
}
catch (ReflectionTypeLoadException e)
{
Assert.NotNull(e.ToString());
Assert.NotNull(e.Message);
}
}
[Fact]
public static void NullArgumentsNoNullPointerException()
{
try
{
throw new ReflectionTypeLoadException(null, null, "Null arguments");
}
catch (ReflectionTypeLoadException e)
{
Assert.NotNull(e.ToString());
Assert.NotNull(e.Message);
}
}
}
}
| // 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 Xunit;
namespace System.Reflection.Tests
{
public static class ReflectionTypeLoadExceptionTests
{
[Fact]
public static void NullExceptionsNoNullPointerException()
{
try
{
Type[] typo = new Type[1];
Exception[] Excepto = new exception[1];
throw new ReflectionTypeLoadException(typo, excepto, "Null elements in Exceptions array");
}
catch (ReflectionTypeLoadException e)
{
Assert.NotNull(e.ToString());
Assert.NotNull(e.Message);
}
}
[Fact]
public static void NullArgumentsNoNullPointerException()
{
try
{
throw new ReflectionTypeLoadException(null, null, "Null arguments");
}
catch (ReflectionTypeLoadException e)
{
Assert.NotNull(e.ToString());
Assert.NotNull(e.Message);
}
}
}
}
| mit | C# |
43e1e78712a11ce80f1cde3d6542cb37b978b80e | Bump version to 1.0.0rc4 | github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity | common/SolutionInfo.cs | common/SolutionInfo.cs | #pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
// this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics
internal const string VersionForAssembly = "1.0.0";
// Actual real version
internal const string Version = "1.0.0rc4";
}
}
| #pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
// this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics
internal const string VersionForAssembly = "1.0.0";
// Actual real version
internal const string Version = "1.0.0rc3";
}
}
| mit | C# |
7dce9c60c12768f1d11fcd9d2393908956eab349 | use guid not random | antony-liu/npoi,tonyqus/npoi | main/Util/TempFile.cs | main/Util/TempFile.cs |
namespace NPOI.Util
{
using System;
using System.IO;
using System.Threading;
public class TempFile
{
private static string dir;
/**
* Creates a temporary file. Files are collected into one directory and by default are
* deleted on exit from the VM. Files can be kept by defining the system property
* <c>poi.keep.tmp.files</c>.
*
* Dont forget to close all files or it might not be possible to delete them.
*/
public static FileInfo CreateTempFile(String prefix, String suffix)
{
if (dir == null)
{
dir = Directory.CreateDirectory(Path.GetTempPath() + @"\poifiles").FullName;
}
// Generate a unique new filename
string file= dir + "\\" + prefix + Guid.NewGuid().ToString() + suffix;
while (File.Exists(file))
{
file = dir + "\\" + prefix + Guid.NewGuid().ToString() + suffix;
Thread.Sleep(1);
}
FileStream newFile = new FileStream(file, FileMode.CreateNew, FileAccess.ReadWrite);
newFile.Close();
return new FileInfo(file);
}
public static string GetTempFilePath(String prefix, String suffix)
{
if (dir == null)
{
dir = Directory.CreateDirectory(Path.GetTempPath() + @"\poifiles").FullName;
}
Random rnd = new Random(DateTime.Now.Millisecond);
Thread.Sleep(10);
//return prefix + rnd.Next() + suffix;
return dir + "\\" + prefix + rnd.Next() + suffix;
}
}
}
|
namespace NPOI.Util
{
using System;
using System.IO;
using System.Threading;
public class TempFile
{
private static string dir;
/**
* Creates a temporary file. Files are collected into one directory and by default are
* deleted on exit from the VM. Files can be kept by defining the system property
* <c>poi.keep.tmp.files</c>.
*
* Dont forget to close all files or it might not be possible to delete them.
*/
public static FileInfo CreateTempFile(String prefix, String suffix)
{
if (dir == null)
{
dir = Directory.CreateDirectory(Path.GetTempPath() + @"\poifiles").FullName;
}
// Generate a unique new filename
Random rnd = new Random(DateTime.Now.Millisecond);
Thread.Sleep(1);
string file= dir + "\\" + prefix + rnd.Next() + suffix;
while (File.Exists(file))
{
file = dir + "\\" + prefix + rnd.Next() + suffix;
Thread.Sleep(1);
}
FileStream newFile = new FileStream(file, FileMode.CreateNew, FileAccess.ReadWrite);
newFile.Close();
return new FileInfo(file);
}
public static string GetTempFilePath(String prefix, String suffix)
{
if (dir == null)
{
dir = Directory.CreateDirectory(Path.GetTempPath() + @"\poifiles").FullName;
}
Random rnd = new Random(DateTime.Now.Millisecond);
Thread.Sleep(10);
//return prefix + rnd.Next() + suffix;
return dir + "\\" + prefix + rnd.Next() + suffix;
}
}
}
| apache-2.0 | C# |
1a0580763a4ee2b4e078fd7adbd4f15f729b91b4 | send fix | HackerDom/qctf-starter-2015,HackerDom/qctf-starter-2015,HackerDom/qctf-starter-2015,HackerDom/qctf-starter-2015 | checksystem/src/chat/Send.ashx.cs | checksystem/src/chat/Send.ashx.cs | using System;
using System.Web;
using main.auth;
using main.db;
using main.utils;
namespace main.chat
{
public class Send : BaseHandler
{
protected override AjaxResult ProcessRequestInternal(HttpContext context)
{
var login = AuthModule.GetAuthLogin();
var flags = DbStorage.FindFlags(login);
if(ElCapitan.GameEnded(flags))
throw new HttpException(403, "The End");
var user = DbStorage.FindUserByLogin(login);
if(user == null)
throw new HttpException(403, "Access denied");
if(user.EndTime != DateTime.MinValue && user.EndTime < DateTime.UtcNow)
throw new HttpException(403, "The End");
var question = context.Request.Form["question"].TrimToNull();
if(question == null)
throw new HttpException(400, "Message is empty");
if(question.Length > Settings.MaxMsgLength)
throw new HttpException(400, "Message too large");
Flag flag;
File[] files;
DateTime timer;
var answer = ElCapitan.GetAnswer(question, flags, out flag, out files, out timer);
var msg = new Msg {Text = answer, Time = DateTime.UtcNow, Type = MsgType.Answer};
DbStorage.AddDialog(login, new Msg {Text = question, Time = DateTime.UtcNow, Type = MsgType.Question}, new[] {msg}, flag, files);
return new AjaxResult {Messages = new[] {msg}, Files = files, Score = flag != null ? 1 : 0, Timer = timer == DateTime.MinValue ? DateTime.MinValue : (user.EndTime != DateTime.MinValue ? user.EndTime : timer)};
}
}
} | using System;
using System.Web;
using main.auth;
using main.db;
using main.utils;
namespace main.chat
{
public class Send : BaseHandler
{
protected override AjaxResult ProcessRequestInternal(HttpContext context)
{
var login = AuthModule.GetAuthLogin();
var flags = DbStorage.FindFlags(login);
if(ElCapitan.GameEnded(flags))
throw new HttpException(403, "The End");
var user = DbStorage.FindUserByLogin(login);
if(user == null)
throw new HttpException(403, "Access denied");
if(user.EndTime != DateTime.MinValue && user.EndTime < DateTime.UtcNow)
throw new HttpException(403, "The End");
var question = context.Request.Form["question"].TrimToNull();
if(question == null)
throw new HttpException(400, "Message is empty");
if(question.Length > Settings.MaxMsgLength)
throw new HttpException(400, "Message too large");
Flag flag;
File[] files;
DateTime timer;
var answer = ElCapitan.GetAnswer(question, flags, out flag, out files, out timer);
var msg = new Msg {Text = answer, Time = DateTime.UtcNow, Type = MsgType.Answer};
DbStorage.AddDialog(login, new Msg {Text = question, Time = DateTime.UtcNow, Type = MsgType.Question}, new[] {msg}, flag, files);
return new AjaxResult {Messages = new[] {msg}, Files = files, Score = flag != null ? 1 : 0, Timer = timer};
}
}
} | mit | C# |
41404661e37dbf364e5efc8d05dbf579353777d3 | Update Program.cs | hairywelly/StormMultilangCSharp,hairywelly/StormMultilangCSharp,hairywelly/StormMultilangCSharp | WordCountTest/Program.cs | WordCountTest/Program.cs | using StormMultiLang;
namespace WordCountTest
{
class Program
{
static void Main(string[] args)
{
var config = new StormConfigurationBuilder().DontBotherWithTaskIds();
var bolt = new SplitSentence(config.Reader(), config.BoltWriter());
bolt.Run();
}
}
}
| using StormMultiLang;
namespace WordCountTest
{
class Program
{
static void Main(string[] args)
{
var config = new StrormConfigurationBuilder().DontBotherWithTaskIds();
var bolt = new SplitSentence(config.Reader(), config.BoltWriter());
bolt.Run();
}
}
}
| mit | C# |
c5852c3b174c14f4cbe6c79a50f4cd0df13d4eef | Add 10s delay for always failing worker | Rosiv/backoffice,Rosiv/backoffice,Rosiv/backoffice | BackOffice.Worker/CProductAlwaysFailingReportWorker.cs | BackOffice.Worker/CProductAlwaysFailingReportWorker.cs | using BackOffice.Jobs.Interfaces;
using BackOffice.Jobs.Reports;
using System;
using System.Threading;
namespace BackOffice.Worker
{
public class CProductAlwaysFailingReportWorker : IJobWorker
{
private readonly AlwaysFailingReport report;
public CProductAlwaysFailingReportWorker(AlwaysFailingReport report)
{
this.report = report;
}
public void Start()
{
Thread.Sleep(10 * 1000);
throw new NotImplementedException();
}
}
}
| using BackOffice.Jobs.Interfaces;
using BackOffice.Jobs.Reports;
using System;
namespace BackOffice.Worker
{
public class CProductAlwaysFailingReportWorker : IJobWorker
{
private readonly AlwaysFailingReport report;
public CProductAlwaysFailingReportWorker(AlwaysFailingReport report)
{
this.report = report;
}
public void Start()
{
throw new NotImplementedException();
}
}
}
| mit | C# |
34e0da1a0b66bb6849acab06d82deea902661734 | Remove navbar | ethomson/gitresources,alsafonov/gitresources,alsafonov/gitresources,ethomson/gitresources | GitResources/Views/Shared/_Layout.cshtml | GitResources/Views/Shared/_Layout.cshtml | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@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("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)</li>
<li>@Html.ActionLink("API", "Index", "Help", new { area = "HelpPage" }, null)</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
-->
<div class="container body-content">
@RenderBody()
@RenderSection("SPAViews", required: false)
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("Scripts", required: false)
</body>
</html>
| <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@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("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)</li>
<li>@Html.ActionLink("API", "Index", "Help", new { area = "HelpPage" }, null)</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
@RenderSection("SPAViews", required: false)
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("Scripts", required: false)
</body>
</html>
| mit | C# |
f4a2875c779db2819fe3703b1aab961c77c7b876 | Bump version. | oozcitak/imagelistview | ImageListView/Properties/AssemblyInfo.cs | ImageListView/Properties/AssemblyInfo.cs | // ImageListView - A listview control for image files
// Copyright (C) 2009 Ozgur Ozcitak
//
// 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.
//
// Ozgur Ozcitak (ozcitak@yahoo.com)
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("ImageListView")]
[assembly: AssemblyDescription("A ListView like control for displaying image files with asynchronously loaded thumbnails.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Özgür Özçıtak")]
[assembly: AssemblyProduct("ImageListView")]
[assembly: AssemblyCopyright("Copyright © 2013 Özgür Özçıtak")]
[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("3eb67a8d-4c80-4c11-944d-c99ef0ec7eb9")]
// 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("12.0.0.0")]
[assembly: AssemblyFileVersion("12.0.0.0")]
| // ImageListView - A listview control for image files
// Copyright (C) 2009 Ozgur Ozcitak
//
// 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.
//
// Ozgur Ozcitak (ozcitak@yahoo.com)
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("ImageListView")]
[assembly: AssemblyDescription("A ListView like control for displaying image files with asynchronously loaded thumbnails.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Özgür Özçıtak")]
[assembly: AssemblyProduct("ImageListView")]
[assembly: AssemblyCopyright("Copyright © 2013 Özgür Özçıtak")]
[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("3eb67a8d-4c80-4c11-944d-c99ef0ec7eb9")]
// 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("11.2.0.0")]
[assembly: AssemblyFileVersion("11.2.0.0")]
| apache-2.0 | C# |
05e1bad8639c76c241c5748d7d097ab5c25186b1 | add 記帳本 route setting | hatelove/MyMvcHomework,hatelove/MyMvcHomework,hatelove/MyMvcHomework | MyMoney/MyMoney/App_Start/RouteConfig.cs | MyMoney/MyMoney/App_Start/RouteConfig.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace MyMoney
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Accouting",
url: "skilltree",
defaults: new { controller = "Accounting", action = "Add" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace MyMoney
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
| mit | C# |
c1082ddb9a7e03ac420a4cb7aa5e468dde614b22 | Add space before the unit | UselessToucan/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu | osu.Game.Rulesets.Osu/Mods/OsuModBarrelRoll.cs | osu.Game.Rulesets.Osu/Mods/OsuModBarrelRoll.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.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModBarrelRoll : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>
{
[SettingSource("Roll speed", "Rotations per minute")]
public BindableNumber<double> SpinSpeed { get; } = new BindableDouble(0.5)
{
MinValue = 0.02,
MaxValue = 4,
Precision = 0.01,
};
[SettingSource("Direction", "The direction of rotation")]
public Bindable<RotationDirection> Direction { get; } = new Bindable<RotationDirection>(RotationDirection.Clockwise);
public override string Name => "Barrel Roll";
public override string Acronym => "BR";
public override string Description => "The whole playfield is on a wheel!";
public override double ScoreMultiplier => 1;
public override string SettingDescription => $"{SpinSpeed.Value} rpm {Direction.Value.GetDescription().ToLowerInvariant()}";
public void Update(Playfield playfield)
{
playfield.Rotation = (Direction.Value == RotationDirection.CounterClockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
}
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
{
// scale the playfield to allow all hitobjects to stay within the visible region.
drawableRuleset.Playfield.Scale = new Vector2(OsuPlayfield.BASE_SIZE.Y / OsuPlayfield.BASE_SIZE.X);
}
}
}
| // 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.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModBarrelRoll : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>
{
[SettingSource("Roll speed", "Rotations per minute")]
public BindableNumber<double> SpinSpeed { get; } = new BindableDouble(0.5)
{
MinValue = 0.02,
MaxValue = 4,
Precision = 0.01,
};
[SettingSource("Direction", "The direction of rotation")]
public Bindable<RotationDirection> Direction { get; } = new Bindable<RotationDirection>(RotationDirection.Clockwise);
public override string Name => "Barrel Roll";
public override string Acronym => "BR";
public override string Description => "The whole playfield is on a wheel!";
public override double ScoreMultiplier => 1;
public override string SettingDescription => $"{SpinSpeed.Value}rpm {Direction.Value.GetDescription().ToLowerInvariant()}";
public void Update(Playfield playfield)
{
playfield.Rotation = (Direction.Value == RotationDirection.CounterClockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
}
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
{
// scale the playfield to allow all hitobjects to stay within the visible region.
drawableRuleset.Playfield.Scale = new Vector2(OsuPlayfield.BASE_SIZE.Y / OsuPlayfield.BASE_SIZE.X);
}
}
}
| mit | C# |
76aabdd2971effca216074ee33e7399b8e8b92b0 | rename field rotate to spin | peppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,2yangk23/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu,EVAST9919/osu,peppy/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,johnneijzen/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,smoogipooo/osu,smoogipoo/osu,EVAST9919/osu,peppy/osu-new,johnneijzen/osu | osu.Game.Rulesets.Osu/Skinning/LegacyCursor.cs | osu.Game.Rulesets.Osu/Skinning/LegacyCursor.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.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Osu.Skinning
{
public class LegacyCursor : CompositeDrawable
{
public LegacyCursor(bool spin = true)
{
Size = new Vector2(50);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
this.spin = spin;
}
private NonPlayfieldSprite cursor;
private readonly bool spin;
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
InternalChildren = new Drawable[]
{
new NonPlayfieldSprite
{
Texture = skin.GetTexture("cursormiddle"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
cursor = new NonPlayfieldSprite
{
Texture = skin.GetTexture("cursor"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
};
}
protected override void LoadComplete()
{
if (spin)
cursor.Spin(10000, RotationDirection.Clockwise);
}
}
}
| // 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.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Osu.Skinning
{
public class LegacyCursor : CompositeDrawable
{
public LegacyCursor(bool spin = true)
{
Size = new Vector2(50);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
rotate = spin;
}
private NonPlayfieldSprite cursor;
private readonly bool rotate;
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
InternalChildren = new Drawable[]
{
new NonPlayfieldSprite
{
Texture = skin.GetTexture("cursormiddle"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
cursor = new NonPlayfieldSprite
{
Texture = skin.GetTexture("cursor"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
};
}
protected override void LoadComplete()
{
if (rotate)
cursor.Spin(10000, RotationDirection.Clockwise);
}
}
}
| mit | C# |
78037962c763e9b7b5af784405144405342777fe | Format a little bit | Microsoft/poshtools,SpotLabsNET/poshtools,adamdriscoll/poshtools,mgreenegit/poshtools,YOTOV-LIMITED/poshtools,erwindevreugd/poshtools,zbrad/poshtools,KevinHorvatin/poshtools,daviwil/poshtools | PowerShellTools/Options/BitnessOption.cs | PowerShellTools/Options/BitnessOption.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PowerShellTools.Options
{
internal enum BitnessOptions
{
DefaultAsAnyCPU = 0,
x86 = 1
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PowerShellTools.Options
{
internal enum BitnessOptions
{
DefaultAsAnyCPU = 0,
x86 = 1
}
}
| apache-2.0 | C# |
79c7fad423018d34db9b1dadff967d8e3cc03a16 | Add small tolerance to image comparison | simontaylor81/Syrup,simontaylor81/Syrup | SRPTests/TestRenderer/ImageComparison.cs | SRPTests/TestRenderer/ImageComparison.cs | using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Xunit.Sdk;
namespace SRPTests.TestRenderer
{
static class ImageComparison
{
// Assert two bitmaps are binary identical.
public static void AssertImagesEqual(Bitmap expected, Bitmap actual)
{
Assert.Equal(expected.Width, actual.Width);
Assert.Equal(expected.Height, actual.Height);
Assert.Equal(expected.PixelFormat, actual.PixelFormat);
// Check pixels one by one.
for (int y = 0; y < expected.Height; y++)
{
for (int x = 0; x < expected.Width; x++)
{
AssertPixelsEqual(expected.GetPixel(x, y), actual.GetPixel(x, y), x, y);
}
}
}
// Custom equality assertion to allow the failing pixel to be reported.
private static void AssertPixelsEqual(Color expected, Color actual, int x, int y)
{
// This is pretty hacky, but GPU variations mean that the results can
// come out slightly differently on different hardware.
if (!EqualTolerance(expected.R, actual.R, 1) ||
!EqualTolerance(expected.G, actual.G, 1) ||
!EqualTolerance(expected.B, actual.B, 1) ||
!EqualTolerance(expected.A, actual.A, 1))
{
throw new PixelEqualException(expected, actual, x, y);
}
}
private static bool EqualTolerance(int a, int b, int tolerance) => Math.Abs(a - b) <= tolerance;
// Special equality exception to allow us to report which pixel failed.
class PixelEqualException : AssertActualExpectedException
{
public PixelEqualException(Color expected, Color actual, int x, int y)
: base(expected, actual, string.Format("Pixel mismatch at ({0}, {1})", x, y))
{
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Xunit.Sdk;
namespace SRPTests.TestRenderer
{
static class ImageComparison
{
// Assert two bitmaps are binary identical.
public static void AssertImagesEqual(Bitmap expected, Bitmap actual)
{
Assert.Equal(expected.Width, actual.Width);
Assert.Equal(expected.Height, actual.Height);
Assert.Equal(expected.PixelFormat, actual.PixelFormat);
// Check pixels one by one.
for (int y = 0; y < expected.Height; y++)
{
for (int x = 0; x < expected.Width; x++)
{
AssertPixelsEqual(expected.GetPixel(x, y), actual.GetPixel(x, y), x, y);
}
}
}
// Custom equality assertion to allow the failing pixel to be reported.
private static void AssertPixelsEqual(Color expected, Color actual, int x, int y)
{
if (expected != actual)
{
throw new PixelEqualException(expected, actual, x, y);
}
}
// Special equality exception to allow us to report which pixel failed.
class PixelEqualException : AssertActualExpectedException
{
public PixelEqualException(Color expected, Color actual, int x, int y)
: base(expected, actual, string.Format("Pixel mismatch at ({0}, {1})", x, y))
{
}
}
}
}
| mit | C# |
32cfe1d33330dd28d09cf128af1f24b0a452c3e4 | Revert "update" | bitzhuwei/CSharpGL,bitzhuwei/CSharpGL,bitzhuwei/CSharpGL | CSharpGL/0Foundations/OpenGLObjects/Texture/ImageFillers/TexBufferImageFiller.cs | CSharpGL/0Foundations/OpenGLObjects/Texture/ImageFillers/TexBufferImageFiller.cs | using System;
namespace CSharpGL
{
/// <summary>
/// fill texture's content with a buffer.
/// </summary>
public class TexBufferImageFiller : ImageFiller, IDisposable
{
private uint internalformat;
private BufferPtr bufferPtr;
private bool autoDispose;
/// <summary>
///
/// </summary>
/// <param name="internalformat"></param>
/// <param name="bufferPtr"></param>
/// <param name="autoDispose">Dispose <paramref name="bufferPtr"/> when this filler is disposed.</param>
public TexBufferImageFiller(uint internalformat, BufferPtr bufferPtr, bool autoDispose)
{
this.internalformat = internalformat;
this.bufferPtr = bufferPtr;
this.autoDispose = autoDispose;
}
/// <summary>
///
/// </summary>
public override void Fill()
{
OpenGL.GetDelegateFor<OpenGL.glTexBuffer>()(OpenGL.GL_TEXTURE_BUFFER, internalformat, bufferPtr.BufferId);
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
} // end sub
/// <summary>
/// Destruct instance of the class.
/// </summary>
~TexBufferImageFiller()
{
this.Dispose(false);
}
/// <summary>
/// Backing field to track whether Dispose has been called.
/// </summary>
private bool disposedValue = false;
/// <summary>
/// Dispose managed and unmanaged resources of this instance.
/// </summary>
/// <param name="disposing">If disposing equals true, managed and unmanaged resources can be disposed. If disposing equals false, only unmanaged resources can be disposed. </param>
private void Dispose(bool disposing)
{
if (this.disposedValue == false)
{
if (disposing)
{
// Dispose managed resources.
} // end if
// Dispose unmanaged resources.
if (this.autoDispose)
{
var disp = this.bufferPtr as IDisposable;
if (disp != null) { disp.Dispose(); }
}
} // end if
this.disposedValue = true;
} // end sub
}
} | namespace CSharpGL
{
/// <summary>
/// fill texture's content with a buffer.
/// </summary>
public class TexBufferImageFiller : ImageFiller
{
private uint internalformat;
private BufferPtr bufferPtr;
private bool autoDispose;
/// <summary>
///
/// </summary>
/// <param name="internalformat"></param>
/// <param name="bufferPtr"></param>
/// <param name="autoDispose">Dispose <paramref name="bufferPtr"/> when this filler is disposed.</param>
public TexBufferImageFiller(uint internalformat, BufferPtr bufferPtr, bool autoDispose)
{
this.internalformat = internalformat;
this.bufferPtr = bufferPtr;
this.autoDispose = autoDispose;
}
/// <summary>
///
/// </summary>
public override void Fill()
{
OpenGL.GetDelegateFor<OpenGL.glTexBuffer>()(OpenGL.GL_TEXTURE_BUFFER, internalformat, bufferPtr.BufferId);
if (this.autoDispose)
{
bufferPtr.Dispose();
bufferPtr = null;
}
}
}
} | mit | C# |
9028453c93f7a64ef9ba9e3fe7f5e09bb5b9463f | Make GetVersionInfo() work with newer versions of Newtonsoft.Json | imazen/imageflow-dotnet | src/Imageflow/Bindings/VersionInfo.cs | src/Imageflow/Bindings/VersionInfo.cs | using System;
using System.Xml;
namespace Imageflow.Bindings
{
public class VersionInfo
{
private VersionInfo() { }
internal static VersionInfo FromDynamic(dynamic versionInfo)
{
var info = new VersionInfo();
string longVersionString = versionInfo.long_version_string.Value;
string lastGitCommit = versionInfo.last_git_commit.Value;
bool dirtyWorkingTree = versionInfo.dirty_working_tree.Value;
// Sometimes Newtonsoft gives us a DateTime, other times a string.
object dateTime = versionInfo.build_date.Value;
if (dateTime is string)
{
info.BuildDate = XmlConvert.ToDateTime(dateTime as string, XmlDateTimeSerializationMode.Utc);
}
else if (dateTime is DateTime)
{
info.BuildDate = new DateTimeOffset((dateTime as DateTime?).Value);
}
info.LongVersionString = longVersionString;
info.LastGitCommit = lastGitCommit;
info.DirtyWorkingTree = dirtyWorkingTree;
return info;
}
public string LongVersionString { get; private set; }
public string LastGitCommit { get; private set; }
public bool DirtyWorkingTree { get; private set; }
public DateTimeOffset BuildDate { get; private set; }
}
} | using System;
using System.Xml;
namespace Imageflow.Bindings
{
public class VersionInfo
{
private VersionInfo() { }
internal static VersionInfo FromDynamic(dynamic versionInfo)
{
var info = new VersionInfo();
string dateTime = versionInfo.build_date.Value;
string longVersionString = versionInfo.long_version_string.Value;
string lastGitCommit = versionInfo.last_git_commit.Value;
bool dirtyWorkingTree = versionInfo.dirty_working_tree.Value;
info.BuildDate = XmlConvert.ToDateTime(dateTime, XmlDateTimeSerializationMode.Utc);
info.LongVersionString = longVersionString;
info.LastGitCommit = lastGitCommit;
info.DirtyWorkingTree = dirtyWorkingTree;
return info;
}
public string LongVersionString { get; private set; }
public string LastGitCommit { get; private set; }
public bool DirtyWorkingTree { get; private set; }
public DateTimeOffset BuildDate { get; private set; }
}
} | agpl-3.0 | C# |
ca2e4422394014dfb1d1c905dcefa2da754e3b06 | fix DataAccess project ITransaction name conflict | Ahoo-Wang/SmartSql | src/SmartSql.DataAccess/DataAccess.cs | src/SmartSql.DataAccess/DataAccess.cs | using SmartSql.Abstractions;
using System;
using System.Collections.Generic;
using System.Text;
using SmartSql.DataAccess.Abstractions;
using System.Data;
using SmartSql.Abstractions.DbSession;
using Microsoft.Extensions.Logging;
namespace SmartSql.DataAccess
{
public abstract class DataAccess : Abstractions.ITransaction
{
public DataAccess(String smartSqlMapConfigPath = "SmartSqlMapConfig.xml")
{
SqlMapper = MapperContainer.Instance.GetSqlMapper(smartSqlMapConfigPath);
InitScope();
}
public DataAccess(ILoggerFactory loggerFactory, String smartSqlMapConfigPath = "SmartSqlMapConfig.xml")
{
SqlMapper = MapperContainer.Instance.GetSqlMapper(new SmartSqlOptions
{
ConfigPath = smartSqlMapConfigPath,
LoggerFactory = loggerFactory
});
InitScope();
}
public DataAccess(ISmartSqlMapper sqlMapper)
{
SqlMapper = sqlMapper;
InitScope();
}
public string Scope { get; protected set; }
protected abstract void InitScope();
public ISmartSqlMapper SqlMapper { get; }
#region Transaction
/// <summary>
/// 开启事务
/// </summary>
/// <returns></returns>
public virtual IDbConnectionSession BeginTransaction()
{
return SqlMapper.BeginTransaction();
}
public virtual IDbConnectionSession BeginTransaction(IsolationLevel isolationLevel)
{
return SqlMapper.BeginTransaction(isolationLevel);
}
/// <summary>
/// 提交事务
/// </summary>
public virtual void CommitTransaction()
{
SqlMapper.CommitTransaction();
}
/// <summary>
/// 回滚事务
/// </summary>
public virtual void RollbackTransaction()
{
SqlMapper.RollbackTransaction();
}
#endregion
}
}
| using SmartSql.Abstractions;
using System;
using System.Collections.Generic;
using System.Text;
using SmartSql.DataAccess.Abstractions;
using System.Data;
using SmartSql.Abstractions.DbSession;
using Microsoft.Extensions.Logging;
namespace SmartSql.DataAccess
{
public abstract class DataAccess : ITransaction
{
public DataAccess(String smartSqlMapConfigPath = "SmartSqlMapConfig.xml")
{
SqlMapper = MapperContainer.Instance.GetSqlMapper(smartSqlMapConfigPath);
InitScope();
}
public DataAccess(ILoggerFactory loggerFactory, String smartSqlMapConfigPath = "SmartSqlMapConfig.xml")
{
SqlMapper = MapperContainer.Instance.GetSqlMapper(new SmartSqlOptions
{
ConfigPath = smartSqlMapConfigPath,
LoggerFactory = loggerFactory
});
InitScope();
}
public DataAccess(ISmartSqlMapper sqlMapper)
{
SqlMapper = sqlMapper;
InitScope();
}
public string Scope { get; protected set; }
protected abstract void InitScope();
public ISmartSqlMapper SqlMapper { get; }
#region Transaction
/// <summary>
/// 开启事务
/// </summary>
/// <returns></returns>
public virtual IDbConnectionSession BeginTransaction()
{
return SqlMapper.BeginTransaction();
}
public virtual IDbConnectionSession BeginTransaction(IsolationLevel isolationLevel)
{
return SqlMapper.BeginTransaction(isolationLevel);
}
/// <summary>
/// 提交事务
/// </summary>
public virtual void CommitTransaction()
{
SqlMapper.CommitTransaction();
}
/// <summary>
/// 回滚事务
/// </summary>
public virtual void RollbackTransaction()
{
SqlMapper.RollbackTransaction();
}
#endregion
}
}
| apache-2.0 | C# |
c6e57670eca9387d0cb905674a7a723c77226e7a | write hello world to the console | cdemaskey/coffee-roaster,cdemaskey/coffee-roaster | coffee-roaster/coffee-roaster/Program.cs | coffee-roaster/coffee-roaster/Program.cs | using System;
namespace coffee_roaster
{
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace coffee_roaster
{
class Program
{
static void Main(string[] args)
{
}
}
}
| mit | C# |
1754cdb844416ad1a0a21e6cbec6b1a51b94a56b | index html changes for home | bluemner/FormsGenerator,bluemner/FormsGenerator,bluemner/FormsGenerator | FormsGeneratorWebApplication/Views/Forms/Index.cshtml | FormsGeneratorWebApplication/Views/Forms/Index.cshtml | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>Welcome to Forms</h1>
<p>This application allows user to create and modify surveys, send them out, keep track of them, view the analytics of the responses and be able to download that data.</p>
<p><a class="btn btn-primary btn-lg" href="@Url.Action("Index","FormsAdmin")">Lets Get Started »</a></p>
</div>
<div class="row">
<div class="col-md-6">
<h2>Anonymous of Submission Form</h2>
<p class="text-">Anonymity was also huge for us, so when a Admin sends out the surveys to whomever, and when they get submitted, the Admin will not be able to see who submitted which response.</p>
</div>
<div class="col-md-6">
<h2>Analytics/Download</h2>
<p>
The application will also keep track of their previous surveys and be able to still view the analytics and download the stats.
</p>
</div>
</div> |
@{
ViewBag.Title = "Index";
}
<h2>Forms Index</h2>
@Scripts.Render("~/Scripts/views/forms-view.js") | mit | C# |
cfcffea6443845e92e53dbe1b1b4ae55414df11d | Add boss microgame length option | plrusek/NitoriWare,Barleytree/NitoriWare,uulltt/NitoriWare,NitorInc/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare | Assets/Scripts/Microgame/MicrogameTraits.cs | Assets/Scripts/Microgame/MicrogameTraits.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class MicrogameTraits : MonoBehaviour
{
[SerializeField]
private ControlScheme _controlScheme;
public virtual ControlScheme controlScheme { get { return _controlScheme; } set { } }
[SerializeField]
private bool _hideCursor;
public virtual bool hideCursor { get { return _hideCursor; } set { } }
[SerializeField]
private Duration _duration;
public virtual Duration duration { get { return _duration; } set { } }
[SerializeField]
private bool _canEndEarly;
public virtual bool canEndEarly { get { return _canEndEarly; } set { } }
[SerializeField]
private string _command;
public virtual string command { get { return _command; } set { } }
public virtual string localizedCommand { get { return TextHelper.getLocalizedText("microgame." + microgameId + ".command", command); } set { } }
[SerializeField]
private bool _defaultVictory;
public virtual bool defaultVictory { get { return _defaultVictory; } set { } }
[SerializeField]
private float _victoryVoiceDelay, _failureVoiceDelay;
public virtual float victoryVoiceDelay { get { return _victoryVoiceDelay; } set { } }
public virtual float failureVoiceDelay { get { return _failureVoiceDelay; } set { } }
[SerializeField]
private AudioClip _musicClip;
public virtual AudioClip musicClip{ get { return _musicClip; } set { } }
private string _microgameId;
public string microgameId { get { return _microgameId; } set { } }
public enum ControlScheme
{
Key,
Mouse
}
public enum Duration
{
Short8Beats,
Long16Beats,
BossGame
}
public virtual void onAccessInStage(string microgameId)
{
this._microgameId = microgameId;
}
public float getDurationInBeats()
{
return duration == Duration.Long16Beats ? 16f : (duration == Duration.BossGame ? float.PositiveInfinity : 8f);
}
public static MicrogameTraits findMicrogameTraits(string microgameId, int difficulty)
{
GameObject traits = Resources.Load<GameObject>("Microgames/_Finished/" + microgameId + "/Traits" + difficulty.ToString());
if (traits != null)
return traits.GetComponent<MicrogameTraits>();
traits = Resources.Load<GameObject>("Microgames/" + microgameId + "/Traits" + difficulty.ToString());
if (traits != null)
return traits.GetComponent<MicrogameTraits>();
traits = Resources.Load<GameObject>("Microgames/_Bosses/" + microgameId + "/Traits" + difficulty.ToString());
if (traits != null)
return traits.GetComponent<MicrogameTraits>();
Debug.LogError("Can't find Traits prefab for " + microgameId + difficulty.ToString());
return null;
}
} | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class MicrogameTraits : MonoBehaviour
{
[SerializeField]
private ControlScheme _controlScheme;
public virtual ControlScheme controlScheme { get { return _controlScheme; } set { } }
[SerializeField]
private bool _hideCursor;
public virtual bool hideCursor { get { return _hideCursor; } set { } }
[SerializeField]
private Duration _duration;
public virtual Duration duration { get { return _duration; } set { } }
[SerializeField]
private bool _canEndEarly;
public virtual bool canEndEarly { get { return _canEndEarly; } set { } }
[SerializeField]
private string _command;
public virtual string command { get { return _command; } set { } }
public virtual string localizedCommand { get { return TextHelper.getLocalizedText("microgame." + microgameId + ".command", command); } set { } }
[SerializeField]
private bool _defaultVictory;
public virtual bool defaultVictory { get { return _defaultVictory; } set { } }
[SerializeField]
private float _victoryVoiceDelay, _failureVoiceDelay;
public virtual float victoryVoiceDelay { get { return _victoryVoiceDelay; } set { } }
public virtual float failureVoiceDelay { get { return _failureVoiceDelay; } set { } }
[SerializeField]
private AudioClip _musicClip;
public virtual AudioClip musicClip{ get { return _musicClip; } set { } }
private string _microgameId;
public string microgameId { get { return _microgameId; } set { } }
public enum ControlScheme
{
Key,
Mouse
}
public enum Duration
{
Short8Beats,
Long16Beats
}
public virtual void onAccessInStage(string microgameId)
{
this._microgameId = microgameId;
}
public float getDurationInBeats()
{
return duration == Duration.Short8Beats ? 8f : 16f;
}
public static MicrogameTraits findMicrogameTraits(string microgameId, int difficulty)
{
GameObject traits = Resources.Load<GameObject>("Microgames/_Finished/" + microgameId + "/Traits" + difficulty.ToString());
if (traits != null)
return traits.GetComponent<MicrogameTraits>();
traits = Resources.Load<GameObject>("Microgames/" + microgameId + "/Traits" + difficulty.ToString());
if (traits != null)
return traits.GetComponent<MicrogameTraits>();
traits = Resources.Load<GameObject>("Microgames/_Bosses/" + microgameId + "/Traits" + difficulty.ToString());
if (traits != null)
return traits.GetComponent<MicrogameTraits>();
Debug.LogError("Can't find Traits prefab for " + microgameId + difficulty.ToString());
return null;
}
} | mit | C# |
0ce6e92967c85c680b3d682ea9bf92998f0a3773 | 修正 offset 的計算公式 | andrew0928/WebServerClock | WebServerClock/Form1.cs | WebServerClock/Form1.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WebServerClock
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.labClock.Text = (DateTime.Now + this.Offset).ToString("HH:mm:ss.f");
}
private TimeSpan Offset = TimeSpan.Zero;
private void button1_Click(object sender, EventArgs e)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(this.textWebSiteURL.Text);
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Head, "/");
DateTime t0 = DateTime.Now;
HttpResponseMessage rsp = client.SendAsync(req, HttpCompletionOption.ResponseHeadersRead).Result;
DateTime t3 = DateTime.Now;
TimeSpan duration = t3 - t0;
DateTime t1p = DateTime.Parse(rsp.Headers.GetValues("Date").First());
this.Offset = t1p - t0.AddMilliseconds(duration.TotalMilliseconds / 2);
this.labelOffset.Text = string.Format(
@"時間差: {0} msec, 最大誤差值: {1} msec",
this.Offset.TotalMilliseconds,
duration.TotalMilliseconds / 2);
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WebServerClock
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.labClock.Text = (DateTime.Now + this.Offset).ToString("HH:mm:ss.f");
}
private TimeSpan Offset = TimeSpan.Zero;
private void button1_Click(object sender, EventArgs e)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(this.textWebSiteURL.Text);
HttpRequestMessage hrm = new HttpRequestMessage(HttpMethod.Head, "/");
DateTime start = DateTime.Now;
HttpResponseMessage rsp = client.SendAsync(hrm, HttpCompletionOption.ResponseHeadersRead).Result;
TimeSpan deviation = DateTime.Now - start;
this.Offset = DateTime.Parse(rsp.Headers.GetValues("Date").First()) - DateTime.Now;
this.labelOffset.Text = string.Format(
@"時間差: {0} msec, 最大誤差值: {1} msec",
this.Offset.TotalMilliseconds,
deviation.TotalMilliseconds);
}
}
}
| mit | C# |
8faec2c8eb1ae786653da299a5a964e2f25b06f3 | Remove Beep; Throw instead | HelloKitty/Testity,HelloKitty/Testity | src/Testity.BuildProcess.Unity3D/BuildSteps/AddMemberInitializationMethodStep.cs | src/Testity.BuildProcess.Unity3D/BuildSteps/AddMemberInitializationMethodStep.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Fasterflect;
using Testity.Common;
using Testity.EngineComponents.Unity3D;
namespace Testity.BuildProcess.Unity3D
{
public class AddMemberInitializationMethodStep : ITestityBuildStep
{
private readonly ITypeRelationalMapper typeResolver;
private readonly ITypeMemberParser typeParser;
private readonly IInitializationExpressionBuilderProvider initExpressionBuildProvider;
public AddMemberInitializationMethodStep(ITypeRelationalMapper mapper, ITypeMemberParser parser, IInitializationExpressionBuilderProvider provider)
{
typeResolver = mapper;
typeParser = parser;
initExpressionBuildProvider = provider;
}
public void Process(IClassBuilder builder, Type typeToParse)
{
IEnumerable<MemberInfo> serializedMemberInfos = typeParser.Parse(MemberTypes.Field | MemberTypes.Property, typeToParse);
List<IInitializationExpression> initExpressions = new List<IInitializationExpression>(serializedMemberInfos.Count());
foreach (MemberInfo mi in serializedMemberInfos)
{
//find a an experssion builder for the source -> dest type
IInitializationExpressionBuilder expressionBuilder = initExpressionBuildProvider.FromReflectionData(typeResolver.ResolveMappedType(mi.Type()), mi.Type());
if (expressionBuilder == null)
continue; //this is for testing. Don't do this in the future.
else
{
IInitializationExpression expression = expressionBuilder.Build(new InitializationExpressionData(mi.Name, mi.MemberType, mi.Name),
typeof(TestityBehaviour<>).MembersWith<ImplementationField>(MemberTypes.Field, Flags.InstanceAnyVisibility).First().Name); //get the testity field we need to assign this too
if (expression == null)
throw new InvalidOperationException("Unable to build expression for init for Member: " + mi.Name + " in Type: " + mi.Type().ToString());
initExpressions.Add(expression);
}
}
//Give the block provider the expressions we want and find the name of the field in the MonoBehaviour that must be set.
UnityInitializationMethodImplementationProvider blockProvider =
new UnityInitializationMethodImplementationProvider(initExpressions);
//Using the default member provider and the block provider we quite complexly just built above we can add the initialization method.
builder.AddMemberMethod(new DefaultMemberImplementationProvider(typeof(void), MemberImplementationModifier.Override | MemberImplementationModifier.Protected, "InitializeScriptComponentMemberValues"),
blockProvider);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Fasterflect;
using Testity.Common;
using Testity.EngineComponents.Unity3D;
namespace Testity.BuildProcess.Unity3D
{
public class AddMemberInitializationMethodStep : ITestityBuildStep
{
private readonly ITypeRelationalMapper typeResolver;
private readonly ITypeMemberParser typeParser;
private readonly IInitializationExpressionBuilderProvider initExpressionBuildProvider;
public AddMemberInitializationMethodStep(ITypeRelationalMapper mapper, ITypeMemberParser parser, IInitializationExpressionBuilderProvider provider)
{
typeResolver = mapper;
typeParser = parser;
initExpressionBuildProvider = provider;
}
public void Process(IClassBuilder builder, Type typeToParse)
{
IEnumerable<MemberInfo> serializedMemberInfos = typeParser.Parse(MemberTypes.Field | MemberTypes.Property, typeToParse);
List<IInitializationExpression> initExpressions = new List<IInitializationExpression>(serializedMemberInfos.Count());
foreach (MemberInfo mi in serializedMemberInfos)
{
//find a an experssion builder for the source -> dest type
IInitializationExpressionBuilder expressionBuilder = initExpressionBuildProvider.FromReflectionData(typeResolver.ResolveMappedType(mi.Type()), mi.Type());
if (expressionBuilder == null)
continue; //this is for testing. Don't do this in the future.
else
{
IInitializationExpression expression = expressionBuilder.Build(new InitializationExpressionData(mi.Name, mi.MemberType, mi.Name),
typeof(TestityBehaviour<>).MembersWith<ImplementationField>(MemberTypes.Field, Flags.InstanceAnyVisibility).First().Name); //get the testity field we need to assign this too
if (expression == null)
Console.Beep();
initExpressions.Add(expression);
}
}
//Give the block provider the expressions we want and find the name of the field in the MonoBehaviour that must be set.
UnityInitializationMethodImplementationProvider blockProvider =
new UnityInitializationMethodImplementationProvider(initExpressions);
//Using the default member provider and the block provider we quite complexly just built above we can add the initialization method.
builder.AddMemberMethod(new DefaultMemberImplementationProvider(typeof(void), MemberImplementationModifier.Override | MemberImplementationModifier.Protected, "InitializeScriptComponentMemberValues"),
blockProvider);
}
}
}
| mit | C# |
a2682f4a6c4048a71ae1e105ca9e7786e7f50905 | Adjust interop flags. | beppler/trayleds | TrayLeds/NativeMethods.cs | TrayLeds/NativeMethods.cs | using System;
using System.Runtime.InteropServices;
namespace TrayLeds
{
internal class NativeMethods
{
public const int WH_KEYBOARD_LL = 13;
public const int WM_KEYDOWN = 0x100;
public const int WM_SYSKEYDOWN = 0x104;
public const int WM_KEYUP = 0x101;
public const int WM_SYSKEYUP = 0x105;
public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SetWindowsHookEx(int idHook, HookProc callback, IntPtr hInstance, uint threadId);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool UnhookWindowsHookEx(IntPtr hInstance);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetModuleHandle(string moduleName);
}
}
| using System;
using System.Runtime.InteropServices;
namespace TrayLeds
{
internal class NativeMethods
{
public const int WH_KEYBOARD_LL = 13;
public const int WM_KEYDOWN = 0x100;
public const int WM_SYSKEYDOWN = 0x104;
public const int WM_KEYUP = 0x101;
public const int WM_SYSKEYUP = 0x105;
public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SetWindowsHookEx(int idHook, HookProc callback, IntPtr hInstance, uint threadId);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool UnhookWindowsHookEx(IntPtr hInstance);
[DllImport("user32.dll")]
public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetModuleHandle(string moduleName);
}
}
| mit | C# |
b002096bd9159279b29ea1ec0cf9a0d1e001c098 | Fix AssemblyVersion | dmitry-shechtman/AsyncInit | AsyncInit/Net45/Properties/AssemblyInfo.cs | AsyncInit/Net45/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Ditto.AsyncInit")]
[assembly: AssemblyDescription("A generic implementation of the asynchronous factory pattern.")]
[assembly: AssemblyVersion("1.5.0.*")]
[assembly: ComVisible(false)]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Ditto.AsyncInit")]
[assembly: AssemblyDescription("A generic implementation of the asynchronous factory pattern.")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
| apache-2.0 | C# |
bc0e1adec47177a25cc921b4b91f5ea1875f246a | Update IPlatService.cs | Nutritia/nutritia,Corantin/nutritia,glesaux/nutritia | Logic/Services/Definitions/IPlatService.cs | Logic/Services/Definitions/IPlatService.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nutritia
{
public interface IPlatService
{
IList<Plat> RetrieveAll();
IList<Plat> RetrieveSome(RetrievePlatArgs args);
Plat Retrieve(RetrievePlatArgs args);
IList<Aliment> RetrieveAlimentsPlat(RetrievePlatArgs args);
void Update(Plat plat);
void Insert(Plat unPlat);
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nutritia
{
public interface IPlatService
{
IList<Plat> RetrieveAll();
IList<Plat> RetrieveSome(RetrievePlatArgs args);
Plat Retrieve(RetrievePlatArgs args);
IList<Aliment> RetrieveAlimentsPlat(RetrievePlatArgs args);
void Update(Plat plat);
void Insert(Plat unPlat);
}
}
| mpl-2.0 | C# |
13e043787b71d6fa6d44b87f07fe95fa4f56339f | 修正切換鈕的狀態在 post back 之後變回舊值的問題; | lozenlin/SampleCMS,lozenlin/SampleCMS,lozenlin/SampleCMS | Source/Management/App_Code/AssemblyInfo.cs | Source/Management/App_Code/AssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("SampleCMS Management")]
[assembly: AssemblyProduct("SampleCMS Management")]
[assembly: AssemblyCopyright("Copyright © 2018, based on SampleCMS Management v1.2")]
[assembly: AssemblyVersion("1.2.3.*")]
// If you encounter a compilation error with AssemblyInfo, you can delete this file.
| using System.Reflection;
[assembly: AssemblyTitle("SampleCMS Management")]
[assembly: AssemblyProduct("SampleCMS Management")]
[assembly: AssemblyCopyright("Copyright © 2018, based on SampleCMS Management v1.2")]
[assembly: AssemblyVersion("1.2.2.*")]
// If you encounter a compilation error with AssemblyInfo, you can delete this file.
| mit | C# |
65746f809edc34cc8ada74bf2d806fb8fa427ac9 | Fix inaccurate file count | NateShoffner/Strike.NET | Strike.NET/Converters/FileInfoConverter.cs | Strike.NET/Converters/FileInfoConverter.cs | #region
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
#endregion
namespace StrikeNET.Converters
{
internal class FileInfoConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteValue(value.ToString());
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var files = new List<TorrentFileInfo>();
var fileInfo = JArray.Load(reader);
var o = fileInfo.First;
if (o != null)
{
var fileNamesArray = o.SelectToken("file_names") as JArray;
var fileLengthsArray = o.SelectToken("file_lengths") as JArray;
if (fileNamesArray != null && fileLengthsArray != null)
{
var fileNames = new List<string>(fileNamesArray.Values<string>());
var fileLengths = new List<long>(fileLengthsArray.Values<long>());
//increment using lengths since 'file_names'
//includes directories as well
var total = fileLengths.Count;
for (var i = 0; i < total; i++)
{
var fi = new TorrentFileInfo(fileNames[i], fileLengths[i]);
files.Add(fi);
}
}
}
return files;
}
public override bool CanConvert(Type objectType)
{
return objectType == typeof (List<TorrentFileInfo>);
}
}
} | #region
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
#endregion
namespace StrikeNET.Converters
{
internal class FileInfoConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteValue(value.ToString());
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var files = new List<TorrentFileInfo>();
var fileInfo = JArray.Load(reader);
var o = fileInfo.First;
if (o != null)
{
var fileNamesArray = o.SelectToken("file_names") as JArray;
var fileLengthsArray = o.SelectToken("file_lengths") as JArray;
if (fileNamesArray != null && fileLengthsArray != null)
{
var fileNames = new List<string>(fileNamesArray.Values<string>());
var fileLengths = new List<long>(fileLengthsArray.Values<long>());
var total = fileNames.Count();
for (var i = 0; i < total; i++)
{
var fi = new TorrentFileInfo(fileNames[i], fileLengths[i]);
files.Add(fi);
}
}
}
return files;
}
public override bool CanConvert(Type objectType)
{
return objectType == typeof (List<TorrentFileInfo>);
}
}
} | mit | C# |
20acf0e0d3eef07b28f08792a7a324473d9f1747 | bump up version | hoseinisalim/ZigorTimeTable,Resaneh24/ZigorTimeTable,hoseinisalim/ZigorTimeTable,hoseinisalim/ZigorTimeTable,Resaneh24/ZigorTimeTable,hoseinisalim/ZigorTimeTable,Resaneh24/ZigorTimeTable,Resaneh24/ZigorTimeTable | CSharp/ZgTimeTable/ZgTimeTable/Properties/AssemblyInfo.cs | CSharp/ZgTimeTable/ZgTimeTable/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("ZgTimeTable")]
[assembly: AssemblyDescription("Zigor protocol time table implementations")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Resaneh24")]
[assembly: AssemblyProduct("ZgTimeTable")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("Resaneh24")]
[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("5b4d731f-2351-4bd7-b292-cff3c2f565d3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.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("ZgTimeTable")]
[assembly: AssemblyDescription("Zigor protocol time table implementations")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Resaneh24")]
[assembly: AssemblyProduct("ZgTimeTable")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("Resaneh24")]
[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("5b4d731f-2351-4bd7-b292-cff3c2f565d3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
| apache-2.0 | C# |
3997f65dd24a11fa2acee6a1660a5d40dab27489 | add regex to parse date | jgraber/ForgetTheMilk,jgraber/ForgetTheMilk,jgraber/ForgetTheMilk | ForgetTheMilk/ForgetTheMilk/Controllers/TaskController.cs | ForgetTheMilk/ForgetTheMilk/Controllers/TaskController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Mvc;
namespace ForgetTheMilk.Controllers
{
public class TaskController : Controller
{
public ActionResult Index()
{
return View(Tasks);
}
public static readonly List<Task> Tasks = new List<Task>();
[HttpPost]
public ActionResult Add(string task)
{
var taskItem = new Task {Description = task};
var dueDatePattern = new Regex(@"may\s(\d)");
var hasDueDate = dueDatePattern.IsMatch(task);
if (hasDueDate)
{
var dueDate = dueDatePattern.Match(task);
var day = Convert.ToInt32(dueDate.Groups[1].Value);
taskItem.DueDate = new DateTime(DateTime.Today.Year, 5, day);
}
Tasks.Add(taskItem);
return RedirectToAction("Index");
}
}
public class Task
{
public string Description { get; set; }
public DateTime? DueDate { get; set; }
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace ForgetTheMilk.Controllers
{
public class TaskController : Controller
{
public ActionResult Index()
{
return View(Tasks);
}
public static readonly List<Task> Tasks = new List<Task>();
[HttpPost]
public ActionResult Add(string task)
{
Tasks.Add(new Task() {Description = task});
return RedirectToAction("Index");
}
}
public class Task
{
public string Description { get; set; }
public DateTime? DueDate { get; set; }
}
} | apache-2.0 | C# |
ec7d7a15ced0ab2af7751d8d20d3da8c1b0177ee | implement submitting charge request | innerfence/chargedemo-windows | InnerFence.ChargeDemo.Phone/ChargeAPI/ChargeUtilsPhone.cs | InnerFence.ChargeDemo.Phone/ChargeAPI/ChargeUtilsPhone.cs | using System;
using System.Collections.Generic;
using System.IO.IsolatedStorage;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Windows.System;
namespace InnerFence.ChargeAPI
{
public static partial class ChargeUtils
{
private static RandomNumberGenerator s_rng;
public static void DeleteLocalData(string key)
{
IsolatedStorageSettings.ApplicationSettings.Remove(key);
}
public static object RetrieveLocalData(string key)
{
if (IsolatedStorageSettings.ApplicationSettings.Contains(key))
{
return IsolatedStorageSettings.ApplicationSettings[key];
}
return null;
}
public static void SaveLocalData(string key, object value)
{
IsolatedStorageSettings.ApplicationSettings[key] = value;
IsolatedStorageSettings.ApplicationSettings.Save();
}
public static async void SubmitChargeRequest(ChargeRequest chargeRequest)
{
Uri launchURL = chargeRequest.GenerateLaunchURL();
var success = await Launcher.LaunchUriAsync(launchURL);
if (!success)
{
throw new ChargeException("Could not launch Credit Card Terminal. Please ensure it has been installed.");
}
}
public static uint GenerateRandomNumber()
{
if (s_rng == null)
{
s_rng = new RNGCryptoServiceProvider();
}
byte[] bytes = new byte[4];
s_rng.GetBytes(bytes);
return BitConverter.ToUInt32(bytes, 0);
}
}
}
| using System;
using System.Collections.Generic;
using System.IO.IsolatedStorage;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace InnerFence.ChargeAPI
{
public static partial class ChargeUtils
{
private static RandomNumberGenerator s_rng;
public static void DeleteLocalData(string key)
{
IsolatedStorageSettings.ApplicationSettings.Remove(key);
}
public static object RetrieveLocalData(string key)
{
if (IsolatedStorageSettings.ApplicationSettings.Contains(key))
{
return IsolatedStorageSettings.ApplicationSettings[key];
}
return null;
}
public static void SaveLocalData(string key, object value)
{
IsolatedStorageSettings.ApplicationSettings[key] = value;
IsolatedStorageSettings.ApplicationSettings.Save();
}
public static void SubmitChargeRequest(ChargeRequest chargeRequest)
{
// TODO
throw new NotImplementedException();
}
public static uint GenerateRandomNumber()
{
if (s_rng == null)
{
s_rng = new RNGCryptoServiceProvider();
}
byte[] bytes = new byte[4];
s_rng.GetBytes(bytes);
return BitConverter.ToUInt32(bytes, 0);
}
}
}
| mit | C# |
586fdaa5a69a212e1a80d28a6ace73df681d939f | Make the discovery context null tests pass. | SeanFarrow/NBench.VisualStudio | src/NBench.VisualStudio.TestAdapter/NBenchTestDiscoverer.cs | src/NBench.VisualStudio.TestAdapter/NBenchTestDiscoverer.cs | namespace NBench.VisualStudio.TestAdapter
{
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
public class NBenchTestDiscoverer : ITestDiscoverer
{
public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
{
if (sources == null)
{
throw new ArgumentNullException("sources", "The sources collection you have passed in is null. The source collection must be populated.");
}
else if (!sources.Any())
{
throw new ArgumentException("The sources collection you have passed in is empty. The source collection must be populated.", "sources");
}
else if (discoveryContext == null)
{
throw new ArgumentNullException("discoveryContext", "The discovery context you have passed in is null. The discovery context must not be null.");
}
throw new NotImplementedException();
}
}
} | namespace NBench.VisualStudio.TestAdapter
{
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
public class NBenchTestDiscoverer : ITestDiscoverer
{
public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
{
if (sources == null)
{
throw new ArgumentNullException("sources", "The sources collection you have passed in is null. The source collection must be populated.");
}
else if (!sources.Any())
{
throw new ArgumentException("The sources collection you have passed in is empty. The source collection must be populated.", "sources");
}
throw new NotImplementedException();
}
}
} | apache-2.0 | C# |
0eac2401de6d75bc0f18adc393f4da557ac098d7 | make the failing test passed. | SeanFarrow/NBench.VisualStudio | src/NBench.VisualStudio.TestAdapter/NBenchTestDiscoverer.cs | src/NBench.VisualStudio.TestAdapter/NBenchTestDiscoverer.cs | namespace NBench.VisualStudio.TestAdapter
{
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using NBench.VisualStudio.TestAdapter.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
public class NBenchTestDiscoverer : ITestDiscoverer
{
private INBenchFunctionalityWrapper functionalitywrapper;
public NBenchTestDiscoverer(INBenchFunctionalityWrapper functionalityWrapper)
{
if (functionalityWrapper == null)
{
throw new ArgumentNullException("functionalityWrapper", "The NBench functionality wrapper you have passed in is null. The NBench functionality wrapper must not be null.");
}
this.functionalitywrapper = functionalityWrapper;
}
public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
{
if (sources == null)
{
throw new ArgumentNullException("sources", "The sources collection you have passed in is null. The source collection must be populated.");
}
else if (!sources.Any())
{
throw new ArgumentException("The sources collection you have passed in is empty. The source collection must be populated.", "sources");
}
else if (discoveryContext == null)
{
throw new ArgumentNullException("discoveryContext", "The discovery context you have passed in is null. The discovery context must not be null.");
}
else if (logger == null)
{
throw new ArgumentNullException("logger", "The message logger you have passed in is null. The message logger must not be null.");
}
else if (discoverySink == null)
{
throw new ArgumentNullException("discoverySink", "The test case discovery sink you have passed in is null. The test case discovery sink must not be null.");
}
throw new NotImplementedException();
}
}
} | namespace NBench.VisualStudio.TestAdapter
{
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using NBench.VisualStudio.TestAdapter.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
public class NBenchTestDiscoverer : ITestDiscoverer
{
private INBenchFunctionalityWrapper functionalitywrapper;
public NBenchTestDiscoverer(INBenchFunctionalityWrapper functionalityWrapper)
{
if (functionalityWrapper == null)
{
throw new ArgumentNullException("functionalityWrapper", "The NBench functionality wrapper you have passed in is null. The NBench functionality wrapper must not be null.");
}
throw new NotImplementedException();
}
public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
{
if (sources == null)
{
throw new ArgumentNullException("sources", "The sources collection you have passed in is null. The source collection must be populated.");
}
else if (!sources.Any())
{
throw new ArgumentException("The sources collection you have passed in is empty. The source collection must be populated.", "sources");
}
else if (discoveryContext == null)
{
throw new ArgumentNullException("discoveryContext", "The discovery context you have passed in is null. The discovery context must not be null.");
}
else if (logger == null)
{
throw new ArgumentNullException("logger", "The message logger you have passed in is null. The message logger must not be null.");
}
else if (discoverySink == null)
{
throw new ArgumentNullException("discoverySink", "The test case discovery sink you have passed in is null. The test case discovery sink must not be null.");
}
throw new NotImplementedException();
}
}
} | apache-2.0 | C# |
248cd2d92353189554c74e7b22ccd3a92e107625 | Initialize reflection methods here | DMagic1/KSP_Vessel_Manager | Source/Notes_MainMenu.cs | Source/Notes_MainMenu.cs | using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using BetterNotes.Framework;
namespace BetterNotes
{
[KSPAddon(KSPAddon.Startup.MainMenu, true)]
public class Notes_MainMenu : Notes_MBE
{
private bool loaded;
private const string settingsFilePath = "BetterNotes/Settings";
private const string settingsNode = "Notes_Settings";
private const string localizationFilePath = "BetterNotes/Localization";
private const string localizationNode = "Notes_Localization";
private static bool contractsPlusLoaded;
private static Notes_Settings settings;
private static Notes_Localization localization;
public static bool ContractsPlusLoaded
{
get { return contractsPlusLoaded; }
}
public static Notes_Settings Settings
{
get { return settings; }
}
public static Notes_Localization Localization
{
get { return localization; }
}
public static Notes_LanguagePack Active_Localization_Pack
{
get { return localization.ActivePack; }
}
protected override void Start()
{
if (loaded)
return;
loaded = true;
settings = new Notes_Settings(settingsFilePath, settingsNode);
localization = new Notes_Localization(localizationFilePath, localizationNode);
contractsPlusLoaded = Notes_AssemblyLoad.loadMethods();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using BetterNotes.Framework;
namespace BetterNotes
{
[KSPAddon(KSPAddon.Startup.MainMenu, true)]
public class Notes_MainMenu : Notes_MBE
{
private bool loaded;
private const string settingsFilePath = "BetterNotes/Settings";
private const string settingsNode = "Notes_Settings";
private const string localizationFilePath = "BetterNotes/Localization";
private const string localizationNode = "Notes_Localization";
private static Notes_Settings settings;
private static Notes_Localization localization;
public static Notes_Settings Settings
{
get { return settings; }
}
public static Notes_Localization Localization
{
get { return localization; }
}
public static Notes_LanguagePack Active_Localization_Pack
{
get { return localization.ActivePack; }
}
protected override void Start()
{
if (loaded)
return;
loaded = true;
settings = new Notes_Settings(settingsFilePath, settingsNode);
localization = new Notes_Localization(localizationFilePath, localizationNode);
}
}
}
| mit | C# |
ea073022a4112e2b9939c2f2d8562bd131d2d367 | clean up search code so it fully works for now | SamTheDev/octokit.net,nsnnnnrn/octokit.net,Sarmad93/octokit.net,octokit/octokit.net,shana/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,octokit/octokit.net,hahmed/octokit.net,cH40z-Lord/octokit.net,dampir/octokit.net,adamralph/octokit.net,gdziadkiewicz/octokit.net,shiftkey-tester/octokit.net,M-Zuber/octokit.net,gabrielweyer/octokit.net,octokit-net-test-org/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,octokit-net-test-org/octokit.net,rlugojr/octokit.net,SamTheDev/octokit.net,Sarmad93/octokit.net,devkhan/octokit.net,geek0r/octokit.net,mminns/octokit.net,michaKFromParis/octokit.net,shiftkey/octokit.net,chunkychode/octokit.net,ivandrofly/octokit.net,shiftkey/octokit.net,SLdragon1989/octokit.net,thedillonb/octokit.net,brramos/octokit.net,dlsteuer/octokit.net,editor-tools/octokit.net,forki/octokit.net,hahmed/octokit.net,naveensrinivasan/octokit.net,fake-organization/octokit.net,darrelmiller/octokit.net,editor-tools/octokit.net,magoswiat/octokit.net,shana/octokit.net,rlugojr/octokit.net,khellang/octokit.net,khellang/octokit.net,daukantas/octokit.net,devkhan/octokit.net,M-Zuber/octokit.net,takumikub/octokit.net,eriawan/octokit.net,octokit-net-test/octokit.net,eriawan/octokit.net,Red-Folder/octokit.net,ChrisMissal/octokit.net,ivandrofly/octokit.net,thedillonb/octokit.net,alfhenrik/octokit.net,fffej/octokit.net,hitesh97/octokit.net,TattsGroup/octokit.net,SmithAndr/octokit.net,bslliw/octokit.net,alfhenrik/octokit.net,shiftkey-tester/octokit.net,gabrielweyer/octokit.net,SmithAndr/octokit.net,nsrnnnnn/octokit.net,gdziadkiewicz/octokit.net,kdolan/octokit.net,dampir/octokit.net,kolbasov/octokit.net,chunkychode/octokit.net,mminns/octokit.net,TattsGroup/octokit.net | Octokit/Models/Request/SearchCodeRequest.cs | Octokit/Models/Request/SearchCodeRequest.cs | using Octokit.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Octokit
{
/// <summary>
/// Searching Code/Files
/// http://developer.github.com/v3/search/#search-code
/// </summary>
public class SearchCodeRequest : RequestParameters
{
public SearchCodeRequest(string term)
{
Ensure.ArgumentNotNullOrEmptyString(term, "term");
Term = term;
Page = 1;
PerPage = 100;
Order = SortDirection.Descending;
}
/// <summary>
/// The search term
/// </summary>
[Parameter(Key = "q")]
public string Term { get; private set; }
/// <summary>
/// Optional Sort field. Can only be indexed, which indicates how recently a file has been indexed by the GitHub search infrastructure. If not provided, results are sorted by best match.
/// </summary>
//public string Sort { get; set; } //this will need to be re-added
/// <summary>
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
/// </summary>
public SortDirection Order { get; set; }
/// <summary>
/// Page of paginated results
/// </summary>
public int Page { get; set; }
/// <summary>
/// Number of items per page
/// </summary>
[Parameter(Key = "per_page")]
public int PerPage { get; set; }
}
}
| using Octokit.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Octokit
{
/// <summary>
/// Searching Code/Files
/// http://developer.github.com/v3/search/#search-code
/// </summary>
public class SearchCodeRequest : RequestParameters
{
public SearchCodeRequest(string term)
{
Ensure.ArgumentNotNullOrEmptyString(term, "term");
Term = term;
Page = 1;
PerPage = 100;
Order = SortDirection.Descending;
}
/// <summary>
/// The search term
/// </summary>
[Parameter(Key = "q")]
public string Term { get; private set; }
/// <summary>
/// Optional Sort field. Can only be indexed, which indicates how recently a file has been indexed by the GitHub search infrastructure. If not provided, results are sorted by best match.
/// </summary>
public string Sort { get; set; }
/// <summary>
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
/// </summary>
public SortDirection Order { get; set; }
/// <summary>
/// Page of paginated results
/// </summary>
public int Page { get; set; }
/// <summary>
/// Number of items per page
/// </summary>
[Parameter(Key = "per_page")]
public int PerPage { get; set; }
}
}
| mit | C# |
d140a774a4de669b9a2568a77233fd6bdba7a9b0 | Work in progress | daveh551/Highway.Data,HighwayFramework/Highway.Data,ericburcham/Highway.Data,daveh551/Highway.Data,daveh551/Highway.Data,daveh551/Highway.Data | Highway/src/Highway.Data.EntityFramework/Builders/DynamicAggregateContextBuilder.cs | Highway/src/Highway.Data.EntityFramework/Builders/DynamicAggregateContextBuilder.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.CodeDom;
using System.Reflection;
using System.CodeDom.Compiler;
namespace Highway.Data.EntityFramework.Builder
{
public static class DynamicAggregateContextBuilder
{
private static Dictionary<string, Type> _previousContextTypes = new Dictionary<string, Type>();
private static string BuildKey(IAggregateConfiguration configuration)
{
return string.Join(",", configuration.TypesConfigured.Select(x=>x.FullName));
}
public static Type Create(IAggregateConfiguration configuration)
{
string key = BuildKey(configuration);
if(_previousContextTypes.ContainsKey(key))
{
return _previousContextTypes[key];
}
Type contextType = ConstructNewContextType();
_previousContextTypes.Add(key, contextType);
return contextType;
}
private static Type ConstructNewContextType()
{
var codeDomProvider = new Microsoft.CSharp.CSharpCodeProvider();
Guid typeGuid = Guid.NewGuid();
string typeGuidString = typeGuid.ToString().Replace("{",string.Empty).Replace("}",string.Empty).Replace("-",string.Empty);
var classDeclaration = classString.Replace("{className}", typeGuidString);
CompilerParameters newCompilerParameters = new CompilerParameters();
var output = codeDomProvider.CompileAssemblyFromSource(newCompilerParameters, classDeclaration);
var type = output.CompiledAssembly.GetType(string.Format("{0}AggregateContext",typeGuidString));
return type;
}
/*BE VERY CAREFUL WITH THIS
* HERE BE DRAGONS!!!
*
* This is the class declaration that we compiled with a guid in the name
* at runtime so that each aggregate root ends up a different model compilation
* with entity framework, and then that type is cached. If you modify this and break
* the function. Devlin will hunt you down and feed you to the dragon!!!
* */
private static string classString = @"using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Highway.Data
{
internal class {className}AggregateContext : AggregateDataContext
{
public {className}AggregateContext(IAggregateConfiguration configuration)
: base(configuration)
{
}
}
}
";
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.CodeDom;
using System.Reflection;
using System.CodeDom.Compiler;
namespace Highway.Data.EntityFramework.Builder
{
public static class DynamicAggregateContextBuilder
{
private static Dictionary<string, Type> _previousContextTypes = new Dictionary<string, Type>();
private static string BuildKey(IAggregateConfiguration configuration)
{
return string.Join(",", configuration.TypesConfigured.Select(x=>x.FullName));
}
public static Type Create(IAggregateConfiguration configuration)
{
string key = BuildKey(configuration);
if(_previousContextTypes.ContainsKey(key))
{
return _previousContextTypes[key];
}
Type contextType = ConstructNewContextType();
_previousContextTypes.Add(key, contextType);
return contextType;
}
private static Type ConstructNewContextType()
{
var codeDomProvider = new Microsoft.CSharp.CSharpCodeProvider();
Guid typeGuid = Guid.NewGuid();
string typeGuidString = typeGuid.ToString().Replace("{",string.Empty).Replace("}",string.Empty).Replace("-",string.Empty);
var classDeclaration = classString.Replace("{className}", typeGuidString);
CompilerParameters newCompilerParameters = new CompilerParameters();
var output = codeDomProvider.CompileAssemblyFromSource(newCompilerParameters, classDeclaration);
var type = output.CompiledAssembly.GetType(string.Format("{0}AggregateContext",typeGuid));
return type;
}
/*BE VERY CAREFUL WITH THIS
* HERE BE DRAGONS!!!
*
* This is the class declaration that we compiled with a guid in the name
* at runtime so that each aggregate root ends up a different model compilation
* with entity framework, and then that type is cached. If you modify this and break
* the function. Devlin will hunt you down and feed you to the dragon!!!
* */
private static string classString = @"using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Highway.Data
{
internal class {className}AggregateContext : AggregateDataContext
{
public {className}AggregateContext(IAggregateConfiguration configuration)
: base(configuration)
{
}
}
}
";
}
}
| mit | C# |
3b62ffa280fcde1249e15e7b43a08d64a15da6f3 | Make penalties less forgiving | DragonEyes7/ConcoursUBI17,DragonEyes7/ConcoursUBI17 | Proto/Assets/Scripts/Time/TimeController.cs | Proto/Assets/Scripts/Time/TimeController.cs | using UnityEngine;
using UnityEngine.SceneManagement;
public class TimeController : MonoBehaviour
{
public MultipleDelegate Tick = new MultipleDelegate();
public MultipleDelegate End = new MultipleDelegate();
private string _filePath = "./";
[SerializeField] private int _penalizePlayerOnWrongTarget = 20;
private int _maxTime = 30, _totalTime, _penalties = 0;
private float _timer;
public bool _isPlaying;
public int Time { get; set; }
public int MaxTime
{
get { return _maxTime; }
}
public bool IsPlaying
{
set { _isPlaying = value; }
}
private void FixedUpdate()
{
_timer += UnityEngine.Time.deltaTime;
if (_timer >= 1f && _isPlaying) DoTick();
}
private void DoTick()
{
_timer = 0;
Time++;
_totalTime++;
Tick.Execute(Time);
if (Time == _maxTime)
{
//Game has ended stop countdown and show the players they f*cked up
FindObjectOfType<GameManager>().Defeat();
End.Execute(Time);
End.Empty();
}
}
public void SaveTime()
{
_filePath += SceneManager.GetActiveScene().name + ".json";
var leaderboard = new Leaderboard(_filePath);
leaderboard.AddScore(new Score(PhotonNetwork.room.Name, _totalTime, _penalties));
leaderboard.Save();
}
public void WrongTargetIntercepted()
{
++_penalties;
_totalTime += _penalizePlayerOnWrongTarget * _penalties;
}
public void SetMaxTime(int maxTime)
{
_maxTime = maxTime;
}
} | using UnityEngine;
using UnityEngine.SceneManagement;
public class TimeController : MonoBehaviour
{
public MultipleDelegate Tick = new MultipleDelegate();
public MultipleDelegate End = new MultipleDelegate();
private string _filePath = "./";
[SerializeField] private int _penalizePlayerOnWrongTarget = 20;
private int _maxTime = 30, _totalTime, _penalties = 0;
private float _timer;
public bool _isPlaying;
public int Time { get; set; }
public int MaxTime
{
get { return _maxTime; }
}
public bool IsPlaying
{
set { _isPlaying = value; }
}
private void FixedUpdate()
{
_timer += UnityEngine.Time.deltaTime;
if (_timer >= 1f && _isPlaying) DoTick();
}
private void DoTick()
{
_timer = 0;
Time++;
_totalTime++;
Tick.Execute(Time);
if (Time == _maxTime)
{
//Game has ended stop countdown and show the players they f*cked up
FindObjectOfType<GameManager>().Defeat();
End.Execute(Time);
End.Empty();
}
}
public void SaveTime()
{
_filePath += SceneManager.GetActiveScene().name + ".json";
var leaderboard = new Leaderboard(_filePath);
leaderboard.AddScore(new Score(PhotonNetwork.room.Name, _totalTime, _penalties));
leaderboard.Save();
}
public void WrongTargetIntercepted()
{
++_penalties;
_totalTime += _penalizePlayerOnWrongTarget;
}
public void SetMaxTime(int maxTime)
{
_maxTime = maxTime;
}
} | mit | C# |
e8fccaf348b8d4fc00e42015f2a117e737f1aa90 | Add missing method. | honestegg/cassette,BluewireTechnologies/cassette,damiensawyer/cassette,andrewdavey/cassette,damiensawyer/cassette,andrewdavey/cassette,BluewireTechnologies/cassette,damiensawyer/cassette,honestegg/cassette,honestegg/cassette,andrewdavey/cassette | src/Cassette/Web/ExceptionCachedManager.cs | src/Cassette/Web/ExceptionCachedManager.cs | using System;
using System.Web;
using System.Web.Caching;
namespace Cassette.Web
{
// We don't want to throw the exception during lazy initialization because
// there is no chance to recreate the object, even if, say, a broken file is fixed.
// Instead, we cache the exception in this special implementation of IManager
// and throw it when trying to call members. The CreateCacheDependency()
// method creates a special dependency that will be triggered just before
// the exception is thrown. This provides us with a chance to re-create the
// lazy object with fixed (we hope!) files.
public class ExceptionCachedManager : ICassetteApplication
{
public ExceptionCachedManager(Exception exception)
{
this.exception = exception;
cacheClearer = new CacheClearer();
}
readonly Exception exception;
readonly CacheClearer cacheClearer;
public IPageAssetManager CreatePageHelper(HttpContextBase httpContext)
{
cacheClearer.Clear();
throw exception;
}
public IHttpHandler CreateHttpHandler()
{
cacheClearer.Clear();
throw exception;
}
public CacheDependency CreateCacheDependency()
{
return cacheClearer;
}
public void Dispose()
{
}
class CacheClearer : CacheDependency
{
public void Clear()
{
NotifyDependencyChanged(this, EventArgs.Empty);
}
}
}
}
| using System;
using System.Web.Caching;
using Cassette.CoffeeScript;
using Cassette.Configuration;
using System.Web;
namespace Cassette.Web
{
// We don't want to throw the exception during lazy initialization because
// there is no chance to recreate the object, even if, say, a broken file is fixed.
// Instead, we cache the exception in this special implementation of IManager
// and throw it when trying to call members. The CreateCacheDependency()
// method creates a special dependency that will be triggered just before
// the exception is thrown. This provides us with a chance to re-create the
// lazy object with fixed (we hope!) files.
public class ExceptionCachedManager : ICassetteApplication
{
public ExceptionCachedManager(Exception exception)
{
this.exception = exception;
cacheClearer = new CacheClearer();
}
readonly Exception exception;
readonly CacheClearer cacheClearer;
public IPageAssetManager CreatePageHelper(HttpContextBase httpContext)
{
cacheClearer.Clear();
throw exception;
}
public IHttpHandler CreateHttpHandler()
{
cacheClearer.Clear();
throw exception;
}
public CacheDependency CreateCacheDependency()
{
return cacheClearer;
}
class CacheClearer : CacheDependency
{
public void Clear()
{
NotifyDependencyChanged(this, EventArgs.Empty);
}
}
}
}
| mit | C# |
db94715ed747966abaf90d479adfc00ff27763e8 | Correct issue #1 - Routing problem | vmichalak/Hermes.Net | src/HermesNet/Helpers/MiddlewareManager.cs | src/HermesNet/Helpers/MiddlewareManager.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using HermesNet.Models;
using HermesNet.Models.Http;
namespace HermesNet.Helpers
{
internal class MiddlewareManager
{
private class Entry
{
public HttpMethod Method { get; set; }
public string Route { get; set; }
}
private readonly Dictionary<Entry, IMiddleware> _middlewares = new Dictionary<Entry, IMiddleware>();
public void Add(string route, HttpMethod method, IMiddleware middleware)
{
this._middlewares.Add(new Entry() { Method = method, Route = route }, middleware);
}
public async Task<HttpResponse> Execute(HttpRequest request)
{
HttpContext context = new HttpContext(request);
try
{
Entry searchEntry = new Entry()
{
Method = request.Method,
Route = request.BaseUrl
};
IMiddleware middleware = FilterMiddlewares(searchEntry);
if (middleware == null)
{
context.Response.StatusCode = HttpStatusCode.NotFound;
}
else
{
await middleware.Run(context);
}
}
catch (Exception e)
{
#if !DEBUG
context.Response.StatusCode = HttpStatusCode.InternalServerError;
context.Response.Send("Internal Server Error: " + e.Message);
#else
throw new Exception("Error during MiddlewareManager Execution.", e);
#endif
}
return context.Response;
}
private IMiddleware FilterMiddlewares(Entry searchEntry)
{
KeyValuePair<Entry, IMiddleware>[] list = this._middlewares.ToList().FindAll(m =>
{
Regex regex = new Regex("^"+m.Key.Route);
return (m.Key.Method == HttpMethod.ALL || m.Key.Method == searchEntry.Method) && regex.IsMatch(searchEntry.Route);
}).ToArray();
int maxRouteSize = list[0].Key.Route.Length;
int item = 0;
for (int i = 1; i < list.Length; i++)
{
if (list[i].Key.Route.Length > maxRouteSize)
{
maxRouteSize = list[i].Key.Route.Length;
item = i;
}
}
return list[item].Value;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using HermesNet.Models;
using HermesNet.Models.Http;
namespace HermesNet.Helpers
{
internal class MiddlewareManager
{
private class Entry
{
public HttpMethod Method { get; set; }
public string Route { get; set; }
}
private readonly Dictionary<Entry, IMiddleware> _middlewares = new Dictionary<Entry, IMiddleware>();
public void Add(string route, HttpMethod method, IMiddleware middleware)
{
this._middlewares.Add(new Entry() { Method = method, Route = route }, middleware);
}
public async Task<HttpResponse> Execute(HttpRequest request)
{
HttpContext context = new HttpContext(request);
try
{
Entry searchEntry = new Entry()
{
Method = request.Method,
Route = request.BaseUrl
};
IMiddleware middleware = FilterMiddlewares(searchEntry);
if (middleware == null)
{
context.Response.StatusCode = HttpStatusCode.NotFound;
}
else
{
await middleware.Run(context);
}
}
catch (Exception e)
{
#if !DEBUG
context.Response.StatusCode = HttpStatusCode.InternalServerError;
context.Response.Send("Internal Server Error: " + e.Message);
#else
throw new Exception("Error during MiddlewareManager Execution.", e);
#endif
}
return context.Response;
}
private IMiddleware FilterMiddlewares(Entry searchEntry)
{
return this._middlewares.FirstOrDefault(m =>
{
Regex regex = new Regex("^"+m.Key.Route);
return (m.Key.Method == HttpMethod.ALL || m.Key.Method == searchEntry.Method) && regex.IsMatch(searchEntry.Route);
}).Value;
}
}
}
| mit | C# |
90de6a73a8170f79fd80b38dc7e6013fa129e0e0 | Modify StringDictionary.Parse to allow duplicated keys | emoacht/SnowyImageCopy | Source/SnowyTool/Helper/StringDictionary.cs | Source/SnowyTool/Helper/StringDictionary.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SnowyTool.Helper
{
/// <summary>
/// Parses string to Dictionary.
/// </summary>
public static class StringDictionary
{
/// <summary>
/// Parses string divided by new lines and separator in each line to Dictionary.
/// </summary>
/// <param name="source">Source string</param>
/// <param name="separator">Separator char</param>
/// <returns>Dictionary of Key string and value string</returns>
public static Dictionary<string, string> Parse(string source, char separator)
{
if (string.IsNullOrWhiteSpace(source))
throw new ArgumentNullException(nameof(source));
if (char.IsWhiteSpace(separator))
throw new ArgumentException("The separator must not be white space.", nameof(separator));
return source.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.Select(x => x.Split(new[] { separator }, 2))
.Where(x => x.Length == 2)
.Select(x => new { Key = x[0].Trim(), Value = x[1].Trim() })
.Where(x => !string.IsNullOrEmpty(x.Key))
.GroupBy(x => x.Key)
.ToDictionary(x => x.Key, x => x.Last().Value);
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SnowyTool.Helper
{
/// <summary>
/// Parses string to Dictionary.
/// </summary>
public static class StringDictionary
{
/// <summary>
/// Parses string divided by new lines and separator in each line to Dictionary.
/// </summary>
/// <param name="source">Source string</param>
/// <param name="separator">Separator char</param>
/// <returns>Dictionary of Key string and value string</returns>
public static Dictionary<string, string> Parse(string source, char separator)
{
if (string.IsNullOrWhiteSpace(source))
throw new ArgumentNullException(nameof(source));
if (char.IsWhiteSpace(separator))
throw new ArgumentException("The separator must not be white space.", nameof(separator));
return source.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.Select(x => x.Split(new[] { separator }, 2))
.Where(x => x.Length == 2)
.Where(x => !string.IsNullOrWhiteSpace(x[0]))
.ToDictionary(x => x[0], x => x[1]);
}
}
} | mit | C# |
1cf36bce66e11d7ccdeb3e1630a083fe133ad7d3 | Remove unneeded keys | NinetailLabs/VaraniumSharp.Initiator | VaraniumSharp.Initiator/Enumerations/ConfigurationKeys.cs | VaraniumSharp.Initiator/Enumerations/ConfigurationKeys.cs | namespace VaraniumSharp.Initiator.Enumerations
{
/// <summary>
/// Contains keys for reading configuration values from App.config
/// </summary>
public static class ConfigurationKeys
{
#region Variables
/// <summary>
/// Indicate if logging should be done to the console
/// </summary>
public const string LogToConsole = "log.console";
/// <summary>
/// Indicate if logging should be done to a file
/// </summary>
public const string LogToFile = "log.file";
/// <summary>
/// Path where log file should be written to
/// </summary>
public const string LogFilePath = "log.file.path";
/// <summary>
/// Indicate if logging should be done to Seq
/// </summary>
public const string LogToSeq = "log.seq";
/// <summary>
/// Url of the Seq host
/// </summary>
public const string SeqHost = "seq.host";
/// <summary>
/// Indicate if logging should be done to Splunk
/// </summary>
public const string LogToSplunk = "log.splunk";
/// <summary>
/// Url of the Splunk Event Collector
/// </summary>
public const string SplunkHost = "log.splunk.host";
/// <summary>
/// Event Collector token for Splunk
/// </summary>
public const string SplunkToken = "log.splunk.token";
#endregion Variables
}
} | namespace VaraniumSharp.Initiator.Enumerations
{
/// <summary>
/// Contains keys for reading configuration values from App.config
/// </summary>
public static class ConfigurationKeys
{
#region Variables
/// <summary>
/// Host address of the service
/// </summary>
public const string ServiceHost = "service.host";
/// <summary>
/// The port on which the service is hosted
/// </summary>
public const string ServicePort = "service.port";
/// <summary>
/// Indicate if logging should be done to the console
/// </summary>
public const string LogToConsole = "log.console";
/// <summary>
/// Indicate if logging should be done to a file
/// </summary>
public const string LogToFile = "log.file";
/// <summary>
/// Path where log file should be written to
/// </summary>
public const string LogFilePath = "log.file.path";
/// <summary>
/// Indicate if logging should be done to Seq
/// </summary>
public const string LogToSeq = "log.seq";
/// <summary>
/// Url of the Seq host
/// </summary>
public const string SeqHost = "seq.host";
/// <summary>
/// Indicate if logging should be done to Splunk
/// </summary>
public const string LogToSplunk = "log.splunk";
/// <summary>
/// Url of the Splunk Event Collector
/// </summary>
public const string SplunkHost = "log.splunk.host";
/// <summary>
/// Event Collector token for Splunk
/// </summary>
public const string SplunkToken = "log.splunk.token";
#endregion Variables
}
} | mit | C# |
801474d77c16c5bd34a64fc34deef45608961911 | remove using | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Behaviors/PasteAddressOnClickBehavior.cs | WalletWasabi.Gui/Behaviors/PasteAddressOnClickBehavior.cs | using Avalonia;
using Avalonia.Controls;
using Avalonia.Input.Platform;
using Avalonia.Interactivity;
using Avalonia.Xaml.Interactivity;
using NBitcoin;
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
namespace WalletWasabi.Gui.Behaviors
{
internal class PasteAddressOnClickBehavior : Behavior<TextBox>
{
private CompositeDisposable _disposables = new CompositeDisposable();
public void PasteClipboardContentIfBitcoinAddress()
{
var clipboard = (IClipboard)AvaloniaLocator.Current.GetService(typeof(IClipboard));
var text = clipboard.GetTextAsync().GetAwaiter().GetResult();
try
{
var address = BitcoinAddress.Create(text, Global.Network);
if(address is BitcoinWitPubKeyAddress)
{
if(string.IsNullOrWhiteSpace(AssociatedObject.Text) )
AssociatedObject.Text = text;
}
}
catch(FormatException)
{
}
}
protected override void OnAttached()
{
_disposables = new CompositeDisposable
{
AssociatedObject.GetObservable(TextBox.IsFocusedProperty).Subscribe(focused =>
{
if(focused && string.IsNullOrWhiteSpace(AssociatedObject.Text))
{
PasteClipboardContentIfBitcoinAddress();
}
})
};
base.OnAttached();
}
protected override void OnDetaching()
{
base.OnDetaching();
_disposables.Dispose();
}
}
}
| using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Input.Platform;
using Avalonia.Interactivity;
using Avalonia.Xaml.Interactivity;
using NBitcoin;
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
namespace WalletWasabi.Gui.Behaviors
{
internal class PasteAddressOnClickBehavior : Behavior<TextBox>
{
private CompositeDisposable _disposables = new CompositeDisposable();
public void PasteClipboardContentIfBitcoinAddress()
{
var clipboard = (IClipboard)AvaloniaLocator.Current.GetService(typeof(IClipboard));
var text = clipboard.GetTextAsync().GetAwaiter().GetResult();
try
{
var address = BitcoinAddress.Create(text, Global.Network);
if(address is BitcoinWitPubKeyAddress)
{
if(string.IsNullOrWhiteSpace(AssociatedObject.Text) )
AssociatedObject.Text = text;
}
}
catch(FormatException)
{
}
}
protected override void OnAttached()
{
_disposables = new CompositeDisposable
{
AssociatedObject.GetObservable(TextBox.IsFocusedProperty).Subscribe(focused =>
{
if(focused && string.IsNullOrWhiteSpace(AssociatedObject.Text))
{
PasteClipboardContentIfBitcoinAddress();
}
})
};
base.OnAttached();
}
protected override void OnDetaching()
{
base.OnDetaching();
_disposables.Dispose();
}
}
}
| mit | C# |
80ca3a159c22c51b5333eea38cf8de48cb6494b2 | fix NRE | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/ViewModels/WasabiDocumentTabViewModel.cs | WalletWasabi.Gui/ViewModels/WasabiDocumentTabViewModel.cs | using AvalonStudio.Documents;
using AvalonStudio.Extensibility;
using AvalonStudio.MVVM;
using AvalonStudio.Shell;
using Dock.Model;
using ReactiveUI;
using System;
using System.Reactive.Disposables;
using System.Threading.Tasks;
namespace WalletWasabi.Gui.ViewModels
{
public abstract class WasabiDocumentTabViewModel : ViewModelBase, IDocumentTabViewModel
{
private string _title;
private bool _isSelected;
private bool _isClosed;
private object _dialogResult;
protected WasabiDocumentTabViewModel(string title)
{
Title = title;
}
private CompositeDisposable Disposables { get; set; }
public object Context { get; set; }
public double Width { get; set; }
public double Height { get; set; }
public IDockable Parent { get; set; }
public string Title
{
get => _title;
set => this.RaiseAndSetIfChanged(ref _title, value);
}
public bool IsSelected
{
get => _isSelected;
set => this.RaiseAndSetIfChanged(ref _isSelected, value);
}
public bool IsClosed
{
get => _isClosed;
set => this.RaiseAndSetIfChanged(ref _isClosed, value);
}
public object DialogResult
{
get => _dialogResult;
set => this.RaiseAndSetIfChanged(ref _dialogResult, value);
}
public bool IsDirty { get; set; }
public virtual void OnSelected()
{
IsSelected = true;
}
public virtual void OnDeselected()
{
IsSelected = false;
}
// This interface member is called explicitly from Avalonia after the Tab was opened.
void IDockableViewModel.OnOpen()
{
Disposables = Disposables is null ? new CompositeDisposable() : throw new NotSupportedException($"Cannot open {GetType().Name} before closing it.");
IsClosed = false;
OnOpen(Disposables);
}
/// <summary>
/// Called when a tab is opened in the dock for the fist time.
/// </summary>
/// <param name="disposables">Disposables add IDisposables to this where Dispose will be called when tab is closed.</param>
public virtual void OnOpen(CompositeDisposable disposables)
{
}
/// <summary>
/// Called when the close button on the tab is clicked.
/// </summary>
/// <returns>true to confirm close, false to cancel.</returns>
public virtual bool OnClose()
{
Disposables?.Dispose();
Disposables = null;
IsSelected = false;
IoC.Get<IShell>().RemoveDocument(this);
IsClosed = true;
return true;
}
public void Select()
{
IoC.Get<IShell>().Select(this);
}
public async Task<object> ShowDialogAsync()
{
DialogResult = null;
while (!IsClosed)
{
if (!IsSelected) // Prevent de-selection of tab.
{
Select();
}
await Task.Delay(100);
}
return DialogResult;
}
}
}
| using AvalonStudio.Documents;
using AvalonStudio.Extensibility;
using AvalonStudio.MVVM;
using AvalonStudio.Shell;
using Dock.Model;
using ReactiveUI;
using System;
using System.Reactive.Disposables;
using System.Threading.Tasks;
namespace WalletWasabi.Gui.ViewModels
{
public abstract class WasabiDocumentTabViewModel : ViewModelBase, IDocumentTabViewModel
{
private string _title;
private bool _isSelected;
private bool _isClosed;
private object _dialogResult;
protected WasabiDocumentTabViewModel(string title)
{
Title = title;
}
private CompositeDisposable Disposables { get; set; }
public object Context { get; set; }
public double Width { get; set; }
public double Height { get; set; }
public IDockable Parent { get; set; }
public string Title
{
get => _title;
set => this.RaiseAndSetIfChanged(ref _title, value);
}
public bool IsSelected
{
get => _isSelected;
set => this.RaiseAndSetIfChanged(ref _isSelected, value);
}
public bool IsClosed
{
get => _isClosed;
set => this.RaiseAndSetIfChanged(ref _isClosed, value);
}
public object DialogResult
{
get => _dialogResult;
set => this.RaiseAndSetIfChanged(ref _dialogResult, value);
}
public bool IsDirty { get; set; }
public virtual void OnSelected()
{
IsSelected = true;
}
public virtual void OnDeselected()
{
IsSelected = false;
}
// This interface member is called explicitly from Avalonia after the Tab was opened.
void IDockableViewModel.OnOpen()
{
Disposables = Disposables is null ? new CompositeDisposable() : throw new NotSupportedException($"Cannot open {GetType().Name} before closing it.");
IsClosed = false;
OnOpen(Disposables);
}
/// <summary>
/// Called when a tab is opened in the dock for the fist time.
/// </summary>
/// <param name="disposables">Disposables add IDisposables to this where Dispose will be called when tab is closed.</param>
public virtual void OnOpen(CompositeDisposable disposables)
{
}
/// <summary>
/// Called when the close button on the tab is clicked.
/// </summary>
/// <returns>true to confirm close, false to cancel.</returns>
public virtual bool OnClose()
{
Disposables.Dispose();
Disposables = null;
IsSelected = false;
IoC.Get<IShell>().RemoveDocument(this);
IsClosed = true;
return true;
}
public void Select()
{
IoC.Get<IShell>().Select(this);
}
public async Task<object> ShowDialogAsync()
{
DialogResult = null;
while (!IsClosed)
{
if (!IsSelected) // Prevent de-selection of tab.
{
Select();
}
await Task.Delay(100);
}
return DialogResult;
}
}
}
| mit | C# |
cedfce6872e0c46244ad44eb26ad5b85d96bb401 | Fix documentation 2. | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Extensions/StreamExtensions.cs | WalletWasabi/Extensions/StreamExtensions.cs | using System.Buffers;
using System.Threading;
using System.Threading.Tasks;
namespace System.IO
{
public static class StreamExtensions
{
public static async Task<int> ReadByteAsync(this Stream stream, CancellationToken ctsToken = default)
{
ArrayPool<byte> pool = ArrayPool<byte>.Shared;
byte[] buffer = pool.Rent(1);
try
{
int len = await stream.ReadAsync(buffer.AsMemory(0, 1), ctsToken).ConfigureAwait(false);
// End of stream.
if (len == 0)
{
return -1;
}
return buffer[0];
}
finally
{
pool.Return(buffer);
}
}
/// <summary>
/// Attempts to read <paramref name="count"/> bytes from <paramref name="stream"/>.
/// </summary>
/// <param name="stream">Stream to read from.</param>
/// <param name="buffer">Buffer whose length must be at least <paramref name="count"/> elements.</param>
/// <param name="count">Number of bytes to read.</param>
/// <param name="cancellationToken">Cancellation token to cancel the asynchronous operation.</param>
/// <returns>Number of read bytes. At most <paramref name="count"/>.</returns>
public static async Task<int> ReadBlockAsync(this Stream stream, byte[] buffer, int count, CancellationToken cancellationToken = default)
{
int left = count;
while (left != 0)
{
int read = await stream.ReadAsync(buffer.AsMemory(count - left, left), cancellationToken).ConfigureAwait(false);
// End of stream.
if (read == 0)
{
break;
}
left -= read;
}
return count - left;
}
}
}
| using System.Buffers;
using System.Threading;
using System.Threading.Tasks;
namespace System.IO
{
public static class StreamExtensions
{
public static async Task<int> ReadByteAsync(this Stream stream, CancellationToken ctsToken = default)
{
ArrayPool<byte> pool = ArrayPool<byte>.Shared;
byte[] buffer = pool.Rent(1);
try
{
int len = await stream.ReadAsync(buffer.AsMemory(0, 1), ctsToken).ConfigureAwait(false);
// End of stream.
if (len == 0)
{
return -1;
}
return buffer[0];
}
finally
{
pool.Return(buffer);
}
}
/// <summary>
/// Attempts to read <paramref name="count"/> bytes from <paramref name="stream"/>.
/// </summary>
/// <param name="stream">Stream to read from.</param>
/// <param name="buffer">Buffer whose length must be at least <paramref name="count"/> elements.</param>
/// <param name="count">Number of bytes to read.</param>
/// <param name="cancellationToken">Cancellation token to cancel the asynchronous operation.</param>
/// <returns><paramref name="count"/> when all <paramref name="count"/> bytes were read from the stream. Otherwise, a number of remaining bytes that were not transmitted.</returns>
public static async Task<int> ReadBlockAsync(this Stream stream, byte[] buffer, int count, CancellationToken cancellationToken = default)
{
int left = count;
while (left != 0)
{
int read = await stream.ReadAsync(buffer.AsMemory(count - left, left), cancellationToken).ConfigureAwait(false);
// End of stream.
if (read == 0)
{
break;
}
left -= read;
}
return count - left;
}
}
}
| mit | C# |
69d8126d4e3976665dc1c9b44211f00723e6c1ca | Update version number. | Damnae/storybrew | editor/Properties/AssemblyInfo.cs | editor/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.39.*")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.38.*")]
| mit | C# |
81bce29c4155741a951fc9c88ee9c27dccc6f144 | Update version number. | Damnae/storybrew | editor/Properties/AssemblyInfo.cs | editor/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.54.*")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.53.*")]
| mit | C# |
4e21336a5c575618d5ef98dfc9928ba29b2e25c9 | Reduce memory usage by using a hashset instead of a list | Moq/moq | src/Moq.Proxy.Generator/ProxyDiscoverer.cs | src/Moq.Proxy.Generator/ProxyDiscoverer.cs | using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
namespace Moq.Proxy
{
public class ProxyDiscoverer
{
public async Task<IImmutableSet<ImmutableArray<ITypeSymbol>>> DiscoverProxiesAsync(Project project, CancellationToken cancellationToken = default(CancellationToken))
{
var discoverer = project.LanguageServices.GetRequiredService<IProxyDiscoverer>();
var compilation = await project.GetCompilationAsync(cancellationToken);
var proxyGeneratorSymbol = compilation.GetTypeByMetadataName(typeof(ProxyGeneratorAttribute).FullName);
// TODO: message.
if (proxyGeneratorSymbol == null)
throw new InvalidOperationException();
var proxies = new HashSet<ImmutableArray<ITypeSymbol>>(StructuralComparer<ImmutableArray<ITypeSymbol>>.Default);
foreach (var document in project.Documents)
{
var discovered = await discoverer.DiscoverProxiesAsync(document, proxyGeneratorSymbol, cancellationToken);
foreach (var proxy in discovered)
{
proxies.Add(proxy);
}
}
return proxies.ToImmutableHashSet(StructuralComparer<ImmutableArray<ITypeSymbol>>.Default);
}
}
}
| using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
namespace Moq.Proxy
{
public class ProxyDiscoverer
{
public async Task<IImmutableSet<ImmutableArray<ITypeSymbol>>> DiscoverProxiesAsync(Project project, CancellationToken cancellationToken = default(CancellationToken))
{
var discoverer = project.LanguageServices.GetRequiredService<IProxyDiscoverer>();
var compilation = await project.GetCompilationAsync(cancellationToken);
var proxyGeneratorSymbol = compilation.GetTypeByMetadataName(typeof(ProxyGeneratorAttribute).FullName);
// TODO: message.
if (proxyGeneratorSymbol == null)
throw new InvalidOperationException();
var proxies = new List<ImmutableArray<ITypeSymbol>>();
foreach (var document in project.Documents)
{
var discovered = await discoverer.DiscoverProxiesAsync(document, proxyGeneratorSymbol, cancellationToken);
proxies.AddRange(discovered);
}
return proxies.ToImmutableHashSet(StructuralComparer<ImmutableArray<ITypeSymbol>>.Default);
}
}
}
| apache-2.0 | C# |
4c24ba3c595955b43e70b93766cabc47756eefec | Add checkpoint at block #200000 | CryptoManiac/NovacoinLibrary | Novacoin/Checkpoints.cs | Novacoin/Checkpoints.cs | using System;
namespace Novacoin
{
public class Checkpoints
{
private static Tuple<uint, uint256, uint>[] checkpoints = new Tuple<uint, uint256, uint>[]
{
new Tuple<uint, uint256, uint>(0, NetInfo.nHashGenesisBlock, 1360105017),
new Tuple<uint, uint256, uint>(200000, new uint256("0000000000029f8bbf66e6ea6f3e5db55009404aae0fe395a53dd33142b2bff2"), 1441127233),
};
/// <summary>
/// Last checkpoint height.
/// </summary>
public static uint TotalBlocksEstimate { get { return checkpoints[checkpoints.Length - 1].Item1; } }
/// <summary>
/// Last checkpoint timestamp.
/// </summary>
public static uint LastCheckpointTime { get { return checkpoints[checkpoints.Length - 1].Item3; } }
/// <summary>
/// Block hash verification.
/// </summary>
/// <param name="nHeight">Block height.</param>
/// <param name="nBlockHash">Block hash.</param>
/// <returns></returns>
public static bool Verify(uint nHeight, uint256 nBlockHash)
{
foreach (var checkpoint in checkpoints)
{
if (checkpoint.Item1 == nHeight)
{
return nBlockHash == checkpoint.Item2;
}
}
return true;
}
}
} | using System;
namespace Novacoin
{
public class Checkpoints
{
private static Tuple<uint, uint256, uint>[] checkpoints = new Tuple<uint, uint256, uint>[]
{
new Tuple<uint, uint256, uint>(0, NetInfo.nHashGenesisBlock, 1360105017)
};
/// <summary>
/// Last checkpoint height.
/// </summary>
public static uint TotalBlocksEstimate { get { return checkpoints[checkpoints.Length - 1].Item1; } }
/// <summary>
/// Last checkpoint timestamp.
/// </summary>
public static uint LastCheckpointTime { get { return checkpoints[checkpoints.Length - 1].Item3; } }
/// <summary>
/// Block hash verification.
/// </summary>
/// <param name="nHeight">Block height.</param>
/// <param name="nBlockHash">Block hash.</param>
/// <returns></returns>
public static bool Verify(uint nHeight, uint256 nBlockHash)
{
foreach (var checkpoint in checkpoints)
{
if (checkpoint.Item1 == nHeight)
{
return nBlockHash == checkpoint.Item2;
}
}
return true;
}
}
} | agpl-3.0 | C# |
cca8170b07d3d911d49cd75aa1c51b823c720bf6 | Fix exception message variable. | brendanjbaker/StraightSQL | src/StraightSql/TypeConverterExtensions.cs | src/StraightSql/TypeConverterExtensions.cs | namespace StraightSql
{
using System;
internal static class TypeConverterExtensions
{
public static Boolean CanConvert(this System.ComponentModel.TypeConverter typeConverter, Type fromType, Type toType)
{
return typeConverter.CanConvertFrom(fromType) && typeConverter.CanConvertTo(toType);
}
public static T Convert<T>(this System.ComponentModel.TypeConverter typeConverter, Object instance)
{
return (T)typeConverter.ConvertTo(instance, typeof(T));
}
public static T Convert<T>(this ITypeConverter typeConverter, Object instance)
{
T value;
if (typeConverter.TryConvert(instance, out value))
return value;
throw new InvalidCastException($"Could not convert type {instance.GetType().Name} to type {typeof(T).Name}.");
}
}
}
| namespace StraightSql
{
using System;
internal static class TypeConverterExtensions
{
public static Boolean CanConvert(this System.ComponentModel.TypeConverter typeConverter, Type fromType, Type toType)
{
return typeConverter.CanConvertFrom(fromType) && typeConverter.CanConvertTo(toType);
}
public static T Convert<T>(this System.ComponentModel.TypeConverter typeConverter, Object instance)
{
return (T)typeConverter.ConvertTo(instance, typeof(T));
}
public static T Convert<T>(this ITypeConverter typeConverter, Object instance)
{
T value;
if (typeConverter.TryConvert(instance, out value))
return value;
throw new InvalidCastException($"Could not convert type {value.GetType().Name} to type {typeof(T).Name}.");
}
}
}
| mit | C# |
feed6dfc6751c1efff8457b051bb96a7ce6a64aa | Fix of data transform. | pietrobr/connectthedots,HydAu/ConnectTheDots2,jeffwilcox/connectthedots,zack076/connectthedots,yashchandak/connectthedots,jomolinare/connectthedots,Azure/connectthedots,ZingPow/connectthedots,Azure/connectthedots,MSOpenTech/connectthedots,jeffwilcox/connectthedots,jessejjohnson/connectthedots,HydAu/ConnectTheDots2,Azure/connectthedots,BretStateham/connectthedots,BretStateham/connectthedots,jomolinare/connectthedots,ZingPow/connectthedots,radiojam11/connectthedots,Azure/connectthedots,jomolinare/connectthedots,jmservera/connectthedots,yashchandak/connectthedots,BretStateham/connectthedots,beeva-marianmoldovan/connectthedots,Azure/connectthedots,pietrobr/connectthedots,jomolinare/connectthedots,beeva-marianmoldovan/connectthedots,BretStateham/connectthedots,noopkat/connectthedots,Azure/connectthedots,HydAu/ConnectTheDots2,noopkat/connectthedots,beeva-marianmoldovan/connectthedots,zack076/connectthedots,BretStateham/connectthedots,jeffwilcox/connectthedots,jmservera/connectthedots,jmservera/connectthedots,jessejjohnson/connectthedots,jmservera/connectthedots,BretStateham/connectthedots,beeva-marianmoldovan/connectthedots,noopkat/connectthedots,jmservera/connectthedots,jessejjohnson/connectthedots,yashchandak/connectthedots,jomolinare/connectthedots,BretStateham/connectthedots,HydAu/AzureConnectTheDots,MSOpenTech/connectthedots,noopkat/connectthedots,yashchandak/connectthedots,pietrobr/connectthedots,MSOpenTech/connectthedots,jomolinare/connectthedots,radiojam11/connectthedots,beeva-marianmoldovan/connectthedots,pietrobr/connectthedots,zack076/connectthedots,MSOpenTech/connectthedots,jeffwilcox/connectthedots,jessejjohnson/connectthedots,HydAu/AzureConnectTheDots,jessejjohnson/connectthedots,zack076/connectthedots,HydAu/ConnectTheDots2,zack076/connectthedots,noopkat/connectthedots,radiojam11/connectthedots,ZingPow/connectthedots,ZingPow/connectthedots,HydAu/ConnectTheDots2,MSOpenTech/connectthedots,noopkat/connectthedots,jeffwilcox/connectthedots,beeva-marianmoldovan/connectthedots,yashchandak/connectthedots,jmservera/connectthedots,pietrobr/connectthedots,HydAu/AzureConnectTheDots,HydAu/ConnectTheDots2,HydAu/AzureConnectTheDots,radiojam11/connectthedots,pietrobr/connectthedots,radiojam11/connectthedots,MSOpenTech/connectthedots,ZingPow/connectthedots,radiojam11/connectthedots,noopkat/connectthedots,Azure/connectthedots,jeffwilcox/connectthedots,HydAu/AzureConnectTheDots,ZingPow/connectthedots,yashchandak/connectthedots,jessejjohnson/connectthedots,HydAu/AzureConnectTheDots,zack076/connectthedots | Devices/Gateways/GatewayService/Gateway/Models/QueuedItem.cs | Devices/Gateways/GatewayService/Gateway/Models/QueuedItem.cs | using System;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Gateway.Models
{
[DataContract]
public class QueuedItem
{
[DataMember(Name = "serializedData")]
public string JsonData { get; set; }
}
public static class DataTransforms
{
public static SensorDataContract SensorDataContractFromQueuedItem(QueuedItem data)
{
SensorDataContract result = null;
try
{
result =
JsonConvert.DeserializeObject<SensorDataContract>(data.JsonData);
}
catch (Exception ex)
{
}
return result;
}
public static SensorDataContract AddTimeCreated(SensorDataContract data)
{
SensorDataContract result = data;
if (result.TimeCreated == default(DateTime))
{
var creationTime = DateTime.UtcNow;
result.TimeCreated = creationTime;
}
return result;
}
}
}
| using System;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Gateway.Models
{
[DataContract]
public class QueuedItem
{
[DataMember(Name = "serializedData")]
public string JsonData { get; set; }
}
public static class DataTransforms
{
public static SensorDataContract SensorDataContractFromQueuedItem(QueuedItem data)
{
SensorDataContract result =
JsonConvert.DeserializeObject<SensorDataContract>(data.JsonData);
return result;
}
public static SensorDataContract AddTimeCreated(SensorDataContract data)
{
SensorDataContract result = data;
if (result.TimeCreated == default(DateTime))
{
var creationTime = DateTime.UtcNow;
result.TimeCreated = creationTime;
}
return result;
}
}
}
| mit | C# |
b17f1966b9601b14f8f662cee5f8c57b9d44c8a7 | Test commit | melanchall/drywetmidi,melanchall/drywetmidi,melanchall/drymidi | DryWetMidi/Tools/Randomizer/Base/Randomizer.cs | DryWetMidi/Tools/Randomizer/Base/Randomizer.cs | using System;
using System.Collections.Generic;
using System.Linq;
using Melanchall.DryWetMidi.Smf.Interaction;
namespace Melanchall.DryWetMidi.Tools
{
// TODO: remove this comment
public abstract class Randomizer<TObject, TSettings>
where TSettings : RandomizingSettings, new()
{
#region Methods
protected void RandomizeInternal(IEnumerable<TObject> objects, IBounds bounds, TempoMap tempoMap, TSettings settings)
{
settings = settings ?? new TSettings();
var random = new Random();
foreach (var obj in objects.Where(o => o != null))
{
var time = GetOldTime(obj, settings);
time = RandomizeTime(time, bounds, random, tempoMap);
var correctionResult = CorrectObject(obj, time, settings);
var instruction = correctionResult.RandomizingInstruction;
if (instruction == RandomizingInstruction.Apply)
{
SetNewTime(obj, correctionResult.Time, settings);
break;
}
if (instruction == RandomizingInstruction.Skip)
break;
}
}
protected abstract long GetOldTime(TObject obj, TSettings settings);
protected abstract void SetNewTime(TObject obj, long time, TSettings settings);
protected abstract RandomizingCorrectionResult CorrectObject(TObject obj, long time, TSettings settings);
private static long RandomizeTime(long time, IBounds bounds, Random random, TempoMap tempoMap)
{
var timeBounds = bounds.GetBounds(time, tempoMap);
var minTime = Math.Max(0, timeBounds.Item1) - 1;
var maxTime = timeBounds.Item2;
var difference = (int)Math.Abs(maxTime - minTime);
return minTime + random.Next(difference) + 1;
}
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using Melanchall.DryWetMidi.Smf.Interaction;
namespace Melanchall.DryWetMidi.Tools
{
public abstract class Randomizer<TObject, TSettings>
where TSettings : RandomizingSettings, new()
{
#region Methods
protected void RandomizeInternal(IEnumerable<TObject> objects, IBounds bounds, TempoMap tempoMap, TSettings settings)
{
settings = settings ?? new TSettings();
var random = new Random();
foreach (var obj in objects.Where(o => o != null))
{
var time = GetOldTime(obj, settings);
time = RandomizeTime(time, bounds, random, tempoMap);
var correctionResult = CorrectObject(obj, time, settings);
var instruction = correctionResult.RandomizingInstruction;
if (instruction == RandomizingInstruction.Apply)
{
SetNewTime(obj, correctionResult.Time, settings);
break;
}
if (instruction == RandomizingInstruction.Skip)
break;
}
}
protected abstract long GetOldTime(TObject obj, TSettings settings);
protected abstract void SetNewTime(TObject obj, long time, TSettings settings);
protected abstract RandomizingCorrectionResult CorrectObject(TObject obj, long time, TSettings settings);
private static long RandomizeTime(long time, IBounds bounds, Random random, TempoMap tempoMap)
{
var timeBounds = bounds.GetBounds(time, tempoMap);
var minTime = Math.Max(0, timeBounds.Item1) - 1;
var maxTime = timeBounds.Item2;
var difference = (int)Math.Abs(maxTime - minTime);
return minTime + random.Next(difference) + 1;
}
#endregion
}
}
| mit | C# |
ec3e04dbdc2cd415a7a66d17e12518efcea34059 | Fix responsiveness problem | lucasdavid/Gamedalf,lucasdavid/Gamedalf | Gamedalf/Views/Shared/_SearchWithCreate.cshtml | Gamedalf/Views/Shared/_SearchWithCreate.cshtml | @model String
<div class="row">
<div class="col-sm-6">
@Html.Partial("_Search", @Model)
</div>
<div class="col-sm-2 col-sm-offset-4 text-right">
<a href="@Url.Action("Create")" class="btn btn-primary">
<span class="glyphicon glyphicon-plus"></span>
Create
</a>
</div>
</div>
| @model String
<div class="row">
<div class="col-md-6">
@Html.Partial("_Search", @Model)
</div>
<div class="col-md-2 col-sm-push-4 text-right">
<a href="@Url.Action("Create")" class="btn btn-primary">
<span class="glyphicon glyphicon-plus"></span>
Create
</a>
</div>
</div>
| mit | C# |
fbe95519b134ae0f4d8cd5435d55810099eb45ac | update copyright info | dietsche/infinite-putty-tunnel | InfinitePuttyTunnel/Properties/AssemblyInfo.cs | InfinitePuttyTunnel/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Infinite PuTTY Tunnel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Infinite PuTTY Tunnel")]
[assembly: AssemblyCopyright("Copyright 2016 Gregory L Dietsche. Copyright (c) 2009-2009 Joeri Bekker.")]
[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("26409fc0-5677-469d-acff-f41414b538f3")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.0.0")] | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Infinite PuTTY Tunnel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Infinite PuTTY Tunnel")]
[assembly: AssemblyCopyright("Copyright (c) 2009-2009 Joeri Bekker. Copyright 2016 Gregory L Dietsche.")]
[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("26409fc0-5677-469d-acff-f41414b538f3")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.0.0")] | mit | C# |
fa1d98dd575e1b63a72c69f907ff683fbc01a710 | Add flaky category to missed Batch test | ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell | src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/JobScheduleTests.cs | src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/JobScheduleTests.cs | // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 Microsoft.Azure.Test;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
namespace Microsoft.Azure.Commands.Batch.Test.ScenarioTests
{
public class JobScheduleTests : WindowsAzure.Commands.Test.Utilities.Common.RMTestBase
{
public JobScheduleTests(Xunit.Abstractions.ITestOutputHelper output)
{
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
}
[Fact]
[Trait(Category.AcceptanceType, Category.Flaky)]
public void TestJobScheduleCRUD()
{
BatchController.NewInstance.RunPsTest("Test-JobScheduleCRUD");
}
[Fact]
[Trait(Category.AcceptanceType, Category.Flaky)]
public void TestDisableEnableTerminateJobSchedule()
{
BatchController controller = BatchController.NewInstance;
string jobScheduleId = "testDisableEnableTerminateJobSchedule";
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-DisableEnableTerminateJobSchedule '{0}'", jobScheduleId) }; },
() =>
{
context = new ScenarioTestContext();
ScenarioTestHelpers.CreateTestJobSchedule(controller, context, jobScheduleId, null);
},
() =>
{
ScenarioTestHelpers.DeleteJobSchedule(controller, context, jobScheduleId);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
}
}
| // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 Microsoft.Azure.Test;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
namespace Microsoft.Azure.Commands.Batch.Test.ScenarioTests
{
public class JobScheduleTests : WindowsAzure.Commands.Test.Utilities.Common.RMTestBase
{
public JobScheduleTests(Xunit.Abstractions.ITestOutputHelper output)
{
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestJobScheduleCRUD()
{
BatchController.NewInstance.RunPsTest("Test-JobScheduleCRUD");
}
[Fact]
[Trait(Category.AcceptanceType, Category.Flaky)]
public void TestDisableEnableTerminateJobSchedule()
{
BatchController controller = BatchController.NewInstance;
string jobScheduleId = "testDisableEnableTerminateJobSchedule";
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-DisableEnableTerminateJobSchedule '{0}'", jobScheduleId) }; },
() =>
{
context = new ScenarioTestContext();
ScenarioTestHelpers.CreateTestJobSchedule(controller, context, jobScheduleId, null);
},
() =>
{
ScenarioTestHelpers.DeleteJobSchedule(controller, context, jobScheduleId);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
}
}
| apache-2.0 | C# |
ca9e2e44a76f1d8596e48151b314a9ee036b916c | Add license header | alfantp/azure-powershell,CamSoper/azure-powershell,AzureRT/azure-powershell,yoavrubin/azure-powershell,krkhan/azure-powershell,AzureAutomationTeam/azure-powershell,pankajsn/azure-powershell,hovsepm/azure-powershell,ankurchoubeymsft/azure-powershell,AzureRT/azure-powershell,krkhan/azure-powershell,alfantp/azure-powershell,ClogenyTechnologies/azure-powershell,devigned/azure-powershell,shuagarw/azure-powershell,AzureRT/azure-powershell,arcadiahlyy/azure-powershell,naveedaz/azure-powershell,pankajsn/azure-powershell,devigned/azure-powershell,devigned/azure-powershell,yantang-msft/azure-powershell,atpham256/azure-powershell,AzureRT/azure-powershell,hovsepm/azure-powershell,jtlibing/azure-powershell,ClogenyTechnologies/azure-powershell,jtlibing/azure-powershell,naveedaz/azure-powershell,ankurchoubeymsft/azure-powershell,hovsepm/azure-powershell,pankajsn/azure-powershell,Matt-Westphal/azure-powershell,yoavrubin/azure-powershell,CamSoper/azure-powershell,zhencui/azure-powershell,rohmano/azure-powershell,akurmi/azure-powershell,yoavrubin/azure-powershell,atpham256/azure-powershell,arcadiahlyy/azure-powershell,yantang-msft/azure-powershell,yantang-msft/azure-powershell,rohmano/azure-powershell,devigned/azure-powershell,yoavrubin/azure-powershell,yantang-msft/azure-powershell,CamSoper/azure-powershell,Matt-Westphal/azure-powershell,atpham256/azure-powershell,naveedaz/azure-powershell,zhencui/azure-powershell,AzureAutomationTeam/azure-powershell,jtlibing/azure-powershell,hovsepm/azure-powershell,zhencui/azure-powershell,shuagarw/azure-powershell,AzureRT/azure-powershell,pankajsn/azure-powershell,hovsepm/azure-powershell,atpham256/azure-powershell,nemanja88/azure-powershell,AzureAutomationTeam/azure-powershell,krkhan/azure-powershell,zhencui/azure-powershell,Matt-Westphal/azure-powershell,ClogenyTechnologies/azure-powershell,alfantp/azure-powershell,akurmi/azure-powershell,ClogenyTechnologies/azure-powershell,ankurchoubeymsft/azure-powershell,seanbamsft/azure-powershell,devigned/azure-powershell,AzureAutomationTeam/azure-powershell,atpham256/azure-powershell,seanbamsft/azure-powershell,arcadiahlyy/azure-powershell,yoavrubin/azure-powershell,arcadiahlyy/azure-powershell,rohmano/azure-powershell,ClogenyTechnologies/azure-powershell,zhencui/azure-powershell,CamSoper/azure-powershell,krkhan/azure-powershell,krkhan/azure-powershell,alfantp/azure-powershell,jtlibing/azure-powershell,hungmai-msft/azure-powershell,rohmano/azure-powershell,devigned/azure-powershell,hungmai-msft/azure-powershell,hungmai-msft/azure-powershell,naveedaz/azure-powershell,zhencui/azure-powershell,Matt-Westphal/azure-powershell,seanbamsft/azure-powershell,akurmi/azure-powershell,hungmai-msft/azure-powershell,rohmano/azure-powershell,shuagarw/azure-powershell,AzureAutomationTeam/azure-powershell,atpham256/azure-powershell,nemanja88/azure-powershell,AzureAutomationTeam/azure-powershell,Matt-Westphal/azure-powershell,yantang-msft/azure-powershell,naveedaz/azure-powershell,hungmai-msft/azure-powershell,ankurchoubeymsft/azure-powershell,rohmano/azure-powershell,alfantp/azure-powershell,krkhan/azure-powershell,seanbamsft/azure-powershell,pankajsn/azure-powershell,seanbamsft/azure-powershell,ankurchoubeymsft/azure-powershell,CamSoper/azure-powershell,akurmi/azure-powershell,AzureRT/azure-powershell,akurmi/azure-powershell,shuagarw/azure-powershell,jtlibing/azure-powershell,nemanja88/azure-powershell,hungmai-msft/azure-powershell,pankajsn/azure-powershell,seanbamsft/azure-powershell,shuagarw/azure-powershell,naveedaz/azure-powershell,nemanja88/azure-powershell,arcadiahlyy/azure-powershell,yantang-msft/azure-powershell,nemanja88/azure-powershell | src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/OSType.cs | src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/OSType.cs | // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption
{
enum OSType
{
Windows,
Linux,
Unknown
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption
{
enum OSType
{
Windows,
Linux,
Unknown
}
}
| apache-2.0 | C# |
a2c7ee20055cf9db0ce13d3b8458ea2a17b8c4a5 | Add separator before action item in tool bar | ulrichb/Roflcopter,ulrichb/Roflcopter | Src/Roflcopter.Plugin/TodoItems/TodoItemsCountDummyAction.cs | Src/Roflcopter.Plugin/TodoItems/TodoItemsCountDummyAction.cs | using System.Linq;
using JetBrains.ActionManagement;
using JetBrains.Annotations;
using JetBrains.Application.DataContext;
using JetBrains.ReSharper.Features.Inspections.Actions;
using JetBrains.UI.ActionsRevised;
namespace Roflcopter.Plugin.TodoItems
{
[ActionGroup(nameof(TodoItemsCountDummyActionGroup), ActionGroupInsertStyles.Separated, Id = 944208910)]
public class TodoItemsCountDummyActionGroup : IAction, IInsertLast<TodoExplorerActionBarActionGroup>
{
public TodoItemsCountDummyActionGroup(TodoItemsCountDummyAction _)
{
}
}
[Action(nameof(TodoItemsCountDummyAction), Id = 944208920)]
public class TodoItemsCountDummyAction : IExecutableAction
{
public bool Update(IDataContext context, ActionPresentation presentation, [CanBeNull] DelegateUpdate nextUpdate)
{
var todoItemsCountProvider = context.GetComponent<TodoItemsCountProvider>();
var todoItemsCounts = todoItemsCountProvider.TodoItemsCounts;
if (todoItemsCounts == null)
presentation.Text = null;
else
presentation.Text = string.Join(", ", todoItemsCounts.Select(x => $"{x.Definition}: {x.Count}"));
return false;
}
public void Execute(IDataContext context, [CanBeNull] DelegateExecute nextExecute)
{
}
}
}
| using System.Linq;
using JetBrains.ActionManagement;
using JetBrains.Annotations;
using JetBrains.Application.DataContext;
using JetBrains.ReSharper.Features.Inspections.Actions;
using JetBrains.UI.ActionsRevised;
namespace Roflcopter.Plugin.TodoItems
{
[Action(nameof(TodoItemsCountDummyAction), Id = 944208914)]
public class TodoItemsCountDummyAction : IExecutableAction, IInsertLast<TodoExplorerActionBarActionGroup>
{
public bool Update(IDataContext context, ActionPresentation presentation, [CanBeNull] DelegateUpdate nextUpdate)
{
var todoItemsCountProvider = context.GetComponent<TodoItemsCountProvider>();
var todoItemsCounts = todoItemsCountProvider.TodoItemsCounts;
if (todoItemsCounts == null)
presentation.Text = null;
else
presentation.Text = string.Join(", ", todoItemsCounts.Select(x => $"{x.Definition}: {x.Count}"));
return false;
}
public void Execute(IDataContext context, [CanBeNull] DelegateExecute nextExecute)
{
}
}
}
| mit | C# |
4bea5a56df99bd7b18e3ebe34bf0627c30a07d6f | Update AssemblyInfo.cs | Sturnus/DynamicContentControl | Sturnus.Wpf.DynamicContentControl/Properties/AssemblyInfo.cs | Sturnus.Wpf.DynamicContentControl/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Markup;
// 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("Sturnus.Wpf.DynamicContentControl")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sturnus.Wpf.DynamicContentControl")]
[assembly: AssemblyCopyright("Copyright © 2015 Jeroen Spreeuwenberg")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: XmlnsDefinition("http://www.github.com/sturnus/dynamiccontentcontrol", "Sturnus.Wpf.DynamicContentControl")]
// 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("73e15c9a-ae01-4a91-887a-dc424e65cba9")]
// 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")]
[assembly: AssemblyFileVersion("1.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Markup;
// 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("Sturnus.Wpf.DynamicContentControl")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Toshiba")]
[assembly: AssemblyProduct("Sturnus.Wpf.DynamicContentControl")]
[assembly: AssemblyCopyright("Copyright © Toshiba 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: XmlnsDefinition("http://www.github.com/sturnus/dynamiccontentcontrol", "Sturnus.Wpf.DynamicContentControl")]
// 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("73e15c9a-ae01-4a91-887a-dc424e65cba9")]
// 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")]
[assembly: AssemblyFileVersion("1.0.0")]
| apache-2.0 | C# |
d94615cb2048d3511974873821b8122d90ea741e | use Restart instead of Start method | pixel-stuff/ld_dare_32 | Unity/ludum-dare-32-PixelStuff/Assets/Scripts/GameManager.cs | Unity/ludum-dare-32-PixelStuff/Assets/Scripts/GameManager.cs | using UnityEngine;
using System.Collections;
public enum GameState {
Intro, // Game launched
Start,
Over
}
public class GameManager : MonoBehaviour {
public BrothersManager brothersManager;
private GameState _state;
private GameState state {
get {
return _state;
}
set {
if (value == _state)
return;
_state = value;
switch (_state) {
case GameState.Intro:
Intro ();
break;
case GameState.Start:
Restart ();
break;
case GameState.Over:
GameOver ();
break;
}
}
}
// Use this for initialization
void Start () {
state = GameState.Intro;
}
// Update is called once per frame
void Update () {
// Handle Keyboard inputs
if (Input.GetKey (KeyCode.R)) {
Restart();
}
if (state == GameState.Start) {
// While playing
if (Input.GetKey (KeyCode.S)) {
Attack();
}
if (Input.GetKey (KeyCode.Space)) {
ChopWood();
}
}
if (Input.GetKey (KeyCode.Return)) {
Submit();
}
}
private void Submit() {
if (state == GameState.Intro) {
state = GameState.Start;
}
}
private void Intro() {
}
private void Restart() {
brothersManager.state = BrothersState.MovingIntoScene;
}
private void Attack() {
if (brothersManager.state == BrothersState.PrepareAttack) {
brothersManager.state = BrothersState.Attack;
} else {
brothersManager.state = BrothersState.PrepareAttack;
}
}
private void ChopWood() {
brothersManager.ChopWood ();
}
private void GameOver() {
brothersManager.Die ();
}
}
| using UnityEngine;
using System.Collections;
public enum GameState {
Intro, // Game launched
Start,
Over
}
public class GameManager : MonoBehaviour {
public BrothersManager brothersManager;
private GameState _state;
private GameState state {
get {
return _state;
}
set {
if (value == _state)
return;
_state = value;
switch (_state) {
case GameState.Intro:
Intro ();
break;
case GameState.Start:
Start ();
break;
case GameState.Over:
GameOver ();
break;
}
}
}
// Use this for initialization
void Start () {
state = GameState.Intro;
}
// Update is called once per frame
void Update () {
// Handle Keyboard inputs
if (Input.GetKey (KeyCode.R)) {
Restart();
}
if (state == GameState.Start) {
// While playing
if (Input.GetKey (KeyCode.S)) {
Attack();
}
if (Input.GetKey (KeyCode.Space)) {
ChopWood();
}
}
if (Input.GetKey (KeyCode.Return)) {
Submit();
}
}
private void Submit() {
if (state == GameState.Intro) {
state = GameState.Start;
}
}
private void Intro() {
}
private void Restart() {
brothersManager.state = BrothersState.MovingIntoScene;
}
private void Attack() {
if (brothersManager.state == BrothersState.PrepareAttack) {
brothersManager.state = BrothersState.Attack;
} else {
brothersManager.state = BrothersState.PrepareAttack;
}
}
private void ChopWood() {
brothersManager.ChopWood ();
}
private void GameOver() {
brothersManager.Die ();
}
}
| mit | C# |
8cebdb0015a62d01680dd7fb2bc089d476aa9e24 | 修改IContainerItemCollection,继承IBaseCacheStrategy<string, IBaseContainerBag> | jiehanlin/WeiXinMPSDK,lishewen/WeiXinMPSDK,JeffreySu/WxOpen,lishewen/WeiXinMPSDK,mc7246/WeiXinMPSDK,wanddy/WeiXinMPSDK,down4u/WeiXinMPSDK,wanddy/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,wanddy/WeiXinMPSDK,down4u/WeiXinMPSDK,JeffreySu/WxOpen,mc7246/WeiXinMPSDK,lishewen/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,down4u/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,mc7246/WeiXinMPSDK,JeffreySu/WeiXinMPSDK | Senparc.Weixin/Senparc.Weixin/Cache/ContainerCacheStragegy/ContainerItemCollection.cs | Senparc.Weixin/Senparc.Weixin/Cache/ContainerCacheStragegy/ContainerItemCollection.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Senparc.Weixin.Containers;
namespace Senparc.Weixin.Cache
{
/// <summary>
/// IContainerItemCollection,对某个Container下的缓存值ContainerBag进行封装
/// </summary>
public interface IContainerItemCollection : IBaseCacheStrategy<string, IBaseContainerBag>
{
/// <summary>
/// 创建时间
/// </summary>
DateTime CreateTime { get; set; }
}
/// <summary>
/// 储存某个Container下所有ContainerBag的字典集合
/// </summary>
public class ContainerItemCollection : Dictionary<string, IBaseContainerBag>, IContainerItemCollection
{
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
public ContainerItemCollection()
{
CreateTime = DateTime.Now;
}
public string CacheSetKey { get; set; }
public void InsertToCache(string key, IBaseContainerBag value)
{
base[key] = value;
}
public void RemoveFromCache(string key)
{
base.Remove(key);
}
public IBaseContainerBag Get(string key)
{
if (this.CheckExisted(key))
{
return base[key];
}
return null;
}
public IDictionary<string, IBaseContainerBag> GetAll()
{
return this;
}
public bool CheckExisted(string key)
{
return base.ContainsKey(key);
}
public long GetCount()
{
return base.Count;
}
public void Update(string key, IBaseContainerBag value)
{
base[key] = value;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Senparc.Weixin.Containers;
namespace Senparc.Weixin.Cache
{
/// <summary>
/// IContainerItemCollection,对某个Container下的缓存值ContainerBag进行封装
/// </summary>
public interface IContainerItemCollection : IDictionary<string, IBaseContainerBag>
{
/// <summary>
/// 创建时间
/// </summary>
DateTime CreateTime { get; set; }
}
/// <summary>
/// 储存某个Container下所有ContainerBag的字典集合
/// </summary>
public class ContainerItemCollection : Dictionary<string, IBaseContainerBag>, IContainerItemCollection
{
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
public ContainerItemCollection()
{
CreateTime = DateTime.Now;
}
}
}
| apache-2.0 | C# |
8d267176d1a69d4005358f0cd7bf70663e8e62da | update fixed user agent default constructor test check if null | wangkanai/Detection | src/Detection/test/UserAgentTests.cs | src/Detection/test/UserAgentTests.cs | // Copyright (c) 2019 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using Xunit;
namespace Wangkanai.Detection.Test
{
public class UserAgentTests
{
[Fact]
public void Ctor_Default_Success()
{
var userAgent = new UserAgent();
Assert.NotNull(userAgent.ToString());
Assert.Equal(string.Empty, userAgent.ToString());
}
[Fact]
public void Ctor_String_Success()
{
var name = "Agent";
var userAgent = new UserAgent(name);
Assert.Equal(name, userAgent.ToString());
}
[Fact]
public void Ctor_Null_Success()
{
var userAgent = new UserAgent(null);
Assert.NotNull(userAgent.ToString());
}
}
}
| // Copyright (c) 2019 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using Xunit;
namespace Wangkanai.Detection.Test
{
public class UserAgentTests
{
[Fact]
public void Ctor_Default_Success()
{
var userAgent = new UserAgent();
Assert.Null(userAgent.ToString());
}
[Fact]
public void Ctor_String_Success()
{
var name = "Agent";
var userAgent = new UserAgent(name);
Assert.Equal(name, userAgent.ToString());
}
[Fact]
public void Ctor_Null_Success()
{
var userAgent = new UserAgent(null);
Assert.NotNull(userAgent.ToString());
}
}
}
| apache-2.0 | C# |
33be43d8c9ae76e6e5d9c8df7748a3fc2156c12f | Update ShapeSubtype.cs | eiriktsarpalis/TypeShape,eiriktsarpalis/TypeShape | src/TypeShape.CSharp/ShapeSubtype.cs | src/TypeShape.CSharp/ShapeSubtype.cs | using System;
// Binding type arguments in subtype constraint currently not possible in F#,
// defining those shape types in C#.
namespace TypeShape
{
public interface ISubtypeVisitor<TBase, TResult>
{
TResult Visit<TSubtype>() where TSubtype : TBase;
}
public interface IShapeSubtype<TBase>
{
Type Subtype { get; }
TResult Accept<TResult>(ISubtypeVisitor<TBase, TResult> visitor);
}
public class ShapeSubtype<TSubtype, TBase> : IShapeSubtype<TBase> where TSubtype : TBase
{
public Type Subtype => typeof(TSubtype);
public TResult Accept<TResult>(ISubtypeVisitor<TBase, TResult> visitor)
{
return visitor.Visit<TSubtype>();
}
}
}
| using System;
// Binding type arguments in subtype constraint currently not possible in C#,
// defining those shape types in C#.
namespace TypeShape
{
public interface ISubtypeVisitor<TBase, TResult>
{
TResult Visit<TSubtype>() where TSubtype : TBase;
}
public interface IShapeSubtype<TBase>
{
Type Subtype { get; }
TResult Accept<TResult>(ISubtypeVisitor<TBase, TResult> visitor);
}
public class ShapeSubtype<TSubtype, TBase> : IShapeSubtype<TBase> where TSubtype : TBase
{
public Type Subtype => typeof(TSubtype);
public TResult Accept<TResult>(ISubtypeVisitor<TBase, TResult> visitor)
{
return visitor.Visit<TSubtype>();
}
}
}
| mit | C# |
0cca12c17d68d9f0e9f0585c0b27aa6007e86fb5 | update camera script to draw the building mesh | AlexanderMazaletskiy/ProceduralBuildings,tkaretsos/ProceduralBuildings | Scripts/CameraControl.cs | Scripts/CameraControl.cs | using UnityEngine;
using System.Collections.Generic;
public class CameraControl : MonoBehaviour
{
private enum CameraMode
{
Horizontal,
Free
}
[SerializeField]
private CameraMode _cameraMode = CameraMode.Horizontal;
[SerializeField]
private float _movementSpeed = 10.0f;
[SerializeField]
private float _rotationSpeed = 200.0f;
[SerializeField]
private Material mat;
private float _x_rotation = 0.0f;
private float _y_rotation = 0.0f;
void OnPostRender ()
{
BuildingMesh mesh = new BuildingMesh(new Vector3(1,0,1),
new Vector3(1,0,-1),
new Vector3(-1,0,-1),
new Vector3(-1,0,1),
BuildingType.Neoclassical);
mesh.ConstructFaces();
mesh.Draw(mat);
}
void Update ()
{
_y_rotation += Input.GetAxis("Mouse X") * _rotationSpeed * Time.deltaTime;
_x_rotation += Input.GetAxis("Mouse Y") * _rotationSpeed * Time.deltaTime;
ClampCamera();
camera.transform.eulerAngles = new Vector3(-_x_rotation, _y_rotation, 0.0f);
if (Input.GetAxis("Vertical") != 0.0f)
{
if (_cameraMode == CameraMode.Horizontal)
camera.transform.position += Vector3.Cross(camera.transform.right, Vector3.up) *
Input.GetAxis("Vertical") *
_movementSpeed * Time.deltaTime;
else
camera.transform.position += camera.transform.forward *
Input.GetAxis("Vertical") *
_movementSpeed * Time.deltaTime;
}
if (Input.GetAxis("Horizontal") != 0.0f)
camera.transform.position += camera.transform.right *
Input.GetAxis("Horizontal") *
_movementSpeed * Time.deltaTime;
if (Input.GetKey(KeyCode.E))
camera.transform.position += Vector3.up * _movementSpeed * Time.deltaTime;
if (Input.GetKey(KeyCode.C))
camera.transform.position -= Vector3.up * _movementSpeed * Time.deltaTime;
if (Input.GetKeyUp(KeyCode.M))
if (_cameraMode == CameraMode.Free)
_cameraMode = CameraMode.Horizontal;
else
_cameraMode = CameraMode.Free;
}
private void ClampCamera ()
{
if (_y_rotation < -360.0f) _y_rotation += 360.0f;
if (_y_rotation > 360.0f) _y_rotation -= 360.0f;
if (_x_rotation > 80.0f) _x_rotation = 80.0f;
if (_x_rotation < -80.0f) _x_rotation = -80.0f;
}
}
| using UnityEngine;
using System.Collections.Generic;
public class CameraControl : MonoBehaviour
{
private enum CameraMode
{
Horizontal,
Free
}
[SerializeField]
private CameraMode _cameraMode = CameraMode.Horizontal;
[SerializeField]
private float _movementSpeed = 10.0f;
[SerializeField]
private float _rotationSpeed = 200.0f;
private float _x_rotation = 0.0f;
private float _y_rotation = 0.0f;
void Start ()
{
BuildingMesh mesh = new BuildingMesh(new Vector3(1,0,1),
new Vector3(-1,0,1),
new Vector3(-1,0,-1),
new Vector3(1,0,-1),
BuildingType.Neoclassical);
}
void Update ()
{
_y_rotation += Input.GetAxis("Mouse X") * _rotationSpeed * Time.deltaTime;
_x_rotation += Input.GetAxis("Mouse Y") * _rotationSpeed * Time.deltaTime;
ClampCamera();
camera.transform.eulerAngles = new Vector3(-_x_rotation, _y_rotation, 0.0f);
if (Input.GetAxis("Vertical") != 0.0f)
{
if (_cameraMode == CameraMode.Horizontal)
camera.transform.position += Vector3.Cross(camera.transform.right, Vector3.up) *
Input.GetAxis("Vertical") *
_movementSpeed * Time.deltaTime;
else
camera.transform.position += camera.transform.forward *
Input.GetAxis("Vertical") *
_movementSpeed * Time.deltaTime;
}
if (Input.GetAxis("Horizontal") != 0.0f)
camera.transform.position += camera.transform.right *
Input.GetAxis("Horizontal") *
_movementSpeed * Time.deltaTime;
if (Input.GetKey(KeyCode.E))
camera.transform.position += Vector3.up * _movementSpeed * Time.deltaTime;
if (Input.GetKey(KeyCode.C))
camera.transform.position -= Vector3.up * _movementSpeed * Time.deltaTime;
if (Input.GetKeyUp(KeyCode.M))
if (_cameraMode == CameraMode.Free)
_cameraMode = CameraMode.Horizontal;
else
_cameraMode = CameraMode.Free;
}
private void ClampCamera ()
{
if (_y_rotation < -360.0f) _y_rotation += 360.0f;
if (_y_rotation > 360.0f) _y_rotation -= 360.0f;
if (_x_rotation > 80.0f) _x_rotation = 80.0f;
if (_x_rotation < -80.0f) _x_rotation = -80.0f;
}
}
| mit | C# |
f08d9b56dd453425b34397f27a6d3cb789ff3ad9 | Add Notes.UpdateTest.RemovingTag | orodriguez/FTF,orodriguez/FTF,orodriguez/FTF | FTF.Tests.XUnit/Notes/UpdateTest.cs | FTF.Tests.XUnit/Notes/UpdateTest.cs | using System;
using System.Linq;
using FTF.Api.Exceptions;
using Xunit;
namespace FTF.Tests.XUnit.Notes
{
public class UpdateTest : UserAuthenticatedTest
{
[Fact]
public void SimpleTextUpdate()
{
CurrentTime = new DateTime(2016, 2, 20);
var noteId = App.Notes.Create("Buy cheese");
App.Notes.Update(noteId, "Buy american cheese");
var note = App.Notes.Retrieve(noteId);
Assert.Equal("Buy american cheese", note.Text);
Assert.Equal(new DateTime(2016,2,20), note.CreationDate);
Assert.Equal("orodriguez", note.UserName);
}
[Fact]
public void WithTags()
{
var noteId = App.Notes.Create("Note without tag");
App.Notes.Update(noteId, "A Note with #some #tags");
var note = App.Notes.Retrieve(noteId);
Assert.Equal(new[] { "some", "tags" }, note.Tags.Select(n => n.Name));
}
[Fact]
public void WithExistingTags()
{
App.Notes.Create("Note with #Tag");
var noteId = App.Notes.Create("Note without tag");
App.Notes.Update(noteId, "Note update with #Tag");
var tags = App.Taggins.All().ToList();
Assert.Equal(new[] { "Tag" }, tags.Select(t => t.Name));
Assert.Equal(new[] { 2 }, tags.Select(t => t.NotesCount));
}
[Fact]
public void RemovingTag()
{
var noteId = App.Notes.Create("Note with #Tag");
App.Notes.Update(noteId, "Note without tag");
var note = App.Notes.Retrieve(noteId);
Assert.Empty(note.Tags);
}
[Fact]
public void EmptyText()
{
var noteId = App.Notes.Create("Buy cheese");
var error = Assert.Throws<ValidationException>(() => App.Notes.Update(noteId, ""));
Assert.Equal("Note can not be empty", error.Message);
}
}
}
| using System;
using System.Linq;
using FTF.Api.Exceptions;
using Xunit;
namespace FTF.Tests.XUnit.Notes
{
public class UpdateTest : UserAuthenticatedTest
{
[Fact]
public void SimpleTextUpdate()
{
CurrentTime = new DateTime(2016, 2, 20);
var noteId = App.Notes.Create("Buy cheese");
App.Notes.Update(noteId, "Buy american cheese");
var note = App.Notes.Retrieve(noteId);
Assert.Equal("Buy american cheese", note.Text);
Assert.Equal(new DateTime(2016,2,20), note.CreationDate);
Assert.Equal("orodriguez", note.UserName);
}
[Fact]
public void WithTags()
{
var noteId = App.Notes.Create("Note without tag");
App.Notes.Update(noteId, "A Note with #some #tags");
var note = App.Notes.Retrieve(noteId);
Assert.Equal(new[] { "some", "tags" }, note.Tags.Select(n => n.Name));
}
[Fact]
public void WithExistingTags()
{
App.Notes.Create("Note with #Tag");
var noteId = App.Notes.Create("Note without tag");
App.Notes.Update(noteId, "Note update with #Tag");
var tags = App.Taggins.All().ToList();
Assert.Equal(new[] { "Tag" }, tags.Select(t => t.Name));
Assert.Equal(new[] { 2 }, tags.Select(t => t.NotesCount));
}
[Fact]
public void EmptyText()
{
var noteId = App.Notes.Create("Buy cheese");
var error = Assert.Throws<ValidationException>(() => App.Notes.Update(noteId, ""));
Assert.Equal("Note can not be empty", error.Message);
}
}
}
| mit | C# |
e2f5f48092721f7603f1fac0c7eefd2104f09271 | Add the request action | flagbug/Espera.Network | Espera.Network/RequestInfo.cs | Espera.Network/RequestInfo.cs | using Newtonsoft.Json.Linq;
using System;
namespace Espera.Network
{
public class RequestInfo
{
public JObject Parameters { get; set; }
public string RequestAction { get; set; }
public Guid RequestId { get; set; }
}
} | using Newtonsoft.Json.Linq;
using System;
namespace Espera.Network
{
public class RequestInfo
{
public JObject Parameters { get; set; }
public Guid RequestId { get; set; }
}
} | mit | C# |
0980f18c5d7b8a5b8886072d0d90bab1d98f0fe6 | Remove deprecated Select Folder signature from file dialogs. | mmoening/agg-sharp,larsbrubaker/agg-sharp,mmoening/agg-sharp,jlewin/agg-sharp,MatterHackers/agg-sharp,mmoening/agg-sharp | Gui/FileDialogs/FileDialog.cs | Gui/FileDialogs/FileDialog.cs | using System;
using System.IO;
namespace MatterHackers.Agg.UI
{
public abstract class FileDialogCreator
{
public delegate void OpenFileDialogDelegate( OpenFileDialogParams openParams );
public delegate void SelectFolderDialogDelegate( SelectFolderDialogParams folderParams );
public delegate void SaveFileDialogDelegate( SaveFileDialogParams saveParams );
public abstract bool OpenFileDialog(OpenFileDialogParams openParams, OpenFileDialogDelegate callback);
public abstract bool SelectFolderDialog(SelectFolderDialogParams folderParams, SelectFolderDialogDelegate callback);
public abstract bool SaveFileDialog(SaveFileDialogParams saveParams, SaveFileDialogDelegate callback);
}
public static class FileDialog
{
static FileDialogCreator fileDialogCreatorPlugin = null;
static FileDialogCreator FileDialogCreatorPlugin
{
get
{
if (fileDialogCreatorPlugin == null)
{
string pluginPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
PluginFinder<FileDialogCreator> fileDialogCreatorPlugins = new PluginFinder<FileDialogCreator>(pluginPath);
if (fileDialogCreatorPlugins.Plugins.Count != 1)
{
throw new Exception(string.Format("Did not find any FileDialogCreators in Plugin path ({0}.", pluginPath));
}
fileDialogCreatorPlugin = fileDialogCreatorPlugins.Plugins[0];
}
return fileDialogCreatorPlugin;
}
}
public static bool OpenFileDialog(OpenFileDialogParams openParams, FileDialogCreator.OpenFileDialogDelegate callback)
{
return FileDialogCreatorPlugin.OpenFileDialog(openParams, callback);
}
public static bool SelectFolderDialog(SelectFolderDialogParams folderParams, FileDialogCreator.SelectFolderDialogDelegate callback)
{
return FileDialogCreatorPlugin.SelectFolderDialog(folderParams, callback);
}
public static bool SaveFileDialog(SaveFileDialogParams saveParams, FileDialogCreator.SaveFileDialogDelegate callback)
{
return FileDialogCreatorPlugin.SaveFileDialog(saveParams, callback);
}
}
}
| using System;
using System.IO;
namespace MatterHackers.Agg.UI
{
public abstract class FileDialogCreator
{
public delegate void OpenFileDialogDelegate( OpenFileDialogParams openParams );
public delegate void SelectFolderDialogDelegate( SelectFolderDialogParams folderParams );
public delegate void SaveFileDialogDelegate( SaveFileDialogParams saveParams );
public abstract bool OpenFileDialog(OpenFileDialogParams openParams, OpenFileDialogDelegate callback);
public abstract string SelectFolderDialog(ref SelectFolderDialogParams folderParams);
public abstract bool SelectFolderDialog(SelectFolderDialogParams folderParams, SelectFolderDialogDelegate callback);
public abstract bool SaveFileDialog(SaveFileDialogParams saveParams, SaveFileDialogDelegate callback);
}
public static class FileDialog
{
static FileDialogCreator fileDialogCreatorPlugin = null;
static FileDialogCreator FileDialogCreatorPlugin
{
get
{
if (fileDialogCreatorPlugin == null)
{
string pluginPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
PluginFinder<FileDialogCreator> fileDialogCreatorPlugins = new PluginFinder<FileDialogCreator>(pluginPath);
if (fileDialogCreatorPlugins.Plugins.Count != 1)
{
throw new Exception(string.Format("Did not find any FileDialogCreators in Plugin path ({0}.", pluginPath));
}
fileDialogCreatorPlugin = fileDialogCreatorPlugins.Plugins[0];
}
return fileDialogCreatorPlugin;
}
}
public static bool OpenFileDialog(OpenFileDialogParams openParams, FileDialogCreator.OpenFileDialogDelegate callback)
{
return FileDialogCreatorPlugin.OpenFileDialog(openParams, callback);
}
public static bool SelectFolderDialog(SelectFolderDialogParams folderParams, FileDialogCreator.SelectFolderDialogDelegate callback)
{
return FileDialogCreatorPlugin.SelectFolderDialog(folderParams, callback);
}
public static bool SaveFileDialog(SaveFileDialogParams saveParams, FileDialogCreator.SaveFileDialogDelegate callback)
{
return FileDialogCreatorPlugin.SaveFileDialog(saveParams, callback);
}
}
}
| bsd-2-clause | C# |
b0295b511bf149528993c3edd442a0fded407556 | enable cookie sessions | 0xFireball/KQAnalytics3,0xFireball/KQAnalytics3,0xFireball/KQAnalytics3 | KQAnalytics3/src/KQAnalytics3/Bootstrapper.cs | KQAnalytics3/src/KQAnalytics3/Bootstrapper.cs | using Nancy;
using Nancy.Bootstrapper;
using Nancy.Conventions;
using Nancy.Cryptography;
using Nancy.Session;
using Nancy.TinyIoc;
namespace KQAnalytics3
{
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
base.ConfigureConventions(nancyConventions);
nancyConventions.StaticContentsConventions.Add(
StaticContentConventionBuilder.AddDirectory("assets", "wwwroot/assets/")
);
nancyConventions.StaticContentsConventions.Add(
StaticContentConventionBuilder.AddDirectory("static", "wwwroot/static/")
);
}
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
//TODO: Do any required initialization for Nancy here
CookieBasedSessions.Enable(pipelines, new CookieBasedSessionsConfiguration {
// TODO: Configuration
});
}
}
} | using Nancy;
using Nancy.Bootstrapper;
using Nancy.Conventions;
using Nancy.TinyIoc;
namespace KQAnalytics3
{
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
base.ConfigureConventions(nancyConventions);
nancyConventions.StaticContentsConventions.Add(
StaticContentConventionBuilder.AddDirectory("assets", "wwwroot/assets/")
);
nancyConventions.StaticContentsConventions.Add(
StaticContentConventionBuilder.AddDirectory("static", "wwwroot/static/")
);
}
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
//TODO: Do any required initialization for Nancy here
}
}
} | agpl-3.0 | C# |
96745ffb071e3acb43207689a8ef439c366e2153 | Create new style dictionary | BillWagner/TourOfCSharp6 | TourOfCSharp6/Program.cs | TourOfCSharp6/Program.cs | using System;
using System.Collections.Generic;
using System.Linq.Enumerable;
namespace TourOfCSharp6
{
class Program
{
static void Main(string[] args)
{
var webErrors = new Dictionary<int, string>
{
[404] = "Page not Found",
[302] = "Page moved, but left a forwarding address.",
[500] = "The web server can't come out to play today."
};
//PartOne();
}
private static void PartOne()
{
var random = new System.Random();
var range = Range(1, 100);
var sequence = from n in range
select new Point(
random.NextDouble() * 1000,
random.NextDouble() * 1000
);
var sequence2 = range
.Select(n => new Point
(
random.NextDouble() * 1000,
random.NextDouble() * 1000
));
// Should not compile, but does with VS2015 14.0.22310.1
var sequence3 = Select(range, n => new Point
(
random.NextDouble() * 1000,
random.NextDouble() * 1000
));
foreach (var item in sequence)
Console.WriteLine(item);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq.Enumerable;
namespace TourOfCSharp6
{
class Program
{
static void Main(string[] args)
{
var webErrors = new Dictionary<int, string>();
webErrors.Add(404, "Page not Found");
webErrors[302] = "Page moved, but left a forwarding address.";
webErrors[500] = "The web server can't come out to play today.";
//PartOne();
}
private static void PartOne()
{
var random = new System.Random();
var range = Range(1, 100);
var sequence = from n in range
select new Point(
random.NextDouble() * 1000,
random.NextDouble() * 1000
);
var sequence2 = range
.Select(n => new Point
(
random.NextDouble() * 1000,
random.NextDouble() * 1000
));
// Should not compile, but does with VS2015 14.0.22310.1
var sequence3 = Select(range, n => new Point
(
random.NextDouble() * 1000,
random.NextDouble() * 1000
));
foreach (var item in sequence)
Console.WriteLine(item);
}
}
}
| mit | C# |
b31092deaa165cfb3998b0915cc822ede5be47b6 | Add documentation for ClientOptions Model #39 | ithielnor/harvest.net | Harvest.Net/Models/ClientOptions.cs | Harvest.Net/Models/ClientOptions.cs | using RestSharp.Serializers;
namespace Harvest.Net.Models
{
/// <summary>
/// Model which is used for general operations in the client context.
/// </summary>
[SerializeAs(Name = "client")]
public class ClientOptions
{
/// <summary>
/// New client name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Optional Highrise ID for our legacy integration.
/// </summary>
public long? HighriseId { get; set; }
/// <summary>
/// The currency you�d like to use for the client.
/// </summary>
public Currency? Currency { get; set; }
/// <summary>
/// Additional details, normally used for address information.
/// </summary>
public string Details { get; set; }
/// <summary>
/// Determines if the client is active, or archived.
/// </summary>
public bool? Active { get; set; }
}
}
| using RestSharp.Serializers;
namespace Harvest.Net.Models
{
[SerializeAs(Name = "client")]
public class ClientOptions
{
public string Name { get; set; }
public long? HighriseId { get; set; }
public Currency? Currency { get; set; }
public string Details { get; set; }
public bool? Active { get; set; }
}
}
| mit | C# |
6540d21cbb344214b84045a0ef8249f4faee44ab | bump version to 15300 | HearthSim/HearthDb | HearthDb/Properties/AssemblyInfo.cs | HearthDb/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.2.0.15300")]
[assembly: AssemblyFileVersion("6.2.0.15300")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.2.0.15181")]
[assembly: AssemblyFileVersion("6.2.0.15181")]
| mit | C# |
4bb853b2fbb8c54bc98c0bc2fdcf36c1a15b9808 | reduce iteration/run count | stevedesmond-ca/BenchmarkMockNet | Program.cs | Program.cs | using System.Linq;
using BenchmarkDotNet.Running;
using BenchmarkMockNet.Benchmarks;
namespace BenchmarkMockNet
{
public static class Program
{
public const int InvocationCount = 100_000;
public const int TargetCount = 3;
public static void Main(string[] args)
{
new BenchmarkTests().RunAll();
var runner = new BenchmarkSwitcher(new[] {
typeof(Construction),
typeof(Callback),
typeof(EmptyMethod),
typeof(EmptyReturn),
typeof(Return),
typeof(Verify),
typeof(CallbackOnly),
typeof(EmptyMethodOnly),
typeof(EmptyReturnOnly),
typeof(ReturnOnly),
typeof(VerifyOnly)
});
if (args.Any(a => a.Contains("filter")))
runner.Run(args);
else
runner.RunAll();
}
}
} | using System.Linq;
using BenchmarkDotNet.Running;
using BenchmarkMockNet.Benchmarks;
namespace BenchmarkMockNet
{
public static class Program
{
public const int InvocationCount = 1_000_000;
public const int TargetCount = 5;
public static void Main(string[] args)
{
new BenchmarkTests().RunAll();
var runner = new BenchmarkSwitcher(new[] {
typeof(Construction),
typeof(Callback),
typeof(EmptyMethod),
typeof(EmptyReturn),
typeof(Return),
typeof(Verify),
typeof(CallbackOnly),
typeof(EmptyMethodOnly),
typeof(EmptyReturnOnly),
typeof(ReturnOnly),
typeof(VerifyOnly)
});
if (args.Any(a => a.Contains("filter")))
runner.Run(args);
else
runner.RunAll();
}
}
} | mit | C# |
5103fce734043cc282b780f254053267c1d03ba6 | Update Version.cs | dupdob/NFluent,NFluent/NFluent,tpierrain/NFluent,tpierrain/NFluent,dupdob/NFluent,tpierrain/NFluent,dupdob/NFluent,NFluent/NFluent | Version.cs | Version.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="Version.cs" company="">
// Copyright 2013 Thomas PIERRAIN
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
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("1.4.0.1")]
[assembly: AssemblyFileVersion("1.4.0.1")] | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="Version.cs" company="">
// Copyright 2013 Thomas PIERRAIN
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
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("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")] | apache-2.0 | C# |
8eac16ed9e3f4e166781d2883c36db2bb4ff16ff | Update Renaming: Add a semicolon | imba-tjd/CSharp-Code-Repository | 单个文件的程序/Renaming.cs | 单个文件的程序/Renaming.cs | // https://zhidao.baidu.com/question/2122516412305974027
using System;
using System.IO;
public class Renaming
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("本程序可以将指定文件夹下的所有jpg重命名为“文件夹名+序号.jpg”。");
Console.WriteLine("允许一次输入多个文件夹,以空格分隔。路径最好用引号括起来。");
Console.Write("请输入文件夹路径:");
args = Console.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries);
}
int count = 0;
foreach (string dirPath in args)
{
if (!Directory.Exists(dirPath))
{
Console.WriteLine("路径:" + dirPath + " 不存在或不是文件夹,忽略。");
continue;
}
int index = 0;
foreach (string file in Directory.GetFiles(dirPath))
{
string extension = Path.GetExtension(file);
if (extension != ".jpg" && extension != ".jpeg")
continue;
File.Move(file,
Path.GetFullPath(dirPath) + "\\" +// 获取文件夹的绝对路径
Path.GetFileName(Path.GetFullPath(dirPath)) //获取文件夹名
+ ++index + extension);
count++;
}
}
Console.WriteLine("共调整{0}个文件。", count);
}
}
| // https://zhidao.baidu.com/question/2122516412305974027
using System;
using System.IO;
public class Renaming
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("本程序可以将指定文件夹下的所有jpg重命名为“文件夹名+序号.jpg”。");
Console.WriteLine("允许一次输入多个文件夹,以空格分隔。路径最好用引号括起来。")
Console.Write("请输入文件夹路径:");
args = Console.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries);
}
int count = 0;
foreach (string dirPath in args)
{
if (!Directory.Exists(dirPath))
{
Console.WriteLine("路径:" + dirPath + " 不存在或不是文件夹,忽略。");
continue;
}
int index = 0;
foreach (string file in Directory.GetFiles(dirPath))
{
string extension = Path.GetExtension(file);
if (extension != ".jpg" && extension != ".jpeg")
continue;
File.Move(file,
Path.GetFullPath(dirPath) + "\\" +// 获取文件夹的绝对路径
Path.GetFileName(Path.GetFullPath(dirPath)) //获取文件夹名
+ ++index + extension);
count++;
}
}
Console.WriteLine("共调整{0}个文件。", count);
}
}
| mit | C# |
9a3ea15d4b3af5994084fde9002cd969a2a76d78 | Comment out per-error logging, now only needed for logging | VictoriaD/Opserver,wuanunet/Opserver,dteg/Opserver,mqbk/Opserver,baflynn/Opserver,agrath/Opserver,opserver/Opserver,vebin/Opserver,GABeech/Opserver,jeddytier4/Opserver,a9261/Opserver,opserver/Opserver,huoxudong125/Opserver,volkd/Opserver,18098924759/Opserver,rducom/Opserver,manesiotise/Opserver,manesiotise/Opserver,GABeech/Opserver,navone/Opserver,jeddytier4/Opserver,geffzhang/Opserver,IDisposable/Opserver,agrath/Opserver,vebin/Opserver,hotrannam/Opserver,18098924759/Opserver,hotrannam/Opserver,michaelholzheimer/Opserver,manesiotise/Opserver,rducom/Opserver,maurobennici/Opserver,maurobennici/Opserver,Janiels/Opserver,navone/Opserver,vbfox/Opserver,a9261/Opserver,baflynn/Opserver,huoxudong125/Opserver,geffzhang/Opserver,volkd/Opserver,vbfox/Opserver,dteg/Opserver,IDisposable/Opserver,michaelholzheimer/Opserver,Janiels/Opserver,VictoriaD/Opserver,mqbk/Opserver,opserver/Opserver,wuanunet/Opserver | Opserver.Core/OpserverCore.cs | Opserver.Core/OpserverCore.cs | using StackExchange.Elastic;
namespace StackExchange.Opserver
{
public class OpserverCore
{
// Initializes various bits in OpserverCore like exception logging and such so that projects using the core need not load up all references to do so.
public static void Init()
{
try
{
ElasticException.ExceptionDataPrefix = ExtensionMethods.ExceptionLogPrefix;
// We're going to get errors - that's kinda the point of monitoring
// No need to log every one here unless for crazy debugging
//ElasticException.ExceptionOccurred += e => Current.LogException(e);
}
catch { }
}
}
}
| using StackExchange.Elastic;
namespace StackExchange.Opserver
{
public class OpserverCore
{
// Initializes various bits in OpserverCore like exception logging and such so that projects using the core need not load up all references to do so.
public static void Init()
{
try
{
ElasticException.ExceptionDataPrefix = ExtensionMethods.ExceptionLogPrefix;
ElasticException.ExceptionOccurred += e => Current.LogException(e);
}
catch { }
}
}
}
| mit | C# |
78905a26cba31bfa41784901817d7409688a6a8b | Add Progress.CreateOnlyValueChanged | TORISOUP/UniRx,neuecc/UniRx | Assets/Plugins/UniRx/Scripts/Async/Progress.cs | Assets/Plugins/UniRx/Scripts/Async/Progress.cs | #if NET_4_6 || NET_STANDARD_2_0 || CSHARP_7_OR_LATER
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
using System;
using System.Collections.Generic;
namespace UniRx.Async
{
/// <summary>
/// Lightweight IProgress[T] factory.
/// </summary>
public static class Progress
{
public static IProgress<T> Create<T>(Action<T> handler)
{
if (handler == null) return NullProgress<T>.Instance;
return new AnonymousProgress<T>(handler);
}
public static IProgress<T> CreateOnlyValueChanged<T>(Action<T> handler, IEqualityComparer<T> comparer = null)
{
if (handler == null) return NullProgress<T>.Instance;
// TODO:UnityEqualityComparer?
return new OnlyValueChangedProgress<T>(handler, comparer ?? EqualityComparer<T>.Default);
}
sealed class NullProgress<T> : IProgress<T>
{
public static readonly IProgress<T> Instance = new NullProgress<T>();
NullProgress()
{
}
public void Report(T value)
{
}
}
sealed class AnonymousProgress<T> : IProgress<T>
{
readonly Action<T> action;
public AnonymousProgress(Action<T> action)
{
this.action = action;
}
public void Report(T value)
{
action(value);
}
}
sealed class OnlyValueChangedProgress<T> : IProgress<T>
{
readonly Action<T> action;
readonly IEqualityComparer<T> comparer;
bool isFirstCall;
T latestValue;
public OnlyValueChangedProgress(Action<T> action, IEqualityComparer<T> comparer)
{
this.action = action;
this.comparer = comparer;
this.isFirstCall = true;
}
public void Report(T value)
{
if (isFirstCall)
{
isFirstCall = false;
}
else if (comparer.Equals(value, latestValue))
{
return;
}
latestValue = value;
action(value);
}
}
}
}
#endif | #if NET_4_6 || NET_STANDARD_2_0 || CSHARP_7_OR_LATER
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
using System;
namespace UniRx.Async
{
/// <summary>
/// Lightweight IProgress[T] factory.
/// </summary>
public static class Progress
{
public static IProgress<T> Create<T>(Action<T> handler)
{
if (handler == null) return NullProgress<T>.Instance;
return new AnonymousProgress<T>(handler);
}
sealed class NullProgress<T> : IProgress<T>
{
public static readonly IProgress<T> Instance = new NullProgress<T>();
NullProgress()
{
}
public void Report(T value)
{
}
}
sealed class AnonymousProgress<T> : IProgress<T>
{
readonly Action<T> action;
public AnonymousProgress(Action<T> action)
{
this.action = action;
}
public void Report(T value)
{
action(value);
}
}
}
}
#endif | mit | C# |
a95f1382e55edf701b06221fac811f9dad6afba2 | Fix Off-by-one error in AdapterListCollection. | alesliehughes/monoDX,alesliehughes/monoDX | Microsoft.DirectX.Direct3D/Microsoft.DirectX.Direct3D/AdapterListCollection.cs | Microsoft.DirectX.Direct3D/Microsoft.DirectX.Direct3D/AdapterListCollection.cs | /*
* The MIT License (MIT)
*
* Copyright (c) 2013 Alistair Leslie-Hughes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Collections;
namespace Microsoft.DirectX.Direct3D
{
public sealed class AdapterListCollection : IEnumerable, IEnumerator
{
internal int _count;
internal int _index;
public AdapterInformation Default {
get => new AdapterInformation(0);
}
public AdapterInformation this [int index] {
get => new AdapterInformation(index);
}
public int Count {
get => _count;
}
public object Current {
get => new AdapterInformation(_index);
}
public void Reset ()
{
throw new NotImplementedException ();
}
public bool MoveNext ()
{
if (_index >= (_count - 1)) return false;
_index++;
return true;
}
public IEnumerator GetEnumerator ()
{
return this;
}
public override bool Equals (object compare)
{
throw new NotImplementedException ();
}
public override int GetHashCode ()
{
return base.GetHashCode();
}
internal AdapterListCollection (int count)
{
_count = count;
_index = -1;
}
}
}
| /*
* The MIT License (MIT)
*
* Copyright (c) 2013 Alistair Leslie-Hughes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Collections;
namespace Microsoft.DirectX.Direct3D
{
public sealed class AdapterListCollection : IEnumerable, IEnumerator
{
internal int _count;
internal int _index;
public AdapterInformation Default {
get => new AdapterInformation(0);
}
public AdapterInformation this [int index] {
get => new AdapterInformation(index);
}
public int Count {
get => _count;
}
public object Current {
get => new AdapterInformation(_index);
}
public void Reset ()
{
throw new NotImplementedException ();
}
public bool MoveNext ()
{
if (_index >= _count) return false;
_index++;
return true;
}
public IEnumerator GetEnumerator ()
{
return this;
}
public override bool Equals (object compare)
{
throw new NotImplementedException ();
}
public override int GetHashCode ()
{
return base.GetHashCode();
}
internal AdapterListCollection (int count)
{
_count = count;
_index = -1;
}
}
}
| mit | C# |
df614d75a385ee0b29713db6b7303f4980572a1c | Bump version | mhutch/MonoDevelop.AddinMaker,mhutch/MonoDevelop.AddinMaker | Properties/AddinInfo.cs | Properties/AddinInfo.cs | using System;
using Mono.Addins;
using Mono.Addins.Description;
[assembly:Addin (
"AddinMaker",
Namespace = "MonoDevelop",
Version = "1.3.0",
Url = "http://github.com/mhutch/MonoDevelop.AddinMaker"
)]
[assembly:AddinName ("Addin Maker")]
[assembly:AddinCategory ("Addin Development")]
[assembly:AddinDescription ("Makes it easy to create and edit addins")]
[assembly:AddinAuthor ("mhutch")]
| using System;
using Mono.Addins;
using Mono.Addins.Description;
[assembly:Addin (
"AddinMaker",
Namespace = "MonoDevelop",
Version = "1.2.1",
Url = "http://github.com/mhutch/MonoDevelop.AddinMaker"
)]
[assembly:AddinName ("Addin Maker")]
[assembly:AddinCategory ("Addin Development")]
[assembly:AddinDescription ("Makes it easy to create and edit addins")]
[assembly:AddinAuthor ("Michael Hutchinson")]
| mit | C# |
c8aca4092788e0ff9d52199ce49c43b8f3c69362 | Update CompositionRootSetup.cs | tiksn/TIKSN-Exchange | TIKSN.Exchange/CompositionRootSetup.cs | TIKSN.Exchange/CompositionRootSetup.cs | using Autofac;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using TIKSN.Data;
using TIKSN.Data.LiteDB;
using TIKSN.DependencyInjection;
using TIKSN.Finance.ForeignExchange;
using TIKSN.Finance.ForeignExchange.Data;
using TIKSN.Finance.ForeignExchange.Data.LiteDB;
namespace TIKSN.Exchange
{
public class CompositionRootSetup : AutofacCompositionRootSetupBase
{
public CompositionRootSetup(IConfigurationRoot configurationRoot) : base(configurationRoot)
{
}
protected override void ConfigureContainerBuilder(ContainerBuilder builder)
{
builder.RegisterType<ExchangeRateRepository>().As<IExchangeRateRepository>().InstancePerLifetimeScope();
builder.RegisterType<ForeignExchangeRepository>().As<IForeignExchangeRepository>().InstancePerLifetimeScope();
builder.RegisterType<DatabaseProvider>().As<ILiteDbDatabaseProvider>().SingleInstance();
builder.RegisterType<UnitOfWorkFactory>().As<IUnitOfWorkFactory>().InstancePerLifetimeScope();
builder.RegisterType<ExchangeRateService>().As<IExchangeRateService>().InstancePerLifetimeScope();
builder.RegisterType<TextLocalizer>().As<IStringLocalizer>().SingleInstance();
}
protected override void ConfigureOptions(IServiceCollection services, IConfigurationRoot configuration)
{
}
protected override void ConfigureServices(IServiceCollection services)
{
}
}
} | using Autofac;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using TIKSN.Data;
using TIKSN.Data.LiteDB;
using TIKSN.DependencyInjection;
using TIKSN.Exchange.Commands;
using TIKSN.Finance.ForeignExchange;
using TIKSN.Finance.ForeignExchange.Data;
using TIKSN.Finance.ForeignExchange.Data.LiteDB;
namespace TIKSN.Exchange
{
public class CompositionRootSetup : AutofacCompositionRootSetupBase
{
public CompositionRootSetup(IConfigurationRoot configurationRoot) : base(configurationRoot)
{
}
protected override void ConfigureContainerBuilder(ContainerBuilder builder)
{
builder.RegisterType<ExchangeRateRepository>().As<IExchangeRateRepository>().InstancePerLifetimeScope();
builder.RegisterType<ForeignExchangeRepository>().As<IForeignExchangeRepository>().InstancePerLifetimeScope();
builder.RegisterType<DatabaseProvider>().As<ILiteDbDatabaseProvider>().SingleInstance();
builder.RegisterType<UnitOfWorkFactory>().As<IUnitOfWorkFactory>().InstancePerLifetimeScope();
builder.RegisterType<ExchangeRateService>().As<IExchangeRateService>().InstancePerLifetimeScope();
builder.RegisterType<TextLocalizer>().As<IStringLocalizer>().SingleInstance();
}
protected override void ConfigureOptions(IServiceCollection services, IConfigurationRoot configuration)
{
}
protected override void ConfigureServices(IServiceCollection services)
{
}
}
} | mit | C# |
3312617532ff01be4ad5de2e59e280e17d704a03 | Change Columns static method to return IReadOnlyList. | bordoley/SQLitePCL.pretty,matrostik/SQLitePCL.pretty | SQLitePCL.pretty/ResultSet.cs | SQLitePCL.pretty/ResultSet.cs | /*
Copyright 2014 David Bordoley
Copyright 2014 Zumero, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
namespace SQLitePCL.pretty
{
public static class ResultSet
{
public static IReadOnlyList<IColumnInfo> Columns(this IReadOnlyList<IResultSetValue> rs)
{
Contract.Requires(rs != null);
return new ResultSetColumnsListImpl(rs);
}
internal sealed class ResultSetColumnsListImpl : IReadOnlyList<IColumnInfo>
{
private readonly IReadOnlyList<IResultSetValue> rs;
internal ResultSetColumnsListImpl(IReadOnlyList<IResultSetValue> rs)
{
this.rs = rs;
}
public IColumnInfo this[int index]
{
get
{
return rs[index].ColumnInfo;
}
}
public int Count
{
get
{
return rs.Count;
}
}
public IEnumerator<IColumnInfo> GetEnumerator()
{
return rs.Select(val => val.ColumnInfo).GetEnumerator();
}
IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
}
}
}
| /*
Copyright 2014 David Bordoley
Copyright 2014 Zumero, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
namespace SQLitePCL.pretty
{
public static class ResultSet
{
public static IEnumerable<IColumnInfo> Columns(this IReadOnlyList<IResultSetValue> rs)
{
Contract.Requires(rs != null);
return rs.Select(value => value.ColumnInfo);
}
}
}
| apache-2.0 | C# |
35026ad6428f35b100575cdd0653d4694bdca3e5 | Add missing `EditorClock` caching | ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu | osu.Game/Tests/Visual/SelectionBlueprintTestScene.cs | osu.Game/Tests/Visual/SelectionBlueprintTestScene.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 JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Screens.Edit;
namespace osu.Game.Tests.Visual
{
public abstract class SelectionBlueprintTestScene : OsuManualInputManagerTestScene
{
[Cached]
private readonly EditorClock editorClock = new EditorClock();
protected override Container<Drawable> Content => content ?? base.Content;
private readonly Container content;
protected SelectionBlueprintTestScene()
{
base.Content.Add(content = new Container
{
Clock = new FramedClock(new StopwatchClock()),
RelativeSizeAxes = Axes.Both
});
}
protected void AddBlueprint(HitObjectSelectionBlueprint blueprint, [CanBeNull] DrawableHitObject drawableObject = null)
{
Add(blueprint.With(d =>
{
d.DrawableObject = drawableObject;
d.Depth = float.MinValue;
d.Select();
}));
}
}
}
| // 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 JetBrains.Annotations;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Tests.Visual
{
public abstract class SelectionBlueprintTestScene : OsuManualInputManagerTestScene
{
protected override Container<Drawable> Content => content ?? base.Content;
private readonly Container content;
protected SelectionBlueprintTestScene()
{
base.Content.Add(content = new Container
{
Clock = new FramedClock(new StopwatchClock()),
RelativeSizeAxes = Axes.Both
});
}
protected void AddBlueprint(HitObjectSelectionBlueprint blueprint, [CanBeNull] DrawableHitObject drawableObject = null)
{
Add(blueprint.With(d =>
{
d.DrawableObject = drawableObject;
d.Depth = float.MinValue;
d.Select();
}));
}
}
}
| mit | C# |
cb3537d2d365c5b007ab346691e0bf49fb9d72ea | fix acc tests assumption (#162) | NServiceBusSqlPersistence/NServiceBus.SqlPersistence | src/AcceptanceTestsHolder/App_Packages/NSB.AcceptanceTests/EndpointTemplates/EndpointCustomizationConfigurationExtensions.cs | src/AcceptanceTestsHolder/App_Packages/NSB.AcceptanceTests/EndpointTemplates/EndpointCustomizationConfigurationExtensions.cs | namespace NServiceBus.AcceptanceTests.EndpointTemplates
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using AcceptanceTesting.Support;
using Hosting.Helpers;
public static class EndpointCustomizationConfigurationExtensions
{
public static IEnumerable<Type> GetTypesScopedByTestClass(this EndpointCustomizationConfiguration endpointConfiguration)
{
var assemblies = new AssemblyScanner().GetScannableAssemblies();
var assembliesToScan = assemblies.Assemblies
//exclude acceptance tests by default
.Where(a => a != Assembly.GetExecutingAssembly()).ToList();
var types = assembliesToScan
.SelectMany(a => a.GetTypes());
types = types.Union(GetNestedTypeRecursive(endpointConfiguration.BuilderType.DeclaringType, endpointConfiguration.BuilderType));
types = types.Union(endpointConfiguration.TypesToInclude);
return types.Where(t => !endpointConfiguration.TypesToExclude.Contains(t)).ToList();
}
static IEnumerable<Type> GetNestedTypeRecursive(Type rootType, Type builderType)
{
if (rootType == null)
{
throw new InvalidOperationException("Make sure you nest the endpoint infrastructure inside the TestFixture as nested classes");
}
yield return rootType;
if (typeof(IEndpointConfigurationFactory).IsAssignableFrom(rootType) && rootType != builderType)
{
yield break;
}
foreach (var nestedType in rootType.GetNestedTypes(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).SelectMany(t => GetNestedTypeRecursive(t, builderType)))
{
yield return nestedType;
}
}
}
} | namespace NServiceBus.AcceptanceTests.EndpointTemplates
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using AcceptanceTesting.Support;
using Hosting.Helpers;
public static class EndpointCustomizationConfigurationExtensions
{
public static IEnumerable<Type> GetTypesScopedByTestClass(this EndpointCustomizationConfiguration endpointConfiguration)
{
var assemblies = new AssemblyScanner().GetScannableAssemblies();
var types = assemblies.Assemblies
//exclude all test types by default
.Where(a =>
{
var references = a.GetReferencedAssemblies();
return references.All(an => an.Name != "nunit.framework");
})
.SelectMany(a => a.GetTypes());
types = types.Union(GetNestedTypeRecursive(endpointConfiguration.BuilderType.DeclaringType, endpointConfiguration.BuilderType));
types = types.Union(endpointConfiguration.TypesToInclude);
return types.Where(t => !endpointConfiguration.TypesToExclude.Contains(t)).ToList();
}
static IEnumerable<Type> GetNestedTypeRecursive(Type rootType, Type builderType)
{
if (rootType == null)
{
throw new InvalidOperationException("Make sure you nest the endpoint infrastructure inside the TestFixture as nested classes");
}
yield return rootType;
if (typeof(IEndpointConfigurationFactory).IsAssignableFrom(rootType) && rootType != builderType)
{
yield break;
}
foreach (var nestedType in rootType.GetNestedTypes(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).SelectMany(t => GetNestedTypeRecursive(t, builderType)))
{
yield return nestedType;
}
}
}
} | mit | C# |
262920e5f2e1ff3ed8721f373ec131988531adf7 | extend client | igeligel/csharp-steamgaug-es-api | SteamGaugesApi.Core/Client.cs | SteamGaugesApi.Core/Client.cs | using System.Net.Http;
using Newtonsoft.Json;
using SteamGaugesApi.Core.Models;
namespace SteamGaugesApi.Core
{
public class Client
{
private readonly HttpClient _httpClient;
public Client()
{
_httpClient = new HttpClient();
}
public Client(HttpClient httpClient)
{
_httpClient = httpClient;
}
public SteamGaugesResponse Get()
{
var responseContent = _httpClient.GetAsync("https://steamgaug.es/api/v2").Result
.Content.ReadAsStringAsync().Result;
return JsonConvert.DeserializeObject<SteamGaugesResponse>(responseContent);
}
}
}
| using System.Net.Http;
using Newtonsoft.Json;
using SteamGaugesApi.Core.Models;
namespace SteamGaugesApi.Core
{
public class Client
{
public SteamGaugesResponse Get()
{
var httpClient = new HttpClient();
var responseContent = httpClient.GetAsync("https://steamgaug.es/api/v2").Result
.Content.ReadAsStringAsync().Result;
return JsonConvert.DeserializeObject<SteamGaugesResponse>(responseContent);
}
}
}
| mit | C# |
4d1454c08a23cdc255105c5d9ec839277ab13920 | make the compiler happy? | versionone/OAuth2Client.Net,versionone/OAuth2Client.Net | ExampleMemberListCSharp/Program.cs | ExampleMemberListCSharp/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using OAuth2Client;
namespace ExampleMemberListCSharp
{
class Defaults
{
public static string Scope = "apiv1";
public static string EndpointUrl = "http://localhost/VersionOne.Web";
public static string ApiQuery = "/rest-1.oauth.v1/Data/Member?Accept=text/json";
}
static class WebClientExtensions
{
public static string DownloadStringOAuth2(this WebClient client, IStorage storage, string scope, string path)
{
var creds = storage.GetCredentials();
client.AddBearer(creds);
try
{
return client.DownloadString(path);
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
if (((HttpWebResponse)ex.Response).StatusCode != HttpStatusCode.Unauthorized)
throw;
var secrets = storage.GetSecrets();
var authclient = new AuthClient(secrets, scope);
var newcreds = authclient.refreshAuthCode(creds);
var storedcreds = storage.StoreCredentials(newcreds);
client.AddBearer(storedcreds);
return client.DownloadString(path);
}
throw;
}
}
}
class AsyncProgram
{
private static async Task<string> DoRequestAsync(string path)
{
var httpclient = HttpClientFactory.WithOAuth2<IWebProxy>("apiv1");
var response = await httpclient.GetAsync(Defaults.EndpointUrl + Defaults.ApiQuery);
var body = await response.Content.ReadAsStringAsync();
return body;
}
public static int MainAsync(string[] args)
{
var t = DoRequestAsync(Defaults.EndpointUrl + Defaults.ApiQuery);
Task.WaitAll(t);
Console.WriteLine(t.Result);
return 0;
}
}
class Program
{
static void Main(string[] args)
{
IStorage storage = Storage.JsonFileStorage.Default;
using (var webclient = new WebClient())
{
var body = webclient.DownloadStringOAuth2(storage, "apiv1", Defaults.EndpointUrl + Defaults.ApiQuery);
Console.WriteLine(body);
}
Console.ReadLine();
AsyncProgram.MainAsync(args);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using OAuth2Client;
namespace ExampleMemberListCSharp
{
class Defaults
{
public static string Scope = "apiv1";
public static string EndpointUrl = "http://localhost/VersionOne.Web";
public static string ApiQuery = "/rest-1.oauth.v1/Data/Member?Accept=text/json";
}
static class WebClientExtensions
{
public static string DownloadStringOAuth2(this WebClient client, IStorage storage, string scope, string path)
{
var creds = storage.GetCredentials();
client.AddBearer(creds);
try
{
return client.DownloadString(path);
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
if (((HttpWebResponse)ex.Response).StatusCode != HttpStatusCode.Unauthorized)
throw;
var secrets = storage.GetSecrets();
var authclient = new AuthClient(secrets, scope);
var newcreds = authclient.refreshAuthCode(creds);
var storedcreds = storage.StoreCredentials(newcreds);
client.AddBearer(storedcreds);
return client.DownloadString(path);
}
throw;
}
}
}
class AsyncProgram
{
private static async Task<string> DoRequestAsync(string path)
{
var httpclient = HttpClientFactory.WithOAuth2("apiv1");
var response = await httpclient.GetAsync(Defaults.EndpointUrl + Defaults.ApiQuery);
var body = await response.Content.ReadAsStringAsync();
return body;
}
public static int MainAsync(string[] args)
{
var t = DoRequestAsync(Defaults.EndpointUrl + Defaults.ApiQuery);
Task.WaitAll(t);
Console.WriteLine(t.Result);
return 0;
}
}
class Program
{
static void Main(string[] args)
{
IStorage storage = Storage.JsonFileStorage.Default;
using (var webclient = new WebClient())
{
var body = webclient.DownloadStringOAuth2(storage, "apiv1", Defaults.EndpointUrl + Defaults.ApiQuery);
Console.WriteLine(body);
}
Console.ReadLine();
AsyncProgram.MainAsync(args);
}
}
}
| bsd-3-clause | C# |
ea4dbc8c0f3ef669d86439a9b1a368c213d39a26 | Fix mania hold note head disappears | peppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu | osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs | osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
/// <summary>
/// The head of a <see cref="DrawableHoldNote"/>.
/// </summary>
public class DrawableHoldNoteHead : DrawableNote
{
protected override ManiaSkinComponents Component => ManiaSkinComponents.HoldNoteHead;
public DrawableHoldNoteHead()
: this(null)
{
}
public DrawableHoldNoteHead(HeadNote headNote)
: base(headNote)
{
Anchor = Anchor.TopCentre;
Origin = Anchor.TopCentre;
}
public bool UpdateResult() => base.UpdateResult(true);
protected override void UpdateHitStateTransforms(ArmedState state)
{
// suppress the base call explicitly.
// the hold note head should never change its visual state on its own due to the "freezing" mechanic
// (when hit, it remains visible in place at the judgement line; when dropped, it will scroll past the line).
// it will be hidden along with its parenting hold note when required.
// Set `LifetimeEnd` explicitly to a non-`double.MaxValue` because otherwise this DHO is automatically expired.
LifetimeEnd = double.PositiveInfinity;
}
public override bool OnPressed(KeyBindingPressEvent<ManiaAction> e) => false; // Handled by the hold note
public override void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
/// <summary>
/// The head of a <see cref="DrawableHoldNote"/>.
/// </summary>
public class DrawableHoldNoteHead : DrawableNote
{
protected override ManiaSkinComponents Component => ManiaSkinComponents.HoldNoteHead;
public DrawableHoldNoteHead()
: this(null)
{
}
public DrawableHoldNoteHead(HeadNote headNote)
: base(headNote)
{
Anchor = Anchor.TopCentre;
Origin = Anchor.TopCentre;
}
public bool UpdateResult() => base.UpdateResult(true);
protected override void UpdateHitStateTransforms(ArmedState state)
{
// suppress the base call explicitly.
// the hold note head should never change its visual state on its own due to the "freezing" mechanic
// (when hit, it remains visible in place at the judgement line; when dropped, it will scroll past the line).
// it will be hidden along with its parenting hold note when required.
}
public override bool OnPressed(KeyBindingPressEvent<ManiaAction> e) => false; // Handled by the hold note
public override void OnReleased(KeyBindingReleaseEvent<ManiaAction> e)
{
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.