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
5d571a0c7bcfbc4ec022f09b7ae7f885b5e59a0c
Change field and variable names from context to handle
Archie-Yang/PcscDotNet
src/PcscDotNet/PcscContext.cs
src/PcscDotNet/PcscContext.cs
using System; namespace PcscDotNet { public class PcscContext : IDisposable { private SCardContext _handle; private readonly Pcsc _pcsc; private readonly IPcscProvider _provider; public bool IsDisposed { get; private set; } = false; public bool IsEstablished => _handle.HasValue; public Pcsc Pcsc => _pcsc; public PcscContext(Pcsc pcsc) { _pcsc = pcsc; _provider = pcsc.Provider; } public PcscContext(Pcsc pcsc, SCardScope scope) : this(pcsc) { Establish(scope); } ~PcscContext() { Dispose(); } public unsafe PcscContext Establish(SCardScope scope) { if (IsDisposed) throw new ObjectDisposedException(nameof(PcscContext), nameof(Establish)); if (IsEstablished) throw new InvalidOperationException("Context has been established."); SCardContext handle; _provider.SCardEstablishContext(scope, null, null, &handle).ThrowIfNotSuccess(); _handle = handle; return this; } public PcscContext Release() { if (IsDisposed) throw new ObjectDisposedException(nameof(PcscContext), nameof(Release)); if (IsEstablished) { _provider.SCardReleaseContext(_handle).ThrowIfNotSuccess(); _handle = SCardContext.Default; } return this; } public void Dispose() { if (IsDisposed) return; Release(); GC.SuppressFinalize(this); IsDisposed = true; } } }
using System; namespace PcscDotNet { public class PcscContext : IDisposable { private SCardContext _context; private readonly Pcsc _pcsc; private readonly IPcscProvider _provider; public bool IsDisposed { get; private set; } = false; public bool IsEstablished => _context.HasValue; public Pcsc Pcsc => _pcsc; public PcscContext(Pcsc pcsc) { _pcsc = pcsc; _provider = pcsc.Provider; } public PcscContext(Pcsc pcsc, SCardScope scope) : this(pcsc) { Establish(scope); } ~PcscContext() { Dispose(); } public unsafe PcscContext Establish(SCardScope scope) { if (IsDisposed) throw new ObjectDisposedException(nameof(PcscContext), nameof(Establish)); if (IsEstablished) throw new InvalidOperationException("Context has been established."); SCardContext context; _provider.SCardEstablishContext(scope, null, null, &context).ThrowIfNotSuccess(); _context = context; return this; } public PcscContext Release() { if (IsDisposed) throw new ObjectDisposedException(nameof(PcscContext), nameof(Release)); if (IsEstablished) { _provider.SCardReleaseContext(_context).ThrowIfNotSuccess(); _context = SCardContext.Default; } return this; } public void Dispose() { if (IsDisposed) return; Release(); GC.SuppressFinalize(this); IsDisposed = true; } } }
mit
C#
a445ab4af3a5a4dcc37dadbd666d76b3e3c73eb8
comment the codes
chjwilliams/DreamTeam
DreamTeam/Assets/Resources/Scripts/GameWorld/GameManager.cs
DreamTeam/Assets/Resources/Scripts/GameWorld/GameManager.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; /***************************************************************************************************/ /* Gamemanager: control camera switch */ /* start(); */ /* update(); */ /* toggleCamera(); */ /* */ /***************************************************************************************************/ public class GameManager : MonoBehaviour { // Public Variables public static GameManager gm; //Refernece to the gamemanager public GameObject firstPersonCamera; //Refernece to the firstpersoncamera public GameObject thirdPersonCamera; //Refernece to the thirdpersoncamera public bool thirdPersonActive; ////Refernece to whether the thirdpersoncamera is active // Use this for initialization void Start () { //if gm is undifined, get the refernce to GameManger if (gm == null) { gm = GameObject.FindGameObjectWithTag ("GameManager").GetComponent<GameManager> (); } //initial thirdpersoncamera inactive thirdPersonActive = false; } // Update is called once per frame void Update () { //if left shift key is down, set the active of thirdpersoncamera the opposite if (Input.GetKeyDown(KeyCode.LeftShift)){ thirdPersonActive = !thirdPersonActive; //call toggleCamera function toggleCamera (thirdPersonActive); } } //the function we set the active/inactive of firstperson and thirdperson camera void toggleCamera(bool b){ if (b){ // make camera view thirdperson camera thirdPersonCamera.SetActive(true); firstPersonCamera.SetActive (false); } else { // make camera view first person camera thirdPersonCamera.SetActive(false); firstPersonCamera.SetActive(true); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameManager : MonoBehaviour { public static GameManager gm; public GameObject firstPersonCamera; public GameObject thirdPersonCamera; public bool thirdPersonActive; // Use this for initialization void Start () { if (gm == null) { gm = GameObject.FindGameObjectWithTag ("GameManager").GetComponent<GameManager> (); } thirdPersonActive = false; } // Update is called once per frame void Update () { if (Input.GetKeyDown(KeyCode.LeftShift)){ thirdPersonActive = !thirdPersonActive; toggleCamera (thirdPersonActive); } } void toggleCamera(bool b){ if (b){ // make camera view thirdperson camera thirdPersonCamera.SetActive(true); firstPersonCamera.SetActive (false); } else { // make camera view first person camera thirdPersonCamera.SetActive(false); firstPersonCamera.SetActive(true); } } }
unlicense
C#
a0f980874d96fc528d157e762b91ed189937a994
Fix object construction.
darvell/Coremero
Coremero/Coremero.Client.Discord/DiscordObjectFactory.cs
Coremero/Coremero.Client.Discord/DiscordObjectFactory.cs
using System; using System.Collections.Generic; using System.Text; using Discord; namespace Coremero.Client.Discord { public class DiscordObjectFactory<TSource, TTarget> where TSource : ISnowflakeEntity { private Dictionary<ulong, TTarget> _cache = new Dictionary<ulong, TTarget>(); public TTarget Get(TSource source) { TTarget result; _cache.TryGetValue(source.Id, out result); if (result == null) { // Resort to reflection. :( _cache[source.Id] = (TTarget) Activator.CreateInstance(typeof(TTarget), new[] {source}); } return result; } } public static class DiscordFactory { public static readonly DiscordObjectFactory<IGuild, DiscordServer> ServerFactory = new DiscordObjectFactory<IGuild, DiscordServer>(); public static readonly DiscordObjectFactory<IMessageChannel, DiscordChannel> ChannelFactory = new DiscordObjectFactory<IMessageChannel, DiscordChannel>(); public static readonly DiscordObjectFactory<global::Discord.IUser, DiscordUser> UserFactory = new DiscordObjectFactory<global::Discord.IUser, DiscordUser>(); } }
using System; using System.Collections.Generic; using System.Text; using Discord; namespace Coremero.Client.Discord { public class DiscordObjectFactory<TSource, TTarget> where TSource : ISnowflakeEntity { private Dictionary<ulong, TTarget> _cache = new Dictionary<ulong, TTarget>(); public TTarget Get(TSource source) { TTarget result; _cache.TryGetValue(source.Id, out result); if (result == null) { // Resort to reflection. :( _cache[source.Id] = (TTarget) Activator.CreateInstance(typeof(TTarget), new[] {source}); } return result; } } public static class DiscordFactory { public static readonly DiscordObjectFactory<IGuild, IServer> ServerFactory = new DiscordObjectFactory<IGuild, IServer>(); public static readonly DiscordObjectFactory<IMessageChannel, IChannel> ChannelFactory = new DiscordObjectFactory<IMessageChannel, IChannel>(); public static readonly DiscordObjectFactory<global::Discord.IUser, IUser> UserFactory = new DiscordObjectFactory<global::Discord.IUser, IUser>(); } }
mit
C#
2f16b448ea8619ea6ea8d34231ff94f040702e53
Set beatLength inline
UselessToucan/osu,smoogipooo/osu,peppy/osu,UselessToucan/osu,ppy/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,peppy/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,smoogipoo/osu
osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs
osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; using osu.Game.Beatmaps.Timing; namespace osu.Game.Beatmaps.ControlPoints { public class TimingControlPoint : ControlPoint { /// <summary> /// The time signature at this control point. /// </summary> public readonly Bindable<TimeSignatures> TimeSignatureBindable = new Bindable<TimeSignatures>(TimeSignatures.SimpleQuadruple) { Default = TimeSignatures.SimpleQuadruple }; /// <summary> /// Default length of a beat in milliseconds. Used whenever there is no beatmap or track playing. /// </summary> private const double default_beat_length = 60000.0 / 60.0; public static readonly TimingControlPoint DEFAULT = new TimingControlPoint { BeatLengthBindable = { Value = default_beat_length, Disabled = true }, TimeSignatureBindable = { Disabled = true } }; /// <summary> /// The time signature at this control point. /// </summary> public TimeSignatures TimeSignature { get => TimeSignatureBindable.Value; set => TimeSignatureBindable.Value = value; } public const double DEFAULT_BEAT_LENGTH = 1000; /// <summary> /// The beat length at this control point. /// </summary> public readonly BindableDouble BeatLengthBindable = new BindableDouble(DEFAULT_BEAT_LENGTH) { Default = DEFAULT_BEAT_LENGTH, MinValue = 6, MaxValue = 60000 }; /// <summary> /// The beat length at this control point. /// </summary> public double BeatLength { get => BeatLengthBindable.Value; set => BeatLengthBindable.Value = value; } /// <summary> /// The BPM at this control point. /// </summary> public double BPM => 60000 / BeatLength; // Timing points are never redundant as they can change the time signature. public override bool IsRedundant(ControlPoint existing) => false; } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; using osu.Game.Beatmaps.Timing; namespace osu.Game.Beatmaps.ControlPoints { public class TimingControlPoint : ControlPoint { /// <summary> /// The time signature at this control point. /// </summary> public readonly Bindable<TimeSignatures> TimeSignatureBindable = new Bindable<TimeSignatures>(TimeSignatures.SimpleQuadruple) { Default = TimeSignatures.SimpleQuadruple }; /// <summary> /// Default length of a beat in milliseconds. Used whenever there is no beatmap or track playing. /// </summary> private const double default_beat_length = 60000.0 / 60.0; public static readonly TimingControlPoint DEFAULT = new TimingControlPoint { BeatLength = default_beat_length, BeatLengthBindable = { Disabled = true }, TimeSignatureBindable = { Disabled = true } }; /// <summary> /// The time signature at this control point. /// </summary> public TimeSignatures TimeSignature { get => TimeSignatureBindable.Value; set => TimeSignatureBindable.Value = value; } public const double DEFAULT_BEAT_LENGTH = 1000; /// <summary> /// The beat length at this control point. /// </summary> public readonly BindableDouble BeatLengthBindable = new BindableDouble(DEFAULT_BEAT_LENGTH) { Default = DEFAULT_BEAT_LENGTH, MinValue = 6, MaxValue = 60000 }; /// <summary> /// The beat length at this control point. /// </summary> public double BeatLength { get => BeatLengthBindable.Value; set => BeatLengthBindable.Value = value; } /// <summary> /// The BPM at this control point. /// </summary> public double BPM => 60000 / BeatLength; // Timing points are never redundant as they can change the time signature. public override bool IsRedundant(ControlPoint existing) => false; } }
mit
C#
5c3141d16afd3a4091e42ed4f1906a58d1d6fba4
Fix ready button tooltip showing when locally available
peppy/osu,ppy/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu,smoogipooo/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu
osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs
osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; using osu.Game.Online; using osu.Game.Online.Rooms; namespace osu.Game.Screens.OnlinePlay.Components { public abstract class ReadyButton : TriangleButton, IHasTooltip { public new readonly BindableBool Enabled = new BindableBool(); private IBindable<BeatmapAvailability> availability; [BackgroundDependencyLoader] private void load(OnlinePlayBeatmapAvailabilityTracker beatmapTracker) { availability = beatmapTracker.Availability.GetBoundCopy(); availability.BindValueChanged(_ => updateState()); Enabled.BindValueChanged(_ => updateState(), true); } private void updateState() => base.Enabled.Value = availability.Value.State == DownloadState.LocallyAvailable && Enabled.Value; public virtual LocalisableString TooltipText { get { if (Enabled.Value) return string.Empty; if (availability.Value.State != DownloadState.LocallyAvailable) return "Beatmap not downloaded"; return string.Empty; } } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterface; using osu.Game.Online; using osu.Game.Online.Rooms; namespace osu.Game.Screens.OnlinePlay.Components { public abstract class ReadyButton : TriangleButton, IHasTooltip { public new readonly BindableBool Enabled = new BindableBool(); private IBindable<BeatmapAvailability> availability; [BackgroundDependencyLoader] private void load(OnlinePlayBeatmapAvailabilityTracker beatmapTracker) { availability = beatmapTracker.Availability.GetBoundCopy(); availability.BindValueChanged(_ => updateState()); Enabled.BindValueChanged(_ => updateState(), true); } private void updateState() => base.Enabled.Value = availability.Value.State == DownloadState.LocallyAvailable && Enabled.Value; public virtual LocalisableString TooltipText { get { if (Enabled.Value) return string.Empty; return "Beatmap not downloaded"; } } } }
mit
C#
2b8e8f2dc4a20d242a1f6526ce3a8ef4bade2c73
Add conversion from CIE1931XYZ to SRGB
Litipk/ColorSharp,Litipk/ColorSharp
ColorSharp/src/CIEXYZ.cs
ColorSharp/src/CIEXYZ.cs
/** * The MIT License (MIT) * Copyright (c) 2014 Andrés Correa Casablanca * * 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. */ /** * Contributors: * - Andrés Correa Casablanca <[email protected] , [email protected]> */ using System; using System.Collections.Generic; namespace Litipk.ColorSharp { /** * CIE 1931 XYZ Color Space. */ public class CIEXYZ : AConvertibleColor { #region private properties double X, Y, Z; #endregion #region constructors /** * This constructor "installs" the conversor methods into the instance */ protected CIEXYZ(AConvertibleColor dataSource=null) : base(dataSource) { Conversors.Add (typeof(SRGB), ToSRGB); } // Constructor public CIEXYZ (double X, double Y, double Z, AConvertibleColor dataSource=null) : this(dataSource) { this.X = X; this.Y = Y; this.Z = Z; } #endregion #region conversors /** * Assumes CIE 1931 (2º) XYZ */ public SRGB ToSRGB (Dictionary<KeyValuePair<Type, Type>, object> strategies=null) { double tx = X / 100.0; double ty = Y / 100.0; double tz = Z / 100.0; // Linear transformation double r = tx * 3.2406 + ty * -1.5372 + tz * -0.4986; double g = tx * -0.9689 + ty * 1.8758 + tz * 0.0415; double b = tx * 0.0557 + ty * -0.2040 + tz * 1.0570; // Gamma correction r = r > 0.0031308 ? 1.055 * Math.Pow(r, 1 / 2.4) - 0.055 : 12.92 * r; g = g > 0.0031308 ? 1.055 * Math.Pow(g, 1 / 2.4) - 0.055 : 12.92 * g; b = b > 0.0031308 ? 1.055 * Math.Pow(b, 1 / 2.4) - 0.055 : 12.92 * b; double maxChannelValue = Math.Max (r, Math.Max (g, b)); // Another correction if (maxChannelValue > 1.0) { r = r / maxChannelValue; g = g / maxChannelValue; b = b / maxChannelValue; } return new SRGB(r, g, b); } #endregion #region inherited methods public override bool IsInsideColorSpace() { return true; // TODO : Find criteria! } #endregion } }
/** * The MIT License (MIT) * Copyright (c) 2014 Andrés Correa Casablanca * * 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. */ /** * Contributors: * - Andrés Correa Casablanca <[email protected] , [email protected]> */ using System; using System.Collections.Generic; namespace Litipk.ColorSharp { /** * CIE 1931 XYZ Color Space. */ public class CIEXYZ : AConvertibleColor { #region private properties double X, Y, Z; #endregion #region constructors /** * This constructor "installs" the conversor methods into the instance */ protected CIEXYZ(AConvertibleColor dataSource=null) : base(dataSource) { Conversors.Add (typeof(SRGB), ToSRGB); } // Constructor public CIEXYZ (double X, double Y, double Z, AConvertibleColor dataSource=null) : this(dataSource) { this.X = X; this.Y = Y; this.Z = Z; } #endregion #region conversors public SRGB ToSRGB (Dictionary<KeyValuePair<Type, Type>, object> strategies=null) { throw new NotImplementedException (); } #endregion #region inherited methods public override bool IsInsideColorSpace() { return true; // TODO : Find criteria! } #endregion } }
mit
C#
e0ad435fce928da558a967a4276e9794898f0d65
delete a line
ravjotsingh9/DBLike
DBLike/Server/Program.cs
DBLike/Server/Program.cs
using Server.DatabaseAccess; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace Server { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }
using Server.DatabaseAccess; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace Server { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] DBConnection test; static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }
apache-2.0
C#
3f83411293212ba1ea40bd7062ecbf321e0a4cfa
Update Program.cs
natintosh/Numerical-Methods
NumericalMethods/LUDecomposition/LUDecomposition/Program.cs
NumericalMethods/LUDecomposition/LUDecomposition/Program.cs
using System; namespace LUDecomposition { class MainClass:NumericalMethods { public static void Main() { Double[,] linearEquation = { { 25, 5, 1, 106.8 }, { 64, 8, 1, 177.2 }, { 144, 12, 1, 292.2 } }; Decompostion decomposition = new Decompostion(matrix); decomposition.Decompose(); Double[,] upperMatrix = decomposition.GetUpperMatrix(); Double[,] lowerMatrix = decomposition.GetLowerMatrix(); ForwBackSubstitution forwBackSubstitution = new ForwBackSubstitution(upperMatrix, lowerMatrix); forwBackSubstitution.Substitute(); } } }
using System; namespace LUDecomposition { class MainClass:NumericalMethods { public static void Main() { Double[,] matrix = { { 1, 2, 1, 4 }, { 3, -4, -2, 2 }, { 5, 3, 5, -1 } }; Decompostion decomposition = new Decompostion(matrix); decomposition.Decompose(); Double[,] upperMatrix = decomposition.GetUpperMatrix(); Double[,] lowerMatrix = decomposition.GetLowerMatrix(); ForwBackSubstitution forwBackSubstitution = new ForwBackSubstitution(upperMatrix, lowerMatrix); forwBackSubstitution.Substitute(); } } }
mit
C#
5922db73e4c64ec422fd312b2108aaf83fe6da53
Update FastBinaryBondDeserializer.cs
tiksn/TIKSN-Framework
TIKSN.Core/Serialization/Bond/FastBinaryBondDeserializer.cs
TIKSN.Core/Serialization/Bond/FastBinaryBondDeserializer.cs
using Bond.IO.Safe; using Bond.Protocols; namespace TIKSN.Serialization.Bond { public class FastBinaryBondDeserializer : DeserializerBase<byte[]> { protected override T DeserializeInternal<T>(byte[] serial) { var input = new InputBuffer(serial); var reader = new FastBinaryReader<InputBuffer>(input); return global::Bond.Deserialize<T>.From(reader); } } }
using Bond.IO.Safe; using Bond.Protocols; using TIKSN.Analytics.Telemetry; namespace TIKSN.Serialization.Bond { public class FastBinaryBondDeserializer : DeserializerBase<byte[]> { public FastBinaryBondDeserializer(IExceptionTelemeter exceptionTelemeter) : base(exceptionTelemeter) { } protected override T DeserializeInternal<T>(byte[] serial) { var input = new InputBuffer(serial); var reader = new FastBinaryReader<InputBuffer>(input); return global::Bond.Deserialize<T>.From(reader); } } }
mit
C#
154d80de359fa2800a67932c50743734d5131cd0
Update Program.cs
egcgy/demo1
Hello1/Hello1/Program.cs
Hello1/Hello1/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Hello1 { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!!"); Console.WriteLine("Added on the server"); Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Hello1 { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!!"); Console.ReadLine(); } } }
mit
C#
f48f0278ea4ca109a49628edacd5f6d288381ab0
implement writing of DoInitActionTag
Alexx999/SwfSharp
SwfSharp/Tags/DoInitActionTag.cs
SwfSharp/Tags/DoInitActionTag.cs
using System; using System.Collections.Generic; using System.IO; using SwfSharp.Structs; using SwfSharp.Utils; namespace SwfSharp.Tags { public class DoInitActionTag : DoActionTag { public ushort SpriteID { get; set; } public DoInitActionTag(int size) : base(TagType.DoInitAction, size) { } internal override void FromStream(BitReader reader, byte swfVersion) { SpriteID = reader.ReadUI16(); base.FromStream(reader, swfVersion); } internal override void ToStream(BitWriter writer, byte swfVersion) { writer.WriteUI16(SpriteID); base.ToStream(writer, swfVersion); } } }
using System.Collections.Generic; using System.IO; using SwfSharp.Structs; using SwfSharp.Utils; namespace SwfSharp.Tags { public class DoInitActionTag : DoActionTag { public ushort SpriteID { get; set; } public DoInitActionTag(int size) : base(TagType.DoInitAction, size) { } internal override void FromStream(BitReader reader, byte swfVersion) { SpriteID = reader.ReadUI16(); base.FromStream(reader, swfVersion); } } }
mit
C#
e81967e2d89d398b0813687f68b6fa2ed5d01262
Make TreeWalkForGitDir() delegate to LibGit2Sharp
Kantis/GitVersion,dpurge/GitVersion,dpurge/GitVersion,TomGillen/GitVersion,ermshiperete/GitVersion,ParticularLabs/GitVersion,Philo/GitVersion,DanielRose/GitVersion,JakeGinnivan/GitVersion,Philo/GitVersion,orjan/GitVersion,GeertvanHorrik/GitVersion,JakeGinnivan/GitVersion,asbjornu/GitVersion,ParticularLabs/GitVersion,FireHost/GitVersion,Kantis/GitVersion,orjan/GitVersion,dpurge/GitVersion,alexhardwicke/GitVersion,dpurge/GitVersion,MarkZuber/GitVersion,gep13/GitVersion,onovotny/GitVersion,DanielRose/GitVersion,Kantis/GitVersion,onovotny/GitVersion,anobleperson/GitVersion,ermshiperete/GitVersion,RaphHaddad/GitVersion,alexhardwicke/GitVersion,distantcam/GitVersion,onovotny/GitVersion,GitTools/GitVersion,GeertvanHorrik/GitVersion,dazinator/GitVersion,dazinator/GitVersion,openkas/GitVersion,openkas/GitVersion,gep13/GitVersion,asbjornu/GitVersion,RaphHaddad/GitVersion,FireHost/GitVersion,anobleperson/GitVersion,ermshiperete/GitVersion,TomGillen/GitVersion,pascalberger/GitVersion,ermshiperete/GitVersion,DanielRose/GitVersion,GitTools/GitVersion,JakeGinnivan/GitVersion,distantcam/GitVersion,pascalberger/GitVersion,anobleperson/GitVersion,JakeGinnivan/GitVersion,pascalberger/GitVersion,MarkZuber/GitVersion
GitFlowVersion/GitDirFinder.cs
GitFlowVersion/GitDirFinder.cs
namespace GitFlowVersion { using System.IO; using LibGit2Sharp; public class GitDirFinder { public static string TreeWalkForGitDir(string currentDirectory) { string gitDir = Repository.Discover(currentDirectory); if (gitDir != null) { return gitDir.TrimEnd(new []{ Path.DirectorySeparatorChar }); } return null; } } }
namespace GitFlowVersion { using System.IO; public class GitDirFinder { public static string TreeWalkForGitDir(string currentDirectory) { while (true) { var gitDir = Path.Combine(currentDirectory, @".git"); if (Directory.Exists(gitDir)) { return gitDir; } var parent = Directory.GetParent(currentDirectory); if (parent == null) { break; } currentDirectory = parent.FullName; } return null; } } }
mit
C#
0da00521a99ae13522697d5fd58f9200c753b9a5
Remove extra TypeForward from facade to fix ConfiguredTaskAwaiter (#6899)
mskvortsov/coreclr,krytarowski/coreclr,bartdesmet/coreclr,russellhadley/coreclr,alexperovich/coreclr,krytarowski/coreclr,neurospeech/coreclr,krytarowski/coreclr,jamesqo/coreclr,krk/coreclr,mmitche/coreclr,AlexGhiondea/coreclr,Dmitry-Me/coreclr,James-Ko/coreclr,hseok-oh/coreclr,YongseopKim/coreclr,neurospeech/coreclr,pgavlin/coreclr,mskvortsov/coreclr,rartemev/coreclr,cshung/coreclr,russellhadley/coreclr,YongseopKim/coreclr,wateret/coreclr,parjong/coreclr,mskvortsov/coreclr,tijoytom/coreclr,rartemev/coreclr,kyulee1/coreclr,cydhaselton/coreclr,cmckinsey/coreclr,ramarag/coreclr,alexperovich/coreclr,dasMulli/coreclr,ruben-ayrapetyan/coreclr,Dmitry-Me/coreclr,botaberg/coreclr,rartemev/coreclr,krk/coreclr,botaberg/coreclr,ragmani/coreclr,pgavlin/coreclr,dpodder/coreclr,gkhanna79/coreclr,krk/coreclr,ramarag/coreclr,mmitche/coreclr,yizhang82/coreclr,sjsinju/coreclr,krytarowski/coreclr,Dmitry-Me/coreclr,rartemev/coreclr,JonHanna/coreclr,YongseopKim/coreclr,sjsinju/coreclr,gkhanna79/coreclr,poizan42/coreclr,sjsinju/coreclr,yizhang82/coreclr,poizan42/coreclr,hseok-oh/coreclr,krytarowski/coreclr,tijoytom/coreclr,cmckinsey/coreclr,cydhaselton/coreclr,dpodder/coreclr,kyulee1/coreclr,ramarag/coreclr,cshung/coreclr,sagood/coreclr,mmitche/coreclr,JosephTremoulet/coreclr,cshung/coreclr,ragmani/coreclr,neurospeech/coreclr,ragmani/coreclr,cmckinsey/coreclr,qiudesong/coreclr,wtgodbe/coreclr,mskvortsov/coreclr,ragmani/coreclr,pgavlin/coreclr,dasMulli/coreclr,bartdesmet/coreclr,yeaicc/coreclr,bartdesmet/coreclr,gkhanna79/coreclr,mmitche/coreclr,gkhanna79/coreclr,sjsinju/coreclr,JonHanna/coreclr,AlexGhiondea/coreclr,cmckinsey/coreclr,russellhadley/coreclr,alexperovich/coreclr,tijoytom/coreclr,jamesqo/coreclr,jamesqo/coreclr,sjsinju/coreclr,hseok-oh/coreclr,AlexGhiondea/coreclr,bartdesmet/coreclr,poizan42/coreclr,ragmani/coreclr,sagood/coreclr,qiudesong/coreclr,ruben-ayrapetyan/coreclr,wateret/coreclr,krytarowski/coreclr,gkhanna79/coreclr,yeaicc/coreclr,Dmitry-Me/coreclr,botaberg/coreclr,qiudesong/coreclr,poizan42/coreclr,jamesqo/coreclr,JonHanna/coreclr,qiudesong/coreclr,wateret/coreclr,neurospeech/coreclr,tijoytom/coreclr,JonHanna/coreclr,James-Ko/coreclr,James-Ko/coreclr,dasMulli/coreclr,cmckinsey/coreclr,dasMulli/coreclr,cshung/coreclr,wateret/coreclr,yizhang82/coreclr,mskvortsov/coreclr,cydhaselton/coreclr,JonHanna/coreclr,cydhaselton/coreclr,JosephTremoulet/coreclr,dpodder/coreclr,James-Ko/coreclr,ruben-ayrapetyan/coreclr,AlexGhiondea/coreclr,alexperovich/coreclr,dasMulli/coreclr,JosephTremoulet/coreclr,botaberg/coreclr,rartemev/coreclr,bartdesmet/coreclr,cydhaselton/coreclr,JonHanna/coreclr,bartdesmet/coreclr,Dmitry-Me/coreclr,dpodder/coreclr,ramarag/coreclr,krk/coreclr,sagood/coreclr,wtgodbe/coreclr,yizhang82/coreclr,botaberg/coreclr,AlexGhiondea/coreclr,parjong/coreclr,ruben-ayrapetyan/coreclr,ruben-ayrapetyan/coreclr,mmitche/coreclr,gkhanna79/coreclr,jamesqo/coreclr,krk/coreclr,parjong/coreclr,poizan42/coreclr,wtgodbe/coreclr,kyulee1/coreclr,sjsinju/coreclr,parjong/coreclr,ramarag/coreclr,hseok-oh/coreclr,tijoytom/coreclr,pgavlin/coreclr,yizhang82/coreclr,ramarag/coreclr,mskvortsov/coreclr,ramarag/coreclr,dpodder/coreclr,Dmitry-Me/coreclr,sagood/coreclr,parjong/coreclr,Dmitry-Me/coreclr,ruben-ayrapetyan/coreclr,neurospeech/coreclr,russellhadley/coreclr,kyulee1/coreclr,sagood/coreclr,yeaicc/coreclr,alexperovich/coreclr,krk/coreclr,hseok-oh/coreclr,botaberg/coreclr,jamesqo/coreclr,YongseopKim/coreclr,yizhang82/coreclr,kyulee1/coreclr,James-Ko/coreclr,hseok-oh/coreclr,YongseopKim/coreclr,wateret/coreclr,wtgodbe/coreclr,JosephTremoulet/coreclr,cmckinsey/coreclr,sagood/coreclr,neurospeech/coreclr,cshung/coreclr,yeaicc/coreclr,cydhaselton/coreclr,yeaicc/coreclr,JosephTremoulet/coreclr,poizan42/coreclr,wtgodbe/coreclr,pgavlin/coreclr,rartemev/coreclr,russellhadley/coreclr,yeaicc/coreclr,wateret/coreclr,James-Ko/coreclr,wtgodbe/coreclr,russellhadley/coreclr,bartdesmet/coreclr,YongseopKim/coreclr,ragmani/coreclr,dpodder/coreclr,kyulee1/coreclr,pgavlin/coreclr,mmitche/coreclr,AlexGhiondea/coreclr,parjong/coreclr,cmckinsey/coreclr,qiudesong/coreclr,cshung/coreclr,dasMulli/coreclr,alexperovich/coreclr,tijoytom/coreclr,qiudesong/coreclr,yeaicc/coreclr,JosephTremoulet/coreclr,dasMulli/coreclr
src/mscorlib/facade/TypeForwards.cs
src/mscorlib/facade/TypeForwards.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.Runtime.CompilerServices; #if WINDOWS_TYPEFORWARDS [assembly: TypeForwardedTo(typeof(System.Threading.WinRTSynchronizationContextFactoryBase))] [assembly: TypeForwardedTo(typeof(System.Resources.WindowsRuntimeResourceManagerBase))] [assembly: TypeForwardedTo(typeof(System.Resources.PRIExceptionInfo))] [assembly: TypeForwardedTo(typeof(System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeImportAttribute))] [assembly: TypeForwardedTo(typeof(System.Runtime.InteropServices.WindowsRuntime.IRestrictedErrorInfo))] [assembly: TypeForwardedTo(typeof(System.StubHelpers.EventArgsMarshaler))] [assembly: TypeForwardedTo(typeof(System.StubHelpers.InterfaceMarshaler))] #endif [assembly: TypeForwardedTo(typeof(System.Diagnostics.Tracing.FrameworkEventSource))] [assembly: TypeForwardedTo(typeof(System.Globalization.CultureData))] [assembly: TypeForwardedTo(typeof(System.Globalization.CalendarData))] [assembly: TypeForwardedTo(typeof(System.IO.BufferedStream))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.JitHelpers))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.ObjectHandleOnStack))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.PinningHelper))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.StackCrawlMarkHandle))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.StringHandleOnStack))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.FriendAccessAllowedAttribute))] [assembly: TypeForwardedTo(typeof(System.StubHelpers.StubHelpers))] [assembly: TypeForwardedTo(typeof(System.StubHelpers.CleanupWorkList))] [assembly: TypeForwardedTo(typeof(System.StubHelpers.CleanupWorkListElement))] [assembly: TypeForwardedTo(typeof(System.Threading.StackCrawlMark))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.AsyncCausalityStatus))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.CausalityRelation))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.CausalitySynchronousWork))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.AsyncCausalityTracer))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.CausalityTraceLevel))]
// 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.Runtime.CompilerServices; #if WINDOWS_TYPEFORWARDS [assembly: TypeForwardedTo(typeof(System.Threading.WinRTSynchronizationContextFactoryBase))] [assembly: TypeForwardedTo(typeof(System.Resources.WindowsRuntimeResourceManagerBase))] [assembly: TypeForwardedTo(typeof(System.Resources.PRIExceptionInfo))] [assembly: TypeForwardedTo(typeof(System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeImportAttribute))] [assembly: TypeForwardedTo(typeof(System.Runtime.InteropServices.WindowsRuntime.IRestrictedErrorInfo))] [assembly: TypeForwardedTo(typeof(System.Globalization.CultureTypes))] [assembly: TypeForwardedTo(typeof(System.StubHelpers.EventArgsMarshaler))] [assembly: TypeForwardedTo(typeof(System.StubHelpers.InterfaceMarshaler))] #endif [assembly: TypeForwardedTo(typeof(System.Diagnostics.Tracing.FrameworkEventSource))] [assembly: TypeForwardedTo(typeof(System.Globalization.CultureData))] [assembly: TypeForwardedTo(typeof(System.Globalization.CalendarData))] [assembly: TypeForwardedTo(typeof(System.IO.BufferedStream))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.JitHelpers))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.ObjectHandleOnStack))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.PinningHelper))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.StackCrawlMarkHandle))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.StringHandleOnStack))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.FriendAccessAllowedAttribute))] [assembly: TypeForwardedTo(typeof(System.StubHelpers.StubHelpers))] [assembly: TypeForwardedTo(typeof(System.StubHelpers.CleanupWorkList))] [assembly: TypeForwardedTo(typeof(System.StubHelpers.CleanupWorkListElement))] [assembly: TypeForwardedTo(typeof(System.Threading.StackCrawlMark))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.AsyncCausalityStatus))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.CausalityRelation))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.CausalitySynchronousWork))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.AsyncCausalityTracer))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.CausalityTraceLevel))]
mit
C#
e562c5193d591042c02c7eed9c8663ebd3574cf7
prepare for 1.3.0 release
jordanbtucker/im-only-resting,codemonkey493/im-only-resting,nathanwblair/im-only-resting,jordanbtucker/im-only-resting,SwensenSoftware/im-only-resting,ItsAGeekThing/im-only-resting,abhinavwaviz/im-only-resting,MrZANE42/im-only-resting,stephen-swensen/im-only-resting,codemonkey493/im-only-resting,nathanwblair/im-only-resting,ItsAGeekThing/im-only-resting,stephen-swensen/im-only-resting,MrZANE42/im-only-resting,abhinavwaviz/im-only-resting,SwensenSoftware/im-only-resting
Ior/Properties/AssemblyInfo.cs
Ior/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("I'm Only Resting")] [assembly: AssemblyDescription("http://www.swensensoftware.com/im-only-resting")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("I'm Only Resting")] [assembly: AssemblyCopyright("Copyright © Swensen Software 2012 - 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("42d77ebc-de54-4916-b931-de852d2bacff")] // 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.3.0.*")] [assembly: AssemblyFileVersion("1.3.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("I'm Only Resting")] [assembly: AssemblyDescription("http://www.swensensoftware.com/im-only-resting")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("I'm Only Resting")] [assembly: AssemblyCopyright("Copyright © Swensen Software 2012 - 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("42d77ebc-de54-4916-b931-de852d2bacff")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.2.0.*")] [assembly: AssemblyFileVersion("1.2.0.*")]
apache-2.0
C#
ef35fb9e7d67493947615354c539113c4cb90e12
Use mousedown position for instantaneous feedback
ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework
osu.Framework/Graphics/Containers/DrawableRearrangeableListItem.cs
osu.Framework/Graphics/Containers/DrawableRearrangeableListItem.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Input.Events; using osuTK; namespace osu.Framework.Graphics.Containers { public abstract class DrawableRearrangeableListItem<TModel> : CompositeDrawable where TModel : IEquatable<TModel> { internal Action<DrawableRearrangeableListItem<TModel>, DragStartEvent> StartArrangement; internal Action<DrawableRearrangeableListItem<TModel>, DragEvent> Arrange; internal Action<DrawableRearrangeableListItem<TModel>, DragEndEvent> EndArrangement; /// <summary> /// The item this <see cref="DrawableRearrangeableListItem{TModel}"/> represents. /// </summary> public TModel Model; /// <summary> /// Creates a new <see cref="DrawableRearrangeableListItem{TModel}"/>. /// </summary> /// <param name="item">The item to represent.</param> protected DrawableRearrangeableListItem(TModel item) { Model = item; } /// <summary> /// Returns whether the item is currently able to be dragged. /// </summary> protected virtual bool IsDraggableAt(Vector2 screenSpacePos) => true; protected override bool OnDragStart(DragStartEvent e) { if (IsDraggableAt(e.ScreenSpaceMouseDownPosition)) { StartArrangement?.Invoke(this, e); return true; } return false; } protected override void OnDrag(DragEvent e) => Arrange?.Invoke(this, e); protected override void OnDragEnd(DragEndEvent e) => EndArrangement?.Invoke(this, e); } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Input.Events; using osuTK; namespace osu.Framework.Graphics.Containers { public abstract class DrawableRearrangeableListItem<TModel> : CompositeDrawable where TModel : IEquatable<TModel> { internal Action<DrawableRearrangeableListItem<TModel>, DragStartEvent> StartArrangement; internal Action<DrawableRearrangeableListItem<TModel>, DragEvent> Arrange; internal Action<DrawableRearrangeableListItem<TModel>, DragEndEvent> EndArrangement; /// <summary> /// The item this <see cref="DrawableRearrangeableListItem{TModel}"/> represents. /// </summary> public TModel Model; /// <summary> /// Creates a new <see cref="DrawableRearrangeableListItem{TModel}"/>. /// </summary> /// <param name="item">The item to represent.</param> protected DrawableRearrangeableListItem(TModel item) { Model = item; } /// <summary> /// Returns whether the item is currently able to be dragged. /// </summary> protected virtual bool IsDraggableAt(Vector2 screenSpacePos) => true; protected override bool OnDragStart(DragStartEvent e) { if (IsDraggableAt(e.ScreenSpaceMousePosition)) { StartArrangement?.Invoke(this, e); return true; } return false; } protected override void OnDrag(DragEvent e) => Arrange?.Invoke(this, e); protected override void OnDragEnd(DragEndEvent e) => EndArrangement?.Invoke(this, e); } }
mit
C#
060ea24bf3ff0b5af6f36388ee87429b052b09fe
Fix filepath
Kerbas-ad-astra/CapCom,DMagic1/CapCom
Source/CapComSettings.cs
Source/CapComSettings.cs
#region license /*The MIT License (MIT) CapComSettings - Serializable object to store configuration options in an external file Copyright (c) 2015 DMagic KSP Plugin Framework by TriggerAu, 2014: http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #endregion using CapCom.Framework; using UnityEngine; namespace CapCom { public class CapComSettings : CC_ConfigNodeStorage { [Persistent] public bool stockToolbar = true; [Persistent] public bool hideBriefing = false; [Persistent] public bool hideNotes = false; [Persistent] public bool showDeclineWarning = true; [Persistent] public bool showCancelWarning = true; [Persistent] public bool tooltipsEnabled = true; //[Persistent] //public bool useKSPStyle = false; [Persistent] public int sortMode = 0; [Persistent] public bool ascending = true; [Persistent] public bool activeLimit = true; [Persistent] public bool forceDecline = false; [Persistent] public bool forceCancel = false; [Persistent] public float windowHeight = 600; [Persistent] public float windowPosX = 50; [Persistent] public float windowPosY = 50; [Persistent] public float windowSize = 0; [Persistent] public KeyCode scrollUp = KeyCode.UpArrow; [Persistent] public KeyCode scrollDown = KeyCode.DownArrow; [Persistent] public KeyCode listRight = KeyCode.RightArrow; [Persistent] public KeyCode listLeft = KeyCode.LeftArrow; [Persistent] public KeyCode accept = KeyCode.Return; [Persistent] public KeyCode cancel = KeyCode.Delete; [Persistent] public KeyCode multiSelect = KeyCode.LeftControl; public CapComSettings (string file) { FilePath = file; NodeName = "DMagicUtilities/CapCom/" + file + "/" + this.GetType().Name; Load(); } } }
#region license /*The MIT License (MIT) CapComSettings - Serializable object to store configuration options in an external file Copyright (c) 2015 DMagic KSP Plugin Framework by TriggerAu, 2014: http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #endregion using CapCom.Framework; using UnityEngine; namespace CapCom { public class CapComSettings : CC_ConfigNodeStorage { [Persistent] public bool stockToolbar = true; [Persistent] public bool hideBriefing = false; [Persistent] public bool hideNotes = false; [Persistent] public bool showDeclineWarning = true; [Persistent] public bool showCancelWarning = true; [Persistent] public bool tooltipsEnabled = true; //[Persistent] //public bool useKSPStyle = false; [Persistent] public int sortMode = 0; [Persistent] public bool ascending = true; [Persistent] public bool activeLimit = true; [Persistent] public bool forceDecline = false; [Persistent] public bool forceCancel = false; [Persistent] public float windowHeight = 600; [Persistent] public float windowPosX = 50; [Persistent] public float windowPosY = 50; [Persistent] public float windowSize = 0; [Persistent] public KeyCode scrollUp = KeyCode.UpArrow; [Persistent] public KeyCode scrollDown = KeyCode.DownArrow; [Persistent] public KeyCode listRight = KeyCode.RightArrow; [Persistent] public KeyCode listLeft = KeyCode.LeftArrow; [Persistent] public KeyCode accept = KeyCode.Return; [Persistent] public KeyCode cancel = KeyCode.Delete; [Persistent] public KeyCode multiSelect = KeyCode.LeftControl; public CapComSettings (string file) { FilePath = file; NodeName = "CapCom/" + file + "/" + this.GetType().Name; Load(); } } }
mit
C#
c6b492b428decf889d82241023ebd96232423ff4
Update Bitmap.cs
Meragon/Unity-WinForms
System/Drawing/Bitmap.cs
System/Drawing/Bitmap.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace System.Drawing { [Serializable] public class Bitmap : Image { public static implicit operator UnityEngine.Texture2D(Bitmap image) { if (image == null) return null; return image.uTexture; } public static implicit operator Bitmap(UnityEngine.Texture2D text) { return new Bitmap(text); } public Bitmap(UnityEngine.Texture2D original) { Color = Color.White; uTexture = original; } public Bitmap(UnityEngine.Texture2D original, Color color) { Color = color; uTexture = original; } public Bitmap(int width, int height) { Color = Color.White; uTexture = new UnityEngine.Texture2D(width, height); } public void Apply() { uTexture.Apply(); } public Color GetPixel(int x, int y) { return Color.FromUColor(uTexture.GetPixel(x, uTexture.height - y)); } public void SetPixel(int x, int y, Color color) { uTexture.SetPixel(x, uTexture.height - y, color.ToUColor()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace System.Drawing { [Serializable] public class Bitmap : Image { public static implicit operator UnityEngine.Texture2D(Bitmap image) { if (image == null) return null; return image.uTexture; } public static implicit operator Bitmap(UnityEngine.Texture2D text) { return new Bitmap(text); } public Bitmap(UnityEngine.Texture2D original) { Color = Color.White; uTexture = original; } public Bitmap(UnityEngine.Texture2D original, Color color) { Color = color; uTexture = original; } public Bitmap(int width, int height) { Color = Color.White; uTexture = new UnityEngine.Texture2D(width, height); } public void Apply() { uTexture.Apply(); } public Color GetPixel(int x, int y) { return Color.FromUColor(uTexture.GetPixel(x, y)); } public void SetPixel(int x, int y, Color color) { uTexture.SetPixel(x, uTexture.height - y, color.ToUColor()); } } }
mit
C#
988370dc7af6bf80303334bd19e16019d244e437
remove prod profiling, fow now
jdaigle/FriendsOfDT,jdaigle/FriendsOfDT,jdaigle/FriendsOfDT,jdaigle/FriendsOfDT
src/FODT/Global.asax.cs
src/FODT/Global.asax.cs
using StackExchange.Profiling; namespace FODT { public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { Startup.ApplicationStart(); } protected void Application_BeginRequest() { #if DEBUG MiniProfiler.Start(); #endif } protected void Application_EndRequest() { #if DEBUG MiniProfiler.Stop(); #endif } } }
using StackExchange.Profiling; namespace FODT { public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { Startup.ApplicationStart(); } protected void Application_BeginRequest() { MiniProfiler.Start(); } protected void Application_EndRequest() { MiniProfiler.Stop(); } } }
mit
C#
b5a587fbbf5a80b0d5edf5393a80e7fbec4b5707
Update Program.cs
jbtule/keyczar-dotnet
Keyczar/KeyczarTool/Program.cs
Keyczar/KeyczarTool/Program.cs
// Copyright 2012 James Tuley ([email protected]) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.Linq; using System.Text; using KeyczarTool.Commands; using ManyConsole; namespace KeyczarTool { public class Program { public static int Main(string[] args) { var commands = new ConsoleCommand[] { new Create(), new AddKey(), new PubKey(), new Promote(), new Demote(), new Revoke(), new ImportKey(), new Export(), new UseKey(), new Password(), }; // run the command for the console input return ConsoleCommandDispatcher.DispatchCommand(commands, args, Console.Out); } } }
// Copyright 2012 James Tuley ([email protected]) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.Linq; using System.Text; using KeyczarTool.Commands; using ManyConsole; namespace KeyczarTool { public class Program { public static int Main(string[] args) { // locate any commands in the assembly (or use an IoC container, or whatever source) var commands = new ConsoleCommand[] { new Create(), new AddKey(), new PubKey(), new Promote(), new Demote(), new Revoke(), new ImportKey(), new Export(), new UseKey(), new Password(), }; // run the command for the console input return ConsoleCommandDispatcher.DispatchCommand(commands, args, Console.Out); } } }
apache-2.0
C#
cbe4071bae8dbc46b2c62c31d87eca265f865516
Set version to 0.3.
strayfatty/ShowFeed,strayfatty/ShowFeed
src/ShowFeed/Properties/AssemblyInfo.cs
src/ShowFeed/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("ShowFeed")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ShowFeed")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("3b3f205e-4800-4725-bfa1-a68a4b1527bd")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("0.3.0.0")] [assembly: AssemblyFileVersion("0.3.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("ShowFeed")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ShowFeed")] [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("3b3f205e-4800-4725-bfa1-a68a4b1527bd")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("0.2.1.0")] [assembly: AssemblyFileVersion("0.2.1.0")]
mit
C#
1aa57c8993530122d351f012de11fd77cba85692
use less words in footer
kreeben/resin,kreeben/resin
src/Sir.HttpServer/Views/_Layout.cshtml
src/Sir.HttpServer/Views/_Layout.cshtml
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="/css/theme.css"> </head> <body> <a href="/" title="Go.go! v0.3a"><h1 class="logo">Go<span class="sub">&#9632;</span>go!</h1></a> <p id="slogan">Another non-tracking search engine.</p> <div> @RenderBody() </div> <footer> <div> @if (ViewData["doc_count"] != null) { <p>Index size: @ViewData["doc_count"] documents</p> } @if (ViewData["last_processed_url"] != null) { <p>Last crawled: <a href="@ViewData["last_processed_url"]">@ViewData["last_processed_title"]</a></p> } <p><a href="/queryparser?collection=www&q=trump%20tower&fields=title&fields=body&skip=0&take=10">Create</a> your own collection.</p> <p>Powered by <a href="https://github.com/kreeben/resin">Resin</a>. Hosted by <a href="https://freenode.net/">freenode</a>.</p> <p>Coming soon: NEAR operator, create collection from query, join between collections, optional semantic search, optional 100% PII-less personalized search</p> </div> </footer> </body> </html>
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="/css/theme.css"> </head> <body> <a href="/" title="Go.go! v0.3a"><h1 class="logo">Go<span class="sub">&#9632;</span>go!</h1></a> <p id="slogan">Another non-tracking search engine.</p> <div> @RenderBody() </div> <footer> <div> @if (ViewData["doc_count"] != null) { <p>Index size: @ViewData["doc_count"] documents</p> } @if (ViewData["last_processed_url"] != null) { <p>Last crawled: <a href="@ViewData["last_processed_url"]">@ViewData["last_processed_title"]</a></p> } <p><a href="/queryparser?collection=www&q=trump%20tower&fields=title&fields=body&skip=0&take=10">Create</a> your own collection.</p> <p>Powered by <a href="https://github.com/kreeben/resin">Resin</a>. Hosted by <a href="https://freenode.net/">freenode</a>.</p> <p>Coming soon to your nearest non-tracking search engine: NEAR operator, create collection from query, join between collections, optional semantic search, optional 100% PII-less personalized search</p> </div> </footer> </body> </html>
mit
C#
c3258ad402d1f6289a52361cf82ece239ba709c6
Update index.cshtml
Wyamio/Wyam.Web,dodyg/Wyam.Web,ibebbs/Wyam.Web,ibebbs/Wyam.Web,Wyamio/Wyam.Web,tareq-s/Wyam.Web,tareq-s/Wyam.Web
Input/index.cshtml
Input/index.cshtml
Title: Introduction --- <p class="lead"><strong>Wyam is different.</strong> It's not a Jekyll clone (not that there's anything wrong with that) and it's not designed around blogs (though it's great at those too). Wyam is a static <em>content</em> generator and can be used to generate web sites, produce documentation, create ebooks, and much more. Since everything is configured by chaining together flexible modules (that you can even write yourself), the only limits to what it can create are your imagination.</p> <div class="alert alert-info" role="alert">Wyam is currently under heavy development, but it is usable today. Read on for more information if you want to get started now and help influence it's future direction.</div> <h1>Features</h1> <hr /> <ul> <li>Flexible <a href="/getting-started/configuration">script-based configuration</a></li> <li>Lots of <a href="/modules">modules</a> for things like <a href="/modules/readfiles">reading</a> and <a href="/modules/writefiles">writing</a> files, handling <a href="/modules/frontmatter">frontmatter</a>, and manipulating <a href="/modules/metadata">metadata</a></li> <li><a href="/modules/yaml">YAML parser</a></li> <li>Support for multiple templating languages including <a href="/modules/razor">Razor</a></li> <li>Integrated <a href="/getting-started/usage">web server</a> for previewing output</li> <li>Integrated <a href="/getting-started/usage">file watching</a> and regeneration</li> <li>Full <a href="/getting-started/configuration#nuget">NuGet support</a></li> <li><a href="/advanced/writing-a-module">Easily extensible</a></li> <li><a href="/advanced/embedded-use">Embeddable engine</a></li> </ul> <h1>Usage</h1> <hr /> <p>The best way to get started is to <a href="/getting-started/usage">use the command line application</a>:</p> <pre>c:\MySite&gt;<strong>Wyam.exe --preview --watch</strong> Loading configuration from c:\MySite\config.wyam. Cleaning output directory c:\MySite\.\Output... Cleaned output directory. Executing 3 pipelines... Executing pipeline "Markdown" (1/3) with 5 child module(s)... Executed pipeline "Markdown" (1/3) resulting in 0 output document(s). Executing pipeline "Razor" (2/3) with 4 child module(s)... Executed pipeline "Razor" (2/3) resulting in 2 output document(s). Executing pipeline "Resources" (3/3) with 1 child module(s)... Executed pipeline "Resources" (3/3) resulting in 21 output document(s). Executed 3 pipelines. Preview server running on port 5080... Watching folder c:\MySite\.\Input... Hit any key to exit... </pre> <p>Read more about <a href="/getting-started/configuration">configuration files</a> and the <a href="/getting-started/usage">available command line arguments</a> in the documentation.</p>
Title: Introduction --- <p class="lead">Wyam is different. It's not a Jekyll clone (not that there's anything wrong with that). Wyam is a static *content* generator. It's not limited to blogs (though it's good at those too) and can be used to generate web sites, produce documentation, create ebooks, and much more. Since everything is configured by chaining together flexible modules (that you can even write yourself), the only limits to what it can create are your imagination.</p> <div class="alert alert-info" role="alert">Wyam is currently under heavy development, but it is usable today. Read on for more information if you want to get started now and help influence it's future direction.</div> <h1>Features</h1> <hr /> <ul> <li>Flexible <a href="/getting-started/configuration">script-based configuration</a></li> <li>Lots of <a href="/modules">modules</a> for things like <a href="/modules/readfiles">reading</a> and <a href="/modules/writefiles">writing</a> files, handling <a href="/modules/frontmatter">frontmatter</a>, and manipulating <a href="/modules/metadata">metadata</a></li> <li><a href="/modules/yaml">YAML parser</a></li> <li>Support for multiple templating languages including <a href="/modules/razor">Razor</a></li> <li>Integrated <a href="/getting-started/usage">web server</a> for previewing output</li> <li>Integrated <a href="/getting-started/usage">file watching</a> and regeneration</li> <li>Full <a href="/getting-started/configuration#nuget">NuGet support</a></li> <li><a href="/advanced/writing-a-module">Easily extensible</a></li> <li><a href="/advanced/embedded-use">Embeddable engine</a></li> </ul> <h1>Usage</h1> <hr /> <p>The best way to get started is to <a href="/getting-started/usage">use the command line application</a>:</p> <pre>c:\MySite&gt;<strong>Wyam.exe --preview --watch</strong> Loading configuration from c:\MySite\config.wyam. Cleaning output directory c:\MySite\.\Output... Cleaned output directory. Executing 3 pipelines... Executing pipeline "Markdown" (1/3) with 5 child module(s)... Executed pipeline "Markdown" (1/3) resulting in 0 output document(s). Executing pipeline "Razor" (2/3) with 4 child module(s)... Executed pipeline "Razor" (2/3) resulting in 2 output document(s). Executing pipeline "Resources" (3/3) with 1 child module(s)... Executed pipeline "Resources" (3/3) resulting in 21 output document(s). Executed 3 pipelines. Preview server running on port 5080... Watching folder c:\MySite\.\Input... Hit any key to exit... </pre> <p>Read more about <a href="/getting-started/configuration">configuration files</a> and the <a href="/getting-started/usage">available command line arguments</a> in the documentation.</p>
mit
C#
6894ddee179f40d14a2b1446afd522216f4073aa
Update TintedImageRenderer.cs
shrutinambiar/xamarin-forms-tinted-image
src/Plugin.CrossPlatformTintedImage.Android/TintedImageRenderer.cs
src/Plugin.CrossPlatformTintedImage.Android/TintedImageRenderer.cs
using System; using Android.Views; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using Android.Graphics; using System.ComponentModel; using Plugin.CrossPlatformTintedImage.Android; using Plugin.CrossPlatformTintedImage.Abstractions; [assembly:ExportRendererAttribute(typeof(TintedImage), typeof(TintedImageRenderer))] namespace Plugin.CrossPlatformTintedImage.Android { public class TintedImageRenderer : ImageRenderer { public static void Init() { } protected override void OnElementChanged(ElementChangedEventArgs<Image> e) { base.OnElementChanged(e); SetTint(); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == TintedImage.TintColorProperty.PropertyName || e.PropertyName == TintedImage.SourceProperty.PropertyName) SetTint(); } void SetTint() { if (Control == null || Element == null) return; if (((TintedImage)Element).TintColor.Equals(Xamarin.Forms.Color.Transparent)) { //Turn off tinting if (Control.ColorFilter != null) Control.ClearColorFilter(); return; } //Apply tint color var colorFilter = new PorterDuffColorFilter(((TintedImage)Element).TintColor.ToAndroid(), PorterDuff.Mode.SrcIn); Control.SetColorFilter(colorFilter); } } }
using System; using Android.Views; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using Android.Graphics; using System.ComponentModel; using Plugin.CrossPlatformTintedImage.Android; using Plugin.CrossPlatformTintedImage.Abstractions; [assembly:ExportRendererAttribute(typeof(TintedImage), typeof(TintedImageRenderer))] namespace Plugin.CrossPlatformTintedImage.Android { public class TintedImageRenderer : ImageRenderer { public static void Init() { } protected override void OnElementChanged(ElementChangedEventArgs<Image> e) { base.OnElementChanged(e); SetTint(); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == TintedImage.TintColorProperty.PropertyName) SetTint(); } void SetTint() { if (Control == null || Element == null) return; if (((TintedImage)Element).TintColor.Equals(Xamarin.Forms.Color.Transparent)) { //Turn off tinting if (Control.ColorFilter != null) Control.ClearColorFilter(); return; } //Apply tint color var colorFilter = new PorterDuffColorFilter(((TintedImage)Element).TintColor.ToAndroid(), PorterDuff.Mode.SrcIn); Control.SetColorFilter(colorFilter); } } }
mit
C#
715839ec1eca2c40dc74758080032c727df13c50
Update formWrangler.cshtml
mcmullengreg/formWrangler
formWrangler.cshtml
formWrangler.cshtml
@inherits umbraco.MacroEngines.DynamicNodeContext @{ if ( String.IsNullOrEmpty(@Parameter.mediaFolder) ) { <div><p>A folder has not been selected</p></div> } var folder = Parameter.mediaFolder; var media = Model.MediaById(folder); } @helper traverse(dynamic node) { var cc = node.Children; if (cc.Count()>0) { <ul> @foreach (var c in cc) { <li> @structure(c) @traverse(c) </li> } </ul> } } @helper structure( dynamic node ){ if ( node.NodeTypeAlias == "Folder" ) { <span class="folder" id="@node.Name.ToLower().Replace(" ", "_")">@node.Name</span> } else { <a href="@node.Url">@node.Name</a> if ( node.description != "" ){ @Html.Raw(@node.description); } } } <div class="formWrangler"> @traverse(media) </div>
@inherits umbraco.MacroEngines.DynamicNodeContext @{ if ( String.IsNullOrEmpty(@Parameter.mediaFolder) ) { <div><p>A folder has not been selected</p></div> } var folder = Parameter.mediaFolder; var media = Model.MediaById(folder); } @helper traverse(dynamic node) { var cc = node.Children; if (cc.Count()>0) { <ul> @foreach (var c in cc) { <li> @structure(c) @traverse(c) </li> } </ul> } } @helper structure( dynamic node ){ if ( node.NodeTypeAlias == "Folder" ) { <span class="folder" id="@node.Name.ToLower().Replace(" ", "_")">@node.Name</span> } else { <a href="@node.Url">@node.Name</a> } } <div class="formWrangler"> @traverse(media) </div>
mit
C#
c74f9d2578f0ef50207e03d54d8b465d8b6f02a6
Update header
Iluvatar82/helix-toolkit,chrkon/helix-toolkit,helix-toolkit/helix-toolkit,JeremyAnsel/helix-toolkit,holance/helix-toolkit
Source/HelixToolkit.Wpf.Tests/Visual3Ds/Text/BillboardTextVisual3DTests.cs
Source/HelixToolkit.Wpf.Tests/Visual3Ds/Text/BillboardTextVisual3DTests.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="BillboardTextVisual3DTests.cs" company="Helix Toolkit"> // Copyright (c) 2014 Helix Toolkit contributors // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace HelixToolkit.Wpf.Tests.Visual3Ds.Text { using System.Windows; using NUnit.Framework; [TestFixture] public class BillboardTextVisual3DTests { [Test] public void MaterialTypeProperty_Metadata_DefaultValues() { PropertyMetadata metadata = BillboardTextVisual3D.MaterialTypeProperty.GetMetadata(typeof(BillboardTextVisual3D)); Assert.AreEqual((MaterialType)metadata.DefaultValue, MaterialType.Diffuse); Assert.NotNull(metadata.PropertyChangedCallback); } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="CubeVisual3DTests.cs" company="Helix Toolkit"> // Copyright (c) 2014 Helix Toolkit contributors // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace HelixToolkit.Wpf.Tests.Visual3Ds.Text { using System.Windows; using NUnit.Framework; [TestFixture] public class BillboardTextVisual3DTests { [Test] public void MaterialTypeProperty_Metadata_DefaultValues() { PropertyMetadata metadata = BillboardTextVisual3D.MaterialTypeProperty.GetMetadata(typeof(BillboardTextVisual3D)); Assert.AreEqual((MaterialType)metadata.DefaultValue, MaterialType.Diffuse); Assert.NotNull(metadata.PropertyChangedCallback); } } }
mit
C#
8d528f631fbb4888b8c7c8d2fde25ca492d39562
Use JAVA_HOME and SIKULI_HOME environment variables
christianrondeau/SikuliSharp,christianrondeau/SikuliSharp
SikuliSharp/SikuliExec.cs
SikuliSharp/SikuliExec.cs
using System; using System.Diagnostics; using System.IO; using System.Text; namespace SikuliSharp { public interface ISikuliExec { string ExecuteProject(string projectPath); } public class SikuliExec : ISikuliExec { public string ExecuteProject(string projectPath) { var javaHome = GetPathEnvironmentVariable("JAVA_HOME"); var sikuliHome = GetPathEnvironmentVariable("SIKULI_HOME"); var sikuliScriptJarPath = Path.Combine(sikuliHome, "sikuli-script.jar"); return RunExternalExe(Path.Combine(javaHome, "bin", "java"), " -jar \"" + sikuliScriptJarPath + "\" -r \"" + projectPath + "\""); } private string GetPathEnvironmentVariable(string name) { var value = Environment.GetEnvironmentVariable(name); if (String.IsNullOrEmpty(value)) throw new Exception(string.Format("Environment variables {0} not set", name)); if (!Directory.Exists(value)) throw new Exception(string.Format("Environment variables {0} is set to a directory that does not exist: {1}", name, value)); return value; } private string RunExternalExe(string filename, string arguments) { var process = new Process { StartInfo = { FileName = filename, Arguments = arguments, CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, UseShellExecute = false, RedirectStandardError = true, RedirectStandardOutput = true } }; var stdOutput = new StringBuilder(); process.OutputDataReceived += (sender, args) => stdOutput.Append(args.Data); process.Start(); process.BeginOutputReadLine(); var stdError = process.StandardError.ReadToEnd(); process.WaitForExit(); if (process.ExitCode == 0) { var output = stdOutput.ToString(); if (output.StartsWith("[error]")) throw new Exception(output); #if(DEBUG) Debug.WriteLine("Command Output:"); Debug.WriteLine(output); #endif return output; } var message = new StringBuilder(); message.AppendLine(stdOutput.ToString()); if (!string.IsNullOrEmpty(stdError)) message.AppendLine(stdError); throw new Exception("Finished with exit code = " + process.ExitCode + ": " + message); } } }
using System; using System.Diagnostics; using System.IO; using System.Text; namespace SikuliSharp { public interface ISikuliExec { string ExecuteProject(string projectPath); } public class SikuliExec : ISikuliExec { public string ExecuteProject(string projectPath) { //TODO: Check for JAVA_HOME, java in PATH or throw //TODO: Find the SIKULI_HOME path, or dynamically install //TODO: Run in interactive mode for faster feedback (instead of launching for every action) const string sikuliHome = @"E:\Dev\Tools\SikuliX"; var sikuliScriptJarPath = Path.Combine(sikuliHome, "sikuli-script.jar"); return RunExternalExe("java", " -jar \"" + sikuliScriptJarPath + "\" -r \"" + projectPath + "\""); } public string RunExternalExe(string filename, string arguments) { var process = new Process { StartInfo = { FileName = filename, Arguments = arguments, CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, UseShellExecute = false, RedirectStandardError = true, RedirectStandardOutput = true } }; var stdOutput = new StringBuilder(); process.OutputDataReceived += (sender, args) => stdOutput.Append(args.Data); process.Start(); process.BeginOutputReadLine(); var stdError = process.StandardError.ReadToEnd(); process.WaitForExit(); if (process.ExitCode == 0) { var output = stdOutput.ToString(); if(output.StartsWith("[error]")) throw new Exception(output); #if(DEBUG) Debug.WriteLine("Command Output:"); Debug.WriteLine(output); #endif return output; } var message = new StringBuilder(); message.AppendLine(stdOutput.ToString()); if (!string.IsNullOrEmpty(stdError)) message.AppendLine(stdError); throw new Exception("Finished with exit code = " + process.ExitCode + ": " + message); } } }
mit
C#
b982e29f72d9449ccb2aa0d34ad72579643776c0
Fix spelling issue
SixLabors/Fonts
src/SixLabors.Fonts/Glyph.cs
src/SixLabors.Fonts/Glyph.cs
// Copyright (c) Six Labors. // Licensed under the Apache License, Version 2.0. using System.Numerics; namespace SixLabors.Fonts { /// <summary> /// A glyph from a particular font face. /// </summary> public readonly struct Glyph { private readonly float pointSize; internal Glyph(GlyphInstance instance, float pointSize) { this.Instance = instance; this.pointSize = pointSize; } /// <summary> /// Gets the glyph instance. /// </summary> /// <value> /// The glyph instance. /// </value> public GlyphInstance Instance { get; } /// <summary> /// Calculates the bounding box /// </summary> /// <param name="location">location to calculate from.</param> /// <param name="dpi">dpi to calualtes in relation to</param> /// <returns>The bounding box</returns> public FontRectangle BoundingBox(Vector2 location, Vector2 dpi) => this.Instance.BoundingBox(location, this.pointSize * dpi); /// <summary> /// Renders to. /// </summary> /// <param name="surface">The surface.</param> /// <param name="location">The location.</param> /// <param name="dpi">The dpi.</param> /// <param name="lineHeight">The line height.</param> internal void RenderTo(IGlyphRenderer surface, Vector2 location, float dpi, float lineHeight) => this.RenderTo(surface, location, dpi, dpi, lineHeight); /// <summary> /// Renders the glyph to the render surface in font units relative to a bottom left origin at (0,0) /// </summary> /// <param name="surface">The surface.</param> /// <param name="location">The location.</param> /// <param name="dpiX">The dpi along the X axis.</param> /// <param name="dpiY">The dpi along the Y axis.</param> /// <param name="lineHeight">The line height.</param> /// <exception cref="System.NotSupportedException">Too many control points</exception> internal void RenderTo(IGlyphRenderer surface, Vector2 location, float dpiX, float dpiY, float lineHeight) => this.Instance.RenderTo(surface, this.pointSize, location, new Vector2(dpiX, dpiY), lineHeight); } }
// Copyright (c) Six Labors. // Licensed under the Apache License, Version 2.0. using System.Numerics; namespace SixLabors.Fonts { /// <summary> /// A glyph from a particular font face. /// </summary> public readonly struct Glyph { private readonly float pointSize; internal Glyph(GlyphInstance instance, float pointSize) { this.Instance = instance; this.pointSize = pointSize; } /// <summary> /// Gets the glyph instance. /// </summary> /// <value> /// The glyph instance. /// </value> public GlyphInstance Instance { get; } /// <summary> /// Calculates the bounding box /// </summary> /// <param name="location">location to calualte from.</param> /// <param name="dpi">dpi to calualtes in relation to</param> /// <returns>The bounding box</returns> public FontRectangle BoundingBox(Vector2 location, Vector2 dpi) => this.Instance.BoundingBox(location, this.pointSize * dpi); /// <summary> /// Renders to. /// </summary> /// <param name="surface">The surface.</param> /// <param name="location">The location.</param> /// <param name="dpi">The dpi.</param> /// <param name="lineHeight">The line height.</param> internal void RenderTo(IGlyphRenderer surface, Vector2 location, float dpi, float lineHeight) => this.RenderTo(surface, location, dpi, dpi, lineHeight); /// <summary> /// Renders the glyph to the render surface in font units relative to a bottom left origin at (0,0) /// </summary> /// <param name="surface">The surface.</param> /// <param name="location">The location.</param> /// <param name="dpiX">The dpi along the X axis.</param> /// <param name="dpiY">The dpi along the Y axis.</param> /// <param name="lineHeight">The line height.</param> /// <exception cref="System.NotSupportedException">Too many control points</exception> internal void RenderTo(IGlyphRenderer surface, Vector2 location, float dpiX, float dpiY, float lineHeight) => this.Instance.RenderTo(surface, this.pointSize, location, new Vector2(dpiX, dpiY), lineHeight); } }
apache-2.0
C#
4cb2c4b494ab229fe81c8032ee530ea69bd4abf0
Support both landscape and portrait mode
ppy/osu,johnneijzen/osu,NeoAdonis/osu,2yangk23/osu,UselessToucan/osu,ppy/osu,EVAST9919/osu,peppy/osu,johnneijzen/osu,UselessToucan/osu,smoogipooo/osu,2yangk23/osu,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,UselessToucan/osu,smoogipoo/osu,ZLima12/osu,NeoAdonis/osu,smoogipoo/osu,EVAST9919/osu,peppy/osu,ZLima12/osu,smoogipoo/osu
osu.Android/OsuGameActivity.cs
osu.Android/OsuGameActivity.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using Android.App; using Android.Content.PM; using Android.OS; using Android.Views; using osu.Framework.Android; namespace osu.Android { [Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullSensor, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = true)] public class OsuGameActivity : AndroidGameActivity { protected override Framework.Game CreateGame() => new OsuGameAndroid(); protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Window.AddFlags(WindowManagerFlags.Fullscreen); Window.AddFlags(WindowManagerFlags.KeepScreenOn); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using Android.App; using Android.Content.PM; using Android.OS; using Android.Views; using osu.Framework.Android; namespace osu.Android { [Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.SensorLandscape, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = true)] public class OsuGameActivity : AndroidGameActivity { protected override Framework.Game CreateGame() => new OsuGameAndroid(); protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Window.AddFlags(WindowManagerFlags.Fullscreen); Window.AddFlags(WindowManagerFlags.KeepScreenOn); } } }
mit
C#
f92c62877049f68e340627a345fad04f39b4fd29
Add ability to set width and height when setting the image
kswoll/WootzJs,x335/WootzJs,x335/WootzJs,kswoll/WootzJs,x335/WootzJs,kswoll/WootzJs
WootzJs.Mvc/Mvc/Views/Image.cs
WootzJs.Mvc/Mvc/Views/Image.cs
using WootzJs.Mvc.Mvc.Views.Css; using WootzJs.Web; namespace WootzJs.Mvc.Mvc.Views { public class Image : InlineControl { public Image() { } public Image(string source, int? width = null, int? height = null) { Source = source; if (width != null) Width = width.Value; if (height != null) Height = height.Value; } public Image(string defaultSource, string highlightedSource) { Source = defaultSource; MouseEntered += () => Source = highlightedSource; MouseExited += () => Source = defaultSource; } public Image(string defaultSource, string highlightedSource, CssColor highlightColor) { Source = defaultSource; MouseEntered += () => { Source = highlightedSource; Style.BackgroundColor = highlightColor; }; MouseExited += () => { Source = defaultSource; Style.BackgroundColor = CssColor.Inherit; }; } public int Width { get { return int.Parse(Node.GetAttribute("width")); } set { Node.SetAttribute("width", value.ToString()); } } public int Height { get { return int.Parse(Node.GetAttribute("height")); } set { Node.SetAttribute("height", value.ToString()); } } public string Source { get { return Node.GetAttribute("src"); } set { Node.SetAttribute("src", value); } } protected override Element CreateNode() { var node = Browser.Document.CreateElement("img"); node.Style.Display = "block"; return node; } } }
using WootzJs.Mvc.Mvc.Views.Css; using WootzJs.Web; namespace WootzJs.Mvc.Mvc.Views { public class Image : InlineControl { public Image() { } public Image(string source) { Source = source; } public Image(string defaultSource, string highlightedSource) { Source = defaultSource; MouseEntered += () => Source = highlightedSource; MouseExited += () => Source = defaultSource; } public Image(string defaultSource, string highlightedSource, CssColor highlightColor) { Source = defaultSource; MouseEntered += () => { Source = highlightedSource; Style.BackgroundColor = highlightColor; }; MouseExited += () => { Source = defaultSource; Style.BackgroundColor = CssColor.Inherit; }; } public int Width { get { return int.Parse(Node.GetAttribute("width")); } set { Node.SetAttribute("width", value.ToString()); } } public int Height { get { return int.Parse(Node.GetAttribute("height")); } set { Node.SetAttribute("height", value.ToString()); } } public string Source { get { return Node.GetAttribute("src"); } set { Node.SetAttribute("src", value); } } protected override Element CreateNode() { var node = Browser.Document.CreateElement("img"); node.Style.Display = "block"; return node; } } }
mit
C#
a003b6e12ca34e59b75d2843e3df910bc3e4a7e9
Increment version
R-Smith/vmPing
vmPing/Properties/AssemblyInfo.cs
vmPing/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("vmPing")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("vmPing")] [assembly: AssemblyCopyright("Copyright © 2021 Ryan Smith")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.18")] [assembly: AssemblyFileVersion("1.3.18")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("vmPing")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("vmPing")] [assembly: AssemblyCopyright("Copyright © 2021 Ryan Smith")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.17.1")] [assembly: AssemblyFileVersion("1.3.17.1")]
mit
C#
b7b57ea98dedbb9fcc3c95426c790a0425cbf174
Fix link title on footer. (#220)
reactiveui/website,reactiveui/website,reactiveui/website,reactiveui/website
input/_Footer.cshtml
input/_Footer.cshtml
<div class="container bottom-footer"> <div class="col-lg-10 col-sm-10 col-xs-12"> <ul class="list-inline"> <li class="list-inline-item"> <a href="/team" target="_blank">Team</a> </li> <li class="list-inline-item"> <a href="/sponsorship" target="_blank">Sponsorship</a> </li> <li class="list-inline-item"> <a href="/support" target="_blank">Support</a> </li> <li class="list-inline-item"> <a href="/stackoverflow" target="_blank">StackOverflow</a> </li> <li class="list-inline-item"> <a href="/branding" target="_blank">Branding</a> </li> <li> <a href="/source-code" target="_blank">Source Code</a> </li> <li class="list-inline-item"> <a href="/docs" target="_blank">Documentation</a> </li> <li class="list-inline-item"> <a href="/changelog" target="_blank">Changelog</a> </li> </ul> </div> <div class="col-lg-2 col-sm-2 col-xs-12"> <a href="/"><img src="./assets/img/logo.png" width="64" height="64" class="footer-logo" ></a> </div> </div>
<div class="container bottom-footer"> <div class="col-lg-10 col-sm-10 col-xs-12"> <ul class="list-inline"> <li class="list-inline-item"> <a href="/team" target="_blank">Branding</a> </li> <li class="list-inline-item"> <a href="/sponsorship" target="_blank">Sponsorship</a> </li> <li class="list-inline-item"> <a href="/support" target="_blank">Support</a> </li> <li class="list-inline-item"> <a href="/stackoverflow" target="_blank">StackOverflow</a> </li> <li class="list-inline-item"> <a href="/branding" target="_blank">Branding</a> </li> <li> <a href="/source-code" target="_blank">Source Code</a> </li> <li class="list-inline-item"> <a href="/docs" target="_blank">Documentation</a> </li> <li class="list-inline-item"> <a href="/changelog" target="_blank">Changelog</a> </li> </ul> </div> <div class="col-lg-2 col-sm-2 col-xs-12"> <a href="/"><img src="./assets/img/logo.png" width="64" height="64" class="footer-logo" ></a> </div> </div>
mit
C#
1270578e11c5625a98f484bbe09a5872819eb828
Update Test.cs
hesham8/Rotten-Tomatoes,hesham8/Rotten-Tomatoes
RT.UITests/Test.cs
RT.UITests/Test.cs
using System; using NUnit.Framework; using System.Reflection; using System.IO; using Xamarin.UITest.iOS; using Xamarin.UITest; using Xamarin.UITest.Queries; using System.Linq; namespace RT.UITests { [TestFixture ()] public class Test { iOSApp _app; public string PathToIPA { get; set; } [TestFixtureSetUp] public void TestFixtureSetup() { string currentFile = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath; FileInfo fi = new FileInfo(currentFile); string dir = fi.Directory.Parent.Parent.Parent.FullName; PathToIPA = Path.Combine(dir, "RT", "bin", "iPhoneSimulator", "Debug", "RTiOS.app"); } [SetUp] public void SetUp() { _app = ConfigureApp.iOS.AppBundle(PathToIPA).StartApp(); } [Test ()] public void TestCase () { Func<AppQuery, AppQuery> topBoxOffice = e => e.Id ("topBox0"); _app.ScrollDown(); // is bugged in simulator. Only works on real devices -- I have no test device at the moment _app.WaitForElement (topBoxOffice, "Timed out waiting for top box office..."); var cell = _app.Query (topBoxOffice).SingleOrDefault(); var rating = cell.Label; Assert.Equals (rating, "Rotten"); } } }
using System; using NUnit.Framework; using System.Reflection; using System.IO; using Xamarin.UITest.iOS; using Xamarin.UITest; using Xamarin.UITest.Queries; using System.Linq; namespace RT.UITests { [TestFixture ()] public class Test { iOSApp _app; public string PathToIPA { get; set; } [TestFixtureSetUp] public void TestFixtureSetup() { string currentFile = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath; FileInfo fi = new FileInfo(currentFile); string dir = fi.Directory.Parent.Parent.Parent.FullName; PathToIPA = Path.Combine(dir, "RT", "bin", "iPhoneSimulator", "Debug", "RTiOS.app"); } [SetUp] public void SetUp() { _app = ConfigureApp.iOS.AppBundle(PathToIPA).StartApp(); } [Test ()] public void TestCase () { Func<AppQuery, AppQuery> topBoxOffice = e => e.Id ("topBox0"); //_app.ScrollDown() is bugged?? //Solution is to manually scroll down on test device. _app.WaitForElement (topBoxOffice, "Timed out waiting for top box office..."); var cell = _app.Query (topBoxOffice).SingleOrDefault(); var rating = cell.Label; Assert.Equals (rating, "Rotten"); } } }
mit
C#
d2f1d4c6dae98a3d0defca930857b5625c7aa982
create less garbage
dmanning23/AverageBuddy
Source/Averager.cs
Source/Averager.cs
using System.Collections.Generic; using Microsoft.CSharp; using System; namespace AverageBuddy { /// <summary> /// Template class to help calculate the average value of a history of values. /// This can only be used with types that have a 'zero' and that have the += and / operators overloaded. /// Example: Used to smooth frame rate calculations. /// </summary> /// <typeparam name="T"></typeparam> public class Averager<T> where T : struct { #region Members /// <summary> /// this holds the history /// </summary> private List<T> History { get; set; } /// <summary> /// The max smaple size we want /// </summary> public int MaxSize { get; set; } /// <summary> /// an example of the 'zero' value of the type to be smoothed. /// This would be something like Vector2D(0,0) /// </summary> private T ZeroValue; int _iNext = 0; #endregion //Members #region Methods //to instantiate a Smoother pass it the number of samples you want //to use in the smoothing, and an exampe of a 'zero' type public Averager(int SampleSize, T zeroValue) { History = new List<T>(); MaxSize = SampleSize; ZeroValue = zeroValue; for (int i = 0; i < MaxSize; i++) { History.Add(ZeroValue); } } /// <summary> /// each time you want to get a new average, feed it the most recent value /// and this method will return an average over the last SampleSize updates /// </summary> /// <param name="MostRecentValue"></param> /// <returns></returns> public T Update(T MostRecentValue) { //add the new value to the correct index History[_iNext] = MostRecentValue; _iNext++; if (_iNext >= MaxSize) { _iNext = 0; } //now to calculate the average of the history list dynamic sum = ZeroValue; dynamic count = History.Count; foreach (var iter in History) { sum += iter; } return sum / count; } #endregion //Methods } }
using System.Collections.Generic; using Microsoft.CSharp; using System; namespace AverageBuddy { /// <summary> /// Template class to help calculate the average value of a history of values. /// This can only be used with types that have a 'zero' and that have the += and / operators overloaded. /// Example: Used to smooth frame rate calculations. /// </summary> /// <typeparam name="T"></typeparam> public class Averager<T> where T : struct { #region Members /// <summary> /// this holds the history /// </summary> private Queue<T> History { get; set; } /// <summary> /// The max smaple size we want /// </summary> public int MaxSize { get; set; } /// <summary> /// an example of the 'zero' value of the type to be smoothed. /// This would be something like Vector2D(0,0) /// </summary> private T ZeroValue; #endregion //Members #region Methods //to instantiate a Smoother pass it the number of samples you want //to use in the smoothing, and an exampe of a 'zero' type public Averager(int SampleSize, T zeroValue) { History = new Queue<T>(); MaxSize = SampleSize; ZeroValue = zeroValue; } /// <summary> /// each time you want to get a new average, feed it the most recent value /// and this method will return an average over the last SampleSize updates /// </summary> /// <param name="MostRecentValue"></param> /// <returns></returns> public T Update(T MostRecentValue) { //add the new value to the beginning History.Enqueue(MostRecentValue); //pop enough items off to stay in the correct size while (History.Count > MaxSize) { History.Dequeue(); } //now to calculate the average of the history list dynamic sum = ZeroValue; dynamic count = History.Count; foreach (var iter in History) { sum += iter; } return sum / count; } #endregion //Methods } }
mit
C#
86f8cbd2567a2c1a6680525512d360dce74430d6
Bump version to 0.10.5
quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot
CactbotOverlay/Properties/AssemblyInfo.cs
CactbotOverlay/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CactbotOverlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CactbotOverlay")] [assembly: AssemblyCopyright("Copyright 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")] // Version: // - Major Version // - Minor Version // - Build Number // - Revision // GitHub has only 3 version components, so Revision should always be 0. [assembly: AssemblyVersion("0.10.5.0")] [assembly: AssemblyFileVersion("0.10.5.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CactbotOverlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CactbotOverlay")] [assembly: AssemblyCopyright("Copyright 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")] // Version: // - Major Version // - Minor Version // - Build Number // - Revision // GitHub has only 3 version components, so Revision should always be 0. [assembly: AssemblyVersion("0.10.4.0")] [assembly: AssemblyFileVersion("0.10.4.0")]
apache-2.0
C#
d8c8922c65ea85352a73d1d0bab4abc8273fc3c3
switch to [FromBody] binding on create casual
MassDebaters/DebateApp,MassDebaters/DebateApp,MassDebaters/DebateApp
DebateAppDomain/DebateAppDomainAPI/Controllers/DebatesController.cs
DebateAppDomain/DebateAppDomainAPI/Controllers/DebatesController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using DebateAppDomainAPI.Models; using DebateApp.Domain; using System.Net.Http; namespace DebateAppDomainAPI.Controllers { [Produces("application/json")] [Route("api/[controller]/[action]")] public class DebatesController : Controller { private DBHelper _dbh = new DBHelper(); [HttpPost] //Create Casual expects an httppost with form data in the following format: //int UserID = //string Topic = //string Category = //string Opener = public DebateModel CreateCasual([FromBody]FormDataModels.CreateCasualModel cm) { var u = _dbh.DBGetUser(cm.UserID); u.Transfer(); var c = new Casual(u.UserLogic, cm.Topic, cm.Category, cm.Opener); c.GetStage(); var d = new DebateModel(c); var res = _dbh.DBCreateDebate(d); return res; } [HttpGet("{id}")] public DebateModel GetDebate(int id) { return _dbh.DBGetDebate(id); } [HttpGet] public List<DebateModel> GetAllDebate() { return _dbh.DBGetAllDebate(); } [HttpGet("{id}")] public DebateModel StartDebate(int id) { return _dbh.StartDebate(id); } [HttpPut("{id}")] public DebateModel NextRound(int id, [FromBody]bool value) { return _dbh.NextRound(id, value); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using DebateAppDomainAPI.Models; using DebateApp.Domain; using System.Net.Http; namespace DebateAppDomainAPI.Controllers { [Produces("application/json")] [Route("api/[controller]/[action]")] public class DebatesController : Controller { private DBHelper _dbh = new DBHelper(); [HttpPost] //Create Casual expects an httppost with form data in the following format: //int UserID = //string Topic = //string Category = //string Opener = public DebateModel CreateCasual([FromForm]FormDataModels.CreateCasualModel cm) { var u = _dbh.DBGetUser(cm.UserID); u.Transfer(); var c = new Casual(u.UserLogic, cm.Topic, cm.Category, cm.Opener); c.GetStage(); var d = new DebateModel(c); var res = _dbh.DBCreateDebate(d); return res; } [HttpGet("{id}")] public DebateModel GetDebate(int id) { return _dbh.DBGetDebate(id); } [HttpGet] public List<DebateModel> GetAllDebate() { return _dbh.DBGetAllDebate(); } [HttpGet("{id}")] public DebateModel StartDebate(int id) { return _dbh.StartDebate(id); } [HttpPut("{id}")] public DebateModel NextRound(int id, [FromBody]bool value) { return _dbh.NextRound(id, value); } } }
mit
C#
5853cb11cc4fda68fb34a30355f8b9469eff9f28
Call signalr hub base method in case of exception in user codes of signalr hub events class
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
Foundation/Server/Foundation.Api/Middlewares/Signalr/MessagesHub.cs
Foundation/Server/Foundation.Api/Middlewares/Signalr/MessagesHub.cs
using System.Threading.Tasks; using Microsoft.AspNet.SignalR; using Microsoft.Owin; using Foundation.Api.Middlewares.SignalR.Contracts; namespace Foundation.Api.Middlewares.SignalR { public class MessagesHub : Hub { public override async Task OnConnected() { try { IOwinContext context = new OwinContext(Context.Request.Environment); Core.Contracts.IDependencyResolver dependencyResolver = context.Get<Core.Contracts.IDependencyResolver>("DependencyResolver"); await dependencyResolver.Resolve<IMessagesHubEvents>().OnConnected(this); } finally { await base.OnConnected(); } } public override async Task OnDisconnected(bool stopCalled) { try { IOwinContext context = new OwinContext(Context.Request.Environment); Core.Contracts.IDependencyResolver dependencyResolver = context.Get<Core.Contracts.IDependencyResolver>("DependencyResolver"); await dependencyResolver.Resolve<IMessagesHubEvents>().OnDisconnected(this, stopCalled); } finally { await base.OnDisconnected(stopCalled); } } public override async Task OnReconnected() { try { IOwinContext context = new OwinContext(Context.Request.Environment); Core.Contracts.IDependencyResolver dependencyResolver = context.Get<Core.Contracts.IDependencyResolver>("DependencyResolver"); await dependencyResolver.Resolve<IMessagesHubEvents>().OnReconnected(this); } finally { await base.OnReconnected(); } } } }
using System.Threading.Tasks; using Microsoft.AspNet.SignalR; using Microsoft.Owin; using Foundation.Api.Middlewares.SignalR.Contracts; namespace Foundation.Api.Middlewares.SignalR { public class MessagesHub : Hub { public override async Task OnConnected() { IOwinContext context = new OwinContext(Context.Request.Environment); Core.Contracts.IDependencyResolver dependencyResolver = context.Get<Core.Contracts.IDependencyResolver>("DependencyResolver"); await dependencyResolver.Resolve<IMessagesHubEvents>().OnConnected(this); await base.OnConnected(); } public override async Task OnDisconnected(bool stopCalled) { IOwinContext context = new OwinContext(Context.Request.Environment); Core.Contracts.IDependencyResolver dependencyResolver = context.Get<Core.Contracts.IDependencyResolver>("DependencyResolver"); await dependencyResolver.Resolve<IMessagesHubEvents>().OnDisconnected(this, stopCalled); await base.OnDisconnected(stopCalled); } public override async Task OnReconnected() { IOwinContext context = new OwinContext(Context.Request.Environment); Core.Contracts.IDependencyResolver dependencyResolver = context.Get<Core.Contracts.IDependencyResolver>("DependencyResolver"); await dependencyResolver.Resolve<IMessagesHubEvents>().OnReconnected(this); await base.OnReconnected(); } } }
mit
C#
df6b0a45533d54133055f7997c6157607179c0dc
Use absolute path on linux
Mako88/dxx-tracker
RebirthTracker/RebirthTracker/Configuration.cs
RebirthTracker/RebirthTracker/Configuration.cs
using System.Runtime.InteropServices; namespace RebirthTracker { /// <summary> /// Class to keep track of OS-specific configuration settings /// </summary> public static class Configuration { /// <summary> /// Get the folder where files should be stored /// </summary> public static string GetDataDir() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return "..\\..\\..\\..\\..\\"; } return "/var/www/"; } } }
using System.Runtime.InteropServices; namespace RebirthTracker { /// <summary> /// Class to keep track of OS-specific configuration settings /// </summary> public static class Configuration { /// <summary> /// Get the folder where files should be stored /// </summary> public static string GetDataDir() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return "..\\..\\..\\..\\..\\"; } return "../../../../../../"; } } }
mit
C#
c86284f91375ead674e3f0dfc8e5f390e744cd49
Edit sub tweak
bergthor13/Skermstafir,bergthor13/Skermstafir,bergthor13/Skermstafir
Skermstafir/Views/Subtitle/EditSubtitle.cshtml
Skermstafir/Views/Subtitle/EditSubtitle.cshtml
@model Skermstafir.Models.SubtitleModel @{ ViewBag.Title = "Edit Subtitle"; } <div class="subtitle-box"> <div class="box-title"> <p>Gladiator</p> <p class="votes-req-page">▲ 15</p> </div> <div class="flokkar disabled"> <input type="checkbox" id="genre1" /> <label for="genre1">Kvikmyndir</label> <input type="checkbox" id="genre2" /> <label for="genre2">Þættir</label> <input type="checkbox" id="genre3" /> <label for="genre3">Barnaefni</label> <input type="checkbox" id="genre4" /> <label for="genre4">Heimildir</label> <br /> <input type="checkbox" id="genre5" /> <label for="genre5">Gaman</label> <input type="checkbox" id="genre6" /> <label for="genre6">Spenna</label> <input type="checkbox" id="genre7" /> <label for="genre7">Drama</label> <input type="checkbox" id="genre8" /> <label for="genre8">Ævintýri</label> </div> <p>Stofnandi þýðingu: </p> <p>Útgáfuár:</p> <input type="text" name="year" value="2014" /> <textarea>Hér kemur lýsing á myndinni.</textarea> <textarea cols="20" rows="20"></textarea> <textarea cols="20" rows="20"></textarea> </div>
@model Skermstafir.Models.SubtitleModel @{ ViewBag.Title = "Edit Subtitle"; } <div class="subtitle-box"> <div class="box-title"> <p>Gladiator</p> <p class="votes-req-page">▲ 15</p> </div> <div class="flokkar disabled"> <input type="checkbox" id="genre1" /> <label for="genre1">Kvikmyndir</label> <input type="checkbox" id="genre2" /> <label for="genre2">Þættir</label> <input type="checkbox" id="genre3" /> <label for="genre3">Barnaefni</label> <input type="checkbox" id="genre4" /> <label for="genre4">Heimildir</label> <br /> <input type="checkbox" id="genre5" /> <label for="genre5">Gaman</label> <input type="checkbox" id="genre6" /> <label for="genre6">Spenna</label> <input type="checkbox" id="genre7" /> <label for="genre7">Drama</label> <input type="checkbox" id="genre8" /> <label for="genre8">Ævintýri</label> </div> <p>Stofnandi þýðingu: </p> <p>Útgáfuár:</p> <input class="disabled" type="text" name="year" value="2014" /> <textarea class="disabled">Hér kemur lýsing á myndinni.</textarea> <textarea cols="20" rows="20"></textarea> <textarea cols="20" rows="20"></textarea> </div>
mit
C#
c25ae87a8f441ff8b47e3fa21c0af6c72dbf4267
Update version from 1.2 to 1.3
Spryng/SpryngApiHttpDotNet
SpryngApiHttpDotNet/Properties/AssemblyInfo.cs
SpryngApiHttpDotNet/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("SpryngHttpApiDotNet")] [assembly: AssemblyDescription("Spryng Http Api .NET Library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Spryng")] [assembly: AssemblyProduct("SpryngHttpApiDotNet")] [assembly: AssemblyCopyright("Spryng © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("678f2f8b-1255-4b87-b170-b35bbe5b2d4a")] // 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.3.0.0")] [assembly: AssemblyFileVersion("1.3.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("SpryngHttpApiDotNet")] [assembly: AssemblyDescription("Spryng Http Api .NET Library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Spryng")] [assembly: AssemblyProduct("SpryngHttpApiDotNet")] [assembly: AssemblyCopyright("Spryng © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("678f2f8b-1255-4b87-b170-b35bbe5b2d4a")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.2.0.0")] [assembly: AssemblyFileVersion("1.2.0.0")]
bsd-2-clause
C#
6eff86952190b0a6042183606a450f68e0084d5a
Update comment
wvdd007/roslyn,KevinRansom/roslyn,weltkante/roslyn,physhi/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,eriawan/roslyn,mavasani/roslyn,dotnet/roslyn,eriawan/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,physhi/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,dotnet/roslyn,physhi/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,diryboy/roslyn,sharwell/roslyn,eriawan/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,sharwell/roslyn,sharwell/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn
src/VisualStudio/Core/Def/Storage/VisualStudioCloudCacheServiceProvider.cs
src/VisualStudio/Core/Def/Storage/VisualStudioCloudCacheServiceProvider.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Composition; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Storage; using Microsoft.VisualStudio.RpcContracts.Caching; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.ServiceBroker; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Storage { [ExportWorkspaceService(typeof(ICloudCacheServiceProvider), ServiceLayer.Host), Shared] internal class VisualStudioCloudCacheServiceProvider : ICloudCacheServiceProvider { private readonly IAsyncServiceProvider _serviceProvider; private readonly IThreadingContext _threadingContext; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioCloudCacheServiceProvider( IThreadingContext threadingContext, SVsServiceProvider serviceProvider) { _threadingContext = threadingContext; _serviceProvider = (IAsyncServiceProvider)serviceProvider; } public async ValueTask<ICloudCacheService> CreateCacheAsync(CancellationToken cancellationToken) { var serviceContainer = await _serviceProvider.GetServiceAsync<SVsBrokeredServiceContainer, IBrokeredServiceContainer>().ConfigureAwait(false); var serviceBroker = serviceContainer.GetFullAccessServiceBroker(); #pragma warning disable ISB001 // Dispose of proxies // cache service will be disposed inside VisualStudioCloudCacheService.Dispose var cacheService = await serviceBroker.GetProxyAsync<ICacheService>(VisualStudioServices.VS2019_10.CacheService, cancellationToken: cancellationToken).ConfigureAwait(false); #pragma warning restore ISB001 // Dispose of proxies Contract.ThrowIfNull(cacheService); return new VisualStudioCloudCacheService(_threadingContext, cacheService); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Composition; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Storage; using Microsoft.VisualStudio.RpcContracts.Caching; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.ServiceBroker; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Storage { [ExportWorkspaceService(typeof(ICloudCacheServiceProvider), ServiceLayer.Host), Shared] internal class VisualStudioCloudCacheServiceProvider : ICloudCacheServiceProvider { private readonly IAsyncServiceProvider _serviceProvider; private readonly IThreadingContext _threadingContext; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioCloudCacheServiceProvider( IThreadingContext threadingContext, SVsServiceProvider serviceProvider) { _threadingContext = threadingContext; _serviceProvider = (IAsyncServiceProvider)serviceProvider; } public async ValueTask<ICloudCacheService> CreateCacheAsync(CancellationToken cancellationToken) { var serviceContainer = await _serviceProvider.GetServiceAsync<SVsBrokeredServiceContainer, IBrokeredServiceContainer>().ConfigureAwait(false); var serviceBroker = serviceContainer.GetFullAccessServiceBroker(); #pragma warning disable ISB001 // Dispose of proxies // cache service will be disposed inside VisualStudioCloudCachePersistentStorage.Dispose var cacheService = await serviceBroker.GetProxyAsync<ICacheService>(VisualStudioServices.VS2019_10.CacheService, cancellationToken: cancellationToken).ConfigureAwait(false); #pragma warning restore ISB001 // Dispose of proxies Contract.ThrowIfNull(cacheService); return new VisualStudioCloudCacheService(_threadingContext, cacheService); } } }
mit
C#
098f86e0adf92ccaf0430ce5f3e1aea6142980df
Improve exception message
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Extensions/ExceptionExtensions.cs
WalletWasabi/Extensions/ExceptionExtensions.cs
using System.Collections.Generic; using System.Net.Http; using System.Text; using WalletWasabi.Helpers; using WalletWasabi.Hwi.Exceptions; namespace System { public static class ExceptionExtensions { public static string ToTypeMessageString(this Exception ex) { var trimmed = Guard.Correct(ex.Message); if (trimmed == "") { if (ex is HwiException hwiEx) { return $"{hwiEx.GetType().Name}: {hwiEx.ErrorCode}"; } return ex.GetType().Name; } else { return $"{ex.GetType().Name}: {ex.Message}"; } } public static Dictionary<string, string> BitcoinCoreTranslations { get; } = new Dictionary<string, string> { ["too-long-mempool-chain"] = "At least one coin you are trying to spend is part of long or heavy chain of unconfirmed transactions. You must wait for some previous transactions to confirm.", ["bad-txns-inputs-missingorspent"] = "At least one coin you are trying to spend is already spent.", ["missing-inputs"] = "At least one coin you are trying to spend is already spent.", ["txn-mempool-conflict"] = "At least one coin you are trying to spend is already spent.", ["bad-txns-inputs-duplicate"] = "The transaction contains duplicated inputs.", ["bad-txns-nonfinal"] = "The transaction is not final and cannot be broadcasted.", ["bad-txns-oversize"] = "The transaction is too big." }; public static string ToUserFriendlyString(this HttpRequestException ex) { var trimmed = Guard.Correct(ex.Message); if (trimmed == "") { return ex.ToTypeMessageString(); } else { foreach (KeyValuePair<string, string> pair in BitcoinCoreTranslations) { if (trimmed.Contains(pair.Key, StringComparison.InvariantCultureIgnoreCase)) { return pair.Value; } } return ex.ToTypeMessageString(); } } } }
using System.Collections.Generic; using System.Net.Http; using WalletWasabi.Helpers; namespace System { public static class ExceptionExtensions { public static string ToTypeMessageString(this Exception ex) { var trimmed = Guard.Correct(ex.Message); return trimmed == "" ? ex.GetType().Name : $"{ex.GetType().Name}: {ex.Message}"; } public static Dictionary<string, string> BitcoinCoreTranslations { get; } = new Dictionary<string, string> { ["too-long-mempool-chain"] = "At least one coin you are trying to spend is part of long or heavy chain of unconfirmed transactions. You must wait for some previous transactions to confirm.", ["bad-txns-inputs-missingorspent"] = "At least one coin you are trying to spend is already spent.", ["missing-inputs"] = "At least one coin you are trying to spend is already spent.", ["txn-mempool-conflict"] = "At least one coin you are trying to spend is already spent.", ["bad-txns-inputs-duplicate"] = "The transaction contains duplicated inputs.", ["bad-txns-nonfinal"] = "The transaction is not final and cannot be broadcasted.", ["bad-txns-oversize"] = "The transaction is too big." }; public static string ToUserFriendlyString(this HttpRequestException ex) { var trimmed = Guard.Correct(ex.Message); if (trimmed == "") { return ex.ToTypeMessageString(); } else { foreach (KeyValuePair<string, string> pair in BitcoinCoreTranslations) { if (trimmed.Contains(pair.Key, StringComparison.InvariantCultureIgnoreCase)) { return pair.Value; } } return ex.ToTypeMessageString(); } } } }
mit
C#
76e7b77248d612f68c7da881b0401c0c03fccff3
Fix template.
Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex
backend/src/Squidex.Domain.Apps.Entities/Apps/Commands/CreateApp.cs
backend/src/Squidex.Domain.Apps.Entities/Apps/Commands/CreateApp.cs
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System.Runtime.Serialization; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; namespace Squidex.Domain.Apps.Entities.Apps.Commands { public sealed class CreateApp : AppCommand, IAggregateCommand { public DomainId AppId { get; set; } public string Name { get; set; } public string? Template { get; set; } [IgnoreDataMember] public override DomainId AggregateId { get => AppId; } public CreateApp() { AppId = DomainId.NewGuid(); } } }
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System.Runtime.Serialization; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; namespace Squidex.Domain.Apps.Entities.Apps.Commands { public sealed class CreateApp : AppCommand, IAggregateCommand { public DomainId AppId { get; set; } public string Name { get; set; } [IgnoreDataMember] public override DomainId AggregateId { get => AppId; } public CreateApp() { AppId = DomainId.NewGuid(); } } }
mit
C#
5809732441d75b39f6ca6fc26c10c04e5de501a1
Create a TODO to revert the locking code.
SludgeVohaul/P2EApp
P2E.Services/UserCredentialsService.cs
P2E.Services/UserCredentialsService.cs
using System; using System.Text; using P2E.Interfaces.Services; namespace P2E.Services { public class UserCredentialsService : IUserCredentialsService { // TODO - revert that stuipd locking idea and introduce a Credentials class instead. // Syncs console output/input between instance so that only one // instance can request user credentials at any time. private static readonly object LockObject = new object(); public string Loginname { get; private set; } public string Password { get; private set; } public void GetUserCredentials() { // Each instance can request credentials only once. if (HasUserCredentials) return; lock (LockObject) { if (HasUserCredentials) return; Console.Out.Write("Username: "); Loginname = Console.ReadLine(); Console.Out.Write("Password: "); Password = GetPassword(); } } public bool HasUserCredentials => Loginname != null && Password != null; private string GetPassword() { var password = new StringBuilder(); ConsoleKeyInfo key; do { key = Console.ReadKey(true); if (key.Key != ConsoleKey.Backspace && key.Key != ConsoleKey.Enter) { password.Append(key.KeyChar); Console.Write("*"); } else { if (key.Key == ConsoleKey.Backspace && password.Length > 0) { password.Remove(password.Length - 1, 1); Console.Write("\b \b"); } } } while (key.Key != ConsoleKey.Enter); Console.WriteLine(); return password.ToString(); } } }
using System; using System.Text; using P2E.Interfaces.Services; namespace P2E.Services { public class UserCredentialsService : IUserCredentialsService { // Syncs console output/input between instance so that only one // instance can request user credentials at any time. private static readonly object LockObject = new object(); public string Loginname { get; private set; } public string Password { get; private set; } public void GetUserCredentials() { // Each instance can request credentials only once. if (HasUserCredentials) return; lock (LockObject) { if (HasUserCredentials) return; Console.Out.Write("Username: "); Loginname = Console.ReadLine(); Console.Out.Write("Password: "); Password = GetPassword(); } } public bool HasUserCredentials => Loginname != null && Password != null; private string GetPassword() { var password = new StringBuilder(); ConsoleKeyInfo key; do { key = Console.ReadKey(true); if (key.Key != ConsoleKey.Backspace && key.Key != ConsoleKey.Enter) { password.Append(key.KeyChar); Console.Write("*"); } else { if (key.Key == ConsoleKey.Backspace && password.Length > 0) { password.Remove(password.Length - 1, 1); Console.Write("\b \b"); } } } while (key.Key != ConsoleKey.Enter); Console.WriteLine(); return password.ToString(); } } }
bsd-2-clause
C#
e17beb0ff57aa2b008ef22038245d6a11f33bd76
Update ScienceData.cs
Anatid/XML-Documentation-for-the-KSP-API
src/ScienceData.cs
src/ScienceData.cs
using System; /// <summary> /// Class containing information on science reports, stored in the persistent file in modules using IScienceDataContainer. /// </summary> public class ScienceData : IConfigNode { /// <summary> /// Amount of data, in mits, to be transmitted or recovered. Affects transmission time and energy usage. /// </summary> public float dataAmount; /// <summary> /// Level of science lab boost, less than 1 is un-boosted, 1.5 is the standard lab boosted value, higher levels don't appear to be used. /// </summary> public float labBoost; /// <summary> /// ID of science data in Experimentname@CelestialbodynameExperimentalsituationBiome format, matches Science Subject id. /// </summary> public string subjectID; /// <summary> /// Science data title, displayed on experimental results dialog page and recovery summary. /// </summary> public string title; /// <summary> /// Percentage of science value that can be transmitted. 1 is equal to the amount gained by returning to Kerbin. /// </summary> public float transmitValue; public ScienceData(ConfigNode node); /// <summary> /// Generate Science Data based on Science Subject values. /// </summary> /// <param name="amount">Amount of data, it mits.</param> /// <param name="xmitValue">Transmission value</param> /// <param name="labBoost">Current state of science lab boost</param> /// <param name="id">Matches Science Subject ID</param> /// <param name="dataName">Title of science data</param> public ScienceData(float amount, float xmitValue, float labBoost, string id, string dataName); public static ScienceData CopyOf(ScienceData src); public void Load(ConfigNode node); public void Save(ConfigNode node); }
#region Assembly Assembly-CSharp.dll, v2.0.50727 // C:\Users\David\Documents\Visual Studio 2010\Projects\KSP Science\KSP DEV\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp.dll #endregion using System; /// <summary> /// Class containing information on science reports, stored in the persistent file in modules using IScienceDataContainer. /// </summary> public class ScienceData : IConfigNode { /// <summary> /// Amount of data, in mits, to be transmitted or recovered. Affects transmission time and energy usage. /// </summary> public float dataAmount; /// <summary> /// Level of science lab boost, less than 1 is un-boosted, 1.5 is the standard lab boosted value, higher levels don't appear to be used. /// </summary> public float labBoost; /// <summary> /// ID of science data in Experimentname@CelestialbodynameExperimentalsituationBiome format, matches Science Subject id. /// </summary> public string subjectID; /// <summary> /// Science data title, displayed on experimental results dialog page and recovery summary. /// </summary> public string title; /// <summary> /// Percentage of science value that can be transmitted. 1 is equal to the amount gained by returning to Kerbin. /// </summary> public float transmitValue; public ScienceData(ConfigNode node); /// <summary> /// Generate Science Data based on Science Subject values. /// </summary> /// <param name="amount">Amount of data, it mits.</param> /// <param name="xmitValue">Transmission value</param> /// <param name="labBoost">Current state of science lab boost</param> /// <param name="id">Matches Science Subject ID</param> /// <param name="dataName">Title of science data</param> public ScienceData(float amount, float xmitValue, float labBoost, string id, string dataName); public static ScienceData CopyOf(ScienceData src); public void Load(ConfigNode node); public void Save(ConfigNode node); }
unlicense
C#
94bd54b18d9b294fac734049f31ab81493993477
Add duration as statistical value for blocks in TeamCity
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/BuildServers/TeamCityOutputSink.cs
source/Nuke.Common/BuildServers/TeamCityOutputSink.cs
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using JetBrains.Annotations; using Nuke.Common.OutputSinks; using Nuke.Common.Utilities; using Nuke.Common.Utilities.Collections; namespace Nuke.Common.BuildServers { [UsedImplicitly] [ExcludeFromCodeCoverage] internal class TeamCityOutputSink : AnsiColorOutputSink { private readonly TeamCity _teamCity; public TeamCityOutputSink(TeamCity teamCity) : base(traceCode: "37", informationCode: "36", warningCode: "33", errorCode: "31", successCode: "32") { _teamCity = teamCity; } public override IDisposable WriteBlock(string text) { var stopWatch = new Stopwatch(); return DelegateDisposable.CreateBracket( () => { _teamCity.OpenBlock(text); stopWatch.Start(); }, () => { _teamCity.CloseBlock(text); _teamCity.AddStatisticValue( $"NUKE_DURATION_{text.SplitCamelHumpsWithSeparator("_").ToUpper()}", stopWatch.ElapsedMilliseconds.ToString()); stopWatch.Stop(); }); } } }
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Diagnostics.CodeAnalysis; using System.Linq; using JetBrains.Annotations; using Nuke.Common.OutputSinks; using Nuke.Common.Utilities; namespace Nuke.Common.BuildServers { [UsedImplicitly] [ExcludeFromCodeCoverage] internal class TeamCityOutputSink : AnsiColorOutputSink { private readonly TeamCity _teamCity; public TeamCityOutputSink(TeamCity teamCity) : base(traceCode: "37", informationCode: "36", warningCode: "33", errorCode: "31", successCode: "32") { _teamCity = teamCity; } public override IDisposable WriteBlock(string text) { return DelegateDisposable.CreateBracket( () => _teamCity.OpenBlock(text), () => _teamCity.CloseBlock(text)); } } }
mit
C#
2d39bdd3e04978047b87ddf9c9ab49d5e69b3fdb
simplify IS_INLINE_INTEGRATION_TEST_ACTIVE
Fody/Fody,GeertvanHorrik/Fody
SampleTarget/WeaverIntegrationTests.cs
SampleTarget/WeaverIntegrationTests.cs
#if IS_INLINE_INTEGRATION_TEST_ACTIVE // only test if environment variable MSBUILDDISABLENODERESUSE is set to 1"; using System; using System.Globalization; using System.IO; using Xunit; [assembly: SampleWeaver.Sample] namespace SampleTarget { using JetBrains.Annotations; public class WeaverIntegrationTests { [Fact] public void SampleWeaverAddedExtraFileDuringBuild() { var assemblyPath = new Uri(GetType().Assembly.CodeBase).LocalPath; var targetFolder = AppDomain.CurrentDomain.BaseDirectory; var extraFilePath = Path.Combine(targetFolder, "SomeExtraFile.txt"); var extraFileContent = File.ReadAllText(extraFilePath); var assemblyBuildTime = File.GetLastWriteTime(assemblyPath); Assert.True(DateTime.TryParse(extraFileContent, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out var weaverExecutionTime)); var elapsed = assemblyBuildTime - weaverExecutionTime; Assert.True(elapsed < TimeSpan.FromMinutes(1)); } //[Fact] //public void SampleWeaverRemovedObsoleteDependenciesDuringBuild() //{ // var targetFolder = AppDomain.CurrentDomain.BaseDirectory; // var sampleWeaverFiles = Directory.EnumerateFiles(targetFolder, "SampleWeaver.*"); // Assert.Empty(sampleWeaverFiles); //} [Fact] public void NullGuardsAreActive() { Assert.Throws<ArgumentNullException>(() => GuardedMethod(null)); } [Fact] public void WeaverConfigurationIsRead() { var type = Type.GetType("SampleWeaverTest.Configuration"); var content = (string)type.GetField("Content").GetValue(null); const string expectedContent = "<SampleWeaver MyProperty=\"PropertyValue\">\r\n <Content>Test</Content>\r\n</SampleWeaver>"; Assert.Equal(expectedContent, content); var propertyValue = (string)type.GetField("PropertyValue").GetValue(null); const string expectedPropertyValue = "PropertyValue"; Assert.Equal(expectedPropertyValue, propertyValue); } [NotNull] public object GuardedMethod([NotNull] object parameter) { return parameter; } } } #endif
using System; using System.Globalization; using System.IO; using Xunit; [assembly: SampleWeaver.Sample] namespace SampleTarget { using JetBrains.Annotations; public class WeaverIntegrationTests { #if IS_INLINE_INTEGRATION_TEST_ACTIVE private const string skipReason = null; #else private const string skipReason = "Inline integration tests skipped, since environment variable MSBUILDDISABLENODERESUSE is not set to 1"; #endif [Fact(Skip = skipReason)] public void SampleWeaverAddedExtraFileDuringBuild() { var assemblyPath = new Uri(GetType().Assembly.CodeBase).LocalPath; var targetFolder = AppDomain.CurrentDomain.BaseDirectory; var extraFilePath = Path.Combine(targetFolder, "SomeExtraFile.txt"); var extraFileContent = File.ReadAllText(extraFilePath); var assemblyBuildTime = File.GetLastWriteTime(assemblyPath); Assert.True(DateTime.TryParse(extraFileContent, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out var weaverExecutionTime)); var elapsed = assemblyBuildTime - weaverExecutionTime; Assert.True(elapsed < TimeSpan.FromMinutes(1)); } //[Fact(Skip = skipReason)] //public void SampleWeaverRemovedObsoleteDependenciesDuringBuild() //{ // var targetFolder = AppDomain.CurrentDomain.BaseDirectory; // var sampleWeaverFiles = Directory.EnumerateFiles(targetFolder, "SampleWeaver.*"); // Assert.Empty(sampleWeaverFiles); //} [Fact(Skip = skipReason)] public void NullGuardsAreActive() { Assert.Throws<ArgumentNullException>(() => GuardedMethod(null)); } [Fact(Skip = skipReason)] public void WeaverConfigurationIsRead() { var type = Type.GetType("SampleWeaverTest.Configuration"); var content = (string)type.GetField("Content").GetValue(null); const string expectedContent = "<SampleWeaver MyProperty=\"PropertyValue\">\r\n <Content>Test</Content>\r\n</SampleWeaver>"; Assert.Equal(expectedContent, content); var propertyValue = (string)type.GetField("PropertyValue").GetValue(null); const string expectedPropertyValue = "PropertyValue"; Assert.Equal(expectedPropertyValue, propertyValue); } [NotNull] public object GuardedMethod([NotNull] object parameter) { return parameter; } } }
mit
C#
b462035809bc81728115de3a45f159b0e040d48c
refactor update course command
StanJav/language-ext,louthy/language-ext,StefanBertels/language-ext
Samples/Contoso/Contoso.Application/Courses/Commands/UpdateCourseHandler.cs
Samples/Contoso/Contoso.Application/Courses/Commands/UpdateCourseHandler.cs
using System.Threading; using System.Threading.Tasks; using Contoso.Application.Departments.Queries; using Contoso.Core; using Contoso.Core.Domain; using Contoso.Core.Interfaces.Repositories; using LanguageExt; using MediatR; using static Contoso.Validators; using static LanguageExt.Prelude; namespace Contoso.Application.Courses.Commands { public class UpdateCourseHandler : IRequestHandler<UpdateCourse, Validation<Error, Task>> { private readonly IMediator _mediator; private readonly ICourseRepository _courseRepository; public UpdateCourseHandler(IMediator mediator, ICourseRepository courseRepository) { _mediator = mediator; _courseRepository = courseRepository; } public Task<Validation<Error, Task>> Handle(UpdateCourse request, CancellationToken cancellationToken) => Validate(request) .MapT(c => ApplyUpdate(c, request)) .MapT(Persist); private Course ApplyUpdate(Course c, UpdateCourse request) => new Course { CourseId = c.CourseId, DepartmentId = request.DepartmentId, Credits = request.Credits, Title = request.Title }; private Task Persist(Course c) => _courseRepository.Update(c); private async Task<Validation<Error, Course>> Validate(UpdateCourse updateCourse) => (ValidateTitle(updateCourse), await DepartmentMustExist(updateCourse), await CourseMustExist(updateCourse)).Apply((t, d, course) => course); private Validation<Error, string> ValidateTitle(UpdateCourse course) => NotEmpty(course.Title) .Bind(NotLongerThan(50)); private async Task<Validation<Error, Course>> CourseMustExist(UpdateCourse updateCourse) => (await _courseRepository.Get(updateCourse.CourseId)) .ToValidation<Error>($"Course Id {updateCourse.CourseId} does not exist."); private async Task<Validation<Error, int>> DepartmentMustExist(UpdateCourse updateCourse) => (await _mediator.Send(new GetDepartmentById(updateCourse.DepartmentId))) .ToValidation<Error>($"Department Id: {updateCourse.DepartmentId} does not exist") .Map(d => d.DepartmentId); } }
using System.Threading; using System.Threading.Tasks; using Contoso.Application.Departments.Queries; using Contoso.Core; using Contoso.Core.Domain; using Contoso.Core.Interfaces.Repositories; using LanguageExt; using MediatR; using static Contoso.Validators; using static LanguageExt.Prelude; namespace Contoso.Application.Courses.Commands { public class UpdateCourseHandler : IRequestHandler<UpdateCourse, Validation<Error, Task>> { private readonly IMediator _mediator; private readonly ICourseRepository _courseRepository; public UpdateCourseHandler(IMediator mediator, ICourseRepository courseRepository) { _mediator = mediator; _courseRepository = courseRepository; } public Task<Validation<Error, Task>> Handle(UpdateCourse request, CancellationToken cancellationToken) => Validate(request) .MapT(c => ApplyUpdate(c, request)); private Task ApplyUpdate(Course c, UpdateCourse request) { c.Title = request.Title; c.Credits = request.Credits; c.DepartmentId = request.DepartmentId; return _courseRepository.Update(c); } private async Task<Validation<Error, Course>> Validate(UpdateCourse updateCourse) => (ValidateTitle(updateCourse), await DepartmentMustExist(updateCourse), await CourseMustExist(updateCourse)).Apply((t, d, course) => course); private Validation<Error, string> ValidateTitle(UpdateCourse course) => NotEmpty(course.Title) .Bind(NotLongerThan(50)); private async Task<Validation<Error, Course>> CourseMustExist(UpdateCourse updateCourse) => (await _courseRepository.Get(updateCourse.CourseId)) .ToValidation<Error>($"Course Id {updateCourse.CourseId} does not exist."); private async Task<Validation<Error, int>> DepartmentMustExist(UpdateCourse updateCourse) => (await _mediator.Send(new GetDepartmentById(updateCourse.DepartmentId))) .ToValidation<Error>($"Department Id: {updateCourse.DepartmentId} does not exist") .Map(d => d.DepartmentId); } }
mit
C#
f6c7518e16d8d2b3e65681e4a2543be712adb56c
Increment to v1.1.0.1
austins/PasswordHasher
PasswordHasher/Properties/AssemblyInfo.cs
PasswordHasher/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Password Hasher")] [assembly: AssemblyDescription( "Lets you hash a string through a variety of algorithms and see how long each method takes and the length of the resulting hashes." )] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Austin S.")] [assembly: AssemblyProduct("Password Hasher")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("Austin S.")] [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("1146a36c-4303-4059-a6b6-bb5ab5580c56")] // 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.1")] [assembly: AssemblyFileVersion("1.1.0.1")]
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("Password Hasher")] [assembly: AssemblyDescription( "Lets you hash a string through a variety of algorithms and see how long each method takes and the length of the resulting hashes." )] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Austin S.")] [assembly: AssemblyProduct("Password Hasher")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("Austin S.")] [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("1146a36c-4303-4059-a6b6-bb5ab5580c56")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
apache-2.0
C#
2df3404651bf117dcb0e42b64942e416b4d2e168
Bump version
dylanplecki/BasicOidcAuthentication,joelnet/KeycloakOwinAuthentication,dylanplecki/KeycloakOwinAuthentication
src/Owin.Security.Keycloak/Properties/AssemblyInfo.cs
src/Owin.Security.Keycloak/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Keycloak OWIN Authentication")] [assembly: AssemblyDescription("Keycloak Authentication Middleware for ASP.NET OWIN")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OWIN")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("fcac3105-3e81-49c4-9d8e-0fc9e608e87c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("1.0.1.4")] [assembly: AssemblyFileVersion("1.0.1.4")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Keycloak OWIN Authentication")] [assembly: AssemblyDescription("Keycloak Authentication Middleware for ASP.NET OWIN")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OWIN")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("fcac3105-3e81-49c4-9d8e-0fc9e608e87c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("1.0.1.3")] [assembly: AssemblyFileVersion("1.0.1.3")]
mit
C#
03b479081d4cbae470df7e8bbd9ea2ab5f30ff4d
Improve test helpers
leotsarev/hardcode-analyzer
Tsarev.Analyzer.Helpers/TypeHelpers.cs
Tsarev.Analyzer.Helpers/TypeHelpers.cs
using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; namespace Tsarev.Analyzer.Helpers { /// <summary> /// Collection of useful helpers related to types /// </summary> public static class TypeHelpers { /// <summary> /// Determines if some type is actually a Task or Task&lt;T&gt;> or ValueTask /// </summary> public static bool IsTask(this ExpressionSyntax expression, SyntaxNodeAnalysisContext context) { var type = context.SemanticModel.GetTypeInfo(expression).Type as INamedTypeSymbol; if (type == null) return false; if (type.Name == "Task") return true; if (type.IsGenericType && type.OriginalDefinition.Name == "Task") return true; if (type.IsGenericType && type.OriginalDefinition.Name == "ValueTask") return true; return false; } /// <summary> /// Determines if some expression is actually of type T /// </summary> public static bool IsExpressionOfType<T>(this ExpressionSyntax createNode, SyntaxNodeAnalysisContext context) { var type = context.SemanticModel.GetTypeInfo(createNode).Type as INamedTypeSymbol; return Equals(type, GetType<T>(context)); } /// <summary> /// Determines if some expression is actually of type T or of type derived from T /// </summary> public static bool IsExpressionOfTypeOrDerived<T>(this ExpressionSyntax createNode, SyntaxNodeAnalysisContext context) { var targetType = GetType<T>(context); return createNode.IsExpressionOfTypeOrDerived(context, targetType); } /// <summary> /// Determines if some expression is actually of type T or of type derived from T /// </summary> public static bool IsExpressionOfTypeOrDerived(this ExpressionSyntax createNode, SyntaxNodeAnalysisContext context, INamedTypeSymbol targetType) { var actualType = context.SemanticModel.GetTypeInfo(createNode).Type as INamedTypeSymbol; var searchType = actualType; while (searchType != null) { if (Equals(searchType, targetType)) { return true; } searchType = searchType.BaseType; } return false; } /// <summary> /// Gets matching type in context /// </summary> [CanBeNull] public static INamedTypeSymbol GetType<T>(this SyntaxNodeAnalysisContext context) => context.SemanticModel.Compilation.GetType<T>(); /// <summary> /// Gets matching type in context /// </summary> [CanBeNull] public static INamedTypeSymbol GetType<T>(this Compilation semanticModelCompilation) => semanticModelCompilation.GetTypeByMetadataName(typeof(T).FullName); } }
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; namespace Tsarev.Analyzer.Helpers { /// <summary> /// Collection of useful helpers related to types /// </summary> public static class TypeHelpers { /// <summary> /// Determines if some type is actually a Task or Task&lt;T&gt;> or ValueTask /// </summary> public static bool IsTask(this ExpressionSyntax expression, SyntaxNodeAnalysisContext context) { var type = context.SemanticModel.GetTypeInfo(expression).Type as INamedTypeSymbol; if (type == null) return false; if (type.Name == "Task") return true; if (type.IsGenericType && type.OriginalDefinition.Name == "Task") return true; if (type.IsGenericType && type.OriginalDefinition.Name == "ValueTask") return true; return false; } /// <summary> /// Determines if some expression is actually of type T /// </summary> public static bool IsExpressionOfType<T>(this ExpressionSyntax createNode, SyntaxNodeAnalysisContext context) { var type = context.SemanticModel.GetTypeInfo(createNode).Type as INamedTypeSymbol; return Equals(type, GetType<T>(context)); } /// <summary> /// Gets matching type in context /// </summary> public static INamedTypeSymbol GetType<T>(this SyntaxNodeAnalysisContext context) { return context.SemanticModel.Compilation.GetTypeByMetadataName(typeof(T).FullName); } } }
mit
C#
bf70d9e8d6e6f99c3434004b5de4e63aa6840fa0
Make it easier to depend on ArticyEditorModule (#57)
ArticySoftware/ArticyImporterForUnreal,ArticySoftware/ArticyImporterForUnreal,ArticySoftware/ArticyImporterForUnreal
Source/ArticyEditor/ArticyEditor.Build.cs
Source/ArticyEditor/ArticyEditor.Build.cs
// // Copyright (c) articy Software GmbH & Co. KG. All rights reserved. // using UnrealBuildTool; public class ArticyEditor : ModuleRules { public ArticyEditor(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; OptimizeCode = CodeOptimization.Never; PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... } ); PrivateIncludePaths.AddRange( new string[] { // ... add other private include paths required here ... } ); PublicDependencyModuleNames.AddRange( new string[] { "Core", "ArticyRuntime", "EditorWidgets", //"ClassViewer" // ... add other public dependencies that you statically link with here ... } ); PrivateDependencyModuleNames.AddRange( new string[] { "Projects", "InputCore", "UnrealEd", "LevelEditor", "CoreUObject", "Engine", "Slate", "SlateCore", // ... add private dependencies that you statically link with here ... "Json", "GameProjectGeneration", "ContentBrowser", "PropertyEditor", "EditorStyle", "SourceControl", "GraphEditor", "ApplicationCore", #if UE_5_0_OR_LATER "ToolMenus", #endif } ); DynamicallyLoadedModuleNames.AddRange( new string[] { // ... add any modules that your module loads dynamically here ... } ); } }
// // Copyright (c) articy Software GmbH & Co. KG. All rights reserved. // using UnrealBuildTool; public class ArticyEditor : ModuleRules { public ArticyEditor(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; OptimizeCode = CodeOptimization.Never; PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... } ); PrivateIncludePaths.AddRange( new string[] { // ... add other private include paths required here ... } ); PublicDependencyModuleNames.AddRange( new string[] { "Core", //"ClassViewer" // ... add other public dependencies that you statically link with here ... } ); PrivateDependencyModuleNames.AddRange( new string[] { "Projects", "InputCore", "UnrealEd", "LevelEditor", "CoreUObject", "Engine", "Slate", "SlateCore", // ... add private dependencies that you statically link with here ... "ArticyRuntime", "Json", "GameProjectGeneration", "ContentBrowser", "PropertyEditor", "EditorStyle", "EditorWidgets", "SourceControl", "GraphEditor", "ApplicationCore", #if UE_5_0_OR_LATER "ToolMenus", #endif } ); DynamicallyLoadedModuleNames.AddRange( new string[] { // ... add any modules that your module loads dynamically here ... } ); } }
mit
C#
8849134b3700576deb664b6a074a5d4320d59330
add CBToolClass
CloudBreadProject/CloudBread-Client-Unity,CloudBreadProject/CloudBread-Client-Unity,CloudBreadProject/CloudBread-Client-Unity,CloudBreadProject/CloudBread-Client-Unity
Assets/Scripts/CloudBread/CBTools.cs
Assets/Scripts/CloudBread/CBTools.cs
using System; using System.Text; namespace AssemblyCSharp { public class CBTools { public CBTools () { } public static string encoding(string jsonString){ // utf-8 인코딩 byte [] bytesForEncoding = Encoding.UTF8.GetBytes ( jsonString ) ; string encodedString = Convert.ToBase64String (bytesForEncoding ); // utf-8 디코딩 byte[] decodedBytes = Convert.FromBase64String (encodedString ); string decodedString = Encoding.UTF8.GetString (decodedBytes ); } } }
using System; namespace AssemblyCSharp { public class CBTools { public CBTools () { } } }
mit
C#
14f91fcf031c74441546599cf3946c41cfa89fda
Fix typo in IMarkupFormatter.cs
AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp
src/AngleSharp/IMarkupFormatter.cs
src/AngleSharp/IMarkupFormatter.cs
namespace AngleSharp { using AngleSharp.Dom; using System; /// <summary> /// Basic interface for HTML node serialization. /// </summary> public interface IMarkupFormatter { /// <summary> /// Formats the given text. /// </summary> /// <param name="text">The text to sanitize.</param> /// <returns>The formatted text.</returns> String Text(ICharacterData text); /// <summary> /// Emits the text literally. /// </summary> /// <param name="text">The text to return.</param> /// <returns>The contained text.</returns> String LiteralText(ICharacterData text); /// <summary> /// Formats the given comment. /// </summary> /// <param name="comment">The comment to stringify.</param> /// <returns>The formatted comment.</returns> String Comment(IComment comment); /// <summary> /// Formats the given processing instruction using the target and the /// data. /// </summary> /// <param name="processing"> /// The processing instruction to stringify. /// </param> /// <returns>The formatted processing instruction.</returns> String Processing(IProcessingInstruction processing); /// <summary> /// Formats the given doctype using the name, public and system /// identifiers. /// </summary> /// <param name="doctype">The document type to stringify.</param> /// <returns>The formatted doctype.</returns> String Doctype(IDocumentType doctype); /// <summary> /// Formats opening a tag with the given name. /// </summary> /// <param name="element">The element to open.</param> /// <param name="selfClosing"> /// Is the element actually self-closing? /// </param> /// <returns>The formatted opening tag.</returns> String OpenTag(IElement element, Boolean selfClosing); /// <summary> /// Formats closing a tag with the given name. /// </summary> /// <param name="element">The element to close.</param> /// <param name="selfClosing"> /// Is the element actually self-closing? /// </param> /// <returns>The formatted closing tag.</returns> String CloseTag(IElement element, Boolean selfClosing); } }
namespace AngleSharp { using AngleSharp.Dom; using System; /// <summary> /// Basic interface for HTML node serialization. /// </summary> public interface IMarkupFormatter { /// <summary> /// Formats the given text. /// </summary> /// <param name="text">The text to sanatize.</param> /// <returns>The formatted text.</returns> String Text(ICharacterData text); /// <summary> /// Emits the text literally. /// </summary> /// <param name="text">The text to return.</param> /// <returns>The contained text.</returns> String LiteralText(ICharacterData text); /// <summary> /// Formats the given comment. /// </summary> /// <param name="comment">The comment to stringify.</param> /// <returns>The formatted comment.</returns> String Comment(IComment comment); /// <summary> /// Formats the given processing instruction using the target and the /// data. /// </summary> /// <param name="processing"> /// The processing instruction to stringify. /// </param> /// <returns>The formatted processing instruction.</returns> String Processing(IProcessingInstruction processing); /// <summary> /// Formats the given doctype using the name, public and system /// identifiers. /// </summary> /// <param name="doctype">The document type to stringify.</param> /// <returns>The formatted doctype.</returns> String Doctype(IDocumentType doctype); /// <summary> /// Formats opening a tag with the given name. /// </summary> /// <param name="element">The element to open.</param> /// <param name="selfClosing"> /// Is the element actually self-closing? /// </param> /// <returns>The formatted opening tag.</returns> String OpenTag(IElement element, Boolean selfClosing); /// <summary> /// Formats closing a tag with the given name. /// </summary> /// <param name="element">The element to close.</param> /// <param name="selfClosing"> /// Is the element actually self-closing? /// </param> /// <returns>The formatted closing tag.</returns> String CloseTag(IElement element, Boolean selfClosing); } }
mit
C#
4cb223b7e1546f4fc6df85d7c0c73f3a6335341a
Fix server list not updating proprely.
DragonEyes7/ConcoursUBI17,DragonEyes7/ConcoursUBI17
Proto/Assets/Scripts/UI/ServerUI.cs
Proto/Assets/Scripts/UI/ServerUI.cs
using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; public class ServerUI : MonoBehaviour { [SerializeField]InputField m_ServerNameField; [SerializeField]RectTransform m_ServerList; List<GameObject> m_ServerButtons = new List<GameObject>(); void Start () { PhotonNetwork.ConnectUsingSettings("Proto v0.1"); StartCoroutine(WaitForConnection()); } public void CreateServer() { PhotonNetwork.CreateRoom(m_ServerNameField.text, null, null); //SceneManager.LoadScene("Level1"); PhotonNetwork.LoadLevel("Level1"); } public void GetServerList() { foreach(GameObject serverbutton in m_ServerButtons) { Destroy(serverbutton); } m_ServerButtons.Clear(); foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList()) { GameObject serverbutton = (GameObject)Instantiate(Resources.Load("ServerJoinButton"), m_ServerList); serverbutton.GetComponentInChildren<Text>().text = roomInfo.Name + " " + roomInfo.PlayerCount + "/2"; //+ roomInfo.MaxPlayers; serverbutton.GetComponent<Button>().onClick.AddListener(() => JoinServer(roomInfo.Name)); m_ServerButtons.Add(serverbutton); } } void JoinServer(string serverName) { PhotonNetwork.JoinRoom(serverName); //SceneManager.LoadScene("Level1"); PhotonNetwork.LoadLevel("Level1"); } IEnumerator WaitForConnection() { yield return new WaitUntil(() => PhotonNetwork.connectionStateDetailed == ClientState.JoinedLobby); LoadingCompleted(); } void LoadingCompleted() { LoadingManager LM = FindObjectOfType<LoadingManager>(); if (LM) { LM.ConnectionCompleted(); } } }
using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; using System.Collections; public class ServerUI : MonoBehaviour { [SerializeField]InputField m_ServerNameField; [SerializeField]RectTransform m_ServerList; void Start () { PhotonNetwork.ConnectUsingSettings("Proto v0.1"); StartCoroutine(WaitForConnection()); } public void CreateServer() { PhotonNetwork.CreateRoom(m_ServerNameField.text, null, null); //SceneManager.LoadScene("Level1"); PhotonNetwork.LoadLevel("Level1"); } public void GetServerList() { foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList()) { GameObject serverbutton = (GameObject)Instantiate(Resources.Load("ServerJoinButton"), m_ServerList); serverbutton.GetComponentInChildren<Text>().text = roomInfo.Name + " " + roomInfo.PlayerCount + "/2"; //+ roomInfo.MaxPlayers; serverbutton.GetComponent<Button>().onClick.AddListener(() => JoinServer(roomInfo.Name)); } } void JoinServer(string serverName) { PhotonNetwork.JoinRoom(serverName); //SceneManager.LoadScene("Level1"); PhotonNetwork.LoadLevel("Level1"); } IEnumerator WaitForConnection() { yield return new WaitUntil(() => PhotonNetwork.connectionStateDetailed == ClientState.JoinedLobby); LoadingCompleted(); } void LoadingCompleted() { LoadingManager LM = FindObjectOfType<LoadingManager>(); if (LM) { LM.ConnectionCompleted(); } } }
mit
C#
2d18a79d34b43f7a77b62fd413dd19d52a7f5d05
Update XDatabasesTests.cs
Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
tests/Core2D.UnitTests/Collections/XDatabasesTests.cs
tests/Core2D.UnitTests/Collections/XDatabasesTests.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Core2D.Collections; using Xunit; namespace Core2D.UnitTests { public class XDatabasesTests { [Fact] [Trait("Core2D", "Collections")] public void Inherits_From_ObservableObject() { var target = new XDatabases(); Assert.True(target is ObservableObject); } [Fact] [Trait("Core2D", "Collections")] public void Children_Not_Null() { var target = new XDatabases(); Assert.NotNull(target.Children); } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Core2D.Collections; using Xunit; namespace Core2D.UnitTests { public class XDatabasesTests { [Fact] [Trait("Core2D", "Collections")] public void Inherits_From_ObservableResource() { var target = new XDatabases(); Assert.True(target is ObservableResource); } [Fact] [Trait("Core2D", "Collections")] public void Children_Not_Null() { var target = new XDatabases(); Assert.NotNull(target.Children); } } }
mit
C#
9f8b20d3f36c38068b383efbcc535b908889ac8f
Fix webapp sample (cherry picked from commit eb6715dd8e9025cb154fdceb4114fb5bcd250d19)
prabirshrestha/FacebookSharp,prabirshrestha/FacebookSharp,prabirshrestha/FacebookSharp
src/Samples/FacebookSharp.Samples.WebApplication/FacebookContext.cs
src/Samples/FacebookSharp.Samples.WebApplication/FacebookContext.cs
using System.Web; using System.Configuration; using System; namespace FacebookSharp.Samples.Website { public class SampleFacebookContext : IFacebookContext { private Facebook _facebookContext; #region Implementation of IFacebookContext public Facebook FacebookContext { get { if (ConfigurationManager.AppSettings["FacebookSharp.AppKey"] == "AppKey") throw new ApplicationException("Please specify FacebookSharp.AppKey in web.config AppSettings."); if (ConfigurationManager.AppSettings["FacebookSharp.AppSecret"] == "AppSecret") throw new ApplicationException("Please specify FacebookSharp.AppSecret in web.config AppSettings."); if (ConfigurationManager.AppSettings["FacebookSharp.PostAuthorizeUrl"] == "PostAuthorizeUrl") throw new ApplicationException("Please specify FacebookSharp.PostAuthorizeUrl in web.config AppSettings."); if (_facebookContext == null) { FacebookSettings settings = new FacebookSettings(); settings.PostAuthorizeUrl = ConfigurationManager.AppSettings["FacebookSharp.PostAuthorizeUrl"]; settings.ApplicationKey = ConfigurationManager.AppSettings["FacebookSharp.AppKey"]; settings.ApplicationSecret = ConfigurationManager.AppSettings["FacebookSharp.AppSecret"]; if (HttpContext.Current.Session["access_token"] != null) { settings.AccessExpires = Convert.ToDouble(HttpContext.Current.Session["expires_in"]); settings.AccessToken = HttpContext.Current.Session["access_token"].ToString(); } _facebookContext = new Facebook(settings); } return _facebookContext; } } public virtual IFacebookMembershipProvider FacebookMembershipProvider { get { return null; } } #endregion } }
using System.Web; using System.Configuration; using System; namespace FacebookSharp.Samples.Website { public class SampleFacebookContext : IFacebookContext { private Facebook _facebookContext; #region Implementation of IFacebookContext public Facebook FacebookContext { get { if (_facebookContext.Settings.ApplicationKey == "AppKey") throw new ApplicationException("Please specify FacebookSharp.AppKey in web.config AppSettings."); if (_facebookContext.Settings.ApplicationSecret == "AppSecret") throw new ApplicationException("Please specify FacebookSharp.AppSecret in web.config AppSettings."); if (_facebookContext.Settings.PostAuthorizeUrl == "PostAuthorizeUrl") throw new ApplicationException("Please specify FacebookSharp.PostAuthorizeUrl in web.config AppSettings."); if (_facebookContext == null) { FacebookSettings settings = new FacebookSettings(); settings.PostAuthorizeUrl = ConfigurationManager.AppSettings["FacebookSharp.PostAuthorizeUrl"]; settings.ApplicationKey = ConfigurationManager.AppSettings["FacebookSharp.AppKey"]; settings.ApplicationSecret = ConfigurationManager.AppSettings["FacebookSharp.AppSecret"]; if (HttpContext.Current.Session["access_token"] != null) { settings.AccessExpires = Convert.ToDouble(HttpContext.Current.Session["expires_in"]); settings.AccessToken = HttpContext.Current.Session["access_token"].ToString(); } _facebookContext = new Facebook(settings); } return _facebookContext; } } public virtual IFacebookMembershipProvider FacebookMembershipProvider { get { return null; } } #endregion } }
bsd-3-clause
C#
4039691288f6a6faef160635c5c6ab05fd9bc7a8
Add missing type tags
huysentruitw/pem-utils
src/DerConverter/Asn/Enumerations/DerAsnKnownTypeTags.cs
src/DerConverter/Asn/Enumerations/DerAsnKnownTypeTags.cs
namespace DerConverter.Asn { public static class DerAsnKnownTypeTags { public static class Primitive { public static readonly long Boolean = 0x01; public static readonly long Integer = 0x02; public static readonly long BitString = 0x03; public static readonly long OctetString = 0x04; public static readonly long Null = 0x05; public static readonly long ObjectIdentifier = 0x06; public static readonly long ObjectDescriptor = 0x07; //public static readonly long InstanceOf_External = 0x08; public static readonly long Real = 0x09; public static readonly long Enumerated = 0x0A; public static readonly long EmbeddedPdv = 0x0B; public static readonly long Utf8String = 0x0C; public static readonly long RelativeOid = 0x0D; public static readonly long NumericString = 0x12; public static readonly long PrintableString = 0x13; public static readonly long TeletexString = 0x14; public static readonly long VideotexString = 0x15; public static readonly long Ia5tring = 0x16; public static readonly long UtcTime = 0x17; public static readonly long GeneralizedTime = 0x18; public static readonly long GraphicString = 0x19; public static readonly long VisibleString = 0x1A; public static readonly long GeneralString = 0x1B; public static readonly long UniversalString = 0x1C; public static readonly long CharacterString = 0x1D; public static readonly long BmpString = 0x1E; } public static class Constructed { public static readonly long Sequence = 0x10; public static readonly long Set = 0x11; } } }
namespace DerConverter.Asn { public static class DerAsnKnownTypeTags { public static class Primitive { public static readonly long Boolean = 0x01; public static readonly long Integer = 0x02; public static readonly long BitString = 0x03; public static readonly long OctetString = 0x04; public static readonly long Null = 0x05; public static readonly long ObjectIdentifier = 0x06; public static readonly long Utf8String = 0x0C; public static readonly long PrintableString = 0x13; public static readonly long TeletexString = 0x14; public static readonly long Ia5tring = 0x16; public static readonly long UtcTime = 0x17; public static readonly long BmpString = 0x1E; } public static class Constructed { public static readonly long Sequence = 0x10; public static readonly long Set = 0x11; } } }
apache-2.0
C#
2ba331732480f1ff96dd4e6fbdce579648b4f9e7
refactor - inline temp variable
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
src/FilterLists.Services/Implementations/TableService.cs
src/FilterLists.Services/Implementations/TableService.cs
using System.IO; using System.Net.Http; using System.Threading.Tasks; using FilterLists.Data.Repositories.Contracts; using FilterLists.Services.Contracts; namespace FilterLists.Services.Implementations { public class TableService : ITableService { private readonly IListRepository _listRepository; private readonly ITableCsvRepository _tableCsvRepository; public TableService(IListRepository listRepository, ITableCsvRepository tableCsvRepository) { _listRepository = listRepository; _tableCsvRepository = tableCsvRepository; } /// <summary> /// update all tables via .CSVs from GitHub /// </summary> public void UpdateTables() { //TODO: loop through all CSVs UpdateTable("List"); } /// <summary> /// update table via .CSV from GitHub /// </summary> /// <param name="tableName">name of database table</param> public void UpdateTable(string tableName) { var file = FetchFile(_tableCsvRepository.GetUrlByName(tableName), tableName).Result; //TODO: exec stored procedure to merge/upsert csv into corresponding db table } /// <summary> /// fetch file as string from internet /// </summary> /// <param name="url">URL of file to fetch</param> /// <param name="fileName">name to save file as</param> /// <returns>string of file</returns> private static async Task<string> FetchFile(string url, string fileName) { var response = await new HttpClient().GetAsync(url); response.EnsureSuccessStatusCode(); var path = Path.Combine(Directory.GetCurrentDirectory(), "csv"); Directory.CreateDirectory(path); var file = Path.Combine(path, fileName + ".csv"); using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None)) { await response.Content.CopyToAsync(fileStream); } return file; } } }
using System.IO; using System.Net.Http; using System.Threading.Tasks; using FilterLists.Data.Repositories.Contracts; using FilterLists.Services.Contracts; namespace FilterLists.Services.Implementations { public class TableService : ITableService { private readonly IListRepository _listRepository; private readonly ITableCsvRepository _tableCsvRepository; public TableService(IListRepository listRepository, ITableCsvRepository tableCsvRepository) { _listRepository = listRepository; _tableCsvRepository = tableCsvRepository; } /// <summary> /// update all tables via .CSVs from GitHub /// </summary> public void UpdateTables() { //TODO: loop through all CSVs UpdateTable("List"); } /// <summary> /// update table via .CSV from GitHub /// </summary> /// <param name="tableName">name of database table</param> public void UpdateTable(string tableName) { var file = FetchFile(_tableCsvRepository.GetUrlByName(tableName), tableName).Result; //TODO: exec stored procedure to merge/upsert csv into corresponding db table } /// <summary> /// fetch file as string from internet /// </summary> /// <param name="url">URL of file to fetch</param> /// <param name="fileName">name to save file as</param> /// <returns>string of file</returns> private static async Task<string> FetchFile(string url, string fileName) { var client = new HttpClient(); var response = await client.GetAsync(url); response.EnsureSuccessStatusCode(); var path = Path.Combine(Directory.GetCurrentDirectory(), "csv"); Directory.CreateDirectory(path); var file = Path.Combine(path, fileName + ".csv"); using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None)) { await response.Content.CopyToAsync(fileStream); } return file; } } }
mit
C#
723c8e661210452c8081fbfe09187bdf757fcf26
Add log message when a branch template is changed
kamsar/Unicorn,kamsar/Unicorn
src/Unicorn/Deserialization/DefaultDeserializerLogger.cs
src/Unicorn/Deserialization/DefaultDeserializerLogger.cs
using System.Diagnostics.CodeAnalysis; using Rainbow.Model; using Rainbow.Storage.Sc.Deserialization; using Sitecore.Data; using Sitecore.Data.Fields; using Sitecore.Data.Items; using Sitecore.StringExtensions; using Unicorn.Logging; namespace Unicorn.Deserialization { [ExcludeFromCodeCoverage] public class DefaultDeserializerLogger : IDefaultDeserializerLogger { private readonly ILogger _logger; public DefaultDeserializerLogger(ILogger logger) { _logger = logger; } public virtual void CreatedNewItem(Item targetItem) { } public virtual void MovedItemToNewParent(Item newParentItem, Item oldParentItem, Item movedItem) { _logger.Debug("* [M] from {0} to {1}".FormatWith(oldParentItem.ID, newParentItem.ID)); } public virtual void RemovingOrphanedVersion(Item versionToRemove) { _logger.Debug("* [D] {0}#{1}".FormatWith(versionToRemove.Language.Name, versionToRemove.Version.Number)); } public virtual void RenamedItem(Item targetItem, string oldName) { _logger.Debug("* [R] from {0} to {1}".FormatWith(oldName, targetItem.Name)); } public virtual void ChangedBranchTemplate(Item targetItem, string oldBranchId) { _logger.Debug("* [B] from {0} to {1}".FormatWith(oldBranchId, targetItem.BranchId)); } public virtual void ChangedTemplate(Item targetItem, TemplateItem oldTemplate) { _logger.Debug("* [T] from {0} to {1}".FormatWith(oldTemplate.Name, targetItem.TemplateName)); } public virtual void AddedNewVersion(Item newVersion) { _logger.Debug("* [A] version {0}#{1}".FormatWith(newVersion.Language.Name, newVersion.Version.Number)); } public virtual void WroteBlobStream(Item item, IItemFieldValue field) { } public virtual void UpdatedChangedFieldValue(Item item, IItemFieldValue field, string oldValue) { var itemField = item.Fields[new ID(field.FieldId)]; if (itemField.Shared) _logger.Debug("* [U] {0}".FormatWith(itemField.Name)); else if(itemField.Unversioned) _logger.Debug("* [U] {0}: {1}".FormatWith(item.Language.Name, itemField.Name)); else _logger.Debug("* [U] {0}#{1}: {2}".FormatWith(item.Language.Name, item.Version.Number, itemField.Name)); } public virtual void ResetFieldThatDidNotExistInSerialized(Field field) { } public void SkippedPastingIgnoredField(Item item, IItemFieldValue field) { } } }
using System.Diagnostics.CodeAnalysis; using Rainbow.Model; using Rainbow.Storage.Sc.Deserialization; using Sitecore.Data; using Sitecore.Data.Fields; using Sitecore.Data.Items; using Sitecore.StringExtensions; using Unicorn.Logging; namespace Unicorn.Deserialization { [ExcludeFromCodeCoverage] public class DefaultDeserializerLogger : IDefaultDeserializerLogger { private readonly ILogger _logger; public DefaultDeserializerLogger(ILogger logger) { _logger = logger; } public virtual void CreatedNewItem(Item targetItem) { } public virtual void MovedItemToNewParent(Item newParentItem, Item oldParentItem, Item movedItem) { _logger.Debug("* [M] from {0} to {1}".FormatWith(oldParentItem.ID, newParentItem.ID)); } public virtual void RemovingOrphanedVersion(Item versionToRemove) { _logger.Debug("* [D] {0}#{1}".FormatWith(versionToRemove.Language.Name, versionToRemove.Version.Number)); } public virtual void RenamedItem(Item targetItem, string oldName) { _logger.Debug("* [R] from {0} to {1}".FormatWith(oldName, targetItem.Name)); } public virtual void ChangedBranchTemplate(Item targetItem, string oldBranchId) { } public virtual void ChangedTemplate(Item targetItem, TemplateItem oldTemplate) { _logger.Debug("* [T] from {0} to {1}".FormatWith(oldTemplate.Name, targetItem.TemplateName)); } public virtual void AddedNewVersion(Item newVersion) { _logger.Debug("* [A] version {0}#{1}".FormatWith(newVersion.Language.Name, newVersion.Version.Number)); } public virtual void WroteBlobStream(Item item, IItemFieldValue field) { } public virtual void UpdatedChangedFieldValue(Item item, IItemFieldValue field, string oldValue) { var itemField = item.Fields[new ID(field.FieldId)]; if (itemField.Shared) _logger.Debug("* [U] {0}".FormatWith(itemField.Name)); else if(itemField.Unversioned) _logger.Debug("* [U] {0}: {1}".FormatWith(item.Language.Name, itemField.Name)); else _logger.Debug("* [U] {0}#{1}: {2}".FormatWith(item.Language.Name, item.Version.Number, itemField.Name)); } public virtual void ResetFieldThatDidNotExistInSerialized(Field field) { } public void SkippedPastingIgnoredField(Item item, IItemFieldValue field) { } } }
mit
C#
6aeffc1be3abe9192ec61b216e7e57a8f4bd55cb
Update GitPull.cs
mwhite14/LabviewGitPlugin_Hackathon
GitHubPlugin/GitHubPlugin/GitPull.cs
GitHubPlugin/GitHubPlugin/GitPull.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using LibGit2Sharp; namespace GitHubPlugin { class GitPull { private Repository repo; public GitPull() { } public GitPull(string localRepoPath) { repo = new Repository(localRepoPath); } public string PullChanges() { PullOptions pullOps = new PullOptions(); FetchOptions fetchOps = new FetchOptions(); MergeOptions mergeOps = new MergeOptions(); UsernamePasswordCredentials creds = new UsernamePasswordCredentials(); creds.Username = "[email protected]"; creds.Password = "hehe"; fetchOps.Credentials = creds; pullOps.FetchOptions = fetchOps; pullOps.MergeOptions = mergeOps; try { repo.Network.Fetch(repo.Network.Remotes["origin"], fetchOps, new Signature("colon", "email", DateTime.Now), "Fetched crap"); MergeResult results = repo.Network.Pull(new Signature("colon", "email", DateTime.Now), pullOps); Console.WriteLine(results.Status.ToString()); } catch (Exception e) { return "Message: " + e.Message + " Cause: " + e.InnerException + " Error#" + e.HResult; } return null; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using LibGit2Sharp; namespace GitHubPlugin { class GitPull { private Repository repo; public GitPull() { } public GitPull(string localRepoPath) { repo = new Repository(localRepoPath); } public string PullChanges() { PullOptions pullOps = new PullOptions(); FetchOptions fetchOps = new FetchOptions(); MergeOptions mergeOps = new MergeOptions(); UsernamePasswordCredentials creds = new UsernamePasswordCredentials(); creds.Username = "[email protected]"; creds.Password = "Irithos11!"; fetchOps.Credentials = creds; pullOps.FetchOptions = fetchOps; pullOps.MergeOptions = mergeOps; try { repo.Network.Fetch(repo.Network.Remotes["origin"], fetchOps, new Signature("colon", "email", DateTime.Now), "Fetched crap"); MergeResult results = repo.Network.Pull(new Signature("colon", "email", DateTime.Now), pullOps); Console.WriteLine(results.Status.ToString()); } catch (Exception e) { return "Message: " + e.Message + " Cause: " + e.InnerException + " Error#" + e.HResult; } return null; } } }
mit
C#
cb8e85836e70365772667f95de25f3a916bc3b23
Add remarks
saidmarouf/Doccou,aloisdg/Doccou,aloisdg/CountPages
Doccou.Pcl/Document.cs
Doccou.Pcl/Document.cs
using System; using System.Collections.Generic; using System.IO; using Doccou.Pcl.Documents; using Doccou.Pcl.Documents.Archives; namespace Doccou.Pcl { /// <summary> /// Document is the class wrapping every other class in this library. /// If you are an user, everything you need come from here. /// </summary> public class Document { public DocumentType ExtensionType { get; private set; } public string Extension { get; private set; } public string FullName { get; private set; } public string Name { get; private set; } public string NameWithoutExtension { get; private set; } public uint? Count { get; private set; } private readonly Dictionary<string, DocumentType> _extensionsSupported = new Dictionary<string, DocumentType> { { ".pdf", DocumentType.Pdf }, { ".docx", DocumentType.Docx }, { ".odt", DocumentType.Odt } }; /// <remarks> /// We can't open stream ourself. /// </remarks> private Document(string fullName) { FullName = fullName; Name = Path.GetFileName(fullName); NameWithoutExtension = Path.GetFileNameWithoutExtension(fullName); Extension = Path.GetExtension(fullName); ExtensionType = IsSupported(Extension) ? _extensionsSupported[Extension] : DocumentType.Unknow; } public Document(string fullName, Stream stream) : this(fullName) { Count = !ExtensionType.Equals(DocumentType.Unknow) ? BuildDocument(stream).Count : 0; } public bool IsSupported(string extension) { return _extensionsSupported.ContainsKey(extension); } // replace with a static dictionary ? private IDocument BuildDocument(Stream stream) { switch (ExtensionType) { case DocumentType.Pdf: return new Pdf(stream); case DocumentType.Docx: return new Docx(stream); case DocumentType.Odt: return new Odt(stream); default: throw new NotImplementedException(); } } } }
using System; using System.Collections.Generic; using System.IO; using Doccou.Pcl.Documents; using Doccou.Pcl.Documents.Archives; namespace Doccou.Pcl { /// <summary> /// Document is the class wrapping every other class in this library. /// If you are an user, everything you need come from here. /// </summary> public class Document { public DocumentType ExtensionType { get; private set; } public string Extension { get; private set; } public string FullName { get; private set; } public string Name { get; private set; } public string NameWithoutExtension { get; private set; } public uint Count { get; private set; } private readonly Dictionary<string, DocumentType> _extensionsSupported = new Dictionary<string, DocumentType> { { ".pdf", DocumentType.Pdf }, { ".docx", DocumentType.Docx }, { ".odt", DocumentType.Odt } }; public Document(string fullName) { FullName = fullName; Name = Path.GetFileName(fullName); NameWithoutExtension = Path.GetFileNameWithoutExtension(fullName); Extension = Path.GetExtension(fullName); ExtensionType = IsSupported(Extension) ? _extensionsSupported[Extension] : DocumentType.Unknow; } public Document(string fullName, Stream stream) : this(fullName) { Count = !ExtensionType.Equals(DocumentType.Unknow) ? BuildDocument(stream).Count : 0; } public bool IsSupported(string extension) { return _extensionsSupported.ContainsKey(extension); } // replace with a static dictionary ? private IDocument BuildDocument(Stream stream) { switch (ExtensionType) { case DocumentType.Pdf: return new Pdf(stream); case DocumentType.Docx: return new Docx(stream); case DocumentType.Odt: return new Odt(stream); default: throw new NotImplementedException(); } } } }
mit
C#
61be29c8fed9c6dbd6758282fb3bbda449339386
Save Addon URL parameters too
smx-smx/KodiSharp,smx-smx/KodiSharp,smx-smx/KodiSharp
KodiInterop/KodiInterop/KodiAddon.cs
KodiInterop/KodiInterop/KodiAddon.cs
using System; using System.IO; using System.Reflection; namespace Smx.KodiInterop { public abstract class KodiAddon { //http://stackoverflow.com/a/1373295 private static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args) { string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll"); if (!File.Exists(assemblyPath)) return null; Assembly assembly = Assembly.LoadFrom(assemblyPath); return assembly; } private static void SetAssemblyResolver() { AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(LoadFromSameFolder); } public int Handle { get; private set; } public string BaseUrl { get; private set; } public string Parameters { get; private set; } public KodiAddon() { SetAssemblyResolver(); this.BaseUrl = PythonInterop.EvalToResult("sys.argv[0]"); this.Handle = int.Parse(PythonInterop.EvalToResult("sys.argv[1]")); this.Parameters = PythonInterop.EvalToResult("sys.argv[2]"); PyConsole.WriteLine(string.Format("BaseUrl: {0}, Handle: {1}, Parameters: {2}", this.BaseUrl, this.Handle, this.Parameters)); KodiBridge.RunningAddon = this; } public int Run() { try { return this.PluginMain(); } catch (Exception ex) { // This takes the exception and stores it, not allowing it to bubble up KodiBridge.SaveException(ex); return 1; } } public abstract int PluginMain(); } }
using System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Text; namespace Smx.KodiInterop { public abstract class KodiAddon { //http://stackoverflow.com/a/1373295 private static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args) { string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll"); if (!File.Exists(assemblyPath)) return null; Assembly assembly = Assembly.LoadFrom(assemblyPath); return assembly; } private static void SetAssemblyResolver() { AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(LoadFromSameFolder); } public int Handle { get; private set; } public string BaseUrl { get; private set; } public KodiAddon() { SetAssemblyResolver(); this.BaseUrl = PythonInterop.EvalToResult("sys.argv[0]"); this.Handle = int.Parse(PythonInterop.EvalToResult("sys.argv[1]")); PyConsole.WriteLine(string.Format("BaseUrl: {0}, Handle: {1}", this.BaseUrl, this.Handle)); KodiBridge.RunningAddon = this; } public int Run() { try { return this.PluginMain(); } catch (Exception ex) { // This takes the exception and stores it, not allowing it to bubble up KodiBridge.SaveException(ex); return 1; } } public abstract int PluginMain(); } }
mpl-2.0
C#
728ee9cf49d811fcf7d47f03600b197573e1a34a
Fix conversion of hash to string
wyldphyre/LockScreenBackgroundSaver
LockScreenBackgroundSaver/Program.cs
LockScreenBackgroundSaver/Program.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Security.Cryptography; using System.Threading; namespace LockScreenBackgroundSaver { class Program { static void Main(string[] args) { var MonitorForNewImages = false; var OutputFolder = ""; foreach (var argument in args) { if (argument == "-monitor") { MonitorForNewImages = true; } else if (argument.StartsWith("-output:")) { OutputFolder = argument.Split(':').Last(); } } if (OutputFolder == "") { Console.WriteLine("must provide an output folder using the -output parameter"); return; } // TODO: Validate that OutputFolder exists const int MinimumBackgroundSize = 1024 * 100; //var MonitorInterval = TimeSpan.FromMinutes(10); var MonitorInterval = TimeSpan.FromSeconds(10); var AssetPath = string.Format(@"C:\Users\{0}\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets", Environment.UserName); do { var AssetDirectoryInfo = new DirectoryInfo(AssetPath); var AssetFiles = AssetDirectoryInfo.GetFiles(); var PotentialBackgroundFiles = AssetFiles.Where(File => File.Length > MinimumBackgroundSize).ToArray(); var AssetHashFilePathDictionary = new Dictionary<string, string>(); var HashAlgorithm = SHA256Managed.Create(); foreach (var File in PotentialBackgroundFiles) { using (var FileStream = new FileStream(File.FullName, FileMode.Open)) { var HashReturnValue = HashAlgorithm.ComputeHash(FileStream); var Hash = BitConverter.ToString(HashReturnValue).Replace("-", String.Empty); if (!AssetHashFilePathDictionary.ContainsKey(Hash)) AssetHashFilePathDictionary.Add(Hash, File.FullName); } } if (MonitorForNewImages) Thread.Sleep(MonitorInterval); } while (MonitorForNewImages); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Security.Cryptography; using System.Threading; namespace LockScreenBackgroundSaver { class Program { static void Main(string[] args) { var MonitorForNewImages = false; var OutputFolder = ""; foreach (var argument in args) { if (argument == "-monitor") { MonitorForNewImages = true; } else if (argument.StartsWith("-output:")) { OutputFolder = argument.Split(':').Last(); } } if (OutputFolder == "") { Console.WriteLine("must provide an output folder using the -output parameter"); return; } // TODO: Validate that OutputFolder exists const int MinimumBackgroundSize = 1024 * 100; //var MonitorInterval = TimeSpan.FromMinutes(10); var MonitorInterval = TimeSpan.FromSeconds(10); var AssetPath = string.Format(@"C:\Users\{0}\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets", Environment.UserName); do { var AssetDirectoryInfo = new DirectoryInfo(AssetPath); var AssetFiles = AssetDirectoryInfo.GetFiles(); var PotentialBackgroundFiles = AssetFiles.Where(File => File.Length > MinimumBackgroundSize).ToArray(); var AssetHashFilePathDictionary = new Dictionary<string, string>(); var HashAlgorithm = SHA256Managed.Create(); foreach (var File in PotentialBackgroundFiles) { using (var FileStream = new FileStream(File.FullName, FileMode.Open)) { var HashReturnValue = HashAlgorithm.ComputeHash(FileStream); var sb = new StringBuilder(); for (int i = 0; i < HashReturnValue.Length; i++) sb.Append(BitConverter.ToString(HashReturnValue)); var Hash = sb.ToString(); if (!AssetHashFilePathDictionary.ContainsKey(Hash)) AssetHashFilePathDictionary.Add(Hash, File.FullName); } } if (MonitorForNewImages) Thread.Sleep(MonitorInterval); } while (MonitorForNewImages); } } }
mit
C#
1ab0aff66132c1aa95418377caedd485d63b9229
Refactor `Program` in Atata.TestApp
atata-framework/atata,atata-framework/atata
test/Atata.TestApp/Program.cs
test/Atata.TestApp/Program.cs
namespace Atata.TestApp; public static class Program { public static void Main(string[] args) => CreateWebApplication(new WebApplicationOptions { Args = args }) .Run(); public static WebApplication CreateWebApplication(WebApplicationOptions options) { var builder = WebApplication.CreateBuilder(options); builder.Services.AddRazorPages(); var app = builder.Build(); app.UseDeveloperExceptionPage(); app.UseStatusCodePages(); app.UseStaticFiles(); app.UseRouting(); app.MapRazorPages(); return app; } }
namespace Atata.TestApp; public static class Program { public static void Main(string[] args) => CreateWebApplication(new WebApplicationOptions { Args = args }) .Run(); public static WebApplication CreateWebApplication(WebApplicationOptions options, Action<WebApplicationBuilder> builderConfiguration = null) { var builder = WebApplication.CreateBuilder(options); builder.Services.AddRazorPages(); builderConfiguration?.Invoke(builder); var app = builder.Build(); app.UseDeveloperExceptionPage(); app.UseStatusCodePages(); app.UseStaticFiles(); app.UseRouting(); app.MapRazorPages(); return app; } }
apache-2.0
C#
2d72cea7546d800894de94aea142394b51dd4ebe
allow the api key to be set outside of config
nelsonsar/raygun4net,MindscapeHQ/raygun4net,articulate/raygun4net,tdiehl/raygun4net,ddunkin/raygun4net,ddunkin/raygun4net,MindscapeHQ/raygun4net,tdiehl/raygun4net,articulate/raygun4net,MindscapeHQ/raygun4net,nelsonsar/raygun4net
Mindscape.Raygun4Net/RaygunClient.cs
Mindscape.Raygun4Net/RaygunClient.cs
using System; using System.Net; using System.Web; using Mindscape.Raygun4Net.Messages; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Mindscape.Raygun4Net { public class RaygunClient { private readonly string _apiKey; /// <summary> /// Initializes a new instance of the <see cref="RaygunClient" /> class. /// </summary> /// <param name="apiKey">The API key.</param> public RaygunClient(string apiKey) { _apiKey = apiKey; } /// <summary> /// Initializes a new instance of the <see cref="RaygunClient" /> class. /// Uses the ApiKey specified in the config file. /// </summary> public RaygunClient() : this(RaygunSettings.Settings.ApiKey) { } public void Send(Exception exception) { var message = RaygunMessageBuilder.New .SetMachineName(Environment.MachineName) .SetExceptionDetails(exception) .SetHttpDetails(HttpContext.Current) .SetClientDetails() .Build(); Send(message); } public void Send(RaygunMessage raygunMessage) { using (var client = new WebClient()) { client.Headers.Add("X-ApiKey", _apiKey); try { client.UploadString(RaygunSettings.Settings.ApiEndpoint, JObject.FromObject(raygunMessage, new JsonSerializer { MissingMemberHandling = MissingMemberHandling.Ignore }).ToString()); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(string.Format("Error Logging Exception to Raygun.io {0}", ex.Message)); } } } } }
using System; using System.Net; using System.Web; using Mindscape.Raygun4Net.Messages; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Mindscape.Raygun4Net { public class RaygunClient { public void Send(Exception exception) { var message = RaygunMessageBuilder.New .SetMachineName(Environment.MachineName) .SetExceptionDetails(exception) .SetHttpDetails(HttpContext.Current) .SetClientDetails() .Build(); Send(message); } public void Send(RaygunMessage raygunMessage) { using (var client = new WebClient()) { client.Headers.Add("X-ApiKey", RaygunSettings.Settings.ApiKey); try { client.UploadString(RaygunSettings.Settings.ApiEndpoint, JObject.FromObject(raygunMessage, new JsonSerializer { MissingMemberHandling = MissingMemberHandling.Ignore }).ToString()); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(string.Format("Error Logging Exception to Raygun.io {0}", ex.Message)); } } } } }
mit
C#
8ec7fc8e16c25869ba430ac1c2218adc7201d264
Make MetadataToken IEquatable
fnajera-rac-de/cecil,ttRevan/cecil,jbevain/cecil,saynomoo/cecil,gluck/cecil,cgourlay/cecil,furesoft/cecil,SiliconStudio/Mono.Cecil,mono/cecil,sailro/cecil
Mono.Cecil.Metadata/MetadataToken.cs
Mono.Cecil.Metadata/MetadataToken.cs
// // Author: // Jb Evain ([email protected]) // // Copyright (c) 2008 - 2015 Jb Evain // Copyright (c) 2008 - 2011 Novell, Inc. // // Licensed under the MIT/X11 license. // using System; namespace Mono.Cecil { public struct MetadataToken : IEquatable<MetadataToken> { readonly uint token; public uint RID { get { return token & 0x00ffffff; } } public TokenType TokenType { get { return (TokenType) (token & 0xff000000); } } public static readonly MetadataToken Zero = new MetadataToken ((uint) 0); public MetadataToken (uint token) { this.token = token; } public MetadataToken (TokenType type) : this (type, 0) { } public MetadataToken (TokenType type, uint rid) { token = (uint) type | rid; } public MetadataToken (TokenType type, int rid) { token = (uint) type | (uint) rid; } public int ToInt32 () { return (int) token; } public uint ToUInt32 () { return token; } public override int GetHashCode () { return (int) token; } public bool Equals (MetadataToken other) { return other.token == token; } public override bool Equals (object obj) { if (obj is MetadataToken) { var other = (MetadataToken) obj; return other.token == token; } return false; } public static bool operator == (MetadataToken one, MetadataToken other) { return one.token == other.token; } public static bool operator != (MetadataToken one, MetadataToken other) { return one.token != other.token; } public override string ToString () { return string.Format ("[{0}:0x{1}]", TokenType, RID.ToString ("x4")); } } }
// // Author: // Jb Evain ([email protected]) // // Copyright (c) 2008 - 2015 Jb Evain // Copyright (c) 2008 - 2011 Novell, Inc. // // Licensed under the MIT/X11 license. // namespace Mono.Cecil { public struct MetadataToken { readonly uint token; public uint RID { get { return token & 0x00ffffff; } } public TokenType TokenType { get { return (TokenType) (token & 0xff000000); } } public static readonly MetadataToken Zero = new MetadataToken ((uint) 0); public MetadataToken (uint token) { this.token = token; } public MetadataToken (TokenType type) : this (type, 0) { } public MetadataToken (TokenType type, uint rid) { token = (uint) type | rid; } public MetadataToken (TokenType type, int rid) { token = (uint) type | (uint) rid; } public int ToInt32 () { return (int) token; } public uint ToUInt32 () { return token; } public override int GetHashCode () { return (int) token; } public override bool Equals (object obj) { if (obj is MetadataToken) { var other = (MetadataToken) obj; return other.token == token; } return false; } public static bool operator == (MetadataToken one, MetadataToken other) { return one.token == other.token; } public static bool operator != (MetadataToken one, MetadataToken other) { return one.token != other.token; } public override string ToString () { return string.Format ("[{0}:0x{1}]", TokenType, RID.ToString ("x4")); } } }
mit
C#
0ee61553096189a981630faa176d39d89e6bcfa6
test conversion of witness address
NicolasDorier/NBitcoin,MetacoSA/NBitcoin,stratisproject/NStratis,lontivero/NBitcoin,MetacoSA/NBitcoin
NBitcoin.Tests/JsonConverterTests.cs
NBitcoin.Tests/JsonConverterTests.cs
using NBitcoin.JsonConverters; using NBitcoin.OpenAsset; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace NBitcoin.Tests { public class JsonConverterTests { [Fact] [Trait("UnitTest", "UnitTest")] public void CanSerializeInJson() { Key k = new Key(); CanSerializeInJsonCore(DateTimeOffset.UtcNow); CanSerializeInJsonCore(new byte[] { 1, 2, 3 }); CanSerializeInJsonCore(k); CanSerializeInJsonCore(Money.Coins(5.0m)); CanSerializeInJsonCore(k.PubKey.GetAddress(Network.Main)); CanSerializeInJsonCore(new KeyPath("1/2")); CanSerializeInJsonCore(Network.Main); CanSerializeInJsonCore(new uint256(RandomUtils.GetBytes(32))); CanSerializeInJsonCore(new uint160(RandomUtils.GetBytes(20))); CanSerializeInJsonCore(new AssetId(k.PubKey)); CanSerializeInJsonCore(k.PubKey.ScriptPubKey); CanSerializeInJsonCore(new Key().PubKey.WitHash.GetAddress(Network.Main)); CanSerializeInJsonCore(new Key().PubKey.WitHash.ScriptPubKey.GetWitScriptAddress(Network.Main)); var sig = k.Sign(new uint256(RandomUtils.GetBytes(32))); CanSerializeInJsonCore(sig); CanSerializeInJsonCore(new TransactionSignature(sig, SigHash.All)); CanSerializeInJsonCore(k.PubKey.Hash); CanSerializeInJsonCore(k.PubKey.ScriptPubKey.Hash); CanSerializeInJsonCore(k.PubKey.WitHash); CanSerializeInJsonCore(k); CanSerializeInJsonCore(k.PubKey); CanSerializeInJsonCore(new WitScript(new Script(Op.GetPushOp(sig.ToDER()), Op.GetPushOp(sig.ToDER())))); CanSerializeInJsonCore(new LockTime(1)); CanSerializeInJsonCore(new LockTime(DateTime.UtcNow)); } private T CanSerializeInJsonCore<T>(T value) { var str = Serializer.ToString(value); var obj2 = Serializer.ToObject<T>(str); Assert.Equal(str, Serializer.ToString(obj2)); return obj2; } } }
using NBitcoin.JsonConverters; using NBitcoin.OpenAsset; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace NBitcoin.Tests { public class JsonConverterTests { [Fact] [Trait("UnitTest", "UnitTest")] public void CanSerializeInJson() { Key k = new Key(); CanSerializeInJsonCore(DateTimeOffset.UtcNow); CanSerializeInJsonCore(new byte[] { 1, 2, 3 }); CanSerializeInJsonCore(k); CanSerializeInJsonCore(Money.Coins(5.0m)); CanSerializeInJsonCore(k.PubKey.GetAddress(Network.Main)); CanSerializeInJsonCore(new KeyPath("1/2")); CanSerializeInJsonCore(Network.Main); CanSerializeInJsonCore(new uint256(RandomUtils.GetBytes(32))); CanSerializeInJsonCore(new uint160(RandomUtils.GetBytes(20))); CanSerializeInJsonCore(new AssetId(k.PubKey)); CanSerializeInJsonCore(k.PubKey.ScriptPubKey); var sig = k.Sign(new uint256(RandomUtils.GetBytes(32))); CanSerializeInJsonCore(sig); CanSerializeInJsonCore(new TransactionSignature(sig, SigHash.All)); CanSerializeInJsonCore(k.PubKey.Hash); CanSerializeInJsonCore(k.PubKey.ScriptPubKey.Hash); CanSerializeInJsonCore(k.PubKey.WitHash); CanSerializeInJsonCore(k); CanSerializeInJsonCore(k.PubKey); CanSerializeInJsonCore(new WitScript(new Script(Op.GetPushOp(sig.ToDER()), Op.GetPushOp(sig.ToDER())))); CanSerializeInJsonCore(new LockTime(1)); CanSerializeInJsonCore(new LockTime(DateTime.UtcNow)); } private T CanSerializeInJsonCore<T>(T value) { var str = Serializer.ToString(value); var obj2 = Serializer.ToObject<T>(str); Assert.Equal(str, Serializer.ToString(obj2)); return obj2; } } }
mit
C#
5fe309cf70d3599d92beec79fd8bcb39bbdd3493
Fix NullRef in Collision::FromContact closes https://github.com/xamarin/urho-samples/issues/12
florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho
Bindings/Portable/Collision.cs
Bindings/Portable/Collision.cs
// // Helpers to surface a simpler API for collisions // using System; using System.Runtime.InteropServices; namespace Urho.Physics { public unsafe struct CollisionData { public Vector3 ContactPosition, ContactNormal; public float ContactDistance, ContactImpulse; public CollisionData (byte *p) { ContactPosition = *(Vector3 *)p; p += 12; ContactNormal = *(Vector3 *) p; p += 12; ContactDistance = *(float *) p; p += 4; ContactImpulse = *(float *) p; } public override string ToString () { return $"[CollisionData: Position={ContactPosition}, Normal={ContactNormal}, Distance={ContactDistance}, Impuse={ContactImpulse}"; } [DllImport (Consts.NativeImport, CallingConvention=CallingConvention.Cdecl)] extern static int MemoryStream_Size (IntPtr data); [DllImport (Consts.NativeImport, CallingConvention=CallingConvention.Cdecl)] extern static int MemoryStream_GetData (IntPtr data); internal static CollisionData [] FromContactData (IntPtr data, int size) { if (data == IntPtr.Zero || size < 1) return new CollisionData[0]; const int encodedSize = 4 * 3+3+1+1; var n = size / encodedSize; byte *ptr = (byte *) data; var ret = new CollisionData [n]; for (int i = 0; i < n; i++){ ret [i] = new CollisionData (ptr); ptr += encodedSize; } return ret; } } }
// // Helpers to surface a simpler API for collisions // using System; using System.Runtime.InteropServices; namespace Urho.Physics { public unsafe struct CollisionData { public Vector3 ContactPosition, ContactNormal; public float ContactDistance, ContactImpulse; public CollisionData (byte *p) { ContactPosition = *(Vector3 *)p; p += 12; ContactNormal = *(Vector3 *) p; p += 12; ContactDistance = *(float *) p; p += 4; ContactImpulse = *(float *) p; } public override string ToString () { return $"[CollisionData: Position={ContactPosition}, Normal={ContactNormal}, Distance={ContactDistance}, Impuse={ContactImpulse}"; } [DllImport (Consts.NativeImport, CallingConvention=CallingConvention.Cdecl)] extern static int MemoryStream_Size (IntPtr data); [DllImport (Consts.NativeImport, CallingConvention=CallingConvention.Cdecl)] extern static int MemoryStream_GetData (IntPtr data); internal static CollisionData [] FromContactData (IntPtr data, int size) { const int encodedSize = 4 * 3+3+1+1; var n = size / encodedSize; byte *ptr = (byte *) data; var ret = new CollisionData [n]; for (int i = 0; i < n; i++){ ret [i] = new CollisionData (ptr); ptr += encodedSize; } return ret; } } }
mit
C#
30cf597ec2456cce133767050d08698519ded913
Use NUnit string randomizer
Chelaris182/wslib
UnitTests/Utils/RandomGeneration.cs
UnitTests/Utils/RandomGeneration.cs
using System; using NUnit.Framework; namespace UnitTests.Utils { public static class RandomGeneration { private static readonly Random random = new Random(); public static string RandomString(int sizeFrom, int sizeTo) { return TestContext.CurrentContext.Random.GetString(random.Next(sizeFrom, sizeTo)); } public static byte[] RandomArray(int size) { var list = new byte[size]; for (var i = 0; i < size; i++) list[i] = (byte)random.Next(Byte.MinValue, Byte.MaxValue); return list; } } }
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; namespace UnitTests.Utils { public static class RandomGeneration { private static readonly Random random = new Random(); private static readonly ReadOnlyCollection<char> asciiSymbols = Array.AsReadOnly(Enumerable.Range(32, 126).Select(Convert.ToChar).ToArray()); public static string RandomString(int sizeFrom, int sizeTo) { return new string(RandomCollection(asciiSymbols, sizeFrom, sizeTo)); } public static string RandomString(IReadOnlyList<char> alphabet, int sizeFrom, int sizeTo) { return new string(RandomCollection(alphabet, sizeFrom, sizeTo)); } public static T[] RandomCollection<T>(IReadOnlyList<T> alphabet, int sizeFrom, int sizeTo) { return RandomCollection(alphabet, random.Next(sizeFrom, sizeTo)); } public static T[] RandomCollection<T>(IReadOnlyList<T> alphabet, int size) { var list = new T[size]; for (var i = 0; i < size; i++) list[i] = alphabet[random.Next(alphabet.Count)]; return list; } public static byte[] RandomArray(int size) { var list = new byte[size]; for (var i = 0; i < size; i++) list[i] = (byte)random.Next(Byte.MinValue, Byte.MaxValue); return list; } } }
mit
C#
f27366b62da2541a28c50e45fcd44dea266bb315
Update GetAgeStoreFunctionInjectionConvention.cs
divega/UdfCodeFirstSample
UdfCodeFirstSample/GetAgeStoreFunctionInjectionConvention.cs
UdfCodeFirstSample/GetAgeStoreFunctionInjectionConvention.cs
using System.Data.Entity.Core.Metadata.Edm; using System.Data.Entity.Infrastructure; using System.Data.Entity.ModelConfiguration.Conventions; namespace UdfCodeFirstSample { public class GetAgeStoreFunctionInjectionConvention : IStoreModelConvention<EdmModel> { public void Apply(EdmModel item, DbModel model) { var parameter = FunctionParameter.Create( "birthDate", model.GetStorePrimitiveType(PrimitiveTypeKind.DateTime), ParameterMode.In); var returnValue = FunctionParameter.Create( "result", model.GetStorePrimitiveType(PrimitiveTypeKind.Int32), ParameterMode.ReturnValue); var function = item.CreateAndAddFunction( "GetAge", new[] {parameter}, new[] {returnValue}); } } }
using System.Data.Entity.Core.Metadata.Edm; using System.Data.Entity.Infrastructure; using System.Data.Entity.ModelConfiguration.Conventions; namespace UdfCodeFirstSample { public class GetAgeStoreFunctionInjectionConvention : IStoreModelConvention<EdmModel> { public void Apply(EdmModel item, DbModel model) { FunctionParameter parameter = FunctionParameter.Create( "birthDate", model.GetStorePrimitiveType(PrimitiveTypeKind.DateTime), ParameterMode.In); FunctionParameter returnValue = FunctionParameter.Create( "result", model.GetStorePrimitiveType(PrimitiveTypeKind.Int32), ParameterMode.ReturnValue); EdmFunction function = item.CreateAndAddFunction( "GetAge", new[] {parameter}, new[] {returnValue}); } } }
apache-2.0
C#
a7e6b25b1c5254654b81264eb6b2524bc64dd5c1
add comment
Luke-Wolf/krystal-voicecontrol
Krystal.Voice/Form1.cs
Krystal.Voice/Form1.cs
// // Copyright 2014 Terry // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace Krystal.Voice { public partial class Kristal : Form { MyPipeline pp = new MyPipeline(); public Kristal() { InitializeComponent(); } private void Kristal_Load(object sender, EventArgs e) { //Kick the voice recognition pipline off into it's own thread so that it doesn't block the form. Thread thread = new Thread(voiceloop); thread.Start(); } private void voiceloop() { pp.LoopFrames(); pp.Dispose(); } } }
// // Copyright 2014 Terry // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace Krystal.Voice { public partial class Kristal : Form { MyPipeline pp = new MyPipeline(); public Kristal() { InitializeComponent(); } private void Kristal_Load(object sender, EventArgs e) { Thread thread = new Thread(voiceloop); thread.Start(); } private void voiceloop() { pp.LoopFrames(); pp.Dispose(); } } }
apache-2.0
C#
8b42199c5d08321388c49355e43574005598b1d3
Comment out jump list support again as no SDK is out yet... :(
sibbl/ParkenDD
ParkenDD/Services/JumpListService.cs
ParkenDD/Services/JumpListService.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; using Windows.UI.StartScreen; using ParkenDD.Api.Models; namespace ParkenDD.Services { public class JumpListService { private readonly ResourceService _resources; private const string ArgumentFormat = "city={0}"; public JumpListService(ResourceService resources) { _resources = resources; } public async void UpdateCityList(IEnumerable<MetaDataCityRow> metaData) { await UpdateCityListAsync(metaData); } public async Task UpdateCityListAsync(IEnumerable<MetaDataCityRow> cities) { /* if (cities == null) { return; } if (JumpList.IsSupported()) { var jumpList = await JumpList.LoadCurrentAsync(); jumpList.SystemGroupKind = JumpListSystemGroupKind.None; jumpList.Items.Clear(); foreach (var city in cities) { var item = JumpListItem.CreateWithArguments(string.Format(ArgumentFormat, city.Id), city.Name); item.GroupName = _resources.JumpListCitiesHeader; item.Logo = new Uri("ms-appx:///Assets/ParkingIcon.png"); jumpList.Items.Add(item); } await jumpList.SaveAsync(); } */ } } }
using System; using System.Collections.Generic; using System.Threading.Tasks; using Windows.UI.StartScreen; using ParkenDD.Api.Models; namespace ParkenDD.Services { public class JumpListService { private readonly ResourceService _resources; private const string ArgumentFormat = "city={0}"; public JumpListService(ResourceService resources) { _resources = resources; } public async void UpdateCityList(IEnumerable<MetaDataCityRow> metaData) { await UpdateCityListAsync(metaData); } public async Task UpdateCityListAsync(IEnumerable<MetaDataCityRow> cities) { if (cities == null) { return; } if (JumpList.IsSupported()) { var jumpList = await JumpList.LoadCurrentAsync(); jumpList.SystemGroupKind = JumpListSystemGroupKind.None; jumpList.Items.Clear(); foreach (var city in cities) { var item = JumpListItem.CreateWithArguments(string.Format(ArgumentFormat, city.Id), city.Name); item.GroupName = _resources.JumpListCitiesHeader; item.Logo = new Uri("ms-appx:///Assets/ParkingIcon.png"); jumpList.Items.Add(item); } await jumpList.SaveAsync(); } } } }
mit
C#
23874f0ea5e54d4c5293b2de0d586504f088c92f
Remove unnecessary permission
kentcb/WorkoutWotch
Src/WorkoutWotch.UI.Android/Properties/AssemblyInfo.cs
Src/WorkoutWotch.UI.Android/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Android.App; // 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("WorkoutWotch.UI.Droid")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WorkoutWotch.UI.Droid")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // 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")] // Add some common permissions, these can be removed if not needed [assembly: UsesPermission(Android.Manifest.Permission.Internet)]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Android.App; // 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("WorkoutWotch.UI.Droid")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WorkoutWotch.UI.Droid")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // 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")] // Add some common permissions, these can be removed if not needed [assembly: UsesPermission(Android.Manifest.Permission.Internet)] [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
mit
C#
d880e2d904ff4c7f78e0047d141c5dd877698a19
set { LineCount = value; }
zptec/Liq_UI
Liq_UI/Translation/TranslationSegment.cs
Liq_UI/Translation/TranslationSegment.cs
using System.Collections.Generic; namespace Liq_UI.Translation { internal class TranslationSegment { //Begin Line int BeginLine; //Line Count int LineCount { get { return CodeLines.Count; } set { LineCount = value; } } //End Line int EndLine { get { return BeginLine + LineCount + 1; } } //Code Lines List<string> CodeLines = new List<string>(); } }
namespace Liq_UI.Translation { internal class TranslationSegment { //Begin Line int BeginLine; //Line Count int LineCount; //End Line int EndLine { get { return BeginLine + LineCount + 1; } } } }
mit
C#
b9c6d73be0617d517c3f85def91a1c3d88778a7d
clean up
dkataskin/bstrkr
bstrkr.mobile/bstrkr.core/Providers/Bus13LiveDataProvider.cs
bstrkr.mobile/bstrkr.core/Providers/Bus13LiveDataProvider.cs
using System; using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using System.Xml; using System.Xml.Linq; using RestSharp.Portable; using RestSharp.Portable.Deserializers; namespace bstrkr.core.providers { public class Bus13LiveDataProvider : ILiveDataProvider { private string _endpoint; private string _location; public Bus13LiveDataProvider(string endpoint, string location) { _endpoint = endpoint; _location = location; } public IEnumerable<Route> GetRoutes() { return null; } public async Task<IEnumerable<Route>> GetRoutesAsync() { var routeTypes = await this.GetRouteTypesAsync().ConfigureAwait(false); var request = new RestRequest("searchAllRouteTypes.php"); request.AddParameter("city", _location, ParameterType.QueryString); var client = this.GetRestClient(); return await Task.Factory.StartNew(() => { var response = client.Execute<string>(request).Result; return this.ParseRoutes(response.Data); }).ConfigureAwait(false); } public IEnumerable<Vehicle> GetVehicles() { return null; } public async Task<IEnumerable<Vehicle>> GetVehiclesAsync() { throw new NotImplementedException (); } private RestClient GetRestClient() { var client = new RestClient(_endpoint); client.ClearHandlers(); client.RemoveHandler("text/html"); client.AddHandler("text/html", new JsonDeserializer()); return client; } private async Task<IEnumerable<Bus13RouteType>> GetRouteTypesAsync() { var request = new RestRequest("searchAllRouteTypes.php"); request.AddParameter("city", _location, ParameterType.QueryString); var client = this.GetRestClient(); return await Task.Factory.StartNew(() => { try { var response = client.Execute<Bus13RouteType[]>(request).Result; return response.Data; } catch (Exception ex) { return null; } }).ConfigureAwait(false); } private IEnumerable<Route> ParseRoutes(string routes) { if (string.IsNullOrEmpty(routes)) { return new List<Route>(); } return new List<Route>(); } private class Bus13RouteType { public string typeId { get; set; } public string typeName { get; set; } public string typeShName { get; set; } } } }
using System; using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using System.Xml; using System.Xml.Linq; using RestSharp.Portable; using RestSharp.Portable.Deserializers; namespace bstrkr.core.providers { public class Bus13LiveDataProvider : ILiveDataProvider { private string _endpoint; private string _location; public Bus13LiveDataProvider(string endpoint, string location) { _endpoint = endpoint; _location = location; } public IEnumerable<Route> GetRoutes() { return null; } public async Task<IEnumerable<Route>> GetRoutesAsync() { var routeTypes = await this.GetRouteTypesAsync().ConfigureAwait(false); var request = new RestRequest("searchAllRouteTypes.php"); request.AddParameter("city", _location, ParameterType.QueryString); var client = this.GetRestClient(); return await Task.Factory.StartNew(() => { var response = client.Execute<string>(request).Result; return this.ParseRoutes(response.Data); }).ConfigureAwait(false); } public IEnumerable<Vehicle> GetVehicles() { return null; } public async Task<IEnumerable<Vehicle>> GetVehiclesAsync() { throw new NotImplementedException (); } private RestClient GetRestClient() { var client = new RestClient(_endpoint); client.ClearHandlers(); client.RemoveHandler("text/html"); client.AddHandler("text/html", new JsonDeserializer()); return client; } private async Task<IEnumerable<RouteType>> GetRouteTypesAsync() { var request = new RestRequest("searchAllRouteTypes.php"); request.AddParameter("city", _location, ParameterType.QueryString); var client = this.GetRestClient(); return await Task.Factory.StartNew(() => { try { var response = client.Execute<RouteType[]>(request).Result; return response.Data; } catch (Exception ex) { return null; } }).ConfigureAwait(false); } private IEnumerable<Route> ParseRoutes(string routes) { if (string.IsNullOrEmpty(routes)) { return new List<Route>(); } return new List<Route>(); } private class Bus13RouteType { public string typeId { get; set; } public string typeName { get; set; } public string typeShName { get; set; } } } }
bsd-2-clause
C#
d1a3bfc27fc7c1a8c1f09e67cac802ed1f242d38
Fix compile issue
gphoto/libgphoto2.OLDMIGRATION,gphoto/libgphoto2.OLDMIGRATION,gphoto/libgphoto2.OLDMIGRATION,gphoto/libgphoto2.OLDMIGRATION
bindings/csharp/Object.cs
bindings/csharp/Object.cs
using System; using System.Runtime.InteropServices; namespace LibGPhoto2 { public abstract class Object : System.IDisposable { protected HandleRef handle; private bool disposed = false; public HandleRef Handle { get { return handle; } } public Object () {} public Object (IntPtr ptr) { handle = new HandleRef (this, ptr); } protected abstract void Cleanup (); public void Dispose () { Dispose (true); System.GC.SuppressFinalize (this); } private void Dispose (bool disposing) { if (!disposed) { if (disposing) { // clean up anything that's managed } // clean up any unmanaged objects Cleanup (); disposed = true; } else { Console.WriteLine ("Saved us from doubly disposing an object!"); } } ~Object () { Dispose (false); } } }
using System; using System.Runtime.InteropServices; namespace LibGPhoto2 { public abstract class Object : System.IDisposable { protected HandleRef handle; private bool disposed = false; public HandleRef Handle { get { return handle; } } public Object () {} public Object (IntPtr ptr) { handle = new HandleRef (this, ptr); } protected abstract void Cleanup (); public void Dispose () { Dispose (true); System.GC.SuppressFinalize (this); } private void Dispose (bool disposing) { if (!disposed) { if (disposing) { // clean up anything that's managed handle = null; } // clean up any unmanaged objects Cleanup (); disposed = true; } else { Console.WriteLine ("Saved us from doubly disposing an object!"); } } ~Object () { Dispose (false); } } }
lgpl-2.1
C#
39adf1adc6b55278115f8773fa4c6c6ff4d59c21
Use type.fullname now
wanachengwang/UnityGameFlow,wanachengwang/UnityGameFlow,wanachengwang/UnityGameFlow,wanachengwang/UnityGameFlow
HotFixProject/HotFix/Class1.cs
HotFixProject/HotFix/Class1.cs
using System; using UnityEngine; // Patch the same fullname(namespace&classname) namespace ILHotFix { public class ILHFHelloWorld { public static void Start(ILHFHelloWorld self) { Debug.Log("HotFix:ILHFHelloWorld.Start."); } static int _cnt = 0; public static void Update(ILHFHelloWorld self) { if((_cnt++&0x3f) == 0) { Debug.Log("HotFix:ILHFHelloWorld.Update."); } } } }
using System; using UnityEngine; namespace HotFix { public class ILHFHelloWorld { public static void Start(ILHFHelloWorld self) { Debug.Log("HotFix.ILHFHelloWorld.Start."); } static int _cnt = 0; public static void Update(ILHFHelloWorld self) { if((_cnt++&0x3f) == 0) { Debug.Log("HotFix.ILHFHelloWorld.Update."); } } } }
mit
C#
3c7d9de2b1eff2296694c60c326cbb6419d9c6e5
Support full screen now that core MonoMac supports it
l8s/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,l8s/Eto,l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,bbqchickenrobot/Eto-1
Source/Eto.Test/Eto.Test.Mac/Startup.cs
Source/Eto.Test/Eto.Test.Mac/Startup.cs
using System; using System.Drawing; using MonoMac.Foundation; using MonoMac.AppKit; using MonoMac.ObjCRuntime; using Eto.Forms; namespace Eto.Test.Mac { class Startup { static void Main (string [] args) { AddStyles (); var generator = new Eto.Platform.Mac.Generator (); var app = new TestApplication (generator); app.Run (args); } static void AddStyles () { // support full screen mode! Style.Add<Window, NSWindow> ("main", (widget, control) => { control.CollectionBehavior |= NSWindowCollectionBehavior.FullScreenPrimary; }); Style.Add<Application, NSApplication> ("application", (widget, control) => { if (control.RespondsToSelector (new Selector ("presentationOptions:"))) { control.PresentationOptions |= NSApplicationPresentationOptions.FullScreen; } }); // other styles Style.Add<TreeView, NSScrollView> ("sectionList", (widget, control) => { control.BorderType = NSBorderType.NoBorder; var table = control.DocumentView as NSTableView; table.SelectionHighlightStyle = NSTableViewSelectionHighlightStyle.SourceList; }); } } }
using System; using System.Drawing; using MonoMac.Foundation; using MonoMac.AppKit; using MonoMac.ObjCRuntime; using Eto.Forms; namespace Eto.Test.Mac { class Startup { static void Main (string [] args) { AddStyles (); var generator = new Eto.Platform.Mac.Generator (); var app = new TestApplication (generator); app.Run (args); } static void AddStyles () { // support full screen mode! Style.Add<Window, NSWindow> ("main", (widget, control) => { //control.CollectionBehavior |= NSWindowCollectionBehavior.FullScreenPrimary; // not in monomac/master yet.. }); Style.Add<Application, NSApplication> ("application", (widget, control) => { if (control.RespondsToSelector (new Selector ("presentationOptions:"))) { control.PresentationOptions |= NSApplicationPresentationOptions.FullScreen; } }); // other styles Style.Add<TreeView, NSScrollView> ("sectionList", (widget, control) => { control.BorderType = NSBorderType.NoBorder; var table = control.DocumentView as NSTableView; table.SelectionHighlightStyle = NSTableViewSelectionHighlightStyle.SourceList; }); } } }
bsd-3-clause
C#
ccba9da43e599a0b60e82595671503bd855e0fdd
Bump version to 1.5
davidebbo/WebActivator
WebActivator/Properties/AssemblyInfo.cs
WebActivator/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Web; // 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("WebActivator")] [assembly: AssemblyDescription("A NuGet package that allows other packages to execute some startup code in web apps")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("David Ebbo")] [assembly: AssemblyProduct("WebActivator")] [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] [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("3bc078bd-ade4-4271-964f-1d041508c419")] [assembly: InternalsVisibleTo("WebActivatorTest")] // 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.5")] [assembly: PreApplicationStartMethod(typeof(WebActivator.ActivationManager), "Run")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Web; // 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("WebActivator")] [assembly: AssemblyDescription("A NuGet package that allows other packages to execute some startup code in web apps")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("David Ebbo")] [assembly: AssemblyProduct("WebActivator")] [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] [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("3bc078bd-ade4-4271-964f-1d041508c419")] [assembly: InternalsVisibleTo("WebActivatorTest")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.4.0")] [assembly: PreApplicationStartMethod(typeof(WebActivator.ActivationManager), "Run")]
apache-2.0
C#
d01485700d9bd3e30d2ee93914e14c210f5d8034
work on 2.0.8 started
fabsenet/adrilight,fabsenet/adrilight
adrilight/Properties/AssemblyInfo.cs
adrilight/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // die mit einer Assembly verknüpft sind. [assembly: AssemblyTitle("adrilight")] [assembly: AssemblyDescription("An Ambilight clone for Windows based sources - HTPC or just a normal PC")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("fabsenet")] [assembly: AssemblyProduct("adrilight")] [assembly: AssemblyCopyright("MIT Licence")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. [assembly: ComVisible(false)] // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird [assembly: Guid("657d437d-a560-4b5e-9926-b3acb5868f6d")] // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: // // Hauptversion // Nebenversion // Buildnummer // Revision // // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.8")] [assembly: InternalsVisibleTo("adrilight.Tests")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // die mit einer Assembly verknüpft sind. [assembly: AssemblyTitle("adrilight")] [assembly: AssemblyDescription("An Ambilight clone for Windows based sources - HTPC or just a normal PC")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("fabsenet")] [assembly: AssemblyProduct("adrilight")] [assembly: AssemblyCopyright("MIT Licence")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. [assembly: ComVisible(false)] // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird [assembly: Guid("657d437d-a560-4b5e-9926-b3acb5868f6d")] // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: // // Hauptversion // Nebenversion // Buildnummer // Revision // // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.7")] [assembly: InternalsVisibleTo("adrilight.Tests")]
mit
C#
ce4660448e323cf254d5d62acf4e54b34e138d93
Enable raven studio for port 8081
Vavro/DragonContracts,Vavro/DragonContracts
DragonContracts/DragonContracts/Base/RavenDbController.cs
DragonContracts/DragonContracts/Base/RavenDbController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using System.Web; using System.Web.Http; using System.Web.Http.Controllers; using DragonContracts.Models; using Raven.Client; using Raven.Client.Document; using Raven.Client.Embedded; using Raven.Database.Config; using Raven.Database.Server.Responders; namespace DragonContracts.Base { public class RavenDbController : ApiController { private const int RavenWebUiPort = 8081; public IDocumentStore Store { get { return LazyDocStore.Value; } } private static readonly Lazy<IDocumentStore> LazyDocStore = new Lazy<IDocumentStore>(() => { var docStore = new EmbeddableDocumentStore() { DataDirectory = "App_Data/Raven", UseEmbeddedHttpServer = true }; docStore.Configuration.Port = RavenWebUiPort; Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(RavenWebUiPort); docStore.Initialize(); return docStore; }); public IAsyncDocumentSession Session { get; set; } public async override Task<HttpResponseMessage> ExecuteAsync( HttpControllerContext controllerContext, CancellationToken cancellationToken) { using (Session = Store.OpenAsyncSession()) { var result = await base.ExecuteAsync(controllerContext, cancellationToken); await Session.SaveChangesAsync(); return result; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using System.Web; using System.Web.Http; using System.Web.Http.Controllers; using DragonContracts.Models; using Raven.Client; using Raven.Client.Document; using Raven.Client.Embedded; using Raven.Database.Server.Responders; namespace DragonContracts.Base { public class RavenDbController : ApiController { public IDocumentStore Store { get { return LazyDocStore.Value; } } private static readonly Lazy<IDocumentStore> LazyDocStore = new Lazy<IDocumentStore>(() => { var docStore = new EmbeddableDocumentStore() { DataDirectory = "App_Data/Raven" }; docStore.Initialize(); return docStore; }); public IAsyncDocumentSession Session { get; set; } public async override Task<HttpResponseMessage> ExecuteAsync( HttpControllerContext controllerContext, CancellationToken cancellationToken) { using (Session = Store.OpenAsyncSession()) { var result = await base.ExecuteAsync(controllerContext, cancellationToken); await Session.SaveChangesAsync(); return result; } } } }
mit
C#
7d6915de0ec1f2d6b49316174249060cb392937c
modify demo
jiehanlin/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,wanddy/WeiXinMPSDK,lishewen/WeiXinMPSDK,down4u/WeiXinMPSDK,down4u/WeiXinMPSDK,lishewen/WeiXinMPSDK,wanddy/WeiXinMPSDK,mc7246/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,mc7246/WeiXinMPSDK,down4u/WeiXinMPSDK,mc7246/WeiXinMPSDK,lishewen/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,wanddy/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,JeffreySu/WeiXinMPSDK
src/Senparc.Weixin.MP.Sample/Senparc.Weixin.MP.Sample/Models/ProductModel.cs
src/Senparc.Weixin.MP.Sample/Senparc.Weixin.MP.Sample/Models/ProductModel.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Senparc.Weixin.MP.Sample.Models { /// <summary> /// 商品实体类 /// </summary> public class ProductModel { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public ProductModel() { } public ProductModel(int id, string name, decimal price) { Id = id; Name = name; Price = price; } private static List<ProductModel> ProductList { get; set; } public static List<ProductModel> GetFakeProductList() { var list = ProductList ?? new List<ProductModel>() { new ProductModel(1,"产品1",(decimal)1.00), new ProductModel(2,"产品2",(decimal)2.00), new ProductModel(3,"产品3",(decimal)3.00), new ProductModel(4,"产品4",(decimal)4.00), new ProductModel(5,"捐赠1",(decimal)10.00), new ProductModel(6,"捐赠2",(decimal)50.00), new ProductModel(7,"捐赠3",(decimal)100.00), new ProductModel(8,"捐赠4",(decimal)500.00), }; ProductList = ProductList ?? list; return list; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Senparc.Weixin.MP.Sample.Models { /// <summary> /// 商品实体类 /// </summary> public class ProductModel { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public ProductModel() { } public ProductModel(int id, string name, decimal price) { Id = id; Name = name; Price = price; } private static List<ProductModel> ProductList { get; set; } public static List<ProductModel> GetFakeProductList() { var list = ProductList ?? new List<ProductModel>() { new ProductModel(1,"产品1",(decimal)0.01), new ProductModel(2,"产品2",(decimal)2.00), new ProductModel(3,"产品3",(decimal)3.00), new ProductModel(4,"产品4",(decimal)4.00), new ProductModel(5,"捐赠1",(decimal)10.00), new ProductModel(6,"捐赠2",(decimal)50.00), new ProductModel(7,"捐赠3",(decimal)100.00), new ProductModel(8,"捐赠4",(decimal)500.00), }; ProductList = ProductList ?? list; return list; } } }
apache-2.0
C#
a6334e0169f3fb577c368c45bd3c1017eea3420e
Remove Dimension from IObjectiveFunction interface.
geoem/MSolve,geoem/MSolve
ISAAR.MSolve.Analyzers/Optimization/IObjectiveFunction.cs
ISAAR.MSolve.Analyzers/Optimization/IObjectiveFunction.cs
using ISAAR.MSolve.Matrices; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ISAAR.MSolve.Analyzers.Optimization { public interface IObjectiveFunction { /// <summary> /// Calculates the fitness value of the function. /// </summary> /// <param name="x">The continuous decision variable vector. /// </param> /// <returns> /// The fitness value. /// </returns> double Fitness(double[] x); } }
using ISAAR.MSolve.Matrices; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ISAAR.MSolve.Analyzers.Optimization { public interface IObjectiveFunction { /// <summary> /// Calculates the fitness value of the function. /// </summary> /// <param name="x">The continuous decision variable vector. /// </param> /// <returns> /// The fitness value. /// </returns> double Fitness(double[] x); /// <summary> /// Gets the dimension of the decision variable. /// </summary> /// <returns> /// The dimension of the decision variable. /// </returns> int Dimension(); } }
apache-2.0
C#
3d757cb813ca8509ca9a4c3ea4b1ba31405b8261
increase version
tinohager/Nager.AmazonProductAdvertising,tinohager/Nager.AmazonProductAdvertising
Nager.AmazonProductAdvertising/Properties/AssemblyInfo.cs
Nager.AmazonProductAdvertising/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("Nager.AmazonProductAdvertising")] [assembly: AssemblyDescription("Amazon ProductAdvertising")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("nager.at")] [assembly: AssemblyProduct("Nager.AmazonProductAdvertising")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("026a9ee3-9a48-48a1-9026-1573f2e8a85e")] // 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.12.0")] [assembly: AssemblyFileVersion("1.0.12.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("Nager.AmazonProductAdvertising")] [assembly: AssemblyDescription("Amazon ProductAdvertising")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("nager.at")] [assembly: AssemblyProduct("Nager.AmazonProductAdvertising")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("026a9ee3-9a48-48a1-9026-1573f2e8a85e")] // 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.11.0")] [assembly: AssemblyFileVersion("1.0.11.0")]
mit
C#
2ea5a97784b7c46f4a34e28572ea5662e7829b58
Fix ClickableText test case
NeoAdonis/osu,peppy/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu-new,johnneijzen/osu,smoogipoo/osu,2yangk23/osu,johnneijzen/osu,EVAST9919/osu,peppy/osu,UselessToucan/osu,ppy/osu,ZLima12/osu,ZLima12/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,peppy/osu,UselessToucan/osu,EVAST9919/osu,smoogipooo/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu
osu.Game.Tests/Visual/TestCaseClickableText.cs
osu.Game.Tests/Visual/TestCaseClickableText.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; using System; using System.Collections.Generic; namespace osu.Game.Tests.Visual { public class TestCaseClickableText : OsuTestCase { public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ClickableText), typeof(FillFlowContainer) }; public TestCaseClickableText() { ClickableText text; Add(new FillFlowContainer<ClickableText> { Direction = FillDirection.Vertical, Children = new[] { new ClickableText{ Text = "Default", }, new ClickableText{ IsEnabled = false, Text = "Disabled", }, new ClickableText{ Text = "Without sounds", IsMuted = true, }, new ClickableText{ Text = "Without click sounds", IsClickMuted = true, }, new ClickableText{ Text = "Without hover sounds", IsHoverMuted = true, }, text = new ClickableText{ Text = "Disables after click (Action)", }, new ClickableText{ Text = "Has tooltip", TooltipText = "Yep", } } }); text.Action = () => text.IsEnabled = false; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; using System; using System.Collections.Generic; namespace osu.Game.Tests.Visual { public class TestCaseClickableText : OsuTestCase { public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ClickableText) }; public TestCaseClickableText() { ClickableText text; AddRange(new[] { new ClickableText{ Text = "Default", }, new ClickableText{ IsEnabled = false, Text = "Disabled", }, new ClickableText{ Text = "Without sounds", IsMuted = true, }, new ClickableText{ Text = "Without click sounds", IsClickMuted = true, }, new ClickableText{ Text = "Without hover sounds", IsHoverMuted = true, }, text = new ClickableText{ Text = "Disables after click (Action)", }, new ClickableText{ Text = "Has tooltip", TooltipText = "Yep", } }); text.Action = () => text.IsEnabled = false; } } }
mit
C#
fa6074925e8bf58d010b9d3a5459277643560dc1
Remove unused variable
smoogipoo/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu-new,ZLima12/osu,UselessToucan/osu,peppy/osu,2yangk23/osu,EVAST9919/osu,NeoAdonis/osu,EVAST9919/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,ZLima12/osu,johnneijzen/osu,smoogipoo/osu,2yangk23/osu,ppy/osu
osu.Game.Tests/Visual/TestCaseTextBadgePair.cs
osu.Game.Tests/Visual/TestCaseTextBadgePair.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Overlays.Changelog.Header; namespace osu.Game.Tests.Visual { public class TestCaseTextBadgePair : OsuTestCase { public TestCaseTextBadgePair() { TextBadgePair textBadgePair; Add(new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, Width = 250, Height = 50, Children = new Drawable[] { new Box { Colour = Color4.Gray, Alpha = 0.5f, RelativeSizeAxes = Axes.Both, }, textBadgePair = new TextBadgePair(Color4.DeepSkyBlue, "Test") { Anchor = Anchor.Centre, Origin = Anchor.Centre, } } }); AddStep(@"Deactivate", textBadgePair.Deactivate); AddStep(@"Activate", textBadgePair.Activate); AddStep(@"Hide text", () => textBadgePair.HideText(200)); AddStep(@"Show text", () => textBadgePair.ShowText(200)); AddStep(@"Different text", () => textBadgePair.ChangeText(200, "This one's a little bit wider")); AddWaitStep(1); AddStep(@"Different text", () => textBadgePair.ChangeText(200, "Ok?..")); } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Overlays.Changelog.Header; namespace osu.Game.Tests.Visual { public class TestCaseTextBadgePair : OsuTestCase { public TestCaseTextBadgePair() { Container container; TextBadgePair textBadgePair; Add(container = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, Width = 250, Height = 50, Children = new Drawable[] { new Box { Colour = Color4.Gray, Alpha = 0.5f, RelativeSizeAxes = Axes.Both, }, textBadgePair = new TextBadgePair(Color4.DeepSkyBlue, "Test") { Anchor = Anchor.Centre, Origin = Anchor.Centre, } } }); AddStep(@"Deactivate", textBadgePair.Deactivate); AddStep(@"Activate", textBadgePair.Activate); AddStep(@"Hide text", () => textBadgePair.HideText(200)); AddStep(@"Show text", () => textBadgePair.ShowText(200)); AddStep(@"Different text", () => textBadgePair.ChangeText(200, "This one's a little bit wider")); AddWaitStep(1); AddStep(@"Different text", () => textBadgePair.ChangeText(200, "Ok?..")); } } }
mit
C#
64f04c81e18758ff031e38b19e6d9a2cca471fcb
Add support for encrypt/decrypt single URL from the command line
babelmark/babelmark-proxy
src/EncryptApp/Program.cs
src/EncryptApp/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using BabelMark; using Newtonsoft.Json; namespace EncryptApp { /// <summary> /// Programs to encode/decode the babelmark-registry (https://github.com/babelmark/babelmark-registry) /// Or to encode locally an URL /// </summary> class Program { static int Main(string[] args) { if (args.Length < 2 || args.Length > 3) { Console.WriteLine("Usage: passphrase decode|encode [url?]"); return 1; } if (!(args[1] == "decode" || args[1] == "encode")) { Console.WriteLine("Usage: passphrase decode|encode"); Console.WriteLine($"Invalid argument ${args[1]}"); return 1; } var passphrase = args[0]; var encode = args[1] == "encode"; if (args.Length == 3) { var url = args[2]; Console.WriteLine(encode ? StringCipher.Encrypt(url, passphrase) : StringCipher.Decrypt(url, passphrase)); } else { Environment.SetEnvironmentVariable(MarkdownRegistry.PassphraseEnv, passphrase); var entries = MarkdownRegistry.Instance.GetEntriesAsync().Result; foreach (var entry in entries) { if (encode) { var originalUrl = entry.Url; entry.Url = StringCipher.Encrypt(entry.Url, passphrase); var testDecrypt = StringCipher.Decrypt(entry.Url, passphrase); if (originalUrl != testDecrypt) { Console.WriteLine("Unexpected error while encrypt/decrypt. Not matching"); return 1; } } } Console.WriteLine(JsonConvert.SerializeObject(entries, Formatting.Indented)); } return 0; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using BabelMark; using Newtonsoft.Json; namespace EncryptApp { class Program { static int Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Usage: passphrase decode|encode"); return 1; } if (!(args[1] == "decode" || args[1] == "encode")) { Console.WriteLine("Usage: passphrase decode|encode"); Console.WriteLine($"Invalid argument ${args[1]}"); return 1; } var encode = args[1] == "encode"; Environment.SetEnvironmentVariable(MarkdownRegistry.PassphraseEnv, args[0]); var entries = MarkdownRegistry.Instance.GetEntriesAsync().Result; foreach (var entry in entries) { if (encode) { var originalUrl = entry.Url; entry.Url = StringCipher.Encrypt(entry.Url, args[0]); var testDecrypt = StringCipher.Decrypt(entry.Url, args[0]); if (originalUrl != testDecrypt) { Console.WriteLine("Unexpected error while encrypt/decrypt. Not matching"); return 1; } } } Console.WriteLine(JsonConvert.SerializeObject(entries, Formatting.Indented)); return 0; } } }
bsd-2-clause
C#
f4d8733710261e046a78c4e16e30092161533f4e
allow the user to create things
Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate
Sample.Host/Program.cs
Sample.Host/Program.cs
using System; using System.IO; using System.Security.Claims; using Ledger.Stores; using Ledger.Stores.Fs; using Magistrate; using Magistrate.WebInterface; using Microsoft.Owin.Hosting; using Serilog; namespace Sample.Host { class Program { static void Main(string[] args) { var host = WebApp.Start("http://localhost:4444", app => { Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.ColoredConsole() .CreateLogger(); app.Use(typeof(SerilogMiddleware)); //add a login provider here //app.Use<WindowsAuthentication>(); Directory.CreateDirectory("store"); app.UseMagistrateApi(config => { config.EventStore = new FileEventStore("store"); config.User = () => { //e.g. take user from ClaimsPrincipal: //var current = ClaimsPrincipal.Current; //return new MagistrateUser //{ // Name = current.Identity.Name, // Key = current.Identity.Name.ToLower().Replace(" ", "") //}; return new MagistrateUser { Name = "Andy Dote", Key = "andy-dote", CanCreatePermissions = true, CanCreateRoles = true, CanCreateUsers = true, }; }; }); var ui = new MagistrateWebInterface(); ui.Configure(app); }); Console.WriteLine("Press any key to exit."); Console.ReadKey(); host.Dispose(); } } }
using System; using System.IO; using System.Security.Claims; using Ledger.Stores; using Ledger.Stores.Fs; using Magistrate; using Magistrate.WebInterface; using Microsoft.Owin.Hosting; using Serilog; namespace Sample.Host { class Program { static void Main(string[] args) { var host = WebApp.Start("http://localhost:4444", app => { Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.ColoredConsole() .CreateLogger(); app.Use(typeof(SerilogMiddleware)); //add a login provider here //app.Use<WindowsAuthentication>(); Directory.CreateDirectory("store"); app.UseMagistrateApi(config => { config.EventStore = new FileEventStore("store"); config.User = () => { //e.g. take user from ClaimsPrincipal: //var current = ClaimsPrincipal.Current; //return new MagistrateUser //{ // Name = current.Identity.Name, // Key = current.Identity.Name.ToLower().Replace(" ", "") //}; return new MagistrateUser { Name = "Andy Dote", Key = "andy-dote" }; }; }); var ui = new MagistrateWebInterface(); ui.Configure(app); }); Console.WriteLine("Press any key to exit."); Console.ReadKey(); host.Dispose(); } } }
lgpl-2.1
C#
358111632eff2dfe340bb31cec460a5f26ab5c60
Remove diagnostic code from MorphInto(); close #12
arthurrump/Zermelo.App.UWP
Zermelo.App.UWP/Helpers/ObservableCollectionExtensions.cs
Zermelo.App.UWP/Helpers/ObservableCollectionExtensions.cs
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Zermelo.App.UWP.Helpers { static class ObservableCollectionExtensions { public static void MorphInto<TSource>(this ObservableCollection<TSource> first, IEnumerable<TSource> second) { var add = second.Except(first).ToList(); var remove = first.Except(second).ToList(); foreach (var i in remove) first.Remove(i); foreach (var i in add) first.Add(i); // If there are any changes to first, make sure it's in // the same order as second. if (add.Count() > 0 || remove.Count() > 0) for (int i = 0; i < second.Count(); i++) first.Move(first.IndexOf(second.ElementAt(i)), i); } } }
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Zermelo.App.UWP.Helpers { static class ObservableCollectionExtensions { public static void MorphInto<TSource>(this ObservableCollection<TSource> first, IEnumerable<TSource> second) { var add = second.Except(first).ToList(); var remove = first.Except(second).ToList(); // TODO: Remove the diagnostic try-catch blocks, when #12 is fixed try { foreach (var i in remove) first.Remove(i); } catch (InvalidOperationException ex) { throw new Exception("Exception in the Remove loop.", ex); } try { foreach (var i in add) first.Add(i); } catch (InvalidOperationException ex) { throw new Exception("Exception in the Add loop.", ex); } try { // If there are any changes to first, make sure it's in // the same order as second. if (add.Count() > 0 || remove.Count() > 0) for (int i = 0; i < second.Count(); i++) first.Move(first.IndexOf(second.ElementAt(i)), i); } catch (InvalidOperationException ex) { throw new Exception("Exception in the reordering loop.", ex); } } } }
mit
C#
1e716e10a9bc1e64e1229f6561164e836e4db728
Improve array aux functions.
fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game
common/auxiliary/array.cs
common/auxiliary/array.cs
//------------------------------------------------------------------------------ // Revenge Of The Cats: Ethernet // Copyright (C) 2008, mEthLab Interactive //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // Array support functions. //------------------------------------------------------------------------------ function arrayGetValue(%array, %key) { if(!isObject(%array)) return; %array.moveFirst(); %idx = %array.getIndexFromKey(%key); if(%idx == -1) return ""; return %array.getValue(%idx); } function arrayChangeElement(%array, %key, %value) { if(!isObject(%array)) return; %array.moveFirst(); %idx = %array.getIndexFromKey(%key); if(%idx != -1) %array.erase(%idx); %array.push_back(%key, %value); } function readLinesIntoArray(%fileName, %array) { if(!isObject(%array)) return; %file = new FileObject(); %file.openForRead(%fileName); %line = 0; while(!%file.isEOF()) { %line++; %array.push_back(%line, strreplace(%file.readLine(), "<br>", "\n")); } %file.delete(); }
//------------------------------------------------------------------------------ // Revenge Of The Cats: Ethernet // Copyright (C) 2008, mEthLab Interactive //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // Array support functions. //------------------------------------------------------------------------------ function arrayGetValue(%array, %key) { %array.moveFirst(); %idx = %array.getIndexFromKey(%key); if(%idx == -1) return ""; return %array.getValue(%idx); } function arrayChangeElement(%array, %key, %value) { %array.moveFirst(); %idx = %array.getIndexFromKey(%key); if(%idx != -1) %array.erase(%idx); %array.push_back(%key, %value); } function readLinesIntoArray(%fileName, %array) { %file = new FileObject(); %file.openForRead(%fileName); %line = 0; while(!%file.isEOF()) { %line++; %array.push_back(%line, strreplace(%file.readLine(), "<br>", "\n")); } %file.delete(); }
lgpl-2.1
C#
d1ccfdc0f714c40ea998469a5ffe51fdf0a67c1a
Update solution info.
dnnsoftware/Dnn.AdminExperience.Library,dnnsoftware/Dnn.AdminExperience.Library,dnnsoftware/Dnn.Platform,RichardHowells/Dnn.Platform,dnnsoftware/Dnn.Platform,EPTamminga/Dnn.Platform,valadas/Dnn.Platform,nvisionative/Dnn.Platform,nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,bdukes/Dnn.Platform,mitchelsellers/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,robsiera/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.Platform,RichardHowells/Dnn.Platform,valadas/Dnn.Platform,EPTamminga/Dnn.Platform,robsiera/Dnn.Platform,bdukes/Dnn.Platform,dnnsoftware/Dnn.Platform,robsiera/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Library,mitchelsellers/Dnn.Platform,RichardHowells/Dnn.Platform,RichardHowells/Dnn.Platform,nvisionative/Dnn.Platform,bdukes/Dnn.Platform,bdukes/Dnn.Platform,EPTamminga/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform
src/SolutionInfo.cs
src/SolutionInfo.cs
#region Copyright // DotNetNuke� - http://www.dotnetnuke.com // Copyright (c) 2002-2016 // by DotNetNuke Corporation // All Rights Reserved #endregion #region Usings using System.Reflection; #endregion // 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. // Review the values of the assembly attributes [assembly: AssemblyCompany("DNN Corporation")] [assembly: AssemblyProduct("http://www.dnnsoftware.com")] [assembly: AssemblyCopyright("DotNetNuke is copyright 2002-2016 by DNN Corporation. All Rights Reserved.")] [assembly: AssemblyTrademark("DNN")] // 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.3.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")]
#region Copyright // DotNetNuke� - http://www.dotnetnuke.com // Copyright (c) 2002-2016 // by DotNetNuke Corporation // All Rights Reserved #endregion #region Usings using System.Reflection; #endregion // 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. // Review the values of the assembly attributes [assembly: AssemblyCompany("DNN Corporation")] [assembly: AssemblyProduct("http://www.dnnsoftware.com")] [assembly: AssemblyCopyright("DotNetNuke is copyright 2002-2016 by DNN Corporation. All Rights Reserved.")] [assembly: AssemblyTrademark("DNN")] // 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.2.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")]
mit
C#
9f1af3fc73f5643fd8e2a811cdf74e9384e5f901
Remove usings
k-t/SharpHaven
SharpHaven/App.cs
SharpHaven/App.cs
using System; using System.Drawing; using System.IO; using NLog; using OpenTK; using OpenTK.Graphics; using SharpHaven.Resources; namespace SharpHaven { public static class App { private static readonly Logger Log = LogManager.GetCurrentClassLogger(); private static Audio audio; private static Config config; private static ResourceManager resourceManager; private static MainWindow window; public static void Main(string[] args) { Log.Info("Client started"); AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; GraphicsContext.ShareContexts = false; config = new Config(); resourceManager = new ResourceManager(); using (audio = new Audio()) using (var icon = GetApplicationIcon()) using (var gameWindow = new MainWindow(1024, 768)) { window = gameWindow; gameWindow.Icon = icon; gameWindow.Run(60, 60); } } public static Audio Audio { get { return audio; } } public static Config Config { get { return config; } } public static ResourceManager Resources { get { return resourceManager; } } public static INativeWindow Window { get { return window; } } public static void QueueOnMainThread(Action action) { window.QueueUpdate(action); } public static void Exit() { window.Close(); } private static Icon GetApplicationIcon() { var res = Resources.Load("custom/ui/icon"); var data = res.GetLayer<ImageData>(); return new Icon(new MemoryStream(data.Data)); } private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e) { Log.Fatal((Exception)e.ExceptionObject); // flush log before the termination (otherwise it can be empty) LogManager.Flush(); } } }
using System; using System.Drawing; using System.IO; using System.Threading; using System.Windows.Forms; using NLog; using OpenTK; using OpenTK.Graphics; using SharpHaven.Resources; namespace SharpHaven { public static class App { private static readonly Logger Log = LogManager.GetCurrentClassLogger(); private static Audio audio; private static Config config; private static ResourceManager resourceManager; private static MainWindow window; public static void Main(string[] args) { Log.Info("Client started"); AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; GraphicsContext.ShareContexts = false; config = new Config(); resourceManager = new ResourceManager(); using (audio = new Audio()) using (var icon = GetApplicationIcon()) using (var gameWindow = new MainWindow(1024, 768)) { window = gameWindow; gameWindow.Icon = icon; gameWindow.Run(60, 60); } } public static Audio Audio { get { return audio; } } public static Config Config { get { return config; } } public static ResourceManager Resources { get { return resourceManager; } } public static INativeWindow Window { get { return window; } } public static void QueueOnMainThread(Action action) { window.QueueUpdate(action); } public static void Exit() { window.Close(); } private static Icon GetApplicationIcon() { var res = Resources.Load("custom/ui/icon"); var data = res.GetLayer<ImageData>(); return new Icon(new MemoryStream(data.Data)); } private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e) { Log.Fatal((Exception)e.ExceptionObject); // flush log before the termination (otherwise it can be empty) LogManager.Flush(); } } }
mit
C#
d2471bd67e67504f4b65a4de5fbb223efd9299b5
Replace test with test stub
SmartStepGroup/AgileCamp2015_Master,SmartStepGroup/AgileCamp2015_Master,SmartStepGroup/AgileCamp2015_Master
UnitTests/UnitTest1.cs
UnitTests/UnitTest1.cs
#region Usings using NUnit.Framework; #endregion namespace UnitTests { [TestFixture] public class UnitTest1 { [Test] public void TestMethod1() { Assert.True(true); } } }
#region Usings using System.Linq; using System.Web.Mvc; using NUnit.Framework; using WebApplication.Controllers; using WebApplication.Models; #endregion namespace UnitTests { [TestFixture] public class UnitTest1 { [Test] public void TestMethod1() { var formCollection = new FormCollection(); formCollection["Name"] = "Habit"; var habitController = new HabitController(); habitController.Create(formCollection); var habit = ApplicationDbContext.Create().Habits.Single(); Assert.AreEqual("Habit", habit.Name); } } }
mit
C#
f0a50f63132876d192a3eb77858d49a822a54440
Fix compare --overwrite not working
sethreno/schemazen,sethreno/schemazen
console/Compare.cs
console/Compare.cs
using System; using System.IO; using ManyConsole; using NDesk.Options; using SchemaZen.Library.Command; namespace SchemaZen.console { internal class Compare : ConsoleCommand { private string _source; private string _target; private string _outDiff; private bool _overwrite; private bool _verbose; private bool _debug; public Compare() { IsCommand("Compare", "CreateDiff two databases."); Options = new OptionSet(); SkipsCommandSummaryBeforeRunning(); HasRequiredOption( "s|source=", "Connection string to a database to compare.", o => _source = o); HasRequiredOption( "t|target=", "Connection string to a database to compare.", o => _target = o); HasOption( "outFile=", "Create a sql diff file in the specified path.", o => _outDiff = o); HasOption( "o|overwrite", "Overwrite existing target without prompt.", o => _overwrite = o != null); HasOption( "v|verbose", "Enable verbose mode (show detailed changes).", o => _verbose = o != null); HasOption( "debug", "Launch the debugger", o => _debug = o != null); } public override int Run(string[] remainingArguments) { if (_debug) System.Diagnostics.Debugger.Launch(); if (!string.IsNullOrEmpty(_outDiff)) { Console.WriteLine(); if (!_overwrite && File.Exists(_outDiff)) { var question = $"{_outDiff} already exists - do you want to replace it"; if (!ConsoleQuestion.AskYN(question)) { return 1; } _overwrite = true; } } var compareCommand = new CompareCommand { Source = _source, Target = _target, Verbose = _verbose, OutDiff = _outDiff, Overwrite = _overwrite }; try { return compareCommand.Execute() ? 1 : 0; } catch (Exception ex) { throw new ConsoleHelpAsException(ex.Message); } } } }
using System; using System.IO; using ManyConsole; using NDesk.Options; using SchemaZen.Library.Command; namespace SchemaZen.console { internal class Compare : ConsoleCommand { private string _source; private string _target; private string _outDiff; private bool _overwrite; private bool _verbose; private bool _debug; public Compare() { IsCommand("Compare", "CreateDiff two databases."); Options = new OptionSet(); SkipsCommandSummaryBeforeRunning(); HasRequiredOption( "s|source=", "Connection string to a database to compare.", o => _source = o); HasRequiredOption( "t|target=", "Connection string to a database to compare.", o => _target = o); HasOption( "outFile=", "Create a sql diff file in the specified path.", o => _outDiff = o); HasOption( "o|overwrite", "Overwrite existing target without prompt.", o => _overwrite = o != null); HasOption( "v|verbose", "Enable verbose mode (show detailed changes).", o => _verbose = o != null); HasOption( "debug", "Launch the debugger", o => _debug = o != null); } public override int Run(string[] remainingArguments) { if (_debug) System.Diagnostics.Debugger.Launch(); if (!string.IsNullOrEmpty(_outDiff)) { Console.WriteLine(); if (!_overwrite && File.Exists(_outDiff)) { var question = $"{_outDiff} already exists - do you want to replace it"; if (!ConsoleQuestion.AskYN(question)) { return 1; } } } var compareCommand = new CompareCommand { Source = _source, Target = _target, Verbose = _verbose, OutDiff = _outDiff, Overwrite = _overwrite }; try { return compareCommand.Execute() ? 1 : 0; } catch (Exception ex) { throw new ConsoleHelpAsException(ex.Message); } } } }
mit
C#
3afce93fae16bb030fc2ee79f3fa9328fe17f072
Remove exception
mstrother/BmpListener
BmpListener/Bmp/StatisticsReport.cs
BmpListener/Bmp/StatisticsReport.cs
using System; namespace BmpListener.Bmp { public class StatisticsReport : BmpMessage { public StatisticsReport(BmpHeader bmpHeader, byte[] data) : base(bmpHeader, data) { } } }
using System; namespace BmpListener.Bmp { public class StatisticsReport : BmpMessage { public StatisticsReport(BmpHeader bmpHeader, byte[] data) : base(bmpHeader, data) { throw new NotImplementedException(); } public BmpMessage ParseBody() { throw new NotImplementedException(); } } }
mit
C#
35ba9e9e035f1ca9a4665c5b4ed58886c23f7241
clean code
6bee/Remote.Linq
src/Remote.Linq/Expressions/RemoteLinqExpressionException.cs
src/Remote.Linq/Expressions/RemoteLinqExpressionException.cs
// Copyright (c) Christof Senn. All rights reserved. See license.txt in the project root for license information. namespace Remote.Linq.Expressions { using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; [Serializable] [SuppressMessage("Design", "CA1032:Implement standard exception constructors", Justification = "This exception type requires an expression.")] public class RemoteLinqExpressionException : RemoteLinqException { private RemoteLinqExpressionException() { Expression = null!; } public RemoteLinqExpressionException(Expression expression) { Expression = expression; } public RemoteLinqExpressionException(Expression expression, string message) : base(message) { Expression = expression; } public RemoteLinqExpressionException(Expression expression, string message, Exception innerException) : base(message, innerException) { Expression = expression; } protected RemoteLinqExpressionException(SerializationInfo info, StreamingContext context) : base(info, context) { Expression = (Expression)info.GetValue(nameof(Expression), typeof(Expression)) !; } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue(nameof(Expression), Expression); } public Expression Expression { get; } } }
// Copyright (c) Christof Senn. All rights reserved. See license.txt in the project root for license information. namespace Remote.Linq.Expressions { using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; [Serializable] [SuppressMessage("Design", "CA1032:Implement standard exception constructors", Justification = "This exception type requires an expression.")] public class RemoteLinqExpressionException : RemoteLinqException { private RemoteLinqExpressionException() { } public RemoteLinqExpressionException(Expression expression) { Expression = expression; } public RemoteLinqExpressionException(Expression expression, string message) : base(message) { Expression = expression; } public RemoteLinqExpressionException(Expression expression, string message, Exception innerException) : base(message, innerException) { Expression = expression; } protected RemoteLinqExpressionException(SerializationInfo info, StreamingContext context) : base(info, context) { Expression = (Expression)info.GetValue(nameof(Expression), typeof(Expression)) !; } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue(nameof(Expression), Expression); } public Expression Expression { get; } = null!; } }
mit
C#
e1b35afd060f4c7984e69cf24b7b71d301d2b96b
Fix broken #endif location.
nodatime/nodatime,malcolmr/nodatime,zaccharles/nodatime,malcolmr/nodatime,malcolmr/nodatime,malcolmr/nodatime,BenJenkinson/nodatime,zaccharles/nodatime,zaccharles/nodatime,zaccharles/nodatime,zaccharles/nodatime,BenJenkinson/nodatime,zaccharles/nodatime,jskeet/nodatime,jskeet/nodatime,nodatime/nodatime
src/NodaTime.Test/DateTimeZoneProvidersTest.cs
src/NodaTime.Test/DateTimeZoneProvidersTest.cs
// Copyright 2013 The Noda Time Authors. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using NUnit.Framework; namespace NodaTime.Test { /// <summary> /// Tests for DateTimeZoneProviders. /// </summary> [TestFixture] public class DateTimeZoneProvidersTest { [Test] public void DefaultProviderIsTzdb() { #pragma warning disable 0618 Assert.AreSame(DateTimeZoneProviders.Tzdb, DateTimeZoneProviders.Default); #pragma warning restore 0618 } [Test] public void TzdbProviderUsesTzdbSource() { Assert.IsTrue(DateTimeZoneProviders.Tzdb.VersionId.StartsWith("TZDB: ")); } #if !PCL [Test] public void BclProviderUsesTimeZoneInfoSource() { Assert.IsTrue(DateTimeZoneProviders.Bcl.VersionId.StartsWith("TimeZoneInfo: ")); } #endif } }
// Copyright 2013 The Noda Time Authors. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using NUnit.Framework; namespace NodaTime.Test { /// <summary> /// Tests for DateTimeZoneProviders. /// </summary> [TestFixture] public class DateTimeZoneProvidersTest { [Test] public void DefaultProviderIsTzdb() { #pragma warning disable 0618 Assert.AreSame(DateTimeZoneProviders.Tzdb, DateTimeZoneProviders.Default); #pragma warning restore 0618 } [Test] public void TzdbProviderUsesTzdbSource() { Assert.IsTrue(DateTimeZoneProviders.Tzdb.VersionId.StartsWith("TZDB: ")); } #if !PCL [Test] public void BclProviderUsesTimeZoneInfoSource() { Assert.IsTrue(DateTimeZoneProviders.Bcl.VersionId.StartsWith("TimeZoneInfo: ")); } } #endif }
apache-2.0
C#
38a93ae908504c70f71415ea67e6d7b412b2275b
Add Apply method that takes a Selection to IPathElement interface
Domysee/Pather.CSharp
src/Pather.CSharp/PathElements/IPathElement.cs
src/Pather.CSharp/PathElements/IPathElement.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Pather.CSharp.PathElements { public interface IPathElement { object Apply(object target); Selection Apply(Selection target); } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Pather.CSharp.PathElements { public interface IPathElement { object Apply(object target); } }
mit
C#
87b322b1e10fea3a023af2ae96c954bcc46b1794
Revert accidental change of the async flag.
mdavid/nuget,mdavid/nuget
src/VsConsole/Console/PowerConsole/HostInfo.cs
src/VsConsole/Console/PowerConsole/HostInfo.cs
using System; using System.Diagnostics; namespace NuGetConsole.Implementation.PowerConsole { /// <summary> /// Represents a host with extra info. /// </summary> class HostInfo : ObjectWithFactory<PowerConsoleWindow> { Lazy<IHostProvider, IHostMetadata> HostProvider { get; set; } public HostInfo(PowerConsoleWindow factory, Lazy<IHostProvider, IHostMetadata> hostProvider) : base(factory) { UtilityMethods.ThrowIfArgumentNull(hostProvider); this.HostProvider = hostProvider; } /// <summary> /// Get the HostName attribute value of this host. /// </summary> public string HostName { get { return HostProvider.Metadata.HostName; } } IWpfConsole _wpfConsole; /// <summary> /// Get/create the console for this host. If not already created, this /// actually creates the (console, host) pair. /// /// Note: Creating the console is handled by this package and mostly will /// succeed. However, creating the host could be from other packages and /// fail. In that case, this console is already created and can be used /// subsequently in limited ways, such as displaying an error message. /// </summary> public IWpfConsole WpfConsole { get { if (_wpfConsole == null) { _wpfConsole = Factory.WpfConsoleService.CreateConsole( Factory.ServiceProvider, PowerConsoleWindow.ContentType, HostName); _wpfConsole.Host = HostProvider.Value.CreateHost(_wpfConsole, @async: true); } return _wpfConsole; } } } }
using System; using System.Diagnostics; namespace NuGetConsole.Implementation.PowerConsole { /// <summary> /// Represents a host with extra info. /// </summary> class HostInfo : ObjectWithFactory<PowerConsoleWindow> { Lazy<IHostProvider, IHostMetadata> HostProvider { get; set; } public HostInfo(PowerConsoleWindow factory, Lazy<IHostProvider, IHostMetadata> hostProvider) : base(factory) { UtilityMethods.ThrowIfArgumentNull(hostProvider); this.HostProvider = hostProvider; } /// <summary> /// Get the HostName attribute value of this host. /// </summary> public string HostName { get { return HostProvider.Metadata.HostName; } } IWpfConsole _wpfConsole; /// <summary> /// Get/create the console for this host. If not already created, this /// actually creates the (console, host) pair. /// /// Note: Creating the console is handled by this package and mostly will /// succeed. However, creating the host could be from other packages and /// fail. In that case, this console is already created and can be used /// subsequently in limited ways, such as displaying an error message. /// </summary> public IWpfConsole WpfConsole { get { if (_wpfConsole == null) { _wpfConsole = Factory.WpfConsoleService.CreateConsole( Factory.ServiceProvider, PowerConsoleWindow.ContentType, HostName); _wpfConsole.Host = HostProvider.Value.CreateHost(_wpfConsole, @async: false); } return _wpfConsole; } } } }
apache-2.0
C#
049dc27a2b783aa105adbc8d69aec35e7a30c1ab
add mail methods
feuerwelt/estellaris
Estellaris.Web/Email/Mailer.cs
Estellaris.Web/Email/Mailer.cs
using System; using System.Collections.Generic; using MailKit.Net.Smtp; using MimeKit; namespace Estellaris.Web.Email { public class Mailer : IDisposable { readonly MailCredentials _credentials; readonly SmtpClient _smtpClient; public Mailer(MailCredentials credentials) { _credentials = credentials; _smtpClient = new SmtpClient(); _smtpClient.ServerCertificateValidationCallback = (s, c, h, e) => true; _smtpClient.Connect(_credentials.Server, _credentials.Port, _credentials.UseSsl); _smtpClient.AuthenticationMechanisms.Remove("XOAUTH2"); _smtpClient.Authenticate(_credentials.Username, _credentials.Password); } public void Dispose() { _smtpClient.Disconnect(true); _smtpClient.Dispose(); } public bool SendMail(IEnumerable<string> to, string from, string subject, string body, MailType type = MailType.Html) { var message = new MimeMessage { Subject = subject, Body = new TextPart("html") { Text = body } }; message.From.Add(new MailboxAddress("", from)); foreach (var email in to) message.To.Add(new MailboxAddress("", email)); try { _smtpClient.Send(message); return true; } catch { return false; } } public bool SendPlain(IEnumerable<string> to, string from, string subject, string body) { return SendMail(to, from, subject, body, MailType.PlainText); } public bool SendPlain(string to, string from, string subject, string body) { return SendMail(new [] { to }, from, subject, body, MailType.PlainText); } public bool SendHtml(IEnumerable<string> to, string from, string subject, string body) { return SendMail(to, from, subject, body, MailType.Html); } public bool SendHtml(string to, string from, string subject, string body) { return SendMail(new [] { to }, from, subject, body, MailType.Html); } string GetSubtype(MailType type) { switch (type) { case MailType.Html: return "html"; default: return "plain"; } } } }
using System; using System.Collections.Generic; using MailKit.Net.Smtp; using MimeKit; namespace Estellaris.Web.Email { public class Mailer : IDisposable { readonly MailCredentials _credentials; readonly SmtpClient _smtpClient; public Mailer(MailCredentials credentials) { _credentials = credentials; _smtpClient = new SmtpClient(); _smtpClient.ServerCertificateValidationCallback = (s, c, h, e) => true; _smtpClient.Connect(_credentials.Server, _credentials.Port, _credentials.UseSsl); _smtpClient.AuthenticationMechanisms.Remove("XOAUTH2"); _smtpClient.Authenticate(_credentials.Username, _credentials.Password); } public void Dispose() { _smtpClient.Disconnect(true); _smtpClient.Dispose(); } public bool SendMail(IEnumerable<string> to, string from, string subject, string body, MailType type = MailType.Html) { var message = new MimeMessage { Subject = subject, Body = new TextPart("html") { Text = body } }; message.From.Add(new MailboxAddress("", from)); foreach (var email in to) message.To.Add(new MailboxAddress("", email)); try { _smtpClient.Send(message); return true; } catch { return false; } } string GetSubtype(MailType type) { switch (type) { case MailType.Html: return "html"; default: return "plain"; } } } }
mit
C#