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 |
---|---|---|---|---|---|---|---|---|
033b31a9f691f2a1f360abb1b905ce7122ecc829
|
Implement MtomData methods
|
teerachail/SoapWithAttachments
|
WebsiteForSpike/MtomTestSite/Service1.svc.cs
|
WebsiteForSpike/MtomTestSite/Service1.svc.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace MtomTestSite
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public string GetDataLen(string name, byte[] data)
{
return string.Format("{0}: {1}", name, data.Length);
}
public string GetDataLenStream(Stream data)
{
byte[] buffer = new byte[2048];
var n = data.Read(buffer, 0, buffer.Length);
return string.Format("Data Length: {0}", n);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
public MyMtomData GetMyMtomData()
{
return new MtomTestSite.MyMtomData
{
Name = string.Format("My Mtom Data @{0}", DateTime.Now),
File1 = new byte[215],
File2 = new byte[128],
};
}
public MyMtomData RoundTripMyMtomData(MyMtomData data)
{
data.Name = string.Format("Received: {0}", data.Name);
return data;
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace MtomTestSite
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public string GetDataLen(string name, byte[] data)
{
return string.Format("{0}: {1}", name, data.Length);
}
public string GetDataLenStream(Stream data)
{
byte[] buffer = new byte[2048];
var n = data.Read(buffer, 0, buffer.Length);
return string.Format("Data Length: {0}", n);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
}
}
|
mit
|
C#
|
d36b77186a5fd1912781371ccc048dcdce448a33
|
fix for exe dying before tests complete.
|
mdevilliers/Toxiproxy.Net
|
Toxiproxy.Net.Tests/ToxiproxyTestsBase.cs
|
Toxiproxy.Net.Tests/ToxiproxyTestsBase.cs
|
using System;
using System.Diagnostics;
namespace Toxiproxy.Net.Tests
{
public class ToxiproxyTestsBase : IDisposable
{
protected Connection _connection;
protected Process _process;
protected readonly Proxy one = new Proxy() { Name = "one", Enabled = true, Listen = "127.0.0.1:44399", Upstream = "google.com:443" };
protected readonly Proxy two = new Proxy() { Name = "two", Enabled = true, Listen = "127.0.0.1:44377", Upstream = "google.com:443" };
public ToxiproxyTestsBase()
{
// TODO : start up version of toxiproxy....
var processInfo = new ProcessStartInfo()
{
FileName = @"..\..\..\compiled\Win64\toxiproxy.exe"
};
_process = new Process()
{
StartInfo = processInfo
};
_process.Start();
_connection = new Connection();
CreateKnownState();
}
protected void CreateKnownState()
{
var client = _connection.Client();
foreach (var proxyName in client.All().Keys)
{
client.Delete(proxyName);
}
client.Add(one);
client.Add(two);
}
public void Dispose()
{
if (_process.HasExited == false)
{
_process.Kill();
}
}
}
}
|
using System;
using System.Diagnostics;
namespace Toxiproxy.Net.Tests
{
public class ToxiproxyTestsBase : IDisposable
{
protected Connection _connection;
protected Process _process;
protected readonly Proxy one = new Proxy() { Name = "one", Enabled = true, Listen = "127.0.0.1:44399", Upstream = "google.com:443" };
protected readonly Proxy two = new Proxy() { Name = "two", Enabled = true, Listen = "127.0.0.1:44377", Upstream = "google.com:443" };
public ToxiproxyTestsBase()
{
// TODO : start up version of toxiproxy....
var processInfo = new ProcessStartInfo()
{
FileName = @"..\..\..\compiled\Win64\toxiproxy.exe"
};
_process = new Process()
{
StartInfo = processInfo
};
_process.Start();
_connection = new Connection();
CreateKnownState();
}
protected void CreateKnownState()
{
var client = _connection.Client();
foreach (var proxyName in client.All().Keys)
{
client.Delete(proxyName);
}
client.Add(one);
client.Add(two);
}
public void Dispose()
{
_process.Kill();
}
}
}
|
mit
|
C#
|
5d61f2ee2c4fe913c22b8b784d41a60124deaa7e
|
bump - suffix (rc003)
|
KevinJump/uSync,KevinJump/uSync,KevinJump/uSync
|
uSync.BackOffice/BackOfficeConstants.cs
|
uSync.BackOffice/BackOfficeConstants.cs
|
using System;
using System.Collections.Generic;
namespace uSync.BackOffice
{
public static partial class uSyncConstants
{
public const string ReleaseSuffix = "-rc003";
public static class Priorites
{
public const int USYNC_RESERVED_LOWER = 1000;
public const int USYNC_RESERVED_UPPER = 2000;
public const int DataTypes = USYNC_RESERVED_LOWER + 10;
public const int Templates = USYNC_RESERVED_LOWER + 20;
public const int ContentTypes = USYNC_RESERVED_LOWER + 30;
public const int MediaTypes = USYNC_RESERVED_LOWER + 40;
public const int MemberTypes = USYNC_RESERVED_LOWER + 45;
public const int Languages = USYNC_RESERVED_LOWER + 5;
public const int DictionaryItems = USYNC_RESERVED_LOWER + 6;
public const int Macros = USYNC_RESERVED_LOWER + 70;
public const int Media = USYNC_RESERVED_LOWER + 200;
public const int Content = USYNC_RESERVED_LOWER + 210;
public const int ContentTemplate = USYNC_RESERVED_LOWER + 215;
public const int DomainSettings = USYNC_RESERVED_LOWER + 219;
public const int DataTypeMappings = USYNC_RESERVED_LOWER + 220;
public const int RelationTypes = USYNC_RESERVED_LOWER + 230;
}
public static class Groups
{
public const string Settings = "Settings";
public const string Content = "Content";
public const string Members = "Members";
public const string Users = "Users";
public static Dictionary<string, string> Icons = new Dictionary<string, string> {
{ Settings, "icon-settings-alt color-blue" },
{ Content, "icon-documents color-purple" },
{ Members, "icon-users" },
{ Users, "icon-users color-green"}
};
}
}
}
|
using System;
using System.Collections.Generic;
namespace uSync.BackOffice
{
public static partial class uSyncConstants
{
public const string ReleaseSuffix = "-rc002";
public static class Priorites
{
public const int USYNC_RESERVED_LOWER = 1000;
public const int USYNC_RESERVED_UPPER = 2000;
public const int DataTypes = USYNC_RESERVED_LOWER + 10;
public const int Templates = USYNC_RESERVED_LOWER + 20;
public const int ContentTypes = USYNC_RESERVED_LOWER + 30;
public const int MediaTypes = USYNC_RESERVED_LOWER + 40;
public const int MemberTypes = USYNC_RESERVED_LOWER + 45;
public const int Languages = USYNC_RESERVED_LOWER + 5;
public const int DictionaryItems = USYNC_RESERVED_LOWER + 6;
public const int Macros = USYNC_RESERVED_LOWER + 70;
public const int Media = USYNC_RESERVED_LOWER + 200;
public const int Content = USYNC_RESERVED_LOWER + 210;
public const int ContentTemplate = USYNC_RESERVED_LOWER + 215;
public const int DomainSettings = USYNC_RESERVED_LOWER + 219;
public const int DataTypeMappings = USYNC_RESERVED_LOWER + 220;
public const int RelationTypes = USYNC_RESERVED_LOWER + 230;
}
public static class Groups
{
public const string Settings = "Settings";
public const string Content = "Content";
public const string Members = "Members";
public const string Users = "Users";
public static Dictionary<string, string> Icons = new Dictionary<string, string> {
{ Settings, "icon-settings-alt color-blue" },
{ Content, "icon-documents color-purple" },
{ Members, "icon-users" },
{ Users, "icon-users color-green"}
};
}
}
}
|
mpl-2.0
|
C#
|
ce1e3f770943b488c69ee92f79ef41a4b52cee3a
|
add debug info
|
ignatandrei/stankins,ignatandrei/stankins,ignatandrei/stankins,ignatandrei/stankins,ignatandrei/stankins,ignatandrei/stankins
|
StankinsTests/TestTransformerLine.cs
|
StankinsTests/TestTransformerLine.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ReceiverFileSystem;
using Shouldly;
using StanskinsImplementation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Transformers;
namespace StankinsTests
{
[TestClass]
public class TestTransformerLine
{
[TestMethod]
public async Task TestTransformerFileToLines()
{
#region arrange
var dir = AppContext.BaseDirectory;
var folderSql = Path.Combine(dir, "SqlToExecute");
var receiverFolder = new ReceiverFolderHierarchical(folderSql, "*.txt");
DirectoryInfo di = new DirectoryInfo(folderSql);
Console.WriteLine($"start files in {folderSql}");
foreach (var item in di.EnumerateFiles( "*.txt"))
{
Console.WriteLine($"File {item.FullName}");
}
Console.WriteLine($"end files in {folderSql}");
#endregion
#region act
var transformer = new TransformerFileToLines();
var j = new SimpleJob();
j.Receivers.Add(0, receiverFolder);
j.FiltersAndTransformers.Add(0, transformer);
await j.Execute();
#endregion
#region assert
receiverFolder.valuesRead?.Length.ShouldBeGreaterThan(1);
transformer.valuesTransformed.ShouldNotBeNull();
var files = transformer.valuesTransformed.GroupBy(it => it.Values["FullName"]).ToArray();
files.Length.ShouldBeGreaterThan(1);
var file1Len = files.First().Count();
var file2Len = files.Last().Count();
file1Len.ShouldBeGreaterThan(0);
file2Len.ShouldBeGreaterThan(0);
(file1Len + file2Len).ShouldBeGreaterThan(2);
#endregion
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ReceiverFileSystem;
using Shouldly;
using StanskinsImplementation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Transformers;
namespace StankinsTests
{
[TestClass]
public class TestTransformerLine
{
[TestMethod]
public async Task TestTransformerFileToLines()
{
#region arrange
var dir = AppContext.BaseDirectory;
var folderSql = Path.Combine(dir, "SqlToExecute");
var receiverFolder = new ReceiverFolderHierarchical(folderSql, "*.txt");
#endregion
#region act
var transformer = new TransformerFileToLines();
var j = new SimpleJob();
j.Receivers.Add(0, receiverFolder);
j.FiltersAndTransformers.Add(0, transformer);
await j.Execute();
#endregion
#region assert
receiverFolder.valuesRead?.Length.ShouldBeGreaterThan(1);
transformer.valuesTransformed.ShouldNotBeNull();
var files = transformer.valuesTransformed.GroupBy(it => it.Values["FullName"]).ToArray();
files.Length.ShouldBeGreaterThan(1);
var file1Len = files.First().Count();
var file2Len = files.Last().Count();
file1Len.ShouldBeGreaterThan(0);
file2Len.ShouldBeGreaterThan(0);
(file1Len + file2Len).ShouldBeGreaterThan(2);
#endregion
}
}
}
|
mit
|
C#
|
ada74779a4267e0f7331db43524b6bdc117a444f
|
Remove `[ClicksUsingScript]` from `GoTo2Page`
|
atata-framework/atata,atata-framework/atata
|
test/Atata.Tests/Components/GoTo2Page.cs
|
test/Atata.Tests/Components/GoTo2Page.cs
|
namespace Atata.Tests
{
using _ = GoTo2Page;
[Url("goto2")]
[VerifyTitle("GoTo 2")]
public class GoTo2Page : Page<_>
{
public LinkDelegate<GoTo1Page, _> GoTo1 { get; private set; }
[GoTemporarily]
public LinkDelegate<GoTo1Page, _> GoTo1Temporarily { get; private set; }
public LinkDelegate<_> GoTo1Blank { get; private set; }
public LinkDelegate<GoTo3Page, _> GoTo3 { get; private set; }
[GoTemporarily]
public LinkDelegate<GoTo3Page, _> GoTo3Temporarily { get; private set; }
public LinkDelegate<_> GoTo3Blank { get; private set; }
}
}
|
namespace Atata.Tests
{
using _ = GoTo2Page;
[Url("goto2")]
[VerifyTitle("GoTo 2")]
public class GoTo2Page : Page<_>
{
public LinkDelegate<GoTo1Page, _> GoTo1 { get; private set; }
[GoTemporarily]
public LinkDelegate<GoTo1Page, _> GoTo1Temporarily { get; private set; }
public LinkDelegate<_> GoTo1Blank { get; private set; }
public LinkDelegate<GoTo3Page, _> GoTo3 { get; private set; }
[GoTemporarily]
[ClicksUsingScript] // TODO: Recheck this test without [ClicksUsingScript] after update to WebDriver 4.
public LinkDelegate<GoTo3Page, _> GoTo3Temporarily { get; private set; }
public LinkDelegate<_> GoTo3Blank { get; private set; }
}
}
|
apache-2.0
|
C#
|
4be71714db3fc735cfc965b2bfe7919819ad4127
|
fix imports in tests.
|
Centeva/TypeScripter
|
TypeScripter.Tests/UtilsUnitTests.cs
|
TypeScripter.Tests/UtilsUnitTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TypeScripter.Common;
namespace TypeScripter.Tests
{
[TestClass]
public class UtilsUnitTests
{
[TestMethod]
public void ToTypeScripterType_ListOfInt()
{
Assert.AreEqual("number[]", typeof(List<int>).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_ListOfObject()
{
Assert.AreEqual("UtilsUnitTests[]", typeof(List<UtilsUnitTests>).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_ArrayOfInt()
{
Assert.AreEqual("number[]", typeof(int[]).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_ArrayOfObject()
{
Assert.AreEqual("UtilsUnitTests[]", typeof(UtilsUnitTests[]).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_IEnumerableOfInt()
{
Assert.AreEqual("number[]", typeof(IEnumerable<int>).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_Dictionary_Int_Object()
{
Assert.AreEqual("any", typeof(Dictionary<int, UtilsUnitTests>).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_IDictionary_Int_Object()
{
Assert.AreEqual("any", typeof(IDictionary<int, UtilsUnitTests>).ToTypeScriptType().Name);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TypeScripter;
namespace TypeScripter.Tests
{
[TestClass]
public class UtilsUnitTests
{
[TestMethod]
public void ToTypeScripterType_ListOfInt()
{
Assert.AreEqual("number[]", typeof(List<int>).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_ListOfObject()
{
Assert.AreEqual("UtilsUnitTests[]", typeof(List<UtilsUnitTests>).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_ArrayOfInt()
{
Assert.AreEqual("number[]", typeof(int[]).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_ArrayOfObject()
{
Assert.AreEqual("UtilsUnitTests[]", typeof(UtilsUnitTests[]).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_IEnumerableOfInt()
{
Assert.AreEqual("number[]", typeof(IEnumerable<int>).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_Dictionary_Int_Object()
{
Assert.AreEqual("any", typeof(Dictionary<int, UtilsUnitTests>).ToTypeScriptType().Name);
}
[TestMethod]
public void ToTypeScripterType_IDictionary_Int_Object()
{
Assert.AreEqual("any", typeof(IDictionary<int, UtilsUnitTests>).ToTypeScriptType().Name);
}
}
}
|
mit
|
C#
|
17ef34af9af7dfe369cc16520cd76e7840573981
|
fix private field var name style. refs #287
|
t-ashula/bl4n
|
bl4n/Data/ExtraJsonPropertyReadableObject.cs
|
bl4n/Data/ExtraJsonPropertyReadableObject.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ExtraJsonPropertyReadableObject.cs">
// bl4n - Backlog.jp API Client library
// this file is part of bl4n, license under MIT license. http://t-ashula.mit-license.org/2015
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace BL4N.Data
{
/// <summary> NX̃o[ɃfVACYȂ JSON ̃vpeB擾\ȃIuWFNg\܂ </summary>
public abstract class ExtraJsonPropertyReadableObject
{
[JsonExtensionData]
private IDictionary<string, JToken> _extraProperties = new Dictionary<string, JToken>();
/// <summary> ]ȃvpeBƂ̒l̃yAœ܂ </summary>
/// <returns> ]ȃvpeB̈ꗗ </returns>
public IDictionary<string, string> GetExtraProperties()
{
return _extraProperties.ToDictionary(kv => kv.Key, kv => kv.Value.ToString());
}
/// <summary>
/// ]ȃvpeB邩ǂ擾܂
/// </summary>
/// <returns> ]ȃvpeBƂ true </returns>
public bool HasExtraProperty()
{
return _extraProperties.Any();
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ExtraJsonPropertyReadableObject.cs">
// bl4n - Backlog.jp API Client library
// this file is part of bl4n, license under MIT license. http://t-ashula.mit-license.org/2015
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace BL4N.Data
{
/// <summary> NX̃o[ɃfVACYȂ JSON ̃vpeB擾\ȃIuWFNg\܂ </summary>
public abstract class ExtraJsonPropertyReadableObject
{
[JsonExtensionData]
private IDictionary<string, JToken> extraProperties = new Dictionary<string, JToken>();
/// <summary> ]ȃvpeBƂ̒l̃yAœ܂ </summary>
/// <returns> ]ȃvpeB̈ꗗ </returns>
public IDictionary<string, string> GetExtraProperties()
{
return extraProperties.ToDictionary(kv => kv.Key, kv => kv.Value.ToString());
}
/// <summary>
/// ]ȃvpeB邩ǂ擾܂
/// </summary>
/// <returns> ]ȃvpeBƂ true </returns>
public bool HasExtraProperty()
{
return extraProperties.Any();
}
}
}
|
mit
|
C#
|
d28c3ccb95dbfdcec634ca77f8cd475d4fed9ed0
|
Add time measurement in Main, fix output
|
lou1306/CIV,lou1306/CIV
|
CIV/Program.cs
|
CIV/Program.cs
|
using System;
using System.Diagnostics;
using CIV.Formats;
using static System.Console;
namespace CIV
{
[Flags]
enum ExitCodes : int
{
Success = 0,
FileNotFound = 1,
ParsingFailed = 2,
VerificationFailed = 4
}
class Program
{
static void Main(string[] args)
{
try
{
var project = new Caal().Load(args[0]);
VerifyAll(project);
}
catch (System.IO.FileNotFoundException ex)
{
ForegroundColor = ConsoleColor.Red;
WriteLine(ex.Message);
ResetColor();
Environment.Exit((int)ExitCodes.FileNotFound);
}
}
static void VerifyAll(Caal project)
{
WriteLine("Loaded project {0}. Starting verification...", project.Name);
var sw = new Stopwatch();
sw.Start();
foreach (var kv in project.Formulae)
{
Write($"{kv.Value} |= {kv.Key}...");
Out.Flush();
var isSatisfied = kv.Key.Check(kv.Value);
ForegroundColor = isSatisfied ? ConsoleColor.Green : ConsoleColor.Red;
var result = isSatisfied ? "Success!" : "Failure";
Write($"\t{result}");
WriteLine();
ResetColor();
}
sw.Stop();
WriteLine($"Completed in {sw.Elapsed.TotalMilliseconds} ms.");
}
}
}
|
using System;
using CIV.Formats;
using static System.Console;
namespace CIV
{
[Flags]
enum ExitCodes : int
{
Success = 0,
FileNotFound = 1,
ParsingFailed = 2,
VerificationFailed = 4
}
class Program
{
static void Main(string[] args)
{
try
{
var project = new Caal().Load(args[0]);
VerifyAll(project);
}
catch (System.IO.FileNotFoundException ex)
{
ForegroundColor = ConsoleColor.Red;
WriteLine(ex.Message);
ResetColor();
Environment.Exit((int)ExitCodes.FileNotFound);
}
}
static void VerifyAll(Caal project)
{
WriteLine("Loaded project {0}", project.Name);
foreach (var kv in project.Formulae)
{
var isSatisfied = kv.Key.Check(kv.Value);
var symbol = isSatisfied ? "|=" : "|/=";
ForegroundColor = isSatisfied ? ConsoleColor.Green : ConsoleColor.Red;
WriteLine($"{kv.Value} {symbol} {kv.Key}");
}
ResetColor();
}
}
}
|
mit
|
C#
|
ff6642190f0d6e85cdff7eb3b2998fef0f9fb974
|
Update colour retrieval logic
|
UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,ppy/osu,peppy/osu,peppy/osu-new,smoogipooo/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu
|
osu.Game.Rulesets.Catch.Tests/CatchSkinColourDecodingTest.cs
|
osu.Game.Rulesets.Catch.Tests/CatchSkinColourDecodingTest.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.IO.Stores;
using osu.Game.Rulesets.Catch.Skinning;
using osu.Game.Skinning;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class CatchSkinColourDecodingTest
{
[Test]
public void TestCatchSkinColourDecoding()
{
var store = new NamespacedResourceStore<byte[]>(new DllResourceStore(GetType().Assembly), "Resources/special-skin");
var rawSkin = new TestLegacySkin(new SkinInfo { Name = "special-skin" }, store);
var skin = new CatchLegacySkinTransformer(rawSkin);
Assert.AreEqual(new Color4(232, 185, 35, 255), skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash)?.Value);
Assert.AreEqual(new Color4(232, 74, 35, 255), skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashAfterImage)?.Value);
Assert.AreEqual(new Color4(0, 255, 255, 255), skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashFruit)?.Value);
}
private class TestLegacySkin : LegacySkin
{
public TestLegacySkin(SkinInfo skin, IResourceStore<byte[]> storage)
// Bypass LegacySkinResourceStore to avoid returning null for retrieving files due to bad skin info (SkinInfo.Files = null).
: base(skin, storage, null, "skin.ini")
{
}
}
}
}
|
// 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.IO.Stores;
using osu.Game.Rulesets.Catch.Skinning;
using osu.Game.Skinning;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class CatchSkinColourDecodingTest
{
[Test]
public void TestCatchSkinColourDecoding()
{
var store = new NamespacedResourceStore<byte[]>(new DllResourceStore(GetType().Assembly), "Resources/special-skin");
var rawSkin = new TestLegacySkin(new SkinInfo { Name = "special-skin" }, store);
var skin = new CatchLegacySkinTransformer(rawSkin);
Assert.AreEqual(new Color4(232, 185, 35, 255), skin.GetHyperDashCatcherColour()?.Value);
Assert.AreEqual(new Color4(232, 74, 35, 255), skin.GetHyperDashCatcherAfterImageColour()?.Value);
Assert.AreEqual(new Color4(0, 255, 255, 255), skin.GetHyperDashFruitColour()?.Value);
}
private class TestLegacySkin : LegacySkin
{
public TestLegacySkin(SkinInfo skin, IResourceStore<byte[]> storage)
// Bypass LegacySkinResourceStore to avoid returning null for retrieving files due to bad skin info (SkinInfo.Files = null).
: base(skin, storage, null, "skin.ini")
{
}
}
}
}
|
mit
|
C#
|
8e4b15aaa5f0a4e3aeaf66a85d628ecf9f7df54d
|
Update test scene
|
smoogipoo/osu,UselessToucan/osu,ppy/osu,EVAST9919/osu,2yangk23/osu,smoogipoo/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,ppy/osu,EVAST9919/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu
|
osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs
|
osu.Game.Tournament.Tests/Screens/TestSceneGameplayScreen.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens;
using osu.Game.Tournament.Screens.Gameplay;
using osu.Game.Tournament.Screens.Gameplay.Components;
namespace osu.Game.Tournament.Tests.Screens
{
public class TestSceneGameplayScreen : TournamentTestScene
{
[Cached]
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay { Width = 0.5f };
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(TeamScore),
typeof(TeamScoreDisplay),
typeof(TeamDisplay),
typeof(MatchHeader),
typeof(MatchScoreDisplay),
typeof(BeatmapInfoScreen),
typeof(SongBar),
};
[BackgroundDependencyLoader]
private void load()
{
Add(new GameplayScreen());
Add(chat);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens.Gameplay;
using osu.Game.Tournament.Screens.Gameplay.Components;
namespace osu.Game.Tournament.Tests.Screens
{
public class TestSceneGameplayScreen : TournamentTestScene
{
[Cached]
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay();
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(TeamScore),
typeof(TeamScoreDisplay),
typeof(TeamDisplay),
typeof(MatchHeader),
typeof(MatchScoreDisplay),
};
[BackgroundDependencyLoader]
private void load()
{
Add(new GameplayScreen());
Add(chat);
}
}
}
|
mit
|
C#
|
7a23c7f9da4ccaa769ce1ae17218ab3bfdc5c5f3
|
Fix copyright in assemblyinfo
|
z4kn4fein/stashbox-mocking
|
src/stashbox.mocking.rhino.mocks/Properties/AssemblyInfo.cs
|
src/stashbox.mocking.rhino.mocks/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Stashbox.RhinoMocks")]
[assembly: AssemblyDescription("RhinoMocks auto mocking integration for Stashbox.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Peter Csajtai")]
[assembly: AssemblyProduct("Stashbox.RhinoMocks")]
[assembly: AssemblyCopyright("Copyright © Peter Csajtai 2020")]
[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("aba9ab67-62e9-44e2-a2a5-e7c4b2d9ccf8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.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("Stashbox.RhinoMocks")]
[assembly: AssemblyDescription("RhinoMocks auto mocking integration for Stashbox.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Peter Csajtai")]
[assembly: AssemblyProduct("Stashbox.RhinoMocks")]
[assembly: AssemblyCopyright("Copyright © Peter Csajtai 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("aba9ab67-62e9-44e2-a2a5-e7c4b2d9ccf8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
eae51cc53b17240c231e0f4d3b7c03ed01fb2328
|
Remove Nancy options
|
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
|
InfinniPlatform.Core/Http/Middlewares/NancyHttpMiddleware.cs
|
InfinniPlatform.Core/Http/Middlewares/NancyHttpMiddleware.cs
|
using InfinniPlatform.Http.Middlewares;
using Microsoft.AspNetCore.Builder;
using Nancy.Bootstrapper;
using Nancy.Owin;
namespace InfinniPlatform.Core.Http.Middlewares
{
/// <summary>
/// Модуль хостинга для обработки прикладных запросов на базе Nancy.
/// </summary>
internal class NancyHttpMiddleware : HttpMiddlewareBase<NancyMiddlewareOptions>
{
private readonly INancyBootstrapper _nancyBootstrapper;
public NancyHttpMiddleware(INancyBootstrapper nancyBootstrapper) : base(HttpMiddlewareType.Application)
{
_nancyBootstrapper = nancyBootstrapper;
}
public override void Configure(IApplicationBuilder app, NancyMiddlewareOptions options)
{
app.UseOwin(x => x.UseNancy(new NancyOptions
{
Bootstrapper = _nancyBootstrapper
}));
}
}
}
|
using InfinniPlatform.Http.Middlewares;
using Microsoft.AspNetCore.Builder;
using Nancy.Bootstrapper;
using Nancy.Owin;
namespace InfinniPlatform.Core.Http.Middlewares
{
/// <summary>
/// Модуль хостинга для обработки прикладных запросов на базе Nancy.
/// </summary>
internal class NancyHttpMiddleware : HttpMiddlewareBase<NancyMiddlewareOptions>
{
private readonly INancyBootstrapper _nancyBootstrapper;
public NancyHttpMiddleware(INancyBootstrapper nancyBootstrapper) : base(HttpMiddlewareType.Application)
{
_nancyBootstrapper = nancyBootstrapper;
}
public override void Configure(IApplicationBuilder app, NancyMiddlewareOptions options)
{
app.UseOwin(x => x.UseNancy(new NancyOptions
{
Bootstrapper = _nancyBootstrapper,
PerformPassThrough = context => options.PerformPassThrough
}));
}
}
}
|
agpl-3.0
|
C#
|
a03a7d8ad48a0e21f9b0df5dd93019b771b01969
|
Update FlightCamera.cs
|
Anatid/XML-Documentation-for-the-KSP-API
|
FlightCamera.cs
|
FlightCamera.cs
|
#region Assembly Assembly-CSharp.dll, v2.0.50727
// C:\greg\games\KSP 0.18.2\KSP_Data\Managed\Assembly-CSharp.dll
#endregion
using System;
using UnityEngine;
/// <summary>
/// This class is related to control of the main camera used in the flight scene. Its transform is the
/// parent of the actual Camera objects.
/// </summary>
public class FlightCamera : MonoBehaviour
{
public FlightCamera.Modes autoMode;
public Camera[] cameras;
public float cameraWobbleSensitivity;
public float camHdg;
public float camPitch;
public Vector3 endDirection;
/// <summary>
/// Returns the singleton FlightCamera object.
/// </summary>
public static FlightCamera fetch;
public FoRModes FoRMode;
public float fovDefault;
public float maxDistance;
public float maxPitch;
public float minDistance;
public float minHeight;
public float minHeightAtMaxDist;
public float minHeightAtMinDist;
public float minPitch;
public FlightCamera.Modes mode;
public GUIStyle modeReadoutStyle;
public float orbitSensitivity;
public float orientationSharpness;
public float pivotTranslateSharpness;
public float sharpness;
public float startDistance;
public Vector3 targetDirection;
public bool updateActive;
public float zoomScaleFactor;
public extern FlightCamera();
/// <summary>
/// You can set this to change the look direction of the in-flight camera (value is in radians).
/// </summary>
public extern static float CamHdg { get; set; }
public extern static int CamMode { get; }
/// <summary>
/// You can set this to change the look direction of the in-flight camera (value is in radians).
/// </summary>
public extern static float CamPitch { get; set; }
public extern float Distance { get; }
public extern static FoRModes FrameOfReferenceMode { get; }
public extern Quaternion pivotRotation { get; }
/// <summary>
/// Enables mouse control of the camera.
/// </summary>
public extern void ActivateUpdate();
/// <summary>
/// Disables mouse control of the camera.
/// </summary>
public extern void DeactivateUpdate();
public extern void DisableCamera();
public extern void EnableCamera();
public extern void ResetFoV();
public extern void SetDistance(float dist);
public extern void SetDistanceImmediate(float dist);
public extern void SetFoV();
public extern void SetFoV(float fov);
public extern void setMode(FlightCamera.Modes m);
public extern static void SetMode(FlightCamera.Modes m);
public extern void setModeImmediate(FlightCamera.Modes m);
public extern static void SetModeImmediate(FlightCamera.Modes m);
public extern void SetNextMode();
public extern void setTarget(Transform tgt);
public extern static void SetTarget(Transform tgt);
public enum Modes
{
AUTO = 0,
FREE = 1,
ORBITAL = 2,
CHASE = 3,
}
}
|
#region Assembly Assembly-CSharp.dll, v2.0.50727
// C:\greg\games\KSP 0.18.2\KSP_Data\Managed\Assembly-CSharp.dll
#endregion
using System;
using UnityEngine;
/// <summary>
/// This class is related to control of the main camera used in the flight scene.
/// </summary>
public class FlightCamera : MonoBehaviour
{
public FlightCamera.Modes autoMode;
public Camera[] cameras;
public float cameraWobbleSensitivity;
public float camHdg;
public float camPitch;
public Vector3 endDirection;
public static FlightCamera fetch;
public FoRModes FoRMode;
public float fovDefault;
public float maxDistance;
public float maxPitch;
public float minDistance;
public float minHeight;
public float minHeightAtMaxDist;
public float minHeightAtMinDist;
public float minPitch;
public FlightCamera.Modes mode;
public GUIStyle modeReadoutStyle;
public float orbitSensitivity;
public float orientationSharpness;
public float pivotTranslateSharpness;
public float sharpness;
public float startDistance;
public Vector3 targetDirection;
public bool updateActive;
public float zoomScaleFactor;
public extern FlightCamera();
/// <summary>
/// You can set this to change the look direction of the in-flight camera (value is in radians).
/// </summary>
public extern static float CamHdg { get; set; }
public extern static int CamMode { get; }
/// <summary>
/// You can set this to change the look direction of the in-flight camera (value is in radians).
/// </summary>
public extern static float CamPitch { get; set; }
public extern float Distance { get; }
public extern static FoRModes FrameOfReferenceMode { get; }
public extern Quaternion pivotRotation { get; }
public extern void ActivateUpdate();
public extern void DeactivateUpdate();
public extern void DisableCamera();
public extern void EnableCamera();
public extern void ResetFoV();
public extern void SetDistance(float dist);
public extern void SetDistanceImmediate(float dist);
public extern void SetFoV();
public extern void SetFoV(float fov);
public extern void setMode(FlightCamera.Modes m);
public extern static void SetMode(FlightCamera.Modes m);
public extern void setModeImmediate(FlightCamera.Modes m);
public extern static void SetModeImmediate(FlightCamera.Modes m);
public extern void SetNextMode();
public extern void setTarget(Transform tgt);
public extern static void SetTarget(Transform tgt);
public enum Modes
{
AUTO = 0,
FREE = 1,
ORBITAL = 2,
CHASE = 3,
}
}
|
unlicense
|
C#
|
b115b037cc42ecb22b49de564451e89b0c7f7b03
|
Fix build error
|
smischke/helix-toolkit,Iluvatar82/helix-toolkit,holance/helix-toolkit,helix-toolkit/helix-toolkit,chrkon/helix-toolkit,JeremyAnsel/helix-toolkit,jotschgl/helix-toolkit
|
Source/HelixToolkit.Wpf.SharpDX.Tests/Controls/CanvasMock.cs
|
Source/HelixToolkit.Wpf.SharpDX.Tests/Controls/CanvasMock.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CanvasMock.cs" company="Helix Toolkit">
// Copyright (c) 2014 Helix Toolkit contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using HelixToolkit.Wpf.SharpDX.Model.Lights3D;
using SharpDX;
using SharpDX.Direct3D11;
namespace HelixToolkit.Wpf.SharpDX.Tests.Controls
{
class CanvasMock : IRenderHost
{
public CanvasMock()
{
RenderTechniquesManager = new DefaultRenderTechniquesManager();
RenderTechnique = RenderTechniquesManager.RenderTechniques[DefaultRenderTechniqueNames.Phong];
EffectsManager = new DefaultEffectsManager(RenderTechniquesManager);
Device = EffectsManager.Device;
}
private int renderCycles = 1;
public int RenderCycles
{
set { renderCycles = value; }
get { return renderCycles; }
}
public Device Device { get; private set; }
public Color4 ClearColor { get; private set; }
public bool IsShadowMapEnabled { get; private set; }
public MSAALevel MSAA { get; set; }
public IRenderer Renderable { get; set; }
public RenderTechnique RenderTechnique { get; private set; }
public double ActualHeight { get; private set; }
public double ActualWidth { get; private set; }
public IEffectsManager EffectsManager { get; set; }
public IRenderTechniquesManager RenderTechniquesManager { get; set; }
public bool IsBusy
{
get;private set;
}
private readonly Light3DSceneShared light3DSceneShared = new Light3DSceneShared();
public Light3DSceneShared Light3DSceneShared
{
get
{
return light3DSceneShared;
}
}
public void SetDefaultRenderTargets()
{
}
public void SetDefaultColorTargets(DepthStencilView dsv)
{
}
public event EventHandler<SharpDX.Utilities.RelayExceptionEventArgs> ExceptionOccurred;
public void InvalidateRender()
{
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CanvasMock.cs" company="Helix Toolkit">
// Copyright (c) 2014 Helix Toolkit contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using SharpDX;
using SharpDX.Direct3D11;
namespace HelixToolkit.Wpf.SharpDX.Tests.Controls
{
class CanvasMock : IRenderHost
{
public CanvasMock()
{
RenderTechniquesManager = new DefaultRenderTechniquesManager();
RenderTechnique = RenderTechniquesManager.RenderTechniques[DefaultRenderTechniqueNames.Phong];
EffectsManager = new DefaultEffectsManager(RenderTechniquesManager);
Device = EffectsManager.Device;
}
private int renderCycles = 1;
public int RenderCycles
{
set { renderCycles = value; }
get { return renderCycles; }
}
public Device Device { get; private set; }
public Color4 ClearColor { get; private set; }
public bool IsShadowMapEnabled { get; private set; }
public MSAALevel MSAA { get; set; }
public IRenderer Renderable { get; set; }
public RenderTechnique RenderTechnique { get; private set; }
public double ActualHeight { get; private set; }
public double ActualWidth { get; private set; }
public IEffectsManager EffectsManager { get; set; }
public IRenderTechniquesManager RenderTechniquesManager { get; set; }
public bool IsBusy
{
get;private set;
}
public void SetDefaultRenderTargets()
{
}
public void SetDefaultColorTargets(DepthStencilView dsv)
{
}
public event EventHandler<SharpDX.Utilities.RelayExceptionEventArgs> ExceptionOccurred;
public void InvalidateRender()
{
}
}
}
|
mit
|
C#
|
400a3ae3f5ebdd6cb6ca4930852ea4884b96f272
|
implement Serialzer
|
sentendro/Walk_For_L-Creamy
|
Assets/Script/Controller/C_Serializer.cs
|
Assets/Script/Controller/C_Serializer.cs
|
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System;
public class C_Serializer{
#region serialize
public static string ObjectToString(Object obj)
{
using (var memoryStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(memoryStream, obj);
memoryStream.Flush();
memoryStream.Position = 0;
return Convert.ToBase64String(memoryStream.ToArray());
}
}
#endregion
#region Deserialize
public static T Deserialize<T>(string xmlText)
{
if (xmlText != null && xmlText != String.Empty)
{
byte[] b = Convert.FromBase64String(xmlText);
using (var stream = new MemoryStream(b))
{
var formatter = new BinaryFormatter();
stream.Seek(0, SeekOrigin.Begin);
return (T)formatter.Deserialize(stream);
}
}
else
{
return default(T);
}
}
#endregion
}
|
using UnityEngine;
using System.Collections;
public class C_Serializer : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
|
mit
|
C#
|
3871168e09ef6c5366087cb3a686e03373793860
|
Remove publicly exposed Vertices property
|
DasAllFolks/SharpGraphs
|
Graph/IGraph.cs
|
Graph/IGraph.cs
|
using System;
using System.Collections.Generic;
namespace Graph
{
/// <summary>
/// Represents a graph.
/// </summary>
/// <typeparam name="V">The vertex type.</typeparam>
/// <typeparam name="E">The edge type.</typeparam>
public interface IGraph<V, E> : IEquatable<IGraph<V, E>> where E: IEdge<V>
{
/// <summary>
/// Attempts to add an edge to the graph.
/// </summary>
/// <param name="edge">
/// The edge.
/// </param>
/// <param name="allowNewVertices">
/// Iff true, add vertices in the edge which aren't yet in the graph
/// to the graph's vertex set.
/// </param>
/// <returns>
/// True if the edge was successfully added (the definition of
/// "success" may vary from implementation to implementation).
/// </returns>
/// <exception cref="InvalidOperationException">
/// Thrown if the edge contains at least one edge not in the graph,
/// and allowNewVertices is set to false.
/// </exception>
bool TryAddEdge(E edge, bool allowNewVertices = false);
/// <summary>
/// Attempts to remove an edge from the graph.
/// </summary>
/// <param name="edge">The edge.</param>
/// <returns>
/// True if the edge was successfully removed, false otherwise.
/// </returns>
bool TryRemoveEdge(E edge);
}
}
|
using System;
using System.Collections.Generic;
namespace Graph
{
/// <summary>
/// Represents a graph.
/// </summary>
/// <typeparam name="V">The vertex type.</typeparam>
/// <typeparam name="E">The edge type.</typeparam>
public interface IGraph<V, E> : IEquatable<IGraph<V, E>> where E: IEdge<V>
{
/// <summary>
/// The graph's vertices.
/// </summary>
ISet<V> Vertices { get; }
/// <summary>
/// Attempts to add an edge to the graph.
/// </summary>
/// <param name="edge">
/// The edge.
/// </param>
/// <param name="allowNewVertices">
/// Iff true, add vertices in the edge which aren't yet in the graph
/// to the graph's vertex set.
/// </param>
/// <returns>
/// True if the edge was successfully added (the definition of
/// "success" may vary from implementation to implementation).
/// </returns>
/// <exception cref="InvalidOperationException">
/// Thrown if the edge contains at least one edge not in the graph,
/// and allowNewVertices is set to false.
/// </exception>
bool TryAddEdge(E edge, bool allowNewVertices = false);
/// <summary>
/// Attempts to remove an edge from the graph.
/// </summary>
/// <param name="edge">The edge.</param>
/// <returns>
/// True if the edge was successfully removed, false otherwise.
/// </returns>
bool TryRemoveEdge(E edge);
}
}
|
apache-2.0
|
C#
|
aebef29d89830dabfd6797cd5acb10450ffb0ef3
|
Add dialog settings
|
ethno2405/BrailleTranslator
|
src/BrailleTranslator.Desktop/ViewModels/ToolbarViewModel.cs
|
src/BrailleTranslator.Desktop/ViewModels/ToolbarViewModel.cs
|
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Microsoft.Win32;
using System;
using System.Windows.Controls;
using System.Windows.Input;
namespace BrailleTranslator.Desktop.ViewModels
{
public class ToolbarViewModel : ViewModelBase
{
public static ICommand OpenCommand { get; set; }
public static ICommand SaveCommand { get; set; }
public static ICommand PrintCommand { get; set; }
public static ICommand ExitCommand { get; set; }
private string _selectedPath;
public string SelectedPath
{
get { return _selectedPath; }
set
{
_selectedPath = value;
RaisePropertyChanged("SelectedPath");
}
}
private string _defaultPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
public ToolbarViewModel()
{
RegisterCommands();
}
/*
public ToolbarViewModel(string defaultPath)
{
_defaultPath = defaultPath;
RegisterCommands();
}*/
private void RegisterCommands()
{
OpenCommand = new RelayCommand(ExecuteOpenFileDialog);
SaveCommand = new RelayCommand(ExecuteSaveFileDialog);
PrintCommand = new RelayCommand(ExecutePrintFileDialog);
ExitCommand = new RelayCommand(ExecuteExitDialog);
}
private void ExecuteOpenFileDialog()
{
var dialog = new OpenFileDialog { InitialDirectory = _defaultPath };
dialog.Filter = "Braille Files (*.brf)|*.brf|Text Files (*.txt)|*.txt";
dialog.ShowDialog();
SelectedPath = dialog.FileName;
}
private void ExecuteSaveFileDialog()
{
var dialog = new SaveFileDialog { InitialDirectory = _defaultPath };
dialog.Filter = "Braille Files (*.brf)|*.brf";
dialog.DefaultExt = ".braille";
dialog.ShowDialog();
SelectedPath = dialog.FileName;
}
private void ExecutePrintFileDialog()
{
var dialog = new PrintDialog();
dialog.ShowDialog();
}
private void ExecuteExitDialog()
{
Environment.Exit(0);
}
}
}
|
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Microsoft.Win32;
using System;
using System.Windows.Controls;
using System.Windows.Input;
namespace BrailleTranslator.Desktop.ViewModels
{
public class ToolbarViewModel : ViewModelBase
{
public static ICommand OpenCommand { get; set; }
public static ICommand SaveCommand { get; set; }
public static ICommand PrintCommand { get; set; }
public static ICommand ExitCommand { get; set; }
private string _selectedPath;
public string SelectedPath
{
get { return _selectedPath; }
set
{
_selectedPath = value;
RaisePropertyChanged("SelectedPath");
}
}
private string _defaultPath;
public ToolbarViewModel()
{
RegisterCommands();
}
/*
public ToolbarViewModel(string defaultPath)
{
_defaultPath = defaultPath;
RegisterCommands();
}*/
private void RegisterCommands()
{
OpenCommand = new RelayCommand(ExecuteOpenFileDialog);
SaveCommand = new RelayCommand(ExecuteSaveFileDialog);
PrintCommand = new RelayCommand(ExecutePrintFileDialog);
ExitCommand = new RelayCommand(ExecuteExitDialog);
}
private void ExecuteOpenFileDialog()
{
var dialog = new OpenFileDialog { InitialDirectory = _defaultPath };
dialog.ShowDialog();
SelectedPath = dialog.FileName;
}
private void ExecuteSaveFileDialog()
{
var dialog = new SaveFileDialog { InitialDirectory = _defaultPath };
dialog.ShowDialog();
SelectedPath = dialog.FileName;
}
private void ExecutePrintFileDialog()
{
var dialog = new PrintDialog();
dialog.ShowDialog();
}
private void ExecuteExitDialog()
{
Environment.Exit(0);
}
}
}
|
apache-2.0
|
C#
|
6d6a5efc24b98f4a009c6f7838a6c8cb0511eb6e
|
Add Google Analytics tracking for changing results mode
|
opencolorado/.NET-Wrapper-for-CKAN-API,opencolorado/.NET-Wrapper-for-CKAN-API,DenverDev/.NET-Wrapper-for-CKAN-API,DenverDev/.NET-Wrapper-for-CKAN-API,opencolorado/.NET-Wrapper-for-CKAN-API
|
CkanDotNet.Web/Views/Shared/_ResultsMode.cshtml
|
CkanDotNet.Web/Views/Shared/_ResultsMode.cshtml
|
@using CkanDotNet.Api.Model
@using CkanDotNet.Web.Models
@using CkanDotNet.Web.Models.Helpers
@using System.Collections.Specialized
@model PackageSearchResultsModel
@{
var routeValues = RouteHelper.RouteFromParameters(Html.ViewContext);
// Remove the page number from the route values since we are doing client-side
// pagination in the table mode
RouteHelper.UpdateRoute(routeValues, "page", null);
}
<div class="results-mode">
@if (Model.DisplayMode == ResultsDisplayMode.Table)
{
<a class="mode" href="@Url.Action("Index", "Search", RouteHelper.UpdateRoute(routeValues, "mode", "list"))">List</a><span class="mode active">Table</span>
}
else
{
<span class="mode active">List</span><a class="mode" href="@Url.Action("Index", "Search", RouteHelper.UpdateRoute(routeValues, "mode", "table"))">Table</a>
}
</div>
@if (SettingsHelper.GetGoogleAnalyticsEnabled())
{
<script language="javascript">
$('.mode').click(function () {
var mode = $(this).text();
_gaq.push([
'_trackEvent',
'Search',
'Mode',
mode]);
});
</script>
}
|
@using CkanDotNet.Api.Model
@using CkanDotNet.Web.Models
@using CkanDotNet.Web.Models.Helpers
@using System.Collections.Specialized
@model PackageSearchResultsModel
@{
var routeValues = RouteHelper.RouteFromParameters(Html.ViewContext);
// Remove the page number from the route values since we are doing client-side
// pagination in the table mode
RouteHelper.UpdateRoute(routeValues, "page", null);
}
<div class="results-mode">
@if (Model.DisplayMode == ResultsDisplayMode.Table)
{
<a class="mode" href="@Url.Action("Index", "Search", RouteHelper.UpdateRoute(routeValues, "mode", "list"))">List</a><span class="mode active">Table</span>
}
else
{
<span class="mode active">List</span><a class="mode" href="@Url.Action("Index", "Search", RouteHelper.UpdateRoute(routeValues, "mode", "table"))">Table</a>
}
</div>
|
apache-2.0
|
C#
|
01be59b347f8b1400f87a06ba517995fb6dcb622
|
add FillAccount method for stress tests
|
ceee/PocketSharp
|
PocketSharp.Tests/StressTests.cs
|
PocketSharp.Tests/StressTests.cs
|
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Xunit;
using PocketSharp.Models;
using System.IO;
using System.Linq;
using System.Diagnostics;
namespace PocketSharp.Tests
{
public class StressTests : TestsBase
{
private static IEnumerable<string> urls;
private static string[] tags = new string[]{ "css", "js", "csharp", "windows", "microsoft" };
public StressTests() : base()
{
// !! please don't misuse this account !!
client = new PocketClient(
consumerKey: "20000-786d0bc8c39294e9829111d6",
callbackUri: "http://frontendplay.com",
accessCode: "9b8ecb6b-7801-1a5c-7b39-2ba05b"
);
urls = File.ReadAllLines("../../url-10000.csv").Select(item => item.Split(',')[1]);
//await FillAccount(598, 10000);
}
[Fact]
public async Task Are100ItemsRetrievedProperly()
{
}
[Fact]
public void Are1000ItemsRetrievedProperly()
{
}
[Fact]
public void Are10000ItemsRetrievedProperly()
{
}
[Fact]
public void Are0ItemsRetrievedProperly()
{
}
[Fact]
public void IsSearchedSuccessfullyOn10000Items()
{
}
private async Task FillAccount(int offset, int count)
{
int r;
int r2;
string[] tag;
Random rnd = new Random();
foreach (string url in urls.Skip(offset).Take(count))
{
r = rnd.Next(tags.Length);
r2 = rnd.Next(tags.Length);
tag = new string[] { tags[r], tags[r2] };
await client.Add(new Uri("http://" + url), tag);
}
}
}
}
|
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Xunit;
using PocketSharp.Models;
using System.IO;
using System.Linq;
using System.Diagnostics;
namespace PocketSharp.Tests
{
public class StressTests : TestsBase
{
private static IEnumerable<string> urls;
private static string[] tags = new string[]{ "css", "js", "csharp", "windows", "microsoft" };
public StressTests() : base()
{
// !! please don't misuse this account !!
client = new PocketClient(
consumerKey: "20000-786d0bc8c39294e9829111d6",
callbackUri: "http://frontendplay.com",
accessCode: "9b8ecb6b-7801-1a5c-7b39-2ba05b"
);
urls = File.ReadAllLines("../../url-10000.csv").Select(item => item.Split(',')[1]);
}
[Fact]
public async Task Are100ItemsRetrievedProperly()
{
}
[Fact]
public void Are1000ItemsRetrievedProperly()
{
}
[Fact]
public void Are10000ItemsRetrievedProperly()
{
}
[Fact]
public void Are0ItemsRetrievedProperly()
{
}
[Fact]
public void IsSearchedSuccessfullyOn10000Items()
{
}
}
}
|
mit
|
C#
|
8c6c9b8f02b3142c8f247b900c1e59b7d759d9ab
|
Fix to alarm not triggering correctly
|
lucas-miranda/Raccoon
|
Raccoon/Core/Components/Alarm.cs
|
Raccoon/Core/Components/Alarm.cs
|
namespace Raccoon.Components {
public class Alarm : Component {
public Alarm(uint interval, System.Action action) {
NextActivationTimer = Interval = interval;
Action = action;
}
public System.Action Action { get; set; }
public uint Timer { get; private set; }
public uint NextActivationTimer { get; private set; }
public uint Interval { get; set; }
public uint RepeatTimes { get; set; } = uint.MaxValue;
public uint TriggeredCount { get; private set; }
public override void Update(int delta) {
Timer += (uint) delta;
if (TriggeredCount > RepeatTimes || Timer < NextActivationTimer) {
return;
}
Action();
TriggeredCount++;
NextActivationTimer += Interval;
}
public override void Render() {
}
public override void DebugRender() {
}
public void Reset() {
TriggeredCount = 0;
Timer = 0;
NextActivationTimer = Interval;
}
}
}
|
namespace Raccoon.Components {
public class Alarm : Component {
public Alarm(uint interval, System.Action action) {
NextActivationTimer = Interval = interval;
Action = action;
}
public System.Action Action { get; set; }
public uint Timer { get; private set; }
public uint NextActivationTimer { get; private set; }
public uint Interval { get; set; }
public uint RepeatTimes { get; set; } = uint.MaxValue;
public uint RepeatCount { get; private set; }
public override void Update(int delta) {
Timer += (uint) delta;
if (Timer < NextActivationTimer) {
return;
}
Action();
if (RepeatCount < RepeatTimes) {
RepeatCount++;
NextActivationTimer += Interval;
}
}
public override void Render() {
}
public override void DebugRender() {
}
public void Reset() {
RepeatCount = 0;
Timer = 0;
NextActivationTimer = Interval;
}
}
}
|
mit
|
C#
|
3ffbbf64e5d78c501442fe22abfd597b1c15827f
|
Clean up
|
abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,arknu/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS
|
src/Umbraco.Web.Common/Security/ConfigureIISServerOptions.cs
|
src/Umbraco.Web.Common/Security/ConfigureIISServerOptions.cs
|
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
namespace Umbraco.Cms.Web.Common.Security
{
public class ConfigureIISServerOptions : IConfigureOptions<IISServerOptions>
{
private readonly IOptions<RuntimeSettings> _runtimeSettings;
public ConfigureIISServerOptions(IOptions<RuntimeSettings> runtimeSettings) => _runtimeSettings = runtimeSettings;
public void Configure(IISServerOptions options)
{
// convert from KB to bytes
options.MaxRequestBodySize = _runtimeSettings.Value.MaxRequestLength.HasValue ? _runtimeSettings.Value.MaxRequestLength.Value * 1024 : uint.MaxValue; // ~4GB is the max supported value for IIS and IIS express.
}
}
}
|
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
namespace Umbraco.Cms.Web.Common.Security
{
public class ConfigureIISServerOptions : IConfigureOptions<IISServerOptions>
{
private readonly IOptions<RuntimeSettings> _runtimeSettings;
public ConfigureIISServerOptions(IOptions<RuntimeSettings> runtimeSettings) => _runtimeSettings = runtimeSettings;
public void Configure(IISServerOptions options)
{
// convert from KB to bytes
options.MaxRequestBodySize = _runtimeSettings.Value.MaxRequestLength.HasValue ? _runtimeSettings.Value.MaxRequestLength.Value * 1024 : uint.MaxValue; // ~4GB is the max supported value for IIS and IIS express.
//options.IisMaxRequestSizeLimit
}
}
}
|
mit
|
C#
|
9aa9049cc6056c6940392ef78c7a64dcaea3df27
|
Test some more cases for the simple single clause solver.
|
Logicalshift/Reason
|
LogicalShift.Reason.Tests/SingleClauseSolver.cs
|
LogicalShift.Reason.Tests/SingleClauseSolver.cs
|
using LogicalShift.Reason.Solvers;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
namespace LogicalShift.Reason.Tests
{
[TestFixture]
public class SingleClauseSolver
{
[Test]
public void SolveAsSelf()
{
var a = Literal.NewAtom();
var b = Literal.NewAtom();
var fab = Literal.NewFunctor(2).With(a, b);
var clause = Clause.Always(fab);
var solver = new SimpleSingleClauseSolver(clause, new NothingSolver());
Assert.IsTrue(solver.Query(fab)());
}
[Test]
public void SolveWithVariable()
{
var a = Literal.NewAtom();
var b = Literal.NewAtom();
var f = Literal.NewFunctor(2);
var X = Literal.NewVariable();
var fab = f.With(a, b);
var fXb = f.With(X, b);
var clause = Clause.Always(fab);
var solver = new SimpleSingleClauseSolver(clause, new NothingSolver());
Assert.IsTrue(solver.Query(fXb)());
}
[Test]
public void VariablesThatCantUnifyCantBeSolved1()
{
// An argument of f(X, X) can't unify against f(a, b) as X can't be both b and a
var a = Literal.NewAtom();
var b = Literal.NewAtom();
var f = Literal.NewFunctor(2);
var g = Literal.NewFunctor(1);
var X = Literal.NewVariable();
var gfab = g.With(f.With(a, b));
var gfXX = g.With(f.With(X, X));
var clause = Clause.Always(gfab);
var solver = new SimpleSingleClauseSolver(clause, new NothingSolver());
Assert.IsFalse(solver.Query(gfXX)());
}
[Test]
public void VariablesThatCantUnifyCantBeSolved2()
{
// The arguments a,b can't unify against X,X as X can't be both values
var a = Literal.NewAtom();
var b = Literal.NewAtom();
var f = Literal.NewFunctor(2);
var X = Literal.NewVariable();
var fab = f.With(a, b);
var fXX = f.With(X, X);
var clause = Clause.Always(fab);
var solver = new SimpleSingleClauseSolver(clause, new NothingSolver());
Assert.IsFalse(solver.Query(fXX)());
}
[Test]
public void DifferentDoesNotSolve()
{
var a = Literal.NewAtom();
var b = Literal.NewAtom();
var c = Literal.NewAtom();
var f = Literal.NewFunctor(2);
var fab = f.With(a, b);
var fac = f.With(a, c);
var clause = Clause.Always(fab);
var solver = new SimpleSingleClauseSolver(clause, new NothingSolver());
Assert.IsFalse(solver.Query(fac)());
}
}
}
|
using LogicalShift.Reason.Solvers;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
namespace LogicalShift.Reason.Tests
{
[TestFixture]
public class SingleClauseSolver
{
[Test]
public void SolveAsSelf()
{
var a = Literal.NewAtom();
var b = Literal.NewAtom();
var fab = Literal.NewFunctor(2).With(a, b);
var clause = Clause.Always(fab);
var solver = new SimpleSingleClauseSolver(clause, new NothingSolver());
Assert.IsTrue(solver.Query(fab)());
}
}
}
|
apache-2.0
|
C#
|
2cef4dc2db93b25ddd0cffa8d06b7a7fd8ea5ae2
|
Put the PatronFactoryTest in the correct namespace (which is the same as the class it is testing).
|
drovani/Vigil
|
test/Vigil.Patrons.Tests/PatronFactoryTest.cs
|
test/Vigil.Patrons.Tests/PatronFactoryTest.cs
|
using Moq;
using System;
using Vigil.Domain;
using Vigil.MessageQueue;
using Vigil.MessageQueue.Commands;
using Xunit;
namespace Vigil.Patrons
{
public class PatronFactoryTest
{
[Fact]
public void User_Can_Create_New_Patron()
{
var queue = new Mock<ICommandQueue>(MockBehavior.Strict);
queue.Setup(q => q.QueueCommand(It.IsAny<ICommand>(), It.IsAny<IKeyIdentity>())).Verifiable();
PatronFactory factory = new PatronFactory(queue.Object);
IKeyIdentity result = factory.CreatePatron(new CreatePatronCommand()
{
DisplayName = "Test User",
IsAnonymous = false,
PatronType = "Test Account"
});
queue.VerifyAll();
Assert.NotEqual(Guid.Empty, result.Id);
}
}
}
|
using Moq;
using System;
using Vigil.Domain;
using Vigil.MessageQueue;
using Vigil.MessageQueue.Commands;
using Xunit;
namespace Vigil.Patrons.Tests
{
public class PatronFactoryTest
{
[Fact]
public void User_Can_Create_New_Patron()
{
var queue = new Mock<ICommandQueue>(MockBehavior.Strict);
queue.Setup(q => q.QueueCommand(It.IsAny<ICommand>(), It.IsAny<IKeyIdentity>())).Verifiable();
PatronFactory factory = new PatronFactory(queue.Object);
IKeyIdentity result = factory.CreatePatron(new CreatePatronCommand()
{
DisplayName = "Test User",
IsAnonymous = false,
PatronType = "Test Account"
});
queue.VerifyAll();
Assert.NotEqual(Guid.Empty, result.Id);
}
}
}
|
apache-2.0
|
C#
|
cc9df4bfb15b52f76e848bc64d758deb52520b2f
|
Increment version
|
SmithAndr/octokit.net,Sarmad93/octokit.net,SLdragon1989/octokit.net,naveensrinivasan/octokit.net,devkhan/octokit.net,Red-Folder/octokit.net,eriawan/octokit.net,octokit/octokit.net,octokit-net-test-org/octokit.net,SamTheDev/octokit.net,magoswiat/octokit.net,chunkychode/octokit.net,khellang/octokit.net,shana/octokit.net,ChrisMissal/octokit.net,ivandrofly/octokit.net,TattsGroup/octokit.net,shiftkey/octokit.net,dampir/octokit.net,nsnnnnrn/octokit.net,ivandrofly/octokit.net,hahmed/octokit.net,devkhan/octokit.net,michaKFromParis/octokit.net,dlsteuer/octokit.net,dampir/octokit.net,shiftkey-tester/octokit.net,gdziadkiewicz/octokit.net,darrelmiller/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,thedillonb/octokit.net,rlugojr/octokit.net,gdziadkiewicz/octokit.net,daukantas/octokit.net,brramos/octokit.net,mminns/octokit.net,rlugojr/octokit.net,shiftkey-tester/octokit.net,M-Zuber/octokit.net,cH40z-Lord/octokit.net,SamTheDev/octokit.net,eriawan/octokit.net,bslliw/octokit.net,octokit-net-test/octokit.net,shiftkey/octokit.net,adamralph/octokit.net,nsrnnnnn/octokit.net,hitesh97/octokit.net,octokit-net-test-org/octokit.net,fake-organization/octokit.net,geek0r/octokit.net,khellang/octokit.net,Sarmad93/octokit.net,gabrielweyer/octokit.net,alfhenrik/octokit.net,TattsGroup/octokit.net,chunkychode/octokit.net,mminns/octokit.net,thedillonb/octokit.net,takumikub/octokit.net,fffej/octokit.net,forki/octokit.net,octokit/octokit.net,hahmed/octokit.net,shana/octokit.net,alfhenrik/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,editor-tools/octokit.net,gabrielweyer/octokit.net,kolbasov/octokit.net,kdolan/octokit.net,SmithAndr/octokit.net,editor-tools/octokit.net,M-Zuber/octokit.net
|
SolutionInfo.cs
|
SolutionInfo.cs
|
// <auto-generated/>
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProductAttribute("Octokit")]
[assembly: AssemblyVersionAttribute("0.1.9")]
[assembly: AssemblyFileVersionAttribute("0.1.9")]
[assembly: ComVisibleAttribute(false)]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.1.9";
}
}
|
// <auto-generated/>
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProductAttribute("Octokit")]
[assembly: AssemblyVersionAttribute("0.1.8")]
[assembly: AssemblyFileVersionAttribute("0.1.8")]
[assembly: ComVisibleAttribute(false)]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.1.8";
}
}
|
mit
|
C#
|
2a7fd462334c6d305bca6815f5a424437268b3aa
|
Change "Sidebar" "Tooltip Type" option default value
|
danielchalmers/DesktopWidgets
|
DesktopWidgets/Widgets/Sidebar/Settings.cs
|
DesktopWidgets/Widgets/Sidebar/Settings.cs
|
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using DesktopWidgets.WidgetBase.Settings;
namespace DesktopWidgets.Widgets.Sidebar
{
public class Settings : WidgetSettingsBase
{
[Browsable(false)]
[DisplayName("Shortcuts")]
public ObservableCollection<Shortcut> Shortcuts { get; set; }
[Category("Shortcut Style")]
[DisplayName("Icon Position")]
public IconPosition IconPosition { get; set; } = IconPosition.Left;
[Category("Shortcut Style")]
[DisplayName("Tooltip Type")]
public ToolTipType ToolTipType { get; set; } = ToolTipType.Path;
[Category("Shortcut Style")]
[DisplayName("Horizontal Alignment")]
public HorizontalAlignment ButtonHorizontalAlignment { get; set; } = HorizontalAlignment.Center;
[Category("Shortcut Style")]
[DisplayName("Vertical Alignment")]
public VerticalAlignment ButtonVerticalAlignment { get; set; } = VerticalAlignment.Center;
[Category("Shortcut Style")]
[DisplayName("Icon Scaling Mode")]
public ImageScalingMode IconScalingMode { get; set; } = ImageScalingMode.LowQuality;
[Category("Shortcut Style")]
[DisplayName("Content Mode")]
public ShortcutContentMode ShortcutContentMode { get; set; } = ShortcutContentMode.Both;
[Category("Style")]
[DisplayName("Orientation")]
public ShortcutOrientation ShortcutOrientation { get; set; } = ShortcutOrientation.Vertical;
[Category("Shortcut Style")]
[DisplayName("Height")]
public int ButtonHeight { get; set; } = 32;
[Category("Behavior (Hideable)")]
[DisplayName("Hide on Shortcut Launch")]
public bool HideOnExecute { get; set; } = true;
[Category("General")]
[DisplayName("Allow Drag Drop Files")]
public bool AllowDropFiles { get; set; } = true;
[Browsable(false)]
[DisplayName("Default Shortcuts Mode")]
public DefaultShortcutsMode DefaultShortcutsMode { get; set; } = DefaultShortcutsMode.Preset;
[Category("General")]
[DisplayName("Parse Shortcut Files")]
public bool ParseShortcutFiles { get; set; } = false;
[Category("General")]
[DisplayName("Enable Icon Cache")]
public bool UseIconCache { get; set; } = true;
[Category("Behavior")]
[DisplayName("Keep Open With Modifier Key")]
public ModifierKeys KeepOpenWithModifierKey { get; set; } = ModifierKeys.Control;
}
}
|
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using DesktopWidgets.WidgetBase.Settings;
namespace DesktopWidgets.Widgets.Sidebar
{
public class Settings : WidgetSettingsBase
{
[Browsable(false)]
[DisplayName("Shortcuts")]
public ObservableCollection<Shortcut> Shortcuts { get; set; }
[Category("Shortcut Style")]
[DisplayName("Icon Position")]
public IconPosition IconPosition { get; set; } = IconPosition.Left;
[Category("Shortcut Style")]
[DisplayName("Tooltip Type")]
public ToolTipType ToolTipType { get; set; } = ToolTipType.None;
[Category("Shortcut Style")]
[DisplayName("Horizontal Alignment")]
public HorizontalAlignment ButtonHorizontalAlignment { get; set; } = HorizontalAlignment.Center;
[Category("Shortcut Style")]
[DisplayName("Vertical Alignment")]
public VerticalAlignment ButtonVerticalAlignment { get; set; } = VerticalAlignment.Center;
[Category("Shortcut Style")]
[DisplayName("Icon Scaling Mode")]
public ImageScalingMode IconScalingMode { get; set; } = ImageScalingMode.LowQuality;
[Category("Shortcut Style")]
[DisplayName("Content Mode")]
public ShortcutContentMode ShortcutContentMode { get; set; } = ShortcutContentMode.Both;
[Category("Style")]
[DisplayName("Orientation")]
public ShortcutOrientation ShortcutOrientation { get; set; } = ShortcutOrientation.Vertical;
[Category("Shortcut Style")]
[DisplayName("Height")]
public int ButtonHeight { get; set; } = 32;
[Category("Behavior (Hideable)")]
[DisplayName("Hide on Shortcut Launch")]
public bool HideOnExecute { get; set; } = true;
[Category("General")]
[DisplayName("Allow Drag Drop Files")]
public bool AllowDropFiles { get; set; } = true;
[Browsable(false)]
[DisplayName("Default Shortcuts Mode")]
public DefaultShortcutsMode DefaultShortcutsMode { get; set; } = DefaultShortcutsMode.Preset;
[Category("General")]
[DisplayName("Parse Shortcut Files")]
public bool ParseShortcutFiles { get; set; } = false;
[Category("General")]
[DisplayName("Enable Icon Cache")]
public bool UseIconCache { get; set; } = true;
[Category("Behavior")]
[DisplayName("Keep Open With Modifier Key")]
public ModifierKeys KeepOpenWithModifierKey { get; set; } = ModifierKeys.Control;
}
}
|
apache-2.0
|
C#
|
20019a28814e8827c7a3022512d0fc37f617b3bb
|
Set version number to default
|
oopanuga/Common-Provider
|
CommonProvider/Properties/AssemblyInfo.cs
|
CommonProvider/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("CommonProvider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CommonProvider")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("CommonProvider.Tests")]
//[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("66f8c303-60aa-4d30-aa6c-0af2e5676d80")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CommonProvider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CommonProvider")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("CommonProvider.Tests")]
//[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("66f8c303-60aa-4d30-aa6c-0af2e5676d80")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.4.0")]
[assembly: AssemblyFileVersion("2.0.4.0")]
|
mit
|
C#
|
2eeae6fb67741f4386d2691a152e1862f4fa017a
|
Add optional --teamcity argument for NUnit3 build task
|
gmartin7/libpalaso,andrew-polk/libpalaso,andrew-polk/libpalaso,andrew-polk/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,gmartin7/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,ddaspit/libpalaso,andrew-polk/libpalaso,gtryus/libpalaso,sillsdev/libpalaso,tombogle/libpalaso,ddaspit/libpalaso,tombogle/libpalaso,gtryus/libpalaso,tombogle/libpalaso,gmartin7/libpalaso,gmartin7/libpalaso,ermshiperete/libpalaso,sillsdev/libpalaso,ermshiperete/libpalaso,gtryus/libpalaso,sillsdev/libpalaso,glasseyes/libpalaso,ermshiperete/libpalaso,glasseyes/libpalaso,ddaspit/libpalaso,ddaspit/libpalaso,tombogle/libpalaso,sillsdev/libpalaso
|
Palaso.MSBuildTasks/UnitTestTasks/NUnit3.cs
|
Palaso.MSBuildTasks/UnitTestTasks/NUnit3.cs
|
// Copyright (c) 2016 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System.Text;
namespace Palaso.BuildTasks.UnitTestTasks
{
/// <summary>
/// Run NUnit3 on a test assembly.
/// </summary>
public class NUnit3 : NUnit
{
private bool? _useNUnit3Xml;
public bool UseNUnit3Xml
{
get { return _useNUnit3Xml.HasValue && _useNUnit3Xml.Value; }
set { _useNUnit3Xml = value; }
}
public bool NoColor { get; set; }
/// <summary>
/// Should be set to true if the tests are running on a TeamCity server.
/// Adds --teamcity which "Turns on use of TeamCity service messages."
/// </summary>
public bool TeamCity { get; set; }
/// <summary>
/// Gets the name (without path) of the NUnit executable. When running on Mono this is
/// different from ProgramNameAndPath() which returns the executable we'll start.
/// </summary>
protected override string RealProgramName
{
get
{
return "nunit3-console.exe";
}
}
protected override string AddAdditionalProgramArguments()
{
var bldr = new StringBuilder();
//bldr.Append(" --noheader");
// We don't support TestInNewThread for now
if (!string.IsNullOrEmpty(OutputXmlFile))
{
bldr.AppendFormat(" \"--result:{0};format={1}\"", OutputXmlFile,
UseNUnit3Xml ? "nunit3" : "nunit2");
}
bldr.Append(" --labels=All");
if (NoColor)
bldr.Append(" --nocolor");
if (Force32Bit)
bldr.Append(" --x86");
if (TeamCity)
bldr.Append(" --teamcity");
return bldr.ToString();
}
}
}
|
// Copyright (c) 2016 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System.Text;
namespace Palaso.BuildTasks.UnitTestTasks
{
/// <summary>
/// Run NUnit on a test assembly.
/// </summary>
public class NUnit3 : NUnit
{
private bool? _useNUnit3Xml;
public bool UseNUnit3Xml
{
get { return _useNUnit3Xml.HasValue && _useNUnit3Xml.Value; }
set { _useNUnit3Xml = value; }
}
public bool NoColor { get; set; }
/// <summary>
/// Gets the name (without path) of the NUnit executable. When running on Mono this is
/// different from ProgramNameAndPath() which returns the executable we'll start.
/// </summary>
protected override string RealProgramName
{
get
{
return "nunit3-console.exe";
}
}
protected override string AddAdditionalProgramArguments()
{
var bldr = new StringBuilder();
//bldr.Append(" --noheader");
// We don't support TestInNewThread for now
if (!string.IsNullOrEmpty(OutputXmlFile))
{
bldr.AppendFormat(" \"--result:{0};format={1}\"", OutputXmlFile,
UseNUnit3Xml ? "nunit3" : "nunit2");
}
bldr.Append(" --labels=All");
if (NoColor)
bldr.Append(" --nocolor");
if (Force32Bit)
bldr.Append(" --x86");
return bldr.ToString();
}
}
}
|
mit
|
C#
|
95d55df6306d4aab7a195a670afcf273f4e603a1
|
update MockWebSocket
|
Mazyod/PhoenixSharp
|
PhoenixTests/WebSocketImpl/MockWebSocket.cs
|
PhoenixTests/WebSocketImpl/MockWebSocket.cs
|
using Phoenix;
using System.Collections.Generic;
namespace PhoenixTests {
public sealed class MockWebsocketAdapter : IWebsocket {
public WebsocketState mockState = WebsocketState.Closed;
public readonly WebsocketConfiguration config;
public MockWebsocketAdapter(WebsocketConfiguration config) {
this.config = config;
}
#region IWebsocket methods
public WebsocketState state => mockState;
public int callConnectCount = 0;
public void Connect() {
callConnectCount += 1;
mockState = WebsocketState.Open;
config.onOpenCallback?.Invoke(this);
}
public List<string> callSend = new();
public void Send(string message) {
callSend.Add(message);
}
public int callCloseCount = 0;
public void Close(ushort? code = null, string message = null) {
callCloseCount += 1;
config.onCloseCallback?.Invoke(this, code ?? 0, message);
}
#endregion
}
public sealed class MockWebsocketFactory : IWebsocketFactory {
public IWebsocket Build(WebsocketConfiguration config) => new MockWebsocketAdapter(config);
}
}
|
using Phoenix;
using System.Collections.Generic;
namespace PhoenixTests {
public sealed class MockWebsocketAdapter : IWebsocket {
public readonly WebsocketConfiguration config;
public MockWebsocketAdapter(WebsocketConfiguration config) {
this.config = config;
}
#region IWebsocket methods
public WebsocketState state => mockState;
public WebsocketState mockState = WebsocketState.Closed;
public int callConnectCount = 0;
public void Connect() {
callConnectCount += 1;
}
public List<string> callSend = new();
public void Send(string message) {
callSend.Add(message);
}
public int callCloseCount = 0;
public void Close(ushort? code = null, string message = null) {
callCloseCount += 1;
}
#endregion
}
public sealed class MockWebsocketFactory : IWebsocketFactory {
public IWebsocket Build(WebsocketConfiguration config) => new MockWebsocketAdapter(config);
}
}
|
mit
|
C#
|
737dd1bd3e698a341dfeebd772e98d558ceee31b
|
update version
|
mjsmith11/jeopardy
|
Jeopardy_Game/Properties/AssemblyInfo.cs
|
Jeopardy_Game/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("Jeopardy_Game")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jeopardy_Game")]
[assembly: AssemblyCopyright("Copyright © 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("c669ae19-9947-41c1-8de5-594294badf04")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.3.0")]
[assembly: AssemblyFileVersion("1.2.3.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Jeopardy_Game")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jeopardy_Game")]
[assembly: AssemblyCopyright("Copyright © 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("c669ae19-9947-41c1-8de5-594294badf04")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
6f18461738e0ac88a470e1636dceac4b830526e5
|
Remove previously obsoleted CompareResult.MergedBaseCommit property
|
editor-tools/octokit.net,shiftkey-tester/octokit.net,alfhenrik/octokit.net,TattsGroup/octokit.net,adamralph/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,alfhenrik/octokit.net,TattsGroup/octokit.net,thedillonb/octokit.net,shiftkey-tester/octokit.net,octokit/octokit.net,dampir/octokit.net,M-Zuber/octokit.net,khellang/octokit.net,thedillonb/octokit.net,rlugojr/octokit.net,editor-tools/octokit.net,khellang/octokit.net,octokit/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,dampir/octokit.net,gdziadkiewicz/octokit.net,ivandrofly/octokit.net,ivandrofly/octokit.net,eriawan/octokit.net,shiftkey/octokit.net,gdziadkiewicz/octokit.net,eriawan/octokit.net,shiftkey/octokit.net,M-Zuber/octokit.net,rlugojr/octokit.net
|
Octokit/Models/Response/CompareResult.cs
|
Octokit/Models/Response/CompareResult.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
namespace Octokit
{
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class CompareResult
{
public CompareResult() { }
public CompareResult(string url, string htmlUrl, string permalinkUrl, string diffUrl, string patchUrl, GitHubCommit baseCommit, GitHubCommit mergeBaseCommit, string status, int aheadBy, int behindBy, int totalCommits, IReadOnlyList<GitHubCommit> commits, IReadOnlyList<GitHubCommitFile> files)
{
Url = url;
HtmlUrl = htmlUrl;
PermalinkUrl = permalinkUrl;
DiffUrl = diffUrl;
PatchUrl = patchUrl;
BaseCommit = baseCommit;
MergeBaseCommit = mergeBaseCommit;
Status = status;
AheadBy = aheadBy;
BehindBy = behindBy;
TotalCommits = totalCommits;
Commits = commits;
Files = files;
}
public string Url { get; protected set; }
public string HtmlUrl { get; protected set; }
public string PermalinkUrl { get; protected set; }
public string DiffUrl { get; protected set; }
public string PatchUrl { get; protected set; }
public GitHubCommit BaseCommit { get; protected set; }
public GitHubCommit MergeBaseCommit { get; protected set; }
public string Status { get; protected set; }
public int AheadBy { get; protected set; }
public int BehindBy { get; protected set; }
public int TotalCommits { get; protected set; }
public IReadOnlyList<GitHubCommit> Commits { get; protected set; }
public IReadOnlyList<GitHubCommitFile> Files { get; protected set; }
internal string DebuggerDisplay
{
get
{
return string.Format(CultureInfo.InvariantCulture, "Status: {0} Ahead By: {1}, Behind By: {2}", Status, AheadBy, BehindBy);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
namespace Octokit
{
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class CompareResult
{
public CompareResult() { }
public CompareResult(string url, string htmlUrl, string permalinkUrl, string diffUrl, string patchUrl, GitHubCommit baseCommit, GitHubCommit mergeBaseCommit, string status, int aheadBy, int behindBy, int totalCommits, IReadOnlyList<GitHubCommit> commits, IReadOnlyList<GitHubCommitFile> files)
{
Url = url;
HtmlUrl = htmlUrl;
PermalinkUrl = permalinkUrl;
DiffUrl = diffUrl;
PatchUrl = patchUrl;
BaseCommit = baseCommit;
MergeBaseCommit = mergeBaseCommit;
Status = status;
AheadBy = aheadBy;
BehindBy = behindBy;
TotalCommits = totalCommits;
Commits = commits;
Files = files;
}
public string Url { get; protected set; }
public string HtmlUrl { get; protected set; }
public string PermalinkUrl { get; protected set; }
public string DiffUrl { get; protected set; }
public string PatchUrl { get; protected set; }
public GitHubCommit BaseCommit { get; protected set; }
[Obsolete("This property is obsolete. Use MergeBaseCommit instead.", false)]
public GitHubCommit MergedBaseCommit { get; protected set; }
public GitHubCommit MergeBaseCommit { get; protected set; }
public string Status { get; protected set; }
public int AheadBy { get; protected set; }
public int BehindBy { get; protected set; }
public int TotalCommits { get; protected set; }
public IReadOnlyList<GitHubCommit> Commits { get; protected set; }
public IReadOnlyList<GitHubCommitFile> Files { get; protected set; }
internal string DebuggerDisplay
{
get
{
return string.Format(CultureInfo.InvariantCulture, "Status: {0} Ahead By: {1}, Behind By: {2}", Status, AheadBy, BehindBy);
}
}
}
}
|
mit
|
C#
|
4892f9a3bdcba86fd2a2c76eca995cdb4f15e415
|
Bump version
|
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
|
R7.University/Properties/AssemblyInfo.cs
|
R7.University/Properties/AssemblyInfo.cs
|
using System.Reflection;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("R7.University")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("R7.Labs")]
[assembly: AssemblyProduct("R7.University")]
[assembly: AssemblyCopyright("Roman M. Yagodin")]
[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("2.0.0.*")]
[assembly: AssemblyInformationalVersion("2.0.0-rc.2")]
// 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("")]
|
using System.Reflection;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("R7.University")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("R7.Labs")]
[assembly: AssemblyProduct("R7.University")]
[assembly: AssemblyCopyright("Roman M. Yagodin")]
[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("2.0.0.*")]
[assembly: AssemblyInformationalVersion("2.0.0-rc.1")]
// 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("")]
|
agpl-3.0
|
C#
|
dc890999a0aed4c8b7073093245a5990b946c36b
|
Revert "Added incoming_webhook to Access Token Response"
|
Inumedia/SlackAPI
|
SlackAPI/RPCMessages/AccessTokenResponse.cs
|
SlackAPI/RPCMessages/AccessTokenResponse.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlackAPI
{
[RequestPath("oauth.access")]
public class AccessTokenResponse : Response
{
public string access_token;
public string scope;
public string team_name;
public string team_id { get; set; }
public BotTokenResponse bot;
}
public class BotTokenResponse
{
public string emoji;
public string image_24;
public string image_32;
public string image_48;
public string image_72;
public string image_192;
public bool deleted;
public UserProfile icons;
public string id;
public string name;
public string bot_user_id;
public string bot_access_token;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlackAPI
{
[RequestPath("oauth.access")]
public class AccessTokenResponse : Response
{
public string access_token;
public string scope;
public string team_name;
public string team_id { get; set; }
public BotTokenResponse bot;
public IncomingWebhook incoming_webhook { get; set; }
}
public class BotTokenResponse
{
public string emoji;
public string image_24;
public string image_32;
public string image_48;
public string image_72;
public string image_192;
public bool deleted;
public UserProfile icons;
public string id;
public string name;
public string bot_user_id;
public string bot_access_token;
}
public class IncomingWebhook
{
public string channel { get; set; }
public string channel_id { get; set; }
public string configuration_url { get; set; }
public string url { get; set; }
}
}
|
mit
|
C#
|
2a9ac1bde32e453b124c54780879055fd6e29885
|
Update DataProviderElement.cs
|
barsgroup/bars2db,barsgroup/linq2db,inickvel/linq2db,MaceWindu/linq2db,lvaleriu/linq2db,enginekit/linq2db,jogibear9988/linq2db,sdanyliv/linq2db,genusP/linq2db,LinqToDB4iSeries/linq2db,ronnyek/linq2db,rechkalov/linq2db,sdanyliv/linq2db,MaceWindu/linq2db,genusP/linq2db,AK107/linq2db,lvaleriu/linq2db,AK107/linq2db,jogibear9988/linq2db,LinqToDB4iSeries/linq2db,giuliohome/linq2db,linq2db/linq2db,linq2db/linq2db
|
Source/Configuration/DataProviderElement.cs
|
Source/Configuration/DataProviderElement.cs
|
using System;
using System.Configuration;
namespace LinqToDB.Configuration
{
using DataProvider;
public class DataProviderElement : ElementBase
{
static readonly ConfigurationProperty _propTypeName = new ConfigurationProperty("type", typeof(string), string.Empty, ConfigurationPropertyOptions.IsRequired);
static readonly ConfigurationProperty _propName = new ConfigurationProperty("name", typeof(string), string.Empty, ConfigurationPropertyOptions.None);
static readonly ConfigurationProperty _propDefault = new ConfigurationProperty("default", typeof(bool), false, ConfigurationPropertyOptions.None);
public DataProviderElement()
{
Properties.Add(_propTypeName);
Properties.Add(_propName);
Properties.Add(_propDefault);
}
/// <summary>
/// Gets or sets an assembly qualified type name of this data provider.
/// </summary>
public string TypeName
{
get { return (string)base[_propTypeName]; }
}
/// <summary>
/// Gets or sets a name of this data provider.
/// If not set, <see cref="DataProviderBase.Name"/> is used.
/// </summary>
public string Name
{
get { return (string)base[_propName]; }
}
/// <summary>
/// Gets a value indicating whether the provider is default.
/// </summary>
public bool Default
{
get { return (bool)base[_propDefault]; }
}
}
}
|
using System;
using System.Configuration;
namespace LinqToDB.Configuration
{
using DataProvider;
class DataProviderElement : ElementBase
{
static readonly ConfigurationProperty _propTypeName = new ConfigurationProperty("type", typeof(string), string.Empty, ConfigurationPropertyOptions.IsRequired);
static readonly ConfigurationProperty _propName = new ConfigurationProperty("name", typeof(string), string.Empty, ConfigurationPropertyOptions.None);
static readonly ConfigurationProperty _propDefault = new ConfigurationProperty("default", typeof(bool), false, ConfigurationPropertyOptions.None);
public DataProviderElement()
{
Properties.Add(_propTypeName);
Properties.Add(_propName);
Properties.Add(_propDefault);
}
/// <summary>
/// Gets or sets an assembly qualified type name of this data provider.
/// </summary>
public string TypeName
{
get { return (string)base[_propTypeName]; }
}
/// <summary>
/// Gets or sets a name of this data provider.
/// If not set, <see cref="DataProviderBase.Name"/> is used.
/// </summary>
public string Name
{
get { return (string)base[_propName]; }
}
/// <summary>
/// Gets a value indicating whether the provider is default.
/// </summary>
public bool Default
{
get { return (bool)base[_propDefault]; }
}
}
}
|
mit
|
C#
|
ead029f053014a5775245bec27f459c0ee74492d
|
add star and end date for seasons
|
YeeRSoft/broken-shoe-league,YeeRSoft/broken-shoe-league,YeeRSoft/broken-shoe-league
|
Source/BrokenShoeLeague.Domain/Season.cs
|
Source/BrokenShoeLeague.Domain/Season.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace BrokenShoeLeague.Domain
{
public class Season
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public ICollection<Matchday> Matchdays { get; set; }
public void Update(string name, DateTime startDate, DateTime endDate)
{
Name = name;
StartDate = startDate;
EndDate = endDate;
}
}
}
|
using System.Collections.Generic;
namespace BrokenShoeLeague.Domain
{
public class Season
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<Matchday> Matchdays { get; set; }
}
}
|
mit
|
C#
|
30faa0c93ab3012be2a6a4f7c9bf2159b140098c
|
Add the missing enum value to ListMemberStatus
|
Jericho/CakeMail.RestClient
|
CakeMail.RestClient/Models/ListMemberStatus.cs
|
CakeMail.RestClient/Models/ListMemberStatus.cs
|
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;
namespace CakeMail.RestClient.Models
{
[JsonConverter(typeof(StringEnumConverter))]
public enum ListMemberStatus
{
[EnumMember(Value = "active")]
Active,
[EnumMember(Value = "unsubscribed")]
Unsubscribed,
[EnumMember(Value = "deleted")]
Deleted,
[EnumMember(Value = "inactive_bounced")]
InactiveBounced,
[EnumMember(Value = "active_bounced")]
ActiveBounced,
[EnumMember(Value = "spam")]
Spam
}
}
|
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;
namespace CakeMail.RestClient.Models
{
[JsonConverter(typeof(StringEnumConverter))]
public enum ListMemberStatus
{
[EnumMember(Value = "active")]
Active,
[EnumMember(Value = "unsubscribed")]
Unsubscribed,
[EnumMember(Value = "deleted")]
Deleted,
[EnumMember(Value = "inactive_bounced")]
InactiveBounced,
[EnumMember(Value = "spam")]
Spam
}
}
|
mit
|
C#
|
05a793c2157d65334f33874711475ac03d86959a
|
Remove debugging print statement
|
bitstadium/HockeySDK-Windows,ChristopheLav/HockeySDK-Windows
|
Src/Kit.UWP/HockeyClientExtensionsUwp.cs
|
Src/Kit.UWP/HockeyClientExtensionsUwp.cs
|
namespace Microsoft.HockeyApp
{
using Extensibility.Windows;
using Services;
using Services.Device;
/// <summary>
/// Send information to the HockeyApp service.
/// </summary>
public static class HockeyClientExtensionsUwp
{
/// <summary>
/// Bootstraps HockeyApp SDK.
/// </summary>
/// <param name="this"><see cref="HockeyClient"/></param>
/// <param name="appId">The application identifier, which is a unique hash string which is automatically created when you add a new application to HockeyApp.</param>
public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appId)
{
return Configure(@this, appId, null) as IHockeyClientConfigurable;
}
/// <summary>
/// Bootstraps HockeyApp SDK.
/// </summary>
/// <param name="this"><see cref="HockeyClient"/></param>
/// <param name="appId">The application identifier, which is a unique hash string which is automatically created when you add a new application to HockeyApp service.</param>
/// <param name="configuration">Telemetry Configuration.</param>
public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appId, TelemetryConfiguration configuration)
{
if (@this.AsInternal().TestAndSetIsConfigured())
{
return @this as IHockeyClientConfigurable;
}
ServiceLocator.AddService<BaseStorageService>(new StorageService());
ServiceLocator.AddService<IApplicationService>(new ApplicationService());
ServiceLocator.AddService<IDeviceService>(new DeviceService());
ServiceLocator.AddService<Services.IPlatformService>(new PlatformService());
ServiceLocator.AddService<IHttpService>(new HttpClientTransmission());
ServiceLocator.AddService<IUnhandledExceptionTelemetryModule>(new UnhandledExceptionTelemetryModule());
WindowsAppInitializer.InitializeAsync(appId, configuration);
return @this as IHockeyClientConfigurable;
}
}
}
|
namespace Microsoft.HockeyApp
{
using Extensibility.Windows;
using Services;
using Services.Device;
/// <summary>
/// Send information to the HockeyApp service.
/// </summary>
public static class HockeyClientExtensionsUwp
{
/// <summary>
/// Bootstraps HockeyApp SDK.
/// </summary>
/// <param name="this"><see cref="HockeyClient"/></param>
/// <param name="appId">The application identifier, which is a unique hash string which is automatically created when you add a new application to HockeyApp.</param>
public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appId)
{
return Configure(@this, appId, null) as IHockeyClientConfigurable;
}
/// <summary>
/// Bootstraps HockeyApp SDK.
/// </summary>
/// <param name="this"><see cref="HockeyClient"/></param>
/// <param name="appId">The application identifier, which is a unique hash string which is automatically created when you add a new application to HockeyApp service.</param>
/// <param name="configuration">Telemetry Configuration.</param>
public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appId, TelemetryConfiguration configuration)
{
if (@this.AsInternal().TestAndSetIsConfigured())
{
return @this as IHockeyClientConfigurable;
}
System.Diagnostics.Debug.WriteLine("Configuring");
ServiceLocator.AddService<BaseStorageService>(new StorageService());
ServiceLocator.AddService<IApplicationService>(new ApplicationService());
ServiceLocator.AddService<IDeviceService>(new DeviceService());
ServiceLocator.AddService<Services.IPlatformService>(new PlatformService());
ServiceLocator.AddService<IHttpService>(new HttpClientTransmission());
ServiceLocator.AddService<IUnhandledExceptionTelemetryModule>(new UnhandledExceptionTelemetryModule());
WindowsAppInitializer.InitializeAsync(appId, configuration);
return @this as IHockeyClientConfigurable;
}
}
}
|
mit
|
C#
|
d8b6cf7c8347ad5430b94ae04a601b12eba02e81
|
Make NetKeyValue partial to support the added functions
|
Facepunch/Facepunch.Steamworks,Facepunch/Facepunch.Steamworks,Facepunch/Facepunch.Steamworks
|
Facepunch.Steamworks/Networking/NetKeyValue.cs
|
Facepunch.Steamworks/Networking/NetKeyValue.cs
|
using Steamworks.Data;
using System;
using System.Runtime.InteropServices;
namespace Steamworks.Data
{
[StructLayout( LayoutKind.Explicit, Pack = Platform.StructPlatformPackSize )]
internal partial struct NetKeyValue
{
[FieldOffset(0)]
internal NetConfig Value; // m_eValue ESteamNetworkingConfigValue
[FieldOffset( 4 )]
internal NetConfigType DataType; // m_eDataType ESteamNetworkingConfigDataType
[FieldOffset( 8 )]
internal long Int64Value; // m_int64 int64_t
[FieldOffset( 8 )]
internal int Int32Value; // m_val_int32 int32_t
[FieldOffset( 8 )]
internal float FloatValue; // m_val_float float
[FieldOffset( 8 )]
internal IntPtr PointerValue; // m_val_functionPtr void *
// TODO - support strings, maybe
}
}
|
using Steamworks.Data;
using System;
using System.Runtime.InteropServices;
namespace Steamworks.Data
{
[StructLayout( LayoutKind.Explicit, Pack = Platform.StructPlatformPackSize )]
internal struct NetKeyValue
{
[FieldOffset(0)]
internal NetConfig Value; // m_eValue ESteamNetworkingConfigValue
[FieldOffset( 4 )]
internal NetConfigType DataType; // m_eDataType ESteamNetworkingConfigDataType
[FieldOffset( 8 )]
internal long Int64Value; // m_int64 int64_t
[FieldOffset( 8 )]
internal int Int32Value; // m_val_int32 int32_t
[FieldOffset( 8 )]
internal float FloatValue; // m_val_float float
[FieldOffset( 8 )]
internal IntPtr PointerValue; // m_val_functionPtr void *
// TODO - support strings, maybe
}
}
|
mit
|
C#
|
c9a6dfe3974260a2b0ee29ba63d23971af5544b5
|
add ParkingPermit validation type
|
smbc-digital/iag-contentapi
|
src/StockportContentApi/Enums/EPaymentReferenceValidation.cs
|
src/StockportContentApi/Enums/EPaymentReferenceValidation.cs
|
namespace StockportContentApi.Enums
{
public enum EPaymentReferenceValidation
{
None,
ParkingFine,
BusLaneAndCamera,
FPN,
CameraCar,
BusLane,
Applications,
ParkingPermit
}
}
|
namespace StockportContentApi.Enums
{
public enum EPaymentReferenceValidation
{
None,
ParkingFine,
BusLaneAndCamera,
FPN,
CameraCar,
BusLane,
Applications
}
}
|
mit
|
C#
|
ac1bbc537321cc5787049529902d8e37f0b33c47
|
Remove duplicate implementation.
|
brendanjbaker/StraightSQL
|
src/StraightSql/Entity/IEntityConfigurationOptionsBuilder.cs
|
src/StraightSql/Entity/IEntityConfigurationOptionsBuilder.cs
|
namespace StraightSql.Entity
{
using System;
using System.Linq.Expressions;
public interface IEntityConfigurationOptionsBuilder<TEntity>
{
IEntityConfigurationOptionsBuilder<TEntity> AddField<TField>(Expression<Func<TEntity, TField>> expression, String name);
IEntityConfiguration Build();
}
}
|
namespace StraightSql.Entity
{
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
public class EntityConfigurationOptionsBuilder<TEntity>
: IEntityConfigurationOptionsBuilder<TEntity>
{
private readonly String name;
private readonly ICollection<IEntityFieldConfiguration> fieldConfigurations;
public EntityConfigurationOptionsBuilder(String name)
: this(name, new List<IEntityFieldConfiguration>()) { }
public EntityConfigurationOptionsBuilder(String name, ICollection<IEntityFieldConfiguration> fieldConfigurations)
{
this.name = name;
this.fieldConfigurations = fieldConfigurations;
}
public IEntityConfigurationOptionsBuilder<TEntity> AddField<TField>(Expression<Func<TEntity, TField>> expression, String name)
{
fieldConfigurations.Add(EntityFieldConfiguration.Create(expression, name));
return this;
}
public IEntityConfiguration Build()
{
return new EntityConfiguration(name, typeof(TEntity), fieldConfigurations);
}
}
}
|
mit
|
C#
|
04c1b6f87ee94cd66f0c856b1d50d57f6186086d
|
Update TemplateDragAndDropListBox.cs
|
wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
Core2D.Wpf/Controls/Custom/Lists/TemplateDragAndDropListBox.cs
|
Core2D.Wpf/Controls/Custom/Lists/TemplateDragAndDropListBox.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using System.Windows.Controls;
namespace Core2D.Wpf.Controls.Custom.Lists
{
/// <summary>
/// The <see cref="ListBox"/> control for <see cref="Template"/> items with drag and drop support.
/// </summary>
public class TemplateDragAndDropListBox : DragAndDropListBox<Template>
{
/// <summary>
/// Initializes a new instance of the <see cref="TemplateDragAndDropListBox"/> class.
/// </summary>
public TemplateDragAndDropListBox()
: base()
{
this.Initialized += (s, e) => base.Initialize();
}
/// <summary>
/// Updates DataContext collection ImmutableArray property.
/// </summary>
/// <param name="array">The updated immutable array.</param>
public override void UpdateDataContext(ImmutableArray<Template> array)
{
var editor = (Core2D.Editor)this.Tag;
var project = editor.Project;
var previous = project.Templates;
var next = array;
editor.project?.History?.Snapshot(previous, next, (p) => project.Templates = p);
project.Templates = next;
}
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using System.Windows.Controls;
namespace Core2D.Wpf.Controls.Custom.Lists
{
/// <summary>
/// The <see cref="ListBox"/> control for <see cref="Template"/> items with drag and drop support.
/// </summary>
public class TemplateDragAndDropListBox : DragAndDropListBox<Template>
{
/// <summary>
/// Initializes a new instance of the <see cref="TemplateDragAndDropListBox"/> class.
/// </summary>
public TemplateDragAndDropListBox()
: base()
{
this.Initialized += (s, e) => base.Initialize();
}
/// <summary>
/// Updates DataContext collection ImmutableArray property.
/// </summary>
/// <param name="array">The updated immutable array.</param>
public override void UpdateDataContext(ImmutableArray<Template> array)
{
var editor = (Core2D.Editor)this.Tag;
var project = editor.Project;
var previous = project.Templates;
var next = array;
editor.Project.History.Snapshot(previous, next, (p) => project.Templates = p);
project.Templates = next;
}
}
}
|
mit
|
C#
|
3522c66eb57eea11cd18e55d7f006d331c8f1d63
|
Implement GetSubNavigation
|
Gibe/Gibe.Navigation
|
Gibe.Navigation.GibeCommerce/GibeCommerceNavigationProvider.cs
|
Gibe.Navigation.GibeCommerce/GibeCommerceNavigationProvider.cs
|
using System.Collections.Generic;
using System.Linq;
using Gibe.Navigation.GibeCommerce.Models;
using Gibe.Navigation.Models;
using GibeCommerce.CatalogSystem;
using GibeCommerce.SiteServices.UrlProviders;
namespace Gibe.Navigation.GibeCommerce
{
public class GibeCommerceNavigationProvider<T> : INavigationProvider<T> where T : INavigationElement
{
private readonly ICatalogService _catalogService;
private readonly IUrlProvider _urlProvider;
// URL provider
public GibeCommerceNavigationProvider(ICatalogService catalogService, int priority, IUrlProvider urlProvider)
{
_catalogService = catalogService;
Priority = priority;
_urlProvider = urlProvider;
}
public IEnumerable<T> GetNavigationElements()
{
var categories = _catalogService.GetSubCategories("root")
.Where(x => x.Name != "root" && IncludeInNavigation(x));
return categories.OrderBy(x => x.Rank).Select(x => (T) ToNavigationElement(x)).ToList();
}
public SubNavigationModel<T> GetSubNavigation(string url)
{
var categories = _catalogService.GetAllCategories();
var parent = categories.First(x => _urlProvider.GetUrl(x, UrlProviderMode.Relative) == url);
var children = _catalogService.GetSubCategories(parent.Name);
return new SubNavigationModel<T>
{
SectionParent = ToNavigationElement(parent),
NavigationElements = children.Select(x => (T) ToNavigationElement(x))
};
}
public int Priority { get; }
private INavigationElement ToNavigationElement(Category category)
{
return new GibeCommerceNavigationElement
{
Title = category.PageTitle,
IsActive = false,
IsVisible = ShowInNavigation(category),
NavTitle = category.DisplayName,
Items = _catalogService.GetSubCategories(category.Name).Select(ToNavigationElement),
Url = _urlProvider.GetUrl(category, UrlProviderMode.Relative)
};
}
protected virtual bool IncludeInNavigation(Category category)
{
return true;
}
protected virtual bool ShowInNavigation(Category category)
{
return true;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Gibe.Navigation.GibeCommerce.Models;
using Gibe.Navigation.Models;
using Gibe.Urls;
using GibeCommerce.CatalogSystem;
using GibeCommerce.CatalogSystem.Data;
using GibeCommerce.SiteServices.UrlProviders;
namespace Gibe.Navigation.GibeCommerce
{
public class GibeCommerceNavigationProvider<T> : INavigationProvider<T> where T : INavigationElement
{
private readonly ICatalogService _catalogService;
private readonly IUrlProvider _urlProvider;
// URL provider
public GibeCommerceNavigationProvider(ICatalogService catalogService, int priority, IUrlProvider urlProvider)
{
_catalogService = catalogService;
Priority = priority;
_urlProvider = urlProvider;
}
public IEnumerable<T> GetNavigationElements()
{
var categories = _catalogService.GetSubCategories("root")
.Where(x => x.Name != "root" && IncludeInNavigation(x));
return categories.OrderBy(x => x.Rank).Select(x => (T)ToNavigationElement(x)).ToList();
}
public SubNavigationModel<T> GetSubNavigation(string url)
{
throw new NotImplementedException();
}
public int Priority { get; }
private INavigationElement ToNavigationElement(Category category)
{
return new GibeCommerceNavigationElement
{
Title = category.PageTitle,
IsActive = false,
IsVisible = ShowInNavigation(category),
NavTitle = category.DisplayName,
Items = _catalogService.GetSubCategories(category.Name).Select(ToNavigationElement),
Url = _urlProvider.GetUrl(category, UrlProviderMode.Relative)
};
}
protected virtual bool IncludeInNavigation(Category category)
{
return true;
}
protected virtual bool ShowInNavigation(Category category)
{
return true;
}
}
}
|
mit
|
C#
|
ec78a81aa0dc6820380b7ec22a93a75b152be7c5
|
Fix Error entity not contain RawJson
|
yamachu/Mastodot
|
Mastodot/Utils/JsonConverters/ErrorThrowJsonConverter.cs
|
Mastodot/Utils/JsonConverters/ErrorThrowJsonConverter.cs
|
using System;
using Mastodot.Entities;
using Mastodot.Exceptions;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Mastodot.Utils.JsonConverters
{
internal class ErrorThrowJsonConverter<T> : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return true;
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (objectType.Name.StartsWith("IEnumerable"))
{
JArray jArray = JArray.Load(reader);
return jArray.ToObject<T>();
}
JObject jObject = JObject.Load(reader);
if (jObject["error"] != null)
{
Error error = jObject.ToObject<Error>();
error.RawJson = jObject.ToString();
var exception = new DeserializeErrorException($"Cant deserialize response, Type {objectType}")
{
Error = error
};
throw exception;
}
return jObject.ToObject<T>();
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
serializer.Serialize(writer, value);
}
}
}
|
using System;
using Mastodot.Entities;
using Mastodot.Exceptions;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Mastodot.Utils.JsonConverters
{
internal class ErrorThrowJsonConverter<T> : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return true;
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (objectType.Name.StartsWith("IEnumerable"))
{
JArray jArray = JArray.Load(reader);
return jArray.ToObject<T>();
}
JObject jObject = JObject.Load(reader);
if (jObject["error"] != null)
{
Error error = jObject.ToObject<Error>();
var exception = new DeserializeErrorException($"Cant deserialize response, Type {objectType}")
{
Error = error
};
throw exception;
}
return jObject.ToObject<T>();
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
serializer.Serialize(writer, value);
}
}
}
|
mit
|
C#
|
e3e60e8f9d7cb448138a3a78a9095994a7d5d6df
|
Add [Serializable] attribute
|
dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute
|
Source/NSubstitute/Exceptions/NotASubstituteException.cs
|
Source/NSubstitute/Exceptions/NotASubstituteException.cs
|
using System;
using System.Runtime.Serialization;
namespace NSubstitute.Exceptions
{
[Serializable]
public class NotASubstituteException : SubstituteException
{
const string Explanation = "NSubstitute extension methods like .Received() can only be called on objects created using Substitute.For<T>() and related methods.";
public NotASubstituteException() : base(Explanation) { }
protected NotASubstituteException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
|
using System.Runtime.Serialization;
namespace NSubstitute.Exceptions
{
[Serializable]
public class NotASubstituteException : SubstituteException
{
const string Explanation = "NSubstitute extension methods like .Received() can only be called on objects created using Substitute.For<T>() and related methods.";
public NotASubstituteException() : base(Explanation) { }
protected NotASubstituteException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
|
bsd-3-clause
|
C#
|
dc3af1e0f7634b373c43957188ec1bfec7f0a3f3
|
Remove IAPIProvider since its not required at DrawableAvatar
|
peppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu
|
osu.Game/Users/Drawables/DrawableAvatar.cs
|
osu.Game/Users/Drawables/DrawableAvatar.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Users.Drawables
{
[LongRunningLoad]
public class DrawableAvatar : Sprite
{
private readonly User user;
/// <summary>
/// A simple, non-interactable avatar sprite for the specified user.
/// </summary>
/// <param name="user">The user. A null value will get a placeholder avatar.</param>
public DrawableAvatar(User user = null)
{
this.user = user;
RelativeSizeAxes = Axes.Both;
FillMode = FillMode.Fit;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textures)
{
string avatarUrl = user?.AvatarUrl;
if (avatarUrl != null)
Texture = textures.Get(avatarUrl);
else if (user != null && user.Id > 1)
Texture = textures.Get($@"https://a.ppy.sh/{user.Id}");
Texture ??= textures.Get(@"Online/avatar-guest");
}
protected override void LoadComplete()
{
base.LoadComplete();
this.FadeInFromZero(300, Easing.OutQuint);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Online.API;
namespace osu.Game.Users.Drawables
{
[LongRunningLoad]
public class DrawableAvatar : Sprite
{
private readonly User user;
[Resolved(CanBeNull = true)]
private IAPIProvider api { get; set; }
/// <summary>
/// A simple, non-interactable avatar sprite for the specified user.
/// </summary>
/// <param name="user">The user. A null value will get a placeholder avatar.</param>
public DrawableAvatar(User user = null)
{
this.user = user;
RelativeSizeAxes = Axes.Both;
FillMode = FillMode.Fit;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textures)
{
string avatarUrl = user?.AvatarUrl;
if (api != null && avatarUrl != null)
Texture = textures.Get(avatarUrl);
else if (user != null && user.Id > 1)
Texture = textures.Get($@"https://a.ppy.sh/{user.Id}");
Texture ??= textures.Get(@"Online/avatar-guest");
}
protected override void LoadComplete()
{
base.LoadComplete();
this.FadeInFromZero(300, Easing.OutQuint);
}
}
}
|
mit
|
C#
|
08f3a68d97b41c13a27197dde0bfb8c4736be317
|
Add a test for IterateAsync
|
Microsoft/xunit-performance,ianhays/xunit-performance,Microsoft/xunit-performance,ericeil/xunit-performance,mmitche/xunit-performance,visia/xunit-performance,pharring/xunit-performance
|
samples/SimplePerfTests/FormattingTests.cs
|
samples/SimplePerfTests/FormattingTests.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Xunit.Performance;
using Xunit;
namespace SimplePerfTests
{
public class Document
{
private string _text;
public Document(string text)
{
_text = text;
}
public void Format()
{
_text = _text.ToUpper();
}
public Task FormatAsync()
{
Format();
return Task.CompletedTask;
}
public override string ToString()
{
return _text;
}
}
public class FormattingTests
{
private static IEnumerable<object[]> MakeArgs(params object[] args)
{
return args.Select(arg => new object[] { arg });
}
public static IEnumerable<object[]> FormatCurlyBracesMemberData = MakeArgs(
new Document("Hello, world!")
);
[Benchmark]
[MemberData(nameof(FormatCurlyBracesMemberData))]
public static void FormatCurlyBracesTest(Document document)
{
Benchmark.Iterate(document.Format);
}
[Benchmark]
[MemberData(nameof(FormatCurlyBracesMemberData))]
public static async Task FormatCurlyBracesTestAsync(Document document)
{
await Benchmark.IterateAsync(() => document.FormatAsync());
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xunit.Performance;
using Xunit;
namespace SimplePerfTests
{
public class Document
{
private string _text;
public Document(string text)
{
_text = text;
}
public void Format()
{
_text = _text.ToUpper();
}
public override string ToString()
{
return _text;
}
}
public class FormattingTests
{
private static IEnumerable<object[]> MakeArgs(params object[] args)
{
return args.Select(arg => new object[] { arg });
}
public static IEnumerable<object[]> FormatCurlyBracesMemberData = MakeArgs(
new Document("Hello, world!")
);
[Benchmark]
[MemberData(nameof(FormatCurlyBracesMemberData))]
public static void FormatCurlyBracesTest(Document document)
{
Benchmark.Iterate(document.Format);
}
}
}
|
mit
|
C#
|
38e1ed8535bcfd59c7afcda5d33d54ffa9d846da
|
Update SharedAssemblyInfo.cs
|
wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors,XamlBehaviors/XamlBehaviors,XamlBehaviors/XamlBehaviors
|
src/Shared/SharedAssemblyInfo.cs
|
src/Shared/SharedAssemblyInfo.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
using System.Resources;
[assembly: AssemblyCompany("Wiesław Šoltés")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2017")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Avalonia")]
[assembly: AssemblyTrademark("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.5.0.2")]
[assembly: AssemblyFileVersion("0.5.0.2")]
[assembly: AssemblyInformationalVersion("0.5.0.2")]
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
using System.Resources;
[assembly: AssemblyCompany("Wiesław Šoltés")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2017")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Avalonia")]
[assembly: AssemblyTrademark("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.5.0.1")]
[assembly: AssemblyFileVersion("0.5.0.1")]
[assembly: AssemblyInformationalVersion("0.5.0.1")]
|
mit
|
C#
|
c96966c743a9254cc32ab565342c885c78efc93c
|
implement ReadOnlyBase and ReadOnlyListBase serialiization using MobileFormatter. Add unit tests for serialization for .NET and SilverLight.
|
MarimerLLC/csla,BrettJaner/csla,rockfordlhotka/csla,rockfordlhotka/csla,MarimerLLC/csla,JasonBock/csla,ronnymgm/csla-light,jonnybee/csla,ronnymgm/csla-light,JasonBock/csla,MarimerLLC/csla,BrettJaner/csla,JasonBock/csla,jonnybee/csla,ronnymgm/csla-light,rockfordlhotka/csla,BrettJaner/csla,jonnybee/csla
|
cslalightcs/Csla/ReadOnlyBase.cs
|
cslalightcs/Csla/ReadOnlyBase.cs
|
using System;
using Csla.Serialization;
using Csla.Core;
using Csla.Core.FieldManager;
namespace Csla
{
[Serializable]
public class ReadOnlyBase<T> : Csla.Core.MobileObject
where T : ReadOnlyBase<T>
{
#region FieldManager
private FieldDataManager _fieldManager;
public static PropertyInfo<P> RegisterProperty<P>(Type ownerType, PropertyInfo<P> property)
{
return PropertyInfoManager.RegisterProperty<P>(ownerType, property);
}
protected FieldDataManager FieldManager
{
get
{
if (_fieldManager == null)
{
_fieldManager = new FieldDataManager(this.GetType());
}
return _fieldManager;
}
}
protected P GetProperty<P>(IPropertyInfo propertyInfo)
{
IFieldData data = FieldManager.GetFieldData(propertyInfo);
return (P)(data != null ? data.Value : null);
}
protected void SetProperty<P>(IPropertyInfo propertyInfo, P value)
{
FieldManager.SetFieldData<P>(propertyInfo, value);
}
protected void LoadProperty(IPropertyInfo propertyInfo, object newValue)
{
FieldManager.LoadFieldData(propertyInfo, newValue);
}
protected object ReadProperty(IPropertyInfo propertyInfo)
{
var info = FieldManager.GetFieldData(propertyInfo);
if (info != null)
return info.Value;
else
return null;
}
#endregion
#region MobileFormatter
protected override void OnGetChildren(
Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter)
{
base.OnGetChildren(info, formatter);
var fieldManagerInfo = formatter.SerializeObject(_fieldManager);
info.AddChild("_fieldManager", fieldManagerInfo.ReferenceId);
}
protected override void OnSetChildren(Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter)
{
var childData = info.Children["_fieldManager"];
_fieldManager = (FieldDataManager)formatter.GetObject(childData.ReferenceId);
base.OnSetChildren(info, formatter);
}
#endregion
}
}
|
using System;
using Csla.Serialization;
using Csla.Core;
using Csla.Core.FieldManager;
namespace Csla
{
[Serializable]
public class ReadOnlyBase<T> : Csla.Core.MobileObject
where T : ReadOnlyBase<T>
{
#region FieldManager
private FieldDataManager _fieldManager;
public static PropertyInfo<P> RegisterProperty<P>(Type ownerType, PropertyInfo<P> property)
{
return PropertyInfoManager.RegisterProperty<P>(ownerType, property);
}
protected FieldDataManager FieldManager
{
get
{
if (_fieldManager == null)
{
_fieldManager = new FieldDataManager(this.GetType());
}
return _fieldManager;
}
}
protected P GetProperty<P>(IPropertyInfo propertyInfo)
{
IFieldData data = FieldManager.GetFieldData(propertyInfo);
return (P)(data != null ? data.Value : null);
}
protected void SetProperty<P>(IPropertyInfo propertyInfo, P value)
{
FieldManager.SetFieldData<P>(propertyInfo, value);
}
#endregion
}
}
|
mit
|
C#
|
e6f7b84bd8699a3d35099371bf56be99f783bfc2
|
Remove CLSCompliant indicator.
|
HeadspringLabs/bulk-writer
|
src/BulkWriter/Properties/AssemblyInfo.cs
|
src/BulkWriter/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: 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("d4478ca6-9e19-4372-8d21-5f90f05212c0")]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: 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("d4478ca6-9e19-4372-8d21-5f90f05212c0")]
[assembly: CLSCompliant(true)]
|
apache-2.0
|
C#
|
4b975ca10d34211f6555ff0e98b49c99f23981cb
|
Add better test coverage of `SettingsPanel`
|
smoogipoo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu,NeoAdonis/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,ppy/osu
|
osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.cs
|
osu.Game.Tests/Visual/Settings/TestSceneSettingsPanel.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.Containers;
using osu.Framework.Testing;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.Settings
{
[TestFixture]
public class TestSceneSettingsPanel : OsuTestScene
{
private SettingsPanel settings;
private DialogOverlay dialogOverlay;
[SetUpSteps]
public void SetUpSteps()
{
AddStep("create settings", () =>
{
settings?.Expire();
Add(settings = new SettingsOverlay
{
State = { Value = Visibility.Visible }
});
});
}
[Test]
public void ToggleVisibility()
{
AddWaitStep("wait some", 5);
AddToggleStep("toggle editor visibility", visible => settings.ToggleVisibility());
}
[BackgroundDependencyLoader]
private void load()
{
Add(dialogOverlay = new DialogOverlay
{
Depth = -1
});
Dependencies.Cache(dialogOverlay);
}
}
}
|
// 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.Containers;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.Settings
{
[TestFixture]
public class TestSceneSettingsPanel : OsuTestScene
{
private readonly SettingsPanel settings;
private readonly DialogOverlay dialogOverlay;
public TestSceneSettingsPanel()
{
settings = new SettingsOverlay
{
State = { Value = Visibility.Visible }
};
Add(dialogOverlay = new DialogOverlay
{
Depth = -1
});
}
[BackgroundDependencyLoader]
private void load()
{
Dependencies.Cache(dialogOverlay);
Add(settings);
}
}
}
|
mit
|
C#
|
aa5924b9f2b1d9c5fc6b769f18e8c6ee3b0059b2
|
remove TODO
|
2sic/app-blog,2sic/app-blog,2sic/app-blog
|
bs4/_ListTopPost.cshtml
|
bs4/_ListTopPost.cshtml
|
@inherits Custom.Hybrid.Razor12
@using ToSic.Razor.Blade;
@{
var helpers = CreateInstance("Links.cs");
// This config is for the toolbar used on an item.
var toolbarConfig = new [] {
"-layout", // hide 'layout' button
"%new&show=true?contentType=BlogPost&entityId=0", // 'new' should show for the type BlogPost
"%delete&show=true" // show 'delete'
};
}
@* If no Details-page is configured, show warning to Admin *@
@if(Edit.Enabled && !Text.Has(Settings.DetailsPage)) {
<div class="alert alert-danger" role="alert">@Html.Raw(@Resources.LabelAdminDetailPageWarning)</div>
}
<section class="app-blog5" @Edit.TagToolbar(Content)>
<h1 class="category-header mb-4">@Content.Title</h1>
@* List the posts in 3 columns *@
<div class="row card-deck">
@foreach (var post in AsList(Data["Posts"])) {
<article class="app-blog5-list-item effect-zoom col-12 col-md-6 col-lg-4 mb-5" @Edit.TagToolbar(post, toolbar: toolbarConfig)>
<div class="card h-100 m-0">
@* Image of the post *@
@Html.Partial("shared/_MainImage.cshtml", new { Post = post, Settings = Settings.Images.BlogCards })
<div class="card-body">
<h5 class="card-title">@post.Title</h5>
<p class="card-text">@Html.Raw(Tags.Strip(post.Teaser))</p>
</div>
<div class="card-footer text-right">
<a href="@helpers.LinkToDetailsPage(post)" class="btn btn-outline-primary stretched-link">@Resources.ReadMore</a>
</div>
</div>
</article>
}
</div>
@* Show pagination if configured *@
@if (Content.ShowPagination == true) {
@Html.Partial("shared/_ListPaging.cshtml")
}
</section>
@Html.Partial("shared/_Assets.cshtml")
|
@inherits Custom.Hybrid.Razor12
@using ToSic.Razor.Blade;
@{
var helpers = CreateInstance("Links.cs");
// This config is for the toolbar used on an item.
var toolbarConfig = new [] {
"-layout", // hide 'layout' button
"%new&show=true?contentType=BlogPost&entityId=0", // 'new' should show for the type BlogPost
"%delete&show=true" // show 'delete'
};
// TODO: @2ro sync effect with gallery? grow instead of darken
}
@* If no Details-page is configured, show warning to Admin *@
@if(Edit.Enabled && !Text.Has(Settings.DetailsPage)) {
<div class="alert alert-danger" role="alert">@Html.Raw(@Resources.LabelAdminDetailPageWarning)</div>
}
<section class="app-blog5" @Edit.TagToolbar(Content)>
<h1 class="category-header mb-4">@Content.Title</h1>
@* List the posts in 3 columns *@
<div class="row card-deck">
@foreach (var post in AsList(Data["Posts"])) {
<article class="app-blog5-list-item effect-zoom col-12 col-md-6 col-lg-4 mb-5" @Edit.TagToolbar(post, toolbar: toolbarConfig)>
<div class="card h-100 m-0">
@* Image of the post *@
@Html.Partial("shared/_MainImage.cshtml", new { Post = post, Settings = Settings.Images.BlogCards })
<div class="card-body">
<h5 class="card-title">@post.Title</h5>
<p class="card-text">@Html.Raw(Tags.Strip(post.Teaser))</p>
</div>
<div class="card-footer text-right">
<a href="@helpers.LinkToDetailsPage(post)" class="btn btn-outline-primary stretched-link">@Resources.ReadMore</a>
</div>
</div>
</article>
}
</div>
@* Show pagination if configured *@
@if (Content.ShowPagination == true) {
@Html.Partial("shared/_ListPaging.cshtml")
}
</section>
@Html.Partial("shared/_Assets.cshtml")
|
mit
|
C#
|
8a3db9720b4e068fbc4df08b7269b2c2999e2a3a
|
Fix null handling
|
WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common
|
src/WeihanLi.Common/Services/Validator.cs
|
src/WeihanLi.Common/Services/Validator.cs
|
using System.ComponentModel.DataAnnotations;
using WeihanLi.Extensions;
using AnnotationValidationResult = System.ComponentModel.DataAnnotations.ValidationResult;
using ValidationResult = WeihanLi.Common.Models.ValidationResult;
namespace WeihanLi.Common.Services;
public interface IValidator
{
ValidationResult Validate(object? value);
}
public interface IValidator<T>
{
Task<ValidationResult> ValidateAsync(T value);
}
public sealed class DataAnnotationValidator : IValidator
{
public static IValidator Instance {get;}
static DataAnnotationValidator()
{
Instance = new DataAnnotationValidator();
}
public ValidationResult Validate(object? value)
{
var validationResult = new ValidationResult();
if(value is null)
{
validationResult.Valid = false;
validationResult.Errors ??= new Dictionary<string, string[]>();
validationResult.Errors[string.Empty] = new[]{ "Value is null" };
}
else
{
var annotationValidateResults = new List<AnnotationValidationResult>();
validationResult.Valid =
Validator.TryValidateObject(value, new ValidationContext(value), annotationValidateResults);
validationResult.Errors = annotationValidateResults
.GroupBy(x => x.MemberNames.StringJoin(","))
.ToDictionary(g => g.Key, g => g.Select(x => x.ErrorMessage).WhereNotNull().ToArray());
}
return validationResult;
}
}
public sealed class DelegateValidator : IValidator
{
private readonly Func<object?, ValidationResult> _validateFunc;
public DelegateValidator(Func<object?, ValidationResult> validateFunc)
{
_validateFunc = Guard.NotNull(validateFunc);
}
public ValidationResult Validate(object? value)
{
return _validateFunc.Invoke(value);
}
}
public sealed class DelegateValidator<T> : IValidator<T>
{
private readonly Func<T, Task<ValidationResult>> _validateFunc;
public DelegateValidator(Func<T, Task<ValidationResult>> validateFunc)
{
_validateFunc = Guard.NotNull(validateFunc);
}
public Task<ValidationResult> ValidateAsync(T value)
{
return _validateFunc.Invoke(value);
}
}
|
using System.ComponentModel.DataAnnotations;
using WeihanLi.Extensions;
using AnnotationValidationResult = System.ComponentModel.DataAnnotations.ValidationResult;
using ValidationResult = WeihanLi.Common.Models.ValidationResult;
namespace WeihanLi.Common.Services;
public interface IValidator
{
ValidationResult Validate(object? value);
}
public interface IValidator<T>
{
Task<ValidationResult> ValidateAsync(T value);
}
public sealed class DataAnnotationValidator : IValidator
{
public static IValidator Instance {get;}
static DataAnnotationValidator()
{
Instance = new DataAnnotationValidator();
}
public ValidationResult Validate(object? value)
{
var validationResult = new ValidationResult();
var annotationValidateResults = new List<AnnotationValidationResult>();
validationResult.Valid =
Validator.TryValidateObject(value, new ValidationContext(value), annotationValidateResults);
validationResult.Errors = annotationValidateResults
.GroupBy(x => x.MemberNames.StringJoin(","))
.ToDictionary(g => g.Key, g => g.Select(x => x.ErrorMessage).WhereNotNull().ToArray());
return validationResult;
}
}
public sealed class DelegateValidator : IValidator
{
private readonly Func<object?, ValidationResult> _validateFunc;
public DelegateValidator(Func<object?, ValidationResult> validateFunc)
{
_validateFunc = Guard.NotNull(validateFunc);
}
public ValidationResult Validate(object? value)
{
return _validateFunc.Invoke(value);
}
}
public sealed class DelegateValidator<T> : IValidator<T>
{
private readonly Func<T, Task<ValidationResult>> _validateFunc;
public DelegateValidator(Func<T, Task<ValidationResult>> validateFunc)
{
_validateFunc = Guard.NotNull(validateFunc);
}
public Task<ValidationResult> ValidateAsync(T value)
{
return _validateFunc.Invoke(value);
}
}
|
mit
|
C#
|
6b4af66597a323efe5679e9b1c2ae2f6a6a9bce4
|
Update interface for ignored request policy
|
peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype
|
src/Glimpse.Agent.Web/Framework/IIgnoredRequestPolicy.cs
|
src/Glimpse.Agent.Web/Framework/IIgnoredRequestPolicy.cs
|
using System;
namespace Glimpse.Agent.Web
{
public interface IIgnoredRequestPolicy
{
bool ShouldIgnore(IContext context);
}
}
|
using System;
namespace Glimpse.Agent.Web
{
public class IIgnoredRequestPolicy
{
}
}
|
mit
|
C#
|
4f0a5a491ddbd6a2a4dc2018c626aab8aaa3e41b
|
fix merge error
|
jonnii/chinchilla
|
Chinchilla/Topologies/Rabbit/Exchange.cs
|
Chinchilla/Topologies/Rabbit/Exchange.cs
|
namespace Chinchilla.Topologies.Rabbit
{
public class Exchange : Bindable, IExchange
{
public Exchange(string name, ExchangeType exchangeType)
{
Name = name;
Type = exchangeType;
}
public ExchangeType Type { get; set; }
public Durability Durability { get; set; }
public bool IsAutoDelete { get; set; }
public bool IsInternal { get; set; }
public string AlternateExchange { get; set; }
public bool HasAlternateExchange
{
get { return !string.IsNullOrEmpty(AlternateExchange); }
}
public override void Visit(ITopologyVisitor visitor)
{
visitor.Visit(this);
foreach (var binding in Bindings)
{
binding.Visit(visitor);
}
}
public override string ToString()
{
return string.Format("[Exchange Name: {0}]", Name);
}
}
}
|
namespace Chinchilla.Topologies.Rabbit
{
public class Exchange : Bindable, IExchange
{
public Exchange(string name, ExchangeType exchangeType)
{
Name = name;
Type = exchangeType;
}
public ExchangeType Type { get; set; }
public Durability Durability { get; set; }
public bool IsAutoDelete { get; set; }
public bool IsInternal { get; set; }
public string AlternateExchange { get; set; }
public bool HasAlternateExchange
{
get { return !string.IsNullOrEmpty(AlternateExchange); }
}
public override void Visit(ITopologyVisitor visitor)
{
visitor.Visit(this);
foreach (var binding in Bindings)
{
binding.Visit(visitor);
}
}
public override string ToString()
{
return string.Format("[Exchange Name: {0}]", Name);
}
public override string ToString()
{
return string.Format("[Exchange Name: {0}]", Name);
}
}
}
|
apache-2.0
|
C#
|
24ce5f13e078e292ecd4d946bee54bfe69a3dd76
|
Add extra url alias
|
dolkensp/HoloXPLOR,dolkensp/HoloXPLOR,dolkensp/HoloXPLOR
|
HoloXPLOR/Controllers/_BaseController.cs
|
HoloXPLOR/Controllers/_BaseController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace HoloXPLOR.Controllers
{
public abstract class _BaseController : Controller
{
private HashSet<String> _secureHosts = new HashSet<String>(StringComparer.InvariantCultureIgnoreCase) {
"holoxplor.space",
"ptu.holoxplor.space",
};
protected override void OnAuthorization(AuthorizationContext filterContext)
{
#region Force HTTPS
var hostname = filterContext.HttpContext.Request.Url.Host;
var path = filterContext.HttpContext.Request.Url.PathAndQuery;
var scheme = filterContext.HttpContext.Request.Url.Scheme;
var xfHeader = filterContext.HttpContext.Request.Headers["x-forwarded-proto"];
// Redirect HTTP requests to HTTPS
if (this._secureHosts.Contains(hostname) &&
!String.Equals(xfHeader, Uri.UriSchemeHttps, StringComparison.InvariantCultureIgnoreCase) &&
!String.Equals(scheme, Uri.UriSchemeHttps, StringComparison.InvariantCultureIgnoreCase))
filterContext.Result = this.RedirectPermanent(String.Format("{0}://{1}{2}", Uri.UriSchemeHttps, hostname, path));
#endregion
#region Force new URLs
if (String.Equals(hostname, "www.holoxplor.space", StringComparison.InvariantCultureIgnoreCase))
filterContext.Result = this.RedirectPermanent(String.Format("{0}://{1}{2}", Uri.UriSchemeHttps, "holoxplor.space", path));
if (String.Equals(hostname, "holoxplor.azurewebsites.net", StringComparison.InvariantCultureIgnoreCase))
filterContext.Result = this.RedirectPermanent(String.Format("{0}://{1}{2}", Uri.UriSchemeHttps, "holoxplor.space", path));
if (String.Equals(hostname, "holoxplor-ptu.azurewebsites.net", StringComparison.InvariantCultureIgnoreCase))
filterContext.Result = this.RedirectPermanent(String.Format("{0}://{1}{2}", Uri.UriSchemeHttps, "ptu.holoxplor.space", path));
#endregion
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace HoloXPLOR.Controllers
{
public abstract class _BaseController : Controller
{
private HashSet<String> _secureHosts = new HashSet<String>(StringComparer.InvariantCultureIgnoreCase) {
"holoxplor.space",
"ptu.holoxplor.space",
};
protected override void OnAuthorization(AuthorizationContext filterContext)
{
#region Force HTTPS
var hostname = filterContext.HttpContext.Request.Url.Host;
var path = filterContext.HttpContext.Request.Url.PathAndQuery;
var scheme = filterContext.HttpContext.Request.Url.Scheme;
var xfHeader = filterContext.HttpContext.Request.Headers["x-forwarded-proto"];
// Redirect HTTP requests to HTTPS
if (this._secureHosts.Contains(hostname) &&
!String.Equals(xfHeader, Uri.UriSchemeHttps, StringComparison.InvariantCultureIgnoreCase) &&
!String.Equals(scheme, Uri.UriSchemeHttps, StringComparison.InvariantCultureIgnoreCase))
filterContext.Result = this.RedirectPermanent(String.Format("{0}://{1}{2}", Uri.UriSchemeHttps, hostname, path));
#endregion
#region Force new URLs
if (String.Equals(hostname, "holoxplor.azurewebsites.net", StringComparison.InvariantCultureIgnoreCase))
filterContext.Result = this.RedirectPermanent(String.Format("{0}://{1}{2}", Uri.UriSchemeHttps, "holoxplor.space", path));
if (String.Equals(hostname, "holoxplor-ptu.azurewebsites.net", StringComparison.InvariantCultureIgnoreCase))
filterContext.Result = this.RedirectPermanent(String.Format("{0}://{1}{2}", Uri.UriSchemeHttps, "ptu.holoxplor.space", path));
#endregion
}
}
}
|
mit
|
C#
|
fc0d048c3c9a9b9fbf1ca76e59cfa46640d3defb
|
set next alpha version
|
xxMUROxx/MahApps.Metro,batzen/MahApps.Metro,Evangelink/MahApps.Metro,Danghor/MahApps.Metro,pfattisc/MahApps.Metro,Jack109/MahApps.Metro,chuuddo/MahApps.Metro,ye4241/MahApps.Metro,p76984275/MahApps.Metro,psinl/MahApps.Metro,jumulr/MahApps.Metro,MahApps/MahApps.Metro
|
MahApps.Metro/Properties/AssemblyInfo.cs
|
MahApps.Metro/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyCopyright("Copyright © MahApps.Metro 2011-2015")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Behaviours")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Converters")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Controls")]
[assembly: AssemblyVersion("1.1.2.0")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyTitleAttribute("MahApps.Metro")]
[assembly: AssemblyDescriptionAttribute("Toolkit for creating Metro styled WPF apps")]
[assembly: AssemblyProductAttribute("MahApps.Metro 1.1.2-ALPHA")]
[assembly: InternalsVisibleTo("Mahapps.Metro.Tests")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyCopyright("Copyright © MahApps.Metro 2011-2015")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Behaviours")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Converters")]
[assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Controls")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyTitleAttribute("MahApps.Metro")]
[assembly: AssemblyDescriptionAttribute("Toolkit for creating Metro styled WPF apps")]
[assembly: AssemblyProductAttribute("MahApps.Metro 1.1.1")]
//[assembly: InternalsVisibleTo("Mahapps.Metro.Tests")]
|
mit
|
C#
|
06534f0798326400a99f9eeefaa7a1249ffb0fbb
|
Allow tile size to be changed from 8x8 using Clear-Tileset --tile-size.
|
Prof9/PixelPet
|
PixelPet/CLI/Commands/ClearTilesetCmd.cs
|
PixelPet/CLI/Commands/ClearTilesetCmd.cs
|
using LibPixelPet;
using System;
namespace PixelPet.CLI.Commands {
internal class ClearTilesetCmd : CliCommand {
public ClearTilesetCmd()
: base("Clear-Tileset",
new Parameter("tile-size", "s", false, new ParameterValue("width", "8"), new ParameterValue("height", "8"))
) { }
public override void Run(Workbench workbench, ILogger logger) {
int tw = FindNamedParameter("--tile-size").Values[0].ToInt32();
int th = FindNamedParameter("--tile-size").Values[1].ToInt32();
workbench.Tileset = new Tileset(tw, th);
logger?.Log("Created new " + tw + 'x' + th + " tileset.");
}
}
}
|
using LibPixelPet;
using System;
namespace PixelPet.CLI.Commands {
internal class ClearTilesetCmd : CliCommand {
public ClearTilesetCmd()
: base("Clear-Tileset") { }
public override void Run(Workbench workbench, ILogger logger) {
int w = 8;
int h = 8;
workbench.Tileset = new Tileset(w, h);
logger?.Log("Created new " + w + 'x' + h + " tileset.");
}
}
}
|
mit
|
C#
|
9695d53b0e332e5420a22a0be2eed87693ca3e5f
|
Test case for calling try read with null values
|
BizTalkComponents/Utils
|
Tests/UnitTests/ContextExtensionTests.cs
|
Tests/UnitTests/ContextExtensionTests.cs
|
using System;
using Microsoft.BizTalk.Message.Interop;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Winterdom.BizTalk.PipelineTesting;
namespace BizTalkComponents.Utils.Tests.UnitTests
{
[TestClass]
public class ContextExtensionTests
{
private IBaseMessage _testMessage;
[TestInitialize]
public void InitializeTest()
{
_testMessage = MessageHelper.Create("<test></test>");
_testMessage.Context.Promote(new ContextProperty("http://testuri.org#SourceProperty"), "Value");
}
[TestMethod]
public void TryReadValidTest()
{
object val;
Assert.IsTrue(_testMessage.Context.TryRead(new ContextProperty("http://testuri.org#SourceProperty"), out val));
Assert.AreEqual("Value", val.ToString());
}
[TestMethod]
public void TryReadInValidTest()
{
object val;
Assert.IsFalse(_testMessage.Context.TryRead(new ContextProperty("http://testuri.org#NonExisting"), out val));
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void TryReadInValidArgumentTest()
{
object val;
_testMessage.Context.TryRead(null, out val);
}
}
}
|
using System;
using Microsoft.BizTalk.Message.Interop;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Winterdom.BizTalk.PipelineTesting;
namespace BizTalkComponents.Utils.Tests.UnitTests
{
[TestClass]
public class ContextExtensionTests
{
private IBaseMessage _testMessage;
[TestInitialize]
public void InitializeTest()
{
_testMessage = MessageHelper.Create("<test></test>");
_testMessage.Context.Promote(new ContextProperty("http://testuri.org#SourceProperty"), "Value");
}
[TestMethod]
public void TryReadValidTest()
{
object val;
Assert.IsTrue(_testMessage.Context.TryRead(new ContextProperty("http://testuri.org#SourceProperty"), out val));
Assert.AreEqual("Value", val.ToString());
}
[TestMethod]
public void TryReadInValidTest()
{
object val;
Assert.IsFalse(_testMessage.Context.TryRead(new ContextProperty("http://testuri.org#NonExisting"), out val));
}
}
}
|
mit
|
C#
|
55ec639a7c81efd7914bea4b022a586a271a28d5
|
Update version to 1.2.3.0
|
msft-shahins/BotBuilder,dr-em/BotBuilder,dr-em/BotBuilder,msft-shahins/BotBuilder,Clairety/ConnectMe,msft-shahins/BotBuilder,xiangyan99/BotBuilder,yakumo/BotBuilder,xiangyan99/BotBuilder,mmatkow/BotBuilder,stevengum97/BotBuilder,mmatkow/BotBuilder,yakumo/BotBuilder,dr-em/BotBuilder,xiangyan99/BotBuilder,mmatkow/BotBuilder,stevengum97/BotBuilder,Clairety/ConnectMe,Clairety/ConnectMe,mmatkow/BotBuilder,stevengum97/BotBuilder,Clairety/ConnectMe,xiangyan99/BotBuilder,dr-em/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,yakumo/BotBuilder,stevengum97/BotBuilder
|
CSharp/Library/Properties/AssemblyInfo.cs
|
CSharp/Library/Properties/AssemblyInfo.cs
|
using System.Resources;
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("Microsoft.Bot.Builder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Bot Builder")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.3.0")]
[assembly: AssemblyFileVersion("1.2.3.0")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]
[assembly: NeutralResourcesLanguage("en")]
|
using System.Resources;
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("Microsoft.Bot.Builder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Bot Builder")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.2.0")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]
[assembly: NeutralResourcesLanguage("en")]
|
mit
|
C#
|
cdd283a65c10555e11fce9c00a62c5b5cec9a338
|
Add ToString to ServoTelemetrics
|
dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo
|
DynamixelServo.Driver/ServoTelemetrics.cs
|
DynamixelServo.Driver/ServoTelemetrics.cs
|
namespace DynamixelServo.Driver
{
public class ServoTelemetrics
{
public int Id { get; set; }
public int Temperature { get; set; }
public float Voltage { get; set; }
public int Load { get; set; }
public override string ToString()
{
return $"Id: {Id} Temperature: {Temperature}°C Voltage: {Voltage}V Load: {Load:000}";
}
}
}
|
namespace DynamixelServo.Driver
{
public class ServoTelemetrics
{
public int Id { get; set; }
public int Temperature { get; set; }
public float Voltage { get; set; }
public int Load { get; set; }
}
}
|
apache-2.0
|
C#
|
0f62a6e26cfaefcf5c2b6039c3b93d10794fd7de
|
remove rrssb from project
|
odedw/game-of-music,odedw/game-of-music
|
GameOfMusicV2/Views/Shared/_Layout.cshtml
|
GameOfMusicV2/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game of Music</title>
<link href="~/Content/bootstrap.css" rel="stylesheet" />
<link href="~/Content/Site.css" rel="stylesheet" />
@Scripts.Render("~/bundles/modernizr")
<meta name="description" content="Game of Music | A music experiment based on Conway's Game of Life'" />
@Html.Partial("Analytics")
<script src="//code.createjs.com/createjs-2013.12.12.min.js"></script>
<body>
<div class="container body-content">
@RenderBody()
</div>
<footer>
<p>Made by Oded Welgreen</p>
<ul>
<li><a href="https://twitter.com/injagames" target="_blank"><img src="~/Content/Images/twitter.png" /> </a></li>
<li><a href="https://github.com/OdedW/game-of-music" target="_blank"><img src="~/Content/Images/github.png" /> </a></li>
<li><a href="https://soundcloud.com/injagames" target="_blank"> <img src="~/Content/Images/soundcloud.png" /> </a></li>
<li><a href="https://www.youtube.com/channel/UCA8cEeddcTGoZAPoBbFC78A" target="_blank"> <img src="~/Content/Images/youtube.png" /> </a></li>
<li><a href="mailto:InjaGames@outlook.com" target="_top"><img src="~/Content/Images/email.png" /> </a></li>
</ul>
<p>
<span>Works best on WebKit •</span>
<a href="http://www.google.com/chrome" target="_blank">Chrome</a>
<span>or</span>
<a href="http://www.apple.com/safari" target="_blank">Safari</a>
</p>
</footer>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/jsextlibs")
@RenderSection("scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game of Music</title>
<link href="~/Content/bootstrap.css" rel="stylesheet" />
<link href="~/Content/Site.css" rel="stylesheet" />
<link href="~/Content/rrssb.css" rel="stylesheet" />
@Scripts.Render("~/bundles/modernizr")
<meta name="description" content="Game of Music | A music experiment based on Conway's Game of Life'" />
@Html.Partial("Analytics")
<script src="//code.createjs.com/createjs-2013.12.12.min.js"></script>
<body>
<div class="container body-content">
@RenderBody()
</div>
<footer>
<p>Made by Oded Welgreen</p>
<ul>
<li><a href="https://twitter.com/injagames" target="_blank"><img src="~/Content/Images/twitter.png" /> </a></li>
<li><a href="https://github.com/OdedW/game-of-music" target="_blank"><img src="~/Content/Images/github.png" /> </a></li>
<li><a href="https://soundcloud.com/injagames" target="_blank"> <img src="~/Content/Images/soundcloud.png" /> </a></li>
<li><a href="https://www.youtube.com/channel/UCA8cEeddcTGoZAPoBbFC78A" target="_blank"> <img src="~/Content/Images/youtube.png" /> </a></li>
<li><a href="mailto:InjaGames@outlook.com" target="_top"><img src="~/Content/Images/email.png" /> </a></li>
</ul>
<p>
<span>Works best on WebKit •</span>
<a href="http://www.google.com/chrome" target="_blank">Chrome</a>
<span>or</span>
<a href="http://www.apple.com/safari" target="_blank">Safari</a>
</p>
</footer>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/jsextlibs")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
7b43b78444c348507fe39bef1869507d2886c4a0
|
Disable KuduUpTimeTest test
|
dev-enthusiast/kudu,oliver-feng/kudu,chrisrpatterson/kudu,kenegozi/kudu,barnyp/kudu,EricSten-MSFT/kudu,uQr/kudu,juoni/kudu,mauricionr/kudu,puneet-gupta/kudu,projectkudu/kudu,YOTOV-LIMITED/kudu,shrimpy/kudu,juvchan/kudu,EricSten-MSFT/kudu,projectkudu/kudu,juoni/kudu,dev-enthusiast/kudu,juvchan/kudu,mauricionr/kudu,kali786516/kudu,mauricionr/kudu,duncansmart/kudu,shrimpy/kudu,shibayan/kudu,kali786516/kudu,MavenRain/kudu,badescuga/kudu,shibayan/kudu,EricSten-MSFT/kudu,juvchan/kudu,kenegozi/kudu,MavenRain/kudu,badescuga/kudu,juvchan/kudu,sitereactor/kudu,juvchan/kudu,juoni/kudu,shrimpy/kudu,projectkudu/kudu,puneet-gupta/kudu,oliver-feng/kudu,bbauya/kudu,shibayan/kudu,dev-enthusiast/kudu,uQr/kudu,uQr/kudu,duncansmart/kudu,duncansmart/kudu,EricSten-MSFT/kudu,shrimpy/kudu,oliver-feng/kudu,sitereactor/kudu,bbauya/kudu,bbauya/kudu,projectkudu/kudu,duncansmart/kudu,kenegozi/kudu,shibayan/kudu,MavenRain/kudu,YOTOV-LIMITED/kudu,sitereactor/kudu,chrisrpatterson/kudu,uQr/kudu,kali786516/kudu,YOTOV-LIMITED/kudu,kali786516/kudu,mauricionr/kudu,badescuga/kudu,dev-enthusiast/kudu,barnyp/kudu,barnyp/kudu,projectkudu/kudu,puneet-gupta/kudu,juoni/kudu,sitereactor/kudu,chrisrpatterson/kudu,badescuga/kudu,oliver-feng/kudu,shibayan/kudu,MavenRain/kudu,puneet-gupta/kudu,kenegozi/kudu,bbauya/kudu,YOTOV-LIMITED/kudu,badescuga/kudu,chrisrpatterson/kudu,sitereactor/kudu,puneet-gupta/kudu,EricSten-MSFT/kudu,barnyp/kudu
|
Kudu.FunctionalTests/GitStabilityTests.cs
|
Kudu.FunctionalTests/GitStabilityTests.cs
|
using System;
using System.Linq;
using Kudu.Core.Deployment;
using Kudu.FunctionalTests.Infrastructure;
using Kudu.TestHarness;
using Xunit;
namespace Kudu.FunctionalTests
{
public class GitStabilityTests
{
[Fact]
public void NSimpleDeployments()
{
string repositoryName = "HelloKudu";
using (var repo = Git.Clone("HelloKudu"))
{
for (int i = 0; i < 5; i++)
{
string applicationName = repositoryName + i;
ApplicationManager.Run(applicationName, appManager =>
{
// Act
appManager.GitDeploy(repo.PhysicalPath);
var results = appManager.DeploymentManager.GetResultsAsync().Result.ToList();
// Assert
Assert.Equal(1, results.Count);
Assert.Equal(DeployStatus.Success, results[0].Status);
KuduAssert.VerifyUrl(appManager.SiteUrl, "Hello Kudu");
});
}
}
}
[Fact(Skip="This test is too unreliable as it relies on formatting. Also, its main Assert has been disabled so it's useless")]
public void KuduUpTimeTest()
{
ApplicationManager.Run("KuduUpTimeTest", appManager =>
{
TimeSpan upTime = TimeSpan.Parse(appManager.GetKuduUpTime());
TestTracer.Trace("UpTime: {0}", upTime);
// some time the upTime is 00:00:00 (TimeSpan.Zero!).
// Need to do more investigation.
// Assert.NotEqual<TimeSpan>(TimeSpan.Zero, upTime);
});
}
}
}
|
using System;
using System.Linq;
using Kudu.Core.Deployment;
using Kudu.FunctionalTests.Infrastructure;
using Kudu.TestHarness;
using Xunit;
namespace Kudu.FunctionalTests
{
public class GitStabilityTests
{
[Fact]
public void NSimpleDeployments()
{
string repositoryName = "HelloKudu";
using (var repo = Git.Clone("HelloKudu"))
{
for (int i = 0; i < 5; i++)
{
string applicationName = repositoryName + i;
ApplicationManager.Run(applicationName, appManager =>
{
// Act
appManager.GitDeploy(repo.PhysicalPath);
var results = appManager.DeploymentManager.GetResultsAsync().Result.ToList();
// Assert
Assert.Equal(1, results.Count);
Assert.Equal(DeployStatus.Success, results[0].Status);
KuduAssert.VerifyUrl(appManager.SiteUrl, "Hello Kudu");
});
}
}
}
[Fact]
public void KuduUpTimeTest()
{
ApplicationManager.Run("KuduUpTimeTest", appManager =>
{
TimeSpan upTime = TimeSpan.Parse(appManager.GetKuduUpTime());
TestTracer.Trace("UpTime: {0}", upTime);
// some time the upTime is 00:00:00 (TimeSpan.Zero!).
// Need to do more investigation.
// Assert.NotEqual<TimeSpan>(TimeSpan.Zero, upTime);
});
}
}
}
|
apache-2.0
|
C#
|
9c6d0607f46a3e87c8f6e3ca42dda2a7029d2773
|
Update Domain Model
|
shahriarhossain/MailChimp.Api.Net
|
MailChimp.Api.Net/Domain/Reports/Opens.cs
|
MailChimp.Api.Net/Domain/Reports/Opens.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MailChimp.Api.Net.Domain.Reports
{
public class Opens
{
public int opens_total { get; set; }
public int unique_opens { get; set; }
public double open_rate { get; set; }
public string last_open { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MailChimp.Api.Net.Domain.Reports
{
public class Opens
{
public int opens_total { get; set; }
public int unique_opens { get; set; }
public int open_rate { get; set; }
public string last_open { get; set; }
}
}
|
mit
|
C#
|
5ec0a41b948afad2e470c2b021d635eb7aa09da6
|
Add test
|
sakapon/Samples-2017
|
ProxySample/DynamicHttpConsole/Program.cs
|
ProxySample/DynamicHttpConsole/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace DynamicHttpConsole
{
class Program
{
const string Uri_ZipCloud = "http://zipcloud.ibsnet.co.jp/api/search";
const string Uri_Cgis_Xml = "http://zip.cgis.biz/xml/zip.php";
static void Main(string[] args)
{
HttpHelperTest0();
HttpHelperTest();
DynamicHttpProxyTest();
}
static void HttpHelperTest0()
{
Console.WriteLine(HttpHelper.Get(Uri_ZipCloud));
Console.WriteLine(HttpHelper.Get(Uri_ZipCloud, new { zipcode = "6020881" }));
}
static void HttpHelperTest()
{
Console.WriteLine(HttpHelper.Get(Uri_Cgis_Xml));
Console.WriteLine(HttpHelper.Get(Uri_Cgis_Xml, new Dictionary<string, object> { { "zn", "6048301" } }));
Console.WriteLine(HttpHelper.Get(Uri_Cgis_Xml, new Dictionary<string, object> { { "zn", "501" }, { "ver", 1 } }));
Console.WriteLine(HttpHelper.Get(Uri_Cgis_Xml, new { zn = "6050073" }));
Console.WriteLine(HttpHelper.Get(Uri_Cgis_Xml, new { zn = "502", ver = 1 }));
}
static void DynamicHttpProxyTest()
{
dynamic http = new DynamicHttpProxy();
Console.WriteLine(http.Get(Uri_Cgis_Xml));
Console.WriteLine(http.Get(Uri_Cgis_Xml, new { zn = "1000001" }));
Console.WriteLine(http.Get(Uri_Cgis_Xml, new { zn = "401", ver = 1 }));
Console.WriteLine(http.Get(Uri_Cgis_Xml, zn: "1510052"));
Console.WriteLine(http.Get(Uri_Cgis_Xml, zn: "402", ver: 1));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace DynamicHttpConsole
{
class Program
{
const string Uri_ZipCloud = "http://zipcloud.ibsnet.co.jp/api/search";
const string Uri_Cgis = "http://zip.cgis.biz/xml/zip.php";
static void Main(string[] args)
{
HttpHelperTest();
DynamicHttpProxyTest();
}
static void HttpHelperTest()
{
Console.WriteLine(HttpHelper.Get(Uri_ZipCloud));
Console.WriteLine(HttpHelper.Get(Uri_ZipCloud, new Dictionary<string, object> { { "zipcode", "6040973" } }));
Console.WriteLine(HttpHelper.Get(Uri_ZipCloud, new { zipcode = "6040973" }));
Console.WriteLine(HttpHelper.Get(Uri_Cgis));
Console.WriteLine(HttpHelper.Get(Uri_Cgis, new { zn = "6020881" }));
}
static void DynamicHttpProxyTest()
{
dynamic http = new DynamicHttpProxy();
Console.WriteLine(http.Get(Uri_Cgis));
Console.WriteLine(http.Get(Uri_Cgis, new { zn = "6020881" }));
Console.WriteLine(http.Get(Uri_Cgis, zn: "6020881"));
}
}
}
|
mit
|
C#
|
668254b659c7ceb2dc0ca57599903cb470cc2337
|
Put constructor initializers on their own line
|
qmfrederik/AS.TurboJpegWrapper,qmfrederik/AS.TurboJpegWrapper
|
Quamotion.TurboJpegWrapper/TJException.cs
|
Quamotion.TurboJpegWrapper/TJException.cs
|
// <copyright file="TJException.cs" company="Autonomic Systems, Quamotion">
// Copyright (c) Autonomic Systems. All rights reserved.
// Copyright (c) Quamotion. All rights reserved.
// </copyright>
using System;
namespace TurboJpegWrapper
{
// ReSharper disable once InconsistentNaming
/// <summary>
/// Exception thrown then internal error in the underlying turbo jpeg library is occured.
/// </summary>
public class TJException : Exception
{
/// <summary>
/// Creates new instance of the <see cref="TJException"/> class.
/// </summary>
/// <param name="error">Error message from underlying turbo jpeg library.</param>
public TJException(string error)
: base(error)
{
}
}
}
|
// <copyright file="TJException.cs" company="Autonomic Systems, Quamotion">
// Copyright (c) Autonomic Systems. All rights reserved.
// Copyright (c) Quamotion. All rights reserved.
// </copyright>
using System;
namespace TurboJpegWrapper
{
// ReSharper disable once InconsistentNaming
/// <summary>
/// Exception thrown then internal error in the underlying turbo jpeg library is occured.
/// </summary>
public class TJException : Exception
{
/// <summary>
/// Creates new instance of the <see cref="TJException"/> class.
/// </summary>
/// <param name="error">Error message from underlying turbo jpeg library.</param>
public TJException(string error) : base(error)
{
}
}
}
|
mit
|
C#
|
24da6ed778942b83f4abba5c2b13842c4e4d65eb
|
update HospitalInfo with new properties needed for 3370
|
dhawalharsora/connectedcare-sdk,SnapMD/connectedcare-sdk
|
SnapMD.ConnectedCare.ApiModels/HospitalInfo.cs
|
SnapMD.ConnectedCare.ApiModels/HospitalInfo.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SnapMD.ConnectedCare.ApiModels
{
public class HospitalInfo
{
public int HospitalId { get; set; }
public string HospitalName { get; set; }
public string ContactPerson { get; set; }
public string Email { get; set; }
public string HospitalImage { get; set; }
public string ContactNumber { get; set; }
public string IsActive { get; set; }
public string HospitalCode { get; set; }
public string BrandName { get; set; }
public string BrandTitle { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string State { get; set; }
public int? StateId { get; set; }
public double? ConsultationCharge { get; set; }
public string HospitalDomainName { get; set; }
public string BrandColor { get; set; }
public string ITDepartmentContactNumber { get; set; }
public string AppointmentsContactNumber { get; set; }
public string Locale { get; set; }
public virtual IEnumerable<HospitalHours> OperatingHours { get; set; }
public List<string> EnabledModules { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SnapMD.ConnectedCare.ApiModels
{
public class HospitalInfo
{
public int HospitalId { get; set; }
public string HospitalName { get; set; }
public string ContactPerson { get; set; }
public string Email { get; set; }
public string HospitalImage { get; set; }
public string ContactNumber { get; set; }
public string IsActive { get; set; }
public string HospitalCode { get; set; }
public string BrandName { get; set; }
public string BrandTitle { get; set; }
public int? StateId { get; set; }
public double? ConsultationCharge { get; set; }
public string HospitalDomainName { get; set; }
public string BrandColor { get; set; }
public string ITDepartmentContactNumber { get; set; }
public string AppointmentsContactNumber { get; set; }
public virtual IEnumerable<HospitalHours> OperatingHours { get; set; }
public List<string> EnabledModules { get; set; }
}
}
|
apache-2.0
|
C#
|
0de0fec3043209e10862b59a30592505f2f46547
|
Add overload on effect pass to allow flag parameter.
|
TechPriest/SharpDX,TigerKO/SharpDX,TigerKO/SharpDX,Ixonos-USA/SharpDX,VirusFree/SharpDX,weltkante/SharpDX,waltdestler/SharpDX,dazerdude/SharpDX,PavelBrokhman/SharpDX,weltkante/SharpDX,manu-silicon/SharpDX,davidlee80/SharpDX-1,fmarrabal/SharpDX,TechPriest/SharpDX,davidlee80/SharpDX-1,dazerdude/SharpDX,Ixonos-USA/SharpDX,TechPriest/SharpDX,jwollen/SharpDX,weltkante/SharpDX,sharpdx/SharpDX,waltdestler/SharpDX,dazerdude/SharpDX,mrvux/SharpDX,fmarrabal/SharpDX,davidlee80/SharpDX-1,VirusFree/SharpDX,fmarrabal/SharpDX,RobyDX/SharpDX,waltdestler/SharpDX,VirusFree/SharpDX,manu-silicon/SharpDX,dazerdude/SharpDX,RobyDX/SharpDX,TechPriest/SharpDX,andrewst/SharpDX,manu-silicon/SharpDX,RobyDX/SharpDX,PavelBrokhman/SharpDX,weltkante/SharpDX,waltdestler/SharpDX,andrewst/SharpDX,PavelBrokhman/SharpDX,manu-silicon/SharpDX,mrvux/SharpDX,sharpdx/SharpDX,TigerKO/SharpDX,TigerKO/SharpDX,sharpdx/SharpDX,davidlee80/SharpDX-1,andrewst/SharpDX,Ixonos-USA/SharpDX,RobyDX/SharpDX,fmarrabal/SharpDX,jwollen/SharpDX,VirusFree/SharpDX,Ixonos-USA/SharpDX,PavelBrokhman/SharpDX,jwollen/SharpDX,mrvux/SharpDX,jwollen/SharpDX
|
Source/SharpDX.Direct3D11.Effects/EffectPass.cs
|
Source/SharpDX.Direct3D11.Effects/EffectPass.cs
|
// Copyright (c) 2010-2013 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.
#if !WIN8METRO
namespace SharpDX.Direct3D11
{
public partial class EffectPass
{
/// <summary>
/// Set the state contained in a pass to the device.
/// </summary>
/// <returns>Returns one of the following {{Direct3D 10 Return Codes}}.</returns>
/// <unmanaged>HRESULT Apply([None] UINT Flags)</unmanaged>
public void Apply(DeviceContext context)
{
Apply(0, context);
}
/// <summary>
/// Set the state contained in a pass to the device.
/// </summary>
/// <returns>Returns one of the following {{Direct3D 10 Return Codes}}.</returns>
/// <unmanaged>HRESULT Apply([None] UINT Flags)</unmanaged>
public void Apply(DeviceContext context, int flags)
{
Apply(flags, context);
}
}
}
#endif
|
// Copyright (c) 2010-2013 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.
#if !WIN8METRO
namespace SharpDX.Direct3D11
{
public partial class EffectPass
{
/// <summary>
/// Set the state contained in a pass to the device.
/// </summary>
/// <returns>Returns one of the following {{Direct3D 10 Return Codes}}.</returns>
/// <unmanaged>HRESULT Apply([None] UINT Flags)</unmanaged>
public void Apply(DeviceContext context)
{
Apply(0, context);
}
}
}
#endif
|
mit
|
C#
|
71d3bfbac98a9dd3b11554697cd8424545d4b2b9
|
Update TestKernelSets.cs
|
zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos
|
Tests/Cosmos.TestRunner.Full/TestKernelSets.cs
|
Tests/Cosmos.TestRunner.Full/TestKernelSets.cs
|
using System;
using System.Collections.Generic;
namespace Cosmos.TestRunner.Full
{
public static class TestKernelSets
{
// Kernel types to run: the ones that will run in test runners that use the default engine configuration.
public static IEnumerable<Type> GetKernelTypesToRun()
{
//yield return typeof(KernelGen3.Boot);
return GetStableKernelTypes();
}
// Stable kernel types: the ones that are stable and will run in AppVeyor
public static IEnumerable<Type> GetStableKernelTypes()
{
yield return typeof(BoxingTests.Kernel);
yield return typeof(Compiler.Tests.TypeSystem.Kernel);
yield return typeof(Compiler.Tests.Bcl.Kernel);
yield return typeof(Compiler.Tests.Bcl.System.Kernel);
//yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel);
yield return typeof(Compiler.Tests.Exceptions.Kernel);
yield return typeof(Compiler.Tests.MethodTests.Kernel);
yield return typeof(Compiler.Tests.SingleEchoTest.Kernel);
yield return typeof(Kernel.Tests.Fat.Kernel);
yield return typeof(Kernel.Tests.IO.Kernel);
yield return typeof(SimpleStructsAndArraysTest.Kernel);
yield return typeof(Kernel.Tests.DiskManager.Kernel);
//yield return typeof(KernelGen3.Boot);
yield return typeof(GraphicTest.Kernel);
yield return typeof(NetworkTest.Kernel);
// Please see the notes on the kernel itself before enabling it
//yield return typeof(ConsoleTest.Kernel);
// This is a bit slow and works only because ring check is disabled to decide if leave it enabled
yield return typeof(MemoryOperationsTest.Kernel);
yield return typeof(ProcessorTests.Kernel);
}
}
}
|
using System;
using System.Collections.Generic;
namespace Cosmos.TestRunner.Full
{
public static class TestKernelSets
{
// Kernel types to run: the ones that will run in test runners that use the default engine configuration.
public static IEnumerable<Type> GetKernelTypesToRun()
{
//yield return typeof(KernelGen3.Boot);
return GetStableKernelTypes();
}
// Stable kernel types: the ones that are stable and will run in AppVeyor
public static IEnumerable<Type> GetStableKernelTypes()
{
yield return typeof(BoxingTests.Kernel);
yield return typeof(Compiler.Tests.TypeSystem.Kernel);
yield return typeof(Compiler.Tests.Bcl.Kernel);
yield return typeof(Compiler.Tests.Bcl.System.Kernel);
yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel);
yield return typeof(Compiler.Tests.Exceptions.Kernel);
yield return typeof(Compiler.Tests.MethodTests.Kernel);
yield return typeof(Compiler.Tests.SingleEchoTest.Kernel);
yield return typeof(Kernel.Tests.Fat.Kernel);
yield return typeof(Kernel.Tests.IO.Kernel);
yield return typeof(SimpleStructsAndArraysTest.Kernel);
yield return typeof(Kernel.Tests.DiskManager.Kernel);
// //yield return typeof(KernelGen3.Boot);
yield return typeof(GraphicTest.Kernel);
yield return typeof(NetworkTest.Kernel);
// Please see the notes on the kernel itself before enabling it
//yield return typeof(ConsoleTest.Kernel);
// This is a bit slow and works only because ring check is disabled to decide if leave it enabled
yield return typeof(MemoryOperationsTest.Kernel);
yield return typeof(ProcessorTests.Kernel);
}
}
}
|
bsd-3-clause
|
C#
|
98b61d7c51b577b85a6cbb455cf8de1322bb7087
|
Fix async test
|
Fody/NullGuard
|
TestsNullableRefTypes/RewritingAsyncMethods.cs
|
TestsNullableRefTypes/RewritingAsyncMethods.cs
|
using System;
using System.Threading.Tasks;
using Xunit;
public class RewritingAsyncMethods
{
[Fact]
public async void RequiresNonNullConcreteTypeAsync()
{
await Assert.ThrowsAsync<InvalidOperationException>(() => ClassWithAsyncMethods.GetNonNullAsync());
}
[Fact]
public async void AllowsNullConcreteTypeAsync()
{
var result = await ClassWithAsyncMethods.GetNullAsync();
Assert.Null(result);
}
[Fact]
public async void RequiresNonNullGenericTypeAsyncWithDelay()
{
await Assert.ThrowsAsync<InvalidOperationException>(() => ClassWithAsyncMethods.GetNonNullAsyncWithDelay<string>());
}
[Fact]
public async void AllowsMaybeNullGenericTypeAsync()
{
var result = await ClassWithAsyncMethods.GetMaybeNullAsync<string>();
Assert.Null(result);
}
[Fact]
public async void AllowsNullGenericTypeAsyncWithDelay()
{
var result = await ClassWithAsyncMethods.GetNullAsyncWithDelay<string>();
Assert.Null(result);
}
[Fact]
public async void AllowsNullGenericTypeAsyncWithDelay2()
{
var result = await ClassWithAsyncMethods.GetNullAsyncWithDelay2<string>();
Assert.Null(result);
}
[Fact]
public void AllowsNullTask()
{
var result = ClassWithAsyncMethods.GetNullTask();
Assert.Null(result);
}
[Fact]
public async Task RequiresNonNullTask()
{
await Assert.ThrowsAsync<InvalidOperationException>(async () => await ClassWithAsyncMethods.GetNonNullTask());
}
}
|
using System;
using Xunit;
public class RewritingAsyncMethods
{
[Fact]
public async void RequiresNonNullConcreteTypeAsync()
{
await Assert.ThrowsAsync<InvalidOperationException>(() => ClassWithAsyncMethods.GetNonNullAsync());
}
[Fact]
public async void AllowsNullConcreteTypeAsync()
{
var result = await ClassWithAsyncMethods.GetNullAsync();
Assert.Null(result);
}
[Fact]
public async void RequiresNonNullGenericTypeAsyncWithDelay()
{
await Assert.ThrowsAsync<InvalidOperationException>(() => ClassWithAsyncMethods.GetNonNullAsyncWithDelay<string>());
}
[Fact]
public async void AllowsMaybeNullGenericTypeAsync()
{
var result = await ClassWithAsyncMethods.GetMaybeNullAsync<string>();
Assert.Null(result);
}
[Fact]
public async void AllowsNullGenericTypeAsyncWithDelay()
{
var result = await ClassWithAsyncMethods.GetNullAsyncWithDelay<string>();
Assert.Null(result);
}
[Fact]
public async void AllowsNullGenericTypeAsyncWithDelay2()
{
var result = await ClassWithAsyncMethods.GetNullAsyncWithDelay2<string>();
Assert.Null(result);
}
[Fact]
public void AllowsNullTask()
{
var result = ClassWithAsyncMethods.GetNullTask();
Assert.Null(result);
}
[Fact]
public void RequiresNonNullTask()
{
Assert.Throws<InvalidOperationException>(new Action(() => ClassWithAsyncMethods.GetNonNullTask()));
}
}
|
mit
|
C#
|
a94883118917d3b48e8140f77d85d1522bc6f84e
|
Bump version to 0.14
|
whampson/bft-spec,whampson/cascara
|
Src/WHampson.Cascara/Properties/AssemblyInfo.cs
|
Src/WHampson.Cascara/Properties/AssemblyInfo.cs
|
#region License
/* Copyright (c) 2017 Wes Hampson
*
* 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.
*/
#endregion
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("WHampson.Cascara")]
[assembly: AssemblyProduct("WHampson.Cascara")]
[assembly: AssemblyCopyright("Copyright (c) 2017 Wes Hampson")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2cc76928-f34e-4a9b-8623-1ccc543005c0")]
[assembly: AssemblyFileVersion("0.14.0.0")]
[assembly: AssemblyVersion("0.14.0.0")]
[assembly: AssemblyInformationalVersion("0.14")]
|
#region License
/* Copyright (c) 2017 Wes Hampson
*
* 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.
*/
#endregion
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("WHampson.Cascara")]
[assembly: AssemblyProduct("WHampson.Cascara")]
[assembly: AssemblyCopyright("Copyright (c) 2017 Wes Hampson")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2cc76928-f34e-4a9b-8623-1ccc543005c0")]
[assembly: AssemblyFileVersion("0.13.1.0")]
[assembly: AssemblyVersion("0.13.1.0")]
[assembly: AssemblyInformationalVersion("0.13.1")]
|
mit
|
C#
|
b2eb9ad080adca6d15bd3e6ebaa2583cd8c2c36d
|
Update namespace name
|
regifraga/Net.Comunication.UDP
|
SimpleUDPMessage/SimpleUDPMessageClient.cs
|
SimpleUDPMessage/SimpleUDPMessageClient.cs
|
using System;
using System.Net;
using System.Text;
using System.Net.Sockets;
namespace RegiFraga.Comunication.UDP
{
public class SimpleUDPMessageClient : SimpleUDPMessageBase
{
private Action<string> _sendCallback;
public delegate void MessageReceiveHandle(string message);
public event MessageReceiveHandle OnMessageReceive;
public SimpleUDPMessageClient(string address = "127.0.0.1", int port = 9669)
{
Address = address;
Port = port;
base.OnReceive += SimpleUDPMessageClient_OnReceive; ;
}
protected override void InitializerUdp()
{
base.Udp = new UdpClient(Address, Port);
}
public string Address { get; private set; }
public void Send(string message)
{
byte[] data = Encoding.ASCII.GetBytes(message);
base.Udp.Send(data, data.Length);
}
public void Send(string message, Action<string> callback)
{
_sendCallback = callback;
byte[] data = Encoding.ASCII.GetBytes(message);
base.Udp.Send(data, data.Length);
}
private void SimpleUDPMessageClient_OnReceive(IPEndPoint sender, string message)
{
OnMessageReceive?.Invoke(message);
_sendCallback?.Invoke(message);
}
}
}
|
using System;
using System.Net;
using System.Text;
using System.Net.Sockets;
namespace IMS.UDP.Simple.Message
{
public class SimpleUDPMessageClient : SimpleUDPMessageBase
{
private Action<string> _sendCallback;
public delegate void MessageReceiveHandle(string message);
public event MessageReceiveHandle OnMessageReceive;
public SimpleUDPMessageClient(string address = "127.0.0.1", int port = 9669)
{
Address = address;
Port = port;
base.OnReceive += SimpleUDPMessageClient_OnReceive; ;
}
protected override void InitializerUdp()
{
base.Udp = new UdpClient(Address, Port);
}
public string Address { get; private set; }
public void Send(string message)
{
byte[] data = Encoding.ASCII.GetBytes(message);
base.Udp.Send(data, data.Length);
}
public void Send(string message, Action<string> callback)
{
_sendCallback = callback;
byte[] data = Encoding.ASCII.GetBytes(message);
base.Udp.Send(data, data.Length);
}
private void SimpleUDPMessageClient_OnReceive(IPEndPoint sender, string message)
{
OnMessageReceive?.Invoke(message);
_sendCallback?.Invoke(message);
}
}
}
|
mit
|
C#
|
ac602ae1178a0c606ac882e6139cf30a81e44447
|
Update WalletWasabi.Gui/Models/LoadWalletEntry.cs
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Models/LoadWalletEntry.cs
|
WalletWasabi.Gui/Models/LoadWalletEntry.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using WalletWasabi.Hwi.Models;
namespace WalletWasabi.Gui.Models
{
public class LoadWalletEntry
{
public string WalletName { get; set; } = null;
public HwiEnumerateEntry HardwareWalletInfo { get; set; } = null;
public LoadWalletEntry(string walletName)
{
WalletName = walletName;
HardwareWalletInfo = null;
}
public LoadWalletEntry(HwiEnumerateEntry hwi)
{
string typeString = hwi.Model.ToString();
var walletNameBuilder = new StringBuilder(typeString);
if (hwi.NeedsPinSent is true)
{
walletNameBuilder.Append(" - Needs PIN Sent");
}
else if (hwi.NeedsPassphraseSent is true)
{
walletNameBuilder.Append(" - Needs Passphrase Sent");
}
else if (!string.IsNullOrWhiteSpace(hwi.Error))
{
walletNameBuilder.Append($" - Error: {hwi.Error}");
}
else if (hwi.Code != null)
{
walletNameBuilder.Append($" - Error: {hwi.Code}");
}
else if (hwi.Fingerprint is null)
{
walletNameBuilder.Append($" - Could Not Acquire Fingerprint");
}
WalletName = walletNameBuilder.ToString();
HardwareWalletInfo = hwi;
}
public override string ToString()
{
return WalletName;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using WalletWasabi.Hwi.Models;
namespace WalletWasabi.Gui.Models
{
public class LoadWalletEntry
{
public string WalletName { get; set; } = null;
public HwiEnumerateEntry HardwareWalletInfo { get; set; } = null;
public LoadWalletEntry(string walletName)
{
WalletName = walletName;
HardwareWalletInfo = null;
}
public LoadWalletEntry(HwiEnumerateEntry hwi)
{
string typeString = hwi.Model.ToString();
var walletNameBuilder = new StringBuilder(typeString);
if (hwi.NeedsPinSent is true)
{
walletNameBuilder.Append(" - Needs PIN Sent");
}
else if (hwi.NeedsPassphraseSent is true)
{
walletNameBuilder.Append($" - Needs Passphrase Sent");
}
else if (!string.IsNullOrWhiteSpace(hwi.Error))
{
walletNameBuilder.Append($" - Error: {hwi.Error}");
}
else if (hwi.Code != null)
{
walletNameBuilder.Append($" - Error: {hwi.Code}");
}
else if (hwi.Fingerprint is null)
{
walletNameBuilder.Append($" - Could Not Acquire Fingerprint");
}
WalletName = walletNameBuilder.ToString();
HardwareWalletInfo = hwi;
}
public override string ToString()
{
return WalletName;
}
}
}
|
mit
|
C#
|
f4e9703deb20a7abdd303781a17c63e736951136
|
Fix incorrect comparison
|
peppy/osu-new,ppy/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,peppy/osu,ppy/osu,smoogipoo/osu
|
osu.Game/Screens/Multi/Components/SelectionPollingComponent.cs
|
osu.Game/Screens/Multi/Components/SelectionPollingComponent.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Online.Multiplayer;
namespace osu.Game.Screens.Multi.Components
{
/// <summary>
/// A <see cref="RoomPollingComponent"/> that polls for the currently-selected room.
/// </summary>
public class SelectionPollingComponent : RoomPollingComponent
{
[Resolved]
private Bindable<Room> selectedRoom { get; set; }
[Resolved]
private IRoomManager roomManager { get; set; }
[BackgroundDependencyLoader]
private void load()
{
selectedRoom.BindValueChanged(_ =>
{
if (IsLoaded)
PollImmediately();
});
}
private GetRoomRequest pollReq;
protected override Task Poll()
{
if (!API.IsLoggedIn)
return base.Poll();
if (selectedRoom.Value?.RoomID.Value == null)
return base.Poll();
var tcs = new TaskCompletionSource<bool>();
pollReq?.Cancel();
pollReq = new GetRoomRequest(selectedRoom.Value.RoomID.Value.Value);
pollReq.Success += result =>
{
var rooms = new List<Room>(roomManager.Rooms);
int index = rooms.FindIndex(r => r.RoomID.Value == result.RoomID.Value);
if (index < 0)
return;
rooms[index] = result;
NotifyRoomsReceived(rooms);
tcs.SetResult(true);
};
pollReq.Failure += _ => tcs.SetResult(false);
API.Queue(pollReq);
return tcs.Task;
}
}
}
|
// 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 System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Online.Multiplayer;
namespace osu.Game.Screens.Multi.Components
{
/// <summary>
/// A <see cref="RoomPollingComponent"/> that polls for the currently-selected room.
/// </summary>
public class SelectionPollingComponent : RoomPollingComponent
{
[Resolved]
private Bindable<Room> selectedRoom { get; set; }
[Resolved]
private IRoomManager roomManager { get; set; }
[BackgroundDependencyLoader]
private void load()
{
selectedRoom.BindValueChanged(_ =>
{
if (IsLoaded)
PollImmediately();
});
}
private GetRoomRequest pollReq;
protected override Task Poll()
{
if (!API.IsLoggedIn)
return base.Poll();
if (selectedRoom.Value?.RoomID.Value == null)
return base.Poll();
var tcs = new TaskCompletionSource<bool>();
pollReq?.Cancel();
pollReq = new GetRoomRequest(selectedRoom.Value.RoomID.Value.Value);
pollReq.Success += result =>
{
var rooms = new List<Room>(roomManager.Rooms);
int index = rooms.FindIndex(r => r.RoomID == result.RoomID);
if (index < 0)
return;
rooms[index] = result;
NotifyRoomsReceived(rooms);
tcs.SetResult(true);
};
pollReq.Failure += _ => tcs.SetResult(false);
API.Queue(pollReq);
return tcs.Task;
}
}
}
|
mit
|
C#
|
0bf983dc4a6a82f9696a480936dfd64e7e45e442
|
Fix compiler failing to load settings xml causing an empty compiler error in Unity, (#29)
|
SaladLab/Unity3D.IncrementalCompiler,SaladbowlCreative/Unity3D.IncrementalCompiler
|
core/IncrementalCompiler/Settings.cs
|
core/IncrementalCompiler/Settings.cs
|
using System;
using System.IO;
using System.Reflection;
using System.Xml.Linq;
namespace IncrementalCompiler
{
public class Settings
{
public DebugSymbolFileType DebugSymbolFile;
public PrebuiltOutputReuseType PrebuiltOutputReuse;
public static Settings Default = new Settings
{
DebugSymbolFile = DebugSymbolFileType.Mdb,
PrebuiltOutputReuse = PrebuiltOutputReuseType.WhenNoChange,
};
public static Settings Load()
{
var fileName = Path.ChangeExtension(Assembly.GetEntryAssembly().Location, ".xml");
if (File.Exists(fileName) == false)
return null;
using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Load(stream);
}
}
public static Settings Load(Stream stream)
{
// To reduce start-up time, do manual parsing instead of using XmlSerializer
var xdoc = XDocument.Load(stream).Element("Settings");
return new Settings
{
DebugSymbolFile = (DebugSymbolFileType)Enum.Parse(typeof(DebugSymbolFileType), xdoc.Element("DebugSymbolFile").Value),
PrebuiltOutputReuse = (PrebuiltOutputReuseType)Enum.Parse(typeof(PrebuiltOutputReuseType), xdoc.Element("PrebuiltOutputReuse").Value),
};
}
}
}
|
using System;
using System.IO;
using System.Reflection;
using System.Xml.Linq;
namespace IncrementalCompiler
{
public class Settings
{
public DebugSymbolFileType DebugSymbolFile;
public PrebuiltOutputReuseType PrebuiltOutputReuse;
public static Settings Default = new Settings
{
DebugSymbolFile = DebugSymbolFileType.Mdb,
PrebuiltOutputReuse = PrebuiltOutputReuseType.WhenNoChange,
};
public static Settings Load()
{
var fileName = Path.ChangeExtension(Assembly.GetEntryAssembly().Location, ".xml");
if (File.Exists(fileName) == false)
return null;
using (var stream = new FileStream(fileName, FileMode.Open))
{
return Load(stream);
}
}
public static Settings Load(Stream stream)
{
// To reduce start-up time, do manual parsing instead of using XmlSerializer
var xdoc = XDocument.Load(stream).Element("Settings");
return new Settings
{
DebugSymbolFile = (DebugSymbolFileType)Enum.Parse(typeof(DebugSymbolFileType), xdoc.Element("DebugSymbolFile").Value),
PrebuiltOutputReuse = (PrebuiltOutputReuseType)Enum.Parse(typeof(PrebuiltOutputReuseType), xdoc.Element("PrebuiltOutputReuse").Value),
};
}
}
}
|
mit
|
C#
|
052c3ba6e0459d530b7b9f135c92c645ca6123d3
|
fix Save and Load Serialization. #67
|
cbovar/ConvNetSharp
|
src/ConvNetSharp.Core/Serialization/SerializationExtensions.cs
|
src/ConvNetSharp.Core/Serialization/SerializationExtensions.cs
|
using System;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace ConvNetSharp.Core.Serialization
{
public static class SerializationExtensions
{
public static Net<T> FromJson<T>(string json) where T : struct, IEquatable<T>, IFormattable
{
var data = JsonConvert.DeserializeObject<JObject>(json);
var dico = data.ToDictionary();
var net = Net<T>.FromData(dico);
return net;
}
public static T[] ToArrayOfT<T>(this object obj)
{
var arrayofT = obj as T[];
if (arrayofT != null)
{
return arrayofT;
}
var jarray = obj as JArray;
if (jarray != null)
{
return jarray.ToObject<T[]>();
}
return ((object[])obj).Select(o => (T)Convert.ChangeType(o, typeof(T), null)).ToArray();
}
public static string ToJson<T>(this Net<T> net) where T : struct, IEquatable<T>, IFormattable
{
var data = net.GetData();
var json = JsonConvert.SerializeObject(data);
return json;
}
}
}
|
using System;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace ConvNetSharp.Core.Serialization
{
public static class SerializationExtensions
{
public static Net<T> FromJson<T>(string json) where T : struct, IEquatable<T>, IFormattable
{
var data = JsonConvert.DeserializeObject<JObject>(json);
var dico = data.ToDictionary();
var net = Net<T>.FromData(dico);
return net;
}
public static T[] ToArrayOfT<T>(this object obj)
{
var arrayofT = obj as T[];
if (arrayofT != null)
{
return arrayofT;
}
var jarray = obj as JArray;
if (jarray != null)
{
return jarray.ToObject<T[]>();
}
return ((object[])obj).Cast<T>().ToArray();
}
public static string ToJson<T>(this Net<T> net) where T : struct, IEquatable<T>, IFormattable
{
var data = net.GetData();
var json = JsonConvert.SerializeObject(data);
return json;
}
}
}
|
mit
|
C#
|
73bcfcc96b6db893b86becdd071081ab524b3c8f
|
Refactor VK class
|
rhynodegreat/CSharpGameLibrary,vazgriz/CSharpGameLibrary,rhynodegreat/CSharpGameLibrary,vazgriz/CSharpGameLibrary
|
CSGL.Vulkan/Unmanaged/VK.cs
|
CSGL.Vulkan/Unmanaged/VK.cs
|
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
using CSGL.Vulkan.Unmanaged;
namespace CSGL.Vulkan.Unmanaged {
public static partial class VK {
public static string GetCommand<T>() {
Type t = typeof(T);
return GetCommand(t);
}
public static string GetCommand(Type t) {
string name = t.Name;
return name.Substring(0, name.Length - 8); //"Delegate".Length == 8
}
public static IntPtr Load(VkInstance instance, string commandName) {
var native = Interop.GetUTF8(commandName);
return GetInstanceProcAddr(instance, native);
}
public static IntPtr Load(VkDevice device, string commandName) {
var native = Interop.GetUTF8(commandName);
return GetDeviceProcAddr(device, native);
}
public static void Load<T>(ref T del, VkInstance instance) {
var commandName = GetCommand<T>();
IntPtr ptr = Load(instance, commandName);
del = Marshal.GetDelegateForFunctionPointer<T>(ptr);
}
public static void Load<T>(ref T del) {
Load(ref del, VkInstance.Null);
}
public static void Load<T>(ref T del, VkDevice device) {
var commandName = GetCommand<T>();
IntPtr ptr = Load(device, commandName);
del = Marshal.GetDelegateForFunctionPointer<T>(ptr);
}
public static void Load<T>(ref T del, Vulkan.VkInstance instance) {
Load(ref del, instance.Native);
}
public static void Load<T>(ref T del, Vulkan.VkDevice device) {
var command = GetCommand<T>();
IntPtr ptr = device.GetProcAdddress(command);
del = Marshal.GetDelegateForFunctionPointer<T>(ptr);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
using CSGL.Vulkan.Unmanaged;
namespace CSGL.Vulkan.Unmanaged {
public static partial class VK {
public static string GetCommand<T>() {
Type t = typeof(T);
return GetCommand(t);
}
public static string GetCommand(Type t) {
string name = t.Name;
return name.Substring(0, name.Length - 8); //"Delegate".Length == 8
}
public static void Load<T>(ref T del, VkInstance instance) {
var command = GetCommand<T>();
var native = Interop.GetUTF8(command);
IntPtr ptr = VK.GetInstanceProcAddr(instance, native);
del = Marshal.GetDelegateForFunctionPointer<T>(ptr);
}
public static void Load<T>(ref T del) {
Load(ref del, VkInstance.Null);
}
public static void Load<T>(ref T del, VkDevice device) {
var command = GetCommand<T>();
var native = Interop.GetUTF8(command);
IntPtr ptr = VK.GetDeviceProcAddr(device, native);
del = Marshal.GetDelegateForFunctionPointer<T>(ptr);
}
public static void Load<T>(ref T del, Vulkan.VkInstance instance) {
Load(ref del, instance.Native);
}
public static void Load<T>(ref T del, Vulkan.VkDevice device) {
var command = GetCommand<T>();
IntPtr ptr = device.GetProcAdddress(command);
del = Marshal.GetDelegateForFunctionPointer<T>(ptr);
}
}
}
|
mit
|
C#
|
fa7a296f86c010e73ba22c55c7a3f104658a4be6
|
fix bug in while condition
|
pashchuk/Numerical-methods,pashchuk/Numerical-methods
|
CSharp/Nums/SeidelMethod.cs
|
CSharp/Nums/SeidelMethod.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Nums
{
public class SeidelMethod
{
#region Fields
private Matrix<double> _matrix;
private double[] _vector;
private double[] _solution;
#endregion
#region Properties
#endregion
#region Costructors
public SeidelMethod(Matrix<double> inputMatrix, double[] vector)
{
_matrix = inputMatrix;
_vector = vector;
}
#endregion
#region private Methods
private void calculate(Matrix<double> matrix, double[] vector)
{
const double epsilon = 0.0000001;
var size = vector.Length;
var currentSolution = new double[size];
var previousSolution = new double[size];
var iterationCount = 0;
do
{
Array.Copy(currentSolution, previousSolution, size);
for (int i = 0; i < size; i++)
{
var sum = default (double);
for (int j = 0; j < i; j++)
sum += currentSolution[j]*matrix[i, j];
for (int j = i + 1; j < size; j++)
sum += previousSolution[j]*matrix[i, j];
currentSolution[i] = (vector[i] - sum)/matrix[i, i];
}
iterationCount++;
} while (!isEnd(eps: epsilon, curr: currentSolution, prev: previousSolution));
_solution = currentSolution;
}
private bool isEnd(double[] curr, double[] prev, double eps)
{
var sum = curr.Select((cur, i) => (cur - prev[i])*(cur - prev[i])).Sum();
return Math.Sqrt(sum) <= eps;
}
private unsafe double[] verify(Matrix<double> sourceMatrix, double[] resultVector)
{
var size = resultVector.Length;
var verifyVector = new double[size];
fixed (double* pMatrix = sourceMatrix.GetMatrixPointer(),
pVector = resultVector, pVerifyVector = verifyVector)
{
for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
*(pVerifyVector + i) += pMatrix[i * size + j] * pVector[j];
}
return verifyVector;
}
#endregion
#region public Methods
public void Solve()
{
calculate(_matrix, _vector);
foreach (var d in _solution)
Console.WriteLine(d);
Console.WriteLine();
var ver = verify(_matrix, _solution);
foreach (var d in ver)
Console.WriteLine(d);
}
#endregion
#region Events
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Nums
{
public class SeidelMethod
{
#region Fields
private Matrix<double> _matrix;
private double[] _vector;
private double[] _solution;
#endregion
#region Properties
#endregion
#region Costructors
public SeidelMethod(Matrix<double> inputMatrix, double[] vector)
{
_matrix = inputMatrix;
_vector = vector;
}
#endregion
#region private Methods
private void calculate(Matrix<double> matrix, double[] vector)
{
const double epsilon = 0.0000001;
var size = vector.Length;
var currentSolution = new double[size];
var previousSolution = new double[size];
var iterationCount = 0;
do
{
Array.Copy(currentSolution, previousSolution, size);
for (int i = 0; i < size; i++)
{
var sum = default (double);
for (int j = 0; j < i; j++)
sum += currentSolution[j]*matrix[i, j];
for (int j = i + 1; j < size; j++)
sum += previousSolution[j]*matrix[i, j];
currentSolution[i] = (vector[i] - sum)/matrix[i, i];
}
iterationCount++;
} while (isEnd(eps: epsilon, curr: currentSolution, prev: previousSolution));
_solution = currentSolution;
}
private bool isEnd(double[] curr, double[] prev, double eps)
{
var sum = curr.Select((cur, i) => (cur - prev[i])*(cur - prev[i])).Sum();
return Math.Sqrt(sum) <= eps;
}
#endregion
#region public Methods
public void Solve()
{
calculate(_matrix, _vector);
foreach (var d in _solution)
{
Console.WriteLine(d);
}
}
#endregion
#region Events
#endregion
}
}
|
mit
|
C#
|
f493f77a1e3f47c21f3bc907e9d59af6a8a35156
|
Make sure the model isn't lost when navigating to/from the contact picker
|
HTBox/MobileKidsIdApp,bseebacher/MobileKidsIdApp,rockfordlhotka/MobileKidsIdApp,HTBox/MobileKidsIdApp,bseebacher/MobileKidsIdApp,bseebacher/MobileKidsIdApp,rockfordlhotka/MobileKidsIdApp,bseebacher/MobileKidsIdApp,HTBox/MobileKidsIdApp,HTBox/MobileKidsIdApp
|
src/MobileKidsIdApp/MobileKidsIdApp/ViewModels/BasicDetails.cs
|
src/MobileKidsIdApp/MobileKidsIdApp/ViewModels/BasicDetails.cs
|
using MobileKidsIdApp.Services;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
using MobileKidsIdApp.Models;
namespace MobileKidsIdApp.ViewModels
{
public class BasicDetails : ViewModelBase<Models.ChildDetails>
{
private ContactInfo _contact;
public ICommand ChangeContactCommand { get; private set; }
public BasicDetails(Models.ChildDetails details)
{
ChangeContactCommand = new Command(async () =>
{
PrepareToShowModal();
ContactInfo contact = await DependencyService.Get<IContactPicker>().GetSelectedContactInfo();
if (contact == null)
{
//Do nothing, user must have cancelled.
}
else
{
_contact = contact;
Model.ContactId = contact.Id;
//Only overwrite name fields if they were blank.
if (string.IsNullOrEmpty(Model.FamilyName))
Model.FamilyName = contact.FamilyName;
if (string.IsNullOrEmpty(Model.AdditionalName))
Model.AdditionalName = contact.AdditionalName;
if (string.IsNullOrEmpty(Model.GivenName))
Model.GivenName = contact.GivenName;
OnPropertyChanged(nameof(Contact));
}
});
Model = details;
}
protected override async Task<ChildDetails> DoInitAsync()
{
_contact = await DependencyService.Get<IContactPicker>().GetContactInfoForId(Model.ContactId);
return Model;
}
public ContactInfo Contact { get { return _contact; } }
}
}
|
using MobileKidsIdApp.Services;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
using MobileKidsIdApp.Models;
namespace MobileKidsIdApp.ViewModels
{
public class BasicDetails : ViewModelBase<Models.ChildDetails>
{
private ContactInfo _contact;
public ICommand ChangeContactCommand { get; private set; }
public BasicDetails(Models.ChildDetails details)
{
ChangeContactCommand = new Command(async () =>
{
ContactInfo contact = await DependencyService.Get<IContactPicker>().GetSelectedContactInfo();
if (contact == null)
{
//Do nothing, user must have cancelled.
}
else
{
_contact = contact;
Model.ContactId = contact.Id;
//Only overwrite name fields if they were blank.
if (string.IsNullOrEmpty(Model.FamilyName))
Model.FamilyName = contact.FamilyName;
if (string.IsNullOrEmpty(Model.AdditionalName))
Model.AdditionalName = contact.AdditionalName;
if (string.IsNullOrEmpty(Model.GivenName))
Model.GivenName = contact.GivenName;
OnPropertyChanged(nameof(Contact));
}
});
Model = details;
}
protected override async Task<ChildDetails> DoInitAsync()
{
_contact = await DependencyService.Get<IContactPicker>().GetContactInfoForId(Model.ContactId);
return Model;
}
public ContactInfo Contact { get { return _contact; } }
}
}
|
apache-2.0
|
C#
|
ab65d1b661df00cd009641ad89601d09947e5d88
|
Update for CLS Compliance
|
dipeshc/BTDeploy
|
src/MonoTorrent.Tests/Client/Tests/AllowedFastAlgorithmTest.cs
|
src/MonoTorrent.Tests/Client/Tests/AllowedFastAlgorithmTest.cs
|
//
// AllowedFastAlgorithm.cs
//
// Authors:
// Alan McGovern alan.mcgovern@gmail.com
//
// Copyright (C) 2006 Alan McGovern
//
// 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;
using NUnit.Framework;
using System.Net;
namespace MonoTorrent.Client.Tests
{
//[TestFixture]
//public class AllowedFastAlgorithmTest
//{
// [Test]
// public void CalculateTest()
// {
// byte[] infohash = new byte[20];
// IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse("80.4.4.200"), 24142);
// for (int i = 0; i < infohash.Length; i++)
// infohash[i] = (byte)170;
// List<UInt32> results = AllowedFastAlgorithm.Calculate(endpoint.Address.GetAddressBytes(), infohash, 9, (UInt32)1313);
// Assert.AreEqual(1059, results[0], "#1");
// Assert.AreEqual(431, results[1], "#2");
// Assert.AreEqual(808, results[2], "#3");
// Assert.AreEqual(1217, results[3], "#4");
// Assert.AreEqual(287, results[4], "#5");
// Assert.AreEqual(376, results[5], "#6");
// Assert.AreEqual(1188, results[6], "#7");
// Assert.AreEqual(353, results[7], "#8");
// Assert.AreEqual(508, results[8], "#9");
// }
//}
}
|
//
// AllowedFastAlgorithm.cs
//
// Authors:
// Alan McGovern alan.mcgovern@gmail.com
//
// Copyright (C) 2006 Alan McGovern
//
// 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;
using NUnit.Framework;
using System.Net;
namespace MonoTorrent.Client.Tests
{
[TestFixture]
public class AllowedFastAlgorithmTest
{
[Test]
public void CalculateTest()
{
byte[] infohash = new byte[20];
IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse("80.4.4.200"), 24142);
for (int i = 0; i < infohash.Length; i++)
infohash[i] = (byte)170;
List<UInt32> results = AllowedFastAlgorithm.Calculate(endpoint.Address.GetAddressBytes(), infohash, 9, (UInt32)1313);
Assert.AreEqual(1059, results[0], "#1");
Assert.AreEqual(431, results[1], "#2");
Assert.AreEqual(808, results[2], "#3");
Assert.AreEqual(1217, results[3], "#4");
Assert.AreEqual(287, results[4], "#5");
Assert.AreEqual(376, results[5], "#6");
Assert.AreEqual(1188, results[6], "#7");
Assert.AreEqual(353, results[7], "#8");
Assert.AreEqual(508, results[8], "#9");
}
}
}
|
mit
|
C#
|
38c3ecacd83ffc27a983666ee576f5101b23a949
|
Fix for ObjectDisposed exception if form was closed.
|
nycdotnet/TSqlFlex
|
Code/TSqlFlex/RunCommand.cs
|
Code/TSqlFlex/RunCommand.cs
|
using System;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Text;
using RedGate.SIPFrameworkShared;
namespace TSqlFlex
{
class RunCommand : ISharedCommand
{
private readonly ISsmsFunctionalityProvider4 ssmsProvider;
private readonly ICommandImage commandImage = new CommandImageNone();
private ObjectExplorerNodeDescriptorBase currentNode = null;
private frmMain form = new frmMain();
public void SetSelectedDBNode(ObjectExplorerNodeDescriptorBase theSelectedNode)
{
currentNode = theSelectedNode;
var objectExplorerNode = currentNode as IOeNode;
IConnectionInfo ci = null;
if (objectExplorerNode != null
&& objectExplorerNode.HasConnection
&& objectExplorerNode.TryGetConnection(out ci)) //there should be a TryGetConnection2 or just get rid of IConnectionInfo "1"...
{
form.SetConnection(new SqlConnectionStringBuilder(ci.ConnectionString));
}
}
public RunCommand(ISsmsFunctionalityProvider4 provider)
{
ssmsProvider = provider;
if (ssmsProvider == null)
{
throw new ArgumentException("Could not initialize provider for RunCommand.");
}
}
public string Name { get { return "Open_TSQL_Flex"; } }
public void Execute()
{
if (form == null || form.IsDisposed)
{
form = new frmMain();
SetSelectedDBNode(currentNode);
}
form.Show();
}
public string Caption { get { return "TSQLFlex"; } }
public string Tooltip { get { return "Runs a command for scripting"; } }
public ICommandImage Icon { get { return commandImage; } }
public string[] DefaultBindings { get { return new string[] {}; } }
public bool Visible { get { return true; } }
public bool Enabled { get { return true; } }
}
}
|
using System;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Text;
using RedGate.SIPFrameworkShared;
namespace TSqlFlex
{
class RunCommand : ISharedCommand
{
private readonly ISsmsFunctionalityProvider4 ssmsProvider;
private readonly ICommandImage commandImage = new CommandImageNone();
private ObjectExplorerNodeDescriptorBase currentNode = null;
private frmMain form = new frmMain();
public void SetSelectedDBNode(ObjectExplorerNodeDescriptorBase theSelectedNode)
{
currentNode = theSelectedNode;
var objectExplorerNode = currentNode as IOeNode;
IConnectionInfo ci = null;
if (objectExplorerNode != null
&& objectExplorerNode.HasConnection
&& objectExplorerNode.TryGetConnection(out ci)) //there should be a TryGetConnection2 or just get rid of IConnectionInfo "1"...
{
form.SetConnection(new SqlConnectionStringBuilder(ci.ConnectionString));
}
}
public RunCommand(ISsmsFunctionalityProvider4 provider)
{
ssmsProvider = provider;
if (ssmsProvider == null)
{
throw new ArgumentException("Could not initialize provider for RunCommand.");
}
}
public string Name { get { return "Open_TSQL_Flex"; } }
public void Execute()
{
form.Show();
}
public string Caption { get { return "TSQLFlex"; } }
public string Tooltip { get { return "Runs a command for scripting"; } }
public ICommandImage Icon { get { return commandImage; } }
public string[] DefaultBindings { get { return new string[] {}; } }
public bool Visible { get { return true; } }
public bool Enabled { get { return true; } }
}
}
|
mit
|
C#
|
6a2a3d953275afccd7181f095252c5219303f8fc
|
Fix JSON formatting in Angular2Spa template
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
templates/Angular2Spa/Startup.cs
|
templates/Angular2Spa/Startup.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNet.SpaServices.Webpack;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Serialization;
namespace WebApplicationBasic
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddJsonOptions(options =>
{
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env)
{
app.UseDeveloperExceptionPage();
if (env.IsDevelopment()) {
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
HotModuleReplacement = true
});
}
app.UseStaticFiles();
loggerFactory.AddConsole();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });
});
}
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseDefaultHostingConfiguration(args)
.UseIISPlatformHandlerUrl()
.UseKestrel()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNet.SpaServices.Webpack;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Serialization;
namespace WebApplicationBasic
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env)
{
app.UseDeveloperExceptionPage();
if (env.IsDevelopment()) {
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
HotModuleReplacement = true
});
}
app.UseStaticFiles();
loggerFactory.AddConsole();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });
});
}
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseDefaultHostingConfiguration(args)
.UseIISPlatformHandlerUrl()
.UseKestrel()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
|
apache-2.0
|
C#
|
dbc7c071d8a78064e22c9fa8ee4dbf92afa29de9
|
Set Name
|
dsharlet/LiveSPICE,dsharlet/ComputerAlgebra
|
Circuit/Components/VariableResistor.cs
|
Circuit/Components/VariableResistor.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SyMath;
using System.ComponentModel;
namespace Circuit
{
[CategoryAttribute("Standard")]
[DisplayName("Variable Resistor")]
[DefaultProperty("Resistance")]
[Description("Variable resistor.")]
public class VariableResistor : TwoTerminal
{
protected Quantity resistance = new Quantity(100, Units.Ohm);
[Description("Resistance of this variable resistor.")]
[Serialize]
public Quantity Resistance { get { return resistance; } set { if (resistance.Set(value)) NotifyChanged("Resistance"); } }
protected Expression wipe = 0.5m;
[Serialize]
[Description("Position of the wiper on this variable resistor, between 0 and 1.")]
public Expression Wipe { get { return wipe; } set { wipe = value; NotifyChanged("Wipe"); } }
public VariableResistor() { Name = "R1"; }
public override void Analyze(ModifiedNodalAnalysis Mna)
{
Resistor.Analyze(Mna, Anode, Cathode, Resistance.Value * Wipe);
}
public override void LayoutSymbol(SymbolLayout Sym)
{
base.LayoutSymbol(Sym);
Sym.AddWire(Anode, new Coord(0, 16));
Sym.AddWire(Cathode, new Coord(0, -16));
Sym.InBounds(new Coord(-10, 0), new Coord(10, 0));
Sym.DrawArrow(EdgeType.Black, new Coord(-6, -15), new Coord(6, 15), 0.1);
Resistor.Draw(Sym, 0, -16, 16, 7);
Sym.DrawText(() => resistance.ToString(), new Coord(-7, 0), Alignment.Far, Alignment.Center);
Sym.DrawText(() => wipe.ToString(), new Coord(9, 3), Alignment.Near, Alignment.Near);
Sym.DrawText(() => Name, new Coord(9, -3), Alignment.Near, Alignment.Far);
}
public override string ToString() { return Name + " = " + resistance.ToString(); }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SyMath;
using System.ComponentModel;
namespace Circuit
{
[CategoryAttribute("Standard")]
[DisplayName("Variable Resistor")]
[DefaultProperty("Resistance")]
[Description("Variable resistor.")]
public class VariableResistor : TwoTerminal
{
protected Quantity resistance = new Quantity(100, Units.Ohm);
[Description("Resistance of this variable resistor.")]
[Serialize]
public Quantity Resistance { get { return resistance; } set { if (resistance.Set(value)) NotifyChanged("Resistance"); } }
protected Expression wipe = 0.5m;
[Serialize]
[Description("Position of the wiper on this variable resistor, between 0 and 1.")]
public Expression Wipe { get { return wipe; } set { wipe = value; NotifyChanged("Wipe"); } }
public VariableResistor() { }
public override void Analyze(ModifiedNodalAnalysis Mna)
{
Resistor.Analyze(Mna, Anode, Cathode, Resistance.Value * Wipe);
}
public override void LayoutSymbol(SymbolLayout Sym)
{
base.LayoutSymbol(Sym);
Sym.AddWire(Anode, new Coord(0, 16));
Sym.AddWire(Cathode, new Coord(0, -16));
Sym.InBounds(new Coord(-10, 0), new Coord(10, 0));
Sym.DrawArrow(EdgeType.Black, new Coord(-6, -15), new Coord(6, 15), 0.1);
Resistor.Draw(Sym, 0, -16, 16, 7);
Sym.DrawText(() => resistance.ToString(), new Coord(-7, 0), Alignment.Far, Alignment.Center);
Sym.DrawText(() => wipe.ToString(), new Coord(9, 3), Alignment.Near, Alignment.Near);
Sym.DrawText(() => Name, new Coord(9, -3), Alignment.Near, Alignment.Far);
}
public override string ToString() { return Name + " = " + resistance.ToString(); }
}
}
|
mit
|
C#
|
67d6fe0c91413c56ade380a3c3dfd891b9928199
|
add comment
|
ivayloivanof/C-Sharp-Chat-Programm
|
Client/ChatClient/ChatClient/Client.cs
|
Client/ChatClient/ChatClient/Client.cs
|
namespace ChatClient
{
using System.Collections.Generic;
public class Client
{
public List<ServerInfo> ServerInfoList;
public Server connectedServer;
private string loginName;
private string loginPassword;
private string serverPassword;
public Client()
{
this.ServerInfoList = new List<ServerInfo>();
this.LoadServerInfoList();
this.connectedServer = new Server();
this.connectedServer.Disconnected += new Server.ServerDisconnectedHandler(this.ServerDisconnected);
}
public void SetLoginData(string name, string password, string serverPassword = "")
{
this.loginName = name;
this.loginPassword = password;
this.serverPassword = serverPassword;
}
public void ServerDisconnected(object handle)
{
// TODO no implement
}
private void LoadServerInfoList()
{
// TODO no implement
}
}
}
|
namespace ChatClient
{
using System.Collections.Generic;
public class Client
{
public List<ServerInfo> ServerInfoList;
public Server connectedServer;
private string loginName;
private string loginPassword;
private string serverPassword;
public Client()
{
this.ServerInfoList = new List<ServerInfo>();
this.LoadServerInfoList();
this.connectedServer = new Server();
this.connectedServer.Disconnected += new Server.ServerDisconnectedHandler(this.ServerDisconnected);
}
public void SetLoginData(string name, string password, string serverPassword = "")
{
this.loginName = name;
this.loginPassword = password;
this.serverPassword = serverPassword;
}
public void ServerDisconnected(object handle)
{
}
private void LoadServerInfoList()
{
// TODO no implement
}
}
}
|
unlicense
|
C#
|
d327720370475476e27182309d97dfc67158c923
|
Add comments
|
YallaDotNet/syslog
|
Core/Transport/ISyslogMessageSender.cs
|
Core/Transport/ISyslogMessageSender.cs
|
using System;
using System.Collections.Generic;
using SyslogNet.Client.Serialization;
namespace SyslogNet.Client.Transport
{
/// <summary>
/// Message sender.
/// </summary>
public interface ISyslogMessageSender : IDisposable
{
/// <summary>
/// Connects to the remote host.
/// </summary>
void Connect();
/// <summary>
/// Disconnects from the remote host.
/// </summary>
void Disconnect();
/// <summary>
/// Reconnects to the remote host.
/// </summary>
void Reconnect();
/// <summary>
/// Sends a message.
/// </summary>
/// <param name="message">Message.</param>
/// <param name="serializer">Serializer.</param>
void Send(SyslogMessage message, ISyslogMessageSerializer serializer);
/// <summary>
/// Sends a collection of messages.
/// </summary>
/// <param name="messages">Messages.</param>
/// <param name="serializer">Serializer.</param>
void Send(IEnumerable<SyslogMessage> messages, ISyslogMessageSerializer serializer);
}
}
|
using System;
using System.Collections.Generic;
using SyslogNet.Client.Serialization;
namespace SyslogNet.Client.Transport
{
public interface ISyslogMessageSender : IDisposable
{
void Connect();
void Disconnect();
void Reconnect();
void Send(SyslogMessage message, ISyslogMessageSerializer serializer);
void Send(IEnumerable<SyslogMessage> messages, ISyslogMessageSerializer serializer);
}
}
|
mit
|
C#
|
f59d2307835b44f39a9bb693cc99dc639231e6f8
|
set an expires date, so that the cookie does not expire immediatly in IE11.
|
AlejandroCano/extensions,signumsoftware/extensions,MehdyKarimpour/extensions,signumsoftware/framework,signumsoftware/framework,signumsoftware/extensions,MehdyKarimpour/extensions,AlejandroCano/extensions
|
Signum.React.Extensions/Translation/CulturesController.cs
|
Signum.React.Extensions/Translation/CulturesController.cs
|
using System;
using Signum.Engine;
using Signum.Engine.Authorization;
using Signum.Engine.Basics;
using Signum.Engine.Operations;
using Signum.Entities;
using Signum.Entities.Authorization;
using Signum.Entities.Basics;
using Signum.React.Filters;
using Signum.Utilities;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Http;
namespace Signum.React.Translation
{
[ValidateModelFilter]
public class CultureController : ControllerBase
{
IHostingEnvironment _env;
public CultureController(IHostingEnvironment env)
{
_env = env;
}
[HttpGet("api/culture/cultures"), AllowAnonymous]
public List<CultureInfoEntity> GetCultures()
{
return CultureInfoLogic.CultureInfoToEntity.Value.Values.ToList();
}
[HttpGet("api/culture/currentCulture"), AllowAnonymous]
public CultureInfoEntity CurrentCulture()
{
return CultureInfo.CurrentCulture.TryGetCultureInfoEntity() ?? CultureInfoLogic.CultureInfoToEntity.Value.Values.FirstEx();
}
[HttpPost("api/culture/setCurrentCulture"), AllowAnonymous]
public string SetCurrentCulture([Required, FromBody]Lite<CultureInfoEntity> culture)
{
var ci = ExecutionMode.Global().Using(_ => culture.Retrieve().ToCultureInfo());
if (UserEntity.Current != null && !UserEntity.Current.Is(AuthLogic.AnonymousUser)) //Won't be used till next refresh
{
var user = UserEntity.Current.ToLite().Retrieve();
user.CultureInfo = culture.Retrieve();
using (AuthLogic.Disable())
using (OperationLogic.AllowSave<UserEntity>())
{
UserEntity.Current = user;
user.Save();
}
}
ControllerContext.HttpContext.Response.Cookies.Append("language", ci.Name, new CookieOptions
{
Expires = DateTimeOffset.MaxValue
});
return ci.Name;
}
}
}
|
using Signum.Engine;
using Signum.Engine.Authorization;
using Signum.Engine.Basics;
using Signum.Engine.Operations;
using Signum.Entities;
using Signum.Entities.Authorization;
using Signum.Entities.Basics;
using Signum.React.Filters;
using Signum.Utilities;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using System.ComponentModel.DataAnnotations;
namespace Signum.React.Translation
{
[ValidateModelFilter]
public class CultureController : ControllerBase
{
IHostingEnvironment _env;
public CultureController(IHostingEnvironment env)
{
_env = env;
}
[HttpGet("api/culture/cultures"), AllowAnonymous]
public List<CultureInfoEntity> GetCultures()
{
return CultureInfoLogic.CultureInfoToEntity.Value.Values.ToList();
}
[HttpGet("api/culture/currentCulture"), AllowAnonymous]
public CultureInfoEntity CurrentCulture()
{
return CultureInfo.CurrentCulture.TryGetCultureInfoEntity() ?? CultureInfoLogic.CultureInfoToEntity.Value.Values.FirstEx();
}
[HttpPost("api/culture/setCurrentCulture"), AllowAnonymous]
public string SetCurrentCulture([Required, FromBody]Lite<CultureInfoEntity> culture)
{
var ci = ExecutionMode.Global().Using(_ => culture.Retrieve().ToCultureInfo());
if (UserEntity.Current != null && !UserEntity.Current.Is(AuthLogic.AnonymousUser)) //Won't be used till next refresh
{
var user = UserEntity.Current.ToLite().Retrieve();
user.CultureInfo = culture.Retrieve();
using (AuthLogic.Disable())
using (OperationLogic.AllowSave<UserEntity>())
{
UserEntity.Current = user;
user.Save();
}
}
ControllerContext.HttpContext.Response.Cookies.Append("language", ci.Name);
return ci.Name;
}
}
}
|
mit
|
C#
|
aeb897bf168703f1d66b89ec4a61ac8a1ecd7b53
|
Format code
|
Weingartner/SolidworksAddinFramework
|
SolidworksAddinFramework/RevertiblePropertyManagerPage.cs
|
SolidworksAddinFramework/RevertiblePropertyManagerPage.cs
|
using System.Collections.Generic;
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
namespace SolidworksAddinFramework
{
/// <summary>
/// This page works with live Data. Changes made in the
/// UI are immediately reflected in the object passed
/// in. If OnCancel is called then the live data is reverte
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class RevertiblePropertyManagerPage<T> : ReactiveObjectPropertyManagerPageBase<T>
where T : ReactiveUI.ReactiveObject
{
private T _Original;
protected RevertiblePropertyManagerPage(
string name,
IEnumerable<swPropertyManagerPageOptions_e> optionsE,
IModelDoc2 modelDoc,
T data) : base(name, optionsE, modelDoc, data)
{
}
protected override void OnShow()
{
CloneData();
}
protected override void OnCancel()
{
using (Data.DelayChangeNotifications())
{
Json.Copy(_Original, Data);
}
}
protected override void OnCommit()
{
CloneData();
}
private void CloneData()
{
_Original = Json.Clone(Data);
}
}
}
|
using System.Collections.Generic;
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
namespace SolidworksAddinFramework
{
/// <summary>
/// This page works with live Data. Changes made in the
/// UI are immediately reflected in the object passed
/// in. If OnCancel is called then the live data is reverte
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class RevertiblePropertyManagerPage<T> : ReactiveObjectPropertyManagerPageBase<T>
where T : ReactiveUI.ReactiveObject
{
private T _Original;
protected RevertiblePropertyManagerPage
(string name
, IEnumerable<swPropertyManagerPageOptions_e> optionsE
, ISldWorks swApp
, IModelDoc2 modelDoc
, T data) : base(name, optionsE, modelDoc, data)
{
}
protected override void OnShow()
{
CloneData();
}
protected override void OnCancel()
{
using (Data.DelayChangeNotifications())
{
Json.Copy(_Original, Data);
}
}
protected override void OnCommit()
{
CloneData();
}
private void CloneData()
{
_Original = Json.Clone(Data);
}
}
}
|
mit
|
C#
|
088d6fe78147e1ad30d84936bd8e3c3b72f6703d
|
Fix compile error with removed brush cache
|
PowerOfCode/Eto,l8s/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,PowerOfCode/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,l8s/Eto,l8s/Eto
|
Source/Eto.Platform.Wpf/Forms/Controls/GroupBoxHandler.cs
|
Source/Eto.Platform.Wpf/Forms/Controls/GroupBoxHandler.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using swc = System.Windows.Controls;
using sw = System.Windows;
using swd = System.Windows.Data;
using swm = System.Windows.Media;
using Eto.Forms;
using Eto.Drawing;
using Eto.Platform.Wpf.Drawing;
namespace Eto.Platform.Wpf.Forms.Controls
{
public class GroupBoxHandler : WpfContainer<swc.GroupBox, GroupBox>, IGroupBox
{
Font font;
public GroupBoxHandler ()
{
Control = new swc.GroupBox ();
}
public override Size ClientSize
{
get { return this.Size; }
set
{
// TODO
this.Size = value;
}
}
public override object ContainerObject
{
get { return Control; }
}
public override void SetLayout (Layout layout)
{
Control.Content = (System.Windows.UIElement)layout.ControlObject;
}
public override Color BackgroundColor
{
get
{
var brush = Control.Background as swm.SolidColorBrush;
if (brush != null) return brush.Color.ToEto ();
else return Colors.Black;
}
set
{
Control.Background = new swm.SolidColorBrush (value.ToWpf ());
}
}
public Font Font
{
get { return font; }
set
{
font = value;
FontHandler.Apply (Control, font);
}
}
public override Size? MinimumSize
{
get
{
if (Control.MinHeight == 0 && Control.MinWidth == 0)
return null;
return new Eto.Drawing.Size ((int)Control.MinHeight, (int)Control.MinWidth);
}
set
{
if (value != null) {
Control.MinHeight = value.Value.Height;
Control.MinWidth = value.Value.Width;
}
else
Control.MinWidth = Control.MinHeight = 0;
}
}
public string Text
{
get { return Control.Header as string; }
set { Control.Header = value; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using swc = System.Windows.Controls;
using sw = System.Windows;
using swd = System.Windows.Data;
using swm = System.Windows.Media;
using Eto.Forms;
using Eto.Drawing;
using Eto.Platform.Wpf.Drawing;
using Eto.Cache;
namespace Eto.Platform.Wpf.Forms.Controls
{
public class GroupBoxHandler : WpfContainer<swc.GroupBox, GroupBox>, IGroupBox
{
Font font;
public GroupBoxHandler ()
{
Control = new swc.GroupBox ();
}
public override Size ClientSize
{
get { return this.Size; }
set
{
// TODO
this.Size = value;
}
}
public override object ContainerObject
{
get { return Control; }
}
public override void SetLayout (Layout layout)
{
Control.Content = (System.Windows.UIElement)layout.ControlObject;
}
public override Color BackgroundColor
{
get
{
var brush = Control.Background as swm.SolidColorBrush;
if (brush != null) return brush.Color.ToEto ();
else return Colors.Black;
}
set
{
Control.Background = BrushCache.GetBrush(this.Generator, value).ControlObject as swm.Brush;
}
}
public Font Font
{
get { return font; }
set
{
font = value;
FontHandler.Apply (Control, font);
}
}
public override Size? MinimumSize
{
get
{
if (Control.MinHeight == 0 && Control.MinWidth == 0)
return null;
return new Eto.Drawing.Size ((int)Control.MinHeight, (int)Control.MinWidth);
}
set
{
if (value != null) {
Control.MinHeight = value.Value.Height;
Control.MinWidth = value.Value.Width;
}
else
Control.MinWidth = Control.MinHeight = 0;
}
}
public string Text
{
get { return Control.Header as string; }
set { Control.Header = value; }
}
}
}
|
bsd-3-clause
|
C#
|
fed5c2549d4738ef5a5037142e4fb30a4c331639
|
Fix to build with Beta 2.
|
rockfordlhotka/csla,MarimerLLC/csla,JasonBock/csla,ronnymgm/csla-light,BrettJaner/csla,MarimerLLC/csla,JasonBock/csla,jonnybee/csla,jonnybee/csla,JasonBock/csla,ronnymgm/csla-light,rockfordlhotka/csla,MarimerLLC/csla,BrettJaner/csla,jonnybee/csla,BrettJaner/csla,rockfordlhotka/csla,ronnymgm/csla-light
|
Source/Csla.Web.Mvc/CslaModelBinder.cs
|
Source/Csla.Web.Mvc/CslaModelBinder.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace Csla.Web.Mvc
{
/// <summary>
/// Model binder for use with CSLA .NET editable business
/// objects.
/// </summary>
public class CslaModelBinder : DefaultModelBinder
{
/// <summary>
/// Creates an instance of the model if the controller implements
/// IModelCreator.
/// </summary>
/// <param name="controllerContext">Controller context</param>
/// <param name="bindingContext">Binding context</param>
/// <param name="modelType">Type of model object</param>
protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)
{
var controller = controllerContext.Controller as IModelCreator;
if (controller != null)
return controller.CreateModel(modelType);
else
return base.CreateModel(controllerContext, bindingContext, modelType);
}
/// <summary>
/// Checks the validation rules for properties
/// after the Model has been updated.
/// </summary>
/// <param name="controllerContext">Controller context</param>
/// <param name="bindingContext">Binding context</param>
protected override void OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
var obj = bindingContext.Model as Csla.Core.BusinessBase;
if (obj != null)
{
var errors = from r in obj.BrokenRulesCollection
where r.Severity == Csla.Validation.RuleSeverity.Error
select r;
foreach (var item in errors)
{
bindingContext.ModelState.AddModelError(item.Property, item.Description);
//bindingContext.ModelState.SetModelValue(item.Property, bindingContext.ValueProvider.GetValue(controllerContext, item.Property));
bindingContext.ModelState.SetModelValue(item.Property, bindingContext.ValueProvider[item.Property]);
}
}
else
base.OnModelUpdated(controllerContext, bindingContext);
}
/// <summary>
/// Prevents IDataErrorInfo validation from
/// operating against editable objects.
/// </summary>
/// <param name="controllerContext">Controller context</param>
/// <param name="bindingContext">Binding context</param>
/// <param name="propertyDescriptor">Property descriptor</param>
/// <param name="value">Value</param>
protected override void OnPropertyValidated(ControllerContext controllerContext, ModelBindingContext bindingContext, System.ComponentModel.PropertyDescriptor propertyDescriptor, object value)
{
if (!(bindingContext.Model is Csla.Core.BusinessBase))
base.OnPropertyValidated(controllerContext, bindingContext, propertyDescriptor, value);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace Csla.Web.Mvc
{
/// <summary>
/// Model binder for use with CSLA .NET editable business
/// objects.
/// </summary>
public class CslaModelBinder : DefaultModelBinder
{
/// <summary>
/// Creates an instance of the model if the controller implements
/// IModelCreator.
/// </summary>
/// <param name="controllerContext">Controller context</param>
/// <param name="bindingContext">Binding context</param>
/// <param name="modelType">Type of model object</param>
protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)
{
var controller = controllerContext.Controller as IModelCreator;
if (controller != null)
return controller.CreateModel(modelType);
else
return base.CreateModel(controllerContext, bindingContext, modelType);
}
/// <summary>
/// Checks the validation rules for properties
/// after the Model has been updated.
/// </summary>
/// <param name="controllerContext">Controller context</param>
/// <param name="bindingContext">Binding context</param>
protected override void OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
var obj = bindingContext.Model as Csla.Core.BusinessBase;
if (obj != null)
{
var errors = from r in obj.BrokenRulesCollection
where r.Severity == Csla.Validation.RuleSeverity.Error
select r;
foreach (var item in errors)
{
bindingContext.ModelState.AddModelError(item.Property, item.Description);
bindingContext.ModelState.SetModelValue(item.Property, bindingContext.ValueProvider.GetValue(controllerContext, item.Property));
//bindingContext.ModelState.SetModelValue(item.Property, bindingContext.ValueProvider[item.Property]);
}
}
else
base.OnModelUpdated(controllerContext, bindingContext);
}
/// <summary>
/// Prevents IDataErrorInfo validation from
/// operating against editable objects.
/// </summary>
/// <param name="controllerContext">Controller context</param>
/// <param name="bindingContext">Binding context</param>
/// <param name="propertyDescriptor">Property descriptor</param>
/// <param name="value">Value</param>
protected override void OnPropertyValidated(ControllerContext controllerContext, ModelBindingContext bindingContext, System.ComponentModel.PropertyDescriptor propertyDescriptor, object value)
{
if (!(bindingContext.Model is Csla.Core.BusinessBase))
base.OnPropertyValidated(controllerContext, bindingContext, propertyDescriptor, value);
}
}
}
|
mit
|
C#
|
5d154b2c7231950a840253a297fe439146e19258
|
Optimize edges' GetHashCode method
|
MSayfullin/Basics
|
Basics.Structures/Graphs/Edge.cs
|
Basics.Structures/Graphs/Edge.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Basics.Structures.Graphs
{
[DebuggerDisplay("{Source}->{Target}")]
public class Edge<T> : IEquatable<Edge<T>> where T : IEquatable<T>
{
private readonly Lazy<int> _hashCode;
public Edge(T source, T target)
{
Source = source;
Target = target;
_hashCode = new Lazy<int>(() =>
{
var sourceHashCode = Source.GetHashCode();
return ((sourceHashCode << 5) + sourceHashCode) ^ Target.GetHashCode();
});
}
public T Source { get; private set; }
public T Target { get; private set; }
public bool IsSelfLooped
{
get { return Source.Equals(Target); }
}
public static bool operator ==(Edge<T> a, Edge<T> b)
{
return a.Equals(b);
}
public static bool operator !=(Edge<T> a, Edge<T> b)
{
return !a.Equals(b);
}
public bool Equals(Edge<T> other)
{
return
!Object.ReferenceEquals(other, null)
&& this.Source.Equals(other.Source)
&& this.Target.Equals(other.Target);
}
public override bool Equals(object obj)
{
return Equals(obj as Edge<T>);
}
public override int GetHashCode()
{
return _hashCode.Value;
}
public override string ToString()
{
return Source + "->" + Target;
}
}
}
|
using System;
using System.Diagnostics;
namespace Basics.Structures.Graphs
{
[DebuggerDisplay("{Source}->{Target}")]
public class Edge<T> : IEquatable<Edge<T>> where T : IEquatable<T>
{
public Edge(T source, T target)
{
Source = source;
Target = target;
}
public T Source { get; private set; }
public T Target { get; private set; }
public bool IsSelfLooped
{
get { return Source.Equals(Target); }
}
public static bool operator ==(Edge<T> a, Edge<T> b)
{
return a.Equals(b);
}
public static bool operator !=(Edge<T> a, Edge<T> b)
{
return !a.Equals(b);
}
public bool Equals(Edge<T> other)
{
return
!Object.ReferenceEquals(other, null)
&& this.Source.Equals(other.Source)
&& this.Target.Equals(other.Target);
}
public override bool Equals(object obj)
{
return Equals(obj as Edge<T>);
}
public override int GetHashCode()
{
return Source.GetHashCode() ^ Target.GetHashCode();
}
public override string ToString()
{
return Source + "->" + Target;
}
}
}
|
mit
|
C#
|
e95fa2d8d5d966cbf1cec7898b258c64c2a86e0b
|
update test
|
martinlindhe/Punku
|
PunkuTests/Strings/Shift.cs
|
PunkuTests/Strings/Shift.cs
|
using System;
using NUnit.Framework;
using Punku;
[TestFixture]
[Category ("Strings")]
public class Strings_Shift
{
[Test]
public void Test01 ()
{
Assert.AreEqual (Punku.Strings.Shift.ShiftString ("qrpgle.kyicrpylq()", 2), "string.maketrans()");
}
[Test]
public void Test02 ()
{
Assert.AreEqual (Punku.Strings.Shift.ShiftString ("rpylqjyrc", 2), "translate");
}
}
|
using System;
using NUnit.Framework;
using Punku;
[TestFixture]
[Category ("Strings")]
public class Strings_Shift
{
[Test]
public void Test01 ()
{
Assert.AreEqual (Punku.Strings.Shift.ShiftLetters ("qrpgle.kyicrpylq()", 2), "string.maketrans()");
}
[Test]
public void Test02 ()
{
Assert.AreEqual (Punku.Strings.Shift.ShiftLetters ("rpylqjyrc", 2), "translate");
}
}
|
mit
|
C#
|
5ffd3ff82acbf76acc91accf666b76ab1255b3e1
|
Add xmldoc and allow constructing an `AssemblyRulesetStore` with a directory path
|
ppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu
|
osu.Game/Rulesets/AssemblyRulesetStore.cs
|
osu.Game/Rulesets/AssemblyRulesetStore.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Platform;
#nullable enable
namespace osu.Game.Rulesets
{
/// <summary>
/// A ruleset store that populates from loaded assemblies (and optionally, assemblies in a storage).
/// </summary>
public class AssemblyRulesetStore : RulesetStore
{
public override IEnumerable<RulesetInfo> AvailableRulesets => availableRulesets;
private readonly List<RulesetInfo> availableRulesets = new List<RulesetInfo>();
/// <summary>
/// Create an assembly ruleset store that populates from loaded assemblies and an external location.
/// </summary>
/// <param name="path">An path containing ruleset DLLs.</param>
public AssemblyRulesetStore(string path)
: this(new NativeStorage(path))
{
}
/// <summary>
/// Create an assembly ruleset store that populates from loaded assemblies and an optional storage source.
/// </summary>
/// <param name="storage">An optional storage containing ruleset DLLs.</param>
public AssemblyRulesetStore(Storage? storage = null)
: base(storage)
{
List<Ruleset> instances = LoadedAssemblies.Values
.Select(r => Activator.CreateInstance(r) as Ruleset)
.Where(r => r != null)
.Select(r => r.AsNonNull())
.ToList();
// add all legacy rulesets first to ensure they have exclusive choice of primary key.
foreach (var r in instances.Where(r => r is ILegacyRuleset))
availableRulesets.Add(new RulesetInfo(r.RulesetInfo.ShortName, r.RulesetInfo.Name, r.RulesetInfo.InstantiationInfo, r.RulesetInfo.OnlineID));
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Platform;
#nullable enable
namespace osu.Game.Rulesets
{
public class AssemblyRulesetStore : RulesetStore
{
public override IEnumerable<RulesetInfo> AvailableRulesets => availableRulesets;
private readonly List<RulesetInfo> availableRulesets = new List<RulesetInfo>();
public AssemblyRulesetStore(Storage? storage = null)
: base(storage)
{
List<Ruleset> instances = LoadedAssemblies.Values
.Select(r => Activator.CreateInstance(r) as Ruleset)
.Where(r => r != null)
.Select(r => r.AsNonNull())
.ToList();
// add all legacy rulesets first to ensure they have exclusive choice of primary key.
foreach (var r in instances.Where(r => r is ILegacyRuleset))
availableRulesets.Add(new RulesetInfo(r.RulesetInfo.ShortName, r.RulesetInfo.Name, r.RulesetInfo.InstantiationInfo, r.RulesetInfo.OnlineID));
}
}
}
|
mit
|
C#
|
653be3b88bd8f6758ad5e7d02419bc3db9c9e2e0
|
Fix crashes when server is turned off
|
LibertyLocked/webscripthook,LibertyLocked/webscripthook,LibertyLocked/webscripthook,LibertyLocked/webscripthook
|
VStats-plugin/MainScript.cs
|
VStats-plugin/MainScript.cs
|
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using GTA;
using Newtonsoft.Json;
namespace VStats_plugin
{
class MainScript : Script
{
private readonly string url;
//private SemaphoreSlim PostDataSemaphore = new SemaphoreSlim(1, 1);
Object lockThis = new Object();
bool isStopped;
GameData cacheData;
public MainScript()
{
// SETUP
var settings = ScriptSettings.Load(@".\scripts\VStats-plugin.ini");
string port = settings.GetValue("Core", "PORT", "8080");
url = "http://localhost:" + port + "/push";
this.isStopped = true;
this.Tick += OnTick;
}
private void OnTick(object sender, EventArgs e)
{
if (isStopped)
{
Thread workerThread = new Thread(ThreadProc_PostJSON);
workerThread.Start();
}
cacheData = GameData.GetData();
//ThreadProc_PostJSON();
}
private void ThreadProc_PostJSON()
{
lock (lockThis)
{
isStopped = false;
try
{
using (var client = new WebClient())
{
var values = new NameValueCollection();
values["d"] = JsonConvert.SerializeObject(cacheData);
client.UploadValues(url, values);
}
}
catch
{
Thread.Sleep(100);
//throw;
}
isStopped = true;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using GTA;
using Newtonsoft.Json;
namespace VStats_plugin
{
class MainScript : Script
{
private readonly string url;
//private SemaphoreSlim PostDataSemaphore = new SemaphoreSlim(1, 1);
Object lockThis = new Object();
bool isStopped;
GameData cacheData;
public MainScript()
{
// SETUP
var settings = ScriptSettings.Load(@".\scripts\VStats-plugin.ini");
string port = settings.GetValue("Core", "PORT", "8080");
url = "http://localhost:" + port + "/push";
this.isStopped = true;
this.Tick += OnTick;
}
private void OnTick(object sender, EventArgs e)
{
if (isStopped)
{
Thread workerThread = new Thread(ThreadProc_PostJSON);
workerThread.Start();
}
cacheData = GameData.GetData();
//ThreadProc_PostJSON();
}
private void ThreadProc_PostJSON()
{
lock (lockThis)
{
isStopped = false;
try
{
using (var client = new WebClient())
{
var values = new NameValueCollection();
values["d"] = JsonConvert.SerializeObject(cacheData);
client.UploadValues(url, values);
}
}
catch
{
//Thread.Sleep(100);
throw new Exception(url);
}
isStopped = true;
}
}
}
}
|
mit
|
C#
|
6b2416feb0934de94d446ab0bc82b50b486015d4
|
Update copyright year in template
|
codingteam/codingteam.org.ru,codingteam/codingteam.org.ru
|
Views/Shared/_Layout.cshtml
|
Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<title>@ViewData["Title"]</title>
<link rel="icon" type="image/png" href="favicon.png">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="~/style.css"/>
</head>
<body>
<div class="container">
<header>
<nav class="navbar navbar-default">
<a class="navbar-brand" href="~/"><img src="images/logo-transparent-dark.svg"/></a>
<ul class="nav navbar-nav">
<li><a href="~/">Logs</a></li>
<li><a href="~/resources">Resources</a>
</ul>
</nav>
</header>
<div id="main" role="main">
@RenderBody()
</div>
<footer>© 2019 <a href="https://github.com/codingteam/codingteam.org.ru">codingteam</a></footer>
</div>
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<title>@ViewData["Title"]</title>
<link rel="icon" type="image/png" href="favicon.png">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="~/style.css"/>
</head>
<body>
<div class="container">
<header>
<nav class="navbar navbar-default">
<a class="navbar-brand" href="~/"><img src="images/logo-transparent-dark.svg"/></a>
<ul class="nav navbar-nav">
<li><a href="~/">Logs</a></li>
<li><a href="~/resources">Resources</a>
</ul>
</nav>
</header>
<div id="main" role="main">
@RenderBody()
</div>
<footer>© 2014–2018 <a href="https://github.com/codingteam/codingteam.org.ru">codingteam</a></footer>
</div>
</body>
</html>
|
mit
|
C#
|
4e12a2734ccf28dae236d6c78385e79d69bf32d7
|
Remove ignore attribute from now fixed test scene
|
smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,peppy/osu,smoogipooo/osu,ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,UselessToucan/osu,UselessToucan/osu
|
osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs
|
osu.Game.Rulesets.Catch.Tests/TestSceneCatchPlayerLegacySkin.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Screens.Play.HUD;
using osu.Game.Skinning;
using osu.Game.Tests.Visual;
using osuTK;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestSceneCatchPlayerLegacySkin : LegacySkinPlayerTestScene
{
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
[Test]
public void TestLegacyHUDComboCounterHidden([Values] bool withModifiedSkin)
{
if (withModifiedSkin)
{
AddStep("change component scale", () => Player.ChildrenOfType<LegacyScoreCounter>().First().Scale = new Vector2(2f));
AddStep("update target", () => Player.ChildrenOfType<SkinnableTargetContainer>().ForEach(LegacySkin.UpdateDrawableTarget));
AddStep("exit player", () => Player.Exit());
CreateTest(null);
}
AddAssert("legacy HUD combo counter hidden", () =>
{
return Player.ChildrenOfType<LegacyComboCounter>().All(c => c.ChildrenOfType<Container>().Single().Alpha == 0f);
});
}
}
}
|
// 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.Linq;
using NUnit.Framework;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Screens.Play.HUD;
using osu.Game.Skinning;
using osu.Game.Tests.Visual;
using osuTK;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestSceneCatchPlayerLegacySkin : LegacySkinPlayerTestScene
{
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
[Test]
[Ignore("HUD components broken, remove when fixed.")]
public void TestLegacyHUDComboCounterHidden([Values] bool withModifiedSkin)
{
if (withModifiedSkin)
{
AddStep("change component scale", () => Player.ChildrenOfType<LegacyScoreCounter>().First().Scale = new Vector2(2f));
AddStep("update target", () => Player.ChildrenOfType<SkinnableTargetContainer>().ForEach(LegacySkin.UpdateDrawableTarget));
AddStep("exit player", () => Player.Exit());
CreateTest(null);
}
AddAssert("legacy HUD combo counter hidden", () =>
{
return Player.ChildrenOfType<LegacyComboCounter>().All(c => !c.ChildrenOfType<Container>().Single().IsPresent);
});
}
}
}
|
mit
|
C#
|
95743e724cc1af58eb85bd45a048cbddcaf70757
|
add unary button
|
neuecc/MagicOnion
|
samples/ChatApp/ChatApp.Server/Program.cs
|
samples/ChatApp/ChatApp.Server/Program.cs
|
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using Grpc.Core;
using MagicOnion.Hosting;
using MagicOnion.OpenTelemetry;
using MagicOnion.Server;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using OpenTelemetry.Exporter.Prometheus;
using OpenTelemetry.Stats;
using OpenTelemetry.Tags;
using OpenTelemetry.Trace;
using OpenTelemetry.Trace.Sampler;
namespace ChatApp.Server
{
class Program
{
static async Task Main(string[] args)
{
GrpcEnvironment.SetLogger(new Grpc.Core.Logging.ConsoleLogger());
var config = new ConfigurationBuilder().AddEnvironmentVariables().Build();
var exporterHost = config.GetValue<string>("PROMETHEUS_EXPORTER_HOST", "localhost");
var exporterPort = config.GetValue<string>("PROMETHEUS_EXPORTER_PORT", "9182");
var exporter = new PrometheusExporter(
new PrometheusExporterOptions()
{
// put exporterHost "+" to listen to all hostnames and 0.0.0.0.
Url = $"http://{exporterHost}:{exporterPort}/metrics/",
},
Stats.ViewManager);
exporter.Start();
await MagicOnionHost.CreateDefaultBuilder(useSimpleConsoleLogger: true)
.ConfigureServices(collection =>
{
collection.AddSingleton<ITracer>(Tracing.Tracer);
collection.AddSingleton<ISampler>(Samplers.AlwaysSample);
})
.UseMagicOnion(
new MagicOnionOptions()
{
GlobalFilters = new[] { new OpenTelemetryCollectorFilter(null) },
GlobalStreamingHubFilters = new[] { new OpenTelemetryHubCollectorFilter(null) },
MagicOnionLogger = new OpenTelemetryCollectorLogger(Stats.StatsRecorder, Tags.Tagger)
},
new ServerPort(config.GetValue<string>("MAGICONION_HOST", "127.0.0.1"), 12345, ServerCredentials.Insecure))
.RunConsoleAsync();
}
}
}
|
using System.Threading.Tasks;
using Grpc.Core;
using MagicOnion.Hosting;
using MagicOnion.OpenTelemetry;
using MagicOnion.Server;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using OpenTelemetry.Exporter.Prometheus;
using OpenTelemetry.Stats;
using OpenTelemetry.Tags;
using OpenTelemetry.Trace;
using OpenTelemetry.Trace.Sampler;
namespace ChatApp.Server
{
class Program
{
static async Task Main(string[] args)
{
GrpcEnvironment.SetLogger(new Grpc.Core.Logging.ConsoleLogger());
var exporter = new PrometheusExporter(
new PrometheusExporterOptions()
{
Url = "http://localhost:9185/metrics/", // "+" is a wildcard used to listen to all hostnames
},
Stats.ViewManager);
exporter.Start();
await MagicOnionHost.CreateDefaultBuilder(useSimpleConsoleLogger: true)
.ConfigureServices(collection =>
{
collection.AddSingleton<ITracer>(Tracing.Tracer);
collection.AddSingleton<ISampler>(Samplers.AlwaysSample);
})
.UseMagicOnion(
new MagicOnionOptions()
{
GlobalFilters = new[] { new OpenTelemetryCollectorFilter(null) },
GlobalStreamingHubFilters = new[] { new OpenTelemetryHubCollectorFilter(null) },
MagicOnionLogger = new OpenTelemetryCollectorLogger(Stats.StatsRecorder, Tags.Tagger)
},
new ServerPort("localhost", 12345, ServerCredentials.Insecure))
.RunConsoleAsync();
}
}
}
|
mit
|
C#
|
bfd0b35213f6ec4eab6ebeed1c210116d8823b15
|
Add logging of Widget's existence.
|
timtmok/ktanemod-twofactor,timtmok/ktanemod-twofactor
|
Assets/Scripts/TwoFactorWidget.cs
|
Assets/Scripts/TwoFactorWidget.cs
|
using System.Collections.Generic;
using Newtonsoft.Json;
using UnityEngine;
using Random = UnityEngine.Random;
public class TwoFactorWidget : MonoBehaviour
{
public TextMesh KeyText;
public AudioClip Notify;
private int _key;
private float _timeElapsed;
private const float TimerLength = 60.0f;
public static string WidgetQueryTwofactor = "twofactor";
public static string WidgetTwofactorKey = "twofactor_key";
void Awake ()
{
Debug.Log("[TwoFactorWidget] Two Factor present");
GetComponent<KMWidget>().OnQueryRequest += GetQueryResponse;
GetComponent<KMWidget>().OnWidgetActivate += Activate;
GenerateKey();
}
void Update()
{
_timeElapsed += Time.deltaTime;
// ReSharper disable once InvertIf
if (_timeElapsed >= TimerLength)
{
_timeElapsed = 0f;
UpdateKey();
}
}
private void Activate()
{
_timeElapsed = 0f;
DisplayKey();
}
void UpdateKey()
{
GetComponent<KMAudio>().HandlePlaySoundAtTransform(Notify.name, transform);
GenerateKey();
DisplayKey();
}
private void GenerateKey()
{
_key = Random.Range(0, 1000000);
}
private void DisplayKey()
{
KeyText.text = _key.ToString() + ".";
}
private string GetQueryResponse(string querykey, string queryinfo)
{
if (querykey != WidgetQueryTwofactor) return string.Empty;
var response = new Dictionary<string, int> {{WidgetTwofactorKey, _key}};
var serializedResponse = JsonConvert.SerializeObject(response);
return serializedResponse;
}
}
|
using System.Collections.Generic;
using Newtonsoft.Json;
using UnityEngine;
using Random = UnityEngine.Random;
public class TwoFactorWidget : MonoBehaviour
{
public TextMesh KeyText;
public AudioClip Notify;
private int _key;
private float _timeElapsed;
private const float TimerLength = 60.0f;
public static string WidgetQueryTwofactor = "twofactor";
public static string WidgetTwofactorKey = "twofactor_key";
void Awake ()
{
GetComponent<KMWidget>().OnQueryRequest += GetQueryResponse;
GetComponent<KMWidget>().OnWidgetActivate += Activate;
GenerateKey();
}
void Update()
{
_timeElapsed += Time.deltaTime;
// ReSharper disable once InvertIf
if (_timeElapsed >= TimerLength)
{
_timeElapsed = 0f;
UpdateKey();
}
}
private void Activate()
{
_timeElapsed = 0f;
DisplayKey();
}
void UpdateKey()
{
GetComponent<KMAudio>().HandlePlaySoundAtTransform(Notify.name, transform);
GenerateKey();
DisplayKey();
}
private void GenerateKey()
{
_key = Random.Range(0, 1000000);
}
private void DisplayKey()
{
KeyText.text = _key.ToString() + ".";
}
private string GetQueryResponse(string querykey, string queryinfo)
{
if (querykey != WidgetQueryTwofactor) return string.Empty;
var response = new Dictionary<string, int> {{WidgetTwofactorKey, _key}};
var serializedResponse = JsonConvert.SerializeObject(response);
return serializedResponse;
}
}
|
mit
|
C#
|
055d95a2ce87f12a2e16227d183ef4c7d06d7e35
|
Undo API break.
|
florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho
|
Bindings/Portable/Actions/Node.cs
|
Bindings/Portable/Actions/Node.cs
|
using System;
using System.Threading.Tasks;
using Urho.Actions;
namespace Urho
{
partial class Node
{
/// <summary>
/// Runs an Action that can be awaited.
/// </summary>
/// <param name="action">A FiniteTimeAction.</param>
public Task<ActionState> RunActionsAsync(FiniteTimeAction action)
{
var tcs = new TaskCompletionSource<ActionState>();
ActionState state = null;
var completion = new CallFunc(() => tcs.TrySetResult(state));
var asyncAction = new Sequence(action, completion);
state = Application.Current.ActionManager.AddAction(asyncAction, this);
return tcs.Task;
}
/// <summary>
/// Runs a sequence of Actions so that it can be awaited.
/// </summary>
/// <param name="actions">An array of FiniteTimeAction objects.</param>
public Task<ActionState> RunActionsAsync(params FiniteTimeAction[] actions)
{
if (actions.Length == 0)
return Task.FromResult<ActionState>(null);
var tcs = new TaskCompletionSource<ActionState>();
ActionState state = null;
FiniteTimeAction completion = new CallFunc(() => tcs.TrySetResult(state));
var asyncAction = actions.Length > 0 ? new Sequence(actions, completion) : completion;
state = Application.Current.ActionManager.AddAction(asyncAction, this);
return tcs.Task;
}
public void RunActions(params FiniteTimeAction[] actions)
{
var action = actions.Length > 1 ? new Sequence(actions) : actions[0];
Application.Current.ActionManager.AddAction(action, this);
}
public void RemoveAction(ActionState state)
{
Application.Current.ActionManager.RemoveAction(state);
}
public void RemoveAction(BaseAction action)
{
Application.Current.ActionManager.RemoveAction(action, this);
}
public void RemoveAllActions()
{
Application.Current.ActionManager.RemoveAllActionsFromTarget(this);
}
public void PauseAllActions()
{
Application.Current.ActionManager.PauseTarget(this);
}
public void ResumeAllActions()
{
Application.Current.ActionManager.ResumeTarget(this);
}
}
}
|
using System;
using System.Threading.Tasks;
using Urho.Actions;
namespace Urho
{
partial class Node
{
/// <summary>
/// Runs an Action that can be awaited.
/// </summary>
/// <param name="action">A FiniteTimeAction.</param>
public Task<ActionState> RunActionsAsync(FiniteTimeAction action)
{
var tcs = new TaskCompletionSource<ActionState>();
ActionState state = null;
var completion = new CallFunc(() => tcs.TrySetResult(state));
var asyncAction = new Sequence(action, completion);
state = Application.Current.ActionManager.AddAction(asyncAction, this);
return tcs.Task;
}
/// <summary>
/// Runs a sequence of Actions so that it can be awaited.
/// </summary>
/// <param name="actions">An array of FiniteTimeAction objects.</param>
public Task<ActionState> RunActionsAsync(FiniteTimeAction[] actions)
{
if (actions.Length == 0)
return Task.FromResult<ActionState>(null);
var tcs = new TaskCompletionSource<ActionState>();
ActionState state = null;
FiniteTimeAction completion = new CallFunc(() => tcs.TrySetResult(state));
var asyncAction = actions.Length > 0 ? new Sequence(actions, completion) : completion;
state = Application.Current.ActionManager.AddAction(asyncAction, this);
return tcs.Task;
}
public void RunActions(params FiniteTimeAction[] actions)
{
var action = actions.Length > 1 ? new Sequence(actions) : actions[0];
Application.Current.ActionManager.AddAction(action, this);
}
public void RemoveAction(ActionState state)
{
Application.Current.ActionManager.RemoveAction(state);
}
public void RemoveAction(BaseAction action)
{
Application.Current.ActionManager.RemoveAction(action, this);
}
public void RemoveAllActions()
{
Application.Current.ActionManager.RemoveAllActionsFromTarget(this);
}
public void PauseAllActions()
{
Application.Current.ActionManager.PauseTarget(this);
}
public void ResumeAllActions()
{
Application.Current.ActionManager.ResumeTarget(this);
}
}
}
|
mit
|
C#
|
e5e6a7f4b4a73f40fb3ce6dde761c093d5c1e706
|
Test - use TraceLogger for BufferPoolTests
|
TrabacchinLuigi/dokan-dotnet,dokan-dev/dokan-dotnet,dokan-dev/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,dokan-dev/dokan-dotnet
|
DokanNet.Tests/BufferPoolTests.cs
|
DokanNet.Tests/BufferPoolTests.cs
|
using System;
using DokanNet.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DokanNet.Tests
{
/// <summary>
/// Tests for <see cref="BufferPool"/>.
/// </summary>
[TestClass]
public sealed class BufferPoolTests
{
/// <summary>
/// Rudimentary test for <see cref="BufferPool"/>.
/// </summary>
[TestMethod, TestCategory(TestCategories.Success)]
public void BufferPoolBasicTest()
{
BufferPool pool = new BufferPool();
ILogger logger = new TraceLogger();
// Verify buffer is pooled.
const int MB = 1024 * 1024;
byte[] buffer = pool.RentBuffer(MB, logger);
pool.ReturnBuffer(buffer, logger);
byte[] buffer2 = pool.RentBuffer(MB, logger);
Assert.AreSame(buffer, buffer2, "Expected recycling of 1 MB buffer.");
// Verify buffer that buffer not power of 2 is not pooled.
buffer = pool.RentBuffer(MB - 1, logger);
pool.ReturnBuffer(buffer, logger);
buffer2 = pool.RentBuffer(MB - 1, logger);
Assert.AreNotSame(buffer, buffer2, "Did not expect recycling of 1 MB - 1 byte buffer.");
// Run through a bunch of random buffer sizes and make sure we always get a buffer of the right size.
int seed = Environment.TickCount;
Console.WriteLine($"Random seed: {seed}");
Random random = new Random(seed);
for (int i = 0; i < 1000; i++)
{
int size = random.Next(0, 2 * MB);
buffer = pool.RentBuffer((uint)size, logger);
Assert.AreEqual(size, buffer.Length, "Wrong buffer size.");
pool.ReturnBuffer(buffer, logger);
}
}
}
}
|
using System;
using DokanNet.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DokanNet.Tests
{
/// <summary>
/// Tests for <see cref="BufferPool"/>.
/// </summary>
[TestClass]
public sealed class BufferPoolTests
{
/// <summary>
/// Rudimentary test for <see cref="BufferPool"/>.
/// </summary>
[TestMethod, TestCategory(TestCategories.Success)]
public void BufferPoolBasicTest()
{
BufferPool pool = new BufferPool();
ILogger logger = new ConsoleLogger();
// Verify buffer is pooled.
const int MB = 1024 * 1024;
byte[] buffer = pool.RentBuffer(MB, logger);
pool.ReturnBuffer(buffer, logger);
byte[] buffer2 = pool.RentBuffer(MB, logger);
Assert.AreSame(buffer, buffer2, "Expected recycling of 1 MB buffer.");
// Verify buffer that buffer not power of 2 is not pooled.
buffer = pool.RentBuffer(MB - 1, logger);
pool.ReturnBuffer(buffer, logger);
buffer2 = pool.RentBuffer(MB - 1, logger);
Assert.AreNotSame(buffer, buffer2, "Did not expect recycling of 1 MB - 1 byte buffer.");
// Run through a bunch of random buffer sizes and make sure we always get a buffer of the right size.
int seed = Environment.TickCount;
Console.WriteLine($"Random seed: {seed}");
Random random = new Random(seed);
for (int i = 0; i < 1000; i++)
{
int size = random.Next(0, 2 * MB);
buffer = pool.RentBuffer((uint)size, logger);
Assert.AreEqual(size, buffer.Length, "Wrong buffer size.");
pool.ReturnBuffer(buffer, logger);
}
}
}
}
|
mit
|
C#
|
7147aa41c0597721ad689e14e081952374a008f1
|
Revert develop purpose action
|
OrganizeSanayi/HospitalAutomation
|
HospitalAutomation.GUI/Program.cs
|
HospitalAutomation.GUI/Program.cs
|
using System;
using System.Windows.Forms;
namespace HospitalAutomation.GUI
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new LoginForm());
}
}
}
|
using System;
using System.Windows.Forms;
namespace HospitalAutomation.GUI
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormHomePage());
}
}
}
|
apache-2.0
|
C#
|
71156c6e8818fbefecac4ee2d31724df1bbcfe45
|
Fix create BitmapDecoder with async file stream.
|
lindexi/lindexi_gd,lindexi/lindexi_gd,lindexi/lindexi_gd,lindexi/lindexi_gd,lindexi/lindexi_gd
|
JemlemlacuLemjakarbabo/Program.cs
|
JemlemlacuLemjakarbabo/Program.cs
|
using System;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
namespace JemlemlacuLemjakarbabo
{
class Program
{
static void Main(string[] args)
{
CheckHResult(UnsafeNativeMethods.WICCodec.CreateImagingFactory(UnsafeNativeMethods.WICCodec.WINCODEC_SDK_VERSION,
out var pImagingFactory));
using var fs = new FileStream("image.jpg",
FileMode.Open,
FileAccess.Read,
FileShare.Read,
4096,
FileOptions.Asynchronous);
var stream = fs;
SafeFileHandle safeFilehandle
System.IO.FileStream filestream = stream as System.IO.FileStream;
try
{
if (filestream.IsAsync is false)
{
safeFilehandle = filestream.SafeFileHandle;
}
else
{
// If Filestream is async that doesn't support IWICImagingFactory_CreateDecoderFromFileHandle_Proxy, then revert to old code path.
safeFilehandle = null;
}
}
catch
{
// If Filestream doesn't support SafeHandle then revert to old code path.
// See https://github.com/dotnet/wpf/issues/4355
safeFilehandle = null;
}
Guid vendorMicrosoft = new Guid(MILGuidData.GUID_VendorMicrosoft);
UInt32 metadataFlags = (uint)WICMetadataCacheOptions.WICMetadataCacheOnDemand;
CheckHResult
(
UnsafeNativeMethods.WICImagingFactory.CreateDecoderFromFileHandle
(
pImagingFactory,
fs.SafeFileHandle,
ref vendorMicrosoft,
metadataFlags,
out var decoder
)
);
}
static void CheckHResult(int hr)
{
if (hr < 0)
{
Exception exceptionForHR = Marshal.GetExceptionForHR(hr, (IntPtr)(-1));
throw exceptionForHR;
}
}
}
}
|
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace JemlemlacuLemjakarbabo
{
class Program
{
static void Main(string[] args)
{
CheckHResult(UnsafeNativeMethods.WICCodec.CreateImagingFactory(UnsafeNativeMethods.WICCodec.WINCODEC_SDK_VERSION,
out var pImagingFactory));
using var fs = new FileStream("image.jpg",
FileMode.Open,
FileAccess.Read,
FileShare.Read,
4096,
FileOptions.Asynchronous);
Guid vendorMicrosoft = new Guid(MILGuidData.GUID_VendorMicrosoft);
UInt32 metadataFlags = (uint)WICMetadataCacheOptions.WICMetadataCacheOnDemand;
CheckHResult
(
UnsafeNativeMethods.WICImagingFactory.CreateDecoderFromFileHandle
(
pImagingFactory,
fs.SafeFileHandle,
ref vendorMicrosoft,
metadataFlags,
out var decoder
)
);
}
static void CheckHResult(int hr)
{
if (hr < 0)
{
Exception exceptionForHR = Marshal.GetExceptionForHR(hr, (IntPtr)(-1));
throw exceptionForHR;
}
}
}
}
|
mit
|
C#
|
9c6ce230bca4a6c131b3cd849cb888c610b7c85f
|
Fix compile error
|
EVAST9919/osu,johnneijzen/osu,ZLima12/osu,smoogipoo/osu,Drezi126/osu,peppy/osu-new,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,DrabWeb/osu,johnneijzen/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,Frontear/osuKyzer,Nabile-Rahmani/osu,tacchinotacchi/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,naoey/osu,ZLima12/osu,naoey/osu,Damnae/osu,smoogipooo/osu,DrabWeb/osu,EVAST9919/osu,osu-RP/osu-RP,DrabWeb/osu,ppy/osu,naoey/osu,ppy/osu,peppy/osu,UselessToucan/osu,2yangk23/osu
|
osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs
|
osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Graphics.Containers
{
public class ReverseDepthFillFlowContainer<T> : FillFlowContainer<T> where T : Drawable
{
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
protected override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.Reverse();
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Graphics.Containers
{
public class ReverseDepthFillFlowContainer<T> : FillFlowContainer<T> where T : Drawable
{
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
protected override IEnumerable<T> FlowingChildren => base.FlowingChildren.Reverse();
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.