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
58c60100b431e6ce6ee720ff72206e9f9071d070
Fix APIScoreToken's data type not matching server side
peppy/osu-new,ppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu
osu.Game/Online/Rooms/APIScoreToken.cs
osu.Game/Online/Rooms/APIScoreToken.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using Newtonsoft.Json; namespace osu.Game.Online.Rooms { public class APIScoreToken { [JsonProperty("id")] public long ID { get; set; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using Newtonsoft.Json; namespace osu.Game.Online.Rooms { public class APIScoreToken { [JsonProperty("id")] public int ID { get; set; } } }
mit
C#
a5794adbdce96484eb5ce44044b9333683fa69a3
Update Laters class
one-signal/OneSignal-Xamarin-SDK,one-signal/OneSignal-Xamarin-SDK
Com.OneSignal.Core/Utilities/Later.cs
Com.OneSignal.Core/Utilities/Later.cs
using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace Laters { /// <summary>For referencing <see cref="ILater{TResult}"/> generically</summary> public interface ILater { } /// <summary>Read-only interface for a standard <see cref="Later{TResult}"/></summary> public interface ILater<TResult> : ILater { event Action<TResult> OnComplete; TaskAwaiter<TResult> GetAwaiter(); } /// <summary>Basic Later for passing a single type to callbacks and awaiters</summary> public class Later<TResult> : BaseLater<TResult> { public void Complete(TResult result) => _complete(result); } /// <summary>Separated implementation so the derivations can offer different methods for completion</summary> public abstract class BaseLater<TResult> : ILater<TResult> { public event Action<TResult> OnComplete { remove => _onComplete -= value; add { if (_isComplete) _onComplete += value; else if (value != null) value(_result); } } public TaskAwaiter<TResult> GetAwaiter() { if (_completionSource != null) return _completionSource.Task.GetAwaiter(); _completionSource = new TaskCompletionSource<TResult>(); if (_isComplete) _completionSource.TrySetResult(_result); else _onComplete += result => _completionSource.TrySetResult(result); return _completionSource.Task.GetAwaiter(); } protected void _complete(TResult result) { if (_isComplete) return; _result = result; var toComplete = _onComplete; _onComplete = null; _isComplete = true; toComplete?.Invoke(_result); } private TaskCompletionSource<TResult> _completionSource; private event Action<TResult> _onComplete; private bool _isComplete = false; private TResult _result; } }
using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace Laters { /// <summary>Read-only interface for a standard <see cref="Later{TResult}"/></summary> public interface ILater<TResult> { event Action<TResult> OnComplete; TaskAwaiter<TResult> GetAwaiter(); } /// <summary>Basic Later for passing a single type to callbacks and awaiters</summary> public class Later<TResult> : BaseLater<TResult> { public void Complete(TResult result) => _complete(result); } /// <summary>Separated implementation so the derivations can offer different methods for completion</summary> public abstract class BaseLater<TResult> : ILater<TResult> { public event Action<TResult> OnComplete { remove => _onComplete -= value; add { if (_isComplete) _onComplete += value; else if (value != null) value(_result); } } public TaskAwaiter<TResult> GetAwaiter() { if (_completionSource != null) return _completionSource.Task.GetAwaiter(); _completionSource = new TaskCompletionSource<TResult>(); if (_isComplete) _completionSource.TrySetResult(_result); else _onComplete += result => _completionSource.TrySetResult(result); return _completionSource.Task.GetAwaiter(); } protected void _complete(TResult result) { if (_isComplete) return; _result = result; var toComplete = _onComplete; _onComplete = null; _isComplete = true; toComplete?.Invoke(_result); } private TaskCompletionSource<TResult> _completionSource; private event Action<TResult> _onComplete; private bool _isComplete = false; private TResult _result; } }
mit
C#
f75740f07ac32452ffac39f468ab1c51ae4c63b3
Add ToString override to Process File
danielchalmers/DesktopWidgets
DesktopWidgets/Classes/ProcessFile.cs
DesktopWidgets/Classes/ProcessFile.cs
using System.ComponentModel; using System.Diagnostics; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; namespace DesktopWidgets.Classes { [ExpandableObject] [DisplayName("Process File")] public class ProcessFile : FilePath { public ProcessFile(string path) : base(path) { Path = path; } public ProcessFile() { } [PropertyOrder(2)] [DisplayName("Arguments")] public string Arguments { get; set; } = ""; [PropertyOrder(1)] [DisplayName("Start in Folder")] public string StartInFolder { get; set; } = ""; [PropertyOrder(3)] [DisplayName("Window Style")] public ProcessWindowStyle WindowStyle { get; set; } = ProcessWindowStyle.Normal; public override string ToString() { return string.Join(" ", Path, Arguments); } } }
using System.ComponentModel; using System.Diagnostics; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; namespace DesktopWidgets.Classes { [ExpandableObject] [DisplayName("Process File")] public class ProcessFile : FilePath { public ProcessFile(string path) : base(path) { Path = path; } public ProcessFile() { } [PropertyOrder(2)] [DisplayName("Arguments")] public string Arguments { get; set; } = ""; [PropertyOrder(1)] [DisplayName("Start in Folder")] public string StartInFolder { get; set; } = ""; [PropertyOrder(3)] [DisplayName("Window Style")] public ProcessWindowStyle WindowStyle { get; set; } = ProcessWindowStyle.Normal; } }
apache-2.0
C#
2f8842761387e24a76c6cdc4ef836f06893d796f
update version
DanielLavrushin/LinqToSolr
LinqToSolr/Properties/AssemblyInfo.cs
LinqToSolr/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("Linq to Solr Provider")] [assembly: AssemblyDescription(" Linq to Solr Provider")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Linq to Solr Provider")] [assembly: AssemblyCopyright("Copyright by Daniel V. Lavrushin © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("19e399ea-8724-444d-acec-276e2157838e")] // 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.3")] [assembly: AssemblyFileVersion("1.0.0.3")]
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("Linq to Solr Provider")] [assembly: AssemblyDescription(" Linq to Solr Provider")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Linq to Solr Provider")] [assembly: AssemblyCopyright("Copyright by Daniel V. Lavrushin © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("19e399ea-8724-444d-acec-276e2157838e")] // 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.2")] [assembly: AssemblyFileVersion("1.0.0.2")]
mit
C#
aea414fb31f2ae3aed7dec68d22ccc89ba6176b8
Update IrrSpatialScope.cs
ADAPT/ADAPT
source/ADAPT/Documents/IrrSpatialScope.cs
source/ADAPT/Documents/IrrSpatialScope.cs
/******************************************************************************* * Copyright (C) 2018 AgGateway and ADAPT Contributors * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html> * * Contributors: * R. Andres Ferreyra - Adapting from PAIL S632-3 schema. *******************************************************************************/ using AgGateway.ADAPT.ApplicationDataModel.Shapes; namespace AgGateway.ADAPT.ApplicationDataModel.Documents { /// <summary> /// This class describes either a radial, or a multipolygon spatial scope /// for the purposes of specifying an amount of irrigation water / products. /// </summary> public class IrrSpatialScope { /// <summary> /// Specify using radial start/end angle notation (inner/outer radii are provided by the sections). /// Used for center pivots. /// </summary> public IrrRadialSpatialScope RadialScope { get; set; } /// <summary> /// Specify using a multipolygon: good for stationary suystems. /// </summary> public MultiPolygon MultiPolygonScope { get; set; } } }
/******************************************************************************* * Copyright (C) 2018 AgGateway and ADAPT Contributors * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html> * * Contributors: * R. Andres Ferreyra - Adapting from PAIL S632-3 schema. *******************************************************************************/ using AgGateway.ADAPT.ApplicationDataModel.Shapes; namespace AgGateway.ADAPT.ApplicationDataModel.Documents { /// <summary> /// This class describes either a radial, or a multipolygon spatial scope /// for the purposes of specifying an amount of irrigation water / products. /// </summary> public class IrrSpatialScope { /// <summary> /// Specify using radial start/end angle notation (inner/outer radii are provided by the sections). /// Used for center pivots. /// </summary> public RadialSpatialScope RadialScope { get; set; } /// <summary> /// Specify using a multipolygon: good for stationary suystems. /// </summary> public MultiPolygon MultiPolygonScope { get; set; } } }
epl-1.0
C#
13ab9e11fd2c651aa32430504c1016a9e5c81768
Add string extension "CombineForPath": Similar to Path.Combine, but it combines as may parts as you have into a single, platform-appropriate path.
gtryus/libpalaso,mccarthyrb/libpalaso,marksvc/libpalaso,mccarthyrb/libpalaso,darcywong00/libpalaso,tombogle/libpalaso,ddaspit/libpalaso,darcywong00/libpalaso,ermshiperete/libpalaso,gtryus/libpalaso,marksvc/libpalaso,andrew-polk/libpalaso,hatton/libpalaso,ermshiperete/libpalaso,darcywong00/libpalaso,marksvc/libpalaso,chrisvire/libpalaso,ddaspit/libpalaso,gmartin7/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,gtryus/libpalaso,gtryus/libpalaso,mccarthyrb/libpalaso,hatton/libpalaso,gmartin7/libpalaso,JohnThomson/libpalaso,glasseyes/libpalaso,hatton/libpalaso,hatton/libpalaso,sillsdev/libpalaso,gmartin7/libpalaso,mccarthyrb/libpalaso,chrisvire/libpalaso,JohnThomson/libpalaso,chrisvire/libpalaso,JohnThomson/libpalaso,ddaspit/libpalaso,ermshiperete/libpalaso,tombogle/libpalaso,sillsdev/libpalaso,JohnThomson/libpalaso,sillsdev/libpalaso,andrew-polk/libpalaso,gmartin7/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,ermshiperete/libpalaso,andrew-polk/libpalaso,chrisvire/libpalaso,sillsdev/libpalaso,ddaspit/libpalaso,andrew-polk/libpalaso,tombogle/libpalaso
Palaso/Extensions/StringExtensions.cs
Palaso/Extensions/StringExtensions.cs
using System.Collections.Generic; using System.IO; using System.Xml; namespace Palaso.Extensions { public static class StringExtensions { public static List<string> SplitTrimmed(this string s, char seperator) { if(s.Trim() == string.Empty) return new List<string>(); var x = s.Split(seperator); var r = new List<string>(); foreach (var part in x) { var trim = part.Trim(); if(trim!=string.Empty) { r.Add(trim); } } return r; } private static XmlNode _xmlNodeUsedForEscaping; public static string EscapeAnyUnicodeCharactersIllegalInXml(this string text) { //we actually want to preserve html markup, just escape the disallowed unicode characters text = text.Replace("<", "_lt;"); text = text.Replace(">", "_gt;"); text = text.Replace("&", "_amp;"); text = text.Replace("\"", "_quot;"); text = text.Replace("'", "_apos;"); text = EscapeSoXmlSeesAsPureTextAndEscapeCharactersIllegalInXml(text); //put it back, now text = text.Replace("_lt;", "<"); text = text.Replace("_gt;", ">"); text = text.Replace("_amp;", "&"); text = text.Replace("_quot;", "\""); text = text.Replace("_apos;", "'"); return text; } public static string EscapeSoXmlSeesAsPureTextAndEscapeCharactersIllegalInXml(this string text) { if (_xmlNodeUsedForEscaping == null)//notice, this is only done once per run { XmlDocument doc = new XmlDocument(); _xmlNodeUsedForEscaping = doc.CreateElement("text", "x", ""); } _xmlNodeUsedForEscaping.InnerText = text; text = _xmlNodeUsedForEscaping.InnerXml; return text; } /// <summary> /// Similar to Path.Combine, but you don't have to specify the location of the temporaryfolder itself, and you can add multiple parts to combine. /// </summary> /// <example> string path = "my".Combine("stuff", "toys", "ball.txt")</example> public static string CombineForPath(this string rootPath, params string[] partsOfThePath) { string result = rootPath.ToString(); foreach (var s in partsOfThePath) { result = Path.Combine(result, s); } return result; } } }
using System.Collections.Generic; using System.Xml; namespace Palaso.Extensions { public static class StringExtensions { public static List<string> SplitTrimmed(this string s, char seperator) { if(s.Trim() == string.Empty) return new List<string>(); var x = s.Split(seperator); var r = new List<string>(); foreach (var part in x) { var trim = part.Trim(); if(trim!=string.Empty) { r.Add(trim); } } return r; } private static XmlNode _xmlNodeUsedForEscaping; public static string EscapeAnyUnicodeCharactersIllegalInXml(this string text) { //we actually want to preserve html markup, just escape the disallowed unicode characters text = text.Replace("<", "_lt;"); text = text.Replace(">", "_gt;"); text = text.Replace("&", "_amp;"); text = text.Replace("\"", "_quot;"); text = text.Replace("'", "_apos;"); text = EscapeSoXmlSeesAsPureTextAndEscapeCharactersIllegalInXml(text); //put it back, now text = text.Replace("_lt;", "<"); text = text.Replace("_gt;", ">"); text = text.Replace("_amp;", "&"); text = text.Replace("_quot;", "\""); text = text.Replace("_apos;", "'"); return text; } public static string EscapeSoXmlSeesAsPureTextAndEscapeCharactersIllegalInXml(this string text) { if (_xmlNodeUsedForEscaping == null)//notice, this is only done once per run { XmlDocument doc = new XmlDocument(); _xmlNodeUsedForEscaping = doc.CreateElement("text", "x", ""); } _xmlNodeUsedForEscaping.InnerText = text; text = _xmlNodeUsedForEscaping.InnerXml; return text; } } }
mit
C#
c38952175f3b5e012506bc3d34daeb9e6528903b
Bump for v0.3.0 (#152)
decred/Paymetheus,jrick/Paymetheus
Paymetheus/Properties/AssemblyInfo.cs
Paymetheus/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("Paymetheus Decred Wallet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Paymetheus")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyMetadata("Organization", "Decred")] // 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("0.3.0.0")] [assembly: AssemblyFileVersion("0.3.0.0")]
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("Paymetheus Decred Wallet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Paymetheus")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyMetadata("Organization", "Decred")] // 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("0.2.0.0")] [assembly: AssemblyFileVersion("0.2.0.0")]
isc
C#
a1a8246c05cb920e14a35f0fbba9df573bbe6233
trim whitespace
ZLima12/osu,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,DrabWeb/osu,ppy/osu,peppy/osu,EVAST9919/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,ZLima12/osu,NeoAdonis/osu,smoogipooo/osu,smoogipoo/osu,johnneijzen/osu,UselessToucan/osu,DrabWeb/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,ppy/osu,2yangk23/osu,NeoAdonis/osu,ppy/osu,DrabWeb/osu,2yangk23/osu
osu.Game/Rulesets/Mods/ModTimeRamp.cs
osu.Game/Rulesets/Mods/ModTimeRamp.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Audio; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Mods { public abstract class ModTimeRamp : Mod { public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModHalfTime) }; public abstract double AppendRate { get; } } public abstract class ModTimeRamp<T> : ModTimeRamp, IUpdatableByPlayfield, IApplicableToClock, IApplicableToBeatmap<T> where T : HitObject { private double lastObjectEndTime; private IAdjustableClock clock; private IHasPitchAdjust pitchAdjust; public virtual void ApplyToClock(IAdjustableClock clk) { clock = clk; pitchAdjust = clk as IHasPitchAdjust; } public virtual void ApplyToBeatmap(Beatmap<T> beatmap) { HitObject lastObject = beatmap.HitObjects[beatmap.HitObjects.Count - 1]; lastObjectEndTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; } public virtual void Update(Playfield playfield) { double newRate; if (1 + AppendRate < 1) newRate = Math.Max(1 + AppendRate, 1 + (AppendRate * (clock.CurrentTime / (lastObjectEndTime * 0.75)))); else newRate = Math.Min(1 + AppendRate, 1 + (AppendRate * (clock.CurrentTime / (lastObjectEndTime * 0.75)))); clock.Rate = newRate; pitchAdjust.PitchAdjust = newRate; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Audio; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Mods { public abstract class ModTimeRamp : Mod { public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModHalfTime) }; public abstract double AppendRate { get; } } public abstract class ModTimeRamp<T> : ModTimeRamp, IUpdatableByPlayfield, IApplicableToClock, IApplicableToBeatmap<T> where T : HitObject { private double lastObjectEndTime; private IAdjustableClock clock; private IHasPitchAdjust pitchAdjust; public virtual void ApplyToClock(IAdjustableClock clk) { clock = clk; pitchAdjust = clk as IHasPitchAdjust; } public virtual void ApplyToBeatmap(Beatmap<T> beatmap) { HitObject lastObject = beatmap.HitObjects[beatmap.HitObjects.Count - 1]; lastObjectEndTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; } public virtual void Update(Playfield playfield) { double newRate; if (1 + AppendRate < 1) newRate = Math.Max(1 + AppendRate, 1 + (AppendRate * (clock.CurrentTime / (lastObjectEndTime * 0.75)))); else newRate = Math.Min(1 + AppendRate, 1 + (AppendRate * (clock.CurrentTime / (lastObjectEndTime * 0.75)))); clock.Rate = newRate; pitchAdjust.PitchAdjust = newRate; } } }
mit
C#
3cac4c1b70d7c0d42710847ace9adfc46ffc8922
Add Create() method
whampson/bft-spec,whampson/cascara
Src/WHampson.Bft/TemplateException.cs
Src/WHampson.Bft/TemplateException.cs
#region License /* Copyright (c) 2017 Wes Hampson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #endregion using System; using System.Runtime.Serialization; using System.Xml; using System.Xml.Linq; namespace WHampson.Bft { public class TemplateException : Exception { public TemplateException() : base() { } public TemplateException(string message) : base(message) { } public TemplateException(string message, Exception innerException) : base(message, innerException) { } protected TemplateException(SerializationInfo info, StreamingContext context) : base(info, context) { } internal static TemplateException Create(XObject obj, string msgFmt, params object[] fmtArgs) { IXmlLineInfo lineInfo = obj; string msg = string.Format(msgFmt, fmtArgs); if (!msg.EndsWith(".")) { msg += "."; } msg += " " + string.Format(" Line {0}, position {1}.", lineInfo.LineNumber, lineInfo.LinePosition); return new TemplateException(msg); } } }
#region License /* Copyright (c) 2017 Wes Hampson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #endregion using System; using System.Runtime.Serialization; namespace WHampson.Bft { public class TemplateException : Exception { public TemplateException() : base() { } public TemplateException(string message) : base(message) { } public TemplateException(string message, Exception innerException) : base(message, innerException) { } protected TemplateException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
mit
C#
f29d92c162761afbde6e4fa244d433a5ded72d4c
fix broken typeformatter tests
OrleansContrib/OrleansDashboard,OrleansContrib/OrleansDashboard,OrleansContrib/OrleansDashboard
Tests/UnitTests/TypeFormatterTests.cs
Tests/UnitTests/TypeFormatterTests.cs
using System; using OrleansDashboard.Metrics.TypeFormatting; using TestGrains; using Xunit; namespace UnitTests { public class TypeFormatterTests { [Fact] public void TestSimpleType() { var example = "System.String"; var name = TypeFormatter.Parse(example); Assert.Equal("String", name); } [Fact] public void TestCustomType() { var example = "ExecuteAsync(CreateApp)"; var name = TypeFormatter.Parse(example); Assert.Equal("ExecuteAsync(CreateApp)", name); } [Fact] public void TestFriendlyNameForStrings() { var example = "TestGrains.GenericGrain`1[[System.String,mscorlib]]"; var name = TypeFormatter.Parse(example); Assert.Equal("TestGrains.GenericGrain<String>", name); } [Fact] public void TestGenericWithMultipleTs() { var example = "TestGrains.IGenericGrain`1[[System.Tuple`2[[string],[int]]]]"; var name = TypeFormatter.Parse(example); Assert.Equal("TestGrains.IGenericGrain<Tuple<string, int>>", name); } [Fact] public void TestGenericGrainWithMultipleTs() { var example = "TestGrains.ITestGenericGrain`2[[string],[int]]"; var name = TypeFormatter.Parse(example); Assert.Equal("TestGrains.ITestGenericGrain<string, int>", name); } [Fact] public void TestGenericGrainWithFsType() { var example = ".Program.Progress"; var name = TypeFormatter.Parse(example); Assert.Equal(".Program.Progress", name); } } }
using System; using OrleansDashboard.Metrics.TypeFormatting; using TestGrains; using Xunit; namespace UnitTests { public class TypeFormatterTests { [Fact] public void TestSimpleType() { var example = "System.String"; var name = TypeFormatter.Parse(example); Assert.Equal("String", name); } [Fact] public void TestCustomType() { var example = "ExecuteAsync(CreateApp)"; var name = TypeFormatter.Parse(example); Assert.Equal("ExecuteAsync(CreateApp)", name); } [Fact] public void TestFriendlyNameForStrings() { var example = "TestGrains.GenericGrain`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"; var name = TypeFormatter.Parse(example); Assert.Equal("TestGrains.GenericGrain<String>", name); } [Fact] public void TestGenericWithMultipleTs() { var example = typeof(IGenericGrain<Tuple<string, int>>).FullName; var name = TypeFormatter.Parse(example); Assert.Equal("TestGrains.IGenericGrain<Tuple<String, Int32>>", name); } [Fact] public void TestGenericGrainWithMultipleTs() { var example = typeof(ITestGenericGrain<string, int>).FullName; var name = TypeFormatter.Parse(example); Assert.Equal("TestGrains.ITestGenericGrain<String, Int32>", name); } [Fact] public void TestGenericGrainWithFsType() { var example = ".Program.Progress"; var name = TypeFormatter.Parse(example); Assert.Equal(".Program.Progress", name); } } }
mit
C#
f31a5dc70446281cbe5f25a621f468f29a7ffbf0
add function of using space to skip prologue
Rubyjin/SENECA
SENECA/Assets/Scripts/Game_World/Prologue.cs
SENECA/Assets/Scripts/Game_World/Prologue.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using ChrsUtils.ChrsEventSystem; using ChrsUtils.ChrsEventSystem.EventsManager; using UnityEngine.SceneManagement; using SenecaEvents; public class Prologue : MonoBehaviour { public AudioClip clip; private AudioSource audioSource; // Use this for initialization void Start () { clip = Resources.Load("Audio/VO/Beorn/BEORN_VO_GAMEINTRO") as AudioClip; audioSource = GetComponent<AudioSource>(); audioSource.PlayOneShot(clip); GameManager.instance.inConversation = true; } IEnumerator LoadNextScene() { yield return new WaitForSeconds(1.0f); Services.Events.Fire(new SceneChangeEvent("Seneca_Campsite")); TransitionData.Instance.TITLE.visitedScene = true; TransitionData.Instance.TITLE.position = Vector3.zero; TransitionData.Instance.TITLE.scale = Vector3.zero; Services.Scenes.Swap<SenecaCampsiteSceneScript>(TransitionData.Instance); } // Update is called once per frame void Update () { if(!audioSource.isPlaying) { GameManager.instance.inConversation = false; StartCoroutine(LoadNextScene()); } if (Input.GetKey (KeyCode.Space)) { GameManager.instance.inConversation = false; StartCoroutine(LoadNextScene()); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using ChrsUtils.ChrsEventSystem; using ChrsUtils.ChrsEventSystem.EventsManager; using UnityEngine.SceneManagement; using SenecaEvents; public class Prologue : MonoBehaviour { public AudioClip clip; private AudioSource audioSource; // Use this for initialization void Start () { clip = Resources.Load("Audio/VO/Beorn/BEORN_VO_GAMEINTRO") as AudioClip; audioSource = GetComponent<AudioSource>(); audioSource.PlayOneShot(clip); GameManager.instance.inConversation = true; } IEnumerator LoadNextScene() { yield return new WaitForSeconds(1.0f); Services.Events.Fire(new SceneChangeEvent("Seneca_Campsite")); TransitionData.Instance.TITLE.visitedScene = true; TransitionData.Instance.TITLE.position = Vector3.zero; TransitionData.Instance.TITLE.scale = Vector3.zero; Services.Scenes.Swap<SenecaCampsiteSceneScript>(TransitionData.Instance); } // Update is called once per frame void Update () { if(!audioSource.isPlaying) { GameManager.instance.inConversation = false; StartCoroutine(LoadNextScene()); } } }
unlicense
C#
01a7014eadfc0df79dc12b5e4a2ba60d87d8269d
Update ScriptRunner.cs
filipw/dotnet-script,filipw/dotnet-script
src/Dotnet.Script.Core/ScriptRunner.cs
src/Dotnet.Script.Core/ScriptRunner.cs
using System; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Scripting.Hosting; using Microsoft.CodeAnalysis.Scripting; using Microsoft.CodeAnalysis.Scripting.Hosting; namespace Dotnet.Script.Core { public class ScriptRunner { protected ScriptLogger Logger; protected ScriptCompiler ScriptCompiler; public ScriptRunner(ScriptCompiler scriptCompiler, ScriptLogger logger) { Logger = logger; ScriptCompiler = scriptCompiler; } public Task<TReturn> Execute<TReturn>(ScriptContext context) { var globals = new CommandLineScriptGlobals(Console.Out, CSharpObjectFormatter.Instance); foreach (var arg in context.Args) globals.Args.Add(arg); return Execute<TReturn, CommandLineScriptGlobals>(context, globals); } public virtual Task<TReturn> Execute<TReturn, THost>(ScriptContext context, THost host) { var compilationContext = ScriptCompiler.CreateCompilationContext<TReturn, THost>(context); return Execute(compilationContext, host); } public virtual async Task<TReturn> Execute<TReturn, THost>(ScriptCompilationContext<TReturn> compilationContext, THost host) { var scriptResult = await compilationContext.Script.RunAsync(host, ex => true).ConfigureAwait(false); return ProcessScriptState(scriptResult); } protected TReturn ProcessScriptState<TReturn>(ScriptState<TReturn> scriptState) { if (scriptState.Exception != null) { Logger.Log("Script execution resulted in an exception."); Logger.Log(scriptState.Exception.Message); Logger.Log(scriptState.Exception.StackTrace); throw scriptState.Exception; } return scriptState.ReturnValue; } } }
using System; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Scripting.Hosting; using Microsoft.CodeAnalysis.Scripting; using Microsoft.CodeAnalysis.Scripting.Hosting; namespace Dotnet.Script.Core { public class ScriptRunner { protected ScriptLogger Logger; protected ScriptCompiler ScriptCompiler; public ScriptRunner(ScriptCompiler scriptCompiler, ScriptLogger logger) { Logger = logger; ScriptCompiler = scriptCompiler; } public Task<TReturn> Execute<TReturn>(ScriptContext context) { var globals = new CommandLineScriptGlobals(Console.Out, CSharpObjectFormatter.Instance); foreach (var arg in context.Args) globals.Args.Add(arg); return Execute<TReturn, CommandLineScriptGlobals>(context, globals); } public virtual Task<TReturn> Execute<TReturn, THost>(ScriptContext context, THost host) { var compilationContext = ScriptCompiler.CreateCompilationContext<TReturn, THost>(context); return Execute(compilationContext, host); } public virtual async Task<TReturn> Execute<TReturn, THost>(ScriptCompilationContext<TReturn> compilationContext, THost host) { var scriptResult = await compilationContext.Script.RunAsync(host, ex => true).ConfigureAwait(false); return ProcessScriptState(scriptResult); } protected TReturn ProcessScriptState<TReturn>(ScriptState<TReturn> scriptState) { if (scriptState.Exception != null) { Logger.Log("Script execution resulted in an exception."); Logger.Log(scriptState.Exception.Message); Logger.Log(scriptState.Exception.StackTrace); throw scriptState.Exception; } return scriptState.ReturnValue; } } }
mit
C#
170749508f98d35f6f6170b7f05c74f3ca80e960
Move version to 3.1
tombogle/libpalaso,gtryus/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,gmartin7/libpalaso,ermshiperete/libpalaso,gtryus/libpalaso,tombogle/libpalaso,andrew-polk/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,gmartin7/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso,ddaspit/libpalaso,gmartin7/libpalaso,ddaspit/libpalaso,gmartin7/libpalaso,ermshiperete/libpalaso,tombogle/libpalaso,ddaspit/libpalaso,sillsdev/libpalaso,andrew-polk/libpalaso,sillsdev/libpalaso,andrew-polk/libpalaso,sillsdev/libpalaso,ermshiperete/libpalaso,gtryus/libpalaso,andrew-polk/libpalaso,ddaspit/libpalaso
GlobalAssemblyInfo.cs
GlobalAssemblyInfo.cs
using System.Reflection; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyCompany("SIL")] [assembly: AssemblyProduct("Palaso Library")] [assembly: AssemblyCopyright("Copyright © 2016 SIL International")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyFileVersion("3.1.0.0")] [assembly: AssemblyVersion("3.1.0.0")]
using System.Reflection; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyCompany("SIL")] [assembly: AssemblyProduct("Palaso Library")] [assembly: AssemblyCopyright("Copyright © 2015 SIL International")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyFileVersion("3.0.0.0")] [assembly: AssemblyVersion("3.0.0.0")]
mit
C#
b7ef1e8b05489aac91e4d18261225723acddd6ea
Add Array.CopyRangeTo, Array.SubArray
eleven41/Eleven41.Extensions
Eleven41.Extensions/ArrayExtensions.cs
Eleven41.Extensions/ArrayExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Eleven41.Extensions { public static class ArrayExtensions { // Populates an entire array with the specified value. public static void Populate<T>(this T[] arr, T value) { for (int i = 0; i < arr.Length; i++) { arr[i] = value; } } // Copies a range of items from this array to a target array. public static void CopyRangeTo<T>(this T[] self, int startIndex, int numItemsToCopy, T[] target) { if (startIndex > self.Length) throw new ArgumentOutOfRangeException("startIndex"); if (numItemsToCopy < 0) throw new ArgumentOutOfRangeException("numItemsToCopy"); if (numItemsToCopy > target.Length) throw new ArgumentOutOfRangeException("numItemsToCopy"); if (numItemsToCopy > self.Length - startIndex) throw new ArgumentOutOfRangeException("numItemsToCopy"); for (int i = 0; i < numItemsToCopy; ++i) { target[i] = self[startIndex + i]; } } // Copies a range of items from this array to a target array. public static void CopyRangeTo<T>(this T[] self, int startIndex, int numItemsToCopy, T[] target, int targetStartIndex) { if (startIndex > self.Length) throw new ArgumentOutOfRangeException("startIndex"); if (numItemsToCopy < 0) throw new ArgumentOutOfRangeException("numItemsToCopy"); if (numItemsToCopy > target.Length - targetStartIndex) throw new ArgumentOutOfRangeException("numItemsToCopy"); if (numItemsToCopy > self.Length - startIndex) throw new ArgumentOutOfRangeException("numItemsToCopy"); for (int i = 0; i < numItemsToCopy; ++i) { target[targetStartIndex + i] = self[startIndex + i]; } } public static T[] SubArray<T>(this T[] self, int startIndex) { if (startIndex > self.Length) throw new ArgumentOutOfRangeException("startIndex"); int numItems = self.Length - startIndex; T[] results = new T[numItems]; self.CopyRangeTo(startIndex, numItems, results); return results; } public static T[] SubArray<T>(this T[] self, int startIndex, int numItems) { if (startIndex > self.Length) throw new ArgumentOutOfRangeException("startIndex"); if (numItems > self.Length - startIndex) throw new ArgumentOutOfRangeException("numItems"); T[] results = new T[numItems]; self.CopyRangeTo(startIndex, numItems, results); return results; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Eleven41.Extensions { public static class ArrayExtensions { // Populates an entire array with the specified value. public static void Populate<T>(this T[] arr, T value) { for (int i = 0; i < arr.Length; i++) { arr[i] = value; } } } }
mit
C#
67f283b91e534d68663de29bf0fbee21d0527471
Update setcursorposition condition
tsolarin/readline,tsolarin/readline
src/ReadLine/Abstractions/Console2.cs
src/ReadLine/Abstractions/Console2.cs
using System; namespace Internal.ReadLine.Abstractions { internal class Console2 : IConsole { private bool IsSeenOnScreen(char c) => !(char.IsControl(c) || char.IsWhiteSpace(c)); public int CursorLeft => Console.CursorLeft; public int CursorTop => Console.CursorTop; public int BufferWidth => Console.BufferWidth; public int BufferHeight => Console.BufferHeight; public bool PasswordMode { get; set; } public char PasswordChar { get; set; } private bool ScreenVisible { get => !(char.IsControl(PasswordChar) || char.IsWhiteSpace(PasswordChar)); } public void SetBufferSize(int width, int height) => Console.SetBufferSize(width, height); public void SetCursorPosition(int left, int top) { if (!PasswordMode || ScreenVisible) Console.SetCursorPosition(left, top); } public void Write(string value) { if (PasswordMode) value = new String(PasswordChar, value.Length); Console.Write(value); } public void WriteLine(string value) => Console.WriteLine(value); } }
using System; namespace Internal.ReadLine.Abstractions { internal class Console2 : IConsole { private bool IsSeenOnScreen(char c) => !(char.IsControl(c) || char.IsWhiteSpace(c)); public int CursorLeft => Console.CursorLeft; public int CursorTop => Console.CursorTop; public int BufferWidth => Console.BufferWidth; public int BufferHeight => Console.BufferHeight; public bool PasswordMode { get; set; } public char PasswordChar { get; set; } private bool ScreenVisible { get => !(char.IsControl(PasswordChar) || char.IsWhiteSpace(PasswordChar)); } public void SetBufferSize(int width, int height) => Console.SetBufferSize(width, height); public void SetCursorPosition(int left, int top) { if (ScreenVisible) Console.SetCursorPosition(left, top); } public void Write(string value) { if (PasswordMode) value = new String(PasswordChar, value.Length); Console.Write(value); } public void WriteLine(string value) => Console.WriteLine(value); } }
mit
C#
9d35521fde85e9fcaafe2cbfd8b3dc46a5649a9b
adjust links args
beginor/PNChartTouch
PNChartBindings/libPNChart.linkwith.cs
PNChartBindings/libPNChart.linkwith.cs
using System; using MonoTouch.ObjCRuntime; [assembly: LinkWith ( "libPNChart.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator, Frameworks = "Foundation,UIKit,CoreGraphics,QuartzCore", ForceLoad = true )]
using System; using MonoTouch.ObjCRuntime; [assembly: LinkWith ("libPNChart.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator, ForceLoad = true)]
mit
C#
790b1361d5895719ab471d273f3e999aa8d09142
Add Start Manually option to IMEI prefab
adjust/unity_sdk,adjust/unity_sdk,adjust/unity_sdk
Assets/AdjustImei/Unity/AdjustImei.cs
Assets/AdjustImei/Unity/AdjustImei.cs
using System; using UnityEngine; namespace com.adjust.sdk.imei { public class AdjustImei : MonoBehaviour { private const string errorMsgEditor = "[AdjustImei]: Adjust IMEI plugin can not be used in Editor."; private const string errorMsgPlatform = "[AdjustImei]: Adjust IMEI plugin can only be used in Android apps."; public bool startManually = true; public bool readImei = false; void Awake() { if (IsEditor()) { return; } DontDestroyOnLoad(transform.gameObject); if (!this.startManually) { if (this.readImei) { AdjustImei.ReadImei(); } else { AdjustImei.DoNotReadImei(); } } } public static void ReadImei() { if (IsEditor()) { return; } #if UNITY_ANDROID AdjustImeiAndroid.ReadImei(); #else Debug.Log(errorMsgPlatform); #endif } public static void DoNotReadImei() { if (IsEditor()) { return; } #if UNITY_ANDROID AdjustImeiAndroid.DoNotReadImei(); #else Debug.Log(errorMsgPlatform); #endif } private static bool IsEditor() { #if UNITY_EDITOR Debug.Log(errorMsgEditor); return true; #else return false; #endif } } }
using System; using UnityEngine; namespace com.adjust.sdk.imei { public class AdjustImei : MonoBehaviour { private const string errorMsgEditor = "[AdjustImei]: Adjust IMEI plugin can not be used in Editor."; private const string errorMsgPlatform = "[AdjustImei]: Adjust IMEI plugin can only be used in Android apps."; public bool readImei = false; void Awake() { if (IsEditor()) { return; } DontDestroyOnLoad(transform.gameObject); if (this.readImei) { AdjustImei.ReadImei(); } else { AdjustImei.DoNotReadImei(); } } public static void ReadImei() { if (IsEditor()) { return; } #if UNITY_ANDROID AdjustImeiAndroid.ReadImei(); #else Debug.Log(errorMsgPlatform); #endif } public static void DoNotReadImei() { if (IsEditor()) { return; } #if UNITY_ANDROID AdjustImeiAndroid.DoNotReadImei(); #else Debug.Log(errorMsgPlatform); #endif } private static bool IsEditor() { #if UNITY_EDITOR Debug.Log(errorMsgEditor); return true; #else return false; #endif } } }
mit
C#
1f4ecddf6b4675bb6bbd5f3f749a61f204f688c9
bump to 1.4.0
greggman/DeJson.NET
DeJson/AssemblyInfo.cs
DeJson/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("DeJson")] [assembly: AssemblyDescription("JSON serializer/deserializer")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Greggman")] [assembly: AssemblyProduct("DeJson")] [assembly: AssemblyCopyright("Gregg Tavares")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.4.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("DeJson")] [assembly: AssemblyDescription("JSON serializer/deserializer")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Greggman")] [assembly: AssemblyProduct("DeJson")] [assembly: AssemblyCopyright("Gregg Tavares")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.3.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
bsd-3-clause
C#
df8f3f3803f586b9b06e7f09a4e788c48d1410fd
add validation for Fraction setter Gtk backend doesn't allow setting a MinValue or MaxValue, so Xwt uses the same assumed max and min values by the Gtk backend, and adjust the other 2 backends to this limits.
mono/xwt,residuum/xwt,iainx/xwt,akrisiun/xwt,mminns/xwt,lytico/xwt,sevoku/xwt,hwthomas/xwt,mminns/xwt,directhex/xwt,antmicro/xwt,hamekoz/xwt,TheBrainTech/xwt,steffenWi/xwt,cra0zy/xwt
Xwt/Xwt/ProgressBar.cs
Xwt/Xwt/ProgressBar.cs
// // ProgressBar.cs // // Author: // Andres G. Aragoneses <knocte@gmail.com> // // Copyright (c) 2012 Anrdres G. Aragoneses // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Xwt.Backends; using Xwt.Drawing; namespace Xwt { public class ProgressBar : Widget { double? fraction; public ProgressBar () { } protected override BackendHost CreateBackendHost () { return new WidgetBackendHost (); } IProgressBarBackend Backend { get { return (IProgressBarBackend) BackendHost.Backend; } } public double? Fraction { get { return fraction; } set { // gtk backend only supports this range (cannot set a MinValue or MaxValue) if (value < 0.0 || value > 1.0) throw new NotSupportedException ("Fraction value can only be in the [0.0..1.0] range"); fraction = value; Backend.SetFraction (fraction); } } } }
// // ProgressBar.cs // // Author: // Andres G. Aragoneses <knocte@gmail.com> // // Copyright (c) 2012 Anrdres G. Aragoneses // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Xwt.Backends; using Xwt.Drawing; namespace Xwt { public class ProgressBar : Widget { double? fraction; public ProgressBar () { } protected override BackendHost CreateBackendHost () { return new WidgetBackendHost (); } IProgressBarBackend Backend { get { return (IProgressBarBackend) BackendHost.Backend; } } public double? Fraction { get { return fraction; } set { fraction = value; Backend.SetFraction (fraction); } } } }
mit
C#
8d0550d6f602d16e016b609879bcafbae53ddfe6
Fix Trigger2D wrong method names
wirunekaewjai/unity-fsm
FSM/Event/OnTrigger2D.cs
FSM/Event/OnTrigger2D.cs
using UnityEngine; namespace Devdayo { [DisallowMultipleComponent] public class TriggerEnter2D : FsmEvent<Collider2D> { void OnTriggerEnter2D(Collider2D other) { Notify(other); } } [DisallowMultipleComponent] public class TriggerStay2D : FsmEvent<Collider2D> { void OnTriggerStay2D(Collider2D other) { Notify(other); } } [DisallowMultipleComponent] public class TriggerExit2D : FsmEvent<Collider2D> { void OnTriggerExit2D(Collider2D other) { Notify(other); } } }
using UnityEngine; namespace Devdayo { [DisallowMultipleComponent] public class TriggerEnter2D : FsmEvent<Collider2D> { void OnTrigger2DEnter(Collider2D other) { Notify(other); } } [DisallowMultipleComponent] public class TriggerStay2D : FsmEvent<Collider2D> { void OnTrigger2DStay(Collider2D other) { Notify(other); } } [DisallowMultipleComponent] public class TriggerExit2D : FsmEvent<Collider2D> { void OnTrigger2DExit(Collider2D other) { Notify(other); } } }
mit
C#
6d1ef689ae5dc9a3edfb6713c49208adf7a046a7
Change VarAddr to use identifier
CosmosOS/XSharp,CosmosOS/XSharp,CosmosOS/XSharp
source/XSharp/Tokens/Variable.cs
source/XSharp/Tokens/Variable.cs
namespace XSharp.Tokens { public class Variable : Identifier { public Variable() { mFirstChars = "."; } protected override bool CheckChar(int aLocalPos, char aChar) { // The name of the variable must start with a alphabet if (aLocalPos == 1) { return Chars.Alpha.IndexOf(aChar) > -1; } return base.CheckChar(aLocalPos, aChar); } public override object Check(string aText) { return aText.Substring(1); } } public class VariableAddress : Identifier { public VariableAddress() { mFirstChars = "@"; } protected override bool CheckChar(int aLocalPos, char aChar) { switch (aLocalPos) { case 1: return aChar == '.'; case 2: return Chars.Alpha.IndexOf(aChar) > -1; } return base.CheckChar(aLocalPos, aChar); } public override object Check(string aText) { return aText.Substring(2); } } }
namespace XSharp.Tokens { public class Variable : Identifier { public Variable() { mFirstChars = "."; } protected override bool CheckChar(int aLocalPos, char aChar) { // The name of the variable must start with a alphabet if (aLocalPos == 1) { return Chars.Alpha.IndexOf(aChar) > -1; } return base.CheckChar(aLocalPos, aChar); } public override object Check(string aText) { return aText.Substring(1); } } public class VariableAddress : Spruce.Tokens.AlphaNum { public VariableAddress() : base(Chars.AlphaNum, "@") { } protected override bool CheckChar(int aLocalPos, char aChar) { switch (aLocalPos) { case 0: return aChar == '@'; case 1: return aChar == '.'; case 2: return Chars.Alpha.IndexOf(aChar) > -1; } return base.CheckChar(aLocalPos, aChar); } public override object Check(string aText) { return aText.Substring(2); } } }
bsd-3-clause
C#
551964755bac758d51286d67b41c86095612e75a
fix urlparser logger type
PandaWood/Cradiator
src/Cradiator/Model/UrlParser.cs
src/Cradiator/Model/UrlParser.cs
using System; using System.Text.RegularExpressions; using Cradiator.Extensions; using log4net; namespace Cradiator.Model { public class UrlParser { static readonly ILog _log = LogManager.GetLogger(typeof(UrlParser).Name); private readonly string _url; public UrlParser(string url) { _url = url; } public string Url { get { return _url; } } public bool IsValid { get { var isValid = IsDebug || Regex.IsMatch(_url, @"^((https?)://+[\w\d:#@%/;$()~_?\+-=\\\.&]*)"); // just to prevent basic typos and misunderstandings if (!isValid) _log.WarnFormat("Skipping invalid URL: '{0}'", _url); return isValid; } } public bool IsNotValid { get { return !IsValid; } } public bool IsDebug { get { return _url.HasValue() && _url.ToLower().StartsWith("debug"); } } } }
using System; using System.Text.RegularExpressions; using Cradiator.Extensions; using log4net; namespace Cradiator.Model { public class UrlParser { static readonly ILog _log = LogManager.GetLogger(typeof(ViewUrl).Name); private readonly string _url; public UrlParser(string url) { _url = url; } public string Url { get { return _url; } } public bool IsValid { get { var isValid = IsDebug || Regex.IsMatch(_url, @"^((https?)://+[\w\d:#@%/;$()~_?\+-=\\\.&]*)"); if (!isValid) _log.WarnFormat("Skipping invalid URL: '{0}'", _url); return isValid; } } public bool IsNotValid { get { return !IsValid; } } public bool IsDebug { get { return _url.HasValue() && _url.ToLower().StartsWith("debug"); } } } }
mit
C#
fd1bc3f77767eb57509810fd3c2fae2dbba66aa1
build 0.0.5
rachmann/qboAccess,rachmann/qboAccess,rachmann/qboAccess
src/Global/GlobalAssemblyInfo.cs
src/Global/GlobalAssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; [ assembly : ComVisible( false ) ] [ assembly : AssemblyProduct( "QuickBooksOnlineAccess" ) ] [ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ] [ assembly : AssemblyCopyright( "Copyright (C) 2014 Agile Harbor, LLC" ) ] [ assembly : AssemblyDescription( "QuickBooksOnline webservices API wrapper." ) ] [ assembly : AssemblyTrademark( "" ) ] [ assembly : AssemblyCulture( "" ) ] [ assembly : CLSCompliant( 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.*")] // Keep in track with CA API version [ assembly : AssemblyVersion( "0.0.5.0" ) ]
using System; using System.Reflection; using System.Runtime.InteropServices; [ assembly : ComVisible( false ) ] [ assembly : AssemblyProduct( "QuickBooksOnlineAccess" ) ] [ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ] [ assembly : AssemblyCopyright( "Copyright (C) 2014 Agile Harbor, LLC" ) ] [ assembly : AssemblyDescription( "QuickBooksOnline webservices API wrapper." ) ] [ assembly : AssemblyTrademark( "" ) ] [ assembly : AssemblyCulture( "" ) ] [ assembly : CLSCompliant( 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.*")] // Keep in track with CA API version [ assembly : AssemblyVersion( "0.0.4.0" ) ]
bsd-3-clause
C#
e33e78ece05145e7480e570c4dbe1ddea6034a5f
change sample
akamyshanov/launchable
src/Launchable.Sample/Program.cs
src/Launchable.Sample/Program.cs
using System; using System.IO; namespace Launchable.Sample { class Program : ILaunchable { public void Dispose() { Log("Stopping"); } public void Start() { Log("Starting"); } private static void Log(string msg) { msg = DateTime.Now.ToString("R") + " / " + msg; Console.WriteLine(msg); File.AppendAllText("log.txt", msg + Environment.NewLine); } static void Main(string[] args) { LaunchableRunner.Run<Program>(args); // or LaunchableRunner.Run(() => new Program(), args); } } }
using System; using System.IO; namespace Launchable.Sample { class Program : ILaunchable { public void Dispose() { Log("Stopping"); } public void Start() { Log("Starting"); } private static void Log(string msg) { msg = DateTime.Now.ToString("R") + " / " + msg; Console.WriteLine(msg); File.AppendAllText("log.txt", msg + Environment.NewLine); } static void Main(string[] args) { LaunchableRunner.Run<Program>(args); } } }
mit
C#
0ee782e8f4fb78ed743cad90fe2105194cfe7fca
Make this interface disposable so taht code analysis should hopefully remind users to call .Dispose on it.
Haraguroicha/CefSharp,zhangjingpu/CefSharp,dga711/CefSharp,AJDev77/CefSharp,VioletLife/CefSharp,VioletLife/CefSharp,gregmartinhtc/CefSharp,battewr/CefSharp,illfang/CefSharp,wangzheng888520/CefSharp,VioletLife/CefSharp,twxstar/CefSharp,NumbersInternational/CefSharp,haozhouxu/CefSharp,twxstar/CefSharp,twxstar/CefSharp,Livit/CefSharp,ruisebastiao/CefSharp,wangzheng888520/CefSharp,Haraguroicha/CefSharp,rlmcneary2/CefSharp,illfang/CefSharp,haozhouxu/CefSharp,AJDev77/CefSharp,joshvera/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,ITGlobal/CefSharp,zhangjingpu/CefSharp,rlmcneary2/CefSharp,NumbersInternational/CefSharp,windygu/CefSharp,joshvera/CefSharp,Livit/CefSharp,zhangjingpu/CefSharp,gregmartinhtc/CefSharp,Haraguroicha/CefSharp,dga711/CefSharp,illfang/CefSharp,NumbersInternational/CefSharp,illfang/CefSharp,jamespearce2006/CefSharp,AJDev77/CefSharp,yoder/CefSharp,ruisebastiao/CefSharp,NumbersInternational/CefSharp,haozhouxu/CefSharp,ITGlobal/CefSharp,jamespearce2006/CefSharp,haozhouxu/CefSharp,twxstar/CefSharp,ITGlobal/CefSharp,wangzheng888520/CefSharp,dga711/CefSharp,battewr/CefSharp,battewr/CefSharp,rlmcneary2/CefSharp,yoder/CefSharp,battewr/CefSharp,windygu/CefSharp,windygu/CefSharp,rlmcneary2/CefSharp,yoder/CefSharp,VioletLife/CefSharp,Livit/CefSharp,gregmartinhtc/CefSharp,ruisebastiao/CefSharp,jamespearce2006/CefSharp,ruisebastiao/CefSharp,ITGlobal/CefSharp,Haraguroicha/CefSharp,windygu/CefSharp,joshvera/CefSharp,yoder/CefSharp,AJDev77/CefSharp,gregmartinhtc/CefSharp,Livit/CefSharp,dga711/CefSharp,joshvera/CefSharp,wangzheng888520/CefSharp,zhangjingpu/CefSharp,Haraguroicha/CefSharp
CefSharp/IRequest.cs
CefSharp/IRequest.cs
// Copyright © 2010-2015 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; using System.Collections.Specialized; namespace CefSharp { public interface IRequest : IDisposable { string Url { get; set; } string Method { get; } string Body { get; } NameValueCollection Headers { get; set; } /// <summary> /// Get the transition type for this request. /// Applies to requests that represent a main frame or sub-frame navigation. /// </summary> TransitionType TransitionType { get; } } }
// Copyright © 2010-2015 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System.Collections.Specialized; namespace CefSharp { public interface IRequest { string Url { get; set; } string Method { get; } string Body { get; } NameValueCollection Headers { get; set; } /// <summary> /// Get the transition type for this request. /// Applies to requests that represent a main frame or sub-frame navigation. /// </summary> TransitionType TransitionType { get; } } }
bsd-3-clause
C#
cc7da265f272cf0d3eafa32bafd7e043e458540e
Add exit codes
Ackara/Daterpillar
src/Daterpillar.CommandLine/ExitCode.cs
src/Daterpillar.CommandLine/ExitCode.cs
namespace Gigobyte.Daterpillar { internal struct ExitCode { public const int Success = 0; public const int ParsingError = 2; public const int UnhandledException = 1; } }
namespace Gigobyte.Daterpillar { internal struct ExitCode { public const int Success = 0; } }
mit
C#
4f40333cc02adb8c04e1940538702e891a657d51
Update AssemblyInfo.cs
tiksn/TIKSN-Framework
TIKSN.LanguageLocalization/Properties/AssemblyInfo.cs
TIKSN.LanguageLocalization/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; [assembly: AssemblyTitle("TIKSN.LanguageLocalization")] [assembly: NeutralResourcesLanguage("en")]
using System.Reflection; using System.Resources; [assembly: AssemblyTitle("TIKSN.LanguageLocalization")] [assembly: NeutralResourcesLanguage("en")]
mit
C#
5be216e16f6d092847058d963e38af5b4b7d5817
Disable test parallelization
tunnelvisionlabs/dotnet-trees
Tvl.Collections.Trees.Test/Properties/AssemblyInfo.cs
Tvl.Collections.Trees.Test/Properties/AssemblyInfo.cs
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System; using System.Reflection; using System.Runtime.InteropServices; using Xunit; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(false)] // 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("73541434-2511-441c-bbaf-05044be33019")] // Disable test parallelization since GeneratorTest manipulates mutable shared data [assembly: CollectionBehavior(DisableTestParallelization = true)]
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System; using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(false)] // 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("73541434-2511-441c-bbaf-05044be33019")]
mit
C#
312872fc74f9287782187936aa8e5108b8afd766
add note to use your own api key in Demo.cs
weblogng/weblogng-client-dotnet
WeblogNG.Test/Demo.cs
WeblogNG.Test/Demo.cs
using System; namespace WeblogNG.Demo { public class Utilities { //be sure to generate and use your own api key via the 'User Account' page at: //http://weblog-ng-ui.herokuapp.com/app/#/account public static Logger Logger = Logger.CreateAsyncLogger ("93c5a127-e2a4-42cc-9cc6-cf17fdac8a7f"); } public class Application { public void StartUp() { using (Utilities.Logger.CreateTimer ("Application-StartUp")) { //perform the acutal start up operations, e.g.: //1. read configuration //2. initialize connection pools //3. pre-heat caches //4. etc System.Threading.Thread.Sleep (1000); } } public static void Main (string[] args){ Application app = new Application (); app.StartUp (); System.Threading.Thread.Sleep (15000); } } }
using System; namespace WeblogNG.Demo { public class Utilities { public static Logger Logger = Logger.CreateAsyncLogger ("93c5a127-e2a4-42cc-9cc6-cf17fdac8a7f"); } public class Application { public void StartUp() { using (Utilities.Logger.CreateTimer ("Application-StartUp")) { //perform the acutal start up operations, e.g.: //1. read configuration //2. initialize connection pools //3. pre-heat caches //4. etc System.Threading.Thread.Sleep (1000); } } public static void Main (string[] args){ Application app = new Application (); app.StartUp (); System.Threading.Thread.Sleep (15000); } } }
apache-2.0
C#
dcc2dc1fa5b23db8b710d6f46b889f24f30dd9aa
add XML doc
OlegKleyman/Omego.Extensions
core/Omego.Extensions/Queryable.cs
core/Omego.Extensions/Queryable.cs
namespace Omego.Extensions { using System; using System.Linq; using System.Linq.Expressions; /// <summary> /// Contains extension methods for <see cref="IQueryable{T}" />. /// </summary> public static class Queryable { /// <summary> /// Returns the first element of an <see cref="IQueryable{T}" /> matching the given predicate or throws an <see cref="Exception"/>. /// </summary> /// <typeparam name="T">The type of the object to return.</typeparam> /// <param name="queryable">The <see cref="IQueryable{T}"/> of <typeparamref name="T"/> to find the first element in.</param> /// <param name="predicate">The predicate to use to find the first element.</param> /// <param name="exception">The exception to throw when the element is not found.</param> /// <returns>An instance of <typeparamref name="T" />.</returns> public static T FirstOrThrow<T>(this IQueryable<T> queryable, Expression<Func<T, bool>> predicate, Exception exception) { if (queryable == null) throw new ArgumentNullException(nameof(queryable)); if(predicate == null) throw new ArgumentNullException(nameof(predicate)); if (!queryable.Any(predicate)) { if (exception == null) throw new ArgumentNullException(nameof(exception)); throw exception; } return queryable.First(predicate); } /// <summary> /// Returns the first element of an <see cref="IQueryable{T}" /> of <typeparamref name="T"/> or throws an exception. /// </summary> /// <typeparam name="T">The type of the object to return.</typeparam> /// <param name="queryable">The <see cref="IQueryable{T}"/> of <typeparamref name="T"/> to find the first element in.</param> /// <param name="exception">The exception to throw when the element is not found.</param> /// <returns>An instance of <typeparamref name="T" />.</returns> public static T FirstOrThrow<T>(this IQueryable<T> queryable, Exception exception) { return queryable.FirstOrThrow(element => true, exception); } /// <summary> /// Returns the first element of an <see cref="IQueryable{T}" /> matching the given predicate or throws an <see cref="InvalidOperationException"/>. /// </summary> /// <typeparam name="T">The type of the object to return.</typeparam> /// <param name="queryable">The <see cref="IQueryable{T}"/> of <typeparamref name="T"/> to find the first element in.</param> /// <param name="predicate">The predicate to use to find the first element.</param> /// <returns>An instance of <typeparamref name="T" />.</returns> public static T FirstOrThrow<T>(this IQueryable<T> queryable, Expression<Func<T, bool>> predicate) { if (predicate == null) throw new ArgumentNullException(nameof(predicate)); return queryable.FirstOrThrow( predicate, new InvalidOperationException($"No matches found for: {predicate.Body}")); } } }
namespace Omego.Extensions { using System; using System.Linq; using System.Linq.Expressions; public static class Queryable { public static T FirstOrThrow<T>(this IQueryable<T> queryable, Expression<Func<T, bool>> predicate, Exception exception) { if (queryable == null) throw new ArgumentNullException(nameof(queryable)); if(predicate == null) throw new ArgumentNullException(nameof(predicate)); if (!queryable.Any(predicate)) { if (exception == null) throw new ArgumentNullException(nameof(exception)); throw exception; } return queryable.First(predicate); } public static T FirstOrThrow<T>(this IQueryable<T> queryable, Exception exception) { return queryable.FirstOrThrow(element => true, exception); } public static T FirstOrThrow<T>(this IQueryable<T> queryable, Expression<Func<T, bool>> predicate) { if (predicate == null) throw new ArgumentNullException(nameof(predicate)); return queryable.FirstOrThrow( predicate, new InvalidOperationException($"No matches found for: {predicate.Body}")); } } }
unlicense
C#
fa64cd411957a6c067b567fad88eb9165ebfda66
修复查询字符串拼接的一个小错误。 :station:
Zongsoft/Zongsoft.Web
src/Utility.cs
src/Utility.cs
using System; using System.Collections.Generic; namespace Zongsoft.Web { internal static class Utility { public static string RepairQueryString(string path, string queryString = null) { if(string.IsNullOrWhiteSpace(queryString)) return path; queryString = queryString.Trim().TrimStart('?'); if(string.IsNullOrWhiteSpace(path)) return "/" + (string.IsNullOrWhiteSpace(queryString) ? string.Empty : "?" + queryString); var index = path.IndexOf('?'); if(index > 0) return path + "&" + queryString; else return path + "?" + queryString; } } }
using System; using System.Collections.Generic; namespace Zongsoft.Web { internal static class Utility { public static string RepairQueryString(string path, string queryString = null) { if(string.IsNullOrWhiteSpace(queryString)) return path; queryString = queryString.Trim().TrimStart('?'); if(string.IsNullOrWhiteSpace(path)) return "/" + (string.IsNullOrWhiteSpace(queryString) ? string.Empty : "?" + queryString); var index = path.IndexOf('?'); if(index > 0) return path + "&" + queryString; else return path + "?" + (string.IsNullOrWhiteSpace(queryString) ? string.Empty : "?" + queryString); } } }
lgpl-2.1
C#
76907cbee6f63a2ead6fc76204644ed6accbf36c
Fix constructor line length in DirectedEdge.
DasAllFolks/SharpGraphs
Graph/DirectedEdge.cs
Graph/DirectedEdge.cs
using System; namespace Graph { /// <summary> /// Represents a directed edge (arrow) in a labeled <see cref="IGraph"/>. /// </summary> /// <typeparam name="V"> /// The type used to create vertex (node) labels. /// </typeparam> /// <typeparam name="W"> /// The type used for the edge weight. /// </typeparam> public class DirectedEdge<V, W> : AbstractEdge<V, W>, IDirectedEdge<V, W> where V : struct, IEquatable<V> where W : struct, IComparable<W>, IEquatable<W> { /// <summary> /// Returns the head (vertex) of the <see cref="DirectedEdge{V, W}"/>. /// </summary> /// <remarks>Immutable after construction.</remarks> public V Head { get; private set; } /// <summary> /// Returns the tail (vertex) of the <see cref="DirectedEdge{T}"/>. /// </summary> /// <remarks>Immutable after construction.</remarks> public V Tail { get; private set; } /// <summary> /// Creates a new <see cref="DirectedEdge{T}"/> from two vertices. /// </summary> public DirectedEdge(V head, V tail, W weight) : base(head, tail, weight) { Head = head; Tail = tail; } /// <summary> /// Determines whether two <see cref="DirectedEdge{V, W}"/>s have the /// same head and tail vertices and weight. /// </summary> public bool Equals(IDirectedEdge<V, W> directedEdge) { return Head.Equals(directedEdge.Head) && Tail.Equals(directedEdge.Tail) && Weight.Equals(directedEdge.Weight); } } }
using System; namespace Graph { /// <summary> /// Represents a directed edge (arrow) in a labeled <see cref="IGraph"/>. /// </summary> /// <typeparam name="V"> /// The type used to create vertex (node) labels. /// </typeparam> /// <typeparam name="W"> /// The type used for the edge weight. /// </typeparam> public class DirectedEdge<V, W> : AbstractEdge<V, W>, IDirectedEdge<V, W> where V : struct, IEquatable<V> where W : struct, IComparable<W>, IEquatable<W> { /// <summary> /// Returns the head (vertex) of the <see cref="DirectedEdge{V, W}"/>. /// </summary> /// <remarks>Immutable after construction.</remarks> public V Head { get; private set; } /// <summary> /// Returns the tail (vertex) of the <see cref="DirectedEdge{T}"/>. /// </summary> /// <remarks>Immutable after construction.</remarks> public V Tail { get; private set; } /// <summary> /// Creates a new <see cref="DirectedEdge{T}"/> from two vertices. /// </summary> public DirectedEdge(V head, V tail, W weight) : base(head, tail, weight) { Head = head; Tail = tail; } /// <summary> /// Determines whether two <see cref="DirectedEdge{V, W}"/>s have the /// same head and tail vertices and weight. /// </summary> public bool Equals(IDirectedEdge<V, W> directedEdge) { return Head.Equals(directedEdge.Head) && Tail.Equals(directedEdge.Tail) && Weight.Equals(directedEdge.Weight); } } }
apache-2.0
C#
fae3bef17dc1c19437f2a5a4b87b11508f8c353f
disable ci task
lriki/Lumino,lriki/Lumino,lriki/Lumino,lriki/Lumino,lriki/Lumino,lriki/Lumino,lriki/Lumino
tools/LuminoBuild/Rules/BuildForCI_3.cs
tools/LuminoBuild/Rules/BuildForCI_3.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LuminoBuild.Rules { // CI 環境によっては実行時間が長すぎると強制終了させられる。そのため、一部のタスクを分離したりスキップするための BuildRule。 class BuildForCI_3 : BuildRule { public override string Name => "BuildForCI_3"; public override void Build(Builder builder) { builder.DoTask("MakeReleasePackage"); builder.DoTask("CompressPackage"); if (Utils.IsWin32) { //builder.DoTask("MakeNuGetPackage_Core"); builder.DoTask("MakeInstaller_Win32"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LuminoBuild.Rules { // CI 環境によっては実行時間が長すぎると強制終了させられる。そのため、一部のタスクを分離したりスキップするための BuildRule。 class BuildForCI_3 : BuildRule { public override string Name => "BuildForCI_3"; public override void Build(Builder builder) { builder.DoTask("MakeReleasePackage"); builder.DoTask("CompressPackage"); if (Utils.IsWin32) { builder.DoTask("MakeNuGetPackage_Core"); builder.DoTask("MakeInstaller_Win32"); } } } }
mit
C#
ace1cc0e7072df25e53a08281856630edd6e2a17
Fix number formatter allocating many arrays
smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,ppy/osu-framework
osu.Framework/Utils/NumberFormatter.cs
osu.Framework/Utils/NumberFormatter.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; namespace osu.Framework.Utils { /// <summary> /// Exposes functionality for formatting numbers. /// </summary> public static class NumberFormatter { private static readonly string[] suffixes = { "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" }; /// <summary> /// Prints the number with at most two decimal digits, followed by a magnitude suffic (k, M, G, T, etc.) depending on the magnitude of the number. If the number is /// too large or small this will print the number using scientific notation instead. /// </summary> /// <param name="number">The number to print.</param> /// <returns>The number with at most two decimal digits, followed by a magnitude suffic (k, M, G, T, etc.) depending on the magnitude of the number. If the number is /// too large or small this will print the number using scientific notation instead.</returns> public static string PrintWithSiSuffix(double number) { // The logarithm is undefined for zero. if (number == 0) return "0"; var isNeg = number < 0; number = Math.Abs(number); int log1000 = (int)Math.Floor(Math.Log(number, 1000)); int index = log1000 + 8; if (index >= suffixes.Length) return $"{(isNeg ? "-" : "")}{number:E}"; return $"{(isNeg ? "-" : "")}{number / Math.Pow(1000, log1000):G3}{suffixes[index]}"; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; namespace osu.Framework.Utils { /// <summary> /// Exposes functionality for formatting numbers. /// </summary> public static class NumberFormatter { /// <summary> /// Prints the number with at most two decimal digits, followed by a magnitude suffic (k, M, G, T, etc.) depending on the magnitude of the number. If the number is /// too large or small this will print the number using scientific notation instead. /// </summary> /// <param name="number">The number to print.</param> /// <returns>The number with at most two decimal digits, followed by a magnitude suffic (k, M, G, T, etc.) depending on the magnitude of the number. If the number is /// too large or small this will print the number using scientific notation instead.</returns> public static string PrintWithSiSuffix(double number) { // The logarithm is undefined for zero. if (number == 0) return "0"; var isNeg = number < 0; number = Math.Abs(number); var strs = new[] { "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" }; int log1000 = (int)Math.Floor(Math.Log(number, 1000)); int index = log1000 + 8; if (index >= strs.Length) return $"{(isNeg ? "-" : "")}{number:E}"; return $"{(isNeg ? "-" : "")}{number / Math.Pow(1000, log1000):G3}{strs[index]}"; } } }
mit
C#
2f972ebb0066a2a4235126da7e103f684de1c777
Use OnAttachedToVisualTree and OnDetachedFromVisualTree
wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors
src/Avalonia.Xaml.Interactions/Custom/FocusOnAttachedToVisualTreeBehavior.cs
src/Avalonia.Xaml.Interactions/Custom/FocusOnAttachedToVisualTreeBehavior.cs
using Avalonia.Controls; using Avalonia.Xaml.Interactivity; namespace Avalonia.Xaml.Interactions.Custom; /// <summary> /// Focuses the <see cref="Behavior.AssociatedObject"/> when attached to visual tree. /// </summary> public class FocusOnAttachedToVisualTreeBehavior : Behavior<Control> { /// <inheritdoc/> protected override void OnAttachedToVisualTree() { base.OnAttachedToVisualTree(); AssociatedObject?.Focus(); } }
using Avalonia.Controls; using Avalonia.Xaml.Interactivity; namespace Avalonia.Xaml.Interactions.Custom; /// <summary> /// Focuses the <see cref="Behavior.AssociatedObject"/> when attached to visual tree. /// </summary> public class FocusOnAttachedToVisualTreeBehavior : Behavior<Control> { /// <summary> /// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>. /// </summary> protected override void OnAttached() { base.OnAttached(); if (AssociatedObject is { }) { AssociatedObject.AttachedToVisualTree += AssociatedObject_AttachedToVisualTree; } } /// <summary> /// Called when the behavior is being detached from its <see cref="Behavior.AssociatedObject"/>. /// </summary> protected override void OnDetaching() { base.OnDetaching(); if (AssociatedObject is { }) { AssociatedObject.AttachedToVisualTree -= AssociatedObject_AttachedToVisualTree; } } private void AssociatedObject_AttachedToVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { AssociatedObject?.Focus(); } }
mit
C#
b2dcda7b5ddfbd10fdfa9112ccd478c209defe05
Add auth to Learners endpoint
SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments
src/CommitmentsV2/SFA.DAS.CommitmentsV2.Api/Controllers/LearnerController.cs
src/CommitmentsV2/SFA.DAS.CommitmentsV2.Api/Controllers/LearnerController.cs
using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SFA.DAS.CommitmentsV2.Api.Types.Responses; using SFA.DAS.CommitmentsV2.Application.Queries.GetAllLearners; using System; using System.Net; using System.Threading.Tasks; namespace SFA.DAS.CommitmentsV2.Api.Controllers { [ApiController] [Authorize] [Route("api/learners")] public class LearnerController : ControllerBase { private readonly IMediator _mediator; public LearnerController(IMediator mediator) { _mediator = mediator; } [HttpGet] public async Task<IActionResult> GetAllLearners(DateTime? sinceTime = null, int batch_number = 1, int batch_size = 1000) { var result = await _mediator.Send(new GetAllLearnersQuery(sinceTime, batch_number, batch_size)); var settings = new JsonSerializerSettings { DateFormatString = "yyyy-MM-dd'T'HH:mm:ss" }; var jsonResult = new JsonResult(new GetAllLearnersResponse() { Learners = result.Learners, BatchNumber = result.BatchNumber, BatchSize = result.BatchSize, TotalNumberOfBatches = result.TotalNumberOfBatches }, settings); jsonResult.StatusCode = (int)HttpStatusCode.OK; jsonResult.ContentType = "application/json"; return jsonResult; } } }
using System; using System.Net; using System.Threading.Tasks; using MediatR; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SFA.DAS.CommitmentsV2.Api.Types.Responses; using SFA.DAS.CommitmentsV2.Application.Queries.GetAllLearners; namespace SFA.DAS.CommitmentsV2.Api.Controllers { [ApiController] [Route("api/learners")] public class LearnerController : ControllerBase { private readonly IMediator _mediator; public LearnerController(IMediator mediator) { _mediator = mediator; } [HttpGet] public async Task<IActionResult> GetAllLearners(DateTime? sinceTime = null, int batch_number = 1, int batch_size = 1000) { var result = await _mediator.Send(new GetAllLearnersQuery(sinceTime, batch_number, batch_size)); var settings = new JsonSerializerSettings { DateFormatString = "yyyy-MM-dd'T'HH:mm:ss" }; var jsonResult = new JsonResult(new GetAllLearnersResponse() { Learners = result.Learners, BatchNumber = result.BatchNumber, BatchSize = result.BatchSize, TotalNumberOfBatches = result.TotalNumberOfBatches }, settings); jsonResult.StatusCode = (int)HttpStatusCode.OK; jsonResult.ContentType = "application/json"; return jsonResult; } } }
mit
C#
c77c84bec7cca32b8d4c081acaf57e197461d6f5
Remove ContextType.Invalid
RogueException/Discord.Net,Confruggy/Discord.Net,AntiTcb/Discord.Net,LassieME/Discord.Net
src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs
src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Discord.Commands { [Flags] public enum ContextType { Guild = 1, // 01 DM = 2 // 10 } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class RequireContextAttribute : PreconditionAttribute { public ContextType Context { get; set; } public RequireContextAttribute(ContextType context) { Context = context; } public override Task<PreconditionResult> CheckPermissions(IMessage context, Command executingCommand, object moduleInstance) { var validContext = false; if (Context.HasFlag(ContextType.Guild)) validContext = validContext || context.Channel is IGuildChannel; if (Context.HasFlag(ContextType.DM)) validContext = validContext || context.Channel is IDMChannel; if (validContext) return Task.FromResult(PreconditionResult.FromSuccess()); else return Task.FromResult(PreconditionResult.FromError($"Invalid context for command; accepted contexts: {Context}")); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Discord.Commands { [Flags] public enum ContextType { Invalid = 0, // 00 Guild = 1, // 01 DM = 2 // 10 } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class RequireContextAttribute : PreconditionAttribute { public ContextType Context { get; set; } public RequireContextAttribute(ContextType context) { Context = context; if (Context == ContextType.Invalid) throw new ArgumentException("Context must be a bitfield of ContextType.Guild and ContextType.DM", "context"); } public override Task<PreconditionResult> CheckPermissions(IMessage context, Command executingCommand, object moduleInstance) { var validContext = false; if (Context == ContextType.Invalid) throw new InvalidOperationException("Invalid ContextType"); if (Context.HasFlag(ContextType.Guild)) validContext = validContext || context.Channel is IGuildChannel; if (Context.HasFlag(ContextType.DM)) validContext = validContext || context.Channel is IDMChannel; if (validContext) return Task.FromResult(PreconditionResult.FromSuccess()); else return Task.FromResult(PreconditionResult.FromError($"Invalid context for command; accepted contexts: {Context}")); } } }
mit
C#
04de08ca3f39914433a35a28b964eb4a99ddf446
move list to one matchbox parent
smbc-digital/iag-webapp,smbc-digital/iag-webapp,smbc-digital/iag-webapp
src/StockportWebapp/Views/stockportgov/Shared/GenericFeaturedItemList.cshtml
src/StockportWebapp/Views/stockportgov/Shared/GenericFeaturedItemList.cshtml
@model StockportWebapp.Models.GenericFeaturedItemList @{ var loopCount = Model.HideButton ? Model.Items.Count() : 8; } <div class="matchbox-parent"> <div class="primary-topics"> @for (var count = 0; count < loopCount; count += 4) { <div class="featured-topic-list generic-Featured-Items-margin-top"> <partial name="GenericFeaturedItem" model='Model.Items.Skip(count).Take(4)' /> </div> } </div> @if (!string.IsNullOrEmpty(Model.ButtonText)) { <div id="see-more-container" class="generic-list-see-more-container"> @for (var count = 8; count < Model.Items.Count(); count += 4) { <div class="featured-topic-list generic-Featured-Items-margin-top"> <partial name="GenericFeaturedItem" model='Model.Items.Skip(count).Take(4)' /> </div> } </div> @if (Model.Items.Count >= 9) { <div> <div class="featured-content-button-wrapper"> <stock-button id="see-more-services" class="@Model.ButtonCssClass generic-list-see-more button-up-down">@Model.ButtonText</stock-button> </div> </div> } } </div> <script> require(['/assets/javascript/stockportgov/config.min.js'], function() { require(['viewmoreslider.min'], function(viewmoreslider) { viewmoreslider.Init(); } ); }); </script>
@model StockportWebapp.Models.GenericFeaturedItemList @{ var loopCount = Model.HideButton ? Model.Items.Count() : 8; } <div class="primary-topics"> @for (var count = 0; count < loopCount; count += 4) { <div class="featured-topic-list generic-Featured-Items-margin-top matchbox-parent"> <partial name="GenericFeaturedItem" model='Model.Items.Skip(count).Take(4)' /> </div> } </div> @if (!string.IsNullOrEmpty(Model.ButtonText)) { <div id="see-more-container" class="generic-list-see-more-container"> @for (var count = 8; count < Model.Items.Count(); count += 4) { <div class="featured-topic-list generic-Featured-Items-margin-top matchbox-parent"> <partial name="GenericFeaturedItem" model='Model.Items.Skip(count).Take(4)' /> </div> } </div> @if (Model.Items.Count >= 9) { <div> <div class="featured-content-button-wrapper"> <stock-button id="see-more-services" class="@Model.ButtonCssClass generic-list-see-more button-up-down">@Model.ButtonText</stock-button> </div> </div> } } <script> require(['/assets/javascript/stockportgov/config.min.js'], function() { require(['viewmoreslider.min'], function(viewmoreslider) { viewmoreslider.Init(); } ); }); </script>
mit
C#
d2a5b00748e599a465c42dea7dd2f700c7f3f08d
Check for AD credentials, check if local account
ZXeno/Andromeda
Andromeda/Andromeda/CredentialManager.cs
Andromeda/Andromeda/CredentialManager.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.DirectoryServices.AccountManagement; namespace Andromeda { public static class CredentialManager { public static string UserName { get; set; } public static string GetDomain() { return Environment.UserDomainName; } public static string GetUser() { return "null"; } public static string GetPass() { return "null"; } public static bool DoesUserExistInActiveDirectory(string userName) { try { using (var domainContext = new PrincipalContext(ContextType.Domain, Environment.UserDomainName)) { using (var foundUser = UserPrincipal.FindByIdentity(domainContext, IdentityType.SamAccountName, userName)) { return foundUser != null; } } } catch (Exception ex) { return false; } } public static bool IsUserLocal(string userName) { bool exists = false; using (var domainContext = new PrincipalContext(ContextType.Machine)) { using (var foundUser = UserPrincipal.FindByIdentity(domainContext, IdentityType.SamAccountName, userName)) { return true; } } return false; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Andromeda { public static class CredentialManager { public static string GetUser() { return "null"; } public static string GetPass() { return "null"; } } }
agpl-3.0
C#
e6607fb1f00b1a446fcfb4adc869c329a25006d0
update xml comments
Pondidum/Conifer,Pondidum/Conifer
Conifer/RouterConfigurationExpression.cs
Conifer/RouterConfigurationExpression.cs
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Web.Http.Controllers; namespace Conifer { public class RouterConfigurationExpression { private readonly List<IRouteConvention> _defaultConventions; private readonly IConventionalRouter _router; public RouterConfigurationExpression(IConventionalRouter router) { _defaultConventions = Default.Conventions.ToList(); _router = router; } /// <summary>Setup the default convetions to create routes</summary> public void DefaultConventionsAre(IEnumerable<IRouteConvention> conventions) { _defaultConventions.Clear(); _defaultConventions.AddRange(conventions); } /// <summary>Create routes for all the applicable methods in the controller</summary> public void AddAll<TController>() where TController : IHttpController { AddAll<TController>(_defaultConventions); } /// <summary>Create routes for all the applicable methods in the controller</summary> /// <param name="conventions">Override the default conventions with a custom set</param> public void AddAll<TController>(IEnumerable<IRouteConvention> conventions) where TController : IHttpController { if (conventions == null) conventions = Enumerable.Empty<IRouteConvention>(); _router.AddRoutes<TController>(conventions.ToList()); } /// <summary>Creates a route for the specified method in the controller /// </summary> public void Add<TController>(Expression<Action<TController>> expression) where TController : IHttpController { Add(expression, _defaultConventions); } /// <summary>Creates a route for the specified method in the controller</summary> /// <param name="expression">The action to create a route for</param> /// <param name="conventions">Override the default conventions with a custom set</param> public void Add<TController>(Expression<Action<TController>> expression, IEnumerable<IRouteConvention> conventions) where TController : IHttpController { if (conventions == null) conventions = Enumerable.Empty<IRouteConvention>(); _router.AddRoute(expression, conventions.ToList()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Web.Http.Controllers; namespace Conifer { public class RouterConfigurationExpression { private readonly List<IRouteConvention> _defaultConventions; private readonly IConventionalRouter _router; public RouterConfigurationExpression(IConventionalRouter router) { _defaultConventions = Default.Conventions.ToList(); _router = router; } /// <summary> /// Setup the default convetions to create routes /// </summary> public void DefaultConventionsAre(IEnumerable<IRouteConvention> conventions) { _defaultConventions.Clear(); _defaultConventions.AddRange(conventions); } /// <summary> /// Create routes for all the applicable methods in the controller /// </summary> public void AddAll<TController>() where TController : IHttpController { AddAll<TController>(_defaultConventions); } /// <summary> /// Create routes for all the applicable methods in the controller /// </summary> /// <param name="conventions">Override the default conventions with a custom set</param> public void AddAll<TController>(IEnumerable<IRouteConvention> conventions) where TController : IHttpController { if (conventions == null) conventions = Enumerable.Empty<IRouteConvention>(); _router.AddRoutes<TController>(conventions.ToList()); } /// <summary> /// Creates a route for the specified method in the controller /// </summary> public void Add<TController>(Expression<Action<TController>> expression) where TController : IHttpController { Add(expression, _defaultConventions); } /// <summary> /// Creates a route for the specified method in the controller /// </summary> /// <param name="conventions">Override the default conventions with a custom set</param> public void Add<TController>(Expression<Action<TController>> expression, IEnumerable<IRouteConvention> conventions) where TController : IHttpController { if (conventions == null) conventions = Enumerable.Empty<IRouteConvention>(); _router.AddRoute(expression, conventions.ToList()); } } }
lgpl-2.1
C#
a58f6d6b37116b034cb55907416a10021ee0282b
Refactor IServerConfig
msoler8785/ExoMail
ExoMail.Smtp/Interfaces/IServerConfig.cs
ExoMail.Smtp/Interfaces/IServerConfig.cs
using ExoMail.Smtp.Enums; using System.Collections.Generic; using System.Net; using System.Security.Cryptography.X509Certificates; namespace ExoMail.Smtp.Interfaces { public interface IServerConfig { string HostName { get; set; } bool IsEncryptionRequired { get; } bool IsTls { get; set; } int MaxMessageSize { get; set; } int Port { get; set; } string ServerId { get; set; } IPAddress ServerIpBinding { get; set; } int SessionTimeout { get; set; } //List<ISessionValidator> SessionValidators { get; set; } //List<IMessageValidator> MessageValidators { get; set; } X509Certificate2 X509Certificate2 { get; set; } ServerType ServerType { get; set; } //IMessageStore MessageStore { get; set; } } }
using System.Collections.Generic; using System.Net; using System.Security.Cryptography.X509Certificates; namespace ExoMail.Smtp.Interfaces { public interface IServerConfig { string HostName { get; set; } bool IsEncryptionRequired { get; } bool IsTls { get; set; } int MaxMessageSize { get; set; } int Port { get; set; } string ServerId { get; set; } IPAddress ServerIpBinding { get; set; } int SessionTimeout { get; set; } List<ISessionValidator> SessionValidators { get; set; } List<IMessageValidator> MessageValidators { get; set; } X509Certificate2 X509Certificate2 { get; set; } //IMessageStore MessageStore { get; set; } } }
mit
C#
1d62ffead31fc05708135c3c732dd6e7bd557f23
Set off automatical assembly version up
kamil4521/GendarmeNUnit
GendarmeNUnit/Properties/AssemblyInfo.cs
GendarmeNUnit/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("GendarmeNUnit")] [assembly: AssemblyDescription("Gendarme NUnit tools")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Giskard Solutions")] [assembly: AssemblyProduct("GendarmeNUnit")] [assembly: AssemblyCopyright("Copyright © Giskard Solutions 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("4c2299b3-4140-4d4c-82e0-896508d51f84")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyFileVersion("1.0.0")]
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("GendarmeNUnit")] [assembly: AssemblyDescription("Gendarme NUnit tools")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Giskard Solutions")] [assembly: AssemblyProduct("GendarmeNUnit")] [assembly: AssemblyCopyright("Copyright © Giskard Solutions 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("4c2299b3-4140-4d4c-82e0-896508d51f84")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
e9469009c16478cf8cfdf02e3b43185fe9e63089
refactor standalone osx build target
watson-developer-cloud/unity-sdk,watson-developer-cloud/unity-sdk,watson-developer-cloud/unity-sdk
Travis/TravisBuild.cs
Travis/TravisBuild.cs
/** * Copyright 2015 IBM Corp. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #if UNITY_EDITOR using UnityEditor; using UnityEngine; public static class RunTravisBuild { public static string[] BuildScenes = { "Assets/Watson/Scenes/UnitTests/Main.unity", "Assets/Watson/Scenes/UnitTests/TestMic.unity", "Assets/Watson/Scenes/UnitTests/TestNaturalLanguageClassifier.unity", "Assets/Watson/Scenes/UnitTests/TestSpeechToText.unity", "Assets/Watson/Scenes/UnitTests/TestTextToSpeech.unity", "Assets/Watson/Scenes/UnitTests/UnitTests.unity", "Assets/Watson/Examples/WidgetExamples/ExampleDialog.unity", "Assets/Watson/Examples/WidgetExamples/ExampleLanguageTranslator.unity" }; static public void OSX() { BuildPipeline.BuildPlayer(BuildScenes, Application.dataPath + "TestBuildOSX", BuildTarget.StandaloneOSXUniversal, BuildOptions.None); } static public void Windows() { BuildPipeline.BuildPlayer(BuildScenes, Application.dataPath + "TestBuildWindows", BuildTarget.StandaloneWindows64, BuildOptions.None); } static public void Linux() { BuildPipeline.BuildPlayer(BuildScenes, Application.dataPath + "TestBuildLinux", BuildTarget.StandaloneLinux64, BuildOptions.None); } } #endif
/** * Copyright 2015 IBM Corp. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #if UNITY_EDITOR using UnityEditor; using UnityEngine; public static class RunTravisBuild { public static string[] BuildScenes = { "Assets/Watson/Scenes/UnitTests/Main.unity", "Assets/Watson/Scenes/UnitTests/TestMic.unity", "Assets/Watson/Scenes/UnitTests/TestNaturalLanguageClassifier.unity", "Assets/Watson/Scenes/UnitTests/TestSpeechToText.unity", "Assets/Watson/Scenes/UnitTests/TestTextToSpeech.unity", "Assets/Watson/Scenes/UnitTests/UnitTests.unity", "Assets/Watson/Examples/WidgetExamples/ExampleDialog.unity", "Assets/Watson/Examples/WidgetExamples/ExampleLanguageTranslator.unity" }; static public void OSX() { BuildPipeline.BuildPlayer(BuildScenes, Application.dataPath + "TestBuildOSX", BuildTarget.StandaloneOSX, BuildOptions.None); } static public void Windows() { BuildPipeline.BuildPlayer(BuildScenes, Application.dataPath + "TestBuildWindows", BuildTarget.StandaloneWindows64, BuildOptions.None); } static public void Linux() { BuildPipeline.BuildPlayer(BuildScenes, Application.dataPath + "TestBuildLinux", BuildTarget.StandaloneLinux64, BuildOptions.None); } } #endif
apache-2.0
C#
1c07c1c60a9d85d3795b146409dc222e7ae35a7c
fix EnableVirtualizationWithGrouping
chuuddo/MahApps.Metro,MahApps/MahApps.Metro,ye4241/MahApps.Metro,jumulr/MahApps.Metro,xxMUROxx/MahApps.Metro,Jack109/MahApps.Metro,Evangelink/MahApps.Metro,Danghor/MahApps.Metro,psinl/MahApps.Metro,pfattisc/MahApps.Metro,batzen/MahApps.Metro,p76984275/MahApps.Metro
MahApps.Metro/Controls/ComboBoxHelper.cs
MahApps.Metro/Controls/ComboBoxHelper.cs
using System; using System.Windows; using System.Windows.Controls; namespace MahApps.Metro.Controls { /// <summary> /// A helper class that provides various attached properties for the ComboBox control. /// <see cref="ComboBox"/> /// </summary> public class ComboBoxHelper { public static readonly DependencyProperty EnableVirtualizationWithGroupingProperty = DependencyProperty.RegisterAttached("EnableVirtualizationWithGrouping", typeof(bool), typeof(ComboBoxHelper), new FrameworkPropertyMetadata(false, EnableVirtualizationWithGroupingPropertyChangedCallback)); private static void EnableVirtualizationWithGroupingPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { var comboBox = dependencyObject as ComboBox; if (comboBox != null && e.NewValue != e.OldValue) { #if NET4_5 comboBox.SetValue(VirtualizingStackPanel.IsVirtualizingProperty, e.NewValue); comboBox.SetValue(VirtualizingPanel.IsVirtualizingWhenGroupingProperty, e.NewValue); #endif } } public static void SetEnableVirtualizationWithGrouping(DependencyObject obj, bool value) { obj.SetValue(EnableVirtualizationWithGroupingProperty, value); } public static bool GetEnableVirtualizationWithGrouping(DependencyObject obj) { return (bool)obj.GetValue(EnableVirtualizationWithGroupingProperty); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; namespace MahApps.Metro.Controls { /// <summary> /// A helper class that provides various attached properties for the ComboBox control. /// <see cref="ComboBox"/> /// </summary> public class ComboBoxHelper : DependencyObject { public static readonly DependencyProperty EnableVirtualizationWithGroupingProperty = DependencyProperty.RegisterAttached("EnableVirtualizationWithGrouping", typeof(bool), typeof(ComboBoxHelper), new FrameworkPropertyMetadata(false)); public static void SetEnableVirtualizationWithGrouping(DependencyObject obj, bool value) { if (obj is ComboBox) { #if NET4_5 ComboBox comboBox = obj as ComboBox; comboBox.SetValue(EnableVirtualizationWithGroupingProperty, value); comboBox.SetValue(VirtualizingPanel.IsVirtualizingProperty, value); comboBox.SetValue(VirtualizingPanel.IsVirtualizingWhenGroupingProperty, value); #else obj.SetValue(EnableVirtualizationWithGroupingProperty, false); #endif } } public static bool GetEnableVirtualizationWithGrouping(DependencyObject obj) { return (bool)obj.GetValue(EnableVirtualizationWithGroupingProperty); } } }
mit
C#
7298a2c574070ebb3c263017addd659dbea216e4
Update version number
dneelyep/MonoGameUtils
MonoGameUtils/Properties/AssemblyInfo.cs
MonoGameUtils/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("MonoGameUtils")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MonoGameUtils")] [assembly: AssemblyCopyright("")] [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("4ecedc75-1f2d-4915-9efe-368a5d104e41")] // 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.1.6")] [assembly: AssemblyFileVersion("1.0.1.6")]
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("MonoGameUtils")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MonoGameUtils")] [assembly: AssemblyCopyright("")] [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("4ecedc75-1f2d-4915-9efe-368a5d104e41")] // 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.1.5")] [assembly: AssemblyFileVersion("1.0.1.5")]
mit
C#
ce4f0b46a5d65cf96841958dceb551115f19e930
fix dataview
Ackara/Daterpillar
src/Daterpillar/Modeling/DataRecord.cs
src/Daterpillar/Modeling/DataRecord.cs
using System; using System.Reflection; namespace Acklann.Daterpillar.Modeling { public abstract class DataRecord : DataViewRecord, IInsertable { public DataRecord() : this(null) { } public DataRecord(Type type) : base(type) { ColumnMap.Register(type ?? GetType()); } public virtual string GetTableName() => TableName; public virtual string[] GetColumns() { return ColumnMap.GetColumns(GetTableName()); } public virtual object[] GetValues() { MemberInfo[] members = ColumnMap.GetMembers(GetTableName()); object[] results = new object[members.Length]; for (int i = 0; i < results.Length; i++) { results[i] = WriteValue(members[i]); } return results; } protected virtual object WriteValue(PropertyInfo member) { return Scripting.SqlComposer.Serialize(member.GetValue(this)); } protected virtual object WriteValue(FieldInfo member) { return Scripting.SqlComposer.Serialize(member.GetValue(this)); } protected object WriteValue(MemberInfo member) { if (member is PropertyInfo property) return WriteValue(property); else if (member is FieldInfo field) return WriteValue(field); else return null; } #region Backing Members private string GetKey(string item) => string.Concat(GetTableName(), '.', item); #endregion Backing Members } }
using System; using System.Reflection; namespace Acklann.Daterpillar.Modeling { public abstract class DataRecord : DataViewRecord, IInsertable { public DataRecord() : this(null) { } public DataRecord(Type type) { ColumnMap.Register(type ?? GetType()); } public virtual string GetTableName() => TableName; public virtual string[] GetColumns() { return ColumnMap.GetColumns(GetTableName()); } public virtual object[] GetValues() { MemberInfo[] members = ColumnMap.GetMembers(GetTableName()); object[] results = new object[members.Length]; for (int i = 0; i < results.Length; i++) { results[i] = WriteValue(members[i]); } return results; } protected virtual object WriteValue(PropertyInfo member) { return Scripting.SqlComposer.Serialize(member.GetValue(this)); } protected virtual object WriteValue(FieldInfo member) { return Scripting.SqlComposer.Serialize(member.GetValue(this)); } protected object WriteValue(MemberInfo member) { if (member is PropertyInfo property) return WriteValue(property); else if (member is FieldInfo field) return WriteValue(field); else return null; } #region Backing Members private string GetKey(string item) => string.Concat(GetTableName(), '.', item); #endregion Backing Members } }
mit
C#
b88410682d22231eac3fb78ad51e1367d3d190b6
bump version
Recognos/Recognos.Core
Recognos.Core/Properties/AssemblyInfo.cs
Recognos.Core/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Recognos Romania")] [assembly: AssemblyProduct("Recognos Core Libraries")] [assembly: AssemblyCopyright("Copyright © Recognos Romania 2014")] [assembly: AssemblyTrademark("Recognos Core Libraries")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] [assembly: AssemblyVersion("2.0.1.0")] [assembly: AssemblyFileVersion("2.0.1.0")]
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Recognos Romania")] [assembly: AssemblyProduct("Recognos Core Libraries")] [assembly: AssemblyCopyright("Copyright © Recognos Romania 2014")] [assembly: AssemblyTrademark("Recognos Core Libraries")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")]
mit
C#
0ebdf90dfa9d4ed99b6df992844fe16a85beaf33
Move methods below ctor
smoogipoo/osu,EVAST9919/osu,johnneijzen/osu,UselessToucan/osu,johnneijzen/osu,ppy/osu,ppy/osu,peppy/osu-new,smoogipooo/osu,2yangk23/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,NeoAdonis/osu,NeoAdonis/osu,2yangk23/osu,UselessToucan/osu,peppy/osu,peppy/osu,smoogipoo/osu
osu.Game.Tests/WaveformTestBeatmap.cs
osu.Game.Tests/WaveformTestBeatmap.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using System.Linq; using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Video; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Formats; using osu.Game.IO; using osu.Game.IO.Archives; using osu.Game.Tests.Resources; namespace osu.Game.Tests { /// <summary> /// A <see cref="WorkingBeatmap"/> that is used for test scenes that include waveforms. /// </summary> public class WaveformTestBeatmap : WorkingBeatmap { private readonly ITrackStore trackStore; public WaveformTestBeatmap(AudioManager audioManager) : base(new BeatmapInfo(), audioManager) { trackStore = audioManager.GetTrackStore(getZipReader()); } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); trackStore?.Dispose(); } private Stream getStream() => TestResources.GetTestBeatmapStream(); private ZipArchiveReader getZipReader() => new ZipArchiveReader(getStream()); protected override IBeatmap GetBeatmap() => createTestBeatmap(); protected override Texture GetBackground() => null; protected override VideoSprite GetVideo() => null; protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(firstAudioFile)); protected override Track GetTrack() => trackStore.Get(firstAudioFile); private string firstAudioFile { get { using (var reader = getZipReader()) return reader.Filenames.First(f => f.EndsWith(".mp3")); } } private Beatmap createTestBeatmap() { using (var reader = getZipReader()) { using (var beatmapStream = reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu")))) using (var beatmapReader = new LineBufferedReader(beatmapStream)) return Decoder.GetDecoder<Beatmap>(beatmapReader).Decode(beatmapReader); } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using System.Linq; using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Video; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Formats; using osu.Game.IO; using osu.Game.IO.Archives; using osu.Game.Tests.Resources; namespace osu.Game.Tests { /// <summary> /// A <see cref="WorkingBeatmap"/> that is used for test scenes that include waveforms. /// </summary> public class WaveformTestBeatmap : WorkingBeatmap { private readonly ITrackStore trackStore; private Stream getStream() => TestResources.GetTestBeatmapStream(); private ZipArchiveReader getZipReader() => new ZipArchiveReader(getStream()); public WaveformTestBeatmap(AudioManager audioManager) : base(new BeatmapInfo(), audioManager) { trackStore = audioManager.GetTrackStore(getZipReader()); } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); trackStore?.Dispose(); } protected override IBeatmap GetBeatmap() => createTestBeatmap(); protected override Texture GetBackground() => null; protected override VideoSprite GetVideo() => null; protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(firstAudioFile)); protected override Track GetTrack() => trackStore.Get(firstAudioFile); private string firstAudioFile { get { using (var reader = getZipReader()) return reader.Filenames.First(f => f.EndsWith(".mp3")); } } private Beatmap createTestBeatmap() { using (var reader = getZipReader()) { using (var beatmapStream = reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu")))) using (var beatmapReader = new LineBufferedReader(beatmapStream)) return Decoder.GetDecoder<Beatmap>(beatmapReader).Decode(beatmapReader); } } } }
mit
C#
e7f87e713aa41976fcdd8f6aa6b97ee5751030df
Add some tests for Tuple3dc class.
Xevle/Tests
Tests.Xevle.Math/Tuples/Tuple3dcTests.cs
Tests.Xevle.Math/Tuples/Tuple3dcTests.cs
using NUnit.Framework; using System; using Xevle.Math.Tuples; namespace Tests.Xevle.Math { [TestFixture()] public class Test { [Test()] public void TestConstructor() { // Prepare test Tuple3dc tuple = new Tuple3dc(1, 2, 3); // Execute test Assert.AreEqual(1, tuple.x); Assert.AreEqual(2, tuple.y); Assert.AreEqual(3, tuple.z); } #region Test operators #region Unary operators [Test()] public void TestUnaryOperatorPlus() { // Prepare test Tuple3dc tuple = new Tuple3dc(1, 2, 3); tuple = +tuple; // Execute test Assert.AreEqual(1, tuple.x); Assert.AreEqual(2, tuple.y); Assert.AreEqual(3, tuple.z); } [Test()] public void TestUnaryOperatorMinus() { // Prepare test Tuple3dc tuple = new Tuple3dc(1, 2, 3); tuple = -tuple; // Execute test Assert.AreEqual(-1, tuple.x); Assert.AreEqual(-2, tuple.y); Assert.AreEqual(-3, tuple.z); } [Test()] public void TestUnaryOperatorMagnitude() { // Prepare test Tuple3dc tuple = new Tuple3dc(1, 2, 3); double magnitude = !tuple; double diff = System.Math.Abs(3.74165738677394 - magnitude); // Execute test if (diff > 0.01) { Assert.Fail(); } } [Test()] public void TestUnaryOperatorNormalize() { // Prepare test Tuple3dc tuple = new Tuple3dc(1, 2, 3); Tuple3dc normalizedTuple = ~tuple; double diffX = System.Math.Abs(0.267261241912424 - normalizedTuple.x); double diffY = System.Math.Abs(0.534522483824849 - normalizedTuple.y); double diffZ = System.Math.Abs(0.801783725737273 - normalizedTuple.z); // Execute test if (diffX > 0.01) Assert.Fail(); if (diffY > 0.01) Assert.Fail(); if (diffZ > 0.01) Assert.Fail(); } #endregion #endregion } }
using NUnit.Framework; using System; using Xevle.Math.Tuples; namespace Tests.Xevle.Math { [TestFixture ()] public class Test { [Test ()] public void TestConstructor () { Tuple3dc tuple = new Tuple3dc (1, 2, 3); Assert.AreEqual (1, tuple.x); Assert.AreEqual (2, tuple.y); Assert.AreEqual (3, tuple.z); } } }
mit
C#
49502ab46e824fec1ff6dc9b631da1a4ac72e815
Tweak login page
mattgwagner/alert-roster
alert-roster.web/Views/Home/Login.cshtml
alert-roster.web/Views/Home/Login.cshtml
@{ ViewBag.Title = "Login"; } @using (Html.BeginForm("Login", "Home", FormMethod.Post)) { @Html.AntiForgeryToken() <div class="form-horizontal"> <h4>Password</h4> <div class="form-group"> <div class="col-md-4"> @Html.Password("password") </div> </div> <div class="form-group"> <div class="col-md-4"> <input type="submit" value="Login" class="btn btn-default" /> </div> </div> </div> }
@{ ViewBag.Title = "Login"; } <h2>@ViewBag.Title</h2> @using (Html.BeginForm("Login", "Home", FormMethod.Post)) { @Html.AntiForgeryToken() <div class="form-horizontal"> <h4>Password</h4> <hr /> @Html.ValidationSummary(true) <div class="form-group"> <div class="col-md-10"> @Html.Password("password") </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Login" class="btn btn-default" /> </div> </div> </div> }
mit
C#
2acbd21f71c77453f0a049ad6e5debfa16838543
add static references to SQLite
mdavid626/artemis
src/Artemis.Data/CarAdvertDbContext.cs
src/Artemis.Data/CarAdvertDbContext.cs
using Artemis.Common; using System; using System.Collections.Generic; using System.Data.Common; using System.Data.Entity; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Artemis.Data { internal class CarAdvertDbContext : DbContext { public CarAdvertDbContext() : base("SqlConnectionString") { } public CarAdvertDbContext(DbConnection connection, bool contextOwnsConnection) : base(connection, contextOwnsConnection) { } static CarAdvertDbContext() { var type = typeof(System.Data.Entity.SqlServer.SqlProviderServices); if (type == null) throw new Exception("Do not remove, ensures static reference to System.Data.Entity.SqlServer"); type = typeof(System.Data.SQLite.SQLiteContext); if (type == null) throw new Exception("Do not remove, ensures static reference to SQLite"); type = typeof(System.Data.SQLite.EF6.SQLiteProviderFactory); if (type == null) throw new Exception("Do not remove, ensures static reference to SQLite"); type = typeof(System.Data.SQLite.Linq.SQLiteProviderFactory); if (type == null) throw new Exception("Do not remove, ensures static reference to SQLite"); } public DbSet<CarAdvert> CarAdverts { get; set; } } }
using Artemis.Common; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Artemis.Data { internal class CarAdvertDbContext : DbContext { public DbSet<CarAdvert> CarAdverts { get; set; } } }
mit
C#
239304dc6c072ccf7b4cd9981d34ec99383f4c46
upgrade enode version to 2.6.2
Aaron-Liu/enode,tangxuehua/enode
src/ENode/Properties/AssemblyInfo.cs
src/ENode/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("ENode")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ENode")] [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("bdf470ac-90a3-47cf-9032-a3f7a298a688")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.6.2")] [assembly: AssemblyFileVersion("2.6.2")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ENode")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ENode")] [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("bdf470ac-90a3-47cf-9032-a3f7a298a688")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.6.1")] [assembly: AssemblyFileVersion("2.6.1")]
mit
C#
1216057dda848422bddef3b8503717d82eca4a5f
Update AssemblyInfo.cs
heinrichelsigan/TwitterTestLogon
AssemblyInfo.cs
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("TwitterTestLogon")] [assembly: AssemblyDescription("Twitter Test Logon Windows Form")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("area23.at")] [assembly: AssemblyProduct("TwitterTestLogon")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("c3c66330-e64a-461a-a9ab-59f9d5df965e")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("TwitterTestLogon")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TwitterTestLogon")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("c3c66330-e64a-461a-a9ab-59f9d5df965e")] // 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")]
apache-2.0
C#
5b0c66cb7bc82905ac1b1391586ff5e6bfa5dcee
Update seed method
wagoid/easy-vet,wagoid/easy-vet,wagoid/easy-vet
server/EasyVet/Migrations/Configuration.cs
server/EasyVet/Migrations/Configuration.cs
namespace EasyVet.Migrations { using DAO; using Models; using System; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; internal sealed class Configuration : DbMigrationsConfiguration<EasyVet.DAO.VetContext> { public Configuration() { AutomaticMigrationsEnabled = false; } protected override void Seed(VetContext context) { if (context.Addresses.ToList().Count == 0) { var address = new Address() { StreetName = "Rua dos bobos", Municipality = "Belo Horizonte", Neighbourhood = "Mantiqueira", State = "Minas Gerais", Number = 0, StreetType = "Rua", ZipCode = "31655-155" }; context.Addresses.Add(address); var veterinary = new Veterinary() { Address = address, BirthDate = DateTime.Now, Cpf = "11769446656", Name = "Wago admin", Password = "fAYqnJi3eB1hWhYxGChFLqo7+dhvkgBdGJPoEMWd+xI=", PhoneNumber = "666", Salary = 11575.58m, Specialty = "Nenhuma", Type = Enumerations.UserType.Veterinary}; context.Veterinaries.Add(veterinary); } // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // } } }
namespace EasyVet.Migrations { using DAO; using Models; using System; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; internal sealed class Configuration : DbMigrationsConfiguration<EasyVet.DAO.VetContext> { public Configuration() { AutomaticMigrationsEnabled = false; } protected override void Seed(VetContext context) { if (context.Addresses.ToList().Count == 0) { var address = new Address() { StreetName = "Rua dos bobos", Municipality = "Belo Horizonte", Neighbourhood = "Mantiqueira", State = "Minas Gerais", Number = 0, StreetType = "Rua", ZipCode = "31655-155" }; context.Addresses.Add(address); var veterinary = new Veterinary() { Address = address, BirthDate = DateTime.Now, Cpf = "11769446656", Name = "Wago admin", Password = "fAYqnJi3eB1hWhYxGChFLqo7+dhvkgBdGJPoEMWd+xI=", PhoneNumber = "666", Salary = 11575.58m, Specialty = "Nenhuma" }; context.Veterinaries.Add(veterinary); } // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // } } }
mit
C#
fffc895129b07be1761ebe3d9ca64deeea6f1d14
simplify previous commit
WreckedAvent/slimCat,AerysBat/slimCat
slimCat/Commands/Channel/OpenLogCommand.cs
slimCat/Commands/Channel/OpenLogCommand.cs
#region Copyright // -------------------------------------------------------------------------------------------------------------------- // <copyright file="OpenLogCommand.cs"> // Copyright (c) 2013, Justin Kadrovach, All rights reserved. // // This source is subject to the Simplified BSD License. // Please see the License.txt file for more information. // All other rights reserved. // // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // </copyright> // -------------------------------------------------------------------------------------------------------------------- #endregion namespace slimCat.Services { #region Usings using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms.VisualStyles; using Models; using Utilities; #endregion public partial class UserCommandService { private void OnOpenLogRequested(IDictionary<string, object> command) { logger.OpenLog(false, model.CurrentChannel.Title, model.CurrentChannel.Id); } private void OnOpenLogFolderRequested(IDictionary<string, object> command) { if (command.ContainsKey(Constants.Arguments.Channel)) { var toOpen = command.Get(Constants.Arguments.Channel); if (string.IsNullOrWhiteSpace(toOpen)) return; var match = model.AllChannels.FirstByIdOrNull(toOpen); if (match != null) logger.OpenLog(true, match.Title, match.Id); else logger.OpenLog(true, toOpen, toOpen); } else logger.OpenLog(true, model.CurrentChannel.Title, model.CurrentChannel.Id); } } }
#region Copyright // -------------------------------------------------------------------------------------------------------------------- // <copyright file="OpenLogCommand.cs"> // Copyright (c) 2013, Justin Kadrovach, All rights reserved. // // This source is subject to the Simplified BSD License. // Please see the License.txt file for more information. // All other rights reserved. // // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // </copyright> // -------------------------------------------------------------------------------------------------------------------- #endregion namespace slimCat.Services { #region Usings using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms.VisualStyles; using Models; using Utilities; #endregion public partial class UserCommandService { private void OnOpenLogRequested(IDictionary<string, object> command) { logger.OpenLog(false, model.CurrentChannel.Title, model.CurrentChannel.Id); } private void OnOpenLogFolderRequested(IDictionary<string, object> command) { if (command.ContainsKey(Constants.Arguments.Channel)) { var toOpen = command.Get(Constants.Arguments.Channel); if (string.IsNullOrWhiteSpace(toOpen)) return; var match = model.AllChannels.FirstByIdOrNull(toOpen) ?? (ChannelModel) model.CurrentPms.FirstByIdOrNull(toOpen); if (match != null) logger.OpenLog(true, match.Title, match.Id); else logger.OpenLog(true, toOpen, toOpen); } else logger.OpenLog(true, model.CurrentChannel.Title, model.CurrentChannel.Id); } } }
bsd-2-clause
C#
456564b26ce10f9802af036a82f0cab49f9d726a
fix context redirect
Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek
Tweek.ApiService.NetCore/Security/TweekLegacy.cs
Tweek.ApiService.NetCore/Security/TweekLegacy.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; using Tweek.ApiService.Addons; using System.Security.Claims; using Microsoft.AspNetCore.Rewrite; namespace Tweek.ApiService.NetCore.Security { public class TweekLegacySupport : ITweekAddon { public void Install(IApplicationBuilder builder, IConfiguration configuration) { builder.UseRewriter(new RewriteOptions().AddRewrite("^configurations/([^?]+)[?]?(.*)", "v1/keys/$1?$tweeklegacy=tweeklegacy&$ignoreKeyTypes=true&$2", true)); builder.UseRewriter(new RewriteOptions().AddRewrite("^context/([^?]+)[?]?(.*)", "v1/context/$1?$tweeklegacy=tweeklegacy&$2", true)); builder.Use(next => (ctx) => { if (ctx.Request.Query.ContainsKey("$tweeklegacy")) { ctx.User.AddIdentity(new ClaimsIdentity(new[] { new Claim("iss", "TweekLegacy") })); } return next(ctx); } ); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; using Tweek.ApiService.Addons; using System.Security.Claims; using Microsoft.AspNetCore.Rewrite; namespace Tweek.ApiService.NetCore.Security { public class TweekLegacySupport : ITweekAddon { public void Install(IApplicationBuilder builder, IConfiguration configuration) { builder.UseRewriter(new RewriteOptions().AddRewrite("configurations/([^?]+)[?]?(.*)", "v1/keys/$1?$tweeklegacy=tweeklegacy&$ignoreKeyTypes=true&$2", true)); builder.UseRewriter(new RewriteOptions().AddRewrite("context/([^?]+)[?]?(.*)", "v1/context/$1?$tweeklegacy=tweeklegacy&$2", true)); builder.Use(next => (ctx) => { if (ctx.Request.Query.ContainsKey("$tweeklegacy")) { ctx.User.AddIdentity(new ClaimsIdentity(new[] { new Claim("iss", "TweekLegacy") })); } return next(ctx); } ); } } }
mit
C#
34468a3f53b6af41089f0ae0c68724a8aa43a5e7
Update feedback command
bcanseco/magnanibot
src/Magnanibot.Discord/Modules/Feedback.cs
src/Magnanibot.Discord/Modules/Feedback.cs
using System; using System.Threading.Tasks; using CommonBotLibrary.Services; using Discord; using Discord.Commands; using Magnanibot.Exceptions; using Magnanibot.Extensions; namespace Magnanibot.Modules { [Group(nameof(Feedback)), Alias("idea", "suggestion", "bug")] [Summary("Allows submitting bot feedback. Thank you!")] [RequireContext(ContextType.Guild)] public class Feedback : Module { private Feedback(GithubService service) => Service = service; private GithubService Service { get; } [Command, Summary("Reports a [bug] or a submits a [suggestion].")] [Remarks("Example: !feedback suggestion Add a command that does my homework")] private async Task PostAsync(FeedbackType type, [Remainder] string comment) { var title = comment.Truncate(55); var body = $"**Server:** {Context.Guild.Name}" + $"\n**Channel:** {Context.Channel.Name}" + $"\n**User:** {Context.User}" + $"\n\n**Message:**\n{comment}" + $"\n\n`Filed on {DateTime.Now} using Discord.NET {DiscordConfig.Version}.`"; var labels = new[] {type.ToString()}; var isSuccess = await Service.CreateIssueAsync(title, body, labels); // Positive feedback to be delivered via webhook if (!isSuccess) throw new BotException("Couldn't process feedback, please try again later."); } public enum FeedbackType { Suggestion, Bug } } }
using System; using System.Threading.Tasks; using CommonBotLibrary.Services; using Discord; using Discord.Commands; using Magnanibot.Exceptions; using Magnanibot.Extensions; namespace Magnanibot.Modules { [Group(nameof(Feedback)), Alias("idea", "suggestion", "bug")] [Summary("Creates a GitHub issue with your feedback. Thank you!")] [Remarks("Example: !feedback Add more commands plz")] [RequireContext(ContextType.Guild)] public class Feedback : Module { private Feedback(GithubService service) => Service = service; private GithubService Service { get; } [Command] private async Task PostAsync([Remainder] string comment) { var title = comment.Truncate(55); var body = $"**Server:** {Context.Guild.Name}" + $"\n**Channel:** {Context.Channel.Name}" + $"\n**User:** {Context.User}" + $"\n\n**Message:**\n{comment}" + $"\n\n`Filed on {DateTime.Now} using Discord.NET {DiscordConfig.Version}.`"; var labels = new[] {"feedback"}; var isSuccess = await Service.CreateIssueAsync(title, body, labels); // Positive feedback to be delivered via webhook if (!isSuccess) throw new BotException("Couldn't process feedback, please try again later."); } } }
mit
C#
cbde5ba9820eac6671d9b703fb921345e97a88a3
Disable store generated properties for the Ids.
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/MusicStore/Models/MusicStoreContext.cs
src/MusicStore/Models/MusicStoreContext.cs
using System; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.SqlServer; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Metadata; using Microsoft.Framework.OptionsModel; namespace MusicStore.Models { public class ApplicationUser : IdentityUser { } public class MusicStoreContext : IdentityDbContext<ApplicationUser> { public MusicStoreContext(IServiceProvider serviceProvider, IOptionsAccessor<MusicStoreDbContextOptions> optionsAccessor) : base(serviceProvider, optionsAccessor.Options) { } public DbSet<Album> Albums { get; set; } public DbSet<Artist> Artists { get; set; } public DbSet<Order> Orders { get; set; } public DbSet<Genre> Genres { get; set; } public DbSet<CartItem> CartItems { get; set; } public DbSet<OrderDetail> OrderDetails { get; set; } protected override void OnModelCreating(ModelBuilder builder) { builder.Entity<Album>().Key(a => a.AlbumId); builder.Entity<Artist>().Key(a => a.ArtistId); builder.Entity<Order>().Key(o => o.OrderId); builder.Entity<Genre>().Key(g => g.GenreId); builder.Entity<CartItem>().Key(c => c.CartItemId); builder.Entity<OrderDetail>().Key(o => o.OrderDetailId); // TODO: Remove this when we start using auto generated values builder.Entity<Album>().Property(a => a.AlbumId).GenerateValuesOnAdd(generateValues: false); builder.Entity<Artist>().Property(a => a.ArtistId).GenerateValuesOnAdd(generateValues: false); builder.Entity<Order>().Property(o => o.OrderId).GenerateValuesOnAdd(generateValues: false); builder.Entity<Genre>().Property(g => g.GenreId).GenerateValuesOnAdd(generateValues: false); builder.Entity<CartItem>().Property(c => c.CartItemId).GenerateValuesOnAdd(generateValues: false); builder.Entity<OrderDetail>().Property(o => o.OrderDetailId).GenerateValuesOnAdd(generateValues: false); base.OnModelCreating(builder); } } public class MusicStoreDbContextOptions : DbContextOptions { public string DefaultAdminUserName { get; set; } public string DefaultAdminPassword { get; set; } } }
using System; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.SqlServer; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Metadata; using Microsoft.Framework.OptionsModel; namespace MusicStore.Models { public class ApplicationUser : IdentityUser { } public class MusicStoreContext : IdentityDbContext<ApplicationUser> { public MusicStoreContext(IServiceProvider serviceProvider, IOptionsAccessor<MusicStoreDbContextOptions> optionsAccessor) : base(serviceProvider, optionsAccessor.Options) { } public DbSet<Album> Albums { get; set; } public DbSet<Artist> Artists { get; set; } public DbSet<Order> Orders { get; set; } public DbSet<Genre> Genres { get; set; } public DbSet<CartItem> CartItems { get; set; } public DbSet<OrderDetail> OrderDetails { get; set; } protected override void OnModelCreating(ModelBuilder builder) { builder.Entity<Album>().Key(a => a.AlbumId); builder.Entity<Artist>().Key(a => a.ArtistId); builder.Entity<Order>().Key(o => o.OrderId); builder.Entity<Genre>().Key(g => g.GenreId); builder.Entity<CartItem>().Key(c => c.CartItemId); builder.Entity<OrderDetail>().Key(o => o.OrderDetailId); base.OnModelCreating(builder); } } public class MusicStoreDbContextOptions : DbContextOptions { public string DefaultAdminUserName { get; set; } public string DefaultAdminPassword { get; set; } } }
apache-2.0
C#
cce4a41c5d97e2aec83e6e1095424b3cd3a13e3b
Add "disabled" common string
smoogipoo/osu,ppy/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,peppy/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu
osu.Game/Localisation/CommonStrings.cs
osu.Game/Localisation/CommonStrings.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Localisation; namespace osu.Game.Localisation { public static class CommonStrings { private const string prefix = @"osu.Game.Resources.Localisation.Common"; /// <summary> /// "Cancel" /// </summary> public static LocalisableString Cancel => new TranslatableString(getKey(@"cancel"), @"Cancel"); /// <summary> /// "Clear" /// </summary> public static LocalisableString Clear => new TranslatableString(getKey(@"clear"), @"Clear"); /// <summary> /// "Enabled" /// </summary> public static LocalisableString Enabled => new TranslatableString(getKey(@"enabled"), @"Enabled"); /// <summary> /// "Disabled" /// </summary> public static LocalisableString Disabled => new TranslatableString(getKey(@"disabled"), @"Disabled"); /// <summary> /// "Default" /// </summary> public static LocalisableString Default => new TranslatableString(getKey(@"default"), @"Default"); /// <summary> /// "Width" /// </summary> public static LocalisableString Width => new TranslatableString(getKey(@"width"), @"Width"); /// <summary> /// "Height" /// </summary> public static LocalisableString Height => new TranslatableString(getKey(@"height"), @"Height"); /// <summary> /// "Downloading..." /// </summary> public static LocalisableString Downloading => new TranslatableString(getKey(@"downloading"), @"Downloading..."); /// <summary> /// "Importing..." /// </summary> public static LocalisableString Importing => new TranslatableString(getKey(@"importing"), @"Importing..."); private static string getKey(string key) => $@"{prefix}:{key}"; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Localisation; namespace osu.Game.Localisation { public static class CommonStrings { private const string prefix = @"osu.Game.Resources.Localisation.Common"; /// <summary> /// "Cancel" /// </summary> public static LocalisableString Cancel => new TranslatableString(getKey(@"cancel"), @"Cancel"); /// <summary> /// "Clear" /// </summary> public static LocalisableString Clear => new TranslatableString(getKey(@"clear"), @"Clear"); /// <summary> /// "Enabled" /// </summary> public static LocalisableString Enabled => new TranslatableString(getKey(@"enabled"), @"Enabled"); /// <summary> /// "Default" /// </summary> public static LocalisableString Default => new TranslatableString(getKey(@"default"), @"Default"); /// <summary> /// "Width" /// </summary> public static LocalisableString Width => new TranslatableString(getKey(@"width"), @"Width"); /// <summary> /// "Height" /// </summary> public static LocalisableString Height => new TranslatableString(getKey(@"height"), @"Height"); /// <summary> /// "Downloading..." /// </summary> public static LocalisableString Downloading => new TranslatableString(getKey(@"downloading"), @"Downloading..."); /// <summary> /// "Importing..." /// </summary> public static LocalisableString Importing => new TranslatableString(getKey(@"importing"), @"Importing..."); private static string getKey(string key) => $@"{prefix}:{key}"; } }
mit
C#
4961ba3e703ccbde635b650fbb5ee8b381d346ec
Test Scan being lazy
guygervais/morelinq,florinbrasov/morelinq,gayancc/morelinq,Prince2690/morelinq,smurfpandey/morelinq,amyhickman/morelinq,KalebDark/morelinq,joeeisel/morelinq,soraismus/morelinq,csuffyy/morelinq,Prince2690/morelinq,whut/morelinq,hardborn/morelinq,ApocalypticOctopus/morelinq,faithword/morelinq,ventis07/morelinq,ayseff/morelinq,atknatk/morelinq,RandallFlagg/morelinq,pavelhodek/morelinq,dee-donny/morelinq,amyhickman/morelinq,ruanzx/morelinq,amithegde/morelinq,jello-chen/morelinq,MeiChunLo/morelinq,arumata/morelinq,ayseff/morelinq,dee-donny/morelinq,swcook1310/morelinq,pinakimukherjee/morelinq,atknatk/morelinq,soraismus/morelinq,smurfpandey/morelinq,evilz/morelinq,jello-chen/morelinq,montoyaaguirre/morelinq,ddonny/morelinq,blyzer/morelinq,amithegde/morelinq,hardborn/morelinq,pavelhodek/morelinq,CADbloke/morelinq,tsjDEV/morelinq,usmanm77/morelinq,whut/morelinq,cliftonm/morelinq,faithword/morelinq,ApocalypticOctopus/morelinq,realzhaorong/morelinq,scriptnull/morelinq,kenwilcox/morelinq,scriptnull/morelinq,mzahor/morelinq,ShengboZhang/morelinq,Jeff-Lewis/morelinq,mzahor/morelinq,swcook1310/morelinq,ApocalypticOctopus/morelinq,xingh/morelinq,xingh/morelinq,sochdj/morelinq,tsjDEV/morelinq,pinakimukherjee/morelinq,dee-donny/morelinq,meh-uk/morelinq,smurfpandey/morelinq,cliftonm/morelinq,ddonny/morelinq,sochdj/morelinq,kenwilcox/morelinq,Jeff-Lewis/morelinq,s1495k043/morelinq,s1495k043/morelinq,guygervais/morelinq,DuZorn/morelinq,arumata/morelinq,joeeisel/morelinq,ShengboZhang/morelinq,ddonny/morelinq,meh-uk/morelinq,xingh/morelinq,gayancc/morelinq,realzhaorong/morelinq,sochdj/morelinq,xalid77/morelinq,blyzer/morelinq,csuffyy/morelinq,bitbonk/morelinq,ruanzx/morelinq,xalid77/morelinq,bitbonk/morelinq,MeiChunLo/morelinq,evilz/morelinq,CADbloke/morelinq,florinbrasov/morelinq,zalid/morelinq,subzer0092/morelinq,zalid/morelinq,KalebDark/morelinq,ventis07/morelinq,DuZorn/morelinq,amithegde/morelinq,usmanm77/morelinq,subzer0092/morelinq,RandallFlagg/morelinq,jma2400/morelinq,evilz/morelinq,jma2400/morelinq,montoyaaguirre/morelinq
MoreLinq.Test/ScanTest.cs
MoreLinq.Test/ScanTest.cs
#region License and Terms // MoreLINQ - Extensions to LINQ to Objects // Copyright (c) 2008 Jonathan Skeet. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using System; using System.Linq; using NUnit.Framework; namespace MoreLinq.Test { [TestFixture] public class ScanTest { [Test] [ExpectedException(typeof(InvalidOperationException))] public void ScanEmpty() { (new int[] { }).Scan(SampleData.Plus).Count(); } [Test] public void ScanSum() { var result = SampleData.Values.Scan(SampleData.Plus); var gold = SampleData.Values.PreScan(SampleData.Plus, 0).Zip(SampleData.Values, SampleData.Plus); result.AssertSequenceEqual(gold); } [Test] public void ScanIsLazy() { new BreakingSequence<object>().Scan<object>(delegate { throw new NotImplementedException(); }); } } }
#region License and Terms // MoreLINQ - Extensions to LINQ to Objects // Copyright (c) 2008 Jonathan Skeet. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using System; using System.Linq; using NUnit.Framework; namespace MoreLinq.Test { [TestFixture] public class ScanTest { [Test] [ExpectedException(typeof(InvalidOperationException))] public void ScanEmpty() { (new int[] { }).Scan(SampleData.Plus).Count(); } [Test] public void ScanSum() { var result = SampleData.Values.Scan(SampleData.Plus); var gold = SampleData.Values.PreScan(SampleData.Plus, 0).Zip(SampleData.Values, SampleData.Plus); result.AssertSequenceEqual(gold); } } }
apache-2.0
C#
2d5a134a702b18a2432e3492881349ddb9c5b700
Change comments header
Minesweeper-6-Team-Project-Telerik/Minesweeper-6
src2/WpfMinesweeper/Models/ImageFactory.cs
src2/WpfMinesweeper/Models/ImageFactory.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="ImageFactory.cs" company="Telerik Academy"> // Teamwork Project "Minesweeper-6" // </copyright> // <summary> // The image factory // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace WpfMinesweeper.Models { using System; using System.Drawing; using System.Windows; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Imaging; public static class ImageFactory { /// <summary> /// Creates an image, ready to be used in the WPF view. /// </summary> /// <param name="imgResource">The resource of the image.</param> /// <returns></returns> public static ImageBrush CreateImage(Bitmap imgResource) { var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap( imgResource.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); return new ImageBrush(bitmapSource); } } }
namespace WpfMinesweeper.Models { using System; using System.Drawing; using System.Windows; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Imaging; public static class ImageFactory { /// <summary> /// Creates an image, ready to be used in the WPF view. /// </summary> /// <param name="imgResource">The resource of the image.</param> /// <returns></returns> public static ImageBrush CreateImage(Bitmap imgResource) { var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap( imgResource.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); return new ImageBrush(bitmapSource); } } }
mit
C#
144b8ce141ff748f736f8b05972a5c6d6c3cfdd7
Fix failing test
mvno/Okanshi,mvno/Okanshi,mvno/Okanshi
tests/Okanshi.Tests/PeakRateCounterTest.cs
tests/Okanshi.Tests/PeakRateCounterTest.cs
using System; using FluentAssertions; using Xunit; namespace Okanshi.Test { public class PeakRateCounterTest { private readonly PeakRateCounter counter; private readonly ManualClock manualClock = new ManualClock(); public PeakRateCounterTest() { counter = new PeakRateCounter(MonitorConfig.Build("Test"), TimeSpan.FromMilliseconds(500), manualClock); } [Fact] public void Initial_peak_rate_is_zero() { var value = counter.GetValue(); value.Should().Be(0); } [Theory] [InlineData(1)] [InlineData(10)] [InlineData(110)] public void Incrementing_value_updates_peak_rate_after_interval(int amount) { counter.Increment(amount); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.GetValue().Should().Be(amount); } [Fact] public void Peak_rate_is_reset_when_crossing_interval_again_and_polling_multiple_times() { counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.GetValue(); manualClock.Advance(TimeSpan.FromMilliseconds(600)); var value = counter.GetValue(); value.Should().Be(0); } [Fact] public void Peak_rate_is_per_defined_step() { counter.Increment(); counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(700)); counter.GetValue().Should().Be(2); } [Fact] public void Peak_rate_is_updated_correctly_by_interval() { counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.GetValue().Should().Be(1); } [Fact] public void Incrementing_with_negative_numbers_does_not_change_the_value() { counter.Increment(); counter.Increment(-1); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.GetValue().Should().Be(1); } [Fact] public void Incrementing_with_negative_numbers_and_then_with_a_positive_does_not_change_the_value() { counter.Increment(); counter.Increment(-1); counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.GetValue().Should().Be(1); } } }
using System; using FluentAssertions; using Xunit; namespace Okanshi.Test { public class PeakRateCounterTest { private readonly PeakRateCounter counter; private readonly ManualClock manualClock = new ManualClock(); public PeakRateCounterTest() { counter = new PeakRateCounter(MonitorConfig.Build("Test"), TimeSpan.FromMilliseconds(500), manualClock); } [Fact] public void Initial_peak_rate_is_zero() { var value = counter.GetValue(); value.Should().Be(0); } [Theory] [InlineData(1)] [InlineData(10)] [InlineData(110)] public void Incrementing_value_updates_peak_rate_after_interval(int amount) { counter.Increment(amount); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.GetValue().Should().Be(amount); } [Fact] public void Peak_rate_is_reset_when_crossing_interval_again_and_polling_multiple_times() { counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.GetValue(); manualClock.Advance(TimeSpan.FromMilliseconds(600)); var value = counter.GetValue(); value.Should().Be(0); } [Fact] public void Peak_rate_is_per_defined_step() { counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(100)); counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(700)); counter.GetValue().Should().Be(2); } [Fact] public void Peak_rate_is_updated_correctly_by_interval() { counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.GetValue().Should().Be(1); } [Fact] public void Incrementing_with_negative_numbers_does_not_change_the_value() { counter.Increment(); counter.Increment(-1); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.GetValue().Should().Be(1); } [Fact] public void Incrementing_with_negative_numbers_and_then_with_a_positive_does_not_change_the_value() { counter.Increment(); counter.Increment(-1); counter.Increment(); manualClock.Advance(TimeSpan.FromMilliseconds(600)); counter.GetValue().Should().Be(1); } } }
mit
C#
274ef14f1047c644d2e981e8ebe43c75d4422bd2
Bump version to 0.2.2.
ejball/XmlDocMarkdown
SolutionInfo.cs
SolutionInfo.cs
using System.Reflection; [assembly: AssemblyVersion("0.2.2.0")] [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright 2017 Ed Ball")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
using System.Reflection; [assembly: AssemblyVersion("0.2.1.0")] [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright 2017 Ed Ball")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
mit
C#
24176ba1024f103b89c84ba1c0aca8823647a3c9
Replace the BELL character before writing to the console.
gnieuwhof/httpforwarder
ForwarderConsole/Print.cs
ForwarderConsole/Print.cs
namespace ForwarderConsole { using System; using System.Text; public static class Print { public static void Error(string error) { InternalPrint("--- ERROR --", error, ConsoleColor.Red); } public static void Request(byte[] bytes) { string request = Encoding.ASCII.GetString(bytes); InternalPrint("--- REQUEST ---", request, ConsoleColor.White); } public static void Response(byte[] bytes) { string response = Encoding.ASCII.GetString(bytes); InternalPrint("--- RESPONSE ---", response, ConsoleColor.Yellow); } public static void Color(string message, ConsoleColor color) { Console.ForegroundColor = color; // Replace the BELL character. message = message.Replace('\a', 'B'); Console.WriteLine(message); } private static void InternalPrint(string header, string message, ConsoleColor color) { string txt = Line(header) + Line() + Line(message) + Line("=================================================="); Print.Color(txt, color); } private static string Line(string txt = "") { return txt + Environment.NewLine; } } }
namespace ForwarderConsole { using System; using System.Text; public static class Print { public static void Error(string error) { InternalPrint("--- ERROR --", error, ConsoleColor.Red); } public static void Request(byte[] bytes) { string request = Encoding.ASCII.GetString(bytes); InternalPrint("--- REQUEST ---", request, ConsoleColor.White); } public static void Response(byte[] bytes) { string response = Encoding.ASCII.GetString(bytes); InternalPrint("--- RESPONSE ---", response, ConsoleColor.Yellow); } public static void Color(string message, ConsoleColor color) { Console.ForegroundColor = color; Console.WriteLine(message); } private static void InternalPrint(string header, string message, ConsoleColor color) { string txt = Line(header) + Line() + Line(message) + Line("=================================================="); Print.Color(txt, color); } private static string Line(string txt = "") { return txt + Environment.NewLine; } } }
mit
C#
9f8f9cc9d6d55e411e7eb43915f41cf9e036e2fc
make ParamT accessible and separate virtual methods from public methods
pragmatrix/Konstruktor2
Konstruktor2/Activator.cs
Konstruktor2/Activator.cs
using System; using System.Diagnostics; using Konstruktor2.Detail; namespace Konstruktor2 { public class Activator<ParamT, ResultT> : IDisposable where ResultT : class { readonly Func<ParamT, Owned<ResultT>> _generator; Owned<ResultT> _generated_; ParamT _param; public ParamT Param { get { Debug.Assert(IsActive); return _param; } } public ResultT Instance_ { get { return IsActive ? _generated_.Value : null; } } public bool IsActive { get { return _generated_ != null; } } public Activator(Func<ParamT, Owned<ResultT>> generator) { _generator = generator; } public void Dispose() { if (IsActive) deactivate(); } public void activate(ParamT param) { if (IsActive) deactivate(); _param = param; _generated_ = _generator(param); activated(param); Activated.raise(param); } public void deactivate() { if (_generated_ == null) return; Deactivating.raise(); deactivating(); _generated_.Dispose(); _generated_ = null; _param = default(ParamT); } protected virtual void activated(ParamT param) { } protected virtual void deactivating() { } public event Action<ParamT> Activated; public event Action Deactivating; } }
using System; using System.Diagnostics; namespace Konstruktor2 { public class Activator<ParamT, ResultT> : IDisposable where ResultT : class { readonly Func<ParamT, Owned<ResultT>> _generator; Owned<ResultT> _generated_; public ResultT Instance_ { get { return IsActive ? _generated_.Value : null; } } public bool IsActive { get { return _generated_ != null; } } public Activator(Func<ParamT, Owned<ResultT>> generator) { _generator = generator; } public void Dispose() { if (IsActive) deactivate(); } public virtual void activate(ParamT param) { if (IsActive) deactivate(); _generated_ = _generator(param); } public virtual void deactivate() { Debug.Assert(_generated_ != null); _generated_.Dispose(); _generated_ = null; } } }
bsd-3-clause
C#
a116876e17c2fcc020f20020ec6de83d3bf1cac4
Add Color
EasyPeasyLemonSqueezy/MadCat
MadCat/NutEngine/Scene.cs
MadCat/NutEngine/Scene.cs
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Content; using NutEngine.Camera; namespace NutEngine { public abstract class Scene { protected Application App { get; } protected ContentManager Content { get; } protected SpriteBatch Batcher { get; } protected Node World { get; set; } protected Camera2D Camera { get; set; } protected Color Color { get; set; } public Scene(Application app) { App = app; Batcher = app.Batcher; Content = app.Content; World = new Node(); Camera = new OrthographicSRTCamera(new Vector2(App.ScreenWidth, App.ScreenHeight)); Color = Color.Black; } /// <summary> /// Update current game state. /// You should realize it in every your scene. /// </summary> public abstract void Update(float deltaTime); /// <summary> /// Draw the scene. /// Execute <see cref="Node.Visit(SpriteBatch, Matrix2D)"/> /// on each node, start from root node - <see cref="World"/>. /// </summary> public void Draw() { /// Fill background with black color. App.GraphicsDevice.Clear(Color); Batcher.Begin(); var transform = Camera.Transform; World.Visit(Batcher, transform); Batcher.End(); } } }
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Content; using NutEngine.Camera; namespace NutEngine { public abstract class Scene { protected Application App { get; } protected ContentManager Content { get; } protected SpriteBatch Batcher { get; } protected Node World { get; set; } protected Camera2D Camera { get; set; } public Scene(Application app) { App = app; Batcher = app.Batcher; Content = app.Content; World = new Node(); Camera = new OrthographicSRTCamera(new Vector2(App.ScreenWidth, App.ScreenHeight)); } /// <summary> /// Update current game state. /// You should realize it in every your scene. /// </summary> public abstract void Update(float deltaTime); /// <summary> /// Draw the scene. /// Execute <see cref="Node.Visit(SpriteBatch, Matrix2D)"/> /// on each node, start from root node - <see cref="World"/>. /// </summary> public void Draw() { /// Fill background with black color. App.GraphicsDevice.Clear(Color.Black); Batcher.Begin(); var transform = Camera.Transform; World.Visit(Batcher, transform); Batcher.End(); } } }
mit
C#
edb771c4a95dce984ddb05d109a1f7d9343c867c
Update ReadLineTests
tsolarin/readline,tsolarin/readline
test/ReadLine.Tests/ReadLineTests.cs
test/ReadLine.Tests/ReadLineTests.cs
using System; using System.Linq; using Xunit; using static System.ReadLine; namespace ReadLine.Tests { public class ReadLineTests : IDisposable { public ReadLineTests() { string[] history = new string[] { "ls -a", "dotnet run", "git init" }; AddHistory(history); } [Fact] public void TestNoInitialHistory() { Assert.Equal(3, GetHistory().Count); } [Fact] public void TestUpdatesHistory() { AddHistory("mkdir"); Assert.Equal(4, GetHistory().Count); Assert.Equal("mkdir", GetHistory().Last()); } [Fact] public void TestGetCorrectHistory() { Assert.Equal("ls -a", GetHistory()[0]); Assert.Equal("dotnet run", GetHistory()[1]); Assert.Equal("git init", GetHistory()[2]); } public void Dispose() { // If all above tests pass // clear history works ClearHistory(); } } }
using System; using System.Linq; using Xunit; namespace Tests { public class Tests : IDisposable { public Tests() { string[] history = new string[] { "ls -a", "dotnet run", "git init" }; ReadLine.AddHistory(history); } [Fact] public void TestNoInitialHistory() { Assert.Equal(3, ReadLine.GetHistory().Count); } [Fact] public void TestUpdatesHistory() { ReadLine.AddHistory("mkdir"); Assert.Equal(4, ReadLine.GetHistory().Count); } [Fact] public void TestGetCorrectHistory() { var history = ReadLine.GetHistory(); Assert.Equal(3, history.Count); Assert.Equal("git init", history.Last()); } public void Dispose() { // If all above tests pass // clear history works ReadLine.ClearHistory(); } } }
mit
C#
026f76d838bdf557448469d34719042cb2ef388a
Update App.xaml.cs
fanoI/Cosmos,MetSystem/Cosmos,jp2masa/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,tgiphil/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,MyvarHD/Cosmos,zdimension/Cosmos,sgetaz/Cosmos,zhangwenquan/Cosmos,zdimension/Cosmos,fanoI/Cosmos,Cyber4/Cosmos,MetSystem/Cosmos,sgetaz/Cosmos,MetSystem/Cosmos,MyvarHD/Cosmos,CosmosOS/Cosmos,Cyber4/Cosmos,trivalik/Cosmos,Cyber4/Cosmos,MyvarHD/Cosmos,zhangwenquan/Cosmos,zhangwenquan/Cosmos,MyvarHD/Cosmos,tgiphil/Cosmos,trivalik/Cosmos,jp2masa/Cosmos,Cyber4/Cosmos,tgiphil/Cosmos,fanoI/Cosmos,sgetaz/Cosmos,zdimension/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,MetSystem/Cosmos,MetSystem/Cosmos,MyvarHD/Cosmos,zhangwenquan/Cosmos,sgetaz/Cosmos,jp2masa/Cosmos,Cyber4/Cosmos,trivalik/Cosmos,sgetaz/Cosmos,zdimension/Cosmos,zarlo/Cosmos,zhangwenquan/Cosmos,zdimension/Cosmos
source/Cosmos.Build.Builder/App.xaml.cs
source/Cosmos.Build.Builder/App.xaml.cs
using System.Linq; using System.Windows; using Cosmos.Build.Installer; namespace Cosmos.Build.Builder { public partial class App : Application { public static bool DoNotLaunchVS; public static bool IsUserKit; public static bool ResetHive; public static bool StayOpen; public static bool UseTask; public static bool NoMsBuildClean; public static bool InstallTask; public static bool IgnoreVS; public static bool TestMode = false; public static bool HasParams = false; /// <summary> /// Version of Visual Studio to use. /// </summary> public static VsVersion VsVersion; /// <summary> /// Use Visual Studio Experimental Hive for installing Cosmos Kit. /// </summary> public static bool UseVsHive; protected override void OnStartup(StartupEventArgs e) { HasParams = e.Args.Length > 0; var xArgs = new string[e.Args.Length]; for (int i = 0; i < xArgs.Length; i++) { xArgs[i] = e.Args[i].ToUpper(); } IsUserKit = xArgs.Contains("-USERKIT"); ResetHive = xArgs.Contains("-RESETHIVE"); StayOpen = xArgs.Contains("-STAYOPEN"); UseTask = !xArgs.Contains("-NOTASK"); NoMsBuildClean = xArgs.Contains("-NOCLEAN"); InstallTask = xArgs.Contains("-INSTALLTASK"); DoNotLaunchVS = xArgs.Contains("-NOVSLAUNCH"); // For use during dev of Builder only. IgnoreVS = xArgs.Contains("-IGNOREVS"); TestMode = xArgs.Contains("-TESTMODE"); if (xArgs.Contains("-VS2015") || xArgs.Contains("/VS2015")) { VsVersion = VsVersion.Vs2015; Paths.VsVersion = VsVersion.Vs2015; } if (xArgs.Contains("-VSEXPHIVE") || xArgs.Contains("/VSEXPHIVE")) { UseVsHive = true; } base.OnStartup(e); } } }
using System.Linq; using System.Windows; using Cosmos.Build.Installer; namespace Cosmos.Build.Builder { public partial class App : Application { public static bool DoNotLaunchVS; public static bool IsUserKit; public static bool ResetHive; public static bool StayOpen; public static bool UseTask; public static bool NoMsBuildClean; public static bool InstallTask; public static bool IgnoreVS; public static bool TestMode = false; public static bool HasParams = false; /// <summary> /// Version of Visual Studio to use. /// </summary> public static VsVersion VsVersion; /// <summary> /// Use Visual Studio Experimental Hive for installing Cosmos Kit. /// </summary> public static bool UseVsHive; protected override void OnStartup(StartupEventArgs e) { HasParams = e.Args.Length > 0; var xArgs = new string[e.Args.Length]; for (int i = 0; i < xArgs.Length; i++) { xArgs[i] = e.Args[i].ToUpper(); } IsUserKit = xArgs.Contains("-USERKIT"); ResetHive = xArgs.Contains("-RESETHIVE"); StayOpen = xArgs.Contains("-STAYOPEN"); UseTask = !xArgs.Contains("-NOTASK"); NoMsBuildClean = xArgs.Contains("-NOCLEAN"); InstallTask = xArgs.Contains("-INSTALLTASK"); DoNotLaunchVS = xArgs.Contains("-NOVSLAUNCH"); // For use during dev of Builder only. IgnoreVS = xArgs.Contains("-IGNOREVS"); TestMode = xArgs.Contains("-TESTMODE"); if (xArgs.Contains("-VS2015") || xArgs.Contains("/VS2015")) { VsVersion = VsVersion.Vs2015; Paths.VsVersion = VsVersion.Vs2015; } if (xArgs.Contains("-VS2013") || xArgs.Contains("/VS2013")) { VsVersion = VsVersion.Vs2013; Paths.VsVersion = VsVersion.Vs2013; } if (xArgs.Contains("-VSEXPHIVE") || xArgs.Contains("/VSEXPHIVE")) { UseVsHive = true; } base.OnStartup(e); } } }
bsd-3-clause
C#
3c2f64963b77f6a1780925411ba0b1eb844c6a92
Fix test runs that are launched from Test Explorer in debug mode
GitTools/GitLink,ShaiNahum/GitLink,AArnott/PdbGit
src/GitLink.Tests/ProjectHelperFacts.cs
src/GitLink.Tests/ProjectHelperFacts.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="ProjectHelperFacts.cs" company="CatenaLogic"> // Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace GitLink.Tests { using System.IO; using System.Linq; using System.Reflection; using NUnit.Framework; [TestFixture] public class ProjectHelperFacts { private static readonly string SolutionFile = Path.Combine( Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"TestSolution\TestSolution.sln"); [Test] public void GettingProjectsFromSolution() { Assert.AreEqual(3, ProjectHelper.GetProjects(SolutionFile, Configuration.Debug, Platform.AnyCpu).Count()); } [Test] public void GettingProjectsFromSolution_SkipsProjectNotSelectedForPlatform() { var projects = ProjectHelper.GetProjects(SolutionFile, Configuration.Debug, Platform.x64).ToList(); Assert.AreEqual(2, projects.Count); Assert.False(projects.Any(c => c.GetProjectName() == "BuiltInAnyCpuOnly")); } [Test] public void GettingProjectsFromSolution_SkipsProjectNotSelectedForConfiguration() { var projects = ProjectHelper.GetProjects(SolutionFile, Configuration.Release, Platform.AnyCpu).ToList(); Assert.AreEqual(2, projects.Count); Assert.False(projects.Any(c => c.GetProjectName() == "BuiltInDebugOnly")); } [Test] public void GettingProjectsFromSolution_SkipsProjectNotSelectedForEitherConfigurationOrPlatform() { var project = ProjectHelper.GetProjects(SolutionFile, Configuration.Release, Platform.x64).Single(); Assert.AreEqual("BuiltAlways", project.GetProjectName()); } private static class Configuration { public const string Debug = "Debug"; public const string Release = "Release"; } private static class Platform { public const string AnyCpu = "Any CPU"; public const string x64 = "x64"; } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="ProjectHelperFacts.cs" company="CatenaLogic"> // Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace GitLink.Tests { using System.Linq; using NUnit.Framework; [TestFixture] public class ProjectHelperFacts { private const string SolutionFile = @"TestSolution\TestSolution.sln"; [Test] public void GettingProjectsFromSolution() { Assert.AreEqual(3, ProjectHelper.GetProjects(SolutionFile, Configuration.Debug, Platform.AnyCpu).Count()); } [Test] public void GettingProjectsFromSolution_SkipsProjectNotSelectedForPlatform() { var projects = ProjectHelper.GetProjects(SolutionFile, Configuration.Debug, Platform.x64).ToList(); Assert.AreEqual(2, projects.Count); Assert.False(projects.Any(c => c.GetProjectName() == "BuiltInAnyCpuOnly")); } [Test] public void GettingProjectsFromSolution_SkipsProjectNotSelectedForConfiguration() { var projects = ProjectHelper.GetProjects(SolutionFile, Configuration.Release, Platform.AnyCpu).ToList(); Assert.AreEqual(2, projects.Count); Assert.False(projects.Any(c => c.GetProjectName() == "BuiltInDebugOnly")); } [Test] public void GettingProjectsFromSolution_SkipsProjectNotSelectedForEitherConfigurationOrPlatform() { var project = ProjectHelper.GetProjects(SolutionFile, Configuration.Release, Platform.x64).Single(); Assert.AreEqual("BuiltAlways", project.GetProjectName()); } private static class Configuration { public const string Debug = "Debug"; public const string Release = "Release"; } private static class Platform { public const string AnyCpu = "Any CPU"; public const string x64 = "x64"; } } }
mit
C#
265913be662436886380735bf87ae4923212dc61
Add Bigsby Trovalds was here
Bigsby/NetCore,Bigsby/NetCore,Bigsby/NetCore
consoleApp/Program.cs
consoleApp/Program.cs
using System; namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("Hello World, I was created by my father, Bigsby, in an unidentified evironment!"); Console.WriteLine("Bigsby Gates was here!"); Console.WriteLine("Bigsby Trovalds was here!"); } } }
using System; namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("Hello World, I was created by my father, Bigsby, in an unidentified evironment!"); Console.WriteLine("Bigsby Gates was here!"); } } }
apache-2.0
C#
5b84c90286f839efb44a89954353c657ed57ddbb
Fix documentation warning.
googol/NuGet.Lucene,Stift/NuGet.Lucene,themotleyfool/NuGet.Lucene
source/NuGet.Lucene/IFastZipPackage.cs
source/NuGet.Lucene/IFastZipPackage.cs
using System; using System.IO; namespace NuGet.Lucene { /// <summary> /// An extension of <see cref="IPackage"/> that /// can stream package contents reusing a single /// stream without loading the entire package into /// memory or using any temp files. /// </summary> /// <remarks> /// <para> /// Implementations are <b>not</b> thread-safe. /// </para> /// <para> /// <see cref="IDisposable.Dispose"/> must be invoked /// after any streams are accessed either via <see cref="GetZipEntryStream"/> /// or via <see cref="IPackageFile.GetStream"/>. /// </para> /// </remarks> public interface IFastZipPackage : IPackage, IDisposable { string GetFileLocation(); Stream GetZipEntryStream(string path); } }
using System; using System.IO; namespace NuGet.Lucene { /// <summary> /// An extension of <see cref="IPackage"/> that /// can stream package contents reusing a single /// stream without loading the entire package into /// memory or using any temp files. /// </summary> /// <remarks> /// <para> /// Implementations are <b>not</b> thread-safe. /// </para> /// <para> /// <see cref="IFastZipPackage.Dispose"/> must be invoked /// after any streams are accessed either via <see cref="GetZipEntryStream"/> /// or via <see cref="IPackageFile.GetStream"/>. /// </para> /// </remarks> public interface IFastZipPackage : IPackage, IDisposable { string GetFileLocation(); Stream GetZipEntryStream(string path); } }
apache-2.0
C#
7c24765bfceab6259963210e6d9295c71a197d4d
add failing test
jquintus/TeamCitySpike
AmazingApp/AmazingTests/ProgramTests.cs
AmazingApp/AmazingTests/ProgramTests.cs
using AmazingApp; using NUnit.Framework; namespace AmazingTests { [TestFixture] public class ProgramTests { [Test] public void Msg_IsHelloWorld() { Assert.AreEqual("Hello World", Program.Msg); } [Test] public void Pass() { Assert.Pass(); } [Test] public void Fail() { Assert.Fail(); } } }
using AmazingApp; using NUnit.Framework; namespace AmazingTests { [TestFixture] public class ProgramTests { [Test] public void Msg_IsHelloWorld() { Assert.AreEqual("Hello World", Program.Msg); } [Test] public void Pass() { Assert.Pass(); } } }
mit
C#
21b6832e46c3042a31e5e2ac12744a007b5137ea
Add volume and pitch mults to AudioAutoScale
Barleytree/NitoriWare,NitorInc/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare
Assets/Scripts/Audio/AudioAutoAdjust.cs
Assets/Scripts/Audio/AudioAutoAdjust.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; //Automatically adjusts pitch od all audiosources in gameobject, and its children if specified public class AudioAutoAdjust : MonoBehaviour { [SerializeField] private bool includeChildren, tieToTimescale = true, tieToVolumeSettings = true; [SerializeField] private bool preserveInitialPitch; [SerializeField] private bool updateEachFrame = true; [SerializeField] private PrefsHelper.VolumeType volumeType = PrefsHelper.VolumeType.SFX; [Range(0f, 1f)] [SerializeField] private float volumeMult = 1f; [SerializeField] [Range(0f, 1f)] private float pitchMult = 1f; private AudioSource[] sources; private float[] initialVolumes; private float[] initialPitches; private float instanceTimeScale, instanceVolumeSetting; void Awake() { sources = includeChildren ? GetComponentsInChildren<AudioSource>() : GetComponents<AudioSource>(); if (tieToVolumeSettings) { initialVolumes = new float[sources.Length]; for (int i = 0; i < sources.Length; i++) { initialVolumes[i] = sources[i].volume; } updateVolume(); } if (tieToTimescale) { initialPitches = new float[sources.Length]; for (int i = 0; i < sources.Length; i++) { initialPitches[i] = sources[i].pitch; } updatePitch(); } } void Update() { if (updateEachFrame) { if (tieToTimescale && Time.timeScale != instanceTimeScale) updatePitch(); if (tieToVolumeSettings && PrefsHelper.getVolume(volumeType) != instanceVolumeSetting) updateVolume(); } } public void updateVolume() { for (int i = 0; i < sources.Length; i++) { sources[i].volume = initialVolumes[i] * PrefsHelper.getVolume(volumeType) * volumeMult; } instanceVolumeSetting = PrefsHelper.getVolume(volumeType); } public void updatePitch() { for (int i = 0; i < sources.Length; i++) { sources[i].pitch = Time.timeScale * pitchMult; if (preserveInitialPitch) sources[i].pitch *= initialPitches[i]; } instanceTimeScale = Time.timeScale; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; //Automatically adjusts pitch od all audiosources in gameobject, and its children if specified public class AudioAutoAdjust : MonoBehaviour { [SerializeField] private bool includeChildren, tieToTimescale = true, tieToVolumeSettings = true; [SerializeField] private bool preserveInitialPitch; [SerializeField] private bool updateEachFrame = true; [SerializeField] private PrefsHelper.VolumeType volumeType = PrefsHelper.VolumeType.SFX; private AudioSource[] sources; private float[] initialVolumes; private float[] initialPitches; private float instanceTimeScale, instanceVolumeSetting; void Awake() { sources = includeChildren ? GetComponentsInChildren<AudioSource>() : GetComponents<AudioSource>(); if (tieToVolumeSettings) { initialVolumes = new float[sources.Length]; for (int i = 0; i < sources.Length; i++) { initialVolumes[i] = sources[i].volume; } updateVolume(); } if (tieToTimescale) { initialPitches = new float[sources.Length]; for (int i = 0; i < sources.Length; i++) { initialPitches[i] = sources[i].pitch; } updatePitch(); } } void Update() { if (updateEachFrame) { if (tieToTimescale && Time.timeScale != instanceTimeScale) updatePitch(); if (tieToVolumeSettings && PrefsHelper.getVolume(volumeType) != instanceVolumeSetting) updateVolume(); } } public void updateVolume() { for (int i = 0; i < sources.Length; i++) { sources[i].volume = initialVolumes[i] * PrefsHelper.getVolume(volumeType); } instanceVolumeSetting = PrefsHelper.getVolume(volumeType); } public void updatePitch() { for (int i = 0; i < sources.Length; i++) { sources[i].pitch = Time.timeScale; if (preserveInitialPitch) sources[i].pitch *= initialPitches[i]; } instanceTimeScale = Time.timeScale; } }
mit
C#
aea7263ffad571df4684057b565969755c7febb1
Use the AppData instead of the CommonAppData folder to save the profile and settings, to avoid the UAC.
vebin/CloudNotes,vebin/CloudNotes,daxnet/CloudNotes,daxnet/CloudNotes,daxnet/CloudNotes,vebin/CloudNotes
CloudNotes.DesktopClient/Directories.cs
CloudNotes.DesktopClient/Directories.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Mime; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CloudNotes.DesktopClient { public static class Directories { private const string CloudNotesDataFolder = "CloudNotes"; public static string GetFullName(string fileOrDir) { #if DEBUG return Path.Combine(Application.StartupPath, fileOrDir); #else var path = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), CloudNotesDataFolder); return Path.Combine(path, fileOrDir); #endif } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Mime; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CloudNotes.DesktopClient { public static class Directories { private const string CloudNotesDataFolder = "CloudNotes"; public static string GetFullName(string fileOrDir) { #if DEBUG return Path.Combine(Application.StartupPath, fileOrDir); #else var path = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), CloudNotesDataFolder); return Path.Combine(path, fileOrDir); #endif } } }
apache-2.0
C#
5948455dd54d68be75885d7e0f653710ba5933b0
Implement ManagerCollection.this[string name] access
tainicom/Aether
Source/Engine/Data/ManagerCollection.cs
Source/Engine/Data/ManagerCollection.cs
#region License // Copyright 2015 Kastellanos Nikolaos // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using System.Collections.ObjectModel; using tainicom.Aether.Elementary.Managers; namespace tainicom.Aether.Engine.Data { public partial class ManagerCollection : Collection<IAetherManager> { private AetherEngine _engine; public ManagerCollection(AetherEngine engine) { this._engine = engine; } public IAetherManager this[string name] { get { for (int i = 0; i < this.Count; i++) { if (this[i].Name == name) return this[i]; } return null; } } protected override void InsertItem(int index, IAetherManager item) { // check if manager allready in use. var itemType = item.GetType(); foreach (var manager in this) { if (manager.GetType().Equals(itemType)) throw new AetherException(string.Format("Manager of type {0} allready in use.", itemType.Name)); } base.InsertItem(index, item); } } }
#region License // Copyright 2015 Kastellanos Nikolaos // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using System.Collections.ObjectModel; using tainicom.Aether.Elementary.Managers; namespace tainicom.Aether.Engine.Data { public partial class ManagerCollection : Collection<IAetherManager> { private AetherEngine _engine; public ManagerCollection(AetherEngine engine) { this._engine = engine; } protected override void InsertItem(int index, IAetherManager item) { // check if manager allready in use. var itemType = item.GetType(); foreach (var manager in this) { if (manager.GetType().Equals(itemType)) throw new AetherException(string.Format("Manager of type {0} allready in use.", itemType.Name)); } base.InsertItem(index, item); } } }
apache-2.0
C#
b5b36ee09ed405e7bb259cde341dd6ba9e293775
Update AttributeContainsElement.cs
thelgevold/xpathitup
XPathFinder/AttributeContainsElement.cs
XPathFinder/AttributeContainsElement.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace XPathItUp { internal class AttributeContainsElement : Base, IAttributeContains { internal static IAttributeContains Create(List<string> expressionParts, string value, int currentAttributeIndex,bool appliesToParent) { return new AttributeContainsElement(expressionParts, value, currentAttributeIndex,appliesToParent); } private AttributeContainsElement(List<string> expressionParts, string value, int currentAttributeIndex,bool appliesToParent) { this.AppliesToParent = appliesToParent; this.ExpressionParts = expressionParts; this.attributeIndex = currentAttributeIndex; string attributeString = this.ExpressionParts[this.attributeIndex]; this.ExpressionParts[this.attributeIndex] = string.Format(attributeString, "contains(", "'" + value + "')"); } public IAndElement And { get { return AndElement.Create(this.ExpressionParts, this.tagIndex, this.attributeIndex + 1,this.AppliesToParent); } } } }
/* Copyright (C) 2010 Torgeir Helgevold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace XPathItUp { internal class AttributeContainsElement : Base, IAttributeContains { internal static IAttributeContains Create(List<string> expressionParts, string value, int currentAttributeIndex,bool appliesToParent) { return new AttributeContainsElement(expressionParts, value, currentAttributeIndex,appliesToParent); } private AttributeContainsElement(List<string> expressionParts, string value, int currentAttributeIndex,bool appliesToParent) { this.AppliesToParent = appliesToParent; this.ExpressionParts = expressionParts; this.attributeIndex = currentAttributeIndex; string attributeString = this.ExpressionParts[this.attributeIndex]; this.ExpressionParts[this.attributeIndex] = string.Format(attributeString, "contains(", "'" + value + "')"); } public IAndElement And { get { return AndElement.Create(this.ExpressionParts, this.tagIndex, this.attributeIndex + 1,this.AppliesToParent); } } } }
mit
C#
ea7f574388b724ac271fe73678b98e66a29f394c
Add credits field to microgame traits
NitorInc/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare,Barleytree/NitoriWare
Assets/Scripts/Microgame/MicrogameTraits.cs
Assets/Scripts/Microgame/MicrogameTraits.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; public class MicrogameTraits : MonoBehaviour { #pragma warning disable 0649 [SerializeField] private ControlScheme _controlScheme; public virtual ControlScheme controlScheme { get { return _controlScheme; } set { } } [SerializeField] private bool _hideCursor; public virtual bool hideCursor { get { return _hideCursor; } set { } } [SerializeField] private Duration _duration; public virtual Duration duration { get { return _duration; } set { } } [SerializeField] private bool _canEndEarly; public virtual bool canEndEarly { get { return _canEndEarly; } set { } } [SerializeField] private string _command; public virtual string command { get { return _command; } set { } } public virtual string localizedCommand { get { return TextHelper.getLocalizedText("microgame." + microgameId + ".command", command); } set { } } [SerializeField] private bool _defaultVictory; public virtual bool defaultVictory { get { return _defaultVictory; } set { } } [SerializeField] private float _victoryVoiceDelay, _failureVoiceDelay; public virtual float victoryVoiceDelay { get { return _victoryVoiceDelay; } set { } } public virtual float failureVoiceDelay { get { return _failureVoiceDelay; } set { } } [SerializeField] private AudioClip _musicClip; public virtual AudioClip musicClip{ get { return _musicClip; } set { } } [SerializeField] private bool _isStageReady; public virtual bool isStageReady { get { return _isStageReady; } set { } } [SerializeField] private string[] _credits; public virtual string[] credits { get { return _credits; } set { } } #pragma warning restore 0649 private string _microgameId; public string microgameId { get { return _microgameId; } set { } } public enum ControlScheme { Key, Mouse } public enum Duration { Short8Beats, Long16Beats } public virtual void onAccessInStage(string microgameId) { this._microgameId = microgameId; } public virtual float getDurationInBeats() { return duration == Duration.Long16Beats ? 16f : 8f; } public static MicrogameTraits findMicrogameTraits(string microgameId, int difficulty, bool skipFinishedFolder = false) { GameObject traits; if (!skipFinishedFolder) { traits = Resources.Load<GameObject>("Microgames/_Finished/" + microgameId + "/Traits" + difficulty.ToString()); if (traits != null) return traits.GetComponent<MicrogameTraits>(); } traits = Resources.Load<GameObject>("Microgames/" + microgameId + "/Traits" + difficulty.ToString()); if (traits != null) return traits.GetComponent<MicrogameTraits>(); traits = Resources.Load<GameObject>("Microgames/_Bosses/" + microgameId + "/Traits" + difficulty.ToString()); if (traits != null) return traits.GetComponent<MicrogameTraits>(); Debug.LogError("Can't find Traits prefab for " + microgameId + difficulty.ToString()); return null; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; public class MicrogameTraits : MonoBehaviour { #pragma warning disable 0649 [SerializeField] private ControlScheme _controlScheme; public virtual ControlScheme controlScheme { get { return _controlScheme; } set { } } [SerializeField] private bool _hideCursor; public virtual bool hideCursor { get { return _hideCursor; } set { } } [SerializeField] private Duration _duration; public virtual Duration duration { get { return _duration; } set { } } [SerializeField] private bool _canEndEarly; public virtual bool canEndEarly { get { return _canEndEarly; } set { } } [SerializeField] private string _command; public virtual string command { get { return _command; } set { } } public virtual string localizedCommand { get { return TextHelper.getLocalizedText("microgame." + microgameId + ".command", command); } set { } } [SerializeField] private bool _defaultVictory; public virtual bool defaultVictory { get { return _defaultVictory; } set { } } [SerializeField] private float _victoryVoiceDelay, _failureVoiceDelay; public virtual float victoryVoiceDelay { get { return _victoryVoiceDelay; } set { } } public virtual float failureVoiceDelay { get { return _failureVoiceDelay; } set { } } [SerializeField] private AudioClip _musicClip; public virtual AudioClip musicClip{ get { return _musicClip; } set { } } [SerializeField] private bool _isStageReady; public virtual bool isStageReady { get { return _isStageReady; } set { } } #pragma warning restore 0649 private string _microgameId; public string microgameId { get { return _microgameId; } set { } } public enum ControlScheme { Key, Mouse } public enum Duration { Short8Beats, Long16Beats } public virtual void onAccessInStage(string microgameId) { this._microgameId = microgameId; } public virtual float getDurationInBeats() { return duration == Duration.Long16Beats ? 16f : 8f; } public static MicrogameTraits findMicrogameTraits(string microgameId, int difficulty, bool skipFinishedFolder = false) { GameObject traits; if (!skipFinishedFolder) { traits = Resources.Load<GameObject>("Microgames/_Finished/" + microgameId + "/Traits" + difficulty.ToString()); if (traits != null) return traits.GetComponent<MicrogameTraits>(); } traits = Resources.Load<GameObject>("Microgames/" + microgameId + "/Traits" + difficulty.ToString()); if (traits != null) return traits.GetComponent<MicrogameTraits>(); traits = Resources.Load<GameObject>("Microgames/_Bosses/" + microgameId + "/Traits" + difficulty.ToString()); if (traits != null) return traits.GetComponent<MicrogameTraits>(); Debug.LogError("Can't find Traits prefab for " + microgameId + difficulty.ToString()); return null; } }
mit
C#
ef28ff53b928aff0088edca811f35cb7b231e383
Clean up old BoundObject code
quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot,sqt/cactbot
BrowserControl.xaml.cs
BrowserControl.xaml.cs
using CefSharp.Wpf; using System.Windows.Controls; namespace Cactbot { public partial class BrowserControl : UserControl { public BrowserControl() { DataContext = this; InitializeComponent(); CreationHandlers = delegate {}; } public delegate void OnBrowserCreation(object sender, IWpfWebBrowser browser); public OnBrowserCreation CreationHandlers { get; set; } private IWpfWebBrowser webBrowser; public IWpfWebBrowser WebBrowser { get { return webBrowser; } set { if (webBrowser == value) return; webBrowser = value; if (webBrowser != null) CreationHandlers(this, webBrowser); } } } }
using CefSharp.Wpf; using System.Windows.Controls; namespace Cactbot { public partial class BrowserControl : UserControl { public BrowserControl() { DataContext = this; InitializeComponent(); CreationHandlers = delegate {}; } public delegate void OnBrowserCreation(object sender, IWpfWebBrowser browser); public OnBrowserCreation CreationHandlers { get; set; } public class BoundObject { public string MyProperty { get; set; } } private IWpfWebBrowser webBrowser; public IWpfWebBrowser WebBrowser { get { return webBrowser; } set { if (value != null) value.RegisterJsObject("bound", new BoundObject()); if (webBrowser == value) return; webBrowser = value; if (webBrowser != null) CreationHandlers(this, webBrowser); } } } }
apache-2.0
C#
2e1cf96c8dd936e668885282478c28d14e436bad
add error handling
conekta/conekta-.net
conekta/Base/Requestor.cs
conekta/Base/Requestor.cs
using System; using System.IO; using System.Net; using System.Text; using Newtonsoft.Json; namespace conekta { public class Requestor { public Requestor () { } public String request (String method, String resource_uri, String data = "{}") { try { HttpWebRequest http = (HttpWebRequest)WebRequest.Create(conekta.Api.baseUri + resource_uri); http.Accept = "application/vnd.conekta-v" + conekta.Api.version + "+json"; http.UserAgent = "Conekta/v1 DotNetBindings/Conekta::" + conekta.Api.version; http.Method = method; var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(conekta.Api.apiKey); http.Headers.Add("Authorization", "Basic " + System.Convert.ToBase64String(plainTextBytes) + ":"); http.Headers.Add ("Accept-Language", conekta.Api.locale); if (method == "POST" || method == "PUT") { var dataBytes = Encoding.ASCII.GetBytes(data); http.ContentLength = dataBytes.Length; http.ContentType = "application/json"; Stream dataStream = http.GetRequestStream (); dataStream.Write (dataBytes, 0, dataBytes.Length); } WebResponse response = http.GetResponse (); var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); return responseString; } catch (WebException webExcp) { WebExceptionStatus status = webExcp.Status; if (status == WebExceptionStatus.ProtocolError) { HttpWebResponse httpResponse = (HttpWebResponse)webExcp.Response; var encoding = ASCIIEncoding.ASCII; using (var reader = new System.IO.StreamReader(httpResponse.GetResponseStream(), encoding)) { string responseText = reader.ReadToEnd(); throw new Exception ("Conekta API Implementation Error (" + (int)httpResponse.StatusCode + " - " + httpResponse.StatusCode + ") :: " + responseText); } } return ""; } catch (Exception e) { System.Console.WriteLine (e.ToString ()); return ""; } } } }
using System; using System.IO; using System.Net; using System.Text; using Newtonsoft.Json; namespace conekta { public class Requestor { public Requestor () { } public String request (String method, String resource_uri, String data = "{}") { HttpWebRequest http = (HttpWebRequest)WebRequest.Create(conekta.Api.baseUri + resource_uri); http.Accept = "application/vnd.conekta-v" + conekta.Api.version + "+json"; http.UserAgent = "Conekta/v1 DotNetBindings/Conekta::" + conekta.Api.version; http.Method = method; var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(conekta.Api.apiKey); http.Headers.Add("Authorization", "Basic " + System.Convert.ToBase64String(plainTextBytes) + ":"); http.Headers.Add ("Accept-Language", conekta.Api.locale); if (method == "POST" || method == "PUT") { var dataBytes = Encoding.ASCII.GetBytes(data); http.ContentLength = dataBytes.Length; http.ContentType = "application/json"; Stream dataStream = http.GetRequestStream (); dataStream.Write (dataBytes, 0, dataBytes.Length); } WebResponse response = http.GetResponse (); var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); return responseString; } } }
mit
C#
9ddf4bf9e10941a948cb7db11ee0091724ac56a3
Update AssemblyInfo.cs
NimaAra/Easy.Logger,NimaAra/EasyLogger
EasyLogger/Properties/AssemblyInfo.cs
EasyLogger/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("EasyLogger")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("EasyLogger.Tests.Unit")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("EasyLogger")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: NeutralResourcesLanguage("en-GB")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("EasyLogger.Tests.Unit")]
mit
C#
3c11e8542dafc0778a7b7dc933cb9d5e46d786b5
remove controller name from main route
annaked/ExpressEntryCalculator,annaked/ExpressEntryCalculator,annaked/ExpressEntryCalculator
ExpressEntryCalculator.Web/Startup.cs
ExpressEntryCalculator.Web/Startup.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace ExpressEntryCalculator.Web { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{action}", defaults: new { controller = "Home", action = "Index" }); }); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace ExpressEntryCalculator.Web { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } } }
mit
C#
91b4d5cc5dc7faad1937686b7d107a350a23c22f
Update BuildTool Deploy
WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework
Framework.BuildTool/Command/Deploy.cs
Framework.BuildTool/Command/Deploy.cs
using System.IO; namespace Framework.BuildTool { public class CommandDeploy : Command { public CommandDeploy() : base("deploy", "Deploy to Azure git") { this.AzureGitUrl = ArgumentAdd("azureGitUrl", "Azure Git Url"); } public readonly Argument AzureGitUrl; public override void Run() { string azureGitUrl = AzureGitUrl.Value; string folderPublish = UtilFramework.FolderName + "Server/bin/Debug/netcoreapp2.0/publish/"; // UtilBuildTool.DirectoryDelete(folderPublish); UtilFramework.Assert(!Directory.Exists(folderPublish), "Delete folder failed!"); UtilBuildTool.DotNetPublish(UtilFramework.FolderName + "Server/"); UtilFramework.Assert(Directory.Exists(folderPublish), "Publish failed!"); UtilBuildTool.Start(folderPublish, "git", "init"); UtilBuildTool.Start(folderPublish, "git", "remote add azure " + azureGitUrl); UtilBuildTool.Start(folderPublish, "git", "fetch --all"); UtilBuildTool.Start(folderPublish, "git", "add ."); UtilBuildTool.Start(folderPublish, "git", "commit -m Deploy"); UtilBuildTool.Start(folderPublish, "git", "push azure master -f --porcelain"); // Do not write to stderr. See also: https://git-scm.com/docs/git-push/2.10.0 } } }
using System.IO; namespace Framework.BuildTool { public class CommandDeploy : Command { public CommandDeploy() : base("deploy", "Deploy to Azure git") { this.AzureGitUrl = ArgumentAdd("azureGitUrl", "Azure Git Url"); } public readonly Argument AzureGitUrl; public override void Run() { string azureGitUrl = AzureGitUrl.Value; string folderPublish = UtilFramework.FolderName + "Server/bin/Debug/netcoreapp2.0/publish/"; // UtilBuildTool.DirectoryDelete(folderPublish); UtilFramework.Assert(!Directory.Exists(folderPublish), "Delete folder failed!"); UtilBuildTool.DotNetPublish(UtilFramework.FolderName + "Server/"); UtilFramework.Assert(Directory.Exists(folderPublish), "Publish failed!"); UtilBuildTool.Start(folderPublish, "git", "init"); UtilBuildTool.Start(folderPublish, "git", "remote add azure " + azureGitUrl); UtilBuildTool.Start(folderPublish, "git", "fetch --all"); UtilBuildTool.Start(folderPublish, "git", "add ."); UtilBuildTool.Start(folderPublish, "git", "commit -m Deploy"); UtilBuildTool.Start(folderPublish, "git", "push azure master -f"); } } }
mit
C#
5d0b16d0ee48b398118363a0a99166ed048b10c8
Fix NullReferenceException.
rmcardle/LazerTagHost,rmcardle/LazerTagHost
LazerTagHostLibrary/GameDefinition.cs
LazerTagHostLibrary/GameDefinition.cs
namespace LazerTagHostLibrary { public struct GameDefinition { public HostGun.CommandCode GameType { get; set; } public byte GameId { get; set; } public int GameTimeMinutes { get; set; } public int Tags { get; set; } private int _reloads; public int Reloads { get { return _reloads; } set { _reloads = value; _unlimitedReloads = (_reloads == 0xff); } } public int Shields { get; set; } private int _mega; public int Mega { get { return _mega; } set { _mega = value; UnlimitedMega = (_mega == 0xff); } } public bool ExtendedTagging { get; set; } private bool _unlimitedReloads; public bool UnlimitedReloads { get { return _unlimitedReloads; } set { _unlimitedReloads = value; if (value) { _reloads = 0xff; } else { if (_reloads == 0xff) _reloads = 99; } } } private bool _unlimitedMega; public bool UnlimitedMega { get { return _unlimitedMega; } set { _unlimitedMega = value; if (value) { _mega = 0xff; } else { if (_mega == 0xff) _mega = 99; } } } public bool TeamTags { get; set; } public bool MedicMode { get; set; } public bool RapidTags { get; set; } public bool Hunt { get; set; } public bool HuntDirection { get; set; } public bool Zones { get; set; } public bool TeamZones { get; set; } public bool NeutralizeTaggedPlayers { get; set; } public bool ZonesRevivePlayers { get; set; } public bool HospitalZones { get; set; } public bool ZonesTagPlayers { get; set; } public int TeamCount { get; set; } private char[] _name; public char[] Name { get { return _name; } set { if (value == null) { _name = null; return; } _name = new char[4]; for (var i = 0; i < 4; i++) { _name[i] = (value.Length > i) ? value[i] : ' '; } } } public int CountdownTimeSeconds { get; set; } } }
namespace LazerTagHostLibrary { public struct GameDefinition { public HostGun.CommandCode GameType { get; set; } public byte GameId { get; set; } public int GameTimeMinutes { get; set; } public int Tags { get; set; } private int _reloads; public int Reloads { get { return _reloads; } set { _reloads = value; _unlimitedReloads = (_reloads == 0xff); } } public int Shields { get; set; } private int _mega; public int Mega { get { return _mega; } set { _mega = value; UnlimitedMega = (_mega == 0xff); } } public bool ExtendedTagging { get; set; } private bool _unlimitedReloads; public bool UnlimitedReloads { get { return _unlimitedReloads; } set { _unlimitedReloads = value; if (value) { _reloads = 0xff; } else { if (_reloads == 0xff) _reloads = 99; } } } private bool _unlimitedMega; public bool UnlimitedMega { get { return _unlimitedMega; } set { _unlimitedMega = value; if (value) { _mega = 0xff; } else { if (_mega == 0xff) _mega = 99; } } } public bool TeamTags { get; set; } public bool MedicMode { get; set; } public bool RapidTags { get; set; } public bool Hunt { get; set; } public bool HuntDirection { get; set; } public bool Zones { get; set; } public bool TeamZones { get; set; } public bool NeutralizeTaggedPlayers { get; set; } public bool ZonesRevivePlayers { get; set; } public bool HospitalZones { get; set; } public bool ZonesTagPlayers { get; set; } public int TeamCount { get; set; } private char[] _name; public char[] Name { get { return _name; } set { _name = new char[4]; for (var i = 0; i < 4; i++) { _name[i] = (value.Length > i) ? value[i] : ' '; } } } public int CountdownTimeSeconds { get; set; } } }
mit
C#
8bacc2d9196caab2ad6ae443ae7a0a98f56fa074
Fix build error.
inter8ection/Obvs
Obvs.NetMQ/Properties/AssemblyInfo.cs
Obvs.NetMQ/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("Obvs.NetMQ")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Christopher Read")] [assembly: AssemblyProduct("Obvs.NetMQ")] [assembly: AssemblyCopyright("Copyright © Christopher Read 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("535bb00c-b63e-4b6f-a274-6083d57cc46b")] // 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.2.0")] [assembly: AssemblyFileVersion("1.3.2.0-rc1")]
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("Obvs.NetMQ")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Christopher Read")] [assembly: AssemblyProduct("Obvs.NetMQ")] [assembly: AssemblyCopyright("Copyright © Christopher Read 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("535bb00c-b63e-4b6f-a274-6083d57cc46b")] // 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.2.0")] [assembly: AssemblyFileVersion("1.3.2.0")]
mit
C#
0cf79d4bfd456d16071520cfa2158c20fdbc8479
Update ValuesOut.cs
EricZimmerman/RegistryPlugins
RegistryPlugin.Uninstall/ValuesOut.cs
RegistryPlugin.Uninstall/ValuesOut.cs
using System; using RegistryPluginBase.Interfaces; namespace RegistryPlugin.Uninstall { public class ValuesOut : IValueOut { public ValuesOut(string keyName, string displayName, string displayVersion, string publisher, string installDate, string installSource, string installLocation, string uninstallString, DateTimeOffset? timestamp) { KeyName = keyName; DisplayName = displayName; DisplayVersion = displayVersion; Publisher = publisher; InstallDate = installDate; InstallSource = installSource; InstallLocation = installLocation; UninstallString = uninstallString; Timestamp = timestamp; } public DateTimeOffset? Timestamp { get; } public string KeyName { get; } public string DisplayName { get; } public string DisplayVersion { get; } public string Publisher { get; } public string InstallDate { get; } public string InstallSource { get; } public string InstallLocation { get; } public string UninstallString { get; } public string BatchKeyPath { get; set; } public string BatchValueName { get; set; } public string BatchValueData1 => $"KeyName: {KeyName} DisplayName: {DisplayName} DisplayVersion: {DisplayVersion} Publisher: {Publisher} InstallDate: {InstallDate}"; public string BatchValueData2 => $"InstallSource: {InstallSource} InstallLocation: {InstallLocation} UninstallString: {UninstallString}"; public string BatchValueData3 => $"Timestamp: {Timestamp?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}"; } }
using System; using RegistryPluginBase.Interfaces; namespace RegistryPlugin.Uninstall { public class ValuesOut : IValueOut { public ValuesOut(string keyName, string displayName, string displayVersion, string publisher, string installDate, string installSource, string installLocation, string uninstallString, DateTimeOffset? timestamp) { KeyName = keyName; DisplayName = displayName; DisplayVersion = displayVersion; Publisher = publisher; InstallDate = installDate; InstallSource = installSource; InstallLocation = installLocation; UninstallString = uninstallString; Timestamp = timestamp; } public DateTimeOffset? Timestamp { get; } public string KeyName { get; } public string DisplayName { get; } public string DisplayVersion { get; } public string Publisher { get; } public string InstallDate { get; } public string InstallSource { get; } public string InstallLocation { get; } public string UninstallString { get; } public string BatchKeyPath { get; set; } public string BatchValueName { get; set; } public string BatchValueData1 => $"KeyName: {KeyName} DisplayName: {DisplayName} DisplayVersion: {DisplayVersion} Publisher: {Publisher} InstallDate: {InstallDate}"; public string BatchValueData2 => $"InstallSource: {InstallSource} InstallLocation: {InstallLocation} UninstallString: {UninstallString}"; public string BatchValueData3 => $"Timestamp: {Timestamp?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff} "; } }
mit
C#
7c3a6cb6e0d3fd04c20a0e34d4fd414dc575b3d5
Update assembly info
bcatcho/transition,bcatcho/transition
Transition/Properties/AssemblyInfo.cs
Transition/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle ("Transition")] [assembly: AssemblyDescription ("A state machine language and interpreter")] [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("")] [assembly: AssemblyProduct ("")] [assembly: AssemblyCopyright ("Brandon Catcho")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion ("0.1.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle ("Transition")] [assembly: AssemblyDescription ("")] [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("")] [assembly: AssemblyProduct ("")] [assembly: AssemblyCopyright ("bcatcho")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion ("0.1.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
mit
C#
902b8cfaf80f03c160e4bfad2aceb94cf89214de
Test shouldn't check registered peer count
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Tests/LiveServerTests.cs
WalletWasabi.Tests/LiveServerTests.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using NBitcoin; using WalletWasabi.Services; using WalletWasabi.Tests.XunitConfiguration; using WalletWasabi.WebClients.ChaumianCoinJoin; using Xunit; namespace WalletWasabi.Tests { public class LiveServerTests : IClassFixture<SharedFixture> { private readonly Dictionary<NetworkType, Uri> _networkUriMappings = new Dictionary<NetworkType, Uri> { { NetworkType.Mainnet, new Uri("http://4jsmnfcsmbrlm7l7.onion") }, { NetworkType.Testnet, new Uri("http://wtgjmaol3io5ijii.onion") } }; // Blockchain [Theory] [InlineData(NetworkType.Mainnet)] [InlineData(NetworkType.Testnet)] public async Task GetFeesAsync(NetworkType networkType) { using (var client = new WasabiClient(_networkUriMappings[networkType])) { var feeEstimationPairs = await client.GetFeesAsync(1000); Assert.True(feeEstimationPairs.NotNullAndNotEmpty()); } } [Theory] [InlineData(NetworkType.Mainnet)] [InlineData(NetworkType.Testnet)] public async Task GetFiltersAsync(NetworkType networkType) { using (var client = new WasabiClient(_networkUriMappings[networkType])) { var filterModel = IndexDownloader.GetStartingFilter(Network.GetNetwork(networkType.ToString())); var filters = await client.GetFiltersAsync(filterModel.BlockHash, 2); Assert.True(filters.NotNullAndNotEmpty()); Assert.True(filters.Count() == 2); } } [Theory] [InlineData(NetworkType.Mainnet)] [InlineData(NetworkType.Testnet)] public async Task GetAllRoundStatesAsync(NetworkType networkType) { using (var client = new SatoshiClient(_networkUriMappings[networkType])) { var states = await client.GetAllRoundStatesAsync(); Assert.True(states.NotNullAndNotEmpty()); Assert.True(states.Count() == 2); } } // Offchain [Theory] [InlineData(NetworkType.Mainnet)] [InlineData(NetworkType.Testnet)] public async Task GetExchangeRatesAsync(NetworkType networkType) { using (var client = new WasabiClient(_networkUriMappings[networkType])) { var exchangeRates = await client.GetExchangeRatesAsync(); Assert.True(exchangeRates.NotNullAndNotEmpty()); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using NBitcoin; using WalletWasabi.Services; using WalletWasabi.Tests.XunitConfiguration; using WalletWasabi.WebClients.ChaumianCoinJoin; using Xunit; namespace WalletWasabi.Tests { public class LiveServerTests : IClassFixture<SharedFixture> { private readonly Dictionary<NetworkType, Uri> _networkUriMappings = new Dictionary<NetworkType, Uri> { { NetworkType.Mainnet, new Uri("http://4jsmnfcsmbrlm7l7.onion") }, { NetworkType.Testnet, new Uri("http://wtgjmaol3io5ijii.onion") } }; // Blockchain [Theory] [InlineData(NetworkType.Mainnet)] [InlineData(NetworkType.Testnet)] public async Task GetFeesAsync(NetworkType networkType) { using (var client = new WasabiClient(_networkUriMappings[networkType])) { var feeEstimationPairs = await client.GetFeesAsync(1000); Assert.True(feeEstimationPairs.NotNullAndNotEmpty()); } } [Theory] [InlineData(NetworkType.Mainnet)] [InlineData(NetworkType.Testnet)] public async Task GetFiltersAsync(NetworkType networkType) { using (var client = new WasabiClient(_networkUriMappings[networkType])) { var filterModel = IndexDownloader.GetStartingFilter(Network.GetNetwork(networkType.ToString())); var filters = await client.GetFiltersAsync(filterModel.BlockHash, 2); Assert.True(filters.NotNullAndNotEmpty()); Assert.True(filters.Count() == 2); } } [Theory] [InlineData(NetworkType.Mainnet)] [InlineData(NetworkType.Testnet)] public async Task GetAllRoundStatesAsync(NetworkType networkType) { using (var client = new SatoshiClient(_networkUriMappings[networkType])) { var states = await client.GetAllRoundStatesAsync(); var noRegisteredPeers = states.All(s => s.RegisteredPeerCount == 0); Assert.True(noRegisteredPeers); Assert.True(states.NotNullAndNotEmpty()); Assert.True(states.Count() == 2); } } // Offchain [Theory] [InlineData(NetworkType.Mainnet)] [InlineData(NetworkType.Testnet)] public async Task GetExchangeRatesAsync(NetworkType networkType) { using (var client = new WasabiClient(_networkUriMappings[networkType])) { var exchangeRates = await client.GetExchangeRatesAsync(); Assert.True(exchangeRates.NotNullAndNotEmpty()); } } } }
mit
C#
3e8666cadbcae04e658a85da13b8d4eaaa570521
Delete unsed class
lizhen325/DakHanMaRi,lizhen325/DakHanMaRi
Web.UI/Reposotires/AdminRepository.cs
Web.UI/Reposotires/AdminRepository.cs
using System.Linq; using System.Web.Mvc; using Web.UI.Interfaces; using Web.UI.Models; namespace Web.UI.Reposotires { public class AdminRepository : Controller, IAdminProfileRepository { private readonly CMSDBContext db; public AdminRepository(CMSDBContext db) { this.db = db; } public AdminProfile LoginValidation(string userId) { return db.AdminProfiles.FirstOrDefault(p => p.userId == userId); } protected override void Dispose(bool disposing) { if (disposing) db.Dispose(); base.Dispose(disposing); } } }
using System.Linq; using System.Web.Mvc; using Web.UI.Interfaces; using Web.UI.Models; namespace Web.UI.Reposotires { public class aa { public string Password { get; set; } } public class AdminRepository : Controller, IAdminProfileRepository { private readonly CMSDBContext db; public AdminRepository(CMSDBContext db) { this.db = db; } public AdminProfile LoginValidation(string userId) { return db.AdminProfiles.FirstOrDefault(p => p.userId == userId); } protected override void Dispose(bool disposing) { if (disposing) db.Dispose(); base.Dispose(disposing); } } }
mit
C#
f2a972e49164f4b068d587d7043873819678e39b
Update comments and bumped up default packets to 64 and datagrams 40
markmnl/FalconUDP
PoolSizes.cs
PoolSizes.cs
 namespace FalconUDP { /// <summary> /// Class contining the number of objects FalconPeer will create on construction to mitigate /// later allocations and /// </summary> public class FalconPoolSizes { /// <summary> /// Number of <see cref="Packet"/>s to pool. The optimal number is the maximum number in /// use at any one time - which will be the number received between calls to <see cref="FalconPeer.Update()"/>. /// </summary> public int InitalNumPacketsToPool = 32; /// <summary> /// Number of Pings to pool - an internal object used whenever a Ping is sent. The optimal /// number is the maximum in use at any one time - which will be the number of outstanding /// (i.e. haven't received Pong reply or timed-out) pings. /// </summary> public int InitalNumPingsToPool = 10; /// <summary> /// Number of DiscoverySignalTask's to pool - an internal object used to track a discovery /// process initated from calling one of the Discover or Punch through methods on /// FalconPeer. The optimal number is the maximum number of discovery process you will /// have outstanding at any one time. /// </summary> public int InitalNumEmitDiscoverySignalTaskToPool = 5; /// <summary> /// Number of internal buffers to pool used to store pakcets enqued but not yet sent. The /// optimal number is the maximum number of unsent datagrams at any time which the number /// of packets enqueued to send minus the number that can be "packed-in" existing /// datagrams. /// </summary> public int InitalNumSendDatagramsToPool = 20; /// <summary> /// Number of interal data structurs use to save ACKknowledgement details to be sent in /// response to receiving a Reliable message. The optimal number is the maximum number of /// ACKs oustanding resulting from incoming reliable packets between calls to /// <see cref="FalconPeer.Update()"/> and <see cref="FalconPeer.SendEnquedPackets()"/> /// </summary> public int InitalNumAcksToPool = 20; /// <summary> /// Default pool sizes. /// </summary> public static readonly FalconPoolSizes Default = new FalconPoolSizes { InitalNumPacketsToPool = 64, InitalNumPingsToPool = 10, InitalNumEmitDiscoverySignalTaskToPool = 5, InitalNumSendDatagramsToPool = 40, InitalNumAcksToPool = 20, }; } }
 namespace FalconUDP { /// <summary> /// Class contining the number of object FalconPeer will create on construction to mitigate /// later allocations. /// </summary> public class FalconPoolSizes { /// <summary> /// Number of <see cref="Packet"/>s to pool. The optimal number is just over the maximum /// number in use at any one time - which will be the number received between calls to /// <see cref="FalconPeer.ProcessReceivedPackets()"/> /// </summary> public int InitalNumPacketsToPool = 32; /// <summary> /// Number of Pings to pool - an internal object used whenever a Ping is sent. The optimal /// number is the maximum in use at any one time - which will be the number of outstanding /// (i.e. haven't received Ping reply or timed-out) pings. /// </summary> public int InitalNumPingsToPool = 10; /// <summary> /// Number of DiscoverySignalTask's to pool - an internal object used to track a discovery /// process initated from calling of the Discover or Punch through methods on FalconPeer. /// The optimal number is the maximum number of discovery process you will have outstanding /// at any one time. /// </summary> public int InitalNumEmitDiscoverySignalTaskToPool = 5; /// <summary> /// Number of internal buffers to pool used to store pakcets enqued but not yet sent. The /// optimal number is the maximum number of sends, minus the number that can be "packed-in" /// existing datagrams, at any one time. /// </summary> public int InitalNumSendDatagramsToPool = 20; /// <summary> /// Number of interal data structurs use to save ACKknowledgement details to be sent in /// response to receiving a Reliable message. The optimal number is the maximum number of /// ACKs oustanding resulting from incoming reliable packets between calls to /// <see cref="FalconPeer.ProcessReceivedPackets()"/> then <see cref="FalconPeer.SendEnquedPackets()"/> /// </summary> public int InitalNumAcksToPool = 20; /// <summary> /// Default pool sizes. /// </summary> public static readonly FalconPoolSizes Default = new FalconPoolSizes { InitalNumPacketsToPool = 32, InitalNumPingsToPool = 10, InitalNumEmitDiscoverySignalTaskToPool = 5, InitalNumSendDatagramsToPool = 20, InitalNumAcksToPool = 20, }; } }
mit
C#
9ac7d7ba8aadd1e1182acbfdbee5cb4d75142852
add warning that SuppressFinalize is not supported
dot42/api
System/GC.cs
System/GC.cs
// Copyright (C) 2014 dot42 // // Original filename: GC.cs // // 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 Dot42; using JSystem = Java.Lang.System; using JRuntime = Java.Lang.Runtime; namespace System { /// <summary> /// Controls the garbage collector. /// </summary> public static class GC { /// <summary> /// Force a run of the garbase collector. /// </summary> public static void Collect() { JSystem.Gc(); } /// <summary> /// Instruct the system not to call the finalizer of the given object. /// </summary> /// <remarks>Not implemented</remarks> [Obsolete("SuppressFinalize is not supported in Java, this method does nothing.")] public static void SuppressFinalize(object value) { if (value == null) throw new ArgumentNullException("value"); } /// <summary> /// Retrieves the number of bytes currently allocated. /// </summary> public static long GetTotalMemory(bool forceFullCollection) { //we cannot force, but provide hints if (forceFullCollection) { JSystem.RunFinalization(); JSystem.Gc(); } return JRuntime.GetRuntime().TotalMemory(); } } }
// Copyright (C) 2014 dot42 // // Original filename: GC.cs // // 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 JSystem = Java.Lang.System; using JRuntime = Java.Lang.Runtime; namespace System { /// <summary> /// Controls the garbage collector. /// </summary> public static class GC { /// <summary> /// Force a run of the garbase collector. /// </summary> public static void Collect() { JSystem.Gc(); } /// <summary> /// Instruct the system not to call the finalizer of the given object. /// </summary> /// <remarks>Not implemented</remarks> public static void SuppressFinalize(object value) { if (value == null) throw new ArgumentNullException("value"); } /// <summary> /// Retrieves the number of bytes currently allocated. /// </summary> public static long GetTotalMemory(bool forceFullCollection) { //we cannot force, but provide hints if (forceFullCollection) { JSystem.RunFinalization(); JSystem.Gc(); } return JRuntime.GetRuntime().TotalMemory(); } } }
apache-2.0
C#
51c5eac7acc2f385cdceef79fb2f25d5ae1aeddf
Update EnumerableTests.cs
keith-hall/Extensions,keith-hall/Extensions
tests/EnumerableTests.cs
tests/EnumerableTests.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using HallLibrary.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Tests { [TestClass] public class EnumerableTests { private IEnumerable<int> _failAtFifthIteration = Enumerable.Range(1, 4).Concat(new[] { 0 }.Select(s => 1 / s)); private IEnumerable<int> _threeElements = Enumerable.Range(1, 3); [TestMethod] public void TestCountExceeds() { Assert.IsTrue(_failAtFifthIteration.CountExceeds(3)); Assert.IsTrue(_threeElements.CountExceeds(2)); Assert.IsFalse(_threeElements.CountExceeds(3)); Assert.IsFalse(_threeElements.CountExceeds(4)); } [TestMethod] [ExpectedException(typeof(DivideByZeroException))] public void TestCountException() { // show that Count iterates through all elements, which is why my extension methods are better // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression if (_failAtFifthIteration.Count() > 3) Assert.Fail("The above should cause a DivideByZero Exception so this line should never be reached."); else Assert.Fail("Count is greater than 3 so this line should never be reached."); } [TestMethod] public void TestCountEquals() { Assert.IsFalse(_failAtFifthIteration.CountEquals(2)); Assert.IsTrue(_threeElements.CountEquals(3)); Assert.IsFalse(_threeElements.CountEquals(2)); } [TestMethod] public void TestCountIsLessThan() { Assert.IsFalse(_failAtFifthIteration.CountIsLessThan(3)); Assert.IsTrue(_threeElements.CountIsLessThan(4)); Assert.IsFalse(_threeElements.CountIsLessThan(3)); } [TestMethod] public void TestCountEqualsWithDistinct() { // show that Distinct does not iterate through all elements before returning elements Assert.IsFalse(_failAtFifthIteration.Distinct().CountEquals(2)); Assert.IsTrue(_threeElements.Distinct().CountEquals(3)); } [TestMethod] public void TestGroupRank() { var scores = new object[] { "Jane", 18, "Joe", 12, "Fred", 18, "Jill", 21, "Jim", 15 }; var zipped = scores.OfType<string>().Zip(scores.OfType<int>(), Tuple.Create); var grouped = zipped.GroupBy(t => t.Item2).OrderByDescending(g => g.Key); var ranked = grouped.Rank(false, Tuple.Create); Assert.IsTrue(ranked.Select(t => t.Item3).SequenceEqual(new[] { 1, 2, 2, 4, 5 })); //Assert.IsTrue(ranked.Select(t => t.Item2.Item1).SequenceEqual(new[] { "Jill", "Jane", "Fred", "Jim", "Joe" })); ranked = grouped.Rank(true, Tuple.Create); Assert.IsTrue(ranked.Select(t => t.Item3).SequenceEqual(new[] { 1, 2, 2, 3, 4 })); //Assert.IsTrue(ranked.Select(t => t.Item2.Item1).SequenceEqual(new[] { "Jill", "Jane", "Fred", "Jim", "Joe" })); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using HallLibrary.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Tests { [TestClass] public class EnumerableTests { private IEnumerable<int> _failAtFifthIteration = Enumerable.Range(1, 4).Concat(new[] { 0 }.Select(s => 1 / s)); private IEnumerable<int> _threeElements = Enumerable.Range(1, 3); [TestMethod] public void TestCountExceeds() { Assert.IsTrue(_failAtFifthIteration.CountExceeds(3)); Assert.IsTrue(_threeElements.CountExceeds(2)); Assert.IsFalse(_threeElements.CountExceeds(3)); Assert.IsFalse(_threeElements.CountExceeds(4)); } [TestMethod] [ExpectedException(typeof(DivideByZeroException))] public void TestCountException() { // show that Count iterates through all elements, which is why my extension methods are better // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression if (_failAtFifthIteration.Count() > 3) Assert.Fail("The above should cause a DivideByZero Exception so this line should never be reached."); else Assert.Fail("Count is greater than 3 so this line should never be reached."); } [TestMethod] public void TestCountEquals() { Assert.IsFalse(_failAtFifthIteration.CountEquals(2)); Assert.IsTrue(_threeElements.CountEquals(3)); Assert.IsFalse(_threeElements.CountEquals(2)); } [TestMethod] public void TestCountIsLessThan() { Assert.IsFalse(_failAtFifthIteration.CountIsLessThan(3)); Assert.IsTrue(_threeElements.CountIsLessThan(4)); Assert.IsFalse(_threeElements.CountIsLessThan(3)); } [TestMethod] public void TestDistinct() { // show that Distinct does not iterate through all elements before returning elements Assert.IsFalse(_failAtFifthIteration.Distinct().CountEquals(2)); Assert.IsTrue(_threeElements.Distinct().CountEquals(3)); } } }
apache-2.0
C#
bac1f8d1c0ef8689326571fe267d13fc93c48492
add indexer method
pashchuk/Numerical-methods,pashchuk/Numerical-methods
CSharp/lab1/Matrix.cs
CSharp/lab1/Matrix.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace lab1 { public class Matrix<T> where T : struct { #region Fields private T[,] _matrix; #endregion #region Properties public T this[int row, int column] { get { return _matrix[row, column]; } set { _matrix[row, column] = value; } } #endregion #region Costructors public Matrix(int rows, int columns) { _matrix = new T[rows, columns]; } public Matrix(int size) : this(size, size) { } #endregion #region private Methods #endregion #region public Methods #endregion #region Events #endregion } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace lab1 { public class Matrix<T> where T : struct { #region Fields private T[,] _matrix; #endregion #region Properties #endregion #region Costructors public Matrix(int rows, int columns) { _matrix = new T[rows, columns]; } public Matrix(int size) : this(size, size) { } #endregion #region private Methods #endregion #region public Methods #endregion #region Events #endregion } }
mit
C#
aacd65078c3d6d54fdf030d0955c7f29bcdf7473
Use Id instead of fixed value
jazd/Business,jazd/Business,jazd/Business
CSharp/Core/Individual/IndividualDB.cs
CSharp/Core/Individual/IndividualDB.cs
using System; namespace Business.Core { public partial class Individual { public IDatabase Database { get; private set; } public Individual(IDatabase database, UInt64? id = null) { Database = database; if(id != null) Load((UInt64)id); } private void Load(UInt64 id) { // Overwrite this object with Individual id Empty(); Id = id; // Default to person for now Person = true; if (Database != null) { Database.Connect(); Database.Connection.Open(); Database.Command.CommandText = GetIndividualSQL; Database.Command.Parameters.Add(new Parameter() { Name= "@id", Value = id }); var reader = Database.Command.ExecuteReader(); if (reader.HasRows) { if (reader.Read()) { try { FullName = reader.GetString(0); GoesBy = reader.GetString(1); } catch (Exception ex) { // Some sort of type or data issue Database.Profile.Log?.Error($"reading Individual: {ex.Message}"); } } } } } private const string GetIndividualSQL = @" SELECT fullname, goesBY FROM ( SELECT fullname, goesBy FROM People WHERE individual = @id UNION SELECT name AS fullname, goesBy FROM Entities WHERE individual = @id ) AS Individual LIMIT 1 "; } }
using System; namespace Business.Core { public partial class Individual { public IDatabase Database { get; private set; } public Individual(IDatabase database, UInt64? id = null) { Database = database; if(id != null) Load((UInt64)id); } private void Load(UInt64 id) { // Overwrite this object with Individual id Empty(); Id = id; // Default to person for now Person = true; if (Database != null) { Database.Connect(); Database.Connection.Open(); Database.Command.CommandText = GetIndividualSQL; Database.Command.Parameters.Add(new Parameter() { Name= "@id", Value = 3 }); var reader = Database.Command.ExecuteReader(); if (reader.HasRows) { if (reader.Read()) { try { FullName = reader.GetString(0); GoesBy = reader.GetString(1); } catch (Exception ex) { // Some sort of type or data issue Database.Profile.Log?.Error($"reading Individual: {ex.Message}"); } } } } } private const string GetIndividualSQL = @" SELECT fullname, goesBy FROM People WHERE individual = @id "; } }
mit
C#
5e75d001c820c6125b5b9ee759be4f34cfd5d83a
Fix Dialog creation
openmedicus/gtk-sharp,openmedicus/gtk-sharp,openmedicus/gtk-sharp,openmedicus/gtk-sharp,openmedicus/gtk-sharp,openmedicus/gtk-sharp,openmedicus/gtk-sharp
gtk/Dialog.cs
gtk/Dialog.cs
// // Gtk.Dialog.cs - Gtk Dialog class customizations // // Author: Duncan Mak (duncan@ximian.com) // Mike Kestner (mkestner@speakeasy.net) // // Copyright (C) 2002 Ximian, Inc. and Mike Kestner // // This program is free software; you can redistribute it and/or // modify it under the terms of version 2 of the Lesser GNU General // Public License as published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this program; if not, write to the // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. namespace Gtk { using System; using System.Runtime.InteropServices; public partial class Dialog { [DllImport (Global.GtkNativeDll, CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gtk_dialog_new_with_buttons (IntPtr title, IntPtr i, int flags, IntPtr dummy); public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags, params object[] button_data) : base(IntPtr.Zero) { IntPtr native = GLib.Marshaller.StringToPtrGStrdup (title); Raw = gtk_dialog_new_with_buttons (native, parent == null ? IntPtr.Zero : parent.Handle, (int) flags, IntPtr.Zero); GLib.Marshaller.Free (native); for (int i = 0; i < button_data.Length - 1; i += 2) AddButton ((string) button_data [i], (int) button_data [i + 1]); } public void AddActionWidget (Widget child, ResponseType response) { this.AddActionWidget (child, (int) response); } public Gtk.Widget AddButton (string button_text, ResponseType response) { return this.AddButton (button_text, (int) response); } public void Respond (ResponseType response) { this.Respond ((int) response); } [Obsolete ("Replaced by AlternativeButtonOrder property")] public int SetAlternativeButtonOrderFromArray (int n_params) { return -1; } } }
// // Gtk.Dialog.cs - Gtk Dialog class customizations // // Author: Duncan Mak (duncan@ximian.com) // Mike Kestner (mkestner@speakeasy.net) // // Copyright (C) 2002 Ximian, Inc. and Mike Kestner // // This program is free software; you can redistribute it and/or // modify it under the terms of version 2 of the Lesser GNU General // Public License as published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this program; if not, write to the // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. namespace Gtk { using System; using System.Runtime.InteropServices; public partial class Dialog { [DllImport (Global.GtkNativeDll, CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gtk_dialog_new_with_buttons (IntPtr title, IntPtr i, int flags, IntPtr dummy); public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags, params object[] button_data) : base(IntPtr.Zero) { if (GetType() != typeof (Dialog)) { GLib.Value[] vals = new GLib.Value [1]; string[] names = new string [1]; names [0] = "title"; vals [0] = new GLib.Value (title); CreateNativeObject (names, vals); TransientFor = parent; if ((flags & DialogFlags.Modal) > 0) Modal = true; if ((flags & DialogFlags.DestroyWithParent) > 0) DestroyWithParent = true; } else { IntPtr native = GLib.Marshaller.StringToPtrGStrdup (title); Raw = gtk_dialog_new_with_buttons (native, parent == null ? IntPtr.Zero : parent.Handle, (int) flags, IntPtr.Zero); GLib.Marshaller.Free (native); } for (int i = 0; i < button_data.Length - 1; i += 2) AddButton ((string) button_data [i], (int) button_data [i + 1]); } public void AddActionWidget (Widget child, ResponseType response) { this.AddActionWidget (child, (int) response); } public Gtk.Widget AddButton (string button_text, ResponseType response) { return this.AddButton (button_text, (int) response); } public void Respond (ResponseType response) { this.Respond ((int) response); } [Obsolete ("Replaced by AlternativeButtonOrder property")] public int SetAlternativeButtonOrderFromArray (int n_params) { return -1; } } }
lgpl-2.1
C#
bd48b262c3c11fa24473c77372b98d8d00fd66f0
fix bug: #90
shuxinqin/Chloe
src/Chloe/Query/QueryState/DistinctQueryState.cs
src/Chloe/Query/QueryState/DistinctQueryState.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Chloe.DbExpressions; using Chloe.Query.QueryExpressions; namespace Chloe.Query.QueryState { class DistinctQueryState : SubQueryState { public DistinctQueryState(ResultElement resultElement) : base(resultElement) { } public override IQueryState Accept(SelectExpression exp) { IQueryState state = this.AsSubQueryState(); return state.Accept(exp); } public override DbSqlQueryExpression CreateSqlQuery() { DbSqlQueryExpression sqlQuery = base.CreateSqlQuery(); sqlQuery.IsDistinct = true; return sqlQuery; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Chloe.DbExpressions; namespace Chloe.Query.QueryState { class DistinctQueryState : SubQueryState { public DistinctQueryState(ResultElement resultElement) : base(resultElement) { } public override DbSqlQueryExpression CreateSqlQuery() { DbSqlQueryExpression sqlQuery = base.CreateSqlQuery(); sqlQuery.IsDistinct = true; return sqlQuery; } } }
mit
C#
2f8f06e1fc6923aa51c959ef4659c97ae91093ba
Fix ctor to take arbitrary object type as model.
nikhilk/silverlightfx
src/Client/Core/UserInterface/ViewUserControl.cs
src/Client/Core/UserInterface/ViewUserControl.cs
// ViewUserControl.cs // Copyright (c) Nikhil Kothari, 2008. All Rights Reserved. // http://www.nikhilk.net // // Silverlight.FX is an application framework for building RIAs with Silverlight. // This project is licensed under the BSD license. See the accompanying License.txt // file for more information. // For updated project information please visit http://projects.nikhilk.net/SilverlightFX. // using System; using System.ComponentModel; using System.Windows; using System.Windows.Controls; namespace SilverlightFX.UserInterface { /// <summary> /// Represents a user control within the application's user interface. /// </summary> public class ViewUserControl : View { /// <summary> /// Initializes an instance of a ViewUserControl. /// </summary> public ViewUserControl() { } /// <summary> /// Initializes an instance of a ViewUserControl with an associated view model. /// The view model is set as the DataContext of the Form. /// </summary> /// <param name="viewModel">The associated view model object.</param> public ViewUserControl(object viewModel) : base(viewModel) { } } }
// ViewUserControl.cs // Copyright (c) Nikhil Kothari, 2008. All Rights Reserved. // http://www.nikhilk.net // // Silverlight.FX is an application framework for building RIAs with Silverlight. // This project is licensed under the BSD license. See the accompanying License.txt // file for more information. // For updated project information please visit http://projects.nikhilk.net/SilverlightFX. // using System; using System.ComponentModel; using System.Windows; using System.Windows.Controls; namespace SilverlightFX.UserInterface { /// <summary> /// Represents a user control within the application's user interface. /// </summary> public class ViewUserControl : View { /// <summary> /// Initializes an instance of a ViewUserControl. /// </summary> public ViewUserControl() { } /// <summary> /// Initializes an instance of a ViewUserControl with an associated view model. /// The view model is set as the DataContext of the Form. /// </summary> /// <param name="viewModel">The associated view model object.</param> public ViewUserControl(Model viewModel) : base(viewModel) { } } }
bsd-3-clause
C#
aaa8d020b70e0b209f8d692d0377a2012b2192b0
update version to 1.0.1.0
cityindex-attic/RESTful-Webservice-Schema,cityindex-attic/RESTful-Webservice-Schema,cityindex-attic/RESTful-Webservice-Schema
src/MetadataProcessor/Properties/AssemblyInfo.cs
src/MetadataProcessor/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("MetadataProcessor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MetadataProcessor")] [assembly: AssemblyCopyright("Copyright © 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("9232869a-0e7b-42b2-a5f6-40bf2318cd5b")] // 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.1.*")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: InternalsVisibleTo("MetadataProcessor.Tests")]
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("MetadataProcessor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MetadataProcessor")] [assembly: AssemblyCopyright("Copyright © 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("9232869a-0e7b-42b2-a5f6-40bf2318cd5b")] // 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.1")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("MetadataProcessor.Tests")]
apache-2.0
C#
f0964e6c3522250a88f9383e3036a8cc3a8ea311
Add application/problem+json and application/problem+xml media types
ASP-NET-MVC-Boilerplate/Framework,ASP-NET-Core-Boilerplate/Framework,ASP-NET-Core-Boilerplate/Framework,ASP-NET-Core-Boilerplate/Framework,ASP-NET-MVC-Boilerplate/Framework,ASP-NET-Core-Boilerplate/Framework
Source/Boxed.AspNetCore/ContentType.cs
Source/Boxed.AspNetCore/ContentType.cs
namespace Boxed.AspNetCore { /// <summary> /// A list of internet media types, which are a standard identifier used on the Internet to indicate the type of /// data that a file contains. Web browsers use them to determine how to display, output or handle files and search /// engines use them to classify data files on the web. /// </summary> public static class ContentType { /// <summary>Atom feeds.</summary> public const string Atom = "application/atom+xml"; /// <summary>HTML; Defined in RFC 2854.</summary> public const string Html = "text/html"; /// <summary>Form URL Encoded.</summary> public const string FormUrlEncoded = "application/x-www-form-urlencoded"; /// <summary>GIF image; Defined in RFC 2045 and RFC 2046.</summary> public const string Gif = "image/gif"; /// <summary>JPEG JFIF image; Defined in RFC 2045 and RFC 2046.</summary> public const string Jpg = "image/jpeg"; /// <summary>JavaScript Object Notation JSON; Defined in RFC 4627.</summary> public const string Json = "application/json"; /// <summary>Web App Manifest.</summary> public const string Manifest = "application/manifest+json"; /// <summary>Multi-part form daata; Defined in RFC 2388.</summary> public const string MultipartFormData = "multipart/form-data"; /// <summary>Portable Network Graphics; Registered,[8] Defined in RFC 2083.</summary> public const string Png = "image/png"; /// <summary>Problem Details JavaScript Object Notation (JSON); Defined at https://tools.ietf.org/html/rfc7807.</summary> public const string ProblemJson = "application/problem+json"; /// <summary>Problem Details Extensible Markup Language (XML); Defined at https://tools.ietf.org/html/rfc7807.</summary> public const string ProblemXml = "application/problem+xml"; /// <summary>REST'ful JavaScript Object Notation (JSON); Defined at http://restfuljson.org/.</summary> public const string RestfulJson = "application/vnd.restful+json"; /// <summary>Rich Site Summary; Defined by Harvard Law.</summary> public const string Rss = "application/rss+xml"; /// <summary>Textual data; Defined in RFC 2046 and RFC 3676.</summary> public const string Text = "text/plain"; /// <summary>Extensible Markup Language; Defined in RFC 3023.</summary> public const string Xml = "application/xml"; /// <summary>Compressed ZIP.</summary> public const string Zip = "application/zip"; } }
namespace Boxed.AspNetCore { /// <summary> /// A list of internet media types, which are a standard identifier used on the Internet to indicate the type of /// data that a file contains. Web browsers use them to determine how to display, output or handle files and search /// engines use them to classify data files on the web. /// </summary> public static class ContentType { /// <summary>Atom feeds.</summary> public const string Atom = "application/atom+xml"; /// <summary>HTML; Defined in RFC 2854.</summary> public const string Html = "text/html"; /// <summary>Form URL Encoded.</summary> public const string FormUrlEncoded = "application/x-www-form-urlencoded"; /// <summary>GIF image; Defined in RFC 2045 and RFC 2046.</summary> public const string Gif = "image/gif"; /// <summary>JPEG JFIF image; Defined in RFC 2045 and RFC 2046.</summary> public const string Jpg = "image/jpeg"; /// <summary>JavaScript Object Notation JSON; Defined in RFC 4627.</summary> public const string Json = "application/json"; /// <summary>Web App Manifest.</summary> public const string Manifest = "application/manifest+json"; /// <summary>Multi-part form daata; Defined in RFC 2388.</summary> public const string MultipartFormData = "multipart/form-data"; /// <summary>Portable Network Graphics; Registered,[8] Defined in RFC 2083.</summary> public const string Png = "image/png"; /// <summary>REST'ful JavaScript Object Notation JSON; Defined at http://restfuljson.org/.</summary> public const string RestfulJson = "application/vnd.restful+json"; /// <summary>Rich Site Summary; Defined by Harvard Law.</summary> public const string Rss = "application/rss+xml"; /// <summary>Textual data; Defined in RFC 2046 and RFC 3676.</summary> public const string Text = "text/plain"; /// <summary>Extensible Markup Language; Defined in RFC 3023.</summary> public const string Xml = "application/xml"; /// <summary>Compressed ZIP.</summary> public const string Zip = "application/zip"; } }
mit
C#
b06f4e88873682050bf0efdc8dc035e0bfb4ba3c
Update SparklrMenu.xaml.cs
windowsphonehacker/SparklrWP
SparklrWP/Controls/SparklrMenu.xaml.cs
SparklrWP/Controls/SparklrMenu.xaml.cs
using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using SparklrWP.Controls; using SparklrWP.Utils; using SparklrWP.Utils.Extensions; using SparklrWP.ViewModels; using System; using System.Windows; using System.Windows.Controls; using System.Windows.Navigation; namespace SparklrWP.Controls { public partial class SparklrMenu : UserControl { public SparklrMenu() { InitializeComponent(); } private void home_Click(object sender, EventArgs e) { (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/Pages/MainPage.xaml", UriKind.Relative)); } private void friends_Click(object sender, RoutedEventArgs e) { (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/Pages/MainPage.xaml?page=1", UriKind.Relative)); } private void inbox_Click(object sender, RoutedEventArgs e) { (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/Pages/InboxPage.xaml", UriKind.Relative)); } private void network_Click(object sender, RoutedEventArgs e) { } } }
using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using SparklrWP.Controls; using SparklrWP.Utils; using SparklrWP.Utils.Extensions; using SparklrWP.ViewModels; using System; using System.Windows; using System.Windows.Controls; using System.Windows.Navigation; namespace SparklrWP.Controls { public partial class SparklrMenu : UserControl { public SparklrMenu() { InitializeComponent(); } private void home_Click(object sender, EventArgs e) { (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/Pages/MainPage.xaml", UriKind.Relative)); } private void friends_Click(object sender, RoutedEventArgs e) { (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/Pages/MainPage.xaml?page=1", UriKind.Relative)); } private void inbox_Click(object sender, RoutedEventArgs e) { (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/Pages/InboxPage.xaml", UriKind.Relative)); } private void network_Click(object sender, RoutedEventArgs e) { (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/Pages/MainPage.xaml?page=3", UriKind.Relative)); } } }
mit
C#
06fd2699310b50b4f8fb942031bbc595f650611e
add license
NDark/ndinfrastructure,NDark/ndinfrastructure
Unity/UnityTools/OnClickChangeScene.cs
Unity/UnityTools/OnClickChangeScene.cs
/** MIT License Copyright (c) 2017 NDark 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. */ /** @file OnClickChangeScene.cs @author NDark @date 20170402 . file started. */ using UnityEngine; public class OnClickChangeScene : MonoBehaviour { public string m_SceneName = string.Empty ; void OnClick() { UnityEngine.SceneManagement.SceneManager.LoadScene ( m_SceneName ); } }
/** @file OnClickChangeScene.cs @author NDark @date 20170402 . file started. */ using UnityEngine; public class OnClickChangeScene : MonoBehaviour { public string m_SceneName = string.Empty ; void OnClick() { UnityEngine.SceneManagement.SceneManager.LoadScene ( m_SceneName ); } }
mit
C#