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 |
---|---|---|---|---|---|---|---|---|
954fe6eaaaa9851246569db7a7e818b2fc3cf597
|
Correct filtering
|
dlidstrom/Snittlistan,dlidstrom/Snittlistan,dlidstrom/Snittlistan
|
Snittlistan.Web/Areas/V2/DocumentSessionExtensions.cs
|
Snittlistan.Web/Areas/V2/DocumentSessionExtensions.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Raven.Abstractions;
using Raven.Client;
using Snittlistan.Web.Areas.V2.Domain;
using Snittlistan.Web.Areas.V2.Indexes;
namespace Snittlistan.Web.Areas.V2
{
public static class DocumentSessionExtensions
{
public static List<SelectListItem> CreateRosterSelectList(this IDocumentSession session, int season, string rosterId = "")
{
return session.Query<Roster, RosterSearchTerms>()
.Where(x => x.Season == season)
.Where(x => x.Preliminary == false)
.Where(x => x.BitsMatchId != 0)
.Where(x => x.Date < SystemTime.UtcNow)
.OrderBy(x => x.Date)
.ToList()
.Where(x => x.MatchResultId == null || string.IsNullOrEmpty(rosterId) == false)
.Select(
x => new SelectListItem
{
Text = $"{x.Turn}: {x.Team} - {x.Opponent} ({x.Location} {x.Date.ToShortTimeString()})",
Value = x.Id,
Selected = x.Id == rosterId
})
.ToList();
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Raven.Client;
using Snittlistan.Web.Areas.V2.Indexes;
namespace Snittlistan.Web.Areas.V2
{
public static class DocumentSessionExtensions
{
public static List<SelectListItem> CreateRosterSelectList(this IDocumentSession session, int season, string rosterId = "")
{
return session.Query<RosterSearchTerms.Result, RosterSearchTerms>()
.Where(x => x.Season == season)
.Where(x => x.Preliminary == false)
.Where(x => x.PlayerCount > 0)
.Where(x => x.BitsMatchId != 0)
.OrderBy(x => x.Date)
.ProjectFromIndexFieldsInto<RosterSearchTerms.Result>()
.ToList()
.Where(x => x.MatchResultId == null || string.IsNullOrEmpty(rosterId) == false)
.Select(
x => new SelectListItem
{
Text = $"{x.Turn}: {x.Team} - {x.Opponent} ({x.Location} {x.Date.ToShortTimeString()})",
Value = x.Id,
Selected = x.Id == rosterId
})
.ToList();
}
}
}
|
mit
|
C#
|
6f66407a1e3041774f7324b8106cb801bf5489c1
|
Bump assembly version
|
kjac/FormEditor,kjac/FormEditor,kjac/FormEditor
|
Source/Solution/FormEditor/Properties/AssemblyInfo.cs
|
Source/Solution/FormEditor/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("FormEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Kenn Jacobsen")]
[assembly: AssemblyProduct("FormEditor")]
[assembly: AssemblyCopyright("Copyright © Kenn Jacobsen 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("39b39b20-7b79-4259-9f04-4c005534b053")]
// 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("0.13.1.1")]
[assembly: AssemblyFileVersion("0.13.1.1")]
|
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("FormEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Kenn Jacobsen")]
[assembly: AssemblyProduct("FormEditor")]
[assembly: AssemblyCopyright("Copyright © Kenn Jacobsen 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("39b39b20-7b79-4259-9f04-4c005534b053")]
// 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("0.12.1.1")]
[assembly: AssemblyFileVersion("0.12.1.1")]
|
mit
|
C#
|
9a2293ce3ef0a8fc20f6c7f52171e292b500b18b
|
Remove empty navigation list in anydiff module (invalid HTML).
|
netjunki/trac-Pygit2,walty8/trac,jun66j5/trac-ja,walty8/trac,netjunki/trac-Pygit2,netjunki/trac-Pygit2,walty8/trac,jun66j5/trac-ja,jun66j5/trac-ja,walty8/trac,jun66j5/trac-ja
|
templates/anydiff.cs
|
templates/anydiff.cs
|
<?cs include "header.cs"?>
<div id="ctxtnav" class="nav"></div>
<div id="content" class="changeset">
<div id="title">
<h1>Select Base and Target for Diff:</h1>
</div>
<div id="anydiff">
<form action="<?cs var:anydiff.changeset_href ?>" method="get">
<table>
<tr>
<th><label for="old_path">From:</label></th>
<td>
<input type="text" id="old_path" name="old_path" value="<?cs
var:anydiff.old_path ?>" size="44" />
<label for="old_rev">at Revision:</label>
<input type="text" id="old_rev" name="old" value="<?cs
var:anydiff.old_rev ?>" size="4" />
</td>
</tr>
<tr>
<th><label for="new_path">To:</label></th>
<td>
<input type="text" id="new_path" name="new_path" value="<?cs
var:anydiff.new_path ?>" size="44" />
<label for="new_rev">at Revision:</label>
<input type="text" id="new_rev" name="new" value="<?cs
var:anydiff.new_rev ?>" size="4" />
</td>
</tr>
</table>
<div class="buttons">
<input type="submit" value="View changes" />
</div>
</form>
</div>
<div id="help">
<strong>Note:</strong> See <a href="<?cs var:trac.href.wiki
?>/TracChangeset#ExaminingArbitraryDifferences">TracChangeset</a> for help on using the arbitrary diff feature.
</div>
</div>
<?cs include "footer.cs"?>
|
<?cs include "header.cs"?>
<div id="ctxtnav" class="nav">
<h2>Navigation</h2><?cs
with:links = chrome.links ?>
<ul>
</ul><?cs
/with ?>
</div>
<div id="content" class="changeset">
<div id="title">
<h1>Select Base and Target for Diff:</h1>
</div>
<div id="anydiff">
<form action="<?cs var:anydiff.changeset_href ?>" method="get">
<table>
<tr>
<th><label for="old_path">From:</label></th>
<td>
<input type="text" id="old_path" name="old_path" value="<?cs
var:anydiff.old_path ?>" size="44" />
<label for="old_rev">at Revision:</label>
<input type="text" id="old_rev" name="old" value="<?cs
var:anydiff.old_rev ?>" size="4" />
</td>
</tr>
<tr>
<th><label for="new_path">To:</label></th>
<td>
<input type="text" id="new_path" name="new_path" value="<?cs
var:anydiff.new_path ?>" size="44" />
<label for="new_rev">at Revision:</label>
<input type="text" id="new_rev" name="new" value="<?cs
var:anydiff.new_rev ?>" size="4" />
</td>
</tr>
</table>
<div class="buttons">
<input type="submit" value="View changes" />
</div>
</form>
</div>
<div id="help">
<strong>Note:</strong> See <a href="<?cs var:trac.href.wiki
?>/TracChangeset#ExaminingArbitraryDifferences">TracChangeset</a> for help on using the arbitrary diff feature.
</div>
</div>
<?cs include "footer.cs"?>
|
bsd-3-clause
|
C#
|
7693e9ac0b4cf12ab1f2083b17ebca502841a770
|
Kill hard tabs
|
NatalieWolfe/BaseBuilder
|
Assets/Scripts/Managers/UnionManager.cs
|
Assets/Scripts/Managers/UnionManager.cs
|
using UnityEngine;
using System.Collections;
public class UnionManager : MonoBehaviour {
public static UnionManager instance;
public GameObject workerPrefab;
void Start () {
if (instance != null && instance != this) {
Destroy(this);
return;
}
instance = this;
GameManager.Game.union.RegisterOnWorkerEvent(OnWorkerEvent);
// FIXME: This is just for debugging!
GameManager.Game.union.CreateWorker();
}
private void OnWorkerEvent(Events.WorkerEvent e) {
if (e.workerEventType == Events.WorkerEventType.WorkerCreated) {
GameObject worker = (GameObject)Instantiate(workerPrefab);
worker.transform.parent = transform;
WorkerController controller = worker.GetComponent<WorkerController>();
if (controller == null) {
Debug.LogError("Worker prefab does not contain worker controller!");
Destroy(worker);
}
controller.worker = e.worker;
}
else if (e.workerEventType == Events.WorkerEventType.WorkerDestroyed) {
// TODO: Destroy game object when worker destroyed.
// TODO: Death animations?
}
}
}
|
using UnityEngine;
using System.Collections;
public class UnionManager : MonoBehaviour {
public static UnionManager instance;
public GameObject workerPrefab;
void Start () {
if (instance != null && instance != this) {
Destroy(this);
return;
}
instance = this;
GameManager.Game.union.RegisterOnWorkerEvent(OnWorkerEvent);
// FIXME: This is just for debugging!
GameManager.Game.union.CreateWorker();
}
private void OnWorkerEvent(Events.WorkerEvent e) {
if (e.workerEventType == Events.WorkerEventType.WorkerCreated) {
GameObject worker = (GameObject)Instantiate(workerPrefab);
worker.transform.parent = transform;
WorkerController controller = worker.GetComponent<WorkerController>();
if (controller == null) {
Debug.LogError("Worker prefab does not contain worker controller!");
Destroy(worker);
}
controller.worker = e.worker;
}
else if (e.workerEventType == Events.WorkerEventType.WorkerDestroyed) {
// TODO: Destroy game object when worker destroyed.
// TODO: Death animations?
}
}
}
|
mit
|
C#
|
35147f6309f0aa6e5895fb69e47df039c4766bcc
|
Update ILineDisassembler.cs
|
informedcitizenry/6502.Net
|
6502.Net/ILineDisassembler.cs
|
6502.Net/ILineDisassembler.cs
|
//-----------------------------------------------------------------------------
// Copyright (c) 2017 Nate Burnett <informedcitizenry@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace Asm6502.Net
{
/// <summary>
/// Represents an interface for a line disassembler.
/// </summary>
public interface ILineDisassembler
{
/// <summary>
/// Disassemble a line of 6502 source.
/// </summary>
/// <param name="line">The SourceLine.</param>
/// <returns>A string representation of the source.</returns>
string DisassembleLine(SourceLine line);
/// <summary>
/// Disassemble a line of 6502 source to a supplied
/// System.Text.StringBuilder.
/// </summary>
/// <param name="line">The SourceLine to disassemble.</param>
/// <param name="sb">A System.Text.StringBuilder to output disassembly.</param>
void DisassembleLine(SourceLine line, StringBuilder sb);
/// <summary>
/// Gets a flag indicating if printing is on.
/// </summary>
bool PrintingOn { get; }
}
}
|
//-----------------------------------------------------------------------------
// Copyright (c) 2017 Nate Burnett <informedcitizenry@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace Asm6502.Net
{
/// <summary>
/// Represents an interface for a line disassembler.
/// </summary>
public interface ILineDisassembler
{
/// <summary>
/// Disassemble a line of 6502 source.
/// </summary>
/// <param name="line">The SourceLine.</param>
/// <returns>A string representation of the source.</returns>
string DisassembleLine(SourceLine line);
/// <summary>
/// Disassemble a line of 6502 source to a supplied
/// System.Text.StringBuilder.
/// </summary>
/// <param name="line">The SourceLine to disassemble.</param>
/// <param name="sb">A System.Text.StringBuilder to output disassembly.</param>
void DisassembleLine(SourceLine line, StringBuilder sb);
/// <summary>
/// Gets a flag indicating if printing is on.
/// </summary>
bool PrintingOn { get; }
/// <summary>
/// Gets or sets the set of directives to skip if
/// verbose option is not set.
/// </summary>
HashSet<string> SkipOnVerbose { get; set; }
}
}
|
mit
|
C#
|
a2056273b4478cbe33306c7121b323afff92b382
|
Add constructor for CyclesLight.
|
mcneel/RhinoCycles
|
CyclesLight.cs
|
CyclesLight.cs
|
/**
Copyright 2014-2017 Robert McNeel and Associates
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 ccl;
using Light = Rhino.Render.ChangeQueue.Light;
namespace RhinoCyclesCore
{
/// <summary>
/// Intermediate class used for converting rhino light sources
/// to Cycles light sources.
/// </summary>
public class CyclesLight
{
public CyclesLight()
{
Co = new float4(0.0f);
Dir = new float4(0.0f);
AxisU = new float4(0.0f);
AxisV = new float4(0.0f);
DiffuseColor = new float4(0.0f);
Id = Guid.Empty;
}
public Light.Event Event { get; set; }
public LightType Type { get; set; }
/// <summary>
/// Location of light in world
/// </summary>
public float4 Co { get; set; }
/// <summary>
/// Direction of light (ignored for point light)
/// </summary>
public float4 Dir { get; set; }
/// <summary>
/// Size of soft-shadow. Higher values give softer shadows, lower values
/// sharper shadows.
///
/// Note that lower values will contribute to fireflies.
/// </summary>
public float Size { get; set; }
public float SizeU { get; set; }
public float SizeV { get; set; }
public float4 AxisU { get; set; }
public float4 AxisV { get; set; }
public float SpotAngle { get; set; }
public float SpotSmooth { get; set; }
/// <summary>
/// Color of the light
/// </summary>
public float4 DiffuseColor { get; set; }
/// <summary>
/// Intensity of the light. This is generally
/// between 0.0f and 1.0f, but can be higher
/// </summary>
public float Strength { get; set; }
/// <summary>
/// Set to true if light source should cast shadows
/// </summary>
public bool CastShadow { get; set; }
/// <summary>
/// Set to true if multiple importance sampling is to
/// be used for this light
/// </summary>
public bool UseMis { get; set; }
/// <summary>
/// Light ID set to the RhinoObject Id it represents
/// </summary>
public Guid Id { get; set; }
public float Gamma { get; set; }
}
}
|
/**
Copyright 2014-2017 Robert McNeel and Associates
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 ccl;
using Light = Rhino.Render.ChangeQueue.Light;
namespace RhinoCyclesCore
{
/// <summary>
/// Intermediate class used for converting rhino light sources
/// to Cycles light sources.
/// </summary>
public class CyclesLight
{
public Light.Event Event { get; set; }
public LightType Type { get; set; }
/// <summary>
/// Location of light in world
/// </summary>
public float4 Co { get; set; }
/// <summary>
/// Direction of light (ignored for point light)
/// </summary>
public float4 Dir { get; set; }
/// <summary>
/// Size of soft-shadow. Higher values give softer shadows, lower values
/// sharper shadows.
///
/// Note that lower values will contribute to fireflies.
/// </summary>
public float Size { get; set; }
public float SizeU { get; set; }
public float SizeV { get; set; }
public float4 AxisU { get; set; }
public float4 AxisV { get; set; }
public float SpotAngle { get; set; }
public float SpotSmooth { get; set; }
/// <summary>
/// Color of the light
/// </summary>
public float4 DiffuseColor { get; set; }
/// <summary>
/// Intensity of the light. This is generally
/// between 0.0f and 1.0f, but can be higher
/// </summary>
public float Strength { get; set; }
/// <summary>
/// Set to true if light source should cast shadows
/// </summary>
public bool CastShadow { get; set; }
/// <summary>
/// Set to true if multiple importance sampling is to
/// be used for this light
/// </summary>
public bool UseMis { get; set; }
/// <summary>
/// Light ID set to the RhinoObject Id it represents
/// </summary>
public Guid Id { get; set; }
public float Gamma { get; set; }
}
}
|
apache-2.0
|
C#
|
b584769fff83ca37fb9292cbfff0097b258f473e
|
test SerializeNetworkView
|
brosnandevera/Unity-Local-Network-Client-Finder
|
Assets/CubeMover.cs
|
Assets/CubeMover.cs
|
using UnityEngine;
using System.Collections;
public class CubeMover : MonoBehaviour {
// Use this for initialization
public int testVal = 0;
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.A))
{
Debug.Log("Move Left");
transform.position = new Vector3(transform.position.x - 0.05f, transform.position.y, transform.position.z);
}
if (Input.GetKey(KeyCode.D))
{
Debug.Log("Move Right");
transform.position = new Vector3(transform.position.x + 0.05f, transform.position.y, transform.position.z);
}
}
public void OnSerializeNetworkView(NetworkMessageInfo info, BitStream stream)
{
if (stream.isWriting)
{
float val = testVal;
stream.Serialize(ref val);
}
else
{
//reading
float val2 = 0;
stream.Serialize(ref val2);
Debug.Log("Lol "+ testVal);
}
}
}
|
using UnityEngine;
using System.Collections;
public class CubeMover : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.A))
{
Debug.Log("Move Left");
transform.position = new Vector3(transform.position.x - 0.05f, transform.position.y, transform.position.z);
}
if (Input.GetKey(KeyCode.D))
{
Debug.Log("Move Left");
transform.position = new Vector3(transform.position.x + 0.05f, transform.position.y, transform.position.z);
}
}
}
|
mit
|
C#
|
aa88434e8d2ae260024cc7bee550ce67a3366e5a
|
Update unit test
|
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
|
src/Arkivverket.Arkade.Test/Core/Addml/Processes/ControlNotNullTest.cs
|
src/Arkivverket.Arkade.Test/Core/Addml/Processes/ControlNotNullTest.cs
|
using System.Collections.Generic;
using Arkivverket.Arkade.Core;
using Arkivverket.Arkade.Core.Addml;
using Arkivverket.Arkade.Core.Addml.Definitions;
using Arkivverket.Arkade.Core.Addml.Definitions.DataTypes;
using Arkivverket.Arkade.Core.Addml.Processes;
using Arkivverket.Arkade.Test.Core.Addml.Builders;
using FluentAssertions;
using Xunit;
namespace Arkivverket.Arkade.Test.Core.Addml.Processes
{
public class ControlNotNullTest
{
[Fact]
public void ShouldReportNullValues()
{
List<string> nullValues = new List<string>
{
"null"
};
AddmlFieldDefinition fieldDefinition1 = new AddmlFieldDefinitionBuilder()
.WithDataType(new StringDataType(null, nullValues))
.Build();
AddmlFieldDefinition fieldDefinition2 = new AddmlFieldDefinitionBuilder()
.WithDataType(new StringDataType(null, nullValues))
.Build();
FlatFile flatFile = new FlatFile(fieldDefinition1.GetAddmlFlatFileDefinition());
ControlNotNull test = new ControlNotNull();
test.Run(flatFile);
test.Run(new Field(fieldDefinition1, "A"));
test.Run(new Field(fieldDefinition1, "null"));
test.Run(new Field(fieldDefinition1, "B"));
test.Run(new Field(fieldDefinition1, "C"));
test.Run(new Field(fieldDefinition2, "A"));
test.Run(new Field(fieldDefinition2, "B"));
test.Run(new Field(fieldDefinition2, "C"));
test.EndOfFile();
TestRun testRun = test.GetTestRun();
testRun.IsSuccess().Should().BeFalse();
testRun.Results.Count.Should().Be(1);
testRun.Results[0].Location.ToString().Should().Be(fieldDefinition1.GetIndex().ToString());
testRun.Results[0].Message.Should().Be("NULL-verdier finnes");
}
}
}
|
using System.Collections.Generic;
using Arkivverket.Arkade.Core;
using Arkivverket.Arkade.Core.Addml;
using Arkivverket.Arkade.Core.Addml.Definitions;
using Arkivverket.Arkade.Core.Addml.Definitions.DataTypes;
using Arkivverket.Arkade.Core.Addml.Processes;
using Arkivverket.Arkade.Test.Core.Addml.Builders;
using FluentAssertions;
using Xunit;
namespace Arkivverket.Arkade.Test.Core.Addml.Processes
{
public class ControlNotNullTest
{
[Fact]
public void ShouldReportNullValues()
{
List<string> nullValues = new List<string>
{
"null"
};
AddmlFieldDefinition fieldDefinition1 = new AddmlFieldDefinitionBuilder()
.WithDataType(new StringDataType(null, nullValues))
.Build();
AddmlFieldDefinition fieldDefinition2 = new AddmlFieldDefinitionBuilder()
.WithDataType(new StringDataType(null, nullValues))
.Build();
FlatFile flatFile = new FlatFile(fieldDefinition1.GetAddmlFlatFileDefinition());
ControlNotNull test = new ControlNotNull();
test.Run(flatFile);
test.Run(new Field(fieldDefinition1, "A"));
test.Run(new Field(fieldDefinition1, "null"));
test.Run(new Field(fieldDefinition1, "B"));
test.Run(new Field(fieldDefinition1, "C"));
test.Run(new Field(fieldDefinition2, "A"));
test.Run(new Field(fieldDefinition2, "B"));
test.Run(new Field(fieldDefinition2, "C"));
test.EndOfFile();
TestRun testRun = test.GetTestRun();
testRun.IsSuccess().Should().BeTrue();
testRun.Results.Count.Should().Be(1);
testRun.Results[0].Location.ToString().Should().Be(fieldDefinition1.GetIndex().ToString());
testRun.Results[0].Message.Should().Be("NULL-verdier finnes");
}
}
}
|
agpl-3.0
|
C#
|
acfacdd029139c2ea638b007276faffe3a781b1b
|
Fix running link
|
gep13/gep13,gep13/gep13,gep13/gep13,gep13/gep13
|
input/about.cshtml
|
input/about.cshtml
|
Title: About
Image: images/water.jpg
---
<p>My name is Gary Ewan Park and I work as a Senior Software Systems Engineer up here in Aberdeen. If you want to get in touch with me, there are a number of social networking sites linked on the left hand side of this site, as well as a <a href="http://www.gep13.co.uk/contact/">contact form</a>.</p>
<p>I first started coding at University, (well, I say coding but, what I mean of course is <a href="http://www.mathworks.co.uk/">MATLAB</a>), and at my first job I started using the wonderful VB6. As time progressed, I moved onto VB.Net in Visual Studio 2003, and when I started using Visual Studio 2005 I made the switch to using C#. This wasn’t because I didn’t “like” VB.Net, but as I started getting into Web Forms Development, I started seeing a lot of similarities in syntax between C# and JavaScript, and to me, it seemed to make more sense to use C#. Now, I am happy to converse in either VB.Net or C#. However, as I am always saying, it doesn't matter about the syntax of the language, it is an understanding of the Framework, and what it is you are trying to achieve, that is the important thing.</p>
<p>I graduated from the University of Aberdeen with a First Class Honours Degree in Electrical and Electronic Engineering. Looking back at the career that I have had, it strikes me that a Computer Science Degree might have served me better. On the other hand though, I do think it helps to be able to know about the hardware side of things, so that you can know what the software is trying to control.</p>
<p>Today sees me developing using SharePoint, Silverlight, and ASP.Net, but I am starting to do more client side development work using systems link AngularJS. In addition to coding, I love automating things. Especially around automated deployment of code, as well as infrastructure. Automate all the things!</p>
<p>For my sins, I am a self-confessed Microsoft Fan Boy. I don’t know what else to say other than I think that the .Net Framework is a great platform to build on, and I really can’t get enough of it. I am a certified Microsoft Developer, (you can see my certifications <a href="https://www.mcpvirtualbusinesscard.com/VBCServer/gep13/profile">here</a>) and I am more than happy to talk at length about anything geek related, so if you have any questions, feel free to get in touch.</p>
<p>Outside of work I like to play 5-a-side football and golf, and I have also started <a href="http://smashrun.com/gep13/invite">running</a> on a regular basis. I have it in my head that I would like to be able to do a half marathon. Still a long way to go before being ready for that though! I used to be an archer at University as well, but since graduating I haven’t done any. This is something that I would like to get back into though.</p>
<p>I have profiles scattered around the web at the following sites:</p>
@Html.Partial("_SocialLinks")
|
Title: About
Image: images/water.jpg
---
<p>My name is Gary Ewan Park and I work as a Senior Software Systems Engineer up here in Aberdeen. If you want to get in touch with me, there are a number of social networking sites linked on the left hand side of this site, as well as a <a href="http://www.gep13.co.uk/contact/">contact form</a>.</p>
<p>I first started coding at University, (well, I say coding but, what I mean of course is <a href="http://www.mathworks.co.uk/">MATLAB</a>), and at my first job I started using the wonderful VB6. As time progressed, I moved onto VB.Net in Visual Studio 2003, and when I started using Visual Studio 2005 I made the switch to using C#. This wasn’t because I didn’t “like” VB.Net, but as I started getting into Web Forms Development, I started seeing a lot of similarities in syntax between C# and JavaScript, and to me, it seemed to make more sense to use C#. Now, I am happy to converse in either VB.Net or C#. However, as I am always saying, it doesn't matter about the syntax of the language, it is an understanding of the Framework, and what it is you are trying to achieve, that is the important thing.</p>
<p>I graduated from the University of Aberdeen with a First Class Honours Degree in Electrical and Electronic Engineering. Looking back at the career that I have had, it strikes me that a Computer Science Degree might have served me better. On the other hand though, I do think it helps to be able to know about the hardware side of things, so that you can know what the software is trying to control.</p>
<p>Today sees me developing using SharePoint, Silverlight, and ASP.Net, but I am starting to do more client side development work using systems link AngularJS. In addition to coding, I love automating things. Especially around automated deployment of code, as well as infrastructure. Automate all the things!</p>
<p>For my sins, I am a self-confessed Microsoft Fan Boy. I don’t know what else to say other than I think that the .Net Framework is a great platform to build on, and I really can’t get enough of it. I am a certified Microsoft Developer, (you can see my certifications <a href="https://www.mcpvirtualbusinesscard.com/VBCServer/gep13/profile">here</a>) and I am more than happy to talk at length about anything geek related, so if you have any questions, feel free to get in touch.</p>
<p>Outside of work I like to play 5-a-side football and golf, and I have also started [running](http://smashrun.com/gep13/invite) on a regular basis. I have it in my head that I would like to be able to do a half marathon. Still a long way to go before being ready for that though! I used to be an archer at University as well, but since graduating I haven’t done any. This is something that I would like to get back into though.</p>
<p>I have profiles scattered around the web at the following sites:</p>
@Html.Partial("_SocialLinks")
|
mit
|
C#
|
9b547cfde0f546df8abeebf47ec36f36d7bd91ef
|
Bump version to 1.6.1.0 after fixing #18
|
logonmy/inotify-win,McBen/inotify-win
|
src/AssemblyInfo.cs
|
src/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("https://github.com/thekid/inotify-win")]
[assembly: AssemblyDescription("A port of the inotifywait tool for Windows")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Timm Friebe")]
[assembly: AssemblyProduct("inotify-win")]
[assembly: AssemblyCopyright("Copyright © 2012 - 2015 Timm Friebe")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.6.1.0")]
[assembly: ComVisible(false)]
[assembly: Guid("4254314b-ae21-4e2f-ba52-d6f3d83a86b5")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("https://github.com/thekid/inotify-win")]
[assembly: AssemblyDescription("A port of the inotifywait tool for Windows")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Timm Friebe")]
[assembly: AssemblyProduct("inotify-win")]
[assembly: AssemblyCopyright("Copyright © 2012 - 2015 Timm Friebe")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.6.0.0")]
[assembly: ComVisible(false)]
[assembly: Guid("4254314b-ae21-4e2f-ba52-d6f3d83a86b5")]
|
bsd-3-clause
|
C#
|
b43857a149128b11f73b0a72a26497468592fe66
|
Remove not used using statements
|
mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype
|
src/Glimpse.Agent.Connection.Http/Broker/RemoteHttpMessagePublisher.cs
|
src/Glimpse.Agent.Connection.Http/Broker/RemoteHttpMessagePublisher.cs
|
using System;
using System.Net.Http;
namespace Glimpse.Agent
{
public class RemoteHttpMessagePublisher : IMessagePublisher, IDisposable
{
private readonly HttpClient _httpClient;
private readonly HttpClientHandler _httpHandler;
public RemoteHttpMessagePublisher()
{
_httpHandler = new HttpClientHandler();
_httpClient = new HttpClient(_httpHandler);
}
public void PublishMessage(IMessage message)
{
var content = new StringContent("Hello");
// TODO: Try shifting to async and await
// TODO: Find out what happened to System.Net.Http.Formmating - PostAsJsonAsync
_httpClient.PostAsJsonAsync("http://localhost:15999/Glimpse/Agent", message)
.ContinueWith(requestTask =>
{
// Get HTTP response from completed task.
HttpResponseMessage response = requestTask.Result;
// Check that response was successful or throw exception
response.EnsureSuccessStatusCode();
// Read response asynchronously as JsonValue and write out top facts for each country
var result = response.Content.ReadAsStringAsync().Result;
});
}
public void Dispose()
{
_httpClient.Dispose();
_httpHandler.Dispose();
}
}
}
|
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace Glimpse.Agent
{
public class RemoteHttpMessagePublisher : IMessagePublisher, IDisposable
{
private readonly HttpClient _httpClient;
private readonly HttpClientHandler _httpHandler;
public RemoteHttpMessagePublisher()
{
_httpHandler = new HttpClientHandler();
_httpClient = new HttpClient(_httpHandler);
}
public void PublishMessage(IMessage message)
{
var content = new StringContent("Hello");
// TODO: Try shifting to async and await
// TODO: Find out what happened to System.Net.Http.Formmating - PostAsJsonAsync
_httpClient.PostAsJsonAsync("http://localhost:15999/Glimpse/Agent", message)
.ContinueWith(requestTask =>
{
// Get HTTP response from completed task.
HttpResponseMessage response = requestTask.Result;
// Check that response was successful or throw exception
response.EnsureSuccessStatusCode();
// Read response asynchronously as JsonValue and write out top facts for each country
var result = response.Content.ReadAsStringAsync().Result;
});
}
public void Dispose()
{
_httpClient.Dispose();
_httpHandler.Dispose();
}
}
}
|
mit
|
C#
|
32b1caae5e96035b7adf480cfe02eb8cc2a458b7
|
Fix build
|
CatenaLogic/RepositoryCleaner
|
src/RepositoryCleaner/Services/Extensions/ICleanerServiceExtensions.cs
|
src/RepositoryCleaner/Services/Extensions/ICleanerServiceExtensions.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ICleanerServiceExtensions.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2015 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace RepositoryCleaner.Services
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Catel;
using Catel.Data;
using Catel.Logging;
using Catel.Threading;
using Models;
internal static class ICleanerServiceExtensions
{
private static readonly ILog Log = LogManager.GetCurrentClassLogger();
public static async Task CleanAsync(this ICleanerService cleanerService, IEnumerable<Repository> repositories, bool isFakeClean, Action completedCallback = null)
{
Argument.IsNotNull(nameof(cleanerService), cleanerService);
var cleanedUpRepositories = new List<Repository>();
var repositoriesToCleanUp = (from repository in repositories
where repository.IsIncluded
select repository).ToList();
Log.Info("Cleaning up '{0}' repositories", repositoriesToCleanUp.Count);
foreach (var repository in repositoriesToCleanUp)
{
// Note: we can also do them all async (don't await), but the disk is probably the bottleneck anyway
await Task.Factory.StartNew(() => cleanerService.Clean(repository, isFakeClean));
cleanedUpRepositories.Add(repository);
if (completedCallback != null)
{
completedCallback();
}
}
Log.Info("Cleaned up '{0}' repositories", cleanedUpRepositories.Count);
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ICleanerServiceExtensions.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2015 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace RepositoryCleaner.Services
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Catel;
using Catel.Data;
using Catel.Logging;
using Catel.Threading;
using Models;
internal static class ICleanerServiceExtensions
{
private static readonly ILog Log = LogManager.GetCurrentClassLogger();
public static IEnumerable<Repository> GetCleanableRepositories(this ICleanerService cleanerService, params Repository[] repositories)
{
Argument.IsNotNull(() => cleanerService);
var cleanableRepositories = new List<Repository>();
foreach (var repository in repositories)
{
if (cleanerService.CanClean(repository))
{
cleanableRepositories.Add(repository);
}
}
return cleanableRepositories;
}
public static async Task<IEnumerable<Repository>> GetCleanableRepositoriesAsync(this ICleanerService cleanerService, params Repository[] repositories)
{
Argument.IsNotNull(() => cleanerService);
return await Task.Factory.StartNew(() => GetCleanableRepositories(cleanerService, repositories));
}
public static async Task<bool> CanCleanAsync(this ICleanerService cleanerService, Repository repository)
{
Argument.IsNotNull(() => cleanerService);
return await Task.Factory.StartNew(() => cleanerService.CanClean(repository));
}
public static async Task CleanAsync(this ICleanerService cleanerService, IEnumerable<Repository> repositories, bool isFakeClean, Action completedCallback = null)
{
Argument.IsNotNull(() => cleanerService);
var cleanedUpRepositories = new List<Repository>();
var repositoriesToCleanUp = (from repository in repositories
where repository.IsIncluded
select repository).ToList();
Log.Info("Cleaning up '{0}' repositories", repositoriesToCleanUp.Count);
foreach (var repository in repositoriesToCleanUp)
{
// Note: we can also do them all async (don't await), but the disk is probably the bottleneck anyway
await Task.Factory.StartNew(() => cleanerService.Clean(repository, isFakeClean));
cleanedUpRepositories.Add(repository);
if (completedCallback != null)
{
completedCallback();
}
}
Log.Info("Cleaned up '{0}' repositories", cleanedUpRepositories.Count);
}
}
}
|
mit
|
C#
|
2f65ccc297d1da12109ce2e6a85da3a9e673c3f3
|
Update PetEnPlugin.cs
|
krbysh/FFXIV-ACT-OverlayPlugin-Plugins
|
PetEnPlugin.cs
|
PetEnPlugin.cs
|
using Advanced_Combat_Tracker;
using System;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
// Advanced Combat Tracker - mini parse window用Plugin
// NameEn: 日本語クライアント利用時に、キャラクター名(ペット含む)を英語で出力
[assembly: AssemblyTitle("Mini Parse Pets' Name in English")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ACTv3Plugins
{
public class NameEnPlugin : IActPluginV1
{
Label statusLabel;
private string[,] Pet = {
{"フェアリー・エオス","Eos"},{"フェアリー・セレネ","Selene"},{"イフリート・エギ","Ifrit-Egi"},{"ガルーダ・エギ","Garuda-Egi"},{"タイタン・エギ","Titan-Egi"},
{"カーバンクル・エメラルド","Emerald"},{"カーバンクル・トパーズ","Topaz"},
};
private bool isOneByteChar(string str)
{
byte [] byte_data = System.Text.Encoding.GetEncoding(932).GetBytes(str);
if (byte_data.Length == str.Length) {
return true;
}else{
return false;
}
}
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
{
statusLabel = pluginStatusText;
CombatantData.ExportVariables.Add(
"NameEn",
new CombatantData.TextExportFormatter("NameEn", "Name En", "name in english", (data, extra) => {
string name = data.GetColumnByName("Name");
if(!(isOneByteChar(name))){
for( int i=0;i<Pet.Length-1;i++ ){
if(name.Contains(Pet[i,0])) return name.Replace(Pet[i,0],Pet[i,1]);
}
}
return name;
}));
ActGlobals.oFormActMain.ValidateLists();
statusLabel.Text = "Initialized.";
}
public void DeInitPlugin()
{
CombatantData.ExportVariables.Remove("NameEn");
statusLabel.Text = "Deinitialized";
}
}
}
|
using Advanced_Combat_Tracker;
using System;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
// Advanced Combat Tracker - mini parse window用Plugin
// NameEn: 日本語クライアント利用時に、キャラクター名(ペット含む)を英語で出力
[assembly: AssemblyTitle("Mini Parse Pets' Name in English")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ACTv3Plugins
{
public class NameEnPlugin : IActPluginV1
{
Label statusLabel;
private string[,] Pet = {
{"フェアリー・エオス","Eos"},{"フェアリー・セレネ","Selene"},{"イフリート・エギ","Ifrit-Egi"},{"ガルーダ・エギ","Garuda-Egi"},{"タイタン・エギ","Titan-Egi"},
{"カーバンクル・エメラルド","Emerald"},{"カーバンクル・トパーズ","Topaz"},
};
private bool isOneByteChar(string str)
{
byte [] byte_data = System.Text.Encoding.GetEncoding(932).GetBytes(str);
if (byte_data.Length == str.Length) {
return true;
}else{
return false;
}
}
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
{
statusLabel = pluginStatusText;
CombatantData.ExportVariables.Add(
"NameEn",
new CombatantData.TextExportFormatter("NameEn", "Name En", "name in english", (data, extra) => {
string name = data.GetColumnByName("Name");
if(!(isOneByteChar(name))){
for( int i=0;i<Pet.Length-1;i++ ){
if(name.Contains(Pet[i,0])) return name.Replace(Pet[i,0],Pet[i,1]);
}
}
return name;
}));
ActGlobals.oFormActMain.ValidateLists();
statusLabel.Text = "Initialized.";
}
public void DeInitPlugin()
{
CombatantData.ExportVariables.Remove("NameEn");
statusLabel.Text = "Deinitialized";
}
}
}
|
mit
|
C#
|
615500bf9ad9d021b6f4e0ce8f4c2bc5ce400a65
|
change the title of the main index page
|
wimplash/GenscapeHackathon-2015,wimplash/GenscapeHackathon-2015,wimplash/GenscapeHackathon-2015,wimplash/GenscapeHackathon-2015,wimplash/GenscapeHackathon-2015
|
java-janitor/JavaJanitor/Views/Home/Index.cshtml
|
java-janitor/JavaJanitor/Views/Home/Index.cshtml
|
<div class="jumbotron">
<h1>WHERE'S THE JOE!?</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>ASP.NET Web API is a framework that makes it easy to build HTTP services that reach
a broad range of clients, including browsers and mobile devices. ASP.NET Web API
is an ideal platform for building RESTful applications on the .NET Framework.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301870">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301871">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301872">Learn more »</a></p>
</div>
</div>
|
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>ASP.NET Web API is a framework that makes it easy to build HTTP services that reach
a broad range of clients, including browsers and mobile devices. ASP.NET Web API
is an ideal platform for building RESTful applications on the .NET Framework.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301870">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301871">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301872">Learn more »</a></p>
</div>
</div>
|
mit
|
C#
|
dee3636469cb2c74b534a855ab798f6d20b7b0c7
|
Add CaseInsensitiveType (None, lower, UPPER)
|
KvanTTT/DAGE,KvanTTT/DAGE,KvanTTT/DAGE,KvanTTT/DAGE,KvanTTT/DAGE,KvanTTT/DAGE,KvanTTT/DAGE
|
AntlrGrammarEditor/Grammar.cs
|
AntlrGrammarEditor/Grammar.cs
|
using System.Collections.Generic;
namespace AntlrGrammarEditor
{
public enum CaseInsensitiveType
{
None,
lower,
UPPER
}
public class Grammar
{
public const string AntlrDotExt = ".g4";
public const string LexerPostfix = "Lexer";
public const string ParserPostfix = "Parser";
public string Name { get; set; }
public string Root { get; set; }
public string FileExtension { get; set; } = "txt";
public HashSet<Runtime> Runtimes = new HashSet<Runtime>();
public bool SeparatedLexerAndParser { get; set; }
public CaseInsensitiveType CaseInsensitiveType { get; set; }
public bool Preprocessor { get; set; }
public bool PreprocessorCaseInsensitive { get; set; }
public string PreprocessorRoot { get; set; }
public bool PreprocessorSeparatedLexerAndParser { get; set; }
public List<string> Files { get; set; } = new List<string>();
public List<string> TextFiles { get; set; } = new List<string>();
public string Directory { get; set; } = "";
}
}
|
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Collections.Generic;
using System.IO;
namespace AntlrGrammarEditor
{
public class Grammar
{
public const string AntlrDotExt = ".g4";
public const string ProjectDotExt = ".age";
public const string LexerPostfix = "Lexer";
public const string ParserPostfix = "Parser";
public string Name { get; set; }
public string Root { get; set; }
public string FileExtension { get; set; } = "txt";
public HashSet<Runtime> Runtimes = new HashSet<Runtime>();
public bool SeparatedLexerAndParser { get; set; }
public bool CaseInsensitive { get; set; }
public bool Preprocessor { get; set; }
public bool PreprocessorCaseInsensitive { get; set; }
public string PreprocessorRoot { get; set; }
public bool PreprocessorSeparatedLexerAndParser { get; set; }
public List<string> Files { get; set; } = new List<string>();
public List<string> TextFiles { get; set; } = new List<string>();
public string Directory { get; set; } = "";
}
}
|
apache-2.0
|
C#
|
e2971ff9dab67d0b1bf24b498476bf5f7b15080b
|
work with the as documented 'COVERALLS_PARALLEL' ARG
|
csMACnz/coveralls.net
|
src/csmacnz.Coveralls/CoverageMetadataResolver.cs
|
src/csmacnz.Coveralls/CoverageMetadataResolver.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using BCLExtensions;
using Beefeater;
using csmacnz.Coveralls.Adapters;
using csmacnz.Coveralls.MetaDataResolvers;
using csmacnz.Coveralls.Ports;
namespace csmacnz.Coveralls
{
public static class CoverageMetadataResolver
{
public static CoverageMetadata Resolve(MainArgs args, IEnvironmentVariables variables)
{
var resolvers = CreateResolvers(args, variables);
var serviceName = Resolve(resolvers, r => r.ResolveServiceName());
var serviceJobId = Resolve(resolvers, r => r.ResolveServiceJobId());
var serviceNumber = Resolve(resolvers, r => r.ResolveServiceNumber());
var pullRequestId = Resolve(resolvers, r => r.ResolvePullRequestId());
var parallel = ResolveParallel(args, variables);
return new CoverageMetadata
{
ServiceJobId = serviceJobId.ValueOr("0"),
ServiceName = serviceName.ValueOr("coveralls.net"),
ServiceNumber = serviceNumber.ValueOr(null),
PullRequestId = pullRequestId.ValueOr(null),
Parallel = parallel
};
}
private static List<IMetaDataResolver> CreateResolvers(MainArgs args, IEnvironmentVariables variables)
{
return new List<IMetaDataResolver>
{
new CommandLineMetaDataResolver(args),
new AppVeyorMetaDataResolver(variables),
new TravisMetaDataResolver(variables)
};
}
private static Option<string> Resolve(List<IMetaDataResolver> resolvers, Func<IMetaDataResolver, Option<string>> resolve)
{
return resolvers
.Where(r => r.IsActive())
.Select(r => resolve?.Invoke(r) ?? Option<string>.None)
.FirstOrDefault(v => v.HasValue);
}
private static bool ResolveParallel(MainArgs args, IEnvironmentVariables variables)
{
if (args.IsProvided("--parallel"))
{
return args.OptParallel;
}
return variables.GetBooleanVariable("COVERALLS_PARALLEL");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using BCLExtensions;
using Beefeater;
using csmacnz.Coveralls.Adapters;
using csmacnz.Coveralls.MetaDataResolvers;
using csmacnz.Coveralls.Ports;
namespace csmacnz.Coveralls
{
public static class CoverageMetadataResolver
{
public static CoverageMetadata Resolve(MainArgs args, IEnvironmentVariables variables)
{
var resolvers = CreateResolvers(args, variables);
var serviceName = Resolve(resolvers, r => r.ResolveServiceName());
var serviceJobId = Resolve(resolvers, r => r.ResolveServiceJobId());
var serviceNumber = Resolve(resolvers, r => r.ResolveServiceNumber());
var pullRequestId = Resolve(resolvers, r => r.ResolvePullRequestId());
var parallel = args.OptParallel;
return new CoverageMetadata
{
ServiceJobId = serviceJobId.ValueOr("0"),
ServiceName = serviceName.ValueOr("coveralls.net"),
ServiceNumber = serviceNumber.ValueOr(null),
PullRequestId = pullRequestId.ValueOr(null),
Parallel = parallel
};
}
private static List<IMetaDataResolver> CreateResolvers(MainArgs args, IEnvironmentVariables variables)
{
return new List<IMetaDataResolver>
{
new CommandLineMetaDataResolver(args),
new AppVeyorMetaDataResolver(variables),
new TravisMetaDataResolver(variables)
};
}
private static Option<string> Resolve(List<IMetaDataResolver> resolvers, Func<IMetaDataResolver, Option<string>> resolve)
{
return resolvers
.Where(r => r.IsActive())
.Select(r => resolve?.Invoke(r) ?? Option<string>.None)
.FirstOrDefault(v => v.HasValue);
}
}
}
|
mit
|
C#
|
bed4efc295198e08e5e992bef278e02369bf30d1
|
Allow more of the word for the reader count, as the writer count will always be v small
|
peterchase/parallel-workshop
|
ParallelWorkshop/Ex08DiyReaderWriterLock/PossibleSolution/InterlockedReaderWriterLock.cs
|
ParallelWorkshop/Ex08DiyReaderWriterLock/PossibleSolution/InterlockedReaderWriterLock.cs
|
using System.Threading;
namespace Lurchsoft.ParallelWorkshop.Ex08DiyReaderWriterLock.PossibleSolution
{
/// <summary>
/// A scary low-level reader-writer lock implementation.
/// <para>
/// This one does not block, though it does yield. It will spin the CPU until the lock is available. However, by doing
/// so, it avoids the cost of synchronisation and is much faster than a blocking lock.
/// </para>
/// </summary>
public class InterlockedReaderWriterLock : IReaderWriterLock
{
private const int OneWriter = 1 << 28;
private int counts;
public void EnterReadLock()
{
while (true)
{
int cur = Interlocked.Increment(ref counts);
if ((cur & 0xF0000000) == 0)
{
return;
}
Interlocked.Decrement(ref counts);
Thread.Yield();
}
}
public void ExitReadLock()
{
Interlocked.Decrement(ref counts);
}
public void EnterWriteLock()
{
while (true)
{
int cur = Interlocked.Add(ref counts, OneWriter);
if (cur == OneWriter)
{
return;
}
Interlocked.Add(ref counts, -OneWriter);
Thread.Yield();
}
}
public void ExitWriteLock()
{
Interlocked.Add(ref counts, -OneWriter);
}
}
}
|
using System;
using System.Threading;
namespace Lurchsoft.ParallelWorkshop.Ex08DiyReaderWriterLock.PossibleSolution
{
/// <summary>
/// A scary low-level reader-writer lock implementation.
/// <para>
/// This one does not block, though it does yield. It will spin the CPU until the lock is available. However, by doing
/// so, it avoids the cost of synchronisation and is much faster than a blocking lock.
/// </para>
/// </summary>
public class InterlockedReaderWriterLock : IReaderWriterLock
{
private const int OneWriter = 1 << 16;
private int counts;
public void EnterReadLock()
{
while (true)
{
int cur = Interlocked.Increment(ref counts);
if ((cur & 0xFFFF0000) == 0)
{
return;
}
Interlocked.Decrement(ref counts);
Thread.Yield();
}
}
public void ExitReadLock()
{
Interlocked.Decrement(ref counts);
}
public void EnterWriteLock()
{
while (true)
{
int cur = Interlocked.Add(ref counts, OneWriter);
if (cur == OneWriter)
{
return;
}
Interlocked.Add(ref counts, -OneWriter);
Thread.Yield();
}
}
public void ExitWriteLock()
{
Interlocked.Add(ref counts, -OneWriter);
}
}
}
|
apache-2.0
|
C#
|
ce45ee726d998e11c41300a5e4bad74e4a633800
|
Make input tablet start states be set right
|
knexer/Chinese-Rooms-what-do-they-know-do-they-know-things-lets-find-out
|
Assets/Scripts/UI/TabletUI.cs
|
Assets/Scripts/UI/TabletUI.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[RequireComponent(typeof(GridLayoutGroup))]
public class TabletUI : MonoBehaviour, ITablet
{
public ITabletCell TopLeft { get { return topLeft; } set { topLeft.SetState(value); } }
public ITabletCell TopRight { get { return topRight; } set { topRight.SetState(value); } }
public ITabletCell BottomLeft { get { return bottomLeft; } set { bottomLeft.SetState(value); } }
public ITabletCell BottomRight { get { return bottomRight; } set { bottomRight.SetState(value); } }
private TabletCellUI topLeft;
private TabletCellUI topRight;
private TabletCellUI bottomLeft;
private TabletCellUI bottomRight;
void Start() {
GetComponent<GridLayoutGroup>().startCorner = GridLayoutGroup.Corner.UpperLeft;
GetComponent<GridLayoutGroup>().startAxis = GridLayoutGroup.Axis.Horizontal;
TabletCellUI[] cells = GetComponentsInChildren<TabletCellUI>();
if (cells.Length != 4)
throw new Exception("Expected 4 TabletCellUI components in children, but found " + cells.Length);
topLeft = cells[0];
topRight = cells[1];
bottomLeft = cells[2];
bottomRight = cells[3];
topLeft.parent = this;
topRight.parent = this;
bottomLeft.parent = this;
bottomRight.parent = this;
this.SetState(GlobalInput.InputTablet);
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[RequireComponent(typeof(GridLayoutGroup))]
public class TabletUI : MonoBehaviour, ITablet
{
public ITabletCell TopLeft { get { return topLeft; } set { topLeft.SetState(value); } }
public ITabletCell TopRight { get { return topRight; } set { topRight.SetState(value); } }
public ITabletCell BottomLeft { get { return bottomLeft; } set { bottomLeft.SetState(value); } }
public ITabletCell BottomRight { get { return bottomRight; } set { bottomRight.SetState(value); } }
private TabletCellUI topLeft;
private TabletCellUI topRight;
private TabletCellUI bottomLeft;
private TabletCellUI bottomRight;
void Start() {
GetComponent<GridLayoutGroup>().startCorner = GridLayoutGroup.Corner.UpperLeft;
GetComponent<GridLayoutGroup>().startAxis = GridLayoutGroup.Axis.Horizontal;
TabletCellUI[] cells = GetComponentsInChildren<TabletCellUI>();
if (cells.Length != 4)
throw new Exception("Expected 4 TabletCellUI components in children, but found " + cells.Length);
topLeft = cells[0];
topRight = cells[1];
bottomLeft = cells[2];
bottomRight = cells[3];
topLeft.parent = this;
topRight.parent = this;
bottomLeft.parent = this;
bottomRight.parent = this;
}
}
|
mit
|
C#
|
6c76fdf9d2d937b176fbfae6f8cea5b841f73362
|
increment patch version,
|
jwChung/Experimentalism,jwChung/Experimentalism
|
build/CommonAssemblyInfo.cs
|
build/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.22.3")]
[assembly: AssemblyInformationalVersion("0.22.3")]
/*
* Version 0.22.3
*
* - [FIX] Renamed AssemblyFixtureCustomizationAttribute to
* AssemblyCustomizationAttribute. (BREAKING-CHANGE)
*/
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.22.2")]
[assembly: AssemblyInformationalVersion("0.22.2")]
/*
* Version 0.22.3
*
* - [FIX] Renamed AssemblyFixtureCustomizationAttribute to
* AssemblyCustomizationAttribute. (BREAKING-CHANGE)
*/
|
mit
|
C#
|
460e749ede7f1d3b213d94e453d62e1d109d5116
|
Add SesReceipt.DmarcPolicy
|
carbon/Amazon
|
src/Amazon.Ses/Notifications/SesReceipt.cs
|
src/Amazon.Ses/Notifications/SesReceipt.cs
|
using System;
using System.Text.Json.Serialization;
namespace Amazon.Ses;
public sealed class SesReceipt
{
[JsonPropertyName("timestamp")]
public DateTime Timestamp { get; init; }
[JsonPropertyName("processingTimeMillis")]
public long ProcessingTimeMillis { get; init; }
/// <summary>
/// none | quarantine | reject
/// </summary>
[JsonPropertyName("dmarcPolicy")]
public string? DmarcPolicy { get; set; }
#nullable disable
[JsonPropertyName("recipients")]
public string[] Recipients { get; init; }
[JsonPropertyName("spamVerdict")]
public SesVerdict SpamVerdict { get; init; }
[JsonPropertyName("virusVerdict")]
public SesVerdict VirusVerdict { get; init; }
[JsonPropertyName("spfVerdict")]
public SesVerdict SpfVerdict { get; init; }
[JsonPropertyName("dkimVerdict")]
public SesVerdict DkimVerdict { get; init; }
[JsonPropertyName("action")]
public SesNotificationAction Action { get; init; }
}
|
#nullable disable
using System;
using System.Text.Json.Serialization;
namespace Amazon.Ses;
public sealed class SesReceipt
{
[JsonPropertyName("timestamp")]
public DateTime Timestamp { get; init; }
[JsonPropertyName("processingTimeMillis")]
public long ProcessingTimeMillis { get; init; }
[JsonPropertyName("recipients")]
public string[] Recipients { get; init; }
[JsonPropertyName("spamVerdict")]
public SesVerdict SpamVerdict { get; init; }
[JsonPropertyName("virusVerdict")]
public SesVerdict VirusVerdict { get; init; }
[JsonPropertyName("spfVerdict")]
public SesVerdict SpfVerdict { get; init; }
[JsonPropertyName("dkimVerdict")]
public SesVerdict DkimVerdict { get; init; }
[JsonPropertyName("action")]
public SesNotificationAction Action { get; init; }
}
|
mit
|
C#
|
e270e739fe24eacb1b9f28a966411be8ab839637
|
Test creation branche DevJB
|
jbblois/Sucradom,jbblois/Sucradom,jbblois/Sucradom,jbblois/Sucradom
|
Sucradom/Program.cs
|
Sucradom/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sucradom
{
class Program
{
static void Main(string[] args)
{
//Coucou
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sucradom
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
apache-2.0
|
C#
|
21f4d4af2e169da98314cd5384ea18c755478da3
|
Build fix.
|
wojtpl2/ExtendedXmlSerializer,wojtpl2/ExtendedXmlSerializer,Mike-EEE/ExtendedXmlSerializer,Mike-EEE/ExtendedXmlSerializer
|
src/ExtendedXmlSerializer/Cache/Getters.cs
|
src/ExtendedXmlSerializer/Cache/Getters.cs
|
// MIT License
//
// Copyright (c) 2016 Wojciech Nagórski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System.Reflection;
namespace ExtendedXmlSerialization.Cache
{
sealed class Getters : WeakCache<MemberInfo, ObjectAccessors.PropertyGetter>
{
public static Getters Default { get; } = new Getters();
Getters() : base(ObjectAccessors.CreatePropertyGetter) {}
}
}
|
// MIT License
//
// Copyright (c) 2016 Wojciech Nagórski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System.Reflection;
using System.Runtime.CompilerServices;
namespace ExtendedXmlSerialization.Cache
{
sealed class Getters : WeakCacheBase<MemberInfo, ObjectAccessors.PropertyGetter>
{
public static Getters Default { get; } = new Getters();
Getters() {}
protected override ObjectAccessors.PropertyGetter Callback(MemberInfo key)
{
var getter = ObjectAccessors.CreatePropertyGetter(key);
var callback = new ConditionalWeakTable<object, object>.CreateValueCallback(getter);
var cache = new WeakCache<object, object>(callback);
ObjectAccessors.PropertyGetter result = cache.Get;
return result;
}
}
}
|
mit
|
C#
|
051422d2c59d391a10843d26bc9a08b39c0236fb
|
Add basic mapping functionality of log consumers
|
atata-framework/atata-configuration-json
|
src/Atata.Configuration.Json/JsonConfigMapper.cs
|
src/Atata.Configuration.Json/JsonConfigMapper.cs
|
using System;
namespace Atata
{
public static class JsonConfigMapper
{
public static AtataContextBuilder Map<TConfig>(TConfig config, AtataContextBuilder builder)
where TConfig : JsonConfig<TConfig>
{
if (config.BaseUrl != null)
builder.UseBaseUrl(config.BaseUrl);
if (config.RetryTimeout != null)
builder.UseRetryTimeout(TimeSpan.FromSeconds(config.RetryTimeout.Value));
if (config.RetryInterval != null)
builder.UseRetryInterval(TimeSpan.FromSeconds(config.RetryInterval.Value));
if (config.AssertionExceptionTypeName != null)
builder.UseAssertionExceptionType(Type.GetType(config.AssertionExceptionTypeName));
if (config.UseNUnitTestName)
builder.UseNUnitTestName();
if (config.LogNUnitError)
builder.LogNUnitError();
if (config.TakeScreenshotOnNUnitError)
{
if (config.TakeScreenshotOnNUnitErrorTitle != null)
builder.TakeScreenshotOnNUnitError(config.TakeScreenshotOnNUnitErrorTitle);
else
builder.TakeScreenshotOnNUnitError();
}
if (config.LogConsumers != null)
{
foreach (var item in config.LogConsumers)
MapLogConsumer(item, builder);
}
return builder;
}
private static void MapLogConsumer(LogConsumerJsonSection logConsumerSection, AtataContextBuilder builder)
{
Type type = ResolveLogConsumerType(logConsumerSection.TypeName);
ILogConsumer logConsumer = (ILogConsumer)Activator.CreateInstance(type);
if (logConsumerSection.MinLevel != null)
;
if (logConsumerSection.SectionFinish == false)
;
}
private static Type ResolveLogConsumerType(string typeName)
{
//// Check log consumer aliases.
return Type.GetType(typeName);
}
}
}
|
using System;
namespace Atata
{
public static class JsonConfigMapper
{
public static AtataContextBuilder Map<TConfig>(TConfig config, AtataContextBuilder builder)
where TConfig : JsonConfig<TConfig>
{
if (config.BaseUrl != null)
builder.UseBaseUrl(config.BaseUrl);
if (config.RetryTimeout != null)
builder.UseRetryTimeout(TimeSpan.FromSeconds(config.RetryTimeout.Value));
if (config.RetryInterval != null)
builder.UseRetryInterval(TimeSpan.FromSeconds(config.RetryInterval.Value));
if (config.AssertionExceptionTypeName != null)
builder.UseAssertionExceptionType(Type.GetType(config.AssertionExceptionTypeName));
if (config.UseNUnitTestName)
builder.UseNUnitTestName();
if (config.LogNUnitError)
builder.LogNUnitError();
if (config.TakeScreenshotOnNUnitError)
{
if (config.TakeScreenshotOnNUnitErrorTitle != null)
builder.TakeScreenshotOnNUnitError(config.TakeScreenshotOnNUnitErrorTitle);
else
builder.TakeScreenshotOnNUnitError();
}
return builder;
}
}
}
|
apache-2.0
|
C#
|
cc1cf5e268b1914fd358979c0b68a195460d0b03
|
Set current culture in shared entrypoint.
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content
|
Content.Shared/EntryPoint.cs
|
Content.Shared/EntryPoint.cs
|
using System;
using System.Collections.Generic;
using System.Globalization;
using Content.Shared.Maps;
using Robust.Shared.ContentPack;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
namespace Content.Shared
{
public class EntryPoint : GameShared
{
// If you want to change your codebase's language, do it here.
private const string Culture = "en-US";
#pragma warning disable 649
[Dependency] private readonly IPrototypeManager _prototypeManager;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
public override void PreInit()
{
IoCManager.InjectDependencies(this);
// Default to en-US.
_localizationManager.LoadCulture(new CultureInfo(Culture));
}
public override void Init()
{
}
public override void PostInit()
{
base.PostInit();
_initTileDefinitions();
}
private void _initTileDefinitions()
{
// Register space first because I'm a hard coding hack.
var spaceDef = _prototypeManager.Index<ContentTileDefinition>("space");
_tileDefinitionManager.Register(spaceDef);
var prototypeList = new List<ContentTileDefinition>();
foreach (var tileDef in _prototypeManager.EnumeratePrototypes<ContentTileDefinition>())
{
if (tileDef.Name == "space")
{
continue;
}
prototypeList.Add(tileDef);
}
// Sort ordinal to ensure it's consistent client and server.
// So that tile IDs match up.
prototypeList.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.Ordinal));
foreach (var tileDef in prototypeList)
{
_tileDefinitionManager.Register(tileDef);
}
_tileDefinitionManager.Initialize();
}
}
}
|
using System;
using System.Collections.Generic;
using Content.Shared.Maps;
using Robust.Shared.ContentPack;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
namespace Content.Shared
{
public class EntryPoint : GameShared
{
#pragma warning disable 649
[Dependency] private readonly IPrototypeManager _prototypeManager;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
#pragma warning restore 649
public override void Init()
{
IoCManager.InjectDependencies(this);
}
public override void PostInit()
{
base.PostInit();
_initTileDefinitions();
}
private void _initTileDefinitions()
{
// Register space first because I'm a hard coding hack.
var spaceDef = _prototypeManager.Index<ContentTileDefinition>("space");
_tileDefinitionManager.Register(spaceDef);
var prototypeList = new List<ContentTileDefinition>();
foreach (var tileDef in _prototypeManager.EnumeratePrototypes<ContentTileDefinition>())
{
if (tileDef.Name == "space")
{
continue;
}
prototypeList.Add(tileDef);
}
// Sort ordinal to ensure it's consistent client and server.
// So that tile IDs match up.
prototypeList.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.Ordinal));
foreach (var tileDef in prototypeList)
{
_tileDefinitionManager.Register(tileDef);
}
_tileDefinitionManager.Initialize();
}
}
}
|
mit
|
C#
|
b884ed2a3d8b8fd50412134a3f162a84c1c29417
|
Make test actually test drum behaviours
|
peppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,ppy/osu
|
osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs
|
osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Taiko.Tests
{
[TestFixture]
public class TestSceneDrumTouchInputArea : OsuTestScene
{
[Cached]
private TaikoInputManager taikoInputManager = new TaikoInputManager(new TaikoRuleset().RulesetInfo);
private DrumTouchInputArea drumTouchInputArea = null!;
[SetUpSteps]
public void SetUpSteps()
{
AddStep("create drum", () =>
{
Children = new Drawable[]
{
new InputDrum
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Height = 0.5f,
},
drumTouchInputArea = new DrumTouchInputArea
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Height = 0.5f,
},
};
});
}
[Test]
public void TestDrum()
{
AddStep("show drum", () => drumTouchInputArea.Show());
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.UI;
namespace osu.Game.Rulesets.Taiko.Tests
{
[TestFixture]
public class TestSceneDrumTouchInputArea : DrawableTaikoRulesetTestScene
{
protected const double NUM_HIT_OBJECTS = 10;
protected const double HIT_OBJECT_TIME_SPACING_MS = 1000;
[BackgroundDependencyLoader]
private void load()
{
var drumTouchInputArea = new DrumTouchInputArea();
DrawableRuleset.KeyBindingInputManager.Add(drumTouchInputArea);
drumTouchInputArea.ShowTouchControls();
}
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
{
List<TaikoHitObject> hitObjects = new List<TaikoHitObject>();
for (int i = 0; i < NUM_HIT_OBJECTS; i++)
{
hitObjects.Add(new Hit
{
StartTime = Time.Current + i * HIT_OBJECT_TIME_SPACING_MS,
IsStrong = isOdd(i),
Type = isOdd(i / 2) ? HitType.Centre : HitType.Rim
});
}
var beatmap = new Beatmap<TaikoHitObject>
{
BeatmapInfo = { Ruleset = ruleset },
HitObjects = hitObjects
};
return beatmap;
}
private bool isOdd(int number)
{
return number % 2 == 0;
}
}
}
|
mit
|
C#
|
449a60f3b217ee07ddb8fb8177eff6e9589d15c0
|
Update Class1.cs
|
j2ghz/IntranetGJAK,j2ghz/IntranetGJAK
|
UnitTests/Class1.cs
|
UnitTests/Class1.cs
|
using IntranetGJAK.Controllers;
using Xunit;
namespace UnitTests
{
// This project can output the Class library as a NuGet Package.
// To enable this option, right-click on the project and select the Properties menu item. In the Build tab select "Produce outputs on build".
public class Home
{
[Fact]
public void ControllerNotNull()
{
Assert.True(true);
}
}
public class UploadController
{
[Fact]
public void ControllerNotNull()
{
Assert.False(false);
}
}
}
|
using IntranetGJAK.Controllers;
using Xunit;
namespace UnitTests
{
// This project can output the Class library as a NuGet Package.
// To enable this option, right-click on the project and select the Properties menu item. In the Build tab select "Produce outputs on build".
public class Home
{
[Fact]
public void ControllerNotNull()
{
Assert.True(true);
}
}
public class UploadController
{
[Fact]
public void ControllerNotNull()
{
Assert.False(true);
}
}
}
|
agpl-3.0
|
C#
|
d8ba7dec4a293234abdd180ab06f4c1c096b6bdb
|
make table striped
|
j2ghz/IntranetGJAK,j2ghz/IntranetGJAK
|
IntranetGJAK/Views/Home/Index.cshtml
|
IntranetGJAK/Views/Home/Index.cshtml
|
@using IntranetGJAK.Tools
@model IEnumerable<IntranetGJAK.Models.File>
@{
ViewData["Title"] = "Seznam soubor";
}
<table class="table table-striped table-hover">
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Size)
</th>
<th>
@Html.DisplayNameFor(model => model.Uploader)
</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
<strong>@Html.DisplayFor(modelItem => item.Name)</strong>
</td>
<td>
@Html.DisplayFor(modelItem => item.Size)
</td>
<td>
@Html.DisplayFor(modelItem => item.Uploader)
</td>
</tr>
}
</table>
|
@using IntranetGJAK.Tools
@model IEnumerable<IntranetGJAK.Models.File>
@{
ViewData["Title"] = "Seznam soubor";
}
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Size)
</th>
<th>
@Html.DisplayNameFor(model => model.Uploader)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Size)
</td>
<td>
@Html.DisplayFor(modelItem => item.Uploader)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
</td>
</tr>
}
</table>
|
agpl-3.0
|
C#
|
a317cfcfbea676ca56bb06c7e498e48ddc57925c
|
Make Error property of MastodonApiException read-only.
|
pawotter/mastodon-api-cs
|
Mastodon.API/MastodonApiException.cs
|
Mastodon.API/MastodonApiException.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace Mastodon.API
{
/// <summary>
/// This exception indicates an error code from the MastodonAPI (i.e., 400, 404, 500, etc).
/// It is up to the caller to catch these exceptions and take appropriate action within their application.
/// </summary>
public class MastodonApiException : Exception
{
/// <summary>
/// The StatusCode returned from the Http call to the API
/// </summary>
public HttpStatusCode StatusCode { get; }
/// <summary>
/// Deserialized representation of the error message from the API
/// </summary>
public Error Error { get; }
public MastodonApiException(HttpStatusCode statusCode, Error error)
{
StatusCode = statusCode;
Error = error;
}
public MastodonApiException(HttpStatusCode statusCode, string message)
: base(message)
{
StatusCode = statusCode;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace Mastodon.API
{
/// <summary>
/// This exception indicates an error code from the MastodonAPI (i.e., 400, 404, 500, etc).
/// It is up to the caller to catch these exceptions and take appropriate action within their application.
/// </summary>
public class MastodonApiException : Exception
{
/// <summary>
/// The StatusCode returned from the Http call to the API
/// </summary>
public HttpStatusCode StatusCode { get; }
/// <summary>
/// Deserialized representation of the error message from the API
/// </summary>
public Error Error { get; set; }
public MastodonApiException(HttpStatusCode statusCode, Error error)
{
StatusCode = statusCode;
Error = error;
}
public MastodonApiException(HttpStatusCode statusCode, string message)
: base(message)
{
StatusCode = statusCode;
}
}
}
|
mit
|
C#
|
c49aa8dc72e7b6d43de8c04fc71962dd7aa55581
|
Update Constants.cs
|
peejster/DormRoomMonitor
|
DormRoomMonitor/Constants.cs
|
DormRoomMonitor/Constants.cs
|
namespace DormRoomMonitor
{
/// <summary>
/// General constant variables
/// </summary>
public static class GeneralConstants
{
// With no GPU support, the Raspberry Pi cannot display the live camera feed so this variable should be set to true.
// However, if you are deploying to other harware on which Windows 10 IoT Core does have GPU support, set it to fale.
public const bool DisableLiveCameraFeed = true;
// Oxford Face API Primary should be entered here
// You can obtain a subscription key for Face API by following the instructions here: https://www.projectoxford.ai/doc/general/subscription-key-mgmt
public const string OxfordAPIKey = "<your subscription key here>";
// Name of the folder in which all Whitelist data is stored
public const string WhiteListFolderName = "Dorm_Room_Monitor_Whitelist";
// Name of the folder in which all the intruder data is stored
public const string IntruderFolderName = "Dorm Room Monitor Intruders";
}
/// <summary>
/// Constant variables that hold messages to be read via the SpeechHelper class
/// </summary>
public static class SpeechContants
{
public const string InitialGreetingMessage = "Dorm room monitor has been activated.";
public const string IntruderDetectedMessage = "Intruder detected.";
public const string NotAllowedEntryMessage = "Sorry! I don't recognize you. You are not authorized to be here.";
public const string NoCameraMessage = "Sorry! It seems like your camera has not been fully initialized.";
public static string AllowedEntryMessage(string visitorName)
{
return "Hello " + visitorName + "! You are authorized to be here.";
}
}
/// <summary>
/// Constant variables that hold values used to interact with device Gpio
/// </summary>
public static class GpioConstants
{
// The GPIO pin that the PIR motion sensor is attached to
public const int PirPin = 5;
}
}
|
namespace DormRoomMonitor
{
/// <summary>
/// General constant variables
/// </summary>
public static class GeneralConstants
{
// With no GPU support, the Raspberry Pi cannot display the live camera feed so this variable should be set to true.
// However, if you are deploying to other harware on which Windows 10 IoT Core does have GPU support, set it to fale.
public const bool DisableLiveCameraFeed = true;
// Oxford Face API Primary should be entered here
// You can obtain a subscription key for Face API by following the instructions here: https://www.projectoxford.ai/doc/general/subscription-key-mgmt
public const string OxfordAPIKey = "b2b1adb22ce44bcc91e5cdfe2afb4f53";
// Name of the folder in which all Whitelist data is stored
public const string WhiteListFolderName = "Dorm_Room_Monitor_Whitelist";
// Name of the folder in which all the intruder data is stored
public const string IntruderFolderName = "Dorm Room Monitor Intruders";
}
/// <summary>
/// Constant variables that hold messages to be read via the SpeechHelper class
/// </summary>
public static class SpeechContants
{
public const string InitialGreetingMessage = "Dorm room monitor has been activated.";
public const string IntruderDetectedMessage = "Intruder detected.";
public const string NotAllowedEntryMessage = "Sorry! I don't recognize you. You are not authorized to be here.";
public const string NoCameraMessage = "Sorry! It seems like your camera has not been fully initialized.";
public static string AllowedEntryMessage(string visitorName)
{
return "Hello " + visitorName + "! You are authorized to be here.";
}
}
/// <summary>
/// Constant variables that hold values used to interact with device Gpio
/// </summary>
public static class GpioConstants
{
// The GPIO pin that the PIR motion sensor is attached to
public const int PirPin = 5;
}
}
|
mit
|
C#
|
a04f18db4f6a3aedd8ef91a6098a7997b6e9e0eb
|
Use the token authenticator.
|
chunkychode/octokit.net,ivandrofly/octokit.net,gdziadkiewicz/octokit.net,dlsteuer/octokit.net,khellang/octokit.net,fffej/octokit.net,dampir/octokit.net,nsnnnnrn/octokit.net,shiftkey-tester/octokit.net,octokit-net-test/octokit.net,devkhan/octokit.net,hahmed/octokit.net,SamTheDev/octokit.net,michaKFromParis/octokit.net,alfhenrik/octokit.net,shiftkey/octokit.net,adamralph/octokit.net,darrelmiller/octokit.net,eriawan/octokit.net,rlugojr/octokit.net,M-Zuber/octokit.net,eriawan/octokit.net,octokit/octokit.net,mminns/octokit.net,SmithAndr/octokit.net,fake-organization/octokit.net,mminns/octokit.net,shiftkey-tester/octokit.net,shana/octokit.net,shana/octokit.net,rlugojr/octokit.net,octokit-net-test-org/octokit.net,kdolan/octokit.net,gabrielweyer/octokit.net,cH40z-Lord/octokit.net,hitesh97/octokit.net,SamTheDev/octokit.net,nsrnnnnn/octokit.net,thedillonb/octokit.net,editor-tools/octokit.net,ChrisMissal/octokit.net,dampir/octokit.net,TattsGroup/octokit.net,geek0r/octokit.net,kolbasov/octokit.net,Sarmad93/octokit.net,forki/octokit.net,naveensrinivasan/octokit.net,octokit-net-test-org/octokit.net,editor-tools/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,hahmed/octokit.net,Red-Folder/octokit.net,gabrielweyer/octokit.net,gdziadkiewicz/octokit.net,yonglehou/octokit.net,magoswiat/octokit.net,SLdragon1989/octokit.net,yonglehou/octokit.net,thedillonb/octokit.net,devkhan/octokit.net,bslliw/octokit.net,octokit/octokit.net,shiftkey/octokit.net,M-Zuber/octokit.net,brramos/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,TattsGroup/octokit.net,takumikub/octokit.net,Sarmad93/octokit.net,ivandrofly/octokit.net,khellang/octokit.net,alfhenrik/octokit.net,daukantas/octokit.net,chunkychode/octokit.net,SmithAndr/octokit.net
|
Octokit/Authentication/Authenticator.cs
|
Octokit/Authentication/Authenticator.cs
|
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Octokit.Internal
{
class Authenticator
{
readonly Dictionary<AuthenticationType, IAuthenticationHandler> authenticators =
new Dictionary<AuthenticationType, IAuthenticationHandler>
{
{ AuthenticationType.Anonymous, new AnonymousAuthenticator() },
{ AuthenticationType.Basic, new BasicAuthenticator() },
{ AuthenticationType.Oauth, new TokenAuthenticator() }
};
public Authenticator(ICredentialStore credentialStore)
{
Ensure.ArgumentNotNull(credentialStore, "credentialStore");
CredentialStore = credentialStore;
}
public async Task Apply(IRequest request)
{
Ensure.ArgumentNotNull(request, "request");
var credentials = await CredentialStore.GetCredentials().ConfigureAwait(false) ?? Credentials.Anonymous;
authenticators[credentials.AuthenticationType].Authenticate(request, credentials);
}
public ICredentialStore CredentialStore { get; set; }
}
}
|
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Octokit.Internal
{
class Authenticator
{
readonly Dictionary<AuthenticationType, IAuthenticationHandler> authenticators =
new Dictionary<AuthenticationType, IAuthenticationHandler>
{
{ AuthenticationType.Anonymous, new AnonymousAuthenticator() },
{ AuthenticationType.Basic, new BasicAuthenticator() },
{ AuthenticationType.Oauth, new AnonymousAuthenticator() }
};
public Authenticator(ICredentialStore credentialStore)
{
Ensure.ArgumentNotNull(credentialStore, "credentialStore");
CredentialStore = credentialStore;
}
public async Task Apply(IRequest request)
{
Ensure.ArgumentNotNull(request, "request");
var credentials = await CredentialStore.GetCredentials().ConfigureAwait(false) ?? Credentials.Anonymous;
authenticators[credentials.AuthenticationType].Authenticate(request, credentials);
}
public ICredentialStore CredentialStore { get; set; }
}
}
|
mit
|
C#
|
fcf0f92a87be00d5a2df8271747324342fb560b3
|
Fix BundleTable
|
Arionildo/Quiz-CWI,Arionildo/Quiz-CWI,Arionildo/Quiz-CWI
|
Quiz/Quiz.Web/App_Start/BundleConfig.cs
|
Quiz/Quiz.Web/App_Start/BundleConfig.cs
|
using System.Web;
using System.Web.Optimization;
namespace Quiz.Web
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/jquery.pietimer").Include(
"~/Scripts/jquery.pietimer.js"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/style").Include(
"~/Scripts/style.css"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
#if DEBUG
BundleTable.EnableOptimizations = false;
#else
BundleTable.EnableOptimizations = true;
#endif
}
}
}
|
using System.Web;
using System.Web.Optimization;
namespace Quiz.Web
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/jquery.pietimer").Include(
"~/Scripts/jquery.pietimer.js"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/style").Include(
"~/Scripts/style.css"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
BundleTable.EnableOptimizations = false;
}
}
}
|
mit
|
C#
|
46e2e50aefe5ef5c32908919eeaa5ec0e020e0eb
|
split up ValueData data
|
EricZimmerman/RegistryPlugins
|
RegistryPlugin.ProfileList/ValuesOut.cs
|
RegistryPlugin.ProfileList/ValuesOut.cs
|
using System;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.ProfileList
{
public class ValuesOut : IValueOut
{
public ValuesOut(string keyName, string profileimagepath, DateTimeOffset? timestamp)
{
KeyName = keyName;
ProfileImagePath = profileimagepath;
Timestamp = timestamp;
}
public DateTimeOffset? Timestamp { get; }
public string KeyName { get; }
public string ProfileImagePath { get; }
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"KeyName: {KeyName}";
public string BatchValueData2 => $"Timestamp: {Timestamp?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
public string BatchValueData3 => $"ProfileImagePath: {ProfileImagePath}";
}
}
|
using System;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.ProfileList
{
public class ValuesOut : IValueOut
{
public ValuesOut(string keyName, string profileimagepath, DateTimeOffset? timestamp)
{
KeyName = keyName;
ProfileImagePath = profileimagepath;
Timestamp = timestamp;
}
public DateTimeOffset? Timestamp { get; }
public string KeyName { get; }
public string ProfileImagePath { get; }
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"KeyName: {KeyName} ProfileImagePath: {ProfileImagePath}";
public string BatchValueData2 => $"Timestamp: {Timestamp?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
public string BatchValueData3 => string.Empty;
}
}
|
mit
|
C#
|
a405c2087ba68f5d2cf1a694926c7c803b0966ed
|
Implement Size() method
|
MSayfullin/Basics
|
Basics.Structures/DynamicConnectivity/UnionFind.cs
|
Basics.Structures/DynamicConnectivity/UnionFind.cs
|
using System;
namespace Basics.Structures.DynamicConnectivity
{
public abstract class UnionFind
{
protected int[] elements;
public UnionFind(int size)
{
elements = new int[size];
for (int i = 0; i < size; i++)
{
elements[i] = i;
}
}
public abstract bool IsConnected(int p, int q);
public abstract void Union(int p, int q);
public int Size()
{
return elements.Length;
}
}
}
|
using System;
namespace Basics.Structures.DynamicConnectivity
{
public abstract class UnionFind
{
protected int[] elements;
public UnionFind(int size)
{
elements = new int[size];
for (int i = 0; i < size; i++)
{
elements[i] = i;
}
}
public abstract bool IsConnected(int p, int q);
public abstract void Union(int p, int q);
}
}
|
mit
|
C#
|
1cf28524c59408e268e36ff74934597434349eeb
|
Fix bug where running a project without export in a directory with a space was confusing the command line arg generator.
|
blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon
|
Compiler/Crayon/Workers/RunCbxFlagBuilderWorker.cs
|
Compiler/Crayon/Workers/RunCbxFlagBuilderWorker.cs
|
using Common;
using Exporter;
using System.Linq;
namespace Crayon
{
// cmdLineFlags = Crayon::RunCbxFlagBuilder(command, buildContext)
class RunCbxFlagBuilderWorker : AbstractCrayonWorker
{
public override CrayonWorkerResult DoWorkImpl(CrayonWorkerResult[] args)
{
ExportCommand command = (ExportCommand)args[0].Value;
string finalCbxPath = (string)args[1].Value;
string cbxFile = FileUtil.GetPlatformPath(finalCbxPath);
int processId = System.Diagnostics.Process.GetCurrentProcess().Id;
string runtimeArgs = string.Join(",", command.DirectRunArgs.Select(s => Utf8Base64.ToBase64(s)));
string flags = "\"" + cbxFile + "\" vmpid:" + processId;
if (runtimeArgs.Length > 0)
{
flags += " runtimeargs:" + runtimeArgs;
}
return new CrayonWorkerResult() { Value = flags };
}
}
}
|
using Common;
using Exporter;
using System.Linq;
namespace Crayon
{
// cmdLineFlags = Crayon::RunCbxFlagBuilder(command, buildContext)
class RunCbxFlagBuilderWorker : AbstractCrayonWorker
{
public override CrayonWorkerResult DoWorkImpl(CrayonWorkerResult[] args)
{
ExportCommand command = (ExportCommand)args[0].Value;
string finalCbxPath = (string)args[1].Value;
string cbxFile = FileUtil.GetPlatformPath(finalCbxPath);
int processId = System.Diagnostics.Process.GetCurrentProcess().Id;
string runtimeArgs = string.Join(",", command.DirectRunArgs.Select(s => Utf8Base64.ToBase64(s)));
string flags = cbxFile + " vmpid:" + processId;
if (runtimeArgs.Length > 0)
{
flags += " runtimeargs:" + runtimeArgs;
}
return new CrayonWorkerResult() { Value = flags };
}
}
}
|
mit
|
C#
|
117c0dace307fb2ba3ee03d6697bf729b6c6fa56
|
refactor and docker compose
|
threenine/swcApi,threenine/swcApi,threenine/swcApi
|
src/Api.Database/ApiContextFactory.cs
|
src/Api.Database/ApiContextFactory.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Infrastructure;
namespace Api.Database
{
public class ApiContextFactory : IDesignTimeDbContextFactory<ApiContext>
{
public ApiContextFactory()
{
}
public ApiContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<ApiContext>();
builder.UseSqlServer(
"Server=(localdb)\\mssqllocaldb;Database=config;Trusted_Connection=True;MultipleActiveResultSets=true");
return new ApiContext(builder.Options);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Infrastructure;
namespace Api.Database
{
public class ApiContextFactory : IDesignTimeDbContextFactory<ApiContext>
{
public ApiContextFactory()
{
}
public ApiContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<ApiContext>();
builder.UseSqlServer(
"Server=(localdb)\\mssqllocaldb;Database=config;Trusted_Connection=True;MultipleActiveResultSets=true");
return new ApiContext(builder.Options);
}
}
}
|
apache-2.0
|
C#
|
8625831b7d6300336b233829ae93214cee8fcd42
|
fix invalid XML character
|
tainicom/Aether
|
Source/Elementary/Leptons/ILepton.cs
|
Source/Elementary/Leptons/ILepton.cs
|
#region License
// Copyright 2015 Kastellanos Nikolaos
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using Microsoft.Xna.Framework;
namespace tainicom.Aether.Elementary.Leptons
{
/// <summary>
/// Particle that have position, rotation and scale
/// </summary>
public interface ILepton : ILocalTransform, IPosition, IAether
{
//Matrix LocalTransform { get; } //Defined in ILocalTransform
Quaternion Rotation { get; set; }
Vector3 Scale { get; set; }
//Vector3 Position { get; set; } //Defined in IPosition
}
}
|
#region License
// Copyright 2015 Kastellanos Nikolaos
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using Microsoft.Xna.Framework;
namespace tainicom.Aether.Elementary.Leptons
{
/// <summary>
/// Particle that have position, rotation & scale
/// </summary>
public interface ILepton : ILocalTransform, IPosition, IAether
{
//Matrix LocalTransform { get; } //Defined in ILocalTransform
Quaternion Rotation { get; set; }
Vector3 Scale { get; set; }
//Vector3 Position { get; set; } //Defined in IPosition
}
}
|
apache-2.0
|
C#
|
d602877a423748b7daf7450f841cff91e6473a2a
|
Remove test websocket code from WF implementation
|
HelloKitty/317refactor
|
src/Client/Rs317.Client.WF/Program.cs
|
src/Client/Rs317.Client.WF/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Rs317.Sharp
{
public static class Program
{
public static async Task Main(string[] args)
{
try
{
Console.WriteLine($"RS2 user client - release #{317} using Rs317.Sharp by Glader");
await StartClient(0, 0, true);
}
catch(Exception exception)
{
throw new InvalidOperationException($"Erorr: {exception.Message} \n\n Stack: {exception.StackTrace}");
}
}
private static async Task StartClient(int localWorldId, short portOffset, bool membersWorld)
{
Application.SetCompatibleTextRenderingDefault(false);
Task clientRunningAwaitable = signlink.startpriv("127.0.0.1");
ClientConfiguration configuration = new ClientConfiguration(localWorldId, (short) (portOffset + 1), membersWorld);
RsWinForm windowsFormApplication = new RsWinForm(765, 503);
RsWinFormsClient client1 = new RsWinFormsClient(configuration, windowsFormApplication.CreateGraphics());
windowsFormApplication.RegisterInputSubscriber(client1);
client1.createClientFrame(765, 503);
Application.Run(windowsFormApplication);
await clientRunningAwaitable
.ConfigureAwait(false);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Rs317.Sharp
{
public static class Program
{
public static async Task Main(string[] args)
{
try
{
Console.WriteLine($"RS2 user client - release #{317} using Rs317.Sharp by Glader");
await StartClient(0, 0, true);
}
catch(Exception exception)
{
throw new InvalidOperationException($"Erorr: {exception.Message} \n\n Stack: {exception.StackTrace}");
}
}
private static async Task StartClient(int localWorldId, short portOffset, bool membersWorld)
{
Application.SetCompatibleTextRenderingDefault(false);
Task clientRunningAwaitable = signlink.startpriv("127.0.0.1");
ClientConfiguration configuration = new ClientConfiguration(localWorldId, (short) (portOffset + 1), membersWorld);
RsWinForm windowsFormApplication = new RsWinForm(765, 503);
RsWinFormsClient client1 = new RsWinFormsClient(configuration, windowsFormApplication.CreateGraphics(), new DefaultWebSocketClientFactory());
windowsFormApplication.RegisterInputSubscriber(client1);
client1.createClientFrame(765, 503);
Application.Run(windowsFormApplication);
await clientRunningAwaitable
.ConfigureAwait(false);
}
}
}
|
mit
|
C#
|
9d9f6372f64f0e83db08931864b9dbeca3bd04d9
|
Remove unneeded comments
|
Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype
|
src/Glimpse.Common/GlimpseServices.cs
|
src/Glimpse.Common/GlimpseServices.cs
|
using Glimpse;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection;
using System.Collections.Generic;
namespace Glimpse
{
public class GlimpseServices
{
public static IEnumerable<IServiceDescriptor> GetDefaultServices()
{
return GetDefaultServices(new Configuration());
}
public static IEnumerable<IServiceDescriptor> GetDefaultServices(IConfiguration configuration)
{
var describe = new ServiceDescriber(configuration);
//
// Discovery & Reflection.
//
yield return describe.Transient<ITypeActivator, DefaultTypeActivator>();
yield return describe.Transient<ITypeSelector, DefaultTypeSelector>();
yield return describe.Transient<IAssemblyProvider, DefaultAssemblyProvider>();
yield return describe.Transient<ITypeService, DefaultTypeService>();
yield return describe.Transient(typeof(IDiscoverableCollection<>), typeof(ReflectionDiscoverableCollection<>));
}
}
}
|
using Glimpse;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection;
using System.Collections.Generic;
namespace Glimpse
{
public class GlimpseServices
{
public static IEnumerable<IServiceDescriptor> GetDefaultServices()
{
return GetDefaultServices(new Configuration());
}
public static IEnumerable<IServiceDescriptor> GetDefaultServices(IConfiguration configuration)
{
var describe = new ServiceDescriber(configuration);
//
// Discovery & Reflection.
//
yield return describe.Transient<ITypeActivator, DefaultTypeActivator>();
yield return describe.Transient<ITypeSelector, DefaultTypeSelector>();
yield return describe.Transient<IAssemblyProvider, DefaultAssemblyProvider>();
yield return describe.Transient<ITypeService, DefaultTypeService>();
yield return describe.Transient(typeof(IDiscoverableCollection<>), typeof(ReflectionDiscoverableCollection<>));
//
// Broker
//
//yield return describe.Singleton<IMessageBus, DefaultMessageBus>();
}
}
}
|
mit
|
C#
|
c1a74bb8e5cbd6e43456720e44ed3c323261cee7
|
Fix to apply for the library updates.
|
cube-soft/Cube.Core,cube-soft/Cube.Core,cube-soft/Cube.FileSystem,cube-soft/Cube.FileSystem
|
Tests/Sources/Details/GlobalSetup.cs
|
Tests/Sources/Details/GlobalSetup.cs
|
/* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, Inc.
//
// 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 NUnit.Framework;
using System.Reflection;
namespace Cube.FileSystem.Tests
{
/* --------------------------------------------------------------------- */
///
/// GlobalSetup
///
/// <summary>
/// NUnit で最初に実行する処理を記述するテストです。
/// </summary>
///
/* --------------------------------------------------------------------- */
[SetUpFixture]
public class GlobalSetup
{
/* ----------------------------------------------------------------- */
///
/// OneTimeSetup
///
/// <summary>
/// 一度だけ実行される初期化処理です。
/// </summary>
///
/* ----------------------------------------------------------------- */
[OneTimeSetUp]
public void OneTimeSetup()
{
Logger.Configure();
Logger.Info(typeof(GlobalSetup), Assembly.GetExecutingAssembly());
}
}
}
|
/* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, Inc.
//
// 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 Cube.Log;
using NUnit.Framework;
using System.Reflection;
namespace Cube.FileSystem.Tests
{
/* --------------------------------------------------------------------- */
///
/// GlobalSetup
///
/// <summary>
/// NUnit で最初に実行する処理を記述するテストです。
/// </summary>
///
/* --------------------------------------------------------------------- */
[SetUpFixture]
public class GlobalSetup
{
/* ----------------------------------------------------------------- */
///
/// OneTimeSetup
///
/// <summary>
/// 一度だけ実行される初期化処理です。
/// </summary>
///
/* ----------------------------------------------------------------- */
[OneTimeSetUp]
public void OneTimeSetup()
{
Logger.Configure();
Logger.Info(typeof(GlobalSetup), Assembly.GetExecutingAssembly());
}
}
}
|
apache-2.0
|
C#
|
464ad2b3378bf4ddf29c51d1074954e05b1492cd
|
Work on ActionController
|
Maree2/jam,Maree2/jam
|
JamProject/Assets/Core/Scripts/ActionController.cs
|
JamProject/Assets/Core/Scripts/ActionController.cs
|
using UnityEngine;
using System.Collections;
public class ActionController : MonoBehaviour
{
public void Start()
{
}
public void Update()
{
}
public void Awake()
{
}
}
|
using UnityEngine;
using System.Collections;
public class ActionController : MonoBehaviour
{
// Awake is called when the script instance is being loaded (Since v1.0)
public void Awake()
{
}
// OnBecameVisible is called when the renderer became visible by any camera (Since v1.0)
public void OnBecameInvisible()
{
}
// This function is called every fixed framerate frame, if the MonoBehaviour is enabled (Since v1.0)
public void FixedUpdate()
{
}
}
|
mit
|
C#
|
ad5fbe9dfb5e3b08212641e3b8341b3a2fde772b
|
Remove test of no longer existing method CompileApi.
|
FloodProject/flood,FloodProject/flood,FloodProject/flood
|
src/Tools/RPCGen.Tests/RPCGenTests.cs
|
src/Tools/RPCGen.Tests/RPCGenTests.cs
|
using Flood.Tools.RPCGen;
using NUnit.Framework;
using System;
using System.IO;
using System.Reflection;
namespace RPCGen.Tests
{
[TestFixture]
class RPCGenTests
{
[Test]
public void MainTest()
{
string genDirectory = Path.Combine("..", "..", "gen", "RPCGen.Tests");
Directory.CreateDirectory(genDirectory);
var sourceDllPath = Path.GetFullPath("RPCGen.Tests.Services.dll");
var destDllPath = Path.Combine(genDirectory, "RPCGen.Tests.Services.dll");
var sourcePdbPath = Path.GetFullPath("RPCGen.Tests.Services.pdb");
var destPdbPath = Path.Combine(genDirectory, "RPCGen.Tests.Services.pdb");
System.IO.File.Copy(sourceDllPath, destDllPath, true);
if (File.Exists(sourcePdbPath))
System.IO.File.Copy(sourcePdbPath, destPdbPath, true);
var args = new string[]
{
String.Format("-o={0}", genDirectory),
destDllPath
};
var ret = Flood.Tools.RPCGen.Program.Main(args);
Assert.AreEqual(0, ret);
}
}
}
|
using Flood.Tools.RPCGen;
using NUnit.Framework;
using System;
using System.IO;
using System.Reflection;
namespace RPCGen.Tests
{
[TestFixture]
class RPCGenTests
{
[Test]
public void MainTest()
{
string genDirectory = Path.Combine("..", "..", "gen", "RPCGen.Tests");
Directory.CreateDirectory(genDirectory);
var sourceDllPath = Path.GetFullPath("RPCGen.Tests.Services.dll");
var destDllPath = Path.Combine(genDirectory, "RPCGen.Tests.Services.dll");
var sourcePdbPath = Path.GetFullPath("RPCGen.Tests.Services.pdb");
var destPdbPath = Path.Combine(genDirectory, "RPCGen.Tests.Services.pdb");
System.IO.File.Copy(sourceDllPath, destDllPath, true);
if (File.Exists(sourcePdbPath))
System.IO.File.Copy(sourcePdbPath, destPdbPath, true);
var args = new string[]
{
String.Format("-o={0}", genDirectory),
destDllPath
};
var ret = Flood.Tools.RPCGen.Program.Main(args);
Assert.AreEqual(0, ret);
}
[Test]
public void GenAPI()
{
string genDirectory = Path.Combine("..", "..", "gen", "RPCGen.Tests.API");
Directory.CreateDirectory(genDirectory);
var sourceDllPath = Path.GetFullPath("RPCGen.Tests.Services.dll");
var destDllPath = Path.Combine(genDirectory, "RPCGen.Tests.Services.dll");
var rpcCompiler = new Compiler(sourceDllPath, genDirectory);
rpcCompiler.Process();
rpcCompiler.CompileApi(destDllPath);
}
}
}
|
bsd-2-clause
|
C#
|
145eed38c992df9c6e046f708939bd9f03ac0ff5
|
move to 3.9.9.5
|
MutonUfoAI/pgina,MutonUfoAI/pgina,MutonUfoAI/pgina
|
Plugins/SSHAuth/SSHAuth/Properties/AssemblyInfo.cs
|
Plugins/SSHAuth/SSHAuth/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("SSHAuth")]
[assembly: AssemblyDescription("ssh authentication for pGina")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SSHAuth")]
[assembly: AssemblyCopyright("Copyright © David Dumas 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("dada0db3-2d35-4c73-b8eb-db290e6c895e")]
// 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("3.9.9.5")]
[assembly: AssemblyFileVersion("3.9.9.5")]
|
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("SSHAuth")]
[assembly: AssemblyDescription("ssh authentication for pGina")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SSHAuth")]
[assembly: AssemblyCopyright("Copyright © David Dumas 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("dada0db3-2d35-4c73-b8eb-db290e6c895e")]
// 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("3.9.9.4")]
[assembly: AssemblyFileVersion("3.9.9.4")]
|
bsd-3-clause
|
C#
|
c05584f864d0738bef5d771b267b9e4a66431b93
|
Change usage of connection provider for connection factory.
|
Saaka/WordHunt,Saaka/WordHunt,Saaka/WordHunt,Saaka/WordHunt
|
WordHunt/Games/Create/Repository/GameRepository.cs
|
WordHunt/Games/Create/Repository/GameRepository.cs
|
using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using WordHunt.Data.Connection;
namespace WordHunt.Games.Create.Repository
{
public interface IGameRepository
{
void SaveGame(string name);
}
public class GameRepository : IGameRepository
{
private readonly IDbConnectionFactory connectionFactory;
public GameRepository(IDbConnectionFactory connectionFactory)
{
this.connectionFactory = connectionFactory;
}
public void SaveGame(string name)
{
using (var connection = connectionFactory.CreateConnection())
{
connection.Execute(@"INSERT INTO Words(LanguageId, Value) VALUES (@LanguageId, @Value)",
new { LanguageId = 1, Value = name });
}
}
}
}
|
using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using WordHunt.Data.Connection;
namespace WordHunt.Games.Create.Repository
{
public interface IGameRepository
{
void SaveGame(string name);
}
public class GameRepository : IGameRepository
{
private readonly IDbConnectionProvider connectionProvider;
public GameRepository(IDbConnectionProvider connectionProvider)
{
this.connectionProvider = connectionProvider;
}
public void SaveGame(string name)
{
var connection = connectionProvider.GetConnection();
connection.Execute(@"INSERT INTO Words(LanguageId, Value) VALUES (@LanguageId, @Value)",
new { LanguageId = 1, Value = name });
}
}
}
|
mit
|
C#
|
09d288024607aa8f7fc94f4deb89cd7a80e05ed2
|
Fix compilation error
|
Xeeynamo/KingdomHearts
|
OpenKh.Tests/kh2/TrsrTests.cs
|
OpenKh.Tests/kh2/TrsrTests.cs
|
using Xunit;
using OpenKh.Common;
using OpenKh.Kh2.System;
namespace OpenKh.Tests.kh2
{
public class TrsrTests
{
[Fact]
public void CheckNewTrsr() => Common.FileOpenRead(@"kh2/res/trsr.bin", x => x.Using(stream =>
{
var table = BaseSystem<Trsr>.Read(stream);
Assert.Equal(0x1AE, table.Count);
}));
}
}
|
using Xunit;
using OpenKh.Kh2.System;
namespace OpenKh.Tests.kh2
{
public class TrsrTests
{
[Fact]
public void CheckNewTrsr() => Common.FileOpenRead(@"kh2/res/trsr.bin", x => x.Using(stream =>
{
var table = BaseSystem<Trsr>.Read(stream);
Assert.Equal(0x1AE, table.Count);
}));
}
}
|
mit
|
C#
|
08be31a90487cf31486946fb10f46afec5952757
|
add Shuffle helper
|
adamabdelhamed/PowerArgs,workabyte/PowerArgs,adamabdelhamed/PowerArgs,workabyte/PowerArgs
|
PowerArgs/Extensions/Array.cs
|
PowerArgs/Extensions/Array.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace PowerArgs
{
public static class ArrayEx
{
public static bool None<T>(this IEnumerable<T> items) => items.Any() == false;
public static int RemoveWhere<T>(this IList<T> list, Func<T,bool> whereClause)
{
var toRemove = list.Where(item => whereClause(item)).ToList();
var removed = 0;
foreach(var item in toRemove)
{
if(list.Remove(item))
{
removed++;
}
}
return removed;
}
public static List<T> ToList<T>(this Array a)
{
List<T> ret = new List<T>();
foreach(var element in a)
{
ret.Add((T)element);
}
return ret;
}
public static IEnumerable<List<T>> ToBatchesOf<T>(this IEnumerable<T> items, int n)
{
var currentBatch = new List<T>();
foreach(var item in items)
{
currentBatch.Add(item);
if(currentBatch.Count == n)
{
yield return currentBatch;
currentBatch = new List<T>();
}
}
if(currentBatch.Count > 0)
{
yield return currentBatch;
}
}
private static Random r = new Random();
public static void Shuffle<T>(this IList<T> list)
{
for (var i = 0; i < list.Count; i++)
{
var randomIndex = r.Next(0, list.Count);
var temp = list[i];
list[i] = list[randomIndex];
list[randomIndex] = temp;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace PowerArgs
{
public static class ArrayEx
{
public static bool None<T>(this IEnumerable<T> items) => items.Any() == false;
public static int RemoveWhere<T>(this IList<T> list, Func<T,bool> whereClause)
{
var toRemove = list.Where(item => whereClause(item)).ToList();
var removed = 0;
foreach(var item in toRemove)
{
if(list.Remove(item))
{
removed++;
}
}
return removed;
}
public static List<T> ToList<T>(this Array a)
{
List<T> ret = new List<T>();
foreach(var element in a)
{
ret.Add((T)element);
}
return ret;
}
public static IEnumerable<List<T>> ToBatchesOf<T>(this IEnumerable<T> items, int n)
{
var currentBatch = new List<T>();
foreach(var item in items)
{
currentBatch.Add(item);
if(currentBatch.Count == n)
{
yield return currentBatch;
currentBatch = new List<T>();
}
}
if(currentBatch.Count > 0)
{
yield return currentBatch;
}
}
}
}
|
mit
|
C#
|
92179f02d815516f77932b819e7d6b25faded3be
|
remove not needed pproperties.
|
NickPolyder/FreeParkingSystem
|
src/Account/FreeParkingSystem.Accounts.Data/Models/AccountsDbContext.cs
|
src/Account/FreeParkingSystem.Accounts.Data/Models/AccountsDbContext.cs
|
using Microsoft.EntityFrameworkCore;
namespace FreeParkingSystem.Accounts.Data.Models
{
public class AccountsDbContext : DbContext
{
public AccountsDbContext(DbContextOptions<AccountsDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<DbUser>()
.ToTable("User");
modelBuilder.Entity<DbClaims>()
.ToTable("Claims");
}
}
}
|
using Microsoft.EntityFrameworkCore;
namespace FreeParkingSystem.Accounts.Data.Models
{
public class AccountsDbContext : DbContext
{
public AccountsDbContext(DbContextOptions<AccountsDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<DbUser>()
.ToTable("User");
modelBuilder.Entity<DbClaims>()
.ToTable("Claims");
}
public DbSet<DbUser> Users { get; set; }
public DbSet<DbClaims> Claims { get; set; }
}
}
|
mit
|
C#
|
3e91fe4ce6f04368b487c445c1d25b4e8bbe4c6b
|
Fix message spelling error.
|
couchbase/couchbase-lite-net,couchbase/couchbase-lite-net,couchbase/couchbase-lite-net
|
src/Couchbase.Lite.Shared/API/Error/CouchbaseLiteErrorMessageNetOnly.cs
|
src/Couchbase.Lite.Shared/API/Error/CouchbaseLiteErrorMessageNetOnly.cs
|
// CouchbaseLiteErrorMessage.cs
//
// Copyright (c) 2019 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Collections.Generic;
using System.Text;
namespace Couchbase.Lite
{
internal static partial class CouchbaseLiteErrorMessage
{
//Database - Copy
internal const string ResolveDefaultDirectoryFailed = "Failed to resolve a default directory! If you have overriden the default directory, please check it. Otherwise please file a bug report.";
//Replicator Start()
internal const string ReplicatorDisposed = "Replication cannot be started after disposal";
//MArray MDict <--- in the future, we will replace them with LiteCore Mutable Fleece API
internal const string CannotRemoveItemsFromNonMutableMArray = "Cannot remove items from a non-mutable array";
internal const string CannotRemoveStartingFromIndexLessThan = "Cannot remove starting from an index less than 0 (got {0})";
internal const string CannotRemoveRangeEndsBeforeItStarts = "Cannot remove a range that ends before it starts (got start= {0}, count = {1} )";
internal const string RangeEndForRemoveExceedsArrayLength = "Range end for remove exceeds the length of the array(got start = {0}, count = {1} )";
internal const string CannotSetItemsInNonMutableMArray = "Cannot set items in a non-mutable array";
internal const string CannotClearNonMutableMArray = "Cannot clear a non-mutable array";
internal const string CannotInsertItemsInNonMutableMArray = "Cannot insert items in a non-mutable array";
internal const string CannotClearNonMutableMDict = "Cannot clear a non-mutable MDict";
internal const string CannotSetItemsInNonMutableInMDict = "Cannot set items in a non-mutable MDict";
internal const string CreateCertAttributeEmpty = "Attribute used to create TLSIdentity cannot be null or empty";
}
}
|
// CouchbaseLiteErrorMessage.cs
//
// Copyright (c) 2019 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Collections.Generic;
using System.Text;
namespace Couchbase.Lite
{
internal static partial class CouchbaseLiteErrorMessage
{
//Database - Copy
internal const string ResolveDefaultDirectoryFailed = "Failed to resolve a default directory! If you have overriden the default directory, please check it. Otherwise please file a bug report.";
//Replicator Start()
internal const string ReplicatorDisposed = "Replication cannot be started after disposal";
//MArray MDict <--- in the future, we will replace them with LiteCore Mutable Fleece API
internal const string CannotRemoveItemsFromNonMutableMArray = "Cannot remove items from a non-mutable array";
internal const string CannotRemoveStartingFromIndexLessThan = "Cannot remove starting from an index less than 0 (got {0})";
internal const string CannotRemoveRangeEndsBeforeItStarts = "Cannot remove a range that ends before it starts (got start= {0}, count = {1} )";
internal const string RangeEndForRemoveExceedsArrayLength = "Range end for remove exceeds the length of the array(got start = {0}, count = {1} )";
internal const string CannotSetItemsInNonMutableMArray = "Cannot set items in a non-mutable array";
internal const string CannotClearNonMutableMArray = "Cannot clear a non-mutable array";
internal const string CannotInsertItemsInNonMutableMArray = "Cannot insert items in a non-mutable array";
internal const string CannotClearNonMutableMDict = "Cannot clear a non-mutable MDict";
internal const string CannotSetItemsInNonMutableInMDict = "Cannot set items in a non-mutable MDict";
internal const string CreateCertAttributeEmpty = "Attribute used to create TLSIdentity cannot be bull or empty";
}
}
|
apache-2.0
|
C#
|
b9c2959da75c0e825b4d688bffab9922d17426d5
|
Convert ErrorCause properties only when not null
|
elastic/elasticsearch-net,elastic/elasticsearch-net
|
src/Elasticsearch.Net/Responses/ServerException/ErrorCauseExtensions.cs
|
src/Elasticsearch.Net/Responses/ServerException/ErrorCauseExtensions.cs
|
using System;
using System.Collections.Generic;
namespace Elasticsearch.Net
{
internal static class ErrorCauseExtensions
{
public static void FillValues(this ErrorCause rootCause, IDictionary<string, object> dict)
{
if (dict == null) return;
if (dict.TryGetValue("reason", out var reason) && reason != null) rootCause.Reason = Convert.ToString(reason);
if (dict.TryGetValue("type", out var type) && type != null) rootCause.Type = Convert.ToString(type);
if (dict.TryGetValue("stack_trace", out var stackTrace) && stackTrace != null) rootCause.StackTrace = Convert.ToString(stackTrace);
// if (dict.TryGetValue("index", out var index)) rootCause.Index = Convert.ToString(index);
// if (dict.TryGetValue("resource.id", out var resourceId)) rootCause.ResourceId = Convert.ToString(resourceId);
// if (dict.TryGetValue("resource.type", out var resourceType)) rootCause.ResourceType = Convert.ToString(resourceType);
}
}
}
|
using System;
using System.Collections.Generic;
namespace Elasticsearch.Net
{
internal static class ErrorCauseExtensions
{
public static void FillValues(this ErrorCause rootCause, IDictionary<string, object> dict)
{
if (dict == null) return;
if (dict.TryGetValue("reason", out var reason)) rootCause.Reason = Convert.ToString(reason);
if (dict.TryGetValue("type", out var type)) rootCause.Type = Convert.ToString(type);
if (dict.TryGetValue("stack_trace", out var stackTrace)) rootCause.StackTrace = Convert.ToString(stackTrace);
// if (dict.TryGetValue("index", out var index)) rootCause.Index = Convert.ToString(index);
// if (dict.TryGetValue("resource.id", out var resourceId)) rootCause.ResourceId = Convert.ToString(resourceId);
// if (dict.TryGetValue("resource.type", out var resourceType)) rootCause.ResourceType = Convert.ToString(resourceType);
}
}
}
|
apache-2.0
|
C#
|
57cf0de806be2dfbe60477e0e70fb80fee02d4f7
|
fix Control Panel
|
signumsoftware/extensions,signumsoftware/extensions,signumsoftware/framework,MehdyKarimpour/extensions,AlejandroCano/extensions,MehdyKarimpour/extensions,signumsoftware/framework,AlejandroCano/extensions
|
Signum.Web.Extensions/ControlPanel/Controllers/ControlPanelController.cs
|
Signum.Web.Extensions/ControlPanel/Controllers/ControlPanelController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Signum.Utilities;
using Signum.Entities.ControlPanel;
using Signum.Entities.Authorization;
using Signum.Entities;
using Signum.Engine;
namespace Signum.Web.ControlPanel
{
public class ControlPanelController : Controller
{
public ViewResult View(Lite<ControlPanelDN> panel)
{
return View(ControlPanelClient.ViewPrefix.Formato("ControlPanel"), panel.Retrieve());
}
public ActionResult AddNewPart()
{
string partType = Request.Form["newPartType"];
var cp = this.ExtractEntity<ControlPanelDN>().ApplyChanges(this.ControllerContext, "", true).Value;
var lastColumn = 0.To(cp.NumberOfColumns).WithMin(c => cp.Parts.Count(p => p.Column == c));
var newPart = new PanelPart
{
Column = lastColumn,
Row = (cp.Parts.Where(a => a.Column == lastColumn).Max(a => (int?)a.Row + 1) ?? 0),
Title = "",
Content = (IPartDN)Activator.CreateInstance(Navigator.ResolveType(partType))
};
cp.Parts.Add(newPart);
return Navigator.NormalPage(this, cp);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Signum.Utilities;
using Signum.Entities.ControlPanel;
using Signum.Entities.Authorization;
using Signum.Entities;
using Signum.Engine;
namespace Signum.Web.ControlPanel
{
public class ControlPanelController : Controller
{
public ViewResult View(Lite<ControlPanelDN> panel)
{
return View(ControlPanelClient.ViewPrefix.Formato("ControlPanel"), panel.Retrieve());
}
public ActionResult AddNewPart()
{
string partType = Request.Form["newPartType"];
var cp = this.ExtractEntity<ControlPanelDN>().ApplyChanges(this.ControllerContext, "", true).Value;
var firstColumnParts = cp.Parts.Where(p => p.Column == 1).ToList();
var higherRowFirstColumn = firstColumnParts.Any() ? firstColumnParts.Max(p => p.Row) : 0;
var newPart = new PanelPart
{
Row = higherRowFirstColumn + 1,
Column = 1,
Title = "",
Content = (IPartDN)Activator.CreateInstance(Navigator.ResolveType(partType))
};
cp.Parts.Add(newPart);
return Navigator.NormalPage(this, cp);
}
}
}
|
mit
|
C#
|
3b5d796b611f2c0f35127a1b2557d25cb5bf69e7
|
Update CSharpHelloWorld.cs
|
MadMrCrazy/hello-world
|
CSharpHelloWorld.cs
|
CSharpHelloWorld.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
Console.ReadLine();
}
}
}
https://mva.microsoft.com/en-us/training-courses/c-fundamentals-for-absolute-beginners-16169?l=p90QdGQIC_7106218949
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
Console.ReadLine();
}
}
}
|
unlicense
|
C#
|
a461aefd69203d42e74a3482d9fdb155f03f14aa
|
add back billing settings
|
bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core
|
src/Billing/Startup.cs
|
src/Billing/Startup.cs
|
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Bit.Core;
using Stripe;
using Bit.Core.Utilities;
using Serilog.Events;
namespace Bit.Billing
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.AddSettingsConfiguration(env, "bitwarden-Billing");
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
// Options
services.AddOptions();
// Settings
var globalSettings = services.AddGlobalSettingsServices(Configuration);
services.Configure<BillingSettings>(Configuration.GetSection("BillingSettings"));
// Stripe Billing
StripeConfiguration.SetApiKey(globalSettings.StripeApiKey);
// Repositories
services.AddSqlServerRepositories();
// Context
services.AddScoped<CurrentContext>();
// Services
services.AddBaseServices();
services.AddDefaultServices();
// Mvc
services.AddMvc();
}
public void Configure(
IApplicationBuilder app,
IHostingEnvironment env,
IApplicationLifetime appLifetime,
GlobalSettings globalSettings,
ILoggerFactory loggerFactory)
{
loggerFactory
.AddSerilog(env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error)
.AddConsole()
.AddDebug();
app.UseMvc();
}
}
}
|
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Bit.Core;
using Stripe;
using Bit.Core.Utilities;
using Serilog.Events;
namespace Bit.Billing
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.AddSettingsConfiguration(env, "bitwarden-Billing");
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
// Options
services.AddOptions();
// Settings
var globalSettings = services.AddGlobalSettingsServices(Configuration);
// Stripe Billing
StripeConfiguration.SetApiKey(globalSettings.StripeApiKey);
// Repositories
services.AddSqlServerRepositories();
// Context
services.AddScoped<CurrentContext>();
// Services
services.AddBaseServices();
services.AddDefaultServices();
// Mvc
services.AddMvc();
}
public void Configure(
IApplicationBuilder app,
IHostingEnvironment env,
IApplicationLifetime appLifetime,
GlobalSettings globalSettings,
ILoggerFactory loggerFactory)
{
loggerFactory
.AddSerilog(env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error)
.AddConsole()
.AddDebug();
app.UseMvc();
}
}
}
|
agpl-3.0
|
C#
|
06d1706fdc03f106cddfedf2d5306c07482c12e3
|
Move memory allocation from getter to constructor in Aligned.cs
|
dblock/resourcelib,resourcelib/resourcelib,resourcelib/resourcelib,dblock/resourcelib
|
Source/ResourceLib/Aligned.cs
|
Source/ResourceLib/Aligned.cs
|
using System;
using System.Runtime.InteropServices;
namespace Vestris.ResourceLib
{
/// <summary>
/// Creates an 8 bit aligned copy of the buffer if it is not already aligned
/// </summary>
internal sealed class Aligned : IDisposable
{
private IntPtr _ptr;
private bool allocated;
private bool Disposed => _ptr == IntPtr.Zero;
public IntPtr Ptr
{
get
{
if (Disposed)
throw new ObjectDisposedException(nameof(Aligned));
return _ptr;
}
}
public Aligned(IntPtr lp, int size)
{
if (lp == IntPtr.Zero)
throw new ArgumentException("Cannot align a null pointer.", nameof(lp));
if (lp.ToInt64() % 8 == 0)
{
_ptr = lp;
allocated = false;
}
else
{
_ptr = Marshal.AllocHGlobal(size);
allocated = true;
Kernel32.CopyMemory(_ptr, lp, (uint)size);
}
}
public void Dispose()
{
if (!allocated || Disposed)
return;
Marshal.FreeHGlobal(_ptr);
_ptr = IntPtr.Zero;
}
}
}
|
using System;
using System.Runtime.InteropServices;
namespace Vestris.ResourceLib
{
/// <summary>
/// Creates an 8 bit aligned copy of the buffer if it is not already aligned
/// </summary>
internal sealed class Aligned : IDisposable
{
private IntPtr lp;
private IntPtr lpAligned = IntPtr.Zero;
private int _size;
private bool disposed = false;
public IntPtr Ptr
{
get
{
if (disposed)
throw new ObjectDisposedException(nameof(Aligned));
if (this.lpAligned != IntPtr.Zero)
return this.lpAligned;
if (lp.ToInt64() % 8 == 0)
return lp;
IntPtr lpAligned = Marshal.AllocHGlobal(_size);
Kernel32.CopyMemory(lpAligned, lp, (uint)_size);
return lpAligned;
}
}
public Aligned(IntPtr lp, int size)
{
this.lp = lp;
_size = size;
}
public void Dispose()
{
if (disposed || lpAligned == IntPtr.Zero)
return;
disposed = true;
Marshal.FreeHGlobal(lpAligned);
}
}
}
|
mit
|
C#
|
c16d2983ee64521199f4813e180483a89f7745df
|
Update version to 2.6.3 for dev
|
VirusFree/SharpDX,mrvux/SharpDX,TigerKO/SharpDX,andrewst/SharpDX,manu-silicon/SharpDX,waltdestler/SharpDX,Ixonos-USA/SharpDX,dazerdude/SharpDX,weltkante/SharpDX,jwollen/SharpDX,PavelBrokhman/SharpDX,waltdestler/SharpDX,andrewst/SharpDX,Ixonos-USA/SharpDX,davidlee80/SharpDX-1,weltkante/SharpDX,TechPriest/SharpDX,fmarrabal/SharpDX,VirusFree/SharpDX,TigerKO/SharpDX,waltdestler/SharpDX,jwollen/SharpDX,TigerKO/SharpDX,PavelBrokhman/SharpDX,manu-silicon/SharpDX,andrewst/SharpDX,RobyDX/SharpDX,VirusFree/SharpDX,TechPriest/SharpDX,dazerdude/SharpDX,VirusFree/SharpDX,TechPriest/SharpDX,weltkante/SharpDX,fmarrabal/SharpDX,davidlee80/SharpDX-1,jwollen/SharpDX,RobyDX/SharpDX,TigerKO/SharpDX,fmarrabal/SharpDX,sharpdx/SharpDX,dazerdude/SharpDX,manu-silicon/SharpDX,davidlee80/SharpDX-1,jwollen/SharpDX,davidlee80/SharpDX-1,manu-silicon/SharpDX,PavelBrokhman/SharpDX,mrvux/SharpDX,weltkante/SharpDX,RobyDX/SharpDX,fmarrabal/SharpDX,sharpdx/SharpDX,RobyDX/SharpDX,mrvux/SharpDX,Ixonos-USA/SharpDX,Ixonos-USA/SharpDX,dazerdude/SharpDX,PavelBrokhman/SharpDX,TechPriest/SharpDX,sharpdx/SharpDX,waltdestler/SharpDX
|
Source/SharedAssemblyInfo.cs
|
Source/SharedAssemblyInfo.cs
|
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly:AssemblyCompany("Alexandre Mutel")]
[assembly:AssemblyCopyright("Copyright © 2010-2013 Alexandre Mutel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyVersion("2.6.3")]
[assembly:AssemblyFileVersion("2.6.3")]
[assembly: NeutralResourcesLanguage("en-us")]
#if DEBUG
[assembly:AssemblyConfiguration("Debug")]
#else
[assembly:AssemblyConfiguration("Release")]
#endif
[assembly:ComVisible(false)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when public and interface: renaming", Exclude = false, ApplyToMembers = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when struct: renaming", Exclude = false, ApplyToMembers = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.*: INotifyPropertyChanged heuristics", Exclude = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when enum: forced rename", Exclude = false)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when enum: enum values pruning", Exclude = false)]
[assembly: Obfuscation(Feature = "legacy xml serialization heuristics", Exclude = true)]
[assembly: Obfuscation(Feature = "ignore InternalsVisibleToAttribute", Exclude = false)]
|
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly:AssemblyCompany("Alexandre Mutel")]
[assembly:AssemblyCopyright("Copyright © 2010-2013 Alexandre Mutel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyVersion("2.6.2")]
[assembly:AssemblyFileVersion("2.6.2")]
[assembly: NeutralResourcesLanguage("en-us")]
#if DEBUG
[assembly:AssemblyConfiguration("Debug")]
#else
[assembly:AssemblyConfiguration("Release")]
#endif
[assembly:ComVisible(false)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when public and interface: renaming", Exclude = false, ApplyToMembers = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when struct: renaming", Exclude = false, ApplyToMembers = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.*: INotifyPropertyChanged heuristics", Exclude = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when enum: forced rename", Exclude = false)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when enum: enum values pruning", Exclude = false)]
[assembly: Obfuscation(Feature = "legacy xml serialization heuristics", Exclude = true)]
[assembly: Obfuscation(Feature = "ignore InternalsVisibleToAttribute", Exclude = false)]
|
mit
|
C#
|
6a624d95d45d6710fcfeaa379f2c9e9c228eb2ac
|
Update SimpleInjectorJobActivator.cs
|
devmondo/HangFire.SimpleInjector
|
src/HangFire.SimpleInjector/SimpleInjectorJobActivator.cs
|
src/HangFire.SimpleInjector/SimpleInjectorJobActivator.cs
|
using System;
using SimpleInjector;
using SimpleInjector.Lifestyles;
namespace Hangfire.SimpleInjector
{
public class SimpleInjectorJobActivator : JobActivator
{
private readonly Container _container;
public SimpleInjectorJobActivator(Container container)
{
if (container == null)
{
throw new ArgumentNullException("container");
}
_container = container;
}
public override object ActivateJob(Type jobType)
{
return _container.GetInstance(jobType);
}
public override JobActivatorScope BeginScope(JobActivatorContext context)
{
var scope = AsyncScopedLifestyle.BeginScope(_container);
return new SimpleInjectorScope(_container, scope);
}
}
internal class SimpleInjectorScope : JobActivatorScope
{
private readonly Container _container;
private readonly Scope _scope;
public SimpleInjectorScope(Container container, Scope scope)
{
_container = container;
_scope = scope;
}
public override object Resolve(Type type)
{
return _container.GetInstance(type);
}
public override void DisposeScope()
{
_scope.Dispose();
}
}
}
|
using System;
using Injector = SimpleInjector;
namespace Hangfire.SimpleInjector
{
public class SimpleInjectorJobActivator : JobActivator
{
private readonly Injector.Container _container;
private readonly Injector.Lifestyle _lifestyle;
public SimpleInjectorJobActivator(Injector.Container container)
{
if (container == null)
{
throw new ArgumentNullException("container");
}
_container = container;
}
public SimpleInjectorJobActivator(Injector.Container container, Injector.Lifestyle lifestyle)
{
if (container == null)
{
throw new ArgumentNullException("container");
}
if (lifestyle == null)
{
throw new ArgumentNullException("lifestyle");
}
_container = container;
_lifestyle = lifestyle;
}
public override object ActivateJob(Type jobType)
{
return _container.GetInstance(jobType);
}
public override JobActivatorScope BeginScope(JobActivatorContext context)
{
if (_lifestyle == null || _lifestyle != Injector.Lifestyle.Scoped)
{
return new SimpleInjectorScope(_container, Injector.Lifestyles.AsyncScopedLifestyle.BeginScope(_container));
}
return new SimpleInjectorScope(_container, new Injector.Lifestyles.AsyncScopedLifestyle().GetCurrentScope(_container));
}
}
internal class SimpleInjectorScope : JobActivatorScope
{
private readonly Injector.Container _container;
private readonly Injector.Scope _scope;
public SimpleInjectorScope(Injector.Container container, Injector.Scope scope)
{
_container = container;
_scope = scope;
}
public override object Resolve(Type type)
{
return _container.GetInstance(type);
}
public override void DisposeScope()
{
if (_scope != null)
{
_scope.Dispose();
}
}
}
}
|
mit
|
C#
|
e4c57adf6f5ce5303759209cca3d94ea1d8dc4fb
|
Bump version
|
jkonecki/Streamstone,james-andrewsmith/Streamstone
|
Source/Streamstone.Version.cs
|
Source/Streamstone.Version.cs
|
using System;
using System.Linq;
using System.Reflection;
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
|
using System;
using System.Linq;
using System.Reflection;
[assembly: AssemblyVersion("0.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
|
apache-2.0
|
C#
|
93afc7732edd4b0f290e681c550e5d749aa64bb3
|
Improve encoding aware
|
ronnieoverby/DbUp,WiRuc/DbUp,JakeGinnivan/DbUp,aggieben/DbUp,dazinator/DbUp,TicketSolutionsPtyLtd/DbUp,DbUp/DbUp
|
src/DbUp/Engine/SqlScript.cs
|
src/DbUp/Engine/SqlScript.cs
|
using System.IO;
using System.Text;
namespace DbUp.Engine
{
/// <summary>
/// Represents a SQL Server script that comes from an embedded resource in an assembly.
/// </summary>
public class SqlScript
{
private readonly string contents;
private readonly string name;
/// <summary>
/// Initializes a new instance of the <see cref="SqlScript"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="contents">The contents.</param>
public SqlScript(string name, string contents)
{
this.name = name;
this.contents = contents;
}
/// <summary>
/// Gets the contents of the script.
/// </summary>
/// <value></value>
public virtual string Contents
{
get { return contents; }
}
/// <summary>
/// Gets the name of the script.
/// </summary>
/// <value></value>
public string Name
{
get { return name; }
}
/// <summary>
///
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static SqlScript FromFile(string path)
{
using (FileStream fileStream = new FileStream(path, FileMode.Open))
{
var fileName = new FileInfo(path).Name;
return FromStream(fileName, fileStream);
}
}
/// <summary>
///
/// </summary>
/// <param name="scriptName"></param>
/// <param name="stream"></param>
/// <returns></returns>
public static SqlScript FromStream(string scriptName, Stream stream)
{
using (var resourceStreamReader = new StreamReader(stream, Encoding.Default, true))
{
string c = resourceStreamReader.ReadToEnd();
return new SqlScript(scriptName, c);
}
}
}
}
|
using System.IO;
using System.Text;
namespace DbUp.Engine
{
/// <summary>
/// Represents a SQL Server script that comes from an embedded resource in an assembly.
/// </summary>
public class SqlScript
{
private readonly string contents;
private readonly string name;
/// <summary>
/// Initializes a new instance of the <see cref="SqlScript"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="contents">The contents.</param>
public SqlScript(string name, string contents)
{
this.name = name;
this.contents = contents;
}
/// <summary>
/// Gets the contents of the script.
/// </summary>
/// <value></value>
public virtual string Contents
{
get { return contents; }
}
/// <summary>
/// Gets the name of the script.
/// </summary>
/// <value></value>
public string Name
{
get { return name; }
}
/// <summary>
///
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static SqlScript FromFile(string path)
{
using (StreamReader streamReader = new StreamReader(path, Encoding.Default, true))
{
var contents = streamReader.ReadToEnd();
streamReader.Close();
var fileName = new FileInfo(path).Name;
return new SqlScript(fileName, contents);
}
}
/// <summary>
///
/// </summary>
/// <param name="scriptName"></param>
/// <param name="stream"></param>
/// <returns></returns>
public static SqlScript FromStream(string scriptName, Stream stream)
{
using (var resourceStreamReader = new StreamReader(stream))
{
string c = resourceStreamReader.ReadToEnd();
return new SqlScript(scriptName, c);
}
}
}
}
|
mit
|
C#
|
5ddfe049f05973e9bb351121d0cb90d605cc5fe0
|
Fix nullability
|
nikeee/HolzShots
|
src/HolzShots.Capture.Video/Capture/Video/FFmpeg/HttpClientExtensions.cs
|
src/HolzShots.Capture.Video/Capture/Video/FFmpeg/HttpClientExtensions.cs
|
using System;
using System.Net.Http;
using System.IO;
using System.Threading.Tasks;
using HolzShots.Net;
using System.Threading;
namespace HolzShots.Capture.Video.FFmpeg
{
/// <summary> Ref: https://stackoverflow.com/a/46497896 </summary>
public static class HttpClientExtensions
{
public static async Task DownloadAsync(this HttpClient client, string requestUri, Stream destination, IProgress<TransferProgress>? progress = default, CancellationToken cancellationToken? = default)
{
// Get the http headers first to examine the content length
using var response = await client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
var contentLength = response.Content.Headers.ContentLength;
using var download = await response.Content.ReadAsStreamAsync(cancellationToken);
// Ignore progress reporting when no progress reporter was
// passed or when the content length is unknown
if (progress == null || !contentLength.HasValue)
{
await download.CopyToAsync(destination, cancellationToken);
return;
}
var totalData = new MemSize(contentLength!.Value);
// Convert absolute progress (bytes downloaded) into relative progress (0% - 100%)
var relativeProgress = new Progress<long>(bytesLoaded => progress.Report(new TransferProgress(new MemSize(bytesLoaded), totalData, UploadState.Processing)));
// Use extension method to report progress while downloading
await download.CopyToAsync(destination, 81920, relativeProgress, cancellationToken);
progress.Report(new TransferProgress(totalData, totalData, UploadState.Finished));
}
}
}
|
using System;
using System.Net.Http;
using System.IO;
using System.Threading.Tasks;
using HolzShots.Net;
using System.Threading;
namespace HolzShots.Capture.Video.FFmpeg
{
/// <summary> Ref: https://stackoverflow.com/a/46497896 </summary>
public static class HttpClientExtensions
{
public static async Task DownloadAsync(this HttpClient client, string requestUri, Stream destination, IProgress<TransferProgress> progress = null, CancellationToken cancellationToken = default)
{
// Get the http headers first to examine the content length
using var response = await client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
var contentLength = response.Content.Headers.ContentLength;
using var download = await response.Content.ReadAsStreamAsync(cancellationToken);
// Ignore progress reporting when no progress reporter was
// passed or when the content length is unknown
if (progress == null || !contentLength.HasValue)
{
await download.CopyToAsync(destination, cancellationToken);
return;
}
var totalData = new MemSize(contentLength!.Value);
// Convert absolute progress (bytes downloaded) into relative progress (0% - 100%)
var relativeProgress = new Progress<long>(bytesLoaded => progress.Report(new TransferProgress(new MemSize(bytesLoaded), totalData, UploadState.Processing)));
// Use extension method to report progress while downloading
await download.CopyToAsync(destination, 81920, relativeProgress, cancellationToken);
progress.Report(new TransferProgress(totalData, totalData, UploadState.Finished));
}
}
}
|
agpl-3.0
|
C#
|
d50205c91eb11b7085663835e61844e4c58d01e8
|
fix standard tests
|
agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov
|
WebAPI.API.Tests/Commands/StandardizeRouteNameCommandTests.cs
|
WebAPI.API.Tests/Commands/StandardizeRouteNameCommandTests.cs
|
using NUnit.Framework;
using WebAPI.API.Commands.Geocode;
using WebAPI.Common.Executors;
using WebAPI.Domain;
namespace WebAPI.API.Tests.Commands
{
[TestFixture]
public class StandardizeRouteNameCommandTests
{
[TestCase("15", SideDelineation.P, ExpectedResult = "0015PM")]
[TestCase("I15", SideDelineation.P, ExpectedResult = "0015PM")]
[TestCase("I 15", SideDelineation.P, ExpectedResult = "0015PM")]
[TestCase("I-15", SideDelineation.P, ExpectedResult = "0015PM")]
[TestCase("0015", SideDelineation.P, ExpectedResult = "0015PM")]
[TestCase("I - 15", SideDelineation.P, ExpectedResult = "0015PM")]
[TestCase("I", SideDelineation.P, ExpectedResult = null)]
[TestCase("I - 5", SideDelineation.P, ExpectedResult = "0005PM")]
[TestCase("I - 515", SideDelineation.P, ExpectedResult = "0515PM")]
[TestCase("I - 1515", SideDelineation.P, ExpectedResult = "1515PM")]
[TestCase("I - 15 14", SideDelineation.P, ExpectedResult = null)]
public string CleansInterstate(string route, SideDelineation side)
{
var command = new StandardizeRouteNameCommand(route, side);
return CommandExecutor.ExecuteCommand(command);
}
}
}
|
using NUnit.Framework;
using WebAPI.API.Commands.Geocode;
using WebAPI.Common.Executors;
namespace WebAPI.API.Tests.Commands
{
[TestFixture]
public class StandardizeRouteNameCommandTests
{
[TestCase("15", ExpectedResult = "0015")]
[TestCase("I15", ExpectedResult = "0015")]
[TestCase("I 15", ExpectedResult = "0015")]
[TestCase("I-15", ExpectedResult = "0015")]
[TestCase("0015", ExpectedResult = "0015")]
[TestCase("I - 15", ExpectedResult = "0015")]
[TestCase("I", ExpectedResult = null)]
[TestCase("I - 5", ExpectedResult = "0005")]
[TestCase("I - 515", ExpectedResult = "0515")]
[TestCase("I - 1515", ExpectedResult = "1515")]
[TestCase("I - 15 14", ExpectedResult = null)]
public string CleansInterstate(string route)
{
var command = new StandardizeRouteNameCommand(route);
return CommandExecutor.ExecuteCommand(command);
}
}
}
|
mit
|
C#
|
105729f19cd7febafdbe2c8f2240bfe9c813d694
|
Add synthesis window to iSTFT
|
protyposis/Aurio,protyposis/Aurio
|
Aurio/Aurio/Features/InverseSTFT.cs
|
Aurio/Aurio/Features/InverseSTFT.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aurio.Streams;
namespace Aurio.Features {
/// <summary>
/// Inverse Short-Time Fourier Tranformation.
/// Takes a number of raw FFT frames and converts them to a continuous audio stream by using the overlap-add method.
/// </summary>
public class InverseSTFT : OLA {
private float[] frameBuffer;
private PFFFT.PFFFT fft;
private WindowFunction synthesisWindow;
public InverseSTFT(IAudioWriterStream stream, int windowSize, int hopSize, int fftSize, WindowType windowType)
: base(stream, windowSize, hopSize) {
if (fftSize < windowSize) {
throw new ArgumentOutOfRangeException("fftSize must be >= windowSize");
}
frameBuffer = new float[fftSize];
fft = new PFFFT.PFFFT(fftSize, PFFFT.Transform.Real);
synthesisWindow = WindowUtil.GetFunction(windowType, windowSize);
}
public InverseSTFT(IAudioWriterStream stream, int windowSize, int hopSize, WindowType windowType)
: this(stream, windowSize, hopSize, windowSize, windowType) {
}
/// <summary>
/// Writes a raw FFT result frame into the output audio stream.
/// </summary>
/// <param name="fftResult">raw FFT frame as output by STFT in OutputFormat.Raw mode</param>
public override void WriteFrame(float[] fftResult) {
if (fftResult.Length != fft.Size) {
throw new ArgumentException("the provided FFT result array has an invalid size");
}
OnFrameWrittenInverseSTFT(fftResult);
// do inverse fourier transform
fft.Backward(fftResult, frameBuffer);
// Apply synthesis window
synthesisWindow.Apply(frameBuffer);
base.WriteFrame(frameBuffer);
}
/// <summary>
/// Flushes remaining buffered data to the output audio stream.
/// </summary>
public override void Flush() {
base.Flush();
}
protected virtual void OnFrameWrittenInverseSTFT(float[] frame) {
// to be overridden
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aurio.Streams;
namespace Aurio.Features {
/// <summary>
/// Inverse Short-Time Fourier Tranformation.
/// Takes a number of raw FFT frames and converts them to a continuous audio stream by using the overlap-add method.
/// </summary>
public class InverseSTFT : OLA {
private float[] frameBuffer;
private PFFFT.PFFFT fft;
public InverseSTFT(IAudioWriterStream stream, int windowSize, int hopSize, int fftSize)
: base(stream, windowSize, hopSize) {
if (fftSize < windowSize) {
throw new ArgumentOutOfRangeException("fftSize must be >= windowSize");
}
frameBuffer = new float[fftSize];
fft = new PFFFT.PFFFT(fftSize, PFFFT.Transform.Real);
}
public InverseSTFT(IAudioWriterStream stream, int windowSize, int hopSize)
: this(stream, windowSize, hopSize, windowSize) {
}
/// <summary>
/// Writes a raw FFT result frame into the output audio stream.
/// </summary>
/// <param name="fftResult">raw FFT frame as output by STFT in OutputFormat.Raw mode</param>
public override void WriteFrame(float[] fftResult) {
if (fftResult.Length != fft.Size) {
throw new ArgumentException("the provided FFT result array has an invalid size");
}
OnFrameWrittenInverseSTFT(fftResult);
// do inverse fourier transform
fft.Backward(fftResult, frameBuffer);
base.WriteFrame(frameBuffer);
}
/// <summary>
/// Flushes remaining buffered data to the output audio stream.
/// </summary>
public override void Flush() {
base.Flush();
}
protected virtual void OnFrameWrittenInverseSTFT(float[] frame) {
// to be overridden
}
}
}
|
agpl-3.0
|
C#
|
5efd138e526636e3be1f7c895768b7ddc2cda484
|
Use Type as a key...instead of a string.
|
kylos101/CircuitBreaker
|
CircuitBreaker/CircuitBreakerStateStoreFactory.cs
|
CircuitBreaker/CircuitBreakerStateStoreFactory.cs
|
using System;
using System.Collections.Concurrent;
namespace CircuitBreaker
{
public class CircuitBreakerStateStoreFactory
{
private static ConcurrentDictionary<Type, ICircuitBreakerStateStore> _stateStores =
new ConcurrentDictionary<Type, ICircuitBreakerStateStore>();
internal static ICircuitBreakerStateStore GetCircuitBreakerStateStore(ICircuit circuit)
{
// There is only one type of ICircuitBreakerStateStore to return...
// The ConcurrentDictionary keeps track of ICircuitBreakerStateStore objects (across threads)
// For example, a store for a db connection, web service client, and NAS storage could exist
if (!_stateStores.ContainsKey(circuit.GetType()))
{
_stateStores.TryAdd(circuit.GetType(), new CircuitBreakerStateStore(circuit));
}
return _stateStores[circuit.GetType()];
}
// TODO: Add the ability for Circuit breaker stateStores to update the state in this dictionary?
}
}
|
using System.Collections.Concurrent;
namespace CircuitBreaker
{
public class CircuitBreakerStateStoreFactory
{
private static ConcurrentDictionary<string, ICircuitBreakerStateStore> _stateStores =
new ConcurrentDictionary<string, ICircuitBreakerStateStore>();
internal static ICircuitBreakerStateStore GetCircuitBreakerStateStore(ICircuit circuit)
{
// There is only one type of ICircuitBreakerStateStore to return...
// The ConcurrentDictionary keeps track of ICircuitBreakerStateStore objects (across threads)
// For example, a store for a db connection, web service client, and NAS storage could exist
if (!_stateStores.ContainsKey(circuit.GetType().Name))
{
_stateStores.TryAdd(circuit.GetType().Name, new CircuitBreakerStateStore(circuit));
}
return _stateStores[circuit.GetType().Name];
}
// TODO: Add the ability for Circuit breaker stateStores to update the state in this dictionary?
}
}
|
mit
|
C#
|
9559d111df6481f71d7ae8e268ca216d512aa733
|
Change backup name fomat
|
aruhan/ie10histbackup
|
HistBackup/Model.cs
|
HistBackup/Model.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.IO;
using System.Diagnostics;
namespace HistBackup
{
class Model : BindableBase
{
public static readonly Model Singleton = new Model();
public string SystemDirectory { get; private set; }
public string BackupDirectory
{
get { return _backupDirectory; }
set { SetProperty(ref _backupDirectory, value, "BackupDirectory"); }
}
public string RestoreDirectory
{
get { return _restoreDirectory; }
set { SetProperty(ref _restoreDirectory, value, "RestoreDirectory"); }
}
public Model()
{
SystemDirectory = Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Microsoft\Windows\WebCache");
var datetime = DateTime.Now.ToString("yyyy-MM-dd hhmmyy");
_backupDirectory = Path.Combine(BaseDir(), datetime);
}
public bool DoBackup()
{
var exepath = Path.Combine(BaseDir(), "HoboCopy.exe");
var psi = new ProcessStartInfo(
exepath,
String.Format("{0} {1}", SystemDirectory, BackupDirectory));
var process = Process.Start(psi);
process.WaitForExit();
return process.ExitCode == 0;
}
private string _backupDirectory;
private string _restoreDirectory;
private static string BaseDir()
{
return Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.IO;
using System.Diagnostics;
namespace HistBackup
{
class Model : BindableBase
{
public static readonly Model Singleton = new Model();
public string SystemDirectory { get; private set; }
public string BackupDirectory
{
get { return _backupDirectory; }
set { SetProperty(ref _backupDirectory, value, "BackupDirectory"); }
}
public string RestoreDirectory
{
get { return _restoreDirectory; }
set { SetProperty(ref _restoreDirectory, value, "RestoreDirectory"); }
}
public Model()
{
SystemDirectory = Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Microsoft\Windows\WebCache");
var datetime = DateTime.Now.ToString("yyyyMMdd-hhmmyy");
_backupDirectory = Path.Combine(BaseDir(), datetime);
}
public bool DoBackup()
{
var exepath = Path.Combine(BaseDir(), "HoboCopy.exe");
var psi = new ProcessStartInfo(
exepath,
String.Format("{0} {1}", SystemDirectory, BackupDirectory));
var process = Process.Start(psi);
process.WaitForExit();
return process.ExitCode == 0;
}
private string _backupDirectory;
private string _restoreDirectory;
private static string BaseDir()
{
return Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);
}
}
}
|
mit
|
C#
|
5649fa31b0bd9a8220b1dc36c8ba73e0ad7cfa4f
|
Update version info.
|
msgpack/msgpack-cli,modulexcite/msgpack-cli,modulexcite/msgpack-cli,scopely/msgpack-cli,undeadlabs/msgpack-cli,scopely/msgpack-cli,msgpack/msgpack-cli,undeadlabs/msgpack-cli
|
src/CommonAssemblyInfo.Pack.cs
|
src/CommonAssemblyInfo.Pack.cs
|
#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010-2012 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion -- License Terms --
// Global informations for all MsgPack assemblies(except -RPC assemblies).
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: ComVisible( false )]
// This version represents API compatibility.
// Major : Represents Major update like re-architecting, remove obsoleted APIs etc.
// Minor : Represents Minor update like adding new feature, obsoleting APIs, fix specification issues, etc.
// Build/Revision : Always 0 since CLI implementations does not care these number, so these changes cause some binding failures.
[assembly: AssemblyVersion( "0.4.0.0" )]
// This version represents libarary 'version' for human beings.
// Major : Same as AssemblyVersion.
// Minor : Same as AssemblyVersion.
// Build : Bug fixes and improvements, which does not break API contract, but may break some code depends on internal implementation behaviors.
// For example, some programs use reflection to retrieve private fields, analyse human readable exception messages or stack trace, or so.
// Revision : Not used. It might be used to indicate target platform.
[assembly: AssemblyInformationalVersion( "0.4.0" )]
|
#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010-2012 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion -- License Terms --
// Global informations for all MsgPack assemblies(except -RPC assemblies).
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: ComVisible( false )]
// This version represents API compatibility.
// Major : Represents Major update like re-architecting, remove obsoleted APIs etc.
// Minor : Represents Minor update like adding new feature, obsoleting APIs, fix specification issues, etc.
// Build/Revision : Always 0 since CLI implementations does not care these number, so these changes cause some binding failures.
[assembly: AssemblyVersion( "0.3.0.0" )]
// This version represents libarary 'version' for human beings.
// Major : Same as AssemblyVersion.
// Minor : Same as AssemblyVersion.
// Build : Bug fixes and improvements, which does not break API contract, but may break some code depends on internal implementation behaviors.
// For example, some programs use reflection to retrieve private fields, analyse human readable exception messages or stack trace, or so.
// Revision : Not used. It might be used to indicate target platform.
[assembly: AssemblyInformationalVersion( "0.3.2" )]
|
apache-2.0
|
C#
|
22dd1bfc03fc5dc88340bf0369aee956a16e6757
|
Rename classes
|
barbosatek/Softmex.Test
|
src/Moker.Tests/TestForTest.cs
|
src/Moker.Tests/TestForTest.cs
|
using Moker.Tests.Artifacts;
using Moq;
using NUnit.Framework;
namespace Moker.Tests
{
[TestFixture]
public class TestForSingleDependencyTests : TestFor<ClassWithSingleInterfaceConstructor>
{
[Test]
public void Should_Initialize_Instance()
{
Assert.IsNotNull(Target);
Assert.IsTrue(Target.GetType() == typeof(ClassWithSingleInterfaceConstructor));
}
}
[TestFixture]
public class TestForNoDependenciesTests : TestFor<ClassWithEmptyDefaultConstructor>
{
[Test]
public void Should_Initialize_Instance()
{
Assert.IsNotNull(Target);
Assert.IsTrue(Target.GetType() == typeof(ClassWithEmptyDefaultConstructor));
}
[Test]
public void Should_Add_Any_Mocks()
{
var dependency = The<IDependencyA>();
Assert.IsTrue(dependency.GetType() == typeof(Mock<IDependencyA>));
}
[Test]
public void Should_Persist_Mocks_As_Singletons()
{
var expected = "A";
var dependency = The<IDependencyA>();
dependency.Setup(x => x.Value).Returns(expected);
var anotherDependency = The<IDependencyA>();
Assert.AreEqual("A", anotherDependency.Object.Value);
}
}
}
|
using Moker.Tests.Artifacts;
using Moq;
using NUnit.Framework;
namespace Moker.Tests
{
[TestFixture]
public class ClassWithSingleDependencyTests : TestFor<ClassWithSingleInterfaceConstructor>
{
[Test]
public void Should_Initialize_Instance()
{
Assert.IsNotNull(Target);
Assert.IsTrue(Target.GetType() == typeof(ClassWithSingleInterfaceConstructor));
}
}
[TestFixture]
public class ClassWithNoDependenciesTests : TestFor<ClassWithEmptyDefaultConstructor>
{
[Test]
public void Should_Initialize_Instance()
{
Assert.IsNotNull(Target);
Assert.IsTrue(Target.GetType() == typeof(ClassWithEmptyDefaultConstructor));
}
[Test]
public void Should_Add_Any_Mocks()
{
var dependency = The<IDependencyA>();
Assert.IsTrue(dependency.GetType() == typeof(Mock<IDependencyA>));
}
[Test]
public void Should_Persist_Mocks_As_Singletons()
{
var expected = "A";
var dependency = The<IDependencyA>();
dependency.Setup(x => x.Value).Returns(expected);
var anotherDependency = The<IDependencyA>();
Assert.AreEqual("A", anotherDependency.Object.Value);
}
}
}
|
mit
|
C#
|
e6c32325846af1d0f2e736436096c525139684e2
|
Build and publish nuget package
|
bfriesen/Rock.StaticDependencyInjection,RockFramework/Rock.StaticDependencyInjection
|
src/Properties/AssemblyInfo.cs
|
src/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.StaticDependencyInjection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Rock.StaticDependencyInjection")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6ce9fe22-010d-441a-b954-7c924537a503")]
// 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.1.4")]
[assembly: AssemblyInformationalVersion("1.1.4")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.StaticDependencyInjection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Rock.StaticDependencyInjection")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6ce9fe22-010d-441a-b954-7c924537a503")]
// 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.1.3")]
[assembly: AssemblyInformationalVersion("1.1.3")]
|
mit
|
C#
|
99954bad1bac252af3796468062dda0eb044e659
|
Include TransitionTime in LightState, fix for #95
|
Q42/Q42.HueApi
|
src/Q42.HueApi/Models/State.cs
|
src/Q42.HueApi/Models/State.cs
|
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Q42.HueApi.Converters;
using System;
using System.Runtime.Serialization;
namespace Q42.HueApi
{
[DataContract]
public class State
{
[DataMember(Name = "on")]
public bool On { get; set; }
[DataMember(Name = "bri")]
public byte Brightness { get; set; }
[DataMember(Name = "hue")]
public int? Hue { get; set; }
[DataMember(Name = "sat")]
public int? Saturation { get; set; }
[DataMember(Name = "xy")]
public double[] ColorCoordinates { get; set; }
[DataMember(Name = "ct")]
public int? ColorTemperature { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[DataMember(Name = "alert")]
public Alert Alert { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[DataMember(Name = "effect")]
public Effect? Effect { get; set; }
[DataMember(Name = "colormode")]
public string ColorMode { get; set; }
[DataMember(Name = "reachable")]
public bool? IsReachable { get; set; }
[DataMember(Name = "transitiontime")]
[JsonConverter(typeof(TransitionTimeConverter))]
public TimeSpan? TransitionTime { get; set; }
}
}
|
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Q42.HueApi
{
[DataContract]
public class State
{
[DataMember (Name = "on")]
public bool On { get; set; }
[DataMember (Name = "bri")]
public byte Brightness { get; set; }
[DataMember (Name = "hue")]
public int? Hue { get; set; }
[DataMember (Name = "sat")]
public int? Saturation { get; set; }
[DataMember (Name = "xy")]
public double[] ColorCoordinates { get; set; }
[DataMember (Name = "ct")]
public int? ColorTemperature { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[DataMember (Name = "alert")]
public Alert Alert { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[DataMember (Name = "effect")]
public Effect? Effect { get; set; }
[DataMember (Name = "colormode")]
public string ColorMode { get; set; }
[DataMember (Name = "reachable")]
public bool? IsReachable { get; set; }
}
}
|
mit
|
C#
|
efebfec8c8cbecf1ccdd4f6f019467b8ecbe81d1
|
Enable potentially higher performance text rendering
|
HelloKitty/317refactor
|
src/Rs317.Client.WF/Program.cs
|
src/Rs317.Client.WF/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Rs317.Sharp
{
public static class Program
{
public static async Task Main(string[] args)
{
try
{
Application.SetCompatibleTextRenderingDefault(false);
Console.WriteLine($"RS2 user client - release #{317}");
args = new string[] { "0", "0", "highmem", "members", "0" };
int localWorldId = int.Parse(args[0]);
short portOffset = (short)int.Parse(args[1]);
bool membersWorld;
if(args[3] == "free")
membersWorld = false;
else if(args[3] == "members")
{
membersWorld = true;
}
else
{
Console.WriteLine("Usage: node-id, port-offset, [lowmem/highmem], [free/members], storeid");
return;
}
signlink.storeid = int.Parse(args[4]);
Task clientRunningAwaitable = signlink.startpriv(IPAddress.Parse("127.0.0.1"));
//Wait for signlink
while (!signlink.IsSignLinkThreadActive)
await Task.Delay(50)
.ConfigureAwait(false);
Client client1 = new Client(new ClientConfiguration(localWorldId, portOffset, membersWorld));
client1.createClientFrame(765, 503);
await clientRunningAwaitable
.ConfigureAwait(false);
}
catch(Exception exception)
{
throw new InvalidOperationException($"Erorr: {exception.Message} \n\n Stack: {exception.StackTrace}");
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace Rs317.Sharp
{
public static class Program
{
public static async Task Main(string[] args)
{
try
{
Console.WriteLine($"RS2 user client - release #{317}");
args = new string[] { "0", "0", "highmem", "members", "0" };
int localWorldId = int.Parse(args[0]);
short portOffset = (short)int.Parse(args[1]);
bool membersWorld;
if(args[3] == "free")
membersWorld = false;
else if(args[3] == "members")
{
membersWorld = true;
}
else
{
Console.WriteLine("Usage: node-id, port-offset, [lowmem/highmem], [free/members], storeid");
return;
}
signlink.storeid = int.Parse(args[4]);
Task clientRunningAwaitable = signlink.startpriv(IPAddress.Parse("127.0.0.1"));
//Wait for signlink
while (!signlink.IsSignLinkThreadActive)
await Task.Delay(50)
.ConfigureAwait(false);
Client client1 = new Client(new ClientConfiguration(localWorldId, portOffset, membersWorld));
client1.createClientFrame(765, 503);
await clientRunningAwaitable
.ConfigureAwait(false);
}
catch(Exception exception)
{
throw new InvalidOperationException($"Erorr: {exception.Message} \n\n Stack: {exception.StackTrace}");
}
}
}
}
|
mit
|
C#
|
4725caca461d69297d96f41fd80878a307e0a3b2
|
fix paramref
|
dersia/Prism
|
Source/Xamarin/Prism.Autofac.Forms/Modularity/AutofacModuleInitializer.cs
|
Source/Xamarin/Prism.Autofac.Forms/Modularity/AutofacModuleInitializer.cs
|
using System;
using Prism.Modularity;
using Autofac;
namespace Prism.Autofac.Modularity
{
public class AutofacModuleInitializer : IModuleInitializer
{
readonly IComponentContext _context;
/// <summary>
/// Create a new instance of <see cref="AutofacModuleInitializer"/> with <paramref name="context"/>
/// </summary>
/// <param name="context"></param>
public AutofacModuleInitializer(IComponentContext context)
{
_context = context;
}
public void Initialize(ModuleInfo moduleInfo)
{
var module = (IModule)_context.Resolve(moduleInfo.ModuleType);
if (module != null)
module.Initialize();
}
/// <summary>
/// Create the <see cref="IModule"/> for <paramref name="moduleType"/> by resolving from <see cref="_context"/>
/// </summary>
/// <param name="moduleType">Type of module to create</param>
/// <returns>An isntance of <see cref="IModule"/> for <paramref name="moduleType"/> if exists; otherwise <see langword="null" /></returns>
protected virtual IModule CreateModule(Type moduleType)
{
return _context.Resolve(moduleType) as IModule;
}
}
}
|
using System;
using Prism.Modularity;
using Autofac;
namespace Prism.Autofac.Modularity
{
public class AutofacModuleInitializer : IModuleInitializer
{
readonly IComponentContext _context;
/// <summary>
/// Create a new instance of <see cref="AutofacModuleInitializer"/> with <paramref name="container"/>
/// </summary>
/// <param name="context"></param>
public AutofacModuleInitializer(IComponentContext context)
{
_context = context;
}
public void Initialize(ModuleInfo moduleInfo)
{
var module = (IModule)_context.Resolve(moduleInfo.ModuleType);
if (module != null)
module.Initialize();
}
/// <summary>
/// Create the <see cref="IModule"/> for <paramref name="moduleType"/> by resolving from <see cref="_context"/>
/// </summary>
/// <param name="moduleType">Type of module to create</param>
/// <returns>An isntance of <see cref="IModule"/> for <paramref name="moduleType"/> if exists; otherwise <see langword="null" /></returns>
protected virtual IModule CreateModule(Type moduleType)
{
return _context.Resolve(moduleType) as IModule;
}
}
}
|
apache-2.0
|
C#
|
5ec6ced8baa0a2306c3a0a26fb7eb2c5b82304af
|
Update User.cshtml add CRLF
|
leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net
|
Joinrpg/Views/Shared/DisplayTemplates/User.cshtml
|
Joinrpg/Views/Shared/DisplayTemplates/User.cshtml
|
@model JoinRpg.DataModel.User
@if (Model == null)
{
<span>нет</span>
return;
}
<a class="join-user" href="@Url.Action("Details", "User", new {Model.UserId})"><i class="glyphicon glyphicon-user"></i>@Model.DisplayName.Trim()</a>
|
@model JoinRpg.DataModel.User
@if (Model == null)
{
<span>нет</span>
return;
}
<a class="join-user" href="@Url.Action("Details", "User", new {Model.UserId})"><i class="glyphicon glyphicon-user"></i>@Model.DisplayName.Trim()</a>
|
mit
|
C#
|
52651b9feccdcbd317c2c6f871fc4fe18c3a74cb
|
Use continue to reduce one indentation level.
|
alldne/school,alldne/school
|
School/REPL/REPL.cs
|
School/REPL/REPL.cs
|
using System;
using Mono.Terminal;
namespace School.REPL
{
public class REPL
{
public REPL()
{
}
public void Run()
{
Evaluator evaluator = new Evaluator();
LineEditor editor = new LineEditor("School");
Console.WriteLine("School REPL:");
string line;
while ((line = editor.Edit("> ", "")) != null)
{
if (String.IsNullOrWhiteSpace(line))
continue;
try {
Value value = evaluator.Evaluate(line);
Console.WriteLine(value);
} catch (Exception e) {
Console.WriteLine(e);
}
}
}
}
}
|
using System;
using Mono.Terminal;
namespace School.REPL
{
public class REPL
{
public REPL()
{
}
public void Run()
{
Evaluator evaluator = new Evaluator();
LineEditor editor = new LineEditor("School");
Console.WriteLine("School REPL:");
string line;
while ((line = editor.Edit("> ", "")) != null)
{
if (!String.IsNullOrWhiteSpace(line))
{
try {
Value value = evaluator.Evaluate(line);
Console.WriteLine(value);
} catch (Exception e) {
Console.WriteLine(e);
}
}
}
}
}
}
|
apache-2.0
|
C#
|
09893a64a889eddcd3d7767d7772559c522a068a
|
Update ILiteDbRepository.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/LiteDB/ILiteDbRepository.cs
|
TIKSN.Core/Data/LiteDB/ILiteDbRepository.cs
|
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.LiteDB
{
public interface ILiteDbRepository<TDocument, TIdentity> : IRepository<TDocument>, IQueryRepository<TDocument, TIdentity>, IStreamRepository<TDocument> where TDocument : IEntity<TIdentity> where TIdentity : IEquatable<TIdentity>
{
Task AddOrUpdateAsync(TDocument entity, CancellationToken cancellationToken);
Task AddOrUpdateRangeAsync(IEnumerable<TDocument> entities, CancellationToken cancellationToken);
}
}
|
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.LiteDB
{
public interface ILiteDbRepository<TDocument, TIdentity> : IRepository<TDocument>, IQueryRepository<TDocument, TIdentity> where TDocument : IEntity<TIdentity> where TIdentity : IEquatable<TIdentity>
{
Task AddOrUpdateAsync(TDocument entity, CancellationToken cancellationToken);
Task AddOrUpdateRangeAsync(IEnumerable<TDocument> entities, CancellationToken cancellationToken);
}
}
|
mit
|
C#
|
4a7a98f49b1bbb8edd630a01c7c20eed9d00ca8e
|
Add ReadFile methods
|
paiden/Nett
|
Source/Nett/Toml.cs
|
Source/Nett/Toml.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Nett
{
public class Toml
{
public static string WriteString<T>(T obj)
{
TomlTable tt = TomlTable.From(obj);
using (var ms = new MemoryStream(1024))
{
var sw = new StreamWriter(ms);
tt.WriteTo(sw);
sw.Flush();
ms.Position = 0;
StreamReader sr = new StreamReader(ms);
return sr.ReadToEnd();
}
}
public static T Read<T>(string toRead)
{
return Read<T>(toRead, TomlConfig.DefaultInstance);
}
public static T Read<T>(string toRead, TomlConfig tomlConfig)
{
TomlTable tt = Read(toRead);
T result = tt.Get<T>(tomlConfig);
return result;
}
public static TomlTable Read(string toRead)
{
byte[] bytes = Encoding.UTF8.GetBytes(toRead);
using (var ms = new MemoryStream())
{
StreamWriter writer = new StreamWriter(ms);
writer.Write(toRead);
writer.Flush();
ms.Position = 0;
return StreamTomlSerializer.Deserialize(ms);
}
}
public static T ReadFile<T>(string filePath)
{
return ReadFile<T>(filePath, TomlConfig.DefaultInstance);
}
public static T ReadFile<T>(string filePath, TomlConfig config)
{
var tt = ReadFile(filePath, config);
return tt.Get<T>();
}
public static TomlTable ReadFile(string filePath)
{
return ReadFile(filePath, TomlConfig.DefaultInstance);
}
public static TomlTable ReadFile(string filePath, TomlConfig config)
{
using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
return StreamTomlSerializer.Deserialize(fs);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Nett
{
public class Toml
{
public static string WriteString<T>(T obj)
{
TomlTable tt = TomlTable.From(obj);
using (var ms = new MemoryStream(1024))
{
var sw = new StreamWriter(ms);
tt.WriteTo(sw);
sw.Flush();
ms.Position = 0;
StreamReader sr = new StreamReader(ms);
return sr.ReadToEnd();
}
}
public static T Read<T>(string toRead)
{
return Read<T>(toRead, TomlConfig.DefaultInstance);
}
public static T Read<T>(string toRead, TomlConfig tomlConfig)
{
TomlTable tt = Read(toRead);
T result = tt.Get<T>(tomlConfig);
return result;
}
public static TomlTable Read(string toRead)
{
byte[] bytes = Encoding.UTF8.GetBytes(toRead);
using (var ms = new MemoryStream())
{
StreamWriter writer = new StreamWriter(ms);
writer.Write(toRead);
writer.Flush();
ms.Position = 0;
return StreamTomlSerializer.Deserialize(ms);
}
}
}
}
|
mit
|
C#
|
fe2d7e9fb1ea73a48d3eb77ccb7f17fd9648ec15
|
Fix regex patterns in class 'RegexConstants'
|
lury-lang/lury-lexer
|
lury-lexer/RegexConstants.cs
|
lury-lexer/RegexConstants.cs
|
//
// RegexConstants.cs
//
// Author:
// Tomona Nanase <nanase@users.noreply.github.com>
//
// The MIT License (MIT)
//
// Copyright (c) 2015 Tomona Nanase
//
// 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.Text.RegularExpressions;
namespace Lury.Compiling.Lexer
{
internal class RegexConstants
{
#region -- Public Static Fields --
public static readonly Regex
IntegerAndRange = new Regex(@"(?<num>0([xX][0-9a-fA-F](_?[0-9a-fA-F])*|[oO][0-7](_?[0-7])*|[bB][01](_?[01])*)|[0-9](_?[0-9])*([eE][\+\-]?[0-9](_?[0-9])*)?i?)(\.{2,3})", RegexOptions.Compiled | RegexOptions.ExplicitCapture),
FloatAndImaginary = new Regex(@"(([0-9](_?[0-9])*|(([0-9](_?[0-9])*)?\.[0-9](_?[0-9])*|[0-9](_?[0-9])*\.))[eE][\+\-]?[0-9](_?[0-9])*|(([0-9](_?[0-9])*)?\.[0-9](_?[0-9])*|[0-9](_?[0-9])*\.))i?", RegexOptions.Compiled | RegexOptions.ExplicitCapture);
#endregion
}
}
|
//
// RegexConstants.cs
//
// Author:
// Tomona Nanase <nanase@users.noreply.github.com>
//
// The MIT License (MIT)
//
// Copyright (c) 2015 Tomona Nanase
//
// 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.Text.RegularExpressions;
namespace Lury.Compiling.Lexer
{
internal class RegexConstants
{
#region -- Public Static Fields --
public static readonly Regex
IntegerAndRange = new Regex(@"(?<num>0([xX][0-9a-fA-F](_?[0-9a-fA-F])*|[oO][0-7](_?[0-7])*|[bB][01](_?[01])*)|[0-9](_?[0-9])*([eE][\+\-]?[0-9](_?[0-9])*)?i?)(\.{2,3})?", RegexOptions.Compiled | RegexOptions.ExplicitCapture),
FloatAndImaginary = new Regex(@"(([0-9](_?[0-9])*)?\.[0-9](_?[0-9])*|[0-9](_?[0-9])*\.?)([eE][\+\-]?[0-9](_?[0-9])*)?i?", RegexOptions.Compiled | RegexOptions.ExplicitCapture);
#endregion
}
}
|
mit
|
C#
|
b21a5d2d9ed5907dab966781c2d6d7151f2ff05d
|
add comments
|
bitbeans/SimpleDnsCrypt
|
SimpleDnsCrypt/Helper/DnscryptProxyConfigurationManager.cs
|
SimpleDnsCrypt/Helper/DnscryptProxyConfigurationManager.cs
|
using Nett;
using SimpleDnsCrypt.Config;
using SimpleDnsCrypt.Models;
using System;
using System.IO;
namespace SimpleDnsCrypt.Helper
{
/// <summary>
/// Class to load and save the dnscrypt configuration (TOML format).
/// </summary>
public static class DnscryptProxyConfigurationManager
{
/// <summary>
/// The global dnscrypt configuration.
/// </summary>
public static DnscryptProxyConfiguration DnscryptProxyConfiguration { get; set; }
/// <summary>
/// Loads the configuration from a .toml file.
/// </summary>
/// <returns><c>true</c> on success, otherwise <c>false</c></returns>
public static bool LoadConfiguration()
{
try
{
var configFile = Path.Combine(Directory.GetCurrentDirectory(), Global.DnsCryptProxyFolder, Global.DnsCryptConfigurationFile);
if (!File.Exists(configFile)) return false;
var settings = TomlSettings.Create(s => s.ConfigurePropertyMapping(m => m.UseTargetPropertySelector(standardSelectors => standardSelectors.IgnoreCase)));
DnscryptProxyConfiguration = Toml.ReadFile<DnscryptProxyConfiguration>(configFile, settings);
return true;
}
catch (Exception)
{
return false;
}
}
/// <summary>
/// Saves the configuration to a .toml file.
/// </summary>
/// <returns><c>true</c> on success, otherwise <c>false</c></returns>
public static bool SaveConfiguration()
{
try
{
var configFile = Path.Combine(Directory.GetCurrentDirectory(), Global.DnsCryptProxyFolder, Global.DnsCryptConfigurationFile);
var settings = TomlSettings.Create(s => s.ConfigurePropertyMapping(m => m.UseKeyGenerator(standardGenerators => standardGenerators.LowerCase)));
Toml.WriteFile(DnscryptProxyConfiguration, configFile, settings);
return true;
}
catch (Exception)
{
return false;
}
}
}
}
|
using Nett;
using SimpleDnsCrypt.Config;
using SimpleDnsCrypt.Models;
using System;
using System.IO;
namespace SimpleDnsCrypt.Helper
{
/// <summary>
///
/// </summary>
public static class DnscryptProxyConfigurationManager
{
/// <summary>
///
/// </summary>
public static DnscryptProxyConfiguration DnscryptProxyConfiguration { get; set; }
/// <summary>
///
/// </summary>
/// <returns></returns>
public static bool LoadConfiguration()
{
try
{
var configFile = Path.Combine(Directory.GetCurrentDirectory(), Global.DnsCryptProxyFolder, Global.DnsCryptConfigurationFile);
if (!File.Exists(configFile)) return false;
var settings = TomlSettings.Create(s => s.ConfigurePropertyMapping(m => m.UseTargetPropertySelector(standardSelectors => standardSelectors.IgnoreCase)));
DnscryptProxyConfiguration = Toml.ReadFile<DnscryptProxyConfiguration>(configFile, settings);
return true;
}
catch (Exception)
{
return false;
}
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public static bool SaveConfiguration()
{
try
{
var configFile = Path.Combine(Directory.GetCurrentDirectory(), Global.DnsCryptProxyFolder, Global.DnsCryptConfigurationFile);
var settings = TomlSettings.Create(s => s.ConfigurePropertyMapping(m => m.UseKeyGenerator(standardGenerators => standardGenerators.LowerCase)));
Toml.WriteFile(DnscryptProxyConfiguration, configFile, settings);
return true;
}
catch (Exception)
{
return false;
}
}
}
}
|
mit
|
C#
|
62fe792fa1ac9a9cf1b12d8460a0b78e6a8b29c7
|
Clean up null handling in UnitTestingRemoteHostClientWrapper
|
AmadeusW/roslyn,dotnet/roslyn,panopticoncentral/roslyn,wvdd007/roslyn,mgoertz-msft/roslyn,tmat/roslyn,eriawan/roslyn,mavasani/roslyn,tannergooding/roslyn,sharwell/roslyn,weltkante/roslyn,wvdd007/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,panopticoncentral/roslyn,genlu/roslyn,KevinRansom/roslyn,aelij/roslyn,jmarolf/roslyn,diryboy/roslyn,AlekseyTs/roslyn,heejaechang/roslyn,AmadeusW/roslyn,physhi/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,ErikSchierboom/roslyn,KevinRansom/roslyn,physhi/roslyn,aelij/roslyn,diryboy/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,ErikSchierboom/roslyn,brettfo/roslyn,physhi/roslyn,mgoertz-msft/roslyn,jasonmalinowski/roslyn,KirillOsenkov/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,brettfo/roslyn,sharwell/roslyn,weltkante/roslyn,sharwell/roslyn,wvdd007/roslyn,KirillOsenkov/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,aelij/roslyn,eriawan/roslyn,tannergooding/roslyn,stephentoub/roslyn,tmat/roslyn,AlekseyTs/roslyn,gafter/roslyn,eriawan/roslyn,jasonmalinowski/roslyn,gafter/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,tmat/roslyn,gafter/roslyn,dotnet/roslyn,KirillOsenkov/roslyn,weltkante/roslyn,diryboy/roslyn,brettfo/roslyn,AlekseyTs/roslyn,heejaechang/roslyn,jmarolf/roslyn,bartdesmet/roslyn,tannergooding/roslyn,heejaechang/roslyn,shyamnamboodiripad/roslyn,stephentoub/roslyn,genlu/roslyn,KevinRansom/roslyn
|
src/Workspaces/Core/Portable/ExternalAccess/UnitTesting/Api/UnitTestingRemoteHostClientWrapper.cs
|
src/Workspaces/Core/Portable/ExternalAccess/UnitTesting/Api/UnitTestingRemoteHostClientWrapper.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Remote;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api
{
internal readonly struct UnitTestingRemoteHostClientWrapper
{
internal UnitTestingRemoteHostClientWrapper(RemoteHostClient underlyingObject)
=> UnderlyingObject = underlyingObject;
internal RemoteHostClient? UnderlyingObject { get; }
[MemberNotNullWhen(false, nameof(UnderlyingObject))]
public bool IsDefault => UnderlyingObject == null;
public static async Task<UnitTestingRemoteHostClientWrapper?> TryGetClientAsync(HostWorkspaceServices services, CancellationToken cancellationToken = default)
{
var client = await RemoteHostClient.TryGetClientAsync(services, cancellationToken).ConfigureAwait(false);
if (client is null)
return null;
return new UnitTestingRemoteHostClientWrapper(client);
}
public async Task<bool> TryRunRemoteAsync(UnitTestingServiceHubService service, string targetName, Solution? solution, IReadOnlyList<object?> arguments, object? callbackTarget, CancellationToken cancellationToken)
{
Contract.ThrowIfTrue(IsDefault);
await UnderlyingObject.RunRemoteAsync((WellKnownServiceHubService)service, targetName, solution, arguments, callbackTarget, cancellationToken).ConfigureAwait(false);
return true;
}
public async Task<Optional<T>> TryRunRemoteAsync<T>(UnitTestingServiceHubService service, string targetName, Solution? solution, IReadOnlyList<object?> arguments, object? callbackTarget, CancellationToken cancellationToken)
{
Contract.ThrowIfTrue(IsDefault);
return await UnderlyingObject.RunRemoteAsync<T>((WellKnownServiceHubService)service, targetName, solution, arguments, callbackTarget, cancellationToken).ConfigureAwait(false);
}
public async Task<UnitTestingRemoteServiceConnectionWrapper> CreateConnectionAsync(UnitTestingServiceHubService service, object? callbackTarget, CancellationToken cancellationToken)
{
Contract.ThrowIfTrue(IsDefault);
return new UnitTestingRemoteServiceConnectionWrapper(await UnderlyingObject.CreateConnectionAsync((WellKnownServiceHubService)service, callbackTarget, cancellationToken).ConfigureAwait(false));
}
[Obsolete]
public event EventHandler<bool> StatusChanged
{
add
{
Contract.ThrowIfTrue(IsDefault);
UnderlyingObject.StatusChanged += value;
}
remove
{
Contract.ThrowIfTrue(IsDefault);
UnderlyingObject.StatusChanged -= value;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Remote;
namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api
{
internal readonly struct UnitTestingRemoteHostClientWrapper
{
internal UnitTestingRemoteHostClientWrapper(RemoteHostClient? underlyingObject)
=> UnderlyingObject = underlyingObject;
internal RemoteHostClient? UnderlyingObject { get; }
public bool IsDefault => UnderlyingObject == null;
public static async Task<UnitTestingRemoteHostClientWrapper?> TryGetClientAsync(HostWorkspaceServices services, CancellationToken cancellationToken = default)
=> new UnitTestingRemoteHostClientWrapper(await RemoteHostClient.TryGetClientAsync(services, cancellationToken).ConfigureAwait(false));
public async Task<bool> TryRunRemoteAsync(UnitTestingServiceHubService service, string targetName, Solution? solution, IReadOnlyList<object?> arguments, object? callbackTarget, CancellationToken cancellationToken)
{
await UnderlyingObject!.RunRemoteAsync((WellKnownServiceHubService)service, targetName, solution, arguments, callbackTarget, cancellationToken).ConfigureAwait(false);
return true;
}
public async Task<Optional<T>> TryRunRemoteAsync<T>(UnitTestingServiceHubService service, string targetName, Solution? solution, IReadOnlyList<object?> arguments, object? callbackTarget, CancellationToken cancellationToken)
=> await UnderlyingObject!.RunRemoteAsync<T>((WellKnownServiceHubService)service, targetName, solution, arguments, callbackTarget, cancellationToken).ConfigureAwait(false);
public async Task<UnitTestingRemoteServiceConnectionWrapper> CreateConnectionAsync(UnitTestingServiceHubService service, object? callbackTarget, CancellationToken cancellationToken)
=> new UnitTestingRemoteServiceConnectionWrapper(await UnderlyingObject!.CreateConnectionAsync((WellKnownServiceHubService)service, callbackTarget, cancellationToken).ConfigureAwait(false));
[Obsolete]
public event EventHandler<bool> StatusChanged
{
add => UnderlyingObject!.StatusChanged += value;
remove => UnderlyingObject!.StatusChanged -= value;
}
}
}
|
mit
|
C#
|
9583df461bb3dbe3366eb18b8a812c9ed596ffbd
|
improve test setup to work on german cultures as well
|
concordion/concordion-net,concordion/concordion-net,ShaKaRee/concordion-net,ShaKaRee/concordion-net,ShaKaRee/concordion-net,concordion/concordion-net
|
Concordion.Spec/Concordion/Command/AssertEquals/NonString/NonStringTest.cs
|
Concordion.Spec/Concordion/Command/AssertEquals/NonString/NonStringTest.cs
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Concordion.Integration;
namespace Concordion.Spec.Concordion.Command.AssertEquals.NonString
{
[ConcordionTest]
public class NonStringTest
{
public string outcomeOfPerformingAssertEquals(string fragment, string expectedString, string result, string resultType)
{
object simulatedResult;
if (resultType.Equals("String"))
{
simulatedResult = result;
}
else if (resultType.Equals("Integer"))
{
simulatedResult = Int32.Parse(result);
}
else if (resultType.Equals("Double"))
{
var customCulture = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
customCulture.NumberFormat.NumberDecimalSeparator = ".";
System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;
simulatedResult = Double.Parse(result);
}
else
{
throw new Exception("Unsupported result-type '" + resultType + "'.");
}
fragment = Regex.Replace(fragment, "\\(some expectation\\)", expectedString);
return new TestRig()
.WithStubbedEvaluationResult(simulatedResult)
.ProcessFragment(fragment)
.SuccessOrFailureInWords();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Concordion.Integration;
namespace Concordion.Spec.Concordion.Command.AssertEquals.NonString
{
[ConcordionTest]
public class NonStringTest
{
public string outcomeOfPerformingAssertEquals(string fragment, string expectedString, string result, string resultType)
{
object simulatedResult;
if (resultType.Equals("String"))
{
simulatedResult = result;
}
else if (resultType.Equals("Integer"))
{
simulatedResult = Int32.Parse(result);
}
else if (resultType.Equals("Double"))
{
simulatedResult = Double.Parse(result);
}
else
{
throw new Exception("Unsupported result-type '" + resultType + "'.");
}
fragment = Regex.Replace(fragment, "\\(some expectation\\)", expectedString);
return new TestRig()
.WithStubbedEvaluationResult(simulatedResult)
.ProcessFragment(fragment)
.SuccessOrFailureInWords();
}
}
}
|
apache-2.0
|
C#
|
be041a42ff4503e93deabaf550225d4bff1b1102
|
introduce TsReferenceCollection
|
isukces/isukces.code
|
isukces.code/Typescript/TsFile.cs
|
isukces.code/Typescript/TsFile.cs
|
using System.Collections.Generic;
using isukces.code.interfaces;
using isukces.code.IO;
namespace isukces.code.Typescript
{
public class TsFile : ITsCodeProvider
{
public bool SaveIfDifferent(string filename, bool addBom = false)
{
return CodeFileUtils.SaveIfDifferent(GetCode(), filename, addBom);
}
public override string ToString()
{
return GetCode();
}
public void WriteCodeTo(ITsCodeWriter writer)
{
foreach (var i in References.Items)
i.WriteCodeTo(writer);
foreach (var i in Members)
i.WriteCodeTo(writer);
}
private string GetCode()
{
var ctx = new TsCodeWriter();
WriteCodeTo(ctx);
return ctx.Code;
}
public TsReferenceCollection References { get; } = new TsReferenceCollection();
public List<ITsCodeProvider> Members { get; } = new List<ITsCodeProvider>();
}
public class TsReferenceCollection
{
public void Add(TsReference item)
{
if (_added.Add(item))
_items.Add(item);
}
public IReadOnlyList<TsReference> Items => _items;
private readonly HashSet<TsReference> _added = new HashSet<TsReference>();
private readonly List<TsReference> _items = new List<TsReference>();
}
}
|
using System.Collections.Generic;
using isukces.code.interfaces;
using isukces.code.IO;
namespace isukces.code.Typescript
{
public class TsFile : ITsCodeProvider
{
public bool SaveIfDifferent(string filename, bool addBom = false)
{
return CodeFileUtils.SaveIfDifferent(GetCode(), filename, addBom);
}
public override string ToString()
{
return GetCode();
}
public void WriteCodeTo(ITsCodeWriter writer)
{
foreach (var i in References)
i.WriteCodeTo(writer);
foreach (var i in Members)
i.WriteCodeTo(writer);
}
private string GetCode()
{
var ctx = new TsCodeWriter();
WriteCodeTo(ctx);
return ctx.Code;
}
public List<TsReference> References { get; } = new List<TsReference>();
public List<ITsCodeProvider> Members { get; } = new List<ITsCodeProvider>();
}
}
|
mit
|
C#
|
677e8af387f2a4d87ff6e848ec1da7aaefbf38eb
|
Disable failing tests. Porting to non-generic set would require changes to the whole group of tests cases that, since they are based on a common model and a base test fixture.
|
nkreipke/nhibernate-core,livioc/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,lnu/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,hazzik/nhibernate-core,livioc/nhibernate-core,RogerKratz/nhibernate-core,alobakov/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,alobakov/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,nkreipke/nhibernate-core,ngbrown/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,livioc/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,alobakov/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core
|
src/NHibernate.Test/MultipleCollectionFetchTest/MultipleSetFetchFixture.cs
|
src/NHibernate.Test/MultipleCollectionFetchTest/MultipleSetFetchFixture.cs
|
using System;
using System.Collections;
using System.Net.NetworkInformation;
using NUnit.Framework;
namespace NHibernate.Test.MultipleCollectionFetchTest
{
[TestFixture]
[Ignore("Support for non-generic sets removed. To test generic set instead, need to duplicate or port the sister test fixtures too.")]
public class MultipleSetFetchFixture : AbstractMultipleCollectionFetchFixture
{
protected override IList Mappings
{
get { return new string[] {"MultipleCollectionFetchTest.PersonSet.hbm.xml"}; }
}
protected override void AddToCollection(ICollection collection, Person person)
{
//((ISet) collection).Add(person);
throw new NotImplementedException();
}
protected override ICollection CreateCollection()
{
throw new NotImplementedException();
//return new HashedSet();
}
}
}
|
using System;
using System.Collections;
using Iesi.Collections;
using NUnit.Framework;
namespace NHibernate.Test.MultipleCollectionFetchTest
{
[TestFixture]
public class MultipleSetFetchFixture : AbstractMultipleCollectionFetchFixture
{
protected override IList Mappings
{
get { return new string[] {"MultipleCollectionFetchTest.PersonSet.hbm.xml"}; }
}
protected override void AddToCollection(ICollection collection, Person person)
{
((ISet) collection).Add(person);
}
protected override ICollection CreateCollection()
{
return new HashedSet();
}
}
}
|
lgpl-2.1
|
C#
|
d487b6cc4507e853e68fc28611dfc2541491cab1
|
Use top level program for the Worker template
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp/Program.cs
|
src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp/Program.cs
|
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Company.Application1;
using IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddHostedService<Worker>();
})
.Build();
await host.RunAsync();
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Company.Application1
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<Worker>();
});
}
}
|
apache-2.0
|
C#
|
fdc82931395b61fbdedc91c3becd15570d0b07d3
|
Remove unnecessary conversion operator. Make struct readonly.
|
dotnet/roslyn,tannergooding/roslyn,shyamnamboodiripad/roslyn,agocke/roslyn,weltkante/roslyn,jmarolf/roslyn,AlekseyTs/roslyn,abock/roslyn,swaroop-sridhar/roslyn,bartdesmet/roslyn,davkean/roslyn,diryboy/roslyn,gafter/roslyn,agocke/roslyn,tmat/roslyn,weltkante/roslyn,eriawan/roslyn,DustinCampbell/roslyn,gafter/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,physhi/roslyn,cston/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,dotnet/roslyn,swaroop-sridhar/roslyn,gafter/roslyn,dpoeschl/roslyn,reaction1989/roslyn,bartdesmet/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,brettfo/roslyn,stephentoub/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tannergooding/roslyn,genlu/roslyn,davkean/roslyn,heejaechang/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,jmarolf/roslyn,dpoeschl/roslyn,jcouv/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,agocke/roslyn,swaroop-sridhar/roslyn,jasonmalinowski/roslyn,abock/roslyn,heejaechang/roslyn,KevinRansom/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,tmat/roslyn,AmadeusW/roslyn,shyamnamboodiripad/roslyn,xasx/roslyn,abock/roslyn,xasx/roslyn,brettfo/roslyn,nguerrera/roslyn,nguerrera/roslyn,AlekseyTs/roslyn,VSadov/roslyn,KirillOsenkov/roslyn,eriawan/roslyn,heejaechang/roslyn,mavasani/roslyn,reaction1989/roslyn,davkean/roslyn,panopticoncentral/roslyn,aelij/roslyn,xasx/roslyn,KevinRansom/roslyn,aelij/roslyn,jcouv/roslyn,stephentoub/roslyn,sharwell/roslyn,diryboy/roslyn,VSadov/roslyn,mgoertz-msft/roslyn,jcouv/roslyn,reaction1989/roslyn,sharwell/roslyn,ErikSchierboom/roslyn,AmadeusW/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,genlu/roslyn,tmat/roslyn,DustinCampbell/roslyn,MichalStrehovsky/roslyn,ErikSchierboom/roslyn,physhi/roslyn,KirillOsenkov/roslyn,jmarolf/roslyn,MichalStrehovsky/roslyn,wvdd007/roslyn,dpoeschl/roslyn,panopticoncentral/roslyn,weltkante/roslyn,wvdd007/roslyn,jasonmalinowski/roslyn,DustinCampbell/roslyn,mgoertz-msft/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,mgoertz-msft/roslyn,genlu/roslyn,stephentoub/roslyn,cston/roslyn,mavasani/roslyn,bartdesmet/roslyn,MichalStrehovsky/roslyn,sharwell/roslyn,VSadov/roslyn,CyrusNajmabadi/roslyn,aelij/roslyn,cston/roslyn,tannergooding/roslyn,brettfo/roslyn,nguerrera/roslyn
|
src/Workspaces/Core/Portable/EmbeddedLanguages/VirtualChars/VirtualChar.cs
|
src/Workspaces/Core/Portable/EmbeddedLanguages/VirtualChars/VirtualChar.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars
{
/// <summary>
/// The Regex and Json parsers wants to work over an array of characters, however this array of
/// characters is not the same as the array of characters a user types into a string in C# or
/// VB. For example In C# someone may write: @"\z". This should appear to the user the same as
/// if they wrote "\\z" and the same as "\\\u007a". However, as these all have wildly different
/// presentations for the user, there needs to be a way to map back the characters it sees ( '\'
/// and 'z' ) back to the ranges of characters the user wrote.
///
/// VirtualChar serves this purpose. It contains the interpreted value of any language
/// character/character-escape-sequence, as well as the original SourceText span where that
/// interpreted character was created from. This allows the regex and json parsers to both
/// process input from any language uniformly, but then also produce trees and diagnostics that
/// map back properly to the original source text locations that make sense to the user.
/// </summary>
internal readonly struct VirtualChar : IEquatable<VirtualChar>
{
public readonly char Char;
public readonly TextSpan Span;
public VirtualChar(char @char, TextSpan span)
{
if (span.IsEmpty)
{
throw new ArgumentException("Span should not be empty.", nameof(span));
}
Char = @char;
Span = span;
}
public override bool Equals(object obj)
=> obj is VirtualChar vc && Equals(vc);
public bool Equals(VirtualChar other)
=> Char == other.Char &&
Span == other.Span;
public override int GetHashCode()
{
unchecked
{
var hashCode = 244102310;
hashCode = hashCode * -1521134295 + Char.GetHashCode();
hashCode = hashCode * -1521134295 + Span.GetHashCode();
return hashCode;
}
}
public static bool operator ==(VirtualChar char1, VirtualChar char2)
=> char1.Equals(char2);
public static bool operator !=(VirtualChar char1, VirtualChar char2)
=> !(char1 == char2);
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars
{
/// <summary>
/// The Regex and Json parsers wants to work over an array of characters, however this array of
/// characters is not the same as the array of characters a user types into a string in C# or
/// VB. For example In C# someone may write: @"\z". This should appear to the user the same as
/// if they wrote "\\z" and the same as "\\\u007a". However, as these all have wildly different
/// presentations for the user, there needs to be a way to map back the characters it sees ( '\'
/// and 'z' ) back to the ranges of characters the user wrote.
///
/// VirtualChar serves this purpose. It contains the interpreted value of any language
/// character/character-escape-sequence, as well as the original SourceText span where that
/// interpreted character was created from. This allows the regex and json parsers to both
/// process input from any language uniformly, but then also produce trees and diagnostics that
/// map back properly to the original source text locations that make sense to the user.
/// </summary>
internal struct VirtualChar : IEquatable<VirtualChar>
{
public readonly char Char;
public readonly TextSpan Span;
public VirtualChar(char @char, TextSpan span)
{
if (span.IsEmpty)
{
throw new ArgumentException("Span should not be empty.", nameof(span));
}
Char = @char;
Span = span;
}
public override bool Equals(object obj)
=> obj is VirtualChar vc && Equals(vc);
public bool Equals(VirtualChar other)
=> Char == other.Char &&
Span == other.Span;
public override int GetHashCode()
{
unchecked
{
var hashCode = 244102310;
hashCode = hashCode * -1521134295 + Char.GetHashCode();
hashCode = hashCode * -1521134295 + Span.GetHashCode();
return hashCode;
}
}
public static bool operator ==(VirtualChar char1, VirtualChar char2)
=> char1.Equals(char2);
public static bool operator !=(VirtualChar char1, VirtualChar char2)
=> !(char1 == char2);
public static implicit operator char(VirtualChar vc) => vc.Char;
}
}
|
mit
|
C#
|
7d0e21b0837c7fc808b85b4588cb7887493098cb
|
Correct erroneous using statement.
|
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
|
Test/AdventureWorksFunctionalModel/ModelConfig.cs
|
Test/AdventureWorksFunctionalModel/ModelConfig.cs
|
using NakedObjects.Menu; //TODO: Replace with NakedFramework version when working.
using System;
using System.Collections.Generic;
using System.Linq;
namespace AW
{
public static class ModelConfig
{
public static Type[] EntityTypes() =>
Classes.Where(t => t.Namespace == "AW.Types").ToArray();
public static Type[] FunctionTypes() =>
Classes.Where(t => t.Namespace == "AW.Functions" && t.IsAbstract && t.IsSealed).ToArray();
//IsAbstract && IsSealed tests for a static class. Not really necessary here, just extra safety check.
private static IEnumerable<Type> Classes =>
typeof(ModelConfig).Assembly.GetTypes().Where(t => t.IsClass);
public static IMenu[] MainMenus(IMenuFactory mf) =>
FunctionTypes().Where(t => t.FullName.Contains("MenuFunctions")).Select(t => mf.NewMenu(t)).ToArray();
}
}
|
using NakedObjects.Menu; //TODO: Replace with NakedFramework version when working.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Configuration;
namespace AW
{
public static class ModelConfig
{
public static Type[] EntityTypes() =>
Classes.Where(t => t.Namespace == "AW.Types").ToArray();
public static Type[] FunctionTypes() =>
Classes.Where(t => t.Namespace == "AW.Functions" && t.IsAbstract && t.IsSealed).ToArray();
//IsAbstract && IsSealed tests for a static class. Not really necessary here, just extra safety check.
private static IEnumerable<Type> Classes =>
typeof(ModelConfig).Assembly.GetTypes().Where(t => t.IsClass);
public static IMenu[] MainMenus(IMenuFactory mf) =>
FunctionTypes().Where(t => t.FullName.Contains("MenuFunctions")).Select(t => mf.NewMenu(t)).ToArray();
}
}
|
apache-2.0
|
C#
|
55cb703968e43c9612c86a8be388db18a1aecc05
|
Bump ver to 2.2.7
|
RazorGenerator/RazorGenerator,RazorGenerator/RazorGenerator,wizzardmr42/RazorGenerator
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System;
using System.Reflection;
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyProduct("RazorGenerator")]
[assembly: AssemblyCompany("RazorGenerator contributors")]
[assembly: AssemblyInformationalVersion("2.2.7")]
|
using System;
using System.Reflection;
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyProduct("RazorGenerator")]
[assembly: AssemblyCompany("RazorGenerator contributors")]
[assembly: AssemblyInformationalVersion("2.2.6")]
|
apache-2.0
|
C#
|
caf68e9c227c5a7aac485aefafb54f665ff32a00
|
Clear down dispatcher queue on disconnect.
|
micdenny/EasyNetQ.Management.Client,chinaboard/EasyNetQ.Management.Client,EasyNetQ/EasyNetQ.Management.Client,EasyNetQ/EasyNetQ.Management.Client,alexwiese/EasyNetQ.Management.Client,Pliner/EasyNetQ.Management.Client,Pliner/EasyNetQ.Management.Client,micdenny/EasyNetQ.Management.Client,LawrenceWard/EasyNetQ.Management.Client
|
Source/Version.cs
|
Source/Version.cs
|
using System.Reflection;
// EasyNetQ version number: <major>.<minor>.<non-breaking-feature>.<build>
[assembly: AssemblyVersion("0.14.4.0")]
// Note: until version 1.0 expect breaking changes on 0.X versions.
// 0.14.4.0 Consumer dispatcher queue cleared after connection lost.
// 0.14.3.0 IConsumerErrorStrategy not being disposed fix
// 0.14.2.0 MessageProperties serialization fix
// 0.14.1.0 Fixed missing properties in error message
// 0.14.0.0 Big internal consumer rewrite
// 0.13.0.0 AutoSubscriber moved to EasyNetQ.AutoSubscribe namespace.
// 0.12.4.0 Factored ConsumerDispatcher out of QueueingConsumerFactory.
// 0.12.3.0 Upgrade to RabbitMQ.Client 3.1.1
// 0.12.2.0 Requested Heartbeat on by default
// 0.12.1.0 Factored declares out of AdvancedBus publish and consume.
// 0.11.1.0 New plugable validation strategy (IMessageValidationStrategy)
// 0.11.0.0 Exchange durability can be configured
// 0.10.1.0 EasyNetQ.Trace
// 0.10.0.0 John-Mark Newton's RequestAsync API change
// 0.9.2.0 C# style property names on Management.Client
// 0.9.1.0 Upgrade to RabbitMQ.Client 3.0.0.0
// 0.9.0.0 Management
// 0.8.4.0 Better client information sent to RabbitMQ
// 0.8.3.0 ConsumerErrorStrategy ack strategy
// 0.8.2.0 Publisher confirms
// 0.8.1.0 Prefetch count can be configured with the prefetchcount connection string value.
// 0.8.0.0 Fluent publisher & subscriber configuration. Breaking change to IBus and IPublishChannel.
// 0.7.2.0 Cluster support
// 0.7.1.0 Daniel Wertheim's AutoSubscriber
// 0.7.0.0 Added IServiceProvider to make it easy to plug in your own dependencies. Some breaking changes to RabbitHutch
// 0.6.3.0 Consumer Queue now uses BCL BlockingCollection.
// 0.6.2.0 New model cleanup strategy based on consumer tracking
// 0.6.1.0 Removed InMemoryBus, Removed concrete class dependencies from FuturePublish.
// 0.6 Introduced IAdvancedBus, refactored IBus
// 0.5 Added IPublishChannel and moved Publish and Request to it from IBus
// 0.4 Topic based routing
// 0.3 Upgrade to RabbitMQ.Client 2.8.1.0
// 0.2 Upgrade to RabbitMQ.Client 2.7.0.0
// 0.1 Initial
|
using System.Reflection;
// EasyNetQ version number: <major>.<minor>.<non-breaking-feature>.<build>
[assembly: AssemblyVersion("0.14.3.0")]
// Note: until version 1.0 expect breaking changes on 0.X versions.
// 0.14.3.0 IConsumerErrorStrategy not being disposed fix
// 0.14.2.0 MessageProperties serialization fix
// 0.14.1.0 Fixed missing properties in error message
// 0.14.0.0 Big internal consumer rewrite
// 0.13.0.0 AutoSubscriber moved to EasyNetQ.AutoSubscribe namespace.
// 0.12.4.0 Factored ConsumerDispatcher out of QueueingConsumerFactory.
// 0.12.3.0 Upgrade to RabbitMQ.Client 3.1.1
// 0.12.2.0 Requested Heartbeat on by default
// 0.12.1.0 Factored declares out of AdvancedBus publish and consume.
// 0.11.1.0 New plugable validation strategy (IMessageValidationStrategy)
// 0.11.0.0 Exchange durability can be configured
// 0.10.1.0 EasyNetQ.Trace
// 0.10.0.0 John-Mark Newton's RequestAsync API change
// 0.9.2.0 C# style property names on Management.Client
// 0.9.1.0 Upgrade to RabbitMQ.Client 3.0.0.0
// 0.9.0.0 Management
// 0.8.4.0 Better client information sent to RabbitMQ
// 0.8.3.0 ConsumerErrorStrategy ack strategy
// 0.8.2.0 Publisher confirms
// 0.8.1.0 Prefetch count can be configured with the prefetchcount connection string value.
// 0.8.0.0 Fluent publisher & subscriber configuration. Breaking change to IBus and IPublishChannel.
// 0.7.2.0 Cluster support
// 0.7.1.0 Daniel Wertheim's AutoSubscriber
// 0.7.0.0 Added IServiceProvider to make it easy to plug in your own dependencies. Some breaking changes to RabbitHutch
// 0.6.3.0 Consumer Queue now uses BCL BlockingCollection.
// 0.6.2.0 New model cleanup strategy based on consumer tracking
// 0.6.1.0 Removed InMemoryBus, Removed concrete class dependencies from FuturePublish.
// 0.6 Introduced IAdvancedBus, refactored IBus
// 0.5 Added IPublishChannel and moved Publish and Request to it from IBus
// 0.4 Topic based routing
// 0.3 Upgrade to RabbitMQ.Client 2.8.1.0
// 0.2 Upgrade to RabbitMQ.Client 2.7.0.0
// 0.1 Initial
|
mit
|
C#
|
619371206293baa772b236d6b0e2bd660db81430
|
Clean DWMApi.ColorizationColor
|
rchcomm/Captura
|
Utility/DWMApi.cs
|
Utility/DWMApi.cs
|
using System.Runtime.InteropServices;
using System.Windows.Media;
namespace Captura
{
public static class DWMApi
{
const string DllName = "dwmapi.dll";
[DllImport(DllName)]
static extern int DwmGetColorizationColor(ref int Color, [MarshalAs(UnmanagedType.Bool)] ref bool Opaque);
[DllImport(DllName)]
static extern int DwmIsCompositionEnabled(out bool Enabled);
public static Color ColorizationColor
{
get
{
bool dwm;
DwmIsCompositionEnabled(out dwm);
if (!dwm)
return Colors.DarkBlue;
var color = 0;
var opaque = true;
DwmGetColorizationColor(ref color, ref opaque);
return Color.FromArgb(255, (byte)(color >> 16), (byte)(color >> 8), (byte)color);
}
}
}
}
|
using System.Runtime.InteropServices;
using System.Windows.Media;
namespace Captura
{
public static class DWMApi
{
const string DllName = "dwmapi.dll";
[DllImport(DllName)]
static extern int DwmGetColorizationColor(ref int Color, [MarshalAs(UnmanagedType.Bool)] ref bool Opaque);
[DllImport(DllName)]
static extern int DwmIsCompositionEnabled(out bool Enabled);
public static Color ColorizationColor
{
get
{
bool dwm;
DwmIsCompositionEnabled(out dwm);
if (!dwm)
return Colors.DarkBlue;
var color = 0;
var opaque = true;
DwmGetColorizationColor(ref color, ref opaque);
var c = System.Drawing.Color.FromArgb(color);
return Color.FromArgb(c.A, c.R, c.G, c.B);
}
}
}
}
|
mit
|
C#
|
c8bb1ff5b3923cb3fff6001458dd6377f987a828
|
Fix string representation of Command
|
yishn/GTPWrapper
|
GTPWrapper/Command.cs
|
GTPWrapper/Command.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GTPWrapper {
/// <summary>
/// Represents a GTP command.
/// </summary>
public class Command {
/// <summary>
/// Gets an optional command id.
/// </summary>
public int? Id { get; private set; }
/// <summary>
/// Gets the name of the command.
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Gets a list of arguments.
/// </summary>
public List<string> Arguments { get; private set; }
/// <summary>
/// Initializes a new instance of the Command class.
/// </summary>
/// <param name="input">A string of the form "[id] command_name [arguments]"</param>
public Command(string input) {
input = input.Trim();
int id, start;
string[] inputs = input.Split(' ').Where(s => !string.IsNullOrWhiteSpace(s)).ToArray();
if (int.TryParse(inputs[0], out id)) {
start = 1;
this.Id = id;
} else {
start = 0;
this.Id = null;
}
this.Name = inputs[start];
this.Arguments = new List<string>(inputs.Skip(start + 1));
}
/// <summary>
/// Initializes a new instance of the Command class.
/// </summary>
/// <param name="id">An optional command id.</param>
/// <param name="name">The name of the command.</param>
/// <param name="arguments">A list of arguments, separated by spaces.</param>
public Command(int? id, string name, string arguments) {
this.Id = id;
this.Name = name;
this.Arguments = arguments.Split(' ').ToList<string>();
}
/// <summary>
/// Returns a GTP-compliant string
/// </summary>
public override string ToString() {
string result = "";
result += this.Id.HasValue ? this.Id.ToString() + " " : "";
result += this.Name + " " + string.Join(" ", this.Arguments);
return result;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GTPWrapper {
/// <summary>
/// Represents a GTP command.
/// </summary>
public class Command {
/// <summary>
/// Gets an optional command id.
/// </summary>
public int? Id { get; private set; }
/// <summary>
/// Gets the name of the command.
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Gets a list of arguments.
/// </summary>
public List<string> Arguments { get; private set; }
/// <summary>
/// Initializes a new instance of the Command class.
/// </summary>
/// <param name="input">A string of the form "[id] command_name [arguments]"</param>
public Command(string input) {
input = input.Trim();
int id, start;
string[] inputs = input.Split(' ').Where(s => !string.IsNullOrWhiteSpace(s)).ToArray();
if (int.TryParse(inputs[0], out id)) {
start = 1;
this.Id = id;
} else {
start = 0;
this.Id = null;
}
this.Name = inputs[start];
this.Arguments = new List<string>(inputs.Skip(start + 1));
}
/// <summary>
/// Initializes a new instance of the Command class.
/// </summary>
/// <param name="id">An optional command id.</param>
/// <param name="name">The name of the command.</param>
/// <param name="arguments">A list of arguments, separated by spaces.</param>
public Command(int? id, string name, string arguments) {
this.Id = id;
this.Name = name;
this.Arguments = arguments.Split(' ').ToList<string>();
}
/// <summary>
/// Returns a GTP-compliant string
/// </summary>
public override string ToString() {
string result = "";
result += this.Id.HasValue ? this.Id.ToString() : "";
result += " " + this.Name + " " + string.Join(" ", this.Arguments);
return result;
}
}
}
|
mit
|
C#
|
d0e62638363125f8391a6280f47268df941b1cae
|
Fix typo
|
antonio-bakula/simpleDLNA,bra1nb3am3r/simpleDLNA,nmaier/simpleDLNA
|
GlobalAssemblyInfo.cs
|
GlobalAssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("Nils Maier")]
[assembly: AssemblyProduct("SimpleDLNA")]
[assembly: AssemblyCopyright("Copyright © 2012-2015 Nils Maier")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyInformationalVersion("1.1")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: CLSCompliant(true)]
|
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("Nils Maier")]
[assembly: AssemblyProduct("SimpleDLNA")]
[assembly: AssemblyCopyright("Copyright © 2012-2015s Nils Maier")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyInformationalVersion("1.1")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: CLSCompliant(true)]
|
bsd-2-clause
|
C#
|
2a6ee25bd3362dadd8ab004d55e1f63ffa100960
|
Fix back-to-front blocking conditional
|
peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework
|
osu.Framework.Tests/TestGame.cs
|
osu.Framework.Tests/TestGame.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.Bindables;
using osu.Framework.IO.Stores;
namespace osu.Framework.Tests
{
[Cached]
internal class TestGame : Game
{
public readonly Bindable<bool> BlockExit = new Bindable<bool>();
[BackgroundDependencyLoader]
private void load()
{
Resources.AddStore(new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(TestGame).Assembly), "Resources"));
}
protected override bool OnExiting() => !BlockExit.Value;
}
}
|
// 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.Bindables;
using osu.Framework.IO.Stores;
namespace osu.Framework.Tests
{
[Cached]
internal class TestGame : Game
{
public readonly Bindable<bool> BlockExit = new Bindable<bool>();
[BackgroundDependencyLoader]
private void load()
{
Resources.AddStore(new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(TestGame).Assembly), "Resources"));
}
protected override bool OnExiting() => BlockExit.Value;
}
}
|
mit
|
C#
|
2a00b7e16eb5b59a8f19ff0ff8d88e33972967b9
|
make Vulkan.Android friendly assembly of Vulkan
|
mono/VulkanSharp
|
src/Vulkan/Properties/AssemblyInfo.cs
|
src/Vulkan/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("Vulkan")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("Vulkan")]
[assembly: AssemblyCopyright ("Copyright (c) Xamarin Inc")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("0.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
[assembly: InternalsVisibleTo("Vulkan.Android")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("Vulkan")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("Vulkan")]
[assembly: AssemblyCopyright ("Copyright (c) Xamarin Inc")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("0.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
mit
|
C#
|
3e15bce24644eadf95e81ad0a4d69fc078c606cb
|
Increment minor -> 0.7.0
|
awseward/Bugsnag.NET,awseward/Bugsnag.NET
|
SharedAssemblyInfo.cs
|
SharedAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("0.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
[assembly: AssemblyInformationalVersion("0.7.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("0.6.0.0")]
[assembly: AssemblyFileVersion("0.6.0.0")]
[assembly: AssemblyInformationalVersion("0.6.0")]
|
mit
|
C#
|
97ba822fda48d4f2ed59cac155f35e33c12d2b91
|
fix test constructor
|
danielgerlag/workflow-core
|
src/samples/WorkflowCore.TestSample01/NUnitTest.cs
|
src/samples/WorkflowCore.TestSample01/NUnitTest.cs
|
using FluentAssertions;
using NUnit.Framework;
using System;
using WorkflowCore.Models;
using WorkflowCore.Testing;
using WorkflowCore.TestSample01.Workflow;
namespace WorkflowCore.TestSample01
{
[TestFixture]
public class NUnitTest : WorkflowTest<MyWorkflow, MyDataClass>
{
[SetUp]
protected void Setup()
{
base.Setup(false);
}
[Test]
public void NUnit_workflow_test_sample()
{
var workflowId = StartWorkflow(new MyDataClass { Value1 = 2, Value2 = 3 });
WaitForWorkflowToComplete(workflowId, TimeSpan.FromSeconds(30));
GetStatus(workflowId).Should().Be(WorkflowStatus.Complete);
UnhandledStepErrors.Count.Should().Be(0);
GetData(workflowId).Value3.Should().Be(5);
}
}
}
|
using FluentAssertions;
using NUnit.Framework;
using System;
using WorkflowCore.Models;
using WorkflowCore.Testing;
using WorkflowCore.TestSample01.Workflow;
namespace WorkflowCore.TestSample01
{
[TestFixture]
public class NUnitTest : WorkflowTest<MyWorkflow, MyDataClass>
{
[SetUp]
protected override void Setup(bool registerClassMap = false)
{
base.Setup(registerClassMap);
}
[Test]
public void NUnit_workflow_test_sample()
{
var workflowId = StartWorkflow(new MyDataClass { Value1 = 2, Value2 = 3 });
WaitForWorkflowToComplete(workflowId, TimeSpan.FromSeconds(30));
GetStatus(workflowId).Should().Be(WorkflowStatus.Complete);
UnhandledStepErrors.Count.Should().Be(0);
GetData(workflowId).Value3.Should().Be(5);
}
}
}
|
mit
|
C#
|
ba9518a1636a7707312311bd213b951f59f0e632
|
Return a value for reads from expansion RAM even though not present
|
eightlittlebits/elbgb
|
elbgb.gameboy/Memory/Mappers/RomOnly.cs
|
elbgb.gameboy/Memory/Mappers/RomOnly.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace elbgb.gameboy.Memory.Mappers
{
class RomOnly : Cartridge
{
public RomOnly(CartridgeHeader header, byte[] romData)
: base(header, romData)
{
}
public override byte ReadByte(ushort address)
{
if (address < 0x8000)
{
return _romData[address];
}
else
return 0x00;
}
public override void WriteByte(ushort address, byte value)
{
return;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace elbgb.gameboy.Memory.Mappers
{
class RomOnly : Cartridge
{
public RomOnly(CartridgeHeader header, byte[] romData)
: base(header, romData)
{
}
public override byte ReadByte(ushort address)
{
return _romData[address];
}
public override void WriteByte(ushort address, byte value)
{
return;
}
}
}
|
mit
|
C#
|
af4495cd8e2685f9e9c175f167054a92920a8b30
|
Test case naming.
|
ManufacturingIntelligence/nhibernate-core,lnu/nhibernate-core,livioc/nhibernate-core,lnu/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,RogerKratz/nhibernate-core,hazzik/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,alobakov/nhibernate-core,gliljas/nhibernate-core,RogerKratz/nhibernate-core,alobakov/nhibernate-core,livioc/nhibernate-core,nkreipke/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,ngbrown/nhibernate-core,alobakov/nhibernate-core,lnu/nhibernate-core,RogerKratz/nhibernate-core,nkreipke/nhibernate-core,ManufacturingIntelligence/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,livioc/nhibernate-core,RogerKratz/nhibernate-core,hazzik/nhibernate-core,ngbrown/nhibernate-core,hazzik/nhibernate-core,fredericDelaporte/nhibernate-core
|
src/NHibernate.Test/NHSpecificTest/NH3604/FixtureByCode.cs
|
src/NHibernate.Test/NHSpecificTest/NH3604/FixtureByCode.cs
|
using System.Linq;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Linq;
using NHibernate.Mapping.ByCode;
using NUnit.Framework;
namespace NHibernate.Test.NHSpecificTest.NH3604
{
/// <summary>
/// Tests ability to map a non-public property by code via expressions to access the hidden properties
/// </summary>
public class ByCodeFixture : TestCaseMappingByCode
{
protected override HbmMapping GetMappings()
{
var mapper = new ModelMapper();
mapper.Class<Entity>(rc =>
{
rc.Id(Entity.PropertyAccessExpressions.Id, m => m.Generator(Generators.GuidComb));
rc.Property(x => x.Name);
rc.OneToOne(x => x.Detail, m => m.Cascade(Mapping.ByCode.Cascade.All));
});
mapper.Class<EntityDetail>(rc =>
{
rc.Id(x => x.Id, m => m.Generator(new ForeignGeneratorDef(ReflectionHelper.GetProperty(EntityDetail.PropertyAccessExpressions.Entity))));
rc.OneToOne(EntityDetail.PropertyAccessExpressions.Entity, m => m.Constrained(true));
rc.Property(x => x.ExtraInfo);
});
return mapper.CompileMappingForAllExplicitlyAddedEntities();
}
protected override void OnSetUp()
{
using (ISession session = OpenSession())
using (ITransaction transaction = session.BeginTransaction())
{
var e1 = new Entity { Name = "Bob" };
session.Save(e1);
var e2 = new Entity { Name = "Sally" };
var ed2 = new EntityDetail(e2) { ExtraInfo = "Jo" };
e2.Detail = ed2;
session.Save(e2);
session.Flush();
transaction.Commit();
}
}
protected override void OnTearDown()
{
using (ISession session = OpenSession())
using (ITransaction transaction = session.BeginTransaction())
{
session.Delete("from System.Object");
session.Flush();
transaction.Commit();
}
}
[Test]
public void CanPerformQueryOnMappedClassWithProtectedProperty()
{
using (ISession session = OpenSession())
using (session.BeginTransaction())
{
var result = from e in session.Query<Entity>()
where e.Name == "Sally"
select e;
var entities = result.ToList();
Assert.AreEqual(1, entities.Count);
Assert.AreEqual("Jo", entities[0].Detail.ExtraInfo);
}
}
[Test]
public void CanWriteMappingsReferencingProtectedProperty()
{
var mapper = new ModelMapper();
mapper.Class<Entity>(rc =>
{
rc.Id(Entity.PropertyAccessExpressions.Id, m => m.Generator(Generators.GuidComb));
rc.Property(x => x.Name);
});
mapper.CompileMappingForEachExplicitlyAddedEntity().WriteAllXmlMapping();
}
}
}
|
using System.Linq;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Linq;
using NHibernate.Mapping.ByCode;
using NUnit.Framework;
namespace NHibernate.Test.NHSpecificTest.NH3604
{
/// <summary>
/// Tests ability to map a non-public property by code via expressions to access the hidden properties
/// </summary>
public class ByCodeFixture : TestCaseMappingByCode
{
protected override HbmMapping GetMappings()
{
var mapper = new ModelMapper();
mapper.Class<Entity>(rc =>
{
rc.Id(Entity.PropertyAccessExpressions.Id, m => m.Generator(Generators.GuidComb));
rc.Property(x => x.Name);
rc.OneToOne(x => x.Detail, m => m.Cascade(Mapping.ByCode.Cascade.All));
});
mapper.Class<EntityDetail>(rc =>
{
rc.Id(x => x.Id, m => m.Generator(new ForeignGeneratorDef(ReflectionHelper.GetProperty(EntityDetail.PropertyAccessExpressions.Entity))));
rc.OneToOne(EntityDetail.PropertyAccessExpressions.Entity, m => m.Constrained(true));
rc.Property(x => x.ExtraInfo);
});
return mapper.CompileMappingForAllExplicitlyAddedEntities();
}
protected override void OnSetUp()
{
using (ISession session = OpenSession())
using (ITransaction transaction = session.BeginTransaction())
{
var e1 = new Entity { Name = "Bob" };
session.Save(e1);
var e2 = new Entity { Name = "Sally" };
var ed2 = new EntityDetail(e2) { ExtraInfo = "Jo" };
e2.Detail = ed2;
session.Save(e2);
session.Flush();
transaction.Commit();
}
}
protected override void OnTearDown()
{
using (ISession session = OpenSession())
using (ITransaction transaction = session.BeginTransaction())
{
session.Delete("from System.Object");
session.Flush();
transaction.Commit();
}
}
[Test]
public void PerformQuery()
{
using (ISession session = OpenSession())
using (session.BeginTransaction())
{
var result = from e in session.Query<Entity>()
where e.Name == "Sally"
select e;
var entities = result.ToList();
Assert.AreEqual(1, entities.Count);
Assert.AreEqual("Jo", entities[0].Detail.ExtraInfo);
}
}
[Test]
public void WriteXmlMappings()
{
var mapper = new ModelMapper();
mapper.Class<Entity>(rc =>
{
rc.Id(Entity.PropertyAccessExpressions.Id, m => m.Generator(Generators.GuidComb));
rc.Property(x => x.Name);
});
mapper.CompileMappingForEachExplicitlyAddedEntity().WriteAllXmlMapping();
}
}
}
|
lgpl-2.1
|
C#
|
79af5ea24d4e48178241db63a500cc5e332acb31
|
Adjust test name
|
karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS
|
src/Markdown/Editor/Test/Tokens/TokenizeBlockTest.cs
|
src/Markdown/Editor/Test/Tokens/TokenizeBlockTest.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using FluentAssertions;
using Microsoft.Languages.Core.Classification;
using Microsoft.Languages.Core.Test.Tokens;
using Microsoft.Markdown.Editor.Tokens;
using Microsoft.UnitTests.Core.XUnit;
using Xunit;
namespace Microsoft.Markdown.Editor.Test.Tokens {
[ExcludeFromCodeCoverage]
public class TokenizeMdBlockTest : TokenizeTestBase<MarkdownToken, MarkdownTokenType> {
[CompositeTest]
[InlineData(
@"```
block
block
```
", 24)]
[InlineData(
@"```
block```
```
block
```
", 31)]
[Category.Md.Tokenizer]
public void CodeBlock01(string text, int length) {
var tokens = Tokenize(text, new MdTokenizer());
tokens.Should().HaveCount(1);
tokens[0].Should().HaveType(MarkdownTokenType.Monospace);
tokens[0].Length.Should().Be(length);
}
[CompositeTest]
[InlineData(
@"```{r}
#comment
```
")]
[Category.Md.Tokenizer]
public void CodeBlock02(string text) {
var tokens = Tokenize(text, new MdTokenizer());
tokens.Should().HaveCount(1);
tokens[0].Should().HaveType(MarkdownTokenType.Code);
tokens[0].Length.Should().Be(21);
}
[CompositeTest]
[Category.Md.Tokenizer]
[InlineData(@"`r x <- 1`")]
[InlineData(@"`rtoken`")]
public void CodeBlock03(string content) {
var tokens = Tokenize(@"`r x <- 1`", new MdTokenizer());
tokens.Should().HaveCount(1);
tokens[0].Should().HaveType(MarkdownTokenType.Code);
}
[CompositeTest]
[InlineData(@"```block```")]
[InlineData(@"```block")]
[InlineData(@"```block` ```")]
[Category.Md.Tokenizer]
public void CodeBlock04(string text) {
var tokens = Tokenize(text, new MdTokenizer());
tokens.Should().HaveCount(1);
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using FluentAssertions;
using Microsoft.Languages.Core.Classification;
using Microsoft.Languages.Core.Test.Tokens;
using Microsoft.Markdown.Editor.Tokens;
using Microsoft.UnitTests.Core.XUnit;
using Xunit;
namespace Microsoft.Markdown.Editor.Test.Tokens {
[ExcludeFromCodeCoverage]
public class TokenizeMdBlockTest : TokenizeTestBase<MarkdownToken, MarkdownTokenType> {
[CompositeTest]
[InlineData(
@"```
block
block
```
", 24)]
[InlineData(
@"```
block```
```
block
```
", 31)]
[Category.Md.Tokenizer]
public void CodeBlock01(string text, int length) {
var tokens = Tokenize(text, new MdTokenizer());
tokens.Should().HaveCount(1);
tokens[0].Should().HaveType(MarkdownTokenType.Monospace);
tokens[0].Length.Should().Be(length);
}
[CompositeTest]
[InlineData(
@"```{r}
#comment
```
")]
[Category.Md.Tokenizer]
public void CodeBlock02(string text) {
var tokens = Tokenize(text, new MdTokenizer());
tokens.Should().HaveCount(1);
tokens[0].Should().HaveType(MarkdownTokenType.Code);
tokens[0].Length.Should().Be(21);
}
[CompositeTest]
[InlineData(@"```block```")]
[InlineData(@"```block")]
[InlineData(@"```block` ```")]
[Category.Md.Tokenizer]
public void TokenizeMd_BlockEmpty(string text) {
var tokens = Tokenize(text, new MdTokenizer());
tokens.Should().BeEmpty();
}
[CompositeTest]
[Category.Md.Tokenizer]
[InlineData(@"`r x <- 1`")]
[InlineData(@"`rtoken`")]
public void CodeBlock03(string content) {
var tokens = Tokenize(@"`r x <- 1`", new MdTokenizer());
tokens.Should().HaveCount(1);
tokens[0].Should().HaveType(MarkdownTokenType.Code);
}
}
}
|
mit
|
C#
|
97032b14df5bb41a4cf4b77d919fc5a3c4773929
|
remove region
|
RadicalFx/radical
|
src/Radical/ChangeTracking/Advisory/AdvisedAction.cs
|
src/Radical/ChangeTracking/Advisory/AdvisedAction.cs
|
using Radical.ComponentModel.ChangeTracking;
using Radical.Validation;
using System;
namespace Radical.ChangeTracking
{
/// <summary>
/// Represents a suggested action produced by
/// the provisioning system of a change tracking service.
/// </summary>
public class AdvisedAction : IAdvisedAction
{
/// <summary>
/// Initializes a new instance of the <see cref="AdvisedAction"/> class.
/// </summary>
/// <param name="target">The target.</param>
/// <param name="action">The action.</param>
public AdvisedAction(object target, ProposedActions action)
{
Ensure.That(target).Named(() => target).IsNotNull();
Ensure.That(action)
.Named(() => action)
.IsDefined()
.WithMessage("None is a not supported ProposedActions value.")
.If(v => v == ProposedActions.None)
.ThenThrow(v => new NotSupportedException(v.GetFullErrorMessage()));
Target = target;
Action = action;
}
/// <summary>
/// Gets the suggested action for the target object encapsulated by this instance.
/// </summary>
/// <value>The suggested action.</value>
public ProposedActions Action
{
get;
private set;
}
/// <summary>
/// Gets the target object of the suggested action.
/// </summary>
/// <value>The target object.</value>
public object Target
{
get;
private set;
}
}
}
|
using Radical.ComponentModel.ChangeTracking;
using Radical.Validation;
using System;
namespace Radical.ChangeTracking
{
/// <summary>
/// Represents a suggested action produced by
/// the provisioning system of a change tracking service.
/// </summary>
public class AdvisedAction : IAdvisedAction
{
/// <summary>
/// Initializes a new instance of the <see cref="AdvisedAction"/> class.
/// </summary>
/// <param name="target">The target.</param>
/// <param name="action">The action.</param>
public AdvisedAction(object target, ProposedActions action)
{
Ensure.That(target).Named(() => target).IsNotNull();
Ensure.That(action)
.Named(() => action)
.IsDefined()
.WithMessage("None is a not supported ProposedActions value.")
.If(v => v == ProposedActions.None)
.ThenThrow(v => new NotSupportedException(v.GetFullErrorMessage()));
Target = target;
Action = action;
}
#region IAdvisedAction Members
/// <summary>
/// Gets the suggested action for the target object encapsulated by this instance.
/// </summary>
/// <value>The suggested action.</value>
public ProposedActions Action
{
get;
private set;
}
/// <summary>
/// Gets the target object of the suggested action.
/// </summary>
/// <value>The target object.</value>
public object Target
{
get;
private set;
}
#endregion
}
}
|
mit
|
C#
|
4cde00132cb99792e01e874f9119b17c5fbf1720
|
Hide internal implementation, since there's no value in exporting these methods
|
sbennett1990/signify.cs
|
SignifyCS/Verify.cs
|
SignifyCS/Verify.cs
|
/*
* Copyright (c) 2017 Scott Bennett <scottb@fastmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
using System;
using Sodium;
namespace SignifyCS {
public class Verify {
public static bool VerifyMessage(PubKey pub_key, Signature sig, byte[] message) {
checkAlgorithms(pub_key, sig);
checkKeys(pub_key, sig);
return verifyCrypto(sig, message, pub_key);
}
private static void checkAlgorithms(PubKey pub_key, Signature sig) {
if (!pub_key.Algorithm.Equals(BaseCryptoFile.PK_ALGORITHM)) {
throw new Exception($"unsupported public key; unexpected algorithm '{pub_key.Algorithm}'");
}
if (!sig.Algorithm.Equals(BaseCryptoFile.PK_ALGORITHM)) {
throw new Exception($"unsupported signature; unexpected algorithm '{sig.Algorithm}'");
}
}
private static void checkKeys(PubKey pub_key, Signature sig) {
if (!CryptoBytes.ConstantTimeEquals(pub_key.KeyNum, sig.KeyNum)) {
throw new Exception("verification failed: checked against wrong key");
}
}
private static bool verifyCrypto(Signature sig, byte[] message, PubKey pub_key) {
return PublicKeyAuth.VerifyDetached(sig.SigData, message, pub_key.PubKeyData);
}
}
}
|
/*
* Copyright (c) 2017 Scott Bennett <scottb@fastmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
using System;
using Sodium;
namespace SignifyCS {
public class Verify {
public static bool VerifyMessage(PubKey pub_key, Signature sig, byte[] message) {
CheckAlgorithms(pub_key, sig);
CheckKeys(pub_key, sig);
return VerifyCrypto(sig, message, pub_key);
}
public static void CheckAlgorithms(PubKey pub_key, Signature sig) {
if (!pub_key.Algorithm.Equals(BaseCryptoFile.PK_ALGORITHM)) {
throw new Exception($"unsupported public key; unexpected algorithm '{pub_key.Algorithm}'");
}
if (!sig.Algorithm.Equals(BaseCryptoFile.PK_ALGORITHM)) {
throw new Exception($"unsupported signature; unexpected algorithm '{sig.Algorithm}'");
}
}
public static void CheckKeys(PubKey pub_key, Signature sig) {
if (!CryptoBytes.ConstantTimeEquals(pub_key.KeyNum, sig.KeyNum)) {
throw new Exception("verification failed: checked against wrong key");
}
}
public static bool VerifyCrypto(Signature sig, byte[] message, PubKey pub_key) {
return PublicKeyAuth.VerifyDetached(sig.SigData, message, pub_key.PubKeyData);
}
}
}
|
isc
|
C#
|
e856d28d6585a59529b9945e1f3c223a2f4e1e14
|
Use non-deprecated UnsafeRawPointer type to represent untyped native pointers.
|
jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000
|
binder/Generators/Swift/SwiftGenerator.cs
|
binder/Generators/Swift/SwiftGenerator.cs
|
using System.Collections.Generic;
using System.Linq;
using CppSharp.AST;
using CppSharp.Generators;
namespace Embeddinator.Generators
{
public class SwiftGenerator : Generator
{
public SwiftTypePrinter TypePrinter { get; internal set; }
public static string IntPtrType = "UnsafeRawPointer";
public SwiftGenerator(BindingContext context)
: base(context)
{
TypePrinter = new SwiftTypePrinter(Context);
}
public override List<CodeGenerator> Generate(IEnumerable<TranslationUnit> units)
{
var unit = units.First();
var sources = new SwiftSources(Context, unit);
return new List<CodeGenerator> { sources };
}
public override bool SetupPasses()
{
return true;
}
protected override string TypePrinterDelegate(CppSharp.AST.Type type)
{
return type.Visit(TypePrinter).Type;
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using CppSharp.AST;
using CppSharp.Generators;
namespace Embeddinator.Generators
{
public class SwiftGenerator : Generator
{
public SwiftTypePrinter TypePrinter { get; internal set; }
public static string IntPtrType = "UnsafePointer<Void>";
public SwiftGenerator(BindingContext context)
: base(context)
{
TypePrinter = new SwiftTypePrinter(Context);
}
public override List<CodeGenerator> Generate(IEnumerable<TranslationUnit> units)
{
var unit = units.First();
var sources = new SwiftSources(Context, unit);
return new List<CodeGenerator> { sources };
}
public override bool SetupPasses()
{
return true;
}
protected override string TypePrinterDelegate(CppSharp.AST.Type type)
{
return type.Visit(TypePrinter).Type;
}
}
}
|
mit
|
C#
|
8821813e9c51c7d8b22f577917c671bc4a530771
|
add a data point
|
liupeirong/Azure,liupeirong/Azure,liupeirong/Azure,liupeirong/Azure,liupeirong/Azure,liupeirong/Azure,liupeirong/Azure,liupeirong/Azure
|
PowerBIISV/ContosoOData/Controllers/ProductsController.cs
|
PowerBIISV/ContosoOData/Controllers/ProductsController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ContosoOData.Models;
using System.Web.OData;
using System.Web.Http;
namespace ContosoOData.Controllers
{
[Authorize]
public class ProductsController : ODataController
{
public IQueryable<Product> Get()
{
var products = new List<Product>();
products.Add(new Product {Id = 100, Name = "Hadoop", Price = 10, Category = "BigData"});
products.Add(new Product {Id = 200, Name = "Spark", Price = 20, Category = "BigData" });
products.Add(new Product { Id = 300, Name = "DataLake", Price = 20, Category = "BigData" });
products.Add(new Product { Id = 400, Name = "Hive", Price = 40, Category = "BigData" });
return products.AsQueryable();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ContosoOData.Models;
using System.Web.OData;
using System.Web.Http;
namespace ContosoOData.Controllers
{
[Authorize]
public class ProductsController : ODataController
{
public IQueryable<Product> Get()
{
var products = new List<Product>();
products.Add(new Product {Id = 100, Name = "Hadoop", Price = 10, Category = "BigData"});
products.Add(new Product {Id = 200, Name = "Spark", Price = 20, Category = "BigData" });
products.Add(new Product { Id = 300, Name = "DataLake", Price = 20, Category = "BigData" });
return products.AsQueryable();
}
}
}
|
mit
|
C#
|
51fccad5be7237db8310ad03c9e9eca74b9a9cf3
|
Remove unused options replaced by TestProxy (#23258)
|
AsrOneSdk/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net
|
common/Perf/Azure.Test.Perf/PerfOptions.cs
|
common/Perf/Azure.Test.Perf/PerfOptions.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using CommandLine;
using System;
namespace Azure.Test.Perf
{
public class PerfOptions
{
[Option('d', "duration", Default = 10, HelpText = "Duration of test in seconds")]
public int Duration { get; set; }
[Option("insecure", HelpText = "Allow untrusted SSL certs")]
public bool Insecure { get; set; }
[Option('i', "iterations", Default = 1, HelpText = "Number of iterations of main test loop")]
public int Iterations { get; set; }
[Option("job-statistics", HelpText = "Print job statistics (used by automation)")]
public bool JobStatistics { get; set; }
[Option('l', "latency", HelpText = "Track and print per-operation latency statistics")]
public bool Latency { get; set; }
[Option("max-io-completion-threads", HelpText = "The maximum number of asynchronous I/O threads that the thread pool creates on demand")]
public int? MaxIOCompletionThreads { get; set; }
[Option("max-worker-threads", HelpText = "The maximum number of worker threads that the thread pool creates on demand")]
public int? MaxWorkerThreads { get; set; }
[Option("min-io-completion-threads", HelpText = "The minimum number of asynchronous I/O threads that the thread pool creates on demand")]
public int? MinIOCompletionThreads { get; set; }
[Option("min-worker-threads", HelpText = "The minimum number of worker threads that the thread pool creates on demand")]
public int? MinWorkerThreads { get; set; }
[Option("no-cleanup", HelpText = "Disables test cleanup")]
public bool NoCleanup { get; set; }
[Option('p', "parallel", Default = 1, HelpText = "Number of operations to execute in parallel")]
public int Parallel { get; set; }
[Option('r', "rate", HelpText = "Target throughput (ops/sec)")]
public int? Rate { get; set; }
[Option("status-interval", Default = 1, HelpText = "Interval to write status to console in seconds")]
public int StatusInterval { get; set; }
[Option("sync", HelpText = "Runs sync version of test")]
public bool Sync { get; set; }
[Option('x', "test-proxy", HelpText = "URI of TestProxy Server")]
public Uri TestProxy { get; set; }
[Option('w', "warmup", Default = 5, HelpText = "Duration of warmup in seconds")]
public int Warmup { get; set; }
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using CommandLine;
using System;
namespace Azure.Test.Perf
{
public class PerfOptions
{
[Option('d', "duration", Default = 10, HelpText = "Duration of test in seconds")]
public int Duration { get; set; }
[Option("host", HelpText = "Host to redirect HTTP requests")]
public string Host { get; set; }
[Option("insecure", HelpText = "Allow untrusted SSL certs")]
public bool Insecure { get; set; }
[Option('i', "iterations", Default = 1, HelpText = "Number of iterations of main test loop")]
public int Iterations { get; set; }
[Option("job-statistics", HelpText = "Print job statistics (used by automation)")]
public bool JobStatistics { get; set; }
[Option('l', "latency", HelpText = "Track and print per-operation latency statistics")]
public bool Latency { get; set; }
[Option("max-io-completion-threads", HelpText = "The maximum number of asynchronous I/O threads that the thread pool creates on demand")]
public int? MaxIOCompletionThreads { get; set; }
[Option("max-worker-threads", HelpText = "The maximum number of worker threads that the thread pool creates on demand")]
public int? MaxWorkerThreads { get; set; }
[Option("min-io-completion-threads", HelpText = "The minimum number of asynchronous I/O threads that the thread pool creates on demand")]
public int? MinIOCompletionThreads { get; set; }
[Option("min-worker-threads", HelpText = "The minimum number of worker threads that the thread pool creates on demand")]
public int? MinWorkerThreads { get; set; }
[Option("no-cleanup", HelpText = "Disables test cleanup")]
public bool NoCleanup { get; set; }
[Option('p', "parallel", Default = 1, HelpText = "Number of operations to execute in parallel")]
public int Parallel { get; set; }
[Option("port", HelpText = "Port to redirect HTTP requests")]
public int? Port { get; set; }
[Option('r', "rate", HelpText = "Target throughput (ops/sec)")]
public int? Rate { get; set; }
[Option("status-interval", Default = 1, HelpText = "Interval to write status to console in seconds")]
public int StatusInterval { get; set; }
[Option("sync", HelpText = "Runs sync version of test")]
public bool Sync { get; set; }
[Option('x', "test-proxy", HelpText = "URI of TestProxy Server")]
public Uri TestProxy { get; set; }
[Option('w', "warmup", Default = 5, HelpText = "Duration of warmup in seconds")]
public int Warmup { get; set; }
}
}
|
mit
|
C#
|
7757cbb0a545ecdad83807473871fe0bd41fa946
|
Trim branch names
|
jquintus/TrelloWorld,jquintus/TrelloWorld
|
TrelloWorld/TrelloWorld.Server/Services/SettingsLoader.cs
|
TrelloWorld/TrelloWorld.Server/Services/SettingsLoader.cs
|
namespace TrelloWorld.Server.Services
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using TrelloWorld.Server.Config;
public class SettingsLoader : ISettingsLoader<Settings>
{
public Settings Load()
{
string root = HttpContext.Current == null
? string.Empty
: HttpContext.Current.Server.MapPath("~/MarkdownViews");
return new Settings()
{
MarkdownRootPath = root,
Key = WebConfigurationManager.AppSettings["Trello.Key"],
Token = WebConfigurationManager.AppSettings["Trello.Token"],
Branches = ReadList("Trello.Branches"),
IncludeLinkToCommit = ReadBool("Trello.IncludeLinkToCommit"),
IncludeCardId = ReadBool("Trello.IncludeCardId"),
CardIdRegex = ReadString("Trello.CardIdRegex", Settings.DEFAULT_CARD_ID_REGEX),
};
}
private bool ReadBool(string key, bool defaultValue = false)
{
var stringValue = WebConfigurationManager.AppSettings[key];
if (string.IsNullOrWhiteSpace(stringValue)) return defaultValue;
bool value;
return bool.TryParse(stringValue, out value)
? value
: defaultValue;
}
private List<string> ReadList(string key)
{
var value = WebConfigurationManager.AppSettings[key];
return string.IsNullOrWhiteSpace(value)
? new List<string>()
: value.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries).Select(i => i.Trim()).ToList();
}
private string ReadString(string key, string defaultValue = "")
{
var value = WebConfigurationManager.AppSettings[key];
return string.IsNullOrWhiteSpace(value)
? defaultValue
: value;
}
}
}
|
namespace TrelloWorld.Server.Services
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using TrelloWorld.Server.Config;
public class SettingsLoader : ISettingsLoader<Settings>
{
public Settings Load()
{
string root = HttpContext.Current == null
? string.Empty
: HttpContext.Current.Server.MapPath("~/MarkdownViews");
return new Settings()
{
MarkdownRootPath = root,
Key = WebConfigurationManager.AppSettings["Trello.Key"],
Token = WebConfigurationManager.AppSettings["Trello.Token"],
Branches = ReadList("Trello.Branches"),
IncludeLinkToCommit = ReadBool("Trello.IncludeLinkToCommit"),
IncludeCardId = ReadBool("Trello.IncludeCardId"),
CardIdRegex = ReadString("Trello.CardIdRegex", Settings.DEFAULT_CARD_ID_REGEX),
};
}
private bool ReadBool(string key, bool defaultValue = false)
{
var stringValue = WebConfigurationManager.AppSettings[key];
if (string.IsNullOrWhiteSpace(stringValue)) return defaultValue;
bool value;
return bool.TryParse(stringValue, out value)
? value
: defaultValue;
}
private List<string> ReadList(string key)
{
var value = WebConfigurationManager.AppSettings[key];
return string.IsNullOrWhiteSpace(value)
? new List<string>()
: value.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries).ToList();
}
private string ReadString(string key, string defaultValue = "")
{
var value = WebConfigurationManager.AppSettings[key];
return string.IsNullOrWhiteSpace(value)
? defaultValue
: value;
}
}
}
|
mit
|
C#
|
2ce23930d43aa0592ad9b86ce6d0aa31ba4d2b11
|
Fix CanvasCellViewBackend.QueueDraw()
|
hamekoz/xwt,cra0zy/xwt,mono/xwt,lytico/xwt,hwthomas/xwt,antmicro/xwt,TheBrainTech/xwt
|
Xwt.WPF/Xwt.WPFBackend.CellViews/CanvasCellViewBackend.cs
|
Xwt.WPF/Xwt.WPFBackend.CellViews/CanvasCellViewBackend.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Xwt.Backends;
namespace Xwt.WPFBackend
{
class CanvasCellViewBackend: CellViewBackend, ICanvasCellViewBackend
{
public void QueueDraw()
{
CurrentElement.InvalidateVisual ();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Xwt.Backends;
namespace Xwt.WPFBackend
{
class CanvasCellViewBackend: CellViewBackend, ICanvasCellViewBackend
{
public void QueueDraw()
{
}
}
}
|
mit
|
C#
|
90dba3e87e59a5acab24609490546986fcb72397
|
Update Stock.cs
|
IanMcT/StockMarketGame
|
SMG/SMG/Stock.cs
|
SMG/SMG/Stock.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SMG
{
class Stock
{
/// <summary>
/// Name of the Stock
/// </summary>
public string StockName;
/// <summary>
/// Description of the Stock
/// </summary>
public string StockDescription;
/// <summary>
/// The last four or so points for the Stock
/// </summary>
public double StockHistory;
/// <summary>
/// scale of one to ten determining if its going to be low risk or high risk
/// </summary>
public double StockRisk;
/// <summary>
/// what percent payout the stock is going to have
/// </summary>
public double StockReturn;
public Stock(string StockName)
{
this.StockName = StockName;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SMG
{
class Stock
{
/// <summary>
/// Name of the Stock
/// </summary>
public string StockName;
/// <summary>
/// Description of the Stock
/// </summary>
public string StockDescription;
/// <summary>
/// The last four or so points for the Stock
/// </summary>
public decimal StockHistory;
/// <summary>
/// scale of one to ten determining if its going to be low risk or high risk
/// </summary>
public decimal StockRisk;
/// <summary>
/// what percent payout the stock is going to have
/// </summary>
public decimal StockReturn;
}
}
|
apache-2.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.