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
9d7615a19fa71815f90b7ac0da12cf8b110a6927
Test that user is not null
jhofker/SmugSharp
SmugSharpTest/SmugMugUnitTests.cs
SmugSharpTest/SmugMugUnitTests.cs
using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; using SmugSharp; namespace SmugSharpTest { [TestClass] public class UnitTest1 { private string ApiKey { get { return Configuration.Authentication.ApiKey; } } private string ApiSecret { get { return Configuration.Authentication.ApiSecret; } } private string CallbackUrl { get { return Configuration.Authentication.CallbackUrl; } } private string AccessToken { get { return Configuration.Authentication.AccessToken; } } private string AccessTokenSecret { get { return Configuration.Authentication.AccessTokenSecret; } } [TestMethod] public void TestSmugMugCtorWorks() { var smugmug = new SmugMug(ApiKey, ApiSecret, CallbackUrl); Assert.IsNotNull(smugmug, "SmugMug should not be null after constructing."); Assert.IsNotNull(smugmug.Authentication, "SmugMug Authentication should not be null."); Assert.AreEqual(ApiKey, smugmug.ApiKey, "API key should be kept."); } [TestMethod] public async Task TestGetResponseWithHeaders() { var smugmug = new SmugMug(AccessToken, AccessTokenSecret, ApiKey, ApiSecret, CallbackUrl); var authUserUrl = $"{SmugMug.BaseApiUrl}!authuser"; var response = await smugmug.GetResponseWithHeaders(authUserUrl); Assert.IsFalse(response.Contains("\"Code\":4")); } [TestMethod] public async Task TestGetPublicResponse() { var smugmug = new SmugMug(AccessToken, AccessTokenSecret, ApiKey, ApiSecret, CallbackUrl); var authUserUrl = $"{SmugMug.BaseApiUrl}/user/cmac"; var response = await smugmug.GetResponseWithHeaders(authUserUrl); Assert.IsFalse(response.Contains("\"Code\":4")); } [TestMethod] public async Task TestGetCurrentUserNotNull() { var smugmug = new SmugMug(AccessToken, AccessTokenSecret, ApiKey, ApiSecret, CallbackUrl); var user = await smugmug.GetCurrentUser(); Assert.IsNotNull(user); } } }
using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; using SmugSharp; namespace SmugSharpTest { [TestClass] public class UnitTest1 { private string ApiKey { get { return Configuration.Authentication.ApiKey; } } private string ApiSecret { get { return Configuration.Authentication.ApiSecret; } } private string CallbackUrl { get { return Configuration.Authentication.CallbackUrl; } } private string AccessToken { get { return Configuration.Authentication.AccessToken; } } private string AccessTokenSecret { get { return Configuration.Authentication.AccessTokenSecret; } } [TestMethod] public void TestSmugMugCtorWorks() { var smugmug = new SmugMug(ApiKey, ApiSecret, CallbackUrl); Assert.IsNotNull(smugmug, "SmugMug should not be null after constructing."); Assert.IsNotNull(smugmug.Authentication, "SmugMug Authentication should not be null."); Assert.AreEqual(ApiKey, smugmug.ApiKey, "API key should be kept."); } [TestMethod] public async Task TestGetResponseWithHeaders() { var smugmug = new SmugMug(AccessToken, AccessTokenSecret, ApiKey, ApiSecret, CallbackUrl); var authUserUrl = $"{SmugMug.BaseApiUrl}!authuser"; var response = await smugmug.GetResponseWithHeaders(authUserUrl); Assert.IsFalse(response.Contains("\"Code\":4")); } [TestMethod] public async Task TestGetPublicResponse() { var smugmug = new SmugMug(AccessToken, AccessTokenSecret, ApiKey, ApiSecret, CallbackUrl); var authUserUrl = $"{SmugMug.BaseApiUrl}/user/cmac"; var response = await smugmug.GetResponseWithHeaders(authUserUrl); Assert.IsFalse(response.Contains("\"Code\":4")); } } }
mit
C#
9e0aee6d8b42eb87a9d9d8c5857df3d7d4baf08d
add code generation to PieSlice
GeertvanHorrik/oxyplot,Kaplas80/oxyplot,objorke/oxyplot,NilesDavis/oxyplot,objorke/oxyplot,shoelzer/oxyplot,GeertvanHorrik/oxyplot,DotNetDoctor/oxyplot,DotNetDoctor/oxyplot,Isolocis/oxyplot,HermanEldering/oxyplot,oxyplot/oxyplot,Kaplas80/oxyplot,olegtarasov/oxyplot,olegtarasov/oxyplot,Jofta/oxyplot,ze-pequeno/oxyplot,GeertvanHorrik/oxyplot,shoelzer/oxyplot,Jonarw/oxyplot,objorke/oxyplot,zur003/oxyplot,shoelzer/oxyplot,HermanEldering/oxyplot
Source/OxyPlot/Series/PieSlice.cs
Source/OxyPlot/Series/PieSlice.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="PieSlice.cs" company="OxyPlot"> // Copyright (c) 2014 OxyPlot contributors // </copyright> // <summary> // Represent a slice of a <see cref="PieSeries" />. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace OxyPlot.Series { /// <summary> /// Represent a slice of a <see cref="PieSeries" />. /// </summary> public class PieSlice : ICodeGenerating { /// <summary> /// Initializes a new instance of the <see cref="PieSlice" /> class. /// </summary> /// <param name="label">The label.</param> /// <param name="value">The value.</param> public PieSlice(string label, double value) { this.Fill = OxyColors.Automatic; this.Label = label; this.Value = value; } /// <summary> /// Gets or sets the fill color. /// </summary> public OxyColor Fill { get; set; } /// <summary> /// Gets the actual fill color. /// </summary> /// <value>The actual color.</value> public OxyColor ActualFillColor { get { return this.Fill.GetActualColor(this.DefaultFillColor); } } /// <summary> /// Gets or sets a value indicating whether the slice is exploded. /// </summary> public bool IsExploded { get; set; } /// <summary> /// Gets the label. /// </summary> public string Label { get; private set; } /// <summary> /// Gets the value. /// </summary> public double Value { get; private set; } /// <summary> /// Gets or sets the default fill color. /// </summary> /// <value>The default fill color.</value> internal OxyColor DefaultFillColor { get; set; } /// <summary> /// Returns C# code that generates this instance. /// </summary> /// <returns>C# code.</returns> public string ToCode() { return CodeGenerator.FormatConstructor( this.GetType(), "{0}, {1}", this.Label, this.Value); } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="PieSlice.cs" company="OxyPlot"> // Copyright (c) 2014 OxyPlot contributors // </copyright> // <summary> // Represent a slice of a <see cref="PieSeries" />. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace OxyPlot.Series { /// <summary> /// Represent a slice of a <see cref="PieSeries" />. /// </summary> public class PieSlice { /// <summary> /// Initializes a new instance of the <see cref = "PieSlice" /> class. /// </summary> public PieSlice() { this.Fill = OxyColors.Automatic; } /// <summary> /// Initializes a new instance of the <see cref="PieSlice" /> class. /// </summary> /// <param name="label">The label.</param> /// <param name="value">The value.</param> public PieSlice(string label, double value) : this() { this.Label = label; this.Value = value; } /// <summary> /// Gets or sets the fill color. /// </summary> public OxyColor Fill { get; set; } /// <summary> /// Gets the actual fill color. /// </summary> /// <value>The actual color.</value> public OxyColor ActualFillColor { get { return this.Fill.GetActualColor(this.DefaultFillColor); } } /// <summary> /// Gets or sets a value indicating whether the slice is exploded. /// </summary> public bool IsExploded { get; set; } /// <summary> /// Gets or sets the label. /// </summary> public string Label { get; set; } /// <summary> /// Gets or sets the value. /// </summary> public double Value { get; set; } /// <summary> /// Gets or sets the default fill color. /// </summary> /// <value>The default fill color.</value> internal OxyColor DefaultFillColor { get; set; } } }
mit
C#
c2fe56838b15a251a6ea69b9fd646fa1003072e8
Add more methods to sort by
It423/todo-list,wrightg42/todo-list
Todo-List/Todo-List/NoteSorter.cs
Todo-List/Todo-List/NoteSorter.cs
// NoteSorter.cs // <copyright file="NoteSorter.cs"> This code is protected under the MIT License. </copyright> using System.Collections.Generic; using System.Linq; namespace Todo_List { /// <summary> /// A static class containing a list of notes and methods for sorting them. /// </summary> public static class NoteSorter { /// <summary> /// Initializes static members of the <see cref="NoteSorter" /> class. /// </summary> public static NoteSorter() { Notes = new List<Note>(); } /// <summary> /// Gets or sets the list of notes currently stored in the program. /// </summary> public static List<Note> Notes { get; set; } /// <summary> /// Gets all the notes with certain category tags. /// </summary> /// <param name="categoryNames"> The list of categories. </param> /// <returns> The list of notes under the category. </returns> /// <remarks> No category names in the list means all categories. </remarks> public static List<Note> GetNotesByCatagory(List<string> categoryNames) { IEnumerable<Note> notesUnderCategories = Notes; foreach (string catergory in categoryNames) { notesUnderCategories = notesUnderCategories.Where(n => n.Categories.Select(c => c = c.ToUpper()).Contains(catergory.ToUpper())); } return notesUnderCategories.ToList(); } /// <summary> /// Adds a note to the collection of notes. /// </summary> /// <param name="note"> The note to add. </param> public static void AddNote(Note note) { Notes.Add(note); } /// <summary> /// Removes a note from the collection of notes. /// </summary> /// <param name="note"> The note to remove. </param> public static void RemoveNote(Note note) { Notes.Remove(note); } /// <summary> /// Edits a note. /// </summary> /// <param name="oldNote"> The old note to edit. </param> /// <param name="newNote"> The new note to replace the old. </param> public static void EditNote(Note oldNote, Note newNote) { int i = Notes.IndexOf(oldNote); Notes[i] = newNote; } /// <summary> /// Finds the index of a note by the title. /// </summary> /// <param name="title"> The title of the note. </param> /// <returns> The index of the note in the list. </returns> public static int NoteIndex(string title) { // Get the note by the title Note note = Notes.Where(n => n.Title == title).ToArray()[0]; return Notes.IndexOf(note); } } }
// NoteSorter.cs // <copyright file="NoteSorter.cs"> This code is protected under the MIT License. </copyright> using System.Collections.Generic; using System.Linq; namespace Todo_List { /// <summary> /// A static class containing a list of notes and methods for sorting them. /// </summary> public static class NoteSorter { /// <summary> /// Initializes static members of the <see cref="NoteSorter" /> class. /// </summary> public static NoteSorter() { Notes = new List<Note>(); } /// <summary> /// Gets or sets the list of notes currently stored in the program. /// </summary> public static List<Note> Notes { get; set; } /// <summary> /// Gets all the notes with certain category tags. /// </summary> /// <param name="categoryNames"> The list of categories. </param> /// <returns> The list of notes under the category. </returns> /// <remarks> No category names in the list means all categories. </remarks> public static List<Note> GetNotesByCatagory(List<string> categoryNames) { IEnumerable<Note> notesUnderCategories = Notes; foreach (string catergory in categoryNames) { notesUnderCategories = notesUnderCategories.Where(n => n.Categories.Contains(catergory.ToUpper())); } return notesUnderCategories.ToList(); } } }
mit
C#
80f7e45a25253f650f4cab6f084dee0a720ba391
Change Backend events to virtual
mminns/xwt,antmicro/xwt,mono/xwt,sevoku/xwt,hwthomas/xwt,iainx/xwt,directhex/xwt,TheBrainTech/xwt,residuum/xwt,steffenWi/xwt,mminns/xwt,akrisiun/xwt,lytico/xwt,cra0zy/xwt,hamekoz/xwt
Xwt.WPF/Xwt.WPFBackend/Backend.cs
Xwt.WPF/Xwt.WPFBackend/Backend.cs
// // Backend.cs // // Author: // Eric Maupin <ermau@xamarin.com> // // Copyright (c) 2012 Xamarin, Inc. // // 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. namespace Xwt.WPFBackend { public abstract class Backend : IBackend { protected Widget frontend; void IBackend.Initialize (object frontend) { this.frontend = (Widget) frontend; } public virtual void EnableEvent (object eventId) { } public virtual void DisableEvent (object eventId) { } } }
// // Backend.cs // // Author: // Eric Maupin <ermau@xamarin.com> // // Copyright (c) 2012 Xamarin, Inc. // // 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. namespace Xwt.WPFBackend { public abstract class Backend : IBackend { protected Widget frontend; void IBackend.Initialize (object frontend) { this.frontend = (Widget) frontend; } public abstract void EnableEvent (object eventId); public abstract void DisableEvent (object eventId); } }
mit
C#
395ce12c55e48d0b317a01067fbb8de534a0162a
use interface for concrete tree
b3b00/csly,b3b00/sly
cpg/parser/parsgenerator/generator/ConcreteSyntaxTreeVisitor.cs
cpg/parser/parsgenerator/generator/ConcreteSyntaxTreeVisitor.cs
using System; using parser.parsergenerator.syntax; using System.Collections.Generic; using cpg.parser.parsgenerator.syntax; namespace parser.parsergenerator.generator { public class ConcreteSyntaxTreeVisitor<T> { public Type ParserClass { get; set; } public ParserConfiguration<T> Configuration { get; set; } public ConcreteSyntaxTreeVisitor(ParserConfiguration<T> conf) { this.ParserClass = ParserClass; this.Configuration = conf; } public object VisitSyntaxTree(IConcreteSyntaxNode<T> root) { return Visit(root); } private object Visit(IConcreteSyntaxNode<T> n) { if (n.IsTerminal()) { return Visit(n as ConcreteSyntaxLeaf<T>); } else { return Visit(n as ConcreteSyntaxNode<T>); } } private object Visit(ConcreteSyntaxNode<T> node) { object result = null; if (Configuration.Functions.ContainsKey(node.Name)) { List<object> args = new List<object>(); node.Children.ForEach(n => { object v = Visit(n); if (v != null) { args.Add(v); } }); result = Configuration.Functions[node.Name].Invoke(args); } return result; } private object Visit(ConcreteSyntaxLeaf<T> leaf) { return leaf.Token; } } }
using System; using parser.parsergenerator.syntax; using System.Collections.Generic; using cpg.parser.parsgenerator.syntax; namespace parser.parsergenerator.generator { public class ConcreteSyntaxTreeVisitor<T> { public Type ParserClass { get; set; } public ParserConfiguration<T> Configuration { get; set; } public ConcreteSyntaxTreeVisitor(ParserConfiguration<T> conf) { this.ParserClass = ParserClass; this.Configuration = conf; } public object VisitSyntaxTree(ConcreteSyntaxNode<T> root) { return Visit(root); } private object Visit(IConcreteSyntaxNode<T> n) { if (n.IsTerminal()) { return Visit(n as ConcreteSyntaxLeaf<T>); } else { return Visit(n as ConcreteSyntaxNode<T>); } } private object Visit(ConcreteSyntaxNode<T> node) { object result = null; if (Configuration.Functions.ContainsKey(node.Name)) { List<object> args = new List<object>(); node.Children.ForEach(n => { object v = Visit(n); if (v != null) { args.Add(v); } }); result = Configuration.Functions[node.Name].Invoke(args); } return result; } private object Visit(ConcreteSyntaxLeaf<T> leaf) { return leaf.Token; } } }
mit
C#
b791a6a62f292b2403eda68559d2e3d947c32dae
Fix scanning for MyGet versions
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/Tooling/LatestMyGetVersionAttribute.cs
source/Nuke.Common/Tooling/LatestMyGetVersionAttribute.cs
// Copyright 2020 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; using System.Reflection; using JetBrains.Annotations; using Nuke.Common.IO; using Nuke.Common.Utilities; using Nuke.Common.ValueInjection; namespace Nuke.Common.Tooling { [PublicAPI] public class LatestMyGetVersionAttribute : ValueInjectionAttributeBase { private readonly string _feed; private readonly string _package; public LatestMyGetVersionAttribute(string feed, string package) { _feed = feed; _package = package; } public override object GetValue(MemberInfo member, object instance) { var rssFile = NukeBuild.TemporaryDirectory / $"{_feed}.xml"; HttpTasks.HttpDownloadFile($"https://www.myget.org/RSS/{_feed}", rssFile); return XmlTasks.XmlPeek(rssFile, ".//title") // TODO: regex? .First(x => x.Contains($"/{_package} ")) .Split('(').Last() .Split(')').First() .TrimStart("version "); } } }
// Copyright 2020 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; using System.Reflection; using JetBrains.Annotations; using Nuke.Common.IO; using Nuke.Common.Utilities; using Nuke.Common.ValueInjection; namespace Nuke.Common.Tooling { [PublicAPI] public class LatestMyGetVersionAttribute : ValueInjectionAttributeBase { private readonly string _feed; private readonly string _package; public LatestMyGetVersionAttribute(string feed, string package) { _feed = feed; _package = package; } public override object GetValue(MemberInfo member, object instance) { var rssFile = NukeBuild.TemporaryDirectory / $"{_feed}.xml"; HttpTasks.HttpDownloadFile($"https://www.myget.org/RSS/{_feed}", rssFile); return XmlTasks.XmlPeek(rssFile, ".//title") // TODO: regex? .First(x => x.Contains($" {_package} ")) .Split('(').Last() .Split(')').First() .TrimStart("version "); } } }
mit
C#
3364ccf655bfe427ddf9b59bace24e26ff43b235
Add test for multiple items
dsolovay/AutoSitecore
src/AutoSitecoreUnitTest/AutoSitecoreCustomizationTest.cs
src/AutoSitecoreUnitTest/AutoSitecoreCustomizationTest.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using AutoSitecore; using FluentAssertions; using NSubstitute; using Ploeh.AutoFixture; using Sitecore; using Sitecore.Data; using Sitecore.Data.Items; using Sitecore.Globalization; using Xunit; using Xunit.Abstractions; namespace AutoSitecoreUnitTest { public class AutoSitecoreCustomizationTest { [Fact] public void IsAutoFixtureCustomization() { Fixture fixture = new Fixture(); ICustomization sut = new AutoSitecoreCustomization(); fixture.Customize(sut); } [Fact] public void CreatesAnonymousIds() { Fixture fixture = new Fixture(); fixture.Customize(new AutoSitecoreCustomization()); ID anonyousId = fixture.Create<ID>(); anonyousId.Should().NotBe(ID.Null); } [Fact] public void CreatesItemDefinitions() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var definition = fixture.Create<ItemDefinition>(); } [Fact] public void CreatesItemData() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var data = fixture.Create<ItemData>(); } [Fact] public void CreatesSubstituteDatabase() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var db = fixture.Create<Database>(); } [Fact] public void CreatesItemAsSubstitute() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var item = fixture.Create<Item>(); item.GetType().Should().NotBe<Item>(); item.GetType().Should().BeDerivedFrom<Item>(); item.GetType().FullName.Should().Be("Castle.Proxies.ItemProxy"); } [Fact] public void KeyIsEmpty() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var item = fixture.Create<Item>(); item.Key.Should().BeEmpty(); } [Fact] public void ItemIdsAreSame() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var item = fixture.Create<Item>(); item.ID.Should().Be(item.InnerData.Definition.ID); } [Theory, AutoSitecore] public void CanSetPath(Item item) { item.Paths.FullPath.Returns("/sitecore/content/home"); } [Theory, AutoSitecore] public void CanCreateManyItems(IEnumerable<Item> items) { items.Count().Should().Be(3, "this is AutoFixture standard behavior"); items.First().GetType().ToString().Should().Be("Castle.Proxies.ItemProxy"); items.First().ID.Should().NotBe(items.Last().ID); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using AutoSitecore; using FluentAssertions; using NSubstitute; using Ploeh.AutoFixture; using Sitecore; using Sitecore.Data; using Sitecore.Data.Items; using Sitecore.Globalization; using Xunit; using Xunit.Abstractions; namespace AutoSitecoreUnitTest { public class AutoSitecoreCustomizationTest { [Fact] public void IsAutoFixtureCustomization() { Fixture fixture = new Fixture(); ICustomization sut = new AutoSitecoreCustomization(); fixture.Customize(sut); } [Fact] public void CreatesAnonymousIds() { Fixture fixture = new Fixture(); fixture.Customize(new AutoSitecoreCustomization()); ID anonyousId = fixture.Create<ID>(); anonyousId.Should().NotBe(ID.Null); } [Fact] public void CreatesItemDefinitions() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var definition = fixture.Create<ItemDefinition>(); } [Fact] public void CreatesItemData() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var data = fixture.Create<ItemData>(); } [Fact] public void CreatesSubstituteDatabase() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var db = fixture.Create<Database>(); } [Fact] public void CreatesItemAsSubstitute() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var item = fixture.Create<Item>(); item.GetType().Should().NotBe<Item>(); item.GetType().Should().BeDerivedFrom<Item>(); item.GetType().FullName.Should().Be("Castle.Proxies.ItemProxy"); } [Fact] public void KeyIsEmpty() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var item = fixture.Create<Item>(); item.Key.Should().BeEmpty(); } [Fact] public void ItemIdsAreSame() { IFixture fixture = new Fixture().Customize(new AutoSitecoreCustomization()); var item = fixture.Create<Item>(); item.ID.Should().Be(item.InnerData.Definition.ID); } [Theory, AutoSitecore] public void CanSetPath(Item item) { item.Paths.FullPath.Returns("/sitecore/content/home"); } } }
mit
C#
b177085b32f28e297f722a1d06d670c9a3865c52
Fix question submission truncation bug
CSClassroom/CSClassroom,CSClassroom/CSClassroom,CSClassroom/CSClassroom,CSClassroom/CSClassroom,CSClassroom/CSClassroom,CSClassroom/CSClassroom
Services/src/CSClassroom/CSClassroom.WebApp/Views/Shared/_CodeEditor.cshtml
Services/src/CSClassroom/CSClassroom.WebApp/Views/Shared/_CodeEditor.cshtml
@model CodeEditorSettings @if (Model.TextArea) { <textarea name="@Model.EditorName" style="display: none"></textarea> } <div id="wrapper-@Model.EditorName"></div> <script> function createEditor(text) { $('#wrapper-@Model.EditorName').html('<pre id="@Model.EditorName"></pre>'); $('#@Model.EditorName').text(text); createCodeEditor('@Model.EditorName', @Html.Raw(Model.TextArea ? $"$(\"textarea[name = {@Model.EditorName}]\")" : "undefined"), @Model.MinLines, @Model.MaxLines); } var initialContents = @Json.Serialize(Model.InitialContents); createEditor(initialContents); </script> @if (!string.IsNullOrEmpty(Model.RevertContents)) { <script> function revertCodeEditor() { var revertContents = @Json.Serialize(Model.RevertContents); createEditor(revertContents); } $(function() { $("#revert").css('display', '').click(revertCodeEditor); }) </script> }
@model CodeEditorSettings @if (Model.TextArea) { <textarea name="@Model.EditorName" style="display: none"></textarea> } <div id="wrapper-@Model.EditorName"></div> <script> function createEditor(text) { $('#wrapper-@Model.EditorName').html('<pre id="@Model.EditorName">' + (text != null ? text : '') + '</pre>'); createCodeEditor('@Model.EditorName', @Html.Raw(Model.TextArea ? $"$(\"textarea[name = {@Model.EditorName}]\")" : "undefined"), @Model.MinLines, @Model.MaxLines); } var initialContents = @Json.Serialize(Model.InitialContents); createEditor(initialContents); </script> @if (!string.IsNullOrEmpty(Model.RevertContents)) { <script> function revertCodeEditor() { var revertContents = @Json.Serialize(Model.RevertContents); createEditor(revertContents); } $(function() { $("#revert").css('display', '').click(revertCodeEditor); }) </script> }
mit
C#
2c68ba879ac9c2dab343b160c814861274c1c180
comment out for now
aritchie/userdialogs
src/Acr.UserDialogs.Android/Fragments/LoadingFragment.cs
src/Acr.UserDialogs.Android/Fragments/LoadingFragment.cs
//using System; //using Android.Content; //using Android.OS; //using Android.Support.V7.App; //using AndroidHUD; //namespace Acr.UserDialogs.Fragments //{ // public class LoadingFragment : AppCompatDialogFragment // { // public ProgressDialog Config { get; set; } // public override void OnSaveInstanceState(Bundle bundle) // { // base.OnSaveInstanceState(bundle); // ConfigStore.Instance.Store(bundle, this.Config); // } // public override void OnViewStateRestored(Bundle bundle) // { // base.OnViewStateRestored(bundle); // if (this.Config == null) // this.Config = ConfigStore.Instance.Pop<ProgressDialog>(bundle); // } // public override void OnAttach(Context context) // { // base.OnAttach(context); // if (this.Config.IsShowing) // this.Config.Show(); // } // public override void OnDetach() // { // base.OnDetach(); // try // { // AndHUD.Shared.Dismiss(this.Activity); // } // catch { } // } // } //}
using System; using Android.App; using Android.Content; using Android.OS; using Android.Support.V7.App; using AndroidHUD; namespace Acr.UserDialogs.Fragments { public class LoadingFragment : AppCompatDialogFragment { public ProgressDialog Config { get; set; } public override void OnSaveInstanceState(Bundle bundle) { base.OnSaveInstanceState(bundle); ConfigStore.Instance.Store(bundle, this.Config); } public override void OnViewStateRestored(Bundle bundle) { base.OnViewStateRestored(bundle); if (this.Config == null) this.Config = ConfigStore.Instance.Pop<ProgressDialog>(bundle); } public override void OnAttach(Context context) { base.OnAttach(context); if (this.Config.IsShowing) this.Config.Show(); } public override void OnDetach() { base.OnDetach(); try { AndHUD.Shared.Dismiss(this.Activity); } catch { } } } }
mit
C#
fa2d262146a3924403487fbc6153b3af9fec2237
Update commented-out Database.SetInitializer
shrishrirang/azure-mobile-apps-quickstarts,Azure/azure-mobile-apps-quickstarts,shrishrirang/azure-mobile-apps-quickstarts,Azure/azure-mobile-apps-quickstarts,Azure/azure-mobile-apps-quickstarts,shrishrirang/azure-mobile-apps-quickstarts,lindydonna/azure-mobile-apps-quickstarts,Azure/azure-mobile-apps-quickstarts,Azure/azure-mobile-apps-quickstarts,lindydonna/azure-mobile-apps-quickstarts,lindydonna/azure-mobile-apps-quickstarts,shrishrirang/azure-mobile-apps-quickstarts,lindydonna/azure-mobile-apps-quickstarts,shrishrirang/azure-mobile-apps-quickstarts,lindydonna/azure-mobile-apps-quickstarts,Azure/azure-mobile-apps-quickstarts,shrishrirang/azure-mobile-apps-quickstarts,lindydonna/azure-mobile-apps-quickstarts
backend/dotnet/Quickstart/ZUMOAPPNAMEService/App_Start/Startup.MobileApp.cs
backend/dotnet/Quickstart/ZUMOAPPNAMEService/App_Start/Startup.MobileApp.cs
using System; using System.Collections.Generic; using System.Data.Entity; using System.Web.Http; using Microsoft.Azure.Mobile.Server.Config; using ZUMOAPPNAMEService.DataObjects; using ZUMOAPPNAMEService.Models; using Owin; namespace ZUMOAPPNAMEService { public partial class Startup { public static void ConfigureMobileApp(IAppBuilder app) { HttpConfiguration config = new HttpConfiguration(); //For more information on Web API tracing, see http://go.microsoft.com/fwlink/?LinkId=620686 config.EnableSystemDiagnosticsTracing(); new MobileAppConfiguration() .UseDefaultConfiguration() .ApplyTo(config); // Use Entity Framework Code First to create database tables based on your DbContext Database.SetInitializer(new ZUMOAPPNAMEInitializer()); // To prevent Entity Framework from modifying your database schema, use a null database initializer // Database.SetInitializer<ZUMOAPPNAMEContext>(null); app.UseMobileAppAuthentication(config); app.UseWebApi(config); } } public class ZUMOAPPNAMEInitializer : CreateDatabaseIfNotExists<ZUMOAPPNAMEContext> { protected override void Seed(ZUMOAPPNAMEContext context) { List<TodoItem> todoItems = new List<TodoItem> { new TodoItem { Id = Guid.NewGuid().ToString(), Text = "First item", Complete = false }, new TodoItem { Id = Guid.NewGuid().ToString(), Text = "Second item", Complete = false }, }; foreach (TodoItem todoItem in todoItems) { context.Set<TodoItem>().Add(todoItem); } base.Seed(context); } } }
using System; using System.Collections.Generic; using System.Data.Entity; using System.Web.Http; using Microsoft.Azure.Mobile.Server.Config; using ZUMOAPPNAMEService.DataObjects; using ZUMOAPPNAMEService.Models; using Owin; namespace ZUMOAPPNAMEService { public partial class Startup { public static void ConfigureMobileApp(IAppBuilder app) { HttpConfiguration config = new HttpConfiguration(); //For more information on Web API tracing, see http://go.microsoft.com/fwlink/?LinkId=620686 config.EnableSystemDiagnosticsTracing(); new MobileAppConfiguration() .UseDefaultConfiguration() .ApplyTo(config); // Use Entity Framework Code First to create database tables based on your DbContext Database.SetInitializer(new ZUMOAPPNAMEInitializer()); // To prevent Entity Framework from modifying your database schema, use a null database initializer // Database.SetInitializer(null); app.UseMobileAppAuthentication(config); app.UseWebApi(config); } } public class ZUMOAPPNAMEInitializer : CreateDatabaseIfNotExists<ZUMOAPPNAMEContext> { protected override void Seed(ZUMOAPPNAMEContext context) { List<TodoItem> todoItems = new List<TodoItem> { new TodoItem { Id = Guid.NewGuid().ToString(), Text = "First item", Complete = false }, new TodoItem { Id = Guid.NewGuid().ToString(), Text = "Second item", Complete = false }, }; foreach (TodoItem todoItem in todoItems) { context.Set<TodoItem>().Add(todoItem); } base.Seed(context); } } }
apache-2.0
C#
f23e39237915011dfb7aed406f11805fb9a8a3c3
Add method to GetPresignedUrlRequest and update to class
carbon/Amazon
src/Amazon.S3/Actions/GetUrlRequest.cs
src/Amazon.S3/Actions/GetUrlRequest.cs
using System; namespace Amazon.S3 { public class GetPresignedUrlRequest { public GetPresignedUrlRequest( string method, string host, AwsRegion region, string bucketName, string objectKey, TimeSpan expiresIn) { Method = method ?? throw new ArgumentException(nameof(method)); Host = host ?? throw new ArgumentNullException(nameof(host)); Region = region; BucketName = bucketName ?? throw new ArgumentNullException(nameof(bucketName)); Key = objectKey; ExpiresIn = expiresIn; } public string Method { get; } public string Host { get; } public string BucketName { get; } public AwsRegion Region { get; } public string Key { get; } public TimeSpan ExpiresIn { get; } } }
using System; namespace Amazon.S3 { public readonly struct GetPresignedUrlRequest { public GetPresignedUrlRequest( string host, AwsRegion region, string bucketName, string objectKey, TimeSpan expiresIn) { Host = host ?? throw new ArgumentNullException(nameof(host)); Region = region; BucketName = bucketName ?? throw new ArgumentNullException(nameof(bucketName)); Key = objectKey; ExpiresIn = expiresIn; } public readonly string Host; public readonly string BucketName; public readonly AwsRegion Region; public readonly string Key; public readonly TimeSpan ExpiresIn; } }
mit
C#
8b2d18503e583d538099f7aa63c8c04d4c91cbe7
bump to 1.0
jorisvergeer/Envify,Fody/Stamp
CommonAssemblyInfo.cs
CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("Stamp")] [assembly: AssemblyProduct("Stamp")] [assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyFileVersion("1.0.0")]
using System.Reflection; [assembly: AssemblyTitle("Stamp")] [assembly: AssemblyProduct("Stamp")] [assembly: AssemblyVersion("0.8.3")] [assembly: AssemblyFileVersion("0.8.3")]
mit
C#
483db14ff75496ae46d088373d4fce997e8c6924
Change library version to 0.8.1
CurrencyCloud/currencycloud-net
Source/CurrencyCloud/Properties/AssemblyInfo.cs
Source/CurrencyCloud/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("CurrencyCloud")] [assembly: AssemblyDescription("CurrencyCloud API client library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Currency Cloud")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("Copyright © Currency Cloud 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e2c08eff-8a14-4c77-abd3-c9e193ae81e8")] // 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.8.1.0")] [assembly: AssemblyFileVersion("0.8.1.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("CurrencyCloud")] [assembly: AssemblyDescription("CurrencyCloud API client library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Currency Cloud")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("Copyright © Currency Cloud 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("e2c08eff-8a14-4c77-abd3-c9e193ae81e8")] // 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.7.4.0")] [assembly: AssemblyFileVersion("0.7.4.0")]
mit
C#
c7ad9b5b5822866473489b97e5279fcd1a121e65
Update SerializationRestFactory.cs
tiksn/TIKSN-Framework
TIKSN.Core/Web/Rest/SerializationRestFactory.cs
TIKSN.Core/Web/Rest/SerializationRestFactory.cs
using System; using System.Collections.Generic; using TIKSN.Serialization; namespace TIKSN.Web.Rest { public class SerializationRestFactory : ISerializerRestFactory, IDeserializerRestFactory { private readonly IDictionary<string, Tuple<ISerializer<string>, IDeserializer<string>>> map; public SerializationRestFactory(JsonSerializer jsonSerializer, JsonDeserializer jsonDeserializer, DotNetXmlSerializer dotNetXmlSerializer, DotNetXmlDeserializer dotNetXmlDeserializer) { this.map = new Dictionary<string, Tuple<ISerializer<string>, IDeserializer<string>>>(); this.map.Add("application/json", new Tuple<ISerializer<string>, IDeserializer<string>>(jsonSerializer, jsonDeserializer)); this.map.Add("application/xml", new Tuple<ISerializer<string>, IDeserializer<string>>(dotNetXmlSerializer, dotNetXmlDeserializer)); } IDeserializer<string> IDeserializerRestFactory.Create(string mediaType) => this.map[mediaType].Item2; ISerializer<string> ISerializerRestFactory.Create(string mediaType) => this.map[mediaType].Item1; } }
using System; using System.Collections.Generic; using TIKSN.Serialization; namespace TIKSN.Web.Rest { public class SerializationRestFactory : ISerializerRestFactory, IDeserializerRestFactory { private readonly IDictionary<string, Tuple<ISerializer<string>, IDeserializer<string>>> map; public SerializationRestFactory(JsonSerializer jsonSerializer, JsonDeserializer jsonDeserializer, DotNetXmlSerializer dotNetXmlSerializer, DotNetXmlDeserializer dotNetXmlDeserializer) { map = new Dictionary<string, Tuple<ISerializer<string>, IDeserializer<string>>>(); map.Add("application/json", new Tuple<ISerializer<string>, IDeserializer<string>>(jsonSerializer, jsonDeserializer)); map.Add("application/xml", new Tuple<ISerializer<string>, IDeserializer<string>>(dotNetXmlSerializer, dotNetXmlDeserializer)); } IDeserializer<string> IDeserializerRestFactory.Create(string mediaType) { return map[mediaType].Item2; } ISerializer<string> ISerializerRestFactory.Create(string mediaType) { return map[mediaType].Item1; } } }
mit
C#
ff781b5fd5d8728fec8cc0aa7a68dcefb4e99d38
change metadata documentation for parameter
dgg/NMoneys.Web,dgg/NMoneys.Web,dgg/NMoneys.Web
src/Web/Api/v1/Messages/MultiFormat.cs
src/Web/Api/v1/Messages/MultiFormat.cs
using NMoneys.Web.ApiModel.v1.Datatypes; using NMoneys.Web.ApiModel.v1.Messages; using ServiceStack.ServiceHost; namespace NMoneys.Web.Api.v1.Messages { [Route("/v1/currencies/format", "POST", Summary = "")] [Api("Allows formatting monetary amounts according to their currencies.")] public class MultiFormat : IReturn<MultiFormatResponse> { [ApiMember(IsRequired = true, ParameterType = "body", Verb = "POST", Description = "Quantities to be formatted.")] public FormatableQuantity[] Quantities { get; set; } } public class MultiFormatResponse : IMultiFormatResponse { public FormattedMoney[] Moneys { get; set; } } }
using NMoneys.Web.ApiModel.v1.Datatypes; using NMoneys.Web.ApiModel.v1.Messages; using ServiceStack.ServiceHost; namespace NMoneys.Web.Api.v1.Messages { [Route("/v1/currencies/format", "POST", Summary = "")] [Api("Allows formatting monetary amounts according to their currencies.")] public class MultiFormat : IReturn<MultiFormatResponse> { [ApiMember(IsRequired = true, ParameterType = "body", Verb = "POST", Description = "Three-letter ISO code of the currency to use for formatting.")] public FormatableQuantity[] Quantities { get; set; } } public class MultiFormatResponse : IMultiFormatResponse { public FormattedMoney[] Moneys { get; set; } } }
bsd-2-clause
C#
59dd401b7a25a53fdf294568a9742dea66f0d566
Add agent to web owin middleware
pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype
src/Glimpse.Host.Web.Owin/GlimpseMiddleware.cs
src/Glimpse.Host.Web.Owin/GlimpseMiddleware.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; using Glimpse.Host.Web.Owin.Framework; using Glimpse.Agent.Web; namespace Glimpse.Host.Web.Owin { public class GlimpseMiddleware { private readonly Func<IDictionary<string, object>, Task> _innerNext; private readonly WebAgentRuntime _runtime; public GlimpseMiddleware(Func<IDictionary<string, object>, Task> innerNext) { _innerNext = innerNext; _runtime = new WebAgentRuntime(); // TODO: This shouldn't have this direct depedency } public async Task Invoke(IDictionary<string, object> environment) { var newContext = new HttpContext(environment); _runtime.Begin(newContext); await _innerNext(environment); _runtime.End(newContext); } } }
using System; using System.Collections.Generic; using System.Threading.Tasks; using Glimpse.Host.Web.Owin.Framework; namespace Glimpse.Host.Web.Owin { public class GlimpseMiddleware { private readonly Func<IDictionary<string, object>, Task> _innerNext; public GlimpseMiddleware(Func<IDictionary<string, object>, Task> innerNext) { _innerNext = innerNext; } public async Task Invoke(IDictionary<string, object> environment) { var newContext = new HttpContext(environment); await _innerNext(environment); } } }
mit
C#
94fab797716895235e2c9dd3c47355d29bfc38b7
Add some cool docs about IDynamicEndpointMetadata.
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Http/Routing/src/Matching/MatcherPolicy.cs
src/Http/Routing/src/Matching/MatcherPolicy.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Matching; namespace Microsoft.AspNetCore.Routing { /// <summary> /// Defines a policy that applies behaviors to the URL matcher. Implementations /// of <see cref="MatcherPolicy"/> and related interfaces must be registered /// in the dependency injection container as singleton services of type /// <see cref="MatcherPolicy"/>. /// </summary> /// <remarks> /// <see cref="MatcherPolicy"/> implementations can implement the following /// interfaces <see cref="IEndpointComparerPolicy"/>, <see cref="IEndpointSelectorPolicy"/>, /// and <see cref="INodeBuilderPolicy"/>. /// </remarks> public abstract class MatcherPolicy { /// <summary> /// Gets a value that determines the order the <see cref="MatcherPolicy"/> should /// be applied. Policies are applied in ascending numeric value of the <see cref="Order"/> /// property. /// </summary> public abstract int Order { get; } /// <summary> /// Returns a value that indicates whether the provided <paramref name="endpoints"/> contains /// one or more dynamic endpoints. /// </summary> /// <param name="endpoints">The set of endpoints.</param> /// <returns><c>true</c> if a dynamic endpoint is found; otherwise returns <c>false</c>.</returns> /// <remarks> /// <para> /// The presence of <see cref="IDynamicEndpointMetadata"/> signifies that an endpoint that may be replaced /// during processing by an <see cref="IEndpointSelectorPolicy"/>. /// </para> /// <para> /// An implementation of <see cref="INodeBuilderPolicy"/> should also implement <see cref="IEndpointSelectorPolicy"/> /// and use its <see cref="IEndpointSelectorPolicy"/> implementation when a node contains a dynamic endpoint. /// <see cref="INodeBuilderPolicy"/> implementations rely on caching of data based on a static set of endpoints. This /// is not possible when endpoints are replaced dynamically. /// </para> /// </remarks> protected static bool ContainsDynamicEndpoints(IReadOnlyList<Endpoint> endpoints) { if (endpoints == null) { throw new ArgumentNullException(nameof(endpoints)); } for (var i = 0; i < endpoints.Count; i++) { var metadata = endpoints[i].Metadata.GetMetadata<IDynamicEndpointMetadata>(); if (metadata?.IsDynamic == true) { return true; } } return false; } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Matching; namespace Microsoft.AspNetCore.Routing { /// <summary> /// Defines a policy that applies behaviors to the URL matcher. Implementations /// of <see cref="MatcherPolicy"/> and related interfaces must be registered /// in the dependency injection container as singleton services of type /// <see cref="MatcherPolicy"/>. /// </summary> /// <remarks> /// <see cref="MatcherPolicy"/> implementations can implement the following /// interfaces <see cref="IEndpointComparerPolicy"/>, <see cref="IEndpointSelectorPolicy"/>, /// and <see cref="INodeBuilderPolicy"/>. /// </remarks> public abstract class MatcherPolicy { /// <summary> /// Gets a value that determines the order the <see cref="MatcherPolicy"/> should /// be applied. Policies are applied in ascending numeric value of the <see cref="Order"/> /// property. /// </summary> public abstract int Order { get; } /// <summary> /// Returns a value that indicates whether the provided <paramref name="endpoints"/> contains /// one or more dynamic endpoints. /// </summary> /// <param name="endpoints">The set of endpoints.</param> /// <returns><c>true</c> if a dynamic endpoint is found; otherwise returns <c>false</c>.</returns> protected static bool ContainsDynamicEndpoints(IReadOnlyList<Endpoint> endpoints) { if (endpoints == null) { throw new ArgumentNullException(nameof(endpoints)); } for (var i = 0; i < endpoints.Count; i++) { var metadata = endpoints[i].Metadata.GetMetadata<IDynamicEndpointMetadata>(); if (metadata?.IsDynamic == true) { return true; } } return false; } } }
apache-2.0
C#
f87e9b801716136e0ad43d124bc1b312b5b6212f
Remove unnecessary tooltip text
ZLima12/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,EVAST9919/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu,2yangk23/osu,NeoAdonis/osu,smoogipooo/osu,ZLima12/osu,EVAST9919/osu,peppy/osu,NeoAdonis/osu,johnneijzen/osu,smoogipoo/osu,peppy/osu-new,johnneijzen/osu,UselessToucan/osu,ppy/osu,2yangk23/osu
osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs
osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Profile.Sections { /// <summary> /// Display artist/title/mapper information, commonly used as the left portion of a profile or score display row (see <see cref="DrawableProfileRow"/>). /// </summary> public abstract class BeatmapMetadataContainer : OsuHoverContainer { private readonly BeatmapInfo beatmap; protected BeatmapMetadataContainer(BeatmapInfo beatmap) { this.beatmap = beatmap; AutoSizeAxes = Axes.Both; } [BackgroundDependencyLoader(true)] private void load(BeatmapSetOverlay beatmapSetOverlay) { Action = () => { if (beatmap.OnlineBeatmapID != null) beatmapSetOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value); else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); }; Child = new FillFlowContainer { AutoSizeAxes = Axes.Both, Children = CreateText(beatmap), }; } protected abstract Drawable[] CreateText(BeatmapInfo beatmap); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Profile.Sections { /// <summary> /// Display artist/title/mapper information, commonly used as the left portion of a profile or score display row (see <see cref="DrawableProfileRow"/>). /// </summary> public abstract class BeatmapMetadataContainer : OsuHoverContainer { private readonly BeatmapInfo beatmap; protected BeatmapMetadataContainer(BeatmapInfo beatmap) { this.beatmap = beatmap; AutoSizeAxes = Axes.Both; TooltipText = $"{beatmap.Metadata.Artist} - {beatmap.Metadata.Title}"; } [BackgroundDependencyLoader(true)] private void load(BeatmapSetOverlay beatmapSetOverlay) { Action = () => { if (beatmap.OnlineBeatmapID != null) beatmapSetOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value); else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); }; Child = new FillFlowContainer { AutoSizeAxes = Axes.Both, Children = CreateText(beatmap), }; } protected abstract Drawable[] CreateText(BeatmapInfo beatmap); } }
mit
C#
6b2885a80be20f116e0a5207c4694ff5434cd7bd
Bump version number
chriscena/Helsenorge.Messaging
GlobalAssemblyInfo.cs
GlobalAssemblyInfo.cs
using System; 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: AssemblyConfiguration("")] [assembly: AssemblyCompany("Direktoratet for e-helse")] [assembly: AssemblyProduct("Helsenorge.Messaging")] [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)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: CLSCompliant(false)]
using System; 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: AssemblyConfiguration("")] [assembly: AssemblyCompany("Direktoratet for e-helse")] [assembly: AssemblyProduct("Helsenorge.Messaging")] [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)] // 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.25.0")] [assembly: AssemblyFileVersion("1.0.25.0")] [assembly: CLSCompliant(false)]
mit
C#
83e908fc2d05a0867216f48cf5def8db86419b6a
add indexer to PipelineContext (as before)
dotJEM/web-host,dotJEM/web-host,dotJEM/web-host
src/DotJEM.Web.Host/Providers/AsyncPipeline/IPipelineContext.cs
src/DotJEM.Web.Host/Providers/AsyncPipeline/IPipelineContext.cs
using System; using System.Collections.Generic; namespace DotJEM.Web.Host.Providers.AsyncPipeline { public interface IPipelineContext { object this[string key] { get; set; } bool TryGetValue(string key, out object value); object GetParameter(string key); IPipelineContext Replace(params (string key, object value)[] values); IPipelineContext Add(string key, object value); IPipelineContext Set(string key, object value); } public class PipelineContext : IPipelineContext { private readonly Dictionary<string, object> parameters = new(); public object this[string key] { get => parameters[key]; set => parameters[key] = value; } public virtual bool TryGetValue(string key, out object value) => parameters.TryGetValue(key, out value); public virtual object GetParameter(string key) { return parameters.TryGetValue(key, out object value) ? value : null; } public virtual IPipelineContext Replace(params (string key, object value)[] values) { foreach ((string key, object value) in values) { if (!parameters.ContainsKey(key)) throw new MissingMemberException(""); parameters[key] = value; } return this; } public IPipelineContext Add(string key, object value) { parameters.Add(key, value); return this; } public IPipelineContext Set(string key, object value) { parameters[key] = value; return this; } } }
using System; using System.Collections.Generic; namespace DotJEM.Web.Host.Providers.AsyncPipeline { public interface IPipelineContext { bool TryGetValue(string key, out object value); object GetParameter(string key); IPipelineContext Replace(params (string key, object value)[] values); IPipelineContext Add(string key, object value); IPipelineContext Set(string key, object value); } public class PipelineContext : IPipelineContext { private readonly Dictionary<string, object> parameters = new(); public virtual bool TryGetValue(string key, out object value) => parameters.TryGetValue(key, out value); public virtual object GetParameter(string key) { return parameters.TryGetValue(key, out object value) ? value : null; } public virtual IPipelineContext Replace(params (string key, object value)[] values) { foreach ((string key, object value) in values) { if (!parameters.ContainsKey(key)) throw new MissingMemberException(""); parameters[key] = value; } return this; } public IPipelineContext Add(string key, object value) { parameters.Add(key, value); return this; } public IPipelineContext Set(string key, object value) { parameters[key] = value; return this; } } }
mit
C#
7f1f8e56260a92096673d69a0549804e7a3c5fa1
Use FontAwesome icons as bullets in Resources list
codingteam/codingteam.org.ru,codingteam/codingteam.org.ru
Views/Home/Resources.cshtml
Views/Home/Resources.cshtml
<h1>Resources</h1> <p>Here is a list of codingteam affiliated online resources:</p> <ul class="fa-ul"> <li> <a href="https://github.com/codingteam/"> <i class="fa-li fa fa-github"></i> GitHub organization </a> </li> <li> <a href="https://gitter.im/codingteam"> <i class="fa-li fa fa-users"></i> Gitter room </a> </li> <li> <a href="https://bitbucket.org/codingteam"> <i class="fa-li fa fa-bitbucket"></i> Bitbucket team </a> </li> <li> <a href="https://gitlab.com/groups/codingteam"> <i class="fa-li fa fa-code-fork"></i> GitLab team </a> </li> <li> <a href="http://www.loglist.net/"> <i class="fa-li fa fa-ambulance"></i> LogList </a> </li> <li> <a href="xmpp:codingteam@conference.jabber.ru?join"> <i class="fa-li fa fa-lightbulb-o"></i> XMPP conference </a> </li> </ul>
<h1>Resources</h1> <p>Here is a list of codingteam affiliated online resources:</p> <ul> <li> <a href="https://github.com/codingteam/"> <i class="fa fa-github"></i> GitHub organization </a> </li> <li> <a href="https://gitter.im/codingteam"> <i class="fa fa-users"></i> Gitter room </a> </li> <li> <a href="https://bitbucket.org/codingteam"> <i class="fa fa-bitbucket"></i> Bitbucket team </a> </li> <li> <a href="https://gitlab.com/groups/codingteam"> <i class="fa fa-code-fork"></i> GitLab team </a> </li> <li> <a href="http://www.loglist.net/"> <i class="fa fa-ambulance"></i> LogList </a> </li> <li> <a href="xmpp:codingteam@conference.jabber.ru?join"> <i class="fa fa-lightbulb-o"></i> XMPP conference </a> </li> </ul>
mit
C#
dce45bb2d19af726baabd75203075c91d4794d78
Add test for anonymous type and InternalsVisibleTo
ProxyFoo/ProxyFoo
source/ProxyFoo.Tests/Functional/DuckUseCaseTests.cs
source/ProxyFoo.Tests/Functional/DuckUseCaseTests.cs
#region Apache License Notice // Copyright © 2014, Silverlake Software LLC // // 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.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using NUnit.Framework; [assembly: InternalsVisibleTo("ZPFD.Functional.DuckUseCaseTests.WorksWithAnonymousTypes")] namespace ProxyFoo.Tests.Functional { [TestFixture] public class DuckUseCaseTests : ProxyFooTestsBase { public class CompatibleSample<T> : IEnumerable<T> { readonly List<T> _values = new List<T>(); IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public IEnumerator<T> GetEnumerator() { return _values.GetEnumerator(); } public void Add(T value) { _values.Add(value); } } public interface IAdd<in T> { void Add(T value); } [Test] public void ObjectInitializerCompatible() { var sample = new CompatibleSample<int>(); object result = Duck.Cast<IAdd<int>>(sample); var sampleEnumerable = result as IEnumerable; var sampleEnumerableInt = result as IEnumerable<int>; var sampleAdd = result as IAdd<int>; Assert.That(sampleEnumerable, Is.Not.Null); Assert.That(sampleEnumerableInt, Is.Not.Null); Assert.That(sampleAdd, Is.Not.Null); } public interface ITest { double Value { get; } } [Test] public void WorksWithAnonymousTypes() { var test = Duck.Cast<ITest>( new {Value = 1d}); Assert.That(test, Is.Not.Null); Assert.That(test.Value, Is.EqualTo(1d)); } } }
#region Apache License Notice // Copyright © 2014, Silverlake Software LLC // // 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.Collections; using System.Collections.Generic; using NUnit.Framework; namespace ProxyFoo.Tests.Functional { [TestFixture] public class DuckUseCaseTests : ProxyFooTestsBase { public class CompatibleSample<T> : IEnumerable<T> { readonly List<T> _values = new List<T>(); IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public IEnumerator<T> GetEnumerator() { return _values.GetEnumerator(); } public void Add(T value) { _values.Add(value); } } public interface IAdd<in T> { void Add(T value); } [Test] public void ObjectInitializerCompatible() { var sample = new CompatibleSample<int>(); object result = Duck.Cast<IAdd<int>>(sample); var sampleEnumerable = result as IEnumerable; var sampleEnumerableInt = result as IEnumerable<int>; var sampleAdd = result as IAdd<int>; Assert.That(sampleEnumerable, Is.Not.Null); Assert.That(sampleEnumerableInt, Is.Not.Null); Assert.That(sampleAdd, Is.Not.Null); } } }
apache-2.0
C#
069f299b8a78e3bcadd52bb5bfc18429ff7fe4a0
Remove duplicated CornerRadius
jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,grokys/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex
src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs
src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs
using System; using Avalonia.Controls.Generators; using Avalonia.Controls.Platform; using Avalonia.Controls.Primitives; using Avalonia.LogicalTree; namespace Avalonia.Controls { public class MenuFlyoutPresenter : MenuBase { public MenuFlyoutPresenter() :base(new DefaultMenuInteractionHandler(true)) { } public override void Close() { // DefaultMenuInteractionHandler calls this var host = this.FindLogicalAncestorOfType<Popup>(); if (host != null) { SelectedIndex = -1; host.IsOpen = false; } } public override void Open() { throw new NotSupportedException("Use MenuFlyout.ShowAt(Control) instead"); } protected override IItemContainerGenerator CreateItemContainerGenerator() { return new MenuItemContainerGenerator(this); } } }
using System; using Avalonia.Controls.Generators; using Avalonia.Controls.Platform; using Avalonia.Controls.Primitives; using Avalonia.LogicalTree; namespace Avalonia.Controls { public class MenuFlyoutPresenter : MenuBase { public static readonly StyledProperty<CornerRadius> CornerRadiusProperty = Border.CornerRadiusProperty.AddOwner<FlyoutPresenter>(); public CornerRadius CornerRadius { get => GetValue(CornerRadiusProperty); set => SetValue(CornerRadiusProperty, value); } public MenuFlyoutPresenter() :base(new DefaultMenuInteractionHandler(true)) { } public override void Close() { // DefaultMenuInteractionHandler calls this var host = this.FindLogicalAncestorOfType<Popup>(); if (host != null) { SelectedIndex = -1; host.IsOpen = false; } } public override void Open() { throw new NotSupportedException("Use MenuFlyout.ShowAt(Control) instead"); } protected override IItemContainerGenerator CreateItemContainerGenerator() { return new MenuItemContainerGenerator(this); } } }
mit
C#
c2fd2466dc6cafbabdec5dce35f0ca20df6bb388
Update Viktor.cs
FireBuddy/adevade
AdEvade/AdEvade/Data/Spells/SpecialSpells/Viktor.cs
AdEvade/AdEvade/Data/Spells/SpecialSpells/Viktor.cs
using System; using EloBuddy; using EloBuddy.SDK; namespace AdEvade.Data.Spells.SpecialSpells { class Viktor : IChampionPlugin { static Viktor() { } public const string ChampionName = "Viktor"; public string GetChampionName() { return ChampionName; } public void LoadSpecialSpell(SpellData spellData) { if (spellData.SpellName == "ViktorDeathRay") { Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpellCast3; } } private static void Obj_AI_Base_OnProcessSpellCast3(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender != null && sender.Team != ObjectManager.Player.Team && args.SData.Name != null && args.SData.Name == "ViktorDeathRay") { . var End = new vector3() => enemy.GetWaypoints().Last(); // var missileDist = End.To2D().Distance(args.Start.To2D()); // var delay = missileDist / 1.5f + 600; // spellData.SpellDelay = delay; // SpellDetector.CreateSpellData(sender, args.Start, End, spellData); } } } }
using System; using EloBuddy; using EloBuddy.SDK; namespace AdEvade.Data.Spells.SpecialSpells { class Viktor : IChampionPlugin { static Viktor() { } public const string ChampionName = "Viktor"; public string GetChampionName() { return ChampionName; } public void LoadSpecialSpell(SpellData spellData) { if (spellData.SpellName == "ViktorDeathRay") { Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpellCast3; } } private static void Obj_AI_Base_OnProcessSpellCast3(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender != null && sender.Team != ObjectManager.Player.Team && args.SData.Name != null && args.SData.Name == "ViktorDeathRay") { . var End = new vector3 => enemy.GetWaypoints().Last(); // var missileDist = End.To2D().Distance(args.Start.To2D()); // var delay = missileDist / 1.5f + 600; // spellData.SpellDelay = delay; // SpellDetector.CreateSpellData(sender, args.Start, End, spellData); } } } }
mit
C#
57e9fa2c5be57b1f50ebfc49d74ea8f26cf62433
Update Assets/MixedRealityToolkit/Utilities/CameraCache.cs
killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
Assets/MixedRealityToolkit/Utilities/CameraCache.cs
Assets/MixedRealityToolkit/Utilities/CameraCache.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEngine; namespace Microsoft.MixedReality.Toolkit.Utilities { /// <summary> /// The purpose of this class is to provide a cached reference to the main camera. Calling Camera.main /// executes a FindByTag on the scene, which will get worse and worse with more tagged objects. /// </summary> public static class CameraCache { private static Camera cachedCamera; /// <summary> /// Returns a cached reference to the main camera and uses Camera.main if it hasn't been cached yet. /// </summary> public static Camera Main { get { if (cachedCamera != null) { return cachedCamera; } // If the cached camera is null, search for main var mainCamera = Camera.main; if (mainCamera == null) { // If no main camera was found, create it now Debug.LogWarning("No main camera found. The Mixed Reality Toolkit requires at least one camera in the scene. One will be generated now."); mainCamera = new GameObject("Main Camera", typeof(Camera)) { tag = "MainCamera" }.GetComponent<Camera>(); } // Cache the main camera cachedCamera = mainCamera; return cachedCamera; } } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEngine; namespace Microsoft.MixedReality.Toolkit.Utilities { /// <summary> /// The purpose of this class is to provide a cached reference to the main camera. Calling Camera.main /// executes a FindByTag on the scene, which will get worse and worse with more tagged objects. /// </summary> public static class CameraCache { private static Camera cachedCamera; /// <summary> /// Returns a cached reference to the main camera and uses Camera.main if it hasn't been cached yet. /// </summary> public static Camera Main { get { if (cachedCamera != null) { return cachedCamera; } // If the cached camera is null, search for main var mainCamera = Camera.main; if (mainCamera == null) { // If no main camera was found, create it now Debug.LogWarning("No main camera found. The mixed reality toolkit requires at least one camera in the scene. One will be generated now."); mainCamera = new GameObject("Main Camera", typeof(Camera)) { tag = "MainCamera" }.GetComponent<Camera>(); } // Cache the main camera cachedCamera = mainCamera; return cachedCamera; } } } }
mit
C#
ffa9d6c7c512b7716465872c1e83f9000e71fc78
Fix crash editing artifact
ermshiperete/BuildDependency
BuildDependencyManager/Dialogs/ImportDialogModel.cs
BuildDependencyManager/Dialogs/ImportDialogModel.cs
// Copyright (c) 2014-2015 Eberhard Beilharz // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Collections.Generic; using System.Threading.Tasks; using BuildDependency.TeamCity; using BuildDependency.TeamCity.RestClasses; namespace BuildDependency.Manager.Dialogs { public class ImportDialogModel { public TeamCityApi TeamCity { get; set; } public List<ArtifactProperties> Artifacts { get; private set; } public async Task<List<Project>> GetProjects() { if (TeamCity == null) return null; var allProjects = await TeamCity.GetAllProjectsAsync(); if (allProjects != null) allProjects.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.OrdinalIgnoreCase)); return allProjects; } public Task<List<BuildType>> GetConfigurationsForProjectTask(string projectId) { return TeamCity.GetBuildTypesForProjectTask(projectId); } public async Task LoadArtifacts(string configId) { Artifacts = new List<ArtifactProperties>(); var deps = await TeamCity.GetArtifactDependenciesAsync(configId); if (deps != null) { foreach (var dep in deps) { if (dep.Properties != null) Artifacts.Add(new ArtifactProperties(dep.Properties)); } } } } }
// Copyright (c) 2014-2015 Eberhard Beilharz // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Collections.Generic; using System.Threading.Tasks; using BuildDependency.TeamCity; using BuildDependency.TeamCity.RestClasses; namespace BuildDependency.Manager.Dialogs { public class ImportDialogModel { public TeamCityApi TeamCity { get; set; } public List<ArtifactProperties> Artifacts { get; private set; } public async Task<List<Project>> GetProjects() { if (TeamCity == null) return null; var allProjects = await TeamCity.GetAllProjectsAsync(); if (allProjects != null) allProjects.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.OrdinalIgnoreCase)); return allProjects; } public Task<List<BuildType>> GetConfigurationsForProjectTask(string projectId) { return TeamCity.GetBuildTypesForProjectTask(projectId); } public async Task LoadArtifacts(string configId) { Artifacts = new List<ArtifactProperties>(); var deps = await TeamCity.GetArtifactDependenciesAsync(configId); if (deps != null) { foreach (var dep in deps) { Artifacts.Add(new ArtifactProperties(dep.Properties)); } } } } }
mit
C#
2055625c6d48cd662849598dfc2a58ca2da19583
Update AlphaStreamsSlippageModel.cs
JKarathiya/Lean,StefanoRaggi/Lean,AlexCatarino/Lean,JKarathiya/Lean,AlexCatarino/Lean,QuantConnect/Lean,AlexCatarino/Lean,QuantConnect/Lean,QuantConnect/Lean,jameschch/Lean,AlexCatarino/Lean,JKarathiya/Lean,jameschch/Lean,QuantConnect/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,jameschch/Lean,jameschch/Lean,jameschch/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,JKarathiya/Lean
Common/Orders/Slippage/AlphaStreamsSlippageModel.cs
Common/Orders/Slippage/AlphaStreamsSlippageModel.cs
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using QuantConnect.Securities; using QuantConnect.Data.Market; namespace QuantConnect.Orders.Slippage { /// <summary> /// Represents a slippage model that uses a constant percentage of slip /// </summary> public class AlphaStreamsSlippageModel : ISlippageModel { private readonly decimal _slippagePercent = 0.001m; /// <summary> /// Initializes a new instance of the <see cref="ConstantSlippageModel"/> class /// </summary> /// <param name="slippagePercent">The slippage percent for each order. Percent is ranged 0 to 1.</param> public AlphaStreamsSlippageModel() {} /// <summary> /// Slippage Model. Return a decimal cash slippage approximation on the order. /// </summary> public decimal GetSlippageApproximation(Security asset, Order order) { if (asset.Type != SecurityType.Equity) { return 0; } return _slippagePercent * asset.GetLastData()?.Value ?? 0; } } }
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using QuantConnect.Securities; using QuantConnect.Data.Market; namespace QuantConnect.Orders.Slippage { /// <summary> /// Represents a slippage model that uses a constant percentage of slip /// </summary> public class AlphaStreamsSlippageModel : ISlippageModel { private readonly decimal _slippagePercent = 0.001m; /// <summary> /// Initializes a new instance of the <see cref="ConstantSlippageModel"/> class /// </summary> /// <param name="slippagePercent">The slippage percent for each order. Percent is ranged 0 to 1.</param> public AlphaStreamsSlippageModel() {} /// <summary> /// Slippage Model. Return a decimal cash slippage approximation on the order. /// </summary> public decimal GetSlippageApproximation(Security asset, Order order) { var lastData = asset.GetLastData(); if (lastData == null) return 0; if (lastData.DataType == MarketDataType.TradeBar) { return _slippagePercent * ((TradeBar)lastData).Close; } else if (lastData.DataType == MarketDataType.Tick && asset.Type == SecurityType.Equity) { return _slippagePercent * ((Tick)lastData).Value; } else { return 0; } } } }
apache-2.0
C#
1aebb2c09685ae7a1fa99b364ef73daa9c898aba
simplify build script
hpcsc/Sharpenter.BootstrapperLoader
build.cake.cs
build.cake.cs
using System.Diagnostics; using IO = System.IO; using System.Linq; var target = Argument("target", "Default"); var buildConfiguration = "Release"; var solutionFile = "Sharpenter.BootstrapperLoader.sln"; var mainProject = "./Sharpenter.BootstrapperLoader"; var testProject = "./Sharpenter.BootstrapperLoader.Tests"; Task("Clean") .Does(() => { var projects = new List<string> { mainProject, testProject }; projects.ForEach(project => { var binDir = IO.Path.Combine(IO.Directory.GetCurrentDirectory(), project, "bin"); if (DirectoryExists(binDir)) { DeleteDirectory(binDir, recursive:true); } var objDir = IO.Path.Combine(IO.Directory.GetCurrentDirectory(), project, "obj"); if (DirectoryExists(objDir)) { DeleteDirectory(objDir, recursive:true); } }); }); Task("Restore") .Does(() => { DotNetCoreRestore(solutionFile); }); Task("Build") .Does(() => { var settings = new DotNetCoreBuildSettings { Configuration = buildConfiguration }; DotNetCoreBuild(mainProject, settings); }); Task("Test") .IsDependentOn("Build") .Does(() => { DotNetCoreTool("./Sharpenter.BootstrapperLoader.Tests/Sharpenter.BootstrapperLoader.Tests.csproj", "xunit", "-xml TestResult.xml"); }); Task("Default") .IsDependentOn("Clean") .IsDependentOn("Restore") .IsDependentOn("Test"); RunTarget(target);
using System.Diagnostics; using IO = System.IO; using System.Linq; var target = Argument("target", "Default"); var buildConfiguration = "Release"; var solutionFile = "Sharpenter.BootstrapperLoader.sln"; var mainProject = "Sharpenter.BootstrapperLoader"; var testProject = "Sharpenter.BootstrapperLoader.Tests"; void Build(string targetFramework) { var settings = new DotNetCoreMSBuildSettings() .SetConfiguration(buildConfiguration) .SetTargetFramework(targetFramework); DotNetCoreMSBuild(solutionFile, settings); } void DeleteIfExists(string project) { var binDir = IO.Path.Combine(IO.Directory.GetCurrentDirectory(), project, "bin"); if (DirectoryExists(binDir)) { DeleteDirectory(binDir, recursive:true); } var objDir = IO.Path.Combine(IO.Directory.GetCurrentDirectory(), project, "obj"); if (DirectoryExists(objDir)) { DeleteDirectory(objDir, recursive:true); } } Task("Clean") .Does(() => { DeleteIfExists(mainProject); DeleteIfExists(testProject); }); Task("Restore") .Does(() => { DotNetCoreRestore(solutionFile); }); Task("BuildNetStandard") .Does(() => { Build("netstandard2.0"); }); Task("BuildNet452") .Does(() => { Build("net452"); }); Task("Test") .IsDependentOn("BuildNetStandard") .IsDependentOn("BuildNet452") .Does(() => { DotNetCoreTool("./Sharpenter.BootstrapperLoader.Tests/Sharpenter.BootstrapperLoader.Tests.csproj", "xunit", "-xml TestResult.xml"); }); Task("Default") .IsDependentOn("Clean") .IsDependentOn("Restore") .IsDependentOn("Test"); RunTarget(target);
mit
C#
76d90d39f9bceaa92499d01b222e66067816ba3f
Disable tinting option on Android
shrutinambiar/xamarin-forms-tinted-image
CrossPlatformTintedImage/CrossPlatformTintedImage/CrossPlatformTintedImage.Droid/TintedImageRenderer.cs
CrossPlatformTintedImage/CrossPlatformTintedImage/CrossPlatformTintedImage.Droid/TintedImageRenderer.cs
using System; using Android.Views; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using Android.Graphics; using System.ComponentModel; using CrossPlatformTintedImage; using CrossPlatformTintedImage.Droid; [assembly:ExportRendererAttribute(typeof(TintedImage), typeof(TintedImageRenderer))] namespace CrossPlatformTintedImage.Droid { public class TintedImageRenderer : ImageRenderer { protected override void OnElementChanged(ElementChangedEventArgs<Image> e) { base.OnElementChanged(e); SetTint(); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == TintedImage.TintColorProperty.PropertyName) SetTint(); } void SetTint() { if (Control == null || Element == null) return; if (((TintedImage)Element).TintColor.Equals(Xamarin.Forms.Color.Transparent)) { //Turn off tinting if (Control.ColorFilter != null) Control.ClearColorFilter(); return; } //Apply tint color var colorFilter = new PorterDuffColorFilter(((TintedImage)Element).TintColor.ToAndroid(), PorterDuff.Mode.SrcIn); Control.SetColorFilter(colorFilter); } } }
using System; using Android.Views; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using Android.Graphics; using System.ComponentModel; using CrossPlatformTintedImage; using CrossPlatformTintedImage.Droid; [assembly:ExportRendererAttribute(typeof(TintedImage), typeof(TintedImageRenderer))] namespace CrossPlatformTintedImage.Droid { public class TintedImageRenderer : ImageRenderer { protected override void OnElementChanged(ElementChangedEventArgs<Image> e) { base.OnElementChanged(e); SetTint(); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == TintedImage.TintColorProperty.PropertyName) SetTint(); } void SetTint() { if (Control != null && Element != null) { var colorFilter = new PorterDuffColorFilter(((TintedImage) Element).TintColor.ToAndroid(), PorterDuff.Mode.SrcIn); Control.SetColorFilter(colorFilter); } } } }
mit
C#
1af077f8a6e23e3b9342fce553f97bae7a3b802f
Use Interlocked
tmds/Tmds.DBus
PendingCall.cs
PendingCall.cs
// Copyright 2007 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Threading; namespace NDesk.DBus { class PendingCall { Connection conn; Message reply = null; object lockObj = new object (); public PendingCall (Connection conn) { this.conn = conn; } int waiters = 0; public Message Reply { get { if (Thread.CurrentThread == conn.mainThread) { /* while (reply == null) conn.Iterate (); */ while (reply == null) conn.HandleMessage (conn.ReadMessage ()); conn.DispatchSignals (); } else { lock (lockObj) { Interlocked.Increment (ref waiters); while (reply == null) Monitor.Wait (lockObj); Interlocked.Decrement (ref waiters); } } return reply; } set { lock (lockObj) { reply = value; if (waiters > 0) Monitor.PulseAll (lockObj); if (Completed != null) Completed (reply); } } } public event Action<Message> Completed; } }
// Copyright 2007 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Threading; namespace NDesk.DBus { class PendingCall { Connection conn; Message reply = null; object lockObj = new object (); public PendingCall (Connection conn) { this.conn = conn; } int waiters = 0; public Message Reply { get { if (Thread.CurrentThread == conn.mainThread) { /* while (reply == null) conn.Iterate (); */ while (reply == null) conn.HandleMessage (conn.ReadMessage ()); conn.DispatchSignals (); } else { lock (lockObj) { waiters++; while (reply == null) Monitor.Wait (lockObj); waiters--; } } return reply; } set { lock (lockObj) { reply = value; if (waiters > 0) Monitor.PulseAll (lockObj); if (Completed != null) Completed (reply); } } } public event Action<Message> Completed; } }
mit
C#
c35b891381ea4638f65ebb532643731ec84b07a5
Add support for OAuth
chuggafan/RedditSharp-1,ekaralar/RedditSharpWindowsStore,pimanac/RedditSharp,nyanpasudo/RedditSharp,RobThree/RedditSharp,IAmAnubhavSaini/RedditSharp,SirCmpwn/RedditSharp,angelotodaro/RedditSharp,CrustyJew/RedditSharp,tomnolan95/RedditSharp,theonlylawislove/RedditSharp,epvanhouten/RedditSharp,Jinivus/RedditSharp,justcool393/RedditSharp-1
RedditSharp/IWebAgent.cs
RedditSharp/IWebAgent.cs
using System.IO; using System.Net; namespace RedditSharp { public interface IWebAgent { CookieContainer Cookies { get; set; } string AuthCookie { get; set; } string AccessToken { get; set; } HttpWebRequest CreateRequest(string url, string method); HttpWebRequest CreateGet(string url); HttpWebRequest CreatePost(string url); string GetResponseString(Stream stream); void WritePostBody(Stream stream, object data, params string[] additionalFields); } }
using System.IO; using System.Net; namespace RedditSharp { public interface IWebAgent { CookieContainer Cookies { get; set; } string AuthCookie { get; set; } HttpWebRequest CreateRequest(string url, string method); HttpWebRequest CreateGet(string url); HttpWebRequest CreatePost(string url); string GetResponseString(Stream stream); void WritePostBody(Stream stream, object data, params string[] additionalFields); } }
mit
C#
111205d2e67ce235e30471ea72260e70578a1075
Fix failing test
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
src/Arkivverket.Arkade.Test/Core/Addml/Processes/AnalyseCountRecordsTest.cs
src/Arkivverket.Arkade.Test/Core/Addml/Processes/AnalyseCountRecordsTest.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Arkivverket.Arkade.Core; using Arkivverket.Arkade.Core.Addml; using Arkivverket.Arkade.Core.Addml.Definitions; using Arkivverket.Arkade.Core.Addml.Processes; using Arkivverket.Arkade.Test.Core.Addml.Builders; using FluentAssertions; using Xunit; using Record = Arkivverket.Arkade.Core.Addml.Record; namespace Arkivverket.Arkade.Test.Core.Addml.Processes { public class AnalyseCountRecordsTest { [Fact] public void ShouldReportSuccessIfRecordCountIsCorrect() { AddmlFlatFileDefinition defintion = new AddmlFlatFileDefinitionBuilder() .WithNumberOfRecords(4) .WithFileName("filnavn.dat") .Build(); FlatFile flatFile = new FlatFile(defintion); AnalyseCountRecords test = new AnalyseCountRecords(); test.Run(flatFile); test.Run((Arkade.Core.Addml.Record)null); test.Run((Arkade.Core.Addml.Record)null); test.Run((Arkade.Core.Addml.Record)null); test.Run((Arkade.Core.Addml.Record)null); test.EndOfFile(); TestRun testRun = test.GetTestRun(); testRun.IsSuccess().Should().BeTrue(); testRun.Results.Count.Should().Be(1); testRun.Results[0].Message.Should().StartWith("4 "); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Arkivverket.Arkade.Core; using Arkivverket.Arkade.Core.Addml; using Arkivverket.Arkade.Core.Addml.Definitions; using Arkivverket.Arkade.Core.Addml.Processes; using Arkivverket.Arkade.Test.Core.Addml.Builders; using FluentAssertions; using Xunit; using Record = Arkivverket.Arkade.Core.Addml.Record; namespace Arkivverket.Arkade.Test.Core.Addml.Processes { public class AnalyseCountRecordsTest { [Fact] public void ShouldReportSuccessIfRecordCountIsCorrect() { AddmlFlatFileDefinition defintion = new AddmlFlatFileDefinitionBuilder() .WithNumberOfRecords(4) .WithFileName("filnavn.dat") .Build(); FlatFile flatFile = new FlatFile(defintion); AnalyseCountRecords test = new AnalyseCountRecords(); test.Run(flatFile); test.Run((Arkade.Core.Addml.Record)null); test.Run((Arkade.Core.Addml.Record)null); test.Run((Arkade.Core.Addml.Record)null); test.Run((Arkade.Core.Addml.Record)null); test.EndOfFile(); TestRun testRun = test.GetTestRun(); testRun.IsSuccess().Should().BeTrue(); testRun.Results.Count.Should().Be(1); testRun.Results[0].Message.Should().Be("RecordCount 4."); } } }
agpl-3.0
C#
eeaeafe040120c41239523ae97b2f28e71befb7e
Mark render start point as graph part (obviously)
id144/dx11-vvvv,id144/dx11-vvvv,id144/dx11-vvvv
Core/VVVV.DX11.Core/NodeInterfaces/IDX11RenderWindow.cs
Core/VVVV.DX11.Core/NodeInterfaces/IDX11RenderWindow.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using FeralTic.DX11; namespace VVVV.DX11 { public interface IAttachableWindow { void AttachContext(DX11RenderContext renderContext); IntPtr WindowHandle { get; } } public interface IDX11RenderStartPoint : IDX11RenderGraphPart { DX11RenderContext RenderContext { get; } bool Enabled { get; } void Present(); } public interface IDX11RenderWindow : IDX11RenderStartPoint , IAttachableWindow { } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using FeralTic.DX11; namespace VVVV.DX11 { public interface IAttachableWindow { void AttachContext(DX11RenderContext renderContext); IntPtr WindowHandle { get; } } public interface IDX11RenderStartPoint { DX11RenderContext RenderContext { get; } bool Enabled { get; } void Present(); } public interface IDX11RenderWindow : IDX11RenderStartPoint , IAttachableWindow { } }
bsd-3-clause
C#
65faad85f5960ff82a7032d9ad8c7c9a15fd9c6a
Change "Ok" to "OK" in message dialogs
michael-reichenauer/GitMind
GitMind/Common/MessageDialogs/MessageDialog.xaml.cs
GitMind/Common/MessageDialogs/MessageDialog.xaml.cs
using System.Windows; namespace GitMind.Common.MessageDialogs { /// <summary> /// Interaction logic for MessageDialog.xaml /// </summary> public partial class MessageDialog : Window { public MessageDialog( Window owner, string message, string title, MessageBoxButton button, MessageBoxImage image) { Owner = owner; InitializeComponent(); MessageDialogViewModel viewModel = new MessageDialogViewModel(); DataContext = viewModel; viewModel.Title = title; viewModel.Message = message; viewModel.IsInfo = image == MessageBoxImage.Information; viewModel.IsQuestion = image == MessageBoxImage.Question; viewModel.IsWarn = image == MessageBoxImage.Warning; viewModel.IsError = image == MessageBoxImage.Error; if (button == MessageBoxButton.OK) { viewModel.OkText = "OK"; viewModel.IsCancelVisible = false; } else if (button == MessageBoxButton.OKCancel) { viewModel.OkText = "OK"; viewModel.CancelText = "Cancel"; viewModel.IsCancelVisible = true; } else if (button == MessageBoxButton.YesNo) { viewModel.OkText = "Yes"; viewModel.CancelText = "No"; viewModel.IsCancelVisible = true; } } } }
using System.Windows; namespace GitMind.Common.MessageDialogs { /// <summary> /// Interaction logic for MessageDialog.xaml /// </summary> public partial class MessageDialog : Window { public MessageDialog( Window owner, string message, string title, MessageBoxButton button, MessageBoxImage image) { Owner = owner; InitializeComponent(); MessageDialogViewModel viewModel = new MessageDialogViewModel(); DataContext = viewModel; viewModel.Title = title; viewModel.Message = message; viewModel.IsInfo = image == MessageBoxImage.Information; viewModel.IsQuestion = image == MessageBoxImage.Question; viewModel.IsWarn = image == MessageBoxImage.Warning; viewModel.IsError = image == MessageBoxImage.Error; if (button == MessageBoxButton.OK) { viewModel.OkText = "Ok"; viewModel.IsCancelVisible = false; } else if (button == MessageBoxButton.OKCancel) { viewModel.OkText = "Ok"; viewModel.CancelText = "Cancel"; viewModel.IsCancelVisible = true; } else if (button == MessageBoxButton.YesNo) { viewModel.OkText = "Yes"; viewModel.CancelText = "No"; viewModel.IsCancelVisible = true; } } } }
mit
C#
1d6b7f3206a75fb97eaf41e609c9fb80c40b46eb
Add parser error message in SerializedClassLayout.
Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver
src/AsmResolver.DotNet/Serialized/SerializedClassLayout.cs
src/AsmResolver.DotNet/Serialized/SerializedClassLayout.cs
using System; using AsmResolver.PE.DotNet.Metadata.Tables; using AsmResolver.PE.DotNet.Metadata.Tables.Rows; namespace AsmResolver.DotNet.Serialized { /// <summary> /// Represents a lazily initialized implementation of <see cref="ClassLayout"/> that is read from a /// .NET metadata image. /// </summary> public class SerializedClassLayout : ClassLayout { private readonly ModuleReaderContext _context; private readonly ClassLayoutRow _row; /// <summary> /// Creates a class layout from a class layout metadata row. /// </summary> /// <param name="context">The reader context.</param> /// <param name="token">The token to initialize the class layout for.</param> /// <param name="row">The metadata table row to base the class layout on.</param> public SerializedClassLayout( ModuleReaderContext context, MetadataToken token, in ClassLayoutRow row) : base(token) { _context = context ?? throw new ArgumentNullException(nameof(context)); _row = row; PackingSize = row.PackingSize; ClassSize = row.ClassSize; } /// <inheritdoc /> protected override TypeDefinition GetParent() { return _context.ParentModule.TryLookupMember(new MetadataToken(TableIndex.TypeDef, _row.Parent), out var member) ? member as TypeDefinition : _context.BadImageAndReturn<TypeDefinition>($"Invalid parent type in class layout {MetadataToken.ToString()}."); } } }
using System; using AsmResolver.PE.DotNet.Metadata.Tables; using AsmResolver.PE.DotNet.Metadata.Tables.Rows; namespace AsmResolver.DotNet.Serialized { /// <summary> /// Represents a lazily initialized implementation of <see cref="ClassLayout"/> that is read from a /// .NET metadata image. /// </summary> public class SerializedClassLayout : ClassLayout { private readonly ModuleReaderContext _context; private readonly ClassLayoutRow _row; /// <summary> /// Creates a class layout from a class layout metadata row. /// </summary> /// <param name="context">The reader context.</param> /// <param name="token">The token to initialize the class layout for.</param> /// <param name="row">The metadata table row to base the class layout on.</param> public SerializedClassLayout( ModuleReaderContext context, MetadataToken token, in ClassLayoutRow row) : base(token) { _context = context ?? throw new ArgumentNullException(nameof(context)); _row = row; PackingSize = row.PackingSize; ClassSize = row.ClassSize; } /// <inheritdoc /> protected override TypeDefinition GetParent() { return _context.ParentModule.TryLookupMember(new MetadataToken(TableIndex.TypeDef, _row.Parent), out var member) ? member as TypeDefinition : null; } } }
mit
C#
e62657667a8751d463f13373ceb3e4216bc08f36
modify comments
wanlitao/FCP.Routing
FCP.Routing.LoadBalance/Constants/LoadBalanceConstants.cs
FCP.Routing.LoadBalance/Constants/LoadBalanceConstants.cs
namespace FCP.Routing.LoadBalance { public static class LoadBalanceConstants { /// <summary> /// Consistent Hash default virtual Nodes /// </summary> public const int DefaultVirtualNodesFactor = 5; } }
namespace FCP.Routing.LoadBalance { /// <summary> /// 负载均衡 常量 /// </summary> public static class LoadBalanceConstants { /// <summary> /// 一致性Hash默认虚拟节点数 /// </summary> public const int DefaultVirtualNodesFactor = 5; } }
apache-2.0
C#
9707fa2754c5db1debfb9a520a1d10c92adc6c3e
Change - finished compliance for to_number function.
jdevillard/JmesPath.Net
src/jmespath.net/Functions/ToNumberFunction.cs
src/jmespath.net/Functions/ToNumberFunction.cs
using System; using System.Globalization; using DevLab.JmesPath.Interop; using Newtonsoft.Json.Linq; namespace DevLab.JmesPath.Functions { public class ToNumberFunction : JmesPathFunction { public ToNumberFunction() : base("to_number", 1) { } public override bool Validate(params JToken[] args) { return true; } public override JToken Execute(params JToken[] args) { var arg = args[0]; if (args[0] == null) return null; switch (arg.Type) { case JTokenType.Integer: case JTokenType.Float: return arg; case JTokenType.String: { var value = args[0].Value<string>(); int i =0 ; double d = 0; if (int.TryParse(value, out i)) return new JValue(i); else if (double.TryParse(value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d)) return new JValue(d); return null; } default: return null; } } } }
using System; using DevLab.JmesPath.Interop; using Newtonsoft.Json.Linq; namespace DevLab.JmesPath.Functions { public class ToNumberFunction : JmesPathFunction { public ToNumberFunction() : base("to_number", 1) { } public override bool Validate(params JToken[] args) { return true; } public override JToken Execute(params JToken[] args) { return new JValue(Convert.ToInt32(args[0].Value<int>())); } } }
apache-2.0
C#
1823c77cd0b9799c5d66629fcc011018282c93dc
Add some complexity to test cases.
AxeDotNet/AxePractice.CSharpViaTest
src/CSharpViaTest.IOs/10_HandleText/CalculateTextCharLength.cs
src/CSharpViaTest.IOs/10_HandleText/CalculateTextCharLength.cs
using System; using System.Collections.Generic; using Xunit; namespace CSharpViaTest.IOs._10_HandleText { /* * Description * =========== * * This test will introduce the concept of Codepoint and surrogate pair to you. But * for the most of the cases, the character can fit in 16-bit unicode character. * * Difficulty: Super Easy */ public class CalculateTextCharLength { static IEnumerable<object[]> TestCases() => new[] { new object[]{"", 0}, new object[]{"12345", 5}, new object[]{char.ConvertFromUtf32(0x2A601) + "1234", 5} }; #region Please modifies the code to pass the test static int GetCharacterLength(string text) { throw new NotImplementedException(); } #endregion [Theory] [MemberData(nameof(TestCases))] public void should_calculate_text_character_length(string testString, int expectedLength) { Assert.Equal(expectedLength, GetCharacterLength(testString)); } } }
using System; using System.Collections.Generic; using Xunit; namespace CSharpViaTest.IOs._10_HandleText { /* * Description * =========== * * This test will introduce the concept of Codepoint and surrogate pair to you. But * for the most of the cases, the character can fit in 16-bit unicode character. * * Difficulty: Super Easy */ public class CalculateTextCharLength { static IEnumerable<object[]> TestCases() => new[] { new object[]{"", 0}, new object[]{"1", 1}, new object[]{char.ConvertFromUtf32(0x2A601), 1} }; #region Please modifies the code to pass the test static int GetCharacterLength(string text) { throw new NotImplementedException(); } #endregion [Theory] [MemberData(nameof(TestCases))] public void should_calculate_text_character_length(string testString, int expectedLength) { Assert.Equal(expectedLength, GetCharacterLength(testString)); } } }
mit
C#
9620105ca33961497bee100de7d1a0ae6a3f9070
Fix NH-2339 (thanks to Timur Kristóf)
nhibernate/nhibernate-core,lnu/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,gliljas/nhibernate-core,nkreipke/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,lnu/nhibernate-core,nhibernate/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,alobakov/nhibernate-core,lnu/nhibernate-core,RogerKratz/nhibernate-core,hazzik/nhibernate-core,ManufacturingIntelligence/nhibernate-core,fredericDelaporte/nhibernate-core,RogerKratz/nhibernate-core,fredericDelaporte/nhibernate-core,ManufacturingIntelligence/nhibernate-core,livioc/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,livioc/nhibernate-core,hazzik/nhibernate-core,livioc/nhibernate-core,alobakov/nhibernate-core,gliljas/nhibernate-core,ngbrown/nhibernate-core,fredericDelaporte/nhibernate-core,ngbrown/nhibernate-core,alobakov/nhibernate-core,RogerKratz/nhibernate-core,nhibernate/nhibernate-core
src/NHibernate/Context/ReflectiveHttpContext.cs
src/NHibernate/Context/ReflectiveHttpContext.cs
using System; using System.Collections; using System.Linq.Expressions; using System.Reflection; namespace NHibernate.Context { /// <summary> /// This class allows access to the HttpContext without referring to HttpContext at compile time. /// The accessors are cached as delegates for performance. /// </summary> public static class ReflectiveHttpContext { static ReflectiveHttpContext() { CreateCurrentHttpContextGetter(); CreateHttpContextItemsGetter(); } public static Func<object> HttpContextCurrentGetter { get; private set; } public static Func<object, IDictionary> HttpContextItemsGetter { get; private set; } public static IDictionary HttpContextCurrentItems { get { return HttpContextItemsGetter(HttpContextCurrentGetter()); } } private static System.Type HttpContextType { get { return System.Type.GetType( string.Format( "System.Web.HttpContext, System.Web, Version={0}, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", Environment.Version)); } } private static void CreateCurrentHttpContextGetter() { PropertyInfo currentProperty = HttpContextType.GetProperty("Current", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy); Expression propertyExpression = Expression.Property(null, currentProperty); Expression convertedExpression = Expression.Convert(propertyExpression, typeof (object)); HttpContextCurrentGetter = (Func<object>) Expression.Lambda(convertedExpression).Compile(); } private static void CreateHttpContextItemsGetter() { ParameterExpression contextParam = Expression.Parameter(typeof (object), "context"); Expression convertedParam = Expression.Convert(contextParam, HttpContextType); Expression itemsProperty = Expression.Property(convertedParam, "Items"); HttpContextItemsGetter = (Func<object, IDictionary>) Expression.Lambda(itemsProperty, contextParam).Compile(); } } }
using System; using System.Collections; using System.Linq.Expressions; using System.Reflection; namespace NHibernate.Context { /// <summary> /// This class allows access to the HttpContext without referring to HttpContext at compile time. /// The accessors are cached as delegates for performance. /// </summary> public static class ReflectiveHttpContext { static ReflectiveHttpContext() { CreateCurrentHttpContextGetter(); CreateHttpContextItemsGetter(); } public static Func<object> HttpContextCurrentGetter { get; private set; } public static Func<object, IDictionary> HttpContextItemsGetter { get; private set; } public static IDictionary HttpContextCurrentItems { get { return HttpContextItemsGetter(HttpContextCurrentGetter()); } } private static System.Type HttpContextType { get { string mscorlibVersion = typeof(object).Assembly.GetName().Version.ToString(); return System.Type.GetType("System.Web.HttpContext, System.Web, Version=" + mscorlibVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); } } private static void CreateCurrentHttpContextGetter() { PropertyInfo currentProperty = HttpContextType.GetProperty("Current", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy); Expression propertyExpression = Expression.Property(null, currentProperty); Expression convertedExpression = Expression.Convert(propertyExpression, typeof (object)); HttpContextCurrentGetter = (Func<object>) Expression.Lambda(convertedExpression).Compile(); } private static void CreateHttpContextItemsGetter() { ParameterExpression contextParam = Expression.Parameter(typeof (object), "context"); Expression convertedParam = Expression.Convert(contextParam, HttpContextType); Expression itemsProperty = Expression.Property(convertedParam, "Items"); HttpContextItemsGetter = (Func<object, IDictionary>) Expression.Lambda(itemsProperty, contextParam).Compile(); } } }
lgpl-2.1
C#
66b0857cf2ddf7d0b7dd4c9776e9e926799cacba
Add next page command property
dnnsoftware/Dnn.AdminExperience.Library,valadas/Dnn.Platform,valadas/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Library,RichardHowells/Dnn.Platform,EPTamminga/Dnn.Platform,bdukes/Dnn.Platform,robsiera/Dnn.Platform,dnnsoftware/Dnn.Platform,nvisionative/Dnn.Platform,RichardHowells/Dnn.Platform,RichardHowells/Dnn.Platform,robsiera/Dnn.Platform,nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,bdukes/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Library,dnnsoftware/Dnn.Platform,EPTamminga/Dnn.Platform,dnnsoftware/Dnn.Platform,mitchelsellers/Dnn.Platform,EPTamminga/Dnn.Platform,bdukes/Dnn.Platform,bdukes/Dnn.Platform,robsiera/Dnn.Platform,RichardHowells/Dnn.Platform,mitchelsellers/Dnn.Platform,valadas/Dnn.Platform
src/Dnn.PersonaBar.Library/Prompt/Models/ConsoleResultModel.cs
src/Dnn.PersonaBar.Library/Prompt/Models/ConsoleResultModel.cs
using Newtonsoft.Json; namespace Dnn.PersonaBar.Library.Prompt.Models { /// <summary> /// Standard response object sent to client /// </summary> public class ConsoleResultModel { // the returned result - text or HTML [JsonProperty(PropertyName = "output")] public string Output; // is the output an error message? [JsonProperty(PropertyName = "isError")] public bool IsError; // is the Output HTML? [JsonProperty(PropertyName = "isHtml")] public bool IsHtml; // should the client reload after processing the command [JsonProperty(PropertyName = "mustReload")] public bool MustReload; // the response contains data to be formatted by the client [JsonProperty(PropertyName = "data")] public object Data; // optionally tell the client in what order the fields should be displayed [JsonProperty(PropertyName = "fieldOrder")] public string[] FieldOrder; [JsonProperty(PropertyName = "pagingInfo")] public PagingInfo PagingInfo; [JsonProperty(PropertyName = "nextPageCommand")] public string NextPageCommand; [JsonProperty(PropertyName = "records")] public int Records { get; set; } public ConsoleResultModel() { } public ConsoleResultModel(string output) { Output = output; } } }
using Newtonsoft.Json; namespace Dnn.PersonaBar.Library.Prompt.Models { /// <summary> /// Standard response object sent to client /// </summary> public class ConsoleResultModel { // the returned result - text or HTML [JsonProperty(PropertyName = "output")] public string Output; // is the output an error message? [JsonProperty(PropertyName = "isError")] public bool IsError; // is the Output HTML? [JsonProperty(PropertyName = "isHtml")] public bool IsHtml; // should the client reload after processing the command [JsonProperty(PropertyName = "mustReload")] public bool MustReload; // the response contains data to be formatted by the client [JsonProperty(PropertyName = "data")] public object Data; // optionally tell the client in what order the fields should be displayed [JsonProperty(PropertyName = "fieldOrder")] public string[] FieldOrder; [JsonProperty(PropertyName = "pagingInfo")] public PagingInfo PagingInfo; [JsonProperty(PropertyName = "records")] public int Records { get; set; } public ConsoleResultModel() { } public ConsoleResultModel(string output) { Output = output; } } }
mit
C#
dc6a748fb11815554378bb37c89f5912a0b6f63a
rename git temp folder
tsolarin/dotnet-globals,tsolarin/dotnet-globals
src/DotNet.Globals.Core/PackageResolvers/GitPackageResolver.cs
src/DotNet.Globals.Core/PackageResolvers/GitPackageResolver.cs
using System; using System.IO; using System.Linq; using DotNet.Globals.Core.Utils; namespace DotNet.Globals.Core.PackageResolvers { internal class GitPackageResolver : FolderPackageResolver { public GitPackageResolver(DirectoryInfo packagesFolder, string source, Options options) : base(packagesFolder, source, options) { } protected override void Acquire() { var packageName = this.Source.Split('/').Last().Replace(".git", ""); DirectoryInfo tempFolder = new DirectoryInfo(Path.GetTempPath()) .CreateSubdirectory("dotnet-globals-" + Guid.NewGuid().ToString()) .CreateSubdirectory(packageName); bool clone = ProcessRunner.RunProcess("git", "clone", this.Source, tempFolder.FullName); if (!clone) throw new Exception("Unable to clone repository"); this.Source = string.IsNullOrEmpty(this.Options.Folder) ? tempFolder.FullName : Path.Combine(tempFolder.FullName, this.Options.Folder); base.Acquire(); } } }
using System; using System.IO; using System.Linq; using DotNet.Globals.Core.Utils; namespace DotNet.Globals.Core.PackageResolvers { internal class GitPackageResolver : FolderPackageResolver { public GitPackageResolver(DirectoryInfo packagesFolder, string source, Options options) : base(packagesFolder, source, options) { } protected override void Acquire() { var packageName = this.Source.Split('/').Last().Replace(".git", ""); DirectoryInfo tempFolder = new DirectoryInfo(Path.GetTempPath()) .CreateSubdirectory("dotnet-exec-" + Guid.NewGuid().ToString()) .CreateSubdirectory(packageName); bool clone = ProcessRunner.RunProcess("git", "clone", this.Source, tempFolder.FullName); if (!clone) throw new Exception("Unable to clone repository"); this.Source = string.IsNullOrEmpty(this.Options.Folder) ? tempFolder.FullName : Path.Combine(tempFolder.FullName, this.Options.Folder); base.Acquire(); } } }
mit
C#
012e5bca46ebc8bac27926b255b08d118ff7520c
Add idling to RIBAS metrics
MiXTelematics/MiX.Integrate.Api.Client
MiX.Integrate.Shared/Entities/Trips/TripRibasMetrics.cs
MiX.Integrate.Shared/Entities/Trips/TripRibasMetrics.cs
using System; namespace MiX.Integrate.Shared.Entities.Trips { /// <summary>Encapsulates the RIBAS metrics of a trip</summary> public class TripRibasMetrics { /// <summary>Unique identifier of the trip</summary> public long TripId { get; set; } /// <summary>Identifies the asset associated with the trip</summary> public long AssetId { get; set; } /// <summary>Identifies the driver associated with the trip</summary> public long DriverId { get; set; } /// <summary>Date and time the trip started</summary> public DateTime TripStart { get; set; } /// <summary>Time, in seconds, spent driving</summary> public decimal DrivingTime { get; set; } /// <summary>Total duration, in seconds, of the trip</summary> public decimal Duration { get; set; } /// <summary>Total distance the asset moved in the trip</summary> public decimal DistanceKilometers { get; set; } /// <summary>Total over-speeding duration, in seconds</summary> public int? SpeedingTime{ get; set; } /// <summary>Total time, in seconds, that harsh braking occurred</summary> public int? HarshBrakeTime{ get; set; } /// <summary>Total time, in seconds, that harsh acceleration occurred</summary> public int? HarshAccelerationTime{ get; set; } /// <summary>Total time, in seconds, that over-revving occurred</summary> public int? OverRevTime{ get; set; } /// <summary>Total time, in seconds, that normal idling occurred</summary> public int? IdleTime{ get; set; } /// <summary>Total time, in seconds, excessive idling occurred</summary> public int? ExcessiveIdleTime{ get; set; } /// <summary>Total time, in seconds, spent out of green band</summary> public int? OutOfGreenBandTime{ get; set; } /// <summary>Number of times over-speeding occurred</summary> public int? SpeedingOccurs{ get; set; } /// <summary>Number of times harsh braking occurred</summary> public int? HarshBrakeOccurs{ get; set; } /// <summary>Number of times harsh acceleration occurred</summary> public int? HarshAccelerationOccurs{ get; set; } /// <summary>Number of times over-revving occurred</summary> public int? OverRevOccurs{ get; set; } /// <summary>Number of times excessive idling occurred</summary> public int? ExcessiveIdleOccurs{ get; set; } /// <summary>Number of times idling occurred</summary> public int? IdleOccurs{ get; set; } /// <summary>Highest speed recorded during the trip</summary> public decimal MaxSpeedKilometersPerHour { get; set; } /// <summary>Maximum acceleration recorded during the trip</summary> public decimal MaxAccelerationKilometersPerHourPerSecond { get; set; } /// <summary>Maximum deceleration recorded during the trip</summary> public decimal MaxDecelerationKilometersPerHourPerSecond { get; set; } /// <summary>Highest engine RPM recorded during the trip</summary> public decimal MaxRpm { get; set; } } }
using System; namespace MiX.Integrate.Shared.Entities.Trips { /// <summary>Encapsulates the RIBAS metrics of a trip</summary> public class TripRibasMetrics { /// <summary>Unique identifier of the trip</summary> public long TripId { get; set; } /// <summary>Identifies the asset associated with the trip</summary> public long AssetId { get; set; } /// <summary>Identifies the driver associated with the trip</summary> public long DriverId { get; set; } /// <summary>Date and time the trip started</summary> public DateTime TripStart { get; set; } /// <summary>Time, in seconds, spent driving</summary> public decimal DrivingTime { get; set; } /// <summary>Total duration, in seconds, of the trip</summary> public decimal Duration { get; set; } /// <summary>Total distance the asset moved in the trip</summary> public decimal DistanceKilometers { get; set; } /// <summary>Total over-speeding duration, in seconds</summary> public int? SpeedingTime{ get; set; } /// <summary>Total time, in seconds, that harsh braking occurred</summary> public int? HarshBrakeTime{ get; set; } /// <summary>Total time, in seconds, that harsh acceleration occurred</summary> public int? HarshAccelerationTime{ get; set; } /// <summary>Total time, in seconds, that over-revving occurred</summary> public int? OverRevTime{ get; set; } /// <summary>Total time, in seconds, excessive idling occurred</summary> public int? ExcessiveIdleTime{ get; set; } /// <summary>Total time, in seconds, spent out of green band</summary> public int? OutOfGreenBandTime{ get; set; } /// <summary>Number of times over-speeding occurred</summary> public int? SpeedingOccurs{ get; set; } /// <summary>Number of times harsh braking occurred</summary> public int? HarshBrakeOccurs{ get; set; } /// <summary>Number of times harsh acceleration occurred</summary> public int? HarshAccelerationOccurs{ get; set; } /// <summary>Number of times over-revving occurred</summary> public int? OverRevOccurs{ get; set; } /// <summary>Number of times excessive idling occurred</summary> public int? ExcessiveIdleOccurs{ get; set; } /// <summary>Highest speed recorded during the trip</summary> public decimal MaxSpeedKilometersPerHour { get; set; } /// <summary>Maximum acceleration recorded during the trip</summary> public decimal MaxAccelerationKilometersPerHourPerSecond { get; set; } /// <summary>Maximum deceleration recorded during the trip</summary> public decimal MaxDecelerationKilometersPerHourPerSecond { get; set; } /// <summary>Highest engine RPM recorded during the trip</summary> public decimal MaxRpm { get; set; } } }
mit
C#
371d9d2d298474c8b6ff84e48d3933568c878d71
Update KeywordTokenScanner.cs
Zebrina/PapyrusScriptEditorVSIX,Zebrina/PapyrusScriptEditorVSIX
PapyrusScriptEditorVSIX/Language/KeywordTokenScanner.cs
PapyrusScriptEditorVSIX/Language/KeywordTokenScanner.cs
using Microsoft.VisualStudio.Text; using Papyrus.Common; using Papyrus.Common.Extensions; using Papyrus.Language.Components; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Papyrus.Language { public class KeywordTokenScanner : TokenScannerModule { public override bool Scan(SnapshotSpan sourceSnapshotSpan, int offset, ref TokenScannerState state, out Token token) { if (state == TokenScannerState.Text) { string text = sourceSnapshotSpan.GetText(); Keyword keyword = Keyword.Parse(text, offset, Delimiter.FindNext(text, offset) - offset); if (keyword != null) { token = new Token(keyword, new SnapshotSpan(sourceSnapshotSpan.Snapshot, sourceSnapshotSpan.Subspan(offset, keyword.Text.Length))); return true; } } token = null; return false; } } }
using Microsoft.VisualStudio.Text; using Papyrus.Common; using Papyrus.Common.Extensions; using Papyrus.Language.Components; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Papyrus.Language { public class KeywordTokenScanner : TokenScannerModule { public override bool Scan(SnapshotSpan sourceSnapshotSpan, int offset, ref TokenScannerState state, out Token token) { string text = sourceSnapshotSpan.GetText(); Keyword keyword = Keyword.Parse(text, offset, Delimiter.FindNext(text, offset) - offset); if (keyword != null) { token = new Token(keyword, new SnapshotSpan(sourceSnapshotSpan.Snapshot, sourceSnapshotSpan.Subspan(offset, keyword.Text.Length))); return true; } token = null; return false; } } }
mit
C#
da2f3c3932221eadef2845a11cdb25bbb9a98878
Test commit example
aspose-imaging/Aspose.Imaging-for-.NET
Examples/CSharp/ModifyingAndConvertingImages/SupportBMPHeader.cs
Examples/CSharp/ModifyingAndConvertingImages/SupportBMPHeader.cs
using Aspose.Imaging; using Aspose.Imaging.Examples.CSharp; using Aspose.Imaging.ImageOptions; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CSharp.ModifyingAndConvertingImages { class SupportBMPHeader { public static void Run() { //ExStart:SupportBMPHeader string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); string sourceFile = @"D:\source.bmp"; string resultFile = @"D:\result.png"; using (Image image = Image.Load(sourceFile)) { image.Save(resultFile, new PngOptions()); } //ExEnd:SupportBMPHeader } } }
using Aspose.Imaging; using Aspose.Imaging.Examples.CSharp; using Aspose.Imaging.ImageOptions; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CSharp.ModifyingAndConvertingImages { class SupportBMPHeader { public static void Run() { //ExStart:SupportBMPHeader string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); string sourceFile = @"D:\source.bmp"; string resultFile = @"D:\result.png"; using (Image image = Image.Load(sourceFile)) { image.Save(resultFile, new PngOptions()); } //ExEnd:SupportBMPHeader } } }
mit
C#
274273f6937d84c3a79c09771b23bf41794447ba
Increment build number
emoacht/ManagedNativeWifi
Source/ManagedNativeWifi/Properties/AssemblyInfo.cs
Source/ManagedNativeWifi/Properties/AssemblyInfo.cs
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ManagedNativeWifi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ManagedNativeWifi")] [assembly: AssemblyCopyright("Copyright © 2015-2020 emoacht")] [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("ebff4686-23e6-42bf-97ca-cf82641bcfa7")] // 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.7.1.0")] [assembly: AssemblyFileVersion("1.7.1.0")] [assembly: NeutralResourcesLanguage("en-US")] // For unit test [assembly: InternalsVisibleTo("ManagedNativeWifi.Test")]
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ManagedNativeWifi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ManagedNativeWifi")] [assembly: AssemblyCopyright("Copyright © 2015-2020 emoacht")] [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("ebff4686-23e6-42bf-97ca-cf82641bcfa7")] // 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.7.0.0")] [assembly: AssemblyFileVersion("1.7.0.0")] [assembly: NeutralResourcesLanguage("en-US")] // For unit test [assembly: InternalsVisibleTo("ManagedNativeWifi.Test")]
mit
C#
6f271c3915af6383af1d5428260349a2cfefa680
Undo diagnostics
dirkrombauts/SpecLogLogoReplacer
Tests/StepDefinitions.cs
Tests/StepDefinitions.cs
using System; using System.Drawing; using System.Drawing.Imaging; using Aim.SpecLogLogoReplacer.Tests.Properties; using Aim.SpecLogLogoReplacer.UI; using NFluent; using TechTalk.SpecFlow; namespace Aim.SpecLogLogoReplacer.Tests { [Binding] public class StepDefinitions { private string htmlFile; private string messageToUser; [Given(@"I have the html file exported from SpecLog contains")] public void GivenIHaveTheHtmlFileExportedFromSpecLogContains(string multilineText) { this.htmlFile = multilineText; } [When(@"I replace the logo with file '(.*)'")] public void WhenIReplaceTheLogoWithFile(string fileName) { Bitmap newLogo; switch ((fileName ?? string.Empty).ToLowerInvariant()) { case "logo.png": { newLogo = Resources.logo; break; } default: { throw new ArgumentOutOfRangeException(string.Format("Unknown logo file '{0}'", fileName)); } } try { this.htmlFile = new LogoReplacer().Replace(this.htmlFile, newLogo, ImageFormat.Png); } catch (Exception exception) { this.messageToUser = exception.Message; } } [Then(@"the html file should contain")] public void ThenTheHtmlFileShouldContain(string multilineText) { Check.That(this.htmlFile).Contains(multilineText); } [Then(@"I should see a message saying")] public void ThenIShouldSeeAMessageSaying(string expectedMessage) { Check.That(this.messageToUser).StartsWith(expectedMessage); } } }
using System; using System.Drawing; using System.Drawing.Imaging; using Aim.SpecLogLogoReplacer.Tests.Properties; using Aim.SpecLogLogoReplacer.UI; using NFluent; using TechTalk.SpecFlow; namespace Aim.SpecLogLogoReplacer.Tests { [Binding] public class StepDefinitions { private string htmlFile; private string messageToUser; [Given(@"I have the html file exported from SpecLog contains")] public void GivenIHaveTheHtmlFileExportedFromSpecLogContains(string multilineText) { this.htmlFile = multilineText; } [When(@"I replace the logo with file '(.*)'")] public void WhenIReplaceTheLogoWithFile(string fileName) { Bitmap newLogo; switch ((fileName ?? string.Empty).ToLowerInvariant()) { case "logo.png": { newLogo = Resources.logo; break; } default: { throw new ArgumentOutOfRangeException(string.Format("Unknown logo file '{0}'", fileName)); } } try { this.htmlFile = new LogoReplacer().Replace(this.htmlFile, newLogo, ImageFormat.Png); } catch (Exception exception) { this.messageToUser = exception.Message; } } [Then(@"the html file should contain")] public void ThenTheHtmlFileShouldContain(string multilineText) { Console.Out.WriteLine(System.Threading.Thread.CurrentThread.CurrentCulture); Check.That(this.htmlFile).Contains(multilineText); } [Then(@"I should see a message saying")] public void ThenIShouldSeeAMessageSaying(string expectedMessage) { Check.That(this.messageToUser).StartsWith(expectedMessage); } } }
isc
C#
99153bccb5b3165297c7be7b48935822362448c2
support sending of html documents
digipost/digipost-client-lib-webapp-dotnet,digipost/digipost-client-lib-webapp,digipost/digipost-client-lib-webapp-dotnet,digipost/digipost-client-lib-webapp
DigipostClientLibWebapp/Controllers/Converter.cs
DigipostClientLibWebapp/Controllers/Converter.cs
using System; using Digipost.Api.Client.Domain.Search; using DigipostClientLibWebapp.Models; namespace DigipostClientLibWebapp.Controllers { public class Converter { public static SendModel SearchDetailsToSendModel(SearchDetails searchDetails) { var sendModel = new SendModel(); if (searchDetails.SearchDetailsAddress != null) { sendModel.AdditionalAddressLine = searchDetails.SearchDetailsAddress.AdditionalAddressLine; sendModel.City = searchDetails.SearchDetailsAddress.City; sendModel.HouseLetter = searchDetails.SearchDetailsAddress.HouseLetter; sendModel.HouseNumber = searchDetails.SearchDetailsAddress.HouseNumber; sendModel.Street = searchDetails.SearchDetailsAddress.Street; sendModel.ZipCode = searchDetails.SearchDetailsAddress.ZipCode; } sendModel.DigipostAddress = searchDetails.DigipostAddress; sendModel.FirstName = searchDetails.FirstName; sendModel.MiddleName = searchDetails.MiddleName; sendModel.LastName = searchDetails.LastName; sendModel.MobileNumber = searchDetails.MobileNumber; sendModel.OrganizationName = searchDetails.OrganizationName; return sendModel; } public static string MimeTypeToDigipostFileType(string mimeType) { if (mimeType.Equals("application/pdf", StringComparison.OrdinalIgnoreCase)) return "pdf"; if (mimeType.Equals("text/plain", StringComparison.OrdinalIgnoreCase)) return "txt"; if(mimeType.Equals("text/html",StringComparison.OrdinalIgnoreCase)) return "html"; return ""; } } }
using System; using Digipost.Api.Client.Domain.Search; using DigipostClientLibWebapp.Models; namespace DigipostClientLibWebapp.Controllers { public class Converter { public static SendModel SearchDetailsToSendModel(SearchDetails searchDetails) { var sendModel = new SendModel(); if (searchDetails.SearchDetailsAddress != null) { sendModel.AdditionalAddressLine = searchDetails.SearchDetailsAddress.AdditionalAddressLine; sendModel.City = searchDetails.SearchDetailsAddress.City; sendModel.HouseLetter = searchDetails.SearchDetailsAddress.HouseLetter; sendModel.HouseNumber = searchDetails.SearchDetailsAddress.HouseNumber; sendModel.Street = searchDetails.SearchDetailsAddress.Street; sendModel.ZipCode = searchDetails.SearchDetailsAddress.ZipCode; } sendModel.DigipostAddress = searchDetails.DigipostAddress; sendModel.FirstName = searchDetails.FirstName; sendModel.MiddleName = searchDetails.MiddleName; sendModel.LastName = searchDetails.LastName; sendModel.MobileNumber = searchDetails.MobileNumber; sendModel.OrganizationName = searchDetails.OrganizationName; return sendModel; } public static string MimeTypeToDigipostFileType(string mimeType) { if (mimeType.Equals("application/pdf", StringComparison.OrdinalIgnoreCase)) return "pdf"; if (mimeType.Equals("text/plain", StringComparison.OrdinalIgnoreCase)) return "txt"; return ""; } } }
apache-2.0
C#
0d59b73f9bde79c3b4a733e57f2d18cc453267b7
Change signature
sakapon/Samples-2017
DrawingSample/BitmapScaleConsole/BitmapHelper.cs
DrawingSample/BitmapScaleConsole/BitmapHelper.cs
using System; using System.Drawing; using System.Drawing.Drawing2D; namespace BitmapScaleConsole { public static class BitmapHelper { public static Bitmap GetScreenBitmap(int x, int y, int width, int height) { var bitmap = new Bitmap(width, height); using (var graphics = Graphics.FromImage(bitmap)) { graphics.CopyFromScreen(x, y, 0, 0, bitmap.Size); } return bitmap; } // Bilinear (Default) or HighQualityBilinear. public static Bitmap ScaleImage(Image source, int width, int height, InterpolationMode interpolationMode = InterpolationMode.HighQualityBilinear) { var bitmap = new Bitmap(width, height); using (var graphics = Graphics.FromImage(bitmap)) { graphics.InterpolationMode = interpolationMode; graphics.DrawImage(source, 0, 0, width, height); } return bitmap; } } }
using System; using System.Drawing; using System.Drawing.Drawing2D; namespace BitmapScaleConsole { public static class BitmapHelper { public static Bitmap GetScreenBitmap(int x, int y, int width, int height) { var bitmap = new Bitmap(width, height); using (var graphics = Graphics.FromImage(bitmap)) { graphics.CopyFromScreen(x, y, 0, 0, bitmap.Size); } return bitmap; } public static Bitmap ScaleImage(Image source, int width, int height) { var bitmap = new Bitmap(width, height); using (var graphics = Graphics.FromImage(bitmap)) { // Bilinear (Default) or HighQualityBilinear. graphics.InterpolationMode = InterpolationMode.HighQualityBilinear; graphics.DrawImage(source, 0, 0, width, height); } return bitmap; } } }
mit
C#
08d866331701e2a1083bab83c4c8e15753813c76
Move foreign_keys PRAGMA to a separate SQL statement (outside of a transaction)
joelverhagen/CheckRepublic,joelverhagen/CheckRepublic,joelverhagen/CheckRepublic
src/Knapcode.CheckRepublic.Logic/Entities/Migrations/20160903202322_RemoveMachineNameFromCheckBatchMigration.cs
src/Knapcode.CheckRepublic.Logic/Entities/Migrations/20160903202322_RemoveMachineNameFromCheckBatchMigration.cs
using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Migrations; namespace Knapcode.CheckRepublic.Logic.Entities.Migrations { public partial class RemoveMachineNameFromCheckBatchMigration : Migration { private const string DropMachineNameColumnSql = @" CREATE TEMPORARY TABLE CheckBatches_Temporary (CheckBatchId INTEGER, Duration TEXT, Time TEXT); INSERT INTO CheckBatches_Temporary SELECT CheckBatchId, Duration, Time FROM CheckBatches; DROP TABLE CheckBatches; CREATE TABLE CheckBatches (CheckBatchId INTEGER NOT NULL CONSTRAINT PK_CheckBatches PRIMARY KEY AUTOINCREMENT, Duration TEXT NOT NULL, Time TEXT NOT NULL); INSERT INTO CheckBatches SELECT CheckBatchId, Duration, Time FROM CheckBatches_Temporary; DROP TABLE CheckBatches_Temporary; "; protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.Sql("PRAGMA foreign_keys = OFF", suppressTransaction: true); migrationBuilder.Sql(DropMachineNameColumnSql); migrationBuilder.DropIndex( name: "IX_CheckNotifications_CheckId", table: "CheckNotifications"); /* migrationBuilder.DropColumn( name: "MachineName", table: "CheckBatches"); */ migrationBuilder.CreateIndex( name: "IX_CheckNotifications_CheckId", table: "CheckNotifications", column: "CheckId", unique: true); migrationBuilder.Sql("PRAGMA foreign_keys = ON", suppressTransaction: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_CheckNotifications_CheckId", table: "CheckNotifications"); migrationBuilder.AddColumn<string>( name: "MachineName", table: "CheckBatches", nullable: true); migrationBuilder.CreateIndex( name: "IX_CheckNotifications_CheckId", table: "CheckNotifications", column: "CheckId"); } } }
using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Migrations; namespace Knapcode.CheckRepublic.Logic.Entities.Migrations { public partial class RemoveMachineNameFromCheckBatchMigration : Migration { private const string DropMachineNameColumnSql = @" PRAGMA foreign_keys = OFF; BEGIN TRANSACTION; CREATE TEMPORARY TABLE CheckBatches_Temporary (CheckBatchId INTEGER, Duration TEXT, Time TEXT); INSERT INTO CheckBatches_Temporary SELECT CheckBatchId, Duration, Time FROM CheckBatches; DROP TABLE CheckBatches; CREATE TABLE CheckBatches (CheckBatchId INTEGER NOT NULL CONSTRAINT PK_CheckBatches PRIMARY KEY AUTOINCREMENT, Duration TEXT NOT NULL, Time TEXT NOT NULL); INSERT INTO CheckBatches SELECT CheckBatchId, Duration, Time FROM CheckBatches_Temporary; DROP TABLE CheckBatches_Temporary; COMMIT; PRAGMA foreign_keys = ON; "; protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.Sql(DropMachineNameColumnSql, suppressTransaction: true); migrationBuilder.DropIndex( name: "IX_CheckNotifications_CheckId", table: "CheckNotifications"); /* migrationBuilder.DropColumn( name: "MachineName", table: "CheckBatches"); */ migrationBuilder.CreateIndex( name: "IX_CheckNotifications_CheckId", table: "CheckNotifications", column: "CheckId", unique: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_CheckNotifications_CheckId", table: "CheckNotifications"); migrationBuilder.AddColumn<string>( name: "MachineName", table: "CheckBatches", nullable: true); migrationBuilder.CreateIndex( name: "IX_CheckNotifications_CheckId", table: "CheckNotifications", column: "CheckId"); } } }
mit
C#
e7bbbbca86a03cd8c909c66ca1eb3e07e7e6d240
fix OperationalInsight searchResult backward compatible issue
devigned/azure-powershell,AzureAutomationTeam/azure-powershell,naveedaz/azure-powershell,AzureAutomationTeam/azure-powershell,naveedaz/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,devigned/azure-powershell,ClogenyTechnologies/azure-powershell,hungmai-msft/azure-powershell,ClogenyTechnologies/azure-powershell,naveedaz/azure-powershell,AzureAutomationTeam/azure-powershell,hungmai-msft/azure-powershell,ClogenyTechnologies/azure-powershell,devigned/azure-powershell,ClogenyTechnologies/azure-powershell,devigned/azure-powershell,AzureAutomationTeam/azure-powershell,naveedaz/azure-powershell,AzureAutomationTeam/azure-powershell,naveedaz/azure-powershell,devigned/azure-powershell,devigned/azure-powershell,hungmai-msft/azure-powershell,hungmai-msft/azure-powershell,hungmai-msft/azure-powershell,naveedaz/azure-powershell,hungmai-msft/azure-powershell
src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Models/PSSearchGetSearchResultsResponse.cs
src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Models/PSSearchGetSearchResultsResponse.cs
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.Azure.Management.OperationalInsights.Models; using System; using System.Linq; using System.Collections.Generic; namespace Microsoft.Azure.Commands.OperationalInsights.Models { public class PSSearchGetSearchResultsResponse { public PSSearchGetSearchResultsResponse() { } public PSSearchGetSearchResultsResponse(SearchResultsResponse response) { if (response != null) { this.Id = response.Id; this.Metadata = new PSSearchMetadata(response.Metadata); this.Value = response.Value.Select(jObj=>jObj.ToString()).ToList(); if (response.Error != null) { this.Error = new PSSearchError(response.Error); } } } public string Id { get; set; } public PSSearchMetadata Metadata { get; set; } public IEnumerable<Object> Value { get; set; } public PSSearchError Error { get; set; } } }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.Azure.Management.OperationalInsights.Models; using System; using System.Collections.Generic; namespace Microsoft.Azure.Commands.OperationalInsights.Models { public class PSSearchGetSearchResultsResponse { public PSSearchGetSearchResultsResponse() { } public PSSearchGetSearchResultsResponse(SearchResultsResponse response) { if (response != null) { this.Id = response.Id; this.Metadata = new PSSearchMetadata(response.Metadata); this.Value = response.Value; if (response.Error != null) { this.Error = new PSSearchError(response.Error); } } } public string Id { get; set; } public PSSearchMetadata Metadata { get; set; } public IEnumerable<Object> Value { get; set; } public PSSearchError Error { get; set; } } }
apache-2.0
C#
b1c88e93ace382d31b6874f3d1cbc52525833ffc
Clear firstContext when ApplicationEntryPoint is destroyed
SlashGames/slash-framework,SlashGames/slash-framework,SlashGames/slash-framework
Source/Slash.Unity.StrangeIoC/Source/Initialization/ApplicationEntryPoint.cs
Source/Slash.Unity.StrangeIoC/Source/Initialization/ApplicationEntryPoint.cs
namespace Slash.Unity.StrangeIoC.Initialization { using System.Collections; using System.Collections.Generic; using System.Linq; using strange.extensions.context.impl; using Slash.Reflection.Utils; using Slash.Unity.InspectorExt.PropertyDrawers; using Slash.Unity.StrangeIoC.Configs; using Slash.Unity.StrangeIoC.Modules; using UnityEngine; public class ApplicationEntryPoint : ApplicationEntryPoint<ApplicationDomainContext> { } public class ApplicationEntryPoint<TDomainContext> : ModuleView where TDomainContext : ApplicationDomainContext, new() { [TypeProperty(BaseType = typeof(StrangeBridge))] public List<string> BridgeTypes; /// <summary> /// Main config for application. /// </summary> public StrangeConfig Config; private void Awake() { var domainContext = new TDomainContext(); // Add bridges. foreach (var bridgeType in this.BridgeTypes) { if (bridgeType != null) { domainContext.AddBridge(ReflectionUtils.FindType(bridgeType)); } } domainContext.Init(); domainContext.Config = this.Config; domainContext.SetModuleView(this); Context.firstContext = this.context = domainContext; } /// <inheritdoc /> protected override void OnDestroy() { base.OnDestroy(); Context.firstContext = null; } private IEnumerator LaunchContextWhenReady(TDomainContext domainContext) { yield return new WaitUntil(() => domainContext.IsReadyToLaunch); domainContext.Launch(); } private void Start() { this.context.Start(); // Launch when ready. this.StartCoroutine(this.LaunchContextWhenReady((TDomainContext) this.context)); } } }
namespace Slash.Unity.StrangeIoC.Initialization { using System.Collections; using System.Collections.Generic; using System.Linq; using strange.extensions.context.impl; using Slash.Reflection.Utils; using Slash.Unity.InspectorExt.PropertyDrawers; using Slash.Unity.StrangeIoC.Configs; using Slash.Unity.StrangeIoC.Modules; using UnityEngine; public class ApplicationEntryPoint : ApplicationEntryPoint<ApplicationDomainContext> { } public class ApplicationEntryPoint<TDomainContext> : ModuleView where TDomainContext : ApplicationDomainContext, new() { [TypeProperty(BaseType = typeof(StrangeBridge))] public List<string> BridgeTypes; /// <summary> /// Main config for application. /// </summary> public StrangeConfig Config; private void Awake() { var domainContext = new TDomainContext(); // Add bridges. foreach (var bridgeType in this.BridgeTypes) { if (bridgeType != null) { domainContext.AddBridge(ReflectionUtils.FindType(bridgeType)); } } domainContext.Init(); domainContext.Config = this.Config; domainContext.SetModuleView(this); Context.firstContext = this.context = domainContext; } private IEnumerator LaunchContextWhenReady(TDomainContext domainContext) { yield return new WaitUntil(() => domainContext.IsReadyToLaunch); domainContext.Launch(); } private void Start() { this.context.Start(); // Launch when ready. this.StartCoroutine(this.LaunchContextWhenReady((TDomainContext) this.context)); } } }
mit
C#
ad6b2fe6d6efef1da4e4ec370d23caaba4459a67
Bump version to 1.1.0
mj1856/NodaTime.NetworkClock
NodaTime.NetworkClock/Properties/AssemblyInfo.cs
NodaTime.NetworkClock/Properties/AssemblyInfo.cs
using System.Reflection; [assembly: AssemblyCompany("Matt Johnson")] [assembly: AssemblyProduct("NodaTime.NetworkClock")] [assembly: AssemblyCopyright("Copyright © Matt Johnson. MIT Licensed.")] [assembly: AssemblyTitle("NodaTime.NetworkClock")] [assembly: AssemblyDescription("A NodaTime.IClock implementation that gets the current time from an NTP server instead of the computer's local clock.")] [assembly: AssemblyVersion("1.1.0.*")] [assembly: AssemblyInformationalVersion("1.1.0")]
using System.Reflection; [assembly: AssemblyCompany("Matt Johnson")] [assembly: AssemblyProduct("NodaTime.NetworkClock")] [assembly: AssemblyCopyright("Copyright © 2014, Matt Johnson. MIT Licensed.")] [assembly: AssemblyTitle("NodaTime.NetworkClock")] [assembly: AssemblyDescription("A NodaTime.IClock implementation that gets the current time from an NTP server instead of the computer's local clock.")] [assembly: AssemblyVersion("1.0.1.*")] [assembly: AssemblyInformationalVersion("1.0.1")]
mit
C#
45a658388ed70b236634444ea783d6c7512817bc
update nuget
weitaolee/Orleans.EventSourcing
Orleans.EventSourcing/Properties/AssemblyInfo.cs
Orleans.EventSourcing/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的常规信息通过以下 // 特性集控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Orleans.EventSourcing")] [assembly: AssemblyDescription("Orleans Event-Sourcing Libary")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Witte Lee")] [assembly: AssemblyProduct("Orleans.EventSourcing")] [assembly: AssemblyCopyright("Copyright © Witte Lee 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("f82b183c-c122-4e97-825a-636770f135d9")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.2.1")] [assembly: AssemblyFileVersion("1.0.2.1")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的常规信息通过以下 // 特性集控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Orleans.EventSourcing")] [assembly: AssemblyDescription("Orleans Event-Sourcing Libary")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Witte Lee")] [assembly: AssemblyProduct("Orleans.EventSourcing")] [assembly: AssemblyCopyright("Copyright © Witte Lee 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("f82b183c-c122-4e97-825a-636770f135d9")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.1.2")] [assembly: AssemblyFileVersion("1.0.1.2")]
mit
C#
8c00b1daa0d9b09b8cf857972d3a876c2548fb1b
Update ValuesOut.cs
EricZimmerman/RegistryPlugins
RegistryPlugin.TerminalServerClient/ValuesOut.cs
RegistryPlugin.TerminalServerClient/ValuesOut.cs
using System; using RegistryPluginBase.Interfaces; namespace RegistryPlugin.TerminalServerClient { public class ValuesOut:IValueOut { public ValuesOut(int mru, string host, string user, DateTimeOffset lastmod) { MRUPosition = mru; HostName = host; Username = user; LastModified = lastmod.UtcDateTime; } public string HostName { get; } public string Username { get; } public int MRUPosition { get; } public DateTime LastModified { get; } public string BatchKeyPath { get; set; } public string BatchValueName { get; set; } public string BatchValueData1 => HostName; public string BatchValueData2 => $"User: {Username}, MRU: {MRUPosition}"; public string BatchValueData3 => $"Last modified: {LastModified.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}"; } }
using System; using RegistryPluginBase.Interfaces; namespace RegistryPlugin.TerminalServerClient { public class ValuesOut:IValueOut { public ValuesOut(int mru, string host, string user, DateTimeOffset lastmod) { MRUPosition = mru; HostName = host; Username = user; LastModified = lastmod.UtcDateTime; } public string HostName { get; } public string Username { get; } public int MRUPosition { get; } public DateTime LastModified { get; } public string BatchKeyPath { get; set; } public string BatchValueName { get; set; } public string BatchValueData1 => HostName; public string BatchValueData2 => $"User: {Username}, MRU: {MRUPosition}"; public string BatchValueData3 => $"Last modified: {LastModified.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff} "; } }
mit
C#
99e8b659f953105bb6a45df834b771cdf1656ce0
Remove unused method
MelHarbour/HeadRaceTiming-Site,MelHarbour/HeadRaceTiming-Site,MelHarbour/HeadRaceTiming-Site
HeadRaceTiming-Site/Controllers/CrewApiController.cs
HeadRaceTiming-Site/Controllers/CrewApiController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using HeadRaceTimingSite.Models; using Microsoft.EntityFrameworkCore; // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 namespace HeadRaceTimingSite.Controllers { [Route("api/[controller]")] public class CrewApiController : Controller { private readonly TimingSiteContext _context; public CrewApiController(TimingSiteContext context) { _context = context; } [HttpGet("{id}")] public async Task<Crew> GetById(int id) { return await _context.Crews.FirstOrDefaultAsync(x => x.CrewId == id); } [HttpGet("ByCompetition/{id}")] public async Task<IEnumerable<Crew>> GetByCompetition(int id) { return await _context.Crews.Where(c => c.CompetitionId == id) .Include(x => x.Competition.TimingPoints).Include(x => x.Results).ToListAsync(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using HeadRaceTimingSite.Models; using Microsoft.EntityFrameworkCore; // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 namespace HeadRaceTimingSite.Controllers { [Route("api/[controller]")] public class CrewApiController : Controller { private readonly TimingSiteContext _context; public CrewApiController(TimingSiteContext context) { _context = context; } [HttpGet] public async Task<IEnumerable<Crew>> GetAll() { return await _context.Crews.Include(x => x.Competition.TimingPoints).Include(x => x.Results).ToListAsync(); } [HttpGet("{id}")] public async Task<Crew> GetById(int id) { return await _context.Crews.FirstOrDefaultAsync(x => x.CrewId == id); } [HttpGet("ByCompetition/{id}")] public async Task<IEnumerable<Crew>> GetByCompetition(int id) { return await _context.Crews.Where(c => c.CompetitionId == id) .Include(x => x.Competition.TimingPoints).Include(x => x.Results).ToListAsync(); } } }
mit
C#
d5964e24ec1e745ae5868dcab13cf14376ca6972
fix constructor for rest service
XamarinGarage/GiTracker
GiTracker/Services/Rest/RestService.cs
GiTracker/Services/Rest/RestService.cs
using System; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; using GiTracker.Services.HttpClientProvider; namespace GiTracker.Services.Rest { internal class RestService : IRestService { protected readonly IHttpClientProvider HttpClientProvider; public RestService(IHttpClientProvider httpClientProvider) { HttpClientProvider = httpClientProvider; } public async Task<object> GetAsync(string host, string url, Type responseType, CancellationToken cancellationToken) { using (var client = HttpClientProvider.CreateHttpClient()) { using (var response = await client.GetAsync(HttpClientProvider.GetRequestUrl(host, url), cancellationToken).ConfigureAwait(false)) { cancellationToken.ThrowIfCancellationRequested(); if (!response.IsSuccessStatusCode) throw new Exception(response.ToString()); var data = await response.Content.ReadAsStringAsync().ConfigureAwait(false); return JsonConvert.DeserializeObject(data, responseType); } } } public async Task<T> GetAsync<T>(string host, string url, CancellationToken cancellationToken) { var response = await GetAsync(host, url, typeof(T), cancellationToken); return (T)response; } } }
using System; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; using GiTracker.Services.HttpClientProvider; namespace GiTracker.Services.Rest { internal class RestService : IRestService { protected readonly IHttpClientProvider HttpClientProvider; protected RestService(IHttpClientProvider httpClientProvider) { HttpClientProvider = httpClientProvider; } public async Task<object> GetAsync(string host, string url, Type responseType, CancellationToken cancellationToken) { using (var client = HttpClientProvider.CreateHttpClient()) { using (var response = await client.GetAsync(HttpClientProvider.GetRequestUrl(host, url), cancellationToken).ConfigureAwait(false)) { cancellationToken.ThrowIfCancellationRequested(); if (!response.IsSuccessStatusCode) throw new Exception(response.ToString()); var data = await response.Content.ReadAsStringAsync().ConfigureAwait(false); return JsonConvert.DeserializeObject(data, responseType); } } } public async Task<T> GetAsync<T>(string host, string url, CancellationToken cancellationToken) { var response = await GetAsync(host, url, typeof(T), cancellationToken); return (T)response; } } }
apache-2.0
C#
33822a5a063f3a4ca63884f656c002e5f077ebbf
Remove : to avoid jekyl problem with example
MarcosMeli/FileHelpers,aim00ver/FileHelpers,jbparker/FileHelpers,p07r0457/FileHelpers,xavivars/FileHelpers,guillaumejay/FileHelpers
FileHelpers.Examples/Examples/10.QuickStart/30.ReadFileFixed.cs
FileHelpers.Examples/Examples/10.QuickStart/30.ReadFileFixed.cs
using System; using System.Collections; using System.Collections.Generic; using FileHelpers; namespace ExamplesFx { //-> Name:Read Fixed File //-> Description:Example of how to read a Fixed Length layout file (eg COBOL output) //-> AutoRun:true public class ReadFixedFile : ExampleBase { //-> Let's start with a simple file: //-> FileIn:Input.txt /*01010 Alfreds Futterkiste 13122005 12399 Ana Trujillo Emparedados y 23012000 00011 Antonio Moreno Taquería 21042001 51677 Around the Horn 13051998 99999 Berglunds snabbköp 02111999*/ //-> /FileIn //-> We define the record layout: //-> File:RecordClass.cs [FixedLengthRecord()] public class Customer { [FieldFixedLength(5)] public int CustId; [FieldFixedLength(30)] [FieldTrim(TrimMode.Both)] public string Name; [FieldFixedLength(8)] [FieldConverter(ConverterKind.Date, "ddMMyyyy")] public DateTime AddedDate; } //-> /File //-> Read the values and write them to the Console: public override void Run() { //-> File:Example.cs var engine = new FixedFileEngine<Customer>(); Customer[] result = engine.ReadFile("input.txt"); foreach (var detail in result) Console.WriteLine(" Client: {0}, Name: {1}", detail.CustId, detail.Name); //-> /File } //-> Console } }
using System; using System.Collections; using System.Collections.Generic; using FileHelpers; namespace ExamplesFx { //-> Name:Read Fixed File //-> Description:Example of how to read a Fixed Length layout file (eg COBOL output): //-> AutoRun:true public class ReadFixedFile : ExampleBase { //-> Let's start with a simple file: //-> FileIn:Input.txt /*01010 Alfreds Futterkiste 13122005 12399 Ana Trujillo Emparedados y 23012000 00011 Antonio Moreno Taquería 21042001 51677 Around the Horn 13051998 99999 Berglunds snabbköp 02111999*/ //-> /FileIn //-> We define the record layout: //-> File:RecordClass.cs [FixedLengthRecord()] public class Customer { [FieldFixedLength(5)] public int CustId; [FieldFixedLength(30)] [FieldTrim(TrimMode.Both)] public string Name; [FieldFixedLength(8)] [FieldConverter(ConverterKind.Date, "ddMMyyyy")] public DateTime AddedDate; } //-> /File //-> Read the values and write them to the Console: public override void Run() { //-> File:Example.cs var engine = new FixedFileEngine<Customer>(); Customer[] result = engine.ReadFile("input.txt"); foreach (var detail in result) Console.WriteLine(" Client: {0}, Name: {1}", detail.CustId, detail.Name); //-> /File } //-> Console } }
mit
C#
4678c1ce804f5a94dfd6472e3f337bb02230bfdd
simplify conversion of visibility
PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer
StandUpTimer/Views/InverseVisibilityConverter.cs
StandUpTimer/Views/InverseVisibilityConverter.cs
using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace StandUpTimer.Views { public class InverseVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var visibility = value as Visibility? ?? Visibility.Visible; return visibility == Visibility.Visible ? Visibility.Hidden : Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace StandUpTimer.Views { public class InverseVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var visibility = value is Visibility ? (Visibility) value : Visibility.Visible; return visibility == Visibility.Visible ? Visibility.Hidden : Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
mit
C#
633b34dcbdd1564c0347575a995501ba14660ac2
fix failing linux test
toddams/RazorLight,toddams/RazorLight
tests/RazorLight.Tests/Utils/DirectoryUtils.cs
tests/RazorLight.Tests/Utils/DirectoryUtils.cs
using System.IO; namespace RazorLight.Tests.Utils { public static class DirectoryUtils { public static string RootDirectory { get { var location = typeof(DirectoryUtils).Assembly.Location; if (!Directory.Exists(location)) throw new DirectoryNotFoundException($"Could not find location [{location}]."); return location; } } } }
using System.IO; namespace RazorLight.Tests.Utils { public static class DirectoryUtils { public static string RootDirectory => Directory.GetCurrentDirectory(); } }
apache-2.0
C#
79ac64a0885620f9755fb5cc82cb226c34cb21c5
Split out editor save steps to try and catch test failure
smoogipoo/osu,peppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,ppy/osu,ppy/osu
osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs
osu.Game.Tests/Visual/Editing/TestSceneEditorSaving.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using NUnit.Framework; using osu.Framework.Input; using osu.Framework.Testing; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit; using osu.Game.Screens.Menu; using osu.Game.Screens.Select; using osuTK.Input; namespace osu.Game.Tests.Visual.Editing { public class TestSceneEditorSaving : OsuGameTestScene { private Editor editor => Game.ChildrenOfType<Editor>().FirstOrDefault(); private EditorBeatmap editorBeatmap => (EditorBeatmap)editor.Dependencies.Get(typeof(EditorBeatmap)); /// <summary> /// Tests the general expected flow of creating a new beatmap, saving it, then loading it back from song select. /// </summary> [Test] public void TestNewBeatmapSaveThenLoad() { AddStep("set default beatmap", () => Game.Beatmap.SetDefault()); PushAndConfirm(() => new EditorLoader()); AddUntilStep("wait for editor load", () => editor != null); AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint())); AddStep("Enter compose mode", () => InputManager.Key(Key.F1)); AddUntilStep("Wait for compose mode load", () => editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true); AddStep("Change to placement mode", () => InputManager.Key(Key.Number2)); AddStep("Move to playfield", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre)); AddStep("Place single hitcircle", () => InputManager.Click(MouseButton.Left)); AddAssert("Beatmap contains single hitcircle", () => editorBeatmap.HitObjects.Count == 1); AddStep("Save", () => InputManager.Keys(PlatformAction.Save)); AddStep("Exit", () => InputManager.Key(Key.Escape)); AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu); PushAndConfirm(() => new PlaySongSelect()); AddUntilStep("Wait for beatmap selected", () => !Game.Beatmap.IsDefault); AddStep("Open options", () => InputManager.Key(Key.F3)); AddStep("Enter editor", () => InputManager.Key(Key.Number5)); AddUntilStep("Wait for editor load", () => editor != null); AddAssert("Beatmap contains single hitcircle", () => editorBeatmap.HitObjects.Count == 1); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using NUnit.Framework; using osu.Framework.Input; using osu.Framework.Testing; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit; using osu.Game.Screens.Menu; using osu.Game.Screens.Select; using osuTK.Input; namespace osu.Game.Tests.Visual.Editing { public class TestSceneEditorSaving : OsuGameTestScene { private Editor editor => Game.ChildrenOfType<Editor>().FirstOrDefault(); private EditorBeatmap editorBeatmap => (EditorBeatmap)editor.Dependencies.Get(typeof(EditorBeatmap)); /// <summary> /// Tests the general expected flow of creating a new beatmap, saving it, then loading it back from song select. /// </summary> [Test] public void TestNewBeatmapSaveThenLoad() { AddStep("set default beatmap", () => Game.Beatmap.SetDefault()); PushAndConfirm(() => new EditorLoader()); AddUntilStep("wait for editor load", () => editor != null); AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint())); AddStep("Enter compose mode", () => InputManager.Key(Key.F1)); AddUntilStep("Wait for compose mode load", () => editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true); AddStep("Change to placement mode", () => InputManager.Key(Key.Number2)); AddStep("Move to playfield", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre)); AddStep("Place single hitcircle", () => InputManager.Click(MouseButton.Left)); AddStep("Save and exit", () => { InputManager.Keys(PlatformAction.Save); InputManager.Key(Key.Escape); }); AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu); PushAndConfirm(() => new PlaySongSelect()); AddUntilStep("Wait for beatmap selected", () => !Game.Beatmap.IsDefault); AddStep("Open options", () => InputManager.Key(Key.F3)); AddStep("Enter editor", () => InputManager.Key(Key.Number5)); AddUntilStep("Wait for editor load", () => editor != null); AddAssert("Beatmap contains single hitcircle", () => editorBeatmap.HitObjects.Count == 1); } } }
mit
C#
242c63091fa79f9d58982a7e184079fb8309c7e7
Revert "Update EventArgsCache.cs"
Fody/PropertyChanged
PropertyChanged.Fody/EventArgsCache.cs
PropertyChanged.Fody/EventArgsCache.cs
using System.Collections.Generic; using System.Linq; using Mono.Cecil; using Mono.Cecil.Cil; public class EventArgsCache { public EventArgsCache(ModuleWeaver moduleWeaver) { this.moduleWeaver = moduleWeaver; var attributes = TypeAttributes.AutoClass | TypeAttributes.AutoLayout | TypeAttributes.Abstract | TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit | TypeAttributes.Class | TypeAttributes.NotPublic; cacheTypeDefinition = new TypeDefinition(moduleWeaver.ModuleDefinition.Name, "<>PropertyChangedEventArgs", attributes, moduleWeaver.TypeSystem.ObjectReference); } public FieldReference GetEventArgsField(string propertyName) { if (!properties.TryGetValue(propertyName, out var field)) { var attributes = FieldAttributes.Assembly | FieldAttributes.Static | FieldAttributes.InitOnly; field = new FieldDefinition(propertyName, attributes, moduleWeaver.PropertyChangedEventArgsReference); properties.Add(propertyName, field); } return field; } public void InjectType() { if (properties.Count == 0) return; var attributes = MethodAttributes.Private | MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName | MethodAttributes.Static; var cctor = new MethodDefinition(".cctor", attributes, moduleWeaver.TypeSystem.VoidReference); foreach (var pair in properties.OrderBy(i => i.Key)) { var propertyName = pair.Key; var eventArgsField = pair.Value; cacheTypeDefinition.Fields.Add(eventArgsField); cctor.Body.Instructions.Append( Instruction.Create(OpCodes.Ldstr, propertyName), Instruction.Create(OpCodes.Newobj, moduleWeaver.PropertyChangedEventConstructorReference), Instruction.Create(OpCodes.Stsfld, eventArgsField) ); } cctor.Body.Instructions.Append( Instruction.Create(OpCodes.Ret) ); cacheTypeDefinition.Methods.Add(cctor); moduleWeaver.ModuleDefinition.Types.Add(cacheTypeDefinition); } ModuleWeaver moduleWeaver; TypeDefinition cacheTypeDefinition; Dictionary<string, FieldDefinition> properties = new Dictionary<string, FieldDefinition>(); }
using System.Collections.Generic; using System.Linq; using Mono.Cecil; using Mono.Cecil.Cil; public class EventArgsCache { public EventArgsCache(ModuleWeaver moduleWeaver) { this.moduleWeaver = moduleWeaver; var attributes = TypeAttributes.AutoClass | TypeAttributes.AutoLayout | TypeAttributes.Abstract | TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit | TypeAttributes.Class | TypeAttributes.NotPublic; // need to qualify the namespace to avoid linker issues var nameSpace = moduleWeaver.ModuleDefinition.Name; cacheTypeDefinition = new TypeDefinition(nameSpace, "<>PropertyChangedEventArgs", attributes, moduleWeaver.TypeSystem.ObjectReference); } public FieldReference GetEventArgsField(string propertyName) { if (!properties.TryGetValue(propertyName, out var field)) { var attributes = FieldAttributes.Assembly | FieldAttributes.Static | FieldAttributes.InitOnly; field = new FieldDefinition(propertyName, attributes, moduleWeaver.PropertyChangedEventArgsReference); properties.Add(propertyName, field); } return field; } public void InjectType() { if (properties.Count == 0) return; var attributes = MethodAttributes.Private | MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName | MethodAttributes.Static; var cctor = new MethodDefinition(".cctor", attributes, moduleWeaver.TypeSystem.VoidReference); foreach (var pair in properties.OrderBy(i => i.Key)) { var propertyName = pair.Key; var eventArgsField = pair.Value; cacheTypeDefinition.Fields.Add(eventArgsField); cctor.Body.Instructions.Append( Instruction.Create(OpCodes.Ldstr, propertyName), Instruction.Create(OpCodes.Newobj, moduleWeaver.PropertyChangedEventConstructorReference), Instruction.Create(OpCodes.Stsfld, eventArgsField) ); } cctor.Body.Instructions.Append( Instruction.Create(OpCodes.Ret) ); cacheTypeDefinition.Methods.Add(cctor); moduleWeaver.ModuleDefinition.Types.Add(cacheTypeDefinition); } ModuleWeaver moduleWeaver; TypeDefinition cacheTypeDefinition; Dictionary<string, FieldDefinition> properties = new Dictionary<string, FieldDefinition>(); }
mit
C#
87eebad8bd5bb0b93515de9be88af6e210f41de8
remove credentials
MatthiWare/SmsAndCall
SmsAndCallClient/SmsAndCallClient/Api/Credentials.cs
SmsAndCallClient/SmsAndCallClient/Api/Credentials.cs
namespace MatthiWare.SmsAndCallClient.Api { internal static class Credentials { internal const string TWILIO_ACC_SID = "your sid token"; internal const string TWILIO_AUTH_TOKEN = "secret"; internal const string CLICKATELL_API_KEY = "secret"; } }
namespace MatthiWare.SmsAndCallClient.Api { internal static class Credentials { internal const string TWILIO_ACC_SID = "***REMOVED***"; internal const string TWILIO_AUTH_TOKEN = "***REMOVED***"; internal const string CLICKATELL_API_KEY = ""; } }
mit
C#
f5ad27b1c0ae2e2a09834619790dff6d03adbd84
Add dependency on Sequence and Fungus Script components
snozbot/fungus,kdoore/Fungus,lealeelu/Fungus,Nilihum/fungus,inarizushi/Fungus,RonanPearce/Fungus,tapiralec/Fungus,FungusGames/Fungus
Assets/Fungus/FungusScript/Scripts/EventHandler.cs
Assets/Fungus/FungusScript/Scripts/EventHandler.cs
using UnityEngine; using System; using System.Collections; using System.Collections.Generic; namespace Fungus { public class EventHandlerInfoAttribute : Attribute { public EventHandlerInfoAttribute(string category, string eventHandlerName, string helpText) { this.Category = category; this.EventHandlerName = eventHandlerName; this.HelpText = helpText; } public string Category { get; set; } public string EventHandlerName { get; set; } public string HelpText { get; set; } } /** * A Sequence may have an associated Event Handler which starts executing the sequence when * a specific event occurs. * To create a custom Event Handler, simply subclass EventHandler and call the ExecuteSequence() method * when the event occurs. * Add an EventHandlerInfo attibute and your new EventHandler class will automatically appear in the * 'Start Event' dropdown menu when a sequence is selected. */ [RequireComponent(typeof(Sequence))] [RequireComponent(typeof(FungusScript))] public class EventHandler : MonoBehaviour { [HideInInspector] public Sequence parentSequence; /** * The Event Handler should call this method when the event is detected. */ public virtual bool ExecuteSequence() { if (parentSequence == null) { return false; } FungusScript fungusScript = parentSequence.GetFungusScript(); return fungusScript.ExecuteSequence(parentSequence); } } }
using UnityEngine; using System; using System.Collections; using System.Collections.Generic; namespace Fungus { public class EventHandlerInfoAttribute : Attribute { public EventHandlerInfoAttribute(string category, string eventHandlerName, string helpText) { this.Category = category; this.EventHandlerName = eventHandlerName; this.HelpText = helpText; } public string Category { get; set; } public string EventHandlerName { get; set; } public string HelpText { get; set; } } /** * A Sequence may have an associated Event Handler which starts executing the sequence when * a specific event occurs. * To create a custom Event Handler, simply subclass EventHandler and call the ExecuteSequence() method * when the event occurs. * Add an EventHandlerInfo attibute and your new EventHandler class will automatically appear in the * 'Start Event' dropdown menu when a sequence is selected. */ public class EventHandler : MonoBehaviour { [HideInInspector] public Sequence parentSequence; /** * The Event Handler should call this method when the event is detected. */ public virtual bool ExecuteSequence() { if (parentSequence == null) { return false; } FungusScript fungusScript = parentSequence.GetFungusScript(); return fungusScript.ExecuteSequence(parentSequence); } } }
mit
C#
c575625a6dc9fa9fce8396d91660c3d126a14d33
Set default text alignment to left for FlowDocument.
aluxnimm/outlookcaldavsynchronizer
CalDavSynchronizer.Conversions/RtfXamlConverter.cs
CalDavSynchronizer.Conversions/RtfXamlConverter.cs
using System.IO; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Markup; using System.Xml; namespace CalDavSynchronizer.Conversions { internal class RtfXamlConverter { public static string ConvertRtfToXaml (string rtfText) { if (string.IsNullOrEmpty (rtfText)) return ""; var flowDocument = new FlowDocument (); var textRange = new TextRange (flowDocument.ContentStart, flowDocument.ContentEnd); using (var rtfMemoryStream = new MemoryStream ()) { using (var rtfStreamWriter = new StreamWriter (rtfMemoryStream)) { rtfStreamWriter.Write (rtfText); rtfStreamWriter.Flush (); rtfMemoryStream.Seek (0, SeekOrigin.Begin); textRange.Load (rtfMemoryStream, DataFormats.Rtf); } } return XamlWriter.Save(flowDocument); } public static string ConvertXamlToRtf(string xamlText) { FlowDocument flowDocument; using (var xamlTextReader = new StringReader(xamlText)) using (var xamlXmlReader = new XmlTextReader(xamlTextReader)) { flowDocument = (FlowDocument) XamlReader.Load(xamlXmlReader); flowDocument.SetValue (FlowDocument.TextAlignmentProperty, TextAlignment.Left); } using (var rtfMemoryStream = new MemoryStream()) { var textRange = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd); textRange.Save(rtfMemoryStream, DataFormats.Rtf); rtfMemoryStream.Seek(0, SeekOrigin.Begin); using (var rtfStreamReader = new StreamReader(rtfMemoryStream)) { return rtfStreamReader.ReadToEnd(); } } } } }
using System.IO; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Markup; using System.Xml; namespace CalDavSynchronizer.Conversions { internal class RtfXamlConverter { public static string ConvertRtfToXaml (string rtfText) { if (string.IsNullOrEmpty (rtfText)) return ""; var flowDocument = new FlowDocument (); var textRange = new TextRange (flowDocument.ContentStart, flowDocument.ContentEnd); using (var rtfMemoryStream = new MemoryStream ()) { using (var rtfStreamWriter = new StreamWriter (rtfMemoryStream)) { rtfStreamWriter.Write (rtfText); rtfStreamWriter.Flush (); rtfMemoryStream.Seek (0, SeekOrigin.Begin); textRange.Load (rtfMemoryStream, DataFormats.Rtf); } } return XamlWriter.Save(flowDocument); } public static string ConvertXamlToRtf(string xamlText) { FlowDocument flowDocument; using (var xamlTextReader = new StringReader(xamlText)) using (var xamlXmlReader = new XmlTextReader(xamlTextReader)) { flowDocument = (FlowDocument) XamlReader.Load(xamlXmlReader); } using (var rtfMemoryStream = new MemoryStream()) { var textRange = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd); textRange.Save(rtfMemoryStream, DataFormats.Rtf); rtfMemoryStream.Seek(0, SeekOrigin.Begin); using (var rtfStreamReader = new StreamReader(rtfMemoryStream)) { return rtfStreamReader.ReadToEnd(); } } } } }
agpl-3.0
C#
92a969b0483ee9cf5fd7d34995f6193bdda32093
Add SystemProgramming Lab2 Variant18
pugachAG/univ,pugachAG/univ,pugachAG/univ
SystemProgramming/Lab2/Lab2/Program.cs
SystemProgramming/Lab2/Lab2/Program.cs
using Lab2.Automata; using Lab2.Common; using Lab2.IO; using Lab2.RegularExpressions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Lab2 { class Program { public const string FileName = @"D:\Dev\univ\SystemProgramming\Lab2\Lab2.Test\Assets\Automaton1Definition.txt"; static void Main(string[] args) { Variant18(); Console.WriteLine(); Variant3(); Console.ReadLine(); } static void Variant3() { FiniteStateAutomaton automaton = ReadAutomaton(); while (true) { Console.WriteLine("Input string:"); string str = Console.ReadLine(); Console.WriteLine("Recognition result: {0}", automaton.CheckRecognizable(str)); } } static void Variant18() { FiniteStateAutomaton automaton = ReadAutomaton(); RegularExpression regex = AutomatonToRegExConvert.StateRemovalMethod(automaton); Console.WriteLine(regex.ToString()); } static FiniteStateAutomaton ReadAutomaton() { IAutomaton automaton = null; try { string[] lines = System.IO.File.ReadAllLines(FileName); automaton = AutomatonReader.ReadAutomaton(lines); } catch (Exception ex) { Console.WriteLine(ex.Message); } return automaton as FiniteStateAutomaton; } } }
using Lab2.Automata; using Lab2.IO; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Lab2 { class Program { public const string FileName = @"D:\Dev\univ\SystemProgramming\Lab2\Lab2.Test\Assets\Automaton1Definition.txt"; static void Main(string[] args) { Variant3(); Console.ReadLine(); } static void Variant3() { IAutomaton automaton = null; try { string[] lines = System.IO.File.ReadAllLines(FileName); automaton = AutomatonReader.ReadAutomaton(lines); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } while (true) { Console.WriteLine("Input string:"); string str = Console.ReadLine(); Console.WriteLine("Recognition result: {0}", automaton.CheckRecognizable(str)); } } } }
mit
C#
17fda44ff6729107e149b95f5b3be7cb566aef45
Add obsolete flag to Interface
JC-Chris/Xamarin.Plugins,jamesmontemagno/Xamarin.Plugins,tim-hoff/Xamarin.Plugins,predictive-technology-laboratory/Xamarin.Plugins,labdogg1003/Xamarin.Plugins,monostefan/Xamarin.Plugins,LostBalloon1/Xamarin.Plugins
Settings/Refractored.Xam.Settings.Abstractions/ISettings.cs
Settings/Refractored.Xam.Settings.Abstractions/ISettings.cs
 using System; namespace Refractored.Xam.Settings.Abstractions { /// <summary> /// Main interface for settings /// </summary> public interface ISettings { /// <summary> /// Gets the current value or the default that you specify. /// </summary> /// <typeparam name="T">Vaue of t (bool, int, float, long, string)</typeparam> /// <param name="key">Key for settings</param> /// <param name="defaultValue">default value if not set</param> /// <returns>Value or default</returns> T GetValueOrDefault<T>(string key, T defaultValue = default(T)); /// <summary> /// Adds or updates the value /// </summary> /// <param name="key">Key for settting</param> /// <param name="value">Value to set</param> /// <returns>True of was added or updated and you need to save it.</returns> bool AddOrUpdateValue<T>(string key, T value); /// <summary> /// Adds or updates the value /// </summary> /// <param name="key">Key for settting</param> /// <param name="value">Value to set</param> /// <returns>True of was added or updated and you need to save it.</returns> [Obsolete("This method is now obsolete, please use generic version as this may be removed in the future.")] bool AddOrUpdateValue(string key, Object value); /// <summary> /// Removes a desired key from the settings /// </summary> /// <param name="key">Key for setting</param> void Remove(string key); /// <summary> /// Saves any changes out. /// </summary> [Obsolete("Save is deprecated and settings are automatically saved when AddOrUpdateValue is called.")] void Save(); } }
 using System; namespace Refractored.Xam.Settings.Abstractions { /// <summary> /// Main interface for settings /// </summary> public interface ISettings { /// <summary> /// Gets the current value or the default that you specify. /// </summary> /// <typeparam name="T">Vaue of t (bool, int, float, long, string)</typeparam> /// <param name="key">Key for settings</param> /// <param name="defaultValue">default value if not set</param> /// <returns>Value or default</returns> T GetValueOrDefault<T>(string key, T defaultValue = default(T)); /// <summary> /// Adds or updates the value /// </summary> /// <param name="key">Key for settting</param> /// <param name="value">Value to set</param> /// <returns>True of was added or updated and you need to save it.</returns> bool AddOrUpdateValue<T>(string key, T value); /// <summary> /// Adds or updates the value /// </summary> /// <param name="key">Key for settting</param> /// <param name="value">Value to set</param> /// <returns>True of was added or updated and you need to save it.</returns> bool AddOrUpdateValue(string key, Object value); /// <summary> /// Removes a desired key from the settings /// </summary> /// <param name="key">Key for setting</param> void Remove(string key); /// <summary> /// Saves any changes out. /// </summary> [Obsolete("Save is deprecated and settings are automatically saved when AddOrUpdateValue is called.")] void Save(); } }
mit
C#
9a39ea0f6be50646215911de333fb8e14ab59564
Copy the internal address on reports
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Services/ReportService.cs
Battery-Commander.Web/Services/ReportService.cs
using BatteryCommander.Web.Models; using FluentEmail.Core; using System.IO; using System.Threading.Tasks; namespace BatteryCommander.Web.Services { public class ReportService { private readonly Database db; private readonly IFluentEmailFactory emailSvc; public ReportService(Database db, IFluentEmailFactory emailSvc) { this.db = db; this.emailSvc = emailSvc; } public async Task SendPerstatReport(int unitId) { var unit = await UnitService.Get(db, unitId); await emailSvc .Create() .To(unit.PERSTAT.Recipients) .SetFrom(unit.PERSTAT.From.EmailAddress, unit.PERSTAT.From.Name) .BCC(new[] { unit.PERSTAT.From, new FluentEmail.Core.Models.Address(emailAddress: "Reports@redleg.app") }) .Subject($"{unit.Name} | RED 1 PERSTAT") .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Jobs/Red1_Perstat.html", unit) .SendWithErrorCheck(); } public async Task SendSensitiveItems(int unitId) { var unit = await UnitService.Get(db, unitId); await emailSvc .Create() .To(unit.SensitiveItems.Recipients) .SetFrom(unit.SensitiveItems.From.EmailAddress, unit.SensitiveItems.From.Name) .BCC(new[] { unit.SensitiveItems.From, new FluentEmail.Core.Models.Address(emailAddress: "Reports@redleg.app") }) .Subject($"{unit.Name} | GREEN 3 Report | {unit.SensitiveItems.Status}") .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Jobs/Green3_SensitiveItems.html", unit) .SendWithErrorCheck(); } } }
using BatteryCommander.Web.Models; using FluentEmail.Core; using System.IO; using System.Threading.Tasks; namespace BatteryCommander.Web.Services { public class ReportService { private readonly Database db; private readonly IFluentEmailFactory emailSvc; public ReportService(Database db, IFluentEmailFactory emailSvc) { this.db = db; this.emailSvc = emailSvc; } public async Task SendPerstatReport(int unitId) { var unit = await UnitService.Get(db, unitId); await emailSvc .Create() .To(unit.PERSTAT.Recipients) .SetFrom(unit.PERSTAT.From.EmailAddress, unit.PERSTAT.From.Name) .BCC(unit.PERSTAT.From.EmailAddress, unit.PERSTAT.From.Name) .Subject($"{unit.Name} | RED 1 PERSTAT") .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Jobs/Red1_Perstat.html", unit) .SendWithErrorCheck(); } public async Task SendSensitiveItems(int unitId) { var unit = await UnitService.Get(db, unitId); await emailSvc .Create() .To(unit.SensitiveItems.Recipients) .SetFrom(unit.SensitiveItems.From.EmailAddress, unit.SensitiveItems.From.Name) .BCC(unit.SensitiveItems.From.EmailAddress, unit.SensitiveItems.From.Name) .Subject($"{unit.Name} | GREEN 3 Report | {unit.SensitiveItems.Status}") .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Jobs/Green3_SensitiveItems.html", unit) .SendWithErrorCheck(); } } }
mit
C#
c46541a6cbbf1e2700c32d43c1c12d2035b71d3f
Add remaining list columns
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Views/Weapons/List.cshtml
Battery-Commander.Web/Views/Weapons/List.cshtml
@model WeaponListViewModel @{ ViewBag.Title = "Master Authorization List"; } <div class="page-header"> <h1> @ViewBag.Title @Html.ActionLink("Add New", "New", "Weapons", null, new { @class = "btn btn-default" }) </h1> </div> <div id="weapon-list"> <table class="table table-striped display nowrap" width="100%" id="dt"> <thead> <tr> <th>@Html.DisplayNameFor(_ => _.Weapons.FirstOrDefault().Unit)</th> <th>@Html.DisplayNameFor(_ => _.Weapons.FirstOrDefault().Type)</th> <th>@Html.DisplayNameFor(_ => _.Weapons.FirstOrDefault().AdminNumber)</th> <th>@Html.DisplayNameFor(_ => _.Weapons.FirstOrDefault().Serial)</th> <th>@Html.DisplayNameFor(_ => _.Weapons.FirstOrDefault().OpticSerial)</th> <th>@Html.DisplayNameFor(_ => _.Weapons.FirstOrDefault().OpticType)</th> <th>@Html.DisplayNameFor(_ => _.Weapons.FirstOrDefault().Assigned)</th> <th></th> </tr> </thead> <tbody> @foreach (var weapon in Model.Weapons) { <tr> <td>@Html.DisplayFor(_ => weapon.Unit)</td> <td>@Html.DisplayFor(_ => weapon.Type)</td> <td>@Html.DisplayFor(_ => weapon.AdminNumber)</td> <td>@Html.DisplayFor(_ => weapon.Serial)</td> <td>@Html.DisplayFor(_ => weapon.OpticSerial)</td> <td>@Html.DisplayFor(_ => weapon.OpticType)</td> <td>@Html.DisplayFor(_ => weapon.Assigned)</td> <td>@Html.ActionLink("Edit", "Edit", new { weapon.Id })</td> </tr> } </tbody> </table> </div>
@model WeaponListViewModel @{ ViewBag.Title = "Master Authorization List"; } <div class="page-header"> <h1> @ViewBag.Title @Html.ActionLink("Add New", "New", "Weapons", null, new { @class = "btn btn-default" }) </h1> </div> <div id="weapon-list"> <table class="table table-striped display nowrap" width="100%" id="dt"> <thead> <tr> <th>@Html.DisplayNameFor(_ => _.Weapons.FirstOrDefault().Unit)</th> </tr> </thead> <tbody> @foreach (var weapon in Model.Weapons) { <tr> <td>@Html.DisplayFor(_ => weapon.Unit)</td> </tr> } </tbody> </table> </div>
mit
C#
f1397bde7b0c536ccf9ec9c2dcc5a2d13f76f767
Improve code coverage for Microsoft.Win32.Primitives
CherryCxldn/corefx,mellinoe/corefx,n1ghtmare/corefx,stormleoxia/corefx,nchikanov/corefx,rjxby/corefx,mmitche/corefx,Jiayili1/corefx,rajansingh10/corefx,n1ghtmare/corefx,billwert/corefx,SGuyGe/corefx,690486439/corefx,jlin177/corefx,brett25/corefx,elijah6/corefx,chenkennt/corefx,Ermiar/corefx,mafiya69/corefx,dhoehna/corefx,twsouthwick/corefx,ViktorHofer/corefx,dtrebbien/corefx,claudelee/corefx,mokchhya/corefx,MaggieTsang/corefx,scott156/corefx,dotnet-bot/corefx,fgreinacher/corefx,khdang/corefx,kkurni/corefx,parjong/corefx,rubo/corefx,jlin177/corefx,ravimeda/corefx,nbarbettini/corefx,benjamin-bader/corefx,PatrickMcDonald/corefx,shimingsg/corefx,Petermarcu/corefx,DnlHarvey/corefx,Priya91/corefx-1,Chrisboh/corefx,wtgodbe/corefx,shahid-pk/corefx,shana/corefx,axelheer/corefx,s0ne0me/corefx,KrisLee/corefx,zhenlan/corefx,JosephTremoulet/corefx,nelsonsar/corefx,ericstj/corefx,chenxizhang/corefx,axelheer/corefx,adamralph/corefx,gabrielPeart/corefx,shimingsg/corefx,seanshpark/corefx,bpschoch/corefx,bitcrazed/corefx,Frank125/corefx,viniciustaveira/corefx,vidhya-bv/corefx-sorting,rjxby/corefx,Ermiar/corefx,Petermarcu/corefx,Petermarcu/corefx,axelheer/corefx,uhaciogullari/corefx,JosephTremoulet/corefx,CloudLens/corefx,MaggieTsang/corefx,Alcaro/corefx,gregg-miskelly/corefx,the-dwyer/corefx,manu-silicon/corefx,larsbj1988/corefx,Petermarcu/corefx,richlander/corefx,Winsto/corefx,nbarbettini/corefx,EverlessDrop41/corefx,stephenmichaelf/corefx,the-dwyer/corefx,oceanho/corefx,vidhya-bv/corefx-sorting,krk/corefx,chaitrakeshav/corefx,adamralph/corefx,jlin177/corefx,weltkante/corefx,mellinoe/corefx,krytarowski/corefx,Alcaro/corefx,khdang/corefx,YoupHulsebos/corefx,wtgodbe/corefx,stone-li/corefx,billwert/corefx,lggomez/corefx,jeremymeng/corefx,mmitche/corefx,vidhya-bv/corefx-sorting,stephenmichaelf/corefx,jhendrixMSFT/corefx,josguil/corefx,mazong1123/corefx,jcme/corefx,gkhanna79/corefx,cydhaselton/corefx,cartermp/corefx,Alcaro/corefx,twsouthwick/corefx,claudelee/corefx,alphonsekurian/corefx,shimingsg/corefx,shahid-pk/corefx,690486439/corefx,anjumrizwi/corefx,vrassouli/corefx,huanjie/corefx,thiagodin/corefx,shana/corefx,mokchhya/corefx,shiftkey-tester/corefx,mazong1123/corefx,josguil/corefx,cartermp/corefx,alexandrnikitin/corefx,tijoytom/corefx,akivafr123/corefx,EverlessDrop41/corefx,shahid-pk/corefx,vijaykota/corefx,JosephTremoulet/corefx,anjumrizwi/corefx,comdiv/corefx,fffej/corefx,shrutigarg/corefx,chenxizhang/corefx,vijaykota/corefx,jhendrixMSFT/corefx,rjxby/corefx,dhoehna/corefx,vidhya-bv/corefx-sorting,ellismg/corefx,SGuyGe/corefx,ptoonen/corefx,rahku/corefx,fernando-rodriguez/corefx,cnbin/corefx,seanshpark/corefx,ellismg/corefx,popolan1986/corefx,CherryCxldn/corefx,stephenmichaelf/corefx,richlander/corefx,VPashkov/corefx,dotnet-bot/corefx,weltkante/corefx,gabrielPeart/corefx,weltkante/corefx,destinyclown/corefx,dhoehna/corefx,dsplaisted/corefx,fernando-rodriguez/corefx,Winsto/corefx,mellinoe/corefx,gabrielPeart/corefx,nbarbettini/corefx,Jiayili1/corefx,weltkante/corefx,jlin177/corefx,akivafr123/corefx,ViktorHofer/corefx,tijoytom/corefx,mmitche/corefx,wtgodbe/corefx,ericstj/corefx,the-dwyer/corefx,rubo/corefx,pgavlin/corefx,claudelee/corefx,jlin177/corefx,cydhaselton/corefx,rahku/corefx,zmaruo/corefx,seanshpark/corefx,arronei/corefx,dotnet-bot/corefx,spoiledsport/corefx,kyulee1/corefx,Alcaro/corefx,EverlessDrop41/corefx,MaggieTsang/corefx,benpye/corefx,tijoytom/corefx,gregg-miskelly/corefx,fernando-rodriguez/corefx,gregg-miskelly/corefx,janhenke/corefx,alexandrnikitin/corefx,shimingsg/corefx,mellinoe/corefx,billwert/corefx,alphonsekurian/corefx,iamjasonp/corefx,KrisLee/corefx,nchikanov/corefx,nchikanov/corefx,shimingsg/corefx,oceanho/corefx,zhangwenquan/corefx,lydonchandra/corefx,janhenke/corefx,dhoehna/corefx,claudelee/corefx,Priya91/corefx-1,ellismg/corefx,ptoonen/corefx,krk/corefx,destinyclown/corefx,viniciustaveira/corefx,krytarowski/corefx,alphonsekurian/corefx,marksmeltzer/corefx,marksmeltzer/corefx,dtrebbien/corefx,stone-li/corefx,fffej/corefx,viniciustaveira/corefx,gkhanna79/corefx,wtgodbe/corefx,cartermp/corefx,dsplaisted/corefx,nbarbettini/corefx,richlander/corefx,scott156/corefx,zhenlan/corefx,janhenke/corefx,dkorolev/corefx,cydhaselton/corefx,matthubin/corefx,comdiv/corefx,shmao/corefx,SGuyGe/corefx,cydhaselton/corefx,billwert/corefx,scott156/corefx,Ermiar/corefx,rjxby/corefx,Chrisboh/corefx,iamjasonp/corefx,Priya91/corefx-1,nchikanov/corefx,Petermarcu/corefx,bitcrazed/corefx,tstringer/corefx,manu-silicon/corefx,comdiv/corefx,n1ghtmare/corefx,kkurni/corefx,mazong1123/corefx,weltkante/corefx,elijah6/corefx,shahid-pk/corefx,mazong1123/corefx,YoupHulsebos/corefx,scott156/corefx,rahku/corefx,kyulee1/corefx,KrisLee/corefx,marksmeltzer/corefx,kyulee1/corefx,thiagodin/corefx,Chrisboh/corefx,shahid-pk/corefx,n1ghtmare/corefx,stone-li/corefx,shrutigarg/corefx,wtgodbe/corefx,gkhanna79/corefx,stephenmichaelf/corefx,shmao/corefx,zhenlan/corefx,akivafr123/corefx,vs-team/corefx,stone-li/corefx,mafiya69/corefx,ericstj/corefx,bitcrazed/corefx,krytarowski/corefx,dkorolev/corefx,shmao/corefx,brett25/corefx,ericstj/corefx,larsbj1988/corefx,josguil/corefx,jeremymeng/corefx,JosephTremoulet/corefx,pgavlin/corefx,elijah6/corefx,iamjasonp/corefx,nbarbettini/corefx,PatrickMcDonald/corefx,parjong/corefx,YoupHulsebos/corefx,tstringer/corefx,alphonsekurian/corefx,twsouthwick/corefx,chaitrakeshav/corefx,ptoonen/corefx,uhaciogullari/corefx,josguil/corefx,alexandrnikitin/corefx,mellinoe/corefx,Chrisboh/corefx,stone-li/corefx,janhenke/corefx,arronei/corefx,jhendrixMSFT/corefx,Yanjing123/corefx,MaggieTsang/corefx,chenkennt/corefx,ViktorHofer/corefx,stone-li/corefx,axelheer/corefx,rahku/corefx,nchikanov/corefx,dotnet-bot/corefx,heXelium/corefx,DnlHarvey/corefx,elijah6/corefx,parjong/corefx,ravimeda/corefx,krytarowski/corefx,mokchhya/corefx,heXelium/corefx,cartermp/corefx,jcme/corefx,xuweixuwei/corefx,YoupHulsebos/corefx,zhenlan/corefx,twsouthwick/corefx,akivafr123/corefx,gabrielPeart/corefx,690486439/corefx,DnlHarvey/corefx,ViktorHofer/corefx,spoiledsport/corefx,jhendrixMSFT/corefx,jhendrixMSFT/corefx,jhendrixMSFT/corefx,billwert/corefx,akivafr123/corefx,VPashkov/corefx,gkhanna79/corefx,lggomez/corefx,pallavit/corefx,cydhaselton/corefx,lggomez/corefx,Chrisboh/corefx,Yanjing123/corefx,ravimeda/corefx,cnbin/corefx,andyhebear/corefx,misterzik/corefx,yizhang82/corefx,Ermiar/corefx,ViktorHofer/corefx,lggomez/corefx,vrassouli/corefx,popolan1986/corefx,yizhang82/corefx,pallavit/corefx,richlander/corefx,richlander/corefx,JosephTremoulet/corefx,CloudLens/corefx,s0ne0me/corefx,erpframework/corefx,BrennanConroy/corefx,dotnet-bot/corefx,shmao/corefx,dsplaisted/corefx,mazong1123/corefx,JosephTremoulet/corefx,parjong/corefx,mafiya69/corefx,krk/corefx,nbarbettini/corefx,shahid-pk/corefx,janhenke/corefx,krytarowski/corefx,wtgodbe/corefx,jmhardison/corefx,vidhya-bv/corefx-sorting,lggomez/corefx,parjong/corefx,rajansingh10/corefx,wtgodbe/corefx,alexperovich/corefx,khdang/corefx,manu-silicon/corefx,YoupHulsebos/corefx,yizhang82/corefx,chaitrakeshav/corefx,ericstj/corefx,Petermarcu/corefx,tijoytom/corefx,cartermp/corefx,bitcrazed/corefx,rjxby/corefx,rubo/corefx,SGuyGe/corefx,tijoytom/corefx,CloudLens/corefx,alexperovich/corefx,DnlHarvey/corefx,shmao/corefx,cnbin/corefx,chenxizhang/corefx,andyhebear/corefx,richlander/corefx,cartermp/corefx,bpschoch/corefx,ericstj/corefx,shimingsg/corefx,zhenlan/corefx,dkorolev/corefx,elijah6/corefx,tijoytom/corefx,Yanjing123/corefx,spoiledsport/corefx,shiftkey-tester/corefx,nelsonsar/corefx,SGuyGe/corefx,shana/corefx,marksmeltzer/corefx,zhangwenquan/corefx,bitcrazed/corefx,jeremymeng/corefx,kyulee1/corefx,JosephTremoulet/corefx,ellismg/corefx,zmaruo/corefx,tstringer/corefx,PatrickMcDonald/corefx,heXelium/corefx,khdang/corefx,nelsonsar/corefx,benjamin-bader/corefx,shrutigarg/corefx,mmitche/corefx,weltkante/corefx,Frank125/corefx,zmaruo/corefx,jlin177/corefx,ravimeda/corefx,anjumrizwi/corefx,yizhang82/corefx,pallavit/corefx,bpschoch/corefx,the-dwyer/corefx,Frank125/corefx,alphonsekurian/corefx,andyhebear/corefx,fgreinacher/corefx,pgavlin/corefx,benpye/corefx,seanshpark/corefx,zhenlan/corefx,benjamin-bader/corefx,shiftkey-tester/corefx,ViktorHofer/corefx,bpschoch/corefx,marksmeltzer/corefx,zhangwenquan/corefx,pgavlin/corefx,elijah6/corefx,alexperovich/corefx,fffej/corefx,Chrisboh/corefx,stephenmichaelf/corefx,richlander/corefx,Jiayili1/corefx,jcme/corefx,dotnet-bot/corefx,dhoehna/corefx,690486439/corefx,stone-li/corefx,khdang/corefx,kkurni/corefx,uhaciogullari/corefx,mmitche/corefx,SGuyGe/corefx,the-dwyer/corefx,Jiayili1/corefx,alexperovich/corefx,zhenlan/corefx,tstringer/corefx,cydhaselton/corefx,kkurni/corefx,iamjasonp/corefx,alexandrnikitin/corefx,vrassouli/corefx,dhoehna/corefx,jhendrixMSFT/corefx,benjamin-bader/corefx,manu-silicon/corefx,seanshpark/corefx,Frank125/corefx,adamralph/corefx,mafiya69/corefx,kkurni/corefx,mokchhya/corefx,benjamin-bader/corefx,ellismg/corefx,iamjasonp/corefx,larsbj1988/corefx,huanjie/corefx,MaggieTsang/corefx,ericstj/corefx,PatrickMcDonald/corefx,oceanho/corefx,ptoonen/corefx,690486439/corefx,ravimeda/corefx,matthubin/corefx,DnlHarvey/corefx,Ermiar/corefx,matthubin/corefx,n1ghtmare/corefx,yizhang82/corefx,dhoehna/corefx,erpframework/corefx,yizhang82/corefx,alphonsekurian/corefx,gkhanna79/corefx,nchikanov/corefx,Yanjing123/corefx,shimingsg/corefx,mmitche/corefx,krk/corefx,manu-silicon/corefx,rahku/corefx,mazong1123/corefx,DnlHarvey/corefx,VPashkov/corefx,PatrickMcDonald/corefx,axelheer/corefx,twsouthwick/corefx,shrutigarg/corefx,VPashkov/corefx,benjamin-bader/corefx,jeremymeng/corefx,krytarowski/corefx,Ermiar/corefx,yizhang82/corefx,jmhardison/corefx,ptoonen/corefx,dotnet-bot/corefx,larsbj1988/corefx,popolan1986/corefx,nelsonsar/corefx,jmhardison/corefx,jcme/corefx,lydonchandra/corefx,tstringer/corefx,ravimeda/corefx,tstringer/corefx,pallavit/corefx,krytarowski/corefx,benpye/corefx,seanshpark/corefx,heXelium/corefx,andyhebear/corefx,jeremymeng/corefx,stephenmichaelf/corefx,pallavit/corefx,iamjasonp/corefx,stephenmichaelf/corefx,s0ne0me/corefx,mafiya69/corefx,vijaykota/corefx,benpye/corefx,CloudLens/corefx,MaggieTsang/corefx,chenkennt/corefx,rajansingh10/corefx,mokchhya/corefx,marksmeltzer/corefx,shmao/corefx,zmaruo/corefx,alphonsekurian/corefx,the-dwyer/corefx,Priya91/corefx-1,pallavit/corefx,fgreinacher/corefx,seanshpark/corefx,KrisLee/corefx,viniciustaveira/corefx,Ermiar/corefx,huanjie/corefx,anjumrizwi/corefx,manu-silicon/corefx,Priya91/corefx-1,rahku/corefx,krk/corefx,MaggieTsang/corefx,brett25/corefx,nchikanov/corefx,khdang/corefx,ravimeda/corefx,jcme/corefx,rjxby/corefx,fffej/corefx,mafiya69/corefx,elijah6/corefx,rahku/corefx,chaitrakeshav/corefx,xuweixuwei/corefx,arronei/corefx,marksmeltzer/corefx,fgreinacher/corefx,vs-team/corefx,billwert/corefx,YoupHulsebos/corefx,cydhaselton/corefx,misterzik/corefx,jmhardison/corefx,alexandrnikitin/corefx,vs-team/corefx,brett25/corefx,stormleoxia/corefx,vs-team/corefx,dkorolev/corefx,mmitche/corefx,rjxby/corefx,ellismg/corefx,alexperovich/corefx,twsouthwick/corefx,weltkante/corefx,zhangwenquan/corefx,uhaciogullari/corefx,gkhanna79/corefx,mellinoe/corefx,Jiayili1/corefx,rajansingh10/corefx,kkurni/corefx,Petermarcu/corefx,oceanho/corefx,Jiayili1/corefx,misterzik/corefx,janhenke/corefx,rubo/corefx,gregg-miskelly/corefx,jlin177/corefx,erpframework/corefx,lggomez/corefx,krk/corefx,nbarbettini/corefx,billwert/corefx,dtrebbien/corefx,tijoytom/corefx,josguil/corefx,xuweixuwei/corefx,lydonchandra/corefx,ptoonen/corefx,CherryCxldn/corefx,YoupHulsebos/corefx,ptoonen/corefx,manu-silicon/corefx,s0ne0me/corefx,Jiayili1/corefx,lggomez/corefx,ViktorHofer/corefx,krk/corefx,gkhanna79/corefx,CherryCxldn/corefx,alexperovich/corefx,Winsto/corefx,BrennanConroy/corefx,dtrebbien/corefx,mokchhya/corefx,parjong/corefx,cnbin/corefx,jcme/corefx,thiagodin/corefx,shana/corefx,matthubin/corefx,vrassouli/corefx,erpframework/corefx,BrennanConroy/corefx,benpye/corefx,josguil/corefx,parjong/corefx,mazong1123/corefx,twsouthwick/corefx,shmao/corefx,destinyclown/corefx,huanjie/corefx,shiftkey-tester/corefx,lydonchandra/corefx,stormleoxia/corefx,DnlHarvey/corefx,stormleoxia/corefx,the-dwyer/corefx,rubo/corefx,comdiv/corefx,alexperovich/corefx,Priya91/corefx-1,Yanjing123/corefx,axelheer/corefx,benpye/corefx,thiagodin/corefx,iamjasonp/corefx
src/Microsoft.Win32.Primitives/tests/Win32Exception.cs
src/Microsoft.Win32.Primitives/tests/Win32Exception.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.ComponentModel; using Xunit; namespace Microsoft.Win32.Primitives.Tests { public static class Win32ExceptionTestType { [Fact] public static void InstantiateException() { int error = 5; string message = "This is an error message."; Exception innerException = new FormatException(); // Test each of the constructors and validate the properties of the resulting instance Win32Exception ex = new Win32Exception(); Assert.Equal(expected: E_FAIL, actual: ex.HResult); ex = new Win32Exception(error); Assert.Equal(expected: E_FAIL, actual: ex.HResult); Assert.Equal(expected: error, actual: ex.NativeErrorCode); ex = new Win32Exception(message); Assert.Equal(expected: E_FAIL, actual: ex.HResult); Assert.Equal(expected: message, actual: ex.Message); ex = new Win32Exception(error, message); Assert.Equal(expected: E_FAIL, actual: ex.HResult); Assert.Equal(expected: error, actual: ex.NativeErrorCode); Assert.Equal(expected: message, actual: ex.Message); ex = new Win32Exception(message, innerException); Assert.Equal(expected: E_FAIL, actual: ex.HResult); Assert.Equal(expected: message, actual: ex.Message); Assert.Same(expected: innerException, actual: ex.InnerException); } private const int E_FAIL = unchecked((int)0x80004005); [Fact] public static void InstantiateExceptionWithLongErrorString() { // This test checks that Win32Exception supports error strings greater than 256 characters. // Since we will have to rely on a message associated with an error code, // we try to reduce the flakiness by testing the following 3 scenarios: // 1. Validating the positive case, that an errorCode with a message string greater than 256 characters is supported. // 2. Validating that the message string retrieved is actually greater than 256 characters. // 3. Validating that the default error string is what we assume it is, by checking against an error code // that does not exist today. // If the corresponding errors or error strings in Windows change and invalidate these cases, this test will break, // and we can revise it accordingly. Win32Exception ex = new Win32Exception(0x268); Assert.NotEqual("Unknown error (0x268)", ex.Message); Assert.True(ex.Message.Length > 256); ex = new Win32Exception(0x23); Assert.Equal(expected: "Unknown error (0x23)", actual: ex.Message); } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.ComponentModel; using Xunit; namespace Microsoft.Win32.Primitives.Tests { public static class Win32ExceptionTestType { [Fact] public static void InstantiateException() { Win32Exception ex = new Win32Exception(5); Assert.True(ex.HResult == E_FAIL); Assert.True(ex.NativeErrorCode == 5); } public const int E_FAIL = unchecked((int)0x80004005); } }
mit
C#
343b255c512f0e4d6543c8b1845fe1cec0db5489
Fix for json property name on EndsWithPredicate
SuperDrew/MbDotNet,mattherman/MbDotNet,mattherman/MbDotNet
MbDotNet/Models/Predicates/EndsWithPredicate.cs
MbDotNet/Models/Predicates/EndsWithPredicate.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using MbDotNet.Models.Predicates.Fields; namespace MbDotNet.Models.Predicates { public class EndsWithPredicate<T> : PredicateBase where T : PredicateFields, new() { [JsonProperty("endsWith")] public T Fields { get; private set; } public EndsWithPredicate(T fields) { Fields = fields; } public EndsWithPredicate(T fields, bool isCaseSensitive, string exceptExpression, XPathSelector selector) : base(isCaseSensitive, exceptExpression, selector) { Fields = fields; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using MbDotNet.Models.Predicates.Fields; namespace MbDotNet.Models.Predicates { public class EndsWithPredicate<T> : PredicateBase where T : PredicateFields, new() { [JsonProperty("startsWith")] public T Fields { get; private set; } public EndsWithPredicate(T fields) { Fields = fields; } public EndsWithPredicate(T fields, bool isCaseSensitive, string exceptExpression, XPathSelector selector) : base(isCaseSensitive, exceptExpression, selector) { Fields = fields; } } }
mit
C#
f81022eaa283792190fcfb0c594a35bf59255b0a
Update ui, closes #2217
quails4Eva/NSwag,RSuter/NSwag,quails4Eva/NSwag,RSuter/NSwag,quails4Eva/NSwag,RSuter/NSwag,RSuter/NSwag,quails4Eva/NSwag,RSuter/NSwag
src/NSwagStudio/Views/SwaggerGenerators/WebApiToSwaggerGeneratorView.xaml.cs
src/NSwagStudio/Views/SwaggerGenerators/WebApiToSwaggerGeneratorView.xaml.cs
using System.Linq; using System.Threading.Tasks; using System.Windows.Controls; using MyToolkit.Mvvm; using NSwag.Commands; using NSwag.Commands.Generation.WebApi; using NSwagStudio.ViewModels.SwaggerGenerators; namespace NSwagStudio.Views.SwaggerGenerators { public partial class WebApiToSwaggerGeneratorView : ISwaggerGeneratorView { public WebApiToSwaggerGeneratorView(WebApiToSwaggerCommand command, NSwagDocument document) { InitializeComponent(); ViewModelHelper.RegisterViewModel(Model, this); Model.Command = command; Model.Document = document; ControllersList.SelectedItems.Clear(); foreach (var controller in Model.ControllerNames) ControllersList.SelectedItems.Add(controller); } private WebApiToSwaggerGeneratorViewModel Model => (WebApiToSwaggerGeneratorViewModel)Resources["ViewModel"]; public string Title => "Web API via reflection"; public IOutputCommand Command => Model.Command; public Task<string> GenerateSwaggerAsync() { return Model.GenerateSwaggerAsync(); } public override string ToString() { return Title; } private void ControllersListSelectionChanged(object sender, SelectionChangedEventArgs e) { Model.ControllerNames = ((ListBox)sender).SelectedItems.OfType<string>().ToArray(); } } }
using System.Linq; using System.Threading.Tasks; using System.Windows.Controls; using MyToolkit.Mvvm; using NSwag.Commands; using NSwag.Commands.Generation.WebApi; using NSwagStudio.ViewModels.SwaggerGenerators; namespace NSwagStudio.Views.SwaggerGenerators { public partial class WebApiToSwaggerGeneratorView : ISwaggerGeneratorView { public WebApiToSwaggerGeneratorView(WebApiToSwaggerCommand command, NSwagDocument document) { InitializeComponent(); ViewModelHelper.RegisterViewModel(Model, this); Model.Command = command; Model.Document = document; ControllersList.SelectedItems.Clear(); foreach (var controller in Model.ControllerNames) ControllersList.SelectedItems.Add(controller); } private WebApiToSwaggerGeneratorViewModel Model => (WebApiToSwaggerGeneratorViewModel)Resources["ViewModel"]; public string Title => "Web API or ASP.NET Core via Reflection (deprecated)"; public IOutputCommand Command => Model.Command; public Task<string> GenerateSwaggerAsync() { return Model.GenerateSwaggerAsync(); } public override string ToString() { return Title; } private void ControllersListSelectionChanged(object sender, SelectionChangedEventArgs e) { Model.ControllerNames = ((ListBox) sender).SelectedItems.OfType<string>().ToArray(); } } }
mit
C#
73f1d112cacd34c9f3f7ff215ef32bb4d8ce3679
Bump version to 3.2.2.0
adjackura/compute-image-windows,ning-yang/compute-image-windows,GoogleCloudPlatform/compute-image-windows,illfelder/compute-image-windows,adjackura/compute-image-windows,GoogleCloudPlatform/compute-image-windows,illfelder/compute-image-windows,ning-yang/compute-image-windows
agent/Common/Properties/VersionInfo.cs
agent/Common/Properties/VersionInfo.cs
/* * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyCompany("Google Inc")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // Version information for an assembly consists of the following four values: // // Major Version: Large feature and functionality changes, or incompatible // API changes. // Minor Version: Add functionality without API changes. // Build Number: Bug fixes. // Revision: Minor changes or improvements such as style fixes. // // 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("3.2.2.0")] [assembly: AssemblyFileVersion("3.2.2.0")]
/* * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyCompany("Google Inc")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // Version information for an assembly consists of the following four values: // // Major Version: Large feature and functionality changes, or incompatible // API changes. // Minor Version: Add functionality without API changes. // Build Number: Bug fixes. // Revision: Minor changes or improvements such as style fixes. // // 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("3.2.1.0")] [assembly: AssemblyFileVersion("3.2.1.0")]
apache-2.0
C#
28deb9a33518af9525966f17a2faa2d9be054e94
delete garbage in spawn manager so level1 compiles for everyone
GGProductions/LetterStorm,GGProductions/LetterStorm,GGProductions/LetterStorm
Assets/Scripts/SpawnManager.cs
Assets/Scripts/SpawnManager.cs
using UnityEngine; using System.Collections; public class SpawnManager : MonoBehaviour { // Use this for initialization void Start () { } }
using UnityEngine; using System.Collections; public class SpawnManager : MonoBehaviour { // Use this for initialization void Start () { } IEnumerator EnemySpawn() { while() { } } }
mit
C#
3bb01fd59583939aa46e5e8e18189375cc222d24
Fix close button animation not being applied correct on mouse down due to conflicting scales
NeoAdonis/osu,NeoAdonis/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu
osu.Game/Overlays/Chat/ChannelList/ChannelListItemCloseButton.cs
osu.Game/Overlays/Chat/ChannelList/ChannelListItemCloseButton.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osuTK; using osuTK.Graphics; namespace osu.Game.Overlays.Chat.ChannelList { public class ChannelListItemCloseButton : OsuClickableContainer { private SpriteIcon icon = null!; private Color4 normalColour; private Color4 hoveredColour; [BackgroundDependencyLoader] private void load(OsuColour osuColour) { normalColour = osuColour.Red2; hoveredColour = Color4.White; Alpha = 0f; Size = new Vector2(20); Add(icon = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(0.75f), Icon = FontAwesome.Solid.TimesCircle, RelativeSizeAxes = Axes.Both, Colour = normalColour, }); } // Transforms matching OsuAnimatedButton protected override bool OnHover(HoverEvent e) { icon.FadeColour(hoveredColour, 300, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { icon.FadeColour(normalColour, 300, Easing.OutQuint); base.OnHoverLost(e); } protected override bool OnMouseDown(MouseDownEvent e) { icon.ScaleTo(0.75f, 2000, Easing.OutQuint); return base.OnMouseDown(e); } protected override void OnMouseUp(MouseUpEvent e) { icon.ScaleTo(1, 1000, Easing.OutElastic); base.OnMouseUp(e); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osuTK; using osuTK.Graphics; namespace osu.Game.Overlays.Chat.ChannelList { public class ChannelListItemCloseButton : OsuClickableContainer { private SpriteIcon icon = null!; private Color4 normalColour; private Color4 hoveredColour; [BackgroundDependencyLoader] private void load(OsuColour osuColour) { normalColour = osuColour.Red2; hoveredColour = Color4.White; Alpha = 0f; Size = new Vector2(20); Add(icon = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, Scale = new Vector2(0.75f), Icon = FontAwesome.Solid.TimesCircle, RelativeSizeAxes = Axes.Both, Colour = normalColour, }); } // Transforms matching OsuAnimatedButton protected override bool OnHover(HoverEvent e) { icon.FadeColour(hoveredColour, 300, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { icon.FadeColour(normalColour, 300, Easing.OutQuint); base.OnHoverLost(e); } protected override bool OnMouseDown(MouseDownEvent e) { icon.ScaleTo(0.75f, 2000, Easing.OutQuint); return base.OnMouseDown(e); } protected override void OnMouseUp(MouseUpEvent e) { icon.ScaleTo(1, 1000, Easing.OutElastic); base.OnMouseUp(e); } } }
mit
C#
15d36e0d8479953ffdf37591888c22a000449ba9
Update PedometerDatum.cs
predictive-technology-laboratory/sensus,predictive-technology-laboratory/sensus,predictive-technology-laboratory/sensus,predictive-technology-laboratory/sensus,predictive-technology-laboratory/sensus,predictive-technology-laboratory/sensus
Sensus.Shared/Probes/Movement/PedometerDatum.cs
Sensus.Shared/Probes/Movement/PedometerDatum.cs
using System; using System.Collections.Generic; using System.Text; namespace Sensus.Probes.Movement { class PedometerDatum : Datum { double _steps; public PedometerDatum(DateTimeOffset timestamp, double Steps) : base(timestamp) { _steps = Steps; } public override string DisplayDetail { get { return "Steps: " + Math.Round(_steps, 2); } } public override object StringPlaceholderValue { get { return "Steps: " + Math.Round(_steps, 2); } } public double Steps { get => _steps; set => _steps = value; } public override bool Equals(object obj) { return base.Equals(obj); } public override int GetHashCode() { return base.GetHashCode(); } public override string ToString() { return base.ToString() + Environment.NewLine + "Steps: " + _steps; } } }
using System; using System.Collections.Generic; using System.Text; namespace Sensus.Probes.Movement { class PedometerDatum : Datum { double _steps; public PedometerDatum(DateTimeOffset timestamp, double Steps) : base(timestamp) { _steps = Steps; } public override string DisplayDetail { get { return "Steps: " + Math.Round(_steps, 2); } } public override object StringPlaceholderValue => throw new NotImplementedException(); public double Steps { get => _steps; set => _steps = value; } public override bool Equals(object obj) { return base.Equals(obj); } public override int GetHashCode() { return base.GetHashCode(); } public override string ToString() { return base.ToString() + Environment.NewLine + "Steps: " + _steps; } } }
apache-2.0
C#
f1fd40dcca30d348cbdad21ded8f6cef557a4fb8
Fix test not working for various reasons
ppy/osu,UselessToucan/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,peppy/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu
osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs
osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Overlays.AccountCreation; using osu.Game.Overlays.Settings; using osu.Game.Users; namespace osu.Game.Tests.Visual.Online { public class TestSceneAccountCreationOverlay : OsuTestScene { private readonly Container userPanelArea; private readonly AccountCreationOverlay accountCreation; private IBindable<User> localUser; public TestSceneAccountCreationOverlay() { Children = new Drawable[] { accountCreation = new AccountCreationOverlay(), userPanelArea = new Container { Padding = new MarginPadding(10), AutoSizeAxes = Axes.Both, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, }; } [BackgroundDependencyLoader] private void load() { localUser = API.LocalUser.GetBoundCopy(); localUser.BindValueChanged(user => { userPanelArea.Child = new UserGridPanel(user.NewValue) { Width = 200 }; }, true); } [Test] public void TestOverlayVisibility() { AddStep("start hidden", () => accountCreation.Hide()); AddStep("log out", () => API.Logout()); AddStep("show manually", () => accountCreation.Show()); AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible); AddStep("click button", () => accountCreation.ChildrenOfType<SettingsButton>().Single().Click()); AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType<ScreenWarning>().SingleOrDefault()?.IsPresent == true); AddStep("log back in", () => API.Login("dummy", "password")); AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Overlays.AccountCreation; using osu.Game.Overlays.Settings; using osu.Game.Users; namespace osu.Game.Tests.Visual.Online { public class TestSceneAccountCreationOverlay : OsuTestScene { private readonly Container userPanelArea; private readonly AccountCreationOverlay accountCreation; private IBindable<User> localUser; public TestSceneAccountCreationOverlay() { Children = new Drawable[] { accountCreation = new AccountCreationOverlay(), userPanelArea = new Container { Padding = new MarginPadding(10), AutoSizeAxes = Axes.Both, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, }; } [BackgroundDependencyLoader] private void load() { API.Logout(); localUser = API.LocalUser.GetBoundCopy(); localUser.BindValueChanged(user => { userPanelArea.Child = new UserGridPanel(user.NewValue) { Width = 200 }; }, true); } [Test] public void TestOverlayVisibility() { AddStep("start hidden", () => accountCreation.Hide()); AddStep("log out", API.Logout); AddStep("show manually", () => accountCreation.Show()); AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible); AddStep("click button", () => accountCreation.ChildrenOfType<SettingsButton>().Single().Click()); AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType<ScreenWarning>().Single().IsPresent); AddStep("log back in", () => API.Login("dummy", "password")); AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden); } } }
mit
C#
741408b5e2cae5fcacef59a690bcaffe3b62d5ea
Enable menu window to switch foreground state
emoacht/Monitorian
Source/Monitorian.Core/Views/MenuWindow.xaml.cs
Source/Monitorian.Core/Views/MenuWindow.xaml.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using Monitorian.Core.Models; using Monitorian.Core.ViewModels; using ScreenFrame.Movers; namespace Monitorian.Core.Views { public partial class MenuWindow : Window { private readonly FloatWindowMover _mover; public MenuWindowViewModel ViewModel => (MenuWindowViewModel)this.DataContext; public MenuWindow(AppControllerCore controller, Point pivot) { LanguageService.Switch(); InitializeComponent(); this.DataContext = new MenuWindowViewModel(controller); _mover = new FloatWindowMover(this, pivot); } protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); WindowEffect.EnableBackgroundTranslucency(this); } public void AddHeadItem(Control item) => this.HeadItems.Children.Add(item); public void RemoveHeadItem(Control item) => this.HeadItems.Children.Remove(item); public void AddMenuItem(Control item) => this.MenuItems.Children.Insert(0, item); public void RemoveMenuItem(Control item) => this.MenuItems.Children.Remove(item); #region Foreground public void DepartFromForegrond() { this.Topmost = false; } public async void ReturnToForegroud() { if (!this.IsActive) { // Wait for this window to be able to be activated. await Task.Delay(TimeSpan.FromMilliseconds(100)); } // Activate this window. This is necessary to assure this window is foreground. this.Activate(); this.Topmost = true; } #endregion #region Close private bool _isClosing = false; protected override void OnDeactivated(EventArgs e) { base.OnDeactivated(e); if (!this.Topmost) return; if (!_isClosing) this.Close(); } protected override void OnClosing(CancelEventArgs e) { if (!e.Cancel) { _isClosing = true; ViewModel.Dispose(); } base.OnClosing(e); } #endregion } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using Monitorian.Core.Models; using Monitorian.Core.ViewModels; using ScreenFrame.Movers; namespace Monitorian.Core.Views { public partial class MenuWindow : Window { private readonly FloatWindowMover _mover; internal MenuWindowViewModel ViewModel => (MenuWindowViewModel)this.DataContext; public MenuWindow(AppControllerCore controller, Point pivot) { LanguageService.Switch(); InitializeComponent(); this.DataContext = new MenuWindowViewModel(controller); _mover = new FloatWindowMover(this, pivot); } protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); WindowEffect.EnableBackgroundTranslucency(this); } public void AddHeadItem(Control item) => this.HeadItems.Children.Add(item); public void RemoveHeadItem(Control item) => this.HeadItems.Children.Remove(item); public void AddMenuItem(Control item) => this.MenuItems.Children.Insert(0, item); public void RemoveMenuItem(Control item) => this.MenuItems.Children.Remove(item); #region Close private bool _isClosing = false; protected override void OnDeactivated(EventArgs e) { base.OnDeactivated(e); if (!_isClosing) this.Close(); } protected override void OnClosing(CancelEventArgs e) { if (!e.Cancel) { _isClosing = true; ViewModel.Dispose(); } base.OnClosing(e); } #endregion } }
mit
C#
a3ddc273dac46fc2f3e1d4c97f30e910409584df
Bump version to 0.8.0
whampson/bft-spec,whampson/cascara
Src/WHampson.Cascara/Properties/AssemblyInfo.cs
Src/WHampson.Cascara/Properties/AssemblyInfo.cs
#region License /* Copyright (c) 2017 Wes Hampson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #endregion using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("WHampson.Cascara")] [assembly: AssemblyDescription("Binary File Template parser.")] [assembly: AssemblyProduct("WHampson.Cascara")] [assembly: AssemblyCopyright("Copyright (c) 2017 Wes Hampson")] [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2cc76928-f34e-4a9b-8623-1ccc543005c0")] [assembly: AssemblyFileVersion("0.8.0")] [assembly: AssemblyVersion("0.8.0")] [assembly: AssemblyInformationalVersion("0.8.0")]
#region License /* Copyright (c) 2017 Wes Hampson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #endregion using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("WHampson.Cascara")] [assembly: AssemblyDescription("Binary File Template parser.")] [assembly: AssemblyProduct("WHampson.Cascara")] [assembly: AssemblyCopyright("Copyright (c) 2017 Wes Hampson")] [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2cc76928-f34e-4a9b-8623-1ccc543005c0")] [assembly: AssemblyFileVersion("0.7.0")] [assembly: AssemblyVersion("0.7.0")] [assembly: AssemblyInformationalVersion("0.7.0")]
mit
C#
95f607b4d755e73555918656418b84d691083c1a
update vs
Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal
Master/Appleseed/Projects/Appleseed.PortalTemplate/Properties/AssemblyInfo.cs
Master/Appleseed/Projects/Appleseed.PortalTemplate/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("Appleseed.PortalTemplate")] [assembly: AssemblyDescription("Appleseed Portal and Content Management System")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ANANT Corporation")] [assembly: AssemblyProduct("Appleseed.PortalTemplate")] [assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-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("ffe59a6a-e2ab-4ea5-8eec-39b791c8f302")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.131.463")] [assembly: AssemblyFileVersion("1.4.131.463")]
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("Appleseed.PortalTemplate")] [assembly: AssemblyDescription("Appleseed Portal and Content Management System")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ANANT Corporation")] [assembly: AssemblyProduct("Appleseed.PortalTemplate")] [assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-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("ffe59a6a-e2ab-4ea5-8eec-39b791c8f302")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.98.383")] [assembly: AssemblyFileVersion("1.4.98.383")]
apache-2.0
C#
355ecc4499bf1357612c6c6607b65a46e84ea432
Change cursor trail blending mode to match stable
UselessToucan/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,peppy/osu,peppy/osu
osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs
osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.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.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Configuration; using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Skinning.Legacy { public class LegacyCursorTrail : CursorTrail { private const double disjoint_trail_time_separation = 1000 / 60.0; private bool disjointTrail; private double lastTrailTime; private IBindable<float> cursorSize; [BackgroundDependencyLoader] private void load(ISkinSource skin, OsuConfigManager config) { Texture = skin.GetTexture("cursortrail"); disjointTrail = skin.GetTexture("cursormiddle") == null; Blending = !disjointTrail ? BlendingParameters.Additive : BlendingParameters.Inherit; if (Texture != null) { // stable "magic ratio". see OsuPlayfieldAdjustmentContainer for full explanation. Texture.ScaleAdjust *= 1.6f; } cursorSize = config.GetBindable<float>(OsuSetting.GameplayCursorSize).GetBoundCopy(); } protected override double FadeDuration => disjointTrail ? 150 : 500; protected override bool InterpolateMovements => !disjointTrail; protected override float IntervalMultiplier => 1 / Math.Max(cursorSize.Value, 1); protected override bool OnMouseMove(MouseMoveEvent e) { if (!disjointTrail) return base.OnMouseMove(e); if (Time.Current - lastTrailTime >= disjoint_trail_time_separation) { lastTrailTime = Time.Current; return base.OnMouseMove(e); } return false; } } }
// 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.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Configuration; using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Skinning.Legacy { public class LegacyCursorTrail : CursorTrail { private const double disjoint_trail_time_separation = 1000 / 60.0; private bool disjointTrail; private double lastTrailTime; private IBindable<float> cursorSize; public LegacyCursorTrail() { Blending = BlendingParameters.Additive; } [BackgroundDependencyLoader] private void load(ISkinSource skin, OsuConfigManager config) { Texture = skin.GetTexture("cursortrail"); disjointTrail = skin.GetTexture("cursormiddle") == null; if (Texture != null) { // stable "magic ratio". see OsuPlayfieldAdjustmentContainer for full explanation. Texture.ScaleAdjust *= 1.6f; } cursorSize = config.GetBindable<float>(OsuSetting.GameplayCursorSize).GetBoundCopy(); } protected override double FadeDuration => disjointTrail ? 150 : 500; protected override bool InterpolateMovements => !disjointTrail; protected override float IntervalMultiplier => 1 / Math.Max(cursorSize.Value, 1); protected override bool OnMouseMove(MouseMoveEvent e) { if (!disjointTrail) return base.OnMouseMove(e); if (Time.Current - lastTrailTime >= disjoint_trail_time_separation) { lastTrailTime = Time.Current; return base.OnMouseMove(e); } return false; } } }
mit
C#
df733afd631b5a1235adfd0c838e5a7af278740a
Update assembly version.
MatthewKing/DeviceId
src/DeviceId/Properties/AssemblyInfo.cs
src/DeviceId/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("DeviceId")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DeviceId")] [assembly: AssemblyCopyright("Copyright © Matthew King 2015-2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("13803197-daeb-4ba4-8a38-7be03930f463")] [assembly: AssemblyVersion("2.1.0.0")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("DeviceId")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DeviceId")] [assembly: AssemblyCopyright("Copyright © Matthew King 2015-2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("13803197-daeb-4ba4-8a38-7be03930f463")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0")]
mit
C#
8c58f7ac1ad54e9b31e7eeae2cddaf881775ec94
Print started
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNet.Hosting/Program.cs
src/Microsoft.AspNet.Hosting/Program.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.IO; using Microsoft.AspNet.Hosting.Internal; using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Runtime; namespace Microsoft.AspNet.Hosting { public class Program { private const string HostingIniFile = "Microsoft.AspNet.Hosting.ini"; private readonly IServiceProvider _serviceProvider; public Program(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; } public void Main(string[] args) { var config = new Configuration(); if (File.Exists(HostingIniFile)) { config.AddIniFile(HostingIniFile); } config.AddEnvironmentVariables(); config.AddCommandLine(args); var host = new WebHostBuilder(_serviceProvider, config).Build(); using (host.Start()) { Console.WriteLine("Started"); var appShutdownService = host.ApplicationServices.GetRequiredService<IApplicationShutdown>(); Console.CancelKeyPress += delegate { appShutdownService.RequestShutdown(); }; appShutdownService.ShutdownRequested.WaitHandle.WaitOne(); } } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.IO; using Microsoft.AspNet.Hosting.Internal; using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Runtime; namespace Microsoft.AspNet.Hosting { public class Program { private const string HostingIniFile = "Microsoft.AspNet.Hosting.ini"; private readonly IServiceProvider _serviceProvider; public Program(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; } public void Main(string[] args) { var config = new Configuration(); if (File.Exists(HostingIniFile)) { config.AddIniFile(HostingIniFile); } config.AddEnvironmentVariables(); config.AddCommandLine(args); var host = new WebHostBuilder(_serviceProvider, config).Build(); using (host.Start()) { var appShutdownService = host.ApplicationServices.GetRequiredService<IApplicationShutdown>(); Console.CancelKeyPress += delegate { appShutdownService.RequestShutdown(); }; appShutdownService.ShutdownRequested.WaitHandle.WaitOne(); } } } }
apache-2.0
C#
b16cc83d2d4599c85d3a8b6714461a276d4e7da5
increment patch version
jwChung/Experimentalism,jwChung/Experimentalism
build/CommonAssemblyInfo.cs
build/CommonAssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Jin-Wook Chung")] [assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyProduct("")] [assembly: AssemblyVersion("0.8.3")] [assembly: AssemblyInformationalVersion("0.8.3")] /* * Version 0.8.3 * * Initializes a test-fixture only when necessary rather than every time. * * Fixes that fixture factory passed from ConvertToTestCommand should take * MethodInfo of a test delegate rather than it of a test method, which is * adorned with FisrtClassTheoremAttribute. * * BREAKING CHANGE * - ITestCase, TestCase * ITestCommand ConvertToTestCommand(IMethodInfo, ITestFixture) * -> ITestCommand ConvertToTestCommand(IMethodInfo, Func<MethodInfo, ITestFixture>) * * Issue * - https://github.com/jwChung/Experimentalism/issues/28 * * Pull request * - https://github.com/jwChung/Experimentalism/pull/29 */
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Jin-Wook Chung")] [assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyProduct("")] [assembly: AssemblyVersion("0.8.2")] [assembly: AssemblyInformationalVersion("0.8.2")] /* * Version 0.8.2 * * Implemented FistClassCommand to display well-formatted name * of first class test. * * Issue * - https://github.com/jwChung/Experimentalism/issues/26 * * Pull requests * - https://github.com/jwChung/Experimentalism/pull/27 */
mit
C#
b22acb20cd497a1b758722f50e7521ba09c00b2b
Simplify header after syncing with LCA
dotnet/codeformatter,kharaone/codeformatter,shiftkey/Octokit.CodeFormatter,mmitche/codeformatter,rainersigwald/codeformatter,jaredpar/codeformatter,BertTank/codeformatter,BradBarnich/codeformatter,rollie42/codeformatter,david-mitchell/codeformatter,hickford/codeformatter,shiftkey/codeformatter,cbjugstad/codeformatter,Maxwe11/codeformatter,twsouthwick/codeformatter,twsouthwick/codeformatter,mmitche/codeformatter,dotnet/codeformatter,michaelcfanning/codeformatter,srivatsn/codeformatter,weltkante/codeformatter,jeremyabbott/codeformatter
src/Microsoft.DotNet.CodeFormatting/Rules/HasCopyrightHeaderFormattingRule.cs
src/Microsoft.DotNet.CodeFormatting/Rules/HasCopyrightHeaderFormattingRule.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under MIT. See LICENSE in the project root for license information. using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; namespace Microsoft.DotNet.CodeFormatting.Rules { [Export(typeof(IFormattingRule))] internal sealed class HasCopyrightHeaderFormattingRule : IFormattingRule { static readonly string[] CopyrightHeader = { "// Copyright (c) Microsoft. All rights reserved.", "// Licensed under the MIT license. See LICENSE file in the project root for full license information." }; public async Task<Document> ProcessAsync(Document document, CancellationToken cancellationToken) { var syntaxNode = await document.GetSyntaxRootAsync(cancellationToken) as CSharpSyntaxNode; if (syntaxNode == null) return document; if (HasCopyrightHeader(syntaxNode)) return document; var newNode = AddCopyrightHeader(syntaxNode); return document.WithSyntaxRoot(newNode); } private static bool HasCopyrightHeader(SyntaxNode syntaxNode) { var leadingComments = syntaxNode.GetLeadingTrivia().Where(t => t.CSharpKind() == SyntaxKind.SingleLineCommentTrivia).ToArray(); if (leadingComments.Length < CopyrightHeader.Length) return false; return leadingComments.Take(CopyrightHeader.Length) .Select(t => t.ToFullString()) .SequenceEqual(CopyrightHeader); } private static SyntaxNode AddCopyrightHeader(CSharpSyntaxNode syntaxNode) { var newTrivia = GetCopyrightHeader().Concat(syntaxNode.GetLeadingTrivia()); return syntaxNode.WithLeadingTrivia(newTrivia); } private static IEnumerable<SyntaxTrivia> GetCopyrightHeader() { foreach (var headerLine in CopyrightHeader) { yield return SyntaxFactory.Comment(headerLine); yield return SyntaxFactory.CarriageReturnLineFeed; } } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under MIT. See LICENSE in the project root for license information. using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; namespace Microsoft.DotNet.CodeFormatting.Rules { [Export(typeof(IFormattingRule))] internal sealed class HasCopyrightHeaderFormattingRule : IFormattingRule { static readonly string[] CopyrightHeader = { "// Copyright (c) Microsoft. All rights reserved.", "// This code is licensed under the MIT License.", "// 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." }; public async Task<Document> ProcessAsync(Document document, CancellationToken cancellationToken) { var syntaxNode = await document.GetSyntaxRootAsync(cancellationToken) as CSharpSyntaxNode; if (syntaxNode == null) return document; if (HasCopyrightHeader(syntaxNode)) return document; var newNode = AddCopyrightHeader(syntaxNode); return document.WithSyntaxRoot(newNode); } private static bool HasCopyrightHeader(SyntaxNode syntaxNode) { var leadingComments = syntaxNode.GetLeadingTrivia().Where(t => t.CSharpKind() == SyntaxKind.SingleLineCommentTrivia).ToArray(); if (leadingComments.Length < CopyrightHeader.Length) return false; return leadingComments.Take(CopyrightHeader.Length) .Select(t => t.ToFullString()) .SequenceEqual(CopyrightHeader); } private static SyntaxNode AddCopyrightHeader(CSharpSyntaxNode syntaxNode) { var newTrivia = GetCopyrightHeader().Concat(syntaxNode.GetLeadingTrivia()); return syntaxNode.WithLeadingTrivia(newTrivia); } private static IEnumerable<SyntaxTrivia> GetCopyrightHeader() { foreach (var headerLine in CopyrightHeader) { yield return SyntaxFactory.Comment(headerLine); yield return SyntaxFactory.CarriageReturnLineFeed; } } } }
mit
C#
fffffefc7083c65941700e68262ecf825826bcee
Change link title to manage reservations
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/V2/FundingComplete.cshtml
src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/V2/FundingComplete.cshtml
@model SFA.DAS.EmployerAccounts.Web.ViewModels.AccountDashboardViewModel @if (Model.ReservedFundingToShow != null) { <h3 class="das-panel__heading">Apprenticeship funding secured</h3> <dl class="das-definition-list das-definition-list--with-separator"> <dt class="das-definition-list__title">Legal entity:</dt> <dd class="das-definition-list__definition">@Model.ReservedFundingToShowLegalEntityName</dd> <dt class="das-definition-list__title">Training course:</dt> <dd class="das-definition-list__definition">@Model.ReservedFundingToShow.CourseName</dd> <dt class="das-definition-list__title">Start and end date: </dt> <dd class="das-definition-list__definition">@Model.ReservedFundingToShow.StartDate.ToString("MMMM yyyy") to @Model.ReservedFundingToShow.EndDate.ToString("MMMM yyyy")</dd> </dl> } @if (Model.RecentlyAddedReservationId != null && Model.ReservedFundingToShow?.ReservationId != Model.RecentlyAddedReservationId) { <p>We're dealing with your request for funding, please check back later.</p> } <p><a href="@Url.ReservationsAction("reservations/manage")" class="das-panel__link">Manage reservations</a> </p>
@model SFA.DAS.EmployerAccounts.Web.ViewModels.AccountDashboardViewModel @if (Model.ReservedFundingToShow != null) { <h3 class="das-panel__heading">Apprenticeship funding secured</h3> <dl class="das-definition-list das-definition-list--with-separator"> <dt class="das-definition-list__title">Legal entity:</dt> <dd class="das-definition-list__definition">@Model.ReservedFundingToShowLegalEntityName</dd> <dt class="das-definition-list__title">Training course:</dt> <dd class="das-definition-list__definition">@Model.ReservedFundingToShow.CourseName</dd> <dt class="das-definition-list__title">Start and end date: </dt> <dd class="das-definition-list__definition">@Model.ReservedFundingToShow.StartDate.ToString("MMMM yyyy") to @Model.ReservedFundingToShow.EndDate.ToString("MMMM yyyy")</dd> </dl> } @if (Model.RecentlyAddedReservationId != null && Model.ReservedFundingToShow?.ReservationId != Model.RecentlyAddedReservationId) { <p>We're dealing with your request for funding, please check back later.</p> } <p><a href="@Url.ReservationsAction("reservations/manage")" class="das-panel__link">Check and secure funding now</a> </p>
mit
C#
3bd0fe18a53c73f8a69797778899aed83a887799
Initialize bass with no sound
EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework
osu.Framework.Tests/Visual/Platform/TestSceneTrackBass.cs
osu.Framework.Tests/Visual/Platform/TestSceneTrackBass.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 ManagedBass; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osu.Framework.Testing; using osu.Framework.Tests.Visual.Clocks; namespace osu.Framework.Tests.Visual.Platform { public class TestSceneTrackBass : FrameworkTestScene { private TrackBass track; [BackgroundDependencyLoader] private void load(Game game, AudioManager audio) { // Initialize bass with no audio to make sure the test remains consistent even if there is no audio device. Bass.Init(0); var stream = game.Resources.GetStream("Tracks/sample-track.mp3"); track = new TrackBass(stream); audio.Track.AddItem(track); Child = new TestSceneClock.VisualClock(track) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativePositionAxes = Axes.Both, }; } [SetUpSteps] public void SetUpSteps() { AddStep("Seek to 1 second", () => track.Seek(1000)); AddAssert("Initial seek was successful", () => track.CurrentTime == 1000); } /// <summary> /// Bass does not allow seeking to the end of the track. It should fail and the current time should not change. /// </summary> [Test] public void TestTrackSeekingToEndFails() { AddStep("Attempt to seek to the end of the track", () => track.Seek(track.Length)); AddAssert("Track did not seek", () => track.CurrentTime == 1000); } /// <summary> /// Bass restarts the track from the beginning if Start is called when the track has been completed. /// This is blocked locally in <see cref="TrackBass"/>, so this test expects the track to not restart. /// </summary> [Test] public void TestTrackPlaybackBlocksAtTrackEnd() { AddStep("Seek to right before end of track", () => track.Seek(track.Length - 1)); AddStep("Play", () => track.Start()); AddUntilStep("Track stopped playing", () => !track.IsRunning); AddStep("Start track again", () => track.Start()); AddAssert("Track did not restart", () => track.CurrentTime == track.Length); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osu.Framework.Testing; using osu.Framework.Tests.Visual.Clocks; namespace osu.Framework.Tests.Visual.Platform { public class TestSceneTrackBass : FrameworkTestScene { private TrackBass track; [BackgroundDependencyLoader] private void load(Game game, AudioManager audio) { var stream = game.Resources.GetStream("Tracks/sample-track.mp3"); track = new TrackBass(stream); audio.Track.AddItem(track); Child = new TestSceneClock.VisualClock(track) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativePositionAxes = Axes.Both, }; } [SetUpSteps] public void SetUpSteps() { AddStep("Seek to 1 second", () => track.Seek(1000)); AddAssert("Initial seek was successful", () => track.CurrentTime == 1000); } /// <summary> /// Bass does not allow seeking to the end of the track. It should fail and the current time should not change. /// </summary> [Test] public void TestTrackSeekingToEndFails() { AddStep("Attempt to seek to the end of the track", () => track.Seek(track.Length)); AddAssert("Track did not seek", () => track.CurrentTime == 1000); } /// <summary> /// Bass restarts the track from the beginning if Start is called when the track has been completed. /// This is blocked locally in <see cref="TrackBass"/>, so this test expects the track to not restart. /// </summary> [Test] public void TestTrackPlaybackBlocksAtTrackEnd() { AddStep("Seek to right before end of track", () => track.Seek(track.Length - 1)); AddStep("Play", () => track.Start()); AddUntilStep("Track stopped playing", () => !track.IsRunning); AddStep("Start track again", () => track.Start()); AddAssert("Track did not restart", () => track.CurrentTime == track.Length); } } }
mit
C#
fa4d72550bbeec2654338d41650a6cf26dec507f
fix coding style
EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework
osu.Framework.Tests/Visual/Screens/TestSceneScreenExit.cs
osu.Framework.Tests/Visual/Screens/TestSceneScreenExit.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; using osu.Framework.Testing; using osuTK.Graphics; namespace osu.Framework.Tests.Visual.Screens { public class TestSceneScreenExit : FrameworkTestScene { private ScreenStack stack; [SetUpSteps] public void SetUpSteps() { AddStep("Create new screen stack", () => { Child = stack = new ScreenStack { RelativeSizeAxes = Axes.Both }; }); } [Test] public void ScreenExitTest() { TestScreen beforeExit = null; AddStep("Push test screen", () => stack.Push(beforeExit = new TestScreen("BEFORE EXIT"))); AddUntilStep("Wait for current", () => beforeExit.IsLoaded); AddStep("Exit test screen", () => beforeExit.Exit()); // No exceptions should be thrown. AddAssert("Test screen is not current", () => !ReferenceEquals(beforeExit, stack.CurrentScreen)); AddAssert("Stack is not empty", () => stack.CurrentScreen != null); } private class TestScreen : Screen { private readonly string screenText; public TestScreen(string screenText) { this.screenText = screenText; } [BackgroundDependencyLoader] private void load() { AddInternal(new SpriteText { Text = screenText, Colour = Color4.White, Anchor = Anchor.Centre, Origin = Anchor.Centre, }); } public override bool OnExiting(IScreen next) { this.Push(new TestScreen("AFTER EXIT")); return true; } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; using osu.Framework.Testing; using osuTK.Graphics; namespace osu.Framework.Tests.Visual.Screens { public class TestSceneScreenExit : FrameworkTestScene { private ScreenStack stack; [SetUpSteps] public void SetUpSteps() { AddStep("Create new screen stack", () => { Child = stack = new ScreenStack { RelativeSizeAxes = Axes.Both }; }); } [Test] public void ScreenExitTest() { TestScreen beforeExit = null; AddStep("Push test screen", () => stack.Push(beforeExit = new TestScreen("BEFORE EXIT"))); AddUntilStep("Wait for current", () => beforeExit.IsLoaded); AddStep("Exit test screen", () => beforeExit.Exit()); // No exceptions should be thrown. AddAssert("Test screen is not current", () => !object.ReferenceEquals(beforeExit, stack.CurrentScreen)); AddAssert("Stack is not empty", () => stack.CurrentScreen != null); } private class TestScreen : Screen { private string screenText; public TestScreen(string screenText) { this.screenText = screenText; } [BackgroundDependencyLoader] private void load() { AddInternal(new SpriteText { Text = screenText, Colour = Color4.White, Anchor = Anchor.Centre, Origin = Anchor.Centre, }); } public override bool OnExiting(IScreen next) { this.Push(new TestScreen("AFTER EXIT")); return true; } } } }
mit
C#
a1c6d08b87ce73122da0b7c89fb8579f473c1ccf
Add round reset cleanup for PlantSystem It now repopulates the entire seed database.
space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14-content,space-wizards/space-station-14
Content.Server/GameObjects/EntitySystems/PlantSystem.cs
Content.Server/GameObjects/EntitySystems/PlantSystem.cs
using System; using System.Collections.Generic; using Content.Server.Botany; using Content.Server.GameObjects.Components.Botany; using Content.Shared.GameTicking; using JetBrains.Annotations; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; using Robust.Shared.Prototypes; namespace Content.Server.GameObjects.EntitySystems { [UsedImplicitly] public class PlantSystem : EntitySystem, IResettingEntitySystem { [Dependency] private readonly IComponentManager _componentManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; private int _nextUid = 0; private readonly Dictionary<int, Seed> _seeds = new Dictionary<int,Seed>(); private float _timer = 0f; public IReadOnlyDictionary<int, Seed> Seeds => _seeds; public override void Initialize() { base.Initialize(); PopulateDatabase(); } private void PopulateDatabase() { _nextUid = 0; _seeds.Clear(); foreach (var seed in _prototypeManager.EnumeratePrototypes<Seed>()) { AddSeedToDatabase(seed); } } public bool AddSeedToDatabase(Seed seed) { // If it's not -1, it's already in the database. Probably. if (seed.Uid != -1) return false; seed.Uid = GetNextSeedUid(); _seeds[seed.Uid] = seed; return true; } private int GetNextSeedUid() { return _nextUid++; } public override void Update(float frameTime) { base.Update(frameTime); _timer += frameTime; if (_timer < 3f) return; _timer = 0f; foreach (var plantHolder in _componentManager.EntityQuery<PlantHolderComponent>()) { plantHolder.Update(); } } public void Reset() { PopulateDatabase(); } } }
using System; using System.Collections.Generic; using Content.Server.Botany; using Content.Server.GameObjects.Components.Botany; using JetBrains.Annotations; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; using Robust.Shared.Prototypes; namespace Content.Server.GameObjects.EntitySystems { [UsedImplicitly] public class PlantSystem : EntitySystem { [Dependency] private readonly IComponentManager _componentManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; private int _nextUid = 0; private readonly Dictionary<int, Seed> _seeds = new Dictionary<int,Seed>(); private float _timer = 0f; public IReadOnlyDictionary<int, Seed> Seeds => _seeds; public override void Initialize() { base.Initialize(); foreach (var seed in _prototypeManager.EnumeratePrototypes<Seed>()) { AddSeedToDatabase(seed); } } public bool AddSeedToDatabase(Seed seed) { // If it's not -1, it's already in the database. Probably. if (seed.Uid != -1) return false; seed.Uid = GetNextSeedUid(); _seeds[seed.Uid] = seed; return true; } private int GetNextSeedUid() { return _nextUid++; } public override void Update(float frameTime) { base.Update(frameTime); _timer += frameTime; if (_timer < 3f) return; _timer = 0f; foreach (var plantHolder in _componentManager.EntityQuery<PlantHolderComponent>()) { plantHolder.Update(); } } } }
mit
C#
741f74b60a2a756fcb29dec2e3f9c397808bf802
Test for IList<T> and IEnumerable<T>
grantcolley/dipmapper
DevelopmentInProgress.DipMapper.Test/TestDapperClass.cs
DevelopmentInProgress.DipMapper.Test/TestDapperClass.cs
using System; using System.Collections.Generic; namespace DevelopmentInProgress.DipMapper.Test { public class TestDapperClass { public int Id { get; set; } public string Name { get; set; } public DateTime Date { get; set; } public IEnumerable<TestDapperClass> TestDataClasses { get; set; } public IList<TestDapperClass> TestDataClasse { get; set; } } }
using System; using System.Collections.Generic; namespace DevelopmentInProgress.DipMapper.Test { public class TestDapperClass { public int Id { get; set; } public string Name { get; set; } public DateTime Date { get; set; } public IEnumerable<TestDapperClass> TestDataClasses { get; set; } } }
apache-2.0
C#
eb70ac3b91c07cd376e2182821c0eca25d35b0d2
Fix Thing Category Delete
cmoussalli/DynThings,cmoussalli/DynThings,cmoussalli/DynThings,cmoussalli/DynThings
DynThings.WebPortal/Views/ThingCategorys/_Delete.cshtml
DynThings.WebPortal/Views/ThingCategorys/_Delete.cshtml
@model DynThings.Data.Models.ThingCategory @using (Html.BeginForm("DeletePV", "ThingCategorys", FormMethod.Post, new { id = "ThingCategoryDeleteForm" })) { <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="myModalLabel">Delete Confirmation</h4> </div> <div class="modal-body"> @if (Model.Things.Count > 0) { <div class="alert alert-danger alert-dismissable"> <h3>Warning</h3><h5> you have @Model.Things.Count Thing(s) associated with the selected ThingCategory.</h5> <h5>You must delete all associated Thing(s) to able to delete this category.</h5> </div><br /> } @Html.AntiForgeryToken() @Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.ID) @Html.HiddenFor(model => model.Title) <span>Are you sure you want to delete the following object?</span><br /><br /> <span>Type: ThingCategory</span><br /> <span>Title: @Model.Title</span><br /> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> @if (Model.Things.Count == 0) { <button type="submit" class="btn btn-danger">Delete</button> } </div> } <script> //Attach : Delete Form Submit $(document).ready(function () { $("#ThingCategoryDeleteForm").on("submit", function (event) { event.preventDefault(); var url = $(this).attr("action"); var formData = $(this).serialize(); $.ajax({ url: url, type: "POST", data: formData, dataType: "json", success: function (resp) { window.location = getRootURL() + "ThingCategorys"; } }) LoadPart_ThingCategoryListDiv(); $('#mdl').modal('hide'); }); }); </script>
@model DynThings.Data.Models.ThingCategory @using (Html.BeginForm("DeletePV", "ThingCategorys", FormMethod.Post, new { id = "ThingCategoryDeleteForm" })) { <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="myModalLabel">Delete Confirmation</h4> </div> <div class="modal-body"> @if (Model.Things.Count > 0) { <div class="alert alert-warning alert-dismissable"> <h3>Warning</h3><h5> you have @Model.Things.Count Endpoint(s) associated with the selected ThingCategory.</h5> <h5>All associated data will be removed.</h5> </div><br /> } @Html.AntiForgeryToken() @Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.ID) @Html.HiddenFor(model => model.Title) <span>Are you sure you want to delete the following object?</span><br /><br /> <span>Type: ThingCategory</span><br /> <span>Title: @Model.Title</span><br /> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-danger">Delete</button> </div> } <script> //Attach : Delete Form Submit $(document).ready(function () { $("#ThingCategoryDeleteForm").on("submit", function (event) { event.preventDefault(); var url = $(this).attr("action"); var formData = $(this).serialize(); $.ajax({ url: url, type: "POST", data: formData, dataType: "json", success: function (resp) { window.location = getRootURL() + "ThingCategorys"; } }) LoadPart_ThingCategoryListDiv(); $('#mdl').modal('hide'); }); }); </script>
mit
C#
6b6249b38927040d7a0ffa8888d03e705d436339
simplify validation
corker/estuite
Estuite.Specs.UnitTests/describe_DefaultEventHandler.cs
Estuite.Specs.UnitTests/describe_DefaultEventHandler.cs
using System; using System.Diagnostics; using Estuite.Domain; using Shouldly; namespace Estuite.Specs.UnitTests { public class describe_DefaultEventHandler : nspec { private void before_each() { _aggregate = new AggregateUnderTest(); _target = new DefaultEventHandler(); } private void when_handle() { act = () => _target.Handle(_aggregate, new EventWithHandler()); it["should execute handler"] = () => _aggregate.Counter.ShouldBe(1); } private void when_handle_multiple_times() { before = () => { var @event = new EventWithHandler(); var aggregate = new AggregateUnderTest(); var target = new DefaultEventHandlerWithNoCache(); var stopwatch = Stopwatch.StartNew(); for (var i = 0; i < Times; i++) target.Handle(aggregate, @event); _elapsedNoCache = stopwatch.Elapsed; }; act = () => { var @event = new EventWithHandler(); var stopwatch = Stopwatch.StartNew(); for (var i = 0; i < Times; i++) _target.Handle(_aggregate, @event); _elapsed = stopwatch.Elapsed; }; it["executes handler multiple times"] = () => _aggregate.Counter.ShouldBe(Times); it["is faster than with no cache"] = () => _elapsed.ShouldBeLessThan(_elapsedNoCache); } private AggregateUnderTest _aggregate; private DefaultEventHandler _target; private TimeSpan _elapsed; private TimeSpan _elapsedNoCache; private const int Times = 100000; private class AggregateUnderTest { public int Counter; private void Handle(EventWithHandler @event) { Counter++; } } private class EventWithHandler { } } }
using System; using System.Diagnostics; using Estuite.Domain; using Shouldly; namespace Estuite.Specs.UnitTests { public class describe_DefaultEventHandler : nspec { private void before_each() { _aggregate = new AggregateUnderTest(); _target = new DefaultEventHandler(); } private void when_handle() { act = () => _target.Handle(_aggregate, new EventWithHandler()); it["should execute handler"] = () => _aggregate.Counter.ShouldBe(1); } private void when_handle_multiple_times() { before = () => { var @event = new EventWithHandler(); var aggregate = new AggregateUnderTest(); var target = new DefaultEventHandlerWithNoCache(); var stopwatch = Stopwatch.StartNew(); for (var i = 0; i < Times; i++) target.Handle(aggregate, @event); _elapsedNoCache = stopwatch.Elapsed; }; act = () => { var @event = new EventWithHandler(); var stopwatch = Stopwatch.StartNew(); for (var i = 0; i < Times; i++) _target.Handle(_aggregate, @event); _elapsed = stopwatch.Elapsed; _delta = (_elapsedNoCache - _elapsed).Milliseconds; }; it["executes handler multiple times"] = () => _aggregate.Counter.ShouldBe(Times); it["is faster than with no cache"] = () => _delta.ShouldBeGreaterThan(Milliseconds); } private AggregateUnderTest _aggregate; private DefaultEventHandler _target; private TimeSpan _elapsed; private TimeSpan _elapsedNoCache; private int _delta; private const int Times = 100000; private const int Milliseconds = 100; private class AggregateUnderTest { public int Counter; private void Handle(EventWithHandler @event) { Counter++; } } private class EventWithHandler { } } }
mit
C#
77c274df2ab03f0aeb147e83230389a06f856e5c
Fix vaccum lock
mbdavid/LiteDB
LiteDB/Engine/Engine/Vaccum.cs
LiteDB/Engine/Engine/Vaccum.cs
using System; using System.Collections.Generic; using System.Linq; namespace LiteDB.Engine { public partial class LiteEngine { /// <summary> /// Read database searching for empty pages but non-linked in FreeListPage. Must run Checkpoint before and do lock reserved /// </summary> public int Vaccum() { // do not accept any command after shutdown database if (_shutdown) throw LiteException.DatabaseShutdown(); _locker.EnterReserved(false); try { // do checkpoint with no lock (already locked) _wal.Checkpoint(true, _header, false); _log.Info("vaccum datafile"); return this.AutoTransaction(transaction => { var snapshot = transaction.CreateSnapshot(LockMode.Write, "_vaccum", false); var count = 0; foreach (var pageID in _dataFile.ReadZeroPages()) { snapshot.DeletePage(pageID); count++; } return count; }); } finally { _locker.ExitReserved(false); } } } }
using System; using System.Collections.Generic; using System.Linq; namespace LiteDB.Engine { public partial class LiteEngine { /// <summary> /// Read database searching for empty pages but non-linked in FreeListPage. Must run Checkpoint before and do lock reserved /// </summary> public int Vaccum() { // do not accept any command after shutdown database if (_shutdown) throw LiteException.DatabaseShutdown(); _locker.EnterReserved(false); try { // do checkpoint with no lock (already locked) _wal.Checkpoint(true, _header, false); _log.Info("vaccum datafile"); return this.AutoTransaction(transaction => { var snapshot = transaction.CreateSnapshot(LockMode.Write, "_vaccum", false); var count = 0; foreach (var pageID in _dataFile.ReadZeroPages()) { snapshot.DeletePage(pageID); count++; } return count; }); } finally { _locker.ExitReserved(true); } } } }
mit
C#
eec99dffac13f38894c14456dcdd8b2dad5fe1d3
modify to log every 1000 messages and remove immediate dispatch setting
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerFinance.Jobs/ScheduledJobs/ExpireFundsJob.cs
src/SFA.DAS.EmployerFinance.Jobs/ScheduledJobs/ExpireFundsJob.cs
using System.Threading.Tasks; using Microsoft.Azure.WebJobs; using Microsoft.Extensions.Logging; using NServiceBus; using SFA.DAS.EmployerFinance.Data; using SFA.DAS.EmployerFinance.Interfaces; using SFA.DAS.EmployerFinance.Messages.Commands; namespace SFA.DAS.EmployerFinance.Jobs.ScheduledJobs { public class ExpireFundsJob { private readonly IMessageSession _messageSession; private readonly ICurrentDateTime _currentDateTime; private readonly IEmployerAccountRepository _accountRepository; public ExpireFundsJob( IMessageSession messageSession, ICurrentDateTime currentDateTime, IEmployerAccountRepository accountRepository) { _messageSession = messageSession; _currentDateTime = currentDateTime; _accountRepository = accountRepository; } public async Task Run( [TimerTrigger("0 0 0 28 * *")] TimerInfo timer, ILogger logger) { logger.LogInformation($"Starting {nameof(ExpireFundsJob)}"); var now = _currentDateTime.Now; var accounts = await _accountRepository.GetAllAccounts(); logger.LogInformation($"Queueing {nameof(ExpireAccountFundsCommand)} messages for {accounts.Count} accounts."); for (int i = 0; i < accounts.Count; i++) { var account = accounts[i]; var sendOptions = new SendOptions(); sendOptions.SetMessageId($"{nameof(ExpireAccountFundsCommand)}-{now.Year}-{now.Month}-{account.Id}"); await _messageSession.Send(new ExpireAccountFundsCommand { AccountId = account.Id }, sendOptions); if (i % 1000 == 0) { logger.LogInformation($"Queued {i} of {accounts.Count} messages."); await Task.Delay(5000); } } logger.LogInformation($"{nameof(ExpireFundsJob)} completed."); } } }
using System.Threading.Tasks; using Microsoft.Azure.WebJobs; using Microsoft.Extensions.Logging; using NServiceBus; using SFA.DAS.EmployerFinance.Data; using SFA.DAS.EmployerFinance.Interfaces; using SFA.DAS.EmployerFinance.Messages.Commands; namespace SFA.DAS.EmployerFinance.Jobs.ScheduledJobs { public class ExpireFundsJob { private readonly IMessageSession _messageSession; private readonly ICurrentDateTime _currentDateTime; private readonly IEmployerAccountRepository _accountRepository; public ExpireFundsJob( IMessageSession messageSession, ICurrentDateTime currentDateTime, IEmployerAccountRepository accountRepository) { _messageSession = messageSession; _currentDateTime = currentDateTime; _accountRepository = accountRepository; } public async Task Run( [TimerTrigger("0 0 0 28 * *")] TimerInfo timer, ILogger logger) { logger.LogInformation($"Starting {nameof(ExpireFundsJob)}"); var now = _currentDateTime.Now; var accounts = await _accountRepository.GetAllAccounts(); logger.LogInformation($"Queueing {nameof(ExpireAccountFundsCommand)} messages for {accounts.Count} accounts."); for (int i = 0; i < accounts.Count; i++) { var account = accounts[i]; var sendOptions = new SendOptions(); sendOptions.RequireImmediateDispatch(); sendOptions.SetMessageId($"{nameof(ExpireAccountFundsCommand)}-{now.Year}-{now.Month}-{account.Id}"); await _messageSession.Send(new ExpireAccountFundsCommand { AccountId = account.Id }, sendOptions); if (i % 100 == 0) { await Task.Delay(500); } } logger.LogInformation($"{nameof(ExpireFundsJob)} completed."); } } }
mit
C#
b98f7da5cc1f1c2b0a2bf5d3d818aaf19c233855
Remove unused imports
messagebird/csharp-rest-api
MessageBird/Net/IRestClient.cs
MessageBird/Net/IRestClient.cs
using MessageBird.Net.ProxyConfigurationInjector; using MessageBird.Resources; namespace MessageBird.Net { // immutable, so no read/write properties public interface IRestClient { string AccessKey { get; } string Endpoint { get; } IProxyConfigurationInjector ProxyConfigurationInjector { get; } string ApiVersion { get; } string ClientVersion { get; } string UserAgent { get; } T Create<T> (T resource) where T : Resource; T Retrieve<T>(T resource) where T : Resource; void Update(Resource resource); void Delete(Resource resource); string PerformHttpRequest(string method, string uri, string body, HttpStatusCode expectedStatusCode); string PerformHttpRequest(string method, string uri, HttpStatusCode expectedStatusCode); } }
using MessageBird.Net.ProxyConfigurationInjector; using MessageBird.Resources; using System; using System.Net; namespace MessageBird.Net { // immutable, so no read/write properties public interface IRestClient { string AccessKey { get; } string Endpoint { get; } IProxyConfigurationInjector ProxyConfigurationInjector { get; } string ApiVersion { get; } string ClientVersion { get; } string UserAgent { get; } T Create<T> (T resource) where T : Resource; T Retrieve<T>(T resource) where T : Resource; void Update(Resource resource); void Delete(Resource resource); string PerformHttpRequest(string method, string uri, string body, HttpStatusCode expectedStatusCode); string PerformHttpRequest(string method, string uri, HttpStatusCode expectedStatusCode); } }
isc
C#
48a155c664c045af2cdc1b8e200c5a633700ff62
Add tests to ensure client ip is copied from request telemetry if present
Microsoft/ApplicationInsights-SDK-Labs
WCF/Shared.Tests/ClientIpTelemetryInitializerTests.cs
WCF/Shared.Tests/ClientIpTelemetryInitializerTests.cs
using Microsoft.ApplicationInsights.DataContracts; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.ServiceModel.Channels; using System.Text; namespace Microsoft.ApplicationInsights.Wcf.Tests { [TestClass] public class ClientIpTelemetryInitializerTests { [TestMethod] public void SetsClientIpFromWcfContextOnRequest() { const String clientIp = "10.12.32.12"; var context = new MockOperationContext(); context.IncomingProperties.Add( RemoteEndpointMessageProperty.Name, new RemoteEndpointMessageProperty(clientIp, 7656)); var initializer = new ClientIpTelemetryInitializer(); var telemetry = context.Request; initializer.Initialize(telemetry, context); Assert.AreEqual(clientIp, telemetry.Context.Location.Ip); } [TestMethod] public void SetsClientIpFromWcfContextOnOtherEvent() { const String originalIp = "10.12.32.12"; const String newIp = "172.34.12.45"; var context = new MockOperationContext(); context.IncomingProperties.Add( RemoteEndpointMessageProperty.Name, new RemoteEndpointMessageProperty(originalIp, 7656)); var initializer = new ClientIpTelemetryInitializer(); // initialize request with the original IP initializer.Initialize(context.Request, context); // replace IP so that we can tell // it is being picked up from the request // rather than the context context.IncomingProperties.Clear(); context.IncomingProperties.Add( RemoteEndpointMessageProperty.Name, new RemoteEndpointMessageProperty(newIp, 7656)); var telemetry = new EventTelemetry("myevent"); initializer.Initialize(telemetry, context); Assert.AreEqual(originalIp, telemetry.Context.Location.Ip); } [TestMethod] public void ClientIpIsCopiedFromRequestIfPresent() { const String clientIp = "10.12.32.12"; var context = new MockOperationContext(); context.Request.Context.Location.Ip = clientIp; var initializer = new ClientIpTelemetryInitializer(); var telemetry = new EventTelemetry(); initializer.Initialize(telemetry, context); Assert.AreEqual(clientIp, telemetry.Context.Location.Ip); } } }
using Microsoft.ApplicationInsights.DataContracts; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.ServiceModel.Channels; using System.Text; namespace Microsoft.ApplicationInsights.Wcf.Tests { [TestClass] public class ClientIpTelemetryInitializerTests { [TestMethod] public void SetsClientIpFromWcfContextOnRequest() { const String clientIp = "10.12.32.12"; var context = new MockOperationContext(); context.IncomingProperties.Add( RemoteEndpointMessageProperty.Name, new RemoteEndpointMessageProperty(clientIp, 7656)); var initializer = new ClientIpTelemetryInitializer(); var telemetry = context.Request; initializer.Initialize(telemetry, context); Assert.AreEqual(clientIp, telemetry.Context.Location.Ip); } [TestMethod] public void SetsClientIpFromWcfContextOnOtherEvent() { const String originalIp = "10.12.32.12"; const String newIp = "172.34.12.45"; var context = new MockOperationContext(); context.IncomingProperties.Add( RemoteEndpointMessageProperty.Name, new RemoteEndpointMessageProperty(originalIp, 7656)); var initializer = new ClientIpTelemetryInitializer(); // initialize request with the original IP initializer.Initialize(context.Request, context); // replace IP so that we can tell // it is being picked up from the request // rather than the context context.IncomingProperties.Clear(); context.IncomingProperties.Add( RemoteEndpointMessageProperty.Name, new RemoteEndpointMessageProperty(newIp, 7656)); var telemetry = new EventTelemetry("myevent"); initializer.Initialize(telemetry, context); Assert.AreEqual(originalIp, telemetry.Context.Location.Ip); } } }
mit
C#
d0756e93450c94c94176399b75e331d10a076037
Correct inconsistent use of tabs and spaces.
WhitePhantom88/PopulousStringEditor
PopulousStringEditor/Views/StringComparisonView.xaml.cs
PopulousStringEditor/Views/StringComparisonView.xaml.cs
using System.Windows.Controls; namespace PopulousStringEditor.Views { /// <summary> /// Interaction logic for StringComparisonView.xaml /// </summary> public partial class StringComparisonView : UserControl { /// <summary>Gets or sets the visibility of the referenced strings.</summary> public System.Windows.Visibility ReferenceStringsVisiblity { get { return ReferenceStringsColumn.Visibility; } set { ReferenceStringsColumn.Visibility = value; } } /// <summary> /// Default constructor. /// </summary> public StringComparisonView() { InitializeComponent(); } } }
using System.Windows.Controls; namespace PopulousStringEditor.Views { /// <summary> /// Interaction logic for StringComparisonView.xaml /// </summary> public partial class StringComparisonView : UserControl { /// <summary>Gets or sets the visibility of the referenced strings.</summary> public System.Windows.Visibility ReferenceStringsVisiblity { get { return ReferenceStringsColumn.Visibility; } set { ReferenceStringsColumn.Visibility = value; } } /// <summary> /// Default constructor. /// </summary> public StringComparisonView() { InitializeComponent(); } } }
mit
C#
fc634d2ed235b884347c3755564235cf8f2d44a4
Rename test
damiensawyer/cassette,honestegg/cassette,honestegg/cassette,andrewdavey/cassette,damiensawyer/cassette,andrewdavey/cassette,andrewdavey/cassette,BluewireTechnologies/cassette,BluewireTechnologies/cassette,honestegg/cassette,damiensawyer/cassette
src/Cassette.UnitTests/BundleProcessing/CompileAsset.cs
src/Cassette.UnitTests/BundleProcessing/CompileAsset.cs
using System.IO; using Cassette.IO; using Cassette.Utilities; using Moq; using Should; using Xunit; using System.Linq; namespace Cassette.BundleProcessing { public class CompileAsset_Tests { [Fact] public void TransformCallsCompiler() { var asset = new Mock<IAsset>(); asset.SetupGet(a => a.Path).Returns("test.less"); var sourceInput = "source-input"; var compilerOutput = "compiler-output"; var compiler = StubCompiler(compilerOutput); var transformer = new CompileAsset(compiler, Mock.Of<IDirectory>()); var getResultStream = transformer.Transform( () => sourceInput.AsStream(), asset.Object ); using (var reader = new StreamReader(getResultStream())) { reader.ReadToEnd().ShouldEqual(compilerOutput); } } ICompiler StubCompiler(string compilerOutput) { var compiler = new Mock<ICompiler>(); compiler.Setup(c => c.Compile(It.IsAny<string>(), It.IsAny<CompileContext>())) .Returns(new CompileResult(compilerOutput, Enumerable.Empty<string>())); return compiler.Object; } } }
using System.IO; using Cassette.IO; using Cassette.Utilities; using Moq; using Should; using Xunit; using System.Linq; namespace Cassette.BundleProcessing { public class CompileAsset_Tests { [Fact] public void TransformCallsLessCompiler() { var asset = new Mock<IAsset>(); asset.SetupGet(a => a.Path).Returns("test.less"); var sourceInput = "source-input"; var compilerOutput = "compiler-output"; var compiler = StubCompiler(compilerOutput); var transformer = new CompileAsset(compiler, Mock.Of<IDirectory>()); var getResultStream = transformer.Transform( () => sourceInput.AsStream(), asset.Object ); using (var reader = new StreamReader(getResultStream())) { reader.ReadToEnd().ShouldEqual(compilerOutput); } } ICompiler StubCompiler(string compilerOutput) { var compiler = new Mock<ICompiler>(); compiler.Setup(c => c.Compile(It.IsAny<string>(), It.IsAny<CompileContext>())) .Returns(new CompileResult(compilerOutput, Enumerable.Empty<string>())); return compiler.Object; } } }
mit
C#
dad1b6c8a1389602981236b917469d2a39b90adb
Update SpaceFolder.cs
KerbaeAdAstra/KerbalFuture
KerbalFuture/SpaceFolder.cs
KerbalFuture/SpaceFolder.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using KSP; namespace KerbalFuture { class SpaceFolderData : MonoBehavior { public static string path() { return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); } public bool partContainsModule(string miPart, string moduleName) { List<partDatabase> = GameDatabase.GetConfigNodes("PART"); partDatabase[] = GameDatabase.GetConfigNodes(" if( { return true; } else { return false; } } public ConfigNode CFGFinder(PartModule pM) { ConfigNode[] nodeGroup = GameDatabase.Instance.GetConfigNodes("PART"); if(nodeGroup.Length == 0) { return new ConfigNode(); } for (int i; i < nodeGroup.Length; i++) { if(nodeGroup[i].GetValues(pM.Part.partName).Length > 0) { return nodeGroup[i]; } } return new ConfigNode(); } } class SpaceFolderVslChecks : MonoBehavior { public bool SpaceFolderWarpCheck() { List<Part> vslParts = this.Vessel.Parts; for(vslParts[i]) { if(partContainsModule(vslParts[i], "SpaceFolderDrive")) { } } } } class FlightDrive : VesselModule { Vector3 vslObtVel; public void FixedUpdate() { if((HighLogic.LoadedSceneIsFlight) && (SpaceFolderWarpCheck())) { vslObtVel = Vessel.GetObtVelocity(); if (SpacefolderWarpCheck()) { } } } } class SpaceFolderEngine : PartModule { double holeDiameter; } } sfj
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using KSP; namespace KerbalFuture { class SpaceFolderData : MonoBehavior { public static string path() { return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); } public bool partContainsModule(string miPart, string moduleName) { List<partDatabase> = GameDatabase.GetConfigNodes("PART"); partDatabase[] = GameDatabase.GetConfigNodes(" if( { return true; } else { return false; } } public ConfigNode CFGFinder(PartModule pM) { ConfigNode[] nodeGroup = GameDatabase.Instance.GetConfigNodes("PART"); if(nodeGroup.Length == 0) { return new ConfigNode(); } for (int i; i < nodeGroup.Length; i++) { if(nodeGroup[i].GetValues(pM.Part.partName).Length > 0) { return nodeGroup[i]; } } return new ConfigNode(); } } class SpaceFolderVslChecks : MonoBehavior { public bool SpaceFolderWarpCheck() { List<Part> vslParts = this.Vessel.Parts; for(vslParts[i]) { if(partContainsModule(vslParts[i], "SpaceFolderDrive")) { } } } } class FlightDrive : VesselModule { Vector3 vslObtVel; public void FixedUpdate() { if((HighLogic.LoadedSceneIsFlight) && (SpaceFolderWarpCheck())) { vslObtVel = Vessel.GetObtVelocity(); if (SpacefolderWarpCheck(true)) } } } class SpaceFolderEngine : PartModule { double holeDiameter; } }
mit
C#
d55c413901f11ccd153c7fc70bf87a537aedd18d
split compound test case
Unity-Technologies/CodeEditor,Unity-Technologies/CodeEditor
src/CodeEditor.Text.Data.Tests/ContentTypeRegistryTest.cs
src/CodeEditor.Text.Data.Tests/ContentTypeRegistryTest.cs
using System.Reflection; using CodeEditor.Composition; using CodeEditor.Composition.Hosting; using NUnit.Framework; namespace CodeEditor.Text.Data.Tests { [TestFixture] public class ContentTypeRegistryTest { private IContentTypeRegistry _registry; [SetUp] public void SetUp() { var container = new CompositionContainer(AssemblyOf<IContentTypeSpecificService>(), AssemblyOf<IContentTypeRegistry>()); _registry = container.GetExportedValue<IContentTypeRegistry>(); } [Test] public void ForName() { var contentType = _registry.ForName(FooContentType.Name); Assert.AreEqual(FooContentType.Name, contentType.Name); Assert.IsInstanceOf<FooContentType>(contentType.Definition); } [Test] public void ContentTypeSpecificService() { var contentType = _registry.ForName(FooContentType.Name); Assert.IsInstanceOf<FooSpecificService>(contentType.GetService<IContentTypeSpecificService>()); } [Test] public void TextContentTypeIsAvailable() { Assert.AreEqual("text", _registry.ForName("text").Name); Assert.AreEqual("text", _registry.ForFileExtension(".txt").Name); } [Test] public void ForNameReturnsNullForUnknownContentType() { Assert.IsNull(_registry.ForName("bagoonfleskish")); } private static Assembly AssemblyOf<T>() { return typeof(T).Assembly; } } /// <summary> /// A service with a different implementation /// for each content type. /// </summary> public interface IContentTypeSpecificService { } [ContentTypeDefinition(Name)] public class FooContentType : IContentTypeDefinition { public const string Name = "Foo"; } [Export(typeof(IContentTypeSpecificService))] [ContentType(FooContentType.Name)] public class FooSpecificService : IContentTypeSpecificService { } [ContentTypeDefinition(Name)] public class BarContentType : IContentTypeDefinition { public const string Name = "Bar"; } [Export(typeof(IContentTypeSpecificService))] [ContentType(BarContentType.Name)] public class BarSpecificService : IContentTypeSpecificService { } }
using System.Reflection; using CodeEditor.Composition; using CodeEditor.Composition.Hosting; using NUnit.Framework; namespace CodeEditor.Text.Data.Tests { [TestFixture] public class ContentTypeRegistryTest { private IContentTypeRegistry _registry; [SetUp] public void SetUp() { var container = new CompositionContainer(AssemblyOf<IContentTypeSpecificService>(), AssemblyOf<IContentTypeRegistry>()); _registry = container.GetExportedValue<IContentTypeRegistry>(); } [Test] public void ContentTypeSpecificService() { var contentType = _registry.ForName(FooContentType.Name); Assert.AreEqual(FooContentType.Name, contentType.Name); Assert.IsInstanceOf<FooContentType>(contentType.Definition); Assert.IsInstanceOf<FooSpecificService>(contentType.GetService<IContentTypeSpecificService>()); } [Test] public void TextContentTypeIsAvailable() { Assert.AreEqual("text", _registry.ForName("text").Name); Assert.AreEqual("text", _registry.ForFileExtension(".txt").Name); } [Test] public void ForNameReturnsNullForUnknownContentType() { Assert.IsNull(_registry.ForName("bagoonfleskish")); } private static Assembly AssemblyOf<T>() { return typeof(T).Assembly; } } /// <summary> /// A service with a different implementation /// for each content type. /// </summary> public interface IContentTypeSpecificService { } [ContentTypeDefinition(Name)] public class FooContentType : IContentTypeDefinition { public const string Name = "Foo"; } [Export(typeof(IContentTypeSpecificService))] [ContentType(FooContentType.Name)] public class FooSpecificService : IContentTypeSpecificService { } [ContentTypeDefinition(Name)] public class BarContentType : IContentTypeDefinition { public const string Name = "Bar"; } [Export(typeof(IContentTypeSpecificService))] [ContentType(BarContentType.Name)] public class BarSpecificService : IContentTypeSpecificService { } }
mit
C#
61f0a46f3454804af55de37e6ebab83c9759f53d
Add newline
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
using ReactiveUI; using System; using System.Collections.ObjectModel; using System.Composition; using System.Linq; using System.Reactive.Disposables; using WalletWasabi.Gui.Tabs.WalletManager.GenerateWallets; using WalletWasabi.Gui.Tabs.WalletManager.HardwareWallets; using WalletWasabi.Gui.Tabs.WalletManager.LoadWallets; using WalletWasabi.Gui.Tabs.WalletManager.RecoverWallets; using WalletWasabi.Gui.ViewModels; namespace WalletWasabi.Gui.Tabs.WalletManager { [Export] [Shared] public class WalletManagerViewModel : WasabiDocumentTabViewModel { private ObservableCollection<CategoryViewModel> _categories; private CategoryViewModel _selectedCategory; private ViewModelBase _currentView; private LoadWalletViewModel LoadWalletDesktop { get; set; } public WalletManagerViewModel() : base("Wallet Manager") { } public ObservableCollection<CategoryViewModel> Categories { get => _categories; set => this.RaiseAndSetIfChanged(ref _categories, value); } public CategoryViewModel SelectedCategory { get => _selectedCategory; set => this.RaiseAndSetIfChanged(ref _selectedCategory, value); } public void SelectGenerateWallet() { SelectedCategory = Categories.First(x => x is GenerateWalletViewModel); } public void SelectRecoverWallet() { SelectedCategory = Categories.First(x => x is RecoverWalletViewModel); } public void SelectLoadWallet() { SelectedCategory = Categories.First(x => x is LoadWalletViewModel model && model.LoadWalletType == LoadWalletType.Desktop); } public void SelectTestPassword(string walletName) { var passwordTestViewModel = Categories.OfType<LoadWalletViewModel>().First(x => x.LoadWalletType == LoadWalletType.Password); SelectedCategory = passwordTestViewModel; passwordTestViewModel.SelectedWallet = passwordTestViewModel.Wallets.FirstOrDefault(w => w.WalletName == walletName); } public override void OnOpen(CompositeDisposable disposables) { base.OnOpen(disposables); LoadWalletDesktop = new LoadWalletViewModel(this, LoadWalletType.Desktop); Categories = new ObservableCollection<CategoryViewModel> { new GenerateWalletViewModel(this), new RecoverWalletViewModel(this), LoadWalletDesktop, new LoadWalletViewModel(this, LoadWalletType.Password), new ConnectHardwareWalletViewModel(this) }; SelectedCategory = Categories.FirstOrDefault(); this.WhenAnyValue(x => x.SelectedCategory).Subscribe(category => { category?.OnCategorySelected(); CurrentView = category; }); } public override bool OnClose() { foreach (var tab in Categories.OfType<IDisposable>()) { tab.Dispose(); } return base.OnClose(); } public ViewModelBase CurrentView { get => _currentView; set => this.RaiseAndSetIfChanged(ref _currentView, value); } } }
using ReactiveUI; using System; using System.Collections.ObjectModel; using System.Composition; using System.Linq; using System.Reactive.Disposables; using WalletWasabi.Gui.Tabs.WalletManager.GenerateWallets; using WalletWasabi.Gui.Tabs.WalletManager.HardwareWallets; using WalletWasabi.Gui.Tabs.WalletManager.LoadWallets; using WalletWasabi.Gui.Tabs.WalletManager.RecoverWallets; using WalletWasabi.Gui.ViewModels; namespace WalletWasabi.Gui.Tabs.WalletManager { [Export] [Shared] public class WalletManagerViewModel : WasabiDocumentTabViewModel { private ObservableCollection<CategoryViewModel> _categories; private CategoryViewModel _selectedCategory; private ViewModelBase _currentView; private LoadWalletViewModel LoadWalletDesktop { get; set; } public WalletManagerViewModel() : base("Wallet Manager") { } public ObservableCollection<CategoryViewModel> Categories { get => _categories; set => this.RaiseAndSetIfChanged(ref _categories, value); } public CategoryViewModel SelectedCategory { get => _selectedCategory; set => this.RaiseAndSetIfChanged(ref _selectedCategory, value); } public void SelectGenerateWallet() { SelectedCategory = Categories.First(x => x is GenerateWalletViewModel); } public void SelectRecoverWallet() { SelectedCategory = Categories.First(x => x is RecoverWalletViewModel); } public void SelectLoadWallet() { SelectedCategory = Categories.First(x => x is LoadWalletViewModel model && model.LoadWalletType == LoadWalletType.Desktop); } public void SelectTestPassword(string walletName) { var passwordTestViewModel = Categories.OfType<LoadWalletViewModel>().First(x => x.LoadWalletType == LoadWalletType.Password); SelectedCategory = passwordTestViewModel; passwordTestViewModel.SelectedWallet = passwordTestViewModel.Wallets.FirstOrDefault(w => w.WalletName == walletName); } public override void OnOpen(CompositeDisposable disposables) { base.OnOpen(disposables); LoadWalletDesktop = new LoadWalletViewModel(this, LoadWalletType.Desktop); Categories = new ObservableCollection<CategoryViewModel> { new GenerateWalletViewModel(this), new RecoverWalletViewModel(this), LoadWalletDesktop, new LoadWalletViewModel(this, LoadWalletType.Password), new ConnectHardwareWalletViewModel(this) }; SelectedCategory = Categories.FirstOrDefault(); this.WhenAnyValue(x => x.SelectedCategory).Subscribe(category => { category?.OnCategorySelected(); CurrentView = category; }); } public override bool OnClose() { foreach (var tab in Categories.OfType<IDisposable>()) { tab.Dispose(); } return base.OnClose(); } public ViewModelBase CurrentView { get => _currentView; set => this.RaiseAndSetIfChanged(ref _currentView, value); } } }
mit
C#