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 |
---|---|---|---|---|---|---|---|---|
0ca78fb08ef1c53023cab7b05ef07ad3da41d1d6
|
bump version
|
Fody/Publicize
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Publicize")]
[assembly: AssemblyProduct("Publicize")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Publicize")]
[assembly: AssemblyProduct("Publicize")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.8.0.0")]
[assembly: AssemblyFileVersion("0.8.0.0")]
|
mit
|
C#
|
3f070e20ba49dbca8f6f80f9d1167c7d09f7e0b1
|
Print the sha which was excluded from version calculation
|
dazinator/GitVersion,GitTools/GitVersion,dpurge/GitVersion,JakeGinnivan/GitVersion,asbjornu/GitVersion,gep13/GitVersion,ermshiperete/GitVersion,onovotny/GitVersion,ParticularLabs/GitVersion,JakeGinnivan/GitVersion,gep13/GitVersion,JakeGinnivan/GitVersion,GitTools/GitVersion,ermshiperete/GitVersion,onovotny/GitVersion,asbjornu/GitVersion,dazinator/GitVersion,dpurge/GitVersion,ParticularLabs/GitVersion,onovotny/GitVersion,dpurge/GitVersion,ermshiperete/GitVersion,dpurge/GitVersion,ermshiperete/GitVersion,JakeGinnivan/GitVersion
|
src/GitVersionCore/VersionFilters/ShaVersionFilter.cs
|
src/GitVersionCore/VersionFilters/ShaVersionFilter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using GitVersion.VersionCalculation.BaseVersionCalculators;
namespace GitVersion.VersionFilters
{
public class ShaVersionFilter : IVersionFilter
{
private readonly IEnumerable<string> shas;
public ShaVersionFilter(IEnumerable<string> shas)
{
if (shas == null) throw new ArgumentNullException("shas");
this.shas = shas;
}
public bool Exclude(BaseVersion version, out string reason)
{
if (version == null) throw new ArgumentNullException("version");
reason = null;
if (version.BaseVersionSource != null &&
shas.Any(sha => version.BaseVersionSource.Sha.StartsWith(sha, StringComparison.OrdinalIgnoreCase)))
{
reason = $"Sha {version.BaseVersionSource.Sha} was ignored due to commit having been excluded by configuration";
return true;
}
return false;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using GitVersion.VersionCalculation.BaseVersionCalculators;
namespace GitVersion.VersionFilters
{
public class ShaVersionFilter : IVersionFilter
{
private readonly IEnumerable<string> shas;
public ShaVersionFilter(IEnumerable<string> shas)
{
if (shas == null) throw new ArgumentNullException("shas");
this.shas = shas;
}
public bool Exclude(BaseVersion version, out string reason)
{
if (version == null) throw new ArgumentNullException("version");
reason = null;
if (version.BaseVersionSource != null &&
shas.Any(sha => version.BaseVersionSource.Sha.StartsWith(sha, StringComparison.OrdinalIgnoreCase)))
{
reason = "Source was ignored due to commit having been excluded by configuration";
return true;
}
return false;
}
}
}
|
mit
|
C#
|
6116e4a2b65dfcd11da7d04c2f39dda2b5cb4312
|
Fix namespace
|
mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,jacksonh/manos,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,jmptrader/manos,jmptrader/manos,jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos
|
src/Manos/Manos.Server.Testing/MockHttpTransaction.cs
|
src/Manos/Manos.Server.Testing/MockHttpTransaction.cs
|
using System;
namespace Manos.Server.Testing
{
public class MockHttpTransaction
{
public MockHttpTransaction ()
{
}
}
}
|
using System;
namespace Mango.Server.Testing
{
public class MockHttpTransaction
{
public MockHttpTransaction ()
{
}
}
}
|
mit
|
C#
|
7ce03971103f601ad6009a1321d1b8edbe4b16f1
|
Update EGamePlayers.cs
|
pushyka/chess-all
|
Model/EGamePlayers.cs
|
Model/EGamePlayers.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace chess.Model
{
/* Enum representing the player values for chess and tictactoe. */
public enum EGamePlayers
{
White,
Black,
X,
O
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace chess.Model
{
/* Enum representing the various game pieces for chess and tictactoe. */
public enum EGamePlayers
{
White,
Black,
X,
O
}
}
|
mit
|
C#
|
ae224222d528fd7a72fb87fd2d278ad53bf1a183
|
Change glimpse security policy
|
EmilPD/Common-News,EmilPD/Common-News,EmilPD/Common-News
|
src/Web/CommonNews.Web/App_Start/GlimpseSecurityPolicy.cs
|
src/Web/CommonNews.Web/App_Start/GlimpseSecurityPolicy.cs
|
// Uncomment this class to provide custom runtime policy for Glimpse
namespace CommonNews.Web
{
using Glimpse.AspNet.Extensions;
using Glimpse.Core.Extensibility;
public class GlimpseSecurityPolicy : IRuntimePolicy
{
public RuntimeEvent ExecuteOn
{
// The RuntimeEvent.ExecuteResource is only needed in case you create a security policy
// Have a look at http://blog.getglimpse.com/2013/12/09/protect-glimpse-axd-with-your-custom-runtime-policy/ for more details
get { return RuntimeEvent.EndRequest | RuntimeEvent.ExecuteResource; }
}
public RuntimePolicy Execute(IRuntimePolicyContext policyContext)
{
// You can perform a check like the one below to control Glimpse's permissions within your application.
// More information about RuntimePolicies can be found at http://getglimpse.com/Help/Custom-Runtime-Policy
// var httpContext = policyContext.GetHttpContext();
// if (!httpContext.User.IsInRole("Administrator"))
// {
// return RuntimePolicy.Off;
// }
return RuntimePolicy.Off;
}
}
}
|
/*
// Uncomment this class to provide custom runtime policy for Glimpse
using Glimpse.AspNet.Extensions;
using Glimpse.Core.Extensibility;
namespace CommonNews.Web
{
public class GlimpseSecurityPolicy:IRuntimePolicy
{
public RuntimePolicy Execute(IRuntimePolicyContext policyContext)
{
// You can perform a check like the one below to control Glimpse's permissions within your application.
// More information about RuntimePolicies can be found at http://getglimpse.com/Help/Custom-Runtime-Policy
// var httpContext = policyContext.GetHttpContext();
// if (!httpContext.User.IsInRole("Administrator"))
// {
// return RuntimePolicy.Off;
// }
return RuntimePolicy.On;
}
public RuntimeEvent ExecuteOn
{
// The RuntimeEvent.ExecuteResource is only needed in case you create a security policy
// Have a look at http://blog.getglimpse.com/2013/12/09/protect-glimpse-axd-with-your-custom-runtime-policy/ for more details
get { return RuntimeEvent.EndRequest | RuntimeEvent.ExecuteResource; }
}
}
}
*/
|
mit
|
C#
|
4bb2f84ede9be4efbb0ee980e8ad8464e9bab301
|
add META to CommandType.cs
|
McSherry/AppsAgainstHumanity
|
CsNetLib2/CommandType.cs
|
CsNetLib2/CommandType.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CsNetLib2
{
public enum CommandType
{
JOIN,
ACKN,
REFU,
NICK,
NACC,
NDNY,
CLNF,
CLJN,
CLEX,
SMSG,
RMSG,
BDCS,
PONG,
GSTR,
RSTR,
BLCK,
WHTE,
CZAR,
PICK,
BLNK,
CZPK,
REVL,
PNTS,
RWIN,
ENDG,
GWIN,
CRTO,
CZTO,
UNRG,
PING,
DISC,
META,
// For use when an invalid command is sent to AAHProtocolWrapper.
// Recommended behaviour for handlers registered to this on a server is to reply with UNRG.
// Recommended behaviour for clients is not to bind to this.
_InternalInvalid
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CsNetLib2
{
public enum CommandType
{
JOIN,
ACKN,
REFU,
NICK,
NACC,
NDNY,
CLNF,
CLJN,
CLEX,
SMSG,
RMSG,
BDCS,
PONG,
GSTR,
RSTR,
BLCK,
WHTE,
CZAR,
PICK,
BLNK,
CZPK,
REVL,
PNTS,
RWIN,
ENDG,
GWIN,
CRTO,
CZTO,
UNRG,
PING,
DISC,
// For use when an invalid command is sent to AAHProtocolWrapper.
// Recommended behaviour for handlers registered to this on a server is to reply with UNRG.
// Recommended behaviour for clients is not to bind to this.
_InternalInvalid
}
}
|
apache-2.0
|
C#
|
0cd9ddb448f3be4bbea004fafda06c749f2925fe
|
Add diacritic detection to CharSetDetector
|
blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon
|
Localization/CharSetDetector.cs
|
Localization/CharSetDetector.cs
|
using System.Collections.Generic;
namespace Localization
{
public enum CharType
{
UNKNOWN,
BASIC_SET,
LETTER,
ACCENTED,
NUMBER,
HIRAGANA,
KATAKANA,
KANJI,
}
public class CharSetDetector
{
private static Dictionary<char, CharType> types = new Dictionary<char, CharType>();
public static CharType GetCharType(char c)
{
CharType ct;
if (!types.TryGetValue(c, out ct))
{
ct = GetTypeImpl(c);
types[c] = ct;
}
return ct;
}
private static readonly string DIACRITIC_CHARS =
// This is not an exhaustive list and should not be defined this way.
// TODO: Find the correct way to identify these characters programmatically.
"āēīūčģķļņšžўõáíóúýáéíóúýöáâãàçéêíóôõúâêîôûŵŷäëïöüẅÿàèìòùẁỳáéíóúẃý";
private static readonly HashSet<char> DIACRITICS = new HashSet<char>(
(DIACRITIC_CHARS + DIACRITIC_CHARS.ToUpper()).ToCharArray());
private static CharType GetTypeImpl(char c)
{
if (c >= '0' && c <= '9') return CharType.NUMBER;
if (c >= 'a' && c <= 'z') return CharType.LETTER;
if (c >= 'A' && c <= 'Z') return CharType.LETTER;
int code = (int)c;
if (code >= 0x3040 && code <= 0x309f) return CharType.HIRAGANA;
if (code >= 0x30a0 && code <= 0x30ff) return CharType.KATAKANA;
if (code >= 0x4e00 && code <= 0x9fbf) return CharType.KANJI;
if (DIACRITICS.Contains(c))
{
return CharType.ACCENTED;
}
return CharType.UNKNOWN;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Localization
{
public enum CharType
{
UNKNOWN,
BASIC_SET,
LETTER,
ACCENTED,
NUMBER,
HIRAGANA,
KATAKANA,
KANJI,
}
public class CharSetDetector
{
private static Dictionary<char, CharType> types = new Dictionary<char, CharType>();
public static CharType GetCharType(char c)
{
CharType ct;
if (!types.TryGetValue(c, out ct))
{
ct = GetTypeImpl(c);
types[c] = ct;
}
return ct;
}
private static CharType GetTypeImpl(char c)
{
if (c >= '0' && c <= '9') return CharType.NUMBER;
if (c >= 'a' && c <= 'z') return CharType.LETTER;
if (c >= 'A' && c <= 'Z') return CharType.LETTER;
int code = (int)c;
if (code >= 0x3040 && code <= 0x309f) return CharType.HIRAGANA;
if (code >= 0x30a0 && code <= 0x30ff) return CharType.KATAKANA;
if (code >= 0x4e00 && code <= 0x9fbf) return CharType.KANJI;
// TODO: diacritic characters
return CharType.UNKNOWN;
}
}
}
|
mit
|
C#
|
d965d8f20494dc1d20e78087f8ea2903bd0b9efc
|
Test commit from Visual Studio
|
yishn/GTPWrapper
|
GTPWrapper/GTPWrapper.cs
|
GTPWrapper/GTPWrapper.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GTPWrapper {
public class GTPWrapper {
public GTPWrapper() {
}
public string Command(string input) {
return "=";
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GTPWrapper {
public class GTPWrapper {
public GTPWrapper() {
}
public string Command(string input) {
return "";
}
}
}
|
mit
|
C#
|
804005337bded004aa853277578a76bfe73b0447
|
add doc for the Misc API client
|
devkhan/octokit.net,cH40z-Lord/octokit.net,gabrielweyer/octokit.net,khellang/octokit.net,forki/octokit.net,octokit-net-test-org/octokit.net,nsnnnnrn/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,TattsGroup/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,nsrnnnnn/octokit.net,dampir/octokit.net,hahmed/octokit.net,SamTheDev/octokit.net,kdolan/octokit.net,octokit-net-test/octokit.net,bslliw/octokit.net,rlugojr/octokit.net,gdziadkiewicz/octokit.net,darrelmiller/octokit.net,SamTheDev/octokit.net,yonglehou/octokit.net,octokit/octokit.net,takumikub/octokit.net,octokit/octokit.net,dampir/octokit.net,ivandrofly/octokit.net,rlugojr/octokit.net,editor-tools/octokit.net,yonglehou/octokit.net,hitesh97/octokit.net,shiftkey/octokit.net,hahmed/octokit.net,dlsteuer/octokit.net,magoswiat/octokit.net,Red-Folder/octokit.net,editor-tools/octokit.net,chunkychode/octokit.net,shana/octokit.net,SmithAndr/octokit.net,geek0r/octokit.net,naveensrinivasan/octokit.net,gabrielweyer/octokit.net,alfhenrik/octokit.net,eriawan/octokit.net,eriawan/octokit.net,M-Zuber/octokit.net,adamralph/octokit.net,TattsGroup/octokit.net,octokit-net-test-org/octokit.net,Sarmad93/octokit.net,fake-organization/octokit.net,chunkychode/octokit.net,alfhenrik/octokit.net,shana/octokit.net,fffej/octokit.net,Sarmad93/octokit.net,khellang/octokit.net,M-Zuber/octokit.net,brramos/octokit.net,mminns/octokit.net,thedillonb/octokit.net,shiftkey-tester/octokit.net,thedillonb/octokit.net,daukantas/octokit.net,devkhan/octokit.net,shiftkey-tester/octokit.net,ChrisMissal/octokit.net,kolbasov/octokit.net,shiftkey/octokit.net,SLdragon1989/octokit.net,ivandrofly/octokit.net,SmithAndr/octokit.net,gdziadkiewicz/octokit.net,michaKFromParis/octokit.net,mminns/octokit.net
|
Octokit/IMiscellaneousClient.cs
|
Octokit/IMiscellaneousClient.cs
|
using System;
#if NET_45
using System.Collections.ObjectModel;
#endif
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
namespace Octokit
{
/// <summary>
/// /// A client for GitHub's miscellaneous APIs.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/misc/">miscellaneous API documentation</a> for more details.
/// </remarks>
public interface IMiscellaneousClient
{
/// <summary>
/// Gets all the emojis available to use on GitHub.
/// </summary>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>An <see cref="IReadOnlyDictionary{TKey,TValue}"/> of emoji and their URI.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
Task<IReadOnlyDictionary<string, Uri>> GetEmojis();
/// <summary>
/// Gets the rendered Markdown for the specified plain-text Markdown document.
/// </summary>
/// <param name="markdown">A plain-text Markdown document.</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>The rendered Markdown.</returns>
Task<string> RenderRawMarkdown(string markdown);
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
namespace Octokit
{
public interface IMiscellaneousClient
{
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
Task<IReadOnlyDictionary<string, Uri>> GetEmojis();
Task<string> RenderRawMarkdown(string markdown);
}
}
|
mit
|
C#
|
fa7da473d0cff9de49ba2911a8b57d68fc4f0641
|
Fix LogComponent using wrong entity prototype
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
|
Content.Server/GameObjects/Components/Botany/LogComponent.cs
|
Content.Server/GameObjects/Components/Botany/LogComponent.cs
|
using System.Threading.Tasks;
using Content.Shared.GameObjects.Components.Tag;
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Utility;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Botany
{
[RegisterComponent]
public class LogComponent : Component, IInteractUsing
{
public override string Name => "Log";
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
return false;
if (eventArgs.Using.HasTag("BotanySharp"))
{
for (var i = 0; i < 2; i++)
{
var plank = Owner.EntityManager.SpawnEntity("MaterialWoodPlank1", Owner.Transform.Coordinates);
plank.RandomOffset(0.25f);
}
Owner.Delete();
return true;
}
return false;
}
}
}
|
using System.Threading.Tasks;
using Content.Shared.GameObjects.Components.Tag;
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Utility;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Botany
{
[RegisterComponent]
public class LogComponent : Component, IInteractUsing
{
public override string Name => "Log";
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
return false;
if (eventArgs.Using.HasTag("BotanySharp"))
{
for (var i = 0; i < 2; i++)
{
var plank = Owner.EntityManager.SpawnEntity("WoodPlank1", Owner.Transform.Coordinates);
plank.RandomOffset(0.25f);
}
Owner.Delete();
return true;
}
return false;
}
}
}
|
mit
|
C#
|
260f1450af21767aea3eb8ff9325fccfaa4090cb
|
Test fix
|
Shuttle/shuttle-core-infrastructure,Shuttle/Shuttle.Core.Infrastructure
|
Shuttle.Core.Infrastructure.Tests/StreamExtensionsFixture.cs
|
Shuttle.Core.Infrastructure.Tests/StreamExtensionsFixture.cs
|
using System.IO;
using NUnit.Framework;
namespace Shuttle.Core.Infrastructure.Tests
{
[TestFixture]
public class StreamExtensionsFixture
{
[Test]
public void Should_be_able_to_convert_a_stream_to_an_array_of_bytes()
{
var stream = new MemoryStream(new byte[] {0, 1, 2, 3, 4});
var bytes = stream.ToBytes();
Assert.AreEqual(5, bytes.Length);
Assert.AreEqual(0, bytes[0]);
Assert.AreEqual(4, bytes[4]);
}
[Test]
public void Should_be_able_to_make_a_copy_of_a_stream()
{
var bytes = new byte[] {0, 1, 2, 3, 4};
var stream = new MemoryStream(bytes);
var output = new MemoryStream();
stream.CopyTo(output);
Assert.AreEqual(5, output.Length);
Assert.AreEqual(5, output.Position);
Assert.AreEqual(5, stream.Position);
var copy = stream.Copy();
Assert.AreEqual(5, copy.Length);
Assert.AreEqual(0, copy.Position);
Assert.AreEqual(5, stream.Position);
}
}
}
|
using System.IO;
using NUnit.Framework;
namespace Shuttle.Core.Infrastructure.Tests
{
[TestFixture]
public class StreamExtensionsFixture
{
[Test]
public void Should_be_able_to_convert_a_stream_to_an_array_of_bytes()
{
var stream = new MemoryStream(new byte[] {0, 1, 2, 3, 4});
var bytes = stream.ToBytes();
Assert.AreEqual(5, bytes.Length);
Assert.AreEqual(0, bytes[0]);
Assert.AreEqual(4, bytes[4]);
}
[Test]
public void Should_be_able_to_make_a_copy_of_a_stream()
{
var bytes = new byte[] {0, 1, 2, 3, 4};
var stream = new MemoryStream(bytes);
var output = new MemoryStream();
stream.CopyTo(output);
Assert.AreEqual(5, output.Length);
Assert.AreEqual(5, output.Position);
Assert.AreEqual(5, stream.Position);
var copy = stream.Copy();
Assert.AreEqual(5, copy.Length);
Assert.AreEqual(0, copy.Position);
Assert.AreEqual(0, copy.Position);
}
}
}
|
bsd-3-clause
|
C#
|
d80fe92ea6664d63e14e973b4e18e37868ba0567
|
Remove unnecessary check for SharpZipLib dll.
|
cloudfoundry/IronFrame,cloudfoundry-incubator/if_warden,cloudfoundry-incubator/IronFrame,stefanschneider/IronFrame,cloudfoundry-incubator/if_warden,stefanschneider/IronFrame,cloudfoundry/IronFrame,cloudfoundry-incubator/IronFrame
|
IronFoundry.Container/ContainerHostDependencyHelper.cs
|
IronFoundry.Container/ContainerHostDependencyHelper.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
namespace IronFoundry.Container
{
public class ContainerHostDependencyHelper
{
const string ContainerHostAssemblyName = "IronFoundry.Container.Host";
readonly Assembly containerHostAssembly;
public ContainerHostDependencyHelper()
{
this.containerHostAssembly = GetContainerHostAssembly();
}
public virtual string ContainerHostExe
{
get { return ContainerHostAssemblyName + ".exe"; }
}
public virtual string ContainerHostExePath
{
get { return containerHostAssembly.Location; }
}
static Assembly GetContainerHostAssembly()
{
return Assembly.ReflectionOnlyLoad(ContainerHostAssemblyName);
}
public virtual IReadOnlyList<string> GetContainerHostDependencies()
{
return EnumerateLocalReferences(containerHostAssembly).ToList();
}
IEnumerable<string> EnumerateLocalReferences(Assembly assembly)
{
foreach (var referencedAssemblyName in assembly.GetReferencedAssemblies())
{
var referencedAssembly = Assembly.ReflectionOnlyLoad(referencedAssemblyName.FullName);
if (!referencedAssembly.GlobalAssemblyCache)
{
yield return referencedAssembly.Location;
foreach (var nestedReferenceFilePath in EnumerateLocalReferences(referencedAssembly))
yield return nestedReferenceFilePath;
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
namespace IronFoundry.Container
{
public class ContainerHostDependencyHelper
{
const string ContainerHostAssemblyName = "IronFoundry.Container.Host";
readonly Assembly containerHostAssembly;
public ContainerHostDependencyHelper()
{
this.containerHostAssembly = GetContainerHostAssembly();
}
public virtual string ContainerHostExe
{
get { return ContainerHostAssemblyName + ".exe"; }
}
public virtual string ContainerHostExePath
{
get { return containerHostAssembly.Location; }
}
static Assembly GetContainerHostAssembly()
{
return Assembly.ReflectionOnlyLoad(ContainerHostAssemblyName);
}
public virtual IReadOnlyList<string> GetContainerHostDependencies()
{
return EnumerateLocalReferences(containerHostAssembly).ToList();
}
IEnumerable<string> EnumerateLocalReferences(Assembly assembly)
{
foreach (var referencedAssemblyName in assembly.GetReferencedAssemblies())
{
var referencedAssembly = Assembly.ReflectionOnlyLoad(referencedAssemblyName.FullName);
if (!referencedAssembly.GlobalAssemblyCache)
{
yield return referencedAssembly.Location;
if (!referencedAssembly.Location.Contains("ICSharpCode.SharpZipLib.dll"))
foreach (var nestedReferenceFilePath in EnumerateLocalReferences(referencedAssembly))
yield return nestedReferenceFilePath;
}
}
}
}
}
|
apache-2.0
|
C#
|
7d741f2c6052795b4b5c9c555efc634295d791d2
|
fix extension reference
|
monoman/PackageManagerAddin
|
NuPackAddin.Commands/PackageReferenceCommandHandler.cs
|
NuPackAddin.Commands/PackageReferenceCommandHandler.cs
|
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MonoDevelop.Components.Commands;
using MonoDevelop.Core;
using MonoDevelop.Projects;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide;
using NuPackAddin.Dialogs;
using NuPackAddin.Extensions;
namespace NuPackAddin.Commands
{
public enum PackageReferenceCommands
{
Add,
Update,
UpdateAll,
Delete,
DeleteAll
}
public class PackageReferenceCommandHandler : NodeCommandHandler
{
/// <summary>Execute the command for adding a new web reference to a project.</summary>
[CommandHandler(PackageReferenceCommands.Add)]
public void NewPackageReference()
{
// Get the project and project folder
DotNetProject project = CurrentNode.GetParentDataItem(typeof(DotNetProject), true) as DotNetProject;
AddPackageReferenceDialog dialog = new AddPackageReferenceDialog(project);
try
{
if (MessageService.RunCustomDialog(dialog) == (int)Gtk.ResponseType.Ok)
{
project.AddPackage(dialog.SelectedPackage); // TODO create extension method for DotNetProject
IdeApp.ProjectOperations.Save(project);
}
}
catch (Exception exception)
{
MessageService.ShowException(exception);
}
finally
{
dialog.Destroy();
}
}
}
}
|
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MonoDevelop.Components.Commands;
using MonoDevelop.Core;
using MonoDevelop.Projects;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide;
using NuPackAddin.Dialogs;
namespace NuPackAddin.Commands
{
public enum PackageReferenceCommands
{
Add,
Update,
UpdateAll,
Delete,
DeleteAll
}
public class PackageReferenceCommandHandler : NodeCommandHandler
{
/// <summary>Execute the command for adding a new web reference to a project.</summary>
[CommandHandler(PackageReferenceCommands.Add)]
public void NewPackageReference()
{
// Get the project and project folder
DotNetProject project = CurrentNode.GetParentDataItem(typeof(DotNetProject), true) as DotNetProject;
AddPackageReferenceDialog dialog = new AddPackageReferenceDialog(project);
try
{
if (MessageService.RunCustomDialog(dialog) == (int)Gtk.ResponseType.Ok)
{
project.AddPackage(dialog.SelectedPackage); // TODO create extension method for DotNetProject
IdeApp.ProjectOperations.Save(project);
}
}
catch (Exception exception)
{
MessageService.ShowException(exception);
}
finally
{
dialog.Destroy();
}
}
}
}
|
apache-2.0
|
C#
|
93f92fb846208edf1c6a53f16aef7ac8bf1647bd
|
Format DescribeRequest
|
carbon/Amazon
|
src/Amazon.Ec2/Actions/DescribeRequest.cs
|
src/Amazon.Ec2/Actions/DescribeRequest.cs
|
#nullable enable
using System.Collections.Generic;
using System.Globalization;
namespace Amazon.Ec2
{
public abstract class DescribeRequest
{
public int? MaxResults { get; set; }
public string? NextToken { get; set; }
public List<Filter> Filters { get; } = new List<Filter>();
protected void AddIds(Dictionary<string, string> parameters, string prefix, IReadOnlyList<string>? ids)
{
if (ids is null) return;
for (int i = 0; i < ids.Count; i++)
{
// e.g. VpcId.1
parameters.Add(prefix + "." + (i + 1), ids[i]);
}
}
protected Dictionary<string, string> GetParameters(string actionName)
{
var parameters = new Dictionary<string, string> {
{ "Action", actionName }
};
int i = 1;
foreach (Filter filter in Filters)
{
string prefix = "Filter." + i.ToString(CultureInfo.InvariantCulture) + ".";
parameters.Add(prefix + "Name", filter.Name);
parameters.Add(prefix + "Value", filter.Value);
i++;
}
if (MaxResults is int maxResults)
{
parameters.Add("MaxResults", maxResults.ToString(CultureInfo.InvariantCulture));
}
if (NextToken != null)
{
parameters.Add("NextToken", NextToken);
}
return parameters;
}
}
}
|
#nullable enable
using System;
using System.Collections.Generic;
namespace Amazon.Ec2
{
public abstract class DescribeRequest
{
public int? MaxResults { get; set; }
public string? NextToken { get; set; }
public List<Filter> Filters { get; } = new List<Filter>();
protected void AddIds(Dictionary<string, string> parameters, string prefix, IReadOnlyList<string>? ids)
{
if (ids is null) return;
for (var i = 0; i < ids.Count; i++)
{
// e.g. VpcId.1
parameters.Add(prefix + "." + (i + 1), ids[i]);
}
}
protected Dictionary<string, string> GetParameters(string actionName)
{
if (actionName is null)
throw new ArgumentNullException(nameof(actionName));
var parameters = new Dictionary<string, string> {
{ "Action", actionName }
};
var i = 1;
foreach (Filter filter in Filters)
{
string prefix = "Filter." + i + ".";
parameters.Add(prefix + "Name", filter.Name);
parameters.Add(prefix + "Value", filter.Value);
i++;
}
if (MaxResults != null)
{
parameters.Add("MaxResults", MaxResults.Value.ToString());
}
if (NextToken != null)
{
parameters.Add("NextToken", NextToken);
}
return parameters;
}
}
}
|
mit
|
C#
|
ba1c9bc8e47919a3d901675a4de37fb8287a932b
|
Set RemoteEndPoint for UDP connections
|
kerryjiang/SuperSocket,kerryjiang/SuperSocket
|
src/SuperSocket.Channel/UdpPipeChannel.cs
|
src/SuperSocket.Channel/UdpPipeChannel.cs
|
using System;
using System.Buffers;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using SuperSocket.ProtoBase;
namespace SuperSocket.Channel
{
public class UdpPipeChannel<TPackageInfo> : VirtualChannel<TPackageInfo>, IChannelWithSessionIdentifier
{
private Socket _socket;
public UdpPipeChannel(Socket socket, IPipelineFilter<TPackageInfo> pipelineFilter, ChannelOptions options, IPEndPoint remoteEndPoint)
: this(socket, pipelineFilter, options, remoteEndPoint, $"{remoteEndPoint.Address}:{remoteEndPoint.Port}")
{
}
public UdpPipeChannel(Socket socket, IPipelineFilter<TPackageInfo> pipelineFilter, ChannelOptions options, IPEndPoint remoteEndPoint, string sessionIdentifier)
: base(pipelineFilter, options)
{
_socket = socket;
RemoteEndPoint = remoteEndPoint;
SessionIdentifier = sessionIdentifier;
}
public string SessionIdentifier { get; }
protected override void Close()
{
WriteEOFPackage();
}
protected override ValueTask<int> FillPipeWithDataAsync(Memory<byte> memory, CancellationToken cancellationToken)
{
throw new NotSupportedException();
}
protected override async ValueTask<int> SendOverIOAsync(ReadOnlySequence<byte> buffer, CancellationToken cancellationToken)
{
var total = 0;
foreach (var piece in buffer)
{
total += await _socket.SendToAsync(GetArrayByMemory<byte>(piece), SocketFlags.None, RemoteEndPoint);
}
return total;
}
}
}
|
using System;
using System.Buffers;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using SuperSocket.ProtoBase;
namespace SuperSocket.Channel
{
public class UdpPipeChannel<TPackageInfo> : VirtualChannel<TPackageInfo>, IChannelWithSessionIdentifier
{
private Socket _socket;
private IPEndPoint _remoteEndPoint;
public UdpPipeChannel(Socket socket, IPipelineFilter<TPackageInfo> pipelineFilter, ChannelOptions options, IPEndPoint remoteEndPoint)
: this(socket, pipelineFilter, options, remoteEndPoint, $"{remoteEndPoint.Address}:{remoteEndPoint.Port}")
{
}
public UdpPipeChannel(Socket socket, IPipelineFilter<TPackageInfo> pipelineFilter, ChannelOptions options, IPEndPoint remoteEndPoint, string sessionIdentifier)
: base(pipelineFilter, options)
{
_socket = socket;
_remoteEndPoint = remoteEndPoint;
SessionIdentifier = sessionIdentifier;
}
public string SessionIdentifier { get; }
protected override void Close()
{
WriteEOFPackage();
}
protected override ValueTask<int> FillPipeWithDataAsync(Memory<byte> memory, CancellationToken cancellationToken)
{
throw new NotSupportedException();
}
protected override async ValueTask<int> SendOverIOAsync(ReadOnlySequence<byte> buffer, CancellationToken cancellationToken)
{
var total = 0;
foreach (var piece in buffer)
{
total += await _socket.SendToAsync(GetArrayByMemory<byte>(piece), SocketFlags.None, _remoteEndPoint);
}
return total;
}
}
}
|
apache-2.0
|
C#
|
576c1bf81c1b2d741f032644c7bacf95f6cfe226
|
add comment
|
bordoley/RxApp
|
RxApp.Android/Interfaces.cs
|
RxApp.Android/Interfaces.cs
|
using System;
using System.ComponentModel;
namespace RxApp
{
public interface IRxApplication : IAndroidApplication
{
void OnActivityCreated(IRxActivity activity);
}
// FIXME: Consider exposing Activity callbacks as observables
// obvious example is OnOptionsItemSelected. Its a slippery slope though.
public interface IRxActivity : IActivity, IViewFor
{
}
public interface IRxActivity<TViewModel> : IRxActivity, IViewFor<TViewModel>
where TViewModel: class
{
}
}
|
using System;
using System.ComponentModel;
namespace RxApp
{
public interface IRxApplication : IAndroidApplication
{
void OnActivityCreated(IRxActivity activity);
}
public interface IRxActivity : IActivity, IViewFor
{
}
public interface IRxActivity<TViewModel> : IRxActivity, IViewFor<TViewModel>
where TViewModel: class
{
}
}
|
apache-2.0
|
C#
|
4be4cfc564c7d381ce6bceaa64716bd3e2304111
|
Set Browsable to false to hide DockPanel.Skin property.
|
RadarNyan/dockpanelsuite,angelapper/dockpanelsuite,compborg/dockpanelsuite,Romout/dockpanelsuite,transistor1/dockpanelsuite,dockpanelsuite/dockpanelsuite,shintadono/dockpanelsuite,joelbyren/dockpanelsuite,xo-energy/dockpanelsuite
|
WinFormsUI/Docking/DockPanel.Appearance.cs
|
WinFormsUI/Docking/DockPanel.Appearance.cs
|
using System;
namespace WeifenLuo.WinFormsUI.Docking
{
using System.ComponentModel;
public partial class DockPanel
{
private DockPanelSkin m_dockPanelSkin = VS2005Theme.CreateVisualStudio2005();
[LocalizedCategory("Category_Docking")]
[LocalizedDescription("DockPanel_DockPanelSkin")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Obsolete("Please use Theme instead.")]
[Browsable(false)]
public DockPanelSkin Skin
{
get { return m_dockPanelSkin; }
set { m_dockPanelSkin = value; }
}
private ThemeBase m_dockPanelTheme = new VS2005Theme();
[LocalizedCategory("Category_Docking")]
[LocalizedDescription("DockPanel_DockPanelTheme")]
public ThemeBase Theme
{
get { return m_dockPanelTheme; }
set
{
if (value == null)
{
return;
}
if (m_dockPanelTheme.GetType() == value.GetType())
{
return;
}
m_dockPanelTheme = value;
m_dockPanelTheme.Apply(this);
}
}
}
}
|
using System;
namespace WeifenLuo.WinFormsUI.Docking
{
using System.ComponentModel;
public partial class DockPanel
{
private DockPanelSkin m_dockPanelSkin = VS2005Theme.CreateVisualStudio2005();
[LocalizedCategory("Category_Docking")]
[LocalizedDescription("DockPanel_DockPanelSkin")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Obsolete("Please use Theme instead.")]
public DockPanelSkin Skin
{
get { return m_dockPanelSkin; }
set { m_dockPanelSkin = value; }
}
private ThemeBase m_dockPanelTheme = new VS2005Theme();
[LocalizedCategory("Category_Docking")]
[LocalizedDescription("DockPanel_DockPanelTheme")]
public ThemeBase Theme
{
get { return m_dockPanelTheme; }
set
{
if (value == null)
{
return;
}
if (m_dockPanelTheme.GetType() == value.GetType())
{
return;
}
m_dockPanelTheme = value;
m_dockPanelTheme.Apply(this);
}
}
}
}
|
mit
|
C#
|
c4a1d7c53bc254e997789cc8cc4479fdfda1403d
|
fix callback
|
WojcikMike/docs.particular.net,eclaus/docs.particular.net,pedroreys/docs.particular.net,pashute/docs.particular.net,yuxuac/docs.particular.net
|
Snippets/Snippets_3/Callback/Callback.cs
|
Snippets/Snippets_3/Callback/Callback.cs
|
namespace MyServer.Callback
{
using System;
using NServiceBus;
public class Callback
{
class PlaceOrder : ICommand
{
}
class PlaceOrderResponse : IMessage
{
public object Response { get; set; }
}
public void CallbackSnippet()
{
PlaceOrder placeOrder = new PlaceOrder();
IBus bus = null;
// ReSharper disable once NotAccessedVariable
PlaceOrderResponse message; // get replied message
#region CallbackToAccessMessageRegistration
IAsyncResult sync = bus.Send(placeOrder)
.Register(ar =>
{
CompletionResult localResult = (CompletionResult)ar.AsyncState;
message = (PlaceOrderResponse)localResult.Messages[0];
}, null);
sync.AsyncWaitHandle.WaitOne();
// return message;
#endregion
#region CallbackToAccessMessageRegistration
IAsyncResult sync = bus.Send(placeOrder)
.Register(ar =>
{
CompletionResult localResult = (CompletionResult)ar.AsyncState;
message = (PlaceOrderResponse)localResult.Messages[0];
}, null);
sync.AsyncWaitHandle.WaitOne();
// return message;
#endregion
}
enum Status
{
OK,
Error
}
public void TriggerCallback()
{
IBus bus = null;
#region TriggerCallback
bus.Return(Status.OK);
#endregion
}
}
}
|
namespace MyServer.Callback
{
using System;
using NServiceBus;
public class Callback
{
class PlaceOrder : ICommand
{
}
class PlaceOrderResponse : IMessage
{
public object Response { get; set; }
}
public void CallbackSnippet()
{
PlaceOrder placeOrder = new PlaceOrder();
IBus bus = null;
// ReSharper disable once NotAccessedVariable
PlaceOrderResponse message; // get replied message
#region CallbackToAccessMessageRegistration
IAsyncResult sync = bus.Send(placeOrder)
.Register(ar =>
{
CompletionResult localResult = (CompletionResult)ar.AsyncState;
message = (PlaceOrderResponse)localResult.Messages[0];
}, null);
sync.AsyncWaitHandle.WaitOne();
// return message;
#endregion
}
enum Status
{
OK,
Error
}
public void TriggerCallback()
{
IBus bus = null;
#region TriggerCallback
bus.Return(Status.OK);
#endregion
}
}
}
|
apache-2.0
|
C#
|
412ba6ac9919ba53669cd212359f150b7b60cfe9
|
make error message explicit
|
shana/NullGuard,ulrichb/NullGuard,Fody/NullGuard
|
Tests/Verifier.cs
|
Tests/Verifier.cs
|
using System;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using NUnit.Framework;
public static class Verifier
{
public static void Verify(string beforeAssemblyPath, string afterAssemblyPath)
{
var before = Validate(beforeAssemblyPath);
var after = Validate(afterAssemblyPath);
var message = string.Format("Failed processing {0}\r\n{1}",Path.GetFileName(afterAssemblyPath),after);
Assert.AreEqual(TrimLineNumbers(before), TrimLineNumbers(after), message);
}
public static string Validate(string assemblyPath2)
{
var exePath = Environment.ExpandEnvironmentVariables(@"%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\PEVerify.exe");
if (!File.Exists(exePath))
{
exePath = Environment.ExpandEnvironmentVariables(@"%programfiles(x86)%\Microsoft SDKs\Windows\v8.0A\Bin\NETFX 4.0 Tools\PEVerify.exe");
}
var process = Process.Start(new ProcessStartInfo(exePath, "\"" + assemblyPath2 + "\"")
{
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
});
process.WaitForExit(10000);
return process.StandardOutput.ReadToEnd().Trim().Replace(assemblyPath2, "");
}
static string TrimLineNumbers(string foo)
{
return Regex.Replace(foo, @"0x.*]", "");
}
}
|
using System;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using NUnit.Framework;
public static class Verifier
{
public static void Verify(string beforeAssemblyPath, string afterAssemblyPath)
{
var before = Validate(beforeAssemblyPath);
var after = Validate(afterAssemblyPath);
Assert.AreEqual(TrimLineNumbers(before), TrimLineNumbers(after));
}
public static string Validate(string assemblyPath2)
{
var exePath = Environment.ExpandEnvironmentVariables(@"%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\PEVerify.exe");
if (!File.Exists(exePath))
{
exePath = Environment.ExpandEnvironmentVariables(@"%programfiles(x86)%\Microsoft SDKs\Windows\v8.0A\Bin\NETFX 4.0 Tools\PEVerify.exe");
}
var process = Process.Start(new ProcessStartInfo(exePath, "\"" + assemblyPath2 + "\"")
{
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
});
process.WaitForExit(10000);
return process.StandardOutput.ReadToEnd().Trim().Replace(assemblyPath2, "");
}
static string TrimLineNumbers(string foo)
{
return Regex.Replace(foo, @"0x.*]", "");
}
}
|
mit
|
C#
|
4d3bfb14097a6dd41220b040603d68d832cd7611
|
Fix compilation issue
|
pamidur/aspect-injector
|
AspectInjector.Broker/AccessModifiers.cs
|
AspectInjector.Broker/AccessModifiers.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace AspectInjector.Broker
{
[Flags]
public enum AccessModifiers
{
Private = 1,
Protected = 2,
Internal = 4,
ProtectedInternal = 8,
Public = 16
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AspectInjector.Broker
{
[Flags]
public enum AccessModifiers
{
Private = 1,
Protected = 2,
Internal = 4,
ProtectedInternal = 8,
Public = 16
}
}
|
apache-2.0
|
C#
|
85a1a1d4e981e184f2f5d91c41a4d3be2a4ea3fa
|
Remove one virtual call from StreamHelpers.ValidateCopyToArgs (#8361)
|
parjong/coreclr,mskvortsov/coreclr,wateret/coreclr,neurospeech/coreclr,AlexGhiondea/coreclr,poizan42/coreclr,cmckinsey/coreclr,qiudesong/coreclr,JosephTremoulet/coreclr,sagood/coreclr,AlexGhiondea/coreclr,mmitche/coreclr,yeaicc/coreclr,alexperovich/coreclr,botaberg/coreclr,cmckinsey/coreclr,ruben-ayrapetyan/coreclr,krk/coreclr,botaberg/coreclr,ragmani/coreclr,yizhang82/coreclr,YongseopKim/coreclr,kyulee1/coreclr,wtgodbe/coreclr,wateret/coreclr,James-Ko/coreclr,JonHanna/coreclr,YongseopKim/coreclr,rartemev/coreclr,YongseopKim/coreclr,ruben-ayrapetyan/coreclr,krytarowski/coreclr,sjsinju/coreclr,hseok-oh/coreclr,mmitche/coreclr,parjong/coreclr,kyulee1/coreclr,alexperovich/coreclr,sagood/coreclr,James-Ko/coreclr,ruben-ayrapetyan/coreclr,sagood/coreclr,rartemev/coreclr,kyulee1/coreclr,yeaicc/coreclr,neurospeech/coreclr,sjsinju/coreclr,krk/coreclr,mmitche/coreclr,James-Ko/coreclr,wtgodbe/coreclr,gkhanna79/coreclr,ruben-ayrapetyan/coreclr,hseok-oh/coreclr,hseok-oh/coreclr,mskvortsov/coreclr,dpodder/coreclr,pgavlin/coreclr,sjsinju/coreclr,neurospeech/coreclr,poizan42/coreclr,AlexGhiondea/coreclr,poizan42/coreclr,JosephTremoulet/coreclr,qiudesong/coreclr,wtgodbe/coreclr,yizhang82/coreclr,AlexGhiondea/coreclr,dpodder/coreclr,alexperovich/coreclr,tijoytom/coreclr,krytarowski/coreclr,parjong/coreclr,yeaicc/coreclr,wtgodbe/coreclr,cydhaselton/coreclr,James-Ko/coreclr,JonHanna/coreclr,dpodder/coreclr,qiudesong/coreclr,botaberg/coreclr,pgavlin/coreclr,krytarowski/coreclr,JosephTremoulet/coreclr,jamesqo/coreclr,russellhadley/coreclr,pgavlin/coreclr,cmckinsey/coreclr,alexperovich/coreclr,ragmani/coreclr,YongseopKim/coreclr,hseok-oh/coreclr,neurospeech/coreclr,qiudesong/coreclr,JonHanna/coreclr,JosephTremoulet/coreclr,cmckinsey/coreclr,gkhanna79/coreclr,rartemev/coreclr,neurospeech/coreclr,hseok-oh/coreclr,russellhadley/coreclr,gkhanna79/coreclr,krk/coreclr,jamesqo/coreclr,cmckinsey/coreclr,krk/coreclr,krytarowski/coreclr,James-Ko/coreclr,cmckinsey/coreclr,jamesqo/coreclr,wateret/coreclr,yizhang82/coreclr,poizan42/coreclr,cmckinsey/coreclr,sjsinju/coreclr,wtgodbe/coreclr,hseok-oh/coreclr,wtgodbe/coreclr,tijoytom/coreclr,cshung/coreclr,ragmani/coreclr,kyulee1/coreclr,rartemev/coreclr,rartemev/coreclr,cydhaselton/coreclr,krk/coreclr,mskvortsov/coreclr,sagood/coreclr,sagood/coreclr,yeaicc/coreclr,tijoytom/coreclr,russellhadley/coreclr,gkhanna79/coreclr,alexperovich/coreclr,wateret/coreclr,AlexGhiondea/coreclr,cydhaselton/coreclr,dpodder/coreclr,russellhadley/coreclr,mskvortsov/coreclr,cshung/coreclr,JosephTremoulet/coreclr,jamesqo/coreclr,mmitche/coreclr,parjong/coreclr,pgavlin/coreclr,kyulee1/coreclr,James-Ko/coreclr,parjong/coreclr,ragmani/coreclr,yeaicc/coreclr,pgavlin/coreclr,russellhadley/coreclr,cydhaselton/coreclr,JonHanna/coreclr,cshung/coreclr,dpodder/coreclr,krk/coreclr,jamesqo/coreclr,gkhanna79/coreclr,dpodder/coreclr,mmitche/coreclr,botaberg/coreclr,cshung/coreclr,sagood/coreclr,qiudesong/coreclr,neurospeech/coreclr,krytarowski/coreclr,ruben-ayrapetyan/coreclr,JonHanna/coreclr,yizhang82/coreclr,yizhang82/coreclr,kyulee1/coreclr,yeaicc/coreclr,yizhang82/coreclr,JosephTremoulet/coreclr,YongseopKim/coreclr,gkhanna79/coreclr,krytarowski/coreclr,cydhaselton/coreclr,cshung/coreclr,poizan42/coreclr,sjsinju/coreclr,poizan42/coreclr,wateret/coreclr,ruben-ayrapetyan/coreclr,cydhaselton/coreclr,cshung/coreclr,ragmani/coreclr,mskvortsov/coreclr,AlexGhiondea/coreclr,mskvortsov/coreclr,wateret/coreclr,tijoytom/coreclr,qiudesong/coreclr,jamesqo/coreclr,sjsinju/coreclr,tijoytom/coreclr,YongseopKim/coreclr,rartemev/coreclr,botaberg/coreclr,yeaicc/coreclr,botaberg/coreclr,mmitche/coreclr,parjong/coreclr,pgavlin/coreclr,russellhadley/coreclr,alexperovich/coreclr,JonHanna/coreclr,tijoytom/coreclr,ragmani/coreclr
|
src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs
|
src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.IO
{
/// <summary>Provides methods to help in the implementation of Stream-derived types.</summary>
internal static partial class StreamHelpers
{
/// <summary>Validate the arguments to CopyTo, as would Stream.CopyTo.</summary>
public static void ValidateCopyToArgs(Stream source, Stream destination, int bufferSize)
{
if (destination == null)
{
throw new ArgumentNullException(nameof(destination));
}
if (bufferSize <= 0)
{
throw new ArgumentOutOfRangeException(nameof(bufferSize), bufferSize, Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
}
bool sourceCanRead = source.CanRead;
if (!sourceCanRead && !source.CanWrite)
{
throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_StreamClosed"));
}
bool destinationCanWrite = destination.CanWrite;
if (!destinationCanWrite && !destination.CanRead)
{
throw new ObjectDisposedException(nameof(destination), Environment.GetResourceString("ObjectDisposed_StreamClosed"));
}
if (!sourceCanRead)
{
throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnreadableStream"));
}
if (!destinationCanWrite)
{
throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnwritableStream"));
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.IO
{
/// <summary>Provides methods to help in the implementation of Stream-derived types.</summary>
internal static partial class StreamHelpers
{
/// <summary>Validate the arguments to CopyTo, as would Stream.CopyTo.</summary>
public static void ValidateCopyToArgs(Stream source, Stream destination, int bufferSize)
{
if (destination == null)
{
throw new ArgumentNullException(nameof(destination));
}
if (bufferSize <= 0)
{
throw new ArgumentOutOfRangeException(nameof(bufferSize), bufferSize, Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
}
bool sourceCanRead = source.CanRead;
if (!sourceCanRead && !source.CanWrite)
{
throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_StreamClosed"));
}
bool destinationCanWrite = destination.CanWrite;
if (!destination.CanRead && !destinationCanWrite)
{
throw new ObjectDisposedException(nameof(destination), Environment.GetResourceString("ObjectDisposed_StreamClosed"));
}
if (!sourceCanRead)
{
throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnreadableStream"));
}
if (!destinationCanWrite)
{
throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnwritableStream"));
}
}
}
}
|
mit
|
C#
|
88e55fa7685aa901564003e0f60efdde3ca99c24
|
Fix code analysis issue
|
spritely/Foundations.WebApi
|
Foundations.WebApi/GlobalSuppressions.cs
|
Foundations.WebApi/GlobalSuppressions.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GlobalSuppressions.cs">
// Copyright (c) 2017. All rights reserved. Licensed under the MIT license. See LICENSE file in
// the project root for full license information.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
// This file is used by Code Analysis to maintain SuppressMessage attributes that are applied to this
// project. Project-level suppressions either have no target or are given a specific target and
// scoped to a namespace, type, member, etc.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0002:Simplify Member Access", Justification = "This is an auto-generated file.", Scope = "member", Target = "~P:Spritely.Foundations.WebApi.Messages.ResourceManager")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Spritely.Foundations.WebApi.WriteLog.Invoke(System.String)", Scope = "member", Target = "Spritely.Foundations.WebApi.BasicWebApiLogPolicy.#.cctor()", Justification = "Colon is used as a separator for log file output - overkill to move this into resources.")]
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GlobalSuppressions.cs">
// Copyright (c) 2017. All rights reserved. Licensed under the MIT license. See LICENSE file in
// the project root for full license information.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
// This file is used by Code Analysis to maintain SuppressMessage attributes that are applied to this
// project. Project-level suppressions either have no target or are given a specific target and
// scoped to a namespace, type, member, etc.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0002:Simplify Member Access", Justification = "This is an auto-generated file.", Scope = "member", Target = "~P:Spritely.Foundations.WebApi.Messages.ResourceManager")]
|
mit
|
C#
|
0f4be1f966800ff5eeda575f4dbdb66bb428cd51
|
Add test: CanRequestChunkEncodedAsync
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
MagicalCryptoWallet.Tests/TorTests.cs
|
MagicalCryptoWallet.Tests/TorTests.cs
|
using MagicalCryptoWallet.TorSocks5;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Xunit;
namespace MagicalCryptoWallet.Tests
{
// Tor must be running
public class TorTests : IClassFixture<SharedFixture>
{
private SharedFixture SharedFixture { get; }
public TorTests(SharedFixture fixture)
{
SharedFixture = fixture;
}
[Fact]
public async Task CanGetTwiceAsync()
{
using (var client = new TorHttpClient(new Uri("https://icanhazip.com/")))
{
await client.SendAsync(HttpMethod.Get, "");
await client.SendAsync(HttpMethod.Get, "");
}
}
[Fact]
public async Task CanDoRequest1Async()
{
using (var client = new TorHttpClient(new Uri("http://api.qbit.ninja")))
{
var contents = await QBitTestAsync(client, 1);
foreach (var content in contents)
{
Assert.Equal("\"Good question Holmes !\"", content);
}
}
}
[Fact]
public async Task CanRequestChunkEncodedAsync()
{
using (var client = new TorHttpClient(new Uri("https://jigsaw.w3.org/")))
{
var response = await client.SendAsync(HttpMethod.Get, "/HTTP/ChunkedScript");
var content = await response.Content.ReadAsStringAsync();
Assert.Equal(1000, Regex.Matches(content, "01234567890123456789012345678901234567890123456789012345678901234567890").Count);
}
}
private static async Task<List<string>> QBitTestAsync(TorHttpClient client, int times, bool alterRequests = false)
{
var relativetUri = "/whatisit/what%20is%20my%20future";
var tasks = new List<Task<HttpResponseMessage>>();
for (var i = 0; i < times; i++)
{
var task = client.SendAsync(HttpMethod.Get, relativetUri);
if (alterRequests)
{
using (var ipClient = new TorHttpClient(new Uri("https://api.ipify.org/")))
{
var task2 = ipClient.SendAsync(HttpMethod.Get, "/");
tasks.Add(task2);
}
}
tasks.Add(task);
}
await Task.WhenAll(tasks);
var contents = new List<string>();
foreach (var task in tasks)
{
contents.Add(await (await task).Content.ReadAsStringAsync());
}
return contents;
}
}
}
|
using MagicalCryptoWallet.TorSocks5;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace MagicalCryptoWallet.Tests
{
// Tor must be running
public class TorTests : IClassFixture<SharedFixture>
{
private SharedFixture SharedFixture { get; }
public TorTests(SharedFixture fixture)
{
SharedFixture = fixture;
}
[Fact]
public async Task CanGetTwiceAsync()
{
using (var client = new TorHttpClient(new Uri("https://icanhazip.com/")))
{
await client.SendAsync(HttpMethod.Get, "");
await client.SendAsync(HttpMethod.Get, "");
}
}
[Fact]
public async Task CanDoRequest1Async()
{
using (var client = new TorHttpClient(new Uri("http://api.qbit.ninja")))
{
var contents = await QBitTestAsync(client, 1);
foreach (var content in contents)
{
Assert.Equal("\"Good question Holmes !\"", content);
}
}
}
private static async Task<List<string>> QBitTestAsync(TorHttpClient client, int times, bool alterRequests = false)
{
var relativetUri = "/whatisit/what%20is%20my%20future";
var tasks = new List<Task<HttpResponseMessage>>();
for (var i = 0; i < times; i++)
{
var task = client.SendAsync(HttpMethod.Get, relativetUri);
if (alterRequests)
{
using (var ipClient = new TorHttpClient(new Uri("https://api.ipify.org/")))
{
var task2 = ipClient.SendAsync(HttpMethod.Get, "/");
tasks.Add(task2);
}
}
tasks.Add(task);
}
await Task.WhenAll(tasks);
var contents = new List<string>();
foreach (var task in tasks)
{
contents.Add(await (await task).Content.ReadAsStringAsync());
}
return contents;
}
}
}
|
mit
|
C#
|
f7d4f3be06f0cb451af656eca806dcfc03c5cf2c
|
Remove Cache From Print Version
|
mazzimo/blog,mazzimo/blog
|
Mazzimo/Controllers/HomeController.cs
|
Mazzimo/Controllers/HomeController.cs
|
using Mazzimo.Models;
using Mazzimo.Repositories;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Mazzimo.Controllers
{
public class HomeController : Controller
{
IPostRepository _postRepo;
IResumeRepository _cvRepo;
public HomeController(IPostRepository postRepo,
IResumeRepository cvRepo)
{
_postRepo = postRepo;
_cvRepo = cvRepo;
}
public ActionResult Index()
{
var post = _postRepo.GetFirst();
if (post == null)
post = _postRepo.GetIntroductionPost();
return View(post);
}
public ActionResult Cv(string id)
{
var cv = _cvRepo.GetResumeFromLanguageCode(id);
if (cv == null)
return HttpNotFound();
ViewBag.Id = id;
return View(cv);
}
public ActionResult CvPrint(string id)
{
var cv = _cvRepo.GetResumeFromLanguageCode(id);
if (cv == null)
return HttpNotFound();
return View(cv);
}
public ActionResult Post(string id)
{
var post = _postRepo.GetById(id);
if (post == null)
return HttpNotFound();
return View(post);
}
}
}
|
using Mazzimo.Models;
using Mazzimo.Repositories;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Mazzimo.Controllers
{
public class HomeController : Controller
{
IPostRepository _postRepo;
IResumeRepository _cvRepo;
public HomeController(IPostRepository postRepo,
IResumeRepository cvRepo)
{
_postRepo = postRepo;
_cvRepo = cvRepo;
}
public ActionResult Index()
{
var post = _postRepo.GetFirst();
if (post == null)
post = _postRepo.GetIntroductionPost();
return View(post);
}
public ActionResult Cv(string id)
{
var cv = _cvRepo.GetResumeFromLanguageCode(id);
if (cv == null)
return HttpNotFound();
ViewBag.Id = id;
return View(cv);
}
public ActionResult CvPrint(string id)
{
var cv = _cvRepo.GetResumeFromLanguageCode(id);
if (cv == null)
return HttpNotFound();
Response.Cache.SetExpires(DateTime.Now.AddYears(1));
Response.Cache.SetCacheability(HttpCacheability.Public);
return View(cv);
}
public ActionResult Post(string id)
{
var post = _postRepo.GetById(id);
if (post == null)
return HttpNotFound();
return View(post);
}
}
}
|
cc0-1.0
|
C#
|
5c4c3612ccca83f788880ada7f00018963e2928c
|
Include info level.
|
MindscapeHQ/raygun4net,MindscapeHQ/raygun4net,MindscapeHQ/raygun4net
|
Mindscape.Raygun4Net.Xamarin.iOS.Unified/RaygunLogLevel.cs
|
Mindscape.Raygun4Net.Xamarin.iOS.Unified/RaygunLogLevel.cs
|
using System;
namespace Mindscape.Raygun4Net.Xamarin.iOS.Unified
{
public enum RaygunLogLevel
{
Error,
Warning,
Info,
Debug,
Verbose
}
}
|
using System;
namespace Mindscape.Raygun4Net.Xamarin.iOS.Unified
{
public enum RaygunLogLevel
{
Error,
Warning,
Debug,
Verbose
}
}
|
mit
|
C#
|
ecc9bdf91fe67d88e08834b95967913276aeb8b2
|
Rename "Keep Size" to "Original Size"
|
ivanz/PicasaUploader,ivanz/PicasaUploader
|
PicasaUploader/Utilities/ImageSize.cs
|
PicasaUploader/Utilities/ImageSize.cs
|
//
// Copyright (c) 2009 Ivan N. Zlatev <contact@i-nz.net>
//
// Authors:
// Ivan N. Zlatev <contact@i-nz.net>
//
// License: MIT/X11 - See LICENSE.txt
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace PicasaUploader
{
class ImageSize
{
public static ImageSize Empty = new ImageSize ("Original Size", 0, 0);
public ImageSize (string label, int width, int height)
{
if (String.IsNullOrEmpty (label))
throw new ArgumentException ("label is null or empty.", "label");
Label = label;
Height = height;
Width = width;
}
public int Width { get; set; }
public int Height { get; set; }
public string Label { get; set; }
public override string ToString ()
{
if (this == Empty)
return Empty.Label;
return String.Format ("{0} ({1}x{2})", Label, Width, Height);
}
public override bool Equals (object obj)
{
ImageSize size = obj as ImageSize;
if (size != null)
return size.Height == this.Height && size.Width == this.Width && size.Label == this.Label;
return base.Equals (obj);
}
public override int GetHashCode ()
{
return base.GetHashCode ();
}
}
}
|
//
// Copyright (c) 2009 Ivan N. Zlatev <contact@i-nz.net>
//
// Authors:
// Ivan N. Zlatev <contact@i-nz.net>
//
// License: MIT/X11 - See LICENSE.txt
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace PicasaUploader
{
class ImageSize
{
public static ImageSize Empty = new ImageSize ("Keep Size", 0, 0);
public ImageSize (string label, int width, int height)
{
if (String.IsNullOrEmpty (label))
throw new ArgumentException ("label is null or empty.", "label");
Label = label;
Height = height;
Width = width;
}
public int Width { get; set; }
public int Height { get; set; }
public string Label { get; set; }
public override string ToString ()
{
if (this == Empty)
return Empty.Label;
return String.Format ("{0} ({1}x{2})", Label, Width, Height);
}
public override bool Equals (object obj)
{
ImageSize size = obj as ImageSize;
if (size != null)
return size.Height == this.Height && size.Width == this.Width && size.Label == this.Label;
return base.Equals (obj);
}
public override int GetHashCode ()
{
return base.GetHashCode ();
}
}
}
|
mit
|
C#
|
c78886489d837bdc5a560cb1d41fee63c7657a94
|
Update ServiceProviderFixture.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Framework.IntegrationTests/ServiceProviderFixture.cs
|
TIKSN.Framework.IntegrationTests/ServiceProviderFixture.cs
|
using System;
using System.Collections.Generic;
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using TIKSN.Data.Mongo;
using TIKSN.DependencyInjection;
using TIKSN.Framework.IntegrationTests.Data.Mongo;
namespace TIKSN.Framework.IntegrationTests
{
public class ServiceProviderFixture : IDisposable
{
private readonly IHost host;
public ServiceProviderFixture()
{
this.host = Host.CreateDefaultBuilder()
.ConfigureServices(services =>
{
services.AddFrameworkPlatform();
})
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.ConfigureContainer<ContainerBuilder>(builder =>
{
builder.RegisterModule<CoreModule>();
builder.RegisterModule<PlatformModule>();
builder.RegisterType<TestMongoRepository>().As<ITestMongoRepository>().InstancePerLifetimeScope();
builder.RegisterType<TestMongoDatabaseProvider>().As<IMongoDatabaseProvider>().SingleInstance();
builder.RegisterType<TestMongoClientProvider>().As<IMongoClientProvider>().SingleInstance();
})
.ConfigureHostConfiguration(builder =>
{
builder.AddInMemoryCollection(GetInMemoryConfiguration());
builder.AddUserSecrets<ServiceProviderFixture>();
})
.Build();
static Dictionary<string, string> GetInMemoryConfiguration() => new()
{
{
"ConnectionStrings:Mongo",
"mongodb://localhost:27017/TIKSN_Framework_IntegrationTests?w=majority"
}
};
}
public IServiceProvider Services => this.host.Services;
public void Dispose() => this.host?.Dispose();
}
}
|
using System;
using System.Collections.Generic;
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using TIKSN.Data.Mongo;
using TIKSN.DependencyInjection;
using TIKSN.Framework.IntegrationTests.Data.Mongo;
namespace TIKSN.Framework.IntegrationTests
{
public class ServiceProviderFixture : IDisposable
{
private readonly IHost host;
public ServiceProviderFixture()
{
this.host = Host.CreateDefaultBuilder()
.ConfigureServices(services =>
{
services.AddFrameworkPlatform();
})
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.ConfigureContainer<ContainerBuilder>(builder =>
{
builder.RegisterModule<CoreModule>();
builder.RegisterModule<PlatformModule>();
builder.RegisterType<TestMongoRepository>().As<ITestMongoRepository>().InstancePerLifetimeScope();
builder.RegisterType<TestMongoDatabaseProvider>().As<IMongoDatabaseProvider>().SingleInstance();
builder.RegisterType<TestMongoClientProvider>().As<IMongoClientProvider>().SingleInstance();
})
.ConfigureHostConfiguration(builder => { builder.AddInMemoryCollection(GetInMemoryConfiguration()); })
.Build();
static Dictionary<string, string> GetInMemoryConfiguration() => new()
{
{
"ConnectionStrings:Mongo",
"mongodb://localhost:27017/TIKSN_Framework_IntegrationTests?w=majority"
}
};
}
public IServiceProvider Services => this.host.Services;
public void Dispose() => this.host?.Dispose();
}
}
|
mit
|
C#
|
cd377e64450d8e6274a90a3e90ef6d77c5e1f078
|
Fix incorrect balance
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
|
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
|
using System;
using System.Collections.ObjectModel;
using System.Composition;
using System.Linq;
using System.Reactive.Linq;
using AvalonStudio.Extensibility;
using AvalonStudio.Shell;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Models;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class WalletViewModel : WasabiDocumentTabViewModel
{
private ObservableCollection<WalletActionViewModel> _actions;
private string _title;
public override string Title
{
get { return _title; }
set { this.RaiseAndSetIfChanged(ref _title, value); }
}
public WalletViewModel(string name, bool receiveDominant)
: base(name)
{
var coinsChanged = Observable.FromEventPattern(Global.WalletService.Coins, nameof(Global.WalletService.Coins.HashSetChanged));
var newBlockProcessed = Observable.FromEventPattern(Global.WalletService, nameof(Global.WalletService.NewBlockProcessed));
var coinSpent = Observable.FromEventPattern(Global.WalletService, nameof(Global.WalletService.CoinSpentOrSpenderConfirmed));
coinsChanged
.Merge(newBlockProcessed)
.Merge(coinSpent)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(o =>
{
SetBalance(name);
});
SetBalance(name);
if (receiveDominant)
{
_actions = new ObservableCollection<WalletActionViewModel>
{
new SendTabViewModel(this),
new CoinJoinTabViewModel(this),
new HistoryTabViewModel(this),
new ReceiveTabViewModel(this)
};
}
else
{
_actions = new ObservableCollection<WalletActionViewModel>
{
new SendTabViewModel(this),
new ReceiveTabViewModel(this),
new CoinJoinTabViewModel(this),
new HistoryTabViewModel(this)
};
}
foreach (var vm in _actions)
{
vm.DisplayActionTab();
}
}
public string Name { get; }
public ObservableCollection<WalletActionViewModel> Actions
{
get { return _actions; }
set { this.RaiseAndSetIfChanged(ref _actions, value); }
}
private void SetBalance(string walletName)
{
Money balance = Global.WalletService.Coins.Where(c => c.Unspent).Sum(c => (long?)c.Amount) ?? 0;
Title = $"{walletName} ({balance.ToString(false, true)} BTC)";
}
}
}
|
using System;
using System.Collections.ObjectModel;
using System.Composition;
using System.Linq;
using System.Reactive.Linq;
using AvalonStudio.Extensibility;
using AvalonStudio.Shell;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Models;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class WalletViewModel : WasabiDocumentTabViewModel
{
private ObservableCollection<WalletActionViewModel> _actions;
private string _title;
public override string Title
{
get { return _title; }
set { this.RaiseAndSetIfChanged(ref _title, value); }
}
public WalletViewModel(string name, bool receiveDominant)
: base(name)
{
var coinsChanged = Observable.FromEventPattern(Global.WalletService.Coins, nameof(Global.WalletService.Coins.HashSetChanged));
coinsChanged
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(o =>
{
SetBalance(name);
});
SetBalance(name);
if (receiveDominant)
{
_actions = new ObservableCollection<WalletActionViewModel>
{
new SendTabViewModel(this),
new CoinJoinTabViewModel(this),
new HistoryTabViewModel(this),
new ReceiveTabViewModel(this)
};
}
else
{
_actions = new ObservableCollection<WalletActionViewModel>
{
new SendTabViewModel(this),
new ReceiveTabViewModel(this),
new CoinJoinTabViewModel(this),
new HistoryTabViewModel(this)
};
}
foreach (var vm in _actions)
{
vm.DisplayActionTab();
}
}
public string Name { get; }
public ObservableCollection<WalletActionViewModel> Actions
{
get { return _actions; }
set { this.RaiseAndSetIfChanged(ref _actions, value); }
}
private void SetBalance(string walletName)
{
Money balance = Global.WalletService.Coins.Where(c => c.Unspent).Sum(c => (long?)c.Amount) ?? 0;
Title = $"{walletName} ({balance.ToString(false, true)} BTC)";
}
}
}
|
mit
|
C#
|
0f4510fa1a612fff0d369f525b64169a4e14d6b5
|
add main ctor
|
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.Text;
using System.Threading.Tasks;
namespace Nums
{
public class SeidelMethod
{
#region Fields
private Matrix<double> _matrix;
private double[] _vector;
#endregion
#region Properties
#endregion
#region Costructors
public SeidelMethod(Matrix<double> inputMatrix, double[] vector)
{
_matrix = inputMatrix;
_vector = vector;
}
#endregion
#region private Methods
#endregion
#region public Methods
#endregion
#region Events
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nums
{
class SeidelMethod
{
}
}
|
mit
|
C#
|
0f8eebb053f7bf4392066c970335f9789cf6a6c0
|
Simplify C# headless blinky sample
|
dotMorten/samples,sewong/samples,Sumahitha/samples,ricl/samples,MasayukiNagase/samples,javiddhankwala/samples,HerrickSpencer/samples,jayhopeter/samples,sewong/samples,rachitb777/samples,parameshbabu/samples,sewong/samples,jessekaplan/samples,MagicBunny/samples,Sumahitha/samples,sewong/samples,rachitb777/samples,dotMorten/samples,MasayukiNagase/samples,javiddhankwala/samples,javiddhankwala/samples,derekameer/samples,dankuo/samples,jordanrh1/samples,tjaffri/msiot-samples,zhuridartem/samples,sndnvaps/samples,dankuo/samples,parameshbabu/samples,DavidShoe/samples,bfjelds/samples,Sumahitha/samples,ms-iot/samples,neilshipp/samples,neilshipp/samples,dotMorten/samples,javiddhankwala/samples,neilshipp/samples,paulmon/samples,rachitb777/samples,MagicBunny/samples,ms-iot/samples,jordanrh1/samples,sndnvaps/ms-iot_samples,DavidShoe/samples,ms-iot/samples,ms-iot/samples,jayhopeter/samples,dotMorten/samples,dotMorten/samples,jordanrh1/samples,jayhopeter/samples,jordanrh1/samples,sndnvaps/ms-iot_samples,jessekaplan/samples,jessekaplan/samples,ms-iot/samples,HerrickSpencer/samples,sndnvaps/ms-iot_samples,derekameer/samples,jordanrh1/samples,bfjelds/samples,jayhopeter/samples,neilshipp/samples,bfjelds/samples,ms-iot/samples,dotMorten/samples,paulmon/samples,HerrickSpencer/samples,paulmon/samples,parameshbabu/samples,rachitb777/samples,neilshipp/samples,jessekaplan/samples,tjaffri/msiot-samples,rachitb777/samples,paulmon/samples,derekameer/samples,jordanrh1/samples,ricl/samples,dankuo/samples,bfjelds/samples,parameshbabu/samples,bfjelds/samples,sndnvaps/ms-iot_samples,paulmon/samples,MasayukiNagase/samples,DavidShoe/samples,sewong/samples,parameshbabu/samples,rachitb777/samples,bfjelds/samples,derekameer/samples,derekameer/samples,javiddhankwala/samples,neilshipp/samples,neilshipp/samples,bfjelds/samples,jayhopeter/samples,jessekaplan/samples,Sumahitha/samples,paulmon/samples,derekameer/samples,parameshbabu/samples,rachitb777/samples,jessekaplan/samples,bfjelds/samples,MicrosoftEdge/WebOnPi,ricl/samples,MasayukiNagase/samples,zhuridartem/samples,tjaffri/msiot-samples,MagicBunny/samples,javiddhankwala/samples,HerrickSpencer/samples,MagicBunny/samples,zhuridartem/samples,jayhopeter/samples,rachitb777/samples,ms-iot/samples,ms-iot/samples,derekameer/samples,jayhopeter/samples,jessekaplan/samples,zhuridartem/samples,sewong/samples,zhuridartem/samples,paulmon/samples,paulmon/samples,tjaffri/msiot-samples,sewong/samples,zhuridartem/samples,tjaffri/msiot-samples,ms-iot/samples,derekameer/samples,sewong/samples,MasayukiNagase/samples,jessekaplan/samples,MasayukiNagase/samples,zhuridartem/samples,bfjelds/samples,MasayukiNagase/samples,rachitb777/samples,parameshbabu/samples,derekameer/samples,MasayukiNagase/samples,jessekaplan/samples,sndnvaps/samples,tjaffri/msiot-samples,sndnvaps/samples,rachitb777/samples,HerrickSpencer/samples,javiddhankwala/samples,tjaffri/msiot-samples,jordanrh1/samples,DavidShoe/samples,dankuo/samples,jayhopeter/samples,sndnvaps/ms-iot_samples,parameshbabu/samples,parameshbabu/samples,zhuridartem/samples,javiddhankwala/samples,MicrosoftEdge/WebOnPi,neilshipp/samples,sndnvaps/samples,Sumahitha/samples,javiddhankwala/samples,sndnvaps/samples,jayhopeter/samples,jordanrh1/samples,jordanrh1/samples,jayhopeter/samples,parameshbabu/samples,paulmon/samples,ms-iot/samples,MagicBunny/samples,ricl/samples,dankuo/samples,tjaffri/msiot-samples,derekameer/samples,zhuridartem/samples,MasayukiNagase/samples,zhuridartem/samples,Sumahitha/samples,bfjelds/samples,DavidShoe/samples,jessekaplan/samples,ricl/samples,sewong/samples,dotMorten/samples,tjaffri/msiot-samples,Sumahitha/samples,sewong/samples,tjaffri/msiot-samples,dotMorten/samples,Sumahitha/samples,jordanrh1/samples,MasayukiNagase/samples,paulmon/samples,javiddhankwala/samples
|
BlinkyHeadless/CS/StartupTask.cs
|
BlinkyHeadless/CS/StartupTask.cs
|
/*
Copyright(c) Microsoft Open Technologies, Inc. All rights reserved.
The MIT License(MIT)
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.Linq;
using System.Text;
using System.Net.Http;
using Windows.ApplicationModel.Background;
using Windows.Devices.Gpio;
using Windows.System.Threading;
namespace BlinkyHeadlessCS
{
public sealed class StartupTask : IBackgroundTask
{
BackgroundTaskDeferral _deferral;
private GpioPinValue value = GpioPinValue.High;
private const int LED_PIN = 5;
private GpioPin pin;
private ThreadPoolTimer timer;
public void Run(IBackgroundTaskInstance taskInstance)
{
_deferral = taskInstance.GetDeferral();
InitGPIO();
timer = ThreadPoolTimer.CreatePeriodicTimer(Timer_Tick, TimeSpan.FromMilliseconds(500));
}
private void InitGPIO()
{
pin = GpioController.GetDefault().OpenPin(LED_PIN);
pin.Write(GpioPinValue.High);
pin.SetDriveMode(GpioPinDriveMode.Output);
}
private void Timer_Tick(ThreadPoolTimer timer)
{
value = (value == GpioPinValue.High) ? GpioPinValue.Low : GpioPinValue.High;
pin.Write(value);
}
}
}
|
/*
Copyright(c) Microsoft Open Technologies, Inc. All rights reserved.
The MIT License(MIT)
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.Linq;
using System.Text;
using System.Net.Http;
using Windows.ApplicationModel.Background;
using Windows.Devices.Gpio;
using Windows.System.Threading;
namespace BlinkyHeadlessCS
{
public sealed class StartupTask : IBackgroundTask
{
BackgroundTaskDeferral _deferral;
private int LEDStatus = 0;
private const int LED_PIN = 5;
private GpioPin pin;
private ThreadPoolTimer timer;
public void Run(IBackgroundTaskInstance taskInstance)
{
_deferral = taskInstance.GetDeferral();
InitGPIO();
timer = ThreadPoolTimer.CreatePeriodicTimer(Timer_Tick, TimeSpan.FromMilliseconds(500));
}
private void InitGPIO()
{
var gpio = GpioController.GetDefault();
if (gpio == null)
{
pin = null;
return;
}
pin = gpio.OpenPin(LED_PIN);
pin.Write(GpioPinValue.High);
pin.SetDriveMode(GpioPinDriveMode.Output);
}
private void Timer_Tick(ThreadPoolTimer timer)
{
if (pin != null)
{
if (LEDStatus == 0)
{
LEDStatus = 1;
pin.Write(GpioPinValue.High);
}
else
{
LEDStatus = 0;
pin.Write(GpioPinValue.Low);
}
}
}
}
}
|
mit
|
C#
|
c368ec23e2282750276780bbb4c6aafd3556f8f3
|
refactor HoganCompiler to only build the ScriptEngine once ala CoffeeScriptCompiler
|
wolfgang42/SquishIt,farans/SquishIt,jetheredge/SquishIt,Worthaboutapig/SquishIt,0liver/SquishIt,AlexCuse/SquishIt,AlexCuse/SquishIt,0liver/SquishIt,farans/SquishIt,Worthaboutapig/AC-SquishIt,wolfgang42/SquishIt,AlexCuse/SquishIt,Worthaboutapig/AC-SquishIt,jetheredge/SquishIt,farans/SquishIt,AlexCuse/SquishIt,jetheredge/SquishIt,wolfgang42/SquishIt,farans/SquishIt,jetheredge/SquishIt,Worthaboutapig/SquishIt,Worthaboutapig/SquishIt,Worthaboutapig/SquishIt,Worthaboutapig/AC-SquishIt,Worthaboutapig/AC-SquishIt,jetheredge/SquishIt,0liver/SquishIt,0liver/SquishIt,Worthaboutapig/AC-SquishIt,AlexCuse/SquishIt,farans/SquishIt,wolfgang42/SquishIt,0liver/SquishIt,wolfgang42/SquishIt,AlexCuse/SquishIt,jetheredge/SquishIt,Worthaboutapig/SquishIt
|
SquishIt.Hogan/Hogan/HoganCompiler.cs
|
SquishIt.Hogan/Hogan/HoganCompiler.cs
|
using System.IO;
using System.Reflection;
using Jurassic;
namespace SquishIt.Hogan.Hogan
{
public class HoganCompiler
{
static string _hogan;
static ScriptEngine _engine;
public string Compile(string input)
{
return HoganEngine.CallGlobalFunction<string>("compile", input);
}
static ScriptEngine HoganEngine
{
get
{
if(_engine == null)
{
lock(typeof(HoganCompiler))
{
var engine = new ScriptEngine { EnableDebugging = true };
engine.Execute(Compiler);
engine.Evaluate("var compile = function (template) {return Hogan.compile(template, { asString: 1 });};");
_engine = engine;
}
}
return _engine;
}
}
static string Compiler
{
get { return _hogan ?? (_hogan = LoadHogan()); }
}
static string LoadHogan()
{
using(var stream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("SquishIt.Hogan.Hogan.hogan-2.0.0.js"))
using(var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
}
}
|
using System.IO;
using System.Reflection;
using Jurassic;
namespace SquishIt.Hogan.Hogan
{
public class HoganCompiler
{
private static string _hogan;
private readonly ScriptEngine _scriptEngine;
public HoganCompiler()
{
_scriptEngine = new ScriptEngine {EnableDebugging = true};
_scriptEngine.Execute(Compiler);
_scriptEngine
.Evaluate("var compile = function (template) {return Hogan.compile(template, { asString: 1 });};");
}
private static string Compiler
{
get { return _hogan ?? (_hogan = LoadHogan()); }
}
public string Compile(string input)
{
return _scriptEngine.CallGlobalFunction<string>("compile", input);
}
private static string LoadHogan()
{
using (Stream stream =
Assembly.GetExecutingAssembly()
.GetManifestResourceStream("SquishIt.Hogan.Hogan.hogan-2.0.0.js"))
{
using (var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
}
}
}
|
mit
|
C#
|
a16e5be5e74f8956e087abfb920bb7e625ae8bca
|
fix issue serializing duration
|
IUMDPI/IUMediaHelperApps
|
Common/Models/OperationResult.cs
|
Common/Models/OperationResult.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
namespace Common.Models
{
public abstract class OperationReport
{
private TimeSpan _duration;
[XmlAttribute("Timestamp")]
public DateTime Timestamp { get; set; }
public bool Succeeded { get; set; }
public string Issue { get; set; }
[XmlIgnore]
public TimeSpan Duration
{
get {return _duration;}
set { _duration = value; }
}
[XmlAttribute("Duration")]
public long DurationTicks
{
get { return _duration.Ticks; }
set { _duration = new TimeSpan(value);}
}
public static Task<T> Read<T>(string path) where T:OperationReport
{
return Task.Run(() =>
{
using (var inputStream = File.Open(path, FileMode.Open))
{
var serializer = new XmlSerializer(typeof(T));
var reader = XmlReader.Create(inputStream);
return (T)serializer.Deserialize(reader);
}
});
}
}
public class PackagerObjectReport : OperationReport
{
[XmlAttribute("Barcode")]
public string Barcode { get; set; }
}
public class PackagerReport : OperationReport
{
[XmlArray("Objects")]
[XmlArrayItem("Object")]
public List<PackagerObjectReport> ObjectReports { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
namespace Common.Models
{
public abstract class OperationReport
{
[XmlAttribute("Timestamp")]
public DateTime Timestamp { get; set; }
public bool Succeeded { get; set; }
public string Issue { get; set; }
public TimeSpan Duration { get; set; }
public static Task<T> Read<T>(string path) where T:OperationReport
{
return Task.Run(() =>
{
using (var inputStream = File.Open(path, FileMode.Open))
{
var serializer = new XmlSerializer(typeof(T));
var reader = XmlReader.Create(inputStream);
return (T)serializer.Deserialize(reader);
}
});
}
}
public class PackagerObjectReport : OperationReport
{
[XmlAttribute("Barcode")]
public string Barcode { get; set; }
}
public class PackagerReport : OperationReport
{
[XmlArray("Objects")]
[XmlArrayItem("Object")]
public List<PackagerObjectReport> ObjectReports { get; set; }
}
}
|
apache-2.0
|
C#
|
f2a10913cea8171255bcb15dc64afbfe34cde8a4
|
add missing copyright
|
RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk
|
Ds3/Runtime/RuntimeUtils.cs
|
Ds3/Runtime/RuntimeUtils.cs
|
/*
* ******************************************************************************
* Copyright 2014-2016 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
using System;
namespace Ds3.Runtime
{
public static class RuntimeUtils
{
public static bool IsRunningOnMono()
{
return Type.GetType("Mono.Runtime") != null;
}
}
}
|
using System;
namespace Ds3.Runtime
{
public static class RuntimeUtils
{
public static bool IsRunningOnMono()
{
return Type.GetType("Mono.Runtime") != null;
}
}
}
|
apache-2.0
|
C#
|
09b2abe4192f8395f5d6b3d9b44d5423a9283440
|
Remove unused operator.
|
Iscgx/GCL
|
GCL.Syntax/Data/NodeArea.cs
|
GCL.Syntax/Data/NodeArea.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace GCL.Syntax.Data
{
public class NodeArea : HashSet<Element>
{
private int hashCode = 0;
public NodeArea()
{
}
public NodeArea(IEnumerable<Element> collection) : base(collection)
{
}
public override int GetHashCode()
{
if (hashCode == 0)
hashCode = this.Aggregate(0, (current, element) => current ^ (486187739 & element.GetHashCode()));
return hashCode;
}
public override bool Equals(object obj)
{
if (obj == null || (obj is NodeArea) == false)
return false;
var otherNodeArea = obj as NodeArea;
return SetEquals(otherNodeArea);
}
public static bool operator ==(NodeArea n1, NodeArea n2)
{
if ((object) n1 == null || (object) n2 == null)
return false;
return n1.Equals(n2);
}
public static bool operator !=(NodeArea n1, NodeArea n2)
{
return !(n1 == n2);
}
public override string ToString()
{
return $"Count = {Count}";
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace GCL.Syntax.Data
{
public class NodeArea : HashSet<Element>
{
private int hashCode = 0;
public NodeArea()
{
}
public NodeArea(IEnumerable<Element> collection) : base(collection)
{
}
public override int GetHashCode()
{
if (hashCode == 0)
hashCode = this.Aggregate(0, (current, element) => current ^ (486187739 & element.GetHashCode()));
return hashCode;
}
public override bool Equals(object obj)
{
if (obj == null || (obj is NodeArea) == false)
return false;
var otherNodeArea = obj as NodeArea;
return SetEquals(otherNodeArea);
}
public static bool operator ==(NodeArea n1, NodeArea n2)
{
if ((object) n1 == null || (object) n2 == null)
return false;
return n1.Equals(n2);
}
public static bool operator !=(NodeArea n1, NodeArea n2)
{
return !(n1 == n2);
}
public static NodeArea operator +(NodeArea n1, NodeArea n2)
{
return new NodeArea(n1.Union(n2));
}
public override string ToString()
{
return $"Count = {Count}";
}
}
}
|
mit
|
C#
|
61bf25333a37e4b8f339a65a0787a0066dc5485a
|
Update Bugsnag.PCL UnWrap extension method
|
awseward/Bugsnag.NET,awseward/Bugsnag.NET
|
Bugsnag.PCL/Extensions/Extensions.cs
|
Bugsnag.PCL/Extensions/Extensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Bugsnag.PCL.Extensions
{
static class Extensions
{
/// <remarks>Not sure I'm really thrilled with this...</remarks>
public static IEnumerable<Exception> Unwrap(this Exception ex)
{
if (ex == null)
{
return Enumerable.Empty<Exception>();
}
else if (ex.InnerException == null)
{
return new Exception[] { ex };
}
return new Exception[] { ex }.Concat(ex.InnerException.Unwrap());
}
public static IEnumerable<string> ToLines(this Exception ex)
{
if (ex == null || ex.StackTrace == null)
{
return new string[] { String.Empty };
}
return ex.StackTrace.Split(
new string[] { Environment.NewLine },
StringSplitOptions.RemoveEmptyEntries);
}
public static string ParseFile(this string line)
{
var match = Regex.Match(line, "in (.+):line");
if (match.Groups.Count < 2) { return "[file]"; }
return match.Groups[1].Value;
}
public static string ParseMethodName(this string line)
{
// to extract the full method name (with namespace)
var match = Regex.Match(line, "at ([^)]+[)])");
if (match.Groups.Count < 2) { return "[method]"; }
return match.Groups[1].Value;
}
public static int ParseLineNumber(this string line)
{
var match = Regex.Match(line, ":line ([0-9]+)");
if (match.Groups.Count < 2) { return -1; }
return Convert.ToInt32(match.Groups[1].Value);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Bugsnag.PCL.Extensions
{
static class Extensions
{
/// <remarks>Not sure I'm really thrilled with this...</remarks>
public static IEnumerable<Exception> Unwrap(this Exception ex)
{
if (ex == null)
{
return Enumerable.Empty<Exception>();
}
else if (ex.InnerException == null)
{
return new Exception[] { ex };
}
return ex.InnerException.Unwrap().Concat(new Exception[] { ex });
}
public static IEnumerable<string> ToLines(this Exception ex)
{
if (ex == null || ex.StackTrace == null)
{
return new string[] { String.Empty };
}
return ex.StackTrace.Split(
new string[] { Environment.NewLine },
StringSplitOptions.RemoveEmptyEntries);
}
public static string ParseFile(this string line)
{
var match = Regex.Match(line, "in (.+):line");
if (match.Groups.Count < 2) { return "[file]"; }
return match.Groups[1].Value;
}
public static string ParseMethodName(this string line)
{
// to extract the full method name (with namespace)
var match = Regex.Match(line, "at ([^)]+[)])");
if (match.Groups.Count < 2) { return "[method]"; }
return match.Groups[1].Value;
}
public static int ParseLineNumber(this string line)
{
var match = Regex.Match(line, ":line ([0-9]+)");
if (match.Groups.Count < 2) { return -1; }
return Convert.ToInt32(match.Groups[1].Value);
}
}
}
|
mit
|
C#
|
1d2733ddc810c0dd92c09c32d158c46df60ca7b2
|
add some comments and timeout parameter to send
|
vforteli/RadiusServer
|
Classes/RadiusClient.cs
|
Classes/RadiusClient.cs
|
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
namespace Flexinets.Radius
{
public class RadiusClient
{
private readonly UdpClient _udpClient;
private readonly RadiusDictionary _dictionary;
public RadiusClient(IPEndPoint localEndpoint, RadiusDictionary dictionary)
{
_udpClient = new UdpClient(localEndpoint);
_dictionary = dictionary;
}
/// <summary>
/// Send a packet with specified timeout
/// </summary>
/// <param name="packet"></param>
/// <param name="remoteEndpoint"></param>
/// <param name="timeout"></param>
/// <returns></returns>
public async Task<IRadiusPacket> SendPacketAsync(IRadiusPacket packet, IPEndPoint remoteEndpoint, TimeSpan timeout)
{
var packetBytes = packet.GetBytes(_dictionary);
await _udpClient.SendAsync(packetBytes, packetBytes.Length, remoteEndpoint);
Task.Run(() =>
{
Thread.Sleep(timeout);
_udpClient.Close();
});
// todo use events to create a common udpclient for multiple packets to enable sending and receiving without blocking
var response = await _udpClient.ReceiveAsync();
return RadiusPacket.ParseRawPacket(response.Buffer, _dictionary, packet.SharedSecret);
}
/// <summary>
/// Send a packet with default timeout of 3 seconds
/// </summary>
/// <param name="packet"></param>
/// <param name="remoteEndpoint"></param>
/// <returns></returns>
public async Task<IRadiusPacket> SendPacketAsync(IRadiusPacket packet, IPEndPoint remoteEndpoint)
{
return await SendPacketAsync(packet, remoteEndpoint, TimeSpan.FromSeconds(3));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Flexinets.Radius
{
public class RadiusClient
{
private readonly UdpClient _udpClient;
private readonly RadiusDictionary _dictionary;
private readonly List<Task<IRadiusPacket>> _tasks = new List<Task<IRadiusPacket>>();
public RadiusClient(IPEndPoint localEndpoint, RadiusDictionary dictionary)
{
_udpClient = new UdpClient(localEndpoint);
_dictionary = dictionary;
}
public async Task<IRadiusPacket> SendPacket(IRadiusPacket packet, IPEndPoint remoteEndpoint)
{
var packetBytes = packet.GetBytes(_dictionary);
await _udpClient.SendAsync(packetBytes, packetBytes.Length, remoteEndpoint);
Task.Run(() =>
{
Thread.Sleep(1000);
_udpClient.Close();
});
var response = await _udpClient.ReceiveAsync();
return RadiusPacket.ParseRawPacket(response.Buffer, _dictionary, Encoding.UTF8.GetBytes("secret"));
}
}
}
|
mit
|
C#
|
dff9958db34117dd9496cd74f99d1fea11873196
|
Update AutofacExtensions.cs
|
galaktor/autofac-extensions
|
AutofacExtensions.cs
|
AutofacExtensions.cs
|
using System;
using Autofac.Builder;
namespace Autofac
{
// TODO: move these into extra DLL within Autofac package! consider extra package if this grows into more...
public static class AutofacExtensions
{
/// <summary>
/// Forces resolve of a single instance of T. Useful for services that are not dependend on by any other component
/// but need to be instantiated in the system.
/// </summary>
/// <typeparam name="T">The type of the service.</typeparam>
/// <param name="b">The container builder used to register the service.</param>
public static IRegistrationBuilder<T, ConcreteReflectionActivatorData, SingleRegistrationStyle> RegisterAndActivate<T>(this ContainerBuilder b)
{
b.RegisterType<StartableBootstrap<T>>()
.As<IStartable>()
.SingleInstance();
return b.RegisterType<T>().As<T>();
}
/// <summary>
/// Forces resolve of a single instance of T. Useful for services that are not dependend on by any other component
/// but need to be instantiated in the system.
/// </summary>
/// <param name="b">The container builder used to register the service.</param>
/// <param name="c">A delegate that uses the context to create/resolve the component.</param>
/// <returns></returns>
public static IRegistrationBuilder<T, SimpleActivatorData, SingleRegistrationStyle> RegisterAndActivate<T>(this ContainerBuilder b, Func<IComponentContext,T> c)
{
b.RegisterType<StartableBootstrap<T>>()
.As<IStartable>()
.SingleInstance();
return b.Register(c).As<T>();
}
}
}
|
using System;
using Autofac.Builder;
namespace Autofac
{
// TODO: move these into extra DLL within Autofac package! consider extra package if this grows into more...
public static class AutofacExtensions
{
/// <summary>
/// Forces resolve of a single instance of T. Useful for services that are not dependend on by any other component
/// but need to be instantiated in the system.
/// </summary>
/// <typeparam name="T">The type of the service.</typeparam>
/// <param name="b">The container builder used to register the service.</param>
public static IRegistrationBuilder<T, ConcreteReflectionActivatorData, SingleRegistrationStyle> RegisterAndActivate<T>(this ContainerBuilder b)
{
b.RegisterType<StartableBootstrap<T>>()
.As<IStartable>()
.SingleInstance();
return b.RegisterType<T>();
}
/// <summary>
/// Forces resolve of a single instance of T. Useful for services that are not dependend on by any other component
/// but need to be instantiated in the system.
/// </summary>
/// <param name="b">The container builder used to register the service.</param>
/// <param name="c">A delegate that uses the context to create/resolve the component.</param>
/// <returns></returns>
public static IRegistrationBuilder<T, SimpleActivatorData, SingleRegistrationStyle> RegisterAndActivate<T>(this ContainerBuilder b, Func<IComponentContext,T> c)
{
b.RegisterType<StartableBootstrap<T>>()
.As<IStartable>()
.SingleInstance();
return b.Register(c);
}
}
}
|
mit
|
C#
|
c78421497eb3baaf0f50c244d638e91bc4021cd4
|
move logging middleware to capture api too
|
Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate
|
Sample.Host/Program.cs
|
Sample.Host/Program.cs
|
using System;
using System.Security.Claims;
using Ledger.Stores;
using Magistrate;
using Microsoft.Owin.Hosting;
using Serilog;
namespace Sample.Host
{
class Program
{
static void Main(string[] args)
{
var host = WebApp.Start("http://localhost:4444", app =>
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.ColoredConsole()
.CreateLogger();
app.Use(typeof(SerilogMiddleware));
//add a login provider here
//app.Use<WindowsAuthentication>();
app.UseMagistrateApi(config =>
{
config.EventStore = new InMemoryEventStore();
config.User = () =>
{
//e.g. take user from ClaimsPrincipal:
//var current = ClaimsPrincipal.Current;
//return new MagistrateUser
//{
// Name = current.Identity.Name,
// Key = current.Identity.Name.ToLower().Replace(" ", "")
//};
return new MagistrateUser
{
Name = "Andy Dote",
Key = "andy-dote"
};
};
});
var ui = new MagistrateWebInterface();
ui.Configure(app);
});
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
host.Dispose();
}
}
}
|
using System;
using System.Security.Claims;
using Ledger.Stores;
using Magistrate;
using Microsoft.Owin.Hosting;
using Serilog;
namespace Sample.Host
{
class Program
{
static void Main(string[] args)
{
var host = WebApp.Start("http://localhost:4444", app =>
{
//add a login provider here
//app.Use<WindowsAuthentication>();
app.UseMagistrateApi(config =>
{
config.EventStore = new InMemoryEventStore();
config.User = () =>
{
//e.g. take user from ClaimsPrincipal:
//var current = ClaimsPrincipal.Current;
//return new MagistrateUser
//{
// Name = current.Identity.Name,
// Key = current.Identity.Name.ToLower().Replace(" ", "")
//};
return new MagistrateUser
{
Name = "Andy Dote",
Key = "andy-dote"
};
};
});
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.ColoredConsole()
.CreateLogger();
app.Use(typeof(SerilogMiddleware));
var ui = new MagistrateWebInterface();
ui.Configure(app);
});
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
host.Dispose();
}
}
}
|
lgpl-2.1
|
C#
|
d77ca5e124fb77331983dabf6aee25ecaed9e6ca
|
Add a sample code with commented assignments
|
anjdreas/roslyn-analyzers
|
SampleConsoleApp/Program.cs
|
SampleConsoleApp/Program.cs
|
namespace SampleConsoleApp
{
internal static class Program
{
private static void Main()
{
// ObjectInitializer_AssignAll enable
var foo = new Foo
{
// Commented assignments after opening brace.
// PropCommented1 = 1,
// Assigned property, OK'ed by analyzer
PropAssigned = 1,
// Commented assignments just before closing brace
//PropCommented2 = ,
// PropCommented3=,
};
}
private class Foo
{
public int PropAssigned { get; set; }
public int PropCommented1 { get; set; }
public int PropCommented2 { get; set; }
public int PropCommented3 { get; set; }
public int PropUnassigned { get; set; }
}
}
}
|
namespace SampleConsoleApp
{
internal static class Program
{
private static void Main(string[] args)
{
// ObjectInitializer_AssignAll enable
var foo2 = new Foo
{
};
//Foo foo = new Foo
//{
// //PropInt = 1,
// // ObjectInitializer_AssignAll disable
// Bar = new Bar
// {
// //PropInt = 2
// }
//};
}
private class Foo
{
public int PropInt { get; set; }
public Bar Bar { get; internal set; }
}
private class Bar
{
public int PropInt { get; set; }
}
}
}
|
mit
|
C#
|
732417852fa45eb4b7315eb713f82e6bd867df22
|
Revert "Missing ; -.-"
|
TheScienceOfCode/Sibelius.Web,TheScienceOfCode/Sibelius.Web,TheScienceOfCode/Sibelius.Web
|
Sibelius.Web/Data/Global.cs
|
Sibelius.Web/Data/Global.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Sibelius.Web.Data
{
public static class Global
{
public static readonly string Connection =
Environment.GetEnvironmentVariable("CUSTOMCONNSTR_MONGOLAB_URI");
//"mongodb://localhost/tsoc";
public static readonly string DefaultMainImg =
Environment.GetEnvironmentVariable("APPSETTING_DEFAULT_MAINIMG_URL");
public const string IdProperty = "Id";
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Sibelius.Web.Data
{
public static class Global
{
public static readonly string Connection =
//Environment.GetEnvironmentVariable("CUSTOMCONNSTR_MONGOLAB_URI");
"mongodb://localhost/tsoc";
public static readonly string DefaultMainImg =
Environment.GetEnvironmentVariable("APPSETTING_DEFAULT_MAINIMG_URL");
public const string IdProperty = "Id";
}
}
|
mit
|
C#
|
4bcf1193affb0885ae9fe984ee53a8d91f2cf8db
|
Test new collaboration
|
bioepic-blake/RPG
|
RPG3/SkeletonWorrior.cs
|
RPG3/SkeletonWorrior.cs
|
using System;
namespace RPG3
{
public class SkeletonWorrior : enermy
{
public string weaponName { get; set; }
public SkeletonWorrior(string name, string WeaponS)
: base(name)
{
weaponName = WeaponS;
}
public void Ignore()
{
}
public override int _DamageSet()
{
_weaponDamage += 9;
return _weaponDamage;
}
public override int _HealthSet()
{
_health += 40;
return _health;
}
public override int _speedSet()
{
_speed += 5;
return _speed;
}
public override string ToString()
{
return $"enermy name = {_Name} {Environment.NewLine} health = {_health} {Environment.NewLine} speed = {_speed} {Environment.NewLine} weapon = {weaponName} {Environment.NewLine} weapon damage = {_weaponDamage}";
}
}
}
|
using System;
namespace RPG3
{
public class SkeletonWorrior : enermy
{
public string weaponName { get; set; }
public SkeletonWorrior(string name, string WeaponS)
:base(name)
{
weaponName = WeaponS;
}
public override int _DamageSet()
{
_weaponDamage += 9;
return _weaponDamage;
}
public override int _HealthSet()
{
_health += 40;
return _health;
}
public override int _speedSet()
{
_speed += 5;
return _speed;
}
public override string ToString()
{
return $"enermy name = {_Name} {Environment.NewLine} health = {_health} {Environment.NewLine} speed = {_speed} {Environment.NewLine} weapon = {weaponName} {Environment.NewLine} weapon damage = {_weaponDamage}";
}
}
}
|
mit
|
C#
|
6f39ee9bb2c83769cadcef69113bef59e1a248c1
|
add stats to the tests
|
RPCS3/discord-bot
|
Tests/LogParsingProfiler.cs
|
Tests/LogParsingProfiler.cs
|
using System;
using System.IO.Pipelines;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using CompatBot;
using CompatBot.EventHandlers.LogParsing;
using CompatBot.EventHandlers.LogParsing.ArchiveHandlers;
using CompatBot.EventHandlers.LogParsing.SourceHandlers;
using NUnit.Framework;
namespace Tests
{
[TestFixture]
public class LogParsingProfiler
{
private static readonly IArchiveHandler[] archiveHandlers =
{
new GzipHandler(),
new ZipHandler(),
new RarHandler(),
new SevenZipHandler(),
new PlainTextHandler(),
};
[Explicit("For performance profiling only")]
[TestCase(@"C:\Documents\Downloads\RPCS3(206)_perf_problem.log")]
public async Task Analyze(string path)
{
var cts = new CancellationTokenSource();
var source = await FileSource.DetectArchiveHandlerAsync(path, archiveHandlers).ConfigureAwait(false);
var pipe = new Pipe();
var fillPipeTask = source.FillPipeAsync(pipe.Writer, cts.Token);
var readPipeTask = LogParser.ReadPipeAsync(pipe.Reader, cts.Token);
var result = await readPipeTask.ConfigureAwait(false);
await fillPipeTask.ConfigureAwait(false);
result.TotalBytes = source.LogFileSize;
Config.Log.Debug("~~~~~~~~~~~~~~~~~~~~");
Config.Log.Debug("Extractor hit stats (CPU time, s / total hits):");
foreach (var (key, (count, time)) in result.ExtractorHitStats.OrderByDescending(kvp => kvp.Value.regexTime))
{
var ttime = TimeSpan.FromTicks(time).TotalSeconds;
var msg = $"{ttime:0.000}/{count} ({ttime / count:0.000000}): {key}";
if (count > 100000 || ttime > 20)
Config.Log.Fatal(msg);
else if (count > 10000 || ttime > 10)
Config.Log.Error(msg);
else if (count > 1000 || ttime > 5)
Config.Log.Warn(msg);
else if (count > 100 || ttime > 1)
Config.Log.Info(msg);
else
Config.Log.Debug(msg);
}
Config.Log.Debug("~~~~~~~~~~~~~~~~~~~~");
Assert.That(result.CompleteCollection, Is.Not.Null.And.Not.Empty);
}
}
}
|
using System.IO.Pipelines;
using System.Threading;
using System.Threading.Tasks;
using CompatBot.EventHandlers.LogParsing;
using CompatBot.EventHandlers.LogParsing.ArchiveHandlers;
using CompatBot.EventHandlers.LogParsing.SourceHandlers;
using NUnit.Framework;
namespace Tests
{
[TestFixture]
public class LogParsingProfiler
{
private static readonly IArchiveHandler[] archiveHandlers =
{
new GzipHandler(),
new ZipHandler(),
new RarHandler(),
new SevenZipHandler(),
new PlainTextHandler(),
};
[Explicit("For performance profiling only")]
[TestCase(@"C:\Documents\Downloads\RPCS3(206)_perf_problem.log")]
public async Task Analyze(string path)
{
var cts = new CancellationTokenSource();
var source = await FileSource.DetectArchiveHandlerAsync(path, archiveHandlers).ConfigureAwait(false);
var pipe = new Pipe();
var fillPipeTask = source.FillPipeAsync(pipe.Writer, cts.Token);
var readPipeTask = LogParser.ReadPipeAsync(pipe.Reader, cts.Token);
var result = await readPipeTask.ConfigureAwait(false);
await fillPipeTask.ConfigureAwait(false);
result.TotalBytes = source.LogFileSize;
Assert.That(result.CompleteCollection, Is.Not.Null.And.Not.Empty);
}
}
}
|
lgpl-2.1
|
C#
|
db00e53b349b627d6f8fd3b3b639e594286093d8
|
Add new status fields
|
Inumedia/SlackAPI
|
SlackAPI/UserProfile.cs
|
SlackAPI/UserProfile.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlackAPI
{
public class UserProfile
{
public string first_name;
public string last_name;
public string real_name;
public string email;
public string skype;
public string status_emoji;
public string status_text;
public string phone;
public string image_24;
public string image_32;
public string image_48;
public string image_72;
public string image_192;
public override string ToString()
{
return real_name;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlackAPI
{
public class UserProfile
{
public string first_name;
public string last_name;
public string real_name;
public string email;
public string skype;
public string phone;
public string image_24;
public string image_32;
public string image_48;
public string image_72;
public string image_192;
public override string ToString()
{
return real_name;
}
}
}
|
mit
|
C#
|
00658f992321a9290b65692de0effec7c12fec08
|
Disable running IL2CPU in process.
|
jp2masa/Cosmos,zarlo/Cosmos,tgiphil/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,trivalik/Cosmos,CosmosOS/Cosmos,tgiphil/Cosmos,jp2masa/Cosmos,CosmosOS/Cosmos,fanoI/Cosmos,trivalik/Cosmos,trivalik/Cosmos,jp2masa/Cosmos,CosmosOS/Cosmos,fanoI/Cosmos,fanoI/Cosmos,zarlo/Cosmos,tgiphil/Cosmos,zarlo/Cosmos
|
Users/Matthijs/DebugCompiler/MyEngine.cs
|
Users/Matthijs/DebugCompiler/MyEngine.cs
|
using System;
using System.IO;
using Cosmos.Build.Common;
using Cosmos.TestRunner.Core;
using NUnit.Framework;
namespace DebugCompiler
{
[TestFixture]
public class RunKernels
{
[TestCaseSource(typeof(MySource), nameof(MySource.ProvideData))]
public void Test(Type kernelToRun)
{
Environment.CurrentDirectory = Path.GetDirectoryName(typeof(RunKernels).Assembly.Location);
var xEngine = new Engine();
// Sets the time before an error is registered. For example if set to 60 then if a kernel runs for more than 60 seconds then
// that kernel will be marked as a failure and terminated
xEngine.AllowedSecondsInKernel = 300;
// If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are run.
xEngine.RunTargets.Add(RunTargetEnum.Bochs);
//xEngine.StartBochsDebugGui = false;
//xEngine.RunWithGDB = true;
// If you're working on the compiler (or other lower parts), you can choose to run the compiler in process
// one thing to keep in mind though, is that this only works with 1 kernel at a time!
//xEngine.RunIL2CPUInProcess = true;
xEngine.TraceAssembliesLevel = TraceAssemblies.User;
xEngine.EnableStackCorruptionChecks = true;
xEngine.StackCorruptionChecksLevel = StackCorruptionDetectionLevel.AllInstructions;
// Select kernels to be tested by adding them to the engine
xEngine.AddKernel(kernelToRun.Assembly.Location);
xEngine.OutputHandler = new TestOutputHandler();
Assert.IsTrue(xEngine.Execute());
}
private class TestOutputHandler : OutputHandlerFullTextBase
{
protected override void Log(string message)
{
TestContext.WriteLine(String.Concat(DateTime.Now.ToString("hh:mm:ss.ffffff "), new String(' ', mLogLevel * 2), message));
}
}
}
}
|
using System;
using System.IO;
using Cosmos.Build.Common;
using Cosmos.TestRunner.Core;
using NUnit.Framework;
namespace DebugCompiler
{
[TestFixture]
public class RunKernels
{
[TestCaseSource(typeof(MySource), nameof(MySource.ProvideData))]
public void Test(Type kernelToRun)
{
Environment.CurrentDirectory = Path.GetDirectoryName(typeof(RunKernels).Assembly.Location);
var xEngine = new Engine();
// Sets the time before an error is registered. For example if set to 60 then if a kernel runs for more than 60 seconds then
// that kernel will be marked as a failure and terminated
xEngine.AllowedSecondsInKernel = 300;
// If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are run.
xEngine.RunTargets.Add(RunTargetEnum.Bochs);
//xEngine.StartBochsDebugGui = false;
//xEngine.RunWithGDB = true;
// If you're working on the compiler (or other lower parts), you can choose to run the compiler in process
// one thing to keep in mind though, is that this only works with 1 kernel at a time!
xEngine.RunIL2CPUInProcess = true;
xEngine.TraceAssembliesLevel = TraceAssemblies.User;
xEngine.EnableStackCorruptionChecks = true;
xEngine.StackCorruptionChecksLevel = StackCorruptionDetectionLevel.AllInstructions;
// Select kernels to be tested by adding them to the engine
xEngine.AddKernel(kernelToRun.Assembly.Location);
xEngine.OutputHandler = new TestOutputHandler();
Assert.IsTrue(xEngine.Execute());
}
private class TestOutputHandler : OutputHandlerFullTextBase
{
protected override void Log(string message)
{
TestContext.WriteLine(String.Concat(DateTime.Now.ToString("hh:mm:ss.ffffff "), new String(' ', mLogLevel * 2), message));
}
}
}
}
|
bsd-3-clause
|
C#
|
e184ce9af8688dba3440a4d81cb5431640a52906
|
move declaration to top (#711)
|
MarkPieszak/aspnetcore-angular2-universal,MarkPieszak/aspnetcore-angular2-universal,MarkPieszak/aspnetcore-angular2-universal,MarkPieszak/aspnetcore-angular2-universal
|
Views/Shared/_Layout.cshtml
|
Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<base href="@(Url.Content("~/"))" />
<title>@ViewData["Title"]</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@Html.Raw(ViewData["Meta"])
@Html.Raw(ViewData["Links"])
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/0.8.2/css/flag-icon.min.css" />
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/all.js" integrity="sha384-xymdQtn1n3lH2wcu0qhcdaOpQwyoarkgLVxC/wZ5q7h9gHtxICrpcaSUfygqZGOe" crossorigin="anonymous"></script>
@Html.Raw(ViewData["Styles"])
<link rel="manifest" href="/manifest.json">
</head>
<body>
@RenderBody()
<!-- Here we're passing down any data to be used by grabbed and parsed by Angular -->
@Html.Raw(ViewData["TransferData"])
@Html.Raw(ViewData["Scripts"])
@RenderSection("scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<base href="@(Url.Content("~/"))" />
<title>@ViewData["Title"]</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@Html.Raw(ViewData["Meta"])
@Html.Raw(ViewData["Links"])
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/0.8.2/css/flag-icon.min.css" />
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/all.js" integrity="sha384-xymdQtn1n3lH2wcu0qhcdaOpQwyoarkgLVxC/wZ5q7h9gHtxICrpcaSUfygqZGOe" crossorigin="anonymous"></script>
@Html.Raw(ViewData["Styles"])
<link rel="manifest" href="/manifest.json">
</head>
<body>
@RenderBody()
<!-- Here we're passing down any data to be used by grabbed and parsed by Angular -->
@Html.Raw(ViewData["TransferData"])
@Html.Raw(ViewData["Scripts"])
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
93c805ba243ce19c504c228e5f2db0a38695eb85
|
revert gtk osx
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Program.cs
|
WalletWasabi.Gui/Program.cs
|
using Avalonia;
using AvalonStudio.Shell;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Logging;
namespace WalletWasabi.Gui
{
internal class Program
{
#pragma warning disable IDE1006 // Naming Styles
private static async Task Main(string[] args)
#pragma warning restore IDE1006 // Naming Styles
{
StatusBarViewModel statusBar = null;
try
{
Logger.SetFilePath(Path.Combine(Global.DataDir, "Logs.txt"));
#if RELEASE
Logger.SetMinimumLevel(LogLevel.Info);
Logger.SetModes(LogMode.File);
#else
Logger.SetMinimumLevel(LogLevel.Debug);
Logger.SetModes(LogMode.Debug, LogMode.Console, LogMode.File);
#endif
var configFilePath = Path.Combine(Global.DataDir, "Config.json");
var config = new Config(configFilePath);
await config.LoadOrCreateDefaultFileAsync();
Logger.LogInfo<Config>("Config is successfully initialized.");
Global.Initialize(config);
statusBar = new StatusBarViewModel(Global.Nodes.ConnectedNodes, Global.MemPoolService, Global.IndexDownloader);
MainWindowViewModel.Instance = new MainWindowViewModel(statusBar);
BuildAvaloniaApp()
.StartShellApp<AppBuilder, MainWindow>("Wasabi Wallet", new DefaultLayoutFactory(), () => MainWindowViewModel.Instance);
}
catch (Exception ex)
{
Logger.LogCritical<Program>(ex);
}
finally
{
statusBar?.Dispose();
await Global.DisposeAsync();
}
}
private static AppBuilder BuildAvaloniaApp()
{
return AppBuilder.Configure<App>().UsePlatformDetect().UseReactiveUI();
}
}
}
|
using Avalonia;
using AvalonStudio.Shell;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Logging;
namespace WalletWasabi.Gui
{
internal class Program
{
#pragma warning disable IDE1006 // Naming Styles
private static async Task Main(string[] args)
#pragma warning restore IDE1006 // Naming Styles
{
StatusBarViewModel statusBar = null;
try
{
Logger.SetFilePath(Path.Combine(Global.DataDir, "Logs.txt"));
#if RELEASE
Logger.SetMinimumLevel(LogLevel.Info);
Logger.SetModes(LogMode.File);
#else
Logger.SetMinimumLevel(LogLevel.Debug);
Logger.SetModes(LogMode.Debug, LogMode.Console, LogMode.File);
#endif
var configFilePath = Path.Combine(Global.DataDir, "Config.json");
var config = new Config(configFilePath);
await config.LoadOrCreateDefaultFileAsync();
Logger.LogInfo<Config>("Config is successfully initialized.");
Global.Initialize(config);
statusBar = new StatusBarViewModel(Global.Nodes.ConnectedNodes, Global.MemPoolService, Global.IndexDownloader);
MainWindowViewModel.Instance = new MainWindowViewModel(statusBar);
BuildAvaloniaApp()
.StartShellApp<AppBuilder, MainWindow>("Wasabi Wallet", new DefaultLayoutFactory(), () => MainWindowViewModel.Instance);
}
catch (Exception ex)
{
Logger.LogCritical<Program>(ex);
}
finally
{
statusBar?.Dispose();
await Global.DisposeAsync();
}
}
private static AppBuilder BuildAvaloniaApp()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return AppBuilder.Configure<App>().UseGtk3().UseSkia().UseReactiveUI();
}
return AppBuilder.Configure<App>().UsePlatformDetect().UseReactiveUI();
}
}
}
|
mit
|
C#
|
907bf70cd3c0fe466014e43a001f62c70bac3c8f
|
Change -> PropertyChange
|
afit/HVoIPM
|
StateUpdateEventArgs.cs
|
StateUpdateEventArgs.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using LothianProductions.VoIP.State;
namespace LothianProductions.VoIP {
public class StateUpdateEventArgs : EventArgs {
public StateUpdateEventArgs( IList<DevicePropertyChange> deviceChanges, IList<LinePropertyChange> lineChanges,
IList<CallPropertyChange> callChanges ) {
mDeviceStateChanges = deviceChanges;
mLineStateChanges = lineChanges;
mCallStateChanges = callChanges;
}
protected IList<DevicePropertyChange> mDeviceStateChanges;
public IList<DevicePropertyChange> DeviceStateChanges {
get{ return mDeviceStateChanges; }
}
protected IList<LinePropertyChange> mLineStateChanges;
public IList<LinePropertyChange> LineStateChanges {
get{ return mLineStateChanges; }
}
protected IList<CallPropertyChange> mCallStateChanges;
public IList<CallPropertyChange> CallStateChanges {
get{ return mCallStateChanges; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using LothianProductions.VoIP.State;
namespace LothianProductions.VoIP {
public class StateUpdateEventArgs : EventArgs {
public StateUpdateEventArgs( IList<DeviceChange> deviceChanges, IList<LineChange> lineChanges,
IList<CallChange> callChanges ) {
mDeviceStateChanges = deviceChanges;
mLineStateChanges = lineChanges;
mCallStateChanges = callChanges;
}
protected IList<DeviceChange> mDeviceStateChanges;
public IList<DeviceChange> DeviceStateChanges {
get{ return mDeviceStateChanges; }
}
protected IList<LineChange> mLineStateChanges;
public IList<LineChange> LineStateChanges {
get{ return mLineStateChanges; }
}
protected IList<CallChange> mCallStateChanges;
public IList<CallChange> CallStateChanges {
get{ return mCallStateChanges; }
}
}
}
|
mit
|
C#
|
cc324ee74f42ec89aeec3066f8b7095f9a16c512
|
Call correct overload of log.FatalAsync
|
mbrit/MetroLog,thomasgalliker/MetroLog,thomasgalliker/MetroLog,mbrit/MetroLog,onovotny/MetroLog,onovotny/MetroLog,mbrit/MetroLog,onovotny/MetroLog,thomasgalliker/MetroLog
|
MetroLog.Shared.WinRT/GlobalCrashHandler.cs
|
MetroLog.Shared.WinRT/GlobalCrashHandler.cs
|
extern alias pcl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
namespace MetroLog
{
public static class GlobalCrashHandler
{
public static void Configure()
{
Application.Current.UnhandledException += App_UnhandledException;
}
private static async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// unbind we're going to re-enter and don't want to loop...
Application.Current.UnhandledException -= App_UnhandledException;
// say we've handled this one. this allows our FATAL write to complete.
e.Handled = true;
// go...
var log = (ILoggerAsync)pcl::MetroLog.LogManagerFactory.DefaultLogManager.GetLogger<Application>();
await log.FatalAsync("The application crashed: " + e.Message, e);
// if we're aborting, fake a suspend to flush the targets...
await LazyFlushManager.FlushAllAsync(new LogWriteContext());
// abort the app here...
Application.Current.Exit();
}
}
}
|
extern alias pcl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
namespace MetroLog
{
public static class GlobalCrashHandler
{
public static void Configure()
{
Application.Current.UnhandledException += App_UnhandledException;
}
private static async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// unbind we're going to re-enter and don't want to loop...
Application.Current.UnhandledException -= App_UnhandledException;
// say we've handled this one. this allows our FATAL write to complete.
e.Handled = true;
// go...
var log = (ILoggerAsync)pcl::MetroLog.LogManagerFactory.DefaultLogManager.GetLogger<Application>();
await log.FatalAsync("The application crashed: " + e.Message, e.Exception);
// if we're aborting, fake a suspend to flush the targets...
await LazyFlushManager.FlushAllAsync(new LogWriteContext());
// abort the app here...
Application.Current.Exit();
}
}
}
|
mit
|
C#
|
f55dd05faa8ab85b815e805b896d317ccf0594c2
|
Fix test
|
zr40/kyru-dotnet,zr40/kyru-dotnet
|
Tests/KademliaIdTest.cs
|
Tests/KademliaIdTest.cs
|
using Kyru.Network;
using MbUnit.Framework;
namespace Tests
{
internal sealed class KademliaIdTest
{
[Test, ExpectedInvalidOperationException]
public void AllZeroIdMustNotHaveKademliaBucket()
{
var id = new KademliaId(new byte[20]);
id.KademliaBucket();
}
[Test]
public void TestKademliaBucket()
{
var bytes = new byte[20];
bytes[19] = 0xff;
var id = new KademliaId(bytes);
Assert.AreEqual(7, id.KademliaBucket());
bytes[19] = 0x89;
id = new KademliaId(bytes);
Assert.AreEqual(7, id.KademliaBucket());
bytes[19] = 0x01;
id = new KademliaId(bytes);
Assert.AreEqual(0, id.KademliaBucket());
bytes[19] = 0x74;
id = new KademliaId(bytes);
Assert.AreEqual(6, id.KademliaBucket());
bytes[10] = 0xff;
id = new KademliaId(bytes);
Assert.AreEqual(79, id.KademliaBucket());
bytes[0] = 0xff;
id = new KademliaId(bytes);
Assert.AreEqual(159, id.KademliaBucket());
}
[Test]
public void TestToString()
{
var bytes = new byte[20];
var id = new KademliaId(bytes);
// Length must be okay
Assert.AreEqual("0000000000000000000000000000000000000000", id.ToString().ToLower());
bytes[0] = 0xff;
id = new KademliaId(bytes);
Assert.AreEqual("ff00000000000000000000000000000000000000", id.ToString().ToLower());
bytes[0] = 0x00;
bytes[19] = 0xff;
id = new KademliaId(bytes);
Assert.AreEqual("00000000000000000000000000000000000000ff", id.ToString().ToLower());
}
}
}
|
using Kyru.Network;
using MbUnit.Framework;
namespace Tests
{
internal sealed class KademliaIdTest
{
[Test, ExpectedInvalidOperationException]
public void AllZeroIdMustNotHaveKademliaBucket()
{
var id = new KademliaId(new byte[20]);
id.KademliaBucket();
}
[Test]
public void TestKademliaBucket()
{
var bytes = new byte[20];
bytes[19] = 0xff;
var id = new KademliaId(bytes);
Assert.AreEqual(7, id.KademliaBucket());
bytes[19] = 0x89;
id = new KademliaId(bytes);
Assert.AreEqual(7, id.KademliaBucket());
bytes[19] = 0x01;
id = new KademliaId(bytes);
Assert.AreEqual(0, id.KademliaBucket());
bytes[19] = 0x74;
id = new KademliaId(bytes);
Assert.AreEqual(6, id.KademliaBucket());
bytes[10] = 0xff;
id = new KademliaId(bytes);
Assert.AreEqual(79, id.KademliaBucket());
bytes[0] = 0xff;
id = new KademliaId(bytes);
Assert.AreEqual(159, id.KademliaBucket());
}
[Test]
public void testToString() {
var bytes = new byte[20];
var id = new KademliaId(bytes);
// Length must be okay
Assert.AreEqual("00000000000000000000000000000000000000000000", id.ToString().ToLower());
bytes[0] = 0xff;
id = new KademliaId(bytes);
Assert.AreEqual("ff000000000000000000000000000000000000000000", id.ToString().ToLower());
bytes[0] = 0x00;
bytes[19] = 0xff;
id = new KademliaId(bytes);
Assert.AreEqual("000000000000000000000000000000000000000000ff", id.ToString().ToLower());
}
}
}
|
bsd-3-clause
|
C#
|
22b7f19cdd860476ae32ad55793408f0e9f824a7
|
Add missing methods
|
mausch/ReadOnlyCollections
|
ReadOnlyCollectionsInterfaces/Interfaces.cs
|
ReadOnlyCollectionsInterfaces/Interfaces.cs
|
using System;
namespace System.Collections.Generic {
#if NET40
public interface IReadOnlyCollection<out T> : IEnumerable<T> {
#elif NET20 || NET35
public interface IReadOnlyCollection<T> : IEnumerable<T> {
#endif
int Count { get; }
}
#if NET40
public interface IReadOnlyList<out T> : IReadOnlyCollection<T> {
#elif NET20 || NET35
public interface IReadOnlyList<T> : IReadOnlyCollection<T> {
#endif
T this[int index] { get; }
}
public interface IReadOnlyDictionary<TKey, TValue> : IReadOnlyCollection<KeyValuePair<TKey, TValue>> {
TValue this[TKey key] { get; }
IEnumerable<TKey> Keys { get; }
IEnumerable<TValue> Values { get; }
bool ContainsKey(TKey key);
bool TryGetValue(TKey key, out TValue value);
}
}
|
using System;
namespace System.Collections.Generic {
#if NET40
public interface IReadOnlyCollection<out T> : IEnumerable<T> {
#elif NET20 || NET35
public interface IReadOnlyCollection<T> : IEnumerable<T> {
#endif
int Count { get; }
}
#if NET40
public interface IReadOnlyList<out T> : IReadOnlyCollection<T> {
#elif NET20 || NET35
public interface IReadOnlyList<T> : IReadOnlyCollection<T> {
#endif
T this[int index] { get; }
}
public interface IReadOnlyDictionary<TKey, TValue> : IReadOnlyCollection<KeyValuePair<TKey, TValue>> {
TValue this[TKey key] { get; }
IEnumerable<TKey> Keys { get; }
IEnumerable<TValue> Values { get; }
}
}
|
apache-2.0
|
C#
|
7f6638b6d39447d733e83c820cff4b18df716009
|
Test was improved.
|
Nirklav/BinSerializer
|
Tests/SerializeTests.cs
|
Tests/SerializeTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;
using ThirtyNineEighty.BinSerializer;
namespace Tests
{
[TestClass]
public class SerializeTests
{
[Type("Test")]
class Test
{
[Field("a")]
public string StrField;
[Field("i")]
public int IntField;
[Field("b")]
public Test InnerField;
[Field("x")]
public TestStruct InnerStructField;
[Field("c")]
public int[] ArrayField;
[Field("g")]
public Test NullField;
[Field("n")]
public IJob InterfaceField;
}
[Type("TestStruct")]
struct TestStruct
{
[Field("b")]
public int IntField;
[Field("a")]
public float FloatField;
}
interface IJob
{
int JobId { get; }
}
[Type("Job")]
class Job : IJob
{
[Field("j")]
public int _jobId = 100;
public int JobId { get { return _jobId; } }
}
[TestMethod]
public void SerializeTest()
{
var test = new Test();
test.StrField = "str value";
test.IntField = 255;
test.InnerField = test;
test.InnerStructField = new TestStruct();
test.InnerStructField.IntField = 10;
test.InnerStructField.FloatField = 0.55f;
test.ArrayField = new int[] { 1, 3, 3, 7 };
test.InterfaceField = new Job();
var stream = new MemoryStream();
BinSerializer.Serialize(stream, test);
stream.Position = 0;
var test2 = BinSerializer.Deserialize<Test>(stream);
Assert.AreEqual(test.StrField, test2.StrField);
Assert.AreEqual(test.IntField, test2.IntField);
Assert.AreEqual(ReferenceEquals(test, test.InnerField), ReferenceEquals(test2, test2.InnerField));
Assert.AreEqual(test.InnerStructField.IntField, test2.InnerStructField.IntField);
Assert.AreEqual(test.InnerStructField.FloatField, test2.InnerStructField.FloatField);
Assert.AreEqual(test.ArrayField.Length, test2.ArrayField.Length);
for (int i = 0; i < test.ArrayField.Length; i++)
Assert.AreEqual(test.ArrayField[i], test2.ArrayField[i]);
Assert.AreEqual(test.NullField, test2.NullField);
Assert.AreEqual(((Job)test.InterfaceField).JobId, ((Job)test2.InterfaceField).JobId);
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;
using ThirtyNineEighty.BinSerializer;
namespace Tests
{
[TestClass]
public class SerializeTests
{
[Type("Test")]
class Test
{
[Field("a")]
public string StrField;
[Field("i")]
public int IntField;
[Field("b")]
public Test InnerField;
[Field("x")]
public TestStruct InnerStructField;
[Field("c")]
public int[] ArrayField;
}
[Type("TestStruct")]
struct TestStruct
{
[Field("b")]
public int IntField;
[Field("a")]
public float FloatField;
}
[TestMethod]
public void SerializeTest()
{
var test = new Test();
test.StrField = "str value";
test.IntField = 255;
test.InnerField = test;
test.InnerStructField = new TestStruct();
test.InnerStructField.IntField = 10;
test.InnerStructField.FloatField = 0.55f;
test.ArrayField = new int[] { 1, 3, 3, 7 };
var stream = new MemoryStream();
BinSerializer.Serialize(stream, test);
stream.Position = 0;
var test2 = BinSerializer.Deserialize<Test>(stream);
Assert.AreEqual(test.StrField, test2.StrField);
Assert.AreEqual(test.IntField, test2.IntField);
Assert.AreEqual(ReferenceEquals(test, test.InnerField), ReferenceEquals(test2, test2.InnerField));
Assert.AreEqual(test.InnerStructField.IntField, test2.InnerStructField.IntField);
Assert.AreEqual(test.InnerStructField.FloatField, test2.InnerStructField.FloatField);
Assert.AreEqual(test.ArrayField.Length, test2.ArrayField.Length);
for (int i = 0; i < test.ArrayField.Length; i++)
Assert.AreEqual(test.ArrayField[i], test2.ArrayField[i]);
}
}
}
|
mit
|
C#
|
7f8ab2352a6ff93938533ab811a9b73687505df3
|
add horizontal ruler
|
bjornhol/furry-bear,bjornhol/furry-bear,bjornhol/furry-bear
|
Views/Home/Index.cshtml
|
Views/Home/Index.cshtml
|
<div class="text-center">
<h3>Furry Bear</h3>
<hr/>
<p>Database connection: @ViewBag.Online</p>
</div>
|
<div class="text-center">
<h3>Furry Bear</h3>
<p>Database connection: @ViewBag.Online</p>
</div>
|
mit
|
C#
|
a9bc5be4cbe75893ba1248e79eaa012e2274f284
|
Make convlayer tests more complete
|
hiperz/ConvNetSharp,cbovar/ConvNetSharp
|
src/ConvNetSharp.Tests/ConvLayerTests.cs
|
src/ConvNetSharp.Tests/ConvLayerTests.cs
|
using NUnit.Framework;
namespace ConvNetSharp.Tests
{
[TestFixture]
public class ConvLayerTests
{
[Test]
public void GradientWrtInputCheck()
{
const int inputWidth = 30;
const int inputHeight = 30;
const int inputDepth = 2;
// Create layer
const int filterWidth = 3;
const int filterHeight = 3;
const int filterCount = 5;
var layer = new ConvLayer(filterWidth, filterHeight, filterCount) { Stride = 2};
GradientCheckTools.GradientCheck(layer, inputWidth, inputHeight, inputDepth);
}
[Test]
public void GradientWrtParametersCheck()
{
const int inputWidth = 10;
const int inputHeight = 10;
const int inputDepth = 2;
// Create layer
const int filterWidth = 3;
const int filterHeight = 3;
const int filterCount = 2;
var layer = new ConvLayer(filterWidth, filterHeight, filterCount) { Stride = 2 };
GradientCheckTools.GradienWrtParameterstCheck(inputWidth, inputHeight, inputDepth, layer);
}
}
}
|
using NUnit.Framework;
namespace ConvNetSharp.Tests
{
[TestFixture]
public class ConvLayerTests
{
[Test]
public void GradientWrtInputCheck()
{
const int inputWidth = 10;
const int inputHeight = 10;
const int inputDepth = 2;
// Create layer
const int filterWidth = 3;
const int filterHeight = 3;
const int filterCount = 2;
var layer = new ConvLayer(filterWidth, filterHeight, filterCount);
GradientCheckTools.GradientCheck(layer, inputWidth, inputHeight, inputDepth);
}
[Test]
public void GradientWrtParametersCheck()
{
const int inputWidth = 10;
const int inputHeight = 10;
const int inputDepth = 2;
// Create layer
const int filterWidth = 3;
const int filterHeight = 3;
const int filterCount = 2;
var layer = new ConvLayer(filterWidth, filterHeight, filterCount);
GradientCheckTools.GradienWrtParameterstCheck(inputWidth, inputHeight, inputDepth, layer);
}
}
}
|
mit
|
C#
|
108f4311720c9d991c8312db7571fbc712ec39b3
|
add includePatientCoUsers for appointmentsRequest
|
SnapMD/connectedcare-sdk,dhawalharsora/connectedcare-sdk
|
SnapMD.VirtualCare.ApiModels/Scheduling/AppointmentsRequest.cs
|
SnapMD.VirtualCare.ApiModels/Scheduling/AppointmentsRequest.cs
|
using System.Collections.Generic;
namespace SnapMD.VirtualCare.ApiModels.Scheduling
{
/// <summary>
/// Request model for Appointments search filter
/// </summary>
/// <seealso cref="SnapMD.VirtualCare.ApiModels.Scheduling.AvailabilityBlocksRequest" />
public class AppointmentsRequest : AvailabilityBlocksRequest
{
/// <summary>
/// The appointment type codes to be searched.
/// </summary>
/// <value>
/// The appointment type codes.
/// </value>
public AppointmentTypeCode[] AppointmentTypeCodes { get; set; }
/// <summary>
/// The appointment status codes to be searched.
/// </summary>
/// <value>
/// The appointment status codes.
/// </value>
public AppointmentStatusCode[] AppointmentStatusCodes { get; set; }
/// <summary>
/// The patient user identifier. Filters patient appointments.
/// </summary>
/// <value>
/// The patient user identifier.
/// </value>
public int? PatientUserId { get; set; }
/// <summary>
/// Patient Identifiers, Filter for searching appointments for list of patients.
/// </summary>
public int[] PatientIds { get; set; }
/// <summary>
/// Flag indicates search should include patient dependents or not.
/// </summary>
/// <value>
/// The include patient dependents.
/// </value>
public bool? IncludePatientDependents { get; set; }
/// <summary>
/// Flag indicates search should include patient co-users or not.
/// </summary>
/// <value>
/// The include patient co-userss.
/// </value>
public bool? IncludePatientCoUsers { get; set; }
}
}
|
using System.Collections.Generic;
namespace SnapMD.VirtualCare.ApiModels.Scheduling
{
/// <summary>
/// Request model for Appointments search filter
/// </summary>
/// <seealso cref="SnapMD.VirtualCare.ApiModels.Scheduling.AvailabilityBlocksRequest" />
public class AppointmentsRequest : AvailabilityBlocksRequest
{
/// <summary>
/// The appointment type codes to be searched.
/// </summary>
/// <value>
/// The appointment type codes.
/// </value>
public AppointmentTypeCode[] AppointmentTypeCodes { get; set; }
/// <summary>
/// The appointment status codes to be searched.
/// </summary>
/// <value>
/// The appointment status codes.
/// </value>
public AppointmentStatusCode[] AppointmentStatusCodes { get; set; }
/// <summary>
/// The patient user identifier. Filters patient appointments.
/// </summary>
/// <value>
/// The patient user identifier.
/// </value>
public int? PatientUserId { get; set; }
/// <summary>
/// Patient Identifiers, Filter for searching appointments for list of patients.
/// </summary>
public int[] PatientIds { get; set; }
/// <summary>
/// Flag indicates search should include patient dependents or not.
/// </summary>
/// <value>
/// The include patient dependents.
/// </value>
public bool? IncludePatientDependents { get; set; }
}
}
|
apache-2.0
|
C#
|
b71a73f8b054f3bb4f56139d3bf6d75cce0069d1
|
increment patch version,
|
jwChung/Experimentalism,jwChung/Experimentalism
|
build/CommonAssemblyInfo.cs
|
build/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.9.3")]
[assembly: AssemblyInformationalVersion("0.9.3")]
/*
* Version 0.9.3
*
* Removes an unnecessary guard clause in
* AutoFixtureFirstClassTheoremAttribute.
*/
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.9.2")]
[assembly: AssemblyInformationalVersion("0.9.2")]
/*
* Version 0.9.2
*
* Releases Experiment.AutoFixture with a new assembly to simplify
* transform files and hide irrelevant assemblies.
*/
|
mit
|
C#
|
3a45b388996980a72e2d8ae518dd59d6cbe5e05c
|
Fix insane oversight in `SynchronizationContext` implementation
|
smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework
|
osu.Framework/Threading/SchedulerSynchronizationContext.cs
|
osu.Framework/Threading/SchedulerSynchronizationContext.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.Threading;
#nullable enable
namespace osu.Framework.Threading
{
/// <summary>
/// A synchronisation context which posts all continuatiuons to a scheduler instance.
/// </summary>
internal class SchedulerSynchronizationContext : SynchronizationContext
{
private readonly Scheduler scheduler;
public SchedulerSynchronizationContext(Scheduler scheduler)
{
this.scheduler = scheduler;
}
public override void Send(SendOrPostCallback d, object? state) => scheduler.Add(() => d(state), false);
public override void Post(SendOrPostCallback d, object? state) => scheduler.Add(() => d(state), true);
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
#nullable enable
namespace osu.Framework.Threading
{
/// <summary>
/// A synchronisation context which posts all continuatiuons to a scheduler instance.
/// </summary>
internal class SchedulerSynchronizationContext : SynchronizationContext
{
private readonly Scheduler scheduler;
public SchedulerSynchronizationContext(Scheduler scheduler)
{
this.scheduler = scheduler;
}
public override void Post(SendOrPostCallback d, object? state) => scheduler.Add(() => d(state), false);
}
}
|
mit
|
C#
|
aedfdce87296abec5f9f572408de333bf0a9e8ed
|
Update values in calculator test
|
NeoAdonis/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,peppy/osu-new,smoogipoo/osu
|
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
|
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.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.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Osu.Difficulty;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest
{
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
[TestCase(6.6915334809485199d, "diffcalc-test")]
[TestCase(1.0366129190339499d, "zero-length-sliders")]
public void Test(double expected, string name)
=> base.Test(expected, name);
[TestCase(8.3966904501824473d, "diffcalc-test")]
[TestCase(1.2732783892964523d, "zero-length-sliders")]
public void TestClockRateAdjusted(double expected, string name)
=> Test(expected, name, new OsuModDoubleTime());
protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap);
protected override Ruleset CreateRuleset() => new OsuRuleset();
}
}
|
// 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.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Osu.Difficulty;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest
{
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
[TestCase(6.7568168283591499d, "diffcalc-test")]
[TestCase(1.0348244046058293d, "zero-length-sliders")]
public void Test(double expected, string name)
=> base.Test(expected, name);
[TestCase(8.4783236764532557d, "diffcalc-test")]
[TestCase(1.2708532136987165d, "zero-length-sliders")]
public void TestClockRateAdjusted(double expected, string name)
=> Test(expected, name, new OsuModDoubleTime());
protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap);
protected override Ruleset CreateRuleset() => new OsuRuleset();
}
}
|
mit
|
C#
|
9d95388b63208bfa8a9ec7971e58e8a8cd7adddc
|
Update unit test
|
sonvister/Binance
|
test/Binance.Tests/Api/RateLimiterTest.cs
|
test/Binance.Tests/Api/RateLimiterTest.cs
|
using Binance.Api;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Xunit;
namespace Binance.Tests.Api
{
public class RateLimiterTest
{
[Fact]
public void ConfigureThrows()
{
var rateLimiter = new RateLimiter();
Assert.Throws<ArgumentException>("count", () => rateLimiter.Configure(-1, TimeSpan.FromSeconds(1)));
Assert.Throws<ArgumentException>("count", () => rateLimiter.Configure(0, TimeSpan.FromSeconds(1)));
}
[Fact]
public void Configure()
{
const int count = 3;
var duration = TimeSpan.FromSeconds(3);
var enabled = !RateLimiter.EnabledDefault;
var rateLimiter = new RateLimiter
{
IsEnabled = enabled
};
rateLimiter.Configure(count, duration);
Assert.Equal(count, rateLimiter.Count);
Assert.Equal(duration, rateLimiter.Duration);
Assert.Equal(enabled, rateLimiter.IsEnabled);
}
[Fact]
public async Task RateLimit()
{
const int count = 3;
const int intervals = 2;
var rateLimiter = new RateLimiter
{
IsEnabled = true
};
rateLimiter.Configure(count, TimeSpan.FromSeconds(1));
var stopwatch = Stopwatch.StartNew();
for (var i = 0; i < count * intervals + 1; i++)
await rateLimiter.DelayAsync();
stopwatch.Stop();
Assert.True(stopwatch.ElapsedMilliseconds > rateLimiter.Duration.TotalMilliseconds * (intervals - 0.1));
Assert.False(stopwatch.ElapsedMilliseconds > rateLimiter.Duration.TotalMilliseconds * (intervals + 0.1));
}
}
}
|
using Binance.Api;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Xunit;
namespace Binance.Tests.Api
{
public class RateLimiterTest
{
[Fact]
public void ConfigureThrows()
{
var rateLimiter = new RateLimiter();
Assert.Throws<ArgumentException>("count", () => rateLimiter.Configure(-1, TimeSpan.FromSeconds(1)));
Assert.Throws<ArgumentException>("count", () => rateLimiter.Configure(0, TimeSpan.FromSeconds(1)));
}
[Fact]
public void Configure()
{
const int count = 3;
var duration = TimeSpan.FromSeconds(3);
var enabled = !RateLimiter.EnabledDefault;
var rateLimiter = new RateLimiter
{
IsEnabled = enabled
};
rateLimiter.Configure(count, duration);
Assert.Equal(count, rateLimiter.Count);
Assert.Equal(duration, rateLimiter.Duration);
Assert.Equal(enabled, rateLimiter.IsEnabled);
}
[Fact]
public async Task RateLimit()
{
const int count = 3;
const int intervals = 2;
var rateLimiter = new RateLimiter
{
IsEnabled = true
};
rateLimiter.Configure(count, TimeSpan.FromSeconds(1));
var stopwatch = Stopwatch.StartNew();
for (var i = 0; i < count * intervals + 1; i++)
await rateLimiter.DelayAsync();
stopwatch.Stop();
Assert.True(stopwatch.ElapsedMilliseconds > rateLimiter.Duration.TotalMilliseconds * intervals);
Assert.True(stopwatch.ElapsedMilliseconds < rateLimiter.Duration.TotalMilliseconds * (intervals + 0.5));
}
}
}
|
mit
|
C#
|
68cfa03584203785afd98f747dfb997d11d0f3b5
|
remove spurious readline at end of main program
|
ilovepi/Compiler,ilovepi/Compiler
|
compiler/Program/Program.cs
|
compiler/Program/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using compiler.frontend;
namespace Program
{
class Program
{
static void Main(string[] args)
{
Lexer l = new Lexer(@"..\..\testdata\big.txt");
Token t;
do
{
t = l.getNextToken();
Console.WriteLine( TokenHelper.printToken(t) );
} while (t != Token.EOF);
// necessary when testing on windows with visual studio
//Console.WriteLine("Press 'enter' to exit ....");
//Console.ReadLine();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using compiler.frontend;
namespace Program
{
class Program
{
static void Main(string[] args)
{
Lexer l = new Lexer(@"..\..\testdata\test029.txt");
Token t;
do
{
t = l.getNextToken();
Console.WriteLine( TokenHelper.printToken(t) );
} while (t != Token.EOF);
Console.WriteLine("Press 'enter' to exit ....");
Console.ReadLine();
}
}
}
|
mit
|
C#
|
ac11aa295230ba2da8f09847d44bcba8636788bc
|
Improve error handling when parsing ACL records
|
openchain/openchain
|
src/Openchain.Ledger/Validation/DynamicPermissionLayout.cs
|
src/Openchain.Ledger/Validation/DynamicPermissionLayout.cs
|
// Copyright 2015 Coinprism, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Openchain.Ledger.Validation
{
public class DynamicPermissionLayout : IPermissionsProvider
{
private readonly ITransactionStore store;
private readonly KeyEncoder keyEncoder;
public static string AclResourceName { get; } = "acl";
public DynamicPermissionLayout(ITransactionStore store, KeyEncoder keyEncoder)
{
this.store = store;
this.keyEncoder = keyEncoder;
}
public async Task<PermissionSet> GetPermissions(IReadOnlyList<SignatureEvidence> identities, LedgerPath path, bool recursiveOnly, string recordName)
{
PermissionSet currentPermissions = PermissionSet.Unset;
Record record = await this.store.GetRecord(new RecordKey(RecordType.Data, path, AclResourceName));
if (record.Value.Value.Count == 0)
return PermissionSet.Unset;
IReadOnlyList<Acl> permissions;
try
{
permissions = Acl.Parse(Encoding.UTF8.GetString(record.Value.ToByteArray()), path, keyEncoder);
}
catch (JsonReaderException)
{
return PermissionSet.Unset;
}
catch (InvalidOperationException)
{
return PermissionSet.Unset;
}
foreach (Acl acl in permissions)
{
if (acl.IsMatch(identities, path, recursiveOnly, recordName))
currentPermissions = currentPermissions.Add(acl.Permissions);
}
return currentPermissions;
}
}
}
|
// Copyright 2015 Coinprism, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Openchain.Ledger.Validation
{
public class DynamicPermissionLayout : IPermissionsProvider
{
private readonly ITransactionStore store;
private readonly KeyEncoder keyEncoder;
public static string AclResourceName { get; } = "acl";
public DynamicPermissionLayout(ITransactionStore store, KeyEncoder keyEncoder)
{
this.store = store;
this.keyEncoder = keyEncoder;
}
public async Task<PermissionSet> GetPermissions(IReadOnlyList<SignatureEvidence> identities, LedgerPath path, bool recursiveOnly, string recordName)
{
PermissionSet currentPermissions = PermissionSet.Unset;
Record record = await this.store.GetRecord(new RecordKey(RecordType.Data, path, AclResourceName));
if (record.Value.Value.Count == 0)
return PermissionSet.Unset;
IReadOnlyList<Acl> permissions;
try
{
permissions = Acl.Parse(Encoding.UTF8.GetString(record.Value.ToByteArray()), path, keyEncoder);
}
catch (JsonReaderException)
{
return PermissionSet.Unset;
}
foreach (Acl acl in permissions)
{
if (acl.IsMatch(identities, path, recursiveOnly, recordName))
currentPermissions = currentPermissions.Add(acl.Permissions);
}
return currentPermissions;
}
}
}
|
apache-2.0
|
C#
|
e1cd71b4809e02b6b631204f9259fa0e11d32f6e
|
Fix wrong type for linkbuttons
|
roman-yagodin/R7.HelpDesk,roman-yagodin/R7.HelpDesk
|
R7.HelpDesk/AdminSettings.ascx.designer.cs
|
R7.HelpDesk/AdminSettings.ascx.designer.cs
|
using System;
using System.Web.UI.WebControls;
namespace R7.HelpDesk
{
public partial class AdminSettings
{
protected Panel pnlAdminSettings;
protected Panel pnlAdministratorRole;
protected Panel pnlUploFilesPath;
protected Panel pnlTagsAdmin;
protected Panel pnlRoles;
protected Button btnAddNew;
protected Button btnUpdate;
protected LinkButton lnkAdminRole;
protected LinkButton lnkUploFilesPath;
protected LinkButton lnkTagsAdmin;
protected LinkButton lnkRoles;
protected DropDownList ddlAdminRole;
protected TextBox txtUploadedFilesPath;
protected DropDownList ddlUploadPermission;
protected TreeView tvCategories;
protected Label lblAdminRole;
protected Label lblUploadedFilesPath;
protected TextBox txtCategoryID;
protected DropDownList ddlParentCategory;
protected TextBox txtCategory;
protected CheckBox chkRequesterVisible;
protected CheckBox chkSelectable;
protected TextBox txtParentCategoryID;
protected Button btnDelete;
protected Label lblTagError;
protected Label lblRoleError;
protected DropDownList ddlRole;
protected ListView lvRoles;
}
}
|
using System;
using System.Web.UI.WebControls;
namespace R7.HelpDesk
{
public partial class AdminSettings
{
protected Panel pnlAdminSettings;
protected Panel pnlAdministratorRole;
protected Panel pnlUploFilesPath;
protected Panel pnlTagsAdmin;
protected Panel pnlRoles;
protected Button btnAddNew;
protected Button btnUpdate;
protected HyperLink lnkAdminRole;
protected HyperLink lnkUploFilesPath;
protected HyperLink lnkTagsAdmin;
protected HyperLink lnkRoles;
protected DropDownList ddlAdminRole;
protected TextBox txtUploadedFilesPath;
protected DropDownList ddlUploadPermission;
protected TreeView tvCategories;
protected Label lblAdminRole;
protected Label lblUploadedFilesPath;
protected TextBox txtCategoryID;
protected DropDownList ddlParentCategory;
protected TextBox txtCategory;
protected CheckBox chkRequesterVisible;
protected CheckBox chkSelectable;
protected TextBox txtParentCategoryID;
protected Button btnDelete;
protected Label lblTagError;
protected Label lblRoleError;
protected DropDownList ddlRole;
protected ListView lvRoles;
}
}
|
mit
|
C#
|
575b4ad81691588df3e2b83278bfc52d48a6b2aa
|
Make QueuedSender a partial class so we can extend it with Identity later on
|
mattgwagner/CertiPay.Common
|
CertiPay.Common.Notifications/Notifications/QueuedSender.cs
|
CertiPay.Common.Notifications/Notifications/QueuedSender.cs
|
using CertiPay.Common.Logging;
using CertiPay.Common.WorkQueue;
using System.Threading.Tasks;
namespace CertiPay.Common.Notifications
{
/// <summary>
/// Sends notifications to the background worker queue for async processing and retries
/// </summary>
public partial class QueuedSender :
INotificationSender<SMSNotification>,
INotificationSender<EmailNotification>
{
private static readonly ILog Log = LogManager.GetLogger<QueuedSender>();
private readonly IQueueManager _queue;
public QueuedSender(IQueueManager queue)
{
this._queue = queue;
}
public async Task SendAsync(EmailNotification notification)
{
Log.Info("Sending Notification via Queue {Queue}: {@Notification}", EmailNotification.QueueName, notification);
await _queue.Enqueue(EmailNotification.QueueName, notification);
}
public async Task SendAsync(SMSNotification notification)
{
Log.Info("Sending Notification via Queue {Queue}: {@Notification}", SMSNotification.QueueName, notification);
await _queue.Enqueue(SMSNotification.QueueName, notification);
}
}
}
|
using CertiPay.Common.Logging;
using CertiPay.Common.WorkQueue;
using System.Threading.Tasks;
namespace CertiPay.Common.Notifications
{
/// <summary>
/// Sends notifications to the background worker queue for async processing and retries
/// </summary>
public class QueuedSender :
//IIdentityMessageService,
INotificationSender<SMSNotification>,
INotificationSender<EmailNotification>
{
private static readonly ILog Log = LogManager.GetLogger<QueuedSender>();
private readonly IQueueManager _queue;
public QueuedSender(IQueueManager queue)
{
this._queue = queue;
}
public async Task SendAsync(EmailNotification notification)
{
Log.Info("Sending Notification via Queue {Queue}: {@Notification}", EmailNotification.QueueName, notification);
await _queue.Enqueue(EmailNotification.QueueName, notification);
}
public async Task SendAsync(SMSNotification notification)
{
Log.Info("Sending Notification via Queue {Queue}: {@Notification}", SMSNotification.QueueName, notification);
await _queue.Enqueue(SMSNotification.QueueName, notification);
}
//public async Task SendAsync(IdentityMessage message)
//{
// // TODO Add logging
// // TODO Might need a sanity check in here to make sure something doesn't go to the wrong format
// if (String.IsNullOrWhiteSpace(message.Subject))
// {
// await SendAsync(new SMSNotification
// {
// Recipients = new[]
// {
// message.Destination
// },
// Content = message.Body
// });
// }
// else
// {
// await SendAsync(new EmailNotification
// {
// FromAddress = EmailService.NO_REPLY_ADDR,
// Recipients = new[]
// {
// message.Destination
// },
// Subject = message.Subject,
// Content = message.Body
// });
// }
//}
}
}
|
mit
|
C#
|
fec3bbc6d1f79b0d8d9933af44bc9d16d89493d4
|
Change default repo path
|
MistyKuu/bitbucket-for-visual-studio,MistyKuu/bitbucket-for-visual-studio
|
Source/GitClientVS.Infrastructure/Paths.cs
|
Source/GitClientVS.Infrastructure/Paths.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitClientVS.Infrastructure
{
public static class Paths
{
public static string GitClientStorageDirectory => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"GitClientVSExtension");
public static string GitClientLogFilePath => Path.Combine(GitClientStorageDirectory, "Logs", "logs.txt");
public static string GitClientUserDataPath => Path.Combine(GitClientStorageDirectory, "User", "data.dat");
public static string GitClientProxyDataPath => Path.Combine(GitClientStorageDirectory, "User", "proxy.dat");
public static string DefaultRepositoryPath => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Source", "Repos");
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitClientVS.Infrastructure
{
public static class Paths
{
public static string GitClientStorageDirectory => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"GitClientVSExtension");
public static string GitClientLogFilePath => Path.Combine(GitClientStorageDirectory, "Logs", "logs.txt");
public static string GitClientUserDataPath => Path.Combine(GitClientStorageDirectory, "User", "data.dat");
public static string GitClientProxyDataPath => Path.Combine(GitClientStorageDirectory, "User", "proxy.dat");
public static string DefaultRepositoryPath => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Source", "Repos");
}
}
|
mit
|
C#
|
32e7d2916c44d6a9e9d69c6b63520cfd2b36cd79
|
read model db will migrate on start
|
andreyleskov/GridDomain,linkelf/GridDomain
|
GridDomain.Tests.Acceptance/BalloonDomain/BalloonContext.cs
|
GridDomain.Tests.Acceptance/BalloonDomain/BalloonContext.cs
|
using GridDomain.Tests.Common;
using GridDomain.Tests.Common.Configuration;
using Microsoft.EntityFrameworkCore;
namespace GridDomain.Tests.Acceptance.BalloonDomain
{
public class BalloonContext : DbContext
{
public BalloonContext() : base(
new DbContextOptionsBuilder().UseSqlServer(new AutoTestLocalDbConfiguration().ReadModelConnectionString).
Options)
{
Database.Migrate();
}
public BalloonContext(DbContextOptions connString) : base(connString)
{
Database.Migrate();
}
public DbSet<BalloonCatalogItem> BalloonCatalog { get; set; }
}
}
|
using GridDomain.Tests.Common;
using GridDomain.Tests.Common.Configuration;
using Microsoft.EntityFrameworkCore;
namespace GridDomain.Tests.Acceptance.BalloonDomain
{
public class BalloonContext : DbContext
{
public BalloonContext() : base(new DbContextOptionsBuilder().UseSqlServer(new AutoTestLocalDbConfiguration().ReadModelConnectionString).
Options) { }
public BalloonContext(DbContextOptions connString) : base(connString) { }
public DbSet<BalloonCatalogItem> BalloonCatalog { get; set; }
}
}
|
apache-2.0
|
C#
|
9c3138b67b74c89be81b7461efcff02ecd921928
|
Fix tests
|
ASP-NET-MVC-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates
|
Tests/Boxed.Templates.FunctionalTest/OrleansTemplateTest.cs
|
Tests/Boxed.Templates.FunctionalTest/OrleansTemplateTest.cs
|
namespace Boxed.Templates.FunctionalTest;
using System;
using System.Threading.Tasks;
using Boxed.DotnetNewTest;
using Xunit;
using Xunit.Abstractions;
[Trait("Template", "Orleans")]
public class OrleansTemplateTest
{
private const string TemplateName = "orleans";
private const string SolutionFileName = "OrleansTemplate.sln";
private static readonly string[] DefaultArguments = new string[]
{
"no-install-azurite-emulator=true",
"no-start-azurite-emulator=true",
"http-port={HTTP_PORT}",
};
public OrleansTemplateTest(ITestOutputHelper testOutputHelper)
{
ArgumentNullException.ThrowIfNull(testOutputHelper);
TestLogger.WriteMessage = testOutputHelper.WriteLine;
}
[Theory]
[Trait("IsUsingDocker", "false")]
[Trait("IsUsingDotnetRun", "false")]
[InlineData("OrleansNoSerilog", "logging=None")]
[InlineData("OrleansOpenTelemetry", "open-telemetry=true")]
[InlineData("OrleansGitHubContainerRegistry", "docker-registry=GitHubContainerRegistry")]
[InlineData("OrleansDockerHub", "docker-registry=DockerHub")]
public async Task RestoreBuild_OrleansDefaults_SuccessfulAsync(string name, params string[] arguments)
{
await InstallTemplateAsync().ConfigureAwait(false);
await using (var tempDirectory = TempDirectory.NewTempDirectory())
{
var project = await tempDirectory
.DotnetNewAsync(TemplateName, name, DefaultArguments.ToArguments(arguments))
.ConfigureAwait(false);
await project.DotnetRestoreAsync().ConfigureAwait(false);
await project.DotnetBuildAsync().ConfigureAwait(false);
}
}
[Theory]
[Trait("IsUsingDocker", "true")]
[Trait("IsUsingDotnetRun", "false")]
[InlineData("OrleansDefaults")]
[InlineData("OrleansNoDocker", "docker=false")]
public async Task Cake_ApiDefaults_SuccessfulAsync(string name, params string[] arguments)
{
await InstallTemplateAsync().ConfigureAwait(false);
await using (var tempDirectory = TempDirectory.NewTempDirectory())
{
var project = await tempDirectory
.DotnetNewAsync(TemplateName, name, DefaultArguments.ToArguments(arguments))
.ConfigureAwait(false);
await project.DotnetToolRestoreAsync().ConfigureAwait(false);
await project.DotnetCakeAsync(timeout: TimeSpan.FromMinutes(10)).ConfigureAwait(false);
}
}
private static Task InstallTemplateAsync() => DotnetNew.InstallAsync<OrleansTemplateTest>(SolutionFileName);
}
|
namespace Boxed.Templates.FunctionalTest;
using System;
using System.Threading.Tasks;
using Boxed.DotnetNewTest;
using Xunit;
using Xunit.Abstractions;
[Trait("Template", "Orleans")]
public class OrleansTemplateTest
{
private const string TemplateName = "orleans";
private const string SolutionFileName = "OrleansTemplate.sln";
private static readonly string[] DefaultArguments = new string[]
{
"no-install-storage-emulator=true",
"no-start-storage-emulator=true",
"http-port={HTTP_PORT}",
};
public OrleansTemplateTest(ITestOutputHelper testOutputHelper)
{
ArgumentNullException.ThrowIfNull(testOutputHelper);
TestLogger.WriteMessage = testOutputHelper.WriteLine;
}
[Theory]
[Trait("IsUsingDocker", "false")]
[Trait("IsUsingDotnetRun", "false")]
[InlineData("OrleansNoSerilog", "logging=None")]
[InlineData("OrleansOpenTelemetry", "open-telemetry=true")]
[InlineData("OrleansGitHubContainerRegistry", "docker-registry=GitHubContainerRegistry")]
[InlineData("OrleansDockerHub", "docker-registry=DockerHub")]
public async Task RestoreBuild_OrleansDefaults_SuccessfulAsync(string name, params string[] arguments)
{
await InstallTemplateAsync().ConfigureAwait(false);
await using (var tempDirectory = TempDirectory.NewTempDirectory())
{
var project = await tempDirectory
.DotnetNewAsync(TemplateName, name, DefaultArguments.ToArguments(arguments))
.ConfigureAwait(false);
await project.DotnetRestoreAsync().ConfigureAwait(false);
await project.DotnetBuildAsync().ConfigureAwait(false);
}
}
[Theory]
[Trait("IsUsingDocker", "true")]
[Trait("IsUsingDotnetRun", "false")]
[InlineData("OrleansDefaults")]
[InlineData("OrleansNoDocker", "docker=false")]
public async Task Cake_ApiDefaults_SuccessfulAsync(string name, params string[] arguments)
{
await InstallTemplateAsync().ConfigureAwait(false);
await using (var tempDirectory = TempDirectory.NewTempDirectory())
{
var project = await tempDirectory
.DotnetNewAsync(TemplateName, name, DefaultArguments.ToArguments(arguments))
.ConfigureAwait(false);
await project.DotnetToolRestoreAsync().ConfigureAwait(false);
await project.DotnetCakeAsync(timeout: TimeSpan.FromMinutes(10)).ConfigureAwait(false);
}
}
private static Task InstallTemplateAsync() => DotnetNew.InstallAsync<OrleansTemplateTest>(SolutionFileName);
}
|
mit
|
C#
|
ae10d36fb05efabcc0812ddc8e73667a6ed00336
|
remove 1.x language detection path (#3420)
|
quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot
|
plugin/CactbotEventSource/FFXIVPlugin.cs
|
plugin/CactbotEventSource/FFXIVPlugin.cs
|
using Advanced_Combat_Tracker;
using System;
using CactbotEventSource.loc;
namespace Cactbot {
public class FFXIVPlugin {
private ILogger logger_;
public FFXIVPlugin(ILogger logger) {
logger_ = logger;
}
public string GetLocaleString() {
switch (GetLanguageId()) {
case 1:
return "en";
case 2:
return "fr";
case 3:
return "de";
case 4:
return "ja";
case 5:
return "cn";
case 6:
return "ko";
default:
return null;
}
}
public int GetLanguageId() {
IActPluginV1 ffxiv_plugin = null;
foreach (var plugin in ActGlobals.oFormActMain.ActPlugins) {
// Skip disabled and unloaded plugins.
if (plugin.pluginObj == null)
continue;
var file = plugin.pluginFile.Name;
if (file == "FFXIV_ACT_Plugin.dll") {
if (ffxiv_plugin != null) {
logger_.LogWarning(Strings.MultiplePluginsLoadedErrorMessage);
}
ffxiv_plugin = plugin.pluginObj;
}
}
if (ffxiv_plugin == null) {
logger_.LogError(Strings.NoFFXIVACTPluginFoundErrorMessage);
return 0;
}
try {
// Cannot "just" cast to FFXIV_ACT_Plugin.FFXIV_ACT_Plugin here, because
// ACT uses LoadFrom which places the assembly into its own loading
// context. Use dynamic here to make this choice at runtime.
dynamic plugin_derived = ffxiv_plugin;
return (int)plugin_derived.DataRepository.GetSelectedLanguageID();
} catch (Exception e) {
logger_.LogError(Strings.DeterminingLanguageErrorMessage, e.ToString());
return 0;
}
}
}
}
|
using Advanced_Combat_Tracker;
using System;
using CactbotEventSource.loc;
namespace Cactbot {
public class FFXIVPlugin {
private ILogger logger_;
public FFXIVPlugin(ILogger logger) {
logger_ = logger;
}
public string GetLocaleString() {
switch (GetLanguageId()) {
case 1:
return "en";
case 2:
return "fr";
case 3:
return "de";
case 4:
return "ja";
case 5:
return "cn";
case 6:
return "ko";
default:
return null;
}
}
public int GetLanguageId() {
IActPluginV1 ffxiv_plugin = null;
foreach (var plugin in ActGlobals.oFormActMain.ActPlugins) {
// Skip disabled and unloaded plugins.
if (plugin.pluginObj == null)
continue;
var file = plugin.pluginFile.Name;
if (file == "FFXIV_ACT_Plugin.dll") {
if (ffxiv_plugin != null) {
logger_.LogWarning(Strings.MultiplePluginsLoadedErrorMessage);
}
ffxiv_plugin = plugin.pluginObj;
}
}
if (ffxiv_plugin == null) {
logger_.LogError(Strings.NoFFXIVACTPluginFoundErrorMessage);
return 0;
}
// Cannot "just" cast to FFXIV_ACT_Plugin.FFXIV_ACT_Plugin here, because
// ACT uses LoadFrom which places the assembly into its own loading
// context. Use dynamic here to make this choice at runtime.
// ffxiv plugin 1.x path
try {
dynamic plugin_derived = ffxiv_plugin;
return (int)plugin_derived.Settings.GetParseSettings().LanguageID;
} catch (Exception) {
}
// ffxiv plugin 2.x path
try {
// Cannot "just" cast to FFXIV_ACT_Plugin.FFXIV_ACT_Plugin here, because
// ACT uses LoadFrom which places the assembly into its own loading
// context. Use dynamic here to make this choice at runtime.
dynamic plugin_derived = ffxiv_plugin;
return (int)plugin_derived.DataRepository.GetSelectedLanguageID();
} catch (Exception e) {
logger_.LogError(Strings.DeterminingLanguageErrorMessage, e.ToString());
return 0;
}
}
}
}
|
apache-2.0
|
C#
|
885900435a10db81f00cff05196fe38410d885c6
|
Fix typo
|
kgiszewski/BasecampApiNet,kgiszewski/BasecampApiNet
|
src/BasecampApiNet/Models/TodoResultModel.cs
|
src/BasecampApiNet/Models/TodoResultModel.cs
|
using System;
using Newtonsoft.Json;
namespace BasecampApiNet.Models
{
public class TodoResultModel : ResultModelBase
{
[JsonProperty("todolist_id")]
public int TodoListId { get; set; }
[JsonProperty("position")]
public int Position { get; set; }
[JsonProperty("content")]
public string Content { get; set; }
[JsonProperty("due_at")]
public DateTime? DueAt { get; set; }
[JsonProperty("due_on")]
public DateTime? DueOn { get; set; }
[JsonProperty("completed_at")]
public bool IsCompleted { get; set; }
[JsonProperty("comments_count")]
public int CommentsCount { get; set; }
[JsonProperty("private")]
public bool IsPrivate { get; set; }
[JsonProperty("trashed")]
public bool IsTrashed { get; set; }
[JsonProperty("todolist")]
public string TodoList { get; set; }
[JsonProperty("creator")]
public CreatorModel Creator { get; set; }
[JsonProperty("assignee")]
public AssigneeModel AssigneeModel { get; set; }
}
}
|
using System;
using Newtonsoft.Json;
namespace BasecampApiNet.Models
{
public class TodoResultModel : ResultModelBase
{
[JsonProperty("todolist_id")]
public int TodoListId { get; set; }
[JsonProperty("position")]
public int Position { get; set; }
[JsonProperty("content")]
public string Content { get; set; }
[JsonProperty("due_at")]
public DateTime? DueAt { get; set; }
[JsonProperty("due_on")]
public DateTime? DueOn { get; set; }
[JsonProperty("completed_at")]
public bool IsCompleted { get; set; }
[JsonProperty("comments_count")]
public int CommentsCount { get; set; }
[JsonProperty("private")]
public bool IsPrivate { get; set; }
[JsonProperty("trashed")]
public bool IsTrashed { get; set; }
[JsonProperty("totolist")]
public string TodoList { get; set; }
[JsonProperty("creator")]
public CreatorModel Creator { get; set; }
[JsonProperty("assignee")]
public AssigneeModel AssigneeModel { get; set; }
}
}
|
mit
|
C#
|
f3d75dd862cd6f85604990537dc908cfa1936e8a
|
Fix bug with slow loading high scores
|
vlesierse/codebreaker,vlesierse/codebreaker,vlesierse/codebreaker
|
src/CodeBreaker.WebApp/Storage/ScoreStore.cs
|
src/CodeBreaker.WebApp/Storage/ScoreStore.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CodeBreaker.Core;
using CodeBreaker.Core.Storage;
using Microsoft.EntityFrameworkCore;
namespace CodeBreaker.WebApp.Storage
{
public class ScoreStore : IScoreStore
{
private readonly CodeBreakerDbContext _dbContext;
public ScoreStore(CodeBreakerDbContext dbContext)
{
_dbContext = dbContext;
}
public Task<Score[]> GetScores(int page, int size)
{
return _dbContext.Scores
.OrderBy(s => s.Attempts)
.ThenBy(s => s.Duration)
.Skip(page * size).Take(size)
.ToArrayAsync();
}
public async Task SaveScore(Score score)
{
await _dbContext.Scores.AddAsync(score);
await _dbContext.SaveChangesAsync();
}
public Task<bool> ScoreExists(Guid gameId)
{
return _dbContext.Scores.AnyAsync(s => s.GameId == gameId);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CodeBreaker.Core;
using CodeBreaker.Core.Storage;
using Microsoft.EntityFrameworkCore;
namespace CodeBreaker.WebApp.Storage
{
public class ScoreStore : IScoreStore
{
private readonly CodeBreakerDbContext _dbContext;
public ScoreStore(CodeBreakerDbContext dbContext)
{
_dbContext = dbContext;
}
public async Task<Score[]> GetScores(int page, int size)
{
return (await _dbContext.Scores.ToListAsync())
.OrderBy(s => s.Attempts)
.ThenBy(s => s.Duration)
.Skip(page * size).Take(size)
.ToArray();
}
public async Task SaveScore(Score score)
{
await _dbContext.Scores.AddAsync(score);
await _dbContext.SaveChangesAsync();
}
public Task<bool> ScoreExists(Guid gameId)
{
return _dbContext.Scores.AnyAsync(s => s.GameId == gameId);
}
}
}
|
mit
|
C#
|
251930ce5ff97dbe21db6478086abd44fad2168a
|
Check for active connections in each iteration
|
oschwald/HttpMock,mattolenik/HttpMock,hibri/HttpMock,zhdusurfin/HttpMock
|
src/HttpMock.Integration.Tests/PortHelper.cs
|
src/HttpMock.Integration.Tests/PortHelper.cs
|
using System;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
namespace HttpMock.Integration.Tests
{
internal static class PortHelper
{
internal static int FindLocalAvailablePortForTesting()
{
const int minPort = 1024;
var random = new Random();
var maxPort = 64000;
var randomPort = random.Next(minPort, maxPort);
while (IsPortInUse(randomPort))
{
randomPort = random.Next(minPort, maxPort);
}
return randomPort;
}
private static bool IsPortInUse(int randomPort)
{
var properties = IPGlobalProperties.GetIPGlobalProperties();
return properties.GetActiveTcpConnections().Any(a => a.LocalEndPoint.Port == randomPort) && properties.GetActiveTcpListeners().Any( a=> a.Port == randomPort);
}
}
}
|
using System;
using System.Linq;
using System.Net.NetworkInformation;
namespace HttpMock.Integration.Tests
{
internal static class PortHelper
{
internal static int FindLocalAvailablePortForTesting()
{
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
var activeTcpConnections = properties.GetActiveTcpConnections();
const int minPort = 1024;
var random = new Random();
var maxPort = 64000;
var randomPort = random.Next(minPort, maxPort);
while (activeTcpConnections.Any(a => a.LocalEndPoint.Port == randomPort))
{
randomPort = random.Next(minPort, maxPort);
}
return randomPort;
}
}
}
|
mit
|
C#
|
024768d7ebb4c1ecf1bd6397a0a364965f2f9d0a
|
Switch over support commands from using the query class
|
modulexcite/ZocMon,ZocDoc/ZocMon,ZocDoc/ZocMon,ZocDoc/ZocMon,modulexcite/ZocMon,modulexcite/ZocMon
|
ZocMon/ZocMon/ZocMonLib/Framework/StorageCommandsSupport.cs
|
ZocMon/ZocMon/ZocMonLib/Framework/StorageCommandsSupport.cs
|
using System.Data;
using System.Linq;
namespace ZocMonLib
{
public class StorageCommandsSupport : IStorageCommandsSupport
{
public string SelectCurrentReduceStatus(IDbConnection conn)
{
const string sql = @"SELECT TOP(1) IsReducing FROM Settings";
var result = DatabaseSqlHelper.Query<bool>(conn, sql);
if (result.Any())
return result.First() ? "1" : "0";
return "";
}
public void UpdateCurrentReduceStatus(string value, IDbConnection conn)
{
//TODO this doesn't take into account if it doesn't exist
const string sql = @"UPDATE Settings SET IsReducing = @isReducing";
DatabaseSqlHelper.Execute(conn, sql, param: new { isReducing = value == "1" });
}
}
}
|
using System.Data;
using System.Linq;
namespace ZocMonLib
{
public class StorageCommandsSupport : IStorageCommandsSupport
{
public string SelectCurrentReduceStatus(IDbConnection conn)
{
var result = DatabaseSqlHelper.CreateListWithConnection<bool>(conn, StorageCommandsSqlServerQuery.CurrentlyReducingSql);
if (result.Any())
return result.First() ? "1" : "0";
return "";
}
public void UpdateCurrentReduceStatus(string value, IDbConnection conn)
{
DatabaseSqlHelper.ExecuteNonQueryWithConnection(conn, StorageCommandsSqlServerQuery.UpdateReducingSql, new { IsReducing = value == "1" });
}
}
}
|
apache-2.0
|
C#
|
f0fb4220b5cfc0656466f2ed9f551d0365fd9105
|
Fix documentation confusion in a similar way to r3a00fecf9d42.
|
zaccharles/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,nodatime/nodatime,nodatime/nodatime,BenJenkinson/nodatime,zaccharles/nodatime,zaccharles/nodatime,malcolmr/nodatime,malcolmr/nodatime,zaccharles/nodatime,zaccharles/nodatime,jskeet/nodatime,zaccharles/nodatime,malcolmr/nodatime,jskeet/nodatime
|
src/NodaTime/Annotations/MutableAttribute.cs
|
src/NodaTime/Annotations/MutableAttribute.cs
|
// Copyright 2013 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
namespace NodaTime.Annotations
{
/// <summary>
/// Indicates that a type is mutable. Some members of this type
/// allow state to be visibly changed.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
internal sealed class MutableAttribute : Attribute
{
}
}
|
// Copyright 2013 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
namespace NodaTime.Annotations
{
/// <summary>
/// Indicates that a type is immutable. Some members of this type
/// allow state to be visibly changed.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
internal sealed class MutableAttribute : Attribute
{
}
}
|
apache-2.0
|
C#
|
9712e000abee4a5f0898d91ff491daf2d8ecbb31
|
Update PackagedProduct.cs
|
ADAPT/ADAPT
|
source/ADAPT/Products/PackagedProduct.cs
|
source/ADAPT/Products/PackagedProduct.cs
|
/*******************************************************************************
* Copyright (C) 2020 AgGateway and ADAPT Contributors
* Copyright (C) 2020 Syngenta
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contributors:
* R. Andres Ferreyra - initial implementation based on ProductStatusEnum class.
* *******************************************************************************/
using System.Collections.Generic;
using AgGateway.ADAPT.ApplicationDataModel.Common;
using AgGateway.ADAPT.ApplicationDataModel.Representations;
namespace AgGateway.ADAPT.ApplicationDataModel.Products
{
public class PackagedProduct
{
public PackagedProduct()
{
Id = CompoundIdentifierFactory.Instance.Create();
ContainedPackagedProducts = new List(ContainedPackagedProduct);
ContextItems = new List<ContextItem>();
}
public CompoundIdentifier Id { get; private set; }
public string Description { get; set; }
public int ProductId { get; set; }
public int ContainerModelId { get; set; }
public PackagedProductStatusEnum Status { get; set; }
public NumericRepresentationValue ProductQuantity { get; set; }
public List<ContainedPackagedProduct> ContainedPackagedProducts { get; set; }
public NumericRepresentationValue GrossWeight { get; set; }
public NumericRepresentationValue NetWeight { get; set; }
public List<ContextItem> ContextItems { get; set; }
}
}
|
/*******************************************************************************
* Copyright (C) 2020 AgGateway and ADAPT Contributors
* Copyright (C) 2020 Syngenta
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contributors:
* R. Andres Ferreyra - initial implementation based on ProductStatusEnum class.
* *******************************************************************************/
using System.Collections.Generic;
using AgGateway.ADAPT.ApplicationDataModel.Common;
using AgGateway.ADAPT.ApplicationDataModel.Representations;
namespace AgGateway.ADAPT.ApplicationDataModel.Products
{
public class PackagedProduct
{
public PackagedProduct()
{
Id = CompoundIdentifierFactory.Instance.Create();
ContainedPackagedProducts = new List(ContainedPackageProduct);
ContextItems = new List<ContextItem>();
}
public CompoundIdentifier Id { get; private set; }
public string Description { get; set; }
public int ProductId { get; set; }
public int ContainerModelId { get; set; }
public PackagedProductStatusEnum Status { get; set; }
public NumericRepresentationValue ProductQuantity { get; set; }
public List<ContainedPackagedProduct> ContainedPackagedProducts { get; set; }
public NumericRepresentationValue GrossWeight { get; set; }
public NumericRepresentationValue NetWeight { get; set; }
public List<ContextItem> ContextItems { get; set; }
}
}
|
epl-1.0
|
C#
|
ecd47d28f9f168e94704baf0775089c2f02e3a50
|
Initialize GitRepositoryConfigurer with an IGitExecutor
|
appharbor/appharbor-cli
|
src/AppHarbor/GitRepositoryConfigurer.cs
|
src/AppHarbor/GitRepositoryConfigurer.cs
|
namespace AppHarbor
{
public class GitRepositoryConfigurer
{
private readonly IGitExecutor _executor;
public GitRepositoryConfigurer(IGitExecutor executor)
{
_executor = executor;
}
}
}
|
namespace AppHarbor
{
public class GitRepositoryConfigurer
{
}
}
|
mit
|
C#
|
9bdd59d50efb62e128fc1d047302d2d18cbc216d
|
Mark ParseError.message as readonly
|
arlobelshee/Fools.net,Minions/Fools.net,JayBazuzi/Fools.net
|
src/Core/Gibberish/Parsing/ParseError.cs
|
src/Core/Gibberish/Parsing/ParseError.cs
|
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
namespace Gibberish
{
public class ParseError
{
[StringFormatMethod("baseMesage")]
private ParseError([NotNull] string baseMessage, [NotNull] params object[] messageParams)
{
message = string.Format(baseMessage, messageParams);
}
public static ParseError UnknownLanguage(IEnumerable<char> lang)
{
return new ParseError(UiStrings.UnknownLanguage, new string(lang.ToArray()), KnownLanguages.ToSetDisplayString());
}
public readonly string message;
public static ParseError MissingThunkName()
{
return new ParseError(UiStrings.MissingDefineThunkName);
}
[NotNull] private static readonly string[] KnownLanguages = {
"fasm"
};
}
}
|
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
namespace Gibberish
{
public class ParseError
{
[StringFormatMethod("baseMesage")]
private ParseError([NotNull] string baseMessage, [NotNull] params object[] messageParams)
{
message = string.Format(baseMessage, messageParams);
}
public static ParseError UnknownLanguage(IEnumerable<char> lang)
{
return new ParseError(UiStrings.UnknownLanguage, new string(lang.ToArray()), KnownLanguages.ToSetDisplayString());
}
public string message;
public static ParseError MissingThunkName()
{
return new ParseError(UiStrings.MissingDefineThunkName);
}
[NotNull] private static readonly string[] KnownLanguages = {
"fasm"
};
}
}
|
bsd-3-clause
|
C#
|
995318ecf3d6508bcc233326ad1fb7e60f2e6e0b
|
Fix inline cache assignment issue
|
stevedesmond-ca/dotnet-libyear
|
src/LibYear.Lib/PackageVersionChecker.cs
|
src/LibYear.Lib/PackageVersionChecker.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using LibYear.Lib.FileTypes;
using NuGet.Common;
using NuGet.Protocol.Core.Types;
namespace LibYear.Lib
{
public class PackageVersionChecker : IPackageVersionChecker
{
private readonly PackageMetadataResource _metadataResource;
private readonly IDictionary<string, IList<Release>> _versionCache;
public PackageVersionChecker(PackageMetadataResource metadataResource, IDictionary<string, IList<Release>> versionCache)
{
_metadataResource = metadataResource;
_versionCache = versionCache;
}
public IDictionary<IProjectFile, IEnumerable<Result>> GetPackages(IEnumerable<IProjectFile> projectFiles)
=> projectFiles.ToDictionary(proj => proj, proj => AwaitResults(proj.Packages.Select(p => GetResultTask(p.Key, p.Value))));
public static IEnumerable<Result> AwaitResults(IEnumerable<Task<Result>> resultsTasks)
{
var tasks = resultsTasks.ToArray();
Task.WaitAll(tasks);
return tasks.Select(t => t.Result);
}
public async Task<Result> GetResultTask(string packageName, PackageVersion installed)
{
if (!_versionCache.ContainsKey(packageName))
{
_versionCache[packageName] = await GetVersions(packageName);
}
var versions = _versionCache[packageName];
var current = versions.FirstOrDefault(v => v.Version == installed);
var latest = versions.FirstOrDefault(v => v.Version == versions.Where(m => !m.Version.IsPrerelease && m.IsPublished).Max(m => m.Version));
if (installed?.IsWildcard ?? false)
{
current = latest;
}
return new Result(packageName, current, latest);
}
public async Task<IList<Release>> GetVersions(string packageName)
{
var metadata = _metadataResource.GetMetadataAsync(packageName, true, true, NullSourceCacheContext.Instance, NullLogger.Instance, CancellationToken.None);
return (await metadata).Select(m => new Release(m)).ToList();
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using LibYear.Lib.FileTypes;
using NuGet.Common;
using NuGet.Protocol.Core.Types;
namespace LibYear.Lib
{
public class PackageVersionChecker : IPackageVersionChecker
{
private readonly PackageMetadataResource _metadataResource;
private readonly IDictionary<string, IList<Release>> _versionCache;
public PackageVersionChecker(PackageMetadataResource metadataResource, IDictionary<string, IList<Release>> versionCache)
{
_metadataResource = metadataResource;
_versionCache = versionCache;
}
public IDictionary<IProjectFile, IEnumerable<Result>> GetPackages(IEnumerable<IProjectFile> projectFiles)
=> projectFiles.ToDictionary(proj => proj, proj => AwaitResults(proj.Packages.Select(p => GetResultTask(p.Key, p.Value))));
public static IEnumerable<Result> AwaitResults(IEnumerable<Task<Result>> resultsTasks)
{
var tasks = resultsTasks.ToArray();
Task.WaitAll(tasks);
return tasks.Select(t => t.Result);
}
public async Task<Result> GetResultTask(string packageName, PackageVersion installed)
{
var versions = _versionCache.ContainsKey(packageName) ? _versionCache[packageName] : _versionCache[packageName] = await GetVersions(packageName);
var current = versions.FirstOrDefault(v => v.Version == installed);
var latest = versions.FirstOrDefault(v => v.Version == versions.Where(m => !m.Version.IsPrerelease && m.IsPublished).Max(m => m.Version));
if (installed?.IsWildcard ?? false)
{
current = latest;
}
return new Result(packageName, current, latest);
}
public async Task<IList<Release>> GetVersions(string packageName)
{
var metadata = _metadataResource.GetMetadataAsync(packageName, true, true, NullSourceCacheContext.Instance, NullLogger.Instance, CancellationToken.None);
return (await metadata).Select(m => new Release(m)).ToList();
}
}
}
|
mit
|
C#
|
1af9d889e0f905db1ae6a01d44afc0f621ed8bd6
|
Update index.cshtml
|
KovalNikita/apmathcloud
|
SITE/index.cshtml
|
SITE/index.cshtml
|
@{
var txt = DateTime.Now; // C#
int m = 1;
int b = 1;
double t_0 = 1;
double t_end = 100;
double z_0 = 0;
double z_d = 10;
double t1 = t_0;
double t2 = t_end;
double h = 0.1;
double width = 0.05;
}
<html>
<head>
<script type="text/javascript"
src="https://www.google.com/jsapi?autoload={
'modules':[{
'name':'visualization',
'version':'1',
'packages':['corechart']
}]
}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
var options = {
title: 'Company Performance',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
</body>
</html>
|
@{
var txt = DateTime.Now; // C#
int m = 1;
int b = 1;
double t_0 = 1;
double t_end = 100;
double z_0 = 0;
double z_d = 10;
double t1 = t_0;
double t2 = t_end;
double h = 0.1;
double width = 0.05;
}
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Mushrooms', 3],
['Onions', 1],
['Olives', 1],
['Zucchini', 1],
['Pepperoni', 2]
]);
// Set chart options
var options = {'title':'How Much Pizza I Ate Last Night',
'width':400,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<!--Div that will hold the pie chart-->
<div id="chart_div"></div>
</body>
</html>
|
mit
|
C#
|
74f778fc02d0fae4abcf45fde7fae9ab22ef0c37
|
Add all operating system in the platform resolver
|
wangkanai/Detection
|
src/Services/Defaults/PlatformService.cs
|
src/Services/Defaults/PlatformService.cs
|
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using Wangkanai.Detection.Extensions;
using Wangkanai.Detection.Models;
namespace Wangkanai.Detection.Services
{
public class PlatformService : IPlatformService
{
public Processor Processor { get; }
public OperatingSystem OperatingSystem { get; }
public PlatformService(IUserAgentService userAgentService)
{
var userAgent = userAgentService.UserAgent;
Processor = ParseProcessor(userAgent);
OperatingSystem = ParseOperatingSystem(userAgent);
}
private static OperatingSystem ParseOperatingSystem(UserAgent agent)
{
if (agent.Contains(OperatingSystem.Android))
return OperatingSystem.Android;
if (agent.Contains(OperatingSystem.Windows))
return OperatingSystem.Windows;
if (agent.Contains(OperatingSystem.Mac))
return OperatingSystem.Mac;
if (agent.Contains(OperatingSystem.iOS))
return OperatingSystem.iOS;
if (agent.Contains(OperatingSystem.Linux))
return OperatingSystem.Linux;
return OperatingSystem.Others;
}
private static Processor ParseProcessor(UserAgent agent)
{
if (agent.Contains(Processor.ARM))
return Processor.ARM;
if (agent.Contains(Processor.x86))
return Processor.x86;
if (agent.Contains(Processor.x64))
return Processor.x64;
return Processor.Others;
}
}
}
|
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using Wangkanai.Detection.Extensions;
using Wangkanai.Detection.Models;
namespace Wangkanai.Detection.Services
{
public class PlatformService : IPlatformService
{
public Processor Processor { get; }
public OperatingSystem OperatingSystem { get; }
public PlatformService(IUserAgentService userAgentService)
{
var userAgent = userAgentService.UserAgent;
Processor = ParseProcessor(userAgent);
OperatingSystem = ParseOperatingSystem(userAgent);
}
private static OperatingSystem ParseOperatingSystem(UserAgent agent)
{
if (agent.Contains(OperatingSystem.Android))
return OperatingSystem.Android;
if (agent.Contains(OperatingSystem.Windows))
return OperatingSystem.Windows;
if (agent.Contains(OperatingSystem.Mac))
return OperatingSystem.Mac;
return OperatingSystem.Others;
}
private static Processor ParseProcessor(UserAgent agent)
{
if (agent.Contains(Processor.ARM))
return Processor.ARM;
if (agent.Contains(Processor.x86))
return Processor.x86;
if (agent.Contains(Processor.x64))
return Processor.x64;
return Processor.Others;
}
}
}
|
apache-2.0
|
C#
|
18cad6aada3ad36e0563bf7ba6aa3f60e9e6bb96
|
Fix connection string check
|
NServiceBusSqlPersistence/NServiceBus.SqlPersistence
|
src/TestHelper/MySqlConnectionBuilder.cs
|
src/TestHelper/MySqlConnectionBuilder.cs
|
using System;
using MySql.Data.MySqlClient;
public static class MySqlConnectionBuilder
{
public static MySqlConnection Build()
{
var connection = Environment.GetEnvironmentVariable("MySQLConnectionString");
if (string.IsNullOrWhiteSpace(connection))
{
throw new Exception("MySQLConnectionString environment variable is empty");
}
return new MySqlConnection(connection);
}
}
|
using System;
using MySql.Data.MySqlClient;
public static class MySqlConnectionBuilder
{
public static MySqlConnection Build()
{
var connection = Environment.GetEnvironmentVariable("MySQLConnectionString");
if (string.IsNullOrWhiteSpace("MySQLConnectionString"))
{
throw new Exception("MySQLConnectionString environment variable is empty");
}
return new MySqlConnection(connection);
}
}
|
mit
|
C#
|
416eff8cca987433808d1c343da2764dff83b219
|
Check for null before we dispose
|
mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp
|
views/SkiaSharp.Views.Desktop/SKGLControl.cs
|
views/SkiaSharp.Views.Desktop/SKGLControl.cs
|
using System;
using System.ComponentModel;
using System.Windows.Forms;
using OpenTK;
namespace SkiaSharp.Views
{
public class SKGLControl : GLControl
{
private readonly bool designMode;
private GRContext grContext;
private GRBackendRenderTargetDesc renderTarget;
public SKGLControl()
{
designMode = DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime;
ResizeRedraw = true;
}
public event EventHandler<SKPaintGLSurfaceEventArgs> PaintSurface;
protected override void OnPaint(PaintEventArgs e)
{
if (designMode)
{
e.Graphics.Clear(BackColor);
return;
}
base.OnPaint(e);
// create the contexts if not done already
if (grContext == null)
{
var glInterface = GRGlInterface.CreateNativeInterface();
grContext = GRContext.Create(GRBackend.OpenGL, glInterface);
// get initial details
renderTarget = SKGLDrawable.CreateRenderTarget();
}
// update to the latest dimensions
renderTarget.Width = Width;
renderTarget.Height = Height;
// create the surface
using (var surface = SKSurface.Create(grContext, renderTarget))
{
// start drawing
OnPaintSurface(new SKPaintGLSurfaceEventArgs(surface, renderTarget));
surface.Canvas.Flush();
}
// update the control
SwapBuffers();
}
protected virtual void OnPaintSurface(SKPaintGLSurfaceEventArgs e)
{
// invoke the event
PaintSurface?.Invoke(this, e);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
// clean up
if (grContext != null)
{
grContext.Dispose();
grContext = null;
}
}
}
}
|
using System;
using System.ComponentModel;
using System.Windows.Forms;
using OpenTK;
namespace SkiaSharp.Views
{
public class SKGLControl : GLControl
{
private readonly bool designMode;
private GRContext grContext;
private GRBackendRenderTargetDesc renderTarget;
public SKGLControl()
{
designMode = DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime;
ResizeRedraw = true;
}
public event EventHandler<SKPaintGLSurfaceEventArgs> PaintSurface;
protected override void OnPaint(PaintEventArgs e)
{
if (designMode)
{
e.Graphics.Clear(BackColor);
return;
}
base.OnPaint(e);
// create the contexts if not done already
if (grContext == null)
{
var glInterface = GRGlInterface.CreateNativeInterface();
grContext = GRContext.Create(GRBackend.OpenGL, glInterface);
// get initial details
renderTarget = SKGLDrawable.CreateRenderTarget();
}
// update to the latest dimensions
renderTarget.Width = Width;
renderTarget.Height = Height;
// create the surface
using (var surface = SKSurface.Create(grContext, renderTarget))
{
// start drawing
OnPaintSurface(new SKPaintGLSurfaceEventArgs(surface, renderTarget));
surface.Canvas.Flush();
}
// update the control
SwapBuffers();
}
protected virtual void OnPaintSurface(SKPaintGLSurfaceEventArgs e)
{
// invoke the event
PaintSurface?.Invoke(this, e);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
// clean up
grContext.Dispose();
}
}
}
|
mit
|
C#
|
24fe669b40716f00b5d527e17f4aa3d0cf652db9
|
Simplify fetching the temporary path
|
markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation
|
testpackages/CopyTest1/dev/CopyTest1.cs
|
testpackages/CopyTest1/dev/CopyTest1.cs
|
// Automatically generated by Opus v0.50
namespace CopyTest1
{
class CopySingleFileTest : FileUtilities.CopyFile
{
public CopySingleFileTest()
{
this.SetRelativePath(this, "data", "testfile.txt");
this.UpdateOptions += delegate(Opus.Core.IModule module, Opus.Core.Target target) {
FileUtilities.ICopyFileOptions options = module.Options as FileUtilities.ICopyFileOptions;
if (null != options)
{
options.DestinationDirectory = System.IO.Path.GetTempPath();
}
};
}
}
class CopyMultipleFileTest : FileUtilities.CopyFileCollection
{
public CopyMultipleFileTest()
{
this.Include(this, "data", "*");
}
}
class CopyDirectoryTest : FileUtilities.CopyDirectory
{
public CopyDirectoryTest()
{
this.Include(this, "data");
}
}
}
|
// Automatically generated by Opus v0.50
namespace CopyTest1
{
class CopySingleFileTest : FileUtilities.CopyFile
{
public CopySingleFileTest()
{
this.SetRelativePath(this, "data", "testfile.txt");
this.UpdateOptions += delegate(Opus.Core.IModule module, Opus.Core.Target target) {
FileUtilities.ICopyFileOptions options = module.Options as FileUtilities.ICopyFileOptions;
if (null != options)
{
if (target.HasPlatform(Opus.Core.EPlatform.OSX))
{
options.DestinationDirectory = "/tmp";
}
else if (target.HasPlatform(Opus.Core.EPlatform.Unix))
{
options.DestinationDirectory = "/tmp";
}
else if (target.HasPlatform(Opus.Core.EPlatform.Windows))
{
options.DestinationDirectory = @"c:/temp";
}
}
};
}
}
class CopyMultipleFileTest : FileUtilities.CopyFileCollection
{
public CopyMultipleFileTest()
{
this.Include(this, "data", "*");
}
}
class CopyDirectoryTest : FileUtilities.CopyDirectory
{
public CopyDirectoryTest()
{
this.Include(this, "data");
}
}
}
|
bsd-3-clause
|
C#
|
e85930073d2ad471979b6e8f93e6c5962412ba23
|
Remove dead code
|
qiudesong/coreclr,YongseopKim/coreclr,gkhanna79/coreclr,JonHanna/coreclr,AlexGhiondea/coreclr,mmitche/coreclr,botaberg/coreclr,James-Ko/coreclr,ruben-ayrapetyan/coreclr,cshung/coreclr,cydhaselton/coreclr,hseok-oh/coreclr,rartemev/coreclr,russellhadley/coreclr,poizan42/coreclr,pgavlin/coreclr,cydhaselton/coreclr,alexperovich/coreclr,wateret/coreclr,qiudesong/coreclr,botaberg/coreclr,JosephTremoulet/coreclr,AlexGhiondea/coreclr,botaberg/coreclr,mskvortsov/coreclr,jamesqo/coreclr,yeaicc/coreclr,poizan42/coreclr,cydhaselton/coreclr,parjong/coreclr,mmitche/coreclr,sagood/coreclr,gkhanna79/coreclr,cmckinsey/coreclr,alexperovich/coreclr,krytarowski/coreclr,yizhang82/coreclr,dpodder/coreclr,sjsinju/coreclr,rartemev/coreclr,tijoytom/coreclr,James-Ko/coreclr,YongseopKim/coreclr,JonHanna/coreclr,kyulee1/coreclr,ruben-ayrapetyan/coreclr,wtgodbe/coreclr,rartemev/coreclr,botaberg/coreclr,mmitche/coreclr,wateret/coreclr,sjsinju/coreclr,JosephTremoulet/coreclr,tijoytom/coreclr,cmckinsey/coreclr,mskvortsov/coreclr,cydhaselton/coreclr,sagood/coreclr,cydhaselton/coreclr,yizhang82/coreclr,dpodder/coreclr,JosephTremoulet/coreclr,rartemev/coreclr,James-Ko/coreclr,ruben-ayrapetyan/coreclr,krk/coreclr,jamesqo/coreclr,ragmani/coreclr,yeaicc/coreclr,krytarowski/coreclr,pgavlin/coreclr,pgavlin/coreclr,tijoytom/coreclr,wtgodbe/coreclr,ragmani/coreclr,JonHanna/coreclr,alexperovich/coreclr,qiudesong/coreclr,tijoytom/coreclr,ragmani/coreclr,krytarowski/coreclr,krk/coreclr,jamesqo/coreclr,krytarowski/coreclr,sagood/coreclr,JosephTremoulet/coreclr,poizan42/coreclr,alexperovich/coreclr,alexperovich/coreclr,JonHanna/coreclr,gkhanna79/coreclr,yeaicc/coreclr,mskvortsov/coreclr,jamesqo/coreclr,sagood/coreclr,wateret/coreclr,poizan42/coreclr,rartemev/coreclr,AlexGhiondea/coreclr,James-Ko/coreclr,mmitche/coreclr,alexperovich/coreclr,krytarowski/coreclr,mskvortsov/coreclr,mmitche/coreclr,parjong/coreclr,wateret/coreclr,ruben-ayrapetyan/coreclr,dpodder/coreclr,hseok-oh/coreclr,yeaicc/coreclr,cshung/coreclr,parjong/coreclr,dpodder/coreclr,JosephTremoulet/coreclr,hseok-oh/coreclr,qiudesong/coreclr,kyulee1/coreclr,kyulee1/coreclr,krk/coreclr,kyulee1/coreclr,jamesqo/coreclr,ragmani/coreclr,russellhadley/coreclr,yizhang82/coreclr,cshung/coreclr,cshung/coreclr,ragmani/coreclr,gkhanna79/coreclr,krk/coreclr,kyulee1/coreclr,James-Ko/coreclr,botaberg/coreclr,parjong/coreclr,James-Ko/coreclr,yizhang82/coreclr,AlexGhiondea/coreclr,wtgodbe/coreclr,dpodder/coreclr,krytarowski/coreclr,gkhanna79/coreclr,russellhadley/coreclr,AlexGhiondea/coreclr,cshung/coreclr,cmckinsey/coreclr,wateret/coreclr,sagood/coreclr,JonHanna/coreclr,cmckinsey/coreclr,mmitche/coreclr,sjsinju/coreclr,parjong/coreclr,cydhaselton/coreclr,ruben-ayrapetyan/coreclr,AlexGhiondea/coreclr,cmckinsey/coreclr,pgavlin/coreclr,yizhang82/coreclr,sjsinju/coreclr,kyulee1/coreclr,hseok-oh/coreclr,qiudesong/coreclr,mskvortsov/coreclr,wateret/coreclr,wtgodbe/coreclr,dpodder/coreclr,yeaicc/coreclr,yeaicc/coreclr,JosephTremoulet/coreclr,poizan42/coreclr,wtgodbe/coreclr,russellhadley/coreclr,wtgodbe/coreclr,sagood/coreclr,YongseopKim/coreclr,hseok-oh/coreclr,ruben-ayrapetyan/coreclr,qiudesong/coreclr,pgavlin/coreclr,tijoytom/coreclr,sjsinju/coreclr,russellhadley/coreclr,krk/coreclr,jamesqo/coreclr,poizan42/coreclr,mskvortsov/coreclr,rartemev/coreclr,YongseopKim/coreclr,hseok-oh/coreclr,russellhadley/coreclr,pgavlin/coreclr,gkhanna79/coreclr,cmckinsey/coreclr,YongseopKim/coreclr,krk/coreclr,cshung/coreclr,JonHanna/coreclr,yeaicc/coreclr,YongseopKim/coreclr,cmckinsey/coreclr,parjong/coreclr,botaberg/coreclr,sjsinju/coreclr,tijoytom/coreclr,ragmani/coreclr,yizhang82/coreclr
|
src/mscorlib/src/System/SharedStatics.cs
|
src/mscorlib/src/System/SharedStatics.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*=============================================================================
**
**
**
** Purpose: Container for statics that are shared across AppDomains.
**
**
=============================================================================*/
namespace System
{
using System.Threading;
using System.Runtime.Remoting;
using System.Security;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Diagnostics;
using System.Diagnostics.Contracts;
internal sealed class SharedStatics
{
// this is declared static but is actually forced to be the same object
// for each AppDomain at AppDomain create time.
private static SharedStatics _sharedStatics;
// Note: Do not add any code in this ctor because it is not called
// when we set up _sharedStatics via AppDomain::SetupSharedStatics
private SharedStatics()
{
BCLDebug.Assert(false, "SharedStatics..ctor() is never called.");
}
// This is the total amount of memory currently "reserved" via
// all MemoryFailPoints allocated within the process.
// Stored as a long because we need to use Interlocked.Add.
private long _memFailPointReservedMemory;
internal static long AddMemoryFailPointReservation(long size)
{
// Size can legitimately be negative - see Dispose.
return Interlocked.Add(ref _sharedStatics._memFailPointReservedMemory, (long) size);
}
internal static ulong MemoryFailPointReservedMemory {
get {
Debug.Assert(Volatile.Read(ref _sharedStatics._memFailPointReservedMemory) >= 0, "Process-wide MemoryFailPoint reserved memory was negative!");
return (ulong) Volatile.Read(ref _sharedStatics._memFailPointReservedMemory);
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*=============================================================================
**
**
**
** Purpose: Container for statics that are shared across AppDomains.
**
**
=============================================================================*/
namespace System
{
using System.Threading;
using System.Runtime.Remoting;
using System.Security;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Diagnostics;
using System.Diagnostics.Contracts;
internal sealed class SharedStatics
{
// this is declared static but is actually forced to be the same object
// for each AppDomain at AppDomain create time.
private static SharedStatics _sharedStatics;
// Note: Do not add any code in this ctor because it is not called
// when we set up _sharedStatics via AppDomain::SetupSharedStatics
private SharedStatics()
{
BCLDebug.Assert(false, "SharedStatics..ctor() is never called.");
}
private volatile String _Remoting_Identity_IDGuid;
// Note this may not need to be process-wide.
private int _Remoting_Identity_IDSeqNum;
// This is the total amount of memory currently "reserved" via
// all MemoryFailPoints allocated within the process.
// Stored as a long because we need to use Interlocked.Add.
private long _memFailPointReservedMemory;
internal static long AddMemoryFailPointReservation(long size)
{
// Size can legitimately be negative - see Dispose.
return Interlocked.Add(ref _sharedStatics._memFailPointReservedMemory, (long) size);
}
internal static ulong MemoryFailPointReservedMemory {
get {
Debug.Assert(Volatile.Read(ref _sharedStatics._memFailPointReservedMemory) >= 0, "Process-wide MemoryFailPoint reserved memory was negative!");
return (ulong) Volatile.Read(ref _sharedStatics._memFailPointReservedMemory);
}
}
}
}
|
mit
|
C#
|
07e9638ae96272b24986bbf2541220f330e457fc
|
update initializer
|
AerisG222/mikeandwan.us,AerisG222/mikeandwan.us,AerisG222/mikeandwan.us,AerisG222/mikeandwan.us,AerisG222/mikeandwan.us
|
src/www/Controllers/MawBaseController.cs
|
src/www/Controllers/MawBaseController.cs
|
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace MawMvcApp.Controllers
{
public class MawBaseController<T>
: Controller
{
protected ILogger<T> Log { get; }
public MawBaseController(ILogger<T> log)
{
Log = log ?? throw new ArgumentNullException(nameof(log));
}
protected void LogValidationErrors()
{
var errs = ModelState.Values.SelectMany(v => v.Errors);
foreach (var err in errs)
{
Log.LogWarning(err.ErrorMessage);
}
}
}
}
|
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace MawMvcApp.Controllers
{
public class MawBaseController<T>
: Controller
{
protected ILogger<T> Log { get; }
public MawBaseController(ILogger<T> log)
{
if(log == null)
{
throw new ArgumentNullException(nameof(log));
}
Log = log;
}
protected void LogValidationErrors()
{
var errs = ModelState.Values.SelectMany(v => v.Errors);
foreach (var err in errs)
{
Log.LogWarning(err.ErrorMessage);
}
}
}
}
|
mit
|
C#
|
0c2d4bb14e132b111f91149c7bae264b897bde97
|
fix serialize() call sites.
|
ecologylab/simplCSharp
|
Simpl.Fundamental/Collections/ResourcePool.cs
|
Simpl.Fundamental/Collections/ResourcePool.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Simpl.Fundamental.Collections
{
public abstract class ResourcePool<T>
{
private readonly List<T> _pool;
private int _initialCapacity;
protected ResourcePool(int initialCapacity)
{
_initialCapacity = initialCapacity;
_pool = new List<T>(initialCapacity);
}
public T Acquire()
{
if (_pool.Count <= 0)
{
T resource = GenerateNewResource();
return resource;
}
else
{
lock(_pool)
{
T resource = _pool.ElementAt(_pool.Count - 1);
_pool.RemoveAt(_pool.Count - 1);
return resource;
}
}
}
public void Release(T resource)
{
lock(_pool)
{
_pool.Add(resource);
}
}
public void Clear()
{
lock(_pool)
{
_pool.Clear();
}
}
protected abstract T GenerateNewResource();
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Simpl.Fundamental.Collections
{
abstract class ResourcePool<T> where T : new()
{
private readonly List<T> _pool;
private int _initialCapacity;
protected ResourcePool(int initialCapacity)
{
_initialCapacity = initialCapacity;
_pool = new List<T>(initialCapacity);
}
public T Acquire()
{
if (_pool.Count <= 0)
{
T resource = GenerateNewResource();
return resource;
}
else
{
lock(_pool)
{
T resource = _pool.ElementAt(_pool.Count - 1);
_pool.RemoveAt(_pool.Count - 1);
return resource;
}
}
}
public void Release(T resource)
{
lock(_pool)
{
_pool.Add(resource);
}
}
public void Clear()
{
lock(_pool)
{
_pool.Clear();
}
}
protected abstract T GenerateNewResource();
}
}
|
apache-2.0
|
C#
|
83633b7ebd8a7b5ee7320eb7fd1842e7e5dcb213
|
refactor Bird to call BirdController for OnCollisionEnter2D
|
nrjohnstone/flappybird-unity
|
unity-flappybirds/Assets/Scripts/Bird.cs
|
unity-flappybirds/Assets/Scripts/Bird.cs
|
using UnityEngine;
namespace Assets.Scripts
{
public class Bird : MonoBehaviour, IInput, IAnimator, IRigidbody2D
{
public float upForce = 150f;
private Animator anim;
private BirdController birdController;
private Rigidbody2D rb2d;
public void Start()
{
rb2d = GetComponent<Rigidbody2D>();
anim = GetComponent<Animator>();
birdController = new BirdController(this, this, this)
{
upForce = upForce
};
}
public void Update()
{
birdController.Update();
}
public void OnCollisionEnter2D(Collision2D other)
{
birdController.OnCollisionEnter2D(other);
}
public bool IsLeftMouseButtonDown()
{
return Input.GetMouseButtonDown(0);
}
public void SetTrigger(string triggerName)
{
anim.SetTrigger(triggerName);
}
public Vector2 velocity
{
get { return rb2d.velocity; }
set { rb2d.velocity = value; }
}
public void AddForce(Vector2 vector2)
{
rb2d.AddForce(vector2);
}
}
}
|
using UnityEngine;
namespace Assets.Scripts
{
public class Bird : MonoBehaviour, IInput, IAnimator, IRigidbody2D
{
public float upForce = 150f;
private bool isDead = false;
private Animator anim;
private BirdController birdController;
private Rigidbody2D rb2d;
public void Start()
{
rb2d = GetComponent<Rigidbody2D>();
anim = GetComponent<Animator>();
birdController = new BirdController(this, this, this);
}
public void Update()
{
birdController.Update();
}
public void OnCollisionEnter2D(Collision2D other)
{
rb2d.velocity = Vector2.zero;
isDead = true;
anim.SetTrigger("Die");
GameControl.instance.BirdDied();
}
public bool IsLeftMouseButtonDown()
{
return Input.GetMouseButtonDown(0);
}
public void SetTrigger(string triggerName)
{
anim.SetTrigger(triggerName);
}
public Vector2 velocity
{
get { return rb2d.velocity; }
set { rb2d.velocity = value; }
}
public void AddForce(Vector2 vector2)
{
rb2d.AddForce(vector2);
}
}
}
|
cc0-1.0
|
C#
|
4d03118129c9e3b05658eee1c7a727b24d126094
|
Use new constructor
|
AngleSharp/AngleSharp,FlorianRappl/AngleSharp,AngleSharp/AngleSharp,Livven/AngleSharp,FlorianRappl/AngleSharp,zedr0n/AngleSharp.Local,Livven/AngleSharp,AngleSharp/AngleSharp,Livven/AngleSharp,FlorianRappl/AngleSharp,AngleSharp/AngleSharp,zedr0n/AngleSharp.Local,zedr0n/AngleSharp.Local,FlorianRappl/AngleSharp,AngleSharp/AngleSharp
|
AngleSharp.Scripting/JavaScriptEngine.cs
|
AngleSharp.Scripting/JavaScriptEngine.cs
|
namespace AngleSharp.Scripting
{
using AngleSharp.Infrastructure;
using AngleSharp.Network;
using AngleSharp.Tools;
using Jint;
using Jint.Native.Global;
using Jint.Runtime.Environments;
using System;
using System.IO;
using System.Text;
public class JavaScriptEngine : IScriptEngine
{
readonly Engine _engine;
readonly LexicalEnvironment _variable;
public JavaScriptEngine()
{
_engine = new Engine();
_engine.SetValue("console", new ConsoleInstance(_engine));
_variable = LexicalEnvironment.NewObjectEnvironment(_engine, _engine.Global, null, false);
}
public String Type
{
get { return "text/javascript"; }
}
public Object Result
{
get { return _engine.GetCompletionValue(); }
}
public void Evaluate(String source, ScriptOptions options)
{
var context = new DomNodeInstance(_engine, options.Context ?? new AnalysisWindow { Document = options.Document });
var env = LexicalEnvironment.NewObjectEnvironment(_engine, context, _engine.ExecutionContext.LexicalEnvironment, true);
_engine.EnterExecutionContext(env, _variable, context);
_engine.Execute(source);
_engine.LeaveExecutionContext();
}
public void Evaluate(IResponse response, ScriptOptions options)
{
var reader = new StreamReader(response.Content, options.Encoding ?? Encoding.UTF8, true);
var content = reader.ReadToEnd();
reader.Close();
Evaluate(content, options);
}
public void Reset()
{
//TODO Jint
}
}
}
|
namespace AngleSharp.Scripting
{
using AngleSharp.Infrastructure;
using AngleSharp.Network;
using AngleSharp.Tools;
using Jint;
using Jint.Native.Global;
using Jint.Runtime.Environments;
using System;
using System.IO;
using System.Text;
public class JavaScriptEngine : IScriptEngine
{
readonly Engine _engine;
readonly LexicalEnvironment _variable;
public JavaScriptEngine()
{
_engine = new Engine();
_engine.SetValue("console", new ConsoleInstance(_engine));
_variable = LexicalEnvironment.NewObjectEnvironment(_engine, _engine.Global, null, false);
}
public String Type
{
get { return "text/javascript"; }
}
public Object Result
{
get { return _engine.GetCompletionValue(); }
}
public void Evaluate(String source, ScriptOptions options)
{
var context = new DomNodeInstance(_engine, options.Context ?? new AnalysisWindow(options.Document));
var env = LexicalEnvironment.NewObjectEnvironment(_engine, context, _engine.ExecutionContext.LexicalEnvironment, true);
_engine.EnterExecutionContext(env, _variable, context);
_engine.Execute(source);
_engine.LeaveExecutionContext();
}
public void Evaluate(IResponse response, ScriptOptions options)
{
var reader = new StreamReader(response.Content, options.Encoding ?? Encoding.UTF8, true);
var content = reader.ReadToEnd();
reader.Close();
Evaluate(content, options);
}
public void Reset()
{
//TODO Jint
}
}
}
|
mit
|
C#
|
7c6e162819e7bb53b5f856e3d778039f59989e8b
|
Allow NUnit tests to run over and over
|
Hitcents/iOS4Unity,Hitcents/iOS4Unity
|
Assets/NUnitLite/NUnitLiteUnityRunner.cs
|
Assets/NUnitLite/NUnitLiteUnityRunner.cs
|
// Copyright (C) 2013 by Andrew Zhilin <andrew_zhilin@yahoo.com>
#region Usings
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using NUnitLite;
using NUnitLite.Runner;
using UnityEngine;
#endregion
/* NOTE:
*
* This is a test runner for NUnitLite, that redirects test results
* to Unity console.
*
* After compilation of C# files Unity gives you two assemblies:
*
* - Assembly-CSharp-firstpass.dll for 'Plugins' and 'Standard Assets'
* - Assembly-CSharp.dll for another scripts
*
* Then, if you want have tests in both places - you should call
* NUnitLiteUnityRunner.RunTests() from both places. One call per assembly
* is enough, but you can call it as many times as you want - all
* calls after first are ignored.
*
* You can use 'MonoBahavior' classes for tests, but Unity give you
* one harmless warning per class. Using special Test classes would be
* better idea.
*/
public static class NUnitLiteUnityRunner
{
public static Action<string, ResultSummary> Presenter { get; set; }
static NUnitLiteUnityRunner()
{
Presenter = UnityConsolePresenter;
}
public static void RunTests()
{
RunTests(Assembly.GetCallingAssembly());
}
private static void RunTests(Assembly assembly)
{
if (assembly == null)
throw new ArgumentNullException("assembly");
using (var sw = new StringWriter())
{
var runner = new NUnitStreamUI(sw);
runner.Execute(assembly);
var resultSummary = runner.Summary;
var resultText = sw.GetStringBuilder().ToString();
Presenter(resultText, resultSummary);
}
}
private static void UnityConsolePresenter(string longResult, ResultSummary result)
{
if (result != null && (result.ErrorCount > 0 || result.FailureCount > 0))
Debug.LogWarning(longResult);
else
Debug.Log(longResult);
}
}
|
// Copyright (C) 2013 by Andrew Zhilin <andrew_zhilin@yahoo.com>
#region Usings
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using NUnitLite;
using NUnitLite.Runner;
using UnityEngine;
#endregion
/* NOTE:
*
* This is a test runner for NUnitLite, that redirects test results
* to Unity console.
*
* After compilation of C# files Unity gives you two assemblies:
*
* - Assembly-CSharp-firstpass.dll for 'Plugins' and 'Standard Assets'
* - Assembly-CSharp.dll for another scripts
*
* Then, if you want have tests in both places - you should call
* NUnitLiteUnityRunner.RunTests() from both places. One call per assembly
* is enough, but you can call it as many times as you want - all
* calls after first are ignored.
*
* You can use 'MonoBahavior' classes for tests, but Unity give you
* one harmless warning per class. Using special Test classes would be
* better idea.
*/
public static class NUnitLiteUnityRunner
{
private static readonly HashSet<Assembly> Tested =
new HashSet<Assembly>();
public static Action<string, ResultSummary> Presenter { get; set; }
static NUnitLiteUnityRunner()
{
Presenter = UnityConsolePresenter;
}
public static void RunTests()
{
RunTests(Assembly.GetCallingAssembly());
}
private static void RunTests(Assembly assembly)
{
if (assembly == null)
throw new ArgumentNullException("assembly");
if (Tested.Contains(assembly))
return;
Tested.Add(assembly);
using (var sw = new StringWriter())
{
var runner = new NUnitStreamUI(sw);
runner.Execute(assembly);
var resultSummary = runner.Summary;
var resultText = sw.GetStringBuilder().ToString();
Presenter(resultText, resultSummary);
}
}
private static void UnityConsolePresenter(string longResult, ResultSummary result)
{
if (result != null && (result.ErrorCount > 0 || result.FailureCount > 0))
Debug.LogWarning(longResult);
else
Debug.Log(longResult);
}
}
|
apache-2.0
|
C#
|
3217c4857ef0296f3fe6f857f386837583e61841
|
Make highlighter mesh invisible
|
EightBitBoy/EcoRealms
|
Assets/Scripts/Map/MapHighlightManager.cs
|
Assets/Scripts/Map/MapHighlightManager.cs
|
using UnityEngine;
using System.Collections;
namespace ecorealms.map {
public class MapHighlightManager : MonoBehaviour {
private int sizeX;
private int sizeY;
private float HEIGHT = 0.2f;
private Mesh mesh;
public void Setup(int chunksX, int chunksY, int tilesX, int tilesY) {
this.sizeX = chunksX * tilesX;
this.sizeY = chunksY * tilesY;
mesh = gameObject.AddComponent<MeshFilter>().mesh;
gameObject.AddComponent<MeshRenderer>();
gameObject.layer = LayerMask.NameToLayer("IgnoreCamera");
AddOverlayQuad();
}
void AddOverlayQuad() {
Vector3[] vertices = new Vector3[4];
Vector3[] normals = new Vector3[4];
int[] triangles = new int[6];
vertices[0] = new Vector3(0, HEIGHT, 0);
vertices[1] = new Vector3(0, HEIGHT, sizeY);
vertices[2] = new Vector3(sizeX, HEIGHT, sizeY);
vertices[3] = new Vector3(sizeX, HEIGHT, 0);
normals[0] = Vector3.up;
normals[1] = Vector3.up;
normals[2] = Vector3.up;
normals[3] = Vector3.up;
triangles[0] = 0;
triangles[1] = 1;
triangles[2] = 3;
triangles[3] = 1;
triangles[4] = 2;
triangles[5] = 3;
mesh.Clear();
mesh.vertices = vertices;
mesh.normals = normals;
mesh.triangles = triangles;
}
}
}
|
using UnityEngine;
using System.Collections;
namespace ecorealms.map {
public class MapHighlightManager : MonoBehaviour {
private int sizeX;
private int sizeY;
private float HEIGHT = 0.2f;
public void Setup(int chunksX, int chunksY, int tilesX, int tilesY) {
this.sizeX = chunksX * tilesX;
this.sizeY = chunksY * tilesY;
AddOverlayQuad();
}
void AddOverlayQuad() {
gameObject.AddComponent<MeshRenderer>();
Vector3[] vertices = new Vector3[4];
Vector3[] normals = new Vector3[4];
int[] triangles = new int[6];
vertices[0] = new Vector3(0, HEIGHT, 0);
vertices[1] = new Vector3(0, HEIGHT, sizeY);
vertices[2] = new Vector3(sizeX, HEIGHT, sizeY);
vertices[3] = new Vector3(sizeX, HEIGHT, 0);
normals[0] = Vector3.up;
normals[1] = Vector3.up;
normals[2] = Vector3.up;
normals[3] = Vector3.up;
triangles[0] = 0;
triangles[1] = 1;
triangles[2] = 3;
triangles[3] = 1;
triangles[4] = 2;
triangles[5] = 3;
}
}
}
|
apache-2.0
|
C#
|
8b3156b2b2915b3fb3cc0d1d4624ab267d0ff6af
|
Set app version to 3.0.0
|
Phrynohyas/eve-o-preview,Phrynohyas/eve-o-preview
|
Eve-O-Preview/Properties/AssemblyInfo.cs
|
Eve-O-Preview/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("EVE-O Preview")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EVE-O Preview")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: CLSCompliant(true)]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("EVE-O Preview")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EVE-O Preview")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
[assembly: AssemblyVersion("2.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
[assembly: CLSCompliant(true)]
|
mit
|
C#
|
4dc7110c50ce21586fa8a74f1c15fd189c21a9ae
|
Bump version.
|
oozcitak/imagelistview
|
ImageListView/Properties/AssemblyInfo.cs
|
ImageListView/Properties/AssemblyInfo.cs
|
// ImageListView - A listview control for image files
// Copyright (C) 2009 Ozgur Ozcitak
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Ozgur Ozcitak (ozcitak@yahoo.com)
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ImageListView")]
[assembly: AssemblyDescription("A ListView like control for displaying image files with asynchronously loaded thumbnails.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Özgür Özçıtak")]
[assembly: AssemblyProduct("ImageListView")]
[assembly: AssemblyCopyright("Copyright © 2013 Özgür Özçıtak")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3eb67a8d-4c80-4c11-944d-c99ef0ec7eb9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("13.4.0.0")]
[assembly: AssemblyFileVersion("13.4.0.0")]
|
// ImageListView - A listview control for image files
// Copyright (C) 2009 Ozgur Ozcitak
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Ozgur Ozcitak (ozcitak@yahoo.com)
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ImageListView")]
[assembly: AssemblyDescription("A ListView like control for displaying image files with asynchronously loaded thumbnails.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Özgür Özçıtak")]
[assembly: AssemblyProduct("ImageListView")]
[assembly: AssemblyCopyright("Copyright © 2013 Özgür Özçıtak")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3eb67a8d-4c80-4c11-944d-c99ef0ec7eb9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("13.3.0.0")]
[assembly: AssemblyFileVersion("13.3.0.0")]
|
apache-2.0
|
C#
|
c696d77b12d8c4ff1bd329c5c2f5b0c15eff4128
|
Reorder inspector
|
bartlomiejwolk/TPPCamera
|
Editor/GameCameraEditor.cs
|
Editor/GameCameraEditor.cs
|
using UnityEditor;
[CustomEditor(typeof(GameCamera))]
class GameCameraEditor : Editor {
#region FIELDS
private GameCamera Script { get; set; }
#endregion
#region SERIALIZED PROPERTIES
private SerializedProperty cameraLimits;
private SerializedProperty cameraOcclusionLayerMask;
private SerializedProperty cameraOffset;
private SerializedProperty cameraRotationSpeed;
private SerializedProperty followSpeed;
private SerializedProperty lookAtPointOffset;
private SerializedProperty lookAtPointWhenNotVisible;
private SerializedProperty mode;
private SerializedProperty movementVelocityOffset;
private SerializedProperty offsetWhenNotVisible;
private SerializedProperty perspectiveChangeSpeed;
private SerializedProperty targetTransform;
#endregion
private void OnEnable() {
cameraLimits = serializedObject.FindProperty("cameraLimits");
cameraOcclusionLayerMask =
serializedObject.FindProperty("cameraOcclusionLayerMask");
cameraOffset = serializedObject.FindProperty("cameraOffset");
cameraRotationSpeed =
serializedObject.FindProperty("cameraRotationSpeed");
followSpeed = serializedObject.FindProperty("followSpeed");
lookAtPointOffset = serializedObject.FindProperty("lookAtPointOffset");
lookAtPointWhenNotVisible =
serializedObject.FindProperty("lookAtPointWhenNotVisible");
mode = serializedObject.FindProperty("mode");
movementVelocityOffset =
serializedObject.FindProperty("movementVelocityOffset");
offsetWhenNotVisible =
serializedObject.FindProperty("offsetWhenNotVisible");
perspectiveChangeSpeed =
serializedObject.FindProperty("perspectiveChangeSpeed");
targetTransform = serializedObject.FindProperty("targetTransform");
}
public override void OnInspectorGUI() {
serializedObject.Update();
EditorGUILayout.PropertyField(mode);
EditorGUILayout.PropertyField(targetTransform);
EditorGUILayout.PropertyField(cameraOcclusionLayerMask);
EditorGUILayout.PropertyField(cameraOffset);
EditorGUILayout.PropertyField(lookAtPointOffset);
EditorGUILayout.PropertyField(followSpeed);
EditorGUILayout.PropertyField(cameraRotationSpeed);
EditorGUILayout.PropertyField(perspectiveChangeSpeed);
EditorGUILayout.PropertyField(movementVelocityOffset);
EditorGUILayout.PropertyField(cameraLimits);
EditorGUILayout.PropertyField(lookAtPointWhenNotVisible);
EditorGUILayout.PropertyField(offsetWhenNotVisible);
serializedObject.ApplyModifiedProperties();
}
}
|
using UnityEditor;
[CustomEditor(typeof(GameCamera))]
class GameCameraEditor : Editor {
#region FIELDS
private GameCamera Script { get; set; }
#endregion
#region SERIALIZED PROPERTIES
private SerializedProperty cameraLimits;
private SerializedProperty cameraOcclusionLayerMask;
private SerializedProperty cameraOffset;
private SerializedProperty cameraRotationSpeed;
private SerializedProperty followSpeed;
private SerializedProperty lookAtPointOffset;
private SerializedProperty lookAtPointWhenNotVisible;
private SerializedProperty mode;
private SerializedProperty movementVelocityOffset;
private SerializedProperty offsetWhenNotVisible;
private SerializedProperty perspectiveChangeSpeed;
private SerializedProperty targetTransform;
#endregion
private void OnEnable() {
cameraLimits = serializedObject.FindProperty("cameraLimits");
cameraOcclusionLayerMask =
serializedObject.FindProperty("cameraOcclusionLayerMask");
cameraOffset = serializedObject.FindProperty("cameraOffset");
cameraRotationSpeed =
serializedObject.FindProperty("cameraRotationSpeed");
followSpeed = serializedObject.FindProperty("followSpeed");
lookAtPointOffset = serializedObject.FindProperty("lookAtPointOffset");
lookAtPointWhenNotVisible =
serializedObject.FindProperty("lookAtPointWhenNotVisible");
mode = serializedObject.FindProperty("mode");
movementVelocityOffset =
serializedObject.FindProperty("movementVelocityOffset");
offsetWhenNotVisible =
serializedObject.FindProperty("offsetWhenNotVisible");
perspectiveChangeSpeed =
serializedObject.FindProperty("perspectiveChangeSpeed");
targetTransform = serializedObject.FindProperty("targetTransform");
}
public override void OnInspectorGUI() {
serializedObject.Update();
EditorGUILayout.PropertyField(cameraLimits);
EditorGUILayout.PropertyField(cameraOcclusionLayerMask);
EditorGUILayout.PropertyField(cameraOffset);
EditorGUILayout.PropertyField(cameraRotationSpeed);
EditorGUILayout.PropertyField(followSpeed);
EditorGUILayout.PropertyField(lookAtPointOffset);
EditorGUILayout.PropertyField(lookAtPointWhenNotVisible);
EditorGUILayout.PropertyField(mode);
EditorGUILayout.PropertyField(movementVelocityOffset);
EditorGUILayout.PropertyField(offsetWhenNotVisible);
EditorGUILayout.PropertyField(perspectiveChangeSpeed);
EditorGUILayout.PropertyField(targetTransform);
serializedObject.ApplyModifiedProperties();
}
}
|
mit
|
C#
|
f6f1d65a74e14f4a4940974bb26fd0d4ca3191c2
|
Use Thread.Sleep in System.Threading.Helpers.Sleep on CoreCLR
|
krytarowski/corefx,nbarbettini/corefx,elijah6/corefx,nbarbettini/corefx,shahid-pk/corefx,kkurni/corefx,ptoonen/corefx,larsbj1988/corefx,chenkennt/corefx,scott156/corefx,matthubin/corefx,cnbin/corefx,richlander/corefx,yizhang82/corefx,Yanjing123/corefx,spoiledsport/corefx,destinyclown/corefx,Jiayili1/corefx,shana/corefx,jlin177/corefx,shmao/corefx,shana/corefx,marksmeltzer/corefx,PatrickMcDonald/corefx,cydhaselton/corefx,alphonsekurian/corefx,Priya91/corefx-1,JosephTremoulet/corefx,rahku/corefx,mellinoe/corefx,janhenke/corefx,khdang/corefx,oceanho/corefx,MaggieTsang/corefx,twsouthwick/corefx,ericstj/corefx,gkhanna79/corefx,mokchhya/corefx,690486439/corefx,fgreinacher/corefx,destinyclown/corefx,popolan1986/corefx,kyulee1/corefx,jhendrixMSFT/corefx,Petermarcu/corefx,zhenlan/corefx,stephenmichaelf/corefx,seanshpark/corefx,jlin177/corefx,shiftkey-tester/corefx,gregg-miskelly/corefx,manu-silicon/corefx,weltkante/corefx,vs-team/corefx,ptoonen/corefx,cartermp/corefx,billwert/corefx,JosephTremoulet/corefx,ravimeda/corefx,andyhebear/corefx,ViktorHofer/corefx,dsplaisted/corefx,weltkante/corefx,zhangwenquan/corefx,JosephTremoulet/corefx,Ermiar/corefx,benjamin-bader/corefx,mellinoe/corefx,Yanjing123/corefx,SGuyGe/corefx,mokchhya/corefx,BrennanConroy/corefx,alexperovich/corefx,SGuyGe/corefx,destinyclown/corefx,CloudLens/corefx,the-dwyer/corefx,cartermp/corefx,tijoytom/corefx,BrennanConroy/corefx,the-dwyer/corefx,josguil/corefx,rjxby/corefx,MaggieTsang/corefx,mellinoe/corefx,tijoytom/corefx,parjong/corefx,jcme/corefx,n1ghtmare/corefx,benjamin-bader/corefx,heXelium/corefx,oceanho/corefx,axelheer/corefx,janhenke/corefx,mokchhya/corefx,YoupHulsebos/corefx,misterzik/corefx,pgavlin/corefx,richlander/corefx,ellismg/corefx,shmao/corefx,vs-team/corefx,chaitrakeshav/corefx,shahid-pk/corefx,rajansingh10/corefx,kkurni/corefx,andyhebear/corefx,the-dwyer/corefx,richlander/corefx,thiagodin/corefx,ravimeda/corefx,tstringer/corefx,YoupHulsebos/corefx,alphonsekurian/corefx,bitcrazed/corefx,wtgodbe/corefx,YoupHulsebos/corefx,yizhang82/corefx,uhaciogullari/corefx,shrutigarg/corefx,alexperovich/corefx,CloudLens/corefx,jhendrixMSFT/corefx,krk/corefx,wtgodbe/corefx,jeremymeng/corefx,benpye/corefx,weltkante/corefx,Jiayili1/corefx,tstringer/corefx,gkhanna79/corefx,shiftkey-tester/corefx,krk/corefx,krytarowski/corefx,richlander/corefx,n1ghtmare/corefx,zhenlan/corefx,krk/corefx,lggomez/corefx,shiftkey-tester/corefx,marksmeltzer/corefx,kyulee1/corefx,parjong/corefx,mafiya69/corefx,benjamin-bader/corefx,rjxby/corefx,Jiayili1/corefx,lggomez/corefx,benjamin-bader/corefx,DnlHarvey/corefx,rahku/corefx,gregg-miskelly/corefx,mafiya69/corefx,vidhya-bv/corefx-sorting,rahku/corefx,chenxizhang/corefx,comdiv/corefx,JosephTremoulet/corefx,shrutigarg/corefx,claudelee/corefx,jeremymeng/corefx,stephenmichaelf/corefx,shahid-pk/corefx,axelheer/corefx,marksmeltzer/corefx,Ermiar/corefx,ViktorHofer/corefx,twsouthwick/corefx,nchikanov/corefx,vidhya-bv/corefx-sorting,alphonsekurian/corefx,pallavit/corefx,yizhang82/corefx,billwert/corefx,stone-li/corefx,popolan1986/corefx,EverlessDrop41/corefx,misterzik/corefx,vijaykota/corefx,billwert/corefx,ericstj/corefx,uhaciogullari/corefx,gregg-miskelly/corefx,lggomez/corefx,jeremymeng/corefx,krytarowski/corefx,EverlessDrop41/corefx,rahku/corefx,josguil/corefx,jcme/corefx,alexandrnikitin/corefx,fernando-rodriguez/corefx,weltkante/corefx,rubo/corefx,krk/corefx,axelheer/corefx,zhangwenquan/corefx,VPashkov/corefx,alphonsekurian/corefx,krytarowski/corefx,axelheer/corefx,CloudLens/corefx,mafiya69/corefx,zhenlan/corefx,lggomez/corefx,rjxby/corefx,cnbin/corefx,rjxby/corefx,dhoehna/corefx,khdang/corefx,MaggieTsang/corefx,Winsto/corefx,s0ne0me/corefx,yizhang82/corefx,josguil/corefx,alexperovich/corefx,kkurni/corefx,wtgodbe/corefx,vs-team/corefx,brett25/corefx,Ermiar/corefx,nchikanov/corefx,SGuyGe/corefx,ericstj/corefx,xuweixuwei/corefx,jhendrixMSFT/corefx,the-dwyer/corefx,dhoehna/corefx,nelsonsar/corefx,akivafr123/corefx,chenkennt/corefx,iamjasonp/corefx,tstringer/corefx,fgreinacher/corefx,josguil/corefx,BrennanConroy/corefx,jeremymeng/corefx,KrisLee/corefx,kkurni/corefx,matthubin/corefx,marksmeltzer/corefx,adamralph/corefx,CherryCxldn/corefx,manu-silicon/corefx,shrutigarg/corefx,stone-li/corefx,cydhaselton/corefx,gabrielPeart/corefx,Frank125/corefx,ellismg/corefx,shimingsg/corefx,shmao/corefx,mazong1123/corefx,iamjasonp/corefx,vidhya-bv/corefx-sorting,axelheer/corefx,chaitrakeshav/corefx,vrassouli/corefx,parjong/corefx,mokchhya/corefx,YoupHulsebos/corefx,brett25/corefx,ptoonen/corefx,matthubin/corefx,larsbj1988/corefx,nchikanov/corefx,alexandrnikitin/corefx,thiagodin/corefx,ViktorHofer/corefx,KrisLee/corefx,bpschoch/corefx,690486439/corefx,pallavit/corefx,nbarbettini/corefx,khdang/corefx,larsbj1988/corefx,shmao/corefx,rubo/corefx,cartermp/corefx,pallavit/corefx,akivafr123/corefx,elijah6/corefx,anjumrizwi/corefx,stone-li/corefx,stone-li/corefx,popolan1986/corefx,Priya91/corefx-1,seanshpark/corefx,vrassouli/corefx,pallavit/corefx,ravimeda/corefx,fernando-rodriguez/corefx,tstringer/corefx,adamralph/corefx,dotnet-bot/corefx,ravimeda/corefx,ericstj/corefx,seanshpark/corefx,CherryCxldn/corefx,Priya91/corefx-1,dotnet-bot/corefx,khdang/corefx,jmhardison/corefx,janhenke/corefx,comdiv/corefx,DnlHarvey/corefx,benjamin-bader/corefx,shrutigarg/corefx,mmitche/corefx,JosephTremoulet/corefx,zhenlan/corefx,alexandrnikitin/corefx,nchikanov/corefx,fffej/corefx,Alcaro/corefx,krk/corefx,jmhardison/corefx,gkhanna79/corefx,pgavlin/corefx,kyulee1/corefx,jhendrixMSFT/corefx,thiagodin/corefx,tijoytom/corefx,mellinoe/corefx,zhangwenquan/corefx,mmitche/corefx,jcme/corefx,viniciustaveira/corefx,misterzik/corefx,lydonchandra/corefx,iamjasonp/corefx,dhoehna/corefx,Petermarcu/corefx,viniciustaveira/corefx,gkhanna79/corefx,ericstj/corefx,akivafr123/corefx,dsplaisted/corefx,mmitche/corefx,andyhebear/corefx,stone-li/corefx,jcme/corefx,Yanjing123/corefx,mazong1123/corefx,bpschoch/corefx,heXelium/corefx,n1ghtmare/corefx,richlander/corefx,alphonsekurian/corefx,shana/corefx,nelsonsar/corefx,shimingsg/corefx,rahku/corefx,rjxby/corefx,alexperovich/corefx,cydhaselton/corefx,manu-silicon/corefx,krytarowski/corefx,cartermp/corefx,kyulee1/corefx,khdang/corefx,ellismg/corefx,anjumrizwi/corefx,shimingsg/corefx,mazong1123/corefx,cydhaselton/corefx,heXelium/corefx,benpye/corefx,Ermiar/corefx,690486439/corefx,shimingsg/corefx,billwert/corefx,Priya91/corefx-1,ptoonen/corefx,nbarbettini/corefx,mafiya69/corefx,matthubin/corefx,bitcrazed/corefx,pgavlin/corefx,dtrebbien/corefx,iamjasonp/corefx,cnbin/corefx,Alcaro/corefx,janhenke/corefx,shana/corefx,krytarowski/corefx,erpframework/corefx,lggomez/corefx,DnlHarvey/corefx,benpye/corefx,brett25/corefx,MaggieTsang/corefx,ericstj/corefx,gabrielPeart/corefx,dhoehna/corefx,nchikanov/corefx,dhoehna/corefx,benpye/corefx,shiftkey-tester/corefx,fffej/corefx,nbarbettini/corefx,the-dwyer/corefx,nchikanov/corefx,seanshpark/corefx,YoupHulsebos/corefx,mafiya69/corefx,fgreinacher/corefx,jeremymeng/corefx,dotnet-bot/corefx,pgavlin/corefx,benpye/corefx,wtgodbe/corefx,the-dwyer/corefx,anjumrizwi/corefx,chenxizhang/corefx,alexandrnikitin/corefx,mazong1123/corefx,jmhardison/corefx,parjong/corefx,dsplaisted/corefx,MaggieTsang/corefx,fgreinacher/corefx,fffej/corefx,zhangwenquan/corefx,mellinoe/corefx,Ermiar/corefx,Petermarcu/corefx,lggomez/corefx,adamralph/corefx,Petermarcu/corefx,rjxby/corefx,pallavit/corefx,huanjie/corefx,gkhanna79/corefx,khdang/corefx,akivafr123/corefx,marksmeltzer/corefx,Priya91/corefx-1,mafiya69/corefx,zhenlan/corefx,mazong1123/corefx,alexandrnikitin/corefx,Jiayili1/corefx,bpschoch/corefx,EverlessDrop41/corefx,nchikanov/corefx,gkhanna79/corefx,xuweixuwei/corefx,marksmeltzer/corefx,lydonchandra/corefx,n1ghtmare/corefx,nelsonsar/corefx,twsouthwick/corefx,mazong1123/corefx,josguil/corefx,Frank125/corefx,billwert/corefx,xuweixuwei/corefx,YoupHulsebos/corefx,stephenmichaelf/corefx,tstringer/corefx,stormleoxia/corefx,parjong/corefx,janhenke/corefx,nbarbettini/corefx,bitcrazed/corefx,KrisLee/corefx,jmhardison/corefx,alexperovich/corefx,scott156/corefx,yizhang82/corefx,cnbin/corefx,Ermiar/corefx,vs-team/corefx,shimingsg/corefx,shahid-pk/corefx,yizhang82/corefx,chaitrakeshav/corefx,690486439/corefx,kkurni/corefx,arronei/corefx,zmaruo/corefx,seanshpark/corefx,josguil/corefx,SGuyGe/corefx,manu-silicon/corefx,JosephTremoulet/corefx,Chrisboh/corefx,dtrebbien/corefx,wtgodbe/corefx,huanjie/corefx,elijah6/corefx,fffej/corefx,axelheer/corefx,cartermp/corefx,PatrickMcDonald/corefx,richlander/corefx,erpframework/corefx,mazong1123/corefx,mokchhya/corefx,parjong/corefx,bitcrazed/corefx,mmitche/corefx,tstringer/corefx,tijoytom/corefx,rajansingh10/corefx,erpframework/corefx,ravimeda/corefx,jhendrixMSFT/corefx,gabrielPeart/corefx,ViktorHofer/corefx,weltkante/corefx,Jiayili1/corefx,Frank125/corefx,MaggieTsang/corefx,dkorolev/corefx,Priya91/corefx-1,stormleoxia/corefx,DnlHarvey/corefx,stephenmichaelf/corefx,benpye/corefx,jcme/corefx,benjamin-bader/corefx,Frank125/corefx,andyhebear/corefx,oceanho/corefx,uhaciogullari/corefx,the-dwyer/corefx,claudelee/corefx,Chrisboh/corefx,rubo/corefx,dotnet-bot/corefx,mokchhya/corefx,ViktorHofer/corefx,dtrebbien/corefx,stephenmichaelf/corefx,DnlHarvey/corefx,Chrisboh/corefx,dotnet-bot/corefx,spoiledsport/corefx,parjong/corefx,bitcrazed/corefx,twsouthwick/corefx,MaggieTsang/corefx,lggomez/corefx,DnlHarvey/corefx,shimingsg/corefx,seanshpark/corefx,Yanjing123/corefx,rajansingh10/corefx,huanjie/corefx,YoupHulsebos/corefx,elijah6/corefx,chaitrakeshav/corefx,nelsonsar/corefx,vrassouli/corefx,jhendrixMSFT/corefx,ellismg/corefx,n1ghtmare/corefx,akivafr123/corefx,manu-silicon/corefx,lydonchandra/corefx,dotnet-bot/corefx,chenkennt/corefx,ravimeda/corefx,vidhya-bv/corefx-sorting,stormleoxia/corefx,bpschoch/corefx,Chrisboh/corefx,PatrickMcDonald/corefx,CloudLens/corefx,iamjasonp/corefx,krk/corefx,dotnet-bot/corefx,elijah6/corefx,cydhaselton/corefx,vijaykota/corefx,ravimeda/corefx,690486439/corefx,mmitche/corefx,alexperovich/corefx,brett25/corefx,cartermp/corefx,scott156/corefx,stone-li/corefx,alexperovich/corefx,stormleoxia/corefx,claudelee/corefx,stephenmichaelf/corefx,billwert/corefx,pallavit/corefx,VPashkov/corefx,viniciustaveira/corefx,chenxizhang/corefx,arronei/corefx,dkorolev/corefx,vrassouli/corefx,JosephTremoulet/corefx,VPashkov/corefx,ptoonen/corefx,erpframework/corefx,uhaciogullari/corefx,comdiv/corefx,jlin177/corefx,lydonchandra/corefx,zhenlan/corefx,billwert/corefx,arronei/corefx,Petermarcu/corefx,spoiledsport/corefx,jlin177/corefx,Jiayili1/corefx,SGuyGe/corefx,shahid-pk/corefx,huanjie/corefx,Chrisboh/corefx,richlander/corefx,shmao/corefx,jlin177/corefx,rjxby/corefx,seanshpark/corefx,Petermarcu/corefx,marksmeltzer/corefx,alphonsekurian/corefx,iamjasonp/corefx,mellinoe/corefx,zhenlan/corefx,jhendrixMSFT/corefx,mmitche/corefx,wtgodbe/corefx,mmitche/corefx,krytarowski/corefx,CherryCxldn/corefx,ellismg/corefx,PatrickMcDonald/corefx,s0ne0me/corefx,krk/corefx,weltkante/corefx,twsouthwick/corefx,rahku/corefx,nbarbettini/corefx,jlin177/corefx,tijoytom/corefx,Alcaro/corefx,larsbj1988/corefx,cydhaselton/corefx,fernando-rodriguez/corefx,cydhaselton/corefx,iamjasonp/corefx,ptoonen/corefx,vijaykota/corefx,Petermarcu/corefx,janhenke/corefx,zmaruo/corefx,ViktorHofer/corefx,yizhang82/corefx,SGuyGe/corefx,zmaruo/corefx,jcme/corefx,ptoonen/corefx,jlin177/corefx,viniciustaveira/corefx,dhoehna/corefx,rubo/corefx,ericstj/corefx,ViktorHofer/corefx,VPashkov/corefx,twsouthwick/corefx,DnlHarvey/corefx,anjumrizwi/corefx,tijoytom/corefx,dhoehna/corefx,shmao/corefx,claudelee/corefx,Chrisboh/corefx,dtrebbien/corefx,alphonsekurian/corefx,zmaruo/corefx,elijah6/corefx,manu-silicon/corefx,oceanho/corefx,shimingsg/corefx,s0ne0me/corefx,shahid-pk/corefx,stone-li/corefx,Winsto/corefx,manu-silicon/corefx,Yanjing123/corefx,gregg-miskelly/corefx,stephenmichaelf/corefx,heXelium/corefx,dkorolev/corefx,weltkante/corefx,CherryCxldn/corefx,dkorolev/corefx,vidhya-bv/corefx-sorting,Ermiar/corefx,thiagodin/corefx,elijah6/corefx,gkhanna79/corefx,ellismg/corefx,Jiayili1/corefx,KrisLee/corefx,kkurni/corefx,gabrielPeart/corefx,shmao/corefx,Winsto/corefx,tijoytom/corefx,wtgodbe/corefx,scott156/corefx,rahku/corefx,s0ne0me/corefx,twsouthwick/corefx,rajansingh10/corefx,Alcaro/corefx,PatrickMcDonald/corefx,rubo/corefx,comdiv/corefx
|
src/System.Threading/src/System/Threading/Helpers.CoreCLR.cs
|
src/System.Threading/src/System/Threading/Helpers.CoreCLR.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace System.Threading
{
/// <summary>
/// Contains Core-CLR specific Sleep and Spin-wait logic
/// </summary>
internal static class Helpers
{
internal static void Sleep(int milliseconds)
{
Thread.Sleep(milliseconds);
}
internal static void Spin(int iterations)
{
Thread.SpinWait(iterations);
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace System.Threading
{
/// <summary>
/// Contains Core-CLR specific Sleep and Spin-wait logic
/// </summary>
internal static class Helpers
{
private static readonly WaitHandle s_sleepHandle = new System.Threading.ManualResetEvent(false);
internal static void Sleep(uint milliseconds)
{
s_sleepHandle.WaitOne((int)milliseconds);
}
internal static void Spin(int iterations)
{
Thread.SpinWait(iterations);
}
}
}
|
mit
|
C#
|
b71aa76ccd3842ec2938dc7a8bf12405ca14dc05
|
Update version number for 1.2.2.0 release
|
markashleybell/MAB.DotIgnore,markashleybell/MAB.DotIgnore
|
MAB.DotIgnore/Properties/AssemblyInfo.cs
|
MAB.DotIgnore/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("MAB.DotIgnore")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MAB.DotIgnore")]
[assembly: AssemblyCopyright("Copyright © Mark Ashley Bell 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("fed27394-3783-46a4-9449-8edf1ff197e4")]
// Expose internal classes to unit test assembly
[assembly:InternalsVisibleTo("MAB.DotIgnore.Test")]
// 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: AssemblyInformationalVersion("1.2.2")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MAB.DotIgnore")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MAB.DotIgnore")]
[assembly: AssemblyCopyright("Copyright © Mark Ashley Bell 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("fed27394-3783-46a4-9449-8edf1ff197e4")]
// Expose internal classes to unit test assembly
[assembly:InternalsVisibleTo("MAB.DotIgnore.Test")]
// 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.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1")]
|
mit
|
C#
|
09d70ba2549cc41b79a84a1ae421bbba905342ba
|
update assumblyinfo
|
brandonseydel/MailChimp.Net
|
MailChimp.Net/Properties/AssemblyInfo.cs
|
MailChimp.Net/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("MailChimp.Net")]
[assembly: AssemblyDescription("A .NET Wrapper for Mail Chimp v3.0 API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Brandon Seydel")]
[assembly: AssemblyProduct("MailChimp.Net")]
[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)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("74f62c2b-b935-4284-85de-df37f62a431c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MailChimp.Net")]
[assembly: AssemblyDescription("A .NET Wrapper for Mail Chimp v3.0 API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Brandon Seydel")]
[assembly: AssemblyProduct("MailChimp.Net")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: as]
// 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("74f62c2b-b935-4284-85de-df37f62a431c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
b9e652d39f6e14d998e119828fe931153c7cabf9
|
Fix the not registered fare deal options.
|
lehmamic/columbus,lehmamic/columbus
|
Diskordia.Columbus.Bots/BotsExtensions.cs
|
Diskordia.Columbus.Bots/BotsExtensions.cs
|
using System;
using Diskordia.Columbus.Bots.FareDeals;
using Diskordia.Columbus.Bots.FareDeals.SingaporeAirlines;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Diskordia.Columbus.Bots
{
public static class BotsExtensions
{
public static IServiceCollection AddFareDealBots(this IServiceCollection services, IConfiguration configuration)
{
if(services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
services.AddTransient<IFareDealScanService, SingaporeAirlinesFareDealService>();
services.Configure<SingaporeAirlinesOptions>(configuration.GetSection("FareDealScan:SingaporeAirlines"));
services.Configure<FareDealScanOptions>(configuration.GetSection("FareDealScan"));
return services;
}
}
}
|
using System;
using Diskordia.Columbus.Bots.FareDeals;
using Diskordia.Columbus.Bots.FareDeals.SingaporeAirlines;
using Diskordia.Columbus.Common;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Diskordia.Columbus.Bots
{
public static class BotsExtensions
{
public static IServiceCollection AddFareDealBots(this IServiceCollection services, IConfiguration configuration)
{
if(services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
services.AddTransient<IFareDealScanService, SingaporeAirlinesFareDealService>();
services.Configure<SingaporeAirlinesOptions>(configuration.GetSection("FareDealScan:SingaporeAirlines"));
return services;
}
}
}
|
mit
|
C#
|
71f76986ffd89c07a9c6ec81671b3f5c401cda6f
|
Throw Exception if arg < 0 using Throw Expression
|
treymack/fibonacci
|
FibCSharp/Program.cs
|
FibCSharp/Program.cs
|
using System;
using System.Linq;
namespace FibCSharp
{
class Program
{
static void Main(string[] args)
{
var max = 50;
Enumerable.Range(0, int.MaxValue)
.Select(Fib)
.TakeWhile(x => x <= max)
.ToList()
.ForEach(Console.WriteLine);
}
static int Fib(int arg) =>
arg < 0 ? throw new Exception("Argument must be >= 0")
: arg == 0 ? 0
: arg == 1 ? 1
: Fib(arg - 2) + Fib(arg - 1);
}
}
|
using System;
using System.Linq;
namespace FibCSharp
{
class Program
{
static void Main(string[] args)
{
var max = 50;
Enumerable.Range(0, int.MaxValue)
.Select(Fib)
.TakeWhile(x => x <= max)
.ToList()
.ForEach(Console.WriteLine);
}
static int Fib(int arg) =>
arg == 0 ? 0
: arg == 1 ? 1
: Fib(arg - 2) + Fib(arg - 1);
}
}
|
unlicense
|
C#
|
c1072bfc983e4dc4be94ee662915e810d28fdb1a
|
Change file version.
|
stackia/SteamFriendsManager
|
SteamFriendsManager/Properties/AssemblyInfo.cs
|
SteamFriendsManager/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Steam Friends Manager")]
[assembly: AssemblyDescription("Manage your Steam friends without the original Steam client.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Stackia")]
[assembly: AssemblyProduct("Steam Friends Manager")]
[assembly: AssemblyCopyright("Copyright © Stackia 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0")]
[assembly: NeutralResourcesLanguage("zh")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Steam Friends Manager")]
[assembly: AssemblyDescription("Manage your Steam friends without the original Steam client.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Stackia")]
[assembly: AssemblyProduct("Steam Friends Manager")]
[assembly: AssemblyCopyright("Copyright © Stackia 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("zh")]
|
bsd-3-clause
|
C#
|
7d5e791c27f1bc4b00afa6778f046a9e7e7cf1d8
|
Split ModuleOutput tests to separate asserts
|
cskeppstedt/t4ts,AkosLukacs/t4ts,cskeppstedt/t4ts,AkosLukacs/t4ts,dolly22/t4ts,dolly22/t4ts,bazubii/t4ts,bazubii/t4ts
|
T4TS.Tests/Output/ModuleOutputAppenderTests.cs
|
T4TS.Tests/Output/ModuleOutputAppenderTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace T4TS.Tests
{
[TestClass]
public class ModuleOutputAppenderTests
{
[TestMethod]
public void TypescriptVersion083YieldsModule()
{
var sb = new StringBuilder();
var module = new TypeScriptModule
{
QualifiedName = "Foo"
};
var appender = new ModuleOutputAppender(sb, 0, new Settings
{
CompatibilityVersion = new Version(0, 8, 3)
});
appender.AppendOutput(module);
Assert.IsTrue(sb.ToString().StartsWith("module "));
}
[TestMethod]
public void TypescriptVersion090YieldsDeclareModule()
{
var sb = new StringBuilder();
var module = new TypeScriptModule
{
QualifiedName = "Foo"
};
var appender = new ModuleOutputAppender(sb, 0, new Settings
{
CompatibilityVersion = new Version(0, 9, 0)
});
appender.AppendOutput(module);
Assert.IsTrue(sb.ToString().StartsWith("declare module "));
}
[TestMethod]
public void DefaultTypescriptVersionYieldsDeclareModule()
{
var sb = new StringBuilder();
var module = new TypeScriptModule
{
QualifiedName = "Foo"
};
var appender = new ModuleOutputAppender(sb, 0, new Settings
{
CompatibilityVersion = null
});
appender.AppendOutput(module);
Assert.IsTrue(sb.ToString().StartsWith("declare module "));
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace T4TS.Tests
{
[TestClass]
public class ModuleOutputAppenderTests
{
[TestMethod]
public void ModuleOutputAppenderRespectsCompatibilityVersion()
{
var sb = new StringBuilder();
var module = new TypeScriptModule
{
QualifiedName = "Foo"
};
var settings = new Settings();
var appender = new ModuleOutputAppender(sb, 0, settings);
settings.CompatibilityVersion = new Version(0, 8, 3);
appender.AppendOutput(module);
Assert.IsTrue(sb.ToString().StartsWith("module"));
sb.Clear();
settings.CompatibilityVersion = new Version(0, 9, 0);
appender.AppendOutput(module);
Assert.IsTrue(sb.ToString().StartsWith("declare module"));
sb.Clear();
settings.CompatibilityVersion = null;
appender.AppendOutput(module);
Assert.IsTrue(sb.ToString().StartsWith("declare module"));
}
}
}
|
apache-2.0
|
C#
|
d3c7295886022924c7d898cfb90637f2831b1bde
|
change method name to avoid hiding
|
andrewjk/Watsonia.Data
|
Watsonia.Data.TestPerformance/WatsoniaConfiguration.cs
|
Watsonia.Data.TestPerformance/WatsoniaConfiguration.cs
|
using System;
using System.Linq;
using System.Reflection;
using Watsonia.Data.SQLite;
using Watsonia.Data.SqlServer;
namespace Watsonia.Data.TestPerformance
{
internal sealed class WatsoniaConfiguration : DatabaseConfiguration
{
public WatsoniaConfiguration(string connectionString, string entityNamespace)
: base(GetDataAccessProvider(), connectionString, entityNamespace)
{
}
private static IDataAccessProvider GetDataAccessProvider()
{
if (Config.UseSqlServer)
{
return new SqlServerDataAccessProvider();
}
else
{
return new SQLiteDataAccessProvider();
}
}
public override bool ShouldCacheType(Type type)
{
return false;
}
public override string GetTableName(Type type)
{
return base.GetTableName(type) + "s";
}
//// HACK: If we remove this override, we get two columns e.g. SportID and SportsID
//// We should be connecting up related types and properties more intelligently
//public override string GetForeignKeyColumnName(PropertyInfo property)
//{
// return property.Name.TrimEnd('s') + "ID";
//}
//public override string GetForeignKeyColumnName(Type tableType, Type foreignType)
//{
// return foreignType.Name.TrimEnd('s') + "ID";
//}
// HACK: If we remove this override, we get two columns e.g. SportID and SportsID
// We should be connecting up related types and properties more intelligently
public override string GetForeignKeyColumnName(PropertyInfo property)
{
return property.Name + "sID";
}
public override string GetForeignKeyColumnName(Type tableType, Type foreignType)
{
return foreignType.Name + "sID";
}
}
}
|
using System;
using System.Linq;
using System.Reflection;
using Watsonia.Data.SQLite;
using Watsonia.Data.SqlServer;
namespace Watsonia.Data.TestPerformance
{
internal sealed class WatsoniaConfiguration : DatabaseConfiguration
{
public WatsoniaConfiguration(string connectionString, string entityNamespace)
: base(DataAccessProvider(), connectionString, entityNamespace)
{
}
private static IDataAccessProvider DataAccessProvider()
{
if (Config.UseSqlServer)
{
return new SqlServerDataAccessProvider();
}
else
{
return new SQLiteDataAccessProvider();
}
}
public override bool ShouldCacheType(Type type)
{
return false;
}
public override string GetTableName(Type type)
{
return base.GetTableName(type) + "s";
}
//// HACK: If we remove this override, we get two columns e.g. SportID and SportsID
//// We should be connecting up related types and properties more intelligently
//public override string GetForeignKeyColumnName(PropertyInfo property)
//{
// return property.Name.TrimEnd('s') + "ID";
//}
//public override string GetForeignKeyColumnName(Type tableType, Type foreignType)
//{
// return foreignType.Name.TrimEnd('s') + "ID";
//}
// HACK: If we remove this override, we get two columns e.g. SportID and SportsID
// We should be connecting up related types and properties more intelligently
public override string GetForeignKeyColumnName(PropertyInfo property)
{
return property.Name + "sID";
}
public override string GetForeignKeyColumnName(Type tableType, Type foreignType)
{
return foreignType.Name + "sID";
}
}
}
|
mit
|
C#
|
69e3aa8499e5176a9d1369e70d5276f61b3b2a1c
|
Update MaxCount.cs
|
michaeljwebb/Algorithm-Practice
|
LeetCode/MaxCount.cs
|
LeetCode/MaxCount.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class MaxCount
{
public static void Main(String[] args)
{
int[] nums = { 2, 3, 4, 9, 5, 5, 8, 5, 0 };
FindMaxCount(nums);
}
public static int FindMaxCount(int[] nums)
{
Dictionary<int, int> _maxCount = new Dictionary<int, int>();
int maxKeyCount = 0;
int count = 0;
for (int i = 0; i < nums.Length; i++)
{
if (!_maxCount.ContainsKey(nums[i]))
{
_maxCount.Add(nums[i], 1);
}
else
{
int tempCount = (int)_maxCount[nums[i]];
tempCount++;
_maxCount.Remove(nums[i]);
_maxCount.Add(nums[i], tempCount);
if (count < tempCount)
{
count = tempCount;
maxKeyCount = nums[i];
}
}
}
Console.WriteLine("Max Count: " + maxKeyCount);
Console.WriteLine("Occurences: " + count);
return maxKeyCount;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class MaxCount
{
public static void Main(String[] args)
{
int[] nums = { 2, 3, 4, 9, 5, 5, 8, 5, 0 };
FindMaxCount(nums);
}
public static int FindMaxCount(int[] nums)
{
Dictionary<int, int> _maxCount = new Dictionary<int, int>();
int maxKeyCount = 0;
int count = 0;
for (int i = 0; i < nums.Length; i++)
{
if (!_maxCount.ContainsKey(nums[i]))
{
_maxCount.Add(nums[i], 1);
}
else
{
int tempCount = (int)_maxCount[nums[i]];
tempCount++;
_maxCount.Remove(nums[i]);
_maxCount.Add(nums[i], tempCount);
if (count < tempCount)
{
count = tempCount;
maxKeyCount = nums[i];
}
}
}
Console.WriteLine("Max Count: " + maxKeyCount);
Console.WriteLine("Occurences: " + count);
return maxKeyCount;
}
}
|
mit
|
C#
|
8d43421ff3cd30d6ffca3aa01aa8863294f29d3c
|
Change version up to 0.5.1
|
matiasbeckerle/breakout,matiasbeckerle/perspektiva,matiasbeckerle/arkanoid
|
source/Assets/Scripts/Loader.cs
|
source/Assets/Scripts/Loader.cs
|
using UnityEngine;
using System.Reflection;
[assembly: AssemblyVersion("0.5.1.*")]
public class Loader : MonoBehaviour
{
/// <summary>
/// DebugUI prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _debugUI;
/// <summary>
/// ModalDialog prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _modalDialog;
/// <summary>
/// MainMenu prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _mainMenu;
/// <summary>
/// InGameUI prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _inGameUI;
/// <summary>
/// SoundManager prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _soundManager;
/// <summary>
/// GameManager prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _gameManager;
protected void Awake()
{
// Check if the instances have already been assigned to static variables or they are still null.
if (DebugUI.Instance == null)
{
Instantiate(_debugUI);
}
if (ModalDialog.Instance == null)
{
Instantiate(_modalDialog);
}
if (MainMenu.Instance == null)
{
Instantiate(_mainMenu);
}
if (InGameUI.Instance == null)
{
Instantiate(_inGameUI);
}
if (SoundManager.Instance == null)
{
Instantiate(_soundManager);
}
if (GameManager.Instance == null)
{
Instantiate(_gameManager);
}
}
}
|
using UnityEngine;
using System.Reflection;
[assembly: AssemblyVersion("0.5.0.*")]
public class Loader : MonoBehaviour
{
/// <summary>
/// DebugUI prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _debugUI;
/// <summary>
/// ModalDialog prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _modalDialog;
/// <summary>
/// MainMenu prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _mainMenu;
/// <summary>
/// InGameUI prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _inGameUI;
/// <summary>
/// SoundManager prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _soundManager;
/// <summary>
/// GameManager prefab to instantiate.
/// </summary>
[SerializeField]
private GameObject _gameManager;
protected void Awake()
{
// Check if the instances have already been assigned to static variables or they are still null.
if (DebugUI.Instance == null)
{
Instantiate(_debugUI);
}
if (ModalDialog.Instance == null)
{
Instantiate(_modalDialog);
}
if (MainMenu.Instance == null)
{
Instantiate(_mainMenu);
}
if (InGameUI.Instance == null)
{
Instantiate(_inGameUI);
}
if (SoundManager.Instance == null)
{
Instantiate(_soundManager);
}
if (GameManager.Instance == null)
{
Instantiate(_gameManager);
}
}
}
|
unknown
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.