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 |
---|---|---|---|---|---|---|---|---|
39401b645a9cc2ae1d83a2cdf6a474d14afd77c9
|
Add HangfireSet Score index
|
sergezhigunov/Hangfire.EntityFramework
|
src/Hangfire.EntityFramework/HangfireSet.cs
|
src/Hangfire.EntityFramework/HangfireSet.cs
|
// Copyright (c) 2017 Sergey Zhigunov.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Hangfire.EntityFramework
{
internal class HangfireSet
{
[Key, Column(Order = 0)]
[Required]
[StringLength(100)]
public string Key { get; set; }
[Key, Column(Order = 1)]
[Required]
[StringLength(100)]
public string Value { get; set; }
[Index("IX_HangfireSet_Score", IsUnique = false)]
public double Score { get; set; }
[DateTimePrecision(7)]
[Index("IX_HangfireSet_CreatedAt", IsUnique = false)]
public DateTime CreatedAt { get; set; }
[DateTimePrecision(7)]
[Index("IX_HangfireSet_ExpireAt", IsUnique = false)]
public DateTime? ExpireAt { get; set; }
}
}
|
// Copyright (c) 2017 Sergey Zhigunov.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Hangfire.EntityFramework
{
internal class HangfireSet
{
[Key, Column(Order = 0)]
[Required]
[StringLength(100)]
public string Key { get; set; }
[Key, Column(Order = 1)]
[Required]
[StringLength(100)]
public string Value { get; set; }
public double Score { get; set; }
[DateTimePrecision(7)]
[Index("IX_HangfireSet_CreatedAt", IsUnique = false)]
public DateTime CreatedAt { get; set; }
[DateTimePrecision(7)]
[Index("IX_HangfireSet_ExpireAt", IsUnique = false)]
public DateTime? ExpireAt { get; set; }
}
}
|
mit
|
C#
|
4a39d1592e1fb2068f67c0eaaca93d64c36bb0ed
|
Update logging details
|
aliencube/Application-Insights-WebTests-SDK
|
src/Insights.WebTests.ConsoleApp/Program.cs
|
src/Insights.WebTests.ConsoleApp/Program.cs
|
using System;
using Aliencube.AdalWrapper;
using Aliencube.Azure.Insights.WebTests.Models.Options;
using Aliencube.Azure.Insights.WebTests.Services;
using Aliencube.Azure.Insights.WebTests.Services.Settings;
namespace Aliencube.Azure.Insights.WebTests.ConsoleApp
{
/// <summary>
/// This represents the main entity of the console application entry.
/// </summary>
public class Program
{
/// <summary>
/// Executes the console application.
/// </summary>
/// <param name="args">List of arguments.</param>
public static void Main(string[] args)
{
var options = CommandBuildOptions.Build(args);
using (var settings = WebTestSettingsElement.CreateInstance())
using (var context = new AuthenticationContextWrapper($"{settings.Authentication.AadInstanceUrl.TrimEnd('/')}/{settings.Authentication.TenantName}.onmicrosoft.com", false))
using (var service = new WebTestService(settings, context))
{
try
{
var processed = service.ProcessAsync(options).Result;
}
catch (AggregateException ex)
{
foreach (var e in ex.InnerExceptions)
{
Console.WriteLine($"--- Exception #{ex.InnerExceptions.IndexOf(e) + 1} ---");
LogErrorToConsole(e);
}
}
catch (Exception ex)
{
LogErrorToConsole(ex);
}
}
#if DEBUG
Console.ReadLine();
#endif
}
private static void LogErrorToConsole(Exception ex)
{
while (true)
{
Console.WriteLine(ex.Message);
#if DEBUG
Console.WriteLine(ex.StackTrace);
#endif
if (ex.InnerException == null)
{
break;
}
ex = ex.InnerException;
}
}
}
}
|
using Aliencube.AdalWrapper;
using Aliencube.Azure.Insights.WebTests.Models.Options;
using Aliencube.Azure.Insights.WebTests.Services;
using Aliencube.Azure.Insights.WebTests.Services.Settings;
namespace Aliencube.Azure.Insights.WebTests.ConsoleApp
{
/// <summary>
/// This represents the main entity of the console application entry.
/// </summary>
public class Program
{
/// <summary>
/// Executes the console application.
/// </summary>
/// <param name="args">List of arguments.</param>
public static void Main(string[] args)
{
var options = CommandBuildOptions.Build(args);
using (var settings = WebTestSettingsElement.CreateInstance())
using (var context = new AuthenticationContextWrapper($"{settings.Authentication.AadInstanceUrl.TrimEnd('/')}/{settings.Authentication.TenantName}.onmicrosoft.com", false))
using (var service = new WebTestService(settings, context))
{
var processed = service.ProcessAsync(options).Result;
}
}
}
}
|
mit
|
C#
|
8157358f45954e4dfab79b36768b01a4e7373852
|
Fix filter
|
fuyuno/Norma
|
Source/Norma.Eta/Filters/BracesFilter.cs
|
Source/Norma.Eta/Filters/BracesFilter.cs
|
using System.Text.RegularExpressions;
namespace Norma.Eta.Filters
{
public class BracesFilter : IFilter
{
private readonly Regex _regex = new Regex(@"[\(〈《【「『\[\{].*[\)〉》】」』\]\}]", RegexOptions.Compiled);
#region Implementation of IFilter
/// <summary>
/// カッコ以下を取り除きます。
/// </summary>
/// <param name="str">e.g. "しずちゃん(南海キャンディーズ)"</param>
/// <returns>e.g. "しずちゃん"</returns>
public string Call(string str)
{
return _regex.Replace(str, "");
}
#endregion
}
}
|
using System.Text.RegularExpressions;
namespace Norma.Eta.Filters
{
public class BracesFilter : IFilter
{
private readonly Regex _regex = new Regex(@"[\(〈《【「『\[\{].*?[\)〉》】」』\]\}]", RegexOptions.Compiled);
#region Implementation of IFilter
/// <summary>
/// カッコ以下を取り除きます。
/// </summary>
/// <param name="str">e.g. "しずちゃん(南海キャンディーズ)"</param>
/// <returns>e.g. "しずちゃん"</returns>
public string Call(string str)
{
return _regex.Replace(str, "");
}
#endregion
}
}
|
mit
|
C#
|
0c4f79620c82cb32a2ecf80e7530e15cf3b081e5
|
Update comments
|
StephenMcConnel/BloomDesktop,andrew-polk/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,JohnThomson/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,gmartin7/myBloomFork,JohnThomson/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,JohnThomson/BloomDesktop,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,andrew-polk/BloomDesktop,andrew-polk/BloomDesktop,andrew-polk/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop
|
src/BloomExe/web/I18NHandler.cs
|
src/BloomExe/web/I18NHandler.cs
|
using System.Collections.Generic;
using Bloom.Collection;
using L10NSharp;
using Newtonsoft.Json;
namespace Bloom.web
{
/// <summary>
/// This class handles requests for internationalization. It uses the L10NSharp LocalizationManager to look up values.
/// </summary>
static class I18NHandler
{
public static bool HandleRequest(string localPath, IRequestInfo info, CollectionSettings currentCollectionSettings)
{
var lastSep = localPath.IndexOf("/", System.StringComparison.Ordinal);
var lastSegment = (lastSep > -1) ? localPath.Substring(lastSep + 1) : localPath;
switch (lastSegment)
{
case "loadStrings":
var d = new Dictionary<string, string>();
var post = info.GetPostData();
foreach (string key in post.Keys)
{
var translation = LocalizationManager.GetDynamicString("Bloom", key, post[key]);
if (!d.ContainsKey(key)) d.Add(key, translation);
}
info.ContentType = "application/json";
info.WriteCompleteOutput(JsonConvert.SerializeObject(d));
return true;
}
return false;
}
}
}
|
using System.Collections.Generic;
using Bloom.Collection;
using L10NSharp;
using Newtonsoft.Json;
namespace Bloom.web
{
static class I18NHandler
{
public static bool HandleRequest(string localPath, IRequestInfo info, CollectionSettings currentCollectionSettings)
{
var lastSep = localPath.IndexOf("/", System.StringComparison.Ordinal);
var lastSegment = (lastSep > -1) ? localPath.Substring(lastSep + 1) : localPath;
switch (lastSegment)
{
case "loadStrings":
var d = new Dictionary<string, string>();
var post = info.GetPostData();
foreach (string key in post.Keys)
{
var translation = LocalizationManager.GetDynamicString("Bloom", key, post[key]);
if (!d.ContainsKey(key)) d.Add(key, translation);
}
info.ContentType = "application/json";
info.WriteCompleteOutput(JsonConvert.SerializeObject(d));
return true;
}
return false;
}
}
}
|
mit
|
C#
|
bb709517d744d19c3d148f516d14f7e3a482435a
|
Fix style cop rules
|
wrightg42/tron,It423/tron
|
Tron/Application/Application/GameData.cs
|
Tron/Application/Application/GameData.cs
|
// GameData.cs
// <copyright file="GameData.cs"> This code is protected under the MIT License. </copyright>
using System;
using Tron;
namespace Application
{
/// <summary>
/// A class containing all game data and method for input handling.
/// </summary>
public static class GameData
{
/// <summary>
/// Gets or sets the game information.
/// </summary>
public static TronGame Tron { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the current game is a local multiplayer one.
/// </summary>
public static bool LocalTwoPlayer { get; set; }
/// <summary>
/// Gets or sets the id number for the online player you represent.
/// </summary>
public static int OnlinePlayerId { get; set; }
/// <summary>
/// Sends the move command to a player.
/// </summary>
/// <param name="direction"> The direction to move. </param>
/// <param name="player"> The player inputting the move. </param>
public static void ChangeDirection(Direction direction, int player)
{
// Change the id of the player being redirected if not local two player
if (!LocalTwoPlayer)
{
// If the player key set is that of player two don't do anything
if (player != 0)
{
return;
}
player = OnlinePlayerId;
}
Tron.Cars[player].ChangeDirection(direction);
}
/// <summary>
/// Boosts a player.
/// </summary>
/// <param name="player"> The player inputting the boost. </param>
public static void Boost(int player)
{
// Change the id of the player being boosted if not local two player
if (!LocalTwoPlayer)
{
// If the player key set is that of player two don't do anything
if (player != 0)
{
return;
}
player = OnlinePlayerId;
}
Tron.Cars[player].Boost();
}
}
}
|
using System;
// GameData.cs
// <copyright file="GameData.cs"> This code is protected under the MIT License. </copyright>
using Tron;
namespace Application
{
public static class GameData
{
/// <summary>
/// Gets or sets the game information.
/// </summary>
public static TronGame Tron { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the current game is a local multiplayer one.
/// </summary>
public static bool LocalTwoPlayer { get; set; }
/// <summary>
/// Gets or sets the id number for the online player you represent.
/// </summary>
public static int OnlinePlayerId { get; set; }
/// <summary>
/// Sends the move command to a player.
/// </summary>
/// <param name="direction"> The direction to move. </param>
/// <param name="player"> The player inputting the move. </param>
public static void ChangeDirection(Direction direction, int player)
{
// Change the id of the player being redirected if not local two player
if (!LocalTwoPlayer)
{
// If the player key set is that of player two don't do anything
if (player != 0)
{
return;
}
player = OnlinePlayerId;
}
Tron.Cars[player].ChangeDirection(direction);
}
/// <summary>
/// Boosts a player.
/// </summary>
/// <param name="player"> The player inputting the boost. </param>
public static void Boost(int player)
{
// Change the id of the player being boosted if not local two player
if (!LocalTwoPlayer)
{
// If the player key set is that of player two don't do anything
if (player != 0)
{
return;
}
player = OnlinePlayerId;
}
Tron.Cars[player].Boost();
}
}
}
|
mit
|
C#
|
676d64aee31229c68d84686b8c58cc3986f157c7
|
fix for GA
|
autumn009/TanoCSharpSamples
|
Chap37/EnhancedLineDirective/EnhancedLineDirective/Program.cs
|
Chap37/EnhancedLineDirective/EnhancedLineDirective/Program.cs
|
#line (1000, 20) - (1010, 99) "otherfile.cs"
System.Console.WriteLine("Hello, World!");
#warning This is warning.
|
#line (1000, 20) - (1010, 99) "otherfile.cs"
Console.WriteLine("Hello, World!");
#warning This is warning.
|
mit
|
C#
|
0afa54ee6f5fe2c8b4c3fe46391b2bccb844e153
|
Fix missing .ascx extension in control filename
|
roman-yagodin/R7.Epsilon,roman-yagodin/R7.Epsilon,roman-yagodin/R7.Epsilon
|
R7.Epsilon/components/ControlLocalizer.cs
|
R7.Epsilon/components/ControlLocalizer.cs
|
//
// ControlLocalizer.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2015
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Web.UI;
using DotNetNuke.Services.Localization;
namespace R7.Epsilon
{
public class ControlLocalizer
{
#region Properties
protected string LocalResourceFile { get; private set; }
#endregion
public ControlLocalizer (Control control)
{
LocalResourceFile = Localization.GetResourceFile (control, control.GetType ().Name + ".ascx");
}
#region Public methods
public string GetString (string key)
{
return Localization.GetString (key, LocalResourceFile);
}
// REVIEW: Remove as unused?
public string GetString (string key, string defaultKey)
{
var localizedValue = GetString (key);
return !string.IsNullOrWhiteSpace (localizedValue) ? localizedValue : GetString(defaultKey);
}
public string SafeGetString (string key, string defaultValue)
{
var localizedValue = GetString (key);
return !string.IsNullOrWhiteSpace (localizedValue) ? localizedValue : defaultValue;
}
#endregion
}
}
|
//
// ControlLocalizer.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2015
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Web.UI;
using DotNetNuke.Services.Localization;
namespace R7.Epsilon
{
public class ControlLocalizer
{
#region Properties
protected string LocalResourceFile { get; private set; }
#endregion
public ControlLocalizer (Control control)
{
LocalResourceFile = Localization.GetResourceFile (control, control.GetType ().Name);
}
#region Public methods
public string GetString (string key)
{
return Localization.GetString (key, LocalResourceFile);
}
public string GetString (string key, string defaultKey)
{
var localizedValue = GetString (key);
return !string.IsNullOrWhiteSpace (localizedValue) ? localizedValue : GetString(defaultKey);
}
public string SafeGetString (string key, string defaultValue)
{
var localizedValue = GetString (key);
return !string.IsNullOrWhiteSpace (localizedValue) ? localizedValue : defaultValue;
}
#endregion
}
}
|
agpl-3.0
|
C#
|
bc32e97773f82d0317f97b3da7541ee4a1ce2a34
|
Update SapphireSkin.cs
|
AlexanderDzhoganov/Skylines-Sapphire,bnm12/Skylines-Sapphire
|
Skins/TemplateSkin/Source/SapphireSkin.cs
|
Skins/TemplateSkin/Source/SapphireSkin.cs
|
using ICities;
namespace SapphireSkin
{
public class Mod : IUserMod
{
public string Name
{
get
{
return "YourSkinName";
}
}
public string Description
{
get { return "YourSkinDescription"; }
}
}
}
|
using ICities;
namespace SapphireSkin
{
public class Mod : IUserMod
{
public string Name
{
get
{
return "<YourSkinName>";
}
}
public string Description
{
get { return "<YourSkinDescription>"; }
}
}
}
|
mit
|
C#
|
d335c15e0022d3ee7b0bcbf7cdd6b342584f7345
|
Downgrade der DB
|
iwb/ILK-Protokoll,iwb/ILK-Protokoll
|
ILK-Protokoll/Migrations/201409151502066_approval_tristate.cs
|
ILK-Protokoll/Migrations/201409151502066_approval_tristate.cs
|
using System.Data.Entity.Migrations;
namespace ILK_Protokoll.Migrations
{
public partial class approval_tristate : DbMigration
{
public override void Up()
{
RenameColumn("dbo.L_Extension", name: "Approved", newName: "Approval");
AlterColumn("dbo.L_Extension", "Approval", c => c.Int(nullable: false));
RenameColumn("dbo.L_Conference", name: "Approved", newName: "Approval");
AlterColumn("dbo.L_Conference", "Approval", c => c.Int(nullable: false));
}
public override void Down()
{
AlterColumn("dbo.L_Extension", "Approval", c => c.Boolean(nullable: false));
RenameColumn("dbo.L_Extension", name: "Approval", newName: "Approved");
AlterColumn("dbo.L_Conference", "Approval", c => c.Boolean(nullable: false));
RenameColumn("dbo.L_Conference", name: "Approval", newName: "Approved");
}
}
}
|
using System.Data.Entity.Migrations;
namespace ILK_Protokoll.Migrations
{
public partial class approval_tristate : DbMigration
{
public override void Up()
{
RenameColumn("dbo.L_Extension", name: "Approved", newName: "Approval");
AlterColumn("dbo.L_Extension", "Approval", c => c.Int(nullable: false));
RenameColumn("dbo.L_Conference", name: "Approved", newName: "Approval");
AlterColumn("dbo.L_Conference", "Approval", c => c.Int(nullable: false));
}
public override void Down()
{
RenameColumn("dbo.L_Extension", name: "Approval", newName: "Approved");
AlterColumn("dbo.L_Extension", "Approval", c => c.Boolean(nullable: false));
RenameColumn("dbo.L_Conference", name: "Approval", newName: "Approved");
AlterColumn("dbo.L_Conference", "Approval", c => c.Boolean(nullable: false));
}
}
}
|
mit
|
C#
|
4888b49a169146443fc7c56b4095468db14f5c2c
|
Fix version
|
mastertnt/XRay
|
XTreeListView/Properties/AssemblyInfo.cs
|
XTreeListView/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
// 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("XTreeListView")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("XTreeListView")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("42f47e5f-e4a3-457d-884b-90d52170314f")]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
[assembly: XmlnsDefinition("http://schemas.xray.com/wpf/xaml/xtreelistview", "XTreeListView.Gui")]
// 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.1.4.0")]
[assembly: AssemblyFileVersion("2.1.4.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
// 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("XTreeListView")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("XTreeListView")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("42f47e5f-e4a3-457d-884b-90d52170314f")]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
[assembly: XmlnsDefinition("http://schemas.xray.com/wpf/xaml/xtreelistview", "XTreeListView.Gui")]
// 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.1.3.0")]
[assembly: AssemblyFileVersion("2.1.3.0")]
|
mit
|
C#
|
a66c4961d1f8776c1a22e52cc474a69764d5b9c8
|
Update ToFriendlyStringTests.cs
|
Fody/Fody,GeertvanHorrik/Fody
|
Tests/FodyCommon/ToFriendlyStringTests.cs
|
Tests/FodyCommon/ToFriendlyStringTests.cs
|
using System;
using Xunit;
public class ToFriendlyStringTests : TestBase
{
[Fact(Skip = "todo")]
public void ToFriendlyName()
{
var currentDirectory = Environment.CurrentDirectory.ToLowerInvariant()
.Replace(@"bin\debug", string.Empty)
.Replace(@"bin\release", string.Empty);
try
{
ThrowException1();
}
catch (Exception exception)
{
var friendlyString = exception.ToFriendlyString().ToLowerInvariant();
friendlyString = friendlyString
.Replace(currentDirectory, string.Empty);
// ReSharper disable StringLiteralTypo
var expected = @"an unhandled exception occurred:
exception:
foo
type:
system.exception
stacktrace:
at tofriendlystringtests.throwexception2() in tofriendlystringtests.cs:line 60
at tofriendlystringtests.throwexception1() in tofriendlystringtests.cs:line 55
at tofriendlystringtests.tofriendlyname() in tofriendlystringtests.cs:line 15
source:
fodycommon.tests
targetsite:
void throwexception2()
";
// ReSharper restore StringLiteralTypo
Assert.Equal(expected, friendlyString);
}
}
void ThrowException1()
{
ThrowException2();
}
void ThrowException2()
{
throw new Exception("Foo");
}
}
|
using System;
using Xunit;
public class ToFriendlyStringTests : TestBase
{
[Fact(Skip = "todo")]
public void ToFriendlyName()
{
var currentDirectory = AssemblyLocation.CurrentDirectory.ToLowerInvariant()
.Replace(@"bin\debug", string.Empty)
.Replace(@"bin\release", string.Empty);
try
{
ThrowException1();
}
catch (Exception exception)
{
var friendlyString = exception.ToFriendlyString().ToLowerInvariant();
friendlyString = friendlyString
.Replace(currentDirectory, string.Empty);
// ReSharper disable StringLiteralTypo
var expected = @"an unhandled exception occurred:
exception:
foo
type:
system.exception
stacktrace:
at tofriendlystringtests.throwexception2() in tofriendlystringtests.cs:line 60
at tofriendlystringtests.throwexception1() in tofriendlystringtests.cs:line 55
at tofriendlystringtests.tofriendlyname() in tofriendlystringtests.cs:line 15
source:
fodycommon.tests
targetsite:
void throwexception2()
";
// ReSharper restore StringLiteralTypo
Assert.Equal(expected, friendlyString);
}
}
void ThrowException1()
{
ThrowException2();
}
void ThrowException2()
{
throw new Exception("Foo");
}
}
|
mit
|
C#
|
18db3bcf18ad9fd8acf89b7639ae7037b64c4f6c
|
Fix warnings.
|
DotNetAnalyzers/WpfAnalyzers
|
WpfAnalyzers.Analyzers/Helpers/SymbolHelpers/TypeSymbolExt.cs
|
WpfAnalyzers.Analyzers/Helpers/SymbolHelpers/TypeSymbolExt.cs
|
namespace WpfAnalyzers
{
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis;
[SuppressMessage("ReSharper", "UnusedMember.Global")]
internal static class TypeSymbolExt
{
internal static IEnumerable<ITypeSymbol> RecursiveBaseTypes(this ITypeSymbol type)
{
while (type != null)
{
foreach (var @interface in type.AllInterfaces)
{
yield return @interface;
}
type = type.BaseType;
if (type != null)
{
yield return type;
}
}
}
}
}
|
namespace WpfAnalyzers
{
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using Gu.Roslyn.AnalyzerExtensions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
[SuppressMessage("ReSharper", "UnusedMember.Global")]
internal static class TypeSymbolExt
{
internal static IEnumerable<ITypeSymbol> RecursiveBaseTypes(this ITypeSymbol type)
{
while (type != null)
{
foreach (var @interface in type.AllInterfaces)
{
yield return @interface;
}
type = type.BaseType;
if (type != null)
{
yield return type;
}
}
}
}
}
|
mit
|
C#
|
3a3475b0fc5b63b72bdb1d7910cc85d6306e7fc4
|
fix updated version number
|
NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity
|
ncmb_unity/Assets/NCMB/CommonConstant.cs
|
ncmb_unity/Assets/NCMB/CommonConstant.cs
|
/*******
Copyright 2014 NIFTY Corporation All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**********/
using System.Collections;
namespace NCMB.Internal
{
//通信種別
internal enum ConnectType
{
//GET通信
GET,
//POST通信
POST,
//PUT通信
PUT,
//DELETE通信
DELETE
}
/// <summary>
/// 定数を定義する共通用のクラスです
/// </summary>
internal static class CommonConstant
{
//service
public static readonly string DOMAIN = "mb.api.cloud.nifty.com";//ドメイン
public static readonly string DOMAIN_URL = "https://mb.api.cloud.nifty.com";//ドメインのURL
public static readonly string API_VERSION = "2013-09-01";//APIバージョン
public static readonly string SDK_VERSION = "2.1.1"; //SDKバージョン
//DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください
}
}
|
/*******
Copyright 2014 NIFTY Corporation All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**********/
using System.Collections;
namespace NCMB.Internal
{
//通信種別
internal enum ConnectType
{
//GET通信
GET,
//POST通信
POST,
//PUT通信
PUT,
//DELETE通信
DELETE
}
/// <summary>
/// 定数を定義する共通用のクラスです
/// </summary>
internal static class CommonConstant
{
//service
public static readonly string DOMAIN = "mb.api.cloud.nifty.com";//ドメイン
public static readonly string DOMAIN_URL = "https://mb.api.cloud.nifty.com";//ドメインのURL
public static readonly string API_VERSION = "2013-09-01";//APIバージョン
public static readonly string SDK_VERSION = "2.1.0"; //SDKバージョン
//DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください
}
}
|
apache-2.0
|
C#
|
34cc5360147ea7422782f1928810bbdce238ad54
|
update object names
|
Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen
|
ConsoleTestApp/Program.cs
|
ConsoleTestApp/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Dashen;
using Dashen.Endpoints.Stats;
namespace ConsoleTestApp
{
class Program
{
static void Main(string[] args)
{
var config = new DashenConfiguration
{
ListenOn = new Uri("http://localhost:8080")
};
config.EnableConsoleLog();
var ui = new Dashboard(config);
var model = new TextControlViewModel { Content = "Test" };
//config all the things...
ui.Register(new Widget
{
Create = () => model,
Heading = "Text",
Interval = new TimeSpan(0, 0, 10),
Width = 2,
});
ui.Register(new Widget
{
Create = () => new ListControlViewModel { Items = new[] { "One", "Two", "Many", "Lots" }.ToList() },
Heading = "List",
Width = 3
});
ui.Register(new Widget
{
Create = () => new GraphControlViewModel
{
Points = new[] { new Pair(0,10), new Pair(50, 15) },
XTicks = new[] { new Label(0, "left"), new Label(50, "right") }
},
Heading = "Graph",
Width = 7
});
ui.Register(new Widget
{
Create = () => new BarGraphControlViewModel
{
Points = new[] { new Pair(0, 10), new Pair(2, 15) },
XTicks = new[] { new Label(0, "left"), new Label(2, "right") }
},
Heading = "Bar",
Width = 3
});
ui.Start();
Console.WriteLine("Webui running on port 8080.");
Console.WriteLine("Press any key to exit.");
Task.Run(() =>
{
var counter = 0;
while (true)
{
counter++;
model.Content = "Test " + counter;
Thread.Sleep(1000);
}
});
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Dashen;
using Dashen.Endpoints.Stats;
namespace ConsoleTestApp
{
class Program
{
static void Main(string[] args)
{
var ui = new Dashboard(new DashenConfiguration{
ListenOn = new Uri("http://localhost:8080")
});
var model = new TextControlViewModel { Content = "Test" };
//config all the things...
ui.Register(new Widget
{
Create = () => model,
Heading = "Text",
Interval = new TimeSpan(0,0,1),
Width = 2,
});
ui.Register(new Widget
{
Create = () => new ListControlViewModel { Items = new[] { "One", "Two", "Many", "Lots" }.ToList() },
Heading = "List",
Width = 3
});
ui.Register(new Widget
{
Create = () => new GraphControlViewModel
{
Points = new[] { new KeyValuePair<int, int>(0,10), new KeyValuePair<int, int>(50, 15) },
XTicks = new[] { new KeyValuePair<int, string>(0, "left"), new KeyValuePair<int, string>(50, "right") }
},
Heading = "Graph",
Width = 7
});
ui.Register(new Widget
{
Create = () => new BarGraphControlViewModel
{
Points = new[] { new KeyValuePair<int, int>(0, 10), new KeyValuePair<int, int>(2, 15) },
XTicks = new[] { new KeyValuePair<int, string>(0, "left"), new KeyValuePair<int, string>(2, "right") }
},
Heading = "Bar",
Width = 3
});
ui.Start();
Console.WriteLine("Webui running on port 8080.");
Console.WriteLine("Press any key to exit.");
Task.Run(() =>
{
var counter = 0;
while (true)
{
counter++;
model.Content = "Test " + counter;
Thread.Sleep(1000);
}
});
Console.ReadKey();
}
}
}
|
lgpl-2.1
|
C#
|
8d8befc95779e0d4fae946151b73fb6a1a36fc12
|
Handle iOS memory alerts and free any memory we can
|
EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ZLima12/osu-framework
|
osu.Framework.iOS/GameViewController.cs
|
osu.Framework.iOS/GameViewController.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 CoreGraphics;
using UIKit;
namespace osu.Framework.iOS
{
internal class GameViewController : UIViewController
{
public override bool PrefersStatusBarHidden() => true;
public override UIRectEdge PreferredScreenEdgesDeferringSystemGestures => UIRectEdge.All;
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
SixLabors.ImageSharp.Configuration.Default.MemoryAllocator.ReleaseRetainedResources();
GC.Collect();
}
public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
{
coordinator.AnimateAlongsideTransition(_ => { }, _ => UIView.AnimationsEnabled = true);
UIView.AnimationsEnabled = false;
base.ViewWillTransitionToSize(toSize, coordinator);
(View as IOSGameView)?.RequestResizeFrameBuffer();
}
}
}
|
// 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 CoreGraphics;
using UIKit;
namespace osu.Framework.iOS
{
internal class GameViewController : UIViewController
{
public override bool PrefersStatusBarHidden() => true;
public override UIRectEdge PreferredScreenEdgesDeferringSystemGestures => UIRectEdge.All;
public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
{
coordinator.AnimateAlongsideTransition(_ => { }, _ => UIView.AnimationsEnabled = true);
UIView.AnimationsEnabled = false;
base.ViewWillTransitionToSize(toSize, coordinator);
(View as IOSGameView)?.RequestResizeFrameBuffer();
}
}
}
|
mit
|
C#
|
f4a8d0032b5663474acc5784762672a43a9f1dec
|
Fix help text to use Debug output
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Common/Execution/HandleHelpRequestsAttribute.cs
|
source/Nuke.Common/Execution/HandleHelpRequestsAttribute.cs
|
// Copyright 2021 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Linq;
namespace Nuke.Common.Execution
{
internal class HandleHelpRequestsAttribute : BuildExtensionAttributeBase, IOnBuildInitialized
{
public void OnBuildInitialized(
NukeBuild build,
IReadOnlyCollection<ExecutableTarget> executableTargets,
IReadOnlyCollection<ExecutableTarget> executionPlan)
{
if (build.Help || executionPlan.Count == 0)
{
Host.Debug(HelpTextService.GetTargetsText(build.ExecutableTargets));
Host.Debug(HelpTextService.GetParametersText(build));
}
if (build.Plan)
ExecutionPlanHtmlService.ShowPlan(build.ExecutableTargets);
if (build.Help || executionPlan.Count == 0 || build.Plan)
Environment.Exit(exitCode: 0);
}
}
}
|
// Copyright 2021 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Linq;
namespace Nuke.Common.Execution
{
internal class HandleHelpRequestsAttribute : BuildExtensionAttributeBase, IOnBuildInitialized
{
public void OnBuildInitialized(
NukeBuild build,
IReadOnlyCollection<ExecutableTarget> executableTargets,
IReadOnlyCollection<ExecutableTarget> executionPlan)
{
if (build.Help || executionPlan.Count == 0)
{
Host.Information(HelpTextService.GetTargetsText(build.ExecutableTargets));
Host.Information(HelpTextService.GetParametersText(build));
}
if (build.Plan)
ExecutionPlanHtmlService.ShowPlan(build.ExecutableTargets);
if (build.Help || executionPlan.Count == 0 || build.Plan)
Environment.Exit(exitCode: 0);
}
}
}
|
mit
|
C#
|
22973f2154834046ea9a17c4ceb0128d4c1e8dc9
|
Add encryption support
|
Baggykiin/pass-winmenu
|
pass-winmenu/src/ExternalPrograms/GPG.cs
|
pass-winmenu/src/ExternalPrograms/GPG.cs
|
using System;
using System.Diagnostics;
using System.Text;
namespace PassWinmenu.ExternalPrograms
{
/// <summary>
/// Simple wrapper over GPG.
/// </summary>
internal class GPG
{
private readonly string executable;
/// <summary>
/// Initialises the wrapper.
/// </summary>
/// <param name="executable">The name of the GPG executable. Can be a full filename or the name of an executable contained in %PATH%.</param>
public GPG(string executable)
{
this.executable = executable;
}
/// <summary>
/// Runs GPG with the given arguments, and returns everything it prints to its standard output.
/// </summary>
/// <param name="arguments">The arguments to be passed to GPG.</param>
/// <returns>A (UTF-8 decoded) string containing the text returned by GPG.</returns>
/// <exception cref="GpgException">Thrown when GPG returns a non-zero exit code.</exception>
private string RunGPG(string arguments)
{
var proc = Process.Start(new ProcessStartInfo
{
FileName = executable,
Arguments = arguments,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
StandardOutputEncoding = Encoding.UTF8
});
proc.WaitForExit();
var result = proc.StandardOutput.ReadToEnd();
if (proc.ExitCode != 0)
{
throw new GpgException(proc.ExitCode);
}
return result;
}
/// <summary>
/// Decrypt a file with GPG.
/// </summary>
/// <param name="file">The path to the file to be decrypted.</param>
/// <returns>The contents of the decrypted file.</returns>
/// <exception cref="GpgException">Thrown when decryption fails.</exception>
public string Decrypt(string file)
{
return RunGPG($"--decrypt \"{file}\"");
}
/// <summary>
/// Encrypt a file with GPG.
/// </summary>
/// <param name="file">The path to the file to be encrypted.</param>
/// <exception cref="GpgException">Thrown when encryption fails.</exception>
public void Encrypt(string file)
{
RunGPG($"--default-recipient-self --encrypt \"{file}\"");
}
}
internal class GpgException : Exception
{
public int ExitCode { get; }
public GpgException(int exitCode)
{
ExitCode = exitCode;
}
}
}
|
using System;
using System.Diagnostics;
using System.Text;
namespace PassWinmenu.ExternalPrograms
{
/// <summary>
/// Simple wrapper over GPG.
/// </summary>
internal class GPG
{
private readonly string executable;
/// <summary>
/// Initialises the wrapper.
/// </summary>
/// <param name="executable">The name of the GPG executable. Can be a full filename or the name of an executable contained in %PATH%.</param>
public GPG(string executable)
{
this.executable = executable;
}
/// <summary>
/// Runs GPG with the given arguments, and returns everything it prints to its standard output.
/// </summary>
/// <param name="arguments">The arguments to be passed to GPG.</param>
/// <returns>A (UTF-8 decoded) string containing the text returned by GPG.</returns>
/// <exception cref="GpgException">Thrown when GPG returns a non-zero exit code.</exception>
private string RunGPG(string arguments)
{
var proc = Process.Start(new ProcessStartInfo
{
FileName = executable,
Arguments = arguments,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
StandardOutputEncoding = Encoding.UTF8
});
proc.WaitForExit();
var result = proc.StandardOutput.ReadToEnd();
if (proc.ExitCode != 0)
{
throw new GpgException(proc.ExitCode);
}
return result;
}
/// <summary>
/// Decrypt a file with GPG.
/// </summary>
/// <param name="file">The path to the file to be decrypted.</param>
/// <returns>The contents of the decrypted file.</returns>
/// <exception cref="GpgException">Thrown when decryption fails.</exception>
public string Decrypt(string file)
{
return RunGPG($"--decrypt \"{file}\"");
}
}
internal class GpgException : Exception
{
public int ExitCode { get; }
public GpgException(int exitCode)
{
ExitCode = exitCode;
}
}
}
|
mit
|
C#
|
49b087f6bc77ecf0cfa0434b6d898aefa9802cea
|
Fix typo
|
Xeeynamo/KingdomHearts
|
OpenKh.Kh2/Battle/Lvup.cs
|
OpenKh.Kh2/Battle/Lvup.cs
|
using System.Collections.Generic;
using System.IO;
using Xe.BinaryMapper;
namespace OpenKh.Kh2.Battle
{
public class Lvup
{
[Data] public int MagicCode { get; set; }
[Data] public int Count { get; set; }
[Data(Count = 0x38)] public byte[] Unknown08 { get; set; }
[Data(Count = 13)] public List<PlayableCharacter> Characters { get; set; }
public class PlayableCharacter
{
[Data] public int NumLevels { get; set; }
[Data(Count = 99)] public List<Level> Levels { get; set; }
public class Level
{
[Data] public int Exp { get; set; }
[Data] public byte Strength { get; set; }
[Data] public byte Magic { get; set; }
[Data] public byte Defense { get; set; }
[Data] public byte Ap { get; set; }
[Data] public short SwordAbility { get; set; }
[Data] public short ShieldAbility { get; set; }
[Data] public short StaffAbility { get; set; }
[Data] public short Padding { get; set; }
}
}
public enum PlayableCharacterType
{
Sora,
Donald,
Goofy,
Mickey,
Auron,
PingMulan,
Aladdin,
Sparrow,
Beast,
Jack,
Simba,
Tron,
Riku
}
public static Lvup Read(Stream stream) => BinaryMapping.ReadObject<Lvup>(stream);
public void Write(Stream stream) => BinaryMapping.WriteObject(stream, this);
}
}
|
using System.Collections.Generic;
using System.IO;
using Xe.BinaryMapper;
namespace OpenKh.Kh2.Battle
{
public class Lvup
{
[Data] public int MagicCode { get; set; }
[Data] public int Count { get; set; }
[Data(Count = 0x38)] public byte[] Unknown08 { get; set; }
[Data(Count = 13)] public List<PlayableCharacter> Characters { get; set; }
public class PlayableCharacter
{
[Data] public int NumLevels { get; set; }
[Data(Count = 99)] public List<Level> Levels { get; set; }
public class Level
{
[Data] public int Exp { get; set; }
[Data] public byte Strength { get; set; }
[Data] public byte Magic { get; set; }
[Data] public byte Defense { get; set; }
[Data] public byte Ap { get; set; }
[Data] public short SwordAbility { get; set; }
[Data] public short ShieldAbility { get; set; }
[Data] public short StaffAbility { get; set; }
[Data] public short Padding { get; set; }
}
}
public enum PlayableCharacterType
{
Sora,
Donald,
Goofy,
Mickey,
Auron,
PingMulan,
Aladdin,
Sparrow,
Biest,
Jack,
Simba,
Tron,
Riku
}
public static Lvup Read(Stream stream) => BinaryMapping.ReadObject<Lvup>(stream);
public void Write(Stream stream) => BinaryMapping.WriteObject(stream, this);
}
}
|
mit
|
C#
|
d732d276b1186ce2108c2a5c88a6c2ec45907284
|
Make activation delay customisable
|
ZLima12/osu,ppy/osu,ppy/osu,2yangk23/osu,EVAST9919/osu,smoogipooo/osu,peppy/osu,peppy/osu-new,johnneijzen/osu,UselessToucan/osu,EVAST9919/osu,johnneijzen/osu,2yangk23/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,ZLima12/osu,smoogipoo/osu,ppy/osu
|
osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
|
osu.Game/Graphics/Containers/HoldToConfirmContainer.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.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Graphics.Containers
{
public abstract class HoldToConfirmContainer : Container
{
public Action Action;
private const int default_activation_delay = 200;
private const int fadeout_delay = 200;
private readonly double activationDelay;
private bool fired;
private bool confirming;
/// <summary>
/// Whether the overlay should be allowed to return from a fired state.
/// </summary>
protected virtual bool AllowMultipleFires => false;
public Bindable<double> Progress = new BindableDouble();
/// <summary>
/// Create a new instance.
/// </summary>
/// <param name="activationDelay">The time requried before an action is confirmed.</param>
protected HoldToConfirmContainer(double activationDelay = default_activation_delay)
{
this.activationDelay = activationDelay;
}
protected void BeginConfirm()
{
if (confirming || (!AllowMultipleFires && fired)) return;
confirming = true;
this.TransformBindableTo(Progress, 1, activationDelay * (1 - Progress.Value), Easing.Out).OnComplete(_ => Confirm());
}
protected virtual void Confirm()
{
Action?.Invoke();
fired = true;
}
protected void AbortConfirm()
{
if (!AllowMultipleFires && fired) return;
confirming = false;
this.TransformBindableTo(Progress, 0, fadeout_delay, Easing.Out);
}
}
}
|
// 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.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Graphics.Containers
{
public abstract class HoldToConfirmContainer : Container
{
public Action Action;
private const int activate_delay = 200;
private const int fadeout_delay = 200;
private bool fired;
private bool confirming;
/// <summary>
/// Whether the overlay should be allowed to return from a fired state.
/// </summary>
protected virtual bool AllowMultipleFires => false;
public Bindable<double> Progress = new BindableDouble();
protected void BeginConfirm()
{
if (confirming || (!AllowMultipleFires && fired)) return;
confirming = true;
this.TransformBindableTo(Progress, 1, activate_delay * (1 - Progress.Value), Easing.Out).OnComplete(_ => Confirm());
}
protected virtual void Confirm()
{
Action?.Invoke();
fired = true;
}
protected void AbortConfirm()
{
if (!AllowMultipleFires && fired) return;
confirming = false;
this.TransformBindableTo(Progress, 0, fadeout_delay, Easing.Out);
}
}
}
|
mit
|
C#
|
5569b1c3b8893e87d13bfff9ae355cb16b21d845
|
Add test to prove proper support for TimeSpan in AppSettings
|
CaioProiete/serilog,serilog/serilog,merbla/serilog,merbla/serilog,serilog/serilog
|
test/Serilog.Tests/Settings/SettingValueConversionsTests.cs
|
test/Serilog.Tests/Settings/SettingValueConversionsTests.cs
|
using System;
using Serilog.Events;
using Serilog.Formatting;
using Serilog.Formatting.Json;
using Serilog.Settings.KeyValuePairs;
using Xunit;
namespace Serilog.Tests.Settings
{
public class SettingValueConversionsTests
{
[Fact]
public void ConvertibleValuesConvertToTIfTargetIsNullable()
{
var result = (int?)SettingValueConversions.ConvertToType("3", typeof(int?));
Assert.True(result == 3);
}
[Fact]
public void NullValuesConvertToNullIfTargetIsNullable()
{
var result = (int?)SettingValueConversions.ConvertToType(null, typeof(int?));
Assert.True(result == null);
}
[Fact]
public void EmptyStringValuesConvertToNullIfTargetIsNullable()
{
var result = (int?)SettingValueConversions.ConvertToType("", typeof(int?));
Assert.True(result == null);
}
[Fact]
public void ValuesConvertToNullableTimeSpan()
{
var result = (System.TimeSpan?)SettingValueConversions.ConvertToType("00:01:00", typeof(System.TimeSpan?));
Assert.Equal(System.TimeSpan.FromMinutes(1), result);
}
[Fact]
public void ValuesConvertToEnumMembers()
{
var result = (LogEventLevel)SettingValueConversions.ConvertToType("Information", typeof(LogEventLevel));
Assert.Equal(LogEventLevel.Information, result);
}
[Fact]
public void StringValuesConvertToDefaultInstancesIfTargetIsInterface()
{
var result = SettingValueConversions.ConvertToType("Serilog.Formatting.Json.JsonFormatter", typeof(ITextFormatter));
Assert.IsType<JsonFormatter>(result);
}
[Theory]
[InlineData("3.14:21:18.986", 3 /*days*/, 14 /*hours*/, 21 /*min*/, 18 /*sec*/, 986 /*ms*/)]
[InlineData("4", 4, 0, 0, 0, 0)] // minimal : days
[InlineData("2:0", 0, 2, 0, 0, 0)] // minimal hours
[InlineData("0:5", 0, 0, 5, 0, 0)] // minimal minutes
[InlineData("0:0:7", 0, 0, 0, 7, 0)] // minimal seconds
[InlineData("0:0:0.2", 0, 0, 0, 0, 200)] // minimal milliseconds
public void TimeSpanValuesCanBeParsed(string input, int expDays, int expHours, int expMin, int expSec, int expMs)
{
var expectedTimeSpan = new TimeSpan(expDays, expHours, expMin, expSec, expMs);
var actual = SettingValueConversions.ConvertToType(input, typeof(TimeSpan));
Assert.IsType<TimeSpan>(actual);
Assert.Equal(expectedTimeSpan, actual);
}
}
}
|
using Serilog.Events;
using Serilog.Formatting;
using Serilog.Formatting.Json;
using Serilog.Settings.KeyValuePairs;
using Xunit;
namespace Serilog.Tests.Settings
{
public class SettingValueConversionsTests
{
[Fact]
public void ConvertibleValuesConvertToTIfTargetIsNullable()
{
var result = (int?)SettingValueConversions.ConvertToType("3", typeof(int?));
Assert.True(result == 3);
}
[Fact]
public void NullValuesConvertToNullIfTargetIsNullable()
{
var result = (int?)SettingValueConversions.ConvertToType(null, typeof(int?));
Assert.True(result == null);
}
[Fact]
public void EmptyStringValuesConvertToNullIfTargetIsNullable()
{
var result = (int?)SettingValueConversions.ConvertToType("", typeof(int?));
Assert.True(result == null);
}
[Fact]
public void ValuesConvertToNullableTimeSpan()
{
var result = (System.TimeSpan?)SettingValueConversions.ConvertToType("00:01:00", typeof(System.TimeSpan?));
Assert.Equal(System.TimeSpan.FromMinutes(1), result);
}
[Fact]
public void ValuesConvertToEnumMembers()
{
var result = (LogEventLevel)SettingValueConversions.ConvertToType("Information", typeof(LogEventLevel));
Assert.Equal(LogEventLevel.Information, result);
}
[Fact]
public void StringValuesConvertToDefaultInstancesIfTargetIsInterface()
{
var result = SettingValueConversions.ConvertToType("Serilog.Formatting.Json.JsonFormatter", typeof(ITextFormatter));
Assert.IsType<JsonFormatter>(result);
}
}
}
|
apache-2.0
|
C#
|
000e58ad73aeba2942a17979c0bcb26fab48e8c8
|
Remove comment parsing code from InkParser since it's now handled by the pre-parse step
|
ghostpattern/ink,inkle/ink,ghostpattern/ink,ivaylo5ev/ink,inkle/ink,ivaylo5ev/ink
|
inklecate2Sharp/Parser/InkParser_Whitespace.cs
|
inklecate2Sharp/Parser/InkParser_Whitespace.cs
|
using System;
using System.Collections.Generic;
namespace Inklewriter
{
public partial class InkParser
{
// Handles both newline and endOfFile
protected object EndOfLine()
{
BeginRule();
object newlineOrEndOfFile = OneOf(Newline, EndOfFile);
if( newlineOrEndOfFile == null ) {
return FailRule();
} else {
return SucceedRule(newlineOrEndOfFile);
}
}
// You probably want "endOfLine", since it handles endOfFile too.
protected object Newline()
{
BeginRule();
Whitespace();
// Optional \r, definite \n to support Windows (\r\n) and Mac/Unix (\n)
ParseString ("\r");
bool gotNewline = ParseString ("\n") != null;
if( !gotNewline ) {
return FailRule();
} else {
IncrementLine();
return SucceedRule(ParseSuccess);
}
}
protected object EndOfFile()
{
BeginRule();
Whitespace();
if( endOfInput ) {
return SucceedRule();
} else {
return FailRule();
}
}
// General purpose space, returns N-count newlines (fails if no newlines)
protected object MultilineWhitespace()
{
BeginRule();
List<object> newlines = OneOrMore(Newline);
if( newlines == null ) {
return FailRule();
}
// Use content field of Token to say how many newlines there were
// (in most circumstances it's unimportant)
int numNewlines = newlines.Count;
if (numNewlines >= 1) {
return SucceedRule ();
} else {
return FailRule ();
}
}
protected object Whitespace()
{
if( ParseCharactersFromCharSet(_inlineWhitespaceChars) != null ) {
return ParseSuccess;
}
return null;
}
private CharacterSet _inlineWhitespaceChars = new CharacterSet(" \t");
}
}
|
using System;
using System.Collections.Generic;
namespace Inklewriter
{
public partial class InkParser
{
// Automatically includes end of line comments due to newline
// Handles both newline and endOfFile
protected object EndOfLine()
{
BeginRule();
object newlineOrEndOfFile = OneOf(Newline, EndOfFile);
if( newlineOrEndOfFile == null ) {
return FailRule();
} else {
return SucceedRule(newlineOrEndOfFile);
}
}
// Automatically includes end of line comments
// However, you probably want "endOfLine", since it handles endOfFile too.
protected object Newline()
{
BeginRule();
// Optional whitespace and comment
Whitespace();
SingleLineComment();
// Optional \r, definite \n to support Windows (\r\n) and Mac/Unix (\n)
ParseString ("\r");
bool gotNewline = ParseString ("\n") != null;
if( !gotNewline ) {
return FailRule();
} else {
IncrementLine();
return SucceedRule(ParseSuccess);
}
}
protected object EndOfFile()
{
BeginRule();
// Optional whitespace and comment
Whitespace();
SingleLineComment();
if( endOfInput ) {
return SucceedRule();
} else {
return FailRule();
}
}
// You shouldn't need this in main rules since it's included in endOfLine
protected object SingleLineComment()
{
if( ParseString("//") == null ) {
return null;
}
ParseUntilCharactersFromCharSet(_newlineChars);
return ParseSuccess;
}
// General purpose space, returns N-count newlines (fails if no newlines)
protected object MultilineWhitespace()
{
BeginRule();
List<object> newlines = OneOrMore(Newline);
if( newlines == null ) {
return FailRule();
}
// Use content field of Token to say how many newlines there were
// (in most circumstances it's unimportant)
int numNewlines = newlines.Count;
if (numNewlines >= 1) {
return SucceedRule ();
} else {
return FailRule ();
}
}
protected object Whitespace()
{
if( ParseCharactersFromCharSet(_inlineWhitespaceChars) != null ) {
return ParseSuccess;
}
return null;
}
private CharacterSet _inlineWhitespaceChars = new CharacterSet(" \t");
private CharacterSet _newlineChars = new CharacterSet("\n\r");
}
}
|
mit
|
C#
|
6b119d1ea9a7e7340fcc3bcac7a7d79bf5ba7c05
|
Update Program.cs
|
BenMCOB/Morser
|
Morser/Program.cs
|
Morser/Program.cs
|
using System;
using System.Collections.Generic;
namespace Morser
{
public class Program
{
static void Main(string[] args)
{
List<bool> _binaryData = new List<bool>(0);
const int byteChunkSize = 1024*160;
// Get morse code data
string encryptedString = TextToMorse.GenerateCodedData();
// Convert back from Morse data
string finalText = MorseToText.ReadCodedData(encryptedString);
Console.WriteLine("Final texttt: {0}", finalText);
Console.ReadLine();
}
}
}
|
using System;
using System.Collections.Generic;
namespace Morser
{
public class Program
{
static void Main(string[] args)
{
List<bool> _binaryData = new List<bool>(0);
const int byteChunkSize = 1024*160;
// Get morse code data
string encryptedString = TextToMorse.GenerateCodedData();
// Convert back from Morse data
string finalText = MorseToText.ReadCodedData(encryptedString);
Console.WriteLine("Final text: {0}", finalText);
Console.ReadLine();
}
}
}
|
mit
|
C#
|
d644c9c9bdb183ba3c0ecfb3939923ae20a59e19
|
Remove unused usings.
|
FacilityApi/FacilityCSharp
|
tests/Facility.ConformanceApi.UnitTests/ConformanceTests.cs
|
tests/Facility.ConformanceApi.UnitTests/ConformanceTests.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Facility.ConformanceApi.Http;
using Facility.ConformanceApi.Testing;
using Facility.Core.Http;
using NUnit.Framework;
namespace Facility.ConformanceApi.UnitTests
{
public class ConformanceTests
{
[TestCaseSource(nameof(TestNames))]
public async Task RunTest(string test)
{
IConformanceApi getApiForTest(string testName)
{
return new HttpClientConformanceApi(
new HttpClientServiceSettings
{
BaseUri = new Uri("https://example.com/"),
Aspects = new[] { FacilityTestClientAspect.Create(testName) },
HttpClient = s_httpClient,
});
}
var result = await new ConformanceApiTester(s_testProvider, getApiForTest).RunTestAsync(test, CancellationToken.None).ConfigureAwait(false);
if (result.Status != ConformanceTestStatus.Pass)
Assert.Fail(result.Message);
}
private static IConformanceTestProvider CreateTestProvider() =>
new ConformanceTestProvider(Path.Combine(TestUtility.GetSolutionDirectory(), "conformance", "tests.json"));
private static HttpClient CreateHttpClient()
{
IConformanceApi getApiForRequest(HttpRequestMessage httpRequest)
{
string testName = httpRequest.Headers.TryGetValues(FacilityTestClientAspect.HeaderName, out var values) ? string.Join(",", values) : null;
return new ConformanceApiService(s_testProvider.TryGetTestInfo(testName));
}
var handler = new ConformanceApiHttpHandler(getApiForRequest, new ServiceHttpHandlerSettings()) { InnerHandler = new NotFoundHttpHandler() };
return new HttpClient(handler);
}
private sealed class NotFoundHttpHandler : HttpMessageHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) =>
Task.FromResult(new HttpResponseMessage(HttpStatusCode.NotFound));
}
private static readonly IConformanceTestProvider s_testProvider = CreateTestProvider();
private static IReadOnlyList<string> TestNames => s_testProvider.GetTestNames();
private static readonly HttpClient s_httpClient = CreateHttpClient();
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Facility.ConformanceApi.Http;
using Facility.ConformanceApi.Testing;
using Facility.Core.Http;
using NCrunch.Framework;
using NUnit.Framework;
using NUnit.Framework.Internal;
namespace Facility.ConformanceApi.UnitTests
{
public class ConformanceTests
{
[TestCaseSource(nameof(TestNames))]
public async Task RunTest(string test)
{
IConformanceApi getApiForTest(string testName)
{
return new HttpClientConformanceApi(
new HttpClientServiceSettings
{
BaseUri = new Uri("https://example.com/"),
Aspects = new[] { FacilityTestClientAspect.Create(testName) },
HttpClient = s_httpClient,
});
}
var result = await new ConformanceApiTester(s_testProvider, getApiForTest).RunTestAsync(test, CancellationToken.None).ConfigureAwait(false);
if (result.Status != ConformanceTestStatus.Pass)
Assert.Fail(result.Message);
}
private static IConformanceTestProvider CreateTestProvider() =>
new ConformanceTestProvider(Path.Combine(TestUtility.GetSolutionDirectory(), "conformance", "tests.json"));
private static HttpClient CreateHttpClient()
{
IConformanceApi getApiForRequest(HttpRequestMessage httpRequest)
{
string testName = httpRequest.Headers.TryGetValues(FacilityTestClientAspect.HeaderName, out var values) ? string.Join(",", values) : null;
return new ConformanceApiService(s_testProvider.TryGetTestInfo(testName));
}
var handler = new ConformanceApiHttpHandler(getApiForRequest, new ServiceHttpHandlerSettings()) { InnerHandler = new NotFoundHttpHandler() };
return new HttpClient(handler);
}
private sealed class NotFoundHttpHandler : HttpMessageHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) =>
Task.FromResult(new HttpResponseMessage(HttpStatusCode.NotFound));
}
private static readonly IConformanceTestProvider s_testProvider = CreateTestProvider();
private static IReadOnlyList<string> TestNames => s_testProvider.GetTestNames();
private static readonly HttpClient s_httpClient = CreateHttpClient();
}
}
|
mit
|
C#
|
7de7748607c236838b5151eabe1f760d5650220e
|
Remove unnecessary nullability
|
NeoAdonis/osu,johnneijzen/osu,ppy/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu-new,peppy/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,EVAST9919/osu,2yangk23/osu,NeoAdonis/osu,ppy/osu,ppy/osu,EVAST9919/osu,2yangk23/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu
|
osu.Game/Online/Chat/ExternalLinkOpener.cs
|
osu.Game/Online/Chat/ExternalLinkOpener.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.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Overlays;
using osu.Game.Overlays.Chat;
namespace osu.Game.Online.Chat
{
public class ExternalLinkOpener : Component
{
[Resolved]
private GameHost host { get; set; }
[Resolved(CanBeNull = true)]
private DialogOverlay dialogOverlay { get; set; }
private Bindable<bool> externalLinkWarning;
[BackgroundDependencyLoader(true)]
private void load(OsuConfigManager config)
{
externalLinkWarning = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning);
}
public void OpenUrlExternally(string url)
{
if (externalLinkWarning.Value)
dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url)));
else
host.OpenUrlExternally(url);
}
}
}
|
// 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.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Overlays;
using osu.Game.Overlays.Chat;
namespace osu.Game.Online.Chat
{
public class ExternalLinkOpener : Component
{
[Resolved(CanBeNull = true)]
private GameHost host { get; set; }
[Resolved(CanBeNull = true)]
private DialogOverlay dialogOverlay { get; set; }
private Bindable<bool> externalLinkWarning;
[BackgroundDependencyLoader(true)]
private void load(OsuConfigManager config)
{
externalLinkWarning = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning);
}
public void OpenUrlExternally(string url)
{
if (externalLinkWarning.Value)
dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url)));
else
host.OpenUrlExternally(url);
}
}
}
|
mit
|
C#
|
b41a5ab09ab4cada8122938d14ab0d02eda85ee9
|
Throw better exceptions.
|
JohanLarsson/Gu.Units
|
Gu.Units/Internals/Parsing/XmlExt.cs
|
Gu.Units/Internals/Parsing/XmlExt.cs
|
namespace Gu.Units
{
using System.Reflection;
using System.Xml;
internal static class XmlExt
{
internal static void SetReadonlyField<T>(ref T self, string fieldName, XmlReader reader, string attributeName)
where T : IQuantity
{
reader.MoveToContent();
var attribute = reader.GetAttribute(attributeName);
if (attribute == null)
{
throw new XmlException($"Could not find attribute named: {attributeName}");
}
var d = XmlConvert.ToDouble(attribute);
reader.ReadStartElement();
SetReadonlyField(ref self, fieldName, d);
}
private static void SetReadonlyField<T>(ref T self, string fieldName, double value)
where T : IQuantity
{
var fieldInfo = self.GetType()
.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
if (fieldInfo == null)
{
throw new XmlException($"Could not find field named: {fieldName}");
}
object boxed = self;
fieldInfo.SetValue(boxed, value);
self = (T)boxed;
}
internal static void WriteAttribute(XmlWriter writer, string name, double value)
{
writer.WriteStartAttribute(name);
writer.WriteValue(value);
writer.WriteEndAttribute();
}
}
}
|
namespace Gu.Units
{
using System.Reflection;
using System.Xml;
internal static class XmlExt
{
internal static void SetReadonlyField<T>(ref T self, string fieldName, XmlReader reader, string attributeName)
where T : IQuantity
{
reader.MoveToContent();
var d = XmlConvert.ToDouble(reader.GetAttribute(attributeName));
reader.ReadStartElement();
SetReadonlyField(ref self, fieldName, d);
}
private static void SetReadonlyField<T>(ref T self, string fieldName, double value)
where T : IQuantity
{
var fieldInfo = self.GetType()
.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
object boxed = self;
fieldInfo.SetValue(boxed, value);
self = (T)boxed;
}
internal static void WriteAttribute(XmlWriter writer, string name, double value)
{
writer.WriteStartAttribute(name);
writer.WriteValue(value);
writer.WriteEndAttribute();
}
}
}
|
mit
|
C#
|
6d10719b9ce281d7f1179cf7943cd553292d00e9
|
Fix comment in MssqlVersionProvider
|
canton7/Simple.Migrations,canton7/SimpleMigrations,canton7/SimpleMigrations,canton7/Simple.Migrations
|
src/Simple.Migrations/VersionProvider/MssqlVersionProvider.cs
|
src/Simple.Migrations/VersionProvider/MssqlVersionProvider.cs
|
namespace SimpleMigrations.VersionProvider
{
/// <summary>
/// Class which can read from / write to a version table in an MSSQL database
/// </summary>
public class MssqlVersionProvider : VersionProviderBase
{
/// <summary>
/// Gets or sets the name of the table to use. Defaults to 'VersionInfo'
/// </summary>
public string TableName { get; set; } = DefaultTableName;
/// <summary>
/// Returns SQL to create the version table
/// </summary>
/// <returns>SQL to create the version table</returns>
public override string GetCreateVersionTableSql()
{
return $@"IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[{this.TableName}]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[{this.TableName}](
[Id] [int] IDENTITY(1,1) PRIMARY KEY NOT NULL,
[Version] [int] NOT NULL,
[AppliedOn] [datetime] NOT NULL,
[Description] [nvarchar](128) NOT NULL,
)
END;";
}
/// <summary>
/// Returns SQL to fetch the current version from the version table
/// </summary>
/// <returns>SQL to fetch the current version from the version table</returns>
public override string GetCurrentVersionSql()
{
return $@"SELECT TOP 1 [Version] FROM [dbo].[{this.TableName}] ORDER BY [Id] desc;";
}
/// <summary>
/// Returns SQL to update the current version in the version table
/// </summary>
/// <returns>SQL to update the current version in the version table</returns>
public override string GetSetVersionSql()
{
return $@"INSERT INTO [dbo].[{this.TableName}] ([Version], [AppliedOn], [Description]) VALUES (@Version, GETDATE(), @Description);";
}
}
}
|
namespace SimpleMigrations.VersionProvider
{
/// <summary>
/// Class which can read from / write to a version table in an SQLite database
/// </summary>
public class MssqlVersionProvider : VersionProviderBase
{
/// <summary>
/// Gets or sets the name of the table to use. Defaults to 'VersionInfo'
/// </summary>
public string TableName { get; set; } = DefaultTableName;
/// <summary>
/// Returns SQL to create the version table
/// </summary>
/// <returns>SQL to create the version table</returns>
public override string GetCreateVersionTableSql()
{
return $@"IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[{this.TableName}]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[{this.TableName}](
[Id] [int] IDENTITY(1,1) PRIMARY KEY NOT NULL,
[Version] [int] NOT NULL,
[AppliedOn] [datetime] NOT NULL,
[Description] [nvarchar](128) NOT NULL,
)
END;";
}
/// <summary>
/// Returns SQL to fetch the current version from the version table
/// </summary>
/// <returns>SQL to fetch the current version from the version table</returns>
public override string GetCurrentVersionSql()
{
return $@"SELECT TOP 1 [Version] FROM [dbo].[{this.TableName}] ORDER BY [Id] desc;";
}
/// <summary>
/// Returns SQL to update the current version in the version table
/// </summary>
/// <returns>SQL to update the current version in the version table</returns>
public override string GetSetVersionSql()
{
return $@"INSERT INTO [dbo].[{this.TableName}] ([Version], [AppliedOn], [Description]) VALUES (@Version, GETDATE(), @Description);";
}
}
}
|
mit
|
C#
|
f43e523c1a082eede8f1b991cad21caa168d8970
|
Update index.cshtml
|
KovalNikita/apmathcloud
|
SITE/index.cshtml
|
SITE/index.cshtml
|
@{
var txt = DateTime.Now; // C#
int m = 1;
int b = 1;
double t_0 = 1;
double t_end = 100;
double z_0 = 0;
double z_d = 10;
double t1 = t_0;
double t2 = t_end;
double h = 0.1;
double width = 0.05;
var amplitudeRequest = Request.Params["amplitude"];
var amplitudeValue = 1;
var clear = int.TryParse(amplitudeRequest, out amplitudeValue);
var errorMssage = "no amplitude provided, please input http://apmath4oj.azurewebsites.net/mem.cshtml?amplitude=5";
}
<html>
<head>
<meta charset="utf-8">
<script src="./mathbox-bundle.min.js"></script>
<title>MathBox Test</title>
</head>
<body>
<script type="text/javascript">
@if(!clear){
Response.Write(String.Format("alert({0});", errorMssage));
}
mathbox = mathBox({
plugins: ['core', 'controls', 'cursor'],
controls: {
klass: THREE.OrbitControls
},
});
three = mathbox.three;
three.camera.position.set(3.5, 1.4, -2.3);
three.renderer.setClearColor(new THREE.Color(0x204060), 1.0);
time = 0
three.on('update', function () {
clock = three.Time.clock
time = clock / 4
});
view = mathbox
.unit({
scale: 720,
})
.cartesian({
range: [[-3, 3], [0, 6], [-3, 3]],
scale: [2, 2, 2],
});
view.axis({ axis: 1, width: 15 });
view.axis({ axis: 2, width: 15 });
view.axis({ axis: 3, width: 15 });
view.grid({
width: 5,
opacity: 0.5,
axes: [1, 3],
});
view.area({
id: 'sampler',
width: 83,
height: 83,
axes: [1, 3],
expr: function (emit, x, y, i, j) {
emit(x, 3 * (.5 + .5 * (Math.sin(x*@amplitudeValue + time) * Math.sin(y/@amplitudeValue + time))), y);
},
channels: 3,
});
view.surface({
lineX: true,
lineY: true,
shaded: true,
color: 0x5090FF,
width: 5,
});
surface = mathbox.select('surface')
</script>
</body>
</html>
|
@{
double [] Solver(double []T,int n)
{
double [] X = new double [n];
return X;
}
var txt = DateTime.Now; // C#
int m = 1;
int b = 1;
double t_0 = 1;
double t_end = 100;
double z_0 = 0;
double z_d = 10;
double t1 = t_0;
double t2 = t_end;
double h = 0.1;
double width = 0.05;
var amplitudeRequest = Request.Params["amplitude"];
var amplitudeValue = 1;
var clear = int.TryParse(amplitudeRequest, out amplitudeValue);
var errorMssage = "no amplitude provided, please input http://apmath4oj.azurewebsites.net/mem.cshtml?amplitude=5";
}
<html>
<head>
<meta charset="utf-8">
<script src="./mathbox-bundle.min.js"></script>
<title>MathBox Test</title>
</head>
<body>
<script type="text/javascript">
@if(!clear){
Response.Write(String.Format("alert({0});", errorMssage));
}
mathbox = mathBox({
plugins: ['core', 'controls', 'cursor'],
controls: {
klass: THREE.OrbitControls
},
});
three = mathbox.three;
three.camera.position.set(3.5, 1.4, -2.3);
three.renderer.setClearColor(new THREE.Color(0x204060), 1.0);
time = 0
three.on('update', function () {
clock = three.Time.clock
time = clock / 4
});
view = mathbox
.unit({
scale: 720,
})
.cartesian({
range: [[-3, 3], [0, 6], [-3, 3]],
scale: [2, 2, 2],
});
view.axis({ axis: 1, width: 15 });
view.axis({ axis: 2, width: 15 });
view.axis({ axis: 3, width: 15 });
view.grid({
width: 5,
opacity: 0.5,
axes: [1, 3],
});
view.area({
id: 'sampler',
width: 83,
height: 83,
axes: [1, 3],
expr: function (emit, x, y, i, j) {
emit(x, 3 * (.5 + .5 * (Math.sin(x*@amplitudeValue + time) * Math.sin(y/@amplitudeValue + time))), y);
},
channels: 3,
});
view.surface({
lineX: true,
lineY: true,
shaded: true,
color: 0x5090FF,
width: 5,
});
surface = mathbox.select('surface')
</script>
</body>
</html>
|
mit
|
C#
|
f3ca835c75131901148902fad3a0077113c603e1
|
Fix error
|
wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D
|
src/Core2D.Serializer.Xaml/XamlConstants.cs
|
src/Core2D.Serializer.Xaml/XamlConstants.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Core2D.Serializer.Xaml
{
public static class XamlConstants
{
public const string CoreNamespace = "https://github.com/wieslawsoltes/Core2D";
public const string EditorNamespace = "https://github.com/wieslawsoltes/Core2D.Editor";
public const string DockNamespace = "https://github.com/wieslawsoltes/Dock.Model";
public const string SpatialNamespace = "https://github.com/wieslawsoltes/Math.Spatial";
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Core2D.Serializer.Xaml
{
public static class XamlConstants
{
public const string CoreNamespace = "https://github.com/wieslawsoltes/Core2D";
public const string EditorNamespace = "https://github.com/wieslawsoltes/Core2D.Editor";
public const string DockNamespace = "https://github.com/wieslawsoltes/Dock.Model;
public const string SpatialNamespace = "https://github.com/wieslawsoltes/Math.Spatial";
}
}
|
mit
|
C#
|
9bb82bd15788b7683d12dc19abc2e10056b29610
|
Update unit tests
|
StefanBertels/language-ext,StanJav/language-ext,louthy/language-ext
|
LanguageExt.Tests/TypeClassMonoid.cs
|
LanguageExt.Tests/TypeClassMonoid.cs
|
using Xunit;
using System.Linq;
using LanguageExt.TypeClasses;
using LanguageExt.Instances;
using static LanguageExt.Prelude;
using static LanguageExt.TypeClass;
using LanguageExt;
namespace LanguageExtTests
{
public class TypeClassMonoid
{
[Fact]
public void IntMonoid()
{
var res = mconcat<TInt, int>(1, 2, 3, 4, 5);
Assert.True(res == 15);
}
[Fact]
public void ListMonoid()
{
var res = mconcat<TLst<int>, Lst<int>>(List(1, 2, 3), List(4, 5));
Assert.True(res.Sum() == 15 && res.Count == 5);
}
[Fact]
public void StringMonad()
{
var res = mconcat<TString, string>("mary ", "had ", "a ", "little ", "lamb");
Assert.True(res == "mary had a little lamb");
}
}
}
|
using Xunit;
using System.Linq;
using LanguageExt.TypeClasses;
using LanguageExt.Instances;
using static LanguageExt.Prelude;
using static LanguageExt.TypeClass;
using LanguageExt;
namespace LanguageExtTests
{
public class TypeClassMonoid
{
[Fact]
public void IntMonoid()
{
var res = mconcat<TInt, int>(1, 2, 3, 4, 5);
Assert.True(res == 15);
}
[Fact]
public void ListMonoid()
{
var res = mconcat<TLst<int>, Lst<int>>(List(1, 2, 3, 4, 5));
Assert.True(res.Sum() == 15 && res.Count == 5);
}
[Fact]
public void StringMonad()
{
var res = mconcat<TString, string>("mary ", "had ", "a ", "little ", "lamb");
Assert.True(res == "mary had a little lamb");
}
}
}
|
mit
|
C#
|
8a6841e34b93ef6375f1fc33da5e0bdd253f7bf4
|
Update WebSocketClient base class to support IJsonProvider
|
sonvister/Binance
|
src/Binance/WebSocket/WebSocketClient.cs
|
src/Binance/WebSocket/WebSocketClient.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace Binance.WebSocket
{
public abstract class WebSocketClient : JsonProvider, IWebSocketClient
{
#region Public Events
public event EventHandler<EventArgs> Open;
public event EventHandler<EventArgs> Close;
#endregion Public Events
#region Public Properties
public bool IsStreaming { get; protected set; }
#endregion Public Properties
#region Constructors
/// <summary>
/// Constructor.
/// </summary>
/// <param name="logger"></param>
protected WebSocketClient(ILogger<WebSocketClient> logger = null)
: base(logger)
{ }
#endregion Constructors
#region Public Methods
public abstract Task StreamAsync(Uri uri, CancellationToken token);
#endregion Public Methods
#region Protected Methods
/// <summary>
/// Raise open event.
/// </summary>
protected void RaiseOpenEvent()
{
try { Open?.Invoke(this, EventArgs.Empty); }
catch (OperationCanceledException) { }
catch (Exception e)
{
Logger?.LogError(e, $"{GetType().Name}: Unhandled {nameof(Open)} event handler exception.");
}
}
/// <summary>
/// Raise close event.
/// </summary>
protected void RaiseCloseEvent()
{
try { Close?.Invoke(this, EventArgs.Empty); }
catch (OperationCanceledException) { }
catch (Exception e)
{
Logger?.LogError(e, $"{GetType().Name}: Unhandled {nameof(Close)} event handler exception.");
}
}
#endregion Protected Methods
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Binance.WebSocket.Events;
using Microsoft.Extensions.Logging;
namespace Binance.WebSocket
{
public abstract class WebSocketClient : IWebSocketClient
{
#region Public Events
public event EventHandler<EventArgs> Open;
public event EventHandler<WebSocketClientEventArgs> Message;
public event EventHandler<EventArgs> Close;
#endregion Public Events
#region Public Properties
public bool IsStreaming { get; protected set; }
#endregion Public Properties
#region Protected Fields
protected readonly ILogger<WebSocketClient> Logger;
#endregion Protected Fields
#region Constructors
/// <summary>
/// Constructor.
/// </summary>
/// <param name="logger"></param>
protected WebSocketClient(ILogger<WebSocketClient> logger = null)
{
Logger = logger;
}
#endregion Constructors
#region Public Methods
public abstract Task StreamAsync(Uri uri, CancellationToken token);
#endregion Public Methods
#region Protected Methods
/// <summary>
/// Raise open event.
/// </summary>
protected void RaiseOpenEvent()
{
try { Open?.Invoke(this, EventArgs.Empty); }
catch (OperationCanceledException) { }
catch (Exception e)
{
Logger?.LogError(e, $"{GetType().Name}: Unhandled open event handler exception.");
}
}
/// <summary>
/// Raise message event.
/// </summary>
/// <param name="args"></param>
protected void RaiseMessageEvent(WebSocketClientEventArgs args)
{
try { Message?.Invoke(this, args); }
catch (OperationCanceledException) { }
catch (Exception e)
{
Logger?.LogError(e, $"{GetType().Name}: Unhandled message event handler exception.");
}
}
/// <summary>
/// Raise close event.
/// </summary>
protected void RaiseCloseEvent()
{
try { Close?.Invoke(this, EventArgs.Empty); }
catch (OperationCanceledException) { }
catch (Exception e)
{
Logger?.LogError(e, $"{GetType().Name}: Unhandled close event handler exception.");
}
}
#endregion Protected Methods
}
}
|
mit
|
C#
|
bb5811849e652546150a8d22beb5c949a02d779f
|
fix tostring indentation of stacktrace
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/CrashReporter/Models/SerializedException.cs
|
WalletWasabi.Gui/CrashReporter/Models/SerializedException.cs
|
using System;
using System.Collections.Generic;
using WalletWasabi.Helpers;
namespace WalletWasabi.Gui.CrashReporter.Models
{
[Serializable]
public class SerializedException
{
public string ExceptionType { get; set; }
public string Message { get; set; }
public string StackTrace { get; set; }
public SerializedException InnerException { get; set; }
public SerializedException()
{
}
public SerializedException(Exception ex)
{
if (ex.InnerException != null)
{
InnerException = new SerializedException(ex.InnerException);
}
ExceptionType = ex.GetType().FullName;
Message = ex.Message;
StackTrace = ex.StackTrace;
}
public override string ToString()
{
return ToStringCore();
}
internal string ToStringCore(int tabLevel = 0)
{
var sb = new System.Text.StringBuilder();
if (!string.IsNullOrEmpty(ExceptionType))
{
sb.Append(Tabs(tabLevel));
sb.Append("ExceptionType: ");
sb.AppendLine(ExceptionType);
}
if (!string.IsNullOrEmpty(Message))
{
sb.Append(Tabs(tabLevel));
sb.Append("Message: ");
sb.AppendLine(Message);
}
if (!string.IsNullOrEmpty(StackTrace))
{
var header = "StackTrace: ";
sb.Append(Tabs(tabLevel));
sb.Append(header);
sb.Append(Tabs(tabLevel));
sb.AppendLine(MultiLineTabs(tabLevel, StackTrace, header.Length));
}
if (InnerException != null)
{
var header = "InnerException: ";
sb.Append(Tabs(tabLevel));
sb.Append(header);
sb.Append(Tabs(tabLevel + 1));
sb.AppendLine(MultiLineTabs(tabLevel + 1, InnerException.ToString(), header.Length));
}
return sb.ToString();
}
internal string MultiLineTabs(int n, string t, int addedPadding = 0)
{
int i = 0;
var sb = new System.Text.StringBuilder();
foreach (var line in t.Split(Environment.NewLine))
{
switch (i)
{
case 0:
sb.AppendLine(line);
break;
default:
var padding = new string(' ', addedPadding);
sb.AppendLine($"{padding}{Tabs(n)}{line}");
break;
}
i++;
}
return sb.ToString();
}
internal string Tabs(int n)
{
return n == 0 ? string.Empty : new string(' ', n * 4);
}
}
}
|
using System;
using System.Collections.Generic;
using WalletWasabi.Helpers;
namespace WalletWasabi.Gui.CrashReporter.Models
{
[Serializable]
public class SerializedException
{
public string ExceptionType { get; set; }
public string Message { get; set; }
public string StackTrace { get; set; }
public SerializedException InnerException { get; set; }
public SerializedException()
{
}
public SerializedException(Exception ex)
{
if (ex.InnerException != null)
{
InnerException = new SerializedException(ex.InnerException);
}
ExceptionType = ex.GetType().FullName;
Message = ex.Message;
StackTrace = ex.StackTrace;
}
public override string ToString()
{
return ToStringCore();
}
internal string ToStringCore(int tabLevel = 0)
{
var sb = new System.Text.StringBuilder();
if (!string.IsNullOrEmpty(ExceptionType))
{
sb.Append(Tabs(tabLevel));
sb.Append("ExceptionType: ");
sb.AppendLine(ExceptionType);
}
if (!string.IsNullOrEmpty(Message))
{
sb.Append(Tabs(tabLevel));
sb.Append("Message: ");
sb.AppendLine(Message);
}
if (!string.IsNullOrEmpty(StackTrace))
{
sb.Append(Tabs(tabLevel));
sb.Append("StackTrace: ");
sb.Append(Tabs(tabLevel));
sb.AppendLine(MultiLineTabs(tabLevel, StackTrace));
}
if (InnerException != null)
{
var header = "InnerException: ";
sb.Append(Tabs(tabLevel));
sb.Append(header);
sb.Append(Tabs(tabLevel+1));
sb.AppendLine(MultiLineTabs(tabLevel + 1, InnerException.ToString(), header.Length));
}
return sb.ToString();
}
internal string MultiLineTabs(int n, string t, int addedPadding = 0)
{
int i = 0;
var sb = new System.Text.StringBuilder();
foreach (var line in t.Split(Environment.NewLine))
{
switch (i)
{
case 0:
sb.AppendLine(line);
break;
default:
var padding = new string(' ', addedPadding);
sb.AppendLine($"{padding}{Tabs(n)}{line}");
break;
}
i++;
}
return sb.ToString();
}
internal string Tabs(int n)
{
return n == 0 ? string.Empty : new string(' ', n * 4);
}
}
}
|
mit
|
C#
|
fe7b2c686cceb10c94424150a39f89455225f37c
|
Improve xmldoc
|
peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework
|
osu.Framework/Input/TouchEventManager.cs
|
osu.Framework/Input/TouchEventManager.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.Collections.Generic;
using System.Diagnostics;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osuTK;
namespace osu.Framework.Input
{
/// <summary>
/// A manager that manages states and events for a single touch.
/// </summary>
public class TouchEventManager : ButtonEventManager<TouchSource>
{
protected Vector2? TouchDownPosition;
/// <summary>
/// The drawable from the input queue that handled a <see cref="TouchDownEvent"/> corresponding to this touch source.
/// </summary>
public Drawable HeldDrawable { get; private set; }
public TouchEventManager(TouchSource source)
: base(source)
{
}
public void HandlePositionChange(InputState state, Vector2 lastPosition)
{
handleTouchMove(state, state.Touch.TouchPositions[(int)Button], lastPosition);
}
private void handleTouchMove(InputState state, Vector2 position, Vector2 lastPosition)
{
PropagateButtonEvent(ButtonDownInputQueue, new TouchMoveEvent(state, new Touch(Button, position), TouchDownPosition, lastPosition));
}
protected override Drawable HandleButtonDown(InputState state, List<Drawable> targets)
{
Debug.Assert(HeldDrawable == null);
Debug.Assert(TouchDownPosition == null);
TouchDownPosition = state.Touch.GetTouchPosition(Button);
Debug.Assert(TouchDownPosition != null);
return HeldDrawable = PropagateButtonEvent(targets, new TouchDownEvent(state, new Touch(Button, (Vector2)TouchDownPosition)));
}
protected override void HandleButtonUp(InputState state, List<Drawable> targets)
{
var currentPosition = state.Touch.TouchPositions[(int)Button];
PropagateButtonEvent(targets, new TouchUpEvent(state, new Touch(Button, currentPosition), TouchDownPosition));
HeldDrawable = null;
TouchDownPosition = null;
}
}
}
|
// 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.Collections.Generic;
using System.Diagnostics;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osuTK;
namespace osu.Framework.Input
{
/// <summary>
/// A manager that manages states and events for a single touch.
/// </summary>
public class TouchEventManager : ButtonEventManager<TouchSource>
{
protected Vector2? TouchDownPosition;
/// <summary>
/// The drawable from the input queue that handled a <see cref="TouchEvent"/> corresponding to this touch source.
/// Null when no drawable has handled a touch event or the touch is not yet active / has been deactivated.
/// </summary>
public Drawable HeldDrawable { get; private set; }
public TouchEventManager(TouchSource source)
: base(source)
{
}
public void HandlePositionChange(InputState state, Vector2 lastPosition)
{
handleTouchMove(state, state.Touch.TouchPositions[(int)Button], lastPosition);
}
private void handleTouchMove(InputState state, Vector2 position, Vector2 lastPosition)
{
PropagateButtonEvent(ButtonDownInputQueue, new TouchMoveEvent(state, new Touch(Button, position), TouchDownPosition, lastPosition));
}
protected override Drawable HandleButtonDown(InputState state, List<Drawable> targets)
{
Debug.Assert(HeldDrawable == null);
Debug.Assert(TouchDownPosition == null);
TouchDownPosition = state.Touch.GetTouchPosition(Button);
Debug.Assert(TouchDownPosition != null);
return HeldDrawable = PropagateButtonEvent(targets, new TouchDownEvent(state, new Touch(Button, (Vector2)TouchDownPosition)));
}
protected override void HandleButtonUp(InputState state, List<Drawable> targets)
{
var currentPosition = state.Touch.TouchPositions[(int)Button];
PropagateButtonEvent(targets, new TouchUpEvent(state, new Touch(Button, currentPosition), TouchDownPosition));
HeldDrawable = null;
TouchDownPosition = null;
}
}
}
|
mit
|
C#
|
90d69c121625ddc69e88b5a232e7c4f6afa51076
|
Allow legacy score to be constructed even if replay file is missing
|
peppy/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu
|
osu.Game/Scoring/LegacyDatabasedScore.cs
|
osu.Game/Scoring/LegacyDatabasedScore.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using osu.Framework.IO.Stores;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Scoring.Legacy;
namespace osu.Game.Scoring
{
public class LegacyDatabasedScore : Score
{
public LegacyDatabasedScore(ScoreInfo score, RulesetStore rulesets, BeatmapManager beatmaps, IResourceStore<byte[]> store)
{
ScoreInfo = score;
var replayFilename = score.Files.FirstOrDefault(f => f.Filename.EndsWith(".osr", StringComparison.InvariantCultureIgnoreCase))?.FileInfo.StoragePath;
if (replayFilename == null)
return;
using (var stream = store.GetStream(replayFilename))
Replay = new DatabasedLegacyScoreDecoder(rulesets, beatmaps).Parse(stream).Replay;
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using osu.Framework.IO.Stores;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Scoring.Legacy;
namespace osu.Game.Scoring
{
public class LegacyDatabasedScore : Score
{
public LegacyDatabasedScore(ScoreInfo score, RulesetStore rulesets, BeatmapManager beatmaps, IResourceStore<byte[]> store)
{
ScoreInfo = score;
var replayFilename = score.Files.First(f => f.Filename.EndsWith(".osr", StringComparison.InvariantCultureIgnoreCase)).FileInfo.StoragePath;
using (var stream = store.GetStream(replayFilename))
Replay = new DatabasedLegacyScoreDecoder(rulesets, beatmaps).Parse(stream).Replay;
}
}
}
|
mit
|
C#
|
6c76473636b095487b7c05eda4d553bdc4e97e3d
|
Revert "Switch off the default diagnostic provider"
|
nicklv/Nancy,damianh/Nancy,tparnell8/Nancy,Novakov/Nancy,tareq-s/Nancy,asbjornu/Nancy,ccellar/Nancy,adamhathcock/Nancy,duszekmestre/Nancy,jonathanfoster/Nancy,duszekmestre/Nancy,jonathanfoster/Nancy,fly19890211/Nancy,wtilton/Nancy,jchannon/Nancy,jmptrader/Nancy,dbolkensteyn/Nancy,sadiqhirani/Nancy,AIexandr/Nancy,sroylance/Nancy,ayoung/Nancy,daniellor/Nancy,VQComms/Nancy,phillip-haydon/Nancy,AIexandr/Nancy,NancyFx/Nancy,jonathanfoster/Nancy,jchannon/Nancy,Novakov/Nancy,xt0rted/Nancy,ccellar/Nancy,AIexandr/Nancy,sadiqhirani/Nancy,sroylance/Nancy,thecodejunkie/Nancy,jongleur1983/Nancy,jongleur1983/Nancy,ccellar/Nancy,sadiqhirani/Nancy,AlexPuiu/Nancy,davidallyoung/Nancy,thecodejunkie/Nancy,lijunle/Nancy,khellang/Nancy,anton-gogolev/Nancy,tareq-s/Nancy,JoeStead/Nancy,xt0rted/Nancy,damianh/Nancy,MetSystem/Nancy,hitesh97/Nancy,joebuschmann/Nancy,dbolkensteyn/Nancy,adamhathcock/Nancy,MetSystem/Nancy,malikdiarra/Nancy,sroylance/Nancy,jeff-pang/Nancy,malikdiarra/Nancy,dbabox/Nancy,nicklv/Nancy,VQComms/Nancy,vladlopes/Nancy,felipeleusin/Nancy,albertjan/Nancy,SaveTrees/Nancy,davidallyoung/Nancy,charleypeng/Nancy,AcklenAvenue/Nancy,daniellor/Nancy,hitesh97/Nancy,albertjan/Nancy,daniellor/Nancy,rudygt/Nancy,AlexPuiu/Nancy,sloncho/Nancy,asbjornu/Nancy,grumpydev/Nancy,EliotJones/NancyTest,dbolkensteyn/Nancy,wtilton/Nancy,horsdal/Nancy,jmptrader/Nancy,joebuschmann/Nancy,joebuschmann/Nancy,khellang/Nancy,xt0rted/Nancy,AlexPuiu/Nancy,nicklv/Nancy,sadiqhirani/Nancy,rudygt/Nancy,tsdl2013/Nancy,fly19890211/Nancy,guodf/Nancy,SaveTrees/Nancy,danbarua/Nancy,fly19890211/Nancy,rudygt/Nancy,ayoung/Nancy,guodf/Nancy,SaveTrees/Nancy,sloncho/Nancy,xt0rted/Nancy,davidallyoung/Nancy,VQComms/Nancy,charleypeng/Nancy,charleypeng/Nancy,AcklenAvenue/Nancy,AlexPuiu/Nancy,Worthaboutapig/Nancy,hitesh97/Nancy,AcklenAvenue/Nancy,EliotJones/NancyTest,kekekeks/Nancy,jmptrader/Nancy,cgourlay/Nancy,anton-gogolev/Nancy,wtilton/Nancy,sloncho/Nancy,dbolkensteyn/Nancy,kekekeks/Nancy,asbjornu/Nancy,blairconrad/Nancy,MetSystem/Nancy,Crisfole/Nancy,Novakov/Nancy,felipeleusin/Nancy,tsdl2013/Nancy,sloncho/Nancy,felipeleusin/Nancy,jchannon/Nancy,lijunle/Nancy,duszekmestre/Nancy,asbjornu/Nancy,adamhathcock/Nancy,dbabox/Nancy,jeff-pang/Nancy,NancyFx/Nancy,murador/Nancy,tparnell8/Nancy,adamhathcock/Nancy,anton-gogolev/Nancy,murador/Nancy,NancyFx/Nancy,lijunle/Nancy,EIrwin/Nancy,MetSystem/Nancy,ayoung/Nancy,thecodejunkie/Nancy,jchannon/Nancy,danbarua/Nancy,horsdal/Nancy,jeff-pang/Nancy,davidallyoung/Nancy,EliotJones/NancyTest,davidallyoung/Nancy,guodf/Nancy,tsdl2013/Nancy,VQComms/Nancy,hitesh97/Nancy,lijunle/Nancy,Crisfole/Nancy,danbarua/Nancy,guodf/Nancy,phillip-haydon/Nancy,grumpydev/Nancy,dbabox/Nancy,NancyFx/Nancy,fly19890211/Nancy,jchannon/Nancy,khellang/Nancy,grumpydev/Nancy,kekekeks/Nancy,Novakov/Nancy,malikdiarra/Nancy,tsdl2013/Nancy,EIrwin/Nancy,jmptrader/Nancy,horsdal/Nancy,VQComms/Nancy,grumpydev/Nancy,duszekmestre/Nancy,malikdiarra/Nancy,EIrwin/Nancy,jonathanfoster/Nancy,tparnell8/Nancy,khellang/Nancy,tareq-s/Nancy,tareq-s/Nancy,danbarua/Nancy,vladlopes/Nancy,Worthaboutapig/Nancy,rudygt/Nancy,felipeleusin/Nancy,dbabox/Nancy,Crisfole/Nancy,blairconrad/Nancy,EIrwin/Nancy,charleypeng/Nancy,tparnell8/Nancy,vladlopes/Nancy,vladlopes/Nancy,AcklenAvenue/Nancy,JoeStead/Nancy,EliotJones/NancyTest,albertjan/Nancy,phillip-haydon/Nancy,cgourlay/Nancy,Worthaboutapig/Nancy,horsdal/Nancy,albertjan/Nancy,wtilton/Nancy,anton-gogolev/Nancy,jongleur1983/Nancy,SaveTrees/Nancy,blairconrad/Nancy,cgourlay/Nancy,blairconrad/Nancy,murador/Nancy,ccellar/Nancy,thecodejunkie/Nancy,jongleur1983/Nancy,murador/Nancy,charleypeng/Nancy,daniellor/Nancy,AIexandr/Nancy,damianh/Nancy,JoeStead/Nancy,AIexandr/Nancy,phillip-haydon/Nancy,joebuschmann/Nancy,nicklv/Nancy,ayoung/Nancy,cgourlay/Nancy,JoeStead/Nancy,jeff-pang/Nancy,Worthaboutapig/Nancy,asbjornu/Nancy,sroylance/Nancy
|
src/Nancy/Diagnostics/DefaultDiagnostics.cs
|
src/Nancy/Diagnostics/DefaultDiagnostics.cs
|
namespace Nancy.Diagnostics
{
using System.Collections.Generic;
using ModelBinding;
using Nancy.Bootstrapper;
using Responses.Negotiation;
using Nancy.Culture;
/// <summary>
/// Wires up the diagnostics support at application startup.
/// </summary>
public class DefaultDiagnostics : IDiagnostics
{
private readonly DiagnosticsConfiguration diagnosticsConfiguration;
private readonly IEnumerable<IDiagnosticsProvider> diagnosticProviders;
private readonly IRootPathProvider rootPathProvider;
private readonly IEnumerable<ISerializer> serializers;
private readonly IRequestTracing requestTracing;
private readonly NancyInternalConfiguration configuration;
private readonly IModelBinderLocator modelBinderLocator;
private readonly IEnumerable<IResponseProcessor> responseProcessors;
private readonly ICultureService cultureService;
public DefaultDiagnostics(DiagnosticsConfiguration diagnosticsConfiguration, IEnumerable<IDiagnosticsProvider> diagnosticProviders, IRootPathProvider rootPathProvider, IEnumerable<ISerializer> serializers, IRequestTracing requestTracing, NancyInternalConfiguration configuration, IModelBinderLocator modelBinderLocator, IEnumerable<IResponseProcessor> responseProcessors, ICultureService cultureService)
{
this.diagnosticsConfiguration = diagnosticsConfiguration;
this.diagnosticProviders = diagnosticProviders;
this.rootPathProvider = rootPathProvider;
this.serializers = serializers;
this.requestTracing = requestTracing;
this.configuration = configuration;
this.modelBinderLocator = modelBinderLocator;
this.responseProcessors = responseProcessors;
this.cultureService = cultureService;
}
/// <summary>
/// Initialise diagnostics
/// </summary>
/// <param name="pipelines">Application pipelines</param>
public void Initialize(IPipelines pipelines)
{
DiagnosticsHook.Enable(this.diagnosticsConfiguration, pipelines, this.diagnosticProviders, this.rootPathProvider, this.serializers, this.requestTracing, this.configuration, this.modelBinderLocator, this.responseProcessors, this.cultureService);
}
}
}
|
namespace Nancy.Diagnostics
{
using System.Collections.Generic;
using System.Linq;
using ModelBinding;
using Nancy.Bootstrapper;
using Responses.Negotiation;
using Nancy.Culture;
/// <summary>
/// Wires up the diagnostics support at application startup.
/// </summary>
public class DefaultDiagnostics : IDiagnostics
{
private readonly DiagnosticsConfiguration diagnosticsConfiguration;
private readonly IEnumerable<IDiagnosticsProvider> diagnosticProviders;
private readonly IRootPathProvider rootPathProvider;
private readonly IEnumerable<ISerializer> serializers;
private readonly IRequestTracing requestTracing;
private readonly NancyInternalConfiguration configuration;
private readonly IModelBinderLocator modelBinderLocator;
private readonly IEnumerable<IResponseProcessor> responseProcessors;
private readonly ICultureService cultureService;
public DefaultDiagnostics(DiagnosticsConfiguration diagnosticsConfiguration, IEnumerable<IDiagnosticsProvider> diagnosticProviders, IRootPathProvider rootPathProvider, IEnumerable<ISerializer> serializers, IRequestTracing requestTracing, NancyInternalConfiguration configuration, IModelBinderLocator modelBinderLocator, IEnumerable<IResponseProcessor> responseProcessors, ICultureService cultureService)
{
this.diagnosticsConfiguration = diagnosticsConfiguration;
this.rootPathProvider = rootPathProvider;
this.serializers = serializers;
this.requestTracing = requestTracing;
this.configuration = configuration;
this.modelBinderLocator = modelBinderLocator;
this.responseProcessors = responseProcessors;
this.cultureService = cultureService;
if (diagnosticProviders.Count() > 2)
{
this.diagnosticProviders = diagnosticProviders.Where(diagProv => diagProv.GetType() != typeof(Nancy.Diagnostics.TestingDiagnosticProvider));
}
else
{
this.diagnosticProviders = diagnosticProviders;
}
}
/// <summary>
/// Initialise diagnostics
/// </summary>
/// <param name="pipelines">Application pipelines</param>
public void Initialize(IPipelines pipelines)
{
DiagnosticsHook.Enable(this.diagnosticsConfiguration, pipelines, this.diagnosticProviders, this.rootPathProvider, this.serializers, this.requestTracing, this.configuration, this.modelBinderLocator, this.responseProcessors, this.cultureService);
}
}
}
|
mit
|
C#
|
be8eb25136821ced46de5796c1a961266e3b3979
|
Add endpoint to get all instances
|
mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard
|
src/Okanshi.Dashboard/DashboardModule.cs
|
src/Okanshi.Dashboard/DashboardModule.cs
|
using Nancy;
using Okanshi.Dashboard.Models;
namespace Okanshi.Dashboard
{
public class DashboardModule : NancyModule
{
private readonly IGetHealthChecks _getHealthChecks;
public DashboardModule(IConfiguration configuration, IGetMetrics getMetrics, IGetHealthChecks getHealthChecks)
{
_getHealthChecks = getHealthChecks;
Get["/"] = p => View["index.html", configuration.GetAll()];
Get["/instances/{instanceName}"] = p =>
{
string instanceName = p.instanceName.ToString();
var service = new Service { Metrics = getMetrics.Execute(instanceName), HealthChecks = _getHealthChecks.Execute(instanceName) };
return Response.AsJson(service);
};
Get["/instances"] = _ => Response.AsJson(configuration.GetAll());
}
}
}
|
using Nancy;
using Okanshi.Dashboard.Models;
namespace Okanshi.Dashboard
{
public class DashboardModule : NancyModule
{
private readonly IGetHealthChecks _getHealthChecks;
public DashboardModule(IConfiguration configuration, IGetMetrics getMetrics, IGetHealthChecks getHealthChecks)
{
_getHealthChecks = getHealthChecks;
Get["/"] = p => View["index.html", configuration.GetAll()];
Get["/instances/{instanceName}"] = p =>
{
string instanceName = p.instanceName.ToString();
var service = new Service { Metrics = getMetrics.Execute(instanceName), HealthChecks = _getHealthChecks.Execute(instanceName) };
return Response.AsJson(service);
};
}
}
}
|
mit
|
C#
|
d9e23f70f05a9f17a462fe70f197632229cbfa74
|
update Model.cs
|
grokify/ringcentral-sdk-csharp-simple
|
src/RingCentralSimple.Api/Model/Model.cs
|
src/RingCentralSimple.Api/Model/Model.cs
|
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace RingCentralSimple.Model
{
public class Base
{
public string ToJson()
{
return JsonConvert.SerializeObject(
this,
Formatting.None,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }
);
}
}
}
namespace RingCentralSimple.Model
{
public class Caller
{
public string phoneNumber { get; set; }
}
}
namespace RingCentralSimple.Model.Request
{
public class FaxMeta : Base
{
public List<Caller> to { get; set; }
public string resolution { get; set; }
public string sendTime { get; set; }
public string coverIndex { get; set; }
public string coverPageText { get; set; }
public string originalMessageId { get; set; }
}
}
namespace RingCentralSimple.Model.Request
{
public class SMS : Base
{
public Caller from { get; set; }
public List<Caller> to { get; set; }
public string text { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace RingCentralSimple.Model
{
public class Base
{
public string ToJson()
{
return JsonConvert.SerializeObject(this);
}
}
}
namespace RingCentralSimple.Model
{
public class Caller
{
public string phoneNumber { get; set; }
}
}
namespace RingCentralSimple.Model.Request
{
public class SMS : Base
{
public Caller from { get; set; }
public List<Caller> to { get; set; }
public string text { get; set; }
}
}
|
mit
|
C#
|
9152c632d90a5c844328257526fa5510e50c1c16
|
add more cases to Method_order tests
|
JakeGinnivan/ApiApprover
|
src/PublicApiGeneratorTests/Method_order.cs
|
src/PublicApiGeneratorTests/Method_order.cs
|
using PublicApiGeneratorTests.Examples;
using Xunit;
namespace PublicApiGeneratorTests
{
public class Method_order : ApiGeneratorTestsBase
{
[Fact]
public void Should_be_alphabetical_order()
{
AssertPublicApi<MethodOrdering>(
@"namespace PublicApiGeneratorTests.Examples
{
public class MethodOrdering
{
public MethodOrdering() { }
public void Method_AA() { }
public void Method_AA<T>() { }
public void Method_AA<T, U>() { }
public void Method_BB() { }
public void Method_I() { }
public void Method_I(string arg) { }
public void Method_i() { }
}
}");
}
}
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
namespace Examples
{
public class MethodOrdering
{
public void Method_BB()
{
}
public void Method_AA<T, U>()
{
}
public void Method_AA<T>()
{
}
public void Method_AA()
{
}
public void Method_I(string arg)
{
}
public void Method_I()
{
}
public void Method_i()
{
}
}
}
// ReSharper restore ClassNeverInstantiated.Global
// ReSharper restore UnusedMember.Global
}
|
using PublicApiGeneratorTests.Examples;
using Xunit;
namespace PublicApiGeneratorTests
{
public class Method_order : ApiGeneratorTestsBase
{
[Fact]
public void Should_be_alphabetical_order()
{
AssertPublicApi<MethodOrdering>(
@"namespace PublicApiGeneratorTests.Examples
{
public class MethodOrdering
{
public MethodOrdering() { }
public void Method_AA() { }
public void Method_BB() { }
public void Method_I() { }
public void Method_i() { }
}
}");
}
}
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
namespace Examples
{
public class MethodOrdering
{
public void Method_BB()
{
}
public void Method_AA()
{
}
public void Method_I()
{
}
public void Method_i()
{
}
}
}
// ReSharper restore ClassNeverInstantiated.Global
// ReSharper restore UnusedMember.Global
}
|
mit
|
C#
|
48f9b7f5bcfc987f4e1310e4ae670c2583be6919
|
Add a getter
|
picrap/dnlib,kiootic/dnlib,jorik041/dnlib,Arthur2e5/dnlib,yck1509/dnlib,ilkerhalil/dnlib,modulexcite/dnlib,0xd4d/dnlib,ZixiangBoy/dnlib
|
dot10/dotNET/MDTable.cs
|
dot10/dotNET/MDTable.cs
|
using System;
using System.IO;
using dot10.IO;
namespace dot10.dotNET {
/// <summary>
/// A MD table (eg. Method table)
/// </summary>
public sealed class MDTable : IDisposable {
uint numRows;
TableInfo tableInfo;
IImageStream imageStream;
/// <summary>
/// Returns total number of rows
/// </summary>
public uint Rows {
get { return numRows; }
}
/// <summary>
/// Returns info about this table
/// </summary>
public TableInfo TableInfo {
get { return tableInfo; }
}
/// <summary>
/// The stream that can access all the rows in this table
/// </summary>
internal IImageStream ImageStream {
get { return imageStream; }
set {
if (imageStream != null)
imageStream.Dispose();
imageStream = value;
}
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="numRows">Number of rows in this table</param>
/// <param name="tableInfo">Info about this table</param>
internal MDTable(uint numRows, TableInfo tableInfo) {
this.numRows = numRows;
this.tableInfo = tableInfo;
}
/// <inheritdoc/>
public override string ToString() {
return string.Format("DL:{0:X8} R:{1} RS:{2} C:{3} {4}", imageStream.Length, numRows, tableInfo.RowSize, tableInfo.Columns.Count, tableInfo.Name);
}
/// <inheritdoc/>
public void Dispose() {
if (imageStream != null)
imageStream.Dispose();
numRows = 0;
tableInfo = null;
imageStream = null;
}
}
}
|
using System;
using System.IO;
using dot10.IO;
namespace dot10.dotNET {
/// <summary>
/// A MD table (eg. Method table)
/// </summary>
public sealed class MDTable : IDisposable {
uint numRows;
TableInfo tableInfo;
IImageStream imageStream;
/// <summary>
/// Returns total number of rows
/// </summary>
public uint Rows {
get { return numRows; }
}
/// <summary>
/// Returns info about this table
/// </summary>
public TableInfo TableInfo {
get { return tableInfo; }
}
/// <summary>
/// The stream that can access all the rows in this table
/// </summary>
internal IImageStream ImageStream {
set {
if (imageStream != null)
imageStream.Dispose();
imageStream = value;
}
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="numRows">Number of rows in this table</param>
/// <param name="tableInfo">Info about this table</param>
internal MDTable(uint numRows, TableInfo tableInfo) {
this.numRows = numRows;
this.tableInfo = tableInfo;
}
/// <inheritdoc/>
public override string ToString() {
return string.Format("DL:{0:X8} R:{1} RS:{2} C:{3} {4}", imageStream.Length, numRows, tableInfo.RowSize, tableInfo.Columns.Count, tableInfo.Name);
}
/// <inheritdoc/>
public void Dispose() {
if (imageStream != null)
imageStream.Dispose();
numRows = 0;
tableInfo = null;
imageStream = null;
}
}
}
|
mit
|
C#
|
88b1e8c004706c4a06b43a264e9c118092e50a61
|
replace message type in MessageReceivedEvent
|
TakeAsh/cs-p2pChat
|
p2pChat/MessageReceivedEvent.cs
|
p2pChat/MessageReceivedEvent.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TakeAshUtility;
namespace p2pChat {
public class MessageReceivedEventArgs :
EventArgs {
public MessageReceivedEventArgs(ChatMessage message) {
Message = message;
}
public ChatMessage Message { get; private set; }
public ChatMessage Response { get; set; }
public override string ToString() {
return "Message:{" + Message + "}, Response:{" + Response + "}";
}
}
public delegate void MessageReceivedEventHandler(
INotifyMessageReceived sender,
MessageReceivedEventArgs e
);
public interface INotifyMessageReceived {
event MessageReceivedEventHandler MessageReceived;
}
public static class INotifyMessageReceivedExtensionMethods {
const string EventHandlerName = "MessageReceived";
public static void NotifyMessageReceived(this INotifyMessageReceived sender, MessageReceivedEventArgs e) {
MessageReceivedEventHandler handler;
if (sender == null ||
e == null ||
(handler = sender.GetDelegate(EventHandlerName)
.GetHandler<MessageReceivedEventHandler>()) == null) {
return;
}
handler(sender, e);
}
public static ChatMessage NotifyMessageReceived(this INotifyMessageReceived sender, ChatMessage message) {
var e = new MessageReceivedEventArgs(message);
sender.NotifyMessageReceived(e);
return e.Response;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TakeAshUtility;
namespace p2pChat {
public class MessageReceivedEventArgs :
EventArgs {
public MessageReceivedEventArgs(string message) {
Message = message;
}
public string Message { get; private set; }
public string Response { get; set; }
public override string ToString() {
return "Message:{" + Message + "}, Response:{" + Response + "}";
}
}
public delegate void MessageReceivedEventHandler(
INotifyMessageReceived sender,
MessageReceivedEventArgs e
);
public interface INotifyMessageReceived {
event MessageReceivedEventHandler MessageReceived;
}
public static class INotifyMessageReceivedExtensionMethods {
const string EventHandlerName = "MessageReceived";
public static void NotifyMessageReceived(this INotifyMessageReceived sender, MessageReceivedEventArgs e) {
MessageReceivedEventHandler handler;
if (sender == null ||
e == null ||
(handler = sender.GetDelegate(EventHandlerName)
.GetHandler<MessageReceivedEventHandler>()) == null) {
return;
}
handler(sender, e);
}
public static string NotifyMessageReceived(this INotifyMessageReceived sender, string message) {
var e = new MessageReceivedEventArgs(message);
sender.NotifyMessageReceived(e);
return e.Response;
}
}
}
|
mit
|
C#
|
be3428350ca775e6d321592098849a19913d2c51
|
Update to version 1.1
|
jamesfoster/DeepEqual
|
src/DeepEqual/Properties/AssemblyInfo.cs
|
src/DeepEqual/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("DeepEqual")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DeepEqual")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2db8921a-dc9f-4b4a-b651-cd71eac66b39")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
|
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("DeepEqual")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DeepEqual")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2db8921a-dc9f-4b4a-b651-cd71eac66b39")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
3f44897e20822038fb2cec5adabc47ccb5720f3d
|
change ICollection<INotification> _domainEvents
|
linfx/LinFx,linfx/LinFx
|
src/LinFx/Domain/Models/AggregateRoot.cs
|
src/LinFx/Domain/Models/AggregateRoot.cs
|
using MediatR;
using System.Collections.Generic;
namespace LinFx.Domain.Models
{
/// <summary>
/// 聚合根
/// </summary>
public abstract class AggregateRoot : Entity, IAggregateRoot
{
private ICollection<INotification> _domainEvents;
public void AddDomainEvent(INotification eventItem)
{
_domainEvents = _domainEvents ?? new List<INotification>();
_domainEvents.Add(eventItem);
}
public void RemoveDomainEvent(INotification eventItem)
{
_domainEvents?.Remove(eventItem);
}
public void ClearDomainEvents()
{
_domainEvents?.Clear();
}
public IEnumerable<INotification> GetDomainEvents()
{
return _domainEvents;
}
}
public abstract class AggregateRoot<TKey> : Entity<TKey>, IAggregateRoot<TKey>
{
private ICollection<INotification> _domainEvents;
public void AddDomainEvent(INotification eventItem)
{
_domainEvents = _domainEvents ?? new List<INotification>();
_domainEvents.Add(eventItem);
}
public void RemoveDomainEvent(INotification eventItem)
{
_domainEvents?.Remove(eventItem);
}
public void ClearDomainEvents()
{
_domainEvents?.Clear();
}
public IEnumerable<INotification> GetDomainEvents()
{
return _domainEvents;
}
}
}
|
using MediatR;
using System.Collections.Generic;
namespace LinFx.Domain.Models
{
/// <summary>
/// 聚合根
/// </summary>
public abstract class AggregateRoot : Entity, IAggregateRoot
{
private List<INotification> _domainEvents;
public void AddDomainEvent(INotification eventItem)
{
_domainEvents = _domainEvents ?? new List<INotification>();
_domainEvents.Add(eventItem);
}
public void RemoveDomainEvent(INotification eventItem)
{
_domainEvents?.Remove(eventItem);
}
public void ClearDomainEvents()
{
_domainEvents?.Clear();
}
public IEnumerable<INotification> GetDomainEvents()
{
return _domainEvents;
}
}
public abstract class AggregateRoot<TKey> : Entity<TKey>, IAggregateRoot<TKey>
{
private List<INotification> _domainEvents;
public IReadOnlyCollection<INotification> DomainEvents => _domainEvents?.AsReadOnly();
public void AddDomainEvent(INotification eventItem)
{
_domainEvents = _domainEvents ?? new List<INotification>();
_domainEvents.Add(eventItem);
}
public void RemoveDomainEvent(INotification eventItem)
{
_domainEvents?.Remove(eventItem);
}
public void ClearDomainEvents()
{
_domainEvents?.Clear();
}
public IEnumerable<INotification> GetDomainEvents()
{
return _domainEvents;
}
}
}
|
mit
|
C#
|
7cccf9064e240e31f0fb0ffeccd95fec2b06af1b
|
Add multi-span support to CompilationFactory
|
terrajobst/nquery-vnext
|
src/NQuery.Testing/CompilationFactory.cs
|
src/NQuery.Testing/CompilationFactory.cs
|
using System;
using System.Collections.Immutable;
using NQuery.Text;
namespace NQuery
{
public static class CompilationFactory
{
private static readonly DataContext DataContext = NorthwindDataContext.Instance;
public static Compilation CreateQuery(string query)
{
var syntaxTree = SyntaxTree.ParseQuery(query);
return new Compilation(DataContext, syntaxTree);
}
public static Compilation CreateQuery(string textWithPipe, out int position)
{
var text = textWithPipe.ParseSinglePosition(out position);
return CreateQuery(text);
}
public static Compilation CreateQuery(string textWithMarkers, out TextSpan span)
{
var text = textWithMarkers.ParseSingleSpan(out span);
return CreateQuery(text);
}
public static Compilation CreateQuery(string textWithMarkers, out ImmutableArray<TextSpan> spans)
{
var text = textWithMarkers.ParseSpans(out spans);
return CreateQuery(text);
}
public static Compilation CreateExpression(string text)
{
var syntaxTree = SyntaxTree.ParseExpression(text);
return new Compilation(DataContext, syntaxTree);
}
public static Compilation CreateExpression(string textWithPipe, out int position)
{
var text = textWithPipe.ParseSinglePosition(out position);
return CreateExpression(text);
}
public static Compilation CreateExpression(string textWithMarkers, out TextSpan span)
{
var text = textWithMarkers.ParseSingleSpan(out span);
return CreateExpression(text);
}
public static Compilation CreateExpression(string textWithMarkers, out ImmutableArray<TextSpan> spans)
{
var text = textWithMarkers.ParseSpans(out spans);
return CreateExpression(text);
}
}
}
|
using System;
using NQuery.Text;
namespace NQuery
{
public static class CompilationFactory
{
private static readonly DataContext DataContext = NorthwindDataContext.Instance;
public static Compilation CreateQuery(string query)
{
var syntaxTree = SyntaxTree.ParseQuery(query);
return new Compilation(DataContext, syntaxTree);
}
public static Compilation CreateQuery(string textWithPipe, out int position)
{
var text = textWithPipe.ParseSinglePosition(out position);
return CreateQuery(text);
}
public static Compilation CreateQuery(string textWithMarkers, out TextSpan span)
{
var text = textWithMarkers.ParseSingleSpan(out span);
return CreateQuery(text);
}
public static Compilation CreateExpression(string text)
{
var syntaxTree = SyntaxTree.ParseExpression(text);
return new Compilation(DataContext, syntaxTree);
}
public static Compilation CreateExpression(string textWithPipe, out int position)
{
var text = textWithPipe.ParseSinglePosition(out position);
return CreateExpression(text);
}
public static Compilation CreateExpression(string textWithMarkers, out TextSpan span)
{
var text = textWithMarkers.ParseSingleSpan(out span);
return CreateExpression(text);
}
}
}
|
mit
|
C#
|
12f792d1c0740ccd5e0334dc1d9740b776f83fb2
|
Fix PCL implementation of Reset
|
yonglehou/Polly,cicorias/Polly,manastalukdar/Polly,mauricedb/Polly,czerwonkabartosz/Polly,joelhulen/Polly,alphaleonis/Polly,michael-wolfenden/Polly
|
src/Polly.Net35/Utilities/SystemClock.cs
|
src/Polly.Net35/Utilities/SystemClock.cs
|
using System;
using System.Threading;
namespace Polly.Utilities
{
/// <summary>
/// Time related delegates used to improve testability of the code
/// </summary>
public static class SystemClock
{
#if !PORTABLE
/// <summary>
/// Allows the setting of a custom Thread.Sleep implementation for testing.
/// By default this will be a call to <see cref="M:Thread.Sleep"/>
/// </summary>
public static Action<TimeSpan> Sleep = Thread.Sleep;
#endif
#if PORTABLE
/// <summary>
/// Allows the setting of a custom Thread.Sleep implementation for testing.
/// By default this will be a call to <see cref="M:ManualResetEvent.WaitOne"/>
/// </summary>
public static Action<TimeSpan> Sleep = timespan => new ManualResetEvent(false).WaitOne(timespan);
#endif
/// <summary>
/// Allows the setting of a custom DateTime.UtcNow implementation for testing.
/// By default this will be a call to <see cref="DateTime.UtcNow"/>
/// </summary>
public static Func<DateTime> UtcNow = () => DateTime.UtcNow;
/// <summary>
/// Resets the custom implementations to their defaults.
/// Should be called during test teardowns.
/// </summary>
public static void Reset()
{
#if !PORTABLE
Sleep = Thread.Sleep;
#endif
#if PORTABLE
Sleep = timeSpan => new ManualResetEvent(false).WaitOne(timeSpan);
#endif
UtcNow = () => DateTime.UtcNow;
}
}
}
|
using System;
using System.Threading;
#if PORTABLE
using System.Threading.Tasks;
#endif
namespace Polly.Utilities
{
/// <summary>
/// Time related delegates used to improve testability of the code
/// </summary>
public static class SystemClock
{
/// <summary>
/// Allows the setting of a custom Thread.Sleep implementation for testing.
/// By default this will be a call to <see cref="Thread.Sleep(TimeSpan)"/>
/// </summary>
#if !PORTABLE
public static Action<TimeSpan> Sleep = Thread.Sleep;
#endif
#if PORTABLE
public static Action<TimeSpan> Sleep = timespan => new ManualResetEvent(false).WaitOne(timespan);
#endif
/// <summary>
/// Allows the setting of a custom DateTime.UtcNow implementation for testing.
/// By default this will be a call to <see cref="DateTime.UtcNow"/>
/// </summary>
public static Func<DateTime> UtcNow = () => DateTime.UtcNow;
/// <summary>
/// Resets the custom implementations to their defaults.
/// Should be called during test teardowns.
/// </summary>
public static void Reset()
{
#if !PORTABLE
Sleep = Thread.Sleep;
#endif
#if PORTABLE
Sleep = async span => await Task.Delay(span);
#endif
UtcNow = () => DateTime.UtcNow;
}
}
}
|
bsd-3-clause
|
C#
|
6ac968207c2490eb2f07765f35dbd45027c6abc9
|
update about page
|
tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web
|
src/Tugberk.Web/Views/About/Index.cshtml
|
src/Tugberk.Web/Views/About/Index.cshtml
|
<div class="about-holder">
<div class="row">
<div class="col">
<h2>About Tugberk Ugurlu</h2>
</div>
</div>
<div class="row">
<div class="col">
<figure class="figure">
<img src="/images/IMG_4060.JPG" class="figure-img img-fluid" alt="Tugberk in Cambridge" title="Tugberk in Cambridge" />
</figure>
</div>
</div>
<div class="row">
<div class="col-md-4">
<img src="/images/IMG_8783.JPG" class="img-thumbnail" alt="Tugberk in Gran Canaria" title="Tugberk in Gran Canaria" />
</div>
<div class="col-md-8">
<p>
I'm a self-motivated software guy who craves to create great software products and build effective development teams with 9 years of software development experience. I've been spreading my passion for software over the years through speaking at conferences, writing blog posts, establishing collaboration on open source projects, and authoring a book. All of these are the concrete evidences of how much I care about communicating what’s important, and what matters in software quality and software delivery process. I also aim to strive for the balance required to have a stable, maintainable and architecturally-accurate software product, and being on the market fast with an iterative approach.
</p>
<p>
I currently work as a Technical Lead at Redgate by leading a team of 5 Software Engineers. I am responsible for all aspects of the products delivered by the team from technical architecture to product direction. I have been also a Microsoft MVP for more than 5 years on Microsoft development technologies.
</p>
</div>
</div>
</div>
|
<div class="about-holder">
<div class="row">
<div class="col">
<h2>About Tugberk Ugurlu</h2>
</div>
</div>
<div class="row">
<div class="col">
<figure class="figure">
<img src="/images/IMG_4060.JPG" class="figure-img img-fluid" alt="Tugberk in Cambridge" title="Tugberk in Cambridge" />
</figure>
</div>
</div>
<div class="row">
<div class="col-md-4">
<img src="/images/IMG_8783.JPG" class="img-thumbnail" alt="Tugberk in Gran Canaria" title="Tugberk in Gran Canaria" />
</div>
<div class="col-md-8">
<p>
I'm a self-motivated Software Engineer who craves to create great software. I've been spreading my passion for software over the years through the talks I've given at conferences, blog posts I've written, the collaboration I've established on open source projects, and the book that I have authored. All of these are the concrete evidences of how much I care about communicating what’s important, and what matters in software quality and software delivery process. I'm also aware of the balance required to have a stable, maintainable and architecturally-accurate software product, and being on the market fast with an iterative approach.
</p>
<p>
I currently work as a Technical Lead of Compare Team at Redgate by leading a team of 5 brilliant Software Engineers. Responsible for all aspects of the products delivered by the team (such as SQL Compare and SQL Data Compare) from technical architecture to product direction.
</p>
</div>
</div>
</div>
|
agpl-3.0
|
C#
|
b36b89a718191d1e5fe396a2f4b873941890d5bc
|
Fix #2340 backwards took calculation on Audit ToString impl
|
CSGOpenSource/elasticsearch-net,adam-mccoy/elasticsearch-net,elastic/elasticsearch-net,CSGOpenSource/elasticsearch-net,elastic/elasticsearch-net,adam-mccoy/elasticsearch-net,adam-mccoy/elasticsearch-net,CSGOpenSource/elasticsearch-net
|
src/Elasticsearch.Net/Auditing/Audit.cs
|
src/Elasticsearch.Net/Auditing/Audit.cs
|
using System;
namespace Elasticsearch.Net
{
public class Audit
{
public AuditEvent Event { get; internal set; }
public DateTime Started { get; }
public DateTime Ended { get; internal set; }
public Node Node { get; internal set; }
public string Path { get; internal set; }
public Exception Exception { get; internal set; }
public Audit(AuditEvent type, DateTime started)
{
this.Event = type;
this.Started = started;
}
public override string ToString()
{
var took = Ended - Started;
return $"Node: {Node?.Uri}, Event: {Event.GetStringValue()} NodeAlive: {Node?.IsAlive}, Took: {took}";
}
}
}
|
using System;
namespace Elasticsearch.Net
{
public class Audit
{
public AuditEvent Event { get; internal set; }
public DateTime Started { get; }
public DateTime Ended { get; internal set; }
public Node Node { get; internal set; }
public string Path { get; internal set; }
public Exception Exception { get; internal set; }
public Audit(AuditEvent type, DateTime started)
{
this.Event = type;
this.Started = started;
}
public override string ToString()
{
var took = Started - Ended;
return $"Node: {Node?.Uri}, Event: {Event.GetStringValue()} NodeAlive: {Node?.IsAlive}, Took: {took}";
}
}
}
|
apache-2.0
|
C#
|
81353dfcc725f4acdfba058e61a53e82ad1209e2
|
fix mainwindow caption
|
MetacoSA/Metaco-Trader,NicolasDorier/PowerWallet,MetacoSA/PowerWallet
|
PowerWallet/App.xaml.cs
|
PowerWallet/App.xaml.cs
|
using NBitcoin;
using PowerWallet.Modules;
using PowerWallet.ViewModel;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using System.ComponentModel.Composition;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Autofac;
using GalaSoft.MvvmLight.Messaging;
namespace PowerWallet
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
var network = e.Args.Contains("-testnet") ? Network.TestNet : Network.Main;
_Network = network;
var window = new MainWindow();
MainWindow = window;
AssemblyCatalog catalog = new AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly());
CompositionContainer container = new CompositionContainer(catalog);
container.ComposeParts(this);
InitializationContext ctx = new InitializationContext(window);
ctx.Container.RegisterInstance<Network>(network);
foreach (var module in Modules)
{
module.Initialize(ctx);
}
Locator = new ViewModelLocator(ctx.Container.Build());
window.ModuleInitialized();
window.LoadLayout();
window.Show();
base.OnStartup(e);
}
[ImportMany]
public IEnumerable<IModule> Modules
{
get;
set;
}
public static ViewModelLocator Locator
{
get;
private set;
}
public static string Caption
{
get
{
return typeof(App).Assembly.GetName().Version.ToString() + " by Nicolas Dorier (" + (Network == Network.TestNet ? "Testnet" : "Mainnet") + ")";
}
}
static Network _Network;
static Network Network
{
get
{
return _Network ?? Network.Main;
}
}
}
}
|
using NBitcoin;
using PowerWallet.Modules;
using PowerWallet.ViewModel;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using System.ComponentModel.Composition;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Autofac;
using GalaSoft.MvvmLight.Messaging;
namespace PowerWallet
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
var network = e.Args.Contains("-testnet") ? Network.TestNet : Network.Main;
_Network = network;
var window = new MainWindow();
MainWindow = window;
AssemblyCatalog catalog = new AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly());
CompositionContainer container = new CompositionContainer(catalog);
container.ComposeParts(this);
InitializationContext ctx = new InitializationContext(window);
ctx.Container.RegisterInstance<Network>(network);
foreach (var module in Modules)
{
module.Initialize(ctx);
}
Locator = new ViewModelLocator(ctx.Container.Build());
window.ModuleInitialized();
window.LoadLayout();
window.Show();
base.OnStartup(e);
}
[ImportMany]
public IEnumerable<IModule> Modules
{
get;
set;
}
public static ViewModelLocator Locator
{
get;
private set;
}
public static string Caption
{
get
{
return typeof(App).Assembly.GetName().Version.ToString() + " by Nicolas Dorier (" + Network.ToString() + "net)";
}
}
static Network _Network;
static Network Network
{
get
{
return _Network ?? Network.Main;
}
}
}
}
|
mit
|
C#
|
015a2aed966dd6a2e217675706ac062413926fe9
|
Increase FileVersion to 4.0.7
|
CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork
|
trunk/Solutions/CslaGenFork/Properties/AssemblyInfo.cs
|
trunk/Solutions/CslaGenFork/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("Csla Generator Fork")]
[assembly: AssemblyDescription("A Csla DAL and Business Object code generation tool based on the CodeSmith engine.\nThis fork is based on CslaGen 20090529.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CslaGenFork Project")]
[assembly: AssemblyProduct("Csla Generator Fork")]
[assembly: AssemblyCopyright("Copyright CslaGen Project, 2007, 2009 && Tiago Freitas Leal, 2009, 2010, 2011")]
[assembly: AssemblyTrademark("All Rights Reserved")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.0.3.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: AssemblyFileVersionAttribute("4.0.7")]
[assembly: GuidAttribute("5c019c4f-d2ab-40dd-9860-70bd603b6017")]
[assembly: ComVisibleAttribute(false)]
|
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("Csla Generator Fork")]
[assembly: AssemblyDescription("A Csla DAL and Business Object code generation tool based on the CodeSmith engine.\nThis fork is based on CslaGen 20090529.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CslaGenFork Project")]
[assembly: AssemblyProduct("Csla Generator Fork")]
[assembly: AssemblyCopyright("Copyright CslaGen Project, 2007, 2009 && Tiago Freitas Leal, 2009, 2010, 2011")]
[assembly: AssemblyTrademark("All Rights Reserved")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.0.3.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: AssemblyFileVersionAttribute("4.0.6")]
[assembly: GuidAttribute("5c019c4f-d2ab-40dd-9860-70bd603b6017")]
[assembly: ComVisibleAttribute(false)]
|
mit
|
C#
|
8dd7c85762e9d5d9b64de77ee6686ce98dbf42b7
|
Add Path property to exception
|
khellang/Middleware,khellang/Middleware
|
src/SpaFallback/SpaFallbackException.cs
|
src/SpaFallback/SpaFallbackException.cs
|
using System;
using System.Text;
using Microsoft.AspNetCore.Http;
namespace Hellang.Middleware.SpaFallback
{
public class SpaFallbackException : Exception
{
private const string Fallback = nameof(SpaFallbackExtensions.UseSpaFallback);
private const string StaticFiles = "UseStaticFiles";
private const string Mvc = "UseMvc";
public SpaFallbackException(PathString path) : base(GetMessage(path))
{
Path = path;
}
public PathString Path { get; }
private static string GetMessage(PathString path) => new StringBuilder()
.AppendLine($"The {Fallback} middleware failed to provide a fallback response for path '{path}' because no middleware could handle it.")
.AppendLine($"Make sure {Fallback} is placed before any middleware that is supposed to provide the fallback response. This is typically {StaticFiles} or {Mvc}.")
.AppendLine($"If you're using {StaticFiles}, make sure the file exists on disk and that the middleware is configured correctly.")
.AppendLine($"If you're using {Mvc}, make sure you have a controller and action method that can handle '{path}'.")
.ToString();
}
}
|
using System;
using System.Text;
using Microsoft.AspNetCore.Http;
namespace Hellang.Middleware.SpaFallback
{
public class SpaFallbackException : Exception
{
private const string Fallback = nameof(SpaFallbackExtensions.UseSpaFallback);
private const string StaticFiles = "UseStaticFiles";
private const string Mvc = "UseMvc";
public SpaFallbackException(PathString path) : base(GetMessage(path))
{
}
private static string GetMessage(PathString path) => new StringBuilder()
.AppendLine($"The {Fallback} middleware failed to provide a fallback response for path '{path}' because no middleware could handle it.")
.AppendLine($"Make sure {Fallback} is placed before any middleware that is supposed to provide the fallback response. This is typically {StaticFiles} or {Mvc}.")
.AppendLine($"If you're using {StaticFiles}, make sure the file exists on disk and that the middleware is configured correctly.")
.AppendLine($"If you're using {Mvc}, make sure you have a controller and action method that can handle '{path}'.")
.ToString();
}
}
|
mit
|
C#
|
49f9cf38156d1d1d4333b89e49c9b2bf5861e4c3
|
Ajuste para numeros long
|
kleberksms/StaticCommons
|
src/StaticCommons/Validation/Numeric.cs
|
src/StaticCommons/Validation/Numeric.cs
|
using System;
namespace StaticCommons.Validation
{
public static class Numeric
{
static Numeric(){}
public static bool StringIsAnNumber(string input)
{
int value;
long value64;
return int.TryParse(input, out value) || long.TryParse(input, out value64);
}
}
}
|
namespace StaticCommons.Validation
{
public static class Numeric
{
static Numeric(){}
public static bool StringIsAnNumber(string input)
{
int value;
return int.TryParse(input, out value);
}
}
}
|
mit
|
C#
|
8a5fd76f4f4bdae9be569c0752a4250a47c1a0d8
|
Fix mistyped field in `PROPVARIANT`
|
stakx/stakx.WIC.Interop,stakx/stakx.WIC
|
stakx.WIC.Interop/Structures/PROPVARIANT.cs
|
stakx.WIC.Interop/Structures/PROPVARIANT.cs
|
using System;
using System.Runtime.InteropServices;
namespace stakx.WIC.Interop
{
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct PROPVARIANT
{
public VARTYPE Type;
public PROPVARIANT_Value Value;
}
[StructLayout(LayoutKind.Explicit)]
public struct PROPVARIANT_Value
{
[FieldOffset(0)]
public sbyte I1;
[FieldOffset(0)]
public byte UI1;
[FieldOffset(0)]
public short I2;
[FieldOffset(0)]
public ushort UI2;
[FieldOffset(0)]
public int I4;
[FieldOffset(0)]
public uint UI4;
[FieldOffset(0)]
public long I8;
[FieldOffset(0)]
public ulong UI8;
[FieldOffset(0)]
public PROPVARIANT_SplitI8 SplitI8;
[FieldOffset(0)]
public PROPVARIANT_SplitUI8 SplitUI8;
[FieldOffset(0)]
public float R4;
[FieldOffset(0)]
public double R8;
[FieldOffset(0)]
public IntPtr Ptr;
[FieldOffset(0)]
public PROPVARIANT_Vector Vector;
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct PROPVARIANT_SplitI8
{
public int A;
public int B;
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct PROPVARIANT_SplitUI8
{
public uint A;
public uint B;
}
[StructLayout(LayoutKind.Sequential)]
public struct PROPVARIANT_Vector
{
public int Length;
public IntPtr Ptr;
}
}
|
using System;
using System.Runtime.InteropServices;
namespace stakx.WIC.Interop
{
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct PROPVARIANT
{
public VARTYPE Type;
public PROPVARIANT_Value Value;
}
[StructLayout(LayoutKind.Explicit)]
public struct PROPVARIANT_Value
{
[FieldOffset(0)]
public sbyte I1;
[FieldOffset(0)]
public byte UI1;
[FieldOffset(0)]
public short I2;
[FieldOffset(0)]
public ushort UI2;
[FieldOffset(0)]
public int I4;
[FieldOffset(0)]
public uint UI4;
[FieldOffset(0)]
public long I8;
[FieldOffset(0)]
public uint UI8;
[FieldOffset(0)]
public PROPVARIANT_SplitI8 SplitI8;
[FieldOffset(0)]
public PROPVARIANT_SplitUI8 SplitUI8;
[FieldOffset(0)]
public float R4;
[FieldOffset(0)]
public double R8;
[FieldOffset(0)]
public IntPtr Ptr;
[FieldOffset(0)]
public PROPVARIANT_Vector Vector;
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct PROPVARIANT_SplitI8
{
public int A;
public int B;
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct PROPVARIANT_SplitUI8
{
public uint A;
public uint B;
}
[StructLayout(LayoutKind.Sequential)]
public struct PROPVARIANT_Vector
{
public int Length;
public IntPtr Ptr;
}
}
|
mit
|
C#
|
c690d5f3bab8c67f47365f2b83f222633505a6e6
|
Add clarifying comment in ValueEditorCache
|
JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS
|
src/Umbraco.Core/Cache/ValueEditorCache.cs
|
src/Umbraco.Core/Cache/ValueEditorCache.cs
|
using System.Collections.Generic;
using System.Linq;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.PropertyEditors;
namespace Umbraco.Cms.Core.Cache
{
public class ValueEditorCache : IValueEditorCache,
INotificationHandler<DataTypeSavedNotification>,
INotificationHandler<DataTypeDeletedNotification>
{
private readonly Dictionary<string, Dictionary<int, IDataValueEditor>> _valueEditorCache = new();
public IDataValueEditor GetValueEditor(IDataEditor editor, IDataType dataType)
{
// We try and get the dictionary based on the IDataEditor alias,
// this is here just in case a data type can have more than one value data editor.
// If this is not the case this could be simplified quite a bit, by just using the inner dictionary only.
IDataValueEditor valueEditor;
if (_valueEditorCache.TryGetValue(editor.Alias, out Dictionary<int, IDataValueEditor> dataEditorCache))
{
if (dataEditorCache.TryGetValue(dataType.Id, out valueEditor))
{
return valueEditor;
}
valueEditor = editor.GetValueEditor(dataType.Configuration);
dataEditorCache[dataType.Id] = valueEditor;
return valueEditor;
}
valueEditor = editor.GetValueEditor(dataType.Configuration);
_valueEditorCache[editor.Alias] = new Dictionary<int, IDataValueEditor> { [dataType.Id] = valueEditor };
return valueEditor;
}
public void Handle(DataTypeSavedNotification notification) =>
ClearCache(notification.SavedEntities.Select(x => x.Id));
public void Handle(DataTypeDeletedNotification notification) =>
ClearCache(notification.DeletedEntities.Select(x => x.Id));
private void ClearCache(IEnumerable<int> dataTypeIds)
{
// If a datatype is saved or deleted we have to clear any value editors based on their ID from the cache,
// since it could mean that their configuration has changed.
foreach (var id in dataTypeIds)
{
foreach (Dictionary<int, IDataValueEditor> editors in _valueEditorCache.Values)
{
editors.Remove(id);
}
}
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.PropertyEditors;
namespace Umbraco.Cms.Core.Cache
{
public class ValueEditorCache : IValueEditorCache,
INotificationHandler<DataTypeSavedNotification>,
INotificationHandler<DataTypeDeletedNotification>
{
private readonly Dictionary<string, Dictionary<int, IDataValueEditor>> _valueEditorCache = new();
public IDataValueEditor GetValueEditor(IDataEditor editor, IDataType dataType)
{
// Instead of creating a value editor immediately check if we've already created one and use that.
IDataValueEditor valueEditor;
if (_valueEditorCache.TryGetValue(editor.Alias, out Dictionary<int, IDataValueEditor> dataEditorCache))
{
if (dataEditorCache.TryGetValue(dataType.Id, out valueEditor))
{
return valueEditor;
}
valueEditor = editor.GetValueEditor(dataType.Configuration);
dataEditorCache[dataType.Id] = valueEditor;
return valueEditor;
}
valueEditor = editor.GetValueEditor(dataType.Configuration);
_valueEditorCache[editor.Alias] = new Dictionary<int, IDataValueEditor> { [dataType.Id] = valueEditor };
return valueEditor;
}
public void Handle(DataTypeSavedNotification notification) =>
ClearCache(notification.SavedEntities.Select(x => x.Id));
public void Handle(DataTypeDeletedNotification notification) =>
ClearCache(notification.DeletedEntities.Select(x => x.Id));
private void ClearCache(IEnumerable<int> dataTypeIds)
{
// If a datatype is saved or deleted we have to clear any value editors based on their ID from the cache,
// since it could mean that their configuration has changed.
foreach (var id in dataTypeIds)
{
foreach (Dictionary<int, IDataValueEditor> editors in _valueEditorCache.Values)
{
editors.Remove(id);
}
}
}
}
}
|
mit
|
C#
|
1e00171578134fc2a5c09dfeb1cac80be207e4ea
|
Update S3Exception to inherit from AwsException
|
carbon/Amazon
|
src/Amazon.S3/Exceptions/S3Exception.cs
|
src/Amazon.S3/Exceptions/S3Exception.cs
|
using System.Net;
using Amazon.Exceptions;
using Amazon.Scheduling;
namespace Amazon.S3;
public sealed class S3Exception : AwsException, IException
{
private readonly S3Error? _error;
public S3Exception(string message, HttpStatusCode statusCode)
: base(message, statusCode) { }
public S3Exception(string message, Exception innerException, HttpStatusCode statusCode)
: base(message, innerException, statusCode)
{
if (innerException is S3Exception s3Exception)
{
_error = s3Exception.Error;
}
}
public S3Exception(S3Error error, HttpStatusCode statusCode)
: this(error.Message, statusCode)
{
_error = error;
}
public S3Error? Error => _error;
public bool IsTransient => HttpStatusCode is HttpStatusCode.InternalServerError or HttpStatusCode.ServiceUnavailable; // 500 || 503
}
|
using System.Net;
using Amazon.Scheduling;
namespace Amazon.S3;
// TODO: Inhert from AwsException
public sealed class S3Exception : Exception, IException
{
public S3Exception(string message, HttpStatusCode statusCode)
: base(message)
{
HttpStatusCode = statusCode;
}
public S3Exception(string message, Exception innerException)
: base(message, innerException)
{
if (innerException is S3Exception s3Exception)
{
HttpStatusCode = s3Exception.HttpStatusCode;
ErrorCode = s3Exception.ErrorCode;
RequestId = s3Exception.RequestId;
}
}
public S3Exception(S3Error error, HttpStatusCode statusCode)
: this(error.Message, statusCode)
{
ErrorCode = error.Code;
HttpStatusCode = statusCode;
RequestId = error.RequestId;
}
public HttpStatusCode HttpStatusCode { get; }
public string? ErrorCode { get; }
public string? RequestId { get; }
public bool IsTransient => HttpStatusCode is HttpStatusCode.InternalServerError or HttpStatusCode.ServiceUnavailable; // 500 || 503
}
|
mit
|
C#
|
3b79faac3d4d12122832f9fb1acce0a734c0f659
|
Initialize CreateCommand with an GitExecutor
|
appharbor/appharbor-cli
|
src/AppHarbor/Commands/CreateCommand.cs
|
src/AppHarbor/Commands/CreateCommand.cs
|
using System;
using System.Linq;
namespace AppHarbor.Commands
{
public class CreateCommand : ICommand
{
private readonly IAppHarborClient _appHarborClient;
private readonly ApplicationConfiguration _applicationConfiguration;
private readonly GitExecutor _gitExecutor;
public CreateCommand(IAppHarborClient appHarborClient, ApplicationConfiguration applicationConfiguration, GitExecutor gitExecutor)
{
_appHarborClient = appHarborClient;
_applicationConfiguration = applicationConfiguration;
_gitExecutor = gitExecutor;
}
public void Execute(string[] arguments)
{
if (arguments.Length == 0)
{
throw new CommandException("An application name must be provided to create an application");
}
var result = _appHarborClient.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault());
Console.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", result.ID);
}
}
}
|
using System;
using System.Linq;
namespace AppHarbor.Commands
{
public class CreateCommand : ICommand
{
private readonly IAppHarborClient _appHarborClient;
private readonly ApplicationConfiguration _applicationConfiguration;
public CreateCommand(IAppHarborClient appHarborClient, ApplicationConfiguration applicationConfiguration)
{
_appHarborClient = appHarborClient;
_applicationConfiguration = applicationConfiguration;
}
public void Execute(string[] arguments)
{
if (arguments.Length == 0)
{
throw new CommandException("An application name must be provided to create an application");
}
var result = _appHarborClient.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault());
Console.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", result.ID);
}
}
}
|
mit
|
C#
|
44089b368fb86105e3ebdc9c6c5b67cf95657264
|
Set CreateOnly to false by defaultso publish is true by default.
|
xero-github/Nuget,pratikkagda/nuget,dolkensp/node.net,GearedToWar/NuGet2,pratikkagda/nuget,pratikkagda/nuget,antiufo/NuGet2,xoofx/NuGet,kumavis/NuGet,atheken/nuget,jmezach/NuGet2,RichiCoder1/nuget-chocolatey,jmezach/NuGet2,mrward/nuget,alluran/node.net,rikoe/nuget,jholovacs/NuGet,alluran/node.net,zskullz/nuget,pratikkagda/nuget,chocolatey/nuget-chocolatey,rikoe/nuget,ctaggart/nuget,mono/nuget,indsoft/NuGet2,jmezach/NuGet2,mrward/nuget,mrward/NuGet.V2,RichiCoder1/nuget-chocolatey,oliver-feng/nuget,xoofx/NuGet,RichiCoder1/nuget-chocolatey,xoofx/NuGet,oliver-feng/nuget,indsoft/NuGet2,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,indsoft/NuGet2,OneGet/nuget,oliver-feng/nuget,mrward/nuget,dolkensp/node.net,pratikkagda/nuget,mrward/nuget,antiufo/NuGet2,antiufo/NuGet2,zskullz/nuget,atheken/nuget,xoofx/NuGet,jholovacs/NuGet,akrisiun/NuGet,jholovacs/NuGet,themotleyfool/NuGet,GearedToWar/NuGet2,ctaggart/nuget,OneGet/nuget,jmezach/NuGet2,pratikkagda/nuget,chester89/nugetApi,mono/nuget,mono/nuget,xoofx/NuGet,GearedToWar/NuGet2,chocolatey/nuget-chocolatey,akrisiun/NuGet,OneGet/nuget,zskullz/nuget,mrward/NuGet.V2,jholovacs/NuGet,ctaggart/nuget,jmezach/NuGet2,GearedToWar/NuGet2,kumavis/NuGet,anurse/NuGet,dolkensp/node.net,GearedToWar/NuGet2,zskullz/nuget,chocolatey/nuget-chocolatey,antiufo/NuGet2,OneGet/nuget,mrward/nuget,indsoft/NuGet2,antiufo/NuGet2,anurse/NuGet,oliver-feng/nuget,RichiCoder1/nuget-chocolatey,ctaggart/nuget,jholovacs/NuGet,dolkensp/node.net,oliver-feng/nuget,chocolatey/nuget-chocolatey,rikoe/nuget,mrward/NuGet.V2,RichiCoder1/nuget-chocolatey,alluran/node.net,mrward/NuGet.V2,rikoe/nuget,xoofx/NuGet,chocolatey/nuget-chocolatey,mrward/NuGet.V2,alluran/node.net,antiufo/NuGet2,chester89/nugetApi,GearedToWar/NuGet2,themotleyfool/NuGet,mono/nuget,jmezach/NuGet2,indsoft/NuGet2,chocolatey/nuget-chocolatey,mrward/nuget,indsoft/NuGet2,oliver-feng/nuget,jholovacs/NuGet,themotleyfool/NuGet
|
src/CommandLine/Commands/PushCommand.cs
|
src/CommandLine/Commands/PushCommand.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using NuGet.Common;
namespace NuGet.Commands {
[Export(typeof(ICommand))]
[Command(typeof(NuGetResources), "push", "PushCommandDescription", AltName="pu",
MinArgs = 2, MaxArgs = 2, UsageDescriptionResourceName = "PushCommandUsageDescription",
UsageSummaryResourceName = "PushCommandUsageSummary")]
public class PushCommand : Command {
private string _apiKey;
private string _packagePath;
[Option(typeof(NuGetResources), "PushCommandPublishDescription", AltName = "co")]
public bool CreateOnly { get; set; }
[Option(typeof(NuGetResources), "PushCommandSourceDescription", AltName = "src")]
public string Source { get; set; }
public override void ExecuteCommand() {
//Frist argument should be the package
_packagePath = Arguments[0];
//Second argument should be the API Key
_apiKey = Arguments[1];
GalleryServer gallery;
if (String.IsNullOrEmpty(Source)) {
gallery = new GalleryServer();
}
else {
gallery = new GalleryServer(Source);
}
ZipPackage pkg = new ZipPackage(_packagePath);
Console.WriteLine(NuGetResources.PushCommandCreatingPackage, pkg.Id, pkg.Version);
using (Stream pkgStream = pkg.GetStream()) {
gallery.CreatePackage(_apiKey, pkgStream);
}
Console.WriteLine(NuGetResources.PushCommandPackageCreated);
if (!CreateOnly) {
var cmd = new PublishCommand();
cmd.Console = Console;
cmd.Source = Source;
cmd.Arguments = new List<string> { pkg.Id, pkg.Version.ToString(), _apiKey };
cmd.Execute();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using NuGet.Common;
namespace NuGet.Commands {
[Export(typeof(ICommand))]
[Command(typeof(NuGetResources), "push", "PushCommandDescription", AltName="pu",
MinArgs = 2, MaxArgs = 2, UsageDescriptionResourceName = "PushCommandUsageDescription",
UsageSummaryResourceName = "PushCommandUsageSummary")]
public class PushCommand : Command {
private string _apiKey;
private string _packagePath;
[Option(typeof(NuGetResources), "PushCommandPublishDescription", AltName = "co")]
public bool CreateOnly { get; set; }
[Option(typeof(NuGetResources), "PushCommandSourceDescription", AltName = "src")]
public string Source { get; set; }
public PushCommand() {
CreateOnly = true;
}
public override void ExecuteCommand() {
//Frist argument should be the package
_packagePath = Arguments[0];
//Second argument should be the API Key
_apiKey = Arguments[1];
GalleryServer gallery;
if (String.IsNullOrEmpty(Source)) {
gallery = new GalleryServer();
}
else {
gallery = new GalleryServer(Source);
}
ZipPackage pkg = new ZipPackage(_packagePath);
Console.WriteLine(NuGetResources.PushCommandCreatingPackage, pkg.Id, pkg.Version);
using (Stream pkgStream = pkg.GetStream()) {
gallery.CreatePackage(_apiKey, pkgStream);
}
Console.WriteLine(NuGetResources.PushCommandPackageCreated);
if (!CreateOnly) {
var cmd = new PublishCommand();
cmd.Console = Console;
cmd.Source = Source;
cmd.Arguments = new List<string> { pkg.Id, pkg.Version.ToString(), _apiKey };
cmd.Execute();
}
}
}
}
|
apache-2.0
|
C#
|
3077702c532f33f3577a77607a2a111c59db962a
|
Fix working directory for lldb launch.
|
faxue-msft/MIEngine,pieandcakes/MIEngine,edumunoz/MIEngine,faxue-msft/MIEngine,csiusers/MIEngine,pieandcakes/MIEngine,orbitcowboy/MIEngine,rajkumar42/MIEngine,rajkumar42/MIEngine,chuckries/MIEngine,Microsoft/MIEngine,orbitcowboy/MIEngine,chuckries/MIEngine,chuckries/MIEngine,edumunoz/MIEngine,csiusers/MIEngine,orbitcowboy/MIEngine,csiusers/MIEngine,chuckries/MIEngine,Microsoft/MIEngine,csiusers/MIEngine,Microsoft/MIEngine,faxue-msft/MIEngine,orbitcowboy/MIEngine,faxue-msft/MIEngine,edumunoz/MIEngine,pieandcakes/MIEngine,edumunoz/MIEngine,Microsoft/MIEngine,rajkumar42/MIEngine,rajkumar42/MIEngine,pieandcakes/MIEngine
|
src/MICore/Transports/LocalTransport.cs
|
src/MICore/Transports/LocalTransport.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.Collections.Generic;
using System.Text;
using System.Threading;
using System.Diagnostics;
using System.IO;
using System.Collections.Specialized;
using System.Collections;
using System.Runtime.InteropServices;
namespace MICore
{
public class LocalTransport : PipeTransport
{
public LocalTransport()
{
}
public override void InitStreams(LaunchOptions options, out StreamReader reader, out StreamWriter writer)
{
LocalLaunchOptions localOptions = (LocalLaunchOptions)options;
string miDebuggerDir = System.IO.Path.GetDirectoryName(localOptions.MIDebuggerPath);
Process proc = new Process();
proc.StartInfo.FileName = localOptions.MIDebuggerPath;
proc.StartInfo.Arguments = "--interpreter=mi";
// LLDB has the -environment-cd mi command that is used to set the working dir for gdb/clrdbg, but it doesn't work.
// So, set lldb's working dir to the user's requested folder before launch.
proc.StartInfo.WorkingDirectory = options.DebuggerMIMode == MIMode.Lldb ? options.WorkingDirectory : miDebuggerDir;
// On Windows, GDB locally requires that the directory be on the PATH, being the working directory isn't good enough
if (PlatformUtilities.IsWindows() &&
options.DebuggerMIMode == MIMode.Gdb)
{
string path = proc.StartInfo.GetEnvironmentVariable("PATH");
path = (string.IsNullOrEmpty(path) ? miDebuggerDir : path + ";" + miDebuggerDir);
proc.StartInfo.SetEnvironmentVariable("PATH", path);
}
foreach (EnvironmentEntry entry in localOptions.Environment)
{
proc.StartInfo.SetEnvironmentVariable(entry.Name, entry.Value);
}
InitProcess(proc, out reader, out writer);
}
protected override string GetThreadName()
{
return "MI.LocalTransport";
}
}
}
|
// 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.Collections.Generic;
using System.Text;
using System.Threading;
using System.Diagnostics;
using System.IO;
using System.Collections.Specialized;
using System.Collections;
using System.Runtime.InteropServices;
namespace MICore
{
public class LocalTransport : PipeTransport
{
public LocalTransport()
{
}
public override void InitStreams(LaunchOptions options, out StreamReader reader, out StreamWriter writer)
{
LocalLaunchOptions localOptions = (LocalLaunchOptions)options;
string miDebuggerDir = System.IO.Path.GetDirectoryName(localOptions.MIDebuggerPath);
Process proc = new Process();
proc.StartInfo.FileName = localOptions.MIDebuggerPath;
proc.StartInfo.Arguments = "--interpreter=mi";
proc.StartInfo.WorkingDirectory = miDebuggerDir;
// On Windows, GDB locally requires that the directory be on the PATH, being the working directory isn't good enough
if (PlatformUtilities.IsWindows() &&
options.DebuggerMIMode == MIMode.Gdb)
{
string path = proc.StartInfo.GetEnvironmentVariable("PATH");
path = (string.IsNullOrEmpty(path) ? miDebuggerDir : path + ";" + miDebuggerDir);
proc.StartInfo.SetEnvironmentVariable("PATH", path);
}
foreach (EnvironmentEntry entry in localOptions.Environment)
{
proc.StartInfo.SetEnvironmentVariable(entry.Name, entry.Value);
}
InitProcess(proc, out reader, out writer);
}
protected override string GetThreadName()
{
return "MI.LocalTransport";
}
}
}
|
mit
|
C#
|
d14dca7bbb20ceb58bf63dfde0de556f82cbccd6
|
Remove forced height for testing
|
gestaoaju/commerce,gestaoaju/commerce
|
src/Views/App/Dashboard/Overview.cshtml
|
src/Views/App/Dashboard/Overview.cshtml
|
@*
* Copyright (c) gestaoaju.com.br - All rights reserved.
* Licensed under MIT (https://github.com/gestaoaju/commerce/blob/master/LICENSE).
*@
@{ Layout = "~/Views/Shared/_AppLayout.cshtml"; }
@section scripts
{
<script type="text/javascript" src="/js/overview.min.js" asp-append-version="true"></script>
}
<div class="page-title">
Título da página
</div>
<div class="page-content">
Conteúdo da página <strong>Comercial</strong>
</div>
|
@*
* Copyright (c) gestaoaju.com.br - All rights reserved.
* Licensed under MIT (https://github.com/gestaoaju/commerce/blob/master/LICENSE).
*@
@{ Layout = "~/Views/Shared/_AppLayout.cshtml"; }
@section scripts
{
<script type="text/javascript" src="/js/overview.min.js" asp-append-version="true"></script>
}
<div class="page-title">
Título da página
</div>
<div class="page-content">
Conteúdo da página <strong>Comercial</strong>
<div style="height:1000px;"></div>
</div>
|
mit
|
C#
|
dd544f54b52423622aeadf2452608661b8af8bd5
|
Remove unused usings
|
mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard
|
src/Okanshi.Dashboard/InMemoryConfiguration.cs
|
src/Okanshi.Dashboard/InMemoryConfiguration.cs
|
using System.Collections.Generic;
namespace Okanshi.Dashboard
{
public class InMemoryConfiguration : IConfiguration
{
private static readonly List<OkanshiServer> _configuration = new List<OkanshiServer>();
public void Add(OkanshiServer server)
{
_configuration.Add(server);
}
public IEnumerable<OkanshiServer> GetAll()
{
return _configuration.ToArray();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Okanshi.Dashboard
{
public class InMemoryConfiguration : IConfiguration
{
private static readonly List<OkanshiServer> _configuration = new List<OkanshiServer>();
public void Add(OkanshiServer server)
{
_configuration.Add(server);
}
public IEnumerable<OkanshiServer> GetAll()
{
return _configuration.ToArray();
}
}
}
|
mit
|
C#
|
86147cec5da485786668cb607fe12ad2451ce0de
|
Include EnpointName in logging context
|
ucdavis/Purchasing,ucdavis/Purchasing,ucdavis/Purchasing
|
Purchasing.Mvc/Logging/SerilogControllerActionFilter.cs
|
Purchasing.Mvc/Logging/SerilogControllerActionFilter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters;
using Serilog;
namespace Purchasing.Mvc.Logging
{
public class SerilogControllerActionFilter : IActionFilter
{
private readonly IDiagnosticContext _diagnosticContext;
public SerilogControllerActionFilter(IDiagnosticContext diagnosticContext)
{
_diagnosticContext = diagnosticContext;
}
public void OnActionExecuting(ActionExecutingContext context)
{
_diagnosticContext.Set("RouteData", context.ActionDescriptor.RouteValues);
_diagnosticContext.Set("ActionName", context.ActionDescriptor.DisplayName);
_diagnosticContext.Set("ActionId", context.ActionDescriptor.Id);
_diagnosticContext.Set("ValidationState", context.ModelState.IsValid);
var httpContext = context.HttpContext;
var request = httpContext.Request;
// Set all the common properties available for every request
_diagnosticContext.Set("Host", request.Host);
_diagnosticContext.Set("Protocol", request.Protocol);
_diagnosticContext.Set("Scheme", request.Scheme);
// Only set it if available. You're not sending sensitive data in a querystring right?!
if (request.QueryString.HasValue)
{
_diagnosticContext.Set("QueryString", request.QueryString.Value);
}
// Set HttpContext properties
_diagnosticContext.Set("User", httpContext.User.Identity.Name ?? "anonymous");
_diagnosticContext.Set("SessionId", httpContext.Session?.Id ?? "no session");
_diagnosticContext.Set("TraceId", httpContext.TraceIdentifier ?? "no trace");
_diagnosticContext.Set("EndpointName", httpContext.GetEndpoint()?.DisplayName ?? "no endpoint");
}
public void OnActionExecuted(ActionExecutedContext context)
{
// Set the content-type of the Response at this point
_diagnosticContext.Set("ResponseContentType", context.HttpContext.Response.ContentType);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Filters;
using Serilog;
namespace Purchasing.Mvc.Logging
{
public class SerilogControllerActionFilter : IActionFilter
{
private readonly IDiagnosticContext _diagnosticContext;
public SerilogControllerActionFilter(IDiagnosticContext diagnosticContext)
{
_diagnosticContext = diagnosticContext;
}
public void OnActionExecuting(ActionExecutingContext context)
{
_diagnosticContext.Set("RouteData", context.ActionDescriptor.RouteValues);
_diagnosticContext.Set("ActionName", context.ActionDescriptor.DisplayName);
_diagnosticContext.Set("ActionId", context.ActionDescriptor.Id);
_diagnosticContext.Set("ValidationState", context.ModelState.IsValid);
var httpContext = context.HttpContext;
var request = httpContext.Request;
// Set all the common properties available for every request
_diagnosticContext.Set("Host", request.Host);
_diagnosticContext.Set("Protocol", request.Protocol);
_diagnosticContext.Set("Scheme", request.Scheme);
// Only set it if available. You're not sending sensitive data in a querystring right?!
if (request.QueryString.HasValue)
{
_diagnosticContext.Set("QueryString", request.QueryString.Value);
}
// Set User
_diagnosticContext.Set("User", httpContext.User.Identity.Name ?? "anonymous");
_diagnosticContext.Set("SessionId", httpContext.Session?.Id ?? "no session");
_diagnosticContext.Set("TraceId", httpContext.TraceIdentifier ?? "no trace");
// TODO: enable after upgrade to aspnetcore 3.x or higher
//// Retrieve the IEndpointFeature selected for the request
//var endpoint = httpContext.GetEndpoint();
//if (endpoint is object) // endpoint != null
//{
// _diagnosticContext.Set("EndpointName", endpoint.DisplayName);
//}
}
public void OnActionExecuted(ActionExecutedContext context)
{
// Set the content-type of the Response at this point
_diagnosticContext.Set("ResponseContentType", context.HttpContext.Response.ContentType);
}
}
}
|
mit
|
C#
|
f49196712021ad8dd440dae824efe0a3961c9e48
|
Add google analytics tracking code.
|
ivanz/TraktorPlaylistExporter
|
TraktorPlaylistExporter.Web/Views/Shared/_Layout.cshtml
|
TraktorPlaylistExporter.Web/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - <a href="http://ivaz.com">Ivan Zlatev</a></p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-19302892-3', 'playlistexporter.azurewebsites.net');
ga('send', 'pageview');
</script>
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - <a href="http://ivaz.com">Ivan Zlatev</a></p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
98d6af52b9c763e71383c540e39c6194c9815c1b
|
Edit it
|
jogibear9988/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp
|
websocket-sharp/Server/IWebSocketSession.cs
|
websocket-sharp/Server/IWebSocketSession.cs
|
#region License
/*
* IWebSocketSession.cs
*
* The MIT License
*
* Copyright (c) 2013-2014 sta.blockhead
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#endregion
using System;
using WebSocketSharp.Net.WebSockets;
namespace WebSocketSharp.Server
{
/// <summary>
/// Exposes the access to the information in a WebSocket session.
/// </summary>
public interface IWebSocketSession
{
#region Properties
/// <summary>
/// Gets the information in the WebSocket handshake request.
/// </summary>
/// <value>
/// A <see cref="WebSocketContext"/> instance that provides the access to
/// the information in the handshake request.
/// </value>
WebSocketContext Context { get; }
/// <summary>
/// Gets the unique ID of the session.
/// </summary>
/// <value>
/// A <see cref="string"/> that represents the unique ID of the session.
/// </value>
string ID { get; }
/// <summary>
/// Gets the WebSocket subprotocol used in the session.
/// </summary>
/// <value>
/// A <see cref="string"/> that represents the subprotocol if any.
/// </value>
string Protocol { get; }
/// <summary>
/// Gets the time that the session has started.
/// </summary>
/// <value>
/// A <see cref="DateTime"/> that represents the time that the session has started.
/// </value>
DateTime StartTime { get; }
/// <summary>
/// Gets the state of the <see cref="WebSocket"/> used in the session.
/// </summary>
/// <value>
/// One of the <see cref="WebSocketState"/> enum values, indicates the state of
/// the <see cref="WebSocket"/> used in the session.
/// </value>
WebSocketState State { get; }
#endregion
}
}
|
#region License
/*
* IWebSocketSession.cs
*
* The MIT License
*
* Copyright (c) 2013-2014 sta.blockhead
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#endregion
using System;
using WebSocketSharp.Net.WebSockets;
namespace WebSocketSharp.Server
{
/// <summary>
/// Exposes the access to the information in a WebSocket session.
/// </summary>
public interface IWebSocketSession
{
#region Properties
/// <summary>
/// Gets the information in the connection request to the WebSocket service.
/// </summary>
/// <value>
/// A <see cref="WebSocketContext"/> that provides the access to the connection request.
/// </value>
WebSocketContext Context { get; }
/// <summary>
/// Gets the unique ID of the session.
/// </summary>
/// <value>
/// A <see cref="string"/> that represents the unique ID of the session.
/// </value>
string ID { get; }
/// <summary>
/// Gets the WebSocket subprotocol used in the session.
/// </summary>
/// <value>
/// A <see cref="string"/> that represents the subprotocol if any.
/// </value>
string Protocol { get; }
/// <summary>
/// Gets the time that the session has started.
/// </summary>
/// <value>
/// A <see cref="DateTime"/> that represents the time that the session has started.
/// </value>
DateTime StartTime { get; }
/// <summary>
/// Gets the state of the <see cref="WebSocket"/> used in the session.
/// </summary>
/// <value>
/// One of the <see cref="WebSocketState"/> enum values, indicates the state of
/// the <see cref="WebSocket"/> used in the session.
/// </value>
WebSocketState State { get; }
#endregion
}
}
|
mit
|
C#
|
86a51e8adeedacda86369b2c6bdfe554bc8e1759
|
Fix path to compiled lib
|
JonDouglas/XamarinComponents,topgenorth/XamarinComponents,topgenorth/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,JonDouglas/XamarinComponents,topgenorth/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents,JonDouglas/XamarinComponents,JonDouglas/XamarinComponents,xamarin/XamarinComponents,topgenorth/XamarinComponents
|
Android/AndroidThings/build.cake
|
Android/AndroidThings/build.cake
|
#addin nuget:?package=Cake.Xamarin.Build
#addin nuget:?package=Cake.Xamarin
var TARGET = Argument ("t", Argument ("target", "Default"));
var NUGET_VERSION = "0.1-devpreview";
var JAR_VERSION = "0.1-devpreview";
var JAR_URL = string.Format ("https://bintray.com/google/androidthings/download_file?file_path=com%2Fgoogle%2Fandroid%2Fthings%2Fandroidthings%2F{0}%2Fandroidthings-{0}.jar", JAR_VERSION);
var JAR_DEST = "./externals/androidthings.jar";
var DOCS_URL = "https://developer.android.com/things/downloads/com.google.android.things-docs-dp1.zip";
var buildSpec = new BuildSpec () {
Libs = new [] {
new DefaultSolutionBuilder {
SolutionPath = "./Android.Things.sln",
OutputFiles = new [] {
new OutputFileCopy {
FromFile = "./source/bin/Release/Xamarin.Android.Things.dll",
}
}
}
},
NuGets = new [] {
new NuGetInfo { NuSpec = "./nuget/Xamarin.Android.Things.nuspec", Version = NUGET_VERSION },
},
};
Task ("externals")
.Does (() =>
{
if (!DirectoryExists ("./externals/"))
CreateDirectory ("./externals");
if (!FileExists (JAR_DEST))
DownloadFile (JAR_URL, JAR_DEST);
DownloadFile (DOCS_URL, "./externals/docs.zip");
Unzip ("./externals/docs.zip", "./externals/docs");
});
Task ("clean").IsDependentOn ("clean-base").Does (() =>
{
if (DirectoryExists ("./externals"))
DeleteDirectory ("./externals", true);
});
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
RunTarget (TARGET);
|
#addin nuget:?package=Cake.Xamarin.Build
#addin nuget:?package=Cake.Xamarin
var TARGET = Argument ("t", Argument ("target", "Default"));
var NUGET_VERSION = "0.1-devpreview";
var JAR_VERSION = "0.1-devpreview";
var JAR_URL = string.Format ("https://bintray.com/google/androidthings/download_file?file_path=com%2Fgoogle%2Fandroid%2Fthings%2Fandroidthings%2F{0}%2Fandroidthings-{0}.jar", JAR_VERSION);
var JAR_DEST = "./externals/androidthings.jar";
var DOCS_URL = "https://developer.android.com/things/downloads/com.google.android.things-docs-dp1.zip";
var buildSpec = new BuildSpec () {
Libs = new [] {
new DefaultSolutionBuilder {
SolutionPath = "./Android.Things.sln",
OutputFiles = new [] {
new OutputFileCopy {
FromFile = "./src/bin/Release/Xamarin.Android.Things.dll",
}
}
}
},
NuGets = new [] {
new NuGetInfo { NuSpec = "./nuget/Xamarin.Android.Things.nuspec", Version = NUGET_VERSION },
},
};
Task ("externals")
.Does (() =>
{
if (!DirectoryExists ("./externals/"))
CreateDirectory ("./externals");
if (!FileExists (JAR_DEST))
DownloadFile (JAR_URL, JAR_DEST);
DownloadFile (DOCS_URL, "./externals/docs.zip");
Unzip ("./externals/docs.zip", "./externals/docs");
});
Task ("clean").IsDependentOn ("clean-base").Does (() =>
{
if (DirectoryExists ("./externals"))
DeleteDirectory ("./externals", true);
});
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
RunTarget (TARGET);
|
mit
|
C#
|
fb6973e26452f7e100a19879f6a2efb3eb5824bf
|
Remove rechargeAmount
|
andrewjleavitt/SpaceThing
|
Assets/Scripts/ShieldBehavior.cs
|
Assets/Scripts/ShieldBehavior.cs
|
using UnityEngine;
public class ShieldBehavior {
public float amount = 0.0f;
public float rechargeRate = 0.0f;
private float capacity = 0.0f;
private float nextRecharge = 0.0f;
private string shieldName;
public ShieldBehavior(string newShieldName, float newCapacity, float newRechargeAmount, float rechargeRate) {
shieldName = newShieldName;
capacity = newCapacity;
rechargeRate = newRechargeAmount;
amount = capacity;
}
public void Recharge() {
if (amount == capacity) {
return;
}
if (Time.time < nextRecharge) {
return;
}
amount = Mathf.Min(capacity, amount += 1);
nextRecharge = Time.time + rechargeRate;
}
public string Status() {
return amount.ToString();
}
}
|
using UnityEngine;
public class ShieldBehavior {
public float amount = 0.0f;
public float rechargeAmount = 0.0f;
public float rechargeRate = 0.0f;
private float capacity = 0.0f;
private float nextRecharge = 0.0f;
private string shieldName;
public ShieldBehavior(string newShieldName, float newCapacity, float newRechargeAmount, float rechargeRate) {
shieldName = newShieldName;
capacity = newCapacity;
rechargeAmount = newRechargeAmount;
rechargeRate = newRechargeAmount;
amount = capacity;
}
public void Recharge() {
if (amount == capacity) {
return;
}
if (Time.time < nextRecharge) {
return;
}
amount += rechargeAmount;
nextRecharge = Time.time + rechargeRate;
}
public string Status() {
return amount.ToString();
}
}
|
unlicense
|
C#
|
e6030a8b7cc225f2b4efb2243d85e35768388b8d
|
Update Logos.Git version (for new dependencies).
|
LogosBible/LogosGit
|
src/Logos.Git/Properties/AssemblyInfo.cs
|
src/Logos.Git/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Logos.Git")]
[assembly: AssemblyDescription("Utility code for working with local git repos and the GitHub web API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Logos Bible Software")]
[assembly: AssemblyProduct("Logos.Git")]
[assembly: AssemblyCopyright("Copyright 2013-2014 Logos Bible Software")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AssemblyVersion("0.5.2")]
[assembly: AssemblyFileVersion("0.5.2")]
[assembly: AssemblyInformationalVersion("0.5.2")]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Logos.Git")]
[assembly: AssemblyDescription("Utility code for working with local git repos and the GitHub web API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Logos Bible Software")]
[assembly: AssemblyProduct("Logos.Git")]
[assembly: AssemblyCopyright("Copyright 2013 Logos Bible Software")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AssemblyVersion("0.5.1")]
[assembly: AssemblyFileVersion("0.5.1")]
[assembly: AssemblyInformationalVersion("0.5.1")]
|
mit
|
C#
|
609bdf47196316634c913ce11d949262c60ee1d0
|
add extra body extend test
|
r2i-sitecore/dotless,rytmis/dotless,r2i-sitecore/dotless,r2i-sitecore/dotless,dotless/dotless,r2i-sitecore/dotless,rytmis/dotless,r2i-sitecore/dotless,rytmis/dotless,modulexcite/dotless,rytmis/dotless,modulexcite/dotless,modulexcite/dotless,modulexcite/dotless,modulexcite/dotless,rytmis/dotless,modulexcite/dotless,rytmis/dotless,modulexcite/dotless,rytmis/dotless,r2i-sitecore/dotless,dotless/dotless,r2i-sitecore/dotless
|
src/dotless.Test/Specs/ExtendFixture.cs
|
src/dotless.Test/Specs/ExtendFixture.cs
|
using dotless.Core.Parser.Infrastructure;
namespace dotless.Test.Specs
{
using System.Collections.Generic;
using NUnit.Framework;
public class ExtendFixture : SpecFixtureBase
{
[Test]
public void ExtendSelector()
{
string input = @"nav ul:extend(.inline) {
background: blue;
}
.inline {
color: red;
}";
string expected = @"nav ul {
background: blue;
}
.inline,
nav ul {
color: red;
}";
AssertLess(input, expected);
}
[Test]
public void ExtendRuleSet()
{
string input = @"nav ul {
&:extend(.inline);
background: blue;
}
.inline {
color: red;
}";
string expected = @"nav ul {
background: blue;
}
.inline,
nav ul {
color: red;
}";
AssertLess(input, expected);
}
[Test]
public void ExtendSelectorMultiple()
{
string input = @".e:extend(.f, .g) { background-color:green; }
.f { color: red; }
.g { color: blue; }
";
string expected = @".e {
background-color: green;
}
.f,
.e {
color: red;
}
.g,
.e {
color: blue;
}
";
AssertLess(input, expected);
}
[Test]
public void ExtendSelectorAll()
{
string input = @".a.b.test,
.test.c {
color: orange;
}
.test {
&:hover {
color: green;
}
}
.replacement:extend(.test all) {}";
string expected = @".a.b.test,
.test.c,
.a.b.replacement,
.replacement.c {
color: orange;
}
.test:hover,
.replacement:hover {
color: green;
}";
AssertLess(input, expected);
}
[Test]
public void ExtendInsideBodyRuleset()
{
string input = @"
div pre { color:red; }
pre:hover,
.some-class {
&:extend(div pre);
}";
string expected = @"div pre,
pre:hover,
.some-class {
color: red;
}";
}
}
}
|
using dotless.Core.Parser.Infrastructure;
namespace dotless.Test.Specs
{
using System.Collections.Generic;
using NUnit.Framework;
public class ExtendFixture : SpecFixtureBase
{
[Test]
public void ExtendSelector()
{
string input = @"nav ul:extend(.inline) {
background: blue;
}
.inline {
color: red;
}";
string expected = @"nav ul {
background: blue;
}
.inline,
nav ul {
color: red;
}";
AssertLess(input, expected);
}
[Test]
public void ExtendRuleSet()
{
string input = @"nav ul {
&:extend(.inline);
background: blue;
}
.inline {
color: red;
}";
string expected = @"nav ul {
background: blue;
}
.inline,
nav ul {
color: red;
}";
AssertLess(input, expected);
}
[Test]
public void ExtendSelectorMultiple()
{
string input = @".e:extend(.f, .g) { background-color:green; }
.f { color: red; }
.g { color: blue; }
";
string expected = @".e {
background-color: green;
}
.f,
.e {
color: red;
}
.g,
.e {
color: blue;
}
";
AssertLess(input,expected);
}
[Test]
public void ExtendSelectorAll()
{
string input = @".a.b.test,
.test.c {
color: orange;
}
.test {
&:hover {
color: green;
}
}
.replacement:extend(.test all) {}";
string expected = @".a.b.test,
.test.c,
.a.b.replacement,
.replacement.c {
color: orange;
}
.test:hover,
.replacement:hover {
color: green;
}";
AssertLess(input, expected);
}
[Test]
public void ExtendInsideBodyRuleset()
{
string input = @"
div pre { color:red; }
pre:hover,
.some-class {
&:extend(div pre);
}";
string expected = @"div pre,
pre:hover,
.some-class {
color: red;
}";
}
}
}
|
apache-2.0
|
C#
|
22e91e7a925bfcdd69be61b0324f6bc3da5ad8ab
|
add configure await sample
|
Fody/FodyAddinSamples,bcuff/FodyAddinSamples,Fody/FodyAddinSamples
|
ConfigureAwaitSample/ConfigureAwaitSample.cs
|
ConfigureAwaitSample/ConfigureAwaitSample.cs
|
using System.Threading;
using System.Threading.Tasks;
using Fody;
using NUnit.Framework;
[TestFixture]
[ConfigureAwait(false)]
public class ConfigureAwaitSample
{
[Test]
public async void Run()
{
var beforeAwaitId = Thread.CurrentThread.ManagedThreadId;
await Task.Delay(30);
Assert.AreNotEqual(Thread.CurrentThread.ManagedThreadId, beforeAwaitId);
}
}
|
using System.Threading;
using System.Threading.Tasks;
using Fody;
using NUnit.Framework;
[TestFixture]
[ConfigureAwait(false)]
public class ConfigureAwaitSample
{
[Test]
public async void Run()
{
var beforeAwaitId = Thread.CurrentThread.ManagedThreadId;
await Task.Delay(30);
Assert.AreNotEqual(Thread.CurrentThread.ManagedThreadId,beforeAwaitId);
}
}
|
mit
|
C#
|
a7ca3deb62104a77d092fb7dda5a992d13b8a0fd
|
change turret BlendColor to Black
|
billtowin/mega-epic-super-tankz,billtowin/mega-epic-super-tankz
|
modules/myModule/scripts/enemy/turret.cs
|
modules/myModule/scripts/enemy/turret.cs
|
function createTurret(%x_pos, %y_pos, %range, %angle)
{
// Create the sprite.
%turret = new Sprite()
{
class = Turret;
Image = "ToyAssets:HollowArrow";
BodyType = dynamic;
BlendColor = "Black";
LinearDamping = 100;
Position = %x_pos SPC %y_pos;
Angle = %angle;
Size = 3;
SceneLayer = 2;
SceneGroup = 1;
};
%turret.createCircleCollisionShape(%turret.Size.x / 2);
%turretBehavior = TurretBehavior.createInstance();
%turretBehavior.range = %range;
%turretBehavior.resetAngle = %angle;
%turret.addBehavior(%turretBehavior);
//Takes Damage Behavior
%takedamage = TakesDamageBehavior.createInstance();
%takedamage.health = 60;
%takedamage.maxHealth = 60;
%turret.addBehavior(%takedamage);
return %turret;
}
function Turret::onDeath(%this)
{
%this.getScene().add(createExplosion(%this.getPositon(), 1));
%this.safeDelete();
}
|
function createTurret(%x_pos, %y_pos, %range, %angle)
{
// Create the sprite.
%turret = new Sprite()
{
class = Turret;
Image = "ToyAssets:HollowArrow";
BodyType = dynamic;
LinearDamping = 100;
Position = %x_pos SPC %y_pos;
Angle = %angle;
Size = 3;
SceneLayer = 2;
SceneGroup = 1;
};
%turret.createCircleCollisionShape(%turret.Size.x / 2);
%turretBehavior = TurretBehavior.createInstance();
%turretBehavior.range = %range;
%turretBehavior.resetAngle = %angle;
%turret.addBehavior(%turretBehavior);
//Takes Damage Behavior
%takedamage = TakesDamageBehavior.createInstance();
%takedamage.health = 60;
%takedamage.maxHealth = 60;
%turret.addBehavior(%takedamage);
return %turret;
}
function Turret::onDeath(%this)
{
%this.getScene().add(createExplosion(%this.getPositon(), 1));
%this.safeDelete();
}
|
mit
|
C#
|
133721888b52153dc563ed35c76bc105c8f96cf7
|
Correct test for TeamCity status
|
beeker/FAKE,MiloszKrajewski/FAKE,beeker/FAKE,beeker/FAKE,MiloszKrajewski/FAKE,MiloszKrajewski/FAKE,MiloszKrajewski/FAKE,beeker/FAKE
|
src/test/Test.FAKECore/TeamCitySpecs.cs
|
src/test/Test.FAKECore/TeamCitySpecs.cs
|
using System.Collections.Generic;
using System.Linq;
using Fake;
using Machine.Specifications;
namespace Test.FAKECore
{
public class when_encapsuting_strings
{
It should_encapsulate_without_special_chars =
() => TeamCityHelper.EncapsulateSpecialChars("Total 47, Failures 1, NotRun 0, Inconclusive 0, Skipped 0")
.ShouldEqual("Total 47, Failures 1, NotRun 0, Inconclusive 0, Skipped 0");
}
public class when_creating_buildstatus
{
It should_encapsulate_special_chars =
() => TeamCityHelper.buildStatus("FAILURE", "Total 47, Failures 1, NotRun 0, Inconclusive 0, Skipped 0")
.ShouldEqual("##teamcity[buildStatus status='FAILURE' text='Total 47, Failures 1, NotRun 0, Inconclusive 0, Skipped 0']");
}
}
|
using System.Collections.Generic;
using System.Linq;
using Fake;
using Machine.Specifications;
namespace Test.FAKECore
{
public class when_encapsuting_strings
{
It should_encapsulate_without_special_chars =
() => TeamCityHelper.EncapsulateSpecialChars("Total 47, Failures 1, NotRun 0, Inconclusive 0, Skipped 0")
.ShouldEqual("Total 47, Failures 1, NotRun 0, Inconclusive 0, Skipped 0");
}
public class when_creating_buildstatus
{
It should_encapsulate_special_chars =
() => TeamCityHelper.buildStatus("FAILURE", "Total 47, Failures 1, NotRun 0, Inconclusive 0, Skipped 0")
.ShouldEqual("##teamcity[buildStatus 'FAILURE' text='Total 47, Failures 1, NotRun 0, Inconclusive 0, Skipped 0']");
}
}
|
apache-2.0
|
C#
|
cc4df1b890198175155550b00cd123e557861394
|
Format contribution info as annotation
|
cake-contrib/Cake.Issues.Website,cake-contrib/Cake.Issues.Website,cake-contrib/Cake.Issues.Website
|
input/docs/index.cshtml
|
input/docs/index.cshtml
|
---
Title: Documentation
---
<div class="alert alert-info">
<p>
We gladly accept your contributions. If there is something that you would like to add then you can edit the content directly on GitHub.
</p>
</div>
@foreach(IDocument child in Model.DocumentList(Keys.Children).OrderBy(x => x.Get<int>(DocsKeys.Order, 1000)))
{
<h1>@(child.String(Keys.Title))</h1>
if(child.ContainsKey(DocsKeys.Description))
{
<p>@Html.Raw(child.String(DocsKeys.Description))</p>
}
@Html.Partial("_ChildPages", child)
}
|
---
Title: Documentation
---
<p>
We gladly accept your contributions. If there is something that you would like to add then you can edit the content directly on GitHub.
</p>
@foreach(IDocument child in Model.DocumentList(Keys.Children).OrderBy(x => x.Get<int>(DocsKeys.Order, 1000)))
{
<h1>@(child.String(Keys.Title))</h1>
if(child.ContainsKey(DocsKeys.Description))
{
<p>@Html.Raw(child.String(DocsKeys.Description))</p>
}
@Html.Partial("_ChildPages", child)
}
|
mit
|
C#
|
d429caf9975b283348e743c1e7eccef4b7ce5665
|
Update ServiceCollectionApplier.cs
|
mrahhal/MR.AttributeDI
|
src/MR.AttributeDI.ServiceCollection/ServiceCollectionApplier.cs
|
src/MR.AttributeDI.ServiceCollection/ServiceCollectionApplier.cs
|
using System;
using Microsoft.Extensions.DependencyInjection;
namespace MR.AttributeDI.ServiceCollection
{
/// <summary>
/// An applier for Microsoft's <see cref="IServiceCollection"/>.
/// </summary>
public class ServiceCollectionApplier : IApplier
{
private readonly IServiceCollection _services;
public ServiceCollectionApplier(IServiceCollection services)
{
_services = services ?? throw new ArgumentNullException(nameof(services));
}
public void Apply(ApplierContext context)
{
if (context.ForwardTo == null)
{
_services.Add(new ServiceDescriptor(
context.Service,
context.Implementation,
Convert(context.Lifetime)));
}
else
{
_services.Add(new ServiceDescriptor(
context.Service,
provider => provider.GetService(context.ForwardTo),
Convert(context.Lifetime)));
}
}
private ServiceLifetime Convert(Lifetime lifetime)
{
switch (lifetime)
{
case Lifetime.Singleton:
return ServiceLifetime.Singleton;
case Lifetime.Scoped:
return ServiceLifetime.Scoped;
case Lifetime.Transient:
default:
return ServiceLifetime.Transient;
}
}
}
}
|
using System;
using Microsoft.Extensions.DependencyInjection;
namespace MR.AttributeDI.ServiceCollection
{
/// <summary>
/// An applier for Microsoft's <see cref="IServiceCollection"/>.
/// </summary>
public class ServiceCollectionApplier : IApplier
{
private IServiceCollection _services;
public ServiceCollectionApplier(IServiceCollection services)
{
if (services == null)
throw new ArgumentNullException(nameof(services));
_services = services;
}
public void Apply(ApplierContext context)
{
if (context.ForwardTo == null)
{
_services.Add(new ServiceDescriptor(
context.Service,
context.Implementation,
Convert(context.Lifetime)));
}
else
{
_services.Add(new ServiceDescriptor(
context.Service,
provider => provider.GetService(context.ForwardTo),
Convert(context.Lifetime)));
}
}
private ServiceLifetime Convert(Lifetime lifetime)
{
switch (lifetime)
{
case Lifetime.Singleton:
return ServiceLifetime.Singleton;
case Lifetime.Scoped:
return ServiceLifetime.Scoped;
case Lifetime.Transient:
default:
return ServiceLifetime.Transient;
}
}
}
}
|
mit
|
C#
|
226eefcc5c0a87d26962b4c22b68b2e53211535e
|
Add note about hash storage
|
ppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu
|
osu.Game/Collections/BeatmapCollection.cs
|
osu.Game/Collections/BeatmapCollection.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Game.Beatmaps;
using osu.Game.Database;
using Realms;
namespace osu.Game.Collections
{
/// <summary>
/// A collection of beatmaps grouped by a name.
/// </summary>
public class BeatmapCollection : RealmObject, IHasGuidPrimaryKey
{
[PrimaryKey]
public Guid ID { get; set; }
/// <summary>
/// The collection's name.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// The <see cref="BeatmapInfo.MD5Hash"/>es of beatmaps contained by the collection.
/// </summary>
/// <remarks>
/// We store as hashes rather than references to <see cref="BeatmapInfo"/>s to allow collections to maintain
/// references to beatmaps even if they are removed. This helps with cases like importing collections before
/// importing the beatmaps they contain, or when sharing collections between users.
///
/// This can probably change in the future as we build the system up.
/// </remarks>
public IList<string> BeatmapMD5Hashes { get; } = null!;
/// <summary>
/// The date when this collection was last modified.
/// </summary>
public DateTimeOffset LastModified { get; set; }
public BeatmapCollection(string? name = null, IList<string>? beatmapMD5Hashes = null)
{
ID = Guid.NewGuid();
Name = name ?? string.Empty;
BeatmapMD5Hashes = beatmapMD5Hashes ?? new List<string>();
LastModified = DateTimeOffset.UtcNow;
}
[UsedImplicitly]
private BeatmapCollection()
{
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Game.Beatmaps;
using osu.Game.Database;
using Realms;
namespace osu.Game.Collections
{
/// <summary>
/// A collection of beatmaps grouped by a name.
/// </summary>
public class BeatmapCollection : RealmObject, IHasGuidPrimaryKey
{
[PrimaryKey]
public Guid ID { get; set; }
/// <summary>
/// The collection's name.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// The <see cref="BeatmapInfo.MD5Hash"/>es of beatmaps contained by the collection.
/// </summary>
public IList<string> BeatmapMD5Hashes { get; } = null!;
/// <summary>
/// The date when this collection was last modified.
/// </summary>
public DateTimeOffset LastModified { get; set; }
public BeatmapCollection(string? name = null, IList<string>? beatmapMD5Hashes = null)
{
ID = Guid.NewGuid();
Name = name ?? string.Empty;
BeatmapMD5Hashes = beatmapMD5Hashes ?? new List<string>();
LastModified = DateTimeOffset.UtcNow;
}
[UsedImplicitly]
private BeatmapCollection()
{
}
}
}
|
mit
|
C#
|
9344897542ff6b6463d8377d61f63b3ec0c8b5b3
|
Split session statics reset method to prevent unloading seasonal backgrounds while idle
|
NeoAdonis/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu
|
osu.Game/Configuration/SessionStatics.cs
|
osu.Game/Configuration/SessionStatics.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.Bindables;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
namespace osu.Game.Configuration
{
/// <summary>
/// Stores global per-session statics. These will not be stored after exiting the game.
/// </summary>
public class SessionStatics : InMemoryConfigManager<Static>
{
protected override void InitialiseDefaults()
{
ensureDefault(SetDefault(Static.LoginOverlayDisplayed, false));
ensureDefault(SetDefault(Static.MutedAudioNotificationShownOnce, false));
ensureDefault(SetDefault(Static.LowBatteryNotificationShownOnce, false));
ensureDefault(SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null));
ensureDefault(SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null));
}
/// <summary>
/// Used to revert statics to their defaults after being idle for appropiate amount of time.
/// Does not affect loaded seasonal backgrounds.
/// </summary>
public void ResetValues()
{
ensureDefault(GetBindable<bool>(Static.LoginOverlayDisplayed));
ensureDefault(GetBindable<bool>(Static.MutedAudioNotificationShownOnce));
ensureDefault(GetBindable<bool>(Static.LowBatteryNotificationShownOnce));
ensureDefault(GetBindable<double?>(Static.LastHoverSoundPlaybackTime));
}
private void ensureDefault<T>(Bindable<T> bindable) => bindable.SetDefault();
}
public enum Static
{
LoginOverlayDisplayed,
MutedAudioNotificationShownOnce,
LowBatteryNotificationShownOnce,
/// <summary>
/// Info about seasonal backgrounds available fetched from API - see <see cref="APISeasonalBackgrounds"/>.
/// Value under this lookup can be <c>null</c> if there are no backgrounds available (or API is not reachable).
/// </summary>
SeasonalBackgrounds,
/// <summary>
/// The last playback time in milliseconds of a hover sample (from <see cref="HoverSounds"/>).
/// Used to debounce hover sounds game-wide to avoid volume saturation, especially in scrolling views with many UI controls like <see cref="SettingsOverlay"/>.
/// </summary>
LastHoverSoundPlaybackTime
}
}
|
// 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.Bindables;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
namespace osu.Game.Configuration
{
/// <summary>
/// Stores global per-session statics. These will not be stored after exiting the game.
/// </summary>
public class SessionStatics : InMemoryConfigManager<Static>
{
protected override void InitialiseDefaults() => ResetValues();
public void ResetValues()
{
ensureDefault(SetDefault(Static.LoginOverlayDisplayed, false));
ensureDefault(SetDefault(Static.MutedAudioNotificationShownOnce, false));
ensureDefault(SetDefault(Static.LowBatteryNotificationShownOnce, false));
ensureDefault(SetDefault(Static.LastHoverSoundPlaybackTime, (double?)null));
ensureDefault(SetDefault<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null));
}
private void ensureDefault<T>(Bindable<T> bindable) => bindable.SetDefault();
}
public enum Static
{
LoginOverlayDisplayed,
MutedAudioNotificationShownOnce,
LowBatteryNotificationShownOnce,
/// <summary>
/// Info about seasonal backgrounds available fetched from API - see <see cref="APISeasonalBackgrounds"/>.
/// Value under this lookup can be <c>null</c> if there are no backgrounds available (or API is not reachable).
/// </summary>
SeasonalBackgrounds,
/// <summary>
/// The last playback time in milliseconds of a hover sample (from <see cref="HoverSounds"/>).
/// Used to debounce hover sounds game-wide to avoid volume saturation, especially in scrolling views with many UI controls like <see cref="SettingsOverlay"/>.
/// </summary>
LastHoverSoundPlaybackTime
}
}
|
mit
|
C#
|
8f4d3e8f3e432fe3bf15d0117714c655e1a00905
|
bump to 3.16.0
|
AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/azure-activedirectory-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet
|
src/ADAL.Common/CommonAssemblyInfo.cs
|
src/ADAL.Common/CommonAssemblyInfo.cs
|
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: AssemblyProduct("Active Directory Authentication Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyFileVersion("3.16.0.0")]
// On official build, attribute AssemblyInformationalVersionAttribute is added as well
// with its value equal to the hash of the last commit to the git branch.
// e.g.: [assembly: AssemblyInformationalVersionAttribute("4392c9835a38c27516fc0cd7bad7bccdcaeab161")]
[assembly: CLSCompliant(false)]
|
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: AssemblyProduct("Active Directory Authentication Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyFileVersion("3.15.1.0")]
// On official build, attribute AssemblyInformationalVersionAttribute is added as well
// with its value equal to the hash of the last commit to the git branch.
// e.g.: [assembly: AssemblyInformationalVersionAttribute("4392c9835a38c27516fc0cd7bad7bccdcaeab161")]
[assembly: CLSCompliant(false)]
|
mit
|
C#
|
6cee7e1a5a9feb72e1835e960c2fee50fd01cb25
|
升级版本到2.3.4
|
tangxuehua/equeue,geffzhang/equeue,geffzhang/equeue,tangxuehua/equeue,tangxuehua/equeue
|
src/EQueue/Properties/AssemblyInfo.cs
|
src/EQueue/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.4")]
[assembly: AssemblyFileVersion("2.3.4")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.3")]
[assembly: AssemblyFileVersion("2.3.3")]
|
mit
|
C#
|
a7f2d06b4ad73ff664e1b0cc8e0086c57b214c60
|
update HelloWorld example
|
jingwood/d2dlib,jingwood/d2dlib,jingwood/d2dlib
|
src/Examples/SampleCode/HelloWorld.cs
|
src/Examples/SampleCode/HelloWorld.cs
|
/*
* MIT License
*
* Copyright (c) 2009-2018 Jingwood, unvell.com. All right reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using unvell.D2DLib.WinForm;
namespace unvell.D2DLib.Examples.SampleCode
{
public partial class HelloWorld : ExampleForm
{
public HelloWorld()
{
Text = "HelloWorld - d2dlib Examples";
}
protected override void OnRender(D2DGraphics g)
{
g.FillPolygon(new D2DPoint[] { new D2DPoint(100, 100), new D2DPoint(150, 150), new D2DPoint(100, 150) }, D2DColor.Red);
g.DrawText("Text drawed via Direct2D API (d2dlib)", D2DColor.Black, "Arial", 24, 140, 110);
}
}
}
|
/*
* MIT License
*
* Copyright (c) 2009-2018 Jingwood, unvell.com. All right reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using unvell.D2DLib.WinForm;
namespace unvell.D2DLib.Examples.Demos
{
public partial class HelloWorld : ExampleForm
{
public HelloWorld()
{
Text = "HelloWorld - d2dlib Examples";
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
protected override void OnRender(D2DGraphics g)
{
base.OnRender(g);
g.DrawText("Text drawed via Direct2D API (d2dlib)", D2DColor.Black, 100, 100);
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
}
}
}
|
mit
|
C#
|
b3be5d55fa6563e6bff656aa5938f2b0bc8c6698
|
Add another test.
|
KirillOsenkov/MathParser
|
src/GuiLabs.MathParser.Tests/Tests.cs
|
src/GuiLabs.MathParser.Tests/Tests.cs
|
using System;
using System.Collections.Generic;
using Xunit;
namespace GuiLabs.MathParser.Tests
{
public class Tests
{
[Fact]
public void TestParser()
{
Binder.Default.RegisterVariable("Random", () => new Random(1).NextDouble());
var compiler = new Compiler();
var compilation = compiler.CompileExpression("Random");
if (compilation.IsSuccess)
{
var result = compilation.Expression();
}
}
[Fact]
public void ToStringTests()
{
var expressions = new Dictionary<string, string>
{
{ "2+3", "2 + 3" },
{ "(2+3)*2", "(2 + 3) * 2" },
{ "pi+e", "pi + e" },
{ "(pi+e)", "pi + e" },
{ "sin(pi+e)", "sin(pi + e)" },
{ "(((((365) * 4 + 1) * 25 - 1) * 4 + 1) * 25 - 366) * (10000 * 1000 * 60 * 60 * 24) - 1", "(((((((((365 * 4) + 1) * 25) - 1) * 4) + 1) * 25) - 366) * ((((10000 * 1000) * 60) * 60) * 24)) - 1" }
};
var tautologies = new[]
{
"2 + 3",
"1",
"(3 * 4) + 2"
};
foreach (var tautology in tautologies)
{
Assert.Equal(tautology, Parser.Parse(tautology).Root.ToString());
}
foreach (var expression in expressions)
{
Assert.Equal(expression.Value, Parser.Parse(expression.Key).Root.ToString());
}
}
}
}
|
using System;
using System.Collections.Generic;
using Xunit;
namespace GuiLabs.MathParser.Tests
{
public class Tests
{
[Fact]
public void TestParser()
{
Binder.Default.RegisterVariable("Random", () => new Random(1).NextDouble());
var compiler = new Compiler();
var compilation = compiler.CompileExpression("Random");
if (compilation.IsSuccess)
{
var result = compilation.Expression();
}
}
[Fact]
public void ToStringTests()
{
var expressions = new Dictionary<string, string>
{
{ "2+3", "2 + 3" },
{ "(2+3)*2", "(2 + 3) * 2" },
{ "pi+e", "pi + e" },
{ "(pi+e)", "pi + e" },
{ "sin(pi+e)", "sin(pi + e)" },
};
var tautologies = new[]
{
"2 + 3",
"1",
"(3 * 4) + 2"
};
foreach (var tautology in tautologies)
{
Assert.Equal(tautology, Parser.Parse(tautology).Root.ToString());
}
foreach (var expression in expressions)
{
Assert.Equal(expression.Value, Parser.Parse(expression.Key).Root.ToString());
}
}
}
}
|
mit
|
C#
|
a0c1d22d2cf2d8ba5999a4f9e0dfb36a00d68198
|
Fix HttpPoster, and add server script
|
arfbtwn/hyena,GNOME/hyena,GNOME/hyena,dufoli/hyena,petejohanson/hyena,petejohanson/hyena,dufoli/hyena,arfbtwn/hyena
|
src/Hyena/Hyena.Metrics/HttpPoster.cs
|
src/Hyena/Hyena.Metrics/HttpPoster.cs
|
//
// HttpPoster.cs
//
// Author:
// Gabriel Burt <gabriel.burt@gmail.com>
//
// Copyright (c) 2010 Novell, 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.
using System;
using System.IO;
using System.Net;
namespace Hyena.Metrics
{
public class HttpPoster
{
private string url;
private MetricsCollection metrics;
public HttpPoster (string url, MetricsCollection metrics)
{
this.url = url;
this.metrics = metrics;
}
public bool Post ()
{
var request = (HttpWebRequest) WebRequest.Create (url);
request.Timeout = 30 * 1000;
request.Method = "POST";
request.KeepAlive = false;
request.ContentType = "text/json";
request.AllowAutoRedirect = true;
try {
using (var stream = request.GetRequestStream ()) {
using (var writer = new StreamWriter (stream)) {
writer.Write (metrics.ToJsonString ());
}
}
var response = (HttpWebResponse) request.GetResponse ();
using (var strm = new StreamReader (response.GetResponseStream ())) {
Console.WriteLine (strm.ReadToEnd ());
}
return response.StatusCode == HttpStatusCode.OK;
} catch (Exception e) {
Log.Exception ("Error posting metrics", e);
}
return false;
}
}
}
|
//
// HttpPoster.cs
//
// Author:
// Gabriel Burt <gabriel.burt@gmail.com>
//
// Copyright (c) 2010 Novell, 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.
using System;
using System.IO;
using System.Net;
/*namespace Hyena.Metrics
{
public class HttpPoster
{
private string url;
private MetricsCollection metrics;
public void HttpPoster (string url, MetricsCollection metrics)
{
this.url = url;
this.metrics = metrics;
}
public bool Post ()
{
var request = (HttpWebRequest) WebRequest.Create (url);
request.Timeout = 30 * 1000;
request.Method = "POST";
request.KeepAlive = false;
request.ContentType = "text/json";
request.AllowAutoRedirect = true;
try {
using (var stream = request.GetRequestStream ()) {
using (var writer = new StreamWriter (stream)) {
foreach (var metric in metrics.Metrics) {
writer.Write (metric.ToString ());
}
}
}
var response = (HttpWebResponse) request.GetResponse ();
return response.StatusCode == HttpStatusCode.OK;
} catch (Exception e) {
Log.Exception ("Error posting metrics", e);
}
return false;
}
}
}*/
|
mit
|
C#
|
1c2fd2e8fa6fe43f15fa71fbac897cf1aea627c3
|
Update to Loader Interface
|
thinkabouthub/Nugety
|
src/Nugety.Nuget/NugetModuleLoader.cs
|
src/Nugety.Nuget/NugetModuleLoader.cs
|
using System.Collections.Generic;
using System.Reflection;
namespace Nugety
{
public class NugetModuleLoader : INugetModuleLoader
{
private NugetLoaderOptions options;
public NugetModuleLoader(INugetyCatalogProvider catalog)
{
Catalog = catalog;
}
public INugetyCatalogProvider Catalog { get; }
public NugetLoaderOptions Options => options ?? (options = new NugetLoaderOptions(this));
public virtual IEnumerable<ModuleInfo<T>> GetModules<T>(params string[] name)
{
return null;
}
public virtual AssemblyInfo LoadAssembly(ModuleInfo module, AssemblyName name)
{
return null;
}
public virtual AssemblyInfo ResolveAssembly(ModuleInfo module, AssemblyName name, AssemblySearchModes modes)
{
return null;
}
}
}
|
using System.Collections.Generic;
using System.Reflection;
namespace Nugety
{
public class NugetModuleLoader : INugetModuleLoader
{
private NugetLoaderOptions options;
public NugetModuleLoader(INugetyCatalogProvider catalog)
{
Catalog = catalog;
}
public INugetyCatalogProvider Catalog { get; }
public NugetLoaderOptions Options => options ?? (options = new NugetLoaderOptions(this));
public virtual IEnumerable<ModuleInfo<T>> GetModules<T>(params string[] name)
{
return null;
}
public virtual AssemblyInfo LoadAssembly(ModuleInfo module, AssemblyName name)
{
return null;
}
public virtual AssemblyInfo ResolveAssembly(ModuleInfo module, AssemblyName name)
{
return null;
}
}
}
|
agpl-3.0
|
C#
|
1a05d22f3142e9c473e30bfcea24912122e6af20
|
Fix a few for HttpBasicIdentity.cs
|
microdee/websocket-sharp,pjc0247/websocket-sharp-unity,TabbedOut/websocket-sharp,pjc0247/websocket-sharp-unity,sta/websocket-sharp,zq513705971/WebSocketApp,alberist/websocket-sharp,juoni/websocket-sharp,Liryna/websocket-sharp,zhangwei900808/websocket-sharp,microdee/websocket-sharp,alberist/websocket-sharp,Liryna/websocket-sharp,juoni/websocket-sharp,TabbedOut/websocket-sharp,alberist/websocket-sharp,hybrid1969/websocket-sharp,jjrdk/websocket-sharp,jmptrader/websocket-sharp,zq513705971/WebSocketApp,sta/websocket-sharp,2Toad/websocket-sharp,prepare/websocket-sharp,hybrid1969/websocket-sharp,jmptrader/websocket-sharp,sinha-abhishek/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,TabbedOut/websocket-sharp,sinha-abhishek/websocket-sharp,jjrdk/websocket-sharp,sta/websocket-sharp,zhangwei900808/websocket-sharp,alberist/websocket-sharp,2Toad/websocket-sharp,microdee/websocket-sharp,jogibear9988/websocket-sharp,jmptrader/websocket-sharp,Liryna/websocket-sharp,sinha-abhishek/websocket-sharp,zq513705971/WebSocketApp,prepare/websocket-sharp,jogibear9988/websocket-sharp,pjc0247/websocket-sharp-unity,2Toad/websocket-sharp,hybrid1969/websocket-sharp,juoni/websocket-sharp,zq513705971/WebSocketApp,microdee/websocket-sharp,zhangwei900808/websocket-sharp,juoni/websocket-sharp,jmptrader/websocket-sharp,TabbedOut/websocket-sharp,prepare/websocket-sharp,sinha-abhishek/websocket-sharp,prepare/websocket-sharp,zhangwei900808/websocket-sharp,hybrid1969/websocket-sharp,pjc0247/websocket-sharp-unity,sta/websocket-sharp,2Toad/websocket-sharp
|
websocket-sharp/Net/HttpBasicIdentity.cs
|
websocket-sharp/Net/HttpBasicIdentity.cs
|
#region License
/*
* HttpBasicIdentity.cs
*
* This code is derived from System.Net.HttpListenerBasicIdentity.cs of Mono
* (http://www.mono-project.com).
*
* The MIT License
*
* Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
* Copyright (c) 2014 sta.blockhead
*
* 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
#region Authors
/*
* Authors:
* - Gonzalo Paniagua Javier <gonzalo@novell.com>
*/
#endregion
using System;
using System.Security.Principal;
namespace WebSocketSharp.Net
{
/// <summary>
/// Holds the user name and password from the HTTP Basic authentication credentials.
/// </summary>
public class HttpBasicIdentity : GenericIdentity
{
#region Private Fields
private string _password;
#endregion
#region internal Constructors
internal HttpBasicIdentity (string username, string password)
: base (username, "Basic")
{
_password = password;
}
#endregion
#region Public Properties
/// <summary>
/// Gets the password from the HTTP Basic authentication credentials.
/// </summary>
/// <value>
/// A <see cref="string"/> that represents the password.
/// </value>
public virtual string Password {
get {
return _password;
}
}
#endregion
}
}
|
#region License
/*
* HttpBasicIdentity.cs
*
* This code is derived from System.Net.HttpListenerBasicIdentity.cs of Mono
* (http://www.mono-project.com).
*
* The MIT License
*
* Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
* Copyright (c) 2014 sta.blockhead
*
* 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
#region Authors
/*
* Authors:
* - Gonzalo Paniagua Javier <gonzalo@novell.com>
*/
#endregion
using System;
using System.Security.Principal;
namespace WebSocketSharp.Net
{
/// <summary>
/// Holds the user name and password from an HTTP Basic authentication credentials.
/// </summary>
public class HttpBasicIdentity : GenericIdentity
{
#region Private Fields
private string _password;
#endregion
#region internal Constructors
internal HttpBasicIdentity (string username, string password)
: base (username, "Basic")
{
_password = password;
}
#endregion
#region Public Properties
/// <summary>
/// Gets the password from an HTTP Basic authentication credentials.
/// </summary>
/// <value>
/// A <see cref="string"/> that represents the password.
/// </value>
public virtual string Password {
get {
return _password;
}
}
#endregion
}
}
|
mit
|
C#
|
09caaa3a900a1d7299b47425340874b4f59c6a5a
|
Add required defaults for tests
|
bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity,bugsnag/bugsnag-unity
|
tests/Bugsnag.Unity.Tests/TestConfiguration.cs
|
tests/Bugsnag.Unity.Tests/TestConfiguration.cs
|
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Bugsnag.Unity.Tests
{
public class TestConfiguration : IConfiguration
{
public TimeSpan MaximumLogsTimePeriod { get; set; } = TimeSpan.FromSeconds(1);
public Dictionary<LogType, int> MaximumTypePerTimePeriod { get; set; }
public TimeSpan UniqueLogsTimePeriod { get; set; } = TimeSpan.FromSeconds(5);
public string ApiKey { get; set; }
public int MaximumBreadcrumbs { get; set; }
public string ReleaseStage { get; set; }
public string AppVersion { get; set; }
public Uri Endpoint { get; set; }
public string PayloadVersion { get; set; }
public Uri SessionEndpoint { get; set; }
public string SessionPayloadVersion { get; set; }
public string Context { get; set; }
public LogType NotifyLevel { get; set; }
public bool AutoNotify { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Bugsnag.Unity.Tests
{
public class TestConfiguration : IConfiguration
{
public TimeSpan MaximumLogsTimePeriod { get; set; }
public Dictionary<LogType, int> MaximumTypePerTimePeriod { get; set; }
public TimeSpan UniqueLogsTimePeriod { get; set; }
public string ApiKey { get; set; }
public int MaximumBreadcrumbs { get; set; }
public string ReleaseStage { get; set; }
public string AppVersion { get; set; }
public Uri Endpoint { get; set; }
public string PayloadVersion { get; set; }
public Uri SessionEndpoint { get; set; }
public string SessionPayloadVersion { get; set; }
public string Context { get; set; }
public LogType NotifyLevel { get; set; }
public bool AutoNotify { get; set; }
}
}
|
mit
|
C#
|
f7636789d9db31816f3fdbfd7e21468761aa4925
|
Use setting candles on CandleStickChart
|
alexeykuzmin0/DTW
|
DTW/GUI/MainForm.cs
|
DTW/GUI/MainForm.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GUI
{
public partial class MainForm : Form
{
Finance.AbstractCandleTokenizer ct;
public MainForm()
{
InitializeComponent();
}
private async void openDataToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
toolStripStatusLabel1.Text = "Loading...";
if (ct == null)
{
ct = await Finance.CandleTokenizer.CreateAsync(
new System.IO.StreamReader(openFileDialog1.FileName));
}
else
{
var ct2 = await Finance.CandleTokenizer.CreateAsync(
new System.IO.StreamReader(openFileDialog1.FileName));
ct = new Finance.DisjointMergeCandleTokenizer(ct, ct2);
}
candleStickChart1.SetCandles(ct);
toolStripStatusLabel1.Text = "Loaded " + openFileDialog1.FileName;
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private async void saveDataToolStripMenuItem_Click(object sender, EventArgs e)
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
toolStripStatusLabel1.Text = "Saving...";
await ct.SaveAsync(new System.IO.StreamWriter(saveFileDialog1.FileName));
toolStripStatusLabel1.Text = "Saved " + saveFileDialog1.FileName;
}
}
private void clearDataToolStripMenuItem_Click(object sender, EventArgs e)
{
ct = null;
candleStickChart1.SetCandles(ct);
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GUI
{
public partial class MainForm : Form
{
Finance.AbstractCandleTokenizer ct;
public MainForm()
{
InitializeComponent();
}
private async void openDataToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
toolStripStatusLabel1.Text = "Loading...";
if (ct == null)
{
ct = await Finance.CandleTokenizer.CreateAsync(
new System.IO.StreamReader(openFileDialog1.FileName));
}
else
{
var ct2 = await Finance.CandleTokenizer.CreateAsync(
new System.IO.StreamReader(openFileDialog1.FileName));
ct = new Finance.DisjointMergeCandleTokenizer(ct, ct2);
}
toolStripStatusLabel1.Text = "Loaded " + openFileDialog1.FileName;
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private async void saveDataToolStripMenuItem_Click(object sender, EventArgs e)
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
toolStripStatusLabel1.Text = "Saving...";
await ct.SaveAsync(new System.IO.StreamWriter(saveFileDialog1.FileName));
toolStripStatusLabel1.Text = "Saved " + saveFileDialog1.FileName;
}
}
private void clearDataToolStripMenuItem_Click(object sender, EventArgs e)
{
ct = null;
}
}
}
|
apache-2.0
|
C#
|
a07177e0bb537e1653e8f5457289e24b6bd4171b
|
Bump version to 1.0.0rc2
|
github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity
|
common/SolutionInfo.cs
|
common/SolutionInfo.cs
|
#pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
// this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics
internal const string VersionForAssembly = "1.0.0";
// Actual real version
internal const string Version = "1.0.0rc2";
}
}
|
#pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
// this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics
internal const string VersionForAssembly = "1.0.0";
// Actual real version
internal const string Version = "1.0.0rc1";
}
}
|
mit
|
C#
|
cb5d244a9570b6620655acd0d10497b8925a2f69
|
use the specialfolder enum instead of a magic string for localappdata path detection
|
SexyFishHorse/CitiesSkylines-Logger
|
Logger/OutputLog.cs
|
Logger/OutputLog.cs
|
namespace SexyFishHorse.CitiesSkylines.Logger
{
using System;
using System.IO;
internal class OutputLog
{
public OutputLog(string modFolderName, string logFileName)
{
FileLocation = GenerateFileLocationPath(modFolderName, logFileName);
}
public string FileLocation { get; private set; }
public void ClearLog()
{
File.Delete(FileLocation);
}
public void Write(string message)
{
using (var file = File.AppendText(FileLocation))
{
file.WriteLine(message);
}
}
private static string GenerateContainingFolderPath(string modFolderName)
{
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var path = Path.Combine(localAppData, "Colossal Order");
path = Path.Combine(path, "Cities_Skylines");
path = Path.Combine(path, "Addons");
path = Path.Combine(path, "Mods");
path = Path.Combine(path, modFolderName);
return path;
}
private static string GenerateFileLocationPath(string modFolderName, string logFileName)
{
var path = GenerateContainingFolderPath(modFolderName);
path = Path.Combine(path, logFileName);
return path;
}
}
}
|
namespace SexyFishHorse.CitiesSkylines.Logger
{
using System;
using System.IO;
internal class OutputLog
{
public OutputLog(string modFolderName, string logFileName)
{
FileLocation = GenerateFileLocationPath(modFolderName, logFileName);
}
public string FileLocation { get; private set; }
public void ClearLog()
{
File.Delete(FileLocation);
}
public void Write(string message)
{
using (var file = File.AppendText(FileLocation))
{
file.WriteLine(message);
}
}
private static string GenerateContainingFolderPath(string modFolderName)
{
var path = Path.Combine(Environment.GetEnvironmentVariable("LOCALAPPDATA"), "Colossal Order");
path = Path.Combine(path, "Cities_Skylines");
path = Path.Combine(path, "Addons");
path = Path.Combine(path, "Mods");
path = Path.Combine(path, modFolderName);
return path;
}
private static string GenerateFileLocationPath(string modFolderName, string logFileName)
{
var path = GenerateContainingFolderPath(modFolderName);
path = Path.Combine(path, logFileName);
return path;
}
}
}
|
mit
|
C#
|
46d19e68f953ad61ca8b90dfffce95b966190677
|
Update RegionFactory.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Globalization/RegionFactory.cs
|
TIKSN.Core/Globalization/RegionFactory.cs
|
using System;
using System.Globalization;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using TIKSN.Data.Cache.Memory;
namespace TIKSN.Globalization
{
public class RegionFactory : MemoryCacheDecoratorBase<RegionInfo>, IRegionFactory
{
public RegionFactory(IMemoryCache memoryCache, IOptions<MemoryCacheDecoratorOptions> genericOptions,
IOptions<MemoryCacheDecoratorOptions<RegionInfo>> specificOptions) : base(memoryCache, genericOptions,
specificOptions)
{
}
public RegionInfo Create(string name)
{
var cacheKey = Tuple.Create(entityType, name);
return this.GetFromMemoryCache(cacheKey, () => new RegionInfo(name));
}
}
}
|
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using System;
using System.Globalization;
using TIKSN.Data.Cache.Memory;
namespace TIKSN.Globalization
{
public class RegionFactory : MemoryCacheDecoratorBase<RegionInfo>, IRegionFactory
{
public RegionFactory(IMemoryCache memoryCache, IOptions<MemoryCacheDecoratorOptions> genericOptions, IOptions<MemoryCacheDecoratorOptions<RegionInfo>> specificOptions) : base(memoryCache, genericOptions, specificOptions)
{
}
public RegionInfo Create(string name)
{
var cacheKey = Tuple.Create(entityType, name);
return GetFromMemoryCache(cacheKey, () => new RegionInfo(name));
}
}
}
|
mit
|
C#
|
80a2104dd4ad361e3c75c28cd4d9c7b3bb99007f
|
Make contravariant.
|
Faithlife/FaithlifeUtility
|
src/Faithlife.Utility/IHasEquivalence.cs
|
src/Faithlife.Utility/IHasEquivalence.cs
|
namespace Faithlife.Utility
{
/// <summary>
/// Implemented by reference classes that do not want to implement IEquatable{T},
/// but do want to support some form of equivalence.
/// </summary>
/// <typeparam name="T">The class type.</typeparam>
/// <remarks>This interface is similar to IEquatable{T}, but avoids the baggage of
/// hash codes, overloaded equality operators, immutability requirements, etc.</remarks>
public interface IHasEquivalence<in T>
{
/// <summary>
/// Determines whether the object is equivalent to the specified object.
/// </summary>
/// <param name="other">The specified object.</param>
/// <returns>True if the object is equivalent to the specified object.</returns>
/// <remarks>As with equality (Object.Equals), equivalence should be reflexive, symmetric,
/// transitive, and consistent (as long as the objects in question are not modified). An object
/// should never be equivalent to null.</remarks>
bool IsEquivalentTo(T other);
}
}
|
namespace Faithlife.Utility
{
/// <summary>
/// Implemented by reference classes that do not want to implement IEquatable{T},
/// but do want to support some form of equivalence.
/// </summary>
/// <typeparam name="T">The class type.</typeparam>
/// <remarks>This interface is similar to IEquatable{T}, but avoids the baggage of
/// hash codes, overloaded equality operators, immutability requirements, etc.</remarks>
public interface IHasEquivalence<T>
{
/// <summary>
/// Determines whether the object is equivalent to the specified object.
/// </summary>
/// <param name="other">The specified object.</param>
/// <returns>True if the object is equivalent to the specified object.</returns>
/// <remarks>As with equality (Object.Equals), equivalence should be reflexive, symmetric,
/// transitive, and consistent (as long as the objects in question are not modified). An object
/// should never be equivalent to null.</remarks>
bool IsEquivalentTo(T other);
}
}
|
mit
|
C#
|
e99e98aad3879ddfcd4c7241dbda84f6a3df9943
|
Update AssemblyInfo.cs
|
sukona/Grapevine,scottoffen/Grapevine
|
src/Grapevine/Properties/AssemblyInfo.cs
|
src/Grapevine/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
// 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("Grapevine")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Scott Offen")]
[assembly: AssemblyProduct("Grapevine")]
[assembly: AssemblyCopyright("© 2014-2016 Scott Offen")]
[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("f6ac4c2c-4801-465c-8dd4-932dc1890747")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0.195")]
[assembly: AssemblyFileVersion("4.0.0.195")]
[assembly: InternalsVisibleTo("Grapevine.Tests")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
// 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("Grapevine")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Scott Offen")]
[assembly: AssemblyProduct("Grapevine")]
[assembly: AssemblyCopyright("© 2014-2016 Scott Offen")]
[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("f6ac4c2c-4801-465c-8dd4-932dc1890747")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0.194")]
[assembly: AssemblyFileVersion("4.0.0.194")]
[assembly: InternalsVisibleTo("Grapevine.Tests")]
|
apache-2.0
|
C#
|
d09f157ad5beb24ac405d96e640ea8c09d59b834
|
refactor dfmengine.cs
|
DuncanmaMSFT/docfx,sergey-vershinin/docfx,dotnet/docfx,hellosnow/docfx,hellosnow/docfx,928PJY/docfx,928PJY/docfx,pascalberger/docfx,hellosnow/docfx,pascalberger/docfx,superyyrrzz/docfx,dotnet/docfx,LordZoltan/docfx,dotnet/docfx,LordZoltan/docfx,sergey-vershinin/docfx,superyyrrzz/docfx,LordZoltan/docfx,superyyrrzz/docfx,928PJY/docfx,pascalberger/docfx,LordZoltan/docfx,sergey-vershinin/docfx,DuncanmaMSFT/docfx
|
src/Microsoft.DocAsCode.Dfm/DfmEngine.cs
|
src/Microsoft.DocAsCode.Dfm/DfmEngine.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.Dfm
{
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.DocAsCode.MarkdownLite;
using Microsoft.DocAsCode.Utility;
public class DfmEngine : MarkdownEngine
{
public DfmEngine(IMarkdownContext context, IMarkdownTokenRewriter rewriter, object renderer, Options options)
: base(context, rewriter, renderer, options, new Dictionary<string, LinkObj>())
{
}
public string Markup(string src, string path)
{
if (string.IsNullOrEmpty(src) && string.IsNullOrEmpty(path)) return string.Empty;
// bug : Environment.CurrentDirectory = c:\a, path = d:\b, MakeRelativePath is not work ...
path = PathUtility.MakeRelativePath(Environment.CurrentDirectory, path);
return InternalMarkup(src, ImmutableStack<string>.Empty.Push(path));
}
internal string InternalMarkup(string src, ImmutableStack<string> parents) =>
InternalMarkup(src, Context.SetFilePathStack(parents));
internal string InternalMarkup(string src, IMarkdownContext context) =>
Mark(Normalize(src), context).ToString();
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.Dfm
{
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.DocAsCode.MarkdownLite;
using Microsoft.DocAsCode.Utility;
public class DfmEngine : MarkdownEngine
{
public DfmEngine(IMarkdownContext context, IMarkdownTokenRewriter rewriter, object renderer, Options options)
: base(context, rewriter, renderer, options, new Dictionary<string, LinkObj>())
{
}
public string Markup(string src, string path)
{
if (string.IsNullOrEmpty(src) && string.IsNullOrEmpty(path)) return string.Empty;
// bug : Environment.CurrentDirectory = c:\a, path = d:\b, MakeRelativePath is not work ...
path = PathUtility.MakeRelativePath(Environment.CurrentDirectory, path);
return InternalMarkup(src, ImmutableStack<string>.Empty.Push(path));
}
public string InternalMarkup(string src, ImmutableStack<string> parents)
{
DfmEngine engine = new DfmEngine(Context, Rewriter, Renderer, Options);
return Mark(Normalize(src), Context.SetFilePathStack(parents)).ToString();
}
public string InternalMarkup(string src, IMarkdownContext context)
{
DfmEngine engine = new DfmEngine(context, Rewriter, Renderer, Options);
return Mark(Normalize(src), context).ToString();
}
}
}
|
mit
|
C#
|
8d2bcf9ad77d0e91d92b7b6cc1be4526c15b8206
|
fix copy & paste typo
|
dnauck/Portable.Licensing,dnauck/Portable.Licensing,dreamrain21/Portable.Licensing,dreamrain21/Portable.Licensing
|
src/Portable.Licensing/Model/Customer.cs
|
src/Portable.Licensing/Model/Customer.cs
|
//
// Copyright © 2012 - 2013 Nauck IT KG http://www.nauck-it.de
//
// Author:
// Daniel Nauck <d.nauck(at)nauck-it.de>
//
// 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 Portable.Licensing.Model
{
/// <summary>
/// The customer of a <see cref="ILicense"/>.
/// </summary>
internal class Customer : ModelBase, ICustomer
{
/// <summary>
/// Initializes a new instance of the <see cref="Customer"/> class.
/// </summary>
public Customer()
: base("Customer")
{
}
/// <summary>
/// Gets or sets the Name of this <see cref="Customer"/>.
/// </summary>
public new string Name
{
get { return GetTag("Name"); }
set { SetTag("Name", value); }
}
/// <summary>
/// Gets or sets the Email of this <see cref="Customer"/>.
/// </summary>
public string Email
{
get { return GetTag("Email"); }
set { SetTag("Email", value); }
}
}
}
|
//
// Copyright © 2012 - 2013 Nauck IT KG http://www.nauck-it.de
//
// Author:
// Daniel Nauck <d.nauck(at)nauck-it.de>
//
// 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 Portable.Licensing.Model
{
/// <summary>
/// The customer of a <see cref="ILicense"/>.
/// </summary>
internal class Customer : ModelBase, ICustomer
{
/// <summary>
/// Initializes a new instance of the <see cref="Customer"/> class.
/// </summary>
public Customer()
: base("Customer")
{
}
/// <summary>
/// Gets or sets the Name of this <see cref="Customer"/>.
/// </summary>
public new string Name
{
get { return GetTag("Name"); }
set { SetTag("Name", value); }
}
/// <summary>
/// Gets or sets the Email of this <see cref="Customer"/>.
/// </summary>
public string Email
{
get { return GetTag("Name"); }
set { SetTag("Name", value); }
}
}
}
|
mit
|
C#
|
2c33a9ca8dea47e8837d2826573e584447ca213f
|
Update Palindrome.cs
|
michaeljwebb/Algorithm-Practice
|
Other/Palindrome.cs
|
Other/Palindrome.cs
|
//Check to see if given string is a palindrome. Return true or false.
using System;
using System.Collections.Generic;
public class Palindrome
{
public static void Main()
{
string testString = "racecar";
Palindrome(testString);
}
public static void Palindrome(string s){
string result = "";
char[] cArray = s.ToCharArray();
for(int i = cArray.Length - 1; i >= 0; i--){
result += cArray[i];
}
if(result == s){
Console.WriteLine(result + " true");
}
else if(result != s){
Console.WriteLine(result + " false");
}
}
}
|
//Check to see if given string is a palindrome. Return true or false.
//Not completed
using System;
using System.Collections.Generic;
public class Test
{
public static void Main()
{
string testString = "racecar";
Palindrome(testString);
}
public static string Palindrome(string s){
Dictionary<int,int> _pCount = new Dictionary<int,int>();
int isOdd = 0;
char[] cArray = s.ToCharArray();
for(int i = 0; i < cArray.Length; i++){
if(!_pCount.ContainsKey(cArray[i])){
_pCount.Add(cArray[i], 1);
}
else{
int tempCount = _pCount[cArray[i]];
tempCount++;
if(tempCount % 1 == 0){
isOdd++;
}
if(isOdd > 1){
Console.WriteLine(isOdd + " false");
}
else if(isOdd <= 1){
Console.WriteLine(isOdd + " true");
}
}
}
return isOdd.ToString();
}
}
|
mit
|
C#
|
83158472603dffc9f37b3e0ddeaf5204b552a9e1
|
Correct order of parameters
|
peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework
|
osu.Framework.Tests/Platform/TrackBassTest.cs
|
osu.Framework.Tests/Platform/TrackBassTest.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using ManagedBass;
using NUnit.Framework;
using osu.Framework.Audio.Track;
using osu.Framework.IO.Stores;
namespace osu.Framework.Tests.Platform
{
[TestFixture]
public class TrackBassTest
{
private readonly TrackBass track;
public TrackBassTest()
{
// Initialize bass with no audio to make sure the test remains consistent even if there is no audio device.
Bass.Init(0);
var resources = new DllResourceStore("osu.Framework.Tests.dll");
var fileStream = resources.GetStream("Resources.Tracks.sample-track.mp3");
track = new TrackBass(fileStream);
}
[SetUp]
public void Setup()
{
#pragma warning disable 4014
track.SeekAsync(1000);
#pragma warning restore 4014
track.Update();
Assert.AreEqual(1000, track.CurrentTime);
}
/// <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()
{
#pragma warning disable 4014
track.SeekAsync(track.Length);
#pragma warning restore 4014
track.Update();
Assert.AreEqual(1000, track.CurrentTime);
}
/// <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()
{
#pragma warning disable 4014
track.SeekAsync(track.Length - 1);
#pragma warning restore 4014
track.StartAsync();
track.Update();
Thread.Sleep(50);
track.Update();
Assert.IsFalse(track.IsRunning);
Assert.AreEqual(track.Length, track.CurrentTime);
track.StartAsync();
track.Update();
Assert.AreEqual(track.Length, track.CurrentTime);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using ManagedBass;
using NUnit.Framework;
using osu.Framework.Audio.Track;
using osu.Framework.IO.Stores;
namespace osu.Framework.Tests.Platform
{
[TestFixture]
public class TrackBassTest
{
private readonly TrackBass track;
public TrackBassTest()
{
// Initialize bass with no audio to make sure the test remains consistent even if there is no audio device.
Bass.Init(0);
var resources = new DllResourceStore("osu.Framework.Tests.dll");
var fileStream = resources.GetStream("Resources.Tracks.sample-track.mp3");
track = new TrackBass(fileStream);
}
[SetUp]
public void Setup()
{
#pragma warning disable 4014
track.SeekAsync(1000);
#pragma warning restore 4014
track.Update();
Assert.AreEqual(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()
{
#pragma warning disable 4014
track.SeekAsync(track.Length);
#pragma warning restore 4014
track.Update();
Assert.AreEqual(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()
{
#pragma warning disable 4014
track.SeekAsync(track.Length - 1);
#pragma warning restore 4014
track.StartAsync();
track.Update();
Thread.Sleep(50);
track.Update();
Assert.IsFalse(track.IsRunning);
Assert.AreEqual(track.CurrentTime, track.Length);
track.StartAsync();
track.Update();
Assert.AreEqual(track.CurrentTime, track.Length);
}
}
}
|
mit
|
C#
|
75b3881c32f6761cb9ae22d1584345581dee5680
|
Update KymPhillpotts.cs
|
beraybentesen/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,beraybentesen/planetxamarin,MabroukENG/planetxamarin
|
src/Firehose.Web/Authors/KymPhillpotts.cs
|
src/Firehose.Web/Authors/KymPhillpotts.cs
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
public class KymPhillpotts : IWorkAtXamarinOrMicrosoft
{
public string FirstName => "Kym";
public string LastName => "Phillpotts";
public string ShortBioOrTagLine => "is one of the Xamarin University instructors";
public string StateOrRegion => "Melbourne, Australia";
public string EmailAddress => "kphillpotts@gmail.com";
public string TwitterHandle => "kphillpotts";
public string GravatarHash => "";
public Uri WebSite => new Uri("http://kymphillpotts.com/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://kymphillpotts.com/rss/"); }
}
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(-37.8136280, 144.9630580);
}
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
public class KymPhillpotts : IWorkAtXamarinOrMicrosoft
{
public string FirstName => "Kym";
public string LastName => "Phillpotts";
public string ShortBioOrTagLine => "instructor at Xamarin University";
public string StateOrRegion => "Melbourne, Australia";
public string EmailAddress => "kphillpotts@gmail.com";
public string TwitterHandle => "kphillpotts";
public string GravatarHash => "";
public Uri WebSite => new Uri("http://kymphillpotts.com/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://kymphillpotts.com/rss/"); }
}
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(-37.8136280, 144.9630580);
}
|
mit
|
C#
|
8adcb812bad78aa2dbc89837315dffe11ff4f867
|
Use Generic monospace font family for DOCX
|
GetTabster/Tabster
|
Plugins/FileTypes/WordDoc/WordDocExporter.cs
|
Plugins/FileTypes/WordDoc/WordDocExporter.cs
|
#region
using System;
using System.Drawing;
using Novacode;
using Tabster.Data;
using Tabster.Data.Processing;
#endregion
namespace WordDoc
{
public class WordDocExporter : ITablatureFileExporter
{
public WordDocExporter()
{
FileType = new FileType("Microsoft Office Open XML Format File", ".docx");
}
#region Implementation of ITablatureFileExporter
public FileType FileType { get; private set; }
public Version Version
{
get { return new Version("1.0"); }
}
public void Export(ITablatureFile file, string fileName, TablatureFileExportArguments args)
{
using (var document = DocX.Create(fileName))
{
var p = document.InsertParagraph();
p.Append(file.Contents).Font(FontFamily.GenericMonospace).FontSize(9);
document.Save();
}
}
#endregion
}
}
|
#region
using System;
using System.Drawing;
using Novacode;
using Tabster.Data;
using Tabster.Data.Processing;
#endregion
namespace WordDoc
{
public class WordDocExporter : ITablatureFileExporter
{
public WordDocExporter()
{
FileType = new FileType("Microsoft Office Open XML Format File", ".docx");
}
#region Implementation of ITablatureFileExporter
public FileType FileType { get; private set; }
public Version Version
{
get { return new Version("1.0"); }
}
public void Export(ITablatureFile file, string fileName)
{
using (var document = DocX.Create(fileName))
{
var p = document.InsertParagraph();
p.Append(file.Contents).Font(new FontFamily("Courier New")).FontSize(9);
document.Save();
}
}
#endregion
}
}
|
apache-2.0
|
C#
|
750f7469ca7c87ae3eed7e7d4658c3550721c11d
|
Correct BID_ASK Description
|
qusma/ib-csharp,sebfia/ib-csharp,krs43/ib-csharp
|
Krs.Ats.IBNet/Enums/HistoricalDataType.cs
|
Krs.Ats.IBNet/Enums/HistoricalDataType.cs
|
using System;
using System.ComponentModel;
namespace Krs.Ats.IBNet
{
/// <summary>
/// Historical Data Request Return Types
/// </summary>
[Serializable()]
public enum HistoricalDataType
{
/// <summary>
/// Return Trade data only
/// </summary>
[Description("TRADES")]
Trades,
/// <summary>
/// Return the mid point between the bid and ask
/// </summary>
[Description("MIDPOINT")]
Midpoint,
/// <summary>
/// Return Bid Prices only
/// </summary>
[Description("BID")]
Bid,
/// <summary>
/// Return ask prices only
/// </summary>
[Description("ASK")]
Ask,
/// <summary>
/// Return Bid / Ask price only
/// </summary>
[Description("BID_ASK")]
BidAsk,
}
}
|
using System;
using System.ComponentModel;
namespace Krs.Ats.IBNet
{
/// <summary>
/// Historical Data Request Return Types
/// </summary>
[Serializable()]
public enum HistoricalDataType
{
/// <summary>
/// Return Trade data only
/// </summary>
[Description("TRADES")]
Trades,
/// <summary>
/// Return the mid point between the bid and ask
/// </summary>
[Description("MIDPOINT")]
Midpoint,
/// <summary>
/// Return Bid Prices only
/// </summary>
[Description("BID")]
Bid,
/// <summary>
/// Return ask prices only
/// </summary>
[Description("ASK")]
Ask,
/// <summary>
/// Return Bid / Ask price only
/// </summary>
[Description("BID/ASK")]
BidAsk,
}
}
|
mit
|
C#
|
b4dffcd9194527c7b02f8fcb0302bfd98dbbe0f5
|
add the proper request methods
|
tparnell8/Untappd.Net,tparnell8/Untappd.Net,rodkings/Untappd.Net,rodkings/Untappd.Net
|
src/Untappd.Net/Request/RepositoryPost.cs
|
src/Untappd.Net/Request/RepositoryPost.cs
|
using System.Threading.Tasks;
using Untappd.Net.Client;
namespace Untappd.Net.Request
{
public partial class Repository
{
/// <summary>
/// do a post with actions
/// </summary>
/// <param name="credentials"></param>
/// <param name="action"></param>
/// <returns>returns dynamic since often the return doesn't matter</returns>
public dynamic Post(IAuthenticatedUntappdCredentials credentials, IAction action)
{
ConfigureRequest(action.EndPoint, action.BodyParameters, action.RequestMethod);
Request.AddParameter("access_token", credentials.AccessToken);
return ExecuteRequest<dynamic>();
}
/// <summary>
/// do a post with actions, Async!
/// </summary>
/// <param name="credentials"></param>
/// <param name="action"></param>
/// <returns>returns dynamic since often the return doesn't matter</returns>
public Task<dynamic> PostAsync(IAuthenticatedUntappdCredentials credentials, IAction action)
{
ConfigureRequest(action.EndPoint, action.BodyParameters, action.RequestMethod);
Request.AddParameter("access_token", credentials.AccessToken);
return ExecuteRequestAsync<dynamic>();
}
}
}
|
using System.Threading.Tasks;
using Untappd.Net.Client;
namespace Untappd.Net.Request
{
public partial class Repository
{
/// <summary>
/// do a post with actions
/// </summary>
/// <param name="credentials"></param>
/// <param name="action"></param>
/// <returns>returns dynamic since often the return doesn't matter</returns>
public dynamic Post(IAuthenticatedUntappdCredentials credentials, IAction action)
{
ConfigureRequest(action.EndPoint, action.BodyParameters);
Request.AddParameter("access_token", credentials.AccessToken);
return ExecuteRequest<dynamic>();
}
/// <summary>
/// do a post with actions, Async!
/// </summary>
/// <param name="credentials"></param>
/// <param name="action"></param>
/// <returns>returns dynamic since often the return doesn't matter</returns>
public Task<dynamic> PostAsync(IAuthenticatedUntappdCredentials credentials, IAction action)
{
ConfigureRequest(action.EndPoint, action.BodyParameters);
Request.AddParameter("access_token", credentials.AccessToken);
return ExecuteRequestAsync<dynamic>();
}
}
}
|
mit
|
C#
|
058889d6a44ee9525b0cad9a5ea0f893881f3f2c
|
add RotateRight(), RotateLeft() extension tests
|
martinlindhe/Punku
|
PunkuTests/Extensions/ByteArrayExtensions.cs
|
PunkuTests/Extensions/ByteArrayExtensions.cs
|
using System;
using System.Text;
using NUnit.Framework;
using Punku;
[TestFixture]
[Category ("Extensions")]
public class Extensions_ByteArray
{
[Test]
public void DosString01 ()
{
byte[] x = { (byte)'a', (byte)'b', (byte)'c', (byte)'$' };
Assert.AreEqual (
x.ToDosString (),
"abc"
);
}
[Test]
public void DosString02 ()
{
byte[] x = { (byte)'$' };
Assert.AreEqual (
x.ToDosString (),
""
);
}
[Test]
public void DosString03 ()
{
byte[] x = { 0 };
Assert.AreEqual (
x.ToDosString (),
"\u0000"
);
}
[Test]
public void CString01 ()
{
byte[] x = { (byte)'a', (byte)'b', (byte)'c' };
Assert.AreEqual (
x.ToCString (),
"abc"
);
}
[Test]
public void CString02 ()
{
byte[] x = { (byte)'a', (byte)'b', (byte)'c', 0, (byte)'d' };
Assert.AreEqual (
x.ToCString (),
"abc"
);
}
[Test]
public void HexString01 ()
{
byte[] x = { 1, 2, 3 };
Assert.AreEqual (
x.ToHexString (),
"010203"
);
}
[Test]
public void HexString02 ()
{
byte[] x = { 1, 2, 3, 0, 4 };
Assert.AreEqual (
x.ToHexString (),
"0102030004"
);
}
[Test]
public void RotateRight01 ()
{
byte[] x = { (byte)'a', (byte)'b', (byte)'c' };
Assert.AreEqual (
x.RotateRight (1),
new byte[] { (byte)'b', (byte)'c', (byte)'d' }
);
}
[Test]
public void RotateLeft01 ()
{
byte[] x = { (byte)'c', (byte)'d', (byte)'e' };
Assert.AreEqual (
x.RotateLeft (2),
new byte[] { (byte)'a', (byte)'b', (byte)'c' }
);
}
}
|
using System;
using System.Text;
using NUnit.Framework;
using Punku;
[TestFixture]
[Category ("Extensions")]
public class Extensions_ByteArray
{
[Test]
public void DosString01 ()
{
byte[] x = { (byte)'a', (byte)'b', (byte)'c', (byte)'$' };
Assert.AreEqual (
x.ToDosString (),
"abc"
);
}
[Test]
public void DosString02 ()
{
byte[] x = { (byte)'$' };
Assert.AreEqual (
x.ToDosString (),
""
);
}
[Test]
public void DosString03 ()
{
byte[] x = { 0 };
Assert.AreEqual (
x.ToDosString (),
"\u0000"
);
}
[Test]
public void CString01 ()
{
byte[] x = { (byte)'a', (byte)'b', (byte)'c' };
Assert.AreEqual (
x.ToCString (),
"abc"
);
}
[Test]
public void CString02 ()
{
byte[] x = { (byte)'a', (byte)'b', (byte)'c', 0, (byte)'d' };
Assert.AreEqual (
x.ToCString (),
"abc"
);
}
[Test]
public void HexString01 ()
{
byte[] x = { 1, 2, 3 };
Assert.AreEqual (
x.ToHexString (),
"010203"
);
}
[Test]
public void HexString02 ()
{
byte[] x = { 1, 2, 3, 0, 4 };
Assert.AreEqual (
x.ToHexString (),
"0102030004"
);
}
}
|
mit
|
C#
|
302756337922442a80a0e16028d247c449a12054
|
Add custom exception for PageFragmentWatcher
|
cezarypiatek/MaintainableSelenium,cezarypiatek/Tellurium,cezarypiatek/MaintainableSelenium,cezarypiatek/Tellurium,cezarypiatek/Tellurium,cezarypiatek/MaintainableSelenium
|
Src/MvcPages/WebPages/PageFragmentWatcher.cs
|
Src/MvcPages/WebPages/PageFragmentWatcher.cs
|
using System;
using System.Linq.Expressions;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using Tellurium.MvcPages.SeleniumUtils;
using Tellurium.MvcPages.WebPages.WebForms;
namespace Tellurium.MvcPages.WebPages
{
public class PageFragmentWatcher
{
private readonly RemoteWebDriver driver;
private readonly string containerId;
public PageFragmentWatcher(RemoteWebDriver driver, string containerId)
{
this.driver = driver;
this.containerId = containerId;
}
public void StartWatching()
{
driver.ExecuteScript(@"var $$expectedId = arguments[0];
__selenium_observers__ = window.__selenium_observers__ || {};
(function(){
var target = document.getElementById($$expectedId);
__selenium_observers__[$$expectedId] = {
observer: new MutationObserver(function(mutations) {
__selenium_observers__[$$expectedId].occured = true;
__selenium_observers__[$$expectedId].observer.disconnect();
}),
occured:false
};
var config = { attributes: true, childList: true, characterData: true, subtree: true };
__selenium_observers__[$$expectedId].observer.observe(target, config);
})();", containerId);
}
public void WaitForChange(int timeout = 30)
{
try
{
driver.WaitUntil(timeout,
d =>
(bool)
driver.ExecuteScript(
"return window.__selenium_observers__ && window.__selenium_observers__[arguments[0]].occured;",
containerId));
}
catch (WebDriverTimeoutException ex)
{
throw new CannotObserveAnyChanges(containerId, ex);
}
}
}
public class CannotObserveAnyChanges:ApplicationException
{
public CannotObserveAnyChanges(string containerId, Exception innerException)
:base($"No changes has been obverved for element with id '{containerId}'", innerException)
{
}
}
}
|
using OpenQA.Selenium.Remote;
using Tellurium.MvcPages.SeleniumUtils;
namespace Tellurium.MvcPages.WebPages
{
public class PageFragmentWatcher
{
private readonly RemoteWebDriver driver;
private readonly string containerId;
public PageFragmentWatcher(RemoteWebDriver driver, string containerId)
{
this.driver = driver;
this.containerId = containerId;
}
public void StartWatching()
{
driver.ExecuteScript(@"var $$expectedId = arguments[0];
__selenium_observers__ = window.__selenium_observers__ || {};
(function(){
var target = document.getElementById($$expectedId);
__selenium_observers__[$$expectedId] = {
observer: new MutationObserver(function(mutations) {
__selenium_observers__[$$expectedId].occured = true;
__selenium_observers__[$$expectedId].observer.disconnect();
}),
occured:false
};
var config = { attributes: true, childList: true, characterData: true, subtree: true };
__selenium_observers__[$$expectedId].observer.observe(target, config);
})();", containerId);
}
public void WaitForChange(int timeout = 30)
{
driver.WaitUntil(timeout, d => (bool)driver.ExecuteScript("return window.__selenium_observers__ && window.__selenium_observers__[arguments[0]].occured;", containerId));
}
}
}
|
mit
|
C#
|
54f07139db1fe29849e83cf660852e4f5a512fcb
|
Improve default payment method dropdown text
|
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
|
BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs
|
BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Payments;
using BTCPayServer.Services;
using BTCPayServer.Validation;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace BTCPayServer.Models.StoreViewModels
{
public class CheckoutExperienceViewModel
{
public class Format
{
public string Name { get; set; }
public string Value { get; set; }
public PaymentMethodId PaymentId { get; set; }
}
public SelectList CryptoCurrencies { get; set; }
public SelectList Languages { get; set; }
[Display(Name = "Default payment method on checkout")]
public string DefaultPaymentMethod { get; set; }
[Display(Name = "Default language on checkout")]
public string DefaultLang { get; set; }
[Display(Name = "Link to a custom CSS stylesheet")]
[Uri]
public string CustomCSS { get; set; }
[Display(Name = "Link to a custom logo")]
[Uri]
public string CustomLogo { get; set; }
[Display(Name = "Custom HTML title to display on Checkout page")]
public string HtmlTitle { get; set; }
[Display(Name = "Requires a refund email")]
public bool RequiresRefundEmail { get; set; }
[Display(Name = "Do not propose on chain payment if the value of the invoice is below...")]
[MaxLength(20)]
public string OnChainMinValue { get; set; }
[Display(Name = "Do not propose lightning payment if value of the invoice is above...")]
[MaxLength(20)]
public string LightningMaxValue { get; set; }
[Display(Name = "Display lightning payment amounts in Satoshis")]
public bool LightningAmountInSatoshi { get; set; }
public void SetLanguages(LanguageService langService, string defaultLang)
{
defaultLang = langService.GetLanguages().Any(language => language.Code == defaultLang) ? defaultLang : "en";
var choices = langService.GetLanguages().Select(o => new Format() { Name = o.DisplayName, Value = o.Code }).ToArray();
var chosen = choices.FirstOrDefault(f => f.Value == defaultLang) ?? choices.FirstOrDefault();
Languages = new SelectList(choices, nameof(chosen.Value), nameof(chosen.Name), chosen);
DefaultLang = chosen.Value;
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Payments;
using BTCPayServer.Services;
using BTCPayServer.Validation;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace BTCPayServer.Models.StoreViewModels
{
public class CheckoutExperienceViewModel
{
public class Format
{
public string Name { get; set; }
public string Value { get; set; }
public PaymentMethodId PaymentId { get; set; }
}
public SelectList CryptoCurrencies { get; set; }
public SelectList Languages { get; set; }
[Display(Name = "Default the default payment method on checkout")]
public string DefaultPaymentMethod { get; set; }
[Display(Name = "Default language on checkout")]
public string DefaultLang { get; set; }
[Display(Name = "Link to a custom CSS stylesheet")]
[Uri]
public string CustomCSS { get; set; }
[Display(Name = "Link to a custom logo")]
[Uri]
public string CustomLogo { get; set; }
[Display(Name = "Custom HTML title to display on Checkout page")]
public string HtmlTitle { get; set; }
[Display(Name = "Requires a refund email")]
public bool RequiresRefundEmail { get; set; }
[Display(Name = "Do not propose on chain payment if the value of the invoice is below...")]
[MaxLength(20)]
public string OnChainMinValue { get; set; }
[Display(Name = "Do not propose lightning payment if value of the invoice is above...")]
[MaxLength(20)]
public string LightningMaxValue { get; set; }
[Display(Name = "Display lightning payment amounts in Satoshis")]
public bool LightningAmountInSatoshi { get; set; }
public void SetLanguages(LanguageService langService, string defaultLang)
{
defaultLang = langService.GetLanguages().Any(language => language.Code == defaultLang) ? defaultLang : "en";
var choices = langService.GetLanguages().Select(o => new Format() { Name = o.DisplayName, Value = o.Code }).ToArray();
var chosen = choices.FirstOrDefault(f => f.Value == defaultLang) ?? choices.FirstOrDefault();
Languages = new SelectList(choices, nameof(chosen.Value), nameof(chosen.Name), chosen);
DefaultLang = chosen.Value;
}
}
}
|
mit
|
C#
|
522af2a4bf8a50a9c59c4edb6c8aa9c9c008a1c2
|
Add assembly informational version
|
CalebChalmers/NetworkMonitor
|
NetworkMonitor/Properties/AssemblyInfo.cs
|
NetworkMonitor/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Network Monitor")]
[assembly: AssemblyDescription("A simple application designed to show you basic network data.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Caleb Chalmers")]
[assembly: AssemblyProduct("Network Monitor")]
[assembly: AssemblyCopyright("Copyright © Caleb Chamers 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyInformationalVersion("1.0.0-rc1")]
[assembly: AssemblyVersion("1.0.0")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Network Monitor")]
[assembly: AssemblyDescription("A simple application designed to show you basic network data.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Caleb Chalmers")]
[assembly: AssemblyProduct("Network Monitor")]
[assembly: AssemblyCopyright("Copyright © Caleb Chamers 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyVersion("1.0.0")]
|
mit
|
C#
|
f08c40e861fb7f2c6875633c992b88508ee828f6
|
Remove Debugging Code
|
charlenni/Mapsui,charlenni/Mapsui
|
Samples/Mapsui.Samples.iOS/AppDelegate.cs
|
Samples/Mapsui.Samples.iOS/AppDelegate.cs
|
namespace Mapsui.Samples.iOS;
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate {
public override UIWindow? Window {
get;
set;
}
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
// create a new window instance based on the screen size
Window = new UIWindow (UIScreen.MainScreen.Bounds);
// create a UIViewController with a single UILabel
var vc = new ViewController();
Window.RootViewController = vc;
// make the window visible
Window.MakeKeyAndVisible ();
return true;
}
}
|
namespace Mapsui.Samples.iOS;
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate {
public override UIWindow? Window {
get;
set;
}
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
Mapsui.UI.iOS.MapControl.UseGPU = true;
// create a new window instance based on the screen size
Window = new UIWindow (UIScreen.MainScreen.Bounds);
// create a UIViewController with a single UILabel
var vc = new ViewController();
Window.RootViewController = vc;
// make the window visible
Window.MakeKeyAndVisible ();
return true;
}
}
|
mit
|
C#
|
0b49d9fac554c1d7935f91f6277a1b3ef402c21a
|
Tweak white value
|
Sirush/UDHBot,Sirush/UDHBot
|
Skin/RectangleSampleAvatarColorSkinModule.cs
|
Skin/RectangleSampleAvatarColorSkinModule.cs
|
using DiscordBot.Domain;
using ImageMagick;
namespace DiscordBot.Skin
{
/// <summary>
/// Fill the background with the color based on the pfp
/// </summary>
public class RectangleSampleAvatarColorSkinModule : ISkinModule
{
public int StartX { get; set; }
public int StartY { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public bool WhiteFix { get; set; }
public string DefaultColor { get; set; }
public string Type { get; set; }
public Drawables GetDrawables(ProfileData data)
{
MagickColor color = DetermineColor(data.Picture);
return new Drawables()
.FillColor(color)
.Rectangle(StartX, StartY, StartX + Width, StartY + Height);
}
private MagickColor DetermineColor(MagickImage dataPicture)
{
//basically we let magick to choose what the main color by resizing to 1x1
MagickImage copy = new MagickImage(dataPicture);
copy.Resize(1, 1);
MagickColor color = copy.GetPixels()[0, 0].ToColor();
if (WhiteFix && color.R + color.G + color.B > 650)
color = new MagickColor(DefaultColor);
return color;
}
}
}
|
using DiscordBot.Domain;
using ImageMagick;
namespace DiscordBot.Skin
{
/// <summary>
/// Fill the background with the color based on the pfp
/// </summary>
public class RectangleSampleAvatarColorSkinModule : ISkinModule
{
public int StartX { get; set; }
public int StartY { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public bool WhiteFix { get; set; }
public string DefaultColor { get; set; }
public string Type { get; set; }
public Drawables GetDrawables(ProfileData data)
{
MagickColor color = DetermineColor(data.Picture);
return new Drawables()
.FillColor(color)
.Rectangle(StartX, StartY, StartX + Width, StartY + Height);
}
private MagickColor DetermineColor(MagickImage dataPicture)
{
//basically we let magick to choose what the main color by resizing to 1x1
MagickImage copy = new MagickImage(dataPicture);
copy.Resize(1, 1);
MagickColor color = copy.GetPixels()[0, 0].ToColor();
if (WhiteFix && color.R + color.G + color.B > 600)
color = new MagickColor(DefaultColor);
return color;
}
}
}
|
mit
|
C#
|
48da4b58f6a4927dd460b7808d2ece9fc56d1e9a
|
Fix points per octave
|
svenboulanger/SpiceSharp,svenboulanger/SpiceSharp
|
SpiceSharp/Simulations/Sweeps/OctaveSweep.cs
|
SpiceSharp/Simulations/Sweeps/OctaveSweep.cs
|
using System;
using System.Collections.Generic;
using SpiceSharp.Diagnostics;
namespace SpiceSharp.Simulations.Sweeps
{
public class OctaveSweep : Sweep<double>
{
/// <summary>
/// Get the points
/// </summary>
public override IEnumerable<double> Points
{
get
{
// Initialize
Current = Initial;
// Go through the points
for (int i = 0; i < Count; i++)
{
yield return Current;
// Go to the next point
Current = Current * freqDelta;
}
}
}
/// <summary>
/// Multiplication factor
/// </summary>
double freqDelta;
/// <summary>
/// Constructor
/// </summary>
/// <param name="initial">Initial value</param>
/// <param name="final">Final value</param>
/// <param name="steps">Steps per decade</param>
public OctaveSweep(double initial, double final, int steps)
{
if (final * initial <= 0)
throw new CircuitException("Invalid decade sweep from {0} to {1}".FormatString(initial, final));
Initial = initial;
Final = final;
freqDelta = Math.Exp(Math.Log(2.0) / steps);
Count = (int)Math.Floor(Math.Log(final / initial) / Math.Log(freqDelta) + 0.25) + 1;
}
}
}
|
using System;
using System.Collections.Generic;
using SpiceSharp.Diagnostics;
namespace SpiceSharp.Simulations.Sweeps
{
public class OctaveSweep : Sweep<double>
{
/// <summary>
/// Get the points
/// </summary>
public override IEnumerable<double> Points
{
get
{
// Initialize
Current = Initial;
// Go through the points
for (int i = 0; i < Count; i++)
{
yield return Current;
// Go to the next point
Current = Current * freqDelta;
}
}
}
/// <summary>
/// Multiplication factor
/// </summary>
double freqDelta;
/// <summary>
/// Constructor
/// </summary>
/// <param name="initial">Initial value</param>
/// <param name="final">Final value</param>
/// <param name="steps">Steps per decade</param>
public OctaveSweep(double initial, double final, int steps)
{
if (final * initial <= 0)
throw new CircuitException("Invalid decade sweep from {0} to {1}".FormatString(initial, final));
Initial = initial;
Final = final;
freqDelta = Math.Exp(Math.Log(10.0) / steps);
Count = (int)Math.Floor(Math.Log(final / initial) / Math.Log(freqDelta) + 0.25) + 1;
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.