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
804ce50faaf2d5c0352ad139fa07acca1e0b3964
Add --colors-per-row argument for e.g. 16x16 rendering of 256-color palette.
Prof9/PixelPet
PixelPet/CLI/Commands/RenderPalettesCmd.cs
PixelPet/CLI/Commands/RenderPalettesCmd.cs
using LibPixelPet; using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; namespace PixelPet.CLI.Commands { internal class RenderPalettesCmd : CliCommand { public RenderPalettesCmd() : base("Render-Palettes", new Parameter("colors-per-row", "cw", false, new ParameterValue("count", "0")) ) { } protected override void Run(Workbench workbench, ILogger logger) { int maxTilesPerRow = FindNamedParameter("--colors-per-row").Values[0].ToInt32(); if (maxTilesPerRow < 0) { logger?.Log("Invalid colors per row.", LogLevel.Error); return; } int tw = 8; int th = 8; int maxColors = workbench.PaletteSet.Max(pe => pe.Palette.Count); int palCount = workbench.PaletteSet.Count; if (maxTilesPerRow == 0) { maxTilesPerRow = maxColors; } int w = maxTilesPerRow; int h = workbench.PaletteSet.Sum(pe => (pe.Palette.Count + maxTilesPerRow - 1) / maxTilesPerRow); if (w <= 0 || h <= 0) { logger?.Log("Cannot render empty palette set.", LogLevel.Error); return; } int count = 0; ColorFormat fmt = ColorFormat.BGRA8888; workbench.ClearBitmap(w * tw, h * th); workbench.Graphics.CompositingMode = CompositingMode.SourceCopy; using (SolidBrush brush = new SolidBrush(Color.Black)) { int p = 0; int c = 0; for (int j = 0; j < h; j++) { Palette pal = workbench.PaletteSet[p].Palette; for (int i = 0; i < w; i++) { // Draw transparent if we ran out of colors. if (c >= pal.Count) { brush.Color = Color.Transparent; } else { brush.Color = Color.FromArgb(fmt.Convert(pal[c++], pal.Format)); } workbench.Graphics.FillRectangle(brush, i * tw, j * th, tw, th); count++; } // Go to next palette. if (c >= pal.Count) { p++; c = 0; } } } workbench.Graphics.Flush(); logger?.Log("Rendered " + w + "x" + h + " palette set containing " + count + " colors.", LogLevel.Information); } } }
using LibPixelPet; using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; namespace PixelPet.CLI.Commands { internal class RenderPalettesCmd : CliCommand { public RenderPalettesCmd() : base("Render-Palettes") { } protected override void Run(Workbench workbench, ILogger logger) { int tw = 8; int th = 8; int w = workbench.PaletteSet.Max(pe => pe.Palette.Count); int h = workbench.PaletteSet.Count; if (w <= 0 || h <= 0) { logger?.Log("Cannot render empty palette set.", LogLevel.Error); return; } int count = 0; ColorFormat fmt = ColorFormat.BGRA8888; workbench.ClearBitmap(w * tw, h * th); workbench.Graphics.CompositingMode = CompositingMode.SourceCopy; using (SolidBrush brush = new SolidBrush(Color.Black)) { for (int i = 0; i < workbench.PaletteSet.Count; i++) { Palette pal = workbench.PaletteSet[i].Palette; for (int j = 0; j < pal.Count; j++) { brush.Color = Color.FromArgb(fmt.Convert(pal[j], pal.Format)); workbench.Graphics.FillRectangle(brush, j * tw, i * th, tw, th); count++; } } } workbench.Graphics.Flush(); logger?.Log("Rendered " + w + "x" + h + " palette set containing " + count + " colors.", LogLevel.Information); } } }
mit
C#
0cf2ee564bcebc86fa0b07971d2da1aaca76b422
Configure lowercase urls
Xenoleth/Reverb-MVC,Xenoleth/Reverb-MVC,Xenoleth/Reverb-MVC
Reverb/Reverb.Web/App_Start/RouteConfig.cs
Reverb/Reverb.Web/App_Start/RouteConfig.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace Reverb.Web { public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.LowercaseUrls = true; routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace Reverb.Web { public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } }
mit
C#
4d6546188b3e59fbc3bbf244ec3e3eba250c52e0
Add default args (for inference)
sharper-library/Sharper.C.Eq
Sharper.C.Eq/Data/EqInstances/Instances.cs
Sharper.C.Eq/Data/EqInstances/Instances.cs
using System; using System.Collections.Generic; using System.Linq; namespace Sharper.C.Data.EqInstances { public struct EqInt : Eq<int> { public bool Equal(int x, int y) => x == y; } public struct EqUInt : Eq<uint> { public bool Equal(uint x, uint y) => x == y; } public struct EqLong : Eq<long> { public bool Equal(long x, long y) => x == y; } public struct EqByte : Eq<byte> { public bool Equal(byte x, byte y) => x == y; } public struct EqChar : Eq<char> { public bool Equal(char x, char y) => x == y; } public struct EqBool : Eq<bool> { public bool Equal(bool x, bool y) => x == y; } public struct EqString : Eq<string> { public bool Equal(string x, string y) => x == y; } public struct EqEnumerable<A, EqA> : Eq<IEnumerable<A>> where EqA : Eq<A> { public EqEnumerable(EqA _eqA = default(EqA)) { } public bool Equal(IEnumerable<A> x, IEnumerable<A> y) => x.SequenceEqual(y, default(EqA).ToEqualityComparer()); } public struct EqTuple<A, EqA, B, EqB> : Eq<Tuple<A, B>> where EqA : Eq<A> where EqB : Eq<B> { public EqTuple(EqA _eqA = default(EqA), EqB _eqB = default(EqB)) { } public bool Equal(Tuple<A, B> x, Tuple<A, B> y) => default(EqA).Equal(x.Item1, y.Item1) && default(EqB).Equal(x.Item2, y.Item2); } }
using System; using System.Collections.Generic; using System.Linq; namespace Sharper.C.Data.EqInstances { public struct EqInt : Eq<int> { public bool Equal(int x, int y) => x == y; } public struct EqUInt : Eq<uint> { public bool Equal(uint x, uint y) => x == y; } public struct EqLong : Eq<long> { public bool Equal(long x, long y) => x == y; } public struct EqByte : Eq<byte> { public bool Equal(byte x, byte y) => x == y; } public struct EqChar : Eq<char> { public bool Equal(char x, char y) => x == y; } public struct EqBool : Eq<bool> { public bool Equal(bool x, bool y) => x == y; } public struct EqString : Eq<string> { public bool Equal(string x, string y) => x == y; } public struct EqEnumerable<A, AEq> : Eq<IEnumerable<A>> where AEq : Eq<A> { public bool Equal(IEnumerable<A> x, IEnumerable<A> y) => x.SequenceEqual(y, default(AEq).ToEqualityComparer()); } public struct EqTuple<A, AEq, B, BEq> : Eq<Tuple<A, B>> where AEq : Eq<A> where BEq : Eq<B> { public bool Equal(Tuple<A, B> x, Tuple<A, B> y) => default(AEq).Equal(x.Item1, y.Item1) && default(BEq).Equal(x.Item2, y.Item2); } }
mit
C#
12dd8d611286f8fb88791b76b4bca97475e71d8e
fix bad merge that lost removal of net45 from portable app test
AbhitejJohn/cli,anurse/Cli,JohnChen0/cli,MichaelSimons/cli,ravimeda/cli,dasMulli/cli,blackdwarf/cli,borgdylan/dotnet-cli,johnbeisner/cli,mylibero/cli,jkotas/cli,naamunds/cli,nguerrera/cli,livarcocc/cli-1,gkhanna79/cli,marono/cli,dasMulli/cli,AbhitejJohn/cli,jonsequitur/cli,johnbeisner/cli,mylibero/cli,harshjain2/cli,stuartleeks/dotnet-cli,weshaggard/cli,blackdwarf/cli,mylibero/cli,nguerrera/cli,marono/cli,schellap/cli,schellap/cli,krwq/cli,borgdylan/dotnet-cli,mylibero/cli,borgdylan/dotnet-cli,EdwardBlair/cli,schellap/cli,svick/cli,Faizan2304/cli,stuartleeks/dotnet-cli,Faizan2304/cli,gkhanna79/cli,AbhitejJohn/cli,weshaggard/cli,livarcocc/cli-1,krwq/cli,marono/cli,ravimeda/cli,FubarDevelopment/cli,danquirk/cli,JohnChen0/cli,krwq/cli,FubarDevelopment/cli,jkotas/cli,jonsequitur/cli,gkhanna79/cli,dasMulli/cli,svick/cli,mlorbetske/cli,krwq/cli,FubarDevelopment/cli,stuartleeks/dotnet-cli,borgdylan/dotnet-cli,naamunds/cli,harshjain2/cli,marono/cli,MichaelSimons/cli,FubarDevelopment/cli,schellap/cli,jonsequitur/cli,JohnChen0/cli,jonsequitur/cli,jkotas/cli,schellap/cli,MichaelSimons/cli,mlorbetske/cli,danquirk/cli,jkotas/cli,JohnChen0/cli,blackdwarf/cli,naamunds/cli,mlorbetske/cli,svick/cli,weshaggard/cli,MichaelSimons/cli,naamunds/cli,weshaggard/cli,Faizan2304/cli,danquirk/cli,blackdwarf/cli,krwq/cli,danquirk/cli,AbhitejJohn/cli,jkotas/cli,harshjain2/cli,livarcocc/cli-1,mlorbetske/cli,EdwardBlair/cli,weshaggard/cli,naamunds/cli,gkhanna79/cli,mylibero/cli,MichaelSimons/cli,johnbeisner/cli,stuartleeks/dotnet-cli,nguerrera/cli,EdwardBlair/cli,gkhanna79/cli,marono/cli,borgdylan/dotnet-cli,danquirk/cli,stuartleeks/dotnet-cli,nguerrera/cli,ravimeda/cli,schellap/cli
test/dotnet-build.Tests/BuildPortableTests.cs
test/dotnet-build.Tests/BuildPortableTests.cs
using System.IO; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; namespace Microsoft.DotNet.Tools.Builder.Tests { public class BuildPortableTests : TestBase { [Fact] public void BuildingAPortableProjectProducesDepsFile() { var testInstance = TestAssetsManager.CreateTestInstance("BuildTestPortableProject") .WithLockFiles(); var result = new BuildCommand( projectPath: testInstance.TestRoot, forcePortable: true) .ExecuteWithCapturedOutput(); result.Should().Pass(); var outputBase = new DirectoryInfo(Path.Combine(testInstance.TestRoot, "bin", "Debug")); var netstandardappOutput = outputBase.Sub("netstandardapp1.5"); netstandardappOutput.Should() .Exist().And .HaveFiles(new[] { "BuildTestPortableProject.deps", "BuildTestPortableProject.dll", "BuildTestPortableProject.pdb" }); } } }
using System.IO; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; namespace Microsoft.DotNet.Tools.Builder.Tests { public class BuildPortableTests : TestBase { [Fact] public void BuildingAPortableProjectProducesDepsFile() { var testInstance = TestAssetsManager.CreateTestInstance("BuildTestPortableProject") .WithLockFiles(); var result = new BuildCommand( projectPath: testInstance.TestRoot, forcePortable: true) .ExecuteWithCapturedOutput(); result.Should().Pass(); var outputBase = new DirectoryInfo(Path.Combine(testInstance.TestRoot, "bin", "Debug")); var netstandardappOutput = outputBase.Sub("netstandardapp1.5"); var fxSubdirs = new[] { netstandardappOutput, outputBase.Sub("net45") }; foreach(var fxSubdir in fxSubdirs) { fxSubdir.Should() .Exist().And .HaveFiles(new[] { "BuildTestPortableProject.dll", "BuildTestPortableProject.pdb" }); } netstandardappOutput.Should().HaveFile("BuildTestPortableProject.deps"); } } }
mit
C#
8583f979a9d64e07f2bac1503f7c41cd5534a279
Update AssemblyInfo
DataGenSoftware/Sql.Net
Sql.Net/Sql.Net/Properties/AssemblyInfo.cs
Sql.Net/Sql.Net/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("Sql.Net")] [assembly: AssemblyDescription("Sql Server Extension")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("DataGen")] [assembly: AssemblyProduct("Sql.Net")] [assembly: AssemblyCopyright("Copyright © DataGen 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("641c7260-be32-48fa-ae56-35a6aa97937b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Sql.Net")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("DataGen")] [assembly: AssemblyProduct("Sql.Net")] [assembly: AssemblyCopyright("Copyright © DataGen 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("641c7260-be32-48fa-ae56-35a6aa97937b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
mit
C#
1e4235575c7fcb8c305bb209401c666934e74310
Update SerializerBase.cs
tiksn/TIKSN-Framework
TIKSN.Core/Serialization/SerializerBase.cs
TIKSN.Core/Serialization/SerializerBase.cs
using System; namespace TIKSN.Serialization { public abstract class SerializerBase<TSerial> : ISerializer<TSerial> where TSerial : class { public TSerial Serialize<T>(T obj) { try { return this.SerializeInternal(obj); } catch (Exception ex) { throw new SerializerException("Serialization failed.", ex); } } protected abstract TSerial SerializeInternal<T>(T obj); } }
using System; namespace TIKSN.Serialization { public abstract class SerializerBase<TSerial> : ISerializer<TSerial> where TSerial : class { public TSerial Serialize<T>(T obj) { try { return SerializeInternal(obj); } catch (Exception ex) { throw new SerializerException("Serialization failed.", ex); } } protected abstract TSerial SerializeInternal<T>(T obj); } }
mit
C#
79ac91081946303056057fe799c965810e1206d7
Add explicit [NotNull] for implementation of external unannotated interface, improve doc comments
ulrichb/ImplicitNullability,ulrichb/ImplicitNullability,ulrichb/ImplicitNullability
Src/ImplicitNullability.Plugin/ImplicitNullabilityCustomCodeAnnotationProvider.cs
Src/ImplicitNullability.Plugin/ImplicitNullabilityCustomCodeAnnotationProvider.cs
using System.Diagnostics; using ImplicitNullability.Plugin.Infrastructure; using JetBrains.Annotations; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CodeAnnotations; using JetBrains.Util; using ReSharperExtensionsShared.Debugging; #if !RESHARPER92 using System.Collections.Generic; #endif namespace ImplicitNullability.Plugin { /// <summary> /// An implementation of ReSharper's <see cref="ICustomCodeAnnotationProvider"/> extension point which uses /// the <see cref="ImplicitNullabilityProvider"/> to implement the Implicit Nullability rules. /// /// Note that these "custom" providers are called by R# at last (basically if there are no (inherited) nullability attributes). /// </summary> [PsiComponent] public class ImplicitNullabilityCustomCodeAnnotationProvider : ICustomCodeAnnotationProvider { private static readonly ILogger Logger = JetBrains.Util.Logging.Logger.GetLogger(typeof(ImplicitNullabilityCustomCodeAnnotationProvider)); private readonly ImplicitNullabilityProvider _implicitNullabilityProvider; public ImplicitNullabilityCustomCodeAnnotationProvider(ImplicitNullabilityProvider implicitNullabilityProvider) { Logger.Verbose(".ctor"); _implicitNullabilityProvider = implicitNullabilityProvider; } public CodeAnnotationNullableValue? GetNullableAttribute([NotNull] IDeclaredElement element) { #if DEBUG var stopwatch = Stopwatch.StartNew(); #endif var result = _implicitNullabilityProvider.AnalyzeDeclaredElement(element); #if DEBUG LogResult("Attribute for ", element, stopwatch, result); #endif return result; } public CodeAnnotationNullableValue? GetContainerElementNullableAttribute([NotNull] IDeclaredElement element) { #if DEBUG var stopwatch = Stopwatch.StartNew(); #endif var result = _implicitNullabilityProvider.AnalyzeDeclaredElementContainerElement(element); #if DEBUG LogResult("Elem attr for ", element, stopwatch, result); #endif return result; } #if !RESHARPER92 public ICollection<IAttributeInstance> GetSpecialAttributeInstances([NotNull] IClrDeclaredElement element) { return EmptyList<IAttributeInstance>.InstanceList; } #endif #if DEBUG private static void LogResult(string messagePrefix, IDeclaredElement element, Stopwatch stopwatch, CodeAnnotationNullableValue? result) { var resultText = (result.IsUnknown() ? "UNKNOWN" : result.ToString()); var message = messagePrefix + DebugUtility.FormatIncludingContext(element) + " => " + resultText; Logger.Verbose(DebugUtility.FormatWithElapsed(message, stopwatch)); } #endif } }
using System.Diagnostics; using ImplicitNullability.Plugin.Infrastructure; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CodeAnnotations; using JetBrains.Util; using ReSharperExtensionsShared.Debugging; #if !RESHARPER92 using System.Collections.Generic; #endif namespace ImplicitNullability.Plugin { /// <summary> /// An implementation of ReSharper's <see cref="ICustomCodeAnnotationProvider"/> extension point which uses /// the <see cref="ImplicitNullabilityProvider"/> to implement the Implicit Nullability rules. /// </summary> [PsiComponent] public class ImplicitNullabilityCustomCodeAnnotationProvider : ICustomCodeAnnotationProvider { private static readonly ILogger Logger = JetBrains.Util.Logging.Logger.GetLogger(typeof(ImplicitNullabilityCustomCodeAnnotationProvider)); private readonly ImplicitNullabilityProvider _implicitNullabilityProvider; public ImplicitNullabilityCustomCodeAnnotationProvider(ImplicitNullabilityProvider implicitNullabilityProvider) { Logger.Verbose(".ctor"); _implicitNullabilityProvider = implicitNullabilityProvider; } public CodeAnnotationNullableValue? GetNullableAttribute(IDeclaredElement element) { #if DEBUG var stopwatch = Stopwatch.StartNew(); #endif var result = _implicitNullabilityProvider.AnalyzeDeclaredElement(element); #if DEBUG LogResult("Attribute for ", element, stopwatch, result); #endif return result; } public CodeAnnotationNullableValue? GetContainerElementNullableAttribute(IDeclaredElement element) { #if DEBUG var stopwatch = Stopwatch.StartNew(); #endif var result = _implicitNullabilityProvider.AnalyzeDeclaredElementContainerElement(element); #if DEBUG LogResult("Elem attr for ", element, stopwatch, result); #endif return result; } #if !RESHARPER92 public ICollection<IAttributeInstance> GetSpecialAttributeInstances(IClrDeclaredElement element) { return EmptyList<IAttributeInstance>.InstanceList; } #endif #if DEBUG private static void LogResult(string messagePrefix, IDeclaredElement element, Stopwatch stopwatch, CodeAnnotationNullableValue? result) { var resultText = (result.IsUnknown() ? "UNKNOWN" : result.ToString()); var message = messagePrefix + DebugUtility.FormatIncludingContext(element) + " => " + resultText; Logger.Verbose(DebugUtility.FormatWithElapsed(message, stopwatch)); } #endif } }
mit
C#
ba6a0ec42c35a40584699d23275dccfece3939b4
Add concat to array
kswoll/WootzJs,x335/WootzJs,kswoll/WootzJs,x335/WootzJs,x335/WootzJs,kswoll/WootzJs
WootzJs.Runtime/Runtime/WootzJs/JsArray.cs
WootzJs.Runtime/Runtime/WootzJs/JsArray.cs
#region License //----------------------------------------------------------------------- // <copyright> // The MIT License (MIT) // // Copyright (c) 2014 Kirk S Woll // // 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. // </copyright> //----------------------------------------------------------------------- #endregion using System.Collections; using System.Collections.Generic; namespace System.Runtime.WootzJs { [Js(Name = "Array", Export = false)] public class JsArray : JsObject { public JsArray() { } public JsArray(int size) { } public extern JsObject this[int index] { get; set; } public extern int length { get; set; } [Js(Name = "join")] public extern JsString join(); [Js(Name = "join")] public extern JsString join(JsString separator); [Js(Name = "slice")] public extern JsArray slice(int start, int end = 0); [Js(Name = "splice")] public extern void splice(int index, int howManyToRemove, params JsObject[] elements); [Js(Name = "push")] public extern void push(params JsObject[] elements); public extern JsObject pop(); [Js(Name = "indexOf")] public extern int indexOf(JsObject o); public extern void unshift(params JsObject[] prepend); public extern JsObject shift(params JsObject[] prepend); public extern void sort(JsFunction compareFunction); public extern JsArray concat(JsObject elements); public extern JsArray concat(JsObject[] elements); } }
#region License //----------------------------------------------------------------------- // <copyright> // The MIT License (MIT) // // Copyright (c) 2014 Kirk S Woll // // 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. // </copyright> //----------------------------------------------------------------------- #endregion using System.Collections; using System.Collections.Generic; namespace System.Runtime.WootzJs { [Js(Name = "Array", Export = false)] public class JsArray : JsObject { public JsArray() { } public JsArray(int size) { } public extern JsObject this[int index] { get; set; } public extern int length { get; set; } [Js(Name = "join")] public extern JsString join(); [Js(Name = "join")] public extern JsString join(JsString separator); [Js(Name = "slice")] public extern JsArray slice(int start, int end = 0); [Js(Name = "splice")] public extern void splice(int index, int howManyToRemove, params JsObject[] elements); [Js(Name = "push")] public extern void push(params JsObject[] elements); public extern JsObject pop(); [Js(Name = "indexOf")] public extern int indexOf(JsObject o); public extern void unshift(params JsObject[] prepend); public extern JsObject shift(params JsObject[] prepend); public extern void sort(JsFunction compareFunction); } }
mit
C#
df7ef05d19675be939b1b1582802eacb1def1a8b
Rectify AutomaticallyRenewingSagaLock not actually working Some debug code made it into the repository and build. Any lock wrapped in an AutomaticallyRenewingSagaLock would never actually perform locking and would just indicate it had acquired the lock
MrMDavidson/Rebus.SingleAccessSagas
Rebus.SingleAccessSagas/AutomaticallyRenewingSagaLock.cs
Rebus.SingleAccessSagas/AutomaticallyRenewingSagaLock.cs
using System; using System.Threading; using System.Threading.Tasks; using Rebus.Exceptions; namespace Rebus.SingleAccessSagas { /// <summary> /// Deferring implemtnation of <seealso cref="ISagaLock"/> which will automatically re-acquire the lock periodically. Useful for lease based locks /// </summary> public class AutomaticallyRenewingSagaLock : ISagaLock { private readonly ISagaLock _actualLock; private readonly TimeSpan _reacquistionInterval; private readonly Timer _lockRenewalTimer; private bool _acquiredLock = false; /// <summary> /// Wraps around another instance of a <seealso cref="ISagaLock"/> and automatically renews the lock periodically /// </summary> /// <param name="actualLock">An instance of a <seealso cref="ISagaLock"/> which performs the actual lock acquisition</param> /// <param name="reacquistionInterval">Period of time before the lock will be reacquired automatically</param> public AutomaticallyRenewingSagaLock(ISagaLock actualLock, TimeSpan reacquistionInterval) { _actualLock = actualLock; _reacquistionInterval = reacquistionInterval; _lockRenewalTimer = new Timer(RenewLock, null, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)); } /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary> public void Dispose() { _lockRenewalTimer?.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)); _actualLock?.Dispose(); } /// <summary> /// Attempt to acquire a lock. If the lock was successfully acquired return <c>true</c>. If the lock could not be acquired returns <c>false</c> /// </summary> public async Task<bool> TryAcquire() { _acquiredLock = await _actualLock.TryAcquire(); if (_acquiredLock == true) { _lockRenewalTimer.Change(_reacquistionInterval, _reacquistionInterval); } return _acquiredLock; } private async void RenewLock(object state) { if (await _actualLock.TryAcquire() == false) { throw new ConcurrencyException("Failed when attempting to re-acquire lock"); } } } }
using System; using System.Threading; using System.Threading.Tasks; using Rebus.Exceptions; namespace Rebus.SingleAccessSagas { /// <summary> /// Deferring implemtnation of <seealso cref="ISagaLock"/> which will automatically re-acquire the lock periodically. Useful for lease based locks /// </summary> public class AutomaticallyRenewingSagaLock : ISagaLock { private readonly ISagaLock _actualLock; private readonly TimeSpan _reacquistionInterval; private readonly Timer _lockRenewalTimer; private bool _acquiredLock = false; /// <summary> /// Wraps around another instance of a <seealso cref="ISagaLock"/> and automatically renews the lock periodically /// </summary> /// <param name="actualLock">An instance of a <seealso cref="ISagaLock"/> which performs the actual lock acquisition</param> /// <param name="reacquistionInterval">Period of time before the lock will be reacquired automatically</param> public AutomaticallyRenewingSagaLock(ISagaLock actualLock, TimeSpan reacquistionInterval) { _actualLock = actualLock; _reacquistionInterval = reacquistionInterval; _lockRenewalTimer = new Timer(RenewLock, null, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)); } /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary> public void Dispose() { _lockRenewalTimer?.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)); _actualLock?.Dispose(); } /// <summary> /// Attempt to acquire a lock. If the lock was successfully acquired return <c>true</c>. If the lock could not be acquired returns <c>false</c> /// </summary> public async Task<bool> TryAcquire() { if (_acquiredLock == false) { return true; } _acquiredLock = await _actualLock.TryAcquire(); if (_acquiredLock == true) { _lockRenewalTimer.Change(_reacquistionInterval, _reacquistionInterval); } return _acquiredLock; } private async void RenewLock(object state) { if (await _actualLock.TryAcquire() == false) { throw new ConcurrencyException("Failed when attempting to re-acquire lock"); } } } }
mit
C#
11368cf880a99a1e9f81b003ec7f031ce4a415fe
Use non-obsolete member
EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an,EamonNerbonne/a-vs-an
A-vs-An/WikipediaAvsAnTrieExtractorTest/NodeEqualityComparer.cs
A-vs-An/WikipediaAvsAnTrieExtractorTest/NodeEqualityComparer.cs
using System.Collections.Generic; using System.Linq; using AvsAnLib.Internals; namespace WikipediaAvsAnTrieExtractorTest { internal class NodeEqualityComparer : IEqualityComparer<Node> { public static readonly NodeEqualityComparer Instance = new NodeEqualityComparer(); public bool Equals(Node x, Node y) { return x.c == y.c && x.ratio.Occurrence == y.ratio.Occurrence && x.ratio.AminAnDiff == y.ratio.AminAnDiff && (x.SortedKids == null) == (y.SortedKids == null) && (x.SortedKids == null || x.SortedKids.Length == y.SortedKids.Length && x.SortedKids.SequenceEqual(y.SortedKids, Instance) ) ; } public int GetHashCode(Node obj) { return obj.c; } } }
using System.Collections.Generic; using System.Linq; using AvsAnLib.Internals; namespace WikipediaAvsAnTrieExtractorTest { internal class NodeEqualityComparer : IEqualityComparer<Node> { public static readonly NodeEqualityComparer Instance = new NodeEqualityComparer(); public bool Equals(Node x, Node y) { return x.c == y.c && x.ratio.Occurence == y.ratio.Occurence && x.ratio.AminAnDiff == y.ratio.AminAnDiff && (x.SortedKids == null) == (y.SortedKids == null) && (x.SortedKids == null || x.SortedKids.Length == y.SortedKids.Length && x.SortedKids.SequenceEqual(y.SortedKids, Instance) ) ; } public int GetHashCode(Node obj) { return obj.c; } } }
apache-2.0
C#
0369da1b3a05c57ea658b48fa0c02a00091fb190
Use different percentage in the unit test.
dlemstra/Magick.NET,dlemstra/Magick.NET
tests/Magick.NET.Tests/ResourceLimitsTests/TheMaxMemoryRequest.cs
tests/Magick.NET.Tests/ResourceLimitsTests/TheMaxMemoryRequest.cs
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET. // Licensed under the Apache License, Version 2.0. using ImageMagick; using Xunit; using Xunit.Sdk; namespace Magick.NET.Tests { public partial class ResourceLimitsTests { [Collection(nameof(RunTestsSeparately))] public class TheMaxMemoryRequest { [Fact] public void ShouldHaveTheCorrectValue() { if (ResourceLimits.MaxMemoryRequest < 100000000U) throw new XunitException("Invalid memory limit: " + ResourceLimits.MaxMemoryRequest); } [Fact] public void ShouldReturnTheCorrectValueWhenChanged() { var oldMemory = ResourceLimits.MaxMemoryRequest; var newMemory = (ulong)(ResourceLimits.MaxMemoryRequest * 0.8); ResourceLimits.MaxMemoryRequest = newMemory; Assert.Equal(newMemory, ResourceLimits.MaxMemoryRequest); ResourceLimits.MaxMemoryRequest = oldMemory; } } } }
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET. // Licensed under the Apache License, Version 2.0. using ImageMagick; using Xunit; using Xunit.Sdk; namespace Magick.NET.Tests { public partial class ResourceLimitsTests { [Collection(nameof(RunTestsSeparately))] public class TheMaxMemoryRequest { [Fact] public void ShouldHaveTheCorrectValue() { if (ResourceLimits.MaxMemoryRequest < 100000000U) throw new XunitException("Invalid memory limit: " + ResourceLimits.MaxMemoryRequest); } [Fact] public void ShouldReturnTheCorrectValueWhenChanged() { var oldMemory = ResourceLimits.MaxMemoryRequest; var newMemory = (ulong)(ResourceLimits.MaxMemoryRequest * 0.9); ResourceLimits.MaxMemoryRequest = newMemory; Assert.Equal(newMemory, ResourceLimits.MaxMemoryRequest); ResourceLimits.MaxMemoryRequest = oldMemory; } } } }
apache-2.0
C#
628a254f28c5d5293024d179b4c09195a9e9c755
Fix a missed renamed method call that was in an #ifdef for WP8
netonjm/CocosSharp,TukekeSoft/CocosSharp,zmaruo/CocosSharp,zmaruo/CocosSharp,haithemaraissia/CocosSharp,mono/CocosSharp,hig-ag/CocosSharp,netonjm/CocosSharp,hig-ag/CocosSharp,mono/CocosSharp,haithemaraissia/CocosSharp,MSylvia/CocosSharp,MSylvia/CocosSharp,TukekeSoft/CocosSharp
cocos2d/platform/CCTask.cs
cocos2d/platform/CCTask.cs
using System; #if WINDOWS_PHONE|| XBOX360 using System.ComponentModel; #else using System.Threading.Tasks; #endif namespace CocosSharp { public static class CCTask { private class TaskSelector : ICCUpdatable { public void Update(float dt) { } } private static ICCUpdatable _taskSelector = new TaskSelector(); public static object RunAsync(Action action) { return RunAsync(action, null); } public static object RunAsync(Action action, Action<object> taskCompleted) { #if WINDOWS_PHONE || XBOX360 var worker = new BackgroundWorker(); worker.DoWork += (sender, args) => { action(); }; if (taskCompleted != null) { worker.RunWorkerCompleted += (sender, args) => { var scheduler = CCDirector.SharedDirector.Scheduler; scheduler.Schedule (f => taskCompleted(worker), _taskSelector, 0, 0, 0, false); }; } worker.RunWorkerAsync(); return worker; #else var task = new Task( () => { action(); if (taskCompleted != null) { var scheduler = CCDirector.SharedDirector.Scheduler; scheduler.Schedule (f => taskCompleted(null), _taskSelector, 0, 0, 0, false); } } ); task.Start(); return task; #endif } } }
using System; #if WINDOWS_PHONE|| XBOX360 using System.ComponentModel; #else using System.Threading.Tasks; #endif namespace CocosSharp { public static class CCTask { private class TaskSelector : ICCUpdatable { public void Update(float dt) { } } private static ICCUpdatable _taskSelector = new TaskSelector(); public static object RunAsync(Action action) { return RunAsync(action, null); } public static object RunAsync(Action action, Action<object> taskCompleted) { #if WINDOWS_PHONE || XBOX360 var worker = new BackgroundWorker(); worker.DoWork += (sender, args) => { action(); }; if (taskCompleted != null) { worker.RunWorkerCompleted += (sender, args) => { var scheduler = CCDirector.SharedDirector.Scheduler; scheduler.ScheduleSelector(f => taskCompleted(worker), _taskSelector, 0, 0, 0, false); }; } worker.RunWorkerAsync(); return worker; #else var task = new Task( () => { action(); if (taskCompleted != null) { var scheduler = CCDirector.SharedDirector.Scheduler; scheduler.Schedule (f => taskCompleted(null), _taskSelector, 0, 0, 0, false); } } ); task.Start(); return task; #endif } } }
mit
C#
c8c8fa9bf4cc3d5c488dd3591b2801c024ba58d1
Update LockType.cs
gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer
Common/Locks/LockType.cs
Common/Locks/LockType.cs
 namespace LunaCommon.Locks { /// <summary> /// Different types of locks /// </summary> public enum LockType { /// <summary> /// The contract lock is owned by only 1 player and it defines who can generate new contracts. /// </summary> Contract, /// <summary> /// The asteroid lock is owned by only 1 player and it defines who spawns the asteroids /// </summary> Asteroid, /// <summary> /// The spectator lock specifies if a user is spectating a vessel or not. /// A vessel can have several spectators /// </summary> Spectator, /// <summary> /// The update lock specifies who updates the position and definition of a given vessel. /// A user can have several update/UnloadedUpdate locks. /// You get the UnloadedUpdate lock when there are vessels far away from other players and nobody is close enought /// to get the "Update" lock. If a player get close to the vessel and gets the "Update" lock, he will steal the /// "UnloadedUpdate" lock from you /// </summary> UnloadedUpdate, /// <summary> /// The update lock specifies who updates the position and definition of a given vessel. /// A user can have several update locks. /// If you are controlling a vessel you also get the update lock. /// If you are in LOADING distance of a vessel that nobody controls and nobody already has the update lock you get it /// If you own the update lock you also own the "UnloadedUpdate" lock /// </summary> Update, /// <summary> /// The control lock specifies who controls a given vessel. /// A user can have several control locks depending on the settings. /// </summary> Control, } }
 namespace LunaCommon.Locks { /// <summary> /// Different types of locks /// </summary> public enum LockType { /// <summary> /// The asteroid lock is owned by only 1 player and it defines who spawns the asteroids /// </summary> Asteroid, /// <summary> /// The control lock specifies who controls a given vessel. /// A user can have several control locks depending on the settings. /// </summary> Control, /// <summary> /// The update lock specifies who updates the position and definition of a given vessel. /// A user can have several update locks. /// If you are controlling a vessel you also get the update lock. /// If you are in LOADING distance of a vessel that nobody controls and nobody already has the update lock you get it /// If you own the update lock you also own the "UnloadedUpdate" lock /// </summary> Update, /// <summary> /// The update lock specifies who updates the position and definition of a given vessel. /// A user can have several update/UnloadedUpdate locks. /// You get the UnloadedUpdate lock when there are vessels far away from other players and nobody is close enought /// to get the "Update" lock. If a player get close to the vessel and gets the "Update" lock, he will steal the /// "UnloadedUpdate" lock from you /// </summary> UnloadedUpdate, /// <summary> /// The spectator lock specifies if a user is spectating a vessel or not. /// A vessel can have several spectators /// </summary> Spectator, /// <summary> /// The contract lock is owned by only 1 player and it defines who can generate new contracts. /// </summary> Contract } }
mit
C#
37b49fa53799cd2b769aa8a8cd6030e6e624cb4f
Update extension_mtd.cs
kenpusney/pastebin,kenpusney/pastebin
book/extension_mtd.cs
book/extension_mtd.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CLR_via_CS { class Program { static void Main(string[] args) { Console.WriteLine("abc".parse()); Console.Read(); } } static class A { public static int parse(this string b) { return b.Length; } public static int parse(this B b) { return b.Age; } } class B { public int Age { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CLR_via_CS { class Program { static void Main(string[] args) { Console.WriteLine("abc".parse()); Console.Read(); } } static class A { public static int parse(this string b) { return b.Length; } public static int parse(this B b) { return b.Length; } } class B { public int Age { get; set; } } }
mit
C#
c6eaba6efe0334aa9a612b5d8a116c67b89d9c34
Add process index to state as primary key. Use process name as property
fareloz/AttachToolbar
State.cs
State.cs
using System.Collections.Generic; namespace AttachToolbar { internal static class State { public static int ProcessIndex = -1; public static List<string> ProcessList = new List<string>(); public static EngineType EngineType = EngineType.Native; public static bool IsAttached = false; public static string ProcessName { get { string processName = ProcessIndex >= 0 ? ProcessList[ProcessIndex] : ""; return processName; } set { ProcessIndex = ProcessList.IndexOf(value); } } public static void Clear() { ProcessList.Clear(); EngineType = EngineType.Native; IsAttached = false; ProcessIndex = -1; } } }
using System.Collections.Generic; namespace AttachToolbar { internal static class State { public static string ProcessName = ""; public static List<string> ProcessList = new List<string>(); public static EngineType EngineType = EngineType.Native; public static bool IsAttached = false; public static void Clear() { ProcessList.Clear(); EngineType = EngineType.Native; IsAttached = false; ProcessName = ""; } } }
mit
C#
d0fe74aceed6de0489f23f23b90b8f178bfea5c7
Remove pokemon catch
cd01/sudo-in-windows,cd01/sudo-in-windows
sudo.cs
sudo.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; [assembly: AssemblyVersion("0.0.1.*")] [assembly: AssemblyCopyright("Copyright cd01 2014")] [assembly: AssemblyDescription("Elevate UAC")] class sudo { static void Main(string[] args) { if (args.Count() == 0) { Console.WriteLine("Usage:"); Console.WriteLine(" sudo [command] ..."); Environment.Exit(0); } var startInfo = new System.Diagnostics.ProcessStartInfo() { FileName = args[0], UseShellExecute = true, Verb = "runas", Arguments = new Func<IEnumerable<string>, string>((argsInShell) => { return string.Join(" ", argsInShell); })(args.Skip(1)) }; var proc = System.Diagnostics.Process.Start(startInfo); proc.WaitForExit(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; [assembly: AssemblyVersion("0.0.1.*")] [assembly: AssemblyCopyright("Copyright cd01 2014")] [assembly: AssemblyDescription("Elevate UAC")] class sudo { static void Main(string[] args) { if (args.Count() == 0) { Console.WriteLine("Usage:"); Console.WriteLine(" sudo [command] ..."); Environment.Exit(0); } var startInfo = new System.Diagnostics.ProcessStartInfo() { FileName = args[0], UseShellExecute = true, Verb = "runas", Arguments = new Func<IEnumerable<string>, string>((argsInShell) => { return string.Join(" ", argsInShell); })(args.Skip(1)) }; try { var proc = System.Diagnostics.Process.Start(startInfo); proc.WaitForExit(); } catch(Exception ex) { Console.Error.WriteLine(ex.Message); } } }
mit
C#
2af63bf54c7e5c1aa0709a214b2f1b947ed7f4b4
Fix system memory check for Linux (20210323)
gmartin7/myBloomFork,gmartin7/myBloomFork,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork
src/BloomExe/Utils/MemoryUtils.cs
src/BloomExe/Utils/MemoryUtils.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Bloom.Utils { class MemoryUtils { /// <summary> /// A crude way of measuring when we might be short enough of memory to need a full reload. /// </summary> /// <returns></returns> public static bool SystemIsShortOfMemory() { // A rather arbitrary limit of 750M...a bit more than Bloom typically uses for a large book // before memory leaks start to mount up. A larger value is wanted for 64-bit processes // since they can start out above the 750M level. var triggerLevel = Environment.Is64BitProcess ? 2000000000L : 750000000; return GetPrivateBytes() > triggerLevel; } /// <summary> /// Significance: This value indicates the current number of bytes allocated to this process that cannot be shared with /// other processes. This value has been useful for identifying memory leaks. /// </summary> /// <remarks>We've had other versions of this method which, confusingly, returned results in KB. This one actually answers bytes.</remarks> public static long GetPrivateBytes() { // Using a PerformanceCounter does not work on Linux and gains nothing on Windows. // After using the PerformanceCounter once on Windows, it always returns the same // value as getting it directly from the Process property. using (var process = Process.GetCurrentProcess()) { return process.PrivateMemorySize64; } } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Bloom.Utils { class MemoryUtils { /// <summary> /// A crude way of measuring when we might be short enough of memory to need a full reload. /// </summary> /// <returns></returns> public static bool SystemIsShortOfMemory() { // A rather arbitrary limit of 750M...a bit more than Bloom typically uses for a large book // before memory leaks start to mount up. return GetPrivateBytes() > 750000000; } /// <summary> /// Significance: This counter indicates the current number of bytes allocated to this process that cannot be shared with /// other processes. This counter has been useful for identifying memory leaks. /// </summary> /// <remarks>We've had other versions of this method which, confusingly, returned results in KB. This one actually answers bytes.</remarks> /// <returns></returns> public static long GetPrivateBytes() { using (var perfCounter = new PerformanceCounter("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName)) { return perfCounter.RawValue; } } } }
mit
C#
e8e4d329cff26270f47e9dbaa474c85473e7e8aa
Set version to 2.0.0-beta04
Jericho/CakeMail.RestClient
CakeMail.RestClient/Properties/AssemblyInfo.cs
CakeMail.RestClient/Properties/AssemblyInfo.cs
using System.Reflection; // 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("CakeMail.RestClient")] [assembly: AssemblyDescription("CakeMail.RestClient is a .NET wrapper for the CakeMail API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Jeremie Desautels")] [assembly: AssemblyProduct("CakeMail.RestClient")] [assembly: AssemblyCopyright("Copyright Jeremie Desautels © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0-beta04")]
using System.Reflection; // 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("CakeMail.RestClient")] [assembly: AssemblyDescription("CakeMail.RestClient is a .NET wrapper for the CakeMail API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Jeremie Desautels")] [assembly: AssemblyProduct("CakeMail.RestClient")] [assembly: AssemblyCopyright("Copyright Jeremie Desautels © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0")]
mit
C#
626f1be600b5a025a8aca6b7ec39967a2253ec4c
Implement Assembly.GetCallingAssembly (#3020)
krytarowski/corert,yizhang82/corert,yizhang82/corert,yizhang82/corert,yizhang82/corert,gregkalapos/corert,tijoytom/corert,gregkalapos/corert,krytarowski/corert,tijoytom/corert,tijoytom/corert,gregkalapos/corert,gregkalapos/corert,botaberg/corert,krytarowski/corert,shrah/corert,botaberg/corert,botaberg/corert,shrah/corert,tijoytom/corert,shrah/corert,botaberg/corert,krytarowski/corert,shrah/corert
src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreRT.cs
src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreRT.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Configuration.Assemblies; using System.Runtime.Serialization; using Internal.Reflection.Augments; namespace System.Reflection { public abstract partial class Assembly : ICustomAttributeProvider, ISerializable { public static Assembly GetEntryAssembly() => Internal.Runtime.CompilerHelpers.StartupCodeHelpers.GetEntryAssembly(); public static Assembly GetExecutingAssembly() { throw new NotImplementedException(); } public static Assembly GetCallingAssembly() { throw new PlatformNotSupportedException(); } public static Assembly Load(AssemblyName assemblyRef) => ReflectionAugments.ReflectionCoreCallbacks.Load(assemblyRef); public static Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore) => ReflectionAugments.ReflectionCoreCallbacks.Load(rawAssembly, rawSymbolStore); public static Assembly Load(string assemblyString) { if (assemblyString == null) throw new ArgumentNullException(nameof(assemblyString)); AssemblyName name = new AssemblyName(assemblyString); return Load(name); } public static Assembly LoadFile(string path) { throw new PlatformNotSupportedException(); } public static Assembly LoadFrom(string assemblyFile) { throw new PlatformNotSupportedException(); } public static Assembly LoadFrom(string assemblyFile, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) { throw new PlatformNotSupportedException(); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Configuration.Assemblies; using System.Runtime.Serialization; using Internal.Reflection.Augments; namespace System.Reflection { public abstract partial class Assembly : ICustomAttributeProvider, ISerializable { public static Assembly GetEntryAssembly() => Internal.Runtime.CompilerHelpers.StartupCodeHelpers.GetEntryAssembly(); public static Assembly GetExecutingAssembly() { throw new NotImplementedException(); } public static Assembly GetCallingAssembly() { throw new NotImplementedException(); } public static Assembly Load(AssemblyName assemblyRef) => ReflectionAugments.ReflectionCoreCallbacks.Load(assemblyRef); public static Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore) => ReflectionAugments.ReflectionCoreCallbacks.Load(rawAssembly, rawSymbolStore); public static Assembly Load(string assemblyString) { if (assemblyString == null) throw new ArgumentNullException(nameof(assemblyString)); AssemblyName name = new AssemblyName(assemblyString); return Load(name); } public static Assembly LoadFile(string path) { throw new PlatformNotSupportedException(); } public static Assembly LoadFrom(string assemblyFile) { throw new PlatformNotSupportedException(); } public static Assembly LoadFrom(string assemblyFile, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) { throw new PlatformNotSupportedException(); } } }
mit
C#
43202f34cbd8e7a37dca8dbcae491ef78b9b75e3
Add Terms of Service content
martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site
src/LondonTravel.Site/Views/Terms/Index.cshtml
src/LondonTravel.Site/Views/Terms/Index.cshtml
@{ ViewBag.MetaDescription = SR.TermsOfServiceMetaDescription; ViewBag.Title = SR.TermsOfServiceMetaTitle; } <div> <h1>@SR.TermsOfServiceTitle</h1> <h3>1. Terms</h3> <p> By accessing the website at <a href="https://londontravel.martincostello.com/" title="London Travel Homepage">https://londontravel.martincostello.com/</a>, you are agreeing to be bound by these terms of service, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this website are protected by applicable copyright and trademark law. </p> <h3>2. Use License</h3> <ol type="a"> <li> Permission is granted to temporarily download one copy of the materials (information or software) on London Travel's website for personal, non-commercial transitory viewing only. This is the grant of a license, not a transfer of title, and under this license you may not: <ol type="i"> <li>modify or copy the materials;</li> <li>use the materials for any commercial purpose, or for any public display (commercial or non-commercial);</li> <li>attempt to decompile or reverse engineer any software contained on London Travel's website;</li> <li>remove any copyright or other proprietary notations from the materials; or</li> <li>transfer the materials to another person or "mirror" the materials on any other server.</li> </ol> </li> <li> This license shall automatically terminate if you violate any of these restrictions and may be terminated by London Travel at any time. Upon terminating your viewing of these materials or upon the termination of this license, you must destroy any downloaded materials in your possession whether in electronic or printed format. </li> </ol> <h3>3. Disclaimer</h3> <ol type="a"> <li> The materials on London Travel's website are provided on an 'as is' basis. London Travel makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties including, without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. </li> <li> Further, London Travel does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its website or otherwise relating to such materials or on any sites linked to this site. </li> </ol> <h3>4. Limitations</h3> <p> In no event shall London Travel or its suppliers be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption) arising out of the use or inability to use the materials on London Travel's website, even if London Travel or a London Travel authorized representative has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you. </p> <h3>5. Accuracy of materials</h3> <p> The materials appearing on London Travel's website could include technical, typographical, or photographic errors. London Travel does not warrant that any of the materials on its website are accurate, complete or current. London Travel may make changes to the materials contained on its website at any time without notice. However London Travel does not make any commitment to update the materials. </p> <h3>6. Links</h3> <p> London Travel has not reviewed all of the sites linked to its website and is not responsible for the contents of any such linked site. The inclusion of any link does not imply endorsement by London Travel of the site. Use of any such linked website is at the user's own risk. </p> <h3>7. Modifications</h3> <p> London Travel may revise these terms of service for its website at any time without notice. By using this website you are agreeing to be bound by the then current version of these terms of service. </p> <h3>8. Governing Law</h3> <p> These terms and conditions are governed by and construed in accordance with the laws of United Kingdom and you irrevocably submit to the exclusive jurisdiction of the courts in that State or location. </p> </div>
@{ ViewBag.MetaDescription = SR.TermsOfServiceMetaDescription; ViewBag.Title = SR.TermsOfServiceMetaTitle; } <div> <h1>@SR.TermsOfServiceTitle</h1> <p> @* TODO Add content *@ This is where the Terms of Service for the London Travel Alexa skill will be. </p> </div>
apache-2.0
C#
14f1a2e32c5f28bc4a5e0f1136730ea0c5ce0ecd
Add test
RSuter/NJsonSchema,NJsonSchema/NJsonSchema
src/NJsonSchema.Tests/Generation/XmlDocsTests.cs
src/NJsonSchema.Tests/Generation/XmlDocsTests.cs
using Newtonsoft.Json; using System.Threading.Tasks; using Xunit; namespace NJsonSchema.Tests.Generation { public class XmlDocsTests { /// <summary>Foobar.</summary> /// <example> /// { "foo": "bar" } /// </example> public abstract class AbstractClass { /// <example> /// { "abc": "def" } /// </example> public string Foo { get; set; } } [Fact] public async Task When_example_xml_docs_is_defined_then_examples_can_be_defined() { /// Act var schema = JsonSchema.FromType<AbstractClass>(); var json = schema.ToJson(Formatting.None); /// Assert Assert.Contains(@"Foobar.", json); Assert.Contains(@"""x-example"":{""foo"":""bar""}", json); Assert.Contains(@"""x-example"":{""abc"":""def""}", json); } } }
using Newtonsoft.Json; using System.Threading.Tasks; using Xunit; namespace NJsonSchema.Tests.Generation { public class XmlDocsTests { /// <example> /// { "foo": "bar" } /// </example> public abstract class AbstractClass { /// <example> /// { "abc": "def" } /// </example> public string Foo { get; set; } } [Fact] public async Task When_example_xml_docs_is_defined_then_examples_can_be_defined() { /// Act var schema = JsonSchema.FromType<AbstractClass>(); var json = schema.ToJson(Formatting.None); /// Assert Assert.Contains(@"""x-example"":{""foo"":""bar""}", json); Assert.Contains(@"""x-example"":{""abc"":""def""}", json); } } }
mit
C#
b87918def42cb623c3ce0435101d80302a0d7667
Update for Dict contains before null check
Narochno/Narochno.Credstash
src/Narochno.Credstash/Internal/CredstashItem.cs
src/Narochno.Credstash/Internal/CredstashItem.cs
using System.Collections.Generic; using Amazon.DynamoDBv2.Model; namespace Narochno.Credstash.Internal { public class CredstashItem { public const string DEFAULT_DIGEST = "SHA256"; public string Name { get; set; } public string Version { get; set; } public string Contents { get; set; } public string Digest { get; set; } public string Hmac { get; set; } public string Key { get; set; } public static CredstashItem From(Dictionary<string, AttributeValue> item) { return new CredstashItem { Name = item["name"].S, Version = item["version"].S, Contents = item["contents"].S, Digest = (item.ContainsKey("digest") ? item["digest"]?.S : null) ?? DEFAULT_DIGEST, Hmac = item["hmac"].S, Key = item["key"].S, }; } } }
using System.Collections.Generic; using Amazon.DynamoDBv2.Model; namespace Narochno.Credstash.Internal { public class CredstashItem { public const string DEFAULT_DIGEST = "SHA256"; public string Name { get; set; } public string Version { get; set; } public string Contents { get; set; } public string Digest { get; set; } public string Hmac { get; set; } public string Key { get; set; } public static CredstashItem From(Dictionary<string, AttributeValue> item) { return new CredstashItem { Name = item["name"].S, Version = item["version"].S, Contents = item["contents"].S, Digest = item["digest"]?.S ?? DEFAULT_DIGEST, Hmac = item["hmac"].S, Key = item["key"].S, }; } } }
apache-2.0
C#
1a2c944ed3e5f42f0eaf3045147d589d3297bed9
fix failing FieldStats tests now that min/max_value can return an object too
CSGOpenSource/elasticsearch-net,CSGOpenSource/elasticsearch-net,elastic/elasticsearch-net,CSGOpenSource/elasticsearch-net,elastic/elasticsearch-net
src/Nest/Search/FieldStats/FieldStatsResponse.cs
src/Nest/Search/FieldStats/FieldStatsResponse.cs
using System.Collections.Generic; using Newtonsoft.Json; namespace Nest { [JsonObject] public interface IFieldStatsResponse : IResponse { [JsonProperty("_shards")] ShardsMetaData Shards { get; } [JsonProperty("indices")] IReadOnlyDictionary<string, FieldStats> Indices { get; } } public class FieldStatsResponse : ResponseBase, IFieldStatsResponse { public ShardsMetaData Shards { get; internal set; } public IReadOnlyDictionary<string, FieldStats> Indices { get; internal set; } = EmptyReadOnly<string, FieldStats>.Dictionary; } [JsonObject] public class FieldStats { [JsonProperty("fields")] public IReadOnlyDictionary<string, FieldStatsField> Fields { get; internal set; } = EmptyReadOnly<string, FieldStatsField>.Dictionary; } public class FieldStatsField { [JsonProperty("max_doc")] public long MaxDoc { get; internal set; } [JsonProperty("doc_count")] public long DocCount { get; internal set; } [JsonProperty("density")] public long Density { get; internal set; } [JsonProperty("sum_doc_freq")] public long SumDocumentFrequency { get; internal set; } [JsonProperty("sum_total_term_freq")] public long SumTotalTermFrequency { get; internal set; } [JsonProperty("searchable")] public bool Searchable { get; internal set; } [JsonProperty("aggregatable")] public bool Aggregatable { get; internal set; } [JsonProperty("min_value")] //TODO this can also be an object in the case of geo_point/shape public object MinValue { get; internal set; } [JsonProperty("min_value_as_string")] public string MinValueAsString { get; internal set; } [JsonProperty("max_value")] //TODO this can also be an object in the case of geo_point/shape public object MaxValue { get; internal set; } [JsonProperty("max_value_as_string")] public string MaxValueAsString { get; internal set; } } }
using System.Collections.Generic; using Newtonsoft.Json; namespace Nest { [JsonObject] public interface IFieldStatsResponse : IResponse { [JsonProperty("_shards")] ShardsMetaData Shards { get; } [JsonProperty("indices")] IReadOnlyDictionary<string, FieldStats> Indices { get; } } public class FieldStatsResponse : ResponseBase, IFieldStatsResponse { public ShardsMetaData Shards { get; internal set; } public IReadOnlyDictionary<string, FieldStats> Indices { get; internal set; } = EmptyReadOnly<string, FieldStats>.Dictionary; } [JsonObject] public class FieldStats { [JsonProperty("fields")] public IReadOnlyDictionary<string, FieldStatsField> Fields { get; internal set; } = EmptyReadOnly<string, FieldStatsField>.Dictionary; } public class FieldStatsField { [JsonProperty("max_doc")] public long MaxDoc { get; internal set; } [JsonProperty("doc_count")] public long DocCount { get; internal set; } [JsonProperty("density")] public long Density { get; internal set; } [JsonProperty("sum_doc_freq")] public long SumDocumentFrequency { get; internal set; } [JsonProperty("sum_total_term_freq")] public long SumTotalTermFrequency { get; internal set; } [JsonProperty("searchable")] public bool Searchable { get; internal set; } [JsonProperty("aggregatable")] public bool Aggregatable { get; internal set; } [JsonProperty("min_value")] //TODO this can also be an object in the case of geo_point/shape public string MinValue { get; internal set; } [JsonProperty("max_value")] //TODO this can also be an object in the case of geo_point/shape public string MaxValue { get; internal set; } } }
apache-2.0
C#
7246c87c439195132b9822d77ae7a8cd7530367d
add Close method to release ticker thread
judwhite/NsqSharp
NsqSharp/Utils/Ticker.cs
NsqSharp/Utils/Ticker.cs
using System; using System.Threading; using NsqSharp.Utils.Channels; namespace NsqSharp.Utils { /// <summary> /// A Ticker holds a channel that delivers `ticks' of a clock at intervals. http://golang.org/pkg/time/#Ticker /// </summary> public class Ticker { private Chan<DateTime> _tickerChan = new Chan<DateTime>(); private bool _stop; /// <summary> /// Initializes a new instance of the Ticker class. /// </summary> /// <param name="duration">The interval between ticks on the channel.</param> public Ticker(TimeSpan duration) { if (duration <= TimeSpan.Zero) throw new ArgumentOutOfRangeException("duration", "duration must be > 0"); GoFunc.Run(() => { while (!_stop) { Thread.Sleep(duration); if (!_stop) { try { _tickerChan.Send(DateTime.Now); } catch (ChannelClosedException) { } } } }, string.Format("Ticker started:{0} duration:{1}", DateTime.Now, duration)); } /// <summary> /// Stop turns off a ticker. After Stop, no more ticks will be sent. Stop does not close the channel, /// to prevent a read from the channel succeeding incorrectly. See <see cref="Close"/>. /// </summary> public void Stop() { _stop = true; } /// <summary> /// Stops the ticker and closes the channel, exiting the ticker thread. Note: after closing a channel, /// all reads from the channel will return default(T). See <see cref="Stop"/>. /// </summary> public void Close() { Stop(); _tickerChan.Close(); } /// <summary> /// The channel on which the ticks are delivered. /// </summary> public IReceiveOnlyChan<DateTime> C { get { return _tickerChan; } } } }
using System; using System.Threading; using NsqSharp.Utils.Channels; namespace NsqSharp.Utils { /// <summary> /// A Ticker holds a channel that delivers `ticks' of a clock at intervals. http://golang.org/pkg/time/#Ticker /// </summary> public class Ticker { private readonly Chan<DateTime> _tickerChan = new Chan<DateTime>(); private bool _stop; /// <summary> /// Initializes a new instance of the Ticker class. /// </summary> /// <param name="duration">The interval between ticks on the channel.</param> public Ticker(TimeSpan duration) { if (duration <= TimeSpan.Zero) throw new ArgumentOutOfRangeException("duration", "duration must be > 0"); GoFunc.Run(() => { while (!_stop) { Thread.Sleep(duration); if (!_stop) { _tickerChan.Send(DateTime.Now); } } }, string.Format("Ticker started:{0} duration:{1}", DateTime.Now, duration)); } /// <summary> /// Stop turns off a ticker. After Stop, no more ticks will be sent. Stop does not close the channel, to prevent a /// read from the channel succeeding incorrectly. /// </summary> public void Stop() { _stop = true; } /// <summary> /// The channel on which the ticks are delivered. /// </summary> public IReceiveOnlyChan<DateTime> C { get { return _tickerChan; } } } }
mit
C#
799e5b04181cc080e5f0c9d85e53276f4746e2a8
change the version
shabtaisharon/ds3_net_sdk,shabtaisharon/ds3_net_sdk,SpectraLogic/ds3_net_sdk,RachelTucker/ds3_net_sdk,RachelTucker/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk
VersionInfo.cs
VersionInfo.cs
/* * ****************************************************************************** * Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * **************************************************************************** */ using System.Reflection; // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("4.0.1.0")] [assembly: AssemblyFileVersion("4.0.1.0")]
/* * ****************************************************************************** * Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * **************************************************************************** */ using System.Reflection; // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("4.0.0.0")] [assembly: AssemblyFileVersion("4.0.0.0")]
apache-2.0
C#
66b64bf08861c07712015f66a4010b02fd802bef
Refactor code
sergeyshushlyapin/Sitecore-Instance-Manager,dsolovay/Sitecore-Instance-Manager,Sitecore/Sitecore-Instance-Manager,Brad-Christie/Sitecore-Instance-Manager
src/SIM.Core/Common/Ensure.cs
src/SIM.Core/Common/Ensure.cs
namespace SIM.Core.Common { using Sitecore.Diagnostics.Base; using Sitecore.Diagnostics.Base.Annotations; public static class Ensure { [ContractAnnotation("obj:null=>stop")] [StringFormatMethod("message")] public static void IsNotNull(object obj, string message, params object[] args) { Assert.ArgumentNotNullOrEmpty(message, nameof(message)); if (obj != null) { return; } if (args == null || args.Length <= 0) { throw new MessageException(message); } throw new MessageException(string.Format(message, args)); } [ContractAnnotation("str:null=>stop")] [StringFormatMethod("message")] public static void IsNotNullOrEmpty(string str, string message, params object[] args) { Assert.ArgumentNotNullOrEmpty(message, nameof(message)); if (!string.IsNullOrEmpty(str)) { return; } if (args == null || args.Length <= 0) { throw new MessageException(message); } throw new MessageException(string.Format(message, args)); } [ContractAnnotation("condition:false=>stop")] [StringFormatMethod("message")] public static void IsTrue(bool condition, string message, params object[] args) { Assert.ArgumentNotNullOrEmpty(message, nameof(message)); if (condition) { return; } if (args == null || args.Length <= 0) { throw new MessageException(message); } throw new MessageException(string.Format(message, args)); } } }
namespace SIM.Core.Common { using Sitecore.Diagnostics.Base; using Sitecore.Diagnostics.Base.Annotations; public static class Ensure { [StringFormatMethod("message")] public static void IsNotNull(object obj, string message, params object[] args) { Assert.ArgumentNotNullOrEmpty(message, nameof(message)); if (obj != null) { return; } if (args == null || args.Length <= 0) { throw new MessageException(message); } throw new MessageException(string.Format(message, args)); } [StringFormatMethod("message")] public static void IsNotNullOrEmpty(string str, string message, params object[] args) { Assert.ArgumentNotNullOrEmpty(message, nameof(message)); if (!string.IsNullOrEmpty(str)) { return; } if (args == null || args.Length <= 0) { throw new MessageException(message); } throw new MessageException(string.Format(message, args)); } [StringFormatMethod("message")] public static void IsTrue(bool condition, string message, params object[] args) { Assert.ArgumentNotNullOrEmpty(message, nameof(message)); if (condition) { return; } if (args == null || args.Length <= 0) { throw new MessageException(message); } throw new MessageException(string.Format(message, args)); } } }
mit
C#
1f80f01b53f4861a26ee8564bb7b81684cfad488
Add accuracy to frame bundle header
NeoAdonis/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu-new,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu
osu.Game/Online/Spectator/FrameHeader.cs
osu.Game/Online/Spectator/FrameHeader.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using System; using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; namespace osu.Game.Online.Spectator { [Serializable] public class FrameHeader { /// <summary> /// The current accuracy of the score. /// </summary> public double Accuracy { get; set; } /// <summary> /// The current combo of the score. /// </summary> public int Combo { get; set; } /// <summary> /// The maximum combo achieved up to the current point in time. /// </summary> public int MaxCombo { get; set; } /// <summary> /// Cumulative hit statistics. /// </summary> public Dictionary<HitResult, int> Statistics { get; set; } /// <summary> /// The time at which this frame was received by the server. /// </summary> public DateTimeOffset ReceivedTime { get; set; } /// <summary> /// Construct header summary information from a point-in-time reference to a score which is actively being played. /// </summary> /// <param name="score">The score for reference.</param> public FrameHeader(ScoreInfo score) { Combo = score.Combo; MaxCombo = score.MaxCombo; Accuracy = score.Accuracy; // copy for safety Statistics = new Dictionary<HitResult, int>(score.Statistics); } [JsonConstructor] public FrameHeader(int combo, int maxCombo, double accuracy, Dictionary<HitResult, int> statistics, DateTimeOffset receivedTime) { Combo = combo; MaxCombo = maxCombo; Accuracy = accuracy; Statistics = statistics; ReceivedTime = receivedTime; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using System; using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; namespace osu.Game.Online.Spectator { [Serializable] public class FrameHeader { /// <summary> /// The current combo of the score. /// </summary> public int Combo { get; set; } /// <summary> /// The maximum combo achieved up to the current point in time. /// </summary> public int MaxCombo { get; set; } /// <summary> /// Cumulative hit statistics. /// </summary> public Dictionary<HitResult, int> Statistics { get; set; } /// <summary> /// The time at which this frame was received by the server. /// </summary> public DateTimeOffset ReceivedTime { get; set; } /// <summary> /// Construct header summary information from a point-in-time reference to a score which is actively being played. /// </summary> /// <param name="score">The score for reference.</param> public FrameHeader(ScoreInfo score) { Combo = score.Combo; MaxCombo = score.MaxCombo; // copy for safety Statistics = new Dictionary<HitResult, int>(score.Statistics); } [JsonConstructor] public FrameHeader(int combo, int maxCombo, Dictionary<HitResult, int> statistics, DateTimeOffset receivedTime) { Combo = combo; MaxCombo = maxCombo; Statistics = statistics; ReceivedTime = receivedTime; } } }
mit
C#
cb264e95b7527044f159ea1a9e9c5f4875bf1db4
Add new line for file logging
pandell/PackageRunner
FileLogging.cs
FileLogging.cs
using System; using System.Diagnostics; using System.IO; namespace PackageRunner { /// <summary> /// </summary> internal class FileLogging { private readonly string _file; private static readonly object _lock = new object(); public FileLogging(string file) { _file = file; } public void AddLine(string text) { lock (_lock) { File.AppendAllText(_file, DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " " + text + Environment.NewLine); Debug.WriteLine(text); } } /// <summary> /// </summary> public void AddLine(string format, params object[] args) { var text = string.Format(format, args); this.AddLine(text); } } }
using System; using System.Diagnostics; using System.IO; namespace PackageRunner { /// <summary> /// </summary> internal class FileLogging { private readonly string _file; private static readonly object _lock = new object(); public FileLogging(string file) { _file = file; } public void AddLine(string text) { lock (_lock) { File.AppendAllText(_file, DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " " + text); Debug.WriteLine(text); } } /// <summary> /// </summary> public void AddLine(string format, params object[] args) { var text = string.Format(format, args); this.AddLine(text); } } }
mit
C#
50e7ad49b55ce4986fcc814e9f3b31084e03b914
Update Init.DependencyInjection.cs
jrmitch120/OctgnImageDb
OctgnImageDb/Setup/Init.DependencyInjection.cs
OctgnImageDb/Setup/Init.DependencyInjection.cs
using Ninject; using OctgnImageDb.Imaging; using OctgnImageDb.Imaging.Doomtown; using OctgnImageDb.Imaging.Netrunner; using OctgnImageDb.Imaging.Got2; using OctgnImageDb.Imaging.LotR; //using OctgnImageDb.Imaging.Starwars; namespace OctgnImageDb.Setup { public partial class Init { public static IKernel Container() { var kernel = new StandardKernel(); kernel.Bind<IImageProvider>().To<NetrunnerDbImages>(); kernel.Bind<IImageProvider>().To<DoomtownDbImages>(); kernel.Bind<IImageProvider>().To<Got2DbImages>(); kernel.Bind<IImageProvider>().To<LotrDBImages>(); //TopTier seemed to go under. No reliable source for hi-rez images that I know of anymore //kernel.Bind<IImageProvider>().To<TopTierDbImages>(); return kernel; } } }
using Ninject; using OctgnImageDb.Imaging; using OctgnImageDb.Imaging.Doomtown; using OctgnImageDb.Imaging.Netrunner; using OctgnImageDb.Imaging.Got2; //using OctgnImageDb.Imaging.Starwars; namespace OctgnImageDb.Setup { public partial class Init { public static IKernel Container() { var kernel = new StandardKernel(); kernel.Bind<IImageProvider>().To<NetrunnerDbImages>(); kernel.Bind<IImageProvider>().To<DoomtownDbImages>(); kernel.Bind<IImageProvider>().To<Got2DbImages>(); //TopTier seemed to go under. No reliable source for hi-rez images that I know of anymore //kernel.Bind<IImageProvider>().To<TopTierDbImages>(); return kernel; } } }
mit
C#
3e2ec2b1730920ad5c96794ca950c4129b1e6aa1
Rename var safely
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
R7.University/Models/UniversityModelContext.cs
R7.University/Models/UniversityModelContext.cs
using DotNetNuke.Common.Utilities; using R7.Dnn.Extensions.Data; using R7.Dnn.Extensions.Models; using R7.University.Data; namespace R7.University.Models { public class UniversityModelContext: ModelContextBase { public UniversityModelContext (IDataContext dataContext): base (dataContext) { } public UniversityModelContext () { } #region ModelContextBase implementation public override IDataContext CreateDataContext () { return UniversityDataContextFactory.Instance.Create (); } public override bool SaveChanges (bool dispose = true) { var isFinal = dispose; var result = base.SaveChanges (isFinal); if (isFinal) { DataCache.ClearCache ("//r7_University"); } return result; } #endregion } }
using DotNetNuke.Common.Utilities; using R7.Dnn.Extensions.Data; using R7.Dnn.Extensions.Models; using R7.University.Data; namespace R7.University.Models { public class UniversityModelContext: ModelContextBase { public UniversityModelContext (IDataContext dataContext): base (dataContext) { } public UniversityModelContext () { } #region ModelContextBase implementation public override IDataContext CreateDataContext () { return UniversityDataContextFactory.Instance.Create (); } public override bool SaveChanges (bool isFinal = true) { var result = base.SaveChanges (isFinal); if (isFinal) { DataCache.ClearCache ("//r7_University"); } return result; } #endregion } }
agpl-3.0
C#
bcda95353e52949e39f3198958452a61672183ef
Remove extra span (#922)
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNetCore.SignalR.Common/Internal/Formatters/BinaryMessageParser.cs
src/Microsoft.AspNetCore.SignalR.Common/Internal/Formatters/BinaryMessageParser.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Binary; namespace Microsoft.AspNetCore.SignalR.Internal.Formatters { public static class BinaryMessageParser { public static bool TryParseMessage(ref ReadOnlyBuffer<byte> buffer, out ReadOnlyBuffer<byte> payload) { long length = 0; payload = default(ReadOnlyBuffer<byte>); if (buffer.Length < sizeof(long)) { return false; } // Read the length length = buffer.Span.Slice(0, sizeof(long)).ReadBigEndian<long>(); if (length > Int32.MaxValue) { throw new FormatException("Messages over 2GB in size are not supported"); } // We don't have enough data if (buffer.Length < (int)length + sizeof(long)) { return false; } // Get the payload payload = buffer.Slice(sizeof(long), (int)length); // Skip the payload buffer = buffer.Slice((int)length + sizeof(long)); return true; } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Binary; namespace Microsoft.AspNetCore.SignalR.Internal.Formatters { public static class BinaryMessageParser { public static bool TryParseMessage(ref ReadOnlyBuffer<byte> buffer, out ReadOnlyBuffer<byte> payload) { long length = 0; payload = default(ReadOnlyBuffer<byte>); if (buffer.Length < sizeof(long)) { return false; } // Read the length length = buffer.Span.Slice(0, sizeof(long)).ReadBigEndian<long>(); if (length > Int32.MaxValue) { throw new FormatException("Messages over 2GB in size are not supported"); } // Skip over the length var remaining = buffer.Slice(sizeof(long)); // We don't have enough data while (remaining.Length < (int)length) { return false; } // Get the payload payload = remaining.Slice(0, (int)length); // Skip the payload buffer = remaining.Slice((int)length); return true; } } }
apache-2.0
C#
71c7b0347d96001563b4a74866cfc75a9b718cd1
Mark model is for user and for course.
M-Yankov/UniversityStudentSystem,M-Yankov/UniversityStudentSystem
UniversityStudentSystem/Data/UniversityStudentSystem.Data.Models/Mark.cs
UniversityStudentSystem/Data/UniversityStudentSystem.Data.Models/Mark.cs
namespace UniversityStudentSystem.Data.Models { using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Common; using CommonModels; public class Mark : BaseModel<int> { [Required] [Range(ModelConstants.MarkMinValue, ModelConstants.MarkMaxValue)] public int Value { get; set; } [MaxLength(ModelConstants.ContentMaxLength)] public string Reason { get; set; } public string UserId { get; set; } public virtual User User { get; set; } public int CourseId { get; set; } public virtual Course Test { get; set; } } }
 namespace UniversityStudentSystem.Data.Models { using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Common; using CommonModels; public class Mark : BaseModel<int> { [Required] [Range(ModelConstants.MarkMinValue, ModelConstants.MarkMaxValue)] public int Value { get; set; } [MaxLength(ModelConstants.ContentMaxLength)] public string Reason { get; set; } public string UserId { get; set; } public virtual User User { get; set; } public int TestId { get; set; } public virtual Test Test { get; set; } } }
mit
C#
9bbddda5ab1a2a66984184122399d8e64ca95b6f
Add IMDTable interface
picrap/dnlib,Arthur2e5/dnlib,0xd4d/dnlib,ilkerhalil/dnlib,jorik041/dnlib,kiootic/dnlib,modulexcite/dnlib,yck1509/dnlib,ZixiangBoy/dnlib
src/DotNet/Writer/MDTable.cs
src/DotNet/Writer/MDTable.cs
using System.Collections.Generic; using dot10.DotNet.MD; namespace dot10.DotNet.Writer { /// <summary> /// MD table interface /// </summary> public interface IMDTable { /// <summary> /// Gets the table type /// </summary> Table Table { get; } /// <summary> /// <c>true</c> if the table is empty /// </summary> bool IsEmpty { get; } /// <summary> /// Gets the number of rows in this table /// </summary> int Rows { get; } /// <summary> /// Gets/sets a value indicating whether it's sorted /// </summary> bool IsSorted { get; set; } } /// <summary> /// Creates rows in a table. Rows can optionally be shared to create a compact table. /// </summary> /// <typeparam name="T">The raw row type</typeparam> public class MDTable<T> : IMDTable { readonly Table table; readonly Dictionary<T, uint> cachedDict; readonly List<T> cached; bool isSorted; /// <inheritdoc/> public Table Table { get { return table; } } /// <inheritdoc/> public bool IsEmpty { get { return cached.Count == 0; } } /// <inheritdoc/> public int Rows { get { return cached.Count; } } /// <inheritdoc/> public bool IsSorted { get { return isSorted; } set { isSorted = value; } } /// <summary> /// Gets the value with rid <paramref name="rid"/> /// </summary> /// <param name="rid">The row ID</param> public T this[uint rid] { get { return cached[(int)rid - 1]; } } /// <summary> /// Constructor /// </summary> /// <param name="table">The table type</param> /// <param name="equalityComparer">Equality comparer</param> public MDTable(Table table, IEqualityComparer<T> equalityComparer) { this.table = table; this.cachedDict = new Dictionary<T, uint>(equalityComparer); this.cached = new List<T>(); } /// <summary> /// Adds a row. If the row already exists, returns a rid to the existing one, else /// it's created and a new rid is returned. /// </summary> /// <param name="row">The row. It's now owned by us and must NOT be modified by the caller.</param> /// <returns>The RID (row ID) of the row</returns> public uint Add(T row) { uint rid; if (cachedDict.TryGetValue(row, out rid)) return rid; return Create(row); } /// <summary> /// Creates a new row even if this row already exists. /// </summary> /// <param name="row">The row. It's now owned by us and must NOT be modified by the caller.</param> /// <returns>The RID (row ID) of the row</returns> public uint Create(T row) { uint rid = (uint)cached.Count + 1; if (!cachedDict.ContainsKey(row)) cachedDict[row] = rid; cached.Add(row); return rid; } } }
using System.Collections.Generic; using dot10.DotNet.MD; namespace dot10.DotNet.Writer { /// <summary> /// Creates rows in a table. Rows can optionally be shared to create a compact table. /// </summary> /// <typeparam name="T">The raw row type</typeparam> public class MDTable<T> { readonly Table table; readonly Dictionary<T, uint> cachedDict; readonly List<T> cached; bool isSorted; /// <summary> /// Gets the table type /// </summary> public Table Table { get { return table; } } /// <summary> /// <c>true</c> if the table is empty /// </summary> public bool IsEmpty { get { return cached.Count == 0; } } /// <summary> /// Gets the number of rows in this table /// </summary> public int Rows { get { return cached.Count; } } /// <summary> /// Gets/sets a value indicating whether it's sorted /// </summary> public bool IsSorted { get { return isSorted; } set { isSorted = value; } } /// <summary> /// Gets the value with rid <paramref name="rid"/> /// </summary> /// <param name="rid">The row ID</param> public T this[uint rid] { get { return cached[(int)rid - 1]; } } /// <summary> /// Constructor /// </summary> /// <param name="table">The table type</param> /// <param name="equalityComparer">Equality comparer</param> public MDTable(Table table, IEqualityComparer<T> equalityComparer) { this.table = table; this.cachedDict = new Dictionary<T, uint>(equalityComparer); this.cached = new List<T>(); } /// <summary> /// Adds a row. If the row already exists, returns a rid to the existing one, else /// it's created and a new rid is returned. /// </summary> /// <param name="row">The row. It's now owned by us and must NOT be modified by the caller.</param> /// <returns>The RID (row ID) of the row</returns> public uint Add(T row) { uint rid; if (cachedDict.TryGetValue(row, out rid)) return rid; return Create(row); } /// <summary> /// Creates a new row even if this row already exists. /// </summary> /// <param name="row">The row. It's now owned by us and must NOT be modified by the caller.</param> /// <returns>The RID (row ID) of the row</returns> public uint Create(T row) { uint rid = (uint)cached.Count + 1; if (!cachedDict.ContainsKey(row)) cachedDict[row] = rid; cached.Add(row); return rid; } } }
mit
C#
8d8349d27bce60508b2a4416b5a3e07ad8e3102b
Add Debug writer for diagnostic purpose
cezarypiatek/MaintainableSelenium,cezarypiatek/MaintainableSelenium,cezarypiatek/Tellurium,cezarypiatek/Tellurium,cezarypiatek/Tellurium,cezarypiatek/MaintainableSelenium
Src/Dashboard/Program.cs
Src/Dashboard/Program.cs
using System; using System.Diagnostics; using System.IO; using System.Threading; using Topshelf; namespace Tellurium.VisualAssertion.Dashboard { public class Program { public static void Main(string[] args) { #if DEBUG using (var server = new WebServer()) { Console.SetOut(new DebugWriter()); server.Run(consoleMode:true); Console.ReadKey(); } #else InstallDashboardService(); #endif } private static void InstallDashboardService() { HostFactory.Run(hostConfiguration => { hostConfiguration.Service<WebServer>(wsc => { wsc.ConstructUsing(() => new WebServer()); wsc.WhenStarted(server => { server.Run(); }); wsc.WhenStopped(ws => ws.Dispose()); }); hostConfiguration.RunAsLocalSystem(); hostConfiguration.SetDescription("This is Tellurium Dashboard"); hostConfiguration.SetDisplayName("Tellurium Dashboard"); hostConfiguration.SetServiceName("TelluriumDashboard"); hostConfiguration.StartAutomatically(); }); } } public class DebugWriter : StringWriter { public override void WriteLine(string value) { Debug.WriteLine(value); base.WriteLine(value); } } }
using System; using System.Threading; using Topshelf; namespace Tellurium.VisualAssertion.Dashboard { public class Program { public static void Main(string[] args) { #if DEBUG using (var server = new WebServer()) { server.Run(consoleMode:true); Console.ReadKey(); } #else InstallDashboardService(); #endif } private static void InstallDashboardService() { HostFactory.Run(hostConfiguration => { hostConfiguration.Service<WebServer>(wsc => { wsc.ConstructUsing(() => new WebServer()); wsc.WhenStarted(server => { server.Run(); }); wsc.WhenStopped(ws => ws.Dispose()); }); hostConfiguration.RunAsLocalSystem(); hostConfiguration.SetDescription("This is Tellurium Dashboard"); hostConfiguration.SetDisplayName("Tellurium Dashboard"); hostConfiguration.SetServiceName("TelluriumDashboard"); hostConfiguration.StartAutomatically(); }); } } }
mit
C#
7567c66e0e26664ab96a0e0506d7ddaef91f3ae3
Initialise script class to prevent null reference expression with variables.
polyethene/IronAHK,polyethene/IronAHK,yatsek/IronAHK,yatsek/IronAHK,michaltakac/IronAHK,yatsek/IronAHK,michaltakac/IronAHK,yatsek/IronAHK,michaltakac/IronAHK,michaltakac/IronAHK,polyethene/IronAHK,michaltakac/IronAHK,yatsek/IronAHK,polyethene/IronAHK
Tests/Rusty/Variables.cs
Tests/Rusty/Variables.cs
using IronAHK.Scripting; using NUnit.Framework; namespace IronAHK.Tests { partial class Rusty { [Test, Category("Variables")] public void ReservedVariables() { Script.Init(); Assert.IsTrue((int)Script.Vars["a_tickCount"] > 0); } } }
using IronAHK.Scripting; using NUnit.Framework; namespace IronAHK.Tests { partial class Rusty { [Test, Category("Variables")] public void ReservedVariables() { Assert.IsTrue((int)Script.Vars["a_tickCount"] > 0); } } }
bsd-2-clause
C#
57152381377d2b09f749f46b829add58f1ab1930
Fix issue description
Hitcents/Xamarin.Forms,Hitcents/Xamarin.Forms,Hitcents/Xamarin.Forms
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46630.cs
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46630.cs
using System.Collections.Generic; using Xamarin.Forms.CustomAttributes; using Xamarin.Forms.Internals; #if UITEST using Xamarin.UITest; using NUnit.Framework; #endif // Apply the default category of "Issues" to all of the tests in this assembly // We use this as a catch-all for tests which haven't been individually categorized #if UITEST [assembly: NUnit.Framework.Category("Issues")] #endif namespace Xamarin.Forms.Controls.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Bugzilla, 46630, "[Xamarin.Forms, Android] Context menu of the Editor control is not working in the ListView", PlatformAffected.Android)] public class Bugzilla46630 : TestContentPage { protected override void Init() { Content = new ListView { HasUnevenRows = true, ItemsSource = new List<int> { 0 }, ItemTemplate = new DataTemplate(() => new ViewCell { Height = 300, ContextActions = { new MenuItem {Text = "Action1"}, new MenuItem {Text = "Action2"} }, View = new StackLayout { Orientation = StackOrientation.Vertical, Spacing = 10, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = 10, Children = { new Label { HeightRequest = 50, BackgroundColor = Color.Coral, Text = "Long click each cell. Input views should not display context actions."}, new Editor { HeightRequest = 50, BackgroundColor = Color.Bisque, Text = "Editor"}, new Entry { HeightRequest = 50, BackgroundColor = Color.Aqua, Text = "Entry"}, new SearchBar { HeightRequest = 50, BackgroundColor = Color.CornflowerBlue, Text = "SearchBar"}, new Grid { HeightRequest = 50, BackgroundColor = Color.PaleVioletRed} } } }) }; } } }
using System.Collections.Generic; using Xamarin.Forms.CustomAttributes; using Xamarin.Forms.Internals; #if UITEST using Xamarin.UITest; using NUnit.Framework; #endif // Apply the default category of "Issues" to all of the tests in this assembly // We use this as a catch-all for tests which haven't been individually categorized #if UITEST [assembly: NUnit.Framework.Category("Issues")] #endif namespace Xamarin.Forms.Controls.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Bugzilla, 46630, "Issue Description", PlatformAffected.Android)] public class Bugzilla46630 : TestContentPage { protected override void Init() { Content = new ListView { HasUnevenRows = true, ItemsSource = new List<int> { 0 }, ItemTemplate = new DataTemplate(() => new ViewCell { Height = 300, ContextActions = { new MenuItem {Text = "Action1"}, new MenuItem {Text = "Action2"} }, View = new StackLayout { Orientation = StackOrientation.Vertical, Spacing = 10, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = 10, Children = { new Label { HeightRequest = 50, BackgroundColor = Color.Coral, Text = "Long click each cell. Input views should not display context actions."}, new Editor { HeightRequest = 50, BackgroundColor = Color.Bisque, Text = "Editor"}, new Entry { HeightRequest = 50, BackgroundColor = Color.Aqua, Text = "Entry"}, new SearchBar { HeightRequest = 50, BackgroundColor = Color.CornflowerBlue, Text = "SearchBar"}, new Grid { HeightRequest = 50, BackgroundColor = Color.PaleVioletRed} } } }) }; } } }
mit
C#
3adfe171ba3cdbdde9e0770b7497cc2375fabd98
Add streaming coroutine
tobyclh/UnityCNTK,tobyclh/UnityCNTK
Assets/UnityCNTK/Scripts/Models/StreamingModel.cs
Assets/UnityCNTK/Scripts/Models/StreamingModel.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityCNTK; using CNTK; using System; using UnityEngine.Assertions; namespace UnityCNTK { /// <summary> /// Streaming model streams a datasource to a model every set period /// </summary> [CreateAssetMenu(fileName = "StreamingModel", menuName = "UnityCNTk/Model/StreamingModel")] public class StreamingModel: Model { public DataSource source; [Tooltip("Evaluation carry out in every specificed second")] public float evaluationPeriod = 10; private bool shouldStop = false; private bool isStreaming = false; public IEnumerator StartStreaming() { Assert.IsFalse(isStreaming, name + " is already streaming"); while (!shouldStop) { Evaluate(source.GetData()); yield return new WaitForSeconds(evaluationPeriod); } } public void StopStreaming() { Assert.IsTrue(isStreaming, name + " is not streaming"); shouldStop = true; } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityCNTK; using CNTK; using System; namespace UnityCNTK{ /// <summary> /// Streaming model streams a datasource to a model every set period /// </summary> [CreateAssetMenu(fileName = "StreamingModel", menuName = "UnityCNTk/Model/StreamingModel")] public class StreamingModel: Model { public DataSource source; [Tooltip("Evaluation carry out in every specificed second")] public double evaluationPeriod = 10; public void StartStreaming() { } public void StopStreaming() { } protected override void OnEvaluated(Dictionary<Variable, Value> outputDataMap) { isEvaluating = false; } } }
mit
C#
46356a5611623a3c32dea5f5b948c771f6764e3a
Bump Cecil version
sailro/cecil,mono/cecil,jbevain/cecil,fnajera-rac-de/cecil,SiliconStudio/Mono.Cecil
ProjectInfo.cs
ProjectInfo.cs
// // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2015 Jb Evain // // Licensed under the MIT/X11 license. // using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyProduct ("Mono.Cecil")] [assembly: AssemblyCopyright ("Copyright © 2008 - 2015 Jb Evain")] #if !PCL [assembly: ComVisible (false)] #endif [assembly: AssemblyVersion ("0.10.0.0")] [assembly: AssemblyFileVersion ("0.10.0.0")]
// // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2015 Jb Evain // // Licensed under the MIT/X11 license. // using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyProduct ("Mono.Cecil")] [assembly: AssemblyCopyright ("Copyright © 2008 - 2015 Jb Evain")] #if !PCL [assembly: ComVisible (false)] #endif [assembly: AssemblyVersion ("0.9.6.0")] [assembly: AssemblyFileVersion ("0.9.6.0")]
mit
C#
8acb183053182559afa0f45591b31629dddfbb11
Add LeaseEnd property to leases
jennings/Turbocharged.Vault
Turbocharged.Vault/Lease.cs
Turbocharged.Vault/Lease.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace Turbocharged.Vault { public class Lease { [JsonProperty("lease_id")] public string LeaseId { get; set; } [JsonProperty("lease_duration")] public int LeaseDuration { get { return _leaseDuration; } set { _leaseDuration = value; LeaseEnd = DateTimeOffset.Now.AddSeconds(value); } } int _leaseDuration; [JsonIgnore] public DateTimeOffset LeaseEnd { get; private set; } [JsonProperty("renewable")] public bool Renewable { get; set; } [JsonProperty("data")] public Dictionary<string, object> Data { get; set; } [JsonProperty("auth")] internal AuthObject Auth { get; set; } internal class AuthObject { [JsonProperty("client_token")] public string ClientToken { get; set; } [JsonProperty("policies")] public List<string> Policies { get; set; } [JsonProperty("lease_duration")] public int LeaseDuration { get; set; } [JsonProperty("renewable")] public bool Renewable { get; set; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace Turbocharged.Vault { public class Lease { [JsonProperty("lease_id")] public string LeaseId { get; set; } [JsonProperty("lease_duration")] public int LeaseDuration { get; set; } [JsonProperty("renewable")] public bool Renewable { get; set; } [JsonProperty("data")] public Dictionary<string, object> Data { get; set; } [JsonProperty("auth")] internal AuthObject Auth { get; set; } internal class AuthObject { [JsonProperty("client_token")] public string ClientToken { get; set; } [JsonProperty("policies")] public List<string> Policies { get; set; } [JsonProperty("lease_duration")] public int LeaseDuration { get; set; } [JsonProperty("renewable")] public bool Renewable { get; set; } } } }
mit
C#
95f28d916ddc6f460f2aa2bc1f04fd9275f0c0c0
Add Db validation for ProductCategories model
MarioZisov/Baskerville,MarioZisov/Baskerville,MarioZisov/Baskerville
BaskervilleWebsite/Baskerville.Models/DataModels/ProductCategory.cs
BaskervilleWebsite/Baskerville.Models/DataModels/ProductCategory.cs
namespace Baskerville.Models.DataModels { using System.Collections.Generic; using System.ComponentModel.DataAnnotations; public class ProductCategory { public ProductCategory() { this.Products = new HashSet<Product>(); this.Subcategories = new HashSet<ProductCategory>(); } public int Id { get; set; } [Required] public string NameBg { get; set; } [Required] public string NameEn { get; set; } public bool IsRemoved { get; set; } public bool IsPrimary { get; set; } public ICollection<Product> Products { get; set; } public ICollection<ProductCategory> Subcategories { get; set; } public int? PrimaryCategoryId { get; set; } public ProductCategory PrimaryCategory { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Baskerville.Models.DataModels { public class ProductCategory { public ProductCategory() { this.Products = new HashSet<Product>(); this.Subcategories = new HashSet<ProductCategory>(); } public int Id { get; set; } public string NameBg { get; set; } public string NameEn { get; set; } public bool IsRemoved { get; set; } public bool IsPrimary { get; set; } public ICollection<Product> Products { get; set; } public ICollection<ProductCategory> Subcategories { get; set; } public int? PrimaryCategoryId { get; set; } public ProductCategory PrimaryCategory { get; set; } } }
apache-2.0
C#
d72dc5fcde3d3e3822b6a46e20d3af602d743317
Fix test.
JohanLarsson/Gu.Roslyn.Asserts
Gu.Roslyn.Asserts.Tests/AnalyzerAssertNoAnalyzerDiagnosticsTests.cs
Gu.Roslyn.Asserts.Tests/AnalyzerAssertNoAnalyzerDiagnosticsTests.cs
namespace Gu.Roslyn.Asserts.Tests { using NUnit.Framework; public class AnalyzerAssertNoAnalyzerDiagnosticsTests { public class Fail { [Test] public void SingleClassFieldNameMustNotBeginWithUnderscore() { var code = @" namespace RoslynSandbox { class Foo { private readonly int _value = 1; } }"; var expected = "Expected no diagnostics, found:\r\n" + "SA1309 Field '_value' must not begin with an underscore\r\n" + " at line 5 and character 29 in file Foo.cs | private readonly int ↓_value = 1;\r\n"; var exception = Assert.Throws<AssertException>(() => AnalyzerAssert.Valid<FieldNameMustNotBeginWithUnderscore>(code)); Assert.AreEqual(expected, exception.Message); exception = Assert.Throws<AssertException>(() => AnalyzerAssert.Valid(typeof(FieldNameMustNotBeginWithUnderscore), code)); Assert.AreEqual(expected, exception.Message); exception = Assert.Throws<AssertException>(() => AnalyzerAssert.Valid(new FieldNameMustNotBeginWithUnderscore(), code)); Assert.AreEqual(expected, exception.Message); } [Test] public void WhenAnalyzerThrows() { var code = @" namespace RoslynSandbox { class Foo { } }"; var expected = "Expected no diagnostics, found:\r\n" + "AD0001 Analyzer 'Gu.Roslyn.Asserts.Tests.ThrowingAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.\r\n" + " at line 0 and character 0 in file | Code did not have position 0,0\r\n"; var exception = Assert.Throws<AssertException>(() => AnalyzerAssert.NoAnalyzerDiagnostics<ThrowingAnalyzer>(code)); Assert.AreEqual(expected, exception.Message); exception = Assert.Throws<AssertException>(() => AnalyzerAssert.NoAnalyzerDiagnostics(typeof(ThrowingAnalyzer), code)); Assert.AreEqual(expected, exception.Message); exception = Assert.Throws<AssertException>(() => AnalyzerAssert.NoAnalyzerDiagnostics(new ThrowingAnalyzer(), code)); Assert.AreEqual(expected, exception.Message); } } } }
namespace Gu.Roslyn.Asserts.Tests { using System; using NUnit.Framework; public class AnalyzerAssertNoAnalyzerDiagnosticsTests { public class Fail { [Test] public void SingleClassFieldNameMustNotBeginWithUnderscore() { var code = @" namespace RoslynSandbox { class Foo { private readonly int _value = 1; } }"; var expected = "Expected no diagnostics, found:\r\n" + "SA1309 Field '_value' must not begin with an underscore\r\n" + " at line 5 and character 29 in file Foo.cs | private readonly int ↓_value = 1;\r\n"; var exception = Assert.Throws<AssertException>(() => AnalyzerAssert.Valid<FieldNameMustNotBeginWithUnderscore>(code)); Assert.AreEqual(expected, exception.Message); exception = Assert.Throws<AssertException>(() => AnalyzerAssert.Valid(typeof(FieldNameMustNotBeginWithUnderscore), code)); Assert.AreEqual(expected, exception.Message); exception = Assert.Throws<AssertException>(() => AnalyzerAssert.Valid(new FieldNameMustNotBeginWithUnderscore(), code)); Assert.AreEqual(expected, exception.Message); } [Test] public void WhenAnalyzerThrows() { var code = @" namespace RoslynSandbox { class Foo { } }"; _ = Assert.Throws<NullReferenceException>(() => AnalyzerAssert.NoAnalyzerDiagnostics<ThrowingAnalyzer>(code)); _ = Assert.Throws<NullReferenceException>(() => AnalyzerAssert.NoAnalyzerDiagnostics(typeof(ThrowingAnalyzer), code)); _ = Assert.Throws<NullReferenceException>(() => AnalyzerAssert.NoAnalyzerDiagnostics(new ThrowingAnalyzer(), code)); } } } }
mit
C#
b2226c48e69e42f0f2ebaa6009f15c2ec423dc60
update version
darraghoriordan/Thinktecture.IdentityModel.45,yonglehou/Thinktecture.IdentityModel.45,shashwatchandra/Thinktecture.IdentityModel.45,IdentityModel/Thinktecture.IdentityModel.45,jbn566/Thinktecture.IdentityModel.45,rmorris8812/Thinktecture.IdentityModel.45,nguyenbanguyen/Thinktecture.IdentityModel.45
IdentityModel/Thinktecture.IdentityModel/Properties/AssemblyInfo.cs
IdentityModel/Thinktecture.IdentityModel/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Thinktecture.IdentityModel")] [assembly: AssemblyDescription("Helper library for identity and access control in .NET 4.5")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Thinktecture")] [assembly: AssemblyProduct("Thinktecture.IdentityModel")] [assembly: AssemblyCopyright("Copyright © Dominick Baier & Brock Allen")] [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("2e3a2e3f-729c-42a4-9aee-48f2e14ae134")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.6.1.0")] [assembly: AssemblyFileVersion("2.6.1.0")] [assembly: CLSCompliant(true)]
using System; using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Thinktecture.IdentityModel")] [assembly: AssemblyDescription("Helper library for identity and access control in .NET 4.5")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Thinktecture")] [assembly: AssemblyProduct("Thinktecture.IdentityModel")] [assembly: AssemblyCopyright("Copyright © Dominick Baier & Brock Allen")] [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("2e3a2e3f-729c-42a4-9aee-48f2e14ae134")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.6.0.0")] [assembly: AssemblyFileVersion("2.6.0.0")] [assembly: CLSCompliant(true)]
bsd-3-clause
C#
d5e6f6b550b82276f53fd8f19c8a54041037c108
Fix string.Replace bug
ErikEJ/EntityFramework.SqlServerCompact,ErikEJ/EntityFramework7.SqlServerCompact
src/Provider40/Query/ExpressionTranslators/Internal/SqlCeStringReplaceTranslator.cs
src/Provider40/Query/ExpressionTranslators/Internal/SqlCeStringReplaceTranslator.cs
using System.Linq; using System.Linq.Expressions; using System.Reflection; using Microsoft.EntityFrameworkCore.Query.Expressions; namespace Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal { public class SqlCeStringReplaceTranslator : IMethodCallTranslator { private static readonly MethodInfo _methodInfo = typeof(string).GetTypeInfo() .GetDeclaredMethods(nameof(string.Replace)) .Single(m => m.GetParameters().Length == 2 && m.GetParameters()[0].ParameterType == typeof(string)); public virtual Expression Translate(MethodCallExpression methodCallExpression) => _methodInfo.Equals(methodCallExpression.Method) ? new SqlFunctionExpression( "REPLACE", methodCallExpression.Type, new[] { methodCallExpression.Object }.Concat(methodCallExpression.Arguments)) : null; } }
using System.Linq; using System.Linq.Expressions; using System.Reflection; using Microsoft.EntityFrameworkCore.Query.Expressions; namespace Microsoft.EntityFrameworkCore.Query.ExpressionTranslators.Internal { public class SqlCeStringReplaceTranslator : IMethodCallTranslator { private static readonly MethodInfo _methodInfo = typeof(string).GetTypeInfo() .GetDeclaredMethods(nameof(string.Replace)) .Single(m => m.GetParameters()[0].ParameterType == typeof(string)); public virtual Expression Translate(MethodCallExpression methodCallExpression) => _methodInfo.Equals(methodCallExpression.Method) ? new SqlFunctionExpression( "REPLACE", methodCallExpression.Type, new[] { methodCallExpression.Object }.Concat(methodCallExpression.Arguments)) : null; } }
apache-2.0
C#
4f5a8ebb2939b9688a3e9e1365168dfa1cdc469d
delete -> truncate in ReplaceDataObjectsInBulkActor
2gis/nuclear-river,xakep139/nuclear-river,2gis/nuclear-river-validation-rules,xakep139/nuclear-river,2gis/nuclear-river
StateInitialization/StateInitialization.Core/Actors/ReplaceDataObjectsInBulkActor.cs
StateInitialization/StateInitialization.Core/Actors/ReplaceDataObjectsInBulkActor.cs
using System; using System.Collections.Generic; using System.Data; using System.Linq; using LinqToDB.Data; using LinqToDB.Mapping; using NuClear.Replication.Core; using NuClear.Replication.Core.Actors; using NuClear.Replication.Core.DataObjects; using NuClear.StateInitialization.Core.Commands; namespace NuClear.StateInitialization.Core.Actors { public sealed class ReplaceDataObjectsInBulkActor<TDataObject> : IActor where TDataObject : class { private readonly IQueryable<TDataObject> _dataObjectsSource; private readonly DataConnection _targetDataConnection; public ReplaceDataObjectsInBulkActor(IStorageBasedDataObjectAccessor<TDataObject> dataObjectAccessor, DataConnection targetDataConnection) { _dataObjectsSource = dataObjectAccessor.GetSource(); _targetDataConnection = targetDataConnection; } public IReadOnlyCollection<IEvent> ExecuteCommands(IReadOnlyCollection<ICommand> commands) { var command = commands.OfType<ReplaceDataObjectsInBulkCommand>().SingleOrDefault(); if (command == null) { return Array.Empty<IEvent>(); } var attributes = _targetDataConnection.MappingSchema.GetAttributes<TableAttribute>(typeof(TDataObject)); var tableName = attributes.Select(x => x.Name).FirstOrDefault() ?? typeof(TDataObject).Name; var schemaName = attributes.Select(x => x.Schema).FirstOrDefault(); if (!string.IsNullOrEmpty(schemaName)) { tableName = $"{schemaName}.{tableName}"; } try { _targetDataConnection.Execute($"TRUNCATE TABLE {tableName}"); var options = new BulkCopyOptions { BulkCopyTimeout = (int)TimeSpan.FromMinutes(command.BulkCopyTimeout).TotalSeconds }; _targetDataConnection.BulkCopy(options, _dataObjectsSource); return Array.Empty<IEvent>(); } catch (Exception ex) { throw new DataException($"Error occured while bulk replacing data for dataobject of type {typeof(TDataObject).Name}{Environment.NewLine}{_targetDataConnection.LastQuery}", ex); } } } }
using System; using System.Collections.Generic; using System.Data; using System.Linq; using LinqToDB; using LinqToDB.Data; using NuClear.Replication.Core; using NuClear.Replication.Core.Actors; using NuClear.Replication.Core.DataObjects; using NuClear.StateInitialization.Core.Commands; namespace NuClear.StateInitialization.Core.Actors { public sealed class ReplaceDataObjectsInBulkActor<TDataObject> : IActor where TDataObject : class { private readonly IQueryable<TDataObject> _dataObjectsSource; private readonly DataConnection _targetDataConnection; public ReplaceDataObjectsInBulkActor(IStorageBasedDataObjectAccessor<TDataObject> dataObjectAccessor, DataConnection targetDataConnection) { _dataObjectsSource = dataObjectAccessor.GetSource(); _targetDataConnection = targetDataConnection; } public IReadOnlyCollection<IEvent> ExecuteCommands(IReadOnlyCollection<ICommand> commands) { var command = commands.OfType<ReplaceDataObjectsInBulkCommand>().SingleOrDefault(); if (command == null) { return Array.Empty<IEvent>(); } try { var options = new BulkCopyOptions { BulkCopyTimeout = (int)TimeSpan.FromMinutes(command.BulkCopyTimeout).TotalSeconds }; _targetDataConnection.GetTable<TDataObject>().Delete(); _targetDataConnection.BulkCopy(options, _dataObjectsSource); return Array.Empty<IEvent>(); } catch (Exception ex) { throw new DataException($"Error occured while bulk replacing data for dataobject of type {typeof(TDataObject).Name}{Environment.NewLine}{_targetDataConnection.LastQuery}", ex); } } } }
mpl-2.0
C#
2c69b2f3e14d7869c73c42f4b86c4254d26c85f7
Update CommandAttribute.cs
Seprum/SampSharp,ikkentim/SampSharp,ikkentim/SampSharp,ikkentim/SampSharp,Seprum/SampSharp,Seprum/SampSharp,Seprum/SampSharp
src/SampSharp.GameMode/SAMP/Commands/CommandAttribute.cs
src/SampSharp.GameMode/SAMP/Commands/CommandAttribute.cs
// SampSharp // Copyright 2016 Tim Potze // // 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 SampSharp.GameMode.SAMP.Commands.PermissionCheckers; namespace SampSharp.GameMode.SAMP.Commands { /// <summary> /// Indicates a method is a player command. /// </summary> [AttributeUsage(AttributeTargets.Method)] public class CommandAttribute : Attribute { /// <summary> /// Initializes a new instance of the <see cref="CommandAttribute" /> class. /// </summary> /// <param name="name">The name of the command.</param> public CommandAttribute(string name) : this(new[] {name}) { } /// <summary> /// Initializes a new instance of the <see cref="CommandAttribute" /> class. /// </summary> /// <param name="names">The names of the command.</param> public CommandAttribute(params string[] names) { Names = names; IgnoreCase = true; } /// <summary> /// Gets the names. /// </summary> public string[] Names { get; } /// <summary> /// Gets or sets a value indicating whether to ignore the case of the command. /// </summary> public bool IgnoreCase { get; set; } /// <summary> /// Gets or sets the shortcut. /// </summary> public string Shortcut { get; set; } /// <summary> /// Gets or sets the display name. /// </summary> public string DisplayName { get; set; } /// <summary> /// Gets or sets the usage message. /// </summary> public string UsageMessage { get; set; } /// <summary> /// Gets or sets the permission checker type. /// </summary> public Type PermissionChecker { get; set; } } }
// SampSharp // Copyright 2016 Tim Potze // // 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 SampSharp.GameMode.SAMP.Commands.PermissionCheckers; namespace SampSharp.GameMode.SAMP.Commands { /// <summary> /// Indicates a method is a player command. /// </summary> [AttributeUsage(AttributeTargets.Method)] public class CommandAttribute : Attribute { /// <summary> /// Initializes a new instance of the <see cref="CommandAttribute" /> class. /// </summary> /// <param name="name">The name of the command.</param> public CommandAttribute(string name) : this(new[] {name}) { } /// <summary> /// Initializes a new instance of the <see cref="CommandAttribute" /> class. /// </summary> /// <param name="names">The names of the command.</param> public CommandAttribute(params string[] names) { Names = names; IgnoreCase = true; } /// <summary> /// Gets the names. /// </summary> public string[] Names { get; } /// <summary> /// Gets or sets a value indicating whether to ignore the case of the command. /// </summary> public bool IgnoreCase { get; set; } /// <summary> /// Gets or sets the shortcut. /// </summary> public string Shortcut { get; set; } /// <summary> /// Gets or sets the display name. /// </summary> public string DisplayName { get; set; } /// <summary> /// Gets or sets the usage message. /// </summary> public string UsageMessage { get; set; } /// <summary> /// Gets or sets the permission checker type /// </summary> public Type PermissionChecker { get; set; } } }
apache-2.0
C#
ff90e58ab8449da6aaa49e0a8ccc6fe9f96832bb
Make soldier list searchable
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Views/Weapons/Edit.cshtml
Battery-Commander.Web/Views/Weapons/Edit.cshtml
@model Weapon @using (Html.BeginForm("Save", "Weapons", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { @Html.AntiForgeryToken() @Html.HiddenFor(model => model.Id) @Html.ValidationSummary() <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Unit) @Html.DropDownListFor(model => model.UnitId, (IEnumerable<SelectListItem>)ViewBag.Units, "-- Select Unit --") </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Type) @Html.DropDownListFor(model => model.Type, Html.GetEnumSelectList<Weapon.WeaponType>()) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.AdminNumber) @Html.TextBoxFor(model => model.AdminNumber) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Serial) @Html.TextBoxFor(model => model.Serial) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.OpticSerial) @Html.TextBoxFor(model => model.OpticSerial) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.OpticType) @Html.DropDownListFor(model => model.OpticType, Html.GetEnumSelectList<Weapon.WeaponOptic>()) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Assigned) @Html.DropDownListFor(model => model.AssignedId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select Soldier --", new { @class = "select2" }) </div> <button type="submit">Save</button> } @if (Model.Id > 0) { <div> @using (Html.BeginForm("Delete", "Weapons", new { Model.Id }, FormMethod.Post)) { @Html.AntiForgeryToken() <button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete this?')">Delete</button> } </div> }
@model Weapon @using (Html.BeginForm("Save", "Weapons", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { @Html.AntiForgeryToken() @Html.HiddenFor(model => model.Id) @Html.ValidationSummary() <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Unit) @Html.DropDownListFor(model => model.UnitId, (IEnumerable<SelectListItem>)ViewBag.Units, "-- Select Unit --") </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Type) @Html.DropDownListFor(model => model.Type, Html.GetEnumSelectList<Weapon.WeaponType>()) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.AdminNumber) @Html.TextBoxFor(model => model.AdminNumber) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Serial) @Html.TextBoxFor(model => model.Serial) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.OpticSerial) @Html.TextBoxFor(model => model.OpticSerial) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.OpticType) @Html.DropDownListFor(model => model.OpticType, Html.GetEnumSelectList<Weapon.WeaponOptic>()) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Assigned) @Html.DropDownListFor(model => model.AssignedId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select Soldier --") </div> <button type="submit">Save</button> } @if (Model.Id > 0) { <div> @using (Html.BeginForm("Delete", "Weapons", new { Model.Id }, FormMethod.Post)) { @Html.AntiForgeryToken() <button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete this?')">Delete</button> } </div> }
mit
C#
62cf350f010cf42be020ae0a5db1d210fa945194
Fix - RuntimeUniqueIdProdiver is static
theraot/Theraot
Core/Theraot/Threading/ThreadingHelper.extra.cs
Core/Theraot/Threading/ThreadingHelper.extra.cs
#if FAT namespace Theraot.Threading { public static partial class ThreadingHelper { // Leaked until AppDomain unload private static readonly NoTrackingThreadLocal<RuntimeUniqueIdProdiver.UniqueId> _threadRuntimeUniqueId = new NoTrackingThreadLocal<RuntimeUniqueIdProdiver.UniqueId>(RuntimeUniqueIdProdiver.GetNextId); public static bool HasThreadUniqueId { get { return _threadRuntimeUniqueId.IsValueCreated; } } public static RuntimeUniqueIdProdiver.UniqueId ThreadUniqueId { get { return _threadRuntimeUniqueId.Value; } } } } #endif
#if FAT namespace Theraot.Threading { public static partial class ThreadingHelper { private static readonly RuntimeUniqueIdProdiver _threadIdProvider = new RuntimeUniqueIdProdiver(); // Leaked until AppDomain unload private static readonly NoTrackingThreadLocal<RuntimeUniqueIdProdiver.UniqueId> _threadRuntimeUniqueId = new NoTrackingThreadLocal<RuntimeUniqueIdProdiver.UniqueId>(_threadIdProvider.GetNextId); public static bool HasThreadUniqueId { get { return _threadRuntimeUniqueId.IsValueCreated; } } public static RuntimeUniqueIdProdiver.UniqueId ThreadUniqueId { get { return _threadRuntimeUniqueId.Value; } } } } #endif
mit
C#
716fd408b95aaa8165f774687075c51233e009fa
load and-design-blazor.js after _framework/blazor.server.js
BioWareRu/BioEngine,BioWareRu/BioEngine,BioWareRu/BioEngine
src/BioEngine.Admin/Pages/_Layout.cshtml
src/BioEngine.Admin/Pages/_Layout.cshtml
@using Microsoft.AspNetCore.Components.Web @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" /> <base href="~/"/> <link rel="preconnect" href="https://fonts.gstatic.com"/> <link href="_content/AntDesign.ProLayout/theme/dark-geekblue.css" rel="stylesheet"/> <link href="BioEngine.Admin.styles.css" rel="stylesheet"/> <link href="~/dist/index.css" rel="stylesheet"/> </head> <body id="bioengine"> @RenderBody() <div id="blazor-error-ui"> <environment include="Staging,Production"> An error has occurred. This application may no longer respond until reloaded. </environment> <environment include="Development"> An unhandled exception has occurred. See browser dev tools for details. </environment> <a href="" class="reload">Reload</a> <a class="dismiss">🗙</a> </div> <script src="_framework/blazor.server.js"></script> <script src="_content/AntDesign/js/ant-design-blazor.js"></script> <script src="~/dist/index.js"></script> </body> </html>
@using Microsoft.AspNetCore.Components.Web @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" /> <base href="~/"/> <link rel="preconnect" href="https://fonts.gstatic.com"/> <link href="_content/AntDesign.ProLayout/theme/dark-geekblue.css" rel="stylesheet"/> <link href="BioEngine.Admin.styles.css" rel="stylesheet"/> <link href="~/dist/index.css" rel="stylesheet"/> </head> <body id="bioengine"> @RenderBody() <div id="blazor-error-ui"> <environment include="Staging,Production"> An error has occurred. This application may no longer respond until reloaded. </environment> <environment include="Development"> An unhandled exception has occurred. See browser dev tools for details. </environment> <a href="" class="reload">Reload</a> <a class="dismiss">🗙</a> </div> <script src="_content/AntDesign/js/ant-design-blazor.js"></script> <script src="_framework/blazor.server.js"></script> <script src="~/dist/index.js"></script> </body> </html>
mit
C#
d2f1e425f73313854c1f32989d8884f6eb2acff8
clean xml
kleberksms/StaticCommons
src/StaticCommons/Class/Inflector/XML.cs
src/StaticCommons/Class/Inflector/XML.cs
 using System.Xml; using System.Xml.Serialization; namespace StaticCommons.Class.Inflector { /** * Base * https://stackoverflow.com/questions/11447529/convert-an-object-to-an-xml-string */ public static class Xml { public static string ToXml(this object obj) { var stringwriter = new System.IO.StringWriter(); var serializer = new XmlSerializer(obj.GetType()); serializer.Serialize(stringwriter, obj); return stringwriter.ToString(); } public static string ToCleanXml(this object obj) { var emptyNamepsaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); var serializer = new XmlSerializer(obj.GetType()); var settings = new XmlWriterSettings { Indent = true, OmitXmlDeclaration = true }; using (var stream = new System.IO.StringWriter()) using (var writer = XmlWriter.Create(stream, settings)) { serializer.Serialize(writer, obj, emptyNamepsaces); return stream.ToString(); } } // ReSharper disable once InconsistentNaming public static string ToCDATA(this string xml) { return $"<![CDATA[{xml}]]>"; } // ReSharper disable once InconsistentNaming public static string ToCDATA(this object obj, bool cleanXml = true) { return cleanXml ? $"<![CDATA[{obj.ToCleanXml()}]]>" : $"<![CDATA[{obj.ToXml()}]]>"; } public static T ToObject<T>(string xmlText) { var stringReader = new System.IO.StringReader(xmlText); var serializer = new XmlSerializer(typeof(T)); return (T) serializer.Deserialize(stringReader); } } }
 using System.Xml; using System.Xml.Serialization; namespace StaticCommons.Class.Inflector { /** * Base * https://stackoverflow.com/questions/11447529/convert-an-object-to-an-xml-string */ public static class Xml { public static string ToXml(this object obj) { var stringwriter = new System.IO.StringWriter(); var serializer = new XmlSerializer(obj.GetType()); serializer.Serialize(stringwriter, obj); return stringwriter.ToString(); } // ReSharper disable once InconsistentNaming public static string ToCDATA(this string xml) { return $"<![CDATA[{xml}]]>"; } public static string ToCleanXml(this object obj) { var emptyNamepsaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); var serializer = new XmlSerializer(obj.GetType()); var settings = new XmlWriterSettings { Indent = true, OmitXmlDeclaration = true }; using (var stream = new System.IO.StringWriter()) using (var writer = XmlWriter.Create(stream, settings)) { serializer.Serialize(writer, obj, emptyNamepsaces); return stream.ToString(); } } public static T ToObject<T>(string xmlText) { var stringReader = new System.IO.StringReader(xmlText); var serializer = new XmlSerializer(typeof(T)); return (T) serializer.Deserialize(stringReader); } } }
mit
C#
d0d507db673c0422e984a8bc4d90dba3673cbfd4
Improve UnloadingAndProcessExitTests.netcoreapp.cs to help narrow down repro for recurring bug (#23397)
twsouthwick/corefx,ptoonen/corefx,axelheer/corefx,ptoonen/corefx,BrennanConroy/corefx,axelheer/corefx,shimingsg/corefx,ptoonen/corefx,twsouthwick/corefx,the-dwyer/corefx,mazong1123/corefx,Ermiar/corefx,fgreinacher/corefx,Ermiar/corefx,the-dwyer/corefx,ericstj/corefx,mmitche/corefx,Ermiar/corefx,mmitche/corefx,ravimeda/corefx,parjong/corefx,mazong1123/corefx,ravimeda/corefx,mazong1123/corefx,the-dwyer/corefx,ericstj/corefx,ViktorHofer/corefx,mmitche/corefx,mmitche/corefx,Jiayili1/corefx,tijoytom/corefx,nchikanov/corefx,MaggieTsang/corefx,tijoytom/corefx,parjong/corefx,shimingsg/corefx,the-dwyer/corefx,ericstj/corefx,Ermiar/corefx,ravimeda/corefx,JosephTremoulet/corefx,ericstj/corefx,nchikanov/corefx,the-dwyer/corefx,mmitche/corefx,parjong/corefx,Ermiar/corefx,zhenlan/corefx,ericstj/corefx,mazong1123/corefx,wtgodbe/corefx,Ermiar/corefx,parjong/corefx,ViktorHofer/corefx,ericstj/corefx,twsouthwick/corefx,ViktorHofer/corefx,zhenlan/corefx,MaggieTsang/corefx,twsouthwick/corefx,seanshpark/corefx,twsouthwick/corefx,BrennanConroy/corefx,the-dwyer/corefx,nchikanov/corefx,BrennanConroy/corefx,tijoytom/corefx,ptoonen/corefx,wtgodbe/corefx,ViktorHofer/corefx,zhenlan/corefx,Jiayili1/corefx,seanshpark/corefx,tijoytom/corefx,zhenlan/corefx,wtgodbe/corefx,zhenlan/corefx,JosephTremoulet/corefx,nchikanov/corefx,MaggieTsang/corefx,axelheer/corefx,nchikanov/corefx,seanshpark/corefx,seanshpark/corefx,ravimeda/corefx,tijoytom/corefx,shimingsg/corefx,wtgodbe/corefx,zhenlan/corefx,Jiayili1/corefx,ptoonen/corefx,mazong1123/corefx,fgreinacher/corefx,seanshpark/corefx,ptoonen/corefx,twsouthwick/corefx,mazong1123/corefx,fgreinacher/corefx,twsouthwick/corefx,ViktorHofer/corefx,MaggieTsang/corefx,seanshpark/corefx,JosephTremoulet/corefx,ravimeda/corefx,axelheer/corefx,shimingsg/corefx,Ermiar/corefx,wtgodbe/corefx,JosephTremoulet/corefx,mmitche/corefx,shimingsg/corefx,shimingsg/corefx,ViktorHofer/corefx,MaggieTsang/corefx,JosephTremoulet/corefx,axelheer/corefx,seanshpark/corefx,tijoytom/corefx,mazong1123/corefx,MaggieTsang/corefx,JosephTremoulet/corefx,parjong/corefx,Jiayili1/corefx,the-dwyer/corefx,ViktorHofer/corefx,nchikanov/corefx,MaggieTsang/corefx,ravimeda/corefx,Jiayili1/corefx,mmitche/corefx,ravimeda/corefx,zhenlan/corefx,nchikanov/corefx,shimingsg/corefx,ptoonen/corefx,parjong/corefx,fgreinacher/corefx,Jiayili1/corefx,ericstj/corefx,JosephTremoulet/corefx,parjong/corefx,tijoytom/corefx,wtgodbe/corefx,axelheer/corefx,Jiayili1/corefx,wtgodbe/corefx
src/System.Runtime.Extensions/tests/System/UnloadingAndProcessExitTests.netcoreapp.cs
src/System.Runtime.Extensions/tests/System/UnloadingAndProcessExitTests.netcoreapp.cs
using System.Diagnostics; using System.IO; using System.Threading; using Xunit; namespace System.Tests { public class UnloadingAndProcessExitTests : RemoteExecutorTestBase { [ActiveIssue("https://github.com/dotnet/corefx/issues/23307", TargetFrameworkMonikers.Uap)] [Fact] public void UnloadingEventMustHappenBeforeProcessExitEvent() { string fileName = GetTestFilePath(); File.WriteAllText(fileName, string.Empty); Func<string, int> otherProcess = f => { Action<int> OnUnloading = i => File.AppendAllText(f, string.Format("u{0}", i)); Action<int> OnProcessExit = i => File.AppendAllText(f, string.Format("e{0}", i)); File.AppendAllText(f, "s"); AppDomain.CurrentDomain.ProcessExit += (sender, e) => OnProcessExit(0); System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += acl => OnUnloading(0); AppDomain.CurrentDomain.ProcessExit += (sender, e) => OnProcessExit(1); System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += acl => OnUnloading(1); File.AppendAllText(f, "h"); return SuccessExitCode; }; using (var remote = RemoteInvoke(otherProcess, fileName)) { } Assert.Equal("shu0u1e0e1", File.ReadAllText(fileName)); } } }
using System.Diagnostics; using System.IO; using System.Threading; using Xunit; namespace System.Tests { public class UnloadingAndProcessExitTests : RemoteExecutorTestBase { [Fact] public void UnloadingEventMustHappenBeforeProcessExitEvent() { string fileName = GetTestFilePath(); File.WriteAllText(fileName, string.Empty); Func<string, int> otherProcess = f => { Action<int> OnUnloading = i => File.AppendAllText(f, string.Format("u{0}", i)); Action<int> OnProcessExit = i => File.AppendAllText(f, string.Format("e{0}", i)); AppDomain.CurrentDomain.ProcessExit += (sender, e) => OnProcessExit(0); System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += acl => OnUnloading(0); AppDomain.CurrentDomain.ProcessExit += (sender, e) => OnProcessExit(1); System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += acl => OnUnloading(1); return SuccessExitCode; }; using (var remote = RemoteInvoke(otherProcess, fileName)) { } Assert.Equal(File.ReadAllText(fileName), "u0u1e0e1"); } } }
mit
C#
1c1760549468bb5240285bbabd52578f7741a7f8
Fix formatting
shyamnamboodiripad/roslyn,AmadeusW/roslyn,bartdesmet/roslyn,AlekseyTs/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,physhi/roslyn,reaction1989/roslyn,nguerrera/roslyn,mavasani/roslyn,nguerrera/roslyn,weltkante/roslyn,brettfo/roslyn,gafter/roslyn,weltkante/roslyn,mgoertz-msft/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,abock/roslyn,davkean/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,davkean/roslyn,abock/roslyn,diryboy/roslyn,jmarolf/roslyn,wvdd007/roslyn,tannergooding/roslyn,eriawan/roslyn,panopticoncentral/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,panopticoncentral/roslyn,aelij/roslyn,AlekseyTs/roslyn,tmat/roslyn,gafter/roslyn,genlu/roslyn,agocke/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,bartdesmet/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,sharwell/roslyn,eriawan/roslyn,davkean/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,reaction1989/roslyn,sharwell/roslyn,physhi/roslyn,tmat/roslyn,agocke/roslyn,dotnet/roslyn,KirillOsenkov/roslyn,mgoertz-msft/roslyn,KevinRansom/roslyn,reaction1989/roslyn,KevinRansom/roslyn,genlu/roslyn,tannergooding/roslyn,ErikSchierboom/roslyn,genlu/roslyn,jasonmalinowski/roslyn,physhi/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,aelij/roslyn,tmat/roslyn,brettfo/roslyn,sharwell/roslyn,agocke/roslyn,heejaechang/roslyn,AlekseyTs/roslyn,wvdd007/roslyn,ErikSchierboom/roslyn,ErikSchierboom/roslyn,heejaechang/roslyn,nguerrera/roslyn,jmarolf/roslyn,KirillOsenkov/roslyn,mavasani/roslyn,gafter/roslyn,abock/roslyn,heejaechang/roslyn,diryboy/roslyn,tannergooding/roslyn,eriawan/roslyn,aelij/roslyn,AmadeusW/roslyn,weltkante/roslyn,wvdd007/roslyn,brettfo/roslyn,jmarolf/roslyn,stephentoub/roslyn,diryboy/roslyn
src/Features/Core/Portable/MoveToNamespace/MoveToNamespaceResult.cs
src/Features/Core/Portable/MoveToNamespace/MoveToNamespaceResult.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.MoveToNamespace { internal class MoveToNamespaceResult { public static readonly MoveToNamespaceResult Failed = new MoveToNamespaceResult(); public bool Succeeded { get; } public Solution UpdatedSolution { get; } public Solution OriginalSolution { get; } public DocumentId UpdatedDocumentId { get; } public ImmutableDictionary<string, ISymbol> NewNameOriginalSymbolMapping { get; } public string NewName { get; } public MoveToNamespaceResult( Solution originalSolution, Solution updatedSolution, DocumentId updatedDocumentId, ImmutableDictionary<string, ISymbol> newNameOriginalSymbolMapping) { OriginalSolution = originalSolution; UpdatedSolution = updatedSolution; UpdatedDocumentId = updatedDocumentId; NewNameOriginalSymbolMapping = newNameOriginalSymbolMapping; Succeeded = true; } private MoveToNamespaceResult() { Succeeded = false; } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.MoveToNamespace { internal class MoveToNamespaceResult { public static readonly MoveToNamespaceResult Failed = new MoveToNamespaceResult(); public bool Succeeded { get; } public Solution UpdatedSolution { get; } public Solution OriginalSolution { get; } public DocumentId UpdatedDocumentId { get; } public ImmutableDictionary<string, ISymbol> NewNameOriginalSymbolMapping { get; } public string NewName { get; } public MoveToNamespaceResult( Solution originalSolution, Solution updatedSolution, DocumentId updatedDocumentId, ImmutableDictionary<string, ISymbol> newNameOriginalSymbolMapping) { OriginalSolution = originalSolution; UpdatedSolution = updatedSolution; UpdatedDocumentId = updatedDocumentId; NewNameOriginalSymbolMapping = newNameOriginalSymbolMapping; Succeeded = true; } private MoveToNamespaceResult() { Succeeded = false; } } }
mit
C#
7543b4fb93889fc704b6d200a9306ef91bccdedd
Fix namespace and add inheritance
mniak/IdentityServer3.Contrib.RedisStores
src/IdentityServer3.Contrib.RedisStores/Stores/RefreshTokenStore.cs
src/IdentityServer3.Contrib.RedisStores/Stores/RefreshTokenStore.cs
using IdentityServer3.Core.Services; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using IdentityServer3.Core.Models; using IdentityServer3.Contrib.RedisStores.Models; using StackExchange.Redis; using IdentityServer3.Contrib.RedisStores.Converters; namespace IdentityServer3.Contrib.RedisStores { /// <summary> /// /// </summary> public class RefreshTokenStore : RedisTransientStore<RefreshToken, RefreshTokenModel>, IRefreshTokenStore { /// <summary> /// /// </summary> /// <param name="redis"></param> /// <param name="options"></param> public RefreshTokenStore(IDatabase redis, RedisOptions options) : base(redis, options, new RefreshTokenConverter()) { } /// <summary> /// /// </summary> /// <param name="redis"></param> public RefreshTokenStore(IDatabase redis) : base(redis, new RefreshTokenConverter()) { } internal override string CollectionName => "refreshTokens"; internal override int GetTokenLifetime(RefreshToken token) { return token.LifeTime; } } }
using IdentityServer3.Core.Services; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using IdentityServer3.Core.Models; using IdentityServer3.Contrib.RedisStores.Models; using StackExchange.Redis; using IdentityServer3.Contrib.RedisStores.Converters; namespace IdentityServer3.Contrib.RedisStores.Stores { /// <summary> /// /// </summary> public class RefreshTokenStore : RedisTransientStore<RefreshToken, RefreshTokenModel> { /// <summary> /// /// </summary> /// <param name="redis"></param> /// <param name="options"></param> public RefreshTokenStore(IDatabase redis, RedisOptions options) : base(redis, options, new RefreshTokenConverter()) { } /// <summary> /// /// </summary> /// <param name="redis"></param> public RefreshTokenStore(IDatabase redis) : base(redis, new RefreshTokenConverter()) { } internal override string CollectionName => "refreshTokens"; internal override int GetTokenLifetime(RefreshToken token) { return token.LifeTime; } } }
mit
C#
553e036d2840844d25b879fb2ec2472bf1c66187
Add GivenName and Surname default claims to FacebookOptions
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNetCore.Authentication.Facebook/FacebookOptions.cs
src/Microsoft.AspNetCore.Authentication.Facebook/FacebookOptions.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using Microsoft.AspNetCore.Authentication.Facebook; using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.Builder { /// <summary> /// Configuration options for <see cref="FacebookMiddleware"/>. /// </summary> public class FacebookOptions : OAuthOptions { /// <summary> /// Initializes a new <see cref="FacebookOptions"/>. /// </summary> public FacebookOptions() { AuthenticationScheme = FacebookDefaults.AuthenticationScheme; DisplayName = AuthenticationScheme; CallbackPath = new PathString("/signin-facebook"); SendAppSecretProof = true; AuthorizationEndpoint = FacebookDefaults.AuthorizationEndpoint; TokenEndpoint = FacebookDefaults.TokenEndpoint; UserInformationEndpoint = FacebookDefaults.UserInformationEndpoint; Scope.Add("public_profile"); Scope.Add("email"); Fields.Add("name"); Fields.Add("email"); Fields.Add("first_name"); Fields.Add("last_name"); } // Facebook uses a non-standard term for this field. /// <summary> /// Gets or sets the Facebook-assigned appId. /// </summary> public string AppId { get { return ClientId; } set { ClientId = value; } } // Facebook uses a non-standard term for this field. /// <summary> /// Gets or sets the Facebook-assigned app secret. /// </summary> public string AppSecret { get { return ClientSecret; } set { ClientSecret = value; } } /// <summary> /// Gets or sets if the appsecret_proof should be generated and sent with Facebook API calls. /// This is enabled by default. /// </summary> public bool SendAppSecretProof { get; set; } /// <summary> /// The list of fields to retrieve from the UserInformationEndpoint. /// https://developers.facebook.com/docs/graph-api/reference/user /// </summary> public ICollection<string> Fields { get; } = new HashSet<string>(); } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using Microsoft.AspNetCore.Authentication.Facebook; using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.Builder { /// <summary> /// Configuration options for <see cref="FacebookMiddleware"/>. /// </summary> public class FacebookOptions : OAuthOptions { /// <summary> /// Initializes a new <see cref="FacebookOptions"/>. /// </summary> public FacebookOptions() { AuthenticationScheme = FacebookDefaults.AuthenticationScheme; DisplayName = AuthenticationScheme; CallbackPath = new PathString("/signin-facebook"); SendAppSecretProof = true; AuthorizationEndpoint = FacebookDefaults.AuthorizationEndpoint; TokenEndpoint = FacebookDefaults.TokenEndpoint; UserInformationEndpoint = FacebookDefaults.UserInformationEndpoint; Scope.Add("public_profile"); Scope.Add("email"); Fields.Add("name"); Fields.Add("email"); } // Facebook uses a non-standard term for this field. /// <summary> /// Gets or sets the Facebook-assigned appId. /// </summary> public string AppId { get { return ClientId; } set { ClientId = value; } } // Facebook uses a non-standard term for this field. /// <summary> /// Gets or sets the Facebook-assigned app secret. /// </summary> public string AppSecret { get { return ClientSecret; } set { ClientSecret = value; } } /// <summary> /// Gets or sets if the appsecret_proof should be generated and sent with Facebook API calls. /// This is enabled by default. /// </summary> public bool SendAppSecretProof { get; set; } /// <summary> /// The list of fields to retrieve from the UserInformationEndpoint. /// https://developers.facebook.com/docs/graph-api/reference/user /// </summary> public ICollection<string> Fields { get; } = new HashSet<string>(); } }
apache-2.0
C#
fb99073d8bc942fe1065a4528d0a3d835fc16a23
Fix stack bounds check in AssignmentEvaluator
ethanmoffat/EndlessClient
EOBot/Interpreter/States/AssignmentEvaluator.cs
EOBot/Interpreter/States/AssignmentEvaluator.cs
using EOBot.Interpreter.Variables; using System.Collections.Generic; using System.Linq; namespace EOBot.Interpreter.States { public class AssignmentEvaluator : IScriptEvaluator { private readonly IEnumerable<IScriptEvaluator> _evaluators; public AssignmentEvaluator(IEnumerable<IScriptEvaluator> evaluators) { _evaluators = evaluators; } public bool Evaluate(ProgramState input) { if (!_evaluators.OfType<VariableEvaluator>().Single().Evaluate(input) || !input.Match(BotTokenType.AssignOperator) || !_evaluators.OfType<ExpressionEvaluator>().Single().Evaluate(input)) { return false; } if (input.OperationStack.Count == 0) return false; var expressionResult = (VariableBotToken)input.OperationStack.Pop(); // todo: check that assignOp is an assignment operator if (input.OperationStack.Count == 0) return false; var assignOp = input.OperationStack.Pop(); if (input.OperationStack.Count == 0) return false; var variable = (IdentifierBotToken)input.OperationStack.Pop(); if (variable.ArrayIndex != null) { if (!input.SymbolTable.ContainsKey(variable.TokenValue)) return false; ((ArrayVariable)input.SymbolTable[variable.TokenValue]).Value[variable.ArrayIndex.Value] = expressionResult.VariableValue; } else { // todo: dynamic typing with no warning, or warn if changing typing of variable on assignment? input.SymbolTable[variable.TokenValue] = expressionResult.VariableValue; } return true; } } }
using EOBot.Interpreter.Variables; using System.Collections.Generic; using System.Linq; namespace EOBot.Interpreter.States { public class AssignmentEvaluator : IScriptEvaluator { private readonly IEnumerable<IScriptEvaluator> _evaluators; public AssignmentEvaluator(IEnumerable<IScriptEvaluator> evaluators) { _evaluators = evaluators; } public bool Evaluate(ProgramState input) { if (!_evaluators.OfType<VariableEvaluator>().Single().Evaluate(input) || !input.Match(BotTokenType.AssignOperator) || !_evaluators.OfType<ExpressionEvaluator>().Single().Evaluate(input)) { return false; } var expressionResult = (VariableBotToken)input.OperationStack.Pop(); if (input.OperationStack.Count == 0) return false; // todo: check that assignOp is an assignment operator var assignOp = input.OperationStack.Pop(); if (input.OperationStack.Count == 0) return false; var variable = (IdentifierBotToken)input.OperationStack.Pop(); if (input.OperationStack.Count == 0) return false; if (variable.ArrayIndex != null) { if (!input.SymbolTable.ContainsKey(variable.TokenValue)) return false; ((ArrayVariable)input.SymbolTable[variable.TokenValue]).Value[variable.ArrayIndex.Value] = expressionResult.VariableValue; } else { // todo: dynamic typing with no warning, or warn if changing typing of variable on assignment? input.SymbolTable[variable.TokenValue] = expressionResult.VariableValue; } return true; } } }
mit
C#
5b3e02eaac6add02774d8030c216e95d772f6bc7
Fix handling of CONNECTION_PLAYER when sending response to GameServer
ethanmoffat/EndlessClient
EOLib/PacketHandlers/ConnectionPlayerHandler.cs
EOLib/PacketHandlers/ConnectionPlayerHandler.cs
using AutomaticTypeMapper; using EOLib.Logger; using EOLib.Net; using EOLib.Net.Communication; using EOLib.Net.Handlers; using EOLib.Net.PacketProcessing; namespace EOLib.PacketHandlers { /// <summary> /// Handles incoming CONNECTION_PLAYER packets which are used for updating sequence numbers in the EO protocol /// </summary> [AutoMappedType] public class ConnectionPlayerHandler : DefaultAsyncPacketHandler { private readonly IPacketProcessActions _packetProcessActions; private readonly IPacketSendService _packetSendService; private readonly ILoggerProvider _loggerProvider; public override PacketFamily Family => PacketFamily.Connection; public override PacketAction Action => PacketAction.Player; public override bool CanHandle => true; public ConnectionPlayerHandler(IPacketProcessActions packetProcessActions, IPacketSendService packetSendService, ILoggerProvider loggerProvider) { _packetProcessActions = packetProcessActions; _packetSendService = packetSendService; _loggerProvider = loggerProvider; } public override bool HandlePacket(IPacket packet) { var seq1 = packet.ReadShort(); var seq2 = packet.ReadChar(); _packetProcessActions.SetUpdatedBaseSequenceNumber(seq1, seq2); var response = new PacketBuilder(PacketFamily.Connection, PacketAction.Ping) .AddString("k") .Build(); try { _packetSendService.SendPacket(response); } catch (NoDataSentException) { return false; } return true; } } }
using AutomaticTypeMapper; using EOLib.Logger; using EOLib.Net; using EOLib.Net.Communication; using EOLib.Net.Handlers; using EOLib.Net.PacketProcessing; namespace EOLib.PacketHandlers { /// <summary> /// Handles incoming CONNECTION_PLAYER packets which are used for updating sequence numbers in the EO protocol /// </summary> [AutoMappedType] public class ConnectionPlayerHandler : DefaultAsyncPacketHandler { private readonly IPacketProcessActions _packetProcessActions; private readonly IPacketSendService _packetSendService; private readonly ILoggerProvider _loggerProvider; public override PacketFamily Family => PacketFamily.Connection; public override PacketAction Action => PacketAction.Player; public override bool CanHandle => true; public ConnectionPlayerHandler(IPacketProcessActions packetProcessActions, IPacketSendService packetSendService, ILoggerProvider loggerProvider) { _packetProcessActions = packetProcessActions; _packetSendService = packetSendService; _loggerProvider = loggerProvider; } public override bool HandlePacket(IPacket packet) { var seq1 = packet.ReadShort(); var seq2 = packet.ReadChar(); _packetProcessActions.SetUpdatedBaseSequenceNumber(seq1, seq2); var response = new PacketBuilder(PacketFamily.Connection, PacketAction.Ping).Build(); try { _packetSendService.SendPacket(response); } catch (NoDataSentException) { return false; } return true; } } }
mit
C#
904a394e04ed947ab6d71886d293b8e6b4002731
create BaseRequest for authentification
ismaelbelghiti/Tigwi,ismaelbelghiti/Tigwi
Core/Tigwi.API/Models/ModifyAccountModel.cs
Core/Tigwi.API/Models/ModifyAccountModel.cs
using System; using System.Xml.Serialization; namespace Tigwi.API.Models { // Models for request bodies public class BaseRequest { public string AccountName { get; set; } public Guid? AccountId { get; set; } public string Key { get; set; } } [Serializable] [XmlRootAttribute("Write")] public class MsgToWrite:BaseRequest { public MsgToPost Message { get; set; } } [Serializable] [XmlTypeAttribute("Message")] public class MsgToPost { public string Content { get; set; } } [Serializable] public class ActionOnMessage:BaseRequest { public Guid? MessageId { get; set; } } [Serializable] [XmlRootAttribute("Delete")] public class MsgToDelete : ActionOnMessage{} [Serializable] [XmlRootAttribute("Copy")] public class CopyMsg : ActionOnMessage{} [Serializable] public class Tag : ActionOnMessage{} [Serializable] public class Untag : ActionOnMessage { } [Serializable] public class SubscribeList:BaseRequest { public Guid? Subscription { get; set; } } [Serializable] public class ListInfo { public string Name; public string Description; public bool IsPrivate; } [Serializable] public class CreateList:BaseRequest { public ListInfo ListInfo { get; set; } } [Serializable] public class ChangeDescription:BaseRequest { public string Description { get; set; } } [Serializable] public class AccountUser:BaseRequest { public string UserLogin { get; set; } public Guid? UserId { get; set; } } [Serializable] public class AddUser : AccountUser{} [Serializable] public class RemoveUser : AccountUser{} [Serializable] public class ChangeAdministrator : AccountUser { } }
using System; using System.Xml.Serialization; namespace Tigwi.API.Models { // Models for request bodies [Serializable] [XmlRootAttribute("Write")] public class MsgToWrite { public string AccountName { get; set; } public Guid? AccountId { get; set; } public MsgToPost Message { get; set; } } [Serializable] [XmlTypeAttribute("Message")] public class MsgToPost { public string Content { get; set; } } [Serializable] public class ActionOnMessage { public string AccountName { get; set; } public Guid? AccountId { get; set; } public Guid? MessageId { get; set; } } [Serializable] [XmlRootAttribute("Delete")] public class MsgToDelete : ActionOnMessage{} [Serializable] [XmlRootAttribute("Copy")] public class CopyMsg : ActionOnMessage{} [Serializable] public class Tag : ActionOnMessage{} [Serializable] public class Untag : ActionOnMessage { } [Serializable] public class SubscribeList { public string AccountName { get; set; } public Guid? AccountId { get; set; } public Guid? Subscription { get; set; } } [Serializable] public class ListInfo { public string Name; public string Description; public bool IsPrivate; } [Serializable] public class CreateList { public string AccountName { get; set; } public Guid? AccountId { get; set; } public ListInfo ListInfo { get; set; } } [Serializable] public class ChangeDescription { public string AccountName { get; set; } public Guid? AccountId { get; set; } public string Description { get; set; } } [Serializable] public class AccountUser { public string AccountName { get; set; } public Guid? AccountId { get; set; } public string UserLogin { get; set; } public Guid? UserId { get; set; } } [Serializable] public class AddUser : AccountUser{} [Serializable] public class RemoveUser : AccountUser{} [Serializable] public class ChangeAdministrator : AccountUser { } }
bsd-3-clause
C#
c8c77a465d3468cacbd81dc55fb4f46f975c2cba
Fix issue where Dapper was trying to insert Read into the post table where that column doesnt exist
gavdraper/gdRead,gavdraper/gdRead
gdRead.Data/Models/Post.cs
gdRead.Data/Models/Post.cs
using System; using DapperExtensions.Mapper; namespace gdRead.Data.Models { public class Post { public int Id { get; set; } public int FeedId { get; set; } public string Name { get; set; } public string Url { get; set; } public string Summary { get; set; } public string Content { get; set; } public DateTime PublishDate { get; set; } public bool Read { get; set; } public DateTime DateFetched { get;set; } public Post() { DateFetched = DateTime.Now; } } public class PostMapper : ClassMapper<Post> { public PostMapper() { Table("Post"); Map(m => m.Read).Ignore(); AutoMap(); } } }
using System; namespace gdRead.Data.Models { public class Post { public int Id { get; set; } public int FeedId { get; set; } public string Name { get; set; } public string Url { get; set; } public string Summary { get; set; } public string Content { get; set; } public DateTime PublishDate { get; set; } public bool Read { get; set; } public DateTime DateFetched { get;set; } public Post() { DateFetched = DateTime.Now; } } }
mit
C#
07d2eef8c83dff5fe5995b32899006455e74107e
Implement vmdstat
paralleltree/Scallion.Tools
vmdstat/Program.cs
vmdstat/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.IO; using NDesk.Options; using Scallion.Tools.Essentials; using Scallion.DomainModels; using Scallion.DomainModels.Components; namespace Scallion.Tools.VmdStat { class Program : Runner { public override string Description { get { return "モーションファイルの情報を表示します。"; } } public override string ArgumentFormat { get { return "[INPUT]..."; } } ExecutionParameter Parameter = new ExecutionParameter(); static void Main(string[] args) { Runner.Execute(() => new Program(args)); } private Program(string[] args) { var opt = new OptionSet() { { "?|h|help", "ヘルプを表示し、終了します。", _ => Parameter.ShowHelp = _ != null } }; var files = opt.Parse(args); if (Parameter.ShowHelp || files.Count == 0) { PrintHelp(opt); Environment.Exit(Parameter.ShowHelp ? 0 : 1); } Parameter.InputFiles = files; } public override void Run() { foreach (string path in Parameter.InputFiles) { var input = new Motion().Load(path); Console.WriteLine("{0}:", Path.GetFileName(path)); Console.WriteLine("モデル名: {0}", input.ModelName); Console.WriteLine("[ボーン]"); Console.WriteLine("ボーン数: {0}", input.Bones.Count); Console.WriteLine("IKボーン数: {0}", input.IKBones.Count()); input.Bones.SelectMany(p => p.KeyFrames).ToList().PrintKeyFrameStat(); Console.WriteLine("[モーフ]"); Console.WriteLine("モーフ数: {0}: ", input.Morphs.Count); input.Morphs.SelectMany(p => p.KeyFrames).ToList().PrintKeyFrameStat(); Console.WriteLine("[カメラ]"); input.Camera.KeyFrames.PrintKeyFrameStat(); Console.WriteLine("[照明]"); input.Light.KeyFrames.PrintKeyFrameStat(); Console.WriteLine("[セルフシャドウ]"); input.SelfShadow.KeyFrames.PrintKeyFrameStat(); Console.WriteLine("[表示]"); input.VisibilityKeyFrames.PrintKeyFrameStat(); Console.WriteLine(); } } } class ExecutionParameter { public bool ShowHelp { get; set; } public IEnumerable<string> InputFiles { get; set; } } static class Extensions { public static void PrintKeyFrameStat<T>(this List<T> src) where T : KeyFrame { Console.WriteLine("総キーフレーム数: {0}", src.Count); if (src.Count > 0) Console.WriteLine("最終インデックス: {0}", src.Max(q => q.KeyFrameIndex)); } } }
using System; using System.Collections.Generic; using System.Linq; namespace Scallion.Tools.VmdStat { class Program { static void Main(string[] args) { } } }
mit
C#
cb5c6e2531d47151884300c5dd3d46e139867042
Replace string[] field by IEnumerable<string> property
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/ManagedDialogs/ManagedFileChooserFilterViewModel.cs
WalletWasabi.Gui/ManagedDialogs/ManagedFileChooserFilterViewModel.cs
using System; using System.Collections.Generic; using System.Linq; using Avalonia.Controls; using WalletWasabi.Gui.ViewModels; namespace WalletWasabi.Gui.ManagedDialogs { internal class ManagedFileChooserFilterViewModel : ViewModelBase { private IEnumerable<string> Extensions { get; } public string Name { get; } public ManagedFileChooserFilterViewModel(FileDialogFilter filter) { Name = filter.Name; if (filter.Extensions.Contains("*")) { return; } Extensions = filter.Extensions?.Select(e => "." + e.ToLowerInvariant()); } public ManagedFileChooserFilterViewModel() { Name = "All files"; } public bool Match(string filename) { if (Extensions is null) { return true; } foreach (var ext in Extensions) { if (filename.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase)) { return true; } } return false; } public override string ToString() => Name; } }
using System; using System.Collections.Generic; using System.Linq; using Avalonia.Controls; using WalletWasabi.Gui.ViewModels; namespace WalletWasabi.Gui.ManagedDialogs { internal class ManagedFileChooserFilterViewModel : ViewModelBase { private readonly string[] Extensions; public string Name { get; } public ManagedFileChooserFilterViewModel(FileDialogFilter filter) { Name = filter.Name; if (filter.Extensions.Contains("*")) { return; } Extensions = filter.Extensions?.Select(e => "." + e.ToLowerInvariant()).ToArray(); } public ManagedFileChooserFilterViewModel() { Name = "All files"; } public bool Match(string filename) { if (Extensions is null) { return true; } foreach (var ext in Extensions) { if (filename.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase)) { return true; } } return false; } public override string ToString() => Name; } }
mit
C#
583134437b6dbabbc5f2e82ff984295d190ace1f
Update version number
ForkandBeard/Alferd-Spritesheet-Unpacker
ASU/Properties/AssemblyInfo.cs
ASU/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("ASU")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ASU")] [assembly: AssemblyCopyright("Copyright © www.forkandbeard.co.uk 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("e203a411-3418-4854-8dd6-feee98945489")] // 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("18.0.0.0")] [assembly: AssemblyFileVersion("18.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ASU")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ASU")] [assembly: AssemblyCopyright("Copyright © www.forkandbeard.co.uk 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("e203a411-3418-4854-8dd6-feee98945489")] // 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("17.0.0.0")] [assembly: AssemblyFileVersion("17.0.0.0")]
mit
C#
7f43f394355fbc84ed0b1001df9e46b16b70b72a
Add stars to favs
File-New-Project/EarTrumpet
EarTrumpet.Actions/ContextMenuAddon.cs
EarTrumpet.Actions/ContextMenuAddon.cs
using EarTrumpet.Extensibility; using EarTrumpet.UI.Helpers; using EarTrumpet.UI.ViewModels; using EarTrumpet_Actions.DataModel.Serialization; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; namespace EarTrumpet_Actions { [Export(typeof(IAddonContextMenu))] public class ContextMenuAddon : IAddonContextMenu { public IEnumerable<ContextMenuItem> Items { get { var ret = new List<ContextMenuItem>(); foreach (var item in Addon.Current.Actions.Where(a => a.Triggers.FirstOrDefault(ax => ax is ContextMenuTrigger) != null)) { ret.Add(new ContextMenuItem { Glyph = "\xE00A", IsChecked = true, DisplayName = item.DisplayName, Command = new RelayCommand(() => Addon.Current.TriggerAction(item)) }); } return ret; } } } }
using EarTrumpet.Extensibility; using EarTrumpet.UI.Helpers; using EarTrumpet.UI.ViewModels; using EarTrumpet_Actions.DataModel.Serialization; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; namespace EarTrumpet_Actions { [Export(typeof(IAddonContextMenu))] public class ContextMenuAddon : IAddonContextMenu { public IEnumerable<ContextMenuItem> Items { get { var ret = new List<ContextMenuItem>(); foreach (var item in Addon.Current.Actions.Where(a => a.Triggers.FirstOrDefault(ax => ax is ContextMenuTrigger) != null)) { ret.Add(new ContextMenuItem { DisplayName = item.DisplayName, Command = new RelayCommand(() => Addon.Current.TriggerAction(item)) }); } return ret; } } } }
mit
C#
e74a36d678f51d0c54531d4fbb35ba3755bea115
update s
autumn009/TanoCSharpSamples
Chap33/末尾以外の名前付き引数2/末尾以外の名前付き引数2/Program.cs
Chap33/末尾以外の名前付き引数2/末尾以外の名前付き引数2/Program.cs
using System; class Program { private static void sub(int n, string t) { Console.WriteLine("In sub(int n, string t)"); } private static void sub<T>(T s, string t) { Console.WriteLine("In sub<T>(T s, string t)"); } static void Main(string[] args) { int a = 0; sub(s: a, ""); sub(n: a, ""); } }
using System; class Program { private static void sub(int n, string t) { Console.WriteLine("In sub(int n, string t)"); } private static void sub<T>(T s, string t) { Console.WriteLine("sub<T>(T s, string t)"); } static void Main(string[] args) { int a = 0; sub(s: a, ""); sub(n: a, ""); } }
mit
C#
4f3045fb258c7cdc01d026a8548052140a0d55f7
Update AutofacPlatformCompositionRootSetupBase.cs
tiksn/TIKSN-Framework
TIKSN.Framework.Platform/DependencyInjection/AutofacPlatformCompositionRootSetupBase.cs
TIKSN.Framework.Platform/DependencyInjection/AutofacPlatformCompositionRootSetupBase.cs
using System.Collections.Generic; using System.Linq; using Autofac.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace TIKSN.DependencyInjection { public abstract class AutofacPlatformCompositionRootSetupBase : AutofacCompositionRootSetupBase { protected AutofacPlatformCompositionRootSetupBase(IConfigurationRoot configurationRoot) : base(configurationRoot) { } protected override IEnumerable<IModule> GetAutofacModules() { var modules = base.GetAutofacModules().ToList(); modules.Add(new PlatformModule()); return modules; } protected override void ConfigureServices(IServiceCollection services) => services.AddFrameworkPlatform(); } }
using System.Collections.Generic; using System.Linq; using Autofac.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace TIKSN.DependencyInjection { public abstract class AutofacPlatformCompositionRootSetupBase : AutofacCompositionRootSetupBase { protected AutofacPlatformCompositionRootSetupBase(IConfigurationRoot configurationRoot) : base(configurationRoot) { } protected override IEnumerable<IModule> GetAutofacModules() { var modules = base.GetAutofacModules().ToList(); modules.Add(new PlatformModule()); return modules; } protected override void ConfigureServices(IServiceCollection services) { services.AddFrameworkPlatform(); } } }
mit
C#
d4779f06cf1c2d8eae68d7d63583a3e34c629567
Rework `CloseStream`
smoogipooo/osu,smoogipoo/osu,peppy/osu-new,peppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu
osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs
osu.Game/IO/FileAbstraction/StreamFileAbstraction.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.IO; namespace osu.Game.IO.FileAbstraction { public class StreamFileAbstraction : TagLib.File.IFileAbstraction { public StreamFileAbstraction(string filename, Stream fileStream) { ReadStream = fileStream; Name = filename; } public string Name { get; } public Stream ReadStream { get; } public Stream WriteStream => ReadStream; public void CloseStream(Stream stream) { if (stream == null) throw new ArgumentNullException(nameof(stream)); stream.Close(); } } }
// 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.IO; namespace osu.Game.IO.FileAbstraction { public class StreamFileAbstraction : TagLib.File.IFileAbstraction { public StreamFileAbstraction(string filename, Stream fileStream) { ReadStream = fileStream; Name = filename; } public string Name { get; } public Stream ReadStream { get; } public Stream WriteStream => ReadStream; public void CloseStream(Stream aStream) { aStream.Position = 0; } } }
mit
C#
6249dcafcb66516940f21e95029f4ca9fc315737
Use a GetHashCode optimisation in ListSpecification
zvirja/AutoFixture,dcastro/AutoFixture,StevenJiang2015/AutoFixture,dlongest/AutoFixture,sergeyshushlyapin/AutoFixture,amarant/AutoFixture,sbrockway/AutoFixture,mrinaldi/AutoFixture,dcastro/AutoFixture,sergeyshushlyapin/AutoFixture,olegsych/AutoFixture,yuva2achieve/AutoFixture,adamchester/AutoFixture,hackle/AutoFixture,amarant/AutoFixture,AutoFixture/AutoFixture,sbrockway/AutoFixture,mrinaldi/AutoFixture,adamchester/AutoFixture,hackle/AutoFixture,Pvlerick/AutoFixture,dlongest/AutoFixture,sean-gilliam/AutoFixture,yuva2achieve/AutoFixture,StevenJiang2015/AutoFixture,olegsych/AutoFixture
Src/AutoFixture/Kernel/ListSpecification.cs
Src/AutoFixture/Kernel/ListSpecification.cs
using System; using System.Collections.Generic; namespace Ploeh.AutoFixture.Kernel { /// <summary> /// Encapsulates logic that determines whether a request is a request for a /// <see cref="List{T}"/>. /// </summary> public class ListSpecification : IRequestSpecification { /// <summary> /// Evaluates a request for a specimen to determine whether it's a request for a /// <see cref="List{T}"/>. /// </summary> /// <param name="request">The specimen request.</param> /// <returns> /// <see langword="true"/> if <paramref name="request"/> is a request for a /// <see cref="List{T}" />; otherwise, <see langword="false"/>. /// </returns> public bool IsSatisfiedBy(object request) { var type = request as Type; if (type == null) { return false; } if (type.IsGenericType) { var genType = type.GetGenericTypeDefinition(); if (genType.GetHashCode() != typeof (List<>).GetHashCode()) return false; return object.Equals(genType, typeof (List<>)); } return false; } } }
using System; using System.Collections.Generic; namespace Ploeh.AutoFixture.Kernel { /// <summary> /// Encapsulates logic that determines whether a request is a request for a /// <see cref="List{T}"/>. /// </summary> public class ListSpecification : IRequestSpecification { /// <summary> /// Evaluates a request for a specimen to determine whether it's a request for a /// <see cref="List{T}"/>. /// </summary> /// <param name="request">The specimen request.</param> /// <returns> /// <see langword="true"/> if <paramref name="request"/> is a request for a /// <see cref="List{T}" />; otherwise, <see langword="false"/>. /// </returns> public bool IsSatisfiedBy(object request) { var type = request as Type; if (type == null) { return false; } return type.IsGenericType && typeof(List<>) == type.GetGenericTypeDefinition(); } } }
mit
C#
131dcc7cc9cf2b5844e72f9846457443055ab878
Remove empty line.
moodmosaic/Fare
Src/Fare.IntegrationTests/AutomatonTests.cs
Src/Fare.IntegrationTests/AutomatonTests.cs
using Xunit; using Xunit.Extensions; namespace Fare.IntegrationTests { public sealed class AutomatonTests { [Theory] [InlineData("ab", "ab", "ab")] [InlineData("ab.*", "a.*", "abc")] public void StringMatchesBothRegexAutomaton(string pattern1, string pattern2, string matchingString) { var automaton1 = new RegExp(pattern1).ToAutomaton(); var automaton2 = new RegExp(pattern2).ToAutomaton(); var intersection = automaton1.Intersection(automaton2); Assert.True(intersection.Run(matchingString)); } [Theory] [InlineData(".*", "ab", "ac")] [InlineData("cab.*", "a.*", "abc")] public void StringDoesntMatchBothRegexAutomaton(string pattern1, string pattern2, string matchingString) { var automaton1 = new RegExp(pattern1).ToAutomaton(); var automaton2 = new RegExp(pattern2).ToAutomaton(); var intersection = automaton1.Intersection(automaton2); Assert.False(intersection.Run(matchingString)); } } }
using Xunit; using Xunit.Extensions; namespace Fare.IntegrationTests { public sealed class AutomatonTests { [Theory] [InlineData("ab", "ab", "ab")] [InlineData("ab.*", "a.*", "abc")] public void StringMatchesBothRegexAutomaton(string pattern1, string pattern2, string matchingString) { var automaton1 = new RegExp(pattern1).ToAutomaton(); var automaton2 = new RegExp(pattern2).ToAutomaton(); var intersection = automaton1.Intersection(automaton2); Assert.True(intersection.Run(matchingString)); } [Theory] [InlineData(".*", "ab", "ac")] [InlineData("cab.*", "a.*", "abc")] public void StringDoesntMatchBothRegexAutomaton(string pattern1, string pattern2, string matchingString) { var automaton1 = new RegExp(pattern1).ToAutomaton(); var automaton2 = new RegExp(pattern2).ToAutomaton(); var intersection = automaton1.Intersection(automaton2); Assert.False(intersection.Run(matchingString)); } } }
mit
C#
221f30d22ccb9720c90a56c857952917f149e9fb
Fix spamming broadcast
SAEnergy/Infrastructure,SAEnergy/Superstructure,SAEnergy/Infrastructure
Src/Server/Server.Hosts/ComponentService.cs
Src/Server/Server.Hosts/ComponentService.cs
using Core.Comm.BaseClasses; using Core.Interfaces.Components; using Core.Interfaces.Components.IoC; using Core.Interfaces.ServiceContracts; using Core.IoC.Container; using Core.Models.DataContracts; using Core.Util; using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.Text; using System.Threading.Tasks; namespace Server.Hosts { [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.PerSession)] public class ComponentService : ServiceHostBase<IComponentService, IComponentServiceCallback>, IComponentService { public ComponentService() { } public ComponentMetadata[] GetComponents() { return IoCContainer.Instance.Resolve<IComponentManager>().GetComponents(); } public void Start(int componentId) { var rc = IoCContainer.Instance.Resolve<IComponentManager>().StartComponent(componentId); UpdateAllUsers(rc); } public void Restart(int componentId) { var rc = IoCContainer.Instance.Resolve<IComponentManager>().RestartComponent(componentId); UpdateAllUsers(rc); } public void Stop(int componentId) { var rc = IoCContainer.Instance.Resolve<IComponentManager>().StopComponent(componentId); UpdateAllUsers(rc); } public void Disable(int componentId) { var rc = IoCContainer.Instance.Resolve<IComponentManager>().DisableComponent(componentId); UpdateAllUsers(rc); } #region Private Methods private void UpdateAllUsers(ComponentMetadata data) { if (data != null) { Broadcast((IComponentServiceCallback c) => c.ComponentUpdated(data)); } } #endregion } }
using Core.Comm.BaseClasses; using Core.Interfaces.Components; using Core.Interfaces.Components.IoC; using Core.Interfaces.ServiceContracts; using Core.IoC.Container; using Core.Models.DataContracts; using Core.Util; using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.Text; using System.Threading.Tasks; namespace Server.Hosts { [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.PerSession)] public class ComponentService : ServiceHostBase<IComponentService, IComponentServiceCallback>, IComponentService { public ComponentService() { } public ComponentMetadata[] GetComponents() { return IoCContainer.Instance.Resolve<IComponentManager>().GetComponents(); } public void Start(int componentId) { var rc = IoCContainer.Instance.Resolve<IComponentManager>().StartComponent(componentId); UpdateAllUsers(rc); } public void Restart(int componentId) { var rc = IoCContainer.Instance.Resolve<IComponentManager>().RestartComponent(componentId); UpdateAllUsers(rc); } public void Stop(int componentId) { var rc = IoCContainer.Instance.Resolve<IComponentManager>().StopComponent(componentId); UpdateAllUsers(rc); } public void Disable(int componentId) { var rc = IoCContainer.Instance.Resolve<IComponentManager>().DisableComponent(componentId); UpdateAllUsers(rc); } #region Private Methods private void UpdateAllUsers(ComponentMetadata data) { if (data != null) { lock (_instances) { foreach (var host in GetInstances<ComponentService>()) { host.Broadcast((IComponentServiceCallback c) => c.ComponentUpdated(data)); } } } } #endregion } }
mit
C#
e281b4b1aae2a1537cb5e550493d4df2fa210f22
Use default files
OzieGamma/beglobal.me
BeGlobal/Startup.cs
BeGlobal/Startup.cs
// <copyright company="Oswald MASKENS" file="Startup.cs"> // Copyright 2014-2016 Oswald MASKENS // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. // </copyright> using Microsoft.AspNet.Builder; using Microsoft.AspNet.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace BeGlobal { public class Startup { public Startup(IHostingEnvironment env) { // Set up configuration sources. var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json"); if (env.IsEnvironment("Development")) { // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately. builder.AddApplicationInsightsSettings(true); } builder.AddEnvironmentVariables(); this.Configuration = builder.Build().ReloadOnChanged("appsettings.json"); } public IConfigurationRoot Configuration { get; set; } // This method gets called by the runtime. Use this method to add services to the container public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddApplicationInsightsTelemetry(this.Configuration); services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(this.Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseIISPlatformHandler(); app.UseApplicationInsightsRequestTelemetry(); app.UseApplicationInsightsExceptionTelemetry(); app.UseStaticFiles(); app.UseDefaultFiles(); app.UseMvc(); } // Entry point for the application. public static void Main(string[] args) => WebApplication.Run<Startup>(args); } }
// <copyright company="Oswald MASKENS" file="Startup.cs"> // Copyright 2014-2016 Oswald MASKENS // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. // </copyright> using Microsoft.AspNet.Builder; using Microsoft.AspNet.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace BeGlobal { public class Startup { public Startup(IHostingEnvironment env) { // Set up configuration sources. var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json"); if (env.IsEnvironment("Development")) { // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately. builder.AddApplicationInsightsSettings(true); } builder.AddEnvironmentVariables(); this.Configuration = builder.Build().ReloadOnChanged("appsettings.json"); } public IConfigurationRoot Configuration { get; set; } // This method gets called by the runtime. Use this method to add services to the container public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddApplicationInsightsTelemetry(this.Configuration); services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(this.Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseIISPlatformHandler(); app.UseApplicationInsightsRequestTelemetry(); app.UseApplicationInsightsExceptionTelemetry(); app.UseStaticFiles(); app.UseMvc(); } // Entry point for the application. public static void Main(string[] args) => WebApplication.Run<Startup>(args); } }
apache-2.0
C#
3f3d7880e4557d726541bfc96033cd0d24c6d6d6
Fix tooltips;
KonH/UDBase
Scripts/Controllers/Log/LogSettings.cs
Scripts/Controllers/Log/LogSettings.cs
using System; using System.Collections.Generic; using UnityEngine; using Rotorz.Games.Reflection; namespace UDBase.Controllers.LogSystem { /// <summary> /// Node, which defined, need to show logs for specific context or not /// </summary> [Serializable] public class LogNode { /// <summary> /// Current log context /// </summary> [Tooltip("Current log context")] [ClassImplements(typeof(ILogContext))] public ClassTypeReference Context; /// <summary> /// Is logs enabled for current context? /// </summary> [Tooltip("Is logs enabled for current context?")] public bool Enabled; } /// <summary> /// Common log settings /// </summary> [Serializable] public class CommonLogSettings { /// <summary> /// Is logging for all contexts enabled by default? /// </summary> [Tooltip("Is logging for all contexts enabled by default?")] public bool EnabledByDefault = false; /// <summary> /// The contexts with specific enabled state /// </summary> [Tooltip("The contexts with specific enabled state")] public List<LogNode> Nodes = new List<LogNode>(); internal bool IsContextEnabled(ILogContext context) { var contextType = context.GetType(); foreach ( var node in Nodes ) { if ( node.Context == contextType ) { return node.Enabled; } } return EnabledByDefault; } } }
using System; using System.Collections.Generic; using UnityEngine; using Rotorz.Games.Reflection; namespace UDBase.Controllers.LogSystem { /// <summary> /// Node, which defined, need to show logs for specific context or not /// </summary> [Serializable] public class LogNode { /// <summary> /// Current log context /// </summary> [Header("Current log context")] [ClassImplements(typeof(ILogContext))] public ClassTypeReference Context; /// <summary> /// Is logs enabled for current context? /// </summary> [Header("Is logs enabled for current context?")] public bool Enabled; } /// <summary> /// Common log settings /// </summary> [Serializable] public class CommonLogSettings { /// <summary> /// Is logging for all contexts enabled by default? /// </summary> [Header("Is logging for all contexts enabled by default?")] public bool EnabledByDefault = false; /// <summary> /// The contexts with specific enabled state /// </summary> [Header("The contexts with specific enabled state")] public List<LogNode> Nodes = new List<LogNode>(); internal bool IsContextEnabled(ILogContext context) { var contextType = context.GetType(); foreach ( var node in Nodes ) { if ( node.Context == contextType ) { return node.Enabled; } } return EnabledByDefault; } } }
mit
C#
8b3a0d8e1317a87cf836122c4b7f69bd8883cad3
Fix MatterSlice engine path.
larsbrubaker/MatterControl,larsbrubaker/MatterControl,rytz/MatterControl,CodeMangler/MatterControl,mmoening/MatterControl,gregory-diaz/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,tellingmachine/MatterControl,ddpruitt/MatterControl,MatterHackers/MatterControl,mmoening/MatterControl,MatterHackers/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,rytz/MatterControl,ddpruitt/MatterControl,ddpruitt/MatterControl,jlewin/MatterControl,tellingmachine/MatterControl,CodeMangler/MatterControl,rytz/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,mmoening/MatterControl,MatterHackers/MatterControl,gregory-diaz/MatterControl,jlewin/MatterControl,CodeMangler/MatterControl
SlicerConfiguration/MatterSliceInfo.cs
SlicerConfiguration/MatterSliceInfo.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Threading; using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.Localizations; using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.PrinterCommunication; using MatterHackers.MatterControl.PrintQueue; using MatterHackers.Agg.PlatformAbstract; namespace MatterHackers.MatterControl.SlicerConfiguration { public class MatterSliceInfo : SliceEngineInfo { public MatterSliceInfo() : base(MatterSliceInfo.DisplayName) { } public static string DisplayName = "MatterSlice"; public override ActivePrinterProfile.SlicingEngineTypes GetSliceEngineType() { return ActivePrinterProfile.SlicingEngineTypes.MatterSlice; } public override bool Exists() { if (OsInformation.OperatingSystem == OSType.Android || OsInformation.OperatingSystem == OSType.Mac || SlicingQueue.runInProcess) { return true; } else { return System.IO.File.Exists(this.GetEnginePath()); } } protected override string getWindowsPath() { string materSliceRelativePath = Path.Combine(".", "MatterSlice.exe"); return Path.GetFullPath(materSliceRelativePath); } protected override string getMacPath() { string applicationPath = Path.Combine(ApplicationDataStorage.Instance.ApplicationPath, "MatterSlice"); return applicationPath; } protected override string getLinuxPath() { string materSliceRelativePath = Path.Combine(".", "MatterSlice.exe"); return Path.GetFullPath(materSliceRelativePath); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Threading; using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.Localizations; using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.PrinterCommunication; using MatterHackers.MatterControl.PrintQueue; using MatterHackers.Agg.PlatformAbstract; namespace MatterHackers.MatterControl.SlicerConfiguration { public class MatterSliceInfo : SliceEngineInfo { public MatterSliceInfo() : base(MatterSliceInfo.DisplayName) { } public static string DisplayName = "MatterSlice"; public override ActivePrinterProfile.SlicingEngineTypes GetSliceEngineType() { return ActivePrinterProfile.SlicingEngineTypes.MatterSlice; } public override bool Exists() { if (OsInformation.OperatingSystem == OSType.Android || OsInformation.OperatingSystem == OSType.Mac || SlicingQueue.runInProcess) { return System.IO.File.Exists(this.GetEnginePath()); } else { return true; } } protected override string getWindowsPath() { string materSliceRelativePath = Path.Combine(".", "MatterSlice.exe"); return Path.GetFullPath(materSliceRelativePath); } protected override string getMacPath() { string applicationPath = Path.Combine(ApplicationDataStorage.Instance.ApplicationPath, "MatterSlice"); return applicationPath; } protected override string getLinuxPath() { string materSliceRelativePath = Path.Combine(".", "MatterSlice.exe"); return Path.GetFullPath(materSliceRelativePath); } } }
bsd-2-clause
C#
fd5e22381721c72156c9ed2de2d1b4d3cae58072
Update cargo monitor
cmdrmcdonald/EliteDangerousDataProvider
CargoMonitor/CargoMonitor.cs
CargoMonitor/CargoMonitor.cs
using Eddi; using EddiDataDefinitions; using EddiEvents; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Controls; using Utilities; namespace EddiCargoMonitor { /// <summary> /// A monitor that keeps track of cargo /// </summary> public class CargoMonitor : EDDIMonitor { // The file to log cargo public static readonly string CargoFile = Constants.DATA_DIR + @"\cargo.json"; // The cargo private List<Cargo> cargo = new List<Cargo>(); public string MonitorName() { return "Cargo monitor"; } public string MonitorVersion() { return "1.0.0"; } public string MonitorDescription() { return "Tracks your cargo and provides information to speech responder scripts."; } public CargoMonitor() { ReadCargo(); Logging.Info("Initialised " + MonitorName() + " " + MonitorVersion()); } public void Start() { // We don't actively do anything, just listen to events, so nothing to do here } public void Stop() { } public void Reload() { ReadCargo(); } public UserControl ConfigurationTabItem() { return null; } public void Handle(Event @event) { Logging.Debug("Received event " + JsonConvert.SerializeObject(@event)); // Handle the events that we care about if (@event is CargoInventoryEvent) { handleCargoInventoryEvent((CargoInventoryEvent)@event); } } private void handleCargoInventoryEvent(CargoInventoryEvent @event) { } public IDictionary<string, object> GetVariables() { IDictionary<string, object> variables = new Dictionary<string, object>(); //variables["cargo"] = configuration.materials; return variables; } private void ReadCargo() { try { cargo = JsonConvert.DeserializeObject<List<Cargo>>(File.ReadAllText(CargoFile)); } catch (Exception ex) { Logging.Warn("Failed to read cargo", ex); } if (cargo == null) { cargo = new List<Cargo>(); } } private void WriteCargo() { try { File.WriteAllText(CargoFile, JsonConvert.SerializeObject(this, Formatting.Indented)); } catch (Exception ex) { Logging.Warn("Failed to write cargo", ex); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace EddiCargoMonitor { /// <summary> /// A monitor that keeps track of cargo /// </summary> public class CargoMonitor { } }
apache-2.0
C#
97c54de3bff4787aa8161b4a33dd53500dd3bfdc
Fix performance statistic not handling rulesets with unimplemented calculator
ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu
osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs
osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Scoring; namespace osu.Game.Screens.Ranking.Expanded.Statistics { public class PerformanceStatistic : StatisticDisplay { private readonly ScoreInfo score; private readonly Bindable<int> performance = new Bindable<int>(); private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); private RollingCounter<int> counter; public PerformanceStatistic(ScoreInfo score) : base("PP") { this.score = score; } [BackgroundDependencyLoader] private void load(ScorePerformanceCache performanceCache) { if (score.PP.HasValue) { setPerformanceValue(score.PP.Value); } else { performanceCache.CalculatePerformanceAsync(score, cancellationTokenSource.Token) .ContinueWith(t => Schedule(() => setPerformanceValue(t.GetResultSafely()?.Total)), cancellationTokenSource.Token); } } private void setPerformanceValue(double? pp) { if (pp.HasValue) performance.Value = (int)Math.Round(pp.Value, MidpointRounding.AwayFromZero); } public override void Appear() { base.Appear(); counter.Current.BindTo(performance); } protected override void Dispose(bool isDisposing) { cancellationTokenSource?.Cancel(); base.Dispose(isDisposing); } protected override Drawable CreateContent() => counter = new StatisticCounter { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre }; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Scoring; namespace osu.Game.Screens.Ranking.Expanded.Statistics { public class PerformanceStatistic : StatisticDisplay { private readonly ScoreInfo score; private readonly Bindable<int> performance = new Bindable<int>(); private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); private RollingCounter<int> counter; public PerformanceStatistic(ScoreInfo score) : base("PP") { this.score = score; } [BackgroundDependencyLoader] private void load(ScorePerformanceCache performanceCache) { if (score.PP.HasValue) { setPerformanceValue(score.PP.Value); } else { performanceCache.CalculatePerformanceAsync(score, cancellationTokenSource.Token) .ContinueWith(t => Schedule(() => setPerformanceValue(t.GetResultSafely().Total)), cancellationTokenSource.Token); } } private void setPerformanceValue(double? pp) { if (pp.HasValue) performance.Value = (int)Math.Round(pp.Value, MidpointRounding.AwayFromZero); } public override void Appear() { base.Appear(); counter.Current.BindTo(performance); } protected override void Dispose(bool isDisposing) { cancellationTokenSource?.Cancel(); base.Dispose(isDisposing); } protected override Drawable CreateContent() => counter = new StatisticCounter { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre }; } }
mit
C#
ac1ccb2d283fe494f98bbf217b0af5db3d183f8c
Fix about TraceSwitch
Seddryck/NBi,Seddryck/NBi
NBi.Core/Calculation/Grouping/AbstractByColumnGrouping.cs
NBi.Core/Calculation/Grouping/AbstractByColumnGrouping.cs
using NBi.Core.ResultSet; using NBi.Extensibility; using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NBi.Core.Calculation.Grouping { public abstract class AbstractByColumnGrouping : IByColumnGrouping { protected ISettingsResultSet Settings { get; } public AbstractByColumnGrouping(ISettingsResultSet settings) { Settings = settings; } public IDictionary<KeyCollection, DataTable> Execute(ResultSet.ResultSet resultSet) { var stopWatch = new Stopwatch(); var dico = new Dictionary<KeyCollection, DataTable>(); var keyComparer = BuildDataRowsKeyComparer(resultSet.Table); stopWatch.Start(); foreach (DataRow row in resultSet.Rows) { var key = keyComparer.GetKeys(row); if (!dico.ContainsKey(key)) dico.Add(key, row.Table.Clone()); dico[key].ImportRow(row); } Trace.WriteLineIf(NBiTraceSwitch.TraceInfo, string.Format("Building rows' groups: {0} [{1}]", dico.Count, stopWatch.Elapsed.ToString(@"d\d\.hh\h\:mm\m\:ss\s\ \+fff\m\s"))); return dico; } protected abstract DataRowKeysComparer BuildDataRowsKeyComparer(DataTable x); } }
using NBi.Core.ResultSet; using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NBi.Core.Calculation.Grouping { public abstract class AbstractByColumnGrouping : IByColumnGrouping { protected ISettingsResultSet Settings { get; } public AbstractByColumnGrouping(ISettingsResultSet settings) { Settings = settings; } public IDictionary<KeyCollection, DataTable> Execute(ResultSet.ResultSet resultSet) { var stopWatch = new Stopwatch(); var dico = new Dictionary<KeyCollection, DataTable>(); var keyComparer = BuildDataRowsKeyComparer(resultSet.Table); stopWatch.Start(); foreach (DataRow row in resultSet.Rows) { var key = keyComparer.GetKeys(row); if (!dico.ContainsKey(key)) dico.Add(key, row.Table.Clone()); dico[key].ImportRow(row); } Trace.WriteLineIf(NBiTraceSwitch.TraceInfo, string.Format("Building rows' groups: {0} [{1}]", dico.Count, stopWatch.Elapsed.ToString(@"d\d\.hh\h\:mm\m\:ss\s\ \+fff\m\s"))); return dico; } protected abstract DataRowKeysComparer BuildDataRowsKeyComparer(DataTable x); } }
apache-2.0
C#
a3570e38720fcf3a1890466656c1f136e53ac669
Use GitVersion for test app
ermshiperete/BuildDependency
Samples/BuildDependencyTestApp/Properties/AssemblyInfo.cs
Samples/BuildDependencyTestApp/Properties/AssemblyInfo.cs
// Copyright (c) 2015 Eberhard Beilharz // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("BuildDependencyTestApp")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("(c) 2014-2017 Eberhard Beilharz")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
// Copyright (c) 2015 Eberhard Beilharz // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("BuildDependencyTestApp")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("(c) 2014-2016 Eberhard Beilharz")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.0.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
mit
C#
fb1c18ae47fe5b05f4ddc824e89af2cd8c2944c0
Make KeyBinding explicitly take an InputKey in a ctor argument.
ppy/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework,Nabile-Rahmani/osu-framework,peppy/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,default0/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,Tom94/osu-framework,default0/osu-framework,peppy/osu-framework,DrabWeb/osu-framework
osu.Framework/Input/Bindings/KeyBinding.cs
osu.Framework/Input/Bindings/KeyBinding.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE namespace osu.Framework.Input.Bindings { /// <summary> /// A binding of a <see cref="Bindings.KeyCombination"/> to an action. /// </summary> public class KeyBinding { /// <summary> /// The combination of keys which will trigger this binding. /// </summary> public KeyCombination KeyCombination; /// <summary> /// The resultant action which is triggered by this binding. /// </summary> public object Action; /// <summary> /// Construct a new instance. /// </summary> /// <param name="keys">The combination of keys which will trigger this binding.</param> /// <param name="action">The resultant action which is triggered by this binding. Usually an enum type.</param> public KeyBinding(KeyCombination keys, object action) { KeyCombination = keys; Action = action; } public KeyBinding(InputKey key, object action) : this((KeyCombination)key, action) { } /// <summary> /// Constructor for derived classes that may require serialisation. /// </summary> public KeyBinding() { } /// <summary> /// Get the action associated with this binding, cast to the required enum type. /// </summary> /// <typeparam name="T">The enum type.</typeparam> /// <returns>A cast <see cref="T"/> representation of <see cref="Action"/>.</returns> public virtual T GetAction<T>() => (T)Action; public override string ToString() => $"{KeyCombination}=>{Action}"; } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE namespace osu.Framework.Input.Bindings { /// <summary> /// A binding of a <see cref="Bindings.KeyCombination"/> to an action. /// </summary> public class KeyBinding { /// <summary> /// The combination of keys which will trigger this binding. /// </summary> public KeyCombination KeyCombination; /// <summary> /// The resultant action which is triggered by this binding. /// </summary> public object Action; /// <summary> /// Construct a new instance. /// </summary> /// <param name="keys">The combination of keys which will trigger this binding.</param> /// <param name="action">The resultant action which is triggered by this binding. Usually an enum type.</param> public KeyBinding(KeyCombination keys, object action) { KeyCombination = keys; Action = action; } /// <summary> /// Constructor for derived classes that may require serialisation. /// </summary> public KeyBinding() { } /// <summary> /// Get the action associated with this binding, cast to the required enum type. /// </summary> /// <typeparam name="T">The enum type.</typeparam> /// <returns>A cast <see cref="T"/> representation of <see cref="Action"/>.</returns> public virtual T GetAction<T>() => (T)Action; public override string ToString() => $"{KeyCombination}=>{Action}"; } }
mit
C#
cc4070c76cbd5014672dae8664a15c2d802dd14f
Isolate headless runs' storage paths
DrabWeb/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,default0/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework,default0/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework,Tom94/osu-framework,peppy/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework
osu.Framework/Platform/HeadlessGameHost.cs
osu.Framework/Platform/HeadlessGameHost.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Collections.Generic; using osu.Framework.Input.Handlers; using osu.Framework.Timing; namespace osu.Framework.Platform { /// <summary> /// A GameHost which doesn't require a graphical or sound device. /// </summary> public class HeadlessGameHost : DesktopGameHost { private readonly IFrameBasedClock customClock; protected override IFrameBasedClock SceneGraphClock => customClock ?? base.SceneGraphClock; public HeadlessGameHost(string gameName = @"", bool bindIPC = false, bool realtime = true) : base(gameName, bindIPC) { if (!realtime) customClock = new FramedClock(new FastClock(1000.0 / 30)); UpdateThread.Scheduler.Update(); Dependencies.Cache(Storage = new DesktopStorage($"headless-{gameName}")); } protected override void UpdateInitialize() { } protected override void DrawInitialize() { } protected override void DrawFrame() { //we can't draw. } protected override void UpdateFrame() { customClock?.ProcessFrame(); base.UpdateFrame(); } protected override IEnumerable<InputHandler> CreateAvailableInputHandlers() => new InputHandler[] { }; private class FastClock : IClock { private readonly double increment; private double time; /// <summary> /// A clock which increments each time <see cref="CurrentTime"/> is requested. /// Run fast. Run consistent. /// </summary> /// <param name="increment">Milliseconds we should increment the clock by each time the time is requested.</param> public FastClock(double increment) { this.increment = increment; } public double CurrentTime => time += increment; public double Rate => 1; public bool IsRunning => true; } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Collections.Generic; using osu.Framework.Input.Handlers; using osu.Framework.Timing; namespace osu.Framework.Platform { /// <summary> /// A GameHost which doesn't require a graphical or sound device. /// </summary> public class HeadlessGameHost : DesktopGameHost { private readonly IFrameBasedClock customClock; protected override IFrameBasedClock SceneGraphClock => customClock ?? base.SceneGraphClock; public HeadlessGameHost(string gameName = @"", bool bindIPC = false, bool realtime = true) : base(gameName, bindIPC) { if (!realtime) customClock = new FramedClock(new FastClock(1000.0 / 30)); UpdateThread.Scheduler.Update(); Dependencies.Cache(Storage = new DesktopStorage(string.Empty)); } protected override void UpdateInitialize() { } protected override void DrawInitialize() { } protected override void DrawFrame() { //we can't draw. } protected override void UpdateFrame() { customClock?.ProcessFrame(); base.UpdateFrame(); } protected override IEnumerable<InputHandler> CreateAvailableInputHandlers() => new InputHandler[] { }; private class FastClock : IClock { private readonly double increment; private double time; /// <summary> /// A clock which increments each time <see cref="CurrentTime"/> is requested. /// Run fast. Run consistent. /// </summary> /// <param name="increment">Milliseconds we should increment the clock by each time the time is requested.</param> public FastClock(double increment) { this.increment = increment; } public double CurrentTime => time += increment; public double Rate => 1; public bool IsRunning => true; } } }
mit
C#
fdc316406900e733604dc6cb059d596ce670e30b
make Tempy work with dotnet 3
fxlv/tempy,fxlv/tempy,fxlv/tempy,fxlv/tempy
TempyAPI/Startup.cs
TempyAPI/Startup.cs
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Serilog; namespace TempyAPI { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); var cosmosDbAuthSettings = new TempyDbAuthCredentials(); Configuration.Bind("CosmosDbAuthSettings", cosmosDbAuthSettings); services.AddSingleton(cosmosDbAuthSettings); services.AddMvc(option => option.EnableEndpointRouting = false); // add a policy to allow CORS requests from any origins, // this will be used for remote Javascript to fetch TempyAPI data services.AddCors( o => o.AddPolicy("AllowAnyOriginPolicy", builder => builder.AllowAnyOrigin()) ); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseStaticFiles(); Log.Debug("Using development configuration."); } else { // TODO: Handle exceptions by displaying nice error pages for PROD app.UseExceptionHandler("/Error"); app.UseHsts(); app.UseHttpsRedirection(); Log.Debug("Using production configuration."); } app.UseMvc(); } } }
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Serilog; namespace TempyAPI { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); var cosmosDbAuthSettings = new TempyDbAuthCredentials(); Configuration.Bind("CosmosDbAuthSettings", cosmosDbAuthSettings); services.AddSingleton(cosmosDbAuthSettings); // add a policy to allow CORS requests from any origins, // this will be used for remote Javascript to fetch TempyAPI data services.AddCors( o => o.AddPolicy("AllowAnyOriginPolicy", builder => builder.AllowAnyOrigin()) ); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseStaticFiles(); Log.Debug("Using development configuration."); } else { // TODO: Handle exceptions by displaying nice error pages for PROD app.UseExceptionHandler("/Error"); app.UseHsts(); app.UseHttpsRedirection(); Log.Debug("Using production configuration."); } app.UseMvc(); } } }
isc
C#
0dd3abe13b99bc7a04e494ef8cdbb527a80d8c39
exclude filestream for storage pecker
ASOS/woodpecker
src/Woodpecker.Core/Sql/AzureSqlStorageSizePecker.cs
src/Woodpecker.Core/Sql/AzureSqlStorageSizePecker.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Woodpecker.Core.Sql { public class AzureSqlStorageSizePecker : AzureSqlDmvPeckerBase { private const string _query = @" select @@servername [collection_server_name] , db_name() [collection_database_name]      , getutcdate() [collection_time_utc]        , df.file_id  , df.type_desc [file_type_desc] , convert(bigint, df.size) *8 [size_kb] , convert(bigint, df.max_size) *8 [max_size_kb] from sys.database_files df where type_desc != 'filestream';"; protected override string GetQuery() { return _query; } protected override IEnumerable<string> GetRowKeyFieldNames() { return new[] { "collection_server_name", "collection_database_name", "file_id" }; } protected override string GetUtcTimestampFieldName() { return "collection_time_utc"; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Woodpecker.Core.Sql { public class AzureSqlStorageSizePecker : AzureSqlDmvPeckerBase { private const string _query = @" select @@servername [collection_server_name] , db_name() [collection_database_name]      , getutcdate() [collection_time_utc]        , df.file_id  , df.type_desc [file_type_desc] , convert(bigint, df.size) *8 [size_kb] , convert(bigint, df.max_size) *8 [max_size_kb] from sys.database_files df;"; protected override string GetQuery() { return _query; } protected override IEnumerable<string> GetRowKeyFieldNames() { return new[] { "collection_server_name", "collection_database_name", "file_id" }; } protected override string GetUtcTimestampFieldName() { return "collection_time_utc"; } } }
mit
C#
ccc3df7350961543543db8b4d6093f4d261dc746
fix demo
Newbe36524/Newbe.Mahua.Framework
src/Newbe.Mahua.Plugins.Parrot/MahuaEvents/PrivateMessageFromFriendReceivedMahuaEvent.cs
src/Newbe.Mahua.Plugins.Parrot/MahuaEvents/PrivateMessageFromFriendReceivedMahuaEvent.cs
using Newbe.Mahua.MahuaEvents; using System.Threading.Tasks; namespace Newbe.Mahua.Plugins.Parrot.MahuaEvents { /// <summary> /// 来自好友的私聊消息接收事件 /// </summary> public class PrivateMessageFromFriendReceivedMahuaEvent : IPrivateMessageFromFriendReceivedMahuaEvent { private readonly IMahuaApi _mahuaApi; public PrivateMessageFromFriendReceivedMahuaEvent( IMahuaApi mahuaApi) { _mahuaApi = mahuaApi; } public void ProcessFriendMessage(PrivateMessageFromFriendReceivedContext context) { // 戳一戳 _mahuaApi.SendPrivateMessage(context.FromQq) .Shake() .Done(); // 嘤嘤嘤 _mahuaApi.SendPrivateMessage(context.FromQq) .Text("嘤嘤嘤:") .Newline() .Text(context.Message) .Done(); // 将好友信息会发给好友 _mahuaApi.SendPrivateMessage(context.FromQq, context.Message); _mahuaApi.SendPrivateMessage(context.FromQq) .Image(@"D:\logo.png") .Done(); // 异步发送消息,不能使用 _mahuaApi 实例,需要另外开启Session Task.Factory.StartNew(() => { using (var robotSession = MahuaRobotManager.Instance.CreateSession()) { var api = robotSession.MahuaApi; api.SendPrivateMessage(context.FromQq, "异步的嘤嘤嘤"); } }); } } }
using Newbe.Mahua.MahuaEvents; namespace Newbe.Mahua.Plugins.Parrot.MahuaEvents { /// <summary> /// 来自好友的私聊消息接收事件 /// </summary> public class PrivateMessageFromFriendReceivedMahuaEvent : IPrivateMessageFromFriendReceivedMahuaEvent { private readonly IMahuaApi _mahuaApi; public PrivateMessageFromFriendReceivedMahuaEvent( IMahuaApi mahuaApi) { _mahuaApi = mahuaApi; } public void ProcessFriendMessage(PrivateMessageFromFriendReceivedContext context) { // 戳一戳 _mahuaApi.SendPrivateMessage(context.FromQq) .Shake() .Done(); // 嘤嘤嘤 _mahuaApi.SendPrivateMessage(context.FromQq) .Text("嘤嘤嘤:") .Newline() .Text(context.Message) .Done(); // 将好友信息会发给好友 _mahuaApi.SendPrivateMessage(context.FromQq, context.Message); _mahuaApi.SendPrivateMessage(context.FromQq) .Image(@"D:\logo.png") .Done(); } } }
mit
C#
d5ad683ac688ee9d852a8fd4ad9ae0434b82739e
Remove comment
AzureAutomationTeam/azure-powershell,hallihan/azure-powershell,dulems/azure-powershell,alfantp/azure-powershell,seanbamsft/azure-powershell,dominiqa/azure-powershell,Matt-Westphal/azure-powershell,AzureAutomationTeam/azure-powershell,praveennet/azure-powershell,yoavrubin/azure-powershell,devigned/azure-powershell,shuagarw/azure-powershell,DeepakRajendranMsft/azure-powershell,yadavbdev/azure-powershell,pomortaz/azure-powershell,rohmano/azure-powershell,devigned/azure-powershell,PashaPash/azure-powershell,chef-partners/azure-powershell,mayurid/azure-powershell,stankovski/azure-powershell,AzureAutomationTeam/azure-powershell,yadavbdev/azure-powershell,hungmai-msft/azure-powershell,chef-partners/azure-powershell,jasper-schneider/azure-powershell,hovsepm/azure-powershell,jianghaolu/azure-powershell,jianghaolu/azure-powershell,praveennet/azure-powershell,yantang-msft/azure-powershell,jtlibing/azure-powershell,hovsepm/azure-powershell,pelagos/azure-powershell,atpham256/azure-powershell,enavro/azure-powershell,CamSoper/azure-powershell,AzureRT/azure-powershell,devigned/azure-powershell,Matt-Westphal/azure-powershell,nemanja88/azure-powershell,chef-partners/azure-powershell,akurmi/azure-powershell,pankajsn/azure-powershell,kagamsft/azure-powershell,haocs/azure-powershell,naveedaz/azure-powershell,pankajsn/azure-powershell,TaraMeyer/azure-powershell,CamSoper/azure-powershell,akurmi/azure-powershell,kagamsft/azure-powershell,nemanja88/azure-powershell,zhencui/azure-powershell,TaraMeyer/azure-powershell,tonytang-microsoft-com/azure-powershell,yoavrubin/azure-powershell,dominiqa/azure-powershell,jasper-schneider/azure-powershell,arcadiahlyy/azure-powershell,ankurchoubeymsft/azure-powershell,SarahRogers/azure-powershell,stankovski/azure-powershell,hungmai-msft/azure-powershell,yantang-msft/azure-powershell,krkhan/azure-powershell,naveedaz/azure-powershell,ClogenyTechnologies/azure-powershell,atpham256/azure-powershell,DeepakRajendranMsft/azure-powershell,juvchan/azure-powershell,jtlibing/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,enavro/azure-powershell,CamSoper/azure-powershell,hallihan/azure-powershell,nickheppleston/azure-powershell,nickheppleston/azure-powershell,AzureAutomationTeam/azure-powershell,haocs/azure-powershell,seanbamsft/azure-powershell,TaraMeyer/azure-powershell,hungmai-msft/azure-powershell,atpham256/azure-powershell,rhencke/azure-powershell,seanbamsft/azure-powershell,naveedaz/azure-powershell,praveennet/azure-powershell,TaraMeyer/azure-powershell,yoavrubin/azure-powershell,juvchan/azure-powershell,shuagarw/azure-powershell,yoavrubin/azure-powershell,yantang-msft/azure-powershell,rhencke/azure-powershell,hallihan/azure-powershell,rohmano/azure-powershell,oaastest/azure-powershell,jasper-schneider/azure-powershell,atpham256/azure-powershell,yadavbdev/azure-powershell,alfantp/azure-powershell,SarahRogers/azure-powershell,devigned/azure-powershell,krkhan/azure-powershell,krkhan/azure-powershell,atpham256/azure-powershell,ailn/azure-powershell,hallihan/azure-powershell,naveedaz/azure-powershell,rohmano/azure-powershell,zaevans/azure-powershell,juvchan/azure-powershell,pelagos/azure-powershell,krkhan/azure-powershell,AzureRT/azure-powershell,rhencke/azure-powershell,arcadiahlyy/azure-powershell,oaastest/azure-powershell,jianghaolu/azure-powershell,TaraMeyer/azure-powershell,hallihan/azure-powershell,seanbamsft/azure-powershell,kagamsft/azure-powershell,hungmai-msft/azure-powershell,DeepakRajendranMsft/azure-powershell,DeepakRajendranMsft/azure-powershell,juvchan/azure-powershell,bgold09/azure-powershell,rhencke/azure-powershell,arcadiahlyy/azure-powershell,dominiqa/azure-powershell,pomortaz/azure-powershell,CamSoper/azure-powershell,hovsepm/azure-powershell,haocs/azure-powershell,tonytang-microsoft-com/azure-powershell,pelagos/azure-powershell,pomortaz/azure-powershell,enavro/azure-powershell,rohmano/azure-powershell,pankajsn/azure-powershell,nemanja88/azure-powershell,ClogenyTechnologies/azure-powershell,yantang-msft/azure-powershell,ailn/azure-powershell,ankurchoubeymsft/azure-powershell,arcadiahlyy/azure-powershell,nemanja88/azure-powershell,seanbamsft/azure-powershell,seanbamsft/azure-powershell,Matt-Westphal/azure-powershell,hovsepm/azure-powershell,ailn/azure-powershell,hovsepm/azure-powershell,mayurid/azure-powershell,PashaPash/azure-powershell,ankurchoubeymsft/azure-powershell,arcadiahlyy/azure-powershell,AzureRT/azure-powershell,PashaPash/azure-powershell,chef-partners/azure-powershell,ClogenyTechnologies/azure-powershell,mayurid/azure-powershell,DeepakRajendranMsft/azure-powershell,zhencui/azure-powershell,Matt-Westphal/azure-powershell,Matt-Westphal/azure-powershell,SarahRogers/azure-powershell,alfantp/azure-powershell,nickheppleston/azure-powershell,bgold09/azure-powershell,yantang-msft/azure-powershell,zhencui/azure-powershell,dulems/azure-powershell,zhencui/azure-powershell,jtlibing/azure-powershell,jianghaolu/azure-powershell,stankovski/azure-powershell,ankurchoubeymsft/azure-powershell,devigned/azure-powershell,dulems/azure-powershell,ankurchoubeymsft/azure-powershell,ailn/azure-powershell,kagamsft/azure-powershell,akurmi/azure-powershell,yoavrubin/azure-powershell,SarahRogers/azure-powershell,alfantp/azure-powershell,naveedaz/azure-powershell,shuagarw/azure-powershell,zaevans/azure-powershell,jtlibing/azure-powershell,AzureRT/azure-powershell,dominiqa/azure-powershell,akurmi/azure-powershell,bgold09/azure-powershell,AzureAutomationTeam/azure-powershell,krkhan/azure-powershell,PashaPash/azure-powershell,nickheppleston/azure-powershell,AzureRT/azure-powershell,jianghaolu/azure-powershell,tonytang-microsoft-com/azure-powershell,AzureRT/azure-powershell,kagamsft/azure-powershell,tonytang-microsoft-com/azure-powershell,enavro/azure-powershell,ClogenyTechnologies/azure-powershell,jtlibing/azure-powershell,jasper-schneider/azure-powershell,yantang-msft/azure-powershell,bgold09/azure-powershell,nemanja88/azure-powershell,oaastest/azure-powershell,jasper-schneider/azure-powershell,pankajsn/azure-powershell,stankovski/azure-powershell,hungmai-msft/azure-powershell,pankajsn/azure-powershell,pelagos/azure-powershell,oaastest/azure-powershell,haocs/azure-powershell,nickheppleston/azure-powershell,naveedaz/azure-powershell,dominiqa/azure-powershell,zaevans/azure-powershell,chef-partners/azure-powershell,akurmi/azure-powershell,dulems/azure-powershell,praveennet/azure-powershell,atpham256/azure-powershell,shuagarw/azure-powershell,hungmai-msft/azure-powershell,shuagarw/azure-powershell,pomortaz/azure-powershell,alfantp/azure-powershell,zhencui/azure-powershell,bgold09/azure-powershell,haocs/azure-powershell,pelagos/azure-powershell,zaevans/azure-powershell,devigned/azure-powershell,krkhan/azure-powershell,PashaPash/azure-powershell,stankovski/azure-powershell,pankajsn/azure-powershell,yadavbdev/azure-powershell,CamSoper/azure-powershell,praveennet/azure-powershell,SarahRogers/azure-powershell,zaevans/azure-powershell,dulems/azure-powershell,ailn/azure-powershell,tonytang-microsoft-com/azure-powershell,juvchan/azure-powershell,oaastest/azure-powershell,mayurid/azure-powershell,rohmano/azure-powershell,zhencui/azure-powershell,yadavbdev/azure-powershell,enavro/azure-powershell,rhencke/azure-powershell,mayurid/azure-powershell,pomortaz/azure-powershell,rohmano/azure-powershell
src/ResourceManager/Network/Commands.NetworkResourceProvider/Common/NetworkBaseClient.cs
src/ResourceManager/Network/Commands.NetworkResourceProvider/Common/NetworkBaseClient.cs
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.NetworkResourceProvider { public abstract class NetworkBaseClient : AzurePSCmdlet { public NetworkClient networkClient; public NetworkClient NetworkClient { get { if (networkClient == null) { networkClient = new NetworkClient(CurrentContext) { VerboseLogger = WriteVerboseWithTimestamp, ErrorLogger = WriteErrorWithTimestamp, WarningLogger = WriteWarningWithTimestamp }; } return networkClient; } set { networkClient = value; } } public override void ExecuteCmdlet() { base.ExecuteCmdlet(); NetworkResourceManagerProfile.Initialize(); } } }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.NetworkResourceProvider { public abstract class NetworkBaseClient : AzurePSCmdlet { //;protected static string NetworkCmdletPrefix public NetworkClient networkClient; public NetworkClient NetworkClient { get { if (networkClient == null) { networkClient = new NetworkClient(CurrentContext) { VerboseLogger = WriteVerboseWithTimestamp, ErrorLogger = WriteErrorWithTimestamp, WarningLogger = WriteWarningWithTimestamp }; } return networkClient; } set { networkClient = value; } } public override void ExecuteCmdlet() { base.ExecuteCmdlet(); NetworkResourceManagerProfile.Initialize(); } } }
apache-2.0
C#
30ebba15ae251a89c8ae0330738d0a1897076759
add some more Utility methods
mans0954/f-spot,Yetangitu/f-spot,Sanva/f-spot,mans0954/f-spot,nathansamson/F-Spot-Album-Exporter,mono/f-spot,GNOME/f-spot,Sanva/f-spot,Sanva/f-spot,Yetangitu/f-spot,GNOME/f-spot,Yetangitu/f-spot,mans0954/f-spot,dkoeb/f-spot,NguyenMatthieu/f-spot,GNOME/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,mans0954/f-spot,dkoeb/f-spot,mono/f-spot,mono/f-spot,nathansamson/F-Spot-Album-Exporter,mans0954/f-spot,mans0954/f-spot,dkoeb/f-spot,dkoeb/f-spot,NguyenMatthieu/f-spot,Yetangitu/f-spot,nathansamson/F-Spot-Album-Exporter,dkoeb/f-spot,GNOME/f-spot,NguyenMatthieu/f-spot,mono/f-spot,dkoeb/f-spot,nathansamson/F-Spot-Album-Exporter,Sanva/f-spot,mono/f-spot,GNOME/f-spot,Yetangitu/f-spot,NguyenMatthieu/f-spot,mono/f-spot
src/Widgets/GdkUtils.cs
src/Widgets/GdkUtils.cs
using System; using Gdk; using System.Runtime.InteropServices; namespace FSpot.Widgets { public class GdkUtils { [DllImport("libgdk-2.0-0.dll")] static extern uint gdk_x11_drawable_get_xid (IntPtr d); [DllImport("libgdk-2.0-0.dll")] static extern IntPtr gdk_x11_display_get_xdisplay (IntPtr d); [DllImport("libgdk-2.0-0.dll")] static extern IntPtr gdk_x11_visual_get_xvisual (IntPtr d); [DllImport("X11")] internal static extern uint XVisualIDFromVisual(IntPtr visual); [DllImport("libgdk-2.0-0.dll")] static extern IntPtr gdk_x11_screen_lookup_visual (IntPtr screen, uint xvisualid); public static uint GetXid (Drawable d) { return gdk_x11_drawable_get_xid (d.Handle); } public static uint GetXVisualId (Visual visual) { return XVisualIDFromVisual (GetXVisual (visual)); } public static IntPtr GetXDisplay (Display display) { return gdk_x11_display_get_xdisplay (display.Handle); } public static IntPtr GetXVisual (Visual v) { return gdk_x11_visual_get_xvisual (v.Handle); } public static Visual LookupVisual (Screen screen, uint visualid) { return (Gdk.Visual) GLib.Object.GetObject (gdk_x11_screen_lookup_visual (screen.Handle, visualid)); } } }
using System; using Gdk; using System.Runtime.InteropServices; namespace FSpot.Widgets { public class GdkUtils { [DllImport("libgdk-2.0-0.dll")] static extern uint gdk_x11_drawable_get_xid (IntPtr d); [DllImport("libgdk-2.0-0.dll")] static extern IntPtr gdk_x11_display_get_xdisplay (IntPtr d); [DllImport("libgdk-2.0-0.dll")] static extern IntPtr gdk_x11_visual_get_xvisual (IntPtr d); [DllImport("X11")] internal static extern uint XVisualIDFromVisual(IntPtr visual); public static uint GetXid (Drawable d) { return gdk_x11_drawable_get_xid (d.Handle); } public static uint GetXVisualId (Visual visual) { return XVisualIDFromVisual (GetXVisual (visual)); } public static IntPtr GetXDisplay (Display display) { return gdk_x11_display_get_xdisplay (display.Handle); } public static IntPtr GetXVisual (Visual v) { return gdk_x11_visual_get_xvisual (v.Handle); } } }
mit
C#
c5105782c0b9688bf16f696751cd6c59ba30affd
Add TODOs to the monitor tool
arfbtwn/dbus-sharp,openmedicus/dbus-sharp,arfbtwn/dbus-sharp,mono/dbus-sharp,Tragetaschen/dbus-sharp,openmedicus/dbus-sharp,Tragetaschen/dbus-sharp,mono/dbus-sharp
src/Monitor.cs
src/Monitor.cs
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Collections.Generic; using NDesk.DBus; using org.freedesktop.DBus; public class ManagedDBusTest { public static void Main (string[] args) { //TODO: allow selection of bus if (args.Length == 1) { string arg = args[1]; switch (arg) { case "--system": break; case "--session": break; default: break; } } Connection conn = new Connection (); ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); string name = "org.freedesktop.DBus"; Bus bus = conn.GetObject<Bus> (name, opath); bus.NameAcquired += delegate (string acquired_name) { Console.WriteLine ("NameAcquired: " + acquired_name); }; bus.Hello (); //hack to process the NameAcquired signal synchronously conn.HandleSignal (conn.ReadMessage ()); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error)); while (true) { Message msg = conn.ReadMessage (); Console.WriteLine ("Message:"); Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType); //foreach (HeaderField hf in msg.HeaderFields) // Console.WriteLine ("\t" + hf.Code + ": " + hf.Value); foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields) Console.WriteLine ("\t" + field.Key + ": " + field.Value); if (msg.Body != null) { Console.WriteLine ("\tBody:"); //System.IO.MemoryStream ms = new System.IO.MemoryStream (msg.Body); //System.IO.MemoryStream ms = msg.Body; //TODO: this needs to be done more intelligently foreach (DType dtype in msg.Signature.Data) { if (dtype == DType.Invalid) continue; object arg; Message.GetValue (msg.Body, dtype, out arg); Console.WriteLine ("\t\t" + dtype + ": " + arg); } } Console.WriteLine (); } } }
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Collections.Generic; using NDesk.DBus; using org.freedesktop.DBus; public class ManagedDBusTest { public static void Main () { Connection conn = new Connection (); ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); string name = "org.freedesktop.DBus"; Bus bus = conn.GetObject<Bus> (name, opath); bus.NameAcquired += delegate (string acquired_name) { Console.WriteLine ("NameAcquired: " + acquired_name); }; bus.Hello (); //hack to process the NameAcquired signal synchronously conn.HandleSignal (conn.ReadMessage ()); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error)); while (true) { Message msg = conn.ReadMessage (); Console.WriteLine ("Message:"); Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType); //foreach (HeaderField hf in msg.HeaderFields) // Console.WriteLine ("\t" + hf.Code + ": " + hf.Value); foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields) Console.WriteLine ("\t" + field.Key + ": " + field.Value); if (msg.Body != null) { Console.WriteLine ("\tBody:"); //System.IO.MemoryStream ms = new System.IO.MemoryStream (msg.Body); //System.IO.MemoryStream ms = msg.Body; foreach (DType dtype in msg.Signature.Data) { if (dtype == DType.Invalid) continue; object arg; Message.GetValue (msg.Body, dtype, out arg); Console.WriteLine ("\t\t" + dtype + ": " + arg); } } Console.WriteLine (); } } }
mit
C#
71ff31ee80261568a75c734a4b8f0127aec38abb
Bump version to 0.30.9
github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity
common/SolutionInfo.cs
common/SolutionInfo.cs
#pragma warning disable 436 using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyProduct("GitHub for Unity")] [assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)] [assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)] [assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)] [assembly: ComVisible(false)] [assembly: AssemblyCompany("GitHub, Inc.")] [assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)] //Required for NSubstitute [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)] //Required for Unity compilation [assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)] namespace System { internal static class AssemblyVersionInformation { internal const string Version = "0.30.9"; } }
#pragma warning disable 436 using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyProduct("GitHub for Unity")] [assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)] [assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)] [assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)] [assembly: ComVisible(false)] [assembly: AssemblyCompany("GitHub, Inc.")] [assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)] //Required for NSubstitute [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)] //Required for Unity compilation [assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)] namespace System { internal static class AssemblyVersionInformation { internal const string Version = "0.30.8"; } }
mit
C#
e1e5708c8781991c3337a4d8de12581a96f95d5d
make the enum private, force the first item to 0
mono/f-spot,Sanva/f-spot,mono/f-spot,nathansamson/F-Spot-Album-Exporter,dkoeb/f-spot,mans0954/f-spot,mans0954/f-spot,GNOME/f-spot,mans0954/f-spot,GNOME/f-spot,dkoeb/f-spot,GNOME/f-spot,GNOME/f-spot,nathansamson/F-Spot-Album-Exporter,mans0954/f-spot,Yetangitu/f-spot,dkoeb/f-spot,mans0954/f-spot,mono/f-spot,dkoeb/f-spot,Sanva/f-spot,NguyenMatthieu/f-spot,dkoeb/f-spot,nathansamson/F-Spot-Album-Exporter,dkoeb/f-spot,mono/f-spot,GNOME/f-spot,Yetangitu/f-spot,Yetangitu/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,mans0954/f-spot,Sanva/f-spot,Yetangitu/f-spot,mono/f-spot,Sanva/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,Yetangitu/f-spot,mono/f-spot,nathansamson/F-Spot-Album-Exporter
src/DragDropTargets.cs
src/DragDropTargets.cs
/* * FSpot.Gui.DragDropTargets.cs * * Author(s) * Mike Gemuende <mike@gemuende.de> * * This is free software. See COPYING for details. */ using System; using Gtk; namespace FSpot.Gui { public static class DragDropTargets { enum TargetType { PlainText = 0, UriList, TagList, TagQueryItem, UriQueryItem, PhotoList, RootWindow }; public static readonly TargetEntry PlainTextEntry = new TargetEntry ("text/plain", 0, (uint) TargetType.PhotoList); public static readonly TargetEntry PhotoListEntry = new TargetEntry ("application/x-fspot-photos", 0, (uint) TargetType.PhotoList); public static readonly TargetEntry UriListEntry = new TargetEntry ("text/uri-list", 0, (uint) TargetType.UriList); public static readonly TargetEntry TagListEntry = new TargetEntry ("application/x-fspot-tags", 0, (uint) TargetType.TagList); /* FIXME: maybe we need just one fspot-query-item */ public static readonly TargetEntry UriQueryEntry = new TargetEntry ("application/x-fspot-uri-query-item", 0, (uint) TargetType.UriQueryItem); public static readonly TargetEntry TagQueryEntry = new TargetEntry ("application/x-fspot-tag-query-item", 0, (uint) TargetType.TagQueryItem); public static readonly TargetEntry RootWindowEntry = new TargetEntry ("application/x-root-window-drop", 0, (uint) TargetType.RootWindow); } }
/* * DragDropTargets.cs * * Author(s) * Mike Gemuende <mike@gemuende.de> * * This is free software. See COPYING for details. */ using System; using Gtk; namespace FSpot.Gui { public static class DragDropTargets { public enum TargetType { PlainText, UriList, TagList, TagQueryItem, UriQueryItem, PhotoList, RootWindow }; public static readonly TargetEntry PlainTextEntry = new TargetEntry ("text/plain", 0, (uint) TargetType.PhotoList); public static readonly TargetEntry PhotoListEntry = new TargetEntry ("application/x-fspot-photos", 0, (uint) TargetType.PhotoList); public static readonly TargetEntry UriListEntry = new TargetEntry ("text/uri-list", 0, (uint) TargetType.UriList); public static readonly TargetEntry TagListEntry = new TargetEntry ("application/x-fspot-tags", 0, (uint) TargetType.TagList); /* FIXME: maybe we need just one fspot-query-item */ public static readonly TargetEntry UriQueryEntry = new TargetEntry ("application/x-fspot-uri-query-item", 0, (uint) TargetType.UriQueryItem); public static readonly TargetEntry TagQueryEntry = new TargetEntry ("application/x-fspot-tag-query-item", 0, (uint) TargetType.TagQueryItem); public static readonly TargetEntry RootWindowEntry = new TargetEntry ("application/x-root-window-drop", 0, (uint) TargetType.RootWindow); } }
mit
C#
0fccd7d45f4e7df78a355443b0197f242e76cc23
Remove unused `using` directive.
fixie/fixie
src/Fixie/TestClass.cs
src/Fixie/TestClass.cs
namespace Fixie { using System; using System.Reflection; using System.Runtime.ExceptionServices; /// <summary> /// The context in which a test class is running. /// </summary> public class TestClass { readonly Action<Action<Case>> runCases; readonly bool isStatic; internal TestClass(Type type, Action<Action<Case>> runCases) : this(type, runCases, null) { } internal TestClass(Type type, Action<Action<Case>> runCases, MethodInfo targetMethod) { this.runCases = runCases; Type = type; TargetMethod = targetMethod; isStatic = Type.IsStatic(); } /// <summary> /// The test class to execute. /// </summary> public Type Type { get; } /// <summary> /// Gets the target MethodInfo identified by the /// test runner as the sole method to be executed. /// Null under normal test execution. /// </summary> public MethodInfo TargetMethod { get; } /// <summary> /// Constructs an instance of the test class type, using its default constructor. /// If the class is static, no action is taken and null is returned. /// </summary> public object Construct() { if (isStatic) return null; try { return Activator.CreateInstance(Type); } catch (TargetInvocationException exception) { ExceptionDispatchInfo.Capture(exception.InnerException).Throw(); throw; //Unreachable. } } public void RunCases(Action<Case> caseLifecycle) { runCases(caseLifecycle); } } }
namespace Fixie { using System; using System.Reflection; using System.Runtime.ExceptionServices; using Internal; /// <summary> /// The context in which a test class is running. /// </summary> public class TestClass { readonly Action<Action<Case>> runCases; readonly bool isStatic; internal TestClass(Type type, Action<Action<Case>> runCases) : this(type, runCases, null) { } internal TestClass(Type type, Action<Action<Case>> runCases, MethodInfo targetMethod) { this.runCases = runCases; Type = type; TargetMethod = targetMethod; isStatic = Type.IsStatic(); } /// <summary> /// The test class to execute. /// </summary> public Type Type { get; } /// <summary> /// Gets the target MethodInfo identified by the /// test runner as the sole method to be executed. /// Null under normal test execution. /// </summary> public MethodInfo TargetMethod { get; } /// <summary> /// Constructs an instance of the test class type, using its default constructor. /// If the class is static, no action is taken and null is returned. /// </summary> public object Construct() { if (isStatic) return null; try { return Activator.CreateInstance(Type); } catch (TargetInvocationException exception) { ExceptionDispatchInfo.Capture(exception.InnerException).Throw(); throw; //Unreachable. } } public void RunCases(Action<Case> caseLifecycle) { runCases(caseLifecycle); } } }
mit
C#
8d040b87b7449b5c46e4930a16a1c8b2a35405ae
Update AssemblyInfo.cs
IMS-GmbH/win32setupapi-cswrapper
trunk/Win32SetupApiNative/Properties/AssemblyInfo.cs
trunk/Win32SetupApiNative/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Win32SetupApiNative")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Win32SetupApiNative")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("f16a135d-68af-4010-95d8-5fc70f713a48")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Win32SetupApiNative")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Win32SetupApiNative")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("f16a135d-68af-4010-95d8-5fc70f713a48")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
bsd-3-clause
C#
6a703b1c1bc638c4dcb856d5e306dff13579974f
Add Empty.XXX<T>
yufeih/Common
src/CommonTasks.cs
src/CommonTasks.cs
namespace System.Threading.Tasks { using System.Collections.Generic; using System.IO; using System.Linq; static class CommonTasks { public static readonly Task Completed = Task.FromResult(true); public static readonly Task<bool> True = Task.FromResult(true); public static readonly Task<bool> False = Task.FromResult(false); public static readonly Task<string> NullString = Task.FromResult<string>(null); public static readonly Task<string> EmptyString = Task.FromResult(""); public static readonly Task<Stream> NullStream = Task.FromResult<Stream>(null); public static Task<T> Null<T>() where T : class => Nulls<T>.Value; public static Task<T> Default<T>() => Defaults<T>.Value; public static Task<IEnumerable<T>> Empty<T>() => Emptys<T>.Value; public static Task<T[]> EmptyArray<T>() => EmptyArrays<T>.Value; class Defaults<T> { public static readonly Task<T> Value = Task.FromResult(default(T)); } class Nulls<T> where T : class { public static readonly Task<T> Value = Task.FromResult<T>(null); } class Emptys<T> { public static readonly Task<IEnumerable<T>> Value = Task.FromResult(Enumerable.Empty<T>()); } class EmptyArrays<T> { public static readonly Task<T[]> Value = Task.FromResult(new T[0]); } public static void Go(this Task task) { } } static class Empty { public static Array<T> => Backing<T>.Array; public static List<T> => Backing<T>.List; public static Dictionary<TKey, TValue> => Backing<TKey, TValue>.Dictionary; class Backing<T> { public static readonly T[] Array = new T[0]; public static readonly List<T> List = new List<T>(0); } class Backing<T1, T2> { public static readonly Dictionary<T1, T2> Dictionary = new Dictionary<T1, T2>(0); } } }
namespace System.Threading.Tasks { using System.Collections.Generic; using System.IO; using System.Linq; static class CommonTasks { public static readonly Task Completed = Task.FromResult(true); public static readonly Task<bool> True = Task.FromResult(true); public static readonly Task<bool> False = Task.FromResult(false); public static readonly Task<string> NullString = Task.FromResult<string>(null); public static readonly Task<string> EmptyString = Task.FromResult(""); public static readonly Task<Stream> NullStream = Task.FromResult<Stream>(null); public static Task<T> Null<T>() where T : class => Nulls<T>.Value; public static Task<T> Default<T>() => Defaults<T>.Value; public static Task<IEnumerable<T>> Empty<T>() => Emptys<T>.Value; public static Task<T[]> EmptyArray<T>() => EmptyArrays<T>.Value; class Defaults<T> { public static readonly Task<T> Value = Task.FromResult(default(T)); } class Nulls<T> where T : class { public static readonly Task<T> Value = Task.FromResult<T>(null); } class Emptys<T> { public static readonly Task<IEnumerable<T>> Value = Task.FromResult(Enumerable.Empty<T>()); } class EmptyArrays<T> { public static readonly Task<T[]> Value = Task.FromResult(new T[0]); } public static void Go(this Task task) { } } }
mit
C#
16634e524afea4edfba7eb8330b3da9ed332541e
Remove Drawable[][] implicit operator
EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework
osu.Framework/Graphics/Containers/GridContainerContent.cs
osu.Framework/Graphics/Containers/GridContainerContent.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Lists; namespace osu.Framework.Graphics.Containers { /// <summary> /// A wrapper that provides access to the <see cref="GridContainer.Content"/> with element change notifications. /// </summary> public class GridContainerContent : ObservableArray<ObservableArray<Drawable>> { private readonly Drawable[][] source; public static implicit operator GridContainerContent(Drawable[][] drawables) { if (drawables == null) return null; return new GridContainerContent(drawables); } private GridContainerContent(Drawable[][] drawables) : base(new ObservableArray<Drawable>[drawables.Length]) { source = drawables; for (int i = 0; i < drawables.Length; i++) { if (drawables[i] != null) { var observableArray = new ObservableArray<Drawable>(drawables[i]); this[i] = observableArray; observableArray.ArrayElementChanged += OnArrayElementChanged; } } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Lists; namespace osu.Framework.Graphics.Containers { /// <summary> /// A wrapper that provides access to the <see cref="GridContainer.Content"/> with element change notifications. /// </summary> public class GridContainerContent : ObservableArray<ObservableArray<Drawable>> { private readonly Drawable[][] source; public static implicit operator Drawable[][](GridContainerContent content) => content.source; public static implicit operator GridContainerContent(Drawable[][] drawables) { if (drawables == null) return null; return new GridContainerContent(drawables); } private GridContainerContent(Drawable[][] drawables) : base(new ObservableArray<Drawable>[drawables.Length]) { source = drawables; for (int i = 0; i < drawables.Length; i++) { if (drawables[i] != null) { var observableArray = new ObservableArray<Drawable>(drawables[i]); this[i] = observableArray; observableArray.ArrayElementChanged += OnArrayElementChanged; } } } } }
mit
C#
3feaaa3e4da9c688fd5f4c89bae004c8468db549
Use FillMode.Fit for icons
smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,2yangk23/osu,peppy/osu,smoogipoo/osu,johnneijzen/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,smoogipooo/osu,EVAST9919/osu,UselessToucan/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu-new,EVAST9919/osu,2yangk23/osu,ppy/osu,NeoAdonis/osu,ppy/osu,ppy/osu
osu.Game/Graphics/UserInterface/ScreenTitleTextureIcon.cs
osu.Game/Graphics/UserInterface/ScreenTitleTextureIcon.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osuTK; namespace osu.Game.Graphics.UserInterface { /// <summary> /// A custom icon class for use with <see cref="ScreenTitle.CreateIcon()"/> based off a texture resource. /// </summary> public class ScreenTitleTextureIcon : CompositeDrawable { private readonly string textureName; public ScreenTitleTextureIcon(string textureName) { this.textureName = textureName; } [BackgroundDependencyLoader] private void load(TextureStore textures) { Size = new Vector2(ScreenTitle.ICON_SIZE); InternalChild = new Sprite { RelativeSizeAxes = Axes.Both, Texture = textures.Get(textureName), Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fit }; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osuTK; namespace osu.Game.Graphics.UserInterface { /// <summary> /// A custom icon class for use with <see cref="ScreenTitle.CreateIcon()"/> based off a texture resource. /// </summary> public class ScreenTitleTextureIcon : CompositeDrawable { private readonly string textureName; public ScreenTitleTextureIcon(string textureName) { this.textureName = textureName; } [BackgroundDependencyLoader] private void load(TextureStore textures) { Size = new Vector2(ScreenTitle.ICON_SIZE); InternalChild = new Sprite { RelativeSizeAxes = Axes.Both, Texture = textures.Get(textureName), Anchor = Anchor.Centre, Origin = Anchor.Centre, }; } } }
mit
C#
822a2f6d0a59bf3f8e432d3a938ce9512549ae6e
comment out non-functioning code
2nd47/GameJam-2
Assets/Scripts/BouncyCollider.cs
Assets/Scripts/BouncyCollider.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class BouncyCollider : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } void OnTriggerEnter (Collider other) { Vector3 bounceDir = Vector3.Reflect (other.transform.position, this.transform.position); //other.AddForce (); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class BouncyCollider : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } void OnTriggerEnter (Collider other) { Vector3 bounceDir = Vector3.Reflect (other.transform.position, this.transform.position); } }
mit
C#
a0615f783198662c2d61f0312994dca48909e3fe
Simplify if directives
thedoritos/unimgpicker,thedoritos/unimgpicker,thedoritos/unimgpicker
Assets/Unimgpicker/Scripts/Unimgpicker.cs
Assets/Unimgpicker/Scripts/Unimgpicker.cs
using System; using UnityEngine; namespace Kakera { public class Unimgpicker : MonoBehaviour { public delegate void ImageDelegate(string path); public delegate void ErrorDelegate(string message); public event ImageDelegate Completed; public event ErrorDelegate Failed; private IPicker picker = #if UNITY_EDITOR new Picker_editor(); #elif UNITY_IOS new PickeriOS(); #elif UNITY_ANDROID new PickerAndroid(); #else new PickerUnsupported(); #endif [Obsolete("Resizing is deprecated. Use Show(title, outputFileName)")] public void Show(string title, string outputFileName, int maxSize) { Show(title, outputFileName); } public void Show(string title, string outputFileName) { picker.Show(title, outputFileName); } private void OnComplete(string path) { var handler = Completed; if (handler != null) { handler(path); } } private void OnFailure(string message) { var handler = Failed; if (handler != null) { handler(message); } } } }
using System; using UnityEngine; namespace Kakera { public class Unimgpicker : MonoBehaviour { public delegate void ImageDelegate(string path); public delegate void ErrorDelegate(string message); public event ImageDelegate Completed; public event ErrorDelegate Failed; private IPicker picker = #if UNITY_IOS && !UNITY_EDITOR new PickeriOS(); #elif UNITY_ANDROID && !UNITY_EDITOR new PickerAndroid(); #elif UNITY_EDITOR_OSX || UNITY_EDITOR_WIN new Picker_editor(); #else new PickerUnsupported(); #endif [Obsolete("Resizing is deprecated. Use Show(title, outputFileName)")] public void Show(string title, string outputFileName, int maxSize) { Show(title, outputFileName); } public void Show(string title, string outputFileName) { picker.Show(title, outputFileName); } private void OnComplete(string path) { var handler = Completed; if (handler != null) { handler(path); } } private void OnFailure(string message) { var handler = Failed; if (handler != null) { handler(message); } } } }
mit
C#
b9d73cd1ea8b4667c77a90707d56f9ffa001512f
Sort lobby queue servers
paralin/D2Moddin
D2MPMaster/Server/ServerService.cs
D2MPMaster/Server/ServerService.cs
using System.Linq; using D2MPMaster.Lobbies; using D2MPMaster.Server; using d2mpserver; using XSockets.Core.XSocket.Helpers; namespace D2MPMaster { public static class ServerManager { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly ServerController Servers = new ServerController(); public static ServerController FindForLobby(Lobby lobby) { //Params ServerRegion region = lobby.region; ServerController server = null; var available = Servers.Find(m => m.Inited && m.Instances.Count < m.InitData.serverCount).OrderBy(m=>m.Instances.Count); if (region == ServerRegion.UNKNOWN) { return available.FirstOrDefault(); } return available.FirstOrDefault(m=>(int)m.InitData.region == (int)region); } } }
using System.Linq; using D2MPMaster.Lobbies; using D2MPMaster.Server; using d2mpserver; using XSockets.Core.XSocket.Helpers; namespace D2MPMaster { public static class ServerManager { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly ServerController Servers = new ServerController(); public static ServerController FindForLobby(Lobby lobby) { //Params ServerRegion region = lobby.region; ServerController server = null; if (region == ServerRegion.UNKNOWN) { return Servers.Find(m=>m.Inited&&m.Instances.Count < m.InitData.serverCount).FirstOrDefault(); } return Servers.Find(m => m.Inited&&m.Instances.Count < m.InitData.serverCount && (int)m.InitData.region == (int)region).FirstOrDefault(); } } }
apache-2.0
C#
fbee85a19b72cc0396990d3dda39a037faa81755
Bump version #.
google/access-bridge-explorer
src/Properties/AssemblyInfo.cs
src/Properties/AssemblyInfo.cs
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Access Bridge Explorer")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Access Bridge Explorer")] [assembly: AssemblyCopyright("Copyright 2015 Google Inc. All Rights Reserved.")] [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("902e9f38-ef1a-4ed5-86bc-25881dbdabed")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.9.1.0")] [assembly: AssemblyFileVersion("0.9.1.0")]
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Access Bridge Explorer")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Access Bridge Explorer")] [assembly: AssemblyCopyright("Copyright 2015 Google Inc. All Rights Reserved.")] [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("902e9f38-ef1a-4ed5-86bc-25881dbdabed")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.9.0.0")] [assembly: AssemblyFileVersion("0.9.0.0")]
apache-2.0
C#
02ea2e8ad65f6ed81313f049c3a67101ed1bc031
Fix resolver
EasyPeasyLemonSqueezy/MadCat
MadCat/NutEngine/Physics/Collider/ResolveCollision.cs
MadCat/NutEngine/Physics/Collider/ResolveCollision.cs
using Microsoft.Xna.Framework; using NutEngine.Physics.Shapes; using System; namespace NutEngine.Physics { public static partial class Collider { public static void ResolveCollision(Collision collision) { var relVelocity = collision.B.Velocity - collision.A.Velocity; var velocityAlongNormal = Vector2.Dot(relVelocity, collision.Manifold.Normal); // Only if objects moving towards each other if (velocityAlongNormal > 0) { return; } // https://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-the-basics-and-impulse-resolution--gamedev-6331 float e = Math.Min(collision.A.Material.Restitution, collision.B.Material.Restitution); float j = -(1 + e) * velocityAlongNormal / (collision.A.Mass.MassInv + collision.B.Mass.MassInv); collision.A.Velocity -= j * collision.Manifold.Normal * collision.A.Mass.MassInv; collision.B.Velocity += j * collision.Manifold.Normal * collision.B.Mass.MassInv; } } }
using Microsoft.Xna.Framework; using NutEngine.Physics.Shapes; using System; namespace NutEngine.Physics { public static partial class Collider { // We should use Bodies, because we can't calculate relative velocity in manifold. // (Obviously we can, but it will be a bit weird) public static void ResolveCollision(Collision collision) { var relVelocity = collision.B.Velocity - collision.A.Velocity; var velocityAlongNormal = Vector2.Dot(relVelocity, collision.Manifold.Normal); // Only if objects moving towards each other if (velocityAlongNormal > 0) { return; } // https://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-the-basics-and-impulse-resolution--gamedev-6331 float e = Math.Min(collision.A.Material.Restitution, collision.B.Material.Restitution); float j = -(1 + e) * velocityAlongNormal / (collision.A.Mass.MassInv + collision.B.Mass.MassInv); collision.A.Velocity -= j * collision.Manifold.Normal; collision.B.Velocity += j * collision.Manifold.Normal; } } }
mit
C#
53ee6486b5a25b64070ac91faae251c0ffe9c823
Set version "0.11.0"
jaenyph/DelegateDecompiler,morgen2009/DelegateDecompiler,hazzik/DelegateDecompiler
src/DelegateDecompiler/Properties/AssemblyInfo.cs
src/DelegateDecompiler/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("DelegateDecompiler")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DelegateDecompiler")] [assembly: AssemblyCopyright("Copyright © hazzik 2012 - 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cec0a257-502b-4718-91c3-9e67555c5e1b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.11.0.0")] [assembly: AssemblyFileVersion("0.11.0.0")] [assembly: InternalsVisibleTo("DelegateDecompiler.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c96a47f445d38b9b23cbf52e405743481cb9bd2df4672ad6494abcdeb9daf5588eb6159cc88af5fd5a18cece1f05ecb3ddba4b6329535438f4d173f2b769c4715c136ce65c2f25e7360916737056bca40bee22ab2f178af4c5fdc0e5051a6b2630f31447885eb4f5273271c56bd7b8fb240ab453635a79ec2d8aae4a58a6439f")]
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("DelegateDecompiler")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DelegateDecompiler")] [assembly: AssemblyCopyright("Copyright © hazzik 2012 - 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cec0a257-502b-4718-91c3-9e67555c5e1b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.10.1.0")] [assembly: AssemblyFileVersion("0.10.1.0")] [assembly: InternalsVisibleTo("DelegateDecompiler.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c96a47f445d38b9b23cbf52e405743481cb9bd2df4672ad6494abcdeb9daf5588eb6159cc88af5fd5a18cece1f05ecb3ddba4b6329535438f4d173f2b769c4715c136ce65c2f25e7360916737056bca40bee22ab2f178af4c5fdc0e5051a6b2630f31447885eb4f5273271c56bd7b8fb240ab453635a79ec2d8aae4a58a6439f")]
mit
C#
fcf0d2d3e876f22b0a0c3e0e1604985dec68a315
Add validations to schema
contentful/contentful.net
Contentful.Core/Models/Schema.cs
Contentful.Core/Models/Schema.cs
using Contentful.Core.Models.Management; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Contentful.Core.Models { /// <summary> /// Represents a schema of array items. /// </summary> public class Schema { /// <summary> /// Specifies what types of resources are allowed in the array. /// </summary> public string Type { get; set; } /// <summary> /// Specifies what type of links are allowed in the array. /// </summary> public string LinkType { get; set; } /// <summary> /// The validations that should be applied to the items in the array. /// </summary> public List<IFieldValidator> Validations { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Contentful.Core.Models { /// <summary> /// Represents a schema of array items. /// </summary> public class Schema { /// <summary> /// Specifies what types of resources are allowed in the array. /// </summary> public string Type { get; set; } /// <summary> /// Specifies what type of links are allowed in the array. /// </summary> public string LinkType { get; set; } } }
mit
C#
33e350afafc65f71cd3cd95c5ff488c92d75ae35
Fix Gaussian distribution when multithreading.
cbovar/ConvNetSharp,hiperz/ConvNetSharp
src/ConvNetSharp.Volume/RandomUtilities.cs
src/ConvNetSharp.Volume/RandomUtilities.cs
using System; namespace ConvNetSharp.Volume { public static class RandomUtilities { private static readonly Random Random = new Random(Seed); private static double val; private static bool returnVal; public static int Seed => (int) 123;//DateTime.Now.Ticks; public static double GaussianRandom() { if (returnVal) { returnVal = false; return val; } double r = 0, u = 0, v = 0; //System.Random is not threadsafe lock (Random) { while (r == 0 || r > 1) { u = 2*Random.NextDouble() - 1; v = 2*Random.NextDouble() - 1; r = u*u + v*v; } } var c = Math.Sqrt(-2 * Math.Log(r) / r); val = v * c; // cache this returnVal = true; return u * c; } public static double Randn(double mu, double std) { return mu + GaussianRandom() * std; } public static double[] RandomDoubleArray(long length, double mu = 0.0, double std = 1.0) { var values = new double[length]; for (var i = 0; i < length; i++) { values[i] = Randn(mu, std); } return values; } public static float[] RandomSingleArray(long length, double mu = 0.0, double std = 1.0) { var values = new float[length]; for (var i = 0; i < length; i++) { values[i] = (float) Randn(mu, std); } return values; } } }
using System; namespace ConvNetSharp.Volume { public static class RandomUtilities { private static readonly Random Random = new Random(Seed); private static double val; private static bool returnVal; public static int Seed => (int) 123;//DateTime.Now.Ticks; public static double GaussianRandom() { if (returnVal) { returnVal = false; return val; } var u = 2 * Random.NextDouble() - 1; var v = 2 * Random.NextDouble() - 1; var r = u * u + v * v; if (r == 0 || r > 1) { return GaussianRandom(); } var c = Math.Sqrt(-2 * Math.Log(r) / r); val = v * c; // cache this returnVal = true; return u * c; } public static double Randn(double mu, double std) { return mu + GaussianRandom() * std; } public static double[] RandomDoubleArray(long length, double mu = 0.0, double std = 1.0) { var values = new double[length]; for (var i = 0; i < length; i++) { values[i] = Randn(mu, std); } return values; } public static float[] RandomSingleArray(long length, double mu = 0.0, double std = 1.0) { var values = new float[length]; for (var i = 0; i < length; i++) { values[i] = (float) Randn(mu, std); } return values; } } }
mit
C#
97fb505bf1862b68544c4f20c27acb187d7775e3
Change Guard to use IsNotNullNorEmpty instead of IsNotNull for strings parameters
evicertia/HermaFx,evicertia/HermaFx,evicertia/HermaFx
HermaFx.Rebus/RebusExtensions.cs
HermaFx.Rebus/RebusExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Rebus; using Rebus.Shared; namespace HermaFx.Rebus { public static class RebusExtensions { public static void Send<TCommand>(this IBus bus, Action<TCommand> customizer) where TCommand : new() { Guard.IsNotNull(bus, "bus"); var message = Activator.CreateInstance<TCommand>(); if (customizer != null) customizer(message); bus.Send(message); } public static void SendLocal<TCommand>(this IBus bus, Action<TCommand> customizer) where TCommand : new() { Guard.IsNotNull(bus, "bus"); var message = Activator.CreateInstance<TCommand>(); if (customizer != null) customizer(message); bus.Send(message); } public static void Publish<TEvent>(this IBus bus, Action<TEvent> customizer) where TEvent : new() { Guard.IsNotNull(bus, "bus"); var message = Activator.CreateInstance<TEvent>(); if (customizer != null) customizer(message); bus.Publish(message); } public static void Reply<TResponse>(this IBus bus, Action<TResponse> customizer) where TResponse : new() { Guard.IsNotNull(bus, "bus"); var message = Activator.CreateInstance<TResponse>(); if (customizer != null) customizer(message); bus.Reply(message); } public static void ReplyTo<TMessage>(this IBus bus, string originator, string correlationId, TMessage message) { Guard.IsNotNull(bus, nameof(bus)); Guard.IsNotNullNorEmpty(originator, nameof(originator)); Guard.IsNotNullNorEmpty(correlationId, nameof(correlationId)); Guard.IsNotNull(message, nameof(message)); bus.AttachHeader(message, Headers.CorrelationId, correlationId); bus.Advanced.Routing.Send(originator, message); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Rebus; using Rebus.Shared; namespace HermaFx.Rebus { public static class RebusExtensions { public static void Send<TCommand>(this IBus bus, Action<TCommand> customizer) where TCommand : new() { Guard.IsNotNull(bus, "bus"); var message = Activator.CreateInstance<TCommand>(); if (customizer != null) customizer(message); bus.Send(message); } public static void SendLocal<TCommand>(this IBus bus, Action<TCommand> customizer) where TCommand : new() { Guard.IsNotNull(bus, "bus"); var message = Activator.CreateInstance<TCommand>(); if (customizer != null) customizer(message); bus.Send(message); } public static void Publish<TEvent>(this IBus bus, Action<TEvent> customizer) where TEvent : new() { Guard.IsNotNull(bus, "bus"); var message = Activator.CreateInstance<TEvent>(); if (customizer != null) customizer(message); bus.Publish(message); } public static void Reply<TResponse>(this IBus bus, Action<TResponse> customizer) where TResponse : new() { Guard.IsNotNull(bus, "bus"); var message = Activator.CreateInstance<TResponse>(); if (customizer != null) customizer(message); bus.Reply(message); } public static void ReplyTo<TMessage>(this IBus bus, string originator, string correlationId, TMessage message) { Guard.IsNotNull(bus, nameof(bus)); Guard.IsNotNull(originator, nameof(originator)); Guard.IsNotNull(correlationId, nameof(correlationId)); Guard.IsNotNull(message, nameof(message)); bus.AttachHeader(message, Headers.CorrelationId, correlationId); bus.Advanced.Routing.Send(originator, message); } } }
mit
C#
4d339741de06c787b341339f856a0d2d3e5d6aa9
add useful links
smbc-digital/iag-webapp,smbc-digital/iag-webapp,smbc-digital/iag-webapp
src/StockportWebapp/Views/stockportgov/Comms/Index.cshtml
src/StockportWebapp/Views/stockportgov/Comms/Index.cshtml
@using StockportWebapp.Models @model StockportWebapp.Models.CommsHomepage @{ ViewData["Title"] = Model.Title; ViewData["og:title"] = Model.Title; ViewData["WhiteBackground"] = true; Layout = "../Shared/_LayoutSemantic.cshtml"; var crumbsList = new List<Crumb>(); } @section Breadcrumbs { <partial name="SemanticBreadcrumb" model='@crumbsList' /> } <div class="comms-homepage"> <article class="with-aside page-container"> <h1>@Model.Title</h1> <h2>@Model.LatestNewsHeader</h2> <h2>@Model.TwitterFeedHeader</h2> <h2>@Model.InstagramFeedTitle</h2> <h2>@Model.FacebookFeedTitle</h2> </article> <article class="article-aside page-container"> @{ ViewData["SignUpAlertsTopicIdTopicId"] = "UKSMBC_136"; } <partial name="SignUpAlerts" /> <h2 class="h3">Useful links</h2> <ul class="useful-links"> @foreach (var link in Model.UsefullLinks) { <a href="@link.Url" title="@link.Text"> <li>@link.Text</li> </a> } </ul> <h2 class="h3">What's on in Stockport</h2> </article> </div>
@using StockportWebapp.Models @model StockportWebapp.Models.CommsHomepage @{ ViewData["Title"] = Model.Title; ViewData["og:title"] = Model.Title; ViewData["WhiteBackground"] = true; Layout = "../Shared/_LayoutSemantic.cshtml"; var crumbsList = new List<Crumb>(); } @section Breadcrumbs { <partial name="SemanticBreadcrumb" model='@crumbsList' /> } <div class="comms-homepage"> <article class="with-aside page-container"> <h1>@Model.Title</h1> <h2>@Model.LatestNewsHeader</h2> <h2>@Model.TwitterFeedHeader</h2> <h2>@Model.InstagramFeedTitle</h2> <h2>@Model.FacebookFeedTitle</h2> </article> <article class="article-aside page-container"> @{ ViewData["SignUpAlertsTopicIdTopicId"] = "UKSMBC_136"; } <partial name="SignUpAlerts" /> <h3>Useful links</h3> <h3>What's on in Stockport</h3> </article> </div>
mit
C#
050a9e5aa58c7773a9db833606c921a1976e6ed9
Add consturctor
EasyPeasyLemonSqueezy/MadCat
MadCat/NutEngine/Physics/Body.cs
MadCat/NutEngine/Physics/Body.cs
using Microsoft.Xna.Framework; using NutEngine.Physics.Shapes; namespace NutEngine.Physics { public class Body { public Shape Shape { get; private set; } public MassData Mass { get; private set; } public Material Material { get; private set; } public object Owner { get; set; } public Vector2 Position { get; set; } public Vector2 Velocity { get; set; } public Vector2 Impulse { get; set; } public Vector2 Force { get; set; } public Body(Shape shape) { Shape = shape; Mass = new MassData(); Material = new Material(); } public void ApplyImpulse() { Velocity += Mass.MassInv * Impulse; Impulse = Vector2.Zero; } public void ApplyForce(float delta) { /// No, it's not undefined behaviour. /// Evaluation from left to right. Position += (Velocity + (Velocity += (Force * Mass.MassInv * delta))) * delta / 2; Force = Vector2.Zero; } } }
using Microsoft.Xna.Framework; using NutEngine.Physics.Shapes; namespace NutEngine.Physics { public class Body { public Shape Shape { get; private set; } public MassData Mass { get; private set; } public Material Material { get; private set; } public object Owner { get; set; } public Vector2 Position { get; set; } public Vector2 Velocity { get; set; } public Vector2 Impulse { get; set; } public Vector2 Force { get; set; } public void ApplyImpulse() { Velocity += Mass.MassInv * Impulse; Impulse = Vector2.Zero; } public void ApplyForce(float delta) { /// No, it's not undefined behaviour. /// Evaluation from left to right. Position += (Velocity + (Velocity += (Force * Mass.MassInv * delta))) * delta / 2; Force = Vector2.Zero; } } }
mit
C#